diff -urN lib/microwindows/src/Arch.rules /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Arch.rules
--- lib/microwindows/src/Arch.rules	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Arch.rules	2005-02-21 16:13:38.000000000 +0100
@@ -0,0 +1,133 @@
+##############################################################################
+# Microwindows Architecture rules Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+#
+# This makefile should be placed at the top of a project hierarchy
+#
+# NOTE: The TOP environment variable should be set to that top directory
+##############################################################################
+
+# Platform dependent flags & definitions
+ifeq ($(ARCH), FREEBSD-X86)
+COMPILER = gcc
+CXX_COMPILER = g++
+TOOLSPREFIX = 
+DEFINES += -DLINUX=1 -DUNIX=1
+CFLAGS += -Wall $(OPTFLAGS)
+LDFLAGS +=
+endif
+
+
+ifeq ($(ARCH), LINUX-NATIVE)
+COMPILER = gcc
+CXX_COMPILER = g++
+TOOLSPREFIX =
+DEFINES += -DLINUX=1 -DUNIX=1
+CFLAGS += -Wall $(OPTFLAGS)
+LDFLAGS +=
+# include the following line for static libraries
+#LDFLAGS += -static
+endif
+
+ifeq ($(ARCH), LINUX-ARM)
+COMPILER = gcc
+CXX_COMPILER = g++
+TOOLSPREFIX = $(ARMTOOLSPREFIX)
+DEFINES += -DLINUX=1 -DUNIX=1
+CFLAGS += -Wall $(OPTFLAGS) -mstructure-size-boundary=8
+LDFLAGS +=
+endif
+
+ifeq ($(ARCH), LINUX-MIPS)
+COMPILER = gcc
+CXX_COMPILER = g++
+TOOLSPREFIX = $(MIPSTOOLSPREFIX)
+DEFINES += -DLINUX=1 -DUNIX=1
+CFLAGS += -msoft-float -s -Wall $(OPTFLAGS)
+LDFLAGS +=
+endif
+
+ifeq ($(ARCH), LINUX-POWERPC)
+COMPILER = gcc
+CXX_COMPILER = g++
+TOOLSPREFIX = $(POWERPCTOOLSPREFIX)
+DEFINES += -DLINUX=1 -DUNIX=1
+CFLAGS += -msoft-float -s -Wall $(OPTFLAGS)
+LDFLAGS +=
+endif
+
+ifeq ($(ARCH), LINUX-SH)
+COMPILER = gcc
+CXX_COMPILER = g++
+TOOLSPREFIX =$(SHTOOLSPREFIX)
+DEFINES += -DLINUX=1 -DUNIX=1
+CFLAGS += -m1 -m3 -Wall $(OPTFLAGS)
+LDFLAGS +=
+endif
+
+ifeq ($(ARCH), SOLARIS)
+# may require using cc if gcc not installed:
+COMPILER = gcc
+HOSTCC = gcc
+CXX_COMPILER = g++
+TOOLSPREFIX =
+DEFINES += -DUNIX=1 -DBIGENDIAN=1
+CFLAGS += $(OPTFLAGS)
+LDFLAGS += -lsocket -lnsl -lrt
+endif
+
+ifeq ($(ARCH), ELKS)
+COMPILER = bcc
+HOSTCC = gcc
+CXX_COMPILER =
+TOOLSPREFIX =
+INCLUDEDIRS += -I/usr/bcc/include -I/home/greg/net/elks/include
+DEFINES += -DELKS=1 -DUNIX=1 -Dconst= -Dvolatile=
+CFLAGS += -0 -ansi -O
+LDFLAGS +=
+endif
+
+ifeq ($(ARCH), DJGPP)
+COMPILER = gcc
+CXX_COMPILER = g++
+TOOLSPREFIX =
+DEFINES += -DDOS_DJGPP=1 -D_NAIVE_DOS_REGS=1 -DMSDOS=1
+CFLAGS += -Wall $(OPTFLAGS)
+LDFLAGS += -lgrx20
+endif
+
+ifeq ($(ARCH), RTEMS)
+COMPILER = gcc
+CXX_COMPILER = g++
+TOOLSPREFIX = $(RTEMSTOOLSPREFIX)
+INCLUDEDIRS += -I$(RTEMS_BUILD)/$(RTEMS_BSP)/lib/include \
+-I$(RTEMS_BUILD)/$(RTEMS_BSP)/lib/include/networking \
+-I$(RTEMS_BUILD)/$(RTEMS_BSP)/lib/include/sys
+DEFINES += -DUNIX=1
+CFLAGS += -O4 -Wall -Wno-unused -fasm -g \
+-B$(RTEMS_BUILD)/$(RTEMS_BSP)/lib/ -specs bsp_specs -qrtems
+endif
+
+
+#<ijsung: eCos>
+ifeq ($(ARCH), ECOS)
+
+COMPILER = gcc
+CXX_COMPILER = g++
+
+ifeq ($(PLATFORM), LINUX)
+TOOLSPREFIX = $(ECOSLINUXTOOLSPREFIX)
+endif
+
+ifeq ($(PLATFORM), ASSABET)
+TOOLSPREFIX = $(ECOSASSABETTOOLSPREFIX)
+endif
+
+HOSTCC = $(TOOLSPREFIX)$(COMPILER)
+DEFINES += -DECOS=1
+CFLAGS += -Wall $(OPTFLAGS) -nostdlib
+LDFLAGS += -L$(ECOSINSTALLPATH)/lib -Ttarget.ld
+ECOS = 1
+
+endif
+#</ijsung>
diff -urN lib/microwindows/src/BUGS /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/BUGS
--- lib/microwindows/src/BUGS	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/BUGS	2005-02-21 16:13:38.000000000 +0100
@@ -0,0 +1,30 @@
+There's still bugs with apps after closebox pressed
+
+GrReparentWindow must have parent mapped before call
+	or children of window being reparented get bad unmap counts...
+Check out if (height == 0 || ... ) code in engine/devfont.c: bad select
+There's still some bugs in the Arc/Pie code - see FLTK valuators demo
+
+fblin16 DrawArea driver is commented out for font display currently
+X11 runs out of colors on t1demo.sh
+
+SetWindowPos is broken for resize of child windows
+
+should BeginPaint incorporate the update region with current DC?
+WM_MOUSEMOVE shouldn't send hittest code like WM_NCMOUSEMOVE
+ATI cards in 16bpp mode: palette not setup properly
+PF_PALETTE emulation doesn't work well on X11 (use PF_TRUECOLOR0888)
+alpha blending is broken on X11
+cursor disappears with much blitting
+
+Non-client title bar not repainted properly on repaint
+
+repaint on VT switch doesn't work with client/server library
+Sleep api isn't accurate
+switch palette's on the fly from framebuffer identification
+
+BitBlt clips blit rectangle to source screen/memimage size
+Terminal emulator doesn't clip text on right side for some reason
+If closing last window, GetMessage/microwindows hangs if not exiting
+
+The ELKS microwin demo draws mouse droppings on screen
diff -urN lib/microwindows/src/CREDITS /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/CREDITS
--- lib/microwindows/src/CREDITS	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/CREDITS	2005-02-21 16:13:39.000000000 +0100
@@ -0,0 +1,46 @@
+Microwindows project
+Copyright (c) 1999-2000 Greg Haerr <greg@censoft.com>
+
+CREDITS
+Thanks to everyone who has contributed to this project.
+Some of the more active contributors are listed below.
+If I've missed you, please remind me or submit something!
+
+Contributors
+Engine				Greg Haerr, David Bell, Morten Rolland
+Win32 api			Greg Haerr
+Nano-X api			David Bell, Alan Cox, Alex Holden, Greg Haerr
+Nano-X window manager		Alex Holden, Greg Haerr
+Nano-X popup keyboard		Vladimir Cotfas, Jay Carlson, Greg Haerr
+Nano-X scribble handwriting	Greg Haerr
+Network code, Nano-X client lib	Greg Haerr, Alex Holden
+MIPS LinuxCE port, touch device	Brad LaRonde
+ELKS port			Greg Haerr, Al Riddoch
+NanoWidget set			Vidar Hokstad
+Bogl library			Ben Pfaff
+Fonts				Darran D. Rimron, Greg Haerr
+Font Subsystems			Greg Haerr, Martin Jolicoeur, Vidar Hokstad
+X11 driver			Tony Rogvall
+Portrait mode fb driver		Martin Jolicoeur
+BMP and JPEG file read/display	Martin Jolicoeur
+RTEMS port			Rosimildo daSilva
+DJGPP/GRX port			Victor Rogachev
+C++ objects framework		Chris Johns
+
+Contact Info
+Jay Carlson		<nop@nop.com>
+Vladimir Cotfas		<vladimircotfas@vtech.ca>
+Alan Cox		<alan@lxorguk.ukuu.org.uk>
+Greg Haerr		<greg@censoft.com>
+Vidar Hokstad		<vidarh@screenmedia.no> <vidar@hokstad.com>
+Alex Holden		<alex@linuxhacker.org>
+Brad LaRonde		<brad@ltc.com>
+Chris Johns		<ccj@acm.org>
+Martin Jolicoeur	<martinj@visuaide.com>
+Ben Pfaff		<pfaffben@debian.org>
+Al Riddoch		<ajr@ecs.soton.ac.uk>
+Darran D. Rimron	<darran@rimron.co.uk>
+Victor Rogachev		<rogach@sut.ru>
+Tony Rogvall		<tony@bluetail.com>
+Morten Rolland		<mortenro@screenmedia.no>
+Rosimildo daSilva	<rosimildo@xoommail.com>
diff -urN lib/microwindows/src/ChangeLog /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/ChangeLog
--- lib/microwindows/src/ChangeLog	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/ChangeLog	2005-02-21 16:13:38.000000000 +0100
@@ -0,0 +1,792 @@
+Version 0.89pre7 - 21st Jan 2001 - greg@censoft.com
+	* moved config.* files to Configs directory and added README
+	* moved caching devfont.c to devfont.caching.c (breaks ftdemo)
+	* added extensive gtkdoc sgml/html/pdf nano-X documentation from Alex
+	* wrote Xlib to Nano-X macro hdr file for easier porting (XtoNX.h)
+	* added Alex's improved server timeout routines (no alarms)
+	* converted demo3 to nxview image viewer
+	* added time field in GR_EVENT_BUTTON for double-click determination
+	* fixed fast window move blit bug with non-root child windows
+	* added GR_WM_PROPS_BORDERCOLOR
+	* added useful macro functions: GrSetWindowTitle,GrSetWindowBorderColor,
+		GrSetWindowBorderSize, GrSetWindowBackgroundColor
+	* ported xfreecell to nano-X
+	* added GrNewPixmapFromData to create pixmap from bitmap data
+	* added Alex's GrSetBackgroundPixmap, GrBell
+	* added Alex's cool screensaver app nsaver, GrSetScreenSaverTimeout
+	* added Alex's getselection/setselection demos,
+		Gr[GS]etSelectOwner, GrRequestClientData, GrSendClientData
+	* enhanced nxclock and ftdemo
+	* fix shared library bug w/GetSysCharHeight function
+	* fixed MwRegisterInput/Output/Except bug (Yang)
+	* fixed Arch.rules for Solaris 7
+	* fix antialiasing bug when both T1lib and Freetype enabled (Murphy)
+	* fixed GrReadArea offset bug (Dave Tubbs)
+	* added MWPF_TRUECOLOR555 for 16 bpp 5/5/5 packed pixels
+	* fixed PIXEL565TOCOLORVAL and PIXEL332TOCOLORVAL macros
+	* fixed 5/5/5 driver for ATI card
+Version 0.89pre6c (unreleased) 8th Dec 2000 - greg@censoft.com
+	* new scancode kbd driver: ESC never quits, pause/break quits
+		select with SCANKBD=Y in config (default)
+	* added Brent's changes for VxWorks port
+	* added PNG image decoding from Alex
+	* fixed GrGetNextEvent returning event twice when signal caught (Alex)
+	* fixed XPM loader errmsg on non-XPM images from Alex
+	* added launcher application from Alex
+	* added HAVE_PNM_SUPPORT for PBM,PGM,PPM ascii&binary images from Alex
+	* added ntetris game from Alex
+	* fixed FREETYPE_FONT_DIR in engine/Makefile
+	* added freetype font caching to devfont.c (experimental) (huge speedup)
+	* added -mstructure-size-boundary=8 for ARM compiles and structure bugs
+	* changed MOUSE_POSITION to ..._MOTION in scribble for better recognizer
+	* fixed nasty slow blitting code in X11 driver
+	* added USE_EXPOSE config option for XFree4.0 backing store expose fix
+	* added iPAQ scancode keyboard driver
+	* added YOPY mouse driver and YOPY build support
+	* fixed dropped events bug in client/server!!
+	* send UPDATE_MOVE to all children on window move
+	* finished fast screen blit move algorithm for topmost windows
+	* auto calculation of virtual screen size
+	* change GR_EVENT_MOUSE subwid to always be mouse window (Peter)
+	* added auto-repeat to scancode tty driver
+	* fixed buggy GrGetRegionBox
+	* fixed X11 screen->offscreen blit
+	* fixed blit with negative src clipping
+	* added GR_MODE_EXCLUDECHILDREN clip mode to GrSetGCMode
+	* added window resize to nanowm and #define OUTLINE_MOVE
+	* changed GrInjectPointerEvent visible arg semantics
+	* converted x11 kbd driver to scancode
+	* added MWKEY_* defines, changed kbd modifiers
+		removed GR_MODIFIER_*, GR_SPECIAL_*, GR_KEYSTROKE_* defines
+		api change: GR_EVENT_KEYSTROKE to return unicode only values
+		api change: GrInjectKeyboardEvent
+	* complete keyboard driver rewrite: scancode, up/down events
+	* ported Doom! to Microwindows
+	* fixed overlapping blit for 8/16 bpp
+	* added current mouse coords in SCREENINFO struct
+	* started on Wt widget set port
+Version 0.89pre6 - 12th Nov 2000 - greg@censoft.com
+	* added Peter's driver blit fix for dst in src rectangle
+	* added Scott's correct GdFillPoly routine (uses malloc/qsort)
+		works for irregular polygons, concave, convex with holes
+	* added config.ipaq for pre-built ipaq build configuration
+	* added -lm to LDFLAGS when T1LIB or FREETYPE is used
+	* added FLIP_MOUSE_IN_PORTRAIT_MODE #define to engine/devmouse.c
+	* added Vladimir's nxlsclients and nxev programs
+	* GrCopyArea optimization fix for windows with no eventclients (slider)
+	* added Kim's SH3 reversed order fblin4sh3.c driver
+	* added support for SuperH compilations (LINUX-SH)
+	* added Jordan's convxpm.perl xpm to rgb converter
+	* added Brent's alloca patch
+	* fix update map/unmap events sent only on actual unmap/map
+	* fix window manager to map parent before reparent for unmapcount bug
+	* allow GdStretchBlit to width/height of 0 without error
+	* remove GsError for GrNewPixmap of 0 width or height
+	* change to service all kbd data in single poll loop
+	* change low level clipping to always clip child windows
+	* fix server clear allocated pixmaps before drawing to them
+	* fix blit code after xor in X11 driver for nxterm
+Version 0.89pre5 - 2nd Nov 2000 - greg@censoft.com
+	* add GdCaptureScreen screen capture for later makebmp processing
+	* temp #define FASTJPEG in engine/devimage.c for 8bpp fast jpeg display
+	* free server images on client disconnect
+	* wrote experimental non-flick blit-move routine when window is topmost
+	* fixed GrCopyArea with offscreen source wid
+	* fixed UPDATE_MAP x, y, values
+	* fixed transparent color drawing in GdDrawImage,
+		unique color no longer required
+	* fix imagehdr free in GdFreeImage
+	* added xpm image support from Jordan, (HAVE_XPM_SUPPORT)
+	* added UPDATE_DESTROY update event subtype
+	* changed update map/unmap semantics: update sent on all child
+		windows of map/unmap
+	* send update unmap event on auto server-destroyed windows
+	* change GrDestroyWindow to send always send update unmap event
+	* change GR_EVENT_TYPE_CHLD_UPDATE message wid member, added subwid
+		now properly sends CHLD_UPDATE messages
+	* added GrDrawLines util function
+	* added virtual and workspace width/height GR_SCREEN_INFO members
+	* added GR_WM_PROPS_NOAUTORESIZE and GR_WM_PROPS_MAXIMIZE window props
+	* fixed cursor on when in source blit rectangle
+	* fixed GrCopyArea copy garbage on clipped src area,sends expose instead
+	* fix DestroyRegion code in GsDestroyClientResources
+	* added Kaben's clipping fix for GdBlit
+	* Kaben's clip region fix when alternating between on/offscreen windows
+	* remove GsError on bad GrCloseWindow
+	* fix negative text coordinate offsets for freetype
+	* consolidated GrNewWindow/GrNewInputWindow
+	* disallow auto-focus to windows with GR_PROPS_NOFOCUS set
+Version 0.89pre4 - 26th October 2000 - greg@censoft.com
+	* added aggregated expose events for better paint appearance
+	* added cleanapps Makefile entry
+	* fixed T1Lib Makefile.rules bug
+	* removed strdup definition for mips in nxscribble
+	* fixed constant timeout event returned when linked with server
+	* rewrote error handling completely, new GrDefaultErrorHandler,
+		GrSetErrorHandler type/semantics. Removed nanox/stubs.c
+	* don't revert to mouse enter/leave focus after window destroy once set
+	* fix GrCopyArea drawing on unmapped window crash
+	* fix crash on bad GrGetWMProperties call
+	* return all 0 info for any invalid id GrGet* functions
+	* fix GrGetWMProperties to return flags 0 on invalid window id
+	* free gc, region and font resources on client exit
+Version 0.89pre3 - 17th October 2000 - greg@censoft.com
+	* turned off alpha blending in X11 screen driver for 8bpp
+	* added Nano-X draw library nxPaintNCArea, nxDraw3dShadow, etc
+	* added Vladimir's GR_CLOSE_FIX in nanox/client.c fixing client hang bug
+	* fix for GrGetWindowInfo crashing Vtech after GrCloseWindow/ncPaint
+	* added NEC Harrier port from Century Software
+	* some include file changes for VxWorks port from Brent
+	* cleaned up nanowm window move/closebox/raisewindow routine and policy
+	* added GrNewWindowEx to specify title and props at window create time
+	* implemented window draw styles GR_WM_PROPS_APPWINDOW, APPFRAME,
+		BORDER, CAPTION, CLOSEBOX, default style set by window manager
+	* implemented GR_WM_PROPS_NOMOVE, NORAISE, NOAUTOMOVE, NODECORATE
+		don't decorate if not direct child of root window
+	* extended GrGetWindowInfo to return window properties
+	* fixed LINK_APP_INTO_SERVER makes
+	* added FBREVERSE=Y and PSIONMOUSE=Y config options for Psion 5 port
+		Justin Davies contributed Psion 5 touchscreen/screen driver
+	* added PIPEKBD option for named pipe keyboard driver (kbd_pipe.c)
+	* added nxterm patch for FreeBSD from Andrew
+	* fixed sharedlibs link for nxkbd, nxscribble and nanowm apps
+	* fixed make bug when SHAREDLIBS=Y and FREETYPE/T1LIB=Y from Murphy
+Version 0.89pre2 - 3rd October 2000 - greg@censoft.com
+	* added nxscribble handwriting recognition from Century Software
+	* added nxkbd popup keyboard for Nano-X (original from Jay & Vladimir)
+	* added SIGHUP ignore to Nano-X, removed GrRedrawScreen dropclient bug
+	* implemented GrReadArea for pixmaps from Peter
+	* added free truetype fonts to distribution (Arial, Times, Courier)
+	* added FREETYPE_FONT_DIR config for truetype font search path, .ttf ext
+	* enhanced nxclock no polling, nxterm better focus handling
+	* added GR_UPDATE_UNMAPTEMP and GR_UPDATE_ACTIVATE update events
+	* added GrGetNextEventTimeout and GR_EVENT_TYPE_TIMEOUT event
+	* reworked NanoWM for 3d window decorations for Nano-X applications
+		removed multi-window decorations, uses only one window now
+	* fixed user clip region parent offset bug from Peter
+	* added GrGetFocus call for use with nxkbd and nxscribble
+	* added GrGetSysColor for system-defined color schemes
+	* fixed focus semantics during window move/resize/reparent
+	* added Makefile INSTALL_PREFIX variable
+	* added GrPoints function from Murphy
+	* rewrote window manager property struct, added set background color
+		added props, flags, title, background, bordersize get/set
+	* added kbd_soft.c named pipe keyboard driver from Vladimir
+	* added touch panel mods to mou_tp.c driver for Helio (TPHELIO=Y)
+	* added inverted 4bpp screen driver for Helio (INVERT4BPP=Y)
+	* added changes to Makefile for shared libs for Helio
+	* added kbd modifier info for X11, nano-X hdr changes from Jordan
+	* generate Nano-X root window expose event repaint on startup
+	* removed termios errchk in serial/ps2 mouse driver
+	* fixed DT_CENTER DrawText and MSDOS GetTickCount from Robert Sharp
+	* fixed Makefile.rules .depend target errmsg
+	* start work on Nano-X drawing library for 3d look/feel
+	* added GrDrawImageBits, .bmp file conversion for Nano-X
+		must change MAXREQSIZE in nxproto.h
+	* add title display to nanoWM
+	* fix SetWMProperties title memcpy/wrapper bugs
+	* fix many NanoWM bugs:
+		window move offset, mousedn on client loses title data
+	* ported nxkbd software keyboard to Nano-X
+	* added FREEBSD-X86 to config file as ARCH option
+Version 0.89pre1 - 18th September 2000 - greg@censoft.com
+	* added map-update events to be batched to any application that selects
+		for child update events on the root window (window managers)
+		this allows a window manager to get a list of all mapped
+		windows without a special API call
+	* updated nanowm bitmaps from Vladimir
+	* eliminate need for sleep after nano-X startup, multiple connect trys
+	* print nano-X server error messages rather than numbers
+	* force nano-X cursor to appear on startup
+	* fix cursor change without mouse movement
+	* moved apps/nanowm to demos/nanowm to fix Makefile build problem
+	* fix bad MIPS sys header define for SOCK_STREAM
+	* fix free() bug in GrSetWMProperties from Vladimir
+	* added alpha RGB444 12bpp fb driver for EP7211 from Julian
+	* fixed uninitialized transparent color in devimage.c from Jamie
+	* fixed mouse in abs mode for iPAQ touchscreen in portrait mode
+	* renamed demos/mwin/demo.c to mdemo.c
+	* added changes for compiled in HAVE_BIG5_SUPPORT
+		packhz12 program
+		bugfixed hzx12 big5 chinese font
+	* added changes to win32 controls:
+		listbox control with scrollbars
+		edit control w/chinese support and caret
+		combobox enhancements
+		new scrollbar (client) control, smooth scrolling thumbs
+		mtest2 demo program
+		multiline edit control
+	* wrote caret handling for win32
+	* added Roman's changes for Kaffe port to win32 api:
+		GetTextExtentExPoint, GetTextExtentPoint, DrawTextA
+		SRCAND, SRCINVERT, BLACKNESS
+		added blit AND, INVERT, BLACKNESS to x11 and 16bpp drivers
+		GdGetTextSizeEx (freetype only for now)
+		automatically append B/I for bold/italic in CreateFont
+		fix delete pen/brush but not font resources in ReleaseDC
+		change default TOP alignment to BASELINE in MwExtTextOut
+		enhanced glyph width calculations for freetype in devfont.c
+		auto antialias for freetype at height > 14
+		not added (kaffe port):
+			TextOut defaults to UTF8, not ASCII
+			no SetForegroundWindow on NCLBUTTONDOWN on HTCLIENT area
+	* enhanced demo2.c for upcoming Linux Journal article (Dec)
+Version 0.88patch1 - 21st August 2000 - greg@censoft.com
+	* temp hack scribble to window #2, remove srvutil.c id!=1 hack
+	* fixed nanowm window move flicker
+	* added window id parm to GrInjectKeyboardEvent
+	* added otherid to nano-X focus window events
+	* fixed BOOL decl in scr_bios.c
+	* add WM_NCHITTEST fix to tpcal calibrator
+	* fix ADS and iPAQ touch screen drivers for kernel driver select bug
+	* added right/left portrait mode mouse fixups, -N cmd line startups
+	* fixed GsError with no clients core dump
+	* added transparent color to MWIMAGEHDR format, GdDrawImage, GIF decode
+Version 0.88 - 3rd August 2000 - greg@censoft.com
+	* added iPAQ mouse support from Century Software, config IPAQMOUSE
+	* changed config option TSMOUSE to ADSMOUSE
+	* added HAVE_GIF_SUPPORT to config, added GIF decoder
+	* changed image decode algorithms, image is kept in core until drawn
+	* added GrDrawImageFromFile, GrLoadImageFromFile, GrDrawImageToFit,
+		GrFreeImage, GrGetImageInfo for GIF, BMP and JPEG
+	* removed GrJPEG/GdJPEG, GrBMP/GdBMP
+	* modified MWIMAGEHDR structure, added pitch and bytesperpixel
+	* wrote decoder for 24bpp .bmp files, enhanced convbmp
+	* added stretch blit, rewrote image routines in Nano-X for ViewML
+	* corrected nano-X demo makefiles to work with LINK_APP_INTO_SERVER
+
+	* Patches recieved from ScreenMedia: Jan Vehusheia
+	* nanox/srvnet.c  Free allocated events to freelist when destroying
+	  a client.
+	* nanox/srvutil.c Correctly reassign mouse pointer information when
+	  an application crashes while a mouse button is held pressed down.
+
+	* Patches recieved from ScreenMedia: Jon K Hellan  <hellan@acm.org>
+	* nanox/srvmain.c (GsInitialize): Initialize wp->owner to NULL.
+	* drivers/kbd_x11.c (X11_Read): Initialize modifiers also when no
+	  key press pending.
+	* demos/nanox/demo5.c (main): Correct height of bitmap2(fg|bg) in
+	  GrSetCursor call.
+
+	* added Kevin's patch for destroying eventclient structures
+	* added Jiwon's patch for NULL name strcpy in devfont.c
+	* added Kyle's makefile patches, PORTRAIT_MODE=R or L in config
+Version 0.88pre11 (IBM OTI java&Kaffe ports) - 10th July 2000 - greg@censoft.com
+	* added set palette patch from Joe for Embedded Planet /dev/lcd driver
+	* started adding win32 keyboard support (not working yet)
+	* added Andrew's port to FreeBSD, Wt wterm terminal emulator port
+	* fixed convbdf font size error
+	* added Kevin's not working combobox control
+	* added George's Isicad Prisma screen driver and config
+	* added Simon's flipped portrait mode driver (we now have two)
+	* added updated BC5 makefiles from Ming-Lin Kao
+	* added HZK font patches from kevin
+	* added checkbox, radio button and static controls by kevin/cms
+	* changed GrSetFontAttr,GdSetFontAttr api
+	* added underlining to font rendering with GrSetFontAttr/MWTF_UNDERLINE
+	* fix WS_POPUP parent clipping, add owner window handling
+	* fix delete pen/brush/font resources in ReleaseDC, use DeleteObject
+	* fix memory leak in GetDCEx using CS_OWNDC
+	* added nofont.c for null font support
+	* added NOFONTSORCLIPPING config option for screen driver interface only
+	* separated engine open and draw routines for small driver interface
+	* IBM OTI Microview port: no ALPHABLEND, VTSWITCH, FBVGA, EPRINTF chg
+Version 0.88pre10 (fltk-nx port) - 18th June 2000 - greg@censoft.com
+	* started adding win32 non-client area scrollbars
+	* added Simon's contributed slider game (slider.sh)
+	* added Nano-X GrEqualRegion, GrEmptyRegion, GrOffsetRegion
+	* added GdEqualRegion, GdEmptyRegion
+	* changed GdRectInRegion to return partial intersection values
+	* fixed Nano-X clipping regions relative to drawable
+	* changed GR_RECT struct to match X, not win32
+	* changed GrRectInRegion, GrGetRegionBox, GrUnionRectWithRegion parms
+		to match X
+	* applied Kevin's HZK font sizing fix
+	* removed floating point, ldiv from ported progress bar, fixed bugs
+	* fixed listbox multi-element display code, initial state
+	* fixed PIXELVALTOCOLORVAL macro typo
+Version 0.88pre9 - 15th June 2000 - greg@censoft.com
+	* added Chinese Han Zi Ku font support from Tanghao and Jauming
+		12x12 and 16x16 ascii and chinese fonts
+		Big5, Unicode-16 and GB2312 encoding supported
+		set with config option HAVE_HZK_SUPPORT
+	* added Guo's Chinese GB2312 decoding routines, fonts/gb2312font.c
+		set with config option HAVE_GB2312_SUPPORT
+	* added Jin ke xue's gb16x16song.c font file (no support yet) (and .bdf)
+	* fixed C++ objects to compile
+	* added Rosimildo's RTEMS changes, convbmp allows full paths
+	* added Alex's VERY COOL nano-X window manager! (great job!!) nanowm.sh
+	* added GrSetWMProperties,GrGetWMProperties,GrCloseWindow, GrKillWindow
+	* added Alex's npanel enhancements (solid dragging, zombies)
+	* added Alex's cpu usage reduction to nclock, npanel
+	* added Alex's patch to get nano-widgets to compile
+	* added Alex's PPM file decoder demo6
+	* implemented DT_CENTER, DT_RIGHT for DrawText
+	* added changes in tpcal.c for MIPS Osprey board port, dblclk changes
+	* HAVETEXTMODE #define for Osprey and Embedded Planet ports
+	* added Michael's MINIX port updates
+	* added George's setpalette changes to VNC
+	* added GdAllocPolygonRegion, GrNewPolygonRegion, CreatePolygonRgn
+	* fixed nasty #if UPDATEREGIONS in windows.h compile problem
+	* added Kevin's port of edit, listbox and progressbar from MiniGUI
+	* added GdGetRegionBox, GrGetRegionBox
+	* fixed update regions calc bug
+	* combined GdEllipse and GdFillEllipse and Arc/Pie routines
+	* wrote pie, arc, outline arc routines, win32 Arc,Pie, GrArc,GrArcAngle
+	* added George's patch to fix X11 screen driver setpalette function
+	* added Murphy's region code for Nano-X, also polygon regions
+Version 0.88pre8 - 23rd May 2000 - greg@censoft.com
+	* added Murphy's X vs Microwindows speed tester in contrib/speedtst
+	* fixed convbdf to not emit nonascii characters
+	* added Victor's DJGPP port
+	* removed automatic portrait mode
+	* added extern "C" to nano-X.h
+	* added Kao's patches for BC5, enhanced scr_tc.c, some bug fixes
+	* fixed win32 top/baseline/bottom positioning
+	* added Morten's GrInjectKeyboard/GrInjectPointer patches
+	* added Kevin Lin's fix to Nano-X persisent mode curclient crash
+	* changed GdCreateFont name,height semantics
+	* added Morten's font picker algorithm, turn on w/#define FONTMAPPER 1
+		Note: font selection is currently under development
+		and will likely change
+	* cleaned up source for Michael's MINIX port, replaced convbmp.c -s opt
+	* fixed XYPOINT in mou_tp.c, changes for embedded planet tp driver
+	* added PIXELVALTOCOLORVAL, COLORVALTOPIXELVAL macros, GdTranslateArea
+	* fixed multiple GsSelect() call in GrGetNextEvent in linked client/serv
+	* continued port of VNC to Nano-X, contributed by George
+	* added Rosimildo's patch for RTEMS, MW* fixes, svgalib fade
+Version 0.88pre7 - 15th April 2000 - greg@censoft.com
+	* added LINUX-POWERPC port for embedded planet linux box
+	* fixed Polygon routine fill/draw reversed, AdjustWindowRectEx
+	* fixed no root window paint without background bitmap
+	* added bitmaps to minesweeper, polished up
+	* added middle button handling for mwin
+	* added GrSetSystemPalette
+	* added user-replaceable GdError, removed all fprintf/printf's
+	* added EPRINTF for all error printfs, DPRINTF for debug printfs
+	* removed HAVE_PERROR config option
+	* changed memmove to memcpy
+Version 0.88pre6b - 5th April 2000 - greg@censoft.com
+	* added PostThreadMessage
+	* started porting minesweeper game
+	* fixed -p persistent mode
+	* added Kao's BC 5.02 fixes, other pre6 fixes from name changes
+	* added Steven's patch for polling drivers, HAVE_PERROR config option
+	* added Erik Hill's alpha blending for X11
+	* fixed jpeg compile bug
+	* removed include <asm/io.h> patch from Shane
+Version 0.88pre6 - 2nd April 2000 - greg@censoft.com
+	* major header file cleanup, fixing namespace pollution
+		API		typdef	procs		data
+		Nano-X:		GR_*	Gr*,nx*,(Gs*)	nx*
+		Microwindows:	MW*	Mw*		mw*
+		Engine: 	MW*	Gd*,Mw*		gr_*, fb*
+	* changed all Nano-X structures and defines to be GR_ prefixed
+		added GR_PIXELVAL, GR_RGB, GR_LOGFONT
+	* MW prefixed all exported typedefs for name space cleanup,
+		split device.h into mwtypes.h for exports
+	* added MWLOGFONT font descriptions
+	* removed BUTTON, MODE, MODIFIER typedefs
+	* added Martin's updates to FreeType renderer, updated ftdemo
+	* added Martin's updated xconfigure for X-based configuration
+	* renamed GrUnloadFont to GrDestroyFont, GdDestroyFont
+	* clean up various unwanted nano-X client library symbol exports
+	* redraw windows on nano-X client disconnect
+	* added -p for nano-x persistent mode, no exit on client disconnect
+	* added Timo's fix in GsAcceptClientFd, ignore SIGPIPE, mult GrClose bug
+	* added automatic portrait mode if screen y resolution > x res
+	* fixed GrReqShmCmds for linked client/server case
+	* implemented freetype renderer ascent/descent calculations
+	* added ascent field to compiled fonts, GrText uses TF_BASELINE default
+	* added 5x7, 6x13 compiled (bdf) fonts, FONT_SYSTEM_FIXED is now 6x13
+	* fixed typo in fonts/convbdf $IMAGEBITS incorrect
+	* added #include <asm/io.h> for outb in 2.3.x systems
+	* added AdjustWindowRectEx, WM_ACTIVATE, IsWindowEnabled
+	* completed GetPixel, added PIXELVAL to COLORVAL conversion macros
+Version 0.88pre5b - 23rd March 2000 - greg@censoft.com
+	* added GetSystemMetrics, SM_CYSCREEN, SM_CXSCREEN, SM_CYMENU
+	* added GetParent, GetDeviceCaps LOGPIXELSX
+	* added EnableWindow, WM_ENABLE
+	* added MapWindowPoints, WM_WINDOWPOSCHANGED
+	* defaulted ANIMATEDPALETTE to off (change in include/device.h)
+	* added RTEMS patches for svgalib, GsSelect timeout handling (Rosimildo)
+	* created shared libs for all libraries with SHAREDLIBS=Y config option
+	* patched setfadelevel out for non framebuffer
+	* patched client/server shm code (Morten)
+Version 0.88pre5 (opera, kaffe) - 22nd March 2000 - greg@censoft.com
+	* added GetDlgItem, GetWindowTextLength, WM_GETTEXTLENGTH
+	* added GetPixel (needs rgb backconversion still)
+	* implemented GWL_WNDPROC, CallWindowProc, GetRValue, GetGValue etc
+	* added GrSetFontSize, GrSetFontRotation, GrSetFontAttr, and GdXXX
+		works on a per-font basis, rather than on GC
+	* added HAVE_SHAREDMEM_SUPPORT config option to compile in shmem support
+	* added shared memory support for Nano-X client/server protocol (Morten)
+	* added -e option to Nano-X server to stop terminate on ESC
+	* fixed psd->DrawArea crash after vt switch, GdArea cursor update
+	* added SHAREDLIBS config option for shared libs (nano-x only now)
+	* applied Morten's patch to fix Nano-X client/server protocol bug
+	* added UTF-8 encoding/decoding for fonts and text
+	* fixed FreeType memory leak (thanks Martin)
+	* added ExtTextOutW, DrawTextW for unicode win32 support
+Version 0.88pre4 (truetype/t1 fonts) - 19th March 2000 - greg@censoft.com
+	* implemented text drawing in ascii, utf8, unicode 16 and unicode 32
+	* added font id's for Nano-X, added GrCreateFont, GrUnloadFont
+	* rewrote font subsystem heavily
+	* added alphablender for antialiased fonts for 8, 16, 24 and 32bpp
+	* added GrText, GrGetGCTextSize flags, CreateFontIndirect
+	* added GdText TF_ flags for 8,16,32 bit packing, top/bottom alignment
+	* added Martin's FreeType TrueType font support
+	* added Vidar's t1lib adobe type1 font support, t1demo for Nano-X
+		use HAVE_FREETYPE_SUPPORT config option
+		use HAVE_T1LIB_SUPPORT config option
+	* renamed min/max to mwmin/mwmax
+	* added Fabio's xconfigure patch for VTSWITCH
+	* fixed WM_CREATE lparam bug
+	* added mou_ts.c touch screen driver for ADS ARM port
+	* added GrSetGCFontSize, GdSetFontSize, GdCreateFont, GdUnloadFont
+	* added GWL_USERDATA to Get/SetWindowLong
+	* turboc port screen driver fixes
+	* added nonclient region special paint handling to avoid flicker
+	* added null kbd driver, set with NOKBD=Y
+Version 0.88pre3d (fltk port) - 12th March 2000 - greg@censoft.com
+	* changed FONTINFO struct, added firstchar, lastchar
+	* added Shane's fonts patches, added CreateFont, GetTextMetrics,
+		GetCharWidth, SetAlignText
+	* debugged nasty VTSWITCH palette changed bug
+	* experimental #define ANIMATEPALETTE for cool fade in
+	* added Kyle's patch to get portrait mode working again
+	* fix SetClipRgn/ExtSetClipRgn to take client coords (win32 api doc bug)
+	* added WM_SHOWWINDOW msg
+	* fixed coords to WM_MOVE msg for WS_CHILD windows
+	* added PeekMessage, Ellipse
+	* added Rosimildo's rtemscfg.h patch
+	* added GetUpdateRgn, GetUpdateRect, GdOffsetRegion
+	* added Kyle's GdCopyArea fix
+Version 0.88pre3c (fltk port) - 8th March 2000 - greg@censoft.com
+	* added CS_OWNDC private DC's
+	* added SetActiveWindow, SetForegroundWindow, BringWindowToTop
+	* added Polygon, PolyPolygon (filled and outline)
+Version 0.88pre3b (fltk port) - 6th March 2000 - greg@censoft.com
+	* added GetDeviceCaps, Polyline
+	* added extern "C" in windows.h
+	* fixed loop bug in CreateRoundRectRgn
+	* added penguin to bin/mdemo
+	* added ValidateRect, ValidateRgn, InvalidateRgn
+	* completely rewrote UPDATEREGIONS handling for new region fns
+	* added DCX_EXCLUDEUPDATE handling to window clipping
+	* sped up WndSetClipWindow, GsSetClipWindow
+	* added GdSetRectRegionIndirect, GdSubtractRectFromRegion
+	* added SetWindowPos for size,move,show,hide,repaint,zorder
+Version 0.88pre3 - 5th March 2000 - greg@censoft.com
+	* added contributed DOS TURBOC port by Victor
+	* modified bin/mdemo to clip 3d drawing into a circle, added penguin
+	* added GdAllocRectRegion, GdAllocRectRegionIndirect, 
+	* added GdSetRectRegion, GdAllocRegion, GdDestroyRegion
+	* added SelectClipRgn, ExtSelectClipRgn, user clip regions!
+	* added DYNAMICREGIONS define for dynamic vs static (small) clip code
+	* added win32 HRGN object and region routines
+	* added GetCursorPos
+	* added Al's update event patches for Nano-X client window manager
+	* added Rosimildo's RTEMS patches for uniform input devices
+	* added George's partial mouse data read fixes (upper level only)
+Version 0.88pre2 - 29th February 2000 - greg@censoft.com
+	* added Al's npanel Nano-X program exec'er (cool)
+	* added Al's patch to cleanup windows on Nano-X client exit
+	* added Al's ignore sigpipe for ELKS
+	* added Morten's jpeg grayscale patch
+	* create dword-aligned offscreen bitmaps for speed
+	* removed much of global scrdev
+	* changed screen driver open routine to return psd
+	* added Vidar's patch for offscreen drawing in Nano-X, added
+		GrNewPixmap, GrCopyArea.  GrDestroyWindow destroys pixmaps
+Version 0.88pre1b - 23rd February 2000 - greg@censoft.com
+	* added Kyle's bug fix for 16 and 32bpp jpeg support
+Version 0.88pre1 - 22nd February 2000 - greg@censoft.com
+	* added PSD to GdClip routines, fixing potential offscreen write bug
+	* renamed libraries, added "make install", hdrs to /usr/include/microwin
+		and libs to /usr/lib/libmw*.a and libnano-X.a
+	* renamed RECT, POINT, CLIPRECT and CLIPREGION types to MWxxx
+	* added Al's ELKS patches for client/server Nano-X on ELKS
+	* renamed xconfigure, updated INSTALL with make instructions
+	* rewrote all fb drivers for speed eliminating multiple function calls
+	* allow GdText count == -1 for strlen()
+	* added GdCalcMemGCAlloc to calculate offscreen allocate size
+	* added three offscreen memory allocation entry points to screen driver
+	* rewrote vga16 driver to use outw rather than outb for speed
+	* adjusted fb drivers to always draw last point for drawhorz/drawvert
+	* rewrote VT switching code, removed from fb driver to separate file
+	* added SetIOPermissions in scrdev for pthreads create i/o bitmap bug
+	* fixed parms named "min" in demos for ELKS bcc compiler
+	* changed VT switch signal to SIGUNUSED for pthreads compatibility
+	* added Brad's touch panel/mouse calibrator to contrib/GPL/tpcal
+	* fixed up SVGAlib driver for 256 colors, added screen to screen blit
+	* process all mouse messages before next select: better mouse speed
+	* added HTBORDER hit testing
+	* fixed FBVGA blitting, wrong scrdev used on memdc
+Version 0.87 - 13th February 2000 - greg@censoft.com
+	* added VTSWITCH in config to include virtual terminal switch code
+	* added support for 24bpp, wrote 24bpp fb driver
+	* fixed 8/8/8 color macros: RGB2PIXEL888, COLOR2PIXEL888, PIXEL888RED
+	* fixed 32bpp fb bug with psd->ncolors, 32bpp alpha blit bugs
+	* added fb driver support for FB_VISUAL_DIRECTCOLOR cards (ATI)
+	* sped up 16, 32bpp blitters by using memcpy
+	* added large font patches from Kyle
+	* added PACIFIC C compiler support from Victor
+	* default UPDATEREGIONS=N in config file for alpha blend demo
+	* removed XORMOVE from config, requires only ERASEMOVE=N
+	* wrote alpha blending demo (requires UPDATEREGIONS=N)
+	* rewrote void *pixels in devdraw.c, won't compile on ansi compilers
+	* fixed PF_TRUECOLOR0888 bug in GdArea
+	* added DJGPP as config ARCH option, Victor's patches for DJGPP
+	* finalized alpha blending blit routines for 8, 16, and 32bpp
+	* added SetTimer/KillTimer api (single timer only)
+	* added Chris' SetSysColor api, C++ object frameworks patch to mwin/
+	* added Rosimildo's make patches for RTEMS
+	* added Martin's make/configure patches
+Version 0.87pre6 - 31st January 2000 - greg@censoft.com
+	* added C++ objects framework from Chris
+	* added support for multiple read/write/except fd's from Chris
+	* added Martin's X11 configure program and various Makefile fixes
+	* added compile time warnings patches from Chris
+	* added Morten's drawarea patch pre5mr1
+	* added experimental 8, 16 and 32bpp constant alpha blending to bitblit
+		(#define ALPHABLEND in device.h and run bin/mterm for demo)
+	* changed distance-cubed find nearest color to use abs() for speed
+	* fixed max character height/width alloc; max now 128x128 (configurable)
+	* small bugfix DRAWON/DRAWOFF in mempl4.c
+Version 0.87pre5 - 26th January 2000 - greg@censoft.com
+	* prepared prebuilt config files for fb, x11, svga
+	* added Morten's drawarea driver patch (16bpp only)
+	* fixed XOR drawing for 1, 2, 4bpp, improved speed with x>>2 not x/4
+	* applied Chris' FBVGA patch
+	* applied Rosilmildo's RTEMS compiling patch
+	* applied Morten's SCREEN_PIXTYPE X11 Makefile patch
+	* added Chris' SetWindowLong and $(HOME)config and Arch.rules patch
+	* completed fix for DJGPP compiled mou_dos.c driver
+	* added Kyle's patches for arbitrarily wide text chars
+Version 0.87pre4 - 18th January 2000 - greg@censoft.com
+	* added Martin's new config-based Makefile system
+	* added Martin's JPEG and BMP file reading/display routines
+	* added Morten's variable PIXELVAL size mods
+	* added contributed DJGPP/GRX port by Victor Rogachev
+	* fixed 16bpp and 32bpp fb blit routines, by Kyle Harris
+	* added Rosimildo's RTEMS changes, scr_bios now runs without bios
+	* added Dan's GrReparentWindow, fixed GetWindowInfo bug
+	* added PF_TRUECOLOR0888 for 4 byte packing
+	* updated doc directory with html faq, architecture
+Version 0.87pre3 - 19th December 1999 - greg@censoft.com
+	* started directory reorganization
+	* changed LINUX meaning in Makefile, added UNIX for SOLARIS
+	* fix negative blit index bug found under X11 by Piotr
+	* set rootwp->parent = NULL for nano-X, fixes GrMoveWindow clip bug
+	* added COLORVAL<->PIXELVAL conversion macros
+	* modified GrArea to take packed pixel values of 8, 16 and 24 bits
+	* modified GrArea to take RGB COLORVALs as well as PIXELVALs
+	* renamed PF_TRUECOLOR24 to PF_TRUECOLOR888
+	* added tunable MAXREQUESTSZ to limit max request length
+	* modified Nano-X demo.c to GrArea() > 64k pixelvals for testing
+	* fix client/server 64k length bug (request can be 24 bits in length)
+	* fixed portrait mode in CreateCompatibleBitmap
+Version 0.87pre2 - 14th December 1999 - greg@censoft.com
+	* added fixes to run on big-endian machines
+	* integrated rtems port, protected mode vga driver
+	* added ARM SA1100 4bpp LCD controller driver
+	* added portrait mode fb driver from Martin Jolicoeur
+	* fixed GrMoveWindow for child windows, MoveWindow for grandchildren
+	* added nanox move.c window move test program from Daniel
+	* rtems portability fixes, use <stdlib.h> rather than <malloc.h>
+	* fixed mterm demo pty bug under X11
+Version 0.87pre1 - 2nd December 1999 - greg@censoft.com
+	* added GrMainLoop convenience function
+	* added passive library entry points GrPrepareSelect,GrServiceSelect
+	* completely rewrote nano-X client/server networking layer for speed
+	* removed nano-X stubs file, rename Gs* routines to Gr*
+	* added GrFindColor function to convert RGB color to pixel value
+	* added GetSystemPaletteEntries, GrGetSystemPalette functions
+	* added null mouse driver (NOMOUSE)
+ 	* added X11 driver by Tony Rogvall <tony@bluetail.com>, fixed colors
+Version 0.86 - 28th October 1999 - greg@censoft.com
+	* merged framebuffer, elks and msdos vga 16 color 4 planes drivers
+	* wrote vga bitbit routines (a herculean effort)
+	* optimized bitblit by traversing window clip region
+	* added experimental multi-rectangle dynamically allocated regions
+	* wrote scrolling terminal emulator demo for microwindows
+	* added WM_FDINPUT msg, WndRegisterFdInput call for terminal emulator
+	* changed SCREENINFO struct, removed black/white, added bpp, planes
+	* added offscreen (memory DC) drawing to microwindows
+	* added BitBlt, CreateCompatibleBitmap, CreateCompatibleDC, DeleteDC
+	* retired BOGL library, must use new interface for blitting
+	* converted framebuffer, svgalib, elks and msdos screen drivers
+	* (we need blit routines for herc and svgalib still)
+	* major screen driver interface change, old drivers not compatible
+Version 0.85 - 14th October 1999 - greg@censoft.com
+	* ported microwindows to Casio and Clio palm pc's (thanks Brad)
+	* ported microwindows to Everex Freestyle palm pc
+	* changed ncolors in SCREENINFO user struct to long
+	* system automatically supports 1, 2, 4, 8bpp palette
+		and 8, 16 and 24 bpp truecolor systems (332, 565, 888 packing)
+	* removed F_PALINDEX from std colors, std colors now RGB
+	* wrote 16bpp, 32bpp fb drivers, 2bpp, 4bpp for palm pc
+	* removed requirement for bogl library, wrote direct framebuffer driver
+	* started screen driver rearchitecture for bitblit
+	* experimental bitblt
+	* added touchscreen device from Brad LaRonde
+	* enhanced nano-X terminal emulator, added scrolling,bitblit
+	* added GrRegisterInput for terminal emulator without polling
+	* rewrote GrGetNextEvent to not require polling
+	* added CREDITS file
+	* integrated Vidar's nanoWidgets 0.2
+	* added screenshot capability: read /dev/fb0 on exit
+	* wrote makebmp utility to convert fb data to bmp file
+Version 0.84 - 3rd October 1999 - greg@censoft.com
+	* integrated Vidar's nanoWidgets 0.1, changed color constants
+	* integrated Brad LaRonde's MIPS LinuxCE port cross-compile changes
+	* integrated Alex's nano-X-0.5pre3 changes except dir/filename changes
+	* added support for 8 to 32 bit truecolor systems
+	* reorganized Makefile for nanoX and linked/non-linked nano-X servers
+	* reorganized Makefiles for gcc, bcc and other compilers
+	* reorganized nano-X.h header file for client programs
+	* fixed GrSetGCFont,GrGetGCTextSize,ReadArea,Area client/server bugs
+	* fix bug in nanoX network select code for client attach
+	* workaround for GrGetNextEvent in nanoX client lib
+	* wrote asm version of VGA driver for ELKS
+	* added optimized herc hline routine from thomas_d_stewart@hotmail.com
+	* added contributed terminal emulator demo for nano-X,
+		(from Alistair Riddoch, requires linked server)
+Version 0.83 - 14th July 1999 - greg@censoft.com
+	* wrote sample untested hercules driver for ELKS
+	* tweaked window repaint code to paint child windows last for ELKS
+	* fixed code for pass-by-structure for bcc/ELKS
+	* added TEST= for select() code in ELKS
+Version 0.82 - 5th July 1999 - greg@censoft.com
+	* added contributed clock demo for nano-X from Alistair Riddoch
+	* added update region calculation for window painting
+	* fixed GdColorInPalette, GdSetPalette, various palette bugs
+	* added double click to maximize/restore windows
+	* added mouse double click processing
+	* added GetTickCount() api, requires OS millisecond time fn
+	* fixed some expose region calculations
+	* combined Makefile builds both/either Micro-Windows and Nano-X
+	* wrote XORMOVE window move algorithm for slow cpu's
+	* added GetDCEx(), SetROP2() and various rect api
+	* change to single toplevel Makefile mod for ELKS or LINUX
+	* changed default ELKS mouse port to /dev/ttys0, type to "pc"
+	* changed tgmath.h to math.h
+Version 0.81 - 22nd June 1999 - greg@censoft.com
+	* added Free System font
+	* removed mswin4 background
+	* changed nano directory
+	* changed vgaplan4 unsigned int fix for ELKS screen bug
+	* set default rom character height to 14 for scr_bios driver
+	* added -ansi option for bcc (I'll post my ansi compiling bcc shortly)
+Version 0.8 - 20th June 1999 - greg@censoft.com
+	* added 3d graphics library for demo app
+	* removed ms windows grabbed fonts, added FreeSansSerif font
+	* added color bitmap support
+	* wrote windows bmp file converter
+	* drawing color bitmaps in 1, 4 and 8 bpp supported
+	* added support for loading partial palettes
+	* added MakePaletteConversionTable function
+	* added support for sophisticated palette optimization
+	* implemented optimized window redraw algorithms during window moves
+	* added child window support
+	* wrote button control
+	* added more sophisticated focus routines on create/destroy
+	* added support for type 1 and type 2 line drawing requests in GdLine
+	* added multiple window color schemes
+	* added desktop wallpaper
+Version 0.7 - 8th June 1999 - greg@censoft.com
+	* created new win32 api: Micro-Win
+	* created window manager and overlapped window border drawcode
+	* added software cursor structure to device layer
+	* changed nano-x and micro-win color model to RGB for user programs
+	* added setpalette driver entry point, 16 and 256 color std palettes
+	* fixed console refresh bug for BOGL
+	* fixed expose bug bad return;
+	* fixed ELKS cols,rows bug in scr_bios.c
+	* disallow console switching for ELKS while in graphics mode
+	* added EGAMODE and CHARHEIGHT environment variables for ELKS/DOS
+Version 0.6 - 23rd May 1999 - greg@censoft.com
+	* Updated bugs from new mini-x distribution
+	* Wrote int33 mouse driver for dos
+	* Wrote a portable vga 4 plane driver for dos, elks
+	* Updated dos driver to support XOR,AND,OR draw modes
+	* Wrote routines for ELKS port, compiled with bcc
+		uses new serial mouse driver, vga 4 plane driver and bios kbd
+	* Added check for FRAMEBUFFER environment variable for /dev/fbX open
+	* Added clipped text output routines, using bitmaps
+	* Added GetCharBits device driver entry point, removed DrawText
+	* Added new nano-X font format, wrote conversion programs to
+		convert bdf fonts and PC ROM bios fonts.  There is no longer
+		any dependency on the BOGL font structure.  Any number
+		of fonts are supported.  Fonts use min 16 bits/scanline.
+		Convbdf and convrom.exe are included.
+	* Created rom 8x16, 8x16 fonts.
+	* Entire nano-X can run on only drawpixel and readpixel if required
+	* Documented scr_bogl.c (bogl), and scr_bios.c (bios) drivers.
+	* Ported world program to 16 bit systems
+	* Added pc, microsoft and logitech direct serial driver mouse support
+	* Wrote SVGAlib screen driver, will now run on *any* linux system,
+		not just v2.x framebuffer systems.  scr_svga.c.
+	* Nano-X is now completely self contained, if desired, in that
+		there are hw drivers for screen, mouse, and keyboard
+		that don't require other software to be running
+Version 0.5 - 18th May 1999 - greg@censoft.com
+	* Rewrote cursor routines
+	* Separated mouse from cursor routines
+	* Removed DrawCursor from device driver
+	* Added ReadPixel to device driver
+	* Made demo programs work with cursor changes
+	* Added polygon draw and fill routines
+	* Added area pixel reading/writing, removed 8-bit limit for colors
+	* Reworked color model
+	* Added direct hardware 640x480x16 support for VGA real mode systems
+	* Made api backwards compatible with mini-x
+	* Ported mini-x world demo program to examples library
+
+Version 0.4 - 12th May 1999 - greg@censoft.com
+	* Added XOR drawing mode to screen drivers
+	* Fixed rectangle, fillrect, and line off-by-one bugs
+	* Commented example drivers better
+	* Implemented text clipping
+	* Fixed VT switch code and redraw
+	* Hacked physical/virtual 0,0 mapping on linux framebuffer startup
+	* Added 256 color and 16 color explicit palette to bogl driver
+	* Added GetFontInfo and GetScreenInfo to drivers
+
+Version 0.3 - 9th May 1999 - greg@censoft.com
+	* Release 0.3 is heavy rewrite of lower-level/mid-level routines
+	* cursor clipping implemented
+	* screen, mouse and kbd driver APIs created
+	* includes GPM mouse driver, /dev/tty keyboard driver
+	* all device-dependent code is in drivers/ directory
+	* intended as evaluation for standalone and other OS ports
+	* should be easy to write an int 10h driver for real mode operation
+	* should be easy to add any other kbd, mouse or screen drivers
+	* quick port with MSC 5.10 for MSDOS created
+	
+Version 0.2 - 5th May 1999 - greg@censoft.com
+	* Made release 0.1 operational for evaluation
+	* Added event processing
+	* Made demo programs work
+	* Fixed numerous bugs
+	* Added client direct link stub routines for non networked systems/test
+	* Started screen device driver api and bogl integration rewrite
+	* printf debug code is still included, this is an interim release
+		for strawman evaluation
+
+Version 0.1 - 25th April 1999 - alex@linuxhacker.org
+Initial release, based on Alan Cox's combination of mini-X and Bogl, and some more work
+by myself. Changes since Alan's release include:
+
+	* Client library and server process are seperate.
+	* Mouse driver rewritten to take the output of GPM in repeater mode.
+	* Mouse pointer code added to the bogl cfb8 driver.
+	* K & R parameter declarations converted to ANSI.
+	* Main control loop uses select() instead of busy waiting.
+	* Beginning of code to redraw screen on switching to graphics console.
+	* Client data is stored in a dynamic linked list instead of a fixed size array.
+	* Some minor bugs fixed.
+	* Many major bugs added.
+	* ChangeLog, TODO, BUGS, README, INSTALL, etc. written.
+	* Probably various other things I've forgotten about now.
diff -urN lib/microwindows/src/Configs/README /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/README
--- lib/microwindows/src/Configs/README	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/README	2005-02-21 16:12:47.000000000 +0100
@@ -0,0 +1,36 @@
+The config files in this directory are pre-built for ease
+in building Microwindows on various systems.  One config file,
+config.fb, is kept up with the latest configuration options.
+Use it if you are building a configuration from scratch for
+your system.
+
+To build Microwindows, copy one of these files to microwin/src/config,
+and type "make clean; make".
+
+// Common configurations
+config.fb	Basic Linux Framebuffer (FB)
+config.x11	Microwindows running on X11
+config.ft	FB and Freetype font rendering
+config.tt	FB and T1Lib font rendering
+config.xtt	X11 and Freetype font rendering
+
+// Specific ports
+config.ads	ARM Linux FB for ADS Graphics Client
+config.big5	FB and Chinese Big5 fonts
+config.dj	DJGPP 32-bit MSDOS
+config.elks	ELKS 16-bit Linux (bcc compiler)
+config.freebsd	FreeBSD port
+config.harrier	MIPS Linux FB for NEC Harrier
+config.helio	MIPS Linux FB for VTech Helio
+config.hzk	FB and Chinese HZK fonts
+config.ipaq	ARM Linux FB for iPAQ
+config.l7200	ARM Linux FB for L7200
+config.ns	x86 Linux for National Semi Geode
+config.oti	PPC Linux for OTI
+config.ppc	PPC Linux for Embedded Planet Linux Planet
+config.prisma	Prisma port
+config.psion	Psion port
+config.rtems	RTEMS port
+config.svga	x86 Linux SVGALib screen driver
+config.yopy	ARM Linux FB for G.Mate YOPY
+config.ecossynth	eCos Linux synthetic target port
diff -urN lib/microwindows/src/Configs/config.ads /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.ads
--- lib/microwindows/src/Configs/config.ads	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.ads	2005-02-21 16:12:44.000000000 +0100
@@ -0,0 +1,285 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-ARM
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = N
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+HAVE_XPM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+FRAMEBUFFER              = Y
+FBVGA                    = Y
+VTSWITCH                 = Y
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = N
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = Y
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = N
+NOKBD			 = Y
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.big5 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.big5
--- lib/microwindows/src/Configs/config.big5	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.big5	2005-02-21 16:12:47.000000000 +0100
@@ -0,0 +1,296 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# LINUX-POWERPC
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-NATIVE
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+POWERPCTOOLSPREFIX       = powerpc-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = Y
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese BIG5 compiled in font support (big5font.c)
+####################################################################
+HAVE_BIG5_SUPPORT        = Y
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+# Generate screen driver interface only with no fonts or clipping
+####################################################################
+NOFONTSORCLIPPING        = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+FRAMEBUFFER              = Y
+FBVGA                    = Y
+VTSWITCH                 = Y
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = Y
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = Y
+NOKBD                    = N
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.dj /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.dj
--- lib/microwindows/src/Configs/config.dj	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.dj	2005-02-21 16:12:44.000000000 +0100
@@ -0,0 +1,298 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# LINUX-POWERPC
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                      = DJGPP
+#ARMTOOLSPREFIX           = arm-linux-
+#MIPSTOOLSPREFIX          = mipsel-linux-
+#POWERPCTOOLSPREFIX       = powerpc-linux-
+#RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = Y
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = N
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = N
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_PALETTE
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = Y
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = N
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+FRAMEBUFFER              = N
+FBVGA                    = N
+VTSWITCH                 = N
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = N
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = N
+NOKBD			 = N
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
+
+####################################################################
+#
+# If the platform is running DOS box using DJGPP and GRX ...
+#
+####################################################################
+ifeq ($(ARCH), DJGPP)
+
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+endif
diff -urN lib/microwindows/src/Configs/config.ecossynth /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.ecossynth
--- lib/microwindows/src/Configs/config.ecossynth	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.ecossynth	2005-02-21 16:12:47.000000000 +0100
@@ -0,0 +1,344 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# LINUX-POWERPC
+# LINUX-SH
+# FREEBSD-X86
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+
+#<ijsung>
+# ECOS-ASSABET
+# ECOS-LINUX
+#</ijsung>
+
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+#ARCH                     = LINUX-NATIVE
+ARCH                     = ECOS-LINUX
+
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+POWERPCTOOLSPREFIX       = powerpc-linux-
+SHTOOLSPREFIX            = sh-linux-gnu
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+###eCos related###
+#<ijsung> 
+ECOSLINUXTOOLSPREFIX	= i686-pc-linux-gnu-
+ECOSINSTALLPATH		= /mnt/workshop/synth_test/install
+GTKSERVERPATH		= /mnt/workshop/microwindows/gtkserver
+#</ijsung>
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = N
+DEBUG                    = Y
+VERBOSE                  = Y
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = N
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = N
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = N
+NANOXDEMO                = N
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = N
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR555  /* pixel is packed 16 bits 5/5/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+
+#Our Simulator uses 24-bit buffer
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = N
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+HAVE_XPM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+FREETYPE_FONT_DIR        = "/usr/local/microwin/fonts"
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese BIG5 compiled in font support (big5font.c)
+####################################################################
+HAVE_BIG5_SUPPORT        = N
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+# Generate screen driver interface only with no fonts or clipping
+####################################################################
+NOFONTSORCLIPPING        = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = 
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+# You may want to turn this on for XFree86 4.x or if your backing store
+# isn't functioning properly
+USE_EXPOSURE		 = N
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+# set FBREVERSE to reverse bit orders in 1,2,4 bpp
+FBVGA                    = N
+FRAMEBUFFER              = N
+FBVGA                    = Y
+VTSWITCH                 = Y
+PORTRAIT_MODE            = N
+FBREVERSE                = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# TPHELIO for VTech Helio
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ,Intel Assabet, ARM ucb1200 (/dev/h3600_ts 11,0)
+# HARRIERMOUSE for NEC Harrier
+# PSIONMOUSE for the Psion 5
+####################################################################
+GPMMOUSE                 = Y
+SERMOUSE                 = N
+TPMOUSE                  = N
+TPHELIO                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+HARRIERMOUSE             = N
+PSIONMOUSE               = N
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = N
+SCANKBD                  = Y
+PIPEKBD                  = N
+NOKBD                    = N
+
+endif
+
+####################################################################
+# Screen driver specific configuration
+# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller
+# INVERT4BPP 4bpp inverted pixel driver for VTech Helio
+####################################################################
+SA1100_LCD_LTLEND        = N
+INVERT4BPP               = N
+
+############eCos##################
+ifeq ($(ARCH), ECOS-LINUX)
+
+ECOS = Y
+GTKSCREEN		 = Y
+HAVE_SHAREDMEM_SUPPORT   = N
+HAVE_FILEIO              = N
+GPMMOUSE		 = N
+VTSWITCH 		 = N 
+NOMOUSE			 = N
+SCANKBD			 = N
+NOKBD			 = Y
+##UNIX			 = N
+endif
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.elks /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.elks
--- lib/microwindows/src/Configs/config.elks	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.elks	2005-02-21 16:12:44.000000000 +0100
@@ -0,0 +1,251 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = ELKS
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+NWIDGET                  = N
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = N
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_PALETTE
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = Y
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = N
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+FRAMEBUFFER              = Y
+FBVGA                    = Y
+VTSWITCH                 = N
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = Y
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard type
+TTYKBD                   = Y
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.fb /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.fb
--- lib/microwindows/src/Configs/config.fb	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.fb	2005-02-21 16:12:44.000000000 +0100
@@ -0,0 +1,312 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# LINUX-POWERPC
+# LINUX-SH
+# FREEBSD-X86
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-NATIVE
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+POWERPCTOOLSPREFIX       = powerpc-linux-
+SHTOOLSPREFIX            = sh-linux-gnu
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = Y
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR555  /* pixel is packed 16 bits 5/5/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+HAVE_XPM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+FREETYPE_FONT_DIR        = "/usr/local/microwin/fonts"
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese BIG5 compiled in font support (big5font.c)
+####################################################################
+HAVE_BIG5_SUPPORT        = N
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+# Generate screen driver interface only with no fonts or clipping
+####################################################################
+NOFONTSORCLIPPING        = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+# You may want to turn this on for XFree86 4.x or if your backing store
+# isn't functioning properly
+USE_EXPOSURE		 = N
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+# set FBREVERSE to reverse bit orders in 1,2,4 bpp
+# set FBVGA=N for all systems without VGA hardware (for MIPS must=N)
+FRAMEBUFFER              = Y
+FBVGA                    = Y
+VTSWITCH                 = Y
+PORTRAIT_MODE            = N
+FBREVERSE                = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# TPHELIO for VTech Helio
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ,Intel Assabet, ARM ucb1200 (/dev/h3600_ts 11,0)
+# HARRIERMOUSE for NEC Harrier
+# PSIONMOUSE for the Psion 5
+####################################################################
+GPMMOUSE                 = Y
+SERMOUSE                 = N
+TPMOUSE                  = N
+TPHELIO                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+HARRIERMOUSE             = N
+PSIONMOUSE               = N
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = N
+SCANKBD                  = Y
+PIPEKBD                  = N
+NOKBD                    = N
+
+endif
+
+####################################################################
+# Screen driver specific configuration
+# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller
+# INVERT4BPP 4bpp inverted pixel driver for VTech Helio
+####################################################################
+SA1100_LCD_LTLEND        = N
+INVERT4BPP               = N
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.freebsd /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.freebsd
--- lib/microwindows/src/Configs/config.freebsd	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.freebsd	2005-02-21 16:12:45.000000000 +0100
@@ -0,0 +1,285 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# LINUX-POWERPC
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = FREEBSD-X86
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+POWERPCTOOLSPREFIX       = powerpc-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = Y
+NWIDGET                  = Y
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_PALETTE
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = Y
+INCJPEG                  = /usr/local/include/
+LIBJPEG                  = /usr/local/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = Y
+INCT1LIB                 = /usr/local/include
+LIBT1LIB                 = /usr/local/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = Y
+INCFTLIB                 = /usr/local/freetype/include
+LIBFTLIB                 = /usr/local/lib/libttf.so
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = Y
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+FRAMEBUFFER              = N
+FBVGA                    = N
+VTSWITCH                 = N
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = N
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = N
+NOKBD                    = N
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.ft /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.ft
--- lib/microwindows/src/Configs/config.ft	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.ft	2005-02-21 16:12:47.000000000 +0100
@@ -0,0 +1,312 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# LINUX-POWERPC
+# LINUX-SH
+# FREEBSD-X86
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-NATIVE
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+POWERPCTOOLSPREFIX       = powerpc-linux-
+SHTOOLSPREFIX            = sh-linux-gnu
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = Y
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR555  /* pixel is packed 16 bits 5/5/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+HAVE_XPM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = Y
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+FREETYPE_FONT_DIR        = "/usr/local/microwin/fonts"
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese BIG5 compiled in font support (big5font.c)
+####################################################################
+HAVE_BIG5_SUPPORT        = N
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+# Generate screen driver interface only with no fonts or clipping
+####################################################################
+NOFONTSORCLIPPING        = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+# You may want to turn this on for XFree86 4.x or if your backing store
+# isn't functioning properly
+USE_EXPOSURE		 = N
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+# set FBREVERSE to reverse bit orders in 1,2,4 bpp
+# set FBVGA=N for all systems without VGA hardware (for MIPS must=N)
+FRAMEBUFFER              = Y
+FBVGA                    = Y
+VTSWITCH                 = Y
+PORTRAIT_MODE            = N
+FBREVERSE                = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# TPHELIO for VTech Helio
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ,Intel Assabet, ARM ucb1200 (/dev/h3600_ts 11,0)
+# HARRIERMOUSE for NEC Harrier
+# PSIONMOUSE for the Psion 5
+####################################################################
+GPMMOUSE                 = Y
+SERMOUSE                 = N
+TPMOUSE                  = N
+TPHELIO                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+HARRIERMOUSE             = N
+PSIONMOUSE               = N
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = N
+SCANKBD                  = Y
+PIPEKBD                  = N
+NOKBD                    = N
+
+endif
+
+####################################################################
+# Screen driver specific configuration
+# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller
+# INVERT4BPP 4bpp inverted pixel driver for VTech Helio
+####################################################################
+SA1100_LCD_LTLEND        = N
+INVERT4BPP               = N
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.harrier /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.harrier
--- lib/microwindows/src/Configs/config.harrier	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.harrier	2005-02-21 16:12:45.000000000 +0100
@@ -0,0 +1,286 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-MIPS
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = N
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+HAVE_XPM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+FRAMEBUFFER              = Y
+FBVGA                    = N
+VTSWITCH                 = N
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = N
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+HARRIERMOUSE             = Y
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = N
+NOKBD			 = Y
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.helio /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.helio
--- lib/microwindows/src/Configs/config.helio	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.helio	2005-02-21 16:12:45.000000000 +0100
@@ -0,0 +1,297 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# LINUX-POWERPC
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-MIPS
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+POWERPCTOOLSPREFIX       = powerpc-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = Y
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = N
+NANOX                    = Y
+SHAREDLIBS               = Y
+NWIDGET                  = N
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = N
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = N
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+#SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+SCREEN_PIXTYPE           = MWPF_PALETTE
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = Y
+INCJPEG                  = .
+#LIBJPEG                 = /usr/lib/libjpeg.so
+ifeq ($(ARCH), LINUX-MIPS)
+LIBJPEG                  = /usr/mipsel-linux/lib/libjpeg.so
+endif
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese BIG5 compiled in font support (big5font.c)
+####################################################################
+HAVE_BIG5_SUPPORT        = N
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+# Generate screen driver interface only with no fonts or clipping
+####################################################################
+NOFONTSORCLIPPING        = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = Y
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+FRAMEBUFFER              = Y
+FBVGA                    = N
+VTSWITCH                 = N
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# TPHELIO for VTech Helio
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = N
+SERMOUSE                 = N
+TPMOUSE                  = N
+TPHELIO                  = Y
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = N
+NOKBD                    = Y
+
+endif
+
+####################################################################
+# Screen driver specific configuration
+# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller
+# INVERT4BPP 4bpp inverted pixel driver for VTech Helio
+####################################################################
+SA1100_LCD_LTLEND        = N
+INVERT4BPP               = Y
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.hzk /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.hzk
--- lib/microwindows/src/Configs/config.hzk	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.hzk	2005-02-21 16:12:48.000000000 +0100
@@ -0,0 +1,286 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# LINUX-POWERPC
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-NATIVE
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+POWERPCTOOLSPREFIX       = powerpc-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = Y
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = Y
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = Y
+HZK_FONT_DIR             = "/home/greg/net/chinese"
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+FRAMEBUFFER              = Y
+FBVGA                    = Y
+VTSWITCH                 = Y
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = Y
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = Y
+NOKBD                    = N
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.ipaq /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.ipaq
--- lib/microwindows/src/Configs/config.ipaq	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.ipaq	2005-02-21 16:12:45.000000000 +0100
@@ -0,0 +1,285 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-ARM
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = N
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+HAVE_XPM_SUPORT          = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = Y
+INCJPEG                  = .
+LIBJPEG                  = /skiff/local/arm-linux/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+FRAMEBUFFER              = Y
+FBVGA                    = N
+VTSWITCH                 = N
+PORTRAIT_MODE            = R
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ and Intel Assabet (/dev/h3600_ts 11,0)
+####################################################################
+GPMMOUSE                 = N
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = Y
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = N
+NOKBD			 = Y
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.l7200 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.l7200
--- lib/microwindows/src/Configs/config.l7200	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.l7200	2005-02-21 16:12:45.000000000 +0100
@@ -0,0 +1,297 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# LINUX-POWERPC
+# LINUX-SH
+# FREEBSD-X86
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-ARM
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+POWERPCTOOLSPREFIX       = powerpc-linux-
+SHTOOLSPREFIX            = sh-linux-gnu
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = Y
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_PALETTE
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_XPM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+FREETYPE_FONT_DIR        = "/usr/local/microwin/fonts"
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese BIG5 compiled in font support (big5font.c)
+####################################################################
+HAVE_BIG5_SUPPORT        = N
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+# Generate screen driver interface only with no fonts or clipping
+####################################################################
+NOFONTSORCLIPPING        = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+# set FBREVERSE to reverse bit orders in 1,2,4 bpp
+# set FBVGA=N for all systems without VGA hardware (for MIPS must=N)
+FRAMEBUFFER              = Y
+FBVGA                    = Y
+VTSWITCH                 = Y
+PORTRAIT_MODE            = N
+FBREVERSE                = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# TPHELIO for VTech Helio
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+# HARRIERMOUSE for NEC Harrier
+# PSIONMOUSE for the Psion 5
+####################################################################
+GPMMOUSE                 = N
+SERMOUSE                 = N
+TPMOUSE                  = N
+TPHELIO                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = Y
+HARRIERMOUSE             = N
+PSIONMOUSE               = N
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = N
+PIPEKBD                  = N
+NOKBD                    = Y
+
+endif
+
+####################################################################
+# Screen driver specific configuration
+# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller
+# INVERT4BPP 4bpp inverted pixel driver for VTech Helio
+####################################################################
+SA1100_LCD_LTLEND        = N
+INVERT4BPP               = N
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.ns /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.ns
--- lib/microwindows/src/Configs/config.ns	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.ns	2005-02-21 16:12:45.000000000 +0100
@@ -0,0 +1,292 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-NATIVE
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = Y
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_XPM_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = Y
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+FREETYPE_FONT_DIR        = "/usr/local/microwin/fonts"
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+# Generate screen driver interface only with no fonts or clipping
+####################################################################
+NOFONTSORCLIPPING        = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+FRAMEBUFFER              = Y
+FBVGA                    = Y
+VTSWITCH                 = Y
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = Y
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard type
+TTYKBD                   = N
+PIPEKBD                  = N
+NOKBD                    = N
+SCANKBD			 = Y
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.oti /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.oti
--- lib/microwindows/src/Configs/config.oti	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.oti	2005-02-21 16:12:46.000000000 +0100
@@ -0,0 +1,291 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# LINUX-POWERPC
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-NATIVE
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+POWERPCTOOLSPREFIX       = powerpc-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = Y
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+# Generate screen driver interface only with no fonts or clipping
+####################################################################
+NOFONTSORCLIPPING        = Y
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+FRAMEBUFFER              = Y
+FBVGA                    = N
+VTSWITCH                 = Y
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = Y
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = Y
+NOKBD                    = N
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.ppc /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.ppc
--- lib/microwindows/src/Configs/config.ppc	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.ppc	2005-02-21 16:12:46.000000000 +0100
@@ -0,0 +1,286 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# LINUX-POWERPC
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-POWERPC
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+POWERPCTOOLSPREFIX       = powerpc-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = N
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+FRAMEBUFFER              = Y
+FBVGA                    = N
+VTSWITCH                 = N
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = N
+SERMOUSE                 = N
+TPMOUSE                  = Y
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = Y
+NOKBD			 = N
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.prisma /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.prisma
--- lib/microwindows/src/Configs/config.prisma	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.prisma	2005-02-21 16:12:46.000000000 +0100
@@ -0,0 +1,298 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# LINUX-POWERPC
+# UCLINUX-PRISMA
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = UCLINUX-PRISMA
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+POWERPCTOOLSPREFIX       = powerpc-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+UCLINUXTOOLPREFIX	 = m68k-elf-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = Y
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = N
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = N
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_PALETTE
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = Y
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = N
+HAVE_GIF_SUPPORT         = N
+HAVE_PNM_SUPPORT         = N
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+FRAMEBUFFER              = N
+FBVGA                    = N
+VTSWITCH                 = N
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = N
+SERMOUSE                 = Y
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = Y
+NOKBD                    = N
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
+####################################################################
+#
+# If the platform is uClinux running on an Isicad Prisma ...
+#
+####################################################################
+ifeq ($(ARCH), UCLINUX-PRISMA)
+
+UCROOT = /usr/local/uclinux
+
+endif
+
diff -urN lib/microwindows/src/Configs/config.psion /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.psion
--- lib/microwindows/src/Configs/config.psion	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.psion	2005-02-21 16:12:46.000000000 +0100
@@ -0,0 +1,300 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# LINUX-POWERPC
+# FREEBSD-X86
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-ARM
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+POWERPCTOOLSPREFIX       = powerpc-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = Y
+NWIDGET                  = Y
+OBJFRAMEWORK             = Y
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = N
+HAVE_PNM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+FREETYPE_FONT_DIR        = "/usr/local/microwin/fonts"
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = Y
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese BIG5 compiled in font support (big5font.c)
+####################################################################
+HAVE_BIG5_SUPPORT        = N
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+# Generate screen driver interface only with no fonts or clipping
+####################################################################
+NOFONTSORCLIPPING        = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 240
+SCREEN_DEPTH             = 2
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+FRAMEBUFFER              = Y
+FBVGA                    = N
+VTSWITCH                 = Y
+PORTRAIT_MODE            = N
+FBREVERSE                = Y
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# PSIONMOUSE for the Psion 5
+# TPHELIO for VTech Helio
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = N
+SERMOUSE                 = N
+TPMOUSE                  = N
+TPHELIO                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+PSIONMOUSE		 = Y
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = Y
+NOKBD                    = N
+
+endif
+
+####################################################################
+# Screen driver specific configuration
+# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller
+# INVERT4BPP 4bpp inverted pixel driver for VTech Helio
+####################################################################
+SA1100_LCD_LTLEND        = N
+INVERT4BPP               = N
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
+
+
diff -urN lib/microwindows/src/Configs/config.rtems /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.rtems
--- lib/microwindows/src/Configs/config.rtems	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.rtems	2005-02-21 16:12:46.000000000 +0100
@@ -0,0 +1,284 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = RTEMS
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+RTEMSTOOLSPREFIX         = i386-rtems-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = Y
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = N
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = N
+NANOXDEMO                = N
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = N
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_PALETTE
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = Y
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+FRAMEBUFFER              = Y
+FBVGA                    = Y
+VTSWITCH                 = N
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = N
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard type
+TTYKBD                   = N
+NOKBD                    = N
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /opt/rtems
+RTEMS_BSP                = pc486
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.svga /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.svga
--- lib/microwindows/src/Configs/config.svga	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.svga	2005-02-21 16:12:46.000000000 +0100
@@ -0,0 +1,250 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-NATIVE
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+NWIDGET                  = N
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+FRAMEBUFFER              = N
+FBVGA                    = Y
+VTSWITCH                 = N
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = Y
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = Y
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard type
+TTYKBD                   = Y
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.t1 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.t1
--- lib/microwindows/src/Configs/config.t1	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.t1	2005-02-21 16:12:48.000000000 +0100
@@ -0,0 +1,291 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-NATIVE
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = N
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+HAVE_XPM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = Y
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = Y
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+# Generate screen driver interface only with no fonts or clipping
+####################################################################
+NOFONTSORCLIPPING        = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+FRAMEBUFFER              = Y
+FBVGA                    = Y
+VTSWITCH                 = Y
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = Y
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = N
+SCANKBD                  = Y
+NOKBD                    = N
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.x11 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.x11
--- lib/microwindows/src/Configs/config.x11	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.x11	2005-02-21 16:12:46.000000000 +0100
@@ -0,0 +1,295 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-NATIVE
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = Y
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+HAVE_XPM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+FREETYPE_FONT_DIR        = "/usr/local/microwin/fonts"
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+# Generate screen driver interface only with no fonts or clipping
+####################################################################
+NOFONTSORCLIPPING        = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = Y
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+# You may want to turn this on for XFree86 4.x or if your backing store
+# isn't functioning properly
+USE_EXPOSURE		 = N
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+FRAMEBUFFER              = Y
+FBVGA                    = Y
+VTSWITCH                 = Y
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ,Intel Assabet, ARM ucb1200 (/dev/h3600_ts 11,0)
+####################################################################
+GPMMOUSE                 = Y
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard type
+TTYKBD                   = Y
+PIPEKBD                  = N
+NOKBD                    = N
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.xtt /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.xtt
--- lib/microwindows/src/Configs/config.xtt	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.xtt	2005-02-21 16:12:48.000000000 +0100
@@ -0,0 +1,288 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-NATIVE
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = Y
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+HAVE_XPM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = Y
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = Y
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+# Generate screen driver interface only with no fonts or clipping
+####################################################################
+NOFONTSORCLIPPING        = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = Y
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+FRAMEBUFFER              = Y
+FBVGA                    = Y
+VTSWITCH                 = Y
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = Y
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+
+# keyboard type
+TTYKBD                   = Y
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/Configs/config.yopy /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.yopy
--- lib/microwindows/src/Configs/config.yopy	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Configs/config.yopy	2005-02-21 16:12:47.000000000 +0100
@@ -0,0 +1,286 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+ARCH                     = LINUX-ARM
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = Y
+DEBUG                    = N
+VERBOSE                  = N
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = Y
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = N
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = Y
+NANOXDEMO                = Y
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = Y
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR0888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = Y
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+HAVE_XPM_SUPORT          = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = Y
+INCJPEG                  = .
+LIBJPEG                  = /skiff/local/arm-linux/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = N
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+FRAMEBUFFER              = Y
+FBVGA                    = N
+VTSWITCH                 = N
+PORTRAIT_MODE            = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ
+####################################################################
+GPMMOUSE                 = N
+SERMOUSE                 = N
+TPMOUSE                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+NOMOUSE                  = N
+YOPYMOUSE		 = Y
+
+# keyboard or null kbd driver
+TTYKBD                   = N
+NOKBD			 = Y
+
+endif
+
+####################################################################
+#
+# If the platform is a LINUX-ARM box ....
+#
+####################################################################
+ifeq ($(ARCH), LINUX-ARM)
+
+# If 4bpp driver with arm SA1100 LCD controller is used ...
+SA1100_LCD_LTLEND        = N
+
+endif
+
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/INSTALL /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/INSTALL
--- lib/microwindows/src/INSTALL	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/INSTALL	2005-02-21 16:13:39.000000000 +0100
@@ -0,0 +1,279 @@
+Microwindows Installation Documentation
+January 21, 2001 g haerr <greg@censoft.com>
+- For notes on eCos Linux Synthetic Target, see bottom of file -
+- For notes on Intel Assabet, see bottom of file -
+
+Microwindows compiles and runs on Linux, UNIX, ELKS, MSDOS, 
+RTEMS, X11 and bare hardware.  There is support for the MIPS,
+ARM, and x86 cpu's using the GNU C cross compiler.
+
+Microwindows can be compiled to use different screen, 
+mouse and keyboard drivers for a given operating system environment.
+Most options are set using configuration file (microwin/src/config) options.
+These options can be manually editted, or if running X11,
+by running a graphical configuration program that will read and 
+write the config file if desired by running "make xconfig".
+Other options are set in the graphics drawing engine's header
+file microwin/src/include/device.h.
+
+After changing any options in microwin/src/config, Microwindows
+is built by typing "make clean; make".
+
+Microwindows' header files can be written to /usr/lib/microwin,
+and libraries to /usr/lib by typing "make install".  This
+is not required unless using Microwindows to build other
+applications, however.  All demos build using the headers
+and libraries built in the source tree.
+
+Config options are detailed in the config file itself and
+following each operating environment below.  Setting the line
+	MICROWIN=Y
+will build Microwindows.  The line
+	NANOX=Y
+will build Nano-X.  Both are built by default.
+
+Setting OPTIMIZE=Y will run an the compiler's -O switch.
+Setting DEBUG=Y will add -g.  Setting VERBOSE=Y will display
+the full compiler command line when making.  When cross-compiling
+for different platforms, the various XXXTOOLSPREFIX values
+must be set accordingly.
+
+The Nano-X server can be built with a compiled-in application,
+or use UNIX sockets to allow seperately compiled applications
+to connect to the server.  Setting the line
+	LINK_APP_INTO_SERVER=Y
+will build a linked application/server, which is useful for debugging
+and speed.  The client/server networking code has been rewritten for speed.
+
+We now have support for scaled, rotated, and antialiased
+fonts with both truetype and adobe type 1 fonts.  To include
+support for truetype fonts, download freetype-1.3.1.tar.gz from
+either microwindows.org or www.freetype.org, and set:
+	HAVE_FREETYPE_SUPPORT=Y
+in the config file. For Adobe Type 1 font support, download
+t1lib-1.0.tar.tz from microwindows.org or 
+ftp://ftp.neuroinformatik.ruhr-uni-bochum.de/pub/software/t1lib/
+and set:
+	HAVE_T1LIB_SUPPORT=Y
+in the config file.  The ftdemo and t1demo programs demonstrate
+use of both truetype and type 1 fonts.
+
+To build the experimental NanoWidget library, set 
+	NWIDGET=Y
+in the config file.  Note that ELKS bcc can't currently compile
+the widget set, due to it's use of the ## token pasting preprocessor
+operator.  The demo application and server runs using ./demo.sh.
+
+All the demos are built in the microwin/src/bin directory.  Following
+are the current demos:
+
+mdemo		Microwindows 3d demo
+mterm		Microwindows terminal emulator
+demo		Nano-X demo
+demo3		Nano-X .bmp and .jpeg display demo
+landmine	Nano-X landmine game
+world		Nano-X world graph demo
+nterm		Nano-X terminal emulator
+nclock		Nano-X clock
+nano-X		Nano-X server (must be run before Nano-X demo)
+		(see demo*.sh)
+
+Linux
+=====
+Linux users set the line below in the config file.
+	ARCH=LINUX-NATIVE
+
+Linux users have the choice of running framebuffer screen drivers,
+which require kernel 2.2.x, the svgalib screen driver for
+Linux 2.0.x users, or X Windows.  The framebuffer driver runs on
+1, 2, 4, 8, 16 and 32bpp systems.  Both linear and VGA memory
+layouts are supported.  To choose between the framebuffer,
+svgalib driver or X Windows, (should run on all Linux systems),
+set one of the following lines in the config file:
+	FRAMEBUFFER=Y		(for 1, 2, 4, 8, 16 or 32 bpp linear fb access)
+	VGALIB=Y		(svgalib vga access)
+	HWVGA=Y			(hardware vga access for rtems)
+	X11=Y			(for X11)
+
+If FRAMEBUFFER is set, the following line enables the optional
+4 planes VGA non-linear driver:
+	FBVGA=Y			(for 4 planes VGA 16 color framebuffer)
+For MIPS and SuperH compilations, set FBVGA=N, since system header
+files don't contain outb() and outw() macros.
+
+When building the X11 version, it is very important to 
+set the SCREEN_PIXTYPE value correctly, as Microwindows
+will emulate the target pixel depth in X11.  See the
+config file for more details.
+
+Linux users can use either the GPM mouse driver, or a "bare"
+serial mouse driver that decodes the mouse directly from the 
+serial port.  Set either line in the config file.
+	GPMMOUSE=Y	or
+	SERMOUSE=Y
+	NOMOUSE=Y		(for no mouse)
+
+Note that to use the GPM driver, you must start GPM with
+the -R option, and usually specify the mouse type with -t.
+See mouse.sh for an example.  If using the direct serial
+mouse driver, the serial port may have to be specified in
+microwin/src/drivers/mou_ser.c, as it defaults to /dev/ttyS1.
+
+I have written a utility that converts MS fonts, for exact
+MS-Windows look and feel.  You must own a MS license in order
+to use an MS font.  To use the MS fonts, run mwin/src/fonts/convfnt32.exe
+on a Windows system, and it will create the win*.c font tables.
+Then, set the following line in the config file:
+	HAVEMSFONTS=Y
+
+
+ELKS
+====
+ELKS users set the line below in the config file.
+	ARCH=ELKS
+
+The NWIDGET=N line must be set, as bcc can't handle
+ansi C's token paste operator, used in the widget library.
+
+The serial mouse driver is in microwin/src/drivers/mou_ser.c.
+The default mouse port and type can be changed with the following
+environment variables, or changed in the driver.
+
+Environment Var		Default		Allowed
+MOUSE_TYPE		pc		ms, pc, logi(same as pc)
+MOUSE_PORT		/dev/ttys0	any serial port
+
+It might also be a good idea to use the XOR frame-redraw window
+move algorithm, by setting the following lines in the config file.
+The XOR algorithm redraws only after the window move is
+completed, which works well on slower cpu's.
+	ERASEMOVE=N
+	UPDATEREGIONS=N
+
+Since ELKS doesn't currently have a floating point library,
+the 3d demo is automatically compiled out of
+microwin/src/demos/microwin/demo.c:
+	#define GRAPH3D	0
+	#define IMAGE	0
+The IMAGE define is set to 0 as bringing in most
+images will break the 64k data segment limit.  The ELKS
+version also doesn't include the button control or wallpaper
+in the demo to keep the text/data sizes down.
+
+The latest version of the ELKS kernel supports a variant
+of UNIX sockets, using numbers rather than names.  To
+build a client/server version of Nano-X for ELKS, the config line
+	LINK_APP_INTO_SERVER=y
+must be set.  In addition, the bcc compiler doesn't support
+the ANSI C '##' token pasting operator which is used
+in the client request code, client.c.  Run the following
+perl script to preprocess the client.c source file:
+
+	cd microwin/src/nanox
+	mv client.c client.dist
+	./elkspatch.pl < client.dist > client.c
+
+MSDOS
+=====
+Microwindows is currently ported using MSC v5.10, and MASM.
+The file mcmwin.mak will build microwin.exe, and mcnanox.mak
+will build nanox.exe.  The DEMO= line can be changed to build
+different nano-X demos.
+
+There are contributed DJGPP and PACIFIC C ports.  Instructions
+are in microwin/src/contrib/djgpp and pacific.
+
+Framebuffer notes:
+If you haven't used any of the Linux 2.2 framebuffer drivers before,
+it can be a little daunting at first. Alex Buell has written a
+Framebuffer HOWTO, which is available on his website at
+http://www.tahallah.demon.co.uk/ which goes into detail about the
+various drivers, command line options, and the fbset utility.
+For any frame buffer other than the Vesa framebuffer
+(which can only change modes at bootup because it needs to
+execute the code in the video card's ROM in real mode),
+you can change bits per pixel with the command 'fbset -depth {8|16|24|32}'.
+Another very useful framebuffer site is http://www.linux-fbdev.org
+
+Intel Assabet
+-------------
+Microwindows compiles up fine on the StrongARM-based Intel
+Assabet.  The following information is known to work:
+
+1. Kernel version - linux-2.4.0-test11
+2. Patches - patch-2.4.0-test11-rmk1, diff-2.4.0-test11-rmk1-np3
+3. Set IPAQMOUSE=Y in Microwindows' config file
+4. "mknod /dev/h3600_ts c 11 0" to create the touchscreen device file
+5. If your screen isn't calibrated, you'll have to edit the Linux kernel:
+	- edit drivers/char/ucb1200_ts.c
+	- search for x_rev = 0 [around line 190]
+	- change x_rev and y_rev both to 1
+	- recompile the kernel
+6. More help is available at
+	http://www.cs.cmu.edu/~wearable/software/assabet.html
+
+eCos for Intel Assabet
+----------------------
+How to get it compile?
+
+1. Install the eCos repository and the 3GLab's touchscreen
+   driver from http://www.3glab.org/developer/ecos/
+
+2. Run the calibration program comes with touchscreen driver.
+   Write down the calibration values in braces. (Or save it to somewhere)
+
+3. make a eCos-Assabet installation with the following
+   commands. (Use EL/IX Template)
+	ecosconfig new assabet elix
+	ecosconfig add CYGPKG_DEVS_TOUCH_ARM_ASSABET
+	
+	supply the user_value in 
+	cdl_option CYGDAT_DEVS_TOUCH_ARM_ASSABET_CALIBRATION
+	to the values you get from step 2 (or your touchscreen will not work properly)
+
+	ecosconfig tree
+	make
+   
+4. modify ECOSINSTALLPATH in src/config to the directory of your eCos installation
+
+5. In the same file, modify ECOSASSABETTOOLSPREFIX to fit your eCos-Assabet tool chain configuration.
+6. Same as above, modify PLATFORM to ASSABET. (simply uncomment that line) 
+
+7. now go to src directory, and type make.
+8. the result will be located at bin/nano-X-ecos 
+
+eCos Linux Synthetic Target
+---------------------------
+How to get it compile?
+
+1. Install the eCos repository
+2  make a eCos Linux Synthetic Target installation with the following
+   commands. (Use EL/IX Template)
+	ecosconfig new linux elix
+	ecosconfig tree
+	make
+   
+3. modify ECOSINSTALLPATH in src/config to the directory of your eCos installation
+4  you may need to modify ECOSLINUXTOOLSPREFIX to fit your eCos Linux synthetic
+   target tool chain configuration.
+
+5. Since eCos synthetic target has no screen devices, I (I-Jui Sung) wrote a 
+   framebuffer simulator for microwindows using GTK+. you can download it at
+
+   http://www.csie.nctu.edu.tw/~ijsung/MicroWin-eCos/gtkserver.tar.gz
+
+   to compile it, simply extract it to a directory and type make
+6. modify GTKSERVERPATH in src/config to the directory you 
+   install framebuffer simulator in step 5.
+
+7. now go to src directory, and type make.
+8. the result will be in bin/nano-X-ecos  Before you run this,
+   be sure to execute the gtkserv you built in step 5. (under X, of course)
+9. if your bin/nano-X-ecos get some signo 11 error, rerun it again.
+
+
+Have fun!
+
+Greg Haerr
+<greg@censoft.com>
+
diff -urN lib/microwindows/src/LICENSE /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/LICENSE
--- lib/microwindows/src/LICENSE	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/LICENSE	2005-02-21 16:03:52.000000000 +0100
@@ -0,0 +1,34 @@
+The Microwindows, Nano-X, and BOGL software are licensed under the MPL,
+as specified below.  Alternatively, the software can be converted to
+the GNU General Public License, Version 2.
+
+/* 
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ * 
+ * The Original Code is MicroWindows.
+ * 
+ * The Initial Developer of the Original Code is Greg Haerr.
+ * Portions created by Greg Haerr are Copyright (C) 1999
+ * Greg Haerr <greg@censoft.com>. All Rights Reserved.
+ * 
+ * Contributor(s):
+ * 
+ * Alternatively, the contents of this file may be used under the terms
+ * of the GNU General Public license (the  "[GNU] License"), in which case the
+ * provisions of [GNU] License are applicable instead of those
+ * above.  If you wish to allow use of your version of this file only
+ * under the terms of the [GNU] License and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting  the provisions above and replace  them with the notice and
+ * other provisions required by the [GNU] License.  If you do not delete
+ * the provisions above, a recipient may use your version of this file
+ * under either the MPL or the [GNU] License.
+ */
diff -urN lib/microwindows/src/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Makefile
--- lib/microwindows/src/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Makefile	2005-02-21 16:13:39.000000000 +0100
@@ -0,0 +1,50 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+TOP = $(shell pwd)
+
+# See if the user has a local config file. If so use that else
+# use the one provided in the distribution.
+ifeq ($(HOME)/microwin/config,$(wildcard $(HOME)/microwin/config))
+CONFIG = $(HOME)/microwin/config
+else
+CONFIG = $(TOP)/config
+endif
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME =
+LIBNAMESO =
+
+# List of objects to compile
+OBJS =	
+
+# demos should be built after the libs !
+all: default
+#	$(MAKE) -C Biou_Te
+#	$(MAKE) -C demos
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
diff -urN lib/microwindows/src/Makefile.rules /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Makefile.rules
--- lib/microwindows/src/Makefile.rules	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/Makefile.rules	2005-02-21 16:13:40.000000000 +0100
@@ -0,0 +1,414 @@
+##############################################################################
+# Microwindows rules Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+#
+# This makefile should be placed at the top of a project hierarchy
+#
+# NOTE: The TOP environment variable should be set to that top directory
+##############################################################################
+
+ifeq ($(ARCH), DJGPP)
+SHELL = bash
+else
+SHELL = /bin/sh
+endif
+
+# install directories for headers and libraries
+INSTALL_PREFIX = /usr
+HDRINSTALLDIR = $(INSTALL_PREFIX)/include/microwin
+LIBINSTALLDIR = $(INSTALL_PREFIX)/lib
+
+INSTALL_DIR   = install -c -m 755 -o root -g root -d
+INSTALL_HDR   = install -c -m 644 -o root -g bin
+INSTALL_LIB   = install -c -m 444 -o root -g bin
+
+ifeq ($(ARCH), ECOS)
+INCLUDEDIRS += -I$(ECOSINSTALLPATH)/include
+ifeq ($(PLATFORM), LINUX)
+INCLUDEDIRS += -I$(GTKSERVERPATH)
+endif
+endif
+INCLUDEDIRS += -I. -I$(TOP)/include
+
+#
+# General configuration setup (see config file)
+#
+DEFINES += -DMWPIXEL_FORMAT=$(SCREEN_PIXTYPE)
+
+ifeq ($(VTSWITCH), Y)
+DEFINES += -DVTSWITCH=1
+endif
+
+ifeq ($(X11), Y)
+CFLAGS += -DX11=1
+LDFLAGS += -L/usr/X11R6/lib -lX11
+endif
+
+ifeq ($(VGALIB), Y)
+LDFLAGS += -lvga
+endif
+
+ifeq ($(ARCH),FREEBSD-X86)
+LDFLAGS += -lvgl
+endif
+
+ifeq ($(HAVE_FILEIO), Y)
+
+DEFINES += -DHAVE_FILEIO
+
+ifeq ($(HAVE_JPEG_SUPPORT), Y)
+DEFINES += -DHAVE_JPEG_SUPPORT=1
+INCLUDEDIRS += -I$(INCJPEG)
+endif
+
+ifeq ($(HAVE_PNG_SUPPORT), Y)
+DEFINES += -DHAVE_PNG_SUPPORT=1
+INCLUDEDIRS += -I$(INCPNG)
+endif
+
+ifeq ($(HAVE_T1LIB_SUPPORT), Y)
+DEFINES += -DHAVE_T1LIB_SUPPORT=1
+INCLUDEDIRS += -I$(INCT1LIB)
+endif
+
+ifeq ($(HAVE_FREETYPE_SUPPORT), Y)
+DEFINES += -DHAVE_FREETYPE_SUPPORT=1
+INCLUDEDIRS += -I$(INCFTLIB)
+endif
+
+ifeq ($(HAVE_HZK_SUPPORT), Y)
+DEFINES += -DHAVE_HZK_SUPPORT=1
+DEFINES += -DHZK_FONT_DIR="\"$(HZK_FONT_DIR)"\"
+endif
+
+ifeq ($(HAVE_BIG5_SUPPORT), Y)
+DEFINES += -DHAVE_BIG5_SUPPORT=1
+endif
+
+ifeq ($(HAVE_GB2312_SUPPORT), Y)
+DEFINES += -DHAVE_GB2312_SUPPORT=1
+endif
+
+ifeq ($(HAVE_BMP_SUPPORT), Y)
+DEFINES += -DHAVE_BMP_SUPPORT=1
+endif
+
+ifeq ($(HAVE_GIF_SUPPORT), Y)
+DEFINES += -DHAVE_GIF_SUPPORT=1
+endif
+
+ifeq ($(HAVE_PNM_SUPPORT), Y)
+DEFINES += -DHAVE_PNM_SUPPORT=1
+endif
+
+ifeq ($(HAVE_XPM_SUPPORT), Y)
+DEFINES += -DHAVE_XPM_SUPPORT=1
+endif
+
+endif
+
+ifeq ($(NOFONTSORCLIPPING), Y)
+CFLAGS += -DNOFONTSORCLIPPING=1
+endif
+
+ifeq ($(HAVE_SHAREDMEM_SUPPORT), Y)
+DEFINES += -DHAVE_SHAREDMEM_SUPPORT=1
+endif
+
+ifeq ($(SHAREDLIBS), Y)
+CFLAGS += -fpic
+endif
+
+ifeq ($(OPTIMIZE), Y)
+OPTFLAGS += -O3
+endif
+
+ifeq ($(DEBUG), Y)
+OPTFLAGS += -ggdb
+endif
+
+CFLAGS += $(INCLUDEDIRS)
+HOSTCFLAGS := $(CFLAGS)
+CPPFLAGS += $(DEFINES)
+LDFLAGS += -L$(TOP)/lib
+ARFLAGS = rs
+
+# Tools (may be overridden by Arch.rules)
+HOSTCC = gcc
+
+# Include the rules for arch's
+# if the user has a specific arch local to their home load it
+ifeq ($(HOME)/microwin/Arch.rules,$(wildcard $(HOME)/microwin/Arch.rules))
+include $(HOME)/microwin/Arch.rules
+else
+include $(TOP)/Arch.rules
+endif
+
+# Tools ...
+CC = $(TOOLSPREFIX)$(COMPILER)
+CXX = $(TOOLSPREFIX)$(CXX_COMPILER)
+AR = $(TOOLSPREFIX)ar
+LD = $(TOOLSPREFIX)ld
+NM = $(TOOLSPREFIX)nm
+STRIP = $(TOOLSPREFIX)strip
+OBJCOPY = $(TOOLSPREFIX)objcopy
+CP = cp
+MV = mv
+
+################## Libraries Section ##################
+
+MWINLIBS = $(TOP)/lib/libmwin.a $(TOP)/lib/libmwinlib.a\
+	$(TOP)/lib/libmwengine.a $(TOP)/lib/libmwdrivers.a\
+	$(TOP)/lib/libmwfonts.a $(TOP)/lib/libmwimages.a
+CCMWINLIBS = -lmwin -lmwinlib -lmwin -lmwengine -lmwdrivers -lmwfonts -lmwimages -lm
+
+ifeq ($(NWIDGET), Y)
+NANOXCLIENTLIBS += $(TOP)/lib/libnwidget.a
+#ifeq ($(LINK_APP_INTO_SERVER), Y)
+#NANOXSERVERLIBS += $(TOP)/lib/libnwidget.a
+#endif
+endif
+
+ifeq ($(LINK_APP_INTO_SERVER), Y)
+NANOXCLIENTLIBS += $(TOP)/lib/libnano-X.a $(TOP)/lib/libmwengine.a\
+	$(TOP)/lib/libmwdrivers.a $(TOP)/lib/libmwfonts.a
+CCNANOXCLIENTLIBS += -lnano-X -lmwengine -lmwdrivers -lmwfonts
+else
+NANOXCLIENTLIBS += $(TOP)/lib/libnano-X.a
+CCNANOXCLIENTLIBS += -lnano-X
+endif
+
+NANOXSERVERLIBS += $(TOP)/lib/libmwengine.a $(TOP)/lib/libmwdrivers.a\
+	$(TOP)/lib/libmwfonts.a
+CCNANOXSERVERLIBS += -lmwengine -lmwdrivers -lmwfonts
+
+ifeq ($(HAVE_FILEIO), Y)
+ifeq ($(HAVE_JPEG_SUPPORT), Y)
+MWINLIBS += $(LIBJPEG)
+CCMWINLIBS += $(LIBJPEG)
+NANOXLIBS += $(LIBJPEG)
+NANOXSERVERLIBS += $(LIBJPEG)
+ifeq ($(SHAREDLIBS), Y)
+	CCNANOXSERVERLIBS += $(LIBJPEG)
+endif
+ifeq ($(LINK_APP_INTO_SERVER), Y)
+	NANOXCLIENTLIBS += $(LIBJPEG)
+endif
+endif
+ifeq ($(HAVE_PNG_SUPPORT), Y)
+MWINLIBS += $(LIBPNG) $(LIBZ)
+CCMWINLIBS += $(LIBPNG) $(LIBZ)
+NANOXLIBS += $(LIBPNG) $(LIBZ)
+NANOXSERVERLIBS += $(LIBPNG) $(LIBZ)
+ifeq ($(SHAREDLIBS), Y)
+	CCNANOXSERVERLIBS += $(LIBPNG) $(LIBZ)
+endif
+ifeq ($(LINK_APP_INTO_SERVER), Y)
+	NANOXCLIENTLIBS += $(LIBPNG) $(LIBZ)
+endif
+endif
+
+endif
+
+ifeq ($(HAVE_T1LIB_SUPPORT), Y)
+MWINLIBS += $(LIBT1LIB)
+CCMWINLIBS += $(LIBT1LIB)
+NANOXLIBS += $(LIBT1LIB)
+NANOXSERVERLIBS += $(LIBT1LIB)
+ifeq ($(SHAREDLIBS), Y)
+	CCNANOXSERVERLIBS += $(LIBT1LIB)
+endif
+ifeq ($(LINK_APP_INTO_SERVER), Y)
+	NANOXCLIENTLIBS += $(LIBT1LIB)
+endif
+LDFLAGS += -lm
+endif
+
+ifeq ($(HAVE_FREETYPE_SUPPORT), Y)
+MWINLIBS += $(LIBFTLIB)
+CCMWINLIBS += $(LIBFTLIB)
+NANOXLIBS += $(LIBFTLIB)
+NANOXSERVERLIBS += $(LIBFTLIB)
+ifeq ($(SHAREDLIBS), Y)
+	CCNANOXSERVERLIBS += $(LIBFTLIB)
+endif
+ifeq ($(LINK_APP_INTO_SERVER), Y)
+	NANOXCLIENTLIBS += $(LIBFTLIB)
+endif
+LDFLAGS += -lm
+endif
+
+ifeq ($(ARCH), ELKS)
+CCMWINLIBS = $(MWINLIBS)
+CCNANOXLIBS = $(NANOXLIBS)
+endif
+
+ifeq ($(ARCH), DJGPP)
+CCMWINLIBS = $(MWINLIBS) -lgrx20
+CCNANOXLIBS = $(NANOXLIBS) 
+NANOXCLIENTLIBS += -lgrx20
+endif
+
+################## End of Libraries Section ##################
+
+# If you dont want to see every executed command ...
+ifeq ($(VERBOSE), N)
+.SILENT:
+endif
+
+.PHONY: default subdirs clean cleandepend xconfig
+
+# Add any exportable variable here
+export TOP ARCH CONFIG
+
+#
+# This is the default target
+# It looks for sub-directories with makefiles in it and tries to execute them
+#
+ifeq ($(SHAREDLIBS), Y)
+default: subdirs $(OBJS) $(CXXOBJS) $(TOP)/lib/$(LIBNAME) $(TOP)/lib/$(LIBNAMESO)
+else
+default: subdirs $(OBJS) $(CXXOBJS) $(ASMOBJS) $(TOP)/lib/$(LIBNAME)
+endif
+
+dirs =	$(shell for file in `\ls`; \
+	do if [ -d $$file -a $$file != "demos" ]; then \
+	if [ -f $$file/Makefile ]; then echo $$file; fi; fi; done)
+
+demos =	$(shell for file in `\ls`; \
+	do if [ -d $$file -a $$file = "demos" ]; then \
+	if [ -f $$file/Makefile ]; then echo $$file; fi; fi; done)
+
+#
+# Subdirectories target
+#
+subdirs:
+ifeq ($(ARCH), DJGPP)
+
+	$(shell set CURDIR=$(pwd);)
+
+	$(shell \
+	if [ ! -d $(TOP)/bin ]; \
+	then mkdir $(TOP)/bin; fi;)
+
+	$(shell \
+	if [ ! -d $(TOP)/lib ]; \
+	then mkdir $(TOP)/lib; fi;)
+
+endif
+	$(foreach dir, $(dirs), $(MAKE) -C $(dir);)
+
+#
+# If a library name is specified,
+# a library of that name will be created with objects in that directory
+#
+ifneq ($(LIBNAME), )
+$(TOP)/lib/$(LIBNAME): $(OBJS) $(CXXOBJS)
+	@echo "Creating library $@ ..."
+	$(AR) $(ARFLAGS) $(TOP)/lib/$(LIBNAME) $(OBJS) $(CXXOBJS) $(ASMOBJS)
+endif
+
+#
+# If a shared object library name is specified, link this object
+#
+ifeq ($(SHAREDLIBS), Y)
+$(TOP)/lib/$(LIBNAMESO): $(TOP)/lib/$(LIBNAME)
+	@echo "Creating shared library $@ ..."
+	$(LD) -shared -o $@ --whole-archive $^
+endif
+
+#
+# Dependencies target for C files
+#
+
+#temp:ijsung
+#.depend: $(OBJS:.o=.c) $(CXXOBJS:.o=.cc)
+#	@echo "Updating dependencies in $(CURDIR) ..."
+#	$(SHELL) -ec '$(HOSTCC) -MM $(CPPFLAGS) $(CFLAGS) $(OBJS:.o=.c) \
+#	| sed '\''s/\($*\)\.o[ :]*/\1.o \$@ : $$(TOP)\/config /g'\'' > $@; \
+#	[ -s $@ ] || rm -f $@'
+
+#
+# Compilation target for C files
+#
+%.o:%.c
+	echo "Compiling $< ..."
+	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+
+#
+# Compilation target for C++ files
+#
+%.o:%.cc
+	@echo "C++ compiling $< ..."
+	$(CXX) -c $(CFLAGS) $(CXXFLAGS) -o $@ $<
+
+#
+# Compilation target for bmp file conversion
+#
+%.c:%.bmp $(TOP)/mwin/bmp/convbmp.c
+	echo "Generating $@ from bitmap file ..."
+	$(TOP)/bin/convbmp $< > $@
+
+xconfig:
+	./xconfigure
+
+# don't clean lib dir
+cleanapps: cleandepend
+	@echo "Cleaning directory $(CURDIR) ..."
+	$(RM) core *~ *.bak *.o TAGS
+	$(RM) bin/*
+	$(foreach dir, $(dirs), $(MAKE) -C $(dir) cleanapps;)
+	$(foreach dir, $(demos), $(MAKE) -C $(dir) cleanapps;)
+
+clean: cleandepend
+	@echo "Cleaning directory $(CURDIR) ..."
+	$(RM) core *~ *.bak *.o TAGS
+	$(RM) $(TOP)/lib/*.a $(TOP)/lib/*.so
+	$(shell cd $(TOP)/bin; \
+		for file in `\ls`; do if [ ! -d $$file ]; \
+		then $(RM) $$file; fi; done; cd $(TOP))
+	$(foreach dir, $(dirs), $(MAKE) -C $(dir) clean;)
+	$(foreach dir, $(demos), $(MAKE) -C $(dir) clean;)
+
+
+cleandepend:
+	@echo "Cleaning dependencies in directory $(CURDIR) ..."
+	$(RM) .depend
+	$(foreach dir, $(dirs), $(MAKE) -C $(dir) cleandepend;)	
+	$(foreach dir, $(demos), $(MAKE) -C $(dir) cleandepend;)	
+
+install: default
+	$(INSTALL_DIR) $(HDRINSTALLDIR)
+	echo "Copying hdrs to $(HDRINSTALLDIR)"
+	$(INSTALL_HDR) include/*.h $(HDRINSTALLDIR)
+	echo "Copying libs to $(LIBINSTALLDIR)"
+	$(INSTALL_DIR) $(LIBINSTALLDIR)
+	$(INSTALL_LIB) lib/*.a $(LIBINSTALLDIR)
+ifeq ($(SHAREDLIBS), Y)
+	$(INSTALL_LIB) lib/*.so $(LIBINSTALLDIR)
+endif
+	echo "Installation completed successfully."
+
+tags:
+	-rm -f TAGS
+	etags --language=c++ --append \
+		`find . \( -name '*.h' -o -name '*.cc' \) -print`
+	etags --language=c --append `find . -name \*.[hc] -print`
+	etags --language=asm --append `find . -name \*.[Ss] -print`
+
+#
+# Included dependency files
+#
+ifneq ($(MAKECMDGOALS), clean)
+ifneq ($(MAKECMDGOALS), cleandepend)
+ifneq ($(MAKECMDGOALS), realclean)
+ifneq ($(MAKECMDGOALS), xconfig)
+ifneq ($(OBJS),)
+-include .depend
+endif
+endif
+endif
+endif
+endif
+
diff -urN lib/microwindows/src/TODO /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/TODO
--- lib/microwindows/src/TODO	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/TODO	2005-02-21 16:13:40.000000000 +0100
@@ -0,0 +1,89 @@
+add stretch blit for background images
+
+send recursive UPDATE_MOVE events to child windows, correct wp->x, wp->y sent
+add WM_KEYDOWN/KEYUP bits to win32
+fix GR_EVENT_TYPE_BUTTON_UP doesn't include correct buttons entry for up button
+client/server gets screwed up on GsError delivery (GrCloseWindow for instance)
+NanoWM should decorate top level windows only
+rewrite nanowm to be table-driven
+change NewWindow to allow style bits
+MAXREQSIZE is statically compiled into each client, should be server only
+fix MAXREQSIZE of 10000 in nxproto.h for images...
+fix nxterm to take x,y,w,h fg,bg on startup
+fix nxterm to redisplay properly
+fix potential sibling window clip bug with move2.sh and nanowm
+allow nano-x wm to run linked with server
+
+add memmove mods to fblin16, 8 drivers for src in dst rectangle
+
+fix GrBitmap bit orders? (reversed from X11?)
+clear loaded images in server on app exit
+fix strlen(const "") (bug in nxkbd.c for #define TITLE)
+free props.title is required in client/server but must not in link-into-server
+
+change VTech Helio kernel to return proper visual for scr_fb.c (TPHELIO)
+
+automatically create correct MWPIXEL_FORMAT in exported mwtypes.h
+fix Polygon auto-complete outline
+
+GdHideCursor/ShowCursor still interferes with GdFixCursor
+	for X11 Enter/LeaveNotify auto-hiding of cursor
+add startup options: -portrait, -landscape
+t1lib UCS2->8859 conversion
+fix fonts/convbdf for > 126 chars, check for constant widths, omit width table
+auto swap x/y for autoportrait mode if y>x unless -portrait
+
+hwnd->update should be an HRGN, make things easier
+hwnd->update should be cleared in BeginPaint, except for OWNDC
+BeginPaint requires DCX_EXCLUDEUPDATE, may be buggy
+Add drawarea driver entry point to all scr*.c!
+add blitting to svgalib driver
+
+handle WS_POPUP owner vs parent for GetParent call
+handle lost focus on disable window call, check disabled when setfocus
+change kbd driver to return ESC, exit check in upper level GsCheckKbd
+slim down devfont.c for small systems
+add showcursor flag on return from mousedev open
+remove sinfo struct
+cursor isn't clipped from blit source rectangle (mterm cursor bug)
+share clipping code winclip.c with nanox/srvutil.c
+implement client and window rects in nanox
+support CopyArea for offscreen drawing
+rewrite GdArea to use bitblit
+build window mgr api
+implement CopyArea to perform BitBlit
+change printf's to GsError returns in srvnet.c
+X11 still has flush problems with demo.c
+add length fields to replies
+nomalloc returns are bad in wrapper functions
+fix GrRetNoMem to be GsError()
+fix DeliverEvent in client lib
+move to Xlib api compatibility
+warn if bad color args are passed?
+
+put fixed bcc allowing // comments on ftp site
+
+have GrGetNextEvent work with timeout returns, for nclock.c etc
+fix GrRegisterInput for multiple fd's
+fix GrRegisterInput to work with GrCheckNextEvent
+
+eliminate any timeout in select() loop
+no duplicate /dev/tty0 open
+fix -O3 framebuffer compile requirement
+remove gen_ routines from screen drivers into library, create fb library
+tag bitmap drawing palette conversion table to bitmap ID for speed
+fix DOS driver for stdpal4bpp for static pseudocolor
+rotate 2bpp Everex driver for normal display viewing
+
+convert all drivers to blit
+get fast inline memcpy, memcpyw, memcpyl for bitblt
+turn on NDEBUG for speed
+bitblt src screen clipping not implemented
+bitblt src mem clipping (copy BLACK?) not implemented
+bitblt assumes src and dest bitmap are same bpp
+vgaplan4 still needs vga_to_mempl4 blit
+fix asmplan4.s: don't draw last point, add psd struct, write ega_init
+
+allow more than one WndRegisterFdInput, run multiple mterm's
+dynamically load fonts, replace existing ones
+error check gdi structures, check for magic word
diff -urN lib/microwindows/src/config /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/config
--- lib/microwindows/src/config	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/config	2005-02-21 16:13:39.000000000 +0100
@@ -0,0 +1,371 @@
+####################################################################
+# Microwindows and Nano-X configuration file
+#
+# This package can be configured to run on Linux (MIPS, ARM, POWERPC or x86)
+# UNIX, ELKS, DJGPP, or RTEMS.
+# On Linux, we've got drivers for Linux 2.x framebuffers, X11, or,
+# svgalib for VGA hardware.
+# In addition, a gpm or direct serial mouse driver can be configured.
+# On ELKS, the bios screen driver and serial mouse driver are always used.
+#
+# Either Microwindows and/or Nano-X can be built.
+# Microwindows and Nano-X have several demos.
+#
+# For MSDOS makes, see mcmwin.mak and mcnanox.mak
+####################################################################
+
+####################################################################
+#
+# build target platform
+#
+# Valid ARCH values are:
+#
+# LINUX-NATIVE
+# LINUX-ARM
+# LINUX-MIPS
+# LINUX-POWERPC
+# LINUX-SH
+# FREEBSD-X86
+# SOLARIS
+# RTEMS
+# DJGPP
+# ELKS
+
+#<ijsung>
+# ECOS-ASSABET
+# ECOS-LINUX
+#</ijsung>
+
+#
+# note: ELKS can't build client/server nano-X, nor widget lib
+#
+####################################################################
+#ARCH                     = LINUX-NATIVE
+
+ARCH			 = ECOS
+# in the arch-platform style
+#PLATFORM		 = LINUX
+PLATFORM		 = ASSABET
+
+ARMTOOLSPREFIX           = arm-linux-
+MIPSTOOLSPREFIX          = mipsel-linux-
+POWERPCTOOLSPREFIX       = powerpc-linux-
+SHTOOLSPREFIX            = sh-linux-gnu
+RTEMSTOOLSPREFIX         = i386-rtemself-
+
+###eCos related###
+#<ijsung> 
+ECOSASSABETTOOLSPREFIX	= arm-elf-
+ECOSLINUXTOOLSPREFIX	= i686-pc-linux-gnu-
+
+ifeq ($(PLATFORM), LINUX)
+ECOSINSTALLPATH		= /mnt/workshop/synth_test/install
+endif
+
+ifeq ($(PLATFORM), ASSABET)
+ECOSINSTALLPATH		= /mnt/workshop/eCosBuilds/AssabetTouch/install
+endif
+
+GTKSERVERPATH		= /mnt/workshop/microwindows/gtkserver
+#</ijsung>
+
+####################################################################
+#
+# Compiling options
+#
+####################################################################
+OPTIMIZE                 = N
+DEBUG                    = Y
+VERBOSE                  = Y
+
+####################################################################
+#
+# Libraries to build: microwin, nano-X, nanowidget, object frameworks
+#
+####################################################################
+MICROWIN                 = N
+NANOX                    = Y
+SHAREDLIBS               = N
+NWIDGET                  = N
+OBJFRAMEWORK             = N
+
+
+####################################################################
+#
+# Demos to build
+#
+####################################################################
+MICROWINDEMO             = N
+NANOXDEMO                = N
+
+####################################################################
+#
+# Applications to build
+#
+####################################################################
+NANOWM                   = N
+
+####################################################################
+#
+# The pixeltype of the native hardware or underlying graphics library.
+# This definition defines the PIXELVAL to be 32, 16 or 8 bits wide.
+# If using Linux framebuffer, set to MWPF_TRUECOLOR0888, and use fbset.
+# It also enables GdArea/GrArea for this particular pixel packing format.
+#
+# define MWPF_PALETTE       /* pixel is packed 8 bits 1, 4 or 8 pal index*/
+# define MWPF_TRUECOLOR0888 /* pixel is packed 32 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR888  /* pixel is packed 24 bits 8/8/8 truecolor*/
+# define MWPF_TRUECOLOR565  /* pixel is packed 16 bits 5/6/5 truecolor*/
+# define MWPF_TRUECOLOR555  /* pixel is packed 16 bits 5/5/5 truecolor*/
+# define MWPF_TRUECOLOR332  /* pixel is packed 8 bits 3/3/2 truecolor*/
+#
+####################################################################
+
+#Our Simulator uses 24-bit buffer
+#SCREEN_PIXTYPE           = MWPF_TRUECOLOR888
+
+####################################################################
+#
+# NanoX: Put Y to the following line to link the nano-X application
+# with the server.  This is required for ELKS, if no network is present,
+# or for speed or debugging.  This affects the nano-X server only.
+#
+####################################################################
+LINK_APP_INTO_SERVER     = N
+
+####################################################################
+#
+# File I/O support
+# Supporting either below drags in libc stdio, which may not be wanted
+#
+####################################################################
+HAVE_FILEIO              = N
+
+####################################################################
+# BMP, GIF reading support
+####################################################################
+HAVE_BMP_SUPPORT         = Y
+HAVE_GIF_SUPPORT         = Y
+HAVE_PNM_SUPPORT         = Y
+HAVE_XPM_SUPPORT         = Y
+
+####################################################################
+# JPEG support through libjpeg, see README.txt in contrib/jpeg
+####################################################################
+HAVE_JPEG_SUPPORT        = N
+INCJPEG                  = .
+LIBJPEG                  = /usr/lib/libjpeg.a
+
+####################################################################
+# PNG support via libpng and libz
+####################################################################
+HAVE_PNG_SUPPORT         = N
+INCPNG                   = .
+LIBPNG                   = /usr/lib/libpng.a
+LIBZ                     = /usr/lib/libz.a
+
+####################################################################
+# T1 adobe type1 font support thru t1lib
+####################################################################
+HAVE_T1LIB_SUPPORT       = N
+INCT1LIB                 = /usr/include
+LIBT1LIB                 = /usr/lib/libt1.a
+
+####################################################################
+# TrueType font support thru FreeType
+####################################################################
+HAVE_FREETYPE_SUPPORT    = N
+INCFTLIB                 = /usr/include
+LIBFTLIB                 = /usr/lib/libttf.so
+FREETYPE_FONT_DIR        = "/usr/local/microwin/fonts"
+
+####################################################################
+# Shared memory support for Nano-X client/server protocol speedup
+####################################################################
+HAVE_SHAREDMEM_SUPPORT   = N
+
+####################################################################
+# Chinese Han Zi Ku font support
+####################################################################
+HAVE_HZK_SUPPORT         = N
+HZK_FONT_DIR             = "fonts/chinese"
+
+####################################################################
+# Chinese BIG5 compiled in font support (big5font.c)
+####################################################################
+HAVE_BIG5_SUPPORT        = N
+
+####################################################################
+# Chinese GB2312 compiled in font support (gb2312font.c)
+####################################################################
+HAVE_GB2312_SUPPORT      = N
+
+####################################################################
+# Generate screen driver interface only with no fonts or clipping
+####################################################################
+NOFONTSORCLIPPING        = N
+
+####################################################################
+#
+# Window move algorithms for Microwindows
+# Change for tradeoff between cpu speed and looks
+# ERASEMOVE repaints only backgrounds while window dragging, quicker.
+# Otherwise an XOR redraw is used for window moves only after button up,
+# quickest (should set for ELKS)
+# UPDATEREGIONS paints in update clipping region only for better look and feel
+#
+####################################################################
+ERASEMOVE                = Y
+UPDATEREGIONS            = Y
+
+####################################################################
+#
+# Use MS fonts (default no)
+#
+####################################################################
+HAVEMSFONTS              = N
+
+####################################################################
+#
+# Link with Gray Palette (valid only for 4bpp modes)
+#
+####################################################################
+GRAYPALETTE              = N
+
+####################################################################
+#
+# If the platform is running UNIX, Linux or RTEMS...
+#
+####################################################################
+ifneq ($(ARCH), ELKS)
+
+# X Window screen, mouse and kbd drivers
+X11                      = N
+
+ifeq ($(X11), Y)
+# predefined model or select screen width, height, depth(palette mode only)
+SCREEN_E15               = 
+SCREEN_WIDTH             = 640
+SCREEN_HEIGHT            = 480
+SCREEN_DEPTH             = 4
+
+# You may want to turn this on for XFree86 4.x or if your backing store
+# isn't functioning properly
+USE_EXPOSURE		 = N
+
+else
+
+# framebuffer screen driver (linear and/or vga 4 planes)
+# set VTSWITCH to include virtual terminal switch code
+# set PORTRAIT_MODE to L or R for left or right orientation
+# set FBREVERSE to reverse bit orders in 1,2,4 bpp
+FBVGA                    = N
+FRAMEBUFFER              = N
+FBVGA                    = Y
+VTSWITCH                 = Y
+PORTRAIT_MODE            = N
+FBREVERSE                = N
+
+# svgalib screen driver
+VGALIB                   = N
+
+# direct VGA hardware access screen driver
+HWVGA                    = N
+
+####################################################################
+# Mouse or touch screen driver
+# TPMOUSE for Linux-VR and Embedded Planet
+# TPHELIO for VTech Helio
+# ADSMOUSE for ADS Graphics Client
+# IPAQMOUSE for Compaq iPAQ,Intel Assabet, ARM ucb1200 (/dev/h3600_ts 11,0)
+# HARRIERMOUSE for NEC Harrier
+# PSIONMOUSE for the Psion 5
+####################################################################
+GPMMOUSE                 = Y
+SERMOUSE                 = N
+TPMOUSE                  = N
+TPHELIO                  = N
+ADSMOUSE                 = N
+IPAQMOUSE                = N
+HARRIERMOUSE             = N
+PSIONMOUSE               = N
+NOMOUSE                  = N
+
+# keyboard or null kbd driver
+TTYKBD                   = N
+SCANKBD                  = Y
+PIPEKBD                  = N
+NOKBD                    = N
+
+endif
+
+####################################################################
+# Screen driver specific configuration
+# SA1100_LCD_LTLEND 4bpp driver with arm SA1100 LCD controller
+# INVERT4BPP 4bpp inverted pixel driver for VTech Helio
+####################################################################
+SA1100_LCD_LTLEND        = N
+INVERT4BPP               = N
+
+############eCos+Linux Synthetic Target##################
+ifeq ($(ARCH), ECOS)
+ECOS = Y
+
+#Linux Synthetic Target Driver
+ifeq ($(PLATFORM), LINUX)
+GTKSCREEN		 = Y
+#Our Simulator uses 24-bit buffer
+SCREEN_PIXTYPE           = MWPF_TRUECOLOR888
+
+endif
+
+ifeq ($(PLATFORM), ASSABET)
+IOMONITOR		= Y
+#Assabet use 565 truecolor
+SCREEN_PIXTYPE		 = MWPF_TRUECOLOR565
+endif
+
+
+HAVE_SHAREDMEM_SUPPORT   = N
+HAVE_FILEIO              = N
+GPMMOUSE		 = N
+VTSWITCH 		 = N 
+NOMOUSE			 = N
+SCANKBD			 = N
+NOKBD			 = Y
+##UNIX			 = N
+endif
+
+####################################################################
+#
+# If the platform is a RTEMS box ....
+#
+####################################################################
+ifeq ($(ARCH), RTEMS)
+
+# Location & BSP information of the RTEMS build
+RTEMS_BUILD              = /tools/build-i386-elf-rtems
+RTEMS_BSP                = pc386
+LINK_APP_INTO_SERVER     = Y
+
+endif
+
+endif
+
+####################################################################
+#
+# If the platform is an ELKS box ...
+#
+####################################################################
+ifeq ($(ARCH), ELKS)
+
+# Higher speed asm driver, c driver of hercules screen driver
+ASMVGADRIVER             = Y
+CVGADRIVER               = N
+HERCDRIVER               = N
+DBGDRIVER                = N
+
+# Mouse support
+SERMOUSE                 = Y
+
+endif
diff -urN lib/microwindows/src/contrib/BSD/bcopy.s /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/BSD/bcopy.s
--- lib/microwindows/src/contrib/BSD/bcopy.s	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/BSD/bcopy.s	2005-02-21 16:12:48.000000000 +0100
@@ -0,0 +1,1580 @@
+Hi,
+
+The following code is the file support.s from the FreeBSD 2.6
+distribution for i386.  I included the entire file so you can
+pick and choose as you like and you can pick up the license.
+There's a generic bcopy that does overlapping, uses rep movs
+in the largest chunk possible, etc.  That might do the trick.
+There's a few macros around but hopefully you can decipher
+them.
+
+Later,
+FM
+
+--
+Frank W. Miller
+Cornfed Systems Inc
+www.cornfed.com
+
+
+--
+/*-
+ * Copyright (c) 1993 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *	$Id: support.s,v 1.41.2.7 1997/03/05 16:31:51 bde Exp $
+ */
+
+#include "npx.h"
+#include "opt_cpu.h"
+
+#include <machine/asmacros.h>
+#include <machine/cputypes.h>
+#include <machine/pmap.h>
+#include <machine/specialreg.h>
+
+#include "assym.s"
+
+#define KDSEL		0x10			/* kernel data selector */
+#define IDXSHIFT	10
+
+	.data
+	.globl	_bcopy_vector
+_bcopy_vector:
+	.long	_generic_bcopy
+	.globl	_bzero
+_bzero:
+	.long	_generic_bzero
+	.globl	_copyin_vector
+_copyin_vector:
+	.long	_generic_copyin
+	.globl	_copyout_vector
+_copyout_vector:
+	.long	_generic_copyout
+	.globl	_ovbcopy_vector
+_ovbcopy_vector:
+	.long	_generic_bcopy
+#if defined(I586_CPU) && NNPX > 0
+kernel_fpu_lock:
+	.byte	0xfe
+	.space	3
+#endif
+
+	.text
+
+/*
+ * bcopy family
+ * void bzero(void *buf, u_int len)
+ */
+
+ENTRY(generic_bzero)
+	pushl	%edi
+	movl	8(%esp),%edi
+	movl	12(%esp),%ecx
+	xorl	%eax,%eax
+	shrl	$2,%ecx
+	cld
+	rep
+	stosl
+	movl	12(%esp),%ecx
+	andl	$3,%ecx
+	rep
+	stosb
+	popl	%edi
+	ret
+
+#if defined(I486_CPU)
+ENTRY(i486_bzero)
+	movl	4(%esp),%edx
+	movl	8(%esp),%ecx
+	xorl	%eax,%eax
+/*
+ * do 64 byte chunks first
+ *
+ * XXX this is probably over-unrolled at least for DX2's
+ */
+2:
+	cmpl	$64,%ecx
+	jb	3f
+	movl	%eax,(%edx)
+	movl	%eax,4(%edx)
+	movl	%eax,8(%edx)
+	movl	%eax,12(%edx)
+	movl	%eax,16(%edx)
+	movl	%eax,20(%edx)
+	movl	%eax,24(%edx)
+	movl	%eax,28(%edx)
+	movl	%eax,32(%edx)
+	movl	%eax,36(%edx)
+	movl	%eax,40(%edx)
+	movl	%eax,44(%edx)
+	movl	%eax,48(%edx)
+	movl	%eax,52(%edx)
+	movl	%eax,56(%edx)
+	movl	%eax,60(%edx)
+	addl	$64,%edx
+	subl	$64,%ecx
+	jnz	2b
+	ret
+
+/*
+ * do 16 byte chunks
+ */
+	SUPERALIGN_TEXT
+3:
+	cmpl	$16,%ecx
+	jb	4f
+	movl	%eax,(%edx)
+	movl	%eax,4(%edx)
+	movl	%eax,8(%edx)
+	movl	%eax,12(%edx)
+	addl	$16,%edx
+	subl	$16,%ecx
+	jnz	3b
+	ret
+
+/*
+ * do 4 byte chunks
+ */
+	SUPERALIGN_TEXT
+4:
+	cmpl	$4,%ecx
+	jb	5f
+	movl	%eax,(%edx)
+	addl	$4,%edx
+	subl	$4,%ecx
+	jnz	4b
+	ret
+
+/*
+ * do 1 byte chunks
+ * a jump table seems to be faster than a loop or more range reductions
+ *
+ * XXX need a const section for non-text
+ */
+	.data
+jtab:
+	.long	do0
+	.long	do1
+	.long	do2
+	.long	do3
+
+	.text
+	SUPERALIGN_TEXT
+5:
+	jmp	jtab(,%ecx,4)
+
+	SUPERALIGN_TEXT
+do3:
+	movw	%ax,(%edx)
+	movb	%al,2(%edx)
+	ret
+
+	SUPERALIGN_TEXT
+do2:
+	movw	%ax,(%edx)
+	ret
+
+	SUPERALIGN_TEXT
+do1:
+	movb	%al,(%edx)
+	ret
+
+	SUPERALIGN_TEXT
+do0:
+	ret
+#endif
+
+#if defined(I586_CPU) && NNPX > 0
+ENTRY(i586_bzero)
+	movl	4(%esp),%edx
+	movl	8(%esp),%ecx
+
+	/*
+	 * The FPU register method is twice as fast as the integer register
+	 * method unless the target is in the L1 cache and we pre-allocate a
+	 * cache line for it (then the integer register method is 4-5 times
+	 * faster).  However, we never pre-allocate cache lines, since that
+	 * would make the integer method 25% or more slower for the common
+	 * case when the target isn't in either the L1 cache or the L2 cache.
+	 * Thus we normally use the FPU register method unless the overhead
+	 * would be too large.
+	 */
+	cmpl	$256,%ecx	/* empirical; clts, fninit, smsw cost a lot */
+	jb	intreg_i586_bzero
+
+	/*
+	 * The FPU registers may belong to an application or to fastmove()
+	 * or to another invocation of bcopy() or ourself in a higher level
+	 * interrupt or trap handler.  Preserving the registers is
+	 * complicated since we avoid it if possible at all levels.  We
+	 * want to localize the complications even when that increases them.
+	 * Here the extra work involves preserving CR0_TS in TS.
+	 * `npxproc != NULL' is supposed to be the condition that all the
+	 * FPU resources belong to an application, but npxproc and CR0_TS
+	 * aren't set atomically enough for this condition to work in
+	 * interrupt handlers.
+	 *
+	 * Case 1: FPU registers belong to the application: we must preserve
+	 * the registers if we use them, so we only use the FPU register
+	 * method if the target size is large enough to amortize the extra
+	 * overhead for preserving them.  CR0_TS must be preserved although
+	 * it is very likely to end up as set.
+	 *
+	 * Case 2: FPU registers belong to fastmove(): fastmove() currently
+	 * makes the registers look like they belong to an application so
+	 * that cpu_switch() and savectx() don't have to know about it, so
+	 * this case reduces to case 1.
+	 *
+	 * Case 3: FPU registers belong to the kernel: don't use the FPU
+	 * register method.  This case is unlikely, and supporting it would
+	 * be more complicated and might take too much stack.
+	 *
+	 * Case 4: FPU registers don't belong to anyone: the FPU registers
+	 * don't need to be preserved, so we always use the FPU register
+	 * method.  CR0_TS must be preserved although it is very likely to
+	 * always end up as clear.
+	 */
+	cmpl	$0,_npxproc
+	je	i586_bz1
+	cmpl	$256+184,%ecx		/* empirical; not quite 2*108 more */
+	jb	intreg_i586_bzero
+	sarb	$1,kernel_fpu_lock
+	jc	intreg_i586_bzero
+	smsw	%ax
+	clts
+	subl	$108,%esp
+	fnsave	0(%esp)
+	jmp	i586_bz2
+
+i586_bz1:
+	sarb	$1,kernel_fpu_lock
+	jc	intreg_i586_bzero
+	smsw	%ax
+	clts
+	fninit				/* XXX should avoid needing this */
+i586_bz2:
+	fldz
+
+	/*
+	 * Align to an 8 byte boundary (misalignment in the main loop would
+	 * cost a factor of >= 2).  Avoid jumps (at little cost if it is
+	 * already aligned) by always zeroing 8 bytes and using the part up
+	 * to the _next_ alignment position.
+	 */
+	fstl	0(%edx)
+	addl	%edx,%ecx		/* part of %ecx -= new_%edx - %edx */
+	addl	$8,%edx
+	andl	$~7,%edx
+	subl	%edx,%ecx
+
+	/*
+	 * Similarly align `len' to a multiple of 8.
+	 */
+	fstl	-8(%edx,%ecx)
+	decl	%ecx
+	andl	$~7,%ecx
+
+	/*
+	 * This wouldn't be any faster if it were unrolled, since the loop
+	 * control instructions are much faster than the fstl and/or done
+	 * in parallel with it so their overhead is insignificant.
+	 */
+fpureg_i586_bzero_loop:
+	fstl	0(%edx)
+	addl	$8,%edx
+	subl	$8,%ecx
+	cmpl	$8,%ecx
+	jae	fpureg_i586_bzero_loop
+
+	cmpl	$0,_npxproc
+	je	i586_bz3
+	frstor	0(%esp)
+	addl	$108,%esp
+	lmsw	%ax
+	movb	$0xfe,kernel_fpu_lock
+	ret
+
+i586_bz3:
+	fstpl	%st(0)
+	lmsw	%ax
+	movb	$0xfe,kernel_fpu_lock
+	ret
+
+intreg_i586_bzero:
+	/*
+	 * `rep stos' seems to be the best method in practice for small
+	 * counts.  Fancy methods usually take too long to start up due
+	 * to cache and BTB misses.
+	 */
+	pushl	%edi
+	movl	%edx,%edi
+	xorl	%eax,%eax
+	shrl	$2,%ecx
+	cld
+	rep
+	stosl
+	movl	12(%esp),%ecx
+	andl	$3,%ecx
+	jne	1f
+	popl	%edi
+	ret
+
+1:
+	rep
+	stosb
+	popl	%edi
+	ret
+#endif /* I586_CPU && NNPX > 0 */
+
+/* fillw(pat, base, cnt) */
+ENTRY(fillw)
+	pushl	%edi
+	movl	8(%esp),%eax
+	movl	12(%esp),%edi
+	movl	16(%esp),%ecx
+	cld
+	rep
+	stosw
+	popl	%edi
+	ret
+
+ENTRY(bcopyb)
+bcopyb:
+	pushl	%esi
+	pushl	%edi
+	movl	12(%esp),%esi
+	movl	16(%esp),%edi
+	movl	20(%esp),%ecx
+	movl	%edi,%eax
+	subl	%esi,%eax
+	cmpl	%ecx,%eax			/* overlapping && src < dst? */
+	jb	1f
+	cld					/* nope, copy forwards */
+	rep
+	movsb
+	popl	%edi
+	popl	%esi
+	ret
+
+	ALIGN_TEXT
+1:
+	addl	%ecx,%edi			/* copy backwards. */
+	addl	%ecx,%esi
+	decl	%edi
+	decl	%esi
+	std
+	rep
+	movsb
+	popl	%edi
+	popl	%esi
+	cld
+	ret
+
+ENTRY(bcopy)
+	MEXITCOUNT
+	jmp	*_bcopy_vector
+
+ENTRY(ovbcopy)
+	MEXITCOUNT
+	jmp	*_ovbcopy_vector
+
+/*
+ * generic_bcopy(src, dst, cnt)
+ *  ws@tools.de     (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
+ */
+ENTRY(generic_bcopy)
+	pushl	%esi
+	pushl	%edi
+	movl	12(%esp),%esi
+	movl	16(%esp),%edi
+	movl	20(%esp),%ecx
+
+	movl	%edi,%eax
+	subl	%esi,%eax
+	cmpl	%ecx,%eax			/* overlapping && src < dst? */
+	jb	1f
+
+	shrl	$2,%ecx				/* copy by 32-bit words */
+	cld					/* nope, copy forwards */
+	rep
+	movsl
+	movl	20(%esp),%ecx
+	andl	$3,%ecx				/* any bytes left? */
+	rep
+	movsb
+	popl	%edi
+	popl	%esi
+	ret
+
+	ALIGN_TEXT
+1:
+	addl	%ecx,%edi			/* copy backwards */
+	addl	%ecx,%esi
+	decl	%edi
+	decl	%esi
+	andl	$3,%ecx				/* any fractional bytes? */
+	std
+	rep
+	movsb
+	movl	20(%esp),%ecx			/* copy remainder by 32-bit words */
+	shrl	$2,%ecx
+	subl	$3,%esi
+	subl	$3,%edi
+	rep
+	movsl
+	popl	%edi
+	popl	%esi
+	cld
+	ret
+
+#if defined(I586_CPU) && NNPX > 0
+ENTRY(i586_bcopy)
+	pushl	%esi
+	pushl	%edi
+	movl	12(%esp),%esi
+	movl	16(%esp),%edi
+	movl	20(%esp),%ecx
+
+	movl	%edi,%eax
+	subl	%esi,%eax
+	cmpl	%ecx,%eax			/* overlapping && src < dst? */
+	jb	1f
+
+	cmpl	$1024,%ecx
+	jb	small_i586_bcopy
+
+	sarb	$1,kernel_fpu_lock
+	jc	small_i586_bcopy
+	cmpl	$0,_npxproc
+	je	i586_bc1
+	smsw	%dx
+	clts
+	subl	$108,%esp
+	fnsave	0(%esp)
+	jmp	4f
+
+i586_bc1:
+	smsw	%dx
+	clts
+	fninit				/* XXX should avoid needing this */
+
+	ALIGN_TEXT
+4:
+	pushl	%ecx
+#define	DCACHE_SIZE	8192
+	cmpl	$(DCACHE_SIZE-512)/2,%ecx
+	jbe	2f
+	movl	$(DCACHE_SIZE-512)/2,%ecx
+2:
+	subl	%ecx,0(%esp)
+	cmpl	$256,%ecx
+	jb	5f			/* XXX should prefetch if %ecx >= 32 */
+	pushl	%esi
+	pushl	%ecx
+	ALIGN_TEXT
+3:
+	movl	0(%esi),%eax
+	movl	32(%esi),%eax
+	movl	64(%esi),%eax
+	movl	96(%esi),%eax
+	movl	128(%esi),%eax
+	movl	160(%esi),%eax
+	movl	192(%esi),%eax
+	movl	224(%esi),%eax
+	addl	$256,%esi
+	subl	$256,%ecx
+	cmpl	$256,%ecx
+	jae	3b
+	popl	%ecx
+	popl	%esi
+5:
+	ALIGN_TEXT
+large_i586_bcopy_loop:
+	fildq	0(%esi)
+	fildq	8(%esi)
+	fildq	16(%esi)
+	fildq	24(%esi)
+	fildq	32(%esi)
+	fildq	40(%esi)
+	fildq	48(%esi)
+	fildq	56(%esi)
+	fistpq	56(%edi)
+	fistpq	48(%edi)
+	fistpq	40(%edi)
+	fistpq	32(%edi)
+	fistpq	24(%edi)
+	fistpq	16(%edi)
+	fistpq	8(%edi)
+	fistpq	0(%edi)
+	addl	$64,%esi
+	addl	$64,%edi
+	subl	$64,%ecx
+	cmpl	$64,%ecx
+	jae	large_i586_bcopy_loop
+	popl	%eax
+	addl	%eax,%ecx
+	cmpl	$64,%ecx
+	jae	4b
+
+	cmpl	$0,_npxproc
+	je	i586_bc2
+	frstor	0(%esp)
+	addl	$108,%esp
+i586_bc2:
+	lmsw	%dx
+	movb	$0xfe,kernel_fpu_lock
+
+/*
+ * This is a duplicate of the main part of generic_bcopy.  See the comments
+ * there.  Jumping into generic_bcopy would cost a whole 0-1 cycles and
+ * would mess up high resolution profiling.
+ */
+	ALIGN_TEXT
+small_i586_bcopy:
+	shrl	$2,%ecx
+	cld
+	rep
+	movsl
+	movl	20(%esp),%ecx
+	andl	$3,%ecx
+	rep
+	movsb
+	popl	%edi
+	popl	%esi
+	ret
+
+	ALIGN_TEXT
+1:
+	addl	%ecx,%edi
+	addl	%ecx,%esi
+	decl	%edi
+	decl	%esi
+	andl	$3,%ecx
+	std
+	rep
+	movsb
+	movl	20(%esp),%ecx
+	shrl	$2,%ecx
+	subl	$3,%esi
+	subl	$3,%edi
+	rep
+	movsl
+	popl	%edi
+	popl	%esi
+	cld
+	ret
+#endif /* I586_CPU && NNPX > 0 */
+
+/*
+ * Note: memcpy does not support overlapping copies
+ */
+ENTRY(memcpy)
+	pushl	%edi
+	pushl	%esi
+	movl	12(%esp),%edi
+	movl	16(%esp),%esi
+	movl	20(%esp),%ecx
+	movl	%edi,%eax
+	shrl	$2,%ecx				/* copy by 32-bit words */
+	cld					/* nope, copy forwards */
+	rep
+	movsl
+	movl	20(%esp),%ecx
+	andl	$3,%ecx				/* any bytes left? */
+	rep
+	movsb
+	popl	%esi
+	popl	%edi
+	ret
+
+
+/*****************************************************************************/
+/* copyout and fubyte family                                                 */
+/*****************************************************************************/
+/*
+ * Access user memory from inside the kernel. These routines and possibly
+ * the math- and DOS emulators should be the only places that do this.
+ *
+ * We have to access the memory with user's permissions, so use a segment
+ * selector with RPL 3. For writes to user space we have to additionally
+ * check the PTE for write permission, because the 386 does not check
+ * write permissions when we are executing with EPL 0. The 486 does check
+ * this if the WP bit is set in CR0, so we can use a simpler version here.
+ *
+ * These routines set curpcb->onfault for the time they execute. When a
+ * protection violation occurs inside the functions, the trap handler
+ * returns to *curpcb->onfault instead of the function.
+ */
+
+/* copyout(from_kernel, to_user, len) */
+ENTRY(copyout)
+	MEXITCOUNT
+	jmp	*_copyout_vector
+
+ENTRY(generic_copyout)
+	movl	_curpcb,%eax
+	movl	$copyout_fault,PCB_ONFAULT(%eax)
+	pushl	%esi
+	pushl	%edi
+	pushl	%ebx
+	movl	16(%esp),%esi
+	movl	20(%esp),%edi
+	movl	24(%esp),%ebx
+	testl	%ebx,%ebx			/* anything to do? */
+	jz	done_copyout
+
+	/*
+	 * Check explicitly for non-user addresses.  If 486 write protection
+	 * is being used, this check is essential because we are in kernel
+	 * mode so the h/w does not provide any protection against writing
+	 * kernel addresses.
+	 */
+
+	/*
+	 * First, prevent address wrapping.
+	 */
+	movl	%edi,%eax
+	addl	%ebx,%eax
+	jc	copyout_fault
+/*
+ * XXX STOP USING VM_MAXUSER_ADDRESS.
+ * It is an end address, not a max, so every time it is used correctly it
+ * looks like there is an off by one error, and of course it caused an off
+ * by one error in several places.
+ */
+	cmpl	$VM_MAXUSER_ADDRESS,%eax
+	ja	copyout_fault
+
+#if defined(I386_CPU)
+
+#if defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU)
+	cmpl	$CPUCLASS_386,_cpu_class
+	jne	3f
+#endif
+/*
+ * We have to check each PTE for user write permission.
+ * The checking may cause a page fault, so it is important to set
+ * up everything for return via copyout_fault before here.
+ */
+	/* compute number of pages */
+	movl	%edi,%ecx
+	andl	$PAGE_MASK,%ecx
+	addl	%ebx,%ecx
+	decl	%ecx
+	shrl	$IDXSHIFT+2,%ecx
+	incl	%ecx
+
+	/* compute PTE offset for start address */
+	movl	%edi,%edx
+	shrl	$IDXSHIFT,%edx
+	andb	$0xfc,%dl
+
+1:
+	/* check PTE for each page */
+	leal	_PTmap(%edx),%eax
+	shrl	$IDXSHIFT,%eax
+	andb	$0xfc,%al
+	testb	$PG_V,_PTmap(%eax)		/* PTE page must be valid */
+	je	4f
+	movb	_PTmap(%edx),%al
+	andb	$PG_V|PG_RW|PG_U,%al		/* page must be valid and user writable */
+	cmpb	$PG_V|PG_RW|PG_U,%al
+	je	2f
+
+4:
+	/* simulate a trap */
+	pushl	%edx
+	pushl	%ecx
+	shll	$IDXSHIFT,%edx
+	pushl	%edx
+	call	_trapwrite			/* trapwrite(addr) */
+	popl	%edx
+	popl	%ecx
+	popl	%edx
+
+	testl	%eax,%eax			/* if not ok, return EFAULT */
+	jnz	copyout_fault
+
+2:
+	addl	$4,%edx
+	decl	%ecx
+	jnz	1b				/* check next page */
+#endif /* I386_CPU */
+
+	/* bcopy(%esi, %edi, %ebx) */
+3:
+	movl	%ebx,%ecx
+
+#if defined(I586_CPU) && NNPX > 0
+	ALIGN_TEXT
+slow_copyout:
+#endif
+	shrl	$2,%ecx
+	cld
+	rep
+	movsl
+	movb	%bl,%cl
+	andb	$3,%cl
+	rep
+	movsb
+
+done_copyout:
+	popl	%ebx
+	popl	%edi
+	popl	%esi
+	xorl	%eax,%eax
+	movl	_curpcb,%edx
+	movl	%eax,PCB_ONFAULT(%edx)
+	ret
+
+	ALIGN_TEXT
+copyout_fault:
+	popl	%ebx
+	popl	%edi
+	popl	%esi
+	movl	_curpcb,%edx
+	movl	$0,PCB_ONFAULT(%edx)
+	movl	$EFAULT,%eax
+	ret
+
+#if defined(I586_CPU) && NNPX > 0
+ENTRY(i586_copyout)
+	/*
+	 * Duplicated from generic_copyout.  Could be done a bit better.
+	 */
+	movl	_curpcb,%eax
+	movl	$copyout_fault,PCB_ONFAULT(%eax)
+	pushl	%esi
+	pushl	%edi
+	pushl	%ebx
+	movl	16(%esp),%esi
+	movl	20(%esp),%edi
+	movl	24(%esp),%ebx
+	testl	%ebx,%ebx			/* anything to do? */
+	jz	done_copyout
+
+	/*
+	 * Check explicitly for non-user addresses.  If 486 write protection
+	 * is being used, this check is essential because we are in kernel
+	 * mode so the h/w does not provide any protection against writing
+	 * kernel addresses.
+	 */
+
+	/*
+	 * First, prevent address wrapping.
+	 */
+	movl	%edi,%eax
+	addl	%ebx,%eax
+	jc	copyout_fault
+/*
+ * XXX STOP USING VM_MAXUSER_ADDRESS.
+ * It is an end address, not a max, so every time it is used correctly it
+ * looks like there is an off by one error, and of course it caused an off
+ * by one error in several places.
+ */
+	cmpl	$VM_MAXUSER_ADDRESS,%eax
+	ja	copyout_fault
+
+	/* bcopy(%esi, %edi, %ebx) */
+3:
+	movl	%ebx,%ecx
+	/*
+	 * End of duplicated code.
+	 */
+
+	cmpl	$1024,%ecx
+	jb	slow_copyout
+
+	pushl	%ecx
+	call	_fastmove
+	addl	$4,%esp
+	jmp	done_copyout
+#endif /* I586_CPU && NNPX > 0 */
+
+/* copyin(from_user, to_kernel, len) */
+ENTRY(copyin)
+	MEXITCOUNT
+	jmp	*_copyin_vector
+
+ENTRY(generic_copyin)
+	movl	_curpcb,%eax
+	movl	$copyin_fault,PCB_ONFAULT(%eax)
+	pushl	%esi
+	pushl	%edi
+	movl	12(%esp),%esi			/* caddr_t from */
+	movl	16(%esp),%edi			/* caddr_t to */
+	movl	20(%esp),%ecx			/* size_t  len */
+
+	/*
+	 * make sure address is valid
+	 */
+	movl	%esi,%edx
+	addl	%ecx,%edx
+	jc	copyin_fault
+	cmpl	$VM_MAXUSER_ADDRESS,%edx
+	ja	copyin_fault
+
+#if defined(I586_CPU) && NNPX > 0
+	ALIGN_TEXT
+slow_copyin:
+#endif
+	movb	%cl,%al
+	shrl	$2,%ecx				/* copy longword-wise */
+	cld
+	rep
+	movsl
+	movb	%al,%cl
+	andb	$3,%cl				/* copy remaining bytes */
+	rep
+	movsb
+
+#if defined(I586_CPU) && NNPX > 0
+	ALIGN_TEXT
+done_copyin:
+#endif
+	popl	%edi
+	popl	%esi
+	xorl	%eax,%eax
+	movl	_curpcb,%edx
+	movl	%eax,PCB_ONFAULT(%edx)
+	ret
+
+	ALIGN_TEXT
+copyin_fault:
+	popl	%edi
+	popl	%esi
+	movl	_curpcb,%edx
+	movl	$0,PCB_ONFAULT(%edx)
+	movl	$EFAULT,%eax
+	ret
+
+#if defined(I586_CPU) && NNPX > 0
+ENTRY(i586_copyin)
+	/*
+	 * Duplicated from generic_copyin.  Could be done a bit better.
+	 */
+	movl	_curpcb,%eax
+	movl	$copyin_fault,PCB_ONFAULT(%eax)
+	pushl	%esi
+	pushl	%edi
+	movl	12(%esp),%esi			/* caddr_t from */
+	movl	16(%esp),%edi			/* caddr_t to */
+	movl	20(%esp),%ecx			/* size_t  len */
+
+	/*
+	 * make sure address is valid
+	 */
+	movl	%esi,%edx
+	addl	%ecx,%edx
+	jc	copyin_fault
+	cmpl	$VM_MAXUSER_ADDRESS,%edx
+	ja	copyin_fault
+	/*
+	 * End of duplicated code.
+	 */
+
+	cmpl	$1024,%ecx
+	jb	slow_copyin
+
+	pushl	%ebx			/* XXX prepare for fastmove_fault */
+	pushl	%ecx
+	call	_fastmove
+	addl	$8,%esp
+	jmp	done_copyin
+#endif /* I586_CPU && NNPX > 0 */
+
+#if defined(I586_CPU) && NNPX > 0
+/* fastmove(src, dst, len)
+	src in %esi
+	dst in %edi
+	len in %ecx		XXX changed to on stack for profiling
+	uses %eax and %edx for tmp. storage
+ */
+/* XXX use ENTRY() to get profiling.  fastmove() is actually a non-entry. */
+ENTRY(fastmove)
+	pushl	%ebp
+	movl	%esp,%ebp
+	subl	$PCB_SAVEFPU_SIZE+3*4,%esp
+
+	movl	8(%ebp),%ecx
+	cmpl	$63,%ecx
+	jbe	fastmove_tail
+
+	testl	$7,%esi	/* check if src addr is multiple of 8 */
+	jnz	fastmove_tail
+
+	testl	$7,%edi	/* check if dst addr is multiple of 8 */
+	jnz	fastmove_tail
+
+/* if (npxproc != NULL) { */
+	cmpl	$0,_npxproc
+	je	6f
+/*    fnsave(&curpcb->pcb_savefpu); */
+	movl	_curpcb,%eax
+	fnsave	PCB_SAVEFPU(%eax)
+/*   npxproc = NULL; */
+	movl	$0,_npxproc
+/* } */
+6:
+/* now we own the FPU. */
+
+/*
+ * The process' FP state is saved in the pcb, but if we get
+ * switched, the cpu_switch() will store our FP state in the
+ * pcb.  It should be possible to avoid all the copying for
+ * this, e.g., by setting a flag to tell cpu_switch() to
+ * save the state somewhere else.
+ */
+/* tmp = curpcb->pcb_savefpu; */
+	movl	%ecx,-12(%ebp)
+	movl	%esi,-8(%ebp)
+	movl	%edi,-4(%ebp)
+	movl	%esp,%edi
+	movl	_curpcb,%esi
+	addl	$PCB_SAVEFPU,%esi
+	cld
+	movl	$PCB_SAVEFPU_SIZE>>2,%ecx
+	rep
+	movsl
+	movl	-12(%ebp),%ecx
+	movl	-8(%ebp),%esi
+	movl	-4(%ebp),%edi
+/* stop_emulating(); */
+	clts
+/* npxproc = curproc; */
+	movl	_curproc,%eax
+	movl	%eax,_npxproc
+	movl	_curpcb,%eax
+	movl	$fastmove_fault,PCB_ONFAULT(%eax)
+4:
+	movl	%ecx,-12(%ebp)
+	cmpl	$1792,%ecx
+	jbe	2f
+	movl	$1792,%ecx
+2:
+	subl	%ecx,-12(%ebp)
+	cmpl	$256,%ecx
+	jb	5f
+	movl	%ecx,-8(%ebp)
+	movl	%esi,-4(%ebp)
+	ALIGN_TEXT
+3:
+	movl	0(%esi),%eax
+	movl	32(%esi),%eax
+	movl	64(%esi),%eax
+	movl	96(%esi),%eax
+	movl	128(%esi),%eax
+	movl	160(%esi),%eax
+	movl	192(%esi),%eax
+	movl	224(%esi),%eax
+	addl	$256,%esi
+	subl	$256,%ecx
+	cmpl	$256,%ecx
+	jae	3b
+	movl	-8(%ebp),%ecx
+	movl	-4(%ebp),%esi
+5:
+	ALIGN_TEXT
+fastmove_loop:
+	fildq	0(%esi)
+	fildq	8(%esi)
+	fildq	16(%esi)
+	fildq	24(%esi)
+	fildq	32(%esi)
+	fildq	40(%esi)
+	fildq	48(%esi)
+	fildq	56(%esi)
+	fistpq	56(%edi)
+	fistpq	48(%edi)
+	fistpq	40(%edi)
+	fistpq	32(%edi)
+	fistpq	24(%edi)
+	fistpq	16(%edi)
+	fistpq	8(%edi)
+	fistpq	0(%edi)
+	addl	$-64,%ecx
+	addl	$64,%esi
+	addl	$64,%edi
+	cmpl	$63,%ecx
+	ja	fastmove_loop
+	movl	-12(%ebp),%eax
+	addl	%eax,%ecx
+	cmpl	$64,%ecx
+	jae	4b
+
+/* curpcb->pcb_savefpu = tmp; */
+	movl	%ecx,-12(%ebp)
+	movl	%esi,-8(%ebp)
+	movl	%edi,-4(%ebp)
+	movl	_curpcb,%edi
+	addl	$PCB_SAVEFPU,%edi
+	movl	%esp,%esi
+	cld
+	movl	$PCB_SAVEFPU_SIZE>>2,%ecx
+	rep
+	movsl
+	movl	-12(%ebp),%ecx
+	movl	-8(%ebp),%esi
+	movl	-4(%ebp),%edi
+
+/* start_emulating(); */
+	smsw	%ax
+	orb	$CR0_TS,%al
+	lmsw	%ax
+/* npxproc = NULL; */
+	movl	$0,_npxproc
+
+	ALIGN_TEXT
+fastmove_tail:
+	movl	_curpcb,%eax
+	movl	$fastmove_tail_fault,PCB_ONFAULT(%eax)
+
+	movb	%cl,%al
+	shrl	$2,%ecx				/* copy longword-wise */
+	cld
+	rep
+	movsl
+	movb	%al,%cl
+	andb	$3,%cl				/* copy remaining bytes */
+	rep
+	movsb
+
+	movl	%ebp,%esp
+	popl	%ebp
+	ret
+
+	ALIGN_TEXT
+fastmove_fault:
+	movl	_curpcb,%edi
+	addl	$PCB_SAVEFPU,%edi
+	movl	%esp,%esi
+	cld
+	movl	$PCB_SAVEFPU_SIZE>>2,%ecx
+	rep
+	movsl
+
+	smsw	%ax
+	orb	$CR0_TS,%al
+	lmsw	%ax
+	movl	$0,_npxproc
+
+fastmove_tail_fault:
+	movl	%ebp,%esp
+	popl	%ebp
+	addl	$8,%esp
+	popl	%ebx
+	popl	%edi
+	popl	%esi
+	movl	_curpcb,%edx
+	movl	$0,PCB_ONFAULT(%edx)
+	movl	$EFAULT,%eax
+	ret
+#endif /* I586_CPU && NNPX > 0 */
+
+/*
+ * fu{byte,sword,word} : fetch a byte (sword, word) from user memory
+ */
+ENTRY(fuword)
+	movl	_curpcb,%ecx
+	movl	$fusufault,PCB_ONFAULT(%ecx)
+	movl	4(%esp),%edx			/* from */
+
+	cmpl	$VM_MAXUSER_ADDRESS-4,%edx	/* verify address is valid */
+	ja	fusufault
+
+	movl	(%edx),%eax
+	movl	$0,PCB_ONFAULT(%ecx)
+	ret
+
+/*
+ * These two routines are called from the profiling code, potentially
+ * at interrupt time. If they fail, that's okay, good things will
+ * happen later. Fail all the time for now - until the trap code is
+ * able to deal with this.
+ */
+ALTENTRY(suswintr)
+ENTRY(fuswintr)
+	movl	$-1,%eax
+	ret
+
+ENTRY(fusword)
+	movl	_curpcb,%ecx
+	movl	$fusufault,PCB_ONFAULT(%ecx)
+	movl	4(%esp),%edx
+
+	cmpl	$VM_MAXUSER_ADDRESS-2,%edx
+	ja	fusufault
+
+	movzwl	(%edx),%eax
+	movl	$0,PCB_ONFAULT(%ecx)
+	ret
+
+ENTRY(fubyte)
+	movl	_curpcb,%ecx
+	movl	$fusufault,PCB_ONFAULT(%ecx)
+	movl	4(%esp),%edx
+
+	cmpl	$VM_MAXUSER_ADDRESS-1,%edx
+	ja	fusufault
+
+	movzbl	(%edx),%eax
+	movl	$0,PCB_ONFAULT(%ecx)
+	ret
+
+	ALIGN_TEXT
+fusufault:
+	movl	_curpcb,%ecx
+	xorl	%eax,%eax
+	movl	%eax,PCB_ONFAULT(%ecx)
+	decl	%eax
+	ret
+
+/*
+ * su{byte,sword,word}: write a byte (word, longword) to user memory
+ */
+ENTRY(suword)
+	movl	_curpcb,%ecx
+	movl	$fusufault,PCB_ONFAULT(%ecx)
+	movl	4(%esp),%edx
+
+#if defined(I386_CPU)
+
+#if defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU)
+	cmpl	$CPUCLASS_386,_cpu_class
+	jne	2f				/* we only have to set the right segment selector */
+#endif /* I486_CPU || I586_CPU || I686_CPU */
+
+	/* XXX - page boundary crossing is still not handled */
+	movl	%edx,%eax
+	shrl	$IDXSHIFT,%edx
+	andb	$0xfc,%dl
+
+	leal	_PTmap(%edx),%ecx
+	shrl	$IDXSHIFT,%ecx
+	andb	$0xfc,%cl
+	testb	$PG_V,_PTmap(%ecx)		/* PTE page must be valid */
+	je	4f
+	movb	_PTmap(%edx),%dl
+	andb	$PG_V|PG_RW|PG_U,%dl		/* page must be valid and user writable */
+	cmpb	$PG_V|PG_RW|PG_U,%dl
+	je	1f
+
+4:
+	/* simulate a trap */
+	pushl	%eax
+	call	_trapwrite
+	popl	%edx				/* remove junk parameter from stack */
+	testl	%eax,%eax
+	jnz	fusufault
+1:
+	movl	4(%esp),%edx
+#endif
+
+2:
+	cmpl	$VM_MAXUSER_ADDRESS-4,%edx	/* verify address validity */
+	ja	fusufault
+
+	movl	8(%esp),%eax
+	movl	%eax,(%edx)
+	xorl	%eax,%eax
+	movl	_curpcb,%ecx
+	movl	%eax,PCB_ONFAULT(%ecx)
+	ret
+
+ENTRY(susword)
+	movl	_curpcb,%ecx
+	movl	$fusufault,PCB_ONFAULT(%ecx)
+	movl	4(%esp),%edx
+
+#if defined(I386_CPU)
+
+#if defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU)
+	cmpl	$CPUCLASS_386,_cpu_class
+	jne	2f
+#endif /* I486_CPU || I586_CPU || I686_CPU */
+
+	/* XXX - page boundary crossing is still not handled */
+	movl	%edx,%eax
+	shrl	$IDXSHIFT,%edx
+	andb	$0xfc,%dl
+
+	leal	_PTmap(%edx),%ecx
+	shrl	$IDXSHIFT,%ecx
+	andb	$0xfc,%cl
+	testb	$PG_V,_PTmap(%ecx)		/* PTE page must be valid */
+	je	4f
+	movb	_PTmap(%edx),%dl
+	andb	$PG_V|PG_RW|PG_U,%dl		/* page must be valid and user writable */
+	cmpb	$PG_V|PG_RW|PG_U,%dl
+	je	1f
+
+4:
+	/* simulate a trap */
+	pushl	%eax
+	call	_trapwrite
+	popl	%edx				/* remove junk parameter from stack */
+	testl	%eax,%eax
+	jnz	fusufault
+1:
+	movl	4(%esp),%edx
+#endif
+
+2:
+	cmpl	$VM_MAXUSER_ADDRESS-2,%edx	/* verify address validity */
+	ja	fusufault
+
+	movw	8(%esp),%ax
+	movw	%ax,(%edx)
+	xorl	%eax,%eax
+	movl	_curpcb,%ecx			/* restore trashed register */
+	movl	%eax,PCB_ONFAULT(%ecx)
+	ret
+
+ALTENTRY(suibyte)
+ENTRY(subyte)
+	movl	_curpcb,%ecx
+	movl	$fusufault,PCB_ONFAULT(%ecx)
+	movl	4(%esp),%edx
+
+#if defined(I386_CPU)
+
+#if defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU)
+	cmpl	$CPUCLASS_386,_cpu_class
+	jne	2f
+#endif /* I486_CPU || I586_CPU || I686_CPU */
+
+	movl	%edx,%eax
+	shrl	$IDXSHIFT,%edx
+	andb	$0xfc,%dl
+
+	leal	_PTmap(%edx),%ecx
+	shrl	$IDXSHIFT,%ecx
+	andb	$0xfc,%cl
+	testb	$PG_V,_PTmap(%ecx)		/* PTE page must be valid */
+	je	4f
+	movb	_PTmap(%edx),%dl
+	andb	$PG_V|PG_RW|PG_U,%dl		/* page must be valid and user writable */
+	cmpb	$PG_V|PG_RW|PG_U,%dl
+	je	1f
+
+4:
+	/* simulate a trap */
+	pushl	%eax
+	call	_trapwrite
+	popl	%edx				/* remove junk parameter from stack */
+	testl	%eax,%eax
+	jnz	fusufault
+1:
+	movl	4(%esp),%edx
+#endif
+
+2:
+	cmpl	$VM_MAXUSER_ADDRESS-1,%edx	/* verify address validity */
+	ja	fusufault
+
+	movb	8(%esp),%al
+	movb	%al,(%edx)
+	xorl	%eax,%eax
+	movl	_curpcb,%ecx			/* restore trashed register */
+	movl	%eax,PCB_ONFAULT(%ecx)
+	ret
+
+/*
+ * copyinstr(from, to, maxlen, int *lencopied)
+ *	copy a string from from to to, stop when a 0 character is reached.
+ *	return ENAMETOOLONG if string is longer than maxlen, and
+ *	EFAULT on protection violations. If lencopied is non-zero,
+ *	return the actual length in *lencopied.
+ */
+ENTRY(copyinstr)
+	pushl	%esi
+	pushl	%edi
+	movl	_curpcb,%ecx
+	movl	$cpystrflt,PCB_ONFAULT(%ecx)
+
+	movl	12(%esp),%esi			/* %esi = from */
+	movl	16(%esp),%edi			/* %edi = to */
+	movl	20(%esp),%edx			/* %edx = maxlen */
+
+	movl	$VM_MAXUSER_ADDRESS,%eax
+
+	/* make sure 'from' is within bounds */
+	subl	%esi,%eax
+	jbe	cpystrflt
+
+	/* restrict maxlen to <= VM_MAXUSER_ADDRESS-from */
+	cmpl	%edx,%eax
+	jae	1f
+	movl	%eax,%edx
+	movl	%eax,20(%esp)
+1:
+	incl	%edx
+	cld
+
+2:
+	decl	%edx
+	jz	3f
+
+	lodsb
+	stosb
+	orb	%al,%al
+	jnz	2b
+
+	/* Success -- 0 byte reached */
+	decl	%edx
+	xorl	%eax,%eax
+	jmp	cpystrflt_x
+3:
+	/* edx is zero - return ENAMETOOLONG or EFAULT */
+	cmpl	$VM_MAXUSER_ADDRESS,%esi
+	jae	cpystrflt
+4:
+	movl	$ENAMETOOLONG,%eax
+	jmp	cpystrflt_x
+
+cpystrflt:
+	movl	$EFAULT,%eax
+
+cpystrflt_x:
+	/* set *lencopied and return %eax */
+	movl	_curpcb,%ecx
+	movl	$0,PCB_ONFAULT(%ecx)
+	movl	20(%esp),%ecx
+	subl	%edx,%ecx
+	movl	24(%esp),%edx
+	testl	%edx,%edx
+	jz	1f
+	movl	%ecx,(%edx)
+1:
+	popl	%edi
+	popl	%esi
+	ret
+
+
+/*
+ * copystr(from, to, maxlen, int *lencopied)
+ */
+ENTRY(copystr)
+	pushl	%esi
+	pushl	%edi
+
+	movl	12(%esp),%esi			/* %esi = from */
+	movl	16(%esp),%edi			/* %edi = to */
+	movl	20(%esp),%edx			/* %edx = maxlen */
+	incl	%edx
+	cld
+1:
+	decl	%edx
+	jz	4f
+	lodsb
+	stosb
+	orb	%al,%al
+	jnz	1b
+
+	/* Success -- 0 byte reached */
+	decl	%edx
+	xorl	%eax,%eax
+	jmp	6f
+4:
+	/* edx is zero -- return ENAMETOOLONG */
+	movl	$ENAMETOOLONG,%eax
+
+6:
+	/* set *lencopied and return %eax */
+	movl	20(%esp),%ecx
+	subl	%edx,%ecx
+	movl	24(%esp),%edx
+	testl	%edx,%edx
+	jz	7f
+	movl	%ecx,(%edx)
+7:
+	popl	%edi
+	popl	%esi
+	ret
+
+ENTRY(bcmp)
+	pushl	%edi
+	pushl	%esi
+	movl	12(%esp),%edi
+	movl	16(%esp),%esi
+	movl	20(%esp),%edx
+	xorl	%eax,%eax
+
+	movl	%edx,%ecx
+	shrl	$2,%ecx
+	cld					/* compare forwards */
+	repe
+	cmpsl
+	jne	1f
+
+	movl	%edx,%ecx
+	andl	$3,%ecx
+	repe
+	cmpsb
+	je	2f
+1:
+	incl	%eax
+2:
+	popl	%esi
+	popl	%edi
+	ret
+
+
+/*
+ * Handling of special 386 registers and descriptor tables etc
+ */
+/* void lgdt(struct region_descriptor *rdp); */
+ENTRY(lgdt)
+	/* reload the descriptor table */
+	movl	4(%esp),%eax
+	lgdt	(%eax)
+
+	/* flush the prefetch q */
+	jmp	1f
+	nop
+1:
+	/* reload "stale" selectors */
+	movl	$KDSEL,%eax
+	movl	%ax,%ds
+	movl	%ax,%es
+	movl	%ax,%ss
+
+	/* reload code selector by turning return into intersegmental return */
+	movl	(%esp),%eax
+	pushl	%eax
+#	movl	$KCSEL,4(%esp)
+	movl	$8,4(%esp)
+	lret
+
+/*
+ * void lidt(struct region_descriptor *rdp);
+ */
+ENTRY(lidt)
+	movl	4(%esp),%eax
+	lidt	(%eax)
+	ret
+
+/*
+ * void lldt(u_short sel)
+ */
+ENTRY(lldt)
+	lldt	4(%esp)
+	ret
+
+/*
+ * void ltr(u_short sel)
+ */
+ENTRY(ltr)
+	ltr	4(%esp)
+	ret
+
+/* ssdtosd(*ssdp,*sdp) */
+ENTRY(ssdtosd)
+	pushl	%ebx
+	movl	8(%esp),%ecx
+	movl	8(%ecx),%ebx
+	shll	$16,%ebx
+	movl	(%ecx),%edx
+	roll	$16,%edx
+	movb	%dh,%bl
+	movb	%dl,%bh
+	rorl	$8,%ebx
+	movl	4(%ecx),%eax
+	movw	%ax,%dx
+	andl	$0xf0000,%eax
+	orl	%eax,%ebx
+	movl	12(%esp),%ecx
+	movl	%edx,(%ecx)
+	movl	%ebx,4(%ecx)
+	popl	%ebx
+	ret
+
+/* load_cr0(cr0) */
+ENTRY(load_cr0)
+	movl	4(%esp),%eax
+	movl	%eax,%cr0
+	ret
+
+/* rcr0() */
+ENTRY(rcr0)
+	movl	%cr0,%eax
+	ret
+
+/* rcr3() */
+ENTRY(rcr3)
+	movl	%cr3,%eax
+	ret
+
+/* void load_cr3(caddr_t cr3) */
+ENTRY(load_cr3)
+	movl	4(%esp),%eax
+	movl	%eax,%cr3
+	ret
+
+
+/*****************************************************************************/
+/* setjump, longjump                                                         */
+/*****************************************************************************/
+
+ENTRY(setjmp)
+	movl	4(%esp),%eax
+	movl	%ebx,(%eax)			/* save ebx */
+	movl	%esp,4(%eax)			/* save esp */
+	movl	%ebp,8(%eax)			/* save ebp */
+	movl	%esi,12(%eax)			/* save esi */
+	movl	%edi,16(%eax)			/* save edi */
+	movl	(%esp),%edx			/* get rta */
+	movl	%edx,20(%eax)			/* save eip */
+	xorl	%eax,%eax			/* return(0); */
+	ret
+
+ENTRY(longjmp)
+	movl	4(%esp),%eax
+	movl	(%eax),%ebx			/* restore ebx */
+	movl	4(%eax),%esp			/* restore esp */
+	movl	8(%eax),%ebp			/* restore ebp */
+	movl	12(%eax),%esi			/* restore esi */
+	movl	16(%eax),%edi			/* restore edi */
+	movl	20(%eax),%edx			/* get rta */
+	movl	%edx,(%esp)			/* put in return frame */
+	xorl	%eax,%eax			/* return(1); */
+	incl	%eax
+	ret
+
+/*
+ * Here for doing BB-profiling (gcc -a).
+ * We rely on the "bbset" instead, but need a dummy function.
+ */
+NON_GPROF_ENTRY(__bb_init_func)
+	movl	4(%esp),%eax
+	movl	$1,(%eax)
+	.byte	0xc3				/* avoid macro for `ret' */
diff -urN lib/microwindows/src/contrib/GPL/tpcal/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/GPL/tpcal/Makefile
--- lib/microwindows/src/contrib/GPL/tpcal/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/GPL/tpcal/Makefile	2005-02-21 16:02:47.000000000 +0100
@@ -0,0 +1,13 @@
+#CC = mipsel-linux-gcc -msoft-float -s
+CC = gcc
+CFLAGS = -Wall -I../../../include -I../../../drivers -L../../../lib
+LIBS = -lmwin -lmwinlib -lmwengine -lmwdrivers -lmwfonts
+OBJECTS = tpcal.o transform.o
+
+all: tpcal
+
+tpcal: $(OBJECTS)
+	$(CC) $(CFLAGS) $(OBJECTS) $(LIBS) -o tpcal
+
+clean:
+	rm -f *.o tpcal
diff -urN lib/microwindows/src/contrib/GPL/tpcal/VERSION /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/GPL/tpcal/VERSION
--- lib/microwindows/src/contrib/GPL/tpcal/VERSION	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/GPL/tpcal/VERSION	2005-02-21 16:02:48.000000000 +0100
@@ -0,0 +1 @@
+0.5
diff -urN lib/microwindows/src/contrib/GPL/tpcal/tpcal.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/GPL/tpcal/tpcal.c
--- lib/microwindows/src/contrib/GPL/tpcal/tpcal.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/GPL/tpcal/tpcal.c	2005-02-21 16:02:47.000000000 +0100
@@ -0,0 +1,363 @@
+/*
+ * Touch-panel calibration program
+ * Copyright (C) 1999 Bradley D. LaRonde <brad@ltc.com>
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include "windows.h"
+#include "mou_tp.h"
+#include "transform.h"
+
+static int xext, yext;
+static CALIBRATION_PAIRS cps;
+static CALIBRATION_PAIR* pcp = 0;
+
+void DrawAbout(HDC hdc, RECT r)
+{
+	const int ver_major = 0;
+	const int ver_minor = 5;
+	const char app_name[] = "Touch Panel Calibrator";
+	const char title[] = "%s, version %d.%d";
+	const char copyright[] = "(C) 1999 Bradley D. LaRonde <brad@ltc.com>";
+	const char warranty[] = "ABSOLUTELY NO WARRANTY";
+	const char license1[] = "This is free software, and you are welcome to";
+	const char license2[] = "redistribute it under certain conditions.";
+
+	const int leading = 15;
+
+	char s[1024];
+
+	sprintf(s, title, app_name, ver_major, ver_minor);
+	SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
+	DrawText(hdc, s, -1, &r, DT_CENTER);
+
+	r.top += leading;
+	DrawText(hdc, copyright, -1, &r, DT_CENTER);
+
+	r.top += leading;
+	DrawText(hdc, warranty, -1, &r, DT_CENTER);
+
+	r.top += leading;
+	DrawText(hdc, license1, -1, &r, DT_CENTER);
+	r.top += leading;
+	DrawText(hdc, license2, -1, &r, DT_CENTER);
+}
+
+void DrawDone(HDC hdc, RECT r)
+{
+        const char donemsg[] = "Calibration is done!";
+	SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
+        DrawText(hdc, donemsg, -1, &r, DT_CENTER);
+}
+
+
+void DrawTarget(HDC hdc, POINT p)
+{
+	const int scale = 9;
+	const int center = 3;
+
+	// I never knew that Windows GDI always leaves off
+	// the last point in a line, and the right and bottom side of a rectangle.
+	// Why would they make use always figure +1?  It isn't always obvious where
+	// +1 is (i.e. a line going at a 10 degree angle).  Blech.
+	// I can only hope that there is some overwhelmingly compelling reason why.
+
+	Rectangle(hdc, p.x - center, p.y - center, p.x + center + 1, p.y + center + 1);
+
+	// scale
+	MoveToEx(hdc, p.x - scale, p.y, NULL);
+	LineTo(hdc, p.x + scale + 1, p.y);
+
+	MoveToEx(hdc, p.x, p.y - scale, NULL);
+	LineTo(hdc, p.x, p.y + scale + 1);
+}
+
+void DrawLabelAlign(HDC hdc, POINT p, LPCSTR psz, int align)
+{
+	RECT r;
+	const int w = 180;
+	const int h = 14;
+	const int m = 15;
+
+	switch(align)
+	{
+		case 1:
+			// right
+			r.left = p.x + m;
+			r.right = p.x + w + m;
+			r.top =  p.y - (h/2);
+			r.bottom = p.y + (h/2);
+			break;
+
+		case 2:
+			// left
+			r.left = p.x - (w + m);
+			r.right = p.x - m;
+			r.top =  p.y - (h/2);
+			r.bottom = p.y + (h/2);
+			break;
+
+		case 3:
+			// below
+			r.left = p.x - (w/2);
+			r.right = p.x + (w/2);
+			r.top =  p.y + m;
+			r.bottom = p.y + m + h;
+			break;
+
+		default:
+			// at
+			r.left = p.x;
+			r.right = p.x + w;
+			r.top =  p.y;
+			r.bottom = p.y + h;
+			break;
+	}
+
+	SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
+	DrawText(hdc, psz, -1, &r, DT_LEFT);
+}
+
+void DrawLabel(HDC hdc, POINT p, LPCSTR psz)
+{
+	if ( p.x < (xext * 1 / 4) )
+		return DrawLabelAlign(hdc, p, psz, 1);
+
+	if ( p.x > (xext * 3 / 4) )
+		return DrawLabelAlign(hdc, p, psz, 2);
+
+	return DrawLabelAlign(hdc, p, psz, 3);
+}
+
+POINT GetTarget(int n)
+{
+	const int inset = 10;
+	POINT p;
+
+ 	switch (n)
+	{
+		case 0:
+			p.x = xext / 2; p.y = yext / 2;
+			pcp = &cps.center;
+			break;
+
+		case 1:
+			p.x = inset; p.y = inset;
+			pcp = &cps.ul;
+			break;
+
+		case 2:
+			p.x = xext - inset; p.y = inset;
+			pcp = &cps.ur;
+			break;
+
+		case 3:
+			p.x = xext - inset; p.y = yext - inset;
+			pcp = &cps.lr;
+			break;
+
+		case 4:
+			p.x = inset; p.y = yext - inset;
+			pcp = &cps.ll;
+			break;
+		
+		default:
+			// return a random target
+			p.x = random() / (RAND_MAX / xext);
+			p.y = random() / (RAND_MAX / yext);
+			pcp = 0;
+			break;
+	}
+
+	return p;
+}
+
+static int total_targets = 5;
+static int current_target = 0;
+static POINT current_target_location;
+
+void DoPaint(HDC hdc)
+{
+	const char szInstructions[] = "Please touch the center of the target.";
+
+	POINT p;
+	int i, n;
+	int old_rop;
+	POINT last = current_target_location;
+	HPEN hOldPen;
+	
+	if (current_target == total_targets) {
+		RECT r = {10, yext/2,  xext - 10, yext/2 + 40};
+		DrawDone(hdc, r);
+		return;
+	}
+	
+	if (current_target == 0)
+	{
+		RECT r = {10, yext - 85, xext - 10, yext - 10};
+		DrawAbout(hdc, r);
+	}
+
+	current_target_location = GetTarget(current_target);
+
+	old_rop = SetROP2(hdc, R2_XORPEN);
+	hOldPen = SelectObject(hdc, GetStockObject(WHITE_PEN));
+
+	n = 20;
+	for (i=0; i < n; i++)
+	{
+		p.x = last.x + ((current_target_location.x - last.x) * i / n);
+		p.y = last.y + ((current_target_location.y - last.y) * i / n);
+		DrawTarget(hdc, p);
+		Sleep(60);
+		DrawTarget(hdc, p);
+	}
+
+	// final position
+	SetROP2(hdc, R2_COPYPEN);
+	SelectObject(hdc, GetStockObject(BLACK_PEN));
+
+	DrawTarget(hdc, current_target_location);
+	DrawLabel(hdc, current_target_location, szInstructions);
+
+	// put things back
+	SetROP2(hdc, old_rop);
+	SelectObject(hdc, hOldPen);
+}
+
+#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
+#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
+
+LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+	PAINTSTRUCT ps;
+	HDC hdc;
+  
+	switch(msg) {
+		case WM_PAINT:
+			hdc = BeginPaint(hwnd, &ps);
+			DoPaint(hdc);
+			EndPaint(hwnd, &ps);
+			break;
+
+		case WM_NCHITTEST:
+			return HTCLIENT;
+
+		case WM_LBUTTONUP:
+			if ( pcp != 0 )
+			{
+				pcp->screen.x = current_target_location.x * TRANSFORMATION_UNITS_PER_PIXEL;
+				pcp->screen.y = current_target_location.y * TRANSFORMATION_UNITS_PER_PIXEL;
+				pcp->device.x = GET_X_LPARAM(lp);
+				pcp->device.y = GET_Y_LPARAM(lp);
+			}
+
+			if ( ++current_target == total_targets )
+			{
+				TRANSFORMATION_COEFFICIENTS tc;
+#if 0
+				CalcTransformationCoefficientsSimple(&cps, &tc);
+				printf("%d %d %d %d %d %d %d\n",
+					tc.a, tc.b, tc.c, tc.d, tc.e, tc.f, tc.s);
+				CalcTransformationCoefficientsBetter(&cps, &tc);
+				printf("%d %d %d %d %d %d %d\n",
+					tc.a, tc.b, tc.c, tc.d, tc.e, tc.f, tc.s);
+				CalcTransformationCoefficientsEvenBetter(&cps, &tc);
+				printf("%d %d %d %d %d %d %d\n",
+					tc.a, tc.b, tc.c, tc.d, tc.e, tc.f, tc.s);
+#endif
+				CalcTransformationCoefficientsBest(&cps, &tc);
+				printf("%d %d %d %d %d %d %d\n",
+					tc.a, tc.b, tc.c, tc.d, tc.e, tc.f, tc.s);
+				InvalidateRect(hwnd, NULL, TRUE);
+				UpdateWindow(hwnd);
+				PostQuitMessage(0);
+				break;
+			}
+			InvalidateRect(hwnd, NULL, TRUE);
+			UpdateWindow(hwnd);
+			break;
+
+		default:
+			return DefWindowProc(hwnd, msg, wp, lp);
+	}
+
+	return 0;
+}
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
+{
+	WNDCLASS wc;
+	RECT r;
+	HWND hwnd;
+	MSG msg;
+	MWCOORD big;
+
+	srandom(time(NULL));
+
+	/* WndButtonRegister(NULL); */
+
+	wc.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW;
+	wc.lpfnWndProc = (WNDPROC)WndProc;
+	wc.cbClsExtra = 0;
+	wc.cbWndExtra = 0;
+	wc.hInstance = 0;
+	wc.hIcon = 0;
+	wc.hCursor = 0;
+	wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
+	wc.lpszMenuName = NULL;
+	wc.lpszClassName = "tpcal";
+	RegisterClass(&wc);
+
+	GetWindowRect(GetDesktopWindow(), &r);
+	xext = r.right;
+	yext = r.bottom;
+
+	hwnd = CreateWindowEx(0L, "tpcal", "Touch Panel Calibration",
+		WS_VISIBLE, 0, 0, xext, yext,
+		NULL, (HMENU)1, NULL, NULL);
+
+	// Don't restrict mouse much in order to handle uncalibrated points.
+	big = 1000000;
+	GdRestrictMouse(-big, -big, big, big);
+
+	// We want all mouse events - even ones outside our window.
+	SetCapture(hwnd);
+
+	while(GetMessage(&msg, NULL, 0, 0)) {
+		TranslateMessage(&msg);
+		DispatchMessage(&msg);
+	}
+
+	return 0;
+}
+
+int enable_pointing_coordinate_transform;
+
+int MwUserInit(int ac, char** av)
+{
+	enable_pointing_coordinate_transform = 0;
+
+	if ( ac > 1 )
+		total_targets = atol(av[1]);
+
+	return 0;
+}
+
diff -urN lib/microwindows/src/contrib/GPL/tpcal/transform.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/GPL/tpcal/transform.c
--- lib/microwindows/src/contrib/GPL/tpcal/transform.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/GPL/tpcal/transform.c	2005-02-21 16:02:47.000000000 +0100
@@ -0,0 +1,295 @@
+/*
+ * transform.c
+ * Calculate coefficients for tranformation equation
+ * Copyright (C) 1999 Bradley D. LaRonde <brad@ltc.com>
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include "windows.h"
+#include "mou_tp.h"
+#include "transform.h"
+
+int CalcTransformationCoefficientsSimple(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc)
+{
+	/*
+	 * This is my simple way of calculating some of the coefficients -
+	 * enough to do a simple scale and translate.
+	 * It ignores any dependencies between axiis (rotation and/or skew).
+	 */
+
+	int min_screen_x = pcp->ul.screen.x;
+	int min_screen_y = pcp->ul.screen.y;
+	int max_screen_x = pcp->lr.screen.x;
+	int max_screen_y = pcp->lr.screen.y;
+
+	int min_device_x = pcp->ul.device.x;
+	int min_device_y = pcp->ul.device.y;
+	int max_device_x = pcp->lr.device.x;
+	int max_device_y = pcp->lr.device.y;
+
+	ptc->s = (1 << 16);
+	ptc->a = ptc->s * (min_screen_x - max_screen_x) / (min_device_x - max_device_x);
+	ptc->b = 0;
+	ptc->c = (ptc->a * -min_device_x) + (ptc->s * min_screen_x);
+	ptc->d = 0;
+	ptc->e = ptc->s * (min_screen_y - max_screen_y) / (min_device_y - max_device_y);
+	ptc->f = (ptc->e * -min_device_y) + (ptc->s * min_screen_y);
+
+	return 0;
+}
+
+int CalcTransformationCoefficientsBetter(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc)
+{
+	/*
+	 * Janus (the man) <janus@place.org> came up with a much better way
+	 * to figure the coefficients.  His original algorithm was written in MOO.
+	 * Jay Carlson <> did the translation to C.
+	 * This way takes into account inter-axis dependency like rotation and skew.
+	 */
+
+	double vector[3][2] =
+	{
+		{pcp->ul.screen.x, pcp->ul.screen.y},
+		{pcp->ur.screen.x, pcp->ur.screen.y},
+		{pcp->lr.screen.x, pcp->lr.screen.y}
+	};
+
+	double matrix[3][3] =
+	{
+		{pcp->ul.device.x, pcp->ul.device.y, 1.0},
+		{pcp->ur.device.x, pcp->ur.device.y, 1.0},
+		{pcp->lr.device.x, pcp->lr.device.y, 1.0}
+	};
+
+	int i, j, r, k;
+	double p, q;
+    
+	for (i = 0; i < 3; i++) {
+          p = matrix[i][i];
+          
+          for (j = 0; j < 3; j++) {
+               matrix[i][j] = matrix[i][j] / p;
+          }
+          
+          for (j = 0; j < 2; j++) {
+               vector[i][j] = vector[i][j] / p;
+          }
+
+          for (r = 0; r < 3; r++) {
+               if (r != i) {
+                    q = matrix[r][i];
+                    
+                    matrix[r][i] = 0.0;
+                    
+                    for (k = i + 1; k < 3; k++) {
+                         matrix[r][k] = matrix[r][k] - (q * matrix[i][k]);
+                    }
+                    
+                    for (k = 0; k < 2; k++) {
+                         vector[r][k] = vector[r][k] - (q * vector[i][k]);
+                    }
+               }
+          }
+	}
+
+	ptc->s = 1 << 16;
+	ptc->a = vector[0][0] * ptc->s;
+	ptc->b = vector[1][0] * ptc->s;
+	ptc->c = vector[2][0] * ptc->s;
+	ptc->d = vector[0][1] * ptc->s;
+	ptc->e = vector[1][1] * ptc->s;
+	ptc->f = vector[2][1] * ptc->s;
+
+	return 0;
+}
+
+int CalcTransformationCoefficientsEvenBetter(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc)
+{
+	/*
+	 * Mike Klar <> added the an xy term to correct for trapezoidial distortion.
+	 */
+
+	double vector[4][2] =
+	{
+		{pcp->ul.screen.x, pcp->ul.screen.y},
+		{pcp->ur.screen.x, pcp->ur.screen.y},
+		{pcp->lr.screen.x, pcp->lr.screen.y},
+		{pcp->ll.screen.x, pcp->ll.screen.y}
+	};
+
+	double matrix[4][4] =
+	{
+		{pcp->ul.device.x, pcp->ul.device.x * pcp->ul.device.y, pcp->ul.device.y, 1.0},
+		{pcp->ur.device.x, pcp->ur.device.x * pcp->ur.device.y, pcp->ur.device.y, 1.0},
+		{pcp->lr.device.x, pcp->lr.device.x * pcp->lr.device.y, pcp->lr.device.y, 1.0},
+		{pcp->ll.device.x, pcp->ll.device.x * pcp->ll.device.y, pcp->ll.device.y, 1.0}
+	};
+
+	int i, j, r, k;
+	double p, q;
+    
+	for (i = 0; i < 4; i++) {
+          p = matrix[i][i];
+          
+          for (j = 0; j < 4; j++) {
+               matrix[i][j] = matrix[i][j] / p;
+          }
+          
+          for (j = 0; j < 2; j++) {
+               vector[i][j] = vector[i][j] / p;
+          }
+
+          for (r = 0; r < 4; r++) {
+               if (r != i) {
+                    q = matrix[r][i];
+                    
+                    matrix[r][i] = 0.0;
+                    
+                    for (k = i + 1; k < 4; k++) {
+                         matrix[r][k] = matrix[r][k] - (q * matrix[i][k]);
+                    }
+                    
+                    for (k = 0; k < 2; k++) {
+                         vector[r][k] = vector[r][k] - (q * vector[i][k]);
+                    }
+               }
+          }
+	}
+
+	/* I just drop the xy coefficient since it is so small. */
+	ptc->s = 1 << 16;
+	ptc->a = vector[0][0] * ptc->s;
+	ptc->b = vector[2][0] * ptc->s;
+	ptc->c = vector[3][0] * ptc->s;
+	ptc->d = vector[0][1] * ptc->s;
+	ptc->e = vector[2][1] * ptc->s;
+	ptc->f = vector[3][1] * ptc->s;
+
+	return 0;
+}
+
+int CalcTransformationCoefficientsBest(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc)
+{
+	/*
+	 * Mike Klar <> came up with a best-fit solution that works best.
+	 */
+
+	const int first_point = 0;
+	const int last_point = 4;
+	int i;
+
+	double Sx=0, Sy=0, Sxy=0, Sx2=0, Sy2=0, Sm=0, Sn=0, Smx=0, Smy=0, Snx=0, Sny=0, S=0;
+	double t1, t2, t3, t4, t5, t6, q;
+
+	/* cast the struct to an array - hacky but ok */
+	CALIBRATION_PAIR *cp = (CALIBRATION_PAIR*)pcp;
+
+	/*
+	 * Do a best-fit calculation for as many points as we want, as
+	 * opposed to an exact fit, which can only be done against 3 points.
+	 *
+	 * The following calculates various sumnations of the sample data
+	 * coordinates.  For purposes of naming convention, x and y
+	 * refer to device coordinates, m and n refer to screen
+	 * coordinates, S means sumnation.  x2 and y2 are x squared and
+	 * y squared, S by itself is just a count of points (= sumnation
+	 * of 1).
+	 */
+
+	for (i = first_point; i < last_point + 1; i++) {
+		Sx += cp[i].device.x;
+		Sy += cp[i].device.y;
+		Sxy += cp[i].device.x * cp[i].device.y;
+		Sx2 += cp[i].device.x * cp[i].device.x;
+		Sy2 += cp[i].device.y * cp[i].device.y;
+		Sm += cp[i].screen.x;
+		Sn += cp[i].screen.y;
+		Smx += cp[i].screen.x * cp[i].device.x;
+		Smy += cp[i].screen.x * cp[i].device.y;
+		Snx += cp[i].screen.y * cp[i].device.x;
+		Sny += cp[i].screen.y * cp[i].device.y;
+		S += 1;
+	}
+
+#if 0
+	printf("%f, %f, %f, %f, "
+	       "%f, %f, %f, %f, "
+	       "%f, %f, %f, %f\n",
+	        Sx, Sy, Sxy, Sx2, Sy2, Sm, Sn, Smx, Smy, Snx, Sny, S);
+#endif
+
+	/*
+	 * Next we solve the simultaneous equations (these equations minimize
+	 * the sum of the square of the m and n error):
+	 *
+	 *    | Sx2 Sxy Sx |   | a d |   | Smx Snx |
+	 *    | Sxy Sy2 Sy | * | b e | = | Smy Sny |
+	 *    | Sx  Sy  S  |   | c f |   | Sm  Sn  |
+	 *
+	 * We could do the matrix solution in code, but that leads to several
+	 * divide by 0 conditions for cases where the data is truly solvable
+	 * (becuase those terms cancel out of the final solution), so we just
+	 * give the final solution instread.  t1 through t6 and q are just
+	 * convenience variables for terms that are used repeatedly - we could
+	 * calculate each of the coefficients directly at this point with a
+	 * nasty long equation, but that would be extremly inefficient.
+	 */
+
+	t1 = Sxy * Sy - Sx * Sy2;
+	t2 = Sxy * Sx - Sx2 * Sy;
+	t3 = Sx2 * Sy2 - Sxy * Sxy;
+	t4 = Sy2 * S - Sy * Sy;
+	t5 = Sx * Sy - Sxy * S;
+	t6 = Sx2 * S - Sx * Sx;
+
+	q = t1 * Sx + t2 * Sy + t3 * S;
+
+	/*
+	 * If q = 0, then the data is unsolvable.  This should only happen
+	 * when there are not enough unique data points (less than 3 points
+	 * will give infinite solutions), or at least one of the 
+	 * coefficients is infinite (which would indicate that the same
+	 * device point represents an infinite area of the screen, probably
+	 * as a result of the same device data point given for 2 different
+	 * screen points).  The first condition should never happen, since
+	 * we're always feeding in at least 3 unique screen points.  The
+	 * second condition would probably indicate bad user input or the
+	 * touchpanel device returning bad data.
+	 */
+
+	if (q == 0)
+		return -1;
+
+	ptc->s = 1 << 16;
+	ptc->a = ((t4 * Smx + t5 * Smy + t1 * Sm) / q + 0.5/65536) * ptc->s;
+	ptc->b = ((t5 * Smx + t6 * Smy + t2 * Sm) / q + 0.5/65536) * ptc->s;
+	ptc->c = ((t1 * Smx + t2 * Smy + t3 * Sm) / q + 0.5/65536) * ptc->s;
+	ptc->d = ((t4 * Snx + t5 * Sny + t1 * Sn) / q + 0.5/65536) * ptc->s;
+	ptc->e = ((t5 * Snx + t6 * Sny + t2 * Sn) / q + 0.5/65536) * ptc->s;
+	ptc->f = ((t1 * Snx + t2 * Sny + t3 * Sn) / q + 0.5/65536) * ptc->s;
+
+	/*
+	 * Finally, we check for overflow on the fp to integer conversion,
+	 * which would also probably indicate bad data.
+	 */
+
+	if ( (ptc->a == 0x80000000) || (ptc->b == 0x80000000) ||
+	     (ptc->c == 0x80000000) || (ptc->d == 0x80000000) ||
+	     (ptc->e == 0x80000000) || (ptc->f == 0x80000000) )
+		return -1;
+	
+	return 0;
+}
+
diff -urN lib/microwindows/src/contrib/GPL/tpcal/transform.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/GPL/tpcal/transform.h
--- lib/microwindows/src/contrib/GPL/tpcal/transform.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/GPL/tpcal/transform.h	2005-02-21 16:02:48.000000000 +0100
@@ -0,0 +1,37 @@
+/*
+ * transform.h
+ * Copyright (C) 1999 Bradley D. LaRonde <brad@ltc.com>
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+typedef struct
+{
+	MWPOINT screen, device;
+} CALIBRATION_PAIR;
+
+typedef struct
+{
+	CALIBRATION_PAIR center;
+	CALIBRATION_PAIR ul;
+	CALIBRATION_PAIR ur;
+	CALIBRATION_PAIR lr;
+	CALIBRATION_PAIR ll;
+} CALIBRATION_PAIRS;
+
+int CalcTransformationCoefficientsSimple(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc);
+int CalcTransformationCoefficientsBetter(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc);
+int CalcTransformationCoefficientsEvenBetter(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc);
+int CalcTransformationCoefficientsBest(CALIBRATION_PAIRS *pcp, TRANSFORMATION_COEFFICIENTS *ptc);
Binary files lib/microwindows/src/contrib/MWIN-TCN.PRJ and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/MWIN-TCN.PRJ differ
Binary files lib/microwindows/src/contrib/MWIN-TCW.PRJ and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/MWIN-TCW.PRJ differ
diff -urN lib/microwindows/src/contrib/README.freebsd /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/README.freebsd
--- lib/microwindows/src/contrib/README.freebsd	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/README.freebsd	2005-02-21 16:02:50.000000000 +0100
@@ -0,0 +1,17 @@
+I have added files to this package to get it to run on a FreeBSD
+console. Some changes, particularly to the Makefiles are not particularly
+clean, and could probably be done a lot better (but hey, it's what I got
+done in about a day d8)
+
+2000/07/01
+I've added a terminal 'wterm'. At least it has a termcap so you can
+run curses based stuff, and it scrolls (scroll speed depends on the
+speed of your blitter, the FreeBSD blitter is completely stupid at
+the moment).
+
+--
+Totally Holistic Enterprises Internet|  P:+61 7 3870 0066   |  Andrew
+The Internet (Aust) Pty Ltd          |  F:+61 7 3870 4477   |  Milton
+ACN: 082 081 472                     |  M:+61 416 022 411   |72 Col .Sig
+PO Box 837 Indooroopilly QLD 4068    |akm@theinternet.com.au|Specialist
+
diff -urN lib/microwindows/src/contrib/djgpp/readme.dj /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/djgpp/readme.dj
--- lib/microwindows/src/contrib/djgpp/readme.dj	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/djgpp/readme.dj	2005-02-21 16:12:48.000000000 +0100
@@ -0,0 +1,36 @@
+For porting Microwindows to DOS + DJGPP you should have the following:
+=====================================================================
+1. Microwin 0.8 pre7  - (microwindows.censoft.com)
+2. DJGPP ver. 2.01    - (www.delorie.com)
+3. GRX ver. 2.3       - (www.gnu.de/software/grx  or  www.delorie.com)
+
+
+You should do the following:
+===============================
+1. save all old files:  
+	config
+2. ren config.dj         to config
+
+do MAKE !!!
+===============
+
+I made it on Windows 95 in DJGPP bash ver. 1147, gcc ver. 2.7.2.1.
+and make ver. 377.
+
+File grx20.h should be in djgpp\include and file libgrx20.a
+should be in djgpp\lib.
+
+For using long file names you should set LFN=y in file djgpp.env
+under Windows 95, or rename some files to 8.3 under DOS.
+
+Program MWINDEMO work at DOS box Windows 95 and pure DOS,
+in videomodes 640x480x16 and 800x600x256.
+
+For NANOXDEMO use LINK_APP_INTO_SERVER.
+
+Program NANOXDEMO demo work at DOS box Windows 95 and pure DOS.
+
+! NOT all demos have been tested (or debugged) for DJGPP.
+===============================================
+
+Victor Rogachev <rogach@sut.ru>
diff -urN lib/microwindows/src/contrib/fb.modes /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/fb.modes
--- lib/microwindows/src/contrib/fb.modes	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/fb.modes	2005-02-21 16:02:49.000000000 +0100
@@ -0,0 +1,975 @@
+#
+#   Sample video modes
+# 
+#   These data are based on the CRTC parameters in
+# 
+#       Mach64 Programmer's Guide, Appendix C
+#       (C) 1998 ATI Technologies Inc.
+#
+
+#
+#	640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		640		480
+#	Scan Frequency		31.469 kHz	59.94 Hz
+#	Sync Width		3.813 us	0.064 ms
+#				12 chars	2 lines
+#	Front Porch		0.636 us	0.318  ms
+#				2 chars		10 lines
+#	Back Porch		1.907 us	1.048  ms
+#				6 chars		33 lines
+#	Active Time		25.422 us	15.253 ms
+#				80 chars	480 lines
+#	Blank Time		6.356 us	1.430 ms
+#				20 chars	45 lines
+#	Polarity		negative	negative
+#
+
+mode "640x480-60"
+    # D: 25.175 MHz, H: 31.469 kHz, V: 59.94 Hz
+    geometry 640 480 640 480 8
+    timings 39722 48 16 33 10 96 2
+endmode
+ 
+#
+#	640x480, 72 Hz, Non-Interlaced (31.20 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		640		480
+#	Scan Frequency		37.500 kHz	72.12 Hz
+#	Sync Width		1.282 us	0.080 ms
+#				5 chars		3 lines
+#	Front Porch		0.769 us	0.240 ms
+#				3 chars		9 lines
+#	Back Porch		4.103 us	0.747 ms
+#				16 chars	28 lines
+#	Active Time		20.513 us	12.800 ms
+#				80 chars	480 lines
+#	Blank Time		6.154 us	1.067 ms
+#				24 chars	40 lines
+#	Polarity		negative	negative
+#
+
+mode "640x480-72"
+    # D: 31.20 MHz, H: 37.500 kHz, V: 72.12 Hz
+    geometry 640 480 640 480 8
+    timings 32052 128 24 28 9 40 3
+endmode
+ 
+mode "test8"
+    # D: 31.20 MHz, H: 37.500 kHz, V: 72.12 Hz
+    geometry 640 480 640 480 8
+    timings 32052 128 24 28 9 40 3
+endmode
+ 
+mode "test16"
+    # D: 31.20 MHz, H: 37.500 kHz, V: 72.12 Hz
+    geometry 640 480 640 480 16
+    timings 32052 128 24 28 9 40 3
+endmode
+ 
+mode "test32"
+    # D: 31.20 MHz, H: 37.500 kHz, V: 72.12 Hz
+    geometry 640 480 640 480 32
+    timings 32052 128 24 28 9 40 3
+endmode
+
+mode "ntest8"
+    # D: 25.172 MHz, H: 31.466 kHz, V: 59.934 Hz
+    geometry 640 480 640 480 8
+    timings 39726 48 16 33 10 96 2
+endmode
+ 
+mode "ntest16"
+    # D: 25.172 MHz, H: 31.466 kHz, V: 59.934 Hz
+    geometry 640 480 640 480 16
+    timings 39726 48 16 33 10 96 2
+endmode
+ 
+mode "ntest32"
+    # D: 25.172 MHz, H: 31.466 kHz, V: 59.934 Hz
+    geometry 640 480 640 480 32
+    timings 39726 48 16 33 10 96 2
+endmode
+ 
+mode "ntest24"
+    # D: 25.172 MHz, H: 31.466 kHz, V: 59.934 Hz
+    geometry 640 480 640 480 24
+    timings 39726 48 16 33 10 96 2
+endmode
+ 
+#
+#	640x480, 75 Hz, Non-Interlaced (31.50 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		640		480
+#	Scan Frequency		37.500 kHz	75.00 Hz
+#	Sync Width		2.032 us	0.080 ms
+#				8 chars		3 lines
+#	Front Porch		0.508 us	0.027 ms
+#				2 chars		1 lines
+#	Back Porch		3.810 us	0.427 ms
+#				15 chars	16 lines
+#	Active Time		20.317 us	12.800 ms
+#				80 chars	480 lines
+#	Blank Time		6.349 us	0.533 ms
+#				25 chars	20 lines
+#	Polarity		negative	negative
+#
+
+mode "640x480-75"
+    # D: 31.50 MHz, H: 37.500 kHz, V: 75.00 Hz
+    geometry 640 480 640 480 8
+    timings 31747 120 16 16 1 64 3
+endmode
+ 
+#
+#	640x480, 90 Hz, Non-Interlaced (39.91 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		640		480
+#	Scan Frequency		47.969 kHz	90.00 Hz
+#	Sync Width		1.002 us	0.292 ms
+#				5 chars		14 lines
+#	Front Porch		0.902 us	0.521 ms
+#				4 chars		25 lines
+#	Back Porch		2.907 us	0.292 ms
+#				15 chars	14 lines
+#	Active Time		16.036 us	10.007 ms
+#				80 chars	480 lines
+#	Blank Time		4.811 us	1.105 ms
+#				24 chars	53 lines
+#	Polarity		negative	negative
+#
+
+mode "640x480-90"
+    # D: 39.91 MHz, H: 47.969 kHz, V: 90.00 Hz
+    geometry 640 480 640 480 8
+    timings 25057 120 32 14 25 40 14
+endmode
+ 
+#
+#	640x480, 100 Hz, Non-Interlaced (44.90 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		640		480
+#	Scan Frequency		52.948 kHz	99.71 Hz
+#	Sync Width		2.851 us	0.227 ms
+#				16 chars	12 lines
+#	Front Porch		0.801 us	0.416 ms
+#				4 chars		22 lines
+#	Back Porch		0.981 us	0.322 ms
+#				6 chars		17 lines
+#	Active Time		14.254 us	9.065 ms
+#				80 chars	480 lines
+#	Blank Time		4.633 us	0.963 ms
+#				26 chars	51 lines
+#	Polarity		negative	negative
+#
+
+mode "640x480-100"
+    # D: 44.90 MHz, H: 52.948 kHz, V: 99.71 Hz
+    geometry 640 480 640 480 8
+    timings 22272 48 32 17 22 128 12
+endmode
+ 
+#
+#	800x600, 48 Hz, Interlaced (36.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		800		600
+#	Scan Frequency		33.835 kHz	96.39 Hz
+#	Sync Width		3.556 us	0.177 ms
+#				16 chars	12 lines
+#	Front Porch		2.222 us	0.163 ms
+#				10 chars	11 lines
+#	Back Porch		1.555 us	1.167 ms
+#				7 chars		79 lines
+#	Active Time		22.222 us	8.867 ms
+#				100 chars	600 lines
+#	Blank Time		7.333 us	1.507 ms
+#				33 chars	102 lines
+#	Polarity		positive	positive
+#
+
+mode "800x600-48-lace"
+    # D: 36.00 MHz, H: 33.835 kHz, V: 96.39 Hz
+    geometry 800 600 800 600 8
+    timings 27778 56 80 79 11 128 12
+    laced true
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	800x600, 56 Hz, Non-Interlaced (36.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		800		600
+#	Scan Frequency		35.156 kHz	56.25 Hz
+#	Sync Width		2.000 us	0.057 ms
+#				9 chars		2 lines
+#	Front Porch		0.667 us	0.028 ms
+#				3 chars		1 lines
+#	Back Porch		3.555 us	0.626 ms
+#				16 chars	22 lines
+#	Active Time		22.222 us	17.067 ms
+#				100 chars	600 lines
+#	Blank Time		6.222 us	0.711 ms
+#				28 chars	25 lines
+#	Polarity		positive	positive
+#
+
+mode "800x600-56"
+    # D: 36.00 MHz, H: 35.156 kHz, V: 56.25 Hz
+    geometry 800 600 800 600 8
+    timings 27778 128 24 22 1 72 2
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	800x600, 60 Hz, Non-Interlaced (40.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		800		600
+#	Scan Frequency		37.879 kHz	60.32 Hz
+#	Sync Width		3.200 us	0.106 ms
+#				16 chars	4 lines
+#	Front Porch		1.000 us	0.026 ms
+#				5 chars		1 lines
+#	Back Porch		2.200 us	0.607 ms
+#				11 chars	23 lines
+#	Active Time		20.000 us	15.840 ms
+#				100 chars	600 lines
+#	Blank Time		6.400 us	0.739 ms
+#				32 chars	28 lines
+#	Polarity		positive	positive
+#
+
+mode "800x600-60"
+    # D: 40.00 MHz, H: 37.879 kHz, V: 60.32 Hz
+    geometry 800 600 800 600 8
+    timings 25000 88 40 23 1 128 4
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	800x600, 70 Hz, Non-Interlaced (44.90 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		800		600
+#	Scan Frequency		44.544 kHz	70.04 Hz
+#	Sync Width		3.207 us	0.269 ms
+#				18 chars	12 lines
+#	Front Porch		0.535 us	0.202 ms
+#				3 chars		9 lines
+#	Back Porch		0.891 us	0.337 ms
+#				5 chars		15 lines
+#	Active Time		17.817 us	13.470 ms
+#				100 chars	600 lines
+#	Blank Time		4.633 us	0.808 ms
+#				26 chars	36 lines
+#	Polarity		positive	negative
+#
+
+mode "800x600-70"
+    # D: 44.90 MHz, H: 44.544 kHz, V: 70.04 Hz
+    geometry 800 600 800 600 8
+    timings 22272 40 24 15 9 144 12
+    hsync high
+endmode
+ 
+#
+#	800x600, 72 Hz, Non-Interlaced (50.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		800		600
+#	Scan Frequency		48.090 kHz	72.19 Hz
+#	Sync Width		2.400 us	0.125 ms
+#				15 chars	6 lines
+#	Front Porch		1.120 us	0.769 ms
+#				7 chars		37 lines
+#	Back Porch		1.280 us	0.478 ms
+#				8 chars		23 lines
+#	Active Time		16.000 us	12.477 ms
+#				100 chars	600 lines
+#	Blank Time		4.800 us	1.372 ms
+#				30 chars	66 lines
+#	Polarity		positive	positive
+#
+
+mode "800x600-72"
+    # D: 50.00 MHz, H: 48.090 kHz, V: 72.19 Hz
+    geometry 800 600 800 600 8
+    timings 20000 64 56 23 37 120 6
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	800x600, 75 Hz, Non-Interlaced (49.50 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		800		600
+#	Scan Frequency		46.875 kHz	75.00 Hz
+#	Sync Width		1.616 us	0.064 ms
+#				10 chars	3 lines
+#	Front Porch		0.323 us	0.021 ms
+#				2 chars		1 lines
+#	Back Porch		3.232 us	0.448 ms
+#				20 chars	21 lines
+#	Active Time		16.162 us	12.800 ms
+#				100 chars	600 lines
+#	Blank Time		5.172 us	0.533 ms
+#				32 chars	25 lines
+#	Polarity		positive	positive
+#
+
+mode "800x600-75"
+    # D: 49.50 MHz, H: 46.875 kHz, V: 75.00 Hz
+    geometry 800 600 800 600 8
+    timings 20203 160 16 21 1 80 3
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	800x600, 90 Hz, Non-Interlaced (56.64 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		800		600
+#	Scan Frequency		57.097 kHz	89.92 Hz
+#	Sync Width		1.130 us	0.193 ms
+#				8 chars		11 lines
+#	Front Porch		0.071 us	0.140 ms
+#				1 chars		8 lines
+#	Back Porch		2.189 us	0.280 ms
+#				15 chars	16 lines
+#	Active Time		14.124 us	10.508 ms
+#				100 chars	600 lines
+#	Blank Time		3.390 us	0.613 ms
+#				24 chars	35 lines
+#	Polarity		positive	positive
+#
+
+mode "800x600-90"
+    # D: 56.64 MHz, H: 57.097 kHz, V: 89.92 Hz
+    geometry 800 600 800 600 8
+    timings 17656 120 8 16 8 64 11
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	800x600, 100 Hz, Non-Interlaced (67.50 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		800		600
+#	Scan Frequency		62.500 kHz	100.00 Hz
+#	Sync Width		0.948 us	0.064 ms
+#				8 chars		4 lines
+#	Front Porch		0.000 us	0.112 ms
+#				0 chars		7 lines
+#	Back Porch		3.200 us	0.224 ms
+#				27 chars	14 lines
+#	Active Time		11.852 us	9.600 ms
+#				100 chars	600 lines
+#	Blank Time		4.148 us	0.400 ms
+#				35 chars	25 lines
+#	Polarity		positive	positive
+#
+
+mode "800x600-100"
+    # D: 67.50 MHz, H: 62.500 kHz, V: 100.00 Hz
+    geometry 800 600 800 600 8
+    timings 14815 216 0 14 7 64 4
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	1024x768, 43 Hz, Interlaced (44.90 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1024		768
+#	Scan Frequency		35.522 kHz	86.96 Hz
+#	Sync Width		3.920 us	0.113 ms
+#				22 chars	8 lines
+#	Front Porch		0.178 us	0.014 ms
+#				1 chars		1 lines
+#	Back Porch		1.247 us	0.563 ms
+#				7 chars		40 lines
+#	Active Time		22.806 us	10.810 ms
+#				128 chars	768 lines
+#	Blank Time		5.345 us	0.690 ms
+#				30 chars	49 lines
+#	Polarity		positive	positive
+#
+
+mode "1024x768-43-lace"
+    # D: 44.90 MHz, H: 35.522 kHz, V: 86.96 Hz
+    geometry 1024 768 1024 768 8
+    timings 22272 56 8 40 1 176 8
+    laced true
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	1024x768, 60 Hz, Non-Interlaced (65.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1024		768
+#	Scan Frequency		48.363 kHz	60.00 Hz
+#	Sync Width		2.092 us	0.124 ms
+#				17 chars	6 lines
+#	Front Porch		0.369 us	0.062 ms
+#				3 chars		3 lines
+#	Back Porch		2.462 us	0.601 ms
+#				20 chars	29 lines
+#	Active Time		15.754 us	15.880 ms
+#				128 chars	768 lines
+#	Blank Time		4.923 us	0.786 ms
+#				40 chars	38 lines
+#	Polarity		negative	negative
+#
+
+mode "1024x768-60"
+    # D: 65.00 MHz, H: 48.363 kHz, V: 60.00 Hz
+    geometry 1024 768 1024 768 8
+    timings 15385 160 24 29 3 136 6
+endmode
+ 
+#
+#	1024x768, 70 Hz, Non-Interlaced (75.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1024		768
+#	Scan Frequency		56.476 kHz	70.07 Hz
+#	Sync Width		1.813 us	0.106 ms
+#				17 chars	6 lines
+#	Front Porch		0.320 us	0.053 ms
+#				3 chars		3 lines
+#	Back Porch		1.921 us	0.514 ms
+#				18 chars	29 lines
+#	Active Time		13.653 us	13.599 ms
+#				128 chars	768 lines
+#	Blank Time		4.053 us	0.673 ms
+#				38 chars	38 lines
+#	Polarity		negative	negative
+#
+
+mode "1024x768-70"
+    # D: 75.00 MHz, H: 56.476 kHz, V: 70.07 Hz
+    geometry 1024 768 1024 768 8
+    timings 13334 144 24 29 3 136 6
+endmode
+ 
+#
+#	1024x768, 72 Hz, Non-Interlaced (75.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		10224		768
+#	Scan Frequency		58.230 kHz	72.245 Hz
+#	Sync Width		1.813 us	0.103 ms
+#				17 chars	6 lines
+#	Front Porch		0.320 us	0.052 ms
+#				3 chars		3 lines
+#	Back Porch		1.387 us	0.498 ms
+#				13 chars	29 lines
+#	Active Time		13.653 us	13.189 ms
+#				128 chars	768 lines
+#	Blank Time		3.520 us	0.653 ms
+#				33 chars	38 lines
+#	Polarity		negative	negative
+#
+
+mode "1024x768-72"
+    # D: 75.00 MHz, H: 58.230 kHz, V: 72.245 Hz
+    geometry 10224 768 10224 768 8
+    timings 13334 104 24 29 3 136 6
+endmode
+ 
+#
+#	1024x768, 75 Hz, Non-Interlaced (78.75 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1024		768
+#	Scan Frequency		60.023 kHz	75.03 Hz
+#	Sync Width		1.219 us	0.050 ms
+#				12 chars	3 lines
+#	Front Porch		0.203 us	0.017 ms
+#				2 chars		1 lines
+#	Back Porch		2.235 us	0.466 ms
+#				22 chars	28 lines
+#	Active Time		13.003 us	12.795 ms
+#				128 chars	768 lines
+#	Blank Time		3.657 us	0.533 ms
+#				36 chars	32 lines
+#	Polarity		positive	positive
+#
+
+mode "1024x768-75"
+    # D: 78.75 MHz, H: 60.023 kHz, V: 75.03 Hz
+    geometry 1024 768 1024 768 8
+    timings 12699 176 16 28 1 96 3
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	1024x768, 90 Hz, Non-Interlaced (100.0 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1024		768
+#	Scan Frequency		76.220 kHz	90.20 Hz
+#	Sync Width		0.960 us	0.197 ms
+#				12 chars	15 lines
+#	Front Porch		0.000 us	0.276 ms
+#				0 chars		21 lines
+#	Back Porch		1.920 us	0.537 ms
+#				24 chars	41 lines
+#	Active Time		10.240 us	10.076 ms
+#				128 chars	768 lines
+#	Blank Time		2.880 us	1.010 ms
+#				36 chars	77 lines
+#	Polarity		negative	negative
+#
+
+mode "1024x768-90"
+    # D: 100.0 MHz, H: 76.220 kHz, V: 90.20 Hz
+    geometry 1024 768 1024 768 8
+    timings 10000 192 0 41 21 96 15
+endmode
+ 
+#
+#	1024x768, 100 Hz, Non-Interlaced (110.0 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1024		768
+#	Scan Frequency		79.023 kHz	99.78 Hz
+#	Sync Width		0.800 us	0.101 ms
+#				11 chars	8 lines
+#	Front Porch		0.000 us	0.000 ms
+#				0 chars		0 lines
+#	Back Porch		2.545 us	0.202 ms
+#				35 chars	16 lines
+#	Active Time		9.309 us	9.719 ms
+#				128 chars	768 lines
+#	Blank Time		3.345 us	0.304 ms
+#				46 chars	24 lines
+#	Polarity		negative	negative
+#
+
+mode "1024x768-100"
+    # D: 110.0 MHz, H: 79.023 kHz, V: 99.78 Hz
+    geometry 1024 768 1024 768 8
+    timings 9091 280 0 16 0 88 8
+endmode
+ 
+#
+#	1152x864, 43 Hz, Interlaced (65.0 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1152		864
+#	Scan Frequency		45.904 kHz	87.02 Hz
+#	Sync Width		1.969 us	0.098 ms
+#				16 chars	9 lines
+#	Front Porch		1.062 us	0.850 ms
+#				9 chars		78 lines
+#	Back Porch		1.031 us	1.133 ms
+#				8 chars		104 lines
+#	Active Time		17.723 us	9.411 ms
+#				144 chars	864 lines
+#	Blank Time		4.062 us	2.080 ms
+#				33 chars	191 lines
+#	Polarity		positive	positive
+#
+
+mode "1152x864-43-lace"
+    # D: 65.0 MHz, H: 45.904 kHz, V: 87.02 Hz
+    geometry 1152 864 1152 864 8
+    timings 15385 64 72 104 78 128 9
+    laced true
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	1152x864, 47 Hz, Interlaced (65.0 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1152		864
+#	Scan Frequency		44.890 kHz	94.80 Hz
+#	Sync Width		1.969 us	0.100 ms
+#				16 chars	9 lines
+#	Front Porch		1.415 us	0.334 ms
+#				11 chars	30 lines
+#	Back Porch		1.170 us	0.490 ms
+#				10 chars	44 lines
+#	Active Time		17.723 us	9.624 ms
+#				144 chars	864 lines
+#	Blank Time		4.554 us	0.924 ms
+#				37 chars	83 lines
+#	Polarity		positive	positive
+#
+
+mode "1152x864-47-lace"
+    # D: 65.0 MHz, H: 44.890 kHz, V: 94.80 Hz
+    geometry 1152 864 1152 864 8
+    timings 15385 80 88 44 30 128 9
+    laced true
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	1152x864, 60 Hz, Non-Interlaced (80.0 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1152		864
+#	Scan Frequency		54.945 kHz	59.98 Hz
+#	Sync Width		1.400 us	0.091 ms
+#				14 chars	5 lines
+#	Front Porch		0.800 us	0.109 ms
+#				8 chars		6 lines
+#	Back Porch		1.600 us	0.746 ms
+#				16 chars	41 lines
+#	Active Time		14.400 us	15.725 ms
+#				144 chars	864 lines
+#	Blank Time		3.800 us	0.946 ms
+#				38 chars	52 lines
+#	Polarity		positive	positive
+#
+
+mode "1152x864-60"
+    # D: 80.0 MHz, H: 54.945 kHz, V: 59.98 Hz
+    geometry 1152 864 1152 864 8
+    timings 12500 128 64 41 6 112 5
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	1152x864, 70 Hz, Non-Interlaced (100.0 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1152		864
+#	Scan Frequency		66.138 kHz	69.99 Hz
+#	Sync Width		1.520 us	0.166 ms
+#				19 chars	11 lines
+#	Front Porch		0.390 us	0.197 ms
+#				5 chars		13 lines
+#	Back Porch		1.690 us	0.862 ms
+#				21 chars	57 lines
+#	Active Time		11.520 us	13.064 ms
+#				144 chars	864 lines
+#	Blank Time		3.600 us	1.225 ms
+#				45 chars	81 lines
+#	Polarity		positive	positive
+#
+
+mode "1152x864-70"
+    # D: 100.0 MHz, H: 66.138 kHz, V: 69.99 Hz
+    geometry 1152 864 1152 864 8
+    timings 10000 168 40 57 13 152 11
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	1152x864, 75 Hz, Non-Interlaced (110.0 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1152		864
+#	Scan Frequency		75.137 kHz	74.99 Hz
+#	Sync Width		1.309 us	0.106 ms
+#				18 chars	8 lines
+#	Front Porch		0.245 us	0.599 ms
+#				3 chars		45 lines
+#	Back Porch		1.282 us	1.132 ms
+#				18 chars	85 lines
+#	Active Time		10.473 us	11.499 ms
+#				144 chars	864 lines
+#	Blank Time		2.836 us	1.837 ms
+#				39 chars	138 lines
+#	Polarity		positive	positive
+#
+
+mode "1152x864-75"
+    # D: 110.0 MHz, H: 75.137 kHz, V: 74.99 Hz
+    geometry 1152 864 1152 864 8
+    timings 9091 144 24 85 45 144 8
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	1152x864, 80 Hz, Non-Interlaced (110.0 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1152		864
+#	Scan Frequency		76.389 kHz	79.74 Hz
+#	Sync Width		1.018 us	0.092 ms
+#				14 chars	7 lines
+#	Front Porch		0.127 us	0.393 ms
+#				2 chars		30 lines
+#	Back Porch		1.473 us	0.747 ms
+#				20 chars	57 lines
+#	Active Time		10.473 us	11.311 ms
+#				144 chars	864 lines
+#	Blank Time		2.618 us	1.231 ms
+#				36 chars	94 lines
+#	Polarity		positive	positive
+#
+
+mode "1152x864-80"
+    # D: 110.0 MHz, H: 76.389 kHz, V: 79.74 Hz
+    geometry 1152 864 1152 864 8
+    timings 9091 160 16 57 30 112 7
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	1280x1024, 43 Hz, Interlaced (80.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1024		1024
+#	Scan Frequency		50.000 kHz	87.03 Hz
+#	Sync Width		1.000 us	0.100 ms
+#				10 chars	10 lines
+#	Front Porch		1.000 us	0.500 ms
+#				10 chars	50 lines
+#	Back Porch		2.000 us	0.650 ms
+#				20 chars	65 lines
+#	Active Time		16.000 us	10.240 ms
+#				160 chars	1024 lines
+#	Blank Time		4.000 us	1.250 ms
+#				40 chars	125 lines
+#	Polarity		positive	positive
+#
+
+mode "1280x1024-43-lace"
+    # D: 80.00 MHz, H: 50.000 kHz, V: 87.03 Hz
+    geometry 1024 1024 1024 1024 8
+    timings 12500 160 80 65 50 80 10
+    laced true
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	1280x1024, 47 Hz, Interlaced (80.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1280		1024
+#	Scan Frequency		50.000 kHz	94.97 Hz
+#	Sync Width		1.000 us	0.100 ms
+#				10 chars	10 lines
+#	Front Porch		1.000 us	0.010 ms
+#				10 chars	1 lines
+#	Back Porch		2.000 us	0.180 ms
+#				20 chars	18 lines
+#	Active Time		16.000 us	10.240 ms
+#				160 chars	1024 lines
+#	Blank Time		4.000 us	0.290 ms
+#				40 chars	29 lines
+#	Polarity		positive	positive
+#
+
+mode "1280x1024-47-lace"
+    # D: 80.00 MHz, H: 50.000 kHz, V: 94.97 Hz
+    geometry 1280 1024 1280 1024 8
+    timings 12500 160 80 18 1 80 10
+    laced true
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	1280x1024, 60 Hz, Non-Interlaced (108.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1280		1024
+#	Scan Frequency		63.981 kHz	60.02 Hz
+#	Sync Width		1.037 us	0.047 ms
+#				14 chars	3 lines
+#	Front Porch		0.444 us	0.015 ms
+#				6 chars		1 lines
+#	Back Porch		2.297 us	0.594 ms
+#				31 chars	38 lines
+#	Active Time		11.852 us	16.005 ms
+#				160 chars	1024 lines
+#	Blank Time		3.778 us	0.656 ms
+#				51 chars	42 lines
+#	Polarity		positive	positive
+#
+
+mode "1280x1024-60"
+    # D: 108.00 MHz, H: 63.981 kHz, V: 60.02 Hz
+    geometry 1280 1024 1280 1024 8
+    timings 9260 248 48 38 1 112 3
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	1280x1024, 70 Hz, Non-Interlaced (126.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1280		1024
+#	Scan Frequency		74.645 kHz	70.02 Hz
+#	Sync Width		0.889 us	0.067 ms
+#				14 chars	5 lines
+#	Front Porch		0.635 us	0.013 ms
+#				10 chars	1 lines
+#	Back Porch		1.714 us	0.483 ms
+#				27 chars	36 lines
+#	Active Time		10.159 us	13.718 ms
+#				160 chars	1024 lines
+#	Blank Time		3.238 us	0.563 ms
+#				51 chars	42 lines
+#	Polarity		positive	positive
+#
+
+mode "1280x1024-70"
+    # D: 126.00 MHz, H: 74.645 kHz, V: 70.02 Hz
+    geometry 1280 1024 1280 1024 8
+    timings 7937 216 80 36 1 112 5
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	1280x1024, 74 Hz, Non-Interlaced (135.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1280		1024
+#	Scan Frequency		78.855 kHz	74.11 Hz
+#	Sync Width		1.067 us	0.380 ms
+#				18 chars	30 lines
+#	Front Porch		0.237 us	0.000 ms
+#				4 chars		0 lines
+#	Back Porch		1.896 us	0.127 ms
+#				32 chars	10 lines
+#	Active Time		9.481 us	12.986 ms
+#				160 chars	1024 lines
+#	Blank Time		3.200 us	0.507 ms
+#				54 chars	40 lines
+#	Polarity		positive	positive
+#
+
+mode "1280x1024-74"
+    # D: 135.00 MHz, H: 78.855 kHz, V: 74.11 Hz
+    geometry 1280 1024 1280 1024 8
+    timings 7408 256 32 10 0 144 30
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	1280x1024, 75 Hz, Non-Interlaced (135.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1280		1024
+#	Scan Frequency		79.976 kHz	75.02 Hz
+#	Sync Width		1.067 us	0.038 ms
+#				18 chars	3 lines
+#	Front Porch		0.119 us	0.012 ms
+#				2 chars		1 lines
+#	Back Porch		1.837 us	0.475 ms
+#				31 chars	38 lines
+#	Active Time		9.481 us	12.804 ms
+#				160 chars	1024 lines
+#	Blank Time		3.022 us	0.525 ms
+#				51 chars	42 lines
+#	Polarity		positive	positive
+#
+
+mode "1280x1024-75"
+    # D: 135.00 MHz, H: 79.976 kHz, V: 75.02 Hz
+    geometry 1280 1024 1280 1024 8
+    timings 7408 248 16 38 1 144 3
+    hsync high
+    vsync high
+endmode
+ 
+#
+#	1600x1200, 60 Hz, Non-Interlaced (156.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1600		1200
+#	Scan Frequency		76.200 kHz	60.00 Hz
+#	Sync Width		1.026 us	0.105 ms
+#				20 chars	8 lines
+#	Front Porch		0.205 us	0.131 ms
+#				4 chars		10 lines
+#	Back Porch		1.636 us	0.682 ms
+#				32 chars	52 lines
+#	Active Time		10.256 us	15.748 ms
+#				200 chars	1200 lines
+#	Blank Time		2.872 us	0.866 ms
+#				56 chars	66 lines
+#	Polarity		negative	negative
+#
+
+mode "1600x1200-60"
+    # D: 156.00 MHz, H: 76.200 kHz, V: 60.00 Hz
+    geometry 1600 1200 1600 1200 8
+    timings 6411 256 32 52 10 160 8
+endmode
+ 
+#
+#	1600x1200, 66 Hz, Non-Interlaced (172.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1600		1200
+#	Scan Frequency		82.700 kHz	66.00 Hz
+#	Sync Width		0.791 us	0.036 ms
+#				17 chars	3 lines
+#	Front Porch		0.233 us	0.036 ms
+#				5 chars		3 lines
+#	Back Porch		1.767 us	0.567 ms
+#				38 chars	47 lines
+#	Active Time		9.302 us	14.512 ms
+#				200 chars	1200 lines
+#	Blank Time		2.791 us	0.532 ms
+#				60 chars	44 lines
+#	Polarity		negative	negative
+#
+
+mode "1600x1200-66"
+    # D: 172.00 MHz, H: 82.700 kHz, V: 66.00 Hz
+    geometry 1600 1200 1600 1200 8
+    timings 5814 304 40 47 3 136 3
+endmode
+ 
+#
+#	1600x1200, 76 Hz, Non-Interlaced (198.00 MHz dotclock)
+#	
+#				Horizontal	Vertical
+#	Resolution		1600		1200
+#	Scan Frequency		95.200 kHz	76.00 Hz
+#	Sync Width		0.687 us	0.052 ms
+#				17 chars	5 lines
+#	Front Porch		0.202 us	0.032 ms
+#				5 chars		3 lines
+#	Back Porch		1.535 us	0.441 ms
+#				38 chars	42 lines
+#	Active Time		8.081 us	12.606 ms
+#				200 chars	1200 lines
+#	Blank Time		2.424 us	0.525 ms
+#				60 chars	50 lines
+#	Polarity		negative	negative
+#
+
+mode "1600x1200-76"
+    # D: 198.00 MHz, H: 95.200 kHz, V: 76.00 Hz
+    geometry 1600 1200 1600 1200 8
+    timings 5051 304 40 42 3 136 5
+endmode
+
diff -urN lib/microwindows/src/contrib/jpeg/README.txt /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/jpeg/README.txt
--- lib/microwindows/src/contrib/jpeg/README.txt	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/jpeg/README.txt	2005-02-21 16:12:49.000000000 +0100
@@ -0,0 +1,25 @@
+To enable jpeg support in nanogui:
+
+- Download libjpeg source tarball at http://www.ijg.org
+- Untar the tarball with tar -zxf <tarball>
+
+In the jpeg directory, setup your compilation environment.
+Here are the typical steps for linux:
+
+- cp jconfig.doc jconfig.h
+- cp makefile.ansi Makefile
+- Open the Makefile and delete the jconfig.h: target
+- Don't forget to setup the right cc tools if you cross-compile!
+- type 'make'
+
+In the config file:
+
+- Enable the HAVE_JPEG_SUPPORT definition
+- set the INCJPEG to the jpeg directory
+- set the LIBJPEG to the jpeg directory
+- compile the project
+
+See demo3 if you want to see an example demo.
+
+Martin Jolcoeur
+martinj@visuaide.com
diff -urN lib/microwindows/src/contrib/ntimers.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/ntimers.c
--- lib/microwindows/src/contrib/ntimers.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/ntimers.c	2005-02-21 16:02:49.000000000 +0100
@@ -0,0 +1,29 @@
+
+void
+GsAddTimer(struct GsTimer* newtimer) {
+    int i;
+    struct GsTimer* curTimer;
+    if(our_timers.numof++>0) {
+	curTimer=our_timer->head;
+	for(curTimer=our_timer->head;curTimer!=NULL;curTimer=curTimer->next) {
+	    if(curTimer->due>newtimer->due) { /* time to file it away... */
+		if(our_timer->head==curTimer) { /* put it at the beginning... */
+		    newtimer->next=our_timer->head;
+		    our_timer->head=newtimer;
+		    return;
+		} /* else put it in the middle... */
+		newtimer->next=curTimer;
+		prevTimer->next=newtimer;
+		return;
+	    }
+	    prevTimer=curTimer;
+	} /* else put it at the end... */
+	our_timer->tail->next=newtimer;
+	our_timer->tail=newtimer;
+	newtimer->next=NULL;
+	return;
+    } /* else... hey it's the first timer! */
+    our_timer->head=newtimer;
+    our_timer->tail=newtimer;
+    newtimer->next=NULL;    
+}
diff -urN lib/microwindows/src/contrib/ntimers.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/ntimers.h
--- lib/microwindows/src/contrib/ntimers.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/ntimers.h	2005-02-21 16:02:49.000000000 +0100
@@ -0,0 +1,19 @@
+#ifndef __NTIMER_H__
+#define __NTIMER_H__
+
+struct GsTimer {
+    struct GsTimer* next;
+    long due;
+    void* some_func;
+    void* some_args;
+};
+
+struct GsTimerHolder {
+    struct GsTimer* head;
+    struct GsTimer* tail;
+    int numof;
+};
+
+
+
+#endif
diff -urN lib/microwindows/src/contrib/pacific/mwin-pcn.prj /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/pacific/mwin-pcn.prj
--- lib/microwindows/src/contrib/pacific/mwin-pcn.prj	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/pacific/mwin-pcn.prj	2005-02-21 16:02:48.000000000 +0100
@@ -0,0 +1,105 @@
+;Project file: C:\DEVELOP\MICROWIN\SRC\MWIN-PCN.PRJ for Pacific C MS-DOS V7.51
+
+List: Object Files	Abs Auto
+Entry: $(LIB)\RT86--DL.OBJ
+Endlist:
+
+List: CPP Include Paths	Abs Auto
+Entry: c:\develop\microwin\src\include
+Entry: $(INC)
+Endlist:
+
+List: CPP Pre-defined Symbols	Abs Auto
+Entry: -DDOS
+Entry: -D_HOSTED
+Entry: -Di8086
+Entry: -D__PACIFIC__
+Entry: -DHI_TECH_C
+Entry: -DLARGE_CODE
+Entry: -SP4,4,4,4,4,4,4
+Entry: -S1,2,2,4,4,8
+Entry: -DLARGE_DATA
+Entry: -DLARGE_MODEL
+Entry: -DERASEMOVE=1
+Entry: -DMSDOS=1
+Entry: -DNONETWORK=1
+Endlist:
+
+List: Source Files	Abs Auto
+Entry: C:\DEVELOP\MICROWIN\SRC\DEMOS\NANOX\DEMO.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\KBD_PAC.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\MOU_DOS.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\INT10_PC.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\ROMFONT.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\SCR_BIOS.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\VGAPLAN4.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVCLIP.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVDRAW.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVKBD.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVMOUSE.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL1.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL2.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL4.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL8.C
+Entry: C:\DEVELOP\MICROWIN\SRC\NANOX\SRVMAIN.C
+Entry: C:\DEVELOP\MICROWIN\SRC\NANOX\SRVFUNC.C
+Entry: C:\DEVELOP\MICROWIN\SRC\NANOX\SRVUTIL.C
+Entry: C:\DEVELOP\MICROWIN\SRC\NANOX\SRVEVENT.C
+Entry: C:\DEVELOP\MICROWIN\SRC\NANOX\STUBS.C
+Endlist:
+
+List: Libraries	Abs Auto
+Entry: $(LIB)\86--DLF.LIB
+Entry: $(LIB)\86--DLC.LIB
+Endlist:
+
+List: Linker options	Abs Auto
+Entry: -lm
+Entry: -p_TEXT,text,CODE=0/,LDATA=0/,LBSS=0/,NVRAM=0/,data=0/,bss,stack=0/
+Endlist:
+
+List: Objtohex options	Abs Auto
+Entry: -lDos_hdr
+Entry: -E02048h
+Endlist:
+
+
+Int: OuputFormat: 0
+Int: Warnlevel: 0
+Int: IdLength: 31
+Int: DebugBaud: 0
+Int: ComPort: 0
+Int: GlobOptLevel: 1
+Int: Rom_addr: 1015808
+Int: Init_addr: 1048560
+Int: Bss_addr: 256
+Int: Bss_size: 32512
+Int: Nvram_addr: 32768
+Int: Modelno: 1
+Int: Chiptype: 1
+Int: Heapsize: 8264
+Int: Falign: 0
+Int: Jalign: 0
+Int: Lalign: 0
+
+Bool: Globopt: 0
+Bool: Postopt: 0
+Bool: Assemopt: 0
+Bool: Symbolic_debug: 1
+Bool: Nolocal: 0
+Bool: Usefloat: 1
+Bool: Autoload: 0
+Bool: Cppasm: 0
+Bool: Genlist: 0
+Bool: GenSrclist: 0
+Bool: Gotadrs: 1
+Bool: Multirom: 0
+Bool: Stopwarn: 0
+Bool: Hardfloat: 0
+Bool: Wildcards: 0
+Bool: I80188eb: 0
+Bool: V25: 0
+
+String: Outfile:C:\DEVELOP\MICROWIN\SRC\MWIN-PCN.EXE
+String: Mapfile:
+String: Symfile:
diff -urN lib/microwindows/src/contrib/pacific/mwin-pct.prj /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/pacific/mwin-pct.prj
--- lib/microwindows/src/contrib/pacific/mwin-pct.prj	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/pacific/mwin-pct.prj	2005-02-21 16:02:48.000000000 +0100
@@ -0,0 +1,97 @@
+;Project file: C:\DEVELOP\MICROWIN\SRC\MWIN-PCT.PRJ for Pacific C MS-DOS V7.51
+
+List: Object Files	Abs Auto
+Entry: $(LIB)\RT86--DL.OBJ
+Endlist:
+
+List: CPP Include Paths	Abs Auto
+Entry: c:\develop\microwin\src\include
+Entry: $(INC)
+Endlist:
+
+List: CPP Pre-defined Symbols	Abs Auto
+Entry: -DDOS
+Entry: -D_HOSTED
+Entry: -Di8086
+Entry: -D__PACIFIC__
+Entry: -DHI_TECH_C
+Entry: -DLARGE_CODE
+Entry: -SP4,4,4,4,4,4,4
+Entry: -S1,2,2,4,4,8
+Entry: -DLARGE_DATA
+Entry: -DLARGE_MODEL
+Entry: -DERASEMOVE=1
+Entry: -DMSDOS=1
+Endlist:
+
+List: Source Files	Abs Auto
+Entry: C:\DEVELOP\MICROWIN\SRC\DEMOS\TEST\TEST.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\KBD_PAC.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\MOU_DOS.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\INT10_PC.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\ROMFONT.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\SCR_BIOS.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\VGAPLAN4.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVCLIP.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVDRAW.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVKBD.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVMOUSE.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL1.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL2.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL4.C
+Endlist:
+
+List: Libraries	Abs Auto
+Entry: $(LIB)\86--DLC.LIB
+Endlist:
+
+List: Linker options	Abs Auto
+Entry: -lm
+Entry: -p_TEXT,text,CODE=0/,LDATA=0/,LBSS=0/,NVRAM=0/,data=0/,bss,stack=0/
+Endlist:
+
+List: Objtohex options	Abs Auto
+Entry: -lDos_hdr
+Entry: -E02048h
+Endlist:
+
+
+Int: OuputFormat: 0
+Int: Warnlevel: 20
+Int: IdLength: 31
+Int: DebugBaud: 0
+Int: ComPort: 0
+Int: GlobOptLevel: 1
+Int: Rom_addr: 1015808
+Int: Init_addr: 1048560
+Int: Bss_addr: 256
+Int: Bss_size: 32512
+Int: Nvram_addr: 32768
+Int: Modelno: 1
+Int: Chiptype: 1
+Int: Heapsize: 8264
+Int: Falign: 0
+Int: Jalign: 0
+Int: Lalign: 0
+
+Bool: Globopt: 0
+Bool: Postopt: 0
+Bool: Assemopt: 0
+Bool: Symbolic_debug: 1
+Bool: Nolocal: 0
+Bool: Usefloat: 0
+Bool: Autoload: 0
+Bool: Cppasm: 0
+Bool: Genlist: 0
+Bool: GenSrclist: 0
+Bool: Gotadrs: 1
+Bool: Multirom: 0
+Bool: Stopwarn: 0
+Bool: Hardfloat: 0
+Bool: Wildcards: 0
+Bool: I80188eb: 0
+Bool: V25: 0
+
+String: Outfile:C:\DEVELOP\MICROWIN\SRC\MWIN-PCT.EXE
+String: Mapfile:
+String: Symfile:
diff -urN lib/microwindows/src/contrib/pacific/mwin-pcw.prj /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/pacific/mwin-pcw.prj
--- lib/microwindows/src/contrib/pacific/mwin-pcw.prj	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/pacific/mwin-pcw.prj	2005-02-21 16:02:48.000000000 +0100
@@ -0,0 +1,113 @@
+;Project file: MWIN-PCW.PRJ for Pacific C MS-DOS V7.51
+
+List: Object Files	Abs Auto
+Entry: $(LIB)\RT86--DL.OBJ
+Endlist:
+
+List: CPP Include Paths	Abs Auto
+Entry: c:\develop\microwin\src\include
+Entry: $(INC)
+Endlist:
+
+List: CPP Pre-defined Symbols	Abs Auto
+Entry: -DDOS
+Entry: -D_HOSTED
+Entry: -Di8086
+Entry: -D__PACIFIC__
+Entry: -DHI_TECH_C
+Entry: -DLARGE_CODE
+Entry: -SP4,4,4,4,4,4,4
+Entry: -S1,2,2,4,4,8
+Entry: -DLARGE_DATA
+Entry: -DLARGE_MODEL
+Entry: -DERASEMOVE=1
+Entry: -DMSDOS=1
+Endlist:
+
+List: Source Files	Abs Auto
+Entry: C:\DEVELOP\MICROWIN\SRC\DEMOS\MWIN\DEMO.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\KBD_PAC.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\MOU_DOS.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\INT10_PC.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\ROMFONT.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\SCR_BIOS.C
+Entry: C:\DEVELOP\MICROWIN\SRC\DRIVERS\VGAPLAN4.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVCLIP.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVDRAW.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVKBD.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVMOUSE.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL1.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL2.C
+Entry: C:\DEVELOP\MICROWIN\SRC\ENGINE\DEVPAL4.C
+Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINMAIN.C
+Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINUSER.C
+Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINGDI.C
+Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINEXPOS.C
+Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINCLIP.C
+Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINEVENT.C
+Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINDEFW.C
+Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\LIST.C
+Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINLIB\DRAW3D.C
+Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINLIB\FASTFILL.C
+Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINLIB\GRAPH3D.C
+Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINLIB\INSETR.C
+Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINLIB\PTINSID.C
+Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\WINLIB\BUTTON.C
+Entry: C:\DEVELOP\MICROWIN\SRC\MWIN\BMP\CS1.C
+Endlist:
+
+List: Libraries	Abs Auto
+Entry: $(LIB)\86--DLF.LIB
+Entry: $(LIB)\86--DLC.LIB
+Endlist:
+
+List: Linker options	Abs Auto
+Entry: -lm
+Entry: -p_TEXT,text,CODE=0/,LDATA=0/,LBSS=0/,NVRAM=0/,data=0/,bss,stack=0/
+Endlist:
+
+List: Objtohex options	Abs Auto
+Entry: -lDos_hdr
+Entry: -E02048h
+Endlist:
+
+
+Int: OuputFormat: 0
+Int: Warnlevel: 0
+Int: IdLength: 31
+Int: DebugBaud: 0
+Int: ComPort: 0
+Int: GlobOptLevel: 1
+Int: Rom_addr: 1015808
+Int: Init_addr: 1048560
+Int: Bss_addr: 256
+Int: Bss_size: 32512
+Int: Nvram_addr: 32768
+Int: Modelno: 1
+Int: Chiptype: 1
+Int: Heapsize: 8264
+Int: Falign: 0
+Int: Jalign: 0
+Int: Lalign: 0
+
+Bool: Globopt: 0
+Bool: Postopt: 0
+Bool: Assemopt: 0
+Bool: Symbolic_debug: 1
+Bool: Nolocal: 0
+Bool: Usefloat: 1
+Bool: Autoload: 0
+Bool: Cppasm: 0
+Bool: Genlist: 0
+Bool: GenSrclist: 0
+Bool: Gotadrs: 1
+Bool: Multirom: 0
+Bool: Stopwarn: 0
+Bool: Hardfloat: 0
+Bool: Wildcards: 0
+Bool: I80188eb: 0
+Bool: V25: 0
+
+String: Outfile:C:\DEVELOP\MICROWIN\SRC\MWIN-PCW.EXE
+String: Mapfile:
+String: Symfile:
diff -urN lib/microwindows/src/contrib/pacific/readme.pc /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/pacific/readme.pc
--- lib/microwindows/src/contrib/pacific/readme.pc	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/pacific/readme.pc	2005-02-21 16:02:48.000000000 +0100
@@ -0,0 +1,41 @@
+For compile Microwindows for DOS & PACIFIC C you should have the following:
+=====================================================================
+1. Microwin 0.87 pre6     - microwindows.censoft.com
+2. PACIFIC C ver. 7.51    - www.hitech.com or www.freedos.org
+            
+You should do the following:
+----------------------------
+
+- EDIT files *.prj to correct paths
+- copy microwin\src\contrib\pacific\mwin-pct.prj microwin\src\mwin-pct.prj
+- copy microwin\src\contrib\pacific\mwin-pcw.prj microwin\src\mwin-pcw.prj
+- copy microwin\src\contrib\pacific\mwin-pcn.prj microwin\src\mwin-pcn.prj
+
+- you should check the next:
+	options | memory model.. | memory model = (*) Large L
+	options | heap size | = 2048
+	options | output file type | (*) MS-DOS Executable Type
+	make | CPP predifined symbols | -DERASEMOVE=1 -DMSDOS=1 -DNONETWORK=1
+	make | CPP include paths | c:\develop\microwin\src\include
+
+RUN ppd, load project and compile !
+
+=====================================================================
+
+For NANOXDEMO use -DNONETWORK=1
+
+- mwin-pct.prj = test demo
+- mwin-pcw.prj = mwin demo
+- mwin-pcn.prj = nanox demo
+
+! NOT all demos have been tested.
+
+=====================================================================
+TO COMPILE with PACIFIC C :
+
+You === SHOULD == check to include header's files only ONE time.
+PACIFIC C doesn't check it. 
+If you do include, PACIFIC C may gives quite strange errors.
+
+=====================================================================
+Victor Rogachev <rogach@sut.ru>
diff -urN lib/microwindows/src/contrib/ptyfix2.txt /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/ptyfix2.txt
--- lib/microwindows/src/contrib/ptyfix2.txt	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/ptyfix2.txt	2005-02-21 16:12:50.000000000 +0100
@@ -0,0 +1,86 @@
+
+--- demos/microwin/mterm.c.old Fri Dec  3 07:03:39 1999
++++ demos/microwin/mterm.c Fri Dec  3 07:16:23 1999
+@@ -248,15 +248,16 @@
+  char * argv[2];
+ 
+ again:
+- sprintf(pty_name, "/dev/ptyp%d", n);
+- if ((tfd = open(pty_name, O_RDWR | O_NONBLOCK)) < 0) {
+- if ((errno == EBUSY) && (n < 3)) {
+- ++n;
+- goto again;
+- }
+- fprintf(stderr, "Can't create pty %s\n", pty_name);
++        if ((tfd = getpt())<0) {
++ fprintf(stderr, "Can't create master pty\n");
+  return -1;
+  }
++
++        if (grantpt(tfd)) 
++                perror("failure");
++        if (unlockpt(tfd)) 
++                perror("failure");
++
+  signal(SIGCHLD, ptysignaled);
+  signal(SIGINT, ptysignaled);
+  if ((pid = fork()) == -1) {
+@@ -264,13 +265,13 @@
+  return -1;
+  }
+  if (!pid) {
++                ptsname_r(tfd, pty_name, 12);
+  close(STDIN_FILENO);
+  close(STDOUT_FILENO);
+  close(STDERR_FILENO);
+  close(tfd);
+  
+  setsid();
+- pty_name[5] = 't';
+  if ((tfd = open(pty_name, O_RDWR)) < 0) {
+  fprintf(stderr, "Child: Can't open pty %s\n", pty_name);
+  exit(1);
+--- demos/nanox/nterm.c.old Fri Dec  3 07:03:39 1999
++++ demos/nanox/nterm.c Fri Dec  3 07:16:20 1999
+@@ -162,15 +162,16 @@
+  pid_t pid;
+ 
+ again:
+- sprintf(pty_name, "/dev/ptyp%d", n);
+- if ((tfd = open(pty_name, O_RDWR | O_NONBLOCK)) < 0) {
+- if ((errno == EBUSY || errno == EIO) && n < 10) {
+- n++;
+- goto again;
+- }
+- fprintf(stderr, "Can't create pty %s\n", pty_name);
++        if ((tfd = getpt())<0) {
++ fprintf(stderr, "Can't create master pty\n");
+  return -1;
+  }
++
++        if (grantpt(tfd)) 
++                perror("failure");
++        if (unlockpt(tfd)) 
++                perror("failure");
++
+  signal(SIGCHLD, sigchild);
+  signal(SIGINT, sigchild);
+  if ((pid = fork()) == -1) {
+@@ -178,13 +179,13 @@
+  return -1;
+  }
+  if (!pid) {
++                ptsname_r(tfd, pty_name, 12);
+  close(STDIN_FILENO);
+  close(STDOUT_FILENO);
+  close(STDERR_FILENO);
+  close(tfd);
+  
+  setsid();
+- pty_name[5] = 't';
+  if ((tfd = open(pty_name, O_RDWR)) < 0) {
+  fprintf(stderr, "Child: Can't open pty %s\n", pty_name);
+  exit(1);
+
+
+-- 
\ No newline at end of file
diff -urN lib/microwindows/src/contrib/readme.tc /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/readme.tc
--- lib/microwindows/src/contrib/readme.tc	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/readme.tc	2005-02-21 16:12:50.000000000 +0100
@@ -0,0 +1,102 @@
+For compile Microwindows for DOS & TURBO C 
+you should have the following:
+====================================================
+1. Microwin 0.87  - microwindows.censoft.com
+2. Turbo C++ ver. 1.0 or Borland C ver. 3.1 
+      
+      
+You should do the following:
+----------------------------
+
+- copy mwin-tcn.prj to microwin\src\
+- copy mwin-tcw.prj to microwin\src\
+
+- run tc or bc IDE
+- load the project
+
+
+You should check the next:
+-------------------------
+
+- correct paths
+- settings defines in : 
+	options | compiler | code generation - defines :
+
+	ERASEMOVE=1;
+	MSDOS=1;
+	DOS_TURBOC=1;
+      
+  
+MAKE !
+====================================================
+
+- mwin-pcw.prj = mwin demo
+- mwin-pcn.prj = nanox demo
+
+For nanox add next defines:
+	NONETWORK=1;
+	SCREEN_PIXTYPE=PF_PALETTE;
+
+
+! NOT all demos have been tested.
+====================================================
+
+The project for mwin demo must have next files:
+
+\DEMOS\MWIN\DEMO.C
+\DRIVERS\GENFONT.C
+\DRIVERS\KBD_TC.C
+\DRIVERS\MOU_DOS.C
+\DRIVERS\SCR_TC.C
+\FONTS\ROM8X16.C
+\FONTS\ROM8X8.C
+\FONTS\WINFRE~1.C
+\FONTS\WINFRE~2.C
+\ENGINE\DEVCLIP.C
+\ENGINE\DEVDRAW.C
+\ENGINE\DEVKBD.C
+\ENGINE\DEVMOUSE.C
+\ENGINE\DEVPAL1.C
+\ENGINE\DEVPAL2.C
+\ENGINE\DEVPAL4.C
+\MWIN\WINCLIP.C
+\MWIN\WINDEFW.C
+\MWIN\WINEVENT.C
+\MWIN\WINEXPOS.C
+\MWIN\WINMAIN.C
+\MWIN\WINUSER.C
+\MWIN\WINGDI.C
+\MWIN\LIST.C
+\MWIN\WINLIB\BUTTON.C
+\MWIN\WINLIB\DRAW3D.C
+\MWIN\WINLIB\FASTFILL.C
+\MWIN\WINLIB\GRAPH3D.C
+\MWIN\WINLIB\INSETR.C
+\MWIN\WINLIB\PTINSID.C
+\MWIN\BMP\CS1.C
+
+The project for nanox demo must have next files:
+
+\DEMOS\NANOX\DEMO.C
+\DRIVERS\GENFONT.C
+\DRIVERS\KBD_TC.C
+\DRIVERS\MOU_DOS.C
+\DRIVERS\SCR_TC.C
+\FONTS\ROM8X16.C
+\FONTS\ROM8X8.C
+\FONTS\WINFRE~1.C
+\ENGINE\DEVCLIP.C
+\ENGINE\DEVDRAW.C
+\ENGINE\DEVKBD.C
+\ENGINE\DEVMOUSE.C
+\ENGINE\DEVPAL1.C
+\ENGINE\DEVPAL2.C
+\ENGINE\DEVPAL4.C
+\NANOX\SRVEVENT.C
+\NANOX\SRVFUNC.C
+\NANOX\SRVMAIN.C
+\NANOX\SRVUTIL.C
+\NANOX\STUBS.C
+
+====================================================
+Victor Rogachev <rogach@sut.ru>
diff -urN lib/microwindows/src/contrib/speedtst/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/speedtst/Makefile
--- lib/microwindows/src/contrib/speedtst/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/speedtst/Makefile	2005-02-21 16:02:48.000000000 +0100
@@ -0,0 +1,18 @@
+CC = gcc
+
+all: speed xspeed
+
+speed.o : speed.c
+	$(CC) -DX11=1 -c $<
+
+speed: speed.o
+	$(CC) -DX11=1 $< -o $@ \
+		-lnano-X -lmwengine -lmwfonts -lmwdrivers \
+		-L/usr/X11R6/lib -lX11
+
+xspeed.o : speed.c
+	$(CC) -DTEST_FOR_X=1 -c $< -o $@
+
+xspeed: xspeed.o
+	$(CC) -DTEST_FOR_X=1 $< -o $@ \
+		-L/usr/X11R6/lib -lX11
diff -urN lib/microwindows/src/contrib/speedtst/speed.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/speedtst/speed.c
--- lib/microwindows/src/contrib/speedtst/speed.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/contrib/speedtst/speed.c	2005-02-21 16:12:49.000000000 +0100
@@ -0,0 +1,292 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+#ifdef TEST_FOR_X
+#include <X11/Xlib.h>
+#else
+#define MWINCLUDECOLORS
+#include <microwin/nano-X.h>
+#endif
+
+#define NUM_POINTS	80
+
+time_t start_time, end_time;
+
+void start_timer()
+{
+	time(&start_time);
+}
+
+void end_timer()
+{
+	time(&end_time);
+	printf("start=%lu, end=%lu, time=%lu\n", 
+		start_time, end_time, end_time-start_time);
+}
+	
+int main()
+{
+#ifdef TEST_FOR_X
+	Display		*display;
+	Window		window;
+	GC		gc;
+	XGCValues	gcValues;
+	Colormap	colormap;
+	Pixmap		src_pixmap;
+	unsigned long	fgColor, bgColor;
+	int		screenNum;
+	XPoint		points[NUM_POINTS];
+#else
+	GR_WINDOW_ID 	window;
+	GR_WINDOW_ID	src_pixmap;
+	unsigned char*	src_pixmap_buf[320*240*2];
+	GR_GC_ID        gc;
+	GR_POINT	points[NUM_POINTS];
+#endif
+	
+	int		c, c1,  count=4500;
+	int		x, y, x1, y1, x2, y2;
+
+#ifdef TEST_FOR_X
+	if(!(display=XOpenDisplay(""))) {
+		printf("Cannot connect to X.\n");
+	}
+	screenNum = DefaultScreen(display);
+	colormap = DefaultColormap(display, screenNum);
+
+	bgColor = BlackPixel(display, screenNum);
+	fgColor = WhitePixel(display, screenNum);
+	window = XCreateSimpleWindow(display, RootWindow(display, screenNum),
+		0, 0 , 639, 479, 0,
+		fgColor, bgColor);
+	src_pixmap = XCreatePixmap(display, window, 320, 240, 16);
+	XMapRaised(display, window);
+	gcValues.background = bgColor;
+	gcValues.foreground = fgColor;
+	gcValues.line_width = 1;
+	gcValues.line_style = LineSolid;
+	gcValues.fill_style = FillSolid;
+	gcValues.fill_rule = WindingRule;
+	gcValues.arc_mode = ArcPieSlice;
+	gc = XCreateGC(display, window,
+		GCForeground  | GCBackground | GCLineWidth | GCLineStyle |
+		GCFillStyle,
+		&gcValues);
+
+#else	
+	GrOpen();
+	window = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, 639, 479, 0, BLACK, BLUE);
+	src_pixmap = GrNewPixmap(640, 480, src_pixmap_buf);
+	GrMapWindow(window);
+	gc = GrNewGC();
+        GrSetGCForeground(gc, WHITE);
+	GrSetGCBackground(gc, BLACK);
+	GrSetGCMode(gc, GR_MODE_SET);
+#endif
+
+
+
+
+	
+	// Horizontal Line
+	////////////////////////////////////////////////
+	printf("Horizontal Line(XDrawLine)\n");
+	start_timer();
+	for(c=0; c<count*20; c++)
+	{
+		y1=random()%480;
+#ifdef TEST_FOR_X
+		XDrawLine(display, window, gc, 0, y1, 639, y1);
+		XFlush(display);
+#else
+		GrLine(window, gc, 0, y1, 639, y1);
+		GrFlush();
+#endif
+	}
+	end_timer();
+#ifdef TEST_FOR_X
+	XClearWindow(display, window);
+#else
+	GrClearWindow(window, GR_TRUE);
+#endif
+	
+	// Vertical Line
+	/////////////////////////////////////////////////
+	printf("Vertical Line(XDrawLine)\n");
+	start_timer();
+	for(c=0; c<count*19; c++)
+	{
+		x1=random()%640;
+#ifdef TEST_FOR_X
+		XDrawLine(display, window, gc, x1, 0, x1, 479);
+		XFlush(display);
+#else
+		GrLine(window, gc, x1, 0, x1, 479);
+		GrFlush();
+#endif
+	}
+	end_timer();
+#ifdef TEST_FOR_X
+	XClearWindow(display, window);
+#else
+	GrClearWindow(window, GR_TRUE);
+#endif
+
+	// General Line
+	/////////////////////////////////////////////////
+	printf("General Line(XDrawLine)\n");
+	start_timer();
+	for(c=0; c<count*22; c++)
+	{
+		x1 = random()%640;
+		x2 = random()%640;
+		y1 = random()%480;
+		y2 = random()%480;
+#ifdef TEST_FOR_X
+		XDrawLine(display, window, gc, x1, y1, x2, y2);
+		XFlush(display);
+#else
+		GrLine(window, gc, x1, y1, x2, y2);
+		GrFlush();
+#endif
+	}
+	end_timer();
+#ifdef TEST_FOR_X
+	XClearWindow(display, window);
+#else
+	GrClearWindow(window, GR_TRUE);
+#endif
+
+	// Point
+	//////////////////////////////////////////////////
+	printf("XPoint\n");
+	start_timer();
+	for(c=0; c<count*25; c++)
+	{
+		x1 = random()%640;
+		y1 = random()%480;
+#ifdef TEST_FOR_X
+		XDrawPoint(display, window, gc, x1, y1);
+		XFlush(display);
+#else
+		GrPoint(window, gc, x1, y1);
+		GrFlush();
+#endif
+	}
+	end_timer();
+#ifdef TEST_FOR_X
+	XClearWindow(display, window);
+#else
+	GrClearWindow(window, GR_TRUE);
+#endif
+
+	// Rectangle
+	//////////////////////////////////////////////////
+	printf("XRectangle\n");
+	start_timer();
+	for(c=0; c<count*20; c++)
+	{
+		x1=random()%639;
+		y1=random()%479;
+		x2=random()%(639-x1)+1;
+		y2=random()%(479-y1)+1;
+#ifdef TEST_FOR_X
+		XDrawRectangle(display, window, gc, x1, y1, x2, y2);
+		XFlush(display);
+#else
+		GrRect(window, gc, x1, y1, x2, y2);
+		GrFlush();
+#endif
+	}
+	end_timer();
+#ifdef TEST_FOR_X
+	XClearWindow(display, window);
+#else
+	GrClearWindow(window, GR_TRUE);
+#endif
+
+	// FillRectangle
+	//////////////////////////////////////////////////
+	printf("XFillRectangle\n");
+	start_timer();
+	for(c=0; c<count*18; c++)
+	{
+		x1=random()%639;
+		y1=random()%479;
+		x2=random()%(639-x1)+1;
+		y2=random()%(479-y1)+1;	
+#ifdef TEST_FOR_X
+		XFillRectangle(display, window, gc, x1, y1, x2, y2);
+		XFlush(display);
+#else
+		GrFillRect(window, gc, x1, y1, x2, y2);
+		GrFlush();
+#endif
+	}
+	end_timer();
+#ifdef TEST_FOR_X
+
+	XClearWindow(display, window);
+#else
+	GrClearWindow(window, GR_TRUE);
+#endif
+
+	// FillPolygon
+	//////////////////////////////////////////////////
+	printf("XFillPolygon\n");
+	start_timer();
+	for(c=0; c<count; c++)
+	{
+		for(c1=0; c1<NUM_POINTS; c1++)
+		{
+			points[c1].x = random()%640;
+			points[c1].y = random()%480;
+		}	
+#ifdef TEST_FOR_X
+		XFillPolygon(display, window, gc, points, NUM_POINTS,
+			0, 0);
+		XFlush(display);
+#else
+		GrFillPoly(window, gc, NUM_POINTS, points);
+		GrFlush();
+#endif
+	}
+	end_timer();
+#ifdef TEST_FOR_X
+	XClearWindow(display, window);
+#else
+	GrClearWindow(window, GR_TRUE);
+#endif
+
+
+	// CopyArea
+	/////////////////////////////////////////////////
+	printf("XCopyArea\n");
+	start_timer();
+	for(c=0; c<count*5; c++)
+	{
+		x1=random()%320;
+		y1=random()%240;
+		x2=random()%319+1;
+		y2=random()%239+1;
+		
+#ifdef TEST_FOR_X
+		XCopyArea(display, src_pixmap, window, gc,
+			0, 0, x2, y2, x1, y1);
+		XFlush(display);
+#else
+		GrCopyArea(window, gc, x1, y1, x2 ,y2, src_pixmap,
+			0, 0, 0);
+		GrFlush();
+#endif
+	}
+	end_timer();	
+
+#ifdef TEST_FOR_X
+	XDestroyWindow(display, window);
+#else
+	GrClose();
+#endif
+}
+
diff -urN lib/microwindows/src/demo.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demo.sh
--- lib/microwindows/src/demo.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demo.sh	2005-02-21 16:13:39.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X & bin/nanowm & bin/landmine
diff -urN lib/microwindows/src/demo2.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demo2.sh
--- lib/microwindows/src/demo2.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demo2.sh	2005-02-21 16:13:39.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X -p & bin/demo2; sleep 10000
diff -urN lib/microwindows/src/demo22.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demo22.sh
--- lib/microwindows/src/demo22.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demo22.sh	2005-02-21 16:13:42.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X & bin/nanowm & bin/demo2 & bin/demo2 & sleep 10000
diff -urN lib/microwindows/src/demo4.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demo4.sh
--- lib/microwindows/src/demo4.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demo4.sh	2005-02-21 16:13:42.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X -e & bin/nxterm & bin/nanowm & sleep 10000
diff -urN lib/microwindows/src/demos/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/Makefile
--- lib/microwindows/src/demos/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/Makefile	2005-02-21 16:13:03.000000000 +0100
@@ -0,0 +1,35 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME =
+
+# List of objects to compile
+OBJS =
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
diff -urN lib/microwindows/src/demos/mwin/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/Makefile
--- lib/microwindows/src/demos/mwin/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/Makefile	2005-02-21 16:02:50.000000000 +0100
@@ -0,0 +1,77 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(MICROWIN), Y)
+ifeq ($(MICROWINDEMO), Y)
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME =
+
+# List of objects to compile
+OBJS =	mdemo.o mterm.o malpha.o mtest.o mine.o mtest2.o
+MINEIMAGES = mineflag.o mineface.o minefacelost.o minebomb.o minedone.o\
+	minehitfalse.o
+
+DEMOS = $(TOP)/bin/mdemo\
+	$(TOP)/bin/mterm\
+	$(TOP)/bin/malpha\
+	$(TOP)/bin/mtest\
+	$(TOP)/bin/mtest2\
+	$(TOP)/bin/mine
+
+ifneq ($(ARCH), ELKS)
+DEMOS += $(TOP)/bin/muserfd
+endif
+
+all: default $(DEMOS)
+
+endif
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
+$(TOP)/bin/mdemo: mdemo.o $(MWINLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) mdemo.o -o $@ $(CCMWINLIBS)
+
+$(TOP)/bin/mterm: mterm.o $(MWINLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) mterm.o -o $@ $(CCMWINLIBS)
+
+$(TOP)/bin/malpha: malpha.o $(MWINLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) malpha.o -o $@ $(CCMWINLIBS)
+
+$(TOP)/bin/mtest: mtest.o $(MWINLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) mtest.o -o $@ $(CCMWINLIBS)
+
+$(TOP)/bin/mtest2: mtest2.o $(MWINLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) mtest2.o -o $@ $(CCMWINLIBS)
+
+$(TOP)/bin/mine: mine.o $(MINEIMAGES) $(MWINLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) mine.o $(MINEIMAGES) -o $@ $(CCMWINLIBS)
+
+$(TOP)/bin/muserfd: muserfd.o $(MWINLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) muserfd.o -o $@ $(CCMWINLIBS)
+
diff -urN lib/microwindows/src/demos/mwin/malpha.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/malpha.c
--- lib/microwindows/src/demos/mwin/malpha.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/malpha.c	2005-02-21 16:02:50.000000000 +0100
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Microwindows alpha blending demo
+ *
+ * This demo requires UPDATEREGIONS=N in microwin/src/config
+ */
+#include "windows.h"
+#include "wintern.h"		/* for MwSetDesktopWallpaper*/
+#include "wintools.h"
+
+extern MWIMAGEHDR image_car8;
+
+#define APPCLASS	"test"
+
+/* forward decls*/
+LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wp,LPARAM lp);
+LRESULT CALLBACK ChildWndProc(HWND hwnd,UINT uMsg,WPARAM wp,LPARAM lp);
+
+int
+RegisterAppClass(void)
+{
+	WNDCLASS	wc;
+
+	wc.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW;
+	wc.lpfnWndProc = (WNDPROC)WndProc;
+	wc.cbClsExtra = 0;
+	wc.cbWndExtra = 0;
+	wc.hInstance = 0;
+	wc.hIcon = 0; /*LoadIcon(GetHInstance(), MAKEINTRESOURCE( 1));*/
+	wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
+	wc.lpszMenuName = NULL;
+	wc.lpszClassName =  APPCLASS;
+	RegisterClass( &wc);
+
+	return 1;
+}
+
+HWND
+CreateAppWindow(void)
+{
+	HWND	hwnd;
+	int 	width, height;
+	RECT 	r;
+	static int nextid = 0;
+
+	GetWindowRect(GetDesktopWindow(), &r);
+	width = height = r.right / 2;
+
+	hwnd = CreateWindowEx(WS_EX_LAYERED, APPCLASS,
+		"Microwindows Alpha Blending",
+		WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+		CW_USEDEFAULT, CW_USEDEFAULT,
+		width, height,
+		NULL, (HMENU)++nextid, NULL, NULL);
+
+	return hwnd;
+}
+
+LRESULT CALLBACK
+WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+	PAINTSTRUCT	ps;
+	HWND		sibwp;
+	HDC		hdcMem;
+	HBITMAP		hbmp, hbmpOrg;
+	HBRUSH		hbr;
+	RECT		rc;
+	extern int mwpaintSerial;
+   
+	switch(msg) {
+	case WM_ERASEBKGND:
+		/* don't erase with screen dc, must alpha blend bkgnd*/
+		return 1;
+	
+	case WM_PAINT:
+		/* NOTE: this routine needs to be generalized
+		 * for arbitrary deep child relationships and
+		 * moved into the Microwindows kernel.  In addition,
+		 * the lower window repainting needs to occur
+		 * offscreen and alpha blended offscreen with
+		 * a final blit to the device screen.
+		 */
+		/* force NC painting - current NC regions don't work
+		 * with this alpha blend algorithm
+		 */
+		mwforceNCpaint = TRUE;
+
+		/* repaint lower windows before alpha blending this window*/
+		++hwnd->unmapcount;	/* tricky don't clip this window*/
+		SendMessage(rootwp, WM_PAINT, 0, 0);
+		for(sibwp=hwnd->siblings; sibwp; sibwp=sibwp->siblings)
+			SendMessage(sibwp, WM_PAINT, 0, 0);
+		--hwnd->unmapcount;
+
+		/* then queue repaint for higher windows*/
+		for(sibwp=hwnd->parent->children; sibwp != hwnd;
+							sibwp=sibwp->siblings)
+			/* don't paint if already painted by above code*/
+			if(sibwp->paintSerial != mwpaintSerial)
+				PostMessage(sibwp, WM_PAINT, 0, 0);
+
+		/* now paint this window offscreen and blend with screen*/
+		BeginPaint(hwnd, &ps);
+		GetClientRect(hwnd, &rc);
+
+		/* redirect painting to offscreen dc*/
+		hdcMem = CreateCompatibleDC(ps.hdc);
+		hbmp = CreateCompatibleBitmap(hdcMem, rc.right, rc.bottom);
+		hbmpOrg = SelectObject(hdcMem, hbmp);
+
+		/* paint window to offscreen*/
+		hbr = (HBRUSH)GetClassLong(hwnd, GCL_HBRBACKGROUND);
+		FillRect(hdcMem, &rc, hbr);
+		SelectObject(hdcMem, GetStockObject(DEFAULT_GUI_FONT));
+		SetBkMode(hdcMem, TRANSPARENT);
+#define TEXTSTRING	"This demonstrates alpha blending"
+		TextOut(hdcMem, 0, 20, TEXTSTRING, strlen(TEXTSTRING));
+
+		/* alpha blend blit offscreen map with physical screen*/
+		BitBlt(ps.hdc, 0, 0, rc.right, rc.bottom, hdcMem, 0, 0,
+			MWROP_BLENDCONSTANT | 150);
+		DeleteObject(SelectObject(hdcMem, hbmpOrg));
+		DeleteDC(hdcMem);
+
+		EndPaint(hwnd, &ps);
+		break;
+
+	default:
+		return DefWindowProc( hwnd, msg, wp, lp);
+	}
+	return( 0);
+}
+
+int WINAPI 
+WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
+	int nShowCmd)
+{
+	MSG msg;
+
+	/* Force XORMOVE window redraw algorithm, required
+	 * for this version of alpha blend painting
+	 */
+	mwERASEMOVE = FALSE;
+
+	RegisterAppClass();
+
+	/* set background wallpaper*/
+	MwSetDesktopWallpaper(&image_car8);
+
+	/* must update root window until alpha blend blitting
+	 * uses off screen memory for hidden windows, rather than
+	 * screen memory*/
+	UpdateWindow(GetDesktopWindow());
+
+	CreateAppWindow();
+	CreateAppWindow();
+
+	/* type ESC to quit...*/
+	while( GetMessage(&msg, NULL, 0, 0)) {
+		TranslateMessage(&msg);
+		DispatchMessage(&msg);
+	}
+	return 0;
+}
diff -urN lib/microwindows/src/demos/mwin/mdemo.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/mdemo.c
--- lib/microwindows/src/demos/mwin/mdemo.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/mdemo.c	2005-02-21 16:12:50.000000000 +0100
@@ -0,0 +1,466 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Demo program for Microwindows
+ */
+#define MWINCLUDECOLORS
+#include "windows.h"
+#include "wintern.h"		/* for MwSetDesktopWallpaper*/
+
+#include "device.h"
+
+#if DOS_TURBOC
+unsigned _stklen = 4096;
+#endif
+
+#define CLIPDEMO	0	/* set for region clipping demo*/
+
+#ifndef ELKS
+#define TIMERDEMO	1	/* set for WM_TIMER demo*/
+#define GRAPH3D		0	/* 3d graphics demo*/
+#define IMAGE		0	/* 256 color image demo*/
+#endif
+#define ARCDEMO		1	/* arc drawing demo*/
+#define CHILD 		1	/* child window demo*/
+#define CLIENT3D	0	/* old client draw test*/
+
+#if GRAPH3D
+#include "graph3d.h"
+#endif
+
+extern MWIMAGEHDR image_car8;
+extern MWIMAGEHDR image_zion208;
+extern MWIMAGEHDR image_penguin;
+extern MWIMAGEHDR image_under4;
+extern MWIMAGEHDR image_microwin;
+extern MWIMAGEHDR image_cs1;
+extern MWIMAGEHDR image_rle8;
+
+#if CHILD
+#if ELKS | MSDOS
+PMWIMAGEHDR image = &image_cs1;		/* 2 color bitmap for 16 color systems*/
+#else
+PMWIMAGEHDR image = &image_penguin;
+#endif
+#endif
+
+#if IMAGE
+PMWIMAGEHDR image2 = &image_zion208;
+#endif
+
+#define APPCLASS	"test"
+#define APPCHILD	"test2"
+
+/* forward decls*/
+LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wp,LPARAM lp);
+LRESULT CALLBACK ChildWndProc(HWND hwnd,UINT uMsg,WPARAM wp,LPARAM lp);
+
+int
+MwUserInit(int ac, char **av)
+{
+	/* test user init procedure - do nothing*/
+	return 0;
+}
+
+int
+RegisterAppClass(void)
+{
+	WNDCLASS	wc;
+
+#if !ELKS
+	MwRegisterButtonControl(NULL);
+	MwRegisterEditControl(NULL);
+	MwRegisterListboxControl(NULL);
+	MwRegisterProgressBarControl(NULL);
+	/*MwRegisterComboboxControl(NULL);*/
+#endif
+	wc.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW;
+	wc.lpfnWndProc = (WNDPROC)WndProc;
+	wc.cbClsExtra = 0;
+	wc.cbWndExtra = 0;
+	wc.hInstance = 0;
+	wc.hIcon = 0; /*LoadIcon(GetHInstance(), MAKEINTRESOURCE( 1));*/
+	wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
+	wc.lpszMenuName = NULL;
+	wc.lpszClassName =  APPCLASS;
+	RegisterClass( &wc);
+
+#if CHILD
+	wc.lpfnWndProc = (WNDPROC)ChildWndProc;
+	wc.lpszClassName =  APPCHILD;
+	return RegisterClass( &wc);
+#endif
+	return 1;
+}
+
+HWND
+CreateAppWindow(void)
+{
+	HWND	hwnd, hlist;
+	static int nextid = 1;
+	int width, height;
+	RECT r;
+	GetWindowRect(GetDesktopWindow(), &r);
+	width = height = r.right / 2;
+
+	hwnd = CreateWindowEx(0L, APPCLASS,
+		"Microwindows Application",
+		WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+		CW_USEDEFAULT, CW_USEDEFAULT,
+		width, height,
+		NULL, (HMENU)nextid++, NULL, NULL);
+
+#if CHILD
+	if(hwnd
+#if GRAPH3D
+			&& (nextid & 03)!=2
+#endif
+								) {
+		CreateWindowEx(0L, APPCHILD,
+			"",
+			WS_BORDER | WS_CHILD | WS_VISIBLE,
+			4, 4, width / 3, height / 3,
+			hwnd, (HMENU)2, NULL, NULL);
+		CreateWindowEx(0L, APPCHILD,
+			"",
+			WS_BORDER | WS_CHILD | WS_VISIBLE,
+			width / 3, height / 3, width / 3, height / 3,
+			hwnd, (HMENU)3, NULL, NULL);
+		CreateWindowEx(0L, APPCHILD,
+			"",
+			WS_BORDER | WS_CHILD | WS_VISIBLE,
+			width * 3 / 5, height * 3 / 5,
+			width * 2 / 3, height * 2 / 3,
+			hwnd, (HMENU)4, NULL, NULL);
+		CreateWindowEx(0L, "EDIT",
+			"OK",
+			WS_BORDER|WS_CHILD | WS_VISIBLE,
+			width * 5 / 8, 10, 100, 18,
+			hwnd, (HMENU)5, NULL, NULL);
+		CreateWindowEx(0L, "PROGBAR",
+			"OK",
+			WS_BORDER|WS_CHILD | WS_VISIBLE,
+			width * 5 / 8, 32, 100, 18,
+			hwnd, (HMENU)6, NULL, NULL);
+
+		hlist = CreateWindowEx(0L, "LISTBOX",
+			"OK",
+			WS_HSCROLL|WS_VSCROLL|WS_BORDER|WS_CHILD | WS_VISIBLE,
+			width * 5 / 8, 54, 100, 48,
+			hwnd, (HMENU)7, NULL, NULL);
+		SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Cherry");
+		SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Apple");
+		SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Orange");
+
+		CreateWindowEx(0L, "BUTTON",
+			"Cancel",
+			BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE,
+			width * 5 / 8 + 50, 106, 50, 14,
+			hwnd, (HMENU)8, NULL, NULL);
+	}
+#endif
+	return hwnd;
+}
+
+#if CHILD
+LRESULT CALLBACK
+ChildWndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+	HDC		hdc;
+	RECT		rc;
+	PAINTSTRUCT	ps;
+
+	switch(msg) {
+	case WM_PAINT:
+		hdc = BeginPaint(hwnd, &ps);
+		GetClientRect(hwnd, &rc);
+		DrawDIB(hdc, rc.left, rc.top, image);
+		EndPaint(hwnd, &ps);
+		break;
+	default:
+		return DefWindowProc( hwnd, msg, wp, lp);
+	}
+	return( 0);
+}
+#endif
+
+LRESULT CALLBACK
+WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+	PAINTSTRUCT	ps;
+	HDC		hdc;
+#if CLIENT3D | IMAGE | GRAPH3D
+	RECT		rc;
+#endif
+#if GRAPH3D
+	static int	countup = 1;
+	int		id;
+	static vec1 	gx, gy;
+#endif
+#if TIMERDEMO
+	static POINT	mousept;
+#endif
+#if ARCDEMO
+	static int	startdegrees = 0;
+	static int	enddegrees = 30;
+#endif
+
+	switch( msg) {
+#if TIMERDEMO
+	case WM_CREATE:
+		SetTimer(hwnd, 1, 100, NULL);
+		mousept.x = 60;
+		mousept.y = 20;
+		break;
+
+	case WM_TIMER:
+#if GRAPH3D
+		GetClientRect(hwnd, &rc);
+		if(countup) {
+			mousept.y += 20;
+			if(mousept.y >= rc.bottom) {
+				mousept.y -= 20;
+				countup = 0;
+			}
+		} else {
+			mousept.y -= 20;
+			if(mousept.y < 20) {
+				mousept.y += 20;
+				countup = 1;
+			}
+		}
+		SendMessage(hwnd, WM_MOUSEMOVE, 0,
+			MAKELONG(mousept.x, mousept.y));
+#endif
+#if ARCDEMO
+		startdegrees += 10;
+		if(startdegrees >= 360)
+			startdegrees = 0;
+		enddegrees += 15;
+		if(enddegrees >= 360)
+			enddegrees = 0;
+		InvalidateRect(hwnd, NULL, TRUE);
+#endif
+		break;
+
+	case WM_DESTROY:
+		KillTimer(hwnd, 1);
+		break;
+#endif /* TIMERDEMO*/
+	case WM_SIZE:
+		break;
+
+	case WM_MOVE:
+		break;
+
+#if CLIENT3D
+	case WM_SETFOCUS:
+		PostMessage((HWND)wp, WM_PAINT, 0, 0L);
+		break;
+
+	case WM_KILLFOCUS:
+		PostMessage((HWND)wp, WM_PAINT, 0, 0L);
+		break;
+	case WM_ERASEBKGND:
+		if(GetFocus() != hwnd)
+			return DefWindowProc(hwnd, msg, wp, lp);
+		return 1;
+#endif
+#if GRAPH3D
+	case WM_ERASEBKGND:
+		if((GetWindowLong(hwnd, GWL_ID) & 03) == 1)
+			return 1;
+		return DefWindowProc(hwnd, msg, wp, lp);
+#endif
+	case WM_PAINT:
+		hdc = BeginPaint(hwnd, &ps);
+
+#if CLIENT3D
+		if(GetFocus() == hwnd) {
+			GetClientRect(hwnd, &rc);
+			Draw3dShadow(hdc, rc.left, rc.top,
+				rc.right-rc.left, rc.bottom-rc.top,
+				GetSysColor(COLOR_3DDKSHADOW),
+				GetSysColor(COLOR_3DLIGHT));
+			InflateRect(&rc, -1, -1);
+			FillRect(hdc, &rc, GetStockObject(GRAY_BRUSH));
+		}
+#endif
+#if IMAGE
+		GetClientRect(hwnd, &rc);
+		DrawDIB(hdc, rc.left+2, rc.top+2, image2);
+#endif
+#if ARCDEMO
+{
+	int x, y, w, h;
+	RECT rc;
+
+	if(hdc != NULL) {
+		GetWindowRect(hwnd, &rc);
+		rc.top += 13;
+		InflateRect(&rc, -3, -3);
+		//Ellipse(hdc, 0, 0, rc.right-rc.left, rc.bottom-rc.top);
+		//Arc(hdc, 0, 0, rc.right-rc.left, rc.bottom-rc.top, 0,0, 0,0);
+		//Pie(hdc, 0, 0, rc.right-rc.left, rc.bottom-rc.top, 0,0, 0,0);
+#if 1
+		x = rc.left;
+		y = rc.top;
+		w = rc.right - rc.left;
+		h = rc.bottom - rc.top;
+		w += 10;
+		GdSetForeground(GdFindColor(RGB(0,255,0)));
+		GdArcAngle(hdc->psd, x+w/2, y+h/2, w/2, h/2, startdegrees*64,
+			enddegrees*64, MWPIE);
+		GdSetForeground(GdFindColor(RGB(0,0,0)));
+		GdArcAngle(hdc->psd, x+w/2, y+h/2, w/2, h/2, startdegrees*64,
+			enddegrees*64, MWARCOUTLINE);
+		//GdSetForeground(GdFindColor(RGB(255,255,255)));
+		//GdPoint(hdc->psd, x+w/2, y+h/2);
+#endif
+	}
+	EndPaint(hwnd, &ps);
+	break;
+}
+#endif /* ARCDEMO*/
+#if GRAPH3D
+		id = (int)GetWindowLong(hwnd, GWL_ID) & 03;
+		init3(hdc, id == 1? hwnd: NULL);
+		switch(id) {
+		case 0:
+			rose(1.0, 7, 13);
+			break;
+		case 1:
+			//look3(0.5, 0.7, 1.5);
+			//look3(0.2, -2 * gy, 1.0+gx);
+			look3(-2 * gx, -2 * gy, 1.2);
+			drawgrid(-8.0, 8.0, 10, -8.0, 8.0, 10);
+			break;
+		case 2:
+			setcolor3(BLACK);
+			circle3(1.0);
+			break;
+		case 3:
+			setcolor3(BLUE);
+			daisy(1.0, 20);
+			break;
+		}
+
+#if CLIPDEMO
+		if(id == 1) {
+			HRGN	hrgn, hrgn2;
+
+			/* create circular clip region for effect*/
+			GetClientRect(hwnd, &rc);
+			InflateRect(&rc, -80, -80);
+			switch((int)GetWindowLong(hwnd, GWL_ID)) {
+			default:
+				hrgn = CreateEllipticRgnIndirect(&rc);
+				break;
+			case 5:
+				hrgn = CreateRoundRectRgn(rc.left, rc.top,
+					rc.right, rc.bottom, 100, 100);
+				break;
+			case 1:
+				hrgn = CreateRectRgnIndirect(&rc);
+				break;
+			}
+
+			/* erase background, clip out blit area*/
+			GetClientRect(hwnd, &rc);
+			hrgn2 = CreateRectRgnIndirect(&rc);
+			SelectClipRgn(hdc, hrgn2);
+			ExtSelectClipRgn(hdc, hrgn, RGN_XOR);
+			DeleteObject(hrgn2);
+
+			GetClientRect(hwnd, &rc);
+			FillRect(hdc, &rc, GetStockObject(BLACK_BRUSH));
+
+			/* clip in only blit area*/
+			SelectClipRgn(hdc, hrgn);
+			DeleteObject(hrgn);
+		}
+#endif /* CLIPDEMO*/
+
+		paint3(hdc);
+
+#endif /* GRAPH3D*/
+		EndPaint(hwnd, &ps);
+		break;
+
+	case WM_LBUTTONDOWN:
+		break;
+
+	case WM_MOUSEMOVE:
+#if GRAPH3D
+		if((GetWindowLong(hwnd, GWL_ID) & 03) == 1) {
+			POINT pt;
+
+			POINTSTOPOINT(pt, lp);
+			GetClientRect(hwnd, &rc);
+			gx = (vec1)pt.x / rc.right;
+			gy = (vec1)pt.y / rc.bottom;
+			InvalidateRect(hwnd, NULL, FALSE);
+			mousept.x = pt.x;
+			mousept.y = pt.y;
+		}
+#endif
+		break;
+
+	case WM_LBUTTONUP:
+		break;
+
+	case WM_RBUTTONDOWN:
+		break;
+
+	default:
+		return DefWindowProc( hwnd, msg, wp, lp);
+	}
+	return( 0);
+}
+
+int WINAPI 
+WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
+	int nShowCmd)
+{
+	MSG 	msg;
+	HWND	hwnd;
+	RECT	rc;
+
+	RegisterAppClass();
+	GetWindowRect(GetDesktopWindow(), &rc);
+#if !(ELKS | MSDOS)
+	/* create penguin window*/
+	CreateWindowEx(0L, APPCHILD, "", WS_BORDER | WS_VISIBLE,
+		rc.right-130-1, rc.bottom-153-1, 130, 153,
+		GetDesktopWindow(), (HMENU)1000, NULL, NULL);
+#endif
+	CreateAppWindow();
+	CreateAppWindow();
+	CreateAppWindow();
+#if !(ELKS | MSDOS)
+	CreateAppWindow();
+	CreateAppWindow();
+	CreateAppWindow();
+	CreateAppWindow();
+	CreateAppWindow();
+	hwnd = CreateAppWindow();
+	GetWindowRect(hwnd, &rc);
+	OffsetRect(&rc, 50, 50);
+	MoveWindow(hwnd, rc.left, rc.top, rc.bottom-rc.top,
+		rc.right-rc.left, TRUE);
+#endif
+#if !(ELKS | MSDOS)
+	/* set background wallpaper*/
+	MwSetDesktopWallpaper(&image_microwin);
+	/*MwSetDesktopWallpaper(&image_under4);*/
+	/*MwSetDesktopWallpaper(&image_car8);*/
+#endif
+
+	/* type ESC to quit...*/
+	while( GetMessage(&msg, NULL, 0, 0)) {
+		TranslateMessage(&msg);
+		DispatchMessage(&msg);
+	}
+	return 0;
+}
diff -urN lib/microwindows/src/demos/mwin/mine.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/mine.c
--- lib/microwindows/src/demos/mwin/mine.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/mine.c	2005-02-21 16:12:50.000000000 +0100
@@ -0,0 +1,1326 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+/*
+ * Minesweeper for Microwindows, adapted from MiniGUI
+ */
+extern int mwCurrentButtons;	// FIXME
+
+
+#ifdef __rtems__
+#define  srandom  srand
+#define  random   rand
+#endif
+
+#define MWINCLUDECOLORS
+#include "windows.h"
+#include "wintools.h"
+
+typedef struct {	
+       	int flag;
+      	int value;
+       	BOOL test;
+       	BOOL hit;
+        BOOL bombout;
+        BOOL error;
+}BOM;
+
+typedef struct  {
+	int x;
+ 	int y;
+	BOOL NY;
+}NO;
+
+typedef struct {
+    int highscore;
+    char name[20];
+}SCORE;
+
+typedef struct {
+	DWORD	dwStyle;
+	LPSTR	spCaption;
+	HMENU	hMenu;
+	HCURSOR	hCursor;
+	HICON	hIcon;
+	WNDPROC	MainWindowProc;
+	int	lx, ty, rx, by;
+	COLORREF iBkColor;
+	DWORD	dwAddData;
+	HWND	hHosting;
+} MAINWINCREATE, *PMAINWINCREATE;
+
+#define IDOK	0
+#define GetCharWidth()		11
+#define GetCharHeight()		13
+
+extern MWIMAGEHDR image_mineflag;
+extern MWIMAGEHDR image_mineface;
+extern MWIMAGEHDR image_minefacelost;
+extern MWIMAGEHDR image_minebomb;
+extern MWIMAGEHDR image_minedone;
+extern MWIMAGEHDR image_minehitfalse;
+
+HWND CreateMainWindow(PMAINWINCREATE pCreateInfo);
+BOOL PtInRect2(const RECT *lprc, int x, int y);
+void Draw3DUpFrame(HDC hDC, int l, int t, int r, int b, int fillc);
+void SearchGround(HDC hdc,int x,int y);
+int Open(HWND hWnd,int x,int y);
+LRESULT TestMyWinProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
+void InitMyWinCreateInfo(PMAINWINCREATE pCreateInfo);
+void InitAbHostedCreateInfo(HWND hHosting, PMAINWINCREATE  pCreateInfo); 
+void InitHighScoreCreateInfo (HWND hHosting, PMAINWINCREATE pCreateInfo);
+void InitCongratulationCreateInfo (HWND hHosting, PMAINWINCREATE pCreateInfo);
+void* TestMyWindow(void* data);
+void BombGame(HWND hWnd, int x, int y);
+void Finished(HWND hWnd);
+void Cancel3DFrame(HDC hdc, int l,int t,int r,int b);
+void TextValue(HDC hdc, int x,int y,int value);
+void BombOut(HWND hWnd);
+void BothButtonDownProc(HWND hWnd, int x, int y);
+void DrawDigit(HDC hdc, char* buffer, int CLOCK);
+
+#define  ID_ABOUT  300
+#define  ID_NEW    301  
+#define  ID_LARGE  302
+#define  ID_MIDDLE 303
+#define  ID_SMALL  304
+#define  ID_CLOSE  305
+#define  ID_HIGHSCORE 306
+#define  ID_CLOCK  400
+
+#define  WIDTH_LARGEWIN   544
+#define  HEIGHT_LARGEWIN  371
+#define  WIDTH_MIDDLEWIN  287
+#define  HEIGHT_MIDDLEWIN 332
+#define  WIDTH_SMALLWIN   178
+#define  HEIGHT_SMALLWIN  206
+
+#define  WIDTH_FACE      30
+#define  HEIGHT_FACE     30
+
+#define  WIDTH_DIGIT     11
+#define  WIDTH_BOMNUM    (2*WIDTH_DIGIT)
+#define  HEIGHT_BOMNUM   30
+
+#define  WIDTH_CLOCK     (3*WIDTH_DIGIT)
+#define  HEIGHT_CLOCK    30
+#define  FREQ_CLOCK      1000
+
+#define  WIDTH_BOX       18
+#define  HEIGHT_BOX      18
+
+//static int winwidth = WIDTH_LARGEWIN;	// change this for startup mine size
+//static int winheight = HEIGHT_LARGEWIN;
+//static int sg_boxnumx = 30;
+//static int sg_boxnumy = 18;
+//static int bombnum = 99;
+
+static int winwidth = WIDTH_MIDDLEWIN;	// change this for startup mine size
+static int winheight = HEIGHT_MIDDLEWIN;
+static int sg_boxnumx = 16;
+static int sg_boxnumy = 16;
+static int bombnum = 40;
+
+//static int winwidth = WIDTH_SMALLWIN;	// change this for startup mine size
+//static int winheight = HEIGHT_SMALLWIN;
+//static int sg_boxnumx = 8;
+//static int sg_boxnumy = 8;
+//static int bombnum = 10;
+
+static BOM bom[30][18];
+static NO NoAdr[540];
+static SCORE score[3];
+static int itime, leftbombnum;
+static int oldx, oldy, adrx, adry;
+static int flag_bombout, flag_finished, flag_size = 2;
+static int second = 0 ;
+static BOOL bTimer;
+static HWND hHighscore,hCongratulate; 
+static int offsetx;
+static int x_face, x_bomnum, x_clock;
+
+void Cancel3DFrame(HDC hdc, int  l, int  t, int w, int h)
+{
+    HBRUSH hbr;
+    RECT rc;
+
+    SetTextColor (hdc,GRAY);
+    Rectangle(hdc, l, t, l + w, t + h);
+    hbr = CreateSolidBrush(LTGRAY);
+    SetRect(&rc, l+1, t+1, l+w, t+h);
+    FillRect(hdc, &rc, hbr);
+    DeleteObject(hbr);
+} 
+
+void TextValue(HDC hdc, int x, int y, int value)
+ {
+    int color = 0;
+    char   va[20]; 
+    switch(value)
+    {
+       case 1:  color=BLUE;       break;
+       case 2:  color=GREEN;      break;   
+       case 3:  color=RED;        break;
+       case 4:  color=MAGENTA;    break;
+       case 5:  color=YELLOW;     break;
+       case 6:  color=CYAN;       break;
+       case 7:  color=RED;    break;
+       case 8:  color=GREEN;  break; 
+    }
+    SetBkColor(hdc,LTGRAY);
+    SetTextColor(hdc,color);
+    sprintf(va,"%d",value);
+    
+    TextOut(hdc, x + ((WIDTH_BOX - GetCharWidth ()) >> 1), 
+        y + ((HEIGHT_BOX - GetCharHeight ()) >> 1), va, -1);
+}  
+
+void SearchGround(HDC hdc,int x,int y)
+{
+     int x1=0,y1=0;
+     int i=1;
+     
+     bom[x][y].test=TRUE;
+     NoAdr[itime].x=x;
+     NoAdr[itime].y=y;
+     NoAdr[itime].NY=FALSE;
+     itime++;
+     Cancel3DFrame(hdc,x*WIDTH_BOX+offsetx, y*HEIGHT_BOX+HEIGHT_FACE,
+                        WIDTH_BOX, HEIGHT_BOX);
+     while( i <= 8 )
+     {
+         switch(i) 
+         {
+             case  1:  x1=x-1;  y1=y;    break;
+             case  2:  x1=x-1;  y1=y-1;  break;
+             case  3:  x1=x-1;  y1=y+1;  break;
+             case  4:  x1=x+1;  y1=y;    break;
+             case  5:  x1=x+1;  y1=y-1;  break;
+             case  6:  x1=x+1;  y1=y+1;  break;
+             case  7:  y1=y-1;  x1=x;    break;
+             case  8:  y1=y+1;  x1=x;    break;   
+         }
+         if( x1>=0 && y1>=0 && x1<sg_boxnumx && y1<sg_boxnumy
+                 &&!bom[x1][y1].hit&& !bom[x1][y1].test && !bom[x1][y1].value )
+               SearchGround(hdc,x1,y1);
+                     
+         if( x1>=0 && y1>=0 && x1<sg_boxnumx && y1<sg_boxnumy
+                            &&!bom[x1][y1].hit
+                            &&!bom[x1][y1].test && bom[x1][y1].value!=0 )
+         {
+             bom[x1][y1].test=TRUE;
+             NoAdr[itime].x=x1;
+             NoAdr[itime].y=y1;
+             NoAdr[itime].NY=TRUE;
+             itime++;
+             Cancel3DFrame(hdc, x1*WIDTH_BOX+offsetx, y1*HEIGHT_BOX+HEIGHT_FACE,
+                                 WIDTH_BOX, HEIGHT_BOX);
+             TextValue(hdc, x1*WIDTH_BOX+offsetx, y1*HEIGHT_BOX+HEIGHT_FACE, 
+                                 bom[x1][y1].value);
+         } 
+         i++;
+     }
+ }
+ 
+BOOL Open(HWND hWnd,int x,int y)
+{ 
+    int x1=0,y1=0;
+    int i=1;
+    HDC hdc;
+
+    hdc = GetDC(hWnd);
+    while( i <= 8 )
+    {
+        switch( i ) {
+            case  1:  x1=x-1;  y1=y;    break;
+            case  2:  x1=x-1;  y1=y-1;  break;
+            case  3:  x1=x-1;  y1=y+1;  break;
+            case  4:  x1=x+1;  y1=y;    break;
+            case  5:  x1=x+1;  y1=y-1;  break;
+            case  6:  x1=x+1;  y1=y+1;  break;
+            case  7:  y1=y-1;  x1=x;    break;
+            case  8:  y1=y+1;  x1=x;    break;   
+        }
+
+        if( x1>=0 && y1>=0 && x1<sg_boxnumx && y1<sg_boxnumy
+            && !bom[x1][y1].hit && bom[x1][y1].flag) {    
+            ReleaseDC(hWnd, hdc);
+            return FALSE;
+        }
+                      
+        if( x1>=0 && y1>=0 && x1<sg_boxnumx && y1<sg_boxnumy
+                && !bom[x1][y1].test && !bom[x1][y1].value
+                && !bom[x1][y1].flag ){
+            SearchGround(hdc,x1,y1);
+        }   
+                     
+        if( x1>=0 && y1>=0 && x1<sg_boxnumx && y1<sg_boxnumy
+                  && !bom[x1][y1].test && bom[x1][y1].value!=0 )
+        {
+            bom[x1][y1].test=TRUE;
+            NoAdr[itime].x=x1;
+            NoAdr[itime].y=y1;
+            NoAdr[itime].NY=TRUE;
+            itime++;
+             Cancel3DFrame(hdc, x1*WIDTH_BOX+offsetx, y1*HEIGHT_BOX+HEIGHT_FACE,
+                                 WIDTH_BOX, HEIGHT_BOX);
+             TextValue(hdc, x1*WIDTH_BOX+offsetx, y1*HEIGHT_BOX+HEIGHT_FACE, 
+                                 bom[x1][y1].value);
+        }
+        i++; 
+    }
+    
+    ReleaseDC(hWnd, hdc);
+    return  TRUE; 
+}
+
+void BombOut(HWND hWnd)
+{ 
+  int i,j;
+  HDC hdc;
+  
+  hdc=GetDC(hWnd);
+  
+  for (i = 0; i < sg_boxnumx; i++) {
+      for (j = 0; j < sg_boxnumy; j++) {
+         if (bom[i][j].flag && !bom[i][j].hit) {
+            Cancel3DFrame(hdc,i*WIDTH_BOX+offsetx,j*HEIGHT_BOX+HEIGHT_FACE,
+                    WIDTH_BOX,HEIGHT_BOX);
+                    
+	    DrawDIB(hdc, i*WIDTH_BOX+offsetx+1, j*HEIGHT_BOX+1+HEIGHT_FACE,
+			&image_minebomb);
+            bom[i][j].bombout = TRUE;            
+          }
+         if (!bom[i][j].flag && bom[i][j].hit){
+            Cancel3DFrame(hdc,i*WIDTH_BOX+offsetx,j*HEIGHT_BOX+HEIGHT_FACE,
+                    WIDTH_BOX,HEIGHT_BOX);
+                    
+	    DrawDIB(hdc, i*WIDTH_BOX+offsetx+1, j*HEIGHT_BOX+1+HEIGHT_FACE,
+			&image_minehitfalse);
+            bom[i][j].error = TRUE;            
+                        
+          }   
+       }
+   }
+
+   DrawDIB(hdc, x_face, 0, &image_minefacelost);
+   flag_bombout = 1;
+   bTimer = FALSE;
+   ReleaseDC(hWnd, hdc);
+}
+
+void Finished(HWND hWnd)
+{ 
+    int i,j;
+    HDC hdc;
+    RECT bombnumber;
+    MAINWINCREATE CreateInfo;
+  
+    hdc = GetDC(hWnd);
+  
+    for (i = 0; i < sg_boxnumx; i++) {
+        for (j = 0; j < sg_boxnumy; j++) {
+            if (bom[i][j].flag && !bom[i][j].hit) {
+                    
+		DrawDIB(hdc, i*WIDTH_BOX+offsetx+3, j*HEIGHT_BOX+3+HEIGHT_FACE,
+				 &image_mineflag);
+                bom[i][j].hit = TRUE;                     
+            }
+        }
+    }
+
+    DrawDIB(hdc, x_face+1, 1, &image_minedone);
+    flag_finished = 1;
+    bTimer = FALSE;
+    ReleaseDC(hWnd, hdc);
+   
+    leftbombnum = 0;
+                     
+    SetRect (&bombnumber, x_bomnum, 0,
+                         x_bomnum + WIDTH_BOMNUM, HEIGHT_BOMNUM);
+    InvalidateRect (hWnd, &bombnumber, FALSE);
+   
+    if (second < score[flag_size].highscore){
+        InitCongratulationCreateInfo(hWnd, &CreateInfo);
+        hCongratulate = CreateMainWindow (&CreateInfo);
+    }    
+}    
+
+#if 0
+HMENU createpmenuabout()
+{
+    HMENU hmnu;
+    MENUITEMINFO mii;
+    memset (&mii, 0, sizeof(MENUITEMINFO));
+    mii.type        = MFT_STRING;
+    mii.id          = 0;
+    mii.typedata    = (DWORD)"About";
+    hmnu = CreatePopupMenu (&mii);
+    
+    memset (&mii, 0, sizeof(MENUITEMINFO));
+    mii.type        = MFT_STRING ;
+    mii.state       = 0;
+    mii.id          = ID_ABOUT;
+    mii.typedata    = (DWORD)"About Bomb Game";
+    InsertMenuItem(hmnu, 3, TRUE, &mii);
+
+    return hmnu;
+}
+
+HMENU createpmenustart()
+{
+    HMENU hmnu;
+    MENUITEMINFO mii;
+    memset (&mii, 0, sizeof(MENUITEMINFO));
+    mii.type        = MFT_STRING;
+    mii.id          = 0;
+    mii.typedata    = (DWORD)"Start";
+    hmnu = CreatePopupMenu (&mii);
+    
+    memset (&mii, 0, sizeof(MENUITEMINFO));
+    mii.type        = MFT_STRING ;
+    mii.state       = 0;
+    mii.id          = ID_NEW;
+    mii.typedata    = (DWORD)"New Game";
+    InsertMenuItem(hmnu, 0, TRUE, &mii);
+    
+    mii.type        = MFT_STRING ;
+    mii.state       = 0;
+    mii.id          = ID_HIGHSCORE;
+    mii.typedata    = (DWORD)"High Score";
+    InsertMenuItem(hmnu, 1, TRUE, &mii);
+    
+    mii.type        = MFT_STRING ;
+    mii.state       = 0;
+    mii.id          = ID_CLOSE;
+    mii.typedata    = (DWORD)"Quit Game";
+    InsertMenuItem(hmnu, 2, TRUE, &mii);
+    
+    return hmnu;
+}
+
+HMENU createpmenulevel()
+{
+    HMENU hmnu;
+    MENUITEMINFO mii;
+    memset (&mii, 0, sizeof(MENUITEMINFO));
+    mii.type        = MFT_STRING;
+    mii.id          = 0;
+    mii.typedata    = (DWORD)"Level";
+    hmnu = CreatePopupMenu (&mii);
+    
+    mii.type        = MFT_STRING ;
+    mii.state       = 0;
+    mii.id          = ID_LARGE;
+    mii.typedata    = (DWORD)"Large";
+    InsertMenuItem(hmnu, 0, TRUE, &mii);
+     
+    mii.type        = MFT_STRING ;
+    mii.state       = 0;
+    mii.id          = ID_MIDDLE;
+    mii.typedata    = (DWORD)"Middle";
+    InsertMenuItem(hmnu, 1, TRUE, &mii);  
+    
+    mii.type        = MFT_STRING ;
+    mii.state       = 0;
+    mii.id          = ID_SMALL;
+    mii.typedata    = (DWORD)"Small";
+    InsertMenuItem(hmnu, 2, TRUE, &mii);  
+
+    return hmnu;
+}
+
+HMENU createmenu1()
+{
+    HMENU hmnu;
+    MENUITEMINFO mii;
+
+    hmnu = CreateMenu();
+
+    memset (&mii, 0, sizeof(MENUITEMINFO));
+    mii.type        = MFT_STRING;
+    mii.id          = 100;
+    mii.typedata    = (DWORD)"Start";
+    mii.hsubmenu    = createpmenustart();
+
+    InsertMenuItem(hmnu, 0, TRUE, &mii);
+
+    mii.type        = MFT_STRING;
+    mii.id          = 110;
+    mii.typedata    = (DWORD)"Level";
+    mii.hsubmenu    = createpmenulevel();
+    InsertMenuItem(hmnu, 1, TRUE, &mii);
+    
+    mii.type        = MFT_STRING;
+    mii.id          = 120;
+    mii.typedata    = (DWORD)"About";
+    mii.hsubmenu    = createpmenuabout();
+    InsertMenuItem(hmnu, 2, TRUE, &mii);
+                   
+    return hmnu;
+}
+#endif
+
+void BothButtonDownProc(HWND hWnd,int adrx,int adry)
+{
+    int test_open = 0; 
+    int i = 1;
+    int adrx1 = 0, adry1 = 0;
+    int flag_opened = 1;
+
+    if (!bom[adrx][adry].test)
+    return;
+    if (!bom[adrx][adry].value)
+    return;
+    if (bom[adrx][adry].hit)
+    return;
+    while (i <= 8)
+    {
+       switch (i)
+       {
+        case 1:
+           adrx1 = adrx-1;
+           adry1 = adry;
+        break;
+                        
+        case 2:
+           adrx1 = adrx-1;
+           adry1 = adry-1;
+        break;
+
+        case 3:
+           adrx1 = adrx-1;
+           adry1 = adry+1;
+        break;
+        
+        case 4:
+           adrx1 = adrx;
+           adry1 = adry-1;
+        break;
+        
+        case 5:
+            adrx1 = adrx;
+            adry1 = adry+1;
+        break;
+        
+        case 6:
+            adrx1 = adrx+1;
+            adry1 = adry; 
+        break; 
+        
+        case 7:
+            adrx1 = adrx+1;
+            adry1 = adry+1;
+        break; 
+        
+        case 8:
+            adrx1 = adrx+1;
+            adry1 = adry-1;
+        break;
+       }
+       
+       if (adrx1>=0 && adry1>=0 && adrx1<sg_boxnumx && adry1<sg_boxnumy
+                            && bom[adrx1][adry1].hit)
+           test_open++;
+       else
+            if(adrx>=0 && adry1>=0 && adrx1<sg_boxnumx && adry1<sg_boxnumy
+                            && !bom[adrx1][adry1].test)
+                flag_opened = 0;            
+       i++;
+    }
+    if ((test_open == bom[adrx][adry].value) && !flag_opened)
+    {
+        if (!Open (hWnd, adrx, adry))
+            BombOut (hWnd);
+        if (itime == (sg_boxnumx*sg_boxnumy-bombnum))
+            Finished(hWnd);
+             
+    }
+            
+}
+
+void DrawDigit(HDC hdc, char* buffer, int CLOCK)
+{
+    int x;
+    
+    if (CLOCK)
+        x = x_clock;
+    else
+        x = x_bomnum;
+        
+    	SetBkMode(hdc, OPAQUE);
+	SetBkColor(hdc, LTGRAY);
+	TextOut(hdc, x, 0, buffer, -1);
+	return;
+}
+
+LRESULT TestMyWinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    HDC hdc;
+    char  bomn[30], seconds[30];
+    int i, j;
+    int ran1, ran2;
+    static RECT bombregion, face, onerect, bombnumber, clock; 
+    static RECT winposition;
+    MAINWINCREATE  CreateInfo;
+    //FILE* pHighscore;
+    //char  buffer[256];
+    PAINTSTRUCT ps;
+    switch (message) {
+      
+        case WM_CREATE:
+            //if( LoadBitmap(&bmpbom,"res/lei.bmp")<0)
+                //fprintf(stderr,"bitmap error");
+            //else
+                //fValidbom = TRUE;
+  
+            //if( LoadBitmap(&bmpface,"res/face1.bmp")<0)
+                //fprintf(stderr,"bitmap error");
+            //else
+                //fValidface = TRUE;
+                
+            //if( LoadBitmap(&bitmap1,"res/face.bmp")<0)
+                //fprintf(stderr,"bitmap error");
+            //else
+                //fValid1 = TRUE;
+                
+            //if( LoadBitmap(&bmpflag,"res/flag.bmp")<0)
+                //fprintf(stderr,"bitmap error");
+            //else
+                //fValidflag = TRUE;   
+                
+            //if( LoadBitmap(&bmpfinalface,"res/finished.bmp")<0)
+                //fprintf(stderr,"bitmap error");
+            //else
+                //fValidfinalface = TRUE;   
+                
+            //if( LoadBitmap(&bmphitfalse,"res/hitfalse.bmp")<0)
+                //fprintf(stderr,"bitmap error");
+            //else
+                //fValidhitfalse = TRUE;   
+                
+            //for (i = 0; i < 10; i++){
+                //sprintf(buffer, "res/%d.bmp", i);
+                //LoadBitmap(sg_bmpDigit + i, buffer);
+            //}
+
+            //if ((pHighscore = fopen("res/.highscore.bomb","r"))){
+                //for (i = 0; i < 3; i++)
+                    //fscanf(pHighscore, "%d, %s",
+                            //&score[i].highscore, score[i].name);
+                //fclose(pHighscore);
+            //}
+            //else
+                //for (i = 0; i < 3; i++){
+                    //score[i].highscore = 999;
+                    //strcpy(score[i].name, "unknown");
+                //}    
+            SetTimer(hWnd, ID_CLOCK, FREQ_CLOCK, NULL);
+            
+            PostMessage(hWnd,WM_COMMAND,ID_NEW,0);
+        break;
+
+        case WM_COMMAND:
+            if (LOWORD(wParam) == ID_ABOUT)
+            {
+               InitAbHostedCreateInfo(hWnd,&CreateInfo);
+               CreateMainWindow(&CreateInfo);  
+            }
+            
+            if (LOWORD(wParam) == ID_CLOSE)
+            {
+                PostMessage(hWnd, WM_CLOSE, 0, 0);
+            }
+            
+            if (LOWORD(wParam) == ID_HIGHSCORE)
+            {
+               InitHighScoreCreateInfo(hWnd,&CreateInfo);
+               hHighscore =  CreateMainWindow(&CreateInfo);  
+               ShowWindow(hHighscore,SW_SHOW); 
+            }
+            
+            if (LOWORD(wParam) == ID_LARGE)
+            {
+                bombnum = 99;
+                sg_boxnumx = 30;
+                sg_boxnumy = 18;
+                winwidth = WIDTH_LARGEWIN;
+                flag_size = 2;
+                GetWindowRect(hWnd, &winposition);
+                MoveWindow(hWnd, winposition.left, winposition.top, 
+                           WIDTH_LARGEWIN, HEIGHT_LARGEWIN, FALSE);
+                PostMessage(hWnd, WM_COMMAND, ID_NEW, 0);
+            }    
+            if (LOWORD(wParam) == ID_MIDDLE)
+            {
+                bombnum = 40;
+                sg_boxnumx = 16;
+                sg_boxnumy = 16;
+                winwidth = WIDTH_MIDDLEWIN;
+                flag_size = 1;
+                GetWindowRect(hWnd, &winposition);
+                MoveWindow(hWnd, winposition.left, winposition.top, 
+                           WIDTH_MIDDLEWIN, HEIGHT_MIDDLEWIN, FALSE);
+                PostMessage(hWnd, WM_COMMAND, ID_NEW, 0);
+            }
+            
+            if (LOWORD(wParam) == ID_SMALL)
+            {
+                bombnum = 10;
+                sg_boxnumx = 8;
+                sg_boxnumy = 8;
+                winwidth = WIDTH_SMALLWIN;
+                flag_size = 0;
+                GetWindowRect(hWnd, &winposition);
+                MoveWindow(hWnd, winposition.left, winposition.top, 
+                           WIDTH_SMALLWIN, HEIGHT_SMALLWIN, FALSE);
+                PostMessage(hWnd, WM_COMMAND, ID_NEW, 0);
+            }    
+                
+            if (LOWORD(wParam) == ID_NEW)
+            {
+                bTimer = FALSE;
+                second = 0;
+                itime = 0;
+                leftbombnum = bombnum;
+                flag_bombout = 0;
+                flag_finished = 0;
+                x_bomnum = winwidth / 6;
+                x_face = (winwidth*2) / 5;
+                x_clock = (winwidth*3) / 5;
+                offsetx = (winwidth - WIDTH_BOX*sg_boxnumx)/2-2;
+                SetRect (&clock, x_clock, 0, 
+                            x_clock + WIDTH_CLOCK, HEIGHT_CLOCK);
+                            
+                SetRect (&face, x_face, 0,
+                            x_face + WIDTH_FACE, HEIGHT_FACE);
+                            
+                SetRect (&bombregion, offsetx, HEIGHT_FACE,
+                           WIDTH_BOX*sg_boxnumx+offsetx,
+                           HEIGHT_BOX*sg_boxnumy+HEIGHT_FACE);
+                     
+                SetRect (&bombnumber, x_bomnum, 0,
+                     x_bomnum + WIDTH_BOMNUM, HEIGHT_BOMNUM);
+                     
+               //**************initial bomb value**************
+               
+              for (i = 0; i < sg_boxnumx; i++)
+                for (j = 0; j < sg_boxnumy; j++)
+                { bom[i][j].flag  = 0;
+                  bom[i][j].hit   = FALSE;
+                  bom[i][j].value = 0;
+                  bom[i][j].test  = FALSE;
+                  bom[i][j].bombout = FALSE;
+                  bom[i][j].error = FALSE;
+                 }; 
+              for (i = 0; i < (sg_boxnumx*sg_boxnumy); i++)
+                  NoAdr[i].NY = FALSE; 
+                   
+              srandom( time(NULL));
+              i = 0;
+              while( i < bombnum )
+               {
+                  ran1 = random()%sg_boxnumx;
+                  ran2 = random()%sg_boxnumy;
+                  if(!bom[ran1][ran2].flag)
+                     { 
+                        bom[ran1][ran2].flag = 1;
+			i++;
+                     } 
+#ifdef __rtems__
+		      else i++;		/* bad rtems random function*/
+#endif
+                }
+ 
+               for (i = 0; i < sg_boxnumx; i++)         
+                  for (j = 0; j < sg_boxnumy; j++)
+                    {
+                if (!bom[i][j].flag) {
+                if(i-1>=0&&j-1>=0&&bom[i-1][j-1].flag)
+                        bom[i][j].value++;
+                        
+                if(i-1>=0&&bom[i-1][j].flag)
+                        bom[i][j].value++;
+                        
+                if(i-1>=0&&j+1<sg_boxnumy&&bom[i-1][j+1].flag)
+                        bom[i][j].value++;
+                        
+                if(j-1>=0&&bom[i][j-1].flag)
+                        bom[i][j].value++;
+                        
+                if(j+1<sg_boxnumy&&bom[i][j+1].flag)
+                        bom[i][j].value++;
+                        
+                if(i+1<sg_boxnumx&&j+1<sg_boxnumy&&bom[i+1][j+1].flag)
+                        bom[i][j].value++; 
+                        
+                if(i+1<sg_boxnumx&&bom[i+1][j].flag) 
+                        bom[i][j].value++;
+                        
+                if(i+1<sg_boxnumx&&j-1>=0&&bom[i+1][j-1].flag)
+                        bom[i][j].value++;
+                } 
+                     }    
+               InvalidateRect (hWnd, NULL, TRUE);
+               }
+        break;
+        
+        case WM_TIMER:
+            if (wParam == ID_CLOCK)
+                if (bTimer){
+                    if (second < 1000){
+                        second++;
+                        InvalidateRect(hWnd, &clock, FALSE);
+                    }
+                }
+        break;        
+
+        case WM_LBUTTONDOWN:
+
+            oldx = LOWORD (lParam);
+            oldy = HIWORD (lParam);
+
+            adrx = (oldx-offsetx)/WIDTH_BOX;
+            adry = (oldy-HEIGHT_FACE)/HEIGHT_BOX;
+            
+            if (hCongratulate || hHighscore)
+                break;
+                
+            if (!PtInRect2 (&bombregion, oldx, oldy)) {
+                if (PtInRect2 (&face, oldx, oldy)){
+                    PostMessage (hWnd, WM_COMMAND, ID_NEW, 0);
+                    break;
+                }    
+                else
+                    break;
+            }
+            if (flag_bombout)
+                break;
+            if (flag_finished)
+                break;
+            if (!bTimer)
+                bTimer = TRUE;
+                
+            if (bom[adrx][adry].hit)
+                break;
+
+            //if (GetShiftKeyStatus() & 0x00000200) {
+	    if(mwCurrentButtons & MWBUTTON_R) {
+                BothButtonDownProc(hWnd,adrx,adry);
+                break;
+            }
+            
+                
+            if (bom[adrx][adry].test)
+                break;
+                
+            if (bom[adrx][adry].flag) {
+                BombOut(hWnd);   
+                break;
+            }    
+            if (bom[adrx][adry].value != 0)
+            {
+                    NoAdr[itime].x  = adrx;
+                    NoAdr[itime].y  = adry;
+                    NoAdr[itime].NY = TRUE;
+                    itime++;
+                    bom[adrx][adry].test = TRUE;
+                    
+                    SetRect (&onerect, adrx*WIDTH_BOX+offsetx,
+                           adry*HEIGHT_BOX+HEIGHT_FACE,
+                           (adrx+1)*WIDTH_BOX+offsetx,
+                           (adry+1)*HEIGHT_BOX+HEIGHT_FACE);
+                    InvalidateRect (hWnd, &onerect, FALSE);
+             }
+             else {
+                    hdc = GetDC(hWnd);
+                    SearchGround (hdc, adrx, adry);
+                    ReleaseDC(hWnd, hdc);
+             }
+             
+             if (itime == (sg_boxnumx*sg_boxnumy - bombnum))
+                Finished(hWnd);
+             
+        break;
+
+        case WM_MBUTTONDOWN:
+             oldx = LOWORD (lParam);
+             oldy = HIWORD (lParam);
+             adrx = (oldx-offsetx)/WIDTH_BOX;
+             adry = (oldy-HEIGHT_FACE)/HEIGHT_BOX;  
+
+            if (!PtInRect2 (&bombregion, oldx, oldy))
+                break;
+            if (flag_bombout)
+                break;
+            if (flag_finished)
+                break;
+                
+            if (!bTimer)
+                bTimer = TRUE;
+                
+           /*****RBUTTONDOWN & LBUTTONDOWN******/
+            
+                BothButtonDownProc(hWnd,adrx,adry); 
+		break;
+
+        case WM_RBUTTONDOWN:
+           //  SetCapture (hWnd);
+             oldx = LOWORD (lParam);
+             oldy = HIWORD (lParam);
+             adrx = (oldx-offsetx)/WIDTH_BOX;
+             adry = (oldy-HEIGHT_FACE)/HEIGHT_BOX;  
+
+            if (!PtInRect2 (&bombregion, oldx, oldy))
+                break;
+            if (flag_bombout)
+                break;
+            if (flag_finished)
+                break;
+                
+            if (!bTimer)
+                bTimer = TRUE;
+                
+           /*****RBUTTONDOWN & LBUTTONDOWN******/
+            
+            //if (GetShiftKeyStatus() & 0x00000100){
+	    if(mwCurrentButtons & MWBUTTON_L) {
+                BothButtonDownProc(hWnd,adrx,adry); 
+                break; 
+            }    
+           /*******  only  rbuttondown   *******/
+                
+            if (bom[adrx][adry].test)
+               break;
+            if (!bom[adrx][adry].hit )
+               {
+                     bom[adrx][adry].hit = TRUE;
+                     leftbombnum--;    
+               }
+            else
+               { bom[adrx][adry].hit = FALSE;
+                 leftbombnum++;
+               }
+            SetRect (&onerect, adrx*WIDTH_BOX+offsetx,
+                      adry*HEIGHT_BOX+HEIGHT_FACE, 
+                      (adrx+1)*WIDTH_BOX+offsetx,
+                      (adry+1)*HEIGHT_BOX+HEIGHT_FACE);
+            InvalidateRect (hWnd, &onerect, FALSE);
+            InvalidateRect (hWnd, &bombnumber, FALSE);
+        break;
+      
+        case WM_PAINT:
+            hdc = BeginPaint (hWnd, &ps);
+           
+            sprintf(seconds, "%03d", second);
+            DrawDigit(hdc, seconds, TRUE);
+
+            if (leftbombnum >= 0){                     
+                sprintf(bomn,"%02d",leftbombnum);
+                DrawDigit(hdc, bomn, FALSE);
+            }
+            
+            if (flag_finished)
+		DrawDIB(hdc, x_face+1, 1, &image_minedone);
+                //DrawMyBitmap (hdc, fValidfinalface?&bmpfinalface:NULL,
+            else 
+                if (flag_bombout)
+		    DrawDIB(hdc, x_face, 0, &image_minefacelost);
+                else
+		    DrawDIB(hdc, x_face, 0, &image_mineface);
+            
+            for (i = 0; i < sg_boxnumx; i++)
+                for (j = 0; j < sg_boxnumy; j++)
+            {
+                if (!bom[i][j].test && !bom[i][j].bombout){
+                    SetTextColor (hdc,BLACK);
+		    SelectObject(hdc, GetStockObject(NULL_BRUSH));
+                    Draw3DUpFrame(hdc,
+                            i*WIDTH_BOX+offsetx,
+                            j*HEIGHT_BOX+HEIGHT_FACE,
+                            (i+1)*WIDTH_BOX+offsetx,
+                            (j+1)*HEIGHT_BOX+HEIGHT_FACE,
+                            LTGRAY);
+                }
+              
+           
+                if ( bom[i][j].hit)
+		    DrawDIB(hdc, i*WIDTH_BOX+offsetx+3, j*HEIGHT_BOX+3+HEIGHT_FACE,
+				 &image_mineflag);
+            
+                if (bom[i][j].error) {
+                    Cancel3DFrame(hdc,i*WIDTH_BOX+offsetx,
+                                 j*HEIGHT_BOX+HEIGHT_FACE,
+                                 WIDTH_BOX,HEIGHT_BOX);
+                    
+		    DrawDIB(hdc, i*WIDTH_BOX+offsetx+1, j*HEIGHT_BOX+1+HEIGHT_FACE,
+		       &image_minehitfalse);
+                }
+                
+                if (bom[i][j].bombout) {
+                    Cancel3DFrame(hdc,i*WIDTH_BOX+offsetx,
+                                        j*HEIGHT_BOX+HEIGHT_FACE,
+                                        WIDTH_BOX,HEIGHT_BOX);
+                    
+		    DrawDIB(hdc, i*WIDTH_BOX+offsetx+1, j*HEIGHT_BOX+1+HEIGHT_FACE,
+		       &image_minebomb);
+                }
+            }
+            
+            for ( i = 0; i < itime; i++ )
+            {
+             Cancel3DFrame(hdc,(NoAdr[i].x)*WIDTH_BOX+offsetx,
+                        (NoAdr[i].y)*HEIGHT_BOX+HEIGHT_FACE,
+                        WIDTH_BOX, HEIGHT_BOX);
+             if(NoAdr[i].NY) 
+                 TextValue(hdc,(NoAdr[i].x)*WIDTH_BOX+offsetx,
+                          (NoAdr[i].y)*HEIGHT_BOX+HEIGHT_FACE, 
+                          bom[NoAdr[i].x][NoAdr[i].y].value);
+            }
+            EndPaint (hWnd, &ps);
+        break;    
+
+        case WM_CLOSE:
+            KillTimer(hWnd, ID_CLOCK);  
+            DestroyWindow (hWnd);
+            PostQuitMessage (0);
+        return 0;
+    }
+    return DefWindowProc(hWnd, message, wParam, lParam);
+}
+
+void InitMyWinCreateInfo(PMAINWINCREATE pCreateInfo)
+{
+    pCreateInfo->dwStyle = WS_CAPTION | WS_BORDER | WS_SYSMENU |  WS_VISIBLE;
+    pCreateInfo->spCaption="Microwindows Minesweeper";
+    pCreateInfo->hMenu = 0; //createmenu1();
+    pCreateInfo->hCursor = 0; //GetSystemCursor(0);
+    pCreateInfo->hIcon = 0;
+    pCreateInfo->MainWindowProc = TestMyWinProc;
+    pCreateInfo->lx = 0;
+    pCreateInfo->ty = 0;
+    pCreateInfo->rx = winwidth;
+    pCreateInfo->by = winheight;
+    pCreateInfo->iBkColor = LTGRAY; 
+    pCreateInfo->dwAddData = 0;
+    pCreateInfo->hHosting = HWND_DESKTOP;
+}
+
+void* TestMyWindow(void* data) 
+{
+    MSG Msg;
+    MAINWINCREATE CreateInfo;
+    HWND hMainWnd;
+
+    InitMyWinCreateInfo(&CreateInfo);
+
+    hMainWnd = CreateMainWindow(&CreateInfo);
+
+    if (hMainWnd == 0)
+        return NULL;
+
+    ShowWindow(hMainWnd,SW_SHOWNORMAL);
+    while( GetMessage(&Msg, NULL, 0, 0) ) {
+        TranslateMessage (&Msg);
+        DispatchMessage(&Msg);
+    }
+
+    return NULL;
+}
+
+int WINAPI 
+WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
+	int nShowCmd)
+{
+    TestMyWindow (NULL);
+    return 0;
+}
+
+/**********   create a hosted about window****/
+LRESULT AbHostedWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    PAINTSTRUCT ps;
+
+    switch (message) {
+        case WM_CREATE:
+        break;
+
+        case WM_PAINT:
+        {
+            HDC hdc;
+
+            hdc = BeginPaint (hWnd, &ps);
+            SetBkColor(hdc,LTGRAY);
+            TextOut (hdc, 10, 25, "Minesweeper Ver 0.9 (1999/08/27)", -1); 
+            TextOut (hdc, 10, 55, 
+                "Author: Mis. Zheng Xiang (xiang_zi@263.net).", -1);
+            TextOut (hdc, 10, 75, 
+                "        Mis. Glory (glory@263.net).", -1);
+            EndPaint (hWnd, &ps);
+        }
+        return 0;
+
+        case WM_CLOSE:
+            DestroyWindow (hWnd);
+        return 0;
+    }
+
+    return DefWindowProc(hWnd, message, wParam, lParam);
+}
+void InitAbHostedCreateInfo (HWND hHosting, PMAINWINCREATE pCreateInfo)
+{
+    pCreateInfo->dwStyle   = WS_BORDER | WS_CAPTION | WS_VISIBLE;
+    pCreateInfo->spCaption = "The about window" ;
+    pCreateInfo->hMenu = 0;
+    pCreateInfo->hCursor = 0; //GetSystemCursor(0);
+    pCreateInfo->hIcon = 0;
+    pCreateInfo->MainWindowProc = AbHostedWinProc;
+    pCreateInfo->lx = 100; 
+    pCreateInfo->ty = 200;
+    pCreateInfo->rx = 540;
+    pCreateInfo->by = 390;
+    pCreateInfo->iBkColor  = LTGRAY; 
+    pCreateInfo->dwAddData = 0;
+    pCreateInfo->hHosting  = hHosting;
+}
+
+/*************************** High Scores Window ******************************/
+#define IDC_RESET  110
+LRESULT HighScoreWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    PAINTSTRUCT ps;
+    static HWND hRESET, hOK;
+    
+    switch (message) {
+        case WM_CREATE:
+            hRESET = CreateWindowEx (0L, "button",
+                        "����",
+                        WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE,
+                        100, 145, 60, 26, 
+			hWnd, (HMENU)IDC_RESET, 0, 0L);
+                        
+            hOK    = CreateWindowEx (0L, "button",
+                        "ȷ��",
+                        WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE,
+                        220, 145, 60, 26,
+			hWnd, (HMENU)IDOK, 0, 0L);
+        break;
+
+        case WM_COMMAND:
+        {
+            int id = LOWORD(wParam);
+            //FILE* pHighscore;
+            int i;
+
+            if (id == IDC_RESET && HIWORD(wParam) == BN_CLICKED) {
+                for (i = 0; i < 3; i++){
+                    score[i].highscore = 999;
+                    strcpy(score[i].name, "unknown");
+                }    
+                
+                //if ((pHighscore = fopen("res/.highscore.bomb", "w+"))){
+                    //for (i = 0; i < 3; i++)
+                        //fprintf(pHighscore, "%d, %s\n", 
+                                    //score[i].highscore,score[i].name);
+                    //fclose(pHighscore);
+                //}    
+                InvalidateRect(hWnd, NULL, TRUE);
+            }
+            if (id == IDOK && HIWORD(wParam) == BN_CLICKED)
+                PostMessage(hWnd, WM_CLOSE, 0, 0);
+        }
+        break;
+        
+        case WM_PAINT:
+        {
+            HDC hdc;
+            char buffer[50];
+            int i;
+            
+            hdc = BeginPaint (hWnd, &ps);
+            SetBkColor(hdc,LTGRAY);
+            TextOut(hdc, 130, 15, "Ӣ�۰�", -1);
+            TextOut(hdc, 15, 45, "SMALL" , -1);
+            TextOut(hdc, 15, 75, "MIDDLE", -1 );
+            TextOut(hdc, 15, 105, "LARGE", -1 );
+            for (i = 0; i < 3; i++){
+                sprintf(buffer, "%3d          %s", 
+                            score[i].highscore, score[i].name);
+                TextOut(hdc, 150, 45+i*30, buffer, -1);
+            }    
+            EndPaint (hWnd, &ps);
+        }
+        return 0;
+
+        case WM_CLOSE:
+            DestroyWindow (hRESET);
+            DestroyWindow (hOK);
+            DestroyWindow (hWnd);
+            hHighscore = HWND_DESKTOP;
+        return 0;
+    }
+
+    return DefWindowProc(hWnd, message, wParam, lParam);
+}
+
+void InitHighScoreCreateInfo (HWND hHosting, PMAINWINCREATE pCreateInfo)
+{
+    pCreateInfo->dwStyle   = WS_BORDER | WS_CAPTION;
+    pCreateInfo->spCaption = "High Score" ;
+    pCreateInfo->hMenu = 0;
+    pCreateInfo->hCursor   = 0; //GetSystemCursor(0);
+    pCreateInfo->hIcon = 0;
+    pCreateInfo->MainWindowProc = HighScoreWinProc;
+    pCreateInfo->lx = 100; 
+    pCreateInfo->ty = 200;
+    pCreateInfo->rx = 470;
+    pCreateInfo->by = 410;
+    pCreateInfo->iBkColor  = LTGRAY; 
+    pCreateInfo->dwAddData = 0;
+    pCreateInfo->hHosting  = hHosting;
+}
+
+/************************* Congratulation Window *****************************/
+
+#define IDC_CTRL_NAME       100
+
+LRESULT CongratulationWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    static HWND hPrompt, hName, hOK;
+       
+    switch (message) {
+        case WM_CREATE:
+#if 0
+            hPrompt = CreateWindow ("static",
+                          "�������Ϻ���մ���: ",
+                          SS_SIMPLE | WS_VISIBLE,
+                          IDC_STATIC,
+                          10, 10, 185, 24, hWnd, 0);
+            hName   = CreateWindow ("edit",
+                          getlogin(),
+                          WS_CHILD | WS_VISIBLE | WS_BORDER,
+                          IDC_CTRL_NAME,
+                          10, 40, 175, 26, hWnd, 0);
+#endif
+            hOK     = CreateWindow ("button",
+                          "ȷ��",
+                          WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE,
+                          110, 75, 75, 26,
+			  hWnd, (HMENU)IDOK, 0, 0L);
+        break;
+
+        case WM_COMMAND:
+        {
+            int id = LOWORD(wParam);
+            //FILE* pHighscore;
+            //int i;
+
+            if (id == IDOK && HIWORD(wParam) == BN_CLICKED) {
+                score[flag_size].highscore = second;
+                SendMessage (hName, WM_GETTEXT,
+                                19, (LPARAM)score[flag_size].name);
+                //if ((pHighscore = fopen("res/.highscore.bomb", "w+"))){
+                    //for (i = 0; i < 3; i++)
+                        //fprintf(pHighscore, "%d, %s\n", 
+                                    //score[i].highscore,score[i].name);
+                    //fclose(pHighscore);
+                //}    
+                PostMessage (hWnd, WM_CLOSE, 0, 0);
+            }
+        }
+        break;
+                                                                                        case WM_CLOSE:
+            DestroyWindow (hPrompt);
+            DestroyWindow (hName);
+            DestroyWindow (hOK);
+            DestroyWindow (hWnd);
+            hCongratulate = HWND_DESKTOP;
+        return 0;
+    }
+
+    return DefWindowProc(hWnd, message, wParam, lParam);
+}
+
+void InitCongratulationCreateInfo (HWND hHosting, PMAINWINCREATE pCreateInfo)
+{
+    pCreateInfo->dwStyle   = WS_BORDER | WS_CAPTION | WS_VISIBLE;
+    pCreateInfo->spCaption = "Congratulation" ;
+    pCreateInfo->hMenu = 0;
+    pCreateInfo->hCursor   = 0; //GetSystemCursor(0);
+    pCreateInfo->hIcon = 0;
+    pCreateInfo->MainWindowProc = CongratulationWinProc;
+    pCreateInfo->lx = 50; 
+    pCreateInfo->ty = 60;
+    pCreateInfo->rx = 255;
+    pCreateInfo->by = 200;
+    pCreateInfo->iBkColor  = LTGRAY; 
+    pCreateInfo->dwAddData = 0;
+    pCreateInfo->hHosting  = hHosting;
+}
+
+HWND
+CreateMainWindow(PMAINWINCREATE pCreateInfo)
+{
+	HWND		hwnd;
+	RECT		rc;
+	WNDCLASS	wc;
+
+	wc.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
+	wc.lpfnWndProc = (WNDPROC)pCreateInfo->MainWindowProc;
+	wc.cbClsExtra = 0;
+	wc.cbWndExtra = 0;
+	wc.hInstance = 0;
+	wc.hIcon = pCreateInfo->hIcon;
+	wc.hCursor = pCreateInfo->hCursor;
+	wc.hbrBackground = (HBRUSH)CreateSolidBrush(pCreateInfo->iBkColor);
+	wc.lpszMenuName = 0;
+	wc.lpszClassName = pCreateInfo->spCaption;
+	RegisterClass(&wc);
+
+	SetRect(&rc, pCreateInfo->lx, pCreateInfo->ty, pCreateInfo->rx,
+		pCreateInfo->by);
+	AdjustWindowRectEx(&rc, pCreateInfo->dwStyle, FALSE, 0L);
+
+	hwnd = CreateWindowEx(0L, pCreateInfo->spCaption,
+			pCreateInfo->spCaption,
+			pCreateInfo->dwStyle,
+			rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
+			pCreateInfo->hHosting,
+			(HMENU)0, (HINSTANCE)0,
+			(PVOID)pCreateInfo->dwAddData);
+	return hwnd;
+}
+
+BOOL
+PtInRect2(const RECT *lprc, int x, int y)
+{
+	POINT	p;
+
+	p.x = x;
+	p.y = y;
+	return PtInRect(lprc, p);
+}
+
+void
+Draw3DUpFrame(HDC hDC, int l, int t, int r, int b, int fillc)
+{
+	RECT	rc;
+	HBRUSH	hbr;
+
+	SetRect(&rc, l, t, r, b);
+	Draw3dBox(hDC, rc.left, rc.top,
+		rc.right-rc.left, rc.bottom-rc.top,
+		GetSysColor(COLOR_3DLIGHT),
+		GetSysColor(COLOR_WINDOWFRAME));
+	InflateRect(&rc, -1, -1);
+	Draw3dBox(hDC, rc.left, rc.top,
+		rc.right-rc.left, rc.bottom-rc.top,
+		GetSysColor(COLOR_BTNHIGHLIGHT),
+		GetSysColor(COLOR_BTNSHADOW));
+	InflateRect(&rc, -1, -1);
+
+	hbr = CreateSolidBrush(LTGRAY);
+	FillRect(hDC, &rc, hbr);
+	DeleteObject(hbr);
+}
Binary files lib/microwindows/src/demos/mwin/minebomb.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/minebomb.bmp differ
Binary files lib/microwindows/src/demos/mwin/minedone.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/minedone.bmp differ
Binary files lib/microwindows/src/demos/mwin/mineface.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/mineface.bmp differ
Binary files lib/microwindows/src/demos/mwin/minefacelost.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/minefacelost.bmp differ
Binary files lib/microwindows/src/demos/mwin/mineflag.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/mineflag.bmp differ
Binary files lib/microwindows/src/demos/mwin/minehitfalse.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/minehitfalse.bmp differ
diff -urN lib/microwindows/src/demos/mwin/mterm.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/mterm.c
--- lib/microwindows/src/demos/mwin/mterm.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/mterm.c	2005-02-21 16:02:51.000000000 +0100
@@ -0,0 +1,333 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Microwindows Terminal Emulator for Linux
+ *
+ * Yes, this is just a demo, and doesn't repaint contents on refresh.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+#define MWINCLUDECOLORS
+#include "windows.h"
+#include "wintern.h"		/* for MwRegisterFdInput*/
+#include "wintools.h"		/* Draw3dInset*/
+
+#define COLS		80
+#define ROWS		24
+#define XMARGIN		2
+#define YMARGIN		2
+#define FGCOLOR		GREEN
+#define BKCOLOR		BLACK
+#define FONTNAME	SYSTEM_FIXED_FONT
+/*#define FONTNAME	OEM_FIXED_FONT*/
+#define APPCLASS	"mterm"
+
+#if DOS_DJGPP
+#define killpg		kill
+#define SIGCHLD		17 /* from Linux, not defined in DJGPP */
+#endif
+
+/* forward decls*/
+LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wp,LPARAM lp);
+void EmOutChar(HWND hwnd, int ch);
+int  CreatePtyShell(void);
+int  ReadPtyShell(int fd, char *buf, int count);
+int  WritePtyShell(int fd, char *buf, int count);
+void ClosePtyShell(int fd);
+
+/* local data*/
+static int ttyfd = -1;
+static int xpos = XMARGIN;
+static int ypos = YMARGIN;
+static int nCharWidth, nCharHeight;
+static int nScreenWidth, nScreenHeight;
+
+int
+RegisterAppClass(void)
+{
+	WNDCLASS	wc;
+
+	wc.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW;
+	wc.lpfnWndProc = (WNDPROC)WndProc;
+	wc.cbClsExtra = 0;
+	wc.cbWndExtra = 0;
+	wc.hInstance = 0;
+	wc.hIcon = 0; /*LoadIcon(GetHInstance(), MAKEINTRESOURCE( 1));*/
+	wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground = CreateSolidBrush(BKCOLOR);
+	wc.lpszMenuName = NULL;
+	wc.lpszClassName =  APPCLASS;
+	RegisterClass( &wc);
+	return 1;
+}
+
+HWND
+CreateAppWindow(void)
+{
+	HWND	hwnd;
+	HDC	hdc;
+	int 	w, h;
+	RECT	rc;
+
+	GetWindowRect(GetDesktopWindow(), &rc);
+	w = rc.right - 40;
+	h = rc.bottom;
+
+	/* determine TE size from font*/
+	hdc = GetDC(NULL);
+	SelectObject(hdc, GetStockObject(FONTNAME));
+	SetRect(&rc, 0, 0, 0, 0);
+	nCharHeight = DrawText(hdc, "m", 1, &rc, DT_CALCRECT);
+	nCharWidth = rc.right;
+	nScreenWidth = min(w, nCharWidth*COLS);
+	nScreenHeight = min(h, nCharHeight*ROWS);
+	ReleaseDC(NULL, hdc);
+
+	hwnd = CreateWindowEx(0L, APPCLASS,
+		"Microwindows Terminal",
+		WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+		CW_USEDEFAULT, CW_USEDEFAULT,
+		nScreenWidth+4, nScreenHeight+24,
+		NULL, (HMENU)1, NULL, NULL);
+
+	return hwnd;
+}
+
+LRESULT CALLBACK
+WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+	unsigned char	ch;
+	HDC		hdc;
+	RECT		rc;
+	PAINTSTRUCT	ps;
+   
+	switch(msg) {
+	case WM_CREATE:
+		ttyfd = CreatePtyShell();
+		/*if(ttyfd == -1)
+			return -1;*/
+		MwRegisterFdInput(hwnd, ttyfd);
+		xpos = XMARGIN;
+		ypos = YMARGIN;
+		break;
+
+	case WM_DESTROY:
+		MwUnregisterFdInput(hwnd, ttyfd);
+		ClosePtyShell(ttyfd);
+		break;
+
+	case WM_CHAR:
+		ch = (char)wp;
+		/* echo half duplex if CreatePtyShell() failed*/
+		if(ttyfd == -1) {
+			EmOutChar(hwnd, ch);
+			if(ch == '\r')
+				EmOutChar(hwnd, '\n');
+		} else
+			WritePtyShell(ttyfd, &ch, 1);
+		break;
+
+	case WM_FDINPUT:
+		if(ReadPtyShell(ttyfd, &ch, 1) == 1)
+			EmOutChar(hwnd, ch);
+		break;
+
+	case WM_PAINT:
+		hdc = BeginPaint(hwnd, &ps);
+		GetClientRect(hwnd, &rc);
+		Draw3dInset(hdc, 0, 0, rc.right-rc.left, rc.bottom-rc.top);
+		EndPaint(hwnd, &ps);
+		break;
+
+	default:
+		return DefWindowProc(hwnd, msg, wp, lp);
+	}
+	return 0;
+}
+
+int WINAPI 
+WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
+	int nShowCmd)
+{
+	MSG 	msg;
+	extern MWIMAGEHDR image_car8;
+
+	RegisterAppClass();
+	MwSetDesktopWallpaper(&image_car8);
+
+	CreateAppWindow();
+
+	/* type ESC to quit...*/
+	while(GetMessage(&msg, NULL, 0, 0)) {
+		TranslateMessage(&msg);
+		DispatchMessage(&msg);
+	}
+	return 0;
+}
+
+void
+EmOutChar(HWND hwnd, int ch)
+{
+	HDC	hdc;
+	RECT	rc;
+
+	switch(ch) {
+	case '\r':
+		xpos = XMARGIN;
+		return;
+	case '\n':
+		ypos += nCharHeight;
+		GetClientRect(hwnd, &rc);
+		if(ypos > (ROWS-1)*nCharHeight + YMARGIN) {
+			ypos -= nCharHeight;
+
+			/* scroll window using bitblt ;-)*/
+			hdc = GetDC(hwnd);
+			BitBlt(hdc, XMARGIN, YMARGIN, rc.right-XMARGIN*2,
+				rc.bottom-nCharHeight-YMARGIN*2,
+				hdc, XMARGIN, nCharHeight+YMARGIN, SRCCOPY);
+			rc.top = ypos;
+			rc.left += XMARGIN;
+			rc.right -= XMARGIN;
+			rc.bottom -= YMARGIN;
+			FillRect(hdc, &rc,
+				(HBRUSH)GetClassLong(hwnd, GCL_HBRBACKGROUND));
+			ReleaseDC(hwnd, hdc);
+		}
+		return;
+	case '\007':			/* bel*/
+		write(STDERR_FILENO, "\007", 1);
+		return;
+	case '\t':
+		xpos += nCharWidth;
+		while((xpos/nCharWidth) & 7)
+			EmOutChar(hwnd, ' ');
+		return;
+	case '\b':
+		if(xpos <= XMARGIN)
+			return;
+		xpos -= nCharWidth;
+		EmOutChar(hwnd, ' ');
+		xpos -= nCharWidth;
+		return;
+	}
+
+	/* draw some text*/
+	hdc = GetDC(hwnd);
+	SelectObject(hdc, GetStockObject(FONTNAME));
+	SetBkColor(hdc, BKCOLOR);
+	SetTextColor(hdc, FGCOLOR);
+	SetRect(&rc, xpos, ypos, xpos+nCharWidth, ypos+nCharHeight);
+	ExtTextOut(hdc, xpos, ypos, ETO_OPAQUE, &rc, (char *)&ch, 1, NULL);
+	ReleaseDC(hwnd, hdc);
+	xpos += nCharWidth;
+	if(xpos > (COLS-1)*nCharWidth) {
+		xpos = XMARGIN;
+		EmOutChar(hwnd, '\n');
+	}
+}
+
+#if ELKS
+#define SHELL	"/bin/sash"
+#else
+#if DOS_DJGPP
+#define SHELL	"bash"
+#else
+#define SHELL	"/bin/sh"
+#endif
+#endif
+
+static int pid;
+
+static void
+ptysignaled(int signo)
+{
+	switch(signo) {
+	case SIGINT:	/* interrupt*/
+#if !ELKS
+		/* this doesn't work, can anyone fix it?*/
+		killpg(pid, SIGINT);
+#endif
+		return;
+	case SIGCHLD:	/* child status change - child exit*/
+		DestroyWindow(GetActiveWindow());
+		CreateAppWindow();
+		return;
+	}
+	fprintf(stderr, "Uncaught signal %d\n", signo);
+}
+
+/*
+ * Create a shell running through a pseudo tty, return the shell fd.
+ */
+int
+CreatePtyShell(void)
+{
+	int	n = 0;
+	int	tfd;
+	char	pty_name[12];
+	char *	argv[2];
+
+again:
+	sprintf(pty_name, "/dev/ptyp%d", n);
+	if ((tfd = open(pty_name, O_RDWR | O_NONBLOCK)) < 0) {
+		if ((errno == EBUSY || errno == EIO) && n < 10) {
+			++n;
+			goto again;
+		}
+		fprintf(stderr, "Can't create pty %s\n", pty_name);
+		return -1;
+	}
+	signal(SIGCHLD, ptysignaled);
+	signal(SIGINT, ptysignaled);
+	if ((pid = fork()) == -1) {
+		fprintf(stderr, "No processes\n");
+		return -1;
+	}
+	if (!pid) {
+		close(STDIN_FILENO);
+		close(STDOUT_FILENO);
+		close(STDERR_FILENO);
+		close(tfd);
+		
+		setsid();
+		pty_name[5] = 't';
+		if ((tfd = open(pty_name, O_RDWR)) < 0) {
+			fprintf(stderr, "Child: Can't open pty %s\n", pty_name);
+			exit(1);
+		}
+		dup2(tfd, STDIN_FILENO);
+		dup2(tfd, STDOUT_FILENO);
+		dup2(tfd, STDERR_FILENO);
+		/*if(!(argv[0] = getenv("SHELL")))*/
+			argv[0] = SHELL;
+		argv[1] = NULL;
+		execv(argv[0], argv);
+		exit(1);
+	}
+	return tfd;
+}
+
+int
+ReadPtyShell(int fd, char *buf, int count)
+{
+	return read(fd, buf, count);
+}
+
+int
+WritePtyShell(int fd, char *buf, int count)
+{
+	return write(fd, buf, count);
+}
+
+void
+ClosePtyShell(int fd)
+{
+	if(ttyfd != -1)
+		close(fd);
+}
diff -urN lib/microwindows/src/demos/mwin/mtest.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/mtest.c
--- lib/microwindows/src/demos/mwin/mtest.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/mtest.c	2005-02-21 16:12:51.000000000 +0100
@@ -0,0 +1,72 @@
+#include <windows.h>
+
+LRESULT CALLBACK wproc(HWND,UINT,WPARAM,LPARAM);
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
+                   PSTR szCmdLine, int iCmdShow)
+{
+        static char szAppName[]="HolaWin";
+        HWND hwnd;
+        MSG msg;
+        WNDCLASS wndclass;
+
+        wndclass.style          = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
+        wndclass.lpfnWndProc    = (WNDPROC)wproc;
+        wndclass.cbClsExtra     =0;
+        wndclass.cbWndExtra     =0;
+        wndclass.hInstance      =0;
+        wndclass.hIcon          =0;
+        wndclass.hCursor        =0;
+        wndclass.hbrBackground  =(HBRUSH)GetStockObject(LTGRAY_BRUSH);
+        wndclass.lpszMenuName   =NULL;
+        wndclass.lpszClassName  = szAppName;
+
+        RegisterClass(&wndclass);
+        hwnd=CreateWindowEx(0L,
+                          szAppName,
+                          "Hola",
+                          WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+                          CW_USEDEFAULT,
+                          CW_USEDEFAULT,
+                          80,
+                          80,
+                          NULL,
+                          NULL,
+                          NULL,
+                          NULL);
+               
+               
+        ShowWindow(hwnd,iCmdShow);
+        UpdateWindow(hwnd);
+        
+        while (GetMessage(&msg,NULL,0,0)) {
+                TranslateMessage(&msg);
+                DispatchMessage(&msg);
+        }      
+        return msg.wParam;
+}       
+LRESULT CALLBACK wproc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
+{       
+        HDC hdc;
+        PAINTSTRUCT ps;
+        RECT rect;
+        
+        switch (iMsg) {
+        case WM_CREATE:
+                break;
+        case WM_PAINT:
+        /*case WM_MOUSEFIRST:*/
+                hdc=BeginPaint(hwnd,&ps);
+                GetClientRect(hwnd,&rect);
+                DrawText(hdc, "Hola, NOS", -1, &rect,
+                         DT_SINGLELINE|DT_CENTER|DT_VCENTER);
+                EndPaint(hwnd,&ps);
+                break;
+        case WM_DESTROY:
+                PostQuitMessage(0);
+                break;
+        default:
+                return DefWindowProc(hwnd,iMsg,wParam,lParam);
+        }      
+        return (0);
+}
diff -urN lib/microwindows/src/demos/mwin/mtest2.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/mtest2.c
--- lib/microwindows/src/demos/mwin/mtest2.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/mtest2.c	2005-02-21 16:12:51.000000000 +0100
@@ -0,0 +1,196 @@
+#define MWINCLUDECOLORS
+#include <windows.h>
+
+LRESULT CALLBACK wproc(HWND,UINT,WPARAM,LPARAM);
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
+                   PSTR szCmdLine, int iCmdShow)
+{
+        static char szAppName[]="HolaWin";
+        HWND hwnd;
+        MSG msg;
+        WNDCLASS wndclass;
+
+	int width, height;
+	RECT r;
+        HWND hlist,hedit;
+
+	GetWindowRect(GetDesktopWindow(), &r);
+	width = height = r.right / 2;
+
+	MwRegisterButtonControl(NULL);
+	MwRegisterEditControl(NULL);
+	MwRegisterListboxControl(NULL);
+	MwRegisterProgressBarControl(NULL);
+	MwRegisterStaticControl(NULL);
+	MwRegisterComboboxControl(NULL);
+	MwRegisterScrollbarControl(NULL);
+
+        wndclass.style          = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
+        wndclass.lpfnWndProc    = (WNDPROC)wproc;
+        wndclass.cbClsExtra     =0;
+        wndclass.cbWndExtra     =0;
+        wndclass.hInstance      =0;
+        wndclass.hIcon          =0;
+        wndclass.hCursor        =0;
+        wndclass.hbrBackground  =(HBRUSH)GetStockObject(LTGRAY_BRUSH);
+        wndclass.lpszMenuName   =NULL;
+        wndclass.lpszClassName  = szAppName;
+
+        RegisterClass(&wndclass);
+        hwnd=CreateWindowEx(0L,
+                          szAppName,
+                          "Hola",
+                          WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+                          CW_USEDEFAULT,
+                          CW_USEDEFAULT,
+                          width,//80,
+                          height,//80,
+                          NULL,
+                          NULL,
+                          NULL,
+                          NULL);
+#if !ELKS
+
+	hedit=CreateWindowEx(0L, "EDIT",
+		"OK",
+		WS_BORDER|WS_CHILD | WS_VISIBLE,
+		width * 5 / 8, 10, 100, 18,
+		hwnd, (HMENU)5, NULL, NULL);
+
+	CreateWindowEx(0L, "PROGBAR",
+		"OK",
+		WS_BORDER|WS_CHILD | WS_VISIBLE,
+		width * 5 / 8, 32, 100, 18,
+		hwnd, (HMENU)6, NULL, NULL);
+
+	hlist = CreateWindowEx(0L, "LISTBOX",
+		"OK",
+		WS_VSCROLL|
+		/*WS_HSCROLL|*/
+		WS_BORDER|WS_CHILD | WS_VISIBLE,
+		width * 5 / 8, 54, 100, 54,
+		hwnd, (HMENU)7, NULL, NULL);
+
+	SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Cherry");
+	SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Apple");
+	SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Orange");
+	SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Banana");
+	SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"Smooth");
+	SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"00000");
+	SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"11111");
+	SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"22222");
+	SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"33333");
+	SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"44444");
+	SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"55555");
+	SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"66666");
+	SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"77777");
+	SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"88888");
+	SendMessage(hlist, LB_ADDSTRING, 0, (LPARAM)(LPSTR)"99999");
+
+	CreateWindowEx(0L, "BUTTON",
+		"Cancel",
+		WS_CHILD | WS_VISIBLE,
+		width * 5 / 8 + 50, 106+16+6, 50, 14,
+		hwnd, (HMENU)8, NULL, NULL);
+
+	CreateWindowEx(0L, "STATIC",
+		"Static",
+		WS_CHILD | WS_VISIBLE,
+		width * 5 / 8, 106+34+6, 100, 18,
+		hwnd, (HMENU)9, NULL, NULL);
+#if 0
+	{
+	HWND hcombo;
+
+	hcombo = CreateWindowEx(0L, "COMBOBOX",
+		 "Combobox",
+#if 0
+		 CBS_SIMPLE | //edit+list
+#else
+#if 0
+		 CBS_DROPDOWNLIST | //static+pop
+#else
+		 CBS_DROPDOWN | //edit+pop
+#endif
+#endif
+
+#if 1
+		 WS_VSCROLL|
+#endif
+		 WS_CHILD | WS_VISIBLE,
+		 width * 5 / 8, 106+14+4+18+4, 100, (18*5),
+		 hwnd, (HMENU)10, NULL, NULL);
+
+	SendMessage(hcombo, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"Cherry");
+	SendMessage(hcombo, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"Apple");
+	SendMessage(hcombo, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"Orange");
+	SendMessage(hcombo, CB_ADDSTRING, 0, (LPARAM)(LPSTR)"Banana");
+	}
+#endif
+
+#if 1
+	CreateWindowEx(0L, "SCROLLBAR",
+		"OK",
+		SBS_VERT | 
+		WS_CHILD | WS_VISIBLE ,
+		width * 5 / 8 -(18*2), 106+68, 18, 128,
+		hwnd, (HMENU)11, NULL, NULL);
+
+	CreateWindowEx(0L, "SCROLLBAR",
+		"OK",
+		SBS_HORZ | 
+		WS_CHILD | WS_VISIBLE ,
+		width * 5 / 8 -18 , 106+68, 128, 18,
+		hwnd, (HMENU)12, NULL, NULL);
+#endif
+
+#endif
+               
+        ShowWindow(hwnd,iCmdShow);
+        UpdateWindow(hwnd);
+
+        while (GetMessage(&msg,NULL,0,0)) {
+                TranslateMessage(&msg);
+                DispatchMessage(&msg);
+        }      
+
+        return msg.wParam;
+}       
+LRESULT CALLBACK wproc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
+{       
+        HDC hdc;
+        PAINTSTRUCT ps;
+        RECT rect,rc;
+	HGDIOBJ oldfont;
+	//int i;
+        
+        switch (iMsg) {
+        case WM_CREATE:
+                break;
+        case WM_PAINT:
+        /*case WM_MOUSEFIRST:*/
+                hdc=BeginPaint(hwnd,&ps);
+                GetClientRect(hwnd,&rc);
+		//Arc(hdc, 0, 0, rc.right-rc.left, rc.bottom-rc.top, 0,0, 0,0);
+		//Pie(hdc, 0, 0, rc.right-rc.left, rc.bottom-rc.top, 0,0, 0,0);
+                GetClientRect(hwnd,&rect);
+	        oldfont=SelectObject(hdc,CreateFont(12,
+			0,0,0,0,0,0,0,0,0,0,0,
+			FF_DONTCARE|DEFAULT_PITCH,
+			"HZXFONT"));
+                DrawText(hdc, "Hola, NOS, �������", -1, &rect,
+                         DT_SINGLELINE|DT_CENTER|DT_VCENTER);
+		DeleteObject(SelectObject(hdc,oldfont));
+		//for (i=0;i<100;i++)
+			//SetPixel(hdc,i,i,BLUE);
+                EndPaint(hwnd,&ps);
+                break;
+        case WM_DESTROY:
+                PostQuitMessage(0);
+                break;
+        default:
+                return DefWindowProc(hwnd,iMsg,wParam,lParam);
+        }      
+        return 0;
+}
diff -urN lib/microwindows/src/demos/mwin/muserfd.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/muserfd.c
--- lib/microwindows/src/demos/mwin/muserfd.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwin/muserfd.c	2005-02-21 16:12:51.000000000 +0100
@@ -0,0 +1,142 @@
+#include <windows.h>
+#include <wintern.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+#if DOS_DJGPP | defined(__FreeBSD__)
+#include <sys/types.h>
+#endif
+
+#define MAX_TEST_FD (500)
+
+LRESULT CALLBACK wproc(HWND,UINT,WPARAM,LPARAM);
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
+                   PSTR szCmdLine, int iCmdShow)
+{
+        static char szAppName[]="HolaWin";
+        HWND hwnd;
+        WNDCLASS wndclass;
+        int random_fd[MAX_TEST_FD][2], fd, unreg_fd;
+
+        wndclass.style          = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
+        wndclass.lpfnWndProc    = (WNDPROC)wproc;
+        wndclass.cbClsExtra     =0;
+        wndclass.cbWndExtra     =0;
+        wndclass.hInstance      =0;
+        wndclass.hIcon          =0;
+        wndclass.hCursor        =0;
+        wndclass.hbrBackground  =(HBRUSH)GetStockObject(LTGRAY_BRUSH);
+        wndclass.lpszMenuName   =NULL;
+        wndclass.lpszClassName  = szAppName;
+
+        RegisterClass(&wndclass);
+        hwnd=CreateWindowEx(0L,
+                          szAppName,
+                          "Hola",
+                          WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+                          CW_USEDEFAULT,
+                          CW_USEDEFAULT,
+                          80,
+                          80,
+                          NULL,
+                          NULL,
+                          NULL,
+                          NULL);
+
+        /*
+         * Create a random list of fd's to test the list
+         * code.
+         */
+        
+        printf ("Select a random list of fd's to test with.\n");
+
+        for (fd = 0; fd < MAX_TEST_FD; fd++)
+        {
+          random_fd[fd][0] = random () % FD_SETSIZE;
+          random_fd[fd][1] = random () % 3;
+        }
+
+        for (fd = 0; fd < MAX_TEST_FD; fd++)
+        {
+          switch (random_fd[fd][1])
+          {
+            case 0:
+              MwRegisterFdInput (hwnd, random_fd[fd][0]);
+              break;
+              
+            case 1:
+              MwRegisterFdOutput (hwnd, random_fd[fd][0]);
+              break;
+              
+            case 2:
+              MwRegisterFdExcept (hwnd, random_fd[fd][0]);
+              break;
+
+            default:
+
+              printf ("Bad fd type, fd index = %i, type = %i !\n",
+                      fd, random_fd[fd][1]);
+              return 1;
+          }
+        }
+
+        unreg_fd = random () % MAX_TEST_FD;
+
+        for (fd = 0; fd < MAX_TEST_FD; fd++)
+        {
+          switch (random_fd[unreg_fd][1])
+          {
+            case 0:
+              MwUnregisterFdInput (hwnd, random_fd[unreg_fd][0]);
+              break;
+              
+            case 1:
+              MwUnregisterFdOutput (hwnd, random_fd[unreg_fd][0]);
+              break;
+              
+            case 2:
+              MwUnregisterFdExcept (hwnd, random_fd[unreg_fd][0]);
+              break;
+
+            default:
+
+              printf ("Bad fd type !\n");
+              return 1;
+          }
+
+          unreg_fd++;
+          if (unreg_fd >= MAX_TEST_FD)
+            unreg_fd = 0;
+        }
+
+        
+        return 0;
+}
+
+LRESULT CALLBACK wproc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
+{       
+        HDC hdc;
+        PAINTSTRUCT ps;
+        RECT rect;
+        
+        switch (iMsg) {
+        case WM_CREATE:
+                break;
+        case WM_PAINT:
+        //case WM_MOUSEFIRST:
+                hdc=BeginPaint(hwnd,&ps);
+                GetClientRect(hwnd,&rect);
+                DrawText(hdc, "Hola, NOS", -1, &rect,
+                         DT_SINGLELINE|DT_CENTER|DT_VCENTER);
+                EndPaint(hwnd,&ps);
+                break;
+        case WM_DESTROY:
+                PostQuitMessage(0);
+                break;
+        default:
+                return DefWindowProc(hwnd,iMsg,wParam,lParam);
+        }      
+        return (0);
+}
diff -urN lib/microwindows/src/demos/mwobjects/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwobjects/Makefile
--- lib/microwindows/src/demos/mwobjects/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwobjects/Makefile	2005-02-21 16:02:52.000000000 +0100
@@ -0,0 +1,51 @@
+##############################################################################
+#
+# MW Objects Makefile
+#
+# (c) Chris Johns 2000
+#
+##############################################################################
+
+include $(CONFIG)
+
+# Do nothing for RTEMS 
+ifneq ($(ARCH), RTEMS)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(OBJFRAMEWORK), Y)
+
+# List of objects to compile
+CXOBJS = mwo-test.o
+
+all: default $(TOP)/bin/mwo-test
+
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
+CCMWINLIBS = -lmwobjects -lmwin -lmwinlib -lmwengine -lmwdrivers -lmwfonts -lmwimages -lm
+
+$(TOP)/bin/mwo-test: mwo-test.o
+	$(CXX) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(CCMWINLIBS)
+
+
+endif
diff -urN lib/microwindows/src/demos/mwobjects/mwo-test.cc /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwobjects/mwo-test.cc
--- lib/microwindows/src/demos/mwobjects/mwo-test.cc	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/mwobjects/mwo-test.cc	2005-02-21 16:02:52.000000000 +0100
@@ -0,0 +1,512 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Demo program for Micro-Windows
+ */
+
+#define MWINCLUDECOLORS
+#include <mwobjects.h>
+#include <iostream>
+
+extern MWIMAGEHDR image_microwin;
+extern MWIMAGEHDR image_zion208;
+
+PMWIMAGEHDR image  = &image_zion208;
+
+using namespace MicroWindowsObjects;
+
+class TestWindowClass
+  : public WindowClass
+{
+public:
+  
+  TestWindowClass (LPCSTR lpszClassName);
+    
+};
+
+class TestChildWindow
+  : public Window
+{
+public:
+
+  TestChildWindow ();
+  
+  HWND create (LPCSTR lpszClassName,
+               HWND parent, 
+               int x, int y, 
+               int nWidth, int nHeight);
+  
+  void set_trace (bool t) 
+    { trace = t; }
+  
+protected:
+
+  virtual LRESULT message_handler (UINT   msg,
+                                   WPARAM wParam,
+                                   LPARAM lParam);
+private:
+  
+  bool trace;
+  
+};
+
+class TestWindow
+  : public Window
+{
+public:
+
+  TestWindow (LPCSTR lpszClassName, bool trace = false);
+  
+private:
+  
+  bool            trace;
+  Window          button;
+  TestChildWindow image[3];
+  
+};
+
+class Test3dWindow
+  : public Window
+{
+public:
+
+  Test3dWindow (LPCSTR lpszChild);
+
+protected:
+
+  virtual LRESULT message_handler (UINT   msg,
+                                   WPARAM wParam,
+                                   LPARAM lParam);
+private:
+
+  vec1 gx;
+  vec1 gy;
+  
+  vec1 last_gx;
+  vec1 last_gy;
+  
+};
+
+class TestRoseWindow
+  : public TestWindow
+{
+public:
+
+  TestRoseWindow (LPCSTR lpszClassName, bool trace = false);
+  
+protected:
+
+  virtual LRESULT message_handler (UINT   msg,
+                                   WPARAM wParam,
+                                   LPARAM lParam);
+};
+
+class TestCircleWindow
+  : public TestWindow
+{
+public:
+
+  TestCircleWindow (LPCSTR lpszClassName, bool trace = false);
+  
+protected:
+
+  virtual LRESULT message_handler (UINT   msg,
+                                   WPARAM wParam,
+                                   LPARAM lParam);
+};
+
+class TestDaisyWindow
+  : public TestWindow
+{
+public:
+
+  TestDaisyWindow (LPCSTR lpszClass, bool trace = false);
+  
+protected:
+
+  virtual LRESULT message_handler (UINT   msg,
+                                   WPARAM wParam,
+                                   LPARAM lParam);
+};
+
+class TestFileDescriptor
+  : public FileDescriptor
+{
+public:
+  
+  void do_fd_test ();
+  
+protected:
+
+  LRESULT read ();
+  LRESULT write ();
+  LRESULT except ();
+};
+
+class TestApplication
+  : public Application
+{
+  enum { GROUPS = 2 };
+  
+public:
+
+  TestApplication ();
+  
+protected:
+
+  virtual int initialise ();
+  virtual int shutdown ();
+  
+private:
+
+  TestWindowClass    main_class;
+
+  Test3dWindow       *t3d [GROUPS];
+  TestRoseWindow     *tr [GROUPS];
+  TestCircleWindow   *tc [GROUPS];
+  TestDaisyWindow    *td [GROUPS];
+
+  TestFileDescriptor *fd;
+  
+};
+
+TestWindowClass::TestWindowClass (LPCSTR lpszClassName)
+  : WindowClass (lpszClassName,
+                 CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW)
+{
+  set_background ((HBRUSH) GetStockObject (LTGRAY_BRUSH));
+}
+
+TestChildWindow::TestChildWindow ()
+{
+}
+
+HWND
+TestChildWindow::create (LPCSTR lpszClassName,
+                         HWND parent, 
+                         int x, int y, 
+                         int nWidth, int nHeight)
+{
+  return Window::create (0,
+                         lpszClassName, 
+                         "", 
+                         WS_BORDER | WS_CHILD | WS_VISIBLE,
+                         x, y, nWidth, nHeight,
+                         parent, 0, 0, 0);
+}
+
+LRESULT
+TestChildWindow::message_handler (UINT   msg,
+                                  WPARAM wParam,
+                                  LPARAM lParam)
+{
+  Paint paint (*this);
+
+  switch (msg) 
+  {
+    case WM_PAINT:
+      paint.begin ();
+
+      DrawDIB (paint, paint.left (), paint.top (), image);
+
+      paint.end ();
+      break;
+
+    default:
+      return Window::message_handler (msg, wParam, lParam);
+  }
+  return 0;
+}
+
+TestWindow::TestWindow (LPCSTR lpszClassName, bool trace)
+  : trace (trace)
+{
+  Rect rc (GetDesktopWindow ());
+  int  width;
+  int  height;
+ 
+  width = height = rc.right () / 2;
+  
+  if (trace)
+    cout << "create: hwnd=" << get_handle ()
+         << " " << rc << endl;
+
+  create (0, lpszClassName, "Micro C++ Application",
+          WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+          CW_USEDEFAULT, CW_USEDEFAULT,
+          width, height,
+          0, 0, 0, 0);
+  
+  button.create (0, "BUTTON", "Ok",
+                 WS_CHILD | WS_VISIBLE,
+                 width * 5 / 8, 10, 50, 14,
+                 *this, 0, 0, 0);
+
+  image[0].create (lpszClassName, *this, 
+                   4, 4, 
+                   width / 3, height / 3);
+  image[1].create (lpszClassName, *this, 
+                   width / 3, height / 3, 
+                   width / 3, height / 3);
+  image[2].create (lpszClassName, *this, 
+                   width * 3 / 5, height * 3 / 5, 
+                   width * 2 / 3, height * 2 / 3);
+
+  image[0].set_trace (trace);
+  image[1].set_trace (trace);
+  image[2].set_trace (trace);
+
+}
+
+Test3dWindow::Test3dWindow (LPCSTR lpszClassName)
+  : gx (0),
+    gy (0),
+    last_gx (0),
+    last_gy (0)
+{
+  Rect rect (GetDesktopWindow ());
+  int  width;
+  int  height;
+ 
+  width = height = rect.right () / 2;
+  
+  create (0, lpszClassName, "Micro C++ Application",
+          WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+          CW_USEDEFAULT, CW_USEDEFAULT,
+          width, height,
+          0, 0, 0, 0);
+}
+
+LRESULT
+Test3dWindow::message_handler (UINT   msg,
+                               WPARAM wParam,
+                               LPARAM lParam)
+{
+  Paint paint (*this, lParam);
+  Rect  rc;
+ 
+  switch (msg) 
+  {
+    case WM_PAINT:
+      paint.begin (true);
+
+      look3 (-2 * gx, -2 * gy, 1.2);
+      drawgrid (-8.0, 8.0, 10, -8.0, 8.0, 10);
+
+      last_gx = gx;
+      last_gy = gy;
+      
+      paint.end ();
+      break;
+
+    case WM_MOUSEMOVE:
+
+      rc.get_client (*this);
+      gx = (vec1) paint.get_point_x () / rc.right ();
+      gy = (vec1) paint.get_point_y () / rc.bottom ();
+
+      if (gx > last_gx || gy > last_gy)
+        invalidate_rect (0, FALSE);
+      break;
+
+    default:
+      return Window::message_handler (msg, wParam, lParam);
+  }
+  return 0;
+}
+
+TestRoseWindow::TestRoseWindow (LPCSTR lpszClassName, bool trace)
+  : TestWindow (lpszClassName, trace)
+{
+}
+
+LRESULT
+TestRoseWindow::message_handler (UINT   msg,
+                                 WPARAM wParam,
+                                 LPARAM lParam)
+{
+  Paint paint (*this);
+  
+  switch (msg) 
+  {
+    case WM_PAINT:
+      paint.begin (true);
+      
+      rose (1.0, 7, 13);
+
+      paint.end ();
+      break;
+
+    default:
+      return Window::message_handler (msg, wParam, lParam);
+  }
+  return 0;
+}
+
+TestCircleWindow::TestCircleWindow (LPCSTR lpszClassName, bool trace)
+  : TestWindow (lpszClassName, trace)
+{
+}
+
+LRESULT
+TestCircleWindow::message_handler (UINT   msg,
+                                   WPARAM wParam,
+                                   LPARAM lParam)
+{
+  Paint paint (*this);
+  
+  switch (msg) 
+  {
+    case WM_PAINT:
+      paint.begin (true);
+      
+      setcolor3 (BLACK);
+      circle3 (1.0);
+
+      paint.end ();
+      break;
+
+    default:
+      return Window::message_handler (msg, wParam, lParam);
+  }
+  return 0;
+}
+
+TestDaisyWindow::TestDaisyWindow (LPCSTR lpszClassName, bool trace)
+  : TestWindow (lpszClassName, trace)
+{
+}
+
+LRESULT
+TestDaisyWindow::message_handler (UINT   msg,
+                                  WPARAM wParam,
+                                  LPARAM lParam)
+{
+  Paint paint (*this);
+  
+  switch (msg) 
+  {
+    case WM_PAINT:
+      paint.begin (true);
+      
+      setcolor3 (BLUE);
+      daisy (1.0, 20);
+
+      paint.paint_3d ();
+      
+      paint.text_out (10, 250, "Date built : %s", __DATE__);
+      
+      paint.end ();
+      break;
+      
+    case WM_LBUTTONDOWN:
+      cout << "left down : " << *this << endl;
+      SendMessage (*this, WM_FDINPUT, 200, 0);
+      return Window::message_handler (msg, wParam, lParam);
+      break;
+      
+    case WM_RBUTTONDOWN:
+      cout << "right down : " << *this << endl;
+      SendMessage (*this, WM_FDOUTPUT, 200, 0);
+      return Window::message_handler (msg, wParam, lParam);
+      break;
+      
+    case WM_LBUTTONDBLCLK:
+      cout << "double left : " << *this << endl;
+      SendMessage (*this, WM_FDEXCEPT, 200, 0);
+      return Window::message_handler (msg, wParam, lParam);
+      break;
+      
+    default:
+      return Window::message_handler (msg, wParam, lParam);
+  }
+  return 0;
+}
+
+void 
+TestFileDescriptor::do_fd_test ()
+{
+}
+
+LRESULT
+TestFileDescriptor::read ()
+{
+  cout << "test read fd for `" << *get_window () << "' and fd " << *this << endl;
+  return 0;  
+}
+
+LRESULT
+TestFileDescriptor::write ()
+{
+  cout << "test write fd for `" << *get_window () << "' and fd " << *this << endl;
+  return 0;  
+}
+
+LRESULT
+TestFileDescriptor::except ()
+{
+  cout << "test except fd for `" << *get_window () << "' and fd " << *this << endl;
+  return 0;  
+}
+
+TestApplication::TestApplication ()
+  : Application (image_microwin),
+    main_class ("test")
+{
+  for (int i = 0; i < GROUPS; i++)
+  {
+    t3d [i] = 0;
+    tr [i] = 0;
+    tc [i] = 0;
+    td [i] = 0;
+  }
+}
+
+int
+TestApplication::initialise ()
+{
+  main_class.register_class ();
+
+  for (int i = 0; i < GROUPS; i++)
+  {
+    t3d [i] = new Test3dWindow ("test");
+    tr [i] = new TestRoseWindow ("test");
+    tc [i] = new TestCircleWindow ("test");
+    td [i] = new TestDaisyWindow ("test");
+  }
+
+  fd = new TestFileDescriptor ();
+  
+  cout << "attach to " << *td[GROUPS - 1] << endl;
+  
+  td[GROUPS - 1]->attach (200, *fd);
+  
+  return 0;
+}
+
+int
+TestApplication::shutdown ()
+{
+  for (int i = 0; i < GROUPS; i++)
+  {
+    if (t3d [i])
+      delete t3d [i];
+    t3d [i] = 0;
+    
+    if (tr [i])
+      delete tr [i];
+    tr [i] = 0;
+    
+    if (tc [i])
+      delete tc [i];
+    tc [i] = 0;
+    
+    if (td [i])
+      delete td [i];
+    td [i] = 0;
+  }
+  
+  return 0;
+}
+
+TestApplication test_application;
diff -urN lib/microwindows/src/demos/nanowm/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/Makefile
--- lib/microwindows/src/demos/nanowm/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/Makefile	2005-02-21 16:12:53.000000000 +0100
@@ -0,0 +1,53 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+ifndef TOP
+TOP = ../..
+CONFIG = $(TOP)/config
+endif
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(NANOWM), Y)
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME =
+
+# List of objects to compile
+OBJS = nanowm.o events.o wlist.o clients.o actions.o
+
+all: default $(TOP)/bin/nanowm
+
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
+ifeq ($(SHAREDLIBS), Y)
+$(TOP)/bin/nanowm: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(CCNANOXCLIENTLIBS)
+else
+$(TOP)/bin/nanowm: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(NANOXCLIENTLIBS)
+endif
diff -urN lib/microwindows/src/demos/nanowm/actions.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/actions.c
--- lib/microwindows/src/demos/nanowm/actions.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/actions.c	2005-02-21 16:12:53.000000000 +0100
@@ -0,0 +1,496 @@
+/*
+ * NanoWM - Window Manager for Nano-X
+ *
+ * Copyright (C) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+#include "nxdraw.h"
+/* Uncomment this if you want debugging output from this file */
+//#define DEBUG
+#include "nanowm.h"
+
+/* uncomment this line to perform outline move operations*/
+//#define OUTLINE_MOVE
+
+void redraw_ncarea(win *window)
+{
+	GR_WINDOW_INFO info;
+	GR_WM_PROPERTIES props;
+	GR_BOOL active;
+
+	Dprintf("container_exposure window %d\n", window->wid);
+
+	GrGetWindowInfo(window->wid, &info);
+
+	GrGetWMProperties(window->clientid, &props);
+
+	/*
+	 * Check for invalid window.  This will be the
+	 * case if the client exited, and we're just
+	 * getting the paint notification for our parent.
+	 */
+	if (props.flags == 0)
+		return;
+
+	active = (window->clientid == GrGetFocus());
+	nxPaintNCArea(window->wid, info.width, info.height, props.title,
+		active, props.props);
+}
+
+void container_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	Dprintf("container_exposure window %d\n", window->wid);
+
+	redraw_ncarea(window);
+}
+
+static GR_BOOL
+PtInRect(GR_RECT *prc, GR_SIZE x, GR_SIZE y)
+{
+	return (x >= prc->x && x < (prc->x+prc->width) &&
+		y >= prc->y && y < (prc->y+prc->height));
+}
+
+void container_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	struct pos_size *pos;
+	GR_RECT		r;
+	GR_COORD	cxborder = 0, cyborder = 0;
+	GR_WINDOW_INFO	info;
+	GR_GC_ID        gc;
+	Dprintf("container_buttondown window %d\n", window->wid);
+
+	if(window->active) return;
+
+	GrGetWindowInfo(window->wid, &info);
+
+	/* calc border sizes*/
+	if (info.props & GR_WM_PROPS_BORDER) {
+		cxborder = 1;
+		cyborder = 1;
+	}
+	if (info.props & GR_WM_PROPS_APPFRAME) {
+		cxborder = CXBORDER;
+		cyborder = CYBORDER;
+	}
+
+	/* Check for close box press*/
+	if ((info.props & (GR_WM_PROPS_CAPTION|GR_WM_PROPS_CLOSEBOX)) ==
+	    (GR_WM_PROPS_CAPTION|GR_WM_PROPS_CLOSEBOX)) {
+
+		/* Get close box rect*/
+		r.x = info.width - CXCLOSEBOX - cxborder - 2;
+		r.y = cyborder + 2;
+		r.width = CXCLOSEBOX;
+		r.height = CYCLOSEBOX;
+
+		/* Check mousedn in close box*/
+		if (PtInRect(&r, event->x, event->y)) {
+			/* this may or not close the window...*/
+			GrCloseWindow(window->clientid);
+			return;
+		}
+	}
+
+	/* Set focus on button down*/
+	GrSetFocus(window->clientid);
+
+	/* check for corner resize */
+	r.x = info.width - 5;
+	r.y = info.height - 5;
+	r.width = 5;
+	r.height = 5;
+
+	if(PtInRect(&r,event->x, event->y)) {
+
+	  struct pos_size * pos;
+
+	  if(!window->data)
+	    if(!(window->data = malloc(sizeof(struct pos_size)))) return;
+
+	  window->sizing = GR_TRUE;
+	  pos = (struct pos_size*)window->data;
+	  
+	  // save off the width/height offset from the window manager
+	  GrGetWindowInfo(window->clientid,&info);
+	  pos->xoff = -info.width;
+	  pos->yoff = -info.height;
+
+	  GrGetWindowInfo(window->wid,&info);
+	  pos->xoff += info.width;
+	  pos->yoff += info.height;
+
+	  gc = GrNewGC();
+	  GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
+	  GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, info.width, info.height);
+	  GrDestroyGC(gc);
+
+	  // save this rectangle's width/height so we can erase it later
+	  pos->width = info.width;
+	  pos->height = info.height;
+
+	  return;
+	}
+
+	/* if not in caption, return (FIXME, not calc'd exactly)*/
+	if (!(info.props & GR_WM_PROPS_CAPTION))
+		return;
+
+	/* Get caption box rect*/
+	r.x = cxborder;
+	r.y = cyborder;
+	r.width = info.width - cxborder*2;
+	r.height = CYCAPTION;
+
+	/* Check for mousedn in caption box*/
+	if (!PtInRect(&r, event->x, event->y))
+		return;
+
+	/* Raise window if mouse down and allowed*/
+	if (!(info.props & GR_WM_PROPS_NORAISE))
+		GrRaiseWindow(window->wid);
+
+	/* Don't allow window move if NOMOVE property set*/
+	if (info.props & GR_WM_PROPS_NOMOVE)
+		return;
+
+	if(!window->data)
+		if(!(window->data = malloc(sizeof(struct pos_size)))) return;
+
+	pos = (struct pos_size *) window->data;
+
+	GrGetWindowInfo(window->wid,&info);
+	
+	pos->xoff = event->x;
+	pos->yoff = event->y;
+
+#ifdef OUTLINE_MOVE
+	pos->xorig = info.x;
+	pos->yorig = info.y;
+	pos->width = info.width;
+	pos->height = info.height;
+
+	gc = GrNewGC();
+	GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
+	GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, info.width, info.height);
+	GrDestroyGC(gc);
+#endif	
+	window->active = GR_TRUE;
+}
+
+void container_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("container_buttonup window %d\n", window->wid);
+
+	if(window->active) {
+	  struct pos_size * pos = (struct pos_size *)window->data;
+#ifdef OUTLINE_MOVE
+	  GR_GC_ID gc;	  
+	  gc = GrNewGC();
+	  GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
+	  GrRect(GR_ROOT_WINDOW_ID,gc,pos->xorig, pos->yorig, pos->width, pos->height);
+
+	  GrMoveWindow(window->wid, pos->xorig, pos->yorig);
+
+#endif
+	  free(pos);
+	  window->active = GR_FALSE;
+	  window->data = 0;
+	}
+	
+	if(window->sizing) {
+	  GR_WINDOW_INFO info;
+	  GR_GC_ID gc;
+
+	  struct pos_size * pos = (struct pos_size *)window->data;
+
+	  gc = GrNewGC();
+	  GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
+
+	  GrGetWindowInfo(window->wid, &info);
+
+	  GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, pos->width, pos->height);
+
+	  GrResizeWindow(window->wid,event->rootx - info.x, event->rooty - info.y);
+	  GrResizeWindow(window->clientid,event->rootx - info.x - pos->xoff, 
+			 event->rooty - info.y - pos->yoff);
+	  GrDestroyGC(gc);
+	  free(window->data);
+	  window->sizing = GR_FALSE;
+	  window->data = 0;
+	}
+}
+
+void container_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	struct pos_size *pos;
+	GR_WINDOW_INFO info;
+	GR_GC_ID gc;
+
+	Dprintf("container_mousemoved window %d\n", window->wid);
+
+	if(window->sizing) {
+
+	  struct pos_size * pos = (struct pos_size*)window->data;
+	  GrGetWindowInfo(window->wid, &info);
+
+	  gc = GrNewGC();
+	  GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
+
+	  // erase old rectangle
+	  GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, pos->width, pos->height);
+	  // draw new one
+	  GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, 
+		 event->rootx - info.x, event->rooty - info.y);
+	  GrDestroyGC(gc);
+
+	  // save this new rectangle's width, height
+	  // I know, this shouldn't be stored in x/y, but...
+	  pos->width = event->rootx - info.x;
+	  pos->height = event->rooty - info.y;
+
+	  return;
+	}
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+#ifdef OUTLINE_MOVE
+	gc = GrNewGC();
+	GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
+	GrRect(GR_ROOT_WINDOW_ID,gc,pos->xorig, pos->yorig, pos->width, pos->height);
+	GrRect(GR_ROOT_WINDOW_ID,gc,event->rootx - pos->xoff, event->rooty - pos->yoff,
+	       pos->width, pos->height);
+
+	pos->xorig = event->rootx - pos->xoff;
+	pos->yorig = event->rooty - pos->yoff;
+	
+	GrDestroyGC(gc);
+#else	
+	GrMoveWindow(window->wid, event->rootx - pos->xoff,
+		event->rooty - pos->yoff);
+#endif
+}
+
+#if 0000
+void topbar_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	win *pwin = find_window(window->pid);
+	struct clientinfo *ci = pwin->data;
+	GR_WM_PROPERTIES prop;
+
+	Dprintf("topbar_exposure window %d\n", window->wid);
+
+	GrGetWMProperties(ci->cid, &prop);
+	if (prop.title)
+		GrText(window->wid, buttonsgc, 0, 0, prop.title, -1,
+			GR_TFASCII|GR_TFTOP);
+}
+
+void closebutton_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	Dprintf("closebutton_exposure window %d\n", window->wid);
+
+	GrBitmap(window->wid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT,
+		TITLE_BAR_HEIGHT, window->active ? closebutton_pressed :
+						closebutton_notpressed);
+}
+
+void topbar_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	struct position *pos;
+
+	Dprintf("topbar_buttondown window %d\n", window->wid);
+
+	GrRaiseWindow(window->pid);
+
+	if(window->active) return;
+
+	if(!window->data)
+		if(!(window->data = malloc(sizeof(struct position)))) return;
+
+	pos = (struct position *) window->data;
+
+	pos->x = event->x + TITLE_BAR_HEIGHT;	/* actually width*/
+	pos->y = event->y;
+
+	window->active = GR_TRUE;
+}
+
+void resizebar_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	GR_WINDOW_INFO wi;
+	struct pos_size *pos;
+
+	Dprintf("resizebar_buttondown window %d\n", window->wid);
+
+	GrRaiseWindow(window->pid);
+
+	if(window->active) return;
+
+	if(!window->data)
+		if(!(window->data = malloc(sizeof(struct pos_size)))) return;
+
+	pos = (struct pos_size *) window->data;
+
+	GrGetWindowInfo(window->pid, &wi);
+
+	pos->xoff = event->x;
+	pos->yoff = event->y;
+	pos->xorig = wi.x;
+	pos->yorig = wi.y;
+	pos->width = wi.width;
+	pos->height = wi.height;
+
+	window->active = GR_TRUE;
+}
+
+void closebutton_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("closebutton_buttondown window %d\n", window->wid);
+
+	GrRaiseWindow(window->pid);
+
+	window->active = GR_TRUE;
+	closebutton_exposure(window, NULL);
+}
+
+
+void topbar_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("topbar_buttonup window %d\n", window->wid);
+
+	window->active = GR_FALSE;
+}
+
+void closebutton_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	win *pwin = find_window(window->pid);
+	struct clientinfo *ci = pwin->data;
+
+	Dprintf("closebutton_buttonup window %d\n", window->wid);
+
+	window->active = GR_FALSE;
+	closebutton_exposure(window, NULL);
+
+	GrCloseWindow(ci->cid);
+}
+
+void topbar_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	struct position *pos;
+	GR_WM_PROPERTIES props;
+
+	Dprintf("topbar_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct position *) window->data;
+
+	/* turn off background erase draw while moving*/
+	GrGetWMProperties(window->pid, &props);
+	props.flags = GR_WM_FLAGS_PROPS;
+	props.props |= GR_WM_PROPS_NOBACKGROUND;
+	GrSetWMProperties(window->pid, &props);
+
+	GrMoveWindow(window->pid, event->rootx - pos->x,
+			event->rooty - pos->y);
+
+	props.props &= ~GR_WM_PROPS_NOBACKGROUND;
+	GrSetWMProperties(window->pid, &props);
+}
+
+void leftbar_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	GR_COORD newx;
+	GR_SIZE newwidth;
+	struct pos_size *pos;
+
+	Dprintf("leftbar_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+	newx = event->rootx - pos->xoff;
+	newwidth = pos->width + pos->xorig - event->rootx - pos->xoff;
+
+	GrMoveWindow(window->pid, newx, pos->yorig);
+	GrResizeWindow(window->pid, newwidth, pos->height);
+}
+
+void leftresize_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	GR_COORD newx;
+	GR_SIZE newwidth, newheight;
+	struct pos_size *pos;
+
+	Dprintf("leftresize_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+	newx = event->rootx - pos->xoff;
+	newheight = event->rooty - pos->yorig;
+	newwidth = pos->width + pos->xorig - event->rootx - pos->xoff;
+
+	GrMoveWindow(window->pid, newx, pos->yorig);
+	GrResizeWindow(window->pid, newwidth, newheight);
+}
+
+void bottombar_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	GR_SIZE newheight;
+	struct pos_size *pos;
+
+	Dprintf("bottombar_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+	newheight = event->rooty - pos->yorig;
+
+	GrResizeWindow(window->pid, pos->width, newheight);
+}
+
+void rightresize_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	GR_SIZE newwidth, newheight;
+	struct pos_size *pos;
+
+	Dprintf("rightresize_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+	newheight = event->rooty - pos->yorig;
+	newwidth = event->rootx - pos->xorig;
+
+	GrResizeWindow(window->pid, newwidth, newheight);
+}
+
+void rightbar_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	GR_SIZE newwidth;
+	struct pos_size *pos;
+
+	Dprintf("rightbar_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+	newwidth = event->rootx - pos->xorig;
+
+	GrResizeWindow(window->pid, newwidth, pos->height);
+
+}
+#endif /* 0000*/
diff -urN lib/microwindows/src/demos/nanowm/clients.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/clients.c
--- lib/microwindows/src/demos/nanowm/clients.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/clients.c	2005-02-21 16:12:53.000000000 +0100
@@ -0,0 +1,370 @@
+/*
+ * NanoWM - Window Manager for Nano-X
+ *
+ * Copyright (C) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+#include "nxdraw.h"
+/* Uncomment this if you want debugging output from this file */
+//#define DEBUG
+#include "nanowm.h"
+
+/* default window style for GR_WM_PROPS_APPWINDOW*/
+#define DEFAULT_WINDOW_STYLE	(GR_WM_PROPS_APPFRAME | GR_WM_PROPS_CAPTION |\
+					GR_WM_PROPS_CLOSEBOX)
+
+static GR_COORD lastx = FIRST_WINDOW_LOCATION;
+static GR_COORD lasty = FIRST_WINDOW_LOCATION;
+
+/*
+ * A new client window has been mapped, so we need to reparent and decorate it.
+ * Returns -1 on failure or 0 on success.
+ */
+int new_client_window(GR_WINDOW_ID wid)
+{
+	win window;
+	GR_WINDOW_ID pid;
+	GR_WINDOW_INFO winfo;
+	GR_COORD x, y, width, height, xoffset, yoffset;
+	GR_WM_PROPS style;
+	GR_WM_PROPERTIES props;
+
+	/* get client window information*/
+	GrGetWindowInfo(wid, &winfo);
+	style = winfo.props;
+
+	/* if not redecorating or not child of root window, return*/
+	if (winfo.parent != GR_ROOT_WINDOW_ID ||
+	    (style & GR_WM_PROPS_NODECORATE))
+		return 0;
+
+	/* deal with replacing borders with window decorations*/
+	if (winfo.bordersize) {
+		/*
+		 * For complex reasons, it's easier to unmap,
+		 * remove the borders, and then map again,
+		 * rather than try to recalculate the window
+		 * position in the server w/o borders.  By
+		 * the time we get this event, the window has
+		 * already been painted with borders...
+		 * This currently causes a screen flicker as
+		 * the window is painted twice.  The workaround
+		 * is to create the window without borders in
+		 * the first place.
+		 */
+		GrUnmapWindow(wid);
+
+		/* remove client borders, if any*/
+		props.flags = style | GR_WM_FLAGS_BORDERSIZE;
+		props.bordersize = 0;
+		GrSetWMProperties(wid, &props);
+
+		/* remap the window without borders, call this routine again*/
+		GrMapWindow(wid);
+		return 0;
+	}
+	
+	/* if default decoration style asked for, set real draw bits*/
+	if ((style & GR_WM_PROPS_APPMASK) == GR_WM_PROPS_APPWINDOW) {
+		GR_WM_PROPERTIES pr;
+
+		style = (style & ~GR_WM_PROPS_APPMASK)|DEFAULT_WINDOW_STYLE;
+		pr.flags = GR_WM_FLAGS_PROPS;
+		pr.props = style;
+		GrSetWMProperties(wid, &pr);
+	}
+
+	/* determine container widths and client child window offsets*/
+	if (style & GR_WM_PROPS_APPFRAME) {
+		width = winfo.width + CXFRAME;
+		height = winfo.height + CYFRAME;
+		xoffset = CXBORDER;
+		yoffset = CYBORDER;
+	} else if (style & GR_WM_PROPS_BORDER) {
+		width = winfo.width + 2;
+		height = winfo.height + 2;
+		xoffset = 1;
+		yoffset = 1;
+	} else {
+		width = winfo.width;
+		height = winfo.height;
+		xoffset = 0;
+		yoffset = 0;
+	}
+	if (style & GR_WM_PROPS_CAPTION) {
+		height += CYCAPTION;
+		yoffset += CYCAPTION;
+		if (style & GR_WM_PROPS_APPFRAME) {
+			/* extra line under caption with appframe*/
+			++height;
+			++yoffset;
+		}
+	}
+
+	/* determine x,y window location*/
+	if (style & GR_WM_PROPS_NOAUTOMOVE) {
+		x = winfo.x;
+		y = winfo.y;
+	} else {
+		/* We could proably use a more intelligent algorithm here */
+		x = lastx + WINDOW_STEP;
+		if((x + width) > si.cols)
+			x = FIRST_WINDOW_LOCATION;
+		lastx = x;
+		y = lasty + WINDOW_STEP;
+		if((y + height) > si.rows)
+			y = FIRST_WINDOW_LOCATION;
+		lasty = y;
+	}
+
+	/* create container window*/
+	pid = GrNewWindow(GR_ROOT_WINDOW_ID, x, y, width, height,
+		0, LTGRAY, BLACK);
+	window.wid = pid;
+	window.pid = GR_ROOT_WINDOW_ID;
+	window.type = WINDOW_TYPE_CONTAINER;
+	window.active = 0;
+	window.data = NULL;
+	window.clientid = wid;
+	add_window(&window);
+
+	/* don't erase background of container window*/
+	props.flags = GR_WM_FLAGS_PROPS;
+	props.props = style | GR_WM_PROPS_NOBACKGROUND;
+	GrSetWMProperties(pid, &props);
+
+	Dprintf("New client window %d container %d\n", wid, pid);
+
+	GrSelectEvents(pid, GR_EVENT_MASK_CHLD_UPDATE
+		| GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_BUTTON_DOWN
+		| GR_EVENT_MASK_MOUSE_POSITION | GR_EVENT_MASK_EXPOSURE);
+
+	/* reparent client to container window*/
+	/* must map before reparent (nano-x bug)*/
+	GrMapWindow(pid);
+	GrReparentWindow(wid, pid, xoffset, yoffset);
+
+	GrSetFocus(wid);	/* force fixed focus*/
+
+	/* add client window*/
+	window.wid = wid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_CLIENT;
+	window.active = 0;
+	window.clientid = 0;
+	window.data = NULL;
+	add_window(&window);
+
+#if 0000
+	/* add system utility button*/
+	nid = GrNewWindow(pid, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0,
+							LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_UTILITYBUTTON;
+	window.active = GR_FALSE;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_EXPOSURE
+				| GR_EVENT_MASK_MOUSE_EXIT);
+	GrMapWindow(nid);
+	GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
+						utilitybutton_notpressed);
+
+	nid = GrNewWindow(pid, TITLE_BAR_HEIGHT + 1, 1, width - (4 *
+			TITLE_BAR_HEIGHT) - 3, TITLE_BAR_HEIGHT - 3, 1, LTGRAY,
+								BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_TOPBAR;
+	window.active = GR_FALSE;
+	window.data = NULL;
+
+	add_window(&window);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_EXPOSURE
+				| GR_EVENT_MASK_MOUSE_POSITION);
+	GrMapWindow(nid);
+
+	nid = GrNewWindow(pid, width - (3 * TITLE_BAR_HEIGHT), 0,
+			TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_ICONISEBUTTON;
+	window.active = GR_FALSE;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_EXPOSURE
+				| GR_EVENT_MASK_MOUSE_EXIT);
+	GrMapWindow(nid);
+	GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
+						iconisebutton_notpressed);
+
+	nid = GrNewWindow(pid, width - (2 * TITLE_BAR_HEIGHT), 0,
+			TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_MAXIMISEBUTTON;
+	window.active = GR_FALSE;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_EXPOSURE
+				| GR_EVENT_MASK_MOUSE_EXIT);
+	GrMapWindow(nid);
+	GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
+						maximisebutton_notpressed);
+
+	nid = GrNewWindow(pid, width - TITLE_BAR_HEIGHT, 0,
+			TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_CLOSEBUTTON;
+	window.active = GR_FALSE;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_EXPOSURE
+				| GR_EVENT_MASK_MOUSE_EXIT);
+	GrMapWindow(nid);
+	GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
+						closebutton_notpressed);
+
+	nid = GrNewWindow(pid, 1, TITLE_BAR_HEIGHT + 1, BORDER_WIDTHS - 2,
+				height - TITLE_BAR_HEIGHT - BORDER_WIDTHS - 1,
+				1, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_LEFTBAR;
+	window.active = GR_FALSE;
+	window.data = NULL;
+
+	add_window(&window);
+
+	GrSetCursor(nid, horizontal_resize_columns, horizontal_resize_rows,
+			horizontal_resize_hotx, horizontal_resize_hoty,
+			BLACK, WHITE, horizontal_resize_fg,
+			horizontal_resize_bg);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_MOUSE_POSITION);
+
+	GrMapWindow(nid);
+
+	nid = GrNewWindow(pid, 1, height - BORDER_WIDTHS + 1, BORDER_WIDTHS - 2,
+					BORDER_WIDTHS - 2, 1, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_LEFTRESIZE;
+	window.active = GR_FALSE;
+	window.data = NULL;
+
+
+	add_window(&window);
+
+	GrSetCursor(nid, lefthand_resize_columns, lefthand_resize_rows,
+			lefthand_resize_hotx, lefthand_resize_hoty,
+			BLACK, WHITE, lefthand_resize_fg, lefthand_resize_bg);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_MOUSE_POSITION);
+
+	GrMapWindow(nid);
+
+	nid = GrNewWindow(pid, BORDER_WIDTHS, height - BORDER_WIDTHS + 1,
+			width - (2 * BORDER_WIDTHS), BORDER_WIDTHS - 2, 1,
+							LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_BOTTOMBAR;
+	window.active = GR_FALSE;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSetCursor(nid, vertical_resize_columns, vertical_resize_rows,
+			vertical_resize_hotx, vertical_resize_hoty,
+			BLACK, WHITE, vertical_resize_fg, vertical_resize_bg);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_MOUSE_POSITION);
+
+	GrMapWindow(nid);
+
+	nid = GrNewWindow(pid, width - BORDER_WIDTHS + 1,
+			height - BORDER_WIDTHS + 1, BORDER_WIDTHS - 2,
+					BORDER_WIDTHS - 2, 1, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_RIGHTRESIZE;
+	window.active = GR_FALSE;
+	window.data = NULL;
+
+	add_window(&window);
+
+	GrSetCursor(nid, righthand_resize_columns, righthand_resize_rows,
+			righthand_resize_hotx, righthand_resize_hoty,
+			BLACK, WHITE, righthand_resize_fg, righthand_resize_bg);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_MOUSE_POSITION);
+
+	GrMapWindow(nid);
+
+	nid = GrNewWindow(pid, width - BORDER_WIDTHS + 1, TITLE_BAR_HEIGHT + 1,
+		BORDER_WIDTHS - 2, height - TITLE_BAR_HEIGHT - BORDER_WIDTHS -1,
+							 1, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_RIGHTBAR;
+	window.active = GR_FALSE;
+	window.data = NULL;
+
+	add_window(&window);
+
+	GrSetCursor(nid, horizontal_resize_columns, horizontal_resize_rows,
+			horizontal_resize_hotx, horizontal_resize_hoty,
+			BLACK, WHITE, horizontal_resize_fg,
+			horizontal_resize_bg);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_MOUSE_POSITION);
+	GrMapWindow(nid);
+#endif
+	return 0;
+}
+
+/*
+ * We've just received an event notifying us that a client window has been
+ * unmapped, so we need to destroy all of the decorations.
+ */
+void client_window_destroy(win *window)
+{
+	win *pwin;
+	GR_WINDOW_ID pid;
+
+	Dprintf("Client window %d has been destroyed\n", window->wid);
+
+	if(!(pwin = find_window(window->pid))) {
+		fprintf(stderr, "Couldn't find parent of destroyed window "
+				"%d\n", window->wid);
+		return;
+	}
+
+	/* Do it this way around so we don't handle events after destroying */
+	pid = pwin->wid;
+	remove_window_and_children(pwin);
+
+	Dprintf("Destroying container %d\n", pid);
+	GrDestroyWindow(pid);
+}
diff -urN lib/microwindows/src/demos/nanowm/events.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/events.c
--- lib/microwindows/src/demos/nanowm/events.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/events.c	2005-02-21 16:12:53.000000000 +0100
@@ -0,0 +1,201 @@
+/*
+ * NanoWM - Window Manager for Nano-X
+ *
+ * Copyright (C) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+/* Uncomment this if you want debugging output from this file */
+//#define DEBUG
+#include "nanowm.h"
+
+void do_exposure(GR_EVENT_EXPOSURE *event)
+{
+	win *window;
+
+	Dprintf("do_exposure: wid %d, x %d, y %d, width %d, height %d\n",
+		event->wid, event->x, event->y, event->width, event->height);
+
+	if(!(window = find_window(event->wid))) return;
+
+	switch(window->type) {
+		case WINDOW_TYPE_CONTAINER:
+			container_exposure(window, event);
+			break;
+		default:
+			printf("Unhandled exposure on window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+
+}
+
+void do_button_down(GR_EVENT_BUTTON *event)
+{
+	win *window;
+
+	Dprintf("do_button_down: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
+		"y %d, buttons %d, changebuttons %d, modifiers %d\n",
+		event->wid, event->subwid, event->rootx, event->rooty, event->x,
+		event->y, event->buttons, event->changebuttons,
+		event->modifiers);
+
+	if(!(window = find_window(event->wid))) return;
+
+	switch(window->type) {
+		case WINDOW_TYPE_CONTAINER:
+			container_buttondown(window, event);
+			break;
+		default:
+			printf("Unhandled button down on window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_button_up(GR_EVENT_BUTTON *event)
+{
+	win *window;
+
+	Dprintf("do_button_up: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
+		"y %d, buttons %d, changebuttons %d, modifiers %d\n",
+		event->wid, event->subwid, event->rootx, event->rooty, event->x,
+		event->y, event->buttons, event->changebuttons,
+		event->modifiers);
+
+	if(!(window = find_window(event->wid))) return;
+
+	switch(window->type) {
+		case WINDOW_TYPE_CONTAINER:
+			container_buttonup(window, event);
+			break;
+		default:
+			printf("Unhandled button up on window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_mouse_enter(GR_EVENT_GENERAL *event)
+{
+	win *window;
+
+	Dprintf("do_mouse_enter: wid %d\n", event->wid);
+
+	if(!(window = find_window(event->wid)))
+		return;
+
+	switch(window->type) {
+		default:
+			printf("Unhandled mouse enter from window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_mouse_exit(GR_EVENT_GENERAL *event)
+{
+	win *window;
+
+	Dprintf("do_mouse_exit: wid %d\n", event->wid);
+
+	if(!(window = find_window(event->wid))) return;
+
+	switch(window->type) {
+		default:
+			printf("Unhandled mouse exit from window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_mouse_moved(GR_EVENT_MOUSE *event)
+{
+	win *window;
+
+	Dprintf("do_mouse_moved: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
+		"y %d, buttons %d, modifiers %d\n", event->wid, event->subwid,
+		event->rootx, event->rooty, event->x, event->y, event->buttons,
+		event->modifiers);
+
+	if(!(window = find_window(event->wid))) return;
+
+	switch(window->type) {
+		case WINDOW_TYPE_CONTAINER:
+			container_mousemoved(window, event);
+			break;
+		default:
+			printf("Unhandled mouse movement in window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_focus_in(GR_EVENT_GENERAL *event)
+{
+	win *window;
+
+	printf("do_focus_in: wid %d\n", event->wid);
+
+	if(!(window = find_window(event->wid)))
+		return;
+
+	switch(window->type) {
+		default:
+			printf("Unhandled focus in from window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_key_down(GR_EVENT_KEYSTROKE *event)
+{
+	Dprintf("do_key_down: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
+		"y %d, buttons %d, modifiers %d, uch %lu, special %d, "
+		"ch %d, content %d\n", event->wid, event->subwid, event->rootx,
+		event->rooty, event->x, event->y, event->buttons,
+		event->modifiers, event->uch, event->special, event->ch,
+		event->content);
+
+	/* FIXME: Implement keyboard shortcuts */
+}
+
+void do_key_up(GR_EVENT_KEYSTROKE *event)
+{
+	Dprintf("do_key_up: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
+		"y %d, buttons %d, modifiers %d, uch %lu, special %d, "
+		"ch %d, content %d\n", event->wid, event->subwid, event->rootx,
+		event->rooty, event->x, event->y, event->buttons,
+		event->modifiers, event->uch, event->special, event->ch,
+		event->content);
+}
+
+void do_update(GR_EVENT_UPDATE *event)
+{
+	win *window;
+
+	Dprintf("do_update: wid %d, subwid %d, x %d, y %d, width %d, height %d, "
+		"utype %d\n", event->wid, event->subwid, event->x, event->y, event->width,
+		event->height, event->utype);
+
+	if(!(window = find_window(event->subwid))) {
+		if (event->utype == GR_UPDATE_MAP)
+			new_client_window(event->subwid);
+		return;
+	}
+
+	if(window->type == WINDOW_TYPE_CONTAINER) {
+		if (event->utype == GR_UPDATE_ACTIVATE)
+			redraw_ncarea(window);
+		return;
+	}
+
+	if(window->type != WINDOW_TYPE_CLIENT)
+		return;
+
+	if(event->utype == GR_UPDATE_DESTROY)
+		client_window_destroy(window);
+}
diff -urN lib/microwindows/src/demos/nanowm/nanowm.2 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/nanowm.2
--- lib/microwindows/src/demos/nanowm/nanowm.2	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/nanowm.2	2005-02-21 16:12:54.000000000 +0100
@@ -0,0 +1,195 @@
+/*
+ * NanoWM- the NanoGUI window manager.
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+
+#ifndef __NANOWM_H
+#define __NANOWM_H
+
+#ifdef DEBUG
+#define Dprintf printf
+#else
+#define Dprintf(ignore...)
+#endif
+
+/* Where to place the first window on the screen */
+#define FIRST_WINDOW_LOCATION 2
+
+/* The distance to leave between windows when deciding where to place */
+#define WINDOW_STEP 20
+
+/* The different window types which can be used in windowlist->type */
+enum {
+	WINDOW_TYPE_ROOT,
+	WINDOW_TYPE_CONTAINER,
+	WINDOW_TYPE_CLIENT
+	/***WINDOW_TYPE_TOPBAR,
+	WINDOW_TYPE_LEFTBAR,
+	WINDOW_TYPE_RIGHTBAR,
+	WINDOW_TYPE_BOTTOMBAR,
+	WINDOW_TYPE_LEFTRESIZE,
+	WINDOW_TYPE_RIGHTRESIZE,
+	WINDOW_TYPE_CLOSEBUTTON,
+	WINDOW_TYPE_MAXIMISEBUTTON,
+	WINDOW_TYPE_RESTOREBUTTON,
+	WINDOW_TYPE_ICONISEBUTTON,
+	WINDOW_TYPE_ICON,
+	WINDOW_TYPE_UTILITYBUTTON,
+	WINDOW_TYPE_UTILITYMENU,
+	WINDOW_TYPE_UTILITYMENUENTRY,
+	WINDOW_TYPE_ROOTMENU,
+	WINDOW_TYPE_ROOTMENUENTRY**/
+};
+
+/* 
+ * Used to keep a list of all the windows we know about so we can quickly
+ * find out whether a window is "one of ours", and if it is, what kind of
+ * window it is (title bar, side bar, button, icon, root menu, etc.), who
+ * it's a child of, and any special data associated with it (the title
+ * used in the title, the text of a root menu entry, the pixmap of an
+ * icon, etc.).
+ */
+struct windowlist {
+	GR_WINDOW_ID wid;	/* The ID of this window */
+	GR_WINDOW_ID pid;	/* The ID of this window's parent */
+	GR_WINDOW_ID clientid;	/* clientid for container window*/
+	int type;		/* What kind of window this is */
+	int active;		/* Whether this window is active or not */
+	void *data;		/* Data associated with this window */
+	struct windowlist *next; /* The next window in the list */
+};
+typedef struct windowlist win;
+
+/*
+ * Used to record the offset position when performing a move.
+ */
+struct position {
+	GR_COORD x;
+	GR_COORD y;
+};
+
+/*
+ * Used to record the original position, original size, and offset position
+ * when performing a resize.
+ */
+struct pos_size {
+	GR_COORD xoff;
+	GR_COORD yoff;
+	GR_COORD xorig;
+	GR_COORD yorig;
+	GR_SIZE width;
+	GR_SIZE height;
+};
+
+#if 0000
+/*
+ * Used to record some general information about the client.
+ */
+struct clientinfo {
+	GR_WINDOW_ID cid;
+};
+#endif
+
+/* Function prototypes */
+win *find_window(GR_WINDOW_ID wid);
+int add_window(win *window);
+int remove_window(win *window);
+int remove_window_and_children(win *window);
+int new_client_window(GR_WINDOW_ID wid);
+void client_window_destroy(win *window);
+void redraw_ncarea(win *window);
+void do_exposure(GR_EVENT_EXPOSURE *event);
+void do_button_down(GR_EVENT_BUTTON *event);
+void do_button_up(GR_EVENT_BUTTON *event);
+void do_mouse_enter(GR_EVENT_GENERAL *event);
+void do_mouse_exit(GR_EVENT_GENERAL *event);
+void do_mouse_moved(GR_EVENT_MOUSE *event);
+void do_focus_in(GR_EVENT_GENERAL *event);
+void do_key_down(GR_EVENT_KEYSTROKE *event);
+void do_key_up(GR_EVENT_KEYSTROKE *event);
+void do_focus_in(GR_EVENT_GENERAL *event);
+void do_focus_out(GR_EVENT_GENERAL *event);
+void do_update(GR_EVENT_UPDATE *event);
+void do_chld_update(GR_EVENT_UPDATE *event);
+void rootwindow_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void container_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void topbar_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void closebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void maximisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void restorebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void iconisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void utilitybutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void utilitymenu_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void utilitymenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void rootmenu_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void rootmenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void icon_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void rootwindow_buttondown(win *window, GR_EVENT_BUTTON *event);
+void container_buttondown(win *window, GR_EVENT_BUTTON *event);
+void topbar_buttondown(win *window, GR_EVENT_BUTTON *event);
+void resizebar_buttondown(win *window, GR_EVENT_BUTTON *event);
+void closebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void maximisebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void restorebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void iconisebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void utilitybutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void icon_buttondown(win *window, GR_EVENT_BUTTON *event);
+void rootwindow_buttonup(win *window, GR_EVENT_BUTTON *event);
+void container_buttonup(win *window, GR_EVENT_BUTTON *event);
+void topbar_buttonup(win *window, GR_EVENT_BUTTON *event);
+void resizebar_buttonup(win *window, GR_EVENT_BUTTON *event);
+void closebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void maximisebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void restorebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void iconisebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void utilitybutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void icon_buttonup(win *window, GR_EVENT_BUTTON *event);
+void utilitymenuentry_buttonup(win *window, GR_EVENT_BUTTON *event);
+void rootmenuentry_buttonup(win *window, GR_EVENT_BUTTON *event);
+void closebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void maximisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void restorebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void iconisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void utilitybutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void utilitymenu_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void utilitymenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void rootmenu_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void rootmenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void container_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void topbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void leftbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void leftresize_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void bottombar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void rightresize_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void rightbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+
+extern GR_SCREEN_INFO si;
+extern win *windows;
+extern GR_BITMAP utilitybutton_notpressed[];
+extern GR_BITMAP utilitybutton_pressed[];
+extern GR_BITMAP maximisebutton_notpressed[];
+extern GR_BITMAP maximisebutton_pressed[];
+extern GR_BITMAP iconisebutton_notpressed[];
+extern GR_BITMAP iconisebutton_pressed[];
+extern GR_BITMAP closebutton_notpressed[];
+extern GR_BITMAP closebutton_pressed[];
+extern GR_BITMAP restorebutton_notpressed[];
+extern GR_BITMAP restorebutton_pressed[];
+extern GR_BITMAP horizontal_resize_fg[];
+extern GR_BITMAP horizontal_resize_bg[];
+extern GR_BITMAP vertical_resize_fg[];
+extern GR_BITMAP vertical_resize_bg[];
+extern GR_BITMAP righthand_resize_fg[];
+extern GR_BITMAP righthand_resize_bg[];
+extern GR_BITMAP lefthand_resize_fg[];
+extern GR_BITMAP lefthand_resize_bg[];
+extern int horizontal_resize_columns, horizontal_resize_rows;
+extern int horizontal_resize_hotx, horizontal_resize_hoty;
+extern int vertical_resize_columns, vertical_resize_rows;
+extern int vertical_resize_hotx, vertical_resize_hoty;
+extern int lefthand_resize_columns, lefthand_resize_rows;
+extern int lefthand_resize_hotx, lefthand_resize_hoty;
+extern int righthand_resize_columns, righthand_resize_rows;
+extern int righthand_resize_hotx, righthand_resize_hoty;
+
+#endif
diff -urN lib/microwindows/src/demos/nanowm/nanowm.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/nanowm.c
--- lib/microwindows/src/demos/nanowm/nanowm.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/nanowm.c	2005-02-21 16:12:54.000000000 +0100
@@ -0,0 +1,95 @@
+/*
+ * NanoWM - Window Manager for Nano-X
+ *
+ * Copyright (C) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ * Parts based on npanel.c Copyright (C) 1999 Alistair Riddoch.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+/* Uncomment this if you want debugging output from this file */
+/* #define DEBUG */
+#include "nanowm.h"
+
+GR_SCREEN_INFO si;
+
+int main(int argc, char *argv[])
+{
+	GR_EVENT event;
+	GR_WM_PROPERTIES props;
+	win window;
+
+	if(GrOpen() < 0) {
+		fprintf(stderr, "Couldn't connect to Nano-X server!\n");
+		exit(1);
+	}
+
+	/* pass errors through main loop, don't exit*/
+	GrSetErrorHandler(NULL);
+
+	GrGetScreenInfo(&si);
+
+	/* add root window*/
+	window.wid = GR_ROOT_WINDOW_ID;
+	window.pid = GR_ROOT_WINDOW_ID;
+	window.type = WINDOW_TYPE_ROOT;
+	window.clientid = 1;
+	window.active = 0;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_CHLD_UPDATE);
+
+	/* Set new root window background color*/
+	props.flags = GR_WM_FLAGS_BACKGROUND;
+	props.background = GrGetSysColor(GR_COLOR_DESKTOP);
+	GrSetWMProperties(GR_ROOT_WINDOW_ID, &props);
+
+	while(1) { 
+		GrGetNextEvent(&event);
+
+		switch(event.type) {
+			case GR_EVENT_TYPE_ERROR:
+				printf("nanowm: error %d\n", event.error.code);
+				break;
+			case GR_EVENT_TYPE_EXPOSURE:
+				do_exposure(&event.exposure);
+				break;
+			case GR_EVENT_TYPE_BUTTON_DOWN:
+				do_button_down(&event.button);
+				break;
+			case GR_EVENT_TYPE_BUTTON_UP:
+				do_button_up(&event.button);
+				break;
+			case GR_EVENT_TYPE_MOUSE_ENTER:
+				do_mouse_enter(&event.general);
+				break;
+			case GR_EVENT_TYPE_MOUSE_EXIT:
+				do_mouse_exit(&event.general);
+				break;
+			case GR_EVENT_TYPE_MOUSE_POSITION:
+				do_mouse_moved(&event.mouse);
+				break;
+			case GR_EVENT_TYPE_KEY_DOWN:
+				do_key_down(&event.keystroke);
+				break;
+			case GR_EVENT_TYPE_KEY_UP:
+				do_key_up(&event.keystroke);
+				break;
+			case GR_EVENT_TYPE_FOCUS_IN:
+				do_focus_in(&event.general);
+				break;
+			case GR_EVENT_TYPE_CHLD_UPDATE:
+				do_update(&event.update);
+				break;
+			default:
+				fprintf(stderr, "Got unexpected event %d\n",
+								event.type);
+				break;
+		}
+	}
+
+	GrClose();
+}
diff -urN lib/microwindows/src/demos/nanowm/nanowm.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/nanowm.h
--- lib/microwindows/src/demos/nanowm/nanowm.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/nanowm.h	2005-02-21 16:12:54.000000000 +0100
@@ -0,0 +1,196 @@
+/*
+ * NanoWM- the NanoGUI window manager.
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+
+#ifndef __NANOWM_H
+#define __NANOWM_H
+
+#ifdef DEBUG
+#define Dprintf printf
+#else
+#define Dprintf(ignore...)
+#endif
+
+/* Where to place the first window on the screen */
+#define FIRST_WINDOW_LOCATION 2
+
+/* The distance to leave between windows when deciding where to place */
+#define WINDOW_STEP 20
+
+/* The different window types which can be used in windowlist->type */
+enum {
+	WINDOW_TYPE_ROOT,
+	WINDOW_TYPE_CONTAINER,
+	WINDOW_TYPE_CLIENT
+	/***WINDOW_TYPE_TOPBAR,
+	WINDOW_TYPE_LEFTBAR,
+	WINDOW_TYPE_RIGHTBAR,
+	WINDOW_TYPE_BOTTOMBAR,
+	WINDOW_TYPE_LEFTRESIZE,
+	WINDOW_TYPE_RIGHTRESIZE,
+	WINDOW_TYPE_CLOSEBUTTON,
+	WINDOW_TYPE_MAXIMISEBUTTON,
+	WINDOW_TYPE_RESTOREBUTTON,
+	WINDOW_TYPE_ICONISEBUTTON,
+	WINDOW_TYPE_ICON,
+	WINDOW_TYPE_UTILITYBUTTON,
+	WINDOW_TYPE_UTILITYMENU,
+	WINDOW_TYPE_UTILITYMENUENTRY,
+	WINDOW_TYPE_ROOTMENU,
+	WINDOW_TYPE_ROOTMENUENTRY**/
+};
+
+/* 
+ * Used to keep a list of all the windows we know about so we can quickly
+ * find out whether a window is "one of ours", and if it is, what kind of
+ * window it is (title bar, side bar, button, icon, root menu, etc.), who
+ * it's a child of, and any special data associated with it (the title
+ * used in the title, the text of a root menu entry, the pixmap of an
+ * icon, etc.).
+ */
+struct windowlist {
+	GR_WINDOW_ID wid;	/* The ID of this window */
+	GR_WINDOW_ID pid;	/* The ID of this window's parent */
+	GR_WINDOW_ID clientid;	/* clientid for container window*/
+	int type;		/* What kind of window this is */
+  int sizing;                   /* True if in the middle of a sizing request */
+  int active;		/* Whether this window is active or not */
+	void *data;		/* Data associated with this window */
+	struct windowlist *next; /* The next window in the list */
+};
+typedef struct windowlist win;
+
+/*
+ * Used to record the offset position when performing a move.
+ */
+struct position {
+	GR_COORD x;
+	GR_COORD y;
+};
+
+/*
+ * Used to record the original position, original size, and offset position
+ * when performing a resize.
+ */
+struct pos_size {
+	GR_COORD xoff;
+	GR_COORD yoff;
+	GR_COORD xorig;
+	GR_COORD yorig;
+	GR_SIZE width;
+	GR_SIZE height;
+};
+
+#if 0000
+/*
+ * Used to record some general information about the client.
+ */
+struct clientinfo {
+	GR_WINDOW_ID cid;
+};
+#endif
+
+/* Function prototypes */
+win *find_window(GR_WINDOW_ID wid);
+int add_window(win *window);
+int remove_window(win *window);
+int remove_window_and_children(win *window);
+int new_client_window(GR_WINDOW_ID wid);
+void client_window_destroy(win *window);
+void redraw_ncarea(win *window);
+void do_exposure(GR_EVENT_EXPOSURE *event);
+void do_button_down(GR_EVENT_BUTTON *event);
+void do_button_up(GR_EVENT_BUTTON *event);
+void do_mouse_enter(GR_EVENT_GENERAL *event);
+void do_mouse_exit(GR_EVENT_GENERAL *event);
+void do_mouse_moved(GR_EVENT_MOUSE *event);
+void do_focus_in(GR_EVENT_GENERAL *event);
+void do_key_down(GR_EVENT_KEYSTROKE *event);
+void do_key_up(GR_EVENT_KEYSTROKE *event);
+void do_focus_in(GR_EVENT_GENERAL *event);
+void do_focus_out(GR_EVENT_GENERAL *event);
+void do_update(GR_EVENT_UPDATE *event);
+void do_chld_update(GR_EVENT_UPDATE *event);
+void rootwindow_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void container_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void topbar_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void closebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void maximisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void restorebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void iconisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void utilitybutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void utilitymenu_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void utilitymenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void rootmenu_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void rootmenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void icon_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void rootwindow_buttondown(win *window, GR_EVENT_BUTTON *event);
+void container_buttondown(win *window, GR_EVENT_BUTTON *event);
+void topbar_buttondown(win *window, GR_EVENT_BUTTON *event);
+void resizebar_buttondown(win *window, GR_EVENT_BUTTON *event);
+void closebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void maximisebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void restorebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void iconisebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void utilitybutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void icon_buttondown(win *window, GR_EVENT_BUTTON *event);
+void rootwindow_buttonup(win *window, GR_EVENT_BUTTON *event);
+void container_buttonup(win *window, GR_EVENT_BUTTON *event);
+void topbar_buttonup(win *window, GR_EVENT_BUTTON *event);
+void resizebar_buttonup(win *window, GR_EVENT_BUTTON *event);
+void closebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void maximisebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void restorebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void iconisebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void utilitybutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void icon_buttonup(win *window, GR_EVENT_BUTTON *event);
+void utilitymenuentry_buttonup(win *window, GR_EVENT_BUTTON *event);
+void rootmenuentry_buttonup(win *window, GR_EVENT_BUTTON *event);
+void closebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void maximisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void restorebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void iconisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void utilitybutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void utilitymenu_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void utilitymenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void rootmenu_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void rootmenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void container_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void topbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void leftbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void leftresize_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void bottombar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void rightresize_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void rightbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+
+extern GR_SCREEN_INFO si;
+extern win *windows;
+extern GR_BITMAP utilitybutton_notpressed[];
+extern GR_BITMAP utilitybutton_pressed[];
+extern GR_BITMAP maximisebutton_notpressed[];
+extern GR_BITMAP maximisebutton_pressed[];
+extern GR_BITMAP iconisebutton_notpressed[];
+extern GR_BITMAP iconisebutton_pressed[];
+extern GR_BITMAP closebutton_notpressed[];
+extern GR_BITMAP closebutton_pressed[];
+extern GR_BITMAP restorebutton_notpressed[];
+extern GR_BITMAP restorebutton_pressed[];
+extern GR_BITMAP horizontal_resize_fg[];
+extern GR_BITMAP horizontal_resize_bg[];
+extern GR_BITMAP vertical_resize_fg[];
+extern GR_BITMAP vertical_resize_bg[];
+extern GR_BITMAP righthand_resize_fg[];
+extern GR_BITMAP righthand_resize_bg[];
+extern GR_BITMAP lefthand_resize_fg[];
+extern GR_BITMAP lefthand_resize_bg[];
+extern int horizontal_resize_columns, horizontal_resize_rows;
+extern int horizontal_resize_hotx, horizontal_resize_hoty;
+extern int vertical_resize_columns, vertical_resize_rows;
+extern int vertical_resize_hotx, vertical_resize_hoty;
+extern int lefthand_resize_columns, lefthand_resize_rows;
+extern int lefthand_resize_hotx, lefthand_resize_hoty;
+extern int righthand_resize_columns, righthand_resize_rows;
+extern int righthand_resize_hotx, righthand_resize_hoty;
+
+#endif
diff -urN lib/microwindows/src/demos/nanowm/org/.depend /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/.depend
--- lib/microwindows/src/demos/nanowm/org/.depend	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/.depend	2005-02-21 16:02:52.000000000 +0100
@@ -0,0 +1,6 @@
+nanowm.o .depend : $(TOP)/config nanowm.c nanowm.h
+bitmaps.o .depend : $(TOP)/config bitmaps.c
+events.o .depend : $(TOP)/config events.c nanowm.h
+wlist.o .depend : $(TOP)/config wlist.c nanowm.h
+clients.o .depend : $(TOP)/config clients.c nanowm.h
+actions.o .depend : $(TOP)/config actions.c nanowm.h
diff -urN lib/microwindows/src/demos/nanowm/org/Makefile.org /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/Makefile.org
--- lib/microwindows/src/demos/nanowm/org/Makefile.org	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/Makefile.org	2005-02-21 16:12:52.000000000 +0100
@@ -0,0 +1,43 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(NANOWM), Y)
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME =
+
+# List of objects to compile
+OBJS = nanowm.o bitmaps.o events.o wlist.o clients.o actions.o
+
+all: default $(TOP)/bin/nanowm
+
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
+$(TOP)/bin/nanowm: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(NANOXCLIENTLIBS)
diff -urN lib/microwindows/src/demos/nanowm/org/README /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/README
--- lib/microwindows/src/demos/nanowm/org/README	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/README	2005-02-21 16:12:53.000000000 +0100
@@ -0,0 +1,27 @@
+29th May 2000- NanoWM Version 0.1.
+
+This is a first cut at a window manager for NanoGUI.
+Many things are as yet unimplemented, unfinished, ugly and/or inefficient.
+
+Currently working:
+	Windows get reparented when they appear.
+	They are placed in a (unintelligent) stacking order.
+	They are decorated with a title bar (no title as yet though), four
+	buttons, and resizing borders.
+	Windows can be dragged using the title bar (currently only solid
+	window dragging is supported).
+	The buttons can be clicked, causing them to change to a different image
+	which is supposed to look like they are pressed in (I'm not an artist,
+	okay).
+	Callbacks get called when the buttons are released, but nothing is in
+	the callbacks yet.
+	The resizing bars can be dragged and the overall window resizes
+	correctly, but the contents of the window don't yet reflow to fit the
+	new size.
+	Clicking on a window brings it to the front.
+	Moving a mouse over a window calls a callback which is intended to
+	change the look of the window somehow to indicate that it is in focus.
+	When a client exits, the parent window and it's children are
+	correctly destroyed.
+	The mouse pointer changes when over the resize bars to indicate the
+	direction in which the window will be resized on dragging it.
diff -urN lib/microwindows/src/demos/nanowm/org/actions.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/actions.c
--- lib/microwindows/src/demos/nanowm/org/actions.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/actions.c	2005-02-21 16:12:51.000000000 +0100
@@ -0,0 +1,491 @@
+/*
+ * NanoWM- the NanoGUI window manager.
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define MWINCLUDECOLORS
+#include <nano-X.h>
+
+/* Uncomment this if you want debugging output from this file */
+//#define DEBUG
+#include "nanowm.h"
+
+void rootwindow_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	Dprintf("rootwindow_exposure window %d\n", window->wid);
+}
+
+void topbar_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	win *pwin = find_window(window->pid);
+	struct clientinfo *ci = pwin->data;
+	GR_WM_PROPERTIES prop;
+
+	Dprintf("topbar_exposure window %d\n", window->wid);
+
+	GrGetWMProperties(ci->cid, &prop);
+	if (prop.title)
+		GrText(window->wid, buttonsgc, 0, 0, prop.title, -1,
+			GR_TFASCII|GR_TFTOP);
+}
+
+void closebutton_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	Dprintf("closebutton_exposure window %d\n", window->wid);
+
+	GrBitmap(window->wid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT,
+		TITLE_BAR_HEIGHT, window->active ? closebutton_pressed :
+						closebutton_notpressed);
+}
+
+void maximisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	Dprintf("maximisebutton_exposure window %d\n", window->wid);
+
+	GrBitmap(window->wid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT,
+		TITLE_BAR_HEIGHT, window->active ? maximisebutton_pressed :
+						maximisebutton_notpressed);
+}
+
+void restorebutton_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	Dprintf("restorebutton_exposure window %d\n", window->wid);
+
+	GrBitmap(window->wid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT,
+		TITLE_BAR_HEIGHT, window->active ? restorebutton_pressed :
+						restorebutton_notpressed);
+}
+
+void iconisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	Dprintf("iconisebutton_exposure window %d\n", window->wid);
+
+	GrBitmap(window->wid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT,
+		TITLE_BAR_HEIGHT, window->active ? iconisebutton_pressed :
+						iconisebutton_notpressed);
+}
+
+void utilitybutton_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	Dprintf("utilitybutton_exposure window %d\n", window->wid);
+
+	GrBitmap(window->wid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT,
+		TITLE_BAR_HEIGHT, window->active ? utilitybutton_pressed :
+						utilitybutton_notpressed);
+}
+
+void utilitymenu_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	Dprintf("utilitymenu_exposure window %d\n", window->wid);
+}
+
+void utilitymenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	Dprintf("utilitymenuentry_exposure window %d\n", window->wid);
+}
+
+void rootmenu_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	Dprintf("rootmenu_exposure window %d\n", window->wid);
+}
+
+void rootmenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	Dprintf("rootmenuentry_exposure window %d\n", window->wid);
+}
+
+void icon_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	Dprintf("icon_exposure window %d\n", window->wid);
+}
+
+void rootwindow_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("rootwindow_buttondown window %d\n", window->wid);
+}
+
+void container_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	struct position *pos;
+
+	Dprintf("container_buttondown window %d\n", window->wid);
+
+	GrRaiseWindow(window->pid);
+
+	if(window->active) return;
+
+	if(!window->data)
+		if(!(window->data = malloc(sizeof(struct position)))) return;
+
+	pos = (struct position *) window->data;
+
+	pos->x = event->x;
+	pos->y = event->y;
+
+	window->active = GR_TRUE;
+}
+
+void topbar_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	struct position *pos;
+
+	Dprintf("topbar_buttondown window %d\n", window->wid);
+
+	GrRaiseWindow(window->pid);
+
+	if(window->active) return;
+
+	if(!window->data)
+		if(!(window->data = malloc(sizeof(struct position)))) return;
+
+	pos = (struct position *) window->data;
+
+	pos->x = event->x + TITLE_BAR_HEIGHT;	/* actually width*/
+	pos->y = event->y;
+
+	window->active = GR_TRUE;
+}
+
+void resizebar_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	GR_WINDOW_INFO wi;
+	struct pos_size *pos;
+
+	Dprintf("resizebar_buttondown window %d\n", window->wid);
+
+	GrRaiseWindow(window->pid);
+
+	if(window->active) return;
+
+	if(!window->data)
+		if(!(window->data = malloc(sizeof(struct pos_size)))) return;
+
+	pos = (struct pos_size *) window->data;
+
+	GrGetWindowInfo(window->pid, &wi);
+
+	pos->xoff = event->x;
+	pos->yoff = event->y;
+	pos->xorig = wi.x;
+	pos->yorig = wi.y;
+	pos->width = wi.width;
+	pos->height = wi.height;
+
+	window->active = GR_TRUE;
+}
+
+void closebutton_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("closebutton_buttondown window %d\n", window->wid);
+
+	GrRaiseWindow(window->pid);
+
+	window->active = GR_TRUE;
+	closebutton_exposure(window, NULL);
+}
+
+void maximisebutton_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("maximisebutton_buttondown window %d\n", window->wid);
+
+	GrRaiseWindow(window->pid);
+
+	window->active = GR_TRUE;
+	maximisebutton_exposure(window, NULL);
+}
+
+void restorebutton_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("restorebutton_buttondown window %d\n", window->wid);
+
+	GrRaiseWindow(window->pid);
+
+	window->active = GR_TRUE;
+	restorebutton_exposure(window, NULL);
+}
+
+void iconisebutton_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("iconisebutton_buttondown window %d\n", window->wid);
+
+	GrRaiseWindow(window->pid);
+
+	window->active = GR_TRUE;
+	iconisebutton_exposure(window, NULL);
+}
+
+void utilitybutton_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("utilitybutton_buttondown window %d\n", window->wid);
+
+	GrRaiseWindow(window->pid);
+
+	window->active = GR_TRUE;
+	utilitybutton_exposure(window, NULL);
+}
+
+void icon_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("icon_buttondown window %d\n", window->wid);
+}
+
+void rootwindow_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("rootwindow_buttonup window %d\n", window->wid);
+}
+
+void container_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("container_buttonup window %d\n", window->wid);
+
+	window->active = GR_FALSE;
+}
+
+void topbar_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("topbar_buttonup window %d\n", window->wid);
+
+	window->active = GR_FALSE;
+}
+
+void resizebar_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("resizebar_buttonup window %d\n", window->wid);
+
+	window->active = GR_FALSE;
+}
+
+void closebutton_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	win *pwin = find_window(window->pid);
+	struct clientinfo *ci = pwin->data;
+
+	Dprintf("closebutton_buttonup window %d\n", window->wid);
+
+	window->active = GR_FALSE;
+	closebutton_exposure(window, NULL);
+
+	GrCloseWindow(ci->cid);
+}
+
+void maximisebutton_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("maximisebutton_buttonup window %d\n", window->wid);
+
+	window->active = GR_FALSE;
+	maximisebutton_exposure(window, NULL);
+}
+
+void restorebutton_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("restorebutton_buttonup window %d\n", window->wid);
+
+	window->active = GR_FALSE;
+	restorebutton_exposure(window, NULL);
+}
+
+void iconisebutton_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("iconisebutton_buttonup window %d\n", window->wid);
+
+	window->active = GR_FALSE;
+	iconisebutton_exposure(window, NULL);
+}
+
+void utilitybutton_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("utilitybutton_buttonup window %d\n", window->wid);
+
+	window->active = GR_FALSE;
+	utilitybutton_exposure(window, NULL);
+}
+
+void icon_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("icon_buttonup window %d\n", window->wid);
+}
+
+void utilitymenuentry_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("utilitymenuentry_buttonup window %d\n", window->wid);
+}
+
+void rootmenuentry_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("rootmenuentry_buttonup window %d\n", window->wid);
+}
+
+void closebutton_mouseexit(win *window, GR_EVENT_GENERAL *event)
+{
+	Dprintf("closebutton_mouseexit window %d\n", window->wid);
+}
+
+void maximisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event)
+{
+	Dprintf("maximisebutton_mouseexit window %d\n", window->wid);
+}
+
+void restorebutton_mouseexit(win *window, GR_EVENT_GENERAL *event)
+{
+	Dprintf("restorebutton_mouseexit window %d\n", window->wid);
+}
+
+void iconisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event)
+{
+	Dprintf("iconisebutton_mouseexit window %d\n", window->wid);
+}
+
+void utilitybutton_mouseexit(win *window, GR_EVENT_GENERAL *event)
+{
+	Dprintf("utilitybutton_mouseexit window %d\n", window->wid);
+}
+
+void utilitymenu_mouseexit(win *window, GR_EVENT_GENERAL *event)
+{
+	Dprintf("utilitymenu_mouseexit window %d\n", window->wid);
+}
+
+void utilitymenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event)
+{
+	Dprintf("utilitymenuentry_mouseexit window %d\n", window->wid);
+}
+
+void rootmenu_mouseexit(win *window, GR_EVENT_GENERAL *event)
+{
+	Dprintf("rootmenu_mouseexit window %d\n", window->wid);
+}
+
+void rootmenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event)
+{
+	Dprintf("rootmenuentry_mouseexit window %d\n", window->wid);
+}
+
+void container_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	struct position *pos;
+
+	Dprintf("container_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct position *) window->data;
+
+	GrMoveWindow(window->wid, event->rootx - pos->x,
+			event->rooty - pos->y);
+}
+
+void topbar_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	struct position *pos;
+	GR_WM_PROPERTIES props;
+
+	Dprintf("topbar_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct position *) window->data;
+
+	/* turn off background erase draw while moving*/
+	GrGetWMProperties(window->pid, &props);
+	props.flags = GR_WM_FLAGS_PROPS;
+	props.props |= GR_WM_PROPS_NOBACKGROUND;
+	GrSetWMProperties(window->pid, &props);
+
+	GrMoveWindow(window->pid, event->rootx - pos->x,
+			event->rooty - pos->y);
+
+	props.props &= ~GR_WM_PROPS_NOBACKGROUND;
+	GrSetWMProperties(window->pid, &props);
+}
+
+void leftbar_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	GR_COORD newx;
+	GR_SIZE newwidth;
+	struct pos_size *pos;
+
+	Dprintf("leftbar_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+	newx = event->rootx - pos->xoff;
+	newwidth = pos->width + pos->xorig - event->rootx - pos->xoff;
+
+	GrMoveWindow(window->pid, newx, pos->yorig);
+	GrResizeWindow(window->pid, newwidth, pos->height);
+}
+
+void leftresize_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	GR_COORD newx;
+	GR_SIZE newwidth, newheight;
+	struct pos_size *pos;
+
+	Dprintf("leftresize_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+	newx = event->rootx - pos->xoff;
+	newheight = event->rooty - pos->yorig;
+	newwidth = pos->width + pos->xorig - event->rootx - pos->xoff;
+
+	GrMoveWindow(window->pid, newx, pos->yorig);
+	GrResizeWindow(window->pid, newwidth, newheight);
+}
+
+void bottombar_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	GR_SIZE newheight;
+	struct pos_size *pos;
+
+	Dprintf("bottombar_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+	newheight = event->rooty - pos->yorig;
+
+	GrResizeWindow(window->pid, pos->width, newheight);
+}
+
+void rightresize_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	GR_SIZE newwidth, newheight;
+	struct pos_size *pos;
+
+	Dprintf("rightresize_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+	newheight = event->rooty - pos->yorig;
+	newwidth = event->rootx - pos->xorig;
+
+	GrResizeWindow(window->pid, newwidth, newheight);
+}
+
+void rightbar_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	GR_SIZE newwidth;
+	struct pos_size *pos;
+
+	Dprintf("rightbar_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+	newwidth = event->rootx - pos->xorig;
+
+	GrResizeWindow(window->pid, newwidth, pos->height);
+
+}
diff -urN lib/microwindows/src/demos/nanowm/org/bitmaps.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/bitmaps.c
--- lib/microwindows/src/demos/nanowm/org/bitmaps.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/bitmaps.c	2005-02-21 16:12:51.000000000 +0100
@@ -0,0 +1,374 @@
+/*
+ * NanoWM- the NanoGUI window manager.
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ *
+ * FIXME: Someone with some artistic ability should redo these.
+ *
+ * Vladimir Cotfas <vladimircotfas@vtech.ca>, Aug 31, 2000:
+ *    re-done the system, minimize, maximize, close buttons
+ *    in the Motif/KDE style (only two colours though)
+ */
+
+#include <nano-X.h>
+
+/*
+ * For defining bitmaps easily.
+ */
+#define X	((unsigned) 1)
+#define _	((unsigned) 0)
+
+#define BITS(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
+	(((((((((((((((a*2+b)*2+c)*2+d)*2+e)*2+f)*2+g)*2+h)*2+i)*2+j)*2+k) \
+	*2+l)*2+m)*2+n)*2+o)*2+p)
+
+/* The utility button not pressed bitmap */
+GR_BITMAP utilitybutton_notpressed[] = {
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,X,X,X,X,X,X,X,X,X,_,_,X,_),
+	BITS(X,_,_,X,_,_,_,_,_,_,_,X,_,_,X,_),
+	BITS(X,_,_,X,X,X,X,X,X,X,X,X,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_)
+};
+
+/* The utility button pressed bitmap */
+GR_BITMAP utilitybutton_pressed[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,X,X,X,X,X,X,X,X,X,_,_,X),
+	BITS(_,X,_,_,X,_,_,_,_,_,_,_,X,_,_,X),
+	BITS(_,X,_,_,X,X,X,X,X,X,X,X,X,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X)
+};
+
+/* The maximise button not pressed bitmap */
+GR_BITMAP maximisebutton_notpressed[] = {
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,X,X,X,X,X,X,X,X,X,_,_,X,_),
+	BITS(X,_,_,X,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,X,_,_,_,_,_,_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_,_,_,_,X),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X)
+};
+
+/* The iconise button not pressed bitmap */
+GR_BITMAP iconisebutton_notpressed[] = {
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,X,X,X,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,X,X,X,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,X,X,X,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_)
+};
+
+/* The iconise button pressed bitmap */
+GR_BITMAP iconisebutton_pressed[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,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,_,_,_,_,_)
+};
+
+/* The close button pressed bitmap */
+GR_BITMAP closebutton_pressed[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,X,X,_,_,_,_,_,X,X,_,_,X),
+	BITS(_,X,_,_,X,X,X,_,_,_,X,X,X,_,_,X),
+	BITS(_,X,_,_,_,X,X,X,_,X,X,X,_,_,_,X),
+	BITS(_,X,_,_,_,_,X,X,X,X,X,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,X,X,X,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,X,X,X,X,X,_,_,_,_,X),
+	BITS(_,X,_,_,_,X,X,X,_,X,X,X,_,_,_,X),
+	BITS(_,X,_,_,X,X,X,_,_,_,X,X,X,_,_,X),
+	BITS(_,X,_,_,X,X,_,_,_,_,_,X,X,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X)
+};
+
+/* The restore button not pressed bitmap */
+GR_BITMAP restorebutton_notpressed[] = {
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,X,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,X,_,X,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,X,_,_,_,X,_,_,_,_,X,_),
+	BITS(X,_,_,_,X,_,_,_,_,_,X,_,_,_,X,_),
+	BITS(X,_,_,X,_,_,_,_,_,_,_,X,_,_,X,_),
+	BITS(X,_,X,X,X,X,X,X,X,X,X,X,X,_,X,_),
+	BITS(X,_,_,X,_,_,_,_,_,_,_,X,_,_,X,_),
+	BITS(X,_,_,_,X,_,_,_,_,_,X,_,_,_,X,_),
+	BITS(X,_,_,_,_,X,_,_,_,X,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,X,_,X,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,X,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_)
+};
+
+/* The restore button pressed bitmap */
+GR_BITMAP restorebutton_pressed[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,X,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,X,_,X,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,X,_,_,_,X,_,_,_,_,X),
+	BITS(_,X,_,_,_,X,_,_,_,_,_,X,_,_,_,X),
+	BITS(_,X,_,_,X,_,_,_,_,_,_,_,X,_,_,X),
+	BITS(_,X,_,X,X,X,X,X,X,X,X,X,X,X,_,X),
+	BITS(_,X,_,_,X,_,_,_,_,_,_,_,X,_,_,X),
+	BITS(_,X,_,_,_,X,_,_,_,_,_,X,_,_,_,X),
+	BITS(_,X,_,_,_,_,X,_,_,_,X,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,X,_,X,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,X,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X)
+};
+
+/* The horizontal resize foreground */
+GR_BITMAP horizontal_resize_fg[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,X,X,_,_,_,_),
+	BITS(_,_,_,X,X,_,_,_,_,_,_,X,X,_,_,_),
+	BITS(_,_,X,X,_,_,_,_,_,_,_,_,X,X,_,_),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(_,_,X,X,_,_,_,_,_,_,_,_,X,X,_,_),
+	BITS(_,_,_,X,X,_,_,_,_,_,_,X,X,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+};
+int horizontal_resize_columns = 16;
+int horizontal_resize_rows = 10;
+int horizontal_resize_hotx = 7;
+int horizontal_resize_hoty = 4;
+
+/* The horizontal resize cursor background */
+GR_BITMAP horizontal_resize_bg[] = {
+	BITS(_,_,_,_,X,X,X,_,_,X,X,X,_,_,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,X,X,X,X,_,_,_),
+	BITS(_,_,X,X,X,X,_,_,_,_,X,X,X,X,_,_),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X),
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(_,_,X,X,X,X,_,_,_,_,X,X,X,X,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,X,X,X,_,_,X,X,X,_,_,_,_),
+};
+
+/* The vertical resize foreground */
+GR_BITMAP vertical_resize_fg[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,_,X,X,_,X,X,_,_,_,_,_,_,_),
+	BITS(_,X,_,_,X,X,_,_,X,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,_,_,X,X,_,_,X,_,_,_,_,_,_,_),
+	BITS(_,X,X,_,X,X,_,X,X,_,_,_,_,_,_,_),
+	BITS(_,_,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+};
+int vertical_resize_columns = 10;
+int vertical_resize_rows = 16;
+int vertical_resize_hotx = 4;
+int vertical_resize_hoty = 7;
+
+/* The vertical resize cursor background */
+GR_BITMAP vertical_resize_bg[] = {
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,X,X,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,_,_,_,_,_,_),
+	BITS(X,X,_,X,X,X,X,_,X,X,_,_,_,_,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(X,X,_,X,X,X,X,_,X,X,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,X,X,_,_,_,_,_,_,_),
+	BITS(_,_,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+};
+
+/* The righthand resize cursor foreground */
+GR_BITMAP righthand_resize_fg[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,_,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,_,_,X,X,X,_,_,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,_,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,X,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+};
+int righthand_resize_columns = 13;
+int righthand_resize_rows = 13;
+int righthand_resize_hotx = 6;
+int righthand_resize_hoty = 6;
+
+/* The righthand resize cursor background */
+GR_BITMAP righthand_resize_bg[] = {
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,X,X,X,X,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(X,X,X,X,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+};
+
+/* The lefthand resize cursor foreground */
+GR_BITMAP lefthand_resize_fg[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,X,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,_,X,X,_,_,_,_),
+	BITS(_,X,X,_,_,X,X,X,_,_,X,X,_,_,_,_),
+	BITS(_,X,X,_,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+};
+int lefthand_resize_columns = 13;
+int lefthand_resize_rows = 13;
+int lefthand_resize_hotx = 6;
+int lefthand_resize_hoty = 6;
+
+/* The lefthand resize cursor background */
+GR_BITMAP lefthand_resize_bg[] = {
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,X,X,X,X,_,_,_),
+	BITS(X,X,X,X,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,X,X,X,X,_,_,_),
+	BITS(X,X,X,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+};
diff -urN lib/microwindows/src/demos/nanowm/org/bitmaps.org /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/bitmaps.org
--- lib/microwindows/src/demos/nanowm/org/bitmaps.org	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/bitmaps.org	2005-02-21 16:12:52.000000000 +0100
@@ -0,0 +1,370 @@
+/*
+ * NanoWM- the NanoGUI window manager.
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ *
+ * FIXME: Someone with some artistic ability should redo these.
+ */
+
+#include <nano-X.h>
+
+/*
+ * For defining bitmaps easily.
+ */
+#define X	((unsigned) 1)
+#define _	((unsigned) 0)
+
+#define BITS(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
+	(((((((((((((((a*2+b)*2+c)*2+d)*2+e)*2+f)*2+g)*2+h)*2+i)*2+j)*2+k) \
+	*2+l)*2+m)*2+n)*2+o)*2+p)
+
+/* The utility button not pressed bitmap */
+GR_BITMAP utilitybutton_notpressed[] = {
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,X,X,X,X,X,X,X,X,X,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,X,X,X,X,X,X,X,X,X,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,X,X,X,X,X,X,X,X,X,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,X,X,X,X,X,X,X,X,X,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,X,X,X,X,X,X,X,X,X,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_)
+};
+
+/* The utility button pressed bitmap */
+GR_BITMAP utilitybutton_pressed[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,X,X,X,X,X,X,X,X,X,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,X,X,X,X,X,X,X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_,_,_,_,_)
+};
+
+/* The maximise button pressed bitmap */
+GR_BITMAP maximisebutton_pressed[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,X,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,X,X,X,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,X,_,X,_,X,_,_,_,_,X),
+	BITS(_,X,_,_,_,X,_,_,X,_,_,X,_,_,_,X),
+	BITS(_,X,_,_,X,_,_,_,X,_,_,_,X,_,_,X),
+	BITS(_,X,_,X,_,_,_,_,X,_,_,_,_,X,_,X),
+	BITS(_,X,_,_,_,_,_,_,X,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,X,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,X,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,X,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,X,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X)
+};
+
+/* The iconise button not pressed bitmap */
+GR_BITMAP iconisebutton_notpressed[] = {
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,X,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,X,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,X,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,X,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,X,_,_,_,_,_,_,X,_),
+	BITS(X,_,X,_,_,_,_,X,_,_,_,_,X,_,X,_),
+	BITS(X,_,_,X,_,_,_,X,_,_,_,X,_,_,X,_),
+	BITS(X,_,_,_,X,_,_,X,_,_,X,_,_,_,X,_),
+	BITS(X,_,_,_,_,X,_,X,_,X,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,X,X,X,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,X,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_)
+};
+
+/* The iconise button pressed bitmap */
+GR_BITMAP iconisebutton_pressed[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,X,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,X,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,X,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,X,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,X,_,_,_,_,_,_,X),
+	BITS(_,X,_,X,_,_,_,_,X,_,_,_,_,X,_,X),
+	BITS(_,X,_,_,X,_,_,_,X,_,_,_,X,_,_,X),
+	BITS(_,X,_,_,_,X,_,_,X,_,_,X,_,_,_,X),
+	BITS(_,X,_,_,_,_,X,_,X,_,X,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,X,X,X,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,X,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X)
+};
+
+/* The close button not pressed bitmap */
+GR_BITMAP closebutton_notpressed[] = {
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,X,_,_,_,_,_,_,_,_,_,X,_,X,_),
+	BITS(X,_,_,X,_,_,_,_,_,_,_,X,_,_,X,_),
+	BITS(X,_,_,_,X,_,_,_,_,_,X,_,_,_,X,_),
+	BITS(X,_,_,_,_,X,_,_,_,X,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,X,_,X,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,X,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,X,_,X,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,X,_,_,_,X,_,_,_,_,X,_),
+	BITS(X,_,_,_,X,_,_,_,_,_,X,_,_,_,X,_),
+	BITS(X,_,_,X,_,_,_,_,_,_,_,X,_,_,X,_),
+	BITS(X,_,X,_,_,_,_,_,_,_,_,_,X,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_)
+};
+
+/* The close button pressed bitmap */
+GR_BITMAP closebutton_pressed[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,_,X,_,_,_,_,_,_,_,_,_,X,_,X),
+	BITS(_,X,_,_,X,_,_,_,_,_,_,_,X,_,_,X),
+	BITS(_,X,_,_,_,X,_,_,_,_,_,X,_,_,_,X),
+	BITS(_,X,_,_,_,_,X,_,_,_,X,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,X,_,X,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,_,X,_,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,_,X,_,X,_,_,_,_,_,X),
+	BITS(_,X,_,_,_,_,X,_,_,_,X,_,_,_,_,X),
+	BITS(_,X,_,_,_,X,_,_,_,_,_,X,_,_,_,X),
+	BITS(_,X,_,_,X,_,_,_,_,_,_,_,X,_,_,X),
+	BITS(_,X,_,X,_,_,_,_,_,_,_,_,_,X,_,X),
+	BITS(_,X,_,_,_,_,_,_,_,_,_,_,_,_,_,X),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X)
+};
+
+/* The restore button not pressed bitmap */
+GR_BITMAP restorebutton_notpressed[] = {
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,X,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,X,_,X,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,X,_,_,_,X,_,_,_,_,X,_),
+	BITS(X,_,_,_,X,_,_,_,_,_,X,_,_,_,X,_),
+	BITS(X,_,_,X,_,_,_,_,_,_,_,X,_,_,X,_),
+	BITS(X,_,X,X,X,X,X,X,X,X,X,X,X,_,X,_),
+	BITS(X,_,_,X,_,_,_,_,_,_,_,X,_,_,X,_),
+	BITS(X,_,_,_,X,_,_,_,_,_,X,_,_,_,X,_),
+	BITS(X,_,_,_,_,X,_,_,_,X,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,X,_,X,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,X,_,_,_,_,_,_,X,_),
+	BITS(X,_,_,_,_,_,_,_,_,_,_,_,_,_,X,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_)
+};
+
+/* The restore button pressed bitmap */
+GR_BITMAP restorebutton_pressed[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_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_,_,_,_),
+};
+int horizontal_resize_columns = 16;
+int horizontal_resize_rows = 10;
+int horizontal_resize_hotx = 7;
+int horizontal_resize_hoty = 4;
+
+/* The horizontal resize cursor background */
+GR_BITMAP horizontal_resize_bg[] = {
+	BITS(_,_,_,_,X,X,X,_,_,X,X,X,_,_,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,X,X,X,X,_,_,_),
+	BITS(_,_,X,X,X,X,_,_,_,_,X,X,X,X,_,_),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X),
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X),
+	BITS(_,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_),
+	BITS(_,_,X,X,X,X,_,_,_,_,X,X,X,X,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,X,X,X,_,_,X,X,X,_,_,_,_),
+};
+
+/* The vertical resize foreground */
+GR_BITMAP vertical_resize_fg[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,_,X,X,_,X,X,_,_,_,_,_,_,_),
+	BITS(_,X,_,_,X,X,_,_,X,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,_,_,X,X,_,_,X,_,_,_,_,_,_,_),
+	BITS(_,X,X,_,X,X,_,X,X,_,_,_,_,_,_,_),
+	BITS(_,_,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+};
+int vertical_resize_columns = 10;
+int vertical_resize_rows = 16;
+int vertical_resize_hotx = 4;
+int vertical_resize_hoty = 7;
+
+/* The vertical resize cursor background */
+GR_BITMAP vertical_resize_bg[] = {
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,X,X,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,_,_,_,_,_,_),
+	BITS(X,X,_,X,X,X,X,_,X,X,_,_,_,_,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(X,X,_,X,X,X,X,_,X,X,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,X,X,_,_,_,_,_,_,_),
+	BITS(_,_,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,X,X,_,_,_,_,_,_,_,_,_,_),
+};
+
+/* The righthand resize cursor foreground */
+GR_BITMAP righthand_resize_fg[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,_,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,_,_,X,X,X,_,_,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,_,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,X,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+};
+int righthand_resize_columns = 13;
+int righthand_resize_rows = 13;
+int righthand_resize_hotx = 6;
+int righthand_resize_hoty = 6;
+
+/* The righthand resize cursor background */
+GR_BITMAP righthand_resize_bg[] = {
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,X,X,X,X,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(X,X,X,X,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+};
+
+/* The lefthand resize cursor foreground */
+GR_BITMAP lefthand_resize_fg[] = {
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,X,X,X,X,X,_,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,_,X,X,_,_,_,_),
+	BITS(_,X,X,_,_,X,X,X,_,_,X,X,_,_,_,_),
+	BITS(_,X,X,_,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,_,_,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,X,X,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_),
+};
+int lefthand_resize_columns = 13;
+int lefthand_resize_rows = 13;
+int lefthand_resize_hotx = 6;
+int lefthand_resize_hoty = 6;
+
+/* The lefthand resize cursor background */
+GR_BITMAP lefthand_resize_bg[] = {
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,_,X,X,X,X,X,X,X,_,_,_),
+	BITS(X,X,X,X,_,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,X,X,X,X,X,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,X,X,X,X,_,_,_),
+	BITS(X,X,X,X,X,X,X,_,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+	BITS(X,X,X,X,X,X,X,X,_,_,_,_,_,_,_,_),
+};
diff -urN lib/microwindows/src/demos/nanowm/org/clients.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/clients.c
--- lib/microwindows/src/demos/nanowm/org/clients.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/clients.c	2005-02-21 16:12:52.000000000 +0100
@@ -0,0 +1,321 @@
+/*
+ * NanoWM- the NanoGUI window manager.
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include <nano-X.h>
+/* Uncomment this if you want debugging output from this file */
+#define DEBUG
+#include "nanowm.h"
+
+#define CONTAINER_MOVES	   0	/* mousedn on container moves*/
+
+GR_COORD lastx = FIRST_WINDOW_LOCATION;
+GR_COORD lasty = FIRST_WINDOW_LOCATION;
+
+/*
+ * A new client window has been mapped, so we need to reparent and decorate it.
+ * Returns -1 on failure or 0 on success.
+ */
+int new_client_window(GR_WINDOW_ID wid)
+{
+	win window;
+	GR_WINDOW_ID pid, nid;
+	GR_WINDOW_INFO winfo;
+	GR_COORD x, y, width, height;
+	GR_WM_PROPERTIES props;
+	struct clientinfo *ci;
+
+	Dprintf("New client window %d\n", wid);
+
+	/* get client window information*/
+	GrGetWindowInfo(wid, &winfo);
+
+	/* deal with replacing borders with window decorations*/
+	if (winfo.bordersize) {
+		/*
+		 * For complex reasons, it's easier to unmap,
+		 * remove the borders, and then map again,
+		 * rather than try to recalculate the window
+		 * position in the server w/o borders.  By
+		 * the time we get this event, the window has
+		 * already been painted with borders...
+		 * This currently causes a screen flicker as
+		 * the window is painted twice.  The workaround
+		 * is to create the window without borders in
+		 * the first place.
+		 */
+		GrUnmapWindow(wid);
+
+		/* remove client borders, if any*/
+		props.flags = GR_WM_FLAGS_BORDERSIZE;
+		props.bordersize = 0;
+		GrSetWMProperties(wid, &props);
+
+		/* remap the window without borders, call this routine again*/
+		GrMapWindow(wid);
+		return 0;
+	}
+	
+	width = (2 * BORDER_WIDTHS) + winfo.width;
+	height = TITLE_BAR_HEIGHT + winfo.height + BORDER_WIDTHS;
+
+	/* FIXME: We could proably use a more intelligent algorithm here */
+	x = lastx + WINDOW_STEP;
+	if((x + width) > si.cols)
+		x = FIRST_WINDOW_LOCATION;
+	lastx = x;
+	y = lasty + WINDOW_STEP;
+	if((y + height) > si.rows)
+		y = FIRST_WINDOW_LOCATION;
+	lasty = y;
+
+	/* create container window*/
+	pid = GrNewWindow(GR_ROOT_WINDOW_ID, x, y, width, height,
+		0, LTGRAY, BLACK);
+	window.wid = pid;
+	window.pid = GR_ROOT_WINDOW_ID;
+	window.type = WINDOW_TYPE_CONTAINER;
+	window.active = 0;
+	ci = malloc(sizeof(struct clientinfo));
+	ci->cid = wid;
+	window.data = ci;
+	add_window(&window);
+
+	GrSelectEvents(pid, GR_EVENT_MASK_UPDATE | GR_EVENT_MASK_CHLD_UPDATE
+#if CONTAINER_MOVES
+			| GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_BUTTON_DOWN |
+			GR_EVENT_MASK_MOUSE_POSITION
+#endif
+			);
+
+	/* reparent client to container window*/
+	GrReparentWindow(wid, pid, BORDER_WIDTHS, TITLE_BAR_HEIGHT);
+
+	GrMapWindow(pid);
+
+	/* add client window*/
+	window.wid = wid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_CLIENT;
+	window.active = 0;
+	window.data = NULL;
+	add_window(&window);
+
+	/* add system utility button*/
+	nid = GrNewWindow(pid, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0,
+							LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_UTILITYBUTTON;
+	window.active = GR_FALSE;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_EXPOSURE
+				| GR_EVENT_MASK_MOUSE_EXIT);
+	GrMapWindow(nid);
+	GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
+						utilitybutton_notpressed);
+
+#if !CONTAINER_MOVES
+	nid = GrNewWindow(pid, TITLE_BAR_HEIGHT + 1, 1, width - (4 *
+			TITLE_BAR_HEIGHT) - 3, TITLE_BAR_HEIGHT - 3, 1, LTGRAY,
+								BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_TOPBAR;
+	window.active = GR_FALSE;
+	window.data = NULL;
+
+	add_window(&window);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_EXPOSURE
+				| GR_EVENT_MASK_MOUSE_POSITION);
+	GrMapWindow(nid);
+#endif
+
+	nid = GrNewWindow(pid, width - (3 * TITLE_BAR_HEIGHT), 0,
+			TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_ICONISEBUTTON;
+	window.active = GR_FALSE;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_EXPOSURE
+				| GR_EVENT_MASK_MOUSE_EXIT);
+	GrMapWindow(nid);
+	GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
+						iconisebutton_notpressed);
+
+	nid = GrNewWindow(pid, width - (2 * TITLE_BAR_HEIGHT), 0,
+			TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_MAXIMISEBUTTON;
+	window.active = GR_FALSE;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_EXPOSURE
+				| GR_EVENT_MASK_MOUSE_EXIT);
+	GrMapWindow(nid);
+	GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
+						maximisebutton_notpressed);
+
+	nid = GrNewWindow(pid, width - TITLE_BAR_HEIGHT, 0,
+			TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_CLOSEBUTTON;
+	window.active = GR_FALSE;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_EXPOSURE
+				| GR_EVENT_MASK_MOUSE_EXIT);
+	GrMapWindow(nid);
+	GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
+						closebutton_notpressed);
+
+	nid = GrNewWindow(pid, 1, TITLE_BAR_HEIGHT + 1, BORDER_WIDTHS - 2,
+				height - TITLE_BAR_HEIGHT - BORDER_WIDTHS - 1,
+				1, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_LEFTBAR;
+	window.active = GR_FALSE;
+	window.data = NULL;
+
+	add_window(&window);
+
+	GrSetCursor(nid, horizontal_resize_columns, horizontal_resize_rows,
+			horizontal_resize_hotx, horizontal_resize_hoty,
+			BLACK, WHITE, horizontal_resize_fg,
+			horizontal_resize_bg);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_MOUSE_POSITION);
+
+	GrMapWindow(nid);
+
+	nid = GrNewWindow(pid, 1, height - BORDER_WIDTHS + 1, BORDER_WIDTHS - 2,
+					BORDER_WIDTHS - 2, 1, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_LEFTRESIZE;
+	window.active = GR_FALSE;
+	window.data = NULL;
+
+
+	add_window(&window);
+
+	GrSetCursor(nid, lefthand_resize_columns, lefthand_resize_rows,
+			lefthand_resize_hotx, lefthand_resize_hoty,
+			BLACK, WHITE, lefthand_resize_fg, lefthand_resize_bg);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_MOUSE_POSITION);
+
+	GrMapWindow(nid);
+
+	nid = GrNewWindow(pid, BORDER_WIDTHS, height - BORDER_WIDTHS + 1,
+			width - (2 * BORDER_WIDTHS), BORDER_WIDTHS - 2, 1,
+							LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_BOTTOMBAR;
+	window.active = GR_FALSE;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSetCursor(nid, vertical_resize_columns, vertical_resize_rows,
+			vertical_resize_hotx, vertical_resize_hoty,
+			BLACK, WHITE, vertical_resize_fg, vertical_resize_bg);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_MOUSE_POSITION);
+
+	GrMapWindow(nid);
+
+	nid = GrNewWindow(pid, width - BORDER_WIDTHS + 1,
+			height - BORDER_WIDTHS + 1, BORDER_WIDTHS - 2,
+					BORDER_WIDTHS - 2, 1, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_RIGHTRESIZE;
+	window.active = GR_FALSE;
+	window.data = NULL;
+
+	add_window(&window);
+
+	GrSetCursor(nid, righthand_resize_columns, righthand_resize_rows,
+			righthand_resize_hotx, righthand_resize_hoty,
+			BLACK, WHITE, righthand_resize_fg, righthand_resize_bg);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_MOUSE_POSITION);
+
+	GrMapWindow(nid);
+
+	nid = GrNewWindow(pid, width - BORDER_WIDTHS + 1, TITLE_BAR_HEIGHT + 1,
+		BORDER_WIDTHS - 2, height - TITLE_BAR_HEIGHT - BORDER_WIDTHS -1,
+							 1, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_RIGHTBAR;
+	window.active = GR_FALSE;
+	window.data = NULL;
+
+	add_window(&window);
+
+	GrSetCursor(nid, horizontal_resize_columns, horizontal_resize_rows,
+			horizontal_resize_hotx, horizontal_resize_hoty,
+			BLACK, WHITE, horizontal_resize_fg,
+			horizontal_resize_bg);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_MOUSE_POSITION);
+	GrMapWindow(nid);
+
+	return 0;
+}
+
+/*
+ * We've just received an event notifying us that a client window has been
+ * unmapped, so we need to destroy all of the decorations.
+ */
+void client_window_unmapped(win *window)
+{
+	win *pwin;
+	GR_WINDOW_ID pid;
+
+	Dprintf("Client window %d has been unmapped\n", window->wid);
+
+	if(!(pwin = find_window(window->pid))) {
+		fprintf(stderr, "Couldn't find parent of unmapped window "
+				"%d\n", window->wid);
+		return;
+	}
+
+	/* Do it this way around so we don't handle events after destroying */
+	pid = pwin->wid;
+	remove_window_and_children(pwin);
+	GrDestroyWindow(pid);
+}
+
+/*
+ * The mouse has entered a window, so give it the focus.
+ */
+void setfocus(win *window)
+{
+}
diff -urN lib/microwindows/src/demos/nanowm/org/events.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/events.c
--- lib/microwindows/src/demos/nanowm/org/events.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/events.c	2005-02-21 16:12:52.000000000 +0100
@@ -0,0 +1,351 @@
+/*
+ * NanoWM- the NanoGUI window manager.
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define MWINCLUDECOLORS
+#include <nano-X.h>
+
+/* Uncomment this if you want debugging output from this file */
+/* #define DEBUG */
+#include "nanowm.h"
+
+void do_exposure(GR_EVENT_EXPOSURE *event)
+{
+	win *window;
+
+	Dprintf("do_exposure: wid %d, x %d, y %d, width %d, height %d\n",
+		event->wid, event->x, event->y, event->width, event->height);
+
+	if(!(window = find_window(event->wid))) return;
+
+	switch(window->type) {
+		case WINDOW_TYPE_ROOT:
+			rootwindow_exposure(window, event);
+			break;
+		case WINDOW_TYPE_TOPBAR:
+			topbar_exposure(window, event);
+			break;
+		case WINDOW_TYPE_LEFTBAR:
+		case WINDOW_TYPE_LEFTRESIZE:
+		case WINDOW_TYPE_BOTTOMBAR:
+		case WINDOW_TYPE_RIGHTRESIZE:
+		case WINDOW_TYPE_RIGHTBAR:
+			break;		/* Currently nothing to redraw */
+		case WINDOW_TYPE_CLOSEBUTTON:
+			closebutton_exposure(window, event);
+			break;
+		case WINDOW_TYPE_MAXIMISEBUTTON:
+			maximisebutton_exposure(window, event);
+			break;
+		case WINDOW_TYPE_RESTOREBUTTON:
+			restorebutton_exposure(window, event);
+			break;
+		case WINDOW_TYPE_ICONISEBUTTON:
+			iconisebutton_exposure(window, event);
+			break;
+		case WINDOW_TYPE_UTILITYBUTTON:
+			utilitybutton_exposure(window, event);
+			break;
+		case WINDOW_TYPE_UTILITYMENU:
+			utilitymenu_exposure(window, event);
+			break;
+		case WINDOW_TYPE_UTILITYMENUENTRY:
+			utilitymenuentry_exposure(window, event);
+			break;
+		case WINDOW_TYPE_ROOTMENU:
+			rootmenu_exposure(window, event);
+			break;
+		case WINDOW_TYPE_ROOTMENUENTRY:
+			rootmenuentry_exposure(window, event);
+			break;
+		case WINDOW_TYPE_ICON:
+			icon_exposure(window, event);
+			break;
+		default:
+			Dprintf("Unhandled exposure on window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+
+}
+
+void do_button_down(GR_EVENT_BUTTON *event)
+{
+	win *window;
+
+	Dprintf("do_button_down: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
+		"y %d, buttons %d, changebuttons %d, modifiers %d\n",
+		event->wid, event->subwid, event->rootx, event->rooty, event->x,
+		event->y, event->buttons, event->changebuttons,
+		event->modifiers);
+
+	if(!(window = find_window(event->wid))) return;
+
+	switch(window->type) {
+		case WINDOW_TYPE_ROOT:
+			rootwindow_buttondown(window, event);
+			break;
+		case WINDOW_TYPE_CONTAINER:
+			container_buttondown(window, event);
+			break;
+		case WINDOW_TYPE_TOPBAR:
+			topbar_buttondown(window, event);
+			break;
+		case WINDOW_TYPE_LEFTBAR:
+		case WINDOW_TYPE_LEFTRESIZE:
+		case WINDOW_TYPE_BOTTOMBAR:
+		case WINDOW_TYPE_RIGHTRESIZE:
+		case WINDOW_TYPE_RIGHTBAR:
+			resizebar_buttondown(window, event);
+			break;
+		case WINDOW_TYPE_CLOSEBUTTON:
+			closebutton_buttondown(window, event);
+			break;
+		case WINDOW_TYPE_MAXIMISEBUTTON:
+			maximisebutton_buttondown(window, event);
+			break;
+		case WINDOW_TYPE_RESTOREBUTTON:
+			restorebutton_buttondown(window, event);
+			break;
+		case WINDOW_TYPE_ICONISEBUTTON:
+			iconisebutton_buttondown(window, event);
+			break;
+		case WINDOW_TYPE_UTILITYBUTTON:
+			utilitybutton_buttondown(window, event);
+			break;
+		case WINDOW_TYPE_ICON:
+			icon_buttondown(window, event);
+			break;
+		default:
+			Dprintf("Unhandled button down on window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_button_up(GR_EVENT_BUTTON *event)
+{
+	win *window;
+
+	Dprintf("do_button_up: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
+		"y %d, buttons %d, changebuttons %d, modifiers %d\n",
+		event->wid, event->subwid, event->rootx, event->rooty, event->x,
+		event->y, event->buttons, event->changebuttons,
+		event->modifiers);
+
+	if(!(window = find_window(event->wid))) return;
+
+	switch(window->type) {
+		case WINDOW_TYPE_ROOT:
+			rootwindow_buttonup(window, event);
+			break;
+		case WINDOW_TYPE_CONTAINER:
+			container_buttonup(window, event);
+			break;
+		case WINDOW_TYPE_TOPBAR:
+			topbar_buttonup(window, event);
+			break;
+		case WINDOW_TYPE_LEFTBAR:
+		case WINDOW_TYPE_LEFTRESIZE:
+		case WINDOW_TYPE_BOTTOMBAR:
+		case WINDOW_TYPE_RIGHTRESIZE:
+		case WINDOW_TYPE_RIGHTBAR:
+			resizebar_buttonup(window, event);
+			break;
+		case WINDOW_TYPE_CLOSEBUTTON:
+			closebutton_buttonup(window, event);
+			break;
+		case WINDOW_TYPE_MAXIMISEBUTTON:
+			maximisebutton_buttonup(window, event);
+			break;
+		case WINDOW_TYPE_RESTOREBUTTON:
+			restorebutton_buttonup(window, event);
+			break;
+		case WINDOW_TYPE_ICONISEBUTTON:
+			iconisebutton_buttonup(window, event);
+			break;
+		case WINDOW_TYPE_UTILITYBUTTON:
+			utilitybutton_buttonup(window, event);
+			break;
+		case WINDOW_TYPE_ICON:
+			icon_buttonup(window, event);
+			break;
+		case WINDOW_TYPE_UTILITYMENUENTRY:
+			utilitymenuentry_buttonup(window, event);
+			break;
+		case WINDOW_TYPE_ROOTMENUENTRY:
+			rootmenuentry_buttonup(window, event);
+			break;
+		default:
+			Dprintf("Unhandled button up on window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_mouse_enter(GR_EVENT_GENERAL *event)
+{
+	win *window;
+
+	Dprintf("do_mouse_enter: wid %d\n", event->wid);
+
+	if(!(window = find_window(event->wid))) return;
+
+	if(window->type == WINDOW_TYPE_CONTAINER) {
+		setfocus(window);
+		return;
+	}
+
+	if((window = find_window(window->pid))) {
+		if(window->type == WINDOW_TYPE_CONTAINER) {
+			setfocus(window);
+			return;
+		}
+	}
+
+	fprintf(stderr, "Can't find container to set focus on window %d\n",
+							event->wid);
+	
+}
+
+void do_mouse_exit(GR_EVENT_GENERAL *event)
+{
+	win *window;
+
+	Dprintf("do_mouse_exit: wid %d\n", event->wid);
+
+	if(!(window = find_window(event->wid))) return;
+
+	switch(window->type) {
+		case WINDOW_TYPE_CLOSEBUTTON:
+			closebutton_mouseexit(window, event);
+			break;
+		case WINDOW_TYPE_MAXIMISEBUTTON:
+			maximisebutton_mouseexit(window, event);
+			break;
+		case WINDOW_TYPE_RESTOREBUTTON:
+			restorebutton_mouseexit(window, event);
+			break;
+		case WINDOW_TYPE_ICONISEBUTTON:
+			iconisebutton_mouseexit(window, event);
+			break;
+		case WINDOW_TYPE_UTILITYBUTTON:
+			utilitybutton_mouseexit(window, event);
+			break;
+		case WINDOW_TYPE_UTILITYMENU:
+			utilitymenu_mouseexit(window, event);
+			break;
+		case WINDOW_TYPE_UTILITYMENUENTRY:
+			utilitymenuentry_mouseexit(window, event);
+			break;
+		case WINDOW_TYPE_ROOTMENU:
+			rootmenu_mouseexit(window, event);
+			break;
+		case WINDOW_TYPE_ROOTMENUENTRY:
+			rootmenuentry_mouseexit(window, event);
+			break;
+		default:
+			Dprintf("Unhandled mouse exit from window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_mouse_moved(GR_EVENT_MOUSE *event)
+{
+	win *window;
+
+	Dprintf("do_mouse_moved: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
+		"y %d, buttons %d, modifiers %d\n", event->wid, event->subwid,
+		event->rootx, event->rooty, event->x, event->y, event->buttons,
+		event->modifiers);
+
+	if(!(window = find_window(event->wid))) return;
+
+	switch(window->type) {
+		case WINDOW_TYPE_CONTAINER:
+			container_mousemoved(window, event);
+			break;
+		case WINDOW_TYPE_TOPBAR:
+			topbar_mousemoved(window, event);
+			break;
+		case WINDOW_TYPE_LEFTBAR:
+			leftbar_mousemoved(window, event);
+			break;
+		case WINDOW_TYPE_LEFTRESIZE:
+			leftresize_mousemoved(window, event);
+			break;
+		case WINDOW_TYPE_BOTTOMBAR:
+			bottombar_mousemoved(window, event);
+			break;
+		case WINDOW_TYPE_RIGHTBAR:
+			rightbar_mousemoved(window, event);
+			break;
+		case WINDOW_TYPE_RIGHTRESIZE:
+			rightresize_mousemoved(window, event);
+			break;
+		default:
+			Dprintf("Unhandled mouse movement in window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_key_down(GR_EVENT_KEYSTROKE *event)
+{
+	Dprintf("do_key_down: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
+		"y %d, buttons %d, modifiers %d, uch %lu, special %d, "
+		"ch %d, content %d\n", event->wid, event->subwid, event->rootx,
+		event->rooty, event->x, event->y, event->buttons,
+		event->modifiers, event->uch, event->special, event->ch,
+		event->content);
+
+	/* FIXME: Implement keyboard shortcuts */
+}
+
+void do_key_up(GR_EVENT_KEYSTROKE *event)
+{
+	Dprintf("do_key_up: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
+		"y %d, buttons %d, modifiers %d, uch %lu, special %d, "
+		"ch %d, content %d\n", event->wid, event->subwid, event->rootx,
+		event->rooty, event->x, event->y, event->buttons,
+		event->modifiers, event->uch, event->special, event->ch,
+		event->content);
+}
+
+void do_update(GR_EVENT_UPDATE *event)
+{
+	win *window;
+
+	Dprintf("do_update: wid %d, x %d, y %d, width %d, height %d, "
+		"utype %d\n", event->wid, event->x, event->y, event->width,
+		event->height, event->utype);
+
+	if(!(window = find_window(event->wid))) {
+		new_client_window(event->wid);
+		return;
+	}
+
+	if(window->type != WINDOW_TYPE_CLIENT) return;
+
+	if(event->utype == GR_UPDATE_UNMAP) client_window_unmapped(window);
+}
+
+void do_chld_update(GR_EVENT_UPDATE *event)
+{
+	win *window;
+
+	Dprintf("do_chld_update: wid %d, x %d, y %d, width %d, height %d, "
+		"utype %d\n", event->wid, event->x, event->y, event->width,
+		event->height, event->utype);
+
+	if(!(window = find_window(event->wid))) return;
+
+	if(window->type != WINDOW_TYPE_CLIENT) return;
+
+	if(event->utype == GR_UPDATE_UNMAP) client_window_unmapped(window);
+}
diff -urN lib/microwindows/src/demos/nanowm/org/nanowm.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/nanowm.c
--- lib/microwindows/src/demos/nanowm/org/nanowm.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/nanowm.c	2005-02-21 16:12:52.000000000 +0100
@@ -0,0 +1,102 @@
+/*
+ * NanoWM- the NanoGUI window manager.
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ *
+ * Parts based on npanel.c Copyright (C) 1999 Alistair Riddoch.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define MWINCLUDECOLORS
+#include <nano-X.h>
+
+/* Uncomment this if you want debugging output from this file */
+/* #define DEBUG */
+#include "nanowm.h"
+
+GR_SCREEN_INFO si;
+GR_GC_ID buttonsgc;
+GR_FONT_ID titlefont;
+
+int main(int argc, char *argv[])
+{
+	GR_EVENT event;
+	GR_WM_PROPERTIES props;
+	win window;
+
+	if(GrOpen() < 0) {
+		fprintf(stderr, "Couldn't connect to Nano-X server!\n");
+		exit(1);
+	}
+
+	GrGetScreenInfo(&si);
+
+	buttonsgc = GrNewGC();
+	GrSetGCForeground(buttonsgc, BLACK);	/* Buttons foreground colour */
+	GrSetGCBackground(buttonsgc, LTGRAY);	/* Buttons background colour */
+	titlefont = GrCreateFont(GR_FONT_GUI_VAR, 0, NULL);
+	GrSetGCFont(buttonsgc, titlefont);
+
+	window.wid = GR_ROOT_WINDOW_ID;
+	window.pid = GR_ROOT_WINDOW_ID;
+	window.type = WINDOW_TYPE_ROOT;
+	window.active = 0;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_EXPOSURE |
+		GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP |
+		GR_EVENT_MASK_UPDATE | GR_EVENT_MASK_CHLD_UPDATE);
+
+	/* Set new root window background color*/
+	props.flags = GR_WM_FLAGS_BACKGROUND;
+	props.background = GR_RGB(0, 128, 128);
+	GrSetWMProperties(GR_ROOT_WINDOW_ID, &props);
+
+	while(1) { 
+		GrGetNextEvent(&event);
+
+		switch(event.type) {
+			case GR_EVENT_TYPE_ERROR:
+				//GrDefaultErrorHandler(event.error);
+				break;
+			case GR_EVENT_TYPE_EXPOSURE:
+				do_exposure(&event.exposure);
+				break;
+			case GR_EVENT_TYPE_BUTTON_DOWN:
+				do_button_down(&event.button);
+				break;
+			case GR_EVENT_TYPE_BUTTON_UP:
+				do_button_up(&event.button);
+				break;
+			case GR_EVENT_TYPE_MOUSE_ENTER:
+				do_mouse_enter(&event.general);
+				break;
+			case GR_EVENT_TYPE_MOUSE_EXIT:
+				do_mouse_exit(&event.general);
+				break;
+			case GR_EVENT_TYPE_MOUSE_POSITION:
+				do_mouse_moved(&event.mouse);
+				break;
+			case GR_EVENT_TYPE_KEY_DOWN:
+				do_key_down(&event.keystroke);
+				break;
+			case GR_EVENT_TYPE_KEY_UP:
+				do_key_up(&event.keystroke);
+				break;
+			case GR_EVENT_TYPE_UPDATE:
+				do_update(&event.update);
+				break;
+			case GR_EVENT_TYPE_CHLD_UPDATE:
+				do_chld_update(&event.update);
+				break;
+			default:
+				fprintf(stderr, "Got unexpected event %d\n",
+								event.type);
+				break;
+		}
+	}
+
+	GrClose();
+}
diff -urN lib/microwindows/src/demos/nanowm/org/nanowm.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/nanowm.h
--- lib/microwindows/src/demos/nanowm/org/nanowm.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/nanowm.h	2005-02-21 16:12:52.000000000 +0100
@@ -0,0 +1,200 @@
+/*
+ * NanoWM- the NanoGUI window manager.
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+
+#ifndef __NANOWM_H
+#define __NANOWM_H
+
+#ifdef DEBUG
+#define Dprintf printf
+#else
+#define Dprintf(ignore...)
+#endif
+
+/* Where to place the first window on the screen */
+#define FIRST_WINDOW_LOCATION 2
+
+/* The distance to leave between windows when deciding where to place */
+#define WINDOW_STEP 20
+
+/* The height of the title bar */
+#define TITLE_BAR_HEIGHT 16
+
+/* The width of the borders */
+#define BORDER_WIDTHS 6
+
+/* The different window types which can be used in windowlist->type */
+enum {
+	WINDOW_TYPE_ROOT,
+	WINDOW_TYPE_CONTAINER,
+	WINDOW_TYPE_CLIENT,
+	WINDOW_TYPE_TOPBAR,
+	WINDOW_TYPE_LEFTBAR,
+	WINDOW_TYPE_RIGHTBAR,
+	WINDOW_TYPE_BOTTOMBAR,
+	WINDOW_TYPE_LEFTRESIZE,
+	WINDOW_TYPE_RIGHTRESIZE,
+	WINDOW_TYPE_CLOSEBUTTON,
+	WINDOW_TYPE_MAXIMISEBUTTON,
+	WINDOW_TYPE_RESTOREBUTTON,
+	WINDOW_TYPE_ICONISEBUTTON,
+	WINDOW_TYPE_ICON,
+	WINDOW_TYPE_UTILITYBUTTON,
+	WINDOW_TYPE_UTILITYMENU,
+	WINDOW_TYPE_UTILITYMENUENTRY,
+	WINDOW_TYPE_ROOTMENU,
+	WINDOW_TYPE_ROOTMENUENTRY
+};
+
+/* 
+ * Used to keep a list of all the windows we know about so we can quickly
+ * find out whether a window is "one of ours", and if it is, what kind of
+ * window it is (title bar, side bar, button, icon, root menu, etc.), who
+ * it's a child of, and any special data associated with it (the title
+ * used in the title, the text of a root menu entry, the pixmap of an
+ * icon, etc.).
+ */
+struct windowlist {
+	GR_WINDOW_ID wid;	/* The ID of this window */
+	GR_WINDOW_ID pid;	/* The ID of this window's parent */
+	int type;		/* What kind of window this is */
+	int active;		/* Whether this window is active or not */
+	void *data;		/* Data associated with this window */
+	struct windowlist *next; /* The next window in the list */
+};
+typedef struct windowlist win;
+
+/*
+ * Used to record the offset position when performing a move.
+ */
+struct position {
+	GR_COORD x;
+	GR_COORD y;
+};
+
+/*
+ * Used to record the original position, original size, and offset position
+ * when performing a resize.
+ */
+struct pos_size {
+	GR_COORD xoff;
+	GR_COORD yoff;
+	GR_COORD xorig;
+	GR_COORD yorig;
+	GR_SIZE width;
+	GR_SIZE height;
+};
+
+/*
+ * Used to record some general information about the client.
+ */
+struct clientinfo {
+	GR_WINDOW_ID cid;
+};
+
+extern void GrDefaultErrorHandler(GR_EVENT_ERROR err);
+
+/* Function prototypes */
+win *find_window(GR_WINDOW_ID wid);
+int add_window(win *window);
+int remove_window(win *window);
+int remove_window_and_children(win *window);
+int new_client_window(GR_WINDOW_ID wid);
+void client_window_unmapped(win *window);
+void setfocus(win *window);
+void do_exposure(GR_EVENT_EXPOSURE *event);
+void do_button_down(GR_EVENT_BUTTON *event);
+void do_button_up(GR_EVENT_BUTTON *event);
+void do_mouse_enter(GR_EVENT_GENERAL *event);
+void do_mouse_exit(GR_EVENT_GENERAL *event);
+void do_mouse_moved(GR_EVENT_MOUSE *event);
+void do_key_down(GR_EVENT_KEYSTROKE *event);
+void do_key_up(GR_EVENT_KEYSTROKE *event);
+void do_focus_in(GR_EVENT_GENERAL *event);
+void do_focus_out(GR_EVENT_GENERAL *event);
+void do_update(GR_EVENT_UPDATE *event);
+void do_chld_update(GR_EVENT_UPDATE *event);
+void rootwindow_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void topbar_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void closebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void maximisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void restorebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void iconisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void utilitybutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void utilitymenu_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void utilitymenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void rootmenu_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void rootmenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void icon_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void rootwindow_buttondown(win *window, GR_EVENT_BUTTON *event);
+void container_buttondown(win *window, GR_EVENT_BUTTON *event);
+void topbar_buttondown(win *window, GR_EVENT_BUTTON *event);
+void resizebar_buttondown(win *window, GR_EVENT_BUTTON *event);
+void closebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void maximisebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void restorebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void iconisebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void utilitybutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void icon_buttondown(win *window, GR_EVENT_BUTTON *event);
+void rootwindow_buttonup(win *window, GR_EVENT_BUTTON *event);
+void container_buttonup(win *window, GR_EVENT_BUTTON *event);
+void topbar_buttonup(win *window, GR_EVENT_BUTTON *event);
+void resizebar_buttonup(win *window, GR_EVENT_BUTTON *event);
+void closebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void maximisebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void restorebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void iconisebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void utilitybutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void icon_buttonup(win *window, GR_EVENT_BUTTON *event);
+void utilitymenuentry_buttonup(win *window, GR_EVENT_BUTTON *event);
+void rootmenuentry_buttonup(win *window, GR_EVENT_BUTTON *event);
+void closebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void maximisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void restorebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void iconisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void utilitybutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void utilitymenu_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void utilitymenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void rootmenu_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void rootmenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void container_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void topbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void leftbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void leftresize_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void bottombar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void rightresize_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void rightbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+
+extern GR_SCREEN_INFO si;
+extern GR_GC_ID buttonsgc;
+extern GR_COORD lastx, lasty;
+extern win *windows;
+extern GR_BITMAP utilitybutton_notpressed[];
+extern GR_BITMAP utilitybutton_pressed[];
+extern GR_BITMAP maximisebutton_notpressed[];
+extern GR_BITMAP maximisebutton_pressed[];
+extern GR_BITMAP iconisebutton_notpressed[];
+extern GR_BITMAP iconisebutton_pressed[];
+extern GR_BITMAP closebutton_notpressed[];
+extern GR_BITMAP closebutton_pressed[];
+extern GR_BITMAP restorebutton_notpressed[];
+extern GR_BITMAP restorebutton_pressed[];
+extern GR_BITMAP horizontal_resize_fg[];
+extern GR_BITMAP horizontal_resize_bg[];
+extern GR_BITMAP vertical_resize_fg[];
+extern GR_BITMAP vertical_resize_bg[];
+extern GR_BITMAP righthand_resize_fg[];
+extern GR_BITMAP righthand_resize_bg[];
+extern GR_BITMAP lefthand_resize_fg[];
+extern GR_BITMAP lefthand_resize_bg[];
+extern int horizontal_resize_columns, horizontal_resize_rows;
+extern int horizontal_resize_hotx, horizontal_resize_hoty;
+extern int vertical_resize_columns, vertical_resize_rows;
+extern int vertical_resize_hotx, vertical_resize_hoty;
+extern int lefthand_resize_columns, lefthand_resize_rows;
+extern int lefthand_resize_hotx, lefthand_resize_hoty;
+extern int righthand_resize_columns, righthand_resize_rows;
+extern int righthand_resize_hotx, righthand_resize_hoty;
+
+#endif
diff -urN lib/microwindows/src/demos/nanowm/org/wlist.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/wlist.c
--- lib/microwindows/src/demos/nanowm/org/wlist.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/org/wlist.c	2005-02-21 16:12:53.000000000 +0100
@@ -0,0 +1,121 @@
+/*
+ * NanoWM- the NanoGUI window manager.
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define MWINCLUDECOLORS
+#include <nano-X.h>
+
+/* Uncomment this to get debugging output from this file */
+//#define DEBUG
+#include "nanowm.h"
+
+win *windows = NULL;
+
+/*
+ * Find the windowlist entry for the specified window ID and return a pointer
+ * to it, or NULL if it isn't in the list.
+ */
+win *find_window(GR_WINDOW_ID wid)
+{
+	win *w = windows;
+
+	Dprintf("Looking for window %d... ", wid);
+
+	while(w) {
+		Dprintf("%d ", w->wid);
+		if(w->wid == wid) {
+			Dprintf("found it!\n");
+			return w;
+		}
+		w = w->next;
+	}
+
+	Dprintf("Nope, %d is not in the list\n", wid);
+	return NULL;
+}
+
+/*
+ * Add a new entry to the front of the windowlist.
+ * Returns -1 on failure or 0 on success.
+ */
+int add_window(win *window)
+{
+	win *w;
+
+	Dprintf("Adding window %d\n", window->wid);
+
+	if(!(w = malloc(sizeof(win)))) return -1;
+
+	w->wid = window->wid;
+	w->pid = window->pid;
+	w->type = window->type;
+	w->active = window->active;
+	w->data = window->data;
+	w->next = windows;
+	windows = w;
+
+	return 0;
+}
+
+/*
+ * Remove an entry from the windowlist.
+ * We must search through the list for it so that we can find the previous
+ * entry in the list and fix the next pointer. The alternative is to add a
+ * prev pointer to the structure which would increase the memory usage.
+ * Returns -1 on failure or 0 on success.
+ */
+int remove_window(win *window)
+{
+	win *w = windows;
+	win *prev = NULL;
+
+	while(w) {
+		if(w == window) {
+			if(!prev) windows = w->next;
+			else prev->next = w->next;
+			if(w->data) free(w->data);
+			free(w);
+			return 0;
+		}
+		prev = w;
+		w = w->next;
+	}
+
+	return -1;
+}
+
+/*
+ * Remove an entry and all it's children from the windowlist.
+ * Returns -1 on failure or 0 on success.
+ */
+int remove_window_and_children(win *window)
+{
+	win *t, *w = windows;
+	win *prev = NULL;
+	GR_WINDOW_ID pid = window->wid;
+
+	Dprintf("Removing window %d and children\n", window->wid);
+
+	while(w) {
+		Dprintf("Examining window %d (pid %d)\n", w->wid, w->pid);
+		if((w->pid == pid) || (w == window)) {
+			Dprintf("Removing window %d (pid %d)\n", w->wid,
+								w->pid);
+			if(prev) prev->next = w->next;
+			else windows = w->next;
+			t = w->next;
+			if(w->data) free(w->data);
+			free(w);
+			w = t;
+			continue;
+		}
+		prev = w;
+		w = w->next;
+	}
+
+	return -1;
+}
diff -urN lib/microwindows/src/demos/nanowm/wlist.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/wlist.c
--- lib/microwindows/src/demos/nanowm/wlist.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanowm/wlist.c	2005-02-21 16:12:54.000000000 +0100
@@ -0,0 +1,121 @@
+/*
+ * NanoWM - Window Manager for Nano-X
+ *
+ * Copyright (C) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+/* Uncomment this to get debugging output from this file */
+//#define DEBUG
+#include "nanowm.h"
+
+static win *windows = NULL;
+
+/*
+ * Find the windowlist entry for the specified window ID and return a pointer
+ * to it, or NULL if it isn't in the list.
+ */
+win *find_window(GR_WINDOW_ID wid)
+{
+	win *w = windows;
+
+	Dprintf("Looking for window %d... ", wid);
+
+	while(w) {
+		Dprintf("%d ", w->wid);
+		if(w->wid == wid) {
+			Dprintf("found it!\n");
+			return w;
+		}
+		w = w->next;
+	}
+
+	Dprintf("Nope, %d is not in the list\n", wid);
+	return NULL;
+}
+
+/*
+ * Add a new entry to the front of the windowlist.
+ * Returns -1 on failure or 0 on success.
+ */
+int add_window(win *window)
+{
+	win *w;
+
+	Dprintf("Adding window %d\n", window->wid);
+
+	if(!(w = malloc(sizeof(win)))) return -1;
+
+	w->wid = window->wid;
+	w->pid = window->pid;
+	w->type = window->type;
+	w->active = window->active;
+	w->clientid = window->clientid;
+	w->data = window->data;
+	w->next = windows;
+	windows = w;
+
+	return 0;
+}
+
+/*
+ * Remove an entry from the windowlist.
+ * We must search through the list for it so that we can find the previous
+ * entry in the list and fix the next pointer. The alternative is to add a
+ * prev pointer to the structure which would increase the memory usage.
+ * Returns -1 on failure or 0 on success.
+ */
+int remove_window(win *window)
+{
+	win *w = windows;
+	win *prev = NULL;
+
+	while(w) {
+		if(w == window) {
+			if(!prev) windows = w->next;
+			else prev->next = w->next;
+			if(w->data) free(w->data);
+			free(w);
+			return 0;
+		}
+		prev = w;
+		w = w->next;
+	}
+
+	return -1;
+}
+
+/*
+ * Remove an entry and all it's children from the windowlist.
+ * Returns -1 on failure or 0 on success.
+ */
+int remove_window_and_children(win *window)
+{
+	win *t, *w = windows;
+	win *prev = NULL;
+	GR_WINDOW_ID pid = window->wid;
+
+	Dprintf("Removing window %d and children\n", window->wid);
+
+	while(w) {
+		Dprintf("Examining window %d (pid %d)\n", w->wid, w->pid);
+		if((w->pid == pid) || (w == window)) {
+			Dprintf("Removing window %d (pid %d)\n", w->wid,
+								w->pid);
+			if(prev) prev->next = w->next;
+			else windows = w->next;
+			t = w->next;
+			if(w->data) free(w->data);
+			free(w);
+			w = t;
+			continue;
+		}
+		prev = w;
+		w = w->next;
+	}
+
+	return -1;
+}
diff -urN lib/microwindows/src/demos/nanox/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/Makefile
--- lib/microwindows/src/demos/nanox/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/Makefile	2005-02-21 16:12:56.000000000 +0100
@@ -0,0 +1,153 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+ifndef TOP
+TOP = ../..
+CONFIG = $(TOP)/config
+endif
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(NANOX), Y)
+ifeq ($(NANOXDEMO), Y)
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME =
+
+# List of objects to compile
+OBJS =	demo.o \
+	move.o \
+	landmine.o \
+	world.o \
+	nxclock.o \
+	nxterm.o \
+	nxview.o \
+	nxlsclients.o \
+	nxev.o \
+	npanel.o \
+	nterm.o \
+	demo2.o \
+	demo5.o \
+	demo6.o \
+	t1demo.o \
+	ftdemo.o \
+	logfont.o \
+	slider.o \
+	ntetris.o \
+	launcher.o \
+	nsaver.o \
+	getselection.o \
+	setselection.o
+
+all: default $(TOP)/bin/demo $(TOP)/bin/move $(TOP)/bin/landmine \
+	$(TOP)/bin/world $(TOP)/bin/nxclock $(TOP)/bin/nxterm \
+	$(TOP)/bin/nxview $(TOP)/bin/nxlsclients $(TOP)/bin/nxev \
+	$(TOP)/bin/npanel $(TOP)/bin/nterm \
+	$(TOP)/bin/demo2 $(TOP)/bin/demo5 $(TOP)/bin/demo6 \
+	$(TOP)/bin/t1demo $(TOP)/bin/ftdemo $(TOP)/bin/logfont \
+	$(TOP)/bin/slider $(TOP)/bin/ntetris $(TOP)/bin/launcher \
+	$(TOP)/bin/nsaver $(TOP)/bin/getselection $(TOP)/bin/setselection
+	$(CP) world.map nanogui.ppm ntetris.ppm launcher.cnf tux.gif $(TOP)/bin
+	
+
+endif
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+ifeq ($(SHAREDLIBS), Y)
+LD_NANOXCLIENTLIBS = $(CCNANOXCLIENTLIBS)
+else
+LD_NANOXCLIENTLIBS = $(NANOXCLIENTLIBS)
+endif
+
+######################## Tools targets section ###############################
+
+$(TOP)/bin/demo: demo.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/move: move.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/landmine: landmine.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/world: world.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/nxclock: nxclock.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/nxterm: nxterm.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/nxview: nxview.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/nxlsclients: nxlsclients.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/nxev: nxev.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/npanel: npanel.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/nterm: nterm.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/demo2: demo2.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/demo5: demo5.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/demo6: demo6.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/t1demo: t1demo.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/ftdemo: ftdemo.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/logfont: logfont.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/slider: slider.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/ntetris: ntetris.o $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/launcher: launcher.o $($NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/nsaver: nsaver.o $($NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/getselection: getselection.o $($NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
+
+$(TOP)/bin/setselection: setselection.o $($NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LD_NANOXCLIENTLIBS)
diff -urN lib/microwindows/src/demos/nanox/README.world /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/README.world
--- lib/microwindows/src/demos/nanox/README.world	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/README.world	2005-02-21 16:02:59.000000000 +0100
@@ -0,0 +1,64 @@
+				WORLD
+
+This is a program that uses mini-X graphics in MINIX to display a map of
+the world.  The database for this map is supplied, and is an edited version
+of the CIA database.  The continents, islands, rivers, lakes, countries,
+and the states of the USA are shown.  I have slightly edited the database
+to fix some arctic islands and remove the Berlin corridor.  But some country
+boundaries are obsolete, since this map is a few years old at least.
+
+This program only uses integer arithmetic.  Floating point is simulated
+using fixed point arithmetic.  For this reason, the projection used in
+the program is rather crude (latitude and longitude are linear and are
+parallel lines).  This means that there is much distortion for the lands
+which are near the North and South poles.  If floating point was avaiable,
+a good projection could be used instead (such as a true spherical view!).
+
+The file "world.map" is the database, and should be installed in "/usr/lib".
+Otherwise you need to edit world.c and change MAPFILE as desired.
+
+To build the program (assuming mini-X is installed), use the command:
+
+	cc -o world world.c -lgraph
+
+When the program starts, it draws the whole world.  After this is done,
+you can use two of the mouse buttons and the keys to manipulate the view.
+
+To zoom in on a section of the map, move the mouse to the location that
+you intend to zoom in on, and press the left mouse button.  Then when you
+drag the mouse, a rectangle (the zoom box) will be drawn to indicate the
+current area that you are zooming into.  Notice that the point that you
+start the zoom box on will be the center of the zoom box, NOT one of its
+corners.
+
+While keeping the mouse button pressed, you can use the 's' and 'm' keys
+to switch between the 'scaling' and the 'moving' modes of the rectangle.
+The scaling mode makes the size of the zoom box vary as you move the mouse,
+but keeps the center of the zoom box fixed.  The moving mode keeps the size
+of the zoom box the same, but moves the box around as you move the mouse.
+Note that the width and height of the zoom box change together to preserve
+the aspect ratio of the zoom area.
+
+If you have started to do a zoom, but change your mind, then you can type
+the escape key before letting up on the mouse button, and this will cancel
+the zoom operation.  If you really want to do a zoom, then simply let up
+on the mouse button and the selected area will be redrawn to fit the screen.
+At this point you can zoom in further if you wish.
+
+You can return to the top level map by typing 't'.  Then you can zoom in
+again on a different area of the map.  Alternatively, you can "zoom out"
+just a little by creating a zoom box larger than the screen size.  This can
+be done, for example, by starting a zoom near the top of the screen, and then
+dragging the mouse down to the bottom of the screen.  Repeating this process
+lets you slowly reduce the magnification.
+
+If you press the right mouse button, the display will show the longitude
+and latitude of the location on the map covered by the cursor.  You can then
+drag the mouse around with the button held down, and the coordinates will
+continuously track the cursor location.  Letting up on the mouse button
+removes the coordinate display.
+
+Typing 'q' will quit from the world program.
+
+Enjoy!
+David I. Bell
diff -urN lib/microwindows/src/demos/nanox/demo.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/demo.c
--- lib/microwindows/src/demos/nanox/demo.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/demo.c	2005-02-21 16:02:55.000000000 +0100
@@ -0,0 +1,479 @@
+/*
+ * Demonstration program for Nano-X graphics.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+#if DOS_TURBOC
+unsigned _stklen = 32768;
+#endif
+
+/*
+ * Definitions to make it easy to define cursors
+ */
+#define	_	((unsigned) 0)		/* off bits */
+#define	X	((unsigned) 1)		/* on bits */
+#define	MASK(a,b,c,d,e,f,g) \
+	(((((((((((((a * 2) + b) * 2) + c) * 2) + d) * 2) \
+	+ e) * 2) + f) * 2) + g) << 9)
+
+#define	W2_WIDTH	70
+#define	W2_HEIGHT	40
+
+
+static	GR_WINDOW_ID	w1;		/* id for large window */
+static	GR_WINDOW_ID	w2;		/* id for small window */
+static	GR_WINDOW_ID	w3;		/* id for third window */
+static	GR_WINDOW_ID	w4;		/* id for grabbable window */
+static	GR_WINDOW_ID	w5;		/* id for testing enter/exit window */
+static	GR_GC_ID	gc1;		/* graphics context for text */
+static	GR_GC_ID	gc2;		/* graphics context for rectangle */
+static	GR_GC_ID	gc3;		/* graphics context for circles */
+static	GR_GC_ID	gc4;		/* graphics context for lines */
+static	GR_COORD	begxpos;	/* beginning x position */
+static	GR_COORD	xpos;		/* x position for text drawing */
+static	GR_COORD	ypos;		/* y position for text drawing */
+static	GR_COORD	linexpos;	/* x position for line drawing */
+static	GR_COORD	lineypos;	/* y position for line drawing */
+static	GR_COORD	xorxpos;	/* x position for xor line */
+static	GR_COORD	xorypos;	/* y position for xor line */
+static	GR_BOOL		lineok;		/* ok to draw line */
+static	GR_SIZE		COLS, ROWS;
+static	GR_SCREEN_INFO	si;		/* information about screen */
+
+void do_buttondown(GR_EVENT_BUTTON	*bp);
+void do_buttonup(GR_EVENT_BUTTON	*bp);
+void do_motion(GR_EVENT_MOUSE		*mp);
+void do_keystroke(GR_EVENT_KEYSTROKE	*kp);
+void do_exposure(GR_EVENT_EXPOSURE	*ep);
+void do_focusin(GR_EVENT_GENERAL	*gp);
+void do_focusout(GR_EVENT_GENERAL	*gp);
+void do_enter(GR_EVENT_GENERAL		*gp);
+void do_exit(GR_EVENT_GENERAL		*gp);
+void do_idle(void);
+/* routine to handle errors */
+void errorcatcher(GR_EVENT *ep);
+
+int
+main(int argc,char **argv)
+{
+	GR_EVENT	event;		/* current event */
+	GR_BITMAP	bitmap1fg[7];	/* bitmaps for first cursor */
+	GR_BITMAP	bitmap1bg[7];
+	GR_BITMAP	bitmap2fg[7];	/* bitmaps for second cursor */
+	GR_BITMAP	bitmap2bg[7];
+
+	if (GrOpen() < 0) {
+		fprintf(stderr, "cannot open graphics\n");
+		exit(1);
+	}
+
+	GrReqShmCmds(655360);
+	
+	GrGetScreenInfo(&si);
+COLS = si.cols - 40;
+ROWS = si.rows - 80;
+
+	/* print error, but don't exit*/
+	GrSetErrorHandler(errorcatcher);
+
+	w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 100, 50, COLS - 120,
+		ROWS - 60, 1, BROWN, WHITE);
+	w2 = GrNewWindow(GR_ROOT_WINDOW_ID, 6, 6, W2_WIDTH, W2_HEIGHT, 2, GREEN,
+		WHITE);
+	w3 = GrNewWindow(GR_ROOT_WINDOW_ID, 250, 30, 80, 100, 1, LTGRAY,
+		GREEN);
+	w4 = GrNewWindow(GR_ROOT_WINDOW_ID, 350, 20, 200, 150, 5, BLACK, WHITE);
+	w5 = GrNewWindow(GR_ROOT_WINDOW_ID, 11, 143, 209, 100, 1, BLUE, GREEN);
+
+	GrSelectEvents(w1, GR_EVENT_MASK_BUTTON_DOWN |
+		GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_EXPOSURE |
+		GR_EVENT_MASK_FOCUS_IN | GR_EVENT_MASK_FOCUS_OUT |
+		GR_EVENT_MASK_CLOSE_REQ);
+	/* must select down and up for w2 to get implicit grab when
+	 * running window manager, otherwise the wm-created parent
+	 * window will get the grab, and we won't get the button up...
+	 */
+	GrSelectEvents(w2, GR_EVENT_MASK_BUTTON_DOWN |
+			GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(w3, GR_EVENT_MASK_BUTTON_DOWN |
+		GR_EVENT_MASK_MOUSE_MOTION | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(w4, GR_EVENT_MASK_BUTTON_DOWN |
+		GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_MOUSE_POSITION |
+		GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(w5, GR_EVENT_MASK_MOUSE_ENTER |
+		GR_EVENT_MASK_MOUSE_EXIT | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_BUTTON_DOWN |
+			GR_EVENT_MASK_CLOSE_REQ);
+
+	GrMapWindow(w1);
+	GrMapWindow(w2);
+	GrMapWindow(w3);
+	GrMapWindow(w4);
+	GrMapWindow(w5);
+
+	gc1 = GrNewGC();
+	gc2 = GrNewGC();
+	gc3 = GrNewGC();
+	gc4 = GrNewGC();
+
+	GrSetGCForeground(gc1, RED);
+	GrSetGCBackground(gc1, BROWN);
+	GrSetGCForeground(gc2, MAGENTA);
+	GrSetGCMode(gc4, GR_MODE_XOR);
+
+	bitmap1fg[0] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[1] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[2] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[3] = MASK(X,X,X,X,X,X,X);
+	bitmap1fg[4] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[5] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[6] = MASK(_,_,_,X,_,_,_);
+
+	bitmap1bg[0] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[1] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[2] = MASK(X,X,X,X,X,X,X);
+	bitmap1bg[3] = MASK(X,X,X,X,X,X,X);
+	bitmap1bg[4] = MASK(X,X,X,X,X,X,X);
+	bitmap1bg[5] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[6] = MASK(_,_,X,X,X,_,_);
+
+	bitmap2fg[0] = MASK(_,_,X,X,X,_,_);
+	bitmap2fg[1] = MASK(_,X,_,_,_,X,_);
+	bitmap2fg[2] = MASK(X,_,_,_,_,_,X);
+	bitmap2fg[3] = MASK(X,_,_,_,_,_,X);
+	bitmap2fg[4] = MASK(_,X,_,_,_,X,_);
+	bitmap2fg[5] = MASK(_,_,X,X,X,_,_);
+
+	bitmap2bg[0] = MASK(_,_,X,X,X,_,_);
+	bitmap2bg[1] = MASK(_,X,X,X,X,X,_);
+	bitmap2bg[2] = MASK(X,X,X,X,X,X,X);
+	bitmap2bg[3] = MASK(X,X,X,X,X,X,X);
+	bitmap2bg[4] = MASK(_,X,X,X,X,X,_);
+	bitmap2bg[5] = MASK(_,_,X,X,X,_,_);
+
+	GrSetCursor(w1, 7, 7, 3, 3, WHITE, BLACK, bitmap1fg, bitmap1bg);
+	GrSetCursor(w2, 7, 7, 3, 3, WHITE, BLACK, bitmap2fg, bitmap2bg);
+
+	while (1) {
+		GrCheckNextEvent(&event);
+
+		switch (event.type) {
+			case GR_EVENT_TYPE_BUTTON_DOWN:
+				do_buttondown(&event.button);
+				break;
+
+			case GR_EVENT_TYPE_BUTTON_UP:
+				do_buttonup(&event.button);
+				break;
+
+			case GR_EVENT_TYPE_MOUSE_POSITION:
+			case GR_EVENT_TYPE_MOUSE_MOTION:
+				do_motion(&event.mouse);
+				break;
+
+			case GR_EVENT_TYPE_KEY_DOWN:
+				do_keystroke(&event.keystroke);
+				break;
+
+			case GR_EVENT_TYPE_EXPOSURE:
+				do_exposure(&event.exposure);
+				break;
+
+			case GR_EVENT_TYPE_FOCUS_IN:
+				do_focusin(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_FOCUS_OUT:
+				do_focusout(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_MOUSE_ENTER:
+				do_enter(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_MOUSE_EXIT:
+				do_exit(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_CLOSE_REQ:
+				GrClose();
+				exit(0);
+
+			case GR_EVENT_TYPE_NONE:
+				do_idle();
+				break;
+		}
+	}
+}
+
+
+/*
+ * Here when a button is pressed.
+ */
+void
+do_buttondown(GR_EVENT_BUTTON	*bp)
+{
+	GR_PIXELVAL	intable[W2_WIDTH * W2_HEIGHT];
+	GR_PIXELVAL	outtable[W2_WIDTH * W2_HEIGHT * 6];
+	GR_PIXELVAL	*inp;
+	GR_PIXELVAL	*outp;
+	GR_PIXELVAL	*oldinp;
+	GR_COORD	row;
+	GR_COORD	col;
+
+	/*static int xx = 100;
+	static int yy = 50;*/
+
+	if (bp->wid == w3) {
+		GrRaiseWindow(w3);
+		GrReadArea(w2, 0, 0, W2_WIDTH, W2_HEIGHT, intable);
+		inp = intable;
+		outp = outtable;
+		for (row = 0; row < W2_HEIGHT; row++) {
+			oldinp = inp;
+			for (col = 0; col < W2_WIDTH; col++) {
+				*outp++ = *inp;
+				*outp++ = *inp++;
+			}
+			inp = oldinp;
+			for (col = 0; col < W2_WIDTH; col++) {
+				*outp++ = *inp;
+				*outp++ = *inp++;
+			}
+			inp = oldinp;
+			for (col = 0; col < W2_WIDTH; col++) {
+				*outp++ = *inp;
+				*outp++ = *inp++;
+			}
+		}
+		GrArea(w1, gc1, 0, 0, W2_WIDTH * 2, W2_HEIGHT * 3, outtable,
+			MWPF_PIXELVAL);
+		return;
+	}
+
+	if (bp->wid == w4) {
+		GrRaiseWindow(w4);
+		linexpos = bp->x;
+		lineypos = bp->y;
+		xorxpos = bp->x;
+		xorypos = bp->y;
+		GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+		lineok = GR_TRUE;
+		return;
+	}
+
+	if (bp->wid != w1) {
+		/*
+		 * Cause a fatal error for testing if more than one
+		 * button is pressed.
+		 */
+		if ((bp->buttons & -((int) bp->buttons)) != bp->buttons)
+			GrClearWindow(-1, 0);
+		return;
+	}
+
+	GrRaiseWindow(w1);
+	/*GrMoveWindow(w1, ++xx, yy);*/
+
+	if (bp->buttons & GR_BUTTON_L) {
+		GrClearWindow(w1, GR_TRUE);
+		return;
+	}
+
+	begxpos = bp->x;
+	xpos = bp->x;
+	ypos = bp->y;
+}
+
+
+/*
+ * Here when a button is released.
+ */
+void
+do_buttonup(GR_EVENT_BUTTON	*bp)
+{
+	if (bp->wid == w4) {
+		if (lineok) {
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+			GrLine(w4, gc3, bp->x, bp->y, linexpos, lineypos);
+		}
+		lineok = GR_FALSE;
+		return;
+	}
+
+	if (bp->wid == w2) {
+		GrClose();
+		exit(0);
+	}
+}
+
+
+/*
+ * Here when the mouse has a motion event.
+ */
+void
+do_motion(GR_EVENT_MOUSE	*mp)
+{
+	if (mp->wid == w4) {
+		if (lineok) {
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+			xorxpos = mp->x;
+			xorypos = mp->y;
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+		}
+		return;
+	}
+
+	if (mp->wid == w3) {
+		GrPoint(w3, gc3, mp->x, mp->y);
+		return;
+	}
+}
+
+
+/*
+ * Here when a keyboard press occurs.
+ */
+void
+do_keystroke(GR_EVENT_KEYSTROKE	*kp)
+{
+	GR_SIZE		width;		/* width of character */
+	GR_SIZE		height;		/* height of character */
+	GR_SIZE		base;		/* height of baseline */
+
+	if (kp->wid == w4) {
+		if (lineok) {
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+			lineok = GR_FALSE;
+		}
+		return;
+	}
+
+	GrGetGCTextSize(gc1, &kp->ch, 1, GR_TFASCII, &width, &height, &base);
+	if ((kp->ch == '\r') || (kp->ch == '\n')) {
+		xpos = begxpos;
+		ypos += height;
+		return;
+	}
+	if (kp->ch == '\b') {		/* assumes fixed width font!! */
+		if (xpos <= begxpos)
+			return;
+		xpos -= width;
+		GrSetGCForeground(gc3, BROWN);
+		GrFillRect(w1, gc3, xpos, ypos - height + base + 1,
+			width, height);
+		return;
+	}
+	GrText(w1, gc1, xpos, ypos + base, &kp->ch, 1, 0);
+	xpos += width;
+}
+
+
+/*
+ * Here when an exposure event occurs.
+ */
+void
+do_exposure(GR_EVENT_EXPOSURE	*ep)
+{
+	GR_POINT	points[3];
+
+	if (ep->wid != w1)
+		return;
+	points[0].x = 311;
+	points[0].y = 119;
+	points[1].x = 350;
+	points[1].y = 270;
+	points[2].x = 247;
+	points[2].y = 147;
+
+	GrFillRect(w1, gc2, 50, 50, 150, 200);
+	GrFillPoly(w1, gc2, 3, points);
+}
+
+
+/*
+ * Here when a focus in event occurs.
+ */
+void
+do_focusin(GR_EVENT_GENERAL	*gp)
+{
+	if (gp->wid != w1)
+		return;
+	GrSetBorderColor(w1, WHITE);
+}
+
+/*
+ * Here when a focus out event occurs.
+ */
+void
+do_focusout(GR_EVENT_GENERAL	*gp)
+{
+	if (gp->wid != w1)
+		return;
+	GrSetBorderColor(w1, GRAY);
+}
+
+
+/*
+ * Here when a enter window event occurs.
+ */
+void
+do_enter(GR_EVENT_GENERAL	*gp)
+{
+	if (gp->wid != w5)
+		return;
+	GrSetBorderColor(w5, WHITE);
+	GrRaiseWindow(w5);
+}
+
+
+/*
+ * Here when a exit window event occurs.
+ */
+void
+do_exit(GR_EVENT_GENERAL	*gp)
+{
+	if (gp->wid != w5)
+		return;
+	GrSetBorderColor(w5, GREEN);
+	GrLowerWindow(w5);
+}
+
+
+/*
+ * Here to do an idle task when nothing else is happening.
+ * Just draw a randomly colored filled circle in the small window.
+ */
+void
+do_idle(void)
+{
+	GR_COORD	x;
+	GR_COORD	y;
+	GR_SIZE		rx;
+	GR_SIZE		ry;
+	GR_COLOR	color;
+
+	x = rand() % 70;
+	y = rand() % 40;
+	rx = (rand() % 10) + 5;
+	ry = (rx * si.ydpcm) / si.xdpcm;	/* make it appear circular */
+	
+	color = rand() % si.ncolors;
+
+	GrSetGCForeground(gc3, MWPALINDEX(color));
+	GrFillEllipse(w2, gc3, x, y, rx, ry);	
+}
+
+
+/*
+ * Here on a server error.  Print the std message but don't exit.
+ */
+void
+errorcatcher(GR_EVENT *ep)
+{
+	printf("nxclient: Error (%s) ", ep->error.name);
+	printf(nxErrorStrings[ep->error.code], ep->error.id);
+}
diff -urN lib/microwindows/src/demos/nanox/demo2.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/demo2.c
--- lib/microwindows/src/demos/nanox/demo2.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/demo2.c	2005-02-21 16:12:54.000000000 +0100
@@ -0,0 +1,90 @@
+#define MWINCLUDECOLORS
+#include <stdio.h>
+#include "nano-X.h"
+
+#include <signal.h>
+
+int
+main(int ac,char **av)
+{
+	GR_WINDOW_ID 	w, w2;
+	GR_GC_ID	gc;
+	GR_EVENT 	event;
+	GR_WM_PROPERTIES props;
+
+	if (GrOpen() < 0) {
+		printf("Can't open graphics\n");
+		exit(1);
+	}
+
+	/* pass errors through main loop*/
+	GrSetErrorHandler(NULL);
+
+#define WIDTH	300
+#define HEIGHT	240
+	w = GrNewWindow(GR_ROOT_WINDOW_ID, 20, 20, WIDTH, HEIGHT,
+		0, GREEN, BLACK);
+
+	w2 = GrNewWindow(w, 20, 20, 40, 40, 0, WHITE, BLACK);
+
+	props.flags = GR_WM_FLAGS_PROPS | GR_WM_FLAGS_TITLE;
+	props.props = GR_WM_PROPS_NOBACKGROUND;
+	props.title = "Nano-X Demo2";
+	GrSetWMProperties(w, &props);
+
+	gc = GrNewGC();
+
+	GrSelectEvents(w, GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_CLOSE_REQ
+		| GR_EVENT_MASK_BUTTON_DOWN
+		| GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_KEY_UP);
+	GrMapWindow(w);
+	GrSetFocus(w);
+	//GrMapWindow(w2);
+
+	for (;;) {
+		//GR_EVENT_KEYSTROKE *kev;
+
+		GrGetNextEvent(&event);
+		switch (event.type) {
+		case GR_EVENT_TYPE_EXPOSURE:
+			GrSetGCForeground(gc,GrGetSysColor(GR_COLOR_APPWINDOW));
+			GrFillRect(w, gc, event.exposure.x, event.exposure.y,
+				event.exposure.width, event.exposure.height);
+			GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_APPTEXT));
+			GrSetGCUseBackground(gc, GR_FALSE);
+			GrText(w, gc, 10, 30, "Hello World", -1, GR_TFASCII);
+			break;
+		case GR_EVENT_TYPE_CLOSE_REQ:
+			GrClose();
+			exit(0);
+			break;
+		case GR_EVENT_TYPE_ERROR:
+			printf("\7demo2: Error (%s) ", event.error.name);
+			printf(nxErrorStrings[event.error.code],event.error.id);
+			break;
+#if 0
+		case GR_EVENT_TYPE_BUTTON_DOWN:
+			/* test server error on bad syscall*/
+			GrMapWindow(w2);
+			GrMoveWindow(GR_ROOT_WINDOW_ID, 0, 0);
+			{ GR_SCREEN_INFO sinfo; GrGetScreenInfo(&sinfo); }
+			break;
+#endif
+#if 0
+		case GR_EVENT_TYPE_KEY_DOWN:
+			kev = (GR_EVENT_KEYSTROKE *)&event;
+			printf("DOWN %d (%04x) %04x\n",
+				kev->ch, kev->ch, kev->modifiers);
+			break;
+		case GR_EVENT_TYPE_KEY_UP:
+			kev = (GR_EVENT_KEYSTROKE *)&event;
+			printf("UP %d (%04x) %04x\n",
+				kev->ch, kev->ch, kev->modifiers);
+			break;
+#endif
+		}
+	}
+
+	GrClose();
+	return 0;
+}
diff -urN lib/microwindows/src/demos/nanox/demo4.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/demo4.c
--- lib/microwindows/src/demos/nanox/demo4.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/demo4.c	2005-02-21 16:12:54.000000000 +0100
@@ -0,0 +1,95 @@
+/*
+ * Demonstration program for Nano-X blitting
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "nano-X.h"
+#include "device.h"
+
+static	GR_WINDOW_ID	w1;		/* id for large window */
+static	GR_GC_ID	gc1;		/* graphics context for text */
+static	GR_GC_ID	gc2;		/* graphics context for text */
+static	GR_SCREEN_INFO	si;		/* information about screen */
+
+#define GRAY14		MWRGB( 17, 17, 17 )
+#define GRAY13		MWRGB( 34, 34, 34 )
+#define GRAY12		MWRGB( 51, 51, 51 )
+#define GRAY11		MWRGB( 68, 68, 68 )
+#define GRAY10		MWRGB( 85, 85, 85 )
+#define GRAY9		MWRGB( 102, 102, 102 )
+#define GRAY8		MWRGB( 119, 119, 119 )
+#define GRAY7		MWRGB( 136, 136, 136 )
+#define GRAY6		MWRGB( 153, 153, 153 )
+#define GRAY5		MWRGB( 170, 170, 170 )
+#define GRAY4		MWRGB( 187, 187, 187 )
+#define GRAY3		MWRGB( 204, 204, 204 )
+#define GRAY2		MWRGB( 221, 221, 221 )
+#define GRAY1		MWRGB( 238, 238, 238 )
+
+int
+main(int argc,char **argv)
+{
+	GR_EVENT	event;		/* current event */
+
+	if (GrOpen() < 0) {
+		fprintf(stderr, "cannot open graphics\n");
+		exit(1);
+	}
+	
+	GrGetScreenInfo(&si);
+
+//	w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 99, 49, 440, 380, 4, BLACK, WHITE);
+//	GrSelectEvents(w1, GR_EVENT_MASK_CLOSE_REQ);
+
+//	GrMapWindow(w1);
+
+	gc1 = GrNewGC();
+//	gc2 = GrNewGC();
+
+	GrSetGCForeground(gc1, WHITE);
+//	GrFillRect(GR_ROOT_WINDOW_ID, gc, 0, 0, 240, 320);
+
+	GrLine(GR_ROOT_WINDOW_ID, gc1, 4, 4, 634, 4);
+	GrLine(GR_ROOT_WINDOW_ID, gc1, 4, 4, 4, 474);
+	GrLine(GR_ROOT_WINDOW_ID, gc1, 634, 4, 634, 474);
+	GrLine(GR_ROOT_WINDOW_ID, gc1, 4, 474, 634, 474);
+
+//	GrJPEG(w1, gc2, 0, 0, 400, 400, "/home/mart/nov9_pic1.jpg");
+
+// Bitblit function
+{
+	PSD	mempsd;
+	int	linelen, size;
+	void *	pixels;
+	
+	mempsd = scrdev.AllocateMemGC(&scrdev);
+	GdCalcMemGCAlloc(mempsd, 50, 100, 0, 0, &size, &linelen);
+	pixels = malloc(size);
+	mempsd->flags |= PSF_ADDRMALLOC;
+	mempsd->MapMemGC(mempsd, 50, 100, scrdev.planes, scrdev.bpp,
+		linelen, size, pixels);
+
+	// Draw some stuff on offscreen
+	GdSetForeground(GdFindColor(GREEN));
+	GdFillRect(mempsd, 0, 0, 50, 100);
+	GdSetForeground(GdFindColor(RED));
+	GdFillRect(mempsd, 5, 20, 40, 60);
+
+	// blit
+	GdBlit(&scrdev, 10, 10, 50, 100, mempsd, 0, 0, 0);
+}
+/*	GrSetGCForeground(gc, BLACK);
+	GrPoint(GR_ROOT_WINDOW_ID, gc, 0, 0);
+
+	GrSetGCForeground(gc, GRAY10);
+	GrFillRect(GR_ROOT_WINDOW_ID, gc, 1, 1, 478, 638);
+*/
+	while (1) {
+		GrGetNextEvent(&event);
+		if(event.type == GR_EVENT_TYPE_CLOSE_REQ) break;
+	}
+
+	GrClose();
+
+	return 0;
+}
diff -urN lib/microwindows/src/demos/nanox/demo5.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/demo5.c
--- lib/microwindows/src/demos/nanox/demo5.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/demo5.c	2005-02-21 16:12:55.000000000 +0100
@@ -0,0 +1,471 @@
+/*
+ * Demonstration program for off screen drawing with Nano-X. Based on demo.c
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+/*
+ * Definitions to make it easy to define cursors
+ */
+#define	_	((unsigned) 0)		/* off bits */
+#define	X	((unsigned) 1)		/* on bits */
+#define	MASK(a,b,c,d,e,f,g) \
+	(((((((((((((a * 2) + b) * 2) + c) * 2) + d) * 2) \
+	+ e) * 2) + f) * 2) + g) << 9)
+
+#define	W2_WIDTH	70
+#define	W2_HEIGHT	40
+
+
+static	GR_WINDOW_ID	w1;		/* id for large window */
+static	GR_WINDOW_ID	w2;		/* id for small window */
+static	GR_WINDOW_ID	w3;		/* id for third window */
+static	GR_WINDOW_ID	w4;		/* id for grabbable window */
+static	GR_WINDOW_ID	w5;		/* id for testing enter/exit window */
+static  GR_WINDOW_ID    p1;             /* off screen pixmap */
+static	GR_GC_ID	gc1;		/* graphics context for text */
+static	GR_GC_ID	gc2;		/* graphics context for rectangle */
+static	GR_GC_ID	gc3;		/* graphics context for circles */
+static	GR_GC_ID	gc4;		/* graphics context for lines */
+static	GR_COORD	begxpos;	/* beginning x position */
+static	GR_COORD	xpos;		/* x position for text drawing */
+static	GR_COORD	ypos;		/* y position for text drawing */
+static	GR_COORD	linexpos;	/* x position for line drawing */
+static	GR_COORD	lineypos;	/* y position for line drawing */
+static	GR_COORD	xorxpos;	/* x position for xor line */
+static	GR_COORD	xorypos;	/* y position for xor line */
+static	GR_BOOL		lineok;		/* ok to draw line */
+static	GR_SCREEN_INFO	si;		/* information about screen */
+
+void do_buttondown();
+void do_buttonup();
+void do_motion();
+void do_keystroke();
+void do_exposure();
+void do_focusin();
+void do_focusout();
+void do_enter();
+void do_exit();
+void do_idle();
+
+int
+main(int argc,char **argv)
+{
+	GR_EVENT	event;		/* current event */
+	GR_BITMAP	bitmap1fg[7];	/* bitmaps for first cursor */
+	GR_BITMAP	bitmap1bg[7];
+	GR_BITMAP	bitmap2fg[7];	/* bitmaps for second cursor */
+	GR_BITMAP	bitmap2bg[7];
+
+	if (GrOpen() < 0) {
+		fprintf(stderr, "cannot open graphics\n");
+		exit(1);
+	}
+	
+	GrGetScreenInfo(&si);
+
+	w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 100, 50, si.cols - 120,
+		si.rows - 60, 1, BROWN, WHITE);
+	w2 = GrNewWindow(GR_ROOT_WINDOW_ID, 6, 6, W2_WIDTH, W2_HEIGHT, 2, GREEN,
+		WHITE);
+	w3 = GrNewWindow(GR_ROOT_WINDOW_ID, 250, 30, 80, 100, 1, LTGRAY,
+		GREEN);
+	w4 = GrNewWindow(GR_ROOT_WINDOW_ID, 350, 20, 200, 150, 5, BLACK, WHITE);
+	w5 = GrNewWindow(GR_ROOT_WINDOW_ID, 11, 143, 209, 100, 1, BLUE, GREEN);
+
+        p1 = GrNewPixmap(200,200,0);
+   
+	GrSelectEvents(w1, GR_EVENT_MASK_BUTTON_DOWN |
+		GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_EXPOSURE |
+		GR_EVENT_MASK_FOCUS_IN | GR_EVENT_MASK_FOCUS_OUT |
+		GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(w2, GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(w3, GR_EVENT_MASK_BUTTON_DOWN |
+		GR_EVENT_MASK_MOUSE_MOTION | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(w4, GR_EVENT_MASK_BUTTON_DOWN |
+		GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_MOUSE_POSITION |
+		GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(w5, GR_EVENT_MASK_MOUSE_ENTER |
+		GR_EVENT_MASK_MOUSE_EXIT | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_BUTTON_DOWN |
+			GR_EVENT_MASK_CLOSE_REQ);
+
+	GrMapWindow(w1);
+	GrMapWindow(w2);
+	GrMapWindow(w3);
+	GrMapWindow(w4);
+	GrMapWindow(w5);
+
+	gc1 = GrNewGC();
+	gc2 = GrNewGC();
+	gc3 = GrNewGC();
+	gc4 = GrNewGC();
+
+	GrSetGCForeground(gc1, RED);
+	GrSetGCBackground(gc1, BROWN);
+	GrSetGCForeground(gc2, MAGENTA);
+	GrSetGCMode(gc4, GR_MODE_XOR);
+
+	bitmap1fg[0] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[1] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[2] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[3] = MASK(X,X,X,X,X,X,X);
+	bitmap1fg[4] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[5] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[6] = MASK(_,_,_,X,_,_,_);
+
+	bitmap1bg[0] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[1] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[2] = MASK(X,X,X,X,X,X,X);
+	bitmap1bg[3] = MASK(X,X,X,X,X,X,X);
+	bitmap1bg[4] = MASK(X,X,X,X,X,X,X);
+	bitmap1bg[5] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[6] = MASK(_,_,X,X,X,_,_);
+
+	bitmap2fg[0] = MASK(_,_,X,X,X,_,_);
+	bitmap2fg[1] = MASK(_,X,_,_,_,X,_);
+	bitmap2fg[2] = MASK(X,_,_,_,_,_,X);
+	bitmap2fg[3] = MASK(X,_,_,_,_,_,X);
+	bitmap2fg[4] = MASK(_,X,_,_,_,X,_);
+	bitmap2fg[5] = MASK(_,_,X,X,X,_,_);
+
+	bitmap2bg[0] = MASK(_,_,X,X,X,_,_);
+	bitmap2bg[1] = MASK(_,X,X,X,X,X,_);
+	bitmap2bg[2] = MASK(X,X,X,X,X,X,X);
+	bitmap2bg[3] = MASK(X,X,X,X,X,X,X);
+	bitmap2bg[4] = MASK(_,X,X,X,X,X,_);
+	bitmap2bg[5] = MASK(_,_,X,X,X,_,_);
+
+	GrSetCursor(w1, 7, 7, 3, 3, WHITE, BLACK, bitmap1fg, bitmap1bg);
+	GrSetCursor(w2, 7, 6, 3, 3, WHITE, BLACK, bitmap2fg, bitmap2bg);
+
+	GrRect(GR_ROOT_WINDOW_ID, gc1, 0, 0, si.cols, si.rows);
+
+
+	while (1) {
+		GrGetNextEvent(&event);
+
+		switch (event.type) {
+			case GR_EVENT_TYPE_BUTTON_DOWN:
+				do_buttondown(&event.button);
+				break;
+
+			case GR_EVENT_TYPE_BUTTON_UP:
+				do_buttonup(&event.button);
+				break;
+
+			case GR_EVENT_TYPE_MOUSE_POSITION:
+			case GR_EVENT_TYPE_MOUSE_MOTION:
+				do_motion(&event.mouse);
+				break;
+
+			case GR_EVENT_TYPE_KEY_DOWN:
+				do_keystroke(&event.keystroke);
+				break;
+
+			case GR_EVENT_TYPE_EXPOSURE:
+				do_exposure(&event.exposure);
+				break;
+
+			case GR_EVENT_TYPE_FOCUS_IN:
+				do_focusin(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_FOCUS_OUT:
+				do_focusout(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_MOUSE_ENTER:
+				do_enter(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_MOUSE_EXIT:
+				do_exit(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_CLOSE_REQ:
+				GrClose();
+				exit(0);
+
+			case GR_EVENT_TYPE_NONE:
+				do_idle();
+				break;
+		}
+	}
+}
+
+
+/*
+ * Here when a button is pressed.
+ */
+void
+do_buttondown(bp)
+	GR_EVENT_BUTTON	*bp;
+{
+	GR_PIXELVAL	intable[W2_WIDTH * W2_HEIGHT];
+	GR_PIXELVAL	outtable[W2_WIDTH * W2_HEIGHT * 6];
+	GR_PIXELVAL	*inp;
+	GR_PIXELVAL	*outp;
+	GR_PIXELVAL	*oldinp;
+	GR_COORD	row;
+	GR_COORD	col;
+
+	/*static int xx = 100;
+	static int yy = 50;*/
+
+	if (bp->wid == w3) {
+		GrRaiseWindow(w3);
+		GrReadArea(w2, 0, 0, W2_WIDTH, W2_HEIGHT, intable);
+		inp = intable;
+		outp = outtable;
+		for (row = 0; row < W2_HEIGHT; row++) {
+			oldinp = inp;
+			for (col = 0; col < W2_WIDTH; col++) {
+				*outp++ = *inp;
+				*outp++ = *inp++;
+			}
+			inp = oldinp;
+			for (col = 0; col < W2_WIDTH; col++) {
+				*outp++ = *inp;
+				*outp++ = *inp++;
+			}
+			inp = oldinp;
+			for (col = 0; col < W2_WIDTH; col++) {
+				*outp++ = *inp;
+				*outp++ = *inp++;
+			}
+		}
+		GrArea(w1, gc1, 0, 0, W2_WIDTH * 2, W2_HEIGHT * 3, outtable,
+			MWPF_PIXELVAL);
+		return;
+	}
+
+	if (bp->wid == w4) {
+	        /* Draw a line in the off screen pixmap. Won't be shown until the button
+		 * is released
+		 */
+	   
+	        GrLine(p1, gc1, 0,0, bp->x, bp->y);
+
+		GrRaiseWindow(w4);
+		linexpos = bp->x;
+		lineypos = bp->y;
+		xorxpos = bp->x;
+		xorypos = bp->y;
+		GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+		lineok = GR_TRUE;
+		return;
+	}
+
+	if (bp->wid != w1) {
+		/*
+		 * Cause a fatal error for testing if more than one
+		 * button is pressed.
+		 */
+		if ((bp->buttons & -((int) bp->buttons)) != bp->buttons)
+			GrClearWindow(-1, 0);
+		return;
+	}
+
+	GrRaiseWindow(w1);
+	/*GrMoveWindow(w1, ++xx, yy);*/
+
+	if (bp->buttons & GR_BUTTON_L) {
+		GrClearWindow(w1, GR_TRUE);
+		return;
+	}
+
+	begxpos = bp->x;
+	xpos = bp->x;
+	ypos = bp->y;
+}
+
+
+/*
+ * Here when a button is released.
+ */
+void
+do_buttonup(bp)
+	GR_EVENT_BUTTON	*bp;
+{
+	if (bp->wid == w4) {
+		if (lineok) {
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+			GrLine(w4, gc3, bp->x, bp->y, linexpos, lineypos);
+		}
+		lineok = GR_FALSE;
+	        GrCopyArea(w1, gc4, 200,200, 200,200, p1,0,0,MWROP_SRCCOPY);
+		return;
+	}
+
+	if (bp->wid == w2) {
+		GrClose();
+		exit(0);
+	}
+}
+
+
+/*
+ * Here when the mouse has a motion event.
+ */
+void
+do_motion(mp)
+	GR_EVENT_MOUSE	*mp;
+{
+	if (mp->wid == w4) {
+		if (lineok) {
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+			xorxpos = mp->x;
+			xorypos = mp->y;
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+		}
+		return;
+	}
+
+	if (mp->wid == w3) {
+		GrPoint(w3, gc3, mp->x, mp->y);
+		return;
+	}
+}
+
+
+/*
+ * Here when a keyboard press occurs.
+ */
+void
+do_keystroke(kp)
+	GR_EVENT_KEYSTROKE	*kp;
+{
+	GR_SIZE		width;		/* width of character */
+	GR_SIZE		height;		/* height of character */
+	GR_SIZE		base;		/* height of baseline */
+
+	if (kp->wid == w4) {
+		if (lineok) {
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+			lineok = GR_FALSE;
+		}
+		return;
+	}
+
+	GrGetGCTextSize(gc1, &kp->ch, 1, GR_TFASCII, &width, &height, &base);
+	if ((kp->ch == '\r') || (kp->ch == '\n')) {
+		xpos = begxpos;
+		ypos += height;
+		return;
+	}
+	if (kp->ch == '\b') {		/* assumes fixed width font!! */
+		if (xpos <= begxpos)
+			return;
+		xpos -= width;
+		GrSetGCForeground(gc3, BROWN);
+		GrFillRect(w1, gc3, xpos, ypos - height + base + 1,
+			width, height);
+		return;
+	}
+	GrText(w1, gc1, xpos, ypos + base, &kp->ch, 1, 0);
+	xpos += width;
+}
+
+
+/*
+ * Here when an exposure event occurs.
+ */
+void
+do_exposure(ep)
+	GR_EVENT_EXPOSURE	*ep;
+{
+	GR_POINT	points[3];
+
+	if (ep->wid != w1)
+		return;
+	points[0].x = 311;
+	points[0].y = 119;
+	points[1].x = 350;
+	points[1].y = 270;
+	points[2].x = 247;
+	points[2].y = 147;
+
+	GrFillRect(w1, gc2, 50, 50, 150, 200);
+	GrFillPoly(w1, gc2, 3, points);
+}
+
+
+/*
+ * Here when a focus in event occurs.
+ */
+void
+do_focusin(gp)
+	GR_EVENT_GENERAL	*gp;
+{
+	if (gp->wid != w1)
+		return;
+	GrSetBorderColor(w1, WHITE);
+}
+
+/*
+ * Here when a focus out event occurs.
+ */
+void
+do_focusout(gp)
+	GR_EVENT_GENERAL	*gp;
+{
+	if (gp->wid != w1)
+		return;
+	GrSetBorderColor(w1, GRAY);
+}
+
+
+/*
+ * Here when a enter window event occurs.
+ */
+void
+do_enter(gp)
+	GR_EVENT_GENERAL	*gp;
+{
+	if (gp->wid != w5)
+		return;
+	GrSetBorderColor(w5, WHITE);
+	GrRaiseWindow(w5);
+}
+
+
+/*
+ * Here when a exit window event occurs.
+ */
+void
+do_exit(gp)
+	GR_EVENT_GENERAL	*gp;
+{
+	if (gp->wid != w5)
+		return;
+	GrSetBorderColor(w5, GREEN);
+	GrLowerWindow(w5);
+}
+
+
+/*
+ * Here to do an idle task when nothing else is happening.
+ * Just draw a randomly colored filled circle in the small window.
+ */
+void
+do_idle()
+{
+	GR_COORD	x;
+	GR_COORD	y;
+	GR_SIZE		rx;
+	GR_SIZE		ry;
+	GR_COLOR	color;
+
+	x = rand() % 70;
+	y = rand() % 40;
+	rx = (rand() % 10) + 5;
+	ry = (rx * si.ydpcm) / si.xdpcm;	/* make it appear circular */
+	
+	color = rand() % si.ncolors;
+
+	GrSetGCForeground(gc3, MWPALINDEX(color));
+	GrFillEllipse(w2, gc3, x, y, rx, ry);	
+}
diff -urN lib/microwindows/src/demos/nanox/demo6.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/demo6.c
--- lib/microwindows/src/demos/nanox/demo6.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/demo6.c	2005-02-21 16:02:55.000000000 +0100
@@ -0,0 +1,165 @@
+/*
+ * Demonstrates loading a binary PPM file and displaying it in a window
+ * as a Pixmap.
+ */
+
+/* Comment this definition out if you don't want to use server side pixmaps */
+/* (it will be slower but will work on device drivers without bitblt) */
+#define USE_PIXMAPS
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <nano-X.h>
+
+GR_WINDOW_ID window;	/* ID for output window */
+#ifdef USE_PIXMAPS
+GR_WINDOW_ID pmap;	/* ID for pixmap */
+#endif
+GR_GC_ID gc;		/* Graphics context */
+int width, height;	/* Size of image */
+unsigned char *data;	/* Local copy of image data */
+
+void do_exposure(GR_EVENT_EXPOSURE *event)
+{
+	/* The window has been exposed so redraw it */
+#ifdef USE_PIXMAPS
+	GrCopyArea(window, gc, 0, 0, width, height, pmap, 0, 0, MWROP_SRCCOPY);
+#else
+	GrArea(window, gc, 0, 0, width, height, data, MWPF_RGB);
+#endif
+}
+
+void errorhandler(GR_EVENT *ep)
+{
+	printf("Error (%s) code %d id %d", ep->error.name, 
+		ep->error.code, ep->error.id);
+	exit(1);
+}
+
+int main(int argc, char *argv[])
+{
+	unsigned char line[256];
+	GR_EVENT event;
+	FILE *infile;
+	int i, o;
+	unsigned char *p;
+
+	if(argc != 2) {
+		printf("Usage: demo6 <filename.ppm>\n");
+		exit(1);
+	}
+
+	if(!(infile = fopen(argv[1], "r"))) {
+		printf("Couldn't open \"%s\" for reading: %s\n", argv[1],
+						strerror(errno));
+		exit(2);
+	}
+
+	/* Read magic number (P6 = colour, binary encoded PPM file) */
+	if(!fgets(line, 256, infile)) goto truncated;
+	if(line[0] != 'P' || line[1] != '6') {
+		printf("Unsupported PPM type or not a PPM file.\n");
+		printf("Please supply a valid P6 format file (colour, with "
+			"binary encoding).\n");
+	}
+
+	/* Strip comments */
+	do {
+		if(!fgets(line, 256, infile)) goto truncated;
+	} while(line[0] == '#');
+
+	/* Read width and height */
+	sscanf(line, "%i %i", &width, &height);
+
+	/* Read the maximum colour value */
+	if(!fgets(line, 256, infile)) goto truncated;
+	sscanf(line, "%i", &i);
+	if(i != 255) {
+		printf("Truecolour mode only is supported\n");
+		exit(4);
+	}
+
+	/* Calculate how many bytes of image data there is */
+	i = width * height * 3;
+	/* Calculate how many bytes of data there will be after unpacking */
+	o = width * height * 4;
+
+	/* Allocate the space to store the data whilst it's being loaded */
+	if(!(data = malloc(o))) {
+		printf("Not enough memory to load image\n");
+		exit(5);
+	}
+
+	/* Read the data in and unpack it to RGBX format */
+	/* The lower byte isn't used so we don't set it to anything */
+	p = data;
+	while(o) {
+		if(fread(p, 1, 3, infile) != 3) goto truncated;
+		p += 4;
+		o -= 4;
+	}
+
+	/* We don't need the input file anymore so close it */
+	fclose(infile);
+
+	/* Register the error handler */
+	GrSetErrorHandler(errorhandler);
+
+	if(GrOpen() < 0) {
+		printf("Couldn't connect to Nano-X server\n");
+		exit(6);
+	}
+
+#ifdef USE_PIXMAPS
+	/* Create the pixmap to store the picture in */
+	pmap = GrNewPixmap(width, height, NULL);
+#endif
+
+	/* Create a graphics context */
+	gc = GrNewGC();
+
+#ifdef USE_PIXMAPS
+	/* Copy the image data into the pixmap */
+	GrArea(pmap, gc, 0, 0, width, height, data, MWPF_RGB);
+	/* We can free the image data now because it's stored in the pixmap */
+	free(data);
+#endif
+
+	/* Create a window to output the image to */
+	window = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, width, height, 0, 0, 0);
+
+	/* Select expose events so we can redraw the image when necessary */
+	GrSelectEvents(window, GR_EVENT_MASK_EXPOSURE |
+				GR_EVENT_MASK_CLOSE_REQ);
+
+	/* Make the window visible */
+	GrMapWindow(window);
+
+#ifdef USE_PIXMAPS
+	/* Paint the pixmap onto it */
+	GrCopyArea(window, gc, 0, 0, width, height, pmap, 0, 0,
+							MWROP_SRCCOPY);
+#else
+	GrArea(window, gc, 0, 0, width, height, data, MWPF_RGB);
+#endif
+
+	while(1) {
+		GrGetNextEvent(&event);
+		switch(event.type) {
+			case GR_EVENT_TYPE_EXPOSURE:
+				do_exposure(&event.exposure);
+				break;
+			case GR_EVENT_TYPE_CLOSE_REQ:
+				GrClose();
+				exit(0);
+		}
+	}
+
+	return 0;
+
+truncated:
+	printf("Error: File appears to be truncated\n");
+	exit(3);
+}
diff -urN lib/microwindows/src/demos/nanox/ftdemo.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/ftdemo.c
--- lib/microwindows/src/demos/nanox/ftdemo.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/ftdemo.c	2005-02-21 16:12:55.000000000 +0100
@@ -0,0 +1,152 @@
+/*
+ * Demonstration program for freetype truetype font support
+ * Martin Jolicoeur 2000 martinj@visuaide.com.
+ */
+#include <stdio.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+#if HAVE_T1LIB_SUPPORT
+#define FONTNAME "bchr"
+//#define FONTNAME "bchb"
+//#define FONTNAME "dcr10"
+//#define FONTNAME "dcbx10"
+#elif HAVE_FREETYPE_SUPPORT
+#define FONTNAME "lt1-r-omega-serif"
+//#define FONTNAME "times"
+//#define FONTNAME "cour"
+#else
+#define FONTNAME GR_FONT_SYSTEM_VAR
+#endif
+
+#define MAXW 400
+#define MAXH 400
+
+GR_GC_ID gid;
+GR_FONT_ID fontid, fontid2;
+GR_BOOL kerning = GR_FALSE;
+GR_BOOL aa = GR_TRUE;
+GR_BOOL underline = GR_FALSE;
+int angle = 0;
+int state = GR_TFBOTTOM;
+char buffer[128];
+int n;
+void Render(GR_WINDOW_ID window);
+
+int
+main()
+{
+  FILE *file;
+  GR_EVENT event;
+  GR_WINDOW_ID window;
+
+  if (GrOpen() < 0) {
+	fprintf(stderr, "cannot open graphics\n");
+	exit(1);
+  }
+
+  window = GrNewWindow(GR_ROOT_WINDOW_ID, 50,50, MAXW,MAXH, 4, BLACK, WHITE);
+  GrMapWindow(window);
+
+  gid = GrNewGC ();
+  GrSelectEvents(window, GR_EVENT_MASK_KEY_DOWN |
+		GR_EVENT_MASK_CLOSE_REQ | GR_EVENT_MASK_EXPOSURE);
+
+  if ((file = fopen("ftdemo.txt", "r")) == NULL) {
+	printf("Can't open text file\n");
+	return (-1);
+  }
+
+  n = 0;
+
+  if(fgets(buffer, 128, file) != NULL) {
+  	for (n = 0; n < 128 && buffer[n]; n++) {
+		if (buffer[n] == '\n')
+			break;
+	}
+  }
+  fclose(file);
+
+  fontid = GrCreateFont(FONTNAME, 20, NULL);
+  fontid2 = GrCreateFont(FONTNAME, 36, NULL);
+
+  Render(window);
+ 
+  while (1) {
+    GrGetNextEvent(&event);
+
+    switch (event.type) {
+    case GR_EVENT_TYPE_KEY_DOWN:
+      switch(event.keystroke.ch) {
+        case 171: /* + */
+        case '+':
+        case '=':
+          angle += 100; /* Increase 10 degrees */
+          angle %= 3600;
+          break;
+        case 173: /* - */
+        case '-':
+        case '_':
+          angle -= 100; /* Decrease 10 degrees */
+          angle %= 3600;
+          break;
+        case 'a':
+          aa = (aa == GR_FALSE)?GR_TRUE:GR_FALSE;
+          break;
+        case 'k':
+          kerning = (kerning == GR_FALSE)?GR_TRUE:GR_FALSE;
+          break;
+        case 'l':
+          state = (state == GR_TFBOTTOM)?GR_TFBASELINE: \
+                  (state == GR_TFBASELINE)?GR_TFTOP:GR_TFBOTTOM;
+          break;
+        case 'u':
+          underline = underline? GR_FALSE: GR_TRUE;
+          break;
+        default:
+          continue;
+          /* Unknown keystroke */
+      }
+      Render(window);
+      break;
+    case GR_EVENT_TYPE_EXPOSURE:
+      Render(window);
+      break;
+    case GR_EVENT_TYPE_CLOSE_REQ:
+      GrClose();
+      exit(0);
+    }
+  }
+
+  return 0;
+}
+
+void Render(GR_WINDOW_ID window)
+{
+   GrSetGCBackground(gid, WHITE);
+   GrSetGCForeground (gid, WHITE);
+   GrSetGCUseBackground(gid, GR_FALSE);
+   GrFillRect(window, gid, 0, 0, MAXW, MAXH);
+   GrSetGCForeground (gid, BLACK);
+ 
+   /* Draw menu */
+   GrSetGCFont(gid, fontid);
+   GrSetFontAttr(fontid, GR_TFKERNING | GR_TFANTIALIAS, 0);
+   GrText(window, gid, 5, 20, "+ Rotate string clockwise", 25, GR_TFASCII);
+   GrText(window, gid, 5, 40, "-  Rotate string counter-clockwise", 34, GR_TFASCII);
+   GrText(window, gid, 5, 60, "a Toggle anti-aliasing", 22, GR_TFASCII);
+   GrText(window, gid, 5, 80, "k Toggle kerning", 16, GR_TFASCII);
+   GrText(window, gid, 5, 100, "u Toggle underline", 18, GR_TFASCII);
+   GrText(window, gid, 5, 120, "l  Toggle alignment bottom/baseline/top", 39, GR_TFASCII);
+ 
+   /* Draw test string */
+   GrSetGCFont(gid, fontid2);
+   GrSetFontAttr(fontid2, (kerning?GR_TFKERNING:0) | (aa?GR_TFANTIALIAS:0) |
+	(underline?GR_TFUNDERLINE: 0), -1);
+   GrSetFontRotation(fontid2, angle);
+   GrText(window, gid, MAXW/2, MAXH/2, buffer, n, state|GR_TFUTF8);
+ 
+   /* Draw arrow */
+   GrLine (window, gid, (MAXW/2)-10 , MAXH/2, (MAXW/2)+10, MAXH/2);
+   GrLine (window, gid, MAXW/2, (MAXH/2)-10, MAXW/2, (MAXH/2)+10);
+}
diff -urN lib/microwindows/src/demos/nanox/getselection.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/getselection.c
--- lib/microwindows/src/demos/nanox/getselection.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/getselection.c	2005-02-21 16:12:55.000000000 +0100
@@ -0,0 +1,119 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "nano-X.h"
+
+static int bytes_received = 0;
+static char *data = NULL;
+
+int got_client_data(GR_EVENT *event)
+{
+	GR_EVENT_CLIENT_DATA *ev = &event->clientdata;
+
+	fprintf(stderr, "Got client data packet with serial number %ld for "
+			"window %d from window %d\n", ev->serial, ev->wid,
+								ev->rid);
+	if(!(data = realloc(data, bytes_received + ev->datalen))) {
+		fprintf(stderr, "Out of memory\n");
+		exit(7);
+	}
+	memcpy(data + bytes_received, ev->data, ev->datalen);
+	free(ev->data);
+
+	fprintf(stderr, "Got client data packet with serial number %ld for "
+			"window %d from window %d\n", ev->serial, ev->wid,
+								ev->rid);
+	fprintf(stderr, "Already received %d bytes, this packet is %ld bytes "
+			"long, and the total data length is %ld bytes so ",
+					bytes_received, ev->datalen, ev->len);
+
+	bytes_received += ev->datalen;
+	if(bytes_received == ev->len) {
+		fprintf(stderr, "we have received all of the data now.\n");
+		fprintf(stderr, "The data in the packet is:\n%s\n", data);
+		return 1;
+	}
+	else if(bytes_received < ev->len) {
+		fprintf(stderr, "this is not the last data packet.\n");
+		return 0;
+	} else fprintf(stderr, "we have received too much data (shouldn't "
+								"happen)\n");
+
+	return 1;
+}
+
+int main(int argc, char *argv[])
+{
+	GR_CHAR *typelist, *p;
+	GR_WINDOW_ID sid, wid;
+	GR_EVENT event;
+	int n = 0, mimetype = -1;
+
+	if(GrOpen() < 0) {
+		fprintf(stderr, "Couldn't connect to Nano-X server\n");
+		return 1;
+	}
+
+	sid = GrGetSelectionOwner(&typelist);
+	if(!sid) {
+		fprintf(stderr, "Clipboard is empty\n");
+		return 2;
+	}
+
+	if(!typelist) {
+		fprintf(stderr, "GrGetSelectionOwner() returned an empty "
+				"type list for window %d\n", sid);
+		return 3;
+	}
+
+	fprintf(stderr, "Window %d owns the selection\n", sid);
+	fprintf(stderr, "It claims to be able to supply data in the following "
+			"types:\n%s\n", typelist);
+
+	p = strtok(typelist, " ");
+	do {
+		if(!strncmp("text/plain", p, 10)) {
+			mimetype = n;
+			break;
+		}
+		n++;
+	} while((p = strtok(NULL, " ")));
+
+	if(mimetype == -1) {
+		fprintf(stderr, "Type text/plain is not available\n");
+		return 4;
+	}
+
+	free(typelist);
+
+	fprintf(stderr, "Type text/plain is available- requesting data\n");
+
+	wid = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, 1, 1, 0, 0, 0);
+	if(!wid) {
+		fprintf(stderr, "Couldn't get a window\n");
+		return 5;
+	}
+
+	GrSelectEvents(wid, GR_EVENT_MASK_CLIENT_DATA);
+
+	GrRequestClientData(wid, sid, 0, mimetype);
+
+	while(1) {
+		GrGetNextEventTimeout(&event, 4000);
+		switch(event.type) {
+			case GR_EVENT_TYPE_CLIENT_DATA:
+				if(got_client_data(&event))
+					return 0;
+				break;
+			case GR_EVENT_TYPE_TIMEOUT:
+				fprintf(stderr, "Timed out waiting for data\n");
+				return 6;
+			default:
+				break;
+		}
+	}
+
+	return 0;
+}
diff -urN lib/microwindows/src/demos/nanox/info.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/info.c
--- lib/microwindows/src/demos/nanox/info.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/info.c	2005-02-21 16:02:55.000000000 +0100
@@ -0,0 +1,55 @@
+/*
+ * Display the results of various GrGetsomethingInfo() calls.
+ */
+
+#include <stdio.h>
+#include <conio.h>
+#include "nano-X.h"
+
+int main()
+{
+	GR_SCREEN_INFO  si;
+	GR_FONT_INFO    fi;
+	GR_GC_INFO      gi;
+	GR_FONT         fonts;
+	int             x, y;
+
+	GrOpen();
+	GrGetScreenInfo(&si);
+
+	printf("rows = %d\n", si.rows);
+	printf("cols = %d\n", si.cols);
+	printf("bpp = %d\n", si.bpp);
+	printf("planes = %d\n", si.planes);
+	printf("ncolors = %d\n", si.ncolors);
+	printf("buttons = 0x%x\n", si.buttons);
+	printf("modifiers = 0x%x\n", si.modifiers);
+	printf("fonts = %d\n", si.fonts);
+
+	getch();
+
+	for(fonts = 0; fonts < si.fonts; fonts++) {
+/*		if(!GrGetFontInfo(fonts, &fi)) { */
+		GrGetFontInfo(fonts, &fi);
+		if(1) {
+			printf("\nfont = %d\n", fi.font);
+			printf("height = %d\n", fi.height);
+			printf("maxwidth = %d\n", fi.maxwidth);
+			printf("baseline = %d\n", fi.baseline);
+			printf("fixed = %s\n", fi.fixed ? "TRUE" : "FALSE");
+			printf("widths =\n");
+			for(y = 0; y != 3; y++) {
+				for(x = 0; x != 7; x++)
+					printf("%2d", fi.widths[x * y]);
+				printf("\n");
+
+				getch();
+
+			}
+		}
+	}
+
+	getch();
+
+	GrClose();
+}
diff -urN lib/microwindows/src/demos/nanox/landmine.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/landmine.c
--- lib/microwindows/src/demos/nanox/landmine.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/landmine.c	2005-02-21 16:12:55.000000000 +0100
@@ -0,0 +1,1312 @@
+/*
+ * Landmine, the game.
+ * Written for mini-X by David I. Bell.
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#if UNIX | DOS_DJGPP
+#include <fcntl.h>
+#include <unistd.h>
+#include <time.h>
+#endif
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+
+#define	MINSIZE		3		/* minimum size of board */
+#define MAXSIZE		30		/* maximum size of board */
+#define SIZE		15		/* default size of playing board */
+#define	MINEPERCENT	15		/* default percentage of mines */
+#define	SAVEFILE	"landmine.save"	/* default save file name */
+#define MAGIC		649351261	/* magic number in save files */
+#define	MAXPARAMS	1000		/* maximum different game parameters */
+
+#define FULLSIZE	(MAXSIZE + 2)	/* board size including borders */
+
+#define	BOARDGAP	10		/* millimeter gap around board */
+#define	RIGHTGAP	15		/* mm gap between board, right side */
+#define	BUTTONGAP	20		/* mm gap between buttons */
+#define	STATUSGAP	35		/* mm gap between buttons and status */
+
+#define	BUTTONWIDTH	80		/* width of buttons (pixels) */
+#define	BUTTONHEIGHT	25		/* height of buttons (pixels) */
+#define	RIGHTSIDE	150		/* pixels to guarantee for right side */
+#define	BOARDBORDER	2		/* border size around board */
+
+/*
+ * Print the number of steps taken.
+ * This is used twice, and is a macro to guarantee that
+ * the two printouts match.
+ */
+#define	PRINTSTEPS	printline(2, "Steps: %3d\n", steps)
+
+
+/*
+ * Typedefs local to this program.
+ */
+typedef	unsigned short	CELL;	/* cell value */
+typedef	int		POS;	/* cell position */
+
+
+/*
+ * For defining bitmaps easily.
+ */
+#define	X	((unsigned) 1)
+#define	_	((unsigned) 0)
+
+#define	BITS(a,b,c,d,e,f,g,h,i) \
+	(((((((((a*2+b)*2+c)*2+d)*2+e)*2+f)*2+g)*2+h)*2+i) << 7)
+
+
+static	GR_BITMAP	twolegs_fg[] = {	/* two legs foreground */
+	BITS(_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,X,X,X,_,_,_),
+	BITS(_,_,_,X,X,X,_,_,_),
+	BITS(_,_,_,X,X,X,_,_,_),
+	BITS(_,_,_,_,X,_,_,_,_),
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,X,_,X,_,X,_,X,_),
+	BITS(_,X,_,X,X,X,_,X,_),
+	BITS(_,_,_,X,_,X,_,_,_),
+	BITS(_,_,_,X,_,X,_,_,_),
+	BITS(_,_,X,X,_,X,X,_,_),
+	BITS(_,_,_,_,_,_,_,_,_)
+};
+
+static	GR_BITMAP	twolegs_bg[] = {	/* two legs background */
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,X,X,X,X,X,X,X,_),
+	BITS(X,X,X,X,X,X,X,X,X),
+	BITS(X,X,X,X,_,X,X,X,X),
+	BITS(X,X,X,X,X,X,X,X,X),
+	BITS(X,X,X,X,X,X,X,X,X),
+	BITS(_,X,X,X,X,X,X,X,_),
+	BITS(_,X,X,X,X,X,X,X,_),
+	BITS(_,X,X,X,X,X,X,X,_)
+};
+
+
+static	GR_BITMAP	oneleg_fg[] = {		/* one leg foreground */
+	BITS(_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,X,X,X,_,_,_),
+	BITS(_,_,_,X,X,X,_,_,_),
+	BITS(_,_,_,X,X,X,_,_,_),
+	BITS(_,_,_,_,X,_,_,_,_),
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,X,_,X,_,X,_,X,_),
+	BITS(_,_,_,X,X,X,_,X,_),
+	BITS(_,_,_,_,_,X,_,_,_),
+	BITS(_,_,_,_,_,X,_,_,_),
+	BITS(_,_,_,_,_,X,X,_,_),
+	BITS(_,_,_,_,_,_,_,_,_),
+};
+
+
+static	GR_BITMAP	oneleg_bg[] = {		/* one leg background */
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,X,X,X,X,X,X,X,_),
+	BITS(X,X,X,X,X,X,X,X,X),
+	BITS(X,X,X,X,_,X,X,X,X),
+	BITS(X,X,X,X,X,X,X,X,X),
+	BITS(_,_,X,X,X,X,X,X,X),
+	BITS(_,_,_,_,X,X,X,X,_),
+	BITS(_,_,_,_,X,X,X,X,_),
+	BITS(_,_,_,_,X,X,X,X,_)
+};
+
+
+static	GR_BITMAP	noleg_fg[] = {		/* no legs foreground */
+	BITS(_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,X,X,X,_,_,_),
+	BITS(_,_,_,X,X,X,_,_,_),
+	BITS(_,_,_,X,X,X,_,_,_),
+	BITS(_,_,_,_,X,_,_,_,_),
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,X,_,X,_,X,_,X,_),
+	BITS(_,_,_,X,X,X,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,_),
+};
+
+
+static	GR_BITMAP	noleg_bg[] = {		/* no legs background */
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,X,X,X,X,X,X,X,_),
+	BITS(X,X,X,X,X,X,X,X,X),
+	BITS(X,X,X,X,_,X,X,X,X),
+	BITS(X,X,X,X,X,X,X,X,X),
+	BITS(_,_,X,X,X,X,X,_,_),
+	BITS(_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,_),
+	BITS(_,_,_,_,_,_,_,_,_)
+};
+
+
+/*
+ * Components of a cell.
+ */
+#define F_EMPTY		' '		/* default value for empty square */
+#define F_REMEMBER	'*'		/* character to remember mine */
+#define F_WRONG		'X'		/* character to remember wrong guess */
+#define F_DISPLAY	0xff		/* character to be displayed here */
+#define F_MINE		0x100		/* TRUE if a mine is here */
+#define F_EDGE		0x200		/* TRUE if this is edge of the world */
+#define F_OLD		0x400		/* TRUE if been at this square before */
+#define F_REACH		0x800		/* TRUE if can reach this square */
+#define F_FLAGS		0xff00		/* all flags */
+
+
+/*
+ * The status of the game.
+ * This structure is read and written from the save file.
+ */
+static	struct status {			/* status of games */
+	long	s_magic;		/* magic number */
+	short	s_playing;		/* TRUE if playing a game */
+	short	s_size;			/* current size of board */
+	short	s_mines;		/* current number of mines on board */
+	short	s_legs;			/* number of legs left */
+	short	s_steps;		/* number of steps taken this game */
+	short	s_index;		/* current game parameter index */
+	short	s_sizeparam[MAXPARAMS];	/* table of size parameters */
+	short	s_mineparam[MAXPARAMS];	/* table of mine parameters */
+	long	s_games0[MAXPARAMS];	/* games finished with no legs */
+	long	s_games1[MAXPARAMS];	/* games finished with one leg */
+	long	s_games2[MAXPARAMS];	/* games finished with two legs */
+	long	s_steps0[MAXPARAMS];	/* steps taken in no leg games */
+	long	s_steps1[MAXPARAMS];	/* steps taken in one leg games */
+	long	s_steps2[MAXPARAMS];	/* steps taken in two leg games */
+	CELL	s_board[FULLSIZE*FULLSIZE];	/* board layout */
+} st;
+
+
+/*
+ * Definitions to make structure references easy.
+ */
+#define magic		st.s_magic
+#define	playing		st.s_playing
+#define size		st.s_size
+#define mines		st.s_mines
+#define legs		st.s_legs
+#define	steps		st.s_steps
+#define	index		st.s_index
+#define	sizeparam	st.s_sizeparam
+#define	mineparam	st.s_mineparam
+#define games0		st.s_games0
+#define games1		st.s_games1
+#define games2		st.s_games2
+#define	steps0		st.s_steps0
+#define	steps1		st.s_steps1
+#define	steps2		st.s_steps2
+#define board		st.s_board
+
+
+#define boardpos(row, col)	(((row) * FULLSIZE) + (col))
+#define ismine(cell)		((cell) & F_MINE)
+#define isedge(cell)		((cell) & F_EDGE)
+#define isold(cell)		((cell) & F_OLD)
+#define isseen(cell)		(((cell) & F_DISPLAY) == F_REMEMBER)
+#define isknown(cell)		(((cell) & F_DISPLAY) != F_EMPTY)
+#define displaychar(cell)	((cell) & F_DISPLAY)
+#define badsquare(n)		(((n) <= 0) || ((n) > size))
+
+
+/*
+ * Offsets for accessing adjacent cells.
+ */
+static	POS	steptable[8] = {
+	FULLSIZE, -FULLSIZE, 1, -1, FULLSIZE-1,
+	FULLSIZE+1, -FULLSIZE-1, -FULLSIZE+1
+};
+
+
+static	GR_WINDOW_ID	mainwid;	/* main window id */
+static	GR_WINDOW_ID	boardwid;	/* board window id */
+static	GR_WINDOW_ID	statwid;	/* status display window id */
+static	GR_WINDOW_ID	quitwid;	/* window id for quit button */
+static	GR_WINDOW_ID	savewid;	/* window id for save button */
+static	GR_WINDOW_ID	newgamewid;	/* window id for new game button */
+
+static	GR_GC_ID	boardgc;	/* graphics context for board */
+static	GR_GC_ID	cleargc;	/* GC for clearing cell of board */
+static	GR_GC_ID	redgc;		/* GC for drawing red */
+static	GR_GC_ID	greengc;	/* GC for drawing green */
+static	GR_GC_ID	blackgc;	/* GC for drawing black */
+static	GR_GC_ID	delaygc;	/* GC for delaying */
+static	GR_GC_ID	statgc;		/* GC for status window */
+static	GR_GC_ID	buttongc;	/* GC for drawing buttons */
+static	GR_GC_ID	xorgc;		/* GC for inverting things */
+
+static	GR_SIZE		xp;		/* pixels for x direction per square */
+static	GR_SIZE		yp;		/* pixels for y direction per square */
+static	GR_SIZE		statwidth;	/* width of window drawing text in */
+static	GR_SIZE		statheight;	/* height of window drawing text in */
+static	GR_SIZE		charheight;	/* height of characters */
+static	GR_COORD	charxpos;	/* current X position for characters */
+static	GR_COORD	charypos;	/* current Y position for characters */
+
+static	GR_SCREEN_INFO	si;		/* window information */
+static	GR_FONT_INFO	fi;		/* font information */
+
+static	GR_SIZE		COLS, ROWS;
+
+static	char	*savefile;		/* filename for saving game */
+
+
+/*
+ * Procedures.
+ */
+static	void	printline(GR_COORD, char *, ...);
+static	void	newline();
+static	void	delay();
+static	void	dokey();
+static	void	handleevent();
+static	void	doexposure();
+static	void	dobutton();
+static	void	drawbomb();
+static	void	drawstatus();
+static	void	drawbutton();
+static	void	drawboard();
+static	void	drawcell();
+static	void	cellcenter();
+static	void	clearcell();
+static	void	newgame();
+static	void	movetopos();
+static	void	setcursor();
+static	void	togglecell();
+static	void	gameover();
+static	void	readgame();
+static	void	findindex();
+static	POS	findcell();
+static	GR_BOOL	checkpath();
+static	GR_BOOL	writegame();
+
+int
+main(argc,argv)
+	int argc;
+	char **argv;
+{
+	GR_COORD	x;
+	GR_COORD	y;
+	GR_SIZE		width;
+	GR_SIZE		height;
+	GR_COORD	rightx;		/* x coordinate for right half stuff */
+	GR_BOOL		setsize;	/* TRUE if size of board is set */
+	GR_BOOL		setmines;	/* TRUE if number of mines is set */
+	GR_SIZE		newsize = 0;	/* desired size of board */
+	GR_COUNT	newmines = 0;	/* desired number of mines */
+
+	setmines = GR_FALSE;
+	setsize = GR_FALSE;
+
+	argc--;
+	argv++;
+	while ((argc > 0) && (**argv == '-')) {
+		switch (argv[0][1]) {
+			case 'm':
+				if (argc <= 0) {
+					fprintf(stderr, "Missing mine count\n");
+					exit(1);
+				}
+				argc--;
+				argv++;
+				newmines = atoi(*argv);
+				setmines = GR_TRUE;
+				break;
+
+			case 's':
+				if (argc <= 0) {
+					fprintf(stderr, "Missing size\n");
+					exit(1);
+				}
+				argc--;
+				argv++;
+				newsize = atoi(*argv);
+				setsize = GR_TRUE;
+				break;
+
+			default:
+				fprintf(stderr, "Unknown option \"-%c\"\n",
+					argv[0][1]);
+				exit(1);
+		}
+		argc--;
+		argv++;
+	}
+	if (argc > 0)
+		savefile = *argv;
+
+	srand(time(0));
+
+	readgame(savefile);
+
+	if (setsize) {
+		if ((newsize < MINSIZE) || (newsize > MAXSIZE)) {
+			fprintf(stderr, "Illegal board size\n");
+			exit(1);
+		}
+		if (newsize != size) {
+			if (steps && playing) {
+				fprintf(stderr,
+					"Cannot change size while game is in progress\n");
+				exit(1);
+			}
+			playing = GR_FALSE;
+			size = newsize;
+			if (!playing)
+				mines = (size * size * MINEPERCENT) / 100;
+		}
+	}
+
+	if (setmines) {
+		if ((newmines <= 0) || ((newmines > (size * size) / 2))) {
+			fprintf(stderr, "Illegal number of mines\n");
+			exit(1);
+		}
+		if (newmines != mines) {
+			if (steps && playing) {
+				fprintf(stderr,
+					"Cannot change mines while game is in progress\n");
+				exit(1);
+			}
+			playing = GR_FALSE;
+			mines = newmines;
+		}
+	}
+
+	findindex();
+
+	/*
+	 * Parameters of the game have been verified.
+	 * Now open the graphics and play the game.
+	 */
+
+	if (GrOpen() < 0) {
+		fprintf(stderr, "Cannot open graphics\n");
+		exit(1);
+	}
+
+	GrReqShmCmds(655360); /* Test by Morten Rolland for shm support */
+
+	GrGetScreenInfo(&si);
+	GrGetFontInfo(0, &fi);
+	charheight = fi.height;
+
+	/*
+	 * Create the main window which will contain all the others.
+	 */
+COLS = si.cols - 40;
+ROWS = si.rows - 80;
+	mainwid = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, COLS, ROWS,
+		0, BLACK, WHITE);
+
+	/*
+	 * Create the board window which lies at the left side.
+	 * Make the board square, and as large as possible while still
+	 * leaving room to the right side for statistics and buttons.
+	 */
+	width = COLS - RIGHTSIDE - (si.xdpcm * RIGHTGAP / 10) - BOARDBORDER * 2;
+	height = (((long) width) * si.ydpcm) / si.xdpcm;
+	if (height > ROWS /* - y * 2*/) {
+		height = ROWS - BOARDBORDER * 2;
+		width = (((long) height) * si.xdpcm) / si.ydpcm;
+	}
+	xp = width / size;
+	yp = height / size;
+	width = xp * size - 1;
+	height = yp * size - 1;
+	x = BOARDBORDER;
+	y = (ROWS - height) / 2;
+	rightx = x + width + (si.xdpcm * RIGHTGAP / 10);
+	boardwid = GrNewWindow(mainwid, x, y, width, height, BOARDBORDER,
+		BLUE, WHITE);
+
+	/*
+	 * Create the buttons.
+	 */
+	x = rightx;
+	y = (si.ydpcm * BOARDGAP / 10);
+	quitwid = GrNewWindow(mainwid, x, y, BUTTONWIDTH, BUTTONHEIGHT,
+		1, RED, WHITE);
+
+	y += (si.ydpcm * BUTTONGAP / 10);
+	savewid = GrNewWindow(mainwid, x, y, BUTTONWIDTH, BUTTONHEIGHT,
+		1, GREEN, WHITE);
+
+	y += (si.ydpcm * BUTTONGAP / 10);
+	newgamewid = GrNewWindow(mainwid, x, y, BUTTONWIDTH, BUTTONHEIGHT,
+		1, GREEN, WHITE);
+
+	/*
+	 * Create the statistics window.
+	 */
+	x = rightx;
+	y += (si.ydpcm * STATUSGAP / 10);
+	width = COLS - x;
+	height = ROWS - y;
+	statwid = GrNewWindow(mainwid, x, y, width, height, 0,
+		0, 0);
+	statwidth = width;
+	statheight = height;
+
+	/*
+	 * Create the GC for drawing the board.
+	 */
+	boardgc = GrNewGC();
+	cleargc = GrNewGC();
+	delaygc = GrNewGC();
+	redgc = GrNewGC();
+	greengc = GrNewGC();
+	statgc = GrNewGC();
+	blackgc = GrNewGC();
+	buttongc = GrNewGC();
+	xorgc = GrNewGC();
+	GrSetGCBackground(boardgc, BLUE);
+	GrSetGCForeground(cleargc, BLUE);
+	GrSetGCForeground(redgc, RED);
+	GrSetGCForeground(greengc, GREEN);
+	GrSetGCForeground(statgc, GRAY);
+	GrSetGCForeground(delaygc, BLACK);
+	GrSetGCForeground(blackgc, BLACK);
+	GrSetGCMode(delaygc, GR_MODE_XOR);
+	GrSetGCMode(xorgc, GR_MODE_XOR);
+	GrSetGCUseBackground(boardgc, GR_FALSE);
+	GrSetGCUseBackground(buttongc, GR_FALSE);
+
+	GrSelectEvents(mainwid, GR_EVENT_MASK_CLOSE_REQ);
+
+	GrSelectEvents(boardwid, GR_EVENT_MASK_EXPOSURE |
+		GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_KEY_DOWN);
+
+	GrSelectEvents(statwid, GR_EVENT_MASK_EXPOSURE);
+
+	GrSelectEvents(quitwid, GR_EVENT_MASK_EXPOSURE |
+		GR_EVENT_MASK_BUTTON_DOWN);
+
+	GrSelectEvents(newgamewid, GR_EVENT_MASK_EXPOSURE |
+		GR_EVENT_MASK_BUTTON_DOWN);
+
+	GrSelectEvents(savewid, GR_EVENT_MASK_EXPOSURE |
+		GR_EVENT_MASK_BUTTON_DOWN);
+
+	setcursor();
+
+	GrMapWindow(mainwid);
+	GrMapWindow(boardwid);
+	GrMapWindow(statwid);
+	GrMapWindow(quitwid);
+	GrMapWindow(savewid);
+	GrMapWindow(newgamewid);
+
+	if (!playing)
+		newgame();
+
+	while (GR_TRUE) {
+		GR_EVENT event;
+
+		GrGetNextEvent(&event);
+		handleevent(&event);
+	}
+}
+
+
+/*
+ * Read the next event and handle it.
+ */
+static void
+handleevent(GR_EVENT *ep)
+{
+	switch (ep->type) {
+		case GR_EVENT_TYPE_BUTTON_DOWN:
+			dobutton(&ep->button);
+			break;
+
+		case GR_EVENT_TYPE_EXPOSURE:
+			doexposure(&ep->exposure);
+			break;
+
+		case GR_EVENT_TYPE_KEY_DOWN:
+			dokey(&ep->keystroke);
+			break;
+
+		case GR_EVENT_TYPE_CLOSE_REQ:
+			GrClose();
+			exit(0);
+	}
+}
+
+
+/*
+ * Handle exposure events.
+ */
+static void
+doexposure(ep)
+	GR_EVENT_EXPOSURE	*ep;
+{
+	if (ep->wid == boardwid) {
+		drawboard();
+		return;
+	}
+
+	if (ep->wid == statwid) {
+		drawstatus();
+		return;
+	}
+
+	if (ep->wid == quitwid) {
+		drawbutton(quitwid, "QUIT");
+		return;
+	}
+
+	if (ep->wid == savewid) {
+		drawbutton(savewid, "SAVE GAME");
+		return;
+	}
+
+	if (ep->wid == newgamewid) {
+		drawbutton(newgamewid, "NEW GAME");
+		return;
+	}
+}
+
+
+/*
+ * Here when we get a button down event.
+ */
+static void
+dobutton(bp)
+	GR_EVENT_BUTTON		*bp;
+{
+	if (bp->wid == boardwid) {
+		movetopos(findcell(bp->x, bp->y));
+		return;
+	}
+
+	if (bp->wid == quitwid) {
+		GrFillRect(quitwid, xorgc, 0, 0, BUTTONWIDTH, BUTTONHEIGHT);
+		GrFlush();
+		if (savefile)
+			writegame(savefile);
+		GrClose();
+		exit(0);
+	}
+
+	if (bp->wid == savewid) {
+		GrFillRect(savewid, xorgc, 0, 0, BUTTONWIDTH, BUTTONHEIGHT);
+		GrFlush();
+		if (savefile == NULL)
+			savefile = SAVEFILE;
+		if (writegame(savefile))
+			write(1, "\007", 1);
+		else
+			delay();
+		GrFillRect(savewid, xorgc, 0, 0, BUTTONWIDTH, BUTTONHEIGHT);
+	}
+
+	if (bp->wid == newgamewid) {
+		GrFillRect(newgamewid, xorgc, 0, 0, BUTTONWIDTH, BUTTONHEIGHT);
+		GrFlush();
+		/*if (playing)
+			write(1, "\007", 1);
+		else {*/
+			newgame();
+			delay();
+		/*}*/
+		GrFillRect(newgamewid, xorgc, 0, 0, BUTTONWIDTH, BUTTONHEIGHT);
+	}
+}
+
+
+/*
+ * Here when we get a keypress in a window.
+ */
+static void
+dokey(kp)
+	GR_EVENT_KEYSTROKE	*kp;
+{
+	if ((kp->wid != boardwid) || !playing)
+		return;
+
+	switch (kp->ch) {
+		case ' ':			/* remember or forget mine */
+			togglecell(findcell(kp->x, kp->y));
+			break;
+	}
+}
+
+
+/*
+ * Redraw the board.
+ */
+static void
+drawboard()
+{
+	GR_COORD	row;
+	GR_COORD	col;
+
+	for (row = 1; row < size; row++) {
+		GrLine(boardwid, boardgc, 0, row * yp - 1, size * xp - 1,
+			row * yp - 1);
+		GrLine(boardwid, boardgc, row * xp - 1, 0,
+			row * xp - 1, size * yp - 1);
+	}
+	for (row = 0; row < FULLSIZE; row++) {
+		for (col = 0; col < FULLSIZE; col++) {
+			drawcell(boardpos(row, col));
+		}
+	}
+}
+
+
+/*
+ * Draw a cell on the board.
+ */
+static void
+drawcell(pos)
+	POS		pos;		/* position to be drawn */
+{
+	GR_COORD	x;
+	GR_COORD	y;
+	GR_SIZE		chwidth;
+	GR_SIZE		chheight;
+	GR_SIZE		chbase;
+	CELL		cell;
+	GR_CHAR		ch;
+
+	cell = board[pos];
+	if (!isknown(cell))
+		return;
+
+	ch = displaychar(cell);
+	if (ch == F_WRONG) {
+		drawbomb(pos, greengc, GR_FALSE);
+		return;
+	}
+
+	if (isold(cell)) {
+		clearcell(pos);
+		cellcenter(pos, &x, &y);
+		GrGetGCTextSize(boardgc, &ch, 1, GR_TFASCII, &chwidth,
+			&chheight, &chbase);
+		GrText(boardwid, boardgc, x - chwidth / 2 + 1,
+			y + chheight / 2, &ch, 1, GR_TFBOTTOM);
+		return;
+	}
+
+	drawbomb(pos, redgc, GR_FALSE);
+}
+
+
+/*
+ * Clear a particular cell.
+ */
+static void
+clearcell(pos)
+	POS		pos;		/* position to be cleared */
+{
+	GR_COORD	row;
+	GR_COORD	col;
+
+	row = pos / FULLSIZE;
+	col = pos % FULLSIZE;
+	GrFillRect(boardwid, cleargc, col * xp - xp, row * yp - yp,
+		xp - 1, yp - 1);
+}
+
+
+/*
+ * Draw a bomb in a window using the specified GC.
+ * The bomb is animated and the terminal is beeped if necessary.
+ */
+static void
+drawbomb(pos, gc, animate)
+	POS		pos;		/* position to draw bomb at */
+	GR_GC_ID	gc;		/* GC for drawing (red or green) */
+	GR_BOOL		animate;	/* TRUE to animate the bomb */
+{
+	GR_COORD	x;
+	GR_COORD	y;
+	GR_COUNT	count;
+
+	if (animate)
+		write(1, "\007", 1);
+
+	cellcenter(pos, &x, &y);
+
+	count = (animate ? 8 : 1);
+	for (;;) {
+		GrFillEllipse(boardwid, gc, x, y, xp / 2 - 3, yp / 2 - 3);
+		if (--count == 0)
+			return;
+		delay();
+		clearcell(pos);
+		delay();
+	}
+}
+
+
+/*
+ * Draw a button which has a specified label string centered in it.
+ */
+static void
+drawbutton(window, label)
+	GR_WINDOW_ID	window;
+	char		*label;
+{
+	GR_SIZE		width;
+	GR_SIZE		height;
+	GR_SIZE		base;
+
+	GrGetGCTextSize(buttongc, label, strlen(label), GR_TFASCII, &width,
+		&height, &base);
+	GrText(window, buttongc, (BUTTONWIDTH - width) / 2,
+		(BUTTONHEIGHT - height) / 2 + height - 1,
+		label, -1, GR_TFBOTTOM);
+}
+
+
+/*
+ * Set the cursor as appropriate.
+ * The cursor changes depending on the number of legs left.
+ */
+static void
+setcursor()
+{
+	GR_BITMAP	*fgbits;	/* bitmap for foreground */
+	GR_BITMAP	*bgbits;	/* bitmap for background */
+
+	switch (legs) {
+		case 0:
+			fgbits = noleg_fg;
+			bgbits = noleg_bg;
+			break;
+		case 1:
+			fgbits = oneleg_fg;
+			bgbits = oneleg_bg;
+			break;
+		default:
+			fgbits = twolegs_fg;
+			bgbits = twolegs_bg;
+			break;
+	}
+	GrSetCursor(boardwid, 9, 12, 4, 6, WHITE, BLACK, fgbits, bgbits);
+}
+
+
+/*
+ * Delay for a while so that something can be seen.
+ * This is done by drawing a large rectangle over the window using a mode
+ * of XOR with the value of 0, (which does nothing except waste time).
+ */
+static void
+delay()
+{
+	GR_COUNT	i;
+
+	for (i = 0; i < 1; i++) {
+		GrFillRect(boardwid, delaygc, 0, 0, xp * size - 1,
+			yp * size - 1);
+		GrFlush();
+	}
+}
+
+
+/*
+ * Calculate the coordinates of the center of a cell on the board.
+ * The coordinates are relative to the origin of the board window.
+ */
+static void
+cellcenter(pos, retx, rety)
+	POS		pos;		/* position to find center of */
+	GR_COORD	*retx;		/* returned X coordinate */
+	GR_COORD	*rety;		/* returned Y coordinate */
+{
+	*retx = (pos % FULLSIZE) * xp - 1 - xp / 2;
+	*rety = (pos / FULLSIZE) * yp - 1 - yp / 2;
+}
+
+
+/*
+ * Draw the status information in the status window.
+ */
+static void
+drawstatus()
+{
+	long	score;
+	long	allsteps;
+	long	games;
+
+	score = 0;
+	games = games0[index];
+	allsteps = steps0[index];
+	score += games1[index];
+	games += games1[index];
+	allsteps += steps1[index];
+	score += games2[index] * 2;
+	games += games2[index];
+	allsteps += steps2[index];
+
+	printline(0, "Size:   %2d\n", size);
+	printline(1, "Mines: %3d\n", mines);
+	PRINTSTEPS;
+	printline(3, "Legs:    %d\n", legs);
+
+	printline(5, "Won games:  %3d\n", games2[index]);
+	printline(6, "1-leg games:%3d\n", games1[index]);
+	printline(7, "Lost games: %3d\n", games0[index]);
+
+	if (games) {
+		printline(9, "Legs/game: %3d.%03d\n", score / games,
+			((score * 1000) / games) % 1000);
+
+		printline(10, "Steps/game:%3d.%03d\n", allsteps / games,
+			((allsteps * 1000) / games) % 1000);
+	}
+}
+
+
+/*
+ * Printf routine for windows, which can print at particular lines.
+ * A negative line number means continue printing at the previous location.
+ * Assumes the status window for output.
+ */
+static void printline(GR_COORD row, char * fmt, ...)
+{
+	va_list		ap;
+	GR_COUNT	cc;
+	GR_SIZE		width;
+	char		*cp;
+	char		buf[256];
+
+	va_start(ap, fmt);
+	vsprintf(buf, fmt, ap);
+	va_end(ap);
+
+	if (row >= 0) {
+		charxpos = 0;
+		charypos = charheight * row + charheight - 1;
+	}
+
+	cp = buf;
+	for (;;) {
+		cc = 0;
+		width = 0;
+		while (*cp >= ' ') {
+			width += fi.widths[(int)*cp++];
+			cc++;
+		}
+		if (width) {
+			GrText(statwid, statgc, charxpos, charypos,
+				cp - cc, cc, GR_TFBOTTOM);
+			charxpos += width;
+		}
+
+		switch (*cp++) {
+			case '\0':
+				return;
+			case '\n':
+				newline();
+				break;
+			case '\r':
+				charxpos = 0;
+				break;
+		}
+	}
+}
+
+
+/*
+ * Clear the remainder of the line and move to the next line.
+ * This assumes output is in the status window.
+ */
+static void
+newline()
+{
+	GrFillRect(statwid, blackgc, charxpos, charypos - charheight + 1,
+		statwidth - charxpos, charheight);
+	charxpos = 0;
+	charypos += charheight;
+}
+
+
+/*
+ * Translate a board window coordinate into a cell position.
+ * If the coordinate is outside of the window, or exactly on one
+ * of the interior lines, then a coordinate of 0 is returned.
+ */
+static POS
+findcell(x, y)
+	GR_COORD	x;
+	GR_COORD	y;
+{
+	GR_COORD	row;
+	GR_COORD	col;
+
+	if (((x % xp) == 0) || ((y % yp) == 0))
+		return 0;
+	row = (y / yp) + 1;
+	col = (x / xp) + 1;
+	if ((row <= 0) || (row > size) || (col <= 0) || (col > size))
+		return 0;
+	return boardpos(row, col);
+}
+
+
+/*
+ * Initialize the board for playing
+ */
+static void
+newgame()
+{
+	GR_COORD	row;
+	GR_COORD	col;
+	GR_COUNT	count;
+	CELL		cell;
+	POS		pos;
+
+	for (row = 0; row < FULLSIZE; row++) {
+		for (col = 0; col < FULLSIZE; col++) {
+			cell = F_EMPTY;
+			if (badsquare(row) || badsquare(col))
+				cell |= F_EDGE;
+			board[boardpos(row, col)] = cell;
+		}
+	}
+
+	playing = GR_TRUE;
+	count = 0;
+	legs = 2;
+	steps = 0;
+	drawstatus();
+	setcursor();
+
+	while (count < mines) {
+		do {
+			row = (rand() / 16) % (size * size + 1);
+		} while (row == (size * size));
+
+		col = (row % size) + 1;
+		row = (row / size) + 1;
+		pos = boardpos(row, col);
+
+		if ((pos == boardpos(1,1)) || (pos == boardpos(1,2)) ||
+			(pos == boardpos(2,1)) || (pos == boardpos(2,2)) ||
+			(pos == boardpos(size,size)))
+				continue;
+
+		if (!ismine(board[pos]) && checkpath(pos))
+			count++;
+	}
+
+	board[boardpos(1,1)] = (F_OLD | '0');
+
+	GrClearWindow(boardwid, GR_TRUE);
+}
+
+
+/*
+ * Check to see if there is still a path from the top left corner to the
+ * bottom right corner, if a new mine is placed at the indicated position.
+ * Returns GR_TRUE if mine was successfully placed.
+ */
+static GR_BOOL
+checkpath(pos)
+	POS		pos;		/* position to place mine at */
+{
+	CELL		*bp;		/* current board position */
+	CELL		*endbp;		/* ending position */
+	POS		endpos;		/* ending position */
+	GR_COUNT	count;		/* number of neighbors */
+	GR_COUNT	i;		/* loop counter */
+	GR_BOOL		more;		/* GR_TRUE if new square reached */
+
+	/*
+	 * Begin by assuming there is a mine at the specified location,
+	 * and then count neighbors.  If there are less than two other
+	 * mines or edge squares, then there must still be a path.
+	 */
+	board[pos] |= F_MINE;
+
+	count = 0;
+
+	for (i = 7; i >= 0; i--) {
+		if (board[pos + steptable[i]] & (F_MINE | F_EDGE))
+		count++;
+	}
+
+	if (count < 2)
+		return GR_TRUE;
+
+	/*
+	 * Two or more neighbors, so we must do the full check.
+	 * First clear the reach flag, except for the top left corner.
+	 */
+	endpos = boardpos(size, size);
+	bp = &board[endpos];
+	endbp = bp;
+	while (bp != board)
+		*bp-- &= ~F_REACH;
+	board[boardpos(1,1)] |= F_REACH;
+
+	/*
+	 * Now loop looking for new squares next to already reached squares.
+	 * Stop when no more changes are found, or when the lower right
+	 * corner is reached.
+	 */
+	do {
+		more = GR_FALSE;
+		for (bp = &board[boardpos(1,1)]; bp != endbp; bp++) {
+			if (*bp & F_REACH) {
+				for (i = 7; i >= 0; i--) {
+					if ((bp[steptable[i]] & (F_MINE | F_REACH | F_EDGE)) == 0) {
+						bp[steptable[i]] |= F_REACH;
+						more = GR_TRUE;
+					}
+				}
+			}
+		}
+
+		if (board[endpos] & F_REACH)
+			return GR_TRUE;
+	} while (more);
+
+	/*
+	 * Cannot reach the lower right corner, so remove the mine and fail.
+	 */
+	board[pos] &= ~F_MINE;
+
+	return GR_FALSE;
+}
+
+
+/*
+ * Move to a particular position and see if we hit a mine.
+ * If not, then count the number of mines adjacent to us so it can be seen.
+ * If we are stepping onto a location where we remembered a mine is at,
+ * then don't do it.  Moving is only allowed to old locations, or to
+ * locations adjacent to old ones.
+ */
+static void
+movetopos(newpos)
+	POS		newpos;		/* position to move to */
+{
+	POS		fixpos;		/* position to fix up */
+	CELL		cell;		/* current cell */
+	GR_COUNT	count;		/* count of cells */
+	GR_COUNT	i;		/* index for neighbors */
+
+	if ((newpos < 0) || (newpos >= (FULLSIZE * FULLSIZE)) || !playing)
+		return;
+
+	cell = board[newpos];
+
+	if (isedge(cell) || (isseen(cell)) || isold(cell))
+		return;
+
+	count = isold(cell);
+	for (i = 0; i < 8; i++)
+		if (isold(board[newpos + steptable[i]]))
+			count++;
+
+	if (count <= 0)
+		return;
+
+	cell = (cell & F_FLAGS) | F_OLD;
+	steps++;
+
+	PRINTSTEPS;
+
+	if (ismine(cell)) {		/* we hit a mine */
+		legs--;
+		board[newpos] = (F_REMEMBER | F_MINE);
+		cell = (F_EMPTY | F_OLD);
+		board[newpos] = cell;
+		drawbomb(newpos, redgc, GR_TRUE);
+		clearcell(newpos);
+		setcursor();
+		for (i = 0; i < 8; i++) {
+			fixpos = newpos + steptable[i];
+			if (isold(board[fixpos])) {
+				board[fixpos]--;
+				drawcell(fixpos);
+			}
+		}
+		drawstatus();
+	}
+
+	count = 0;
+	for (i = 0; i < 8; i++)
+		if (ismine(board[newpos + steptable[i]]))
+			count++;
+	board[newpos] = cell | (count + '0');
+
+	drawcell(newpos);
+
+	if ((legs <= 0) || (newpos == boardpos(size,size)))
+		gameover();
+}
+
+
+/*
+ * Remember or forget the location of a mine.
+ * This is for informational purposes only and does not affect anything.
+ */
+static void
+togglecell(pos)
+	POS	pos;		/* position to toggle */
+{
+	CELL	cell;
+
+	if ((pos <= 0) || !playing)
+		return;
+
+	cell = board[pos];
+	if (isknown(cell)) {
+		if (!isseen(cell))
+			return;
+		board[pos] = (board[pos] & F_FLAGS) | F_EMPTY;
+		clearcell(pos);
+		return;
+	}
+
+	board[pos] = (board[pos] & F_FLAGS) | F_REMEMBER;
+	drawcell(pos);
+}
+
+
+/*
+ * Here when the game is over.
+ * Show where the mines are, and give the results.
+ */
+static void
+gameover()
+{
+	POS	pos;
+	CELL	cell;
+
+	playing = GR_FALSE;
+	switch (legs) {
+		case 0:
+			games0[index]++;
+			steps0[index] += steps;
+			break;
+		case 1:
+			games1[index]++;
+			steps1[index] += steps;
+			break;
+		case 2:
+			games2[index]++;
+			steps2[index] += steps;
+			break;
+	}
+
+	for (pos = 0; pos < (FULLSIZE * FULLSIZE); pos++) {
+		cell = board[pos];
+		if (isseen(cell))
+			cell = (cell & F_FLAGS) | F_WRONG;
+		if (ismine(cell))
+			cell = (cell & F_FLAGS) | F_REMEMBER;
+		board[pos] = cell;
+	}
+
+	drawboard();
+	drawstatus();
+}
+
+
+/*
+ * Search the game parameter table for the current board size and
+ * number of mines, and set the index for those parameters so that
+ * the statistics can be accessed.  Allocates a new index if necessary.
+ */
+static void
+findindex()
+{
+	for (index = 0; index < MAXPARAMS; index++) {
+		if ((sizeparam[index] == size) && (mineparam[index] == mines))
+			return;
+	}
+	for (index = 0; index < MAXPARAMS; index++) {
+		if (sizeparam[index] == 0) {
+			sizeparam[index] = size;
+			mineparam[index] = mines;
+			return;
+		}
+	}
+	fprintf(stderr, "Too many parameters in save file\n");
+	exit(1);
+}
+
+
+/*
+ * Read in a saved game if available, otherwise start from scratch.
+ * Exits if an error is encountered.
+ */
+static void
+readgame(name)
+	char	*name;		/* filename */
+{
+	int	fd;
+
+	fd = -1;
+	if (name)
+		fd = open(name, 0);
+
+	if (fd < 0) {
+		magic = MAGIC;
+		size = SIZE;
+		mines = (size * size * MINEPERCENT) / 100;
+		playing = GR_FALSE;
+		return;
+	}
+
+	if (read(fd, &st, sizeof(st)) != sizeof(st))
+		magic = 0;
+	close(fd);
+
+	if ((magic != MAGIC) || (size > MAXSIZE)) {
+		fprintf(stderr, "Save file format is incorrect\n");
+		exit(1);
+	}
+}
+
+
+/*
+ * Write the current game to a file.
+ * Returns nonzero on an error.
+ */
+static GR_BOOL
+writegame(name)
+	char	*name;		/* filename */
+{
+	int	fd;
+
+	if (name == NULL)
+		return GR_TRUE;
+
+	fd = creat(name, 0666);
+	if (fd < 0)
+		return GR_TRUE;
+
+	if (write(fd, &st, sizeof(st)) != sizeof(st)) {
+		close(fd);
+		return GR_TRUE;
+	}
+	close(fd);
+	return GR_FALSE;
+}
+
+/* END CODE */
diff -urN lib/microwindows/src/demos/nanox/landmine.doc /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/landmine.doc
--- lib/microwindows/src/demos/nanox/landmine.doc	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/landmine.doc	2005-02-21 16:02:56.000000000 +0100
@@ -0,0 +1,108 @@
+			LANDMINE
+
+
+Landmine is a game in which you try to safely move step by step from the
+top left corner of a square board to the bottom right corner of the board.
+Scattered among the cells of the board are invisible mines which blow up
+if you step on them.  When you step on a mine, one of your legs is blown
+off, and if you lose both legs, then the game is over.
+
+Steps are made one at a time from any cell you have already visited to
+any of the eight possible cells which are adjacent to it.  At the start
+of the game you are placed in the top left corner of the board, which is
+guaranteed to have no mine in it.  There are also no mines immediately
+adjacent to the starting cell.  There is also a guaranteed path from the
+starting cell to the finishing cell which does not encounter any mines.
+
+You cannot see the mines, however you have a detector which indicates
+the presence of the mines.  The detector cannot locate the direction of
+any individual mine, but it does indicate the number of mines immediately
+adjacent to your cell.  By using this information from all the cells you
+have already visited, you can usually deduce where the mines must be.
+In this way, you can find your way safely to the destination cell.  Some
+of the deductions that can be made are very subtle, and experience will
+improve your scores dramatically.
+
+When landmine is started up under mini-X, the board is displayed at the
+left side, some buttons are displayed at the upper right, and some statistics
+are displayed at the lower right.  To make a step, use the mouse to move the
+cursor onto the cell that you wish to step on, and press a button.  A number
+will appear in that square (if there is no mine there!) indicating now many
+mines are adjacent to that square.  You can step onto any cell which is
+adjacent to any cell you have already stepped on.
+
+In order to help you deduce where the mines are and what steps are safe,
+you can mark any non-visited cell as containing a mine.  To do this, move
+the mouse to that cell, and then type a space.  A red circle will then
+appear in that cell to indicate that you think it contains a mine.  A
+side effect of doing this is that you cannot accidentally step on the
+square while it is marked.  Notice that the cell is marked as you request
+whether or not a mine is actually there, thus if you mistakenly mark a
+cell, you are likely to get confused and later step on a real mine!  If
+you think that a cell is marked in error, you can clear the marking by
+moving the mouse to the cell and then typing another space.
+
+If you step on a mine, you will hear a beep, and a red circle will flash
+on and off for a few seconds to indicate that the mine has exploded.
+Then the mine will be removed, and the counts in the adjacent cells
+will be adjusted to reflect the new situation with one less mine.  Your
+number of legs is also reduced by 1, and the cursor shape is changed to
+indicate this.  If you lose both legs, then the game is lost.  If you
+successfully make it to the lower right corner, then the game is won.
+
+When the game is over, the location of all mines are marked with red circles.
+In addition, if you had marked cells as containing mines, but the cells were
+wrongly marked, then those cells are shown with green circles.  After you
+have analyzed the results of the game, you can start a new game by using
+the NEW GAME button.
+
+The three buttons on the top right of the screen are QUIT, SAVE GAME,
+and NEW GAME.  The buttons are activated by moving the cursor to the
+interior of the button, and pressing any mouse button.  No confirmation
+is asked for these actions.
+
+QUIT will immediately quit playing and return you to text mode and exit.
+However, if you had started landmine with a filename to restore from,
+then the current status will be saved back to that file.  If you had not
+supplied a filename on starting, and have not saved the game using the
+SAVE GAME button, then QUIT will quit without saving anything.
+
+SAVE GAME is used to save the current status of the game without exiting.
+This lets you make sure that the game is saved away when you have been
+playing for a long time and are worried about crashes.  If you had given
+a file for restoring of previous games, then the game will be saved back
+into that file.  If you had not specified a filename, then a default name
+of "landmine.save" will be used.  If the save operation works, the button
+will momentarily flash.  If the save operation fails, then a beep will
+be sounded.
+
+NEW GAME is used to start a new game.  This button can only be used after
+a game has just been completed.  That is, after both legs have been blown
+off or you have reached the destination cell, you use this button to
+begin another game.
+
+When starting landmine, you can specify some options on the command line.
+The options are the following:
+
+	landmine [-s n] [-m n] [savefile]
+
+The savefile is the filename to save the game into when the SAVE GAME or
+QUIT buttons are used, as described above.
+
+The -s option sets the size of the board.  The size is the number of cells
+across the board, and also down the board.  The board size can be set to
+any size from 3 to 30.  The default size is 15.
+
+The -m option sets the number of mines on the board.  This can be set from
+1 to 50% of the number of cells on the board.  The default number of mines
+is 15% of the number of cells on the board.  For the default board size,
+the default number of mines is 33.
+
+The statistics saved in the save file are kept for each combination of
+board size and mines, thus you can play with many different combinations
+of values and the statistics will be kept separately.  There is a limit
+of 1000 different combinations that can be saved.
+
+You cannot change the board size or number of mines while a game is in
+progress.  To change the parameters, finish the game, save the game into a
+file and exit, then restart landmine giving the new parameters.
diff -urN lib/microwindows/src/demos/nanox/launcher.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/launcher.c
--- lib/microwindows/src/demos/nanox/launcher.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/launcher.c	2005-02-21 16:12:55.000000000 +0100
@@ -0,0 +1,599 @@
+/* 
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ * 
+ * The Original Code is NanoLauncher.
+ * 
+ * The Initial Developer of the Original Code is Alex Holden.
+ * Portions created by Alex Holden are Copyright (C) 2000
+ * Alex Holden <alex@linuxhacker.org>. All Rights Reserved.
+ * 
+ * Contributor(s):
+ * 
+ * Alternatively, the contents of this file may be used under the terms
+ * of the GNU General Public license (the  "[GNU] License"), in which case the
+ * provisions of [GNU] License are applicable instead of those
+ * above.  If you wish to allow use of your version of this file only
+ * under the terms of the [GNU] License and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting  the provisions above and replace  them with the notice and
+ * other provisions required by the [GNU] License.  If you do not delete
+ * the provisions above, a recipient may use your version of this file
+ * under either the MPL or the [GNU] License.
+ */
+
+/*
+ * A simple application launcher for Nano-X by Alex Holden.
+ *
+ * The application needs to be started with the first argument specifying
+ * the location of it's configuration file. The format of the file is
+ * extremely simple- each line can contain either a comment (indicated by
+ * beginning the line with a '#' symbol) or an item description.
+ * An item description consists of the name of the item (the title which
+ * appears underneath the icon on the launcher button) followed by the name
+ * of the icon file (or '-' for no icon) and the command to execute when the
+ * item is clicked on. The command can optionally be followed by a limited
+ * number of arguments to pass to the program when it is executed (increase
+ * MAX_ARGUMENTS in launcher.h if you need more). The program will currently
+ * only allow one icon size (specified at compile time by the ICON_WIDTH and
+ * ICON_HEIGHT parameters). The program only loads each icon file once even if
+ * it is used multiple times, so you can save a small amount of memory by
+ * using the same icon for several programs. If you want to change the size
+ * of the item buttons, change ITEM_WIDTH and ITEM_HEIGHT in launcher.h.
+ * The way the launcher decides whether to draw a vertical panel on the left
+ * hand side of the screen or a horizontal panel along the bottom is by
+ * looking at the width and height of the screen- the panel will be placed on
+ * the side on portrait screens and on the bottom on landscape screens.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+#include "launcher.h"
+
+void reaper(int signum) { while(waitpid(WAIT_ANY, NULL, WNOHANG) > 0); }
+
+void *my_malloc(size_t size)
+{
+	void *ret;
+
+	if(!(ret = malloc(size))) {
+		fprintf(stderr, "Out of memory\n");
+		exit(1);
+	}
+
+	return ret;
+}
+
+void usage(void)
+{
+	fprintf(stderr, "Usage: launcher <config-file>\n");
+	exit(3);
+}
+
+prog_item *make_prog_item(char *buf, int lineno)
+{
+	char *p, *pp, *command;
+	prog_item *prog;
+	int n;
+
+	p = buf;
+
+	prog = my_malloc(sizeof(prog_item));
+
+	for(n = 0; n < MAX_ARGUMENTS; n++) prog->argv[n] = NULL;
+
+	while(isspace(*p)) p++;
+	if(!*p) {
+		fprintf(stderr, "Premature end of line on line %d of config "
+				"file\n", lineno);
+		return 0;
+	}
+	command = p;
+	while(*p && (!isspace(*p))) p++;
+	*p++ = 0;
+	if(!(prog->command = strdup(command))) {
+		free(prog);
+		goto nomem;
+	}
+	pp = p - 1;
+	while(--pp != command) {
+		if(*pp == '/') {
+			pp++;
+			break;
+		}
+	}
+	if(!(prog->argv[0] = strdup(pp))) {
+		free(prog->command);
+		free(prog);
+		goto nomem;
+	}
+
+	n = 1;
+	while(*p) {
+		while(isspace(*p)) p++;
+		if(!*p) break;
+		pp = p;
+		while(*p && (!isspace(*p))) p++;
+		*p++ = 0;
+		if(!(prog->argv[n] = strdup(pp))) {
+			for(n = MAX_ARGUMENTS; n; n--)
+				if(prog->argv[n]) free(prog->argv[n]);
+			free(prog->command);
+			free(prog);
+			goto nomem;
+		}
+		if(++n == (MAX_ARGUMENTS - 1)) {
+			fprintf(stderr, "Too many arguments on line "
+				"%d of the config file\n", lineno);
+			break; 
+		}
+	}
+
+	return prog;
+
+nomem:
+	fprintf(stderr, "Out of memory parsing line %d of the config "
+			"file\n", lineno);
+	return 0;
+}
+
+void set_window_background_colour(char *buf, int lineno)
+{
+	GR_WM_PROPERTIES props;
+	char *p = buf, *pp;
+
+	while(isspace(*p)) p++;
+	if(!*p) {
+		fprintf(stderr, "Premature end of line on line %d of config "
+				"file\n", lineno);
+		return;
+	}
+	pp = p;
+	while(*p && (!isspace(*p))) p++;
+	*p = 0;
+
+	if(!strcmp(pp, "BLACK")) props.background = BLACK;
+	else if(!strcmp(pp, "BLUE")) props.background = BLUE;
+	else if(!strcmp(pp, "GREEN")) props.background = GREEN;
+	else if(!strcmp(pp, "CYAN")) props.background = CYAN;
+	else if(!strcmp(pp, "RED")) props.background = RED;
+	else if(!strcmp(pp, "MAGENTA")) props.background = MAGENTA;
+	else if(!strcmp(pp, "BROWN")) props.background = BROWN;
+	else if(!strcmp(pp, "LTGRAY")) props.background = LTGRAY;
+	else if(!strcmp(pp, "GRAY")) props.background = GRAY;
+	else if(!strcmp(pp, "LTBLUE")) props.background = LTBLUE;
+	else if(!strcmp(pp, "LTGREEN")) props.background = LTGREEN;
+	else if(!strcmp(pp, "LTCYAN")) props.background = LTCYAN;
+	else if(!strcmp(pp, "LTRED")) props.background = LTRED;
+	else if(!strcmp(pp, "LTMAGENTA")) props.background = LTMAGENTA;
+	else if(!strcmp(pp, "YELLOW")) props.background = YELLOW;
+	else if(!strcmp(pp, "WHITE")) props.background = WHITE;
+	else {
+		fprintf(stderr, "Invalid colour \"%s\" on line %d of config "
+							"file\n", pp, lineno);
+		return;
+	}
+
+	props.flags = GR_WM_FLAGS_BACKGROUND;
+	GrSetWMProperties(GR_ROOT_WINDOW_ID, &props);
+}
+
+void parse_config_line(lstate *state, char *buf, int lineno)
+{
+	char *p, *pp, *name, *icon;
+	int n;
+	litem *new_litem, *li;
+	sitem *new_sitem;
+	GR_IMAGE_INFO imageinfo;
+
+	p = buf;
+
+	if((!*p) || (*p == '#') || (*p == '\n')) return;
+
+	while(isspace(*p)) p++;
+	name = p;
+	while(*p && (!isspace(*p))) p++;
+	if(!*p) goto premature;
+	*p++ = 0;
+
+	if(!strcmp(name, "$screensaver")) {
+		new_sitem = my_malloc(sizeof(sitem));
+		if(!(new_sitem->prog = make_prog_item(p, lineno))) {
+			free(new_sitem);
+			return;
+		}
+		new_sitem->next = NULL;
+		if(!state->sitems) {
+			state->sitems = new_sitem;
+			state->cursitem = new_sitem;
+		} else {
+			new_sitem->next = state->sitems;
+			state->sitems = new_sitem;
+		}
+		return;
+	} else if(!strcmp(name, "$screensaver_timeout")) {
+		n = strtol(p, NULL, 10);
+		GrSetScreenSaverTimeout(n);
+		return;
+	} else if(!strcmp(name, "$window_background_image")) {
+		while(isspace(*p)) p++;
+		if(!*p) goto premature;
+		pp = p;
+		while(*p && (!isspace(*p))) p++;
+		*p = 0;
+		state->window_background_image = strdup(pp);
+		return;
+	} else if(!strcmp(name, "$window_background_mode")) {
+		state->window_background_mode = (int) strtol(p, NULL, 10);
+		return;
+	} else if(!strcmp(name, "$window_background_colour")) {
+		set_window_background_colour(p, lineno);
+		return;
+	}
+
+	while(isspace(*p)) p++;
+	if(!*p) goto premature;
+	icon = p;
+	while(*p && (!isspace(*p))) p++;
+	if(!*p) goto premature;
+	*p++ = 0;
+
+	new_litem = my_malloc(sizeof(litem));
+	if(!(new_litem->name = strdup(name))) {
+		free(new_litem);
+		goto nomem;
+	}
+	if(!(new_litem->icon = strdup(icon))) {
+		free(new_litem->name);
+		free(new_litem);
+		goto nomem;
+	}
+	if(!(new_litem->prog = make_prog_item(p, lineno))) {
+		free(new_litem->name);
+		free(new_litem->icon);
+		free(new_litem);
+		return;
+	}
+	new_litem->iconid = 0;
+	if(strcmp("-", icon)) {
+		li = state->litems;
+		while(li) {
+			if(!(strcmp(icon, li->name))) {
+				new_litem->iconid = li->iconid;
+				break;
+			}
+			li = li->next;
+		}
+		if(!new_litem->iconid) {
+			if(!(new_litem->iconid = GrLoadImageFromFile(icon, 0))){
+				fprintf(stderr, "Couldn't load icon \"%s\"\n",
+									icon);
+			} else {
+				GrGetImageInfo(new_litem->iconid, &imageinfo);
+				if((imageinfo.width != ICON_WIDTH) ||
+					(imageinfo.height != ICON_HEIGHT)) {
+					fprintf(stderr, "Icon \"%s\" is the "
+					"wrong size (%dx%d instead of %dx%d)"
+					"\n", icon, imageinfo.width,
+					imageinfo.height, ICON_WIDTH,
+					ICON_HEIGHT);
+					GrFreeImage(new_litem->iconid);
+					new_litem->iconid = 0;
+				}
+			}
+		}
+	}
+
+	new_litem->prev = NULL;
+	new_litem->next = NULL;
+	if(!state->litems) {
+		state->lastlitem = new_litem;
+		state->litems = new_litem;
+	} else {
+		new_litem->next = state->litems;
+		state->litems->prev = new_litem;
+		state->litems = new_litem;
+	}
+
+	state->numlitems++;
+
+	return;
+
+nomem:
+	fprintf(stderr, "Out of memory\n");
+	exit(1);
+
+premature:
+	fprintf(stderr, "Premature end of line on line %d of config file\n",
+								lineno);
+}
+
+void read_config(lstate *state)
+{
+	int lineno = 1;
+	FILE *fp;
+	char *buf = my_malloc(256);
+
+	if(!(fp = fopen(state->config_file, "r"))) {
+		fprintf(stderr, "Couldn't open config file \"%s\"\n",
+							state->config_file);
+		exit(2);
+	}
+
+	state->litems = NULL;
+	state->numlitems = 0;
+	state->sitems = NULL;
+
+	while(fgets(buf, 256, fp)) {
+		parse_config_line(state, buf, lineno);
+		lineno++;
+	}
+
+	fclose(fp);
+	free(buf);
+
+	if(!state->numlitems) {
+		fprintf(stderr, "No valid launcher items in config file\n");
+		exit(5);
+	}
+}
+
+void draw_item(lstate *state, litem *item)
+{
+	GR_SIZE width, height, base, x, len;
+
+	GrDrawImageToFit(item->wid, state->gc, ICON_X_POSITION, ICON_Y_POSITION,
+				ICON_WIDTH, ICON_HEIGHT, item->iconid);
+
+	len = strlen(item->name);
+	GrGetGCTextSize(state->gc, item->name, len, 0, &width, &height, &base);
+	if(width >= ITEM_WIDTH) x = 0;
+	else x = (ITEM_WIDTH - width) / 2;
+
+	GrText(item->wid, state->gc, x, TEXT_Y_POSITION, item->name, len, 0);
+}
+
+void handle_exposure_event(lstate *state)
+{
+	GR_EVENT_EXPOSURE *event = &state->event.exposure;
+	litem *i = state->litems;
+
+	if(event->wid == state->main_window) return;
+
+	while(i) {
+		if(event->wid == i->wid) {
+			draw_item(state, i);
+			return;
+		}
+		i = i->next;
+	}
+
+	fprintf(stderr, "Got exposure event for unknown window %d\n",
+							event->wid);
+}
+
+void launch_program(prog_item *prog)
+{
+	pid_t pid;
+
+	if((pid = fork()) == -1) perror("Couldn't fork");
+	else if(!pid) {
+		if(execvp(prog->command, prog->argv) == -1)
+			fprintf(stderr, "Couldn't start \"%s\": %s\n",
+					prog->command, strerror(errno));
+		exit(7);
+	}
+}
+
+void handle_mouse_event(lstate *state)
+{
+	GR_EVENT_MOUSE *event = &state->event.mouse;
+	litem *i = state->litems;
+
+	if(event->wid == state->main_window) return;
+
+	while(i) {
+		if(event->wid == i->wid) {
+			launch_program(i->prog);
+			return;
+		}
+		i = i->next;
+	}
+
+	fprintf(stderr, "Got mouse event for unknown window %d\n", event->wid);
+}
+
+void handle_screensaver_event(lstate *state)
+{
+	GR_EVENT_SCREENSAVER *event = &state->event.screensaver;
+
+	if(event->activate != GR_TRUE) return;
+
+	if(!state->sitems) {
+		fprintf(stderr, "Got screensaver activate event with no "
+				"screensavers defined\n");
+		return;
+	}
+
+	state->cursitem = state->cursitem->next;
+	if(!state->cursitem) state->cursitem = state->sitems;
+
+	launch_program(state->cursitem->prog);
+}
+
+void handle_event(lstate *state)
+{
+	switch(state->event.type) {
+		case GR_EVENT_TYPE_EXPOSURE:
+			handle_exposure_event(state);
+			break;
+		case GR_EVENT_TYPE_BUTTON_DOWN:
+			handle_mouse_event(state);
+			break;
+		case GR_EVENT_TYPE_CLOSE_REQ:
+			break;
+		case GR_EVENT_TYPE_SCREENSAVER:
+			handle_screensaver_event(state);
+			break;
+		case GR_EVENT_TYPE_NONE:
+			break;
+		default:
+			fprintf(stderr, "Got unknown event type %d\n",
+							state->event.type);
+			break;
+	}
+}
+
+void do_event_loop(lstate *state)
+{
+	do {
+		GrGetNextEvent(&state->event);
+		handle_event(state);
+	} while(state->event.type != GR_EVENT_TYPE_CLOSE_REQ);
+}
+
+void initialise(lstate *state)
+{
+	GR_SCREEN_INFO si;
+	GR_IMAGE_ID back_image;
+	GR_IMAGE_INFO imageinfo;
+	int rows = 1, columns = 1, width, height, x = 0, y = 1;
+	GR_WM_PROPERTIES props;
+	litem *i;
+
+	if(GrOpen() < 0) {
+		fprintf(stderr, "Couldn't connect to Nano-X server\n");
+		exit(4);
+	}
+
+	state->window_background_mode = 0;
+	state->window_background_image = NULL;
+
+	read_config(state);
+
+	GrGetScreenInfo(&si);
+
+	if(si.rows > si.cols) {
+		rows = state->numlitems;
+		while((((rows / columns) + rows % columns) * ITEM_HEIGHT) >
+								si.rows) {
+			columns++;
+		}
+		if((columns * ITEM_WIDTH) > si.cols) goto toomany;
+		rows = (rows / columns) + (rows % columns);
+		width = columns * ITEM_WIDTH + 1 + columns;
+		height = rows * ITEM_HEIGHT + 1 + rows;
+	} else {
+		columns = state->numlitems;
+		while((((columns / rows) + (columns % rows)) * ITEM_WIDTH) >
+								si.cols) {
+			rows++;
+		}
+		if((rows * ITEM_HEIGHT) > si.rows) goto toomany;
+		columns = (columns / rows) + (columns % rows);
+		width = columns * ITEM_WIDTH + 1 + columns;
+		height = (rows * ITEM_HEIGHT) + 1 + rows;
+		y = si.rows - (rows * ITEM_HEIGHT) - 1 - rows;
+	}
+
+	state->gc = GrNewGC();
+	GrSetGCForeground(state->gc, ITEM_TEXT_COLOUR);
+	GrSetGCBackground(state->gc, ITEM_BACKGROUND_COLOUR);
+
+	if(state->window_background_image) {
+		if(!(back_image = GrLoadImageFromFile(
+					state->window_background_image, 0))) {
+			fprintf(stderr, "Couldn't load background image\n");
+		} else {
+			GrGetImageInfo(back_image, &imageinfo);
+			if(!(state->background_pixmap = GrNewPixmap(
+							imageinfo.width,
+						imageinfo.height, NULL))) {
+				fprintf(stderr, "Couldn't allocate pixmap "	
+						"for background image\n");
+			} else {
+				GrDrawImageToFit(state->background_pixmap,
+					state->gc, 0, 0, imageinfo.width,
+					imageinfo.height, back_image);
+				GrFreeImage(back_image);
+				GrSetBackgroundPixmap(GR_ROOT_WINDOW_ID,
+					state->background_pixmap,
+					state->window_background_mode);
+				GrClearWindow(GR_ROOT_WINDOW_ID, GR_TRUE);
+			}
+		}
+	}
+
+	if(state->sitems)
+		GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_SCREENSAVER);
+
+	state->main_window = GrNewWindow(GR_ROOT_WINDOW_ID, 0, y, width, height,
+						0, ITEM_BACKGROUND_COLOUR, 0);
+	GrSelectEvents(state->main_window, GR_EVENT_MASK_CLOSE_REQ);
+	props.flags = GR_WM_FLAGS_PROPS;
+	props.props = GR_WM_PROPS_NOMOVE | GR_WM_PROPS_NODECORATE |
+			GR_WM_PROPS_NOAUTOMOVE | GR_WM_PROPS_NOAUTORESIZE;
+	GrSetWMProperties(state->main_window, &props);
+
+	i = state->lastlitem;
+	y = 0;
+	while(i) {
+		i->wid = GrNewWindow(state->main_window,
+					(x * ITEM_WIDTH) + x + 1,
+					(y * ITEM_HEIGHT) + y + 1, ITEM_WIDTH,
+					ITEM_HEIGHT, 1, ITEM_BACKGROUND_COLOUR,
+							ITEM_BORDER_COLOUR);
+		GrSelectEvents(i->wid, GR_EVENT_MASK_EXPOSURE |
+					GR_EVENT_MASK_BUTTON_DOWN);
+		GrMapWindow(i->wid);
+		i = i->prev;
+		if(++x == columns) {
+			x = 0;
+			y++;
+		}
+	}
+
+	GrMapWindow(state->main_window);
+
+	signal(SIGCHLD, &reaper);
+
+	return;
+
+toomany:
+	fprintf(stderr, "Too many items to fit on screen\n");
+	exit(6);
+}
+
+int main(int argc, char *argv[])
+{
+	lstate *state;
+
+	if(argc != 2) usage();
+
+	state = my_malloc(sizeof(lstate));
+	state->config_file = strdup(argv[1]);
+
+	initialise(state);
+
+	do_event_loop(state);
+
+	GrClose();
+
+	return 0;
+}
diff -urN lib/microwindows/src/demos/nanox/launcher.cnf /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/launcher.cnf
--- lib/microwindows/src/demos/nanox/launcher.cnf	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/launcher.cnf	2005-02-21 16:12:55.000000000 +0100
@@ -0,0 +1,54 @@
+# Sample launcher configuration file
+
+# These are the screen savers to use:
+# A simple screen blanker:
+# $screensaver bin/nsaver 1
+# Draws random dots:
+$screensaver bin/nsaver 2
+# Draws random lines:
+$screensaver bin/nsaver 3
+# Draws worms that crawl randomly around the screen:
+$screensaver bin/nsaver 4
+# Draws a star field accelerating towards the viewer:
+$screensaver bin/nsaver 5
+# Draws a simulated lightning storm:
+$screensaver bin/nsaver 6
+# Draws an orbiting planet simulation:
+$screensaver bin/nsaver 7
+# Draws a moire interference pattern:
+$screensaver bin/nsaver 8
+
+# This is the screen saver timeout delay (in seconds):
+$screensaver_timeout 300
+
+# This is the file to use as the root window background image:
+$window_background_image bin/tux.gif
+
+# This is the mode to use for the window background:
+# 0 = tile across screen
+# 1 = draw once in centre of screen
+# 2 = draw once at top left of screen
+$window_background_mode 0
+
+# This is the background colour to use for the root window:
+# Possible values are:
+# BLACK, BLUE, GREEN, RED, MAGENTA, BROWN, LTGRAY, GRAY, LTBLUE, LTGREEN,
+# LTCYAN, LTRED, LTMAGENTA, YELLOW, WHITE.
+# $window_background_colour GREEN
+
+# These are the launcher panel items. Each line is in the format:
+
+# The item name must not contain any spaces.
+# <item name> <icon filename> <command> <first argument> <second argument> <...>
+# The item name must not contain any spaces.
+# The icon filename can be the letter '-' to specify no icon.
+
+Tetris bin/ntetris.ppm bin/ntetris
+Landmine - bin/landmine
+Slider - bin/slider demos/nanox/slidebmp.bmp
+Terminal - bin/nxterm
+Clock - bin/nxclock
+Map - bin/world
+Scribble - bin/nxscribble
+SoftKeyboard - bin/nxkbd
+Logo - bin/nxview bin/nanogui.ppm
diff -urN lib/microwindows/src/demos/nanox/launcher.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/launcher.h
--- lib/microwindows/src/demos/nanox/launcher.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/launcher.h	2005-02-21 16:12:55.000000000 +0100
@@ -0,0 +1,102 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is NanoLauncher.
+ *
+ * The Initial Developer of the Original Code is Alex Holden.
+ * Portions created by Alex Holden are Copyright (C) 2000
+ * Alex Holden <alex@linuxhacker.org>. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of the GNU General Public license (the  "[GNU] License"), in which case the
+ * provisions of [GNU] License are applicable instead of those
+ * above.  If you wish to allow use of your version of this file only
+ * under the terms of the [GNU] License and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting  the provisions above and replace  them with the notice and
+ * other provisions required by the [GNU] License.  If you do not delete
+ * the provisions above, a recipient may use your version of this file
+ * under either the MPL or the [GNU] License.
+ */
+
+#ifndef LAUNCHER_H
+#define LAUNCHER_H
+
+#define ITEM_WIDTH 100
+#define ITEM_HEIGHT 60
+#define ITEM_TEXT_COLOUR BLACK
+#define ITEM_BORDER_COLOUR BLACK
+#define ITEM_BACKGROUND_COLOUR LTGRAY
+#define ICON_WIDTH 32
+#define ICON_HEIGHT 32
+#define ICON_X_POSITION ((ITEM_WIDTH - ICON_WIDTH) / 2)
+#define ICON_Y_POSITION 6
+#define TEXT_Y_POSITION (ITEM_HEIGHT - 6)
+#define MAX_ARGUMENTS 12
+
+struct command_argv {
+	char *command;
+	char *argv[MAX_ARGUMENTS];
+};
+typedef struct command_argv prog_item;
+
+struct launcher_item {
+	char *name;
+	char *icon;
+	prog_item *prog;
+	struct launcher_item *next;
+	struct launcher_item *prev;
+	GR_IMAGE_ID iconid;
+	GR_WINDOW_ID wid;
+};
+typedef struct launcher_item litem;
+
+struct screensaver_item {
+	prog_item *prog;
+	struct screensaver_item *next;
+};
+typedef struct screensaver_item sitem;
+
+struct launcher_state {
+	char *config_file;
+	GR_WINDOW_ID main_window;
+	litem *litems;
+	litem *lastlitem;
+	int numlitems;
+	sitem *sitems;
+	sitem *cursitem;
+	GR_GC_ID gc;
+	GR_EVENT event;
+	int window_background_mode;
+	char *window_background_image;
+	GR_WINDOW_ID background_pixmap;
+};
+typedef struct launcher_state lstate;
+
+void reaper(int signum);
+void *my_malloc(size_t size);
+void usage(void);
+prog_item *make_prog_item(char *command, int lineno);
+void set_window_background_colour(char *buf, int lineno);
+void parse_config_line(lstate *state, char *buf, int lineno);
+void read_config(lstate *state);
+void draw_item(lstate *state, litem *item);
+void handle_exposure_event(lstate *state);
+void launch_program(prog_item *prog);
+void handle_mouse_event(lstate *state);
+void handle_screensaver_event(lstate *state);
+void handle_event(lstate *state);
+void do_event_loop(lstate *state);
+void initialise(lstate *state);
+
+#endif
diff -urN lib/microwindows/src/demos/nanox/logfont.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/logfont.c
--- lib/microwindows/src/demos/nanox/logfont.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/logfont.c	2005-02-21 16:12:56.000000000 +0100
@@ -0,0 +1,107 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#if UNIX
+#include <time.h>
+#endif
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+/*
+ * logical font demo for Nano-X
+ */
+
+#define MAXW 		630
+#define MAXH 		470
+
+int main(int argc, char **argv)
+{
+	GR_WINDOW_ID 	window;
+	GR_EVENT 	event;
+        GR_GC_ID 	gc;
+	GR_FONT_ID	fontid;
+        int 		x, y, rnd = 0;
+	MWLOGFONT	lf;
+	char		description[128];
+   
+        srand(time(0));
+   
+        GrOpen();
+	window = GrNewWindow(GR_ROOT_WINDOW_ID, 5, 5, MAXW, MAXH, 4, BLACK, BLUE);
+	GrMapWindow(window);
+
+        gc = GrNewGC();
+
+        GrSelectEvents(window,GR_EVENT_MASK_ALL);
+        GrSetGCUseBackground(gc,GR_FALSE);
+	GrSetGCBackground(gc, GR_RGB(0, 0, 0));
+
+	y = 30;
+	x = 0;
+
+	while(1) {
+	      GrCheckNextEvent(&event);
+
+	      if(event.type == GR_EVENT_TYPE_CLOSE_REQ) {
+			GrClose();
+			exit(0);
+	      }
+
+	      sleep(1);
+
+	      MWLF_Clear(&lf);
+	      description[0] = '\0';
+
+	      // lf.lfSerif = 1;
+
+	      if ( rnd & 1 ) {
+		      lf.lfWeight = MWLF_WEIGHT_BOLD;
+		      strcat(description,"Bold ");
+	      }
+	      
+
+	      if ( rnd & 2 ) {
+		      lf.lfItalic = 1;
+		      strcat(description,"Italics ");
+	      }
+	      if ( rnd & 4 ) {
+		      lf.lfOblique = 1;
+		      strcat(description,"Oblique ");
+	      }
+
+	      if ( rnd & 8 ) {
+		      lf.lfMonospace = 1;
+		      strcat(description,"Monospace ");
+	      } else {
+		      lf.lfProportional = 1;
+		      strcat(description,"Proportional ");
+	      }
+
+	      if ( argc > 1 )
+		      strcpy(lf.lfFaceName,argv[1]);
+	      else
+		      strcpy(lf.lfFaceName,"fantasy");
+
+	      fontid = GrCreateFont(0, 0, &lf);
+	      /* GrSetFontSize(fontid, 1+(int)(80.0 * rand() / (RAND_MAX+1.0))); */
+	      GrSetFontSize(fontid,26);
+	      GrSetFontRotation(fontid, 330);	/* 33 degrees*/
+  	      GrSetFontAttr(fontid, GR_TFKERNING | GR_TFANTIALIAS, 0);
+  	      GrSetGCFont(gc, fontid);
+	      /*GrSetGCBackground(gc, rand() & 0xffffff);*/
+ 	      GrSetGCForeground(gc, 0xffffff);
+	      /* x = (int) ((MAXW * 1.0) *rand()/(RAND_MAX+1.0));
+		 y = (int) ((MAXH * 1.0) *rand()/(RAND_MAX+1.0)); */
+
+	      GrText(window, gc,x,y, description, -1, GR_TFASCII);
+
+	      GrDestroyFont(fontid);
+
+	      rnd++;
+	      y += 30;
+	      if ( y > 460 )
+		      y = 0;
+	}
+
+	GrClose();
+}
diff -urN lib/microwindows/src/demos/nanox/move.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/move.c
--- lib/microwindows/src/demos/nanox/move.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/move.c	2005-02-21 16:02:57.000000000 +0100
@@ -0,0 +1,107 @@
+#include <stdio.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+/*
+ * Demo to test child window movement and redrawing
+ */
+int 
+main(int ac,char **av)
+{
+  GR_COORD      offset_x = 0, offset_y = 0;
+  GR_WINDOW_ID 	window1, subwindow1, subsubwin1;
+  GR_WINDOW_ID 	window2, subwindow2;
+  /*GR_WINDOW_ID	subsubwin2;*/
+  GR_EVENT 	event;
+
+  fprintf(stderr,"This is a demo program.\n");
+  fprintf(stderr,"Left-button drags window\n");
+  fprintf(stderr,"Right-button raises window\n");
+  
+  GrOpen();
+  window1 = GrNewWindow(GR_ROOT_WINDOW_ID, 20, 20, 100, 60, 4, BLACK, BLUE);
+  subwindow1 = GrNewWindow(window1, 5, 5, 90, 50, 4, WHITE, RED);
+  subsubwin1 = GrNewWindow(subwindow1, 10, 10, 10, 10, 2, GREEN, BLUE);
+
+  window2 = GrNewWindow(GR_ROOT_WINDOW_ID, 20, 100, 100, 60, 4, BLACK, BLUE);
+  subwindow2 = GrNewWindow(window2, 5, 5, 90, 50, 4, WHITE, RED);
+/*    subsubwin2 = GrNewWindow(subwindow2, 10, 10, 10, 10, 2, GREEN, BLUE); */
+
+  GrSelectEvents(window1, 
+  		 GR_EVENT_MASK_EXPOSURE |
+		 GR_EVENT_MASK_BUTTON_DOWN |
+		 GR_EVENT_MASK_BUTTON_UP |
+		 GR_EVENT_MASK_MOUSE_ENTER |
+		 GR_EVENT_MASK_MOUSE_EXIT |
+		 GR_EVENT_MASK_MOUSE_MOTION |
+		 GR_EVENT_MASK_CLOSE_REQ);
+
+  GrSelectEvents(window2, 
+  		 GR_EVENT_MASK_EXPOSURE |
+		 GR_EVENT_MASK_BUTTON_DOWN |
+		 GR_EVENT_MASK_BUTTON_UP |
+		 GR_EVENT_MASK_MOUSE_ENTER |
+		 GR_EVENT_MASK_MOUSE_EXIT |
+		 GR_EVENT_MASK_MOUSE_MOTION |
+		 GR_EVENT_MASK_CLOSE_REQ);
+
+  GrSelectEvents(subsubwin1, 
+		 GR_EVENT_MASK_BUTTON_DOWN |
+		 0);
+
+  GrMapWindow(subsubwin1);
+  GrMapWindow(subwindow1);
+  GrMapWindow(window1);
+
+  /*GrMapWindow(subsubwin2);*/
+  GrMapWindow(subwindow2);
+  GrMapWindow(window2);
+  
+  while(1) {
+    GrGetNextEvent(&event);
+    
+    switch (event.type) {
+    case GR_EVENT_TYPE_NONE:
+      break;
+    case GR_EVENT_TYPE_BUTTON_DOWN:
+	offset_x = event.button.x;
+	offset_y = event.button.y;
+
+      if (event.button.changebuttons & GR_BUTTON_R) {
+	GrRaiseWindow(event.button.wid);
+      }
+      if (event.button.wid == subsubwin1) {
+	GR_WINDOW_INFO winfo;
+	GrGetWindowInfo(subsubwin1, &winfo);
+	if (winfo.parent == subwindow1) {
+	  GrReparentWindow(subsubwin1, subwindow2, 10, 10);
+	} else {
+	  GrReparentWindow(subsubwin1, subwindow1, 10, 10);
+	}
+      }
+    case GR_EVENT_TYPE_MOUSE_MOTION:
+      if (event.mouse.buttons == GR_BUTTON_L && 
+	  (event.mouse.wid == window1 || event.mouse.wid == window2)) {
+	GrMoveWindow(event.mouse.wid, 
+		     event.mouse.rootx - offset_x, 
+		     event.mouse.rooty - offset_y);
+      }
+      if (event.mouse.buttons == GR_BUTTON_R) {
+	GrResizeWindow(event.mouse.wid, 
+		     event.mouse.x + 1, 
+		     event.mouse.y + 1);
+      }
+      break;
+    case GR_EVENT_TYPE_EXPOSURE:
+      /*GrFillRect(event.exposure.wid, defgc,
+	event.exposure.x, event.exposure.y,
+	event.exposure.width, event.exposure.height);*/
+      break;
+    case GR_EVENT_TYPE_CLOSE_REQ:
+      GrClose();
+      exit(0);
+    default:
+      fprintf(stderr, "%d\n", event.type);
+    }
+  }
+  GrClose();
+}
diff -urN lib/microwindows/src/demos/nanox/nanogui.ppm /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nanogui.ppm
--- lib/microwindows/src/demos/nanox/nanogui.ppm	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nanogui.ppm	2005-02-21 16:12:58.000000000 +0100
@@ -0,0 +1,1578 @@
+P6
+384 83
+255
+��������������������������������������������������������������������������������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڹڸڸڸڸڷڷڷڷڶڶڶڶڵڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲۲۱۱۱۱۰۰۰۰ۯۯۯۯۯۮۮۮۮۭۭۭۭ۪۬۬۬۬۬۫۫۫۫ܪܪܪܩܩܩܩܨܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥܥܤܤܤܤܣܣܣܣܢܢܢܢܢݡݡݡݡݠݠݠݠݟݟݟݟݞݞݞݞݞݝݝݝݝݜݜݜݜݛݛݛݛݛݚݚݚݚݙݙݙޙޘޘޘޘޘޗޗޗޗޖޖޖޖޕޕޕޕޕޔޔޔޔޓޓޓޓޒޒޒޒޑޑޑޑޑސސߐߐߏߏߏߏߎߎߎߎߎߍߍߍߍߌߌߌߌߋߋߋߋߋߊߊߊߊ߉߉߉߉߈߈߈߈߈߇�����������������������������������������������������������������������~�~�~�~�~�}�}�}�}�|�|�|�|�{�{�{�{�z�z�z�z�z�y��������������������������������������������������������������������������������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڸڸڸڸڷڷڷڷڷڶڶڶڶڵڵڵڵڴڴڴڴڴڳ۳۳۳۲۲۲۲۱۱۱۱۱۰۰۰۰ۯۯۯۯۮۮۮۮۭۭۭۭۭ۪۬۬۬۬۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܧܦܦܦܦܥܥܥܥܤܤܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݠݠݠݠݠݟݟݟݟݞݞݞݞݝݝݝݝݝݜݜݜݜݛݛݛݛݚݚݚݚݚݙݙݙޙޘޘޘޘޗޗޗޗޖޖޖޖޖޕޕޕޕޔޔޔޔޓޓޓޓޓޒޒޒޒޑޑޑޑސސސߐߐߏߏߏߏߎߎߎߎߍߍߍߍߍߌߌߌߌߋߋߋߋߊߊߊߊ߉߉߉߉߉߈߈߈߈߇߇����������������������������������������������������������������������~�~�~�~�}�}�}�}�|�|�|�|�|�{�{�{�{�z�z�z�z�y�y������������������������������������������������������������������������������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڹڸڸڸڸڷڷڷڷڶڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۳۲۲۲۲۱۱۱۱۰۰۰۰ۯۯۯۯۯۮۮۮۮۭۭۭۭ۪۬۬۬۬۬۫۫۫۫ܪܪܪܩܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥܥܤܤܤܤܣܣܣܣܢܢܢܢܢݡݡݡݡݠݠݠݠݟݟݟݟݟݞݞݞݞݝݝݝݝݜݜݜݜݜݛݛݛݛݚݚݚݚݙݙݙݙޘޘޘޘޘޗޗޗޗޖޖޖޖޕޕޕޕޕޔޔޔޔޓޓޓޓޒޒޒޒޒޑޑޑޑސސߐߐߏߏߏߏߎߎߎߎߎߍߍߍߍߌߌߌߌߋߋߋߋߋߊߊߊߊ߉߉߉߉߈߈߈߈߈߇�����������������������������������������������������������������������~�~�~�~�~�}�}�}�}�|�|�|�|�{�{�{�{�{�z�z�z�z�y�y������������������������������������������������������������������������������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڸڸڸڸڸڷڷڷڷڶڶڶڶڵڵڵڵڴڴڴڴڴڳ۳۳۳۲۲۲۲۱۱۱۱۱۰۰۰۰ۯۯۯۯۮۮۮۮۮۭۭۭۭ۬۬۬۬۫۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܧܦܦܦܦܥܥܥܥܤܤܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݡݠݠݠݠݟݟݟݟݞݞݞݞݝݝݝݝݝݜݜݜݜݛݛݛݛݚݚݚݚݚݙݙݙޙޘޘޘޘޗޗޗޗޗޖޖޖޖޕޕޕޕޔޔޔޔޔޓޓޓޓޒޒޒޒޑޑޑޑސސސߐߐߏߏߏߏߎߎߎߎߍߍߍߍߍߌߌߌߌߋߋߋߋߊߊߊߊߊ߉߉߉߉߈߈߈߈߇߇�����������������������������������������������������������������������~�~�~�~�}�}�}�}�}�|�|�|�|�{�{�{�{�z�z�z�z�y�y�y����������������������������������������������������������������������������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ںںںںڹڹڹڹڹڸڸڸڸڷڷڷڷڶڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۳۲۲۲۲۱۱۱۱۰۰۰۰۰ۯۯۯۯۮۮۮۮۭۭۭۭ۪۬۬۬۬۬۫۫۫۫ܪܪܪܩܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܦܥܥܥܥܤܤܤܤܣܣܣܣܣܢܢܢܢݡݡݡݡݠݠݠݠݟݟݟݟݟݞݞݞݞݝݝݝݝݜݜݜݜݜݛݛݛݛݚݚݚݚݙݙݙݙޙޘޘޘޘޗޗޗޗޖޖޖޖޕޕޕޕޕޔޔޔޔޓޓޓޓޒޒޒޒޒޑޑޑޑސސސߐߏߏߏߏߏߎߎߎߎߍߍߍߍߌߌߌߌߌߋߋߋߋߊߊߊߊ߉߉߉߉߈߈߈߈߈߇�����������������������������������������������������������������������~�~�~�~�~�}�}�}�}�|�|�|�|�{�{�{�{�{�z�z�z�z�y�y�y����������������������������������������������������������������������������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڸڸڸڸڸڷڷڷڷڶڶڶڶڵڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲۱۱۱۱۱۰۰۰۰ۯۯۯۯۮۮۮۮۮۭۭۭۭ۬۬۬۬۫۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥܤܤܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݡݠݠݠݠݟݟݟݟݞݞݞݞݞݝݝݝݝݜݜݜݜݛݛݛݛݛݚݚݚݚݙݙݙޙޘޘޘޘޗޗޗޗޗޖޖޖޖޕܡܨܨܧܧޔޔޔޓޓޓޓޒޒޒޒޑޑޑޑޑސސߐߐߏߏߏߏߎߎߎߎߍߍߍߍߍߌߌߌߌߋߋߋߋߊߊߊߊߊ߉߉߉߉߈߈߈߈߇߇�����������������������������������������������������������������������~�~�~�~�}�}�}�}�}�|�|�|�|�{�{�{�{�z�z�z�z�z�y�y�y����������������������������������������������hrzqf�kh~wgxn`oy\vh[q{aesaho]izga��������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ںںںںںڹڹڹڹڸڸڸڸڷڷڷڷڷڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۳۲۲۲۲۱۱۱۱۰۰۰۰۰ۯۯۯۯۮۮۮۮۭۭۭۭۭ۪۬۬۬۬۫۫۫۫ܪܪܪܩܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܦܥܥܥܥܤܤܤܤܣܣܣܣܣܢܢܢܢݡݡݡݡݠݠݠݠݠݟݟݟݟݞݞݞݞݝݝݝݝݜݜݜݜݜݛݛݛݛݚݚݚݚݙݙݙݙޙޘޘޘޘޗޗޗޗܢͣzgank[tac{d^ofaip``wS_i]ddS`lZ\fXjlUpvVͣܦޒޒޒޒޒޑޑޑޑސސސߐߏߏߏߏߏߎߎߎߎߍߍߍߍߌߌߌߌߌߋߋߋߋߊߊߊߊ߉߉߉߉߉߈߈߈߈߇߇����������������������������������������������������������������������~�~�~�~�}�}�}�}�|�|�|�|�|�{�{�{�{�z�z�z�z�y�y�y�y�����������������������������������������mqkq}ot{om~wjrf|t_ru\nx]rsYmpdbpljndhhfjzjomkntpbkdh����������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڸڸڸڸڸڷڷڷڷڶڶڶڶڵڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲۲۱۱۱۱۰۰۰۰ۯۯۯۯۯۮۮۮۮۭۭۭۭ۪۬۬۬۬۫۫۫۫۫ܪܪܪܩܩܩܩܨܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥܥܤܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݡݠݠݠݠݟݟݟݟݞݞݞݞݞݝݝݝݝݜݜݜݜݛݛݛݛݛݚݚݚݚݙݙݙޙޘޘޘޘޘޗܣ�tOpdbpljndhhfjzjomkntpbkdhlmajmadklXp]_rS^{Q[tV]rSfvPl{UvoXmnJ̢ޒޑޑޑޑޑސސߐߐߏߏߏߏߎߎߎߎߎߍΤyt�yy�yu�w~wt�xgtxfuyo|np{qpv~tvqqo{oyzghqr`�hrzqf�kh~wgx߈߈߈߈߇߇����ޖ{d^ofaip``wS_i]ddS`lZ\fXjlUpvVrhLnmEopJvlNopIoqNmlHutOsnRޒ����������������������{d^ofaip``wS_i]ddS`lZ\fXjlUpvVrhLnmEopJvlNopIoqNmlHutOsnRw}J�z�z�z�z�y�y�y�y������������������������������������ef�pg�id�dnxgl�mo~llwhczifwnlqjelgoilfk_oj`inqhclZkv]qt`sfbumdhiii������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ںںںںںڹڹڹڹڸڸڸڸڷڷڷڷڷڶڶڶڶڵڵڵڵڴڴڴڴڴڳ۳۳۳۲۲۲۲۱۱۱۱۰۰۰۰۰ۯۯۯۯۮۮۮۮۭۭۭۭۭ۪۬۬۬۬۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܧܦܦܦܦܥܥܥܥܤܤܤܤܣܣܣܣܣܢܢܢܢݡݡݡݡݠݠݠݠݠݟݟݟݟݞݞݞݞݝݝݝݝݝݜݜݜݜݛݛݛݛݚݚݚݚݙݙݙݙޙޘޘޘޘ̥nlqjelgoilfk_oj`inqhclZkv]qt`sfbumdhiii\ck[jpXt^d^e^i[foRdwYnkSndMobL^aQޒޑޑޑޑސސސߐߐߏߏߏߏߎߎߎߎߍߍpt~ny�tipoj{g~�}oyovho~lu|llprv{{~{y�mqkq}ot{om~wjrf|t_r߈߈߈߈߇߇����ݞtpbkdhlmajmadklXp]_rS^{Q[tV]rSfvPl{UvoXmnJedItcKwlLtdNtkPݛ���������������������tpbkdhlmajmadklXp]_rS^{Q[tV]rSfvPl{UvoXmnJedItcKwlLtdNtkPspB�z�z�z�y�y�y�y�y��������������������������������jn|jk|\atbcz_jz_c}_c�je�fp�cz�ax�nmuos{asnaekZ^l\]ppcf|_bk^hd]ho^xkctjhtcfle]h������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڹڸڸڸڸڷڷڷڷڶڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲۲۱۱۱۱۰۰۰۰ۯۯۯۯۯۮۮۮۮۭۭۭۭ۪۬۬۬۬۬۫۫۫۫ܪܪܪܩܩܩܩܨܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥܥܤܤܤܤܣܣܣܣܢܢܢܢܢݡݡݡݡݠݠݠݠݟݟݟݟݟݞݞݞݞݝݝݝݝݜݜݜݜݛݛݛݛݛݚݚݚݚݙݙݙޙޘޘޘ̧cz�ax�nmuos{asnaekZ^l\]ppcf|_bk^hd]ho^xkctjhtcfle]hW`md_baiega^kl]_k\`iMjdQkcUޑޑޑޑޑސސߐߐߏߏߏߏߎߎߎߎߎߍߍt{�tt�u{�jn�et�bn�gl�ft~bn|kk~kr�ef�pg�id�dnxgl�mo~llwhczifw߈߈߈߈߇������ݞt`sfbumdhiii\ck[jpXt^d^e^i[foRdwYnkSndMobL^aQfjPjeLguR^qPݛ���������������������t`sfbumdhiii\ck[jpXt^d^e^i[foRdwYnkSndMobL^aQfjPjeLguR^qPlsB�z�z�z�y�y�y�y�x������������������������������eihk�gk�ab�fatlWi]�ll�ci�[pu\yx]wnhwpmiv\kla`fjpkmqqeisbht\mlibpimsjnfUagPcqafoRo]������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڸڸڸڸڷڷڷڷڷڶڶڶڶڵڵڵڵڴڴڴڴڴڳ۳۳۳۲۲۲۲۱۱۱۱۱۰۰۰۰ۯۯۯۯۮۮۮۮۭۭۭۭۭ۪۬۬۬۬۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܧܦܦܦܦܥܥܥܥܤܤܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݠݠݠݠݠݟݟݟݟݞݞݞݞݝݝݝݝݝݜݜݜݜݛݛݛݛݚݚݚݚݚݙݙݙޙޘܪci�[pu\yx]wnhwpmiv\kla`fjpkmqqeisbht\mlibpimsjnfUagPcqafoRo]Og\]^a`saZjT^nSbg\[jRZkRޑޑޑޑސސސߐߐߏߏߏߏߎߎߎߎߍߍߍco�kv�o{�f{�gr�Ui�fi�]r^uujn|jk|\atbcz_jz_c}_c�je�fp�cz�ax�߈߈߈߇߇������ݞd]ho^xkctjhtcfle]hW`md_baiega^kl]_k\`iMjdQkcUjqTZsAbtNfjGݛ���������������������d]ho^xkctjhtcfle]hW`md_baiega^kl]_k\`iMjdQkcUjqTZsAbtNfjGrqT�z�z�y�y�y�y�y�x����������������������������c`�gk�gb�_r�ja~h\|je�n]wem�Yj�a]yWh~VmxZjvcco^br^jdcn\dlk_mjPhh]bwZik]ksPleXfmSbaQ`bZadXd^������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڹڸڸڸڸڷڷڷڷڶڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۳۲۲۲۲۱۱۱۱۰۰۰۰ۯۯۯۯۯۮۮۮۮۭۭۭۭ۪۬۬۬۬۬۫۫۫۫ܪܪܪܩܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥܥܤܤܤܤܣܣܣܣܢܢܢܢܢݡݡݡݡݠݠݠݠݟݟݟݟݟݞݞݞݞݝݝݝݝݜݜݜݜݜݛݛݛݛݚݚݚݚݙݙݙݙݝn]wem�Yj�a]yWh~VmxZjvcco^br^jdcn\dlk_mjPhh]bwZik]ksPleXfmSbaQ`bZadXd^Vkd[x^ZuX\mbYi`[l\GtOޑޑޑޑސސߐߐߏߏߏߏߏߎߎߎߎߍߍߍso}en�ro�kj�Yg�Zc�ag�ec�eihk�gk�ab�fatlWi]�ll�ci�[pu\yx]wn߈߈߈߇��������ݞibpimsjnfUagPcqafoRo]Og\]^a`saZjT^nSbg\[jRZkRbqGgtLdkKawGݚ��������������������ibpimsjnfUagPcqafoRo]Og\]^a`saZjT^nSbg\[jRZkRbqGgtLdkKawG`vW�z�z�y�y�y�y�x�x��������������������������^a�a\�ab�gf�sf}me�jZ�fisf^udm~glUe~]jwbmsSkwXZxXgpcqhfl`dqgPnoLkgXihTpkOnjPynXp]Vrc[m^QmgJtcXp[������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڸڸڸڸڸڷڷڷڷڶڶڶڶڵڵڵڵڴڴڴڴڴڳڳ۳۳۲۲۲۲۱۱۱۱۱۰۰۰۰ۯۯۯۯۮۮۮۮۮۭۭۭۭ۬۬۬۬۫۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܧܦܦܦܦܥܥܥܥܤܤܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݡݠݠݠݠݟݟݟݟݞݞݞݞݝݝݝݝݝݜݜݜݜݛݛݛݛݚݚݚݚݚݙݙݙܪfisf^udm~glUe~]jwbmsSkwXZxXgpcqhfl`dqgPnoLkgXihTpkOnjPynXp]Vrc[m^QmgJtcXp[^jS\sYTuhRo_No`Tnbޑޑޑސސސߐߐߏߏߏߏߎߎߎߎߍߍߍߍe]�tl�mk�km�k`�ni�ah�c`�gk�gb�_r�ja~h\|je�n]wem�Yj�a]yWh~Vmx߈߈߇߇��������ݞZik]ksPleXfmSbaQ`bZadXd^Vkd[x^ZuX\mbYi`[l\GtOLpSTmSPmGVjLݚ��������������������Zik]ksPleXfmSbaQ`bZadXd^Vkd[x^ZuX\mbYi`[l\GtOLpSTmSPmGVjL[lV�z�y�y�y�y�y�x�x������������������������cT�gZ�h\�b_ga�pS�jU�hc�lc}dh�Vq�\k�ekv[ll`pxYfyQ^n]^wfhi\_eZgaNsfNo]TwdRtjDxeJleHsgXlaUvgIugUqgLrhRk\������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ںںںںںڹڹڹڹڸڸڸڸڷڷڷڷڶڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۳۲۲۲۲۱۱۱۱۰۰۰۰۰ۯۯۯۯۮۮۮۮۭۭۭۭ۪۬۬۬۬۬۫۫۫۫ܪܪܪܩܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܦܥܥܥܥܤܤܤܤܣܣܣܣܣܢܢܢܢݡݡݡݡݠݠݠݠݟݟݟݟݟݞݞݞݞݝݝݝݝݜݜݜݜݜݛݛݛݛݚݚݚݚݙݙݙ̤hc�lc}dh�Vq�\k�ekv[ll`pxYfyQ^n]^wfhi\_eZgaNsfNo]TwdRtjDxeJleHsgXlaUvgIugUqgLrhRk\UlVS|iWykClhQd]ޑޑޑސސސߐߏߏߏߏߏߎߎߎߎߍߍߍߍ`V|pi{sZ�`ezp^�me�^a�a\�ab�gf�sf}me�jZ�fisf^udm~glUe~]jwbms߈߈߇����������ݞTpkOnjPynXp]Vrc[m^QmgJtcXp[^jS\sYTuhRo_No`TnbLs^QjWMm`JbUݚ�������������������TpkOnjPynXp]Vrc[m^QmgJtcXp[^jS\sYTuhRo_No`TnbLs^QjWMm`JbUTdU�z�y�y�y�y�x�x�x����������������������hZ�\`�YW�i_�eS^N�cS�jX�_\�fm�Yb�]gtRgvZfr`aeT_tSYz]YyZ[�abiUd_Vl`UgeBnqQq_MoXB�ZPylEqbJwiPzoZvl[�pP|k_~_P|U����	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڸڸڸڸڸڷڷڷڷڶڶڶڶڵڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲۲۱۱۱۱۰۰۰۰ۯۯۯۯۮۮۮۮۮۭۭۭۭ۪۬۬۬۬۫۫۫۫۫ܪܪܪܩܩܩܩܨܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥܤܤܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݡݠݠݠݠݟݟݟݟݞݞݞݞݞݝݝݝݝݜݜݜݜݛݛݛݛݛݚݚݚݚݙݙcS�jX�_\�fm�Yb�]gtRgvZfr`aeT_tSYz]YyZ[�abiUd_Vl`UgeBnqQq_MoXB�ZPylEqbJwiPzoZvl[�pP|k_~_P|USsWIh`Hq[Do[ޑޑޑސސߐߐߏߏߏߏߎߎߎߎߍߍߍߍߍ`^~aQ�eM|kQ�cf�cT�gZ�h\�b_ga�pS�jU�hc�lc}dh�Vq�\k�ekv[ll`px߈߇߇����������ݞRtjDxeJleHsgXlaUvgIugUqgLrhRk\UlVS|iWykClhQd]Qp^Fr[KcYMjZݚ�������������������~RtjDxeJleHsgXlaUvgIugUqgLrhRk\UlVS|iWykClhQd]Qp^Fr[KcYMjZ\o[�z�y�y�y�y�x�x�x��������������������oh�ff|hl�Yb�[`�Z\WY�Zi}^l�`m�^b|Wn�]d}_ouRflXisShkVbzObrScqMlmXnmOhjTieTefWpjWvcWodPnfSolXskL~mPtgTuaNyiZxdUkf?w^����	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ںںںںںڹڹڹڹڸڸڸڸڷڷڷڷڷڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۳۲۲۲۲۱۱۱۱۰۰۰۰۰ۯۯۯۯۮۮۮۮۭۭۭۭۭ۪۬۬۬۬۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܦܥܥܥܥܤܤܤܤܣܣܣܣܣܢܢܢܢݡݡݡݡݠݠݠݠݠݟݟݟݟݞݞݞݞݝݝݝݝݜݜݜݜݜݛݛݛݛݚݚݚݚݙݙWY�Zi}^l�`m�^b|Wn�]d}_ouRflXisShkVbzObrScqMlmXnmOhjTieTefWpjWvcWodPnfSolXskL~mPtgTuaNyiZxdUkf?w^@oeGkaGrXޑޑސސސߐߏߏߏߏߏߎߎߎߎߍߍߍߍߌgT}p^sWyk[�hZ�\`�YW�i_�eS^N�cS�jX�_\�fm�Yb�]gtRgvZfr`aeT_t߈߇߇����������ݞMoXB�ZPylEqbJwiPzoZvl[�pP|k_~_P|USsWIh`Hq[Do[KaYMpbOwS`wVݚ������������������~MoXB�ZPylEqbJwiPzoZvl[�pP|k_~_P|USsWIh`Hq[Do[KaYMpbOwS`wVcr\�y�y�y�y�x�x�x�x������������������ob�sh~lgz`q�\g~]^y_Y}`_Y^�_p{Ra�Uj�Sh~[^�^_{QemLlePlqK`zKY~XhtTbi_rm[ecL^bPl_RghJr`Rf[Nk_Phi\jk]clZhe`gcSleMp_CjdFe_?p]����	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڸڸڸڸڸڷڷڷڷڶڶڶڶڵڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲۲۱۱۱۱۰۰۰۰ۯۯۯۯۯۮۮۮۮۭۭۭۭ۪۬۬۬۬۫۫۫۫۫ܪܪܪܩܩܩܩܨܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥܥܤܤܤܤܣܣܣܣܢܢܢܢܢݡݡݡݡݠݠݠݠݟݟݟݟݞݞݞݞݞݝݝݝݝݜݜݜݜݛݛݛݛݛݚݚݚݚݙ_Y}`_Y^�_p{Ra�Uj�Sh~[^�^_{QemLlePlqK`zKY~XhtTbi_rm[ecL^bPl_RghJr`Rf[Nk_Phi\jk]clZhe`gcSleMp_CjdFe_?p]>oYCf_ޑޑސސߐߐߏߏߏߏߎߎߎߎߎߍߍߍߍߌo_ymfzwe{oh�ff|hl�Yb�[`�Z\WY�Zi}^l�`m�^b|Wn�]d}_ouRflXisShk߇߇������������ݞWvcWodPnfSolXskL~mPtgTuaNyiZxdUkf?w^@oeGkaGrXFlXLnUEz_QzTݚ�����������������~�~WvcWodPnfSolXskL~mPtgTuaNyiZxdUkf?w^@oeGkaGrXFlXLnUEz_QzTXp\�y�y�y�y�x�x�x�x������������������yv�mo{nk�gvcnyTc�ce�chvas�bw�_q�TY�aW�SWr^^yX\qa]rPXpN\sZVwUYxNadagePjbM_aNv]Qsb\ed[^`YdZNh^IlQKlUVhfWvmJrcLw^MtcDqY@gX����	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ںںںںںڹڹڹڹڸڸڸڸڷڷڷڷڷڶڶڶڶڵڵڵڵڴڴڴڴڴڳ۳۳۳۲۲۲۲۱۱۱۱۰۰۰۰۰ۯۯۯۯۮۮۮۮۭۭۭۭۭ۪۬۬۬۬۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܧܦܦܦܦܥܥܥܥܤܤܤܤܣܣܣܣܣܢܢܢܢݡݡݡݡݠݠݠݠݠݟݟݟݟݞݞݞݞݝݝݝݝݝݜݜݜݜݛݛݛݛݚݚݚݚݚ{{^ce�chvas�bw�_q�TY�aW�SWr^^yX\qa]rPXpN\sZVwUYxNadagePjbM_aNv]Qsb\ed[^`YdZNh^IlQKlUVhfWvmJrcLw^MtcDqY@gXJf[?fYޑސސސߐߐߏߏߏߏߎߎߎߎߍߍߍߍߌߌke�sn{ob�sh~lgz`q�\g~]^y_Y}`_Y^�_p{Ra�Uj�Sh~[^�^_{QemLlePlq߇߇������������ݞJr`Rf[Nk_Phi\jk]clZhe`gcSleMp_CjdFe_?p]>oYCf_IdWLmYI{ZGjMݚ����������������~�~Jr`Rf[Nk_Phi\jk]clZhe`gcSleMp_CjdFe_?p]>oYCf_IdWLmYI{ZGjM[tU�y�y�y�y�x�x�x�x����������������irmw�gn�ck�^vz[g~]e~\c~Ya{Yk~TYqTf|MZvJdsO`uMauNaqU\pTWkMZlHOfOSgSc`ZbVKaTMg]FciK[\OdfUe_P_cXeYVkeWl]Pq_Sg^WwXIxRMsVDwRLoPElX����	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڹڸڸڸڸڷڷڷڷڶڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲۲۱۱۱۱۰۰۰۰ۯۯۯۯۯۮۮۮۮۭۭۭۭ۪۬۬۬۬۬۫۫۫۫ܪܪܪܩܩܩܩܨܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥܥܤܤܤܤܣܣܣܣܢܢܢܢܢݡݡݡݡݠݠݠݠݟݟݟݟݟݞݞݞݞݝݝݝݝݜݜݜݜݛݛݛݛݛݚݚݚݚ۪]e~\c~Ya{Yk~TYqTf|MZvJdsO`uMauNaqU\pTWkMZlHOfOSgSc`ZbVKaTMg]FciK[\OdfUe_P_cXeYVkeWl]Pq_Sg^WwXIxRMsVDwRLoPElXGm`ޑސސߐߐߏߏߏߏߎߎߎߎߎߍߍߍߍߌߌkm�lsyv�mo{nk�gvcnyTc�ce�chvas�bw�_q�TY�aW�SWr^^yX\qa]rPXp߇��������������ݝ\ed[^`YdZNh^IlQKlUVhfWvmJrcLw^MtcDqY@gXJf[?fYOnXEpMBlNMvLݚ���������������~�~�~\ed[^`YdZNh^IlQKlUVhfWvmJrcLw^MtcDqY@gXJf[?fYOnXEpMBlNMvL_bS�y�y�y�x�x�x�x�w����������������or�oqzaf|dhv]o~WhsSf�]]tVckSUwQPoUayBYwNWvORyPSpCTwB]cKZkENoONfCQcJTbCYYEZXL]fJVWJNbL\[OceUUfQmTVnXVrYTr^QjOQsNItINqYEzXNtTQeR����	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڸڸڸڸڷڷڷڷڷڶڶڶڶڵڵڵڵڴڴڴڴڴڳ۳۳۳۲۲۲۲۱۱۱۱۱۰۰۰۰ۯۯۯۯۮۮۮۮۮۭۭۭۭ۪۬۬۬۬۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܧܦܦܦܦܥܥܥܥܤܤܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݠݠݠݠݠݟݟݟݟݞݞݞݞݝݝݝݝݝݜݜݜݜݛݛݛݛݚݚݚݚܟWhsSf�]]tVckSUwQPoUayBYwNWvORyPSpCTwB]cKZkENoONfCQcJTbCYYEZXL]fJVWJNbL\[OceUUfQmTVnXVrYTr^QjOQsNItINqYEzXNtTQeRRlTސސސߐߐߏߏߏߏߎߎߎߎߍߍߍߍߍߌߌprxirmw�gn�ck�^vz[g~]e~\c~Ya{Yk~TYqTf|MZvJdsO`uMauNaqU\pTWk߇��������������ݝOdfUe_P_cXeYVkeWl]Pq_Sg^WwXIxRMsVDwRLoPElXGm`CmWCiCNgNJoFݚ���������������~�~�~OdfUe_P_cXeYVkeWl]Pq_Sg^WwXIxRMsVDwRLoPElXGm`CmWCiCNgNJoFKeV�y�y�y�x�x�x�x�w��������������_i|^mtQwsUjtad~ba~XbzP\jYknXWuHTyOTkMXpEY�NS�KapH\wDUoITbK\fINd;Tc?OjFP]DPcGTb@SY?QU@JaDTjJOcGV[LoaAjaHn\Rq]PmUTtYFmWJ{YR`Gx\HmPXwW����	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ںںںںڹڹڹڹڹڸڸڸڸڷڷڷڷڶڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۳۲۲۲۲۱۱۱۱۰۰۰۰ۯۯۯۯۯۮۮۮۮۭۭۭۭ۪۬۬۬۬۬۫۫۫۫ܪܪܪܩܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܦܥܥܥܥܤܤܤܤܣܣܣܣܢܢܢܢܢݡݡݡݡݠݠݠݠݟݟݟݟݟݞݞݞݞݝݝݝݝݜݜݜݜݜݛݛݛݛݚݚݚݚba~XbzP\jYknXWuHTyOTkMXpEY�NS�KapH\wDUoITbK\fINd;Tc?OjFP]DPcGTb@SY?QU@JaDTjJOcGV[LoaAjaHn\Rq]PmUTtYFmWJ{YR`Gx\HmPXwWސސސߐߏߏߏߏߏߎߎߎߎߍߍߍߍߌߌߌiq�or�oqzaf|dhv]o~WhsSf�]]tVckSUwQPoUayBYwNWvORyPSpCTwB]cKZk����������������ݝL\[OceUUfQmTVnXVrYTr^QjOQsNItINqYEzXNtTQeRRlTEpOVnKOkOPdSݚ�������������~�~�~�~L\[OceUUfQmTVnXVrYTr^QjOQsNItINqYEzXNtTQeRRlTEpOVnKOkOPdSPcR�y�y�x�x�x�x�x�w��������������\dXg�\fSv}^tuNjuRbpHXnS[qQYlD]sMdgB[u<Xu:KuLN~DSzAMs8DrEEjBNjMJ[?Qh>Pk:Pb4GgDSUGR^FQY8T]E^`@c\O_WLbYMsXMl^Ox[GkTUk]Fs]Iv\POFpWDkQ����	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڸڸڸڸڸڷڷڷڷڶڶڶڶڵڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲۱۱۱۱۱۰۰۰۰ۯۯۯۯۮۮۮۮۮۭۭۭۭ۬۬۬۬۫۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܧܦܦܦܦܥܥܥܥܤܤܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݡݠݠݠݠݟݟݟݟݞݞݞݞݞݝݝݝݝݜݜݜݜݛݛݛݛݚݚݚݚʨNjuRbpHXnS[qQYlD]sMdgB[u<Xu:KuLN~DSzAMs8DrEEjBNjMJ[?Qh>Pk:Pb4GgDSUGR^FQY8T]E^`@c\O_WLbYMsXMl^Ox[GkTUk]Fs]Iv\POFpWDkQސސߐߐߏߏߏߏߎߎߎߎߍߍߍߍߍߌߌߌ_i|^mtQwsUjtad~ba~XbzP\jYknXWuHTyOTkMXpEY�NS�KapH\wDUoITbK\f����������������ݝDTjJOcGV[LoaAjaHn\Rq]PmUTtYFmWJ{YR`Gx\HmPXwWQyP>bYIpOBiWݚ�������������~�~�~�~DTjJOcGV[LoaAjaHn\Rq]PmUTtYFmWJ{YR`Gx\HmPXwWQyP>bYIpOBiWKiV�y�y�x�x�x�x�w�w��������������^dw^bw]bmXpuMhjOhhLhrPdmC[t;`oB[r5[s<Rw4Js4Ow<Ls?Tr=Fq=;mH@qOCcIO`ASg@Lb>Rb7NZ?Of>V]<Kd8cd>anC`^FS\HhMCdSP`UMdWH^VTcUSgVEuL@pVEgPEfUDmR��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ںںںںںڹڹڹڹڸڸڸڸڷڷڷڷڶڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۳۲۲۲۲۱۱۱۱۰۰۰۰۰ۯۯۯۯۮۮۮۮۭۭۭۭۭ۪۬۬۬۬۫۫۫۫ܪܪܪܩܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܦܥܥܥܥܤܤܤܤܣܣܣܣܣܢܢܢܢݡݡݡݡݠݠݠݠݟݟݟݟݟݞݞݞݞݝݝݝݝݜݜݜݜݜݛݛݛݛݚݚݚܟMhjOhhLhrPdmC[t;`oB[r5[s<Rw4Js4Ow<Ls?Tr=Fq=;mH@qOCcIO`ASg@Lb>Rb7NZ?Of>V]<Kd8cd>anC`^FS\HhMCdSP`UMdWH^VTcUSgVEuL@pVEgPEfUސސߐߏߏߏߏߏߎߎߎߎߍߍߍߍߌߌߌߌ\dXg�\fSv}^tuNjuRbpHXnS[qQYlD]sMdgB[u<Xu:KuLN~DSzAMs8DrEEj����������������ݝ8T]E^`@c\O_WLbYMsXMl^Ox[GkTUk]Fs]Iv\POFpWDkQKsNGdWLg[Il_ݚ������������~�~�~�~8T]E^`@c\O_WLbYMsXMl^Ox[GkTUk]Fs]Iv\POFpWDkQKsNGdWLg[Il_If\�y�x�x�x�x�x�w�w������������cs�Vn}Um}PgGktQ[sCavK_vHVlLVsA_y3ex=X{@Nz<Uh=Ox6Co.Eq6Hc8H]:AbBEa>NhEQaDTY>RfCMc-Qd/TYNh.Xc<X_4Mc=UaIURD^UB^VB]IH`H>^R<VU:UO9VTF\RLWVD^U����	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڸڸڸڸڸڷڷڷڷڶڶڶڶڵڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲۲۱۱۱۱۰۰۰۰ۯۯۯۯۮۮۮۮۮۭۭۭۭ۪۬۬۬۬۫۫۫۫۫ܪܪܪܩܩܩܩܨܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥܥܤܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݡݠݠݠݠݟݟݟݟݞݞݞݞݞݝݝݝݝݜݜݜݜݛݛݛݛݛݚݚݚGktQ[sCavK_vHVlLVsA_y3ex=X{@Nz<Uh=Ox6Co.Eq6Hc8H]:AbBEa>NhEQaDTY>RfCMc-Qd/TYNh.Xc<X_4Mc=UaIURD^UB^VB]IH`H>^R<VU:UO9VTF\RLWVސߐߐߏߏߏߏߎߎߎߎߎߍߍߍߍߌߌߌߌ^dw^bw]bmXpuMhjOhhLhrPdmC[t;`oB[r5[s<Rw4Js4Ow<Ls?Tr=Fq=;mH@q����������������ݝ8cd>anC`^FS\HhMCdSP`UMdWH^VTcUSgVEuL@pVEgPEfUDmR@`TKaVI^Mݚ�����������~�~�~�~�}8cd>anC`^FS\HhMCdSP`UMdWH^VTcUSgVEuL@pVEgPEfUDmR@`TKaVI^MBdU�y�x�x�x�x�w�w�w������������Wo{QpyTh|QdjUdiLaxNjsI^jTZoHUmAai;\o1_k6fp*Qh7Js5Vd3SiEDg<Bl<Ci>HfBVm:Vm5I]BS_?HT(Sf(Re!J]2Ol5M]0R^DOX;[S7RU6[G8KO/UI9VO@TP6WD;\LEXRK`[IaU����	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ؾ	��	����^b|Wn�]d}_ouRfl��������
+ټ
+ںںںڹڹڹڹڸڸڸڸڷڷڷڷڷڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۳۲۲۲۲۱۱۱۱۰۰۰ڶʱhl�Yb�[`�Z\WY�Zi}^l�`m�^b|ڸڰۭۭ۪۬۬۬۬۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܦܥܥܥܥܤܤܤܤܣۧڱ]d}_ouRflXisShkVbzObrScqMlm~�OۯܥݠݠݠݟݟݟݟݞݞݞݞݝݝݝݝݜݜݜݜݜݛݛݛݛݚݚݚۥUdiLaxNjsI^jTZoHUmAai;\o1_k6fp*Qh7Js5Vd3SiEDg<Bl<Ci>HfBVm:Vm5I]BS_?HT(Sf(Re!J]2Ol5M]0R^DOX;[S7RU6[G8KO/UI9VO@TP6WD;\LEXRK`[ސߐߏߏߏߏߏߎߎߎߎߍߍߍߍߌߌߌߌߌVn}Um}PgGktQ[sCavK_vHVlLVsA_y3ex=X{@Nz<Uh=Ox6Co.Eq6Hc8H]:Ab����������������ݝ.Xc<X_4Mc=UaIURD^UB^VB]IH`H>^R<VU:UO9VTF\RLWVD^UDY\=cG2[Nݚ����������~�~�~�~�}.Xc<X_4Mc=UaIURD^UB^VB]IH`H>^R<VU:UO9VTF\RLWVD^UDY\=cG2[N8aX�x�x�x�x�x�w�w�w������������Ki~U\|M_jHfnQ^jJgnA_hJ_gA_nJfu=eh7^g3ih1Xb+GZ,Rf)Tf)H`3Lf2G`>Jd;PfAMj<Ps2Ce3Fd>C]-T^%LV3RZ)F\(Bd6JX@J]:XL/OU2VO&OS-KM9VR8ON)[B:TE7aO;RE?[O����	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+ؿ	����`_Y^�_p{Ra�Uj�Sh~[^�^_{QemLlePlqK`zKY~Xht����	ٻ
+ڹڹڹڹڸڸڸڸڷڷڷڷڶڶڶڶڵڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲۲۱۱۱۱ڳ��Xob�sh~lgz`q�\g~]^y_Y}`_Y^�_p{Ra�Uj�Sh~[^�^_{ǯ۪۬۬۬۫۫۫۫۫ܪܪܪܩܩܩܩܨܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥܥܤܤۨʭRa�Uj�Sh~[^�^_{QemLlePlqK`zKY~XhtTbi_rm[ecL^bPl_ȪݟݟݟݟݞݞݞݞݞݝݝݝݝݜݜݜݜݛݛݛݛݛݚݚݚHfnQ^jJgnA_hJ_gA_nJfu=eh7^g3ih1Xb+GZ,Rf)Tf)H`3Lf2G`>Jd;PfAMj<Ps2Ce3Fd>C]-T^%LV3RZ)F\(Bd6JX@J]ir8ܦܦܦaj89VR8ON)[B:TE7aO;REߐߐߏߏߏߏߎߎߎߎߎߍߍߍߍߌߌߌߌߋQpyTh|QdjUdiLaxNjsI^jTZoHUmAai;\o1_k6fp*Qh7Js5Vd3SiEDg<Bl<Ci����������������ݝ2Ol5M]0R^DOX;[S7RU6[G8KO/UI9VO@TP6WD;\LEXRK`[IaU6_M9lJ>fGݚ���������~�~�~�~�~�}2Ol5M]0R^DOX;[S7RU6[G8KO/UI9VO@TP6WD;\LEXRK`[IaU6_M9lJ>fG7hR�x�x�x�x�w�w�w�w������������OjjDcqD]mBibCkdJYl?fw8drGfqEcoC`g5fa-`e2`b5T[6Oe=Oe1Ki&Jh"RY������������7:n4LX:PZ3H\*Gd;C_/Aa8K\?Lb.Qb'IQ+Oc,VZ-MO.OI4M?/[K7TF-YI3TH����	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+��	��cnyTc�ce�chvas�bw�_q�TY�aW�SWr^^yX\qa]rPXpN\sZVwUYxNadagePjb��	ٻ
+ڹڸڸڸڸڷڷڷڷڷڶڶڶڶڵڵڵڵڴڴڴڴڴڳ۳۳۳۲۲۲۲۱۱۱ڴ��[km�lsyv�mo{nk�gvcnyTc�ce�chvas�bw�_q�TY�aW�SWr^^yX\qa]rǮ۪۬۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܧܦܦܦܦܥܥܥܥܤۨ��Uas�bw�_q�TY�aW�SWr^^yX\qa]rPXpN\sZVwUYxNadagePjbM_aNv]Qsb\ed�xEܤݟݞݞݞݞݝݝݝݝݝݜݜݜݜݛݛݛݛݚݚݚܟBibCkdJYl?fw8drGfqEcoC`g5fa-`e2`b5T[6Oe=Oe1Ki&Jh"RY-Ub;Tg*Kl-Pm.9k:?g7:n4LX:PZ3H\*Gdܟޓޓޒޒޒޒޑޑޑޑܤ7TF-YIߐߐߏߏߏߏߎߎߎߎߍߍߍߍߌߌߌߌߌߋU\|M_jHfnQ^jJgnA_hJ_gA_nJfu=eh7^g3ih1Xb+GZ,Rf)Tf)H`3Lf2G`>Jd����������������ݝ)F\(Bd6JX@J]:XL/OU2VO&OS-KM9VR8ON)[B:TE7aO;RE?[O=WC<VF1]@ݚ��������~�~�~�~�}�})F\(Bd6JX@J]:XL/OU2VO&OS-KM9VR8ON)[B:TE7aO;RE?[O=WC<VF1]@,bU�x�x�x�x�w�w�w�w����������Fg{DuwCev<[m@TnAXq<cm;ad=`j;Xl>fm6[f:dd>fb4S]5Xc:\h ^[)VX'Ta����������������6AU2?T2IZ2Ba46R38]7J]=KS/JO*PW)MD4LL3KS7GP=MM-UC-[U*[J3T?+\@��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+��	��ck�^vz[g~]e~\c~Ya{Yk~TYqTf|MZvJdsO`uMauNaqU\pTWkMZlHOfOSgSc`ZbVKaTMg]Fci��	ٺ
+ڸڸڸڷڷڷڷڶڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲۲۱۱ں
+ik�dn|prxirmw�gn�ck�^vz[g~]e~\c~Ya{Yk~TYqTf|MZvJdsO`uMauNaqU\pTWkMZlڲ۪۫۫۫ܪܪܪܩܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥ۩�~[\c~Ya{Yk~TYqTf|MZvJdsO`uMauNaqU\pTWkMZlHOfOSgSc`ZbVKaTMg]FciK[\OdfUe_P_c~~AݞݞݞݞݝݝݝݝݜݜݜݜݛݛݛݛݛݚݚݚkvO@TnAXq<cm;ad=`j;Xl>fm6[f:dd>fb4S]5Xc:\h ^[)VX'Ta,N`&Rh3Rf5Tr+Og1Gl)Hi/Ji6AU2?TݙޓޓޓޒޒޒޒޒޑޑޑޑސސޖߐߏߏߏߏߎߎߎߎߎߍߍߍߍߌߌߌߌߋߋDcqD]mBibCkdJYl?fw8drGfqEcoC`g5fa-`e2`b5T[6Oe=Oe1Ki&Jh"RY-Ub����������������ݜ*Gd;C_/Aa8K\?Lb.Qb'IQ+Oc,VZ-MO.OI4M?/[K7TF-YI3TH0]G.^D!bEݚ�������~�~�~�~�~�}�}*Gd;C_/Aa8K\?Lb.Qb'IQ+Oc,VZ-MO.OI4M?/[K7TF-YI3TH0]G.^D!bE%NI�x�x�x�w�w�w�w�w����������FbvEo}8ew4`m5Un;`m@ha;_n7\j6fh4ce>Yj3^^4_a:\_?_W-[c%V]/Ug%Ji����������������<EY37M.?P,EU+<T/8U<SI4IH.SQ"MS+OR4SL2MV+LJ4FG1MJ4]Q/PV)UP#JG��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+��	oqzaf|dhv]o~WhsSf�]]tVckSUwQPoUayBYwNWvORyPSpCTwB]cKZkENoONfCQcJTbCYYEZXL]fJVWJNb��ٿ
+ڸڸڷڷڷڷڶڶڶڶڵڵڵڵڴڴڴڴڴڳ۳۳۳۲۲۲۲۱۱��Zk�ijmo�iq�or�oqzaf|dhv]o~WhsSf�]]tVckSUwQPoUayBYwNWvORyPSpCTwB]cKZkENoONfŬ۪۫ܪܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܧܦܦܦܦܥܥܥڲWhsSf�]]tVckSUwQPoUayBYwNWvORyPSpCTwB]cKZkENoONfCQcJTbCYYEZXL]fJVWJNbL\[OceUUfQmTVnXۨݞݝݝݝݝݝݜݜݜݜݛݛݛݛݚݚݚݚ4`m5Un;`m@ha;_n7\j6fh4ce>Yj3^^4_a:\_?_W-[c%V]/Ug%Ji/Pp,No#Oi.Op"Lb(E_)6_5;[ƟޓޓޓޓޓޒޒޒޒޑޑޑޑސސސߐߐߏߏߏߏߎߎߎߎߍߍߍߍߍߌߌߌߌߋߋCev<[m@TnAXq<cm;ad=`j;Xl>fm6[f:dd>fb4S]5Xc:\h ^[)VX'Ta,N`&Rh����������������ݜ2Ba46R38]7J]=KS/JO*PW)MD4LL3KS7GP=MM-UC-[U*[J3T?+\@-YK-XNݚ�������~�~�~�~�}�}�}2Ba46R38]7J]=KS/JO*PW)MD4LL3KS7GP=MM-UC-[U*[J3T?+\@-YK-XN'QL�x�x�x�w�w�w�w�v����������>bx:l{<lo:Xi>ev=ck6Xq,cz-eq3\l?ja;cm2Sd'Us6ak.fa3fe5W])W`��������������������.=X.;d4LT/MM1LI5TP6ZJ4VN%UPYR*YV+TM1]R2_V1^S+PI5_N3SI2EK��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+��
+ٿ
+��	��^mtQwsUjtad~ba~XbzP\jYknXWuHTyOTkMXpEY�NS�KapH\wDUoITbK\fINd;Tc?OjFP]DPcGTb@SY?QU@JaDTjJOc��	ڷڷڷڷڶڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۳۲۲۲۲۱Y{�[z�Zt�\t�fl�_i|^mtQwsUjtad~ba~XbzP\jYknXWuHTyOTkMXpEY�NS�KapH\wDUoITbK\fINd;Tc?OjFP]۪ܪܪܪܩܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܦܥܥ�~[ba~XbzP\jYknXWuHTyOTkMXpEY�NS�KapH\wDUoITbK\fINd;Tc?OjFP]DPcGTb@SY?QU@JaDTjJOcGV[LoaAjaHn\Ȫݝݝݝݝݜݜݜݜݜݛݛݛݛݚݚݚۥ:Xi>ev=ck6Xq,cz-eq3\l?ja;cm2Sd'Us6ak.fa3fe5W])W`!I^$OZ#Of%D`&Gc%Je,>X0D^ܧޔޓޓޓޓޒޒޒޒޒޑޑޑޑސސސߐߏߏߏߏߏߎߎߎߎߍߍߍߍߌߌߌߌߋߋߋ8ew4`m5Un;`m@ha;_n7\j6fh4ce>Yj3^^4_a:\_?_W-[c%V]/Ug%Ji/Pp,No����������������ݜ,EU+<T/8U<SI4IH.SQ"MS+OR4SL2MV+LJ4FG1MJ4]Q/PV)UP#JG3SH/QLݚ�����~�~�~�~�~�}�}�},EU+<T/8U<SI4IH.SQ"MS+OR4SL2MV+LJ4FG1MJ4]Q/PV)UP#JG3SH/QL2OV�x�x�x�w�w�w�w�v����������7ow:nz=mr8et;esB`z3\{6az6hz7We-`c/Sg-Z_7ai0Yk0bg)V](^\3YX��������������������/Q],Db1Q[<cP;SQ*UR6UI,RM']_#TZ$QN1Y^%Z[$SU*a["PQWU$KQ/KC��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+��	��\dXg�\fSv}^tuNjuRbpHXnS[qQYlD]sMdgB[u<Xu:KuLN~DSzAMs8DrEEjBNjMJ[?Qh>Pk:Pb4GgDSUGR^FQY8T]E^`@c\��	ڷڷڷڶڶڶڶڵڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲۱N��c|�Zo}Vw�]o�jq�\dXg�\fSv}^tuNjuRbpHXnS[qQYlD]sMdgB[u<Xu:KuLN~DSzAMs8DrEEjBNjMJ[?Qh>Pk:PbܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܧܦܦܦܦܥܥSv}^tuNjuRbpHXnS[qQYlD]sMdgB[u<Xu:KuLN~DSzAMs8DrEEjBNjMJ[?Qh>Pk:Pb4GgDSUGR^FQY8T]E^`@c\O_WLbYMsXMl^Ox[ݝݝݝݜݜݜݜݛݛݛݛݚݚݚݚŧ8et;esB`z3\{6az6hz7We-`c/Sg-Z_7ai0Yk0bg)V](^\3YX'Qh6Sc/Lb$Je%Lk#LZ*I\ܧޔޔޓޓޓޓޒޒޒޒޑޑޑޑޑސސߐߐߏߏߏߏߎߎߎߎߍߍߍߍߍߌߌߌߌߋߋߋ<lo:Xi>ev=ck6Xq,cz-eq3\l?ja;cm2Sd'Us6ak.fa3fe5W])W`!I^$OZ#Of����������������ݜ4LT/MM1LI5TP6ZJ4VN%UPYR*YV+TM1]R2_V1^S+PI5_N3SI2EK8LG8TVݚ�����~�~�~�~�}�}�}�}4LT/MM1LI5TP6ZJ4VN%UPYR*YV+TM1]R2_V1^S+PI5_N3SI2EK8LG8TV&QL�x�x�w�w�w�w�v�v����������<j}Gm|Ab�2f{8c}=dx0kl1_i.bo1Zu)Ss/Th'\h-[g0]b*Rd.Si'Wh4Ll��������������������+Sf-\a2[Z;ZX,YS8_R8\T)PT+ZQP\&VS!P_#RY!SO UVOTLH%DQ(EM��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+��	��\f{^dw^bw]bmXpuMhjOhhLhrPdmC[t;`oB[r5[s<Rw4Js4Ow<Ls?Tr=Fq=;mH@qOCcIO`ASg@Lb>Rb7NZ?Of>V]<Kd8cd>anC`^FS\��ٹ
+ڶڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۳۲۲۲۲AytUu�UrzQjtZxz[v�\f{^dw^bw]bmXpuMhjOhhLhrPdmC[t;`oB[r5[s<Rw4Js4Ow<Ls?Tr=Fq=;mH@qOCcIO`ASg@Lb>RbgoAܪܩܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܦܥ]bmXpuMhjOhhLhrPdmC[t;`oB[r5[s<Rw4Js4Ow<Ls?Tr=Fq=;mH@qOCcIO`ASg@Lb>Rb7NZ?Of>V]<Kd8cd>anC`^FS\HhMCdSP`UMdWH^VݝݜݜݜݜݜݛݛݛݛݚݚݚݚAb�2f{8c}=dx0kl1_i.bo1Zu)Ss/Th'\h-[g0]b*Rd.Si'Wh4Ll.Dd/K^2Q],Qb/Fl-Qhܧޔޔޓޓޓޓޒޒޒޒޒޑޑޑޑސސސߐߏߏߏߏߏߎߎߎߎߍߍߍߍߌߌߌߌߌߋߋߋ=mr8et;esB`z3\{6az6hz7We-`c/Sg-Z_7ai0Yk0bg)V](^\3YX'Qh6Sc/Lb����������������ݜ1Q[<cP;SQ*UR6UI,RM']_#TZ$QN1Y^%Z[$SU*a["PQWU$KQ/KC0O?.FCݙ�����~�~�~�~�}�}�}�}1Q[<cP;SQ*UR6UI,RM']_#TZ$QN1Y^%Z[$SU*a["PQWU$KQ/KC0O?.FC)ML�x�x�w�w�w�w�v�v����������?by1ov0dx/]�'Y�']~3au+\~6fy%^�el#Wq!ZtPg!Zo$Rl)Zn.Yu5Mk��������������������9Md)T`9X]:ZS1`O.bN6c[!eTTWNP#NYG_'ER'BbU\$ILXN"TU&HH��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+��	��St|cs�Vn}Um}PgGktQ[sCavK_vHVlLVsA_y3ex=X{@Nz<Uh=Ox6Co.Eq6Hc8H]:AbBEa>NhEQaDTY>RfCMc-Qd/TYNh.Xc<X_4Mc=UaIUR��	ڶڶڶڶڵڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲ڻ
+Mz�J|�Tnu^i�Wh�St|cs�Vn}Um}PgGktQ[sCavK_vHVlLVsA_y3ex=X{@Nz<Uh=Ox6Co.Eq6Hc8H]:AbBEa>NhEQaDTY>RfCMcڶܩܩܩܩܨܨܨܨܨܧܧܧܧܦܦܦܦܥUm}PgGktQ[sCavK_vHVlLVsA_y3ex=X{@Nz<Uh=Ox6Co.Eq6Hc8H]:AbBEa>NhEQaDTY>RfCMc-Qd/TYNh.Xc<X_4Mc=UaIURD^UB^VB]IH`H>^Rݜݜݜݜݛݛݛݛݛݚݚݚݚ0dx/]�'Y�']~3au+\~6fy%^�el#Wq!ZtPg!Zo$Rl)Zn.Yu5Mk(?],@c3J],Lg-@m!AjޔޔޔޓޓޓޓޒޒޒޒޑޑޑޑޑސސߐߐߏߏߏߏߎߎߎߎߎߍߍߍߍߌߌߌߌߋߋߋߋAb�2f{8c}=dx0kl1_i.bo1Zu)Ss/Th'\h-[g0]b*Rd.Si'Wh4Ll.Dd/K^2Q]����������������ݜ2[Z;ZX,YS8_R8\T)PT+ZQP\&VS!P_#RY!SO UVOTLH%DQ(EM5RM)LGݙ����~�~�~�~�}�}�}�}�}2[Z;ZX,YS8_R8\T)PT+ZQP\&VS!P_#RY!SO UVOTLH%DQ(EM5RM)LG2FR�x�w�w�w�w�w�v�v����������7c�3h�+f�,Yz%\�/\&Sq%Qs)Tu,en/mu'euXm"Pt%^d,Li0Rp(Wr2Vh��������������������3RX(Yb.aZ*YU(V[+V[,NJ*ZNNV RQJT<R?ZNZQLDRKPVS'UE��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+��OuzYlyWo{QpyTh|QdjUdiLaxNjsI^jTZoHUmAai;\o1_k6fp*Qh7Js5Vd3SiEDg<Bl<Ci>HfBVm:Vm5I]BS_?HT(Sf(Re!J]2Ol5M]0R^DOX;[S7RU��	ڶڶڶڵڵڵڵڴڴڴڴڴڳ۳۳۳۲۲۲ڵM�{QuS|tKtqMr�OuzYlyWo{QpyTh|QdjUdiLaxNjsI^jTZoHUmAai;\o1_k6fp*Qh7Js5Vd3SiEDg<Bl<Ci>HfBVm:Vm5I]BS_?HT(SfۭܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܦǭTh|QdjUdiLaxNjsI^jTZoHUmAai;\o1_k6fp*Qh7Js5Vd3SiEDg<Bl<Ci>HfBVm:Vm5I]BS_?HT(Sf(Re!J]2Ol5M]0R^DOX;[S7RU6[G8KO/UI9VOnq:ݜݜݜݛݛݛݛݚݚݚݚܞ+f�,Yz%\�/\&Sq%Qs)Tu,en/mu'euXm"Pt%^d,Li0Rp(Wr2Vh$Bm'@`"DV.;\5F]ݚޔޔޓޓޓޓޓޒޒޒޒޑޑޑޑސސސߐߏߏߏߏߏߎߎߎߎߍߍߍߍߌߌߌߌߌߋߋߋߋ0dx/]�'Y�']~3au+\~6fy%^�el#Wq!ZtPg!Zo$Rl)Zn.Yu5Mk(?],@c3J]����������������ݜ9X]:ZS1`O.bN6c[!eTTWNP#NYG_'ER'BbU\$ILXN"TU&HH(UK*QJݙ����~�~�~�~�}�}�}�}�|9X]:ZS1`O.bN6c[!eTTWNP#NYG_'ER'BbU\$ILXN"TU&HH(UK*QJ+BU�x�w�w�w�w�v�v�v����������4d�%e�1e�-ey#Sv,Qs#aq"^m-en+o{ vu!iq`o)Uq0^q [h,Xn.\d&Mq��������������������(Qc*]e#X^(Z^YSVW+LUWMNUWCMO<XMVLOGWMZ R[[X"RK��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+��Hs�WdtNlwKi~U\|M_jHfnQ^jJgnA_hJ_gA_nJfu=eh7^g3ih1Xb+GZ,Rf)Tf)H`3Lf2G`>Jd;PfAMj<Ps2Ce3Fd>C]-T^%LV3RZ)F\(Bd6JX@J]:XL/OU2VO��	ڶڵڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲Q�~W�|KpxP{{HzHs�WdtNlwKi~U\|M_jHfnQ^jJgnA_hJ_gA_nJfu=eh7^g3ih1Xb+GZ,Rf)Tf)H`3Lf2G`>Jd;PfAMj<Ps2Ce3Fd>C]-T^Zn>ܩܩܨܨܨܨܨܧܧܧܧܦܦܦܦۮU\|M_jHfnQ^jJgnA_hJ_gA_nJfu=eh7^g3ih1Xb+GZ,Rf)Tf)H`3Lf2G`>Jd;PfAMj<Ps2Ce3Fd>C]-T^%LV3RZ)F\(Bd6JX@J]:XL/OU2VO&OS-KM9VR8ON۬ݜݛݛݛݛݛݚݚݚݚ۪1e�-ey#Sv,Qs#aq"^m-en+o{ vu!iq`o)Uq0^q [h,Xn.\d&Mq1C`,Ld'Cc'DTfhEޔޔޔޓޓޓޓޒޒޒޒޑޑޑޑޑސސߐߐߏߏߏߏߎߎߎߎߎߍߍߍߍߌߌߌߌߋߋߋߋߋ+f�,Yz%\�/\&Sq%Qs)Tu,en/mu'euXm"Pt%^d,Li0Rp(Wr2Vh$Bm'@`"DV����������������ݜ.aZ*YU(V[+V[,NJ*ZNNV RQJT<R?ZNZQLDRKPVS'UE+RJ$RLݙ���~�~�~�~�~�}�}�}�}�|.aZ*YU(V[+V[,NJ*ZNNV RQJT<R?ZNZQLDRKPVS'UE+RJ$RL*LL�w�w�w�w�w�v�v�v����������.e�/p)l�*a{*dy%_sekeh ljik!cn$btbs-dv#ar+[xLmNk(Hh��������������������*Ug%b_ d`XUSW.Q]3Ib"S\SPUGRIORESNJ GWYNVS!QN]R��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��	Is}AxzOltNesOjjDcqD]mBibCkdJYl?fw8drGfqEcoC`g5fa-`e2`b5T[6Oe=Oe1Ki&Jh"RY-Ub;Tg*Kl-Pm.9k:?g7:n4LX:PZ3H\*Gd;C_/Aa8K\?Lb.Qb'IQ+Ocٸ
+ڵڵڵڵڴڴڴڴڴڳ۳۳۳۲۲۲ڸG�zOzlH�}BsxIs}AxzOltNesOjjDcqD]mBibCkdJYl?fw8drGfqEcoC`g5fa-`e2`b5T[6Oe=Oe1Ki&Jh"RY-Ub;Tg*Kl-Pm.9k:?g7:n4LX:PZ۱ܩܨܨܨܨܧܧܧܧܧܦܦܦܦOjjDcqD]mBibCkdJYl?fw8drGfqEcoC`g5fa-`e2`b5T[6Oe=Oe1Ki&Jh"RY-Ub;Tg*Kl-Pm.9k:?g7:n4LX:PZ3H\*Gd;C_/Aa8K\?Lb.Qb'IQ+Oc,VZ-MO.OI4M?ܡݛݛݛݛݚݚݚݚݚ۪)l�*a{*dy%_sekeh ljik!cn$btbs-dv#ar+[xLmNk(Hh,Mh)We+Mg$I\ݚޔޔޓޓޓޓޓޒޒޒޒޑޑޑޑސސސߐߐߏߏߏߏߎߎߎߎߍߍߍߍߍߌߌߌߌߋߋߋߋߊ1e�-ey#Sv,Qs#aq"^m-en+o{ vu!iq`o)Uq0^q [h,Xn.\d&Mq1C`,Ld'Cc����������������ݜ#X^(Z^YSVW+LUWMNUWCMO<XMVLOGWMZ R[[X"RK%QP/LPݙ���~�~�~�~�}�}�}�}�|�|#X^(Z^YSVW+LUWMNUWCMO<XMVLOGWMZ R[[X"RK%QP/LP(PI�w�w�w�w�v�v�v�v����������2o�0ev1cs!ex#j~_zhr b|%bxac_e]nbj\kbzRu&LvLuHt������������������	��$S`![Z[S&_O#SU+L_,Md*DZ$WM#LJHFZJVLMHLPNHCM"LSQO��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+��Ho�GqtNj{Fg{DuwCev<[m@TnAXq<cm;ad=`j;Xl>fm6[f:dd>fb4S]5Xc:\h ^[)VX'Ta,N`&Rh3Rf5Tr+Og1Gl)Hi/Ji6AU2?T2IZ2Ba46R38]7J]=KS/JO*PW)MD��ڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲KxzYqy\qy[nqHn~Ho�GqtNj{Fg{DuwCev<[m@TnAXq<cm;ad=`j;Xl>fm6[f:dd>fb4S]5Xc:\h ^[)VX'Ta,N`&Rh3Rf5Tr+Og1Gl)Hi/Ji6AU2?T2IZܩܨܨܨܨܧܧܧܧܦܦܦܦr�XDuwCev<[m@TnAXq<cm;ad=`j;Xl>fm6[f:dd>fb4S]5Xc:\h ^[)VX'Ta,N`&Rh3Rf5Tr+Og1Gl)Hi/Ji6AU2?T2IZ2Ba46R38]7J]=KS/JO*PW)MD4LL3KS7GP=MM-UCݛݛݛݛݚݚݚݚݙ0ev1cs!ex#j~_zhr b|%bxac_e]nbj\kbzRu&LvLuHt Yb&Nl"Eb'V`ޔޔޔޓޓޓޓޒޒޒܟܦܥܥܥܥܤܤܤܤܤܤܤܤܣܣܣܣܣޔߍߍߍߌߌߌߌߋߋߋߋߋߊ)l�*a{*dy%_sekeh ljik!cn$btbs-dv#ar+[xLmNk(Hh,Mh)We+Mg����������������ݜ d`XUSW.Q]3Ib"S\SPUGRIORESNJ GWYNVS!QN]R"PO$XOݙ��~�~�~�~�~�}�}�}�}�|�| d`XUSW.Q]3Ib"S\SPUGRIORESNJ GWYNVS!QN]R"PO$XO HO�w�w�w�w�v�v�v�v����������,hw"cz-]v jv#fh#bx]k ghcn ag_e\qXnXu[oNmRj\qPd������������������	��$WP_Q `K!Z_#ZQKWDU#PRHQQVMO^IPK#AHHE>MAREQ#ZI��	��	��	��	��	��	��
+��
+��
+��
+��
+��Nl�GowFb|Fj|FbvEo}8ew4`m5Un;`m@ha;_n7\j6fh4ce>Yj3^^4_a:\_?_W-[c%V]/Ug%Ji/Pp,No#Oi.Op"Lb(E_)6_5;[<EY37M.?P,EU+<T/8U<SI4IH.SQ"MS+OR4SLٽ
+ڵڵڴڴڴڴڴڳ۳۳۳۲۲۲ڸR}�[yxUo~QrxNl�GowFb|Fj|FbvEo}8ew4`m5Un;`m@ha;_n7\j6fh4ce>Yj3^^4_a:\_?_W-[c%V]/Ug%Ji/Pp,No#Oi.Op"Lb(E_)6_5;[<EY37M.?P۬ܨܨܨܧܧܧܧܧܦܦܦ۪FbvEo}8ew4`m5Un;`m@ha;_n7\j6fh4ce>Yj3^^4_a:\_?_W-[c%V]/Ug%Ji/Pp,No#Oi.Op"Lb(E_)6_5;[<EY37M.?P,EU+<T/8U<SI4IH.SQ"MS+OR4SL2MV+LJ4FG1MJۦݛݛݚݚݚݚݚݙ"cz-]v jv#fh#bx]k ghcn ag_e\qXnXu[oNmRj\qPdXk#Qk UiZoEޔޔޔޓޓޓޓޒޒޒ#ZQKWDU#PRHQQVMO^IPK#AHHE>MAREQ#ZI!LUNOYN#T[KTޔߍߍߌߌߌߌߋߋߋߋߊߊ1cs!ex#j~_zhr b|%bxac_e]nbj\kbzRu&LvLuHt Yb&Nl"Eb����������������ݜ[S&_O#SU+L_,Md*DZ$WM#LJHFZJVLMHLPNHCM"LSQOYC%NVݙ��~�~�~�~�}�}�}�}�}�|�|[S&_O#SU+L_,Md*DZ$WM#LJHFZJVLMHLPNHCM"LSQOYC%NVRZ�w�w�w�v�v�v�v�v����������n�$hzaq'dxjc]]#Vi([nWfSoWk%^s^rdn]oRcVcesZk����������������	��	��$OPQL]R U\$WRQV%WE%VEMRTWORNH%VN!TE MC"CHMVNK RJ��	��	��	��	��	��
+��
+��
+��
+��
+��	Niy?i�Ii�?f�?n�>bx:l{<lo:Xi>ev=ck6Xq,cz-eq3\l?ja;cm2Sd'Us6ak.fa3fe5W])W`!I^$OZ#Of%D`&Gc%Je,>X0D^.BW68W.=X.;d4LT/MM1LI5TP6ZJ4VN%UPYR*YV��ڵڵڴڴڴڴڳڳ۳۳۳۲۲۲M}zX�qR�xJnvNiy?i�Ii�?f�?n�>bx:l{<lo:Xi>ev=ck6Xq,cz-eq3\l?ja;cm2Sd'Us6ak.fa3fe5W])W`!I^$OZ#Of%D`&Gc%Je,>X0D^.BW68W.=X.;dem=ܨܨܨܧܧܧܧܦܦܦܦm�b>bx:l{<lo:Xi>ev=ck6Xq,cz-eq3\l?ja;cm2Sd'Us6ak.fa3fe5W])W`!I^$OZ#Of%D`&Gc%Je,>X0D^.BW68W.=X.;d4LT/MM1LI5TP6ZJ4VN%UPYR*YV+TM1]R2_V1^S+PIݛݛݚݚݚݚݙݙ$hzaq'dxjc]]#Vi([nWfSoWk%^s^rdn]oRcVcesZkLnZ]\jܧޔޔޓޓޓޓޒޒޒޒ$WRQV%WE%VEMRTWORNH%VN!TE MC"CHMVNK RJEOJ[RUJ]HQM\ߍߌߌߌߌߋߋߋߋߋߊߊ-]v jv#fh#bx]k ghcn ag_e\qXnXu[oNmRj\qPdXk#Qk Ui����������������ݜ `K!Z_#ZQKWDU#PRHQQVMO^IPK#AHHE>MAREQ#ZI!LUNOݙ�~�~�~�~�~�}�}�}�}�|�|�| `K!Z_#ZQKWDU#PRHQQVMO^IPK#AHHE>MAREQ#ZI!LUNOYN�w�w�w�v�v�v�v�v����������^t"_seebj%jZ\c"Tc]b(Q[ Qb#QoUd!Zf#WvQc P_Zi]uQg����������������	��	��PIXS%WV/[M)\P-YM'Q?)LD!SOJK#HH'JC&MH(^= OITPDRPV$IV��	��	��	��	��	��
+��
+��
+��
+��
+��	Jux8i�An�:d�<c�7ow:nz=mr8et;esB`z3\{6az6hz7We-`c/Sg-Z_7ai0Yk0bg)V](^\3YX'Qh6Sc/Lb$Je%Lk#LZ*I\-4R/5[1HW/Q],Db1Q[<cP;SQ*UR6UI,RM']_#TZ$QN1Y^ٺ
+ڵڴڴڴڴڳڳ۳۳۲۲۲۲Nv�Ez}Lyw@t}Jux8i�An�:d�<c�7ow:nz=mr8et;esB`z3\{6az6hz7We-`c/Sg-Z_7ai0Yk0bg)V](^\3YX'Qh6Sc/Lb$Je%Lk#LZ*I\-4R/5[1HW/Q],Db1Q[ܨܨܨܧܧܧܧܦܦܦ۪<c�7ow:nz=mr8et;esB`z3\{6az6hz7We-`c/Sg-Z_7ai0Yk0bg)V](^\3YX'Qh6Sc/Lb$Je%Lk#LZ*I\-4R/5[1HW/Q],Db1Q[<cP;SQ*UR6UI,RM']_#TZ$QN1Y^%Z[$SU*a["PQۦݚݚݚݚݚݙݙ"_seebj%jZ\c"Tc]b(Q[ Qb#QoUd!Zf#WvQc P_Zi]uQg[^^gOcܠޔޔޓޓޓޓޒޒޒޒ)\P-YM'Q?)LD!SOJK#HH'JC&MH(^= OITPDRPV$IVFS=U =P8Y!:XANĝߌߌߌߌߋߋߋߋߊߊߊaq'dxjc]]#Vi([nWfSoWk%^s^rdn]oRcVcesZkLnZ]\j����������������ݜ]R U\$WRQV%WE%VEMRTWORNH%VN!TE MC"CHMVNK RJEOJ[ݙ�~�~�~�~�}�}�}�}�}�|�|�|]R U\$WRQV%WE%VEMRTWORNH%VN!TE MC"CHMVNK RJEOJ[RU�w�w�v�v�v�v�v�v����������_uSnYp_cSqabRc&Yb+Xk&Kf!Qn+NoQm,OiQh'HoTmLwLj����������������	��	��QM]T!U['SY'RN)XQWG\MPA'E<#GB!GF&LGNU GS'DR)PO%PS CW��	��	��	��	��	��
+��
+��
+��
+��
+��9p�5o�2e�4`�:a�<j}Gm|Ab�2f{8c}=dx0kl1_i.bo1Zu)Ss/Th'\h-[g0]b*Rd.Si'Wh4Ll.Dd/K^2Q],Qb/Fl-Qh(=\4DU/?Y2Oh+Sf-\a2[Z;ZX,YS8_R8\T)PT+ZQP\&VS!P_��	ڴڴڴڴڳڳ۳۳۳۲۲۲ڻ
+Duz?lz;y<rw9p�5o�2e�4`�:a�<j}Gm|Ab�2f{8c}=dx0kl1_i.bo1Zu)Ss/Th'\h-[g0]b*Rd.Si'Wh4Ll.Dd/K^2Q],Qb/Fl-Qh(=\4DU/?Y2Oh+Sf-\a2[Z۰ܨܧܧܧܧܦܦܦܦĬ:a�<j}Gm|Ab�2f{8c}=dx0kl1_i.bo1Zu)Ss/Th'\h-[g0]b*Rd.Si'Wh4Ll.Dd/K^2Q],Qb/Fl-Qh(=\4DU/?Y2Oh+Sf-\a2[Z;ZX,YS8_R8\T)PT+ZQP\&VS!P_#RY!SO UVOTLHݚݚݚݚݙݙݙSnYp_cSqabRc&Yb+Xk&Kf!Qn+NoQm,OiQh'HoTmLwLjKoPeSfޔޔޓޓޓޓޒޒޒޒޒ'RN)XQWG\MPA'E<#GB!GF&LGNU GS'DR)PO%PS CW%=U%:V%7R=LHHEQ$@Mޓߌߌߌߋߋߋߋߊߊߊeebj%jZ\c"Tc]b(Q[ Qb#QoUd!Zf#WvQc P_Zi]uQg[^^gOc����������������ݜ%WV/[M)\P-YM'Q?)LD!SOJK#HH'JC&MH(^= OITPDRPV$IVFS=Uݙ�~�~�~�~�}�}�}�}�|�|�|�|%WV/[M)\P-YM'Q?)LD!SOJK#HH'JC&MH(^= OITPDRPV$IVFS=U =P�w�w�v�v�v�v�v�v����������]rUqDm!NiTiQhTe%Q\%ZiSoNf#Op%Ml'Pg!QlKo LrQqPg��������������	��	��	�� J]UVQ^OW!FX&OL-QJ%GKHH"FBFOBM AP'IP"BN?XE]!@b%I_��	��	��	��	��
+��
+��
+��
+��
+��	Eu�Ey�>p�2k�;\�Ag�?by1ov0dx/]�'Y�']~3au+\~6fy%^�el#Wq!ZtPg!Zo$Rl)Zn.Yu5Mk(?],@c3J],Lg-@m!Aj1Ig/Fb(Pk/Pc9Md)T`9X]:ZS1`O.bN6c[!eTTWNP#NYG_'ERٶڴڴڴڳڳ۳۳۲۲۲۲s�WI}u:rx7wEu�Ey�>p�2k�;\�Ag�?by1ov0dx/]�'Y�']~3au+\~6fy%^�el#Wq!ZtPg!Zo$Rl)Zn.Yu5Mk(?],@c3J],Lg-@m!Aj1Ig/Fb(Pk/Pc9Md)T`9X]Ŭܨܧܧܧܧܦܦܦܦ;\�Ag�?by1ov0dx/]�'Y�']~3au+\~6fy%^�el#Wq!ZtPg!Zo$Rl)Zn.Yu5Mk(?],@c3J],Lg-@m!Aj1Ig/Fb(Pk/Pc9Md)T`9X]:ZS1`O.bN6c[!eTTWNP#NYG_'ER'BbU\$ILXNݚݚݚݚݙݙݙUqDm!NiTiQhTe%Q\%ZiSoNf#Op%Ml'Pg!QlKo LrQqPg#QaXn Kaݚޔޓޓޓޓޒޒޒޒޑ!FX&OL-QJ%GKHH"FBFOBM AP'IP"BN?XE]!@b%I_0;W#:[BM0QH)EN!AdOb]h?ߌߌߋߋߋߋߊߊߊߊYp_cSqabRc&Yb+Xk&Kf!Qn+NoQm,OiQh'HoTmLwLjKoPeSf����������������ݜ!U['SY'RN)XQWG\MPA'E<#GB!GF&LGNU GS'DR)PO%PS CW%=U%:Vݘ�~�~�~�}�}�}�}�}�|�|�|�|!U['SY'RN)XQWG\MPA'E<#GB!GF&LGNU GS'DR)PO%PS CW%=U%:V%7R�w�w�v�v�v�v�v�v����������#H�Y{Cy TwOiIfQlIvPqHrQpHr#Nr O_ Bi'CyQ{ Ql&Fw��������������	��	��	��"XYVU!SK%CU'H]0CU0FO#GJ(FU(GO&>S8_FT!>LBN!:WBN)>Y0?_��	��	��	��	��
+��
+��
+��
+��
+��C��Ay�>o�2b�:s�;f�7c�3h�+f�,Yz%\�/\&Sq%Qs)Tu,en/mu'euXm"Pt%^d,Li0Rp(Wr2Vh$Bm'@`"DV.;\5F]*Je5Me0Ed2Qf7V_3RX(Yb.aZ*YU(V[+V[,NJ*ZNNV RQJT<R?Zټ
+ڴڴڴڳ۳۳۳۲۲۲۲?v�8p�;t}?u�C��Ay�>o�2b�:s�;f�7c�3h�+f�,Yz%\�/\&Sq%Qs)Tu,enڴۭگ��%^d,Li0Rp(Wr2Vh$Bm'@`"DV.;\5F]*Je5Me0Ed2Qf7V_3RX(Yb.aZ*YUܧܧܧܧܧܦܦܦ۪:s�;f�7c�3h�+f�,Yz%\�/\&Sq%Qs)Tu,en/mu'euXm"Pt%^d,Li0Rp(Wr2Vh$Bm'@`"DV.;\5F]*Je5Me0Ed2Qf7V_3RX(Yb.aZ*YU(V[+V[,NJ*ZNNV RQJT<R?ZNZQLDRKP۫ݚݚݙݙݙݙY{Cy TwOiIfQlIvPqHrQpHr#Nr O_ Bi'CyQ{ Ql&Fw%Mc%PoIqܧޓޓޓޓޓޒޒޒޒޑ'H]0CU0FO#GJ(FU(GO&>S8_FT!>LBN!:WBN)>Y0?_%@\1BW'GV)DP3QX!E[SZ'EWޓߌߋߋߋߋߊߊߊߊDm!NiTiQhTe%Q\%ZiSoNf#Op%Ml'Pg!QlKo LrQqPg#QaXn Ka����������������ݜQ^OW!FX&OL-QJ%GKHH"FBFOBM AP'IP"BN?XE]!@b%I_0;W#:[ݘ�~�~�~�}�}�}�}�|�|�|�|�|Q^OW!FX&OL-QJ%GKHH"FBFOBM AP'IP"BN?XE]!@b%I_0;W#:[BM�w�v�v�v�v�v�v�v����������)Jx(Iu(JxCo!Op RjAn#LuImHsH}BFk$Aj&Ky$?{">{%7|*7p������������	��	��	��	��EjNSGTL\Hd%<cGe 9^ <W"6U8`$6a8[(B])5`.GP,DcAb.F\��	��	��	��
+��
+��
+��
+��
+��
+��.��0�~9v)m�9o�9h�4d�%e�1e�-ey#Sv,Qs#aq"^m-en+o{ vu!iq`o)Uq0^q����	��
+��
+��	��'Cc'DT5H^6GR5Tb,Tg1La%VX(Qc*]e#X^(Z^YSVW+LUWMNUWCMO<XMV��	ڴڴڳڳ۳۳۲۲۲۲۲;x9y=~9|w.��0�~9v)m�9o�9h�4d�%e�1e�-ey#Sv,Qs#aq"^m-enڰۭ۬۬۬bzQ [h,Xn.\d&Mq1C`,Ld'Cc'DT5H^6GR5Tb,Tg1La%VX(Qc*]e#X^(Z^ܧܧܧܧܦܦܦܦڲ9o�9h�4d�%e�1e�-ey#Sv,Qs#aq"^m-en+o{ vu!iq`o)Uq0^q [h,Xn.\d&Mq۪ݠݠݠݟܤ5Tb,Tg1La%VX(Qc*]e#X^(Z^YSVW+LUWMNUWCMO<XMVLOGWMZ R[[Xݚݚݙݙݙޙܪ(JxCo!Op RjAn#LuImHsH}BFk$Aj&Ky$?{">{%7|*7p CuCoJlܧޓޓޓޓޒޒޒޒޑޑHd%<cGe 9^ <W"6U8`$6a8[(B])5`.GP,DcAb.F\'E\'>^#8XJd-Nh(GdKaESUi@ߋߋߋߋߋߊߊߊߊCy TwOiIfQlIvPqHrQpHr#Nr O_ Bi'CyQ{ Ql&Fw%Mc%PoIq����������������ݜ!SK%CU'H]0CU0FO#GJ(FU(GO&>S8_FT!>LBN!:WBN)>Y0?_%@\1BWޘ�~�~�~�}�}�}�}�|�|�|�|�{!SK%CU'H]0CU0FO#GJ(FU(GO&>S8_FT!>LBN!:WBN)>Y0?_%@\1BW'GV�w�v�v�v�v�v�v�v����������*Ov(Tv-CrBgRgDc'?n$NvLm"As>r;|Cu;rG(D}#C{>r!@q������������	��	��	��	��KhEZGZHlI]"AgAg!Ca8`=S.T *]!.X%9i*:X3D^%Hg"Be!8a��	��	��	��
+��
+��
+��
+��
+��
++q/x�5t�)v~-u�2g�5g�.e�/p)l�*a{*dy%_sekeh ljik!cn$btbs����
+ںںںںڹڹ��	$I\(KQ.Q^)V\)NW,TS)Of*Ug%b_ d`XUSW.Q]3Ib"S\SPUGRIORES��ڴڴڳ۳۳۳۲۲۲۲۱/t+r�4rx+q/x�5t�)v~-u�2g�5g�.e�/p)l�*a{*dy%_sekeh��ۭۭ۬۬۬گ+[xLmNk(Hh,Mh)We+Mg$I\(KQ.Q^)V\)NW,TS)Of*Ug%b_ d`XUܧܧܧܧܦܦܦܦ`�_2g�5g�.e�/p)l�*a{*dy%_sekeh ljik!cn$btbs-dv#ar+[xLmNkݠݠݠݠݠݟݟݟۮ,TS)Of*Ug%b_ d`XUSW.Q]3Ib"S\SPUGRIORESNJ GWYNVS!QNݚݚݙݙݙޙܪ-CrBgRgDc'?n$NvLm"As>r;|Cu;rG(D}#C{>r!@q=n/@tApQdPޓޓޓޓޒޒޒޒޑޑI]"AgAg!Ca8`=S.T *]!.X%9i*:X3D^%Hg"Be!8a)DZ*@[/Kc$?d*Rh,L`SVF_RYߋߋߋߋߊߊߊߊ߉(JxCo!Op RjAn#LuImHsH}BFk$Aj&Ky$?{">{%7|*7p CuCoJl����������������ݜGTL\Hd%<cGe 9^ <W"6U8`$6a8[(B])5`.GP,DcAb.F\'E\'>^ޘ�~�~�}�}�}�}�|�|�|�|�|�{GTL\Hd%<cGe 9^ <W"6U8`$6a8[(B])5`.GP,DcAb.F\'E\'>^#8X�v�v�v�v�v�v�v�v����������*Gs*ImGtIjDmHl9v)B� <{&6s$.v;vAo/w"8n6x7o8o;s����������	��	��	��	��	��MiKdA^J`FjIe2W8W:[3Y4T2a2X)2S85W/@T+EW-DZ#3a��	��	��
+��
+��
+��
+��
+��
+��
+)ms pv2{z"m�&k�(w�/j�2o�0ev1cs!ex#j~_zhr b|%bxac_e]n��ٽ
+ںںںںڹڹڹڹ��
+#LT&UN*YN!UT"UY&Z[$S`![Z[S&_O#SU+L_,Md*DZ$WM#LJHFZJVLMHڴڳڳ۳۳۳۲۲۲۲۱.v�$y}"tt)ms pv2{z"m�&k�(w�/j�2o�0ev1cs!ex#j~_zhr b|ڸۭ۬۬۬۬۬Ru&LvLuHt Yb&Nl"Eb'V`#LT&UN*YN!UT"UY&Z[$S`![Z[S&_Oܧܧܧܦܦܦܦܥ&k�(w�/j�2o�0ev1cs!ex#j~_zhr b|%bxac_e]nbj\kbzRu&Lvݡݠݠݠݠݟݟݟݟݟۮ&Z[$S`![Z[S&_O#SU+L_,Md*DZ$WM#LJHFZJVLMHLPNHCM"LSݚݙݙݙݙޘܣGtIjDmHl9v)B� <{&6s$.v;vAo/w"8n6x7o8o;s(6w)<o)Dv6uޓޓޓޒޒޒޒޒޑޑFjIe2W8W:[3Y4T2a2X)2S85W/@T+EW-DZ#3a D^(>^"LTH]CcEZ#A\%R]OXܡߋߋߋߊߊߊߊ߉-CrBgRgDc'?n$NvLm"As>r;|Cu;rG(D}#C{>r!@q=n/@tAp����������������ݜGZHlI]"AgAg!Ca8`=S.T *]!.X%9i*:X3D^%Hg"Be!8a)DZ*@[ޘ�~�~�}�}�}�}�|�|�|�|�{�{GZHlI]"AgAg!Ca8`=S.T *]!.X%9i*:X3D^%Hg"Be!8a)DZ*@[/Kc�v�v�v�v�v�v�v�v����������)Bs%Ij&HiEo"BoEk%6u%>q&:m5i2j<o1w%8l!@m-j%4r6p&0}����������	��	��	��	��	��F_GfAkElAf=Z!@b;`8e4Y<U9R!4P+?W#CT*@R7:R)<M&FX��	��	��
+��
+��
+��
+��
+��
+��	)q{ uuo�%m�!s�"w�$n�,hw"cz-]v jv#fh#bx]k ghcn ag_e\qٽ	ڻںںںںڹڹڹڹڸ��	"[`'a[TJ"VTb[$WP_Q `K!Z_#ZQKWDU#PRHQQVMO^IPK#AHٶڳ۳۳۳۲۲۲۲۱۱#t~&vt!ss)q{ uuo�%m�!s�"w�$n�,hw"cz-]v jv#fh#bx]k ghۭۭ۬۬۬۬۫NmRj\qPdXk#Qk Ui#S_ N\"[`'a[TJ"VTb[$WP_Q `K!Z_۫ܧܧܦܦܦܦܥ!s�"w�$n�,hw"cz-]v jv#fh#bx]k ghcn ag_e\qXnXu[oNm۪ݡݠݠݠݠݟݟݟݟݞݞb[$WP_Q `K!Z_#ZQKWDU#PRHQQVMO^IPK#AHHE>MAREQܟݙݙݙޙޘޘ&HiEo"BoEk%6u%>q&:m5i2j<o1w%8l!@m-j%4r6p&0}!5v%7�$6r(;tݙޓޓޒޒޒޒޑޑޑAf=Z!@b;`8e4Y<U9R!4P+?W#CT*@R7:R)<M&FX(LY'@^CQAI(BW$K\RT P[(XTZs;ߋߋߊߊߊߊߊ߉GtIjDmHl9v)B� <{&6s$.v;vAo/w"8n6x7o8o;s(6w)<o)Dv����������������ݜA^J`FjIe2W8W:[3Y4T2a2X)2S85W/@T+EW-DZ#3a D^(>^ޘ�~�}�}�}�}�}�|�|�|�|�{�{A^J`FjIe2W8W:[3Y4T2a2X)2S85W/@T+EW-DZ#3a D^(>^"LT�v�v�v�v�v�v�v�v����������)Bn$Df&Jr:r9p!?i ?n H`$Fi8oB\=iDb#Fg ?f 8e&0r7l!6r��������	��	��	��	��	��	��8g6c;e(Cm@nBl;lDq'1f'.W:R1R6\!3L%<[);Z86H*?W3=_��	��	��
+��
+��
+��
+��
+��
+��	 pv)+w{!h�_�#b�,h�n�$hzaq'dxjc]]#Vi([nWfSoWk��ڻ
+ںںںںڹڹڹڹڹڸٺ
+$Vg`QQTQO#SL$OPQL]R U\$WRQV%WE%VEMRTWORNH%VN!TEټ
+ڳ۳۳۳۲۲۲۲۱۱||)yu+q~ pv)+w{!h�_�#b�,h�n�$hzaq'dxjc]]#Vi([nۭ۬۬۬۬۬۫RcVcesZkLnZ]\jXeRf$Vg`QQTQO#SL$OPQL]R U\ڴܧܦܦܦܦܦܥ_�#b�,h�n�$hzaq'dxjc]]#Vi([nWfSoWk%^s^rdn]oRcݡݠݠݠݠݟݟݟݟݟݞݞۮ$OPQL]R U\$WRQV%WE%VEMRTWORNH%VN!TE MC"CHMVNK۪ݙݙݙޙޘޘ&Jr:r9p!?i ?n H`$Fi8oB\=iDb#Fg ?f 8e&0r7l!6r&5u-s$-p*4kĝޓޒޒޒޒޒޑޑޑ@nBl;lDq'1f'.W:R1R6\!3L%<[);Z86H*?W3=_!Gf K\F\(H^*CT4BW3Ge*LV&PT.SRߋߋߊߊߊߊ߉߉&HiEo"BoEk%6u%>q&:m5i2j<o1w%8l!@m-j%4r6p&0}!5v%7�$6r����������������ݛAkElAf=Z!@b;`8e4Y<U9R!4P+?W#CT*@R7:R)<M&FX(LY'@^ޘ�~�}�}�}�}�|�|�|�|�{�{�{AkElAf=Z!@b;`8e4Y<U9R!4P+?W#CT*@R7:R)<M&FX(LY'@^CQ�v�v�v�v�v�v�v�v����������?p@m>k!As2w:h2f=e3iBY7`7a=W4^9`3_ 5e/3c'0p��������	��	��	��	��	��	��"9k7f7e7b4i;o#6o%4u,>b)=d+9f25["4Y*,_&&P04Q06K62U6HV��	��
+��
+��
+��
+��
+��
+ٿ
+��	'�e�`�_�.`�3hz#bs^t"_seebj%jZ\c"Tc]b(Q[ Qb#Qoٿ	ڻںںںںڹڹڹڹڸڸڸ��S^(UR!YVIMPIXS%WV/[M)\P-YM'Q?)LD!SOJK#HH'JC&MH(^=ټ
+ڳ۳۳۲۲۲۲۱۱۱5o}-ow s|'�e�`�_�.`�3hz#bs^t"_seebj%jZ\c"Tc]bۭ۬۬۬۬۫۫ P_Zi]uQg[^^gOc&XW_VY`S^(UR!YVIMPIXS%WV/[Mڴܧܦܦܦܦܥܥ.`�3hz#bs^t"_seebj%jZ\c"Tc]b(Q[ Qb#QoUd!Zf#WvQc P_ݡݠݠݠݠݟݟݟݟݞݞݞݞPIXS%WV/[M)\P-YM'Q?)LD!SOJK#HH'JC&MH(^= OITPDRPV۪ݙݙޙޘޘޘMbM!As2w:h2f=e3iBY7`7a=W4^9`3_ 5e/3c'0p#m4_!0o",i0vޓޒޒޒޒޑޑޑޑ4i;o#6o%4u,>b)=d+9f25["4Y*,_&&P04Q06K62U6HV-@M)P]1QV"K`&IV5D`*Be)IZ.IR/=Vߋߊߊߊߊߊ߉߉&Jr:r9p!?i ?n H`$Fi8oB\=iDb#Fg ?f 8e&0r7l!6r&5u-s$-p����������������ݛ;e(Cm@nBl;lDq'1f'.W:R1R6\!3L%<[);Z86H*?W3=_!Gf K\ޘ�}�}�}�}�}�|�|�|�|�{�{�{;e(Cm@nBl;lDq'1f'.W:R1R6\!3L%<[);Z86H*?W3=_!Gf K\F\�v�v�v�v�v�v�v�v����������=h 9m7l:[&Ad8Z7^4X7i2f'j.e4]1[6T0_'1`.h'_��������	��	��	��	��	��	��$=j!9l2g7k6r-w$+t(3v&9u,0u,.i!;d(3`18c%9_,4T15Z6=S%@Q��	��
+��
+��
+��
+��
+��
+ٿ
+��	e(Y�"X�%^{,e~#U}_{_uSnYp_cSqabRc&Yb+Xk&Kf!Qnڻ
+ںںںںںڹڹڹڹڸڸڸ��	*ZO%^[[UNIQM]T!U['SY'RN)XQWG\MPA'E<#GB!GF&LGNUټ
+۳۳۳۲۲۲۲۱۱۱/ds-s}$re(Y�"X�%^{,e~#U}_{_uSnYp_cSqabRc&Ybۭ۬۬۬۬۫۫'HoTmLwLjKoPeSf\_QaR[*ZO%^[[UNIQM]T!U['SYڴܦܦܦܦܦܥܥ,e~#U}_{_uSnYp_cSqabRc&Yb+Xk&Kf!Qn+NoQm,OiQh'HoݠݠݠݠݠݟݟݟݟݞݞݞݞQM]T!U['SY'RN)XQWG\MPA'E<#GB!GF&LGNU GS'DR)PO%PS۪ݙݙޙޘޘޘܪ:[&Ad8Z7^4X7i2f'j.e4]1[6T0_'1`.h'_(*Zk!'g1i#6nœޒޒޒޒޑޑޑޑ6r-w$+t(3v&9u,0u,.i!;d(3`18c%9_,4T15Z6=S%@Q.>Y+QV,M_3@W3IW&=`*GQ+FY4AL6>Qݙߊߊߊߊ߉߉߉>k!As2w:h2f=e3iBY7`7a=W4^9`3_ 5e/3c'0p#m4_!0o����������������ݛ7e7b4i;o#6o%4u,>b)=d+9f25["4Y*,_&&P04Q06K62U6HV-@M)P]ޘ�}�}�}�}�|�|�|�|�|�{�{�{7e7b4i;o#6o%4u,>b)=d+9f25["4Y*,_&&P04Q06K62U6HV-@M)P]1QV�v�v�v�v�v�v�v�v����������8e;k?d"2W1b!6_3i4b/h6d#d.d>b6k,e ,j4^0jl������	��	��	��	��	��	��	��*1g)-m&3p%<u?g$/r#1a/j)0s.5w >m"Iw(>e,4f/Bh-=f:P$:R F\��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+��	"`l-`wZ{*_{#\}!WxM}]rUqDm!NiTiQhTe%Q\%ZiSoNfڻںںںںڹڹڹڹڸڸڸڸٿ
+NOJ`RVMW J]UVQ^OW!FX&OL-QJ%GKHH"FBFOBM AP'IPټ
+۳۳۲۲۲۲۲۱۱۱)jd&ZuWq"`l-`wZ{*_{#\}!WxM}]rUqDm!NiTiQhTe%Q\۬۬۬۬۫۫۫Ko LrQqPg#QaXn KaH^D`UbNOJ`RVMW J]UVQ^OWڴܦܦܦܦܥܥܥ#\}!WxM}]rUqDm!NiTiQhTe%Q\%ZiSoNf#Op%Ml'Pg!QlKoݠݠݠݠݟݟݟݟݞݞݞݞݞ J]UVQ^OW!FX&OL-QJ%GKHH"FBFOBM AP'IP"BN?XE]!@b۪ݙޙޘޘޘޘޘ"2W1b!6_3i4b/h6d#d.d>b6k,e ,j4^0jl'_l,a%._&1u,.mݘޒޒޑޑޑޑޑ?g$/r#1a/j)0s.5w >m"Iw(>e,4f/Bh-=f:P$:R F\>SIY%;^+6V*:c+Ee%JW1FS2?R0ATܡߊߊߊߊ߉߉߉7l:[&Ad8Z7^4X7i2f'j.e4]1[6T0_'1`.h'_(*Zk!'g����������������ݛ2g7k6r-w$+t(3v&9u,0u,.i!;d(3`18c%9_,4T15Z6=S%@Q.>Y+QVޘ�}�}�}�}�|�|�|�|�{�{�{�{2g7k6r-w$+t(3v&9u,0u,.i!;d(3`18c%9_,4T15Z6=S%@Q.>Y+QV,M_�v�v�v�v�v�v�v�v����������
+/_=g=i%2\-?c",b/d*^'i/k-.m5h6r'i%k+j"] $f&d������	��	��	��	��	��	��	��!*m"/q3l9f@d9i7g"4]%+y#=i"Dm$7c)>g,>c+<q5Y&;c8W5Q��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+��	-\k)\o<[u.`x1[�.U�/\�#H�Y{Cy TwOiIfQlIvPqHrQpټ
+ںںںںڹڹڹڹڸڸڸڸپ
+RdOaUf&L`"XYVU!SK%CU'H]0CU0FO#GJ(FU(GO&>S8_FT!>Lڼ
+۳۳۲۲۲۲۱۱۱۱[iWr$Yn-\k)\o<[u.`x1[�.U�/\�#H�Y{Cy TwOiIfQlIv۬۬۬۬۫۫۫'CyQ{ Ql&Fw%Mc%PoIqQnNbQaRdOaUf&L`"XYVU!SK%CUڴܦܦܦܦܥܥܥ1[�.U�/\�#H�Y{Cy TwOiIfQlIvPqHrQpHr#Nr O_ Bi'Cyܥݠݠݠݟݟݟݟݞݞݞݞۭ"XYVU!SK%CU'H]0CU0FO#GJ(FU(GO&>S8_FT!>LBN!:WBN)>Y۪ݙޙޘޘޘޘޗ%2\-?c",b/d*^'i/k-.m5h6r'i%k+j"] $f&d%`1\-g$+g)&il*pޒޒޑޑޑޑސ9i7g"4]%+y#=i"Dm$7c)>g,>c+<q5Y&;c8W5Q HQ(>['?e*;Z%;`)@k&@h3:`/ER<CRܠߊߊߊ߉߉߉߉?d"2W1b!6_3i4b/h6d#d.d>b6k,e ,j4^0jl'_l,aޔ��������������^SO&3p%<u?g$/r#1a/j)0s.5w >m"Iw(>e,4f/Bh-=f:P$:R F\>SIYޘ�}�}�}�|�|�|�|�|�{�{�{�{&3p%<u?g$/r#1a/j)0s.5w >m"Iw(>e,4f/Bh-=f:P$:R F\>SIY%;^�v�v�v�v�v�v�v�v����������<n2e-_"4n"$j#'o"l&s$%j*2c$0m5_/p(p/g" d$h2o)_����	��	��	��	��	��	��	��	��!&^*f0i1e7i.n1_)d+c1p!6rCg"3a;j8jBk =f!Aa&>U��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+)Xo0^s,Yv*Wv/]x:Q|2V�)Jx(Iu(JxCo!Op RjAn#LuImHsH}��	ںںںڹڹڹڹڹڸڸڸڸپ
+!DZ%QbHgNdEjNSGTL\Hd%<cGe 9^ <W"6U8`$6a8[(B]ڼ
+۳۲۲۲۲۲۱۱۱۱%ZjWt0Ys)Xo0^s,Yv*Wv/]x:Q|2V�)Jx(Iu(JxCo!Op RjAn#Lu۬۬۬۬۫۫۫$?{">{%7|*7p CuCoJlGnFeHe!DZ%QbHgNdEjNSGTL\ڳܦܦܦܥܥܥܥ/]x:Q|2V�)Jx(Iu(JxCo!Op RjAn#LuImHsH}BFk$Aj&Ky$?{¤ݠݠݟݟݟݟݟݞݞݞݞNdEjNSGTL\Hd%<cGe 9^ <W"6U8`$6a8[(B])5`.GP,DcAbܞޙޘޘޘޘޘޗß"$j#'o"l&s$%j*2c$0m5_/p(p/g" d$h2o)_e
+"c^-c-],f)k(fޑޑޑޑޑސސߐߐߏߏߏߏޕ"3a;j8jBk =f!Aa&>U%,^&:V1:f+3Y$:_#9h9A]';\,>O*DTܠߊߊߊ߉߉߉߉=i%2\-?c",b/d*^'i/k-.m5h6r'i%k+j"] $f&d%`1\-g[QK��������������"/q3l9f@d9i7g"4]%+y#=i"Dm$7c)>g,>c+<q5Y&;c8W5Q HQ(>[ޘ�}�}�}�|�|�|�|�{�{�{�{�z3l9f@d9i7g"4]%+y#=i"Dm$7c)>g,>c+<q5Y&;c8W5Q HQ(>['?e�v�v�v�v�v�v�v�v����������5k+b#l+juuu!y(u-g +q)u'k'gk&!k(j(b#k����	��	��	��	��	��	��	��	��2f4e 'n"*m-r)+o++Z'n(/h1k <c4g4^HiHd7c"Hk9^$=[��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+��2Tx5Jm1Mw5`x:Nw0Nt*Ov(Tv-CrBgRgDc'?n$NvLm"As>r��ںںںڹڹڹڹڸڸڸڸڷپ
+ CoCi"DfP`KhEZGZHlI]"AgAg!Ca8`=S.T *]!.X%9iڼ
+۳۲۲۲۲۱۱۱۱۱[d$Qs&Wz)Tn2Tx5Jm1Mw5`x:Nw0Nt*Ov(Tv-CrBgRgDc'?n$Nv۬۬۬۫۫۫۫(D}#C{>r!@q=n/@tApBo#Be Jn CoCi"DfP`KhEZGZHlڳܦܦܦܥܥܥܥ5`x:Nw0Nt*Ov(Tv-CrBgRgDc'?n$NvLm"As>r;|Cu;rG(D}#C{ܥݠݟݟݟݟݞݞݞݞ¤P`KhEZGZHlI]"AgAg!Ca8`=S.T *]!.X%9i*:X3D^%Hg"Beݙޙޘޘޘޘޗޗޗuuu!y(u-g +q)u'k'gk&!k(j(b#k`YW$b	,b%m e#h)^ݗޑޑސސސߐߐߏߏߏߏߎ4^HiHd7c"Hk9^$=['5\)5g3>e)7]13V6C[9EY(A\5AS*>Uܠߊߊ߉߉߉߉߉-_"4n"$j#'o"l&s$%j*2c$0m5_/p(p/g" d$h2o)_e
+"c^-cߋ����������Ò*f0i1e7i.n1_)d+c1p!6rCg"3a;j8jBk =f!Aa&>U%,^&:Vޘ�}�}�|�|�|�|�|�{�{�{�{�z0i1e7i.n1_)d+c1p!6rCg"3a;j8jBk =f!Aa&>U%,^&:V1:f�v�v�v�v�v�v�v�v����������$i"+k%rp	(�#xsl mg.s,{#v(i fc%f^"c����	��	��	��	��	��	��	��	��'`%a$h +e(e-'^!e%/_ 2m!0l;g
+7m;o*r6j8b!@e%@l':p��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+��'Os!Pt"Kv+Sx*Ku+Ly*Gs*ImGtIjDmHl9v)B� <{&6s$.v;v��	ںڹڹڹڹڹڸڸڸڸڷپ
+8xHv>iMgMiKdA^J`FjIe2W8W:[3Y4T2a2X)2Sڼ
+۳۲۲۲۲۱۱۱۱۰!_d^vfx"Wz'Os!Pt"Kv+Sx*Ku+Ly*Gs*ImGtIjDmHl9v)B�۬۬۬۫۫۫۫6x7o8o;s(6w)<o)Dv6uAk 3o8xHv>iMgMiKdA^J`ڳܦܦܦܥܥܥܥڲ*Ku+Ly*Gs*ImGtIjDmHl9v)B� <{&6s$.v;vAo/w"8n6x7o8oܤݟݟݟݟݞݞݞ��>iMgMiKdA^J`FjIe2W8W:[3Y4T2a2X)2S85W/@T+EW-DZݙޘޘޘޘޘޗޗޗHR^#xsl mg.s,{#v(i fc%f^"c"g-j
+(_0l4`$^#o$h(n.h��ޑސސߐߐߏߏߏߏߏߎ;o*r6j8b!@e%@l':p&2g#4h'7d,0[)<a:`"=[Jc"D^,?Wݘߊߊ߉߉߉߉߈•+juuu!y(u-g +q)u'k'gk&!k(j(b#k`YW$b	,b������ߊJUE2f4e 'n"*m-r)+o++Z'n(/h1k <c4g4^HiHd7c"Hk9^$=['5\)5g���}�}�|�|�|�|�{�{�{�{�{�z 'n"*m-r)+o++Z'n(/h1k <c4g4^HiHd7c"Hk9^$=['5\)5g3>e�v�v�v�v�v�v�v�v����������)n&)wq"tux"q'~&}#t-s!z
+/t%m"n+ln!jh����	��	��	��	��	��	��	��	��"a"g$n!$j''m%+^l)%l(4k!2y!3n2x,v-z2tCp<g;m%;k��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+��	-Tn0Pq-Fr%Gr2Bl)Jt)Bs%Ij&HiEo"BoEk%6u%>q&:m5i2j<o1w��	ڹڹڹڹڸڸڸڸٺ
+ڷپ
+=j <p5o H^F_GfAkElAf=Z!@b;`8e4Y<U9R!4P+?Wڼ
+۲۲۲۲۱۱۱۱۱۰Uj%Sj*Kr-Tv-Tn0Pq-Fr%Gr2Bl)Jt)Bs%Ij&HiEo"BoEk%6u%>q۬۬۫۫۫۫۫-j%4r6p&0}!5v%7�$6r(;t%=z<y=j <p5o H^F_GfAkElڳܦܦܥܥܥܥܤۭ2Bl)Jt)Bs%Ij&HiEo"BoEk%6u%>q&:m5i2j<o1w%8l!@m-j%4r6p&0}£ܤݟݞݞۮ=j <p5o H^F_GfAkElAf=Z!@b;`8e4Y<U9R!4P+?W#CT*@R7:R^`8ޙޘޘޘޘޗޗޗޗܣx"q'~&}#t-s!z
+/t%m"n+ln!jh
+lrg"e&q!p'dk!b#r"a"g��ݖߐߐߏߏߏߏߎܣ,v-z2tCp<g;m%;k&>o%Ae2l9^<b6b$H[!C`BR1eߊߊߊ߉߉߉߉߈ܟp	(�#xsl mg.s,{#v(i fc%f^"c"g-j
+(_0l4`$^#o$h(n.h'`%a$h +e(e-'^!e%/_ 2m!0l;g
+7m;o*r6j8b!@e%@l':p&2g#4h�}�}�}�|�|�|�|�{�{�{�{�z�z$h +e(e-'^!e%/_ 2m!0l;g
+7m;o*r6j8b!@e%@l':p&2g#4h'7d�v�v�v�v�v�v�v�v����������z*q(p$�&}#q1�z ~+|"�"})|,v#v'�{}v����	��	��	��	��	��	��	��	��ts.n"s!i! pi#q,s/t$v ~!/~3x4z"=kF`Bi)=o��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+ؿ	Hv,Fj'?q)9z'Eo"@h)Bn$Df&Jr:r9p!?i ?n H`$Fi8oB\=iDb#Fg����
+ڹڹڸٺ
+��	��پ
+ڷپ
+2z)7r!7m C`8g6c;e(Cm@nBl;lDq'1f'.W:R1R6\!3Lڼ
+۲۲۲۲۱۱۱۱۰۰)I|&C|,DoKzHv,Fj'?q)9z'Eo"@h)Bn$Df&Jr:r9p!?i ?n H`۪۬۬۫۫۫۫ 8e&0r7l!6r&5u-s$-p*4k+9{#,o2z)7r!7m C`8g6c;e(Cmڳܦܦܥܥܥܥܤܤ'Eo"@h)Bn$Df&Jr:r9p!?i ?n H`$Fi8oB\=iDb#Fg ?f 8e&0r7l!6r&5u-s$-p*4k+9{#,o2z)7r!7m C`8g6c;e(Cm@nBl;lDq'1f'.W:R1R6\!3L%<[);Z86Hۤޙޘޘޘޘޗޗޗޗޖ#q1�z ~+|"�"})|,v#v'�{}vzv	nw$igi !d%i&tts.n"s!i! piܤ��/t$v ~!/~3x4z"=kF`Bi)=oAs?k;k'+a!5^)>W!8Q$5Y":Z!3Yߊߊ߉߉߉߉߈߈ޏ"tux"q'~&}#t-s!z
+/t%m"n+ln!jh
+lrg"e&q!p'dk!b#r"a"g$n!$j''m%+^l)%l(4k!2y!3n2x,v-z2tCp<g;m%;k&>o%Ae�}�}�|�|�|�|�{�{�{�{�{�z�z$n!$j''m%+^l)%l(4k!2y!3n2x,v-z2tCp<g;m%;k&>o%Ae2l�v�v�v�v�v�v�v�v����������(v4j-o/v	 }*x's%x$�
+/�5s1�#�%�(v��#q�{����	��	��	��	��	��	��	��	��#{m }&x$s%t%o&u-} ,} %~.y'{)y:Dn8t8tEx��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+��Gm#:h!>n@pDl?p@m>k!As2w:h2f=e3iBY7`7a=W4^9`3_ 5e/3c'0p#m4_!0oپ
+ڷپ
+,u.z3t<l"9k7f7e7b4i;o#6o%4u,>b)=d+9f25["4Y*,_ڻ
+۲۲۲۲۱۱۱۱۰۰>{;BuFjCnGm#:h!>n@pDl?p@m>k!As2w:h2f=e۪۬۫۫۫۫۫3_ 5e/3c'0p#m4_!0o",i0v4y,u.z3t<l"9k7f7e7bڳܦܥܥܥܥܤܤܤQdPDl?p@m>k!As2w:h2f=e3iBY7`7a=W4^9`3_ 5e/3c'0p#m4_!0o",i0v4y,u.z3t<l"9k7f7e7b4i;o#6o%4u,>b)=d+9f25["4Y*,_&&P04Q06Kޙޘޘޘޘޗޗޗޗޗޖܢ's%x$�
+/�5s1�#�%�(v��#q�{urv}"}p&il$kt#{m }&x$s%t%o&u-} ,} %~.y'{)y:Dn8t8tEx >uAv<q1^%3\"4c#C_%:\*=X)5Tߊߊ߉߉߉߉߈߈߈$�&}#q1�z ~+|"�"})|,v#v'�{}vzv	nw$igi !d%i&tts.n"s!i! pi#q,s/t$v ~!/~3x4z"=kF`Bi)=oAsS^N�}�}�|�|�|�|�{�{�{�{�z�z�z.n"s!i! pi#q,s/t$v ~!/~3x4z"=kF`Bi)=oAs?k;k�v�v�v�v�v�v�v�v����������+o"u&m,r(w*p
++m3p6q*|2|0~$�&�'|	(j	!y	}�����	��	��	��	��	��	��	��	��/w#z#{{"x'n-m,y#�)}'�6�&�+�2qCm Ds@|!=p��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+��	M_>c=j!B\;i=h 9m7l:[&Ad8Z7^4X7i2f'j.e4]1[6T0_'1`.h'_(*Zk!'gپ
+ڷپ
++,v *q,f9j$=j!9l2g7k6r-w$+t(3v&9u,0u,.i!;d(3`18cڻ
+۲۲۲۱۱۱۱۰۰۰9p>{&ByOjKfM_>c=j!B\;i=h 9m7l:[&Ad8Z7^4X۪۬۫۫۫۫ܪ0_'1`.h'_(*Zk!'g1i#6n,p+,v *q,f9j$=j!9l2g7kڳܦܥܥܥܥܤܤܤۭ;i=h 9m7l:[&Ad8Z7^4X7i2f'j.e4]1[6T0_'1`.h'_(*Zk!'g1i#6n,p+,v *q,f9j$=j!9l2g7k6r-w$+t(3v&9u,0u,.i!;d(3`18c%9_,4Tc[Bޙޘޘޘޘޗޗޗޗޖޖޖ
++m3p6q*|2|0~$�&�'|	(j	!y	}�!z �!�ww#x$s*h!p$~/w#z#{{"x'n-m,y#�)}'�6�&�+�2qCm Ds@|!=pA~Ev3o9{(5j#5o%Af*<d)@]Úߊ߉߉߉߉߉߈߈߈ITU	 }*x's%x$�
+/�5s1�#�%�(v��#q�{urv}"}p&il$kt#{m }&x$s%t%o&u-} ,} %~.y'{)y:Dn8t8tEx >uޘ�}�|�|�|�|�|�{�{�{�{�z�z�z }&x$s%t%o&u-} ,} %~.y'{)y:Dn8t8tEx >uAv<q�v�v�v�v�v�v�v�v����������#%~-|)n".l1g+l!5z5w*�,�(�
++~���v%v~��|����	��	��	��	��	��	��	��	��)v(r%n#&zto$t$s0{,�)�!/}&�.~,sCn$5|5r;u��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+��Cc-@h?Y6Z8e;k?d"2W1b!6_3i4b/h6d#d.d>b6k,e ,j4^0jl'_l,aپ
+ڷپ
+!,n!,d4b6l*1g)-m&3p%<u?g$/r#1a/j)0s.5w >m"Iw(>e,4fڻ
+۲۲۲۱۱۱۱۰۰۰Gx"FuPtOq@jScCc-@h?Y6Z8e;k?d"2W1b!6_3i4b۪۫۫۫۫۫ܪ ,j4^0jl'_l,a%._&1u,.m!,n!,d4b6l*1g)-m&3p%<uڳܥܥܥܥܥܤܤܤܤ6Z8e;k?d"2W1b!6_3i4b/h6d#d.d>b6k,e ,j4^0jl'_l,a%._&1u,.m!,n!,d4b6l*1g)-m&3p%<u?g$/r#1a/j)0s.5w >m"Iw(>e,4f/Bh-=fݞޘޘޘޘޘޗޗޗޗޖޖޖݜ5w*�,�(�
++~���v%v~��|��"�%stq+v.z*p,v)v(r%n#&zto$t$s0{,�)�!/}&�.~,sCn$5|5r;u<u@x#.s8t)5o)4f*4u.<c!9iޑߊ߉߉߉߉߈߈߈߈ݖ(w*p
++m3p6q*|2|0~$�&�'|	(j	!y	}�!z �!�ww#x$s*h!p$~/w#z#{{"x'n-m,y#�)}'�6�&�+�2qCm Ds@|!=pA~�}�}�|�|�|�|�{�{�{�{�z�z�z�z#{{"x'n-m,y#�)}'�6�&�+�2qCm Ds@|!=pA~Ev3o�v�v�v�v�v�v�v�v����������#$q%{/|%&p)s3z1�-w1|%v0{-�
+(�	)�)�(|
+&xs����	��	��	��	��	��	��	��	�� $�.s#p'w| q'�&y({.|.z0z)z*})y7�&/} 2|1}��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+پ
+��	)N\B_)ImFf
+/_=g=i%2\-?c",b/d*^'i/k-.m5h6r'i%k+j"] $f&d%`1\-gپ
+ڷپ
+*p'm/h$(f!*m"/q3l9f@d9i7g"4]%+y#=i"Dm$7c)>g,>cڻ
+۲۲۱۱۱۱۱۰۰۰%Nt)Df>p*Ad.Lk+M^)N\B_)ImFf
+/_=g=i%2\-?c",b/d*^۪۫۫۫۫ܪܪ+j"] $f&d%`1\-g$+g)&il*p'm/h$(f!*m"/q3l9fڳܥܥܥܥܤܤܤܤܣ۬
+/_=g=i%2\-?c",b/d*^'i/k-.m5h6r'i%k+j"] $f&d%`1\-g$+g)&il*p'm/h$(f!*m"/q3l9f@d9i7g"4]%+y#=i"Dm$7c)>g,>c+<qU[Aޙޘޘޘޘޗޗޗޗޖޖޖޖޖ��1|%v0{-�
+(�	)�)�(|
+&xs	}|$||	x ~%�0�""� $�.s#p'w| q'�&y({.|.z0z)z*})y7�&/} 2|1}8t 5q'>u;l7h /l01h!;d'4`ߊ߉߉߉߉߉߈߈߈߈߇1g+l!5z5w*�,�(�
++~���v%v~��|��"�%stq+v.z*p,v)v(r%n#&zto$t$s0{,�)�!/}&�.~,sCn$5|5r;uQ\U�}�|�|�|�|�|�{�{�{�{�z�z�z�z%n#&zto$t$s0{,�)�!/}&�.~,sCn$5|5r;u<u@x#.s�v�v�v�v�v�v�v�v����������1z&{$1o*u4s2~2y*q+x't+q'|/x�+��+�$�
+�s�����	��	��	��	��	��	��	��	��0r+|*{'tx#�!�&�#�)}'�,q/r$m2q.{!9o 5y6n��
+ٿ
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+��?nEc<c<n2e-_"4n"$j#'o"l&s$%j*2c$0m5_/p(p/g" d$h2o)_e
+"c^پ
+ڷپ
+)k(f'f0^!&^*f0i1e7i.n1_)d+c1p!6rCg"3a;jڻ
+۲۲۱۱۱۱۰۰۰۰!Pb)Uf*Tj&Go)Jd.KgBg?nEc<c<n2e-_"4n"$j#'o"l&s۪۫۫۫۫ܪܪ" d$h2o)_e
+"c^-c-],f)k(f'f0^!&^*f0i1eڲܥܥܥܥܤܤܤܤܣܣ<n2e-_"4n"$j#'o"l&s$%j*2c$0m5_/p(p/g" d$h2o)_e
+"c^-c-],f)k(f'f0^!&^*f0i1e7i.n1_)d+c1p!6rCg"3a;j8jܞޘޘޘޘޘޗޗޗޗޖޖޖޖޕޕ+x't+q'|/x�+��+�$�
+�s���xw
+��%���&y&�#�)y0r+|*{'tx#�!�&�#�)}'�,q/r$m2q.{!9o 5y6n9j"@m+4p#)`8d7\/8m*7fܠߊ߉߉߉߉߈߈߈߈߈߇Õ3z1�-w1|%v0{-�
+(�	)�)�(|
+&xs	}|$||	x ~%�0�""� $�.s#p'w| q'�&y({.|.z0z)z*})y7�&/} 2|1}���}�|�|�|�|�{�{�{�{�{�z�z�z�z#p'w| q'�&y({.|.z0z)z*})y7�&/} 2|1}8t 5q'>u�v�v�v�v�v�v�v�v����������,j5x&j'w&k5r,s+j-q4o.e'q(�{���������	��	��	��	��	��	��	��	��,{'�)�#0y
+,�-y#�)}"v
+!y+t-|")x"/s&q.-j#3v8o��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+��	;s"4d8f5k+b#l+juuu!y(u-g +q)u'k'gk&!k(j(b#k`YWپ
+ڷپ
+ e#h)^1^2f4e 'n"*m-r)+o++Z'n(/h1k <c4g4^Hiڻ
+۲۱۱۱۱۱۰۰۰۰$E`)Ll!Gn%Kn(Bo!DuEr;s"4d8f5k+b#l+juuu!y۪۫۫۫ܪܪܪ&!k(j(b#k`YW$b	,b%m e#h)^1^2f4e 'n"*mڲܥܥܥܤܤܤܤܤܣܣ۬+b#l+juuu!y(u-g +q)u'k'gk&!k(j(b#k`YW$b	,b%m e#h)^1^2f4e 'n"*m-r)+o++Z'n(/h1k <c4g4^Hi��ޙޘޘޘޘޗޗޗޗޗޖޖޖޖޕޕݛ4o.e'q(�{������� �#��!�{!�~!},{'�)�#0y
+,�-y#�)}"v
+!y+t-|")x"/s&q.-j#3v8o%'-*p*-g&m 4a0a/_!2cߊߊ߉߉߉߉߈߈߈߈߇߇��2~2y*q+x't+q'|/x�+��+�$�
+�s���xw
+��%���&y&�#�)y0r+|*{'tx#�!�&�#�)}'�,q/r$m2q.{!9o 5y6n�}�|�|�|�|�|�{�{�{�{�z�z�z�z�y*{'tx#�!�&�#�)}'�,q/r$m2q.{!9o 5y6n9j"@m+4p�v�v�v�v�v�v�v�v����������5e3t3u8t1x7q4p1o1h6j3n3u2�+����	"�&�����	��	��	��	��	��	��	��	��$�-�+{-�&�"�!,�)�#�3p#r,~'#%�&v/x+*o*|#o��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+��),h3e$i"+k%rp	(�#xsl mg.s,{#v(i fc%f^"c"g-j
+(_پ
+ڶپ
+#o$h(n.h'`%a$h +e(e-'^!e%/_ 2m!0l;g
+7m;o*rڻ
+۲۱۱۱۱۰۰۰۰ۯ Es%Fg2PnB^IlFd4e'4e),h3e$i"+k%rp	(�#xsl۪۫۫۫ܪܪܪc%f^"c"g-j
+(_0l4`$^#o$h(n.h'`%a$h +eڲܥܥܥܤܤܤܤܣܣܣܣYUM%rp	(�#xsl mg.s,{#v(i fc%f^"c"g-j
+(_0l4`$^#o$h(n.h'`%a$h +e(e-'^!e%/_ 2m!0l;g
+7m;o*rݙޘޘޘޘޘޗޗޗޗޖޖޖޖޕޕޕޕܨ3n3u2�+����	"�&��%���&�$����!�$�-�+{-�&�"�!,�)�#�3p#r,~'#%�&v/x+*o*|#o )u!'f)(ko!n!+]%]ܠߊ߉߉߉߉߈߈߈߈߈߇����—,s+j-q4o.e'q(�{������� �#��!�{!�~!},{'�)�#0y
+,�-y#�)}"v
+!y+t-|")x"/s&q.-j#3v���}�|�|�|�|�{�{�{�{�{�z�z�z�z�y)�#0y
+,�-y#�)}"v
+!y+t-|")x"/s&q.-j#3v8o%'-*p*-g�v�v�v�v�v�v�v�v����������"<h7Z5c
+*a1[&e'o3i-s0s,}2s&�+uz~�������	��	��	��	��	��	��	��	��3�'�+��$�#"���*�!$s'*}!(s*x')u'3u|'|$| )lٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ؽ	��#6n)n&)wq"tux"q'~&}#t-s!z
+/t%m"n+ln!jh
+lrgپ
+ڶپ
+'dk!b#r"a"g$n!$j''m%+^l)%l(4k!2y!3n2x,v-zڻ
+۱۱۱۱۱۰۰۰۰ۯ+Mp)PhFc#>d(;b"?f#D_$1f%7q#6n)n&)wq"tux"q'~۫۫۫ܪܪܪܪ+ln!jh
+lrg"e&q!p'dk!b#r"a"g$n!$jڲܥܥܤܤܤܤܤܣܣܣܣܢq"tux"q'~&}#t-s!z
+/t%m"n+ln!jh
+lrg"e&q!p'dk!b#r"a"g$n!$j''m%+^l)%l(4k!2y!3n2x,vܞޙޘޘޘޘޗޗޗޗޗޖޖޖޖޕޕޕޕޔRTZ2s&�+uz~���!�(� � � �%�!�	��*�3�'�+��$�#"���*�!$s'*}!(s*x')u'3u|'|$| )l&*|*j'(n%g"%o#a$hߊߊ߉߉߉߉߈߈߈߈߇߇������4p1o1h6j3n3u2�+����	"�&��%���&�$����!�$�-�+{-�&�"�!,�)�#�3p#r,~'#%�&v/x+*oVOZ�}�}�|�|�|�|�{�{�{�{�z�z�z�z�z�y+{-�&�"�!,�)�#�3p#r,~'#%�&v/x+*o*|#o )u!'f)(k�v�v�v�v�v�v�v�v����������4a/t3m$j(m#-n"~%w#{3|/�#x1�/�#���������	��	��	��	��	��	��	��	��)�'��-�%$�"'�5�/�$"!�'+{ 'n$(v'*m#*l$&v%&e!l&rٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+��	%'wz*q(p$�&}#q1�z ~+|"�"})|,v#v'�{}vzv	nپ
+ڶپ
+i !d%i&tts.n"s!i! pi#q,s/t$v ~!/~3xڻ
+۱۱۱۱۰۰۰۰۰ۯ'Re?e$Ag(?gFZ2d!1c/j9i%'wz*q(p$�&}#q1�z۪۫۫ܪܪܪܩ'�{}vzv	nw$igi !d%i&tts.n"sڲܥܥܤܤܤܤܣܣܣܣܣܢۦ$�&}#q1�z ~+|"�"})|,v#v'�{}vzv	nw$igi !d%i&tts.n"s!i! pi#q,s/t$v ~۪ݙޙޘޘޘޘޗޗޗޗޖޖޖޖޖޕޕޕޕޔޔ#x1�/�#�����,�,�'�	*�*� �	*�,�-
+.�)�'��-�%$�"'�5�/�$"!�'+{ 'n$(v'*m#*l$&v%&e!l&r%r.!l&#v"-s".o+gޑߊ߉߉߉߉߈߈߈߈߈߇߇������ߍ3i-s0s,}2s&�+uz~���!�(� � � �%�!�	��*�3�'�+��$�#"���*�!$s'*}!(s*x')u'3u|'|�}�}�|�|�|�|�{�{�{�{�{�z�z�z�z�y�y+��$�#"���*�!$s'*}!(s*x')u'3u|'|$| )l&*|*j'(n�v�v�v�v�v�v�v�v����������.q0s&v#l*j!-x! ~"�)|+�(�+�!���"�������	��	��	��	��	��	��	��	��1�'�"*�.�(�/�#:�%%}&,x)"v$$n50v)4u8/s4(j #b*j-s)"mٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+��	(v4j-o/v	 }*x's%x$�
+/�5s1�#�%�(v��#q�{urvپ
+ڶپ
+&il$kt#{m }&x$s%t%o&u-} ,} %~.y'{)yڻ
+۱۱۱۱۰۰۰۰ۯۯ ?p%9h2a<Z9i3g3a4n/1x1�(v4j-o/v	 }*x's%x۪۫۫ܪܪܪܩ(v��#q�{urv}"}p&il$kt#{m }&xڲܥܥܤܤܤܤܣܣܣܣܢܢܢڰ	 }*x's%x$�
+/�5s1�#�%�(v��#q�{urv}"}p&il$kt#{m }&x$s%t%o&u-} ,} %~۪ݙޙޘޘޘޘޗޗޗޗޗޖޖޖޖޕޕޕޕޔޔޔޔ�!���"���(�#�-�&�,�
+-}#�.�2�1�1�'�"*�.�(�/�#:�%%}&,x)"v$$n50v)4u8/s4(j #b*j-s)"m3u)%j'"l(p&qܠߊߊ߉߉߉߉߈߈߈߈߇߇����������ݞ#{3|/�#x1�/�#�����,�,�'�	*�*� �	*�,�-
+.�)�'��-�%$�"'�5�/�$"!�'+{ 'n$(v'*m#*l$&v���}�}�|�|�|�|�{�{�{�{�z�z�z�z�z�y�y�-�%$�"'�5�/�$"!�'+{ 'n$(v'*m#*l$&v%&e!l&r%r.!l&#v�v�v�v�v�v�v�v�v����������,os$k)t*u)z#y%v�"�}�!����#�"�&�����	��	��	��	��	��	��	��	��*�,�#*� 7z4}*6x(5�#*~(*k-&o6(w4#~0,p;*l2"l) h43z5#w%&mٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+��	"u&m,r(w*p
++m3p6q*|2|0~$�&�'|	(j	!y	}�!z �!�پ
+ڶپ
+$s*h!p$~/w#z#{{"x'n-m,y#�)}'�6�&�+�ں
+۱۱۱۰۰۰۰۰ۯۯ>j3tGi7j5e.j6m0q+|$~+o"u&m,r(w*p
++m3p۪۫ܪܪܪܪܩ	(j	!y	}�!z �!�ww#x$s*h!p$~/w#z#{{ڲܥܤܤܤܤܣܣܣܣܣܢܢܢܢ۰*p
++m3p6q*|2|0~$�&�'|	(j	!y	}�!z �!�ww#x$s*h!p$~/w#z#{{"x'n-m,y#�)}۪ݙݙޙޘޘޘޘޗޗޗޗޖޖޖޖޖޕޕޕޕޔޔޔޔޓ���#�"�&����0~.}'�%�
+)�+� �*�,�#*� 7z4}*6x(5�#*~(*k-&o6(w4#~0,p;*l2"l) h43z5#w%&m2y0u "xtܠߊߊ߉߉߉߉߉߈߈߈߈߇߇������������ݞ+�(�+�!���"���(�#�-�&�,�
+-}#�.�2�1�1�'�"*�.�(�/�#:�%%}&,x)"v$$n50v)4u8/s4(jޘ�}�}�|�|�|�|�|�{�{�{�{�z�z�z�z�y�y�y"*�.�(�/�#:�%%}&,x)"v$$n50v)4u8/s4(j #b*j-s)"m3u)%j'"l�v�v�v�v�v�v�v�v����������&nm!mt &w).q)*�!{ ��%�'�&��"�%�'� �����	��	��	��	��	��	��	��	��,� )�%5�&2x$1|#8{*((5~+({!2+~  r+#o-#o2"u&"{7u'r*qٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+��	)n".l1g+l!5z5w*�,�(�
++~���v%v~��|��"�پ
+ڶپ
++v.z*p,v)v(r%n#&zto$t$s0{,�)�!/}&�.~ں
+۱۱۱۰۰۰۰ۯۯۯ7j:t>cAg3i0o+g0s(v"t#%~-|)n".l1g+l!5z5w۪۫ܪܪܪܩܩ%v~��|��"�%stq+v.z*p,v)v(r%n#&zڲܥܤܤܤܤܣܣܣܣܢܢܢܢܢݡ۰!5z5w*�,�(�
++~���v%v~��|��"�%stq+v.z*p,v)v(r%n#&zto$t$s0{۪ݙݙޙޘޘޘޘޘޗޗޗޗޖޖޖޖޕޕޕޕޕޔޔޔޔޓޓ��"�%�'� ���*�5�0�)�$�.�"�&�,� )�%5�&2x$1|#8{*((5~+({!2+~  r+#o-#o2"u&"{7u'r*q,%%(x(#jܠߊߊߊ߉߉߉߉߈߈߈߈߇߇����������������ݝ}�!����#�"�&����0~.}'�%�
+)�+� �*�,�#*� 7z4}*6x(5�#*~(*k-&o6(w4#~0,p;*lޘ�}�}�}�|�|�|�|�{�{�{�{�z�z�z�z�z�y�y�y#*� 7z4}*6x(5�#*~(*k-&o6(w4#~0,p;*l2"l) h43z5#w%&m2y0u "x�v�v�v�v�v�v�v�v����������"w!t mv'}%)�$%!'� �#��*�,�*�'�$�$�!�����	��	��	��	��	��	��	��	��-�/� 8�0?%5�-�%)z"(|##&.�)! �{(�!y# s0w"!w$(pٿ
+ٿ
+پ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ٿ	��)s3z1�-w1|%v0{-�
+(�	)�)�(|
+&xs	}|پ
+ڶپ
+ ~%�0�""� $�.s#p'w| q'�&y({.|.z0z)z*}ں
+۱۱۱۰۰۰۰ۯۯۯ$4r4q%@g =u=s:m3o3q0m#&n#$q%{/|%&p)s3z1�-w۪ܪܪܪܪܩܩ(|
+&xs	}|$||	x ~%�0�""� $�.s#p'wڲܤܤܤܤܣܣܣܣܣܢܢܢܢݡݡݡܥ-w1|%v0{-�
+(�	)�)�(|
+&xs	}|$||	x ~%�0�""� $�.s#p'w| q'�&yܟݙݙݙޙޘޘޘޘޗޗޗޗޖޖޖޖޖޕޕޕޕޔޔޔޔޓޓޓޓܟ$�$�!����"�-�*� ��*�4�-�/� 8�0?%5�-�%)z"(|##&.�)! �{(�!y# s0w"!w$(p.4|6-~ܠߊߊߊ߉߉߉߉߉߈߈߈߈߇߇������������������ݝ%�'�&��"�%�'� ���*�5�0�)�$�.�"�&�,� )�%5�&2x$1|#8{*((5~+({!2+~  r+#oޘ�}�}�}�|�|�|�|�|�{�{�{�{�z�z�z�z�y�y�y�y%5�&2x$1|#8{*((5~+({!2+~  r+#o-#o2"u&"{7u'r*q,%%(x(#j�v�v�v�v�v�v�v�v����������}
+xxtn%�&'�0�"�!+�-�%%�%$�$!�����(�����	��	��	��	��	��	��	��	��*�3�6�%;�)/�"*�(0�))�)�!������z } |�ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻټ
+��	2~2y*q+x't+q'|/x�+��+�$�
+�s���xwپ
+ڶپ
+&y&�#�)y0r+|*{'tx#�!�&�#�)}'�,q/r$mں
+۱۱۰۰۰۰ۯۯۯۯ@k<p!Ap!4p.h3e9i5s#'m&.q1z&{$1o*u4s2~2y*q۪ܪܪܪܩܩܩ$�
+�s���xw
+��%���&y&�#�)y0r+|*{'tڲܤܤܤܤܣܣܣܣܢܢܢܢܢݡݡݡݡݠIUV't+q'|/x�+��+�$�
+�s���xw
+��%���&y&�#�)y0r+|*{'tx#�KM\ݚݙݙݙݙޘޘޘޘޘޗޗޗޗޖޖޖޖޕޕޕޕޕޔޔޔޔޓޓޓޓޒݘ�(�� �� �(�(�
+�$�#�5�*�3�6�%;�)/�"*�(0�))�)�!������z } |�+"�ޒߊߊߊߊ߉߉߉߉߈߈߈߈߈߇����������������������ޕ*�,�*�'�$�$�!����"�-�*� ��*�4�-�/� 8�0?%5�-�%)z"(|##&.�)! �ޘ�}�}�}�}�|�|�|�|�{�{�{�{�{�z�z�z�z�y�y�y�y 8�0?%5�-�%)z"(|##&.�)! �{(�!y# s0w"!w$(p.4|6-~0r�v�v�v�v�v�v�v�v����������s"'{ym'(u%� �$�(�$#�*�&,�� ��!� ��&�����	��	��	��	��	��	��	��	��.�2�*�%!�!/�,�!�%�!�	"�!�&�"� �"�y-� �("ٿ
+پ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ڻںں��
+��+j-q4o.e'q(�{������� �پ
+ڶٽ
+{!�~!},{'�)�#0y
+,�-y#�)}"v
+!y+t-|")xں
+۱۱۰۰۰۰ۯۯۯۯ".e6f*Ao&6k8j 8j3o0r1n.n,j5x&j'w&k5r,s+jܪܪܪܪܩܩܩ������ �#��!�{!�~!},{'�)�#ڲܤܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݡݠݠ۪.e'q(�{������� �#��!�{!�~!},{'�)�#0yۥݚݚݙݙݙޙޘޘޘޘޗޗޗޗޗޖޖޖޖޕޕޕޕޔޔޔޔޓޓޓޓޓޒޒޒܟ�	%�!�
+!�*�!�
+"�� �(�.�2�*�%!�!/�,�!�%�!�	"�!�&�"� �"�y-� �]L[ߋߊߊߊߊߊ߉߉߉߉߈߈߈߈߇߇������������������������ߌ[Jq����(�� �� �(�(�
+�$�#�5�*�3�6�%;�)/�"*�(0�))�)�!�����}�}�}�}�|�|�|�|�|�{�{�{�{�z�z�z�z�y�y�y�y�y6�%;�)/�"*�(0�))�)�!������z } |�+"�/!w1&u�v�v�v�v�v�v�v�v����������#'p$u!$u&m)'w&,s*�'�(�,�!(�"*��+�!�*�&�������	��	��	��	��	��	��	��	��*�$�"�� ���%�$�&'�!(�!�!�+�+�0� 5ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ںںںںڹ��	��6j3n3u2�+����	"�&��%��پ
+ڶٽ
+���!�$�-�+{-�&�"�!,�)�#�3p#r,~'#%�ں
+۱۰۰۰۰۰ۯۯۯۯ#5q-i2h1d3r4r$+i.a6m6h5e3t3u8t1x7q4p1oܪܪܪܩܩܩܩ��	"�&��%���&�$����!�$�-�+{-�ڲܤܤܤܣܣܣܣܢܢܢܢܢݡݡݡݡݠݠݠݠݟ۩2�+����	"�&��%���&�$����!�$�-�+{ۥݚݚݚݙݙݙݙޙޘޘޘޘޗޗޗޗޖޖޖޖޕޕޕޕޕޔޔޔޔޓޓޓޓޒޒޒޒޒޑ��
+!��,�(�)�.�'��*�$�"�� ���%�$�&'�!(�!�!�+�UReޒߋߋߊߊߊߊ߉߉߉߉߈߈߈߈߈߇������������������������������ޔ!� ��&��	%�!�
+!�*�!�
+"�� �(�.�2�*�%!�!/�,�!�%�!�ޘ�~�~�}�}�}�}�|�|�|�|�{�{�{�{�{�z�z�z�z�y�y�y�y�x*�%!�!/�,�!�%�!�	"�!�&�"� �"�y-� �("-)x&&}#+��v�v�v�v�v�v�v�v����������������������������������������������������	��	��	��	��	��	��	��	����������������������������������������پ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹٽ
+��	��&�+uz~���!�(� �پ
+ڵٺ
+��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	ڷ۱۰۰۰۰ۯۯۯۯۮ)2c(+k<e$-`*-i19h(>^8`7e#?j"<h7Z5c
+*a1[&e'o3iܪܪܪܩܩܩܩ�����!�(� � � �%�!�	��*�3�'�+��ۭܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݡݠݠݠݠݟݟݟܤUKW~���!�(� � � �%�!�	��*���ܠݚݚݚݚݚݙݙݙޙޘޘޘޘޗޗޗޗޗޖޖޖޖޕޕޕޕޔޔޔޔޔޓޓޓޓޒޒޒޒޑޑޑޑܞNKo �(�"�'�������#�+�,���&���*�KNeޒߋߋߋߊߊߊߊߊ߉߉߉߉߈߈߈߈߇߇����������������������������������ޓSGp�$�.�
+!��,�(�)�.�'��*�$�"�� ���ݘ�~�~�~�}�}�}�}�}�|�|�|�|�{�{�{�{�z�z�z�z�z�y�y�y�y�x"�� ���%�$�&'�!(�!�!�+�+�0� 5)3|#-�*(��v�v�v�v�v�v�v�v����������������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ںںںںںڹڹڹڹڸڸٺ
+ٿ
+پ
+��	��	��	��	��	��	پ
+ٸ
+ڵڵڵڵڴڴڴڴڳڳ۳۳۳۲۲۲۲۱۱۱۱۰۰۰۰۰ۯۯۯۯۮۮۮۮۭۭۭۭۭ۪۬۬۬۬۫۫۫۫ܪܪܪܩܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܦܥܥܥܥܤܤܤܤܣܣܣܣܣܢܢܢܢݡݡݡݡݠݠݠݠݠݟݟݟݟݞݞݞۮۭ,�,�'�	*�*�NMb۬ۦݛݛݛݛݚݚݚݚݙݙݙݙޙޘޘޘޘޗޗޗޗޖޖޖޖޖޕޕޕޕޔޔޔޔޓޓޓޓޒޒޒޒޒޑޑޑޑސސސݝPNt"�$�& ���'� �����'��PJjݚߌߌߋߋߋߋߊߊߊߊ߉߉߉߉߉߈߈߈߈߇߇����������������������������������������ݛJIq!�*� � �(�"�'������ ߇��~�~�~�~�}�}�}�}�|�|�|�|�{�{�{�{�{�z�z�z�z�y�y�y�y�x�x�x�x�x�w�w�w�w�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v��������������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڸڸڸڸڸڷڷڷڷڶڶڶڶڵڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲۲۱۱۱۱۰۰۰۰ۯۯۯۯۮۮۮۮۮۭۭۭۭ۪۬۬۬۬۫۫۫۫۫ܪܪܪܩܩܩܩܨܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥܥܤܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݡݠݠݠݠݟݟݟݟݞݞݞݞݞݝݝݝݝݜݜݜݜݛݛݛݛݛݚݚݚݚݙݙݙޙޘޘޘޘޗޗޗޗޗޖޖޖޖޕޕޕޕޔޔޔޔޔޓޓޓޓޒޒޒޒޑޑޑޑޑސސߐߐߏߏߏߏݜܣܣܣܣܢܢߍߍߌߌߌߌߋߋߋߋߊߊߊߊߊ߉߉߉߉߈߈߈߈߇߇��������������������������������������������������߉ݚݚݚݚݚݚ�������~�~�~�~�}�}�}�}�}�|�|�|�|�{�{�{�{�z�z�z�z�z�y�y�y�y�x�x�x�x�w�w�w�w�w�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v��������������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ںںںںںڹڹڹڹڸڸڸڸڷڷڷڷڷڶڶڶڶڵڵڵڵڴڴڴڴڴڳ۳۳۳۲۲۲۲۱۱۱۱۰۰۰۰۰ۯۯۯۯۮۮۮۮۭۭۭۭۭ۪۬۬۬۬۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܦܥܥܥܥܤܤܤܤܣܣܣܣܣܢܢܢܢݡݡݡݡݠݠݠݠݠݟݟݟݟݞݞݞݞݝݝݝݝݝݜݜݜݜݛݛݛݛݚݚݚݚݙݙݙݙޙޘޘޘޘޗޗޗޗޖޖޖޖޖޕޕޕޕޔޔޔޔޓޓޓޓޓޒޒޒޒޑޑޑޑސސސߐߏߏߏߏߏߎߎߎߎߍߍߍߍߌߌߌߌߌߋߋߋߋߊߊߊߊ߉߉߉߉߉߈߈߈߈߇߇����������������������������������������������������������������������~�~�~�~�}�}�}�}�|�|�|�|�|�{�{�{�{�z�z�z�z�y�y�y�y�y�x�x�x�x�w�w�w�w�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v������������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڹڸڸڸڸڷڷڷڷڶڶڶڶڵڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲۲۱۱۱۱۰۰۰۰ۯۯۯۯۯۮۮۮۮۭۭۭۭ۪۬۬۬۬۬۫۫۫۫ܪܪܪܩܩܩܩܨܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥܥܤܤܤܤܣܣܣܣܢܢܢܢܢݡݡݡݡݠݠݠݠݟݟݟݟݞݞݞݞݞݝݝݝݝݜݜݜݜݛݛݛݛݛݚݚݚݚݙݙݙޙޘޘޘޘޘޗޗޗޗޖޖޖޖޕޕޕޕޕޔޔޔޔޓޓޓޓޒޒޒޒޑޑޑޑޑސސߐߐߏߏߏߏߎߎߎߎߎߍߍߍߍߌߌߌߌߋߋߋߋߋߊߊߊߊ߉߉߉߉߈߈߈߈߇߇�����������������������������������������������������������������������~�~�~�~�~�}�}�}�}�|�|�|�|�{�{�{�{�z�z�z�z�z�y�y�y�y�x�x�x�x�w�w�w�w�w�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v������������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڸڸڸڸڷڷڷڷڷڶڶڶڶڵڵڵڵڴڴڴڴڴڳ۳۳۳۲۲۲۲۱۱۱۱۱۰۰۰۰ۯۯۯۯۮۮۮۮۭۭۭۭۭ۪۬۬۬۬۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܧܦܦܦܦܥܥܥܥܤܤܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݠݠݠݠݠݟݟݟݟݞݞݞݞݝݝݝݝݝݜݜݜݜݛݛݛݛݚݚݚݚݚݙݙݙޙޘޘޘޘޗޗޗޗޖޖޖޖޖޕޕޕޕޔޔޔޔޓޓޓޓޓޒޒޒޒޑޑޑޑސސސߐߐߏߏߏߏߎߎߎߎߍߍߍߍߍߌߌߌߌߋߋߋߋߊߊߊߊ߉߉߉߉߉߈߈߈߈߇߇����������������������������������������������������������������������~�~�~�~�}�}�}�}�|�|�|�|�|�{�{�{�{�z�z�z�z�y�y�y�y�y�x�x�x�x�w�w�w�w�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v����������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڹڸڸڸڸڷڷڷڷڶڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۳۲۲۲۲۱۱۱۱۰۰۰۰ۯۯۯۯۯۮۮۮۮۭۭۭۭ۪۬۬۬۬۬۫۫۫۫ܪܪܪܩܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥܥܤܤܤܤܣܣܣܣܢܢܢܢܢݡݡݡݡݠݠݠݠݟݟݟݟݟݞݞݞݞݝݝݝݝݜݜݜݜݜݛݛݛݛݚݚݚݚݙݙݙݙޘޘޘޘޘޗޗޗޗޖޖޖޖޕޕޕޕޕޔޔޔޔޓޓޓޓޒޒޒޒޒޑޑޑޑސސߐߐߏߏߏߏߎߎߎߎߎߍߍߍߍߌߌߌߌߋߋߋߋߋߊߊߊߊ߉߉߉߉߈߈߈߈߈߇�����������������������������������������������������������������������~�~�~�~�~�}�}�}�}�|�|�|�|�{�{�{�{�{�z�z�z�z�y�y�y�y�x�x�x�x�w�w�w�w�w�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v����������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڸڸڸڸڸڷڷڷڷڶڶڶڶڵڵڵڵڴڴڴڴڴڳ۳۳۳۲۲۲۲۱۱۱۱۱۰۰۰۰ۯۯۯۯۮۮۮۮۮۭۭۭۭ۪۬۬۬۬۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܧܧܧܧܧܦܦܦܦܥܥܥܥܤܤܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݡݠݠݠݠݟݟݟݟݞݞݞݞݝݝݝݝݝݜݜݜݜݛݛݛݛݚݚݚݚݚݙݙݙޙޘޘޘޘޗޗޗޗޗޖޖޖޖޕޕޕޕޔޔޔޔޔޓޓޓޓޒޒޒޒޑޑޑޑސސސߐߐߏߏߏߏߎߎߎߎߍߍߍߍߍߌߌߌߌߋߋߋߋߊߊߊߊߊ߉߉߉߉߈߈߈߈߇߇�����������������������������������������������������������������������~�~�~�~�}�}�}�}�}�|�|�|�|�{�{�{�{�z�z�z�z�y�y�y�y�y�x�x�x�x�w�w�w�w�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v��������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ڼ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ںںںںڹڹڹڹڹڸڸڸڸڷڷڷڷڶڶڶڶڶڵڵڵڵڴڴڴڴڳڳ۳۳۳۲۲۲۲۱۱۱۱۰۰۰۰۰ۯۯۯۯۮۮۮۮۭۭۭۭ۪۬۬۬۬۬۫۫۫۫ܪܪܪܩܩܩܩܩܨܨܨܨܧܧܧܧܦܦܦܦܦܥܥܥܥܤܤܤܤܣܣܣܣܢܢܢܢܢݡݡݡݡݠݠݠݠݟݟݟݟݟݞݞݞݞݝݝݝݝݜݜݜݜݜݛݛݛݛݚݚݚݚݙݙݙݙޙޘޘޘޘޗޗޗޗޖޖޖޖޕޕޕޕޕޔޔޔޔޓޓޓޓޒޒޒޒޒޑޑޑޑސސސߐߏߏߏߏߏߎߎߎߎߍߍߍߍߌߌߌߌߌߋߋߋߋߊߊߊߊ߉߉߉߉߈߈߈߈߈߇�����������������������������������������������������������������������~�~�~�~�~�}�}�}�}�|�|�|�|�{�{�{�{�{�z�z�z�z�y�y�y�y�x�x�x�x�x�w�w�w�w�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v��������������������������	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��	��
+��
+��
+��
+��
+��
+ٿ
+ٿ
+ٿ
+ٿ
+ٿ
+پ
+پ
+پ
+پ
+ٽ
+ٽ
+ٽ
+ٽ
+ټ
+ټ
+ټ
+ڼ
+ڻ
+ڻ
+ڻ
+ڻ
+ڻںںںںڹڹڹڹڸڸڸڸڸڷڷڷڷڶڶڶڶڵڵڵڵڵڴڴڴڴڳڳ۳۳۲۲۲۲۱۱۱۱۱۰۰۰۰ۯۯۯۯۮۮۮۮۮۭۭۭۭ۬۬۬۬۫۫۫۫۫ܪܪܪܪܩܩܩܩܨܨܨܨܨܧܧܧܧܦܦܦܦܥܥܥܥܤܤܤܤܤܣܣܣܣܢܢܢܢݡݡݡݡݡݠݠݠݠݟݟݟݟݞݞݞݞݞݝݝݝݝݜݜݜݜݛݛݛݛݚݚݚݚݚݙݙݙޙޘޘޘޘޗޗޗޗޗޖޖޖޖޕޕޕޕޔޔޔޔޔޓޓޓޓޒޒޒޒޑޑޑޑޑސސߐߐߏߏߏߏߎߎߎߎߍߍߍߍߍߌߌߌߌߋߋߋߋߊߊߊߊߊ߉߉߉߉߈߈߈߈߇߇�����������������������������������������������������������������������~�~�~�~�}�}�}�}�}�|�|�|�|�{�{�{�{�z�z�z�z�z�y�y�y�y�x�x�x�x�w�w�w�w�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v�v
\ No newline at end of file
diff -urN lib/microwindows/src/demos/nanox/npanel.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/npanel.c
--- lib/microwindows/src/demos/nanox/npanel.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/npanel.c	2005-02-21 16:12:56.000000000 +0100
@@ -0,0 +1,378 @@
+/*
+ * nano-X launcher/window manager program
+ * (C) 1999 Alistair Riddoch <ajr@ecs.soton.ac.uk>
+ * (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+
+/*
+   Undefine this if solid window moves are incredibly slow on your hardware.
+   Unfortunately since outline moves are not supported yet, the only
+   alternative is "invisible" moving.
+*/ 
+#define SHOW_WINDOW_MOTION
+
+/*
+   Define this if you want the mouse pointer to become bell shaped when over
+   the launcher window.
+*/
+#undef USE_WEIRD_POINTER
+
+#include <stdio.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <stdlib.h>
+#include <unistd.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+/*
+ * Definitions to make it easy to define cursors
+ */
+#define	_	((unsigned) 0)		/* off bits */
+#define	X	((unsigned) 1)		/* on bits */
+#define	MASK(a,b,c,d,e,f,g) \
+	(((((((((((((a * 2) + b) * 2) + c) * 2) + d) * 2) \
+	+ e) * 2) + f) * 2) + g) << 9)
+
+#define DEC_HEIGHT 7
+#define IDLE_DELAY 100000
+
+static	GR_WINDOW_ID	w1;		/* id for launcher window */
+static	GR_GC_ID	gc;		/* graphics context for rectangle */
+static	GR_GC_ID	bgc;		/* graphics context for rectangle */
+static	GR_SCREEN_INFO	si;		/* information about screen */
+static	int		fwidth, fheight;
+static	int		fbase;
+static	int		num_apps = 0;
+
+void do_exposure();
+void do_buttondown();
+void do_buttonup();
+void do_update();
+void do_mouse();
+
+struct app_info {
+	char		app_id[10];
+	char		app_path[64];
+} Apps[] = {
+#if ELKS
+	{"clock", "/root/nclock"},
+	{"term", "/root/nterm"},
+	{"demo", "/root/demo"},
+	{"demo2", "/root/demo2"},
+#else
+	{"clock", "bin/nclock"},
+	{"term", "bin/nterm"},
+	{"demo", "bin/demo"},
+	{"demo2", "bin/demo2"},
+	{"ntest", "bin/ntest"},
+#endif
+	{"", ""}
+};
+
+typedef struct managed_window mwin;
+struct managed_window {
+	GR_WINDOW_ID	wid;	/* Application's window */
+	GR_WINDOW_ID	fid;	/* Title bar */
+	GR_COORD	x;	/* Overall window X origin */
+	GR_COORD	y;	/* Overall window Y origin */
+	GR_SIZE		width;	/* Overall width of window */
+	mwin		* next;
+};
+
+mwin * mwins = NULL;
+mwin * in_motion = NULL;
+GR_COORD	move_xoff;
+GR_COORD	move_yoff;
+
+/*
+ * Reap the dead children whenever we get a SIGCHLD.
+ */
+void reaper(int signum) { while(waitpid(WAIT_ANY, NULL, WNOHANG) > 0); }
+
+int
+main(int argc,char **argv)
+{
+	GR_EVENT	event;		/* current event */
+	struct app_info	* act;
+	int		width, height;
+
+#ifdef USE_WEIRD_POINTER
+	GR_BITMAP	bitmap1fg[7];	/* bitmaps for first cursor */
+	GR_BITMAP	bitmap1bg[7];
+#endif
+
+	for(act = Apps; act->app_id[0] != '\0'; act++, num_apps++);
+
+	if (GrOpen() < 0) {
+		fprintf(stderr, "cannot open graphics\n");
+		exit(1);
+	}
+	
+	GrGetScreenInfo(&si);
+
+	signal(SIGCHLD, &reaper);
+
+	gc = GrNewGC();
+	bgc = GrNewGC();
+
+	GrSetGCForeground(bgc, GRAY);
+	GrSetGCFont(gc, GrCreateFont(GR_FONT_OEM_FIXED, 0, NULL));
+
+	GrGetGCTextSize(gc, "A", 1, GR_TFASCII, &fwidth, &fheight, &fbase);
+	width = fwidth * 8 + 4;
+	height = (fheight) * num_apps + 4;
+
+	w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 5, 5, width,
+		height, 1, WHITE, BLACK);
+
+	GrSelectEvents(w1, GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_BUTTON_DOWN
+			| GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_EXPOSURE |
+					GR_EVENT_MASK_CHLD_UPDATE);
+
+	GrMapWindow(w1);
+
+#ifdef USE_WEIRD_POINTER
+	bitmap1bg[0] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[1] = MASK(_,X,X,X,X,X,_);
+	bitmap1bg[2] = MASK(_,X,X,X,X,X,_);
+	bitmap1bg[3] = MASK(_,X,X,X,X,X,_);
+	bitmap1bg[4] = MASK(_,X,X,X,X,X,_);
+	bitmap1bg[5] = MASK(_,X,X,X,X,X,_);
+	bitmap1bg[6] = MASK(X,X,X,X,X,X,X);
+
+	bitmap1fg[0] = MASK(_,_,_,_,_,_,_);
+	bitmap1fg[1] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[2] = MASK(_,_,X,X,X,_,_);
+	bitmap1fg[3] = MASK(_,_,X,X,X,_,_);
+	bitmap1fg[4] = MASK(_,_,X,X,X,_,_);
+	bitmap1fg[5] = MASK(_,_,X,X,X,_,_);
+	bitmap1fg[6] = MASK(_,X,X,X,X,X,_);
+
+	GrSetCursor(w1, 7, 7, 3, 3, WHITE, BLACK, bitmap1fg, bitmap1bg);
+#endif
+
+	GrFillRect(GR_ROOT_WINDOW_ID, bgc, 0, 0, si.cols, si.rows);
+
+	GrSetGCForeground(gc, BLACK);
+	GrSetGCBackground(gc, WHITE);
+
+	while (1) {
+		GrGetNextEvent(&event);
+
+		switch (event.type) {
+			case GR_EVENT_TYPE_EXPOSURE:
+				do_exposure(&event.exposure);
+				break;
+			case GR_EVENT_TYPE_BUTTON_DOWN:
+				do_buttondown(&event.button);
+				break;
+			case GR_EVENT_TYPE_BUTTON_UP:
+				do_buttonup(&event.button);
+				break;
+			case GR_EVENT_TYPE_UPDATE:
+				do_update(&event.update);
+				break;
+			case GR_EVENT_TYPE_MOUSE_POSITION:
+				do_mouse(&event.mouse);
+				break;
+			case GR_EVENT_TYPE_CLOSE_REQ:
+				GrClose();
+				exit(0);
+		}
+	}
+}
+
+mwin * IsDecoration(GR_WINDOW_ID wid)
+{
+	mwin * mwp;
+	for(mwp = mwins; mwp; mwp = mwp->next) {
+		if (mwp->fid == wid) {
+			return mwp;
+		}
+	}
+	return NULL;
+}
+	
+mwin * FindWindow(GR_WINDOW_ID wid)
+{
+	mwin * mwp;
+	for(mwp = mwins; mwp; mwp = mwp->next) {
+		if (mwp->wid == wid) {
+			return mwp;
+		}
+	}
+	return NULL;
+}
+
+mwin * NewWindow(GR_WINDOW_ID wid)
+{
+	mwin * mwp = malloc(sizeof(mwin));
+
+	if (mwp) {
+		mwp->wid = wid;
+		mwp->next = mwins;
+		mwins = mwp;
+	}
+	return mwp;
+}
+
+void
+do_update(ep)
+	GR_EVENT_UPDATE	*ep;
+{
+	mwin *	mwp;
+	mwin *	tmwp;
+	GR_WINDOW_INFO winfo;
+
+	if (IsDecoration(ep->wid)) return;
+
+	if ((mwp = FindWindow(ep->wid)) == NULL) {
+		/* We have a new window */
+		if (ep->utype != GR_UPDATE_MAP) return;
+		if ((mwp = NewWindow(ep->wid)) == NULL) {
+			printf("malloc failed\n");
+			return;
+		}
+		GrGetWindowInfo(ep->wid, &winfo);
+		mwp->x = ep->x - winfo.bordersize;
+		mwp->y = ep->y - winfo.bordersize;
+		mwp->width = ep->width + 2 * winfo.bordersize;
+		GrMoveWindow(mwp->wid, mwp->x + winfo.bordersize,
+					mwp->y + DEC_HEIGHT +
+						2 * winfo.bordersize);
+		mwp->fid = GrNewWindow(GR_ROOT_WINDOW_ID, mwp->x + 1,
+				mwp->y + 1, mwp->width - 2,
+				DEC_HEIGHT - 2, 1, BLUE, BLACK);
+		GrSelectEvents(mwp->fid, GR_EVENT_MASK_BUTTON_DOWN |
+			GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_MOUSE_POSITION);
+		GrMapWindow(mwp->fid);
+	} else {
+		switch (ep->utype) {
+			case GR_UPDATE_UNMAP:
+				GrUnmapWindow(mwp->fid);
+				GrDestroyWindow(mwp->fid);
+				if (mwins == mwp) {
+					mwins = mwp->next;
+				} else for(tmwp = mwins; tmwp; tmwp = tmwp->next) {
+					if (tmwp->next == mwp) {
+						tmwp->next = mwp->next;
+					}
+				}
+				free(mwp);
+				break;
+			case GR_UPDATE_MOVE:
+				GrGetWindowInfo(ep->wid, &winfo);
+				if ((ep->x == (mwp->x + winfo.bordersize)) &&
+					(ep->y == (mwp->y + winfo.bordersize
+							+ DEC_HEIGHT))) {
+					return;
+				}
+				mwp->x = ep->x - winfo.bordersize;
+				mwp->y = ep->y - winfo.bordersize - DEC_HEIGHT;
+				GrMoveWindow(mwp->fid, mwp->x + 1, mwp->y + 1);
+			default:
+				break;
+		}
+	}
+}
+
+/*
+ * Handle mouse position events
+ */
+void do_mouse(ep)
+	GR_EVENT_MOUSE *ep;
+{
+#ifdef SHOW_WINDOW_MOTION
+	GR_WINDOW_INFO winfo;
+
+	if(!in_motion) return;
+
+	in_motion->x = ep->rootx - move_xoff - 1;
+	in_motion->y = ep->rooty - move_yoff - 1;
+	GrMoveWindow(in_motion->fid, in_motion->x + 1, in_motion->y + 1);
+	GrGetWindowInfo(in_motion->wid, &winfo);
+	GrMoveWindow(in_motion->wid, in_motion->x + winfo.bordersize - 1,
+			in_motion->y + 2 * winfo.bordersize + DEC_HEIGHT - 1);
+#endif
+}
+
+/*
+ * Here when an exposure event occurs.
+ */
+void
+do_exposure(ep)
+	GR_EVENT_EXPOSURE	*ep;
+{
+	struct app_info	* act;
+	int app_no;
+
+	if (ep->wid == w1) {
+		for(act=Apps,app_no=0;act->app_id[0]!='\0';act++,app_no++) {
+			GrText(w1, gc, 2, 2 + fheight * (app_no + 1),
+				act->app_id, -1, GR_TFBOTTOM);
+		}
+	} else if (ep->wid == GR_ROOT_WINDOW_ID) {
+		GrFillRect(GR_ROOT_WINDOW_ID, bgc, ep->x, ep->y,
+				ep->width, ep->height);
+	}
+}
+
+extern char ** environ;
+
+void
+do_buttondown(ep)
+	GR_EVENT_BUTTON	*ep;
+{
+	mwin *	mwp;
+	static int app_no;
+
+	if (ep->wid == w1) {
+		app_no = ep->y / fheight;
+		if (app_no >= num_apps) {
+			app_no = num_apps - 1;
+		}
+		
+		if (!vfork()) {
+			char * nargv[2];
+
+			nargv[0] = Apps[app_no].app_path;
+			nargv[1] = 0;
+			execve(nargv[0], nargv, environ);
+			/* write(1, "\7", 1); */
+			exit(1);
+		}
+	} else if ((mwp = IsDecoration(ep->wid)) != NULL) {
+		GrRaiseWindow(mwp->wid);
+		GrRaiseWindow(mwp->fid);
+		in_motion = mwp;
+		move_xoff = ep->x;
+		move_yoff = ep->y;
+ 	}
+}
+ 
+void
+do_buttonup(ep)
+GR_EVENT_BUTTON	*ep;
+{
+#ifdef SHOW_WINDOW_MOTION
+	in_motion = NULL;
+#else
+	mwin *	mwp;
+	GR_WINDOW_INFO winfo;
+
+	if ((mwp = IsDecoration(ep->wid)) != NULL) {
+		if (mwp == in_motion) {
+			mwp->x = ep->rootx - 1 - move_xoff;
+			mwp->y = ep->rooty - 1 - move_yoff;
+			GrMoveWindow(mwp->fid, mwp->x + 1, mwp->y + 1);
+			GrGetWindowInfo(mwp->wid, &winfo);
+			GrMoveWindow(mwp->wid, mwp->x + winfo.bordersize,
+				mwp->y + 2 * winfo.bordersize + DEC_HEIGHT);
+			in_motion = NULL;
+		}
+	}
+#endif
+}
diff -urN lib/microwindows/src/demos/nanox/nsaver.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nsaver.c
--- lib/microwindows/src/demos/nanox/nsaver.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nsaver.c	2005-02-21 16:12:56.000000000 +0100
@@ -0,0 +1,959 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is NanoScreenSaver.
+ *
+ * The Initial Developer of the Original Code is Alex Holden.
+ * Portions created by Alex Holden are Copyright (C) 2000
+ * Alex Holden <alex@linuxhacker.org>. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of the GNU General Public license (the  "[GNU] License"), in which case the
+ * provisions of [GNU] License are applicable instead of those
+ * above.  If you wish to allow use of your version of this file only
+ * under the terms of the [GNU] License and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting  the provisions above and replace  them with the notice and
+ * other provisions required by the [GNU] License.  If you do not delete
+ * the provisions above, a recipient may use your version of this file
+ * under either the MPL or the [GNU] License.
+ */
+/*
+ * A collection of screen savers for Nano-X by Alex Holden.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <sys/time.h>
+
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+#include "nsaver.h"
+
+void *my_malloc(size_t size)
+{
+	void *ret;
+
+	if(!(ret = malloc(size))) {
+		fprintf(stderr, "Out of memory\n");
+		exit(1);
+	}
+
+	return ret;
+}
+
+void get_random_point_on_screen(nstate *state, GR_COORD *x, GR_COORD *y,
+							GR_COLOR *c)
+{
+	if(x) {
+		*x = (int) RANDRANGE(0, (state->si.cols - 1.0));
+	}
+	if(y) {
+		*y = (int) RANDRANGE(0, (state->si.rows - 1.0));
+	}
+	if(c) {
+		*c = MWPALINDEX((int)RANDRANGE(0, (state->si.ncolors - 1)));
+	}
+}
+
+void saver1_init(nstate *state) {}
+
+void saver1_exposure(nstate *state)
+{
+	GrClearWindow(state->main_window, 0);
+}
+
+void saver1_animate(nstate *state) {}
+
+void saver2_init(nstate *state)
+{
+	(int)state->priv = SAVER2_MAXPIXELS;
+	state->animate_interval = SAVER2_DELAY;
+}
+
+void saver2_exposure(nstate *state)
+{
+	GrClearWindow(state->main_window, 0);
+}
+
+void saver2_animate(nstate *state)
+{
+	GR_COORD x, y;
+	GR_COLOR c;
+	int pixels = SAVER2_PIXELS_PER_FRAME;
+
+	while(pixels--) {
+		if(!((int)state->priv--)) {
+			(int)state->priv = SAVER2_MAXPIXELS;
+			GrClearWindow(state->main_window, 0);
+		}
+		get_random_point_on_screen(state, &x, &y, &c);
+		GrSetGCForeground(state->main_gc, c);
+		GrPoint(state->main_window, state->main_gc, x, y);
+	}
+}
+
+void saver3_init(nstate *state)
+{
+	s3state *s = my_malloc(sizeof(s3state));
+	state->priv = s;
+	s->maxsegments = SAVER3_MAXSEGMENTS;
+	s->lastx = 0;
+	s->lasty = 0;
+	state->animate_interval = SAVER3_DELAY;
+}
+
+void saver3_exposure(nstate *state)
+{
+	GrClearWindow(state->main_window, 0);
+}
+
+void saver3_animate(nstate *state)
+{
+	GR_COORD newx, newy;
+	GR_COLOR c;
+	s3state *s = state->priv;
+	int pixels = SAVER3_SEGMENTS_PER_FRAME;
+
+	while(pixels--) {
+		if(!(s->maxsegments--)) {
+			s->maxsegments = SAVER3_MAXSEGMENTS;
+			GrClearWindow(state->main_window, 0);
+		}
+		get_random_point_on_screen(state, &newx, &newy, &c);
+		GrSetGCForeground(state->main_gc, c);
+		GrLine(state->main_window, state->main_gc, s->lastx, s->lasty,
+							newx, newy);
+		s->lastx = newx;
+		s->lasty = newy;
+	}
+}
+
+void saver4_init(nstate *state)
+{
+	int i;
+
+	s4state *s = my_malloc(sizeof(s4state));
+	state->priv = s;
+
+	s->length = 0;
+
+	for(i = 0; i < SAVER4_NUMWORMS; i++) {
+		s->tip = 0;
+		get_random_point_on_screen(state, &s->worms[i].points[0].x,
+						&s->worms[i].points[0].y,
+						&s->worms[i].colour);
+	}
+
+	state->animate_interval = SAVER4_DELAY;
+}
+
+void saver4_exposure(nstate *state)
+{
+	int i;
+	s4state *s = state->priv;
+
+	GrClearWindow(state->main_window, 0);
+
+	if(!s->length) return;
+
+	for(i = 0; i < SAVER4_NUMWORMS; i++) {
+		GrSetGCForeground(state->main_gc, s->worms[i].colour);
+		GrPoints(state->main_window, state->main_gc, s->length,
+							s->worms[i].points);
+	}
+}
+
+void saver4_get_new_worm_position(nstate *state, s4state *s, int worm,
+						GR_COORD *newx, GR_COORD *newy)
+{
+	int i;
+	GR_COORD oldx = s->worms[worm].points[s->tip].x;
+	GR_COORD oldy = s->worms[worm].points[s->tip].y;
+
+	do {
+		i = (int)RANDRANGE(0, 3.0);
+		switch(i) {
+			case 0:
+				*newx = oldx + 1;
+				if(*newx == state->si.cols) *newx = 0;
+				break;
+			case 1:
+				*newx = oldx - 1;
+				if(*newx == -1) *newx = state->si.cols - 1;
+				break;
+			case 2:
+				*newx = oldx;
+				break;
+		}
+
+		i = (int)RANDRANGE(0, 3.0);
+		switch(i) {
+			case 0:
+				*newy = oldy + 1;
+				if(*newy == state->si.rows) *newy = 0;
+				break;
+			case 1:
+				*newy = oldy - 1;
+				if(*newy == -1) *newy = state->si.rows - 1;
+				break;
+			case 2:
+				*newy = oldy;
+				break;
+		}
+	} while((*newx == oldx) && (*newy == oldy));
+}
+
+int saver4_worm_collides(nstate *state, s4state *s, int x, int y, int thisworm,
+								int thispoint)
+{
+	int i, n;
+
+	for(i = 0; i < SAVER4_NUMWORMS; i++) {
+		for(n = 0; n < s->length; n++) {
+			if((i == thisworm) && (n == thispoint)) continue;
+			if((s->worms[i].points[n].x == x) &&
+					(s->worms[i].points[n].y) == y) {
+				return 1;
+			}
+		}
+	}
+	return 0;
+}
+
+void saver4_animate(nstate *state)
+{
+	int i, newx, newy, tail, newtip, tries;
+	s4state *s = state->priv;
+
+	if(s->length == SAVER4_WORMLENGTH) tail = s->tip + 1;
+	else tail = 0;
+	if(tail == SAVER4_WORMLENGTH) tail = 0;
+	newtip = s->tip + 1;
+	if(newtip == SAVER4_WORMLENGTH) newtip = 0;
+	
+	for(i = 0; i < SAVER4_NUMWORMS; i++) {
+		if(!saver4_worm_collides(state, s, s->worms[i].points[tail].x,
+					s->worms[i].points[tail].y, i, tail)) {
+			GrSetGCForeground(state->main_gc, BLACK);
+			GrPoint(state->main_window, state->main_gc,
+					s->worms[i].points[tail].x,
+					s->worms[i].points[tail].y);
+		}
+		for(tries = SAVER4_COLLISION_RELUCTANCE; tries; tries--) {
+				saver4_get_new_worm_position(state, s, i, &newx,
+									&newy);
+			if(!saver4_worm_collides(state, s, newx, newy, -1, -1))
+				break;
+		}
+		s->worms[i].points[newtip].x = newx;
+		s->worms[i].points[newtip].y = newy;
+		if(tries) {
+			GrSetGCForeground(state->main_gc, s->worms[i].colour);
+			GrPoint(state->main_window, state->main_gc, newx, newy);
+		}
+	}
+
+	s->tip = newtip;
+	if(s->length < SAVER4_WORMLENGTH) s->length++;
+}
+
+void saver5_init(nstate *state)
+{
+	int i;
+
+	s5state *s = my_malloc(sizeof(s5state));
+	state->priv = s;
+
+	s->numstars = 0;
+
+	for(i = 0; i < SAVER5_NUMSTARS; i++) {
+		s->stars[i].angle = RANDRANGE(0, (2 * M_PI));
+		s->stars[i].pos = 1;
+	}
+
+	state->animate_interval = SAVER5_DELAY;
+}
+
+int saver5_drawstar(nstate *state, s5state *s, int star, int delete)
+{
+	int opp, adj;
+	GR_COORD x, y;
+
+	if(delete) GrSetGCForeground(state->main_gc, BLACK);
+	else GrSetGCForeground(state->main_gc, WHITE);
+
+	opp = (int)(sin(s->stars[star].angle) * s->stars[star].pos);
+	adj = (int)(cos(s->stars[star].angle) * s->stars[star].pos);
+
+	x = (state->si.cols / 2) + adj;
+	y = (state->si.rows / 2) + opp;
+
+	if((x < 0) || (y < 0) || (x >= state->si.cols) || (y >= state->si.rows))
+		return 1;
+
+	GrPoint(state->main_window, state->main_gc, x, y);
+
+	return 0;
+}
+
+void saver5_exposure(nstate *state)
+{
+	int i;
+	s5state *s = state->priv;
+
+	GrClearWindow(state->main_window, 0);
+
+	for(i = 0; i < SAVER5_NUMSTARS; i++) {
+		saver5_drawstar(state, s, i, 0);
+	}
+}
+
+void saver5_animate(nstate *state)
+{
+	int i;
+	double position, scale, increment;
+	s5state *s = state->priv;
+
+	if(s->numstars < SAVER5_NUMSTARS) {
+		s->numstars += SAVER5_STARS_INCREMENT;
+		if(s->numstars > SAVER5_NUMSTARS)
+			s->numstars = SAVER5_NUMSTARS;
+	}
+
+	for(i = 0; i < s->numstars; i++) {
+		saver5_drawstar(state, s, i, 1);
+		position = (double)s->stars[i].pos /
+				(double)(state->si.cols / 2);
+		scale = sin((position * M_PI_2) + M_PI + M_PI_2) + 1.0;
+		increment = (scale * SAVER5_STARS_ACCEL_RATE) + 1;
+		s->stars[i].pos += (int) increment;
+		if(saver5_drawstar(state, s, i, 0)) {
+			s->stars[i].pos = 1;
+			s->stars[i].angle = RANDRANGE(0, (2 * M_PI));
+			saver5_drawstar(state, s, i, 0);
+		}
+	}
+}
+
+void saver6_init(nstate *state)
+{
+	int i, n;
+
+	s6state *s = my_malloc(sizeof(s6state));
+	state->priv = s;
+
+	s->new_bolt_time = 0;
+
+	for(i = 0; i < SAVER6_MAXBOLTS; i++) {
+		s->bolts[i].duration = 0;
+		for(n = 0; n < SAVER6_MAXFORKS; n++) {
+			s->bolts[i].forks[n].valid = 0;
+		}
+	}
+
+	state->animate_interval = SAVER6_DELAY;
+}
+
+void saver6_drawfork(nstate *state, s6state *s, int bolt, int fork, int delete)
+{
+	int i;
+
+	if(delete) GrSetGCForeground(state->main_gc, BLACK);
+	for(i = 0; i < SAVER6_THICKNESS; i++) {
+		if(!delete) {
+			if((i < 2) || (i >= SAVER6_THICKNESS - 2))
+				 GrSetGCForeground(state->main_gc, LTBLUE);
+			else GrSetGCForeground(state->main_gc, WHITE);
+		}
+		GrPoly(state->main_window, state->main_gc,
+				s->bolts[bolt].forks[fork].valid,
+				s->bolts[bolt].forks[fork].vertices[i]);
+	}
+}
+
+void saver6_drawbolt(nstate *state, s6state *s, int bolt, int delete)
+{
+	int n;
+
+	for(n = 0; n < SAVER6_MAXFORKS; n++)
+		if(s->bolts[bolt].forks[n].valid)
+			saver6_drawfork(state, s, bolt, n, delete);
+}
+
+void saver6_drawlightning(nstate *state, s6state *s, int delete)
+{
+	int i;
+
+	for(i = 0; i < SAVER6_MAXBOLTS; i++) {
+		if(s->bolts[i].duration) {
+			if(delete) s->bolts[i].duration--;
+			saver6_drawbolt(state, s, i, delete);
+		}
+	}
+}
+
+void saver6_exposure(nstate *state)
+{
+	s6state *s = state->priv;
+
+	GrClearWindow(state->main_window, 0);
+
+	saver6_drawlightning(state, s, 0);
+}
+
+void saver6_setvertices(s6state *s, int bolt, int fork, int vert, GR_COORD x,
+								GR_COORD y)
+{
+	int i;
+
+	for(i = 0; i < SAVER6_THICKNESS; i++) {
+		s->bolts[bolt].forks[fork].vertices[i][vert].x = x + i;
+		s->bolts[bolt].forks[fork].vertices[i][vert].y = y;
+	}
+}
+
+void saver6_perturb(nstate *state, GR_COORD *x, GR_COORD *y, int maxperturb)
+{
+	*x += (int)RANDRANGE(0, (maxperturb - 1.0)) -
+				(double)(maxperturb / 2.0);
+	if(*x < 0) *x = 0;
+	if(*x > (state->si.cols - 1)) *x = state->si.cols - 1;
+
+	*y += (int)RANDRANGE(0, (maxperturb - 1.0)) -
+				(double)(maxperturb / 2.0);
+	if(*y < 0) *y = 0;
+	if(*y > (state->si.cols - 1)) *y = state->si.cols - 1;
+}
+
+void saver6_makefork(nstate *state, s6state *s, int bolt, int fork, GR_COORD x,
+								GR_COORD y)
+{
+	int i, vertices;
+	double length, incr, pos, angle, scale;
+	GR_COORD ex, ey, nx, ny, xlen, ylen;
+
+	saver6_setvertices(s, bolt, fork, 0, x , y);
+
+	scale = (double)(state->si.rows - y) / (double)state->si.rows;
+
+	vertices = (int)(scale * RANDRANGE(SAVER6_MINFULLVERTICES,
+						SAVER6_MAXVERTICES));
+
+	if(vertices < SAVER6_MINVERTICES) vertices = SAVER6_MINVERTICES;
+
+	s->bolts[bolt].forks[fork].valid = vertices;
+
+	ey = state->si.rows - SAVER6_MAXEND_Y +
+		(int)RANDRANGE(0, SAVER6_MAXEND_Y - 1.0);
+	if((ey - y) <= 0) ey = SAVER6_MINDROP;
+	if(ey >= (state->si.rows - 1)) ey = state->si.rows - 1;
+
+	if(!fork) {
+		ex = x + (int)RANDRANGE(0, ((state->si.cols - 1.0) / 2.0));
+	} else {
+		ex = x + (int)(RANDRANGE(0, (ey - y)) / 2.0) - ((ey - y) / 2.0);
+	}
+
+	if(ex >= state->si.cols) ex = state->si.cols - 1;
+	if(ex < 0) ex = 0;
+
+	xlen = MAX(x, ex) - MIN(x, ex);
+	ylen = MAX(y, ey) - MIN(y, ey);
+
+	length = sqrt(((double)(xlen * xlen) + (double)(ylen * ylen)));
+	incr = length / (vertices - 1);
+	angle = atan(((double)xlen / (double)ylen));
+
+	for(i = vertices - 1; i ; i--) {
+		pos = (incr * (i - 1)) + (RANDRANGE(0, SAVER6_MAXZIGZAG) -
+					((double)SAVER6_MAXZIGZAG / 2.0));
+		if(pos < 0) pos = 0;
+		if(pos > length) pos = length;
+		nx = x - (pos * sin(angle));
+		ny = y + pos * cos(angle);
+		saver6_perturb(state, &nx, &ny, SAVER6_MAXZIGZAG);
+		saver6_setvertices(s, bolt, fork, i, nx , ny);
+	}
+}
+
+int saver6_makeforks(nstate *state, s6state *s, int bolt, int fork,
+						int *vert, int *nextfork)
+{
+	int thisvert = 1, thisfork;
+	double prob;
+
+	if(*vert == (s->bolts[bolt].forks[fork].valid - 1)) return 0;
+	if(*nextfork == SAVER6_MAXFORKS) return 0;
+
+ 	prob = (double)SAVER6_FORK_PROBABILITY * ((double)*vert /
+				(double)s->bolts[bolt].forks[fork].valid) *
+					(1.0 / ((double)fork + 1.0));
+	if(RANDRANGE(0, 1) < prob) {
+		thisfork = *nextfork;
+		saver6_makefork(state, s, bolt, thisfork,
+			s->bolts[bolt].forks[fork].vertices[0][*vert].x,
+			s->bolts[bolt].forks[fork].vertices[0][*vert].y);
+		*nextfork += 1;
+		while(saver6_makeforks(state, s, bolt, thisfork, &thisvert,
+								nextfork));
+	}
+
+	*vert += 1;
+
+	return 1;
+}
+
+void saver6_makebolt(nstate *state, s6state *s, int bolt)
+{
+	GR_COORD x;
+	int vert = 1, nextfork = 1, n;
+
+	for(n = 0; n < SAVER6_MAXFORKS; n++)
+		s->bolts[bolt].forks[n].valid = 0;
+
+	x = (int)RANDRANGE(0, (state->si.cols - 1.0));
+
+	saver6_makefork(state, s, bolt, 0, x, 0);
+
+	while(saver6_makeforks(state, s, bolt, 0, &vert, &nextfork));
+}
+
+void saver6_newbolt(nstate *state, s6state *s)
+{
+	int i;
+
+	for(i = 0; i < SAVER6_MAXBOLTS; i++) {
+		if(!s->bolts[i].duration) {
+			saver6_makebolt(state, s, i);
+			s->bolts[i].duration = RANDRANGE(SAVER6_MINDURATION,
+							SAVER6_MAXDURATION);
+			saver6_drawbolt(state, s, i, 0);
+			break;
+		}
+	}
+
+	s->new_bolt_time = RANDRANGE(1, SAVER6_MAXNEWBOLTTIME);
+}
+
+void saver6_perturb_bolt(nstate *state, s6state *s, int bolt, int fork)
+{
+	int m, o;
+	GR_COORD x, ox, y, oy;
+
+	for(m = 1; m < s->bolts[bolt].forks[fork].valid; m++) {
+		ox = x = s->bolts[bolt].forks[fork].vertices[0][m].x;
+		oy = y = s->bolts[bolt].forks[fork].vertices[0][m].y;
+		saver6_perturb(state, &x, &y, SAVER6_MAXZIGZAG);
+		saver6_setvertices(s, bolt, fork, m, x, y);
+		for(o = fork + 1; o < SAVER6_MAXFORKS; o++) {
+			if((s->bolts[bolt].forks[o].vertices[0][0].x == ox) &&
+				(s->bolts[bolt].forks[o].vertices[0][0].y
+								== oy)) {
+				saver6_setvertices(s, bolt, o, 0, x, y);
+			}
+		}
+	}
+}
+
+void saver6_perturb_lightning(nstate *state, s6state *s)
+{
+	int i, n;
+
+	for(i = 0; i < SAVER6_MAXBOLTS; i++) {
+		if(!s->bolts[i].duration) continue;
+		for(n = 0; n < SAVER6_MAXFORKS; n++) {
+			if(!s->bolts[i].forks[n].valid) continue;
+			saver6_perturb_bolt(state, s, i, n);
+		}
+	}
+}
+
+void saver6_animate(nstate *state)
+{
+	s6state *s = state->priv;
+
+	saver6_drawlightning(state, s, 1);
+	saver6_perturb_lightning(state, s);
+	saver6_drawlightning(state, s, 0);
+
+	if(!s->new_bolt_time--) saver6_newbolt(state, s);
+}
+
+/* The algorithm used in saver7 was adapted from "grav" by Greg Bowering */
+
+void saver7_drawstar(nstate *state, s7state *s)
+{
+	GrSetGCForeground(state->main_gc, SAVER7_STARCOLOUR);
+	GrFillEllipse(state->main_window, state->main_gc, s->starx, s->stary,
+				SAVER7_STARRADIUS, SAVER7_STARRADIUS);
+}
+
+void saver7_drawplanet(nstate *state, s7state *s, int planet, int erase)
+{
+	if(erase) GrSetGCForeground(state->main_gc, BLACK);
+	else GrSetGCForeground(state->main_gc, s->planets[planet].colour);
+
+	if((s->planets[planet].ax < 0) || (s->planets[planet].ay < 0) ||
+			(s->planets[planet].ax >= state->si.cols) ||
+			(s->planets[planet].ay >= state->si.rows)) {
+		return;
+	}
+
+	GrFillEllipse(state->main_window, state->main_gc, s->planets[planet].ax,
+				s->planets[planet].ay,
+				SAVER7_PLANETRADIUS, SAVER7_PLANETRADIUS);
+}
+
+void saver7_calc_planet_position(nstate *state, s7state *s, int planet)
+{
+	if(s->planets[planet].r > -SAVER7_ALMOSTDIST) {
+		s->planets[planet].ax = (int)((double) state->si.cols *
+			(0.5 + (s->planets[planet].x / (s->planets[planet].r +
+							SAVER7_DIST))));
+		s->planets[planet].ay = (int)((double) state->si.rows *
+			(0.5 + (s->planets[planet].y / (s->planets[planet].r +
+							SAVER7_DIST))));
+	} else {
+		s->planets[planet].ax = -1;
+		s->planets[planet].ay = -1;
+	}
+}
+
+void saver7_init(nstate *state)
+{
+	int i;
+	s7state *s = my_malloc(sizeof(s7state));
+	state->priv = s;
+
+	s->starx = state->si.cols / 2;
+	s->stary = state->si.rows / 2;
+
+	for(i = 0; i < SAVER7_PLANETS; i++) {
+		s->planets[i].r = RANDRANGE(SAVER7_MIN_STARTDIM,
+						SAVER7_MAX_STARTDIM);
+		s->planets[i].x = RANDRANGE(SAVER7_MIN_STARTDIM,
+						SAVER7_MAX_STARTDIM);
+		s->planets[i].y = RANDRANGE(SAVER7_MIN_STARTDIM,
+						SAVER7_MAX_STARTDIM);
+		s->planets[i].rv = RANDRANGE(SAVER7_MIN_STARTVEL,
+						SAVER7_MAX_STARTVEL);
+		s->planets[i].xv = RANDRANGE(SAVER7_MIN_STARTVEL,
+						SAVER7_MAX_STARTVEL);
+		s->planets[i].yv = RANDRANGE(SAVER7_MIN_STARTVEL,
+						SAVER7_MAX_STARTVEL);
+		s->planets[i].colour = RANDRANGE(0, (state->si.ncolors - 1));
+		saver7_calc_planet_position(state, s, i);
+		saver7_drawplanet(state, s, i, 0);
+	}
+
+	saver7_drawstar(state, s);
+
+	state->animate_interval = SAVER7_DELAY;
+}
+
+void saver7_exposure(nstate *state)
+{
+	int i;
+	s7state *s = state->priv;
+
+	GrClearWindow(state->main_window, 0);
+
+	for(i = 0; i < SAVER7_PLANETS; i++)
+		saver7_drawplanet(state, s, i, 0);
+
+	saver7_drawstar(state, s);
+}
+
+void saver7_moveplanet(nstate *state, s7state *s, int planet)
+{
+	double dist;
+	double accel;
+
+	dist = (s->planets[planet].x * s->planets[planet].x) +
+		(s->planets[planet].y * s->planets[planet].y) +
+		(s->planets[planet].r * s->planets[planet].r);
+	if(dist < SAVER7_COLLIDE) dist = SAVER7_COLLIDE;
+	dist = sqrt(dist);
+	dist = dist * dist * dist;
+
+#ifdef SAVER7_USE_DAMPING
+	accel = s->planets[planet].r * SAVER7_G / dist;
+	if(accel > SAVER7_MAX_ACCEL) accel = SAVER7_MAX_ACCEL;
+	else if(accel < -SAVER7_MAX_ACCEL) accel = -SAVER7_MAX_ACCEL;
+	s->planets[planet].rv = (s->planets[planet].rv + accel) *
+						SAVER7_DAMPING_FACTOR;
+	s->planets[planet].r += s->planets[planet].rv;
+	accel = s->planets[planet].x * SAVER7_G / dist;
+	if(accel > SAVER7_MAX_ACCEL) accel = SAVER7_MAX_ACCEL;
+	else if(accel < -SAVER7_MAX_ACCEL) accel = -SAVER7_MAX_ACCEL;
+	s->planets[planet].xv = (s->planets[planet].xv + accel) *
+						SAVER7_DAMPING_FACTOR;
+	s->planets[planet].x += s->planets[planet].xv;
+	accel = s->planets[planet].y * SAVER7_G / dist;
+	if(accel > SAVER7_MAX_ACCEL) accel = SAVER7_MAX_ACCEL;
+	else if(accel < -SAVER7_MAX_ACCEL) accel = -SAVER7_MAX_ACCEL;
+	s->planets[planet].yv = (s->planets[planet].yv + accel) *
+						SAVER7_DAMPING_FACTOR;
+	s->planets[planet].y += s->planets[planet].yv;
+#else
+	accel = s->planets[planet].r * SAVER7_G / dist;
+	s->planets[planet].rv += accel;
+	s->planets[planet].r += s->planets[planet].rv;
+	accel = s->planets[planet].x * SAVER7_G / dist;
+	s->planets[planet].xv += accel;
+	s->planets[planet].x += s->planets[planet].xv;
+	accel = s->planets[planet].y * SAVER7_G / dist;
+	s->planets[planet].yv += accel;
+	s->planets[planet].y += s->planets[planet].yv;
+#endif
+}
+
+void saver7_animate(nstate *state)
+{
+	int i;
+	s7state *s = state->priv;
+
+	for(i = 0; i < SAVER7_PLANETS; i++) {
+		saver7_moveplanet(state, s, i);
+		saver7_drawplanet(state, s, i, 1);
+		saver7_calc_planet_position(state, s, i);
+		saver7_drawplanet(state, s, i, 0);
+	}
+	saver7_drawstar(state, s);
+}
+
+/* The algorithm used in saver8 is based on that found at: 
+   http://www.go2net.com/internet/deep/1997/04/16/body.html */
+
+void saver8_init(nstate *state)
+{
+	int red = 0, green = 0, blue = 0, step, i = 0;
+
+	s8state *s = my_malloc(sizeof(s8state));
+	state->priv = s;
+
+	s->current_line = 0;
+
+	step = 512 / SAVER8_NUMCOLOURS;
+
+	for(green = 255; green > 0; green -= step, blue += step, i++)
+		s->colours[i] = GR_RGB(0, green, blue);
+	for(blue = 255; blue > 0; blue -= step, red += step, i++)
+		s->colours[i] = GR_RGB(red, 0, blue);
+
+	state->animate_interval = SAVER8_DELAY;
+}
+
+void saver8_drawpattern(nstate *state)
+{
+	int x, col, lines = SAVER8_LINES_PER_FRAME;
+	s8state *s = state->priv;
+
+	if(!s->current_line)
+		s->factor = RANDRANGE(SAVER8_MINFACTOR, SAVER8_MAXFACTOR);
+
+	while(s->current_line < state->si.rows) {
+		if(!--lines) return;
+		for(x = 0; x < state->si.cols; x++) {
+			col = ((((x * x) + (s->current_line * s->current_line))
+					/ s->factor) % SAVER8_NUMCOLOURS);
+			GrSetGCForeground(state->main_gc, s->colours[col]);
+			GrPoint(state->main_window, state->main_gc, x,
+							s->current_line);
+		}
+		s->current_line++;
+	}
+	s->current_line = 0;
+}
+
+void saver8_exposure(nstate *state)
+{
+	s8state *s = state->priv;
+
+	GrClearWindow(state->main_window, 0);
+	s->current_line = 0;
+	saver8_drawpattern(state);
+}
+
+void saver8_animate(nstate *state)
+{
+	saver8_drawpattern(state);
+}
+
+int init(nstate *state)
+{
+	GR_WM_PROPERTIES props;
+	GR_BITMAP cursor = 0;
+
+	if(!GrOpen()) {
+		fprintf(stderr, "Couldn't connect to Nano-X server\n");
+		return 3;
+	}
+
+	GrGetScreenInfo(&state->si);
+
+	state->main_window = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0,
+				state->si.cols, state->si.rows, 0, BLACK, 0);
+
+	GrSelectEvents(state->main_window, GR_EVENT_MASK_EXPOSURE |
+						GR_EVENT_MASK_BUTTON_UP |
+						GR_EVENT_MASK_BUTTON_DOWN |
+						GR_EVENT_MASK_MOUSE_MOTION |
+						GR_EVENT_MASK_KEY_UP |
+						GR_EVENT_MASK_KEY_DOWN |
+						GR_EVENT_MASK_FOCUS_OUT |
+						GR_EVENT_MASK_CLOSE_REQ);
+
+	props.flags = GR_WM_FLAGS_PROPS;
+	props.props = GR_WM_PROPS_NOMOVE | GR_WM_PROPS_NODECORATE |
+			GR_WM_PROPS_NOAUTOMOVE | GR_WM_PROPS_NOAUTORESIZE;
+	GrSetWMProperties(state->main_window, &props);
+
+	state->main_gc = GrNewGC();
+	GrSetGCForeground(state->main_gc, WHITE);
+	GrSetGCBackground(state->main_gc, BLACK);
+
+	state->animate_interval = 0;
+
+	srand(time(0));
+
+	init_functions[state->saver](state);
+
+	calculate_timeout(state);
+
+	GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_SCREENSAVER);
+
+	GrSetCursor(state->main_window, 1, 1, 1, 1, 0, 0, &cursor, &cursor);
+
+	GrMapWindow(state->main_window);
+
+	GrSetFocus(state->main_window);
+
+	return 0;
+}
+
+void calculate_timeout(nstate *state)
+{
+	struct timeval t;
+	long u;
+
+	gettimeofday(&t, NULL);
+	u = t.tv_usec + (state->animate_interval * 1000);
+	state->timeout.tv_sec = t.tv_sec + (u / 1000000);
+	state->timeout.tv_usec = u % 1000000;
+}
+
+unsigned long timeout_delay(nstate *state)
+{
+	struct timeval t;
+	signed long s, m, ret;
+
+	gettimeofday(&t, NULL);
+
+	if(!state->animate_interval) return 0;
+
+	if((t.tv_sec > state->timeout.tv_sec) ||
+			((t.tv_sec == state->timeout.tv_sec) &&
+			t.tv_usec >= state->timeout.tv_usec)) return 1;
+
+	s = state->timeout.tv_sec - t.tv_sec;
+	m = ((state->timeout.tv_usec - t.tv_usec) / 1000);
+	ret = (unsigned long)((1000 * s) + m);
+
+	if(ret <= 0) return 1;
+	else return ret;
+}
+
+void do_animate(nstate *state)
+{
+	struct timeval t;
+
+	if(!state->animate_interval) return;
+
+	gettimeofday(&t, NULL);
+
+	if((t.tv_sec > state->timeout.tv_sec) ||
+			((t.tv_sec == state->timeout.tv_sec) &&
+			(t.tv_usec >= state->timeout.tv_usec))) {
+		animate_functions[state->saver](state);
+		calculate_timeout(state);
+	}
+}
+
+int do_screensaver_event(nstate *state)
+{
+	GR_EVENT_SCREENSAVER *event = &state->event.screensaver;
+
+	if(event->activate != GR_FALSE) {
+		fprintf(stderr, "Got a non-deactivate screensaver event\n");
+		return 0;
+	}
+
+	return 1;
+}
+
+int handle_event(nstate *state)
+{
+	switch(state->event.type) {
+		case GR_EVENT_TYPE_EXPOSURE:
+			exposure_functions[state->saver](state);
+		case GR_EVENT_TYPE_TIMEOUT:
+		case GR_EVENT_TYPE_NONE:
+			break;
+		case GR_EVENT_TYPE_SCREENSAVER:
+			if(do_screensaver_event(state)) return 0;
+			break;
+		case GR_EVENT_TYPE_CLOSE_REQ:
+		case GR_EVENT_MASK_BUTTON_UP:
+		case GR_EVENT_MASK_BUTTON_DOWN:
+		case GR_EVENT_MASK_MOUSE_MOTION:
+		case GR_EVENT_MASK_KEY_UP:
+		case GR_EVENT_MASK_KEY_DOWN:
+		case GR_EVENT_MASK_FOCUS_OUT:
+			return 0;
+		default:
+			fprintf(stderr, "Got unknown event type %d\n",
+							state->event.type);
+			break;
+	}
+	do_animate(state);
+	return(1);
+}
+
+int main(int argc, char *argv[])
+{
+	int ret;
+	nstate *state = my_malloc(sizeof(nstate));
+
+	if(argc == 2) {
+		state->saver = atoi(argv[1]) - 1;
+		if((state->saver) < 0 || (state->saver >= NUM_SAVERS)) {
+			fprintf(stderr, "Invalid saver number \"%s\"\n",
+								argv[1]);
+			return 2;
+		}
+	} else state->saver = 0;
+
+	if((ret = init(state))) return ret;
+
+	do {
+		GrGetNextEventTimeout(&state->event, timeout_delay(state));
+	} while(handle_event(state));
+
+	GrClose();
+
+	return 0;
+}
diff -urN lib/microwindows/src/demos/nanox/nsaver.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nsaver.h
--- lib/microwindows/src/demos/nanox/nsaver.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nsaver.h	2005-02-21 16:12:56.000000000 +0100
@@ -0,0 +1,273 @@
+#ifndef NSAVER_H
+#define NSAVER_H
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is NanoScreenSaver.
+ *
+ * The Initial Developer of the Original Code is Alex Holden.
+ * Portions created by Alex Holden are Copyright (C) 2000
+ * Alex Holden <alex@linuxhacker.org>. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of the GNU General Public license (the  "[GNU] License"), in which case the
+ * provisions of [GNU] License are applicable instead of those
+ * above.  If you wish to allow use of your version of this file only
+ * under the terms of the [GNU] License and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting  the provisions above and replace  them with the notice and
+ * other provisions required by the [GNU] License.  If you do not delete
+ * the provisions above, a recipient may use your version of this file
+ * under either the MPL or the [GNU] License.
+ */
+
+#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
+#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
+#define RANDRANGE(LO, HI) ((LO) + ((double)((HI) - (LO)) *  rand() \
+						/ (RAND_MAX + 1.0)))
+
+typedef struct {
+	GR_WINDOW_ID main_window;
+	GR_GC_ID main_gc;
+	GR_EVENT event;
+	long animate_interval;
+	struct timeval timeout;
+	int saver;
+	void *priv;
+	GR_SCREEN_INFO si;
+} nstate;
+
+void *my_malloc(size_t size);
+void get_random_point_on_screen(nstate *state, GR_COORD *x, GR_COORD *y,
+							GR_COLOR *c);
+int init(nstate *state);
+void calculate_timeout(nstate *state);
+unsigned long timeout_delay(nstate *state);
+unsigned long timeout_delay(nstate *state);
+void do_animate(nstate *state);
+int do_screensaver_event(nstate *state);
+int handle_event(nstate *state);
+
+#define NUM_SAVERS 8
+
+void saver1_init(nstate *state);
+void saver1_exposure(nstate *state);
+void saver1_animate(nstate *state);
+
+#define SAVER2_DELAY 1
+#define SAVER2_MAXPIXELS 65535
+#define SAVER2_PIXELS_PER_FRAME 16
+
+void saver2_init(nstate *state);
+void saver2_exposure(nstate *state);
+void saver2_animate(nstate *state);
+
+#define SAVER3_DELAY 1
+#define SAVER3_MAXSEGMENTS 65535
+#define SAVER3_SEGMENTS_PER_FRAME 4
+
+typedef struct {
+	int maxsegments;
+	GR_COORD lastx;
+	GR_COORD lasty;
+} s3state;
+
+void saver3_init(nstate *state);
+void saver3_exposure(nstate *state);
+void saver3_animate(nstate *state);
+
+#define SAVER4_DELAY 4
+#define SAVER4_NUMWORMS 10
+#define SAVER4_WORMLENGTH 100
+#define SAVER4_COLLISION_RELUCTANCE 20
+
+typedef struct {
+	GR_COLOR colour;
+	GR_POINT points[SAVER4_WORMLENGTH];
+} s4worm;
+
+typedef struct {
+	int length;
+	int tip;
+	s4worm worms[SAVER4_NUMWORMS];
+} s4state;
+
+void saver4_init(nstate *state);
+void saver4_exposure(nstate *state);
+void saver4_get_new_worm_position(nstate *state, s4state *s, int worm,
+					GR_COORD *newx, GR_COORD *newy);
+int saver4_worm_collides(nstate *state, s4state *s, int x, int y, int thisworm,
+								int thispoint);
+void saver4_animate(nstate *state);
+
+#define SAVER5_DELAY 1
+#define SAVER5_NUMSTARS 300
+#define SAVER5_STARS_INCREMENT 2
+#define SAVER5_STARS_ACCEL_RATE 30
+
+typedef struct {
+	double angle;
+	int pos;
+} s5star;
+
+typedef struct {
+	int numstars;
+	s5star stars[SAVER5_NUMSTARS];
+} s5state;
+
+void saver5_init(nstate *state);
+int saver5_drawstar(nstate *state, s5state *s, int star, int delete);
+void saver5_exposure(nstate *state);
+void saver5_animate(nstate *state);
+
+#define SAVER6_DELAY 5
+#define SAVER6_MAXVERTICES 20
+#define SAVER6_MINFULLVERTICES 5
+#define SAVER6_MINVERTICES 3
+#define SAVER6_MINDROP 10
+#define SAVER6_MAXBOLTS 4
+#define SAVER6_MAXFORKS 20
+#define SAVER6_MAXEND_Y 50
+#define SAVER6_THICKNESS 6
+#define SAVER6_MINDURATION 10
+#define SAVER6_MAXDURATION 20
+#define SAVER6_MAXNEWBOLTTIME 300
+#define SAVER6_MAXZIGZAG 10
+#define SAVER6_MAXPERTURBATION 5
+#define SAVER6_FORK_PROBABILITY 0.5
+
+typedef struct {
+	int valid;
+	GR_POINT vertices[SAVER6_THICKNESS][SAVER6_MAXVERTICES];
+} s6fork;
+
+typedef struct {
+	int duration;
+	s6fork forks[SAVER6_MAXFORKS];
+} s6bolt;
+
+typedef struct {
+	int new_bolt_time;
+	s6bolt bolts[SAVER6_MAXBOLTS];
+} s6state;
+
+void saver6_init(nstate *state);
+void saver6_drawfork(nstate *state, s6state *s, int bolt, int fork, int delete);
+void saver6_drawbolt(nstate *state, s6state *s, int bolt, int delete);
+void saver6_drawlightning(nstate *state, s6state *s, int delete);
+void saver6_exposure(nstate *state);
+void saver6_setvertices(s6state *s, int bolt, int fork, int vert, GR_COORD x,
+								GR_COORD y);
+void saver6_makefork(nstate *state, s6state *s, int bolt, int fork, GR_COORD x,
+								GR_COORD y);
+void saver6_perturb(nstate *state, GR_COORD *x, GR_COORD *y, int maxperturb);
+void saver6_makebolt(nstate *state, s6state *s, int bolt);
+void saver6_newbolt(nstate *state, s6state *s);
+void saver6_perturb_bolt(nstate *state, s6state *s, int bolt, int fork);
+void saver6_perturb_lightning(nstate *state, s6state *s);
+void saver6_animate(nstate *state);
+
+/* The algorithm used in saver7 was adapted from "grav" by Greg Bowering */
+
+#define SAVER7_DELAY 2
+#define SAVER7_PLANETS 15
+#define SAVER7_PLANETS_USE_DAMPING
+#define SAVER7_STARCOLOUR YELLOW
+#define SAVER7_STARRADIUS 5
+#define SAVER7_PLANETRADIUS 3
+#define SAVER7_DIST 16.0
+#define SAVER7_ALMOSTDIST (SAVER7_DIST - 0.01)
+#define SAVER7_MAX_STARTDIM (SAVER7_ALMOSTDIST / 2.0)
+#define SAVER7_MIN_STARTDIM -SAVER7_MAX_STARTDIM
+#define SAVER7_MAX_STARTVEL 0.04
+#define SAVER7_MIN_STARTVEL -SAVER7_MAX_STARTVEL
+#define SAVER7_G -0.02
+#define SAVER7_COLLIDE 0.0001
+#define SAVER7_DAMPING_FACTOR 0.999999
+#define SAVER7_MAX_ACCEL 0.1
+
+typedef struct {
+	double r;
+	double rv;
+	double x;
+	double xv;
+	double y;
+	double yv;
+	GR_COORD ax;
+	GR_COORD ay;
+	GR_COLOR colour;
+} s7planet;
+
+typedef struct {
+	s7planet planets[SAVER7_PLANETS];
+	GR_COORD starx;
+	GR_COORD stary;
+} s7state;
+
+void saver7_init(nstate *state);
+void saver7_exposure(nstate *state);
+void saver7_animate(nstate *state);
+
+/* The algorithm used in saver8 is based on that found at:
+   http://www.go2net.com/internet/deep/1997/04/16/body.html */
+
+#define SAVER8_DELAY 1
+#define SAVER8_NUMCOLOURS 64 /* Don't set this higher than 512! */
+#define SAVER8_MINFACTOR 1
+#define SAVER8_MAXFACTOR 20
+#define SAVER8_LINES_PER_FRAME 5
+
+typedef struct {
+	GR_COLOR colours[SAVER8_NUMCOLOURS];
+	int current_line;
+	int factor;
+} s8state;
+
+void saver8_init(nstate *state);
+void saver8_drawpattern(nstate *state);
+void saver8_exposure(nstate *state);
+void saver8_animate(nstate *state);
+
+typedef void(*saver_function)(nstate *);
+
+saver_function init_functions[NUM_SAVERS] = {
+	saver1_init,
+	saver2_init,
+	saver3_init,
+	saver4_init,
+	saver5_init,
+	saver6_init,
+	saver7_init,
+	saver8_init
+};
+saver_function exposure_functions[NUM_SAVERS] = {
+	saver1_exposure,
+	saver2_exposure,
+	saver3_exposure,
+	saver4_exposure,
+	saver5_exposure,
+	saver6_exposure,
+	saver7_exposure,
+	saver8_exposure
+};
+saver_function animate_functions[NUM_SAVERS] = {
+	saver1_animate,
+	saver2_animate,
+	saver3_animate,
+	saver4_animate,
+	saver5_animate,
+	saver6_animate,
+	saver7_animate,
+	saver8_animate
+};
+#endif
diff -urN lib/microwindows/src/demos/nanox/nterm.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nterm.c
--- lib/microwindows/src/demos/nanox/nterm.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nterm.c	2005-02-21 16:12:56.000000000 +0100
@@ -0,0 +1,328 @@
+/*
+ * Nano-X terminal emulator
+ *
+ * Al Riddoch
+ * Greg Haerr
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+#define HAVEBLIT 0		/* set if have bitblit (experimental)*/
+
+#define	_	((unsigned) 0)		/* off bits */
+#define	X	((unsigned) 1)		/* on bits */
+#define	MASK(a,b,c,d,e,f,g) \
+	(((((((((((((a * 2) + b) * 2) + c) * 2) + d) * 2) \
+	+ e) * 2) + f) * 2) + g) << 9)
+
+#if DOS_DJGPP
+#define SIGCHLD		17 /* from Linux */
+#endif
+
+static GR_WINDOW_ID	w1;	/* id for window */
+static GR_GC_ID		gc1;	/* graphics context */
+static GR_GC_ID		gc3;	/* graphics context */
+static GR_COORD		xpos;	/* x coord for text */
+static GR_COORD		ypos;	/* y coord for text */
+static GR_SCREEN_INFO	si;	/* screen info */
+static int 		tfd;
+
+void do_buttondown();
+void do_buttonup();
+void do_motion();
+void text_init();
+int term_init();
+void do_keystroke();
+void do_focusin();
+void do_focusout();
+void do_enter();
+void do_exit();
+void do_fdinput();
+void printg();
+void HandleEvent(GR_EVENT *ep);
+
+int main(int argc, char ** argv)
+{
+	GR_BITMAP	bitmap1fg[7];	/* mouse cursor */
+	GR_BITMAP	bitmap1bg[7];
+
+	if (GrOpen() < 0) {
+		fprintf(stderr, "cannot open graphics\n");
+		exit(1);
+	}
+	
+	GrGetScreenInfo(&si);
+
+	w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 50, 30, si.cols - 120,
+		si.rows - 60, 1, WHITE, LTBLUE);
+
+	GrSelectEvents(w1, GR_EVENT_MASK_BUTTON_DOWN |
+		GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_EXPOSURE |
+		GR_EVENT_MASK_FOCUS_IN | GR_EVENT_MASK_FOCUS_OUT |
+		GR_EVENT_MASK_CLOSE_REQ);
+
+	GrMapWindow(w1);
+
+	gc1 = GrNewGC();
+	gc3 = GrNewGC();
+
+	GrSetGCForeground(gc1, GRAY);
+	GrSetGCBackground(gc1, LTBLUE);
+	GrSetGCFont(gc1, GrCreateFont(GR_FONT_SYSTEM_FIXED, 0, NULL));
+	/*GrSetGCFont(gc1, GrCreateFont(GR_FONT_OEM_FIXED, 0, NULL));*/
+	GrSetGCForeground(gc3, WHITE);
+	GrSetGCBackground(gc3, BLACK);
+
+	bitmap1fg[0] = MASK(_,_,X,_,X,_,_);
+	bitmap1fg[1] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[2] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[3] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[4] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[5] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[6] = MASK(_,_,X,_,X,_,_);
+
+	bitmap1bg[0] = MASK(_,X,X,X,X,X,_);
+	bitmap1bg[1] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[2] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[3] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[4] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[5] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[6] = MASK(_,X,X,X,X,X,_);
+
+	GrSetCursor(w1, 7, 7, 3, 3, WHITE, BLACK, bitmap1fg, bitmap1bg);
+
+	/*GrFillRect(GR_ROOT_WINDOW_ID, gc1, 0, 0, si.cols, si.rows);*/
+
+	GrSetGCForeground(gc1, BLACK);
+	GrSetGCBackground(gc1, WHITE);
+	text_init();
+	if (term_init() < 0) {
+		GrClose();
+		exit(1);
+	}
+
+	/* we want tfd events also*/
+	GrRegisterInput(tfd);
+
+#if 1
+	GrMainLoop(HandleEvent);
+#else
+	while(1) {
+		GR_EVENT ev;
+
+		GrGetNextEvent(&ev);
+		HandleEvent(&ev);
+	}
+#endif
+	/* notreached*/
+	return 0;
+}
+
+void
+HandleEvent(GR_EVENT *ep)
+{
+	switch (ep->type) {
+		case GR_EVENT_TYPE_KEY_DOWN:
+			do_keystroke(&ep->keystroke);
+			break;
+
+		case GR_EVENT_TYPE_FOCUS_IN:
+			do_focusin(&ep->general);
+			break;
+
+		case GR_EVENT_TYPE_FOCUS_OUT:
+			do_focusout(&ep->general);
+			break;
+
+		case GR_EVENT_TYPE_CLOSE_REQ:
+			GrClose();
+			exit(0);
+
+		case GR_EVENT_TYPE_FDINPUT:
+			do_fdinput();
+			break;
+	}
+}
+
+#if ELKS
+char * nargv[2] = {"/bin/sash", NULL};
+#else
+#if DOS_DJGPP
+char * nargv[2] = {"bash", NULL};
+#else
+char * nargv[2] = {"/bin/sh", NULL};
+#endif
+#endif
+
+void sigchild(int signo)
+{
+	printg("We have a signal right now!\n");
+	GrClose();
+	exit(0);
+}
+
+int term_init()
+{
+	char pty_name[12];
+	int n = 0;
+	pid_t pid;
+
+again:
+	sprintf(pty_name, "/dev/ptyp%d", n);
+	if ((tfd = open(pty_name, O_RDWR | O_NONBLOCK)) < 0) {
+		if ((errno == EBUSY || errno == EIO) && n < 10) {
+			n++;
+			goto again;
+		}
+		fprintf(stderr, "Can't create pty %s\n", pty_name);
+		return -1;
+	}
+	signal(SIGCHLD, sigchild);
+	signal(SIGINT, sigchild);
+	if ((pid = fork()) == -1) {
+		fprintf(stderr, "No processes\n");
+		return -1;
+	}
+	if (!pid) {
+		close(STDIN_FILENO);
+		close(STDOUT_FILENO);
+		close(STDERR_FILENO);
+		close(tfd);
+		
+		setsid();
+		pty_name[5] = 't';
+		if ((tfd = open(pty_name, O_RDWR)) < 0) {
+			fprintf(stderr, "Child: Can't open pty %s\n", pty_name);
+			exit(1);
+		}
+		dup2(tfd, STDIN_FILENO);
+		dup2(tfd, STDOUT_FILENO);
+		dup2(tfd, STDERR_FILENO);
+		execv(nargv[0], nargv);
+		exit(1);
+	}
+	return 0;
+}
+	
+
+GR_SIZE		width;		/* width of character */
+GR_SIZE		height;		/* height of character */
+GR_SIZE		base;		/* height of baseline */
+
+void text_init()
+{
+	GrGetGCTextSize(gc1, "A", 1, GR_TFASCII, &width, &height, &base);
+}
+
+void char_del(GR_COORD x, GR_COORD y)
+{
+	xpos -= width;
+	GrFillRect(w1, gc3, x, y /*- height*/ /*+ base*/ + 1, width, height);
+}
+	
+void char_out(GR_CHAR ch)
+{
+	switch(ch) {
+	case '\r':
+		xpos = 0;
+		return;
+	case '\n':
+		ypos += height;
+		if(ypos > si.rows - 60 - height) {
+			ypos -= height;
+#if HAVEBLIT
+			bogl_cfb8_blit(50, 30, si.cols-120,
+				si.rows-60-height, 50, 30+height);
+			GrFillRect(w1, gc3, 50, ypos, si.cols-120, height);
+#else
+			/* FIXME: changing FALSE to TRUE crashes nano-X*/
+			/* clear screen, no scroll*/
+			ypos = 0;
+			GrClearWindow(w1, GR_FALSE);
+#endif
+		}
+		return;
+	case '\007':			/* bel*/
+		return;
+	case '\t':
+		xpos += width;
+		while((xpos/width) & 7)
+			char_out(' ');
+		return;
+	case '\b':			/* assumes fixed width font!!*/
+		if (xpos <= 0)
+			return;
+		char_del(xpos, ypos);
+		return;
+	}
+	GrText(w1, gc1, xpos+1, ypos, &ch, 1, GR_TFTOP);
+	xpos += width;
+}
+
+void printg(char * text)
+{
+	int i;
+
+	for(i = 0; i < strlen(text); i++) {
+		char_out(text[i]);
+	}
+}
+
+
+/*
+ * Here when a keyboard press occurs.
+ */
+void
+do_keystroke(kp)
+	GR_EVENT_KEYSTROKE	*kp;
+{
+	char foo;
+
+	foo = kp->ch;
+	write(tfd, &foo, 1);
+}
+
+
+/*
+ * Here when a focus in event occurs.
+ */
+void
+do_focusin(gp)
+	GR_EVENT_GENERAL	*gp;
+{
+	if (gp->wid != w1)
+		return;
+	GrSetBorderColor(w1, LTBLUE);
+}
+
+/*
+ * Here when a focus out event occurs.
+ */
+void
+do_focusout(gp)
+	GR_EVENT_GENERAL	*gp;
+{
+	if (gp->wid != w1)
+		return;
+	GrSetBorderColor(w1, GRAY);
+}
+
+/*
+ * Here to read the shell input file descriptor.
+ */
+void
+do_fdinput()
+{
+	char	c;
+
+	if (read(tfd, &c, 1) == 1)
+		char_out(c);
+}
diff -urN lib/microwindows/src/demos/nanox/ntetris.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/ntetris.c
--- lib/microwindows/src/demos/nanox/ntetris.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/ntetris.c	2005-02-21 16:12:57.000000000 +0100
@@ -0,0 +1,954 @@
+/* 
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ * 
+ * The Original Code is NanoTetris.
+ * 
+ * The Initial Developer of the Original Code is Alex Holden.
+ * Portions created by Alex Holden are Copyright (C) 2000
+ * Alex Holden <alex@linuxhacker.org>. All Rights Reserved.
+ * 
+ * Contributor(s):
+ * 
+ * Alternatively, the contents of this file may be used under the terms
+ * of the GNU General Public license (the  "[GNU] License"), in which case the
+ * provisions of [GNU] License are applicable instead of those
+ * above.  If you wish to allow use of your version of this file only
+ * under the terms of the [GNU] License and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting  the provisions above and replace  them with the notice and
+ * other provisions required by the [GNU] License.  If you do not delete
+ * the provisions above, a recipient may use your version of this file
+ * under either the MPL or the [GNU] License.
+ */
+
+/*
+ * A Nano-X Tetris clone by Alex Holden.
+ *
+ * The objective is to keep placing new pieces for as long as possible. When a
+ * horizontal line is filled with blocks, it will vanish, and everything above
+ * it will drop down a line. It quickly gets difficult because the speed
+ * increases with the score. Unlike with some Tetris clones, no bonus points
+ * are awarded for matching colours, completing more than one line at a time,
+ * or for using the "drop shape to bottom" function.
+ *
+ * The box in the top left of the game window is the score box. The top score
+ * is the highest score you have achieved since last resetting the high score
+ * counter. The counter is stored when the game exits in the file specified by
+ * the HISCORE_FILE parameter ("/usr/games/nanotetris.hiscore" by default). 
+ * Note that no attempt is made to encrypt the file, so anybody with write
+ * access to the file can alter the contents of it using a text editor.
+ *
+ * The box below the score box is the next shape box. This contains a "preview"
+ * of the next shape to appear, so that you can plan ahead as you are building
+ * up the blocks.
+ *
+ * The game functions can be controlled using either the mouse (or a touch pad,
+ * touch screen, trackball, etc.) and the buttons below the next shape box, or
+ * with the following keyboard keys:
+ *
+ *   Q = quit game
+ *   N = new game
+ *   P = pause game
+ *   C = continue game
+ *   D = rotate shape anticlockwise
+ *   F = rotate shape clockwise
+ *   J = move shape left
+ *   K = move shape right
+ *   Space Bar = drop shape to bottom.
+ *
+ * The reason for the unconventional use of D, F, J, and K keys is that they
+ * are all in the "home" position of a QWERTY keyboard, which makes them very
+ * easy to press if you are used to touch typing.
+ *
+ * I'll leave it to you to figure out which mouse operated movement button does
+ * what (it's pretty obvious).
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <time.h>
+#include <ctype.h>
+#include <errno.h>
+#include <sys/time.h>
+
+#define MWINCLUDECOLORS
+#include <nano-X.h>
+
+#include "ntetris.h"
+
+void *my_malloc(size_t size)
+{
+	void *ret;
+
+	if(!(ret = malloc(size))) {
+		fprintf(stderr, "Out of memory\n");
+		exit(1);
+	}
+
+	return ret;
+}
+
+#ifdef HAVE_USLEEP
+void msleep(long ms)
+{
+	usleep(ms * 1000);
+}
+#else
+void msleep(long ms)
+{
+	struct timespec req, rem;
+
+	req.tv_sec = ms / 1000000;
+	req.tv_nsec = (ms % 1000000) * 1000000;
+
+	while(nanosleep(&req, &rem) == -1) {
+		if(errno == EINTR) {
+			req.tv_sec = rem.tv_sec;
+			req.tv_nsec = rem.tv_nsec;
+			continue;
+		} else {
+			perror("nanosleep() failed");
+			return;
+		}
+	}
+}
+#endif
+
+#ifdef USE_HISCORE_FILE
+void read_hiscore(nstate *state)
+{
+	FILE *f;
+	int i, n;
+
+	if(!(f = fopen(HISCORE_FILE, "r"))) {
+		if(errno != ENOENT)
+			perror("Couldn't open high score file for reading");
+		state->hiscore = state->fhiscore = 0;
+		return;
+	}
+
+	i = fscanf(f, "%d", &n);
+	fclose(f);
+
+	if(i != 1) {
+		fprintf(stderr, "Couldn't read high score file\n");
+		n = 0;
+	}
+
+	state->hiscore = state->fhiscore = n;
+}
+void write_hiscore(nstate *state)
+{
+	FILE *f;
+
+	if(state->score > state->hiscore) state->hiscore = state->score;
+	if(state->hiscore <= state->fhiscore) return;
+
+	if(!(f = fopen(HISCORE_FILE, "w"))) {
+		perror("Couldn't open high score file for writing");
+		return;
+	}
+
+	if((fprintf(f, "%d", state->hiscore)) == -1) {
+		perror("Couldn't write to high score file");
+	}
+
+	fclose(f);
+}
+#else
+void read_hiscore(nstate *state)
+{
+	state->hiscore = 0;
+}
+void write_hiscore(nstate *state) {}
+#endif
+
+int will_collide(nstate *state, int x, int y, int orientation)
+{
+	int r, c, xx, yy;
+	char ch = 0;
+
+	draw_shape(state, state->current_shape.x, state->current_shape.y, 1);
+	for(r = 0; ch < 3; r++) {
+		ch = 0;
+		for(c = 0; ch < 2; c++) {
+			ch = shapes[state->current_shape.type]
+				[state->current_shape.orientation][r][c];
+			if(ch == 1) {
+				yy = y + r;
+				xx = x + c;
+				if((yy == WELL_HEIGHT) || (xx == WELL_WIDTH) ||
+						(state->blocks[0][yy][xx])) {
+					draw_shape(state,
+						state->current_shape.x,
+						state->current_shape.y, 0);
+					return 1;
+				}
+			}
+		}
+	}
+	draw_shape(state, state->current_shape.x, state->current_shape.y, 0);
+
+	return 0;
+}
+
+void draw_shape(nstate *state, GR_COORD x, GR_COORD y, int erase)
+{
+	int r, c, yy, xx;
+	GR_COLOR col;
+	char ch = 0;
+
+	if(erase) col = 0;
+	else col = state->current_shape.colour;
+
+	for(r = 0; ch < 3; r++) {
+		ch = 0;
+		for(c = 0; ch < 2; c++) {
+			ch = shapes[state->current_shape.type]
+				[state->current_shape.orientation][r][c];
+			if(ch == 1) {
+				yy = y + r;
+				xx = x + c;
+				state->blocks[0][yy][xx] = col;
+			}
+		}
+	}
+}
+
+void draw_well(nstate *state, int forcedraw)
+{
+	int x, y;
+
+	for(y = WELL_NOTVISIBLE; y < WELL_HEIGHT; y++) {
+		for(x = 0; x < WELL_WIDTH; x++) {
+			if(forcedraw || (state->blocks[0][y][x] !=
+						state->blocks[1][y][x])) {
+				state->blocks[1][y][x] = state->blocks[0][y][x];
+				GrSetGCForeground(state->wellgc,
+							state->blocks[0][y][x]);
+				GrFillRect(state->well_window, state->wellgc,
+					(BLOCK_SIZE * x),
+					(BLOCK_SIZE * (y - WELL_NOTVISIBLE)),
+						BLOCK_SIZE, BLOCK_SIZE);
+			}
+		}
+	}
+
+	GrFlush();
+}
+
+void draw_score(nstate *state)
+{
+	char buf[32];
+
+	GrFillRect(state->score_window, state->scoregcb, 0, 0,
+			SCORE_WINDOW_WIDTH, SCORE_WINDOW_HEIGHT);
+
+	sprintf(buf, "%d", state->score);
+	GrText(state->score_window, state->scoregcf, TEXT_X_POSITION,
+					TEXT2_Y_POSITION, buf, strlen(buf), 0);
+	sprintf(buf, "%d", state->hiscore);
+	GrText(state->score_window, state->scoregcf, TEXT_X_POSITION,
+					TEXT_Y_POSITION, buf, strlen(buf), 0);
+}
+
+void draw_next_shape(nstate *state)
+{
+	int r, c, startx, starty, x, y;
+	char ch = 0;
+
+	GrFillRect(state->next_shape_window, state->nextshapegcb, 0, 0,
+			NEXT_SHAPE_WINDOW_WIDTH, NEXT_SHAPE_WINDOW_HEIGHT);
+
+	GrSetGCForeground(state->nextshapegcf, state->next_shape.colour);
+
+	startx = (BLOCK_SIZE * ((NEXT_SHAPE_WINDOW_SIZE / 2) -
+			(shape_sizes[state->next_shape.type]
+			[state->next_shape.orientation][0] / 2)));
+	starty = (BLOCK_SIZE * ((NEXT_SHAPE_WINDOW_SIZE / 2) -
+			(shape_sizes[state->next_shape.type]
+			[state->next_shape.orientation][1] / 2)));
+
+	for(r = 0; ch < 3; r++) {
+		ch = 0;
+		for(c = 0; ch < 2; c++) {
+			ch = shapes[state->next_shape.type]
+				[state->next_shape.orientation][r][c];
+			if(ch == 1) {
+				x = startx + (c * BLOCK_SIZE);
+				y = starty + (r * BLOCK_SIZE);
+				GrFillRect(state->next_shape_window,
+					state->nextshapegcf, x, y,
+					BLOCK_SIZE, BLOCK_SIZE);
+			}
+		}
+	}
+}
+
+void draw_new_game_button(nstate *state)
+{
+	GrFillRect(state->new_game_button, state->buttongcb, 0, 0,
+			NEW_GAME_BUTTON_WIDTH, NEW_GAME_BUTTON_HEIGHT);
+	GrText(state->new_game_button, state->buttongcf, TEXT_X_POSITION,
+					TEXT_Y_POSITION, "New Game", 8, 0);
+}
+
+void draw_anticlockwise_button(nstate *state)
+{
+	if(!state->running_buttons_mapped) return;
+	GrFillRect(state->anticlockwise_button, state->buttongcb, 0, 0,
+		ANTICLOCKWISE_BUTTON_WIDTH, ANTICLOCKWISE_BUTTON_HEIGHT);
+	GrText(state->anticlockwise_button, state->buttongcf, TEXT_X_POSITION,
+					TEXT_Y_POSITION, "   /", 4, 0);
+}
+
+void draw_clockwise_button(nstate *state)
+{
+	if(!state->running_buttons_mapped) return;
+	GrFillRect(state->clockwise_button, state->buttongcb, 0, 0,
+			CLOCKWISE_BUTTON_WIDTH, CLOCKWISE_BUTTON_HEIGHT);
+	GrText(state->clockwise_button, state->buttongcf, TEXT_X_POSITION,
+					TEXT_Y_POSITION, "   \\", 4, 0);
+}
+
+void draw_left_button(nstate *state)
+{
+	if(!state->running_buttons_mapped) return;
+	GrFillRect(state->left_button, state->buttongcb, 0, 0,
+			LEFT_BUTTON_WIDTH, LEFT_BUTTON_HEIGHT);
+	GrText(state->left_button, state->buttongcf, TEXT_X_POSITION,
+					TEXT_Y_POSITION, "  <", 3, 0);
+}
+
+void draw_right_button(nstate *state)
+{
+	if(!state->running_buttons_mapped) return;
+	GrFillRect(state->right_button, state->buttongcb, 0, 0,
+			RIGHT_BUTTON_WIDTH, RIGHT_BUTTON_HEIGHT);
+	GrText(state->right_button, state->buttongcf, TEXT_X_POSITION,
+					TEXT_Y_POSITION, "   >", 4, 0);
+}
+
+void draw_drop_button(nstate *state)
+{
+	if(!state->running_buttons_mapped) return;
+	GrFillRect(state->drop_button, state->buttongcb, 0, 0,
+			DROP_BUTTON_WIDTH, DROP_BUTTON_HEIGHT);
+	GrText(state->drop_button, state->buttongcf, TEXT_X_POSITION,
+					TEXT_Y_POSITION, "    Drop", 8, 0);
+}
+
+void draw_pause_continue_button(nstate *state)
+{
+	if((state->running_buttons_mapped) && (state->state == STATE_STOPPED)) {
+		GrUnmapWindow(state->pause_continue_button);
+		GrUnmapWindow(state->anticlockwise_button);
+		GrUnmapWindow(state->clockwise_button);
+		GrUnmapWindow(state->left_button);
+		GrUnmapWindow(state->right_button);
+		GrUnmapWindow(state->drop_button);
+		state->running_buttons_mapped = 0;
+		return;
+	}
+	if((!state->running_buttons_mapped) && (state->state == STATE_RUNNING)){
+		GrMapWindow(state->pause_continue_button);
+		GrMapWindow(state->anticlockwise_button);
+		GrMapWindow(state->clockwise_button);
+		GrMapWindow(state->left_button);
+		GrMapWindow(state->right_button);
+		GrMapWindow(state->drop_button);
+		state->running_buttons_mapped = 1;
+		return;
+	}
+	if(!state->running_buttons_mapped) return;
+	GrFillRect(state->pause_continue_button, state->buttongcb, 0, 0,
+		PAUSE_CONTINUE_BUTTON_WIDTH, PAUSE_CONTINUE_BUTTON_HEIGHT);
+	if(state->state == STATE_PAUSED) {
+		GrText(state->pause_continue_button, state->buttongcf,
+			TEXT_X_POSITION, TEXT_Y_POSITION, " Continue", 9, 0);
+	} else {
+		GrText(state->pause_continue_button, state->buttongcf,
+			TEXT_X_POSITION, TEXT_Y_POSITION, "   Pause", 8, 0);
+	}
+}
+
+int block_is_all_in_well(nstate *state)
+{
+	if(state->current_shape.y >= WELL_NOTVISIBLE)
+		return 1;
+
+	return 0;
+}
+
+void delete_line(nstate *state, int line)
+{
+	int x, y;
+
+	if(line < WELL_NOTVISIBLE) return;
+
+	for(y = line - 1; y; y--)
+		for(x = WELL_WIDTH; x; x--)
+			state->blocks[0][y + 1][x] = state->blocks[0][y][x];
+
+	draw_well(state, 0);
+}
+
+void block_reached_bottom(nstate *state)
+{
+	int x, y;
+
+	if(!block_is_all_in_well(state)) {
+		state->state = STATE_STOPPED;
+		return;
+	}
+
+	for(y = WELL_HEIGHT - 1; y; y--) {
+		for(x = 0; x < WELL_WIDTH; x++)
+			if(!state->blocks[0][y][x]) goto nr;
+		msleep(DELETE_LINE_DELAY);
+		delete_line(state, y);
+		state->score += SCORE_INCREMENT;
+		if((LEVELS > (state->level + 1)) && (((state->level + 1) *
+					LEVEL_DIVISOR) <= state->score))
+			state->level++;
+		draw_score(state);
+		y++;
+		nr:
+	}
+
+	choose_new_shape(state);
+	draw_next_shape(state);
+}
+
+void move_block(nstate *state, int direction)
+{
+	if(direction == 0) {
+ 		if(!state->current_shape.x) return;
+		else {
+			if(!will_collide(state, (state->current_shape.x - 1),
+						state->current_shape.y,
+					state->current_shape.orientation)) {
+				draw_shape(state, state->current_shape.x,
+						state->current_shape.y, 1);
+				state->current_shape.x--;
+				draw_shape(state, state->current_shape.x,
+						state->current_shape.y, 0);
+				draw_well(state, 0);
+			}
+		}
+	} else {
+		if(!will_collide(state, (state->current_shape.x + 1),
+						state->current_shape.y,
+					state->current_shape.orientation)) {
+			draw_shape(state, state->current_shape.x,
+					state->current_shape.y, 1);
+			state->current_shape.x++;
+			draw_shape(state, state->current_shape.x,
+					state->current_shape.y, 0);
+			draw_well(state, 0);
+		}
+	}
+}
+
+void rotate_block(nstate *state, int direction)
+{
+	int neworientation = 0;
+
+	if(direction == 0) {
+		if(!state->current_shape.orientation)
+			neworientation = MAXORIENTATIONS - 1;
+		else neworientation = state->current_shape.orientation - 1;
+	} else {
+		neworientation = state->current_shape.orientation + 1;
+		if(neworientation == MAXORIENTATIONS) neworientation = 0;
+	}
+
+	if(!will_collide(state, state->current_shape.x, state->current_shape.y,
+							neworientation)) {
+		draw_shape(state, state->current_shape.x,
+				state->current_shape.y, 1);
+		state->current_shape.orientation = neworientation;
+		draw_shape(state, state->current_shape.x,
+				state->current_shape.y, 0);
+		draw_well(state, 0);
+	}
+}
+
+int drop_block_1(nstate *state)
+{
+	if(will_collide(state, state->current_shape.x,
+				(state->current_shape.y + 1),
+				state->current_shape.orientation)) {
+		block_reached_bottom(state);
+		return 1;
+	}
+
+	draw_shape(state, state->current_shape.x, state->current_shape.y, 1);
+	state->current_shape.y++;
+	draw_shape(state, state->current_shape.x, state->current_shape.y, 0);
+
+	draw_well(state, 0);
+
+	return 0;
+}
+
+void drop_block(nstate *state)
+{
+	while(!drop_block_1(state)) msleep(DROP_BLOCK_DELAY);
+}
+
+void handle_exposure_event(nstate *state)
+{
+	GR_EVENT_EXPOSURE *event = &state->event.exposure;
+
+	if(event->wid == state->score_window) {
+		draw_score(state);
+		return;
+	}
+	if(event->wid == state->next_shape_window) {
+		draw_next_shape(state);
+		return;
+	}
+	if(event->wid == state->new_game_button) {
+		draw_new_game_button(state);
+		return;
+	}
+	if(event->wid == state->pause_continue_button) {
+		draw_pause_continue_button(state);
+		return;
+	}
+	if(event->wid == state->anticlockwise_button) {
+		draw_anticlockwise_button(state);
+		return;
+	}
+	if(event->wid == state->clockwise_button) {
+		draw_clockwise_button(state);
+		return;
+	}
+	if(event->wid == state->left_button) {
+		draw_left_button(state);
+		return;
+	}
+	if(event->wid == state->right_button) {
+		draw_right_button(state);
+		return;
+	}
+	if(event->wid == state->drop_button) {
+		draw_drop_button(state);
+		return;
+	}
+	if(event->wid == state->well_window) {
+		draw_well(state, 1);
+		return;
+	}
+}
+
+void handle_mouse_event(nstate *state)
+{
+	GR_EVENT_MOUSE *event = &state->event.mouse;
+
+	if(event->wid == state->new_game_button) {
+		state->state = STATE_NEWGAME;
+		return;
+	}
+	if(event->wid == state->pause_continue_button) {
+		if(state->state == STATE_PAUSED) state->state = STATE_RUNNING;
+		else state->state = STATE_PAUSED;
+		return;
+	}
+	if(event->wid == state->anticlockwise_button) {
+		if(state->state == STATE_PAUSED) state->state = STATE_RUNNING;
+		rotate_block(state, 0);
+		return;
+	}
+	if(event->wid == state->clockwise_button) {
+		if(state->state == STATE_PAUSED) state->state = STATE_RUNNING;
+		rotate_block(state, 1);
+		return;
+	}
+	if(event->wid == state->left_button) {
+		if(state->state == STATE_PAUSED) state->state = STATE_RUNNING;
+		move_block(state, 0);
+		return;
+	}
+	if(event->wid == state->right_button) {
+		if(state->state == STATE_PAUSED) state->state = STATE_RUNNING;
+		move_block(state, 1);
+		return;
+	}
+	if(event->wid == state->drop_button) {
+		if(state->state == STATE_PAUSED) state->state = STATE_RUNNING;
+		drop_block(state);
+		return;
+	}
+}
+
+void handle_keyboard_event(nstate *state)
+{
+	GR_EVENT_KEYSTROKE *event = &state->event.keystroke;
+	char c = toupper(event->ch);
+
+	switch(c) {
+		case 'Q':
+			state->state = STATE_EXIT;
+			return;
+		case 'N':
+			state->state = STATE_NEWGAME;
+			return;
+	}
+
+	if(state->state == STATE_STOPPED) return;
+
+	state->state = STATE_RUNNING;
+
+	switch(c) {
+		case 'P':
+			state->state = STATE_PAUSED;
+			break;
+		case 'J':
+			move_block(state, 0);
+			break;
+		case 'K':
+			move_block(state, 1);
+			break;
+		case 'D':
+			rotate_block(state, 0);
+			break;
+		case 'F':
+			rotate_block(state, 1);
+			break;
+		case ' ':
+			drop_block(state);
+			break;
+	}
+}
+
+void handle_event(nstate *state)
+{
+	switch(state->event.type) {
+		case GR_EVENT_TYPE_EXPOSURE:
+			handle_exposure_event(state);
+			break;
+		case GR_EVENT_TYPE_BUTTON_DOWN:
+			handle_mouse_event(state);
+			break;
+		case GR_EVENT_TYPE_KEY_DOWN:
+			handle_keyboard_event(state);
+			break;
+		case GR_EVENT_TYPE_CLOSE_REQ:
+			state->state = STATE_EXIT;
+			break;
+		case GR_EVENT_TYPE_TIMEOUT:
+			break;
+		default:
+			fprintf(stderr, "Unhandled event type %d\n",
+							state->event.type);
+			break;
+	}
+}
+
+void clear_well(nstate *state)
+{
+	int x, y;
+
+	for(y = 0; y < WELL_HEIGHT; y++)
+		for(x = 0; x < WELL_WIDTH; x++) {
+			state->blocks[0][y][x] = 0;
+			state->blocks[1][y][x] = 0;
+		}
+}
+
+/* Dirty hack alert- this is to avoid using any floating point math */
+int random8(int limit)
+{
+	int ret;
+
+	do { ret = random() & 7; } while(ret > limit);
+
+	return ret;
+}
+
+void choose_new_shape(nstate *state)
+{
+	state->current_shape.type = state->next_shape.type;
+	state->current_shape.orientation = state->next_shape.orientation;
+	state->current_shape.colour = state->next_shape.colour;
+	state->current_shape.x = (WELL_WIDTH / 2) - 2;
+	state->current_shape.y = WELL_NOTVISIBLE -
+			shape_sizes[state->next_shape.type]
+				[state->next_shape.orientation][1] - 1;
+	state->next_shape.type = random8(MAXSHAPES - 1);
+	state->next_shape.orientation = random8(MAXORIENTATIONS - 1);
+	state->next_shape.colour = block_colours[random8(MAX_BLOCK_COLOUR)];
+}
+
+void new_game(nstate *state)
+{
+	clear_well(state);
+	if(state->score > state->hiscore) state->hiscore = state->score;
+	state->score = 0;
+	state->level = 0;
+	draw_score(state);
+	choose_new_shape(state);
+	draw_next_shape(state);
+	draw_well(state, 1);
+	if(state->state == STATE_NEWGAME) state->state = STATE_RUNNING;
+}
+
+void init_game(nstate *state)
+{
+	if(GrOpen() < 0) {
+		fprintf(stderr, "Couldn't connect to Nano-X server\n");
+		exit(1);
+	}
+
+	state->main_window = GrNewWindow(GR_ROOT_WINDOW_ID,
+					MAIN_WINDOW_X_POSITION,
+					MAIN_WINDOW_Y_POSITION,
+					MAIN_WINDOW_WIDTH,
+					MAIN_WINDOW_HEIGHT, 0,
+					MAIN_WINDOW_BACKGROUND_COLOUR, 0);
+	GrSelectEvents(state->main_window, GR_EVENT_MASK_EXPOSURE |
+					GR_EVENT_MASK_CLOSE_REQ |
+					GR_EVENT_MASK_KEY_DOWN |
+					GR_EVENT_MASK_TIMEOUT);
+
+	state->score_window = GrNewWindow(state->main_window,
+					SCORE_WINDOW_X_POSITION,
+					SCORE_WINDOW_Y_POSITION,
+					SCORE_WINDOW_WIDTH,
+					SCORE_WINDOW_HEIGHT, 0,
+					SCORE_WINDOW_BACKGROUND_COLOUR, 0);
+	GrSelectEvents(state->score_window, GR_EVENT_MASK_EXPOSURE);
+	GrMapWindow(state->score_window);
+	state->scoregcf = GrNewGC();
+	GrSetGCForeground(state->scoregcf, SCORE_WINDOW_FOREGROUND_COLOUR);
+	GrSetGCBackground(state->scoregcf, SCORE_WINDOW_BACKGROUND_COLOUR);
+	state->scoregcb = GrNewGC();
+	GrSetGCForeground(state->scoregcb, SCORE_WINDOW_BACKGROUND_COLOUR);
+
+	state->next_shape_window = GrNewWindow(state->main_window,
+					NEXT_SHAPE_WINDOW_X_POSITION,
+					NEXT_SHAPE_WINDOW_Y_POSITION,
+					NEXT_SHAPE_WINDOW_WIDTH,
+					NEXT_SHAPE_WINDOW_HEIGHT, 0,
+					NEXT_SHAPE_WINDOW_BACKGROUND_COLOUR, 0);
+	GrSelectEvents(state->next_shape_window, GR_EVENT_MASK_EXPOSURE);
+	GrMapWindow(state->next_shape_window);
+	state->nextshapegcf = GrNewGC();
+	state->nextshapegcb = GrNewGC();
+	GrSetGCForeground(state->nextshapegcb,
+				NEXT_SHAPE_WINDOW_BACKGROUND_COLOUR);
+
+	state->new_game_button = GrNewWindow(state->main_window,
+					NEW_GAME_BUTTON_X_POSITION,
+					NEW_GAME_BUTTON_Y_POSITION,
+					NEW_GAME_BUTTON_WIDTH,
+					NEW_GAME_BUTTON_HEIGHT, 0,
+					BUTTON_BACKGROUND_COLOUR, 0);
+	GrSelectEvents(state->new_game_button, GR_EVENT_MASK_EXPOSURE |
+					GR_EVENT_MASK_BUTTON_DOWN);
+	GrMapWindow(state->new_game_button);
+	state->buttongcf = GrNewGC();
+	GrSetGCForeground(state->buttongcf, BUTTON_FOREGROUND_COLOUR);
+	GrSetGCBackground(state->buttongcf, BUTTON_BACKGROUND_COLOUR);
+	state->buttongcb = GrNewGC();
+	GrSetGCForeground(state->buttongcb, BUTTON_BACKGROUND_COLOUR);
+
+	state->pause_continue_button = GrNewWindow(state->main_window,
+					PAUSE_CONTINUE_BUTTON_X_POSITION,
+					PAUSE_CONTINUE_BUTTON_Y_POSITION,
+					PAUSE_CONTINUE_BUTTON_WIDTH,
+					PAUSE_CONTINUE_BUTTON_HEIGHT, 0,
+					BUTTON_BACKGROUND_COLOUR, 0);
+	GrSelectEvents(state->pause_continue_button, GR_EVENT_MASK_EXPOSURE |
+					GR_EVENT_MASK_BUTTON_DOWN);
+
+	state->anticlockwise_button = GrNewWindow(state->main_window,
+					ANTICLOCKWISE_BUTTON_X_POSITION,
+					ANTICLOCKWISE_BUTTON_Y_POSITION,
+					ANTICLOCKWISE_BUTTON_WIDTH,
+					ANTICLOCKWISE_BUTTON_HEIGHT, 0,
+					BUTTON_BACKGROUND_COLOUR,
+					0);
+	GrSelectEvents(state->anticlockwise_button, GR_EVENT_MASK_EXPOSURE |
+					GR_EVENT_MASK_BUTTON_DOWN);
+
+	state->clockwise_button = GrNewWindow(state->main_window,
+					CLOCKWISE_BUTTON_X_POSITION,
+					CLOCKWISE_BUTTON_Y_POSITION,
+					CLOCKWISE_BUTTON_WIDTH,
+					CLOCKWISE_BUTTON_HEIGHT, 0,
+					BUTTON_BACKGROUND_COLOUR,
+					0);
+	GrSelectEvents(state->clockwise_button, GR_EVENT_MASK_EXPOSURE |
+					GR_EVENT_MASK_BUTTON_DOWN);
+
+	state->left_button = GrNewWindow(state->main_window,
+					LEFT_BUTTON_X_POSITION,
+					LEFT_BUTTON_Y_POSITION,
+					LEFT_BUTTON_WIDTH,
+					LEFT_BUTTON_HEIGHT, 0,
+					BUTTON_BACKGROUND_COLOUR,
+					0);
+	GrSelectEvents(state->left_button, GR_EVENT_MASK_EXPOSURE |
+					GR_EVENT_MASK_BUTTON_DOWN);
+
+	state->right_button = GrNewWindow(state->main_window,
+					RIGHT_BUTTON_X_POSITION,
+					RIGHT_BUTTON_Y_POSITION,
+					RIGHT_BUTTON_WIDTH,
+					RIGHT_BUTTON_HEIGHT, 0,
+					BUTTON_BACKGROUND_COLOUR,
+					0);
+	GrSelectEvents(state->right_button, GR_EVENT_MASK_EXPOSURE |
+					GR_EVENT_MASK_BUTTON_DOWN);
+
+	state->drop_button = GrNewWindow(state->main_window,
+					DROP_BUTTON_X_POSITION,
+					DROP_BUTTON_Y_POSITION,
+					DROP_BUTTON_WIDTH,
+					DROP_BUTTON_HEIGHT, 0,
+					BUTTON_BACKGROUND_COLOUR,
+					0);
+	GrSelectEvents(state->drop_button, GR_EVENT_MASK_EXPOSURE |
+					GR_EVENT_MASK_BUTTON_DOWN);
+
+	state->well_window = GrNewWindow(state->main_window,
+					WELL_WINDOW_X_POSITION,
+					WELL_WINDOW_Y_POSITION,
+					WELL_WINDOW_WIDTH,
+					WELL_WINDOW_HEIGHT, 0,
+					WELL_WINDOW_BACKGROUND_COLOUR, 0);
+	GrSelectEvents(state->well_window, GR_EVENT_MASK_EXPOSURE);
+	GrMapWindow(state->well_window);
+	state->wellgc = GrNewGC();
+
+	GrMapWindow(state->main_window);
+
+	state->state = STATE_STOPPED;
+	state->score = 0;
+	read_hiscore(state);
+	state->level = 0;
+	state->running_buttons_mapped = 0;
+
+	srandom(time(0));
+
+	choose_new_shape(state);
+	new_game(state);
+}
+
+void calculate_timeout(nstate *state)
+{
+	struct timeval t;
+	long u;
+
+	gettimeofday(&t, NULL);
+	u = t.tv_usec + (delays[state->level] * 1000);
+	state->timeout.tv_sec = t.tv_sec + (u / 1000000);
+	state->timeout.tv_usec = u % 1000000;
+}
+
+unsigned long timeout_delay(nstate *state)
+{
+	struct timeval t;
+	signed long s, m, ret;
+
+	gettimeofday(&t, NULL);
+
+	if((t.tv_sec > state->timeout.tv_sec) ||
+			((t.tv_sec == state->timeout.tv_sec) &&
+			t.tv_usec >= state->timeout.tv_usec)) return 1;
+
+	s = state->timeout.tv_sec - t.tv_sec;
+	m = ((state->timeout.tv_usec - t.tv_usec) / 1000);
+	ret = (unsigned long)((1000 * s) + m);
+/*
+	fprintf(stderr, "t.tv_sec = %ld, t.tv_usec = %ld, timeout.tv_sec = "
+		"%ld, timeout.tv_usec = %ld, s = %ld, m = %ld, ret = %ld\n",
+		t.tv_sec, t.tv_usec, state->timeout.tv_sec,	
+		state->timeout.tv_usec, s, m, ret);
+*/
+	if(ret <= 0) return 1;
+	else return ret;
+}
+
+void do_update(nstate *state)
+{
+	struct timeval t;
+
+	gettimeofday(&t, NULL);
+
+	if((t.tv_sec > state->timeout.tv_sec) ||
+			((t.tv_sec == state->timeout.tv_sec) &&
+			(t.tv_usec >= state->timeout.tv_usec))) {
+		drop_block_1(state);
+		calculate_timeout(state);
+	} 
+}
+
+void do_pause(nstate *state)
+{
+	draw_pause_continue_button(state);
+	while(state->state == STATE_PAUSED) {
+		GrGetNextEvent(&state->event);
+		handle_event(state);
+	}
+	draw_pause_continue_button(state);
+}
+
+void wait_for_start(nstate *state)
+{
+	draw_pause_continue_button(state);
+	while(state->state == STATE_STOPPED) {
+		GrGetNextEvent(&state->event);
+		handle_event(state);
+	}
+	if(state->state == STATE_NEWGAME) state->state = STATE_RUNNING;
+	draw_pause_continue_button(state);
+	calculate_timeout(state);
+}
+
+void run_game(nstate *state)
+{
+	while(state->state == STATE_RUNNING) {
+		GrGetNextEventTimeout(&state->event, timeout_delay(state));
+		handle_event(state);
+		if(state->state == STATE_PAUSED) do_pause(state);
+		if(state->state == STATE_RUNNING) do_update(state);
+	}
+}
+
+void main_game_loop(nstate *state)
+{
+	wait_for_start(state);
+	while(state->state != STATE_EXIT) {
+		if(state->state == STATE_RUNNING) run_game(state);
+		if(state->state == STATE_STOPPED) wait_for_start(state);
+		if(state->state != STATE_EXIT) new_game(state);
+	}
+}
+
+int main(int argc, char *argv[])
+{
+	nstate *state = my_malloc(sizeof(nstate));
+
+	init_game(state);
+	main_game_loop(state);
+
+	write_hiscore(state);
+
+	GrClose();
+
+	return 0;
+}
diff -urN lib/microwindows/src/demos/nanox/ntetris.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/ntetris.h
--- lib/microwindows/src/demos/nanox/ntetris.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/ntetris.h	2005-02-21 16:12:57.000000000 +0100
@@ -0,0 +1,408 @@
+#ifndef NTETRIS_H
+#define NTETRIS_H
+
+/*
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ * 
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ * 
+ * The Original Code is NanoTetris.
+ * 
+ * The Initial Developer of the Original Code is Alex Holden.
+ * Portions created by Alex Holden are Copyright (C) 2000
+ * Alex Holden <alex@linuxhacker.org>. All Rights Reserved.
+ * 
+ * Contributor(s):
+ * 
+ * Alternatively, the contents of this file may be used under the terms
+ * of the GNU General Public license (the  "[GNU] License"), in which case the
+ * provisions of [GNU] License are applicable instead of those
+ * above.  If you wish to allow use of your version of this file only
+ * under the terms of the [GNU] License and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting  the provisions above and replace  them with the notice and
+ * other provisions required by the [GNU] License.  If you do not delete
+ * the provisions above, a recipient may use your version of this file
+ * under either the MPL or the [GNU] License.
+ */
+
+/*
+ * Anything which is configurable should be in this file.
+ * Unfortunately I haven't really bothered to comment anything except for the
+ * array of shape descriptions (you can add your own new shapes quite easily).
+ */
+
+#define USE_HISCORE_FILE
+#define HISCORE_FILE "/usr/games/nanotetris.hiscore"
+#undef HAVE_USLEEP
+#define BLOCK_SIZE 10
+#define BORDER_WIDTH 10
+#define CONTROL_BAR_WIDTH 90
+#define BUTTON_HEIGHT 20
+#define BUTTON_WIDTH (CONTROL_BAR_WIDTH - BORDER_WIDTH)
+#define BUTTON_BACKGROUND_COLOUR LTGRAY
+#define BUTTON_FOREGROUND_COLOUR BLACK
+#define MOVEMENT_BUTTON_WIDTH ((BUTTON_WIDTH / 2) - 1)
+#define TEXT_X_POSITION 5
+#define TEXT_Y_POSITION 15
+#define TEXT2_Y_POSITION 30
+#define WELL_WIDTH 12
+#define WELL_HEIGHT 28
+#define WELL_VISIBLE_HEIGHT 24
+#define WELL_NOTVISIBLE (WELL_HEIGHT - WELL_VISIBLE_HEIGHT)
+#define LEVEL_DIVISOR 500
+#define DROP_BLOCK_DELAY 25
+#define DELETE_LINE_DELAY 300
+#define SCORE_INCREMENT 100
+
+#define MAIN_WINDOW_X_POSITION 0
+#define MAIN_WINDOW_Y_POSITION 0
+#define MAIN_WINDOW_WIDTH (CONTROL_BAR_WIDTH + (2 * BORDER_WIDTH) + \
+					(WELL_WIDTH * BLOCK_SIZE))
+#define MAIN_WINDOW_HEIGHT ((2 * BORDER_WIDTH) + \
+					(WELL_VISIBLE_HEIGHT * BLOCK_SIZE))
+#define MAIN_WINDOW_BACKGROUND_COLOUR BLUE
+
+#define SCORE_WINDOW_WIDTH BUTTON_WIDTH
+#define SCORE_WINDOW_HEIGHT 35
+#define SCORE_WINDOW_X_POSITION BORDER_WIDTH
+#define SCORE_WINDOW_Y_POSITION BORDER_WIDTH
+#define SCORE_WINDOW_BACKGROUND_COLOUR BLACK
+#define SCORE_WINDOW_FOREGROUND_COLOUR LTGREEN
+
+#define NEXT_SHAPE_WINDOW_SIZE 6
+#define NEXT_SHAPE_WINDOW_WIDTH (NEXT_SHAPE_WINDOW_SIZE * BLOCK_SIZE)
+#define NEXT_SHAPE_WINDOW_HEIGHT (NEXT_SHAPE_WINDOW_SIZE * BLOCK_SIZE)
+#define NEXT_SHAPE_WINDOW_X_POSITION (BORDER_WIDTH + 10)
+#define NEXT_SHAPE_WINDOW_Y_POSITION ((2 * BORDER_WIDTH) + SCORE_WINDOW_HEIGHT)
+#define NEXT_SHAPE_WINDOW_BACKGROUND_COLOUR BLACK
+
+#define NEW_GAME_BUTTON_WIDTH BUTTON_WIDTH
+#define NEW_GAME_BUTTON_HEIGHT BUTTON_HEIGHT
+#define NEW_GAME_BUTTON_X_POSITION BORDER_WIDTH
+#define NEW_GAME_BUTTON_Y_POSITION ((3 * BORDER_WIDTH) + SCORE_WINDOW_HEIGHT \
+						+ NEXT_SHAPE_WINDOW_HEIGHT)
+
+#define PAUSE_CONTINUE_BUTTON_WIDTH BUTTON_WIDTH
+#define PAUSE_CONTINUE_BUTTON_HEIGHT BUTTON_HEIGHT
+#define PAUSE_CONTINUE_BUTTON_X_POSITION BORDER_WIDTH
+#define PAUSE_CONTINUE_BUTTON_Y_POSITION ((4 * BORDER_WIDTH) + \
+			SCORE_WINDOW_HEIGHT + NEXT_SHAPE_WINDOW_HEIGHT + \
+						NEW_GAME_BUTTON_HEIGHT)
+
+#define ANTICLOCKWISE_BUTTON_WIDTH MOVEMENT_BUTTON_WIDTH
+#define ANTICLOCKWISE_BUTTON_HEIGHT BUTTON_HEIGHT
+#define ANTICLOCKWISE_BUTTON_X_POSITION BORDER_WIDTH
+#define ANTICLOCKWISE_BUTTON_Y_POSITION ((5 * BORDER_WIDTH) + \
+			SCORE_WINDOW_HEIGHT + NEXT_SHAPE_WINDOW_HEIGHT + \
+			NEW_GAME_BUTTON_HEIGHT + PAUSE_CONTINUE_BUTTON_HEIGHT)
+
+#define CLOCKWISE_BUTTON_WIDTH MOVEMENT_BUTTON_WIDTH
+#define CLOCKWISE_BUTTON_HEIGHT BUTTON_HEIGHT
+#define CLOCKWISE_BUTTON_X_POSITION (ANTICLOCKWISE_BUTTON_X_POSITION + \
+					ANTICLOCKWISE_BUTTON_WIDTH + 2)
+#define CLOCKWISE_BUTTON_Y_POSITION ANTICLOCKWISE_BUTTON_Y_POSITION
+
+#define LEFT_BUTTON_WIDTH MOVEMENT_BUTTON_WIDTH
+#define LEFT_BUTTON_HEIGHT BUTTON_HEIGHT
+#define LEFT_BUTTON_X_POSITION BORDER_WIDTH
+#define LEFT_BUTTON_Y_POSITION (ANTICLOCKWISE_BUTTON_Y_POSITION + \
+				ANTICLOCKWISE_BUTTON_HEIGHT + 2)
+
+#define RIGHT_BUTTON_WIDTH MOVEMENT_BUTTON_WIDTH
+#define RIGHT_BUTTON_HEIGHT BUTTON_HEIGHT
+#define RIGHT_BUTTON_X_POSITION (LEFT_BUTTON_X_POSITION + LEFT_BUTTON_WIDTH + 2)
+#define RIGHT_BUTTON_Y_POSITION LEFT_BUTTON_Y_POSITION
+
+#define DROP_BUTTON_WIDTH BUTTON_WIDTH
+#define DROP_BUTTON_HEIGHT BUTTON_HEIGHT
+#define DROP_BUTTON_X_POSITION BORDER_WIDTH
+#define DROP_BUTTON_Y_POSITION (LEFT_BUTTON_Y_POSITION + LEFT_BUTTON_HEIGHT + 2)
+
+#define WELL_WINDOW_WIDTH (BLOCK_SIZE * WELL_WIDTH)
+#define WELL_WINDOW_HEIGHT (BLOCK_SIZE * WELL_VISIBLE_HEIGHT)
+#define WELL_WINDOW_X_POSITION (CONTROL_BAR_WIDTH + BORDER_WIDTH)
+#define WELL_WINDOW_Y_POSITION BORDER_WIDTH
+#define WELL_WINDOW_BACKGROUND_COLOUR BLACK
+
+enum {
+	STATE_STOPPED,
+	STATE_RUNNING,
+	STATE_PAUSED,
+	STATE_NEWGAME,
+	STATE_EXIT,
+	STATE_UNKNOWN
+};
+
+typedef GR_COLOR block;
+
+struct ntetris_shape {
+	int type;
+	int orientation;
+	GR_COLOR colour;
+	int x;
+	int y;
+};
+typedef struct ntetris_shape shape;
+
+struct ntetris_state {
+	block blocks[2][WELL_HEIGHT][WELL_WIDTH];
+	int score;
+	int hiscore;
+	int fhiscore;
+	int level;
+	int state;
+	int running_buttons_mapped;
+	shape current_shape;
+	shape next_shape;
+	GR_WINDOW_ID main_window;
+	GR_WINDOW_ID score_window;
+	GR_WINDOW_ID next_shape_window;
+	GR_WINDOW_ID new_game_button;
+	GR_WINDOW_ID pause_continue_button;
+	GR_WINDOW_ID anticlockwise_button;
+	GR_WINDOW_ID clockwise_button;
+	GR_WINDOW_ID left_button;
+	GR_WINDOW_ID right_button;
+	GR_WINDOW_ID drop_button;
+	GR_WINDOW_ID well_window;
+	GR_GC_ID scoregcf;
+	GR_GC_ID scoregcb;
+	GR_GC_ID nextshapegcf;
+	GR_GC_ID nextshapegcb;
+	GR_GC_ID buttongcf;
+	GR_GC_ID buttongcb;
+	GR_GC_ID wellgc;
+	GR_EVENT event;
+	struct timeval timeout;
+};
+typedef struct ntetris_state nstate;
+
+void *my_malloc(size_t size);
+void msleep(long ms);
+void read_hiscore(nstate *state);
+void write_hiscore(nstate *state);
+int will_collide(nstate *state, int x, int y, int orientation);
+void draw_shape(nstate *state, GR_COORD x, GR_COORD y, int erase);
+void draw_well(nstate *state, int forcedraw);
+void draw_score(nstate *state);
+void draw_next_shape(nstate *state);
+void draw_new_game_button(nstate *state);
+void draw_anticlockwise_button(nstate *state);
+void draw_clockwise_button(nstate *state);
+void draw_left_button(nstate *state);
+void draw_right_button(nstate *state);
+void draw_drop_button(nstate *state);
+void draw_pause_continue_button(nstate *state);
+int block_is_all_in_well(nstate *state);
+void delete_line(nstate *state, int line);
+void block_reached_bottom(nstate *state);
+void move_block(nstate *state, int direction);
+void rotate_block(nstate *state, int direction);
+void drop_block(nstate *state);
+void handle_exposure_event(nstate *state);
+void handle_mouse_event(nstate *state);
+void handle_keyboard_event(nstate *state);
+void handle_event(nstate *state);
+void clear_well(nstate *state);
+int random8(int limit);
+void choose_new_shape(nstate *state);
+void new_game(nstate *state);
+void init_game(nstate *state);
+void calculate_timeout(nstate *state);
+unsigned long timeout_delay(nstate *state);
+void do_update(nstate *state);
+void do_pause(nstate *state);
+void wait_for_start(nstate *state);
+void run_game(nstate *state);
+void main_game_loop(nstate *state);
+
+#define LEVELS 12
+static const int delays[] = {600, 550, 500, 450, 400, 350,
+				300, 250, 200, 150, 100, 50};
+#define MAX_BLOCK_COLOUR 3
+static const GR_COLOR block_colours[] = {
+	LTRED, LTGREEN, LTBLUE, YELLOW
+};
+
+/*
+ * This isn't the most space efficient way of storing the shape patterns, but
+ * it's quick and easy to parse, and only takes a few hundred bytes of code
+ * space anyway. 0 means "not filled", 1 means "filled", 2 means "go to next
+ * line", and 3 means "end of pattern". There are four patterns for each shape; 
+ * one for each orientation. Adding new shapes is quite easy- just increase
+ * MAXSHAPES by the number of shapes you add, then add the four pattern
+ * descriptions (each one should be the previous one rotated clockwise) for
+ * each shape. If you need to use more than MAXROWS rows (including the "end
+ * of line" marker), increase MAXROWS. Ditto for MAXCOLS. Increasing
+ * MAXORIENTATIONS (to get more than four orientations) may work, but it's
+ * untested, and remember that if you increase it you'll have to add the new
+ * orientations for all of the original shapes as well as your new ones. Also
+ * remember to add the new shapes the the array of shape sizes below.
+ */
+#define MAXSHAPES 7
+#define MAXORIENTATIONS 4
+#define MAXCOLS 5
+#define MAXROWS 4
+static const char shapes[MAXSHAPES][MAXORIENTATIONS][MAXROWS][MAXCOLS] = {
+	{ /* **** */
+		{
+			{1,1,1,1,3}
+		},
+		{
+			{1,2},
+			{1,2},
+			{1,2},
+			{1,3}
+		},
+		{
+			{1,1,1,1,3}
+		},
+		{
+			{1,2},
+			{1,2},
+			{1,2},
+			{1,3}
+		}
+	},
+	{ /*    *
+	      ***  */
+		{
+			{0,0,1,2},
+			{1,1,1,3}
+		},
+		{
+			{1,2},
+			{1,2},
+			{1,1,3}
+		},
+		{
+			{1,1,1,2},
+			{1,3}
+		},
+		{
+			{1,1,2},
+			{0,1,2},
+			{0,1,3}
+		}
+	},
+	{ /*  *
+	      ***  */
+		{
+			{1,2},
+			{1,1,1,3}
+		},
+		{
+			{1,1,2},
+			{1,2},
+			{1,3}
+		},
+		{
+			{1,1,1,2},
+			{0,0,1,3}
+		},
+		{
+			{0,1,2},
+			{0,1,2},
+			{1,1,3}
+		}
+	},
+	{ /*  **
+	       **  */
+		{
+			{1,1,2},
+			{0,1,1,3}
+		},
+		{
+			{0,1,2},
+			{1,1,2},
+			{1,3}
+		},
+		{
+			{1,1,2},
+			{0,1,1,3}
+		},
+		{
+			{0,1,2},
+			{1,1,2},
+			{1,3}
+		}
+	},
+	{ /*   **
+	      **   */
+		{
+			{0,1,1,2},
+			{1,1,3}
+		},
+		{
+			{1,2},
+			{1,1,2},
+			{0,1,3}
+		},
+		{
+			{0,1,1,2},
+			{1,1,3}
+		},
+		{
+			{1,2},
+			{1,1,2},
+			{0,1,3}
+		}
+	},
+	{ /*  **
+	      **  */
+		{
+			{1,1,2},
+			{1,1,3}
+		},
+		{
+			{1,1,2},
+			{1,1,3}
+		},
+		{
+			{1,1,2},
+			{1,1,3}
+		},
+		{
+			{1,1,2},
+			{1,1,3}
+		}
+	},
+	{ /*   *
+	      ***  */
+		{
+			{0,1,2},
+			{1,1,1,3}
+		},
+		{
+			{1,2},
+			{1,1,2},
+			{1,3}
+		},
+		{
+			{1,1,1,2},
+			{0,1,3}
+		},
+		{
+			{0,1,2},
+			{1,1,2},
+			{0,1,3}
+		}
+	}
+};
+static const unsigned char shape_sizes[MAXSHAPES][MAXORIENTATIONS][2] = {
+	{{4,1},{1,4},{4,1},{1,4}},
+	{{3,2},{2,3},{3,2},{2,3}},
+	{{3,2},{2,3},{3,2},{2,3}},
+	{{3,2},{2,3},{3,2},{2,3}},
+	{{3,2},{2,3},{3,2},{2,3}},
+	{{2,2},{2,2},{2,2},{2,2}},
+	{{3,2},{2,3},{3,2},{2,3}}
+};
+#endif
Binary files lib/microwindows/src/demos/nanox/ntetris.ppm and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/ntetris.ppm differ
diff -urN lib/microwindows/src/demos/nanox/nxclock.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nxclock.c
--- lib/microwindows/src/demos/nanox/nxclock.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nxclock.c	2005-02-21 16:12:57.000000000 +0100
@@ -0,0 +1,260 @@
+/* 
+ * nxclock - Nano-X clock program
+ *
+ * Copyright (C) 2000 by Greg Haerr <greg@censoft.com>
+ * Copyright (C) 1999 Alistair Riddoch <ajr@ecs.soton.ac.uk>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <time.h>
+#include <sys/time.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+/* If you need a clock bigger than 200x200 you will need to re-write the trig *
+ * to use longs. (Only applies under ELKS I think. */
+#define CWIDTH		100		/* Max 200 */
+#define CHEIGHT		100		/* Max 200 */
+
+/*
+ * Definitions to make it easy to define cursors
+ */
+#define	_	((unsigned) 0)		/* off bits */
+#define	X	((unsigned) 1)		/* on bits */
+#define	MASK(a,b,c,d,e,f,g) \
+	(((((((((((((a * 2) + b) * 2) + c) * 2) + d) * 2) \
+	+ e) * 2) + f) * 2) + g) << 9)
+
+static	GR_WINDOW_ID	w1;		/* id for window */
+static	GR_GC_ID	gc1;		/* graphics context for text */
+static	GR_GC_ID	gc2;		/* graphics context for rectangle */
+static int lh = -1, lm = -1, ls = -1;
+static time_t then;
+
+static unsigned char trig[91] =
+	{ 0, 4, 8, 13, 17, 22, 26, 31, 35, 40, 44, 48, 53, 57, 61, 66,
+	70, 74, 79, 83, 87, 91, 95, 100, 104, 108, 112, 116, 120, 124, 128,
+	131, 135, 139, 143, 146, 150, 154, 157, 161, 164, 167, 171, 174, 177,
+	181, 184, 187, 190, 193, 196, 198, 201, 204, 207, 209, 212, 214, 217,
+	219, 221, 223, 226, 228, 230, 232, 233, 235, 237, 238, 240, 242, 243,
+	244, 246, 247, 248, 249, 250, 251, 252, 252, 253, 254, 254, 255, 255,
+	255, 255, 255, 255}; 
+
+void do_exposure();
+void do_clock();
+void do_idle();
+void errorcatcher();			/* routine to handle errors */
+
+int
+main(int ac, char **av)
+{
+	GR_EVENT	event;		/* current event */
+	GR_BITMAP	bitmap1fg[7];	/* bitmaps for first cursor */
+	GR_BITMAP	bitmap1bg[7];
+
+	if (GrOpen() < 0) {
+		fprintf(stderr, "cannot open graphics\n");
+		exit(1);
+	}
+	
+	/* create window*/
+	w1 = GrNewWindowEx(
+		GR_WM_PROPS_NOAUTOMOVE|GR_WM_PROPS_BORDER|GR_WM_PROPS_CAPTION|
+		GR_WM_PROPS_CLOSEBOX, "nxclock", GR_ROOT_WINDOW_ID, 
+		10, 10, CWIDTH, CHEIGHT, GrGetSysColor(GR_COLOR_WINDOW));
+		
+	GrSelectEvents(w1, GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_CLOSE_REQ);
+
+	gc1 = GrNewGC();
+	gc2 = GrNewGC();
+
+	GrSetGCForeground(gc1, GrGetSysColor(GR_COLOR_WINDOW));
+	GrSetGCBackground(gc1, GrGetSysColor(GR_COLOR_WINDOWTEXT));
+	GrSetGCForeground(gc2, GrGetSysColor(GR_COLOR_WINDOWTEXT));
+	GrSetGCBackground(gc2, GrGetSysColor(GR_COLOR_WINDOW));
+
+	bitmap1bg[0] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[1] = MASK(_,X,X,X,X,X,_);
+	bitmap1bg[2] = MASK(X,X,X,X,X,X,X);
+	bitmap1bg[3] = MASK(X,X,X,X,X,X,X);
+	bitmap1bg[4] = MASK(X,X,X,X,X,X,X);
+	bitmap1bg[5] = MASK(_,X,X,X,X,X,_);
+	bitmap1bg[6] = MASK(_,_,X,X,X,_,_);
+
+	bitmap1fg[0] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[1] = MASK(_,X,_,X,_,X,_);
+	bitmap1fg[2] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[3] = MASK(X,_,_,X,X,_,X);
+	bitmap1fg[4] = MASK(_,_,_,_,_,_,_);
+	bitmap1fg[5] = MASK(_,X,_,_,_,X,_);
+	bitmap1fg[6] = MASK(_,_,_,X,_,_,_);
+
+	GrSetCursor(w1, 7, 7, 3, 3, WHITE, BLACK, bitmap1fg, bitmap1bg);
+	GrMapWindow(w1);
+
+	while (1) {
+		GrGetNextEventTimeout(&event, 500L);
+
+		switch (event.type) {
+			case GR_EVENT_TYPE_EXPOSURE:
+				do_exposure(&event.exposure);
+				break;
+
+			case GR_EVENT_TYPE_CLOSE_REQ:
+				GrClose();
+				exit(0);
+
+			case GR_EVENT_TYPE_TIMEOUT:
+				do_clock();
+				break;
+		}
+	}
+}
+
+int bsin(int angle)
+{
+	if(angle < 91) {
+		return trig[angle];
+	} else if (angle < 181) {
+		return trig[180 - angle];
+	} else if (angle < 271) {
+		return -trig[angle - 180];
+	} else if (angle < 361) {
+		return -trig[360 - angle];
+	} else {
+		return 0;
+	}
+}
+
+int bcos(int angle)
+{
+	if(angle < 91) {
+		return trig[90 - angle];
+	} else if (angle < 181) {
+		return -trig[angle - 90];
+	} else if (angle < 271) {
+		return -trig[270 - angle];
+	} else if (angle < 361) {
+		return trig[angle - 270];
+	} else {
+		return 0;
+	}
+}
+
+/*
+ * Here when an exposure event occurs.
+ */
+void
+do_exposure(ep)
+	GR_EVENT_EXPOSURE	*ep;
+{
+	GR_COORD	midx = CWIDTH / 2;
+	GR_COORD	midy = CHEIGHT / 2;
+	int i, l;
+
+/*	GrFillRect(w1, gc2, 0, 0, CWIDTH, CHEIGHT); */
+/*	GrFillEllipse(w1, gc1, midx, midy, midx, midy); */
+	GrEllipse(w1, gc2, midx, midy, midx - 1, midy - 1);
+	for(i = 0; i < 60; i++) {
+		if (i%5 == 0) {
+			l = 5;
+		} else {
+			l = 0;
+		}
+		GrLine(w1, gc2,
+			midx + (((midx - 3) * bsin(i * 6)) >> 8), 
+			midy + (((midy - 3) * bcos(i * 6)) >> 8), 
+			midx + (((midx - 3 - l) * bsin(i * 6)) >> 8), 
+			midy + (((midy - 3 - l) * bcos(i * 6)) >> 8));
+	}
+
+	lh = -1; lm = -1; ls = -1;
+	then = 0;
+	do_clock();
+}
+
+void draw_time(int hour, int minutes, int sec, GR_GC_ID gc )
+{
+	GR_COORD	midx = CWIDTH / 2;
+	GR_COORD	midy = CHEIGHT / 2;
+
+	GrLine(w1, gc1,
+		midx + (((midx - 8 - midx / 10) * bsin(ls)) >> 8), 
+		midy - (((midy - 8 - midy / 10) * bcos(ls)) >> 8), 
+		midx + (((midx - 8 - midx / 4) * bsin(ls)) >> 8), 
+		midy - (((midy - 8 - midx / 4) * bcos(ls)) >> 8));
+	GrLine(w1, gc2,
+		midx + (((midx - 8 - midx / 10) * bsin(sec)) >> 8), 
+		midy - (((midy - 8 - midy / 10) * bcos(sec)) >> 8), 
+		midx + (((midx - 8 - midx / 4) * bsin(sec)) >> 8), 
+		midy - (((midy - 8 - midx / 4) * bcos(sec)) >> 8));
+	if ((lm != minutes) || (ls == minutes)) {
+		GrLine(w1, gc1,
+			midx + (((midx - 8 - midx / 10) * bsin(lm)) >> 8), 
+			midy - (((midy - 8 - midy / 10) * bcos(lm)) >> 8), 
+			midx + (((midx / 5) * bsin(lm)) >> 8), 
+			midy - (((midy / 5) * bcos(lm)) >> 8));
+		GrLine(w1, gc2,
+			midx + (((midx - 8 - midx / 10) * bsin(minutes)) >> 8), 
+			midy - (((midy - 8 - midy / 10) * bcos(minutes)) >> 8), 
+			midx + (((midx / 5) * bsin(minutes)) >> 8), 
+			midy - (((midy / 5) * bcos(minutes)) >> 8));
+		GrLine(w1, gc1,
+			midx + (((midx - 8 - midx / 2) * bsin(lh)) >> 8), 
+			midy - (((midy - 8 - midy / 2) * bcos(lh)) >> 8), 
+			midx + (((midx / 5) * bsin(lh)) >> 8), 
+			midy - (((midy / 5) * bcos(lh)) >> 8));
+		GrLine(w1, gc2,
+			midx + (((midx - 8 - midx / 2) * bsin(hour)) >> 8), 
+			midy - (((midy - 8 - midy / 2) * bcos(hour)) >> 8), 
+			midx + (((midx / 5) * bsin(hour)) >> 8), 
+			midy - (((midy / 5) * bcos(hour)) >> 8));
+	}
+	lh = hour;
+	lm = minutes;
+	ls = sec;
+}
+
+/*
+ * Update the clock if the seconds have changed.
+ */
+void
+do_clock()
+{
+	struct timeval tv;
+	struct timezone tz;
+	struct tm * tp;
+	time_t now;
+	int minutes, hour, sec;
+
+	gettimeofday(&tv, &tz);
+	now = tv.tv_sec - (60 * tz.tz_minuteswest);
+	if (now == then) {
+		return;
+	}
+	then = now;
+	tp = gmtime(&now);
+	minutes = tp->tm_min * 6;
+	sec = tp->tm_sec * 6;
+	hour = tp->tm_hour;
+	if (hour > 12) {
+		hour -= 12;
+	}
+	hour = hour*30 + minutes/12;
+	draw_time(hour, minutes, sec, gc2);
+}
+
+#if 0
+/*
+ * Sleep a while to avoid using too much CPU time.
+ */
+void do_idle()
+{
+	struct timespec idletime;
+	idletime.tv_sec = 0;
+	idletime.tv_nsec = 100000;
+	nanosleep(&idletime, NULL);
+}
+#endif
diff -urN lib/microwindows/src/demos/nanox/nxev.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nxev.c
--- lib/microwindows/src/demos/nanox/nxev.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nxev.c	2005-02-21 16:02:58.000000000 +0100
@@ -0,0 +1,269 @@
+/*
+ * Copyright (C) 2000 by VTech Informations LTD
+ *
+ * This program is released under MPL
+ *
+ * Vladimir Cotfas <vladimircotfas@vtech.ca>, Nov 7, 2000
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+
+static	GR_WINDOW_ID	w1;		/* id for large window */
+static	GR_WINDOW_ID	w2;		/* id for child window */
+static	GR_GC_ID	gc1;		/* graphics context for text */
+
+#define ALT_CURSOR
+
+#define	WIDTH	100
+#define	HEIGHT	100
+
+#ifdef ALT_CURSOR
+/*
+ * Definitions to make it easy to define cursors
+ */
+#define _       ((unsigned) 0)          /* off bits */
+#define X       ((unsigned) 1)          /* on bits */
+#define MASK(a,b,c,d,e,f,g) \
+        (((((((((((((a * 2) + b) * 2) + c) * 2) + d) * 2) \
+        + e) * 2) + f) * 2) + g) << 9)
+#endif
+
+struct _xlat {
+	GR_UPDATE_TYPE type;
+	const char* name;
+};
+typedef struct _xlat XLAT;
+
+static XLAT update_types[] = {
+	{ 0,			"none" },
+	{ GR_UPDATE_MAP,	"GR_UPDATE_MAP" },
+	{ GR_UPDATE_UNMAP,	"GR_UPDATE_UNMAP" },
+	{ GR_UPDATE_MOVE, 	"GR_UPDATE_MOVE" },
+	{ GR_UPDATE_SIZE,	"GR_UPDATE_SIZE" },
+	{ GR_UPDATE_UNMAPTEMP,	"GR_UPDATE_UNMAPTEMP" },
+	{ GR_UPDATE_ACTIVATE,	"GR_UPDATE_ACTIVATE" },
+	{ GR_UPDATE_DESTROY,	"GR_UPDATE_DESTROY" }
+};
+#define	NR_UPDATES	7	
+		
+struct XLAT {
+	int event_type;
+	char* event_desc;
+};
+
+static struct XLAT table[] = {
+	{ GR_EVENT_TYPE_ERROR,		"GR_EVENT_TYPE_ERROR"		},
+	{ GR_EVENT_TYPE_NONE,		"GR_EVENT_TYPE_NONE"		},
+	{ GR_EVENT_TYPE_EXPOSURE,	"GR_EVENT_TYPE_EXPOSURE"	},
+	{ GR_EVENT_TYPE_BUTTON_DOWN,	"GR_EVENT_TYPE_BUTTON_DOWN"	},
+	{ GR_EVENT_TYPE_BUTTON_UP,	"GR_EVENT_TYPE_BUTTON_UP"	},
+	{ GR_EVENT_TYPE_MOUSE_ENTER,	"GR_EVENT_TYPE_MOUSE_ENTER"	},
+	{ GR_EVENT_TYPE_MOUSE_EXIT,	"GR_EVENT_TYPE_MOUSE_EXIT"	},
+	{ GR_EVENT_TYPE_MOUSE_MOTION,	"GR_EVENT_TYPE_MOUSE_MOTION"	},
+	{ GR_EVENT_TYPE_MOUSE_POSITION,	"GR_EVENT_TYPE_MOUSE_POSITION"	},
+	{ GR_EVENT_TYPE_KEY_DOWN,	"GR_EVENT_TYPE_KEY_DOWN"	},
+	{ GR_EVENT_TYPE_KEY_UP,		"GR_EVENT_TYPE_KEY_UP"		},
+	{ GR_EVENT_TYPE_FOCUS_IN,	"GR_EVENT_TYPE_FOCUS_IN"	},
+	{ GR_EVENT_TYPE_FOCUS_OUT,	"GR_EVENT_TYPE_FOCUS_OUT"	},
+	{ GR_EVENT_TYPE_FDINPUT,	"GR_EVENT_TYPE_FDINPUT"		},
+	{ GR_EVENT_TYPE_UPDATE,		"GR_EVENT_TYPE_UPDATE"		},
+	{ GR_EVENT_TYPE_CHLD_UPDATE,	"GR_EVENT_TYPE_CHLD_UPDATE"	},
+	{ GR_EVENT_TYPE_CLOSE_REQ,	"GR_EVENT_TYPE_CLOSE_REQ"	},
+};
+
+#define	table_SZ	(sizeof(table) / sizeof(table[0]))
+
+char* 
+lookupEvent(int type)
+{
+	int i;
+
+	for (i = 0; i < table_SZ; i++)
+		if (table[i].event_type == type)
+			return table[i].event_desc;
+
+	return NULL;
+}
+
+int
+main(int argc, char **argv)
+{
+	GR_EVENT	event;		/* current event */
+	
+	if (GrOpen() < 0) {
+		fprintf(stderr, "cannot open graphics\n");
+		exit(1);
+	}
+	
+	GrReqShmCmds(65536); /* shared mem is suposed to be faster */
+	
+	w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 
+			0, 0, 
+			WIDTH, HEIGHT, 
+			4, 
+			WHITE, BLACK);
+	GrSelectEvents(w1, 0xffffffffl); /* all events :) */
+	
+	w2 = GrNewWindow(w1, 
+			10, 10, 
+			WIDTH / 4, HEIGHT / 4, 
+			4, 
+			WHITE, BLACK);
+	GrSelectEvents(w2, 0xffffffffl); /* all events :) */
+
+
+	{
+	  GR_WM_PROPERTIES props;
+
+	  props.flags = GR_WM_FLAGS_PROPS | GR_WM_FLAGS_TITLE;
+
+	  props.props = GR_WM_PROPS_BORDER | GR_WM_PROPS_CAPTION | \
+	  		GR_WM_PROPS_CAPTION | GR_WM_PROPS_CLOSEBOX;
+	  props.title = "nano-X Events";
+	  GrSetWMProperties(w1, &props);
+	}
+
+	GrMapWindow(w1);
+	GrMapWindow(w2);
+
+	gc1 = GrNewGC();
+
+	GrSetGCForeground(gc1, BLACK);
+	GrSetGCBackground(gc1, WHITE);
+
+
+#ifdef ALT_CURSOR
+	{
+	        GR_BITMAP       bitmap1fg[7];   /* bitmaps for cursor */
+        	GR_BITMAP       bitmap1bg[7];
+
+		bitmap1bg[0] = MASK(X,X,X,X,X,X,X);
+		bitmap1bg[1] = MASK(_,X,X,X,X,X,_);
+		bitmap1bg[2] = MASK(_,_,X,X,X,_,_);
+		bitmap1bg[3] = MASK(_,_,_,X,_,_,_);
+		bitmap1bg[4] = MASK(_,_,X,X,X,_,_);
+		bitmap1bg[5] = MASK(_,X,X,X,X,X,_);
+		bitmap1bg[6] = MASK(X,X,X,X,X,X,X);
+
+		bitmap1fg[0] = MASK(X,X,X,X,X,X,X);
+		bitmap1fg[1] = MASK(_,X,X,X,X,X,_);
+		bitmap1fg[2] = MASK(_,_,X,X,X,_,_);
+		bitmap1fg[3] = MASK(_,_,_,X,_,_,_);
+		bitmap1fg[4] = MASK(_,_,X,X,X,_,_);
+		bitmap1fg[5] = MASK(_,X,X,X,X,X,_);
+		bitmap1fg[6] = MASK(X,X,X,X,X,X,X);
+
+		GrSetCursor(w1, 7, 7, 3, 3, WHITE, BLACK, bitmap1fg, bitmap1bg);
+	}
+#endif
+
+	
+	for (;;) {
+		GrGetNextEvent(&event);
+
+		printf("%s (0x%x)\n", \
+		       lookupEvent(event.type), event.type);
+		
+		switch(event.type) {
+		  case GR_EVENT_TYPE_EXPOSURE:
+			{
+			  printf("\twid = %d\n", event.exposure.wid);
+			  printf("\t(X, Y) = (%d, %d)\n", \
+			         event.exposure.x, event.exposure.y);
+			  printf("\twidth = %d, height = %d\n", \
+			  	 event.exposure.width, event.exposure.height);
+			}
+			break;
+		  case GR_EVENT_TYPE_BUTTON_DOWN:
+		  case GR_EVENT_TYPE_BUTTON_UP:
+			{
+			  printf("\twid = %d\n", event.button.wid);
+			  printf("\tsub-window id = %d\n", event.button.subwid);
+			  printf("\troot window (X, Y) coordinates = (%d, %d)\n", \
+			         event.button.rootx, event.button.rooty);
+			  printf("\t(X, Y) = (%d, %d)\n", \
+				 event.button.x, event.button.y);
+			  printf("\tbuttons: %04X, ", event.button.buttons);
+			  printf("changed buttons: %04X\n", event.button.changebuttons);
+			  printf("\tmodifiers: %04X\n", event.button.modifiers);
+			}
+			break;
+		  case GR_EVENT_TYPE_MOUSE_ENTER:
+		  case GR_EVENT_TYPE_MOUSE_EXIT:
+		  case GR_EVENT_TYPE_MOUSE_MOTION:
+		  case GR_EVENT_TYPE_MOUSE_POSITION:
+			{
+			  printf("\twid = %d\n", event.mouse.wid);
+			  printf("\tsub-window id = %d\n", event.mouse.subwid);
+			  printf("\troot window (X, Y) coordinates = (%d, %d)\n", \
+			         event.mouse.rootx, event.mouse.rooty);
+			  printf("\t(X, Y) = (%d, %d)\n", \
+				 event.mouse.x, event.mouse.y);
+			  printf("\tbuttons: %04X\n", event.mouse.buttons);
+			  printf("\tmodifiers: %04X\n", event.mouse.modifiers);
+			}
+			break;
+		  case GR_EVENT_TYPE_KEY_DOWN:
+		  case GR_EVENT_TYPE_KEY_UP:
+			{
+			  printf("\twid = %d\n", event.keystroke.wid);
+			  printf("\tsub-window id = %d\n", event.keystroke.subwid);
+			  printf("\troot window (X, Y) coordinates = (%d, %d)\n", \
+			         event.keystroke.rootx, event.keystroke.rooty);
+			  printf("\t(X, Y) = (%d, %d)\n", \
+				 event.keystroke.x, event.keystroke.y);
+			  printf("\tbuttons: %04X\n", event.keystroke.buttons);
+			  printf("\tmodifiers: %04X\n", event.keystroke.modifiers);
+			  printf("\tUnicode-16 keyvalue: %d, ASCII: %d\n", \
+				 (int)event.keystroke.ch, event.keystroke.ch);
+			  printf("\tscancode: %02X\n",
+				(int)event.keystroke.scancode);
+			}
+			break;
+		  case GR_EVENT_TYPE_FOCUS_IN:
+			printf("\twid = %d\n", event.general.wid);
+			printf("\told focus = %d\n", event.general.otherid);
+			break;
+		  case GR_EVENT_TYPE_FOCUS_OUT:
+			printf("\twid = %d\n", event.general.wid);
+			printf("\tnew focus = %d\n", event.general.otherid);
+			break;
+		  case GR_EVENT_TYPE_UPDATE:
+		  case GR_EVENT_TYPE_CHLD_UPDATE:
+			{
+			  printf("\twid = %d\n", event.update.wid);
+			  printf("\tsub-window id = %d\n", event.update.subwid);
+			  printf("\t(X, Y) = (%d, %d)\n", \
+				 event.update.x, event.update.y);
+			  printf("\twidth = %d, height = %d\n", \
+			  	 event.update.width, event.update.height);
+			  {
+				  GR_UPDATE_TYPE u = event.update.utype;
+				  const char* p;
+
+				  p =  (u > NR_UPDATES)? \
+					  "<unknown>": \
+					  update_types[u].name;
+
+			  	  printf("\tupdate_type: %s (%d)\n",
+					  p, u);
+			  }
+			}
+			break;
+		  case GR_EVENT_TYPE_TIMEOUT:
+		  	printf("\ttimeout?\n");
+			break;
+		  case GR_EVENT_TYPE_CLOSE_REQ:
+			GrClose();
+			exit(0);
+			/* no return*/
+		}
+	}
+
+	return 0;
+}
diff -urN lib/microwindows/src/demos/nanox/nxlsclients.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nxlsclients.c
--- lib/microwindows/src/demos/nanox/nxlsclients.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nxlsclients.c	2005-02-21 16:12:57.000000000 +0100
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2000 by VTech Informations LTD.
+ * This program is released under MPL.
+ *
+ * Vladimir Cotfas <vladimircotfas@vtech.ca> Oct 25, 2000
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+#include "windef.h"
+
+/* which is the maximim window id?!?!*/
+#define LIMIT	10000
+
+struct _colour {
+	unsigned long colour;
+	char* name;
+};
+typedef struct _colour COLOURS;
+
+static COLOURS colour_table[] = {
+	{ BLACK, "Black" },
+	{ BLUE, "Blue" },
+	{ GREEN, "Green"},
+	{ CYAN, "Cyan" },
+	{ RED, "Red" },
+	{ MAGENTA, "Magenta" },
+	{ BROWN, "Brown" },
+	{ LTGRAY, "LightGray" },
+	{ GRAY, "Gray" },
+	{ DKGRAY, "DarkGray" },
+	{ LTBLUE, "LightBlue" },
+	{ LTGREEN, "LightGreen" },
+	{ LTCYAN, "LightCyan" },
+	{ LTRED, "LightRed" },
+	{ LTMAGENTA, "LightMagenta" },
+	{ YELLOW, "Yellow" },
+	{ WHITE, "White" }
+};
+#define NR_COLOURS	(sizeof(colour_table) / sizeof(colour_table[0]))
+
+char*
+lookupColour(unsigned long c)
+{
+	int i;
+
+	for (i = 0; i < NR_COLOURS; i++)
+		if (c == colour_table[i].colour)
+			return colour_table[i].name;
+
+	return "UanbleToComply";
+}
+
+struct _xlat {
+        unsigned event_type;
+        char* event_desc;
+};
+typedef struct _xlat XLAT;
+
+static XLAT event_table[] = {
+        { GR_EVENT_TYPE_ERROR,          "GR_EVENT_MASK_ERROR"           },
+/*      { GR_EVENT_TYPE_NONE,           "GR_EVENT_MASK_NONE"            }, */
+        { GR_EVENT_TYPE_EXPOSURE,       "GR_EVENT_MASK_EXPOSURE"        },
+        { GR_EVENT_TYPE_BUTTON_DOWN,    "GR_EVENT_MASK_BUTTON_DOWN"     },
+        { GR_EVENT_TYPE_BUTTON_UP,      "GR_EVENT_MASK_BUTTON_UP"       },
+        { GR_EVENT_TYPE_MOUSE_ENTER,    "GR_EVENT_MASK_MOUSE_ENTER"     },
+        { GR_EVENT_TYPE_MOUSE_EXIT,     "GR_EVENT_MASK_MOUSE_EXIT"      },
+        { GR_EVENT_TYPE_MOUSE_MOTION,   "GR_EVENT_MASK_MOUSE_MOTION"    },
+        { GR_EVENT_TYPE_MOUSE_POSITION, "GR_EVENT_MASK_MOUSE_POSITION"  },
+        { GR_EVENT_TYPE_KEY_DOWN,       "GR_EVENT_MASK_KEY_DOWN"        },
+        { GR_EVENT_TYPE_KEY_UP,         "GR_EVENT_MASK_KEY_UP"          },
+        { GR_EVENT_TYPE_FOCUS_IN,       "GR_EVENT_MASK_FOCUS_IN"        },
+        { GR_EVENT_TYPE_FOCUS_OUT,      "GR_EVENT_MASK_FOCUS_OUT"       },
+        { GR_EVENT_TYPE_FDINPUT,        "GR_EVENT_MASK_FDINPUT"         },
+        { GR_EVENT_TYPE_UPDATE,         "GR_EVENT_MASK_UPDATE"          },
+        { GR_EVENT_TYPE_CHLD_UPDATE,    "GR_EVENT_MASK_CHLD_UPDATE"     },
+        { GR_EVENT_TYPE_CLOSE_REQ,      "GR_EVENT_MASK_CLOSE_REQ"       }
+};
+#define NR_MASKS        (sizeof(event_table) / sizeof(event_table[0]))
+
+struct _wm_props {
+	GR_WM_PROPS prop;
+	char* prop_symbol;
+	char* prop_descr;
+};
+typedef struct _wm_props WM_PROPS;
+
+static WM_PROPS props_table[] = {
+	/* Window properties */
+	{ GR_WM_PROPS_NOBACKGROUND, "GR_WM_PROPS_NOBACKGROUND", "Don't draw window background" },
+	{ GR_WM_PROPS_NOFOCUS, "GR_WM_PROPS_NOFOCUS", "Don't set focus to this window" },
+	{ GR_WM_PROPS_NOMOVE, "GR_WM_PROPS_NOMOVE", "Don't let user move window" },
+	{ GR_WM_PROPS_NORAISE, "GR_WM_PROPS_NORAISE", "Don't let user raise window" },
+	{ GR_WM_PROPS_NODECORATE, "GR_WM_PROPS_NODECORATE", "Don't redecorate window" },
+	{ GR_WM_PROPS_NOAUTOMOVE, "GR_WM_PROPS_NOAUTOMOVE", "Don't move window on decorating" },
+
+	/* default decoration style */
+	{ GR_WM_PROPS_APPWINDOW, "GR_WM_PROPS_APPWINDOW", "Leave appearance to WM" },
+	{ GR_WM_PROPS_APPMASK, "GR_WM_PROPS_APPMASK", "Appearance mask" },
+	{ GR_WM_PROPS_BORDER, "GR_WM_PROPS_BORDER", "Single line border" },
+	{ GR_WM_PROPS_APPFRAME, "GR_WM_PROPS_APPFRAME", "3D app frame" },
+	{ GR_WM_PROPS_CAPTION, "GR_WM_PROPS_CAPTION", "Title bar" },
+	{ GR_WM_PROPS_CLOSEBOX, "GR_WM_PROPS_CLOSEBOX", "Close box" },
+#if 0
+	{ GR_WM_PROPS_MAXIMIZED, "GR_WM_PROPS_MAXIMIZED", "Application is maximized" }
+#endif
+};
+#define NR_PROPS        (sizeof(props_table) / sizeof(props_table[0]))
+
+int
+main(int argc, char* argv[])
+{
+	GR_WINDOW_ID w;
+	GR_WINDOW_INFO info;
+
+        if (GrOpen() < 0) {
+                fprintf(stderr, "nxlsclients: cannot open graphics\n");
+                exit(1);
+        }
+
+	for (w = 0; w < LIMIT; w++) {
+		info.wid = -1; // self-sabotaged like CCCP
+		
+		GrGetWindowInfo(w, &info);
+		
+		if (info.wid == -1) {
+			printf("Query wid = %d, GrGetWindowInfo() is not working!\n", w);
+			continue;
+		}
+		if (info.wid == 0) {
+			//printf("Query wid = %d --> does not exist\n", w);
+			continue;
+		}
+		printf("Window id = %d\n", info.wid);
+		printf("\tAbsolute upper-left X: %d\n", info.x);
+		printf("\tAbsolute upper-left Y: %d\n", info.y);
+		printf("\tWidth = %d\n", info.width);
+		printf("\tHeight = %d\n", info.height);
+		printf("\tBorder: size = %d, colour = %s (#%06lX)\n", \
+		       info.bordersize,
+		       lookupColour(info.bordercolor), info.bordercolor);
+		printf("\tBackground colour = %s (#%06lX)\n", \
+		       lookupColour(info.background), info.background);
+
+		printf("\tParent = %d\n", info.parent);
+		printf("\tFirst child = %d\n", info.child);
+		printf("\tNext sibling? = %d\n", info.sibling);
+
+		printf("\t%sinput-only, ", (info.inputonly == TRUE)?"": "not ");
+		printf("%smapped", (info.mapped == TRUE)?"": "not ");
+		if (info.mapped != TRUE)
+			printf(", unmapcount = %d", info.unmapcount);
+		printf("\n");
+
+		printf("\tEvent mask (0x%08lX):\n", info.eventmask);
+		{
+			int i, n = 0;
+			GR_EVENT_MASK tmp = info.eventmask;
+
+			for (i = 0; i < NR_MASKS; i++) {
+				GR_EVENT_MASK mask = GR_EVENTMASK(event_table[i].event_type);	
+
+				if ((tmp  & mask) == mask) {
+					printf("\t\t%s\n", event_table[i].event_desc);
+					n++;
+				}
+			}
+			if (!n)
+				printf("\t\tGR_EVENT_MASK_NONE (?!?!?)\n");
+		}
+
+		// We don't use info.props, use GrGetWMProperties() intead
+		printf("\tWM Properties:\n");
+		{
+			GR_WM_PROPERTIES wm_props;
+
+			GrGetWMProperties(w, &wm_props);
+			
+			printf("\t\tTitle: ");	
+			if ((wm_props.flags & GR_WM_FLAGS_TITLE ) == GR_WM_FLAGS_TITLE) 
+				printf("'%s'\n", (char*)wm_props.title?:"(null)");
+			else
+				printf("<untitled>\n");
+
+			printf("\t\tBackground colour: ");
+			if ((wm_props.flags & GR_WM_FLAGS_BACKGROUND) == GR_WM_FLAGS_BACKGROUND)
+				printf("%s (#%06lX)\n", lookupColour(wm_props.background), 
+				       wm_props.background);
+			else
+				printf("<unspecified>\n");
+
+			printf("\t\tBorder size: ");
+			if ((wm_props.flags & GR_WM_FLAGS_BORDERSIZE) == GR_WM_FLAGS_BORDERSIZE)
+				printf("%d\n", wm_props.bordersize);
+			else
+				printf("<unspecified>\n");
+
+			printf("\t\tProperty bits (0x%08lX):\n", wm_props.props);
+			{
+				int i, n = 0;
+
+				for (i = 0; i < NR_PROPS; i++) {
+					GR_WM_PROPS prop = props_table[i].prop;
+					if ((wm_props.props & prop) == prop) {
+						printf("\t\t\t%s (%s)\n", \
+								props_table[i].prop_symbol, \
+								props_table[i].prop_descr);
+						n++;
+					}
+				}
+
+				if (!n)
+				       	printf("\t\tNONE (?!?!?)\n");
+			}
+
+		}
+	}
+
+	GrClose();
+
+	return 0;
+ }
diff -urN lib/microwindows/src/demos/nanox/nxterm.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nxterm.c
--- lib/microwindows/src/demos/nanox/nxterm.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nxterm.c	2005-02-21 16:12:57.000000000 +0100
@@ -0,0 +1,1182 @@
+/*
+ * nxterm - terminal emulator for Nano-X
+ *
+ * (C) 1994,95,96 by Torsten Scherer (TeSche)
+ * itschere@techfak.uni-bielefeld.de
+ *
+ * - quite some changes for W1R1
+ * - yet more changes for W1R2
+ *
+ * TeSche 01/96:
+ * - supports W_ICON & W_CLOSE
+ * - supports /etc/utmp logging for SunOS4 and Linux
+ * - supports catching of console output for SunOS4
+ * Phx 02-06/96:
+ * - supports NetBSD-Amiga
+ * Eero 11/97:
+ * - unsetenv(DISPLAY), setenv(LINES, COLUMNS).
+ * - Add new text modes (you need to use terminfo...).
+ * Eero 2/98:
+ * - Implemented fg/bgcolor setting.  With monochrome server it changes
+ *   bgmode variable, which tells in which mode to draw to screen
+ *   (M_CLEAR/M_DRAW) and affects F_REVERSE settings.
+ * - Added a couple of checks.
+ *
+ * TODO:
+ * - Allocate and set sensible window palette for fg/bg color setting.
+ * - add scroll-region ('cs') command. Fairly many programs
+ *   can take advantage of that.
+ * - Add xterm like mouse event to terminfo key event conversion... :)
+ * - check if current NetBSD really needs ifdefs below with
+ *   current W server/library.
+ */
+#include <stdio.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <utmp.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <pwd.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <termios.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+#include "nxterm.h"
+
+#define TITLE	"nxterm"
+
+#define	SMALLBUFFER 80
+#define	LARGEBUFFER 1024
+
+/*
+ * some pty helper functions
+ */
+#ifdef linux
+#define NSIG _NSIG
+#endif
+
+#ifdef __FreeBSD__
+#include <libutil.h>
+#endif
+
+
+/*
+ * some global variables
+ */
+
+static GR_WINDOW_ID	w1;	/* id for window */
+static GR_GC_ID		gc1;	/* graphics context */
+static GR_FONT_ID       regFont;
+//static GR_FONT_ID       boldFont;
+
+static GR_SCREEN_INFO	si;	/* screen info */
+static GR_FONT_INFO     fi;     /* Font Info */
+static GR_WINDOW_INFO   wi;
+static GR_GC_INFO       gi;
+static GR_BOOL		havefocus = GR_FALSE;
+
+static short winw, winh, pid, console;
+static int pipeh;
+static short cblink = 0, visualbell = 0, debug = 0;
+#ifdef __FreeBSD__
+static char pty[SMALLBUFFER];
+static struct winsize winsz;
+#endif
+
+#define fonh fi.height
+#define fonw fi.maxwidth
+
+int term_init();
+
+/****************************************************************************/
+
+/*
+ *
+ */
+
+/* static int isIconified; */
+static int isMaximized=0;
+
+void maximize(void)
+{
+    static short x0, y0, w, h, w_max,h_max;
+
+    if (!isMaximized) 
+    {
+      
+	w_max=si.cols-wi.bordersize;
+	h_max=si.rows-wi.bordersize;
+	GrMoveWindow(w1,0,0);
+	GrResizeWindow(w1,w_max, h_max);
+	isMaximized=1;
+    } 
+    else 
+    {
+	GrResizeWindow(w1, w, h);
+	GrMoveWindow(w1, x0, y0);
+	isMaximized=0;
+    }
+}
+
+
+/****************************************************************************/
+
+
+/*
+ * some common tool functions
+ */
+
+void sigpipe(int sig)
+{
+  /* this one musn't close the window */
+/*  _write_utmp(pty, "", "", 0);  */
+  kill(-pid, SIGHUP);
+  _exit(sig);
+}
+
+
+void sigchld(int sig)
+{
+/*  _write_utmp(pty, "", "", 0);  */
+  _exit(sig);
+}
+
+
+void sigquit(int sig)
+{
+  signal(sig, SIG_IGN);
+  kill(-pid, SIGHUP);
+}
+
+
+/*
+ * this is the wterm terminal code, almost like VT52
+ */
+
+short	bgmode, escstate, curx, cury, curon, curvis;
+short	savx, savy, wrap, style;
+short	col, row, colmask = 0x7f, rowmask = 0x7f;
+
+/*
+ * something to buffer plain text output
+ */
+
+short	sbufcnt = 0;
+short	sbufx, sbufy;
+char    lineBuffer[SMALLBUFFER+1];
+char	*sbuf=lineBuffer;
+
+void sflush(void)
+{
+    if (sbufcnt) 
+    {
+	GrText(w1,gc1, sbufx*fonw, sbufy*fonh, sbuf, sbufcnt, GR_TFTOP);
+	sbufcnt = 0;
+    }
+}
+
+
+void lineRedraw(void)
+{
+    GrSetGCForeground(gc1,gi.background);
+    GrFillRect(w1, gc1, curx*fonw, cury*fonh, (col-curx)*fonw, fonh);
+    GrSetGCForeground(gc1,gi.foreground);
+
+    if (sbufcnt) 
+    {
+	sbuf[sbufcnt] = 0;
+	GrText(w1,gc1, sbufx*fonw, sbufy*fonh, sbuf, sbufcnt, GR_TFTOP);
+    }
+}
+
+void sadd (char c)
+{
+    if (sbufcnt == SMALLBUFFER)
+    {
+	sflush ();
+    }
+
+    if (!sbufcnt)
+    { 
+ 	sbufx = curx; 
+ 	sbufy = cury; 
+    } 
+
+    sbuf[sbufcnt++] = c;
+}
+
+void show_cursor (void)
+{
+	GrSetGCMode(gc1,GR_MODE_XOR);
+	GrSetGCForeground(gc1, WHITE);
+	GrFillRect(w1, gc1, curx*fonw, cury*fonh+1, fonw, fonh-1);
+	GrSetGCForeground(gc1, gi.foreground);
+	GrSetGCMode(gc1,GR_MODE_SET);
+}
+
+
+void draw_cursor (void)
+{
+    if (!curvis)
+    {
+	curvis = 1;
+	show_cursor();
+    }
+}
+void hide_cursor (void)
+{
+    if (curvis) 
+    {
+	curvis = 0;
+	show_cursor();
+    }
+}
+
+
+void vscroll(int lines)
+{
+    hide_cursor();
+    GrCopyArea(w1,gc1,0, 0, winw, winh-(lines*fonh),
+	       w1, 0, (lines*fonh), MWROP_SRCCOPY);
+    
+    GrSetGCForeground(gc1,gi.background);    
+    GrFillRect(w1, gc1, 0, winh-(lines*fonh),
+	       winw, (lines*fonh));
+    GrSetGCForeground(gc1,gi.foreground);    
+}
+
+void esc5(unsigned char c)	/* setting background color */
+{
+
+    GrSetGCBackground(gc1, c);
+    GrGetGCInfo(gc1,&gi);
+    escstate = 0;
+}
+
+void esc4(unsigned char c)	/* setting foreground color */
+{
+    GrSetGCForeground(gc1,c);
+    GrGetGCInfo(gc1,&gi);
+    escstate = 0;
+}
+
+void esc3(unsigned char c)	/* cursor position x axis */
+{
+    curx = (c - 32) & colmask;
+    if (curx >= col)
+	curx = col - 1;
+    else if (curx < 0)
+	curx = 0;
+    escstate = 0;
+}
+
+
+void esc2(unsigned char c)	/* cursor position y axis */
+{
+  cury = (c - 32) & rowmask;
+  if (cury >= row)
+    cury = row - 1;
+  else if (cury < 0)
+    cury = 0;
+  escstate = 3;
+}
+
+
+void esc1(unsigned char c)	/* various control codes */
+{
+    static int ReverseMode=0;
+    escstate = 0;
+
+    switch(c) 
+    {
+    case 'A':/* cursor up */
+	hide_cursor();
+	if ((cury -= 1) < 0)
+	    cury = 0;
+	break;
+
+    case 'B':/* cursor down */
+	hide_cursor();
+	if ((cury += 1) >= row)
+	    cury = row - 1;
+	break;
+
+    case 'C':/* cursor right */
+	hide_cursor();
+	if ((curx += 1) >= col)
+	    curx = col - 1;
+	break;
+
+    case 'D':/* cursor left */
+	hide_cursor();
+	if ((curx -= 1) < 0)
+	    curx = 0;
+	break;
+
+    case 'E':/* clear screen & home */
+	GrClearWindow(w1, 0);
+	curx = 0;
+	cury = 0;
+	break;
+
+    case 'H':/* cursor home */
+	curx = 0;
+	cury = 0;
+	break;
+
+    case 'I':/* reverse index */
+	if ((cury -= 1) < 0) 
+	{
+	    cury = 0;
+	    vscroll(1);
+	}
+	break;
+
+    case 'J':/* erase to end of page */
+
+ 	if (cury < row-1) 
+	{
+	    GrSetGCForeground(gc1,gi.background);
+	    GrFillRect(w1,gc1, 0,(cury+1)*fonh, winw, (row-1-cury)*fonh);
+	    GrSetGCForeground(gc1,gi.foreground);
+	}
+	GrSetGCForeground(gc1,gi.background);
+ 	GrFillRect(w1, gc1, curx*fonw, cury*fonh, (col-curx)*fonw, fonh);
+	GrSetGCForeground(gc1,gi.foreground);
+	break;
+
+    case 'K':/* erase to end of line */
+	GrSetGCForeground(gc1,gi.background);
+	GrFillRect(w1, gc1, curx*fonw, cury*fonh, (col-curx)*fonw, fonh);
+	GrSetGCForeground(gc1,gi.foreground);
+	break;
+
+    case 'L':/* insert line */
+ 	if (cury < row-1) 
+	{
+	    vscroll(1);
+	}
+ 	curx = 0;
+	break;
+
+    case 'M':/* delete line */
+ 	if (cury < row-1) 
+	{ 
+	    vscroll(1);
+ 	}
+ 	curx = 0;
+	break;
+
+    case 'Y':/* position cursor */
+	escstate = 2;
+	break;
+
+    case 'b':/* set foreground color */
+	escstate = 4;
+	break;
+
+    case 'c':/* set background color */
+	escstate = 5;
+	break;
+
+    case 'd':/* erase beginning of display */
+/* 	w_setmode(win, bgmode); */
+ 	if (cury > 0) 
+	{
+	    GrSetGCForeground(gc1,gi.background);
+	    GrFillRect(w1,gc1, 0, 0, winw, cury*fonh);
+	    GrSetGCForeground(gc1,gi.foreground);
+	}
+ 	if (curx > 0) 
+	{
+	    GrSetGCForeground(gc1,gi.background);
+	    GrFillRect(w1,gc1, 0, cury*fonh, curx*fonw, fonh);
+	    GrSetGCForeground(gc1,gi.foreground);
+	}
+	break;
+
+    case 'e':/* enable cursor */
+	curon = 1;
+	break;
+
+    case 'f':/* disable cursor */
+	curon = 0;
+	break;
+
+    case 'j':/* save cursor position */
+	savx = curx;
+	savy = cury;
+	break;
+
+    case 'k':/* restore cursor position */
+	curx = savx;
+	cury = savy;
+	break;
+
+    case 'l':/* erase entire line */
+	GrSetGCForeground(gc1,gi.background);
+	GrRect(w1,gc1, 0, cury*fonh, winw, fonh);
+	GrSetGCForeground(gc1,gi.foreground);
+	curx = 0;
+	break;
+
+    case 'o':/* erase beginning of line */
+	if (curx > 0)
+	{
+	    GrSetGCForeground(gc1,gi.background);
+	    GrRect(w1,gc1,0, cury*fonh, curx*fonw, fonh);
+	    GrSetGCForeground(gc1,gi.foreground);
+	}
+	break;
+
+    case 'p':/* enter reverse video mode */
+    {
+	if(!ReverseMode)
+	{
+	    GrSetGCForeground(gc1,gi.background);
+	    GrSetGCBackground(gc1,gi.foreground);
+ 	    ReverseMode=1; 
+	}
+    }
+	break;
+
+    case 'q':/* exit reverse video mode */
+    {
+	if(ReverseMode)
+	{
+	    GrSetGCForeground(gc1,gi.foreground);
+	    GrSetGCBackground(gc1,gi.background);
+ 	    ReverseMode=0;
+	}
+    }
+	break;
+
+    case 'v':/* enable wrap at end of line */
+	wrap = 1;
+	break;
+
+    case 'w':/* disable wrap at end of line */
+	wrap = 0;
+	break;
+
+/* and these are the extentions not in VT52 */
+
+    case 'G': /* clear all attributes */
+	break;
+
+    case 'g': /* enter bold mode */
+/*	GrSetGCFont(gc1, boldFont); */
+	break;
+
+    case 'h': /* exit bold mode */
+/*	GrSetGCFont(gc1, regFont); */
+	break;
+
+    case 'i': /* enter underline mode */
+	break;
+
+	/* j, k and l are already used */
+
+    case 'm': /* exit underline mode */
+	break;
+
+/* these ones aren't yet on the termcap entries */
+
+    case 'n': /* enter italic mode */
+	break;
+	/* o, p and q are already used */
+
+    case 'r': /* exit italic mode */
+	break;
+
+    case 's': /* enter light mode */
+	break;
+
+    case 't': /* exit ligth mode */
+	break;
+
+    default: /* unknown escape sequence */
+	break;
+    }
+}
+
+/*
+ * un-escaped character print routine
+ */
+
+void esc0 (unsigned char c)
+{
+    switch (c) 
+    {
+    case 0:
+	/*
+	 * printing \000 on a terminal means "do nothing".
+	 * But since we use \000 as string terminator none
+	 * of the characters that follow were printed.
+	 *
+	 * perl -e 'printf("a%ca", 0);'
+	 *
+	 * said 'a' in a wterm, but should say 'aa'. This
+	 * bug screwed up most ncurses programs.
+	 *
+	 * kay.
+	 */
+	break;
+ 
+    case 7: /* bell */
+	if (visualbell) 
+	{
+/* 	    w_setmode(win, M_INVERS); */
+/* 	    w_pbox(win, 0, 0, winw, winh); */
+/* 	    w_test(win, 0, 0); */
+/* 	    w_pbox(win, 0, 0, winw, winh); */
+	    ;
+	} 
+	else 
+	{
+	    ;
+ 	    GrBell();
+	}
+	break;
+
+    case 8: /* backspace */
+	lineRedraw();
+	if (--curx < 0) 
+	{
+	    curx = 0;
+	}
+	break;
+
+    case 9: /* tab */
+    {
+	int borg,i;
+
+	borg=(((curx >> 3) + 1) << 3);
+	if(borg >= col)
+	{
+	    borg=col-1;
+	}
+	borg=borg-curx;
+	for(i=0; i < borg; ++i){sadd(' ');}
+ 	if ((curx = ((curx >> 3) + 1) << 3) >= col) 
+ 	{ 
+ 	    curx = col - 1; 
+ 	} 
+    }
+	break;
+
+    case 10: /* line feed */
+	sflush();
+	if (++cury >= row) 
+	{
+	    vscroll(1);
+	    cury = row-1;
+	}
+	break;
+
+    case 13: /* carriage return */
+	sflush();
+	curx = 0;
+	break;
+
+    case 27: /* escape */
+	sflush();
+	escstate = 1;
+	break;
+
+    case 127: /* delete */
+	break;
+
+    default: /* any printable char */
+	sadd(c);
+	if (++curx >= col) 
+	{
+	    sflush();
+	    if (!wrap) 
+	    {
+		curx = col-1;
+	    } 
+	    else 
+	    {
+		curx = 0;
+		if (++cury >= row) 
+		{
+		    vscroll(1);
+		}
+	    }
+	}
+	break;
+    }
+}
+
+
+void printc(unsigned char c)
+{
+    switch(escstate) 
+    {
+    case 0:
+	esc0(c);
+	break;
+
+    case 1:
+	sflush();
+	esc1(c);
+	break;
+
+    case 2:
+	sflush();
+	esc2(c);
+	break;
+
+    case 3:
+	sflush();
+	esc3(c);
+	break;
+
+    case 4:
+	sflush();
+	esc4(c);
+	break;
+
+    case 5:
+	sflush();
+	esc5(c);
+	break;
+
+    default: 
+	escstate = 0;
+	break;
+    }
+}
+
+
+void init()
+{
+    curx = savx = 0;
+    cury = savy = 0;
+    wrap = 1;
+    curon = 1;
+    curvis = 0;
+    escstate = 0;
+}
+
+
+/*
+ * general code...
+ */
+
+void
+term(void)
+{
+	long 		in, l;
+	GR_EVENT 	wevent;
+	GR_EVENT_KEYSTROKE *kp;
+	unsigned char 	buf[LARGEBUFFER];
+
+	GrRegisterInput(pipeh);
+	while (42) {
+		if (havefocus)
+			draw_cursor();
+		GrGetNextEvent(&wevent);
+
+		switch(wevent.type) {
+		case GR_EVENT_TYPE_CLOSE_REQ:
+			GrClose();
+			exit(0);
+			break;
+
+		case GR_EVENT_TYPE_KEY_DOWN:
+			kp=(GR_EVENT_KEYSTROKE *)&wevent;
+			/* toss all special keys*/
+			if (kp->ch & MWKEY_NONASCII_MASK)
+				break;
+			*buf = kp->ch & 0xff;
+			write(pipeh, buf,1);
+			break;
+
+		case GR_EVENT_TYPE_FOCUS_IN:
+			havefocus = GR_TRUE;
+			break;
+
+		case GR_EVENT_TYPE_FOCUS_OUT:
+			havefocus = GR_FALSE;
+			hide_cursor();
+			break;
+
+		case GR_EVENT_TYPE_UPDATE:
+			/*
+			 * if we get temporarily unmapped (moved),
+			 * set cursor state off.
+			 */
+			if (wevent.update.utype == GR_UPDATE_UNMAPTEMP)
+				curvis = 0;
+			break;
+
+		case GR_EVENT_TYPE_FDINPUT:
+			hide_cursor();
+			while ((in = read(pipeh, buf, sizeof(buf))) > 0) {
+				for (l=0; l<in; l++) {
+					printc(buf[l]); 
+					if (buf[l] == '\n')
+						printc('\r');
+				}
+				sflush();
+			}
+	    		break;
+		}
+	}
+}
+
+
+void usage(char *s)
+{
+    if (s) 
+	fprintf(stderr, "error: %s\n", s);
+    printf("usage: nxterm [-b] [-d] [-f <font family>] [-s <font size>]\n");
+    printf("       [-g <geometry>] [-v] [-c] [-h] [program {args}]\n");
+    exit(0);
+}
+
+
+void *mysignal(int signum, void *handler)
+{
+  struct sigaction sa, so;
+
+  sa.sa_handler = handler;
+  sigemptyset(&sa.sa_mask);
+  sa.sa_flags = SA_RESTART;
+  sigaction(signum, &sa, &so);
+
+  return so.sa_handler;
+}
+
+/*
+ * guess what... :)
+ */
+
+int main(int argc, char **argv)
+{
+    GR_BITMAP	bitmap1fg[7];	/* mouse cursor */
+    GR_BITMAP	bitmap1bg[7];
+    GR_WM_PROPERTIES props;
+
+    short xp, yp, fsize;
+    char *family, *shell = NULL, *cptr, *geometry = NULL;
+    struct passwd *pw;
+    char buf[80];
+    short uid;
+    char thesh[128];
+#ifdef __FreeBSD__
+    char *ptr;
+#endif
+
+#ifdef SIGTTOU
+    /* just in case we're started in the background */
+    signal(SIGTTOU, SIG_IGN);
+#endif
+
+    /* who am I? */
+    if (!(pw = getpwuid((uid = getuid())))) 
+    {
+	fprintf(stderr, "error: wterm can't determine determine your login name\n");
+	exit(-1);
+    }
+
+  
+    if (GrOpen() < 0) 
+    {
+	fprintf(stderr, "cannot open graphics\n");
+	exit(1);
+    }
+
+    GrGetScreenInfo(&si);
+    /*
+     * scan arguments...
+     */
+
+    console = 0;
+    argv++;
+    while (*argv && **argv=='-') 
+	switch (*(*argv+1)) 
+	{
+	case 'b':
+	    cblink = 1;
+	    argv++;
+	    break;
+
+	case 'c':
+	    console = 1;
+	    argv++;
+	    break;
+
+	case 'd':
+	    debug = 1;
+	    argv++;
+	    break;
+
+	case 'f':
+	    if (*++argv) {
+		family = *argv++;
+	    } else {
+		usage("-f option requires an argument");
+	    }
+	    break;
+
+	case 's':
+	    if (*++argv) {
+		fsize = atoi(*argv++);
+	    } else {
+		usage("-s option requires an argument");
+	    }
+	    break;
+
+	case 'g':
+	    if (*++argv) {
+		geometry = *argv++;
+	    } else {
+		usage("-g option requires an argument");
+	    }
+	    break;
+
+	case 'h':
+	    /* this will never return */
+	    usage("");
+
+	case 'v':
+	    visualbell = 1;
+	    argv++;
+	    break;
+
+	default:
+	    usage("unknown option");
+	}
+
+    /*
+     * now *argv either points to a program to start or is zero
+     */
+
+    if (*argv) {
+	shell = *argv;
+    }
+    if (!shell) {
+	shell = getenv("SHELL=");
+    }
+    if (!shell) {
+	shell = pw->pw_shell;
+    }
+    if (!shell) {
+	shell = "/bin/sh";
+    }
+
+    if (!*argv) {
+	/*
+	 * the '-' makes the shell think it is a login shell,
+	 * we leave argv[0] alone if it isn`t a shell (ie.
+	 * the user specified the program to run as an argument
+	 * to wterm.
+	 */
+	cptr = strrchr(shell, '/');
+	sprintf (thesh, "-%s", cptr ? cptr + 1 : shell);
+	*--argv = thesh;
+    }
+
+    col = 80;
+    row = 25;
+    xp = 0;
+    yp = 0;
+    if (geometry) 
+    {
+	if (col < 1) 
+	{
+	    col = 80;
+	}
+	if (row < 1) 
+	{
+	    row = 25;
+	}
+	if (col > 0x7f)
+	    colmask = 0xffff;
+	if (row > 0x7f)
+	    rowmask = 0xffff;
+    }
+    
+    regFont=GrCreateFont(GR_FONT_SYSTEM_FIXED, 0, NULL);
+    /*regFont=GrCreateFont(GR_FONT_OEM_FIXED, 0, NULL);*/
+    /*boldFont=GrCreateFont(GR_FONT_SYSTEM_FIXED, 0, NULL);*/
+    GrGetFontInfo(regFont, &fi);
+
+    winw=col*fi.maxwidth;
+    winh=row*fi.height;
+    w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 10,10,winw, winh,0,BLACK,LTBLUE);
+    props.flags = GR_WM_FLAGS_TITLE;
+    props.title = TITLE;
+    GrSetWMProperties(w1, &props);
+
+    GrSelectEvents(w1, GR_EVENT_MASK_BUTTON_DOWN |
+		   GR_EVENT_MASK_KEY_DOWN | 
+		   GR_EVENT_MASK_FOCUS_IN | GR_EVENT_MASK_FOCUS_OUT |
+		   GR_EVENT_MASK_UPDATE | GR_EVENT_MASK_CLOSE_REQ);
+
+    GrMapWindow(w1);
+
+    gc1 = GrNewGC();
+    GrSetGCFont(gc1, regFont);
+
+#define	_	((unsigned) 0)		/* off bits */
+#define	X	((unsigned) 1)		/* on bits */
+#define	MASK(a,b,c,d,e,f,g) \
+	(((((((((((((a * 2) + b) * 2) + c) * 2) + d) * 2) \
+	+ e) * 2) + f) * 2) + g) << 9)
+	bitmap1fg[0] = MASK(_,_,X,_,X,_,_);
+	bitmap1fg[1] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[2] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[3] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[4] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[5] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[6] = MASK(_,_,X,_,X,_,_);
+
+	bitmap1bg[0] = MASK(_,X,X,X,X,X,_);
+	bitmap1bg[1] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[2] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[3] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[4] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[5] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[6] = MASK(_,X,X,X,X,X,_);
+    GrSetCursor(w1, 7, 7, 3, 3, GREEN, BLACK, bitmap1fg, bitmap1bg);
+    GrSetGCForeground(gc1, GREEN);
+    GrSetGCBackground(gc1, BLACK);
+    GrGetWindowInfo(w1,&wi);
+    GrGetGCInfo(gc1,&gi);
+
+    sprintf(buf, "wterm: %s", shell);
+
+    /*
+     * what kind of terminal do we want to emulate?
+     */
+#ifdef __FreeBSD__
+    putenv ("TERM=wterm");
+#else
+    putenv ("TERM=vt52");
+#endif
+
+    /*
+     * this one should enable us to get rid of an /etc/termcap entry for
+     * both curses and ncurses, hopefully...
+     */
+
+    if (termcap_string) 
+    {
+	sprintf (termcap_string + strlen (termcap_string), "li#%d:co#%d:",
+		 row, col);
+	putenv (termcap_string);
+    }
+    /* in case program absolutely needs terminfo entry, these 'should'
+     * transmit the screen size of correctly (at least xterm sets these
+     * and everything seems to work correctly...). Unlike putenv(),
+     * setenv() allocates also the given string not just a pointer.
+     */
+    sprintf (buf, "%d", col);
+    setenv ("COLUMNS", buf, 1);
+    sprintf (buf, "%d", row);
+    setenv ("LINES", buf, 1);
+
+    init();
+
+    /*
+     * create a pty
+     */
+#ifdef __FreeBSD__
+    winsz.ws_col = col;
+    winsz.ws_row = row;
+    if ((pid = forkpty(&pipeh, pty, NULL, &winsz)) < 0)  
+    {
+	fprintf(stderr,"wterm: can't create pty\r\n");
+	perror("wterm");
+	sleep(2);
+	GrKillWindow(w1);
+	exit(-1);
+    }
+
+    if ((ptr = rindex(pty, '/'))) 
+    {
+	strcpy(pty, ptr + 1);
+    }
+  
+    if (!pid) 
+    {
+	int i;
+	for (i = getdtablesize(); --i >= 3; )
+	    close (i);
+	/*
+	 * SIG_IGN are not reset on exec()
+	 */
+	for (i = NSIG; --i >= 0; )
+	    signal (i, SIG_DFL);
+ 
+	/* caution: start shell with correct user id! */
+	seteuid(getuid());
+	setegid(getgid());
+
+	/* this shall not return */
+	execvp(shell, argv);
+
+	/* oops? */
+	fprintf(stderr,"wterm: can't start shell\r\n");
+	sleep(3);
+	GrKillWindow(w1);
+	_exit(-1);
+    }
+#else
+    pipeh = term_init();
+#endif
+
+/*    _write_utmp(pty, pw->pw_name, "", time(0)); */
+
+#if 0
+    /* catch some signals */
+    mysignal(SIGTERM, sigquit);
+    mysignal(SIGHUP, sigquit);
+    mysignal(SIGINT, SIG_IGN);
+    mysignal(SIGQUIT, sigquit);
+    mysignal(SIGPIPE, sigpipe);
+    mysignal(SIGCHLD, sigchld);
+#endif
+
+    /* prepare to catch console output */
+    if (console) 
+    {
+	/* for any OS chr$(7) might cause endless loops if 
+	 * catched from console 
+	 */
+	visualbell = 1;
+	console = 0;       /* data will come to normal pipe handle */
+	ioctl(pipeh, TIOCCONS, 0);
+    }
+
+    term();
+    return 0;
+}
+
+#if ELKS
+char * nargv[2] = {"/bin/sash", NULL};
+#else
+#if DOS_DJGPP
+char * nargv[2] = {"bash", NULL};
+#else
+char * nargv[2] = {"/bin/sh", NULL};
+#endif
+#endif
+
+void sigchild(int signo)
+{
+	GrClose();
+	exit(0);
+}
+
+int term_init()
+{
+	int tfd;
+	int n = 0;
+	pid_t pid;
+	char pty_name[12];
+
+again:
+	sprintf(pty_name, "/dev/ptyp%d", n);
+	if ((tfd = open(pty_name, O_RDWR | O_NONBLOCK)) < 0) {
+		if ((errno == EBUSY || errno == EIO) && n < 10) {
+			n++;
+			goto again;
+		}
+		fprintf(stderr, "Can't create pty %s\n", pty_name);
+		return -1;
+	}
+	signal(SIGCHLD, sigchild);
+	signal(SIGINT, sigchild);
+	if ((pid = fork()) == -1) {
+		fprintf(stderr, "No processes\n");
+		return -1;
+	}
+	if (!pid) {
+		close(STDIN_FILENO);
+		close(STDOUT_FILENO);
+		close(tfd);
+		
+		setsid();
+		pty_name[5] = 't';
+		if ((tfd = open(pty_name, O_RDWR)) < 0) {
+			fprintf(stderr, "Child: Can't open pty %s\n", pty_name);
+			exit(1);
+		}
+		close(STDERR_FILENO);
+		dup2(tfd, STDIN_FILENO);
+		dup2(tfd, STDOUT_FILENO);
+		dup2(tfd, STDERR_FILENO);
+		execv(nargv[0], nargv);
+		exit(1);
+	}
+	return tfd;
+}
+
+#if 0
+void _write_utmp(char *line, char *user, char *host, int time)
+{
+    int fh, offset, isEmpty, isLine;
+    struct utmp ut;
+
+    if ((fh = open("/etc/utmp", O_RDWR)) < 0) {
+	return;
+    }
+
+    /* first of all try to find an entry with the same line */
+
+    offset = 0;
+    isEmpty = -1;
+    isLine = -1;
+
+    while ((isLine < 0) && (read(fh, &ut, sizeof(ut)) == sizeof(ut))) {
+	if (!ut.ut_line[0]) 
+	{
+	    if (isEmpty < 0) 
+	    {
+		isEmpty = offset;
+	    }
+	} 
+	else 
+	{
+	    if (!strncmp(ut.ut_line, line, sizeof(ut.ut_line))) {
+		isLine = offset;
+	    }
+	}
+	offset += sizeof(ut);
+    }
+
+    if (isLine != -1) {
+	/* we've found a match */
+	lseek(fh, isLine, SEEK_SET);
+    } else if (isEmpty != -1) {
+	/* no match found, but at least an empty entry */
+	lseek(fh, isLine, SEEK_SET);
+    } else {
+	/* not even an empty entry found, assume we can append to the file */
+    }
+
+    if (time) 
+    {
+	strncpy(ut.ut_line, line, sizeof(ut.ut_line));
+	strncpy(ut.ut_name, user, sizeof(ut.ut_name));
+	strncpy(ut.ut_host, host, sizeof(ut.ut_host));
+	ut.ut_time = time;
+    } 
+    else 
+    {
+	memset(&ut, 0, sizeof(ut));
+    }
+    write(fh, &ut, sizeof(ut));
+    close(fh);
+}
+#endif
diff -urN lib/microwindows/src/demos/nanox/nxterm.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nxterm.h
--- lib/microwindows/src/demos/nanox/nxterm.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nxterm.h	2005-02-21 16:02:58.000000000 +0100
@@ -0,0 +1,65 @@
+/* These contained 'pt:re=\\EC' entries.  I deleted them from MiNT and linux
+ * because neither of my (linux) termcap nor terminfo manual pages listed
+ * them.
+ *	++eero
+ */
+#ifdef __MINT__
+
+static char termcap_string[1024] =
+"TERMCAP=wterm|WTerm terminal:al=\\EL:am:bc=\\ED:bl=^G:bs:cd=\\EJ:\
+ce=\\EK:cl=\\EE:cm=\\EY%+ %+ :cr=^M:dl=\\EM:do=\\EB:ho=\\EH:is=\\Ev\\Eq:\
+l0=F10:le=\\ED:ms:nd=\\EC:rc=\\Ek:rs=\\Ev\\Eq\\EE:sc=\\Ej:sr=\\EI:\
+ti=\\Ev\\Ee\\EG:up=\\EA:ve=\\Ee:vi=\\Ef:so=\\Ep:se=\\Eq:mb=\\Ei:md=\\Eg:\
+mr=\\Ep:me=\\EG:te=\\EG:us=\\Ei:ue=\\EG:\
+kb=^H:kl=\\ED:kr=\\EC:ku=\\EA:kd=\\EB:kI=\\EI:kh=\\EE:kP=\\Ea:kN=\\Eb:k0=\\EY:\
+k1=\\EP:k2=\\EQ:k3=\\ER:k4=\\ES:k5=\\ET:k6=\\EU:k7=\\EV:k8=\\EW:k9=\\EX:\
+s0=\\Ey:s1=\\Ep:s2=\\Eq:s3=\\Er:s4=\\Es:s5=\\Et:s6=\\Eu:s7=\\Ev:s8=\\Ew:\
+s9=\\Ex:";
+
+#elif defined(linux) || defined(__FreeBSD__)
+
+static char termcap_string[1024] =
+"TERMCAP=wterm|WTerm terminal:al=\\EL:am:bc=\\ED:bl=^G:bs:cd=\\EJ:\
+ce=\\EK:cl=\\EE:cm=\\EY%+ %+ :cr=^M:dl=\\EM:do=\\EB:ho=\\EH:is=\\Ev\\Eq:\
+l0=F10:le=\\ED:ms:nd=\\EC:rc=\\Ek:rs=\\Ev\\Eq\\EE:sc=\\Ej:sr=\\EI:\
+ti=\\Ev\\Ee\\EG:up=\\EA:ve=\\Ee:vi=\\Ef:so=\\Ep:se=\\Eq:mb=\\Ei:md=\\Eg:\
+mr=\\Ep:me=\\EG:te=\\EG:us=\\Ei:ue=\\EG:\
+kb=^H:kl=\\E[D:kr=\\E[C:ku=\\E[A:kd=\\E[B:kI=\\EI:kh=\\EE:kP=\\Ea:kN=\\Eb:\
+k0=\\EY:k1=\\EP:k2=\\EQ:k3=\\ER:k4=\\ES:k5=\\ET:k6=\\EU:k7=\\EV:k8=\\EW:\
+k9=\\EX:s0=\\Ey:s1=\\Ep:s2=\\Eq:s3=\\Er:s4=\\Es:s5=\\Et:s6=\\Eu:s7=\\Ev:\
+s8=\\Ew:s9=\\Ex:";
+
+#elif defined(sun)
+
+  /* only very basic cursor keys so far... */
+
+static char termcap_string[1024] =
+"TERMCAP=wterm|WTerm terminal:al=\\EL:am:bc=\\ED:bl=^G:bs:cd=\\EJ:\
+ce=\\EK:cl=\\EE:cm=\\EY%+ %+ :cr=^M:dl=\\EM:do=\\EB:ho=\\EH:is=\\Ev\\Eq:\
+l0=F10:le=\\ED:ms:nd=\\EC:pt:re=\\EC:rc=\\Ek:rs=\\Ev\\Eq\\EE:sc=\\Ej:sr=\\EI:\
+ti=\\Ev\\Ee\\EG:up=\\EA:ve=\\Ee:vi=\\Ef:so=\\Ep:se=\\Eq:mb=\\Ei:md=\\Eg:\
+mr=\\Ep:me=\\EG:te=\\EG:us=\\Ei:ue=\\EG:\
+kb=^H:kl=\\E[D:kr=\\E[C:ku=\\E[A:kd=\\E[B:\
+k1=\\E[224z:k2=\\E[225z:k3=\\E[226z:k4=\\E[227z:k5=\\E[228z:\
+k6=\\E[229z:k7=\\E[230z:k8=\\E[231z:k9=\\E[232z:k0=\\E[233z:\
+kN=\\E[222z:kP=\\E[216z:kh=\\E[214z:kH=\\E220z:";
+
+#elif defined(__NetBSD__)
+
+static char termcap_string[1024] =
+"TERMCAP=wterm|WTerm terminal:al=\\EL:am:bc=\\ED:bl=^G:bs:cd=\\EJ:\
+ce=\\EK:cl=\\EE:cm=\\EY%+ %+ :cr=^M:dl=\\EM:do=\\EB:ho=\\EH:is=\\Ev\\Eq:\
+l0=F10:le=\\ED:ms:nd=\\EC:pt:re=\\EC:rc=\\Ek:rs=\\Ev\\Eq\\EE:sc=\\Ej:sr=\\EI:\
+ti=\\Ev\\Ee\\EG:up=\\EA:ve=\\Ee:vi=\\Ef:so=\\Ep:se=\\Eq:mb=\\Ei:md=\\Eg:\
+mr=\\Ep:me=\\EG:te=\\EG:us=\\Ei:ue=\\EG:\
+kb=^H:kl=\\E[D:kr=\\E[C:ku=\\E[A:kd=\\E[B:\
+k1=\\E[224z:k2=\\E[225z:k3=\\E[226z:k4=\\E[227z:k5=\\E[228z:\
+k6=\\E[229z:k7=\\E[230z:k8=\\E[231z:k9=\\E[232z:k0=\\E[233z:\
+kN=\\E[222z:kP=\\E[216z:kh=\\E[214z:kH=\\E220z:";
+
+#else
+
+#error oops, a new operating system?
+
+#endif
+
diff -urN lib/microwindows/src/demos/nanox/nxview.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nxview.c
--- lib/microwindows/src/demos/nanox/nxview.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/nxview.c	2005-02-21 16:02:58.000000000 +0100
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2000, 2001 Greg Haerr <greg@censoft.com>
+ *
+ * nxview - Nano-X image viewer
+ *
+ * Autorecognizes and displays BMP, GIF, JPEG, PNG and XPM files
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+int
+main(int argc,char **argv)
+{
+	GR_IMAGE_ID	image_id;
+	GR_WINDOW_ID	window_id;
+	GR_GC_ID	gc_id;
+	GR_SIZE		w = -1;
+	GR_SIZE		h = -1;
+	GR_EVENT	event;
+	GR_SCREEN_INFO	sinfo;
+	GR_IMAGE_INFO	info;
+	char		title[256];
+
+	if (argc < 2) {
+		printf("Usage: nxview <image file> [stretch]\n");
+		exit(1);
+	}
+
+	if (GrOpen() < 0) {
+		fprintf(stderr, "cannot open graphics\n");
+		exit(1);
+	}
+	
+	if (!(image_id = GrLoadImageFromFile(argv[1], 0))) {
+		fprintf(stderr, "Can't load image file: %s\n", argv[1]);
+		exit(1);
+	}
+
+	if(argc > 2) {
+		/* stretch to half screen size*/
+		GrGetScreenInfo(&sinfo);
+		w = sinfo.cols/2;
+		h = sinfo.rows/2;
+	} else {
+		GrGetImageInfo(image_id, &info);
+		w = info.width;
+		h = info.height;
+	}
+
+	sprintf(title, "nxview %s", argv[1]);
+	window_id = GrNewWindowEx(GR_WM_PROPS_APPWINDOW, title,
+		GR_ROOT_WINDOW_ID, 0, 0, w, h, BLACK);
+
+	GrSelectEvents(window_id,
+		GR_EVENT_MASK_CLOSE_REQ|GR_EVENT_MASK_EXPOSURE);
+
+	GrMapWindow(window_id);
+
+	gc_id = GrNewGC();
+
+	while (1) {
+		GrGetNextEvent(&event);
+		switch(event.type) {
+		case GR_EVENT_TYPE_CLOSE_REQ:
+			GrDestroyWindow(window_id);
+			GrDestroyGC(gc_id);
+			GrFreeImage(image_id);
+			GrClose();
+			exit(0);
+			/* no return*/
+		case GR_EVENT_TYPE_EXPOSURE:
+			GrDrawImageToFit(window_id, gc_id, 0,0, w,h, image_id);
+			break;
+		}
+	}
+
+	return 0;
+}
diff -urN lib/microwindows/src/demos/nanox/setselection.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/setselection.c
--- lib/microwindows/src/demos/nanox/setselection.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/setselection.c	2005-02-21 16:02:59.000000000 +0100
@@ -0,0 +1,84 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "nano-X.h"
+
+int main(int argc, char *argv[])
+{
+	GR_WINDOW_ID wid;
+	GR_EVENT event;
+	FILE *fp;
+	char *buf = NULL;
+	int buf_size = 0;
+	int data_len = 0;
+	int ret = 0;
+	GR_EVENT_CLIENT_DATA_REQ *req;
+	GR_EVENT_SELECTION_CHANGED *sc;
+
+	if(argc != 2) {
+		fprintf(stderr, "Usage: setselection <text file>\n");
+		return 1;
+	}
+
+	if(!(fp = fopen(argv[1], "r"))) {
+		fprintf(stderr, "Couldn't open text file\n");
+		return 2;
+	}
+
+	do {
+		data_len += ret;
+		buf_size = data_len + 65536;
+		if(!(buf = realloc(buf, buf_size))) {
+			fprintf(stderr, "Out of memory\n");
+			return 3;
+		}
+	} while((ret = fread(buf + data_len, 1, 65536, fp)) > 0);
+	if(ret < 0) {
+		fprintf(stderr, "Failed to read text file sucessfully\n");
+		return 2;
+	}
+
+	if(GrOpen() < 0) {
+		fprintf(stderr, "Couldn't connect to Nano-X server\n");
+		return 4;
+	}
+
+	wid = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, 1, 1, 0, 0, 0);
+	if(!wid) {
+		fprintf(stderr, "Couldn't get a window\n");
+		return 5;
+	}
+
+	GrSelectEvents(wid, GR_EVENT_MASK_CLIENT_DATA_REQ |
+				GR_EVENT_MASK_SELECTION_CHANGED);
+
+	GrSetSelectionOwner(wid, "nota/realtype text/plain non/existant "
+				"something/else");
+
+	while(1) {
+		GrGetNextEvent(&event);
+		switch(event.type) {
+			case GR_EVENT_TYPE_CLIENT_DATA_REQ:
+				req = &event.clientdatareq;
+				fprintf(stderr, "Got request with serial "
+					"number %ld from window %d for mime "
+					"type %d\n", req->serial, req->rid,
+							req->mimetype);
+				GrSendClientData(wid, req->rid, req->serial,
+						data_len, data_len, buf);
+				break;
+			case GR_EVENT_TYPE_SELECTION_CHANGED:
+				sc = &event.selectionchanged;
+				if(sc->new_owner != wid) {
+					fprintf(stderr, "Lost selection to "
+						"window %d\n", sc->new_owner);
+					return 0;
+				}
+			default:
+				break;
+		}
+	}
+
+	return 0;
+}
Binary files lib/microwindows/src/demos/nanox/slidebmp.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/slidebmp.bmp differ
diff -urN lib/microwindows/src/demos/nanox/slider.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/slider.c
--- lib/microwindows/src/demos/nanox/slider.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/slider.c	2005-02-21 16:12:58.000000000 +0100
@@ -0,0 +1,344 @@
+/* Copyright (c) 2000 Simon Wood <simon@mungewell.uklinux.net>
+ *
+ * This program is licensed under the same terms that Microwindows
+ * and Nano-X are licensed under.  See the file LICENSE accompanying
+ * this distribution.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+/* set up size of the grid */
+#define WIDTH_IN_TILES	4
+#define HEIGHT_IN_TILES	4
+#define MAX_TILES	(WIDTH_IN_TILES * HEIGHT_IN_TILES)
+#define USE_IMAGE	1
+
+static	int	value[WIDTH_IN_TILES][HEIGHT_IN_TILES];
+static	int	calc_width, calc_height;
+static	int	tile_width = 40;
+static	int	tile_height = 40;
+
+#if USE_IMAGE
+static	void *	image_addr;
+static	int	using_image = 1;
+static	GR_WINDOW_ID	image;		/* storage area for image */
+#endif
+
+static	GR_WINDOW_ID	master;		/* id for whole window */
+static	GR_WINDOW_ID	buttons;	/* id for buttons */
+static	GR_WINDOW_ID	tiles;		/* id for play area */
+static	GR_GC_ID	gc1;		/* graphics context for text */
+
+static  int	value[WIDTH_IN_TILES][HEIGHT_IN_TILES];
+
+/* function prototypes */
+static	void	HandleEvents();
+static	void	RefreshWindow();
+static	void	RandomiseTiles();
+static	void	MoveTile();
+static	void	DrawTile();
+
+int
+main(int argc,char **argv)
+{
+	if (GrOpen() < 0) {
+		fprintf(stderr, "cannot open graphics\n");
+		exit(1);
+	}
+		
+	gc1 = GrNewGC();
+
+#if USE_IMAGE
+	image = GrNewWindow(GR_ROOT_WINDOW_ID, 300, 0, (WIDTH_IN_TILES * tile_width),
+		(HEIGHT_IN_TILES * tile_height), 4, BLACK, WHITE);
+
+	if(argc != 2)
+		/* No image specified, use numered tiles */
+		using_image = 0;
+	else {
+		/* need to find out image size.... */
+ 		image_addr = malloc(4 * (WIDTH_IN_TILES * tile_width) *
+			(HEIGHT_IN_TILES * tile_height) );
+
+ 		image = GrNewPixmap((WIDTH_IN_TILES * tile_width),
+ 			(HEIGHT_IN_TILES * tile_height), image_addr);
+ 
+		GrDrawImageFromFile(image, gc1, 0, 0,
+			GR_IMAGE_MAX_SIZE, GR_IMAGE_MAX_SIZE, argv[1], 0);
+	}
+#endif
+	
+	/* calculate size of tile area */
+ 	calc_width = 10 + (WIDTH_IN_TILES * tile_width);
+ 	calc_height = 15 + 35 + (HEIGHT_IN_TILES * tile_height);
+#if 0
+	/* enforce minimum size */
+	if (calc_width < 240) calc_width=240;
+	if (calc_height < 320) calc_height=320;
+#endif
+	master = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, calc_width, calc_height, 1, RED, WHITE);
+ 	buttons = GrNewWindow((GR_WINDOW_ID) master, 5, 5, (calc_width - 5), 35, 1, RED, RED);
+
+	tiles = GrNewWindow((GR_WINDOW_ID) master, (calc_width/2) - (WIDTH_IN_TILES * tile_width /2),
+ 	 	45 + ((calc_height - 50)/2) - (HEIGHT_IN_TILES * tile_height /2),
+		(WIDTH_IN_TILES * tile_width), (HEIGHT_IN_TILES * tile_height), 1, RED, RED);
+
+	GrMapWindow(master);
+	GrMapWindow(buttons);
+	GrMapWindow(tiles);
+
+ 	/* set random seed */
+ 	srandom((int) getpid());
+
+	RandomiseTiles();
+	
+	GrSelectEvents(master, GR_EVENT_MASK_EXPOSURE|GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(buttons, GR_EVENT_MASK_BUTTON_DOWN); 
+	GrSelectEvents(tiles, GR_EVENT_MASK_BUTTON_DOWN);
+
+	RefreshWindow();
+
+	while (GR_TRUE) {
+		GR_EVENT event;
+
+		GrGetNextEvent(&event);
+		HandleEvents(&event);
+	}
+}
+
+
+/*
+ * Read the next event and handle it.
+ */
+void
+HandleEvents(GR_EVENT *ep)
+{
+	switch (ep->type) {
+		case GR_EVENT_TYPE_BUTTON_DOWN:
+			if (ep->button.wid == buttons) {
+ 				if (ep->button.x < (calc_width/2)) {
+					/* 'Again' */
+					RandomiseTiles();
+					RefreshWindow();
+ 				} else {
+					/* 'Quit' */
+					GrClose();
+#if USE_IMAGE
+					if (using_image)
+						free(image_addr);
+#endif
+					exit(0);
+				}
+			}
+
+			if (ep->button.wid == tiles) {
+				/* Try to move selected tile */
+				MoveTile( (int)(ep->button.x / tile_width),
+					(int)(ep->button.y / tile_height) );
+			}
+			break;
+
+		case GR_EVENT_TYPE_EXPOSURE:
+			RefreshWindow();
+			break;
+		case GR_EVENT_TYPE_CLOSE_REQ:
+			GrClose();
+			exit(0);
+	}
+
+}
+
+void
+RefreshWindow()
+{
+	int xpos, ypos;
+
+	GrSetGCForeground(gc1, WHITE);
+	GrSetGCBackground(gc1, RED);
+
+	/* draw the buttons */
+	GrRect(buttons, gc1, 0, 0, (calc_width - 12)/2, 34);
+	GrRect(buttons, gc1, (calc_width - 8)/2, 0, (calc_width - 12)/2, 34);
+
+#if 0	/* for when center align text works */
+	GrText(buttons, gc1, (calc_width - 10)/4, 22, "Again", 5, 0);
+	GrText(buttons, gc1, (calc_width - 10)*3/4, 22, "Quit", 4, 0);
+#else
+	GrText(buttons, gc1, 5, 22, "Again", 5, 0);
+	GrText(buttons, gc1, (calc_width / 2) + 5, 22, "Quit", 4, 0);
+#endif
+	
+	/* draw the tiles */
+	for (ypos=0; ypos< HEIGHT_IN_TILES; ypos++){
+		for (xpos=0; xpos< WIDTH_IN_TILES; xpos++){
+			DrawTile(xpos, ypos);
+		}
+	}
+}
+
+void
+RandomiseTiles()
+{
+	int count, xpos, ypos;
+
+	/* allocate all the numbers in order  1..MAX_TILES */
+	for (ypos=0; ypos< HEIGHT_IN_TILES; ypos++){
+		for (xpos=0; xpos< WIDTH_IN_TILES; xpos++){
+			value[xpos][ypos] = 1 + xpos + (WIDTH_IN_TILES * ypos);
+		}
+	}
+
+	/* position of 'hole' */
+	xpos = WIDTH_IN_TILES - 1;
+	ypos = HEIGHT_IN_TILES - 1;
+
+	/* randomly slide them around, ALL games can therefore solved - so no excusses!! */
+	for (count=0; count< MAX_TILES * 1000; count++){
+		switch(random() % 4) {
+			case 0:
+				if (ypos < HEIGHT_IN_TILES - 1) {
+					value[xpos][ypos] = value[xpos][ypos+1];
+					ypos++;
+					value[xpos][ypos] = MAX_TILES;
+				}
+				break;
+			case 1:
+				if (xpos > 0) {
+					value[xpos][ypos] = value[xpos - 1][ypos];
+					xpos--;
+					value[xpos][ypos] = MAX_TILES;
+				}
+				break;
+			case 2:
+				if (ypos > 0) {
+					value[xpos][ypos] = value[xpos][ypos - 1];
+					ypos--;
+					value[xpos][ypos] = MAX_TILES;
+				}
+				break;
+			case 3:
+				if (xpos < WIDTH_IN_TILES - 1) {
+					value[xpos][ypos] = value[xpos + 1][ypos];
+					xpos++;
+					value[xpos][ypos] = MAX_TILES;
+				}
+				break;
+		}
+	}
+}
+
+void
+MoveTile(xpos, ypos)
+	int xpos, ypos;
+{
+	/* check all possible moves to see if there is the blank (N,E,S,W) */
+	if (ypos > 0 && value[xpos][ypos - 1] == MAX_TILES) {
+		value[xpos][ypos - 1] = value[xpos][ypos];
+		value[xpos][ypos] = MAX_TILES;
+		DrawTile(xpos, ypos - 1);
+		DrawTile(xpos, ypos);
+	}
+
+	if (xpos < (WIDTH_IN_TILES - 1) && value[xpos + 1][ypos] == MAX_TILES) {
+		value[xpos + 1][ypos] = value[xpos][ypos];
+		value[xpos][ypos] = MAX_TILES;
+		DrawTile(xpos + 1, ypos);
+		DrawTile(xpos, ypos);
+	}
+
+	if (ypos < (HEIGHT_IN_TILES - 1) && value[xpos][ypos + 1] == MAX_TILES) {
+		value[xpos][ypos + 1] = value[xpos][ypos];
+		value[xpos][ypos] = MAX_TILES;
+		DrawTile(xpos, ypos + 1);
+		DrawTile(xpos, ypos);
+	}
+
+	if (xpos > 0 && value[xpos - 1][ypos] == MAX_TILES) {
+		value[xpos - 1][ypos] = value[xpos][ypos];
+		value[xpos][ypos] = MAX_TILES;
+		DrawTile(xpos - 1, ypos);
+		DrawTile(xpos, ypos);
+	}
+
+	/* check for a winner */
+	if (value[WIDTH_IN_TILES - 1][HEIGHT_IN_TILES - 1] == MAX_TILES) {
+		int winner = 0;
+		for (ypos=0; ypos< HEIGHT_IN_TILES; ypos++){
+			for (xpos=0; xpos< WIDTH_IN_TILES; xpos++){
+				if (value[xpos][ypos] == winner + 1)
+					winner++;
+				else 
+					winner=0;
+			}
+		}
+		if (winner == MAX_TILES) {
+			/* Do winning screen */
+			int loop = MAX_TILES;
+			for(loop=0; loop < MAX_TILES; loop++) {
+				for(winner=0; winner < (MAX_TILES - loop) ; winner++) {
+
+					/* move tiles around */
+					xpos = winner % WIDTH_IN_TILES;
+					ypos = (int)(winner/WIDTH_IN_TILES);
+					value[xpos][ypos] = loop + winner + 1; 
+					DrawTile(winner % WIDTH_IN_TILES, (int)(winner/WIDTH_IN_TILES));
+				}
+				GrFlush();
+				for(winner=0; winner < 10000000 ; winner++);
+					/* delay loop */
+			}
+			/* Print message */
+			GrSetGCForeground(gc1, WHITE);
+			GrSetGCBackground(gc1, RED);
+			GrText(tiles, gc1, ((WIDTH_IN_TILES * tile_width)/2) - 40, (HEIGHT_IN_TILES * tile_height)/2, "Well Done!!", -1, 0);
+		}
+				
+	}
+}
+
+
+void
+DrawTile(xpos, ypos)
+	int xpos, ypos;
+{
+	char text[]="00";
+
+	/* blank out old tile */
+	GrSetGCForeground(gc1, RED);
+	GrFillRect(tiles, gc1, (xpos* tile_width), (ypos*tile_height), tile_width, tile_height);
+
+	if (value[xpos][ypos] != MAX_TILES ) {
+		/* re-draw tile and number */
+		GrSetGCForeground(gc1, WHITE);
+		GrSetGCBackground(gc1, RED);
+		GrRect(tiles, gc1, (xpos*tile_width), (ypos*tile_height), tile_width, tile_height);
+		
+#if USE_IMAGE
+		if (using_image) {
+			/* copy from image window */
+			GrCopyArea(tiles, gc1, 1 + (xpos*tile_width), 1 + (ypos*tile_height), 
+				tile_width - 2, tile_height - 2, image,
+				1 + (((value[xpos][ypos] - 1) % WIDTH_IN_TILES) * tile_width), 
+				1 + (((int)(value[xpos][ypos] - 1) / WIDTH_IN_TILES) * tile_height), 0);
+		} else {
+#endif
+			/* label the tile with a number */
+			if (value[xpos][ypos] > 9)
+				text[0] = 48 + (int)(value[xpos][ypos]/10);
+			else
+				text[0] = 32;
+	
+			text[1] = 48 + value[xpos][ypos] % 10;
+			
+			GrText(tiles, gc1, (xpos*tile_width) + (tile_width /2) - 5, (ypos*tile_height) + (tile_height/2) + 5, &text, -1, 0);
+#if USE_IMAGE
+		}
+#endif
+	}
+}
diff -urN lib/microwindows/src/demos/nanox/t1demo.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/t1demo.c
--- lib/microwindows/src/demos/nanox/t1demo.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/t1demo.c	2005-02-21 16:12:58.000000000 +0100
@@ -0,0 +1,191 @@
+/*
+ * font demo for Nano-X
+ * also includes region clipping demo
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#if UNIX | DOS_DJGPP
+#include <time.h>
+#endif
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+#define MAXW 		(630-50)
+#define MAXH 		(470-50)
+
+#define CLIP_POLYGON	0	/* =1 for polygonal region test*/
+
+#if HAVE_HZK_SUPPORT
+#define BIG5
+
+#define MAXFONTS 1
+#ifndef BIG5 
+#define FONT1 "HZKFONT"
+#define FONT2 "HZKFONT"
+#define FONT3 "HZKFONT"
+#define FONT4 "HZKFONT"
+#define FONT5 "HZKFONT"
+#else
+#define FONT1 "HZXFONT"
+#define FONT2 "HZXFONT"
+#define FONT3 "HZXFONT"
+#define FONT4 "HZXFONT"
+#define FONT5 "HZXFONT"
+#endif
+#elif HAVE_T1LIB_SUPPORT
+#define MAXFONTS 5
+#define FONT1 "bchr"
+#define FONT2 "bchb"
+#define FONT3 "dcr10"
+#define FONT4 "dcbx10"
+#define FONT5 "bchri"
+#else
+/* truetype*/
+#define MAXFONTS 5
+#define FONT1 "lt1-r-omega-serif"
+#define FONT2 "arial"
+#define FONT3 "times"
+#define FONT4 "cour"
+#define FONT5 "timesi"
+#endif
+
+static char * names[5] = { FONT1, FONT2, FONT3, FONT4, FONT5 };
+
+int main()
+{
+	GR_WINDOW_ID 	window;
+	GR_EVENT 	event;
+        GR_GC_ID 	gc;
+	GR_FONT_ID	fontid;
+        int 		i, x, y;
+	GR_REGION_ID	regionid = 0;
+#if CLIP_POLYGON
+	GR_POINT	points[]={ {100, 100},
+				{300, 100},
+				{300, 300},
+				{100, 300}};
+#else
+	GR_RECT		clip_rect={100,100,300,300};
+#endif
+   
+        srand(time(0));
+   
+        GrOpen();
+	window = GrNewWindow(GR_ROOT_WINDOW_ID, 50,50, MAXW,MAXH, 4, BLACK,BLUE);
+	GrMapWindow(window);
+
+        gc = GrNewGC();
+
+#if CLIP_POLYGON
+	/* polygon clip region*/
+	regionid = GrNewPolygonRegion(MWPOLY_EVENODD, 3, points);
+#else
+	/* rectangle clip region*/
+        regionid = GrNewRegion();
+	GrUnionRectWithRegion(regionid, &clip_rect);
+#endif
+
+	GrSetGCRegion(gc, regionid);
+	
+        GrSelectEvents(window,GR_EVENT_MASK_ALL);
+        GrSetGCUseBackground(gc,GR_FALSE);
+	GrSetGCBackground(gc, GR_RGB(0, 0, 0));
+	while(1) {
+	      GrCheckNextEvent(&event);
+	   
+	      i = (int)((float)MAXFONTS * rand() / (RAND_MAX + 1.0));
+	      fontid = GrCreateFont(names[i], 20, NULL);
+	      GrSetFontSize(fontid, 1+(int)(80.0 * rand() / (RAND_MAX+1.0)));
+	      GrSetFontRotation(fontid, 330);	/* 33 degrees*/
+  	      GrSetFontAttr(fontid, GR_TFKERNING | GR_TFANTIALIAS, 0);
+  	      GrSetGCFont(gc, fontid);
+	      /*GrSetGCBackground(gc, rand() & 0xffffff);*/
+ 	      GrSetGCForeground(gc, rand() & 0xffffff);
+	      x = (int) ((MAXW * 1.0) *rand()/(RAND_MAX+1.0));
+	      y = (int) ((MAXH * 1.0) *rand()/(RAND_MAX+1.0));
+
+#if HAVE_HZK_SUPPORT
+             {//to test Unicode 16 chinese characters display ,use HZK font Bitmap font (Metrix font).
+#ifndef BIG5		
+		char buffer[256];
+		buffer[0]=0x6c;
+		buffer[1]=0x49;
+		buffer[2]=0x73;
+		buffer[3]=0x8b;
+		buffer[4]=0x79;
+		buffer[5]=0xd1;
+		buffer[6]=0x62;
+		buffer[7]=0x80;
+		buffer[8]=0x61;
+		buffer[9]=0x00;
+		buffer[10]=0x41;
+		buffer[11]=0x00;
+
+		buffer[12]=0x00;
+		buffer[13]=0xa1;
+		buffer[14]=0x00;
+		buffer[15]=0xa6;
+		buffer[16]=0x6c;
+		buffer[17]=0x49;
+		buffer[18]=0x0;
+		buffer[19]=0x0;
+		GrText(window, gc,x,y+20, buffer,17, GR_TFUC16);
+		x=0;y=16;
+		GrText(window, gc,x,y+20, buffer,17, GR_TFUC16);
+#else
+		unsigned short buffer[7];
+		buffer[0]=0x9060;
+		buffer[1]=0x898b;
+		buffer[2]=0x79d1;
+		buffer[3]=0x6280;
+		buffer[4]=0x0061;
+		buffer[5]=0x0041;
+		buffer[6]=0x0;
+		GrText(window, gc,x,y+20, buffer,7, GR_TFUC16);
+		x=0;y=16;
+		GrText(window, gc,x,y+20, buffer,7, GR_TFUC16);
+#endif
+	      }
+
+#ifndef BIG5
+	      x=0;y=16;
+	      /* HZK Metrix font test, includes Chinese and English*/
+	      GrText(window, gc,x,y, "Microwindows,��ӭʹ����Ӣ�ĵ�������",
+		      -1, GR_TFASCII);
+#else	
+	      GrText(window, gc,x,y, "Microwindows,�w��ϥΤ��^���I�}�r��",
+		      -1, GR_TFASCII);
+	      x=0;y=16*3+4;
+	      GrText(window, gc,x,y, "�t�u�v�w������", -1, GR_TFASCII);
+#endif
+	      GrFlush();
+
+#else /* !HZK_FONT_SUPPORT*/
+
+#if HAVE_BIG5_SUPPORT
+	      /* ENCODING_BIG5 test*/
+	      GrText(window, gc,x,y, "�d�d", -1, GR_TFASCII);
+#else
+#if HAVE_GB2312_SUPPORT
+	      /* ENCODING_GB2312 test*/
+	      GrText(window, gc,x,y, "\275\241\275\241", -1, GR_TFASCII);
+#else
+	      /* ASCII test*/
+	      GrText(window, gc,x,y, "Microwindows", -1, GR_TFASCII);
+#endif
+#endif
+
+#endif /* HZK_FONT_SUPPORT*/
+
+
+	      GrDestroyFont(fontid);
+
+		if(event.type == GR_EVENT_TYPE_CLOSE_REQ) {
+			GrClose();
+			exit(0);
+		}
+	}
+
+	GrDestroyRegion(regionid);
+	GrClose();
+}
diff -urN lib/microwindows/src/demos/nanox/test.pbm /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/test.pbm
--- lib/microwindows/src/demos/nanox/test.pbm	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/test.pbm	2005-02-21 16:02:59.000000000 +0100
@@ -0,0 +1,14 @@
+P1
+# A Space Invader
+14 10
+
+0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 1 1 1 1 0 0 0 0 0
+0 0 1 1 1 1 1 1 1 1 1 1 0 0
+0 1 1 1 1 1 1 1 1 1 1 1 1 0
+0 1 1 1 0 0 1 1 0 0 1 1 1 0
+0 1 1 1 1 1 1 1 1 1 1 1 1 0
+0 0 0 0 1 1 0 0 1 1 0 0 0 0
+0 0 0 1 1 0 1 1 0 1 1 0 0 0
+0 1 1 0 0 0 0 0 0 0 0 1 1 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0
Binary files lib/microwindows/src/demos/nanox/tux.gif and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/tux.gif differ
diff -urN lib/microwindows/src/demos/nanox/wait.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/wait.c
--- lib/microwindows/src/demos/nanox/wait.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/wait.c	2005-02-21 16:02:59.000000000 +0100
@@ -0,0 +1,13 @@
+/*
+ * Connect to the server, then wait until terminated (useful for stopping the server
+ * from exiting without a window manager)
+ */
+
+#include "nano-X.h"
+
+int main()
+{
+	char c;
+	read(GrOpen(), &c, 1);
+	return 0;
+}
diff -urN lib/microwindows/src/demos/nanox/world.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/world.c
--- lib/microwindows/src/demos/nanox/world.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/world.c	2005-02-21 16:12:58.000000000 +0100
@@ -0,0 +1,632 @@
+/*
+ * Draw a crude map of the world using mini-X graphics on MINIX.
+ * Converted from an Amiga program by Mike Groshart and Bob Dufford.
+ * Author: David I. Bell
+ *
+ * ported to 16 bit systems by Greg Haerr
+ */
+#include <stdio.h>
+#include <string.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+#if MSDOS
+#include <fcntl.h>
+#endif
+
+#if LINUX | DOS_DJGPP
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#endif
+
+#ifndef O_BINARY
+#define O_BINARY 	0
+#endif
+
+#if DOS_DJGPP
+#define	MAPFILE	"world.map"
+#else
+#define	MAPFILE	"demos/nanox/world.map"		/* was /usr/lib*/
+#endif
+
+#define	SELECTBUTTON	GR_BUTTON_L
+#define	COORDBUTTON	GR_BUTTON_R
+
+
+/*
+ * Definitions to use fixed point in place of true floating point.
+ */
+typedef	long	FLOAT;
+
+#define	SCALE	100		/* fixed point scaling factor */
+
+#define	FFMUL(a,b)	(((FLOAT)(a) * (b) + (SCALE / 2)) / SCALE)
+#define	FFDIV(a,b)	(((FLOAT)(a) * SCALE) / (b))
+#define	FIMUL(a,b)	((FLOAT)(a) * (b))
+#define	FIDIV(a,b)	((FLOAT)(a) / (b))
+#define	ITOF(a)		((FLOAT)(a) * SCALE)
+#define	FTOI(a)		(((FLOAT)(a) + (SCALE / 2)) / SCALE)
+
+
+#define	QSPAN	(90L*60*SCALE)	/* equator to pole (90 degrees) */
+#define HSPAN	(QSPAN*2)	/* pole to pole (180 degrees) */
+#define WSPAN	(QSPAN*4)	/* around equator (360 degrees) */
+
+#define	ABS(n)	(((n) < 0) ? -(n) : (n))
+
+
+/*
+ * Structure of a point in the database file.
+ */
+typedef struct {
+	short	Code;		/* type of point (see code_colors below) */
+	short	Lat;		/* latitude in minutes */
+	short	Lon;		/* longitude in minutes */
+} DBPOINT;
+
+#if BIGENDIAN
+#define SHORT_SWAP(p) (p = ((p & 0xff) << 8) | ((p >> 8) & 0xff))
+#define DBPOINT_CONVERT(p) (SHORT_SWAP(p->Code),SHORT_SWAP(p->Lat),SHORT_SWAP(p->Lon))
+#else
+#define DBPOINT_CONVERT(p)	((void)p)
+#endif
+
+#define POINTSize	sizeof(DBPOINT)
+#define PCount		1024		/* number of points to read at once */
+
+
+/*
+ * The following variables are the scaling factors to be used when drawing
+ * points.  However, they are larger than the true value by a factor of 60.
+ * This is done because without real floating point, their true values are
+ * too small to be accurate enough.  I cannot just increase the fixed point
+ * precision because that causes overflows.  What a pain!
+ */
+static	FLOAT		X_Scale;
+static	FLOAT		Y_Scale;
+
+/*
+ * Other variables.
+ */
+static	FLOAT		Latitude, Longitude;	/* current center of view */
+static	FLOAT		zoom;		/* current zoom scaling factor */
+
+static	FLOAT		latradius;	/* half of view of latitide */
+static	FLOAT		longradius;	/* half of view of longitude */
+static	FLOAT		viewlong;	/* amount of longitide in view */
+static	FLOAT		viewlat;	/* amount of latitude in view */
+
+static	GR_SIZE		mapwidth;	/* width of map in pixels */
+static	GR_SIZE		mapheight;	/* height of map in pixels */
+static	GR_COORD	mapxorig;	/* one half of map width */
+static	GR_COORD	mapyorig;	/* one half of map height */
+static	GR_COORD	selectx;	/* x position of current selection */
+static	GR_COORD	selecty;	/* y position of current selection */
+static	GR_COORD	selectptrx;	/* x position of pointer in selection */
+static	GR_COORD	selectptry;	/* y position of pointer in selection */
+static	GR_SIZE		selectwidth;	/* width of current selection */
+static	GR_SIZE		selectheight;	/* height of current selection */
+static	int		selectmode;	/* selection mode */
+static	GR_BOOL		selectvisible;	/* TRUE if selection is visible on screen */
+static	GR_SIZE		selectxscale;	/* x scaling factor for selection rectangle */
+static	GR_SIZE		selectyscale;	/* y scaling factor for selection rectangle */
+static	GR_BOOL		coordvisible;	/* TRUE if coordinates are visible on screen */
+static	GR_BOOL		coordenabled;	/* TRUE if coordinate display is enabled */
+static	GR_COORD	coordx;		/* x position of coordinates */
+static	GR_COORD	coordy;		/* y position of coordinates */
+static	GR_COORD	ptrx;		/* latest x position of pointer */
+static	GR_COORD	ptry;		/* latest y position of pointer */
+static	char		coordstring[32];	/* coordinate string */
+
+static	GR_WINDOW_ID	mainwid;	/* main window id */
+static	GR_WINDOW_ID	mapwid;		/* window id for map */
+static	GR_GC_ID	mapgc;		/* GC used for drawing map */
+static	GR_GC_ID	xorgc;		/* GC used for rubber banding */
+static	GR_SIZE		COLS, ROWS;
+
+
+/*
+ * Current selection mode
+ */
+#define	SELECT_NONE	0
+#define	SELECT_SCALE	1
+#define	SELECT_MOVE	2
+
+/*
+ * Order of color table (indexed by type of point):
+ *	unused
+ *	continents
+ *	countries
+ *	unused
+ *	USA states
+ *	islands
+ *	lakes
+ *	rivers
+ */
+static	GR_COLOR	code_colors[] = {
+	BLACK, GREEN, RED, BLACK, BROWN, GREEN, BLUE, BLUE
+};
+
+
+static	void	load();
+static	void	setzoom();
+static	void	checkevent();
+static	void	doexposure();
+static	void	dobuttondown();
+static	void	dobuttonup();
+static	void	doposition();
+static	void	dokeydown();
+static	void	showselection();
+static	void	showcoords();
+static	void	mintostr();
+
+
+int
+main(int argc, char **argv)
+{
+	GR_SCREEN_INFO	si;
+
+	if (GrOpen() < 0) {
+		fprintf(stderr, "Cannot open graphics\n");
+		exit(1);
+	}
+
+        GrReqShmCmds(65536); /* Test by Morten Rolland for shm support */
+
+	GrGetScreenInfo(&si);
+COLS = si.cols - 40;
+ROWS = si.rows - 80;
+
+	mainwid = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, COLS, ROWS,
+		0, BLACK, BLACK);
+
+	mapwidth = COLS - 2;
+	mapheight = ROWS - 2;
+	mapxorig = mapwidth / 2;
+	mapyorig = mapheight / 2;
+	selectxscale = 4;
+	selectyscale = 3;
+	coordx = 0;
+	coordy = ROWS - 1;
+	mapwid = GrNewWindow(mainwid, 1, 1, mapwidth, mapheight,
+		1, BLACK, WHITE);
+
+	GrSelectEvents(mainwid, GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(mapwid, GR_EVENT_MASK_EXPOSURE |
+		GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP |
+		GR_EVENT_MASK_MOUSE_POSITION | GR_EVENT_MASK_KEY_DOWN);
+
+	GrMapWindow(mainwid);
+	GrMapWindow(mapwid);
+
+	mapgc = GrNewGC();
+	xorgc = GrNewGC();
+	GrSetGCMode(xorgc, GR_MODE_XOR);
+
+	Longitude = ITOF(0);
+	Latitude = ITOF(0);
+	setzoom(ITOF(1));
+
+	while (1)
+		checkevent();
+}
+
+
+static void
+checkevent()
+{
+	GR_EVENT	event;
+
+	GrGetNextEvent(&event);
+	switch (event.type) {
+		case GR_EVENT_TYPE_EXPOSURE:
+			doexposure(&event.exposure);
+			break;
+		case GR_EVENT_TYPE_BUTTON_DOWN:
+			dobuttondown(&event.button);
+			break;
+		case GR_EVENT_TYPE_BUTTON_UP:
+			dobuttonup(&event.button);
+			break;
+		case GR_EVENT_TYPE_MOUSE_POSITION:
+			doposition(&event.mouse);
+			break;
+		case GR_EVENT_TYPE_KEY_DOWN:
+			dokeydown(&event.keystroke);
+			break;
+		case GR_EVENT_TYPE_CLOSE_REQ:
+			GrClose();
+			exit(0);
+	}
+}
+
+
+static void
+doexposure(ep)
+	GR_EVENT_EXPOSURE	*ep;
+{
+	if (ep->wid != mapwid)
+		return;
+
+	GrClearWindow(mapwid, GR_FALSE);
+	selectvisible = GR_FALSE;
+	coordvisible = GR_FALSE;
+	load(MAPFILE);
+	showselection(GR_TRUE);
+	showcoords(GR_TRUE);
+}
+
+
+static void
+dobuttondown(bp)
+	GR_EVENT_BUTTON	*bp;
+{
+	if (bp->wid != mapwid)
+		return;
+
+	if (bp->changebuttons & SELECTBUTTON) {
+		showselection(GR_FALSE);
+		selectx = bp->x;
+		selecty = bp->y;
+		selectptrx = bp->x;
+		selectptry = bp->y;
+		selectwidth = 0;
+		selectheight = 0;
+		selectmode = SELECT_SCALE;
+		showselection(GR_TRUE);
+	}
+
+	if (bp->changebuttons & COORDBUTTON) {
+		showcoords(GR_FALSE);
+		ptrx = bp->x;
+		ptry = bp->y;
+		coordenabled = GR_TRUE;
+		showcoords(GR_TRUE);
+	}
+}
+
+
+static void
+dobuttonup(bp)
+	GR_EVENT_BUTTON	*bp;
+{
+	if (bp->wid != mapwid)
+		return;
+
+	if (bp->changebuttons & COORDBUTTON) {
+		showcoords(GR_FALSE);
+		coordenabled = GR_FALSE;
+	}
+
+	if (bp->changebuttons & SELECTBUTTON) {
+		showselection(GR_FALSE);
+		if (selectmode == SELECT_NONE)
+			return;
+		selectmode = SELECT_NONE;
+		if (selectwidth <= 0)
+			return;
+		Longitude +=
+			FIDIV(FIMUL(viewlong, selectx - mapxorig), mapwidth);
+		Latitude -=
+			FIDIV(FIMUL(viewlat, selecty - mapyorig), mapheight);
+		setzoom(FIDIV(FIMUL(zoom, mapwidth), selectwidth));
+		GrClearWindow(mapwid, GR_TRUE);
+	}
+}
+
+
+static void
+doposition(mp)
+	GR_EVENT_MOUSE	*mp;
+{
+	GR_SIZE	temp;
+
+	if (mp->wid != mapwid)
+		return;
+
+	if (coordenabled) {
+		showcoords(GR_FALSE);
+		ptrx = mp->x;
+		ptry = mp->y;
+		showcoords(GR_TRUE);
+	}
+
+	showselection(GR_FALSE);
+	switch (selectmode) {
+		case SELECT_SCALE:
+			selectwidth = ABS(mp->x - selectx) * 2 + 1;
+			selectheight = ABS(mp->y - selecty) * 2 + 1;
+			temp = ((long) selectwidth) * selectyscale
+				/ selectxscale;
+			if (selectheight < temp)
+				selectheight = temp;
+			temp = ((long) selectheight) * selectxscale
+				/ selectyscale;
+			if (selectwidth < temp)
+				selectwidth = temp;
+			break;
+
+		case SELECT_MOVE:
+			selectx += (mp->x - selectptrx);
+			selecty += (mp->y - selectptry);
+			break;
+	}
+
+	selectptrx = mp->x;
+	selectptry = mp->y;
+	showselection(GR_TRUE);
+}
+
+
+static void
+dokeydown(kp)
+	GR_EVENT_KEYSTROKE	*kp;
+{
+	if (kp->wid != mapwid)
+		return;
+
+	if (selectmode != SELECT_NONE) {
+		switch (kp->ch) {
+			case 's':	/* scale selection */
+				selectmode = SELECT_SCALE;
+				break;
+
+			case 'm':	/* move selection */
+				selectmode = SELECT_MOVE;
+				break;
+
+			case '\033':	/* cancel selection */
+				showselection(GR_FALSE);
+				selectmode = SELECT_NONE;
+				break;
+		}
+		return;
+	}
+
+	switch (kp->ch) {
+		case 'q':		/* quit */
+		case 'Q':
+			GrClose();
+			exit(0);
+
+		case 't':		/* redraw total map */
+			Longitude = ITOF(0);
+			Latitude = ITOF(0);
+			setzoom(ITOF(1));
+			GrClearWindow(mapwid, GR_TRUE);
+	}
+}
+
+
+/*
+ * Draw or erase the current selection if any is defined.
+ * The selection is a rectangle centered on a specified point, and with a
+ * specified width and height.  Drawing and erasing the selection are the
+ * same drawing operation because of the XOR operation.
+ */
+static void
+showselection(show)
+	GR_BOOL	show;		/* TRUE if show the selection */
+{
+	if ((show == 0) == (selectvisible == 0))
+		return;
+	if (selectmode == SELECT_NONE)
+		return;
+	GrRect(mapwid, xorgc, selectx - selectwidth / 2,
+		selecty - selectheight / 2, selectwidth, selectheight);
+	selectvisible = show;
+}
+
+
+/*
+ * Draw or erase the coordinate string of the current pointer position.
+ * Both of these are the same operation because of the XOR operation.
+ */
+static void
+showcoords(show)
+	GR_BOOL	show;		/* TRUE if show the coordinates */
+{
+	long	curlong;
+	long	curlat;
+	FLOAT	ptrlat;
+	FLOAT	ptrlong;
+
+	if (((show == 0) == (coordvisible == 0)) || !coordenabled)
+		return;
+
+	if (show) {
+		ptrlat = FIDIV(FIMUL(viewlat, ptry), mapheight - 1);
+		ptrlong = FIDIV(FIMUL(viewlong, ptrx), mapwidth - 1);
+
+		curlat = FTOI(Latitude + latradius - ptrlat);
+		curlong = FTOI(Longitude - longradius + ptrlong);
+
+		if (curlong > 180*60)
+			curlong -= 360*60;
+		if (curlong < -180*60)
+			curlong += 360*60;
+
+		mintostr(coordstring, curlong);
+		strcat(coordstring, "  ");
+		mintostr(coordstring + strlen(coordstring), curlat);
+	}
+
+	GrText(mapwid, xorgc, coordx, coordy, coordstring, -1, GR_TFBOTTOM);
+	coordvisible = show;
+}
+
+
+/*
+ * Convert minutes to a string of the form "ddd'mm" and store it
+ * into the indicated buffer.
+ */
+static void
+mintostr(buf, minutes)
+	char	*buf;
+	long	minutes;
+{
+	if (minutes < 0) {
+		minutes = -minutes;
+		*buf++ = '-';
+	}
+	sprintf(buf, "%ld'%02ld", (long)(minutes / 60), (long)(minutes % 60));
+}
+
+
+#if 0
+/*
+ * Convert "ddd'mm" to mins
+ */
+static long
+degtomin(s)
+	char	*s;
+{
+	int	deg, minutes;
+	char	str[10],*strchr(),*cp;
+
+	strcpy(str,s);
+	if (cp = strchr(str,'\047')) {
+		*cp = '\0';
+		minutes = atoi(++cp);
+	} else
+		minutes = 0;
+	if ((deg = atoi(str)) < 0)
+		minutes = -minutes;
+	return(deg * 60 + minutes);
+}
+#endif
+
+
+/*
+ * Set the scale factors for the given zoom factor.
+ * The factors 3 and 4 are here to compensate for the screen aspect ratio.
+ */
+static void
+setzoom(newzoom)
+	FLOAT	newzoom;
+{
+	zoom = newzoom;
+
+	Y_Scale = FIDIV(FIMUL(zoom, mapheight * 3), 180 * 4);
+	X_Scale = FIDIV(FIMUL(zoom, mapwidth), 360);
+
+	viewlong = FFDIV(WSPAN, zoom);
+	viewlat = FFDIV(HSPAN * 4 / 3, zoom);
+	longradius = FIDIV(viewlong, 2);
+	latradius = FIDIV(viewlat, 2);
+}
+
+
+/*
+ * Read the database file and draw the world.
+ */
+static void
+load(fn)
+	char	*fn;
+{
+	register DBPOINT	*pp;
+	DBPOINT		*pend;
+	FLOAT		x, y, LonPrv, LatPrv;
+	long		oldlong = 0L;
+	GR_COORD	xnew, ynew;
+	GR_COORD	xold = 0, yold = 0;
+	GR_BOOL		is_out;
+	GR_BOOL		was_out;
+	GR_BOOL		newseg = GR_FALSE;
+	GR_COLOR	oldcolor;
+	GR_COLOR	newcolor;
+	int		n;
+	int		fh;
+	DBPOINT		p[PCount];
+
+	LonPrv = ITOF(0);
+	LatPrv = ITOF(0);
+	oldcolor = -1;
+	is_out = GR_FALSE;
+	was_out = GR_FALSE;
+
+	fh = open(fn, O_BINARY);
+	if (fh < 0) {
+		GrClose();
+		fprintf(stderr, "Cannot open %s\n", fn);
+		exit(1);
+	}
+
+	while ((n = read(fh, p, PCount * POINTSize)) > 0) {
+		for (pp = p,pend = p + n/POINTSize; pp < pend; pp++)
+		{
+			DBPOINT_CONVERT(pp);
+			/* do displacement */
+			x = ITOF(pp->Lon) - Longitude;
+			y = ITOF(pp->Lat) - Latitude;
+
+			/* wrap around for East-West */
+			if (x < -HSPAN)
+				x += WSPAN;
+			if (x > HSPAN)
+				x -= WSPAN;
+
+			if (pp->Code > 5) {
+				newcolor = code_colors[pp->Code / 1000];
+				if (newcolor != oldcolor) {
+					oldcolor = newcolor;
+					GrSetGCForeground(mapgc, oldcolor);
+				}
+				newseg = GR_TRUE;
+			}
+
+			if (oldcolor == BLACK)
+				goto go_on;
+
+			/* ignore points outside magnified area */
+			if ((x < -longradius || x > longradius ||
+				y < -latradius || y > latradius))
+			{
+				is_out = 1;
+				if (was_out) {		/* out to out */
+					LonPrv = x;
+					LatPrv = y;
+					goto go_on;
+				}
+
+				/* in to out */
+				xold = mapxorig + FTOI(FFMUL(LonPrv, X_Scale)) / 60;
+				yold = mapyorig - FTOI(FFMUL(LatPrv, Y_Scale)) / 60;
+			} else {			/* out to in */
+				is_out = 0;
+				if (was_out) {
+					xold = mapxorig +
+						FTOI(FFMUL(LonPrv, X_Scale)) / 60;
+					yold = mapyorig -
+						FTOI(FFMUL(LatPrv, Y_Scale)) / 60;
+				}
+				/* in to in */
+			}
+			LonPrv = x;
+			LatPrv = y;
+
+			/* scale points w/in area to interlace screen */
+			xnew = mapxorig + FTOI(FFMUL(x, X_Scale)) / 60;
+			ynew = mapyorig - FTOI(FFMUL(y, Y_Scale)) / 60;
+
+			/* if new segment, move to place */
+			if (newseg || ABS(oldlong - pp->Lon) > 180*60) {
+				xold = xnew;
+				yold = ynew;
+			}
+			oldlong = pp->Lon;
+
+			GrLine(mapwid, mapgc, xold, yold, xnew, ynew);
+			xold = xnew;
+			yold = ynew;
+go_on:
+			was_out = is_out;
+			newseg = GR_FALSE;
+		}
+	}
+	close(fh);
+}
+
+/* END CODE */
Binary files lib/microwindows/src/demos/nanox/world.map and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nanox/world.map differ
diff -urN lib/microwindows/src/demos/nwidget/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nwidget/Makefile
--- lib/microwindows/src/demos/nwidget/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nwidget/Makefile	2005-02-21 16:12:59.000000000 +0100
@@ -0,0 +1,45 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES += -DMWIN
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(NWIDGET), Y)
+ifeq ($(NANOXDEMO), Y)
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME =
+
+# List of objects to compile
+OBJS = ntest.o
+
+all: default $(TOP)/bin/ntest
+
+endif
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
+$(TOP)/bin/ntest: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(NANOXCLIENTLIBS)
diff -urN lib/microwindows/src/demos/nwidget/ntest.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nwidget/ntest.c
--- lib/microwindows/src/demos/nwidget/ntest.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nwidget/ntest.c	2005-02-21 16:12:59.000000000 +0100
@@ -0,0 +1,126 @@
+/*
+ * NanoWidgets v0.2
+ * (C) 1999 Screen Media AS
+ * 
+ * Written by Vidar Hokstad
+ * 
+ * Contains code from The Nano Toolkit,
+ * (C) 1999 by Alexander Peuchert.
+ *
+ */
+
+#include <nwidgets.h>
+
+#include <stdio.h>
+#include <string.h>
+#if UNIX
+#include <unistd.h>
+#endif
+
+/****************** Test ****************************************/
+
+void onclick(NBUTTON * w, int b)
+{
+   printf("Button %d was clicked in widget %p\n",b,w);
+}
+
+int main ()
+{
+   NWIDGET * w;
+   NWIDGET * w2;
+   
+   NBUTTON * b1;
+   NBUTTON * b2;
+   NBUTTON * b3;
+   NTOGGLE * b4;
+
+   NSLIDER * s;
+
+   NRADIO * r1;
+   NRADIO * r2;
+
+   NTEXTFIELD * t;
+
+   n_init_button_class();
+   n_init_slider_class();
+   n_init_toggle_class();
+   n_init_radio_class();
+   n_init_textfield_class();
+
+#ifndef MWIN
+   sleep(2);
+#endif
+   
+   w = NEW_NOBJECT(widget);
+   w2 = NEW_NOBJECT(widget);
+
+   b1 = NEW_NOBJECT(button);
+   b2 = NEW_NOBJECT(button);
+   b3 = NEW_NOBJECT(button);
+   b4 = NEW_NOBJECT(toggle);
+   
+   s = NEW_NOBJECT(slider);
+   
+   r1 = NEW_NOBJECT(radio);
+   r2 = NEW_NOBJECT(radio);
+   
+   t = NEW_NOBJECT(textfield);
+   
+   n_widget_init(w,0);   
+   n_widget_resize(w,300,200);
+   n_widget_show(w);
+   
+   n_widget_init(w2,0);   
+   n_widget_move(w2,300,300);
+   n_widget_resize(w2,400,300);
+   n_widget_show(w2);
+
+   n_button_init(b1,w,"text1");
+   n_widget_resize(b1,30,30);
+   n_button_onclick(b1,onclick);
+   n_widget_show(b1);
+   
+   n_button_init(b2,w2,"test");
+   n_widget_resize(b2,30,30);
+   n_button_onclick(b2,onclick);
+   n_widget_show(b2);
+
+   n_button_init(b3,w,"label");
+   n_widget_move(b3,10,10);
+   n_widget_resize(b3,60,30);
+   n_button_onclick(b3,onclick);
+   n_widget_show(b3);
+   
+   n_toggle_init(b4,w);
+   n_widget_move(b4,10,90);
+   n_widget_resize(b4,15,15);
+   n_widget_show(b4);
+
+   n_slider_init(s,w);
+   n_widget_move(s,200,100);
+   n_widget_resize(s,100,100);
+   n_widget_show(s);
+   
+   n_radio_init(r1,w2);
+   n_widget_move(r1,20,20);
+   n_widget_resize(r1,20,20);
+   n_widget_show(r1);
+   
+   n_radio_init(r2,w2);
+   n_widget_move(r2,45,20);
+   n_widget_resize(r2,20,20);
+   n_radio_connect(r1,r2);
+   n_widget_show(r2);
+
+   n_textfield_init(t,w2,"This is my text");
+   n_widget_move(t,45,100);
+   n_widget_resize(t,200,20);
+   n_widget_show(t);
+
+   n_main();
+
+   n_widget_hide(w);
+   n_object_cleanup(w);
+   
+   GrClose();
+}
diff -urN lib/microwindows/src/demos/nxkbd/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/Makefile
--- lib/microwindows/src/demos/nxkbd/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/Makefile	2005-02-21 16:12:59.000000000 +0100
@@ -0,0 +1,48 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(NANOWM), Y)
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME =
+
+# List of objects to compile
+OBJS = nxkbd.o srvconn.o keynorm.o keyctrl.o keyshft.o keynum.o
+
+all: default $(TOP)/bin/nxkbd
+
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
+ifeq ($(SHAREDLIBS), Y)
+$(TOP)/bin/nxkbd: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(CCNANOXCLIENTLIBS)
+else
+$(TOP)/bin/nxkbd: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(NANOXCLIENTLIBS)
+endif
diff -urN lib/microwindows/src/demos/nxkbd/Makefile.org /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/Makefile.org
--- lib/microwindows/src/demos/nxkbd/Makefile.org	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/Makefile.org	2005-02-21 16:13:00.000000000 +0100
@@ -0,0 +1,36 @@
+# Copyright (C) 2000 by VTech Informations LTD.
+# Vladimir Cotfas <vladimircotfas@vtech.ca> Aug 31, 2000
+
+CC = gcc
+CC_FLAGS = -O2 -Wall
+#CC_FLAGS =  -g -O0   
+LINKER = gcc
+
+MWIN_DIR = /home/greg/net/microwin/src
+MWIN_INCLUDE = $(MWIN_DIR)/include
+MWIN_LIB = $(MWIN_DIR)/lib
+
+CC_INCLUDES = -I$(MWIN_INCLUDE)
+nxkbd_LIBS = -L$(MWIN_LIB) -lnano-X
+#nxkbd_LIBS = -L$(MWIN_LIB) -lnano-X -lmwengine -lmwdrivers -lmwfonts -L/usr/X11R6/lib -lX11
+nxkbd_OBJECTS = nxkbd.o srvconn.o keynorm.o keyctrl.o keyshft.o keynum.o
+
+all: nxkbd
+
+nxkbd: $(nxkbd_OBJECTS)
+	$(LINKER) -o nxkbd $(LINKER_ENTRY) $(LINKER_FLAGS) $(nxkbd_OBJECTS) $(nxkbd_LIBS)
+
+.c.o:
+	$(CC) -c $< $(CC_FLAGS) $(CC_DEFINES) $(CC_INCLUDES)
+
+%.c:%.bmp $(MWIN_DIR)/mwin/bmp/convbmp.c
+	echo "Generating $@ from bitmap file ..."
+	$(MWIN_DIR)/bin/convbmp $< > $@
+
+stripped: nxkbd
+	strip nxkbd
+
+clean:
+	rm -f *.o
+	rm -f nxkbd
+
Binary files lib/microwindows/src/demos/nxkbd/keyctrl.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/keyctrl.bmp differ
diff -urN lib/microwindows/src/demos/nxkbd/keyctrl.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/keyctrl.c
--- lib/microwindows/src/demos/nxkbd/keyctrl.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/keyctrl.c	2005-02-21 16:03:00.000000000 +0100
@@ -0,0 +1,83 @@
+/* Generated by convbmp*/
+#include "device.h"
+
+/* MWIMAGEHDR image_keyctrl converted from keyctrl.bmp*/
+
+static MWPALENTRY palette[2] = {
+  RGBDEF(   0,   0,   0 ),	/* pal 0*/
+  RGBDEF( 255, 255, 255 ),	/* pal 1*/
+};
+
+static MWUCHAR imagebits[] = {
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xe2,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xd0,0xce,0xff,0xfb,0xff,0xef,0xff,0xbf,0xee,
+0x46,0xad,0xea,0xad,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xd7,0xb6,0xff,0xfb,0xff,0xef,0xff,0xbf,0xee,
+0x7a,0xad,0xda,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xd7,0xf6,0xff,0xfb,0xff,0xef,0xff,0xbe,0x2e,
+0x7a,0xad,0xda,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xdb,0xf6,0xff,0xfb,0xff,0xef,0xff,0xbe,0xee,
+0x66,0xad,0xda,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xdd,0xce,0xff,0xfb,0xff,0xef,0xff,0xbe,0x3e,
+0x5e,0x68,0x8a,0x91,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xde,0xf6,0xff,0xfb,0xff,0xef,0xff,0xa6,0xfe,
+0x5e,0xfd,0xda,0xfb,0x57,0xff,0xff,0xff,0xff,0xff,0xfb,0xde,0xf6,0xff,0xfb,0xff,0xef,0xff,0xaa,0x3e,
+0x62,0xee,0xda,0xfb,0x57,0xff,0xff,0xff,0xff,0xff,0xfb,0xd6,0xb6,0xff,0xfb,0xff,0xef,0xff,0xab,0xfe,
+0x7f,0xff,0xfb,0xff,0x77,0xff,0xff,0xff,0xff,0xff,0xfb,0x99,0xce,0xff,0xfb,0xff,0xef,0xff,0xab,0xfe,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xa7,0xfe,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x0f,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x00,0x00,0x0f,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x00,0x00,0x0f,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0x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xf7,0xc3,0xdf,0x7f,0x7e,0xfd,0xf6,0xf7,0xdb,0xdf,0xbf,0x7d,0xbd,0xf6,0xf5,0xfe,0xbe,
+0x7b,0x7d,0xea,0xf7,0xdb,0xdf,0x7f,0x7e,0xfd,0xf6,0xf7,0xdb,0xdf,0xbf,0x7d,0xbd,0xf6,0xf4,0x31,0xbe,
+0x7b,0x7d,0xee,0xf7,0xdb,0xdf,0x3f,0x7e,0xfd,0xf6,0xf7,0xdb,0xdf,0xbf,0x7d,0xbd,0xf6,0xf5,0xef,0xbe,
+0x7c,0x7d,0xee,0xf7,0xe7,0xdf,0x5f,0x7c,0x3d,0xf6,0xf7,0xdb,0xdf,0xbf,0x7e,0x7d,0xf1,0xf5,0xef,0xbe,
+0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7e,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf5,0xef,0xba,
+0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7e,0xfd,0xff,0xf7,0xff,0xdf,0xbf,0x7f,0xfd,0xff,0xf4,0x30,0xc6,
+0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe,
+0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe,
+0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+};
+
+MWIMAGEHDR image_keyctrl = {
+  160, 61,	/* width, height*/
+  1, 1,		/* planes, bpp*/
+  20, 1,	/* pitch, bytesperpixel*/
+  1, 2,	/* compression, palsize*/
+  -1L,		/* transcolor*/
+  palette,
+  imagebits,
+};
Binary files lib/microwindows/src/demos/nxkbd/keynorm.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/keynorm.bmp differ
diff -urN lib/microwindows/src/demos/nxkbd/keynorm.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/keynorm.c
--- lib/microwindows/src/demos/nxkbd/keynorm.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/keynorm.c	2005-02-21 16:03:01.000000000 +0100
@@ -0,0 +1,83 @@
+/* Generated by convbmp*/
+#include "device.h"
+
+/* MWIMAGEHDR image_keynorm converted from keynorm.bmp*/
+
+static MWPALENTRY palette[2] = {
+  RGBDEF(   0,   0,   0 ),	/* pal 0*/
+  RGBDEF( 255, 255, 255 ),	/* pal 1*/
+};
+
+static MWUCHAR imagebits[] = {
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xd0,0xce,0xff,0xfb,0xff,0xef,0xef,0xbf,0x7e,
+0x46,0xad,0xea,0xad,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xd7,0xb6,0xff,0xfb,0xff,0xef,0xef,0xbf,0x7e,
+0x7a,0xad,0xda,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xd7,0xf6,0xff,0xfb,0xff,0xef,0xef,0xbf,0x7e,
+0x7a,0xad,0xda,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xdb,0xf6,0xff,0xfb,0xc0,0xef,0xdf,0xbf,0xbe,
+0x66,0xad,0xda,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xdd,0xce,0xff,0xfb,0xff,0xef,0xdf,0xbf,0xbe,
+0x5e,0x68,0x8a,0x91,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xde,0xf6,0xfd,0xfb,0xc0,0xef,0xdf,0xbf,0xbe,
+0x5e,0xfd,0xda,0xfb,0x57,0xff,0xff,0xff,0xff,0xff,0xfb,0xde,0xf6,0xfe,0xfb,0xff,0xef,0xbf,0xbf,0xde,
+0x62,0xee,0xda,0xfb,0x57,0xff,0xff,0xff,0xff,0xff,0xfb,0xd6,0xb6,0xfc,0xfb,0xff,0xef,0xbf,0xbf,0xde,
+0x7f,0xff,0xfb,0xff,0x77,0xff,0xff,0xff,0xff,0xff,0xfb,0x99,0xce,0xfc,0xfb,0xff,0xef,0xbf,0xbf,0xde,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x7f,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x7f,0xff,0xef,0xff,0x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0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+};
+
+MWIMAGEHDR image_keynorm = {
+  160, 61,	/* width, height*/
+  1, 1,		/* planes, bpp*/
+  20, 1,	/* pitch, bytesperpixel*/
+  1, 2,	/* compression, palsize*/
+  -1L,		/* transcolor*/
+  palette,
+  imagebits,
+};
Binary files lib/microwindows/src/demos/nxkbd/keynum.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/keynum.bmp differ
diff -urN lib/microwindows/src/demos/nxkbd/keynum.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/keynum.c
--- lib/microwindows/src/demos/nxkbd/keynum.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/keynum.c	2005-02-21 16:03:01.000000000 +0100
@@ -0,0 +1,83 @@
+/* Generated by convbmp*/
+#include "device.h"
+
+/* MWIMAGEHDR image_keynum converted from keynum.bmp*/
+
+static MWPALENTRY palette[2] = {
+  RGBDEF(   0,   0,   0 ),	/* pal 0*/
+  RGBDEF( 255, 255, 255 ),	/* pal 1*/
+};
+
+static MWUCHAR imagebits[] = {
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xf8,0x2f,0x30,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x46,0xad,0xea,0xad,0xd7,0xff,0xff,0xff,0xff,0xff,0xf8,0x28,0x48,0xf8,0xfb,0xe3,0xef,0xef,0xbe,0xfe,
+0x7a,0xad,0xda,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xf8,0x28,0x08,0xfb,0xfb,0xfb,0xef,0xdf,0xbf,0x7e,
+0x7a,0xad,0xda,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xf8,0x24,0x08,0xfb,0xfb,0xfb,0xef,0xdf,0xbf,0x7e,
+0x66,0xad,0xda,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xf8,0x22,0x30,0xfb,0xfb,0xfb,0xef,0xdf,0xbf,0x7e,
+0x5e,0x68,0x8a,0x91,0xd7,0xff,0xff,0xff,0xff,0xff,0xf8,0x21,0x08,0xfb,0xfb,0xfb,0xef,0xbf,0xbf,0xbe,
+0x5e,0xfd,0xda,0xfb,0x57,0xff,0xff,0xff,0xff,0xff,0xf8,0x21,0x08,0xfb,0xfb,0xfb,0xef,0xdf,0xbf,0x7e,
+0x62,0xee,0xda,0xfb,0x57,0xff,0xff,0xff,0xff,0xff,0xf8,0x29,0x48,0xfb,0xfb,0xfb,0xef,0xdf,0xbf,0x7e,
+0x7f,0xff,0xfb,0xff,0x77,0xff,0xff,0xff,0xff,0xff,0xf8,0x66,0x30,0xfb,0xfb,0xfb,0xef,0xdf,0xbf,0x7e,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0xf8,0xfb,0xe3,0xef,0xef,0xbe,0xfe,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x7f,0xff,0xfb,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0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,0xff,0xf7,0xff,0xfe,
+0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+};
+
+MWIMAGEHDR image_keynum = {
+  160, 61,	/* width, height*/
+  1, 1,		/* planes, bpp*/
+  20, 1,	/* pitch, bytesperpixel*/
+  1, 2,	/* compression, palsize*/
+  -1L,		/* transcolor*/
+  palette,
+  imagebits,
+};
Binary files lib/microwindows/src/demos/nxkbd/keyshft.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/keyshft.bmp differ
diff -urN lib/microwindows/src/demos/nxkbd/keyshft.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/keyshft.c
--- lib/microwindows/src/demos/nxkbd/keyshft.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/keyshft.c	2005-02-21 16:03:01.000000000 +0100
@@ -0,0 +1,83 @@
+/* Generated by convbmp*/
+#include "device.h"
+
+/* MWIMAGEHDR image_keyshft converted from keyshft.bmp*/
+
+static MWPALENTRY palette[2] = {
+  RGBDEF(   0,   0,   0 ),	/* pal 0*/
+  RGBDEF( 255, 255, 255 ),	/* pal 1*/
+};
+
+static MWUCHAR imagebits[] = {
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x03,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x00,0x00,0x03,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x00,0x00,0x03,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xd0,0xce,0xff,0xfb,0xff,0xef,0xdf,0xbf,0x7e,
+0x39,0x52,0x12,0xad,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xd7,0xb6,0xff,0xfb,0xf7,0xef,0xdf,0xbf,0xfe,
+0x05,0x52,0x22,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xd7,0xf6,0xff,0xfb,0xf7,0xef,0xdf,0xbf,0x7e,
+0x05,0x52,0x22,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xdb,0xf6,0xff,0xfb,0xf7,0xef,0xdf,0xbf,0x7e,
+0x19,0x52,0x22,0xab,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xdd,0xce,0xff,0xfb,0x80,0xef,0xdf,0xbf,0xbe,
+0x21,0x97,0x72,0x91,0xd7,0xff,0xff,0xff,0xff,0xff,0xfb,0xde,0xf6,0xfa,0xfb,0xf7,0xef,0xdf,0xbf,0xde,
+0x21,0x02,0x22,0xfb,0x57,0xff,0xff,0xff,0xff,0xff,0xfb,0xde,0xf6,0xfa,0xfb,0xf7,0xef,0xdf,0xbf,0xde,
+0x1d,0x11,0x22,0xfb,0x57,0xff,0xff,0xff,0xff,0xff,0xfb,0xd6,0xb6,0xfa,0xfb,0xf7,0xef,0xdf,0xbd,0xde,
+0x00,0x00,0x23,0xff,0x77,0xff,0xff,0xff,0xff,0xff,0xfb,0x99,0xce,0xff,0xfb,0xff,0xef,0xdf,0xbe,0x3e,
+0x00,0x00,0x03,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x00,0x00,0x03,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x00,0x00,0x03,0xff,0xf7,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x7f,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x7f,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,0xff,0xfb,0xff,0xef,0xff,0xbf,0xfe,
+0x7f,0xff,0xef,0x07,0xbd,0xde,0xf8,0xfb,0xf7,0xef,0x0f,0xbd,0xce,0xef,0xbb,0xfd,0xef,0xbf,0xbf,0xfe,
+0x67,0x5d,0xef,0x7f,0xbd,0xde,0xf7,0x7b,0xf7,0xef,0x77,0xbd,0xce,0xef,0xbb,0xfb,0xef,0xdf,0xbf,0xfe,
+0x5a,0xdd,0xef,0x7f,0xbd,0xde,0xf7,0xfb,0xf7,0xef,0x77,0xbd,0xae,0xef,0xbb,0xf7,0xef,0xef,0xbf,0x3e,
+0x5e,0xdd,0xef,0xbf,0xbe,0xbe,0xf7,0xfb,0xeb,0xef,0x77,0xbd,0xae,0xef,0xbb,0xef,0xef,0xf7,0xbf,0x3e,
+0x5e,0xcd,0xef,0xdf,0xbf,0x7e,0xf7,0xfb,0xeb,0xef,0x0f,0xbd,0x6e,0xef,0xbb,0xdf,0xef,0xfb,0xbf,0xfe,
+0x5c,0x55,0xef,0xef,0xbe,0xbe,0xf7,0xfb,0xeb,0xef,0x77,0xbd,0x6e,0xed,0xbb,0xef,0xef,0xf7,0xbf,0x3e,
+0x5a,0xfd,0xef,0xf7,0xbd,0xde,0xf7,0xfb,0xdd,0xef,0x77,0xbc,0xee,0xea,0xbb,0xf7,0xef,0xef,0xbf,0x3e,
+0x66,0xfd,0xef,0xf7,0xb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f7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe,
+0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe,
+0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xdf,0xff,0x7f,0xfd,0xff,0xf7,0xff,0xfe,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+};
+
+MWIMAGEHDR image_keyshft = {
+  160, 61,	/* width, height*/
+  1, 1,		/* planes, bpp*/
+  20, 1,	/* pitch, bytesperpixel*/
+  1, 2,	/* compression, palsize*/
+  -1L,		/* transcolor*/
+  palette,
+  imagebits,
+};
diff -urN lib/microwindows/src/demos/nxkbd/nxkbd.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/nxkbd.c
--- lib/microwindows/src/demos/nxkbd/nxkbd.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/nxkbd.c	2005-02-21 16:12:59.000000000 +0100
@@ -0,0 +1,372 @@
+/*
+ * nxkbd.c - Software popup keyboard for Nano-X
+ *
+ * Copyright (C) 2000 by Greg Haerr <greg@censoft.com>
+ *	linked-in bitmaps, redrawn keymaps
+ *	enhanced shift/control function, fnkeys
+ *	supports all ascii values 1-127
+ * Copyright (C) 2000 by VTech Informations LTD.
+ * Vladimir Cotfas <vladimircotfas@vtech.ca> Aug 31, 2000
+ *   initial port to Nano-X
+ * Copyright (C) 2000 by Jay Carlson
+ *   initial soft kbd for W
+ *
+ * This code is licensed with the same license as Microwindows.
+ * 
+ * #define KBDPIPE in srvconn.c for named pipe keyboard driver.
+ * Otherwise, the GrInjectKeyboardEvent method is used.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+#define TITLE 		"Soft Keyboard"
+#define DISKIMAGES	0		/* =0 use linked-in images*/
+//#define _SOFTKBD_DEBUG	1
+
+/* kbd states, each with unique bitmap*/
+#define NORM		1000
+#define CNTRL		1001
+#define SHIFT		1002
+#define NUM 		1003
+#define INTL 		1004
+
+/* special chars*/
+#define BS		'\b'		/* value of <- on kbd*/
+#define F1		2000
+#define NONE		3000
+
+/* number of charcodes per bitmap*/
+#define SCANCODES	41
+
+/* size of bitmaps*/
+#define BM_WIDTH 	160
+#define BM_HEIGHT 	61
+
+struct keycolumn {
+        short xoffset;
+        short scancode;
+};
+
+struct keyrow {
+        short yoffset;
+        short height;
+        struct keycolumn columns[12];
+};
+
+/* fixed layout for each scancode location*/
+struct keyrow keyrows[4] = {
+        {0, 15, 
+         {{0, 0}, {14, 1}, {28, 2}, {42, 3}, {56, 4}, {70, 5}, {84, 6}, {98, 7}, {112, 8}, {126, 9}, {140, 10}, {999, -1}}},
+        {15, 15, 
+         {{0, 11}, {14, 12}, {28, 13}, {42, 14}, {56, 15}, {70, 16}, {84, 17}, {98, 18}, {112, 19}, {126, 20}, {140, 21}, {999, -1}}},
+        {30, 15, 
+         {{0, 22}, {19, 23}, {33, 24}, {47, 25}, {61, 26}, {75, 27}, {89, 28}, {103, 29}, {117, 30}, {131, 31}, {145, 32}, {999, -1}} },
+        {45, 15, 
+         {{0, 33}, {21, 34}, {36, 35}, {85, 36}, {103, 37}, {117, 38}, {131, 39}, {145, 40}, {999, -1}}}
+};
+
+#define C(x)	((x)&0x1f)
+
+/* charcode mappings per kbd state*/
+static short normal[SCANCODES] = {
+ 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', BS,
+ 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', '-', '\r',
+ CNTRL, 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', ';',
+ SHIFT, INTL, ' ', NUM, '\'', '=', '\\', '/'
+};
+
+static short control[SCANCODES] = {
+ C('q'),C('w'),C('e'),C('r'),C('t'),C('y'),C('u'),C('i'),C('o'),C('p'),'\033', 
+ C('a'),C('s'),C('d'),C('f'),C('g'),C('h'),C('j'),C('k'),C('l'),C('_'),'\r',
+ CNTRL,C('z'),C('x'),C('c'),C('v'),C('b'),C('n'),C('m'),C('\\'),C(']'),C('^'),
+ SHIFT,INTL,' ',NUM,NONE,NONE,NONE,'\177'
+};
+
+static short shift[SCANCODES] = {
+ 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', BS,
+ 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', '_', '\r',
+ CNTRL, 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', ':',
+ SHIFT, INTL, ' ', NUM, '"', '+', '|', '?'
+};
+
+static short num[SCANCODES] = {
+ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', BS,
+ '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '\r',
+ CNTRL, F1, F1+1, F1+2, F1+3, F1+4, F1+5, F1+6, F1+7, '`', '~',
+ SHIFT, INTL, ' ', NUM, '[', ']', '{', '}'};
+
+static char *fnkey[] = {
+	"\033OP", "\033OQ", "\033OR", "\033OS", "\03315~",
+	"\03317~", "\03318~", "\03319~", "\03320~", "\03321~"
+};
+
+struct layout_state {
+        char *filename;
+        GR_IMAGE_HDR *imagehdr;
+        short *scancode_translations;
+        short sshift;
+        short ctrl_layout, shift_layout, num_layout;
+};
+
+/* auto-converted .bmp files for internal linking*/
+extern GR_IMAGE_HDR image_keynorm;
+extern GR_IMAGE_HDR image_keyctrl;
+extern GR_IMAGE_HDR image_keyshft;
+extern GR_IMAGE_HDR image_keynum;
+
+static struct layout_state layout_states[] = {
+        { /* 0 */
+                "keynorm.bmp",
+                &image_keynorm,
+                normal,
+                0,
+                2, 1, 3
+        }, 
+        { /* 1 */
+                "keyshft.bmp",
+                &image_keyshft,
+                shift,
+                0,
+                2, 0, 3
+        }, 
+        { /* 2 */
+                "keyctrl.bmp",
+                &image_keyctrl,
+                control,
+                1, 		/* ctrl is single shift*/
+                0, 1, 3
+        },
+        { /* 3 */
+                "keynum.bmp",
+                &image_keynum,
+                num,
+                0,
+                2, 1, 0
+        }
+};
+#define N_LAYOUT_STATES (sizeof(layout_states) / sizeof(layout_states[0]))
+
+static GR_WINDOW_ID	w;             
+static GR_GC_ID		gc;            /* graphics context for text */
+static int		current_layout = 0;
+#if DISKIMAGES
+static GR_IMAGE_ID	layout_images[N_LAYOUT_STATES];
+static int		layout_images_loaded[N_LAYOUT_STATES];
+#endif
+
+extern int KbdWrite(int c);
+extern int KbdOpen(void);
+extern void KbdClose(void);
+
+static void 
+push_character(int c)
+{
+#if _SOFTKBD_DEBUG
+	fprintf(stderr, "pushed %d (0x%x) '%c'\n", c, c, c);
+#endif
+	KbdWrite(c);
+}
+
+static void
+display_layout(int layout) 
+{
+#if DISKIMAGES
+#define LIBDIR "."	// "/etc/nxkbd.d"
+	if (!layout_images_loaded[layout] ) {
+        	char buf[128];
+
+		/* 	 
+		 * OK, load image on the server-side ;-) 
+		 * DON'T check for errors ;(
+		 */     
+		sprintf(buf, "%s/%s", LIBDIR, layout_states[layout].filename);
+		layout_images[layout] = GrLoadImageFromFile(buf, 0);
+		layout_images_loaded[layout] = 1;
+	}
+	GrDrawImageToFit(w, gc, 0, 0, -1, -1, layout_images[layout]);
+#else
+	GrDrawImageBits(w, gc, 0, 0, layout_states[layout].imagehdr);
+#endif
+}
+
+static void
+process_scancode(int scancode)
+{
+        int c;
+	
+        c = layout_states[current_layout].scancode_translations[scancode];
+#if _SOFTKBD_DEBUG
+	printf("scancode = %d ", scancode);
+	printf("current_layout = %d ('%s'), scancode (translated) = %d\n", 
+	        current_layout, layout_states[current_layout].filename, c);
+#endif
+
+        switch (c) {
+        default:
+		if (c < 256)		/* normal character*/
+			break;
+
+		/* handle special functions*/
+		if (c >= F1 && c < F1+10) {
+			char *p = fnkey[c-F1];
+			while (*p)
+				push_character(*p++);
+			return;
+		}
+
+		/* no action for NONE*/
+		if (c == NONE)
+			return;
+                fprintf(stderr, "nxkbd: key with unknown translation pressed\n");
+                return;
+        case CNTRL:
+                current_layout = layout_states[current_layout].ctrl_layout;
+                display_layout(current_layout);
+                return;
+        case SHIFT:
+                current_layout = layout_states[current_layout].shift_layout;
+                display_layout(current_layout);
+                return;
+        case NUM:
+                current_layout = layout_states[current_layout].num_layout;
+                display_layout(current_layout);
+                return;
+	case INTL:
+#if _SOFTKBD_DEBUG
+		printf("INTL not yet implemented\n");
+#endif
+		return;
+        }
+
+        if (layout_states[current_layout].sshift) {
+                current_layout = 0;
+                display_layout(current_layout);
+        }
+
+        push_character(c);
+}
+
+
+static void 
+mouse_hit(int x, int y) 
+{
+        int row, column;
+
+        for (row = 0; row < 4; row++) {
+                if (y >= keyrows[row].yoffset &&
+		    y < keyrows[row].yoffset+keyrows[row].height) {
+                        for (column = 0; column < 12; column++) {
+                                if (keyrows[row].columns[column].xoffset == 999) {
+                                        fprintf(stderr, "off end of row\n");
+                                        return;
+                                }
+                                if (x < keyrows[row].columns[column + 1].xoffset) {
+                                        int scancode = keyrows[row].columns[column].scancode;
+                                        process_scancode(scancode);
+                                        return;
+                                }
+                        }
+                }
+        }
+
+        fprintf(stderr, "nxkbd: off bottom\n");
+}
+                                
+int
+main(int argc, char* argv[])
+{
+        GR_EVENT        event;          /* current event */
+	GR_WM_PROPERTIES props;
+
+        if (GrOpen() < 0) {
+                fprintf(stderr, "nxkbd: cannot open graphics\n");
+                exit(1);
+        }
+
+	if (KbdOpen() < 0) {
+                fprintf(stderr, "nxkbd: cannot open kbd named pipe\n");
+                //exit(1);
+        }
+    
+#if !DISKIMAGES
+        GrReqShmCmds(4096); 		/* fast image copy*/
+#endif
+        w = GrNewWindow(GR_ROOT_WINDOW_ID, 
+                        0, 0, BM_WIDTH, BM_HEIGHT, 
+                        0, WHITE, BLACK);
+
+        GrSelectEvents(w, GR_EVENT_MASK_CLOSE_REQ |
+                          GR_EVENT_MASK_EXPOSURE |
+			  /*GR_EVENT_MASK_FOCUS_IN |*/
+			  /*GR_EVENT_MASK_KEY_DOWN |*/	/* required for focus*/
+                          GR_EVENT_MASK_BUTTON_DOWN);
+
+#if 0	// this code fails when link-app-into-server
+	//if (props.title)	// can't free with link-into-server
+		//free(props.title);
+
+	/* title must be alloc'd and copied*/
+	//props.title = malloc(18);
+	//if (props.title)
+		//strcpy(props.title, TITLE);
+
+	props.flags =
+		GR_WM_FLAG_NORESIZE   | /* don't let user resize window */
+		GR_WM_FLAG_NOBORDERS  | /* don't draw any window borders */
+		GR_WM_FLAG_NOTITLEBAR | /* don't draw a title bar */
+		GR_WM_FLAG_NOFOCUS;     /* don't set focus to this window*/
+#endif
+
+	props.flags = GR_WM_FLAGS_PROPS | GR_WM_FLAGS_TITLE;
+	props.props = GR_WM_PROPS_NOFOCUS;
+	props.props |= /*GR_WM_PROPS_NOMOVE |*/ GR_WM_PROPS_NORAISE |
+		GR_WM_PROPS_BORDER | GR_WM_PROPS_CAPTION;
+	props.title = TITLE;
+	GrSetWMProperties(w, &props);
+
+        GrMapWindow(w);
+
+        gc = GrNewGC();
+
+        current_layout = 0;
+        for (;;) {
+                GrGetNextEvent(&event);
+		
+                switch(event.type) {
+			case GR_EVENT_TYPE_CLOSE_REQ:
+#if DISKIMAGES
+				{
+					int i;
+				
+					for(i=0; i < N_LAYOUT_STATES; i++) {
+						if( !layout_images_loaded[i] )
+							continue;
+						GrFreeImage(layout_images[i]);
+					}
+				}
+#endif
+				GrClose();
+				exit(0);
+				/* no return*/
+			case GR_EVENT_TYPE_EXPOSURE:
+				display_layout(current_layout);
+				break;
+			case GR_EVENT_TYPE_BUTTON_DOWN:
+				mouse_hit(event.button.x, event.button.y);
+				break;
+#if 0
+			case GR_EVENT_TYPE_FOCUS_IN:
+				if (event.general.otherid != 1) {
+					int lastfocus = event.general.otherid;
+					GrSetFocus(lastfocus);
+				}
+				break;
+#endif
+		}
+	}
+	
+	/*NOTREACHED*/
+	return 0;
+ }
diff -urN lib/microwindows/src/demos/nxkbd/srvconn.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/srvconn.c
--- lib/microwindows/src/demos/nxkbd/srvconn.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxkbd/srvconn.c	2005-02-21 16:03:02.000000000 +0100
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2000 by Greg Haerr <greg@censoft.com>
+ * Copyright (C) 2000 by VTech Informations LTD.
+ * Vladimir Cotfas <vladimircotfas@vtech.ca> Aug 31, 2000
+ */
+#include <unistd.h>
+#include <fcntl.h>
+#include "nano-X.h"
+
+#define KBDPIPE		0	/* =1 to use named pipe for soft kbd*/
+
+#if KBDPIPE
+static char KBD_NAMED_PIPE[] = "/tmp/.nano-X-softkbd";
+static int kbd_fd = -1;
+
+int 
+KbdOpen(void)
+{
+	if (kbd_fd != -1)
+		close(kbd_fd);
+	
+        if ((kbd_fd = open(KBD_NAMED_PIPE, O_WRONLY)) < 0)
+		return -1;
+			
+        return kbd_fd;
+}
+
+void
+KbdClose(void)
+{
+	if(kbd_fd >= 0) {
+		close(kbd_fd);
+		kbd_fd = -1;
+	}
+}
+
+int
+KbdWrite(int c)
+{
+	char cc = c & 0xff;
+	
+	return write(kbd_fd, &cc, 1);
+}
+
+#else /* !KBDPIPE*/
+
+int 
+KbdOpen(void)
+{
+        return 0;
+}
+
+void
+KbdClose(void)
+{
+}
+
+int
+KbdWrite(int c)
+{
+	GR_WINDOW_ID	win = GrGetFocus();
+
+	/* FIXME: modifiers are incorrect*/
+	GrInjectKeyboardEvent(win, c, 0, 0, 1);
+	GrInjectKeyboardEvent(win, c, 0, 0, 0);
+	return 1;
+}
+#endif /* KBDPIPE*/
diff -urN lib/microwindows/src/demos/nxscribble/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/Makefile
--- lib/microwindows/src/demos/nxscribble/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/Makefile	2005-02-21 16:13:01.000000000 +0100
@@ -0,0 +1,55 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+ifndef TOP
+TOP = ../..
+CONFIG = $(TOP)/config
+endif
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(NANOX), Y)
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME =
+
+# List of objects to compile
+OBJS = nxscribble.o scribwidget.o\
+	hre_api.o li_recognizer.o bitvector.o matrix.o sc.o util.o
+
+all: default $(TOP)/bin/nxscribble
+	$(CP) letters.cl digits.cl punc.cl $(TOP)/bin
+
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
+ifeq ($(SHAREDLIBS), Y)
+$(TOP)/bin/nxscribble: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(CCNANOXCLIENTLIBS) -lm
+else
+$(TOP)/bin/nxscribble: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(NANOXCLIENTLIBS) -lm
+endif
diff -urN lib/microwindows/src/demos/nxscribble/bitvector.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/bitvector.c
--- lib/microwindows/src/demos/nxscribble/bitvector.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/bitvector.c	2005-02-21 16:03:02.000000000 +0100
@@ -0,0 +1,154 @@
+
+/***********************************************************************
+
+bitvector.c - some routines for dealing with bitvectors
+
+Copyright (C) 1991 Dean Rubine
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License. See ../COPYING for
+the full agreement.
+
+ **********************************************************************/
+
+/*LINTLIBRARY*/
+
+#include "util.h"
+#undef	BITS_PER_VECTOR
+#define BITS_PER_VECTOR	128
+#include "bitvector.h"
+/* ari -- for strlen */
+#include <string.h>  
+
+int
+bitcount(max, bv)
+int max;
+BitVector bv;
+{
+	register int i, count;
+
+	for(count = i = 0; i < max; i++)
+		if(IS_SET(i, bv))
+			count++;
+	return count;
+}
+
+char *
+BitVectorToString(max, bv)
+BitVector bv;
+{
+	char *string = tempstring();
+	register int i;
+
+	for(i = 0; i < max; i++)
+		string[i] = IS_SET(i, bv) ? (i % 10) + '0' : '-' ;
+	string[i] = '\0';
+	return string;
+}
+
+
+void
+StringToBitVector(string, max, bv)
+char *string;
+int max;
+BitVector bv;
+{
+	register int i;
+
+/* ari -- strlen returns a size_t, which depends on which OS you've got */
+	if((int) strlen(string) != max) {
+		error("StringToBitVector: strlen(%s)=%d != %d",
+			string, (int) strlen(string), max);
+		return;
+	    }
+
+	for(i = 0; i < max; i++)
+		if(string[i] != '-')
+			BIT_SET(i, bv);
+		else
+			BIT_CLEAR(i, bv);		
+}
+
+
+void
+SetBitVector(v)
+register BitVector v;
+{
+	register int nints = INTS_PER_VECTOR;
+
+	while(--nints >= 0)
+		*v++ = -1;
+}
+
+
+void
+ClearBitVector(nints, v)
+register int nints;
+register BitVector v;
+{
+
+	while(--nints >= 0)
+		*v++ = 0;
+}
+
+void
+AssignBitVector(nints, v1, v2)
+register int nints;
+register BitVector v1, v2;
+{
+
+	while(--nints >= 0)
+		*v1++ = *v2++;
+}
+
+int
+BitVectorDeQ(max, v)
+register int max;
+register BitVector v;
+{
+	register int i;
+	for(i = 0; i < max; i++)
+		if(IS_SET(i, v)) {
+			BIT_CLEAR(i, v);
+			return i;
+		}
+	return -1;
+
+}
+
+int *
+BitVectorOr(v, v1, v2, ipv)
+int *v;
+register int *v1, *v2;
+register int ipv;
+{
+	int *vv = v;
+	do
+		*vv++ = *v1++ | *v2++;
+	while(--ipv > 0);
+	return v;
+}
+
+int *
+BitVectorAnd(v, v1, v2, ipv)
+int *v;
+register int *v1, *v2;
+register int ipv;
+{
+	int *vv = v;
+	do
+		*vv++ = *v1++ & *v2++;
+	while(--ipv > 0);
+	return v;
+}
+
+int
+BitVectorNoBitsSet(v, ipv)
+register int *v;
+register int ipv;
+{
+	do
+		if(*v++) return 0;
+	while(--ipv > 0);
+	return 1;
+}
diff -urN lib/microwindows/src/demos/nxscribble/bitvector.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/bitvector.h
--- lib/microwindows/src/demos/nxscribble/bitvector.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/bitvector.h	2005-02-21 16:03:02.000000000 +0100
@@ -0,0 +1,220 @@
+/***********************************************************************
+
+bitvector.h - some macros for dealing with bitvectors
+
+Copyright (C) 1991 Dean Rubine
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License. See ../COPYING for
+the full agreement.
+
+ **********************************************************************/
+
+/*
+  Bit vector package
+
+  Used so that it's easier when we need more than 8*sizeof(int) bits
+  in a the vector.
+
+  Usage:
+	Before including this file define the identifier BITS_PER_VECTOR
+
+	BITS_PER_VECTOR must be one of the following values:
+
+		16
+		32
+		64
+		128
+
+	The high tech preprocessor hacking is sure to be nonportable.  The
+	use of include in this file is not to include files, it is to
+	print out error messages.  Ugly, I know, but what can I do?
+
+	You may include this file more than one in a single C file!
+	By default, when this file is included it defines a type
+	BitVector.  You may change the name of this type (necessary
+	to avoid redefinitions when included more than one) by defining:
+
+	#define BV_TYPE_NAME	MyBitVectorTypeName
+
+	The usual sequence for including this file is thus:
+
+	#undef BV_TYPE_NAME
+	#undef BITS_PER_VECTOR
+	#define BV_TYPE_NAME	BVTypeName
+	#define BITS_PER_VECTOR	how-many-bits-per-vector
+
+	WARNING: Once the file is re-included do not attempt to manipulate any
+	other vectors besides the newest type for the rest of the file or until
+	the file is included again.
+*/
+
+/*
+  -------------     check BITS_PER_VECTOR     -----------------
+ */
+#ifndef BITS_PER_VECTOR
+#	define	BITS_PER_VECTOR  32
+#endif
+
+#if (BITS_PER_VECTOR != 16) && (BITS_PER_VECTOR != 32) && (BITS_PER_VECTOR != 64) && (BITS_PER_VECTOR != 128)
+
+#	include "****** illegal value for BITS_PER_VECTOR  ******"
+
+#endif
+
+/*
+  -------------      machine dependent stuff     -----------------
+ */
+
+#ifndef	BITS_PER_INT
+
+
+#	ifdef unix
+#		define BITS_PER_INT	32
+#	else
+#		define BITS_PER_INT	16  /* IBM XT Lattice C */
+#	endif
+
+#	define	BV_CHECK_MACHINE_ASSUMPTIONS() \
+	 	if(BITS_PER_INT != 8*sizeof(int)) \
+			error("BV_CHECK_ASSUMPTIONS");
+
+#endif
+
+/*
+  ---- If this file has been included already, redefine everything ----
+ */
+
+#	undef	BV_INDEX_MASK
+#	undef	BV_INDEX_SHIFT
+#	undef	INTS_PER_VECTOR
+#	undef	VECTOR_SIZE_CHECK
+#	undef	SET_BIT_VECTOR
+#	undef	IS_SET
+#	undef	ASSIGN_BIT_VECTOR
+#	undef	CLEAR_BIT_VECTOR
+#	undef	BIT_SET
+#	undef	BIT_CLEAR
+
+/* 
+  --------------- round up to int size -------------------
+ */
+
+#if BITS_PER_VECTOR < BITS_PER_INT
+#	undef	BITS_PER_VECTOR
+#	define	BITS_PER_VECTOR	BITS_PER_INT
+#endif
+
+/*
+  ------------- Compute index shift and mask to avoid division -----
+ */
+
+#define	BV_INDEX_MASK	(BITS_PER_INT - 1)
+
+#if BITS_PER_INT==16
+#	define	BV_INDEX_SHIFT	4
+#endif
+
+#if BITS_PER_INT==32
+#	define	BV_INDEX_SHIFT	5
+#endif
+
+#ifndef BV_INDEX_SHIFT
+#	include "****** bad value for BITS_PER_INT  ******"
+#endif
+
+/*
+ ------------- Compute INTS_PER_VECTOR ------------------
+ */
+
+#if BITS_PER_INT==BITS_PER_VECTOR
+#	define	INTS_PER_VECTOR	1
+#else
+#	if 2*BITS_PER_INT==BITS_PER_VECTOR
+#		define	INTS_PER_VECTOR	2
+#	else
+#		define	INTS_PER_VECTOR	(BITS_PER_VECTOR / BITS_PER_INT)
+#	endif
+#endif 
+
+
+#define	BV_SIZE_CHECK(nbits_needed) \
+	if(nbits_needed > BITS_PER_VECTOR) \
+		error("%s line %d - %d bits needed, %d is vector size", \
+			__FILE__, __LINE__, nbits_needed, BITS_PER_VECTOR);
+
+#ifndef BV_TYPE_NAME
+#	define	BV_TYPE_NAME	BitVector
+#endif
+
+/*
+ ------------- Optimize INTS_PER_VECTOR=1 case
+ */
+
+#if INTS_PER_VECTOR==1
+
+typedef int BV_TYPE_NAME[1];
+
+#define	CLEAR_BIT_VECTOR(v)	( (v)[0] = 0 )
+#define	SET_BIT_VECTOR(v)	( (v)[0] = -1 )		/* assumes 2's comp */
+#define	BIT_SET(bit, v)		( (v)[0] |= (1 << (bit)) )
+#define	BIT_CLEAR(bit, v)	( (v)[0] &= ~(1 << (bit)) )
+#define	IS_SET(bit, v)		( ((v)[0] >> (bit)) & 01 )
+#define	ASSIGN_BIT_VECTOR(v1,v2) ( (v1)[0] = (v2)[0] )
+
+#else
+
+/*
+ ------------- Optimize INTS_PER_VECTOR=2 case -------
+ */
+
+#if INTS_PER_VECTOR==2
+
+    typedef int BV_TYPE_NAME[2];
+
+#   define	CLEAR_BIT_VECTOR(v) ( (v)[0] = (v)[1] = 0 )
+#   define	SET_BIT_VECTOR(v)   ( (v)[0] = (v)[1] = -1 ) /* 2's comp */
+#    define	ASSIGN_BIT_VECTOR(v1,v2) \
+				   ( (v1)[0] = (v2)[0], (v1)[1] = (v2)[1] )
+
+#else
+
+/*
+ ------------- general case -------------------
+ */
+
+     typedef int BV_TYPE_NAME[INTS_PER_VECTOR];
+
+#    define	CLEAR_BIT_VECTOR(v)	(  ClearBitVector(INTS_PER_VECTOR, v) )
+#    define	SET_BIT_VECTOR(v)	(  SetBitVector(INTS_PER_VECTOR, v) )
+#    define	ASSIGN_BIT_VECTOR(v1,v2) \
+				   ( AssignBitVector(INTS_PER_VECTOR, v1, v2) )
+
+#endif
+
+
+#define	BIT_SET(bit, v)	\
+	( (v[bit>>BV_INDEX_SHIFT]) |= (1 << (bit&BV_INDEX_MASK)) )
+
+#define	BIT_CLEAR(bit, v) \
+	( (v[bit>>BV_INDEX_SHIFT]) &= ~(1 << (bit&BV_INDEX_MASK)) )
+
+#define	IS_SET(bit, v) \
+	( ((v[bit>>BV_INDEX_SHIFT]) >> (bit&BV_INDEX_MASK)) & 01 )
+
+#endif
+
+/* TODO: make efficient */
+
+#define	OR(v, v1, v2) ( BitVectorOr((v), (v1), (v2), INTS_PER_VECTOR) )
+#define	AND(v, v1, v2) ( BitVectorAnd((v), (v1), (v2), INTS_PER_VECTOR) )
+#define	NO_BITS_SET(v)	( BitVectorNoBitsSet( (v), INTS_PER_VECTOR ) )
+
+int bitcount();	/* max, bv */
+char *BitVectorToString(); /* max, bv */
+void StringToBitVector(); /* string, max, bv */
+int BitVectorDeQ();	  /* element = BitVectorDeQ(max, bv); */
+
+int *BitVectorOr();
+int *BitVectorAnd();
+int BitVectorNoBitsSet();
diff -urN lib/microwindows/src/demos/nxscribble/digits.cl /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/digits.cl
--- lib/microwindows/src/demos/nxscribble/digits.cl	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/digits.cl	2005-02-21 16:03:02.000000000 +0100
@@ -0,0 +1,423 @@
+20 classes
+0
+1
+2
+3
+4
+6
+7
+8
+9
+B
+N
+A
+S
+R
+P
+U
+V
+W
+X
+5
+ V 12    -0.868832 0.336823 54.4382 0.824697 5.95937 -0.639416 0.364462 128.224 7.0839 7.21703 3.27009 0.265
+ M 12 12
+ 0.0706877 0.178766 -1.55779 0.0170591 -1.18709 0.0988158 -0.0405307 -5.34896 -0.261723 -0.331571 -0.346411 0.000916717
+ 0 0.456038 -4.0199 0.0469372 -3.26572 0.295152 -0.127233 -14.1596 -0.686385 -0.865744 -0.895775 0.00100384
+ 0 0 44.9158 -0.766481 29.6618 -3.04356 1.50025 156.169 6.50061 9.22175 9.16945 0.0277157
+ 0 0 0 0.0187331 -0.47486 0.0654544 -0.0372046 -2.78889 -0.0949287 -0.153827 -0.142259 -0.00178416
+ 0 0 0 0 37.9436 -4.69544 2.31214 126.788 5.98374 7.10354 6.89876 0.0680542
+ 0 0 0 0 0 0.657636 -0.339774 -14.574 -0.645471 -0.767322 -0.70343 -0.013669
+ 0 0 0 0 0 0 0.179529 7.32567 0.306387 0.376506 0.335367 0.00796206
+ 0 0 0 0 0 0 0 578.293 24.3964 33.3165 32.5936 0.201431
+ 0 0 0 0 0 0 0 0 1.12731 1.43227 1.4347 0.00532357
+ 0 0 0 0 0 0 0 0 0 1.94989 1.9333 0.0079861
+ 0 0 0 0 0 0 0 0 0 0 1.93982 0.00475851
+ 0 0 0 0 0 0 0 0 0 0 0 0.0005
+ V 12    -35.5271 102.284 4.34635 391.096 -9.46806 -23.3665 -34.9044 4.47625 14.6324 27.6621 -16.0167 0
+ V 12    0.00538372 0.987343 54.2151 1.52049 54.2022 0.00365474 0.998697 54.5982 -0.00331362 0.995045 0.271884 0.235
+ M 12 12
+ 0.199726 0.0101852 -10.3976 0.0124388 -10.386 0.0572288 0.0006328 -10.4509 -0.208231 -0.151891 -0.0286168 -0.185655
+ 0 0.00127902 -0.822632 0.00203586 -0.822163 0.00319514 0.000102679 -0.836944 -0.0119487 -0.0283753 -0.00601587 -0.0126756
+ 0 0 773.743 -1.19665 772.848 -3.58949 -0.0528495 780.989 9.27996 21.0627 5.01607 11.3177
+ 0 0 0 0.00394629 -1.19582 0.00316145 0.00019045 -1.21741 -0.0136189 -0.0379449 -0.00501631 -0.0155686
+ 0 0 0 0 771.958 -3.58476 -0.052866 780.09 9.27862 21.0564 5.0159 11.3083
+ 0 0 0 0 0 0.0207122 0.000134107 -3.61842 -0.0430791 -0.102229 -0.0299627 -0.0605664
+ 0 0 0 0 0 0 1.02964e-05 -0.053857 -0.000883834 -0.00189239 -0.000271339 -0.000807414
+ 0 0 0 0 0 0 0 788.481 9.29902 21.5266 5.14114 11.4383
+ 0 0 0 0 0 0 0 0 0.584471 -0.261827 -0.100791 0.140588
+ 0 0 0 0 0 0 0 0 0 1.69989 0.51084 0.351802
+ 0 0 0 0 0 0 0 0 0 0 0.168177 0.0924074
+ 0 0 0 0 0 0 0 0 0 0 0 0.2066
+ V 12    -22.4317 44.2829 2.80463 369.441 -2.79376 30.2952 52.2509 0.849907 6.19976 4.8771 -3.79268 0
+ V 12    0.748952 -0.609163 56.6561 0.961987 48.5848 0.607206 0.785999 108.045 -4.40824 7.73482 8.12382 0.2775
+ M 12 12
+ 0.0941015 0.12739 -0.368146 -0.0560117 1.34438 0.0355039 -0.0293618 0.18567 0.750925 -0.46386 -0.112485 -0.00131889
+ 0 0.177863 -0.543038 -0.0800382 1.87357 0.0557927 -0.0463136 0.378538 1.29213 -0.661829 -0.158645 -0.0019424
+ 0 0 28.348 -0.0379026 16.9439 0.280414 -0.142676 57.2082 -33.8839 8.89766 -6.4484 0.271749
+ 0 0 0 0.0398285 -1.09097 -0.0324639 0.026017 -0.858123 -0.346294 0.227679 0.148234 -0.00200978
+ 0 0 0 0 39.0621 0.996094 -0.750566 54.2456 -11.006 -1.15744 -7.59302 0.20598
+ 0 0 0 0 0 0.0332337 -0.0261331 1.32554 0.155093 -0.0995702 -0.177896 0.00410761
+ 0 0 0 0 0 0 0.0207907 -0.905156 -0.231924 0.105935 0.124361 -0.00251432
+ 0 0 0 0 0 0 0 134.454 -55.7632 13.4088 -15.7986 0.583338
+ 0 0 0 0 0 0 0 0 51.0032 -12.7771 6.27666 -0.305126
+ 0 0 0 0 0 0 0 0 0 4.24271 -1.18496 0.0754917
+ 0 0 0 0 0 0 0 0 0 0 1.95733 -0.0676238
+ 0 0 0 0 0 0 0 0 0 0 0 0.002675
+ V 12    -0.979157 30.9851 -1.84912 244.202 -0.870042 60.3329 39.6348 2.96732 1.36243 10.6481 -4.51508 0
+ V 12    0.810435 -0.528327 58.2447 1.03159 39.5567 0.0492026 0.991733 111.092 -4.52355 10.504 11.6369 0.3525
+ M 12 12
+ 0.0685727 0.110014 -1.49958 -0.0167949 -0.991297 0.0547559 -0.00188802 -2.92445 0.204912 -0.220652 -0.252902 0.00170146
+ 0 0.18769 -2.92345 -0.03062 -2.04737 0.088495 -0.00438014 -5.75534 0.337287 -0.368692 -0.312536 0.00332211
+ 0 0 57.2058 0.57743 43.0214 -1.15181 0.101269 109.839 -4.90287 6.25373 3.30595 -0.0637952
+ 0 0 0 0.00875827 0.41034 -0.00715084 0.000690427 0.782045 -0.0552861 0.122995 0.210038 -0.000541413
+ 0 0 0 0 33.0827 -0.785157 0.0813786 84.272 -3.32259 4.11532 0.756693 -0.0484355
+ 0 0 0 0 0 0.0559482 -0.00199208 -2.93063 0.159798 -0.0562995 0.139943 0.0015245
+ 0 0 0 0 0 0 0.000228668 0.226732 -0.00652885 0.00382439 -0.0155073 -0.000122762
+ 0 0 0 0 0 0 0 249.188 -9.36128 5.51768 -12.8122 -0.134631
+ 0 0 0 0 0 0 0 0 0.620373 -0.713371 -0.803881 0.00548976
+ 0 0 0 0 0 0 0 0 0 1.92552 4.02504 -0.00494913
+ 0 0 0 0 0 0 0 0 0 0 10.9993 0.00229203
+ 0 0 0 0 0 0 0 0 0 0 0 7.5e-05
+ V 12    11.2556 45.0956 1.28 279.094 -3.71699 30.3681 25.5477 2.66718 1.42974 12.4536 -4.97276 0
+ V 12    0.244181 0.969499 51.2678 0.709698 48.9359 0.778902 0.594869 70.9969 1.15957 3.57825 2.59775 0.2125
+ M 12 12
+ 0.00168071 -0.00042793 -0.089638 0.00856224 0.0218155 -0.00764593 0.00899914 -0.108729 -0.0200301 -0.0129966 -0.00569979 -0.00110646
+ 0 0.00010916 0.0183344 -0.00220556 -0.00971971 0.00196936 -0.0023198 0.0203826 0.00507744 0.00354237 0.00161264 0.000273957
+ 0 0 106.44 -0.21332 91.9073 0.141073 -0.190651 166.463 2.49447 -5.6088 -5.0443 0.286286
+ 0 0 0 0.0880203 0.499646 -0.0717192 0.0932151 0.445944 -0.218771 0.0522525 0.180022 -0.0118385
+ 0 0 0 0 86.1182 -0.464945 0.558218 148.007 0.59131 -5.43315 -4.13131 0.168198
+ 0 0 0 0 0 0.0590412 -0.0759237 -0.378034 0.175473 -0.0222636 -0.122715 0.00938347
+ 0 0 0 0 0 0 0.0987308 0.530477 -0.231171 0.0547377 0.190597 -0.0124634
+ 0 0 0 0 0 0 0 269.59 1.86277 -7.24373 -4.96851 0.336047
+ 0 0 0 0 0 0 0 0 0.588132 -0.299687 -0.615411 0.0348705
+ 0 0 0 0 0 0 0 0 0 0.898185 1.0518 -0.0260921
+ 0 0 0 0 0 0 0 0 0 0 1.42403 -0.0423594
+ 0 0 0 0 0 0 0 0 0 0 0 0.002275
+ V 12    -19.7866 43.1394 -1.23994 201.004 -0.0919554 59.6065 50.6699 1.73555 7.10613 17.5026 -8.64285 0
+ V 12    -0.426122 -0.107658 60.9813 1.08073 39.7653 -0.343465 0.920632 126.156 7.79931 8.32252 4.45956 0.335
+ M 12 12
+ 0.20699 -0.752324 1.50432 0.0727364 3.3089 -0.146328 -0.0537387 6.34446 1.06811 0.676561 0.404955 0.0332674
+ 0 3.02033 -3.69606 -0.218208 -6.97332 0.594901 0.223259 -21.041 -3.88625 -2.69624 -1.83203 -0.12345
+ 0 0 57.133 0.0826384 40.0182 -0.343739 -0.0528543 138.41 8.65906 9.47495 6.00441 0.458267
+ 0 0 0 0.0482206 2.29715 -0.0480771 -0.0177936 0.897171 0.35552 0.0741994 -0.0258259 0.00645547
+ 0 0 0 0 148.873 -1.36801 -0.436945 102.351 16.601 3.99895 -2.19611 0.385875
+ 0 0 0 0 0 0.120424 0.0456889 -3.29459 -0.747375 -0.474294 -0.316269 -0.0219082
+ 0 0 0 0 0 0 0.0174509 -1.07705 -0.273396 -0.170663 -0.115598 -0.00779972
+ 0 0 0 0 0 0 0 389.475 34.798 32.7173 21.8597 1.5278
+ 0 0 0 0 0 0 0 0 5.53588 3.65233 2.23332 0.17778
+ 0 0 0 0 0 0 0 0 0 3.43962 2.52814 0.150577
+ 0 0 0 0 0 0 0 0 0 0 2.04126 0.103171
+ 0 0 0 0 0 0 0 0 0 0 0 0.0069
+ V 12    -61.3591 84.1919 -1.89078 366.919 -2.95811 43.0758 34.9259 4.32043 16.6654 37.8163 -19.8766 0
+ V 12    0.734428 0.0144477 64.1103 0.984049 53.4913 0.295882 0.9516 91.7006 -1.0022 4.35052 5.24347 0.2425
+ M 12 12
+ 0.719933 0.00994317 0.962911 0.116572 4.1176 -0.10626 0.0365987 -3.25217 -1.97055 -2.08556 -7.17241 0.00250909
+ 0 0.121696 1.11312 0.0400482 2.90061 -0.0340006 0.00883158 -0.814637 0.184317 -0.137426 -0.0683502 0.00477204
+ 0 0 13.5003 0.51082 34.4728 -0.39438 0.114837 -8.2985 -0.510725 -2.6508 -9.57945 0.0598054
+ 0 0 0 0.0310524 1.57615 -0.0273603 0.0085291 -0.760483 -0.251518 -0.368507 -1.15248 0.00194711
+ 0 0 0 0 94.7076 -1.30859 0.390587 -32.2923 -6.01988 -12.8646 -40.6817 0.14462
+ 0 0 0 0 0 0.0251741 -0.00780603 0.742143 0.238163 0.357767 1.04549 -0.00138532
+ 0 0 0 0 0 0 0.00247029 -0.230646 -0.0865678 -0.118146 -0.361411 0.000395286
+ 0 0 0 0 0 0 0 23.586 7.84353 11.6043 31.8534 -0.0232151
+ 0 0 0 0 0 0 0 0 5.78145 5.62405 19.6606 0.00264385
+ 0 0 0 0 0 0 0 0 0 6.69474 20.6191 -0.00476439
+ 0 0 0 0 0 0 0 0 0 0 71.4946 -0.0253875
+ 0 0 0 0 0 0 0 0 0 0 0 0.000275
+ V 12    13.6302 28.7273 3.04421 252.856 -3.29672 34.0834 42.3961 1.23727 2.39582 0.8181 -0.962233 0
+ V 12    -0.591494 -0.72204 57.5914 1.08804 3.6586 0.374196 0.172535 151.71 0.324157 11.2057 6.54117 0.4125
+ M 12 12
+ 0.204581 -0.249426 0.831037 -0.00178567 -0.60475 -0.133475 0.373433 4.35064 0.362549 0.638999 0.391795 0.00867678
+ 0 0.310594 -0.889715 0.00210216 0.823377 0.229049 -0.484176 -5.0091 -0.488897 -0.784134 -0.485778 -0.0128904
+ 0 0 21.9197 -0.0701513 5.58142 2.30104 1.81971 54.0733 -4.74461 -4.97306 -12.5272 0.0281503
+ 0 0 0 0.000249784 -0.0200116 -0.00560478 -0.00616067 -0.158235 0.0175918 0.0228445 0.0496801 -0.00018901
+ 0 0 0 0 5.45848 1.89886 -1.14995 3.22042 -3.79806 -4.90949 -6.78502 -0.0417177
+ 0 0 0 0 0 0.918971 -0.455436 3.18392 -1.23553 -1.1985 -1.70236 -0.0256712
+ 0 0 0 0 0 0 0.854989 8.24797 0.590087 0.795737 0.016398 0.0280625
+ 0 0 0 0 0 0 0 164.464 -4.54517 -0.845679 -18.5819 0.149501
+ 0 0 0 0 0 0 0 0 2.7323 3.62629 5.34509 0.0199408
+ 0 0 0 0 0 0 0 0 0 5.44765 7.67342 0.0118914
+ 0 0 0 0 0 0 0 0 0 0 12.8019 -0.0122934
+ 0 0 0 0 0 0 0 0 0 0 0 0.001275
+ V 12    -36.8636 91.6026 2.53132 445.907 -9.12058 24.8284 -28.2419 5.59594 11.5034 31.8916 -16.6492 0
+ V 12    -0.537602 -0.82772 64.0858 1.05547 48.8959 0.0220152 0.997058 124.185 2.19532 10.2996 10.5937 0.37
+ M 12 12
+ 0.0721133 -0.0473014 1.62635 0.0020778 1.08025 -0.0339579 0.000719243 3.12886 -0.316297 0.651679 0.428142 0.0186265
+ 0 0.0313443 -1.19317 -0.0019644 -0.810891 0.0218198 -0.000418814 -2.25328 0.216285 -0.427327 -0.291585 -0.0126012
+ 0 0 87.024 0.265557 65.283 -0.564903 -0.00552715 152.224 -10.4922 14.3997 14.0663 0.577812
+ 0 0 0 0.00617392 0.167603 -0.00505571 8.79428e-05 0.0453213 -0.0614425 0.0782839 -4.87223e-05 -1.17126e-05
+ 0 0 0 0 49.7718 -0.305801 -0.00819475 116.437 -7.16653 9.03446 10.2505 0.41709
+ 0 0 0 0 0 0.0215377 -0.000580481 -0.764445 0.171712 -0.36634 -0.15377 -0.00695912
+ 0 0 0 0 0 0 2.16308e-05 -0.016579 -0.00288534 0.00853182 0.00137729 7.90149e-05
+ 0 0 0 0 0 0 0 299.123 -16.2517 23.0887 28.1708 1.15946
+ 0 0 0 0 0 0 0 0 1.88719 -3.2828 -1.94161 -0.0832065
+ 0 0 0 0 0 0 0 0 0 6.60671 3.47163 0.15287
+ 0 0 0 0 0 0 0 0 0 0 3.12098 0.13194
+ 0 0 0 0 0 0 0 0 0 0 0 0.0056
+ V 12    -60.9302 48.8885 -2.53682 308.912 -1.1034 65.3942 56.4014 3.46841 9.84652 28.116 -13.7268 0
+ V 12    -0.984615 -0.129299 46.1601 0.0835282 46.0858 -0.99806 0.0607862 46.5957 0.487011 0.714338 0.145569 0.1025
+ M 12 12
+ 0.00174089 -0.00931799 -0.0457754 0.000310923 -0.0487582 -4.29543e-05 -0.000761245 -0.0365313 0.00998752 -0.00198189 0.000940758 -0.000625948
+ 0 0.0535192 0.80185 -0.0036483 0.82158 0.00016741 0.00313017 0.732784 -0.0853471 -0.00425034 -0.0100507 0.00354991
+ 0 0 131.982 -0.40371 132.676 -0.0142705 -0.205784 127.289 -5.97477 -4.91964 -1.68989 0.0891753
+ 0 0 0 0.00132242 -0.406375 3.8182e-05 0.000542944 -0.388449 0.0208413 0.0131975 0.00471587 -0.000305819
+ 0 0 0 0 133.38 -0.0142667 -0.205528 127.946 -6.02557 -4.93402 -1.69749 0.0904919
+ 0 0 0 0 0 2.88068e-06 4.54133e-05 -0.0139761 0.000407971 0.000649566 0.00017787 6.61642e-06
+ 0 0 0 0 0 0 0.000722967 -0.202152 0.00539376 0.0095355 0.00249151 0.000146682
+ 0 0 0 0 0 0 0 122.796 -5.72357 -4.76417 -1.62927 0.0834326
+ 0 0 0 0 0 0 0 0 0.351736 0.16831 0.0658074 -0.00611366
+ 0 0 0 0 0 0 0 0 0 0.22252 0.0725071 -0.00259685
+ 0 0 0 0 0 0 0 0 0 0 0.0250879 -0.0014433
+ 0 0 0 0 0 0 0 0 0 0 0 0.000275
+ V 12    -23.3576 2.4457 2.00506 15.7816 -0.367188 -35.8958 -12.4251 -0.642924 0.499322 -0.989331 -0.135816 0
+ V 12    0.540953 -0.823918 53.946 0.893605 53.946 0.625758 -0.7783 54.2167 -0.241313 0.552941 0.0792705 0.1025
+ M 12 12
+ 0.0719837 0.0546704 -1.33695 -0.0191639 -1.33695 0.0145437 0.0124636 -1.40764 0.135422 -0.0713532 -0.0120074 -0.00512371
+ 0 0.042133 -1.02491 -0.0163675 -1.02491 0.0124576 0.0106013 -1.07216 0.100604 -0.0520623 -0.00933528 -0.00363581
+ 0 0 464.302 0.0569543 464.302 -0.0285438 -0.0552163 465.65 -1.52062 -0.655411 -1.00671 0.130524
+ 0 0 0 0.0107181 0.0569543 -0.00825252 -0.00682761 0.0565902 -0.0301094 0.0141359 0.00475473 0.000577357
+ 0 0 0 0 464.302 -0.0285438 -0.0552163 465.65 -1.52062 -0.655411 -1.00671 0.130524
+ 0 0 0 0 0 0.00635546 0.00525533 -0.0278824 0.0227509 -0.0106696 -0.00366395 -0.000421703
+ 0 0 0 0 0 0 0.00435129 -0.0554437 0.0197009 -0.00926153 -0.00302404 -0.000395379
+ 0 0 0 0 0 0 0 467.135 -1.67697 -0.563519 -0.997572 0.138258
+ 0 0 0 0 0 0 0 0 0.265117 -0.146311 -0.0244901 -0.0104919
+ 0 0 0 0 0 0 0 0 0 0.0867741 0.0166171 0.00579411
+ 0 0 0 0 0 0 0 0 0 0 0.0055401 0.000654071
+ 0 0 0 0 0 0 0 0 0 0 0 0.000475
+ V 12    23.5507 -5.29344 4.00421 190.253 -2.48693 5.43604 -39.2205 -0.219633 -0.424464 -8.89918 3.29379 0
+ V 12    0.994086 0.107285 48.5413 0.0412531 48.5413 0.999148 0.0412414 48.7202 0.122489 0.754344 0.170171 0.095
+ M 12 12
+ 6.5353e-06 -6.05549e-05 -0.00541839 4.60746e-06 -0.00541839 -1.90018e-07 4.60354e-06 -0.00551706 -0.000442839 7.01653e-05 -3.56923e-05 1.80766e-05
+ 0 0.000561091 0.0502058 -4.26919e-05 0.0502058 1.76067e-06 -4.26556e-05 0.0511201 0.00410327 -0.000650139 0.000330719 -0.000167495
+ 0 0 4.49235 -0.00382002 4.49235 0.000157543 -0.00381677 4.57417 0.367156 -0.0581737 0.0295923 -0.0149873
+ 0 0 0 3.24831e-06 -0.00382002 -1.33965e-07 3.24555e-06 -0.00388959 -0.000312207 4.94673e-05 -2.51635e-05 1.27442e-05
+ 0 0 0 0 4.49235 0.000157543 -0.00381677 4.57417 0.367156 -0.0581737 0.0295923 -0.0149873
+ 0 0 0 0 0 5.5249e-09 -1.33851e-07 0.000160412 1.28758e-05 -2.0401e-06 1.03778e-06 -5.2559e-07
+ 0 0 0 0 0 0 3.24279e-06 -0.00388628 -0.000311941 4.94252e-05 -2.51421e-05 1.27334e-05
+ 0 0 0 0 0 0 0 4.65747 0.373842 -0.0592331 0.0301312 -0.0152602
+ 0 0 0 0 0 0 0 0 0.0300073 -0.00475448 0.00241855 -0.00122489
+ 0 0 0 0 0 0 0 0 0 0.000753319 -0.000383205 0.000194077
+ 0 0 0 0 0 0 0 0 0 0 0.000194932 -9.8725e-05
+ 0 0 0 0 0 0 0 0 0 0 0 5e-05
+ V 12    32.9348 -7.22499 2.02466 -4.97987 -0.0370677 37.5587 23.7342 -0.725622 0.0259355 -1.92133 1.1174 0
+ V 12    -0.0204946 -0.994412 41.0208 1.41349 41.0208 0.0111527 -0.98759 41.3393 0.12096 1.33119 0.311238 0.18
+ M 12 12
+ 0.0214411 -0.000441897 1.37815 -0.00233842 1.37815 0.0324384 0.000366321 1.38691 -0.0415797 0.0757787 0.0184973 0
+ 0 9.10741e-06 -0.0284034 4.81944e-05 -0.0284034 -0.000668549 -7.54981e-06 -0.028584 0.000856949 -0.00156178 -0.000381226 0
+ 0 0 88.5822 -0.150305 88.5822 2.08502 0.0235457 89.1453 -2.67258 4.87076 1.18894 0
+ 0 0 0 0.000255034 -0.150305 -0.00353782 -3.99519e-05 -0.15126 0.00453478 -0.00826461 -0.00201736 0
+ 0 0 0 0 88.5822 2.08502 0.0235457 89.1453 -2.67258 4.87076 1.18894 0
+ 0 0 0 0 0 0.0490764 0.000554211 2.09827 -0.0629063 0.114646 0.0279848 0
+ 0 0 0 0 0 0 6.2586e-06 0.0236954 -0.000710389 0.00129468 0.000316027 0
+ 0 0 0 0 0 0 0 89.712 -2.68957 4.90173 1.19649 0
+ 0 0 0 0 0 0 0 0 0.0806335 -0.146954 -0.035871 0
+ 0 0 0 0 0 0 0 0 0 0.267823 0.0653746 0
+ 0 0 0 0 0 0 0 0 0 0 0.0159577 0
+ 0 0 0 0 0 0 0 0 0 0 0 0
+ V 12    -0.793351 12.2231 3.79934 321.507 -3.59714 -17.6949 -67.5307 0.518265 1.74858 -3.83504 0.423141 0
+ V 12    -0.57735 0.816025 58.8508 0.855768 57.1088 -0.648672 0.761034 61.1883 1.04288 2.99231 5.30172 0.2
+ M 12 12
+ 0.00102604 0.000725936 0.292116 0.000741486 0.371028 0.000248239 0.000211588 0.208387 -0.0651262 -0.075661 -0.226351 -0.000452998
+ 0 0.000513611 0.206677 0.000524613 0.262508 0.000175633 0.000149702 0.147437 -0.0460778 -0.0535313 -0.160147 -0.000320503
+ 0 0 83.1666 0.211104 105.633 0.0706747 0.06024 59.3284 -18.5417 -21.541 -64.4429 -0.12897
+ 0 0 0 0.00053585 0.268131 0.000179395 0.000152909 0.150595 -0.0470648 -0.054678 -0.163577 -0.000327368
+ 0 0 0 0 134.169 0.0897667 0.0765132 75.3553 -23.5505 -27.36 -81.8515 -0.16381
+ 0 0 0 0 0 6.00591e-05 5.11918e-05 0.0504171 -0.0157566 -0.0183054 -0.0547634 -0.000109598
+ 0 0 0 0 0 0 4.36336e-05 0.0429733 -0.0134303 -0.0156027 -0.0466779 -9.34169e-05
+ 0 0 0 0 0 0 0 42.323 -13.227 -15.3666 -45.9715 -0.0920033
+ 0 0 0 0 0 0 0 0 4.13379 4.80247 14.3673 0.0287534
+ 0 0 0 0 0 0 0 0 0 5.57932 16.6913 0.0334045
+ 0 0 0 0 0 0 0 0 0 0 49.9346 0.0999346
+ 0 0 0 0 0 0 0 0 0 0 0 0.0002
+ V 12    -23.6811 33.1369 2.95266 212.867 -2.03407 -6.24276 27.856 0.135007 3.6956 3.21097 -2.25166 0
+ V 12    -1 0 59.1364 0.0681789 11.1847 -0.985071 -0.121268 107.733 0.0383859 4.7198 8.83571 0.26
+ M 12 12
+ 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 49.7696 -0.0574683 11.8193 0.148943 -1.20988 89.486 31.7264 1.6058 0.980488 -0.0997693
+ 0 0 0 6.63578e-05 -0.0136475 -0.000171983 0.00139703 -0.103328 -0.0366341 -0.0018542 -0.00113216 0.000115202
+ 0 0 0 0 2.80683 0.0353709 -0.287322 21.2511 7.53438 0.381345 0.232846 -0.0236932
+ 0 0 0 0 0 0.000445735 -0.00362075 0.267801 0.0949462 0.00480561 0.00293426 -0.000298575
+ 0 0 0 0 0 0 0.0294118 -2.17537 -0.771258 -0.0390364 -0.0238353 0.00242536
+ 0 0 0 0 0 0 0 160.896 57.0443 2.88724 1.76292 -0.179386
+ 0 0 0 0 0 0 0 0 20.2245 1.02364 0.625028 -0.0635996
+ 0 0 0 0 0 0 0 0 0 0.0518107 0.0316351 -0.00321903
+ 0 0 0 0 0 0 0 0 0 0 0.0193161 -0.00196551
+ 0 0 0 0 0 0 0 0 0 0 0 0.0002
+ V 12    24.0395 39.5788 10.2585 155.231 -10.7363 -92.5702 -80.1173 1.29775 -1.95363 -14.0565 5.00575 0
+ V 12    0.994868 -0.0263938 86.1634 0.380008 81.3451 0.934392 -0.356239 115.578 4.75077 8.03333 15.1974 0.41
+ M 12 12
+ 1.34205e-05 0.00050586 -0.0509884 -2.26262e-05 -0.0557919 3.97454e-06 1.04249e-05 -0.0842918 -0.014808 -0.0206802 -0.0522437 0.000103616
+ 0 0.0190675 -1.92192 -0.000852854 -2.10298 0.000149813 0.00039295 -3.17723 -0.55816 -0.779504 -1.96923 0.00390564
+ 0 0 193.72 0.0859638 211.97 -0.0151005 -0.0396075 320.25 56.26 78.5704 198.49 -0.39367
+ 0 0 0 3.81466e-05 0.0940622 -6.70086e-06 -1.75759e-05 0.142112 0.0249655 0.0348658 0.0880801 -0.000174692
+ 0 0 0 0 231.94 -0.016523 -0.0433389 350.42 61.5601 85.9724 217.189 -0.430757
+ 0 0 0 0 0 1.17708e-06 3.0874e-06 -0.0249634 -0.00438545 -0.00612455 -0.0154722 3.06865e-05
+ 0 0 0 0 0 0 8.09805e-06 -0.0654774 -0.0115028 -0.0160643 -0.0405826 8.04887e-05
+ 0 0 0 0 0 0 0 529.423 93.0065 129.889 328.134 -0.650798
+ 0 0 0 0 0 0 0 0 16.3389 22.8183 57.645 -0.114329
+ 0 0 0 0 0 0 0 0 0 31.8671 80.5048 -0.159667
+ 0 0 0 0 0 0 0 0 0 0 203.376 -0.403362
+ 0 0 0 0 0 0 0 0 0 0 0 0.0008
+ V 12    36.8582 18.0343 1.89616 104.372 -1.21699 28.3764 -11.9442 0.845809 1.87068 2.57067 -0.822069 0
+ V 12    0.630903 -0.769579 68.2843 0.874553 68.2843 0.640354 -0.766077 117.757 9.68435 12.4076 17.3 0.605
+ M 12 12
+ 0.0116139 0.00952111 0.810195 0.00845242 0.810195 -0.00648185 -0.00541809 1.33266 0.509902 0.633731 1.7202 -0.0022861
+ 0 0.00780544 0.664201 0.00692933 0.664201 -0.00531385 -0.00444178 1.09252 0.418019 0.519535 1.41022 -0.00187415
+ 0 0 56.52 0.589649 56.52 -0.45218 -0.377971 92.9677 35.5712 44.2097 120.003 -0.15948
+ 0 0 0 0.00615155 0.589649 -0.0047174 -0.00394321 0.969892 0.371099 0.46122 1.25193 -0.00166379
+ 0 0 0 0 56.52 -0.45218 -0.377971 92.9677 35.5712 44.2097 120.003 -0.15948
+ 0 0 0 0 0 0.0036176 0.00302391 -0.743775 -0.284582 -0.353693 -0.960063 0.0012759
+ 0 0 0 0 0 0 0.00252764 -0.621711 -0.237879 -0.295647 -0.802504 0.00106651
+ 0 0 0 0 0 0 0 152.919 58.5098 72.7189 197.388 -0.262324
+ 0 0 0 0 0 0 0 0 22.387 27.8236 75.5244 -0.10037
+ 0 0 0 0 0 0 0 0 0 34.5806 93.8655 -0.124745
+ 0 0 0 0 0 0 0 0 0 0 254.788 -0.338607
+ 0 0 0 0 0 0 0 0 0 0 0 0.00045
+ V 12    -12.8826 48.7146 -3.7706 237.558 0.685318 45.4059 -32.8473 3.19714 10.601 30.1256 -14.0359 0
+ V 12    -0.315499 0.944101 87.6009 0.925596 87.6009 -0.600665 0.798058 147.142 -4.0985 11.8461 14.1237 0.66
+ M 12 12
+ 0.016431 0.00549091 0.561318 0.0087056 0.561318 0.00695292 0.00523317 0.598499 -0.578053 -0.665569 -1.88782 -0.00181279
+ 0 0.00183495 0.187581 0.00290923 0.187581 0.00232352 0.00174882 0.200006 -0.193173 -0.222419 -0.630871 -0.000605796
+ 0 0 19.1758 0.297401 19.1758 0.237526 0.178776 20.446 -19.7475 -22.7372 -64.4919 -0.0619286
+ 0 0 0 0.00461246 0.297401 0.00368385 0.00277268 0.317101 -0.306268 -0.352636 -1.00022 -0.000960465
+ 0 0 0 0 19.1758 0.237526 0.178776 20.446 -19.7475 -22.7372 -64.4919 -0.0619286
+ 0 0 0 0 0 0.00294219 0.00221446 0.25326 -0.244608 -0.281641 -0.798848 -0.000767097
+ 0 0 0 0 0 0 0.00166673 0.190618 -0.184106 -0.211979 -0.601259 -0.000577361
+ 0 0 0 0 0 0 0 21.8003 -21.0556 -24.2433 -68.7638 -0.0660308
+ 0 0 0 0 0 0 0 0 20.3362 23.4151 66.4147 0.063775
+ 0 0 0 0 0 0 0 0 0 26.9601 76.4697 0.0734303
+ 0 0 0 0 0 0 0 0 0 0 216.899 0.208278
+ 0 0 0 0 0 0 0 0 0 0 0 0.0002
+ V 12    -35.8766 78.7569 -4.91619 252.441 1.15996 14.866 13.9487 4.10515 3.67335 26.5119 -11.3298 0
+ V 12    -0.991935 0.0894427 62.4857 0.420066 60.8159 -0.929051 -0.369923 77.8878 -1.69329 3.00109 1.94101 0.305
+ M 12 12
+ 0.00013009 0.00144272 0.0164565 0.000589377 0.0104765 2.74297e-05 -6.88889e-05 0.0272376 0.0032141 0.0029235 0.00364059 -8.06504e-05
+ 0 0.016 0.182505 0.00653629 0.116186 0.0003042 -0.000763989 0.302069 0.0356449 0.0324221 0.0403747 -0.000894427
+ 0 0 2.08175 0.0745566 1.32529 0.00346988 -0.00871449 3.44557 0.406586 0.369825 0.460537 -0.0102023
+ 0 0 0 0.00267019 0.0474642 0.000124271 -0.000312104 0.123401 0.0145616 0.013245 0.0164938 -0.00036539
+ 0 0 0 0 0.843703 0.00220899 -0.00554782 2.19352 0.258841 0.235438 0.293187 -0.00649501
+ 0 0 0 0 0 5.78361e-06 -1.45254e-05 0.0057431 0.0006777 0.000616426 0.000767625 -1.70053e-05
+ 0 0 0 0 0 0 3.648e-05 -0.0144236 -0.00170202 -0.00154813 -0.00192787 4.27083e-05
+ 0 0 0 0 0 0 0 5.70287 0.672953 0.612108 0.762249 -0.0168862
+ 0 0 0 0 0 0 0 0 0.0794101 0.0722303 0.0899472 -0.00199261
+ 0 0 0 0 0 0 0 0 0 0.0656996 0.0818147 -0.00181245
+ 0 0 0 0 0 0 0 0 0 0 0.101882 -0.00225702
+ 0 0 0 0 0 0 0 0 0 0 0 5e-05
+ V 12    -23.0358 26.525 1.18672 112.582 -1.02739 -45.3042 -48.6908 0.763702 0.501695 4.11643 -2.39024 0
+ V 12    -0.987919 -0.141627 94.9528 0.8734 85.6297 -0.712269 0.700772 178.174 -0.549404 9.52428 6.05273 0.5525
+ M 12 12
+ 0.000445216 -0.00259943 -0.00895692 -0.000562669 -0.0800858 -0.00108954 -0.00115701 0.0931599 -0.000455399 -0.0202862 -0.034375 0.000411806
+ 0 0.0153888 0.210401 0.00333649 0.588145 0.00620296 0.00658468 -0.162825 -0.00465418 0.130541 0.245088 -0.00153469
+ 0 0 220.835 -0.142725 187.267 -0.24685 -0.253012 333.984 -10.1016 5.33909 17.175 0.409252
+ 0 0 0 0.00108402 -0.048865 0.00162075 0.00170005 -0.121687 0.00752177 0.0362544 0.0854059 0.00012444
+ 0 0 0 0 172.192 -0.0344816 -0.0278066 248.048 -8.41642 6.71359 15.9283 0.205012
+ 0 0 0 0 0 0.00300557 0.00317747 -0.588301 0.0134061 0.0466128 0.0753578 -0.00131824
+ 0 0 0 0 0 0 0.00336033 -0.623609 0.0138244 0.0489248 0.0777454 -0.00143446
+ 0 0 0 0 0 0 0 730.946 -15.5824 15.4731 64.3438 1.53509
+ 0 0 0 0 0 0 0 0 0.463802 -0.211144 -0.742766 -0.0199497
+ 0 0 0 0 0 0 0 0 0 1.77935 4.76738 0.0401742
+ 0 0 0 0 0 0 0 0 0 0 14.659 0.188065
+ 0 0 0 0 0 0 0 0 0 0 0 0.004475
+ V 12    -70.296 77.6869 -5.94485 283.484 0.696282 25.8011 12.6215 5.29216 8.97019 32.3299 -16.1293 0
+ V 20    -697.568 -354.227 -248.172 -295.169 -179.89 -549.58 -219.033 -829.408 -377.996 -52.131 -143.213 -65.0684 -266.881 -157.757 -345.82 -142.905 -307.909 -367.758 -105.318 -469.97
+ M 12 12
+ 40.531 1.124 1.44352 -10.7086 -1.0284 -12.9545 -14.3517 -0.204499 -1.73503 -5.20943 2.67347 0
+ 1.124 22.907 -0.474452 20.613 -0.205512 -7.90084 -6.1928 0.541725 1.16961 4.39697 -2.04169 0
+ 1.44352 -0.474452 0.453725 1.04202 -0.282541 -1.41366 -0.515229 -0.121887 -0.053333 -0.49189 0.22175 0
+ -10.7086 20.613 1.04202 242.224 -2.20516 3.75158 -7.81967 0.950944 2.51888 0.0389675 -1.01072 0
+ -1.0284 -0.205512 -0.282541 -2.20516 0.245823 1.17208 0.846584 0.0297539 0.0213151 0.323688 -0.128126 0
+ -12.9545 -7.90084 -1.41366 3.75158 1.17208 51.2723 33.6699 0.143971 1.5798 4.46039 -1.96071 0
+ -14.3517 -6.1928 -0.515229 -7.81967 0.846584 33.6699 67.4665 -0.307529 1.34343 1.91357 -0.853268 0
+ -0.204499 0.541725 -0.121887 0.950944 0.0297539 0.143971 -0.307529 0.0757869 0.0115349 0.0462066 -0.0424633 0
+ -1.73503 1.16961 -0.053333 2.51888 0.0213151 1.5798 1.34343 0.0115349 0.876624 1.17863 -0.686415 0
+ -5.20943 4.39697 -0.49189 0.0389675 0.323688 4.46039 1.91357 0.0462066 1.17863 5.88724 -2.48812 0
+ 2.67347 -2.04169 0.22175 -1.01072 -0.128126 -1.96071 -0.853268 -0.0424633 -0.686415 -2.48812 1.17447 0
+ 0 0 0 0 0 0 0 0 0 0 0 0
+4 0
+28   111 162  110 161  109 160  108 160  107 160  105 162  102 163  100 166  98 170  97 175  97 180  97 187  100 192  105 196  111 198  118 197  126 194  133 189  138 183  142 177  142 170  139 165  134 161  127 159  120 159  113 160  108 162  104 166  
+27   40 155  39 154  38 154  37 153  35 153  32 155  30 157  28 160  27 164  26 169  27 176  29 182  32 188  36 192  40 194  45 193  50 190  54 184  58 178  61 171  62 164  60 158  56 154  50 152  44 153  37 155  32 159  
+29   102 43  103 43  102 43  101 43  99 45  97 47  95 50  94 55  93 60  94 65  95 68  97 73  101 76  106 77  112 77  117 75  122 73  126 69  128 64  128 59  127 53  124 48  120 43  114 40  109 39  104 39  100 41  98 43  97 46  
+26   28 39  27 38  27 39  26 40  24 41  22 44  21 48  20 52  19 58  20 64  22 69  25 73  29 76  34 77  38 75  43 72  47 68  50 63  51 57  51 51  49 46  46 41  42 38  37 37  32 37  29 39  
+8 1
+43   158 35  158 36  157 37  157 40  156 42  156 44  156 47  155 50  155 53  154 55  154 58  153 60  153 62  153 64  153 66  153 69  153 71  153 73  153 74  153 76  153 77  153 79  153 80  153 82  153 80  153 82  153 84  153 86  153 88  153 89  153 91  153 93  154 95  154 97  154 98  154 99  154 100  154 101  154 102  154 103  154 104  154 105  154 106  
+60   46 31  46 32  45 33  45 34  45 36  44 38  44 39  43 41  43 44  42 46  42 48  42 49  42 51  42 54  42 55  42 57  42 59  42 60  42 62  42 63  42 64  42 65  42 66  42 67  42 69  42 71  42 73  42 74  42 73  42 74  42 76  42 77  42 78  42 79  42 80  42 81  42 82  42 83  41 83  41 84  41 85  41 86  41 88  41 89  41 90  41 91  41 92  40 92  40 93  40 94  40 95  40 96  40 97  40 98  40 99  40 100  40 101  40 102  40 103  40 102  
+20   112 25  112 26  112 28  112 30  113 33  113 37  113 41  113 45  113 52  113 56  113 60  113 63  113 67  112 70  112 74  112 77  112 78  111 79  111 80  111 81  
+30   52 28  52 29  52 31  52 33  52 35  52 37  53 40  53 43  53 45  53 48  53 50  53 53  53 55  53 58  53 60  53 62  53 64  53 65  53 67  53 68  53 69  53 70  53 71  53 72  53 73  52 73  52 74  52 75  51 75  51 76  
+15   117 153  117 152  117 153  117 156  117 160  117 166  117 172  117 180  117 186  117 191  117 195  118 197  118 198  119 198  119 197  
+14   35 150  36 149  37 149  37 151  37 155  37 160  36 167  36 175  36 182  36 189  37 193  38 196  38 197  39 196  
+11   109 34  109 35  110 37  110 42  111 48  111 56  111 64  111 72  112 78  112 81  112 82  
+13   26 30  26 32  27 36  27 41  27 48  27 56  27 63  27 69  27 74  27 78  28 79  28 80  28 81  
+4 2
+28   100 163  99 162  100 162  102 161  105 161  110 160  116 160  121 160  126 162  129 165  129 170  127 176  123 183  118 189  113 194  108 198  105 200  104 201  103 201  105 201  107 201  110 200  114 200  119 199  125 199  130 199  134 198  138 198  
+30   27 161  26 160  26 159  27 159  28 158  30 157  33 157  37 157  39 158  42 161  43 165  43 171  42 179  39 186  35 193  30 199  26 202  23 204  21 204  21 202  22 200  25 198  29 196  33 195  38 196  43 197  48 198  52 200  54 201  56 202  
+33   96 39  96 38  96 37  96 36  97 35  99 33  101 32  104 31  106 31  109 31  112 33  113 37  115 42  115 48  115 55  114 62  112 68  109 73  106 77  102 80  100 81  96 82  94 81  94 80  95 79  98 78  102 76  108 76  114 75  119 76  124 76  127 77  129 77  
+25   19 37  18 36  19 35  20 33  23 32  26 31  30 31  34 32  37 34  38 38  37 44  35 51  31 58  26 65  21 71  17 75  15 78  14 78  16 78  19 76  23 76  28 75  32 75  36 75  40 75  
+4 3
+36   84 161  85 160  86 159  88 158  91 157  95 156  100 156  104 156  109 157  112 159  113 163  113 167  110 173  107 177  104 180  102 183  101 184  100 184  101 184  103 183  105 182  108 182  110 182  113 183  115 185  116 187  116 191  115 195  113 199  109 202  105 204  100 206  95 206  91 205  88 204  85 202  
+38   18 163  18 164  19 163  20 163  22 162  24 162  28 161  31 161  35 162  38 163  40 164  41 167  41 169  40 172  38 175  36 177  34 179  32 180  31 180  32 180  33 180  35 180  37 180  40 181  43 182  45 184  47 188  47 191  47 195  44 199  41 202  38 204  35 204  32 203  30 201  28 199  25 197  23 197  
+36   93 34  92 34  93 33  94 31  97 29  101 28  105 27  110 27  113 27  115 30  116 33  115 37  112 42  109 47  106 51  103 54  102 55  101 55  102 54  104 53  107 52  110 52  113 54  115 56  117 59  118 63  118 67  116 71  113 74  109 77  104 78  100 79  95 79  92 77  90 76  88 74  
+36   12 29  13 28  14 27  15 26  18 24  20 23  24 22  27 22  30 22  33 24  34 27  35 30  34 34  31 38  29 42  27 45  25 46  24 47  25 46  27 45  29 45  31 45  34 45  36 48  38 52  39 57  40 62  39 67  37 71  34 74  31 76  27 77  24 76  20 75  18 73  16 71  
+4 4
+26   107 158  107 157  108 158  108 160  109 163  109 167  109 172  108 176  107 181  106 185  106 188  106 190  106 191  108 191  110 191  112 190  116 189  120 188  124 187  130 186  136 185  141 185  147 185  151 185  154 184  155 184  
+24   22 159  23 160  23 161  23 162  24 164  24 167  25 170  25 173  24 176  24 179  24 181  24 182  25 183  26 183  27 183  29 183  32 182  35 182  40 181  45 180  51 179  56 179  60 178  63 177  
+20   104 26  105 26  105 27  106 29  106 34  106 39  106 45  106 50  105 54  105 57  106 59  108 59  110 58  114 58  118 57  123 57  127 56  131 56  135 57  137 57  
+22   19 24  20 24  20 25  21 27  21 31  21 35  21 41  20 47  19 53  18 58  18 62  18 64  19 66  22 66  26 66  31 66  36 65  42 65  46 65  49 65  52 66  53 66  
+4 6
+33   114 148  114 147  113 147  113 148  111 149  110 152  108 155  106 158  104 163  103 168  103 173  103 178  105 182  107 187  111 190  115 193  119 194  123 195  128 194  132 192  135 188  139 186  140 183  141 180  140 178  138 176  134 175  129 174  123 174  118 175  113 176  109 178  107 180  
+35   47 154  47 153  47 152  47 151  47 150  46 149  45 147  43 146  41 146  38 147  35 149  33 152  30 157  28 163  28 169  28 177  29 184  31 190  33 195  36 197  38 198  41 198  44 196  46 194  48 190  49 187  49 184  48 181  47 179  45 178  42 178  39 179  35 180  30 183  26 186  
+41   127 30  127 31  127 30  128 30  128 29  128 28  128 26  127 25  126 23  125 21  123 19  121 18  119 16  117 16  115 16  113 17  110 19  108 22  106 26  103 32  102 38  100 44  100 52  100 59  101 65  103 70  106 74  110 76  114 77  119 76  123 74  126 72  127 68  127 65  125 62  121 61  117 60  113 62  109 64  106 67  105 70  
+30   29 16  28 16  27 17  26 20  24 23  23 28  22 35  21 42  21 50  22 57  23 63  26 67  29 69  32 70  35 69  39 68  42 66  44 64  46 61  47 59  46 56  45 53  43 51  39 49  35 49  30 49  26 51  23 53  21 56  21 60  
+4 7
+26   98 161  97 161  97 160  98 160  99 160  102 160  107 159  112 159  118 158  124 158  130 157  134 157  135 157  136 158  135 159  134 162  133 164  131 169  127 176  124 184  120 192  116 199  114 204  113 207  113 208  113 207  
+27   27 152  26 153  25 153  26 153  28 153  30 154  34 154  38 154  43 154  48 155  52 156  55 156  57 157  58 158  58 157  58 158  57 159  56 161  55 163  53 168  51 175  47 183  44 192  41 201  39 207  38 211  38 213  
+27   102 40  102 41  104 41  106 41  110 40  115 39  120 39  125 38  129 38  132 38  134 38  135 39  136 39  136 40  136 41  136 42  135 43  134 46  133 51  130 57  127 65  125 74  122 81  120 87  119 91  118 94  118 95  
+28   27 36  26 37  25 37  24 37  23 37  24 37  25 36  28 36  32 36  38 36  44 35  51 34  57 34  61 33  64 33  65 34  65 37  63 40  61 45  58 51  55 58  52 66  50 72  48 77  47 81  46 82  46 83  45 83  
+4 8
+43   123 152  124 151  125 151  125 150  125 149  124 148  123 148  121 148  117 149  113 152  109 155  106 158  104 162  104 165  105 168  108 170  112 171  116 173  121 174  125 176  128 179  129 182  129 186  127 189  124 193  119 196  114 197  110 196  108 194  106 190  107 186  109 182  113 177  116 174  121 171  124 168  127 165  129 162  129 159  128 157  126 155  123 154  122 153  
+46   43 146  43 145  43 144  42 143  42 142  41 141  39 140  37 140  33 141  30 142  26 144  23 147  22 150  21 153  22 156  24 159  27 162  29 164  32 165  36 167  39 169  42 171  45 173  47 176  48 179  48 183  47 186  45 188  41 190  37 191  32 191  28 190  24 187  22 184  23 180  25 175  28 170  32 166  37 162  41 159  44 156  45 154  45 152  44 150  42 149  40 149  
+44   120 34  120 33  120 32  120 31  120 30  118 29  117 27  114 26  111 26  108 27  105 29  102 32  100 35  100 40  100 44  102 47  105 50  109 51  113 53  117 54  121 56  124 58  126 61  127 65  127 69  126 72  124 75  120 77  116 79  110 80  106 80  101 79  99 77  98 75  99 70  103 65  108 59  113 53  117 47  121 43  123 39  124 36  123 35  122 34  
+41   38 23  38 22  37 21  35 20  33 20  30 21  26 22  23 24  20 26  19 29  18 32  18 35  20 38  23 40  26 41  30 43  34 44  37 45  41 47  43 49  44 53  44 57  44 61  42 65  40 68  37 70  34 70  30 69  28 67  26 64  26 61  27 56  29 51  32 45  36 39  39 34  41 31  42 27  43 23  42 20  40 19  
+4 9
+34   127 159  127 158  126 157  126 156  125 156  123 155  121 154  118 153  114 153  110 154  107 156  104 159  102 163  102 168  103 172  105 175  108 177  112 176  116 175  119 172  121 170  123 167  124 165  124 164  125 164  125 166  126 169  126 173  127 179  128 192  129 198  130 202  130 204  131 204  
+40   53 158  53 157  53 155  53 154  52 153  51 152  49 150  47 149  44 149  41 150  38 151  34 154  32 157  30 161  31 165  33 168  36 170  40 171  45 171  48 169  52 168  54 166  55 163  56 162  56 160  56 159  56 160  57 163  57 167  58 173  59 180  60 188  60 195  59 201  58 206  56 210  54 211  53 211  51 211  50 210  
+42   127 36  128 36  128 35  128 34  128 33  127 32  125 31  123 30  120 30  115 30  111 31  107 32  104 34  102 36  102 40  103 43  106 46  110 49  113 50  118 50  123 49  127 46  131 44  133 41  135 40  136 39  136 38  136 39  135 40  135 42  135 46  135 52  134 58  133 65  133 72  132 78  131 82  130 84  129 85  127 85  126 85  125 85  
+40   50 34  50 33  50 32  50 31  49 31  47 30  46 29  43 29  40 28  36 29  32 30  28 31  26 33  24 36  24 40  25 44  28 47  32 49  36 50  41 49  45 47  49 43  52 40  54 37  55 35  55 34  55 33  55 35  55 38  55 42  56 48  57 54  58 62  58 70  58 76  57 81  57 84  56 85  55 85  55 83  
+4 B
+12   143 155  142 155  141 155  139 155  135 155  130 155  124 156  116 156  108 157  100 158  95 158  90 158  
+11   58 154  57 154  55 154  53 153  49 153  44 153  39 153  33 154  28 154  24 155  21 157  
+10   142 60  141 59  139 59  136 58  132 58  126 58  119 58  110 59  102 60  96 62  
+12   66 61  67 61  66 61  64 61  61 60  55 60  49 60  41 60  32 61  26 62  21 63  18 64  
+4 N
+11   102 209  104 208  106 206  109 203  113 199  118 194  123 188  128 182  132 177  136 173  138 171  
+14   22 206  22 205  23 203  25 199  28 195  32 190  36 184  41 178  46 173  50 169  54 165  56 163  59 161  60 160  
+11   97 92  97 91  98 90  100 86  103 82  108 75  114 67  122 58  129 49  134 42  138 37  
+13   27 66  27 67  26 67  27 65  28 63  31 59  34 54  38 49  43 43  47 38  50 34  52 32  52 33  
+2 A
+13   13 59  14 59  17 60  21 60  31 60  38 60  48 60  55 60  59 61  63 61  64 61  65 61  64 61  
+14   48 106  49 106  51 106  55 106  59 107  63 107  70 108  80 108  87 108  91 108  95 108  97 108  98 108  97 108  
+2 S
+19   52 111  52 110  52 107  51 105  51 103  50 101  50 99  49 96  49 93  48 89  48 87  48 84  48 82  48 81  48 80  48 79  48 78  48 77  47 77  
+22   102 140  102 139  102 137  103 134  103 131  103 128  104 125  104 121  104 118  105 115  106 112  107 109  108 106  108 103  109 101  109 99  109 97  110 95  110 93  110 92  110 91  110 92  
+2 R
+24   75 27  75 28  74 30  72 32  69 35  67 37  64 41  61 44  58 48  55 52  52 55  49 58  47 61  45 63  43 64  42 65  41 65  40 66  40 65  41 65  42 65  43 64  44 64  45 63  
+21   158 29  158 30  156 32  154 35  151 38  147 42  143 46  136 53  133 57  129 64  126 68  123 71  121 74  120 76  119 77  119 78  118 78  118 79  117 79  116 79  116 80  
+2 P
+26   92 64  90 64  88 65  84 64  80 64  70 63  60 63  50 62  43 62  36 62  32 62  28 62  26 62  26 63  27 63  29 63  32 63  35 63  39 63  49 63  56 63  66 63  73 62  77 62  79 61  80 61  
+28   206 64  205 64  202 64  199 64  195 64  188 64  181 64  178 64  174 65  171 65  167 66  160 67  157 68  154 68  152 68  151 68  152 68  153 68  154 67  156 67  160 67  164 66  171 65  178 65  185 65  192 64  194 64  196 64  
+2 U
+46   20 79  21 79  22 79  24 79  27 79  34 80  41 81  51 81  61 82  68 82  72 82  74 82  77 82  78 82  79 82  80 82  82 82  84 81  86 81  88 81  89 81  91 81  92 81  91 80  90 79  89 78  88 76  88 74  87 72  87 70  87 67  87 65  87 64  87 63  87 62  87 61  87 60  87 59  87 58  87 57  87 56  87 55  87 54  86 54  86 53  86 52  
+41   84 168  85 167  86 167  88 167  92 167  96 168  103 169  110 170  114 170  110 170  114 170  118 171  128 171  135 170  142 170  152 169  159 169  166 169  169 168  171 168  172 168  173 168  173 167  172 167  172 166  171 165  171 164  170 162  169 160  169 158  169 156  169 153  169 151  169 147  169 145  169 142  170 139  170 137  170 136  170 135  170 134  
+2 V
+64   38 107  39 107  39 106  40 105  41 103  42 101  44 98  45 95  46 91  46 88  47 85  48 82  48 80  48 78  48 77  48 75  48 74  48 73  47 72  46 72  45 72  44 72  44 73  43 73  42 73  42 74  42 75  42 76  42 77  41 78  41 79  42 80  42 82  42 84  42 86  43 88  44 89  45 90  45 91  46 91  47 91  48 90  50 89  53 87  56 85  59 84  62 82  66 80  68 79  70 77  72 75  73 73  74 72  76 70  76 69  77 67  78 66  78 65  79 65  79 64  80 63  81 62  81 61  82 61  
+65   88 138  89 137  90 136  92 135  93 133  95 131  97 130  99 128  102 125  104 123  106 121  107 119  108 117  108 115  108 113  108 112  108 111  108 110  108 109  107 109  106 109  105 109  104 109  103 109  102 109  100 108  99 108  99 109  98 110  98 111  98 112  98 113  98 114  98 116  99 117  99 119  99 120  99 122  99 123  100 124  101 124  102 124  103 123  104 121  106 120  109 117  111 115  114 111  117 107  120 103  122 100  124 96  126 93  127 89  129 86  127 89  129 86  130 83  131 81  132 79  133 78  133 77  133 78  132 78  132 79  
+2 W
+69   107 30  107 31  106 32  106 35  104 37  103 39  102 42  100 45  98 48  96 51  93 55  96 51  93 55  91 59  88 62  86 65  83 67  80 69  78 70  76 71  75 71  74 71  73 71  72 70  71 69  70 67  69 66  69 65  68 64  67 63  67 62  67 61  67 60  67 59  68 59  69 58  70 57  72 56  73 56  74 56  75 56  75 57  76 57  77 58  78 59  80 60  81 61  81 63  82 65  82 67  82 68  82 70  82 72  81 74  80 76  78 78  77 79  74 81  72 83  70 85  68 86  66 87  64 89  62 90  60 91  57 93  55 94  53 95  52 95  
+70   201 44  201 45  200 47  200 50  198 57  196 64  195 71  194 78  193 85  192 89  190 92  189 94  187 96  185 98  184 99  182 100  181 101  180 101  179 101  177 101  176 101  175 100  173 99  172 99  171 98  170 97  169 96  169 95  169 94  168 93  169 91  169 90  169 89  170 88  170 87  171 87  172 86  173 85  174 85  175 84  176 84  177 84  178 85  179 86  179 87  180 88  181 90  182 92  182 94  182 96  182 99  181 101  180 104  180 107  178 109  177 111  175 113  173 114  171 115  168 115  165 116  161 117  158 117  154 118  152 119  150 119  149 120  148 120  149 121  150 121  
+2 X
+34   130 88  128 89  126 89  123 89  119 90  116 91  109 91  102 91  95 92  91 92  84 93  82 93  81 93  80 93  79 93  78 93  79 92  79 91  79 89  79 86  78 83  78 79  77 77  76 74  75 71  74 69  74 68  74 67  74 66  73 66  73 65  73 64  72 64  72 63  
+34   218 155  217 155  216 155  214 155  212 155  209 155  205 155  198 155  188 155  181 155  174 156  170 156  168 156  166 156  166 157  165 157  165 155  164 153  164 152  164 150  163 148  163 145  162 143  162 141  162 139  161 138  161 137  161 136  161 135  162 135  162 134  162 133  162 132  163 132  
+4 5
+60   89 34  88 34  87 34  86 34  84 34  81 34  77 33  73 33  69 33  64 33  60 33  56 34  53 34  50 35  48 36  47 38  46 40  46 42  46 45  47 47  48 50  49 53  50 56  50 59  50 62  50 65  50 67  49 68  49 69  49 70  50 70  51 69  52 68  54 67  56 66  59 66  62 66  66 67  69 69  72 72  75 75  77 78  79 81  81 84  81 88  82 91  81 94  80 97  78 99  76 101  73 103  69 105  64 107  59 108  53 108  47 108  41 106  36 102  32 99  29 97  
+59   195 69  194 69  193 69  191 68  190 67  187 67  183 66  180 66  176 66  172 65  168 65  165 65  163 65  160 65  159 65  158 66  158 68  157 70  157 72  157 75  158 79  158 82  159 87  160 90  161 93  162 96  162 97  162 98  162 99  163 98  164 97  166 97  167 96  170 96  173 97  175 98  179 99  181 102  183 105  186 108  188 112  190 117  191 120  192 124  192 127  191 129  189 131  186 133  181 135  176 136  170 137  163 138  156 138  150 138  145 136  140 134  137 132  134 128  131 124  
+52   81 32  80 32  78 31  76 31  74 31  71 31  67 30  64 30  60 30  56 31  53 31  51 32  49 33  48 34  48 36  48 39  48 42  49 46  51 50  52 54  53 58  54 62  55 65  54 67  55 68  56 67  58 67  60 67  62 67  64 67  67 68  70 70  72 72  75 75  76 78  78 81  78 84  78 86  77 88  75 90  72 91  69 93  64 94  59 94  53 94  48 93  43 92  38 90  34 89  31 88  29 87  28 87  
+54   189 68  189 69  187 69  185 68  183 68  179 67  174 67  170 67  164 68  160 69  156 70  154 71  153 72  152 73  152 74  153 76  154 79  155 82  155 85  156 89  156 92  155 95  155 97  154 98  154 99  154 100  155 100  156 101  157 100  159 100  162 101  165 101  169 103  172 105  175 108  178 112  180 116  182 120  183 123  183 127  182 130  181 133  178 136  174 139  168 141  162 143  154 145  146 146  139 145  133 143  128 141  125 139  123 137  122 135  
diff -urN lib/microwindows/src/demos/nxscribble/hre.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/hre.h
--- lib/microwindows/src/demos/nxscribble/hre.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/hre.h	2005-02-21 16:13:00.000000000 +0100
@@ -0,0 +1,399 @@
+/* 
+ *  hre.h:            API for Handwriting Recognition Engine on Unix
+ *  Author:           James Kempf
+ *  Created On:       Wed Oct 28 11:30:43 1992
+ *  Last Modified By: James Kempf
+ *  Last Modified On: Fri Sep 23 13:49:26 1994
+ *  Update Count:     74
+ *  Copyright (c) 1994 by Sun Microsystems Computer Company
+ *  All rights reserved.
+ *  
+ *  Use and copying of this software and preparation of 
+ *  derivative works based upon this software are permitted.
+ *  Any distribution of this software or derivative works
+ *  must comply with all applicable United States export control
+ *  laws.
+ *
+ *  This software is made available as is, and Sun Microsystems
+ *  Computer Company makes no warranty about the software, its
+ *  performance, or its conformity to any specification
+ */
+
+#ifndef _HRE_H_
+
+#define _HRE_H_
+
+#include <sys/types.h>
+#include <stdlib.h>
+/*#include <libintl.h>*/
+
+#ifdef ELX
+typedef unsigned int wchar_t;
+#endif
+
+#ifndef ARM_LINUX  /* SEP - no X on the itsy yet */
+/* ari  -- for Time */
+//#include <X11/X.h>
+#endif
+
+/* Scalar Type Definitions */
+
+/*For better readibility.*/
+
+#ifndef true
+
+typedef u_char bool;
+
+#define true 1
+#define false 0
+
+#endif
+
+/*For pointers to extra functions on recognizer.*/
+
+typedef void (*rec_fn)();
+
+/*
+ *rec_confidence is an integer between 0-100 giving the confidence of the
+ * recognizer in a particular result.
+*/
+
+typedef u_char rec_confidence;
+
+/*Time value. This is the same as in X.h, so we conditionally define.*/
+/* ari -- no it's not.  *SIGH*  there's an ifdef in X.h specifically */
+/* for osf.  */
+#ifndef X_H
+
+#ifndef __osf__
+typedef unsigned long Time;
+#else
+typedef unsigned int Time;
+#endif
+/* (mips) typedef unsigned long Time; */
+/* (osf) typedef unsigned int Time; */
+
+#endif
+
+/**************** RECOGNIZER CONFIGURATION INFORMATION *******************/
+
+/*
+ * Recognizer information. Gives the locale, category of the character
+ * set returned by the recognizer, and any subsets to which the
+ * recognition can be limited. The locale and category should be
+ * suitable for the setlocale(3). Those recognizers which don't do text
+ * can simply report a blank locale and category, and report the
+ * graphics types they recognize in the subset. 
+*/
+
+typedef struct {
+    char* ri_locale;        /*The locale of the character set.*/
+    char* ri_name;          /*Complete pathname to the recognizer.*/
+    char** ri_subset;       /*Null terminated list of subsets supported*/
+} rec_info;
+
+/*These define a set of common character subset names.*/
+
+#define GESTURE		"GESTURE"	/* gestures only */
+#define MATHSET		"MATHSET"	/* %^*()_+={}<>,/. */
+#define MONEYSET	"MONEYSET"	/* $, maybe cent, pound, and yen */
+#define WHITESPACE	"WHITESPACE"	/* gaps are recognized as space */
+#define KANJI_JIS1	"KANJI_JIS1"	/* the JIS1 kanji only */
+#define KANJI_JIS1_PLUS	"KANJI_JIS1_PLUS" /* JIS1 plus some JIS2 */
+#define KANJI_JIS2	"KANJI_JIS2"	/* the JIS1 + JIS2 kanji */
+#define HIRIGANA	"HIRIGANA"	/* the hirigana */
+#define KATAKANA	"KATAKANA"	/* the katakana */
+#define UPPERCASE	"UPPERCASE"	/* upper case alphabetics, no digits */
+#define LOWERCASE	"LOWERCASE"	/* lower case alphabetics, no digits */
+#define DIGITS		"DIGITS"	/* digits 0-9 only */
+#define PUNCTUATION	"PUNCTUATION"	/* \!-;'"?()&., */
+#define NONALPHABETIC	"NONALPHABETIC" /* all nonalphabetics, no digits */
+#define ASCII		"ASCII"		/* the ASCII character set */
+#define ISO_LATIN12	"ISO_LATIN12"	/* The ISO Latin 12 characters */
+
+
+/********************  RECOGNITION INPUT STRUCTURES ***********************/
+
+/*
+ * WINDOW SYSTEM INTERFACE
+*/
+
+/*Basic point. Note that it is identical to XTimeCoord, for easy conversion*/
+
+typedef struct {
+    Time time;
+    short x, y;
+} pen_point;
+
+/*Bounding box. Structurally identical to XRectangle.*/
+
+typedef struct {
+    short x,y;                    /*Upper left corner.*/
+    short width,height;           /*Width and height.*/
+} pen_rect;    
+
+/* Button flags - pen's button configuration. */
+
+#define TABLET_TIP     0x1	/*tip switch*/
+#define TABLET_BUTTON1 0x2	/*one barrel switch*/
+#define TABLET_BUTTON2 0x4	/*two barrel switches*/
+#define TABLET_BUTTON3 0x8	/*three barrel switches*/
+
+/* Pen flags - additional state information that can be reported by the pen.*/
+
+#define TABLET_PROXIMITY  0x1  /*can report position when pen not in contact*/
+#define TABLET_RELATIVE   0x2	/*can report relative coords, like mouse*/
+#define TABLET_ABSOLUTE	  0x4   /*can report absolute co-ordinates*/
+#define TABLET_RANGE	  0x8   /*can report when pen goes out of range*/
+#define TABLET_INVERT     0x10	/*can report when pen is inverted*/
+#define TABLET_TOUCH	  0x20	/*finger can be used as pen*/
+
+/* Angle flags - reporting of information about the pen angle. */
+
+#define TABLET_ANGLEX  0x1	/*can report angle with the x axis*/
+#define TABLET_ANGLEY  0x2	/*can report angle with the y axis*/
+#define TABLET_ROTATE  0x4	/*can report barrel rotation*/
+
+/* 
+ * Sensor flags - configuration and reporting capabilities
+*  of the tablet's sensor panel.
+*/
+
+#define TABLET_INTEGRATED     0x1     /*sensor panel is integrated with display*/
+#define TABLET_PRESSURE       0x2     /*sensor panel can report pressure*/
+#define TABLET_HEIGHT         0x4     /*sensor panel can report height*/
+
+/* Units flags - in what units x and y coordinate data reported.*/
+
+#define TABLET_DIMENSIONLESS 0x1	/*no units*/
+#define TABLET_ENGLISH	     0x2	/*thousandths of an inch*/
+#define TABLET_METRIC	     0x4	/*tenths of a millimeter*/
+
+/* Origin flags - where the tablet's origin is located.*/
+
+#define TABLET_ULEFT	0x1		/*upper left corner*/
+#define TABLET_URIGHT	0x2		/*upper right corner*/
+#define TABLET_LLEFT    0x4		/*lower left corner*/
+#define TABLET_LRIGHT	0x8		/*lower right corner*/
+#define TABLET_CENTER	0x10		/*center of tablet*/
+
+/*
+ * Tablet  capabilities structure. Defines basic information about tablet
+ * configuration. 
+*/
+
+typedef struct {
+	char tc_id[20];			   /*tablet identifier, null terminated*/
+	u_short tc_button;      	   /*button capabilities*/
+	u_short tc_pen;		       	   /*pen capabilities*/
+	u_short tc_angle;         	   /*pen angle reporting*/
+	u_int tc_sensor : 8;		   /*sensor capabilities*/
+	u_int tc_units : 8;	   	   /*units for xy reporting*/
+	u_int tc_default_units : 8; 	   /*default units*/
+	u_int tc_origin : 8;	   	   /*where origin located*/
+	short tc_x[2];			   /*minimum/maximum x*/
+	short tc_y[2];			   /*minimum/maximum y*/
+	short tc_pressure[2];		   /*minimum/maximum pressure/height*/
+	u_int tc_sample_rate;		   /*rate of event reporting*/
+	u_int tc_sample_distance;	   /*xy coords per sample*/
+
+} tablet_cap;
+
+/*
+ * PEN STROKE DATA
+*/
+
+/*
+ * Pen state parameters. "Basic" state is pen up/down, barrel buttons 
+ * (if any), and in/out of range. Others may be reported by particular pens.
+*/
+
+typedef struct {
+    u_short pt_button;      /*button state - same as tc_button*/
+    u_short pt_pen;         /*other state - same as tc_pen*/
+    short pt_pressure;      /*Pressure. + against tablet, - above tablet.*/
+    double pt_anglex;       /*angle of tilt in the x direction, in radians.*/
+    double pt_angley;       /*angle of tilt in the y direction, in radians.*/
+    double pt_barrelrotate; /*angle of barrel rotation, in radians.*/
+} pen_state;
+
+/*
+ * Stroke structure. 
+*/
+
+typedef struct {
+    u_int ps_npts;                        /*Number of pen_point in array.*/
+    pen_point* ps_pts;                    /*Array of points.*/
+    u_int ps_nstate;			  /*Number of pen_state in array.*/
+    u_int* ps_trans;			  /*State transition point indicies.*/
+    pen_state* ps_state;                  /*Array of state.*/
+} pen_stroke;
+
+/*
+ * RECOGNITION CONTEXT
+*/
+
+/* Structure for reporting writing area geometric constraints. */
+
+typedef struct {
+	pen_rect pr_area;
+	short pr_row, pr_col;
+	double pr_rowpitch, pr_colpitch;
+} pen_frame; 
+
+/*User preferences*/
+
+#define REC_RIGHTH 0x0		/*Right-handed writer.*/
+#define REC_LEFTH  0x1          /*Left-handed writer.*/
+
+/*
+ * Writing direction. There will generally be a preferred and a 
+ * secondary direction (example: English is left to right, then
+ * top to bottom). High byte has preferred, low byte secondary.
+ * The recognizer can ignore this and key off of locale.
+*/
+
+#define REC_DEFAULT           0x0         /*Use default direction.*/
+#define REC_BOTTOM_TOP        0x1         /*Bottom to top.*/
+#define REC_LEFT_RIGHT        0x2         /*Left to right.*/
+#define REC_RIGHT_LEFT        0x3         /*Right to left.*/
+#define REC_TOP_BOTTOM        0x4         /*Top to bottom.*/
+
+/* 
+ * Structure for describing a set of letters to constrain recognition. 
+ * ls_type is the same as the re_type field for rec_element below.
+*/
+
+typedef struct _letterset {
+        char ls_type;
+        union _ls_set {
+                char* aval;
+                wchar_t* wval;
+        } ls_set;
+} letterset;
+
+/*
+ * Recognition context. Describes the context in which the pen stroke
+ * data was obtained and in which recognition should proceed. 
+*/
+
+typedef struct {
+    u_short rc_upref;           /*User preference. */
+    bool rc_gesture;            /*Look for gesture if true.*/
+    u_short rc_direction;       /*Primary and secondary writing direction.*/
+    rec_confidence rc_cutoff;	/*Cut off recognition below this confidence*/
+    tablet_cap* rc_tinfo;       /*Tablet capabilities.*/
+    char** rc_subset;           /*Confine recognition to these subsets.*/
+    pen_frame* rc_frame;        /*If nonNULL, writing area geometry.*/
+    wordset rc_wordset;         /*If nonNULL, dictionary.*/
+    letterset rc_letterset;     /*If nonNULL, constrain to these chars.*/
+    void* rc_context;           /*For recognizer-specific context.*/
+} rc;
+
+/**************************  GESTURES  **************************/
+
+/*
+ * Gestures. The toolkit initializes the recognizer with a
+ * set of gestures having appropriate callbacks. 
+ * When a gesture is recognized, it is returned as part of a
+ * recognition element. The recognizer fills in the bounding
+ * box and hotspots. The toolkit fills in any additional values,
+ * such as the current window, and calls the callback.
+*/
+
+typedef struct Gesture {
+    char* g_name;                      /*The gesture's name.*/
+    u_int g_nhs;                       /*Number of hotspots.*/
+    pen_point* g_hspots;               /*The hotspots.*/
+    pen_rect g_bbox;                   /*The bounding box.*/
+    void (*g_action)(struct Gesture*);       /*Pointer to execution function.*/
+   void* g_wsinfo;	    	     /*For toolkit to fill in.*/
+} gesture;
+
+typedef void (*xgesture)(gesture*);
+
+/*These provide some common gesture names.*/
+
+#define COPY	"COPY"		/*Copy target to clipboard*/
+#define CUT	"CUT"		/*Copy target and delete*/
+#define PASTE	"PASTE"		/*Paste clipboard into target*/
+#define UNDO	"UNDO"		/*Undo the previous gesture action*/
+#define CLEAR	"CLEAR"		/*Clear clipboard*/
+#define EXTEND	"EXTEND"	/*Extend selection to target location*/
+#define RETURN	"RETURN"	/*Insert newline/carriage return at target*/
+#define SPACE	"SPACE"		/*Insert space at target*/
+#define TAB	"TAB"		/*Insert tab at target*/
+#define KKCONVERT  "KKCONVERT"	/*Perform kana-kanji conversion on target*/
+
+/********************* RECOGNITION RETURN VALUES *************************/
+
+
+/*Different types in union. "Other" indicates a cast is needed.*/
+
+#define REC_NONE    0x0             /*No return value*/
+#define REC_GESTURE 0x1             /*Gesture.*/
+#define REC_ASCII   0x2             /*Array of 8 bit ASCII*/
+#define REC_VAR     0x4             /*Array of variable width characters. */
+#define REC_WCHAR   0x8             /*Array of Unicode (wide) characters. */
+#define REC_OTHER   0x10            /*Undefined type.*/
+#define REC_CORR    0x20	    /*rec_correlation struct*/
+
+/*
+ * Recognition elements. A recognition element is a structure having a 
+ * confidence level member, and a union, along with a flag indicating 
+ * the union type. The union contains a pointer to the result. This
+ * is the basic recognition return value, corresponding to one
+ * recognized word, letter, or group of letters.
+*/
+
+/*Ruse to make types woik*/
+
+#define rec_correlation void
+
+typedef struct {
+    char re_type;                  /*Union type flag.*/
+    union {
+	gesture* gval;             /*Gesture.*/
+	char* aval;                /*ASCII and variable width.*/
+	wchar_t* wval;             /*Unicode.*/
+	rec_correlation* rcval;    /*rec_correlation*/
+    } re_result;                   
+    rec_confidence re_conf;        /*Confidence (0-100).*/
+} rec_element;
+
+/*
+ * Recognition alternative. The recognition alternative gives
+ * a translated element for a particular segmentation, and
+ * a pointer to an array of alternatives for the next position
+ * in the segmentation thread.
+*/
+
+struct _Rec_alternative {
+	rec_element ra_elem; 		/*the translated element*/
+	u_int ra_nalter;		/*number of next alternatives*/
+	struct _Rec_alternative* ra_next; /*the array of next alternatives*/
+};
+
+typedef struct _Rec_alternative rec_alternative;
+
+/*
+ * Recognition correlation. A recognition correlation is a recognition
+ * of the stroke input along with a correlation between the stroke
+ * input and the recognized text. The rec_correlation struct contains
+ * a pointer to an arrray of pointers to strokes, and
+   two arrays of integers, giving the starting point and
+ * stopping point of each corresponding recogition element returned
+ * in the strokes. 
+*/
+
+#undef rec_correlation
+
+typedef struct {
+    rec_element ro_elem;          /*The recognized alternative.*/
+    u_int ro_nstrokes;            /*Number of strokes.*/
+    pen_stroke* ro_strokes;       /*Array of strokes.*/
+    u_int* ro_start;              /*Starting index of points.*/
+    u_int* ro_stop;               /*Stopping index of points.*/
+} rec_correlation;
+
+#endif
diff -urN lib/microwindows/src/demos/nxscribble/hre_api.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/hre_api.c
--- lib/microwindows/src/demos/nxscribble/hre_api.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/hre_api.c	2005-02-21 16:13:00.000000000 +0100
@@ -0,0 +1,1453 @@
+/* 
+ *  hre_api.c:        Implementation of HRE API
+ *  Author:           James &
+ *  Created On:       Wed Dec  9 13:49:14 1992
+ *  Last Modified By: James Kempf
+ *  Last Modified On: Fri Sep 23 13:49:04 1994
+ *  Update Count:     137
+ *  Copyright (c) 1994 by Sun Microsystems Computer Company
+ *  All rights reserved.
+ *  
+ *  Use and copying of this software and preparation of 
+ *  derivative works based upon this software are permitted.
+ *  Any distribution of this software or derivative works
+ *  must comply with all applicable United States export control
+ *  laws.
+ *
+ *  This software is made available as is, and Sun Microsystems
+ *  Computer Company makes no warranty about the software, its
+ *  performance, or its conformity to any specification
+ */
+
+
+#include <sys/types.h>
+#ifdef ELX
+#include <vxWorks.h>
+#endif
+#include <sys/stat.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <locale.h>
+#include <stdlib.h>
+/*#include <libintl.h>*/
+#include <hre_internal.h>   /* includes hre.h */
+
+/* ari -- prototype for rii function */
+recognizer __recognizer_internal_initialize(rec_info* ri);
+
+/*Version number of API.*/
+
+char* REC_VERSION = "2.0";
+
+/*Domain name for internationalized text.*/
+
+#define INTL_DOMAIN "recognition_manager"
+
+/* XXX -- Intl Hack -- Jay & Ari */
+#define	dgettext(domain, msg)	(msg)
+#define	bindtextdomain(dirname,	domain)
+
+/*
+ * These magic numbers are used to ensure the integrity of the
+ * recognizer structure.
+*/
+
+
+#define REC_MAGIC       0xfeed
+#define REC_END_MAGIC   0xbeef
+
+/*Check the recognizer for validity*/
+
+#define RI_CHECK_MAGIC(rec) \
+  ( (rec != NULL) && \
+    (((recognizer)rec)->recognizer_magic == REC_MAGIC) && \
+   (((recognizer)rec)->recognizer_end_magic == REC_END_MAGIC) &&\
+   (((recognizer)rec)->recognizer_version == REC_VERSION) )
+
+/*The name of the initialization & finalization functions.*/
+
+/* static char rii_name[] = "__recognizer_internal_initialize";
+static char rif_name[] = "__recognizer_internal_finalize";  */
+
+/*User home directory for recognizer info.*/
+/* ari -- changed USERRECHOME from ".recognizers" */
+#define HOME "HOME"
+#define USERRECHOME ".classifiers"
+
+/*Local functions*/
+
+//static char* shared_library_name(char* directory,char* locale,char* name);
+static rec_info* make_rec_info(char* directory,char* name,char** subset);
+static void delete_rec_info(rec_info* ri);
+//static int check_for_user_home();
+static void intl_initialize();
+
+static void cleanup_rec_element(rec_element* re,bool delete_points_p);
+
+/*The last error.*/
+
+static char* the_last_error = NULL;
+
+static char *safe_malloc (int nbytes)
+{
+  char *res = malloc(nbytes);
+  if (res == NULL) {
+    error("malloc failure");
+    exit(2);
+  }
+  return (res);
+}
+
+
+/*
+ * Implementation of API functions
+*/
+
+/*
+ * recognizer_load - Load the recognizer matching the rec_info struct.
+ * If name is not null, then load the recognizer having that name. Returns
+ * the recognizer object, or null if it can't load the recognizer, and
+ * sets errno to indicate why.
+*/
+
+recognizer 
+recognizer_load(char* directory,char* name,char** subset)
+{
+    recognizer rec;                     /*the recognizer*/
+    //recognizer_internal_initialize rii; /*the initialization function*/
+    rec_info* rinf;                     /*rec_info for recognizer information*/
+    static bool intl_init = false;	/*true if recog. manager initted.*/
+
+    if( intl_init == false ) {
+      intl_init = true;
+
+      intl_initialize();
+    }
+
+    /*The name takes precedence.*/
+    rinf = make_rec_info(directory,name,subset);
+    if (rinf == NULL) {
+	the_last_error = 
+	  dgettext(INTL_DOMAIN,
+		   "Ran out of memory during prelinking initialization.");
+	return((recognizer)NULL);
+    } 
+//fprintf(stderr, "Got past make_rec_info.\n");
+
+    /*Let recognition code create recognizer and initialize*/
+    rec = __recognizer_internal_initialize(rinf);
+    if (rec == NULL) {
+	return((recognizer)NULL);
+    }
+//fprintf(stderr, "Did rii.\n");
+    /*Check whether it's been correctly initialized*/
+
+    if( rec->recognizer_load_state == NULL ||
+        rec->recognizer_save_state == NULL ||
+        rec->recognizer_load_dictionary == NULL ||
+        rec->recognizer_save_dictionary == NULL ||
+        rec->recognizer_free_dictionary == NULL ||
+        rec->recognizer_add_to_dictionary == NULL ||
+        rec->recognizer_delete_from_dictionary == NULL ||
+        rec->recognizer_error == NULL ||
+        rec->recognizer_set_context == NULL ||
+        rec->recognizer_get_context == NULL ||
+        rec->recognizer_clear == NULL ||
+        rec->recognizer_get_buffer == NULL ||
+        rec->recognizer_set_buffer == NULL ||
+        rec->recognizer_translate == NULL ||
+        rec->recognizer_get_extension_functions == NULL ||
+        rec->recognizer_get_gesture_names == NULL ||
+        rec->recognizer_set_gesture_action == NULL
+       ) {
+
+	recognizer_unload(rec);
+fprintf(stderr, "Unloading b/c null function pointer.\n");
+	the_last_error = 
+	  dgettext(INTL_DOMAIN,
+		   "One or more recognizer function pointers is NULL.");
+	return((recognizer)NULL);
+    }
+
+
+    /*Set the rec_info structure.*/
+
+    rec->recognizer_info = rinf;
+
+    /*Check whether home directory is there for recognizer info.*/
+
+/*
+ *  ari -- don't bother.  We're not going to load from each user's
+ *  home directory at this point.  Instead, we'll use a stupid
+ *  little a-b-c file because it loads FAST.
+ *
+ *    if( check_for_user_home() < 0 ) {
+ *	recognizer_unload(rec);
+ *	return((recognizer)NULL);
+ *   }
+ */
+    /*We got it!*/
+//fprintf(stderr, "Done.\n");
+
+    return(rec);
+}
+
+/*
+ * recognizer_unload - Unload the recognizer.
+*/
+
+int
+recognizer_unload(recognizer rec)
+{
+    //recognizer_internal_finalize rif;
+    
+    /*Make sure magic numbers right.*/
+    
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return(-1);
+    }
+    
+    __recognizer_internal_finalize(rec);
+
+    return(0);
+}
+
+/*
+ * recognizer_load_state-Get any recognizer state associated with name
+ * in dir. Note that name may not be simple file name, since
+ * there may be more than one file involved. Return 0 if successful,
+ * -1 if not.
+*/
+
+int recognizer_load_state(recognizer rec,char* dir,char* name)
+{
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return(-1);
+    }
+
+    /*Do the function.*/
+
+    return(rec->recognizer_load_state(rec,dir,name));
+}
+
+/*
+ * recognizer_save_state-Save any recognizer state to name
+ * in dir. Note that name may not be a simple file name, since
+ * there may be more than one file involved. Return 0 if successful,
+ * -1 if not.
+*/
+
+int recognizer_save_state(recognizer rec,char* dir,char* name)
+{
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return(-1);
+    }
+
+    /*Do the function.*/
+
+    return(rec->recognizer_save_state(rec,dir,name));
+}
+
+/*
+ * recognizer_load_dictionary-Load dictionary, return pointer
+ * to it, or NULL if error.
+*/
+
+wordset recognizer_load_dictionary(recognizer rec,char* dir,char* name)
+{
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return(NULL);
+    }
+
+    /*Do the function.*/
+
+    return(rec->recognizer_load_dictionary(rec,dir,name));
+}
+
+/*
+ * recognizer_save_dictionary-Save the  dictionary to the file, return 0 if
+ * OK, -1 if error.
+*/
+
+int recognizer_save_dictionary(recognizer rec,char* dir,char* name,wordset dict)
+{
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return(-1);
+    }
+
+    /*Do the function.*/
+
+    return(rec->recognizer_save_dictionary(rec,dir,name,dict));
+}
+
+/*
+ * recognizer_free_dictionary-Free the dictionary, return 0 if
+ * OK, -1 if error.
+*/
+
+int recognizer_free_dictionary(recognizer rec,wordset dict)
+{
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return(-1);
+    }
+
+    /*Do the function.*/
+
+    return(rec->recognizer_free_dictionary(rec,dict));
+}
+
+/*
+ * recognizer_add_to_dictionary-Add word to the dictionary,
+ * return 0 if OK, -1 if error.
+*/
+
+
+int recognizer_add_to_dictionary(recognizer rec,letterset* word,wordset dict)
+{
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return(-1);
+    }
+
+    /*Do the function.*/
+
+    return(rec->recognizer_add_to_dictionary(rec,word,dict));
+}
+
+/*
+ * recognizer_delete_from_dictionary-Delete word from the dictionary,
+ * return 0 if OK, -1 if error.
+*/
+
+int 
+recognizer_delete_from_dictionary(recognizer rec,letterset* word,wordset dict)
+{
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return(-1);
+    }
+
+    /*Do the function.*/
+
+    return(rec->recognizer_delete_from_dictionary(rec,word,dict));
+}
+
+/*
+ * recognizer_get_info-Get a pointers to the rec_info
+ * giving the locales and subsets supported by the recognizer
+ * and the shared library pathname.
+*/
+
+const rec_info*
+recognizer_get_info(recognizer rec)
+{
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return((rec_info*)NULL);
+    }
+
+    /*Return the rec_info object.*/
+
+    return(rec->recognizer_info);
+}
+
+/*
+ * recognizer_manager_version-Return the version number string of the
+ * recognition manager.
+*/
+
+const char* recognizer_manager_version(recognizer rec)
+{
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return(NULL);
+    }
+
+    return(rec->recognizer_version);
+  
+}
+/*
+ * recognizer_error-Return the last error message, or NULL if none.
+*/
+
+char* recognizer_error(recognizer rec)
+{
+    
+    /*Make sure magic numbers right and function there.*/
+
+    if( !RI_CHECK_MAGIC(rec) && the_last_error == NULL ) {
+      return(dgettext(INTL_DOMAIN,"Bad recognizer object."));
+
+    } else if( the_last_error != NULL ) {
+      char* error = the_last_error;
+
+      the_last_error = NULL;
+      return(error);
+    }
+
+    /*Do the function.*/
+
+    return(rec->recognizer_error(rec));
+}
+
+/*
+ * recognizer_set_context-Set the recognition context for translation.
+ * Return 0 if successful, -1 if error.
+*/
+
+int recognizer_set_context(recognizer rec,rc* rec_xt)
+{
+
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return(-1);
+    }
+
+    /*Do the function.*/
+
+    return(rec->recognizer_set_context(rec,rec_xt));
+}
+
+/* 
+ * recognzier_get_context-Get the recognition context for translation.
+ * If none or error, return NULL.
+*/
+
+rc* recognizer_get_context(recognizer rec)
+{
+
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return(NULL);
+    }
+
+    /*Do the function.*/
+
+    return(recognizer_get_context(rec));
+}
+
+/*
+ * recognizer_clear-Clear buffer and recognition context.
+ * Return 0 if success, else -1.
+*/
+
+int recognizer_clear(recognizer rec,bool delete_points_p)
+{
+
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return(-1);
+    }
+
+    /*Do the function.*/
+
+    return(rec->recognizer_clear(rec,delete_points_p));
+}
+
+/*recognizer_get_buffer-Get stroke buffer. Return 0 if success, else -1.*/
+
+
+int recognizer_get_buffer(recognizer rec, u_int* nstrokes,pen_stroke** strokes)
+{
+
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return(-1);
+    }
+
+    /*Do the function.*/
+
+    return(rec->recognizer_get_buffer(rec,nstrokes,strokes));
+
+}
+
+/*
+ * recognizer_set_buffer-Set stroke buffer to arg. Return 0 if success, else 
+ * return -1.
+*/
+
+int recognizer_set_buffer(recognizer rec,u_int nstrokes,pen_stroke* strokes)
+{
+
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return(-1);
+    }
+
+    /*Do the function.*/
+
+    return(rec->recognizer_set_buffer(rec,nstrokes,strokes));
+
+}
+
+/*
+ * recognizer_translate-Translate the strokes in the current context, including
+ * buffered strokes. If nstrokes == 0 or strokes == NULL, return 
+ * translation of stroke buffer.
+*/
+
+int recognizer_translate(recognizer rec,
+			 u_int nstrokes,
+			 pen_stroke* strokes,
+			 bool correlate_p,
+			 int* nret,
+			 rec_alternative** ret)
+{
+    int retval;
+    char msg[80];
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN, msg);
+	return(-1);
+    }
+
+/* ari */
+/*    {
+ *      u_int i;
+ *      pen_stroke ari_pstr;
+ *      pen_point* ari_pts;
+ *      int ari;
+ *      for (i = 0; i < nstrokes; i++) {
+ *	ari_pstr = strokes[i];
+ *	ari_pts = ari_pstr.ps_pts;
+ *	fprintf(stderr, "\nrecognizer_translate: ari_pts = %ld, sizeof(Time) = %d, sizeof(ari_pts[0] = %d, %d points are...\n", ari_pts, sizeof(Time), sizeof(ari_pts[0]), ari_pstr.ps_npts);
+ *	for (ari = 0; ari < ari_pstr.ps_npts; ari++)
+ *	   fprintf(stderr, "%ld -- (%d, %d)  ", ari_pts[ari], ari_pts[ari].x, ari_pts[ari].y);
+ *      }
+ *    }     
+*/
+    /*Do the function.*/
+/* ari -- this is calling cmu_recognizer_translate */
+    retval = rec->recognizer_translate(rec,
+				     nstrokes,
+				     strokes,
+				     correlate_p,
+				     nret,
+				     ret);
+    return (retval);
+}
+
+
+/*
+ * recognizer_get_extension_functions-Return a null terminated array
+ * of functions providing extended functionality. Their interfaces
+ * will change depending on the recognizer.
+*/
+
+rec_fn* recognizer_get_extension_functions(recognizer rec)
+{
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return((rec_fn*)NULL);
+    }
+
+    /*Do the function.*/
+
+    return(rec->recognizer_get_extension_functions(rec));
+}
+
+
+/*
+ * recognizer_get_gesture_names - Return a null terminated array of
+ * gesture name strings.
+*/
+
+char**
+recognizer_get_gesture_names(recognizer rec)
+{
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return(NULL);
+    }
+
+    /*Do the function.*/
+
+    return(rec->recognizer_get_gesture_names(rec));
+}
+
+/*
+ * recognizer_set_gesture_action-Set the action function for the gesture.
+*/
+
+xgesture 
+recognizer_train_gestures(recognizer rec,char* name,xgesture fn,void* wsinfo)
+{
+    /*Make sure magic numbers right.*/
+
+    if( !RI_CHECK_MAGIC(rec) ) {
+	the_last_error = dgettext(INTL_DOMAIN,"Bad recognizer object.");
+	return((xgesture)-1);
+    }
+
+    /*Do the function.*/
+
+    return(rec->recognizer_set_gesture_action(rec,name,fn,wsinfo));
+}
+
+/*
+ * Local functions.
+*/
+
+/*
+ * shared_library_name-Get the full pathname to the shared library,
+ *    based on the recognizer name and the environment.
+*/
+
+
+#if 0
+static char* shared_library_name(char* directory,char* locale,char* name)
+{
+    char* ret = NULL;
+    int len = strlen(name);
+
+    /*If directory is there, it takes precedence.*/
+
+    if( directory != NULL ) {
+	ret = (char*)safe_malloc(strlen(directory) + len + 2);
+	strcpy(ret,directory);
+	strcat(ret,"/");
+	strcat(ret,name);
+
+    } 
+    else {
+	char* dir = NULL;
+
+	/*First try the environment variable.*/
+
+	if( (dir = getenv(RECHOME)) == NULL ) {
+	    dir = "REC_DEFAULT_HOME_DIR";
+
+	  }
+
+	ret = (char*)safe_malloc(strlen(dir) + strlen(locale) + len + 3);
+	/*Form the pathname.*/
+	strcpy(ret,dir);
+	strcat(ret,"/");
+	strcat(ret,locale);
+	strcat(ret,"/");
+	strcat(ret,name);
+
+    }
+
+    return(ret);
+}
+#endif
+
+/*
+ * intl_initialize-Initialize the internationaliztion of messages for
+ * the recognition manager.
+*/
+
+static void intl_initialize()
+{
+  char* dirname;
+
+  /*Get recognizer home directory name from environment.*/
+
+  if( (dirname = getenv(RECHOME)) == NULL ) {
+    dirname = "REC_DEFAULT_HOME_DIR";
+  }
+
+  /*Bind the text domain.*/
+
+  bindtextdomain(dirname,INTL_DOMAIN);
+}
+
+
+/*make_rec_info-Create a rec_info structure*/
+
+static rec_info* make_rec_info(char* directory,char* name,char** subset)
+{
+    int i,len;
+    rec_info* ri;
+    char* locale;
+
+    ri = (rec_info*)safe_malloc(sizeof(rec_info));
+    ri->ri_locale = NULL;
+    ri->ri_name = NULL;
+    ri->ri_subset = NULL;
+
+    /*Get locale*/
+
+    if( (locale = getenv(LANG)) == NULL ) {
+	locale = strdup(REC_DEFAULT_LOCALE);
+    }
+
+    if( (ri->ri_locale = strdup(locale)) == NULL ) {
+	delete_rec_info(ri);
+	return(NULL);
+    }
+
+    /*Get shared library pathname.*/
+
+/*
+ *    if( (ri->ri_name = shared_library_name(directory,locale,name)) == NULL ) {
+ *	delete_rec_info(ri);
+ *	return(NULL);
+ *    }
+ */
+
+    /*Initialize the subset information.*/
+
+    if( subset != NULL ) {
+	
+	/*Count the subset strings.*/
+
+	for( len = 1; subset[len] != NULL; len++ ) ;
+	
+	/*Copy the subset strings.*/
+	
+	ri->ri_subset = (char**)safe_malloc((len +1)*sizeof(char*));
+	
+	for( i = 0; i < len; i++ ) {
+	    if( subset[i] != NULL ) {
+		if( (ri->ri_subset[i] = strdup(subset[i])) == NULL ) {
+		    delete_rec_info(ri);
+		    return(NULL);
+		}
+	    } else {
+		ri->ri_subset[i] = subset[i];
+	    }
+	}
+
+	ri->ri_subset[i] = NULL;
+
+    } else {
+
+	ri->ri_subset = NULL;
+    }
+    
+    return(ri);
+}
+
+static void delete_rec_info(rec_info* ri)
+{
+    if( ri != NULL ) {
+	if( ri->ri_locale != NULL ) {
+	    free(ri->ri_locale);
+	}
+/*
+ *	if( ri->ri_name != NULL ) {
+ *	    free(ri->ri_name);
+ *	}
+ */
+	if( ri->ri_subset != NULL ) {
+	    int i;
+	    for( i = 0; ri->ri_subset[i] != NULL; i++) {
+		free(ri->ri_subset[i]);
+	    }
+	    free(ri->ri_subset);
+	}
+	free(ri);
+    }
+}
+
+/*check_for_user_home-Check whether USERRECHOME has been created.*/
+
+#if 0
+static int check_for_user_home()
+{
+    char* homedir = getenv(HOME);
+    char* rechome = NULL;
+
+    if( homedir == NULL ) {
+	the_last_error = "Home environment variable HOME not set.";
+	return(-1);
+    }
+
+    rechome = (char*)safe_malloc(strlen(homedir) + strlen(USERRECHOME) + 2);
+
+    /*Form name.*/
+
+    strcpy(rechome,homedir);
+    strcat(rechome,"/");
+    strcat(rechome,USERRECHOME);
+
+    /*Create directory.*/
+
+    if( mkdir(rechome,S_IRWXU | S_IRWXG | S_IRWXO) < 0 ) {
+
+	/*If errno is EEXIST, then OK.*/
+
+	if( errno != EEXIST ) {
+	    the_last_error = "Error during creation of USERRECHOME.";
+	    free(rechome);
+	    return(-1);
+	}
+    }
+
+    free(rechome);
+
+    return(0);
+}
+#endif
+
+/*
+ * Constructor functions for making structures.
+ *
+ *    The general philosophy here is that we control all memory
+ *    in connected data structures, *except* for pen_point arrays.
+ *    There are likely to be lots and lots of points, they are likely
+ *    to come from the window system; so if we wanted to control them,
+ *    we would have to copy which would be slow. We require the client
+ *    to deal with them directly, or the client can give us permission
+ *    to delete them.
+*/
+
+/*
+ * recognizer
+*/
+
+
+recognizer make_recognizer(rec_info* rif)
+{
+    recognizer rec;
+    
+    /*Allocate it.*/
+
+    rec = (recognizer)safe_malloc(sizeof(*rec));
+    rec->recognizer_magic = REC_MAGIC;
+    rec->recognizer_version = REC_VERSION;
+    rec->recognizer_info = rif;
+    rec->recognizer_specific = NULL;
+    rec->recognizer_end_magic = REC_END_MAGIC;
+    rec->recognizer_load_state = NULL;
+    rec->recognizer_save_state = NULL;
+    rec->recognizer_load_dictionary = NULL;
+    rec->recognizer_save_dictionary = NULL;
+    rec->recognizer_free_dictionary = NULL;
+    rec->recognizer_add_to_dictionary = NULL;
+    rec->recognizer_delete_from_dictionary = NULL;
+    rec->recognizer_error = NULL;
+    rec->recognizer_set_context = NULL;
+    rec->recognizer_get_context = NULL;
+    rec->recognizer_clear = NULL;
+    rec->recognizer_get_buffer = NULL;
+    rec->recognizer_set_buffer = NULL;
+    rec->recognizer_translate = NULL;
+    rec->recognizer_get_extension_functions = NULL;
+    rec->recognizer_get_gesture_names = NULL;
+    rec->recognizer_set_gesture_action = NULL;
+    return(rec);
+}
+
+void delete_recognizer(recognizer rec)
+{
+
+    if( rec != NULL ) {
+	if( rec->recognizer_info != NULL ) {
+	    delete_rec_info(rec->recognizer_info);
+	}
+	free(rec);
+    }
+}
+
+/*
+ * rec_alternative
+*/
+
+rec_alternative* make_rec_alternative_array(u_int size)
+{
+    int i;
+    rec_alternative* ri;
+
+    ri = (rec_alternative*) safe_malloc(size * sizeof(rec_alternative));
+
+    for( i = 0; i < size; i++ ) {
+        ri[i].ra_elem.re_type = REC_NONE;
+	ri[i].ra_elem.re_result.aval = NULL;
+	ri[i].ra_elem.re_conf = 0;
+	ri[i].ra_nalter = 0;
+	ri[i].ra_next = NULL;
+    }
+
+    return(ri);    
+}
+
+rec_alternative*
+  initialize_rec_alternative(rec_alternative* ra,
+			     u_int nelem)
+{
+  if( ra != NULL ) {
+    if( (ra->ra_next = make_rec_alternative_array(nelem)) == NULL ) {
+      return(NULL);
+    }
+
+    ra->ra_nalter = nelem;
+  }
+
+  return(ra);
+}
+
+void delete_rec_alternative_array(u_int nalter,
+				  rec_alternative* ra,
+				  bool delete_points_p)
+{
+  int i;
+
+    if( ra != NULL ) {
+
+      for( i = 0; i < nalter; i++ ) {
+	cleanup_rec_element(&ra[i].ra_elem,delete_points_p);
+	
+	/*Now do the next one down the line.*/
+	
+	if( ra[i].ra_nalter > 0 ) {
+	  delete_rec_alternative_array(ra[i].ra_nalter,
+				       ra[i].ra_next,
+				       delete_points_p);
+        }
+      }
+
+      free(ra);
+    }
+}
+
+
+/*initialize_rec_element-Initialize a recognition element.*/
+
+rec_element*
+initialize_rec_element(rec_element* re,
+		       char type,
+		       u_int size,
+		       void* trans,
+		       rec_confidence conf)
+{
+    if( re != NULL ) {
+
+	re->re_type = type;
+	re->re_conf = conf;
+	re->re_result.aval = NULL;
+	
+	switch (type) {
+	    
+	  case REC_GESTURE:
+	    if( size > 0 && trans != NULL ) {
+		re->re_result.gval = 
+		     (gesture*)safe_malloc(sizeof(gesture));
+		memcpy((void*)re->re_result.gval,trans,sizeof(gesture));
+	    }
+	    break;
+	    
+	  case REC_ASCII:
+	  case REC_VAR:
+	  case REC_OTHER:
+	    if( size > 0 && trans != NULL ) {
+		re->re_result.aval = 
+		     (char*)safe_malloc((size+1)*sizeof(char));
+		memcpy((void*)re->re_result.aval,trans,size*sizeof(char));
+		re->re_result.aval[size] = '\000';
+	    }
+	    break;
+	    
+	  case REC_WCHAR:
+	    if( size > 0 && trans != NULL ) {
+		re->re_result.wval = 
+		     (wchar_t*)safe_malloc((size+1)*sizeof(wchar_t));
+		memcpy((void*)re->re_result.wval,trans,size*sizeof(wchar_t));
+		re->re_result.wval[size] = '\000';
+	    }
+	    break;
+	    
+	  case REC_CORR:
+	    if( size > 0 && trans != NULL ) {
+	      re->re_result.rcval =
+		   (rec_correlation*)safe_malloc(sizeof(rec_correlation));
+	      memcpy((void*)re->re_result.rcval,
+		     trans,
+		     sizeof(rec_correlation));
+	    }
+	    break;
+
+	  default:
+	    return(NULL);
+	}
+
+    }
+
+    return(re);
+}
+
+static void cleanup_rec_element(rec_element* re,bool delete_points_p)
+{
+  switch(re->re_type) {
+    
+  case REC_NONE:
+    break;
+    
+  case REC_ASCII:
+  case REC_VAR:
+  case REC_WCHAR:
+  case REC_OTHER:
+    free(re->re_result.aval);
+    break;
+    
+  case REC_GESTURE:
+    delete_gesture_array(1,re->re_result.gval,true);
+    break;
+
+  case REC_CORR:
+    delete_rec_correlation(re->re_result.rcval,
+			   delete_points_p);
+    break;
+    
+  }
+  
+}
+
+/*
+ * rec_correlation
+*/
+
+
+rec_correlation* 
+make_rec_correlation(char type,
+		     u_int size,
+		     void* trans,
+		     rec_confidence conf,
+		     u_int ps_size)
+{
+  rec_correlation* rc;
+
+    rc = (rec_correlation*)safe_malloc(sizeof(rec_correlation));
+
+    rc->ro_nstrokes = ps_size;
+
+    /*First initialize element.*/
+
+    if( initialize_rec_element(&(rc->ro_elem),
+			       type,
+			       size,
+			       trans,
+			       conf) == NULL ) {
+      return(NULL);
+    }
+    
+    if( (rc->ro_strokes = make_pen_stroke_array(ps_size)) == NULL ) {
+      return(NULL);
+    }
+    
+    rc->ro_start = (u_int*)safe_malloc(ps_size * sizeof(int));
+    rc->ro_stop = (u_int*)safe_malloc(ps_size * sizeof(int));
+    return(rc);
+}
+
+void delete_rec_correlation(rec_correlation* rc,bool delete_points_p)
+{
+  if( rc != NULL ) {
+
+    cleanup_rec_element(&rc->ro_elem,delete_points_p);
+
+    delete_pen_stroke_array(rc->ro_nstrokes,rc->ro_strokes,delete_points_p);
+
+    if( rc->ro_start != NULL ) {
+      free(rc->ro_start);
+    }
+
+    if( rc->ro_stop != NULL ) {
+      free(rc->ro_stop);
+    }
+
+    free(rc);
+  }
+
+}
+
+
+/*
+ * rec_fn
+*/
+
+
+rec_fn* make_rec_fn_array(u_int size)
+{
+    rec_fn* ri = (rec_fn*)safe_malloc((size + 1) * sizeof(rec_fn));
+    int i;
+
+    for( i = 0; i < size; i++ ) {
+	ri[i] = NULL;
+    }
+
+    ri[i] = NULL;
+
+    return(ri);
+}
+
+void delete_rec_fn_array(rec_fn* rf)
+{
+    if( rf != NULL ) {
+	free(rf);
+    }
+}
+
+/*
+ * pen_stroke
+*/
+
+
+pen_stroke* make_pen_stroke_array(u_int size)
+{
+    int i;
+    pen_stroke* ri;
+
+    ri = (pen_stroke*) safe_malloc(size * sizeof(pen_stroke));
+    for( i = 0; i < size; i++ ) {
+	ri[i].ps_npts = 0;
+	ri[i].ps_pts = NULL;
+	ri[i].ps_nstate = 0;
+	ri[i].ps_state = NULL;
+    }
+
+    return(ri);       
+}
+
+pen_stroke* initialize_pen_stroke(pen_stroke* ps,
+				  u_int npts,
+				  pen_point* pts,
+				  u_int nstate,
+				  u_int* trans,
+				  pen_state* state)
+{
+  if( ps != NULL ) {
+    ps->ps_npts = npts;
+    ps->ps_pts = pts;
+    ps->ps_nstate = nstate;
+    ps->ps_trans = trans;
+    ps->ps_state = state;
+  }
+  return (ps);
+}
+
+void delete_pen_stroke_array(u_int size,pen_stroke* ps,bool delete_points_p)
+{
+  int i;
+  
+    if( ps != NULL ) {
+
+      for( i = 0; i < size; i++ ) {
+
+	    if( ps[i].ps_state != NULL ) {
+		free(ps[i].ps_state);
+	    }
+
+	    if( ps[i].ps_trans != NULL ) {
+	        free(ps[i].ps_trans);
+	    }
+
+	    if( delete_points_p ) {
+		delete_pen_point_array(ps[i].ps_pts);
+	    }
+
+      }
+	
+      free(ps);
+    }
+}
+
+/*
+ * pen_point
+*/
+
+
+pen_point* make_pen_point_array(u_int size)
+{
+    pen_point* pp = (pen_point*)safe_malloc(size * sizeof(pen_point));
+    int i;
+
+    for( i = 0; i < size; i++ ) {
+	pp[i].time = 0;
+	pp[i].x = pp[i].y = 0;
+    }
+
+    return(pp);
+}
+
+void delete_pen_point_array(pen_point* pp)
+{
+    if( pp != NULL ) {
+	free(pp);
+    }
+}
+
+/*
+ * pen_state
+*/
+
+
+pen_state* make_pen_state_array(u_int size)
+{
+  int i;
+
+  pen_state* ps = (pen_state*)safe_malloc(size*sizeof(pen_state));
+  
+  for( i = 0; i < size; i++ ) {
+    ps[i].pt_button = 0;
+    ps[i].pt_pen = 0;
+    ps[i].pt_pressure = 0;
+    ps[i].pt_anglex = 0.0;
+    ps[i].pt_angley = 0.0;
+    ps[i].pt_barrelrotate = 0.0;
+  }
+
+  return(ps);
+
+}
+
+pen_state* initialize_pen_state(pen_state* ps,
+				u_short button,
+				u_short pen,
+				short pressure,
+				double anglex,
+				double angley,
+				double barrelrotate)
+{
+  if( ps != NULL ) {
+    ps->pt_button = button;
+    ps->pt_pen = pen;
+    ps->pt_pressure = pressure;
+    ps->pt_anglex = anglex;
+    ps->pt_angley = angley;
+    ps->pt_barrelrotate = barrelrotate;
+  }
+
+  return(ps);
+}
+
+void delete_pen_state_array(pen_state* ps)
+{
+  if( ps != NULL ) {
+    free(ps);
+  }
+}
+
+/*
+ * gesture 
+*/
+
+gesture*
+make_gesture_array(u_int size)
+{
+    return((gesture*)safe_malloc(size * sizeof(gesture)));
+}
+
+gesture* initialize_gesture(gesture* g,
+			    char* name,
+			    u_int nhs,
+			    pen_point* hspots,
+			    pen_rect bbox,
+			    xgesture fn,
+			    void* wsinfo)
+{
+    if( g != NULL ) {
+
+	/*We don't do points, 'cause they come from the window system.*/
+
+	g->g_nhs = nhs;
+	g->g_hspots = hspots;
+
+	g->g_name = strdup(name);
+
+	g->g_bbox.x = bbox.x;
+	g->g_bbox.y = bbox.y;
+	g->g_bbox.width = bbox.width;
+	g->g_bbox.height = bbox.height;
+	g->g_action = fn;
+	g->g_wsinfo = wsinfo;
+    }
+
+    return(g);
+}
+
+void
+delete_gesture_array(u_int size,gesture* ga,bool delete_points_p)
+{
+    int i;
+
+    if( ga != NULL ) {
+
+      for( i = 0; i < size; i++ ) {
+	
+	free(ga[i].g_name);
+	
+	if( delete_points_p ) {
+	  delete_pen_point_array(ga[i].g_hspots);
+	}
+      }
+      
+      free(ga);
+    }
+}
+
+/*
+ * copy fns for stroke buffer management.
+*/
+
+static pen_stroke* 
+copy_pen_stroke(pen_stroke* ps1,pen_stroke* ps2)
+{
+  u_int* trans = NULL;
+  pen_state* state = NULL;
+  
+  if( (trans = 
+       copy_state_trans_array(ps2->ps_nstate,
+			      ps2->ps_trans)) == NULL ) {
+    return(NULL);
+  }
+  
+  if( (state = 
+       copy_pen_state_array(ps2->ps_nstate,
+			    ps2->ps_state)) == NULL ) {
+    free(trans);
+    return(NULL);
+  }
+  
+  initialize_pen_stroke(ps1,
+			ps2->ps_npts,
+			ps2->ps_pts,
+			ps2->ps_nstate,
+			trans,
+			state);
+  return(ps1);
+
+}
+
+pen_stroke*
+ copy_pen_stroke_array(u_int nstrokes,
+		    pen_stroke* strokes)
+{
+  int i;
+  pen_stroke* ps = make_pen_stroke_array(nstrokes);
+
+  if( ps != NULL ) {
+
+    for( i = 0; i < nstrokes; i++ ) {
+
+      copy_pen_stroke(&ps[i],&strokes[i]);
+
+    }
+
+  }
+
+  return(ps);
+}
+
+pen_state*
+ copy_pen_state_array(u_int nstate,pen_state* state)
+{
+  pen_state* ps = make_pen_state_array(nstate);
+  int i;
+
+  if( ps != NULL ) {
+
+    for( i = 0; i < nstate; i++ ) {
+      
+      initialize_pen_state(&ps[i],
+			   state[i].pt_button,
+			   state[i].pt_pen,
+			   state[i].pt_pressure,
+			   state[i].pt_anglex,
+			   state[i].pt_angley,
+			   state[i].pt_barrelrotate);
+    }
+    
+  }
+
+  return(ps);
+}
+
+u_int*
+ copy_state_trans_array(u_int ntrans,u_int* trans)
+{
+  u_int* pt = (u_int*)safe_malloc(ntrans*sizeof(u_int));
+  int i;
+
+  for( i = 0; i < ntrans; i++ ) {
+    pt[i] = trans[i];
+  }
+  return(pt);
+
+}
+
+pen_stroke*
+concatenate_pen_strokes(int nstrokes1,
+			pen_stroke* strokes1,
+			int nstrokes2,
+			pen_stroke* strokes2,
+			int* nstrokes3,
+			pen_stroke** strokes3)
+{
+  int i;
+  int ns;
+  pen_stroke* ps;
+
+  /*Measure new strokes*/
+
+  ns = nstrokes1 + nstrokes2;
+
+  /*Allocate memory*/
+
+  if( (ps = make_pen_stroke_array(ns)) == NULL ) {
+    return(NULL);
+  }
+
+  /*Copy old ones into new.*/
+
+  for( i = 0; i < nstrokes1; i++ ) {
+    if( copy_pen_stroke(&ps[i],&strokes1[i]) == NULL ) {
+      delete_pen_stroke_array(ns,ps,false);
+      return(NULL);
+    }
+  }
+
+  for( ; i < ns; i++ ) {
+    if( copy_pen_stroke(&ps[i],&strokes2[i - nstrokes1]) == NULL ) {
+      delete_pen_stroke_array(ns,ps,false);
+      return(NULL);
+    }
+  }
+
+  *nstrokes3 = ns;
+  *strokes3 = ps;
+
+  return(ps);
+}
diff -urN lib/microwindows/src/demos/nxscribble/hre_api.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/hre_api.h
--- lib/microwindows/src/demos/nxscribble/hre_api.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/hre_api.h	2005-02-21 16:03:03.000000000 +0100
@@ -0,0 +1,43 @@
+/* 
+ *  hre_api.h:        User-Level API for Handwriting Recognition
+ *  Author:           James Kempf
+ *  Created On:       Mon Nov  2 14:01:25 1992
+ *  Last Modified By: James Kempf
+ *  Last Modified On: Fri Sep 23 13:50:15 1994
+ *  Update Count:     22
+ *  Copyright (c) 1994 by Sun Microsystems Computer Company
+ *  All rights reserved.
+ *  
+ *  Use and copying of this software and preparation of 
+ *  derivative works based upon this software are permitted.
+ *  Any distribution of this software or derivative works
+ *  must comply with all applicable United States export control
+ *  laws.
+ *
+ *  This software is made available as is, and Sun Microsystems
+ *  Computer Company makes no warranty about the software, its
+ *  performance, or its conformity to any specification
+ */
+
+#ifndef _HRE_API_H_
+
+#define _HRE_API_H_
+
+/*
+ * Opaque type for the recognizer. The toolkit must access through
+ * appropriate access functions.
+*/
+
+typedef void* recognizer;
+
+/*
+ * Opaque type for recognizers to implement dictionaries.
+*/
+
+typedef void* wordset;
+
+#include <hre.h>
+#include <hre_api_internal.h>
+
+
+#endif
diff -urN lib/microwindows/src/demos/nxscribble/hre_api_internal.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/hre_api_internal.h
--- lib/microwindows/src/demos/nxscribble/hre_api_internal.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/hre_api_internal.h	2005-02-21 16:03:03.000000000 +0100
@@ -0,0 +1,285 @@
+/* 
+ *  hre_api_internal.h: API functions, used by internal clients also.
+ *  Author:           James Kempf
+ *  Created On:       Tue Jan 12 12:52:27 1993
+ *  Last Modified By: James Kempf
+ *  Last Modified On: Fri Sep 23 13:50:48 1994
+ *  Update Count:     33
+ *  Copyright (c) 1994 by Sun Microsystems Computer Company
+ *  All rights reserved.
+ *  
+ *  Use and copying of this software and preparation of 
+ *  derivative works based upon this software are permitted.
+ *  Any distribution of this software or derivative works
+ *  must comply with all applicable United States export control
+ *  laws.
+ *
+ *  This software is made available as is, and Sun Microsystems
+ *  Computer Company makes no warranty about the software, its
+ *  performance, or its conformity to any specification
+ */
+
+#ifndef _HRE_API_INTERNAL_H_
+
+#define _HRE_API_INTERNAL_H_
+
+/*Need structs for return types.*/
+
+#include <hre.h>
+
+/*
+ * ADMINISTRATION
+*/
+
+/*
+ * recognizer_load - If directory is not NULL, then use it as a pathname
+ * to find the recognizer. Otherwise, use the default naming conventions
+ * to find the recognizer having file name name. The subset argument
+ * contains a null-terminated array of names for character subsets which
+ * the recognizer should translate.
+*/
+
+recognizer 
+recognizer_load(char* directory,char* name,char** subset);
+
+/*
+ * recognizer_unload - Unload the recognizer.
+*/
+
+int
+recognizer_unload(recognizer rec);
+
+/*
+ * recognizer_get_info-Get a pointer to a rec_info 
+ * giving the locale and subsets supported by the recognizer, and shared
+ * library pathname.
+*/
+
+const rec_info* 
+recognizer_get_info(recognizer rec);
+
+
+/*
+ * recognizer_manager_version-Return the version number string of the
+ * recognition manager.
+*/
+
+const char* recognizer_manager_version(recognizer rec);
+
+/*
+ * recognizer_load_state-Get any recognizer state associated with name
+ * in dir. Note that name may not be simple file name, since
+ * there may be more than one file involved. Return 0 if successful,
+ * -1 if not.
+*/
+
+int 
+recognizer_load_state(recognizer rec,char* dir,char* name);
+
+/*
+ * recognizer_save_state-Save any recognizer state to name
+ * in dir. Note that name may not be a simple file name, since
+ * there may be more than one file involved. Return 0 if successful,
+ * -1 if not.
+*/
+
+int 
+recognizer_save_state(recognizer rec,char* dir,char* name);
+
+/*
+ * recognizer_error-Return the last error message, or NULL if none.
+*/
+
+char* 
+recognizer_error(recognizer rec);
+
+/*
+ * DICTIONARIES
+*/
+
+/* recognizer_load_dictionary-Load a dictionary from the directory
+ * dir and file name. Return the dictionary pointer if successful,
+ * otherwise NULL.
+*/
+
+wordset 
+recognizer_load_dictionary(recognizer rec,char* directory,char* name);
+
+/* recoginzer_save_dictionary-Save the dictionary to the file. Return 0
+ * successful, -1 if error occurs.
+*/
+
+int 
+recognizer_save_dictionary(recognizer rec,char* dir,char* name,wordset dict);
+
+/*
+ * recognizer_free_dictionary-Free the dictionary. Return 0 if successful,
+ * -1 if error occurs.
+*/
+
+int
+recognizer_free_dictionary(recognizer rec,wordset dict);
+
+/*
+ * recognizer_add_to_dictionary-Add the word to the dictionary. Return 0
+ * if successful, -1 if error occurs.
+*/
+
+int
+recognizer_add_to_dictionary(recognizer rec,letterset* word,wordset dict);
+
+/*
+ * recognizer_delete_from_dictionary-Delete the word from the dictionary.
+ * Return 0 if successful, -1 if error occurs.
+*/
+
+int
+recognizer_delete_from_dictionary(recognizer rec,letterset* word,wordset dict);
+
+/*
+ * TRANSLATION
+*/
+
+/* recognizer_set/get_context - Set/get the recognition context for 
+ * subsequent buffering and translation. recognizer_set_context() 
+ * returns -1 if an error occurs, otherwise 0. recognizer_get_context() 
+ * returns NULL if no context has been set. The context is copied to avoid 
+ * potential memory deallocation problems.
+*/
+
+int 
+recognizer_set_context(recognizer rec,rc* rec_xt);
+rc* 
+recognizer_get_context(recognizer rec);
+
+/* recognizer_clear - Set stroke buffer to NULL and clear the context. 
+ * Returns -1 if an error occurred, otherwise 0. Both the context and the 
+ * stroke buffer are deallocated. If delete_points_p is true, delete the
+ * points also.
+*/
+
+int 
+recognizer_clear(recognizer rec,bool delete_points_p);
+
+/* recognizer_get/set_buffer - Get/set the stroke buffer. The stroke buffer 
+ * is copied to avoid potential memory allocation problems. Returns -1 if 
+ * an error occurs, otherwise 0.
+*/
+
+int 
+ recognizer_get_buffer(recognizer rec, u_int* nstrokes,pen_stroke** strokes);
+
+int 
+recognizer_set_buffer(recognizer rec,u_int nstrokes,pen_stroke* strokes);
+
+/* recognizer_translate - Copy the strokes argument into the stroke buffer and
+ * translate the buffer. If correlate_p is true, then provide stroke 
+ * correlations as well. If either nstrokes is 0 or strokes is NULL, then 
+ * just translate the stroke buffer and return the translation. Return an 
+ * array of alternative translation segmentations in the ret pointer and the 
+ * number of alternatives in nret, or NULL and 0 if there is no translation. 
+ * The direction of segmentation is as specified by the rc_direction field in 
+ * the buffered recognition context. Returns -1 if an error occurred, 
+ * otherwise 0. 
+*/
+
+int 
+recognizer_translate(recognizer rec,
+		     u_int nstrokes,
+		     pen_stroke* strokes,
+		     bool correlate_p,
+		     int* nret,
+		     rec_alternative** ret);
+
+/*
+ * recognizer_get_extension_functions-Return a null terminated array
+ * of functions providing extended functionality. Their interfaces
+ * will change depending on the recognizer.
+*/
+
+rec_fn* 
+recognizer_get_extension_functions(recognizer rec);
+
+
+/*
+ * GESTURE SUPPORT
+*/
+
+/*
+ * recognizer_get_gesture_names - Return a null terminated array of
+ * character strings containing the gesture names.
+*/
+
+char** 
+recognizer_get_gesture_names(recognizer rec);
+
+/*
+ * recognizer_set_gesture_action-Set the action function associated with the 
+ *  name.
+*/
+
+xgesture 
+recognizer_set_gesture_action(recognizer rec,
+			      char* name,
+			      xgesture fn,
+			      void* wsinof);
+
+/*
+ * The following functions are for deleting data structures returned
+ *   by the API functions.
+*/
+
+
+void 
+delete_rec_alternative_array(u_int nalter,
+			     rec_alternative* ra,
+			     bool delete_points_p);
+
+void 
+delete_rec_correlation(rec_correlation* corr,
+		       bool delete_points_p);
+
+/*
+ * These are used by clients to create arrays for passing to API
+ *  functions.
+*/
+
+pen_stroke* 
+make_pen_stroke_array(u_int size);
+pen_stroke* 
+initialize_pen_stroke(pen_stroke* ps,
+		      u_int npts,
+		      pen_point* pts,
+		      u_int nstate,
+		      u_int* trans,
+		      pen_state* state);
+void 
+delete_pen_stroke_array(u_int size,pen_stroke* ps,bool delete_points_p);
+
+pen_point* 
+make_pen_point_array(u_int size);
+void 
+delete_pen_point_array(pen_point* pp);
+
+pen_stroke*
+copy_pen_stroke_array(u_int nstrokes,pen_stroke* strokes);
+pen_state*
+copy_pen_state_array(u_int nstate,pen_state* state);
+u_int*
+copy_state_trans_array(u_int ntrans,u_int* trans);
+
+pen_state* 
+make_pen_state_array(u_int size);
+pen_state* 
+initialize_pen_state(pen_state* ps,
+		     u_short button,
+		     u_short pen,
+		     short pressure,
+		     double anglex,
+		     double angley,
+		     double barrelrotate);
+void 
+delete_pen_state_array(pen_state* ps);
+
+#endif
+
diff -urN lib/microwindows/src/demos/nxscribble/hre_internal.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/hre_internal.h
--- lib/microwindows/src/demos/nxscribble/hre_internal.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/hre_internal.h	2005-02-21 16:03:03.000000000 +0100
@@ -0,0 +1,286 @@
+/* 
+ *  hre_internal.h:   Internal Interface for Recognizer.
+ *  Author:           James Kempf
+ *  Created On:       Thu Nov  5 10:54:18 1992
+ *  Last Modified By: James Kempf
+ *  Last Modified On: Fri Sep 23 13:51:15 1994
+ *  Update Count:     99
+ *  Copyright (c) 1994 by Sun Microsystems Computer Company
+ *  All rights reserved.
+ *  
+ *  Use and copying of this software and preparation of 
+ *  derivative works based upon this software are permitted.
+ *  Any distribution of this software or derivative works
+ *  must comply with all applicable United States export control
+ *  laws.
+ *
+ *  This software is made available as is, and Sun Microsystems
+ *  Computer Company makes no warranty about the software, its
+ *  performance, or its conformity to any specification
+ */
+
+#ifndef _HRE_INTERNAL_H_
+
+#define _HRE_INTERNAL_H_
+
+/*Avoids forward reference problem.*/
+
+#define wordset void*
+
+#include <hre.h>
+
+#undef wordset
+
+#define recognizer void*
+
+/*
+ * Internal view of wordset. The recognition engine uses this view to
+ * maintain information about which recognizer object this wordset
+ * belongs to, which file (in case it needs to be saved), and internal
+ * data structures.
+*/
+
+typedef struct _wordset {
+	char* ws_pathname;		/*Path name to word set file.*/
+	recognizer ws_recognizer;	/*To whom it belongs.*/
+	void* ws_internal;		/*Internal data structures.*/
+} *wordset;
+
+#undef recognizer
+
+/*
+ * Internal view of the recognizer struct. This view is only available
+ * to OEM clients who implement a recognizer shared library. Clients
+ * of the recognizer itself see it as an opaque data type. The struct
+ * contains a function pointer for each function in the client API.
+*/
+
+struct _Recognizer {
+	u_int recognizer_magic;
+/* ari */
+/* 	const char* recognizer_version;  */
+        char* recognizer_version; 
+
+	rec_info* recognizer_info;
+	void* recognizer_specific;
+	int
+		(*recognizer_load_state)(
+			struct _Recognizer*,
+			char*, char*);
+/*			char* dir,
+			char* name);
+*/
+	int
+		(*recognizer_save_state)(
+			struct _Recognizer*,
+			char*, char*);
+/*			char* dir,
+			char* name); 
+*/
+	char*
+		(*recognizer_error)(
+			struct _Recognizer*);
+	wordset
+		(*recognizer_load_dictionary)(
+/*			struct _Recognizer* rec,
+			char* directory,
+			char* name);
+*/
+			struct _Recognizer*,
+                        char*, char*);
+	int
+		(*recognizer_save_dictionary)(
+/*			struct _Recognizer* rec,
+			char* directory,
+			char* name,
+			wordset dict);
+*/
+			struct _Recognizer*,
+                        char*, char*, wordset);
+
+	int
+	  	(*recognizer_free_dictionary)(
+/*			struct _Recognizer* rec,
+			wordset dict);
+*/
+			struct _Recognizer*,
+                        wordset);
+	int
+	  	(*recognizer_add_to_dictionary)(
+/*			struct _Recognizer* rec,
+			letterset* word,
+			wordset dict);
+*/
+			struct _Recognizer*,
+                        letterset*, wordset);
+	int
+	  	(*recognizer_delete_from_dictionary)(
+/*			struct _Recognizer* rec,
+			letterset* word,
+			wordset dict);
+*/
+			struct _Recognizer*,
+                        letterset*, wordset);
+	int
+	 (*recognizer_set_context)(
+/*		struct _Recognizer* rec,
+		rc* rec_xt);
+*/
+			struct _Recognizer*,rc*);
+	rc*
+	 (*recognizer_get_context)(
+/*		struct _Recognizer* rec);
+*/
+			struct _Recognizer*);
+				   
+	int
+	 (*recognizer_clear)(
+/*		struct _Recognizer* rec,
+		bool delete_ponts_p);
+*/
+			struct _Recognizer*, bool);
+	int
+	 (*recognizer_get_buffer)(
+/*		struct _Recognizer* rec,
+		u_int* nstrokes,
+		pen_stroke** strokes);
+*/
+			struct _Recognizer*, u_int*, pen_stroke**);
+
+	int
+	 (*recognizer_set_buffer)(
+/*		struct _Recognizer* rec,
+		u_int nstrokes,
+		pen_stroke* strokes);
+*/
+			struct _Recognizer*, u_int, pen_stroke*);
+	int
+	 (*recognizer_translate)(
+/*		struct _Recognizer* rec,
+		u_int nstrokes,
+		pen_stroke* strokes,
+		bool correlate_p,
+		int* nret,
+		rec_alternative** ret);
+*/
+			struct _Recognizer*, u_int, pen_stroke*,
+			bool, int*, rec_alternative**);
+	rec_fn*
+	 (*recognizer_get_extension_functions)(
+		struct _Recognizer*);
+	char**
+		(*recognizer_get_gesture_names)(
+			struct _Recognizer*);
+	xgesture
+		(*recognizer_set_gesture_action)(
+			struct _Recognizer*,
+/*			char* name,
+			xgesture fn,
+			void* wsinfo);
+*/
+                        char*, xgesture, void*);
+	u_int recognizer_end_magic; 
+};
+
+typedef struct _Recognizer* recognizer;
+
+/*
+ * recognizer_internal_initialize - Allocate and initialize the recognizer 
+ * object. The recognition shared library has the responsibility for filling
+ * in all the function pointers for the recognition functions. This
+ * function must be defined as a global function within the shared
+ * library, so it can be accessed using dlsym() when the recognizer
+ * shared library is loaded. It returns NULL if an error occured and
+ * sets errno to indicate what.
+*/
+
+typedef recognizer (*recognizer_internal_initialize)(rec_info* ri);
+
+/*Function header definition for recognizer internal initializer.*/
+
+/* ari -- This is used in cmu_recognizer.c. */
+
+#define RECOGNIZER_INITIALIZE(_a) \
+        recognizer __recognizer_internal_initialize(rec_info* _a)
+
+/*
+ * recognizer_internal_finalize - Deallocate and deinitialize the recognizer
+ * object. If the recognizer has allocated any additional storage, it should
+ * be deallocated as well. Returns 0 if successful, -1 if the argument
+ * wasn't a recognizer or wasn't a recognizer handled by this library.
+*/
+
+typedef int (*recognizer_internal_finalize)(recognizer r);
+
+#define RECOGNIZER_FINALIZE(_a) \
+       int __recognizer_internal_finalize(recognizer _a)
+
+
+/*
+ * The following are for creating HRE structures.
+ */
+
+recognizer 
+make_recognizer(rec_info* ri);
+void 
+delete_recognizer(recognizer rec);
+
+rec_alternative* 
+make_rec_alternative_array(u_int size);
+rec_correlation* 
+make_rec_correlation(char type,
+		     u_int size,
+		     void* trans,
+		     rec_confidence conf,
+		     u_int ps_size);
+
+rec_fn* 
+make_rec_fn_array(u_int size);
+void 
+delete_rec_fn_array(rec_fn* rf);
+
+gesture* 
+initialize_gesture(gesture* g,
+		   char* name,
+		   u_int nhs,
+		   pen_point* hspots,
+		   pen_rect bbox,
+		   xgesture cback,
+		   void* wsinfo);
+gesture* 
+make_gesture_array(u_int size);
+void 
+delete_gesture_array(u_int size,gesture* ga,bool delete_points_p);
+
+pen_stroke*
+concatenate_pen_strokes(int nstrokes1,
+			pen_stroke* strokes1,
+			int nstrokes2,
+			pen_stroke* strokes2,
+			int* nstrokes3,
+			pen_stroke** strokes3);
+
+rec_alternative*
+initialize_rec_alternative(rec_alternative* ra,u_int nelem);
+rec_element*
+initialize_rec_element(rec_element* re,
+		       char type,
+		       u_int size,
+		       void* trans,
+		       rec_confidence conf);
+/*
+ * Pathnames, etc.
+*/
+
+/* these going to be handled in the makefile, for portability */
+/* #define REC_DEFAULT_HOME_DIR   "/udir/rapkin/vb/hre.ultrix/lib/recognizers" */
+/* #define REC_DEFAULT_USER_DIR	".recognizers" */
+
+#define REC_DEFAULT_LOCALE  	"C"
+#define RECHOME			"RECHOME"
+#define LANG			"LANG"
+
+#include <hre_api_internal.h>
+
+#endif
+
diff -urN lib/microwindows/src/demos/nxscribble/letters.cl /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/letters.cl
--- lib/microwindows/src/demos/nxscribble/letters.cl	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/letters.cl	2005-02-21 16:03:03.000000000 +0100
@@ -0,0 +1,955 @@
+36 classes
+a
+b
+c
+d
+e
+f
+g
+h
+i
+j
+k
+l
+m
+n
+o
+p
+q
+r
+s
+t
+u
+v
+w
+x
+y
+z
+A
+B
+N
+P
+R
+S
+U
+V
+W
+X
+ V 12    0.399646 -0.901023 68.3035 0.853626 45.3077 0.985601 0.0577468 108.794 -1.7641 5.05968 6.51905 0.313636
+ M 12 12
+ 0.252364 0.122096 -3.5644 -0.0892954 1.67161 0.0128568 -0.00446271 -5.93004 1.85371 1.28053 3.68032 -0.0247525
+ 0 0.0604855 -1.47857 -0.0455797 1.11245 0.00642619 -0.00977233 -2.43846 0.961169 0.748691 2.03279 -0.00418033
+ 0 0 1709.91 1.94678 1004.54 -0.876742 14.6047 2607.49 -28.7349 23.6491 -22.3418 3.25618
+ 0 0 0 0.0560832 -1.33471 -0.0090991 0.0136832 3.74867 -0.378436 -0.23639 -0.403897 -0.0169437
+ 0 0 0 0 707.369 -0.207999 8.21991 1484.2 -2.74835 23.6055 -1.57592 2.8232
+ 0 0 0 0 0 0.0038999 0.000328831 -1.00935 0.0956826 0.116303 0.224319 0.0070438
+ 0 0 0 0 0 0 0.27392 22.2565 -0.900239 -0.830305 -2.90493 -0.00931034
+ 0 0 0 0 0 0 0 4123.04 -6.75052 94.9037 110.282 6.55017
+ 0 0 0 0 0 0 0 0 43.1649 52.3501 131.814 1.11174
+ 0 0 0 0 0 0 0 0 0 73.4378 175.718 2.35503
+ 0 0 0 0 0 0 0 0 0 0 437.382 4.73112
+ 0 0 0 0 0 0 0 0 0 0 0 0.160455
+ V 12    5.36574 -2.40819 1.04612 114.77 -0.517563 28.1487 -4.92446 -0.340564 -1.46704 8.21809 -2.18899 31.972
+ V 12    0.154076 0.980119 60.408 0.965168 35.6989 -0.0173768 0.990109 206.82 -14.0522 15.8188 17.4801 0.523333
+ M 12 12
+ 0.135378 -0.0255002 -1.38321 -0.018171 0.504943 0.080105 0.00160845 -4.20524 -1.01446 -0.0653353 -1.28068 -0.00485185
+ 0 0.00527446 0.290905 0.00276587 -0.242418 -0.0142026 -0.000362804 0.553495 0.129869 0.0227955 0.306975 0.00188893
+ 0 0 394.828 1.24298 186.955 -5.91599 -0.228183 1269.07 10.6292 5.84897 2.67133 0.896392
+ 0 0 0 0.0286294 0.888624 -0.0460479 0.00154784 6.01879 0.296226 0.0248924 -0.49967 -0.0018663
+ 0 0 0 0 189.275 -3.41701 -0.112526 786.651 13.0278 -4.27161 -58.5574 0.368262
+ 0 0 0 0 0 0.173747 0.00462184 -21.619 -0.0402202 -0.00820824 0.584956 -0.00252116
+ 0 0 0 0 0 0 0.000692129 -0.573892 0.053466 0.0141727 -0.0345009 -0.000433994
+ 0 0 0 0 0 0 0 4540.4 87.4294 6.41814 -109.319 2.80201
+ 0 0 0 0 0 0 0 0 35.9685 -1.08454 9.01869 0.17514
+ 0 0 0 0 0 0 0 0 0 2.24012 2.54924 0.00104982
+ 0 0 0 0 0 0 0 0 0 0 51.4081 0.1368
+ 0 0 0 0 0 0 0 0 0 0 0 0.0126
+ V 12    14.4493 26.856 0.200203 132.203 -0.228309 -1.5976 49.8838 -0.0787449 -7.54233 31.0478 -6.10292 -44.2283
+ V 12    -0.51548 -0.699395 64.3271 0.866707 33.7348 0.348184 0.924161 109.692 5.16378 5.64044 3.15367 0.342222
+ M 12 12
+ 0.526885 0.238904 0.741471 0.0575203 -1.142 0.0632321 -0.0239155 4.30394 2.20899 1.6966 5.54289 0.00462132
+ 0 0.679258 14.3878 -0.0436242 6.13672 0.093463 -0.0275413 27.9816 2.19728 2.32334 7.0296 0.0193951
+ 0 0 2719.19 -3.82265 1433.48 14.616 -6.0784 4436.88 44.0248 43.4769 111.576 3.39087
+ 0 0 0 0.0347512 -1.27624 -0.0478862 0.0190366 -6.34297 0.0623548 -0.0584682 0.0719218 -0.00700955
+ 0 0 0 0 823.682 6.28675 -2.58719 2291.74 14.1173 15.8258 38.1371 1.97308
+ 0 0 0 0 0 0.187435 -0.0795747 23.738 0.534235 0.406735 1.12765 0.0279421
+ 0 0 0 0 0 0 0.0348195 -9.87237 -0.203084 -0.134819 -0.361028 -0.0106644
+ 0 0 0 0 0 0 0 7315.45 91.749 89.9288 238.339 5.20584
+ 0 0 0 0 0 0 0 0 12.0452 10.6773 32.721 0.0699095
+ 0 0 0 0 0 0 0 0 0 11.4586 30.3658 0.105709
+ 0 0 0 0 0 0 0 0 0 0 94.3382 0.192381
+ 0 0 0 0 0 0 0 0 0 0 0 0.00915556
+ V 12    -16.2099 -9.5096 1.39521 107.291 -0.846288 6.62733 59.1719 -0.441533 2.12512 12.892 -4.48685 45.1446
+ V 12    0.124989 0.989823 57.4806 0.95813 38.17 -0.0198691 0.990931 164.817 -7.34595 9.40091 10.3519 0.423333
+ M 12 12
+ 0.0408616 -0.00537338 -0.701603 0.00639396 -0.997237 0.0231348 0.000294168 -1.16583 -0.277993 0.0613462 -0.0185456 -0.0043116
+ 0 0.000790587 0.21694 -0.000973071 0.199548 -0.00515744 -9.54895e-05 0.548335 0.0414939 -0.00582608 -0.00387619 0.000622278
+ 0 0 537.835 0.559126 382.301 -3.56392 -0.362759 1594.6 -11.3773 10.1273 -11.7212 0.853839
+ 0 0 0 0.0624367 1.87448 0.0212207 0.00402034 3.36734 -0.327806 0.0471617 -0.212145 -0.00632178
+ 0 0 0 0 444.483 -4.17437 -0.41432 1012.88 -48.3532 -2.28018 -9.59507 -0.324902
+ 0 0 0 0 0 0.156409 0.0152144 -5.53488 -0.0291227 0.218029 -0.151032 0.0188099
+ 0 0 0 0 0 0 0.00253481 -0.249934 0.0543282 0.0291327 -0.0285543 0.00200127
+ 0 0 0 0 0 0 0 5112.2 -9.15045 46.7876 -42.0839 3.60397
+ 0 0 0 0 0 0 0 0 38.1712 3.28523 11.9653 0.0910594
+ 0 0 0 0 0 0 0 0 0 1.33038 0.175394 0.0756697
+ 0 0 0 0 0 0 0 0 0 0 9.60588 -0.0773521
+ 0 0 0 0 0 0 0 0 0 0 0 0.0108
+ V 12    9.24202 18.8968 0.206127 123.855 -0.217878 -3.3918 52.5601 -0.0346533 -4.24773 16.4745 -3.1243 9.44457
+ V 12    -0.66484 -0.723315 73.4083 1.03953 51.0116 0.0579574 0.993277 154.477 11.0187 11.5011 8.31685 0.495556
+ M 12 12
+ 0.209688 -0.143459 1.65727 0.0364763 0.838139 -0.0321871 0.00343876 -0.0446194 0.218527 0.0765792 1.1537 0.0433305
+ 0 0.103547 -1.17655 -0.0211057 -0.52589 0.0248506 -0.00223118 -0.1355 -0.128449 -0.0055948 -0.827045 -0.0264364
+ 0 0 171.011 1.1495 126.411 -0.78815 -0.0765513 281.112 2.55213 -2.84588 -9.37371 -0.00313091
+ 0 0 0 0.0400323 2.28148 -0.00958874 0.00124195 1.46879 0.0393459 -0.150005 0.035281 -0.00154421
+ 0 0 0 0 201.337 -1.60849 -0.0180167 111.512 0.708294 -10.884 10.0211 -0.948075
+ 0 0 0 0 0 0.0900129 -0.00149255 1.06505 -0.00653656 0.0100605 0.00938159 0.0316957
+ 0 0 0 0 0 0 0.000360977 0.1418 0.00230959 0.00535118 -0.018936 0.000652201
+ 0 0 0 0 0 0 0 1347.56 1.2232 8.67589 -144.873 1.3946
+ 0 0 0 0 0 0 0 0 0.338433 0.393695 1.26028 0.0711067
+ 0 0 0 0 0 0 0 0 0 2.45452 0.706677 0.152416
+ 0 0 0 0 0 0 0 0 0 0 43.7868 0.32073
+ 0 0 0 0 0 0 0 0 0 0 0 0.0334222
+ V 12    -19.1726 -9.58074 0.532993 132.408 -0.0899372 1.46136 63.9953 -0.340856 4.90785 27.0273 -8.31652 -0.835639
+ V 12    -0.962645 -0.21878 77.6236 1.01662 73.2855 -0.529572 0.842977 102.924 1.81595 3.3993 1.87967 0.243333
+ M 12 12
+ 0.0214607 -0.0624866 1.7544 0.0137475 0.295463 -0.00271355 -0.00104713 2.35578 0.0234857 -0.0725227 0.0336242 0.00420961
+ 0 0.207583 -8.50149 -0.0576057 -4.39746 -0.00806749 -0.00696427 -11.0449 -0.126378 0.0910634 -0.0833511 -0.0136498
+ 0 0 1642.25 8.33022 1534.27 6.17653 4.02039 1841.63 19.6411 -23.2505 -31.8406 -0.0720389
+ 0 0 0 0.0801228 7.47494 0.0599722 0.0404192 8.49542 0.156863 -0.340109 -0.324413 -0.0060077
+ 0 0 0 0 1544.12 6.2896 3.99783 1681.32 17.0958 -15.9198 -34.524 -0.373372
+ 0 0 0 0 0 0.0553412 0.0370098 6.09849 0.131853 -0.265781 -0.300745 -0.00807496
+ 0 0 0 0 0 0 0.0251418 4.00374 0.0928861 -0.187084 -0.202364 -0.00511327
+ 0 0 0 0 0 0 0 2126.9 22.3809 -19.1556 -28.0063 0.261188
+ 0 0 0 0 0 0 0 0 0.450451 -0.617195 -0.601283 -0.00618568
+ 0 0 0 0 0 0 0 0 0 3.8771 2.02737 0.063605
+ 0 0 0 0 0 0 0 0 0 0 2.09952 0.0599972
+ 0 0 0 0 0 0 0 0 0 0 0 0.003
+ V 12    -24.6065 -5.48567 0.618253 125.26 0.0826266 -17.0863 48.7782 -0.359807 0.720456 8.29677 -3.10104 47.2145
+ V 12    -0.675943 -0.727808 59.9845 0.95858 20.7237 0.419092 0.883771 144.278 10.1362 11.1408 11.3379 0.455556
+ M 12 12
+ 0.0742157 -0.0580838 6.286 -0.025757 0.728887 0.0552694 -0.0251278 16.2631 0.280223 0.289918 -0.133506 0.0343108
+ 0 0.046352 -5.03816 0.0228141 -0.426471 -0.0553798 0.0263941 -13.4269 -0.198483 -0.218938 0.149853 -0.0269771
+ 0 0 1223.7 -1.65129 214.798 3.0112 -1.88517 3167.39 74.9078 36.8127 -48.8185 5.81546
+ 0 0 0 0.0362986 0.731007 -0.0879153 0.0462144 -6.56004 -0.668556 -0.076832 0.314619 -0.0197625
+ 0 0 0 0 156.76 -2.16626 1.16504 399.983 12.5268 10.0842 -13.2323 1.12588
+ 0 0 0 0 0 0.297582 -0.162241 13.9218 0.721033 0.0586547 -0.843902 0.0397837
+ 0 0 0 0 0 0 0.0922086 -8.11511 -0.438964 -0.00440702 0.536478 -0.0191563
+ 0 0 0 0 0 0 0 8562.06 223.989 90.9921 -167.622 14.8988
+ 0 0 0 0 0 0 0 0 34.2048 3.23141 -13.2125 0.706952
+ 0 0 0 0 0 0 0 0 0 1.70576 -1.17382 0.228729
+ 0 0 0 0 0 0 0 0 0 0 23.422 0.0554354
+ 0 0 0 0 0 0 0 0 0 0 0 0.0524222
+ V 12    -17.7135 -6.58129 1.15589 120.376 -0.834714 10.8803 57.2821 -0.352796 4.1747 22.3618 -6.5589 11.1521
+ V 12    0.0284837 0.779287 70.4111 1.06989 66.6917 0.485469 0.872417 131.577 -0.381 7.22736 11.1916 0.321111
+ M 12 12
+ 0.117821 0.592994 -4.99679 -0.0169569 -2.21372 0.00534711 -0.00331103 -1.04189 -1.32577 -0.865289 -2.72811 -0.00171503
+ 0 3.40928 -33.857 -0.103032 -20.1672 0.0345554 -0.0223577 -10.1579 -7.04737 -4.78343 -15.0494 0.00212784
+ 0 0 875.551 -0.126588 819.297 -0.409428 0.356016 1686.49 31.2776 77.4361 174.347 2.50745
+ 0 0 0 0.0287095 -0.585397 -0.0222285 0.0130025 -2.64512 0.411786 0.11636 0.68087 -0.00831696
+ 0 0 0 0 838.983 -0.390967 0.35355 1828.86 -11.1376 61.529 118.278 2.77865
+ 0 0 0 0 0 0.0212206 -0.0127076 -1.28228 -0.0682095 -0.138327 -0.519435 -0.000491028
+ 0 0 0 0 0 0 0.00765406 1.13337 0.0271445 0.0980145 0.331866 0.0011215
+ 0 0 0 0 0 0 0 5605.64 -83.0648 149.629 174.417 10.1295
+ 0 0 0 0 0 0 0 0 51.1137 7.33029 26.6304 -0.252978
+ 0 0 0 0 0 0 0 0 0 12.1246 28.4922 0.325419
+ 0 0 0 0 0 0 0 0 0 0 82.0476 0.349949
+ 0 0 0 0 0 0 0 0 0 0 0 0.0228889
+ V 12    3.54825 12.3942 -0.0871734 134.992 0.338007 12.1843 41.0796 -0.0702678 -1.03756 11.2804 -2.00771 9.85807
+ V 12    0.142394 0.749947 60.5848 1.47216 59.0054 0.0430692 0.993284 62.3978 -1.04001 1.3742 2.72956 0.103333
+ M 12 12
+ 0.308103 0.261259 7.97119 -0.0414303 7.9881 0.00573119 -0.00281468 8.03354 -0.872265 0.680944 1.28981 0.00217198
+ 0 3.44762 -42.5062 0.151165 -30.0003 -0.289186 0.0233989 -55.1187 3.62687 -4.177 -13.0798 -0.0541821
+ 0 0 2606.31 -4.45021 2321.94 -1.55401 -0.588584 2901.91 -163.752 171.483 472.748 2.65047
+ 0 0 0 0.0340459 -3.74047 -0.00427718 0.00352902 -5.19429 0.341379 -0.350779 -0.91562 0.000758548
+ 0 0 0 0 2097.22 -1.87183 -0.482634 2557.21 -138.682 144.451 392.014 2.27762
+ 0 0 0 0 0 0.103389 -0.000593543 -1.22956 0.154691 -0.170274 -0.514306 -0.00300831
+ 0 0 0 0 0 0 0.00039423 -0.697956 0.0454853 -0.0482203 -0.134356 -0.000181723
+ 0 0 0 0 0 0 0 3258.65 -189.33 199.056 554.67 3.02944
+ 0 0 0 0 0 0 0 0 14.4468 -14.75 -41.8572 -0.204229
+ 0 0 0 0 0 0 0 0 0 15.3284 43.8062 0.21751
+ 0 0 0 0 0 0 0 0 0 0 127.6 0.633456
+ 0 0 0 0 0 0 0 0 0 0 0 0.0048
+ V 12    4.79584 8.7641 0.735153 182.099 -0.115306 -3.53472 46.407 -0.35639 -1.41119 3.93101 -0.744261 43.2702
+ V 12    0.160005 0.862107 77.6537 1.02558 69.5941 -0.527115 0.839564 105.517 -2.75746 4.11773 4.40617 0.224444
+ M 12 12
+ 0.222286 0.0926897 20.6447 0.119967 19.5034 0.130899 0.0783581 24.756 -0.785712 0.807423 1.90801 0.0263218
+ 0 0.858235 -4.04485 0.1335 -0.247198 0.160607 0.129107 -10.3277 1.91811 -2.12849 -4.50451 -0.0134242
+ 0 0 3605.14 11.9405 3002.93 9.4556 5.20846 4583.17 -158.138 99.0518 214.227 2.4737
+ 0 0 0 0.106184 10.19 0.101605 0.0661116 13.4068 -0.297454 0.132366 0.326078 0.00605346
+ 0 0 0 0 2629.93 9.15666 5.14124 3790.2 -138.243 98.4729 226.571 2.50477
+ 0 0 0 0 0 0.10828 0.0704452 9.99985 -0.205923 0.195451 0.525073 0.00926354
+ 0 0 0 0 0 0 0.0472553 5.23817 -0.0399084 0.0111075 0.102485 0.00489543
+ 0 0 0 0 0 0 0 5894.27 -209.743 131.519 289.369 3.23977
+ 0 0 0 0 0 0 0 0 14.9704 -12.9181 -32.2227 -0.123639
+ 0 0 0 0 0 0 0 0 0 14.3419 34.209 0.156465
+ 0 0 0 0 0 0 0 0 0 0 90.1727 0.336479
+ 0 0 0 0 0 0 0 0 0 0 0 0.00722222
+ V 12    6.07624 13.2154 0.968336 130.116 -0.265711 -20.0093 41.8845 -0.402123 -2.26101 9.20482 -1.90429 30.0385
+ V 12    -0.139206 0.970963 75.3378 0.792136 53.976 0.130817 0.983367 128.244 -4.83599 6.06693 5.52288 0.272222
+ M 12 12
+ 0.322467 0.0632006 21.4612 -0.0427538 14.5986 0.175824 -0.0203291 40.2196 -0.327818 0.511587 -1.6507 0.0276585
+ 0 0.018208 4.24892 -0.00396177 3.01343 0.0334761 -0.00191779 7.9657 0.0574387 0.0846374 -0.443248 0.00554894
+ 0 0 5409.92 15.6406 5211.57 3.44051 -0.244149 6893.41 248.104 97.4488 230.443 7.73058
+ 0 0 0 0.120019 19.4141 -0.0609222 0.00991189 11.7582 1.58015 0.29151 2.02326 0.0263036
+ 0 0 0 0 5300.28 -0.548623 0.295887 6112.12 290.17 98.8086 315.795 7.89303
+ 0 0 0 0 0 0.140216 -0.016406 11.3767 -0.505904 0.169657 -1.51842 0.00563195
+ 0 0 0 0 0 0 0.00267945 -1.1164 0.0954685 -0.0216125 0.126778 -0.000129618
+ 0 0 0 0 0 0 0 10035.9 176.158 118.399 65.3093 9.45884
+ 0 0 0 0 0 0 0 0 32.5718 3.74829 32.9772 0.313202
+ 0 0 0 0 0 0 0 0 0 2.91776 6.12705 0.190834
+ 0 0 0 0 0 0 0 0 0 0 60.1728 0.404189
+ 0 0 0 0 0 0 0 0 0 0 0 0.0149556
+ V 12    -0.550858 15.5455 1.2347 101.668 -0.65126 -0.578875 50.2244 -0.375502 -3.12698 13.5775 -3.01742 12.8411
+ V 12    0.0944759 0.768043 78.7181 0.919109 73.4364 0.601519 0.793622 108.023 1.46695 4.00275 4.45712 0.233333
+ M 12 12
+ 0.0910845 0.173548 -0.509415 -0.0527325 1.9364 0.0468846 -0.038293 -2.88552 -0.0124118 -0.418227 -1.27789 0.00451528
+ 0 1.51957 -49.1981 -0.041992 -36.0649 0.0778583 -0.065024 -70.7485 -0.128134 -4.4807 -12.6754 -0.0142988
+ 0 0 2506.12 1.34749 2079.5 -2.36516 1.90405 3399.06 18.9027 164.371 441.063 1.13322
+ 0 0 0 0.0709515 -0.56695 -0.0542858 0.0435628 3.33205 -0.122251 0.0787093 0.314885 -0.00185947
+ 0 0 0 0 1845.82 -0.560872 0.472882 2706.37 41.0083 121.121 336.896 0.991502
+ 0 0 0 0 0 0.045548 -0.0365564 -4.47208 0.0685009 -0.178544 -0.643368 0.000150598
+ 0 0 0 0 0 0 0.0294938 3.62068 -0.0508754 0.150583 0.542472 -8.70188e-05
+ 0 0 0 0 0 0 0 4764.12 -13.184 242.833 624.742 1.74438
+ 0 0 0 0 0 0 0 0 17.0916 -2.60429 3.03692 -0.130918
+ 0 0 0 0 0 0 0 0 0 15.366 37.727 0.0815725
+ 0 0 0 0 0 0 0 0 0 0 107.68 0.157028
+ 0 0 0 0 0 0 0 0 0 0 0 0.0032
+ V 12    1.11745 9.3851 0.490389 116.268 0.0719881 14.7767 35.441 -0.248769 -0.0785579 8.78678 -2.11794 15.4082
+ V 12    -0.0412624 -0.645221 65.8038 0.715833 48.3801 0.994541 0.0143255 166.094 -4.32553 11.2014 16.581 0.403333
+ M 12 12
+ 0.34227 0.0409384 -4.78292 -0.064911 -0.367605 -0.00266621 0.0386519 -24.589 0.612188 -0.845324 -3.26736 -0.042786
+ 0 1.89562 17.9404 0.100465 12.2207 -0.0172222 0.00100917 48.7529 6.6873 5.10884 15.3968 -0.0128018
+ 0 0 1293.75 7.78743 669.59 -0.0114715 -2.69192 4453.54 -188.434 103.456 195.417 3.41971
+ 0 0 0 0.0792974 2.6238 -0.000218489 -0.0320352 28.106 -0.86687 0.71903 1.80943 0.0180314
+ 0 0 0 0 422.256 -0.0444246 -1.23763 2194.25 -83.5181 53.0198 84.6088 1.88262
+ 0 0 0 0 0 0.000286587 0.00239793 0.336021 -0.123796 -0.0312811 -0.106129 0.0004618
+ 0 0 0 0 0 0 0.0958558 -4.65369 -0.519935 -0.0526964 -0.0898188 -0.0208584
+ 0 0 0 0 0 0 0 16089.8 -762.441 352.067 689.085 12.2321
+ 0 0 0 0 0 0 0 0 102.668 8.26656 49.201 -0.603818
+ 0 0 0 0 0 0 0 0 0 20.0053 54.9071 0.193066
+ 0 0 0 0 0 0 0 0 0 0 177.323 0.303564
+ 0 0 0 0 0 0 0 0 0 0 0 0.0192
+ V 12    0.648045 5.2073 -0.163197 99.0039 0.227983 32.8841 -9.46232 0.0181511 -2.54893 17.2342 -3.4923 -26.7363
+ V 12    -0.1874 -0.95079 70.2905 0.967337 68.0767 0.541411 -0.836815 164.493 -0.415279 6.94474 8.99813 0.336667
+ M 12 12
+ 0.515341 -0.119225 1.0335 -0.00528176 3.23902 0.0670906 0.0446989 -10.4248 0.465985 -0.535481 -1.34177 -0.0215909
+ 0 0.0325686 0.555946 0.00206988 -0.0949028 -0.0156765 -0.0107281 3.81932 -0.104879 0.128793 0.35817 0.00426698
+ 0 0 1688.26 2.5937 1680.51 -0.861985 -0.397562 3641.26 5.92135 -11.0336 -50.788 0.324024
+ 0 0 0 0.0443067 2.67359 -0.0389861 -0.0228715 6.97647 0.105464 0.136984 0.515504 -9.64461e-05
+ 0 0 0 0 1694.09 -0.717197 -0.291714 3546.68 7.35756 -11.7672 -56.2338 0.268375
+ 0 0 0 0 0 0.0435451 0.0262955 -4.29636 -0.0367025 -0.193872 -0.68371 -0.00230559
+ 0 0 0 0 0 0 0.0159878 -2.43089 -0.0161964 -0.122082 -0.424174 -0.00161175
+ 0 0 0 0 0 0 0 8795.81 10.698 -16.679 -65.6867 1.62002
+ 0 0 0 0 0 0 0 0 0.891438 -0.526444 0.103731 -0.0160222
+ 0 0 0 0 0 0 0 0 0 2.05864 4.41922 0.00183788
+ 0 0 0 0 0 0 0 0 0 0 16.9778 -0.000804065
+ 0 0 0 0 0 0 0 0 0 0 0 0.002
+ V 12    -8.01005 0.461651 -1.01217 134.349 1.02747 26.2281 -68.7083 0.203478 -0.337059 10.6908 -2.9443 -16.9113
+ V 12    -0.759352 0.081353 66.9889 0.937491 11.2173 -0.757203 0.333136 161.282 7.15419 7.19526 3.24982 0.262222
+ M 12 12
+ 0.574062 -0.93599 31.9103 -0.00620827 14.8007 -0.282419 -0.0128577 91.4075 1.43874 1.43679 0.736506 0.0499438
+ 0 3.17684 -84.6624 0.0738641 -31.0503 -0.075642 0.74845 -232.931 -3.81309 -3.88318 -1.87284 -0.133139
+ 0 0 3370.38 -0.72972 1323.33 -27.8986 -16.7554 9401.85 133.965 137.746 62.2908 4.30433
+ 0 0 0 0.0196723 -0.414248 -0.0211307 0.0563411 -2.42748 -0.0696328 -0.0480321 0.0369146 -0.00247947
+ 0 0 0 0 605.554 -14.0562 -2.63195 3813.92 60.8797 61.2081 29.4145 1.92561
+ 0 0 0 0 0 1.2627 -0.131464 -84.9015 -0.868342 -0.943266 -0.307051 -0.0234355
+ 0 0 0 0 0 0 0.640772 -40.4383 -0.169033 -0.198359 0.270761 -0.0116308
+ 0 0 0 0 0 0 0 26443.6 389.867 398.921 184.648 12.4366
+ 0 0 0 0 0 0 0 0 7.6948 7.70059 4.6022 0.235958
+ 0 0 0 0 0 0 0 0 0 7.76144 4.66114 0.236958
+ 0 0 0 0 0 0 0 0 0 0 3.71561 0.134452
+ 0 0 0 0 0 0 0 0 0 0 0 0.00755556
+ V 12    -18.458 7.29231 2.02273 119.128 -1.58341 -21.1111 16.5671 -0.423463 2.53078 18.3395 -5.73911 1.48564
+ V 12    0.235193 0.968513 70.3223 1.07384 19.3254 0.111667 0.952075 180.315 -8.07591 8.51595 7.98512 0.344444
+ M 12 12
+ 0.0564829 -0.013853 -3.45294 -0.000554399 -2.54708 -0.0209861 -0.00687987 -9.32347 -0.103082 -0.0224664 0.638568 0.00696987
+ 0 0.00351138 0.9387 0.000199919 0.646329 0.0029629 0.00108935 2.52817 0.0230854 0.00736132 -0.136832 -0.00119725
+ 0 0 1515.02 -1.42353 312.512 0.24175 0.235343 3698.66 -6.62775 20.8345 -89.0857 0.320876
+ 0 0 0 0.0563413 0.208408 0.122697 0.0269983 -3.95094 0.0596896 0.0318251 0.294814 -0.00827403
+ 0 0 0 0 438.747 -4.42212 1.40652 1165.12 -2.1318 10.1431 -19.9559 -0.270163
+ 0 0 0 0 0 0.7044 0.0509854 -9.5045 0.292356 -0.159063 0.404213 -0.0151037
+ 0 0 0 0 0 0 0.0253449 1.89703 0.0288603 0.0908658 -0.191656 -0.0077285
+ 0 0 0 0 0 0 0 9553.16 -21.9494 63.1384 -222.626 0.722966
+ 0 0 0 0 0 0 0 0 0.717282 -0.436662 -1.75159 -0.0350246
+ 0 0 0 0 0 0 0 0 0 1.23741 -1.4902 0.00160649
+ 0 0 0 0 0 0 0 0 0 0 23.6597 0.163705
+ 0 0 0 0 0 0 0 0 0 0 0 0.00542222
+ V 12    11.0526 22.7562 1.86057 138.023 -1.57415 -1.25863 47.4868 -0.340559 -5.03336 16.9539 -3.42922 12.4228
+ V 12    -0.862217 -0.164243 77.8447 0.831845 33.7264 0.933615 -0.148201 203.442 9.67266 10.7585 7.69453 0.41
+ M 12 12
+ 0.29897 -0.161771 -1.97598 0.0607213 -7.25277 -0.0737928 -0.335535 5.65123 0.951968 0.323466 -0.778814 0.0170785
+ 0 1.76749 -40.188 -0.107431 -0.505546 0.185008 0.539939 -122.208 -3.09664 -1.85295 1.62645 -0.128365
+ 0 0 2355.81 0.215553 1082.52 -1.03115 1.88534 6251.64 153.603 54.426 -90.5909 4.04343
+ 0 0 0 0.0950519 -8.38408 -0.0550511 0.0451667 8.81263 0.198778 0.0565219 -1.03697 -0.00260359
+ 0 0 0 0 1496.77 5.61294 3.98446 2000.99 34.3236 11.0064 31.3201 1.49415
+ 0 0 0 0 0 0.055966 0.0800018 -9.19831 -0.343708 -0.205412 0.630613 -0.00606518
+ 0 0 0 0 0 0 0.901638 5.11527 0.439825 -0.626391 -2.12349 -0.0737932
+ 0 0 0 0 0 0 0 17891.1 540.202 170.315 -398.787 9.79332
+ 0 0 0 0 0 0 0 0 42.786 6.76487 -21.8552 0.259097
+ 0 0 0 0 0 0 0 0 0 2.60336 -3.91037 0.116031
+ 0 0 0 0 0 0 0 0 0 0 30.7276 0.241314
+ 0 0 0 0 0 0 0 0 0 0 0 0.0232
+ V 12    -25.0027 6.19343 0.702586 114.253 -0.521822 34.9476 -23.7343 -0.10455 4.00138 24.8572 -7.55836 -44.6583
+ V 12    0.209952 0.970277 74.7861 0.787827 62.7039 0.780341 0.620685 195.065 -6.06696 11.3916 12.9121 0.408889
+ M 12 12
+ 0.124022 -0.0264448 1.24773 -0.0147862 2.79449 0.0115516 -0.0160944 3.34637 -0.875729 0.105227 -0.129721 0.00222791
+ 0 0.00631499 -0.323615 0.00548105 -0.856079 -0.00290328 0.00394286 -0.626869 0.17791 -0.0199017 -0.0536849 0.00048681
+ 0 0 741.332 2.61488 504.529 -2.26649 2.90116 2711.43 -99.1699 50.0689 62.4166 2.72473
+ 0 0 0 0.0334301 0.608549 -0.0221437 0.0275474 13.856 -0.560372 0.30518 -0.159947 0.0184849
+ 0 0 0 0 517.038 -1.37369 1.72616 1807.19 -98.488 34.6735 58.1374 1.35109
+ 0 0 0 0 0 0.0202739 -0.0254658 -11.3286 0.516796 -0.240304 0.136927 -0.0130916
+ 0 0 0 0 0 0 0.0320891 14.187 -0.610447 0.297164 -0.166667 0.016384
+ 0 0 0 0 0 0 0 11166.8 -511.809 214.8 149.943 11.926
+ 0 0 0 0 0 0 0 0 45.3783 -10.9286 0.0230053 -0.532221
+ 0 0 0 0 0 0 0 0 0 5.32755 4.46494 0.212352
+ 0 0 0 0 0 0 0 0 0 0 32.3301 -0.0273857
+ 0 0 0 0 0 0 0 0 0 0 0 0.0148889
+ V 12    9.41738 21.1756 -0.464708 106.791 0.438611 24.5674 21.783 0.113756 -3.54582 21.8421 -4.38892 -48.4221
+ V 12    -0.593403 -0.695182 76.2992 0.976811 62.1096 -0.640999 0.754739 140.965 0.12594 7.94657 3.74115 0.336667
+ M 12 12
+ 1.01004 -0.619078 21.5338 -0.0188284 8.83462 -0.173254 -0.160987 49.0781 0.808946 0.821354 -0.54795 0.0167427
+ 0 0.471304 -13.494 0.0162904 -5.72435 0.128715 0.11427 -28.2805 -0.513454 -0.546214 0.235904 -0.00299806
+ 0 0 2791.84 2.72122 1920.31 -4.51993 -3.23677 5231.85 -3.3677 22.1551 -81.9961 2.86083
+ 0 0 0 0.052803 2.61309 0.0568742 0.0493523 2.20615 0.171269 -0.1899 -0.136688 -0.00164391
+ 0 0 0 0 1390.54 -1.69008 -0.889029 3469.46 -5.05942 13.4581 -47.5286 1.53592
+ 0 0 0 0 0 0.0984601 0.0859319 -11.9928 0.116127 -0.381085 -0.0680641 -0.00420051
+ 0 0 0 0 0 0 0.076945 -9.29149 0.070785 -0.343065 -0.0902314 -0.00432504
+ 0 0 0 0 0 0 0 10174.7 -9.68876 47.5559 -175.551 6.67667
+ 0 0 0 0 0 0 0 0 3.0506 -0.829505 -1.06958 -0.0238468
+ 0 0 0 0 0 0 0 0 0 3.2939 2.76036 -0.0211042
+ 0 0 0 0 0 0 0 0 0 0 10.1479 -0.355119
+ 0 0 0 0 0 0 0 0 0 0 0 0.0204
+ V 12    -15.347 -6.05029 0.599345 125.592 -0.0107668 -18.5279 46.5025 -0.368201 0.0336666 20.8994 -6.41365 3.13135
+ V 12    0.938507 -0.040987 83.9611 1.00163 78.3182 0.49915 0.860416 113.61 -1.45994 3.73423 4.24723 0.237778
+ M 12 12
+ 0.0677477 0.145273 -1.44333 0.0142629 -0.790868 -0.0248184 0.0147916 -2.94673 0.58742 -0.408431 -1.21737 -0.00627097
+ 0 0.989977 8.26783 -0.00230064 8.65801 -0.138978 0.0855994 5.38269 3.35901 -0.138361 0.283066 -0.0022058
+ 0 0 1562.87 5.62155 1614.87 -7.17035 4.12594 1877.13 -0.539359 24.4959 55.4534 2.50989
+ 0 0 0 0.0609033 7.16334 -0.0430538 0.0240445 5.09612 -0.134832 -0.346887 -0.821358 0.00983112
+ 0 0 0 0 1733.37 -7.8329 4.5244 1887.96 8.79843 21.7555 57.2714 2.64586
+ 0 0 0 0 0 0.0699262 -0.0414511 -7.40227 -0.0336671 0.410212 1.08962 -0.00746758
+ 0 0 0 0 0 0 0.0248802 4.32739 0.0373163 -0.219785 -0.587664 0.0039792
+ 0 0 0 0 0 0 0 2458.12 -12.2325 59.5136 132.2 3.13753
+ 0 0 0 0 0 0 0 0 20.212 6.75438 21.4817 -0.0143441
+ 0 0 0 0 0 0 0 0 0 13.7427 37.1351 0.0869814
+ 0 0 0 0 0 0 0 0 0 0 107.387 0.254566
+ 0 0 0 0 0 0 0 0 0 0 0 0.00515556
+ V 12    20.2551 1.70127 0.470311 125.074 0.0891557 9.89027 45.6579 -0.268055 -1.33629 7.43357 -1.59011 23.3727
+ V 12    0.0850961 0.87805 61.9882 0.937023 36.0688 0.974639 0.000385626 108.799 2.92205 3.74242 2.03137 0.205556
+ M 12 12
+ 0.126704 0.0710394 -1.25277 0.0090714 -1.69575 0.0199892 -0.123875 -0.188246 0.0965135 -0.392457 -0.572182 0.000776415
+ 0 0.869378 -0.952638 -0.008761 -0.813276 -0.0260013 0.0332028 -9.2212 2.66991 -2.28556 -6.10891 -0.0140358
+ 0 0 284.126 -0.033764 188.572 -0.0652279 -0.157096 506.241 -3.74477 2.09651 4.10752 0.415921
+ 0 0 0 0.0221645 -0.856808 0.00076631 -0.0158749 0.964387 -0.0731954 -0.0159182 0.06954 -0.00120782
+ 0 0 0 0 178.374 -0.386706 2.87482 259.83 -1.80298 3.96875 3.77083 0.200446
+ 0 0 0 0 0 0.0109753 -0.0513819 1.23184 -0.092736 0.0205474 0.174985 0.00294528
+ 0 0 0 0 0 0 0.439724 -7.10411 0.201315 0.17826 -0.228115 -0.0186396
+ 0 0 0 0 0 0 0 1136.42 -32.5975 17.5544 59.2093 1.11047
+ 0 0 0 0 0 0 0 0 8.46858 -6.71924 -18.6908 -0.0418491
+ 0 0 0 0 0 0 0 0 0 6.48442 16.1418 0.0294386
+ 0 0 0 0 0 0 0 0 0 0 43.1039 0.0950451
+ 0 0 0 0 0 0 0 0 0 0 0 0.00182222
+ V 12    -0.88259 16.7024 1.09867 126.641 -0.649323 29.9613 -22.0336 -0.265928 0.307259 10.6303 -2.96813 -1.62263
+ V 12    0.290129 0.464985 77.2794 0.707285 58.9079 0.990296 -0.116626 128.243 -0.207406 7.1398 8.53983 0.302222
+ M 12 12
+ 0.699342 0.910191 7.34944 0.0202821 5.1711 -0.00121552 0.000665465 6.07781 2.66628 -3.04317 -9.68592 -0.00493888
+ 0 1.59718 8.08862 -0.0328274 8.55751 0.00576635 0.075501 0.849463 4.77947 -4.83673 -15.6641 0.0135923
+ 0 0 375.095 -1.02658 340.283 -0.13952 -1.96092 382.927 25.5828 -14.6591 -94.3123 0.220431
+ 0 0 0 0.0460436 -2.88458 -0.00239847 -0.0119023 0.847859 -0.0952002 -0.0971751 0.289799 -0.00093762
+ 0 0 0 0 400.749 -0.0262399 -1.16807 254.326 26.3362 -8.58571 -93.6546 0.260308
+ 0 0 0 0 0 0.000589534 0.00496401 -0.260326 0.0179104 -0.0193289 -0.0496903 -0.00031444
+ 0 0 0 0 0 0 0.0508178 -2.77815 0.233335 -0.307274 -0.654851 -0.00151436
+ 0 0 0 0 0 0 0 529.968 3.9414 -0.877304 -34.2945 0.090191
+ 0 0 0 0 0 0 0 0 14.4213 -14.4677 -46.4511 0.0489526
+ 0 0 0 0 0 0 0 0 0 16.4229 48.3318 -0.00608587
+ 0 0 0 0 0 0 0 0 0 0 158.175 -0.0679779
+ 0 0 0 0 0 0 0 0 0 0 0 0.00235556
+ V 12    5.16363 15.7649 0.8485 101.706 -0.272068 30.6141 -26.6035 -0.294836 -1.19759 14.9576 -3.39383 -18.6401
+ V 12    -0.0964798 0.541643 76.3987 0.776867 50.9635 0.983487 -0.087939 175.901 3.25342 10.3855 12.7882 0.381111
+ M 12 12
+ 0.190674 -0.604522 2.26548 0.060497 1.93168 -0.0201795 -0.13943 10.8225 -1.11372 1.16957 4.17967 0.00955366
+ 0 4.08515 -40.3369 -0.155246 -29.2136 0.0570214 0.54136 -143.105 6.02901 -8.00553 -27.5476 -0.116115
+ 0 0 2118.1 2.3645 1378.71 -0.827823 -8.51423 6296.51 67.1937 131.463 457.958 4.46704
+ 0 0 0 0.0597761 0.151398 -0.0166495 -0.0958555 7.6966 -0.344515 0.246192 0.89827 0.00674999
+ 0 0 0 0 977.45 -0.0979468 -3.66483 4228.16 50.2043 97.6817 367.786 2.81598
+ 0 0 0 0 0 0.00572837 0.0332847 -2.00805 0.167367 -0.0896943 -0.187437 -0.00342872
+ 0 0 0 0 0 0 0.21945 -25.1541 1.18894 -1.07247 -3.48208 -0.0301067
+ 0 0 0 0 0 0 0 19517.9 189.363 442.058 1685.22 12.8152
+ 0 0 0 0 0 0 0 0 25.454 -7.81538 -20.332 -0.0311406
+ 0 0 0 0 0 0 0 0 0 18.6772 68.1484 0.328669
+ 0 0 0 0 0 0 0 0 0 0 289.488 1.05429
+ 0 0 0 0 0 0 0 0 0 0 0 0.0114889
+ V 12    -2.37642 17.4178 0.321796 108.693 -0.106349 33.2469 -24.3867 -0.0655701 0.48355 19.6855 -4.55732 -40.5077
+ V 12    0.340981 0.814973 77.3056 0.755024 53.062 -0.143329 0.978926 136.295 6.02462 6.45461 5.76851 0.323333
+ M 12 12
+ 0.211672 0.276027 -5.26597 0.00440787 -2.1834 0.013395 -0.00221185 -9.8222 -1.41885 -1.61309 -4.47195 -0.00493481
+ 0 0.764279 3.56542 -0.0163511 4.35512 -0.209632 -0.0212475 -0.155127 -1.9034 -2.21843 -6.40682 -0.0154572
+ 0 0 1299.57 -3.68441 686.489 -9.38497 -1.08022 2448.35 20.1981 23.0075 58.8519 0.38925
+ 0 0 0 0.0401327 -0.528948 0.0536165 0.00644273 -8.51463 0.205905 0.115329 0.33837 -0.00941497
+ 0 0 0 0 447.812 -4.55188 -0.494033 1159.12 9.66754 5.66116 15.8547 -0.258453
+ 0 0 0 0 0 0.188563 0.0165527 -14.2977 0.405276 0.311014 0.760535 -0.00779272
+ 0 0 0 0 0 0 0.00188082 -1.86211 0.0575526 0.0541998 0.144731 -0.000871986
+ 0 0 0 0 0 0 0 5208.4 39.2596 54.1796 69.0536 1.18854
+ 0 0 0 0 0 0 0 0 17.9551 18.5615 52.8629 -0.0148615
+ 0 0 0 0 0 0 0 0 0 19.8788 55.6602 0.0236241
+ 0 0 0 0 0 0 0 0 0 0 174.83 0.127935
+ 0 0 0 0 0 0 0 0 0 0 0 0.0036
+ V 12    8.19501 10.401 1.03137 93.1394 -0.579021 -9.17137 57.2275 -0.303538 1.82013 13.4725 -3.33402 14.3076
+ V 12    -0.2997 0.679588 92.8182 1.02702 56.2194 0.727629 0.672004 230.552 -3.27463 11.9623 11.3825 0.412222
+ M 12 12
+ 0.8026 -0.383416 -21.6649 0.0268354 -23.54 0.0978261 -0.132776 -73.7497 1.4912 0.0529117 3.58918 -0.0737606
+ 0 1.23246 27.6099 -0.121926 22.2584 0.0403501 -0.0448161 85.1621 -3.96968 -2.87747 -12.9931 0.0503084
+ 0 0 1866.1 0.885354 1365.26 -3.81054 4.39173 5681.23 -81.2322 -35.2025 -295.083 2.52534
+ 0 0 0 0.0576774 -1.13207 -0.0351994 0.0409551 0.956952 0.508848 0.298588 1.03766 -0.00917923
+ 0 0 0 0 1195.38 -3.16213 3.98283 4307.68 -74.9826 -30.017 -245.844 2.41212
+ 0 0 0 0 0 0.070257 -0.083427 -11.1269 -0.127722 0.0186336 0.0930677 0.00211977
+ 0 0 0 0 0 0 0.100439 13.0741 0.132323 -0.00563659 -0.149822 -0.000987506
+ 0 0 0 0 0 0 0 17458.9 -258.027 -98.3473 -893.791 8.55637
+ 0 0 0 0 0 0 0 0 13.3064 9.46421 41.7924 -0.183843
+ 0 0 0 0 0 0 0 0 0 10.5585 35.555 0.0405021
+ 0 0 0 0 0 0 0 0 0 0 151.425 -0.271355
+ 0 0 0 0 0 0 0 0 0 0 0 0.0117556
+ V 12    -4.41974 18.7194 0.591701 135.42 -0.396057 23.5597 24.3854 -0.0940777 -2.3303 25.2492 -6.03729 -43.6139
+ V 12    0.773225 -0.207778 80.0422 0.859908 73.3993 0.68081 0.728286 159.815 -1.14315 8.35861 10.3377 0.463636
+ M 12 12
+ 1.52773 -0.257291 16.2076 0.0293153 18.1825 0.0185121 -0.0250982 42.2846 4.58306 -1.34092 -7.25112 0.366882
+ 0 0.420743 -12.8116 -0.0124076 -6.32755 0.0286584 -0.0277651 -29.326 0.608286 -0.841183 -1.4858 0.0407537
+ 0 0 5068.77 -3.73901 4679.5 0.347128 -1.09551 10656.2 -8.56173 234.589 316.121 32.3256
+ 0 0 0 0.0800595 -4.27463 -0.0487384 0.0452385 -17.4725 0.133853 -1.51878 -1.81828 -0.206564
+ 0 0 0 0 4463.03 1.31965 -2.01248 9967.33 27.0583 227.841 250.736 37.2293
+ 0 0 0 0 0 0.0358874 -0.0333199 7.40414 0.1603 0.805563 0.623035 0.142386
+ 0 0 0 0 0 0 0.0311801 -8.48066 -0.178783 -0.781286 -0.594066 -0.141389
+ 0 0 0 0 0 0 0 24437.9 10.2944 784.671 958.857 108.41
+ 0 0 0 0 0 0 0 0 19.9871 -7.47958 -34.4506 1.63125
+ 0 0 0 0 0 0 0 0 0 72.0353 94.9972 8.29163
+ 0 0 0 0 0 0 0 0 0 0 172.028 7.28854
+ 0 0 0 0 0 0 0 0 0 0 0 1.33345
+ V 12    17.4103 2.20319 -0.268045 111.339 0.444724 17.597 40.4474 -0.0323351 -1.08088 12.9235 -2.7324 16.8933
+ V 12    0.773872 0.014955 87.0731 0.0852753 86.2452 0.994171 -0.0158202 88.1636 0.646201 1.51116 1.85626 0.131111
+ M 12 12
+ 1.54032 0.0280236 37.5569 -0.0206688 43.1694 -0.00512635 0.117857 31.7285 -4.56974 -4.20751 -11.4986 0.0516772
+ 0 0.0677668 -5.50236 0.0164122 -5.3691 -0.00391674 0.073224 -5.61148 -0.0273995 -0.0865782 -0.267022 -0.00184475
+ 0 0 8641.4 -4.53122 8777.31 0.338344 -0.173881 8496.53 -124.727 -104.373 -294.426 5.78794
+ 0 0 0 0.0504594 -4.57923 -0.00590711 0.0293711 -4.46209 -0.0492254 0.136634 0.00486763 0.00248456
+ 0 0 0 0 8933.91 0.317638 0.279731 8611.1 -141.604 -120.007 -337.98 5.97714
+ 0 0 0 0 0 0.000812564 -0.00640825 0.358228 0.0240114 0.00338654 0.0435463 -0.000456643
+ 0 0 0 0 0 0 0.101546 -0.620817 -0.302318 -0.299536 -0.876754 0.00114896
+ 0 0 0 0 0 0 0 8373.76 -107.324 -88.2955 -250.253 5.58787
+ 0 0 0 0 0 0 0 0 14.3527 12.5747 35.9003 -0.191523
+ 0 0 0 0 0 0 0 0 0 12.2721 33.5156 -0.132019
+ 0 0 0 0 0 0 0 0 0 0 97.1191 -0.411629
+ 0 0 0 0 0 0 0 0 0 0 0 0.00708889
+ V 12    12.4572 3.14728 0.480484 15.5328 0.233096 28.186 -11.1355 -0.236408 -0.172307 3.53586 -0.7682 -10.8211
+ V 12    -0.97959 -0.0471904 63.2902 0.103224 63.2633 -0.991553 -0.0186928 63.5941 0.0144769 0.984499 0.198166 0.116667
+ M 12 12
+ 0.00640268 0.00454945 -1.08475 0.0195311 -1.08272 0.00299511 0.0020717 -1.08305 0.0172118 -0.0364846 -0.00974826 -0.00176275
+ 0 0.337189 -1.82124 0.0112965 -1.81079 0.00184028 0.204692 -1.7409 -0.24695 0.232858 0.0656811 -0.00404879
+ 0 0 2607.1 -3.45244 2606.45 -0.441897 1.64644 2606.41 -2.10229 18.8072 0.0841851 2.35876
+ 0 0 0 0.0649139 -3.44178 0.00999834 -0.00538757 -3.45764 0.00897442 -0.0911794 -0.0281919 -0.00451163
+ 0 0 0 0 2605.81 -0.440096 1.64311 2605.75 -2.1389 18.8234 0.0859094 2.35822
+ 0 0 0 0 0 0.00157951 -0.000800715 -0.443542 0.00124578 -0.0140403 -0.00425499 -0.000698872
+ 0 0 0 0 0 0 0.146687 1.71891 -0.0631095 0.132001 0.0417703 -0.00173158
+ 0 0 0 0 0 0 0 2605.83 -2.07083 19.0164 0.167317 2.35919
+ 0 0 0 0 0 0 0 0 0.709499 -0.444293 -0.0747735 -0.0141509
+ 0 0 0 0 0 0 0 0 0 1.18587 0.343378 0.029349
+ 0 0 0 0 0 0 0 0 0 0 0.125799 0.00271197
+ 0 0 0 0 0 0 0 0 0 0 0 0.0028
+ V 12    -24.7854 -0.563721 0.700749 15.0806 0.0246505 -28.2674 -2.06235 -0.320158 -0.0554537 2.33491 -1.21138 26.7809
+ V 12    0.462624 -0.740403 68.8759 0.841956 67.9213 0.658444 -0.737602 70.1269 -0.939989 1.16231 1.84669 0.1
+ M 12 12
+ 0.437832 -0.257163 12.3733 -0.144164 15.2113 0.105523 0.0958625 9.44534 1.87124 -1.94388 -4.91817 -0.00110734
+ 0 0.702206 -13.2431 -0.0378202 -16.1944 0.0370421 0.0196569 -10.2818 -1.57506 1.57795 4.26193 -0.0126388
+ 0 0 1531.97 0.0930538 1657.79 -0.204108 0.106278 1408.8 82.9878 -84.0843 -226.572 0.228694
+ 0 0 0 0.205459 0.462193 -0.153175 -0.133318 -0.317303 0.331504 -0.375562 -0.998929 -0.00215626
+ 0 0 0 0 1813.3 -0.501416 -0.109944 1503.89 103.06 -105.198 -280.517 0.206778
+ 0 0 0 0 0 0.11462 0.0989962 0.124578 -0.255402 0.28844 0.76519 0.00152024
+ 0 0 0 0 0 0 0.0869243 0.347834 -0.201915 0.229187 0.61466 0.00132161
+ 0 0 0 0 0 0 0 1317.57 62.0769 -62.0749 -170.48 0.258105
+ 0 0 0 0 0 0 0 0 14.0473 -14.8569 -37.7278 -0.0318049
+ 0 0 0 0 0 0 0 0 0 15.778 39.9512 0.0378138
+ 0 0 0 0 0 0 0 0 0 0 101.548 0.0821447
+ 0 0 0 0 0 0 0 0 0 0 0 0.001
+ V 12    4.86119 0.340009 0.445772 117.685 0.257808 23.7015 -63.9704 -0.283323 -0.987516 3.74589 -1.2727 2.23273
+ V 12    -0.973334 -0.197112 61.4961 0.118074 16.0555 -0.498697 -0.0570863 107.795 3.39501 4.07805 7.94342 0.202222
+ M 12 12
+ 0.00512349 -0.0233279 -2.00251 0.0109504 -0.563288 -0.0883248 -0.0340416 -3.37546 0.00830385 -0.00814727 -0.156593 -0.00305023
+ 0 0.118789 9.20624 -0.0286473 2.23915 0.559178 0.192535 15.8732 -0.0603551 -0.00761394 0.690495 0.0137186
+ 0 0 1383.07 -3.91519 438.883 15.1076 21.5315 2272.23 -13.4653 3.82281 80.6674 1.91462
+ 0 0 0 0.0740178 -2.63536 0.04033 0.0453845 -5.11437 -0.0174512 -0.113381 -0.396956 -0.0079541
+ 0 0 0 0 633.981 9.43658 3.81145 213.176 -4.17393 -2.86446 -7.79596 0.697837
+ 0 0 0 0 0 5.62304 0.602507 20.6855 0.0626768 -0.182404 1.88804 0.0639809
+ 0 0 0 0 0 0 0.769498 37.9398 -0.209398 -0.169099 0.996599 0.0139136
+ 0 0 0 0 0 0 0 4255.48 -22.2504 10.6819 167.823 3.08545
+ 0 0 0 0 0 0 0 0 0.261139 0.103105 -0.475158 -0.015483
+ 0 0 0 0 0 0 0 0 0 0.450364 1.21092 0.017521
+ 0 0 0 0 0 0 0 0 0 0 9.32208 0.145402
+ 0 0 0 0 0 0 0 0 0 0 0 0.00435556
+ V 12    -22.642 4.12614 2.09684 13.9436 -1.56562 -15.6881 -1.44506 -0.395758 0.781686 2.2243 -0.531158 40.6026
+ V 12    -0.575184 0.670375 67.8362 0.846637 67.522 -0.655566 0.746104 68.3492 -0.349548 0.856767 0.961241 0.104444
+ M 12 12
+ 0.431383 -0.384971 -6.90299 0.0126267 -8.52967 0.020105 0.0220021 -5.13279 -1.50634 1.38881 4.54351 -0.00670436
+ 0 0.546471 17.8371 0.109744 19.733 0.0700628 0.0558012 15.8265 1.76257 -1.57277 -5.2812 0.0119597
+ 0 0 4905.27 1.88294 4959.11 1.27121 0.514793 4858.38 29.8697 -27.0149 -149.678 2.82429
+ 0 0 0 0.126414 2.09711 0.0940514 0.0804237 1.66887 0.276808 -0.13343 -0.579121 -0.00236686
+ 0 0 0 0 5020.07 1.38597 0.594555 4904.61 36.4547 -32.968 -169.505 2.86514
+ 0 0 0 0 0 0.0703337 0.0601325 1.15991 0.164345 -0.059984 -0.306253 -0.00185749
+ 0 0 0 0 0 0 0.0517259 0.439307 0.126508 -0.0385583 -0.210714 -0.00213021
+ 0 0 0 0 0 0 0 4819.69 22.7748 -20.6096 -128.428 2.78434
+ 0 0 0 0 0 0 0 0 6.35566 -5.48313 -18.3434 0.0170977
+ 0 0 0 0 0 0 0 0 0 5.34538 16.6545 -0.0238936
+ 0 0 0 0 0 0 0 0 0 0 55.3 -0.114248
+ 0 0 0 0 0 0 0 0 0 0 0 0.00282222
+ V 12    -12.8425 5.95694 0.792335 103.391 -0.0716873 -22.4426 38.2132 -0.358441 -0.694976 2.5957 -0.82554 41.9967
+ V 12    -0.0174011 -0.979302 64.7642 1.46326 64.3917 -0.00233031 -0.9936 65.372 0.182184 1.08281 0.982671 0.111111
+ M 12 12
+ 0.359598 3.00221e-05 12.2567 0.0460075 11.0812 0.143008 -0.00662607 13.3859 1.33603 1.01307 2.8136 0.00592309
+ 0 0.00637808 -0.166032 -0.0054274 -0.311534 -0.00864816 0.000759261 -0.0151752 0.11348 0.111245 0.359731 -0.000854761
+ 0 0 3831.35 2.48665 3793.48 -4.36005 -0.189503 3868.31 71.4977 15.1299 77.9046 2.05723
+ 0 0 0 0.0235464 2.43971 0.0373319 -0.00276148 2.52332 0.0580199 0.0337794 0.10953 0.000188908
+ 0 0 0 0 3763.33 -4.64953 -0.183037 3822.84 64.2131 8.60789 59.1584 2.05768
+ 0 0 0 0 0 0.114409 -0.00521462 -4.0909 0.256932 0.315387 0.727964 -0.00342699
+ 0 0 0 0 0 0 0.000366594 -0.195259 -0.00828832 -0.00907751 -0.0148718 1.3138e-05
+ 0 0 0 0 0 0 0 3912.81 78.6142 21.5881 96.3411 2.0543
+ 0 0 0 0 0 0 0 0 7.71304 5.87086 17.432 0.00822736
+ 0 0 0 0 0 0 0 0 0 6.17679 15.8575 0.00603771
+ 0 0 0 0 0 0 0 0 0 0 45.581 -0.00382592
+ 0 0 0 0 0 0 0 0 0 0 0 0.00368889
+ V 12    -6.43275 -0.863914 0.557851 198.95 0.255469 7.02272 -84.1532 -0.387754 -0.566074 5.13969 -2.20154 22.257
+ V 12    0.771134 0.0352195 82.0824 0.492939 74.6289 0.87202 -0.478268 111.592 2.45002 4.18321 5.48843 0.247778
+ M 12 12
+ 1.52934 0.0714774 -17.6208 -0.179154 -7.00128 0.136944 0.227324 -37.4384 -4.6885 -4.2768 -16.2502 -0.0239009
+ 0 0.107668 -4.74496 -0.0275816 -5.10219 0.0262798 0.0431138 -6.88945 -0.0498532 0.0700672 -0.06346 -0.000186207
+ 0 0 1663.31 -2.3585 1421.41 -0.731319 -0.316074 2175.48 46.6517 72.1132 230.856 1.83342
+ 0 0 0 0.0700929 -2.83829 -0.03505 -0.0633092 0.250713 0.490913 0.421272 1.51916 -0.00476556
+ 0 0 0 0 1410.79 0.299216 1.23325 1742.28 10.5833 38.852 111.593 1.22555
+ 0 0 0 0 0 0.0251042 0.0423724 -2.83669 -0.387059 -0.275314 -1.15415 0.000674122
+ 0 0 0 0 0 0 0.0724646 -3.72487 -0.640324 -0.457842 -1.89615 0.00203943
+ 0 0 0 0 0 0 0 3054.36 104.526 135.309 446.876 2.48897
+ 0 0 0 0 0 0 0 0 14.8221 13.2232 50.8758 0.0741353
+ 0 0 0 0 0 0 0 0 0 14.8741 50.1694 0.126089
+ 0 0 0 0 0 0 0 0 0 0 183.564 0.351664
+ 0 0 0 0 0 0 0 0 0 0 0 0.00355556
+ V 12    13.0731 8.96274 0.430724 73.8267 0.16042 27.8746 -45.7393 -0.21043 0.252879 7.96352 -1.82234 -10.5349
+ V 12    0.82344 -0.483555 100.37 0.792454 100.218 0.696784 -0.706485 141.85 6.74934 7.91229 5.52726 0.33
+ M 12 12
+ 0.198124 0.320619 -3.08766 -0.0839249 -2.98122 0.0578626 0.0647806 -0.39343 0.609054 -0.845658 -1.36295 -0.0124675
+ 0 0.594963 3.44614 -0.196244 3.53097 0.13467 0.147521 4.41804 0.882847 -1.14561 -1.72153 -0.0124529
+ 0 0 3543.9 -5.67334 3539.65 3.52846 4.21017 3058.77 -26.5589 123.344 186.857 4.74405
+ 0 0 0 0.138442 -5.68194 -0.097839 -0.0971721 -2.51842 -0.0718579 0.2601 0.245931 0.00753079
+ 0 0 0 0 3536.12 3.52716 4.22241 3052.21 -26.2025 122.199 186.016 4.7377
+ 0 0 0 0 0 0.0696352 0.0682825 1.41867 0.0437722 -0.176784 -0.174192 -0.00631838
+ 0 0 0 0 0 0 0.06871 2.11997 0.0749355 -0.207731 -0.208558 -0.00474715
+ 0 0 0 0 0 0 0 2975.39 -9.05054 107.507 145.021 4.29487
+ 0 0 0 0 0 0 0 0 2.27213 -3.11262 -5.18269 -0.0415916
+ 0 0 0 0 0 0 0 0 0 9.01883 11.9513 0.2164
+ 0 0 0 0 0 0 0 0 0 0 19.5519 0.302994
+ 0 0 0 0 0 0 0 0 0 0 0 0.0086
+ V 12    11.2359 4.4263 0.0482801 118.76 0.762602 27.0281 -62.8257 -0.305214 2.40319 21.9525 -6.26707 -55.7713
+ V 12    0.412447 0.890081 104.013 0.887931 100.816 -0.596114 0.784945 159.072 -8.42763 8.68363 5.77523 0.348889
+ M 12 12
+ 0.249205 -0.144416 0.659428 0.1331 0.0464839 0.149015 0.0968027 5.60396 -0.291416 0.182945 0.816916 0.0130843
+ 0 0.0895862 0.773976 -0.0807271 1.1539 -0.092564 -0.0567945 -1.18524 0.172018 -0.110142 -0.696143 -0.00820015
+ 0 0 1075.3 -5.53915 1072.67 -6.02969 -3.1545 1931.83 -2.91689 -2.3162 -82.6341 1.64556
+ 0 0 0 0.176717 -5.56747 0.177752 0.112928 -6.9596 -0.0716634 0.0458014 0.778848 -0.00455476
+ 0 0 0 0 1078.75 -6.11851 -3.21736 1913.81 -0.801243 -3.42706 -82.0116 1.61979
+ 0 0 0 0 0 0.182739 0.114666 -7.83001 -0.0880123 0.070069 0.971881 -0.00322277
+ 0 0 0 0 0 0 0.073843 -3.70383 -0.0574488 0.0445602 0.490497 -0.00225965
+ 0 0 0 0 0 0 0 3941.44 -10.7528 -3.25186 -162.66 3.51644
+ 0 0 0 0 0 0 0 0 0.770771 -0.293386 -0.182348 -0.0144085
+ 0 0 0 0 0 0 0 0 0 0.26211 0.864158 0.00443534
+ 0 0 0 0 0 0 0 0 0 0 17.1649 -0.0237092
+ 0 0 0 0 0 0 0 0 0 0 0 0.00488889
+ V 12    12.3847 18.4129 0.770276 122.123 0.140352 -20.1124 35.5366 -0.477885 -4.81855 23.1153 -5.37298 -19.8261
+ V 12    -0.991892 -0.0652085 67.6195 0.422765 64.8836 -0.922027 -0.384303 87.7993 -1.50683 3.27735 2.68246 0.224444
+ M 12 12
+ 0.000110751 -0.000379392 -0.0944635 0.000653646 -0.0795056 0.000179832 -0.000423565 -0.093764 0.00256135 0.0044972 -0.00483256 0.000106389
+ 0 0.106968 0.781788 0.039036 0.0665271 0.0042666 -0.010221 2.17259 -0.171051 0.188775 0.234445 0.00250576
+ 0 0 814.432 -2.44994 811.663 -0.652778 1.56848 869.331 -3.85478 -15.4977 -37.1924 0.550305
+ 0 0 0 0.0310815 -2.51251 0.00685859 -0.0165054 -2.06016 -0.00860383 0.0938864 0.162267 -0.000707409
+ 0 0 0 0 839.052 -0.580019 1.41442 842.86 0.241878 -19.5684 -47.393 0.501777
+ 0 0 0 0 0 0.00287154 -0.00691209 -0.683207 0.00910535 -0.00571845 0.0196748 -2.17578e-05
+ 0 0 0 0 0 0 0.0167286 1.62634 -0.0190791 0.0131313 -0.058434 -7.70995e-05
+ 0 0 0 0 0 0 0 963.461 -7.44433 -12.4621 -29.4835 0.662764
+ 0 0 0 0 0 0 0 0 0.818063 -0.583274 -1.29739 -0.0179992
+ 0 0 0 0 0 0 0 0 0 1.61154 1.28621 0.000450866
+ 0 0 0 0 0 0 0 0 0 0 7.04095 -0.00323546
+ 0 0 0 0 0 0 0 0 0 0 0 0.00142222
+ V 12    -24.9047 4.52565 0.706881 63.1248 0.0427796 -23.5669 -31.6684 -0.350434 -1.04458 7.07127 -2.36009 25.0877
+ V 36    -90.3112 -330.26 -131.373 -173.117 -249.096 -127.291 -205.317 -132.858 -173.042 -124.141 -119.529 -98.7098 -119.37 -138.594 -164.519 -209.429 -198.606 -174.073 -159.633 -116.485 -106.259 -99.172 -134.438 -114.942 -210.296 -122.523 -41.3475 -42.3311 -97.687 -53.8217 -86.3039 -204.337 -69.0683 -169.645 -195.727 -64.425
+ M 12 12
+ 23.5437 1.73123 -0.0480679 0.309615 -0.0100276 -1.82389 1.63144 0.0153898 -0.234706 0.0132026 0.432145 -7.26704
+ 1.73123 12.3643 0.139963 2.38363 -0.114633 -0.406601 -6.63841 -0.0108937 -0.406324 0.637238 0.210628 -5.43734
+ -0.0480679 0.139963 0.0806172 0.103168 -0.0538965 -0.150402 -0.0402053 -0.0211138 -0.0270994 0.0589144 -0.0179324 0.820913
+ 0.309615 2.38363 0.103168 128.254 -0.00747945 1.25262 -10.9634 -0.102652 -0.3768 1.89716 -0.703515 17.5151
+ -0.0100276 -0.114633 -0.0538965 -0.00747945 0.0466482 0.0975592 -0.0514087 0.0101183 0.0172406 0.00563775 -0.00181087 -0.710881
+ -1.82389 -0.406601 -0.150402 1.25262 0.0975592 30.1171 -5.35369 0.0588838 0.0765097 0.471863 -0.206237 -10.8205
+ 1.63144 -6.63841 -0.0402053 -10.9634 -0.0514087 -5.35369 71.4392 0.0169827 0.273192 -0.77371 0.265191 15.4563
+ 0.0153898 -0.0108937 -0.0211138 -0.102652 0.0101183 0.0588838 0.0169827 0.00852506 0.00816925 -0.0535524 0.0156038 -0.280709
+ -0.234706 -0.406324 -0.0270994 -0.3768 0.0172406 0.0765097 0.273192 0.00816925 0.465283 0.00115915 -0.0463122 -0.67258
+ 0.0132026 0.637238 0.0589144 1.89716 0.00563775 0.471863 -0.77371 -0.0535524 0.00115915 4.1365 -1.15986 -16.1727
+ 0.432145 0.210628 -0.0179324 -0.703515 -0.00181087 -0.206237 0.265191 0.0156038 -0.0463122 -1.15986 0.448141 3.47924
+ -7.26704 -5.43734 0.820913 17.5151 -0.710881 -10.8205 15.4563 -0.280709 -0.67258 -16.1727 3.47924 285.155
+11 a
+36   33 84  33 83  34 83  35 81  36 78  38 75  40 71  43 66  46 61  49 56  51 52  53 48  55 46  56 44  57 43  57 42  58 42  58 41  58 40  59 40  60 42  61 45  62 50  64 56  66 61  68 67  70 73  71 76  73 80  74 82  74 83  75 85  75 86  76 87  76 86  76 85  
+28   172 78  172 79  173 78  174 75  176 72  179 67  182 62  185 55  188 49  191 45  194 41  195 38  196 37  196 38  197 40  199 43  201 48  203 55  206 61  208 67  210 72  212 76  213 79  215 80  215 82  216 82  216 83  215 82  
+32   35 179  35 180  35 179  36 176  37 174  38 170  41 165  44 160  46 154  49 149  52 144  54 140  56 136  56 134  57 133  57 132  57 133  58 135  59 137  61 141  63 147  65 154  68 160  70 166  71 171  73 174  74 176  75 177  75 178  75 179  76 179  76 180  
+28   145 188  146 187  147 185  150 182  153 178  158 172  164 166  170 159  177 153  182 148  186 144  189 142  191 141  192 142  192 144  192 147  193 152  194 159  195 166  197 173  198 179  199 184  200 187  201 189  201 190  202 190  202 191  202 190  
+26   230 176  231 176  232 175  233 172  234 169  237 164  240 159  243 153  246 148  249 144  251 141  252 139  253 139  253 140  254 141  255 143  256 147  258 153  260 159  262 166  264 172  265 176  267 180  268 182  269 183  269 184  
+28   251 96  252 95  252 94  253 91  254 86  257 79  260 72  264 63  269 55  273 48  276 42  278 40  279 39  280 40  281 42  282 45  285 52  287 60  290 69  294 79  297 89  300 96  301 102  303 105  303 107  304 108  304 109  304 108  
+25   54 93  54 94  54 93  55 91  55 88  56 85  58 81  60 76  63 71  66 66  68 61  70 57  72 53  73 51  74 50  74 49  75 50  76 53  78 56  80 62  82 68  84 74  86 78  87 82  88 83  
+28   130 148  130 146  131 144  132 141  135 137  137 131  140 124  143 117  146 111  148 106  149 103  150 102  150 101  151 103  152 106  153 111  155 118  157 125  158 132  160 139  161 143  162 146  163 148  163 149  164 149  164 150  165 150  165 149  
+32   204 159  203 159  203 158  204 156  205 152  208 147  211 139  216 130  220 121  224 113  227 107  230 103  231 101  231 100  232 100  233 102  234 105  236 110  239 118  242 127  245 136  247 145  250 153  252 159  255 166  256 170  257 174  258 176  258 177  258 178  258 177  258 176  
+52   44 100  45 100  46 99  47 98  48 97  48 95  49 93  50 91  52 89  53 86  54 84  56 81  57 78  58 75  60 72  61 69  62 66  63 63  64 61  66 59  67 57  67 55  68 54  68 53  68 52  69 53  70 55  71 58  72 61  74 65  75 68  77 72  78 75  80 78  82 81  80 78  82 81  83 84  84 86  85 87  86 89  87 90  87 91  88 91  88 92  88 93  88 94  89 94  89 95  89 96  90 96  90 97  
+65   170 98  170 97  170 96  170 95  171 93  171 91  172 88  172 86  173 83  174 80  175 78  176 76  178 73  179 71  180 69  182 66  183 64  184 62  185 61  186 59  186 58  187 57  188 55  189 54  190 52  190 50  191 49  191 48  192 48  192 47  192 46  192 47  193 48  194 51  195 54  196 56  198 59  199 62  200 64  201 66  202 69  203 71  204 73  205 75  205 77  206 78  207 80  208 82  209 84  211 86  213 89  215 91  213 89  215 91  217 93  218 95  219 97  220 98  221 100  221 101  222 101  222 102  222 103  222 104  223 104  
+9 b
+49   225 123  225 125  225 129  225 134  226 140  226 147  226 154  226 159  226 162  225 162  225 161  224 157  223 152  222 146  221 138  220 132  221 126  223 120  226 117  230 115  234 115  237 118  239 122  239 127  238 132  235 137  232 141  229 143  227 144  225 143  224 142  225 140  226 139  228 138  232 137  235 138  239 139  243 141  246 144  248 147  249 150  248 154  245 156  241 159  236 160  230 162  225 162  221 161  218 160  
+52   65 132  66 133  66 136  68 140  69 145  69 152  70 159  69 167  68 172  66 176  65 178  63 177  62 174  62 168  61 161  62 153  64 145  68 137  72 131  75 126  79 123  83 123  86 124  88 127  88 132  87 138  85 143  82 148  79 151  76 153  73 154  71 154  70 153  70 152  72 151  74 150  77 149  81 149  85 149  89 150  92 152  94 156  94 159  93 163  90 166  87 170  82 173  77 175  72 176  68 176  64 174  63 172  
+51   123 41  123 40  124 40  124 42  125 44  126 49  127 54  128 61  128 67  128 72  128 76  127 77  127 76  126 73  125 68  124 62  123 55  123 49  123 44  124 39  127 36  131 35  135 34  139 35  143 37  145 40  145 44  144 48  142 52  139 55  136 57  133 58  132 59  131 58  133 57  135 55  138 54  142 53  146 53  150 54  153 56  156 59  157 63  158 66  156 69  153 72  149 73  143 75  138 76  133 76  129 76  
+49   239 156  239 158  240 161  240 166  241 171  241 177  240 182  240 187  239 190  239 191  238 191  238 188  237 183  236 177  236 168  236 159  237 150  238 145  241 139  245 135  250 134  254 136  257 140  258 145  258 149  255 155  252 160  248 164  245 167  242 169  241 169  241 168  243 167  246 165  250 164  255 163  260 164  264 167  266 170  267 173  267 177  266 180  263 183  258 186  253 188  250 190  244 190  238 190  234 189  
+56   172 80  172 81  172 84  172 89  172 97  173 105  172 113  172 119  172 124  172 126  172 125  172 121  172 116  172 110  172 102  171 95  171 88  171 83  172 79  174 76  176 73  179 72  182 72  185 73  187 75  189 79  189 83  189 86  187 90  185 94  183 96  181 98  179 98  177 99  177 98  177 97  178 96  179 95  182 94  186 93  189 93  194 94  198 96  201 99  203 104  204 108  203 112  202 116  199 119  195 121  191 122  187 122  182 122  178 120  175 119  172 117  
+51   64 56  64 58  64 60  65 65  64 71  64 77  64 83  64 89  63 91  63 88  62 84  62 78  61 73  60 67  61 62  62 57  64 52  68 49  72 46  76 45  79 46  81 49  82 53  82 57  81 61  79 65  76 68  74 70  72 70  71 70  71 69  72 68  74 67  77 66  81 66  84 66  88 68  91 69  93 71  95 73  95 75  94 77  91 79  88 82  83 84  78 86  74 87  71 87  68 87  67 85  67 84  
+60   205 151  206 155  206 161  206 167  207 175  207 181  207 187  207 191  206 193  206 194  205 192  205 190  204 186  202 181  201 175  201 169  200 162  200 157  201 151  202 146  203 142  206 138  209 135  212 134  216 134  219 136  223 138  225 141  226 145  226 149  224 153  222 158  218 162  215 165  211 168  209 169  207 169  209 167  212 166  215 165  219 164  224 164  228 165  232 166  235 168  237 170  238 173  239 176  238 179  237 182  235 185  234 187  231 189  227 192  222 194  216 195  210 196  205 195  199 194  195 193  
+58   160 68  161 71  161 74  162 79  163 85  164 90  164 96  164 101  164 103  163 104  163 103  162 101  162 97  161 92  161 86  160 80  160 74  160 69  161 66  162 62  164 60  166 58  169 57  172 57  174 59  175 61  177 64  177 68  176 72  174 76  171 79  168 80  165 81  163 81  162 81  162 80  163 79  165 78  167 77  170 77  174 77  178 77  181 78  184 79  187 81  188 83  189 85  190 88  189 91  187 93  184 96  180 98  176 100  171 102  167 103  163 102  160 101  158 100  
+57   42 46  43 49  43 52  44 56  44 61  45 66  45 70  44 73  44 76  43 77  42 74  42 71  41 67  40 62  40 58  40 53  41 49  42 45  44 42  46 39  49 37  51 36  54 35  57 36  59 38  60 40  61 44  60 48  58 51  56 55  53 58  50 59  48 60  47 60  47 59  49 58  51 57  54 56  57 56  61 56  65 57  69 58  72 59  73 60  74 63  75 65  74 67  73 70  71 72  68 74  64 76  61 77  57 78  53 78  50 78  47 77  45 76  
+9 c
+37   108 124  108 125  109 125  109 126  109 127  108 126  108 124  107 122  105 120  104 118  101 115  99 114  96 113  93 113  90 114  87 117  84 120  81 123  79 128  77 133  76 139  76 144  76 150  77 155  79 160  81 164  83 168  87 170  91 172  96 171  102 170  108 168  114 166  119 163  123 161  125 159  126 158  
+38   202 89  202 90  202 91  202 90  202 89  202 88  202 86  201 85  201 83  200 82  199 81  197 81  195 81  193 81  191 82  188 83  186 85  184 87  182 91  180 95  179 99  178 103  178 108  179 113  180 117  182 120  184 123  187 125  191 126  194 126  198 126  201 124  204 123  207 122  208 120  210 119  210 118  211 117  
+36   81 56  82 56  82 55  82 54  81 54  81 53  80 53  80 52  79 51  78 50  76 49  75 49  74 49  72 50  70 51  68 53  65 55  63 58  62 60  62 62  61 64  62 67  62 70  63 72  64 75  65 77  68 78  70 79  73 80  76 79  79 79  82 77  84 76  87 75  88 74  89 73  
+41   127 144  128 144  127 144  127 143  126 142  125 141  124 140  122 138  120 137  118 137  116 136  113 136  110 136  106 138  103 139  100 142  97 146  94 150  92 156  90 162  89 170  88 177  87 184  88 190  89 196  90 202  93 206  96 210  100 213  105 214  111 214  119 213  126 210  134 207  141 203  147 200  151 197  154 195  156 194  156 193  157 193  
+36   185 56  185 57  185 58  185 57  185 56  185 55  185 53  184 52  183 51  182 50  181 49  179 48  177 48  175 47  172 49  170 51  167 53  164 56  162 60  160 65  159 69  158 74  158 79  159 83  160 87  163 92  167 95  170 96  175 96  181 95  187 93  193 90  198 86  201 84  203 82  204 81  
+36   70 35  71 35  70 35  70 34  69 34  68 33  67 32  64 31  62 30  59 29  57 28  54 27  51 28  49 29  46 31  44 33  41 35  39 38  37 41  35 45  35 49  34 54  35 58  36 61  39 65  42 67  46 69  50 71  55 72  60 72  65 71  71 69  75 68  79 66  82 65  83 64  
+30   131 130  131 129  130 128  129 126  128 124  126 122  124 120  121 119  118 119  116 119  113 120  111 121  108 123  106 127  104 130  102 135  101 140  100 146  99 151  100 155  101 159  103 162  106 164  111 166  116 166  123 165  128 163  133 160  136 158  138 156  
+33   194 43  194 44  194 45  194 44  194 43  194 42  193 41  192 39  191 38  190 37  188 36  186 35  184 35  182 35  180 36  177 38  175 40  173 43  172 47  171 51  170 56  170 61  170 65  171 69  173 73  175 75  179 76  183 77  187 77  192 76  196 75  200 74  202 73  
+38   65 42  65 41  65 40  64 40  63 39  61 38  59 37  58 36  56 36  54 35  53 36  51 36  49 37  47 38  44 39  42 41  40 43  38 45  36 48  35 51  35 55  34 58  35 61  35 64  36 67  37 70  39 73  41 75  43 76  46 77  50 78  53 79  57 79  61 78  64 77  69 76  73 74  75 73  
+9 d
+45   259 144  259 145  259 147  259 150  260 155  261 160  261 166  262 171  262 175  262 178  262 179  262 177  262 175  261 171  260 166  259 161  258 156  257 152  257 148  258 145  259 142  260 139  262 136  264 135  267 134  271 133  274 134  279 136  283 139  286 141  289 145  291 150  292 155  291 160  290 165  288 170  285 174  281 176  277 177  273 178  269 178  266 177  263 176  260 176  258 176  
+44   172 93  173 94  173 95  173 98  174 101  174 105  175 111  175 117  175 122  174 127  174 130  173 132  173 133  173 132  173 129  173 125  173 120  173 115  173 110  172 105  172 101  172 97  173 93  174 90  176 88  178 86  181 86  184 86  188 88  191 91  195 94  197 99  199 103  200 108  200 113  199 117  197 121  195 124  192 126  188 127  184 128  181 128  177 127  175 126  
+51   49 44  49 45  50 48  50 52  51 58  52 64  53 71  53 77  53 82  53 85  52 89  52 92  52 94  52 96  51 96  51 95  51 93  50 91  49 87  49 83  48 78  47 73  46 67  46 62  46 56  46 51  47 46  49 42  51 39  55 36  58 35  63 35  68 35  73 36  77 39  81 42  84 46  86 52  88 57  88 63  87 69  86 74  84 78  82 81  78 83  74 85  69 87  63 88  59 88  55 89  52 88  
+40   85 130  85 131  85 133  86 136  86 140  87 146  87 150  87 156  86 160  86 164  85 164  85 163  85 160  84 155  83 150  82 144  82 139  82 134  82 130  82 127  84 125  86 124  89 124  93 125  97 127  101 130  105 134  108 139  111 144  112 149  112 153  111 158  109 161  106 165  101 167  96 169  89 171  82 172  75 173  70 173  
+44   154 52  154 53  154 55  154 58  155 62  156 67  157 72  157 78  157 82  157 86  156 88  156 89  156 88  155 86  154 83  153 79  152 74  151 69  150 65  150 60  149 56  150 53  150 50  152 48  154 46  157 46  161 46  165 47  169 49  172 51  175 55  177 59  177 62  177 67  176 70  174 74  172 77  169 79  166 81  163 82  160 83  157 84  155 84  153 83  
+41   37 43  37 44  38 45  38 48  39 52  39 56  40 60  40 64  40 67  40 69  39 69  39 67  38 65  38 62  37 59  36 55  35 51  35 48  35 45  37 42  38 40  40 38  43 36  45 36  48 37  51 38  54 41  57 43  60 47  62 52  63 56  64 59  63 62  62 64  59 65  55 67  51 68  46 69  42 70  40 70  39 71  
+39   222 105  223 106  223 108  223 112  223 118  224 125  224 132  224 140  223 146  223 150  222 152  221 149  220 144  219 138  218 130  217 123  215 117  214 112  214 108  214 104  216 102  218 100  222 99  226 99  231 102  235 106  238 112  240 119  240 126  239 133  237 139  234 145  231 149  228 152  225 154  222 156  219 156  217 155  216 154  
+44   141 54  142 55  142 57  142 59  142 63  142 68  142 73  143 78  143 83  142 86  142 89  142 91  142 92  142 91  141 89  141 85  140 80  139 74  139 69  139 64  140 59  141 56  142 53  144 51  147 49  151 49  155 50  159 51  164 54  168 57  171 62  174 67  176 71  176 76  175 80  173 83  171 85  166 88  160 90  154 92  149 93  144 94  141 94  139 94  
+44   32 33  32 34  32 35  32 38  32 42  33 47  33 53  34 58  34 62  34 65  34 66  34 67  33 65  33 63  32 60  31 56  30 52  29 48  29 44  30 40  32 37  33 35  35 32  38 29  41 29  44 29  47 31  50 34  52 38  55 42  56 47  57 52  58 56  58 59  56 62  54 64  51 66  48 67  44 68  41 69  38 70  37 70  35 70  35 71  
+9 e
+56   279 119  279 118  278 117  277 116  277 115  276 114  275 114  273 113  271 113  269 113  266 114  263 116  259 118  255 121  253 124  251 128  250 133  251 137  252 142  254 146  256 149  258 150  261 152  263 152  265 152  267 151  269 150  270 150  270 149  271 149  270 149  268 148  267 148  265 149  263 149  261 150  259 151  257 152  254 154  252 155  250 157  248 160  247 162  247 165  248 169  251 172  254 174  258 176  263 177  268 176  273 175  278 174  283 172  286 170  289 168  290 167  
+54   167 80  167 79  167 78  166 78  165 77  163 76  161 75  159 75  155 75  152 76  149 77  147 79  144 82  143 87  142 93  142 100  144 106  146 112  149 115  153 117  156 116  159 115  162 113  164 112  165 110  166 108  165 107  163 105  161 105  159 104  155 104  152 104  149 105  146 106  143 107  140 109  137 110  136 112  134 115  134 118  134 122  134 126  135 131  136 134  139 138  142 140  145 143  149 143  154 143  159 142  164 140  168 137  171 135  173 134  
+47   62 46  63 47  62 48  62 47  61 45  60 44  59 42  57 42  55 41  53 42  50 43  48 44  45 47  43 51  41 56  40 60  40 64  41 69  43 72  46 74  49 75  52 75  55 75  58 74  60 73  61 72  61 71  60 71  59 70  56 70  53 71  50 72  46 74  43 76  41 78  39 81  38 85  38 90  38 94  40 99  43 102  47 105  51 106  57 106  61 105  66 103  70 100  
+53   263 145  263 144  263 143  262 143  262 142  260 141  259 140  256 140  253 140  250 141  247 143  244 145  242 148  241 150  239 154  239 158  240 162  241 165  243 168  246 169  250 170  253 170  256 170  258 169  259 169  260 169  260 168  260 169  259 169  258 169  257 170  255 170  253 171  250 172  247 173  243 175  240 176  237 178  234 180  233 182  232 183  232 186  233 188  235 190  237 193  240 195  244 197  249 198  254 198  259 197  263 196  267 195  269 193  
+43   183 79  183 78  182 77  181 76  180 75  178 74  174 74  170 74  167 75  163 77  160 80  159 84  158 89  158 95  159 100  161 105  164 108  167 110  169 110  172 109  174 108  175 107  176 104  175 102  174 101  172 101  169 101  166 102  162 104  158 107  155 110  152 114  151 118  150 122  150 126  152 130  154 133  157 135  162 136  167 136  172 135  177 133  182 131  
+39   75 75  75 74  74 73  73 72  71 71  69 69  64 69  60 70  55 70  51 72  47 75  45 79  43 83  43 88  44 93  46 98  48 101  51 102  54 102  56 101  57 99  58 98  58 97  57 97  54 98  51 100  47 103  43 107  39 111  36 115  35 119  34 124  36 128  39 131  43 134  49 135  55 134  61 133  66 130  
+52   256 63  256 64  257 64  256 63  256 62  255 61  254 59  252 57  250 55  248 54  245 54  242 56  239 58  236 62  233 67  231 72  230 77  231 81  232 85  234 88  237 89  241 90  244 89  247 88  249 86  250 84  251 83  250 81  249 80  247 79  245 79  242 79  240 79  237 79  234 80  231 82  228 84  226 87  224 90  223 94  222 98  222 103  223 107  225 111  227 115  231 118  236 119  241 120  247 119  252 117  257 114  261 112  
+54   160 42  160 41  159 40  158 39  157 39  155 38  154 37  152 36  150 35  149 35  148 35  146 36  144 37  142 40  140 43  138 47  137 51  137 55  138 58  139 62  141 65  143 66  145 67  146 68  148 67  149 66  150 65  151 63  152 61  152 60  151 59  149 58  147 59  144 59  141 60  137 61  134 63  130 64  127 66  126 67  124 69  123 71  123 73  124 75  126 78  128 80  132 82  136 84  141 85  146 86  152 85  157 84  161 83  164 81  
+60   71 39  71 38  71 37  71 35  70 34  70 33  69 32  68 31  66 31  64 30  62 30  60 29  57 30  54 31  51 32  48 35  46 38  44 41  43 44  42 47  41 51  42 55  43 58  44 60  47 62  49 63  51 63  54 63  56 63  58 62  59 62  59 61  60 61  59 60  58 60  56 61  54 61  52 62  50 63  48 63  46 64  44 66  42 67  41 69  40 72  39 74  38 77  38 80  38 83  38 86  39 90  40 93  42 95  45 98  47 99  52 99  57 98  62 96  66 95  71 92  
+9 f
+23   288 93  287 93  287 92  285 92  283 92  278 92  273 93  266 95  260 98  254 100  249 102  246 104  245 106  245 109  245 113  246 120  247 128  247 138  247 149  247 159  247 169  246 176  246 180  
+29   199 89  199 88  198 88  196 87  193 85  189 83  185 81  180 79  175 77  171 75  168 74  165 73  164 73  163 73  162 73  163 74  163 76  163 80  163 85  163 93  163 102  162 113  161 123  160 132  160 138  159 143  159 145  158 146  158 145  
+24   80 58  80 59  80 58  79 57  77 56  75 55  70 55  65 54  59 55  55 56  50 57  47 59  46 61  47 64  48 68  49 75  50 85  50 95  50 106  50 115  49 122  49 125  48 127  48 128  
+28   269 62  268 62  267 62  266 61  264 61  261 61  257 61  252 61  246 62  240 62  235 62  231 63  228 63  226 63  225 64  225 65  225 66  226 68  227 72  227 77  228 83  228 89  228 95  227 100  227 105  226 107  225 108  225 107  
+29   175 50  174 49  173 49  171 49  167 48  163 48  158 47  153 48  148 48  144 48  141 49  139 49  138 50  137 52  137 53  138 56  138 60  138 65  139 70  139 76  139 83  138 89  138 95  137 100  137 104  137 107  137 109  137 110  137 111  
+24   72 40  71 40  68 40  65 40  61 40  57 39  53 39  49 39  46 39  44 39  43 40  42 40  42 41  42 42  42 44  43 48  43 53  43 58  44 64  44 70  44 75  44 78  44 80  44 82  
+26   318 111  317 110  316 110  314 109  311 109  307 108  302 108  295 108  289 109  284 109  279 110  276 111  274 112  274 113  273 115  274 118  275 123  276 130  277 140  277 150  277 160  277 170  276 178  276 183  276 187  275 188  
+29   238 52  238 51  237 51  236 51  234 50  232 49  228 49  223 48  217 48  212 48  206 49  202 50  198 51  196 52  195 54  196 57  196 61  197 67  198 75  199 84  199 94  199 103  199 111  198 117  198 120  198 122  197 122  197 121  197 120  
+27   85 42  85 41  84 41  82 41  80 41  76 41  71 40  65 40  59 39  54 39  49 39  46 40  44 41  43 42  43 43  44 45  45 49  46 54  47 61  48 69  48 76  49 84  49 90  49 94  49 97  49 98  49 99  
+9 g
+37   270 90  270 89  270 88  269 86  267 85  265 85  263 86  260 88  257 92  254 97  252 104  252 111  252 117  254 123  257 126  261 128  264 128  269 127  272 126  274 124  276 122  276 119  275 117  273 115  270 113  267 111  264 111  262 110  261 110  260 110  262 110  264 110  266 110  270 109  273 109  276 108  278 107  
+48   182 55  182 56  181 54  181 53  180 51  178 49  175 48  173 46  169 46  165 47  162 49  158 52  154 57  152 63  150 69  148 77  147 85  147 92  149 99  152 104  156 107  162 109  167 110  173 109  179 107  183 104  186 101  187 97  188 93  187 88  185 85  183 81  180 79  176 77  173 77  169 77  166 77  163 78  162 78  161 79  163 79  166 79  169 79  174 78  179 78  183 77  187 76  189 75  
+37   77 46  76 45  76 44  74 42  72 41  70 40  67 40  64 41  61 43  59 47  58 51  58 56  58 60  60 65  62 69  65 72  69 73  73 74  76 73  78 72  80 70  81 68  80 66  79 64  77 62  75 61  72 60  70 60  68 60  68 61  70 61  72 62  74 61  77 61  79 61  81 60  82 60  
+50   174 145  174 144  174 143  173 143  172 141  170 140  169 139  166 138  163 137  160 137  157 138  154 140  151 143  148 147  146 153  145 159  146 165  147 171  150 176  154 179  158 182  162 182  167 181  171 180  174 177  177 174  178 171  179 168  179 166  178 163  176 161  173 160  170 159  168 158  165 159  163 159  161 160  160 160  161 160  162 160  164 160  166 160  170 159  174 158  178 157  181 156  184 155  185 155  186 155  185 155  
+49   213 59  213 58  213 57  212 56  211 56  210 54  208 53  207 52  204 51  201 52  199 53  196 56  193 61  190 66  188 72  187 79  187 85  190 92  193 97  197 101  202 104  207 105  212 104  215 102  218 99  220 96  221 91  220 87  219 83  217 81  214 78  212 77  208 76  205 75  202 75  200 75  198 76  197 76  197 77  198 78  200 79  203 79  207 79  212 79  216 79  221 77  224 76  227 76  229 75  
+41   90 51  90 50  90 49  89 48  87 47  85 46  83 46  81 46  79 46  76 48  74 50  72 54  71 58  70 62  71 67  72 71  73 75  76 79  79 82  82 85  86 86  90 86  94 85  97 83  99 80  100 78  100 75  98 72  96 71  92 70  89 70  86 70  84 71  83 72  83 73  85 73  87 73  91 73  94 72  97 72  100 71  
+57   304 116  304 115  305 116  305 115  304 115  304 114  303 112  302 110  300 108  298 106  295 106  292 106  288 107  284 109  279 112  276 116  272 121  270 126  268 133  267 140  267 146  268 152  270 158  272 162  276 165  280 167  285 168  290 167  295 165  299 163  303 160  305 157  307 155  307 153  307 151  306 150  305 148  302 146  300 145  297 144  294 143  292 144  289 144  287 144  285 144  284 145  285 145  286 145  288 145  291 144  295 144  300 143  304 142  308 141  311 140  313 140  314 139  
+51   201 92  200 92  200 91  200 90  199 89  198 88  197 87  195 87  193 87  191 88  188 90  186 92  183 95  181 99  179 104  178 110  177 117  178 123  179 128  181 132  184 135  187 137  191 137  195 136  199 134  201 132  203 130  204 127  204 125  203 124  201 122  199 121  196 121  194 121  192 121  190 121  189 122  188 122  189 122  190 122  192 122  194 122  197 121  200 121  203 120  205 120  206 119  207 119  208 119  208 118  207 118  
+60   73 51  74 51  74 52  74 51  73 51  73 50  72 49  71 47  69 46  67 45  64 44  61 44  58 45  55 46  53 48  50 51  49 54  48 57  47 61  47 65  47 69  48 73  49 77  51 81  53 85  56 88  59 90  62 91  66 92  70 91  73 90  77 89  79 87  81 85  82 83  83 81  83 79  83 77  82 75  80 74  78 73  76 72  74 72  71 72  69 72  67 72  64 72  63 72  62 72  63 72  64 72  67 72  69 71  72 71  75 70  77 70  80 69  81 69  83 68  84 68  
+9 h
+40   254 104  254 103  254 102  254 103  255 106  256 112  256 120  257 129  257 140  257 150  257 158  256 163  256 166  255 167  255 168  256 167  256 164  256 161  257 158  258 153  260 149  263 144  266 141  270 138  273 136  277 135  280 135  284 135  286 136  288 138  289 141  291 145  291 150  291 156  291 161  290 165  290 168  290 170  289 170  290 169  
+31   155 61  154 60  155 61  155 64  156 70  157 79  158 89  158 97  158 108  158 117  157 122  157 125  157 126  157 125  157 123  158 119  160 115  163 110  167 105  171 101  175 99  178 99  182 100  184 103  186 107  188 111  189 116  189 119  190 122  190 124  189 125  
+40   44 39  44 37  44 36  44 37  44 40  44 44  44 51  43 59  43 68  42 76  42 83  41 88  41 91  41 93  41 94  41 93  41 92  41 91  41 88  41 85  42 81  43 77  45 73  47 70  50 67  53 64  56 62  59 60  62 59  65 58  68 59  69 60  71 63  72 67  74 71  74 76  75 81  75 85  75 89  75 91  
+36   247 106  246 102  245 100  245 99  245 100  245 101  246 105  247 112  248 122  250 135  251 147  252 159  251 168  251 174  251 177  251 178  251 176  252 174  253 171  255 168  258 165  261 162  265 161  270 160  273 161  276 162  279 164  280 166  282 167  282 169  282 171  283 173  283 174  283 176  283 177  283 176  
+38   148 67  147 67  147 66  147 65  148 66  148 67  148 69  149 73  149 80  149 90  149 102  148 113  147 123  146 131  146 135  145 136  146 136  146 135  147 132  148 126  150 119  153 112  156 104  159 98  164 93  168 90  171 89  174 89  177 91  179 95  180 100  182 106  182 112  183 118  183 123  184 128  184 131  184 133  
+25   44 58  43 58  43 59  44 61  44 65  45 71  45 78  45 87  45 95  45 101  45 105  45 107  45 106  46 102  47 98  49 95  51 91  53 89  56 89  58 89  60 91  62 93  63 97  64 100  64 103  
+34   120 121  120 120  120 122  120 126  120 132  120 139  120 148  120 157  119 166  119 174  118 179  118 183  118 185  118 184  118 182  118 179  118 175  119 172  121 166  124 162  127 158  131 155  135 153  138 153  141 153  143 155  145 158  147 162  148 167  148 171  148 175  148 178  148 180  148 181  
+37   176 30  176 29  176 28  176 29  176 32  177 36  177 43  177 52  177 61  177 70  176 79  176 84  175 88  175 90  175 89  175 88  175 85  176 81  178 76  180 71  183 67  186 63  190 61  195 60  199 59  203 60  206 61  209 62  211 65  212 68  212 72  212 77  212 81  211 86  211 89  211 92  211 94  
+27   35 27  34 26  34 27  35 30  35 35  36 42  37 51  37 60  37 68  37 75  37 79  37 81  37 82  37 81  38 79  40 76  42 72  46 68  50 64  54 62  58 62  62 62  65 65  68 68  69 71  70 74  70 76  
+9 i
+12   172 131  173 131  174 134  175 140  176 148  177 159  179 171  180 183  181 193  182 200  182 204  182 205  
+8   77 121  78 124  79 129  80 137  81 145  82 155  83 162  83 168  
+10   282 83  282 82  283 85  284 90  284 97  285 107  286 117  286 125  286 132  286 135  
+14   221 66  222 64  223 63  223 64  222 69  220 77  218 89  215 102  212 115  209 128  208 136  207 141  207 143  207 142  
+17   128 57  128 53  128 49  127 47  127 48  128 51  129 58  130 68  133 81  135 95  137 108  139 119  141 126  142 129  143 131  142 131  142 129  
+11   47 46  46 45  46 46  46 49  45 55  45 63  45 73  45 83  45 91  45 98  45 102  
+17   197 95  198 92  198 91  198 92  198 95  199 101  199 109  199 119  199 131  199 141  198 150  198 158  198 163  198 167  198 170  198 172  198 173  
+11   117 32  118 32  118 33  118 36  119 40  119 46  119 53  120 59  120 64  120 68  120 71  
+12   39 27  39 26  39 29  38 34  38 40  38 47  38 54  38 60  38 64  38 67  38 69  39 69  
+9 j
+26   284 68  285 67  285 66  285 67  286 70  286 75  287 83  288 93  288 105  288 116  288 126  287 135  287 141  286 145  285 147  285 149  284 149  283 149  280 149  276 148  270 147  263 146  254 145  247 142  240 139  236 136  
+25   207 54  208 52  208 51  208 52  209 55  209 60  209 66  210 74  210 82  210 90  210 97  210 102  209 105  208 107  205 108  201 107  195 105  189 104  182 101  176 100  170 99  166 98  164 98  161 98  160 99  
+22   99 37  99 36  99 37  99 38  100 41  100 46  100 52  101 59  101 66  101 72  101 75  101 78  100 79  99 78  98 77  95 76  92 75  87 75  83 75  79 75  77 76  75 77  
+29   297 92  297 89  298 88  298 89  298 91  299 95  299 102  300 111  301 123  302 136  302 148  303 160  304 170  304 177  304 183  304 188  303 192  302 194  301 195  299 196  296 196  292 195  288 195  283 194  277 193  271 193  266 192  262 192  260 192  
+21   204 44  204 43  204 44  204 47  205 52  205 60  206 69  206 80  206 91  205 101  204 110  202 116  200 120  195 122  190 122  184 119  177 116  172 113  168 110  165 107  164 105  
+21   92 28  93 30  93 34  94 39  95 47  95 55  96 64  96 73  95 80  95 86  95 90  94 93  93 95  91 96  89 96  85 95  81 93  77 90  73 87  69 84  65 83  
+24   253 95  254 94  254 92  254 93  254 95  254 100  254 107  254 115  254 125  255 134  255 143  256 150  256 156  256 159  255 162  253 164  250 165  245 165  239 166  232 166  225 166  220 166  216 165  214 165  
+21   198 37  197 38  197 40  198 44  198 49  198 56  198 62  199 68  199 73  198 76  198 78  197 79  195 79  193 79  189 78  184 78  178 78  173 78  168 78  163 77  161 76  
+27   72 34  72 33  72 34  72 35  73 37  73 41  74 46  74 52  74 58  74 65  74 70  74 74  75 78  75 80  75 82  74 82  74 83  73 83  72 83  70 84  67 84  62 85  57 85  53 85  48 85  45 84  42 85  
+9 k
+29   122 132  123 131  124 130  124 131  124 132  123 136  121 140  118 146  113 154  106 161  99 168  91 174  83 178  76 180  70 182  64 182  62 180  62 179  64 177  70 175  77 174  85 174  94 174  102 177  110 180  115 183  118 186  122 189  124 191  
+35   217 51  217 52  217 53  217 55  216 58  216 62  214 66  211 72  207 78  201 84  194 90  186 95  179 99  172 101  167 103  164 104  163 104  162 105  163 105  163 104  164 104  165 104  167 103  170 103  173 103  177 103  185 106  191 110  196 115  202 121  208 128  213 137  218 146  221 154  224 160  
+25   102 41  102 40  102 41  102 42  101 44  100 46  97 49  94 53  89 56  84 60  79 63  74 65  70 66  67 67  65 67  68 66  70 65  74 65  78 66  83 68  87 70  91 73  94 76  96 78  98 80  
+28   110 130  110 131  111 133  111 137  110 142  108 148  105 154  101 159  95 163  88 165  81 166  75 166  70 166  65 164  63 163  63 161  66 160  71 159  78 159  86 159  94 160  102 163  110 166  116 170  121 174  124 177  127 178  128 179  
+24   204 73  205 73  205 75  205 79  203 84  200 91  196 99  191 107  185 113  180 116  174 118  170 118  167 117  165 114  166 111  168 108  173 106  179 105  186 105  194 107  200 109  206 111  210 113  212 114  
+24   92 54  93 54  93 55  93 56  92 59  90 62  87 67  83 71  78 76  73 81  68 84  62 85  59 85  57 83  57 81  58 78  61 76  65 74  71 73  77 73  82 74  88 75  93 77  97 79  
+38   206 115  207 115  208 115  208 117  208 120  207 125  206 131  203 139  200 146  196 153  190 158  186 160  180 162  172 163  165 162  159 161  154 159  152 158  152 156  155 154  159 153  165 151  172 151  179 151  186 152  193 155  199 158  204 162  209 166  213 172  217 177  220 182  223 187  225 190  226 193  227 194  228 195  228 194  
+29   204 53  204 52  204 54  203 56  202 60  200 64  196 69  192 73  187 76  182 78  177 78  173 78  170 77  167 76  167 74  167 72  169 71  171 70  176 70  181 71  187 73  192 76  197 80  201 83  204 87  206 90  207 92  208 94  209 95  
+29   74 35  74 36  74 38  74 41  73 46  71 51  69 57  64 61  60 66  55 69  51 70  47 71  44 70  42 69  41 68  40 67  41 66  43 66  47 65  51 65  56 65  62 66  68 68  73 70  76 72  79 73  80 74  81 75  82 76  
+9 l
+28   152 142  152 141  153 143  154 147  156 153  158 161  160 171  162 181  163 190  164 196  165 201  165 203  165 204  165 205  166 205  168 205  172 204  177 204  183 204  190 204  197 204  204 204  208 204  211 205  213 205  214 204  215 204  214 203  
+24   189 53  189 54  190 56  190 60  191 65  191 71  190 78  190 84  189 89  188 92  188 93  187 94  187 93  188 94  189 94  192 95  196 96  202 98  208 98  216 98  222 98  228 98  232 98  235 97  
+28   69 48  69 45  70 43  70 42  70 43  71 47  70 53  70 62  69 73  67 86  64 97  62 107  60 115  59 120  59 123  58 124  59 124  60 125  63 125  67 125  73 124  79 124  88 122  96 121  104 120  110 118  115 118  117 118  
+21   85 152  85 151  85 153  85 157  86 163  85 171  85 179  85 187  84 193  84 197  85 199  86 199  89 199  92 199  96 198  101 197  106 196  111 196  116 195  119 195  122 195  
+23   170 81  170 78  170 77  170 78  170 82  169 88  168 97  167 108  165 120  164 130  162 138  162 144  162 147  163 149  165 150  169 151  175 151  183 152  192 154  201 156  211 158  219 160  226 162  
+23   42 48  43 47  43 46  43 47  43 49  44 54  43 61  43 70  42 82  41 93  40 103  38 111  38 116  38 119  39 119  42 119  47 118  52 116  58 115  65 114  71 113  76 112  79 111  
+26   233 78  233 77  233 78  233 81  234 87  235 95  235 105  235 116  234 127  234 134  234 140  233 144  233 146  233 147  234 147  235 146  237 146  241 146  246 145  253 144  260 144  267 143  272 142  277 142  279 143  280 143  
+26   134 58  134 56  134 55  134 56  135 59  135 64  135 70  134 77  134 85  133 93  132 100  131 105  130 109  130 110  130 111  131 111  132 110  135 110  139 109  144 109  150 109  156 109  162 109  166 109  169 109  171 110  
+24   27 41  27 40  27 41  27 42  27 45  27 49  27 55  27 61  27 68  27 75  26 80  26 84  26 87  26 88  26 89  27 89  30 89  33 89  37 88  42 87  47 86  52 86  56 86  59 86  
+9 m
+42   266 164  267 165  267 164  267 161  267 157  267 153  268 144  270 135  272 126  274 118  277 112  279 109  281 109  283 111  286 116  288 122  289 131  291 139  291 147  292 153  291 157  291 156  291 152  291 146  292 140  293 133  294 128  296 123  298 120  300 118  303 118  305 120  308 123  311 128  313 135  315 143  316 151  316 158  316 163  315 166  315 168  315 169  
+37   184 146  183 147  183 146  183 145  183 143  183 142  184 138  185 134  186 130  188 127  189 125  191 124  192 124  193 126  194 130  195 133  197 138  198 141  198 144  199 145  200 143  201 140  203 137  205 133  208 129  210 126  211 124  212 124  213 124  213 126  214 129  215 133  217 138  218 142  219 146  219 148  220 149  
+48   64 124  63 125  63 126  62 127  62 126  61 125  62 121  62 115  64 107  65 98  68 90  71 83  72 78  74 75  75 75  75 77  76 81  78 87  80 95  82 103  84 110  85 115  86 118  87 119  87 118  87 115  88 109  89 103  91 95  94 88  96 82  98 78  100 77  101 76  102 75  102 76  103 77  104 80  105 85  106 92  107 100  107 107  108 114  109 119  109 122  110 123  110 125  110 126  
+43   271 175  271 177  271 180  271 182  271 183  271 181  271 178  271 173  271 166  273 158  275 151  277 145  280 141  282 140  284 141  286 144  287 147  288 153  289 159  289 165  290 169  290 171  290 170  291 167  292 162  294 155  296 148  299 141  302 136  305 132  308 130  311 130  313 132  315 136  317 141  318 147  319 153  320 157  321 160  321 163  321 165  321 166  321 167  
+37   191 128  191 130  191 131  191 132  191 131  191 129  191 126  192 120  193 114  195 107  198 100  200 95  203 93  205 93  207 96  209 101  210 108  211 114  212 120  212 124  212 127  213 125  214 121  215 115  217 109  220 102  222 97  224 93  226 92  228 94  230 98  231 105  233 113  235 121  236 129  237 134  237 137  
+46   54 104  54 107  55 109  55 110  54 108  53 104  53 98  52 90  52 82  53 74  56 67  59 62  62 58  67 57  70 57  74 60  76 64  78 70  80 77  81 85  81 92  81 98  81 102  81 103  80 102  81 97  81 92  83 85  85 78  87 71  90 67  93 64  95 61  98 60  100 59  103 60  105 61  107 65  109 70  111 77  112 86  113 94  113 102  113 107  114 111  114 112  
+35   74 202  74 203  74 204  74 203  74 201  74 198  75 195  76 191  78 187  80 184  82 181  84 181  86 181  87 184  89 187  89 191  90 195  90 198  90 200  91 201  91 200  93 198  95 195  97 191  100 187  103 184  105 182  107 182  109 183  110 187  112 192  113 197  114 202  115 206  115 209  
+48   163 118  163 119  163 120  163 119  163 118  163 114  162 108  162 100  164 91  166 83  168 76  171 71  174 69  178 69  181 71  184 74  186 78  188 84  189 92  189 99  189 104  188 109  188 112  187 112  188 111  188 107  189 102  190 96  192 89  194 83  196 78  198 75  199 73  202 72  204 72  206 72  208 72  211 74  213 76  215 80  216 85  217 93  218 100  219 107  219 113  219 117  219 118  219 117  
+47   32 81  32 82  32 81  32 79  32 76  32 71  33 66  34 60  35 54  36 49  37 45  38 42  38 41  39 40  40 40  40 41  42 43  43 47  45 53  47 59  49 64  51 69  52 72  53 74  54 75  54 74  54 73  55 70  56 66  58 61  60 57  63 52  67 48  69 44  71 42  72 41  73 41  74 41  74 43  75 47  75 52  76 58  78 64  78 69  79 73  80 75  81 76  
+9 n
+34   126 204  126 203  126 201  126 199  127 196  128 191  129 185  131 179  133 173  134 169  135 166  136 165  136 166  137 167  138 170  140 174  144 180  147 186  151 192  155 197  158 200  160 202  162 203  163 202  164 199  164 194  164 187  164 178  165 169  165 161  166 154  166 149  167 146  167 144  
+35   211 142  211 143  211 142  211 140  210 137  210 131  210 124  211 116  211 108  212 101  212 97  212 94  213 93  214 96  216 100  219 106  222 113  226 122  230 130  234 136  236 140  238 142  239 142  239 141  240 139  240 135  240 130  241 122  241 112  241 102  241 93  241 84  241 78  240 75  240 74  
+37   95 131  95 132  95 133  94 132  93 130  92 126  92 120  92 111  93 103  95 94  98 86  101 81  104 78  106 76  108 77  109 79  112 83  114 88  117 94  120 101  122 108  124 113  126 118  127 121  129 124  129 126  130 126  130 125  131 120  133 113  135 103  137 93  138 84  139 77  140 73  141 72  141 71  
+34   237 190  237 189  237 188  237 185  238 180  240 174  242 166  244 157  247 149  249 143  251 138  252 136  253 135  254 137  256 141  258 147  261 155  265 165  269 175  272 183  275 189  277 193  279 194  280 194  281 192  281 188  282 181  284 172  285 160  286 149  286 140  286 132  286 127  286 124  
+34   177 117  176 117  175 116  174 114  173 111  172 105  171 99  171 91  170 84  170 79  170 75  170 73  170 72  171 72  173 75  177 80  181 87  187 95  192 103  196 111  199 116  201 119  202 120  202 119  202 115  203 110  203 103  204 95  204 86  205 79  205 73  206 68  206 65  206 64  
+34   54 116  54 115  53 113  53 110  53 106  53 99  53 92  55 85  56 78  58 73  60 69  62 67  63 66  64 65  67 66  68 68  70 70  72 74  74 79  76 85  78 91  79 98  81 103  81 107  82 110  82 108  83 105  84 99  85 92  86 84  87 77  88 72  89 69  90 66  
+39   231 160  230 160  229 159  228 157  227 153  227 149  227 141  227 130  228 119  228 109  229 99  230 93  230 90  231 89  232 90  234 95  237 101  241 109  247 119  253 130  258 139  264 146  268 151  271 155  274 157  275 157  276 157  277 155  277 152  277 147  278 140  278 131  278 121  278 110  278 100  278 91  277 84  276 79  276 77  
+37   148 137  147 138  147 139  146 139  146 138  146 136  145 132  144 128  144 122  144 116  143 110  143 106  143 103  143 102  144 101  144 102  146 104  147 108  150 112  154 118  158 124  161 129  164 133  167 135  168 137  169 137  170 137  170 136  170 134  170 132  170 128  170 124  170 118  170 112  170 107  170 102  170 99  
+36   37 111  37 112  37 111  36 109  36 106  37 101  37 94  37 85  37 77  38 70  38 64  39 61  39 59  39 58  40 60  41 62  44 66  47 73  51 82  55 90  59 98  62 103  64 107  66 108  68 107  68 106  69 104  70 100  71 96  72 90  72 84  72 78  72 72  72 67  72 63  71 61  
+9 o
+26   268 136  267 135  266 134  265 133  263 133  261 134  258 136  255 138  251 143  249 148  247 154  248 161  250 166  254 171  259 174  264 175  269 174  273 172  277 169  279 164  280 159  280 153  279 147  277 142  274 138  270 136  
+31   170 68  170 66  169 64  168 62  166 62  163 62  159 65  155 70  151 77  147 87  146 97  147 108  151 117  156 125  163 129  170 130  178 129  185 125  191 119  194 111  197 101  197 91  196 82  193 74  189 68  183 65  176 63  169 64  162 65  157 68  153 70  
+26   79 51  77 51  76 52  74 54  72 57  70 60  69 65  69 71  70 76  73 81  77 84  81 87  85 87  88 86  91 83  93 79  94 74  94 68  93 63  91 59  88 55  84 53  81 52  78 51  76 52  76 54  
+25   271 158  270 158  267 159  265 160  262 164  260 169  258 176  257 183  258 190  260 196  263 200  268 202  274 201  279 198  285 194  289 189  291 183  292 176  290 170  287 164  283 160  277 157  271 157  265 158  261 159  
+26   175 87  174 86  172 86  170 87  167 89  164 93  161 100  159 108  158 117  160 125  163 131  169 135  176 137  183 137  189 134  195 130  200 124  202 117  203 109  203 101  200 93  195 87  188 84  181 84  173 85  166 88  
+29   62 68  61 67  60 66  58 66  56 68  53 71  51 76  49 83  48 92  49 101  52 109  56 115  62 119  68 120  74 119  79 116  83 111  85 105  87 97  87 89  86 81  83 74  79 70  74 67  67 67  60 68  55 71  51 75  50 78  
+33   264 90  265 87  265 85  263 83  261 83  257 83  253 85  247 89  241 96  236 106  231 118  228 131  228 144  230 154  235 162  243 168  251 170  260 168  270 163  279 155  286 145  291 135  293 127  294 115  291 104  286 95  279 88  271 84  261 84  253 86  244 89  239 94  235 98  
+24   157 117  157 116  155 116  154 117  152 120  149 124  147 130  145 136  144 143  145 149  148 153  151 155  156 155  160 154  165 150  168 146  170 140  171 135  170 129  169 125  166 121  162 119  158 119  154 120  
+25   71 63  69 62  65 63  62 67  58 72  55 81  54 91  53 102  55 112  59 120  64 124  71 125  77 122  82 118  86 111  88 103  89 94  88 85  87 77  84 71  79 66  75 65  70 64  67 65  63 66  
+9 p
+39   262 144  262 143  262 144  263 146  264 150  265 155  266 161  267 167  267 173  267 177  267 180  266 181  265 180  264 177  263 172  262 166  261 159  260 151  260 145  261 139  263 135  267 131  272 128  277 126  283 125  288 127  292 129  296 134  298 138  298 143  297 147  295 152  291 155  287 157  281 158  273 159  265 160  258 160  252 159  
+36   195 93  195 92  196 94  196 97  197 102  198 108  198 115  199 123  199 131  198 136  198 140  197 142  196 139  195 133  194 126  193 117  192 109  192 101  192 94  194 89  196 85  199 83  203 83  207 84  211 86  215 90  217 95  219 100  218 106  217 111  214 115  210 119  205 121  200 122  196 122  193 121  
+36   85 78  86 80  86 84  87 89  89 95  90 103  91 110  92 117  92 122  91 125  91 127  90 126  89 124  88 121  87 114  86 105  85 96  85 88  86 80  87 75  90 72  94 70  97 69  102 69  106 71  110 74  113 78  113 82  112 86  110 89  106 92  102 95  97 98  93 99  89 101  86 101  
+35   248 100  248 103  249 106  250 112  251 121  252 130  253 141  254 150  254 158  255 163  254 167  253 166  251 163  249 157  247 148  244 137  242 126  241 113  242 103  244 94  248 86  253 82  259 80  266 80  273 83  279 89  284 96  287 103  286 111  284 118  279 124  273 128  266 131  259 133  254 132  
+32   148 129  149 130  150 133  151 137  152 143  153 150  154 157  154 162  154 166  154 169  153 169  152 167  151 163  150 158  148 151  147 142  147 134  148 127  149 122  153 119  156 117  160 117  164 119  167 122  169 126  170 130  169 134  166 138  162 141  158 143  152 144  148 145  
+32   57 79  57 80  58 84  58 89  60 95  61 103  62 110  62 117  61 121  60 123  58 122  56 118  54 111  52 103  51 93  51 83  53 74  56 68  61 63  67 61  73 61  79 63  83 66  86 70  87 75  85 81  81 86  76 91  71 95  64 97  61 98  58 98  
+37   209 121  209 122  210 124  211 128  211 133  213 140  214 148  214 155  215 161  215 166  214 169  214 171  212 171  211 169  210 164  209 157  208 147  207 137  208 126  210 116  212 108  215 100  220 95  224 93  228 92  234 93  239 97  243 102  245 108  246 114  244 121  240 126  235 129  229 131  223 132  217 132  212 132  
+38   131 58  131 57  131 58  132 59  133 62  134 66  135 71  136 77  136 83  136 89  136 93  136 95  135 95  134 93  134 88  132 83  131 76  130 69  130 63  130 57  132 52  135 48  138 45  141 43  145 42  149 42  154 45  157 48  159 52  161 57  160 61  159 65  156 68  153 70  148 71  144 71  140 71  136 71  
+37   37 62  37 61  38 60  38 61  38 63  38 66  39 71  40 77  40 84  40 89  40 94  40 97  40 99  39 97  39 94  38 89  37 82  36 75  36 68  37 61  38 56  40 51  42 47  46 44  49 43  53 42  56 43  59 46  61 50  62 54  61 59  59 63  55 66  51 69  46 71  42 72  40 71  
+9 q
+44   277 138  277 139  277 138  276 138  275 137  273 136  271 136  268 137  264 139  259 142  254 148  251 155  248 162  248 170  250 177  254 183  260 187  266 188  272 187  278 184  284 180  288 174  291 167  292 159  291 153  289 147  285 143  280 140  275 139  271 138  267 138  264 138  263 139  264 139  266 140  271 140  276 140  283 139  289 137  295 136  300 134  303 133  306 132  307 132  
+39   170 81  170 79  169 78  167 78  164 80  161 84  158 90  156 99  155 108  155 118  157 126  161 132  167 136  173 137  180 135  186 133  191 128  194 122  196 113  196 104  195 95  191 88  186 82  180 79  175 77  170 77  166 79  165 82  167 86  170 89  176 92  183 94  191 93  200 91  209 88  217 85  224 82  228 80  231 79  
+38   67 65  67 64  67 63  65 63  63 64  60 65  56 69  52 74  48 82  45 92  44 104  44 115  46 125  50 132  55 136  61 136  66 134  73 130  77 124  79 115  81 105  81 95  80 85  78 76  75 71  71 68  65 67  61 68  57 70  55 73  54 76  56 79  59 82  64 83  72 84  77 82  84 80  88 77  
+36   236 157  236 156  235 156  234 157  233 159  232 162  230 165  229 170  228 175  229 179  230 183  233 186  237 188  241 189  244 189  248 188  250 185  252 181  252 177  252 171  252 166  250 161  247 158  244 155  241 155  237 155  234 156  231 157  230 159  231 160  233 160  238 160  244 159  251 157  257 154  263 152  
+43   174 84  174 83  174 81  173 80  172 79  170 78  168 77  164 77  160 78  156 81  151 84  147 90  144 96  142 104  142 112  143 118  145 123  149 127  154 128  160 128  166 126  171 121  176 115  179 108  181 99  182 91  181 84  179 78  176 74  172 71  167 70  163 71  158 72  155 74  154 76  154 78  156 79  160 80  165 80  170 79  176 77  181 76  184 75  
+38   62 54  60 52  58 51  56 51  54 52  51 54  49 56  47 60  46 66  45 73  46 81  47 90  50 96  54 101  59 104  62 104  68 101  73 97  77 90  79 82  79 74  78 68  75 62  72 58  67 55  62 53  58 53  55 53  53 54  52 56  54 58  57 60  62 62  69 63  75 63  82 62  87 60  92 59  
+52   244 122  243 120  242 118  241 117  239 116  236 117  232 119  228 123  224 130  220 138  217 147  216 156  217 166  220 174  225 181  232 185  239 187  246 187  254 184  260 179  267 174  272 168  275 161  278 154  279 148  278 142  276 136  272 130  267 126  262 122  255 119  249 116  243 115  238 114  234 114  232 114  231 115  231 116  232 117  233 118  234 119  235 120  236 120  237 120  240 119  244 118  250 116  258 113  266 110  274 107  280 105  284 103  
+40   165 67  165 66  164 65  162 66  159 67  157 68  154 72  152 76  151 82  151 89  152 95  155 100  158 103  162 104  166 103  170 100  173 96  175 90  176 85  175 80  174 75  172 71  170 69  167 67  164 66  162 65  160 64  158 64  157 63  156 63  157 63  159 64  162 63  166 63  171 62  177 61  187 59  191 59  193 59  195 58  
+49   47 45  47 44  46 44  45 43  44 43  42 43  40 44  38 46  35 50  34 54  33 60  33 66  34 71  37 77  40 81  45 84  50 86  55 85  61 84  65 81  69 77  71 73  72 68  72 63  71 58  68 54  64 50  61 47  58 45  54 43  51 42  49 42  47 42  45 42  44 42  44 43  43 43  43 42  43 43  44 43  46 44  49 44  54 43  59 42  67 41  74 40  80 39  85 38  88 37  
+9 r
+41   244 138  244 140  244 142  245 147  245 152  246 158  246 163  246 167  246 170  245 168  244 164  243 159  241 152  240 144  240 137  242 131  244 127  248 123  252 121  257 121  260 123  261 127  261 132  259 138  255 144  252 149  249 152  246 154  246 155  247 154  250 154  254 154  260 155  266 156  273 159  279 162  284 165  288 168  291 170  292 171  291 170  
+38   145 85  146 83  147 85  149 89  150 96  151 104  152 112  152 119  152 123  151 121  150 115  150 107  149 99  150 90  152 84  155 79  160 76  165 76  169 78  172 81  174 85  174 91  173 97  170 102  168 106  165 109  163 110  162 111  164 112  167 113  171 115  176 117  183 119  190 122  195 124  200 125  203 125  204 125  
+38   51 64  52 63  52 64  53 66  53 70  54 76  54 82  54 88  53 94  53 98  52 100  51 99  51 96  50 90  50 83  51 74  53 66  56 60  59 56  63 54  67 54  70 56  71 59  71 63  70 67  68 72  64 76  63 79  63 82  64 85  68 87  73 90  78 92  84 94  89 96  94 98  98 100  102 100  
+51   244 137  245 138  246 139  247 143  248 149  249 158  250 167  251 176  251 184  251 187  251 190  250 191  248 187  247 182  245 175  243 167  242 158  241 151  242 144  243 138  245 133  249 129  253 126  258 124  264 124  269 125  273 128  276 133  276 140  274 146  270 153  265 159  260 163  256 164  251 166  247 165  246 164  246 163  250 161  255 161  261 162  268 164  275 168  282 173  287 177  291 182  295 187  297 189  298 191  299 192  299 191  
+51   162 51  162 53  163 57  164 62  166 70  167 78  168 87  169 95  169 101  169 106  169 109  168 110  167 109  166 106  164 103  162 98  160 91  157 85  156 78  154 71  154 65  154 59  156 54  159 49  162 45  166 43  170 41  175 41  179 43  182 45  184 50  184 55  182 60  179 66  175 70  170 73  167 75  165 76  164 77  166 77  170 77  176 78  183 80  188 82  196 86  203 89  208 93  212 95  214 96  214 97  213 96  
+48   49 50  49 51  50 54  51 58  52 63  53 69  54 76  53 83  53 88  52 93  51 95  50 94  49 91  48 86  46 81  44 74  42 67  41 61  41 56  41 51  43 47  46 43  50 41  55 39  59 38  64 39  68 40  70 43  70 48  69 53  65 58  62 63  59 66  56 68  55 69  54 70  55 70  58 71  62 72  68 74  74 76  80 79  85 82  90 85  93 88  94 89  95 90  95 89  
+39   200 156  201 159  202 163  203 168  203 175  204 181  204 186  203 190  203 191  202 190  202 186  201 181  200 175  199 168  199 162  199 157  200 153  203 150  205 149  208 149  211 150  213 152  215 154  215 158  214 161  212 164  209 167  208 169  206 170  205 171  206 172  207 173  210 174  215 176  220 178  226 179  233 181  238 182  243 183  
+41   146 58  146 59  146 62  146 66  146 72  147 80  147 87  147 95  146 100  146 103  146 102  146 99  145 95  144 88  143 81  142 74  141 67  141 61  143 56  147 53  152 50  157 48  163 49  167 51  170 54  171 59  169 64  166 69  162 73  158 76  155 77  153 78  153 79  155 80  159 81  169 85  176 89  183 93  188 97  193 99  196 100  
+40   26 51  26 50  26 52  26 56  27 60  28 66  28 73  29 79  29 83  28 86  28 87  27 85  26 81  24 75  24 68  23 61  24 54  26 48  30 43  35 41  40 40  45 40  49 43  50 46  50 52  48 58  43 63  39 68  35 71  32 74  31 75  32 75  35 76  39 77  45 78  51 81  57 84  61 87  64 89  67 90  
+9 s
+39   262 141  262 140  263 139  263 138  263 137  262 135  261 133  258 132  254 131  250 130  245 130  241 132  237 134  234 137  233 141  232 144  234 150  236 155  240 159  244 163  249 166  254 168  258 170  261 173  263 175  263 178  263 182  260 185  257 188  251 190  245 191  238 192  231 191  224 189  219 186  215 182  213 179  212 175  212 173  
+31   194 65  194 64  193 63  192 62  189 61  186 61  181 63  176 65  172 68  169 72  168 76  169 79  172 82  177 86  182 89  187 93  191 97  193 101  193 104  192 108  188 110  184 112  178 113  171 113  165 112  160 111  155 109  153 107  152 106  152 104  154 102  
+30   84 56  84 54  83 53  82 52  80 51  77 52  74 54  70 57  65 60  64 63  62 66  63 69  65 72  70 74  75 76  79 78  82 80  84 83  85 86  84 89  82 92  79 94  74 96  69 98  62 99  57 99  52 99  49 98  48 97  48 95  
+34   270 96  271 94  271 92  270 89  268 87  264 84  260 82  254 81  248 81  242 83  237 87  233 92  232 98  233 102  235 107  240 114  246 121  253 127  260 133  265 138  269 142  271 147  271 151  269 156  266 160  261 163  255 166  248 167  243 167  237 165  231 163  227 160  224 157  223 154  
+33   174 84  174 83  174 82  173 81  171 79  169 78  166 77  161 77  157 78  152 80  148 83  146 86  146 90  147 94  151 99  156 103  161 107  167 111  172 115  175 118  177 121  177 124  176 127  174 130  170 133  166 135  160 136  157 136  151 135  145 134  140 131  136 129  133 127  
+27   80 50  80 49  80 47  79 46  76 46  73 47  69 49  63 52  58 57  55 61  53 66  55 70  58 74  63 76  70 79  75 82  79 86  82 91  82 96  79 100  75 105  70 108  62 110  56 111  51 111  48 110  46 107  
+42   302 74  301 74  300 74  299 72  298 71  296 68  294 66  292 63  289 62  284 62  280 63  275 66  270 70  266 75  264 82  263 90  264 97  266 104  269 109  274 112  279 114  284 115  289 117  293 119  297 122  300 125  301 129  302 135  302 139  300 144  297 148  293 152  288 155  282 157  275 158  268 158  261 157  255 154  250 150  246 147  244 144  242 141  
+37   190 95  190 94  189 93  188 91  186 90  184 89  181 89  178 90  176 92  174 95  172 99  172 102  172 106  173 109  174 112  176 114  178 115  180 116  182 117  184 117  186 118  188 119  190 121  192 123  193 125  193 127  193 130  192 132  190 134  188 136  184 137  181 138  177 139  173 139  170 138  167 137  165 136  
+41   71 42  70 42  69 41  67 41  64 40  60 40  57 40  53 42  50 44  48 46  46 49  45 52  46 56  47 58  48 60  51 62  53 63  56 63  60 63  63 63  67 64  70 65  73 66  75 68  77 70  78 73  79 74  79 77  79 79  78 82  77 84  75 86  72 88  68 89  63 90  59 91  55 91  51 90  48 89  45 88  42 86  
+9 t
+28   240 78  240 79  242 79  245 80  250 81  257 81  264 81  272 81  279 81  285 81  289 81  292 80  293 80  293 81  292 82  292 85  291 90  290 98  288 108  286 118  284 129  281 138  279 146  277 151  276 155  275 157  275 158  274 158  
+27   147 52  145 52  145 51  144 51  144 52  146 53  150 53  155 53  162 53  169 52  175 51  180 50  184 50  186 50  187 50  187 51  186 52  186 56  187 61  187 69  188 79  189 90  190 100  191 110  192 116  193 121  193 123  
+24   38 38  36 38  36 37  39 37  42 37  47 37  53 37  60 37  66 37  71 37  74 38  75 38  75 40  75 42  75 46  74 52  74 59  73 69  73 79  72 88  71 95  70 100  69 102  69 101  
+29   268 93  266 93  265 92  264 92  263 91  264 91  266 90  271 90  278 89  286 88  294 87  302 86  308 86  312 86  314 87  315 87  315 89  315 92  315 98  314 105  314 115  314 126  314 136  315 145  315 152  315 157  316 160  316 162  315 161  
+30   171 77  170 77  169 77  170 77  171 77  175 76  180 76  186 76  192 75  198 75  203 75  206 75  209 76  210 76  211 78  211 81  210 85  210 92  210 102  210 113  210 125  210 136  210 146  210 155  210 163  210 168  211 173  211 175  211 177  210 177  
+27   57 65  56 65  56 64  58 64  61 65  67 64  72 64  78 63  84 63  89 63  92 63  94 63  94 64  94 65  94 68  93 71  93 76  92 85  92 94  92 104  92 112  92 120  92 124  92 126  92 127  92 126  92 125  
+24   258 80  257 80  256 80  258 79  261 79  266 77  271 76  278 74  283 73  286 72  289 72  291 71  292 71  292 72  292 73  292 75  292 80  293 87  293 96  294 105  295 113  295 119  295 123  295 125  
+27   159 50  157 49  157 50  159 50  163 52  168 54  175 56  183 59  190 62  197 64  201 65  204 66  206 67  207 67  207 68  207 69  206 72  205 77  203 84  201 94  198 104  195 112  193 119  193 124  192 126  193 125  193 124  
+25   21 41  22 41  24 42  28 41  34 40  40 40  48 39  56 38  61 38  67 38  69 38  71 39  70 41  70 43  68 47  67 53  64 61  62 70  61 78  59 87  58 93  58 98  58 101  58 100  59 97  
+9 u
+24   229 142  230 140  230 138  231 138  231 140  231 142  231 147  232 154  233 162  235 170  237 178  240 184  244 188  249 189  253 188  257 186  261 181  263 175  265 167  266 159  266 152  266 145  266 141  265 139  
+22   154 93  154 91  154 90  155 92  155 96  157 102  158 110  160 119  162 128  164 135  167 140  170 142  174 142  178 140  181 136  184 131  186 123  187 114  188 105  188 97  188 91  187 89  
+21   60 58  60 59  60 61  60 64  60 69  61 75  62 82  63 90  66 96  70 103  73 106  77 108  81 107  84 104  87 99  90 93  92 85  93 78  93 72  93 66  92 62  
+24   220 119  220 117  220 118  220 120  220 124  220 130  221 137  222 145  224 153  227 160  231 165  236 168  242 168  248 166  253 162  258 157  261 149  263 141  265 133  265 127  265 121  264 117  264 114  263 112  
+21   142 50  141 49  142 52  142 54  143 59  144 65  147 73  150 81  154 87  160 91  165 93  170 93  175 91  178 87  180 82  182 76  182 71  182 66  181 62  180 60  180 59  
+20   44 40  44 41  43 45  43 50  43 57  45 65  47 73  50 81  54 87  59 91  65 92  71 90  74 87  77 82  79 77  80 72  80 67  79 63  79 59  79 57  
+21   224 125  225 127  225 130  226 135  227 141  228 148  230 155  233 161  236 165  240 168  243 168  247 166  250 163  252 158  254 151  255 144  256 136  257 129  257 124  257 121  257 119  
+23   133 67  133 66  133 65  133 66  133 69  134 73  135 80  136 88  138 98  141 106  145 112  150 116  156 116  159 115  164 110  168 102  171 94  173 85  173 77  173 70  172 66  171 63  170 60  
+21   30 53  30 54  30 56  30 60  31 64  33 70  35 76  39 82  42 86  46 88  50 88  54 86  57 83  59 78  61 74  61 68  61 63  60 58  59 54  58 50  57 47  
+9 v
+31   250 157  249 156  250 156  250 157  252 160  254 165  257 171  260 179  263 186  266 192  267 196  269 198  270 198  272 195  274 191  276 184  278 176  281 168  283 162  284 157  285 155  286 154  287 154  289 154  292 155  296 155  301 155  305 155  308 154  311 154  313 153  
+32   164 114  163 112  163 110  163 109  163 111  165 114  167 120  170 127  173 136  175 144  178 151  181 156  184 158  187 158  190 155  193 150  196 143  199 135  201 127  202 120  202 114  203 111  203 109  203 108  204 108  206 108  209 109  213 109  218 109  222 108  226 106  229 105  
+31   60 66  61 65  61 64  61 65  62 66  64 68  67 74  70 81  74 90  77 99  81 107  84 113  86 117  88 117  90 114  92 108  94 101  95 92  95 84  95 77  95 71  94 68  94 65  94 64  96 63  98 62  102 60  107 59  112 58  117 56  120 55  
+34   259 150  258 150  258 151  259 151  260 152  261 155  262 158  264 164  267 170  269 177  271 183  274 188  277 190  281 190  284 187  288 182  291 175  292 169  293 162  294 157  293 153  293 150  292 149  292 148  293 148  294 148  297 148  301 147  306 146  311 144  316 143  319 141  322 141  324 141  
+33   168 101  168 98  168 97  168 96  168 97  169 100  170 104  173 111  175 118  178 126  181 132  183 137  185 140  186 141  187 140  188 136  189 131  191 122  192 113  193 105  194 98  194 94  195 92  195 91  196 91  198 91  200 91  204 91  208 91  212 90  215 89  218 89  219 89  
+32   57 58  57 57  57 56  58 57  58 58  60 62  62 68  64 76  66 86  69 95  71 102  74 106  76 107  79 105  81 100  83 93  85 86  86 78  87 72  87 67  87 63  87 62  86 61  87 61  87 62  89 62  91 62  95 62  99 62  104 61  107 61  110 60  
+31   80 155  80 153  79 152  80 153  81 155  83 160  86 167  90 174  94 181  98 187  102 191  105 192  108 192  111 190  113 185  115 179  116 172  116 165  115 159  115 155  114 153  114 152  114 151  116 151  119 151  124 151  128 151  134 150  138 150  142 149  145 149  
+30   160 93  161 91  162 91  164 94  166 99  168 105  171 112  174 120  177 127  180 132  183 135  185 136  187 135  189 131  190 126  191 118  192 110  192 102  191 96  191 91  191 88  192 86  194 86  197 85  202 84  207 84  212 83  217 82  221 82  223 82  
+29   48 58  48 57  47 56  47 55  48 57  49 59  51 64  54 71  58 79  61 88  63 95  66 100  68 102  70 101  72 97  73 91  74 84  75 76  76 69  76 63  76 59  75 57  76 56  77 56  79 56  81 56  85 56  89 56  93 55  
+9 w
+41   257 148  257 147  257 146  257 147  257 149  257 154  257 161  257 170  258 179  259 187  260 193  262 196  264 197  267 195  269 192  272 187  273 182  275 176  276 170  277 166  278 163  278 162  278 163  279 165  281 168  283 173  286 177  289 182  291 186  294 188  296 188  299 187  300 184  301 178  303 172  304 163  304 154  304 146  304 139  303 133  302 130  
+43   159 64  158 61  158 60  158 61  159 65  161 70  163 79  167 90  171 101  176 113  179 122  183 128  185 131  186 130  188 125  189 117  191 107  194 96  196 85  198 78  199 74  200 72  200 70  200 71  201 72  202 76  204 83  206 92  208 101  211 111  213 119  216 125  218 128  219 129  221 126  223 121  225 112  227 102  229 90  231 79  232 69  232 62  233 57  
+39   37 63  37 61  37 59  36 58  37 61  38 65  38 72  40 80  42 89  44 96  46 101  48 102  50 100  52 96  54 91  56 85  58 79  59 76  60 73  60 72  60 71  61 72  62 74  64 77  67 82  70 87  72 92  75 96  76 98  77 99  79 98  80 95  81 90  82 84  83 76  84 68  84 62  84 58  83 55  
+37   249 123  249 122  249 123  249 124  249 128  248 132  248 139  249 146  250 153  252 159  254 162  257 164  259 163  261 161  263 158  265 154  266 150  266 147  267 146  267 145  268 146  269 149  270 152  272 157  275 161  278 165  282 167  286 166  290 163  294 159  296 153  298 146  299 140  298 135  298 130  297 128  296 126  
+35   159 100  159 98  159 97  158 99  158 103  158 108  158 115  158 123  159 129  161 134  164 136  167 137  171 136  174 134  177 131  179 127  180 125  181 122  181 121  182 122  182 123  183 125  184 129  186 131  189 133  191 135  194 135  196 133  199 131  200 128  202 123  202 117  202 111  201 106  200 101  
+44   35 49  35 47  35 46  34 47  34 48  33 52  32 57  31 64  31 72  31 79  32 88  35 96  38 102  43 105  48 106  54 103  58 99  62 93  65 87  67 81  68 76  68 73  68 71  68 70  68 71  69 73  70 75  71 79  73 84  75 90  77 94  80 98  84 101  87 102  91 101  95 99  98 95  101 89  104 82  104 74  104 66  102 59  99 53  96 48  
+43   229 129  229 127  229 124  230 122  230 121  230 123  230 126  230 132  230 141  230 150  231 160  232 168  234 174  237 177  241 177  245 176  249 172  253 167  256 161  258 156  259 150  260 146  260 144  261 143  261 144  262 146  263 149  264 153  266 158  269 163  270 167  273 170  275 171  277 169  280 166  282 161  284 154  286 146  286 137  286 129  285 122  284 116  282 111  
+37   129 69  128 68  127 67  126 69  126 73  126 78  126 86  126 94  128 103  129 109  130 114  133 116  135 115  138 112  140 107  142 102  144 96  145 92  145 90  146 90  148 92  150 97  153 102  157 108  160 113  163 117  167 119  169 118  171 115  173 109  174 101  175 93  175 85  175 80  174 74  173 71  172 69  
+34   33 39  33 37  32 37  32 39  32 43  32 50  33 57  33 65  34 72  35 77  37 79  38 80  40 78  42 76  45 72  46 68  48 65  49 64  51 64  53 67  55 70  59 73  62 76  65 77  69 78  71 76  73 74  75 70  75 64  76 59  76 53  75 48  74 44  73 41  
+9 x
+37   259 144  258 143  257 142  256 141  255 140  256 141  258 143  261 146  265 150  270 155  276 160  283 165  289 168  295 171  300 172  304 172  308 172  310 170  311 168  311 165  309 163  307 161  304 160  300 161  296 161  291 163  286 166  281 169  276 174  271 178  267 183  264 188  262 191  261 193  261 194  260 195  259 195  
+33   181 87  180 85  180 84  179 84  180 85  180 87  182 91  185 95  188 100  193 106  199 111  205 115  211 116  217 116  222 115  226 113  228 111  229 108  229 107  227 106  224 106  220 107  215 109  208 112  202 115  194 119  187 123  181 128  175 132  171 135  169 138  168 140  168 142  
+30   54 48  53 47  52 47  52 48  54 51  56 56  60 61  65 67  72 74  77 79  83 83  89 85  93 86  97 85  99 83  100 81  100 79  99 76  97 75  94 74  90 74  85 75  79 78  73 82  67 87  61 91  57 95  54 99  53 101  53 103  
+37   227 154  227 153  227 154  227 155  228 157  230 160  233 164  237 169  241 174  246 178  251 181  255 183  258 184  261 184  262 183  263 183  263 181  263 180  263 178  262 177  261 176  260 175  258 175  255 176  251 177  247 178  242 180  238 182  233 185  229 187  226 189  224 190  223 190  222 191  221 191  220 191  218 192  
+37   162 72  161 71  162 72  163 75  165 79  168 84  172 90  177 97  183 103  189 108  195 110  201 111  206 110  212 107  216 103  220 99  222 95  223 92  223 89  222 88  220 86  216 86  213 85  208 85  203 86  198 87  192 89  187 92  181 96  175 100  169 106  163 113  157 119  152 125  147 129  144 131  143 132  
+32   46 52  45 51  45 50  46 52  48 55  51 59  56 65  61 71  66 76  72 80  77 83  81 83  85 83  87 82  89 80  89 78  89 76  89 74  88 73  87 72  85 71  83 71  81 72  78 73  73 75  69 77  63 81  59 85  55 89  53 93  52 95  52 97  
+34   213 130  212 130  211 130  212 131  214 134  216 139  219 144  224 151  229 157  235 161  241 164  247 166  253 166  258 164  261 162  264 159  266 157  266 154  266 152  264 151  261 151  258 151  252 153  246 155  239 159  232 162  224 166  217 170  211 174  206 177  202 180  200 182  198 184  197 186  
+35   141 59  140 59  140 60  140 61  142 63  144 66  147 70  152 76  157 81  162 86  168 89  173 91  177 92  181 91  184 90  186 89  187 89  187 88  186 88  185 87  184 87  183 86  182 87  181 87  180 88  178 88  176 89  170 91  164 94  155 99  146 103  138 108  132 112  127 116  126 118  
+32   33 49  33 50  33 51  34 53  35 56  38 60  40 64  44 69  49 73  54 75  59 77  63 78  67 78  70 78  72 76  72 75  73 74  72 72  71 71  69 70  65 70  61 70  57 71  51 73  45 76  41 79  34 85  28 91  24 96  21 101  20 104  21 104  
+9 y
+48   251 107  251 106  250 106  249 108  247 110  246 114  244 119  243 124  244 130  245 134  248 138  252 139  257 138  262 135  267 131  271 126  273 121  276 118  277 115  277 113  277 115  277 117  278 122  279 128  280 136  281 145  282 154  283 162  283 169  282 174  280 177  277 179  273 179  267 178  261 176  256 173  251 169  248 166  247 162  249 159  254 155  261 151  270 148  280 145  290 142  297 141  302 142  304 142  
+38   140 59  140 58  139 60  138 62  137 66  136 72  135 79  135 85  136 90  139 91  143 90  148 87  152 82  157 77  160 72  162 69  164 68  165 70  165 75  166 83  167 93  168 104  168 115  167 124  164 131  160 135  155 137  149 137  144 136  140 133  138 128  138 123  141 118  146 113  154 108  162 103  171 100  178 99  
+40   22 48  22 47  21 47  22 49  22 53  24 57  26 62  29 66  32 69  35 69  38 67  42 64  44 59  47 55  48 50  49 46  49 44  49 43  50 45  52 50  54 56  58 65  63 75  68 86  71 96  73 105  73 111  72 116  69 118  63 119  57 118  51 115  45 111  40 107  39 101  40 94  43 88  49 81  56 75  63 69  
+40   262 126  262 124  262 123  262 122  262 123  262 126  262 130  262 135  263 140  265 145  266 148  269 149  271 148  274 145  277 142  279 138  281 135  282 133  283 133  284 135  284 140  286 146  288 154  289 163  291 171  291 178  289 183  287 185  283 186  278 185  274 182  269 180  267 177  266 174  268 170  271 166  277 161  284 157  291 154  297 151  
+45   158 75  157 74  156 74  155 76  154 81  153 87  153 96  154 106  156 114  159 120  163 123  168 122  174 117  179 111  183 103  186 95  189 88  190 82  191 79  192 77  192 78  193 82  194 89  195 99  197 111  198 124  200 137  200 150  199 161  196 171  192 179  185 186  177 189  169 190  161 188  156 183  153 176  154 167  159 159  166 152  175 146  185 141  194 138  203 136  209 136  
+37   56 59  56 56  56 54  56 53  56 56  56 59  56 64  57 69  59 74  62 77  65 78  69 77  72 74  74 71  76 67  78 63  79 59  79 58  81 59  82 63  85 69  87 77  89 87  90 97  90 107  88 115  85 120  80 124  75 125  70 124  65 122  63 117  63 112  65 106  70 100  75 95  81 91  
+41   254 107  254 106  254 105  253 105  253 106  252 108  252 112  252 118  252 124  253 130  255 134  258 136  262 136  267 133  272 129  276 125  279 121  281 118  283 116  284 117  285 121  285 126  285 134  286 143  286 153  285 162  282 171  278 178  273 183  265 186  257 186  250 184  245 180  243 175  244 168  250 162  258 157  269 153  279 150  289 150  296 150  
+45   153 62  153 61  152 62  151 63  149 65  147 69  144 75  142 81  141 87  141 93  142 98  145 100  150 100  155 97  161 93  167 88  172 83  175 79  177 76  178 74  179 73  179 74  179 76  179 81  178 87  178 95  177 104  175 113  172 121  168 128  164 134  159 137  153 139  148 139  144 138  142 136  142 132  145 127  150 122  158 118  167 114  177 111  185 110  192 110  196 111  
+47   32 37  32 35  31 35  30 37  29 39  28 43  27 48  27 52  28 59  30 65  32 69  36 71  41 71  45 69  50 65  53 60  56 55  57 51  59 47  59 44  59 43  59 42  60 43  60 46  61 50  62 56  63 64  65 74  67 83  68 92  69 101  69 109  67 115  64 119  60 121  56 121  51 119  47 116  43 111  41 105  41 99  42 93  46 88  52 83  58 79  64 76  71 75  
+11 z
+109   193 53  194 53  197 53  200 52  204 52  208 52  215 52  222 52  232 52  239 52  242 52  244 52  245 51  246 51  247 51  248 51  249 50  249 51  248 53  247 55  246 57  244 60  241 63  239 67  236 70  234 73  232 76  230 79  228 81  227 83  225 85  224 87  223 89  222 90  221 90  220 91  220 92  219 92  218 93  217 95  215 96  213 97  212 99  210 100  209 101  208 102  207 103  206 104  206 105  204 106  203 107  202 108  201 109  201 110  200 111  199 111  199 112  198 112  198 113  197 113  196 114  195 114  194 115  193 115  194 115  193 115  194 115  195 115  198 115  201 115  205 115  209 115  213 115  216 115  217 115  218 115  219 115  221 115  223 114  225 114  227 114  228 114  230 114  230 113  232 113  233 113  234 113  236 114  238 114  240 114  242 114  244 114  245 114  246 114  247 114  248 114  249 114  250 114  251 114  252 114  253 114  254 113  255 113  256 113  257 113  258 113  259 113  260 113  260 112  
+134   22 47  22 46  23 46  24 46  26 46  28 45  32 45  36 45  40 45  47 45  54 45  58 46  61 46  64 46  65 46  67 46  68 46  69 46  70 46  72 46  74 46  76 45  79 45  81 45  83 45  84 45  85 45  86 45  87 45  88 45  89 45  88 46  86 47  85 49  84 51  82 53  81 54  80 56  78 58  76 59  75 61  73 63  71 65  70 66  70 68  69 69  68 70  68 71  67 72  68 71  67 72  66 73  65 74  64 75  62 76  61 77  60 78  60 79  59 79  58 80  57 81  56 82  55 83  54 84  54 85  53 85  52 86  52 87  51 87  50 88  50 89  49 90  49 91  48 91  48 92  47 93  46 94  44 96  44 97  43 98  42 99  41 100  40 101  39 102  38 103  37 103  37 104  36 104  36 105  35 106  34 107  34 108  33 108  32 109  31 111  30 111  30 112  31 111  33 111  36 111  40 111  44 110  47 110  50 110  51 110  52 110  53 110  54 110  55 109  57 109  59 109  62 109  64 109  65 109  67 109  69 109  71 109  73 109  76 109  78 109  79 109  80 108  81 108  82 108  83 108  84 108  85 107  86 107  87 107  89 107  91 107  94 107  95 107  96 107  
+31   249 136  250 135  252 135  256 134  261 132  267 131  274 130  280 129  284 130  287 132  288 135  287 139  284 145  280 152  274 159  268 167  261 174  255 180  252 183  248 187  247 189  248 190  251 190  258 190  266 189  275 189  285 189  292 189  298 189  302 190  304 190  
+27   168 78  167 78  166 78  168 77  170 76  174 75  179 75  184 74  189 74  193 75  195 77  196 82  195 87  192 95  189 103  185 111  181 117  179 121  177 124  177 126  178 126  181 126  186 126  191 126  197 125  202 125  207 125  
+30   56 61  55 61  54 62  53 62  55 61  58 60  63 59  69 58  75 57  80 56  84 57  87 60  87 65  86 71  83 77  80 82  76 90  71 97  66 103  63 108  61 111  62 113  65 113  71 113  76 112  83 112  89 112  95 111  99 111  102 111  
+34   220 73  218 73  220 72  224 71  230 70  238 69  245 68  253 67  259 68  263 70  266 73  266 78  265 86  263 96  258 108  253 121  247 134  240 145  233 156  226 163  221 169  218 173  216 175  218 173  222 170  225 168  233 166  242 163  252 162  261 162  270 163  277 164  282 166  285 167  
+31   140 103  139 103  139 102  141 102  142 102  145 101  149 100  154 99  158 97  162 97  165 97  167 98  167 101  167 106  165 112  161 118  157 124  153 131  148 136  144 139  142 142  140 144  140 145  141 145  144 144  148 144  153 143  159 142  165 142  170 141  175 141  
+26   53 50  51 50  50 50  51 49  53 49  55 49  59 49  63 49  68 50  71 52  72 56  73 60  71 65  69 70  64 74  61 78  58 80  57 81  56 82  56 83  58 82  62 82  65 82  71 81  74 81  77 80  
+36   249 144  247 143  246 143  247 142  248 142  252 141  257 141  263 140  269 140  276 139  280 140  284 141  285 143  284 146  282 151  278 157  272 164  266 172  259 180  252 188  246 194  241 199  238 203  236 205  235 205  240 204  245 202  252 199  261 197  270 195  278 194  286 194  292 195  296 197  298 198  299 200  
+35   173 58  175 58  178 58  182 58  187 58  193 58  198 59  203 59  206 59  208 60  209 62  208 65  207 68  204 74  200 80  195 88  189 96  183 104  178 110  174 115  172 118  170 119  170 120  172 119  174 118  177 117  181 116  187 114  194 113  202 112  210 111  217 110  224 110  229 110  233 111  
+34   33 54  31 53  30 53  29 52  30 52  31 52  33 52  37 52  41 52  46 52  50 52  54 53  56 54  57 57  57 60  56 65  54 71  50 76  46 82  41 88  36 93  32 97  30 100  29 102  30 103  32 102  37 100  43 99  50 97  57 97  64 97  71 98  76 98  78 99  
+9 A
+15   239 59  237 61  236 61  239 62  245 61  253 60  264 59  275 57  286 55  296 54  302 53  307 53  308 53  308 54  307 55  
+12   133 129  130 129  129 129  133 129  139 128  149 128  160 127  171 127  181 126  189 126  194 125  196 125  
+11   60 51  63 52  69 51  79 51  91 51  105 51  119 51  133 51  144 52  153 53  158 53  
+18   175 189  173 189  172 189  175 189  180 188  188 187  198 186  209 184  221 182  234 180  245 178  255 177  263 176  269 175  272 174  274 174  275 175  274 175  
+23   131 120  132 120  135 120  138 120  144 120  151 120  160 120  171 120  184 120  198 119  212 120  227 120  242 120  255 121  267 121  277 121  285 120  290 120  294 120  295 120  295 121  294 121  293 122  
+14   55 77  55 78  56 78  60 77  65 77  73 77  80 77  88 77  94 76  99 76  103 75  104 75  105 75  104 75  
+17   180 151  179 151  181 151  184 152  190 153  197 155  206 158  215 161  225 163  233 166  241 168  247 169  251 169  253 169  254 170  255 170  254 170  
+16   146 104  145 104  146 104  147 104  151 104  158 104  166 103  175 103  186 102  197 100  207 99  216 97  223 97  229 96  231 96  233 96  
+16   23 61  22 61  22 62  23 62  25 62  28 62  34 62  41 62  50 61  59 61  70 61  79 61  87 61  92 61  96 62  98 62  
+9 B
+14   288 170  287 170  285 170  281 169  276 169  269 169  260 168  249 168  240 168  231 169  224 169  219 169  217 169  216 169  
+11   234 116  232 117  229 118  224 120  218 122  210 125  202 126  194 128  187 129  182 129  179 130  
+13   193 92  192 92  191 91  188 90  185 89  179 87  172 85  164 83  156 81  148 80  142 78  138 77  137 76  
+11   297 167  296 167  293 167  289 167  284 166  277 166  270 166  264 165  260 165  257 165  256 164  
+16   202 122  203 122  201 122  198 121  192 121  184 121  174 122  162 122  149 123  136 124  124 124  116 125  109 124  106 124  105 124  106 124  
+12   126 77  125 76  122 76  118 75  113 74  107 73  100 73  94 73  88 73  84 73  81 74  79 74  
+15   321 78  320 78  318 78  315 79  310 79  304 79  297 80  289 81  280 81  272 81  265 82  260 82  257 82  256 81  257 79  
+16   216 128  215 128  214 128  211 128  207 127  201 126  193 126  184 125  174 125  163 124  154 124  145 123  139 123  136 122  133 122  132 121  
+15   123 74  122 74  121 75  118 75  115 74  110 74  103 73  96 73  88 73  80 74  74 74  69 75  67 75  66 75  67 74  
+9 N
+14   253 182  251 183  250 184  249 184  250 182  254 179  258 175  265 170  272 163  280 158  287 153  292 150  296 148  297 146  
+11   185 147  185 146  185 144  187 140  190 134  194 126  199 115  205 104  212 93  217 84  221 78  
+10   75 135  75 134  76 132  77 130  79 125  83 119  88 111  94 102  100 93  106 85  
+10   192 172  192 171  194 169  198 165  203 160  209 153  217 146  225 139  232 132  238 126  
+10   124 135  126 134  130 130  136 125  144 119  153 112  158 108  166 103  172 99  177 96  
+10   49 93  47 95  46 97  47 94  50 90  54 84  59 77  67 69  73 62  78 57  
+14   174 161  174 160  175 158  178 153  182 148  188 140  195 131  203 121  210 111  215 103  219 97  221 94  222 92  222 93  
+11   94 120  96 118  100 113  106 106  114 99  124 89  135 80  146 72  155 66  162 61  167 58  
+12   29 98  29 97  31 95  35 90  40 84  46 77  52 69  58 62  64 57  69 53  71 51  73 50  
+9 P
+23   146 162  144 162  140 162  135 161  128 161  120 161  110 161  100 161  90 162  84 162  76 162  70 162  65 162  63 162  64 162  66 163  71 163  76 163  84 163  94 162  104 161  114 162  124 163  
+20   243 111  244 111  243 111  242 110  238 110  234 109  227 109  220 109  211 110  202 111  194 112  187 114  183 115  181 116  183 116  187 116  194 116  203 115  213 115  222 114  
+18   147 71  146 71  144 70  140 69  135 69  129 68  121 68  112 69  105 70  98 70  94 71  92 71  94 72  98 72  105 72  113 72  122 71  130 70  
+21   288 147  289 147  287 147  284 147  279 147  273 149  264 151  255 154  246 157  239 159  233 161  230 162  229 162  230 162  233 162  240 161  249 160  261 157  273 155  285 152  294 150  
+21   219 126  219 125  217 125  214 125  210 124  204 123  197 123  190 122  182 122  174 121  168 121  163 121  160 121  159 122  160 122  163 123  169 123  177 123  186 123  195 123  203 122  
+19   137 92  136 92  134 91  130 89  126 87  121 85  114 82  107 80  101 79  96 78  92 77  90 78  91 79  94 80  98 82  104 84  111 86  118 88  123 89  
+25   301 155  300 155  299 154  297 154  294 154  288 154  283 154  276 154  270 155  266 155  263 156  262 156  261 156  262 156  263 156  265 156  269 156  274 156  282 156  292 155  303 155  314 154  323 153  329 153  334 153  
+24   234 117  233 117  232 117  229 116  225 115  219 115  211 116  201 117  191 118  182 119  174 120  167 121  163 121  160 122  159 122  160 122  164 121  170 120  179 119  189 118  200 117  210 117  218 118  224 118  
+20   110 82  111 82  110 82  108 81  104 80  100 79  93 79  86 79  80 79  74 80  70 80  68 81  68 82  71 82  75 82  81 82  89 81  96 80  103 80  108 79  
+9 R
+12   292 99  293 99  293 100  292 102  288 105  283 111  275 118  265 127  253 138  243 147  234 155  228 160  
+10   227 79  229 78  230 78  229 79  226 81  222 85  217 90  210 97  202 105  195 112  
+9   137 79  138 78  137 78  135 80  132 84  128 90  123 97  118 105  113 113  
+13   285 79  284 80  282 82  278 85  272 91  264 98  255 107  245 116  235 126  225 134  217 140  211 144  207 147  
+10   197 61  197 60  197 61  195 64  191 68  186 77  179 88  172 99  166 110  161 118  
+13   123 54  123 55  121 56  118 58  114 62  109 66  103 71  97 76  92 80  89 83  87 85  86 85  87 84  
+16   229 72  230 72  230 71  230 72  229 73  227 77  223 83  218 94  210 107  201 120  192 134  185 145  179 153  176 158  174 161  173 162  
+14   142 94  143 94  142 94  142 95  139 97  136 100  132 105  126 111  120 117  114 123  110 127  107 129  105 130  105 129  
+10   84 38  83 39  81 41  78 46  73 53  67 61  60 69  55 76  50 81  48 84  
+9 S
+14   255 169  256 170  257 170  257 167  257 163  256 157  255 148  253 134  252 118  250 103  249 89  248 78  247 70  246 67  
+12   213 161  213 162  212 160  211 158  210 153  209 147  208 139  207 131  206 124  205 119  205 115  205 113  
+13   140 136  140 137  140 136  140 135  139 133  138 128  137 120  136 110  134 99  131 88  129 79  127 72  126 68  
+12   239 158  240 160  240 161  240 158  241 153  241 145  242 134  243 120  244 108  245 98  245 90  246 85  
+9   154 144  153 141  153 137  153 130  154 120  154 109  155 99  157 90  157 84  
+10   82 124  82 125  82 123  82 119  82 112  83 103  83 93  84 84  85 76  85 72  
+14   210 134  210 135  210 134  209 133  209 132  209 129  210 125  210 121  211 116  211 111  212 108  212 105  213 103  213 102  
+16   142 121  142 122  142 121  142 119  142 116  142 109  142 100  143 89  143 76  144 64  144 53  144 46  144 40  144 36  144 34  145 33  
+11   62 117  63 118  63 117  63 114  63 109  63 102  63 93  64 83  65 73  67 65  68 61  
+9 U
+26   238 155  237 155  239 155  243 155  249 156  256 156  264 156  272 157  279 157  285 157  290 157  293 158  296 158  297 158  298 159  299 159  299 158  298 157  298 155  297 152  297 148  296 142  296 136  296 130  296 125  296 122  
+27   125 140  122 140  120 140  121 140  124 140  128 140  135 141  144 142  153 142  162 143  171 144  179 145  185 145  189 145  191 145  193 146  193 145  192 143  192 140  191 136  191 130  191 124  191 116  192 110  194 103  195 99  195 95  
+22   72 74  71 75  73 75  76 75  82 75  89 75  98 74  106 74  114 74  120 74  124 73  127 73  128 73  129 72  128 71  128 68  128 64  128 60  128 55  128 51  128 49  127 47  
+29   212 183  211 183  211 184  212 184  216 184  221 184  229 184  240 184  251 184  262 184  274 184  284 184  293 183  300 183  306 183  310 182  312 183  313 183  314 183  313 182  313 180  312 178  310 174  309 169  307 163  306 157  306 152  306 148  306 146  
+24   156 142  156 141  157 141  161 140  166 140  174 140  182 140  191 141  199 141  207 142  214 142  219 142  222 141  225 141  226 140  227 139  227 137  227 133  227 129  226 123  226 115  225 107  224 99  223 93  
+24   47 99  46 100  46 101  48 101  52 101  58 101  65 101  75 102  83 102  90 103  96 104  100 105  103 105  104 105  104 103  103 101  102 98  102 94  101 90  100 85  100 80  100 76  100 73  100 72  
+30   210 183  208 183  209 183  211 183  216 182  223 182  233 182  243 182  254 182  265 182  274 182  281 182  286 182  290 182  292 182  293 182  292 182  292 181  291 179  290 177  288 174  287 169  286 164  286 160  285 156  285 154  284 152  284 151  284 150  284 149  
+27   159 120  157 121  154 122  155 121  159 121  165 120  173 119  183 118  193 118  202 118  211 118  218 118  223 118  227 118  229 118  231 118  231 119  231 118  230 116  229 113  228 108  226 101  224 93  222 86  219 80  217 76  215 73  
+28   31 85  30 85  31 86  35 86  40 86  47 87  55 87  63 88  72 89  79 90  85 91  90 91  94 92  98 92  100 92  101 92  102 92  102 91  101 90  101 89  99 86  97 81  95 76  94 71  92 65  91 61  91 58  90 56  
+9 V
+34   158 185  157 185  156 184  157 184  158 184  161 184  165 183  169 182  175 179  179 176  185 171  189 166  193 161  194 156  195 152  194 149  192 148  190 147  188 148  186 149  184 151  184 153  185 156  188 158  192 160  197 159  204 158  212 154  220 148  229 142  237 136  244 130  248 124  251 119  
+37   104 168  105 168  106 167  107 166  110 164  113 161  117 157  120 152  123 146  125 142  126 137  126 134  125 132  124 131  123 131  122 131  121 132  120 133  119 135  118 137  118 139  119 142  120 144  123 146  127 147  131 148  135 146  139 144  143 140  146 136  148 129  151 121  152 112  154 102  155 94  155 88  155 84  
+31   46 135  45 135  45 136  46 135  48 134  51 132  54 128  57 124  60 118  63 112  64 106  64 101  63 98  61 98  58 99  57 102  56 107  56 111  58 114  61 116  65 116  70 114  74 110  78 106  81 100  83 95  85 91  88 87  90 84  92 82  93 80  
+38   174 186  173 184  173 183  173 182  173 181  175 181  177 181  181 180  186 177  191 174  196 170  200 166  204 161  206 157  207 153  206 150  205 148  204 147  202 146  200 147  199 147  198 148  198 150  199 151  202 153  206 153  211 153  216 151  222 148  228 143  234 137  239 129  244 121  247 113  249 110  250 104  251 101  250 101  
+32   99 170  98 170  97 171  98 170  100 170  102 169  104 168  108 166  112 162  115 157  118 152  120 146  121 142  120 138  118 136  116 136  113 136  111 138  110 141  110 143  112 146  115 147  119 147  124 146  129 142  135 138  140 133  144 128  149 123  152 118  154 114  156 111  
+30   39 127  38 127  37 128  38 128  39 127  41 126  43 124  46 121  49 117  52 111  54 105  56 99  55 95  54 92  52 91  50 92  48 93  47 96  47 100  48 102  51 105  56 106  61 104  69 100  76 94  82 88  87 81  91 76  94 72  96 70  
+36   178 189  178 188  179 188  180 189  182 189  186 189  190 187  194 184  199 180  204 175  207 169  210 164  212 159  212 156  211 153  210 152  209 152  208 153  207 154  206 155  206 157  206 158  206 160  208 162  211 164  214 164  218 164  225 163  233 160  242 155  251 148  260 141  267 133  272 128  276 124  277 122  
+40   98 162  98 159  98 158  98 157  98 156  98 157  100 157  102 158  105 158  110 158  116 158  122 156  129 153  134 149  139 144  141 139  142 135  142 130  141 127  140 126  138 125  136 125  135 125  133 126  133 128  133 130  135 131  139 131  144 130  150 127  156 122  163 115  169 106  174 97  179 87  182 78  184 70  186 65  186 61  186 59  
+32   35 109  34 110  34 111  36 111  39 110  43 107  48 103  53 98  56 92  59 85  61 79  60 75  59 71  56 69  54 68  51 69  49 72  48 76  48 80  50 84  54 87  58 87  65 84  72 80  78 74  84 68  89 62  93 56  96 52  98 49  100 47  101 46  
+9 W
+36   308 133  307 132  308 132  308 133  309 135  310 138  310 142  310 148  309 153  307 159  304 163  300 167  295 169  291 169  286 169  282 167  279 166  278 165  278 164  279 163  281 163  284 164  287 166  290 168  291 170  292 173  291 177  287 180  281 184  274 187  266 190  257 193  250 194  244 195  240 196  237 197  
+37   234 68  234 67  235 67  236 68  236 69  236 72  237 76  237 81  236 88  235 95  232 102  228 109  223 115  218 119  213 121  209 122  205 120  203 118  202 116  202 115  203 113  206 113  209 114  211 115  214 118  216 123  217 128  215 134  211 140  206 145  199 150  191 153  183 156  174 157  167 157  160 156  156 156  
+34   136 48  137 48  138 50  139 53  140 56  140 61  140 66  138 72  135 77  130 82  125 86  121 87  117 87  114 86  113 84  112 82  113 81  116 80  118 80  121 82  124 84  125 88  125 94  123 100  119 106  113 113  106 118  99 122  91 125  84 126  78 126  74 126  72 126  71 125  
+37   282 80  282 79  283 80  284 80  285 82  288 85  290 90  292 96  294 102  294 109  294 115  291 121  288 125  284 127  280 129  276 129  273 129  271 128  269 128  268 127  269 126  272 126  275 127  278 128  282 131  285 134  287 139  287 143  286 148  283 152  279 156  274 158  268 161  263 163  260 164  257 164  256 164  
+36   209 72  210 73  210 74  211 77  211 82  211 87  210 94  209 100  207 105  203 109  199 112  194 113  190 113  186 112  183 111  182 109  182 108  183 106  185 105  188 105  191 106  194 108  196 112  196 115  196 120  194 125  190 129  184 133  178 137  170 140  162 142  155 143  149 142  143 141  140 140  137 139  
+34   98 61  98 62  99 63  100 65  101 68  103 72  103 77  103 83  102 88  99 93  95 97  90 99  86 100  83 99  80 97  79 95  79 93  80 91  83 91  85 91  87 92  90 95  91 99  91 103  89 109  84 114  78 120  71 125  63 128  55 130  48 131  43 131  39 130  37 129  
+42   291 76  292 76  292 77  293 77  294 79  295 81  296 83  296 89  296 95  295 102  294 109  291 116  288 120  284 123  280 125  276 125  272 124  269 122  266 120  264 118  263 116  263 113  264 111  266 110  269 110  274 110  279 112  284 116  288 121  290 126  290 131  287 137  281 142  274 148  264 154  253 159  242 163  233 166  225 168  218 169  214 169  212 168  
+36   212 63  212 62  212 63  212 64  213 65  214 68  216 72  217 77  218 80  218 85  217 90  214 95  211 98  205 101  200 103  194 103  189 103  186 102  184 101  184 100  186 98  189 97  193 97  197 99  201 102  204 106  205 111  203 117  200 122  193 128  185 133  176 138  167 142  159 144  153 146  149 146  
+34   93 57  93 56  93 55  93 56  93 58  95 61  96 65  96 70  97 76  96 82  95 87  92 92  89 96  85 98  80 98  76 96  73 94  71 92  71 89  72 88  75 88  79 88  81 90  85 93  87 99  88 105  87 113  84 120  80 127  74 132  68 137  61 140  57 141  54 141  
+9 X
+26   335 197  335 198  336 198  335 198  334 198  332 198  328 198  323 199  316 199  308 200  300 201  293 203  286 203  282 204  279 205  277 205  276 206  276 205  276 204  276 201  276 197  277 191  277 184  277 180  278 174  278 171  
+23   234 160  234 161  234 160  232 160  229 159  225 159  218 158  211 158  202 158  193 160  185 161  178 162  173 163  170 164  168 164  168 163  167 161  167 158  167 154  167 149  168 144  168 139  169 137  
+25   152 107  152 108  151 108  150 107  148 107  145 106  140 107  134 106  127 107  119 108  111 108  105 108  99 109  96 109  94 109  93 109  93 110  93 109  93 108  93 106  94 102  95 97  96 91  97 86  97 83  
+25   307 74  306 74  305 74  302 73  298 73  295 72  290 72  282 72  273 71  257 72  249 72  244 72  241 72  240 72  239 72  238 72  238 71  238 70  238 68  237 65  237 61  237 55  237 51  237 47  237 46  
+24   260 156  258 156  256 155  253 155  249 154  243 154  237 154  230 154  223 155  217 155  213 156  209 156  208 157  207 157  207 156  207 155  207 154  208 151  208 148  209 143  209 138  208 134  208 131  207 130  
+24   134 109  133 109  133 110  131 109  129 109  126 109  121 108  115 108  108 108  100 108  93 109  88 109  83 109  80 110  79 111  78 111  79 111  79 109  80 107  81 102  82 97  83 91  84 86  84 83  
+25   262 180  262 179  261 179  260 179  257 179  253 179  249 179  243 180  236 180  228 180  220 179  212 178  203 177  196 177  190 177  185 177  182 177  180 177  178 177  178 175  179 172  180 168  181 162  182 155  183 149  
+24   265 97  263 97  261 98  257 98  253 98  247 98  239 98  232 98  225 99  219 99  215 100  212 101  211 102  210 102  210 101  210 100  209 98  208 94  208 88  207 82  206 76  206 70  205 67  205 65  
+22   113 98  112 97  111 97  109 96  105 97  101 98  96 99  89 100  83 101  77 102  72 101  68 101  65 101  63 101  62 101  63 99  63 96  63 92  64 87  64 82  64 77  64 75  
diff -urN lib/microwindows/src/demos/nxscribble/li_recognizer.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/li_recognizer.c
--- lib/microwindows/src/demos/nxscribble/li_recognizer.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/li_recognizer.c	2005-02-21 16:13:00.000000000 +0100
@@ -0,0 +1,2549 @@
+/*
+ *  li_recognizer.c
+ *
+ *	Copyright 2000 Compaq Computer Corporation.
+ *	Copying or modifying this code for any purpose is permitted,
+ *	provided that this copyright notice is preserved in its entirety
+ *	in all copies or modifications.
+ *	COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR
+ *	IMPLIED, AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR
+ *
+ *
+ *  Adapted from cmu_recognizer.c by Jay Kistler.
+ *  
+ *  Where is the CMU copyright???? Gotta track it down - Jim Gettys
+ *
+ *  Credit to Dean Rubine, Jim Kempf, and Ari Rapkin.
+ */
+
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <string.h>
+#ifndef ELX
+#include <malloc.h>
+#endif
+#include <math.h>
+#include <locale.h>
+#include <hre_internal.h>
+#include <setjmp.h>
+#include "util.h"
+#include "matrix.h"
+#include "sc.h"
+#include "li_recognizer.h"
+#include "li_recognizer_internal.h"
+
+
+int lidebug = 0;
+
+/*LI Magic Number.*/
+
+#define LI_MAGIC 0xACCBADDD
+
+#define CHECK_LI_MAGIC(_a) \
+  ((_a) != NULL && ((li_recognizer*)(_a))->li_magic == LI_MAGIC)
+
+
+static void lialg_initialize(rClassifier *);
+static int lialg_read_classifier_digest(rClassifier *);
+static int lialg_canonicalize_examples(rClassifier *);
+static char *lialg_recognize_stroke(rClassifier *, point_list *);
+
+
+char* li_err_msg = NULL;
+char _zdebug_flag[128];
+
+#define bcopy(s1,s2,n) memcpy(s2,s1,n)
+
+#if 0 /* was #ifdef mips*/
+char *strdup(char* from) {
+   char* to;
+   int len = strlen(from) + 1;
+
+   /*   to = (char *) safe_malloc( len * sizeof(char) );*/
+   to = allocate(len, char);
+   memcpy(to, from, len);
+   return to;
+}
+#endif
+
+
+/*Freeing classifier*/
+
+static void
+free_rClassifier(rClassifier* rc);
+
+/*
+ * Point List Support
+*/
+
+static point_list*
+add_example(point_list* l,int npts,pen_point* pts)
+{
+    pen_point* lpts = make_pen_point_array(npts);
+    /*    point_list* p = (point_list*)safe_malloc(sizeof(point_list));*/
+    point_list *p = allocate(1, point_list);
+
+    p->npts = npts;
+    p->pts = lpts;
+    p->next = l;       /*Order doesn't matter, so we stick on end.*/
+
+    /*Copy points.*/
+
+    bcopy(pts,lpts,npts * sizeof(pen_point));
+
+    return(p);
+}
+    
+
+static void
+delete_examples(point_list* l)
+{
+    point_list* p;
+
+    for( ; l != NULL; l = p ) {
+	p = l->next;
+	free(l->pts);
+	free(l);
+    }
+}
+
+/*
+ * Local functions
+ */
+
+/*
+ * recognize_internal-Form Vector, use Classifier to classify, return char.
+ */
+
+static char*
+  recognize_internal(rClassifier* rec,pen_stroke* str,int* rconf)
+{
+    char *res = NULL;
+    point_list *stroke = NULL;
+
+    stroke = add_example(NULL, str->ps_npts, str->ps_pts);
+    if (stroke == NULL) return(NULL);
+
+    res = lialg_recognize_stroke(rec, stroke);
+
+    delete_examples(stroke);
+    return(res);
+}
+
+/*
+ * file_path-Construct pathname, check for proper extension.
+ */
+
+static int
+  file_path(char* dir,char* filename,char* pathname)
+{
+    char* dot;
+    
+    /*Check for proper extension on file name.*/
+    
+    dot = strrchr(filename,'.');
+    
+    if( dot == NULL ) {
+	return(-1);
+    }
+
+    /*Determine whether a gesture or character classifier.*/
+
+    if( strcmp(dot,LI_CLASSIFIER_EXTENSION) != 0 ) {
+	return(-1);
+    }
+
+    /*Concatenate directory and filename into pathname.*/
+    
+    strcpy(pathname,dir);
+    strcat(pathname,"/");
+    strcat(pathname,filename);
+    
+    return(0);
+}
+
+/*read_classifier_points-Read points so classifier can be extended.*/
+
+static int 
+read_classifier_points(FILE* fd,int nclss,point_list** ex,char** cnames)
+{
+    int i,j,k;
+    char buf[BUFSIZ];
+    int nex = 0;
+    char* names[MAXSCLASSES];
+    point_list* examples[MAXSCLASSES];
+    pen_point* pts;
+    int npts;
+
+    /*Initialize*/
+
+    for( i = 0; i < MAXSCLASSES; i++ ) {
+	names[i] = NULL;
+	examples[i] = NULL;
+    }
+
+    /*Go thru classes.*/
+
+/* ari */
+/* fprintf(stderr, "Classes: [ "); */
+
+    for( k = 0; k < nclss; k++ ) {
+
+	/*Read class name and number of examples.*/
+	
+	if( fscanf(fd,"%d %s",&nex,buf) != 2 ) {
+	    goto unallocate;
+	}
+	
+	/*Save class name*/
+	
+	names[k] = strdup(buf);
+/* ari */
+/* fprintf(stderr, "%s ", buf); */
+
+	/*Read examples.*/
+	
+	for( i = 0; i < nex; i++ ) {
+	    
+	    /*Read number of points.*/
+	    
+	    if( fscanf(fd,"%d",&npts) != 1 ) {
+		goto unallocate; /*Boy would I like exceptions!*/
+	    }
+	    
+	    /*Allocate array for points.*/
+	    
+	    if( (pts = make_pen_point_array(npts)) == NULL ) {
+		goto unallocate;
+	    }
+	    
+	    /*Read in points.*/
+	    
+	    for( j = 0; j < npts; j++ ) {
+		int x,y;
+		if( fscanf(fd,"%d %d",&x,&y) != 2 ) {
+		    delete_pen_point_array(pts);
+		    goto unallocate;
+		}
+		pts[j].x = x;
+		pts[j].y = y;
+	    }
+	    
+	    /*Add example*/
+	    
+	    if( (examples[k] = add_example(examples[k],npts,pts)) == NULL ) {
+		delete_pen_point_array(pts);
+		goto unallocate;
+	    }
+	    
+	    delete_pen_point_array(pts);
+	    
+	  }
+      }
+
+/* ari -- end of list of classes */
+/* fprintf(stderr, "]\n"); */
+
+    /*Transfer to recognizer.*/
+
+    bcopy(examples,ex,sizeof(examples));
+    bcopy(names,cnames,sizeof(names));
+
+    return(0);
+
+    /*Error. Deallocate memory and return.*/
+
+  unallocate:
+
+    for( ; k >= 0; k-- ) {
+	delete_examples(examples[k]);
+	free(names[k]);
+    }
+
+    error("Error in reading example points from classifier file");
+    return(-1);
+}
+
+/*read_classifier-Read a classifier file.*/
+
+static int read_classifier(FILE* fd,rClassifier* rc)
+{
+    sClassifier sc;
+    
+    li_err_msg = NULL;
+
+    /*Read in classifier file.*/
+    
+    if( (sc = sRead(fd)) == NULL ) {
+	return(-1);
+    }
+    
+    /*Read in the example points, so classifier can be extended.*/
+
+    if( read_classifier_points(fd,sc->nclasses,rc->ex,rc->cnames) != 0 ) {
+	sFreeClassifier(sc);
+	return(-1);
+    }
+
+    /*Transfer sClassifier to the rClassifier*/
+
+    rc->sc = sc;
+    
+    return(0);
+}
+
+/*
+ * Extension Functions
+*/
+
+/* getClasses and clearState are by Ari */
+
+static int
+recognizer_getClasses (recognizer r, char ***list, int *nc)
+{
+    int i, nclasses;
+    li_recognizer* rec;
+    sClassifier sc;
+    char **ret;
+
+    rec = (li_recognizer*)r->recognizer_specific;
+
+    /*Check for LI recognizer.*/
+
+    if( !CHECK_LI_MAGIC(rec) ) {
+	li_err_msg = "Not a LI recognizer";
+	return(-1);
+    }
+    
+    sc = rec->li_rc.sc;
+    *nc = nclasses = sc->nclasses;
+    /*    ret = (char **) safe_malloc (nclasses * sizeof(char*));*/
+    ret = allocate(nclasses, char*);
+
+    for (i = 0; i < nclasses; i++) {
+      ret[i] = rec->li_rc.cnames[i];   /* only the 1st char of the cname */
+    }
+    *list = ret;
+    return 0;
+}
+
+static int
+recognizer_clearState (recognizer r)
+{
+  /*This operation isn't supported by the LI recognizer.*/
+
+  li_err_msg = "Clearing state is not supported by the LI recognizer";
+
+  return(-1);
+}
+
+static bool isa_li(recognizer r)
+{ return(CHECK_LI_MAGIC(r)); }
+
+static int
+recognizer_train(recognizer r,rc* rec_xt,u_int nstrokes,
+		    pen_stroke* strokes,rec_element* re,
+		    bool replace_p)
+{
+  /*This operation isn't supported by the LI recognizer.*/
+
+  li_err_msg = "Training is not supported by the LI recognizer";
+
+  return(-1);
+}
+
+int
+li_recognizer_get_example (recognizer	r,
+			   int		class, 
+			   int		instance,
+			   char		**name, 
+			   pen_point	**points,
+			   int		*npts)
+{
+    li_recognizer   *rec = (li_recognizer*)r->recognizer_specific;
+    sClassifier	    sc = rec->li_rc.sc;
+    point_list	    *pl;
+    
+    if( !CHECK_LI_MAGIC(rec) ) {
+	li_err_msg = "Not a LI recognizer";
+	return(-1);
+    }
+    if (class > sc->nclasses)
+	return -1;
+    pl = rec->li_rc.canonex[class];
+    while (instance && pl)
+    {
+	pl = pl->next;
+	instance--;
+    }
+    if (!pl)
+	return -1;
+    *name = rec->li_rc.cnames[class];
+    *points = pl->pts;
+    *npts = pl->npts;
+    return 0;
+}
+
+/*
+ * API Functions
+ */
+
+
+/*li_recognizer_load-Load a classifier file.*/
+
+static int li_recognizer_load(recognizer r,char* dir,char* filename)
+{ 
+    FILE *fd;
+    //int ftype;
+    char* pathname;
+    li_recognizer* rec;
+    rClassifier* rc;
+    
+    rec = (li_recognizer*)r->recognizer_specific;
+
+    /*Make sure recognizer's OK*/
+
+    if( !CHECK_LI_MAGIC(rec) ) {
+	li_err_msg = "Not a LI recognizer";
+	return(-1);
+    }
+
+    rc = &(rec->li_rc);
+
+    /*Check parameters.*/
+
+    if( filename == NULL ) {
+	li_err_msg = "Invalid parameters";
+	return(-1);
+    }
+
+    /*We let the directory be null.*/
+
+    if( dir == NULL || (int)strlen(dir) <= 0 ) {
+	dir = ".";
+    }
+
+    /*Make full pathname and check filename*/
+
+    /* pathname = (char*)safe_malloc(strlen(dir) + strlen(filename) + 2)); */
+
+    pathname = allocate(strlen(dir) + strlen(filename) + 2, char);
+    if( file_path(dir,filename,pathname) == -1 ) {
+	free(pathname);
+	li_err_msg = "Not a LI recognizer classifier file";
+	return(-1);
+    }
+
+    /* Try to short-circuit the full classifier-file processing. */
+    rc->file_name = pathname;
+    if (lialg_read_classifier_digest(rc) == 0)
+	return(0);
+    rc->file_name = NULL;
+
+    /*Open the file*/
+
+    if( (fd = fopen(pathname,"r")) == NULL ) {
+	free(pathname);
+	li_err_msg = "Can't open classifier file";
+/* ari */
+	/* fprintf(stderr, "Trying to open %s.\n", pathname); */
+	return(-1);
+
+    }
+
+    /*If rClassifier is OK, then delete it first.*/
+
+    if( rc->file_name != NULL ) {
+      free_rClassifier(rc);
+    }
+
+    /*Read classifier.*/
+    
+    if( read_classifier(fd,rc) < 0 ) {
+	free(pathname);
+	return(-1);
+    }
+
+    /*Close file.*/
+
+    fclose(fd);
+
+    /*Add classifier name.*/
+
+    rc->file_name = pathname;
+
+    /* Canonicalize examples. */
+    if (lialg_canonicalize_examples(rc) != 0) {
+	free(pathname);
+	rc->file_name = NULL;
+	return(-1);
+    }
+
+    return(0);
+}
+
+/*li_recognizer_save-Save a classifier file.*/
+
+static int li_recognizer_save(recognizer r,char* dir,char* filename)
+{ 
+  /*This operation isn't supported by the LI recognizer.*/
+
+  li_err_msg = "Saving is not supported by the LI recognizer";
+
+  return(-1);
+}
+
+static wordset
+li_recognizer_load_dictionary(recognizer rec,char* directory,char* name)
+{
+  /*This operation isn't supported by the LI recognizer.*/
+
+  li_err_msg = "Dictionaries are not supported by the LI recognizer";
+
+  return(NULL);
+
+}
+
+static int
+li_recognizer_save_dictionary(recognizer rec,
+			       char* directory,
+			       char* name,
+			       wordset dict)
+{
+  /*This operation isn't supported by the LI recognizer.*/
+
+  li_err_msg = "Dictionaries are not supported by the LI recognizer";
+
+  return(-1);
+
+}
+
+static int
+li_recognizer_free_dictionary(recognizer rec,wordset dict)
+{
+  /*This operation isn't supported by the LI recognizer.*/
+
+  li_err_msg = "Dictionaries are not supported by the LI recognizer";
+
+  return(-1);
+
+}
+
+static int
+li_recognizer_add_to_dictionary(recognizer rec,letterset* word,wordset dict)
+{
+  /*This operation isn't supported by the LI recognizer.*/
+
+  li_err_msg = "Dictionaries are not supported by the LI recognizer";
+
+  return(-1);
+
+}
+
+static int
+li_recognizer_delete_from_dictionary(recognizer rec,
+				      letterset* word,
+				      wordset dict)
+{
+  /*This operation isn't supported by the LI recognizer.*/
+
+  li_err_msg = "Dictionaries are not supported by the LI recognizer";
+
+  return(-1);
+
+}
+
+static char*
+li_recognizer_error(recognizer rec)
+{
+    char* ret = li_err_msg;
+
+    /*Check for LI recognizer.*/
+
+    if( !CHECK_LI_MAGIC(rec->recognizer_specific) ) {
+	li_err_msg = "Not a LI recognizer";
+	return(NULL);
+    }
+
+    li_err_msg = NULL;
+
+    return(ret);
+}
+
+static int 
+li_recognizer_clear(recognizer r,bool delete_points_p)
+{
+    li_recognizer* rec; 
+
+    rec = (li_recognizer*)r->recognizer_specific;
+
+    /*Check for LI recognizer.*/
+
+    if( !CHECK_LI_MAGIC(rec) ) {
+	li_err_msg = "Not a LI recognizer";
+	return(0);
+    }
+  
+    return(0);
+}
+
+static int 
+li_recognizer_set_context(recognizer r,rc* rec_xt)
+{
+  /*This operation isn't supported by the LI recognizer.*/
+
+  li_err_msg = "Contexts are not supported by the LI recognizer";
+
+  return(-1);
+}
+
+static rc*
+li_recognizer_get_context(recognizer r)
+{
+  /*This operation isn't supported by the LI recognizer.*/
+
+  li_err_msg = "Contexts are not supported by the LI recognizer";
+
+  return(NULL);
+}
+
+static int 
+li_recognizer_get_buffer(recognizer r, u_int* nstrokes,pen_stroke** strokes)
+{
+  /*This operation isn't supported by the LI recognizer.*/
+
+  li_err_msg = "Buffer get/set are not supported by the LI recognizer";
+
+  return(-1);
+}
+
+static int 
+li_recognizer_set_buffer(recognizer r,u_int nstrokes,pen_stroke* strokes)
+{
+  /*This operation isn't supported by the LI recognizer.*/
+
+  li_err_msg = "Buffer get/set are not supported by the LI recognizer";
+
+  return(-1);
+}
+
+static int
+li_recognizer_translate(recognizer r,
+			 u_int ncs,
+			 pen_stroke* tps,
+			 bool correlate_p,
+			 int* nret,
+			 rec_alternative** ret)
+{
+    char* clss = NULL;
+    li_recognizer* rec; 
+    int conf;
+    rClassifier* rc;
+      
+    rec = (li_recognizer*)r->recognizer_specific;
+
+    *nret = 0;
+    *ret = NULL;
+
+    /*Check for LI recognizer.*/
+
+    if( !CHECK_LI_MAGIC(rec) ) {
+	li_err_msg = "Not a LI recognizer";
+	return(-1);
+    }
+
+   rc = &(rec->li_rc);
+
+    /*Check for valid parameters.*/
+    if (ncs < 1) {
+	li_err_msg = "Invalid parameters: ncs";
+	return(-1);
+    }
+    if( tps == NULL) {
+	li_err_msg = "Invalid parameters: tps";
+	return(-1);
+    }
+    if( nret == NULL) {
+	li_err_msg = "Invalid parameters: nret";
+	return(-1);
+    }
+    if( ret == NULL) {
+	li_err_msg = "Invalid parameters: ret";
+	return(-1);
+    }
+
+/*    if( ncs < 1 || tps == NULL || nret == NULL || ret == NULL) {
+	li_err_msg = "Invalid parameters";
+	return(-1);
+    }
+*/
+
+    /*Check for null classifier. It must have at least one.*/
+/*
+    if( rec->li_rc.sc == NULL ) {
+	li_err_msg = "No classifier";
+	return(-1);
+    }
+*/
+
+    /*
+     * Go through the stroke array and recognize. Since this is a single
+     *   stroke recognizer, each stroke is treated as a separate
+     *   character or gesture. We allow only characters or gestures
+     *   to be recognized at one time, since otherwise, handling
+     *   the display of segmentation would be difficult. 
+    */
+    clss = recognize_internal(rc,tps,&conf);
+    if (clss == NULL) {
+/*
+	li_err_msg = "unrecognized character";
+	return(-1);
+*/
+	*nret = 1;
+	return(0);
+    }
+
+    /*Return values.*/
+    *nret = 1;
+    return(*clss);
+}
+
+
+static rec_fn*
+li_recognizer_get_extension_functions(recognizer rec)
+{
+    rec_fn* ret;
+
+    /*Check for LI recognizer.*/
+
+    if( !CHECK_LI_MAGIC(rec->recognizer_specific) ) {
+	li_err_msg = "Not a LI recognizer";
+	return(NULL);
+    }
+
+    ret = make_rec_fn_array(LI_NUM_EX_FNS);
+
+/* ari -- clearState & getClasses are mine */
+    ret[LI_GET_CLASSES] = (rec_fn)recognizer_getClasses;
+    ret[LI_CLEAR] = (rec_fn)recognizer_clearState;
+    ret[LI_ISA_LI] = (rec_fn)isa_li;
+    ret[LI_TRAIN] = (rec_fn)recognizer_train;
+
+    return(ret);
+}
+
+static char**
+li_recognizer_get_gesture_names(recognizer r)
+{
+  /*This operation isn't supported by the LI recognizer.*/
+
+  li_err_msg = "Gestures are not supported by the LI recognizer";
+
+  return(NULL);
+}
+
+static xgesture
+li_recognizer_set_gesture_action(recognizer r,
+				  char* name,
+				  xgesture fn,
+				  void* wsinfo)
+{
+  /*This operation isn't supported by the LI recognizer.*/
+
+  li_err_msg = "Gestures are not supported by the LI recognizer";
+
+  return(NULL);
+}
+
+/*
+ * Exported Functions
+*/
+
+/*RECOGNIZER_INITIALIZE-Initialize the recognizer.*/
+
+/* note from ari:  this expands via pre-processor to
+ *
+ * recognizer __recognizer_internal_initialize(rec_info* ri)
+*/
+
+RECOGNIZER_INITIALIZE(ri)
+{
+    recognizer r;
+    li_recognizer* rec;
+    //char* homedir;
+    //char rechomedir[BUFSIZ];
+    int i;
+
+    /*Check that locale matches.*/
+
+    if( strcmp(ri->ri_locale,LI_SUPPORTED_LOCALE) != 0 ) {
+	li_err_msg = "Not a supported locale";
+fprintf(stderr, "Locale error.\n");
+	//return(NULL);
+    }
+
+    /*
+     * Check that character sets match. Note that this is only approximate,
+     * since the classifier file will have more information.
+    */
+
+    if( ri->ri_subset != NULL ) {
+      for(i = 0; ri->ri_subset[i] != NULL; i++ ) {
+
+	if( strcmp(ri->ri_subset[i],UPPERCASE) != 0 &&
+	    strcmp(ri->ri_subset[i],LOWERCASE) != 0  &&
+	    strcmp(ri->ri_subset[i],DIGITS) != 0 &&
+	    strcmp(ri->ri_subset[i],GESTURE) != 0 ) {
+	  li_err_msg = "Not a supported character set";
+fprintf(stderr, "charset error.\n");
+
+	  return(NULL);
+	}
+      }
+    }
+	     
+/* ari */
+    r = make_recognizer(ri);
+//fprintf(stderr, "past make_recognizer.\n");
+
+    if( r == NULL ) {
+	li_err_msg = "Can't allocate storage";
+
+	return(NULL);
+    }
+
+    /*Make a LI recognizer structure.*/
+
+
+    /* rec = (li_recognizer*)safe_malloc(sizeof(li_recognizer))) == NULL ); */
+
+    rec = allocate(1, li_recognizer);
+
+    r->recognizer_specific = rec;
+
+    rec->li_rc.file_name = NULL;
+    rec->li_rc.sc = NULL;
+
+    /*Initialize the recognizer struct.*/
+
+    r->recognizer_load_state = li_recognizer_load;
+    r->recognizer_save_state = li_recognizer_save;
+    r->recognizer_load_dictionary = li_recognizer_load_dictionary;
+    r->recognizer_save_dictionary = li_recognizer_save_dictionary;
+    r->recognizer_free_dictionary = li_recognizer_free_dictionary;
+    r->recognizer_add_to_dictionary = li_recognizer_add_to_dictionary;
+    r->recognizer_delete_from_dictionary = li_recognizer_delete_from_dictionary;
+    r->recognizer_error = li_recognizer_error;
+    r->recognizer_translate = li_recognizer_translate;
+    r->recognizer_get_context = li_recognizer_get_context;
+    r->recognizer_set_context = li_recognizer_set_context;
+    r->recognizer_get_buffer = li_recognizer_get_buffer;
+    r->recognizer_set_buffer = li_recognizer_set_buffer;
+    r->recognizer_clear = li_recognizer_clear;
+    r->recognizer_get_extension_functions = 
+      li_recognizer_get_extension_functions;
+    r->recognizer_get_gesture_names = li_recognizer_get_gesture_names;
+    r->recognizer_set_gesture_action = 
+      li_recognizer_set_gesture_action;
+
+    /*Initialize LI Magic Number.*/
+
+    rec->li_magic = LI_MAGIC;
+
+    /*Initialize rClassifier.*/
+
+    rec->li_rc.file_name = NULL;
+
+    for( i = 0; i < MAXSCLASSES; i++ ) {
+	rec->li_rc.ex[i] = NULL;
+	rec->li_rc.cnames[i] = NULL;
+    }
+
+    lialg_initialize(&rec->li_rc);
+
+    /*Get rid of error message. Not needed here.*/
+    li_err_msg = NULL;
+
+    return(r);
+}
+
+/*free_rClassifier-Free the rClassifier.*/
+
+static void
+free_rClassifier(rClassifier* rc)
+{
+    int i;
+
+    if( rc->file_name != NULL) {
+	free(rc->file_name);
+    }
+
+    for( i = 0; rc->ex[i] != NULL; i++) {
+	delete_examples(rc->ex[i]);
+	free(rc->cnames[i]);
+    }
+
+    if(rc->sc != NULL ) {
+	sFreeClassifier(rc->sc);
+    }
+}
+
+/*RECOGNIZER_FINALIZE-Deallocate the recognizer, finalize.*/
+
+RECOGNIZER_FINALIZE(r)
+{
+    li_recognizer* rec = (li_recognizer*)r->recognizer_specific;
+
+    /*Make sure this is a li_recognizer first*/
+
+    if( !CHECK_LI_MAGIC(rec) ) {
+	li_err_msg = "Not a LI recognizer";
+	return(-1);
+    }
+
+    /*Deallocate rClassifier resources.*/
+
+    free_rClassifier(&(rec->li_rc));
+
+    /*Deallocate the li_recognizer struct.*/
+
+    free(rec);
+
+    /*Deallocate the recognizer*/
+
+    delete_recognizer(r);
+
+    return(0);
+}
+
+
+/* **************************************************
+
+  Implementation of the Li/Yeung recognition algorithm
+
+************************************************** */
+
+/*#include <assert.h>*/
+#include <values.h>
+#include <sys/time.h>
+
+#ifdef	__ultrix
+/* Ultrix doesn't have these declarations in math.h! */
+extern double rint(double);
+extern float expf(float);
+#endif
+
+#ifdef	ELX
+extern double rint (double);
+extern float expf (float);	/* N.B.  exp() appears to be broken on ELX! */
+#endif
+
+#define	WORST_SCORE	MAXINT
+
+/* Dynamic programming parameters */
+#define	DP_BAND		3
+#define	MIN_SIM		0
+#define	MAX_DIST	MAXINT
+#define	SIM_THLD	60	/* x 100 */
+#define	DIST_THLD	3200	/* x 100 */
+
+/* Low-pass filter parameters -- empirically derived */
+#define	LP_FILTER_WIDTH	6
+#define	LP_FILTER_ITERS	8
+#define	LP_FILTER_THLD	250	/* x 100 */
+#define	LP_FILTER_MIN	5
+
+/* Pseudo-extrema parameters -- empirically derived */
+#define	PE_AL_THLD	1500	/* x 100 */
+#define	PE_ATCR_THLD	135	/* x 100 */
+
+/* Contour-angle derivation parameters */
+#define	T_ONE		1
+#define	T_TWO		20
+
+/* Pre-processing and canonicalization parameters */
+#define	CANONICAL_X	108
+#define	CANONICAL_Y	128
+#define	DIST_SQ_THRESHOLD   (3*3)	/* copied from fv.h */
+#define	NCANONICAL	50
+
+/* Tap-handling parameters */
+#define	TAP_CHAR	"."
+#define	TAP_TIME_THLD	150	    /* msec */
+#define	TAP_DIST_THLD	75	    /* dx * dx + dy * dy */
+#define	TAP_PATHLEN	1000	    /* x 100 */
+
+
+/* Overload the time field of the pen_point struct with the chain-code. */
+#define	chaincode   time
+
+/* region types */
+#define	RGN_CONVEX  0
+#define	RGN_CONCAVE 1
+#define	RGN_PLAIN   2
+#define	RGN_PSEUDO  3
+
+
+typedef struct RegionList {
+    int start;
+    int end;
+    int type;
+    struct RegionList *next;
+} region_list;
+
+
+/* direction-code table; indexed by dx, dy */
+static int lialg_dctbl[3][3] = {{1, 0, 7}, {2, 0x7FFFFFFF, 6}, {3, 4, 5}};
+
+/* low-pass filter weights */
+static int lialg_lpfwts[2 * LP_FILTER_WIDTH + 1];
+static int lialg_lpfconst = -1;
+
+
+static int lialg_preprocess_stroke(point_list *);
+static point_list *lialg_compute_dominant_points(point_list *);
+static point_list *lialg_interpolate_points(point_list *);
+static void lialg_bresline(pen_point *, pen_point *, point_list *, int *);
+static void lialg_compute_chain_code(point_list *);
+static void lialg_compute_unit_chain_code(point_list *);
+static region_list *lialg_compute_regions(point_list *);
+static point_list *lialg_compute_dompts(point_list *, region_list *);
+static int *lialg_compute_contour_angle_set(point_list *, region_list *);
+static void lialg_score_stroke(point_list *, point_list *, int *, int *);
+static int lialg_compute_similarity(point_list *, point_list *);
+static int lialg_compute_distance(point_list *, point_list *);
+
+static int lialg_read_classifier_digest(rClassifier *);
+
+static int lialg_canonicalize_examples(rClassifier *);
+static int lialg_canonicalize_example_stroke(point_list *);
+static int lialg_compute_equipoints(point_list *);
+
+static int lialg_compute_pathlen(point_list *);
+static int lialg_compute_pathlen_subset(point_list *, int, int);
+static int lialg_filter_points(point_list *);
+static int lialg_translate_points(point_list *, int, int, int, int);
+static void lialg_get_bounding_box(point_list *, int *, int *, int *, int *);
+static void lialg_compute_lpf_parameters();
+static int isqrt(int);
+static int likeatan(int, int);
+static int quadr(int);
+
+
+/*************************************************************
+
+  Core routines for the Li/Yeung recognition algorithm
+
+ *************************************************************/
+
+static void lialg_initialize(rClassifier *rec) {
+    int i;
+
+    /* Initialize the dompts arrays. */
+    for (i = 0; i < MAXSCLASSES; i++) {
+	rec->dompts[i] = NULL;
+    }
+}
+
+
+/*
+ *  Main recognition routine -- called by HRE API.
+ */
+static char *lialg_recognize_stroke(rClassifier *rec, point_list *stroke) {
+    int i;
+    char *name = NULL;
+    point_list *input_dompts = NULL;
+    char *best_name = NULL;
+    int best_score = WORST_SCORE;
+    char *curr_name;
+    point_list *curr_dompts = NULL;
+    //struct timeval stv, etv;
+    //int	elapsed;
+
+    /*    (void)gettimeofday(&stv, NULL);*/
+
+    if (stroke->npts < 1) goto done;
+
+    /* Check for tap. */
+    {
+/*
+	pen_point *startpt = &stroke->pts[0];
+	pen_point *endpt = &stroke->pts[stroke->npts - 1];
+	int dt = endpt->time - startpt->time;
+	int dx = endpt->x - startpt->x;
+	int dy = endpt->y - startpt->y;
+	int magsq = dx * dx + dy * dy;
+*/
+
+	/* First thing is to filter out ``close points.'' */
+	if (lialg_filter_points(stroke) != 0) return(NULL);
+
+	/* Unfortunately, we don't have the actual time that each point */
+	/* was recorded (i.e., dt is invalid).  Hence, we have to use a */
+	/* heuristic based on total distance and the number of points. */
+	if (stroke->npts == 1 || lialg_compute_pathlen(stroke) < TAP_PATHLEN)
+	    return(TAP_CHAR);
+    }
+
+    /* Pre-process input stroke. */
+    if (lialg_preprocess_stroke(stroke) != 0) goto done;
+
+    /* Compute its dominant points. */
+    input_dompts = lialg_compute_dominant_points(stroke);
+    if (input_dompts == NULL) goto done;
+
+    /* Score input stroke against every class in classifier. */
+    for (i = 0, curr_name = rec->cnames[i], curr_dompts = rec->dompts[i];
+	  i < MAXSCLASSES && curr_name != NULL && curr_dompts != NULL;
+	  i++, curr_name = rec->cnames[i], curr_dompts = rec->dompts[i]) {
+	int sim;
+	int dist;
+	int curr_score;
+
+	lialg_score_stroke(input_dompts, curr_dompts, &sim, &dist);
+	curr_score = dist;
+
+	if (lidebug && curr_score < DIST_THLD)
+	    fprintf(stderr, "(%s, %d, %d) ", curr_name, sim, dist);
+
+	/* Is it the best so far? */
+	if (curr_score < best_score && curr_score <= DIST_THLD) {
+	    best_score = curr_score;
+	    best_name = curr_name;
+	}
+    }
+
+    if (lidebug)
+	fprintf(stderr, "\n");
+
+    /* No errors. */
+    name = best_name;
+
+done:
+    delete_examples(input_dompts);
+    /*    (void)gettimeofday(&etv, NULL);
+	  elapsed = (1000 * (etv.tv_sec - stv.tv_sec)) + ((etv.tv_usec - stv.tv_usec + 500) / 1000);
+	  fprintf(stderr, "elapsed = %d\n", elapsed);
+     */
+    return(name);
+}
+
+
+static int lialg_preprocess_stroke(point_list *points) {
+    int minx, miny, maxx, maxy, xrange, yrange, scale, xoff, yoff;
+
+    /* Filter out points that are too close. */
+    /* We did this earlier, when we checked for a tap. */
+/*
+    if (lialg_filter_points(points) != 0) return(-1);
+*/
+
+/*    assert(points->npts > 0);*/
+
+    /* Scale up to avoid conversion errors. */
+    lialg_get_bounding_box(points, &minx, &miny, &maxx, &maxy);
+    xrange = maxx - minx;
+    yrange = maxy - miny;
+    scale = ( ((100 * xrange + CANONICAL_X / 2) / CANONICAL_X) > 
+	      ((100 * yrange + CANONICAL_Y / 2) / CANONICAL_Y))
+      ? (100 * CANONICAL_X + xrange / 2) / xrange
+      : (100 * CANONICAL_Y + yrange / 2) / yrange;
+    if (lialg_translate_points(points, minx, miny, scale, scale) != 0)
+	return(-1);
+
+    /* Center the stroke. */
+    lialg_get_bounding_box(points, &minx, &miny, &maxx, &maxy);
+    xrange = maxx - minx;
+    yrange = maxy - miny;
+    xoff = -((CANONICAL_X - xrange + 1) / 2);
+    yoff = -((CANONICAL_Y - yrange + 1) / 2);
+    if (lialg_translate_points(points, xoff, yoff, 100, 100) != 0) return(-1);
+
+    /* Store the x and y ranges in the point list. */
+    xrange = maxx - minx;
+    yrange = maxy - miny;
+    points->xrange = xrange;
+    points->yrange = yrange;
+
+    if (lidebug) {
+	int i;
+	fprintf(stderr, "After pre-processing:   %d %d %d %d\n",
+		minx, miny, maxx, maxy);
+	for (i = 0; i < points->npts; i++)
+	    fprintf(stderr, "      (%d %d)\n",
+		    points->pts[i].x, points->pts[i].y);
+	fflush(stderr);
+    }
+
+    return(0);
+}
+
+
+static point_list *lialg_compute_dominant_points(point_list *points) {
+    point_list *ipts = NULL;
+    region_list *regions = NULL;
+    point_list *dpts = NULL;
+
+    /* Interpolate points. */
+    ipts = lialg_interpolate_points(points);
+    if (ipts == NULL) return(NULL);
+    if (lidebug) {
+	int j;
+	fprintf(stderr, "After interpolation:  %d ipts\n", ipts->npts);
+	for (j = 0; j < ipts->npts; j++) {
+	    fprintf(stderr, "  (%d, %d), %ld\n",
+		    ipts->pts[j].x, ipts->pts[j].y, ipts->pts[j].chaincode);
+	}
+	fflush(stderr);
+    }
+
+    /* Compute regions. */
+    regions = lialg_compute_regions(ipts);
+/*    assert(regions != NULL);*/
+
+    /* Compute dominant points. */
+    dpts = lialg_compute_dompts(ipts, regions);
+    if (lidebug) {
+	int j;
+	fprintf(stderr, "Dominant points:  ");
+	for (j = 0; j < dpts->npts; j++) {
+	    fprintf(stderr, "%d %d (%ld)  ",
+		    dpts->pts[j].x, dpts->pts[j].y, dpts->pts[j].chaincode);
+	}
+	fprintf(stderr, "\n");
+	fflush(stderr);
+    }
+
+    /* Delete region data structure. */
+    {
+	region_list *curr, *next;
+	for (curr = regions; curr != NULL; ) {
+	    next = curr->next;
+	    free(curr);
+	    curr = next;
+	}
+    }
+    delete_examples(ipts);
+    return(dpts);
+}
+
+
+/* Input points are assumed to be integer-valued! */
+static point_list *lialg_interpolate_points(point_list *points) {
+    int i, j;
+    int maxpts;
+    point_list *newpts;
+
+    /* Compute an upper-bound on the number of interpolated points. */
+    maxpts = 0;
+    for (i = 0; i < (points->npts - 1); i++) {
+	pen_point *pta = &(points->pts[i]);
+	pen_point *ptb = &(points->pts[i+1]);
+	maxpts += abs(pta->x - ptb->x) + abs(pta->y - ptb->y);
+    }
+
+    /* Allocate an array of the requisite size. */
+    maxpts += points->npts;
+    /* newpts = (point_list *)safe_malloc(sizeof(point_list)); */
+    newpts = allocate(1, point_list);
+    newpts->pts = make_pen_point_array(maxpts);
+    if (newpts->pts == NULL) {
+	free(newpts);
+	return(NULL);
+    }
+    newpts->npts = maxpts;
+    newpts->next = NULL;
+
+    /* Interpolate each of the segments. */
+    j = 0;
+    for (i = 0; i < (points->npts - 1); i++) {
+	pen_point *startpt = &(points->pts[i]);
+	pen_point *endpt = &(points->pts[i+1]);
+
+	lialg_bresline(startpt, endpt, newpts, &j);
+
+	j--;	/* end point gets recorded as start point of next segment! */
+    }
+
+    /* Add-in last point. */
+    newpts->pts[j++] = points->pts[points->npts - 1];
+    newpts->npts = j;
+
+    /* Compute the chain code for P (the list of points). */
+    lialg_compute_unit_chain_code(newpts);
+
+    return(newpts);
+}
+
+
+/* This implementation is due to Kenny Hoff. */
+static void lialg_bresline(pen_point *startpt, pen_point *endpt,
+			    point_list *newpts, int *j) {
+    int Ax, Ay, Bx, By, dX, dY, Xincr, Yincr;
+
+    Ax = startpt->x;
+    Ay = startpt->y;
+    Bx = endpt->x;
+    By = endpt->y;
+
+    /* INITIALIZE THE COMPONENTS OF THE ALGORITHM THAT ARE NOT AFFECTED */
+    /* BY THE SLOPE OR DIRECTION OF THE	LINE */
+    dX = abs(Bx-Ax);	/* store the change in X and Y of the line endpoints */
+    dY = abs(By-Ay);
+
+    /* DETERMINE "DIRECTIONS" TO INCREMENT X AND Y (REGARDLESS OF DECISION) */
+    if (Ax > Bx) { Xincr=-1; } else { Xincr=1; }    /* which direction in X? */
+    if (Ay > By) { Yincr=-1; } else { Yincr=1; }    /* which direction in Y? */
+
+    /* DETERMINE INDEPENDENT VARIABLE (ONE THAT ALWAYS INCREMENTS BY 1 (OR -1) ) */
+    /* AND INITIATE APPROPRIATE LINE DRAWING ROUTINE (BASED ON FIRST OCTANT */
+    /* ALWAYS). THE X AND Y'S MAY BE FLIPPED IF Y IS THE INDEPENDENT VARIABLE. */
+    if (dX >= dY) {	    /* if X is the independent variable */
+	int dPr	= dY<<1;	    /* amount to increment decision if right is chosen (always) */
+	int dPru = dPr - (dX<<1);   /* amount to increment decision if up is chosen */
+	int P =	dPr - dX;	    /* decision variable start value */
+
+	/* process each point in the line one at a time (just use dX) */
+	for (; dX>=0; dX--) {
+	    newpts->pts[*j].x = Ax;
+	    newpts->pts[*j].y = Ay;
+	    (*j)++;
+
+	    if (P > 0) {	/* is the pixel	going right AND	up? */
+		Ax+=Xincr;	/* increment independent variable */
+		Ay+=Yincr;	/* increment dependent variable */
+		P+=dPru;	/* increment decision (for up) */
+	    }
+	    else {		/* is the pixel just going right? */
+		Ax+=Xincr;	/* increment independent variable */
+		P+=dPr;		/* increment decision (for right) */
+	    }
+	}
+    }
+    else {		    /* if Y is the independent variable */
+	int dPr	= dX<<1;	    /* amount to increment decision if right is chosen (always) */
+	int dPru = dPr - (dY<<1);   /* amount to increment decision if up is chosen */
+	int P  = dPr - dY;	    /* decision variable start value */
+
+	/* process each point in the line one at a time (just use dY) */
+	for (; dY>=0; dY--) {
+	    newpts->pts[*j].x = Ax;
+	    newpts->pts[*j].y = Ay;
+	    (*j)++;
+
+	    if (P > 0) {	/* is the pixel going up AND right? */
+		Ax+=Xincr;	/* increment dependent variable */
+		Ay+=Yincr;	/* increment independent variable */
+		P+=dPru;	/* increment decision (for up) */
+	    }
+	    else {		/* is the pixel just going up? */
+		Ay+=Yincr;	/* increment independent variable */
+		P+=dPr;		/* increment decision (for right) */
+	    }
+	}
+    }
+}
+
+
+static void lialg_compute_chain_code(point_list *pts) {
+    int i;
+
+    for (i = 0; i < (pts->npts - 1); i++) {
+	pen_point *startpt = &(pts->pts[i]);
+	pen_point *endpt = &(pts->pts[i+1]);
+	int dx = endpt->x - startpt->x;
+	int dy = endpt->y - startpt->y;
+/*
+	int tmp	= rint(4.0 * atan2((double)dx, (double)dy) / M_PI);
+	int dircode = (10 + tmp) % 8;
+*/
+	int tmp = quadr(likeatan(dy, dx));
+	int dircode = (12 - tmp) % 8;
+
+	startpt->chaincode = dircode;
+    }
+}
+
+
+static void lialg_compute_unit_chain_code(point_list *pts) {
+    int i;
+
+    for (i = 0; i < (pts->npts - 1); i++) {
+	pen_point *startpt = &(pts->pts[i]);
+	pen_point *endpt = &(pts->pts[i+1]);
+	int dx = endpt->x - startpt->x;
+	int dy = endpt->y - startpt->y;
+	int dircode = lialg_dctbl[dx+1][dy+1];
+
+/*	assert(dircode < 8);*/
+	startpt->chaincode = dircode;
+    }
+}
+
+
+static region_list *lialg_compute_regions(point_list *pts) {
+    region_list *regions = NULL;
+    region_list *curr_reg = NULL;
+    int *R[2 + LP_FILTER_ITERS];
+    int *junk;
+    int *curr, *next;
+    int i, j;
+
+    /* Initialize low-pass filter parameters if necessary. */
+    if (lialg_lpfconst == -1)
+	lialg_compute_lpf_parameters();
+
+    /* Allocate a 2 x pts->npts array for use in computing the (filtered) Angle set, A_n. */
+    /*    junk = (int *)safe_malloc((2 + LP_FILTER_ITERS) * pts->npts * sizeof(int)); */
+    junk = allocate((2 + LP_FILTER_ITERS) * pts->npts, int);
+    for (i = 0; i < (2 + LP_FILTER_ITERS); i++)
+	R[i] = junk + (i * pts->npts);
+    curr = R[0];
+
+    /* Compute the Angle set, A, in the first element of array R. */
+    /* Values in R are in degrees, x 100. */
+    curr[0] = 18000;				/* a_0 */
+    for (i = 1; i < (pts->npts - 1); i++) {
+	int d_i = pts->pts[i].chaincode;
+	int d_iminusone = pts->pts[i-1].chaincode;
+	int a_i;
+
+	if (d_iminusone < d_i)
+	    d_iminusone += 8;
+
+	a_i = (d_iminusone - d_i) % 8;
+
+	/* convert to degrees, x 100 */
+	curr[i] = ((12 - a_i) % 8) * 45 * 100;
+    }
+    curr[pts->npts - 1]	= 18000;		/* a_L-1 */
+
+    /* Perform a number of filtering iterations. */
+    next = R[1];
+    for (j = 0; j < LP_FILTER_ITERS; j++, curr = R[j], next = R[j+1]) {
+	for (i = 0; i < pts->npts; i++) {
+	    int k;
+
+	    next[i] = 0;
+
+	    for (k = i - LP_FILTER_WIDTH; k <= i + LP_FILTER_WIDTH; k++) {
+		int oldval = (k < 0 || k >= pts->npts) ? 18000 : curr[k];
+		next[i]	+= oldval * lialg_lpfwts[k - (i	- LP_FILTER_WIDTH)];	/* overflow? */
+	    }
+
+	    next[i] /= lialg_lpfconst;
+	}
+    }
+
+    /* Do final thresholding around PI. */
+    /* curr and next are set-up correctly at end of previous loop! */
+    for (i = 0; i < pts->npts; i++) {
+	next[i] = (abs(curr[i] - 18000) < LP_FILTER_THLD)
+	  ? 18000
+	  : curr[i];
+    }
+    curr = next;
+
+    /* Debugging. */
+    if (lidebug > 1) {
+	for (i = 0; i < pts->npts; i++) {
+	    fprintf(stderr, "%3d:  (%3d, %3d)  %ld  ",
+		    i, pts->pts[i].x, pts->pts[i].y, pts->pts[i].chaincode);
+	    for (j = 0; j < 2 + LP_FILTER_ITERS; j++)
+		fprintf(stderr, "%d  ", R[j][i]);
+	    fprintf(stderr, "\n");
+	}
+    }
+
+    /* Do the region segmentation. */
+    {
+	int start, end;
+	int currtype;
+
+#define	RGN_TYPE(val)\
+    (((val) == 18000)\
+	? RGN_PLAIN\
+	: ((val) < 18000 ? RGN_CONCAVE : RGN_CONVEX))
+
+	start = 0;
+	currtype = RGN_TYPE(curr[0]);
+	/*	regions = (region_list *)safe_malloc(sizeof(region_list));*/
+	regions = allocate(1, region_list);
+	curr_reg = regions;
+	curr_reg->start = start;
+	curr_reg->end = 0;
+	curr_reg->type = currtype;
+	curr_reg->next = NULL;
+	for (i = 1; i < pts->npts; i++) {
+	    int nexttype = RGN_TYPE(curr[i]);
+
+	    if (nexttype != currtype) {
+		region_list *next_reg = NULL;
+
+		end = i - 1;
+		curr_reg->end = end;
+		if (lidebug > 1)
+		    fprintf(stderr, "  (%d, %d), %d\n", start, end, currtype);
+
+		start = i;
+		currtype = nexttype;
+		/* next_reg = (region_list *)safe_malloc(sizeof(region_list));*/
+		next_reg = allocate(1, region_list);
+		next_reg->start = start;
+		next_reg->end = 0;
+		next_reg->type = nexttype;
+		next_reg->next = NULL;
+
+		curr_reg->next = next_reg;
+		curr_reg = next_reg;
+	    }
+	}
+	end = i - 1;
+	curr_reg->end = end;
+	if (lidebug > 1)
+	    fprintf(stderr, "  (%d, %d), %d\n", start, end, currtype);
+
+	/* Filter out convex/concave regions that are too short. */
+	for (curr_reg = regions; curr_reg; curr_reg = curr_reg->next)
+	    if (curr_reg->type == RGN_PLAIN) {
+		region_list *next_reg;
+
+		for (next_reg = curr_reg->next;
+		     next_reg != NULL &&
+		       (next_reg->end - next_reg->start) < LP_FILTER_MIN;
+		     next_reg = curr_reg->next) {
+		    /* next_reg must not be plain, and it must be followed by a plain */
+		    /* assert(next_reg->type != RGN_PLAIN); */
+		    /* assert(next_reg->next != NULL && (next_reg->next)->type == RGN_PLAIN); */
+
+		    curr_reg->next = (next_reg->next)->next;
+		    curr_reg->end = (next_reg->next)->end;
+
+		    free(next_reg->next);
+		    free(next_reg);
+		}
+	    }
+
+	/* Add-in pseudo-extremes. */
+	{
+	    region_list *tmp, *prev_reg;
+
+	    tmp = regions;
+	    regions = NULL;
+	    prev_reg = NULL;
+	    for (curr_reg = tmp; curr_reg; curr_reg = curr_reg->next) {
+		if (curr_reg->type == RGN_PLAIN) {
+		    int arclen = lialg_compute_pathlen_subset(pts,
+								curr_reg->start,
+								curr_reg->end);
+		    int dx = pts->pts[curr_reg->end].x -
+		      pts->pts[curr_reg->start].x;
+		    int dy = pts->pts[curr_reg->end].y -
+		      pts->pts[curr_reg->start].y;
+		    int chordlen = isqrt(10000 * (dx * dx + dy * dy));
+		    int atcr = (chordlen == 0) ? 0 : (100 * arclen + chordlen / 2) / chordlen;
+
+		    if (lidebug)
+			fprintf(stderr, "%d, %d, %d\n", arclen, chordlen, atcr);
+
+		    /* Split region if necessary. */
+		    if (arclen >= PE_AL_THLD && atcr >= PE_ATCR_THLD) {
+			int mid = curr_reg->start + (curr_reg->end - curr_reg->start) / 2;
+			int end = curr_reg->end;
+			region_list *saved_next = curr_reg->next;
+
+			curr_reg->end = mid - 1;
+			if (prev_reg == NULL)
+			    regions = curr_reg;
+			else
+			    prev_reg->next = curr_reg;
+			prev_reg = curr_reg;
+
+			/* curr_reg = (region_list *)safe_malloc(sizeof(region_list));*/
+			curr_reg = allocate(1, region_list);
+			curr_reg->start = mid;
+			curr_reg->end = mid;
+			curr_reg->type = RGN_PSEUDO;
+			curr_reg->next = NULL;
+			prev_reg->next = curr_reg;
+			prev_reg = curr_reg;
+
+			/* curr_reg = (region_list *)safe_malloc(sizeof(region_list)); */
+			curr_reg = allocate(1, region_list);
+			curr_reg->start = mid + 1;
+			curr_reg->end = end;
+			curr_reg->type = RGN_PLAIN;
+			curr_reg->next = NULL;
+			prev_reg->next = curr_reg;
+			prev_reg = curr_reg;
+
+			curr_reg->next = saved_next;
+			continue;
+		    }
+		}
+
+		if (prev_reg == NULL)
+		    regions = curr_reg;
+		else
+		    prev_reg->next = curr_reg;
+		prev_reg = curr_reg;
+	    }
+	}
+    }
+
+    free(junk);
+    return(regions);
+}
+
+
+static point_list *lialg_compute_dompts(point_list *pts, region_list *regions) {
+    point_list *dpts = NULL;
+    int ndpts;
+    int *cas = NULL;
+    int nonplain;
+    region_list *r;
+    //int i;
+
+    /* Compute contour angle set. */
+    cas = lialg_compute_contour_angle_set(pts, regions);
+/*    assert(cas != NULL);*/
+
+    /* Dominant points include:  start_pt, end_pt, extrema_of_non_plain_regions, midpts of the preceding. */
+    nonplain = 0;
+    for (r = regions; r != NULL; r = r->next)
+	if (r->type != RGN_PLAIN) nonplain++;
+    ndpts = 2 * (2 + nonplain) - 1;
+    /* dpts = (point_list *)safe_malloc(sizeof(point_list)); */
+    dpts = allocate(1, point_list);
+    dpts->pts = make_pen_point_array(ndpts);
+    if (dpts->pts == NULL) {
+	free(dpts);
+	return(NULL);
+    }
+    dpts->npts = ndpts;
+    dpts->next = NULL;
+
+    /* Pick out dominant points. */
+    {
+	region_list *curr;
+	int dp;
+	int previx;
+	int currix;
+
+	/* Record start point. */
+	dp = 0;
+	previx = 0;
+	dpts->pts[dp++] = pts->pts[previx];
+
+	for (curr = regions; curr != NULL; curr = curr->next)
+	    if (curr->type != RGN_PLAIN) {
+		int max_v = 0;
+		int min_v = MAXINT;
+		int max_ix = -1;
+		int min_ix = -1;
+		int i;
+
+		for (i = curr->start; i <= curr->end; i++) {
+		    int v = cas[i];
+		    if (v > max_v) { max_v = v; max_ix = i; }
+		    if (v < min_v) { min_v = v; min_ix = i; }
+		    if (lidebug > 1)
+			fprintf(stderr, "  %d\n", v);
+		}
+
+		currix = (curr->type == RGN_CONVEX ? max_ix : min_ix);
+
+		/* Record midpoint. */
+		dpts->pts[dp++] = pts->pts[previx + (currix - previx) / 2];
+
+		/* Record extreme point. */
+		dpts->pts[dp++] = pts->pts[currix];
+
+		previx = currix;
+	    }
+
+	/* Record last mid-point and end point. */
+	currix = pts->npts - 1;
+	dpts->pts[dp++] = pts->pts[previx + (currix - previx) / 2];
+	dpts->pts[dp++] = pts->pts[currix];
+    }
+
+    /* Compute chain-code. */
+    lialg_compute_chain_code(dpts);
+
+    free(cas);
+    return(dpts);
+}
+
+
+static int *lialg_compute_contour_angle_set(point_list *pts,
+					       region_list *regions) {
+    int *V = NULL;
+    region_list *curr_reg, *prev_reg;
+    int i;
+    //int j;
+
+    /*    V = (int *)safe_malloc(pts->npts * sizeof(int));*/
+    V = allocate(pts->npts, int);
+
+    V[0] = 18000;
+    for (curr_reg = regions; curr_reg != NULL;
+	    prev_reg = curr_reg, curr_reg = curr_reg->next) {
+	for (i = curr_reg->start; i <= curr_reg->end; i++) {
+	    if (curr_reg->type == RGN_PLAIN) {
+		V[i] = 18000;
+	    }
+	    else {
+#ifdef	notdef
+		/* XXX - eliminate floating point */
+		region_list *next_reg = curr_reg->next;
+		int b = curr_reg->start;
+		int h = prev_reg->start;
+		int t = next_reg->end;
+		int pts_before = i - h;
+		int pts_after = t - i;
+		int min_pts = (pts_before < pts_after)
+		  ? pts_before
+		  : pts_after;
+		int k = (min_pts < T_ONE)
+		  ? T_ONE
+		  : (min_pts > T_TWO)
+		  ? T_TWO
+		  : min_pts;
+		float sum = 0.0;
+
+		for (j = 1; j <= k; j++) {
+		    int ptA = i - j;
+		    int ptB = i + j - 1;
+		    int d_A = pts->pts[ptA].chaincode;
+		    int d_B = pts->pts[ptB].chaincode;
+		    int a_i;
+
+		    if (d_A < d_B)
+			d_A += 8;
+
+		    a_i = (d_A - d_B) % 8;
+
+		    /* convert to radians */
+		    if (a_i == 4 && curr_reg->type == RGN_CONVEX)
+			sum += M_2_PI;
+		    else
+			sum += (float)((12 - a_i) % 8) / 4.0 * M_PI;
+		}
+		V[i] = sum / (float)k;
+#else
+		/* For now, simply choose the mid-point. */
+		int isMidPt = (i == (curr_reg->start +
+				     (curr_reg->end - curr_reg->start) / 2));
+		V[i] = (curr_reg->type == RGN_CONVEX)
+		  ? (isMidPt ? 18000 : 0)
+		  : (isMidPt ? 0 : 18000);
+#endif
+	    }
+	}
+    }
+    V[pts->npts - 1] = 18000;
+
+    return(V);
+}
+
+
+/*
+ *  First compute the similarity between the two strings.
+ *  If it's above a threshold, compute the distance between
+ *  the two and return it as the ``score.''
+ *  Otherwise, return the constant WORST_SCORE.
+ *
+ */
+static void lialg_score_stroke(point_list *input_dompts, point_list *curr_dompts, int *sim, int *dist) {
+    *sim = MIN_SIM;
+    *dist = MAX_DIST;
+
+    *sim = lialg_compute_similarity(input_dompts, curr_dompts);
+    if (*sim < SIM_THLD) goto done;
+
+    *dist = lialg_compute_distance(input_dompts, curr_dompts);
+
+done:
+    if (lidebug)
+	fprintf(stderr, "%d, %d\n", *sim, *dist);
+}
+
+
+static int lialg_compute_similarity(point_list *input_dompts,
+				     point_list *curr_dompts) {
+    int sim = 0;
+    point_list *A, *B;
+    int N, M;
+    int **G = NULL;
+    int *junk = NULL;
+    int i, j;
+
+    /* A is the	longer sequence, length	N. */
+    /* B is the shorter sequence, length M. */
+    if (input_dompts->npts >= curr_dompts->npts) {
+	A = input_dompts;
+	N = input_dompts->npts;
+	B = curr_dompts;
+	M = curr_dompts->npts;
+    }
+    else {
+	A = curr_dompts;
+	N = curr_dompts->npts;
+	B = input_dompts;
+	M = input_dompts->npts;
+    }
+
+    /* Allocate and initialize the Gain matrix, G. */
+    /* The size of G is M x (N + 1). */
+    /* Note that row 0 is unused. */
+    /* Similarities are x 10. */
+    {
+        /*	G = (int **)safe_malloc(M * sizeof(int *));*/
+        G = allocate(M, int *);
+        /*	junk = (int *)safe_malloc(M * (N + 1) * sizeof(int)); */
+	junk = allocate(M * (N + 1), int);
+	for (i = 0; i < M; i++)
+	    G[i] = junk + (i * (N + 1));
+
+	for (i = 1; i < M; i++) {
+	    int bval = B->pts[i-1].chaincode;
+
+	    /* Source column. */
+	    G[i][0] = 0;
+
+	    for (j = 1; j < N; j++) {
+		int aval = A->pts[j-1].chaincode;
+		int diff = abs(bval - aval);
+		if (diff > 4) diff = 8 - diff;
+
+		G[i][j] = (diff == 0)
+		  ? 10
+		  : (diff == 1)
+		  ? 6
+		  : 0;
+	    }
+
+	    /* Sink column. */
+	    G[i][N] = 0;
+	}
+    }
+
+    /* Do the DP algorithm. */
+    /* Proceed in column order, from highest column to the lowest. */
+    /* Within each column, proceed from the highest row to the lowest. */
+    /* Skip the highest column. */
+    {
+	for (j = N - 1; j >= 0; j--)
+	    for (i = M - 1; i > 0; i--) {
+		int max = G[i][j + 1];
+
+		if (i < (M - 1)) {
+		    int tmp = G[i + 1][j + 1];
+		    if (tmp > max) max = tmp;
+		}
+
+		G[i][j] += max;
+	    }
+
+	sim = (10 * G[1][0] + (N - 1) / 2) / (N - 1);
+    }
+
+    if (G != NULL) free(G);
+    if (junk != NULL) free(junk);
+    return(sim);
+}
+
+
+static int lialg_compute_distance(point_list *input_dompts,
+				   point_list *curr_dompts) {
+    int dist = MAX_DIST;
+    point_list *A, *B;
+    int N, M;
+    int **C = NULL;
+    int *junk = NULL;
+    int *BE = NULL;
+    int *TE = NULL;
+    int i, j;
+
+    /* A is the	longer sequence, length	N. */
+    /* B is the shorter sequence, length M. */
+    if (input_dompts->npts >= curr_dompts->npts) {
+	A = input_dompts;
+	N = input_dompts->npts;
+	B = curr_dompts;
+	M = curr_dompts->npts;
+    }
+    else {
+	A = curr_dompts;
+	N = curr_dompts->npts;
+	B = input_dompts;
+	M = input_dompts->npts;
+    }
+
+    /* Construct the helper vectors, BE and TE, which say for each column */
+    /* what are the ``bottom'' and ``top'' rows of interest. */
+    {
+        /*	BE = (int *)safe_malloc((N + 1) * sizeof(int));*/
+	BE = allocate((N + 1), int);
+	/*	TE = (int *)safe_malloc((N + 1) * sizeof(int)); */
+	TE = allocate((N + 1), int);
+
+	for (j = 1; j <= N; j++) {
+	    int bot, top;
+
+	    bot = j + (M - DP_BAND);
+	    if (bot > M) bot = M;
+	    BE[j] = bot;
+
+	    top = j - (N - DP_BAND);
+	    if (top < 1) top = 1;
+	    TE[j] = top;
+	}
+    }
+
+    /* Allocate and initialize the Cost matrix, C. */
+    /* The size of C is (M + 1) x (N + 1). */
+    /* Note that row and column 0 are unused. */
+    /* Costs are x 100. */
+    {
+        /*	C = (int **)safe_malloc((M + 1) * sizeof(int *)); */
+	C = allocate((M + 1), int *);
+	/*	junk = (int *)safe_malloc((M + 1) * (N + 1) * sizeof(int)); */
+	junk = allocate((M + 1) * (N + 1), int);
+	for (i = 0; i <= M; i++)
+	    C[i] = junk + (i * (N + 1));
+
+	for (i = 1; i <= M; i++) {
+	    int bx = B->pts[i-1].x;
+	    int by = B->pts[i-1].y;
+
+	    for (j = 1; j <= N; j++) {
+		int ax = A->pts[j-1].x;
+		int ay = A->pts[j-1].y;
+		int dx = bx - ax;
+		int dy = by - ay;
+		int dist = isqrt(10000 * (dx * dx + dy * dy));
+
+		C[i][j] = dist;
+	    }
+	}
+    }
+
+    /* Do the DP algorithm. */
+    /* Proceed in column order, from highest column to the lowest. */
+    /* Within each column, proceed from the highest row to the lowest. */
+    {
+	for (j = N; j > 0; j--)
+	    for (i = M; i > 0; i--) {
+		int min = MAX_DIST;
+
+		if (i > BE[j] || i < TE[j] || (j == N && i == M))
+		    continue;
+
+		if (j < N) {
+		    if (i >= TE[j+1]) {
+			int tmp = C[i][j+1];
+			if (tmp < min) min = tmp;
+		    }
+
+		    if (i < M) {
+			int tmp = C[i+1][j+1];
+			if (tmp < min) min = tmp;
+		    }
+		}
+
+		if (i < BE[j]) {
+		    int tmp = C[i+1][j];
+		    if (tmp < min) min = tmp;
+		}
+
+		C[i][j] += min;
+	    }
+
+	dist = (C[1][1] + N / 2) / N;
+    }
+
+    if (C != NULL) free(C);
+    if (junk != NULL) free(junk);
+    if (BE != NULL) free(BE);
+    if (TE != NULL) free(TE);
+    return(dist);
+}
+
+
+/*************************************************************
+
+  Digest-processing routines
+
+ *************************************************************/
+
+static int lialg_read_classifier_digest(rClassifier *rec) {
+    //int i;
+    int nclasses;
+    FILE *fp = NULL;
+
+    /* Try to open the corresponding digest file. */
+    {
+	char *clx_path;
+	char *dot;
+
+	/* Get a copy of the filename, with some room on the end. */
+	/*	clx_path = safe_malloc(strlen(rec->file_name) + 5); */
+	clx_path = allocate(strlen(rec->file_name) + 5, char);
+	strcpy(clx_path, rec->file_name);
+
+	/* Truncate the path after the last dot. */
+	dot = strrchr(clx_path, '.');
+	if (dot == NULL) { free(clx_path); return(-1); }
+	*(dot + 1) = 0;
+
+	/* Append the classifier-digest extension. */
+	strcat(clx_path, "clx");
+
+	fp = fopen(clx_path, "r");
+	if (fp == NULL) { free(clx_path); return(-1); }
+
+	free(clx_path);
+    }
+
+    /* Read-in the name and dominant points for each class. */
+    for (nclasses = 0; !feof(fp); nclasses++) {
+	point_list *dpts = NULL;
+	char class[BUFSIZ];
+	int npts;
+	int j;
+
+	if (fscanf(fp, "%s %d", class, &npts) != 2) {
+	    if (feof(fp)) break;
+
+	    goto failed;
+	}
+	rec->cnames[nclasses] = strdup(class);
+
+	/* Allocate a dominant-points list. */
+	/* dpts = (point_list *)safe_malloc(sizeof(point_list)); */
+	dpts = allocate(1, point_list);
+	dpts->pts = make_pen_point_array(npts);
+	if (dpts->pts == NULL) goto failed;
+	dpts->npts = npts;
+	dpts->next = NULL;
+
+	/* Read in each point. */
+	for (j = 0; j < npts; j++) {
+	    int x, y;
+
+	    if (fscanf(fp, "%d %d", &x, &y) != 2) goto failed;
+	    dpts->pts[j].x = x;
+	    dpts->pts[j].y = y;
+	}
+
+	/* Compute the chain-code. */
+	lialg_compute_chain_code(dpts);
+
+	/* Store the list in the rec data structure. */
+	rec->dompts[nclasses] = dpts;
+
+	continue;
+
+failed:
+	fprintf(stderr, "read_classifier_digest failed...\n");
+	for (; nclasses >= 0; nclasses--) {
+	    if (rec->cnames[nclasses] != NULL) {
+		free(rec->cnames[nclasses]);
+		rec->cnames[nclasses] = NULL;
+	    }
+	    if (rec->dompts[nclasses] != NULL) {
+		delete_examples(rec->dompts[nclasses]);
+		rec->dompts[nclasses] = NULL;
+	    }
+	}
+	if (dpts != NULL)
+	    delete_examples(dpts);
+	fclose(fp);
+	return(-1);
+    }
+
+    fclose(fp);
+    return(0);
+}
+
+
+/*************************************************************
+
+  Canonicalization routines
+
+ *************************************************************/
+
+static int lialg_canonicalize_examples(rClassifier *rec) {
+    int i;
+    int nclasses;
+
+    if (lidebug) {
+        fprintf(stderr, "lialg_canonicalize_examples working on %s\n",
+		rec->file_name);
+    }
+    /* Initialize canonical-example arrays. */
+    for (i = 0; i < MAXSCLASSES; i++) {
+	rec->canonex[i] = NULL;
+    }
+
+    /* Figure out number of classes. */
+    for (nclasses = 0;
+	  nclasses < MAXSCLASSES && rec->cnames[nclasses] != NULL;
+	  nclasses++)
+	;
+
+    /* Canonicalize the examples for each class. */
+    for (i = 0; i < nclasses; i++) {
+	int j, k;
+	int nex;
+	point_list *pts, *tmp, *avg;
+	int maxxrange, maxyrange;
+	int minx, miny, maxx, maxy;
+	int avgxrange, avgyrange, avgxoff, avgyoff, avgscale;
+
+	
+	if (lidebug) {
+	    fprintf(stderr, "lialg_canonicalize_examples working on class %s\n",
+		    rec->cnames[i]);
+	}
+	/* Make a copy of the examples. */
+	pts = NULL;
+	tmp = rec->ex[i];
+	for (nex = 0; tmp != NULL; nex++, tmp = tmp->next) {
+	    if ((pts = add_example(pts, tmp->npts, tmp->pts)) == NULL) {
+		delete_examples(pts);
+		return(-1);
+	    }
+	}
+
+	/* Canonicalize each example, and derive the max x and y ranges. */
+	maxxrange = 0;
+	maxyrange = 0;
+	for (j = 0, tmp = pts; j < nex; j++, tmp = tmp->next) {
+	    if (lialg_canonicalize_example_stroke(tmp) != 0) {
+  	        if (lidebug) {
+		    fprintf(stderr, "lialg_canonicalize_example_stroke returned error\n");
+		}
+		return(-1);
+	    }
+
+	    if (tmp->xrange > maxxrange) maxxrange = tmp->xrange;
+	    if (tmp->yrange > maxyrange) maxyrange = tmp->yrange;
+	}
+
+	/* Normalize max ranges. */
+	if (((100 * maxxrange + CANONICAL_X / 2) / CANONICAL_X) >
+	    ((100 * maxyrange + CANONICAL_Y / 2) / CANONICAL_Y)) {
+	    maxyrange = (maxyrange * CANONICAL_X + maxxrange / 2) / maxxrange;
+	    maxxrange = CANONICAL_X;
+	}
+	else {
+	    maxxrange = (maxxrange * CANONICAL_Y + maxyrange / 2) / maxyrange;
+	    maxyrange = CANONICAL_Y;
+	}
+
+	/* Re-scale each example to max ranges. */
+	for (j = 0, tmp = pts; j < nex; j++, tmp = tmp->next) {
+	    int scalex = (tmp->xrange == 0) ? 100 : (100 * maxxrange + tmp->xrange / 2) / tmp->xrange;
+	    int scaley = (tmp->yrange == 0) ? 100 : (100 * maxyrange + tmp->yrange / 2) / tmp->yrange;
+	    if (lialg_translate_points(tmp, 0, 0, scalex, scaley) != 0) {
+		delete_examples(pts);
+		return(-1);
+	    }
+	}
+
+	/* Average the examples; leave average in first example. */
+	avg = pts;				/* careful aliasing!! */
+	for (k = 0; k < NCANONICAL; k++) {
+	    int xsum = 0;
+	    int ysum = 0;
+
+	    for (j = 0, tmp = pts; j < nex; j++, tmp = tmp->next) {
+		xsum += tmp->pts[k].x;
+		ysum += tmp->pts[k].y;
+	    }
+
+	    avg->pts[k].x = (xsum + j / 2) / j;
+	    avg->pts[k].y = (ysum + j / 2) / j;
+	}
+
+	/* Compute BB of averaged stroke and re-scale. */
+	lialg_get_bounding_box(avg, &minx, &miny, &maxx, &maxy);
+	avgxrange = maxx - minx;
+	avgyrange = maxy - miny;
+	avgscale = (((100 * avgxrange + CANONICAL_X / 2) / CANONICAL_X) >
+		    ((100 * avgyrange + CANONICAL_Y / 2) / CANONICAL_Y))
+	  ? (100 * CANONICAL_X + avgxrange / 2) / avgxrange
+	  : (100 * CANONICAL_Y + avgyrange / 2) / avgyrange;
+	if (lialg_translate_points(avg, minx, miny, avgscale, avgscale) != 0) {
+	    delete_examples(pts);
+	    return(-1);
+	}
+
+	/* Re-compute the x and y ranges and center the stroke. */
+	lialg_get_bounding_box(avg, &minx, &miny, &maxx, &maxy);
+	avgxrange = maxx - minx;
+	avgyrange = maxy - miny;
+	avgxoff = -((CANONICAL_X - avgxrange + 1) / 2);
+	avgyoff = -((CANONICAL_Y - avgyrange + 1) / 2);
+	if (lialg_translate_points(avg, avgxoff, avgyoff, 100, 100) != 0) {
+	    delete_examples(pts);
+	    return(-1);
+	}
+
+	/* Create a point list to serve as the ``canonical representation. */
+	if ((rec->canonex[i] = add_example(NULL, avg->npts, avg->pts)) == NULL) {
+	    delete_examples(pts);
+	    return(-1);
+	}
+	(rec->canonex[i])->xrange = maxx - minx;
+	(rec->canonex[i])->yrange = maxy - miny;
+
+	if (lidebug) {
+	    fprintf(stderr, "%s, avgpts = %d\n", rec->cnames[i], avg->npts);
+	    for (j = 0; j < avg->npts; j++) {
+		fprintf(stderr, "  (%d, %d)\n",
+			avg->pts[j].x, avg->pts[j].y);
+	    }
+	}
+
+	/* Compute dominant points of canonical representation. */
+	rec->dompts[i] = lialg_compute_dominant_points(avg);
+
+	/* Clean up. */
+	delete_examples(pts);
+    }
+
+    /* Sanity check. */
+    for (i = 0; i < nclasses; i++) {
+	char *best_name = lialg_recognize_stroke(rec, rec->canonex[i]);
+
+	if (best_name != rec->cnames[i])
+	    fprintf(stderr, "%s, best = %s\n", rec->cnames[i], best_name);
+    }
+
+    return(0);
+}
+
+
+static int lialg_canonicalize_example_stroke(point_list *points) {
+    int minx, miny, maxx, maxy, xrange, yrange, scale;
+
+    /* Filter out points that are too close. */
+    if (lialg_filter_points(points) != 0) return(-1);
+
+    /* Must be at least two points! */
+    if (points->npts < 2) {
+        if (lidebug) {
+	    fprintf(stderr, "lialg_canonicalize_example_stroke: npts=%d\n",
+		    points->npts);
+	}
+        return(-1);
+    }
+
+    /* Scale up to avoid conversion errors. */
+    lialg_get_bounding_box(points, &minx, &miny, &maxx, &maxy);
+    xrange = maxx - minx;
+    yrange = maxy - miny;
+    scale = (((100 * xrange + CANONICAL_X / 2) / CANONICAL_X) >
+	     ((100 * yrange + CANONICAL_Y / 2) / CANONICAL_Y))
+      ? (100 * CANONICAL_X + xrange / 2) / xrange
+      : (100 * CANONICAL_Y + yrange / 2) / yrange;
+    if (lialg_translate_points(points, minx, miny, scale, scale) != 0) {
+        if (lidebug) {
+	    fprintf(stderr, "lialg_translate_points (minx=%d,miny=%d,scale=%d) returned error\n", minx, miny, scale);
+	}
+	return(-1);
+    }
+
+    /* Compute an equivalent stroke with equi-distant points. */
+    if (lialg_compute_equipoints(points) != 0) return(-1);
+
+    /* Re-translate the points to the origin. */
+    lialg_get_bounding_box(points, &minx, &miny, &maxx, &maxy);
+    if (lialg_translate_points(points, minx, miny, 100, 100) != 0) {
+        if (lidebug) {
+	    fprintf(stderr, "lialg_translate_points (minx=%d,miny=%d) returned error\n", minx, miny);
+	}
+        return(-1);
+    }
+
+    /* Store the x and y ranges in the point list. */
+    xrange = maxx - minx;
+    yrange = maxy - miny;
+    points->xrange = xrange;
+    points->yrange = yrange;
+
+    if (lidebug) {
+	int i;
+	fprintf(stderr, "Canonicalized:   %d, %d, %d, %d\n", minx, miny, maxx, maxy);
+	for (i = 0; i < points->npts; i++)
+	    fprintf(stderr, "      (%d %d)\n",
+		    points->pts[i].x, points->pts[i].y);
+	fflush(stderr);
+    }
+
+    return(0);
+}
+
+
+static int lialg_compute_equipoints(point_list *points) {
+    pen_point *equipoints = make_pen_point_array(NCANONICAL);
+    int nequipoints = 0;
+    int pathlen = lialg_compute_pathlen(points);
+    int equidist = (pathlen + (NCANONICAL - 1) / 2) / (NCANONICAL - 1);
+    int i;
+    int dist_since_last_eqpt;
+    int remaining_seglen;
+    int dist_to_next_eqpt;
+
+    if (equipoints == NULL) {
+	error("can't allocate memory in lialg_compute_equipoints");
+	return(-1);
+    }
+
+    if (lidebug) {
+	fprintf(stderr, "compute_equipoints:  npts = %d, pathlen = %d, equidist = %d\n",
+		points->npts, pathlen, equidist);
+	fflush(stderr);
+    }
+
+    /* First original point is an equipoint. */
+    equipoints[0] = points->pts[0];
+    nequipoints++;
+    dist_since_last_eqpt = 0;
+
+    for (i = 1; i < points->npts; i++) {
+	int dx1 = points->pts[i].x - points->pts[i-1].x;
+	int dy1 = points->pts[i].y - points->pts[i-1].y;
+	int endx = 100 * points->pts[i-1].x;
+	int endy = 100 * points->pts[i-1].y;
+	remaining_seglen = isqrt(10000 * (dx1 * dx1 + dy1 * dy1));
+	dist_to_next_eqpt = equidist - dist_since_last_eqpt;
+
+	while (remaining_seglen >= dist_to_next_eqpt) {
+	    if (dx1 == 0) {
+		/* x-coordinate stays the same */
+		if (dy1 >= 0)
+		    endy += dist_to_next_eqpt;
+		else
+		    endy -= dist_to_next_eqpt;
+	    }
+	    else {
+		int slope = (100 * dy1 + dx1 / 2) / dx1;
+		int tmp = isqrt(10000 + slope * slope);
+		int dx = (100 * dist_to_next_eqpt + tmp / 2) / tmp;
+		int dy = (slope * dx + 50) / 100;
+
+		if (dy < 0) dy = -dy;
+		if (dx1 >= 0)
+		    endx += dx;
+		else
+		    endx -= dx;
+		if (dy1 >= 0)
+		    endy += dy;
+		else
+		    endy -= dy;
+	    }
+
+	    equipoints[nequipoints].x = (endx + 50) / 100;
+	    equipoints[nequipoints].y = (endy + 50) / 100;
+	    nequipoints++;
+/*	    assert(nequipoints <= NCANONICAL);*/
+	    dist_since_last_eqpt = 0;
+	    remaining_seglen -= dist_to_next_eqpt;
+	    dist_to_next_eqpt = equidist;
+	}
+
+	dist_since_last_eqpt += remaining_seglen;
+    }
+
+    /* Take care of last equipoint. */
+    if (nequipoints == NCANONICAL) {
+	/* Good. */
+    } else if (nequipoints == (NCANONICAL - 1)) {
+	/* Make last original point the last equipoint. */
+	equipoints[nequipoints] = points->pts[points->npts - 1];
+    } else {
+      if (lidebug) {
+        fprintf(stderr,"lialg_compute_equipoints: nequipoints = %d\n", 
+		nequipoints);
+      }
+/*	assert(false);*/
+	return(-1);
+    }
+
+    points->npts = NCANONICAL;
+    delete_pen_point_array(points->pts);
+    points->pts = equipoints;
+    return(0);
+}
+
+
+/*************************************************************
+
+  Utility routines
+
+ *************************************************************/
+
+/* Result is x 100. */
+static int lialg_compute_pathlen(point_list *points) {
+    return(lialg_compute_pathlen_subset(points, 0, points->npts - 1));
+}
+
+
+/* Result is x 100. */
+static int lialg_compute_pathlen_subset(point_list *points,
+					   int start, int end) {
+    int pathlen;
+    int i;
+
+    pathlen = 0;
+    for (i = start + 1; i <= end; i++) {
+	int dx = points->pts[i].x - points->pts[i-1].x;
+	int dy = points->pts[i].y - points->pts[i-1].y;
+	int dist = isqrt(10000 * (dx * dx + dy * dy));
+	pathlen += dist;
+    }
+
+    return(pathlen);
+}
+
+
+/* Note that this does NOT update points->xrange and points->yrange! */
+static int lialg_filter_points(point_list *points) {
+    int filtered_npts;
+    pen_point *filtered_pts = make_pen_point_array(points->npts);
+    int i;
+
+    if (filtered_pts == NULL) {
+	error("can't allocate memory in lialg_filter_points");
+	return(-1);
+    }
+
+    filtered_pts[0] = points->pts[0];
+    filtered_npts = 1;
+    for (i = 1; i < points->npts; i++) {
+	int j = filtered_npts - 1;
+	int dx = points->pts[i].x - filtered_pts[j].x;
+	int dy = points->pts[i].y - filtered_pts[j].y;
+	int magsq = dx * dx + dy * dy;
+
+	if (magsq >= DIST_SQ_THRESHOLD) {
+	    filtered_pts[filtered_npts] = points->pts[i];
+	    filtered_npts++;
+	}
+    }
+
+    points->npts = filtered_npts;
+    delete_pen_point_array(points->pts);
+    points->pts = filtered_pts;
+    return(0);
+}
+
+
+/* scalex and scaley are x 100. */
+/* Note that this does NOT update points->xrange and points->yrange! */
+static int lialg_translate_points(point_list *points,
+				   int minx, int miny,
+				   int scalex, int scaley) {
+    int i;
+
+    for (i = 0; i < points->npts; i++) {
+	points->pts[i].x = ((points->pts[i].x - minx) * scalex + 50) / 100;
+	points->pts[i].y = ((points->pts[i].y - miny) * scaley + 50) / 100;
+    }
+
+    return(0);
+}
+
+
+static void lialg_get_bounding_box(point_list *points,
+				    int *pminx, int *pminy,
+				    int *pmaxx, int *pmaxy) {
+    int minx, miny, maxx, maxy;
+    int i;
+
+    minx = maxx = points->pts[0].x;
+    miny = maxy = points->pts[0].y;
+    for (i = 1; i < points->npts; i++) {
+	pen_point *pt = &(points->pts[i]);
+	if (pt->x < minx) minx = pt->x;
+	if (pt->x > maxx) maxx = pt->x;
+	if (pt->y < miny) miny = pt->y;
+	if (pt->y > maxy) maxy = pt->y;
+    }
+
+    *pminx = minx;
+    *pminy = miny;
+    *pmaxx = maxx;
+    *pmaxy = maxy;
+}
+
+
+static void lialg_compute_lpf_parameters() {
+    int i;
+
+    for (i = LP_FILTER_WIDTH; i >= 0; i--) {
+	float x = 0.04 * (i * i);
+#ifdef ARM_LINUX
+	double tmp = 100.0 * exp((double)x);
+#else
+	float tmp = 100.0 * expf(x);
+#endif
+	int wt = rint((double)tmp);
+
+	lialg_lpfwts[LP_FILTER_WIDTH - i] = wt;
+	lialg_lpfwts[LP_FILTER_WIDTH + i] = wt;
+    }
+    lialg_lpfconst = 0;
+    for (i = 0; i < (2 * LP_FILTER_WIDTH + 1); i++) {
+	lialg_lpfconst += lialg_lpfwts[i];
+    }
+}
+
+
+/* Code from Joseph Hall (jnhall@sat.mot.com). */
+static int isqrt(int n) {
+    register int i;
+    register long k0, k1, nn;
+
+    for (nn = i = n, k0 = 2; i > 0; i >>= 2, k0 <<= 1)
+	;
+    nn <<= 2;
+    for (;;) {
+	k1 = (nn / k0 + k0) >> 1;
+	if (((k0 ^ k1) & ~1) == 0)
+	    break;
+	k0 = k1;
+    }
+    return (int) ((k1 + 1) >> 1);
+}
+
+
+/* Helper routines from Mark Hayter. */
+static int likeatan(int tantop, int tanbot) { 
+    int t;
+    /* Use tan(theta)=top/bot --> order for t */
+    /* t in range 0..0x40000 */
+
+    if ((tantop == 0) && (tanbot == 0)) 
+	t = 0;
+    else
+    {
+	t = (tantop << 16) / (abs(tantop) + abs(tanbot));
+	if (tanbot < 0) 
+	    t = 0x20000 - t;
+	else 
+	    if (tantop < 0) t = 0x40000 + t;
+    }
+    return t;
+}
+
+
+static int quadr(int t) {
+    return (8 - (((t + 0x4000) >> 15) & 7)) & 7;
+}
diff -urN lib/microwindows/src/demos/nxscribble/li_recognizer.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/li_recognizer.h
--- lib/microwindows/src/demos/nxscribble/li_recognizer.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/li_recognizer.h	2005-02-21 16:03:03.000000000 +0100
@@ -0,0 +1,38 @@
+/*
+ *  li_recognizer.h
+ *
+ *  Adapted from cmu_recognizer.h.
+ *  Credit to Dean Rubine, Jim Kempf, and Ari Rapkin.
+ */
+
+#ifndef _LI_RECOGNIZER_H_
+
+#define _LI_RECOGNIZER_H_
+
+/*Extension function interfaces and indices.*/
+
+#define LI_ISA_LI         0               /*Is this a li recognizer?.*/
+
+typedef bool (*li_isa_li)(recognizer r);
+
+#define LI_TRAIN	    1		   /*Train recognizer*/
+
+typedef int (*li_recognizer_train)(recognizer r,
+				    rc* rec_xt,
+				    u_int nstrokes,
+				    pen_stroke* strokes,
+				    rec_element* re,
+				    bool replace_p);
+
+#define LI_CLEAR           2              /* ari's clear-state extension fn. */
+
+typedef int (*li_recognizer_clearState)(recognizer r);
+
+#define LI_GET_CLASSES     3              /* ari's get-classes extension fn. */
+
+typedef int (*li_recognizer_getClasses)(recognizer r, char ***list, int *nc);
+
+#define LI_NUM_EX_FNS     4               /*Number of extension functions*/
+
+#endif
+
diff -urN lib/microwindows/src/demos/nxscribble/li_recognizer_internal.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/li_recognizer_internal.h
--- lib/microwindows/src/demos/nxscribble/li_recognizer_internal.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/li_recognizer_internal.h	2005-02-21 16:03:04.000000000 +0100
@@ -0,0 +1,49 @@
+/*
+ *  li_recognizer_internal.h
+ *
+ *  Adapted from cmu_recognizer_internal.h.
+ *  Credit to Dean Rubine, Jim Kempf, and Ari Rapkin.
+ */
+
+#ifndef _LI_RECOGNIZER_INTERNAL_H_
+
+#define _LI_RECOGNIZER_INTERNAL_H_
+
+#include <hre_internal.h>
+#include "sc.h"
+
+typedef struct PointList {
+    int npts;
+    int xrange, yrange;
+    pen_point* pts;
+    struct PointList* next;
+} point_list;
+
+typedef struct {
+    char* file_name;              /*The classifier file name.*/
+    sClassifier sc;               /*The classifier.*/
+    point_list* ex[MAXSCLASSES];   /*The training examples.*/
+    char* cnames[MAXSCLASSES];    /*The class names.*/
+    point_list*	canonex[MAXSCLASSES];	/* Canonicalized versions of the strokes. */
+    point_list*	dompts[MAXSCLASSES];	/* Dominant points */
+} rClassifier;
+
+
+/*This structure contains extra fields for instance-specific data.*/
+
+typedef struct {
+    /*Instance-specific data.*/
+    u_int li_magic;            /*Just to make sure nobody's cheating.*/
+    rClassifier li_rc;         /*The character classifier.*/
+} li_recognizer;
+
+
+/*Name of the default classifier file.*/
+#define LI_DEFAULT_CLASSIFIER_FILE   "default.cl"
+
+/*Classifier file extension.*/
+#define LI_CLASSIFIER_EXTENSION ".cl"
+
+/*Locale supported by recognizer.*/
+#define LI_SUPPORTED_LOCALE  REC_DEFAULT_LOCALE
+#endif
diff -urN lib/microwindows/src/demos/nxscribble/matrix.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/matrix.c
--- lib/microwindows/src/demos/nxscribble/matrix.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/matrix.c	2005-02-21 16:13:01.000000000 +0100
@@ -0,0 +1,724 @@
+/***********************************************************************
+
+matrix.c - simple matrix operations
+
+Copyright (C) 1991 Dean Rubine
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License. See ../COPYING for
+the full agreement.
+
+**********************************************************************/
+
+/*
+ Simple matrix operations
+ Why I am writing this stuff over is beyond me
+*/
+
+#undef PIQ_DEBUG
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "util.h"
+#include "matrix.h"
+
+
+typedef	struct array_header *Array;
+
+#define EPSILON		(1.0e-10)	/* zero range */
+
+/*
+ Allocation functions
+*/
+
+
+Vector
+NewVector(r)
+int r;
+{
+	register struct array_header *a;
+	register Vector v;
+
+	a = (struct array_header *)
+	    allocate(sizeof(struct array_header) + r * sizeof(double), char);
+	a->ndims = 1;
+	a->nrows = r;
+	a->ncols = 1;
+	v = (Vector) (a + 1);
+
+#define CHECK
+#ifdef CHECK
+	if(HEADER(v) != (struct array_header *) a ||
+	   NDIMS(v) != 1 || NROWS(v) != r || NCOLS(v) != 1) {
+	    	exit_error("NewVector error: v=%x H: %x,%x  D:%d,%d  R:%d,%d  C:%d,%d\n", v,  HEADER(v), a,  NDIMS(v), 1,  NROWS(v), r, NCOLS(v), 1);
+	    }
+#endif
+
+	return v;
+}
+
+Matrix
+NewMatrix(r, c)
+int r, c;
+{
+	register struct array_header *a = (struct array_header *)
+	   allocate(sizeof(struct array_header) + r * sizeof(double *), char);
+	register int i;
+	register Matrix m;
+
+	m = (Matrix) (a + 1);
+	for(i = 0; i < r; i++)
+		m[i] = allocate(c, double);
+	a->ndims = 2;
+	a->nrows = r;
+	a->ncols = c;
+	return m;
+}
+
+void
+FreeVector(v)
+Vector v;
+{
+	free(HEADER(v));
+}
+
+void
+FreeMatrix(m)
+Matrix m;
+{
+	register int i;
+
+	for(i = 0; i < NROWS(m); i++)
+		free(m[i]);
+	free(HEADER(m));
+}
+
+Vector
+VectorCopy(v)
+register Vector v;
+{
+	register Vector r = NewVector(NROWS(v));
+	register int i;
+
+	for(i = 0; i < NROWS(v); i++)
+		r[i] = v[i];
+	return r;
+}
+
+Matrix
+MatrixCopy(m)
+register Matrix m;
+{
+	register Matrix r = NewMatrix(NROWS(m), NCOLS(m));
+	register int i, j;
+
+	for(i = 0; i < NROWS(m); i++)
+		for(j = 0; j < NROWS(m); j++)
+			r[i][j] = m[i][j];
+	return r;
+}
+
+/* Null vector and matrixes */
+
+
+void
+ZeroVector(v)
+Vector v;
+{
+	register int i;
+	for(i = 0; i < NROWS(v); i++) v[i] = 0.0;
+}
+
+
+void
+ZeroMatrix(m)
+Matrix m;
+{
+	register int i, j;
+	for(i = 0; i < NROWS(m); i++)
+		for(j = 0; j < NCOLS(m); j++)
+			m[i][j] = 0.0;
+}
+
+void
+FillMatrix(m, fill)
+Matrix m;
+double fill;
+{
+	register int i, j;
+	for(i = 0; i < NROWS(m); i++)
+		for(j = 0; j < NCOLS(m); j++)
+			m[i][j] = fill;
+}
+
+double
+InnerProduct(v1, v2)
+register Vector v1, v2;
+{
+	double result = 0;
+	register int n = NROWS(v1);
+	if(n != NROWS(v2)) {
+		exit_error("InnerProduct %d x %d ", n, NROWS(v2));
+	    }
+	while(--n >= 0)
+		result += *v1++ * *v2++;
+	return result;
+}
+
+void
+MatrixMultiply(m1, m2, prod)
+register Matrix m1, m2, prod;
+{
+	register int i, j, k;
+	double sum;
+
+	if(NCOLS(m1) != NROWS(m2)) {
+		error("MatrixMultiply: Can't multiply %dx%d and %dx%d matrices",
+			NROWS(m1), NCOLS(m1), NROWS(m2), NCOLS(m2));
+		return;
+	    }
+	if(NROWS(prod) != NROWS(m1) || NCOLS(prod) != NCOLS(m2)) {
+		error("MatrixMultiply: %dx%d times %dx%d does not give %dx%d product",
+			NROWS(m1), NCOLS(m1), NROWS(m2), NCOLS(m2),
+			NROWS(prod), NCOLS(prod));
+		return;
+	    }
+
+	for(i = 0; i < NROWS(m1); i++)
+		for(j = 0; j < NCOLS(m2); j++) {
+			sum = 0;
+			for(k = 0; k < NCOLS(m1); k++)
+				sum += m1[i][k] * m2[k][j];
+			prod[i][j] = sum;
+		}
+}
+
+/*
+Compute result = v'm where
+	v is a column vector (r x 1)
+	m is a matrix (r x c)
+	result is a column vector (c x 1)
+*/
+
+void
+VectorTimesMatrix(v, m, prod)
+Vector v;
+Matrix m;
+Vector prod;
+{
+	register int i, j;
+
+	if(NROWS(v) != NROWS(m)) {
+		error("VectorTimesMatrix: Can't multiply %d vector by %dx%d",
+			NROWS(v), NROWS(m), NCOLS(m));
+		return;
+	    }
+	if(NROWS(prod) != NCOLS(m)) {
+		error("VectorTimesMatrix: %d vector times %dx%d mat does not fit in %d product" ,
+			NROWS(v), NROWS(m), NCOLS(m), NROWS(prod));
+		return;
+	    }
+
+	for(j = 0; j < NCOLS(m); j++) {
+		prod[j] = 0;
+		for(i = 0; i < NROWS(m); i++)
+			prod[j] += v[i] * m[i][j];
+	}
+}	
+
+void
+ScalarTimesVector(s, v, product)
+double s;
+register Vector v, product;
+{
+	register int n = NROWS(v);
+
+	if(NROWS(v) != NROWS(product)) {
+		error("ScalarTimesVector: result wrong size (%d!=%d)",
+			NROWS(v), NROWS(product));
+		return;
+	    }
+
+	while(--n >= 0)
+		*product++ = s * *v++;
+}
+
+void
+ScalarTimesMatrix(s, m, product)
+double s;
+register Matrix m, product;
+{
+	register int i, j;
+
+	if(NROWS(m) != NROWS(product)  || 
+	   NCOLS(m) != NCOLS(product)) {
+		error("ScalarTimesMatrix: result wrong size (%d!=%d)or(%d!=%d)",
+			NROWS(m), NROWS(product),
+			NCOLS(m), NCOLS(product));
+		return;
+	    }
+
+	for(i = 0; i < NROWS(m); i++)
+		for(j = 0; j < NCOLS(m); j++)
+			product[i][j] = s * m[i][j];
+}
+
+/*
+ Compute v'mv
+ */
+
+double
+QuadraticForm(v, m)
+register Vector v;
+register Matrix m;
+{
+	register int i, j, n;
+	double result = 0;
+
+	n = NROWS(v);
+
+	if(n != NROWS(m) || n != NCOLS(m)) {
+		exit_error("QuadraticForm: bad matrix size (%dx%d not %dx%d)",
+			NROWS(m), NCOLS(m), n, n);
+	    }
+	for(i = 0; i < n; i++)
+		for(j = 0; j < n; j++) {
+
+#ifdef PIQ_DEBUG
+			printf("%g*%g*%g [%g] %s ",
+			m[i][j],v[i],v[j],
+			m[i][j] * v[i] * v[j],
+			i==n-1&&j==n-1? "=" : "+");
+#endif
+
+			result += m[i][j] * v[i] * v[j];
+		}
+	return result;
+}
+
+/* Matrix inversion using full pivoting.
+ * The standard Gauss-Jordan method is used.
+ * The return value is the determinant.
+ * The input matrix may be the same as the result matrix
+ *
+ *	det = InvertMatrix(inputmatrix, resultmatrix);
+ *
+ * HISTORY
+ * 26-Feb-82  David Smith (drs) at Carnegie-Mellon University
+ *	Written.
+ * Sun Mar 20 19:36:16 EST 1988 - converted to this form by Dean Rubine
+ *
+ */
+
+int	DebugInvertMatrix = 0;
+
+#define PERMBUFSIZE 200	/* Max mat size */
+
+#define _abs(x) ((x)>=0 ? (x) : -(x))
+
+double
+InvertMatrix(ym, rm)
+Matrix ym, rm;
+{
+	register int i, j, k;
+	double det, biga, recip_biga, hold;
+	int l[PERMBUFSIZE], m[PERMBUFSIZE];
+	register int n;
+
+	if(NROWS(ym) != NCOLS(ym)) {
+		exit_error("InvertMatrix: not square");
+	    }
+
+	n = NROWS(ym);
+
+	if(n != NROWS(rm) || n != NCOLS(rm)) {
+		exit_error("InvertMatrix: result wrong size");
+	    }
+
+	/* Copy ym to rm */
+	
+	if(ym != rm)
+		for(i = 0; i < n; i++)
+			for(j = 0; j < n; j++)
+				rm[i][j] = ym[i][j];
+
+
+	//if(DebugInvertMatrix) PrintMatrix(rm, "Inverting (det=%g)\n", det);
+
+    /* Allocate permutation vectors for l and m, with the same origin
+       as the matrix. */
+
+	if (n >= PERMBUFSIZE) {
+		exit_error("InvertMatrix: PERMBUFSIZE");
+	    }
+
+	det = 1.0;
+	for (k = 0; k < n;  k++) {
+		l[k] = k;  m[k] = k;
+		biga = rm[k][k];
+
+		/* Find the biggest element in the submatrix */
+		for (i = k;  i < n;  i++)
+			for (j = k; j < n; j++)
+				if (_abs(rm[i][j]) > _abs(biga)) {
+					biga = rm[i][j];
+					l[k] = i;
+					m[k] = j;
+				}
+
+		if(DebugInvertMatrix) 
+			if(biga == 0.0)
+				PrintMatrix(m, "found zero biga = %g\n", biga);
+
+		/* Interchange rows */
+		i = l[k];
+		if (i > k)
+			for (j = 0; j < n; j++) {
+				hold = -rm[k][j];
+				rm[k][j] = rm[i][j];
+				rm[i][j] = hold;
+			}
+
+		/* Interchange columns */
+		j = m[k];
+		if (j > k)
+			for (i = 0; i < n; i++) {
+				hold = -rm[i][k];
+				rm[i][k] = rm[i][j];
+				rm[i][j] = hold;
+			}
+
+		/* Divide column by minus pivot
+		    (value of pivot element is contained in biga). */
+		if (biga == 0.0) {
+			return 0.0;
+		}
+
+		if(DebugInvertMatrix) printf("biga = %g\n", biga);
+		recip_biga = 1/biga;
+		for (i = 0; i < n; i++)
+			if (i != k)
+				rm[i][k] *= -recip_biga;
+
+		/* Reduce matrix */
+		for (i = 0; i < n; i++)
+			if (i != k) {
+				hold = rm[i][k];
+				for (j = 0; j < n; j++)
+					if (j != k)
+						rm[i][j] += hold * rm[k][j];
+			}
+
+		/* Divide row by pivot */
+		for (j = 0; j < n; j++)
+			if (j != k)
+				rm[k][j] *= recip_biga;
+
+		det *= biga;	/* Product of pivots */
+		if(DebugInvertMatrix) printf("det = %g\n", det);
+		rm[k][k] = recip_biga;
+
+	}	/* K loop */
+
+	/* Final row & column interchanges */
+	for (k = n - 1; k >= 0; k--) {
+		i = l[k];
+		if (i > k)
+			for (j = 0; j < n; j++) {
+				hold = rm[j][k];
+				rm[j][k] = -rm[j][i];
+				rm[j][i] = hold;
+			}
+		j = m[k];
+		if (j > k)
+			for (i = 0; i < n; i++) {
+				hold = rm[k][i];
+				rm[k][i] = -rm[j][i];
+				rm[j][i] = hold;
+			}
+	}
+
+	if(DebugInvertMatrix) printf("returning, det = %g\n", det);
+
+	return det;
+}
+
+
+#include "bitvector.h"
+
+Vector
+SliceVector(v, rowmask)
+Vector v;
+BitVector rowmask;
+{
+	register int i, ri;
+
+	Vector r = NewVector(bitcount(NROWS(v), rowmask));
+	for(i = ri = 0; i < NROWS(v); i++)
+		if(IS_SET(i, rowmask) )
+			r[ri++] = v[i];
+	return r;
+}
+
+Matrix
+SliceMatrix(m, rowmask, colmask)
+Matrix m;
+BitVector rowmask, colmask;
+{
+	register int i, ri, j, rj;
+
+	Matrix r;
+	
+	r = NewMatrix(bitcount(NROWS(m), rowmask),
+			     bitcount(NCOLS(m), colmask));
+	for(i = ri = 0; i < NROWS(m); i++)
+		if(IS_SET(i, rowmask) ) {
+			for(j = rj = 0; j < NCOLS(m); j++)
+				if(IS_SET(j, colmask))
+					r[ri][rj++] = m[i][j];
+			ri++;
+		}
+
+	return r;
+}
+
+Matrix
+DeSliceMatrix(m, fill, rowmask, colmask, r)
+Matrix m;
+double fill;
+BitVector rowmask, colmask;
+Matrix r;
+{
+	register int i, ri, j, rj;
+
+	FillMatrix(r, fill);
+
+	for(i = ri = 0; i < NROWS(r); i++) {
+		if(IS_SET(i, rowmask) )  {
+			for(j = rj = 0; j < NCOLS(r); j++)
+				if(IS_SET(j, colmask))
+					r[i][j] = m[ri][rj++];
+			ri++;
+		}
+	}
+
+	return r;
+}
+
+void
+OutputVector(f, v)
+FILE *f;
+register Vector v;
+{
+	register int i;
+	fprintf(f, " V %d   ", NROWS(v));
+	for(i = 0; i < NROWS(v); i++)
+		fprintf(f, " %g", v[i]);
+	fprintf(f, "\n");
+}
+
+Vector
+InputVector(f)
+FILE *f;
+{
+	register Vector v;
+	register int i;
+	char check[4];
+	int nrows;
+
+	if(fscanf(f, "%1s %d", check, &nrows) != 2) {
+		exit_error("InputVector fscanf 1");
+	    }
+	if(check[0] != 'V') {
+		exit_error("InputVector check");
+	    }
+	v = NewVector(nrows);
+	for(i = 0; i < nrows; i++)
+		if(fscanf(f, "%lf", &v[i]) != 1) {
+			exit_error("InputVector fscanf 2");
+		    }
+	return v;
+}
+
+void
+OutputMatrix(f, m)
+FILE* f;
+register Matrix m;
+{
+	register int i, j;
+	fprintf(f, " M %d %d\n", NROWS(m), NCOLS(m));
+	for(i = 0; i < NROWS(m);  i++) {
+		for(j = 0; j < NCOLS(m); j++)
+			fprintf(f, " %g", m[i][j]);
+		fprintf(f, "\n");
+	}
+}
+
+Matrix
+InputMatrix(f)
+FILE *f;
+{
+	register Matrix m;
+	register int i, j;
+	char check[4];
+	int nrows, ncols;
+
+	if(fscanf(f, "%1s %d %d", check, &nrows, &ncols) != 3) {
+		exit_error("InputMatrix fscanf 1");
+	    }
+	if(check[0] != 'M') {
+		exit_error("InputMatrix check");
+	    }
+	m = NewMatrix(nrows, ncols);
+	for(i = 0; i < nrows; i++)
+		for(j = 0; j < ncols; j++)
+			if(fscanf(f, "%lf", &m[i][j]) != 1) {
+				exit_error("InputMatrix fscanf 2");
+			    }
+
+	return m;
+}
+
+double
+InvertSingularMatrix(m, inv)
+Matrix m, inv;
+{
+	register int i, j, k;
+	BitVector mask;
+	Matrix sm;
+	double det, maxdet;
+	int mi = -1, mj = -1, mk = -1;
+
+	maxdet = 0.0;
+	for(i = 0; i < NROWS(m); i++) {
+		printf("r&c%d, ", i); 
+		SET_BIT_VECTOR(mask);
+		BIT_CLEAR(i, mask);
+		sm = SliceMatrix(m, mask, mask);
+		det = InvertMatrix(sm, sm);
+		if(det == 0.0)
+			printf("det still 0\n");
+		else {
+			printf("det = %g\n", det);
+		}
+		if(_abs(det) > _abs(maxdet))
+			maxdet = det, mi = i;
+		FreeMatrix(sm);
+	}
+	printf("\n");
+
+	printf("maxdet=%g when row %d left out\n", maxdet, mi);
+	if(fabs(maxdet) > 1.0e-6) {
+		goto found;
+	}
+
+	maxdet = 0.0;
+	for(i = 0; i < NROWS(m); i++) {
+	     for(j = i+1; j < NROWS(m); j++) {
+		/* printf("leaving out row&col %d&%d, ", i, j); */
+		SET_BIT_VECTOR(mask);
+		BIT_CLEAR(i, mask);
+		BIT_CLEAR(j, mask);
+		sm = SliceMatrix(m, mask, mask);
+		det = InvertMatrix(sm, sm);
+		/*
+		if(det == 0.0)
+			printf("det still 0\n");
+		else {
+			printf("det = %g\n", det);
+		}
+		*/
+		if(abs(det) > abs(maxdet))
+			maxdet = det, mi = i, mj = j;
+		FreeMatrix(sm);
+	    }
+	}
+
+	printf("maxdet=%g when rows %d,%d left out\n", maxdet, mi, mj);
+	if(_abs(maxdet) > 1.0e-6) {
+		goto found;
+	}
+
+	maxdet = 0.0;
+	for(i = 0; i < NROWS(m); i++) {
+	   for(j = i+1; j < NROWS(m); j++) {
+	      for(k = j+1; k < NROWS(m); k++) {
+		/* printf("leaving out row&col %d,%d&%d, ", i, j, k); */
+		SET_BIT_VECTOR(mask);
+		BIT_CLEAR(i, mask);
+		BIT_CLEAR(j, mask);
+		BIT_CLEAR(k, mask);
+		sm = SliceMatrix(m, mask, mask);
+		det = InvertMatrix(sm, sm);
+		/*
+		if(det == 0.0)
+			printf("det still 0\n");
+		else {
+			printf("det = %g\n", det);
+		}
+		*/
+		if(_abs(det) > _abs(maxdet))
+			maxdet = det, mi = i, mj = j, mk = k;
+		FreeMatrix(sm);
+	      }
+	   }
+	}
+	printf("maxdet=%g when rows %d,%d&%d left out\n", maxdet, mi, mj, mk);
+	if(mk == -1)
+		return 0.0;
+
+found:
+
+	SET_BIT_VECTOR(mask);
+	if(mi >= 0) BIT_CLEAR(mi, mask);
+	if(mj >= 0) BIT_CLEAR(mj, mask);
+	if(mk >= 0) BIT_CLEAR(mk, mask);
+	sm = SliceMatrix(m, mask, mask);
+	det = InvertMatrix(sm, sm);
+	DeSliceMatrix(sm, 0.0, mask, mask, inv);
+	FreeMatrix(sm);
+	PrintMatrix(inv, "desliced:\n");
+	return det;
+}
+
+/* You can fairly confidently ignore the compiler warnings after here */
+
+void
+PrintVector(v, s,a1,a2,a3,a4,a5,a6,a7,a8)
+register Vector v;
+char *s; int a1,a2,a3,a4,a5,a6,a7,a8;
+{
+	register int i;
+	printf(s,a1,a2,a3,a4,a5,a6,a7,a8);
+
+	for(i = 0; i < NROWS(v); i++) printf(" %8.4f", v[i]);
+	printf("\n");
+}
+
+void
+PrintMatrix(m, s,a1,a2,a3,a4,a5,a6,a7,a8)
+register Matrix m;
+char *s; int a1,a2,a3,a4,a5,a6,a7,a8;
+{
+	register int i, j;
+	printf(s,a1,a2,a3,a4,a5,a6,a7,a8);
+	for(i = 0; i < NROWS(m);  i++) {
+		for(j = 0; j < NCOLS(m); j++)
+			printf(" %8.4f", m[i][j]);
+		printf("\n");
+	}
+}
+
+void
+PrintArray(a, s,a1,a2,a3,a4,a5,a6,a7,a8)
+Array a;
+char *s; int a1,a2,a3,a4,a5,a6,a7,a8;
+{
+	switch(NDIMS(a)) {
+	case 1: PrintVector((Vector) a, s,a1,a2,a3,a4,a5,a6,a7,a8); break;
+	case 2: PrintMatrix((Matrix) a, s,a1,a2,a3,a4,a5,a6,a7,a8); break;
+	default: error("PrintArray");
+	}
+}
+
diff -urN lib/microwindows/src/demos/nxscribble/matrix.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/matrix.h
--- lib/microwindows/src/demos/nxscribble/matrix.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/matrix.h	2005-02-21 16:03:04.000000000 +0100
@@ -0,0 +1,84 @@
+/***********************************************************************
+
+matrix.h - matrix operations
+
+Copyright (C) 1991 Dean Rubine
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License. See ../COPYING for
+the full agreement.
+
+**********************************************************************/
+/*
+ 
+ Simple matrix operations
+ Why I am writing this stuff over is beyond me
+
+*/
+
+/*
+
+This package provides the Matrix and Vector data types
+
+The difference between this matrix package and others is that:
+	Vectors may be accessed as 1d arrays
+	Matrices may still be accessed like two dimensional arrays
+This is accomplished by putting a structure containing the bounds
+of the matrix before the pointer to the (array of) doubles (in the
+case of a Vector) or before the pointer to an (array of) pointers
+to doubles (in the case of a Matrix).
+
+
+Vectors and matrices are collectively called "arrays" herein.
+*/
+
+#define HEADER(a)	( ((struct array_header *) a) - 1 )
+
+#define	NDIMS(a)	(int)(HEADER(a)->ndims)
+#define NROWS(a)	(int)(HEADER(a)->nrows)
+#define NCOLS(a)	(int)(HEADER(a)->ncols)
+#define	ISVECTOR(a)	(NDIMS(a) == 1)
+#define	ISMATRIX(a)	(NDIMS(a) == 2)
+
+/* Note: this structure is prepended at the beginning of a Vector, and causes
+   the Vector data type to be 32-byte aligned, but not 64-byte aligned.
+   If this were a problem, filler could be filler[5] (or more) instead. 
+   --Sharon Perl, 12/17/98. */
+
+struct array_header {
+	unsigned char	ndims;	/* 1 = vector, 2 = matrix */
+	unsigned char	nrows;
+	unsigned char	ncols;
+	unsigned char	filler;
+};
+
+typedef double **Matrix;
+typedef double *Vector;
+
+Vector	NewVector();	/* int r; (number of rows) */
+Matrix	NewMatrix();	/* int r, c; (number of rows, number of columns) */
+void	FreeVector();	/* Vector v; */
+void	FreeMatrix();	/* Matrix m; */
+void	PrintVector();	/* Vector v; char *fmt; any a1,a2,a3,a4,a5,a6,a7,a8 */
+void	PrintMatrix();	/* Matrix m; char *fmt; any a1,a2,a3,a4,a5,a6,a7,a8 */
+double	InnerProduct();	/* Vector v1, v2 */
+void	MatrixMultiply(); /* Matrix m1, m2, prod; */
+void	VectorTimesMatrix(); /* Vector v; Matrix m; Vector prod; */
+void	ScalarTimesVector(); /* double s; Vector v; Vector prod; */
+double	QuadraticForm(); /* Vector v; Matrix m; (computes v'mv) */
+double	InvertMatrix();	/* Matrix input_matrix, result_matrix (returns det) */
+Vector	SliceVector();	/* Vector v; BitVector rowmask */
+Matrix	SliceMatrix();	/* Matrix m; Bitvector rowmask, colmask; */
+Vector	VectorCopy();	/* Vector v; */
+Matrix	MatrixCopy();	/* Matrix m; */
+Vector	InputVector();	/* FILE *f; */
+Matrix	InputMatrix();	/* FILE *f; */
+
+double	InvertSingularMatrix();	/* Matrix input, result (returns det) */
+Matrix  DeSliceMatrix(); /* Matrix m, double fill, BitVector rowmask, colmask;
+				Matrix result */
+void	OutputVector();
+void	OutputMatrix();
+void	ZeroVector();
+void	ZeroMatrix();	/* Matrix m; */
+void	FillMatrix();	/* Matrix m; double fill; */
diff -urN lib/microwindows/src/demos/nxscribble/nxscribble.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/nxscribble.c
--- lib/microwindows/src/demos/nxscribble/nxscribble.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/nxscribble.c	2005-02-21 16:13:01.000000000 +0100
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 2000 Century Software <embedded.centurysoftware.com>
+ *
+ * Scribble Handwriting Recognition for Nano-X!
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+#include "scrib.h"
+
+#define TEXTWIN_WIDTH	200		/* text window width/height*/
+#define TEXTWIN_HEIGHT	150
+
+static ScribbleWidget	w;
+
+static GR_BOOL		bTextwin = GR_FALSE;
+static GR_WINDOW_ID	wt = 0;
+static GR_GC_ID		gct = 0;
+static GR_GC_ID		gctb = 0;
+static GR_COORD		xpos = 0;
+static GR_COORD		ypos = 0;
+static GR_SIZE		width;		/* width of character */
+static GR_SIZE		height;		/* height of character */
+static GR_SIZE		base;		/* height of baseline */
+static void char_out(GR_CHAR ch);
+static void char_del(GR_COORD x, GR_COORD y);
+
+void do_buttondown(GR_EVENT_BUTTON	*bp);
+void do_buttonup(GR_EVENT_BUTTON	*bp);
+void do_motion(GR_EVENT_MOUSE		*mp);
+void do_focusin(GR_EVENT_GENERAL	*gp);
+void do_keystroke(GR_EVENT_KEYSTROKE	*kp);
+void do_exposure(GR_EVENT_EXPOSURE	*ep);
+
+int
+main(int argc, char **argv)
+{
+	int		t = 1;
+	GR_EVENT	event;		/* current event */
+
+	while (t < argc) {
+		if (!strcmp("-t", argv[t])) {
+			bTextwin = GR_TRUE;
+			++t;
+			continue;
+		}
+	}
+
+	if (GrOpen() < 0) {
+		fprintf(stderr, "cannot open graphics\n");
+		exit(1);
+	}
+
+	if (bTextwin) {
+		/* create text output window for debugging*/
+		wt = GrNewWindow(GR_ROOT_WINDOW_ID, 50, 20,
+				TEXTWIN_WIDTH, TEXTWIN_HEIGHT, 5, BLACK, GREEN);
+		GrSelectEvents(wt, 
+			GR_EVENT_MASK_CLOSE_REQ | GR_EVENT_MASK_KEY_DOWN
+			| GR_EVENT_MASK_EXPOSURE);
+		GrMapWindow(wt);
+		gct = GrNewGC();
+		GrSetGCForeground(gct, GREEN);
+		GrGetGCTextSize(gct, "A",1, GR_TFASCII, &width, &height, &base);
+		GrSetGCFont(gct, GrCreateFont(GR_FONT_OEM_FIXED, 0, NULL));
+		gctb = GrNewGC();
+		GrSetGCForeground(gctb, BLACK);
+	}
+
+	/* create scribble input window*/
+	w = create_scribble();
+
+	while (1) {
+		GrGetNextEvent(&event);
+
+		switch (event.type) {
+			case GR_EVENT_TYPE_BUTTON_DOWN:
+				do_buttondown(&event.button);
+				break;
+
+			case GR_EVENT_TYPE_BUTTON_UP:
+				do_buttonup(&event.button);
+				break;
+
+			case GR_EVENT_TYPE_MOUSE_POSITION:
+			case GR_EVENT_TYPE_MOUSE_MOTION:
+				do_motion(&event.mouse);
+				break;
+
+			case GR_EVENT_TYPE_FOCUS_IN:
+				do_focusin(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_KEY_DOWN:
+				do_keystroke(&event.keystroke);
+				break;
+
+			case GR_EVENT_TYPE_EXPOSURE:
+				do_exposure(&event.exposure);
+				break;
+
+			case GR_EVENT_TYPE_CLOSE_REQ:
+				GrClose();
+				exit(0);
+		}
+	}
+}
+
+
+/*
+ * Here when a button is pressed.
+ */
+void
+do_buttondown(GR_EVENT_BUTTON	*bp)
+{
+	ActionStart(w, bp->x, bp->y);
+}
+
+
+/*
+ * Here when a button is released.
+ */
+void
+do_buttonup(GR_EVENT_BUTTON	*bp)
+{
+	ActionEnd(w, bp->x, bp->y);
+}
+
+
+/*
+ * Here when the mouse has a motion event.
+ */
+void
+do_motion(GR_EVENT_MOUSE	*mp)
+{
+	ActionMove(w, mp->x, mp->y);
+}
+
+
+/*
+ * Here when our window gets focus
+ */
+void
+do_focusin(GR_EVENT_GENERAL	*gp)
+{
+#if 0
+	/* if the window receiving focus is scribble, remember last window*/
+	if (gp->wid == w->win && gp->wid != 1)
+		w->lastfocusid = gp->otherid;
+#endif
+}
+
+
+/*
+ * Here when an exposure event occurs.
+ */
+void
+do_exposure(GR_EVENT_EXPOSURE	*ep)
+{
+	if (ep->wid == w->win)
+		Redisplay(w);
+}
+
+
+/*
+ * Here when a keyboard press or injection occurs.
+ */
+void
+do_keystroke(GR_EVENT_KEYSTROKE	*kp)
+{
+	if (bTextwin)
+		char_out(kp->ch);
+}
+
+static void
+char_del(GR_COORD x, GR_COORD y)
+{
+	xpos -= width;
+	GrFillRect(wt, gctb, x+1, y /*- height*/ /*+ base*/, width, height);
+}
+
+static void
+char_out(GR_CHAR ch)
+{
+	switch(ch) {
+	case '\r':
+	case '\n':
+		xpos = 0;
+		ypos += height;
+		if(ypos >= TEXTWIN_HEIGHT - height) {
+			ypos -= height;
+
+			/* FIXME: changing FALSE to TRUE crashes nano-X*/
+			/* clear screen, no scroll*/
+			ypos = 0;
+			GrClearWindow(wt, GR_FALSE);
+		}
+		return;
+	case '\007':			/* bel*/
+		return;
+	case '\t':
+		xpos += width;
+		while((xpos/width) & 7)
+			char_out(' ');
+		return;
+	case '\b':			/* assumes fixed width font!!*/
+		if (xpos <= 0)
+			return;
+		char_del(xpos, ypos);
+		char_out(' ');
+		char_del(xpos, ypos);
+		return;
+	}
+	GrText(wt, gct, xpos+1, ypos, &ch, 1, GR_TFTOP);
+	xpos += width;
+
+	if (xpos >= TEXTWIN_WIDTH-width)
+		char_out('\n');
+}
diff -urN lib/microwindows/src/demos/nxscribble/punc.cl /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/punc.cl
--- lib/microwindows/src/demos/nxscribble/punc.cl	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/punc.cl	2005-02-21 16:03:04.000000000 +0100
@@ -0,0 +1,698 @@
+33 classes
+!
+#
+$
+%
+&
+'
++
+,
+/
+<
+=
+@
+^
+|
+~
+?
+>
+)
+(
+.
+-
+T
+_
+*
+`
+;
+:
+F
+G
+H
+I
+J
+K
+ V 12    0.049886 -0.989604 50.057 1.52594 50.0488 0.0187451 -0.999046 50.2848 -0.0996306 0.666789 0.145865 0.12
+ M 12 12
+ 0.072489 0.00262767 1.13576 -0.00469268 1.14199 0.0191112 0.000350481 1.12358 0.171161 -0.0273375 -0.0188308 -0.0021693
+ 0 0.00029536 0.0159534 -0.000397192 0.0159646 0.000827037 1.55778e-05 0.0175581 0.00474467 0.00257862 0.000185994 -0.000238129
+ 0 0 22.1984 -0.0218347 22.3292 0.245996 0.0043836 21.586 3.15653 -1.34531 -0.557223 -0.0107666
+ 0 0 0 0.000995911 -0.0218806 -0.00207712 -3.99886e-05 -0.0264514 -0.00394825 -0.0110765 -0.00264208 0.000380231
+ 0 0 0 0 22.4608 0.247315 0.00440698 21.7128 3.17425 -1.3538 -0.560529 -0.0107666
+ 0 0 0 0 0 0.0062168 0.000116549 0.249038 0.0354797 0.00910818 0.000169102 -0.000772006
+ 0 0 0 0 0 0 2.18952e-06 0.00445375 0.000629641 0.000203318 1.43503e-05 -1.46788e-05
+ 0 0 0 0 0 0 0 21.0186 3.074 -1.2418 -0.524773 -0.0124504
+ 0 0 0 0 0 0 0 0 0.483806 -0.201447 -0.0870416 -0.00321751
+ 0 0 0 0 0 0 0 0 0 0.252058 0.080812 -0.00321751
+ 0 0 0 0 0 0 0 0 0 0 0.0276943 -0.000517982
+ 0 0 0 0 0 0 0 0 0 0 0 0.0002
+ V 12    -5.52489 -35.4601 4.03154 386.66 -1.16952 -2.41402 -25.0189 -1.0773 2.41449 -4.15137 0.34553 -59.6006
+ V 12    0.116751 0.989159 54.938 0.937331 47.5277 0.678989 0.730747 132.35 0.699642 9.45562 17.2364 0.385
+ M 12 12
+ 0.0311973 -0.00388715 0.984021 -0.00188968 0.182776 0.0111903 -0.0110209 0.248842 -0.093359 0.285352 -0.0159444 0.00588619
+ 0 0.000534344 -0.130414 -5.31055e-05 -0.00187312 -0.00160486 0.00157996 -0.0287152 -0.0217009 -0.0479767 -0.0290114 -0.00107193
+ 0 0 32.2818 -0.00507341 2.63179 0.373864 -0.369023 9.13503 1.95071 11.3807 5.62052 0.24008
+ 0 0 0 0.00532131 -0.0834584 -0.0039294 0.0035327 0.585233 0.0831266 0.219058 0.659424 0.00218559
+ 0 0 0 0 10.4626 -0.0832467 0.0770943 10.7672 -16.0424 -1.27835 -6.52026 -0.0989823
+ 0 0 0 0 0 0.0105333 -0.00994158 -0.6941 0.25173 -0.0530008 -0.480015 0.00279416
+ 0 0 0 0 0 0 0.00939817 0.624544 -0.236463 0.0365085 0.426988 -0.00280439
+ 0 0 0 0 0 0 0 108.366 -22.1698 30.2308 81.5295 0.133439
+ 0 0 0 0 0 0 0 0 26.2241 2.08557 5.15536 0.188934
+ 0 0 0 0 0 0 0 0 0 13.3512 29.8511 0.165301
+ 0 0 0 0 0 0 0 0 0 0 84.1638 0.286555
+ 0 0 0 0 0 0 0 0 0 0 0 0.0035
+ V 12    -38.708 73.8855 -6.75602 216.961 4.20605 18.359 28.493 3.41663 2.67563 20.5578 -5.85796 -75.5096
+ V 12    -0.638524 -0.742665 47.186 0.964699 37.1448 -0.567201 0.819713 92.0376 0.895497 8.14666 5.12249 0.38
+ M 12 12
+ 0.0849295 -0.0800523 0.676257 0.030871 0.00950862 0.0142014 0.00841607 0.35667 -0.00629488 0.370179 0.257338 0.0099804
+ 0 0.078012 -0.545215 -0.0282092 0.0289632 -0.00834056 -0.00442137 -0.0432412 0.0261499 -0.328391 -0.179574 -0.00873421
+ 0 0 9.93124 0.357925 4.66285 0.370076 0.252286 13.3464 0.316612 3.70847 4.79615 0.0802977
+ 0 0 0 0.0167778 0.22767 0.0118358 0.00812397 0.2277 -0.0190081 0.143042 0.146618 0.00232512
+ 0 0 0 0 9.05026 0.274272 0.207614 4.23238 -0.655921 0.400151 2.21694 -0.0506975
+ 0 0 0 0 0 0.0169423 0.0119398 0.634122 0.0165731 0.103671 0.196546 0.00155624
+ 0 0 0 0 0 0 0.0084721 0.434866 0.00974229 0.0658633 0.13484 0.000787621
+ 0 0 0 0 0 0 0 35.064 2.30699 3.90573 8.27455 0.120138
+ 0 0 0 0 0 0 0 0 0.267796 0.128784 0.337826 0.0115365
+ 0 0 0 0 0 0 0 0 0 1.77866 1.63538 0.0485104
+ 0 0 0 0 0 0 0 0 0 0 2.51658 0.0376901
+ 0 0 0 0 0 0 0 0 0 0 0 0.0018
+ V 12    -62.3217 -3.04281 -2.02307 240.69 1.44273 6.79239 36.4621 1.33272 2.46843 25.1566 -8.58086 -43.9501
+ V 12    0.776615 0.585384 64.4908 0.591912 53.8525 0.994566 0.068018 164.27 -12.595 13.7863 12.7074 0.535
+ M 12 12
+ 0.0935925 -0.106095 3.86846 0.00430316 3.22224 -0.00218803 0.0157518 8.24276 -0.372575 0.211527 -0.439606 -0.00216241
+ 0 0.123189 -4.94107 -0.00376449 -4.1794 0.00295353 -0.0246348 -10.451 0.48261 -0.279196 0.51579 0.00235265
+ 0 0 341.73 0.101056 297.92 -0.273526 2.62915 740.543 -36.3439 17.7283 -15.5175 0.183215
+ 0 0 0 0.000861708 0.0619288 -8.53894e-05 -0.00063734 0.292832 -0.0109841 -0.00265343 -0.00295858 0.000313353
+ 0 0 0 0 260.618 -0.239564 2.34823 643.848 -31.7306 15.649 -13.2158 0.1586
+ 0 0 0 0 0 0.000241617 -0.00230822 -0.603445 0.0300646 -0.0131478 0.0057983 -0.000275863
+ 0 0 0 0 0 0 0.0246078 5.66804 -0.288296 0.140497 -0.060436 0.00216165
+ 0 0 0 0 0 0 0 1616.03 -79.2222 37.2626 -30.4753 0.478155
+ 0 0 0 0 0 0 0 0 3.90713 -1.84028 1.36584 -0.0250482
+ 0 0 0 0 0 0 0 0 0 1.03875 -1.11224 0.00140616
+ 0 0 0 0 0 0 0 0 0 0 2.63821 0.0294959
+ 0 0 0 0 0 0 0 0 0 0 0 0.0009
+ V 12    -31.9542 82.4315 -9.83552 94.8984 6.51264 29.5118 9.78601 3.99923 -3.83964 45.7942 -13.7732 -95.0987
+ V 12    -0.868692 -0.438435 51.1691 1.05531 2.6586 0.0903437 -0.21898 136.553 -0.305897 10.4558 5.77095 0.385
+ M 12 12
+ 0.0336443 -0.0760252 0.861637 -0.000108733 0.148433 -0.0664519 -0.12602 4.04524 0.234576 0.334564 0.192863 0.0038866
+ 0 0.178954 -1.88182 -0.00039898 -0.314805 0.140935 0.267271 -8.36185 -0.557587 -0.756764 -0.473384 -0.00886783
+ 0 0 45.9076 -0.128147 4.54224 -2.45966 -3.49039 206.186 3.98703 5.352 3.87775 0.064666
+ 0 0 0 0.000672595 -0.00517841 0.00450873 0.00251529 -0.574057 0.0108171 0.0154833 0.00645726 0.000170368
+ 0 0 0 0 0.727312 -0.335752 -0.60878 22.3611 0.913602 1.39748 0.725641 0.01609
+ 0 0 0 0 0 0.162665 0.274446 -11.7613 -0.376566 -0.566806 -0.311675 -0.00657838
+ 0 0 0 0 0 0 0.515223 -17.4813 -0.803515 -1.23699 -0.627398 -0.0141972
+ 0 0 0 0 0 0 0 963.402 17.9398 26.9607 16.1459 0.317973
+ 0 0 0 0 0 0 0 0 1.87604 2.57992 1.54387 0.0300221
+ 0 0 0 0 0 0 0 0 0 3.77008 2.02115 0.0433647
+ 0 0 0 0 0 0 0 0 0 0 1.325 0.0237826
+ 0 0 0 0 0 0 0 0 0 0 0 0.0005
+ V 12    -86.3863 12.2898 -0.305307 303.997 -1.92801 10.219 12.2394 1.72185 1.14943 26.5568 -9.26211 -14.9363
+ V 12    0.0656807 0.994664 43.5374 1.53049 43.5205 0.00640072 0.999521 43.79 -0.0138746 0.786061 0.168906 0.1025
+ M 12 12
+ 0.025301 -0.000544207 -0.811395 0.000236238 -0.808355 0.00584339 -5.84955e-05 -0.811931 -0.0865349 0.0135277 0.00261677 0.00033823
+ 0 1.4252e-05 0.0156244 -2.82639e-06 0.0155235 -0.000198956 2.19515e-06 0.0157795 0.00172312 0.000174295 5.29046e-05 3.72815e-06
+ 0 0 28.9776 0.0168483 28.9279 -0.116225 0.00159112 28.9414 3.22906 -0.879374 -0.206263 -0.0248865
+ 0 0 0 0.000416758 0.0171986 0.000283869 6.4271e-06 0.017757 0.00468884 -0.00122853 -0.000575221 -8.43706e-05
+ 0 0 0 0 28.8794 -0.114249 0.00157628 28.8903 3.2254 -0.88575 -0.208068 -0.0250826
+ 0 0 0 0 0 0.00366748 -3.60873e-05 -0.119917 -0.0120029 -0.0115224 -0.00303384 -0.000307837
+ 0 0 0 0 0 0 5.71467e-07 0.00165688 0.000232905 0.000113601 2.37551e-05 1.81796e-06
+ 0 0 0 0 0 0 0 28.9148 3.23382 -0.856803 -0.201492 -0.0244589
+ 0 0 0 0 0 0 0 0 0.380001 -0.0955787 -0.0243592 -0.00307876
+ 0 0 0 0 0 0 0 0 0 0.0998066 0.0243309 0.00260778
+ 0 0 0 0 0 0 0 0 0 0 0.00612781 0.000670961
+ 0 0 0 0 0 0 0 0 0 0 0 7.5e-05
+ V 12    -17.8718 45.8351 2.39734 378.912 -0.0721122 0.822638 22.9365 -0.333549 3.75217 6.95251 -2.788 -110.803
+ V 12    -0.316493 0.94058 46.5157 0.710328 29.1481 0.0472818 0.99435 89.4746 -4.89048 5.69387 4.01352 0.25
+ M 12 12
+ 0.0529535 0.0198291 -0.430744 -0.0124459 -1.2563 0.0348636 -0.00267616 -0.0920761 -0.107183 -0.055066 -0.142378 -0.00126644
+ 0 0.00761095 -0.265252 -0.00372911 -0.482586 0.011599 -0.000856653 -0.256733 -0.0455328 -0.028604 -0.0491365 -0.00103348
+ 0 0 75.1476 -0.210796 37.7582 0.673629 -0.0515556 129.675 3.05719 6.16942 3.23523 0.357294
+ 0 0 0 0.010852 0.556934 -0.0132842 0.00148449 -1.02263 -0.014869 -0.00761269 0.123108 -0.00197871
+ 0 0 0 0 62.5629 -0.512694 0.0664574 23.6932 1.60829 3.75926 9.91041 0.118972
+ 0 0 0 0 0 0.0358721 -0.0028168 1.72965 -0.0370868 0.0395776 -0.0798266 0.0039096
+ 0 0 0 0 0 0 0.00025406 -0.166707 0.000686923 -0.00271654 0.0131261 -0.000353586
+ 0 0 0 0 0 0 0 267.654 6.36396 10.0711 -3.2687 0.682868
+ 0 0 0 0 0 0 0 0 0.425645 0.265684 -0.107409 0.0167055
+ 0 0 0 0 0 0 0 0 0 0.517082 0.379511 0.0285195
+ 0 0 0 0 0 0 0 0 0 0 1.92601 0.00196841
+ 0 0 0 0 0 0 0 0 0 0 0 0.0018
+ V 12    -42.9416 59.5993 -0.998314 170.702 0.897832 6.69731 30.6187 1.1504 0.28149 22.2682 -7.0215 -77.9223
+ V 12    -0.454688 0.842232 33.1338 0.919161 33.1338 -0.60075 0.787936 34.0438 -0.380803 0.994689 0.257463 0.095
+ M 12 12
+ 0.262266 0.137965 0.48634 0.122594 0.48634 0.0959503 0.0754858 1.27174 -0.411405 0.35495 0.111878 0.0163621
+ 0 0.0733522 0.260348 0.0656273 0.260348 0.0513642 0.0404091 0.654085 -0.211395 0.175354 0.054106 0.00835935
+ 0 0 26.6071 0.845841 26.6071 0.620551 0.570832 27.4983 0.680926 -0.993889 -0.382865 0.100565
+ 0 0 0 0.0735517 0.845841 0.0565784 0.0464803 1.17374 -0.151239 0.111473 0.0319328 0.00899285
+ 0 0 0 0 26.6071 0.620551 0.570832 27.4983 0.680926 -0.993889 -0.382865 0.100565
+ 0 0 0 0 0 0.0435757 0.0356894 0.877916 -0.120654 0.089807 0.0259012 0.00692269
+ 0 0 0 0 0 0 0.0294509 0.771849 -0.0903681 0.065549 0.0185661 0.00567681
+ 0 0 0 0 0 0 0 31.2358 -0.701811 0.381593 0.0809312 0.154509
+ 0 0 0 0 0 0 0 0 0.755822 -0.717782 -0.237241 -0.023324
+ 0 0 0 0 0 0 0 0 0 0.744891 0.255722 0.0213502
+ 0 0 0 0 0 0 0 0 0 0 0.0891023 0.00692609
+ 0 0 0 0 0 0 0 0 0 0 0 0.0013
+ V 12    -30.2222 42.7303 1.32172 228.327 0.285969 -4.48971 18.5821 -0.0939902 2.51588 8.56682 -3.27608 -78.1892
+ V 12    0.426123 -0.902218 42.4911 1.00884 42.4911 0.532368 -0.845448 42.6953 -0.21446 0.608858 0.0889538 0.0925
+ M 12 12
+ 0.0142458 0.00699119 -0.800867 -0.00882893 -0.800867 0.00747875 0.00468643 -0.801737 0.00921448 0.0323278 0.00526008 0.000883731
+ 0 0.00344007 -0.384225 -0.00423578 -0.384225 0.00358802 0.00224837 -0.384855 0.00474343 0.0152999 0.00246304 0.000447254
+ 0 0 54.0244 0.571373 54.0244 -0.483622 -0.303896 53.9083 -0.276482 -2.17958 -0.367082 -0.0266136
+ 0 0 0 0.00721138 0.571373 -0.00612261 -0.00380485 0.568596 -0.00439563 -0.0329811 -0.00614072 -0.000779043
+ 0 0 0 0 54.0244 -0.483622 -0.303896 53.9083 -0.276482 -2.17958 -0.367082 -0.0266136
+ 0 0 0 0 0 0.00519847 0.00322999 -0.481247 0.00374416 0.0280752 0.00523386 0.000667378
+ 0 0 0 0 0 0 0.00200818 -0.30246 0.00229929 0.0172811 0.0032068 0.000401292
+ 0 0 0 0 0 0 0 53.7986 -0.280258 -2.15762 -0.362114 -0.0263529
+ 0 0 0 0 0 0 0 0 0.0128786 0.0174123 0.00291956 0.00145604
+ 0 0 0 0 0 0 0 0 0 0.176377 0.035174 0.00485153
+ 0 0 0 0 0 0 0 0 0 0 0.00719769 0.00101249
+ 0 0 0 0 0 0 0 0 0 0 0 0.000275
+ V 12    12.8919 -33.8272 3.40329 248.816 -0.69706 2.46266 -19.495 -1.06444 1.37491 -3.33833 0.734071 -52.8205
+ V 12    -0.776845 -0.625498 53.3187 0.773192 38.3575 0.235755 -0.96415 78.1426 -2.20168 4.2411 5.57318 0.245
+ M 12 12
+ 0.00852157 -0.0103167 0.0591229 -0.00714472 -0.093666 0.01409 0.00488685 0.139842 0.0155436 -0.0618657 -0.287751 -0.00234812
+ 0 0.0125382 -0.0467626 0.0074002 0.0939898 -0.0158806 -0.00560917 -0.101783 -0.0180668 0.0763801 0.357456 0.00283771
+ 0 0 106.444 -0.240436 80.9168 1.17143 0.301372 127.829 0.169533 -4.29264 -23.5846 0.34909
+ 0 0 0 0.0406531 1.02817 -0.0401291 -0.0115439 -1.42304 -0.0341298 -0.00913043 -0.122584 0.00389068
+ 0 0 0 0 98.8055 -0.171853 -0.0704924 61.6267 -0.793888 -4.46301 -26.3098 0.389298
+ 0 0 0 0 0 0.0544507 0.0161429 2.34405 0.0424587 -0.0891712 -0.384799 -0.00216585
+ 0 0 0 0 0 0 0.00489072 0.618861 0.0133286 -0.0314319 -0.137743 -0.000948452
+ 0 0 0 0 0 0 0 187.895 0.987748 -3.50403 -17.9076 0.317623
+ 0 0 0 0 0 0 0 0 0.0412214 -0.0735379 -0.291171 -0.00564795
+ 0 0 0 0 0 0 0 0 0 0.724461 3.67301 -0.00137381
+ 0 0 0 0 0 0 0 0 0 0 18.8372 -0.0253708
+ 0 0 0 0 0 0 0 0 0 0 0 0.0021
+ V 12    -39.0612 -11.3373 2.43606 203.826 -0.931492 3.05023 -18.3931 -0.29605 0.417576 6.67359 -2.22274 -32.8837
+ V 12    0.981236 -0.173579 57.4221 0.895119 52.2756 0.681634 0.724577 110.889 -0.331935 6.29565 6.90851 0.3075
+ M 12 12
+ 0.000978813 0.00512169 0.150445 0.0038076 0.15262 -0.00370616 0.00338241 0.372408 0.00279737 0.0306574 0.0650609 0.000611099
+ 0 0.027206 0.84034 0.0204286 0.871739 -0.0203223 0.0184329 1.99437 0.0156071 0.145946 0.355372 0.00348622
+ 0 0 44.8081 0.378314 42.4863 -0.358367 0.35068 99.7197 0.381736 5.03041 17.0635 0.196867
+ 0 0 0 0.0204923 0.509253 -0.0217325 0.018979 0.82965 0.0153255 0.0603814 0.177014 0.0015282
+ 0 0 0 0 43.0405 -0.531371 0.489174 89.7441 0.49826 3.59607 16.1157 0.18911
+ 0 0 0 0 0 0.023669 -0.0204709 -0.690674 -0.0167577 -0.0331358 -0.165125 -0.0015015
+ 0 0 0 0 0 0 0.0177836 0.712909 0.0145645 0.0400751 0.159867 0.00145981
+ 0 0 0 0 0 0 0 237.226 0.740188 15.5069 39.0911 0.42648
+ 0 0 0 0 0 0 0 0 0.0123835 0.026891 0.16091 0.00166083
+ 0 0 0 0 0 0 0 0 0 1.80619 2.2721 0.0186428
+ 0 0 0 0 0 0 0 0 0 0 6.64574 0.0738396
+ 0 0 0 0 0 0 0 0 0 0 0 0.000875
+ V 12    5.40745 13.8098 -2.68708 197.346 2.64766 12.7611 30.3406 1.60241 1.87592 14.0904 -4.14369 -81.3486
+ V 12    -0.930148 -0.0330482 51.2067 0.808894 4.86803 -0.973607 0.111803 119.138 7.24667 7.42533 3.23527 0.2875
+ M 12 12
+ 0.0352562 -0.129526 0.596513 0.0116492 0.0315672 -0.00631343 -0.0267441 1.34989 0.134008 0.125317 0.0442492 0.00264051
+ 0 0.499675 -2.11408 -0.0466675 -0.0920962 0.0184192 0.0780251 -4.78149 -0.477013 -0.472345 -0.218809 -0.010398
+ 0 0 10.4849 0.143848 0.463363 -0.0926726 -0.392568 24.1815 2.25763 2.17978 0.577589 0.045234
+ 0 0 0 0.0162529 0.0495148 -0.00990296 -0.0419496 0.195961 0.0590176 0.0148769 0.0203399 0.000167744
+ 0 0 0 0 0.20898 -0.0417961 -0.177051 0.579975 0.198205 -0.00366036 -0.0292615 -0.00131966
+ 0 0 0 0 0 0.00835921 0.0354102 -0.115995 -0.039641 0.000732072 0.0058523 0.000263932
+ 0 0 0 0 0 0 0.15 -0.491363 -0.167922 0.00310111 0.0247907 0.00111803
+ 0 0 0 0 0 0 0 57.1671 4.92169 5.24373 1.33844 0.111259
+ 0 0 0 0 0 0 0 0 0.544416 0.42699 0.127013 0.00839133
+ 0 0 0 0 0 0 0 0 0 0.520273 0.193768 0.0117133
+ 0 0 0 0 0 0 0 0 0 0 0.189374 0.00519831
+ 0 0 0 0 0 0 0 0 0 0 0 0.000275
+ V 12    -73.9781 19.4842 2.09578 251.558 -2.73093 -7.33305 21.4949 0.948813 4.09528 16.3162 -6.2654 -25.7316
+ V 12    0.24977 -0.963507 56.884 0.875305 36.4624 0.994313 0.0466005 93.906 -2.481 4.24797 3.33351 0.22
+ M 12 12
+ 0.0348817 0.00859054 -1.1879 -0.0119493 -0.247835 0.00200889 -0.0161239 -1.94124 0.0189749 0.154426 0.0755713 -0.00492869
+ 0 0.00219783 -0.24316 -0.0023142 -0.0548922 0.000417326 -0.00243621 -0.396485 0.00453489 0.0444695 0.0253952 -0.000970794
+ 0 0 76.8499 0.815057 15.5753 -0.11466 1.4209 124.887 -1.10317 1.03092 3.27894 0.364731
+ 0 0 0 0.00903875 0.147447 -0.00127907 0.0170342 1.33313 -0.00924638 0.00727908 0.0340218 0.00377692
+ 0 0 0 0 3.98653 -0.0199166 0.20334 24.8884 -0.336999 0.626034 0.88113 0.0792617
+ 0 0 0 0 0 0.000188633 -0.00237643 -0.188256 0.00120732 0.0029303 -0.00196371 -0.000510655
+ 0 0 0 0 0 0 0.0364948 2.3477 -0.00853273 0.0305964 0.0783661 0.00643354
+ 0 0 0 0 0 0 0 203.179 -1.73582 1.31062 5.10607 0.589335
+ 0 0 0 0 0 0 0 0 0.031392 -0.0617128 -0.0692369 -0.00592187
+ 0 0 0 0 0 0 0 0 0 2.06122 1.50647 0.0155519
+ 0 0 0 0 0 0 0 0 0 0 1.19346 0.0228297
+ 0 0 0 0 0 0 0 0 0 0 0 0.0018
+ V 12    -6.81489 -32.8357 2.86046 220.026 -1.32994 9.78696 13.8833 -0.218079 0.637955 5.39539 -1.46656 -46.5825
+ V 12    -0.0437891 -0.995222 45.4825 1.47768 5.94921 0.294793 0.0694812 87.0315 1.52145 4.07295 8.98949 0.195
+ M 12 12
+ 0.0304075 -0.00103396 0.159901 -0.0128643 0.368575 0.173041 -0.111201 0.433399 0.477384 0.014085 0.147656 -0.00209981
+ 0 5.57776e-05 -0.0148651 0.000532282 -0.0165011 -0.00587208 0.0088201 -0.0234829 -0.011906 0.00119955 -0.000238553 -2.69127e-06
+ 0 0 9.36643 -0.0960947 -8.07592 0.96607 -3.1254 28.4317 -9.37842 0.915194 -1.69541 0.042177
+ 0 0 0 0.00593158 -0.216064 -0.0729346 0.0693864 -0.145152 -0.217148 0.00745752 -0.0414789 0.000616001
+ 0 0 0 0 38.4274 1.92236 -1.65343 -55.2367 32.7668 -4.66675 1.66987 -0.0654721
+ 0 0 0 0 0 0.985638 -0.633357 2.78495 2.57438 0.104626 0.838871 -0.0117098
+ 0 0 0 0 0 0 1.65135 -4.96625 -0.131937 0.268349 0.64472 -0.0115136
+ 0 0 0 0 0 0 0 126.331 -47.1222 7.94391 -1.42314 0.103159
+ 0 0 0 0 0 0 0 0 31.7055 -3.20903 3.99232 -0.0939912
+ 0 0 0 0 0 0 0 0 0 0.757093 0.348834 0.000377499
+ 0 0 0 0 0 0 0 0 0 0 1.84547 -0.0286899
+ 0 0 0 0 0 0 0 0 0 0 0 0.0005
+ V 12    -15.3537 -55.7116 6.88296 406.826 -5.89644 -3.39878 15.1903 -0.724092 2.77212 -12.8139 4.27525 4.98575
+ V 12    -0.0855098 0.991295 60.8098 1.00998 59.8401 -0.535396 0.84341 145.153 -0.0310887 7.43448 10.3095 0.3675
+ M 12 12
+ 0.0394768 0.00475785 1.44357 0.0147329 1.44898 0.0139336 0.00902072 3.3876 0.00174021 -0.00279291 0.394413 0.000575221
+ 0 0.000612986 0.185738 0.00194216 0.168785 0.00163229 0.00106576 0.508611 -0.00046537 -0.00108562 0.0364594 0.000161896
+ 0 0 227.689 0.325135 227.202 0.139119 0.11582 396.574 -6.09428 0.0766059 32.8758 0.326271
+ 0 0 0 0.0066031 0.246071 0.00554922 0.00359509 1.31378 0.00695152 -0.00481108 0.0671992 0.00017804
+ 0 0 0 0 234.672 0.152503 0.12109 358.83 -5.95161 0.420216 38.4361 0.292519
+ 0 0 0 0 0 0.00571503 0.00364125 0.571355 0.0138044 -0.000929844 0.107163 -0.000484525
+ 0 0 0 0 0 0 0.00232453 0.42544 0.0079813 -0.00071847 0.0697841 -0.000255219
+ 0 0 0 0 0 0 0 889.323 -10.0044 -1.5707 36.5651 0.67768
+ 0 0 0 0 0 0 0 0 0.218645 -0.00128774 -0.549312 -0.011207
+ 0 0 0 0 0 0 0 0 0 0.0153194 0.232729 -0.00114322
+ 0 0 0 0 0 0 0 0 0 0 9.80036 0.0150597
+ 0 0 0 0 0 0 0 0 0 0 0 0.000675
+ V 12    -49.5342 82.4385 -8.71418 233.865 5.62957 5.67597 28.8584 4.24355 3.15568 21.646 -7.68012 -87.2371
+ V 12    0.157096 -0.976327 53.4501 1.07577 36.6136 0.349972 0.932218 79.9555 -3.33794 5.15241 2.60165 0.2675
+ M 12 12
+ 0.084035 0.0186076 1.8837 0.00141652 1.6145 -0.0466654 0.0163528 2.67893 -0.00669303 0.052503 -0.0217501 0.00515597
+ 0 0.00439286 0.36222 -0.00165683 0.294655 -0.00999968 0.00340954 0.55473 -0.00781553 0.0173889 0.00448184 0.000452339
+ 0 0 53.341 0.435641 50.0564 -1.12923 0.415396 66.7255 1.02728 0.19874 -2.28333 0.25538
+ 0 0 0 0.0150194 0.608075 -0.00487105 0.00245715 0.212218 0.0355091 -0.0218351 -0.0596791 0.00517811
+ 0 0 0 0 66.7877 -1.25487 0.472696 41.7045 -0.374404 2.86104 -1.23597 0.276277
+ 0 0 0 0 0 0.0300441 -0.0107913 -1.28831 0.01853 -0.0641736 0.00592312 -0.0039484
+ 0 0 0 0 0 0 0.00391244 0.455052 -0.00518839 0.0221534 -0.00460877 0.00163247
+ 0 0 0 0 0 0 0 107.125 2.1724 -1.92238 -3.16413 0.245545
+ 0 0 0 0 0 0 0 0 0.284309 -0.392898 -0.320403 0.0141326
+ 0 0 0 0 0 0 0 0 0 0.62987 0.380905 -0.008609
+ 0 0 0 0 0 0 0 0 0 0 0.405164 -0.0237007
+ 0 0 0 0 0 0 0 0 0 0 0 0.002075
+ V 12    -15.0197 -34.955 3.42388 262.493 -1.47576 6.71518 37.3681 -0.545039 0.954194 11.3575 -3.37294 -55.9466
+ V 12    0.822294 -0.551128 52.2271 0.81778 37.9013 -0.0223183 -0.995935 80.2596 0.895992 5.01664 6.55857 0.2525
+ M 12 12
+ 0.0208836 0.0350742 -0.207062 0.00899897 0.25059 0.00494219 -0.00032755 -0.503197 -0.736249 0.156813 0.43114 3.27205e-05
+ 0 0.0594754 -0.24663 0.0149709 0.473517 0.0115034 -0.000621274 -0.640199 -1.28492 0.284849 0.822242 0.000595599
+ 0 0 40.3166 -0.395058 8.05254 0.997846 -0.0157974 88.5706 -0.747366 6.75191 27.7878 0.235412
+ 0 0 0 0.00779566 0.0786797 -0.00527204 -3.50128e-05 -0.920285 -0.312981 0.000126756 -0.0408239 -0.00205264
+ 0 0 0 0 7.95563 0.383576 -0.010893 15.6592 -13.2886 4.12998 15.1085 0.0585063
+ 0 0 0 0 0 0.0304429 -0.00062877 2.14441 -0.433749 0.263684 0.998663 0.00633759
+ 0 0 0 0 0 0 1.60586e-05 -0.0326012 0.0174314 -0.00656116 -0.0236487 -0.000112136
+ 0 0 0 0 0 0 0 195.547 1.6047 14.3917 58.9348 0.518529
+ 0 0 0 0 0 0 0 0 30.0957 -7.23257 -23.1517 -0.0432929
+ 0 0 0 0 0 0 0 0 0 2.98156 10.1767 0.0515524
+ 0 0 0 0 0 0 0 0 0 0 36.3644 0.194533
+ 0 0 0 0 0 0 0 0 0 0 0 0.001475
+ V 12    18.4702 -12.471 2.96634 196.719 -0.890073 -2.55766 -18.6823 -0.529183 0.897891 1.94864 -0.238543 -50.575
+ V 12    0.72713 0.683693 57.1052 1.26935 54.793 0.0681552 0.994559 64.5825 -1.89759 1.96854 0.546347 0.145
+ M 12 12
+ 0.00777019 -0.00769131 -0.624999 0.00206644 -0.543557 0.0137079 -0.000328333 -0.861637 -0.0149567 -0.00670782 0.0145335 -0.00254463
+ 0 0.00761322 0.618654 -0.00204546 0.538039 -0.0135687 0.000325 0.85289 0.0148049 0.00663972 -0.0143859 0.0025188
+ 0 0 51.9897 -0.208693 44.8634 -1.06998 0.0226925 72.3971 0.841215 0.901384 -1.23365 0.241505
+ 0 0 0 0.00216801 -0.163749 0.00280964 1.10169e-05 -0.335965 0.0128546 -0.0186162 -0.00107563 -0.00179674
+ 0 0 0 0 38.9279 -0.937698 0.0205986 61.8462 0.931359 0.584167 -1.16392 0.19916
+ 0 0 0 0 0 0.0248038 -0.000650152 -1.45981 -0.0336631 -0.00455663 0.0247483 -0.00377905
+ 0 0 0 0 0 0 2.19909e-05 0.029377 0.00150399 -0.000588542 -0.000547953 2.54663e-05
+ 0 0 0 0 0 0 0 102.734 0.58575 1.81664 -1.37818 0.359637
+ 0 0 0 0 0 0 0 0 0.214454 -0.172752 -0.105136 -0.00576455
+ 0 0 0 0 0 0 0 0 0 0.191454 0.0646145 0.0128594
+ 0 0 0 0 0 0 0 0 0 0 0.10492 -0.00373607
+ 0 0 0 0 0 0 0 0 0 0 0 0.0017
+ V 12    10.3343 34.706 3.04544 295.507 0.240784 -0.127427 26.649 -0.634006 2.41131 8.47404 -2.65283 -127.094
+ V 12    -0.652953 0.678683 63.9808 1.29194 61.9284 -0.0806341 0.990022 71.411 1.95437 2.81612 1.18916 0.4225
+ M 12 12
+ 0.529368 0.419893 5.65112 0.0467522 6.05555 0.209656 0.00833685 5.63188 -0.881283 0.631111 -0.0635047 0.401133
+ 0 0.374971 10.2093 0.0392367 10.4683 0.161685 0.00694957 10.4241 -0.913069 0.474249 -0.156813 0.426657
+ 0 0 1638.66 1.79674 1596.92 4.83287 0.527761 1790.4 -40.4055 36.4875 2.11203 38.643
+ 0 0 0 0.0158861 2.022 0.0274681 0.00141449 1.71771 -0.104687 0.103761 0.0479507 0.0908368
+ 0 0 0 0 1563.01 4.94829 0.516332 1736.43 -40.999 35.5008 2.20022 38.4215
+ 0 0 0 0 0 0.106424 0.00540343 5.32722 -0.319421 0.449226 0.0890945 0.25018
+ 0 0 0 0 0 0 0.000413087 0.603124 -0.0166935 0.0283643 0.00891636 0.0175228
+ 0 0 0 0 0 0 0 1971.91 -41.2578 42.1979 3.70314 41.7748
+ 0 0 0 0 0 0 0 0 2.67424 -0.806703 0.57766 -1.26321
+ 0 0 0 0 0 0 0 0 0 2.6792 0.834504 1.35727
+ 0 0 0 0 0 0 0 0 0 0 0.828884 0.213875
+ 0 0 0 0 0 0 0 0 0 0 0 1.15755
+ V 12    -48.0427 39.3168 1.94168 319.386 0.598383 2.22858 29.2673 -0.195782 4.40121 14.3295 -5.13821 -93.1343
+ V 12    -0.962961 -0.0204892 37.0606 0.1267 5.61192 0.0553648 0.289691 69.423 3.16079 4.55237 8.938 0.1825
+ M 12 12
+ 0.00715537 -0.033236 0.604604 0.00280202 0.0921872 0.130801 -0.0322888 1.15234 0.0695716 0.0393536 -0.00681741 0.0010701
+ 0 0.281989 1.32443 -0.0119486 -0.965258 -0.262047 0.119002 3.3798 -0.588997 -0.271414 0.426431 -0.00152003
+ 0 0 194.042 0.272635 -5.81177 21.103 -4.25363 393.436 -2.85471 2.55372 13.4429 0.216217
+ 0 0 0 0.00110637 0.0321677 0.053942 -0.0129796 0.526173 0.0250041 0.0149777 0.000810388 0.000449944
+ 0 0 0 0 5.02563 -0.24281 -0.502882 -16.3839 1.96366 1.75316 -1.23566 0.0051119
+ 0 0 0 0 0 3.46892 -0.608861 43.0499 0.567464 0.217165 0.789962 0.0271478
+ 0 0 0 0 0 0 0.18314 -8.07982 -0.242321 -0.276311 -0.135782 -0.00647155
+ 0 0 0 0 0 0 0 802.435 -7.16744 3.32861 27.7123 0.428904
+ 0 0 0 0 0 0 0 0 1.23194 0.538752 -0.905436 0.00302558
+ 0 0 0 0 0 0 0 0 0 0.761246 -0.0274122 0.00672504
+ 0 0 0 0 0 0 0 0 0 0 1.39487 0.0115577
+ 0 0 0 0 0 0 0 0 0 0 0 0.000275
+ V 12    -40.414 -0.846006 3.76482 59.3111 -2.92393 -1.61484 21.5935 -0.283848 1.74163 2.21325 0.139982 -1.91616
+ V 12    0.745967 -0.0447214 47.5546 0.0472112 46.5383 0.999161 -0.0330946 48.7735 -0.919019 1.43799 2.22858 0.105
+ M 12 12
+ 0.74213 -0.0425573 -3.5898 -0.0114153 -0.629304 0.00117796 0.0300718 -6.51787 2.21437 -2.19718 -6.25273 -0.0150807
+ 0 0.024 -0.62335 0.00143387 -0.798131 -0.000150159 -0.00592014 -0.463961 -0.0910333 0.127843 0.375236 -0.000894427
+ 0 0 51.2526 0.0231856 37.0917 -0.00168853 0.0401286 65.9006 -12.6125 11.0463 29.7324 0.13062
+ 0 0 0 0.000205883 -0.0224991 -2.19644e-05 -0.000639218 0.067755 -0.0322262 0.0333583 0.0966488 0.000178696
+ 0 0 0 0 34.7425 0.00301591 0.160662 40.0584 -3.77868 2.27278 4.78309 0.0710356
+ 0 0 0 0 0 2.5333e-06 7.39075e-05 -0.00623818 0.00316081 -0.0032906 -0.00993518 -2.13619e-05
+ 0 0 0 0 0 0 0.00232895 -0.0749593 0.0764388 -0.0834542 -0.255054 -0.000389944
+ 0 0 0 0 0 0 0 92.1169 -21.4042 19.753 54.406 0.190031
+ 0 0 0 0 0 0 0 0 6.80192 -6.67998 -18.6624 -0.0453352
+ 0 0 0 0 0 0 0 0 0 6.62513 18.545 0.042049
+ 0 0 0 0 0 0 0 0 0 0 52.7028 0.125057
+ 0 0 0 0 0 0 0 0 0 0 0 0.0005
+ V 12    33.8232 2.20635 2.8922 -14.4478 0.639046 6.39629 4.77371 -1.13631 0.0201355 3.35489 0.119112 -78.9471
+ V 12    -0.0276079 -0.99461 59.9495 0.952133 58.6438 0.570163 -0.819327 82.7057 0.0731404 5.1507 7.51047 0.5325
+ M 12 12
+ 0.0399156 -8.01885e-05 -0.00977587 -0.019741 0.129948 0.0182814 0.0133066 0.0363877 0.264113 0.00586653 0.574095 -0.0101908
+ 0 4.04572e-05 0.0258348 -0.000126005 0.0373632 7.75422e-05 7.37125e-05 -0.0121761 -0.0328679 -0.0332044 -0.109601 0.000782545
+ 0 0 26.251 -0.152561 33.9645 0.154895 0.116762 -2.27158 -24.2641 -25.9379 -79.7644 0.184421
+ 0 0 0 0.010715 -0.271176 -0.00996612 -0.00728787 0.002772 0.02071 0.158224 0.215493 0.00352408
+ 0 0 0 0 45.6312 0.253995 0.193823 -5.58794 -32.8817 -35.7324 -109.727 0.366326
+ 0 0 0 0 0 0.00946162 0.0068733 0.0310704 -0.00164193 -0.132897 -0.134644 -0.00522432
+ 0 0 0 0 0 0 0.00500554 0.0134429 -0.0125279 -0.107568 -0.137122 -0.00325373
+ 0 0 0 0 0 0 0 6.77333 7.98386 7.33289 27.3572 -0.411378
+ 0 0 0 0 0 0 0 0 28.9473 28.3514 94.4671 -0.569131
+ 0 0 0 0 0 0 0 0 0 29.59 94.2971 -0.481865
+ 0 0 0 0 0 0 0 0 0 0 310.724 -1.87741
+ 0 0 0 0 0 0 0 0 0 0 0 0.026675
+ V 12    -16.4286 -28.5509 0.648566 225.281 0.752478 8.46256 -13.4458 0.0147482 1.44794 5.64283 -1.6631 -22.3425
+ V 12    0.989354 -0.0460463 50.3481 0.0577831 8.42865 0.328389 0.0159828 94.8818 1.48455 6.90468 14.5298 0.4075
+ M 12 12
+ 0.00104395 0.00823759 0.149452 -0.00036111 0.0433156 0.044291 0.0178876 0.0591334 -0.0322828 -0.1913 -0.523941 0.00328502
+ 0 0.0751874 2.59874 -0.00190428 0.977049 0.396738 0.125803 2.55599 -0.78777 -1.65895 -4.4483 0.00337894
+ 0 0 281.259 0.371842 142.266 16.5398 1.71289 381.385 -78.8995 -37.7814 -117.375 -1.27833
+ 0 0 0 0.00158479 0.267502 0.00606196 -0.00154401 0.557873 -0.038293 0.101343 0.158619 0.00332028
+ 0 0 0 0 77.8314 7.55348 0.773645 195.388 -34.5818 -9.26833 -40.2589 -0.202769
+ 0 0 0 0 0 2.30884 0.762896 16.9627 -3.84203 -8.20184 -23.6045 0.115933
+ 0 0 0 0 0 0 0.35644 -0.434371 0.249828 -2.8359 -8.47569 0.119201
+ 0 0 0 0 0 0 0 539.64 -111.164 -27.7491 -92.2559 -2.60315
+ 0 0 0 0 0 0 0 0 28.8915 13.7356 32.6326 1.07805
+ 0 0 0 0 0 0 0 0 0 38.9998 100.85 -0.0372438
+ 0 0 0 0 0 0 0 0 0 0 272.667 -0.922736
+ 0 0 0 0 0 0 0 0 0 0 0 0.091475
+ V 12    35.8341 -15.3088 6.38201 12.6662 -4.37831 -5.88772 15.9328 -1.0548 -0.134875 -6.90526 4.63567 2.17223
+ V 12    0.415571 0.849692 64.4723 0.638665 38.7767 0.0785575 0.99379 129.564 5.20379 7.17519 4.22235 0.545
+ M 12 12
+ 0.169987 -0.0831376 -1.68214 -0.0426701 -3.36821 -0.0458047 0.00362079 0.60341 -0.28652 0.122504 0.210121 0.00291536
+ 0 0.0406613 0.822707 0.0208692 1.64734 0.0224023 -0.00177087 -0.295118 0.140132 -0.0599145 -0.102767 -0.00142586
+ 0 0 16.646 0.422251 33.3309 0.453271 -0.0358303 -5.97118 2.83532 -1.21226 -2.0793 -0.0288496
+ 0 0 0 0.0107111 0.845491 0.0114979 -0.000908892 -0.151468 0.0719223 -0.0307509 -0.0527446 -0.000731815
+ 0 0 0 0 66.7398 0.907602 -0.0717445 -11.9563 5.67727 -2.42736 -4.16346 -0.0577667
+ 0 0 0 0 0 0.0123426 -0.00097566 -0.162595 0.0772058 -0.0330099 -0.0566193 -0.000785575
+ 0 0 0 0 0 0 7.71244e-05 0.0128529 -0.006103 0.00260938 0.00447567 6.20985e-05
+ 0 0 0 0 0 0 0 2.14196 -1.01707 0.434857 0.745877 0.0103488
+ 0 0 0 0 0 0 0 0 0.482942 -0.206485 -0.354168 -0.00491397
+ 0 0 0 0 0 0 0 0 0 0.0882842 0.151427 0.002101
+ 0 0 0 0 0 0 0 0 0 0 0.259731 0.00360368
+ 0 0 0 0 0 0 0 0 0 0 0 5e-05
+ V 12    -26.7738 55.8115 -1.36864 157.44 1.08798 4.41654 40.0606 1.63931 3.70263 20.1494 -6.50109 -66.7932
+ V 12    -0.355074 -0.933914 43.8549 1.07162 7.14109 0.0789496 -0.348061 83.2347 0.0621775 5.24893 7.02273 0.33
+ M 12 12
+ 0.00301799 -0.00114744 0.313123 -0.00014259 0.00543976 -0.070777 -0.0160541 0.528165 0.239244 0.047461 -0.0469832 -0.00233075
+ 0 0.000436255 -0.119049 5.42126e-05 -0.00206819 0.0269094 0.00610377 -0.200808 -0.0909606 -0.0180447 0.017863 0.000886148
+ 0 0 32.4872 -0.014794 0.564386 -7.34326 -1.66565 54.7983 24.8221 4.92418 -4.8746 -0.24182
+ 0 0 0 6.73691e-06 -0.000257011 0.00334398 0.000758505 -0.0249541 -0.0113035 -0.00224238 0.0022198 0.00011012
+ 0 0 0 0 0.00980486 -0.127572 -0.0289367 0.951989 0.431225 0.0855459 -0.0846846 -0.00420104
+ 0 0 0 0 0 1.65984 0.376497 -12.3864 -5.61069 -1.11304 1.10184 0.05466
+ 0 0 0 0 0 0 0.0853997 -2.80957 -1.27266 -0.252468 0.249926 0.0123984
+ 0 0 0 0 0 0 0 92.432 41.8692 8.30595 -8.22232 -0.407894
+ 0 0 0 0 0 0 0 0 18.9656 3.76237 -3.72449 -0.184765
+ 0 0 0 0 0 0 0 0 0 0.746375 -0.73886 -0.0366534
+ 0 0 0 0 0 0 0 0 0 0 0.73142 0.0362844
+ 0 0 0 0 0 0 0 0 0 0 0 0.0018
+ V 12    -30.3923 -42.8372 5.32192 298.42 -4.65887 -2.03676 3.17694 -0.571773 1.28574 -2.31905 0.803894 15.8007
+ V 12    -0.433765 0.89836 56.2323 0.876871 12.0434 0.476463 -0.120352 103.683 -0.36495 5.55468 8.91303 0.36
+ M 12 12
+ 0.00778106 0.00375702 -1.02437 0.0182585 -1.37764 -0.0594379 0.0228104 -0.940082 -0.379596 -0.00980811 -0.0478109 0.00374245
+ 0 0.00181404 -0.494606 0.00881596 -0.665183 -0.0286991 0.0110138 -0.45391 -0.183284 -0.00473575 -0.023085 0.00180701
+ 0 0 134.857 -2.40371 181.365 7.82492 -3.00297 123.761 49.9733 1.29122 6.29424 -0.492688
+ 0 0 0 0.0428442 -3.23269 -0.139473 0.0535254 -2.20593 -0.890734 -0.023015 -0.11219 0.00878177
+ 0 0 0 0 243.913 10.5235 -4.03861 166.442 67.2078 1.73653 8.46495 -0.662604
+ 0 0 0 0 0 0.454034 -0.174244 7.18109 2.89965 0.0749221 0.365217 -0.0285878
+ 0 0 0 0 0 0 0.0668696 -2.75588 -1.1128 -0.0287528 -0.140159 0.0109711
+ 0 0 0 0 0 0 0 113.578 45.8615 1.18498 5.77635 -0.45215
+ 0 0 0 0 0 0 0 0 18.5184 0.478484 2.33243 -0.182574
+ 0 0 0 0 0 0 0 0 0 0.0123632 0.060266 -0.00471739
+ 0 0 0 0 0 0 0 0 0 0 0.293774 -0.0229955
+ 0 0 0 0 0 0 0 0 0 0 0 0.0018
+ V 12    -37.4944 38.0626 4.94527 247.606 -3.98544 0.14641 4.1165 -0.218079 1.36206 4.16442 -0.727375 -31.4672
+ V 12    0.228825 0.969316 45.242 1.39035 9.55633 0.827157 0.302994 85.2884 -0.0621775 5.70402 10.4161 0.305
+ M 12 12
+ 0.0152786 -0.0036068 -0.570878 -0.00622944 0.43444 -0.0284572 0.0776866 -1.87998 -0.56004 -0.0207207 -0.0176894 -0.0026221
+ 0 0.000851449 0.134766 0.00147057 -0.102557 0.00671784 -0.0183393 0.443804 0.132207 0.00489149 0.00417589 0.000618993
+ 0 0 21.3306 0.23276 -16.2326 1.06329 -2.90272 70.2445 20.9256 0.774217 0.660954 0.0979732
+ 0 0 0 0.00253988 -0.177131 0.0116026 -0.0316746 0.766511 0.228341 0.00844828 0.00721235 0.00106909
+ 0 0 0 0 12.3531 -0.809166 2.20898 -53.4563 -15.9244 -0.589181 -0.502988 -0.0745579
+ 0 0 0 0 0 0.053003 -0.144695 3.50156 1.0431 0.0385933 0.0329473 0.00488378
+ 0 0 0 0 0 0 0.39501 -9.55906 -2.84761 -0.105358 -0.0899444 -0.0133325
+ 0 0 0 0 0 0 0 231.325 68.9109 2.54961 2.17661 0.32264
+ 0 0 0 0 0 0 0 0 20.5283 0.759518 0.648405 0.0961131
+ 0 0 0 0 0 0 0 0 0 0.0281011 0.0239901 0.00355605
+ 0 0 0 0 0 0 0 0 0 0 0.0204805 0.00303582
+ 0 0 0 0 0 0 0 0 0 0 0 0.00045
+ V 12    -20.1039 37.1823 4.28742 366.959 -3.62222 6.40695 12.2317 -0.126816 2.1834 3.19474 -0.285825 -46.4311
+ V 12    0.487618 0.872194 43.3942 1.09937 43.3942 0.454012 0.890639 43.8087 0.0511813 1.29514 0.381767 0.106667
+ M 12 12
+ 0.00343256 -0.00192763 0.0844534 0.00217316 0.0844534 -0.00192714 0.0010038 0.0781474 -0.0141199 -0.0395131 -0.0159104 -3.95112e-05
+ 0 0.0010836 -0.0445122 -0.00119623 -0.0445122 0.00106081 -0.000552536 -0.0409522 0.00826596 0.0221452 0.00886628 3.92604e-05
+ 0 0 9.83687 0.117774 9.83687 -0.104427 0.0544287 9.73131 0.548694 -1.09015 -0.573982 0.0444761
+ 0 0 0 0.0019088 0.117774 -0.0016926 0.000881921 0.114193 -0.00151247 -0.0259936 -0.0115857 0.000351661
+ 0 0 0 0 9.83687 -0.104427 0.0544287 9.73131 0.548694 -1.09015 -0.573982 0.0444761
+ 0 0 0 0 0 0.00150088 -0.000782027 -0.101251 0.00134289 0.0230507 0.0102738 -0.000311767
+ 0 0 0 0 0 0 0.000407472 0.0527746 -0.000695392 -0.0120071 -0.00535216 0.000162598
+ 0 0 0 0 0 0 0 9.63766 0.580362 -1.01831 -0.54592 0.0448392
+ 0 0 0 0 0 0 0 0 0.161573 0.148912 0.0443673 0.00541139
+ 0 0 0 0 0 0 0 0 0 0.456639 0.185924 -0.000236266
+ 0 0 0 0 0 0 0 0 0 0 0.0780408 -0.000886021
+ 0 0 0 0 0 0 0 0 0 0 0 0.000266667
+ V 12    1.95857 41.3836 2.26481 260.904 0.407748 4.97691 22.6122 -0.530316 2.76977 8.5846 -2.68466 -111.108
+ V 12    -0.546576 -0.777895 61.3736 1.12423 46.7205 -0.0178412 0.998976 117.615 9.02693 11.2159 10.3209 0.403333
+ M 12 12
+ 0.220956 -0.12157 0.689291 0.0228679 -0.0355328 0.0203874 0.000364972 0.722104 1.29263 0.39244 -0.791377 0.00985999
+ 0 0.067447 -0.481436 -0.014571 -0.184632 -0.00985887 -0.000151497 -0.290878 -0.592655 -0.20705 0.398824 -0.00554708
+ 0 0 20.8281 0.434903 37.2094 -0.184668 -0.00787444 -17.1994 -17.636 -0.397207 4.2195 0.053079
+ 0 0 0 0.00944354 0.722764 -0.00272257 -0.000137666 -0.303901 -0.287997 0.00905391 0.0482839 0.00145492
+ 0 0 0 0 74.5755 -0.499345 -0.0180676 -38.9833 -43.5037 -3.30296 13.4911 0.043012
+ 0 0 0 0 0 0.00518116 0.000153478 0.325187 0.40729 0.0577628 -0.161921 0.000613092
+ 0 0 0 0 0 0 4.95209e-06 0.0105794 0.0125913 0.00143067 -0.00453462 5.51608e-06
+ 0 0 0 0 0 0 0 22.6182 26.791 2.9712 -9.5518 0.00897817
+ 0 0 0 0 0 0 0 0 32.6999 4.17692 -12.3888 0.0317888
+ 0 0 0 0 0 0 0 0 0 0.837776 -1.98619 0.0155747
+ 0 0 0 0 0 0 0 0 0 0 5.22938 -0.0273221
+ 0 0 0 0 0 0 0 0 0 0 0 0.000466667
+ V 12    -68.972 3.18951 -1.9823 288.929 1.87534 15.4578 50.975 1.45805 5.7303 30.9377 -9.93379 -75.1496
+ V 12    0.577748 -0.807783 62.618 0.972612 41.398 -0.247967 0.966681 120.378 -4.99129 10.8528 11.6847 0.393333
+ M 12 12
+ 0.0256737 0.0198777 -1.25558 0.00735422 -0.205157 0.0159324 0.00393819 -1.93006 0.0849933 -0.0215726 0.380208 -0.000816093
+ 0 0.0154084 -0.9612 0.00578252 -0.150315 0.0121714 0.00299684 -1.45113 0.065545 -0.0128673 0.302432 -0.000604604
+ 0 0 67.9534 -0.306584 15.143 -0.877557 -0.223929 120.288 -4.31274 3.35335 -13.765 0.056242
+ 0 0 0 0.00253682 -0.0173513 0.00376647 0.00087415 -0.342961 0.023081 0.0124493 0.148053 -0.000101404
+ 0 0 0 0 5.62645 -0.204076 -0.0559166 35.6303 -0.800983 1.96575 0.730007 0.019264
+ 0 0 0 0 0 0.0113651 0.0029146 -1.58679 0.0550896 -0.0479143 0.163399 -0.000751773
+ 0 0 0 0 0 0 0.00075399 -0.419962 0.0137843 -0.0143052 0.0352166 -0.000203315
+ 0 0 0 0 0 0 0 247.511 -7.00685 10.7109 -9.48452 0.125934
+ 0 0 0 0 0 0 0 0 0.285093 -0.126205 1.14356 -0.00309098
+ 0 0 0 0 0 0 0 0 0 0.82478 1.37547 0.00641733
+ 0 0 0 0 0 0 0 0 0 0 9.192 -4.24416e-05
+ 0 0 0 0 0 0 0 0 0 0 0 6.66667e-05
+ V 12    -11.5081 -12.9676 0.664301 217.381 0.0944379 6.05471 42.6414 0.611751 -0.258248 21.7391 -5.813 -67.6836
+ V 12    -0.704652 0.694281 67.0879 0.841367 39.5384 -0.159623 -0.976994 159.814 -10.7376 11.8439 10.446 0.476667
+ M 12 12
+ 0.0345584 0.032023 0.0755172 -0.0134295 -0.248787 -0.0309642 0.0060184 -0.631605 -0.046038 0.123899 0.410299 0.00218417
+ 0 0.0297606 0.0344762 -0.0110778 -0.192807 -0.0270517 0.00541485 -0.675936 -0.0440322 0.109338 0.383007 0.00173957
+ 0 0 14.6384 -0.586394 -15.9249 -0.736563 0.079198 35.5859 0.458721 2.50118 -0.24915 0.120705
+ 0 0 0 0.0266582 0.688666 0.0377771 -0.00488074 -1.1773 -0.00363665 -0.133992 -0.115346 -0.00531074
+ 0 0 0 0 18.1369 0.933766 -0.113516 -34.7377 -0.262976 -3.26229 -1.73616 -0.138928
+ 0 0 0 0 0 0.0586575 -0.00844484 -1.1425 0.0154003 -0.214094 -0.314675 -0.00731491
+ 0 0 0 0 0 0 0.0013495 0.0586926 -0.00546522 0.0317554 0.0662258 0.000909411
+ 0 0 0 0 0 0 0 105.957 2.26996 3.43226 -10.4251 0.25618
+ 0 0 0 0 0 0 0 0 0.0829457 -0.0788607 -0.590868 0.00157049
+ 0 0 0 0 0 0 0 0 0 0.787928 1.29444 0.0256966
+ 0 0 0 0 0 0 0 0 0 0 4.96202 0.0167545
+ 0 0 0 0 0 0 0 0 0 0 0 0.00106667
+ V 12    -79.2657 82.2158 -5.58274 203.156 2.9175 11.5176 -20.6847 3.06253 -2.82417 37.3673 -12.2612 -66.2319
+ V 12    0.290502 0.5645 67.2352 0.933692 40.3849 -0.0205627 -0.998613 155.64 10.645 13.1631 15.2814 0.48
+ M 12 12
+ 0.273853 0.170197 0.290182 -0.0269221 -6.85859 -0.0214773 0.00053469 9.80414 1.98945 0.344512 -1.64906 0.0195692
+ 0 0.516991 -1.84515 -0.00419718 -4.67079 0.0336162 0.000282079 -5.7534 2.80655 -0.379309 -2.42523 0.0113493
+ 0 0 10.2844 -0.0902686 -5.25672 -0.254086 0.000813963 68.7407 -5.62581 3.28803 5.15025 0.0247397
+ 0 0 0 0.00302876 0.661815 0.00354296 -5.40956e-05 -1.32494 -0.147719 -0.0519571 0.119432 -0.0019486
+ 0 0 0 0 172.177 0.491271 -0.0133413 -233.782 -51.384 -8.0391 42.6907 -0.4893
+ 0 0 0 0 0 0.00704807 -4.76699e-05 -2.12188 0.0232962 -0.0947922 -0.0306016 -0.00162757
+ 0 0 0 0 0 0 1.0501e-06 0.0205892 0.00369256 0.000745129 -0.00304871 3.83076e-05
+ 0 0 0 0 0 0 0 692.28 25.9903 29.4294 -18.6953 0.724008
+ 0 0 0 0 0 0 0 0 20.4478 0.236924 -17.3268 0.13906
+ 0 0 0 0 0 0 0 0 0 1.28976 -0.0537155 0.0257914
+ 0 0 0 0 0 0 0 0 0 0 14.699 -0.115072
+ 0 0 0 0 0 0 0 0 0 0 0 0.0014
+ V 12    -46.5895 72.4526 -4.24205 243.724 2.7014 11.0874 -8.51107 2.59957 4.68721 29.5403 -9.3939 -80.9054
+ V 12    -0.209438 -0.97543 60.1719 0.971297 57.0193 0.487059 -0.870033 136.121 -0.0570286 7.1614 8.36929 0.343333
+ M 12 12
+ 0.0134198 -0.00280469 0.749448 0.0069702 1.00221 7.37967e-05 -6.84062e-05 2.01629 0.0394375 -0.0368928 -0.126895 -0.00100388
+ 0 0.000594315 -0.163715 -0.00179434 -0.217292 0.000318187 0.000189695 -0.411679 -0.00782739 0.0065781 0.0225502 0.000153342
+ 0 0 48.015 0.682911 62.7838 -0.286064 -0.156387 104.149 1.84153 -1.07535 -3.63301 -0.00694646
+ 0 0 0 0.0176164 0.845309 -0.0137927 -0.00730728 0.644312 0.00328181 0.0277847 0.0986994 0.00181962
+ 0 0 0 0 82.3825 -0.31542 -0.173841 141.23 2.5461 -1.66587 -5.65717 -0.0206507
+ 0 0 0 0 0 0.0136682 0.00718557 0.409276 0.0172158 -0.0465957 -0.163364 -0.00231894
+ 0 0 0 0 0 0 0.00377842 0.199073 0.00873628 -0.0242033 -0.084876 -0.00121118
+ 0 0 0 0 0 0 0 314.543 6.42061 -6.89463 -23.8046 -0.218229
+ 0 0 0 0 0 0 0 0 0.137039 -0.166119 -0.575224 -0.00582741
+ 0 0 0 0 0 0 0 0 0 0.258895 0.900991 0.0106123
+ 0 0 0 0 0 0 0 0 0 0 3.13585 0.0370254
+ 0 0 0 0 0 0 0 0 0 0 0 0.000466667
+ V 12    -44.7152 -0.269373 -6.53928 238.988 4.11896 14.8743 -10.4861 3.11807 1.7694 15.4584 -5.87557 -38.594
+ V 33    -364.388 -326.183 -263.785 -468.398 -410.601 -363.741 -191.042 -163.15 -183.608 -145.725 -203.241 -305.709 -166.423 -431.859 -407.989 -234.162 -138.279 -285.612 -325.139 -86.2547 -69.6601 -174.1 -119.955 -221.671 -260.311 -239.724 -350.068 -218.701 -407.008 -258.397 -422.869 -374.015 -286.058
+ M 12 12
+ 38.7887 -5.06163 0.762521 -13.6259 -0.220786 -2.75772 -0.538112 -0.313659 -0.418746 -4.047 1.68285 -9.15308
+ -5.06163 46.0395 -0.814726 -1.48431 0.68798 0.385743 -4.96499 0.280534 0.145475 4.60175 -1.48201 -24.5281
+ 0.762521 -0.814726 0.414778 0.468638 -0.218013 -0.430306 0.179966 -0.13739 -0.0117663 -0.25093 0.1309 -1.12977
+ -13.6259 -1.48431 0.468638 261.616 -0.885737 1.68163 -3.89785 0.12344 1.59731 -1.73942 -0.241116 -10.3746
+ -0.220786 0.68798 -0.218013 -0.885737 0.175911 0.278387 -0.11062 0.0557183 0.0193273 0.307557 -0.117114 -1.00638
+ -2.75772 0.385743 -0.430306 1.68163 0.278387 11.4918 0.855805 0.0538267 0.00460238 2.21022 -0.480491 -2.70173
+ -0.538112 -4.96499 0.179966 -3.89785 -0.11062 0.855805 29.1711 0.0360441 0.569629 0.794456 -0.0120204 -4.88447
+ -0.313659 0.280534 -0.13739 0.12344 0.0557183 0.0538267 0.0360441 0.0619013 0.00964495 -0.0189672 -0.0173292 0.456135
+ -0.418746 0.145475 -0.0117663 1.59731 0.0193273 0.00460238 0.569629 0.00964495 0.372388 -0.124825 0.0082243 -0.276982
+ -4.047 4.60175 -0.25093 -1.73942 0.307557 2.21022 0.794456 -0.0189672 -0.124825 5.19169 -1.60976 -9.22297
+ 1.68285 -1.48201 0.1309 -0.241116 -0.117114 -0.480491 -0.0120204 -0.0173292 0.0082243 -1.60976 0.627764 2.69088
+ -9.15308 -24.5281 -1.12977 -10.3746 -1.00638 -2.70173 -4.88447 0.456135 -0.276982 -9.22297 2.69088 144.155
+4 !
+13   109 187  109 186  109 185  110 183  110 179  110 175  110 169  110 162  111 155  111 148  111 143  111 139  112 136  
+14   37 182  37 183  36 183  36 181  36 179  36 175  36 170  36 163  35 156  35 150  35 144  35 139  36 136  36 135  
+12   110 87  110 86  111 84  111 82  112 78  112 73  113 66  113 59  113 51  113 44  113 39  113 35  
+15   36 89  37 89  37 88  36 86  36 83  36 79  36 74  35 67  35 59  35 52  35 46  35 42  35 39  35 38  35 37  
+4 #
+44   95 125  95 124  95 123  95 125  96 128  97 133  97 139  98 145  99 150  99 154  100 156  101 155  102 152  104 148  107 143  109 137  113 132  116 127  118 123  120 120  122 117  123 116  123 115  124 115  124 116  123 117  124 119  124 121  124 124  124 129  125 134  126 139  127 144  128 148  128 152  129 156  129 159  129 162  130 163  130 165  130 164  130 163  130 160  130 156  
+38   24 112  24 111  24 112  25 115  25 119  26 125  27 133  27 141  28 148  28 153  28 156  29 157  29 156  30 153  31 149  32 144  34 138  36 132  38 127  40 123  43 119  44 116  46 115  47 114  48 114  48 115  49 117  49 120  50 124  51 129  52 134  53 140  54 145  55 150  55 153  56 155  55 153  55 151  
+40   92 28  92 27  92 28  92 29  92 31  93 35  93 40  93 47  93 53  93 59  93 62  94 64  95 63  97 61  99 57  101 52  104 46  107 40  111 35  113 31  116 27  118 25  120 23  120 22  121 21  121 22  121 24  121 27  122 32  122 37  122 43  123 48  124 53  125 57  125 60  126 62  126 63  127 64  126 63  126 62  
+40   19 27  19 29  19 33  19 38  20 44  20 49  20 55  20 61  20 65  20 67  20 68  21 66  22 63  23 59  25 54  27 50  29 45  32 39  34 35  37 31  39 27  41 25  42 23  43 23  43 24  43 25  43 28  43 31  44 35  44 41  45 47  46 53  46 58  47 62  47 65  48 66  48 65  48 64  48 63  48 62  
+4 $
+42   123 123  123 122  123 121  122 120  122 119  121 119  119 118  118 119  115 119  112 120  110 121  108 122  107 123  106 125  106 128  107 130  108 131  109 133  111 134  114 135  117 136  119 137  122 137  124 138  126 139  127 140  128 142  129 143  128 145  128 147  126 149  125 151  122 153  120 154  116 154  113 154  109 153  106 152  103 150  100 149  99 148  99 147  
+38   55 117  55 116  55 115  54 114  52 114  50 114  47 115  44 115  41 117  39 118  37 120  36 122  36 124  37 125  39 127  41 128  43 129  46 130  49 131  52 132  56 133  58 134  60 135  62 137  63 139  63 142  63 144  62 146  60 147  58 148  56 149  52 150  48 150  44 150  40 149  37 149  34 148  33 147  
+37   117 33  117 32  117 31  116 30  115 29  113 28  112 28  109 29  106 29  104 30  102 32  100 34  100 36  99 39  100 41  101 42  102 44  105 45  107 45  110 46  113 47  116 47  118 49  119 50  120 53  121 55  120 58  119 60  118 63  116 65  113 66  109 67  105 68  102 68  98 68  96 67  95 65  
+43   43 29  44 28  44 27  44 26  43 26  43 25  41 25  39 24  37 24  35 25  32 26  30 28  28 30  26 32  25 35  24 37  25 39  25 40  27 41  29 42  31 42  33 42  36 43  39 43  41 44  44 46  46 47  48 49  49 51  50 54  50 56  49 59  48 61  46 63  44 65  41 66  37 67  34 67  31 66  28 65  26 64  25 62  25 60  
+4 %
+56   26 164  25 164  26 163  27 162  28 162  30 162  32 164  35 168  37 173  40 180  41 187  42 195  41 200  40 204  38 206  37 207  36 206  35 203  35 200  35 196  37 192  40 187  43 184  47 180  51 177  55 175  58 174  61 174  63 175  65 176  66 179  68 183  69 186  70 191  71 195  70 199  70 202  69 204  67 206  66 207  64 207  64 206  63 204  63 201  63 197  65 192  67 187  70 182  73 177  77 173  80 170  84 169  87 170  89 172  91 174  92 177  
+57   96 114  95 114  96 114  96 113  97 113  99 114  101 116  102 119  104 123  105 128  105 134  105 139  103 143  102 146  101 146  100 145  100 143  99 140  99 136  99 133  100 131  101 129  103 127  105 124  109 122  112 120  115 118  117 116  118 116  119 115  120 116  121 117  122 119  123 121  124 124  125 128  125 131  126 135  126 139  125 141  124 143  123 145  122 145  121 144  120 142  121 139  122 136  123 132  125 128  127 124  130 121  133 118  137 116  140 114  143 113  145 113  146 113  
+52   25 90  26 90  27 90  29 90  31 93  33 97  35 102  37 108  38 114  38 120  38 124  37 126  36 126  35 125  33 122  33 119  32 115  32 112  33 109  35 106  38 103  42 100  45 98  49 96  52 95  55 94  56 94  57 96  58 97  59 100  59 103  60 106  61 109  61 113  61 116  61 119  60 121  59 122  58 122  57 121  56 119  56 116  56 113  57 110  59 107  60 104  64 101  67 97  71 95  74 93  76 92  78 92  
+56   23 30  24 30  25 32  27 35  28 38  30 43  31 48  31 53  31 56  31 59  30 61  29 60  28 59  27 57  27 54  27 51  27 48  28 45  30 43  32 41  34 38  37 37  39 35  41 33  44 32  45 32  47 31  47 32  48 33  50 34  51 35  52 37  53 39  54 42  55 45  56 48  56 51  55 54  54 57  53 60  52 62  51 62  50 61  50 59  50 55  51 51  52 46  54 42  56 38  59 36  62 34  64 32  67 32  69 32  71 33  72 34  
+4 &
+41   126 139  126 138  126 137  125 136  123 136  121 135  117 135  112 136  108 137  104 139  101 142  99 144  99 147  101 150  104 153  108 155  112 158  117 162  121 165  124 169  127 172  128 176  128 180  126 182  123 183  119 184  114 183  109 182  104 180  101 177  99 174  100 169  103 165  107 160  113 154  118 150  122 145  125 142  126 139  125 136  123 135  
+42   51 138  51 137  51 136  50 136  49 135  48 134  46 134  43 135  39 137  36 138  33 141  32 144  32 146  33 148  35 151  38 152  42 154  46 157  50 159  53 163  55 166  56 169  55 172  53 175  49 177  46 178  42 178  39 176  37 173  36 170  36 166  38 161  41 157  44 153  48 150  52 146  54 142  55 140  55 137  53 136  51 135  48 135  
+40   113 44  112 44  112 43  111 43  109 42  107 42  104 43  101 44  98 46  95 48  93 50  93 53  93 56  95 58  97 61  101 63  105 65  109 67  112 69  115 72  117 75  117 77  116 80  113 82  110 84  107 84  103 84  100 83  98 80  97 77  97 73  98 69  101 66  104 61  108 57  111 53  114 49  115 45  115 43  113 43  
+40   45 40  45 39  44 39  44 38  43 37  41 36  38 37  35 37  32 39  29 41  27 43  25 46  24 49  25 51  26 53  29 55  31 56  35 58  38 60  41 62  43 65  45 68  45 71  44 75  42 78  39 79  35 80  33 79  31 77  30 74  30 70  32 65  35 61  39 56  43 53  46 49  48 46  48 43  47 41  45 41  
+4 '
+12   110 132  111 134  111 137  111 141  110 147  110 154  110 161  110 166  110 171  110 174  111 175  111 176  
+14   37 128  37 127  37 128  37 131  36 135  36 142  36 151  35 160  35 167  35 173  36 176  36 177  36 176  37 175  
+12   109 34  110 36  110 38  110 42  111 47  111 53  111 60  111 66  111 71  111 74  111 76  111 77  
+14   33 33  33 34  34 36  34 39  34 43  33 48  33 54  33 59  32 65  32 69  32 72  32 74  33 75  33 76  
+4 +
+28   133 117  134 116  134 117  134 118  133 120  132 124  131 128  128 132  125 137  121 142  117 145  112 146  108 146  104 146  101 144  99 142  98 140  98 138  100 136  104 135  109 135  115 135  121 137  127 138  131 140  135 141  137 142  138 142  
+28   59 115  59 114  58 114  58 115  58 116  56 118  55 122  52 126  49 130  45 135  40 139  35 142  30 144  26 145  22 144  20 144  20 142  21 140  23 138  28 137  32 137  38 137  43 139  48 142  51 144  54 147  56 148  58 149  
+24   122 31  122 32  121 34  120 36  119 40  116 45  114 49  110 53  106 55  102 57  99 57  95 56  93 54  92 52  92 50  94 49  97 48  101 48  106 49  111 50  115 52  118 54  121 56  122 57  
+26   47 29  48 29  47 31  47 33  45 36  43 39  40 44  36 48  32 52  28 55  24 58  20 59  17 59  16 58  15 57  16 55  18 54  21 53  25 53  30 53  34 54  39 56  43 58  46 59  49 61  51 61  
+4 ,
+11   128 139  127 139  126 140  125 142  122 145  118 149  115 154  111 159  107 164  105 167  104 169  
+13   54 136  54 137  54 138  54 140  53 143  52 147  51 151  49 155  46 159  43 162  40 163  38 165  37 165  
+9   114 50  114 51  112 53  109 55  104 58  100 62  95 66  92 69  90 71  
+11   47 45  47 46  47 47  46 49  46 52  44 56  42 60  39 65  36 69  33 71  30 74  
+4 /
+10   94 185  95 183  96 180  98 175  101 169  105 162  109 155  113 149  116 145  118 143  
+12   41 181  40 182  41 179  43 176  45 171  49 165  53 159  58 152  60 148  63 144  65 141  66 140  
+11   98 78  98 77  99 76  100 73  102 70  106 65  109 60  113 54  117 50  120 46  122 44  
+11   31 72  31 73  31 72  32 70  34 66  37 62  40 57  44 51  48 46  51 43  53 40  
+4 <
+29   127 178  127 177  126 177  125 176  124 176  123 175  122 174  119 172  116 169  113 166  109 163  105 159  102 156  100 154  98 153  98 152  98 151  99 151  100 151  102 150  105 149  108 147  113 144  117 141  123 138  127 135  131 133  133 132  135 132  
+23   60 173  59 172  57 171  56 169  54 168  51 166  47 163  43 160  40 157  37 155  35 154  34 153  35 154  36 154  37 153  40 152  43 151  47 148  51 146  54 144  58 141  61 140  64 139  
+26   126 88  126 89  125 88  124 87  123 86  120 84  116 82  112 80  107 78  102 76  98 74  95 74  94 74  95 74  96 74  98 73  100 72  103 70  107 68  112 65  118 62  123 59  128 57  131 55  133 54  134 54  
+24   50 85  49 84  48 83  47 82  45 80  42 77  38 74  33 71  28 69  24 67  21 65  19 64  20 63  22 62  26 62  30 61  36 60  42 59  49 57  55 55  60 53  63 52  65 51  66 51  
+4 =
+34   97 132  97 131  98 131  100 131  103 131  107 131  112 130  118 130  123 129  126 128  128 129  129 130  129 131  127 134  125 137  122 142  118 147  115 153  111 159  108 165  105 170  103 174  101 176  101 177  101 178  103 177  106 176  110 175  115 174  121 173  126 173  131 173  134 173  136 173  
+32   26 128  26 127  28 127  30 127  33 127  37 127  41 127  45 126  48 126  50 126  51 126  50 128  49 131  48 134  45 138  42 144  38 150  35 156  31 162  28 168  26 172  25 175  25 176  27 176  31 175  35 174  39 173  44 173  48 173  52 173  54 173  56 173  
+31   102 36  101 36  102 35  104 35  107 34  111 34  115 33  120 32  125 32  128 32  130 33  131 34  130 37  128 40  126 45  122 49  119 54  115 59  111 64  109 67  107 70  107 72  108 73  109 73  113 72  118 71  123 70  128 69  133 69  137 69  140 69  
+31   23 35  22 35  23 35  25 34  28 33  33 32  38 31  43 30  47 30  50 30  51 31  52 32  51 35  49 38  46 43  43 48  40 53  37 58  34 63  32 66  31 68  31 70  32 70  35 70  38 70  43 69  47 68  52 68  56 68  59 68  61 68  
+4 @
+30   116 130  116 129  116 128  116 127  114 128  112 128  111 129  108 131  104 135  102 139  100 144  100 149  101 154  103 159  106 163  110 165  115 166  119 164  124 160  128 156  131 150  132 145  132 140  131 136  127 132  123 130  118 129  114 129  111 130  109 132  
+31   51 124  51 123  50 122  50 121  49 120  48 119  45 119  42 120  39 122  36 125  33 129  30 135  29 139  29 145  30 150  33 155  37 158  41 160  46 160  52 159  56 156  60 151  63 146  64 141  64 135  63 131  60 127  56 125  52 124  49 123  46 124  
+29   115 46  115 45  114 45  112 45  110 46  107 48  104 50  101 54  99 58  98 63  98 67  99 72  102 75  106 77  110 78  116 78  121 76  126 73  129 69  132 64  134 59  134 54  132 49  129 46  125 43  121 42  117 42  113 44  110 46  
+30   39 40  39 39  38 39  37 39  35 40  32 41  29 42  27 45  24 48  23 52  23 57  25 61  27 66  30 69  34 71  39 71  44 70  49 67  53 63  57 58  60 54  61 50  61 46  60 42  56 40  52 38  47 38  43 38  38 40  35 42  
+4 ^
+26   94 185  93 185  93 183  94 181  95 176  97 170  99 164  101 157  103 151  105 146  106 142  108 140  109 140  110 141  111 143  113 146  116 151  118 158  121 166  124 174  126 180  128 185  129 189  130 190  131 191  131 192  
+21   26 165  27 162  28 158  29 154  31 149  33 143  36 138  39 134  41 130  43 127  45 126  47 127  48 129  49 132  51 137  53 144  55 150  57 156  59 160  61 164  62 166  
+24   92 81  91 82  92 81  92 79  94 76  96 71  99 66  102 60  105 54  108 49  111 45  112 42  114 41  115 41  116 44  118 47  119 53  121 59  122 66  124 72  125 78  127 81  128 84  129 85  
+23   22 75  21 75  22 73  23 71  24 67  27 62  29 55  33 49  36 44  39 39  41 36  43 33  45 33  46 34  46 36  47 40  49 45  51 51  53 57  54 63  56 67  58 70  59 73  
+4 |
+21   89 170  89 169  88 169  88 167  88 163  88 158  89 152  89 145  89 139  89 134  89 132  88 135  88 140  87 147  87 155  87 162  87 168  87 173  87 176  87 177  86 176  
+24   36 178  36 177  36 176  35 173  35 169  34 164  34 157  33 153  33 146  33 139  33 135  33 132  33 131  34 134  34 138  35 144  35 152  35 160  35 167  35 173  35 176  35 178  36 177  36 176  
+21   87 82  87 81  87 79  87 74  88 69  88 62  89 55  90 48  90 42  90 38  90 37  90 40  90 44  90 51  91 59  92 66  92 73  93 79  93 83  93 85  93 84  
+24   31 88  31 87  31 86  31 84  31 81  31 77  31 72  31 65  31 60  31 53  31 46  30 42  30 40  30 43  30 47  31 53  32 60  33 66  34 72  35 77  36 80  36 81  35 81  35 79  
+4 ~
+40   123 121  123 120  122 120  122 122  122 126  122 131  122 137  122 144  122 152  122 159  121 166  121 170  120 174  120 175  119 175  119 173  118 169  117 164  116 158  115 151  113 144  111 137  108 132  106 128  103 125  101 124  99 125  97 125  96 126  95 128  95 130  95 133  95 138  95 144  94 150  93 157  92 163  92 167  91 170  90 171  
+41   60 117  61 117  61 118  60 120  60 123  60 128  59 135  58 143  56 152  55 159  54 165  54 169  53 171  53 170  53 167  52 164  50 159  48 153  45 146  42 139  40 133  37 128  35 125  34 123  33 123  32 123  32 124  32 126  32 128  32 132  31 136  31 142  30 149  29 155  27 162  26 168  24 173  23 176  22 179  22 180  22 179  
+39   121 25  120 25  120 26  120 27  120 29  119 33  118 37  117 43  116 49  115 55  114 60  113 63  113 65  112 64  112 62  111 59  110 55  108 49  105 43  103 38  101 33  98 29  97 26  95 25  94 26  93 27  93 28  92 30  92 32  92 35  92 38  92 44  91 49  91 55  90 61  90 65  89 69  89 70  88 70  
+37   47 23  47 24  47 27  47 30  47 34  47 40  47 46  47 52  46 57  46 62  46 65  45 67  44 66  43 64  41 61  39 58  38 55  35 50  32 45  30 39  29 35  28 30  26 28  26 26  25 25  25 27  24 28  23 30  22 34  22 39  21 44  20 51  20 57  20 63  20 67  21 70  21 72  
+4 ?
+29   29 38  28 38  27 38  27 37  27 36  28 35  29 33  32 31  36 29  40 28  45 27  49 27  53 28  56 31  57 34  57 37  56 41  54 45  51 49  48 53  44 57  42 61  39 65  38 68  38 71  38 73  38 76  38 77  39 77  
+30   95 36  94 36  93 36  93 35  93 34  94 32  95 30  96 28  99 26  102 25  106 25  110 26  113 28  115 30  116 33  116 36  114 40  113 44  111 48  109 51  107 54  106 57  106 59  107 62  107 66  107 69  108 71  108 73  108 74  108 75  
+26   35 134  34 133  33 132  33 130  34 129  35 127  38 125  42 124  46 123  50 122  54 122  57 123  59 125  59 128  59 131  58 135  56 139  53 142  51 146  50 150  49 153  49 157  49 159  49 162  49 163  49 165  
+31   99 139  99 140  99 139  99 138  99 137  99 135  99 132  100 130  101 127  104 125  107 123  110 122  114 122  118 122  120 124  122 127  123 130  122 134  121 138  119 142  117 146  115 150  114 153  113 157  112 160  112 163  112 166  112 168  113 170  113 171  114 172  
+4 >
+26   25 92  25 93  26 92  28 90  31 87  34 84  38 81  43 77  47 75  51 72  54 70  55 69  56 69  56 68  55 68  54 67  51 66  49 64  45 62  40 60  35 59  29 57  25 55  21 55  20 55  21 55  
+25   96 100  95 101  96 100  98 99  101 97  105 94  110 92  113 90  118 87  122 85  125 83  127 82  127 81  126 80  125 80  124 80  123 80  120 79  117 77  113 75  109 73  103 71  99 68  95 65  92 64  
+30   32 184  31 184  32 184  33 182  36 180  40 177  46 174  52 170  59 166  66 163  71 161  74 160  75 159  74 159  73 160  72 160  70 160  69 160  67 160  66 158  63 156  59 154  56 152  51 149  47 147  42 146  39 145  36 145  35 146  36 147  
+28   108 197  107 198  108 198  109 198  112 196  116 194  121 191  126 187  132 184  136 182  139 180  141 180  142 179  141 180  141 181  140 181  139 181  138 181  137 180  135 178  133 176  130 174  126 170  122 167  117 163  114 159  110 157  108 156  
+4 )
+16   27 28  28 29  29 30  32 32  35 35  38 41  41 48  42 56  42 63  41 69  39 74  37 77  35 79  33 81  32 81  31 81  
+14   91 28  91 29  93 30  96 32  99 35  103 39  105 46  106 54  105 61  104 68  101 74  99 78  96 80  94 82  
+17   34 124  33 124  34 124  36 125  39 127  42 131  46 137  49 144  51 151  52 158  51 165  50 170  48 173  46 175  44 176  42 177  41 177  
+18   98 128  97 127  97 128  98 129  101 132  104 135  108 140  111 146  113 152  114 157  114 164  112 170  108 176  105 180  101 184  98 186  96 187  94 188  
+8 (
+117   159 21  158 22  158 23  157 24  156 24  156 25  156 26  155 26  155 27  154 27  154 28  153 28  153 29  153 30  152 30  152 31  151 32  151 33  150 33  150 34  150 35  149 36  148 37  148 38  147 39  147 40  146 41  146 42  146 43  145 44  145 45  144 46  144 47  144 48  144 49  144 50  143 50  143 51  143 52  143 51  143 52  143 53  142 53  142 54  142 55  142 56  142 57  142 58  141 59  141 60  141 61  141 62  141 63  141 64  140 64  140 65  140 66  140 67  140 68  140 69  140 70  140 71  140 72  140 73  140 74  140 75  140 76  140 77  141 78  141 79  141 80  141 81  141 82  142 83  142 84  142 85  142 86  143 86  143 87  143 88  144 89  144 90  144 91  145 92  145 93  145 94  146 94  146 95  146 96  147 96  147 97  148 97  148 98  149 99  149 100  150 100  150 101  151 101  151 102  152 103  152 104  153 104  153 105  153 106  154 106  154 107  155 107  156 107  156 108  157 108  157 109  158 109  158 110  159 110  159 111  160 111  160 112  
+101   63 19  63 20  62 20  62 21  62 22  61 22  61 23  60 23  60 24  60 25  59 25  59 26  58 26  58 27  58 28  57 28  57 29  57 30  56 30  56 31  56 32  55 32  55 33  55 34  54 34  54 35  54 36  53 37  53 38  52 38  52 39  52 40  52 41  51 41  51 42  51 43  51 44  51 45  51 46  51 47  50 47  50 48  50 49  50 50  50 51  50 52  50 53  50 54  50 55  50 56  50 57  50 58  50 59  50 60  50 61  50 62  50 63  50 64  50 65  50 66  50 67  50 68  50 69  50 70  50 71  50 72  50 73  50 74  51 74  51 75  51 76  52 77  52 78  52 79  53 80  54 81  54 82  55 82  55 83  56 84  57 85  57 86  58 86  58 87  59 88  60 89  60 90  61 90  61 91  63 92  64 93  65 93  65 94  66 94  67 94  68 94  68 95  69 95  70 95  70 96  71 96  
+15   39 27  38 27  38 26  36 27  35 27  33 29  30 32  28 38  26 45  25 53  26 60  27 67  28 72  31 75  32 77  
+13   113 27  112 27  110 28  108 30  105 34  102 40  99 48  98 57  97 66  98 73  99 77  101 80  103 81  
+16   46 124  45 123  44 123  43 123  41 125  38 127  35 131  32 137  29 144  27 152  27 160  28 166  30 172  33 176  35 177  37 178  
+17   113 128  113 127  112 127  111 127  109 128  107 131  104 136  101 142  99 150  98 159  98 166  98 173  100 177  102 180  105 182  106 183  107 183  
+40   50 24  50 25  49 26  49 27  49 28  49 29  49 30  49 32  47 33  47 35  45 37  45 40  44 42  43 45  43 47  43 50  43 52  43 54  43 55  43 57  43 59  43 60  43 61  44 63  43 61  44 63  45 64  45 65  47 66  47 67  48 68  49 69  50 69  51 70  52 71  53 71  53 72  54 72  55 72  55 73  
+40   140 25  139 27  138 28  137 29  135 31  134 33  133 34  132 36  131 37  129 39  128 41  126 44  124 46  122 49  121 51  119 53  118 55  117 58  116 60  115 63  115 65  115 68  115 71  115 73  116 75  117 78  118 80  119 82  121 83  122 85  124 87  125 89  127 90  128 91  129 92  130 92  131 93  132 93  133 93  133 94  
+4 .
+21   133 137  133 138  132 138  130 139  126 139  122 139  116 139  109 139  103 140  98 141  94 142  91 143  92 143  95 142  100 141  107 140  115 139  124 138  131 138  137 138  140 138  
+21   61 137  61 136  60 135  58 135  55 134  51 134  46 134  41 136  36 137  32 139  29 140  29 141  30 140  34 140  40 139  46 138  53 138  59 138  65 138  68 137  70 138  
+19   126 50  125 50  124 50  122 51  119 51  115 51  111 51  105 52  99 52  95 53  92 53  91 53  92 54  96 54  101 53  106 53  112 52  116 52  120 52  
+18   56 54  54 54  53 54  50 54  46 54  41 55  37 55  33 56  30 56  29 56  30 57  32 57  35 57  39 57  43 57  47 57  50 57  52 57  
+4 -
+12   87 151  88 151  91 151  96 151  103 150  111 150  118 150  124 149  129 149  132 150  134 150  133 151  
+12   23 131  22 131  23 131  25 131  29 130  34 129  41 129  49 129  57 129  65 130  70 130  74 131  
+12   108 62  107 62  105 62  107 62  111 62  116 62  123 62  131 61  139 61  146 61  151 60  153 60  
+14   27 60  25 60  24 60  23 60  25 59  27 59  33 59  40 58  47 58  56 57  63 57  70 57  74 57  76 57  
+4 T
+68   39 103  39 102  39 101  39 100  39 99  39 100  39 99  39 98  38 97  38 95  38 94  38 92  38 91  37 89  37 88  37 87  37 85  37 84  37 83  37 81  37 80  37 79  37 78  37 77  37 75  37 74  37 73  37 72  37 71  37 70  37 69  37 68  37 67  37 66  37 65  37 64  37 63  38 62  38 61  38 60  38 59  38 58  38 57  38 56  38 55  38 54  38 53  39 53  40 53  42 53  44 53  46 53  49 53  51 54  53 54  55 54  57 54  59 54  61 54  62 54  63 54  64 54  65 53  66 53  67 53  68 53  69 53  70 53  
+45   112 99  112 98  112 97  112 95  112 93  112 91  112 87  111 84  111 81  111 77  110 74  111 77  110 74  110 72  110 69  110 68  110 66  110 65  110 63  110 62  110 61  110 59  110 58  110 56  110 55  110 54  110 53  111 53  114 54  116 54  120 55  123 55  125 55  128 55  130 55  132 55  133 55  134 55  136 55  137 55  138 55  139 55  140 55  141 55  142 55  
+57   32 191  32 190  33 189  33 187  33 185  33 183  34 181  34 179  34 177  34 175  34 173  34 170  34 169  34 167  34 165  34 164  34 163  34 162  34 160  34 159  34 158  34 157  34 156  35 156  35 155  35 154  35 153  35 152  35 151  36 151  36 150  36 149  36 148  37 147  37 146  37 145  38 145  38 144  39 144  41 144  43 145  46 145  50 145  54 145  58 145  61 145  64 145  65 145  66 145  67 145  68 145  69 145  70 145  71 145  72 144  73 144  74 144  
+51   108 190  108 189  108 187  107 185  107 183  107 181  107 179  107 177  107 175  107 173  107 171  107 173  107 171  107 169  107 167  107 165  108 163  108 161  108 159  108 158  108 156  108 155  108 154  108 153  108 152  108 151  108 150  109 149  109 148  109 147  109 146  109 145  109 144  109 143  110 143  110 142  110 141  110 140  110 139  111 138  112 138  114 138  117 138  121 138  125 138  129 139  133 139  137 139  140 139  142 139  143 139  
+4 _
+69   17 55  18 55  19 55  20 55  22 55  23 55  26 55  28 55  31 55  34 56  37 56  40 57  43 57  46 57  48 58  50 58  52 58  53 58  54 58  55 57  56 57  57 57  58 57  59 57  60 57  61 57  63 57  65 57  67 56  69 56  71 56  71 57  70 57  69 57  67 57  64 57  62 57  58 57  56 57  54 57  52 57  50 57  49 57  48 57  47 57  46 57  45 57  44 58  42 58  41 58  40 58  41 58  40 58  39 58  38 58  37 58  36 58  35 58  34 58  32 58  31 58  31 59  30 59  29 59  28 59  27 59  26 59  25 59  24 59  
+44   98 78  99 78  101 78  104 78  107 78  110 78  114 78  121 78  125 78  128 78  131 78  133 78  135 78  137 78  138 78  139 78  138 78  137 78  136 78  134 78  131 78  129 78  126 78  124 79  122 79  120 79  117 79  115 78  113 78  111 78  110 78  108 78  108 79  107 79  106 79  105 79  104 79  103 79  102 79  101 79  100 79  99 79  98 79  97 79  
+26   21 124  22 124  24 124  28 125  32 125  39 125  46 126  59 126  69 126  76 127  80 127  83 127  84 127  85 127  85 128  84 128  80 128  76 128  66 128  59 127  52 127  45 126  41 125  38 125  35 124  34 124  
+36   86 165  86 164  87 164  89 164  91 164  93 163  96 163  99 164  102 164  106 164  109 163  106 164  109 163  112 164  116 164  120 164  123 164  125 164  126 164  126 165  125 165  123 165  122 165  120 165  118 165  116 165  114 165  112 165  109 165  102 164  95 163  88 163  84 162  82 162  80 162  81 162  
+2 *
+57   35 128  35 129  38 131  41 134  44 137  46 139  49 141  51 143  53 145  56 147  60 148  63 149  66 150  69 150  73 149  76 147  79 146  81 143  83 141  85 139  86 137  87 135  87 134  87 133  86 133  86 132  85 132  83 132  82 133  79 133  76 134  73 135  69 135  67 136  63 137  61 138  59 139  58 139  57 140  55 141  54 142  53 143  51 145  50 146  49 147  48 148  47 149  46 150  45 152  43 153  41 155  39 157  38 158  37 159  36 160  35 161  34 162  
+56   26 38  26 39  26 40  26 41  26 43  27 46  27 49  28 52  29 55  30 57  31 60  33 63  35 66  37 68  39 70  43 71  47 72  51 73  58 73  65 73  68 73  71 72  73 71  75 69  76 68  77 66  77 65  78 65  78 64  77 63  76 63  75 62  75 63  73 63  71 63  68 64  65 65  62 65  59 66  56 67  53 68  51 69  48 70  46 71  45 72  43 73  41 74  40 75  39 76  38 77  37 78  35 79  34 81  33 81  33 82  33 83  
+2 `
+33   90 187  90 186  90 185  89 185  89 184  89 183  88 181  87 180  86 178  85 175  83 172  82 169  80 165  77 161  75 157  73 154  71 151  70 148  69 147  68 145  67 145  66 145  67 145  67 148  69 151  72 155  75 162  78 169  81 176  83 180  84 183  85 184  85 185  
+37   69 103  69 102  69 101  68 101  67 99  67 98  66 96  65 94  65 92  64 90  62 87  61 84  60 81  59 78  59 75  58 73  58 70  57 68  57 67  57 66  57 67  58 68  59 70  60 72  62 76  64 79  66 83  68 86  69 89  70 92  71 94  72 96  73 98  74 99  75 100  75 101  76 102  
+2 ;
+40   113 53  113 54  113 56  111 59  109 63  107 66  105 70  103 73  101 77  99 81  97 84  95 86  93 88  92 90  91 91  89 93  88 94  88 95  87 95  87 94  88 93  89 92  90 90  92 88  93 85  95 82  97 79  99 75  101 72  103 69  104 66  105 64  105 63  106 62  107 61  108 60  109 58  111 57  112 55  113 54  
+34   71 32  71 33  71 34  69 36  67 39  64 42  61 46  57 50  53 54  50 58  48 61  47 64  46 66  45 68  46 67  47 67  47 66  48 64  49 62  50 59  52 57  54 54  56 51  59 47  61 45  64 42  67 39  71 37  78 34  82 32  86 30  89 28  91 27  93 25  
+2 :
+32   100 31  101 32  101 34  102 37  102 40  103 44  104 48  104 55  105 59  106 63  106 66  107 68  107 70  107 71  108 72  108 73  107 73  107 72  107 71  107 69  108 67  108 65  108 62  108 59  108 56  108 52  108 48  109 45  109 42  108 40  108 39  107 39  
+35   36 26  36 27  36 28  36 30  37 33  37 37  38 41  38 48  38 55  38 59  39 63  39 66  39 69  39 72  38 73  38 74  39 73  39 72  39 69  40 65  41 61  41 57  42 50  42 46  43 39  43 35  43 32  43 29  43 27  43 26  43 27  43 26  43 25  43 26  43 27  
+3 F
+12   184 33  183 32  183 31  185 33  187 36  189 41  192 47  195 55  198 62  200 67  203 72  205 74  
+14   112 34  111 33  112 33  113 34  114 38  117 43  120 50  122 57  125 64  128 69  129 72  131 74  132 75  132 74  
+13   43 37  42 37  42 39  44 41  47 45  49 50  53 56  56 61  59 67  62 70  63 73  64 74  65 74  
+3 G
+41   219 44  219 43  218 42  217 41  216 40  215 40  214 39  212 39  211 40  209 41  206 42  203 44  201 47  198 50  196 54  195 58  195 63  196 66  199 69  201 71  205 72  208 72  211 72  212 71  213 71  213 70  211 71  209 71  206 73  202 75  199 77  196 80  194 83  194 87  194 91  196 94  199 96  203 98  207 98  211 98  215 97  
+40   145 43  145 42  145 40  144 39  142 38  139 38  136 39  132 41  128 44  124 47  121 51  120 54  119 58  120 61  122 64  124 65  127 66  129 66  131 65  133 64  134 63  134 62  133 61  132 61  130 62  128 63  125 65  122 67  119 70  117 73  116 76  117 80  118 83  121 86  124 87  129 88  134 87  138 86  142 85  145 84  
+43   62 44  62 43  63 43  63 42  63 41  62 40  61 38  60 37  58 37  55 37  52 39  49 41  46 43  44 47  42 51  41 56  41 61  42 65  44 68  46 71  48 72  50 72  52 71  53 70  54 69  53 68  53 67  51 67  50 67  48 68  45 70  43 72  41 74  38 80  38 84  39 87  41 90  44 93  48 94  52 94  56 93  60 91  63 90  
+3 H
+41   215 55  214 55  213 54  214 53  215 51  217 50  219 48  223 46  227 45  230 45  234 47  236 50  238 54  237 59  235 63  232 67  228 70  225 73  223 74  222 75  221 75  222 75  223 74  226 74  228 74  231 75  234 76  237 79  239 82  240 85  240 89  239 92  237 95  233 97  230 99  224 100  219 101  213 101  208 100  204 98  201 96  
+40   135 54  134 54  133 54  134 53  135 52  137 50  140 49  144 48  148 49  152 50  155 53  157 56  157 60  156 64  154 68  151 71  149 73  146 75  144 76  143 77  143 76  144 76  146 75  148 75  150 76  153 77  155 78  157 80  158 83  159 85  158 88  157 90  154 93  152 94  148 95  144 96  139 96  135 96  131 95  128 94  
+41   52 52  52 51  51 51  52 50  52 49  53 47  55 45  57 44  60 43  64 44  68 45  72 48  74 50  75 54  74 56  73 59  71 62  68 64  66 66  65 67  65 68  66 68  67 68  69 67  71 68  72 69  74 71  76 74  78 77  79 81  79 84  78 87  75 89  72 91  67 93  62 94  55 94  50 94  45 93  42 91  41 90  
+3 I
+50   223 96  224 96  224 97  223 98  222 99  221 101  219 102  216 104  214 106  210 106  207 106  203 104  199 103  195 101  192 98  189 96  187 93  186 90  186 87  188 85  190 84  194 83  198 82  202 82  205 83  208 83  210 84  211 84  211 85  210 85  209 85  207 85  204 85  200 84  196 84  190 83  185 83  180 82  177 81  174 79  174 76  176 73  180 70  185 67  191 63  197 61  202 59  207 59  210 59  211 60  
+50   152 94  152 95  151 96  149 98  147 99  144 100  139 102  134 104  128 105  122 105  118 104  114 102  112 100  111 97  111 94  113 91  115 88  118 85  121 83  125 82  128 81  131 81  133 82  135 83  136 84  136 85  136 86  135 86  134 87  133 86  131 86  128 85  124 84  121 82  117 80  113 79  109 76  106 74  103 72  102 70  103 69  105 67  109 64  114 62  121 60  128 57  134 56  139 56  142 56  145 57  
+47   64 95  64 96  64 97  63 97  62 99  60 100  57 101  54 101  50 102  46 101  42 100  38 98  35 96  32 92  31 89  31 86  32 83  35 80  37 79  41 78  46 77  50 77  54 78  56 79  57 79  58 80  57 80  56 80  54 80  51 79  47 78  44 77  39 75  36 73  32 70  30 67  29 64  29 61  30 57  34 54  39 51  44 50  50 49  56 49  61 51  65 52  67 54  
+3 J
+52   208 104  207 104  206 104  206 105  207 106  209 107  212 108  216 109  221 109  226 109  231 108  235 106  239 104  241 101  243 98  243 95  242 92  239 90  235 88  231 87  227 87  223 88  220 88  218 89  217 89  217 90  218 90  220 90  222 90  225 90  227 89  231 88  234 87  237 86  239 84  242 82  243 79  245 76  245 72  244 68  241 64  238 60  233 58  226 56  219 56  213 58  207 60  204 63  202 67  202 70  203 72  206 74  
+48   126 101  124 100  123 100  122 100  121 101  122 101  123 102  125 103  128 104  132 104  138 103  143 101  148 99  153 96  156 93  157 89  158 87  157 84  155 82  151 80  149 79  145 79  142 79  139 79  137 79  135 79  136 79  137 79  140 78  144 78  147 77  152 75  156 73  159 71  161 69  163 66  163 64  163 60  161 56  158 53  154 50  151 49  145 48  139 48  133 49  128 51  124 53  122 55  
+49   42 95  41 96  40 97  41 98  42 100  43 101  46 102  49 103  53 103  58 103  62 102  67 100  71 97  73 94  75 90  75 87  75 84  73 82  71 80  68 78  65 78  63 77  60 77  58 78  57 78  56 78  56 79  57 79  58 79  60 78  63 77  66 76  70 75  73 72  75 71  77 68  78 65  77 62  76 59  73 56  70 54  66 52  61 51  56 50  52 51  47 51  45 52  44 52  44 53  
+3 K
+35   200 146  199 145  199 144  198 142  198 140  197 136  197 131  197 127  197 122  197 117  197 114  197 112  198 112  199 114  201 117  203 121  206 126  209 131  213 137  217 141  220 144  224 145  227 146  229 145  230 144  231 143  231 141  232 138  231 135  231 130  230 124  230 118  229 112  228 108  227 104  
+35   137 85  137 84  137 82  137 80  136 77  136 73  136 67  135 61  135 54  135 49  135 44  135 42  136 41  137 43  139 46  141 50  144 56  147 63  151 69  155 75  158 80  161 82  164 83  166 84  167 82  169 80  170 76  171 71  171 65  171 57  171 49  171 42  171 36  170 32  170 30  
+37   44 83  44 84  43 83  43 81  43 78  42 74  42 69  41 63  41 57  40 52  39 48  39 45  39 44  40 45  41 47  43 51  46 55  50 60  53 66  57 70  60 73  63 75  65 77  66 77  67 77  68 76  69 74  69 73  69 69  69 65  68 59  68 53  67 46  67 39  67 34  67 31  67 29  
diff -urN lib/microwindows/src/demos/nxscribble/sc.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/sc.c
--- lib/microwindows/src/demos/nxscribble/sc.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/sc.c	2005-02-21 16:13:01.000000000 +0100
@@ -0,0 +1,533 @@
+/***********************************************************************
+
+sc.c - creates classifiers from feature vectors of examples, as well as
+   classifying example feature vectors.
+
+Copyright (C) 1991 Dean Rubine
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 1, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (in ../COPYING); if not, write to the Free
+Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+***********************************************************************/
+
+
+#include "bitvector.h"
+#include "matrix.h"
+#include "util.h"
+#include "sc.h"
+#include "stdio.h"
+#include "stdlib.h"
+#include "math.h"
+#include "zdebug.h"
+
+#define	EPS	(1.0e-6)	/* for singular matrix check */
+sClassifier
+sNewClassifier()
+{
+	register sClassifier sc = allocate(1, struct sclassifier);
+	sc->nfeatures = -1;
+	sc->nclasses = 0;
+	sc->classdope = allocate(MAXSCLASSES, sClassDope);
+	sc->w = NULL;
+	return sc;
+}
+
+void
+sFreeClassifier(sc)
+register sClassifier sc;
+{
+	register int i;
+	register sClassDope scd;
+
+	for(i = 0; i < sc->nclasses; i++) {
+		scd = sc->classdope[i];
+		if(scd->name) free(scd->name);
+		if(scd->sumcov) FreeMatrix(scd->sumcov);
+		if(scd->average) FreeVector(scd->average);
+		free(scd);
+		if(sc->w && sc->w[i]) FreeVector(sc->w[i]);
+	}
+	free(sc->classdope);
+	if(sc->w) free(sc->w);
+	if(sc->cnst) FreeVector(sc->cnst);
+	if(sc->invavgcov) FreeMatrix(sc->invavgcov);
+	free(sc);
+}
+
+sClassDope
+sClassNameLookup(sc, classname)
+register sClassifier sc;
+register char *classname;
+{
+	register int i;
+	register sClassDope scd;
+	static sClassifier lastsc = NULL;
+	static sClassDope lastscd = NULL;
+
+	/* quick check for last class name */
+	if(lastsc == sc && lastscd != NULL && STREQ(lastscd->name, classname))
+		return lastscd;
+
+	/* linear search through all classes for name */
+	for(i = 0; i < sc->nclasses; i++) {
+		scd = sc->classdope[i];
+		if(STREQ(scd->name, classname))
+			return lastsc = sc, lastscd = scd;
+	}
+	lastsc = NULL;
+	lastscd = NULL;
+	return NULL;
+}
+
+static sClassDope
+sAddClass(sc, classname)
+register sClassifier sc;
+char *classname;
+{
+	register sClassDope scd;
+
+	sc->classdope[sc->nclasses] = scd = allocate(1, struct sclassdope);
+	scd->name = scopy(classname);
+	scd->number = sc->nclasses;
+	scd->nexamples = 0;
+	scd->sumcov = NULL;
+	++sc->nclasses;
+	return scd;
+}
+
+void
+sAddExample(sc, classname, y)
+register sClassifier sc;
+char *classname;
+Vector y;
+{
+	register sClassDope scd;
+	register int i, j;
+	double nfv[50];
+	double nm1on, recipn;
+
+	scd = sClassNameLookup(sc, classname);
+	if(scd == NULL) {
+/* fprintf(stderr, "sAddExample: calling sAddClass on %s.\n", classname); */
+		scd = sAddClass(sc, classname);
+	      }
+
+	if(sc->nfeatures == -1) {
+		sc->nfeatures = NROWS(y);
+/*		fprintf(stderr, "sAddExample: setting sc->nfeatures to NROWS(y).\n"); */
+	      }
+
+	if(scd->nexamples == 0) {
+/* 		fprintf(stderr, "sAddExample: allocating  & zeroing scd->average & scd->sumcov.\n"); */
+		scd->average = NewVector(sc->nfeatures);
+		ZeroVector(scd->average);
+		scd->sumcov = NewMatrix(sc->nfeatures, sc->nfeatures);
+		ZeroMatrix(scd->sumcov);
+
+	}
+
+	if(sc->nfeatures != NROWS(y)) {
+		PrintVector(y, "sAddExample: funny feature vector nrows!=%d", 
+			sc->nfeatures);
+		return;
+	}
+
+	scd->nexamples++;
+	nm1on = ((double) scd->nexamples-1)/scd->nexamples;
+	recipn = 1.0/scd->nexamples;
+
+	/* incrementally update covariance matrix */
+        for(i = 0; i < sc->nfeatures; i++)
+		nfv[i] = y[i] - scd->average[i];
+
+	/* only upper triangular part computed */
+        for(i = 0; i < sc->nfeatures; i++)
+	   for(j = i; j < sc->nfeatures; j++)
+		scd->sumcov[i][j] += nm1on * nfv[i] * nfv[j];
+
+	/* incrementally update mean vector */
+	for(i = 0; i < sc->nfeatures; i++)
+		scd->average[i] = nm1on * scd->average[i] + recipn * y[i];
+
+}
+
+void
+sDoneAdding(sc)
+register sClassifier sc;
+{
+	register int i, j;
+	int c;
+	int ne, denom;
+	double oneoverdenom;
+	register Matrix s;
+	register Matrix avgcov;
+	double det;
+	register sClassDope scd;
+
+	if(sc->nclasses == 0) {
+		error("No classes for adding to classifier");
+		return;
+	    }
+
+	/* Given covariance matrices for each class (* number of examples - 1)
+	    compute the average (common) covariance matrix */
+
+	avgcov = NewMatrix(sc->nfeatures, sc->nfeatures);
+	ZeroMatrix(avgcov);
+	ne = 0;
+	for(c = 0; c < sc->nclasses; c++) {
+		scd = sc->classdope[c];
+		ne += scd->nexamples;
+		s = scd->sumcov;
+		for(i = 0; i < sc->nfeatures; i++)
+			for(j = i; j < sc->nfeatures; j++)
+				avgcov[i][j] += s[i][j]; 
+	}
+
+	denom = ne - sc->nclasses;
+	if(denom <= 0) {
+	    error("Number of classes must be less than number of examples");
+	    return;
+	}
+
+	oneoverdenom = 1.0 / denom;
+	for(i = 0; i < sc->nfeatures; i++)
+		for(j = i; j < sc->nfeatures; j++)
+			avgcov[j][i] = avgcov[i][j] *= oneoverdenom;
+
+	Z('a') PrintMatrix(avgcov, "Average Covariance Matrix\n");
+	/* invert the avg covariance matrix */
+
+	sc->invavgcov = NewMatrix(sc->nfeatures, sc->nfeatures);
+	det = InvertMatrix(avgcov, sc->invavgcov);
+	if(fabs(det) <= EPS)
+		FixClassifier(sc, avgcov);
+	
+	/* now compute discrimination functions */
+	sc->w = allocate(sc->nclasses, Vector);
+	sc->cnst = NewVector(sc->nclasses);
+	for(c = 0; c < sc->nclasses; c++) {
+		scd = sc->classdope[c];
+		sc->w[c] = NewVector(sc->nfeatures);
+		VectorTimesMatrix(scd->average, sc->invavgcov, sc->w[c]);
+		sc->cnst[c] = -0.5 * InnerProduct(sc->w[c], scd->average);
+		/* could add log(priorprob class c) to cnst[c] */
+	}
+
+	FreeMatrix(avgcov);
+	return;
+}
+
+sClassDope
+sClassify(sc, fv) {
+	return sClassifyAD(sc, fv, NULL, NULL);
+}
+
+sClassDope
+sClassifyAD(sc, fv, ap, dp)
+sClassifier sc;
+Vector fv;
+double *ap;
+double *dp;
+{
+	double disc[MAXSCLASSES];
+	register int i, maxclass;
+	double denom, exp();
+	register sClassDope scd;
+	double d;
+
+	if(sc->w == NULL) {
+		error("%x not a trained classifier", sc);
+		return(NULL);
+       }
+
+	for(i = 0; i < sc->nclasses; i++) {
+/* ari */
+	  double IP;
+	  IP = InnerProduct(sc->w[i], fv);
+/*	  fprintf(stderr, "sClassifyAD:  InnerProduct for class %s is %f.\n", sc->classdope[i]->name, IP); */
+/*	  fprintf(stderr, "sClassifyAD:  sc->cnst[i] = %f.\n", sc->cnst[i]); */
+	  disc[i] = IP + sc->cnst[i];
+/*	  fprintf(stderr, "sClassifyAD:  Set disc = %f for class %s.\n", disc[i],sc->classdope[i]->name); */
+	    
+/*	  disc[i] = InnerProduct(sc->w[i], fv) + sc->cnst[i]; */
+	}
+
+	maxclass = 0;
+	for(i = 1; i < sc->nclasses; i++)
+		if(disc[i] > disc[maxclass])
+			maxclass = i;
+
+/* ari */
+/* PF_INIT_COS	0	 initial angle (cos)                         */
+/* PF_INIT_SIN	1	 initial angle (sin)                         */
+/* PF_BB_LEN	2	 length of bounding box diagonal             */
+/* PF_BB_TH	3	 angle of bounding box diagonal              */
+/* PF_SE_LEN	4	 length between start and end points         */
+/* PF_SE_COS	5	 cos of angle between start and end points   */
+/* PF_SE_SIN	6	 sin of angle between start and end points   */
+/* PF_LEN	7	 arc length of path                          */
+/* PF_TH	8	 total angle traversed                       */
+/* PF_ATH	9	 sum of abs vals of angles traversed         */
+/* PF_SQTH	10	 sum of squares of angles traversed          */
+/* PF_DUR	11	 duration of path                            */ 
+/* ifndef USE_TIME                                                   */
+/* 	NFEATURES	12                                           */
+/* else                                                              */
+/* 	PF_MAXV		12	   maximum speed                     */
+/* 	NFEATURES	13                                           */
+/* endif                                                             */
+
+/*
+* fprintf(stderr, "\nFeature vector:\n");
+* fprintf(stderr, "    start cosine      %8.4f    path length       %8.4f\n",
+* 	fv[PF_INIT_COS], fv[PF_LEN]);
+* fprintf(stderr, "    start sine        %8.4f    total angle       %8.4f\n",
+* 	fv[PF_INIT_SIN], fv[PF_TH]);
+* fprintf(stderr, "    b.b. length       %8.4f    total abs. angle  %8.4f\n",
+* 	fv[PF_BB_LEN], fv[PF_ATH]);
+* fprintf(stderr, "    b.b. angle        %8.4f    total sq. angle   %8.4f\n",
+* 	fv[PF_BB_TH], fv[PF_SQTH]);
+* fprintf(stderr, "    st-end length     %8.4f    duration          %8.4f\n",
+* 	fv[PF_SE_LEN], fv[PF_DUR]);
+* fprintf(stderr, "    st-end cos        %8.4f\n", fv[PF_SE_COS]);
+* fprintf(stderr, "    st-end sin        %8.4f\n", fv[PF_SE_SIN]);
+*/
+ 	ZZ('C') {
+		scd = sc->classdope[maxclass];
+		PrintVector(fv, "%10.10s  ", scd->name);
+		ZZZ('C') {
+			for(i = 0; i < sc->nclasses; i++) {
+				scd = sc->classdope[i];
+				PrintVector(scd->average, "%5.5s %5g ",
+					scd->name, disc[i]);
+			}
+		}
+	}
+
+	scd = sc->classdope[maxclass];
+/* ari */
+/* fprintf(stderr,"%s", scd->name); */
+/*
+   fprintf(stderr,"Stroke identified as %s [ ", scd->name);
+   for (i = 0; i < sc->nclasses; i++) {
+      if ( (disc[maxclass] - disc[i] < 5.0) && (i != maxclass) )
+         fprintf(stderr,"%s ", sc->classdope[i]->name);
+   }
+   fprintf(stderr,"], ");
+*/
+	if(ap) {	/* calculate probability of non-ambiguity */
+		for(denom = 0, i = 0; i < sc->nclasses; i++)
+			/* quick check to avoid computing negligible term */
+			if((d = disc[i] - disc[maxclass]) > -7.0)
+				denom += exp(d);
+		*ap = 1.0 / denom;
+	}
+
+	if(dp) 	/* calculate distance to mean of chosen class */
+		*dp = MahalanobisDistance(fv, scd->average, sc->invavgcov);
+
+	return scd;
+}
+
+/*
+ Compute (v-u)' sigma (v-u)
+ */
+
+double
+MahalanobisDistance(v, u, sigma)
+register Vector v, u;
+register Matrix sigma;
+{
+	register int i;
+	static Vector space;
+	double result;
+
+	if(space == NULL || NROWS(space) != NROWS(v)) {
+		if(space) FreeVector(space);
+		space = NewVector(NROWS(v));
+	}
+	for(i = 0; i < NROWS(v); i++)
+		space[i] = v[i] - u[i];
+	result =  QuadraticForm(space, sigma);
+	return result;
+}
+
+void
+FixClassifier(sc, avgcov)
+register sClassifier sc;
+Matrix avgcov;
+{
+	int i;
+	double det;
+	BitVector bv;
+	Matrix m, r;
+
+	/* just add the features one by one, discarding any that cause
+	   the matrix to be non-invertible */
+
+	CLEAR_BIT_VECTOR(bv);
+	for(i = 0; i < sc->nfeatures; i++) {
+		BIT_SET(i, bv);
+		m = SliceMatrix(avgcov, bv, bv);
+		r = NewMatrix(NROWS(m), NCOLS(m));
+		det = InvertMatrix(m, r);
+		if(fabs(det) <= EPS)
+			BIT_CLEAR(i, bv);
+		FreeMatrix(m);
+		FreeMatrix(r);
+	}
+
+	m = SliceMatrix(avgcov, bv, bv);
+	r = NewMatrix(NROWS(m), NCOLS(m));
+	det = InvertMatrix(m, r);
+	if(fabs(det) <= EPS) {
+		error("Can't fix classifier!");
+		return;
+	    }
+	DeSliceMatrix(r, 0.0, bv, bv, sc->invavgcov);
+
+	FreeMatrix(m);
+	FreeMatrix(r);
+
+}
+
+void
+sDumpClassifier(sc)
+register sClassifier sc;
+{
+	register sClassIndex c;
+
+	printf("\n----Classifier %x, %d features:-----\n", (int)sc, sc->nfeatures);
+	printf("%d classes: ", sc->nclasses);
+	for(c = 0; c < sc->nclasses; c++)
+		printf("%s  ", sc->classdope[c]->name);
+	printf("Discrimination functions:\n");
+	for(c = 0; c < sc->nclasses; c++) {
+		PrintVector(sc->w[c], "%s: %g + ", sc->classdope[c]->name, sc->cnst[c]);
+		printf("Mean vectors:\n");
+		PrintVector(sc->classdope[c]->average, "%s: ", sc->classdope[c]->name);
+	    }
+	if( sc->invavgcov != NULL ) {
+	    PrintMatrix(sc->invavgcov, "Inverse average covariance matrix:\n");
+	}
+	printf("\n---------\n\n");
+}
+
+void
+sWrite(outfile, sc)
+FILE *outfile;
+sClassifier sc;
+{
+	int i;
+	register sClassDope scd;
+
+	fprintf(outfile, "%d classes\n", sc->nclasses);
+	for(i = 0; i < sc->nclasses; i++) {
+		scd = sc->classdope[i];
+		fprintf(outfile, "%s\n", scd->name);
+	}
+	for(i = 0; i < sc->nclasses; i++) {
+		scd = sc->classdope[i];
+		OutputVector(outfile, scd->average);
+		OutputMatrix(outfile, scd->sumcov);
+		OutputVector(outfile, sc->w[i]);
+	}
+	OutputVector(outfile, sc->cnst);
+	OutputMatrix(outfile, sc->invavgcov);
+}
+
+sClassifier
+sRead(infile)
+FILE *infile;
+{
+	int i, n;
+	register sClassifier sc;
+	register sClassDope scd;
+	char buf[100];
+
+	
+	Z('a') printf("Reading classifier \n");
+	sc = sNewClassifier();
+	fgets(buf, 100, infile);
+	if(sscanf(buf, "%d", &n) != 1) {
+	    error("Input error in classifier file");
+	    sFreeClassifier(sc);
+	    return(NULL);
+	}
+	Z('a') printf("  %d classes \n", n);
+	for(i = 0; i < n; i++) {
+		fscanf(infile, "%s", buf);
+		scd = sAddClass(sc, buf);
+		Z('a') printf("  %s \n", scd->name);
+	}
+	sc->w = allocate(sc->nclasses, Vector);
+	for(i = 0; i < sc->nclasses; i++) {
+		scd = sc->classdope[i];
+		scd->average = InputVector(infile);
+		scd->sumcov = InputMatrix(infile);
+		sc->w[i] = InputVector(infile);
+	}
+	sc->cnst = InputVector(infile);
+	sc->invavgcov = InputMatrix(infile);
+	Z('a') printf("\n");
+	return sc;
+}
+
+
+void
+sDistances(sc, nclosest)
+register sClassifier sc;
+{
+	register Matrix d = NewMatrix(sc->nclasses, sc->nclasses);
+	register int i, j;
+	double min, max = 0;
+	int n, mi, mj;
+
+	printf("-----------\n");
+	printf("Computing %d closest pairs of classes\n", nclosest);
+	for(i = 0; i < NROWS(d); i++) {
+		for(j = i+1; j < NCOLS(d); j++) {
+			d[i][j] = MahalanobisDistance(
+						sc->classdope[i]->average,
+						sc->classdope[j]->average,
+						sc->invavgcov);
+			if(d[i][j] > max) max = d[i][j];
+		}
+	}
+
+	for(n = 1; n <= nclosest; n++) {
+		min = max;
+		mi = mj = -1;
+		for(i = 0; i < NROWS(d); i++) {
+			for(j = i+1; j < NCOLS(d); j++) {
+				if(d[i][j] < min)
+					min = d[mi=i][mj=j];
+			}
+		}
+		if(mi == -1)
+			break;
+
+		printf("%2d) %10.10s to %10.10s d=%g nstd=%g\n",
+			n,
+			sc->classdope[mi]->name,
+			sc->classdope[mj]->name,
+			d[mi][mj],
+			sqrt(d[mi][mj]));
+
+		d[mi][mj] = max+1;
+	}
+	printf("-----------\n");
+	FreeMatrix(d);
+}
diff -urN lib/microwindows/src/demos/nxscribble/sc.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/sc.h
--- lib/microwindows/src/demos/nxscribble/sc.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/sc.h	2005-02-21 16:03:05.000000000 +0100
@@ -0,0 +1,72 @@
+/***********************************************************************
+
+sc.h - creates classifiers from feature vectors of examples, as well as
+   classifying example feature vectors.
+
+Copyright (C) 1991 Dean Rubine
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 1, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program (in ../COPYING); if not, write to the Free
+Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+***********************************************************************/
+
+
+/*
+ single path classifier
+*/
+
+#ifndef _SC_H_
+
+#define _SC_H_
+
+#define	MAXSCLASSES	100
+
+typedef struct sclassifier *sClassifier; /* single feature-vector classifier */
+typedef int		    sClassIndex; /* single feature-vector class index */
+typedef struct sclassdope  *sClassDope;	 /* single feature-vector class dope */
+
+struct sclassdope {
+	char 		*name;
+	sClassIndex	number;
+	Vector		average;
+	Matrix		sumcov;
+	int		nexamples;
+};
+
+struct sclassifier {
+	int		nfeatures;
+	int		nclasses;
+	sClassDope	*classdope;
+
+	Vector		cnst;	/* constant term of discrimination function */
+	Vector		*w;	/* array of coefficient weights */
+	Matrix		invavgcov; /* inverse covariance matrix */
+};
+
+sClassifier	sNewClassifier();
+sClassifier	sRead();		/* FILE *f */
+void		sWrite();		/* FILE *f; sClassifier sc; */
+void	 	sFreeClassifier();	/* sc */
+void		sAddExample();		/* sc, char *classname; Vector y */
+void		sRemoveExample();	/* sc, classname, y */
+void		sDoneAdding();		/* sc */
+sClassDope	sClassify();		/* sc, y */
+sClassDope	sClassifyAD();		/* sc, y, double *ap; double *dp */
+sClassDope	sClassNameLookup();	/* sc, classname */
+double		MahalanobisDistance();	/* Vector v, u; Matrix sigma */
+void		FixClassifier();
+void		sDumpClassifier();
+void		sDistances();
+
+#endif
diff -urN lib/microwindows/src/demos/nxscribble/scrib.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/scrib.h
--- lib/microwindows/src/demos/nxscribble/scrib.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/scrib.h	2005-02-21 16:13:01.000000000 +0100
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Copyright � 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+#include "hre_api.h"
+#include "li_recognizer.h"
+
+#define CS_LETTERS     0
+#define CS_DIGITS      1
+#define CS_PUNCTUATION 2
+
+#define NUM_RECS    3
+#define DEFAULT_REC_DIR         "classifiers"
+#define REC_DEFAULT_USER_DIR    "bin"
+//#define REC_DEFAULT_USER_DIR    "/home/greg/net/microwin/src/apps/scribble"
+//#define CLASSIFIER_DIR          ".classifiers"
+#define DEFAULT_LETTERS_FILE    "letters.cl"
+#define DEFAULT_DIGITS_FILE     "digits.cl"
+#define DEFAULT_PUNC_FILE       "punc.cl"
+#define rec_name                "libli_recog.so"
+
+struct graffiti {
+	recognizer rec[3];     /* 3 recognizers, one each for letters, digits, 
+				  and punctuation */
+	char cldir[200];       /* directory in which the current classifier
+				  files are found */
+	li_recognizer_train rec_train; /* pointer to training function */
+	li_recognizer_getClasses rec_getClasses; 
+    	                       /* pointer to the function that lists
+                           	  the characters in the classifier
+                           	  file. */
+};
+
+typedef struct {
+    /* private state */
+    GR_WINDOW_ID    win;
+    GR_GC_ID	    gc;
+    GR_BOOL	    down;	    /* mouse is down*/
+    /*GR_WINDOW_ID    lastfocusid;*/    /* last window with focus*/
+    GR_POINT	    *pt;	    /* points */
+    int		    ppasize;
+    pen_stroke	    ps;
+    struct graffiti graf;
+    int		    capsLock;
+    int		    puncShift;
+    int		    tmpShift;
+    int		    ctrlShift;
+    int		    curCharSet;
+    int		    lastchar;
+} ScribbleRec, *ScribbleWidget;
+
+ScribbleWidget	create_scribble(void);
+void		destroy_scribble(ScribbleWidget w);
+void		ActionStart(ScribbleWidget w, int x, int y);
+void		ActionMove(ScribbleWidget w, int x, int y);
+void		ActionEnd(ScribbleWidget w, int x, int y);
+void		Redisplay (ScribbleWidget w);
diff -urN lib/microwindows/src/demos/nxscribble/scribwidget.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/scribwidget.c
--- lib/microwindows/src/demos/nxscribble/scribwidget.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/scribwidget.c	2005-02-21 16:13:01.000000000 +0100
@@ -0,0 +1,467 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 2000 Century Software <embedded.centurysoftware.com>
+ * Scribble Handwriting Recognition for Nano-X!
+ * Scribble object routines
+ *
+ * Copyright � 1999 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  Keith Packard makes no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "scrib.h"
+
+static ScribbleRec	scrib;		/* static object instance*/
+static char *curmsg = NULL;
+
+static char *cl_name[3] = {DEFAULT_LETTERS_FILE, 
+			     DEFAULT_DIGITS_FILE,
+			     DEFAULT_PUNC_FILE};
+
+static int graffiti_load_recognizers(struct graffiti *pg);
+static void Recognize (ScribbleWidget w);
+static void ShowMode (ScribbleWidget w);
+    
+static void
+ResetStroke (ScribbleWidget w)
+{
+    w->ps.ps_npts = 0;
+    w->ps.ps_nstate = 0;
+    w->ps.ps_trans = 0;
+    w->ps.ps_state = 0;
+    w->lastchar = 0;
+    curmsg = NULL;
+    ShowMode(w);
+}
+
+static void
+DisplayStroke (ScribbleWidget	w)
+{
+    GrDrawLines(w->win, w->gc, w->pt, w->ps.ps_npts);
+}
+
+static void
+DisplayLast (ScribbleWidget w)
+{
+    int	    npt;
+    
+    npt = w->ps.ps_npts;
+    if (npt > 2)
+	npt = 2;
+    GrDrawLines(w->win, w->gc, w->pt + (w->ps.ps_npts - npt), npt);
+}
+
+static void
+AddPoint (ScribbleWidget w, int x, int y)
+{
+    pen_point	*ppa;
+    GR_POINT	*pt;
+    int		ppasize;
+    
+    if (w->ps.ps_npts == w->ppasize)
+    {
+	ppasize = w->ppasize + 100;
+	ppa = malloc ((sizeof (pen_point) + sizeof (GR_POINT)) * ppasize);
+	if (!ppa)
+	    return;
+	pt = (GR_POINT *) (ppa + ppasize);
+	memcpy (ppa, w->ps.ps_pts, w->ppasize * sizeof (pen_point));
+	memcpy (pt, w->pt, w->ppasize * sizeof (GR_POINT));
+	free (w->ps.ps_pts);
+	w->ps.ps_pts = ppa;
+	w->pt = pt;
+	w->ppasize = ppasize;
+    }
+    ppa = &w->ps.ps_pts[w->ps.ps_npts];
+    ppa->x = x;
+    ppa->y = y;
+    
+    pt = &w->pt[w->ps.ps_npts];
+    pt->x = x;
+    pt->y = y;
+    
+    w->ps.ps_npts++;
+    
+    DisplayLast (w);
+}
+
+ScribbleWidget
+create_scribble(void)
+{
+    ScribbleWidget new = (ScribbleWidget)&scrib;
+    GR_WM_PROPERTIES props;
+
+    new->capsLock = 0;
+    new->puncShift = 0;
+    new->tmpShift = 0;
+    new->ctrlShift = 0;
+    new->curCharSet = CS_LETTERS;
+    new->lastchar = 0;
+    new->down = GR_FALSE;
+    /*new->lastfocusid = 0;*/
+    
+    graffiti_load_recognizers (&new->graf);
+    
+    new->ppasize = 0;
+    new->ps.ps_pts = 0;
+    new->pt = 0;
+    
+    new->win = GrNewWindow(GR_ROOT_WINDOW_ID,
+		    350, 20, 200, 150,
+		    0, GrGetSysColor(GR_COLOR_APPWINDOW), BLACK);
+    /* set title, disallow focus on input window*/
+    props.flags = GR_WM_FLAGS_TITLE | GR_WM_FLAGS_PROPS;
+    props.props = GR_WM_PROPS_NOFOCUS | GR_WM_PROPS_BORDER |
+	    GR_WM_PROPS_CAPTION;
+    props.title = "nxScribble";
+    GrSetWMProperties(new->win, &props);
+
+    GrSelectEvents(new->win, GR_EVENT_MASK_BUTTON_DOWN |
+		GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_MOUSE_MOTION |
+		GR_EVENT_MASK_KEY_DOWN | /*GR_EVENT_MASK_FOCUS_IN |*/
+		GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_CLOSE_REQ);
+    GrMapWindow(new->win);
+
+    new->gc = GrNewGC();
+    GrSetGCForeground(new->gc, GrGetSysColor(GR_COLOR_APPTEXT));
+    GrSetGCBackground(new->gc, GrGetSysColor(GR_COLOR_APPWINDOW));
+    GrSetGCFont(new->gc, GrCreateFont(GR_FONT_OEM_FIXED, 0, NULL));
+
+    ResetStroke (new);
+    return new;
+}
+
+void
+destroy_scribble(ScribbleWidget w)
+{
+    GrDestroyWindow(w->win);
+    GrDestroyGC(w->gc);
+    free (w->ps.ps_pts);
+}
+
+void
+Redisplay (ScribbleWidget w)
+{
+    /*DisplayStroke (w);*/
+    ShowMode(w);
+}
+
+void
+ActionStart (ScribbleWidget w, int x, int y)
+{
+    GrRaiseWindow(w->win);
+    ResetStroke (w);
+    w->down = GR_TRUE;
+    AddPoint (w, x, y);
+}
+
+void
+ActionMove (ScribbleWidget w, int x, int y)
+{
+    if (w->down)
+    	AddPoint (w, x, y);
+}
+
+void
+ActionEnd (ScribbleWidget w, int x, int y)
+{
+    AddPoint (w, x, y);
+    w->down = GR_FALSE;
+    Recognize (w);
+}
+
+
+static void
+SendKey(ScribbleWidget w, int ch)
+{
+	GR_WINDOW_ID	win = GrGetFocus();
+
+	/* FIXME: modifiers are incorrect*/
+	GrInjectKeyboardEvent(win, ch, 0, 0, 1);
+	GrInjectKeyboardEvent(win, ch, 0, 0, 0);
+}
+
+/* This procedure is called to initialize pg by loading the three
+   recognizers, loading the initial set of three classifiers, and
+   loading & verifying the recognizer extension functions.  If the
+   directory $HOME/.recognizers exists, the classifier files will be
+   loaded from that directory.  If not, or if there is an error, the
+   default files (directory specified in Makefile) will be loaded
+   instead.  Returns non-zero on success, 0 on failure.  (Adapted from
+   package tkgraf/src/GraffitiPkg.c. */
+
+static int
+graffiti_load_recognizers(struct graffiti *pg)
+{
+	bool usingDefault;
+	//char* homedir;
+	int i;
+	rec_fn *fns;
+
+	/* First, load the recognizers... */
+	/* call recognizer_unload if an error ? */
+	for (i = 0; i < NUM_RECS; i++) {
+		/* Load the recognizer itself... */
+		pg->rec[i] = recognizer_load(DEFAULT_REC_DIR, rec_name, NULL);
+		if (pg->rec[i] == NULL) {
+			fprintf(stderr,"Error loading recognizer from %s.", DEFAULT_REC_DIR);
+			return 0;
+		}
+		if ((* (int *)(pg->rec[i])) != 0xfeed) {
+			fprintf(stderr,"Error in recognizer_magic.");
+			return 0;
+		}
+	}
+
+	/* ...then figure out where the classifiers are... */
+	//if ( (homedir = (char*)getenv("HOME")) == NULL ) {
+		strcpy(pg->cldir, REC_DEFAULT_USER_DIR);
+		usingDefault = true;
+	//} else {
+		//strcpy(pg->cldir, homedir);
+		//strcat(pg->cldir, "/"); 
+		//strcat(pg->cldir, CLASSIFIER_DIR); 
+		//usingDefault = false;
+	//}
+
+	/* ...then load the classifiers... */
+	for (i = 0; i < NUM_RECS; i++) {
+		int rec_return;
+		char *s;
+
+		rec_return = recognizer_load_state(pg->rec[i], pg->cldir, cl_name[i]);
+		if ((rec_return == -1) && (usingDefault == false)) {
+			fprintf(stderr,
+				"Unable to load custom classifier file %s/%s.\nTrying default classifier file instead.\nOriginal error: %s\n ", 
+				pg->cldir, cl_name[i], 
+				(s = recognizer_error(pg->rec[i])) ? s : "(none)");
+			rec_return = recognizer_load_state(pg->rec[i],
+							   REC_DEFAULT_USER_DIR, cl_name[i]);
+		}
+		if (rec_return == -1) {
+			fprintf(stderr, "Unable to load default classifier file %s.\nOriginal error: %s\n",
+				cl_name[i], 
+				(s = recognizer_error(pg->rec[i])) ? s : "(none)");
+			return 0;
+		}
+	}
+
+	/* We have recognizers and classifiers now.   */
+	/* Get the vector of LIextension functions..     */
+	fns = recognizer_get_extension_functions(pg->rec[CS_LETTERS]);
+	if (fns == NULL) {
+		fprintf(stderr, "LI Recognizer Training:No extension functions!");
+		return 0;
+	}
+	
+	/* ... and make sure the training & get-classes functions are okay. */
+	if( (pg->rec_train = (li_recognizer_train)fns[LI_TRAIN]) == NULL ) {
+		fprintf(stderr,
+			"LI Recognizer Training:li_recognizer_train() not found!");
+		if (fns != NULL) {
+			free(fns);
+		}
+		return 0;
+	}
+  
+	if( (pg->rec_getClasses = (li_recognizer_getClasses)fns[LI_GET_CLASSES]) == NULL ) {
+		fprintf(stderr,
+			"LI Recognizer Training:li_recognizer_getClasses() not found!");
+		if (fns != NULL) {
+			free(fns);
+		}
+		return 0;
+	}
+	free(fns);
+	return 1;
+}
+
+static void
+msg(char *str)
+{
+	curmsg = str;
+}
+
+static void
+ShowMode (ScribbleWidget w)
+{
+    char *mode;
+    char buf[32];
+
+    if (w->ctrlShift)
+	mode = "^C";
+    else if (w->puncShift)
+	mode = "#&^";
+    else if (w->curCharSet == CS_DIGITS)
+	mode = "123";
+    else if (w->capsLock)
+	mode = "ABC";
+    else if (w->tmpShift)
+	mode = "Abc";
+    else
+	mode = "abc";
+
+    if (curmsg)
+    	sprintf(buf, "%s  %s", mode, curmsg);
+    else if (w->lastchar > ' ')
+    	sprintf(buf, "%s    %c", mode, w->lastchar);
+    else sprintf(buf, "%s", mode);
+    GrClearWindow(w->win, GR_FALSE);
+    GrText(w->win, w->gc, 70, 0, buf, strlen(buf), GR_TFTOP);
+}
+
+static char
+do_recognize(struct graffiti *pg, pen_stroke *ps, int charset)
+{
+       char rec_char;
+       int nret;
+       rec_alternative *ret;
+
+       rec_char = recognizer_translate(pg->rec[charset], 1, ps, false,
+				       &nret, &ret);
+       if (rec_char != -1) {
+	       delete_rec_alternative_array(nret, ret, false);
+       }
+       return rec_char;
+}
+
+typedef int KeySym;
+
+static void
+Recognize (ScribbleWidget w)
+{
+    struct graffiti *graf = &w->graf;
+    pen_stroke	    *ps = &w->ps;
+    KeySym	    keysym;
+    GR_BOOL	    control;
+    char	    c;
+    
+    if (ps->ps_npts == 0)
+	return;
+    
+    w->lastchar = 0;
+
+    c = do_recognize(graf, ps, w->puncShift ? CS_PUNCTUATION : w->curCharSet);
+//printf("class %c (%d)\n", c, c);
+    switch (c) {
+    case '\000':
+msg("[Error]");
+	w->tmpShift = 0;
+	w->puncShift = 0;
+	w->ctrlShift = 0;
+	ShowMode (w);
+	break;
+    case 'L': /* caps lock */
+msg("[Capslock]");
+	w->capsLock = !w->capsLock;
+	ShowMode (w);
+	break;
+    case 'N': /* numlock */
+	if (w->curCharSet == CS_DIGITS) {
+	    w->curCharSet = CS_LETTERS;
+msg("[Letters]");
+	} else {
+	    w->curCharSet = CS_DIGITS;
+msg("[Digits]");
+	}
+	w->tmpShift = 0;
+	w->puncShift = 0;
+	w->ctrlShift = 0;
+	ShowMode (w);
+	break;
+    case 'P': /* usually puncshift, but we'll make it CTRL */
+msg("[Ctrlshift]");
+	w->ctrlShift = !w->ctrlShift;
+	w->tmpShift = 0;
+	w->puncShift = 0;
+	ShowMode (w);
+	break;
+    case 'S': /* shift */
+	w->tmpShift = !w->tmpShift;
+if (w->tmpShift) msg("[Shift]"); else msg("[Unshift]");
+	w->puncShift = 0;
+	w->ctrlShift = 0;
+	ShowMode (w);
+	break;
+    default:
+	control = GR_FALSE;
+	switch (c) {
+	case 'A':
+msg("[Space]");
+	    keysym = ' ';
+	    break;
+	case 'B':
+msg("[Backspace]");
+	    keysym = '\b';
+	    break;
+	case 'R':
+msg("[Return]");
+	    keysym = '\r';
+	    break;
+	case '.':
+	    if (! w->puncShift) {
+msg("[Puncshift]");
+		w->puncShift = 1;
+		w->ctrlShift = 0;
+		w->tmpShift = 0;
+		ShowMode (w);
+		return;
+	    } else {
+		w->puncShift = 0;
+		ShowMode (w);
+	    }		  	
+	    keysym = '.';
+	    break;
+	default:
+	    if ('A' <= c && c <= 'Z') {
+msg("[Notimp]");
+		ShowMode (w);
+		return;
+	    }
+	    keysym = (KeySym) c;
+	    if (w->ctrlShift) 
+	    {
+		control = GR_TRUE;
+		w->ctrlShift = 0;
+		if (c < 'a' || 'z' < c)
+		{
+		    ShowMode (w);
+		    return;
+		}
+	    } 
+	    else if ((w->capsLock && !w->tmpShift) || 
+		     (!w->capsLock && w->tmpShift)) 
+	    {
+		keysym = keysym-'a'+'A';
+	    } 
+	    w->tmpShift = 0;
+	    w->puncShift = 0;
+	    ShowMode(w);
+	}
+	
+	if (control)
+		keysym &= 0x1f;
+	w->lastchar = keysym;
+	ShowMode(w);
+	SendKey(w, keysym);
+	break;
+    }
+}
diff -urN lib/microwindows/src/demos/nxscribble/util.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/util.c
--- lib/microwindows/src/demos/nxscribble/util.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/util.c	2005-02-21 16:13:02.000000000 +0100
@@ -0,0 +1,124 @@
+/***********************************************************************
+
+util.c - memory allocation, error reporting, and other mundane stuff
+
+Copyright (C) 1991 Dean Rubine
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License. See ../COPYING for
+the full agreement.
+
+**********************************************************************/
+/*
+ * Mundane utility routines
+ *	see util.h
+ */
+
+/*LINTLIBRARY*/
+
+#include "util.h"
+#include <stdio.h>
+#include <ctype.h>
+#include <setjmp.h>
+/* ari -- for strlen */
+#include <string.h>
+
+extern char* li_err_msg;
+static char err_msg[BUFSIZ];
+
+/*
+ * Function used by allocation macro
+ */
+
+char *
+myalloc(nitems, itemsize, typename)
+char *typename;
+{
+	register unsigned int bytes = nitems * itemsize;
+	register char *p = malloc(bytes);
+	if(p == NULL)
+	     error("Can't get mem for %d %s's (each %d bytes, %d total bytes)",
+		nitems, typename, itemsize, bytes);
+	return p;
+}
+
+/*
+ * Return a copy of a string
+ */
+
+char *
+scopy(s)
+char *s;
+{
+	register char *p = allocate(strlen(s) + 1, char);
+	//char *strcpy();
+	(void) strcpy(p, s);
+	return p;
+}
+
+/*
+ * Save error message, then return to recognition manager.
+ */
+
+/*VARARGS1*/
+void
+error(a, b, c, d, e, f, g, h, i, j)
+char *a;
+{
+	sprintf(err_msg, a, b, c, d, e, f, g, h, i, j);
+	li_err_msg = err_msg;
+}
+
+/*
+ * Print error message, exit.
+*/
+
+
+/*VARARGS1*/
+void
+  exit_error(a, b, c, d, e, f, g, h, i, j)
+char *a;
+{
+	fprintf(stderr, a, b, c, d, e, f, g, h, i, j);
+	exit(1);
+}
+
+
+/*
+ * print a message if DebugFlag is non-zero
+ */
+
+int	DebugFlag = 1;
+
+void
+debug(a, b, c, d, e, f, g)
+char *a;
+{
+	if(DebugFlag)
+		fprintf(stderr, a, b, c, d, e, f, g);
+}
+
+#define	upper(c)	(islower(c) ? toupper(c) : (c))
+
+int
+ucstrcmp(s1, s2)
+register char *s1, *s2;
+{
+	register int i;
+
+	for(; *s1 && *s2; s1++, s2++)
+		if( (i = (upper(*s1) - upper(*s2))) != 0)
+			return i;
+	return (upper(*s1) - upper(*s2));
+}
+
+#define NSTRINGS 3
+
+char *
+tempstring()
+{
+	static char strings[NSTRINGS][100];
+	static int index;
+	if(index >= NSTRINGS) index = 0;
+	return strings[index++];
+}
diff -urN lib/microwindows/src/demos/nxscribble/util.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/util.h
--- lib/microwindows/src/demos/nxscribble/util.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/util.h	2005-02-21 16:13:02.000000000 +0100
@@ -0,0 +1,64 @@
+/***********************************************************************
+
+util.h - memory allocation, error reporting, and other mundane stuff
+
+Copyright (C) 1991 Dean Rubine
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License. See ../COPYING for
+the full agreement.
+
+**********************************************************************/
+
+/*
+ * General utility functionss
+ *
+ * Mostly for dealing with mundane issues such as:
+ *	Memory allocation
+ *	Error handling
+ */
+
+/*
+ * General allocation macro
+ *
+ * Example:
+ *	struct list *s; s = allocate(4, struct list)
+ * returns space for an array of 4 list structures.
+ * Allocate will die if there is no more memory
+ */
+
+#define	allocate(n, type)	\
+	((type *) myalloc(n, sizeof(type), "type"))
+
+/*
+ * Functions
+ */
+
+#define	STREQ(a,b)	( ! strcmp(a,b) )
+
+char	*myalloc();	/* Do not call this function directly */
+char	*scopy();	/* allocates memory for a string */
+void	debug();	/* printf on stderr -
+			   setting DebugFlag = 0 turns off debugging */
+void	error();	/* printf on stderr, then dies */
+int	ucstrcmp();	/* strcmp, upper case = lower case */
+char	*tempstring();	/* returns a pointer to space that will reused soon */
+
+/*
+   this is the wrong place for all of this, but got chosen since
+   every file includes this one
+ */
+
+#ifdef unix
+#	define GRAPHICS		/* only GDEV on unix machines */
+#endif
+
+#ifndef unix
+
+/* various BSD to lattice C name changes */
+
+#define	bcopy	movmem
+#define index	strchr
+#define	rindex	strrchr
+
+#endif
diff -urN lib/microwindows/src/demos/nxscribble/zdebug.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/zdebug.h
--- lib/microwindows/src/demos/nxscribble/zdebug.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/nxscribble/zdebug.h	2005-02-21 16:03:05.000000000 +0100
@@ -0,0 +1,20 @@
+/***********************************************************************
+
+zdebug.h - macros for debugging
+
+Copyright (C) 1991 Dean Rubine
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License. See ../COPYING for
+the full agreement.
+
+**********************************************************************/
+
+extern char _zdebug_flag[];
+
+#define Z(f) if(_zdebug_flag[f] > 0)
+#define ZZ(f) if(_zdebug_flag[f] >= 2)
+#define ZZZ(f) if(_zdebug_flag[f] >= 3)
+#define ZZZZ(f) if(_zdebug_flag[f] >= 4)
+
+extern double kludge[];
diff -urN lib/microwindows/src/demos/test/test.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/test/test.c
--- lib/microwindows/src/demos/test/test.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/test/test.c	2005-02-21 16:03:05.000000000 +0100
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Test for select()
+ */
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef __PACIFIC__
+#include <errno.h>
+#include <sys/types.h>
+#endif
+
+#if UNIX
+#include <unistd.h>
+#include <sys/time.h>
+#endif
+#if ELKS
+#include <linuxmt/posix_types.h>
+#include <linuxmt/time.h>
+#endif
+#include "windows.h"
+#include "wintern.h"
+
+int		keyb_fd;		/* the keyboard file descriptor */
+int		mouse_fd;		/* the mouse file descriptor */
+
+int
+main(int ac,char **av)
+{
+	if ((keyb_fd = GdOpenKeyboard()) < 0) {
+		PRINT_ERROR("Cannot initialise keyboard");
+		return -1;
+	}
+
+	if ((mouse_fd = GdOpenMouse()) < 0) {
+		PRINT_ERROR("Cannot initialise mouse");
+		GdCloseKeyboard();
+		return -1;
+	}
+
+	for(;;)
+		GsSelect();
+
+	return 0;
+}
+
+void
+GsTerminate(void)
+{
+	GdCloseMouse();
+	GdCloseKeyboard();
+	exit(0);
+}
+
+#if MSDOS
+void
+GsSelect(void)
+{
+	/* If mouse data present, service it*/
+	if(mousedev.Poll())
+		GsCheckMouseEvent();
+
+	/* If keyboard data present, service it*/
+	if(kbddev.Poll())
+		GsCheckKeyboardEvent();
+
+}
+#endif
+
+#if UNIX && defined(HAVESELECT)
+void
+GsSelect(void)
+{
+	fd_set	rfds;
+	int 	e;
+	struct timeval to;
+	int	n;
+
+	/* Set up the FDs for use in the main select(): */
+	FD_ZERO(&rfds);
+	FD_SET(mouse_fd, &rfds);
+	n = mouse_fd;
+	FD_SET(keyb_fd, &rfds);
+	if(keyb_fd > n)
+		n = keyb_fd;
+
+	/* Set up the timeout for the main select().  If
+	 * the mouse is captured we're probably moving a window,
+	 * so poll quickly to allow other windows to repaint while
+	 * checking for more event input.
+	 */
+	to.tv_sec = 0L;
+to.tv_sec = 1L;
+	to.tv_usec = 0L;
+to.tv_usec = 10000L;
+
+	/* Wait for some input on any of the fds in the set or a timeout: */
+	if((e = select(n+1, &rfds, NULL, NULL, &to)) > 0) {
+		
+		/* If data is present on the mouse fd, service it: */
+		if(FD_ISSET(mouse_fd, &rfds))
+			GsCheckMouseEvent();
+
+		/* If data is present on the keyboard fd, service it: */
+		if(FD_ISSET(keyb_fd, &rfds))
+			GsCheckKeyboardEvent();
+
+	} 
+	else if(!e) {
+		printf("select() timeout\n");
+	} else
+		if(errno != EINTR)
+			PRINT_ERROR("Select() call in main failed");
+}
+#endif
+
+/*
+ * Update mouse status and issue events on it if necessary.
+ * This function doesn't block, but is normally only called when
+ * there is known to be some data waiting to be read from the mouse.
+ */
+BOOL GsCheckMouseEvent(void)
+{
+	COORD		rootx;		/* latest mouse x position */
+	COORD		rooty;		/* latest mouse y position */
+	BUTTON		newbuttons;	/* latest buttons */
+	int		mousestatus;	/* latest mouse status */
+
+	/* Read the latest mouse status: */
+	mousestatus = GdReadMouse(&rootx, &rooty, &newbuttons);
+	if(mousestatus < 0) {
+		printf("Mouse error\n");
+		return FALSE;
+	} else if(mousestatus) { /* Deliver events as appropriate: */	
+		printf("mouse %d,%d,%d\n", rootx, rooty, newbuttons);
+      return TRUE;
+   }
+   return FALSE;
+}
+
+/*
+ * Update keyboard status and issue events on it if necessary.
+ * This function doesn't block, but is normally only called when
+ * there is known to be some data waiting to be read from the keyboard.
+ */
+BOOL GsCheckKeyboardEvent(void)
+{
+	unsigned char	ch;		/* latest character */
+	MODIFIER	modifiers;	/* latest modifiers */
+	int		keystatus;	/* latest keyboard status */
+
+	/* Read the latest keyboard status: */
+	keystatus = GdReadKeyboard(&ch, &modifiers);
+	if(keystatus < 0) {
+		if(keystatus == -2)	/* special case for ESC pressed*/
+			GsTerminate();
+		printf("Kbd error\n");
+		return FALSE;
+	} else if(keystatus) { /* Deliver events as appropriate: */	
+		printf("kbd '%c',%d\n", ch, modifiers);
+      return TRUE;
+   }
+   return FALSE;
+}
diff -urN lib/microwindows/src/demos/vnc/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/Makefile
--- lib/microwindows/src/demos/vnc/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/Makefile	2005-02-21 16:03:07.000000000 +0100
@@ -0,0 +1,40 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+ifndef TOP
+TOP = ../..
+CONFIG = $(TOP)/config
+endif
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME =
+
+# List of objects to compile
+OBJS =
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
diff -urN lib/microwindows/src/demos/vnc/README-nanox /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/README-nanox
--- lib/microwindows/src/demos/vnc/README-nanox	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/README-nanox	2005-02-21 16:03:08.000000000 +0100
@@ -0,0 +1,62 @@
+               README for the nano-X VNC viewer
+
+What is VNC ?
+-------------
+VNC is Virtual Network Computing, you have a 'viewer' running on one
+machine which allows you to control the desktop of a different
+machine via the VNC 'server'. The design allows the viewer and server
+to run on different hardware and different operating systems yet
+still work together. What this means in practice is that you can have
+a Windoze desktop in a window on your X display or vice-versa.
+The viewer has also been designed to be small and portable so it
+seemed like a good candidate for a nano-X application.
+
+More info, source and binaries can be found at:
+
+    http://www.uk.research.att.com/vnc/
+
+
+Status of the nano-X port
+-------------------------
+The nano-X port is based on the VNC viewer for X, version 3.3.2.
+This is the 2nd work-in-progress release, the main differences
+from the previous release are:
+
++ Now uses GrSetSystemPalette() to handle 8-bit palette displays.
++ Builds for Microwindows 0.88pre8.
+
+The features / limitations of this release are:
+
++ Compiled with Microwindows version 0.88pre8
++ Viewer tested on uClinux running on an Isicad Prisma 700
+  workstation with the serial mouse driver, the tty keyboard driver
+  and my own screen driver. The Prisma has a 1280 x 1024, 256 colour
+  display but it is not accessible as a frame buffer so needs a 
+  custom microwindows screen driver.
++ Also tested with the X11 screen driver on Slackware Linux.
++ Tested with VNC servers running on NetBSD-Amiga and Slackware
+  Linux.
++ Only tested with an 8-bit palette display.
++ Keyboard handling is working but only for simple ASCII text, no
+  shift-clicking.
++ Mouse seems to work OK.
++ No way to scroll the screen if the viewer window is smaller than 
+  the server's screen.
++ Runs very slowly on the Prisma, most likely due to the Prisma's
+  weird graphics interface.
+
+Installation
+------------
+The tarball is intended to be unpacked in the src/demos subdirectory
+of the Microwindows distribution. The makefiles have been adapted
+from those used by the rest of the demo programs so it should build
+from the top level 'make'. The resulting binary will appear as
+src/bin/vnc. You will need a network connection to a VNC server
+to do anything with it :-)
+
+
+George Harvey
+fr30@dial.pipex.com
+13th June 2000
+
+
diff -urN lib/microwindows/src/demos/vnc/include/rfbproto.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/include/rfbproto.h
--- lib/microwindows/src/demos/vnc/include/rfbproto.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/include/rfbproto.h	2005-02-21 16:03:05.000000000 +0100
@@ -0,0 +1,671 @@
+/*
+ *  Copyright (C) 1997, 1998 Olivetti & Oracle Research Laboratory
+ *
+ *  This is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This software is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this software; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ *  USA.
+ */
+
+/*
+ * rfbproto.h - header file for the RFB protocol version 3.3
+ *
+ * Uses types CARD<n> for an n-bit unsigned integer, INT<n> for an n-bit signed
+ * integer (for n = 8, 16 and 32).
+ *
+ * All multiple byte integers are in big endian (network) order (most
+ * significant byte first).  Unless noted otherwise there is no special
+ * alignment of protocol structures.
+ *
+ *
+ * Once the initial handshaking is done, all messages start with a type byte,
+ * (usually) followed by message-specific data.  The order of definitions in
+ * this file is as follows:
+ *
+ *  (1) Structures used in several types of message.
+ *  (2) Structures used in the initial handshaking.
+ *  (3) Message types.
+ *  (4) Encoding types.
+ *  (5) For each message type, the form of the data following the type byte.
+ *      Sometimes this is defined by a single structure but the more complex
+ *      messages have to be explained by comments.
+ */
+
+
+/*****************************************************************************
+ *
+ * Structures used in several messages
+ *
+ *****************************************************************************/
+
+/*-----------------------------------------------------------------------------
+ * Structure used to specify a rectangle.  This structure is a multiple of 4
+ * bytes so that it can be interspersed with 32-bit pixel data without
+ * affecting alignment.
+ */
+
+typedef struct {
+    CARD16 x;
+    CARD16 y;
+    CARD16 w;
+    CARD16 h;
+} rfbRectangle;
+
+#define sz_rfbRectangle 8
+
+
+/*-----------------------------------------------------------------------------
+ * Structure used to specify pixel format.
+ */
+
+typedef struct {
+
+    CARD8 bitsPerPixel;		/* 8,16,32 only */
+
+    CARD8 depth;		/* 8 to 32 */
+
+    CARD8 bigEndian;		/* True if multi-byte pixels are interpreted
+				   as big endian, or if single-bit-per-pixel
+				   has most significant bit of the byte
+				   corresponding to first (leftmost) pixel. Of
+				   course this is meaningless for 8 bits/pix */
+
+    CARD8 trueColour;		/* If false then we need a "colour map" to
+				   convert pixels to RGB.  If true, xxxMax and
+				   xxxShift specify bits used for red, green
+				   and blue */
+
+    /* the following fields are only meaningful if trueColour is true */
+
+    CARD16 redMax;		/* maximum red value (= 2^n - 1 where n is the
+				   number of bits used for red). Note this
+				   value is always in big endian order. */
+
+    CARD16 greenMax;		/* similar for green */
+
+    CARD16 blueMax;		/* and blue */
+
+    CARD8 redShift;		/* number of shifts needed to get the red
+				   value in a pixel to the least significant
+				   bit. To find the red value from a given
+				   pixel, do the following:
+				   1) Swap pixel value according to bigEndian
+				      (e.g. if bigEndian is false and host byte
+				      order is big endian, then swap).
+				   2) Shift right by redShift.
+				   3) AND with redMax (in host byte order).
+				   4) You now have the red value between 0 and
+				      redMax. */
+
+    CARD8 greenShift;		/* similar for green */
+
+    CARD8 blueShift;		/* and blue */
+
+    CARD8 pad1;
+    CARD16 pad2;
+
+} rfbPixelFormat;
+
+#define sz_rfbPixelFormat 16
+
+
+
+/*****************************************************************************
+ *
+ * Initial handshaking messages
+ *
+ *****************************************************************************/
+
+/*-----------------------------------------------------------------------------
+ * Protocol Version
+ *
+ * The server always sends 12 bytes to start which identifies the latest RFB
+ * protocol version number which it supports.  These bytes are interpreted
+ * as a string of 12 ASCII characters in the format "RFB xxx.yyy\n" where
+ * xxx and yyy are the major and minor version numbers (for version 3.3
+ * this is "RFB 003.003\n").
+ *
+ * The client then replies with a similar 12-byte message giving the version
+ * number of the protocol which should actually be used (which may be different
+ * to that quoted by the server).
+ *
+ * It is intended that both clients and servers may provide some level of
+ * backwards compatibility by this mechanism.  Servers in particular should
+ * attempt to provide backwards compatibility, and even forwards compatibility
+ * to some extent.  For example if a client demands version 3.1 of the
+ * protocol, a 3.0 server can probably assume that by ignoring requests for
+ * encoding types it doesn't understand, everything will still work OK.  This
+ * will probably not be the case for changes in the major version number.
+ *
+ * The format string below can be used in sprintf or sscanf to generate or
+ * decode the version string respectively.
+ */
+
+#define rfbProtocolVersionFormat "RFB %03d.%03d\n"
+#define rfbProtocolMajorVersion 3
+#define rfbProtocolMinorVersion 3
+
+typedef char rfbProtocolVersionMsg[13];	/* allow extra byte for null */
+
+#define sz_rfbProtocolVersionMsg 12
+
+
+/*-----------------------------------------------------------------------------
+ * Authentication
+ *
+ * Once the protocol version has been decided, the server then sends a 32-bit
+ * word indicating whether any authentication is needed on the connection.
+ * The value of this word determines the authentication scheme in use.  For
+ * version 3.0 of the protocol this may have one of the following values:
+ */
+
+#define rfbConnFailed 0
+#define rfbNoAuth 1
+#define rfbVncAuth 2
+
+/*
+ * rfbConnFailed:	For some reason the connection failed (e.g. the server
+ *			cannot support the desired protocol version).  This is
+ *			followed by a string describing the reason (where a
+ *			string is specified as a 32-bit length followed by that
+ *			many ASCII characters).
+ *
+ * rfbNoAuth:		No authentication is needed.
+ *
+ * rfbVncAuth:		The VNC authentication scheme is to be used.  A 16-byte
+ *			challenge follows, which the client encrypts as
+ *			appropriate using the password and sends the resulting
+ *			16-byte response.  If the response is correct, the
+ *			server sends the 32-bit word rfbVncAuthOK.  If a simple
+ *			failure happens, the server sends rfbVncAuthFailed and
+ *			closes the connection. If the server decides that too
+ *			many failures have occurred, it sends rfbVncAuthTooMany
+ *			and closes the connection.  In the latter case, the
+ *			server should not allow an immediate reconnection by
+ *			the client.
+ */
+
+#define rfbVncAuthOK 0
+#define rfbVncAuthFailed 1
+#define rfbVncAuthTooMany 2
+
+
+/*-----------------------------------------------------------------------------
+ * Client Initialisation Message
+ *
+ * Once the client and server are sure that they're happy to talk to one
+ * another, the client sends an initialisation message.  At present this
+ * message only consists of a boolean indicating whether the server should try
+ * to share the desktop by leaving other clients connected, or give exclusive
+ * access to this client by disconnecting all other clients.
+ */
+
+typedef struct {
+    CARD8 shared;
+} rfbClientInitMsg;
+
+#define sz_rfbClientInitMsg 1
+
+
+/*-----------------------------------------------------------------------------
+ * Server Initialisation Message
+ *
+ * After the client initialisation message, the server sends one of its own.
+ * This tells the client the width and height of the server's framebuffer,
+ * its pixel format and the name associated with the desktop.
+ */
+
+typedef struct {
+    CARD16 framebufferWidth;
+    CARD16 framebufferHeight;
+    rfbPixelFormat format;	/* the server's preferred pixel format */
+    CARD32 nameLength;
+    /* followed by char name[nameLength] */
+} rfbServerInitMsg;
+
+#define sz_rfbServerInitMsg (8 + sz_rfbPixelFormat)
+
+
+/*
+ * Following the server initialisation message it's up to the client to send
+ * whichever protocol messages it wants.  Typically it will send a
+ * SetPixelFormat message and a SetEncodings message, followed by a
+ * FramebufferUpdateRequest.  From then on the server will send
+ * FramebufferUpdate messages in response to the client's
+ * FramebufferUpdateRequest messages.  The client should send
+ * FramebufferUpdateRequest messages with incremental set to true when it has
+ * finished processing one FramebufferUpdate and is ready to process another.
+ * With a fast client, the rate at which FramebufferUpdateRequests are sent
+ * should be regulated to avoid hogging the network.
+ */
+
+
+
+/*****************************************************************************
+ *
+ * Message types
+ *
+ *****************************************************************************/
+
+/* server -> client */
+
+#define rfbFramebufferUpdate 0
+#define rfbSetColourMapEntries 1
+#define rfbBell 2
+#define rfbServerCutText 3
+
+
+/* client -> server */
+
+#define rfbSetPixelFormat 0
+#define rfbFixColourMapEntries 1	/* not currently supported */
+#define rfbSetEncodings 2
+#define rfbFramebufferUpdateRequest 3
+#define rfbKeyEvent 4
+#define rfbPointerEvent 5
+#define rfbClientCutText 6
+
+
+
+
+/*****************************************************************************
+ *
+ * Encoding types
+ *
+ *****************************************************************************/
+
+#define rfbEncodingRaw 0
+#define rfbEncodingCopyRect 1
+#define rfbEncodingRRE 2
+#define rfbEncodingCoRRE 4
+#define rfbEncodingHextile 5
+
+
+
+/*****************************************************************************
+ *
+ * Server -> client message definitions
+ *
+ *****************************************************************************/
+
+
+/*-----------------------------------------------------------------------------
+ * FramebufferUpdate - a block of rectangles to be copied to the framebuffer.
+ *
+ * This message consists of a header giving the number of rectangles of pixel
+ * data followed by the rectangles themselves.  The header is padded so that
+ * together with the type byte it is an exact multiple of 4 bytes (to help
+ * with alignment of 32-bit pixels):
+ */
+
+typedef struct {
+    CARD8 type;			/* always rfbFramebufferUpdate */
+    CARD8 pad;
+    CARD16 nRects;
+    /* followed by nRects rectangles */
+} rfbFramebufferUpdateMsg;
+
+#define sz_rfbFramebufferUpdateMsg 4
+
+/*
+ * Each rectangle of pixel data consists of a header describing the position
+ * and size of the rectangle and a type word describing the encoding of the
+ * pixel data, followed finally by the pixel data.  Note that if the client has
+ * not sent a SetEncodings message then it will only receive raw pixel data.
+ * Also note again that this structure is a multiple of 4 bytes.
+ */
+
+typedef struct {
+    rfbRectangle r;
+    CARD32 encoding;	/* one of the encoding types rfbEncoding... */
+} rfbFramebufferUpdateRectHeader;
+
+#define sz_rfbFramebufferUpdateRectHeader (sz_rfbRectangle + 4)
+
+
+/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Raw Encoding.  Pixels are sent in top-to-bottom scanline order,
+ * left-to-right within a scanline with no padding in between.
+ */
+
+
+/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * CopyRect Encoding.  The pixels are specified simply by the x and y position
+ * of the source rectangle.
+ */
+
+typedef struct {
+    CARD16 srcX;
+    CARD16 srcY;
+} rfbCopyRect;
+
+#define sz_rfbCopyRect 4
+
+
+/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * RRE - Rise-and-Run-length Encoding.  We have an rfbRREHeader structure
+ * giving the number of subrectangles following.  Finally the data follows in
+ * the form [<bgpixel><subrect><subrect>...] where each <subrect> is
+ * [<pixel><rfbRectangle>].
+ */
+
+typedef struct {
+    CARD32 nSubrects;
+} rfbRREHeader;
+
+#define sz_rfbRREHeader 4
+
+
+/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * CoRRE - Compact RRE Encoding.  We have an rfbRREHeader structure giving
+ * the number of subrectangles following.  Finally the data follows in the form
+ * [<bgpixel><subrect><subrect>...] where each <subrect> is
+ * [<pixel><rfbCoRRERectangle>].  This means that
+ * the whole rectangle must be at most 255x255 pixels.
+ */
+
+typedef struct {
+    CARD8 x;
+    CARD8 y;
+    CARD8 w;
+    CARD8 h;
+} rfbCoRRERectangle;
+
+#define sz_rfbCoRRERectangle 4
+
+
+/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Hextile Encoding.  The rectangle is divided up into "tiles" of 16x16 pixels,
+ * starting at the top left going in left-to-right, top-to-bottom order.  If
+ * the width of the rectangle is not an exact multiple of 16 then the width of
+ * the last tile in each row will be correspondingly smaller.  Similarly if the
+ * height is not an exact multiple of 16 then the height of each tile in the
+ * final row will also be smaller.  Each tile begins with a "subencoding" type
+ * byte, which is a mask made up of a number of bits.  If the Raw bit is set
+ * then the other bits are irrelevant; w*h pixel values follow (where w and h
+ * are the width and height of the tile).  Otherwise the tile is encoded in a
+ * similar way to RRE, except that the position and size of each subrectangle
+ * can be specified in just two bytes.  The other bits in the mask are as
+ * follows:
+ *
+ * BackgroundSpecified - if set, a pixel value follows which specifies
+ *    the background colour for this tile.  The first non-raw tile in a
+ *    rectangle must have this bit set.  If this bit isn't set then the
+ *    background is the same as the last tile.
+ *
+ * ForegroundSpecified - if set, a pixel value follows which specifies
+ *    the foreground colour to be used for all subrectangles in this tile.
+ *    If this bit is set then the SubrectsColoured bit must be zero.
+ *
+ * AnySubrects - if set, a single byte follows giving the number of
+ *    subrectangles following.  If not set, there are no subrectangles (i.e.
+ *    the whole tile is just solid background colour).
+ *
+ * SubrectsColoured - if set then each subrectangle is preceded by a pixel
+ *    value giving the colour of that subrectangle.  If not set, all
+ *    subrectangles are the same colour, the foreground colour;  if the
+ *    ForegroundSpecified bit wasn't set then the foreground is the same as
+ *    the last tile.
+ *
+ * The position and size of each subrectangle is specified in two bytes.  The
+ * Pack macros below can be used to generate the two bytes from x, y, w, h,
+ * and the Extract macros can be used to extract the x, y, w, h values from
+ * the two bytes.
+ */
+
+#define rfbHextileRaw			(1 << 0)
+#define rfbHextileBackgroundSpecified	(1 << 1)
+#define rfbHextileForegroundSpecified	(1 << 2)
+#define rfbHextileAnySubrects		(1 << 3)
+#define rfbHextileSubrectsColoured	(1 << 4)
+
+#define rfbHextilePackXY(x,y) (((x) << 4) | (y))
+#define rfbHextilePackWH(w,h) ((((w)-1) << 4) | ((h)-1))
+#define rfbHextileExtractX(byte) ((byte) >> 4)
+#define rfbHextileExtractY(byte) ((byte) & 0xf)
+#define rfbHextileExtractW(byte) (((byte) >> 4) + 1)
+#define rfbHextileExtractH(byte) (((byte) & 0xf) + 1)
+
+
+/*-----------------------------------------------------------------------------
+ * SetColourMapEntries - these messages are only sent if the pixel
+ * format uses a "colour map" (i.e. trueColour false) and the client has not
+ * fixed the entire colour map using FixColourMapEntries.  In addition they
+ * will only start being sent after the client has sent its first
+ * FramebufferUpdateRequest.  So if the client always tells the server to use
+ * trueColour then it never needs to process this type of message.
+ */
+
+typedef struct {
+    CARD8 type;			/* always rfbSetColourMapEntries */
+    CARD8 pad;
+    CARD16 firstColour;
+    CARD16 nColours;
+
+    /* Followed by nColours * 3 * CARD16
+       r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */
+
+} rfbSetColourMapEntriesMsg;
+
+#define sz_rfbSetColourMapEntriesMsg 6
+
+
+
+/*-----------------------------------------------------------------------------
+ * Bell - ring a bell on the client if it has one.
+ */
+
+typedef struct {
+    CARD8 type;			/* always rfbBell */
+} rfbBellMsg;
+
+#define sz_rfbBellMsg 1
+
+
+
+/*-----------------------------------------------------------------------------
+ * ServerCutText - the server has new text in its cut buffer.
+ */
+
+typedef struct {
+    CARD8 type;			/* always rfbServerCutText */
+    CARD8 pad1;
+    CARD16 pad2;
+    CARD32 length;
+    /* followed by char text[length] */
+} rfbServerCutTextMsg;
+
+#define sz_rfbServerCutTextMsg 8
+
+
+/*-----------------------------------------------------------------------------
+ * Union of all server->client messages.
+ */
+
+typedef union {
+    CARD8 type;
+    rfbFramebufferUpdateMsg fu;
+    rfbSetColourMapEntriesMsg scme;
+    rfbBellMsg b;
+    rfbServerCutTextMsg sct;
+} rfbServerToClientMsg;
+
+
+
+/*****************************************************************************
+ *
+ * Message definitions (client -> server)
+ *
+ *****************************************************************************/
+
+
+/*-----------------------------------------------------------------------------
+ * SetPixelFormat - tell the RFB server the format in which the client wants
+ * pixels sent.
+ */
+
+typedef struct {
+    CARD8 type;			/* always rfbSetPixelFormat */
+    CARD8 pad1;
+    CARD16 pad2;
+    rfbPixelFormat format;
+} rfbSetPixelFormatMsg;
+
+#define sz_rfbSetPixelFormatMsg (sz_rfbPixelFormat + 4)
+
+
+/*-----------------------------------------------------------------------------
+ * FixColourMapEntries - when the pixel format uses a "colour map", fix
+ * read-only colour map entries.
+ *
+ *    ***************** NOT CURRENTLY SUPPORTED *****************
+ */
+
+typedef struct {
+    CARD8 type;			/* always rfbFixColourMapEntries */
+    CARD8 pad;
+    CARD16 firstColour;
+    CARD16 nColours;
+
+    /* Followed by nColours * 3 * CARD16
+       r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */
+
+} rfbFixColourMapEntriesMsg;
+
+#define sz_rfbFixColourMapEntriesMsg 6
+
+
+/*-----------------------------------------------------------------------------
+ * SetEncodings - tell the RFB server which encoding types we accept.  Put them
+ * in order of preference, if we have any.  We may always receive raw
+ * encoding, even if we don't specify it here.
+ */
+
+typedef struct {
+    CARD8 type;			/* always rfbSetEncodings */
+    CARD8 pad;
+    CARD16 nEncodings;
+    /* followed by nEncodings * CARD32 encoding types */
+} rfbSetEncodingsMsg;
+
+#define sz_rfbSetEncodingsMsg 4
+
+
+/*-----------------------------------------------------------------------------
+ * FramebufferUpdateRequest - request for a framebuffer update.  If incremental
+ * is true then the client just wants the changes since the last update.  If
+ * false then it wants the whole of the specified rectangle.
+ */
+
+typedef struct {
+    CARD8 type;			/* always rfbFramebufferUpdateRequest */
+    CARD8 incremental;
+    CARD16 x;
+    CARD16 y;
+    CARD16 w;
+    CARD16 h;
+} rfbFramebufferUpdateRequestMsg;
+
+#define sz_rfbFramebufferUpdateRequestMsg 10
+
+
+/*-----------------------------------------------------------------------------
+ * KeyEvent - key press or release
+ *
+ * Keys are specified using the "keysym" values defined by the X Window System.
+ * For most ordinary keys, the keysym is the same as the corresponding ASCII
+ * value.  Other common keys are:
+ *
+ * BackSpace		0xff08
+ * Tab			0xff09
+ * Return or Enter	0xff0d
+ * Escape		0xff1b
+ * Insert		0xff63
+ * Delete		0xffff
+ * Home			0xff50
+ * End			0xff57
+ * Page Up		0xff55
+ * Page Down		0xff56
+ * Left			0xff51
+ * Up			0xff52
+ * Right		0xff53
+ * Down			0xff54
+ * F1			0xffbe
+ * F2			0xffbf
+ * ...			...
+ * F12			0xffc9
+ * Shift		0xffe1
+ * Control		0xffe3
+ * Meta			0xffe7
+ * Alt			0xffe9
+ */
+
+typedef struct {
+    CARD8 type;			/* always rfbKeyEvent */
+    CARD8 down;			/* true if down (press), false if up */
+    CARD16 pad;
+    CARD32 key;			/* key is specified as an X keysym */
+} rfbKeyEventMsg;
+
+#define sz_rfbKeyEventMsg 8
+
+
+/*-----------------------------------------------------------------------------
+ * PointerEvent - mouse/pen move and/or button press.
+ */
+
+typedef struct {
+    CARD8 type;			/* always rfbPointerEvent */
+    CARD8 buttonMask;		/* bits 0-7 are buttons 1-8, 0=up, 1=down */
+    CARD16 x;
+    CARD16 y;
+} rfbPointerEventMsg;
+
+#define rfbButton1Mask 1
+#define rfbButton2Mask 2
+#define rfbButton3Mask 4
+
+#define sz_rfbPointerEventMsg 6
+
+
+
+/*-----------------------------------------------------------------------------
+ * ClientCutText - the client has new text in its cut buffer.
+ */
+
+typedef struct {
+    CARD8 type;			/* always rfbClientCutText */
+    CARD8 pad1;
+    CARD16 pad2;
+    CARD32 length;
+    /* followed by char text[length] */
+} rfbClientCutTextMsg;
+
+#define sz_rfbClientCutTextMsg 8
+
+
+
+/*-----------------------------------------------------------------------------
+ * Union of all client->server messages.
+ */
+
+typedef union {
+    CARD8 type;
+    rfbSetPixelFormatMsg spf;
+    rfbFixColourMapEntriesMsg fcme;
+    rfbSetEncodingsMsg se;
+    rfbFramebufferUpdateRequestMsg fur;
+    rfbKeyEventMsg ke;
+    rfbPointerEventMsg pe;
+    rfbClientCutTextMsg cct;
+} rfbClientToServerMsg;
diff -urN lib/microwindows/src/demos/vnc/include/vncauth.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/include/vncauth.h
--- lib/microwindows/src/demos/vnc/include/vncauth.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/include/vncauth.h	2005-02-21 16:03:06.000000000 +0100
@@ -0,0 +1,30 @@
+/*
+ *  Copyright (C) 1997, 1998 Olivetti & Oracle Research Laboratory
+ *
+ *  This is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This software is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this software; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ *  USA.
+ */
+
+/* 
+ * vncauth.h - describes the functions provided by the vncauth library.
+ */
+
+#define MAXPWLEN 8
+#define CHALLENGESIZE 16
+
+extern int vncEncryptAndStorePasswd(char *passwd, char *fname);
+extern char *vncDecryptPasswdFromFile(char *fname);
+extern void vncRandomBytes(unsigned char *bytes);
+extern void vncEncryptBytes(unsigned char *bytes, char *passwd);
diff -urN lib/microwindows/src/demos/vnc/libvncauth/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/libvncauth/Makefile
--- lib/microwindows/src/demos/vnc/libvncauth/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/libvncauth/Makefile	2005-02-21 16:03:06.000000000 +0100
@@ -0,0 +1,42 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS += -I../include
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(NANOX), Y)
+ifeq ($(NANOXDEMO), Y)
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME = libvncauth.a
+
+# List of objects to compile
+OBJS =	d3des.o \
+	vncauth.o
+	
+endif
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
diff -urN lib/microwindows/src/demos/vnc/libvncauth/d3des.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/libvncauth/d3des.c
--- lib/microwindows/src/demos/vnc/libvncauth/d3des.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/libvncauth/d3des.c	2005-02-21 16:13:02.000000000 +0100
@@ -0,0 +1,439 @@
+/*
+ * This is D3DES (V5.09) by Richard Outerbridge with the double and
+ * triple-length support removed for use in VNC.  Also the bytebit[] array
+ * has been reversed so that the most significant bit in each byte of the
+ * key is ignored, not the least significant.
+ *
+ * These changes are Copyright (C) 1998 Olivetti & Oracle Research Laboratory
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+/* D3DES (V5.09) -
+ *
+ * A portable, public domain, version of the Data Encryption Standard.
+ *
+ * Written with Symantec's THINK (Lightspeed) C by Richard Outerbridge.
+ * Thanks to: Dan Hoey for his excellent Initial and Inverse permutation
+ * code;  Jim Gillogly & Phil Karn for the DES key schedule code; Dennis
+ * Ferguson, Eric Young and Dana How for comparing notes; and Ray Lau,
+ * for humouring me on.
+ *
+ * Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge.
+ * (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992.
+ */
+
+#include "d3des.h"
+
+static void scrunch(unsigned char *, unsigned long *);
+static void unscrun(unsigned long *, unsigned char *);
+static void desfunc(unsigned long *, unsigned long *);
+static void cookey(unsigned long *);
+
+static unsigned long KnL[32] = { 0L };
+/*static unsigned long KnR[32] = { 0L };*/
+/*static unsigned long Kn3[32] = { 0L };*/
+/*static unsigned char Df_Key[24] = {
+	0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
+	0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
+	0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 };*/
+
+static unsigned short bytebit[8]	= {
+	01, 02, 04, 010, 020, 040, 0100, 0200 };
+
+static unsigned long bigbyte[24] = {
+	0x800000L,	0x400000L,	0x200000L,	0x100000L,
+	0x80000L,	0x40000L,	0x20000L,	0x10000L,
+	0x8000L,	0x4000L,	0x2000L,	0x1000L,
+	0x800L, 	0x400L, 	0x200L, 	0x100L,
+	0x80L,		0x40L,		0x20L,		0x10L,
+	0x8L,		0x4L,		0x2L,		0x1L	};
+
+/* Use the key schedule specified in the Standard (ANSI X3.92-1981). */
+
+static unsigned char pc1[56] = {
+	56, 48, 40, 32, 24, 16,  8,	 0, 57, 49, 41, 33, 25, 17,
+	 9,  1, 58, 50, 42, 34, 26,	18, 10,  2, 59, 51, 43, 35,
+	62, 54, 46, 38, 30, 22, 14,	 6, 61, 53, 45, 37, 29, 21,
+	13,  5, 60, 52, 44, 36, 28,	20, 12,  4, 27, 19, 11,  3 };
+
+static unsigned char totrot[16] = {
+	1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 };
+
+static unsigned char pc2[48] = {
+	13, 16, 10, 23,  0,  4,  2, 27, 14,  5, 20,  9,
+	22, 18, 11,  3, 25,  7, 15,  6, 26, 19, 12,  1,
+	40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,
+	43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 };
+
+void deskey(key, edf)	/* Thanks to James Gillogly & Phil Karn! */
+unsigned char *key;
+short edf;
+{
+	register int i, j, l, m, n;
+	unsigned char pc1m[56], pcr[56];
+	unsigned long kn[32];
+
+	for ( j = 0; j < 56; j++ ) {
+		l = pc1[j];
+		m = l & 07;
+		pc1m[j] = (key[l >> 3] & bytebit[m]) ? 1 : 0;
+		}
+	for( i = 0; i < 16; i++ ) {
+		if( edf == DE1 ) m = (15 - i) << 1;
+		else m = i << 1;
+		n = m + 1;
+		kn[m] = kn[n] = 0L;
+		for( j = 0; j < 28; j++ ) {
+			l = j + totrot[i];
+			if( l < 28 ) pcr[j] = pc1m[l];
+			else pcr[j] = pc1m[l - 28];
+			}
+		for( j = 28; j < 56; j++ ) {
+		    l = j + totrot[i];
+		    if( l < 56 ) pcr[j] = pc1m[l];
+		    else pcr[j] = pc1m[l - 28];
+		    }
+		for( j = 0; j < 24; j++ ) {
+			if( pcr[pc2[j]] ) kn[m] |= bigbyte[j];
+			if( pcr[pc2[j+24]] ) kn[n] |= bigbyte[j];
+			}
+		}
+	cookey(kn);
+	return;
+	}
+
+static void cookey(raw1)
+register unsigned long *raw1;
+{
+	register unsigned long *cook, *raw0;
+	unsigned long dough[32];
+	register int i;
+
+	cook = dough;
+	for( i = 0; i < 16; i++, raw1++ ) {
+		raw0 = raw1++;
+		*cook	 = (*raw0 & 0x00fc0000L) << 6;
+		*cook	|= (*raw0 & 0x00000fc0L) << 10;
+		*cook	|= (*raw1 & 0x00fc0000L) >> 10;
+		*cook++ |= (*raw1 & 0x00000fc0L) >> 6;
+		*cook	 = (*raw0 & 0x0003f000L) << 12;
+		*cook	|= (*raw0 & 0x0000003fL) << 16;
+		*cook	|= (*raw1 & 0x0003f000L) >> 4;
+		*cook++ |= (*raw1 & 0x0000003fL);
+		}
+	usekey(dough);
+	return;
+	}
+
+void cpkey(into)
+register unsigned long *into;
+{
+	register unsigned long *from, *endp;
+
+	from = KnL, endp = &KnL[32];
+	while( from < endp ) *into++ = *from++;
+	return;
+	}
+
+void usekey(from)
+register unsigned long *from;
+{
+	register unsigned long *to, *endp;
+
+	to = KnL, endp = &KnL[32];
+	while( to < endp ) *to++ = *from++;
+	return;
+	}
+
+void des(inblock, outblock)
+unsigned char *inblock, *outblock;
+{
+	unsigned long work[2];
+
+	scrunch(inblock, work);
+	desfunc(work, KnL);
+	unscrun(work, outblock);
+	return;
+	}
+
+static void scrunch(outof, into)
+register unsigned char *outof;
+register unsigned long *into;
+{
+	*into	 = (*outof++ & 0xffL) << 24;
+	*into	|= (*outof++ & 0xffL) << 16;
+	*into	|= (*outof++ & 0xffL) << 8;
+	*into++ |= (*outof++ & 0xffL);
+	*into	 = (*outof++ & 0xffL) << 24;
+	*into	|= (*outof++ & 0xffL) << 16;
+	*into	|= (*outof++ & 0xffL) << 8;
+	*into	|= (*outof   & 0xffL);
+	return;
+	}
+
+static void unscrun(outof, into)
+register unsigned long *outof;
+register unsigned char *into;
+{
+	*into++ = (*outof >> 24) & 0xffL;
+	*into++ = (*outof >> 16) & 0xffL;
+	*into++ = (*outof >>  8) & 0xffL;
+	*into++ =  *outof++	 & 0xffL;
+	*into++ = (*outof >> 24) & 0xffL;
+	*into++ = (*outof >> 16) & 0xffL;
+	*into++ = (*outof >>  8) & 0xffL;
+	*into	=  *outof	 & 0xffL;
+	return;
+	}
+
+static unsigned long SP1[64] = {
+	0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L,
+	0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L,
+	0x00000400L, 0x01010400L, 0x01010404L, 0x00000400L,
+	0x01000404L, 0x01010004L, 0x01000000L, 0x00000004L,
+	0x00000404L, 0x01000400L, 0x01000400L, 0x00010400L,
+	0x00010400L, 0x01010000L, 0x01010000L, 0x01000404L,
+	0x00010004L, 0x01000004L, 0x01000004L, 0x00010004L,
+	0x00000000L, 0x00000404L, 0x00010404L, 0x01000000L,
+	0x00010000L, 0x01010404L, 0x00000004L, 0x01010000L,
+	0x01010400L, 0x01000000L, 0x01000000L, 0x00000400L,
+	0x01010004L, 0x00010000L, 0x00010400L, 0x01000004L,
+	0x00000400L, 0x00000004L, 0x01000404L, 0x00010404L,
+	0x01010404L, 0x00010004L, 0x01010000L, 0x01000404L,
+	0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L,
+	0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L,
+	0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L };
+
+static unsigned long SP2[64] = {
+	0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L,
+	0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L,
+	0x80000020L, 0x80108020L, 0x80108000L, 0x80000000L,
+	0x80008000L, 0x00100000L, 0x00000020L, 0x80100020L,
+	0x00108000L, 0x00100020L, 0x80008020L, 0x00000000L,
+	0x80000000L, 0x00008000L, 0x00108020L, 0x80100000L,
+	0x00100020L, 0x80000020L, 0x00000000L, 0x00108000L,
+	0x00008020L, 0x80108000L, 0x80100000L, 0x00008020L,
+	0x00000000L, 0x00108020L, 0x80100020L, 0x00100000L,
+	0x80008020L, 0x80100000L, 0x80108000L, 0x00008000L,
+	0x80100000L, 0x80008000L, 0x00000020L, 0x80108020L,
+	0x00108020L, 0x00000020L, 0x00008000L, 0x80000000L,
+	0x00008020L, 0x80108000L, 0x00100000L, 0x80000020L,
+	0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L,
+	0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L,
+	0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L };
+
+static unsigned long SP3[64] = {
+	0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L,
+	0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L,
+	0x00020008L, 0x08000008L, 0x08000008L, 0x00020000L,
+	0x08020208L, 0x00020008L, 0x08020000L, 0x00000208L,
+	0x08000000L, 0x00000008L, 0x08020200L, 0x00000200L,
+	0x00020200L, 0x08020000L, 0x08020008L, 0x00020208L,
+	0x08000208L, 0x00020200L, 0x00020000L, 0x08000208L,
+	0x00000008L, 0x08020208L, 0x00000200L, 0x08000000L,
+	0x08020200L, 0x08000000L, 0x00020008L, 0x00000208L,
+	0x00020000L, 0x08020200L, 0x08000200L, 0x00000000L,
+	0x00000200L, 0x00020008L, 0x08020208L, 0x08000200L,
+	0x08000008L, 0x00000200L, 0x00000000L, 0x08020008L,
+	0x08000208L, 0x00020000L, 0x08000000L, 0x08020208L,
+	0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L,
+	0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L,
+	0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L };
+
+static unsigned long SP4[64] = {
+	0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
+	0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L,
+	0x00000000L, 0x00802000L, 0x00802000L, 0x00802081L,
+	0x00000081L, 0x00000000L, 0x00800080L, 0x00800001L,
+	0x00000001L, 0x00002000L, 0x00800000L, 0x00802001L,
+	0x00000080L, 0x00800000L, 0x00002001L, 0x00002080L,
+	0x00800081L, 0x00000001L, 0x00002080L, 0x00800080L,
+	0x00002000L, 0x00802080L, 0x00802081L, 0x00000081L,
+	0x00800080L, 0x00800001L, 0x00802000L, 0x00802081L,
+	0x00000081L, 0x00000000L, 0x00000000L, 0x00802000L,
+	0x00002080L, 0x00800080L, 0x00800081L, 0x00000001L,
+	0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
+	0x00802081L, 0x00000081L, 0x00000001L, 0x00002000L,
+	0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L,
+	0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L,
+	0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L };
+
+static unsigned long SP5[64] = {
+	0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L,
+	0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L,
+	0x40080100L, 0x00080000L, 0x02000100L, 0x40080100L,
+	0x42000100L, 0x42080000L, 0x00080100L, 0x40000000L,
+	0x02000000L, 0x40080000L, 0x40080000L, 0x00000000L,
+	0x40000100L, 0x42080100L, 0x42080100L, 0x02000100L,
+	0x42080000L, 0x40000100L, 0x00000000L, 0x42000000L,
+	0x02080100L, 0x02000000L, 0x42000000L, 0x00080100L,
+	0x00080000L, 0x42000100L, 0x00000100L, 0x02000000L,
+	0x40000000L, 0x02080000L, 0x42000100L, 0x40080100L,
+	0x02000100L, 0x40000000L, 0x42080000L, 0x02080100L,
+	0x40080100L, 0x00000100L, 0x02000000L, 0x42080000L,
+	0x42080100L, 0x00080100L, 0x42000000L, 0x42080100L,
+	0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L,
+	0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L,
+	0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L };
+
+static unsigned long SP6[64] = {
+	0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L,
+	0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L,
+	0x20004000L, 0x00404010L, 0x00400000L, 0x20000010L,
+	0x00400010L, 0x20004000L, 0x20000000L, 0x00004010L,
+	0x00000000L, 0x00400010L, 0x20004010L, 0x00004000L,
+	0x00404000L, 0x20004010L, 0x00000010L, 0x20400010L,
+	0x20400010L, 0x00000000L, 0x00404010L, 0x20404000L,
+	0x00004010L, 0x00404000L, 0x20404000L, 0x20000000L,
+	0x20004000L, 0x00000010L, 0x20400010L, 0x00404000L,
+	0x20404010L, 0x00400000L, 0x00004010L, 0x20000010L,
+	0x00400000L, 0x20004000L, 0x20000000L, 0x00004010L,
+	0x20000010L, 0x20404010L, 0x00404000L, 0x20400000L,
+	0x00404010L, 0x20404000L, 0x00000000L, 0x20400010L,
+	0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L,
+	0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L,
+	0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L };
+
+static unsigned long SP7[64] = {
+	0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L,
+	0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L,
+	0x04200802L, 0x00200000L, 0x00000000L, 0x04000002L,
+	0x00000002L, 0x04000000L, 0x04200002L, 0x00000802L,
+	0x04000800L, 0x00200802L, 0x00200002L, 0x04000800L,
+	0x04000002L, 0x04200000L, 0x04200800L, 0x00200002L,
+	0x04200000L, 0x00000800L, 0x00000802L, 0x04200802L,
+	0x00200800L, 0x00000002L, 0x04000000L, 0x00200800L,
+	0x04000000L, 0x00200800L, 0x00200000L, 0x04000802L,
+	0x04000802L, 0x04200002L, 0x04200002L, 0x00000002L,
+	0x00200002L, 0x04000000L, 0x04000800L, 0x00200000L,
+	0x04200800L, 0x00000802L, 0x00200802L, 0x04200800L,
+	0x00000802L, 0x04000002L, 0x04200802L, 0x04200000L,
+	0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L,
+	0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L,
+	0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L };
+
+static unsigned long SP8[64] = {
+	0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L,
+	0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L,
+	0x00040040L, 0x10040000L, 0x10041040L, 0x00041000L,
+	0x10041000L, 0x00041040L, 0x00001000L, 0x00000040L,
+	0x10040000L, 0x10000040L, 0x10001000L, 0x00001040L,
+	0x00041000L, 0x00040040L, 0x10040040L, 0x10041000L,
+	0x00001040L, 0x00000000L, 0x00000000L, 0x10040040L,
+	0x10000040L, 0x10001000L, 0x00041040L, 0x00040000L,
+	0x00041040L, 0x00040000L, 0x10041000L, 0x00001000L,
+	0x00000040L, 0x10040040L, 0x00001000L, 0x00041040L,
+	0x10001000L, 0x00000040L, 0x10000040L, 0x10040000L,
+	0x10040040L, 0x10000000L, 0x00040000L, 0x10001040L,
+	0x00000000L, 0x10041040L, 0x00040040L, 0x10000040L,
+	0x10040000L, 0x10001000L, 0x10001040L, 0x00000000L,
+	0x10041040L, 0x00041000L, 0x00041000L, 0x00001040L,
+	0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L };
+
+static void desfunc(block, keys)
+register unsigned long *block, *keys;
+{
+	register unsigned long fval, work, right, leftt;
+	register int round;
+
+	leftt = block[0];
+	right = block[1];
+	work = ((leftt >> 4) ^ right) & 0x0f0f0f0fL;
+	right ^= work;
+	leftt ^= (work << 4);
+	work = ((leftt >> 16) ^ right) & 0x0000ffffL;
+	right ^= work;
+	leftt ^= (work << 16);
+	work = ((right >> 2) ^ leftt) & 0x33333333L;
+	leftt ^= work;
+	right ^= (work << 2);
+	work = ((right >> 8) ^ leftt) & 0x00ff00ffL;
+	leftt ^= work;
+	right ^= (work << 8);
+	right = ((right << 1) | ((right >> 31) & 1L)) & 0xffffffffL;
+	work = (leftt ^ right) & 0xaaaaaaaaL;
+	leftt ^= work;
+	right ^= work;
+	leftt = ((leftt << 1) | ((leftt >> 31) & 1L)) & 0xffffffffL;
+
+	for( round = 0; round < 8; round++ ) {
+		work  = (right << 28) | (right >> 4);
+		work ^= *keys++;
+		fval  = SP7[ work		 & 0x3fL];
+		fval |= SP5[(work >>  8) & 0x3fL];
+		fval |= SP3[(work >> 16) & 0x3fL];
+		fval |= SP1[(work >> 24) & 0x3fL];
+		work  = right ^ *keys++;
+		fval |= SP8[ work		 & 0x3fL];
+		fval |= SP6[(work >>  8) & 0x3fL];
+		fval |= SP4[(work >> 16) & 0x3fL];
+		fval |= SP2[(work >> 24) & 0x3fL];
+		leftt ^= fval;
+		work  = (leftt << 28) | (leftt >> 4);
+		work ^= *keys++;
+		fval  = SP7[ work		 & 0x3fL];
+		fval |= SP5[(work >>  8) & 0x3fL];
+		fval |= SP3[(work >> 16) & 0x3fL];
+		fval |= SP1[(work >> 24) & 0x3fL];
+		work  = leftt ^ *keys++;
+		fval |= SP8[ work		 & 0x3fL];
+		fval |= SP6[(work >>  8) & 0x3fL];
+		fval |= SP4[(work >> 16) & 0x3fL];
+		fval |= SP2[(work >> 24) & 0x3fL];
+		right ^= fval;
+		}
+
+	right = (right << 31) | (right >> 1);
+	work = (leftt ^ right) & 0xaaaaaaaaL;
+	leftt ^= work;
+	right ^= work;
+	leftt = (leftt << 31) | (leftt >> 1);
+	work = ((leftt >> 8) ^ right) & 0x00ff00ffL;
+	right ^= work;
+	leftt ^= (work << 8);
+	work = ((leftt >> 2) ^ right) & 0x33333333L;
+	right ^= work;
+	leftt ^= (work << 2);
+	work = ((right >> 16) ^ leftt) & 0x0000ffffL;
+	leftt ^= work;
+	right ^= (work << 16);
+	work = ((right >> 4) ^ leftt) & 0x0f0f0f0fL;
+	leftt ^= work;
+	right ^= (work << 4);
+	*block++ = right;
+	*block = leftt;
+	return;
+	}
+
+/* Validation sets:
+ *
+ * Single-length key, single-length plaintext -
+ * Key	  : 0123 4567 89ab cdef
+ * Plain  : 0123 4567 89ab cde7
+ * Cipher : c957 4425 6a5e d31d
+ *
+ * Double-length key, single-length plaintext -
+ * Key	  : 0123 4567 89ab cdef fedc ba98 7654 3210
+ * Plain  : 0123 4567 89ab cde7
+ * Cipher : 7f1d 0a77 826b 8aff
+ *
+ * Double-length key, double-length plaintext -
+ * Key	  : 0123 4567 89ab cdef fedc ba98 7654 3210
+ * Plain  : 0123 4567 89ab cdef 0123 4567 89ab cdff
+ * Cipher : 27a0 8440 406a df60 278f 47cf 42d6 15d7
+ *
+ * Triple-length key, single-length plaintext -
+ * Key	  : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
+ * Plain  : 0123 4567 89ab cde7
+ * Cipher : de0b 7c06 ae5e 0ed5
+ *
+ * Triple-length key, double-length plaintext -
+ * Key	  : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
+ * Plain  : 0123 4567 89ab cdef 0123 4567 89ab cdff
+ * Cipher : ad0d 1b30 ac17 cf07 0ed1 1c63 81e4 4de5
+ *
+ * d3des V5.0a rwo 9208.07 18:44 Graven Imagery
+ **********************************************************************/
diff -urN lib/microwindows/src/demos/vnc/libvncauth/d3des.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/libvncauth/d3des.h
--- lib/microwindows/src/demos/vnc/libvncauth/d3des.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/libvncauth/d3des.h	2005-02-21 16:03:06.000000000 +0100
@@ -0,0 +1,50 @@
+/*
+ * This is D3DES (V5.09) by Richard Outerbridge with the double and
+ * triple-length support removed for use in VNC.
+ *
+ * These changes are Copyright (C) 1998 Olivetti & Oracle Research Laboratory
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+/* d3des.h -
+ *
+ *	Headers and defines for d3des.c
+ *	Graven Imagery, 1992.
+ *
+ * Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge
+ *	(GEnie : OUTER; CIS : [71755,204])
+ */
+
+#define EN0	0	/* MODE == encrypt */
+#define DE1	1	/* MODE == decrypt */
+
+extern void deskey(unsigned char *, short);
+/*		      hexkey[8]     MODE
+ * Sets the internal key register according to the hexadecimal
+ * key contained in the 8 bytes of hexkey, according to the DES,
+ * for encryption or decryption according to MODE.
+ */
+
+extern void usekey(unsigned long *);
+/*		    cookedkey[32]
+ * Loads the internal key register with the data in cookedkey.
+ */
+
+extern void cpkey(unsigned long *);
+/*		   cookedkey[32]
+ * Copies the contents of the internal key register into the storage
+ * located at &cookedkey[0].
+ */
+
+extern void des(unsigned char *, unsigned char *);
+/*		    from[8]	      to[8]
+ * Encrypts/Decrypts (according to the key currently loaded in the
+ * internal key register) one block of eight bytes at address 'from'
+ * into the block at address 'to'.  They can be the same.
+ */
+
+/* d3des.h V5.09 rwo 9208.04 15:06 Graven Imagery
+ ********************************************************************/
diff -urN lib/microwindows/src/demos/vnc/libvncauth/vncauth.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/libvncauth/vncauth.c
--- lib/microwindows/src/demos/vnc/libvncauth/vncauth.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/libvncauth/vncauth.c	2005-02-21 16:03:06.000000000 +0100
@@ -0,0 +1,162 @@
+/*
+ *  Copyright (C) 1997, 1998 Olivetti & Oracle Research Laboratory
+ *
+ *  This is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This software is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ *  USA.
+ */
+
+/*
+ * vncauth.c - Functions for VNC password management and authentication.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <vncauth.h>
+#include <d3des.h>
+
+
+/*
+ * We use a fixed key to store passwords, since we assume that our local
+ * file system is secure but nonetheless don't want to store passwords
+ * as plaintext.
+ */
+
+unsigned char fixedkey[8] = {23,82,107,6,35,78,88,7};
+
+
+/*
+ * Encrypt a password and store it in a file.  Returns 0 if successful,
+ * 1 if the file could not be written.
+ */
+
+int
+vncEncryptAndStorePasswd(char *passwd, char *fname)
+{
+    FILE *fp;
+    int i;
+    unsigned char encryptedPasswd[8];
+
+    if ((fp = fopen(fname,"w")) == NULL) return 1;
+
+    chmod(fname, S_IRUSR|S_IWUSR);
+
+    /* pad password with nulls */
+
+    for (i = 0; i < 8; i++) {
+	if (i < strlen(passwd)) {
+	    encryptedPasswd[i] = passwd[i];
+	} else {
+	    encryptedPasswd[i] = 0;
+	}
+    }
+
+    /* Do encryption in-place - this way we overwrite our copy of the plaintext
+       password */
+
+    deskey(fixedkey, EN0);
+    des(encryptedPasswd, encryptedPasswd);
+
+    for (i = 0; i < 8; i++) {
+	putc(encryptedPasswd[i], fp);
+    }
+  
+    fclose(fp);
+    return 0;
+}
+
+
+/*
+ * Decrypt a password from a file.  Returns a pointer to a newly allocated
+ * string containing the password or a null pointer if the password could
+ * not be retrieved for some reason.
+ */
+
+char *
+vncDecryptPasswdFromFile(char *fname)
+{
+    FILE *fp;
+    int i, ch;
+    unsigned char *passwd = (unsigned char *)malloc(9);
+
+    if ((fp = fopen(fname,"r")) == NULL) return NULL;
+
+    for (i = 0; i < 8; i++) {
+	ch = getc(fp);
+	if (ch == EOF) {
+	    fclose(fp);
+	    return NULL;
+	}
+	passwd[i] = ch;
+    }
+
+    fclose(fp);
+
+    deskey(fixedkey, DE1);
+    des(passwd, passwd);
+
+    passwd[8] = 0;
+
+    return (char *)passwd;
+}
+
+
+/*
+ * Generate CHALLENGESIZE random bytes for use in challenge-response
+ * authentication.
+ */
+
+void
+vncRandomBytes(unsigned char *bytes)
+{
+    int i;
+    unsigned int seed = (unsigned int) time(0);
+
+    srandom(seed);
+    for (i = 0; i < CHALLENGESIZE; i++) {
+	bytes[i] = (unsigned char)(random() & 255);    
+    }
+}
+
+
+/*
+ * Encrypt CHALLENGESIZE bytes in memory using a password.
+ */
+
+void
+vncEncryptBytes(unsigned char *bytes, char *passwd)
+{
+    unsigned char key[8];
+    int i;
+
+    /* key is simply password padded with nulls */
+
+    for (i = 0; i < 8; i++) {
+	if (i < strlen(passwd)) {
+	    key[i] = passwd[i];
+	} else {
+	    key[i] = 0;
+	}
+    }
+
+    deskey(key, EN0);
+
+    for (i = 0; i < CHALLENGESIZE; i += 8) {
+	des(bytes+i, bytes+i);
+    }
+}
diff -urN lib/microwindows/src/demos/vnc/vncviewer/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/Makefile
--- lib/microwindows/src/demos/vnc/vncviewer/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/Makefile	2005-02-21 16:03:07.000000000 +0100
@@ -0,0 +1,53 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS += -I../include
+# Defines for preprocessor
+DEFINES += -DNANOX=1
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(NANOX), Y)
+ifeq ($(NANOXDEMO), Y)
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME =
+
+# List of objects to compile
+OBJS =	args.o \
+	rfbproto.o \
+	sockets.o \
+	vncviewer.o \
+	nanox.o
+	
+all: default $(TOP)/bin/vnc
+
+endif
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
+NANOXCLIENTLIBS += $(TOP)/lib/libvncauth.a
+
+
+$(TOP)/bin/vnc: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(NANOXCLIENTLIBS)
+
diff -urN lib/microwindows/src/demos/vnc/vncviewer/args.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/args.c
--- lib/microwindows/src/demos/vnc/vncviewer/args.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/args.c	2005-02-21 16:13:02.000000000 +0100
@@ -0,0 +1,286 @@
+/*
+ *  Copyright (C) 1997, 1998 Olivetti & Oracle Research Laboratory
+ *
+ *  This is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This software is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this software; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ *  USA.
+ */
+
+/*
+ * args.c - argument processing.
+ */
+
+#include <sys/utsname.h>
+#include <vncviewer.h>
+
+#define FLASHPORT  (5400)    /* Offset to listen for `flash' commands */
+#define CLIENTPORT (5500)    /* Offset to listen for reverse connections */
+#define SERVERPORT (5900)    /* Offset to server for regular connections */
+
+char *programName;
+
+char hostname[256];
+int port;
+
+Bool listenSpecified = False;
+int listenPort = 0, flashPort = 0;
+
+char *displayname = NULL;
+
+Bool shareDesktop = False;
+Bool viewOnly = False;
+
+CARD32 explicitEncodings[MAX_ENCODINGS];
+int nExplicitEncodings = 0;
+Bool addCopyRect = True;
+Bool addRRE = True;
+Bool addCoRRE = True;
+Bool addHextile = True;
+
+Bool useBGR233 = False;
+Bool forceOwnCmap = False;
+Bool forceTruecolour = False;
+int requestedDepth = 0;
+
+char *geometry = NULL;
+
+int wmDecorationWidth = 4;
+int wmDecorationHeight = 24;
+
+char *passwdFile = NULL;
+
+int updateRequestPeriodms = 0;
+
+int updateRequestX = 0;
+int updateRequestY = 0;
+int updateRequestW = 0;
+int updateRequestH = 0;
+
+int rawDelay = 0;
+int copyRectDelay = 0;
+
+Bool debug = False;
+
+
+void
+usage()
+{
+    fprintf(stderr,"\n"
+	    "usage: %s [<options>] <host>:<display#>\n"
+	    "       %s [<options>] -listen [<display#>]\n"
+	    "\n"
+	    "<options> are:\n"
+	    "              [-display <display>] [-shared] [-viewonly]\n"
+	    "              [-raw] [-copyrect] [-rre] [-corre] [-hextile]\n"
+	    "              [-nocopyrect] [-norre] [-nocorre] [-nohextile]\n"
+	    "              [-bgr233] [-owncmap] [-truecolour] [-depth <d>]\n"
+	    "              [-geometry <geom>]\n"
+	    "              [-wmdecoration <width>x<height>]\n"
+	    "              [-passwd <passwd-file>]\n"
+	    "              [-period <ms>]\n"
+	    "              [-region <x> <y> <width> <height>]\n"
+	    "              [-rawdelay <ms>] [-copyrectdelay <ms>] [-debug]\n\n"
+	    ,programName,programName);
+    exit(1);
+}
+
+
+void
+processArgs(int argc, char **argv)
+{
+    int i;
+    Bool argumentSpecified = False;
+
+    programName = argv[0];
+
+    for (i = 1; i < argc; i++) {
+
+	if (strcmp(argv[i],"-display") == 0) {
+
+	    if (++i >= argc) usage();
+	    displayname = argv[i];
+
+	} else if (strcmp(argv[i],"-shared") == 0) {
+
+	    shareDesktop = True;
+
+	} else if (strcmp(argv[i],"-viewonly") == 0) {
+
+	    viewOnly = True;
+
+	} else if (strcmp(argv[i],"-rre") == 0) {
+
+	    explicitEncodings[nExplicitEncodings++] = rfbEncodingRRE;
+	    addRRE = False;
+
+	} else if (strcmp(argv[i],"-corre") == 0) {
+
+	    explicitEncodings[nExplicitEncodings++] = rfbEncodingCoRRE;
+	    addCoRRE = False;
+
+	} else if (strcmp(argv[i],"-hextile") == 0) {
+
+	    explicitEncodings[nExplicitEncodings++] = rfbEncodingHextile;
+	    addHextile = False;
+
+	} else if (strcmp(argv[i],"-copyrect") == 0) {
+
+	    explicitEncodings[nExplicitEncodings++] = rfbEncodingCopyRect;
+	    addCopyRect = False;
+
+	} else if (strcmp(argv[i],"-raw") == 0) {
+
+	    explicitEncodings[nExplicitEncodings++] = rfbEncodingRaw;
+
+	} else if (strcmp(argv[i],"-norre") == 0) {
+
+	    addRRE = False;
+
+	} else if (strcmp(argv[i],"-nocorre") == 0) {
+
+	    addCoRRE = False;
+
+	} else if (strcmp(argv[i],"-nohextile") == 0) {
+
+	    addHextile = False;
+
+	} else if (strcmp(argv[i],"-nocopyrect") == 0) {
+
+	    addCopyRect = False;
+
+	} else if (strcmp(argv[i],"-bgr233") == 0) {
+
+	    useBGR233 = True;
+
+	} else if (strcmp(argv[i],"-owncmap") == 0) {
+
+	    forceOwnCmap = True;
+
+	} else if (strcmp(argv[i],"-truecolour") == 0) {
+
+	    forceTruecolour = True;
+
+	} else if (strcmp(argv[i],"-depth") == 0) {
+
+	    if (++i >= argc) usage();
+	    requestedDepth = atoi(argv[i]);
+
+	} else if (strcmp(argv[i],"-geometry") == 0) {
+
+	    if (++i >= argc) usage();
+	    geometry = argv[i];
+
+	} else if (strcmp(argv[i],"-wmdecoration") == 0) {
+
+	    if (++i >= argc) usage();
+	    if (sscanf(argv[i], "%dx%d",
+		       &wmDecorationWidth, &wmDecorationHeight) != 2) usage();
+
+	} else if (strcmp(argv[i],"-passwd") == 0) {
+
+	    if (++i >= argc) usage();
+	    passwdFile = argv[i];
+
+	} else if (strcmp(argv[i],"-period") == 0) {
+
+	    if (++i >= argc) usage();
+	    updateRequestPeriodms = atoi(argv[i]);
+
+	} else if (strcmp(argv[i],"-region") == 0) {
+
+	    if ((i+4) >= argc) usage();
+	    updateRequestX = atoi(argv[i+1]);
+	    updateRequestY = atoi(argv[i+2]);
+	    updateRequestW = atoi(argv[i+3]);
+	    updateRequestH = atoi(argv[i+4]);
+	    if ((updateRequestX < 0) || (updateRequestY < 0) ||
+		(updateRequestW < 0) || (updateRequestH < 0))
+		usage();
+	    i += 4;
+
+	} else if (strcmp(argv[i],"-rawdelay") == 0) {
+
+	    if (++i >= argc) usage();
+	    rawDelay = atoi(argv[i]);
+
+	} else if (strcmp(argv[i],"-copyrectdelay") == 0) {
+
+	    if (++i >= argc) usage();
+	    copyRectDelay = atoi(argv[i]);
+
+	} else if (strcmp(argv[i],"-debug") == 0) {
+
+	    debug = True;
+
+	} else if (strcmp(argv[i],"-listen") == 0) {
+
+	    if (argumentSpecified) usage();
+
+	    listenSpecified = True;
+	    if (++i < argc) {
+		listenPort = CLIENTPORT+atoi(argv[i]);
+		flashPort = FLASHPORT+atoi(argv[i]);
+	    }
+
+	} else if (argv[i][0] != '-') {
+
+	    if (argumentSpecified || listenSpecified) usage();
+
+	    argumentSpecified = True;
+
+	    if (sscanf(argv[i], "%[^:]:%d", hostname, &port) != 2) usage();
+
+	    if (port < 100)
+		port += SERVERPORT;
+
+	} else {
+
+	    usage();
+
+	}
+    }
+
+    if (listenSpecified) {
+	if (listenPort == 0) {
+	    char *display;
+	    char *colonPos;
+	    struct utsname hostinfo;
+
+	    display = XDisplayName(displayname);
+	    colonPos = strchr(display, ':');
+
+	    uname(&hostinfo);
+
+	    if (colonPos && ((colonPos == display) ||
+			     (strncmp(hostinfo.nodename, display,
+				      strlen(hostinfo.nodename)) == 0))) {
+
+		listenPort = CLIENTPORT+atoi(colonPos+1);
+		flashPort = FLASHPORT+atoi(colonPos+1);
+
+	    } else {
+		fprintf(stderr,"%s: cannot work out which display number to "
+			"listen on.\n", programName);
+		fprintf(stderr,
+			"Please specify explicitly with -listen <num>\n");
+		exit(1);
+	    }
+	}
+
+    } else if (!argumentSpecified) {
+
+	usage();
+
+    }
+}
diff -urN lib/microwindows/src/demos/vnc/vncviewer/listen.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/listen.c
--- lib/microwindows/src/demos/vnc/vncviewer/listen.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/listen.c	2005-02-21 16:03:06.000000000 +0100
@@ -0,0 +1,227 @@
+/*
+ *  Copyright (C) 1997, 1998 Olivetti & Oracle Research Laboratory
+ *
+ *  This is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This software is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this software; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ *  USA.
+ */
+
+/*
+ * listen.c - listen for incoming connections
+ */
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/time.h>
+#include <vncviewer.h>
+
+#define FLASHWIDTH 50	/* pixels */
+#define FLASHDELAY 1	/* seconds */
+
+static Font flashFont;
+
+static void getFlashFont(Display *d);
+static void flashDisplay(Display *d, char *user);
+
+void
+listenForIncomingConnections()
+{
+    Display *d;
+    XEvent ev;
+    int listenSocket, flashSocket, sock;
+    fd_set fds;
+    char flashUser[256];
+    int n;
+
+    if (!(d = XOpenDisplay(displayname))) {
+	fprintf(stderr,"%s: unable to open display %s\n",
+		programName, XDisplayName(displayname));
+	exit(1);
+    }
+
+    getFlashFont(d);
+
+    listenSocket = ListenAtTcpPort(listenPort);
+    flashSocket = ListenAtTcpPort(flashPort);
+
+    if ((listenSocket < 0) || (flashSocket < 0)) exit(1);
+
+    fprintf(stderr,"%s: Listening on port %d (flash port %d)\n",
+	    programName,listenPort,flashPort);
+
+    while (True) {
+
+	/* reap any zombies */
+	int status, pid;
+	while ((pid= wait3(&status, WNOHANG, (struct rusage *)0))>0);
+
+	/* discard any X events */
+	while (XCheckIfEvent(d, &ev, AllXEventsPredicate, NULL))
+	    ;
+
+	FD_ZERO(&fds); 
+
+	FD_SET(flashSocket, &fds);
+	FD_SET(listenSocket, &fds);
+	FD_SET(ConnectionNumber(d), &fds);
+
+	select(FD_SETSIZE, &fds, NULL, NULL, NULL);
+
+	if (FD_ISSET(flashSocket, &fds)) {
+
+	    sock = AcceptTcpConnection(flashSocket);
+	    if (sock < 0) exit(1);
+	    n = read(sock, flashUser, 255);
+	    if (n > 0) {
+		flashUser[n] = 0;
+		flashDisplay(d, flashUser);
+	    } else {
+		flashDisplay(d, NULL);
+	    }
+	    close(sock);
+	}
+
+	if (FD_ISSET(listenSocket, &fds)) {
+	    rfbsock = AcceptTcpConnection(listenSocket);
+	    if (rfbsock < 0) exit(1);
+
+	    XCloseDisplay(d);
+
+	    /* Now fork off a new process to deal with it... */
+
+	    switch (fork()) {
+
+	    case -1: 
+		perror("fork"); 
+		exit(1);
+
+	    case 0:
+		/* child - return to caller */
+		close(listenSocket);
+		close(flashSocket);
+		return;
+
+	    default:
+		/* parent - go round and listen again */
+		close(rfbsock); 
+		if (!(d = XOpenDisplay(displayname))) {
+		    fprintf(stderr,"%s: unable to open display \"%s\"\r\n",
+			    programName, XDisplayName (displayname));
+		    exit(1);
+		}
+		getFlashFont(d);
+		break;
+	    }
+	}
+    }
+}
+
+
+/*
+ * getFlashFont
+ */
+
+static void
+getFlashFont(Display *d)
+{
+    char fontName[256];
+    char **fontNames;
+    int nFontNames;
+
+    sprintf(fontName,"-*-courier-bold-r-*-*-%d-*-*-*-*-*-iso8859-1",
+	    FLASHWIDTH);
+    fontNames = XListFonts(d, fontName, 1, &nFontNames);
+    if (nFontNames == 1) {
+	XFreeFontNames(fontNames);
+    } else {
+	sprintf(fontName,"fixed");
+    }
+    flashFont = XLoadFont(d, fontName);
+}
+
+
+/*
+ * flashDisplay
+ */
+
+static void
+flashDisplay(Display *d, char *user)
+{
+    Window w1, w2, w3, w4;
+    XSetWindowAttributes attr;
+
+    XBell(d, 100);
+
+    XForceScreenSaver(d, ScreenSaverReset);
+
+    attr.background_pixel = BlackPixel(d, DefaultScreen(d));
+    attr.override_redirect = 1;
+    attr.save_under = True;
+
+    w1 = XCreateWindow(d, DefaultRootWindow(d), 0, 0,
+		       WidthOfScreen(DefaultScreenOfDisplay(d)), 
+		       FLASHWIDTH, 0, 
+		       CopyFromParent, CopyFromParent, CopyFromParent, 
+		       CWBackPixel|CWOverrideRedirect|CWSaveUnder,
+		       &attr);
+  
+    w2 = XCreateWindow(d, DefaultRootWindow(d), 0, 0, FLASHWIDTH,
+		       HeightOfScreen(DefaultScreenOfDisplay(d)), 0,
+		       CopyFromParent, CopyFromParent, CopyFromParent, 
+		       CWBackPixel|CWOverrideRedirect|CWSaveUnder,
+		       &attr);
+
+    w3 = XCreateWindow(d, DefaultRootWindow(d), 
+		       WidthOfScreen(DefaultScreenOfDisplay(d))-FLASHWIDTH, 
+		       0, FLASHWIDTH, 
+		       HeightOfScreen(DefaultScreenOfDisplay(d)), 0, 
+		       CopyFromParent, CopyFromParent, CopyFromParent, 
+		       CWBackPixel|CWOverrideRedirect|CWSaveUnder,
+		       &attr);
+
+    w4 = XCreateWindow(d, DefaultRootWindow(d), 0,
+		       HeightOfScreen(DefaultScreenOfDisplay(d))-FLASHWIDTH, 
+		       WidthOfScreen(DefaultScreenOfDisplay(d)), 
+		       FLASHWIDTH, 0, 
+		       CopyFromParent, CopyFromParent, CopyFromParent, 
+		       CWBackPixel|CWOverrideRedirect|CWSaveUnder,
+		       &attr);
+
+    XMapWindow(d, w1);
+    XMapWindow(d, w2);
+    XMapWindow(d, w3);
+    XMapWindow(d, w4);
+
+    if (user) {
+	GC gc;
+	XGCValues gcv;
+
+	gcv.foreground = WhitePixel(d, DefaultScreen(d));
+	gcv.font = flashFont;
+	gc = XCreateGC(d, w1, GCForeground|GCFont, &gcv);
+	XDrawString(d, w1, gc,
+		    WidthOfScreen(DefaultScreenOfDisplay(d)) / 2 - FLASHWIDTH,
+		    (FLASHWIDTH * 3 / 4), user, strlen(user));
+    }
+    XFlush(d);
+
+    sleep(FLASHDELAY);
+
+    XDestroyWindow(d, w1);
+    XDestroyWindow(d, w2);
+    XDestroyWindow(d, w3);
+    XDestroyWindow(d, w4);
+    XFlush(d);
+}
diff -urN lib/microwindows/src/demos/vnc/vncviewer/nanox.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/nanox.c
--- lib/microwindows/src/demos/vnc/vncviewer/nanox.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/nanox.c	2005-02-21 16:03:07.000000000 +0100
@@ -0,0 +1,384 @@
+/*
+ *  Copyright (C) 1997, 1998 Olivetti & Oracle Research Laboratory
+ *
+ *  This is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This software is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this software; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ *  USA.
+ *
+ *  Microwindows interface by George Harvey
+ *
+ *  07/03/00  GH	created nanox.c to replace x.c, development
+ *			being done using Microwindows 0.88pre3
+ *  16/03/00  GH	try to match the VNC palette to the current
+ *			palette using a lookup table
+ *  06/05/00  GH	update for mwin 0.88pre7, use GrSetSystemPalette()
+ *			instead of lookup table
+ *  27/05/00  GH	update for mwin 0.88pre8
+ *  03/06/00  GH	remove colour lookup code
+ */
+
+/*
+ * nanox.c - functions to deal with nano-X display.
+ */
+
+#include <vncviewer.h>
+#include <unistd.h>
+
+#define VW_WIDTH	1024	/* VNC window width */
+#define VW_HEIGHT	768	/* VNC window height */
+#define VW_X		0	/* VNC window origin */
+#define VW_Y		0	/* VNC window origin */
+
+#define SCROLLBAR_SIZE 10
+#define SCROLLBAR_BG_SIZE (SCROLLBAR_SIZE + 2)
+
+#define INVALID_PIXEL 0xffffffff
+#define COLORMAP_SIZE 256
+
+/*
+ * global data
+ */
+Colormap	cmap;
+Display		*dpy;
+Window		canvas;
+GR_GC_ID	gc;
+GR_GC_ID	srcGC;
+GR_GC_ID	dstGC;
+
+/* BGR233ToPixel array */
+unsigned long BGR233ToPixel[COLORMAP_SIZE] = { \
+	0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, \
+	0xf7, 0xc7, 0x87, 0x47, 0x07, 0xc6, 0x86, 0x46, \
+	0xf7, 0xc7, 0x87, 0x47, 0x07, 0xc6, 0x86, 0x46, \
+	0xf7, 0xc7, 0x87, 0x47, 0x07, 0xc6, 0x86, 0x46, \
+	0xf7, 0xc7, 0x87, 0x47, 0x07, 0xc6, 0x86, 0x46, \
+	0xf7, 0xc7, 0x87, 0x47, 0x07, 0xc6, 0x86, 0x46, \
+	0xf7, 0xc7, 0x87, 0x47, 0x07, 0xc6, 0x86, 0x46, \
+	0xf7, 0xc7, 0x87, 0x47, 0x07, 0xc6, 0x86, 0x46, \
+	0xf7, 0xc7, 0x87, 0x47, 0x07, 0xc6, 0x86, 0x46, \
+	0x0c, 0x4c, 0x8c, 0xcc, 0x0d, 0x4d, 0x8d, 0xcd, \
+	0xcb, 0x80 \
+	};
+
+/* colour palette for 8-bit displays */
+static GR_PALETTE srv_pal;	/* VNC server palette */
+
+
+/* temporary keyboard mapping array */
+/* ^T = up, ^F = left, ^G = right, ^V = down
+ */
+CARD32 kmap[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0xff51, 0xff53, \
+	0xff08, 0xff09, 0x0a, 0x0b, 0x0c, 0xff0d, 0x0e, 0x0f, \
+	0x10, 0x11, 0x12, 0x13, 0xff52, 0x15, 0xff54, 0x17, \
+	0x18, 0x19, 0x1a, 0xff1b, 0x1c, 0x1d, 0x1e, 0x1f, \
+	0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, \
+	0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, \
+	'0', '1', '2', '3', '4', '5', '6', '7', \
+	'8', '9', 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, \
+	0x40, 'A', 'B', 'C', 'D', 'E', 'F', 'G', \
+	'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', \
+	'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', \
+	'X', 'Y', 'Z', 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, \
+	0x60, 'a', 'b', 'c', 'd', 'e', 'f', 'g', \
+	'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', \
+	'p', 'q', 'r', 's', 't', 'u', 'v', 'w', \
+	'x', 'y', 'z', 0x7b, 0x7c, 0x7d, 0x7e, 0x7f };
+
+static Display		nx_dpy;
+static GR_WINDOW_ID	wid;
+static int		pixtype;	/* format of pixel value */
+
+static void CopyBGR233ToScreen(CARD8 *buf, int x, int y, int width, int height);
+
+extern MWPIXELVAL gr_foreground;	/* for debugging only */
+
+/*
+ * Initialize graphics and open a window for the viewer
+ */
+Bool
+CreateXWindow(void)
+{
+	int fd;
+	GR_SIZE w, h;
+	GR_SCREEN_INFO si;
+
+	if ((fd = GrOpen()) < 0)
+		return(False);
+	nx_dpy.fd = fd;
+	dpy = &nx_dpy;
+
+	GrGetScreenInfo(&si);
+	/* pass screen details to RFB handler */
+	myFormat.bitsPerPixel = si.bpp;
+	myFormat.depth = si.bpp;	/* is this right? */
+	myFormat.bigEndian = 0;		/* how do I find this out? */
+	myFormat.trueColour = (myFormat.depth == 8 && !useBGR233) ? 0 : 1;
+	if (myFormat.trueColour) {
+		myFormat.redMax = myFormat.greenMax = 7;
+		myFormat.blueMax = 3;
+		myFormat.redShift = 0;
+		myFormat.greenShift = 3;
+		myFormat.blueShift = 6;
+	}
+	pixtype = si.pixtype;
+	/* get the initial server palette */
+	GrGetSystemPalette(&srv_pal);
+#if 0
+	/* DEBUG */
+	for (i = 0; i < srv_pal.count; i++) {
+		printf("0x%02x  %03d  %03d  %03d\n", i, \
+			srv_pal.palette[i].r, srv_pal.palette[i].g, \
+			srv_pal.palette[i].b );
+	}
+#endif
+	/* create the top-level window */
+	w = (VW_WIDTH > (si.cols - VW_X)) ? (si.cols - VW_X) : VW_WIDTH;
+	h = (VW_HEIGHT > (si.rows - VW_Y)) ? (si.rows - VW_Y) : VW_HEIGHT;
+	if ((wid = GrNewWindow(GR_ROOT_WINDOW_ID, VW_X, VW_Y, w, h,
+		2, LTGRAY, BLACK)) == 0) {
+		fprintf(stderr, "Unable to create top-level window\n");
+		GrClose();
+		return False;
+	}
+	/* select events to receive */
+	GrSelectEvents(wid, GR_EVENT_MASK_BUTTON_DOWN |
+		GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_KEY_DOWN |
+		GR_EVENT_MASK_KEY_UP | GR_EVENT_MASK_MOUSE_POSITION);
+	/* make thw window visible */
+	GrMapWindow(wid);
+	canvas = wid;
+	/* create the graphics contexts */
+	gc = GrNewGC();
+	srcGC = GrNewGC();
+	dstGC = GrNewGC();
+
+	return True;
+}
+
+/*
+ * set the server palette to the requested colour
+ * NOTE: this has only been tested for 8-bit colour!
+ */
+int
+XStoreColor(Display *dpy, Colormap cmap, XColor *xc)
+{
+	unsigned char ind;
+
+	ind = xc->pixel & 0xff;		/* colour map index */
+	/*
+	 * the colours are passed as 16-bit values so divide by 256 to
+	 * get 8-bit RGB values
+	 */
+	srv_pal.palette[0].r = (xc->red / 256) & 0xff;
+	srv_pal.palette[0].g = (xc->green / 256) & 0xff;
+	srv_pal.palette[0].b = (xc->blue / 256) & 0xff;
+	srv_pal.count = 1;
+#if 0
+	/* DEBUG */
+	printf("XStoreColor: ind=%d, r=%02x, g=%02x, b=%02x\n", ind, \
+		srv_pal.palette[0].r, srv_pal.palette[0].g, \
+		srv_pal.palette[0].b);
+#endif
+	GrSetSystemPalette(ind, &srv_pal);
+
+	return(0);
+}
+
+/*
+ * Copy a rectangular block of pixels
+ */
+int
+XCopyArea(Display *dpy, Window src, Window dst, GR_GC_ID gc,
+        int x1, int y1, int w, int h, int x2, int y2)
+{
+/*	printf("XCopyArea: src=%d, dst=%d, w=%d, h=%d\n",src, dst, w, h); */
+	GrCopyArea(dst, gc, x2, y2, w, h, src, x1, y1, MWROP_SRCCOPY);
+	return(0);
+}
+
+/*
+ * Fill a rectangular block
+ */
+int
+XFillRectangle(Display *dpy, Window canvas, GR_GC_ID gc,
+        int x, int y, int w, int h)
+{
+	GrFillRect(canvas, gc, x, y, w, h);
+/*	printf("XFillRectangle: gr_foreground=%08x\n", (int)gr_foreground); */
+	return(0);
+}
+
+/*
+ * get the X display name
+ */
+char *
+XDisplayName(char *display)
+{
+	return((char *)NULL);
+}
+
+/*
+ * Change the graphics context.
+ * VNC only uses this to set the foreground colour.
+ */
+int
+XChangeGC(Display *dpy, GR_GC_ID gc, unsigned long vmask, GR_GC_INFO *gcv)
+{
+
+        /* all we need is the foreground colour */
+/*	printf("XChangeGC: foreground=%08x\n", gcv->foreground); */
+	if (pixtype == MWPF_PALETTE) {
+		/*
+		 * The MWF_PALINDEX bit tells GdFindColor() to skip the palette
+		 * lookup. This is OK because we have already set the palette.
+		 */
+		GrSetGCForeground(gc, gcv->foreground | MWF_PALINDEX);
+	} else {
+		GrSetGCForeground(gc, gcv->foreground);
+	}
+        return(0);
+}
+
+/*
+ * Ring the bell.
+ */
+int
+XBell(Display *dpy, int pc)
+{
+        return(0);
+}
+
+/*
+ *
+ */
+int
+XSync(Display *dpy, Bool disc)
+{
+        return(0);
+}
+
+/*
+ *
+ */
+int
+XSelectInput(Display *dpy, Window win, long evmask)
+{
+        return(0);
+}
+
+/*
+ *
+ */
+int
+XStoreBytes(Display *dpy, char *bytes, int nbytes)
+{
+        return(0);
+}
+
+/*
+ *
+ */
+int
+XSetSelectionOwner(Display *dpy, Atom sel, Window own, Time t)
+{
+        return(0);
+}
+
+/*
+ * Copy raw pixel data to the screen
+ */
+void
+CopyDataToScreen(CARD8 *buf, int x, int y, int width, int height)
+{
+#if 0
+	/* DEBUG */
+	printf("CDTS ");
+	fflush(stdout);
+#endif
+	if (rawDelay != 0) {
+#if 0
+		XFillRectangle(dpy, canvas, DefaultGC(dpy,DefaultScreen(dpy)),
+		       x, y, width, height);
+#endif
+		XSync(dpy,False);
+		usleep(rawDelay * 1000);
+	}
+	if (!useBGR233) {
+		GrArea(canvas, gc, x, y, width, height, buf, MWPF_PALETTE);
+	} else {
+		CopyBGR233ToScreen(buf, x, y, width, height);
+	}
+}
+
+/*
+ * Copy BGR233 data to the screen.
+ */
+static void
+CopyBGR233ToScreen(CARD8 *buf, int x, int y, int width, int height)
+{
+
+}
+
+/*
+ * Handle all X events (keyboard and mouse).
+ */
+Bool
+HandleXEvents(GR_EVENT *ev)
+{
+	GR_BOOL ret = GR_TRUE;
+	int buttons;
+
+#if 0
+	printf("H");
+	fflush(stdout);
+#endif
+	switch (ev->type) {
+	case GR_EVENT_TYPE_NONE:
+		ret = GR_TRUE;
+		break;
+	case GR_EVENT_TYPE_MOUSE_POSITION:
+		buttons = (ev->mouse.buttons & GR_BUTTON_R) << 2;
+		buttons |= ev->mouse.buttons & GR_BUTTON_M;
+		buttons |= (ev->mouse.buttons & GR_BUTTON_L) >> 2;
+		ret = SendPointerEvent(ev->mouse.x, ev->mouse.y,
+			buttons);
+		break;
+	case GR_EVENT_TYPE_BUTTON_DOWN:
+	case GR_EVENT_TYPE_BUTTON_UP:
+		buttons = (ev->button.buttons & GR_BUTTON_R) << 2;
+		buttons |= ev->button.buttons & GR_BUTTON_M;
+		buttons |= (ev->button.buttons & GR_BUTTON_L) >> 2;
+		ret = SendPointerEvent(ev->button.x, ev->button.y,
+			buttons);
+		break;
+	case GR_EVENT_TYPE_KEY_DOWN:
+	case GR_EVENT_TYPE_KEY_UP:
+		ret = SendKeyEvent(kmap[ev->keystroke.ch & 0x7f],
+			(ev->type == GR_EVENT_TYPE_KEY_DOWN));
+		break;
+	default:
+		break;
+	}
+        return(ret);
+}
+
+/*
+ * Close everything down before exiting.
+ */
+void
+ShutdownX(void)
+{
+	GrClose();
+}
+
diff -urN lib/microwindows/src/demos/vnc/vncviewer/rfbproto.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/rfbproto.c
--- lib/microwindows/src/demos/vnc/vncviewer/rfbproto.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/rfbproto.c	2005-02-21 16:13:02.000000000 +0100
@@ -0,0 +1,986 @@
+/*
+ *  Copyright (C) 1997, 1998 Olivetti & Oracle Research Laboratory
+ *
+ *  This is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This software is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this software; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ *  USA.
+ */
+
+/*
+ * rfbproto.c - functions to deal with client side of RFB protocol.
+ */
+
+#include <unistd.h>
+#include <errno.h>
+#include <pwd.h>
+#include <vncviewer.h>
+#ifndef NANOX
+#include <X11/Xatom.h>
+#endif
+#include <vncauth.h>
+
+static Bool HandleHextileEncoding8(int x, int y, int w, int h);
+static Bool HandleHextileEncoding16(int x, int y, int w, int h);
+static Bool HandleHextileEncoding32(int x, int y, int w, int h);
+
+int rfbsock;
+char *desktopName;
+rfbPixelFormat myFormat;
+rfbServerInitMsg si;
+struct timeval updateRequestTime;
+Bool sendUpdateRequest;
+
+int endianTest = 1;
+
+
+/* note that the CoRRE encoding uses this buffer and assumes it is big enough
+   to hold 255 * 255 * 32 bits -> 260100 bytes.  640*480 = 307200 bytes */
+/* also hextile assumes it is big enough to hold 16 * 16 * 32 bits */
+
+#define BUFFER_SIZE (640*480)
+static char buffer[BUFFER_SIZE];
+
+
+void PrintPixelFormat(rfbPixelFormat *format);
+
+
+/*
+ * ConnectToRFBServer.
+ */
+
+Bool
+ConnectToRFBServer(const char *hostname, int port)
+{
+    unsigned int host;
+
+    if (!StringToIPAddr(hostname, &host)) {
+	fprintf(stderr,"%s: couldn't convert '%s' to host address\n",
+		programName,hostname);
+	return False;
+    }
+
+    rfbsock = ConnectToTcpAddr(host, port);
+
+    if (rfbsock < 0) {
+	fprintf(stderr,"%s: unable to connect to VNC server\n",
+		programName);
+	return False;
+    }
+
+    return True;
+}
+
+
+/*
+ * InitialiseRFBConnection.
+ */
+
+Bool
+InitialiseRFBConnection(int sock)
+{
+    rfbProtocolVersionMsg pv;
+    int major,minor;
+    Bool authWillWork = True;
+    CARD32 authScheme, reasonLen, authResult;
+    char *reason;
+    CARD8 challenge[CHALLENGESIZE];
+    char *passwd;
+    int i;
+    rfbClientInitMsg ci;
+
+    /* if the connection is immediately closed, don't report anything, so
+       that pmw's monitor can make test connections */
+
+    if (listenSpecified)
+	errorMessageFromReadExact = False;
+
+    if (!ReadExact(sock, pv, sz_rfbProtocolVersionMsg)) return False;
+
+    errorMessageFromReadExact = True;
+
+    pv[sz_rfbProtocolVersionMsg] = 0;
+
+    if (sscanf(pv,rfbProtocolVersionFormat,&major,&minor) != 2) {
+	fprintf(stderr,"%s: Not a valid VNC server\n",programName);
+	return False;
+    }
+
+    fprintf(stderr,"%s: VNC server supports protocol version %d.%d "
+	    "(viewer %d.%d)\n",
+	    programName,major,minor,rfbProtocolMajorVersion,
+	    rfbProtocolMinorVersion);
+
+    if ((major == 3) && (minor < 3)) {
+	/* if server is before 3.3 authentication won't work */
+	authWillWork = False;
+    } else {
+	/* any other server version, just tell it what we want */
+	major = rfbProtocolMajorVersion;
+	minor = rfbProtocolMinorVersion;
+    }
+
+    sprintf(pv,rfbProtocolVersionFormat,major,minor);
+
+    if (!WriteExact(sock, pv, sz_rfbProtocolVersionMsg)) return False;
+
+    if (!ReadExact(sock, (char *)&authScheme, 4)) return False;
+
+    authScheme = Swap32IfLE(authScheme);
+
+    switch (authScheme) {
+
+    case rfbConnFailed:
+	if (!ReadExact(sock, (char *)&reasonLen, 4)) return False;
+	reasonLen = Swap32IfLE(reasonLen);
+
+	reason = malloc(reasonLen);
+
+	if (!ReadExact(sock, reason, reasonLen)) return False;
+
+	fprintf(stderr,"%s: VNC connection failed: %.*s\n",
+		programName, (int)reasonLen, reason);
+	return False;
+
+    case rfbNoAuth:
+	fprintf(stderr,"%s: No authentication needed\n",programName);
+	break;
+
+    case rfbVncAuth:
+	if (!authWillWork) {
+	    fprintf(stderr,
+		    "\n%s: VNC server uses the old authentication scheme.\n"
+		    "You should kill your old desktop(s) and restart.\n"
+		    "If you really need to connect to this desktop use "
+		    "vncviewer3.2\n\n",
+		    programName);
+	    return False;
+	}
+
+	if (!ReadExact(sock, (char *)challenge, CHALLENGESIZE)) return False;
+
+	if (passwdFile) {
+	    passwd = vncDecryptPasswdFromFile(passwdFile);
+	} else {
+	    static char pass[32] = {"foobar2"};
+	    passwd = pass;
+	    //passwd = getpass("Password: ");
+	    if (strlen(passwd) == 0) {
+		fprintf(stderr,"%s: Reading password failed\n",programName);
+		return False;
+	    }
+	    if (strlen(passwd) > 8) {
+		passwd[8] = '\0';
+	    }
+	}
+
+	vncEncryptBytes(challenge, passwd);
+
+	/* Lose the password from memory */
+	for (i=0; i<strlen(passwd); i++) {
+	    passwd[i] = '\0';
+	}
+
+	if (!WriteExact(sock, challenge, CHALLENGESIZE)) return False;
+
+	if (!ReadExact(sock, (char *)&authResult, 4)) return False;
+
+	authResult = Swap32IfLE(authResult);
+
+	switch (authResult) {
+	case rfbVncAuthOK:
+	    fprintf(stderr,"%s: VNC authentication succeeded\n",programName);
+	    break;
+	case rfbVncAuthFailed:
+	    fprintf(stderr,"%s: VNC authentication failed\n",programName);
+	    return False;
+	case rfbVncAuthTooMany:
+	    fprintf(stderr,"%s: VNC authentication failed - too many tries\n",
+		    programName);
+	    return False;
+	default:
+	    fprintf(stderr,"%s: Unknown VNC authentication result: %d\n",
+		    programName,(int)authResult);
+	    return False;
+	}
+	break;
+
+    default:
+	fprintf(stderr,
+		"%s: Unknown authentication scheme from VNC server: %d\n",
+		programName,(int)authScheme);
+	return False;
+    }
+
+    ci.shared = (shareDesktop ? 1 : 0);
+
+    if (!WriteExact(sock, (char *)&ci, sz_rfbClientInitMsg)) return False;
+
+    if (!ReadExact(sock, (char *)&si, sz_rfbServerInitMsg)) return False;
+
+    si.framebufferWidth = Swap16IfLE(si.framebufferWidth);
+    si.framebufferHeight = Swap16IfLE(si.framebufferHeight);
+    si.format.redMax = Swap16IfLE(si.format.redMax);
+    si.format.greenMax = Swap16IfLE(si.format.greenMax);
+    si.format.blueMax = Swap16IfLE(si.format.blueMax);
+    si.nameLength = Swap32IfLE(si.nameLength);
+
+    if (((updateRequestX + updateRequestW) > si.framebufferWidth) ||
+	((updateRequestY + updateRequestH) > si.framebufferHeight))
+    {
+	fprintf(stderr,
+		"%s: region requested is outside server's framebuffer\n",
+		programName);
+	return False;
+    }
+    if (updateRequestW == 0)
+	updateRequestW = si.framebufferWidth - updateRequestX;
+    if (updateRequestH == 0)
+	updateRequestH = si.framebufferHeight - updateRequestY;
+
+    desktopName = malloc(si.nameLength + 1);
+
+    if (!ReadExact(sock, desktopName, si.nameLength)) return False;
+
+    desktopName[si.nameLength] = 0;
+
+    fprintf(stderr,"%s: Desktop name \"%s\"\n",programName,desktopName);
+
+    fprintf(stderr,
+	    "%s: Connected to VNC server, using protocol version %d.%d\n",
+	    programName, rfbProtocolMajorVersion, rfbProtocolMinorVersion);
+
+    fprintf(stderr,"%s: VNC server default format:\n",programName);
+    PrintPixelFormat(&si.format);
+
+    return True;
+}
+
+
+/*
+ * SetFormatAndEncodings.
+ */
+
+Bool
+SetFormatAndEncodings()
+{
+    rfbSetPixelFormatMsg spf;
+    char buf[sz_rfbSetEncodingsMsg + MAX_ENCODINGS * 4];
+    rfbSetEncodingsMsg *se = (rfbSetEncodingsMsg *)buf;
+    CARD32 *encs = (CARD32 *)(&buf[sz_rfbSetEncodingsMsg]);
+    int len = 0;
+    int i;
+
+    spf.type = rfbSetPixelFormat;
+    spf.format = myFormat;
+    spf.format.redMax = Swap16IfLE(spf.format.redMax);
+    spf.format.greenMax = Swap16IfLE(spf.format.greenMax);
+    spf.format.blueMax = Swap16IfLE(spf.format.blueMax);
+
+    if (!WriteExact(rfbsock, (char *)&spf, sz_rfbSetPixelFormatMsg))
+	return False;
+
+    se->type = rfbSetEncodings;
+    se->nEncodings = 0;
+
+    for (i = 0; i < nExplicitEncodings; i++) {
+	encs[se->nEncodings++] = Swap32IfLE(explicitEncodings[i]);
+    }
+
+    if (SameMachine(rfbsock)) {
+	encs[se->nEncodings++] = Swap32IfLE(rfbEncodingRaw);
+    }
+
+    if (addCopyRect)
+	encs[se->nEncodings++] = Swap32IfLE(rfbEncodingCopyRect);
+    if (addHextile)
+	encs[se->nEncodings++] = Swap32IfLE(rfbEncodingHextile);
+    if (addCoRRE)
+	encs[se->nEncodings++] = Swap32IfLE(rfbEncodingCoRRE);
+    if (addRRE)
+	encs[se->nEncodings++] = Swap32IfLE(rfbEncodingRRE);
+
+    len = sz_rfbSetEncodingsMsg + se->nEncodings * 4;
+
+    se->nEncodings = Swap16IfLE(se->nEncodings);
+
+    if (!WriteExact(rfbsock, buf, len)) return False;
+
+    return True;
+}
+
+
+/*
+ * SendIncrementalFramebufferUpdateRequest.
+ */
+
+Bool
+SendIncrementalFramebufferUpdateRequest()
+{
+    return SendFramebufferUpdateRequest(updateRequestX, updateRequestY,
+					updateRequestW, updateRequestH, True);
+}
+
+
+/*
+ * SendFramebufferUpdateRequest.
+ */
+
+Bool
+SendFramebufferUpdateRequest(int x, int y, int w, int h, Bool incremental)
+{
+    rfbFramebufferUpdateRequestMsg fur;
+
+    fur.type = rfbFramebufferUpdateRequest;
+    fur.incremental = incremental ? 1 : 0;
+    fur.x = Swap16IfLE(x);
+    fur.y = Swap16IfLE(y);
+    fur.w = Swap16IfLE(w);
+    fur.h = Swap16IfLE(h);
+
+    if (!WriteExact(rfbsock, (char *)&fur, sz_rfbFramebufferUpdateRequestMsg))
+	return False;
+
+    gettimeofday(&updateRequestTime, NULL);
+
+    sendUpdateRequest = False;
+
+    return True;
+}
+
+
+/*
+ * SendPointerEvent.
+ */
+
+Bool
+SendPointerEvent(int x, int y, int buttonMask)
+{
+    rfbPointerEventMsg pe;
+
+    pe.type = rfbPointerEvent;
+    pe.buttonMask = buttonMask;
+    if (x < 0) x = 0;
+    if (y < 0) y = 0;
+    pe.x = Swap16IfLE(x);
+    pe.y = Swap16IfLE(y);
+    return WriteExact(rfbsock, (char *)&pe, sz_rfbPointerEventMsg);
+}
+
+
+/*
+ * SendKeyEvent.
+ */
+
+Bool
+SendKeyEvent(CARD32 key, Bool down)
+{
+    rfbKeyEventMsg ke;
+
+    ke.type = rfbKeyEvent;
+    ke.down = down ? 1 : 0;
+    ke.key = Swap32IfLE(key);
+    return WriteExact(rfbsock, (char *)&ke, sz_rfbKeyEventMsg);
+}
+
+
+/*
+ * SendClientCutText.
+ */
+
+Bool
+SendClientCutText(char *str, int len)
+{
+    rfbClientCutTextMsg cct;
+
+    cct.type = rfbClientCutText;
+    cct.length = Swap32IfLE(len);
+    return  (WriteExact(rfbsock, (char *)&cct, sz_rfbClientCutTextMsg) &&
+	     WriteExact(rfbsock, str, len));
+}
+
+
+
+/*
+ * HandleRFBServerMessage.
+ */
+
+Bool
+HandleRFBServerMessage()
+{
+    rfbServerToClientMsg msg;
+
+    if (!ReadExact(rfbsock, (char *)&msg, 1))
+	return False;
+
+    switch (msg.type) {
+
+    case rfbSetColourMapEntries:
+    {
+	int i;
+	CARD16 rgb[3];
+	XColor xc;
+
+	if (!ReadExact(rfbsock, ((char *)&msg) + 1,
+			 sz_rfbSetColourMapEntriesMsg - 1))
+	    return False;
+
+	msg.scme.firstColour = Swap16IfLE(msg.scme.firstColour);
+	msg.scme.nColours = Swap16IfLE(msg.scme.nColours);
+
+	for (i = 0; i < msg.scme.nColours; i++) {
+	    if (!ReadExact(rfbsock, (char *)rgb, 6))
+		return False;
+	    xc.pixel = msg.scme.firstColour + i;
+	    xc.red = Swap16IfLE(rgb[0]);
+	    xc.green = Swap16IfLE(rgb[1]);
+	    xc.blue = Swap16IfLE(rgb[2]);
+	    xc.flags = DoRed|DoGreen|DoBlue;
+//printf("XStoreColor (%d,%d,%d) = %d\n", xc.red>>8, xc.green>>8, xc.blue>>8, xc.pixel);
+	    XStoreColor(dpy, cmap, &xc);
+	}
+
+	break;
+    }
+
+    case rfbFramebufferUpdate:
+    {
+	rfbFramebufferUpdateRectHeader rect;
+	int linesToRead;
+	int bytesPerLine;
+	int i;
+
+	if (!ReadExact(rfbsock, ((char *)&msg.fu) + 1,
+			 sz_rfbFramebufferUpdateMsg - 1))
+	    return False;
+
+	msg.fu.nRects = Swap16IfLE(msg.fu.nRects);
+
+	for (i = 0; i < msg.fu.nRects; i++) {
+	    if (!ReadExact(rfbsock, (char *)&rect,
+			     sz_rfbFramebufferUpdateRectHeader))
+		return False;
+
+	    rect.r.x = Swap16IfLE(rect.r.x);
+	    rect.r.y = Swap16IfLE(rect.r.y);
+	    rect.r.w = Swap16IfLE(rect.r.w);
+	    rect.r.h = Swap16IfLE(rect.r.h);
+
+	    rect.encoding = Swap32IfLE(rect.encoding);
+
+	    if ((rect.r.x + rect.r.w > si.framebufferWidth) ||
+		(rect.r.y + rect.r.h > si.framebufferHeight))
+	    {
+		fprintf(stderr,"%s: rect too large: %dx%d at (%d, %d)\n",
+		       programName, rect.r.w, rect.r.h, rect.r.x, rect.r.y);
+		return False;
+	    }
+
+	    if ((rect.r.h * rect.r.w) == 0) {
+		fprintf(stderr,"%s: zero size rect - ignoring\n",programName);
+		continue;
+	    }
+
+	    switch (rect.encoding) {
+
+	    case rfbEncodingRaw:
+
+		bytesPerLine = rect.r.w * myFormat.bitsPerPixel / 8;
+		linesToRead = BUFFER_SIZE / bytesPerLine;
+
+		while (rect.r.h > 0) {
+		    if (linesToRead > rect.r.h)
+			linesToRead = rect.r.h;
+
+		    if (!ReadExact(rfbsock, buffer,bytesPerLine * linesToRead))
+			return False;
+
+		    CopyDataToScreen((CARD8 *)buffer, rect.r.x, rect.r.y,
+				     rect.r.w, linesToRead);
+
+		    rect.r.h -= linesToRead;
+		    rect.r.y += linesToRead;
+
+		}
+		break;
+
+	    case rfbEncodingCopyRect:
+	    {
+		rfbCopyRect cr;
+
+		if (!ReadExact(rfbsock, (char *)&cr, sz_rfbCopyRect))
+		    return False;
+
+		cr.srcX = Swap16IfLE(cr.srcX);
+		cr.srcY = Swap16IfLE(cr.srcY);
+
+		if (copyRectDelay != 0) {
+		    XFillRectangle(dpy, canvas, srcGC, cr.srcX, cr.srcY,
+				   rect.r.w, rect.r.h);
+		    XFillRectangle(dpy, canvas, dstGC, rect.r.x, rect.r.y,
+				   rect.r.w, rect.r.h);
+		    XSync(dpy,False);
+		    usleep(copyRectDelay * 1000);
+		    XFillRectangle(dpy, canvas, dstGC, rect.r.x, rect.r.y,
+				   rect.r.w, rect.r.h);
+		    XFillRectangle(dpy, canvas, srcGC, cr.srcX, cr.srcY,
+				   rect.r.w, rect.r.h);
+		}
+
+		XCopyArea(dpy, canvas, canvas, gc, cr.srcX, cr.srcY,
+			  rect.r.w, rect.r.h, rect.r.x, rect.r.y);
+
+		break;
+	    }
+
+	    case rfbEncodingRRE:
+	    {
+		rfbRREHeader hdr;
+		CARD8 pix8;
+		CARD16 pix16;
+		CARD32 pix32;
+		XGCValues gcv;
+		rfbRectangle subrect;
+		int j;
+
+		if (!ReadExact(rfbsock, (char *)&hdr, sz_rfbRREHeader))
+		    return False;
+
+		hdr.nSubrects = Swap32IfLE(hdr.nSubrects);
+
+		switch (myFormat.bitsPerPixel) {
+
+		case 8:
+		    if (!ReadExact(rfbsock, (char *)&pix8, 1))
+			return False;
+
+		    gcv.foreground = (useBGR233 ? BGR233ToPixel[pix8]
+				      : pix8);
+		    XChangeGC(dpy, gc, GCForeground, &gcv);
+		    XFillRectangle(dpy, canvas, gc, rect.r.x, rect.r.y,
+				   rect.r.w, rect.r.h);
+
+		    for (j = 0; j < hdr.nSubrects; j++) {
+			if (!ReadExact(rfbsock, (char *)&pix8, 1))
+			    return False;
+
+			if (!ReadExact(rfbsock, (char *)&subrect,
+					 sz_rfbRectangle))
+			    return False;
+
+			subrect.x = Swap16IfLE(subrect.x);
+			subrect.y = Swap16IfLE(subrect.y);
+			subrect.w = Swap16IfLE(subrect.w);
+			subrect.h = Swap16IfLE(subrect.h);
+
+			gcv.foreground = (useBGR233 ? BGR233ToPixel[pix8]
+					  : pix8);
+			XChangeGC(dpy, gc, GCForeground, &gcv);
+			XFillRectangle(dpy, canvas, gc, rect.r.x + subrect.x,
+				       rect.r.y + subrect.y, subrect.w,
+				       subrect.h);
+		    }
+		    break;
+
+		case 16:
+		    if (!ReadExact(rfbsock, (char *)&pix16, 2))
+			return False;
+
+		    gcv.foreground = pix16;
+		    XChangeGC(dpy, gc, GCForeground, &gcv);
+		    XFillRectangle(dpy, canvas, gc, rect.r.x, rect.r.y,
+				   rect.r.w, rect.r.h);
+
+		    for (j = 0; j < hdr.nSubrects; j++) {
+			if (!ReadExact(rfbsock, (char *)&pix16, 2))
+			    return False;
+
+			if (!ReadExact(rfbsock, (char *)&subrect,
+					 sz_rfbRectangle))
+			    return False;
+
+			subrect.x = Swap16IfLE(subrect.x);
+			subrect.y = Swap16IfLE(subrect.y);
+			subrect.w = Swap16IfLE(subrect.w);
+			subrect.h = Swap16IfLE(subrect.h);
+
+			gcv.foreground = pix16;
+			XChangeGC(dpy, gc, GCForeground, &gcv);
+			XFillRectangle(dpy, canvas, gc, rect.r.x + subrect.x,
+				       rect.r.y + subrect.y, subrect.w,
+				       subrect.h);
+		    }
+		    break;
+
+		case 32:
+		    if (!ReadExact(rfbsock, (char *)&pix32, 4))
+			return False;
+
+		    gcv.foreground = pix32;
+		    XChangeGC(dpy, gc, GCForeground, &gcv);
+		    XFillRectangle(dpy, canvas, gc, rect.r.x, rect.r.y,
+				   rect.r.w, rect.r.h);
+
+		    for (j = 0; j < hdr.nSubrects; j++) {
+			if (!ReadExact(rfbsock, (char *)&pix32, 4))
+			    return False;
+
+			if (!ReadExact(rfbsock, (char *)&subrect,
+					 sz_rfbRectangle))
+			    return False;
+
+			subrect.x = Swap16IfLE(subrect.x);
+			subrect.y = Swap16IfLE(subrect.y);
+			subrect.w = Swap16IfLE(subrect.w);
+			subrect.h = Swap16IfLE(subrect.h);
+
+			gcv.foreground = pix32;
+			XChangeGC(dpy, gc, GCForeground, &gcv);
+			XFillRectangle(dpy, canvas, gc, rect.r.x + subrect.x,
+				       rect.r.y + subrect.y, subrect.w,
+				       subrect.h);
+		    }
+		    break;
+		}
+		break;
+	    }
+
+	    case rfbEncodingCoRRE:
+	    {
+		rfbRREHeader hdr;
+		CARD8 pix8;
+		CARD16 pix16;
+		CARD32 pix32;
+		XGCValues gcv;
+		int j;
+		CARD8 *ptr;
+		register int x, y, w, h;
+
+		if (!ReadExact(rfbsock, (char *)&hdr, sz_rfbRREHeader))
+		    return False;
+
+		hdr.nSubrects = Swap32IfLE(hdr.nSubrects);
+
+		switch (myFormat.bitsPerPixel) {
+
+		case 8:
+		    if (!ReadExact(rfbsock, (char *)&pix8, 1))
+			return False;
+
+		    gcv.foreground = (useBGR233 ? BGR233ToPixel[pix8]
+				      : pix8);
+		    XChangeGC(dpy, gc, GCForeground, &gcv);
+		    XFillRectangle(dpy, canvas, gc, rect.r.x, rect.r.y,
+				   rect.r.w, rect.r.h);
+
+		    if (!ReadExact(rfbsock, buffer, hdr.nSubrects * 5))
+			return False;
+
+		    ptr = (CARD8 *)buffer;
+
+		    for (j = 0; j < hdr.nSubrects; j++) {
+			pix8 = *ptr++;
+			x = *ptr++;
+			y = *ptr++;
+			w = *ptr++;
+			h = *ptr++;
+			gcv.foreground = (useBGR233 ? BGR233ToPixel[pix8]
+					  : pix8);
+			XChangeGC(dpy, gc, GCForeground, &gcv);
+			XFillRectangle(dpy, canvas, gc, rect.r.x + x,
+				       rect.r.y + y, w, h);
+		    }
+		    break;
+
+		case 16:
+		    if (!ReadExact(rfbsock, (char *)&pix16, 2))
+			return False;
+
+		    gcv.foreground = pix16;
+		    XChangeGC(dpy, gc, GCForeground, &gcv);
+		    XFillRectangle(dpy, canvas, gc, rect.r.x, rect.r.y,
+				   rect.r.w, rect.r.h);
+
+		    if (!ReadExact(rfbsock, buffer, hdr.nSubrects * 6))
+			return False;
+
+		    ptr = (CARD8 *)buffer;
+
+		    for (j = 0; j < hdr.nSubrects; j++) {
+			pix16 = *(CARD16 *)ptr;
+			ptr += 2;
+			x = *ptr++;
+			y = *ptr++;
+			w = *ptr++;
+			h = *ptr++;
+			gcv.foreground = pix16;
+			XChangeGC(dpy, gc, GCForeground, &gcv);
+			XFillRectangle(dpy, canvas, gc, rect.r.x + x,
+				       rect.r.y + y, w, h);
+		    }
+		    break;
+
+		case 32:
+		    if (!ReadExact(rfbsock, (char *)&pix32, 4))
+			return False;
+
+		    gcv.foreground = pix32;
+		    XChangeGC(dpy, gc, GCForeground, &gcv);
+		    XFillRectangle(dpy, canvas, gc, rect.r.x, rect.r.y,
+				   rect.r.w, rect.r.h);
+
+		    if (!ReadExact(rfbsock, buffer, hdr.nSubrects * 8))
+			return False;
+
+		    ptr = (CARD8 *)buffer;
+
+		    for (j = 0; j < hdr.nSubrects; j++) {
+			pix32 = *(CARD32 *)ptr;
+			ptr += 4;
+			x = *ptr++;
+			y = *ptr++;
+			w = *ptr++;
+			h = *ptr++;
+			gcv.foreground = pix32;
+			XChangeGC(dpy, gc, GCForeground, &gcv);
+			XFillRectangle(dpy, canvas, gc, rect.r.x + x,
+				       rect.r.y + y, w, h);
+		    }
+		    break;
+		}
+		break;
+	    }
+
+	    case rfbEncodingHextile:
+	    {
+		switch (myFormat.bitsPerPixel) {
+		case 8:
+		    if (!HandleHextileEncoding8(rect.r.x, rect.r.y,
+						rect.r.w, rect.r.h))
+			return False;
+		    break;
+		case 16:
+		    if (!HandleHextileEncoding16(rect.r.x, rect.r.y,
+						 rect.r.w, rect.r.h))
+			return False;
+		    break;
+		case 32:
+		    if (!HandleHextileEncoding32(rect.r.x, rect.r.y,
+						 rect.r.w, rect.r.h))
+			return False;
+		    break;
+		}
+		break;
+	    }
+
+	    default:
+		fprintf(stderr,"%s: unknown rect encoding %d\n",programName,
+		       (int)rect.encoding);
+		return False;
+	    }
+	}
+
+	sendUpdateRequest = True;
+
+	break;
+    }
+
+    case rfbBell:
+	XBell(dpy,100);
+	break;
+
+    case rfbServerCutText:
+    {
+#ifndef NANOX
+	char *str;
+
+	if (!ReadExact(rfbsock, ((char *)&msg) + 1,
+			 sz_rfbServerCutTextMsg - 1))
+	    return False;
+
+	msg.sct.length = Swap32IfLE(msg.sct.length);
+
+	str = malloc(msg.sct.length);
+
+	if (!ReadExact(rfbsock, str, msg.sct.length))
+	    return False;
+
+	XSelectInput(dpy, DefaultRootWindow(dpy), 0);
+	XStoreBytes(dpy, str, msg.sct.length);
+	XSetSelectionOwner(dpy, XA_PRIMARY, None, CurrentTime);
+	XSelectInput(dpy, DefaultRootWindow(dpy), PropertyChangeMask);
+
+	free(str);
+#endif /* !NANOX*/
+	break;
+    }
+
+    default:
+	fprintf(stderr,"%s: unknown message type %d from VNC server\n",
+	       programName,msg.type);
+	return False;
+    }
+
+    return True;
+}
+
+
+#define GET_PIXEL8(pix, ptr) ((pix) = *(ptr)++)
+
+#define GET_PIXEL16(pix, ptr) (((CARD8*)&(pix))[0] = *(ptr)++, \
+			       ((CARD8*)&(pix))[1] = *(ptr)++)
+
+#define GET_PIXEL32(pix, ptr) (((CARD8*)&(pix))[0] = *(ptr)++, \
+			       ((CARD8*)&(pix))[1] = *(ptr)++, \
+			       ((CARD8*)&(pix))[2] = *(ptr)++, \
+			       ((CARD8*)&(pix))[3] = *(ptr)++)
+
+#define DEFINE_HEXTILE(bpp)                                                   \
+static Bool                                                                   \
+HandleHextileEncoding##bpp(int rx, int ry, int rw, int rh)                    \
+{                                                                             \
+    CARD##bpp bg, fg;                                                         \
+    XGCValues gcv;                                                            \
+    int i;                                                                    \
+    CARD8 *ptr;                                                               \
+    int x, y, w, h;                                                           \
+    int sx, sy, sw, sh;                                                       \
+    CARD8 subencoding;                                                        \
+    CARD8 nSubrects;                                                          \
+                                                                              \
+    for (y = ry; y < ry+rh; y += 16) {                                        \
+        for (x = rx; x < rx+rw; x += 16) {                                    \
+            w = h = 16;                                                       \
+            if (rx+rw - x < 16)                                               \
+                w = rx+rw - x;                                                \
+            if (ry+rh - y < 16)                                               \
+                h = ry+rh - y;                                                \
+                                                                              \
+            if (!ReadExact(rfbsock, (char *)&subencoding, 1))                 \
+                return False;                                                 \
+                                                                              \
+            if (subencoding & rfbHextileRaw) {                                \
+                if (!ReadExact(rfbsock, buffer, w * h * (bpp / 8)))           \
+                    return False;                                             \
+                                                                              \
+                CopyDataToScreen((CARD8 *)buffer, x, y, w, h);                \
+                continue;                                                     \
+            }                                                                 \
+                                                                              \
+            if (subencoding & rfbHextileBackgroundSpecified)                  \
+                if (!ReadExact(rfbsock, (char *)&bg, (bpp/8)))                \
+                    return False;                                             \
+                                                                              \
+            if ((bpp == 8) && useBGR233)                                      \
+                gcv.foreground = BGR233ToPixel[bg];                           \
+            else                                                              \
+                gcv.foreground = bg;                                          \
+                                                                              \
+            XChangeGC(dpy, gc, GCForeground, &gcv);                           \
+            XFillRectangle(dpy, canvas, gc, x, y, w, h);                      \
+                                                                              \
+            if (subencoding & rfbHextileForegroundSpecified)                  \
+                if (!ReadExact(rfbsock, (char *)&fg, (bpp/8)))                \
+                    return False;                                             \
+                                                                              \
+            if (!(subencoding & rfbHextileAnySubrects)) {                     \
+                continue;                                                     \
+            }                                                                 \
+                                                                              \
+            if (!ReadExact(rfbsock, (char *)&nSubrects, 1))                   \
+                return False;                                                 \
+                                                                              \
+            ptr = (CARD8 *)buffer;                                            \
+                                                                              \
+            if (subencoding & rfbHextileSubrectsColoured) {                   \
+                if (!ReadExact(rfbsock, buffer, nSubrects * (2 + (bpp / 8)))) \
+                    return False;                                             \
+                                                                              \
+                for (i = 0; i < nSubrects; i++) {                             \
+                    GET_PIXEL##bpp(fg, ptr);                                  \
+                    sx = rfbHextileExtractX(*ptr);                            \
+                    sy = rfbHextileExtractY(*ptr);                            \
+                    ptr++;                                                    \
+                    sw = rfbHextileExtractW(*ptr);                            \
+                    sh = rfbHextileExtractH(*ptr);                            \
+                    ptr++;                                                    \
+                    if ((bpp == 8) && useBGR233)                              \
+                        gcv.foreground = BGR233ToPixel[fg];                   \
+                    else                                                      \
+                        gcv.foreground = fg;                                  \
+                                                                              \
+                    XChangeGC(dpy, gc, GCForeground, &gcv);                   \
+                    XFillRectangle(dpy, canvas, gc, x+sx, y+sy, sw, sh);      \
+                }                                                             \
+                                                                              \
+            } else {                                                          \
+                if (!ReadExact(rfbsock, buffer, nSubrects * 2))               \
+                    return False;                                             \
+                                                                              \
+                if ((bpp == 8) && useBGR233)                                  \
+                    gcv.foreground = BGR233ToPixel[fg];                       \
+                else                                                          \
+                    gcv.foreground = fg;                                      \
+                                                                              \
+                XChangeGC(dpy, gc, GCForeground, &gcv);                       \
+                                                                              \
+                for (i = 0; i < nSubrects; i++) {                             \
+                    sx = rfbHextileExtractX(*ptr);                            \
+                    sy = rfbHextileExtractY(*ptr);                            \
+                    ptr++;                                                    \
+                    sw = rfbHextileExtractW(*ptr);                            \
+                    sh = rfbHextileExtractH(*ptr);                            \
+                    ptr++;                                                    \
+                    XFillRectangle(dpy, canvas, gc, x+sx, y+sy, sw, sh);      \
+                }                                                             \
+            }                                                                 \
+        }                                                                     \
+    }                                                                         \
+                                                                              \
+    return True;                                                              \
+}
+
+DEFINE_HEXTILE(8)
+DEFINE_HEXTILE(16)
+DEFINE_HEXTILE(32)
+
+
+/*
+ * PrintPixelFormat.
+ */
+
+void
+PrintPixelFormat(format)
+    rfbPixelFormat *format;
+{
+    if (format->bitsPerPixel == 1) {
+	fprintf(stderr,"Single bit per pixel.\n");
+	fprintf(stderr,
+		"%s significant bit in each byte is leftmost on the screen.\n",
+		(format->bigEndian ? "Most" : "Least"));
+    } else {
+	fprintf(stderr,"%d bits per pixel.\n",format->bitsPerPixel);
+	if (format->bitsPerPixel != 8) {
+	    fprintf(stderr,"%s significant byte first in each pixel.\n",
+		    (format->bigEndian ? "Most" : "Least"));
+	}
+	if (format->trueColour) {
+	    fprintf(stderr,"True colour: max red %d green %d blue %d\n",
+		    format->redMax, format->greenMax, format->blueMax);
+	    fprintf(stderr,"            shift red %d green %d blue %d\n",
+		    format->redShift, format->greenShift, format->blueShift);
+	} else {
+	    fprintf(stderr,"Uses a colour map (not true colour).\n");
+	}
+    }
+}
diff -urN lib/microwindows/src/demos/vnc/vncviewer/sockets.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/sockets.c
--- lib/microwindows/src/demos/vnc/vncviewer/sockets.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/sockets.c	2005-02-21 16:13:03.000000000 +0100
@@ -0,0 +1,300 @@
+/*
+ *  Copyright (C) 1997, 1998 Olivetti & Oracle Research Laboratory
+ *
+ *  This is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This software is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this software; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ *  USA.
+ */
+
+/*
+ * sockets.c - functions to deal with sockets.
+ */
+
+#include <unistd.h>
+#include <sys/socket.h>
+#include <errno.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <vncviewer.h>
+
+/* fix bad MIPS sys headers...*/
+#ifndef SOCK_STREAM
+#define SOCK_STREAM	2	/* <asm/socket.h>*/
+#endif
+
+void PrintInHex(char *buf, int len);
+
+Bool errorMessageFromReadExact = True;
+
+/*
+ * Read an exact number of bytes, and don't return until you've got them.
+ */
+
+Bool
+ReadExact(int sock, char *buf, int n)
+{
+    int i = 0;
+    int j;
+
+    while (i < n) {
+	j = read(sock, buf + i, (n - i));
+	if (j <= 0) {
+	    if (j < 0) {
+		fprintf(stderr,programName);
+		perror(": read");
+	    } else {
+		if (errorMessageFromReadExact) {
+		    fprintf(stderr,"%s: read failed\n",programName);
+		}
+	    }
+	    return False;
+	}
+	i += j;
+    }
+    if (debug)
+	PrintInHex(buf,n);
+    return True;
+}
+
+
+/*
+ * Write an exact number of bytes, and don't return until you've sent them.
+ */
+
+Bool
+WriteExact(int sock, char *buf, int n)
+{
+    int i = 0;
+    int j;
+
+    while (i < n) {
+	j = write(sock, buf + i, (n - i));
+	if (j <= 0) {
+	    if (j < 0) {
+		fprintf(stderr,programName);
+		perror(": write");
+	    } else {
+		fprintf(stderr,"%s: write failed\n",programName);
+	    }
+	    return False;
+	}
+	i += j;
+    }
+    return True;
+}
+
+
+/*
+ * ConnectToTcpAddr connects to the given TCP port.
+ */
+
+int
+ConnectToTcpAddr(unsigned int host, int port)
+{
+    int sock;
+    struct sockaddr_in addr;
+    int one = 1;
+
+    addr.sin_family = AF_INET;
+    addr.sin_port = htons(port);
+    addr.sin_addr.s_addr = host;
+
+    sock = socket(AF_INET, SOCK_STREAM, 0);
+    if (sock < 0) {
+	fprintf(stderr,programName);
+	perror(": ConnectToTcpAddr: socket");
+	return -1;
+    }
+
+    if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+	fprintf(stderr,programName);
+	perror(": ConnectToTcpAddr: connect");
+	close(sock);
+	return -1;
+    }
+
+    if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
+		   (char *)&one, sizeof(one)) < 0) {
+	fprintf(stderr,programName);
+	perror(": ConnectToTcpAddr: setsockopt");
+	close(sock);
+	return -1;
+    }
+
+    return sock;
+}
+
+
+
+/*
+ * ListenAtTcpPort starts listening at the given TCP port.
+ */
+
+int
+ListenAtTcpPort(int port)
+{
+    int sock;
+    struct sockaddr_in addr;
+    int one = 1;
+
+    addr.sin_family = AF_INET;
+    addr.sin_port = htons(port);
+    addr.sin_addr.s_addr = INADDR_ANY;
+
+    sock = socket(AF_INET, SOCK_STREAM, 0);
+    if (sock < 0) {
+	fprintf(stderr,programName);
+	perror(": ListenAtTcpPort: socket");
+	return -1;
+    }
+
+    if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
+		   (const char *)&one, sizeof(one)) < 0) {
+	fprintf(stderr,programName);
+	perror(": ListenAtTcpPort: setsockopt");
+	close(sock);
+	return -1;
+    }
+
+    if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+	fprintf(stderr,programName);
+	perror(": ListenAtTcpPort: bind");
+	close(sock);
+	return -1;
+    }
+
+    if (listen(sock, 5) < 0) {
+	fprintf(stderr,programName);
+	perror(": ListenAtTcpPort: listen");
+	close(sock);
+	return -1;
+    }
+
+    return sock;
+}
+
+
+/*
+ * AcceptTcpConnection accepts a TCP connection.
+ */
+
+int
+AcceptTcpConnection(int listenSock)
+{
+    int sock;
+    struct sockaddr_in addr;
+    int addrlen = sizeof(addr);
+    int one = 1;
+
+    sock = accept(listenSock, (struct sockaddr *) &addr, &addrlen);
+    if (sock < 0) {
+	fprintf(stderr,programName);
+	perror(": AcceptTcpConnection: accept");
+	return -1;
+    }
+
+    if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
+		   (char *)&one, sizeof(one)) < 0) {
+	fprintf(stderr,programName);
+	perror(": AcceptTcpConnection: setsockopt");
+	close(sock);
+	return -1;
+    }
+
+    return sock;
+}
+
+
+/*
+ * StringToIPAddr - convert a host string to an IP address.
+ */
+
+int
+StringToIPAddr(const char *str, unsigned int *addr)
+{
+    struct hostent *hp;
+
+    if ((*addr = inet_addr(str)) == -1)
+    {
+	if (!(hp = gethostbyname(str)))
+	    return 0;
+
+	*addr = *(unsigned int *)hp->h_addr;
+    }
+
+    return 1;
+}
+
+
+/*
+ * Test if the other end of a socket is on the same machine.
+ */
+
+Bool
+SameMachine(int sock)
+{
+    struct sockaddr_in peeraddr, myaddr;
+    int addrlen = sizeof(struct sockaddr_in);
+
+    getpeername(sock, (struct sockaddr *)&peeraddr, &addrlen);
+    getsockname(sock, (struct sockaddr *)&myaddr, &addrlen);
+
+    return (peeraddr.sin_addr.s_addr == myaddr.sin_addr.s_addr);
+}
+
+
+/*
+ * Print out the contents of a packet for debugging.
+ */
+
+void
+PrintInHex(char *buf, int len)
+{
+    int i, j;
+    char c, str[17];
+
+    str[16] = 0;
+
+    fprintf(stderr,"ReadExact: ");
+
+    for (i = 0; i < len; i++)
+    {
+	if ((i % 16 == 0) && (i != 0)) {
+	    fprintf(stderr,"           ");
+	}
+	c = buf[i];
+	str[i % 16] = (((c > 31) && (c < 127)) ? c : '.');
+	fprintf(stderr,"%02x ",(unsigned char)c);
+	if ((i % 4) == 3)
+	    fprintf(stderr," ");
+	if ((i % 16) == 15)
+	{
+	    fprintf(stderr,"%s\n",str);
+	}
+    }
+    if ((i % 16) != 0)
+    {
+	for (j = i % 16; j < 16; j++)
+	{
+	    fprintf(stderr,"   ");
+	    if ((j % 4) == 3) fprintf(stderr," ");
+	}
+	str[i % 16] = 0;
+	fprintf(stderr,"%s\n",str);
+    }
+
+    fflush(stderr);
+}
diff -urN lib/microwindows/src/demos/vnc/vncviewer/vncviewer.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/vncviewer.c
--- lib/microwindows/src/demos/vnc/vncviewer/vncviewer.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/vncviewer.c	2005-02-21 16:03:07.000000000 +0100
@@ -0,0 +1,175 @@
+/*
+ *  Copyright (C) 1997, 1998 Olivetti & Oracle Research Laboratory
+ *
+ *  This is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This software is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this software; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ *  USA.
+ */
+
+/*
+ * vncviewer.c - VNC viewer for nano-X.
+ */
+
+#include <vncviewer.h>
+
+static void HandleEvents(GR_EVENT *ev);
+
+int
+main(int argc, char **argv)
+{
+#ifndef NANOX
+    fd_set fds;
+    struct timeval tv, *tvp;
+    int msWait;
+#endif
+    processArgs(argc, argv);
+
+    if (listenSpecified) {
+
+#ifndef NANOX
+	listenForIncomingConnections();
+	/* returns only with a succesful connection */
+#endif
+
+    } else {
+	if (!ConnectToRFBServer(hostname, port)) exit(1);
+    }
+
+    if (!InitialiseRFBConnection(rfbsock)) exit(1);
+
+    if (!CreateXWindow()) exit(1);
+
+    if (!SetFormatAndEncodings()) {
+	ShutdownX();
+	exit(1);
+    }
+
+    if (!SendFramebufferUpdateRequest(updateRequestX, updateRequestY,
+				      updateRequestW, updateRequestH, False)) {
+	ShutdownX();
+	exit(1);
+    }
+
+    printf("nanox fd = %d, rfbsock = %d\n", ConnectionNumber(dpy), rfbsock);
+#ifdef NANOX
+    /* register the RFB socket */
+    GrRegisterInput(rfbsock);
+    /* call the nanox main loop to wait for all events */
+    while (True) {
+	GrMainLoop(HandleEvents);
+    }
+
+#else
+    while (True) {
+	/*
+	 * Always handle all X events before doing select.  This is the
+	 * simplest way of ensuring that we don't block in select while
+	 * Xlib has some events on its queue.
+	 */
+
+	if (!HandleXEvents()) {
+	    ShutdownX();
+	    exit(1);
+	}
+
+	tvp = NULL;
+
+	if (sendUpdateRequest) {
+	    gettimeofday(&tv, NULL);
+
+	    msWait = (updateRequestPeriodms +
+		      ((updateRequestTime.tv_sec - tv.tv_sec) * 1000) +
+		      ((updateRequestTime.tv_usec - tv.tv_usec) / 1000));
+
+	    if (msWait > 0) {
+		tv.tv_sec = msWait / 1000;
+		tv.tv_usec = (msWait % 1000) * 1000;
+
+		tvp = &tv;
+	    } else {
+		if (!SendIncrementalFramebufferUpdateRequest()) {
+		    ShutdownX();
+		    exit(1);
+		}
+	    }
+	}
+
+	FD_ZERO(&fds);
+	FD_SET(ConnectionNumber(dpy),&fds);
+	FD_SET(rfbsock,&fds);
+
+	if (select(FD_SETSIZE, &fds, NULL, NULL, tvp) < 0) {
+	    perror("select");
+	    ShutdownX();
+	    exit(1);
+	}
+
+	if (FD_ISSET(rfbsock, &fds)) {
+	    if (!HandleRFBServerMessage()) {
+		ShutdownX();
+		exit(1);
+	    }
+	}
+    }
+#endif	/* NANOX */
+
+    return 0;
+}
+
+#ifdef NANOX
+/*
+ * call-back routine to handle all events
+ */
+void
+HandleEvents(GR_EVENT *ev)
+{
+	struct timeval tv, *tvp;
+	int msWait;
+
+/*	printf("%2d ", ev->type);
+	fflush(stdout);
+ */
+	if (ev->type == GR_EVENT_TYPE_FDINPUT) {
+		if (!HandleRFBServerMessage()) {
+			ShutdownX();
+			exit(1);
+		}
+	} else {
+		if (!HandleXEvents(ev)) {
+		    ShutdownX();
+		    exit(1);
+		}
+	}
+	if (sendUpdateRequest) {
+	    gettimeofday(&tv, NULL);
+
+	    msWait = (updateRequestPeriodms +
+		      ((updateRequestTime.tv_sec - tv.tv_sec) * 1000) +
+		      ((updateRequestTime.tv_usec - tv.tv_usec) / 1000));
+
+	    if (msWait > 0) {
+		tv.tv_sec = msWait / 1000;
+		tv.tv_usec = (msWait % 1000) * 1000;
+
+		tvp = &tv;
+	    } else {
+		if (!SendIncrementalFramebufferUpdateRequest()) {
+		    ShutdownX();
+		    exit(1);
+		}
+	    }
+	}
+}
+#endif	/* NANOX */
+
diff -urN lib/microwindows/src/demos/vnc/vncviewer/vncviewer.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/vncviewer.h
--- lib/microwindows/src/demos/vnc/vncviewer/vncviewer.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/demos/vnc/vncviewer/vncviewer.h	2005-02-21 16:03:07.000000000 +0100
@@ -0,0 +1,244 @@
+/*
+ *  Copyright (C) 1997, 1998 Olivetti & Oracle Research Laboratory
+ *
+ *  This is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This software is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this software; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ *  USA.
+ */
+
+/*
+ * vncviewer.h
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#ifdef NANOX
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+/* required for rfbproto.h */
+typedef unsigned long  CARD32;
+typedef unsigned short CARD16;
+typedef unsigned char  CARD8;
+#else
+#include <X11/Xlib.h>
+#include <X11/Xmd.h>
+#endif
+#include <rfbproto.h>
+
+#ifdef NANOX
+/* try and map some X stuff to nano-X */
+#define Bool		GR_BOOL
+#define True		GR_TRUE
+#define	False		GR_FALSE
+#define XGCValues	GR_GC_INFO
+ 
+typedef GR_ID			Window;		/* from X.h */
+typedef GR_ID			Colormap;	/* from X.h */
+typedef CARD32			Atom;		/* from X.h */
+typedef CARD32			Time;		/* from X.h */
+
+#define None			0L		/* from X.h */
+#define CurrentTime		0L		/* from X.h */
+#define PropertyChangeMask	(1L<<22)	/* from X.h */
+#define XA_PRIMARY		((Atom) 1)	/* from Xatom.h */
+
+/* Flags used in StoreNamedColor, StoreColors */
+#define DoRed			(1<<0)
+#define DoGreen			(1<<1)
+#define DoBlue			(1<<2)
+ 
+#define ConnectionNumber(dpy)	((dpy)->fd)
+#define ScreenOfDisplay(dpy, scr)	(&(dpy)->screens[scr])
+#define DefaultScreen(dpy)	((dpy)->default_screen)
+#define DefaultRootWindow(dpy)	(ScreenOfDisplay(dpy,DefaultScreen(dpy))->root)
+#define DefaultGC(dpy, scr)	(ScreenOfDisplay(dpy,scr)->default_gc)
+
+/* data structure used by color operations */
+typedef struct {
+	unsigned long pixel;
+	unsigned short red, green, blue;
+	char flags;  /* do_red, do_green, do_blue */
+	char pad;
+} XColor;
+
+#define GCForeground	(1L<<2)
+#define GCBackground	(1L<<3)
+
+/*
+ * the Screen structure is defined in Xlib.h
+ */
+typedef struct {
+	Window root;		/* Root window id. */
+} Screen;
+/*
+ * the Display structure is defined as _XDisplay in Xlib.h
+ */
+typedef struct {
+	int fd;			/* Network socket */
+	int default_screen;	/* default screen for operations */
+	Screen *screens;	/* pointer to list of screens */
+} Display;
+
+/*
+ * the XEvent union is defined in Xlib.h
+ */
+typedef struct {
+	int dummy;
+} XEvent;
+
+#endif	/* NANOX */
+
+
+extern int endianTest;
+
+#define Swap16IfLE(s) \
+    (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s))
+
+#define Swap32IfLE(l) \
+    (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \
+			     (((l) & 0x00ff0000) >> 8)  | \
+			     (((l) & 0x0000ff00) << 8)  | \
+			     (((l) & 0x000000ff) << 24))  : (l))
+
+#define MAX_ENCODINGS 10
+
+
+/* args.c */
+
+extern char *programName;
+extern char hostname[];
+extern int port;
+extern Bool listenSpecified;
+extern int listenPort, flashPort;
+extern char *displayname;
+extern Bool shareDesktop;
+extern Bool viewOnly;
+extern CARD32 explicitEncodings[];
+extern int nExplicitEncodings;
+extern Bool addCopyRect;
+extern Bool addRRE;
+extern Bool addCoRRE;
+extern Bool addHextile;
+extern Bool useBGR233;
+extern Bool forceOwnCmap;
+extern Bool forceTruecolour;
+extern int requestedDepth;
+extern char *geometry;
+extern int wmDecorationWidth;
+extern int wmDecorationHeight;
+extern char *passwdFile;
+extern int updateRequestPeriodms;
+extern int updateRequestX;
+extern int updateRequestY;
+extern int updateRequestW;
+extern int updateRequestH;
+extern int rawDelay;
+extern int copyRectDelay;
+extern Bool debug;
+
+extern void processArgs(int argc, char **argv);
+extern void usage();
+
+
+/* rfbproto.c */
+
+extern int rfbsock;
+extern Bool canUseCoRRE;
+extern Bool canUseHextile;
+extern char *desktopName;
+extern rfbPixelFormat myFormat;
+extern rfbServerInitMsg si;
+extern struct timeval updateRequestTime;
+extern Bool sendUpdateRequest;
+
+extern Bool ConnectToRFBServer(const char *hostname, int port);
+extern Bool InitialiseRFBConnection();
+extern Bool SetFormatAndEncodings();
+extern Bool SendIncrementalFramebufferUpdateRequest();
+extern Bool SendFramebufferUpdateRequest(int x, int y, int w, int h,
+					 Bool incremental);
+extern Bool SendPointerEvent(int x, int y, int buttonMask);
+extern Bool SendKeyEvent(CARD32 key, Bool down);
+extern Bool SendClientCutText(char *str, int len);
+extern Bool HandleRFBServerMessage();
+
+#ifdef NANOX
+
+/* nanox.c */
+
+extern Display *dpy;
+extern Window canvas;
+extern Colormap cmap;
+extern GR_GC_ID gc;
+extern GR_GC_ID srcGC, dstGC;
+extern unsigned long BGR233ToPixel[];
+
+extern Bool CreateXWindow();
+extern void ShutdownX();
+extern Bool HandleXEvents(GR_EVENT *ev);
+extern Bool AllXEventsPredicate(Display *dpy, XEvent *ev, char *arg);
+extern void CopyDataToScreen(CARD8 *buf, int x, int y, int width, int height);
+
+/* Xlib functions */
+extern char *XDisplayName(char *display);
+extern int XChangeGC(Display *dpy, GR_GC_ID gc, unsigned long vmask,
+	GR_GC_INFO *gcv);
+extern int XStoreColor(Display *dpy, Colormap cmap, XColor *xc);
+extern int XFillRectangle(Display *dpy, Window canvas, GR_GC_ID gc,
+	int x, int y, int w, int h);
+extern int XSync(Display *dpy, Bool discard);
+extern int XCopyArea(Display *dpy, Window src, Window dst, GR_GC_ID gc, \
+	int x1, int y1, int w, int h, int x2, int y2);
+extern int XBell(Display *dpy, int percent);
+extern int XSelectInput(Display *dpy, Window win, long evmask);
+extern int XStoreBytes(Display *dpy, char *bytes, int nbytes);
+extern int XSetSelectionOwner(Display *dpy, Atom sel, Window own, Time t);
+
+#else	/* NANOX */
+
+/* x.c */
+
+extern Display *dpy;
+extern Window canvas;
+extern Colormap cmap;
+extern GC gc;
+extern GC srcGC, dstGC;
+extern unsigned long BGR233ToPixel[];
+
+extern Bool CreateXWindow();
+extern void ShutdownX();
+extern Bool HandleXEvents();
+extern Bool AllXEventsPredicate(Display *dpy, XEvent *ev, char *arg);
+extern void CopyDataToScreen(CARD8 *buf, int x, int y, int width, int height);
+
+#endif	/* NANOX */
+
+/* sockets.c */
+
+extern Bool errorMessageFromReadExact;
+
+extern Bool ReadExact(int sock, char *buf, int n);
+extern Bool WriteExact(int sock, char *buf, int n);
+extern int ListenAtTcpPort(int port);
+extern int ConnectToTcpAddr(unsigned int host, int port);
+extern int AcceptTcpConnection(int listenSock);
+extern int StringToIPAddr(const char *str, unsigned int *addr);
+extern Bool SameMachine(int sock);
+
+
+/* listen.c */
+
+extern void listenForIncomingConnections();
diff -urN lib/microwindows/src/drivers/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/Makefile
--- lib/microwindows/src/drivers/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/Makefile	2005-02-21 16:13:08.000000000 +0100
@@ -0,0 +1,317 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+ifndef TOP
+TOP = ..
+CONFIG = $(TOP)/config
+endif
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+# Some drivers use outb macro, requires -O optimization
+CFLAGS += -O
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME = libmwdrivers.a
+LIBNAMESO = libmwdrivers.so
+
+# List of objects to compile
+
+# The eCos flavor
+ifeq ($(ARCH), ECOS)
+
+OBJS += fblin1.o fblin2.o fblin4.o fblin8.o fblin16.o fblin24.o fblin32.o fb.o genmem.o
+
+ifeq ($(PLATFORM), LINUX)
+OBJS += scr_ecos_gtkserver.o mou_ecos_gtkserver.o
+endif
+
+ifeq ($(PLATFORM), ASSABET)
+OBJS += scr_ecos_assabet.o mou_ecos_assabet.o
+endif
+
+ifeq ($(NOFONTSORCLIPPING), Y)
+OBJS += nofont.o
+else
+OBJS += genfont.o
+endif
+
+endif
+
+# for UNIX/Linux flavours
+ifneq ($(ARCH), ELKS)
+ifneq ($(ARCH), DJGPP)
+
+ifeq ($(FRAMEBUFFER), Y)
+OBJS += fblin8.o fblin16.o fblin24.o fblin32.o genmem.o fb.o
+
+ifeq ($(FBREVERSE), Y)
+OBJS += fblin1rev.o fblin2rev.o
+else
+OBJS += fblin1.o fblin2.o
+endif
+
+ifeq ($(FBVGA), Y)
+CFLAGS += -DFBVGA=1
+OBJS += vgaplan4.o memplan4.o
+endif
+
+ifeq ($(NOFONTSORCLIPPING), Y)
+OBJS += nofont.o
+else
+OBJS += genfont.o
+endif
+
+ifeq ($(PORTRAIT_MODE),R)
+OBJS += fbportrait_right.o
+CFLAGS += -DPORTRAIT=2
+endif
+
+ifeq ($(PORTRAIT_MODE),L)
+OBJS += fbportrait_left.o
+CFLAGS += -DPORTRAIT=1
+endif
+
+ifeq ($(ARCH), RTEMS)
+OBJS += scr_rtems.o romfont.o
+else
+OBJS += scr_fb.o
+endif
+
+ifeq ($(FBREVERSE), Y)
+OBJS += fblin4rev.o
+else
+ifeq ($(SA1100_LCD_LTLEND), Y)
+OBJS += fblin4sa1100.o
+else
+OBJS += fblin4.o
+endif
+endif
+
+ifeq ($(INVERT4BPP), Y)
+CFLAGS += -DINVERT4BPP=1
+endif
+
+# Added define to avoid compiler error for PPC
+ifeq ($(ARCH), LINUX-POWERPC)
+CFLAGS += -DARCH_LINUX_POWERPPC=1
+endif
+
+endif # FRAMEBUFER
+
+ifeq ($(VTSWITCH), Y)
+OBJS += vtswitch.o
+endif
+
+ifeq ($(X11), Y)
+OBJS += genmem.o fb.o scr_x11.o \
+	fblin1.o fblin2.o fblin4.o fblin8.o fblin16.o fblin24.o fblin32.o \
+	mou_x11.o 
+
+ifneq ($(PIPEKBD), Y)
+OBJS += kbd_x11.o
+else
+OBJS += kbd_pipe.o
+endif
+
+ifeq ($(NOFONTSORCLIPPING), Y)
+OBJS += nofont.o
+else
+OBJS += genfont.o
+endif
+
+ifeq ($(SCREEN_E15), Y)
+CFLAGS += -DSCREEN_E15=1
+endif
+
+ifeq ($(USE_EXPOSURE), Y)
+CFLAGS += -DUSE_EXPOSURE
+endif
+
+ifdef SCREEN_HEIGHT
+CFLAGS += -DSCREEN_HEIGHT=$(SCREEN_HEIGHT)
+endif
+
+ifdef SCREEN_WIDTH
+CFLAGS += -DSCREEN_WIDTH=$(SCREEN_WIDTH)
+endif
+
+ifdef SCREEN_DEPTH
+CFLAGS += -DSCREEN_DEPTH=$(SCREEN_DEPTH)
+endif
+endif # X11 stuff
+
+ifeq ($(ARCH), FREEBSD-X86)
+OBJS += scr_fbsd.o
+OBJS += genfont.o genmem.o fb.o \
+	fblin1.o fblin2.o fblin4.o fblin8.o fblin16.o fblin24.o fblin32.o
+endif
+
+ifeq ($(VGALIB), Y)
+OBJS +=	scr_svga.o genfont.o genmem.o
+endif
+
+ifeq ($(HWVGA), Y)
+OBJS +=	scr_bios.o vgainit.o genfont.o genmem.o
+endif
+
+ifneq ($(X11), Y)
+ifeq ($(GPMMOUSE), Y)
+OBJS += mou_gpm.o
+endif
+
+ifeq ($(SERMOUSE), Y)
+OBJS += mou_ser.o
+endif
+
+ifeq ($(PSIONMOUSE), Y)
+OBJS += mou_ps5.o
+endif
+
+ifeq ($(TPMOUSE), Y)
+OBJS += mou_tp.o
+endif
+
+ifeq ($(TPHELIO), Y)
+CFLAGS += -DTPHELIO=1
+OBJS += mou_tp.o
+endif
+
+ifeq ($(ADSMOUSE), Y)
+OBJS += mou_ads.o
+endif
+
+ifeq ($(YOPYMOUSE), Y)
+OBJS += mou_yopy.o
+endif
+
+ifeq ($(IPAQMOUSE), Y)
+OBJS += mou_ipaq.o
+endif
+
+ifeq ($(HARRIERMOUSE), Y)
+OBJS += mou_harrier.o
+endif
+
+ifeq ($(ARCH), FREEBSD-X86)
+OBJS += mou_fbsd.o
+endif
+
+ifeq ($(NOMOUSE), Y)
+OBJS += mou_null.o
+endif
+
+#
+# Keyboard driver specific for every system
+#
+ifneq ($(PIPEKBD), Y)
+
+ifeq ($(TTYKBD), Y)
+OBJS += kbd_tty.o
+endif
+
+ifeq ($(IPAQKBD), Y)
+OBJS += kbd_ipaq.o
+endif
+
+ifeq ($(SCANKBD), Y)
+OBJS += kbd_ttyscan.o
+endif
+
+ifeq ($(ARCH), FREEBSD-X86)
+#OBJS += kbd_fbsd.o
+OBJS += kbd_tty.o
+endif
+
+ifeq ($(NOKBD), Y)
+OBJS += kbd_null.o
+endif
+
+else
+
+OBJS += kbd_pipe.o
+
+endif # PIPEKBD != Y
+
+ifeq ($(ARCH), RTEMS)
+OBJS += input_rtems.o
+
+ifeq ($(NANOX), Y)
+OBJS += gsselect_rtems.o
+endif
+
+ifeq ($(MICROWIN), Y)
+OBJS += mwselect_rtems.o
+endif
+
+endif # RTEMS architecture
+
+
+endif # !X11
+
+endif # !ELKS
+endif # !DJGPP
+
+# For DJGPP flavor
+ifeq ($(ARCH), DJGPP)
+
+OBJS += scr_djgr.o genfont.o mou_dos.o kbd_djgr.o
+
+endif
+
+# For ELKS flavor
+ifeq ($(ARCH), ELKS)
+
+OBJS += elksutil.o romfont.o
+
+ifeq ($(ASMVGADRIVER), Y)
+OBJS += scr_bios.o elkplan4.o memplan4.o genmem.o
+endif
+
+ifeq ($(CVGADRIVER), Y)
+OBJS += scr_bios.o vgaplan4.o memplan4.o genmem.o
+endif
+
+ifeq ($(HERCDRIVER), Y)
+OBJS += scr_herc.o
+endif
+
+ifeq ($(DBGDRIVER), Y)
+OBJS += scr_debug.o genfont.o genmem.o
+endif
+
+ifeq ($(SERMOUSE), Y)
+OBJS += mou_ser.o
+endif
+
+OBJS +=	kbd_tty.o
+
+endif
+
+# uClinux on an Isicad Prisma
+ifeq ($(ARCH), UCLINUX-PRISMA)
+OBJS += scr_prsm.o genfont.o genmem.o
+ASMOBJS += asm_prsm.o
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
diff -urN lib/microwindows/src/drivers/Makefile.orig /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/Makefile.orig
--- lib/microwindows/src/drivers/Makefile.orig	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/Makefile.orig	2005-02-21 16:13:12.000000000 +0100
@@ -0,0 +1,296 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+ifndef TOP
+TOP = ..
+CONFIG = $(TOP)/config
+endif
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+# Some drivers use outb macro, requires -O optimization
+CFLAGS += -O
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME = libmwdrivers.a
+LIBNAMESO = libmwdrivers.so
+
+# List of objects to compile
+
+# for UNIX/Linux flavours
+ifneq ($(ARCH), ELKS)
+ifneq ($(ARCH), DJGPP)
+
+ifeq ($(FRAMEBUFFER), Y)
+OBJS += fblin8.o fblin16.o fblin24.o fblin32.o genmem.o fb.o
+
+ifeq ($(FBREVERSE), Y)
+OBJS += fblin1rev.o fblin2rev.o
+else
+OBJS += fblin1.o fblin2.o
+endif
+
+ifeq ($(FBVGA), Y)
+CFLAGS += -DFBVGA=1
+OBJS += vgaplan4.o memplan4.o
+endif
+
+ifeq ($(NOFONTSORCLIPPING), Y)
+OBJS += nofont.o
+else
+OBJS += genfont.o
+endif
+
+ifeq ($(PORTRAIT_MODE),R)
+OBJS += fbportrait_right.o
+CFLAGS += -DPORTRAIT=2
+endif
+
+ifeq ($(PORTRAIT_MODE),L)
+OBJS += fbportrait_left.o
+CFLAGS += -DPORTRAIT=1
+endif
+
+ifeq ($(ARCH), RTEMS)
+OBJS += scr_rtems.o romfont.o
+else
+OBJS += scr_fb.o
+endif
+
+ifeq ($(FBREVERSE), Y)
+OBJS += fblin4rev.o
+else
+ifeq ($(SA1100_LCD_LTLEND), Y)
+OBJS += fblin4sa1100.o
+else
+OBJS += fblin4.o
+endif
+endif
+
+ifeq ($(INVERT4BPP), Y)
+CFLAGS += -DINVERT4BPP=1
+endif
+
+# Added define to avoid compiler error for PPC
+ifeq ($(ARCH), LINUX-POWERPC)
+CFLAGS += -DARCH_LINUX_POWERPPC=1
+endif
+
+endif # FRAMEBUFER
+
+ifeq ($(VTSWITCH), Y)
+OBJS += vtswitch.o
+endif
+
+ifeq ($(X11), Y)
+OBJS += genmem.o fb.o scr_x11.o \
+	fblin1.o fblin2.o fblin4.o fblin8.o fblin16.o fblin24.o fblin32.o \
+	mou_x11.o 
+
+ifneq ($(PIPEKBD), Y)
+OBJS += kbd_x11.o
+else
+OBJS += kbd_pipe.o
+endif
+
+ifeq ($(NOFONTSORCLIPPING), Y)
+OBJS += nofont.o
+else
+OBJS += genfont.o
+endif
+
+ifeq ($(SCREEN_E15), Y)
+CFLAGS += -DSCREEN_E15=1
+endif
+
+ifeq ($(USE_EXPOSURE), Y)
+CFLAGS += -DUSE_EXPOSURE
+endif
+
+ifdef SCREEN_HEIGHT
+CFLAGS += -DSCREEN_HEIGHT=$(SCREEN_HEIGHT)
+endif
+
+ifdef SCREEN_WIDTH
+CFLAGS += -DSCREEN_WIDTH=$(SCREEN_WIDTH)
+endif
+
+ifdef SCREEN_DEPTH
+CFLAGS += -DSCREEN_DEPTH=$(SCREEN_DEPTH)
+endif
+endif # X11 stuff
+
+ifeq ($(ARCH), FREEBSD-X86)
+OBJS += scr_fbsd.o
+OBJS += genfont.o genmem.o fb.o \
+	fblin1.o fblin2.o fblin4.o fblin8.o fblin16.o fblin24.o fblin32.o
+endif
+
+ifeq ($(VGALIB), Y)
+OBJS +=	scr_svga.o genfont.o genmem.o
+endif
+
+ifeq ($(HWVGA), Y)
+OBJS +=	scr_bios.o vgainit.o genfont.o genmem.o
+endif
+
+ifneq ($(X11), Y)
+ifeq ($(GPMMOUSE), Y)
+OBJS += mou_gpm.o
+endif
+
+ifeq ($(SERMOUSE), Y)
+OBJS += mou_ser.o
+endif
+
+ifeq ($(PSIONMOUSE), Y)
+OBJS += mou_ps5.o
+endif
+
+ifeq ($(TPMOUSE), Y)
+OBJS += mou_tp.o
+endif
+
+ifeq ($(TPHELIO), Y)
+CFLAGS += -DTPHELIO=1
+OBJS += mou_tp.o
+endif
+
+ifeq ($(ADSMOUSE), Y)
+OBJS += mou_ads.o
+endif
+
+ifeq ($(YOPYMOUSE), Y)
+OBJS += mou_yopy.o
+endif
+
+ifeq ($(IPAQMOUSE), Y)
+OBJS += mou_ipaq.o
+endif
+
+ifeq ($(HARRIERMOUSE), Y)
+OBJS += mou_harrier.o
+endif
+
+ifeq ($(ARCH), FREEBSD-X86)
+OBJS += mou_fbsd.o
+endif
+
+ifeq ($(NOMOUSE), Y)
+OBJS += mou_null.o
+endif
+
+#
+# Keyboard driver specific for every system
+#
+ifneq ($(PIPEKBD), Y)
+
+ifeq ($(TTYKBD), Y)
+OBJS += kbd_tty.o
+endif
+
+ifeq ($(IPAQKBD), Y)
+OBJS += kbd_ipaq.o
+endif
+
+ifeq ($(SCANKBD), Y)
+OBJS += kbd_ttyscan.o
+endif
+
+ifeq ($(ARCH), FREEBSD-X86)
+#OBJS += kbd_fbsd.o
+OBJS += kbd_tty.o
+endif
+
+ifeq ($(NOKBD), Y)
+OBJS += kbd_null.o
+endif
+
+else
+
+OBJS += kbd_pipe.o
+
+endif # PIPEKBD != Y
+
+ifeq ($(ARCH), RTEMS)
+OBJS += input_rtems.o
+
+ifeq ($(NANOX), Y)
+OBJS += gsselect_rtems.o
+endif
+
+ifeq ($(MICROWIN), Y)
+OBJS += mwselect_rtems.o
+endif
+
+endif # RTEMS architecture
+
+
+endif # !X11
+
+endif # !ELKS
+endif # !DJGPP
+
+# For DJGPP flavor
+ifeq ($(ARCH), DJGPP)
+
+OBJS += scr_djgr.o genfont.o mou_dos.o kbd_djgr.o
+
+endif
+
+# For ELKS flavor
+ifeq ($(ARCH), ELKS)
+
+OBJS += elksutil.o romfont.o
+
+ifeq ($(ASMVGADRIVER), Y)
+OBJS += scr_bios.o elkplan4.o memplan4.o genmem.o
+endif
+
+ifeq ($(CVGADRIVER), Y)
+OBJS += scr_bios.o vgaplan4.o memplan4.o genmem.o
+endif
+
+ifeq ($(HERCDRIVER), Y)
+OBJS += scr_herc.o
+endif
+
+ifeq ($(DBGDRIVER), Y)
+OBJS += scr_debug.o genfont.o genmem.o
+endif
+
+ifeq ($(SERMOUSE), Y)
+OBJS += mou_ser.o
+endif
+
+OBJS +=	kbd_tty.o
+
+endif
+
+# uClinux on an Isicad Prisma
+ifeq ($(ARCH), UCLINUX-PRISMA)
+OBJS += scr_prsm.o genfont.o genmem.o
+ASMOBJS += asm_prsm.o
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
diff -urN lib/microwindows/src/drivers/asm.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/asm.h
--- lib/microwindows/src/drivers/asm.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/asm.h	2005-02-21 16:03:09.000000000 +0100
@@ -0,0 +1,87 @@
+; 26 Jul 92
+; Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+; asm.h - all asm*.s TC/MC/Aztec assembly include file
+;
+; 7/26/92 v6.3 TSC support 
+; 11/17/92 original version
+;
+; #define __LARGE__, __MEDIUM__, __SMALL__ for model
+; #define AZTEC, TURBOC, or MSC for C Compiler
+;
+; Routines included:
+;
+;	include asm.h	- start the assembly file
+;	.header		- create the code and data segs
+;	.cseg		- start the code segment
+;	.cend		- end the code segment
+;	.dseg		- start the data segment
+;	.dend		- end the data segment
+;	.dsym name,type	- declare global C data (type=word,byte)
+;	.cextp name	- reference an external C procedure, use model as type
+;	.cextrn name,type- reference external C variable and type(word,byte)
+;	.cproc name	- declare a C-accessible procedure, use model as type
+;	.cendp name	- end C procedure
+;	.center		- enter C procedure (set up BP etc)
+;	.cexit		- exit C procedure (restore BP etc)
+
+;
+; Check Model Symbol
+IFNDEF __LARGE__
+  IFNDEF __MEDIUM__
+    IFNDEF __SMALL__
+	%OUT You must supply a model symbol, __LARGE__, __SMALL__, or __MEDIUM__
+    ENDIF
+  ENDIF
+ENDIF
+;
+; Check Compiler Symbol
+IFDEF AZTEC
+	include asmaz.h
+ELSE
+  IFDEF TURBOC
+	include asmtc.h
+  ELSE
+    IFDEF MSC
+    	include asmmsc.h
+    ELSE
+      IFDEF TSC
+      	include asmtsc.h
+      ELSE
+    	%OUT You must supply a Compiler symbol, AZTEC, TURBOC, MSC or TSC.
+    	.ERR
+      ENDIF
+    ENDIF
+  ENDIF
+ENDIF
+;
+; Define other global symbols
+IFDEF __LARGE__
+LPROG	equ	1
+LDATA	equ	1
+ifdef AZTEC
+PROCP	equ	far
+else
+PROCPTR	equ	far ptr
+endif
+ENDIF
+
+IFDEF __MEDIUM__
+LPROG	equ	1
+LDATA	equ	0
+ifdef AZTEC
+PROCP	equ	far
+else
+PROCPTR	equ	far ptr
+endif
+ENDIF
+
+IFDEF __SMALL__
+LPROG	equ	0
+LDATA	equ	0
+ifdef AZTEC
+PROCP	equ	near
+else
+PROCPTR	equ	near ptr
+endif
+ENDIF
+;
diff -urN lib/microwindows/src/drivers/asm_prsm.s /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/asm_prsm.s
--- lib/microwindows/src/drivers/asm_prsm.s	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/asm_prsm.s	2005-02-21 16:03:09.000000000 +0100
@@ -0,0 +1,1203 @@
+| Routines to interface C to the graphics card in the Prisma
+| These replace the ROM routines.
+|
+| 0.1  16/02/99  G.Harvey	first created
+| 0.11 19/02/99  G.Harvey	optimise line drawing (c_ldraw4())
+| 0.2  20/02/99  G.Harvey	add read/write pixel
+| 0.3  21/02/99  G.Harvey	add video init routines
+| 0.4  23/02/99  G.Harvey	add r1pix
+| 0.41 26/02/99  G.Harvey	add w1pix
+| 0.5  27/02/99  G.Harvey	add rd_rect, wr_rect
+| 0.51 02/03/99  G.Harvey	add wr_rect5
+
+| Base addr of GC video buffer control registers
+
+GC_BASE		= 0x200440
+
+| GC Video Buffer write registers (offsets from the base addr)
+
+GCW_CE		= 0x00	| chip enable
+GCW_PSEL	= 0x04	| plane select
+GCW_INTEN	= 0x08	| intensity write data
+GCW_CMD		= 0x0c	| command
+GCW_CMAP	= 0x10	| colour map address / data
+GCW_DAC		= 0x14	| DAC / video control
+GCW_PY_SM	= 0x18	| pixel Y address / start single mem cycle
+GCW_IN_SM	= 0x1c	| intensity write data / start single mem cycle
+GCW_PX_SL	= 0x20	| pixel X address / start line
+GCW_PX_SM	= 0x24	| pixel X address / start single mem cycle
+GCW_PY		= 0x28	| pixel Y address
+GCW_PX		= 0x2c	| pixel X address
+GCW_LG1		= 0x30	| line generation algorithm
+GCW_LG2		= 0x34	| line generation algorithm
+GCW_LG3		= 0x38	| line generation algorithm
+GCW_LG4		= 0x3c	| line generation algorithm
+
+| GC Video Buffer read registers (offsets from the base addr)
+
+GCR_INTEN	= 0x00	| read intensity
+GCR_RESV	= 0x04	| reserved
+GCR_CMAP	= 0x08	| read colour map
+GCR_STATUS	= 0x0c	| read VBUSY, VBLANK status
+GCR_IN_SM	= 0x10	| read intensity / start single mem cycle
+
+	.text
+
+| Video init 1
+| from LAB_0367 at 0x00104760
+
+	.even
+.globl	init_scr
+init_scr:
+init1:
+	movel	d0,sp@-
+	movel	a0,sp@-
+	lea	GC_BASE,a0	| base of video control registers
+	clrl	a0@(GCW_LG3)
+	tstl	a0@(524)	| 0x20064c - CMD reg but inhibit command
+init1_1:
+	btst	#6,a0@(524)	| GCR_STATUS with command inhibit
+	beq	init1_1		| wait for VBLANK ? 
+init1_2:
+	btst	#5,a0@(524)	| GCR_STATUS
+	bne	init1_2		| VBLANK ?
+	clrl	a0@(GCW_CMAP)	| colour map
+	moveq	#0x17,d0
+	clrl	a0@(GCW_CMAP)
+	movel	d0,a0@(GCW_DAC)
+	moveq	#0x1b,d0
+	clrl	a0@(GCW_CMAP)
+	movel	d0,a0@(GCW_DAC)
+	moveq	#0x1f,d0
+	clrl	a0@(GCW_CMAP)
+	movel	d0,a0@(GCW_DAC)
+	moveq	#6,d0
+	moveb	d0,init_flag1	| ??
+	moveq	#7,d0
+	moveb	d0,line_flag
+	clrl	d0
+	moveb	line_flag,d1
+	btst	#2,d1
+	beq	init1_3
+	orw	#0x100,d0
+init1_3:
+	notb	d1
+	andb	#3,d1
+	orb	d1,d0
+	clrl	d1
+	moveb	init_flag1,d1
+	lsll	#5,d1
+	orl	d1,d0
+	movel	d0,a0@(GCW_DAC)
+	movel	#0x1ff,line_selmask
+	bsr	init3
+	bsr	init2
+	moveal	sp@+,a0
+	movel	sp@+,d0
+	rts
+
+| Video init 2
+| LAB_036B at 0x0010047f4
+
+	.even
+init2:
+	link	a6,#0
+	moveml	d2-d7/a2-a5,sp@-
+	moveal	#0x118808,a3
+	clrw	init_flag2
+init2_1:
+	moveq	#0x10,d0
+	cmpw	init_flag2,d0
+	ble	init2_7
+	movew	init_flag2,init_flag3
+	moveb	a3@+,d7
+	andw	#0xff,d7
+	moveb	a3@+,d6
+	extw	d6
+	moveb	a3@+,d5
+	andw	#0xff,d5
+	moveb	a3@+,d4
+	extw	d4
+	moveb	a3@+,d3
+	andw	0xff,d3
+	moveb	a3@+,d2
+	extw	d2
+	moveal	init_flag4,a2
+	clrw	init_flag5
+init2_2:
+	moveq	#16,d0
+	cmpw	init_flag5,d0	| 06F4
+	ble	init2_6
+	movew	init_flag3,d1	| 06F8
+	extl	d1
+	moveq	#24,d0
+	lsll	d0,d1
+	movel	d1,init_flag6	| 6F0
+	movew	d7,d1
+	extl	d1
+	moveq	#16,d0
+	lsll	d0,d1
+	orl	d1,init_flag6	| 6F0
+	movew	d5,d1
+	extl	d1
+	lsll	#8,d1
+	orl	d1,init_flag6	| 6F0
+	movew	d3,d1
+	extl	d1
+	orl	d1,init_flag6
+	movel	init_flag6,a2@+	| store map entry in table
+	movew	d7,d1
+	extl	d1
+	movew	d6,d0
+	extl	d0
+	addl	d0,d1
+	movew	d1,d7
+	movew	d5,d0
+	extl	d0
+	movew	d4,d1
+	extl	d1
+	addl	d1,d0
+	movew	d0,d5
+	movew	d3,d0
+	extl	d0
+	movew	d2,d1
+	extl	d1
+	addl	d1,d0
+	movew	d0,d3
+	cmpw	#0xff,d7
+	ble	init2_3
+	movew	#0xff,d7
+init2_3:
+	cmpw	#0xff,d5
+	ble	init2_4
+	movew	#0xff,d5
+init2_4:
+	cmpw	#0xff,d3
+	ble	init2_5
+	movew	#0xff,d3
+init2_5:
+	moveq	#16,d0
+	addw	d0,init_flag3	| 06F8
+	addqw	#1,init_flag5	| 06F4
+	bra	init2_2
+init2_6:
+	pea	init_flag4	| start of colour map
+	moveq	#16,d0		| no. of entries
+	movel	d0,sp@-
+	bsr	c_pcmap	| write colour map to video board
+	addql	#8,sp
+	addqw	#1,init_flag2	| 06F6
+	bra	init2_1
+init2_7:
+	moveml	sp@+,d2-d7/a2-a5
+	unlk	a6
+	rts
+
+
+| C entry to program the colour map
+| c_pcmap(int len, int *map)
+|
+| the format of the map appears to be an array of longwords, each word
+| contains an index value and the values for R, G and B, all 8 bits.
+| Format is: :INDEX:RED:GREEN:BLUE:
+
+	.even
+.globl	c_pcmap
+c_pcmap:
+	link	a6,#0
+	movel	a5,sp@-
+	movel	d7,sp@-
+	moveal	a6@(12),a5	| point to colour map
+	movel	a6@(8),d7	| no. of entries
+	bsr	pcmap1
+	movel	sp@+,d7
+	moveal	sp@+,a5
+	unlk	a6
+	rts
+
+| program colour map 1
+| looks like you can only set a maximum of 127 entries at a time
+
+	.even
+pcmap1:
+	moveml	d0-d7/a0-a6,sp@-
+	moveq	#0x17,d0
+	moveq	#0x1b,d1
+	moveq	#0x1f,d2
+	subql	#1,d7
+	btst	#7,d7
+	bne	pcmap1_1	| bra if more than 127 entries
+	bsr	pcmap2
+	bra	pcmap1_2	| done
+pcmap1_1:
+	subl	#0x7f,d7
+	movel	d7,sp@-
+	moveq	#0x7f,d7
+	bsr	pcmap2		| first 127 entries
+	movel	sp@+,d7
+	bsr	pcmap2		| remainder of entries
+pcmap1_2:
+	moveml	sp@+,d0-d7/a0-a6
+	rts
+
+| program colour map 2
+| this subroutine actually writes to the colour map on the video
+| board
+
+	.even
+pcmap2:
+	lea	GC_BASE,a0	| pint to control registers
+	tstl	a0@(524)	| wait for VBLANK
+pcmap2_1:
+	btst	#6,a0@(524)
+	beq	pcmap2_1
+pcmap2_2:
+	btst	#6,a0@(524)
+	bne	pcmap2_2
+pcmap2_3:
+	movel	a5@+,d3		| map entry
+	movew	d3,d5
+	swap	d3
+	movel	d5,d4
+	rorl	#8,d4
+	movel	d3,a0@(GCW_CMAP) | upper 8 bits is addr, lower is data
+	movel	d0,a0@(GCW_DAC)	| write RED
+	moveb	d4,d3
+	movel	d3,a0@(GCW_CMAP)
+	movel	d1,a0@(GCW_DAC)	| write GREEN
+	moveb	d5,d3
+	movel	d3,a0@(GCW_CMAP)
+	movel	d2,a0@(GCW_DAC)	| write BLUE
+	tstw	d7
+	dbeq	d7,pcmap2_3	| loop
+	clrl	a0@(GCW_CMAP)
+	clrl	d0
+|	moveb	line_flag,d1
+	moveb	#7,d1		| line_flag when ROM monitor active
+	btst	#2,d1
+	beq	pcmap2_4
+	orw	#0x100,d0	| overlay on
+pcmap2_4:
+	notb	d1
+	andb	#3,d1
+	orb	d1,d0
+	clrl	d1
+|	moveb	init_flag1,d1
+	moveb	#6,d1		| init_flag1 when ROM monitor active
+	lsll	#5,d1		| overlay colour ?
+	orl	d1,d0
+	movel	d0,a0@(GCW_DAC)	| set overlay colour & operating mode
+	rts
+
+| Init 3
+| LAB_0389 at 0x001004b0c
+
+	.even
+init3:
+	moveml	d0-d7/a0,sp@-
+	movel	line_selmask,d6
+	moveq	#5,d7
+	clrl	d0
+	clrl	d5
+	moveq	#-1,d1
+	movel	d1,d2
+	movew	#0xfb00,d1
+	movew	#0xf602,d2
+	movel	#0x04fe,d3
+	moveq	#7,d4
+	lea	GC_BASE,a0	| base of video control registers
+init3_1:
+	movel	d0,a0@(GCW_INTEN)	| intensity
+	movel	d6,a0@(GCW_PSEL)	| plane select
+	movel	#0x0e,a0@(GCW_CMD)	| command
+	movel	d1,a0@(GCW_LG2)		| line draw
+	movel	d0,a0@(GCW_LG1)		| line draw
+	movel	d2,a0@(GCW_LG2)		| line draw
+	movel	d3,a0@(GCW_LG3)		| line draw
+	movel	d4,a0@(GCW_LG4)		| line draw
+	movel	d5,a0@(GCW_PY)		| pixel Y addr
+	movel	d0,a0@(GCW_PX_SL)	| pixel X addr, start line
+	addql	#1,d5			| incr Y addr
+	cmpw	d7,d5
+	bne	init3_1
+	clrl	d2
+	movel	#0x03fc,d3
+	moveq	#19,d0
+	moveq	#27,d1
+	movel	d6,a0@(GCW_PSEL)	| plane select
+	tstl	a0@(524)		| 0x20064c - CMD reg but inhibit cmd
+init3_2:
+	movel	a0@(524),d4
+	btst	#0x1e,d4
+	beq	init3_2
+init3_3:
+	movel	a0@(524),d4
+	btst	#0x1e,d4
+	bne	init3_3
+	movel	d0,a0@(GCW_CMD)		| command
+	movel	d2,a0@(GCW_PY_SM)	| pixel Y addr, start mem cycle
+init3_4:
+	movel	d1,a0@(GCW_CMD)		| command
+	movel	d3,a0@(GCW_PY_SM)	| pixel Y addr, start mem cycle
+	subql	#4,d3
+	bpl	init3_4
+	moveml	sp@+,d0-d7/a0
+	rts
+
+| in-lined version of ldraw
+
+	.even
+.globl	c_ldraw4
+c_ldraw4:
+	link	a6,#0
+	moveml	d0-d7/a0-a6,sp@-
+	lea	gr_data,a1	| point to data space
+	movel	a6@(8),d2	| x1
+	movel	a6@(12),d3	| y1
+	movel	a6@(16),d1	| x2
+	movel	a6@(20),d0	| y2
+	moveb	#0x03,line_flag		| magic number ?
+
+	moveq	#1,d5
+	movel	d5,a1@(40)	| set x direction flag
+	movel	d5,a1@(44)	| set y direction flag
+	subl	d2,d1		| (d1-d2)->d1, (x2 - x1) -> d1
+	movel	d1,a1@(16)	| delta-x
+
+	subl	d3,d0		| (y2 - y1) -> d0
+	movel	d0,a1@(20)	| delta-y
+	cmpl	d1,d0		| delta-y - delta-x
+	bgt	ldraw4_6	| bra if delta-y > delta-x
+	movel	d5,d0		| set d0 to 1
+	bra	ldraw4_7
+ldraw4_6:
+	clrl	d0		| set d0 to 0
+ldraw4_7:
+	movel	d0,a1@(48)	| set to 0 if delta-y > delta-x, else set to 1
+	beq	ldraw4_8	| bra if delta-y > delta-x
+	movel	a1@(20),d5	| delta-y to d5
+	lsll	#1,d5		| shift left (mul by 2)
+	movel	d5,d4		| copy to d4
+	subl	a1@(16),d4	| (2 * dy) - dx -> d4
+	subl	a1@(40),d4	| d4 - xdir -> d4
+	movel	a1@(16),d6	| dx -> d6
+	movel	a1@(20),d7	| dy -> d7
+	subl	d6,d7		| dy - dx -> d7
+	lsll	#1,d7		| shift left, d7 = ND/NA
+	bra	ldraw4_9
+ldraw4_8:
+	movel	a1@(16),d5	| dx
+	lsll	#1,d5		| shift left (mul by 2)
+	movel	d5,d4
+	subl	a1@(20),d4	| (2 * dx) - dy
+	subl	a1@(44),d4	| ydir
+	movel	a1@(20),d6	| dy
+	movel	a1@(16),d7	| dx
+	subl	d6,d7
+	lsll	#1,d7		| shift left, d7 = ND/NA
+ldraw4_9:
+
+| by this point, d4 = ND/NA, d5 = NB
+
+	subql	#1,d6		| d6 = NC
+	movel	a1@(40),d0	| xdir
+	lsll	#1,d0
+	orl	a1@(44),d0	| ydir
+	lsll	#1,d0
+	orl	a1@(48),d0	| SX/SY
+
+	lea	GC_BASE,a0	| point to video control registers
+	movel	a6@(24),a0@(GCW_INTEN)		| intensity
+	movel	a6@(28),a0@(GCW_PSEL)		| plane select
+	movel	#0x0e,a0@(GCW_CMD)		| write, 4x5, 1 of 20
+	tstl	a1@(16)
+	bne	ldraw41
+	tstl	a1@(20)
+	bne	ldraw41
+	movel	d3,a0@(GCW_PY)		| pixel Y addr
+	movel	d2,a0@(GCW_PX_SM)	| pixel X addr, start single mem
+	bra	ldraw4_done
+ldraw41:
+	movel	d4,a0@(GCW_LG2)		| line gen, ND15-ND0
+	movel	d5,a0@(GCW_LG1)		| line gen, NB15-NB0
+	movel	d7,a0@(GCW_LG2)		| line gen, ND15-ND0
+	movel	d6,a0@(GCW_LG3)		| line-gen, NC11-NC0
+	movel	d0,a0@(GCW_LG4)		| line-gen, SX, SY, XMAJ
+	movel	d3,a0@(GCW_PY)		| pixel Y
+	movel	d2,a0@(GCW_PX_SL)	| pixel X, start line
+ldraw4_done:
+	moveml	sp@+,d0-d7/a0-a6
+	unlk	a6
+	rts
+
+| in-lined version of ldraw including y loop counter
+
+	.even
+.globl	c_ldraw4y
+c_ldraw4y:
+	link	a6,#0
+	moveml	d0-d7/a0-a2,sp@-
+	lea	gr_data,a1	| point to data space
+	movel	a6@(8),d2	| x1
+	movel	a6@(12),d3	| y1
+	movel	a6@(20),a2	| y3
+ldraw4y_1:
+	cmpl	d3,a2
+	jge	ldraw4y_2
+	jra	ldraw4y_11
+ldraw4y_2:
+	movel	a6@(16),d1	| x2
+	movel	a6@(12),d0	| y2 = y1
+	moveb	#0x03,line_flag	| magic number ?
+
+	moveq	#1,d5
+	movel	d5,a1@(40)	| set x direction flag
+	movel	d5,a1@(44)	| set y direction flag
+	subl	d2,d1		| (d1-d2)->d1, (x2 - x1) -> d1
+	movel	d1,a1@(16)	| delta-x
+
+	subl	d3,d0		| (y2 - y1) -> d0
+	movel	d0,a1@(20)	| delta-y
+	cmpl	d1,d0		| delta-y - delta-x
+	bgt	ldraw4y_6	| bra if delta-y > delta-x
+	movel	d5,d0		| set d0 to 1
+	bra	ldraw4y_7
+ldraw4y_6:
+	clrl	d0		| set d0 to 0
+ldraw4y_7:
+	movel	d0,a1@(48)	| set to 0 if delta-y > delta-x, else set to 1
+	beq	ldraw4y_8	| bra if delta-y > delta-x
+	movel	a1@(20),d5	| delta-y to d5
+	lsll	#1,d5		| shift left (mul by 2)
+	movel	d5,d4		| copy to d4
+	subl	a1@(16),d4	| (2 * dy) - dx -> d4
+	subl	a1@(40),d4	| d4 - xdir -> d4
+	movel	a1@(16),d6	| dx -> d6
+	movel	a1@(20),d7	| dy -> d7
+	subl	d6,d7		| dy - dx -> d7
+	lsll	#1,d7		| shift left, d7 = ND/NA
+	bra	ldraw4y_9
+ldraw4y_8:
+	movel	a1@(16),d5	| dx
+	lsll	#1,d5		| shift left (mul by 2)
+	movel	d5,d4
+	subl	a1@(20),d4	| (2 * dx) - dy
+	subl	a1@(44),d4	| ydir
+	movel	a1@(20),d6	| dy
+	movel	a1@(16),d7	| dx
+	subl	d6,d7
+	lsll	#1,d7		| shift left, d7 = ND/NA
+ldraw4y_9:
+
+| by this point, d4 = ND/NA, d5 = NB
+
+	subql	#1,d6		| d6 = NC
+	movel	a1@(40),d0	| xdir
+	lsll	#1,d0
+	orl	a1@(44),d0	| ydir
+	lsll	#1,d0
+	orl	a1@(48),d0	| SX/SY
+
+	lea	GC_BASE,a0	| point to video control registers
+	movel	a6@(24),a0@(GCW_INTEN)		| intensity
+	movel	#0xff,a0@(GCW_PSEL)		| plane select
+	movel	#0x0e,a0@(GCW_CMD)		| write, 4x5, 1 of 20
+	tstl	a1@(16)
+	bne	ldraw4y_10
+	tstl	a1@(20)
+	bne	ldraw4y_10
+	movel	d3,a0@(GCW_PY)		| pixel Y addr
+	movel	d2,a0@(GCW_PX_SM)	| pixel X addr, start single mem
+	bra	ldraw4y_done
+ldraw4y_10:
+	movel	d4,a0@(GCW_LG2)		| line gen, ND15-ND0
+	movel	d5,a0@(GCW_LG1)		| line gen, NB15-NB0
+	movel	d7,a0@(GCW_LG2)		| line gen, ND15-ND0
+	movel	d6,a0@(GCW_LG3)		| line-gen, NC11-NC0
+	movel	d0,a0@(GCW_LG4)		| line-gen, SX, SY, XMAJ
+	movel	d3,a0@(GCW_PY)		| pixel Y
+	movel	d2,a0@(GCW_PX_SL)	| pixel X, start line
+ldraw4y_done:
+	addql	#1,d3		| y++
+	jra	ldraw4y_1
+ldraw4y_11:
+	moveml	sp@+,d0-d7/a0-a2
+	unlk	a6
+	rts
+
+
+| in-lined version of ldraw including y loop counter
+| this version optimised for horizontal lines
+
+	.even
+.globl	c_ldraw5y
+c_ldraw5y:
+	link	a6,#0
+	moveml	d0-d7/a0-a2,sp@-
+	lea	gr_data,a1	| point to data space
+	lea	GC_BASE,a0	| base of video control registers
+	movel	a6@(24),a0@(GCW_INTEN)	| intensity
+	movel	#0xff,a0@(GCW_PSEL)	| plane select
+	movel	a6@(8),d2	| x1
+	movel	a6@(12),d3	| y1
+	movel	a6@(16),d1	| x2
+	movel	a6@(20),a2	| y2
+
+	subl	d2,d1		| (x2 - x1) -> d1
+	clrl	d4		| d4 = (2 * dy) = NA
+	clrl	d5		| d5 = (2 * dy) = NB
+	subl	d1,d4		| (2 * dy) - dx -> d4
+	subql	#1,d4		| d4 - SX -> d4
+	movel	d1,d6		| dx -> d6
+	movel	d5,d7		| dy -> d7
+	subl	d6,d7		| dy - dx -> d7
+	lsll	#1,d7		| shift left, d7 = ND
+
+| by this point, d4 = ND, d5 = NB
+
+	subql	#1,d6		| d6 = NC
+	moveq	#7,d0		| SX, SY, XMAJ
+
+| we are drawing a series of horizontal lines, all the same length
+| so no need to re-calculate all the magic numbers each time
+
+ldraw5y_1:
+	cmpl	d3,a2		| y1 <= y2
+	jge	ldraw5y_2
+	jra	ldraw5y_12
+ldraw5y_2:
+	movel	#0x0e,a0@(GCW_CMD)	| write, 4x5, 1 of 20
+	tstl	d1			| dx
+	bne	ldraw5y_10
+	movel	d3,a0@(GCW_PY)		| pixel Y addr
+	movel	d2,a0@(GCW_PX_SM)	| pixel X addr, start single mem
+	bra	ldraw5y_11
+ldraw5y_10:
+	movel	d4,a0@(GCW_LG2)		| NA
+	movel	d5,a0@(GCW_LG1)		| NB
+	movel	d7,a0@(GCW_LG2)		| ND
+	movel	d6,a0@(GCW_LG3)		| NC
+	movel	d0,a0@(GCW_LG4)		| SX, SY, XMAJ
+	movel	d3,a0@(GCW_PY)		| pixel Y
+	movel	d2,a0@(GCW_PX_SL)	| pixel X, start line
+ldraw5y_11:
+	addql	#1,d3			| y++
+	jra	ldraw5y_1
+ldraw5y_12:
+	moveml	sp@+,d0-d7/a0-a2
+	unlk	a6
+	rts
+
+| in-lined version of ldraw including x loop counter
+| this version optimised for vertical lines
+
+	.even
+.globl	c_ldraw5x
+c_ldraw5x:
+	link	a6,#0
+	moveml	d0-d7/a0-a2,sp@-
+	lea	gr_data,a1	| point to data space
+	lea	GC_BASE,a0	| base of video control registers
+	movel	a6@(24),a0@(GCW_INTEN)	| intensity
+	movel	#0xff,a0@(GCW_PSEL)	| plane select
+	movel	a6@(8),d2	| x1
+	movel	a6@(12),d3	| y1
+	movel	a6@(20),d1	| y2
+	movel	a6@(16),a2	| x2
+
+	subl	d3,d1		| (y2 - y1) -> d1
+	clrl	d4		| d4 = (2 * dx) = NA
+	clrl	d5		| d5 = (2 * dx) = NB
+	subl	d1,d4		| (2 * dx) - dy -> d4
+	subql	#1,d4		| d4 - SY -> d4
+	movel	d1,d6		| dy -> d6
+	movel	d5,d7		| dx -> d7
+	subl	d6,d7		| dx - dy -> d7
+	lsll	#1,d7		| shift left, d7 = ND
+
+| by this point, d4 = ND, d5 = NB
+
+	subql	#1,d6		| d6 = NC
+	moveq	#6,d0		| SX, SY, XMAJ
+
+| we are drawing a series of vertical lines, all the same length
+| so no need to re-calculate all the magic numbers each time
+
+ldraw5x_1:
+	cmpl	d2,a2		| x1 <= x2
+	jge	ldraw5x_2
+	jra	ldraw5x_12
+ldraw5x_2:
+	movel	#0x0e,a0@(GCW_CMD)	| write, 4x5, 1 of 20
+	tstl	d1			| dy
+	bne	ldraw5x_10
+	movel	d3,a0@(GCW_PY)		| pixel Y addr
+	movel	d2,a0@(GCW_PX_SM)	| pixel X addr, start single mem
+	bra	ldraw5x_11
+ldraw5x_10:
+	movel	d4,a0@(GCW_LG2)		| NA
+	movel	d5,a0@(GCW_LG1)		| NB
+	movel	d7,a0@(GCW_LG2)		| ND
+	movel	d6,a0@(GCW_LG3)		| NC
+	movel	d0,a0@(GCW_LG4)		| SX, SY, XMAJ
+	movel	d3,a0@(GCW_PY)		| pixel Y
+	movel	d2,a0@(GCW_PX_SL)	| pixel X, start line
+ldraw5x_11:
+	addql	#1,d2			| x++
+	jra	ldraw5x_1
+ldraw5x_12:
+	moveml	sp@+,d0-d7/a0-a2
+	unlk	a6
+	rts
+
+| read 1 pixel from the screen, handle the bizarre layout
+
+	.even
+.globl	r1pix3
+r1pix3:
+	link	a6,#0
+	moveml	d1-d5/a0,sp@-
+	movew	#1023,d5
+	subw	a6@(14),d5	| d5 is y as 16-bit value
+	movew	d5,d4
+	andib	#0xfc,d4	| d4 is y0
+	movew	#3,d0
+	andw	d5,d0		| y & 3
+	movel	#3,d3		| ensure top word is clear
+	subw	d0,d3		| 3 - (y & 3)
+	aslw	#3,d3		| << 3
+	movel	a6@(8),d0	| x
+	divuw	#20,d0		| x % 20
+	clrw	d0		| clear quotient
+	swap	d0		| put remainder in lower 16 bits
+	divuw	#5,d0		| (x % 20) / 5
+	aslw	#3,d0		| << 3
+	addw	d0,d3		| ys in d3
+	movew	#24,d0
+	cmpw	d3,d0
+	jge	r1pix3_1
+	movew	#-32,d0
+	addw	d0,d3
+r1pix3_1:
+	lea	GC_BASE,a0		| base of video control registers
+	movel	a6@(16),a0@(GCW_PSEL)	| plane select mask
+	movel	#0x07,a0@(GCW_LG4)
+	movel	#0x66,a0@(GCW_CMD)
+	movel	a6@(8),a0@(GCW_PX)	| x
+	movel	d4,a0@(GCW_PY)		| y
+	movel	a0@(GCR_IN_SM),d0	| read intensity, start single mem cycle
+	movel	a0@(GCR_IN_SM),d0
+	movel	d0,d1
+	moveq	#0,d0
+	notb	d0		| d0 = 0xff
+	asll	d3,d0		| << fs
+	andl	d1,d0		| (ic & (0xff << fs)
+	asrl	d3,d0		| >> ys
+	andl	#0xff,d0
+	moveml	sp@+,d1-d5/a0
+	unlk	a6
+	rts
+
+| read a rectangular array of pixels from the screen
+| void rd_rect(int x1, int y1, int x2, int y2, char *buf)
+
+	.even
+.globl	rd_rect2
+rd_rect2:
+	link	a6,#0
+	moveml	d1-d7/a0-a1,sp@-
+	movel	#1023,d7
+	subl	a6@(20),d7	| d7 is y2 as 16-bit value
+	movel	d7,a6@(20)
+	movel	#1023,d6
+	subl	a6@(12),d6	| d6 is y1 as 16-bit value
+	movel	d6,a6@(12)
+	movel	a6@(8),d5	| d5 is x
+	lea	GC_BASE,a0	| base of video control registers
+	movel	a6@(24),a1	| buf
+rd_rect2_1:
+	cmpw	a6@(18),d5	| x < x2
+	jlt	rd_rect2_2
+	jra	rd_rect2_8
+rd_rect2_2:
+	movel	d5,d4		| d4 is xs
+	divuw	#20,d4		| x % 20
+	clrw	d4		| clear quotient
+	swap	d4		| remainder in lower word
+	divuw	#5,d4		| (x % 20) / 5
+	aslw	#3,d4		| ((x % 20) / 5) << 3
+rd_rect2_3:
+	cmpw	d7,d6		| y > y2
+	jgt	rd_rect2_4
+	jra	rd_rect2_7
+rd_rect2_4:
+	movel	d6,d3		| d3 is y0
+	andib	#0xfc,d3	| y & 0xfffc
+	moveq	#3,d0
+	andw	d6,d0		| y & 3
+	moveq	#3,d2		| ensure top word is clear
+	subw	d0,d2		| 3 - (y & 3)
+	aslw	#3,d2		| << 3
+	addw	d4,d2		| ys in d2
+	moveq	#24,d0
+	cmpw	d2,d0
+	jge	rd_rect2_5
+	movew	#-32,d0
+	addw	d0,d2
+rd_rect2_5:
+	movel	#0xff,a0@(GCW_PSEL)	| plane select mask
+	movel	#0x07,a0@(GCW_LG4)
+	movel	#0x66,a0@(GCW_CMD)
+	movel	d5,a0@(GCW_PX)		| x
+	movel	d3,a0@(GCW_PY)		| y0
+	movel	a0@(GCR_IN_SM),d1	| read intensity, start single mem cycle
+	movel	a0@(GCR_IN_SM),d1
+	moveq	#0,d0
+	notb	d0		| d0 = 0xff
+	asll	d2,d0		| << fs
+	andl	d1,d0		| (ic & (0xff << fs)
+	asrl	d2,d0		| >> ys
+	andl	#0xff,d0
+	moveb	d0,a1@+		| *buf++
+rd_rect2_6:
+	subqw	#1,d6		| y--
+	jra	rd_rect2_3
+rd_rect2_7:
+	addqw	#1,d5		| x++
+	movel	a6@(12),d6	| y = y1
+	jra	rd_rect2_1
+rd_rect2_8:
+	moveml	sp@+,d1-d7/a0-a1
+	unlk	a6
+	rts
+
+
+| write a rectangular array of pixels to the screen
+| void wr_rect(int x1, int y1, int x2, int y2, char *buf)
+
+	.even
+.globl	wr_rect2
+wr_rect2:
+	link	a6,#0
+	moveml	d1-d7/a0-a1,sp@-
+	movel	#1023,d7
+	subl	a6@(20),d7	| d7 is y2 as 16-bit value
+	movel	d7,a6@(20)
+	movel	#1023,d6
+	subl	a6@(12),d6	| d6 is y1 as 16-bit value
+	movel	d6,a6@(12)
+	movel	a6@(8),d5	| d5 is x
+	lea	GC_BASE,a0	| base of video control registers
+	movel	a6@(24),a1	| buf
+wr_rect2_1:
+	cmpw	a6@(18),d5	| x < x2
+	jlt	wr_rect2_2
+	jra	wr_rect2_8
+wr_rect2_2:
+	movel	d5,d4		| d4 is xs
+	divuw	#20,d4		| x % 20
+	clrw	d4		| clear quotient
+	swap	d4		| remainder in lower word
+	divuw	#5,d4		| (x % 20) / 5
+	aslw	#3,d4		| ((x % 20) / 5) << 3
+wr_rect2_3:
+	cmpw	d7,d6		| y > y2
+	jgt	wr_rect2_4
+	jra	wr_rect2_7
+wr_rect2_4:
+	movel	d6,d3		| d3 is y0
+	andib	#0xfc,d3	| y & 0xfffc
+	movel	#0xff,a0@(GCW_PSEL)	| plane select mask
+	movel	#0x07,a0@(GCW_LG4)
+	movel	#0x66,a0@(GCW_CMD)
+	movel	d5,a0@(GCW_PX)		| x
+	movel	d3,a0@(GCW_PY)		| y0
+	movel	a0@(GCR_IN_SM),d1	| read intensity, start single mem cycle
+	movel	a0@(GCR_IN_SM),d1	| d1 is ic
+	moveq	#3,d0
+	andw	d6,d0		| y & 3
+	moveq	#3,d2		| ensure top word is clear
+	subw	d0,d2		| 3 - (y & 3)
+	aslw	#3,d2		| << 3
+	addw	d4,d2		| ys in d2
+	moveq	#24,d0
+	cmpw	d2,d0
+	jge	wr_rect2_5
+	movew	#-32,d0
+	addw	d0,d2
+wr_rect2_5:
+	moveq	#0,d0
+	notb	d0		| d0 = 0xff
+	asll	d2,d0		| <<fs
+	notl	d0		| invert
+	andl	d1,d0		| (ic & (0cff << ys))
+	clrl	d1
+	moveb	a1@+,d1		| *buf++
+	asll	d2,d1		| << ys
+	orl	d1,d0
+	movel	#0xff,a0@(GCW_PSEL)	| plane select mask
+	movel	#0x07,a0@(GCW_LG4)
+	movel	#0x6e,a0@(GCW_CMD)
+	movel	d5,a0@(GCW_PX)		| x
+	movel	d3,a0@(GCW_PY)		| y0
+	movel	d0,a0@(GCW_IN_SM)	| write inten, start single mem cycle
+wr_rect2_6:
+	subqw	#1,d6		| y--
+	jra	wr_rect2_3
+wr_rect2_7:
+	addqw	#1,d5		| x++
+	movel	a6@(12),d6	| y = y1
+	jra	wr_rect2_1
+wr_rect2_8:
+	moveml	sp@+,d1-d7/a0-a1
+	unlk	a6
+	rts
+
+| write a rectangular array of pixels to the screen
+| void wr_rect4(int x1, int y1, int x2, int y2, char *buf)
+|
+| This version writes the block with the x axis as the inner loop,
+| this is slower than wr_rect2() but is necessary for the VNC
+| CopyDataToScreen() function.
+
+	.even
+.globl	wr_rect4
+wr_rect4:
+	link	a6,#0
+	moveml	d1-d7/a0-a1,sp@-
+	movel	#1023,d7
+	subl	a6@(20),d7	| d7 is y2 as 16-bit value
+	movel	d7,a6@(20)
+	movel	#1023,d6
+	subl	a6@(12),d6	| d6 is y1 as 16-bit value
+	movel	d6,a6@(12)
+	movel	a6@(8),d5	| d5 is x
+	lea	GC_BASE,a0	| base of video control registers
+	movel	a6@(24),a1	| buf
+wr_rect4_1:
+	cmpw	d7,d6		| y > y2
+	jgt	wr_rect4_2
+	jra	wr_rect4_8
+wr_rect4_2:
+	movel	d6,d3		| d3 is y0
+	andib	#0xfc,d3	| y & 0xfffc
+	moveq	#3,d0
+	andw	d6,d0		| y & 3
+	moveq	#3,d2		| ensure top word is clear
+	subw	d0,d2		| 3 - (y & 3)
+	aslw	#3,d2		| << 3
+wr_rect4_3:
+	cmpw	a6@(18),d5	| x < x2
+	jlt	wr_rect4_4
+	jra	wr_rect4_7
+wr_rect4_4:
+	movel	#0xff,a0@(GCW_PSEL)	| plane select mask
+	movel	#0x07,a0@(GCW_LG4)
+	movel	#0x66,a0@(GCW_CMD)
+	movel	d5,a0@(GCW_PX)		| x
+	movel	d3,a0@(GCW_PY)		| y0
+	movel	a0@(GCR_IN_SM),d1	| read intensity, start single mem cycle
+	movel	a0@(GCR_IN_SM),d1	| d1 is ic
+	movel	d5,d4		| d4 is xs
+	divuw	#20,d4		| x % 20
+	clrw	d4		| clear quotient
+	swap	d4		| remainder in lower word
+	divuw	#5,d4		| (x % 20) / 5
+	aslw	#3,d4		| ((x % 20) / 5) << 3
+	addw	d2,d4		| ys in d2, xs in d4
+	moveq	#24,d0
+	cmpw	d4,d0
+	jge	wr_rect4_5
+	movew	#-32,d0
+	addw	d0,d4
+wr_rect4_5:
+	moveq	#0,d0
+	notb	d0		| d0 = 0xff
+	asll	d4,d0		| <<fs
+	notl	d0		| invert
+	andl	d1,d0		| (ic & (0cff << ys))
+	clrl	d1
+	moveb	a1@+,d1		| *buf++
+	asll	d4,d1		| << ys
+	orl	d1,d0
+	movel	#0xff,a0@(GCW_PSEL)	| plane select mask
+	movel	#0x07,a0@(GCW_LG4)
+	movel	#0x6e,a0@(GCW_CMD)
+	movel	d5,a0@(GCW_PX)		| x
+	movel	d3,a0@(GCW_PY)		| y0
+	movel	d0,a0@(GCW_IN_SM)	| write inten, start single mem cycle
+wr_rect4_6:
+	addqw	#1,d5		| x++
+	jra	wr_rect4_3
+wr_rect4_7:
+	subqw	#1,d6		| y--
+	movel	a6@(8),d5	| x = x1
+	jra	wr_rect4_1
+wr_rect4_8:
+	moveml	sp@+,d1-d7/a0-a1
+	unlk	a6
+	rts
+
+| write a rectangular array of pixels to the screen
+| void wr_rect5(int x1, int y1, int x2, int y2, char *buf)
+|
+| This version writes the block with the x axis as the inner loop,
+| this is slower than wr_rect2() but is necessary for the VNC
+| CopyDataToScreen() function.
+|
+| This version uses a lookup table for the pixel mask and shift count.
+| This removes one of the divide instructions (divides are slow).
+
+	.even
+.globl	wr_rect5
+wr_rect5:
+	link	a6,#0
+	moveml	d1-d7/a0-a2,sp@-
+	movel	#1023,d7
+	subl	a6@(20),d7	| d7 is y2
+	movel	#1023,d6
+	subl	a6@(12),d6	| d6 is y1
+	movel	a6@(8),d5	| d5 is x
+	lea	GC_BASE,a0	| base of video control registers
+	movel	a6@(24),a1	| buf
+	lea	pm_tab,a2	| base of lookup table
+	movel	#0xff,a0@(GCW_PSEL)	| plane select mask
+wr_rect5_1:
+	cmpl	d7,d6		| y > y2
+	jle	wr_rect5_8
+	movel	d6,d3		| d3 is y0
+	andib	#0xfc,d3	| y & 0xfffc
+	moveq	#3,d2
+	andl	d6,d2		| y & 3
+	asll	#3,d2		| (y & 3) * 8
+wr_rect5_3:
+	cmpl	a6@(16),d5	| x < x2
+	jge	wr_rect5_7
+	movel	#0x07,a0@(GCW_LG4)
+	movel	#0x66,a0@(GCW_CMD)
+	movel	d5,a0@(GCW_PX)		| x
+	movel	d3,a0@(GCW_PY)		| y0
+	movel	a0@(GCR_IN_SM),d1	| read intensity, start single mem cycle
+	movel	a0@(GCR_IN_SM),d1	| d1 is ic
+	movel	d5,d4		| d4 is xs
+	divuw	#20,d4		| x % 20
+	clrw	d4		| clear quotient
+	swap	d4		| remainder in lower word
+	asll	#5,d4		| *32
+	addl	d2,d4		| ((x % 20) * 32) + ((y % 4) * 8)
+	movel	a2@(d4:w:1),d0	| fetch mask
+	andl	d1,d0		| (ic & mask)
+|	andl	a2@(d4:w:1),d0	| (ic & mask)
+	clrl	d1
+	moveb	a1@+,d1		| *buf++
+	addql	#4,d4
+	movel	a2@(d4:w:1),d4	| fetch shift count
+	asll	d4,d1		| << ys
+	orl	d1,d0
+	movel	#0x07,a0@(GCW_LG4)
+	movel	#0x6e,a0@(GCW_CMD)
+	movel	d5,a0@(GCW_PX)		| x
+	movel	d3,a0@(GCW_PY)		| y0
+	movel	d0,a0@(GCW_IN_SM)	| write inten, start single mem cycle
+wr_rect5_6:
+	addql	#1,d5		| x++
+	jra	wr_rect5_3
+wr_rect5_7:
+	subql	#1,d6		| y--
+	movel	a6@(8),d5	| x = x1
+	jra	wr_rect5_1
+wr_rect5_8:
+	moveml	sp@+,d1-d7/a0-a2
+	unlk	a6
+	rts
+
+| write 1 pixel to the screen, handle the bizarre layout
+
+	.even
+.globl	w1pix3
+w1pix3:
+	link	a6,#0
+	moveml	d1-d5/a0,sp@-
+	movew	#1023,d5
+	subw	a6@(14),d5	| d5 is y as 16-bit value
+	movew	d5,d4
+	andib	#0xfc,d4	| d4 is y0
+	lea	GC_BASE,a0		| base of video control registers
+	movel	a6@(16),a0@(GCW_PSEL)	| plane select mask
+	movel	#0x07,a0@(GCW_LG4)
+	movel	#0x66,a0@(GCW_CMD)
+	movel	a6@(8),a0@(GCW_PX)	| x
+	movel	d4,a0@(GCW_PY)		| y0
+	movel	a0@(GCR_IN_SM),d0	| read intensity, start single mem cycle
+	movel	a0@(GCR_IN_SM),d0	| 4 pixels in d0
+	movel	d0,d3		| ic in d3
+	movew	#3,d0
+	andw	d5,d0		| y & 3
+	movel	#3,d2		| ensure top word is clear
+	subw	d0,d2		| 3 - (y & 3)
+	aslw	#3,d2		| << 3
+	movel	a6@(8),d0	| x
+	divuw	#20,d0		| x % 20
+	clrw	d0		| clear quotient
+	swap	d0		| put remainder in lower 16 bits
+	divuw	#5,d0		| (x % 20) / 5
+	aslw	#3,d0		| << 3
+	addw	d0,d2		| ys in d2
+	movew	#24,d0
+	cmpw	d2,d0
+	jge	w1pix3_1
+	movew	#-32,d0
+	addw	d0,d2
+w1pix3_1:
+	moveq	#0,d0
+	notb	d0		| d0 = 0xff
+	asll	d2,d0		| << ys
+	notl	d0		| invert
+	andl	d3,d0		| (ic & (0xff << ys)
+	movel	a6@(20),d1	| i
+	asll	d2,d1		| i << ys
+	orl	d1,d0
+	movel	a6@(16),a0@(GCW_PSEL)	| plane select mask
+	movel	#0x07,a0@(GCW_LG4)
+	movel	#0x6e,a0@(GCW_CMD)
+	movel	a6@(8),a0@(GCW_PX)	| x
+	movel	d4,a0@(GCW_PY)		| y0
+	movel	d0,a0@(GCW_IN_SM)	| write inten, start single mem cycle
+	moveml	sp@+,d1-d5/a0
+	unlk	a6
+	rts
+
+| data
+
+	.data
+
+| lookup table for wr_rect5()
+| this gives the pixel mask and shift count to locate each pixel in 
+| the 4 x 20 array pattern used by the Prisma video board
+
+pm_tab:		.long	0x00ffffff, 24	|  0,0
+		.long	0xff00ffff, 16	|  0,1
+		.long	0xffff00ff,  8	|  0,2
+		.long	0xffffff00,  0	|  0,3
+		.long	0x00ffffff, 24	|  1,0
+		.long	0xff00ffff, 16	|  1,1
+		.long	0xffff00ff,  8	|  1,2
+		.long	0xffffff00,  0	|  1,3
+		.long	0x00ffffff, 24	|  2,0
+		.long	0xff00ffff, 16	|  2,1
+		.long	0xffff00ff,  8	|  2,2
+		.long	0xffffff00,  0	|  2,3
+		.long	0x00ffffff, 24	|  3,0
+		.long	0xff00ffff, 16	|  3,1
+		.long	0xffff00ff,  8	|  3,2
+		.long	0xffffff00,  0	|  3,3
+		.long	0x00ffffff, 24	|  4,0
+		.long	0xff00ffff, 16	|  4,1
+		.long	0xffff00ff,  8	|  4,2
+		.long	0xffffff00,  0	|  4,3
+		.long	0xffffff00,  0	|  5,0
+		.long	0x00ffffff, 24	|  5,1
+		.long	0xff00ffff, 16	|  5,2
+		.long	0xffff00ff,  8	|  5,3
+		.long	0xffffff00,  0	|  6,0
+		.long	0x00ffffff, 24	|  6,1
+		.long	0xff00ffff, 16	|  6,2
+		.long	0xffff00ff,  8	|  6,3
+		.long	0xffffff00,  0	|  7,0
+		.long	0x00ffffff, 24	|  7,1
+		.long	0xff00ffff, 16	|  7,2
+		.long	0xffff00ff,  8	|  7,3
+		.long	0xffffff00,  0	|  8,0
+		.long	0x00ffffff, 24	|  8,1
+		.long	0xff00ffff, 16	|  8,2
+		.long	0xffff00ff,  8	|  8,3
+		.long	0xffffff00,  0	|  9,0
+		.long	0x00ffffff, 24	|  9,1
+		.long	0xff00ffff, 16	|  9,2
+		.long	0xffff00ff,  8	|  9,3
+		.long	0xffff00ff,  8	| 10,0
+		.long	0xffffff00,  0	| 10,1
+		.long	0x00ffffff, 24	| 10,2
+		.long	0xff00ffff, 16	| 10,3
+		.long	0xffff00ff,  8	| 11,0
+		.long	0xffffff00,  0	| 11,1
+		.long	0x00ffffff, 24	| 11,2
+		.long	0xff00ffff, 16	| 11,3
+		.long	0xffff00ff,  8	| 12,0
+		.long	0xffffff00,  0	| 12,1
+		.long	0x00ffffff, 24	| 12,2
+		.long	0xff00ffff, 16	| 12,3
+		.long	0xffff00ff,  8	| 13,0
+		.long	0xffffff00,  0	| 13,1
+		.long	0x00ffffff, 24	| 13,2
+		.long	0xff00ffff, 16	| 13,3
+		.long	0xffff00ff,  8	| 14,0
+		.long	0xffffff00,  0	| 14,1
+		.long	0x00ffffff, 24	| 14,2
+		.long	0xff00ffff, 16	| 14,3
+		.long	0xff00ffff, 16	| 15,0
+		.long	0xffff00ff,  8	| 15,1
+		.long	0xffffff00,  0	| 15,2
+		.long	0x00ffffff, 24	| 15,3
+		.long	0xff00ffff, 16	| 16,0
+		.long	0xffff00ff,  8	| 16,1
+		.long	0xffffff00,  0	| 16,2
+		.long	0x00ffffff, 24	| 16,3
+		.long	0xff00ffff, 16	| 17,0
+		.long	0xffff00ff,  8	| 17,1
+		.long	0xffffff00,  0	| 17,2
+		.long	0x00ffffff, 24	| 17,3
+		.long	0xff00ffff, 16	| 18,0
+		.long	0xffff00ff,  8	| 18,1
+		.long	0xffffff00,  0	| 18,2
+		.long	0x00ffffff, 24	| 18,3
+		.long	0xff00ffff, 16	| 19,0
+		.long	0xffff00ff,  8	| 19,1
+		.long	0xffffff00,  0	| 19,2
+		.long	0x00ffffff, 24	| 19,3
+
+
+| temporary storage for line drawing routine
+
+gr_data:
+line_x1:	.long	0	|  0 (668)
+line_y1:	.long	0	|  4 (66c)
+line_x2:	.long	0	|  8 (670)
+line_y2:	.long	0	| 12 (674)
+		.long	0	| 16 (678)
+		.long	0	| 20 (67c)
+		.long	0	| 24 (680)
+		.long	0	| 28 (684)
+		.long	0	| 32 (688)
+		.long	0	| 36 (68c)
+line_xdir:	.long	0	| 40 (690)
+line_ydir:	.long	0	| 44 (694)
+		.long	0	| 48 (698)
+line_selmask:	.long	0	| 52 (69c)
+line_inten:	.long	0	| 56 (6A0)
+line_flag:	.word	0	| 60 (6a4)
+init_flag1:	.word	0	| 62 (6a6)
+		.long	0	| 64 (6a8)
+		.long	0	| 64 (6ac)
+init_flag4:	.long	0	| 64 (6b0)
+		.long	0	| 64 (6b4)
+		.long	0	| 64 (6b8)
+		.long	0	| 64 (6bc)
+		.long	0	| 64 (6c0)
+		.long	0	| 64 (6c4)
+		.long	0	| 64 (6c8)
+		.long	0	| 64 (6cc)
+		.long	0	| 64 (6d0)
+		.long	0	| 64 (6d4)
+		.long	0	| 64 (6d8)
+		.long	0	| 64 (6dc)
+		.long	0	| 64 (6e0)
+		.long	0	| 64 (6e4)
+		.long	0	| 64 (6e8)
+		.long	0	| 64 (6ec)
+init_flag6:	.long	0	| 64 (6f0)
+init_flag5:	.word	0	| 64 (6f4)
+init_flag2:	.word	0	| 64 (6f6)
+init_flag3:	.word	0	| 64 (6f8)
+
+
diff -urN lib/microwindows/src/drivers/asmbios.s /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/asmbios.s
--- lib/microwindows/src/drivers/asmbios.s	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/asmbios.s	2005-02-21 16:03:09.000000000 +0100
@@ -0,0 +1,76 @@
+; Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+;
+; int10 bios video function access
+; int16 bios keyboard access
+;
+; assembly language routines for MSDOS Microsoft C v5.10
+;
+; assemble with masm -Mx -D__MEDIUM__
+;
+
+
+MSC = 1
+;__MEDIUM__ = 1
+	include asm.h
+	.header
+
+	.cseg
+
+;
+; es:bp = int10(int ax,int bx)
+;	Call video bios using interrupt 10h
+;
+	.cproc	int10
+	push	bp
+	mov	bp,sp
+	push	es
+	push	ds
+	push	si
+	push	di
+
+	mov	ax,arg1[bp]	; get first arg
+	mov	bx,arg1+2[bp]	; get second arg
+	int	10h
+	mov	dx,es		; return es:bp
+	mov	ax,bp
+
+	pop	di
+	pop	si
+	pop	ds
+	pop	es
+	pop	bp
+	ret
+	.cendp	int10
+
+;
+; int kbpoll(void) - poll keyboard for char ready
+;
+	.cproc	kbpoll
+	mov	ah,01h			; read, no remove
+	int	16h
+	jz	$9			; no chars ready
+	mov	ax,1			; chars ready
+	ret
+$9:	xor	ax,ax			; no chars ready
+	ret
+	.cendp	kbpoll
+;
+; int kbread(void) - wait and read a kbd char when ready
+;
+	.cproc	kbread
+	mov	ah,00h			; read and remove
+	int	16h			; return ax
+	ret
+	.cendp	kbread
+;
+; int kbflags(void) - return kbd shift status
+;
+	.cproc	kbflags
+	mov	ah,02h			; get shift status
+	int	16h
+	mov	ah,0			; low bits only for now...
+	ret
+	.cendp	kbflags
+
+	.cend
+	end
diff -urN lib/microwindows/src/drivers/asmmsc.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/asmmsc.h
--- lib/microwindows/src/drivers/asmmsc.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/asmmsc.h	2005-02-21 16:03:09.000000000 +0100
@@ -0,0 +1,119 @@
+; 30 Aug 92
+; Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+; msc.h - asm.h include for MSC Compiler
+;
+; 8/30/92 changed small model to use _TEXT only for fixup overflows
+; 7/26/92 v6.3 .center/.cexit macros for TSC
+; 11/17/90 original version
+;
+; .header - start an assembly file
+.header	macro
+ifdef __SMALL__
+_TEXT	SEGMENT  WORD PUBLIC 'CODE'
+_TEXT	ENDS
+else
+ASM_TEXT	SEGMENT  WORD PUBLIC 'CODE'
+ASM_TEXT	ENDS
+endif
+_DATA	SEGMENT  WORD PUBLIC 'DATA'
+_DATA	ENDS
+CONST	SEGMENT  WORD PUBLIC 'CONST'
+CONST	ENDS
+_BSS	SEGMENT  WORD PUBLIC 'BSS'
+_BSS	ENDS
+DGROUP	GROUP	CONST, _BSS, _DATA
+ifdef __LARGE__
+	ASSUME  CS: ASM_TEXT, DS: DGROUP, SS: DGROUP
+endif
+ifdef __MEDIUM__
+	ASSUME  CS: ASM_TEXT, DS: DGROUP		; small data
+endif
+ifdef __SMALL__
+	ASSUME  CS: _TEXT, DS: DGROUP			; small data
+endif
+_BSS	SEGMENT
+_BSS	ENDS
+	endm
+;
+; .cseg - start a code segment
+.cseg	macro
+ifdef __SMALL__
+_TEXT      SEGMENT
+	ASSUME	CS: _TEXT
+else
+ASM_TEXT      SEGMENT
+	ASSUME	CS: ASM_TEXT
+endif
+	endm
+;
+; .cend - end a code segment
+.cend	macro
+ifdef __SMALL__
+_TEXT	ENDS
+else
+ASM_TEXT	ENDS
+endif
+	endm
+;
+; .dseg - start a data segment
+.dseg	macro
+_DATA	segment word public 'DATA'
+	endm
+;
+; .dsym - define data
+.dsym	macro	name,type
+	public	_&name
+_&name	label	type
+	endm
+;
+; .dend - end a data segment
+.dend	macro
+_DATA	ends
+	endm
+;
+; .cextp name - declare an external procedure, use current model for near/far
+.cextp	macro	name
+if	LPROG
+	extrn _&name:far
+else
+	extrn _&name:near
+endif
+name&@	equ	_&name
+	endm
+;
+; .cextrn name,type - declare external C variable and type
+.cextrn	macro	name,type
+	extrn	_&name:type
+name&@	equ	DGROUP:_&name
+	endm
+;
+; .cproc name - used to start a C procedure
+.cproc	macro	name
+	public _&name
+if	LPROG
+	arg1	= 6
+	_&name	proc	far
+else
+	arg1	= 4
+	_&name	proc	near
+endif
+name&@	equ	_&name
+	endm
+;
+; .cendp - end a C procedure
+.cendp macro name
+_&name	endp
+	endm
+;
+; .center - enter C procedure
+.center	macro
+	push	bp
+	mov	bp,sp
+	endm
+;
+; .cexit - exit C procedure
+.cexit	macro
+	pop	bp
+	ret
+	endm
+
diff -urN lib/microwindows/src/drivers/asmplan4.org /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/asmplan4.org
--- lib/microwindows/src/drivers/asmplan4.org	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/asmplan4.org	2005-02-21 16:13:12.000000000 +0100
@@ -0,0 +1,776 @@
+; Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+; Copyright (c) 1991 David I. Bell
+; Permission is granted to use, distribute, or modify this source,
+; provided that this copyright notice remains intact.
+;
+; EGA/VGA Screen Driver 16 color 4 planes, portable C version
+;
+; Note: this file is a replacement for vgaplan4.c, when raw
+; speed rather than portability is desired
+;
+; The algorithms for some of these routines are taken from the book:
+; Programmer's Guide to PC and PS/2 Video Systems by Richard Wilton.
+;
+; Routines to draw pixels and lines for EGA/VGA resolutions.
+; The drawing mode in the data/rotate register is not changed in this
+; module, and must be changed as necessary by the callers.
+;
+
+; Define one and only one of the following to be nonzero.
+;VGA_ET4000	= 0		; TSENG LABS ET4000 chip
+VGA_STANDARD	= 1		; standard VGA
+;EGA_STANDARD	= 0		; standard EGA
+
+
+ifdef VGA_ET4000
+PIXROWS		= 600		; number of pixels down
+PIXCOLS		= 800		; number of pixels across
+PIXBYTES	= 100		; number of bytes across
+endif
+
+ifdef VGA_STANDARD
+PIXROWS		= 480		; number of pixels down
+PIXCOLS		= 640		; number of pixels across
+PIXBYTES	= 80		; number of bytes across
+endif
+
+ifdef EGA_STANDARD
+PIXROWS		= 350		; number of pixels down
+PIXCOLS		= 640		; number of pixels across
+PIXBYTES	= 80		; number of bytes across
+endif
+
+
+CHARCOLS	= 8		; number of pixels in char widths
+CHARROWS	= 16		; number of pixels in char heights
+xCHARROWS	= 14		; number of pixels in char heights
+BITMAPSIZE	= 2		; number of bytes in GR_BITMAP
+
+
+MSC = 1
+;__MEDIUM__ = 1
+	include asm.h
+	.header
+
+	.cextrn	rom_char_addr,word	; ROM char bimap physical address
+
+	.cseg
+
+;
+; void ega_init(void)
+;
+	.cproc	ega_init
+	ret
+	.cendp	ega_init
+
+;
+; Routine to draw an arbitrary line.
+; Called from C:
+;	_ega_drawline[x1, y1, x2, y2, color];
+;
+;	draw a line in the following EGA and VGA modes:
+;	200 line 16 colors modes
+;	350 line modes
+;	640x480 16 color
+
+; argument offsets from bp
+x1	= arg1		; first X coordinate
+y1	= arg1 + 2	; first Y coordinate
+x2	= arg1 + 4	; second X coordinate
+y2	= arg1 + 6	; second Y coordinate
+color	= arg1 + 8	; pixel value
+
+; local variable offsets from bp
+rowincr	= -2		; byte increment between rows
+incr1	= -4		; first increment
+incr2	= -6		; second increment
+routine	= -8		; routine to jump to
+localstack = 8
+
+
+	.cproc	ega_drawline
+	push	bp		; setup stack frame and preserve registers
+	mov	bp, sp
+
+;
+; Make sure that the line is totally within the screen area.
+; If not, we are allowed to completely ignore the line.
+;
+	mov	ax, x1[bp]		; EAX := x1
+	cmp	ax, offset PIXCOLS	; if ((x1<0) || (x1>=PIXCOLS)) return
+	jae	badline
+	mov	ax, x2[bp]		; EAX := x2
+	cmp	ax, offset PIXCOLS	; if ((x2<0) || (x2>=PIXCOLS)) return
+	jae	badline
+	mov	ax, y1[bp]		; EAX := y1
+	cmp	ax, offset PIXROWS	; if ((y1<0) || (y1>=PIXROWS)) return
+	jae	badline
+	mov	ax, y2[bp]		; EAX := y2
+	cmp	ax, offset PIXROWS+1	; if ((y2<0) || (y2>=PIXROWS)) return
+	;;jae	badline		;; FIXME vlines fail with code in
+	jmp	lineok
+
+badline:
+	pop	bp
+	ret
+
+;
+; Here when we know the line is totally drawable.
+;
+lineok:
+	sub	sp, offset localstack
+	push	si
+	push	di
+	push	es
+
+	; configure the graphics controller
+
+	mov	dx, 03ceh	; DX := Graphics Controller port address
+	mov 	ah, color[bp]	; pixel value
+	xor	al, al		; Set/Reset register number (0)
+	out	dx, ax
+
+	mov	ax, 0f01h	; AH := bit plane mask for Enable Set/Reset
+	out	dx, ax		; AL := Enable Set/Reset register number
+
+	; check for vertical line
+
+	mov	si, offset PIXBYTES	; increment for video buffer
+	mov	cx, x2[bp]
+	sub	cx, x1[bp]	; CX := x2 - x1
+	jz	VertLine
+
+	; force x1 < x2
+
+	jns	L01		; jump if x2 > x1
+
+	neg	cx		; CX := x1 - x2
+
+	mov	bx, x2[bp]	; exchange x1 and x2
+	xchg	bx, x1[bp]
+	mov	x2[bp], bx
+
+	mov	bx, y2[bp]	; exchange y1 and y2
+	xchg	bx, y1[bp]
+	mov	y2[bp], bx
+
+	; calculate dy = ABS[y2 - y1]
+
+L01:	mov	bx, y2[bp]
+	sub	bx, y1[bp]	; BX := y2 - y1
+	jz	HorizLine
+
+	jns	L03		; jump if slope is positive
+
+	neg	bx		; BX := y1 - y2
+	neg	si		; negate increment for buffer interleave
+
+	; select appropriate routine for slope of line
+
+L03:	mov	rowincr[bp], si	; save vertical increment
+	mov	routine[bp], offset LowSlope
+	cmp	bx, cx
+	jle	L04		; jump if dy <= dx [slope <= 1]
+	mov	routine[bp], offset HighSlope
+	xchg	bx, cx	; exchange dy and dx
+
+	; calculate initial decision variable and increments
+
+L04:	shl	bx, 1		; BX := 2 * dy
+	mov	incr1[bp], bx	; incr1 := 2 * dy
+	sub	bx, cx
+	mov	si, bx		; SI := d = 2 * dy - dx
+	sub	bx, cx
+	mov	incr2[bp], bx	; incr2 := 2 * [dy - dx]
+
+	; calculate first pixel address
+
+	push	cx		; preserve register
+	mov	ax, y1[bp]	; AX := y
+	mov	bx, x1[bp]	; BX := x
+	call	PixelAddr	; AH := bit mask
+				; ES:BX -> buffer
+				; CL := bits to shift left
+
+	mov	di, bx		; es:di -> buffer
+	shl	ah, cl		; AH := bit mask in proper position
+	mov 	bl, ah		; AH,BL := bit mask
+	mov 	al, 08h		; AL := Bit Mask Register number
+
+	pop	cx		; restore register
+	inc	cx		; CX := number of pixels to draw
+
+	jmp	routine[bp]	; jump to appropriate routine for slope
+
+
+;
+; Routine for vertical lines
+;
+VertLine:
+	mov	ax, y1[bp]	; AX := y1
+	mov	bx, y2[bp]	; BX := y2
+	mov	cx, bx
+	sub	cx, ax		; CX := dy
+	jge	L31		; jump if dy >= 0
+
+	neg	cx		; force dy >= 0
+	mov	ax, bx		; AX := y2
+
+L31:	inc	cx		; CX := number of pixels to draw
+	mov	bx, x1[bp]	; BX := x
+	push	cx		; save register
+	call	PixelAddr	; AH := bit mask
+				; ES:BX -> video buffer
+				; CL := number bits to shift left
+
+; set up Graphics controller
+
+	shl	ah, cl		; AH := bit mask in proper position
+	mov 	al, 08h	; AL := Bit Mask register number
+	out	dx, ax
+
+	pop	cx		; restore register
+
+; draw the line
+
+L111:	or	es:[bx], al	; set pixel
+	add	bx, si		; increment to next line
+	loop	L111
+	jmp 	Lexit
+
+
+;
+; Routine for horizontal lines [slope = 0]
+;
+HorizLine:
+	push	ds		; preserve DS
+
+	mov	ax, y1[bp]
+	mov	bx, x1[bp]
+	call	PixelAddr	; AH := bit mask
+				; ES:BX -> video buffer
+				; CL := number bits to shift left
+	mov	di, bx		; ES:DI -> buffer
+	mov 	dh, ah		; DH := unshifted bit mask for left byte
+
+	not	dh
+	shl	dh, cl		; DH := reverse bit mask for first byte
+	not	dh		; DH := bit mask for first byte
+
+	mov	cx, x2[bp]
+	and	cl, 7
+	xor	cl, 7		; CL := number of bits to shift left
+	mov 	dl, 0ffh	; DL := unshifted bit mask for right byte
+	shl	dl, cl		; DL := bit mask for last byte
+
+	; determine byte offset of first and last pixel in the line
+
+	mov	ax, x2[bp]	; AX := x2
+	mov	bx, x1[bp]	; BX := x1
+
+	mov 	cl, 3		; bits to convert pixels to bytes
+
+	shr	ax, cl		; AX := byte offset of X2
+	shr	bx, cl		; BX := byte offset of X1
+	mov	cx, ax
+	sub	cx, bx		; CX := [number of bytes in line] - 1
+
+	; get Graphics Controller port address into DX
+
+	mov	bx, dx		; BH := bit mask for first byte
+				; BL := bit mask for last byte
+	mov	dx, 03ceh	; DX := Graphics Controller port
+	mov 	al, 8		; AL := Bit mask Register number
+
+	; make video buffer addressable through DS:SI
+
+	push	es
+	pop	ds
+	mov	si, di		; DS:SI -> video buffer
+
+	; set pixels in leftmost byte of the line
+
+	or	bh, bh
+	js	L43		; jump if byte-aligned [x1 is leftmost]
+
+	or	cx, cx
+	jnz	L42		; jump if more than one byte in the line
+
+	and	bl, bh		; BL := bit mask for the line
+	jmp short L44
+
+L42:	mov 	ah, bh		; AH := bit mask for first byte
+	out	dx, ax		; update graphics controller
+
+	movsb			; update bit planes
+	dec	cx
+
+	; use a fast 8086 machine instruction to draw the remainder of the line
+
+L43:	mov 	ah, 0ffh	; AH := bit mask
+	out	dx, ax		; update Bit Mask register
+	rep movsb		; update all pixels in the line
+
+	; set pixels in the rightmost byte of the line
+
+L44:	mov 	ah, bl		; AH := bit mask for last byte
+	out	dx, ax		; update Graphics Controller
+	movsb			; update bit planes
+
+	pop	ds		; restore ds
+	jmp short Lexit
+
+
+;
+; Routine for dy >= dx [slope <= 1]
+; ES:DI -> video buffer
+; AL = Bit Mask Register number
+; BL = bit mask for first pixel
+; CX = number of pixels to draw
+; DX = Graphics Controller port address
+; SI = decision variable
+;
+LowSlope:
+
+L10:	mov 	ah, bl		; AH := bit mask for next pixel
+
+L11:	or	ah, bl		; mask current bit position
+	ror	bl, 1		; rotate pixel value
+	jc	L14		; jump if bit mask rotated to leftmost position
+
+	; bit mask not shifted out
+
+	or	si, si		; test sign of d
+	jns	L12		; jump if d >= 0
+
+	add	si, incr1[bp]	; d := d + incr1
+	loop	L11
+
+	out	dx, ax		; update Bit Mask register
+	or	es:[di], al	; set remaining pixel[s]
+	jmp	Lexit
+
+L12:	add	si, incr2[bp]	; d := d + incr2
+	out	dx, ax		; update Bit Mask register
+
+	or	es:[di], al	; update bit planes
+
+	add	di, rowincr[bp]	; increment y
+	loop	L10
+	jmp	Lexit
+
+	; bit mask shifted out
+
+L14:	out	dx, ax		; update Bit Mask register
+
+	or	es:[di], al	; update bit planes
+	inc	di		; increment x
+
+	or	si, si	; test sign of d
+	jns	L15		; jump if non-negative
+
+	add	si, incr1[bp]	; d := d + incr1
+	loop	L10
+	jmp	Lexit
+
+L15:	add	si, incr2[bp]	; d := d + incr2
+	add	di, rowincr[bp]	; vertical increment
+	loop	L10
+	jmp	Lexit
+
+
+;
+; Routine for dy > dx [slope > 1]
+; ES:DI -> video buffer
+; AH = bit mask for first pixel
+; AL = Bit Mask register number
+; CX = number pixels to draw
+; DX = Graphics Controller port address
+; SI = decision variable
+;
+HighSlope:
+	mov	bx, rowincr[bp]	; BX := y increment
+
+L21:	out	dx, ax		; update Bit Mask register
+L21a:	or	es:[di], al	; update bit planes
+
+	add	di, bx		; increment y
+
+L22:	or	si, si		; test sign of d
+	jns	L23		; jump if d >= 0
+
+	add	si, incr1[bp]	; d := d + incr1
+	loop	L21a
+	jmp	Lexit
+
+L23:	add	si, incr2[bp]	; d := d + incr2
+	ror	ah, 1		; rotate bit mask
+	adc	di, 0		; increment DI if when mask rotated to
+				; leftmost pixel position
+	loop	L21
+;	jmp	Lexit
+
+
+	; restore default Graphics Controller state and return to caller
+
+Lexit:	xor	ax, ax		; AH := 0, AL := 0
+	out	dx, ax		; restore Set/Reset register
+
+	inc	ax		; AH := 0, AL := 1
+	out	dx, ax		; restore Enable Set/Reset register
+
+	mov	ax, 0ff08h	; AH := 0xff, AL := 0
+	out	dx, ax		; restore Bit Mask register
+
+	pop	es
+	pop	di
+	pop	si
+	mov	sp, bp		; restore registers and return
+	pop	bp
+	ret
+	.cendp	ega_drawline
+
+
+;
+; Routine to set an individual pixel value.
+; Called from C like:
+;	_ega_drawpixel[x, y, c1];
+;
+
+; argument offsets, starting with 8 bytes [eip + bp]
+x	= arg1		; X coordinate
+y	= arg1+2	; Y coordinate
+c1	= arg1+4	; pixel value
+
+
+	.cproc	ega_drawpixel
+	push	bp
+	mov	bp, sp
+	push	ds		; save registers and set up stack frame
+
+	mov	cx, x[bp]		; ECX := x
+	cmp	cx, offset PIXCOLS	; if [[x<0] || [x>=PIXCOLS]] return
+	jae	done
+
+	mov	ax, y[bp]		; EAX := y
+	cmp	ax, offset PIXROWS	; if [[y<0] || [y>=PIXROWS]] return
+	jae	done
+
+	mov	dx, offset PIXBYTES	; AX := [y * PIXBYTES]
+	mul	dx
+
+	mov	bx, cx	; BX := [x / 8]
+	shr	bx, 1
+	shr	bx, 1
+	shr	bx, 1
+
+	add	bx, ax		; BX := [y * PIXBYTES] + [x / 8]
+
+	and	cl, 07h		; CL := [x % 8]
+	xor	cl, 07h		; CL := 7 - [x % 8]
+	mov 	ch, 01h		; CH := 1 << [7 - [x % 8]]	[mask]
+	shl	ch, cl
+
+	mov	ax, 0a000h	; DS := EGA buffer segment address
+	mov	ds, ax
+
+	mov	dx, 03ceh	; graphics controller port address
+	mov	ax, 0205h	; select write mode 2
+	out	dx, ax		; [load value 2 into mode register 5]
+	mov 	al, 08h	; set the bit mask register
+	mov 	ah, ch		; [load bit mask into register 8]
+	out	dx, ax
+	mov 	al, [bx]	; dummy read to latch bit planes
+	mov	ax, c1[bp]	; pixel value
+	mov 	[bx], al	; write pixel back to bit planes
+
+	mov	ax, 0005h	; restore default write mode 0
+	out	dx, ax		; [load value 0 into mode register 5]
+	mov	ax, 0ff08h	; restore default bit mask
+	out	dx, ax		; [load value ff into register 8]
+
+done:	pop	ds		; restore registers and return
+	pop	bp
+	ret
+	.cendp	ega_drawpixel
+
+
+
+;
+; Routine to read the value of an individual pixel.
+; Called from C like:
+; 	color = readpixel(xxx, yyy);
+;
+
+xxx	= arg1			; X coordinate
+yyy	= arg1+2		; Y coordinate
+
+
+	.cproc	ega_readpixel
+	push	bp
+	mov	bp, sp
+
+;
+; Make sure that the line is totally within the screen area.
+; If not, then return a pixel value of 0.
+;
+	mov	ax, yyy[bp]		; EAX := y
+	mov	bx, xxx[bp]		; EBX := x
+	cmp	ax, offset PIXROWS	; if [[y<0] || [y>=PIXROWS]] return
+	jae	retzero
+	cmp	bx, offset PIXCOLS	; if [[x<0] || [x>=PIXCOLS]] return
+	jae	retzero
+
+	push	si
+	push	ds
+
+	mov	dx, offset PIXBYTES	; AX := [y * PIXBYTES]
+	mul	dx
+
+	mov 	cl, bl		; save low order column bits
+	shr	bx, 1		; BX := [x / 8]
+	shr	bx, 1
+	shr	bx, 1
+
+	add	bx, ax		; BX := [y * PIXBYTES] + [x / 8]
+
+	and	cl, 07h		; CL := [x % 8]
+	xor 	cl, 07h		; CL := 7 - [x % 8]
+
+	mov	dx, 0a000h	; ES := EGA buffer segment address
+	mov	ds, dx
+
+	mov 	ch, 01h		; CH := 1 << [7 - [col % 8]]  [mask]
+	shl	ch, cl		; CH := bit mask in proper position
+
+	mov	si, bx		; ES:SI -> region buffer byte
+	xor	bl, bl		; BL is used to accumulate the pixel value
+
+	mov	dx, 03ceh	; DX := Graphics Controller port
+	mov	ax, 0304h	; AH := initial bit plane number
+				; AL := Read Map Select register number
+
+L112:	out	dx, ax		; select bit plane
+	mov 	bh, [si]	; BH := byte from current bit plane
+	and	bh, ch		; mask one bit
+	neg	bh		; bit 7 of BH := 1 if masked bit = 1
+				; bit 7 of BH := 0 if masked bit = 0
+	rol	bx, 1		; bit 0 of BL := next bit from pixel value
+	dec	ah		; AH := next bit plane number
+	jge	L112
+
+	xor	ax, ax		; AL := pixel value
+	mov 	al, bl
+
+	pop	ds
+	pop	si
+	pop	bp	
+	ret
+
+retzero:
+	pop	bp
+	xor	ax, ax
+	ret
+	.cendp	ega_readpixel
+
+
+;
+; Local routine to convert row and column numbers to pixel addresses and masks.
+; Input:	EAX = row
+;		EBX = column
+; Output:
+;		AH := bit mask
+;		ES:EBX -> video buffer
+;		CL := number bits to shift left
+;
+PixelAddr:
+	push	dx
+
+	mov	dx, offset PIXBYTES	; AX := [row * PIXBYTES]
+	mul	dx
+
+	mov 	cl, bl		; save low order column bits
+	shr	bx, 1		; BX := [col / 8]
+	shr	bx, 1
+	shr	bx, 1
+
+	add	bx, ax		; BX := [row * PIXBYTES] + [col / 8]
+
+	and	cl, 07h		; CL := [col % 8]
+	xor	cl, 07h		; CL := 7 - [col % 8]
+	mov 	ah, 01h		; AH := 1 << [7 - [col % 8]]	[mask]
+
+	mov	dx, 0a000h	; ES := EGA buffer segment address
+	mov	es, dx
+
+	pop	dx
+
+	ret
+
+IF 0000
+; char _far * ega_get_rom_char_addr();
+; Call the BIOS to find out the address of the ROM character table. 
+
+	.cproc	ega_get_rom_char_addr
+	push	bp		; interrupt uses these
+	push	es
+	push	ds
+	push	si
+	push	di
+	mov	ax,1130h	; function for address of rom character table
+	mov	bx,0202h	; want address of ROM 8x14 character table
+	int	10h		; return address in es:bp
+	mov	dx,es
+	mov	ax,bp
+	pop	di
+	pop	si
+	pop	ds
+	pop	es		; restore registers and return
+	pop	bp
+	ret
+	.cendp	ega_get_rom_char_addr
+
+;
+; Routine to return the bitmap for a character from the ROM.
+; Called from C:
+;	ega_gettextbits(charnum, retbitmap, retwidth, retheight);
+;		UCHAR		charnum;
+;		IMAGEBITS	*retbitmap;
+;		COORD		*retwidth;
+;		COORD		*retheight;
+; The retbitmap is a pointer to an array of IMAGEBITS values (shorts),
+; of length CHARROWS.  Retwidth and retheight are the returned
+; width and height of the character.
+;
+
+charnum		= arg1			; character to get bitmap of
+retaddr		= arg1 + 2		; returned address of bitmap
+retwidth	= arg1 + 4		; returned width of character
+retheight	= arg1 + 6		; returned height of character
+
+	.cproc	ega_gettextbits
+	push	bp		; setup stack frame and preserve registers
+	mov	bp, sp
+	push	es
+
+	xor	ax, ax			; get character code
+	mov	al, charnum[bp]
+	mov	cx, offset CHARROWS	; get number of bytes of data for chars
+	mul	cx			; make offset into ROM bitmap table
+	mov	bx, word ptr rom_char_addr@ ; physical addr of bitmap for char
+	add	bx,ax
+	mov	es, word ptr rom_char_addr@+2
+
+	push	bp
+
+	mov	bp, retaddr[bp]		; address for returned bits
+	xor	dx, dx			; clear low order part of bitmap values
+
+getcharloop:
+	mov 	dh, es:[bx]		; get next byte of bitmap
+	mov	[bp], dx		; store in caller's buffer
+	inc	bx			; advance ROM address
+	add	bp, offset BITMAPSIZE	; and buffer address
+	loop	getcharloop		; loop until did all rows of char
+
+	pop	bp
+
+	mov	ax, offset CHARCOLS	; return width of character
+	mov	bx, retwidth[bp]
+	mov	[bx], ax
+	mov	ax, offset CHARROWS	; return height of character
+	mov	bx, retheight[bp]
+	mov	[bx], ax
+
+	pop	es			; restore registers and return
+	pop	bp
+	ret
+	.cendp	ega_gettextbits
+
+;
+; Routine to draw a text string using the ROM character bitmap.
+; If the background color is [long] -1 then it is not drawn.
+; Called from C like:
+;	ega_drawtext(xx, yy, cp, len, fg, bg);
+;
+xx	= arg1			; X coordinate
+yy	= arg1+2		; Y coordinate
+cp	= arg1+4		; character pointer
+len	= arg1+6		; length of string
+fg	= arg1+8		; foreground color
+bg	= arg1+10		; background color
+
+	.cproc	ega_drawtext
+	push	bp
+	mov	bp, sp
+	push	ds		; save registers we use
+	push	es
+	push	di
+	push	si
+
+	mov	ax, yy[bp]		; EAX := y
+	cmp	ax, offset PIXROWS	; if [[y<0] || [y>=PIXROWS]] return
+	jae	donetext
+	add	ax, offset CHARROWS-1	; convert y to top of chars
+	jl	donetext		; if not enough room, return
+
+	mov	bx, xx[bp]		; EBX := x
+	cmp	bx, offset PIXCOLS	; if [[x<0] || [x>=PIXCOLS]] return
+	jae	donetext
+
+	mov	cx, len[bp]		; see if length is non-positive
+	or	cx, cx
+	jle	donetext
+
+	cmp	cx, offset PIXCOLS	; or very large
+	jae	donetext
+
+	shl	cx, 1		; convert char length to pixel column count
+	shl cx, 1
+	shl cx, 1
+	add	cx, bx	; determine first column to not touch
+	cmp	cx, offset PIXCOLS	; see if will write off end
+	jg	donetext
+
+charloop:
+	mov	bx, cp[bp]	; get address of next character
+	xor	ax, ax
+	mov 	al, [bx]	; get next character
+	inc	bx		; increment character pointer
+	mov	cp[bp], bx	; save away
+	mov	dx,offset CHARROWS	; bytes between character bitmaps
+	mul	dx		; convert char code to offset in ROM table
+	add	ax, word ptr rom_char_addr@ ; make physical address of char bits
+	mov	si, ax		; save in source register
+
+	mov	ax, xx[bp]
+	mov	dx, offset PIXBYTES	; AX := [y * PIXBYTES]
+	mul	dx
+
+	mov 	cl, bl		; save low order column bits
+	shr	bx, 1		; BX := [x / 8]
+	shr	bx, 1
+	shr	bx, 1
+
+	add	bx, ax		; BX := [y * PIXBYTES] + [x / 8]
+
+	and	cl, 07h		; CL := [x % 8]
+	xor	cl, 07h		; CL := 7 - [x % 8]
+
+	mov	dx, 0a000h	; ES := EGA buffer segment address
+	mov	ds, dx
+
+	mov 	ch, 01h		; CH := 1 << [7 - [col % 8]]  [mask]
+	shl	ch, cl		; CH := bit mask in proper position
+
+donetext:
+	pop	si
+	pop	di
+	pop	es
+	pop	ds
+	ret
+	.cendp	ega_drawtext
+ENDIF
+
+	.cend
+	end
diff -urN lib/microwindows/src/drivers/asmplan4.s /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/asmplan4.s
--- lib/microwindows/src/drivers/asmplan4.s	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/asmplan4.s	2005-02-21 16:03:10.000000000 +0100
@@ -0,0 +1,435 @@
+; Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+; Copyright (c) 1991 David I. Bell
+; Permission is granted to use, distribute, or modify this source,
+; provided that this copyright notice remains intact.
+;
+; EGA/VGA Screen Driver 16 color 4 planes, higher speed MASM version
+;
+; Note: this file is a replacement for vgaplan4.c, when raw
+; speed rather than portability is desired
+;
+; The algorithms for some of these routines are taken from the book:
+; Programmer's Guide to PC and PS/2 Video Systems by Richard Wilton.
+;
+; Routines to draw pixels and lines for EGA/VGA resolutions.
+; The drawing mode in the data/rotate register is not changed in this
+; module, and must be changed as necessary by the callers.
+;
+PIXBYTES	= 80		; number of bytes in scan line
+
+
+MSC = 1
+;__MEDIUM__ = 1
+	include asm.h
+	.header
+
+	.cextrn	gr_mode,word	; temp kluge devdraw.c graphics draw mode
+	.dseg
+mode_table:
+	db	00h,18h,10h,08h	; vga draw modes
+
+	.cseg
+
+;
+; int ega_init(PSD psd)
+;
+	.cproc	ega_init
+	mov	ax,1		; success
+	ret
+	.cendp	ega_init
+
+;
+; Routine to draw a horizontal line.
+; Called from C:
+;	ega_drawhine(x1, x2, y, color);
+;
+;	works in the following EGA and VGA modes:
+;	200 line 16 colors modes
+;	350 line modes
+;	640x480 16 color
+
+; argument offsets from bp
+x1	= arg1		; first X coordinate
+x2	= arg1 + 2	; second X coordinate
+y	= arg1 + 4	; second Y coordinate
+color	= arg1 + 6	; pixel value
+
+	.cproc	ega_drawhline
+	push	bp		; setup stack frame and preserve registers
+	mov	bp, sp
+	push	si
+	push	di
+	push	es
+
+	; configure the graphics controller
+
+	mov	dx, 03ceh	; DX := Graphics Controller port address
+
+	mov	al, #3		; set data rotate register
+	lea	bx, mode_table
+	add	bx, @gr_mode
+	mov	ah, [bx]
+	out	dx, ax
+
+	mov 	ah, color[bp]	; pixel value
+	xor	al, al		; Set/Reset register number (0)
+	out	dx, ax
+
+	mov	ax, 0f01h	; AH := bit plane mask for Enable Set/Reset
+	out	dx, ax		; AL := Enable Set/Reset register number
+
+	push	ds		; preserve DS
+
+	mov	ax, y[bp]
+	mov	bx, x1[bp]
+
+	; compute pixel address
+	mov	dx, offset PIXBYTES	; AX := [row * PIXBYTES]
+	mul	dx
+	mov 	cl, bl		; save low order column bits
+	shr	bx, 1		; BX := [col / 8]
+	shr	bx, 1
+	shr	bx, 1
+	add	bx, ax		; BX := [row * PIXBYTES] + [col / 8]
+	and	cl, 07h		; CL := [col % 8]
+	xor	cl, 07h		; CL := 7 - [col % 8]
+	mov 	ah, 01h		; AH := 1 << [7 - [col % 8]]	[mask]
+	mov	dx, 0a000h	; ES := EGA buffer segment address
+	mov	es, dx
+				; AH := bit mask
+				; ES:BX -> video buffer
+				; CL := number bits to shift left
+	mov	di, bx		; ES:DI -> buffer
+	mov 	dh, ah		; DH := unshifted bit mask for left byte
+
+	not	dh
+	shl	dh, cl		; DH := reverse bit mask for first byte
+	not	dh		; DH := bit mask for first byte
+
+	mov	cx, x2[bp]
+	and	cl, 7
+	xor	cl, 7		; CL := number of bits to shift left
+	mov 	dl, 0ffh	; DL := unshifted bit mask for right byte
+	shl	dl, cl		; DL := bit mask for last byte
+
+	; determine byte offset of first and last pixel in the line
+
+	mov	ax, x2[bp]	; AX := x2
+	mov	bx, x1[bp]	; BX := x1
+
+	mov 	cl, 3		; bits to convert pixels to bytes
+
+	shr	ax, cl		; AX := byte offset of X2
+	shr	bx, cl		; BX := byte offset of X1
+	mov	cx, ax
+	sub	cx, bx		; CX := [number of bytes in line] - 1
+
+	; get Graphics Controller port address into DX
+
+	mov	bx, dx		; BH := bit mask for first byte
+				; BL := bit mask for last byte
+	mov	dx, 03ceh	; DX := Graphics Controller port
+	mov 	al, 8		; AL := Bit mask Register number
+
+	; make video buffer addressable through DS:SI
+
+	push	es
+	pop	ds
+	mov	si, di		; DS:SI -> video buffer
+
+	; set pixels in leftmost byte of the line
+
+	or	bh, bh
+	js	L43		; jump if byte-aligned [x1 is leftmost]
+
+	or	cx, cx
+	jnz	L42		; jump if more than one byte in the line
+
+	and	bl, bh		; BL := bit mask for the line
+	jmp short L44
+
+L42:	mov 	ah, bh		; AH := bit mask for first byte
+	out	dx, ax		; update graphics controller
+
+	movsb			; update bit planes
+	dec	cx
+
+	; use a fast 8086 machine instruction to draw the remainder of the line
+
+L43:	mov 	ah, 0ffh	; AH := bit mask
+	out	dx, ax		; update Bit Mask register
+	rep movsb		; update all pixels in the line
+
+	; set pixels in the rightmost byte of the line
+
+L44:	mov 	ah, bl		; AH := bit mask for last byte
+	out	dx, ax		; update Graphics Controller
+	movsb			; update bit planes
+
+	pop	ds		; restore ds
+
+
+	; restore default Graphics Controller state and return to caller
+	;;xor	ax, ax		; AH := 0, AL := 0
+	;;out	dx, ax		; restore Set/Reset register
+	;;inc	ax		; AH := 0, AL := 1
+	;;out	dx, ax		; restore Enable Set/Reset register
+	;;mov	ax, 0ff08h	; AH := 0xff, AL := 0
+	;;out	dx, ax		; restore Bit Mask register
+
+	pop	es
+	pop	di
+	pop	si
+	pop	bp
+	ret
+	.cendp	ega_drawhline
+
+
+;
+; Routine to draw a vertical line.
+; Called from C:
+;	ega_drawvline(x, y1, y2, color);
+;
+;	works in the following EGA and VGA modes:
+;	200 line 16 colors modes
+;	350 line modes
+;	640x480 16 color
+
+; argument offsets from bp
+x	= arg1		; first X coordinate
+y1	= arg1 + 2	; first Y coordinate
+y2	= arg1 + 4	; second Y coordinate
+color	= arg1 + 6	; pixel value
+
+	.cproc	ega_drawvline
+	push	bp		; setup stack frame and preserve registers
+	mov	bp, sp
+	push	ds
+
+	; configure the graphics controller
+
+	mov	dx, 03ceh	; DX := Graphics Controller port address
+
+	mov	al, #3		; set data rotate register
+	lea	bx, mode_table
+	add	bx, @gr_mode
+	mov	ah, [bx]
+	out	dx, ax
+
+	mov 	ah, color[bp]	; pixel value
+	xor	al, al		; Set/Reset register number (0)
+	out	dx, ax
+
+	mov	ax, 0f01h	; AH := bit plane mask for Enable Set/Reset
+	out	dx, ax		; AL := Enable Set/Reset register number
+
+	; prepare to draw vertical line
+
+	mov	ax, y1[bp]	; AX := y1
+	mov	cx, y2[bp]	; BX := y2
+	;;mov	cx, bx
+	sub	cx, ax		; CX := dy
+	;;jge	L311		; jump if dy >= 0
+	;;neg	cx		; force dy >= 0
+	;;mov	ax, bx		; AX := y2
+
+L311:	inc	cx		; CX := number of pixels to draw
+	mov	bx, x[bp]	; BX := x
+	push	cx		; save register
+
+	; compute pixel address
+	push	dx
+	mov	dx, offset PIXBYTES	; AX := [row * PIXBYTES]
+	mul	dx
+	mov 	cl, bl		; save low order column bits
+	shr	bx, 1		; BX := [col / 8]
+	shr	bx, 1
+	shr	bx, 1
+	add	bx, ax		; BX := [row * PIXBYTES] + [col / 8]
+	and	cl, 07h		; CL := [col % 8]
+	xor	cl, 07h		; CL := 7 - [col % 8]
+	mov 	ah, 01h		; AH := 1 << [7 - [col % 8]]	[mask]
+	mov	dx, 0a000h	; DS := EGA buffer segment address
+	mov	ds, dx
+	pop	dx
+				; AH := bit mask
+				; DS:BX -> video buffer
+				; CL := number bits to shift left
+
+	; set up Graphics controller
+
+	shl	ah, cl		; AH := bit mask in proper position
+	mov 	al, 08h		; AL := Bit Mask register number
+	out	dx, ax
+
+	pop	cx		; restore register
+
+	; draw the line
+
+	mov	dx, offset PIXBYTES	; increment for video buffer
+L1111:	or	[bx], al	; set pixel
+	add	bx, dx		; increment to next line
+	loop	L1111
+
+	; restore default Graphics Controller state and return to caller
+	;;xor	ax, ax		; AH := 0, AL := 0
+	;;out	dx, ax		; restore Set/Reset register
+	;;inc	ax		; AH := 0, AL := 1
+	;;out	dx, ax		; restore Enable Set/Reset register
+	;;mov	ax, 0ff08h	; AH := 0xff, AL := 0
+	;;out	dx, ax		; restore Bit Mask register
+
+	pop	ds
+	pop	bp
+	ret
+	.cendp	ega_drawvline
+
+
+;
+; Routine to set an individual pixel value.
+; Called from C like:
+;	ega_drawpixel(x, y, color);
+;
+
+; argument offsets from bp
+x	= arg1		; X coordinate
+y	= arg1+2	; Y coordinate
+color	= arg1+4	; pixel value
+
+	.cproc	ega_drawpixel
+	push	bp
+	mov	bp, sp
+
+	mov	dx, 03ceh	; graphics controller port address
+	mov	al, #3		; set data rotate register
+	lea	bx, mode_table
+	add	bx, @gr_mode
+	mov	ah, [bx]
+	out	dx, ax
+
+	mov	cx, x[bp]		; ECX := x
+	mov	ax, y[bp]		; EAX := y
+
+	mov	dx, offset PIXBYTES	; AX := [y * PIXBYTES]
+	mul	dx
+
+	mov	bx, cx		; BX := [x / 8]
+	shr	bx, 1
+	shr	bx, 1
+	shr	bx, 1
+
+	add	bx, ax		; BX := [y * PIXBYTES] + [x / 8]
+
+	and	cl, 07h		; CL := [x % 8]
+	xor	cl, 07h		; CL := 7 - [x % 8]
+	mov 	ch, 01h		; CH := 1 << [7 - [x % 8]]	[mask]
+	shl	ch, cl
+
+	mov	dx, 03ceh	; graphics controller port address
+
+	;;required for old code
+	;;mov	ax, 0205h	; select write mode 2
+	;;out	dx, ax		; [load value 2 into mode register 5]
+
+	; new code
+	xor	ax,ax		; set color register 0
+	mov	ah,[bp+8]	; color pixel value
+	out	dx,ax
+
+	; original code
+	mov 	al, 08h		; set the bit mask register
+	mov 	ah, ch		; [load bit mask into register 8]
+	out	dx, ax
+
+	push	ds
+	mov	ax, 0a000h	; DS := EGA buffer segment address
+	mov	ds, ax
+
+	; new code
+	or	[bx],al		; quick rmw to set pixel
+
+	;;the following fails under ELKS without cli/sti
+	;;using ES works though.  Code changed to use single
+	;;rmw above rather than write mode 2, but the
+	;;reason for this failure is still unknown...
+	;;cli
+	;;mov 	al, [bx]	; dummy read to latch bit planes
+	;;mov	al, color[bp]	; pixel value
+	;;mov 	[bx], al	; write pixel back to bit planes
+	;;sti
+
+	pop	ds		; restore registers and return
+
+	mov	ax, 0005h	; restore default write mode 0
+	out	dx, ax		; [load value 0 into mode register 5]
+	;;mov	ax, 0ff08h	; restore default bit mask
+	;;out	dx, ax		; [load value ff into register 8]
+
+	pop	bp
+	ret
+	.cendp	ega_drawpixel
+
+;
+; Routine to read the value of an individual pixel.
+; Called from C like:
+; 	color = ega_readpixel(x, y);
+;
+
+; argument offsets from bp
+x	= arg1			; X coordinate
+y	= arg1+2		; Y coordinate
+
+	.cproc	ega_readpixel
+	push	bp
+	mov	bp, sp
+	push	si
+	push	ds
+
+	mov	ax, y[bp]	; EAX := y
+	mov	bx, x[bp]	; EBX := x
+	mov	dx, offset PIXBYTES	; AX := [y * PIXBYTES]
+	mul	dx
+
+	mov 	cl, bl		; save low order column bits
+	shr	bx, 1		; BX := [x / 8]
+	shr	bx, 1
+	shr	bx, 1
+
+	add	bx, ax		; BX := [y * PIXBYTES] + [x / 8]
+
+	and	cl, 07h		; CL := [x % 8]
+	xor 	cl, 07h		; CL := 7 - [x % 8]
+
+	mov	dx, 0a000h	; DS := EGA buffer segment address
+	mov	ds, dx
+
+	mov 	ch, 01h		; CH := 1 << [7 - [col % 8]]  [mask]
+	shl	ch, cl		; CH := bit mask in proper position
+
+	mov	si, bx		; DS:SI -> region buffer byte
+	xor	bl, bl		; BL is used to accumulate the pixel value
+
+	mov	dx, 03ceh	; DX := Graphics Controller port
+	mov	ax, 0304h	; AH := initial bit plane number
+				; AL := Read Map Select register number
+
+L112:	out	dx, ax		; select bit plane
+	mov 	bh, [si]	; BH := byte from current bit plane
+	and	bh, ch		; mask one bit
+	neg	bh		; bit 7 of BH := 1 if masked bit = 1
+				; bit 7 of BH := 0 if masked bit = 0
+	rol	bx, 1		; bit 0 of BL := next bit from pixel value
+	dec	ah		; AH := next bit plane number
+	jge	L112
+
+	xor	ax, ax		; AL := pixel value
+	mov 	al, bl
+
+	pop	ds
+	pop	si
+	pop	bp	
+	ret
+	.cendp	ega_readpixel
+
+	.cend
+	end
diff -urN lib/microwindows/src/drivers/bogl.x/Makefile.org /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/Makefile.org
--- lib/microwindows/src/drivers/bogl.x/Makefile.org	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/Makefile.org	2005-02-21 16:13:04.000000000 +0100
@@ -0,0 +1,24 @@
+BOGL_CFB8_FB=1
+BOGL_VGA16_FB=1
+
+CFLAGS += -Wall -O3 -DSMALLBOGL=1
+LDFLAGS =
+LIB=libbogl.a
+OBJECTS=bogl.o fbvt.o
+
+ifdef BOGL_CFB8_FB
+OBJECTS += bogl-cfb8.o
+CFLAGS += -DBOGL_CFB8_FB=1
+endif
+ifdef BOGL_VGA16_FB
+OBJECTS += bogl-vga16.o
+CFLAGS += -DBOGL_VGA16_FB=1
+endif
+
+all: $(LIB)
+
+clean:
+	rm -f *.o *.a core
+
+$(LIB): $(OBJECTS)
+	$(AR) rcs $(LIB) $(OBJECTS)
diff -urN lib/microwindows/src/drivers/bogl.x/bogl-cfb8.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/bogl-cfb8.c
--- lib/microwindows/src/drivers/bogl.x/bogl-cfb8.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/bogl-cfb8.c	2005-02-21 16:13:03.000000000 +0100
@@ -0,0 +1,369 @@
+/* BOGL - Ben's Own Graphics Library.
+   Written by Ben Pfaff <pfaffben@debian.org>.
+
+   Portions Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+   USA. */
+
+/*#define NDEBUG*/
+#include <assert.h>
+#include <string.h>
+#include "bogl.h"
+#include "boglP.h"
+#include "bogl-cfb8.h"
+
+extern int gr_mode;		/* temp global kluge*/
+
+/* Set pixel (X,Y) to color C. */
+void
+bogl_cfb8_pixel (int x, int y, int c)
+{
+    assert (x >= 0 && x < bogl_xres);
+    assert (y >= 0 && y < bogl_yres);
+    assert (c >= 0 && c < bogl_ncols);
+  
+    bogl_drawing = 1;
+    if(gr_mode == 0)
+    	bogl_frame[x + y * bogl_line_len] = c;
+    else
+    	bogl_frame[x + y * bogl_line_len] ^= c;
+    bogl_drawing = 0;
+}
+
+/* Read pixel at (X,Y). */
+int
+bogl_cfb8_readpixel (int x, int y)
+{
+    assert (x >= 0 && x < bogl_xres);
+    assert (y >= 0 && y < bogl_yres);
+  
+    return bogl_frame[x + y * bogl_line_len];
+}
+
+/* Paint a horizontal line from (X1,Y) to (X2,Y) in color C, where X2
+   >= X1.  The final point is not painted. */
+void
+bogl_cfb8_hline (int x1, int x2, int y, int c)
+{
+  char *dst;
+  int cnt;
+
+  assert (x1 >= 0 && x1 < bogl_xres);
+  assert (x2 >= 0 && x2 <= bogl_xres);
+  assert (x2 >= x1);
+  assert (y >= 0 && y < bogl_yres);
+  assert (c >= 0 && c < bogl_ncols);
+
+  bogl_drawing = 1;
+  dst = bogl_frame + x1 + y * bogl_line_len;
+  if(gr_mode == 0)
+  	memset (dst, c, x2 - x1);
+  else {
+	  cnt = x2 - x1;
+	  while(--cnt >= 0)
+	    *dst++ ^= c;
+  }
+  bogl_drawing = 0;
+}
+
+/* Paints a vertical line from (X,Y1) to (X,Y2) in color C.  The final
+   point is not painted. */
+void
+bogl_cfb8_vline (int x, int y1, int y2, int c)
+{
+  assert (x >= 0 && x < bogl_xres);
+  assert (y1 >= 0 && y1 < bogl_yres);
+  assert (y2 >= 0 && y2 <= bogl_yres);
+  assert (y2 >= y1);
+  assert (c >= 0 && c < bogl_ncols);
+
+  bogl_drawing = 1;
+  if(gr_mode == 0) {
+	  for (; y1 < y2; y1++)
+	    bogl_frame[x + y1 * bogl_line_len] = c;
+  } else {
+	  for (; y1 < y2; y1++)
+	    bogl_frame[x + y1 * bogl_line_len] ^= c;
+  }
+  bogl_drawing = 0;
+}
+
+void
+bogl_cfb8_blit(int destx, int desty, int w, int h, int srcx, int srcy)
+{
+  char *	dst;
+  char *	src;
+  
+  assert (destx >= 0 && destx < bogl_xres);
+  assert (desty >= 0 && desty < bogl_yres);
+  assert (w > 0);
+  assert (h > 0);
+  assert (srcx >= 0 && srcx <= bogl_xres);
+  assert (srcy >= 0 && srcy < bogl_yres);
+
+  bogl_drawing = 1;
+  dst = bogl_frame + destx + desty * bogl_line_len;
+  src = bogl_frame + srcx + srcy * bogl_line_len;
+  while(--h >= 0) {
+      memcpy (dst, src, w);
+      dst += bogl_line_len;
+      src += bogl_line_len;
+  }
+  bogl_drawing = 0;
+}
+
+#if !SMALLBOGL
+/* Clear the region from (X1,Y1) to (X2,Y2) to color C, not including
+   the last row or column.  If C == -1 then the region's colors are
+   inverted rather than set to a particular color.  */
+void
+bogl_cfb8_clear (int x1, int y1, int x2, int y2, int c)
+{
+  char *dst;
+  int cnt;
+  
+  if (x1 == x2 || y1 == y2)
+    return;
+
+  assert (x1 >= 0 && x1 < bogl_xres);
+  assert (x2 >= 0 && x2 <= bogl_xres);
+  assert (x2 >= x1);
+  assert (y1 >= 0 && y1 < bogl_yres);
+  assert (y2 >= 0 && y2 <= bogl_yres);
+  assert (y2 >= y1);
+  assert (c >= -1 && c < bogl_ncols);
+
+  bogl_drawing = 1;
+  dst = bogl_frame + x1 + y1 * bogl_line_len;
+  if(gr_mode == 0)
+	  for (; y1 < y2; y1++) {
+	      memset (dst, c, x2 - x1);
+	      dst += bogl_line_len;
+	  }
+  else
+	  for (; y1 < y2; y1++) {
+	      cnt = x2 - x1;
+	      while(--cnt >= 0)
+		  *dst++ ^= c;
+	      dst = bogl_frame + x1 + y1 * bogl_line_len;
+	  }
+  bogl_drawing = 0;
+}
+
+void
+bogl_cfb8_text (int xx, int yy, const char *s, int n, int fg, int bg,
+		struct bogl_font *font)
+{
+  int h;
+  
+  h = font->height;
+yy -= h;  /* bugfix adjust text y origin, must be done before assert*/
+
+  assert (xx >= 0 && xx < bogl_xres);
+  assert (yy >= 0 && yy < bogl_yres);
+  assert (fg >= 0 && fg < bogl_ncols);
+  assert (bg >= -1 && bg < bogl_ncols);
+
+  bogl_drawing = 1;
+
+  if (yy + h > bogl_yres)
+    h = bogl_yres - yy;
+
+  for (; n--; s++)
+    {
+      volatile char *dst = bogl_frame + xx + yy * bogl_line_len;
+
+      const unsigned char ch = *s;
+      const unsigned long *character = &font->content[font->offset[ch]];
+      int w = font->width[ch];
+
+      int x, y;
+
+      if (xx + w > bogl_xres)
+	w = bogl_xres - xx;
+      
+      for (y = 0; y < h; y++)
+	{
+	  unsigned long c = *character++;
+	  
+	  for (x = 0; x < w; x++)
+	    {
+	      if (c & 0x80000000)
+		dst[x] = fg;
+	      else if (bg != -1)
+		dst[x] = bg;
+
+	      c <<= 1;
+	    }
+
+	  dst += bogl_line_len;
+	}
+
+      xx += w;
+      if (xx >= bogl_xres)
+	break;
+    }
+
+  bogl_drawing = 0;
+}
+
+/* Write PIXMAP at location (XX,YY), with the pixmap's colors mapped
+   according to COLOR_MAP. */
+void
+bogl_cfb8_put (int xx, int yy, const struct bogl_pixmap *pixmap,
+	       const int color_map[16])
+{
+  volatile char *dst;
+  const unsigned char *src;
+  int h;
+  
+  assert (xx + pixmap->width <= bogl_xres);
+  assert (yy >= 0 && yy < bogl_yres);
+  assert (yy + pixmap->width <= bogl_yres);
+  src = pixmap->data;
+
+  bogl_drawing = 1;
+
+  h = pixmap->height;
+  dst = bogl_frame + xx + yy * bogl_line_len;
+  while (h--)
+    {
+      int w = pixmap->width;
+      while (w)
+	{
+	  int color = *src & 0xf;
+	  int count = *src >> 4;
+	  src++;
+
+	  w -= count;
+	  while (count--)
+	    *dst++ = color_map[color];
+	}
+
+      dst += bogl_line_len - pixmap->width;
+    }
+
+  bogl_drawing = 0;
+}
+
+/* Draw mouse pointer POINTER with its hotspot at (X,Y), if VISIBLE !=
+   0. Restores the previously saved background at that point, if
+   VISIBLE == 0. COLORS[] gives the color indices to paint the cursor.
+
+   This routine performs full clipping on all sides of the screen. */
+void bogl_cfb8_pointer(int visible, int x1, int y1,
+			const struct bogl_pointer *pointer, int colors[2])
+{
+	volatile unsigned char *dst, *src;
+	int h, w;
+	static unsigned char saved[16 * 16];
+	static int oldx, oldy, oldxl, oldyl;
+	unsigned const short *clr, *msk;
+	unsigned short c, m;
+	int xl, yl;
+
+	assert(pointer != NULL);
+
+	/* Find edge of bitmap from hotspot */
+	x1 += pointer->hx;
+	y1 += pointer->hy;
+
+	/* Clip to right hand side of screen: */
+	if(x1 >= bogl_line_len - 16) {
+		if(x1 >= (bogl_line_len - 3))
+			x1 = bogl_line_len - 3;
+		/* Calculate overlap: */
+		xl = bogl_line_len - x1 - 1;
+	} else xl = 16;
+
+	/* Clip to bottom of screen: */
+	if(y1 >= bogl_yres - 16) {
+		if(y1 >= bogl_yres)
+			y1 = bogl_yres;
+		/* Calculate overlap: */
+		yl = bogl_yres - y1;
+	} else yl = 16;
+
+	bogl_drawing = 1;
+
+	if(visible) {
+		/* Save the screen under the pointer: */
+		dst = &saved[0];
+		src = bogl_frame + x1 + xl + y1 * bogl_line_len;
+
+		for(h = yl; h; h--) {
+			for(w = xl; w; w--) {
+				*dst = *src;
+				dst++;
+				src--;
+			}
+			dst += 16 - xl;
+			src += bogl_line_len + xl;
+		}
+
+		/* Save the current position, so we can restore it later: */
+		oldx = x1;
+		oldy = y1;
+		oldxl = xl;
+		oldyl = yl;
+
+		/* Draw the new pointer: */
+		dst = bogl_frame + x1 + xl + y1 * bogl_line_len;
+		clr = pointer->color;
+		msk = pointer->mask;
+
+		for(h = yl; h; h--) {
+			c = *clr;
+			m = *msk;
+			c >>= (16 - xl);
+			m >>= (16 - xl);
+			for(w = xl; w; w--) {
+				if(m & 1) *dst = ((c & 1) ? 0 : 15);
+				dst--;
+				c >>= 1;
+				m >>= 1;
+			}
+			clr++;
+			msk++;
+			dst += bogl_line_len + xl;
+		}
+	} else {
+		/* Restore the data under the pointer: */
+		dst = bogl_frame + oldx + oldxl + oldy * bogl_line_len;
+		src = &saved[0];
+
+		for(h = oldyl; h; h--) {
+			for(w = oldxl; w; w--) {
+				*dst = *src;
+				dst--;
+				src++;
+			}
+			src += 16 - oldxl;
+			dst += bogl_line_len + oldxl;
+		}
+	}
+
+	bogl_drawing = 0;
+}
+#endif /* !SMALLBOGL*/
+
+/* Initialize CFB8 mode.  Returns the number of bytes to mmap for the
+   framebuffer. */
+size_t
+bogl_cfb8_init (void)
+{
+  return bogl_line_len * bogl_yres;
+}
diff -urN lib/microwindows/src/drivers/bogl.x/bogl-cfb8.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/bogl-cfb8.h
--- lib/microwindows/src/drivers/bogl.x/bogl-cfb8.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/bogl-cfb8.h	2005-02-21 16:13:03.000000000 +0100
@@ -0,0 +1,40 @@
+/* BOGL - Ben's Own Graphics Library.
+   Written by Ben Pfaff <pfaffben@debian.org>.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+   USA. */
+
+#ifndef bogl_cfb8_h
+#define bogl_cfb8_h
+
+#include <stddef.h>
+
+size_t bogl_cfb8_init ();
+
+void bogl_cfb8_pixel (int x, int y, int c);
+int bogl_cfb8_readpixel (int x, int y);
+void bogl_cfb8_hline (int x1, int x2, int y, int c);
+void bogl_cfb8_vline (int x, int y1, int y2, int c);
+void bogl_cfb8_text (int x, int y, const char *s, int n, int fg, int bg,
+		      struct bogl_font *font);
+void bogl_cfb8_clear (int x1, int y1, int x2, int y2, int c);
+void bogl_cfb8_move (int sx, int sy, int dx, int dy, int w, int h);
+void bogl_cfb8_put (int x, int y, const struct bogl_pixmap *pixmap,
+		     const int color_map[16]);
+void bogl_cfb8_pointer (int visible, int x1, int y1,
+			const struct bogl_pointer *pointer,
+			int colors[2]);
+
+#endif /* bogl_cfb8_h */
diff -urN lib/microwindows/src/drivers/bogl.x/bogl-vga16.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/bogl-vga16.c
--- lib/microwindows/src/drivers/bogl.x/bogl-vga16.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/bogl-vga16.c	2005-02-21 16:13:04.000000000 +0100
@@ -0,0 +1,666 @@
+/* BOGL - Ben's Own Graphics Library.
+   Written by Ben Pfaff <pfaffben@debian.org>.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+   USA. */
+
+/*#define NDEBUG*/
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <linux/fb.h>
+#include <linux/kd.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/io.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include "bogl.h"
+#include "boglP.h"
+#include "bogl-vga16.h"
+
+/* VGA16 support for BOGL. */
+
+/* bits_set[X] is the number of nonzero bits in X. */
+static unsigned char bits_set[256];
+
+/* Program the Set/Reset Register for drawing in color COLOR for write
+   mode 0. */
+static inline void 
+set_color (int c)
+{
+  outb (0, 0x3ce);
+  outb (c, 0x3cf);
+}
+
+/* Set the Enable Set/Reset Register. */
+static inline void
+set_enable_sr (int mask)
+{
+  outb (1, 0x3ce);
+  outb (mask, 0x3cf);
+}
+
+/* Select the Bit Mask Register on the Graphics Controller. */
+static inline void
+select_mask (void)
+{
+  outb (8, 0x3ce);
+}
+
+/* Program the Bit Mask Register to affect only the pixels selected in
+   MASK.  The Bit Mask Register must already have been selected with
+   select_mask (). */
+static inline void
+set_mask (int mask)
+{
+  outb (mask, 0x3cf);
+}
+
+/* Set the Data Rotate Register.  Bits 0-2 are rotate count, bits 3-4
+   are logical operation (0=NOP, 1=AND, 2=OR, 3=XOR). */
+static inline void
+set_op (int op)
+{
+  outb (3, 0x3ce);
+  outb (op, 0x3cf);
+}
+
+/* Set the Memory Plane Write Enable register. */
+static inline void
+set_write_planes (int mask)
+{
+  outb (2, 0x3c4);
+  outb (mask, 0x3c5);
+}
+
+/* Set the Read Map Select register. */
+static inline void
+set_read_plane (int plane)
+{
+  outb (4, 0x3ce);
+  outb (plane, 0x3cf);
+}
+
+/* Set the Graphics Mode Register.  The write mode is in bits 0-1, the
+   read mode is in bit 3. */
+static inline void
+set_mode (int mode)
+{
+  outb (5, 0x3ce);
+  outb (mode, 0x3cf);
+}
+
+/* Read-modify-write the specified memory byte. */
+static inline void
+rmw (volatile char *p)
+{
+  *p |= 1;
+}
+
+/* Set pixel (X,Y) to color C. */
+void
+bogl_vga16_pixel (int x, int y, int c)
+{
+    bogl_drawing = 1;
+
+    assert (x >= 0 && x < bogl_xres);
+    assert (y >= 0 && y < bogl_yres);
+    assert (c >= 0 && c < bogl_ncols);
+  
+    set_color (c);
+    select_mask ();
+    set_mask (0x80 >> (x % 8));
+    rmw (bogl_frame + x / 8 + y * bogl_line_len);
+
+    bogl_drawing = 0;
+}
+
+/* Return 4-bit pixel value at x,y*/
+int
+bogl_vga16_readpixel(int x,int y)
+{
+	volatile char *	src;
+	int		plane;
+	int		c = 0;
+	
+	assert (x >= 0 && x < bogl_xres);
+	assert (y >= 0 && y < bogl_yres);
+  
+	bogl_drawing = 1;
+	src = bogl_frame + x / 8 + y * bogl_line_len;
+	for(plane=0; plane<4; ++plane) {
+		set_read_plane(plane);
+		if(*src & (0x80 >> (x % 8)))
+			c |= 1 << plane;
+	}
+	bogl_drawing = 0;
+	return c;
+}
+
+
+/* Paint a horizontal line from (X1,Y) to (X2,Y) in color C, where X2
+   >= X1.  The final point is not painted. */
+void
+bogl_vga16_hline (int x1, int x2, int y, int c)
+{
+  volatile char *dst;
+
+
+  if (x1 == x2)
+    return;
+
+  assert (x1 >= 0 && x1 < bogl_xres);
+  assert (x2 >= 0 && x2 <= bogl_xres);
+  assert (x2 >= x1);
+  assert (y >= 0 && y < bogl_yres);
+  assert (c >= 0 && c < bogl_ncols);
+
+  bogl_drawing = 1;
+
+  set_color (c);
+  dst = bogl_frame + x1 / 8 + y * bogl_line_len;
+  select_mask ();
+  if (x1 / 8 == x2 / 8) 
+    {
+      set_mask ((0xff >> (x1 % 8)) & (0xff << (7 - x2 % 8)));
+      rmw (dst);
+    }
+  else
+    {
+      volatile char *last;
+      
+      set_mask (0xff >> (x1 % 8));
+      rmw (dst++);
+
+      set_mask (0xff);
+      last = bogl_frame + x2 / 8 + y * bogl_line_len;
+      while (dst < last)
+	*dst++ = 1;
+      
+      set_mask (0xff << (7 - x2 % 8));
+      rmw (dst);
+    }
+
+  bogl_drawing = 0;
+}
+
+/* Paints a vertical line from (X,Y1) to (X,Y2) in color C.  The final
+   point is not painted. */
+void
+bogl_vga16_vline (int x, int y1, int y2, int c)
+{
+  volatile char *dst, *last;
+
+  y2--;
+  
+  assert (x >= 0 && x < bogl_xres);
+  assert (y1 >= 0 && y1 < bogl_yres);
+  assert (y2 >= 0 && y2 <= bogl_yres);
+  assert (y2 >= y1);
+  assert (c >= 0 && c < bogl_ncols);
+
+  bogl_drawing = 1;
+
+  set_color (c);
+  select_mask ();
+  set_mask (0x80 >> (x % 8));
+  dst = bogl_frame + x / 8 + y1 * bogl_line_len;
+  last = bogl_frame + x / 8 + y2 * bogl_line_len;
+  while (dst <= last)
+    {
+      rmw (dst);
+      dst += bogl_line_len;
+    }
+
+  bogl_drawing = 0;
+}
+
+#if !SMALLBOGL
+
+/* Clear the region from (X1,Y1) to (X2,Y2) to color C, not including
+   the last row or column.  If C == -1 then the region's colors are
+   inverted rather than set to a particular color.  */
+void
+bogl_vga16_clear (int x1, int y1, int x2, int y2, int c)
+{
+  volatile char *dst;
+
+
+  if (x1 == x2)
+    return;
+  x2--;
+
+  assert (x1 >= 0 && x1 < bogl_xres);
+  assert (x2 >= 0 && x2 <= bogl_xres);
+  assert (x2 >= x1);
+  assert (y1 >= 0 && y1 < bogl_yres);
+  assert (y2 >= 0 && y2 <= bogl_yres);
+  assert (y2 >= y1);
+  assert (c >= -1 && c < bogl_ncols);
+
+  bogl_drawing = 1;
+
+  set_color (c);
+  if (c == -1)
+    set_op (0x18);
+
+  select_mask ();
+  if (x1 / 8 == x2 / 8)
+    {
+      volatile char *last;
+
+      dst = bogl_frame + x1 / 8 + y1 * bogl_line_len;
+      last = bogl_frame + x2 / 8 + y2 * bogl_line_len;
+      set_mask ((0xff >> (x1 % 8)) & (0xff << (7 - x2 % 8)));
+      while (dst < last)
+	{
+	  rmw (dst);
+	  dst += bogl_line_len;
+	}
+    }
+  else 
+    {
+      /* FIXME: the following code could admittedly be more efficient,
+	 but my first attempt at optimization was buggy. */
+      int y;
+      
+      for (y = y1; y < y2; y++)
+	{
+	  volatile char *last;
+	  dst = bogl_frame + x1 / 8 + y * bogl_line_len;
+	  set_mask (0xff >> (x1 % 8));
+	  rmw (dst++);
+
+	  set_mask (0xff);
+	  last = bogl_frame + x2 / 8 + y * bogl_line_len;
+	  while (dst < last)
+	    *dst++ = 1;
+      
+	  set_mask (0xff << (7 - x2 % 8));
+	  rmw (dst);
+	}
+    }
+
+  set_op (0);
+  bogl_drawing = 0;
+}
+
+/* FIXME: it would be faster to use write mode 3 to write the middle
+   bytes (but also more complex). */
+#define ul_size (sizeof (unsigned long))
+#define ul_bits (CHAR_BIT * ul_size)
+void
+bogl_vga16_text (int xx, int yy, const char *s, int n, int fg, int bg,
+		 struct bogl_font *font)
+{
+  /* Font height, or possibly less due to clipping. */
+  int h;
+  int x, y;
+  unsigned long bits[font->height];
+
+  void plot (void)
+    {
+      volatile char *dst = bogl_frame + xx / 8 + yy * bogl_line_len;
+      int y, i;
+      
+      for (y = 0; y < h; y++)
+	{
+	  unsigned long b = bits[y];
+	  
+	  for (i = ul_size - 1; i >= 0; i--)
+	    {
+	      set_mask (b);
+	      rmw (dst + i);
+	      b >>= 8;
+	    }
+	  
+	  dst += bogl_line_len;
+	}
+    }
+
+  assert (xx >= 0 && xx < bogl_xres);
+  assert (yy >= 0 && yy < bogl_yres);
+  assert (fg >= 0 && fg < bogl_ncols);
+  assert (bg >= -1 && bg < bogl_ncols);
+
+  h = font->height;
+  if (yy + h > bogl_yres)
+    h = bogl_yres - yy;
+
+  if (bg != -1)
+    {
+      int x2 = xx + bogl_metrics (s, n, font);
+      if (x2 >= bogl_xres)
+	x2 = bogl_xres - 1;
+      
+      bogl_vga16_clear (xx, yy, x2, yy + h, bg);
+    }
+  
+  bogl_drawing = 1;
+
+  for (y = 0; y < h; y++)
+    bits[y] = 0;
+  
+  set_color (fg);
+  select_mask ();
+
+  x = xx % ul_bits;
+  xx = xx / ul_bits * ul_bits;
+
+  for (; n--; s++)
+    {
+      const unsigned char ch = *s;
+      const unsigned long *character = &font->content[font->offset[ch]];
+      const int width = font->width[ch];
+
+      for (y = 0; y < h; y++)
+	bits[y] |= character[y] >> x;
+      x += width;
+
+      if (x >= (int) ul_bits)
+	{
+	  plot ();
+
+	  x -= ul_bits;
+	  for (y = 0; y < h; y++)
+	    bits[y] = character[y] << (width - x);
+
+	  xx += ul_bits;
+	  if (xx >= bogl_xres)
+	    goto done;
+	}
+    }
+  plot ();
+
+ done:
+  bogl_drawing = 0;
+}
+
+/* Write PIXMAP at location (XX,YY), with the pixmap's colors mapped
+   according to COLOR_MAP. */
+void
+bogl_vga16_put (int xx, int yy, const struct bogl_pixmap *pixmap,
+		const int color_map[16])
+{
+  volatile char *dst;
+  const unsigned char *src;
+  int x, y;
+
+  assert (xx >= 0 && xx < bogl_xres);
+  assert (xx + pixmap->width <= bogl_xres);
+  assert (yy >= 0 && yy < bogl_yres);
+  assert (yy + pixmap->width <= bogl_yres);
+  src = pixmap->data;
+  
+  bogl_drawing = 1;
+
+  y = yy;
+  while (y < yy + pixmap->height)
+    {
+      x = xx;
+      dst = bogl_frame + x / 8 + y * bogl_line_len;
+
+      while (x < xx + pixmap->width) 
+	{
+	  int color = *src & 0xf;
+	  int count = *src >> 4;
+	  src++;
+	  
+	  if (color == pixmap->transparent)
+	    {
+	      dst += (x + count) / 8 - x / 8;
+	      x += count;
+	      continue;
+	    }
+
+	  set_color (color_map[color]);
+	  select_mask ();
+
+	  if (count == 1)
+	    {
+	      set_mask (0x80 >> (x % 8));
+	      *dst |= 1;
+	      if (++x % 8 == 0)
+		dst++;
+	      continue;
+	    }
+
+	  for (;;)
+	    {
+	      /* Get a mask for COUNT bits starting at X, or at least
+                 as many as will fit in one byte. */
+	      unsigned mask;
+	      mask = (0xffff00 >> count) & 0xff;
+	      mask >>= x % 8;
+	      set_mask (mask);
+
+	      /* Write the bits and bow out if we don't need to
+		 advance to the next byte. */
+	      *dst |= 1;
+	      if ((mask & 1) == 0)
+		{
+		  x += count;
+		  break;
+		}
+
+	      /* Advance to the next byte. */
+	      dst++;
+	      x += bits_set[mask];
+	      count -= bits_set[mask];
+	      if (!count)
+		break;
+	    }
+	}
+      
+      y++;
+    }
+
+  bogl_drawing = 0;
+}
+
+/* Draw mouse pointer POINTER with its hotspot at (X,Y), if VISIBLE !=
+   0.  Restores the previously saved background at that point, if
+   VISIBLE == 0.  COLORS[] gives the color indices to paint the
+   cursor.
+
+   This routine performs full clipping on all sides of the screen. */
+void 
+bogl_vga16_pointer (int visible, int x1, int y1,
+		    const struct bogl_pointer *pointer,
+		    int colors[2])
+{
+  int y_count;		/* Number of scanlines. */
+  int y_ofs;		/* Number of scanlines to skip drawing. */
+  int x_ofs;		/* Number of pixels to skip drawing on each line. */
+
+  assert (pointer != NULL);
+
+  x1 -= pointer->hx;
+  y1 -= pointer->hy;
+  
+  if (y1 + 16 > bogl_yres)
+    y_count = bogl_yres - y1;
+  else
+    y_count = 16;
+
+  if (x1 < 0)
+    {
+      x_ofs = -x1;
+      x1 = 0;
+    }
+  else
+    x_ofs = 0;
+
+  if (y1 < 0)
+    {
+      y_ofs = -y1;
+      y1 = 0;
+      y_count -= y_ofs;
+    }
+  else
+    y_ofs = 0;
+
+  bogl_drawing = 1;
+
+  /* Save or restore the framebuffer contents. */
+  {
+    /* Four planes of sixteen rows of four bytes each. */
+    static unsigned char saved[4 * 16 * 3];
+
+    int plane;		/* Current plane. */
+    int sx_ofs;		/* Byte offset within a scanline to save/restore. */
+      
+    sx_ofs = x1 / 8;
+    if (sx_ofs + 3 > bogl_line_len)
+      sx_ofs = bogl_line_len - 3;
+
+    if (visible)
+      {
+	for (plane = 0; plane < 4; plane++)
+	  {
+	    volatile char *dst = saved + plane * 16 * 3;
+	    volatile char *src = bogl_frame + sx_ofs + y1 * bogl_line_len;
+	    int y = y_count;
+
+	    set_read_plane (plane);
+	    
+	    while (y--)
+	      {
+		*dst++ = *src++;
+		*dst++ = *src++;
+		*dst++ = *src++;
+		
+		src += bogl_line_len - 3;
+	      }
+	  }
+      }
+    else
+      {
+	set_enable_sr (0);
+	select_mask ();
+	set_mask (0xff);
+
+	for (plane = 0; plane < 4; plane++)
+	  {
+	    volatile char *dst = bogl_frame + sx_ofs + y1 * bogl_line_len;
+	    volatile char *src = saved + plane * 16 * 3;
+	    int y = y_count;
+	  
+	    set_write_planes (1 << plane);
+
+	    while (y--)
+	      {
+		*dst++ = *src++;
+		*dst++ = *src++;
+		*dst++ = *src++;
+
+		dst += bogl_line_len - 3;
+	      }
+	  }
+	
+	set_write_planes (0xf);
+	set_enable_sr (0xf);
+      }
+  }
+
+  if (visible)
+    {
+      const unsigned short *mask_p, *color_p;
+      int x_count;
+      int y;
+      int color;
+      
+      x_count = x1 % 8 ? 3 : 2;
+      if (x1 / 8 + x_count > bogl_line_len)
+	x_count = bogl_line_len - x1 / 8;
+
+      for (color = 0; color < 2; color++)
+	{
+	  set_color (colors[color]);
+	  select_mask ();
+	  
+	  mask_p = pointer->mask + y_ofs;
+	  color_p = pointer->color + y_ofs;
+	  for (y = 0; y < y_count; y++, mask_p++, color_p++)
+	    {
+	      volatile char *dst;
+	      unsigned long bits;
+	      int x;
+
+	      dst = bogl_frame + x1 / 8 + (y1 + y) * bogl_line_len;
+
+	      if (color)
+		bits = *mask_p ^ *color_p;
+	      else
+		bits = *mask_p & *color_p;
+	      bits <<= (CHAR_BIT * (sizeof (long) - sizeof (short))) + x_ofs;
+	      bits >>= x1 % 8;
+
+	      x = x_count;
+	      while (x--)
+		{
+		  set_mask (bits >> 24);
+		  rmw (dst++);
+		  bits <<= 8;
+		}
+	    }
+	}
+    }
+
+  bogl_drawing = 0;
+}
+#endif /* !SMALLBOGL*/
+
+/* Initialize the VGA controller.  Returns the number of bytes to
+   memory map on success, or zero on failure. */
+size_t
+bogl_vga16_init (void)
+{
+  if (-1 == ioperm (0x3c0, 0x20, 1))
+    {
+      bogl_fail ("can't get IO permissions: %s", strerror(errno));
+      return 0;
+    }
+
+  /* Set up some default values for the VGA Graphics Registers. */
+  set_enable_sr (0xf);
+  set_op (0);
+  set_mode (0);
+
+  /* Initialize bits_set array. */
+  {
+    int i;
+
+    for (i = 0; i < 256; i++)
+      {
+	int c, j;
+
+	for (c = j = 0; j < 8; j++)
+	  c += (i & (1 << j)) != 0;
+
+	bits_set[i] = c;
+      }
+  }
+  
+  return 0x10000;
+}
diff -urN lib/microwindows/src/drivers/bogl.x/bogl-vga16.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/bogl-vga16.h
--- lib/microwindows/src/drivers/bogl.x/bogl-vga16.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/bogl-vga16.h	2005-02-21 16:13:04.000000000 +0100
@@ -0,0 +1,40 @@
+/* BOGL - Ben's Own Graphics Library.
+   Written by Ben Pfaff <pfaffben@debian.org>.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+   USA. */
+
+#ifndef bogl_vga16_h
+#define bogl_vga16_h
+
+#include <stddef.h>
+
+size_t bogl_vga16_init ();
+
+void bogl_vga16_pixel (int x, int y, int c);
+int bogl_vga16_readpixel (int x, int y);
+void bogl_vga16_hline (int x1, int x2, int y, int c);
+void bogl_vga16_vline (int x, int y1, int y2, int c);
+void bogl_vga16_text (int x, int y, const char *s, int n, int fg, int bg,
+		      struct bogl_font *font);
+void bogl_vga16_clear (int x1, int y1, int x2, int y2, int c);
+void bogl_vga16_move (int sx, int sy, int dx, int dy, int w, int h);
+void bogl_vga16_put (int x, int y, const struct bogl_pixmap *pixmap,
+		     const int color_map[16]);
+void bogl_vga16_pointer (int visible, int x1, int y1,
+			 const struct bogl_pointer *pointer,
+			 int colors[2]);
+
+#endif /* bogl_vga16_h */
diff -urN lib/microwindows/src/drivers/bogl.x/bogl.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/bogl.c
--- lib/microwindows/src/drivers/bogl.x/bogl.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/bogl.c	2005-02-21 16:13:03.000000000 +0100
@@ -0,0 +1,504 @@
+/* BOGL - Ben's Own Graphics Library.
+   Written by Ben Pfaff <pfaffben@debian.org>.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+   USA. */
+
+#define _GNU_SOURCE 1
+#include <assert.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <linux/fb.h>
+#include <linux/kd.h>
+#include <linux/vt.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/io.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include "bogl.h"
+#include "boglP.h"
+#include "bogl-vga16.h"
+#include "bogl-cfb8.h"
+
+/* BOGL main code. */
+
+#ifndef FB_TYPE_VGA_PLANES
+#define FB_TYPE_VGA_PLANES 4
+#endif
+
+#ifndef unused
+#define unused __attribute__((unused))
+#endif
+
+/* Global variables. */
+int bogl_xres, bogl_yres, bogl_ncols;	/* bogl.h */
+int bogl_refresh;
+unsigned char *bogl_frame;		/* boglP.h */
+int bogl_drawing;
+int bogl_line_len;
+int bogl_truecolor;
+
+/* Static variables. */
+static int fb;			/* Framebuffer file handle. */
+static int tty;			/* Tty file handle. */
+static size_t map_amt;		/* Size of mmapped block. */
+
+static struct vt_mode mode;	/* Terminal mode. */
+static int tty_no;		/* Tty that we own. */
+static int type;		/* Video type, one of FB_TYPE_*. */
+static int visual;		/* Visual type, one of FB_VISUAL_*. */
+
+static int visible;		/* Is our VT visible? */
+
+static int status;		/* 0=never initialized, 1=once initialized,
+				   2=currently initialized. */
+static char *error;		/* Error message. */
+
+/* Saved color palette. */
+static __u16 saved_red[16];
+static __u16 saved_green[16];
+static __u16 saved_blue[16];
+
+static int gray;		/* Convert colors to grayscale? */
+
+/* Functions. */
+
+static size_t init_fb (void);
+static int draw_enable (void);
+static void draw_disable (void);
+
+static void vt_switch (int);
+
+/* Initialize BOGL. */
+int
+bogl_init (void)
+{
+  struct fb_fix_screeninfo fb_fix;
+  struct fb_var_screeninfo fb_var;
+  struct vt_stat vts;
+  char *env;
+
+  assert (status < 2);
+  visible = 1;
+  
+  if( !(env = getenv("FRAMEBUFFER")))
+	  env = "/dev/fb0";
+  fb = open (env, O_RDWR);
+  if (fb < 0)
+    return bogl_fail ("opening %s: %m", env);
+
+  tty = open ("/dev/tty0", O_RDWR);
+  if (tty < 0)
+    return bogl_fail ("opening /dev/tty0: %m");
+
+  if (-1 == ioctl (tty, VT_GETSTATE, &vts))
+    return bogl_fail ("can't get VT state: %m");
+  tty_no = vts.v_active;
+
+  if (-1 == ioctl (fb, FBIOGET_FSCREENINFO, &fb_fix)
+      || -1 == ioctl (fb, FBIOGET_VSCREENINFO, &fb_var))
+    return bogl_fail ("reading screen info: %m");
+  
+  bogl_xres = fb_var.xres;
+  bogl_yres = fb_var.yres;
+  bogl_ncols = 1 << fb_var.bits_per_pixel;
+  bogl_line_len = fb_fix.line_length;
+  type = fb_fix.type;
+  visual = fb_fix.visual;
+  bogl_truecolor = (visual == FB_VISUAL_TRUECOLOR);
+
+//printf("smem_start %x\n", (int)fb_fix.smem_start);
+//printf("smem_len %x\n", fb_fix.smem_len);
+//printf("%dx%dx%d linelen %d type %d visual %d\n", bogl_xres, bogl_yres, bogl_ncols, bogl_line_len, type, visual);
+
+  if (!draw_enable ())
+    return bogl_fail ("don't know screen type %d", type);
+
+  if (ioctl (tty, VT_GETMODE, &mode) == -1)
+    return bogl_fail ("can't get VT mode: %m");
+
+  mode.mode = VT_PROCESS;
+  mode.relsig = SIGUSR2;
+  mode.acqsig = SIGUSR2;
+
+  signal (SIGUSR2, vt_switch);
+
+  if (-1 == ioctl (tty, VT_SETMODE, &mode))
+    return bogl_fail ("can't set VT mode: %m");
+
+  if (-1 == ioctl (tty, KDSETMODE, KD_GRAPHICS)) 
+    return bogl_fail ("setting graphics mode: %m");
+
+  map_amt = init_fb ();
+//printf("mapamt %x\n", map_amt);
+  if (!map_amt)
+    return 0;
+  map_amt = (map_amt + getpagesize () - 1) / getpagesize () * getpagesize ();
+
+  bogl_frame = mmap (NULL, map_amt, PROT_READ | PROT_WRITE, MAP_SHARED, fb, 0);
+
+  if (bogl_frame == NULL || bogl_frame == (unsigned char *) -1)
+     return bogl_fail ("mmaping /dev/fb0: %m");
+
+  
+  {
+    static struct fb_cmap cmap;
+
+    cmap.start = 0;
+    cmap.len = 16;
+    cmap.red = saved_red;
+    cmap.green = saved_green;
+    cmap.blue = saved_blue;
+    cmap.transp = NULL;
+
+    ioctl (fb, FBIOGETCMAP, &cmap);
+  }
+
+  if (!status)
+    atexit (bogl_done);
+  status = 2;
+
+  return 1;
+}
+
+static size_t
+init_fb (void)
+{
+#if BOGL_VGA16_FB
+  if (type == FB_TYPE_VGA_PLANES)
+    return bogl_vga16_init (fb);
+#endif
+
+#if BOGL_CFB8_FB
+  if (type == FB_TYPE_PACKED_PIXELS
+      && (visual == FB_VISUAL_PSEUDOCOLOR || visual == FB_VISUAL_TRUECOLOR)
+      && bogl_ncols == 256)
+    return bogl_cfb8_init (fb);
+#endif
+
+  return bogl_fail ("unknown or unsupported framebuffer: type %d, "
+		    "visual %d, %d colors", type, visual, bogl_ncols);
+}
+
+/* Close down BOGL. */
+void
+bogl_done (void)
+{
+  if (status != 2)
+    return;
+  status = 1;
+
+  //bogl_clear (0, 0, bogl_xres, bogl_yres, 0);
+  
+  {
+    static struct fb_cmap cmap;
+
+    cmap.start = 0;
+    cmap.len = 16;
+    cmap.red = saved_red;
+    cmap.green = saved_green;
+    cmap.blue = saved_blue;
+    cmap.transp = NULL;
+
+    ioctl (fb, FBIOPUTCMAP, &cmap);
+  }
+  
+  munmap ((void *) bogl_frame, map_amt);
+  
+  signal (SIGUSR2, SIG_DFL);
+
+  ioctl (tty, KDSETMODE, KD_TEXT);
+
+  mode.mode = VT_AUTO;
+  mode.relsig = 0;
+  mode.acqsig = 0;
+  ioctl (tty, VT_SETMODE, &mode);
+  
+  close (tty);
+  close (fb);
+}
+
+#if 0000
+/* Draw a hollow rectangle from (X1,Y1) to (X2,Y2) in color C. */
+void
+bogl_rectangle (int x1, int y1, int x2, int y2, int c)
+{
+  bogl_hline (x1, x2, y1, c);
+  bogl_vline (x1, y1, y2, c);
+  bogl_hline (x1, x2, y2 - 1, c);
+  bogl_vline (x2 - 1, y1, y2, c);
+}
+
+/* Returns the width of string S when output in font FONT. */
+int
+bogl_metrics (const char *s, int n, struct bogl_font *font)
+{
+  int cx = 0;
+  
+  while (n--)
+    cx += font->width[(unsigned char) *s++];
+  return cx;
+}
+#endif
+
+/* Set whether to convert colors to grayscale.  You'll need to re-set
+   the palette with bogl_set_palette() for this to take effect. */
+void
+bogl_gray_scale (int make_gray)
+{
+  gray = make_gray;
+}
+
+/* Set NC color palettes values starting at C to red-green-blue value
+   specified in PALETTE.  Use 8-bit color values as input. */
+void
+bogl_set_palette (int c, int nc, const unsigned char (*palette)[3])
+{
+  struct fb_cmap cmap;
+
+  __u16 red[nc];
+  __u16 green[nc];
+  __u16 blue[nc];
+
+  int i;
+
+  for (i = 0; i < nc; i++)
+    {
+      const unsigned char *e = palette[i];
+      
+      if (gray)
+	red[i] = green[i] = blue[i] = (e[0] * 77 + e[1] * 151 + e[2] * 28);
+      else
+	{
+	  red[i] = e[0] << 8;
+	  green[i] = e[1] << 8;
+	  blue[i] = e[2] << 8;
+	}
+    }
+
+  cmap.start = c;
+  cmap.len = nc;
+  cmap.red = red;
+  cmap.green = green;
+  cmap.blue = blue;
+  cmap.transp = NULL;
+
+  if(ioctl (fb, FBIOPUTCMAP, &cmap) == -1)
+	  printf("putcmap fail\n");
+}
+
+/* Returns the oldest error message since this function was last
+   called.  Clears the error state.  Returns a null pointer if no
+   errors have occurred.  The caller must free the returned
+   pointer if memory leaks are to be prevented. */
+const char *
+bogl_error (void)
+{
+  char *msg = error;
+  error = NULL;
+  return msg;
+}
+
+/* Drawing function setup/disable. */
+
+/* Dummy drawing functions to disable display. */
+static void
+dummy_pixel (int x unused, int y unused, int c unused)
+{}
+
+static int
+dummy_readpixel (int x unused, int y unused)
+{
+	return 0;
+}
+
+static void 
+dummy_hline (int x1 unused, int x2 unused, int y unused, int c unused)
+{}
+
+static void 
+dummy_vline (int x unused, int y1 unused, int y2 unused, int c unused)
+{}
+
+static void
+dummy_text (int x unused, int y unused, const char *s unused, int n unused,
+	    int fg unused, int bg unused, struct bogl_font *font unused)
+{}
+
+static void
+dummy_clear (int x1 unused, int y1 unused, int x2 unused, int y2 unused,
+	     int c unused)
+{}
+
+static void
+dummy_move (int sx unused, int sy unused, int dx unused, int dy unused,
+	    int w unused, int h unused)
+{}
+
+static void
+dummy_put (int x unused, int y unused, const struct bogl_pixmap *pixmap unused,
+	   const int color_map[] unused)
+{}
+
+static void
+dummy_pointer (int visible unused, int x unused, int y unused,
+	       const struct bogl_pointer *pointer unused,
+	       int colors[2] unused)
+{}
+
+
+/* Enable drawing by setting the bogl_* device-specific functions to
+   their appropriate values for the detected device. */
+static int
+draw_enable (void)
+{
+#if BOGL_VGA16_FB
+  if (type == FB_TYPE_VGA_PLANES)
+    {
+      bogl_pixel = bogl_vga16_pixel;
+      bogl_readpixel = bogl_vga16_readpixel;
+      bogl_hline = bogl_vga16_hline;
+      bogl_vline = bogl_vga16_vline;
+#if !SMALLBOGL
+      bogl_clear = bogl_vga16_clear;
+      bogl_text = bogl_vga16_text;
+      bogl_put = bogl_vga16_put;
+      bogl_pointer = bogl_vga16_pointer;
+#endif
+      return 1;
+    }
+#endif
+
+#if BOGL_CFB8_FB
+  if (type == FB_TYPE_PACKED_PIXELS
+      && (visual == FB_VISUAL_PSEUDOCOLOR || visual == FB_VISUAL_TRUECOLOR)
+      && bogl_ncols == 256)
+    {
+      bogl_pixel = bogl_cfb8_pixel;
+      bogl_readpixel = bogl_cfb8_readpixel;
+      bogl_hline = bogl_cfb8_hline;
+      bogl_vline = bogl_cfb8_vline;
+#if !SMALLBOGL
+      bogl_clear = bogl_cfb8_clear;
+      bogl_text = bogl_cfb8_text;
+      bogl_put = bogl_cfb8_put;
+      bogl_pointer = bogl_cfb8_pointer;
+#endif
+      return 1;
+    }
+#endif
+
+  return 0;
+}
+      
+/* Disable drawing by setting all the bogl_* device-specific functions
+   to dummy functions. */
+static void
+draw_disable (void)
+{
+  bogl_pixel = dummy_pixel;
+  bogl_readpixel = dummy_readpixel;
+  bogl_hline = dummy_hline;
+  bogl_vline = dummy_vline;
+  bogl_text = dummy_text;
+  bogl_clear = dummy_clear;
+  bogl_move = dummy_move;
+  bogl_put = dummy_put;
+  bogl_pointer = dummy_pointer;
+}
+
+/* Signal handler called whenever the kernel wants to switch to or
+   from our tty. */
+static void
+vt_switch (int sig unused)
+{
+  signal (SIGUSR2, vt_switch);
+
+  /* If a BOGL drawing function is in progress then we cannot mode
+     switch right now because the drawing function would continue to
+     scribble on the screen after the switch.  So disable further
+     drawing and schedule an alarm to try again in .1 second. */
+  if (bogl_drawing)
+    {
+      draw_disable ();
+
+      signal (SIGALRM, vt_switch);
+      
+      {
+	struct itimerval duration;
+	
+	duration.it_interval.tv_sec = 0;
+	duration.it_interval.tv_usec = 0;
+	duration.it_value.tv_sec = 0;
+	duration.it_value.tv_usec = 100000;
+	if (-1 == setitimer (ITIMER_REAL, &duration, NULL))
+	  bogl_fail ("can't set timer: %m");
+      }
+      
+      return;
+    }
+      
+  if (visible)
+    {
+      visible = 0;
+      draw_disable ();
+
+      if (-1 == ioctl (tty, VT_RELDISP, 1))
+	bogl_fail ("can't switch away from VT: %m");
+    }
+  else
+    {
+      visible = 1;
+      draw_enable ();
+      
+      if (-1 == ioctl (tty, VT_RELDISP, VT_ACKACQ))
+	bogl_fail ("can't acknowledge VT switch: %m");
+
+      bogl_refresh = 1;
+    }
+}
+
+/* Sets the BOGL error message to MESSAGE if there is none already
+   set.  Returns 0. */
+int
+bogl_fail (const char *format, ...)
+{
+  va_list args;
+
+  if (error)
+    return 0;
+
+  va_start (args, format);
+  vasprintf (&error, format, args);
+  va_end (args);
+printf("error %s\n", error);
+printf("%dx%dx%d linelen %d type %d visual %d\n", bogl_xres, bogl_yres, bogl_ncols, bogl_line_len, type, visual);
+printf("Screen types supported:\n");
+#if BOGL_VGA16_FB
+	printf("%d\n", FB_TYPE_VGA_PLANES);
+#endif
+#if BOGL_CFB8_FB
+	printf("%d\n", FB_TYPE_PACKED_PIXELS);
+#endif
+  return 0;
+}
+
diff -urN lib/microwindows/src/drivers/bogl.x/bogl.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/bogl.h
--- lib/microwindows/src/drivers/bogl.x/bogl.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/bogl.h	2005-02-21 16:13:03.000000000 +0100
@@ -0,0 +1,92 @@
+/* BOGL - Ben's Own Graphics Library.
+   Written by Ben Pfaff <pfaffben@debian.org>.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+   USA. */
+
+#ifndef bogl_h
+#define bogl_h
+
+/* Proportional font structure definition. */
+struct bogl_font
+  {
+    char *name;				/* Font name. */
+    int height;				/* Height in pixels. */
+    unsigned long *content;		/* 32-bit right-padded bitmap array. */
+    short *offset;			/* 256 offsets into content. */
+    unsigned char *width;		/* 256 character widths. */
+  };
+
+/* Pixmap structure definition. */
+struct bogl_pixmap
+  {
+    int width, height;			/* Width, height in pixels. */
+    int ncols;				/* Number of colors. */
+    int transparent;			/* Transparent color or -1 if none. */
+    unsigned char (*palette)[3];	/* Palette. */
+    unsigned char *data;		/* Run-length compressed data. */
+  };
+
+/* Pointer structure definition. */
+struct bogl_pointer
+  {
+    int hx, hy;				/* Hot spot. */
+    unsigned short mask[16];		/* Drawing mask: 0=clear, 1=drawn. */
+    unsigned short color[16];		/* Pixel colors: 0=black, 1=white. */
+  };
+
+/* Screen parameters. */
+extern int bogl_xres, bogl_yres, bogl_ncols;
+extern int bogl_truecolor;
+
+/* 1=Must refresh screen due to tty change. */
+extern int bogl_refresh;
+
+/* Generic routines. */
+int bogl_init (void);
+void bogl_done (void);
+const char *bogl_error (void);
+
+void bogl_line(int x1, int y1, int x2, int y2, int color);
+void bogl_drawellipse(int x, int y, int rx, int ry, int color);
+void bogl_fillellipse(int x, int y, int rx, int ry, int color);
+
+void bogl_gray_scale (int make_gray);
+void bogl_set_palette (int c, int nc, const unsigned char (*palette)[3]);
+void bogl_rectangle (int x1, int y1, int x2, int y2, int c);
+int bogl_metrics (const char *s, int n, struct bogl_font *font);
+
+#define bogl_char_width(CH, FONT)		\
+	((FONT)->width[(unsigned char) (CH)])
+
+#define bogl_font_height(FONT)			\
+	((FONT)->height)
+
+/* Device-specific routines. */
+void (*bogl_pixel) (int x, int y, int c);
+int (*bogl_readpixel) (int x, int y);
+void (*bogl_hline) (int x1, int x2, int y, int c);
+void (*bogl_vline) (int x, int y1, int y2, int c);
+void (*bogl_text) (int x, int y, const char *s, int n, int fg, int bg,
+		   struct bogl_font *font);
+void (*bogl_clear) (int x1, int y1, int x2, int y2, int c);
+void (*bogl_move) (int sx, int sy, int dx, int dy, int w, int h);
+void (*bogl_put) (int x, int y, const struct bogl_pixmap *pixmap,
+		  const int color_map[16]);
+void (*bogl_pointer) (int visible, int x, int y,
+		      const struct bogl_pointer *,
+		      int colors[2]);
+
+#endif /* bogl_h */
diff -urN lib/microwindows/src/drivers/bogl.x/boglP.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/boglP.h
--- lib/microwindows/src/drivers/bogl.x/boglP.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/boglP.h	2005-02-21 16:13:04.000000000 +0100
@@ -0,0 +1,28 @@
+/* BOGL - Ben's Own Graphics Library.
+   Written by Ben Pfaff <pfaffben@debian.org>.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+   USA. */
+
+#ifndef boglP_h
+#define boglP_h
+
+extern unsigned char *bogl_frame;	/* Framebuffer. */
+extern int bogl_drawing;		/* Currently drawing? */
+extern int bogl_line_len;		/* Bytes per scanline. */
+
+int bogl_fail (const char *, ...);
+
+#endif /* boglP_h */
diff -urN lib/microwindows/src/drivers/bogl.x/fbvt.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/fbvt.c
--- lib/microwindows/src/drivers/bogl.x/fbvt.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/bogl.x/fbvt.c	2005-02-21 16:13:04.000000000 +0100
@@ -0,0 +1,78 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <linux/vt.h>
+/*
+ * Framebuffer VT switch operations
+ */
+
+int	vterm;			/* the VT we were started on */
+int 	cvt, ocvt;
+static int ttyfd = -1;
+
+/* entry points*/
+void 	fb_InitVt(void);
+int  	fb_CurrentVt(void);
+int  	fb_CheckVtChange(void);
+void 	fb_RedrawVt(int t);
+
+void
+fb_InitVt(void)
+{
+	ttyfd = open("/dev/tty0", O_RDONLY);
+	cvt = ocvt = vterm = fb_CurrentVt();
+	/*
+	 * Note: this hack is required to get Linux
+	 * to orient virtual 0,0 with physical 0,0
+	 * I have no idea why this kluge is required...
+	 */
+	fb_RedrawVt(vterm);
+}
+
+/*
+ * This function is used to find out what the current active VT is.
+ */
+int
+fb_CurrentVt(void)
+{
+	struct vt_stat stat;
+
+	ioctl(ttyfd, VT_GETSTATE, &stat);
+	return stat.v_active;
+}
+
+/*
+ * Check if our VT has changed.  Return 1 if so.
+ */
+int
+fb_CheckVtChange(void)
+{
+	cvt = fb_CurrentVt();
+	if(cvt != ocvt && cvt == vterm) {
+		ocvt = cvt;
+		return 1;
+	}
+	ocvt = cvt;
+	return 0;
+}
+
+/*
+ * This function is used to cause a redraw of the text console.
+ * FIXME: Switching to another console and
+ * back works, but that's a really dirty hack
+ */
+void
+fb_RedrawVt(int t)
+{
+	if(fb_CurrentVt() == vterm) {
+		ioctl(ttyfd, VT_ACTIVATE, t == 1 ? 2 : 1); /* Awful hack!!*/
+		ioctl(ttyfd, VT_ACTIVATE, t);
+	}
+}
+
+void
+fb_ExitVt(void)
+{
+	if(ttyfd != -1)
+		close(ttyfd);
+}
diff -urN lib/microwindows/src/drivers/elkplan4.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/elkplan4.c
--- lib/microwindows/src/drivers/elkplan4.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/elkplan4.c	2005-02-21 16:13:04.000000000 +0100
@@ -0,0 +1,419 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Microwindows
+ * ELKS EGA/VGA Screen Driver 16 color 4 planes - 16-bit assembly version
+ * 
+ * This file is an adapation of the asmplan4.s MSC asm driver for ELKS
+ */
+#include "device.h"
+#include "vgaplan4.h"
+
+/* assumptions for speed: NOTE: psd is ignored in these routines*/
+#define SCREENSEG		$0a000
+#define SCREENBASE 		MK_FP(0xa000, 0)
+#define BYTESPERLINE		80
+
+/* extern data*/
+extern int gr_mode;	/* temp kluge*/
+
+static unsigned char mode_table[MWMODE_MAX + 1] = {
+  0x00, 0x18, 0x10, 0x08
+};
+
+int
+ega_init(PSD psd)
+{
+	/* fill in screendevice struct*/
+	psd->addr = SCREENBASE;
+	psd->linelen = BYTESPERLINE;
+
+	/* Set up some default values for the VGA Graphics Registers. */
+	set_enable_sr (0x0f);
+	set_op (0);
+	set_mode (0);
+
+	return 1;
+}
+
+/*
+* Routine to draw a horizontal line.
+*	ega_drawhine(psd, x1, x2, y, color);
+*
+*	works in the following EGA and VGA modes:
+*	200 line 16 colors modes
+*	350 line modes
+*	640x480 16 color
+*/
+/* Draw horizontal line from x1,y to x2,y including final point*/
+void
+ega_drawhorzline(PSD psd, int x1, int x2, int y, int color)
+{
+#asm
+	push	bp		; setup stack frame and preserve registers
+	mov	bp, sp
+	push	si
+	push	di
+	push	es
+
+	; configure the graphics controller
+
+	mov	dx, #$03ce	; DX := Graphics Controller port address
+	
+	mov	al, #3		; set data rotate register
+	lea	bx, _mode_table
+	add	bx, _gr_mode
+	mov	ah, [bx]
+	out	dx, ax
+
+	mov 	ah, [bp+12]	; pixel value
+	xor	al, al		; Set/Reset register number (0)
+	out	dx, ax
+
+	mov	ax, #$0f01	; AH := bit plane mask for Enable Set/Reset
+	out	dx, ax		; AL := Enable Set/Reset register number
+
+	push	ds		; preserve DS
+
+	mov	ax, [bp+10]	; y
+	mov	bx, [bp+6]	; x1
+
+	; compute pixel address
+	mov	dx, #BYTESPERLINE ; AX := [row * BYTESPERLINE]
+	mul	dx
+	mov 	cl, bl		; save low order column bits
+	shr	bx, #1		; BX := [col / 8]
+	shr	bx, #1
+	shr	bx, #1
+	add	bx, ax		; BX := [row * BYTESPERLINE] + [col / 8]
+	and	cl, #$07	; CL := [col % 8]
+	xor	cl, #$07	; CL := 7 - [col % 8]
+	mov 	ah, #$01	; AH := 1 << [7 - [col % 8]]	[mask]
+	mov	dx, #SCREENSEG	; ES := EGA buffer segment address
+	mov	es, dx
+				; AH := bit mask
+				; ES:BX -> video buffer
+				; CL := number bits to shift left
+	mov	di, bx		; ES:DI -> buffer
+	mov 	dh, ah		; DH := unshifted bit mask for left byte
+
+	not	dh
+	shl	dh, cl		; DH := reverse bit mask for first byte
+	not	dh		; DH := bit mask for first byte
+
+	mov	cx, [bp+8]	; x2
+	and	cl, #7
+	xor	cl, #7		; CL := number of bits to shift left
+	mov 	dl, #$0ff	; DL := unshifted bit mask for right byte
+	shl	dl, cl		; DL := bit mask for last byte
+
+	; determine byte offset of first and last pixel in the line
+
+	mov	ax, [bp+8]	; AX := x2
+	mov	bx, [bp+6]	; BX := x1
+
+	mov 	cl, #3		; bits to convert pixels to bytes
+
+	shr	ax, cl		; AX := byte offset of X2
+	shr	bx, cl		; BX := byte offset of X1
+	mov	cx, ax
+	sub	cx, bx		; CX := [number of bytes in line] - 1
+
+	; get Graphics Controller port address into DX
+
+	mov	bx, dx		; BH := bit mask for first byte
+				; BL := bit mask for last byte
+	mov	dx, #$03ce	; DX := Graphics Controller port
+	mov 	al, #8		; AL := Bit mask Register number
+
+	; make video buffer addressable through DS:SI
+
+	push	es
+	pop	ds
+	mov	si, di		; DS:SI -> video buffer
+
+	; set pixels in leftmost byte of the line
+
+	or	bh, bh
+	js	L43		; jump if byte-aligned [x1 is leftmost]
+
+	or	cx, cx
+	jnz	L42		; jump if more than one byte in the line
+
+	and	bl, bh		; BL := bit mask for the line
+	jmp near L44
+
+L42:	mov 	ah, bh		; AH := bit mask for first byte
+	out	dx, ax		; update graphics controller
+
+	movsb			; update bit planes
+	dec	cx
+
+	; use a fast 8086 machine instruction to draw the remainder of the line
+
+L43:	mov 	ah, #$0ff	; AH := bit mask
+	out	dx, ax		; update Bit Mask register
+	rep 
+	movsb			; update all pixels in the line
+
+	; set pixels in the rightmost byte of the line
+
+L44:	mov 	ah, bl		; AH := bit mask for last byte
+	out	dx, ax		; update Graphics Controller
+	movsb			; update bit planes
+
+	pop	ds		; restore ds
+
+	; restore default Graphics Controller state and return to caller
+	;;xor	ax, ax		; AH := 0, AL := 0
+	;;out	dx, ax		; restore Set/Reset register
+	;;inc	ax		; AH := 0, AL := 1
+	;;out	dx, ax		; restore Enable Set/Reset register
+	;;mov	ax, #$0ff08	; AH := 0xff, AL := 0
+	;;out	dx, ax		; restore Bit Mask register
+
+	pop	es
+	pop	di
+	pop	si
+	pop	bp
+#endasm
+}
+
+/*
+* Routine to draw a vertical line.
+* Called from C:
+*	ega_drawvline(psd, x, y1, y2, color);
+*
+*	works in the following EGA and VGA modes:
+*	200 line 16 colors modes
+*	350 line modes
+*	640x480 16 color
+*/
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+void
+ega_drawvertline(PSD psd, int x,int y1, int y2, int color)
+{
+#asm
+	push	bp		; setup stack frame and preserve registers
+	mov	bp, sp
+	push	ds
+
+	; configure the graphics controller
+
+	mov	dx, #$03ce	; DX := Graphics Controller port address
+
+	mov	al, #3		; set data rotate register
+	lea	bx, _mode_table
+	add	bx, _gr_mode
+	mov	ah, [bx]
+	out	dx, ax
+
+	mov 	ah, [bp+12]	; color pixel value
+	xor	al, al		; Set/Reset register number (0)
+	out	dx, ax
+
+	mov	ax, #$0f01	; AH := bit plane mask for Enable Set/Reset
+	out	dx, ax		; AL := Enable Set/Reset register number
+
+	; prepare to draw vertical line
+
+	mov	ax, [bp+8]	; AX := y1
+	mov	cx, [bp+10]	; BX := y2
+	;;mov	cx, bx
+	sub	cx, ax		; CX := dy
+	;;jge	L311		; jump if dy >= 0
+	;;neg	cx		; force dy >= 0
+	;;mov	ax, bx		; AX := y2
+
+L311:	inc	cx		; CX := number of pixels to draw
+	mov	bx, [bp+6]	; BX := x
+	push	cx		; save register
+
+	; compute pixel address
+	push	dx
+	mov	dx, #BYTESPERLINE ; AX := [row * BYTESPERLINE]
+	mul	dx
+	mov 	cl, bl		; save low order column bits
+	shr	bx, #1		; BX := [col / 8]
+	shr	bx, #1
+	shr	bx, #1
+	add	bx, ax		; BX := [row * BYTESPERLINE] + [col / 8]
+	and	cl, #$07	; CL := [col % 8]
+	xor	cl, #$07	; CL := 7 - [col % 8]
+	mov 	ah, #$01	; AH := 1 << [7 - [col % 8]]	[mask]
+	mov	dx, #SCREENSEG	; DS := EGA buffer segment address
+	mov	ds, dx
+	pop	dx
+				; AH := bit mask
+				; DS:BX -> video buffer
+				; CL := number bits to shift left
+
+	; set up Graphics controller
+
+	shl	ah, cl		; AH := bit mask in proper position
+	mov 	al, #$08	; AL := Bit Mask register number
+	out	dx, ax
+
+	pop	cx		; restore register
+
+	; draw the line
+
+	mov	dx, #BYTESPERLINE ; increment for video buffer
+L1111:	or	[bx], al	; set pixel
+	add	bx, dx		; increment to next line
+	loop	L1111
+
+	; restore default Graphics Controller state and return to caller
+	;;xor	ax, ax		; AH := 0, AL := 0
+	;;out	dx, ax		; restore Set/Reset register
+	;;inc	ax		; AH := 0, AL := 1
+	;;out	dx, ax		; restore Enable Set/Reset register
+	;;mov	ax, #$0ff08	; AH := 0xff, AL := 0
+	;;out	dx, ax		; restore Bit Mask register
+
+	pop	ds
+	pop	bp
+#endasm
+}
+
+/*
+* Routine to set an individual pixel value.
+* Called from C like:
+*	ega_drawpixel(psd, x, y, color);
+*/
+void
+ega_drawpixel(PSD psd, int x, int y, int color)
+{
+#asm
+	push	bp
+	mov	bp, sp
+
+	mov	dx, #$03ce	; graphics controller port address
+	mov	al, #3		; set data rotate register
+	lea	bx, _mode_table
+	add	bx, _gr_mode
+	mov	ah, [bx]
+	out	dx, ax
+
+	mov	cx, [bp+6]	; ECX := x
+	mov	ax, [bp+8]	; EAX := y
+
+	mov	dx, #BYTESPERLINE ; AX := [y * BYTESPERLINE]
+	mul	dx
+
+	mov	bx, cx		; BX := [x / 8]
+	shr	bx, #1
+	shr	bx, #1
+	shr	bx, #1
+
+	add	bx, ax		; BX := [y * BYTESPERLINE] + [x / 8]
+
+	and	cl, #$07	; CL := [x % 8]
+	xor	cl, #$07	; CL := 7 - [x % 8]
+	mov 	ch, #$01	; CH := 1 << [7 - [x % 8]]	[mask]
+	shl	ch, cl
+
+	mov	dx, #$03ce	; graphics controller port address
+
+	;;required for old code
+	mov	ax, #$0205	; select write mode 2
+	out	dx, ax		; [load value 2 into mode register 5]
+
+	; new code
+	;;xor	ax,ax		; set color register 0
+	;;mov	ah,[bp+10]	; color pixel value
+	;;out	dx,ax
+
+	; original code
+	mov 	al, #$08	; set the bit mask register
+	mov 	ah, ch		; [load bit mask into register 8]
+	out	dx, ax
+
+	push	ds
+	mov	ax, #SCREENSEG	; DS := EGA buffer segment address
+	mov	ds, ax
+
+	; new code
+	;;or	[bx],al		; quick rmw to set pixel
+
+	;;the following fails under ELKS without cli/sti
+	;;using ES works though.  Code changed to use single
+	;;rmw above rather than write mode 2, but the
+	;;reason for this failure is still unknown...
+	;;cli
+	mov 	al, [bx]	; dummy read to latch bit planes
+	mov	al, [bp+10]	; pixel value
+	mov 	[bx], al	; write pixel back to bit planes
+	;;sti
+
+	pop	ds		; restore registers and return
+
+	mov	ax, #$0005	; restore default write mode 0
+	out	dx, ax		; [load value 0 into mode register 5]
+
+	;;mov	ax, #$0ff08	; restore default bit mask
+	;;out	dx, ax		; [load value ff into register 8]
+
+	pop	bp
+#endasm
+}
+
+/*
+* Routine to read the value of an individual pixel.
+* Called from C like:
+* 	color = ega_readpixel(psd, x, y);
+*/
+PIXELVAL
+ega_readpixel(PSD psd, int x, int y)
+{
+#asm
+	push	bp
+	mov	bp, sp
+	push	si
+	push	ds
+
+	mov	ax, [bp+8]	; EAX := y
+	mov	bx, [bp+6]	; EBX := x
+	mov	dx, #BYTESPERLINE ; AX := [y * BYTESPERLINE]
+	mul	dx
+
+	mov 	cl, bl		; save low order column bits
+	shr	bx, #1		; BX := [x / 8]
+	shr	bx, #1
+	shr	bx, #1
+
+	add	bx, ax		; BX := [y * BYTESPERLINE] + [x / 8]
+
+	and	cl, #$07	; CL := [x % 8]
+	xor 	cl, #$07	; CL := 7 - [x % 8]
+
+	mov	dx, #SCREENSEG	; DS := EGA buffer segment address
+	mov	ds, dx
+
+	mov 	ch, #$01	; CH := 1 << [7 - [col % 8]]  [mask]
+	shl	ch, cl		; CH := bit mask in proper position
+
+	mov	si, bx		; DS:SI -> region buffer byte
+	xor	bl, bl		; BL is used to accumulate the pixel value
+
+	mov	dx, #$03ce	; DX := Graphics Controller port
+	mov	ax, #$0304	; AH := initial bit plane number
+				; AL := Read Map Select register number
+
+L112:	out	dx, ax		; select bit plane
+	mov 	bh, [si]	; BH := byte from current bit plane
+	and	bh, ch		; mask one bit
+	neg	bh		; bit 7 of BH := 1 if masked bit = 1
+				; bit 7 of BH := 0 if masked bit = 0
+	rol	bx, #1		; bit 0 of BL := next bit from pixel value
+	dec	ah		; AH := next bit plane number
+	jge	L112
+
+	xor	ax, ax		; AL := pixel value
+	mov 	al, bl
+
+	pop	ds
+	pop	si
+	pop	bp	
+#endasm
+}
diff -urN lib/microwindows/src/drivers/elkplan4.ok /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/elkplan4.ok
--- lib/microwindows/src/drivers/elkplan4.ok	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/elkplan4.ok	2005-02-21 16:13:12.000000000 +0100
@@ -0,0 +1,404 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * MicroWindows
+ * ELKS EGA/VGA Screen Driver 16 color 4 planes - Assembly version
+ * 
+ * This file is an adapation of the asmplan4.s MSC asm driver for ELKS
+ */
+#include "../device.h"
+
+/* number of bytes in scan line*/
+#define PIXBYTES	80
+
+/* extern data*/
+extern MODE gr_mode;	/* temp kluge*/
+
+static unsigned char mode_table[MODE_MAX + 1] = {
+  0x00, 0x18, 0x10, 0x08
+};
+
+void
+ega_init(void)
+{
+}
+
+/*
+* Routine to draw a horizontal line.
+*	ega_drawhine(x1, x2, y, color);
+*
+*	works in the following EGA and VGA modes:
+*	200 line 16 colors modes
+*	350 line modes
+*	640x480 16 color
+*/
+void
+ega_drawhline(int x1, int x2, int y, int color)
+{
+#asm
+	push	bp		; setup stack frame and preserve registers
+	mov	bp, sp
+	push	si
+	push	di
+	push	es
+
+	; configure the graphics controller
+
+	mov	dx, #$03ce	; DX := Graphics Controller port address
+	
+	mov	al, #3		; set data rotate register
+	lea	bx, _mode_table
+	add	bx, _gr_mode
+	mov	ah, [bx]
+	out	dx, ax
+
+	mov 	ah, [bp+10]	; pixel value
+	xor	al, al		; Set/Reset register number (0)
+	out	dx, ax
+
+	mov	ax, #$0f01	; AH := bit plane mask for Enable Set/Reset
+	out	dx, ax		; AL := Enable Set/Reset register number
+
+	push	ds		; preserve DS
+
+	mov	ax, [bp+8]	; y
+	mov	bx, [bp+4]	; x1
+
+	; compute pixel address
+	mov	dx, #PIXBYTES	; AX := [row * PIXBYTES]
+	mul	dx
+	mov 	cl, bl		; save low order column bits
+	shr	bx, #1		; BX := [col / 8]
+	shr	bx, #1
+	shr	bx, #1
+	add	bx, ax		; BX := [row * PIXBYTES] + [col / 8]
+	and	cl, #$07	; CL := [col % 8]
+	xor	cl, #$07	; CL := 7 - [col % 8]
+	mov 	ah, #$01	; AH := 1 << [7 - [col % 8]]	[mask]
+	mov	dx, #$0a000	; ES := EGA buffer segment address
+	mov	es, dx
+				; AH := bit mask
+				; ES:BX -> video buffer
+				; CL := number bits to shift left
+	mov	di, bx		; ES:DI -> buffer
+	mov 	dh, ah		; DH := unshifted bit mask for left byte
+
+	not	dh
+	shl	dh, cl		; DH := reverse bit mask for first byte
+	not	dh		; DH := bit mask for first byte
+
+	mov	cx, [bp+6]	; x2
+	and	cl, #7
+	xor	cl, #7		; CL := number of bits to shift left
+	mov 	dl, #$0ff	; DL := unshifted bit mask for right byte
+	shl	dl, cl		; DL := bit mask for last byte
+
+	; determine byte offset of first and last pixel in the line
+
+	mov	ax, [bp+6]	; AX := x2
+	mov	bx, [bp+4]	; BX := x1
+
+	mov 	cl, #3		; bits to convert pixels to bytes
+
+	shr	ax, cl		; AX := byte offset of X2
+	shr	bx, cl		; BX := byte offset of X1
+	mov	cx, ax
+	sub	cx, bx		; CX := [number of bytes in line] - 1
+
+	; get Graphics Controller port address into DX
+
+	mov	bx, dx		; BH := bit mask for first byte
+				; BL := bit mask for last byte
+	mov	dx, #$03ce	; DX := Graphics Controller port
+	mov 	al, #8		; AL := Bit mask Register number
+
+	; make video buffer addressable through DS:SI
+
+	push	es
+	pop	ds
+	mov	si, di		; DS:SI -> video buffer
+
+	; set pixels in leftmost byte of the line
+
+	or	bh, bh
+	js	L43		; jump if byte-aligned [x1 is leftmost]
+
+	or	cx, cx
+	jnz	L42		; jump if more than one byte in the line
+
+	and	bl, bh		; BL := bit mask for the line
+	jmp L44
+
+L42:	mov 	ah, bh		; AH := bit mask for first byte
+	out	dx, ax		; update graphics controller
+
+	movsb			; update bit planes
+	dec	cx
+
+	; use a fast 8086 machine instruction to draw the remainder of the line
+
+L43:	mov 	ah, #$0ff	; AH := bit mask
+	out	dx, ax		; update Bit Mask register
+	rep 
+	movsb			; update all pixels in the line
+
+	; set pixels in the rightmost byte of the line
+
+L44:	mov 	ah, bl		; AH := bit mask for last byte
+	out	dx, ax		; update Graphics Controller
+	movsb			; update bit planes
+
+	pop	ds		; restore ds
+
+	; restore default Graphics Controller state and return to caller
+	;;xor	ax, ax		; AH := 0, AL := 0
+	;;out	dx, ax		; restore Set/Reset register
+	;;inc	ax		; AH := 0, AL := 1
+	;;out	dx, ax		; restore Enable Set/Reset register
+	;;mov	ax, #$0ff08	; AH := 0xff, AL := 0
+	;;out	dx, ax		; restore Bit Mask register
+
+	pop	es
+	pop	di
+	pop	si
+	pop	bp
+#endasm
+}
+
+/*
+* Routine to draw a vertical line.
+* Called from C:
+*	ega_drawvline(x, y1, y2, color);
+*
+*	works in the following EGA and VGA modes:
+*	200 line 16 colors modes
+*	350 line modes
+*	640x480 16 color
+*/
+void
+ega_drawvline(int x,int y1, int y2, int color)
+{
+#asm
+	push	bp		; setup stack frame and preserve registers
+	mov	bp, sp
+	push	ds
+
+	; configure the graphics controller
+
+	mov	dx, #$03ce	; DX := Graphics Controller port address
+
+	mov	al, #3		; set data rotate register
+	lea	bx, _mode_table
+	add	bx, _gr_mode
+	mov	ah, [bx]
+	out	dx, ax
+
+	mov 	ah, [bp+10]	; color pixel value
+	xor	al, al		; Set/Reset register number (0)
+	out	dx, ax
+
+	mov	ax, #$0f01	; AH := bit plane mask for Enable Set/Reset
+	out	dx, ax		; AL := Enable Set/Reset register number
+
+	; prepare to draw vertical line
+
+	mov	ax, [bp+6]	; AX := y1
+	mov	cx, [bp+8]	; BX := y2
+	;;mov	cx, bx
+	sub	cx, ax		; CX := dy
+	;;jge	L311		; jump if dy >= 0
+	;;neg	cx		; force dy >= 0
+	;;mov	ax, bx		; AX := y2
+
+L311:	inc	cx		; CX := number of pixels to draw
+	mov	bx, [bp+4]	; BX := x
+	push	cx		; save register
+
+	; compute pixel address
+	push	dx
+	mov	dx, #PIXBYTES	; AX := [row * PIXBYTES]
+	mul	dx
+	mov 	cl, bl		; save low order column bits
+	shr	bx, #1		; BX := [col / 8]
+	shr	bx, #1
+	shr	bx, #1
+	add	bx, ax		; BX := [row * PIXBYTES] + [col / 8]
+	and	cl, #$07	; CL := [col % 8]
+	xor	cl, #$07	; CL := 7 - [col % 8]
+	mov 	ah, #$01	; AH := 1 << [7 - [col % 8]]	[mask]
+	mov	dx, #$0a000	; DS := EGA buffer segment address
+	mov	ds, dx
+	pop	dx
+				; AH := bit mask
+				; DS:BX -> video buffer
+				; CL := number bits to shift left
+
+	; set up Graphics controller
+
+	shl	ah, cl		; AH := bit mask in proper position
+	mov 	al, #$08	; AL := Bit Mask register number
+	out	dx, ax
+
+	pop	cx		; restore register
+
+	; draw the line
+
+	mov	dx, #PIXBYTES	; increment for video buffer
+L1111:	or	[bx], al	; set pixel
+	add	bx, dx		; increment to next line
+	loop	L1111
+
+	; restore default Graphics Controller state and return to caller
+	;;xor	ax, ax		; AH := 0, AL := 0
+	;;out	dx, ax		; restore Set/Reset register
+	;;inc	ax		; AH := 0, AL := 1
+	;;out	dx, ax		; restore Enable Set/Reset register
+	;;mov	ax, #$0ff08	; AH := 0xff, AL := 0
+	;;out	dx, ax		; restore Bit Mask register
+
+	pop	ds
+	pop	bp
+#endasm
+}
+
+/*
+* Routine to set an individual pixel value.
+* Called from C like:
+*	ega_drawpixel(x, y, color);
+*/
+void
+ega_drawpixel(int x,int y, int color)
+{
+#asm
+	push	bp
+	mov	bp, sp
+
+	mov	dx, #$03ce	; graphics controller port address
+	mov	al, #3		; set data rotate register
+	lea	bx, _mode_table
+	add	bx, _gr_mode
+	mov	ah, [bx]
+	out	dx, ax
+
+	mov	cx, [bp+4]	; ECX := x
+	mov	ax, [bp+6]	; EAX := y
+
+	mov	dx, #PIXBYTES	; AX := [y * PIXBYTES]
+	mul	dx
+
+	mov	bx, cx		; BX := [x / 8]
+	shr	bx, #1
+	shr	bx, #1
+	shr	bx, #1
+
+	add	bx, ax		; BX := [y * PIXBYTES] + [x / 8]
+
+	and	cl, #$07	; CL := [x % 8]
+	xor	cl, #$07	; CL := 7 - [x % 8]
+	mov 	ch, #$01	; CH := 1 << [7 - [x % 8]]	[mask]
+	shl	ch, cl
+
+	mov	dx, #$03ce	; graphics controller port address
+
+	;;required for old code
+	;;mov	ax, #$0205	; select write mode 2
+	;;out	dx, ax		; [load value 2 into mode register 5]
+
+	; new code
+	xor	ax,ax		; set color register 0
+	mov	ah,[bp+8]	; color pixel value
+	out	dx,ax
+
+	; original code
+	mov 	al, #$08	; set the bit mask register
+	mov 	ah, ch		; [load bit mask into register 8]
+	out	dx, ax
+
+	push	ds
+	mov	ax, #$0a000	; DS := EGA buffer segment address
+	mov	ds, ax
+
+	; new code
+	or	[bx],al		; quick rmw to set pixel
+
+	;;the following fails under ELKS without cli/sti
+	;;using ES works though.  Code changed to use single
+	;;rmw above rather than write mode 2, but the
+	;;reason for this failure is still unknown...
+	;;cli
+	;;mov 	al, [bx]	; dummy read to latch bit planes
+	;;mov	al, [bp+8]	; pixel value
+	;;mov 	[bx], al	; write pixel back to bit planes
+	;;sti
+
+	pop	ds		; restore registers and return
+
+	mov	ax, #$0005	; restore default write mode 0
+	out	dx, ax		; [load value 0 into mode register 5]
+
+	;;mov	ax, #$0ff08	; restore default bit mask
+	;;out	dx, ax		; [load value ff into register 8]
+
+	pop	bp
+#endasm
+}
+
+/*
+* Routine to read the value of an individual pixel.
+* Called from C like:
+* 	color = ega_readpixel(x, y);
+*/
+int
+ega_readpixel(int x, int y)
+{
+#asm
+	push	bp
+	mov	bp, sp
+	push	si
+	push	ds
+
+	mov	ax, [bp+6]	; EAX := y
+	mov	bx, [bp+4]	; EBX := x
+	mov	dx, #PIXBYTES	; AX := [y * PIXBYTES]
+	mul	dx
+
+	mov 	cl, bl		; save low order column bits
+	shr	bx, #1		; BX := [x / 8]
+	shr	bx, #1
+	shr	bx, #1
+
+	add	bx, ax		; BX := [y * PIXBYTES] + [x / 8]
+
+	and	cl, #$07	; CL := [x % 8]
+	xor 	cl, #$07	; CL := 7 - [x % 8]
+
+	mov	dx, #$0a000	; DS := EGA buffer segment address
+	mov	ds, dx
+
+	mov 	ch, #$01	; CH := 1 << [7 - [col % 8]]  [mask]
+	shl	ch, cl		; CH := bit mask in proper position
+
+	mov	si, bx		; DS:SI -> region buffer byte
+	xor	bl, bl		; BL is used to accumulate the pixel value
+
+	mov	dx, #$03ce	; DX := Graphics Controller port
+	mov	ax, #$0304	; AH := initial bit plane number
+				; AL := Read Map Select register number
+
+L112:	out	dx, ax		; select bit plane
+	mov 	bh, [si]	; BH := byte from current bit plane
+	and	bh, ch		; mask one bit
+	neg	bh		; bit 7 of BH := 1 if masked bit = 1
+				; bit 7 of BH := 0 if masked bit = 0
+	rol	bx, #1		; bit 0 of BL := next bit from pixel value
+	dec	ah		; AH := next bit plane number
+	jge	L112
+
+	xor	ax, ax		; AL := pixel value
+	mov 	al, bl
+
+	pop	ds
+	pop	si
+	pop	bp	
+#endasm
+}
diff -urN lib/microwindows/src/drivers/elksutil.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/elksutil.c
--- lib/microwindows/src/drivers/elksutil.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/elksutil.c	2005-02-21 16:03:10.000000000 +0100
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * ELKS utility routines for Micro-Windows drivers
+ */
+#include "device.h"
+#include "vgaplan4.h"
+
+/*
+ * Return the byte at far address
+ */
+unsigned char
+GETBYTE_FP(FARADDR addr)
+{
+#asm
+	push	bp
+	mov	bp,sp
+	push	ds
+
+	mov	bx,[bp+4]	! bx = lo addr
+	mov	ax,[bp+6]	! ds = hi addr
+	mov	ds,ax
+	mov	al,[bx]		! get byte at ds:bx
+	xor	ah,ah
+
+	pop	ds
+	pop	bp
+#endasm
+}
+
+/*
+ * Put the byte at far address
+ */
+void
+PUTBYTE_FP(FARADDR addr,unsigned char val)
+{
+#asm
+	push	bp
+	mov	bp,sp
+	push	ds
+
+	mov	bx,[bp+4]	! bx = lo addr
+	mov	ax,[bp+6]	! ds = hi addr
+	mov	ds,ax
+	mov	al,[bp+8]	! al = val
+	mov	[bx],al		! put byte at ds:bx
+
+	pop	ds
+	pop	bp
+#endasm
+}
+
+/*
+ * Read-modify-write the byte at far address
+ */
+void
+RMW_FP(FARADDR addr)
+{
+#asm
+	push	bp
+	mov	bp,sp
+	push	ds
+
+	mov	bx,[bp+4]	! bx = lo addr
+	mov	ax,[bp+6]	! ds = hi addr
+	mov	ds,ax
+	or	[bx],al		! rmw byte at ds:bx, al value doesnt matter
+
+	pop	ds
+	pop	bp
+#endasm
+}
+
+/*
+ * Or the byte at far address
+ */
+void
+ORBYTE_FP(FARADDR addr,unsigned char val)
+{
+#asm
+	push	bp
+	mov	bp,sp
+	push	ds
+
+	mov	bx,[bp+4]	! bx = lo addr
+	mov	ax,[bp+6]	! ds = hi addr
+	mov	ds,ax
+	mov	al,[bp+8]	! al = val
+	or	[bx],al		! or byte at ds:bx
+
+	pop	ds
+	pop	bp
+#endasm
+}
+
+/*
+ * And the byte at far address
+ */
+void
+ANDBYTE_FP(FARADDR addr,unsigned char val)
+{
+#asm
+	push	bp
+	mov	bp,sp
+	push	ds
+
+	mov	bx,[bp+4]	! bx = lo addr
+	mov	ax,[bp+6]	! ds = hi addr
+	mov	ds,ax
+	mov	al,[bp+8]	! al = val
+	and	[bx],al		! and byte at ds:bx
+
+	pop	ds
+	pop	bp
+#endasm
+}
+
+/*
+ * Input byte from i/o port
+ */
+int
+inportb(int port)
+{
+#asm
+	push	bp
+	mov	bp,sp
+
+	mov	dx,[bp+4]	! dx = port
+	in	al,dx		! input byte
+	xor	ah,ah
+
+	pop	bp
+#endasm
+}
+
+/*
+ * Output byte to i/o port
+ */
+void
+outportb(int port,unsigned char data)
+{
+#asm
+	push	bp
+	mov	bp,sp
+
+	mov	dx,[bp+4]	! dx = port
+	mov	al,[bp+6]	! al = data
+	out	dx,al
+
+	pop	bp
+#endasm
+}
+
+/*
+ * Output word i/o port
+ */
+void
+outport(int port,int data)
+{
+#asm
+	push	bp
+	mov	bp,sp
+
+	mov	dx,[bp+4]	! dx = port
+	mov	ax,[bp+6]	! ax = data
+	out	dx,ax
+
+	pop	bp
+#endasm
+}
+
+/*
+ * es:bp = int10(int ax,int bx)
+ *  Call video bios using interrupt 10h
+ */
+FARADDR
+int10(int ax,int bx)
+{
+#asm
+	push	bp
+	mov	bp,sp
+	push	es
+	push	ds
+	push	si
+	push	di
+
+	mov	ax,[bp+4]	! get first arg
+	mov	bx,[bp+6]	! get second arg
+	int	$10
+	mov	dx,es		! return es:bp
+	mov	ax,bp
+
+	pop	di
+	pop	si
+	pop	ds
+	pop	es
+	pop	bp
+#endasm
+}
+
+/* poll the keyboard*/
+int
+kbpoll(void)
+{
+#asm
+	mov	ah,1			! read, no remove
+	int	$16
+	jz	nordy			! no chars ready
+	mov	ax,1			! chars ready
+	ret
+nordy:	xor	ax,ax			! no chars ready
+#endasm
+}
+
+/* wait and read a kbd char when ready*/
+int
+kbread(void)
+{
+#asm
+	xor	ah,ah			! read and remove
+	int	$16			! return ax
+#endasm
+}
+
+/* return kbd shift status*/
+int
+kbflags(void)
+{
+#asm
+	mov	ah,2			! get shift status
+	int	$16
+	mov	ah,0			! low bits only for now...
+#endasm
+}
diff -urN lib/microwindows/src/drivers/fb.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fb.c
--- lib/microwindows/src/drivers/fb.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fb.c	2005-02-21 16:13:05.000000000 +0100
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Screen Driver Utilities
+ * 
+ * Microwindows framebuffer selection routines
+ * Including this file will drag in all fblinX framebuffer subdrivers
+ * When a new framebuffer subdriver is written, it should be referenced
+ * here in select_fb_driver.
+ */
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "device.h"
+#include "genmem.h"
+#include "fb.h"
+
+/* select a framebuffer subdriver based on planes and bpp*/
+/* modify this procedure to add a new framebuffer subdriver*/
+PSUBDRIVER 
+select_fb_subdriver(PSD psd)
+{
+	PSUBDRIVER  driver = NULL;
+	extern SUBDRIVER fblinear1;
+	extern SUBDRIVER fblinear2;
+	extern SUBDRIVER fblinear4;
+	extern SUBDRIVER fblinear8;
+	extern SUBDRIVER fblinear16;
+	extern SUBDRIVER fblinear24;
+	extern SUBDRIVER fblinear32;
+#if FBVGA
+	extern SUBDRIVER vgaplan4;
+	extern SUBDRIVER memplan4;
+
+	/* FB_TYPE_VGA_PLANES*/
+	if(psd->planes == 4 && psd->bpp == 4) {
+		if(psd->flags & PSF_MEMORY)
+			driver = &memplan4;
+		else driver = &vgaplan4;
+	}
+#endif
+
+	/* FB_TYPE_PACKED_PIXELS*/
+	/* device and memory drivers are the same for packed pixels*/
+	if(psd->planes == 1) {
+		switch(psd->bpp) {
+		case 1:
+			driver = &fblinear1;
+			break;
+		case 2:
+			driver = &fblinear2;
+			break;
+		case 4:
+			driver = &fblinear4;
+			break;
+		case 8:
+			driver = &fblinear8;
+			break;
+		case 16:
+			driver = &fblinear16;
+			break;
+		case 24:
+			driver = &fblinear24;
+			break;
+		case 32:
+			driver = &fblinear32;
+			break;
+		}
+	}
+
+	/* return driver selected*/
+	return driver;
+}
+
+/* 
+ * Initialize memory device with passed parms,
+ * select suitable framebuffer subdriver,
+ * and set subdriver in memory device.
+ */
+MWBOOL
+fb_mapmemgc(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,int linelen,
+	int size,void *addr)
+{
+	PSUBDRIVER subdriver;
+
+	/* initialize mem screen driver*/
+	initmemgc(mempsd, w, h, planes, bpp, linelen, size, addr);
+
+/* FIXME kluge for current portrait mode subdriver in scr_fbportrait.c*/
+if(mempsd->flags & PSF_PORTRAIT) return 1;
+
+	/* select a framebuffer subdriver based on planes and bpp*/
+	subdriver = select_fb_subdriver(mempsd);
+	if(!subdriver)
+		return 0;
+
+	/* set and initialize subdriver into mem screen driver*/
+	if(!set_subdriver(mempsd, subdriver, TRUE))
+		return 0;
+
+	return 1;
+}
diff -urN lib/microwindows/src/drivers/fb.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fb.h
--- lib/microwindows/src/drivers/fb.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fb.h	2005-02-21 16:13:05.000000000 +0100
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Framebuffer drivers header file for Microwindows Screen Drivers
+ */
+
+/* Linux framebuffer critical sections*/
+#if VTSWITCH
+extern volatile int mwdrawing;
+#define DRAWON		++mwdrawing
+#define DRAWOFF		--mwdrawing
+#else
+#define DRAWON
+#define DRAWOFF
+#endif
+
+typedef unsigned char *		ADDR8;
+typedef unsigned short *	ADDR16;
+typedef unsigned long *		ADDR32;
+
+/* subdriver entry points: one required for each draw function*/
+typedef struct {
+	int	 (*Init)(PSD psd);
+	void 	 (*DrawPixel)(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c);
+	MWPIXELVAL (*ReadPixel)(PSD psd, MWCOORD x, MWCOORD y);
+	void 	 (*DrawHorzLine)(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y,
+			MWPIXELVAL c);
+	void	 (*DrawVertLine)(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2,
+			MWPIXELVAL c);
+	void	 (*FillRect)(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,
+			MWCOORD y2,MWPIXELVAL c);
+	void	 (*Blit)(PSD destpsd, MWCOORD destx, MWCOORD desty, MWCOORD w,
+			MWCOORD h,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op);
+	void	 (*DrawArea)(PSD psd, driver_gc_t *gc, int op);
+} SUBDRIVER, *PSUBDRIVER;
+
+
+/* global vars*/
+extern int 	gr_mode;	/* temp kluge*/
+
+/* entry points*/
+/* scr_fb.c*/
+void ioctl_getpalette(int start, int len, short *red, short *green,short *blue);
+void ioctl_setpalette(int start, int len, short *red, short *green,short *blue);
+
+/* genmem.c*/
+void	gen_fillrect(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,
+		MWPIXELVAL c);
+MWBOOL	set_subdriver(PSD psd, PSUBDRIVER subdriver, MWBOOL init);
+void	get_subdriver(PSD psd, PSUBDRIVER subdriver);
+
+/* fb.c*/
+PSUBDRIVER select_fb_subdriver(PSD psd);
+
+/* fbportrait.c*/
+extern PSUBDRIVER _subdriver;
+extern SUBDRIVER  fbportrait;
diff -urN lib/microwindows/src/drivers/fblin1.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin1.c
--- lib/microwindows/src/drivers/fblin1.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin1.c	2005-02-21 16:13:05.000000000 +0100
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * 1bpp Packed Linear Video Driver for Microwindows
+ *
+ * 	In this driver, psd->linelen is line byte length, not line pixel length
+ */
+/*#define NDEBUG*/
+#include <assert.h>
+#include <string.h>
+#include "device.h"
+#include "fb.h"
+
+static unsigned char notmask[8] = {
+	0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe};
+
+/* Calc linelen and mmap size, return 0 on fail*/
+static int
+linear1_init(PSD psd)
+{
+	if (!psd->size)
+		psd->size = psd->yres * psd->linelen;
+	/* linelen in bytes for bpp 1, 2, 4, 8 so no change*/
+	return 1;
+}
+
+/* Set pixel at x, y, to pixelval c*/
+static void
+linear1_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += (x>>3) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR)
+		*addr ^= c << (7-(x&7));
+	else
+		*addr = (*addr & notmask[x&7]) | (c << (7-(x&7)));
+	DRAWOFF;
+}
+
+/* Read pixel at x, y*/
+static MWPIXELVAL
+linear1_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+
+	return (addr[(x>>3) + y * psd->linelen] >> (7-(x&7)) ) & 0x01;
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+linear1_drawhorzline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 < psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += (x1>>3) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR) {
+		while(x1 <= x2) {
+			*addr ^= c << (7-(x1&7));
+			if((++x1 & 7) == 0)
+				++addr;
+		}
+	} else {
+		while(x1 <= x2) {
+			*addr = (*addr & notmask[x1&7]) | (c << (7-(x1&7)));
+			if((++x1 & 7) == 0)
+				++addr;
+		}
+	}
+	DRAWOFF;
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+linear1_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	int	linelen = psd->linelen;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 < psd->yres);
+	assert (y2 >= y1);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += (x>>3) + y1 * linelen;
+	if(gr_mode == MWMODE_XOR)
+		while(y1++ <= y2) {
+			*addr ^= c << (7-(x&7));
+			addr += linelen;
+		}
+	else
+		while(y1++ <= y2) {
+			*addr = (*addr & notmask[x&7]) | (c << (7-(x&7)));
+			addr += linelen;
+		}
+	DRAWOFF;
+}
+
+/* srccopy bitblt, opcode is currently ignored*/
+static void
+linear1_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	ADDR8	dst;
+	ADDR8	src;
+	int	i;
+	int	dlinelen = dstpsd->linelen;
+	int	slinelen = srcpsd->linelen;
+
+	assert (dstpsd->addr != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (srcpsd->addr != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	DRAWON;
+	dst = dstpsd->addr + (dstx>>3) + dsty * dlinelen;
+	src = srcpsd->addr + (srcx>>3) + srcy * slinelen;
+	while(--h >= 0) {
+		ADDR8	d = dst;
+		ADDR8	s = src;
+		MWCOORD	dx = dstx;
+		MWCOORD	sx = srcx;
+		for(i=0; i<w; ++i) {
+			*d = (*d & notmask[dx&7]) |
+			   ((*s >> (7-(sx&7)) & 0x01) << (7-(dx&7)));
+			if((++dx & 7) == 0)
+				++d;
+			if((++sx & 7) == 0)
+				++s;
+		}
+		dst += dlinelen;
+		src += slinelen;
+	}
+	DRAWOFF;
+}
+
+SUBDRIVER fblinear1 = {
+	linear1_init,
+	linear1_drawpixel,
+	linear1_readpixel,
+	linear1_drawhorzline,
+	linear1_drawvertline,
+	gen_fillrect,
+	linear1_blit
+};
diff -urN lib/microwindows/src/drivers/fblin12.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin12.c
--- lib/microwindows/src/drivers/fblin12.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin12.c	2005-02-21 16:13:05.000000000 +0100
@@ -0,0 +1,304 @@
+/* by julian schroeder <detemp1@germany.cirrus.com>
+ * for Cirrus Logic  based on fblin24.c
+ *
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * 12bpp Linear Video Driver for Microwindows
+ *
+ * UNDER CONSTRUCTION
+ */
+/*#define NDEBUG*/
+#include <assert.h>
+#include <string.h>
+#include "device.h"
+#include "fb.h"
+
+int gr_mode=MWMODE_XOR;
+//int gr_mode=0;
+
+/* Calc linelen and mmap size, return 0 on fail*/
+static int
+linear12_init(PSD psd)
+{
+	if (!psd->size) {
+		psd->size = 960*240/2;
+		/* convert linelen from byte to pixel len for bpp 16, 24, 32*/
+		psd->linelen *= 2;
+		psd->linelen /= 3; /* /1.5*/
+	}
+	return 1;
+}
+
+static inline void setpix(char *cptr,int x, int y, char c)
+{
+long adr;
+
+adr=(x>>1) + (y*480);  /* change, julian*/
+
+if(gr_mode == MWMODE_XOR) 
+  {
+  if(x & 0x01) cptr[adr]^=((c << 4) & 0xf0);
+  else cptr[adr]^=(c & 0x0f);
+  }    
+else 
+  {
+  if(x & 0x01) 
+    {
+    cptr[adr]&=0x0f;
+    cptr[adr]|=((c << 4) & 0xf0);
+    }
+  else
+    { 
+    cptr[adr]&=0xf0;
+    cptr[adr]|=(c & 0x0f);
+    }
+  }
+}
+
+static inline char getpix(char *cptr,int x, int y)
+{
+long adr;
+adr=(x>>1) + (y*480);  /* change, julian*/
+
+if(x & 0x01) return (cptr[adr] >> 4) & 0x0f;
+return cptr[adr] & 0x0f;
+}
+
+
+/* Set pixel at x, y, to pixelval c*/
+static void
+linear12_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	MWUCHAR	r, g, b;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	r = PIXEL444RED(c);
+	g = PIXEL444GREEN(c);
+	b = PIXEL444BLUE(c);
+        x=x+(x<<1);
+	DRAWON;
+        setpix(addr,x,y,r);
+	setpix(addr,x+1,y,g);
+	setpix(addr,x+2,y,b);
+	DRAWOFF;
+}
+
+/* Read pixel at x, y*/
+static MWPIXELVAL
+linear12_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+        x=x+(x<<1);
+	return RGB2PIXEL444(getpix(addr,x,y),getpix(addr,x+1,y),getpix(addr,x+2,y));
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+linear12_drawhorzline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	MWUCHAR	r, g, b;
+
+	assert (addr != 0);
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 < psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	r = PIXEL444RED(c);
+	g = PIXEL444GREEN(c);
+	b = PIXEL444BLUE(c);
+	DRAWON;
+	        x1*=3;
+		x2*=3;
+		while((x1+=3) <= x2) {
+		setpix(addr,x1,y,r);
+		setpix(addr,x1+1,y,g);
+		setpix(addr,x1+2,y,b);
+		}
+	DRAWOFF;
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+linear12_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	int	linelen = psd->linelen * 3;
+	MWUCHAR	r, g, b;
+        linelen/=2;
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 < psd->yres);
+	assert (y2 >= y1);
+	assert (c < psd->ncolors);
+	x=x+(x<<1);
+	r = PIXEL444RED(c);
+	g = PIXEL444GREEN(c);
+	b = PIXEL444BLUE(c);
+        
+	DRAWON;
+		while(y1++ <= y2) 
+		{
+	        setpix(addr,x,y1,r);
+	        setpix(addr,x+1,y1,g);
+	        setpix(addr,x+2,y1,b);
+		}		
+	DRAWOFF;
+}
+
+#if 0
+/* srccopy bitblt, opcode is currently ignored*/
+static void
+xlinear12_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	ADDR8	dst = dstpsd->addr;
+	ADDR8	src = srcpsd->addr;
+	int	i;
+	int	dlinelen = dstpsd->linelen * 3;
+	int	slinelen = srcpsd->linelen * 3;
+	int	dlinelen_minus_w = (dstpsd->linelen - w) * 3;
+	int	slinelen_minus_w = (srcpsd->linelen - w) * 3;
+#if ALPHABLEND
+	unsigned int alpha;
+#endif
+
+	assert (dst != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (src != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	DRAWON;
+	dst += (dstx + dsty * dstpsd->linelen) * 3;
+	src += (srcx + srcy * srcpsd->linelen) * 3;
+
+#if ALPHABLEND
+	if((op & MWROP_EXTENSION) != MWROP_BLENDCONSTANT)
+		goto stdblit;
+	alpha = op & 0xff;
+
+	while(--h >= 0) {
+		for(i=0; i<w; ++i) {
+			unsigned long s = *src++;
+			unsigned long d = *dst;
+			*dst++ = (unsigned char)(((s - d)*alpha)>>8) + d;
+			s = *src++;
+			d = *dst;
+			*dst++ = (unsigned char)(((s - d)*alpha)>>8) + d;
+			s = *src++;
+			d = *dst;
+			*dst++ = (unsigned char)(((s - d)*alpha)>>8) + d;
+		}
+		dst += dlinelen_minus_w;
+		src += slinelen_minus_w;
+	}
+	DRAWOFF;
+	return;
+stdblit:
+#endif
+	while(--h >= 0) {
+#if 1
+		/* a _fast_ memcpy is a _must_ in this routine*/
+		memcpy(dst, src, w*3);
+		dst += dlinelen;
+		src += slinelen;
+#else
+		for(i=0; i<w; ++i) {
+			*dst++ = *src++;
+			*dst++ = *src++;
+			*dst++ = *src++;
+		}
+		dst += dlinelen_minus_w;
+		src += slinelen_minus_w;
+#endif
+	}
+	DRAWOFF;
+}
+#endif
+
+/* srccopy bitblt, opcode is currently ignored*/
+static void
+linear12_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	ADDR8	dst = dstpsd->addr;
+	ADDR8	src = srcpsd->addr;
+
+//if ((srcx & 0x01) || (dstx & 0x01))
+ 
+
+	DRAWON;
+        dst+=((dstx*3+1)/2)+480*dsty;
+        src+=((srcx*3+1)/2)+480*srcx;
+
+	assert (dst != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (src != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+
+        if((srcx & 0x01) && !(dstx & 0x01))
+	  {
+	  src+=1;
+	  //w-=1;
+          }
+
+        if(!(srcx & 0x01) && (dstx & 0x01))
+	  {
+	  dst+=1;
+	  //w-=1;
+          }
+
+        if((srcx & 0x01) && (dstx & 0x01))
+	  {
+	  //w-=1;
+          }
+
+
+	while(--h >= 0) {
+		/* a _fast_ memcpy is a _must_ in this routine*/
+		memcpy(dst, src, (w*3+1)/2);
+		dst += 480;
+		src += 480;
+	}
+	DRAWOFF;
+}
+
+
+SUBDRIVER fblinear12 = {
+	linear12_init,
+	linear12_drawpixel,
+	linear12_readpixel,
+	linear12_drawhorzline,
+	linear12_drawvertline,
+	gen_fillrect,
+	linear12_blit
+};
diff -urN lib/microwindows/src/drivers/fblin16.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin16.c
--- lib/microwindows/src/drivers/fblin16.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin16.c	2005-02-21 16:13:05.000000000 +0100
@@ -0,0 +1,547 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * 16bpp Linear Video Driver for Microwindows
+ *
+ * Inspired from Ben Pfaff's BOGL <pfaffben@debian.org>
+ */
+/*#define NDEBUG*/
+#include <assert.h>
+#include <stdlib.h>
+
+/* We want to do string copying fast, so inline assembly if possible */
+#ifndef __OPTIMIZE__
+#define __OPTIMIZE__
+#endif
+#include <string.h>
+
+#include "device.h"
+#include "fb.h"
+
+/* Calc linelen and mmap size, return 0 on fail*/
+static int
+linear16_init(PSD psd)
+{
+	if (!psd->size) {
+		psd->size = psd->yres * psd->linelen;
+		/* convert linelen from byte to pixel len for bpp 16, 24, 32*/
+		psd->linelen /= 2;
+	}
+	return 1;
+}
+
+/* Set pixel at x, y, to pixelval c*/
+static void
+linear16_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR16	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	if(gr_mode == MWMODE_XOR)
+		addr[x + y * psd->linelen] ^= c;
+	else
+		addr[x + y * psd->linelen] = c;
+	DRAWOFF;
+}
+
+/* Read pixel at x, y*/
+static MWPIXELVAL
+linear16_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+	ADDR16	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+
+	return addr[x + y * psd->linelen];
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+linear16_drawhorzline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR16	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 < psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += x1 + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR) {
+		while(x1++ <= x2)
+			*addr++ ^= c;
+	} else
+		//FIXME: memsetw(dst, c, x2-x1+1)?
+		while(x1++ <= x2)
+			*addr++ = c;
+	DRAWOFF;
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+linear16_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	ADDR16	addr = psd->addr;
+	int	linelen = psd->linelen;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 < psd->yres);
+	assert (y2 >= y1);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += x + y1 * linelen;
+	if(gr_mode == MWMODE_XOR)
+		while(y1++ <= y2) {
+			*addr ^= c;
+			addr += linelen;
+		}
+	else
+		while(y1++ <= y2) {
+			*addr = c;
+			addr += linelen;
+		}
+	DRAWOFF;
+}
+
+/* srccopy bitblt*/
+static void
+linear16_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	ADDR16	dst = dstpsd->addr;
+	ADDR16	src = srcpsd->addr;
+	int	i;
+	int	dlinelen = dstpsd->linelen;
+	int	slinelen = srcpsd->linelen;
+#if ALPHABLEND
+	unsigned int alpha;
+#endif
+
+	assert (dst != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (src != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	DRAWON;
+	dst += dstx + dsty * dlinelen;
+	src += srcx + srcy * slinelen;
+
+#if ALPHABLEND
+	if((op & MWROP_EXTENSION) != MWROP_BLENDCONSTANT)
+		goto stdblit;
+	alpha = op & 0xff;
+
+	while(--h >= 0) {
+		for(i=0; i<w; ++i) {
+			unsigned int s = *src++;
+			unsigned int d = *dst;
+			unsigned int t = d & 0xf800;
+			unsigned int m1, m2, m3;
+			m1 = (((((s & 0xf800) - t)*alpha)>>8) & 0xf800) + t;
+			t = d & 0x07e0;
+			m2 = (((((s & 0x07e0) - t)*alpha)>>8) & 0x07e0) + t;
+			t = d & 0x001f;
+			m3 = (((((s & 0x001f) - t)*alpha)>>8) & 0x001f) + t;
+			*dst++ = m1 | m2 | m3;
+		}
+		dst += dlinelen - w;
+		src += slinelen - w;
+	}
+	DRAWOFF;
+	return;
+stdblit:
+#endif
+	switch (op) {
+	case MWROP_SRCCOPY:
+		/* copy from bottom up if dst in src rectangle*/
+		/* memmove is used to handle x case*/
+		if (srcy < dsty) {
+			src += (h-1) * slinelen;
+			dst += (h-1) * dlinelen;
+			slinelen *= -1;
+			dlinelen *= -1;
+		}
+		while(--h >= 0) {
+			/* a _fast_ memmove is a _must_ in this routine*/
+			memmove(dst, src, w<<1);
+			dst += dlinelen;
+			src += slinelen;
+		}
+		break;
+	case MWROP_SRCAND:
+		while(--h >= 0) {
+			for(i=0; i<w; ++i)
+				*dst++ &= *src++;
+			dst += dlinelen - w;
+			src += slinelen - w;
+		}
+		break;
+	case MWROP_SRCINVERT:
+		while(--h >= 0) {
+			for(i=0; i<w; ++i)
+				*dst++ ^= *src++;
+			dst += dlinelen - w;
+			src += slinelen - w;
+		}
+		break;
+	case MWROP_BLACKNESS:
+		while(--h >= 0) {
+			memset(dst, 0, w<<1);
+			dst += dlinelen;
+		}
+		break;
+	}
+	DRAWOFF;
+}
+
+static void init_alpha_lookup(unsigned short **low, unsigned short **high)
+{
+        unsigned short a, x, *lo, *hi;
+        unsigned short r, g, b;
+        unsigned short idx;
+
+        lo = *low = malloc(32*256*2);
+        hi = *high = malloc(32*256*2);
+
+	if ( hi == 0 || lo == 0 )
+		exit(17);
+
+        for ( a=0; a < 32; a++ )
+                for ( x=0; x < 256; x++ ) {
+                        idx = (a << 8) | x;
+                        /* High byte */
+                        r = (x >> 3) * a / 31;
+                        g = ((x << 3) & 0x38) * a / 31;
+                        hi[idx] = (r << 11) | (g << 5);
+                        /* Low byte */
+                        b = (x & 0x1f) * a / 31;
+                        g = ((x >> 5) & 0x7) * a / 31;
+                        lo[idx] = (g << 5) | b;
+                }
+}
+
+static void init_wordmask_lookup(unsigned short **byte2wordmask)
+{
+	unsigned short *maskp, *b2wm;
+	int t, x, u;
+
+	b2wm = *byte2wordmask = malloc(256*8*2);
+	if ( b2wm == 0 )
+		exit(17);
+	for ( t=0; t < 256; t++ ) {
+		maskp = b2wm + 8 * t;
+		x = t;
+		for ( u=1; u < 256; u <<= 1 )
+			if ( x & u )
+				*maskp++ = 0xffff;
+			else
+				*maskp++ = 0x0000;
+	}
+}
+
+/* psd->DrawArea operation PSDOP_PIXMAP_COPYALL which takes a
+ * pixmap, each line is byte aligned, and copies it to the
+ * screen using fg_color and bg_color to replace a 1 and 0 in
+ * the pixmap.  This pixmap is ordered the wrong way around;
+ * it has the leftmost pixel (on the screen) in LSB (Bit 0)
+ * of the bytes.
+ *
+ * The reason why this non-intuitive bit ordering is used is
+ * to match the bit ordering used in the T1lib font rendering
+ * library.
+ *
+ * Variables used in the gc:
+ *       dstx, dsty, dsth, dstw   Destination rectangle
+ *       srcx, srcy               Source rectangle
+ *       src_linelen              Linesize in bytes of source
+ *       pixels                   Pixmap data
+ *       fg_color		  Color of a '1' bit
+ *       bg_color                 Color of a '0' bit
+ */
+
+static void pixmap_copyall(PSD psd, driver_gc_t *gc)
+{
+	int first_byte, last_byte;
+	int hard_prefix, hard_postfix;
+	unsigned short prefixbits, postfixbits, *maskp;
+	unsigned short xor_color, m;
+	unsigned short prefix_mask = 0, prefix_last = 0;
+	unsigned short postfix_mask = 0, postfix_last = 0;
+	int size_main, t, y;
+	unsigned int advance_src, advance_dst;
+	ADDR8 src;
+	ADDR16 dst;
+
+	static unsigned short *byte2wordmask = 0;
+
+	prefixbits = gc->srcx & 7;
+	postfixbits = (gc->srcx + gc->dstw - 1) & 7;
+	first_byte = gc->srcx >> 3;
+	last_byte = (gc->srcx + gc->dstw - 1) >> 3;
+
+	src = ((ADDR8)gc->pixels) + gc->src_linelen * gc->srcy + first_byte;
+	dst = ((ADDR16)psd->addr) + psd->linelen * gc->dsty + gc->dstx;
+	xor_color = gc->fg_color ^ gc->bg_color;
+
+	if ( first_byte != last_byte ) {
+		if ( prefixbits == 0 ) {
+			/* All bits of first byte used */
+			hard_prefix = 0;
+			size_main = last_byte - first_byte;
+		} else {
+			/* Needs to do a few odd bits first */
+			hard_prefix = 1;
+			size_main = last_byte - first_byte - 1;
+			prefix_mask = 1 << prefixbits;
+			prefix_last = 256;
+		}
+		if ( postfixbits != 7 ) {
+			/* Last byte in source contains a few odd bits */
+			hard_postfix = 1;
+			postfix_mask = 1;
+			postfix_last = 2 << postfixbits;
+		} else {
+			/* Last byte in source is used completely */
+			hard_postfix = 0;
+			size_main++;
+		}
+	} else {
+		/* Very narrow pixmap, fits in single first byte */
+		hard_prefix = 1;
+		hard_postfix = 0;
+		size_main = 0;
+		prefix_mask = 1 << prefixbits;
+		prefix_last = 1 << (prefixbits + gc->dstw);
+	}
+
+	advance_src = gc->src_linelen - last_byte + first_byte - 1;
+	advance_dst = psd->linelen - gc->dstw;
+
+	if ( byte2wordmask == 0 )
+		init_wordmask_lookup(&byte2wordmask);
+
+	DRAWON;
+	for ( y=0; y < gc->dsth; y++ ) {
+
+		/* Do pixels of partial first byte */
+		if ( hard_prefix ) {
+			for ( m=prefix_mask; m < prefix_last; m <<= 1 ) {
+				if ( m & *src )
+					*dst++ = gc->fg_color;
+				else
+					*dst++ = gc->bg_color;
+			}
+			src++;
+		}
+
+		/* Do all pixles of main part one byte at a time */
+		for ( t=0; t < size_main; t++ ) {	
+			maskp = byte2wordmask + 8 * (*src++);
+
+			*dst++ = gc->bg_color ^ (*maskp++ & xor_color);
+			*dst++ = gc->bg_color ^ (*maskp++ & xor_color);
+			*dst++ = gc->bg_color ^ (*maskp++ & xor_color);
+			*dst++ = gc->bg_color ^ (*maskp++ & xor_color);
+			*dst++ = gc->bg_color ^ (*maskp++ & xor_color);
+			*dst++ = gc->bg_color ^ (*maskp++ & xor_color);
+			*dst++ = gc->bg_color ^ (*maskp++ & xor_color);
+			*dst++ = gc->bg_color ^ (*maskp++ & xor_color);
+		}
+
+		/* Do last few bits of line */
+		if ( hard_postfix ) {
+			for ( m=postfix_mask; m < postfix_last; m <<= 1 ) {
+				if ( *src & m )
+					*dst++ = gc->fg_color;
+				else
+					*dst++ = gc->bg_color;
+			}
+			src++;
+		}
+
+		src += advance_src;
+		dst += advance_dst;
+	}
+	DRAWOFF;
+}
+
+
+static unsigned short *low2scale = 0, *high2scale = 0;
+
+static void drawarea_alphamap(PSD psd, driver_gc_t *gc)
+{
+	ADDR8 src, dst, alpha;
+	unsigned short psl, psh, pd;
+	unsigned char as, ad;
+	int x, y;
+
+	if ( low2scale == 0 )
+		init_alpha_lookup(&low2scale,&high2scale);
+
+	src = (ADDR8)(((ADDR16)gc->pixels) + gc->srcx +
+		      gc->src_linelen * gc->srcy);
+	dst = (ADDR8)(((ADDR16)psd->addr) +
+		      psd->linelen * gc->dsty + gc->dstx);
+	alpha = ((ADDR8)gc->misc) + gc->src_linelen * gc->srcy + gc->srcx;
+
+	DRAWON;
+	for ( y=0; y < gc->dsth; y++ ) {
+		for ( x=0; x < gc->dstw; x++ ) {
+			as = (*alpha++) >> 3;
+			ad = 31 - as;
+			psl = low2scale[(as<<8)|*src++];
+			psh = high2scale[(as<<8)|*src++];
+			pd = low2scale[(ad<<8)|dst[0]] +
+				high2scale[(ad<<8)|dst[1]];
+			*((unsigned short *)dst)++ = psl + psh + pd;
+		}
+	}
+	DRAWOFF;
+}
+
+static void drawarea_alphacol(PSD psd, driver_gc_t *gc)
+{
+	ADDR8 dst, alpha;
+	unsigned short col_low, col_high, psl, psh, pd;
+	unsigned char as, ad;
+	int x, y;
+
+	if ( low2scale == 0 )
+		init_alpha_lookup(&low2scale,&high2scale);
+
+	dst = (ADDR8)(((ADDR16)psd->addr) +
+		      psd->linelen * gc->dsty + gc->dstx);
+	alpha = ((ADDR8)gc->misc) + gc->src_linelen * gc->srcy + gc->srcx;
+	col_low = gc->bg_color & 0xff;
+	col_high = ( gc->bg_color >> 8 ) & 0xff;
+
+	DRAWON;
+	for ( y=0; y < gc->dsth; y++ ) {
+		for ( x=0; x < gc->dstw; x++ ) {
+			as = (*alpha++) >> 3;
+			if ( as ) {
+				if ( (ad = 31 - as) ) {
+					psl = low2scale[(as<<8)|col_low];
+					psh = high2scale[(as<<8)|col_high];
+					pd = low2scale[(ad<<8)|dst[0]] +
+						high2scale[(ad<<8)|dst[1]];
+					*((unsigned short *)dst)++ = psl + psh + pd;
+				} else {
+					*((unsigned short *)dst)++ = gc->bg_color;
+				}
+			}
+		}
+	}
+	DRAWOFF;
+}
+
+static void linear16_drawarea(PSD psd, driver_gc_t *gc, int op)
+{
+	ADDR16	src16, dst, rsrc, rdst;
+	int linesize, x, y;
+	unsigned short pcol;
+
+	assert(psd->addr != 0);
+	// assert(gc->dstw <= gc->srcw);
+
+	assert(gc->dstx >= 0 && gc->dstx+gc->dstw <= psd->xres);
+	// assert(gc->dsty >= 0 && gc->dsty+gc->dsth <= psd->yres);
+
+	// assert(gc->srcx >= 0 && gc->srcx+gc->dstw <= gc->srcw);
+	assert(gc->srcy >= 0);
+
+	// op = GD_AREA_COPY;
+
+	// printf("DrawArea op=%d x=%d y=%d\n",op,gc->x,gc->y);
+
+	if ( op == PSDOP_COPY )
+		op = gc->gr_usebg ? PSDOP_COPYALL : PSDOP_COPYTRANS;
+
+	switch ( op ) {
+		case PSDOP_COPYALL:
+			linesize = 2 * gc->dstw;
+			src16 = ((ADDR16)gc->pixels) + gc->srcx +
+				gc->src_linelen * gc->srcy;
+			dst = ((ADDR16)psd->addr) + gc->dstx + 
+				psd->linelen * gc->dsty;
+
+			DRAWON;
+			for ( y=1; y < gc->dsth; y++ ) {
+				memcpy(dst,src16,linesize);
+				src16 += gc->src_linelen;
+				dst += psd->linelen;
+			}
+			memcpy(dst,src16,linesize);	/* To be seriously ANSI */
+			DRAWOFF;
+			break;
+
+		case PSDOP_COPYTRANS:
+			src16 = ((ADDR16)gc->pixels) + gc->srcx +
+				gc->src_linelen * gc->srcy;
+                        dst = ((ADDR16)psd->addr) + gc->dstx +
+				psd->linelen * gc->dsty;
+
+                        DRAWON;
+                        for ( y=0; y < gc->dsth; y++ ) {
+				rdst = dst;
+				rsrc = src16;
+				for ( x=0; x < gc->dstw; x++ ) {
+					pcol = *rsrc++;
+					if ( pcol == gc->bg_color )
+						rdst++;
+					else
+						*rdst++ = pcol;
+				}
+				dst += psd->linelen;
+				src16 += gc->src_linelen;
+			}
+			DRAWOFF;
+			break;
+
+		case PSDOP_ALPHAMAP:
+			drawarea_alphamap(psd,gc);
+			break;
+
+		case PSDOP_ALPHACOL:
+			drawarea_alphacol(psd,gc);
+			break;
+
+
+		case PSDOP_PIXMAP_COPYALL:
+			pixmap_copyall(psd,gc);
+			break;
+
+	}
+}
+
+SUBDRIVER fblinear16 = {
+	linear16_init,
+	linear16_drawpixel,
+	linear16_readpixel,
+	linear16_drawhorzline,
+	linear16_drawvertline,
+	gen_fillrect,
+	linear16_blit,
+	linear16_drawarea
+};
diff -urN lib/microwindows/src/drivers/fblin1rev.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin1rev.c
--- lib/microwindows/src/drivers/fblin1rev.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin1rev.c	2005-02-21 16:03:11.000000000 +0100
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+*
+* 1bpp Packed Linear Video Driver (reversed bit order)
+* For Psion S5
+*
+* 	In this driver, psd->linelen is line byte length, not line pixel length
+*/
+/*#define NDEBUG*/
+#include <assert.h>
+#include <string.h>
+#include "device.h"
+#include "fb.h"
+
+static unsigned char notmask[8] = {
+	0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe};
+
+/* Calc linelen and mmap size, return 0 on fail*/
+static int
+linear1_init(PSD psd)
+{
+	if (!psd->size)
+		psd->size = psd->yres * psd->linelen;
+	/* linelen in bytes for bpp 1, 2, 4, 8 so no change*/
+	return 1;
+}
+
+/* Set pixel at x, y, to pixelval c*/
+static void
+linear1_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += (x>>3) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR)
+		*addr ^= c << (x&7);
+	else
+		*addr = (*addr & notmask[x&7]) | (c << (x&7));
+	DRAWOFF;
+}
+
+/* Read pixel at x, y*/
+static MWPIXELVAL
+linear1_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+
+	return (addr[(x>>3) + y * psd->linelen] >> (x&7) ) & 0x01;
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+linear1_drawhorzline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 < psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += (x1>>3) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR) {
+		while(x1 <= x2) {
+			*addr ^= c << (x1&7);
+			if((++x1 & 7) == 0)
+				++addr;
+		}
+	} else {
+		while(x1 <= x2) {
+			*addr = (*addr & notmask[x1&7]) | (c << (x1&7));
+			if((++x1 & 7) == 0)
+				++addr;
+		}
+	}
+	DRAWOFF;
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+linear1_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	int	linelen = psd->linelen;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 < psd->yres);
+	assert (y2 >= y1);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += (x>>3) + y1 * linelen;
+	if(gr_mode == MWMODE_XOR)
+		while(y1++ <= y2) {
+			*addr ^= c << (x&7);
+			addr += linelen;
+		}
+	else
+		while(y1++ <= y2) {
+			*addr = (*addr & notmask[x&7]) | (c << (x&7));
+			addr += linelen;
+		}
+	DRAWOFF;
+}
+
+/* srccopy bitblt, opcode is currently ignored*/
+static void
+linear1_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	ADDR8	dst;
+	ADDR8	src;
+	int	i;
+	int	dlinelen = dstpsd->linelen;
+	int	slinelen = srcpsd->linelen;
+
+	assert (dstpsd->addr != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (srcpsd->addr != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	DRAWON;
+	dst = dstpsd->addr + (dstx>>3) + dsty * dlinelen;
+	src = srcpsd->addr + (srcx>>3) + srcy * slinelen;
+	while(--h >= 0) {
+		ADDR8	d = dst;
+		ADDR8	s = src;
+		MWCOORD	dx = dstx;
+		MWCOORD	sx = srcx;
+		for(i=0; i<w; ++i) {
+			*d = (*d & notmask[dx&7]) |
+			   ((*s >> (sx&7) & 0x01) << (dx&7));
+			if((++dx & 7) == 0)
+				++d;
+			if((++sx & 7) == 0)
+				++s;
+		}
+		dst += dlinelen;
+		src += slinelen;
+	}
+	DRAWOFF;
+}
+
+SUBDRIVER fblinear1 = {
+	linear1_init,
+	linear1_drawpixel,
+	linear1_readpixel,
+	linear1_drawhorzline,
+	linear1_drawvertline,
+	gen_fillrect,
+	linear1_blit
+};
diff -urN lib/microwindows/src/drivers/fblin2.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin2.c
--- lib/microwindows/src/drivers/fblin2.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin2.c	2005-02-21 16:03:11.000000000 +0100
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * 2bpp Packed Linear Video Driver for Microwindows
+ * 	This driver is written for the Vr41xx Palm PC machines
+ * 	The screen is 320x240x4
+ *
+ * 	In this driver, psd->linelen is line byte length, not line pixel length
+ */
+/*#define NDEBUG*/
+#include <assert.h>
+#include <string.h>
+#include "device.h"
+#include "fb.h"
+
+static unsigned char notmask[4] = { 0x3f, 0xcf, 0xf3, 0xfc};
+
+/* Calc linelen and mmap size, return 0 on fail*/
+static int
+linear2_init(PSD psd)
+{
+	if (!psd->size)
+		psd->size = psd->yres * psd->linelen;
+	/* linelen in bytes for bpp 1, 2, 4, 8 so no change*/
+	return 1;
+}
+
+/* Set pixel at x, y, to pixelval c*/
+static void
+linear2_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += (x>>2) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR)
+		*addr ^= c << ((3-(x&3))<<1);
+	else
+		*addr = (*addr & notmask[x&3]) | (c << ((3-(x&3))<<1));
+	DRAWOFF;
+}
+
+/* Read pixel at x, y*/
+static MWPIXELVAL
+linear2_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+
+	return (addr[(x>>2) + y * psd->linelen] >> ((3-(x&3))<<1) ) & 0x03;
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+linear2_drawhorzline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 < psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += (x1>>2) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR) {
+		while(x1 <= x2) {
+			*addr ^= c << ((3-(x1&3))<<1);
+			if((++x1 & 3) == 0)
+				++addr;
+		}
+	} else {
+		while(x1 <= x2) {
+			*addr = (*addr & notmask[x1&3]) | (c << ((3-(x1&3))<<1));
+			if((++x1 & 3) == 0)
+				++addr;
+		}
+	}
+	DRAWOFF;
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+linear2_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	int	linelen = psd->linelen;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 < psd->yres);
+	assert (y2 >= y1);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += (x>>2) + y1 * linelen;
+	if(gr_mode == MWMODE_XOR)
+		while(y1++ <= y2) {
+			*addr ^= c << ((3-(x&3))<<1);
+			addr += linelen;
+		}
+	else
+		while(y1++ <= y2) {
+			*addr = (*addr & notmask[x&3]) | (c << ((3-(x&3))<<1));
+			addr += linelen;
+		}
+	DRAWOFF;
+}
+
+/* srccopy bitblt, opcode is currently ignored*/
+static void
+linear2_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	ADDR8	dst;
+	ADDR8	src;
+	int	i;
+	int	dlinelen = dstpsd->linelen;
+	int	slinelen = srcpsd->linelen;
+
+	assert (dstpsd->addr != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (srcpsd->addr != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	DRAWON;
+	dst = dstpsd->addr + (dstx>>2) + dsty * dlinelen;
+	src = srcpsd->addr + (srcx>>2) + srcy * slinelen;
+	while(--h >= 0) {
+		ADDR8	d = dst;
+		ADDR8	s = src;
+		MWCOORD	dx = dstx;
+		MWCOORD	sx = srcx;
+		for(i=0; i<w; ++i) {
+			*d = (*d & notmask[dx&3]) |
+			   ((*s >> ((3-(sx&3))<<1) & 0x03) << ((3-(dx&3))<<1));
+			if((++dx & 3) == 0)
+				++d;
+			if((++sx & 3) == 0)
+				++s;
+		}
+		dst += dlinelen;
+		src += slinelen;
+	}
+	DRAWOFF;
+}
+
+SUBDRIVER fblinear2 = {
+	linear2_init,
+	linear2_drawpixel,
+	linear2_readpixel,
+	linear2_drawhorzline,
+	linear2_drawvertline,
+	gen_fillrect,
+	linear2_blit
+};
diff -urN lib/microwindows/src/drivers/fblin24.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin24.c
--- lib/microwindows/src/drivers/fblin24.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin24.c	2005-02-21 16:13:06.000000000 +0100
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * 24bpp Linear Video Driver for Microwindows
+ */
+/*#define NDEBUG*/
+#include <assert.h>
+#include <string.h>
+#include "device.h"
+#include "fb.h"
+
+/* Calc linelen and mmap size, return 0 on fail*/
+static int
+linear24_init(PSD psd)
+{
+	if (!psd->size) {
+		psd->size = psd->yres * psd->linelen;
+		/* convert linelen from byte to pixel len for bpp 16, 24, 32*/
+		psd->linelen /= 3;
+	}
+	return 1;
+}
+
+/* Set pixel at x, y, to pixelval c*/
+static void
+linear24_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	MWUCHAR	r, g, b;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	r = PIXEL888RED(c);
+	g = PIXEL888GREEN(c);
+	b = PIXEL888BLUE(c);
+	addr += (x + y * psd->linelen) * 3;
+	DRAWON;
+	if(gr_mode == MWMODE_XOR) {
+		*addr++ ^= b;
+		*addr++ ^= g;
+		*addr ^= r;
+	} else {
+		*addr++ = b;
+		*addr++ = g;
+		*addr = r;
+	}
+	DRAWOFF;
+}
+
+/* Read pixel at x, y*/
+static MWPIXELVAL
+linear24_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+
+	addr += (x + y * psd->linelen) * 3;
+	return RGB2PIXEL888(addr[2], addr[1], addr[0]);
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+linear24_drawhorzline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	MWUCHAR	r, g, b;
+
+	assert (addr != 0);
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 < psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	r = PIXEL888RED(c);
+	g = PIXEL888GREEN(c);
+	b = PIXEL888BLUE(c);
+	addr += (x1 + y * psd->linelen) * 3;
+	DRAWON;
+	if(gr_mode == MWMODE_XOR) {
+		while(x1++ <= x2) {
+			*addr++ ^= b;
+			*addr++ ^= g;
+			*addr++ ^= r;
+		}
+	} else
+		while(x1++ <= x2) {
+			*addr++ = b;
+			*addr++ = g;
+			*addr++ = r;
+		}
+	DRAWOFF;
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+linear24_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	int	linelen = psd->linelen * 3;
+	MWUCHAR	r, g, b;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 < psd->yres);
+	assert (y2 >= y1);
+	assert (c < psd->ncolors);
+
+	r = PIXEL888RED(c);
+	g = PIXEL888GREEN(c);
+	b = PIXEL888BLUE(c);
+	addr += (x + y1 * psd->linelen) * 3;
+	DRAWON;
+	if(gr_mode == MWMODE_XOR)
+		while(y1++ <= y2) {
+			addr[0] ^= b;
+			addr[1] ^= g;
+			addr[2] ^= r;
+			addr += linelen;
+		}
+	else
+		while(y1++ <= y2) {
+			addr[0] = b;
+			addr[1] = g;
+			addr[2] = r;
+			addr += linelen;
+		}
+	DRAWOFF;
+}
+
+/* srccopy bitblt, opcode is currently ignored*/
+static void
+linear24_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	ADDR8	dst = dstpsd->addr;
+	ADDR8	src = srcpsd->addr;
+	int	i;
+	int	dlinelen = dstpsd->linelen * 3;
+	int	slinelen = srcpsd->linelen * 3;
+	int	dlinelen_minus_w = (dstpsd->linelen - w) * 3;
+	int	slinelen_minus_w = (srcpsd->linelen - w) * 3;
+#if ALPHABLEND
+	unsigned int alpha;
+#endif
+
+	assert (dst != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (src != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	DRAWON;
+	dst += (dstx + dsty * dstpsd->linelen) * 3;
+	src += (srcx + srcy * srcpsd->linelen) * 3;
+
+#if ALPHABLEND
+	if((op & MWROP_EXTENSION) != MWROP_BLENDCONSTANT)
+		goto stdblit;
+	alpha = op & 0xff;
+
+	while(--h >= 0) {
+		for(i=0; i<w; ++i) {
+			unsigned long s = *src++;
+			unsigned long d = *dst;
+			*dst++ = (unsigned char)(((s - d)*alpha)>>8) + d;
+			s = *src++;
+			d = *dst;
+			*dst++ = (unsigned char)(((s - d)*alpha)>>8) + d;
+			s = *src++;
+			d = *dst;
+			*dst++ = (unsigned char)(((s - d)*alpha)>>8) + d;
+		}
+		dst += dlinelen_minus_w;
+		src += slinelen_minus_w;
+	}
+	DRAWOFF;
+	return;
+stdblit:
+#endif
+	while(--h >= 0) {
+#if 1
+		/* a _fast_ memcpy is a _must_ in this routine*/
+		memcpy(dst, src, w*3);
+		dst += dlinelen;
+		src += slinelen;
+#else
+		for(i=0; i<w; ++i) {
+			*dst++ = *src++;
+			*dst++ = *src++;
+			*dst++ = *src++;
+		}
+		dst += dlinelen_minus_w;
+		src += slinelen_minus_w;
+#endif
+	}
+	DRAWOFF;
+}
+
+SUBDRIVER fblinear24 = {
+	linear24_init,
+	linear24_drawpixel,
+	linear24_readpixel,
+	linear24_drawhorzline,
+	linear24_drawvertline,
+	gen_fillrect,
+	linear24_blit
+};
diff -urN lib/microwindows/src/drivers/fblin2rev.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin2rev.c
--- lib/microwindows/src/drivers/fblin2rev.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin2rev.c	2005-02-21 16:03:11.000000000 +0100
@@ -0,0 +1,174 @@
+/*
+* Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+*
+* 2bpp Packed Linear Video Driver (reversed bit order)
+* For Psion S5
+*
+* 	In this driver, psd->linelen is line byte length, not line pixel length
+*/
+/*#define NDEBUG*/
+#include <assert.h>
+#include <string.h>
+#include "device.h"
+#include "fb.h"
+
+static unsigned char notmask[4] = { 0xfc, 0xf3, 0xcf, 0x3f };
+
+/* Calc linelen and mmap size, return 0 on fail*/
+static int
+linear2_init(PSD psd)
+{
+	if (!psd->size)
+		psd->size = psd->yres * psd->linelen;
+	/* linelen in bytes for bpp 1, 2, 4, 8 so no change*/
+	return 1;
+}
+
+/* Set pixel at x, y, to pixelval c*/
+static void
+linear2_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += (x>>2) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR)
+		*addr ^= c << ((x&3)<<1);
+	else
+		*addr = (*addr & notmask[x&3]) | (c << ((x&3)<<1));
+	DRAWOFF;
+}
+
+/* Read pixel at x, y*/
+static MWPIXELVAL
+linear2_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+
+	return (addr[(x>>2) + y * psd->linelen] >> ((x&3)<<1) ) & 0x03;
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+linear2_drawhorzline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 < psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += (x1>>2) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR) {
+		while(x1 <= x2) {
+			*addr ^= c << ((x1&3)<<1);
+			if((++x1 & 3) == 0)
+				++addr;
+		}
+	} else {
+		while(x1 <= x2) {
+			*addr = (*addr & notmask[x1&3]) | (c << ((x1&3)<<1));
+			if((++x1 & 3) == 0)
+				++addr;
+		}
+	}
+	DRAWOFF;
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+linear2_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	int	linelen = psd->linelen;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 < psd->yres);
+	assert (y2 >= y1);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += (x>>2) + y1 * linelen;
+	if(gr_mode == MWMODE_XOR)
+		while(y1++ <= y2) {
+			*addr ^= c << ((x&3)<<1);
+			addr += linelen;
+		}
+	else
+		while(y1++ <= y2) {
+			*addr = (*addr & notmask[x&3]) | (c << ((x&3)<<1));
+			addr += linelen;
+		}
+	DRAWOFF;
+}
+
+/* srccopy bitblt, opcode is currently ignored*/
+static void
+linear2_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	ADDR8	dst;
+	ADDR8	src;
+	int	i;
+	int	dlinelen = dstpsd->linelen;
+	int	slinelen = srcpsd->linelen;
+
+	assert (dstpsd->addr != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (srcpsd->addr != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	DRAWON;
+	dst = dstpsd->addr + (dstx>>2) + dsty * dlinelen;
+	src = srcpsd->addr + (srcx>>2) + srcy * slinelen;
+	while(--h >= 0) {
+		ADDR8	d = dst;
+		ADDR8	s = src;
+		MWCOORD	dx = dstx;
+		MWCOORD	sx = srcx;
+		for(i=0; i<w; ++i) {
+			*d = (*d & notmask[dx&3]) |
+			   ((*s >> ((sx&3)<<1) & 0x03) << ((dx&3)<<1));
+			if((++dx & 3) == 0)
+				++d;
+			if((++sx & 3) == 0)
+				++s;
+		}
+		dst += dlinelen;
+		src += slinelen;
+	}
+	DRAWOFF;
+}
+
+SUBDRIVER fblinear2 = {
+	linear2_init,
+	linear2_drawpixel,
+	linear2_readpixel,
+	linear2_drawhorzline,
+	linear2_drawvertline,
+	gen_fillrect,
+	linear2_blit
+};
diff -urN lib/microwindows/src/drivers/fblin32.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin32.c
--- lib/microwindows/src/drivers/fblin32.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin32.c	2005-02-21 16:13:06.000000000 +0100
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * 32bpp Linear Video Driver for Microwindows
+ *
+ * Inspired from Ben Pfaff's BOGL <pfaffben@debian.org>
+ */
+/*#define NDEBUG*/
+#include <assert.h>
+#include <string.h>
+#include "device.h"
+#include "fb.h"
+
+/* Calc linelen and mmap size, return 0 on fail*/
+static int
+linear32_init(PSD psd)
+{
+	if (!psd->size) {
+		psd->size = psd->yres * psd->linelen;
+		/* convert linelen from byte to pixel len for bpp 16, 24, 32*/
+		psd->linelen /= 4;
+	}
+	return 1;
+}
+
+/* Set pixel at x, y, to pixelval c*/
+static void
+linear32_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR32	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	if(gr_mode == MWMODE_XOR)
+		addr[x + y * psd->linelen] ^= c;
+	else
+		addr[x + y * psd->linelen] = c;
+	DRAWOFF;
+}
+
+/* Read pixel at x, y*/
+static MWPIXELVAL
+linear32_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+	ADDR32	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+
+	return addr[x + y * psd->linelen];
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+linear32_drawhorzline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR32	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 < psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += x1 + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR) {
+		while(x1++ <= x2)
+			*addr++ ^= c;
+	} else
+		//FIXME: memsetl(dst, c, x2-x1+1)?
+		while(x1++ <= x2)
+			*addr++ = c;
+	DRAWOFF;
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+linear32_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	ADDR32	addr = psd->addr;
+	int	linelen = psd->linelen;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 < psd->yres);
+	assert (y2 >= y1);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += x + y1 * linelen;
+	if(gr_mode == MWMODE_XOR)
+		while(y1++ <= y2) {
+			*addr ^= c;
+			addr += linelen;
+		}
+	else
+		while(y1++ <= y2) {
+			*addr = c;
+			addr += linelen;
+		}
+	DRAWOFF;
+}
+
+/* srccopy bitblt*/
+static void
+linear32_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	ADDR8	dst8, src8;
+	ADDR32	dst = dstpsd->addr;
+	ADDR32	src = srcpsd->addr;
+	int	i;
+	int	dlinelen = dstpsd->linelen;
+	int	slinelen = srcpsd->linelen;
+	int	dlinelen_minus_w4;
+	int	slinelen_minus_w4;
+#if ALPHABLEND
+	unsigned int alpha;
+#endif
+
+	assert (dst != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (src != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	DRAWON;
+	dst += dstx + dsty * dlinelen;
+	src += srcx + srcy * slinelen;
+
+#if ALPHABLEND
+	if((op & MWROP_EXTENSION) != MWROP_BLENDCONSTANT)
+		goto stdblit;
+	alpha = op & 0xff;
+
+	src8 = (ADDR8)src;
+	dst8 = (ADDR8)dst;
+	dlinelen_minus_w4 = (dlinelen - w) * 4;
+	slinelen_minus_w4 = (slinelen - w) * 4;
+	while(--h >= 0) {
+		for(i=0; i<w; ++i) {
+			register unsigned long s = *src8++;
+			register unsigned long d = *dst8;
+			*dst8++ = (unsigned char)(((s - d)*alpha)>>8) + d;
+			s = *src8++;
+			d = *dst8;
+			*dst8++ = (unsigned char)(((s - d)*alpha)>>8) + d;
+			s = *src8;
+			d = *dst8;
+			*dst8 = (unsigned char)(((s - d)*alpha)>>8) + d;
+			dst8 += 2;
+			src8 += 2;
+		}
+		dst8 += dlinelen_minus_w4;
+		src8 += slinelen_minus_w4;
+	}
+	DRAWOFF;
+	return;
+stdblit:
+#endif
+	/* copy from bottom up if dst in src rectangle*/
+	/* memmove is used to handle x case*/
+	if (srcy < dsty) {
+		src += (h-1) * slinelen;
+		dst += (h-1) * dlinelen;
+		slinelen *= -1;
+		dlinelen *= -1;
+	}
+
+	while(--h >= 0) {
+#if 1
+		/* a _fast_ memmove is a _must_ in this routine*/
+		memmove(dst, src, w<<2);
+		dst += dlinelen;
+		src += slinelen;
+#else
+		for(i=0; i<w; ++i)
+			*dst++ = *src++;
+		dst += dlinelen - w;
+		src += slinelen - w;
+#endif
+	}
+	DRAWOFF;
+}
+
+SUBDRIVER fblinear32 = {
+	linear32_init,
+	linear32_drawpixel,
+	linear32_readpixel,
+	linear32_drawhorzline,
+	linear32_drawvertline,
+	gen_fillrect,
+	linear32_blit
+};
diff -urN lib/microwindows/src/drivers/fblin4.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin4.c
--- lib/microwindows/src/drivers/fblin4.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin4.c	2005-02-21 16:03:12.000000000 +0100
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * 4bpp Packed Linear Video Driver for Microwindows
+ * 	This driver is written for the Vr41xx Palm PC machines
+ * 	Hopefully, we can get the 4bpp mode running 320x240x16
+ *
+ * If INVERT4BPP is defined, then the values are inverted before drawing.
+ * 	This is used for the VTech Helio
+ *
+ * 	In this driver, psd->linelen is line byte length, not line pixel length
+ */
+/*#define NDEBUG*/
+#include <assert.h>
+#include <string.h>
+#include "device.h"
+#include "fb.h"
+
+#if INVERT4BPP
+#define INVERT(c)	((c) = (~c & 0x0f))
+#else
+#define INVERT(c)
+#endif
+
+static unsigned char notmask[2] = { 0x0f, 0xf0};
+
+/* Calc linelen and mmap size, return 0 on fail*/
+static int
+linear4_init(PSD psd)
+{
+	if (!psd->size)
+		psd->size = psd->yres * psd->linelen;
+	/* linelen in bytes for bpp 1, 2, 4, 8 so no change*/
+	return 1;
+}
+
+/* Set pixel at x, y, to pixelval c*/
+static void
+linear4_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	INVERT(c);
+	DRAWON;
+	addr += (x>>1) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR)
+		*addr ^= c << ((1-(x&1))<<2);
+	else
+		*addr = (*addr & notmask[x&1]) | (c << ((1-(x&1))<<2));
+	DRAWOFF;
+}
+
+/* Read pixel at x, y*/
+static MWPIXELVAL
+linear4_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+	ADDR8		addr = psd->addr;
+	MWPIXELVAL	c;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+
+	c = (addr[(x>>1) + y * psd->linelen] >> ((1-(x&1))<<2) ) & 0x0f;
+	INVERT(c);
+	return c;
+	
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+linear4_drawhorzline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 < psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+        INVERT(c);
+	DRAWON;
+	addr += (x1>>1) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR) {
+		while(x1 <= x2) {
+			*addr ^= c << ((1-(x1&1))<<2);
+			if((++x1 & 1) == 0)
+				++addr;
+		}
+	} else {
+		while(x1 <= x2) {
+			*addr = (*addr & notmask[x1&1]) | (c << ((1-(x1&1))<<2));
+			if((++x1 & 1) == 0)
+				++addr;
+		}
+	}
+	DRAWOFF;
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+linear4_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	int	linelen = psd->linelen;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 < psd->yres);
+	assert (y2 >= y1);
+	assert (c < psd->ncolors);
+
+        INVERT(c);
+	DRAWON;
+	addr += (x>>1) + y1 * linelen;
+	if(gr_mode == MWMODE_XOR)
+		while(y1++ <= y2) {
+			*addr ^= c << ((1-(x&1))<<2);
+			addr += linelen;
+		}
+	else
+		while(y1++ <= y2) {
+			*addr = (*addr & notmask[x&1]) | (c << ((1-(x&1))<<2));
+			addr += linelen;
+		}
+	DRAWOFF;
+}
+
+/* srccopy bitblt, opcode is currently ignored*/
+static void
+linear4_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	ADDR8	dst;
+	ADDR8	src;
+	int	i;
+	int	dlinelen = dstpsd->linelen;
+	int	slinelen = srcpsd->linelen;
+
+	assert (dstpsd->addr != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (srcpsd->addr != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	DRAWON;
+	dst = dstpsd->addr + (dstx>>1) + dsty * dlinelen;
+	src = srcpsd->addr + (srcx>>1) + srcy * slinelen;
+	while(--h >= 0) {
+		ADDR8	d = dst;
+		ADDR8	s = src;
+		MWCOORD	dx = dstx;
+		MWCOORD	sx = srcx;
+		for(i=0; i<w; ++i) {
+#if INVERT4BPP
+			unsigned char c = *s;
+			INVERT(c);
+			*d = (*d & notmask[dx&1]) |
+			   ((c >> ((1-(sx&1))<<2) & 0x0f) << ((1-(dx&1))<<2));
+#else
+			*d = (*d & notmask[dx&1]) |
+			   ((*s >> ((1-(sx&1))<<2) & 0x0f) << ((1-(dx&1))<<2));
+#endif
+			if((++dx & 1) == 0)
+				++d;
+			if((++sx & 1) == 0)
+				++s;
+		}
+		dst += dlinelen;
+		src += slinelen;
+	}
+	DRAWOFF;
+}
+
+SUBDRIVER fblinear4 = {
+	linear4_init,
+	linear4_drawpixel,
+	linear4_readpixel,
+	linear4_drawhorzline,
+	linear4_drawvertline,
+	gen_fillrect,
+	linear4_blit
+};
diff -urN lib/microwindows/src/drivers/fblin4rev.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin4rev.c
--- lib/microwindows/src/drivers/fblin4rev.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin4rev.c	2005-02-21 16:03:12.000000000 +0100
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * 4bpp Packed Linear Video Driver (reversed nibble order)
+ * For Psion S5
+ *
+ * If INVERT4BPP is defined, then the values are inverted before drawing.
+ *
+ * 	In this driver, psd->linelen is line byte length, not line pixel length
+ */
+/*#define NDEBUG*/
+#include <assert.h>
+#include <string.h>
+#include "device.h"
+#include "fb.h"
+
+#if INVERT4BPP
+#define INVERT(c)	((c) = (~c & 0x0f))
+#else
+#define INVERT(c)
+#endif
+
+static unsigned char notmask[2] = { 0xf0, 0x0f};
+
+/* Calc linelen and mmap size, return 0 on fail*/
+static int
+linear4_init(PSD psd)
+{
+	if (!psd->size)
+		psd->size = psd->yres * psd->linelen;
+	/* linelen in bytes for bpp 1, 2, 4, 8 so no change*/
+	return 1;
+}
+
+/* Set pixel at x, y, to pixelval c*/
+static void
+linear4_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	INVERT(c);
+	DRAWON;
+	addr += (x>>1) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR)
+		*addr ^= c << ((x&1)<<2);
+	else
+		*addr = (*addr & notmask[x&1]) | (c << ((x&1)<<2));
+	DRAWOFF;
+}
+
+/* Read pixel at x, y*/
+static MWPIXELVAL
+linear4_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+	ADDR8		addr = psd->addr;
+	MWPIXELVAL	c;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+
+	c = (addr[(x>>1) + y * psd->linelen] >> ((x&1)<<2) ) & 0x0f;
+	INVERT(c);
+	return c;
+	
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+linear4_drawhorzline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 < psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	INVERT(c);
+	DRAWON;
+	addr += (x1>>1) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR) {
+		while(x1 <= x2) {
+			*addr ^= c << ((x1&1)<<2);
+			if((++x1 & 1) == 0)
+				++addr;
+		}
+	} else {
+		while(x1 <= x2) {
+			*addr = (*addr & notmask[x1&1]) | (c << ((x1&1)<<2));
+			if((++x1 & 1) == 0)
+				++addr;
+		}
+	}
+	DRAWOFF;
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+linear4_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	int	linelen = psd->linelen;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 < psd->yres);
+	assert (y2 >= y1);
+	assert (c < psd->ncolors);
+
+	INVERT(c);
+	DRAWON;
+	addr += (x>>1) + y1 * linelen;
+	if(gr_mode == MWMODE_XOR)
+		while(y1++ <= y2) {
+			*addr ^= c << ((x&1)<<2);
+			addr += linelen;
+		}
+	else
+		while(y1++ <= y2) {
+			*addr = (*addr & notmask[x&1]) | (c << ((x&1)<<2));
+			addr += linelen;
+		}
+	DRAWOFF;
+}
+
+/* srccopy bitblt, opcode is currently ignored*/
+static void
+linear4_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	ADDR8	dst;
+	ADDR8	src;
+	int	i;
+	int	dlinelen = dstpsd->linelen;
+	int	slinelen = srcpsd->linelen;
+
+	assert (dstpsd->addr != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (srcpsd->addr != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	DRAWON;
+	dst = dstpsd->addr + (dstx>>1) + dsty * dlinelen;
+	src = srcpsd->addr + (srcx>>1) + srcy * slinelen;
+	while(--h >= 0) {
+		ADDR8	d = dst;
+		ADDR8	s = src;
+		MWCOORD	dx = dstx;
+		MWCOORD	sx = srcx;
+		for(i=0; i<w; ++i) {
+#if INVERT4BPP
+			unsigned char c = *s;
+			INVERT(c);
+			*d = (*d & notmask[dx&1]) |
+			   ((c >> ((sx&1)<<2) & 0x0f) << ((dx&1)<<2));
+#else
+			*d = (*d & notmask[dx&1]) |
+			   ((*s >> ((sx&1)<<2) & 0x0f) << ((dx&1)<<2));
+#endif
+			if((++dx & 1) == 0)
+				++d;
+			if((++sx & 1) == 0)
+				++s;
+		}
+		dst += dlinelen;
+		src += slinelen;
+	}
+	DRAWOFF;
+}
+
+SUBDRIVER fblinear4 = {
+	linear4_init,
+	linear4_drawpixel,
+	linear4_readpixel,
+	linear4_drawhorzline,
+	linear4_drawvertline,
+	gen_fillrect,
+	linear4_blit
+};
diff -urN lib/microwindows/src/drivers/fblin4sa1100.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin4sa1100.c
--- lib/microwindows/src/drivers/fblin4sa1100.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin4sa1100.c	2005-02-21 16:03:12.000000000 +0100
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 1999 Martin Jolicoeur <martinj@visuaide.com>
+ *
+ * 4bpp Packed Linear Video Driver for Microwindows
+ * Designed for the arm SA1100 lcd controller with 16 bits access
+ * (little endian)
+ *
+ * 	In this driver, psd->linelen is line byte length, not line pixel length
+ */
+/*#define NDEBUG*/
+#include <assert.h>
+#include <string.h>
+#include "device.h"
+#include "fb.h"
+
+static unsigned short notmask[4] = { 0x0fff, 0xf0ff, 0xff0f, 0xfff0};
+
+/* Calc linelen and mmap size, return 0 on fail*/
+static int
+linear4_init(PSD psd)
+{
+	if (!psd->size)
+		psd->size = psd->yres * psd->linelen;
+	/* linelen in bytes for bpp 1, 2, 4, 8 so no change*/
+	return 1;
+}
+
+
+/* Set pixel at x, y, to pixelval c*/
+static void
+linear4_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += (x>>1) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR)
+		*(ADDR16)addr ^= c << ((3-(x&3))<<2);
+	else
+		*(ADDR16)addr = (*(ADDR16)addr & notmask[x&3]) | (c << ((3-(x&3))<<2));
+	DRAWOFF;
+}
+
+/* Read pixel at x, y*/
+static MWPIXELVAL
+linear4_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+
+	return (addr[(x>>1) + y * psd->linelen] >> ((1-(x&1))<<2) ) & 0x0f;
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+linear4_drawhorzline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 < psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += (x1>>1) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR) {
+		while(x1 <= x2) {
+			*(ADDR16)addr ^= c << ((3-(x1&3))<<2);
+			if((++x1 & 1) == 0)
+				++addr;
+		}
+	} else {
+		while(x1 <= x2) {
+			*(ADDR16)addr = (*(ADDR16)addr & notmask[x1&3]) | (c << ((3-(x1&3))<<2));
+			if((++x1 & 1) == 0)
+				++addr;
+		}
+	}
+	DRAWOFF;
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+linear4_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	int	linelen = psd->linelen;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 < psd->yres);
+	assert (y2 >= y1);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += (x>>1) + y1 * linelen;
+	if(gr_mode == MWMODE_XOR)
+		while(y1++ <= y2) {
+			*(ADDR16)addr ^= c << ((3-(x&3))<<2);
+			addr += linelen;
+		}
+	else
+		while(y1++ <= y2) {
+			*(ADDR16)addr = (*(ADDR16)addr & notmask[x&3]) | (c << ((3-(x&3))<<2));
+			addr += linelen;
+		}
+	DRAWOFF;
+}
+
+/* srccopy bitblt, opcode is currently ignored*/
+static void
+linear4_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	ADDR8	dst;
+	ADDR8	src;
+	int	i;
+	int	dlinelen = dstpsd->linelen;
+	int	slinelen = srcpsd->linelen;
+
+	assert (dstpsd->addr != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (srcpsd->addr != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	DRAWON;
+	dst = dstpsd->addr + (dstx>>1) + dsty * dlinelen;
+	src = srcpsd->addr + (srcx>>1) + srcy * slinelen;
+	while(--h >= 0) {
+		ADDR8	d = dst;
+		ADDR8	s = src;
+		MWCOORD	dx = dstx;
+		MWCOORD	sx = srcx;
+		for(i=0; i<w; ++i) {
+			*(ADDR16)d = (*(ADDR16)d & notmask[dx&3]) |
+			   ((*(ADDR16)s >> ((3-(sx&3))<<2) & 0x000f) << ((3-(dx&3))<<2));
+			if((++dx & 1) == 0)
+				++d;
+			if((++sx & 1) == 0)
+				++s;
+		}
+		dst += dlinelen;
+		src += slinelen;
+	}
+	DRAWOFF;
+}
+
+SUBDRIVER fblinear4 = {
+	linear4_init,
+	linear4_drawpixel,
+	linear4_readpixel,
+	linear4_drawhorzline,
+	linear4_drawvertline,
+	gen_fillrect,
+	linear4_blit
+};
diff -urN lib/microwindows/src/drivers/fblin4sh3.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin4sh3.c
--- lib/microwindows/src/drivers/fblin4sh3.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin4sh3.c	2005-02-21 16:03:12.000000000 +0100
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * 4bpp Packed Linear SH3 Video Driver for Microwindows
+ *
+ * 	In this driver, psd->linelen is line byte length, not line pixel length
+ */
+/* 
+	This is modified for SH3 LittleEndian system.
+	4bpp linear video driver, 
+	Frame buffer sturcture and LCD Pixel is 
+
+	32	           16 15		0
+	-----------------------------------------    
+	| P0 | P1 | P2 | P3 | P4 | P5 | P6 | P7 |
+	-----------------------------------------    
+
+ */
+
+/*#define NDEBUG*/
+#include <assert.h>
+#include <string.h>
+#include "device.h"
+#include "fb.h"
+
+static unsigned char notmask[2] = { 0x0f, 0xf0}; 
+
+/* Calc linelen and mmap size, return 0 on fail*/
+static int
+linear4_init(PSD psd)
+{
+	if (!psd->size)
+		psd->size = psd->yres * psd->linelen;
+	/* linelen in bytes for bpp 1, 2, 4, 8 so no change*/
+	return 1;
+}
+
+/* Set pixel at x, y, to pixelval c*/
+static void
+linear4_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += ((x>>1)^3) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR)
+		*addr ^= c << ((1-(x&1))<<2);
+	else
+		*addr = (*addr & notmask[x&1]) | (c << ((1-(x&1))<<2));
+	DRAWOFF;
+}
+
+/* Read pixel at x, y*/
+static MWPIXELVAL
+linear4_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+
+	return (addr[((x>>1)^3) + y * psd->linelen] >> ((1-(x&1))<<2) ) & 0x0f;
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+linear4_drawhorzline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 < psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += ( (x1>>1)^3 ) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR) {
+		while(x1 <= x2) {
+			*addr ^= c << ((1-(x1&1))<<2);
+			if((++x1 & 1) == 0) {
+			/* 	++addr;    */
+			addr = psd->addr + ( (x1>>1)^3 ) + y * psd->linelen;
+			}
+		}
+	} else {
+		while(x1 <= x2) {
+			*addr = (*addr & notmask[x1&1]) | (c << ((1-(x1&1))<<2));
+			if((++x1 & 1) == 0) {
+			/* 	++addr;    */
+			addr = psd->addr + ( (x1>>1)^3 ) + y * psd->linelen;
+			}
+		}
+	}
+	DRAWOFF;
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+linear4_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	int	linelen = psd->linelen;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 < psd->yres);
+	assert (y2 >= y1);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += ( (x>>1)^3 ) + y1 * linelen;
+	if(gr_mode == MWMODE_XOR)
+		while(y1++ <= y2) {
+			*addr ^= c << ((1-(x&1))<<2);
+			addr += linelen;
+		}
+	else
+		while(y1++ <= y2) {
+			*addr = (*addr & notmask[x&1]) | (c << ((1-(x&1))<<2));
+			addr += linelen;
+		}
+	DRAWOFF;
+}
+
+/* srccopy bitblt, opcode is currently ignored*/
+static void
+linear4_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	ADDR8	dst;
+	ADDR8	src;
+	int	i;
+	int	dlinelen = dstpsd->linelen;
+	int	slinelen = srcpsd->linelen;
+
+	assert (dstpsd->addr != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (srcpsd->addr != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	DRAWON;
+#ifdef SH3_LITTLE_ENDIAN   /* not used */
+	dst = dstpsd->addr + ( (dstx>>1)^3 ) + dsty * dlinelen;
+	src = srcpsd->addr + ( (srcx>>1)^3 ) + srcy * slinelen;
+	while(--h >= 0) {
+		ADDR8	d = dst;
+		ADDR8	s = src;
+		MWCOORD	dx = dstx;
+		MWCOORD	sx = srcx;
+		for(i=0; i<w; ++i) {
+			*d = (*d & notmask[dx&1]) |
+			   ((*s >> ((1-(sx&1))<<2) & 0x0f) << ((1-(dx&1))<<2));
+			if((++dx & 1) == 0)
+				++d;
+			if((++sx & 1) == 0)
+				++s;
+		}
+		dst += dlinelen;
+		src += slinelen;
+	}
+#else
+	dst = dstpsd->addr + dsty * dlinelen;
+	src = srcpsd->addr + srcy * slinelen;
+	while(--h >= 0) {
+		ADDR8	d = dst + ( (dstx>>1)^3 );
+		ADDR8	s = src + ( (srcx>>1)^3 );
+		MWCOORD	dx = dstx;
+		MWCOORD	sx = srcx;
+		for(i=0; i<w; ++i) {
+			*d = (*d & notmask[dx&1]) |
+			   ((*s >> ((1-(sx&1))<<2) & 0x0f) << ((1-(dx&1))<<2));
+			if((++dx & 1) == 0)
+				d = dst + ( (dx >> 1)^3 );
+			if((++sx & 1) == 0)
+				s = src + ( (sx >> 1)^3 );
+		}
+		dst += dlinelen;
+		src += slinelen;
+	}
+#endif
+	DRAWOFF;
+}
+
+SUBDRIVER fblinear4 = {
+	linear4_init,
+	linear4_drawpixel,
+	linear4_readpixel,
+	linear4_drawhorzline,
+	linear4_drawvertline,
+	gen_fillrect,
+	linear4_blit
+};
diff -urN lib/microwindows/src/drivers/fblin8.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin8.c
--- lib/microwindows/src/drivers/fblin8.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fblin8.c	2005-02-21 16:13:06.000000000 +0100
@@ -0,0 +1,271 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * 8bpp Linear Video Driver for Microwindows
+ * 	00/01/26 added alpha blending with lookup tables (64k total)
+ *
+ * Inspired from Ben Pfaff's BOGL <pfaffben@debian.org>
+ */
+/*#define NDEBUG*/
+#include <assert.h>
+
+/* We want to do string copying fast, so inline assembly if possible */
+#ifndef __OPTIMIZE__
+#define __OPTIMIZE__
+#endif
+#include <string.h>
+#include <stdlib.h>
+
+#include "device.h"
+#include "fb.h"
+
+#if ALPHABLEND
+/*
+ * Alpha lookup tables for 256 color palette systems
+ * A 5 bit alpha value is used to keep tables smaller.
+ *
+ * Two tables are created.  The first, alpha_to_rgb contains 15 bit RGB 
+ * values for each alpha value for each color: 32*256 short words.
+ * RGB values can then be blended.  The second, rgb_to_palindex contains
+ * the closest color (palette index) for each of the 5-bit
+ * R, G, and B values: 32*32*32 bytes.
+ */
+static unsigned short *alpha_to_rgb = NULL;
+static unsigned char  *rgb_to_palindex = NULL;
+void init_alpha_lookup(void);
+#endif
+
+/* Calc linelen and mmap size, return 0 on fail*/
+static int
+linear8_init(PSD psd)
+{
+	if (!psd->size)
+		psd->size = psd->yres * psd->linelen;
+	/* linelen in bytes for bpp 1, 2, 4, 8 so no change*/
+	return 1;
+}
+
+/* Set pixel at x, y, to pixelval c*/
+static void
+linear8_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	if(gr_mode == MWMODE_XOR)
+		addr[x + y * psd->linelen] ^= c;
+	else
+		addr[x + y * psd->linelen] = c;
+	DRAWOFF;
+}
+
+/* Read pixel at x, y*/
+static MWPIXELVAL
+linear8_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+
+	return addr[x + y * psd->linelen];
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+linear8_drawhorzline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 < psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += x1 + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR) {
+		while(x1++ <= x2)
+			*addr++ ^= c;
+	} else
+		memset(addr, c, x2 - x1 + 1);
+	DRAWOFF;
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+linear8_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	int	linelen = psd->linelen;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 < psd->yres);
+	assert (y2 >= y1);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	addr += x + y1 * linelen;
+	if(gr_mode == MWMODE_XOR)
+		while(y1++ <= y2) {
+			*addr ^= c;
+			addr += linelen;
+		}
+	else
+		while(y1++ <= y2) {
+			*addr = c;
+			addr += linelen;
+		}
+	DRAWOFF;
+}
+
+/* srccopy bitblt*/
+static void
+linear8_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	ADDR8	dst;
+	ADDR8	src;
+	int	dlinelen = dstpsd->linelen;
+	int	slinelen = srcpsd->linelen;
+#if ALPHABLEND
+	unsigned int srcalpha, dstalpha;
+#endif
+
+	assert (dstpsd->addr != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (srcpsd->addr != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	DRAWON;
+	dst = dstpsd->addr + dstx + dsty * dlinelen;
+	src = srcpsd->addr + srcx + srcy * slinelen;
+
+#if ALPHABLEND
+	if((op & MWROP_EXTENSION) != MWROP_BLENDCONSTANT)
+		goto stdblit;
+	srcalpha = op & 0xff;
+
+	/* FIXME create lookup table after palette is stabilized...*/
+	if(!rgb_to_palindex || !alpha_to_rgb) {
+		init_alpha_lookup();
+		if(!rgb_to_palindex || !alpha_to_rgb)
+			goto stdblit;
+	}
+
+	/* Create 5 bit alpha value index for 256 color indexing*/
+
+	/* destination alpha is (1 - source) alpha*/
+	dstalpha = ((srcalpha>>3) ^ 31) << 8;
+	srcalpha = (srcalpha>>3) << 8;
+
+	while(--h >= 0) {
+	    int	i;
+	    for(i=0; i<w; ++i) {
+		/* Get source RGB555 value for source alpha value*/
+		unsigned short s = alpha_to_rgb[srcalpha + *src++];
+
+		/* Get destination RGB555 value for dest alpha value*/
+		unsigned short d = alpha_to_rgb[dstalpha + *dst];
+
+		/* Add RGB values together and get closest palette index to it*/
+		*dst++ = rgb_to_palindex[s + d];
+	    }
+	    dst += dlinelen - w;
+	    src += slinelen - w;
+	}
+	DRAWOFF;
+	return;
+stdblit:
+#endif
+	/* copy from bottom up if dst in src rectangle*/
+	/* memmove is used to handle x case*/
+	if (srcy < dsty) {
+		src += (h-1) * slinelen;
+		dst += (h-1) * dlinelen;
+		slinelen *= -1;
+		dlinelen *= -1;
+	}
+
+	while(--h >= 0) {
+		/* a _fast_ memcpy is a _must_ in this routine*/
+		memmove(dst, src, w);
+		dst += dlinelen;
+		src += slinelen;
+	}
+	DRAWOFF;
+}
+
+#if ALPHABLEND
+void
+init_alpha_lookup(void)
+{
+	int	i, a;
+	int	r, g, b;
+	extern MWPALENTRY gr_palette[256];
+
+	if(!alpha_to_rgb)
+		alpha_to_rgb = (unsigned short *)malloc(
+			sizeof(unsigned short)*32*256);
+	if(!rgb_to_palindex)
+		rgb_to_palindex = (unsigned char *)malloc(
+			sizeof(unsigned char)*32*32*32);
+	if(!rgb_to_palindex || !alpha_to_rgb)
+		return;
+
+	/*
+	 * Precompute alpha to rgb lookup by premultiplying
+	 * each palette rgb value by each possible alpha
+	 * and storing it as RGB555.
+	 */
+	for(i=0; i<256; ++i) {
+		MWPALENTRY *p = &gr_palette[i];
+		for(a=0; a<32; ++a) {
+			alpha_to_rgb[(a<<8)+i] =
+				(((p->r * a / 31)>>3) << 10) |
+				(((p->g * a / 31)>>3) << 5) |
+				 ((p->b * a / 31)>>3);
+		}
+	}
+
+	/*
+	 * Precompute RGB555 to palette index table by
+	 * finding the nearest palette index for all RGB555 colors.
+	 */
+	for(r=0; r<32; ++r) {
+		for(g=0; g<32; ++g)
+			for(b=0; b<32; ++b)
+				rgb_to_palindex[ (r<<10)|(g<<5)|b] =
+					GdFindNearestColor(gr_palette, 256,
+						MWRGB(r<<3, g<<3, b<<3));
+	}
+}
+#endif
+
+SUBDRIVER fblinear8 = {
+	linear8_init,
+	linear8_drawpixel,
+	linear8_readpixel,
+	linear8_drawhorzline,
+	linear8_drawvertline,
+	gen_fillrect,
+	linear8_blit
+};
diff -urN lib/microwindows/src/drivers/fbportrait_left.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fbportrait_left.c
--- lib/microwindows/src/drivers/fbportrait_left.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fbportrait_left.c	2005-02-21 16:13:06.000000000 +0100
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Portrait mode subdriver for Microwindows
+ */
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "device.h"
+#include "fb.h"
+
+PSUBDRIVER _subdriver;		/* original subdriver*/
+
+static void
+fbportrait_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	_subdriver->DrawPixel(psd, y, psd->xvirtres-x-1, c);
+}
+
+static MWPIXELVAL
+fbportrait_readpixel(PSD psd,MWCOORD x, MWCOORD y)
+{
+	return _subdriver->ReadPixel(psd, y, psd->xvirtres-x-1);
+}
+
+static void
+fbportrait_drawhorzline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	_subdriver->DrawVertLine(psd, y, psd->xvirtres-x2-1,
+		psd->xvirtres-x1-1, c);
+
+	/*
+	 * Uncomment the following if driver doesn't support hline
+	x2 = psd->xvirtres-x2-1;
+	while(x2 <= (psd->xvirtres-x1-1))
+		fb_drawpixel(psd, y, x2++, c);
+	 */
+}
+
+static void
+fbportrait_drawvertline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	_subdriver->DrawHorzLine(psd, y1, y2, psd->xvirtres-x-1, c);
+
+	/*
+	 * Uncomment the following if driver doesn't support vline
+	while(y1 <= y2)
+		fb_drawpixel(psd, y1++, psd->xvirtres-x-1, c);
+	 */
+}
+
+static void
+fbportrait_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2,
+	MWPIXELVAL c)
+{
+	x2 = psd->xvirtres-x2-1;
+	while(x2 <= (psd->xvirtres-x1-1))
+		_subdriver->DrawHorzLine(psd, y1, y2, x2++, c);
+}
+
+static void
+fbportrait_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,MWCOORD h,
+	PSD srcpsd, MWCOORD srcx,MWCOORD srcy,long op)
+{
+	_subdriver->Blit(dstpsd, desty, dstpsd->xvirtres-destx-w, h, w,
+		srcpsd, srcy, srcpsd->xvirtres-srcx-w, op);
+}
+
+SUBDRIVER fbportrait = {
+	NULL,
+	fbportrait_drawpixel,
+	fbportrait_readpixel,
+	fbportrait_drawhorzline,
+	fbportrait_drawvertline,
+	gen_fillrect,
+	fbportrait_blit
+};
diff -urN lib/microwindows/src/drivers/fbportrait_right.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fbportrait_right.c
--- lib/microwindows/src/drivers/fbportrait_right.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/fbportrait_right.c	2005-02-21 16:13:06.000000000 +0100
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Portrait mode subdriver for Microwindows
+ */
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "device.h"
+#include "fb.h"
+
+PSUBDRIVER _subdriver;		/* original subdriver*/
+
+static void
+fbportrait_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	_subdriver->DrawPixel(psd, psd->yvirtres-y-1, x, c);
+}
+
+static MWPIXELVAL
+fbportrait_readpixel(PSD psd,MWCOORD x, MWCOORD y)
+{
+	return _subdriver->ReadPixel(psd, psd->yvirtres-y-1, x);
+}
+
+static void
+fbportrait_drawhorzline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	_subdriver->DrawVertLine(psd, psd->yvirtres-y-1, x1,
+		x2, c);
+
+	/*
+	 * Uncomment the following if driver doesn't support hline
+	x2 = x2;
+	while(x2 <= (x1))
+		fb_drawpixel(psd, psd->yvirtres-y-1, x2++, c);
+	 */
+}
+
+static void
+fbportrait_drawvertline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	_subdriver->DrawHorzLine(psd, psd->yvirtres-y2-1, psd->yvirtres-y1-1,
+		x, c);
+
+	/*
+	 * Uncomment the following if driver doesn't support vline
+	while(y1 <= y2)
+		fb_drawpixel(psd, psd->yvirtres-1-(y1++), x, c);
+	 */
+}
+
+static void
+fbportrait_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2,
+	MWPIXELVAL c)
+{
+	while(x2 <= x1)
+		_subdriver->DrawHorzLine(psd, psd->yvirtres-y2-1,
+			psd->yvirtres-y1-1, x2++, c);
+}
+
+static void
+fbportrait_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,MWCOORD h,
+	PSD srcpsd, MWCOORD srcx,MWCOORD srcy,long op)
+{
+	_subdriver->Blit(dstpsd, dstpsd->yvirtres-desty-h, destx, h, w,
+		srcpsd, srcpsd->yvirtres-srcy-h, srcx, op);
+}
+
+SUBDRIVER fbportrait = {
+	NULL,
+	fbportrait_drawpixel,
+	fbportrait_readpixel,
+	fbportrait_drawhorzline,
+	fbportrait_drawvertline,
+	gen_fillrect,
+	fbportrait_blit
+};
diff -urN lib/microwindows/src/drivers/genfont.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/genfont.c
--- lib/microwindows/src/drivers/genfont.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/genfont.c	2005-02-21 16:13:06.000000000 +0100
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Screen Driver Utilities
+ * 
+ * Microwindows Proportional Font Routines (proportional font format)
+ *
+ * This file contains the generalized low-level font/text
+ * drawing routines.  Both fixed and proportional fonts are
+ * supported, with fixed pitch structure allowing much smaller
+ * font files.
+ */
+#include <stdio.h>
+#include "device.h"
+#include "genfont.h"
+
+/* compiled in fonts*/
+extern MWCFONT font_rom8x16, font_rom8x8;
+extern MWCFONT font_winFreeSansSerif11x13;
+extern MWCFONT font_winFreeSystem14x16;
+extern MWCFONT font_winSystem14x16;
+extern MWCFONT font_winMSSansSerif11x13;
+extern MWCFONT font_winTerminal8x12;
+extern MWCFONT font_helvB10, font_helvB12, font_helvR10;
+extern MWCFONT font_X5x7, font_X6x13;
+
+/* handling routines for MWCOREFONT*/
+static MWFONTPROCS fontprocs = {
+	MWTF_ASCII,		/* routines expect ascii*/
+	gen_getfontinfo,
+	gen_gettextsize,
+	gen_gettextbits,
+	gen_unloadfont,
+	corefont_drawtext,
+	NULL,			/* setfontsize*/
+	NULL,			/* setfontrotation*/
+	NULL,			/* setfontattr*/
+};
+
+/* first font is default font if no match*/
+MWCOREFONT gen_fonts[NUMBER_FONTS] = {
+#if HAVEMSFONTS
+	{&fontprocs, 0, 0, 0, MWFONT_SYSTEM_VAR, &font_winSystem14x16},
+	{&fontprocs, 0, 0, 0, MWFONT_GUI_VAR, &font_winMSSansSerif11x13},
+	{&fontprocs, 0, 0, 0, MWFONT_OEM_FIXED, &font_winTerminal8x12},
+	{&fontprocs, 0, 0, 0, MWFONT_SYSTEM_FIXED, &font_X6x13}
+#else
+	{&fontprocs, 0, 0, 0, MWFONT_SYSTEM_VAR, &font_winFreeSystem14x16},
+	{&fontprocs, 0, 0, 0, MWFONT_GUI_VAR, &font_winFreeSansSerif11x13},
+	{&fontprocs, 0, 0, 0, MWFONT_OEM_FIXED, &font_rom8x16},
+	{&fontprocs, 0, 0, 0, MWFONT_SYSTEM_FIXED, &font_X6x13}
+#endif
+};
+
+/*
+ * Generalized low level get font info routine.  This
+ * routine works with fixed and proportional fonts.
+ */
+MWBOOL
+gen_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo)
+{
+	PMWCFONT	pf = ((PMWCOREFONT)pfont)->cfont;
+	int		i;
+
+	pfontinfo->maxwidth = pf->maxwidth;
+	pfontinfo->height = pf->height;
+	pfontinfo->baseline = pf->ascent;
+	pfontinfo->firstchar = pf->firstchar;
+	pfontinfo->lastchar = pf->firstchar + pf->size - 1;
+	pfontinfo->fixed = pf->width == NULL? TRUE: FALSE;
+	for(i=0; i<256; ++i) {
+		if(pf->width == NULL)
+			pfontinfo->widths[i] = pf->maxwidth;
+		else {
+			if(i<pf->firstchar || i >= pf->firstchar+pf->size)
+				pfontinfo->widths[i] = 0;
+			else pfontinfo->widths[i] = pf->width[i-pf->firstchar];
+		}
+	}
+	return TRUE;
+}
+
+/*
+ * Generalized low level routine to calc bounding box for text output.
+ * Handles both fixed and proportional fonts.  Passed ascii string.
+ */
+void
+gen_gettextsize(PMWFONT pfont, const void *text, int cc,
+	MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase)
+{
+	PMWCFONT		pf = ((PMWCOREFONT)pfont)->cfont;
+	const unsigned char *	str = text;
+	unsigned int		c;
+	int			width;
+
+	if(pf->width == NULL)
+		width = cc * pf->maxwidth;
+	else {
+		width = 0;
+		while(--cc >= 0) {
+			c = *str++;
+#if HAVE_BIG5_SUPPORT
+			/* chinese big5 decoding*/
+			if (c >= 0xA1 && c <= 0xF9 && cc >= 1 &&
+				((*str >= 0x40 && *str <= 0x7E) ||
+			 	(*str >= 0xA1 && *str <= 0xFE)) ) {
+					--cc;
+					++str;
+					width += 12;	/* FIXME*/
+			} else
+#endif
+#if HAVE_GB2312_SUPPORT
+			/* chinese gb2312 decoding*/
+			if (c >= 0xA1 && c < 0xF8 && cc >= 1 &&
+				*str >= 0xA1 && *str < 0xFF) {
+					--cc;
+					++str;
+					width += 12;	/* FIXME*/
+			} else
+#endif
+			    if(c >= pf->firstchar && c < pf->firstchar+pf->size)
+                                width += pf->width[c - pf->firstchar];
+		}
+	}
+	*pwidth = width;
+	*pheight = pf->height;
+	*pbase = pf->ascent;
+}
+
+/*
+ * Generalized low level routine to get the bitmap associated
+ * with a character.  Handles fixed and proportional fonts.
+ */
+void
+gen_gettextbits(PMWFONT pfont, int ch, MWIMAGEBITS *retmap,
+	MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase)
+{
+	PMWCFONT	pf = ((PMWCOREFONT)pfont)->cfont;
+	int 		n, count, width;
+	MWIMAGEBITS *	bits;
+
+#if HAVE_BIG5_SUPPORT
+	/* decode chinese big5*/
+	int CH = ((unsigned int)ch) >> 8, CL = ((unsigned int)ch) & 0xFF;
+	if (CH >= 0xA1 && CH <= 0xF9 && ((CL >= 0x40 && CL <= 0x7E) || (CL >= 0xA1 && CL <= 0xFE)) ) 
+	{
+	    int Pos;//!= ((CH - 0xA1) * 94 + (CL - 0xA1)) * 18;
+
+	    int i;
+	    extern unsigned char JMT_BIG5_12X12_FONT_BITMAP[];
+
+	    int seq;
+	    {
+		seq=0;
+		//ladd=loby-(if(loby<127)?64:98)
+		CL/*c2*/-=(CL/*c2*/<127?64:98);   
+
+		//hadd=(hiby-164)*157
+		if (CH/*c1*/>=0xa4)//standard font
+		{
+			seq=(((CH/*c1*/-164)*157)+CL/*c2*/);
+			if (seq>=5809) seq-=408;
+		}
+
+		//hadd=(hiby-161)*157
+		if (CH/*c1*/<=0xa3)//special font
+			seq=(((CH/*c1*/-161)*157)+CL/*c2*/)+13094;
+	    }
+	    Pos=seq*18;
+
+	    *pwidth = width = 12;
+	    *pheight = 12;
+	    *pbase = 0;
+
+	    for (i = 0; i < 6; i++) {
+		unsigned char *DstBitmap  = ((unsigned char *)retmap) + i * 4;
+		unsigned char *FontBitmap = JMT_BIG5_12X12_FONT_BITMAP +
+			Pos + i * 3;
+		DstBitmap[0] = FontBitmap[1];
+		DstBitmap[1] = FontBitmap[0];
+		DstBitmap[2] = FontBitmap[1] << 4;
+		DstBitmap[3] = FontBitmap[2];
+	    }
+	    return;
+	}
+#endif /* HAVE_BIG5_SUPPORT*/
+
+#if HAVE_GB2312_SUPPORT
+	/* decode chinese gb2312*/
+	int CH = ((unsigned int)ch) >> 8, CL = ((unsigned int)ch) & 0xFF;
+	if (CH >= 0xA1 && CH < 0xF8 && CL >= 0xA1 && CL < 0xFF) {
+	    int Pos = ((CH - 0xA1) * 94 + (CL - 0xA1)) * 18;
+	    int i;
+	    extern unsigned char GUO_GB2312_12X12_FONT_BITMAP[];
+
+	    *pwidth = width = 12;
+	    *pheight = 12;
+	    *pbase = 0;
+
+	    for (i = 0; i < 6; i++) {
+		unsigned char *DstBitmap  = ((unsigned char *)retmap) + i * 4;
+		unsigned char *FontBitmap = GUO_GB2312_12X12_FONT_BITMAP +
+			Pos + i * 3;
+		DstBitmap[0] = FontBitmap[1];
+		DstBitmap[1] = FontBitmap[0];
+		DstBitmap[2] = FontBitmap[1] << 4;
+		DstBitmap[3] = FontBitmap[2];
+	    }
+	    return;
+	}
+#endif /* HAVE_GB2312_SUPPORT*/
+
+	/* if char not in font, map to first character by default*/
+	if(ch < pf->firstchar || ch >= pf->firstchar+pf->size)
+		ch = pf->firstchar;
+
+	ch -= pf->firstchar;
+
+	/* get font bitmap depending on fixed pitch or not*/
+	bits = pf->bits + (pf->offset? pf->offset[ch]: (pf->height * ch));
+	width = pf->width ? pf->width[ch] : pf->maxwidth;
+	count = MWIMAGE_WORDS(width) * pf->height;
+	for(n=0; n<count; ++n)
+		*retmap++ = *bits++;
+
+	/* return width depending on fixed pitch or not*/
+	*pwidth = width;
+	*pheight = pf->height;
+	*pbase = pf->ascent;
+}
+
+void
+gen_unloadfont(PMWFONT pfont)
+{
+	/* builtins can't be unloaded*/
+}
+
+#if NOTUSED
+/* 
+ * Generalized low level text draw routine, called only
+ * if no clipping is required
+ */
+void
+gen_drawtext(PMWFONT pfont,PSD psd,MWCOORD x,MWCOORD y,const void *text,
+	int n,MWPIXELVAL fg)
+{
+	PMWCFONT		pf = ((PMWCOREFONT)pfont)->cfont;
+	const unsigned char *	str = text;
+	MWCOORD 		width;		/* width of character */
+	MWCOORD 		height;		/* height of character */
+	IMAGEBITS   bitmap[MAX_CHAR_HEIGHT*MAX_CHAR_WIDTH/MWIMAGE_BITSPERIMAGE];
+
+	/* x, y is bottom left corner*/
+	y -= pf->height - 1;
+	while (n-- > 0) {
+		pfont->GetTextBits(pfont, *s++, bitmap, &width, &height);
+		gen_drawbitmap(psd, x, y, width, height, bitmap, fg);
+		x += width;
+	}
+}
+
+/*
+ * Generalized low level bitmap output routine, called
+ * only if no clipping is required.  Only the set bits
+ * in the bitmap are drawn, in the foreground color.
+ */
+void
+gen_drawbitmap(PSD psd,MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height,
+	MWIMAGEBITS *table, PIXELVAL fgcolor)
+{
+  MWCOORD minx;
+  MWCOORD maxx;
+  MWIMAGEBITS bitvalue;	/* bitmap word value */
+  int bitcount;			/* number of bits left in bitmap word */
+
+  minx = x;
+  maxx = x + width - 1;
+  bitcount = 0;
+  while (height > 0) {
+	if (bitcount <= 0) {
+		bitcount = MWIMAGE_BITSPERIMAGE;
+		bitvalue = *table++;
+	}
+	if (MWIMAGE_TESTBIT(bitvalue))
+		psd->DrawPixel(psd, x, y, fgcolor);
+	bitvalue = MWIMAGE_SHIFTBIT(bitvalue);
+	--bitcount;
+	if (x++ == maxx) {
+		x = minx;
+		++y;
+		--height;
+		bitcount = 0;
+	}
+  }
+}
+#endif /* NOTUSED*/
diff -urN lib/microwindows/src/drivers/genfont.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/genfont.h
--- lib/microwindows/src/drivers/genfont.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/genfont.h	2005-02-21 16:13:07.000000000 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Screen Driver Utilities
+ * 
+ * MicroWindows Proportional Font Routine Header (proportional font format)
+ *
+ * These routines are screen driver entry points.
+ */
+
+#define NUMBER_FONTS	4	/* number of compiled-in fonts*/
+
+/* entry points*/
+MWBOOL	gen_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo);
+void	gen_gettextsize(PMWFONT pfont, const void *text, int cc,
+		MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+void	gen_gettextbits(PMWFONT pfont, int ch, MWIMAGEBITS *retmap,
+		MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+void	gen_unloadfont(PMWFONT pfont);
+
+void	corefont_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+		const void *text, int cc, int flags);
+
+/* local data*/
+extern MWCOREFONT gen_fonts[NUMBER_FONTS];
+
+/* the following aren't used yet*/
+void	gen_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+		const void *text, int n, MWPIXELVAL fg);
+void 	gen_drawbitmap(PSD psd,MWCOORD x,MWCOORD y,MWCOORD width,MWCOORD height,
+		MWIMAGEBITS *table, MWPIXELVAL fgcolor);
diff -urN lib/microwindows/src/drivers/genmem.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/genmem.c
--- lib/microwindows/src/drivers/genmem.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/genmem.c	2005-02-21 16:13:07.000000000 +0100
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Screen Driver Utilities
+ * 
+ * Microwindows memory device routines
+ */
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "device.h"
+#include "fb.h"
+#include "genmem.h"
+
+/* allocate a memory screen device*/
+PSD 
+gen_allocatememgc(PSD psd)
+{
+	PSD	mempsd;
+
+	/* if driver doesn't have blit, fail*/
+	if((psd->flags & PSF_HAVEBLIT) == 0)
+		return NULL;
+
+	mempsd = malloc(sizeof(SCREENDEVICE));
+	if (!mempsd)
+		return NULL;
+
+	/* copy passed device get initial values*/
+	*mempsd = *psd;
+
+	/* initialize*/
+	mempsd->flags |= PSF_MEMORY;
+	mempsd->flags &= ~PSF_SCREEN;
+	mempsd->addr = NULL;
+
+	return mempsd;
+}
+
+/* initialize memory device with passed parms*/
+void
+initmemgc(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,int linelen,
+	int size,void *addr)
+{
+	assert(mempsd->flags & PSF_MEMORY);
+
+	if (mempsd->flags&PSF_PORTRAIT) {
+		mempsd->yres = w;
+		mempsd->xres = h;
+	} else {
+		mempsd->xres = w;
+		mempsd->yres = h;		
+	}
+	mempsd->xvirtres = w;
+	mempsd->yvirtres = h;
+	mempsd->planes = planes;
+	mempsd->bpp = bpp;
+	mempsd->linelen = linelen;
+	mempsd->size = size;
+	mempsd->addr = addr;
+}
+
+void
+gen_freememgc(PSD mempsd)
+{
+	assert(mempsd->flags & PSF_MEMORY);
+
+	/* note: mempsd->addr must be freed elsewhere*/
+
+	free(mempsd);
+}
+
+void
+gen_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2,
+	MWPIXELVAL c)
+{
+	while(y1 <= y2)
+		psd->DrawHorzLine(psd, x1, x2, y1++, c);
+}
+
+/*
+ * Set subdriver entry points in screen device
+ * Initialize subdriver if init flag is TRUE
+ * Return 0 on fail
+ */
+MWBOOL
+set_subdriver(PSD psd, PSUBDRIVER subdriver, MWBOOL init)
+{
+	/* set subdriver entry points in screen driver*/
+	psd->DrawPixel 		= subdriver->DrawPixel;
+	psd->ReadPixel 		= subdriver->ReadPixel;
+	psd->DrawHorzLine 	= subdriver->DrawHorzLine;
+	psd->DrawVertLine 	= subdriver->DrawVertLine;
+	psd->FillRect	 	= subdriver->FillRect;
+	psd->Blit 		= subdriver->Blit;
+	psd->DrawArea 		= subdriver->DrawArea;
+
+	/* call driver init procedure to calc map size and linelen*/
+	if (init && !subdriver->Init(psd))
+		return 0;
+	return 1;
+}
+
+/* fill in a subdriver struct from passed screen device*/
+void
+get_subdriver(PSD psd, PSUBDRIVER subdriver)
+{
+	/* set subdriver entry points in screen driver*/
+	subdriver->DrawPixel 		= psd->DrawPixel;
+	subdriver->ReadPixel 		= psd->ReadPixel;
+	subdriver->DrawHorzLine 	= psd->DrawHorzLine;
+	subdriver->DrawVertLine 	= psd->DrawVertLine;
+	subdriver->FillRect	 	= psd->FillRect;
+	subdriver->Blit 		= psd->Blit;
+	subdriver->DrawArea 		= psd->DrawArea;
+}
diff -urN lib/microwindows/src/drivers/genmem.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/genmem.h
--- lib/microwindows/src/drivers/genmem.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/genmem.h	2005-02-21 16:03:13.000000000 +0100
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Screen Driver Utilities
+ * 
+ * Microwindows memory device routines header file
+ */
+
+/* entry points*/
+
+/* genmem.c*/
+PSD 	gen_allocatememgc(PSD psd);
+void	gen_freememgc(PSD mempsd);
+void	initmemgc(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,
+		int linelen,int size,void *addr);
+
+/* fb.c*/
+MWBOOL	fb_mapmemgc(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,
+		int linelen,int size,void *addr);
diff -urN lib/microwindows/src/drivers/getbyte.s /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/getbyte.s
--- lib/microwindows/src/drivers/getbyte.s	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/getbyte.s	2005-02-21 16:03:13.000000000 +0100
@@ -0,0 +1,46 @@
+# 05/08/2000 Michael Temari <Michael@TemWare.Com>
+# GETBYTE/PUTBYTE for MINIX
+! sections
+
+.sect .text; .sect .rom; .sect .data; .sect .bss
+
+#include "/usr/src/kernel/protect.h"
+
+.extern	_GETBYTE_FP
+.extern	_PUTBYTE_FP
+.extern	_RMW_FP
+
+.sect .bss
+.sect .text
+
+        .align  16
+_GETBYTE_FP:
+	mov	bx,ds
+        mov	ecx, 0x17
+        mov	ds, cx
+        mov	edx,4(esp)              ! offset
+        sub	ax, ax
+        movb	al,(edx)                ! byte to get
+        mov	ds,bx
+        ret
+
+        .align  16
+_PUTBYTE_FP:
+	mov	bx,ds
+        mov	ecx, 0x17
+        mov	ds, cx
+        mov	eax,4(esp)              ! offset
+        mov	edx,4+4(esp)            ! data byte
+        movb	(eax),dl                ! byte to store
+        mov	ds,bx
+        ret
+
+        .align  16
+_RMW_FP:
+        mov	bx,ds
+        mov	ecx, 0x17
+        mov	ds, cx
+        mov	eax,4(esp)              ! offset
+        orb	(eax),cl                ! byte to store
+        mov	ds,bx
+        ret
diff -urN lib/microwindows/src/drivers/gsselect_rtems.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/gsselect_rtems.c
--- lib/microwindows/src/drivers/gsselect_rtems.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/gsselect_rtems.c	2005-02-21 16:13:07.000000000 +0100
@@ -0,0 +1,83 @@
+/*
+/////////////////////////////////////////////////////////////////////////////
+// $Header: $
+//
+// Copyright (c) 2000 - Rosimildo da Silva
+//  
+// MODULE DESCRIPTION: 
+// This module implements the "GsSelect()" function for Nano-X.
+//
+// MODIFICATION/HISTORY:
+//
+// $Log: $
+//
+/////////////////////////////////////////////////////////////////////////////
+*/
+
+#include <stdio.h>
+#include <errno.h>
+
+#include <rtems/mw_uid.h>
+#include "device.h"
+
+/* defined in input_rtems.c */
+extern struct MW_UID_MESSAGE m_kbd;
+extern struct MW_UID_MESSAGE m_mou;
+
+
+void
+GsSelect(void)
+{
+  struct MW_UID_MESSAGE m;
+  int rc;
+  unsigned int timeout = 10;
+
+  /* perform pre-select duties, if any*/
+  if(scrdev.PreSelect)
+  {
+     scrdev.PreSelect(&scrdev);
+  }
+
+  /* let's make sure that the type is invalid */
+  m.type = MV_UID_INVALID;
+
+  /* wait up to 100 milisecons for events */
+  rc = uid_read_message( &m, timeout );
+
+  /* return if timed-out or something went wrong */
+  if( rc < 0 )
+  {
+     if( errno != ETIMEDOUT )
+        EPRINTF( " rc= %d, errno=%d\n", rc, errno );
+     else
+     {
+        /* timeout handling */
+
+     }
+     return;
+  }
+
+  /* let's pass the event up to microwindows */
+  switch( m.type )
+  {
+    /* Mouse or Touch Screen event */
+    case MV_UID_REL_POS:
+    case MV_UID_ABS_POS:
+        m_mou = m;
+        while(GsCheckMouseEvent())
+             continue;
+        break;
+
+    /* KBD event */
+    case MV_UID_KBD:
+        m_kbd = m;
+        GsCheckKeyboardEvent();
+        break;
+
+    /* micro-windows does nothing with those.. */
+    case MV_UID_TIMER:
+    case MV_UID_INVALID:
+    default:
+       ;
+  }
+}
diff -urN lib/microwindows/src/drivers/input_rtems.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/input_rtems.c
--- lib/microwindows/src/drivers/input_rtems.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/input_rtems.c	2005-02-21 16:13:07.000000000 +0100
@@ -0,0 +1,231 @@
+/*
+/////////////////////////////////////////////////////////////////////////////
+// $Header: $
+//
+// Copyright (c) 2000 - Rosimildo da Silva
+//  
+// MODULE DESCRIPTION: 
+// This module implements the Microwindows Drivers for systems that implements 
+// the Micro Input Device interface. This driver is not specific in any way
+// to RTEMS. It could be used with any sustem that implements such interface.
+//
+// The skeleton of the drivers were based on standard Microwindows drivers.
+//
+// MODIFICATION/HISTORY:
+//
+// $Log: $
+//
+/////////////////////////////////////////////////////////////////////////////
+*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+
+#include <rtems/mw_uid.h>
+#include "device.h"
+#include "windef.h"   /* UCHAR */
+
+
+extern int close( int fd ); /* RTEMS does not include close() in stdio.h */
+
+#define    SCALE        3    /* default scaling factor for acceleration */
+#define    THRESH       5    /* default threshhold for acceleration */
+
+/* prototypes of the mouse driver */
+static int      MWMou_Open(MOUSEDEVICE *pmd);
+static void     MWMou_Close(void);
+static int      MWMou_GetButtonInfo(void);
+static void     MWMou_GetDefaultAccel(int *pscale,int *pthresh);
+static int      MWMou_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz, int *bp);
+
+/* prototypes of the Kbd driver */
+static int     MWKbd_Open(KBDDEVICE *pkd);
+static void    MWKbd_Close(void);
+static void    MWKbd_GetModifierInfo(int *modifiers);
+static int     MWKbd_Read(MWUCHAR *buf, int *modifiers);
+
+
+MOUSEDEVICE mousedev = 
+{
+    MWMou_Open,
+    MWMou_Close,
+    MWMou_GetButtonInfo,
+    MWMou_GetDefaultAccel,
+    MWMou_Read,
+    NULL
+};
+
+
+KBDDEVICE kbddev = {
+    MWKbd_Open,
+    MWKbd_Close,
+    MWKbd_GetModifierInfo,
+    MWKbd_Read,
+    NULL
+};
+
+struct MW_UID_MESSAGE m_kbd = { 0 };
+struct MW_UID_MESSAGE m_mou = { 0 };
+
+
+static int mou_fd = -1;
+static int kbd_fd   = -1;
+
+static const char *Q_NAME        = "MWQ";
+#define            Q_MAX_MSGS      128
+#define            MOUSE_DEVICE    "/dev/mouse"
+
+
+/* Open and register driver */
+static int open_queue_and_register_driver( int fd )
+{
+   int rc;
+   rc = uid_open_queue( Q_NAME, O_CREAT | O_RDWR, Q_MAX_MSGS );
+   if( rc ) 
+   {
+      return rc;
+   }
+   return uid_register_device( fd, Q_NAME );
+}
+
+/* close and unregister device */
+static int close_queue_and_unregister_device( int fd )
+{
+    uid_unregister_device( fd );
+    return uid_close_queue();
+}  
+
+
+/*
+ * Open up the mouse device.
+ */
+static int
+MWMou_Open(MOUSEDEVICE *pmd)
+{
+   int rc;
+   /* no valid event */
+   m_mou.type = MV_UID_INVALID;
+   mou_fd = open( MOUSE_DEVICE, O_NONBLOCK );
+   /* Open your mouse device here */
+   rc = open_queue_and_register_driver( mou_fd );
+   if( rc )
+      return -1;
+   return 2;
+}
+
+/*
+ * Close the mouse device.
+ */
+static void
+MWMou_Close(void)
+{
+   close_queue_and_unregister_device( mou_fd );
+   close( mou_fd );
+}
+
+/*
+ * Get mouse buttons supported
+ */
+static int
+MWMou_GetButtonInfo(void)
+{
+   return 0;
+}
+
+/*
+ * Get default mouse acceleration settings
+ */
+static void
+MWMou_GetDefaultAccel(int *pscale,int *pthresh)
+{
+    *pscale = SCALE;
+    *pthresh = THRESH;
+}
+
+/*
+ * Attempt to read bytes from the mouse and interpret them.
+ * Returns -1 on error, 0 if either no bytes were read or not enough
+ * was read for a complete state, or 1 if the new state was read.
+ * When a new state is read, the current buttons and x and y deltas
+ * are returned.  This routine does not block.
+ */
+static int
+MWMou_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz, int *bp)
+{
+   /* check if a new mouse event has been posted */
+   if( m_mou.type != MV_UID_INVALID )
+   {
+      /* check which return to send up ... */
+      int rc = ( m_mou.type == MV_UID_REL_POS ) ? 1 : 2;
+
+      *bp = m_mou.m.pos.btns;
+      *dx = m_mou.m.pos.x;
+      *dy = m_mou.m.pos.y;
+      *dz = m_mou.m.pos.z;
+      /* consume event */
+      m_mou.type = MV_UID_INVALID;
+      return rc;
+   }
+   return 0;
+}
+
+
+
+/*
+ * Open the keyboard.
+ */
+static int
+MWKbd_Open(KBDDEVICE *pkd)
+{
+   int rc;
+   /* no valid event */
+   m_kbd.type = MV_UID_INVALID;
+  /* kbd it is already opened */
+   kbd_fd = fileno( stdin );
+   /* register kbd driver */
+   rc = open_queue_and_register_driver( kbd_fd );
+   if( rc )
+      return -1;
+   return 1;
+}
+
+/*
+ * Close the keyboard.
+ */
+static void
+MWKbd_Close(void)
+{
+}
+
+/*
+ * Return the possible modifiers for the keyboard.
+ */
+static  void
+MWKbd_GetModifierInfo(int *modifiers)
+{
+    *modifiers = 0;      /* no modifiers available */
+}
+
+/*
+ * This reads one keystroke from the keyboard, and the current state of
+ * the mode keys (ALT, SHIFT, CTRL).  Returns -1 on error, 0 if no data
+ * is ready, and 1 if data was read.  This is a non-blocking call.
+ */
+static int
+MWKbd_Read(MWUCHAR *buf, int *modifiers)
+{
+   /* check if new KBD event has been posted */
+   if( m_kbd.type != MV_UID_INVALID )
+   {
+      *buf = (UCHAR)m_kbd.m.kbd.code;
+/*    *modifiers = m_kbd.m.kbd.modifiers;  */
+      *modifiers = 0;
+
+      /* consume event */
+      m_kbd.type = MV_UID_INVALID;
+      return 1;
+   }
+    return 0;
+}
diff -urN lib/microwindows/src/drivers/int10_pc.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/int10_pc.c
--- lib/microwindows/src/drivers/int10_pc.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/int10_pc.c	2005-02-21 16:03:13.000000000 +0100
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2000 Victor Rogachev <rogach@sut.ru>
+ *
+ * Int10 function for PACIFIC C on MSDOS
+ */
+
+#include "device.h"
+#include "vgaplan4.h"
+
+/*
+**	Uses int 10 for graphics
+*/
+
+FARADDR 
+int10(int ax, int bx)
+{
+	union REGPACK reg;
+
+	reg.x.ax = ax;        
+	reg.x.bx = bx;        
+	intr(0x10, &reg);
+
+	return ((FARADDR) MK_FP(reg.x.es, reg.x.bp));
+}
diff -urN lib/microwindows/src/drivers/kbd_bios.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_bios.c
--- lib/microwindows/src/drivers/kbd_bios.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_bios.c	2005-02-21 16:03:14.000000000 +0100
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Keyboard Driver, PC bios version
+ */
+#include "device.h"
+
+static int  KBD_Open(KBDDEVICE *pkd);
+static void KBD_Close(void);
+static void KBD_GetModifierInfo(int *modifiers);
+static int  KBD_Read(MWUCHAR *buf, int *modifiers);
+static int	KBD_Poll(void);
+
+/* external routines in asmkbd.s*/
+extern int kbpoll(void);
+extern int kbread(void);
+extern int kbflags(void);
+
+KBDDEVICE kbddev = {
+	KBD_Open,
+	KBD_Close,
+	KBD_GetModifierInfo,
+	KBD_Read,
+	KBD_Poll
+};
+
+/*
+ * Open the keyboard.
+ */
+static int
+KBD_Open(KBDDEVICE *pkd)
+{
+	return 1;
+
+}
+
+/*
+ * Close the keyboard.
+ */
+static void
+KBD_Close(void)
+{
+}
+
+/*
+ * Return the possible modifiers for the keyboard.
+ */
+static  void
+KBD_GetModifierInfo(int *modifiers)
+{
+	*modifiers = 0;			/* no modifiers available */
+}
+
+/*
+ * This reads one keystroke from the keyboard, and the current state of
+ * the mode keys (ALT, SHIFT, CTRL).  Returns -1 on error, 0 if no data
+ * is ready, and 1 if data was read.  This is a non-blocking call.
+ */
+static int
+KBD_Read(MWUCHAR *buf, int *modifiers)
+{
+	/* wait until a char is ready*/
+	if(!kbpoll())
+		return 0;
+
+	/* read keyboard shift status*/
+	*modifiers = kbflags();
+
+	/* read keyboard character*/
+	*buf = kbread();
+
+	if(*buf == 0x1b)			/* special case ESC*/
+		return -2;
+	return 1;
+}
+
+static int
+KBD_Poll(void)
+{
+	return kbpoll();
+}
diff -urN lib/microwindows/src/drivers/kbd_djgr.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_djgr.c
--- lib/microwindows/src/drivers/kbd_djgr.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_djgr.c	2005-02-21 16:03:14.000000000 +0100
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Copyright (c) 1999 Victor Rogachev <rogach@sut.ru>
+ *
+ * Keyboard Driver, DOS & DJGPP & GRX version
+ */
+
+#include "device.h"
+
+#include <bios.h>
+
+
+static int  KBD_Open(KBDDEVICE *pkd);
+static void KBD_Close(void);
+static void KBD_GetModifierInfo(int *modifiers);
+static int  KBD_Read(MWUCHAR *buf, int *modifiers);
+static int	KBD_Poll(void);
+
+
+KBDDEVICE kbddev = {
+	KBD_Open,
+	KBD_Close,
+	KBD_GetModifierInfo,
+	KBD_Read,
+	KBD_Poll
+};
+
+
+/*
+ * Open the keyboard.
+ */
+static int
+KBD_Open(KBDDEVICE *pkd)
+{
+	return 1;
+
+}
+
+/*
+ * Close the keyboard.
+ */
+static void
+KBD_Close(void)
+{
+}
+
+/*
+ * Return the possible modifiers for the keyboard.
+ */
+static  void
+KBD_GetModifierInfo(int *modifiers)
+{
+	*modifiers = bioskey(2);
+}
+
+/*
+ * This reads one keystroke from the keyboard, and the current state of
+ * the mode keys (ALT, SHIFT, CTRL).  Returns -1 on error, 0 if no data
+ * is ready, and 1 if data was read.  This is a non-blocking call.
+ */
+static int
+KBD_Read(MWUCHAR *buf, int *modifiers)
+{
+	/* wait until a char is ready*/
+	if(!bioskey(1))
+		return 0;
+
+	/* read keyboard shift status*/
+	*modifiers = bioskey(2);
+
+	/* read keyboard character*/
+	*buf = bioskey(0);
+
+	if(*buf == 0x1b)	/* special case ESC*/
+		return -2;
+	return 1;
+}
+
+/*
+**
+*/
+static int
+KBD_Poll(void)
+{
+	if (bioskey(1)==0)
+	  return 0;
+	else
+	  return 1;
+}
+
diff -urN lib/microwindows/src/drivers/kbd_fbsd.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_fbsd.c
--- lib/microwindows/src/drivers/kbd_fbsd.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_fbsd.c	2005-02-21 16:03:14.000000000 +0100
@@ -0,0 +1,122 @@
+#include <sys/time.h>
+#include <machine/console.h>
+#include <vgl.h>
+
+#include "device.h"
+
+#define KBLEN		30
+unsigned short kbuffer[KBLEN];
+unsigned short klen=0;
+int states[256];
+
+const int quertycodes[48+1]={41, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,\
+			  16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 43,\
+			  30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 44, 45,\
+			  46, 47, 48, 49, 50, 51, 52, 53, 57, 0};
+const char chars[48] =    {'`','1','2','3','4','5','6','7','8','9','0','-','=',\
+			 'q','w','e','r','t','y','u','i','o','p','[',']','\\',\
+			 'a','s','d','f','g','h','j','k','l',';','\'','z','x',\
+			 'c','v','b','n','m',',','.','/',' '};
+
+
+static int initkeyb(KBDDEVICE *pkd);
+static void restorekeyb(void);
+static  void TTY_GetModifierInfo(int *modifiers);
+static int getkey(MWUCHAR *buf, int *modifiers);
+static int kbhit(void);
+
+KBDDEVICE kbddev = {
+  initkeyb,
+  restorekeyb,
+  TTY_GetModifierInfo,
+  getkey,
+  kbhit
+};
+
+/*
+ * Return the possible modifiers for the keyboard.
+ */
+
+static  void TTY_GetModifierInfo(int *modifiers)
+{
+	*modifiers = 0;			/* no modifiers available */
+}
+
+static int initkeyb(KBDDEVICE *pkd)
+{
+	VGLKeyboardInit(VGL_CODEKEYS);
+	memset(states, FALSE, (sizeof states));
+	return(0);
+
+}
+
+static void restorekeyb(void)
+{
+	VGLKeyboardEnd();
+}
+
+void ProcessKbd(void)
+{
+	unsigned short result, i;
+	int isasymbol;
+	int state;
+
+	while((result = VGLKeyboardGetCh()) != 0) {
+
+		if(result < 128)
+			state = TRUE;
+		else {
+			state = FALSE;
+			result -= 128;
+		}
+
+		isasymbol = FALSE;
+		for(i=0;quertycodes[i]!=0;i++)
+			if(result == quertycodes[i]) {
+				result = chars[i];
+				isasymbol = TRUE;
+				break;
+			}
+
+		if (isasymbol == FALSE)
+			result+=128;
+
+		states[result] = state;
+
+		if(state == TRUE)
+			continue;
+
+		if(klen == KBLEN) /* Buffer is full, drop some pieces */
+			memcpy(kbuffer, kbuffer + 1, --klen);
+		kbuffer[klen++] = result;
+	}
+}
+
+int GetAsyncKeyState(int key)
+{
+	ProcessKbd();
+	return(states[key]);
+}
+
+static int getkey(MWUCHAR *buf, int *modifiers)
+{
+	MWUCHAR result;
+	
+	while(kbhit() != TRUE);
+	result = kbuffer[0];
+	memcpy(kbuffer, kbuffer + 1, --klen);
+
+	*buf=result;
+	return(0);
+}
+
+static int kbhit(void)
+{
+	ProcessKbd();
+
+	if (klen > 0)
+		return(1);
+	else
+		return(0);
+}
+
diff -urN lib/microwindows/src/drivers/kbd_ipaq.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_ipaq.c
--- lib/microwindows/src/drivers/kbd_ipaq.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_ipaq.c	2005-02-21 16:13:07.000000000 +0100
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2000 Century Software Embedded Technologies
+ * Written by Jordan Crouse
+ *
+ * Microwindows keyboard driver for Compaq iPAQ
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include "device.h"
+
+#define IPAQ_SCANCODE_RECORD    129
+#define IPAQ_SCANCODE_CALENDAR  130
+#define IPAQ_SCANCODE_CONTACTS 131
+#define IPAQ_SCANCODE_Q        132
+#define IPAQ_SCANCODE_START    133
+#define IPAQ_SCANCODE_UP       134 /* keycode up */
+#define IPAQ_SCANCODE_RIGHT    135 /* keycode right */
+#define IPAQ_SCANCODE_LEFT     136 /* keycode left */
+#define IPAQ_SCANCODE_DOWN     137 /* keycode down */
+
+#define KEYBOARD "/dev/h3600_key"
+
+static int  IPAQ_Open(KBDDEVICE *pkd);
+static void IPAQ_Close(void);
+static void IPAQ_GetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers);
+static int  IPAQ_Read(MWKEY *kbuf, MWKEYMOD *modifiers, MWSCANCODE *scancode);
+
+KBDDEVICE kbddev = {
+	IPAQ_Open,
+	IPAQ_Close,
+	IPAQ_GetModifierInfo,
+	IPAQ_Read,
+	NULL
+};
+
+static int fd;
+
+/* From the kernel - this maps a single index into */
+/* the correct scancode */
+
+static unsigned char scancodes[] = {
+        0, /* unused */
+        IPAQ_SCANCODE_RECORD, /* 1 -> record button */
+        IPAQ_SCANCODE_CALENDAR, /* 2 -> calendar */
+        IPAQ_SCANCODE_CONTACTS, /* 3 -> contact */
+        IPAQ_SCANCODE_Q, /* 4 -> Q button */
+        IPAQ_SCANCODE_START, /* 5 -> start menu */
+        IPAQ_SCANCODE_UP, /* 6 -> up */
+        IPAQ_SCANCODE_RIGHT, /* 7 -> right */
+        IPAQ_SCANCODE_LEFT, /* 8 -> left */
+        IPAQ_SCANCODE_DOWN, /* 9 -> down */
+};
+
+
+static int IPAQ_Open(KBDDEVICE *pkd)
+{
+  /* Open the keyboard and get it ready for use */
+  fd = open(KEYBOARD, O_NONBLOCK);
+
+  if (fd < 0)
+    return - 1;
+  
+  return(fd);
+}
+
+static void IPAQ_Close(void)
+{
+  close(fd);
+  fd = 0;
+}
+
+static void IPAQ_GetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers)
+{
+  if (modifiers)
+    *modifiers = 0;			/* no modifiers available */
+  if (curmodifiers)
+    *curmodifiers = 0;
+}
+
+
+static int IPAQ_Read(MWKEY *kbuf, MWKEYMOD *modifiers, MWSCANCODE *scancode)
+{
+  int keydown = 0;
+  int cc = 0;
+  char buf[1];
+
+  cc = read(fd, &buf, 1);
+
+  if (cc < 0)
+    {
+      if ((errno != EINTR) && (errno != EAGAIN) && (errno != EINVAL))
+	{
+	  perror("IPAQ KEY");
+	   return(-1);
+	}
+      else
+	{
+	  return(0);
+	}
+    }
+  if (cc == 0)
+    return(0);
+
+  /* If the code is less than 127, then we know that */
+  /* we have a key down.  Figure out what we've got */
+
+  *modifiers = 0;
+
+  if (*buf < 127)
+    {
+      keydown = 1; /* Key pressed but not released */
+
+      if (*buf > 9)
+	return(0);
+
+      *scancode = scancodes[(int) *buf];
+    }
+  else
+    {
+      keydown = 2; /* key released */
+      *scancode = *buf;
+    }
+  
+  switch(*scancode)
+    {
+    case IPAQ_SCANCODE_RECORD:
+      *kbuf = MWKEY_RECORD;
+      break;
+
+    case IPAQ_SCANCODE_CALENDAR:
+      *kbuf = MWKEY_APP1;
+      break;
+      
+    case IPAQ_SCANCODE_CONTACTS:
+      *kbuf = MWKEY_APP2;
+      break;
+
+    case IPAQ_SCANCODE_Q:
+      *kbuf = MWKEY_MENU;
+      break;
+
+    case IPAQ_SCANCODE_START:
+      *kbuf = MWKEY_LAST;
+      break;
+      
+    case IPAQ_SCANCODE_UP:
+      *kbuf = MWKEY_UP;
+      break;
+
+    case IPAQ_SCANCODE_DOWN:
+      *kbuf = MWKEY_DOWN;
+      break;
+
+    case IPAQ_SCANCODE_LEFT:
+      *kbuf = MWKEY_LEFT;
+      break;
+      
+    case IPAQ_SCANCODE_RIGHT:
+      *kbuf = MWKEY_RIGHT;
+      break;
+
+    default:
+      printf("Ipaq - Unknown scancode %d\n", *scancode);
+      return(0);
+    }
+
+  return(keydown);
+}
diff -urN lib/microwindows/src/drivers/kbd_null.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_null.c
--- lib/microwindows/src/drivers/kbd_null.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_null.c	2005-02-21 16:13:07.000000000 +0100
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Null Keyboard Driver
+ */
+#include <stdio.h>
+#include "device.h"
+
+static int  NUL_Open(KBDDEVICE *pkd);
+static void NUL_Close(void);
+static void NUL_GetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers);
+static int  NUL_Read(MWUCHAR *buf, MWKEYMOD *modifiers, MWSCANCODE *scancode);
+static int  NUL_Poll(void);
+
+KBDDEVICE kbddev = {
+	NUL_Open,
+	NUL_Close,
+	NUL_GetModifierInfo,
+	NUL_Read,
+	NUL_Poll
+};
+
+/*
+ * Poll for keyboard events
+ */
+static int
+NUL_Poll(void)
+{
+	return 0;
+}
+
+/*
+ * Open the keyboard.
+ */
+static int
+NUL_Open(KBDDEVICE *pkd)
+{
+	return -2;	/* no kbd*/
+}
+
+/*
+ * Close the keyboard.
+ */
+static void
+NUL_Close(void)
+{
+}
+
+/*
+ * Return the possible modifiers for the keyboard.
+ */
+static  void
+NUL_GetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers)
+{
+	if (modifiers)
+		*modifiers = 0;		/* no modifiers available */
+	if (curmodifiers)
+		*curmodifiers = 0;
+}
+
+/*
+ * This reads one keystroke from the keyboard, and the current state of
+ * the modifier keys (ALT, SHIFT, etc).  Returns -1 on error, 0 if no data
+ * is ready, 1 on a keypress, and 2 on keyrelease.
+ * This is a non-blocking call.
+ */
+static int
+NUL_Read(MWUCHAR *buf, MWKEYMOD *modifiers, MWSCANCODE *scancode)
+{
+	return 0;
+}
diff -urN lib/microwindows/src/drivers/kbd_pac.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_pac.c
--- lib/microwindows/src/drivers/kbd_pac.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_pac.c	2005-02-21 16:03:14.000000000 +0100
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Copyright (c) 2000 Victor Rogachev <rogach@sut.ru>
+ *
+ * Keyboard Driver, using BIOS for PACIFIC C on MSDOS
+ */
+
+#include "device.h"
+#include <dos.h>
+#include <conio.h>
+ 
+
+static int  KBD_Open(KBDDEVICE *pkd);
+static void KBD_Close(void);
+static void KBD_GetModifierInfo(int *modifiers);
+static int  KBD_Read(MWUCHAR *buf, int *modifiers);
+static int  KBD_Poll(void);
+
+
+KBDDEVICE kbddev = {
+	KBD_Open,
+	KBD_Close,
+	KBD_GetModifierInfo,
+	KBD_Read,
+	KBD_Poll
+};
+
+
+/*
+ * Open the keyboard
+ */
+static int
+KBD_Open(KBDDEVICE *pkd)
+{
+	return 1;
+}
+
+/*
+ * Close the keyboard.
+ */
+static void
+KBD_Close(void)
+{
+}
+
+/*
+ * Return the possible modifiers for the keyboard.
+ */
+static  void
+KBD_GetModifierInfo(int *modifiers)
+{
+	*modifiers = 0;			/* no modifiers available */
+}
+
+/*
+ * This reads one keystroke from the keyboard, and the current state of
+ * the mode keys (ALT, SHIFT, CTRL).  Returns -1 on error, 0 if no data
+ * is ready, and 1 if data was read.  This is a non-blocking call.
+ */
+static int
+KBD_Read(MWUCHAR *buf, int *modifiers)
+{
+        union REGS 	reg;
+
+	/* wait until a char is ready*/
+	if (!kbhit())
+		return 0;
+
+	/* read keyboard shift status*/
+	reg.x.ax = 0x0200;
+	int86(0x16, &reg, &reg);
+	*modifiers = reg.x.ax;
+
+	/* read keyboard character*/
+	reg.x.ax = 0x1000;
+	int86(0x16, &reg, &reg);
+	*buf = (reg.x.ax & 0x00ff);
+
+	if(*buf == 0x1b)	/* special case ESC*/
+		return -2;
+	return 1;
+}
+
+/*
+**      Poll keyboard for char ready
+*/
+static int
+KBD_Poll(void)
+{
+	if (kbhit())
+		return 1;
+	else
+        	return 0;
+}
+
diff -urN lib/microwindows/src/drivers/kbd_pipe.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_pipe.c
--- lib/microwindows/src/drivers/kbd_pipe.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_pipe.c	2005-02-21 16:13:08.000000000 +0100
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2000 by VTech Informations LTD.
+ *
+ * This source code is released under MPL
+ * 
+ * Vladimir Cotfas <vladimircotfas@vtech.ca> Aug 31, 2000
+ *
+ * Named pipe Keyboard Driver for Microwindows
+ * See src/demos/nxkbd/srvconn.c for example client-side driver
+ */
+#include <stdio.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include "device.h"
+
+static char kbdName[] = "/tmp/.nano-X-softkbd";
+#define KBD_NAMED_PIPE	kbdName	
+
+#define _SOFT_DEBUG	0
+
+static int kbd_fd = -1; /* keyboar driver FIFO */
+
+static int  soft_Open(KBDDEVICE* pkd);
+static void soft_Close();
+static void soft_GetModifierInfo(int* modifiers);
+static int  soft_Read(MWUCHAR* buf, int* modifiers);
+
+KBDDEVICE kbddev = {
+    soft_Open,
+    soft_Close,
+    soft_GetModifierInfo,
+    soft_Read,
+    NULL
+};
+
+/*
+ * Open the keyboard.
+ */
+static int
+soft_Open(KBDDEVICE* pkd)
+{
+        struct stat s;
+
+        /* Check if the file already exists: */
+        if (!stat(KBD_NAMED_PIPE, &s)) {
+                if (unlink(KBD_NAMED_PIPE) < 0)
+                        return -1;
+        }
+	if (mkfifo(KBD_NAMED_PIPE, 0600) < 0) {
+		EPRINTF("mkfifo() error %d ('%s')\n", \
+			errno, sys_errlist[errno]);
+		return -1;
+	}
+
+        /* Open the named pipe */
+        if ((kbd_fd = open(KBD_NAMED_PIPE, O_RDONLY | O_NONBLOCK)) < 0) {
+		EPRINTF("open() error %d ('%s')\n", \
+			errno, sys_errlist[errno]);
+                return -1;
+	}
+	
+    	return kbd_fd;
+}
+
+/*
+ * Close the keyboard.
+ */
+static void
+soft_Close()
+{
+#if _SOFT_DEBUG
+    EPRINTF("kbd_soft.c: soft_Close(): closing named pipe %d\n", kbd_fd);
+#endif
+    if (kbd_fd >= 0)
+	    close(kbd_fd);
+    kbd_fd = -1;
+
+    unlink(KBD_NAMED_PIPE);
+}
+
+/*
+ * Return the possible modifiers for the keyboard.
+ */
+static  void
+soft_GetModifierInfo(int* modifiers)
+{
+#if _SOFT_DEBUG
+    EPRINTF("kbd_soft.c: soft_GetModifierInfo(): being asked about modifiers\n");
+#endif
+    *modifiers = 0;			/* no modifiers available */
+}
+
+/*
+ * This reads one keystroke from the keyboard, and the current state of
+ * the mode keys (ALT, SHIFT, CTRL).  Returns -1 on error, 0 if no data
+ * is ready, and 1 if data was read.  This is a non-blocking call.
+ */
+
+static int
+soft_Read(MWUCHAR* buf, int* modifiers)
+{
+    int cc;
+    *modifiers = 0;         /* no modifiers yet */
+
+    cc = read(kbd_fd, buf, 1); /* this is NON BLOCKING read */
+
+    if (cc > 0) {
+	if(*buf == 0x1b)
+	      return -2;      /* special case ESC*/
+#if _SOFT_DEBUG
+    	EPRINTF("kbd_soft.c: soft_Read(): read '%c', cc = %d\n", 
+	        buf[0], cc); 
+	fflush(NULL);
+#endif
+	return 1;
+    }
+
+    return 0;
+}
diff -urN lib/microwindows/src/drivers/kbd_tc.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_tc.c
--- lib/microwindows/src/drivers/kbd_tc.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_tc.c	2005-02-21 16:03:14.000000000 +0100
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Copyright (c) 2000 Victor Larionov, Victor Rogachev <rogach@sut.ru>
+ *
+ * Keyboard Driver, TURBO C version
+ */
+
+#include "device.h"
+#include <bios.h>
+
+static int  KBD_Open(KBDDEVICE *pkd);
+static void KBD_Close(void);
+static void KBD_GetModifierInfo(int *modifiers);
+static int  KBD_Read(MWUCHAR *buf, int *modifiers);
+static int  KBD_Poll(void);
+
+KBDDEVICE kbddev = {
+	KBD_Open,
+	KBD_Close,
+	KBD_GetModifierInfo,
+	KBD_Read,
+	KBD_Poll
+};
+
+/*
+ * Open the keyboard.
+ */
+static int
+KBD_Open(KBDDEVICE *pkd)
+{
+	return 1;
+}
+
+/*
+ * Close the keyboard.
+ */
+static void
+KBD_Close(void)
+{
+}
+
+/*
+ * Return the possible modifiers for the keyboard.
+ */
+static  void
+KBD_GetModifierInfo(int *modifiers)
+{
+	*modifiers = bioskey(2);		/* no modifiers available */
+}
+
+/*
+ * This reads one keystroke from the keyboard, and the current state of
+ * the mode keys (ALT, SHIFT, CTRL).  Returns -1 on error, 0 if no data
+ * is ready, and 1 if data was read.  This is a non-blocking call.
+ */
+static int
+KBD_Read(MWUCHAR *buf, int *modifiers)
+{
+	/* wait until a char is ready*/
+	if(!bioskey(1))
+		return 0;
+
+	/* read keyboard shift status*/
+	*modifiers = bioskey(2);
+
+	/* read keyboard character*/
+	*buf = bioskey(0);
+
+	if(*buf == 0x1b)			/* special case ESC*/
+		return -2;
+	return 1;
+}
+
+static int
+KBD_Poll(void)
+{
+	if (bioskey(1)!=0)
+	  return 1;
+	else
+	  return 0;
+}
diff -urN lib/microwindows/src/drivers/kbd_tty.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_tty.c
--- lib/microwindows/src/drivers/kbd_tty.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_tty.c	2005-02-21 16:13:08.000000000 +0100
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * /dev/tty TTY Keyboard Driver
+ */
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <termios.h>
+#include "device.h"
+
+#if ELKS
+#define	KEYBOARD	"/dev/tty1"	/* keyboard associated with screen*/
+#else
+#define	KEYBOARD	"/dev/tty"	/* keyboard associated with screen*/
+#endif
+
+extern int escape_quits;
+
+static int  TTY_Open(KBDDEVICE *pkd);
+static void TTY_Close(void);
+static void TTY_GetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers);
+static int  TTY_Read(MWKEY *kbuf, MWKEYMOD *modifiers, MWSCANCODE *scancode);
+static int  TTY_Poll(void);
+
+KBDDEVICE kbddev = {
+	TTY_Open,
+	TTY_Close,
+	TTY_GetModifierInfo,
+	TTY_Read,
+#if _MINIX
+	TTY_Poll,
+#else
+	NULL
+#endif
+};
+
+static	int		fd;		/* file descriptor for keyboard */
+static	struct termios	old;		/* original terminal modes */
+
+/*
+ * Open the keyboard.
+ * This is real simple, we just use a special file handle
+ * that allows non-blocking I/O, and put the terminal into
+ * character mode.
+ */
+static int
+TTY_Open(KBDDEVICE *pkd)
+{
+	struct termios	new;	/* new terminal modes */
+
+	fd = open(KEYBOARD, O_NONBLOCK);
+	if (fd < 0)
+		return -1;
+
+	if (tcgetattr(fd, &old) < 0)
+		goto err;
+
+	new = old;
+	/* If you uncomment ISIG and BRKINT below, then ^C will be ignored.*/
+	new.c_lflag &= ~(ECHO | ICANON | IEXTEN /*| ISIG*/);
+	new.c_iflag &= ~(ICRNL | INPCK | ISTRIP | IXON /*| BRKINT*/);
+	new.c_cflag &= ~(CSIZE | PARENB);
+	new.c_cflag |= CS8;
+	new.c_cc[VMIN] = 0;
+	new.c_cc[VTIME] = 0;
+
+	if(tcsetattr(fd, TCSAFLUSH, &new) < 0)
+		goto err;
+	return fd;
+
+err:
+	close(fd);
+	fd = 0;
+	return -1;
+}
+
+/*
+ * Close the keyboard.
+ * This resets the terminal modes.
+ */
+static void
+TTY_Close(void)
+{
+	tcsetattr(fd, TCSANOW, &old);
+	close(fd);
+	fd = 0;
+}
+
+/*
+ * Return the possible modifiers for the keyboard.
+ */
+static  void
+TTY_GetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers)
+{
+	if (modifiers)
+		*modifiers = 0;		/* no modifiers available */
+	if (curmodifiers)
+		*curmodifiers = 0;
+}
+
+/*
+ * This reads one keystroke from the keyboard, and the current state of
+ * the modifier keys (ALT, SHIFT, etc).  Returns -1 on error, 0 if no data
+ * is ready, 1 on a keypress, and 2 on keyrelease.
+ * This is a non-blocking call.
+ */
+static int
+TTY_Read(MWKEY *kbuf, MWKEYMOD *modifiers, MWSCANCODE *scancode)
+{
+	int	cc;			/* characters read */
+	MWKEY	mwkey;
+	unsigned char buf[1];
+
+	cc = read(fd, buf, 1);
+	if (cc > 0) {
+		mwkey = buf[0];
+		if (mwkey == 27 && escape_quits)	/* ESC -> quit*/
+			mwkey = MWKEY_QUIT;
+		else if (mwkey == ('P'&0x1f))		/* ^P -> print*/
+			mwkey = MWKEY_PRINT;
+
+		*kbuf = mwkey;		/* no translation*/
+		*modifiers = 0;		/* no modifiers*/
+		*scancode = 0;		/* no scancode*/
+		return 1;		/* keypress*/
+	}
+	if ((cc < 0) && (errno != EINTR) && (errno != EAGAIN)) {
+		return -1;
+	}
+	return 0;
+}
+
+static int
+TTY_Poll(void)
+{
+	return 1;	/* used by _MINIX only*/
+}
diff -urN lib/microwindows/src/drivers/kbd_ttyscan.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_ttyscan.c
--- lib/microwindows/src/drivers/kbd_ttyscan.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_ttyscan.c	2005-02-21 16:13:08.000000000 +0100
@@ -0,0 +1,515 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Microwindows /dev/tty console scancode keyboard driver for Linux
+ */
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+#include <linux/keyboard.h>
+#include <linux/kd.h>
+#include <linux/vt.h>
+#include "device.h"
+#include "fb.h"
+
+#define KEYBOARD	"/dev/tty"	/* console kbd to open*/
+
+static int  TTY_Open(KBDDEVICE *pkd);
+static void TTY_Close(void);
+static void TTY_GetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers);
+static int  TTY_Read(MWKEY *kbuf, MWKEYMOD *modifiers, MWSCANCODE *scancode);
+
+KBDDEVICE kbddev = {
+	TTY_Open,
+	TTY_Close,
+	TTY_GetModifierInfo,
+	TTY_Read,
+	NULL
+};
+
+#define RELEASED	0
+#define PRESSED		1
+
+static	int		fd;		/* file descriptor for keyboard */
+static	struct termios	old;		/* original terminal modes */
+static  int 		old_kbd_mode;
+static unsigned char 	key_state[MWKEY_LAST];	//FIXME - make sparse array
+static MWKEYMOD 	key_modstate;
+
+/* kernel unicode tables per shiftstate and scancode*/
+#define NUM_VGAKEYMAPS	(1<<KG_CAPSSHIFT)	/* kernel key maps*/
+static unsigned short	os_keymap[NUM_VGAKEYMAPS][NR_KEYS];
+
+/* PC scancode -> Microwindows key value mapping for non-Linux kernel values*/
+static MWKEY		keymap[128] = {
+MWKEY_UNKNOWN, MWKEY_ESCAPE, '1', '2', '3',				/* 0*/
+'4', '5', '6', '7', '8',						/* 5*/
+'9', '0', '-', '=', MWKEY_BACKSPACE,					/* 10*/
+MWKEY_TAB, 'q', 'w', 'e', 'r',						/* 15*/
+'t', 'y', 'u', 'i', 'o',						/* 20*/
+'o', '[', ']', MWKEY_ENTER, MWKEY_LCTRL,				/* 25*/
+'a', 's', 'd', 'f', 'g',						/* 30*/
+'h', 'j', 'k', 'l', ';',						/* 35*/
+'\'', '`', MWKEY_LSHIFT, '\\', 'z',					/* 40*/
+'x', 'c', 'v', 'b', 'n',						/* 45*/
+'m', ',', '.', '/', MWKEY_RSHIFT,					/* 50*/
+MWKEY_KP_MULTIPLY, MWKEY_LALT, ' ', MWKEY_CAPSLOCK, MWKEY_F1, 		/* 55*/
+MWKEY_F2, MWKEY_F3, MWKEY_F4, MWKEY_F5, MWKEY_F6, 			/* 60*/
+MWKEY_F7, MWKEY_F8, MWKEY_F9, MWKEY_F10, MWKEY_NUMLOCK, 		/* 65*/
+MWKEY_SCROLLOCK, MWKEY_KP7, MWKEY_KP8, MWKEY_KP9, MWKEY_KP_MINUS,	/* 70*/
+MWKEY_KP4, MWKEY_KP5, MWKEY_KP6, MWKEY_KP_PLUS, MWKEY_KP1, 		/* 75*/
+MWKEY_KP2, MWKEY_KP3, MWKEY_KP0, MWKEY_KP_PERIOD, MWKEY_UNKNOWN, 	/* 80*/
+MWKEY_UNKNOWN, MWKEY_UNKNOWN, MWKEY_F11, MWKEY_F12, MWKEY_UNKNOWN,	/* 85*/
+MWKEY_UNKNOWN,MWKEY_UNKNOWN,MWKEY_UNKNOWN,MWKEY_UNKNOWN,MWKEY_UNKNOWN,	/* 90*/
+MWKEY_UNKNOWN, MWKEY_KP_ENTER, MWKEY_RCTRL, MWKEY_KP_DIVIDE,MWKEY_PRINT,/* 95*/
+MWKEY_RALT, MWKEY_BREAK, MWKEY_HOME, MWKEY_UP, MWKEY_PAGEUP,		/* 100*/
+MWKEY_LEFT, MWKEY_RIGHT, MWKEY_END, MWKEY_DOWN, MWKEY_PAGEDOWN,		/* 105*/
+MWKEY_INSERT, MWKEY_DELETE, MWKEY_UNKNOWN,MWKEY_UNKNOWN,MWKEY_UNKNOWN,	/* 110*/
+MWKEY_UNKNOWN,MWKEY_UNKNOWN,MWKEY_UNKNOWN,MWKEY_UNKNOWN,MWKEY_PAUSE,	/* 115*/
+MWKEY_UNKNOWN,MWKEY_UNKNOWN,MWKEY_UNKNOWN,MWKEY_UNKNOWN,MWKEY_UNKNOWN,	/* 120*/
+MWKEY_LMETA, MWKEY_RMETA, MWKEY_MENU					/* 125*/
+};
+
+static MWBOOL	UpdateKeyState(int pressed, MWKEY mwkey);
+static void	UpdateLEDState(MWKEYMOD modstate);
+static MWKEY	TranslateScancode(int scancode, MWKEYMOD modstate);
+static void	LoadKernelKeymaps(int fd);
+static MWBOOL	switch_vt(unsigned short which);
+
+/*
+ * Open the keyboard.
+ * This is real simple, we just use a special file handle
+ * that allows non-blocking I/O, and put the terminal into
+ * character mode.
+ */
+static int
+TTY_Open(KBDDEVICE *pkd)
+{
+	int		i;
+	int		ledstate = 0;
+	struct termios	new;
+
+	/* Open /dev/tty device*/
+	fd = open(KEYBOARD, O_NONBLOCK);
+	if (fd < 0)
+		return -1;
+
+	/* Save previous settings*/
+	if (ioctl(fd, KDGKBMODE, &old_kbd_mode) < 0) {
+		perror("KDGKMODE");
+		goto err;
+	}
+	if (tcgetattr(fd, &old) < 0)
+		goto err;
+
+	/* Set medium-raw keyboard mode */
+	new = old;
+	/* ISIG and BRKINT must be set otherwise '2' is ^C (scancode 3)!!*/
+	new.c_lflag &= ~(ICANON | ECHO | ISIG);
+	new.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | IXOFF | IXON 
+			| BRKINT);
+	new.c_cc[VMIN] = 0;
+	new.c_cc[VTIME] = 0;
+
+	if (tcsetattr(fd, TCSAFLUSH, &new) < 0) {
+		TTY_Close();
+		return -1;
+	}
+	if (ioctl(fd, KDSKBMODE, K_MEDIUMRAW) < 0) {
+		TTY_Close();
+		return -1;
+	}
+
+	/* Load OS keymappings*/
+	LoadKernelKeymaps(fd);
+
+	/* Initialize keyboard state*/
+	key_modstate = MWKMOD_NONE;
+	for (i=0; i<MWKEY_LAST; ++i)
+		key_state[i] = RELEASED;
+	
+	/* preset CAPSLOCK and NUMLOCK from startup LED state*/
+	if (ioctl(fd, KDGETLED, &ledstate) == 0) {
+		if (ledstate & LED_CAP) {
+			key_modstate |= MWKMOD_CAPS;
+			key_state[MWKEY_CAPSLOCK] = PRESSED;
+		}
+		if (ledstate & LED_NUM) {
+			key_modstate |= MWKMOD_NUM;
+			key_state[MWKEY_NUMLOCK] = PRESSED;
+		}
+	}
+	UpdateLEDState(key_modstate);
+
+	return fd;
+
+err:
+	close(fd);
+	fd = -1;
+	return -1;
+}
+
+/*
+ * Close the keyboard.
+ * This resets the terminal modes.
+ */
+static void
+TTY_Close(void)
+{
+	int	ledstate = 0x80000000L;
+
+	if (fd >= 0) {
+		/* revert LEDs to follow key modifiers*/
+		if (ioctl(fd, KDSETLED, ledstate) < 0)
+			perror("KDSETLED");
+
+		/* reset terminal mode*/
+		if (ioctl(fd, KDSKBMODE, old_kbd_mode) < 0)
+			perror("KDSKBMODE");
+		tcsetattr(fd, TCSAFLUSH, &old);
+
+		close(fd);
+	}
+	fd = -1;
+}
+
+/*
+ * Return the possible modifiers and current modifiers for the keyboard.
+ */
+static  void
+TTY_GetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers)
+{
+	if (modifiers)
+		*modifiers = MWKMOD_CTRL | MWKMOD_SHIFT | MWKMOD_ALT |
+			MWKMOD_META | MWKMOD_ALTGR | MWKMOD_CAPS | MWKMOD_NUM;
+	if (curmodifiers)
+		*curmodifiers = key_modstate;
+}
+
+/*
+ * This reads one keystroke from the keyboard, and the current state of
+ * the modifier keys (ALT, SHIFT, etc).  Returns -1 on error, 0 if no data
+ * is ready, 1 on a keypress, and 2 on keyrelease.
+ * This is a non-blocking call.
+ */
+static int
+TTY_Read(MWKEY *kbuf, MWKEYMOD *modifiers, MWSCANCODE *pscancode)
+{
+	int	cc;			/* characters read */
+	int 	pressed;
+	int 	scancode;
+	MWKEY	mwkey;
+	unsigned char buf[128];
+
+	cc = read(fd, buf, 1);
+	if (cc > 0) {
+//printf("scan %02x (%d)\n", *buf & 0xff, *buf&0xff);
+		pressed = (*buf & 0x80)? RELEASED: PRESSED;
+		scancode = *buf & 0x7f;
+		mwkey = keymap[scancode];
+
+		/* Handle Alt-FN for vt switch */
+		switch (mwkey) {
+		case MWKEY_F1:
+		case MWKEY_F2:
+		case MWKEY_F3:
+		case MWKEY_F4:
+		case MWKEY_F5:
+		case MWKEY_F6:
+		case MWKEY_F7:
+		case MWKEY_F8:
+		case MWKEY_F9:
+		case MWKEY_F10:
+		case MWKEY_F11:
+		case MWKEY_F12:
+			if (key_modstate & MWKMOD_ALT) {
+				if (switch_vt(mwkey-MWKEY_F1+1)) {
+					mwkey = MWKEY_REDRAW;
+					goto returnkey;
+				}
+			}
+			/* Fall through to normal processing */
+		default:
+			/* update internal key states*/
+			if (!UpdateKeyState(pressed, mwkey))
+				return 0;
+
+			/* translate scancode to key value*/
+			mwkey = TranslateScancode(scancode, key_modstate);
+
+			if (mwkey) {
+returnkey:
+				*kbuf = mwkey;
+				*modifiers = key_modstate;
+				*pscancode = scancode;
+				return pressed? 1: 2;
+			}
+			return 0;
+		}
+	}
+
+	if ((cc < 0) && (errno != EINTR) && (errno != EAGAIN))
+		return -1;
+	return 0;
+}
+
+/* Update the internal keyboard state, return TRUE if changed*/
+static MWBOOL
+UpdateKeyState(int pressed, MWKEY mwkey)
+{
+	MWKEYMOD modstate = key_modstate;
+
+//printf("UpdateKeyState %d %d\n", pressed, mwkey);
+	if (pressed == PRESSED) {
+		switch (mwkey) {
+		case MWKEY_NUMLOCK:
+		case MWKEY_CAPSLOCK:
+			/* change state on release because of auto-repeat*/
+			return FALSE;
+		case MWKEY_LCTRL:
+			modstate |= MWKMOD_LCTRL;
+			break;
+		case MWKEY_RCTRL:
+			modstate |= MWKMOD_RCTRL;
+			break;
+		case MWKEY_LSHIFT:
+			modstate |= MWKMOD_LSHIFT;
+			break;
+		case MWKEY_RSHIFT:
+			modstate |= MWKMOD_RSHIFT;
+			break;
+		case MWKEY_LALT:
+			modstate |= MWKMOD_LALT;
+			break;
+		case MWKEY_RALT:
+			modstate |= MWKMOD_RALT;
+			break;
+		case MWKEY_LMETA:
+			modstate |= MWKMOD_LMETA;
+			break;
+		case MWKEY_RMETA:
+			modstate |= MWKMOD_RMETA;
+			break;
+		case MWKEY_ALTGR:
+			modstate |= MWKMOD_ALTGR;
+			break;
+		default:
+			break;
+		}
+	} else {
+		switch (mwkey) {
+		case MWKEY_NUMLOCK:
+			key_modstate ^= MWKMOD_NUM;
+			key_state[MWKEY_NUMLOCK] ^= PRESSED;
+			UpdateLEDState(key_modstate);
+			return TRUE;
+		case MWKEY_CAPSLOCK:
+			key_modstate ^= MWKMOD_CAPS;
+			key_state[MWKEY_CAPSLOCK] ^= PRESSED;
+			UpdateLEDState(key_modstate);
+			return TRUE;
+		case MWKEY_LCTRL:
+			modstate &= ~MWKMOD_LCTRL;
+			break;
+		case MWKEY_RCTRL:
+			modstate &= ~MWKMOD_RCTRL;
+			break;
+		case MWKEY_LSHIFT:
+			modstate &= ~MWKMOD_LSHIFT;
+			break;
+		case MWKEY_RSHIFT:
+			modstate &= ~MWKMOD_RSHIFT;
+			break;
+		case MWKEY_LALT:
+			modstate &= ~MWKMOD_LALT;
+			break;
+		case MWKEY_RALT:
+			modstate &= ~MWKMOD_RALT;
+			break;
+		case MWKEY_LMETA:
+			modstate &= ~MWKMOD_LMETA;
+			break;
+		case MWKEY_RMETA:
+			modstate &= ~MWKMOD_RMETA;
+			break;
+		case MWKEY_ALTGR:
+			modstate &= ~MWKMOD_ALTGR;
+			break;
+		default:
+			break;
+		}
+	}
+
+#if 0
+	/* Drop events that don't change state */
+	if (key_state[mwkey] == pressed)
+		return FALSE;
+#endif
+	/* Update internal keyboard state */
+	key_state[mwkey] = (unsigned char)pressed;
+	key_modstate = modstate;
+	return TRUE;
+}
+
+static void
+UpdateLEDState(MWKEYMOD modstate)
+{
+	int	ledstate = 0;
+
+	if (modstate & MWKMOD_CAPS)
+		ledstate |= LED_CAP;
+	if (modstate & MWKMOD_NUM)
+		ledstate |= LED_NUM;
+	ioctl(fd, KDSETLED, ledstate);
+}
+
+/* translate a scancode and modifier state to an MWKEY*/
+static MWKEY
+TranslateScancode(int scancode, MWKEYMOD modstate)
+{
+	unsigned short	mwkey = 0;
+	int		map = 0;
+
+	/* determine appropriate kernel table*/
+	if (modstate & MWKMOD_SHIFT)
+		map |= (1<<KG_SHIFT);
+	if (modstate & MWKMOD_CTRL)
+		map |= (1<<KG_CTRL);
+	if (modstate & MWKMOD_ALT)
+		map |= (1<<KG_ALT);
+	if (modstate & MWKMOD_ALTGR)
+		map |= (1<<KG_ALTGR);
+	if (KTYP(os_keymap[map][scancode]) == KT_LETTER) {
+		if (modstate & MWKMOD_CAPS)
+			map ^= (1<<KG_SHIFT);
+	}
+	if (KTYP(os_keymap[map][scancode]) == KT_PAD) {
+		if (modstate & MWKMOD_NUM) {
+			switch (keymap[scancode]) {
+			case MWKEY_KP0:
+			case MWKEY_KP1:
+			case MWKEY_KP2:
+			case MWKEY_KP3:
+			case MWKEY_KP4:
+			case MWKEY_KP5:
+			case MWKEY_KP6:
+			case MWKEY_KP7:
+			case MWKEY_KP8:
+			case MWKEY_KP9:
+				mwkey = keymap[scancode] - MWKEY_KP0 + '0';
+				break;
+			case MWKEY_KP_PERIOD:
+				mwkey = '.';
+				break;
+			case MWKEY_KP_DIVIDE:
+				mwkey = '/';
+				break;
+			case MWKEY_KP_MULTIPLY:
+				mwkey = '*';
+				break;
+			case MWKEY_KP_MINUS:
+				mwkey = '-';
+				break;
+			case MWKEY_KP_PLUS:
+				mwkey = '+';
+				break;
+			case MWKEY_KP_ENTER:
+				mwkey = MWKEY_ENTER;
+				break;
+			case MWKEY_KP_EQUALS:
+				mwkey = '-';
+				break;
+			}
+		}
+	} else
+		mwkey = KVAL(os_keymap[map][scancode]);
+	
+	if (!mwkey)
+		mwkey = keymap[scancode];
+
+	/* perform additional translations*/
+	switch (mwkey) {
+	case MWKEY_BREAK:
+	case MWKEY_PAUSE:
+		mwkey = MWKEY_QUIT;
+		break;
+	case 0x1c:	/* kernel maps print key to ctrl-\ */
+	case MWKEY_SYSREQ:
+		mwkey = MWKEY_PRINT;
+		break;
+	}
+
+//printf("TranslateScancode %02x to mwkey %d\n", scancode, mwkey);
+	return mwkey;
+}
+
+/* load Linux keyboard mappings, used as first try for scancode conversion*/
+static void
+LoadKernelKeymaps(int fd)
+{
+	int 		map, i;
+	struct kbentry 	entry;
+
+	/* Load all the keysym mappings */
+	for (map=0; map<NUM_VGAKEYMAPS; ++map) {
+		memset(os_keymap[map], 0, NR_KEYS*sizeof(unsigned short));
+		for (i=0; i<NR_KEYS; ++i) {
+			entry.kb_table = map;
+			entry.kb_index = i;
+			if (ioctl(fd, KDGKBENT, &entry) == 0) {
+				/* change K_ENTER to \r*/
+				if (entry.kb_value == K_ENTER)
+					entry.kb_value = K(KT_ASCII,13);
+
+				if ((KTYP(entry.kb_value) == KT_LATIN) ||
+				    (KTYP(entry.kb_value) == KT_ASCII) ||
+				    (KTYP(entry.kb_value) == KT_PAD) ||
+				    (KTYP(entry.kb_value) == KT_LETTER)) {
+					os_keymap[map][i] = entry.kb_value;
+				}
+			}
+		}
+	}
+
+}
+/* Handle switching to another VC, returns when our VC is back */
+static MWBOOL
+switch_vt(unsigned short which)
+{
+	struct vt_stat vtstate;
+	unsigned short current;
+	static unsigned short r[16], g[16], b[16];
+
+	/* Figure out whether or not we're switching to a new console */
+	if ((ioctl(fd, VT_GETSTATE, &vtstate) < 0) ||
+	    (which == vtstate.v_active)) {
+		return FALSE;
+	}
+	current = vtstate.v_active;
+
+	/* save palette, goto text mode*/
+	ioctl_getpalette(0, 16, r, g, b);
+	ioctl(fd, KDSETMODE, KD_TEXT);
+
+	/* New console, switch to it */
+	if (ioctl(fd, VT_ACTIVATE, which) == 0) {
+		/* Wait for our console to be activated again */
+		ioctl(fd, VT_WAITACTIVE, which);
+		while (ioctl(fd, VT_WAITACTIVE, current) < 0) {
+			if ((errno != EINTR) && (errno != EAGAIN)) {
+				/* Unknown VT error, cancel*/
+				break;
+			}
+			usleep(100000);
+		}
+	}
+
+	/* Restore graphics mode and the contents of the screen */
+	ioctl(fd, KDSETMODE, KD_GRAPHICS);
+	ioctl_setpalette(0, 16, r, g, b);
+	return TRUE;
+}
diff -urN lib/microwindows/src/drivers/kbd_x11.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_x11.c
--- lib/microwindows/src/drivers/kbd_x11.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/kbd_x11.c	2005-02-21 16:13:08.000000000 +0100
@@ -0,0 +1,396 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Author: Tony Rogvall <tony@bluetail.com>
+ *
+ * Converted to scancode mode by Greg Haerr
+ *
+ * X11 Keyboard driver
+ */
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <X11/Xlib.h>
+#include <X11/keysym.h>
+#include "device.h"
+
+static int  X11_Open(KBDDEVICE *pkd);
+static void X11_Close(void);
+static void X11_GetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers);
+static int  X11_Read(MWKEY *kbuf, MWKEYMOD *modifiers, MWSCANCODE *scancode);
+
+/* note, numlock and capslock state not initialized properly*/
+static MWKEYMOD key_modstate = MWKMOD_NUM;
+extern int escape_quits;
+
+extern Display*     x11_dpy;
+extern int          x11_scr;
+extern Visual*      x11_vis;
+extern Window       x11_win;
+extern GC           x11_gc;
+extern int          x11_setup_display();
+
+
+KBDDEVICE kbddev = {
+    X11_Open,
+    X11_Close,
+    X11_GetModifierInfo,
+    X11_Read,
+    NULL
+};
+
+/*
+ * Open the keyboard.
+ * This is real simple, we just use a special file handle
+ * that allows non-blocking I/O, and put the terminal into
+ * character mode.
+ */
+static int
+X11_Open(KBDDEVICE *pkd)
+{
+    if (x11_setup_display() < 0)
+	return -1;
+    /* return the x11 file descriptor for select */
+    return ConnectionNumber(x11_dpy);  
+}
+
+/*
+ * Close the keyboard.
+ * This resets the terminal modes.
+ */
+static void
+X11_Close(void)
+{
+    /* nop */
+}
+
+/*
+ * Return the possible modifiers for the keyboard.
+ */
+static  void
+X11_GetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers)
+{
+	if (modifiers)
+		*modifiers = MWKMOD_SHIFT | MWKMOD_CTRL | MWKMOD_ALT;
+	if (curmodifiers)
+		*curmodifiers = key_modstate;
+}
+
+/*
+ * This reads one keystroke from the keyboard, and the current state of
+ * the modifier keys (ALT, SHIFT, etc).  Returns -1 on error, 0 if no data
+ * is ready, 1 on a keypress, and 2 on keyrelease.
+ * This is a non-blocking call.
+ */
+static int
+X11_Read(MWKEY *kbuf, MWKEYMOD *modifiers, MWSCANCODE *scancode)
+{
+	XEvent ev;
+	MWKEY mwkey;
+	static int grabbed = 0;
+	static int x11_accel_num;
+	static int x11_accel_den;
+	static int x11_thres;
+
+    /* check if we have a KeyPressedEvent */
+    if (XCheckMaskEvent(x11_dpy, KeyPressMask|KeyReleaseMask, &ev)) {
+	KeySym sym = XKeycodeToKeysym(x11_dpy, ev.xkey.keycode, 0);
+
+	if (sym == NoSymbol)
+	    return -1;
+
+	/* calculate kbd modifiers*/
+	key_modstate &= (MWKMOD_NUM|MWKMOD_CAPS);
+	if (ev.xkey.state & ControlMask)
+		key_modstate |= MWKMOD_CTRL;
+	if (ev.xkey.state & ShiftMask)
+		key_modstate |= MWKMOD_SHIFT;
+	if (ev.xkey.state & Mod1Mask)
+		key_modstate |= MWKMOD_ALT;
+
+	if (sym == XK_Escape) {
+	    mwkey = MWKEY_ESCAPE;
+
+	    if (ev.xkey.state & ControlMask) {
+		/* toggle grab control */
+		if (grabbed) {
+		    XUngrabPointer(x11_dpy, CurrentTime);
+		    XUngrabKeyboard(x11_dpy, CurrentTime);
+		    XChangePointerControl(x11_dpy, True, False, x11_accel_num, 
+			  x11_accel_den, 0);
+		    grabbed = 0;
+		}
+		else {
+		    /* save pointer config */
+		    XGetPointerControl(x11_dpy, &x11_accel_num, &x11_accel_den,
+			    &x11_thres);
+		    XChangePointerControl(x11_dpy, True, False, 1, 1, 0);
+		    XGrabKeyboard(x11_dpy, x11_win,
+			    True,  /* only to this window */
+			    GrabModeAsync, GrabModeAsync, CurrentTime);
+		    XGrabPointer(x11_dpy, x11_win, False,
+				 PointerMotionMask | ButtonPressMask,
+				 GrabModeAsync, GrabModeAsync, None, None,
+				 CurrentTime);
+		    grabbed = 1;
+		}
+		return 0;
+	    } else if (grabbed)
+		XChangePointerControl(x11_dpy, True, False, x11_accel_num, 
+		      x11_accel_den, 0);
+	    *kbuf = mwkey;
+	    *modifiers = key_modstate;
+	    *scancode = ev.xkey.keycode;
+	    return (ev.xkey.type == KeyPress)? 1: 2;
+	} else {
+	    switch (sym) {
+	    case XK_Delete:
+		    mwkey = MWKEY_DELETE;
+		    break;
+	    case XK_Home:
+		    mwkey = MWKEY_HOME;
+		    break;
+	    case XK_Left:
+		    mwkey = MWKEY_LEFT;
+		    break;
+	    case XK_Up:
+		    mwkey = MWKEY_UP;
+		    break;
+	    case XK_Right:
+		    mwkey = MWKEY_RIGHT;
+		    break;
+	    case XK_Down:
+		    mwkey = MWKEY_DOWN;
+		    break;
+	    case XK_Page_Up:
+		    mwkey = MWKEY_PAGEUP;
+		    break;
+	    case XK_Page_Down:
+		    mwkey = MWKEY_PAGEDOWN;
+		    break;
+	    case XK_End:
+		    mwkey = MWKEY_END;
+		    break;
+	    case XK_Insert:
+		    mwkey = MWKEY_INSERT;
+		    break;
+	    case XK_Pause:
+	    case XK_Break:
+		    mwkey = MWKEY_QUIT;
+		    break;
+	    case XK_Print:
+	    case XK_Sys_Req:
+		    mwkey = MWKEY_PRINT;
+		    break;
+	    case XK_Menu:
+		    mwkey = MWKEY_MENU;
+		    break;
+	    case XK_Cancel:
+		    mwkey = MWKEY_CANCEL;
+		    break;
+	    case XK_KP_Enter:
+		    mwkey = MWKEY_KP_ENTER;
+		    break;
+	    case XK_KP_Home:
+		    mwkey = MWKEY_KP7;
+		    break;
+	    case XK_KP_Left:
+		    mwkey = MWKEY_KP4;
+		    break;
+	    case XK_KP_Up:
+		    mwkey = MWKEY_KP8;
+		    break;
+	    case XK_KP_Right:
+		    mwkey = MWKEY_KP6;
+		    break;
+	    case XK_KP_Down:
+		    mwkey = MWKEY_KP2;
+		    break;
+	    case XK_KP_Page_Up:
+		    mwkey = MWKEY_KP9;
+		    break;
+	    case XK_KP_Page_Down:
+		    mwkey = MWKEY_KP3;
+		    break;
+	    case XK_KP_End:
+		    mwkey = MWKEY_KP1;
+		    break;
+	    case XK_KP_Insert:
+		    mwkey = MWKEY_KP0;
+		    break;
+	    case XK_KP_Delete:
+		    mwkey = MWKEY_KP_PERIOD;
+		    break;
+	    case XK_KP_Equal:
+		    mwkey = MWKEY_KP_EQUALS;
+		    break;
+	    case XK_KP_Multiply:
+		    mwkey = MWKEY_KP_MULTIPLY;
+		    break;
+	    case XK_KP_Add:
+		    mwkey = MWKEY_KP_PLUS;
+		    break;
+	    case XK_KP_Subtract:
+		    mwkey = MWKEY_KP_MINUS;
+		    break;
+	    case XK_KP_Decimal:
+		    mwkey = MWKEY_KP_PERIOD;
+		    break;
+	    case XK_KP_Divide:
+		    mwkey = MWKEY_KP_DIVIDE;
+		    break;
+	    case XK_KP_5:
+	    case XK_KP_Begin:
+		    mwkey = MWKEY_KP5;
+		    break;
+	    case XK_F1:
+		    mwkey = MWKEY_F1;
+		    break;
+	    case XK_F2:
+		    mwkey = MWKEY_F2;
+		    break;
+	    case XK_F3:
+		    mwkey = MWKEY_F3;
+		    break;
+	    case XK_F4:
+		    mwkey = MWKEY_F4;
+		    break;
+	    case XK_F5:
+		    mwkey = MWKEY_F5;
+		    break;
+	    case XK_F6:
+		    mwkey = MWKEY_F6;
+		    break;
+	    case XK_F7:
+		    mwkey = MWKEY_F7;
+		    break;
+	    case XK_F8:
+		    mwkey = MWKEY_F8;
+		    break;
+	    case XK_F9:
+		    mwkey = MWKEY_F9;
+		    break;
+	    case XK_F10:
+		    mwkey = MWKEY_F10;
+		    break;
+	    case XK_F11:
+		    mwkey = MWKEY_F11;
+		    break;
+	    case XK_F12:
+		    mwkey = MWKEY_F12;
+		    break;
+
+	    /* state modifiers*/
+	    case XK_Num_Lock:
+		    /* not sent, used only for state*/
+		    if (ev.xkey.type == KeyRelease)
+		    	key_modstate ^= MWKMOD_NUM;
+		    return 0;
+	    case XK_Shift_Lock:
+	    case XK_Caps_Lock:
+		    /* not sent, used only for state*/
+		    if (ev.xkey.type == KeyRelease)
+		    	key_modstate ^= MWKMOD_CAPS;
+		    return 0;
+	    case XK_Scroll_Lock:
+		    mwkey = MWKEY_SCROLLOCK;
+		    break;
+	    case XK_Shift_L:
+		    mwkey = MWKEY_LSHIFT;
+		    break;
+	    case XK_Shift_R:
+		    mwkey = MWKEY_RSHIFT;
+		    break;
+	    case XK_Control_L:
+		    mwkey = MWKEY_LCTRL;
+		    break;
+	    case XK_Control_R:
+		    mwkey = MWKEY_RCTRL;
+		    break;
+	    case XK_Alt_L:
+		    mwkey = MWKEY_LALT;
+		    break;
+	    case XK_Alt_R:
+		    mwkey = MWKEY_RALT;
+		    break;
+	    case XK_Meta_L:
+	    case XK_Super_L:
+	    case XK_Hyper_L:
+		    mwkey = MWKEY_LMETA;
+		    break;
+	    case XK_Meta_R:
+	    case XK_Super_R:
+	    case XK_Hyper_R:
+		    mwkey = MWKEY_RMETA;
+		    break;
+	    default:
+		    switch (sym) {
+		    case XK_BackSpace:
+		    case XK_Tab:
+		    case XK_Return:
+			break;
+		    default:
+		    	if (sym & 0xFF00)
+			    printf("Unhandled X11 keysym: %04x\n", (int)sym);
+		    }
+
+		    if (key_modstate & MWKMOD_CTRL)
+			    mwkey = sym & 0x1f;
+#if 0
+		    else if (key_modstate & (MWKMOD_SHIFT|MWKMOD_CAPS)) {
+			    if (mwkey >= 'a' && mwkey <= 'z')
+			    	mwkey = mwkey - 'a' + 'A';
+		    }
+#endif
+		    else {
+		 	    sym = XLookupKeysym(&ev.xkey,
+				ev.xkey.state & (MWKMOD_SHIFT|MWKMOD_CAPS));
+		    	    mwkey = sym & 0xff;	/* convert to ASCII*/
+		    }
+		    break;
+
+	    }
+	    if (key_modstate & MWKMOD_NUM) {
+		switch (mwkey) {
+		case MWKEY_KP0:
+		case MWKEY_KP1:
+		case MWKEY_KP2:
+		case MWKEY_KP3:
+		case MWKEY_KP4:
+		case MWKEY_KP5:
+		case MWKEY_KP6:
+		case MWKEY_KP7:
+		case MWKEY_KP8:
+		case MWKEY_KP9:
+			mwkey = mwkey - MWKEY_KP0 + '0';
+			break;
+		case MWKEY_KP_PERIOD:
+			mwkey = '.';
+			break;
+		case MWKEY_KP_DIVIDE:
+			mwkey = '/';
+			break;
+		case MWKEY_KP_MULTIPLY:
+			mwkey = '*';
+			break;
+		case MWKEY_KP_MINUS:
+			mwkey = '-';
+			break;
+		case MWKEY_KP_PLUS:
+			mwkey = '+';
+			break;
+		case MWKEY_KP_ENTER:
+			mwkey = MWKEY_ENTER;
+			break;
+		case MWKEY_KP_EQUALS:
+			mwkey = '-';
+			break;
+		}
+	    }
+	    *modifiers = key_modstate;
+	    *scancode = ev.xkey.keycode;
+	    *kbuf = mwkey;
+	    return (ev.xkey.type == KeyPress)? 1: 2;
+	}
+    }
+    return 0;
+}
diff -urN lib/microwindows/src/drivers/memplan4.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/memplan4.c
--- lib/microwindows/src/drivers/memplan4.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/memplan4.c	2005-02-21 16:13:08.000000000 +0100
@@ -0,0 +1,337 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * 4 planes EGA/VGA Memory (blitting) Video Driver for Microwindows
+ * Included with #define HAVEBLIT in vgaplan4.h
+ * 
+ * 4bpp colors are stored in linear 4pp format in memory dc's
+ *
+ * 	In this driver, psd->linelen is line byte length, not line pixel length
+ */
+/*#define NDEBUG*/
+#include <assert.h>
+#include <string.h>
+#include "device.h"
+#include "vgaplan4.h"
+#include "fb.h"
+
+#if HAVEBLIT
+
+#if MSDOS | ELKS | __rtems__
+/* assumptions for speed: NOTE: psd is ignored in these routines*/
+#define SCREENBASE(psd) 	EGA_BASE
+#define BYTESPERLINE(psd)	80
+#else
+/* run on top of framebuffer*/
+#define SCREENBASE(psd) 	((char *)((psd)->addr))
+#define BYTESPERLINE(psd)	((psd)->linelen)
+#endif
+
+/* extern data*/
+extern int gr_mode;	/* temp kluge*/
+
+static unsigned char notmask[2] = { 0x0f, 0xf0};
+
+/* Calc linelen and mmap size, return 0 on fail*/
+static int
+mempl4_init(PSD psd)
+{
+	if (!psd->size)
+		psd->size = psd->yres * psd->linelen;
+	/* linelen in bytes for bpp 1, 2, 4, 8 so no change*/
+	return 1;
+}
+
+/* Set pixel at x, y, to pixelval c*/
+static void
+mempl4_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	addr += (x>>1) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR)
+		*addr ^= c << ((1-(x&1))<<2);
+	else
+		*addr = (*addr & notmask[x&1]) | (c << ((1-(x&1))<<2));
+}
+
+/* Read pixel at x, y*/
+static MWPIXELVAL
+mempl4_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+
+	return (addr[(x>>1) + y * psd->linelen] >> ((1-(x&1))<<2) ) & 0x0f;
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+mempl4_drawhorzline(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+
+	assert (addr != 0);
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 < psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	addr += (x1>>1) + y * psd->linelen;
+	if(gr_mode == MWMODE_XOR) {
+		while(x1 <= x2) {
+			*addr ^= c << ((1-(x1&1))<<2);
+			if((++x1 & 1) == 0)
+				++addr;
+		}
+	} else {
+		while(x1 <= x2) {
+			*addr = (*addr & notmask[x1&1]) | (c << ((1-(x1&1))<<2));
+			if((++x1 & 1) == 0)
+				++addr;
+		}
+	}
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+mempl4_drawvertline(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	int	linelen = psd->linelen;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 < psd->yres);
+	assert (y2 >= y1);
+	assert (c < psd->ncolors);
+
+	addr += (x>>1) + y1 * linelen;
+	if(gr_mode == MWMODE_XOR)
+		while(y1++ <= y2) {
+			*addr ^= c << ((1-(x&1))<<2);
+			addr += linelen;
+		}
+	else
+		while(y1++ <= y2) {
+			*addr = (*addr & notmask[x&1]) | (c << ((1-(x&1))<<2));
+			addr += linelen;
+		}
+}
+
+/* srccopy bitblt, opcode is currently ignored*/
+/* copy from memdc to memdc*/
+static void
+mempl4_to_mempl4_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, int op)
+{
+	ADDR8	dst;
+	ADDR8	src;
+	int	i;
+	int	dlinelen = dstpsd->linelen;
+	int	slinelen = srcpsd->linelen;
+
+	assert (dstpsd->addr != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (srcpsd->addr != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	dst = (char *)dstpsd->addr + (dstx>>1) + dsty * dlinelen;
+	src = (char *)srcpsd->addr + (srcx>>1) + srcy * slinelen;
+	while(--h >= 0) {
+		ADDR8	d = dst;
+		ADDR8	s = src;
+		MWCOORD	dx = dstx;
+		MWCOORD	sx = srcx;
+		for(i=0; i<w; ++i) {
+			*d = (*d & notmask[dx&1]) |
+			   ((*s >> ((1-(sx&1))<<2) & 0x0f) << ((1-(dx&1))<<2));
+			if((++dx & 1) == 0)
+				++d;
+			if((++sx & 1) == 0)
+				++s;
+		}
+		dst += dlinelen;
+		src += slinelen;
+	}
+}
+
+/* srccopy bitblt, opcode is currently ignored*/
+/* copy from vga memory to vga memory, psd's ignored for speed*/
+static void
+vga_to_vga_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, int op)
+{
+	FARADDR	dst;
+	FARADDR	src;
+	int	i, plane;
+	int	x1, x2;
+
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	DRAWON;
+	set_enable_sr(0);
+	dst = SCREENBASE(dstpsd) + (dstx>>3) + dsty * BYTESPERLINE(dstpsd);
+	src = SCREENBASE(srcpsd) + (srcx>>3) + srcy * BYTESPERLINE(srcpsd);
+	x1 = dstx>>3;
+	x2 = (dstx + w - 1) >> 3;
+	while(--h >= 0) {
+		for(plane=0; plane<4; ++plane) {
+			FARADDR d = dst;
+			FARADDR s = src;
+
+	    		set_read_plane(plane);
+			set_write_planes(1 << plane);
+
+			/* FIXME: only works if srcx and dstx are same modulo*/
+			if(x1 == x2) {
+		  		select_and_set_mask((0xff >> (x1 & 7)) & (0xff << (7 - (x2 & 7))));
+				PUTBYTE_FP(d, GETBYTE_FP(s));
+			} else {
+				select_and_set_mask(0xff >> (x1 & 7));
+				PUTBYTE_FP(d++, GETBYTE_FP(s++));
+
+				set_mask(0xff);
+		  		for(i=x1+1; i<x2; ++i)
+					PUTBYTE_FP(d++, GETBYTE_FP(s++));
+
+		  		set_mask(0xff << (7 - (x2 & 7)));
+				PUTBYTE_FP(d, GETBYTE_FP(s));
+			}
+		}
+		dst += BYTESPERLINE(dstpsd);
+		src += BYTESPERLINE(srcpsd);
+	}
+	set_write_planes(0x0f);
+	set_enable_sr(0x0f);
+	DRAWOFF;
+}
+
+/* srccopy bitblt, opcode is currently ignored*/
+/* copy from memdc to vga memory*/
+static void
+mempl4_to_vga_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, int op)
+{
+	FARADDR	dst;
+	ADDR8	src;
+	int	i;
+	int	slinelen = srcpsd->linelen;
+	int	color, lastcolor = -1;
+	static unsigned char mask[8] = {
+		0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
+	};
+
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (srcpsd->addr != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	DRAWON;
+	set_op(0);		/* modetable[MWMODE_SET]*/
+	dst = SCREENBASE(dstpsd) + (dstx>>3) + dsty * BYTESPERLINE(dstpsd);
+	src = (char *)srcpsd->addr + (srcx>>1) + srcy * slinelen;
+	while(--h >= 0) {
+		FARADDR d = dst;
+		ADDR8	s = src;
+		MWCOORD	dx = dstx;
+		MWCOORD	sx = srcx;
+		for(i=0; i<w; ++i) {
+			color = *s >> ((1-(sx&1))<<2) & 0x0f;
+			if(color != lastcolor)
+				set_color(lastcolor = color);
+			select_and_set_mask (mask[dx&7]);
+			RMW_FP(d);
+
+			if((++dx & 7) == 0)
+				++d;
+			if((++sx & 1) == 0)
+				++s;
+		}
+		dst += BYTESPERLINE(dstpsd);
+		src += slinelen;
+	}
+	DRAWOFF;
+}
+
+/* srccopy bitblt, opcode is currently ignored*/
+/* copy from vga memory to memdc*/
+static void
+vga_to_mempl4_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, int op)
+{
+	/* FIXME*/
+}
+
+void
+ega_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	MWBOOL	srcvga, dstvga;
+
+	/* decide which blit algorithm to use*/
+	srcvga = srcpsd->flags & PSF_SCREEN;
+	dstvga = dstpsd->flags & PSF_SCREEN;
+
+	if(srcvga) {
+		if(dstvga)
+			vga_to_vga_blit(dstpsd, dstx, dsty, w, h,
+				srcpsd, srcx, srcy, op);
+		else
+			vga_to_mempl4_blit(dstpsd, dstx, dsty, w, h,
+				srcpsd, srcx, srcy, op);
+	} else {
+		if(dstvga)
+			mempl4_to_vga_blit(dstpsd, dstx, dsty, w, h,
+				srcpsd, srcx, srcy, op);
+		else
+			mempl4_to_mempl4_blit(dstpsd, dstx, dsty, w, h,
+				srcpsd, srcx, srcy, op);
+	}
+}
+
+SUBDRIVER memplan4 = {
+	mempl4_init,
+	mempl4_drawpixel,
+	mempl4_readpixel,
+	mempl4_drawhorzline,
+	mempl4_drawvertline,
+	gen_fillrect,
+	ega_blit
+};
+
+#endif /* HAVEBLIT*/
diff -urN lib/microwindows/src/drivers/memplan4.org /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/memplan4.org
--- lib/microwindows/src/drivers/memplan4.org	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/memplan4.org	2005-02-21 16:13:12.000000000 +0100
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * 4 planes Memory Video Driver for MicroWindows
+ * 
+ * 4bpp colors are stored bit-packed into memory, 1 bit of color per plane
+ * planes 0-3 are sequential in memory
+ *
+ * 	In this driver, psd->linelen is line byte length, not line pixel length
+ */
+/*#define NDEBUG*/
+#include <assert.h>
+#include <string.h>
+#include "../device.h"
+#include "vgaplan4.h"
+
+/* FIXME assumptions for speed: NOTE: psd is ignored in these routines*/
+#define SCREENBASE 		MK_FP(0xa000, 0)
+#define BYTESPERLINE		80
+
+/*FIXME*/
+typedef char *ADDR8;
+
+/* extern data*/
+extern MODE gr_mode;	/* temp kluge*/
+
+static unsigned char notmask[8] = {
+	0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe
+};
+static unsigned char mask[8] = {
+	0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
+};
+
+/* Set pixel at x, y, to pixelval c*/
+void
+mempl4_drawpixel(PSD psd, COORD x, COORD y, PIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	int	planesize = psd->yres * psd->linelen;
+	int	plane;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c >= 0 && c < psd->ncolors);
+
+	addr += x/8 + y * psd->linelen;
+	if(gr_mode == MODE_XOR) {
+		for(plane=0; plane<4; ++plane) {
+			*addr = (*addr & notmask[x&7]) ^ (c << (7-(x&7)));
+			addr += planesize;
+		}
+	} else {
+		for(plane=0; plane<4; ++plane) {
+			*addr = (*addr & notmask[x&7]) | (c << (7-(x&7)));
+			addr += planesize;
+		}
+	}
+}
+
+/* Read pixel at x, y*/
+PIXELVAL
+mempl4_readpixel(PSD psd, COORD x, COORD y)
+{
+	ADDR8		addr = psd->addr;
+	int		planesize = psd->yres * psd->linelen;
+	int		plane;
+	PIXELVAL	c = 0;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+
+	addr += x/8 + y * psd->linelen;
+	for(plane=0; plane<4; ++plane) {
+		if(*addr & mask[x&7])
+			c |= 1 << plane;
+		addr += planesize;
+	}
+	assert (c >= 0 && c < NCOLORS);
+	return c;
+}
+
+/* Draw horizontal line from x1,y to x2,y not including final point*/
+void
+mempl4_drawhorzline(PSD psd, COORD x1, COORD x2, COORD y, PIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	int	planesize = psd->yres * psd->linelen;
+	int	plane;
+
+	assert (addr != 0);
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 <= psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c >= 0 && c < psd->ncolors);
+
+	addr += x1/8 + y * psd->linelen;
+	if(gr_mode == MODE_XOR) {
+		while(x1 < x2) {
+			*addr = (*addr & notmask[x1&7]) ^ (c << (7-(x1&7)));
+			addr += planesize;
+			*addr = (*addr & notmask[x1&7]) ^ (c << (7-(x1&7)));
+			addr += planesize;
+			*addr = (*addr & notmask[x1&7]) ^ (c << (7-(x1&7)));
+			addr += planesize;
+			*addr = (*addr & notmask[x1&7]) ^ (c << (7-(x1&7)));
+			addr -= planesize * 3;
+			if((++x1 & 7) == 0)
+				++addr;
+		}
+	} else {
+		while(x1 < x2) {
+			*addr = (*addr & notmask[x1&7]) | (c << (7-(x1&7)));
+			addr += planesize;
+			*addr = (*addr & notmask[x1&7]) | (c << (7-(x1&7)));
+			addr += planesize;
+			*addr = (*addr & notmask[x1&7]) | (c << (7-(x1&7)));
+			addr += planesize;
+			*addr = (*addr & notmask[x1&7]) | (c << (7-(x1&7)));
+			addr -= planesize * 3;
+			if((++x1 & 7) == 0)
+				++addr;
+		}
+	}
+}
+
+/* Draw a vertical line from x,y1 to x,y2 not including final point*/
+void
+mempl4_drawvertline(PSD psd, COORD x, COORD y1, COORD y2, PIXELVAL c)
+{
+	ADDR8	addr = psd->addr;
+	int	linelen = psd->linelen;
+	int	planesize = psd->yres * linelen;
+
+	assert (addr != 0);
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 <= psd->yres);
+	assert (y2 >= y1);
+	assert (c >= 0 && c < psd->ncolors);
+
+	addr += x/8 + y1 * linelen;
+	if(gr_mode == MODE_XOR)
+		while(y1++ < y2) {
+			*addr = (*addr & notmask[x&7]) ^ (c << (7-(x&7)));
+			addr += planesize;
+			*addr = (*addr & notmask[x&7]) ^ (c << (7-(x&7)));
+			addr += planesize;
+			*addr = (*addr & notmask[x&7]) ^ (c << (7-(x&7)));
+			addr += planesize;
+			*addr = (*addr & notmask[x&7]) ^ (c << (7-(x&7)));
+			addr = addr - (planesize * 3) + linelen;
+		}
+	else
+		while(y1++ < y2) {
+			*addr = (*addr & notmask[x&7]) | (c << (7-(x&7)));
+			addr += planesize;
+			*addr = (*addr & notmask[x&7]) | (c << (7-(x&7)));
+			addr += planesize;
+			*addr = (*addr & notmask[x&7]) | (c << (7-(x&7)));
+			addr += planesize;
+			*addr = (*addr & notmask[x&7]) | (c << (7-(x&7)));
+			addr = addr - (planesize * 3) + linelen;
+		}
+}
+
+/* srccopy bitblt, opcode is currently ignored*/
+void
+mempl4_to_mempl4_blit(PSD dstpsd, COORD dstx, COORD dsty, COORD w, COORD h,
+	PSD srcpsd, COORD srcx, COORD srcy, int op)
+{
+	ADDR8	dst;
+	ADDR8	src;
+	int	i;
+	int	dlinelen = dstpsd->linelen;
+	int	dplanesize = dstpsd->yres * dstpsd->linelen;
+	int	slinelen = srcpsd->linelen;
+	int	splanesize = srcpsd->yres * srcpsd->linelen;
+
+	assert (dstpsd->addr != 0);
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (srcpsd->addr != 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	while(--h >= 0) {
+		dst = (char *)dstpsd->addr + dstx/8 + dsty * dlinelen;
+		src = (char *)srcpsd->addr + srcx/8 + srcy * slinelen;
+		for(i=0; i<w; ++i) {
+			COORD	dx = dstx;
+			COORD	sx = srcx;
+			*dst = (*dst & notmask[dx&7]) |
+			   ((*src >> (7-(sx&7)) & 0x01) << (7-(dx&7)));
+			dst += dplanesize;
+			src += splanesize;
+			*dst = (*dst & notmask[dx&7]) |
+			   ((*src >> (7-(sx&7)) & 0x01) << (7-(dx&7)));
+			dst += dplanesize;
+			src += splanesize;
+			*dst = (*dst & notmask[dx&7]) |
+			   ((*src >> (7-(sx&7)) & 0x01) << (7-(dx&7)));
+			dst += dplanesize;
+			src += splanesize;
+			*dst = (*dst & notmask[dx&7]) |
+			   ((*src >> (7-(sx&7)) & 0x01) << (7-(dx&7)));
+			dst -= dplanesize * 3;
+			src -= splanesize * 3;
+			if((++dx & 7) == 0)
+				++dst;
+			if((++sx & 7) == 0)
+				++src;
+		}
+	}
+}
+
+/* srccopy bitblt, opcode is currently ignored*/
+/* copy from vga memory to vga memory, psd's ignored for speed*/
+void
+vga_to_vga_blit(PSD dstpsd, COORD dstx, COORD dsty, COORD w, COORD h,
+	PSD srcpsd, COORD srcx, COORD srcy, int op)
+{
+	volatile FARADDR	dst;
+	volatile FARADDR	src;
+	int	i, plane;
+	int	x1, x2;
+	unsigned char linebuf[640/8];
+
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	set_enable_sr(0);
+	dst = SCREENBASE + dstx/8 + dsty * BYTESPERLINE;
+	src = SCREENBASE + srcx/8 + srcy * BYTESPERLINE;
+	x1 = dstx/8;
+	x2 = (dstx + w - 1) / 8;
+	while(--h >= 0) {
+		for(plane=0; plane<4; ++plane) {
+			volatile FARADDR d = dst;
+			volatile FARADDR s = src;
+
+	    		set_read_plane(plane);
+			set_write_planes(1 << plane);
+
+			select_mask();
+			if(x1 == x2) {
+		  		set_mask((0xff >> (x1 & 7)) & (0xff << (7 - (x2 & 7))));
+				PUTBYTE_FP(d, GETBYTE_FP(s));
+			} else {
+				set_mask(0xff >> (x1 & 7));
+				PUTBYTE_FP(d++, GETBYTE_FP(s++));
+
+				set_mask(0xff);
+		  		for(i=x1+1; i<x2; ++i)
+					PUTBYTE_FP(d++, GETBYTE_FP(s++));
+
+		  		set_mask(0xff << (7 - (x2 & 7)));
+				PUTBYTE_FP(d, GETBYTE_FP(s));
+			}
+		}
+		dst += BYTESPERLINE;
+		src += BYTESPERLINE;
+	}
+	set_write_planes(0x0f);
+	set_enable_sr(0x0f);
+}
diff -urN lib/microwindows/src/drivers/mou_ads.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_ads.c
--- lib/microwindows/src/drivers/mou_ads.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_ads.c	2005-02-21 16:03:15.000000000 +0100
@@ -0,0 +1,191 @@
+/*
+ * Microwindows touch screen driver for ADS Graphics Client (www.flatpanels.com)
+ *
+ * Copyright (c) 2000 Century Software Embedded Technologies
+ *
+ * Requires /dev/ts kernel driver (char special 190,34)
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <math.h>
+#include <sys/ioctl.h>
+#include "device.h"
+
+/* file descriptor for touch panel */
+static int pd_fd = -1;
+
+/* Hack extern to used when hiding the mouse cursor
+ * There needs to be a better way to do this
+*/
+extern SCREENDEVICE scrdev;
+
+static int PD_Open(MOUSEDEVICE *pmd)
+{
+ 	/*
+	 * open up the touch-panel device.
+	 * Return the fd if successful, or negative if unsuccessful.
+	 */
+
+	pd_fd = open("/dev/ts", O_NONBLOCK);
+	if (pd_fd < 0) {
+		EPRINTF("Error %d opening touch panel\n", errno);
+		return -1;
+	}
+
+	GdHideCursor(&scrdev);
+	return pd_fd;
+}
+
+static void PD_Close(void)
+{
+ 	/* Close the touch panel device. */
+	EPRINTF("PD_Close called\n");
+	if (pd_fd >= 0)
+		close(pd_fd);
+	pd_fd = -1;
+}
+
+static int PD_GetButtonInfo(void)
+{
+ 	/* get "mouse" buttons supported */
+	return MWBUTTON_L;
+}
+
+static void PD_GetDefaultAccel(int *pscale,int *pthresh)
+{
+	/*
+	 * Get default mouse acceleration settings
+	 * This doesn't make sense for a touch panel.
+	 * Just return something inconspicuous for now.
+	 */
+	*pscale = 3;
+	*pthresh = 5;
+}
+
+static int PD_Read(MWCOORD *px, MWCOORD *py, MWCOORD *pz, int *pb)
+{
+	/* read a data point */
+	short data[3];
+	int bytes_read;
+
+	bytes_read = read(pd_fd, data, sizeof(data));
+
+	if (bytes_read != sizeof(data)) {
+		if (errno == EINTR || errno == EAGAIN)
+			return 0;
+		/*
+		 * kernel driver bug: select returns read available,
+		 * but read returns -1
+		 * we return 0 here to avoid GsError above
+		 */
+		/*return -1;*/
+		return 0;
+	}
+
+	*px = (MWCOORD)data[0];
+	*py = (MWCOORD)data[1];
+
+	*pb = (data[2]>0?MWBUTTON_L:0);
+	*pz = 0;
+
+	if((*px == -1 || *py == -1) && *pb >= 0)
+		return 3;			/* only have button data */
+	else if((*px == -1 || *py == -1) && *pb < 0)
+		return 0;			/* don't have any data   */
+	else 
+		return 2;			/* have full set of data */
+}
+
+MOUSEDEVICE mousedev = {
+	PD_Open,
+	PD_Close,
+	PD_GetButtonInfo,
+	PD_GetDefaultAccel,
+	PD_Read,
+	NULL
+};
+
+#ifdef TEST
+int main(int argc, char ** v)
+{
+	MWCOORD x, y, z;
+	int	b;
+	int result;
+	int mouse = -1;
+	DPRINTF("Opening touch panel...\n");
+
+	if((result=PD_Open(0)) < 0)
+		DPRINTF("Error %d, result %d opening touch-panel\n", errno, result);
+
+	/* This stuff below can be used to set some of the parameters of the
+	 * driver from the command line before going in to the test loop.
+	 * Could this have been done better? Yup.
+	 */
+
+	if(argc > 1) {
+		ioctl(result,1,atoi(v[1]));
+		DPRINTF("Setting pressure to %d\n",atoi(v[1]));
+	} 
+	if(argc > 2) {
+		ioctl(result,2,atoi(v[2]));
+		DPRINTF("Setting updelay to %d\n",atoi(v[2]));
+	}
+	if(argc > 3) {
+		ioctl(result,3,atoi(v[3]));
+		DPRINTF("Setting raw x to %d\n",atoi(v[3]));
+	}
+	if(argc > 4) {
+		ioctl(result,4,atoi(v[4]));
+		DPRINTF("Setting raw y to %d\n",atoi(v[4]));
+	} 
+	if(argc > 5) {
+		ioctl(result,5,atoi(v[5]));
+		DPRINTF("Setting res x to %d\n",atoi(v[5]));
+	}
+	if(argc > 6) {
+		ioctl(result,6,atoi(v[6]));
+		DPRINTF("Setting res y to %d\n",atoi(v[6]));
+	}
+	if(argc > 7) {
+		ioctl(result,7,atoi(v[7]));
+		DPRINTF("Setting fudge x to %d\n",atoi(v[7]));
+	}
+	if(argc > 8) {
+		ioctl(result,8,atoi(v[8]));
+		DPRINTF("Setting fudge y to %d\n",atoi(v[8]));
+	}
+	if(argc > 9) {
+		ioctl(result,9,atoi(v[9]));
+		DPRINTF("Setting average sample to %d\n",atoi(v[9]));
+	} 
+	if(argc > 10) {
+		ioctl(result,10,atoi(v[10]));
+		DPRINTF("Setting raw min x to %d\n",atoi(v[10]));
+	}
+	if(argc > 11) {
+		ioctl(result,11,atoi(v[11]));
+		DPRINTF("Setting raw min y to %d\n",atoi(v[11]));
+	} 
+
+	DPRINTF("Reading touch panel...\n");
+
+	while(1) {
+		result = PD_Read(&x, &y, &z, &b);
+		if( result > 0) {
+			if(mouse != b) {
+				mouse = b;
+				if(mouse) 
+					DPRINTF("Pen Down\n");
+				else
+					DPRINTF("Pen Up\n");
+			}
+
+			DPRINTF("%d,%d,%d,%d,%d\n", result, x, y, z, b);
+
+		}
+	}
+}
+#endif
diff -urN lib/microwindows/src/drivers/mou_dos.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_dos.c
--- lib/microwindows/src/drivers/mou_dos.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_dos.c	2005-02-21 16:03:16.000000000 +0100
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * DOS Mouse Driver, uses int 33h
+ * Added fix for DJGPP 32 bit compilation
+ */
+#include <dos.h>
+
+#ifndef __PACIFIC__
+#include <bios.h>
+#endif
+
+#include "device.h"
+
+#define	SCALE	1	/* default scaling factor for acceleration WAS 3*/
+#define	THRESH	10	/* default threshhold for acceleration WAS 0*/
+
+static int  	MOU_Open(MOUSEDEVICE *pmd);
+static void 	MOU_Close(void);
+static int  	MOU_GetButtonInfo(void);
+static void	MOU_GetDefaultAccel(int *pscale,int *pthresh);
+static int  	MOU_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz,int *bp);
+static int	MOU_Poll(void);
+
+MOUSEDEVICE mousedev = {
+	MOU_Open,
+	MOU_Close,
+	MOU_GetButtonInfo,
+	MOU_GetDefaultAccel,
+	MOU_Read,
+	MOU_Poll
+};
+
+static int mouse_fd;
+
+/*
+ * Open up the mouse device.
+ */
+static int
+MOU_Open(MOUSEDEVICE *pmd)
+{
+	union REGS 	regset;
+
+	/* init mouse*/
+	regset.x.ax = 0;
+	int86(0x33, &regset, &regset);
+
+	/* set mickey-to-pixel ratio*/
+	regset.x.ax = 0x0f;
+	regset.x.cx = 16;	/* # mickeys per 8 pixels x direction (default 8)*/
+	regset.x.dx = 32;	/* # mickeys per 8 pixels y direction (default 16)*/
+	int86(0x33, &regset, &regset);
+
+	/* read motion counters to reset*/
+	regset.x.ax = 0x0b;
+	int86(0x33, &regset, &regset);
+
+	return 1;
+}
+
+/*
+ * Close the mouse device.
+ */
+static void
+MOU_Close(void)
+{
+}
+
+/*
+ * Get mouse buttons supported
+ */
+static int
+MOU_GetButtonInfo(void)
+{
+	return MWBUTTON_L | MWBUTTON_M | MWBUTTON_R;
+}
+
+/*
+ * Get default mouse acceleration settings
+ */
+static void
+MOU_GetDefaultAccel(int *pscale,int *pthresh)
+{
+	*pscale = SCALE;
+	*pthresh = THRESH;
+}
+
+/*
+ * Attempt to read bytes from the mouse and interpret them.
+ * Returns -1 on error, 0 if either no bytes were read or not enough
+ * was read for a complete state, or 1 if the new state was read.
+ * When a new state is read, the current buttons and x and y deltas
+ * are returned.  This routine does not block.
+ */
+static int
+MOU_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz, int *bp)
+{
+	union REGS 	regset;
+	int		buttons;
+
+	/* read motion counters*/
+	regset.x.ax = 0x0b;
+	int86(0x33, &regset, &regset);
+
+	*dx = (short)regset.x.cx;
+	*dy = (short)regset.x.dx;
+	*dz = 0;
+
+	/* read button status*/
+	regset.x.ax = 3;
+	int86(0x33, &regset, &regset);
+
+	buttons = 0;
+	if(regset.x.bx & 01)
+		buttons |= MWBUTTON_L;
+	if(regset.x.bx & 02)
+		buttons |= MWBUTTON_R;
+	if(regset.x.bx & 04)
+		buttons |= MWBUTTON_M;
+	*bp = buttons;
+
+	return 1;
+}
+
+static int
+MOU_Poll(void)
+{
+	return 1;
+}
diff -urN lib/microwindows/src/drivers/mou_ecos_assabet.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_ecos_assabet.c
--- lib/microwindows/src/drivers/mou_ecos_assabet.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_ecos_assabet.c	2005-02-21 16:13:12.000000000 +0100
@@ -0,0 +1,150 @@
+/* Assabet Touchpad Driver based on Greg's NULL mouse driver
+ * Copyright (c) 2001 I-Jui Sung <ijsung@csie.nctu.edu.tw>
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ */
+
+#include <stdio.h>
+#include "device.h"
+#include <assert.h>
+#include <cyg/kernel/kapi.h>
+#include <cyg/io/io.h>                  /* I/O functions */
+#include <cyg/io/touch.h>               /* Touchscreen definitions */
+#include <cyg/hal/hal_arch.h>           /* CYGNUM_HAL_STACK_SIZE_TYPICAL */
+
+#define	SCALE		3	/* default scaling factor for acceleration */
+#define	THRESH		5	/* default threshhold for acceleration */
+
+static int  	NUL_Open(MOUSEDEVICE *pmd);
+static void 	NUL_Close(void);
+static int  	NUL_GetButtonInfo(void);
+static void	NUL_GetDefaultAccel(int *pscale,int *pthresh);
+static int  	NUL_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz, int *bp);
+
+MOUSEDEVICE mousedev = {
+	NUL_Open,
+	NUL_Close,
+	NUL_GetButtonInfo,
+	NUL_GetDefaultAccel,
+	NUL_Read,
+	NULL
+};
+static unsigned OldTouchX,TouchX, OldTouchY, TouchY, PenDown;
+static cyg_io_handle_t handle;
+static int changed=0;
+/*
+ * Open up the mouse device.
+ */
+static int
+NUL_Open(MOUSEDEVICE *pmd)
+{
+	Cyg_ErrNo err;
+	cyg_uint32 mode,len;
+	err = cyg_io_lookup("/dev/ts",&handle);
+
+	if ( err != ENOERR ) {
+		diag_printf( "Touchpad Open Failed %d\n", err );
+		return -1;
+	}
+	else
+		diag_printf("Touchpad Open successfully\n");
+	// Set the required mode:
+	//  Wait for events + report only pen-up / pen-down events + return events into array
+	len = sizeof(cyg_uint32);
+	mode = TS_REPORTMODE_BLOCKING | TS_REPORTMODE_UNPACKED;
+	err = cyg_io_set_config( handle, CYG_IO_SET_CONFIG_TS_REPORT_MODE, (void*)&mode, &len );
+	if ( err != ENOERR ) {
+		diag_printf( "Cannot set required touchscreen mode: %d\n", err );
+        	return -1;
+    	}
+
+	TouchX=0;
+	TouchY=0;
+	PenDown=0;
+	return 1;
+}
+
+/*
+ * Close the mouse device.
+ */
+static void
+NUL_Close(void)
+{
+}
+
+/*
+ * Get mouse buttons supported
+ */
+static int
+NUL_GetButtonInfo(void)
+{
+	return 1;
+}
+
+/*
+ * Get default mouse acceleration settings
+ */
+static void
+NUL_GetDefaultAccel(int *pscale,int *pthresh)
+{
+	*pscale = 1;
+	*pthresh = 100;
+}
+
+/* called by monitor in nanox */
+int
+Assabet_DetectMouseStateChange(void)
+{
+	cyg_uint32 len;
+	touch_event_t buff;
+	Cyg_ErrNo err;
+	while(1)
+	{
+		len = sizeof(buff);
+		err = cyg_io_read( handle, (void*)&buff, &len );
+ 		if ( err != ENOERR ) 
+		{
+			diag_printf("Assabet Touchpad READ failed %d\n", err );
+			return -1;
+        	}
+		else if ( len == 0 )
+		{
+			diag_printf("NO DATA\n");
+			cyg_thread_delay(200);
+			continue;
+        	}
+		OldTouchX=TouchX;
+		OldTouchY=TouchY;
+		PenDown=buff.pendown;
+		TouchX=buff.x;
+		TouchY=buff.y;
+		changed=1;
+		return 1;
+	}
+}
+
+/*
+ * Attempt to read bytes from the mouse and interpret them.
+ * Returns -1 on error, 0 if either no bytes were read or not enough
+ * was read for a complete state, or 1 if the new state was read.
+ * When a new state is read, the current buttons and x and y deltas
+ * are returned.  This routine does not block.
+ */
+static int
+NUL_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz, int *bp)
+{
+	*dx=0;
+	*dy=0;
+	*dz=0;
+	*bp=0;
+	if(changed)
+	{
+		*dx=TouchX-OldTouchX;
+		*dy=TouchY-OldTouchY;
+		*bp |= (PenDown?MWBUTTON_L:0);
+		changed=0;
+		return 1;
+	}
+	else
+		return 0;
+}
diff -urN lib/microwindows/src/drivers/mou_ecos_gtkserver.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_ecos_gtkserver.c
--- lib/microwindows/src/drivers/mou_ecos_gtkserver.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_ecos_gtkserver.c	2005-02-21 16:13:12.000000000 +0100
@@ -0,0 +1,115 @@
+/* GTK+ Server Mouse Driver based on Greg's NULL mouse driver
+ * Copyright (c) 2001 I-Jui Sung <ijsung@csie.nctu.edu.tw>
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * NULL Mouse Driver
+ */
+#include <stdio.h>
+#include "device.h"
+#include <assert.h>
+#include "gtkserv.h"
+
+#define	SCALE		3	/* default scaling factor for acceleration */
+#define	THRESH		5	/* default threshhold for acceleration */
+
+static int  	NUL_Open(MOUSEDEVICE *pmd);
+static void 	NUL_Close(void);
+static int  	NUL_GetButtonInfo(void);
+static void	NUL_GetDefaultAccel(int *pscale,int *pthresh);
+static int  	NUL_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz, int *bp);
+static int	OldMouseX,OldMouseY;
+extern serverinfo * ServerInfo;
+
+MOUSEDEVICE mousedev = {
+	NUL_Open,
+	NUL_Close,
+	NUL_GetButtonInfo,
+	NUL_GetDefaultAccel,
+	NUL_Read,
+	NULL
+};
+/*
+ * Open up the mouse device.
+ */
+static int
+NUL_Open(MOUSEDEVICE *pmd)
+{
+	assert(ServerInfo!=NULL);
+	OldMouseX=ServerInfo->mousex;
+	OldMouseY=ServerInfo->mousey;
+	ServerInfo->changed=0;
+	return 1;
+}
+
+/*
+ * Close the mouse device.
+ */
+static void
+NUL_Close(void)
+{
+}
+
+/*
+ * Get mouse buttons supported
+ */
+static int
+NUL_GetButtonInfo(void)
+{
+	return 3;
+}
+
+/*
+ * Get default mouse acceleration settings
+ */
+static void
+NUL_GetDefaultAccel(int *pscale,int *pthresh)
+{
+	*pscale = 1;
+	*pthresh = 100;
+}
+
+int
+GtkServ_DetectMouseStateChange(void)
+{
+	assert(ServerInfo!=NULL);
+	return ServerInfo->changed;
+}
+
+/*
+ * Attempt to read bytes from the mouse and interpret them.
+ * Returns -1 on error, 0 if either no bytes were read or not enough
+ * was read for a complete state, or 1 if the new state was read.
+ * When a new state is read, the current buttons and x and y deltas
+ * are returned.  This routine does not block.
+ */
+static int
+NUL_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz, int *bp)
+{
+	int state=ServerInfo->changed;
+	ServerInfo->changed=0;
+	*dx=0;
+	*dy=0;
+	*dz=0;
+	*bp=0;
+
+	if(state)
+	{
+		*dx=ServerInfo->mousex-OldMouseX;
+		*dy=ServerInfo->mousey-OldMouseY;
+		OldMouseX=ServerInfo->mousex;
+		OldMouseY=ServerInfo->mousey;
+		switch(ServerInfo->button)
+		{
+			case 1:
+				*bp |= MWBUTTON_L;
+				break;
+			case 2:
+				*bp |= MWBUTTON_R;
+				break;
+			case 3:
+				*bp |= MWBUTTON_M;
+				break;
+		}
+	}
+	return state;
+}
diff -urN lib/microwindows/src/drivers/mou_fbsd.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_fbsd.c
--- lib/microwindows/src/drivers/mou_fbsd.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_fbsd.c	2005-02-21 16:03:16.000000000 +0100
@@ -0,0 +1,113 @@
+/* #include <stdio.h> */
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include <machine/mouse.h>
+#include <machine/console.h>
+
+/* #include <vgl.h> */
+
+#include "device.h"
+
+#define SCALE 3
+#define THRESH 5
+
+
+static int FBSD_Open(MOUSEDEVICE *pmd);
+static void FBSD_Close(void);
+static int FBSD_GetButtonInfo(void);
+static void FBSD_GetDefaultAccel(int *pscale, int *pthresh);
+static int FBSD_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz,int *bp);
+MOUSEDEVICE mousedev = {
+    FBSD_Open,
+    FBSD_Close,
+    FBSD_GetButtonInfo,
+    FBSD_GetDefaultAccel,
+    FBSD_Read,
+    NULL
+};
+
+static int mouse_fd=0;
+
+static int FBSD_Open(MOUSEDEVICE *pmd)
+{
+
+    mousemode_t theMouseMode;
+
+    mouse_fd=open("/dev/sysmouse",O_RDONLY);
+    if(mouse_fd < 0)
+    {
+	return(-1);
+    }
+    ioctl(mouse_fd, MOUSE_GETMODE, &theMouseMode);
+    theMouseMode.level=1;
+    ioctl(mouse_fd, MOUSE_SETMODE, &theMouseMode);
+    return mouse_fd;
+    
+}
+
+static void FBSD_Close(void)
+{
+    if (mouse_fd > 0)
+    {
+	close(mouse_fd);
+    }
+    mouse_fd=0;
+
+}
+
+static int FBSD_GetButtonInfo(void)
+{
+    return MWBUTTON_L | MWBUTTON_M | MWBUTTON_R;
+}
+
+static void FBSD_GetDefaultAccel(int *pscale, int *pthresh)
+{
+    *pscale = SCALE;
+    *pthresh = THRESH;
+}
+
+extern void FBSD_handle_event(void);
+
+static int FBSD_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz,
+		     int *bp)
+
+{
+    mousestatus_t theStatus;
+    int butStat=0;
+    int retVal=0;
+
+    FBSD_handle_event();
+    
+    ioctl(mouse_fd,MOUSE_GETSTATUS, &theStatus);
+
+    if(theStatus.flags | MOUSE_POSCHANGED)
+    {
+	*dx=theStatus.dx;
+	*dy=theStatus.dy;
+	*dz=theStatus.dz;
+	retVal|=1;
+    }
+
+    if(theStatus.button & 0x1)
+    {
+	butStat|=MWBUTTON_L;
+	retVal|=1;
+    }
+    if(theStatus.button & 0x2)
+    {
+	butStat|=MWBUTTON_M;
+	retVal|=1;
+    }
+    if(theStatus.button & 0x4)
+    {
+	butStat|=MWBUTTON_R;
+	retVal|=1;
+    }
+	
+    *bp=butStat;
+    return retVal;
+}
diff -urN lib/microwindows/src/drivers/mou_gpm.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_gpm.c
--- lib/microwindows/src/drivers/mou_gpm.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_gpm.c	2005-02-21 16:13:09.000000000 +0100
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1999 Alex Holden
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * GPM Mouse Driver
+ *
+ * Rewritten to understand the Logitech Mouseman protocol which GPM
+ * produces on /dev/gpmdata when in repeater mode. Remember to start
+ * GPM with the -R flag or it won't work. (gpm -R -t ps2)
+ *
+ */
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include "device.h"
+
+#define	SCALE		3	/* default scaling factor for acceleration */
+#define	THRESH		5	/* default threshhold for acceleration */
+
+#define GPM_DEV_FILE	"/dev/gpmdata"
+
+static int  	GPM_Open(MOUSEDEVICE *pmd);
+static void 	GPM_Close(void);
+static int  	GPM_GetButtonInfo(void);
+static void	MOU_GetDefaultAccel(int *pscale,int *pthresh);
+static int  	GPM_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz, int *bp);
+
+MOUSEDEVICE mousedev = {
+	GPM_Open,
+	GPM_Close,
+	GPM_GetButtonInfo,
+	MOU_GetDefaultAccel,
+	GPM_Read,
+	NULL
+};
+
+static int mouse_fd;
+
+/*
+ * Open up the mouse device.
+ * Returns the fd if successful, or negative if unsuccessful.
+ */
+static int
+GPM_Open(MOUSEDEVICE *pmd)
+{
+	mouse_fd = open(GPM_DEV_FILE, O_NONBLOCK);
+	if (mouse_fd < 0)
+		return -1;
+	return mouse_fd;
+}
+
+/*
+ * Close the mouse device.
+ */
+static void
+GPM_Close(void)
+{
+	if (mouse_fd > 0)
+		close(mouse_fd);
+	mouse_fd = 0;
+}
+
+/*
+ * Get mouse buttons supported
+ */
+static int
+GPM_GetButtonInfo(void)
+{
+	return MWBUTTON_L | MWBUTTON_M | MWBUTTON_R;
+}
+
+/*
+ * Get default mouse acceleration settings
+ */
+static void
+MOU_GetDefaultAccel(int *pscale,int *pthresh)
+{
+	*pscale = SCALE;
+	*pthresh = THRESH;
+}
+
+/*
+ * Attempt to read bytes from the mouse and interpret them.
+ * Returns -1 on error, 0 if either no bytes were read or not enough
+ * was read for a complete state, or 1 if the new state was read.
+ * When a new state is read, the current buttons and x and y deltas
+ * are returned.  This routine does not block.
+ */
+static int
+GPM_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz, int *bp)
+{
+	static unsigned char buf[5];
+	static int nbytes;
+	int n;
+
+	while((n = read(mouse_fd, &buf[nbytes], 5 - nbytes))) {
+		if(n < 0) {
+			if ((errno == EINTR) || (errno == EAGAIN))
+				return 0;
+			else return -1;
+		}
+
+		nbytes += n;
+
+		if(nbytes == 5) {
+			/* button data matches defines, no conversion*/
+			*bp = (~buf[0]) & 0x07;
+			*dx = (signed char)(buf[1]) + (signed char)(buf[3]);
+			*dy = -((signed char)(buf[2]) + (signed char)(buf[4]));
+			*dz = 0;
+			nbytes = 0;
+			return 1;
+		}
+	}
+	return 0;
+}
diff -urN lib/microwindows/src/drivers/mou_harrier.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_harrier.c
--- lib/microwindows/src/drivers/mou_harrier.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_harrier.c	2005-02-21 16:03:16.000000000 +0100
@@ -0,0 +1,542 @@
+/*
+ * Microwindows touch screen driver for NEC Harrier Demo Board.
+ *
+ * Copyright (c) 2000 Century Software Embedded Technologies
+ *
+ * Requires /dev/tpanel kernel device driver for the VRC4173 chip 
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <math.h>
+#include <sys/ioctl.h>
+#include <linux/tpanel.h>
+#include "device.h"
+#include "mou_tp.h"
+
+/* Very basic handling for the touch panel */
+/* Mostly borrowed from mou_ipaq.c which I believe was mostly */
+/* borrowed from mou_tp.c */
+
+/* Define this if you want to use the filter instead of the average method */
+/* #define USE_FILTER */
+
+/* Defines used throughout */
+#define TP_STATUS_HARDDATALOST 0x1000
+#define TP_STATUS_SOFTDATALOST 0x2000
+#define TP_STATUS_PENCONTACT   0x4000
+#define TP_STATUS_DATAVALID    0x8000
+
+/* Fix these when we know the right size */
+
+#define TP_MIN_X_SIZE          291
+#define TP_MIN_Y_SIZE          355
+
+#define TP_MAX_X_SIZE          3839
+#define TP_MAX_Y_SIZE          3711
+
+#define DATA_STATUS  0
+#define DATA_YPLUS   1
+#define DATA_YMINUS  2
+#define DATA_XPLUS   3
+#define DATA_XMINUS  4
+#define DATA_Z       5
+
+
+#ifdef USE_FILTER
+#define MOU_SAMPLE_RATE   1
+#else
+#define MOU_SAMPLE_RATE   10
+#endif
+
+#define MOU_READ_INTERVAL 5000
+
+  /* Data format (from kernel driver): */
+  /* unsigned short status */
+  /* unsigned short x+ (raw) */
+  /* unsigned short x- (raw) */
+  /* unsigned short y+ (raw) */
+  /* unsigned short y- (raw) */
+  /* unsigned short z (presssure, raw) */
+
+static int pd_fd = -1;
+int enable_pointing_coordinate_transform = 1;
+
+static TRANSFORMATION_COEFFICIENTS tc;
+
+#ifndef TEST
+extern SCREENDEVICE scrdev;
+#endif
+
+#ifdef TEST
+#undef EPRINTF
+#undef DPRINTF
+
+#define EPRINTF printf
+#define DPRINTF printf
+#endif
+ 
+int GetPointerCalibrationData(void)
+{
+	/*
+	 * Read the calibration data from the calibration file.
+	 * Calibration file format is seven coefficients separated by spaces.
+	 */
+
+	/* Get pointer calibration data from this file */
+	const char cal_filename[] = "/etc/pointercal";
+
+	int items;
+
+	FILE* f = fopen(cal_filename, "r");
+	if ( f == NULL )
+	{
+		EPRINTF("Error %d opening pointer calibration file %s.\n",
+			errno, cal_filename);
+		EPRINTF("Please type \"/usr/bin/tpcal > %s\" to calibrate\n",
+			cal_filename);
+		return -1;
+	}
+
+	items = fscanf(f, "%d %d %d %d %d %d %d",
+		&tc.a, &tc.b, &tc.c, &tc.d, &tc.e, &tc.f, &tc.s);
+	if ( items != 7 )
+	{
+		EPRINTF("Improperly formatted pointer calibration file %s.\n",
+			cal_filename);
+		return -1;
+	}
+
+#if TEST
+		EPRINTF("a=%d b=%d c=%d d=%d e=%d f=%d s=%d\n",
+			tc.a, tc.b, tc.c, tc.d, tc.e, tc.f, tc.s);
+#endif
+
+	return 0;
+}
+
+inline MWPOINT DeviceToScreen(MWPOINT p)
+{
+	/*
+	 * Transform device coordinates to screen coordinates.
+	 * Take a point p in device coordinates and return the corresponding
+	 * point in screen coodinates.
+	 * This can scale, translate, rotate and/or skew, based on the
+	 * coefficients calculated above based on the list of screen
+	 * vs. device coordinates.
+	 */
+
+	static MWPOINT prev;
+	/* set slop at 3/4 pixel */
+	const short slop = TRANSFORMATION_UNITS_PER_PIXEL * 3 / 4;
+	MWPOINT new, out;
+
+	/* transform */
+	new.x = (tc.a * p.x + tc.b * p.y + tc.c) / tc.s;
+	new.y = (tc.d * p.x + tc.e * p.y + tc.f) / tc.s;
+
+	/* hysteresis (thanks to John Siau) */
+	if ( abs(new.x - prev.x) >= slop )
+		out.x = (new.x | 0x3) ^ 0x3;
+	else
+		out.x = prev.x;
+
+	if ( abs(new.y - prev.y) >= slop )
+		out.y = (new.y | 0x3) ^ 0x3;
+	else
+		out.y = prev.y;
+
+	prev = out;
+
+	return out;
+}
+
+static int PD_Open(MOUSEDEVICE *pmd)
+{
+  struct scanparam s;
+  int settle_upper_limit;
+  int result;
+  
+  /* Open the device */
+  pd_fd = open("/dev/tpanel", O_NONBLOCK);
+  
+  if (pd_fd < 0)
+    {
+      EPRINTF("Error %d opening touch panel\n", errno);
+      return -1;
+    }
+
+  s.interval = MOU_READ_INTERVAL;
+
+  /*
+   * Upper limit on settle time is approximately (scan_interval / 5) - 60
+   * (5 conversions and some fixed overhead)
+   * The opmtimal value is the lowest that doesn't cause significant
+   * distortion.
+   */
+
+  settle_upper_limit = (s.interval / 5) - 60;
+  s.settletime = settle_upper_limit * 50 / 100;
+  result = ioctl(pd_fd, TPSETSCANPARM, &s);
+
+  if ( result < 0 )
+    EPRINTF("Error %d, result %d setting scan parameters.\n",
+	    result, errno);
+  
+  if (enable_pointing_coordinate_transform)
+    { 
+      if (GetPointerCalibrationData() < 0)
+	{
+	  close(pd_fd);
+	  return -1;
+	}
+    }
+  
+  /* We choose not to hide the cursor for now, others may want to */
+  
+#ifdef NOTUSED
+#ifndef TEST
+    /* Hide the cursor */
+  GdHideCursor(&scrdev);
+#endif
+#endif
+  
+  return(pd_fd);
+}
+
+static void PD_Close(void)
+{
+ 	/* Close the touch panel device. */
+	if (pd_fd >= 0)
+		close(pd_fd);
+	pd_fd = -1;
+}
+
+static int PD_GetButtonInfo(void)
+{
+ 	/* get "mouse" buttons supported */
+	return MWBUTTON_L;
+}
+
+static void PD_GetDefaultAccel(int *pscale,int *pthresh)
+{
+	/*
+	 * Get default mouse acceleration settings
+	 * This doesn't make sense for a touch panel.
+	 * Just return something inconspicuous for now.
+	 */
+	*pscale = 3;
+	*pthresh = 5;
+}
+
+#define MAX_DEVICE_READS 10
+static int read_tp(unsigned short *x, unsigned short *y, 
+		   unsigned short *z, int *b, unsigned short *status, unsigned char block)
+{
+  unsigned char read_count = 0;
+  unsigned short tempx, tempy;
+  int bytes_read;
+  unsigned short data[6];
+  
+  /* Uh, oh -- The driver is slow and fat, so we get lots of EAGAINS between   */
+  /* reads.  Thats never good.  So we loop here for some count before we bail  */
+
+  while(read_count < MAX_DEVICE_READS)
+    {
+      bytes_read = read(pd_fd, data, sizeof(data));
+  
+      if (bytes_read != sizeof(data))
+	{
+	  if (errno != EAGAIN)
+	    {
+	      EPRINTF("Error reading touch panel.  errno = %d\n", errno);
+	      return(errno);
+	    }
+
+	  if (block)
+	    {
+	      if (read_count++ == MAX_DEVICE_READS)
+		return(EAGAIN);
+	      else
+		usleep(MOU_READ_INTERVAL / MAX_DEVICE_READS);
+	    }
+	  else
+	    return(EAGAIN);
+	}
+      else
+	break;
+    }
+
+  tempx = data[DATA_XPLUS];
+  tempy = data[DATA_YPLUS];
+
+  /* Sanity check */
+  /* This is based on measured values.  Occassionally, we get a bad read from the board */
+  /* This is to ensure that really wacked out reads don't get through.                  */
+
+  if ((data[DATA_STATUS] & TP_STATUS_DATAVALID) == TP_STATUS_DATAVALID)
+    {
+       if (enable_pointing_coordinate_transform)
+	 {
+	   if (tempx < TP_MIN_X_SIZE || tempx > TP_MAX_X_SIZE)
+	     {
+#ifdef TEST
+	       EPRINTF("Got an out of range X value.  X=%d,Y=%d,B=%d\n",
+		       tempx, tempy, 
+		       ((data[DATA_STATUS] & TP_STATUS_PENCONTACT) ? MWBUTTON_L : 0));
+#endif
+	       return(EAGAIN);
+	     }
+	   
+	   if (tempy < TP_MIN_Y_SIZE || tempy > TP_MAX_Y_SIZE)
+	     {
+#ifdef TEST
+	       EPRINTF("Got an out of range Y value.  X=%d,Y=%d,B=%d\n",
+		       tempx, tempy, 
+		       ((data[DATA_STATUS] & TP_STATUS_PENCONTACT) ? MWBUTTON_L : 0));
+#endif
+	       return(EAGAIN);
+	     }
+	 }
+
+       *x = tempx;
+       *y = tempy;
+       *z = data[DATA_Z];
+    }
+  else
+    { 
+      *x = 0;
+      *y = 0;
+      *z = 0;
+    }
+
+  *b = ((data[DATA_STATUS] & TP_STATUS_PENCONTACT) ? MWBUTTON_L : 0);  
+  *status = data[DATA_STATUS];
+
+  return(0);
+}
+
+
+static int PD_Read(MWCOORD *px, MWCOORD *py, MWCOORD *pz, int *pb)
+{
+#ifdef USE_FILTER
+  /* Filter stuff borrowed from mou_tp.c */
+  const int iir_shift_bits = 3;
+  const int iir_sample_depth = (1 << iir_shift_bits);
+  
+  static int iir_accum_x = 0;
+  static int iir_accum_y = 0;
+  static int iir_accum_z = 0;
+  static int iir_count = 0;
+#else
+  double cx, cy, cz;
+#endif
+
+  /* Other local variables */
+  MWPOINT transformed;
+  int err = 0;
+  unsigned short samples = 0;
+  unsigned short xpos = 0;
+  unsigned short ypos = 0;
+  unsigned short zpos = 0;
+  unsigned short status = 0;
+
+  *pb = 0;
+  *px = 0;
+  *py = 0;
+  *pz = 0;
+
+#ifndef USE_FILTER
+  cx = 0;
+  cy = 0;
+  cz = 0;
+#endif
+
+  if ((err = read_tp(&xpos, &ypos, &zpos, pb, &status, 0)))
+    {
+      if (err == EAGAIN)
+	return(0);
+      else
+	return(1);
+    }
+
+  /* Check the status of the button */
+
+  if ( (status & TP_STATUS_DATAVALID) != TP_STATUS_DATAVALID)
+    {
+      if (*pb)
+	return(0);
+      else
+	goto button_up;
+    }
+
+  while((status & TP_STATUS_DATAVALID) == TP_STATUS_DATAVALID)
+    {
+      int tempb = 0;
+
+      err = read_tp(&xpos, &ypos, &zpos, &tempb, &status, 1);
+ 
+      if (err == EAGAIN)
+	{
+	  if (!samples)
+	    continue; /* We need at least one reading! */
+	  else
+	    break; /* The device continues to not respond.  Bail */
+	}
+      else if (err)
+	return(-1);
+
+      /* If the data is invalid and the button is down, then bail */
+      /* Otherwise, record the button data */
+     
+      if ( (status & TP_STATUS_DATAVALID) != TP_STATUS_DATAVALID)
+	{
+	  if (tempb)
+	    return(0); /* Button is down, but data is invalid */      
+	  else 
+	    {
+	      *pb = tempb; /* Record button up */
+	      goto button_up;
+	    }
+	}
+
+#ifdef USE_FILTER
+
+      /* Run the newly aquired data through a filter */
+      /* is filter ready? */
+      if ( iir_count == iir_sample_depth )
+	{
+	  /* make room for new sample */
+	  iir_accum_x -= iir_accum_x >> iir_shift_bits;
+	  iir_accum_y -= iir_accum_y >> iir_shift_bits;
+	  iir_accum_z -= iir_accum_z >> iir_shift_bits;
+	  
+	  /* feed new sample to filter */
+	  iir_accum_x += xpos;
+	  iir_accum_y += ypos;
+	  iir_accum_z += zpos;
+	}
+      else
+	{
+	  iir_accum_x += xpos;
+	  iir_accum_y += ypos;
+	  iir_accum_z += zpos;
+	  iir_count += 1;
+	}
+
+#else
+      cx += xpos;
+      cy += ypos;
+      cz += zpos;
+#endif
+
+      samples++;
+      
+      /* Enough samples?? */
+      if (samples >= MOU_SAMPLE_RATE)
+	break;
+    }
+
+  if (!samples)
+    return(0);
+
+#ifdef USE_FILTER  
+  /* We're not done gathering samples yet */
+  if (iir_count < iir_sample_depth)
+    return(0);
+
+  if (enable_pointing_coordinate_transform)
+    {	  
+      /* transform x,y to screen coords */
+      transformed.x = iir_accum_x;
+      transformed.y = iir_accum_y;
+      transformed = DeviceToScreen(transformed);
+      
+      *px = transformed.x >> 2;
+      *py = transformed.y >> 2;
+    }
+  else
+    {
+      *px = (MWCOORD) abs(iir_accum_x);
+      *py = (MWCOORD) abs(iir_accum_y);
+    }
+#else
+  
+  if (enable_pointing_coordinate_transform)
+    {
+      transformed.x = (cx / samples);
+      transformed.y = (cy / samples);
+      
+      transformed = DeviceToScreen(transformed);
+      
+      *px = (MWCOORD) transformed.x >> 2;
+      *py = (MWCOORD) transformed.y >> 2;
+    }
+  else
+    {
+      *px = (MWCOORD) abs(cx / samples);
+      *py = (MWCOORD) abs(cy / samples);
+    }
+#endif
+  
+ button_up:
+  if (! *pb)
+    {
+#ifdef USE_FILTER 
+     /* reset the filter */
+      iir_count = 0;
+      iir_accum_x = 0;
+      iir_accum_y = 0;
+      iir_accum_z = 0;
+#endif
+      return(3);
+    }
+  else
+    return(2); /* XYZ and button data */
+
+}
+
+#ifndef TEST
+MOUSEDEVICE mousedev = {
+	PD_Open,
+	PD_Close,
+	PD_GetButtonInfo,
+	PD_GetDefaultAccel,
+	PD_Read,
+	NULL
+};
+#endif
+
+#ifdef TEST
+int main(int argc, char ** v)
+{
+	int x, y, z;
+
+	int	b;
+	int result;
+	
+	DPRINTF("Opening touch panel...\n");
+
+	if((result=PD_Open(0)) < 0)
+	  {
+	    
+	    DPRINTF("Error %d, result %d opening touch-panel\n", errno, result);
+	    exit(0);
+	  }
+
+	DPRINTF("Reading touch panel...\n");
+
+	while(1) 
+	  {
+	    result = PD_Read(&x, &y, &z, &b);
+	    
+	    if( result > 0) 
+	      {
+		DPRINTF("(%d,%d,%d) b = %d\n",x, y, z, b);		
+	      }
+	  }
+}
+#endif
+
diff -urN lib/microwindows/src/drivers/mou_ipaq.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_ipaq.c
--- lib/microwindows/src/drivers/mou_ipaq.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_ipaq.c	2005-02-21 16:13:09.000000000 +0100
@@ -0,0 +1,194 @@
+/*
+ * Microwindows touch screen driver for UCB1200 & UCB1300's
+ * used with ARM boards, including Compaq iPAQ and Intel Assabet.
+ *
+ * Copyright (c) 2000 Century Software Embedded Technologies
+ *
+ * iPAQ/Assabet: Requires /dev/h3600_ts kernel driver (char 11,0).
+ * L7200: Requires /dev/touchscreen/ucb1x00-ts
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <math.h>
+#include <sys/ioctl.h>
+#include "device.h"
+
+#define TOUCHDEVICE	"/dev/h3600_ts"			/* iPAQ*/
+/*define TOUCHDEVICE	"/dev/touchscreen/ucb1x00" */	/* L7200*/
+
+/* file descriptor for touch panel */
+static int pd_fd = -1;
+
+/* Hack extern to used when hiding the mouse cursor
+ * There needs to be a better way to do this
+*/
+extern SCREENDEVICE scrdev;
+
+static int PD_Open(MOUSEDEVICE *pmd)
+{
+ 	/*
+	 * open up the touch-panel device.
+	 * Return the fd if successful, or negative if unsuccessful.
+	 */
+
+	pd_fd = open(TOUCHDEVICE, O_NONBLOCK);
+	if (pd_fd < 0) {
+		EPRINTF("Error %d opening touch panel\n", errno);
+		return -1;
+	}
+
+	GdHideCursor(&scrdev);
+	return pd_fd;
+}
+
+static void PD_Close(void)
+{
+ 	/* Close the touch panel device. */
+	if (pd_fd >= 0)
+		close(pd_fd);
+	pd_fd = -1;
+}
+
+static int PD_GetButtonInfo(void)
+{
+ 	/* get "mouse" buttons supported */
+	return MWBUTTON_L;
+}
+
+static void PD_GetDefaultAccel(int *pscale,int *pthresh)
+{
+	/*
+	 * Get default mouse acceleration settings
+	 * This doesn't make sense for a touch panel.
+	 * Just return something inconspicuous for now.
+	 */
+	*pscale = 3;
+	*pthresh = 5;
+}
+
+static int PD_Read(MWCOORD *px, MWCOORD *py, MWCOORD *pz, int *pb)
+{
+	/* read a data point */
+	short data[4];
+	int bytes_read;
+
+	bytes_read = read(pd_fd, data, sizeof(data));
+
+	if (bytes_read != sizeof(data)) {
+		if (errno == EINTR || errno == EAGAIN)
+			return 0;
+		/*
+		 * kernel driver bug: select returns read available,
+		 * but read returns -1
+		 * we return 0 here to avoid GsError above
+		 */
+		/*return -1;*/
+		return 0;
+	}
+
+	*px = (MWCOORD)data[1];
+	*py = (MWCOORD)data[2];
+
+	*pb = (data[0] ? MWBUTTON_L : 0);
+
+	*pz = 0;
+
+	if(! *pb )
+	  return 3;			/* only have button data */
+	else 
+	  return 2;			/* have full set of data */
+}
+
+MOUSEDEVICE mousedev = {
+	PD_Open,
+	PD_Close,
+	PD_GetButtonInfo,
+	PD_GetDefaultAccel,
+	PD_Read,
+	NULL
+};
+
+#ifdef TEST
+int main(int argc, char ** v)
+{
+	MWCOORD x, y, z;
+	int	b;
+	int result;
+	int mouse = -1;
+	DPRINTF("Opening touch panel...\n");
+
+	if((result=PD_Open(0)) < 0)
+		DPRINTF("Error %d, result %d opening touch-panel\n", errno, result);
+
+	/* This stuff below can be used to set some of the parameters of the
+	 * driver from the command line before going in to the test loop.
+	 * Could this have been done better? Yup.
+	 */
+
+	if(argc > 1) {
+		ioctl(result,1,atoi(v[1]));
+		DPRINTF("Setting pressure to %d\n",atoi(v[1]));
+	} 
+	if(argc > 2) {
+		ioctl(result,2,atoi(v[2]));
+		DPRINTF("Setting updelay to %d\n",atoi(v[2]));
+	}
+	if(argc > 3) {
+		ioctl(result,3,atoi(v[3]));
+		DPRINTF("Setting raw x to %d\n",atoi(v[3]));
+	}
+	if(argc > 4) {
+		ioctl(result,4,atoi(v[4]));
+		DPRINTF("Setting raw y to %d\n",atoi(v[4]));
+	} 
+	if(argc > 5) {
+		ioctl(result,5,atoi(v[5]));
+		DPRINTF("Setting res x to %d\n",atoi(v[5]));
+	}
+	if(argc > 6) {
+		ioctl(result,6,atoi(v[6]));
+		DPRINTF("Setting res y to %d\n",atoi(v[6]));
+	}
+	if(argc > 7) {
+		ioctl(result,7,atoi(v[7]));
+		DPRINTF("Setting fudge x to %d\n",atoi(v[7]));
+	}
+	if(argc > 8) {
+		ioctl(result,8,atoi(v[8]));
+		DPRINTF("Setting fudge y to %d\n",atoi(v[8]));
+	}
+	if(argc > 9) {
+		ioctl(result,9,atoi(v[9]));
+		DPRINTF("Setting average sample to %d\n",atoi(v[9]));
+	} 
+	if(argc > 10) {
+		ioctl(result,10,atoi(v[10]));
+		DPRINTF("Setting raw min x to %d\n",atoi(v[10]));
+	}
+	if(argc > 11) {
+		ioctl(result,11,atoi(v[11]));
+		DPRINTF("Setting raw min y to %d\n",atoi(v[11]));
+	} 
+
+	DPRINTF("Reading touch panel...\n");
+
+	while(1) {
+		result = PD_Read(&x, &y, &z, &b);
+		if( result > 0) {
+			if(mouse != b) {
+				mouse = b;
+				if(mouse) 
+					DPRINTF("Pen Down\n");
+				else
+					DPRINTF("Pen Up\n");
+			}
+
+			DPRINTF("%d,%d,%d,%d,%d\n", result, x, y, z, b);
+
+		}
+	}
+}
+#endif
diff -urN lib/microwindows/src/drivers/mou_null.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_null.c
--- lib/microwindows/src/drivers/mou_null.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_null.c	2005-02-21 16:03:16.000000000 +0100
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * NULL Mouse Driver
+ */
+#include <stdio.h>
+#include "device.h"
+
+#define	SCALE		3	/* default scaling factor for acceleration */
+#define	THRESH		5	/* default threshhold for acceleration */
+
+static int  	NUL_Open(MOUSEDEVICE *pmd);
+static void 	NUL_Close(void);
+static int  	NUL_GetButtonInfo(void);
+static void	NUL_GetDefaultAccel(int *pscale,int *pthresh);
+static int  	NUL_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz, int *bp);
+static int  	NUL_Poll(void);
+
+MOUSEDEVICE mousedev = {
+	NUL_Open,
+	NUL_Close,
+	NUL_GetButtonInfo,
+	NUL_GetDefaultAccel,
+	NUL_Read,
+	NUL_Poll
+};
+
+/*
+ * Poll for events
+ */
+
+static int
+NUL_Poll(void)
+{
+  return 0;
+}
+
+/*
+ * Open up the mouse device.
+ */
+static int
+NUL_Open(MOUSEDEVICE *pmd)
+{
+	return -2;	/* no mouse*/
+}
+
+/*
+ * Close the mouse device.
+ */
+static void
+NUL_Close(void)
+{
+}
+
+/*
+ * Get mouse buttons supported
+ */
+static int
+NUL_GetButtonInfo(void)
+{
+	return 0;
+}
+
+/*
+ * Get default mouse acceleration settings
+ */
+static void
+NUL_GetDefaultAccel(int *pscale,int *pthresh)
+{
+	*pscale = SCALE;
+	*pthresh = THRESH;
+}
+
+/*
+ * Attempt to read bytes from the mouse and interpret them.
+ * Returns -1 on error, 0 if either no bytes were read or not enough
+ * was read for a complete state, or 1 if the new state was read.
+ * When a new state is read, the current buttons and x and y deltas
+ * are returned.  This routine does not block.
+ */
+static int
+NUL_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz, int *bp)
+{
+	return 0;
+}
diff -urN lib/microwindows/src/drivers/mou_ps5.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_ps5.c
--- lib/microwindows/src/drivers/mou_ps5.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_ps5.c	2005-02-21 16:03:16.000000000 +0100
@@ -0,0 +1,184 @@
+/*
+ * Microwindows touch screen driver for Psion 5
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <math.h>
+#include <sys/ioctl.h>
+#define _LINUX_TYPES_H
+#include <linux/fb.h>
+#include </linux/include/asm-arm/arch/touch_psion.h>
+
+#include "device.h"
+
+/* file descriptor for touch panel */
+static int pd_fd;
+
+/* Hack extern to used when hiding the mouse cursor
+ * There needs to be a better way to do this
+*/
+extern SCREENDEVICE scrdev;
+
+static int PD_Open(MOUSEDEVICE *pmd)
+{
+ 	/*
+	 * open up the touch-panel device.
+	 * Return the fd if successful, or negative if unsuccessful.
+	 */
+
+	pd_fd = open("/dev/touch_psion", O_NONBLOCK);
+	if (pd_fd < 0) {
+		fprintf(stderr, "Error %d opening touch panel\n", errno);
+		return -1;
+	}
+
+	GdHideCursor(&scrdev);
+	return pd_fd;
+}
+
+static void PD_Close(void)
+{
+ 	/* Close the touch panel device. */
+	fprintf(stderr,"PD_Close called\n");
+	if (pd_fd > 0)
+		close(pd_fd);
+	pd_fd = 0;
+}
+
+static int PD_GetButtonInfo(void)
+{
+ 	/* get "mouse" buttons supported */
+	return MWBUTTON_L;
+}
+
+static void PD_GetDefaultAccel(int *pscale,int *pthresh)
+{
+	/*
+	 * Get default mouse acceleration settings
+	 * This doesn't make sense for a touch panel.
+	 * Just return something inconspicuous for now.
+	 */
+	*pscale = 3;
+	*pthresh = 5;
+}
+
+static int PD_Read(MWCOORD *px, MWCOORD *py, MWCOORD *pz, int *pb)
+{
+	/* read a data point */
+        struct touch_psion_event data;
+	int bytes_read;
+
+	bytes_read = read(pd_fd, &data, sizeof(data));
+
+	if (bytes_read != sizeof(data)) {
+		if (errno == EINTR || errno == EAGAIN)
+			return 0;
+		return -1;
+	}
+
+	*px = (MWCOORD)data.x_c;
+	*py = (MWCOORD)data.y_c;
+
+	*pb = (data.down>0?MWBUTTON_L:0);
+	*pz = 0;
+
+	if((*px == -1 || *py == -1) && *pb >= 0)
+		return 3;			/* only have button data */
+	if((*px == -1 || *py == -1) && *pb < 0)
+		return 0;			/* don't have any data   */
+	return 2;				/* have full set of data */
+}
+
+MOUSEDEVICE mousedev = {
+	PD_Open,
+	PD_Close,
+	PD_GetButtonInfo,
+	PD_GetDefaultAccel,
+	PD_Read,
+	NULL
+};
+
+#ifdef TEST
+int main(int argc, char ** v)
+{
+	MWCOORD 	x, y, z;
+	MWBUTTON	b;
+	int result;
+	int mouse = -1;
+	printf("Opening touch panel...\n");
+
+	if((result=PD_Open(0)) < 0)
+		printf("Error %d, result %d opening touch-panel\n", errno, result);
+
+	/* This stuff below can be used to set some of the parameters of the
+	 * driver from the command line before going in to the test loop.
+	 * Could this have been done better? Yup.
+	 */
+
+	if(argc > 1) {
+		ioctl(result,1,atoi(v[1]));
+		fprintf(stderr,"Setting pressure to %d\n",atoi(v[1]));
+	} 
+	if(argc > 2) {
+		ioctl(result,2,atoi(v[2]));
+		fprintf(stderr,"Setting updelay to %d\n",atoi(v[2]));
+	}
+	if(argc > 3) {
+		ioctl(result,3,atoi(v[3]));
+		fprintf(stderr,"Setting raw x to %d\n",atoi(v[3]));
+	}
+	if(argc > 4) {
+		ioctl(result,4,atoi(v[4]));
+		fprintf(stderr,"Setting raw y to %d\n",atoi(v[4]));
+	} 
+	if(argc > 5) {
+		ioctl(result,5,atoi(v[5]));
+		fprintf(stderr,"Setting res x to %d\n",atoi(v[5]));
+	}
+	if(argc > 6) {
+		ioctl(result,6,atoi(v[6]));
+		fprintf(stderr,"Setting res y to %d\n",atoi(v[6]));
+	}
+	if(argc > 7) {
+		ioctl(result,7,atoi(v[7]));
+		fprintf(stderr,"Setting fudge x to %d\n",atoi(v[7]));
+	}
+	if(argc > 8) {
+		ioctl(result,8,atoi(v[8]));
+		fprintf(stderr,"Setting fudge y to %d\n",atoi(v[8]));
+	}
+	if(argc > 9) {
+		ioctl(result,9,atoi(v[9]));
+		fprintf(stderr,"Setting average sample to %d\n",atoi(v[9]));
+	} 
+	if(argc > 10) {
+		ioctl(result,10,atoi(v[10]));
+		fprintf(stderr,"Setting raw min x to %d\n",atoi(v[10]));
+	}
+	if(argc > 11) {
+		ioctl(result,11,atoi(v[11]));
+		fprintf(stderr,"Setting raw min y to %d\n",atoi(v[11]));
+	} 
+
+	printf("Reading touch panel...\n");
+
+	while(1) {
+		result = PD_Read(&x, &y, &z, &b);
+		if( result > 0) {
+			if(mouse != b) {
+				mouse = b;
+				if(mouse) 
+					printf("Pen Down\n");
+				else
+					printf("Pen Up\n");
+			}
+
+			printf("%d,%d,%d,%d,%d\n", result, x, y, z, b);
+
+		}
+	}
+}
+#endif
diff -urN lib/microwindows/src/drivers/mou_ser.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_ser.c
--- lib/microwindows/src/drivers/mou_ser.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_ser.c	2005-02-21 16:13:09.000000000 +0100
@@ -0,0 +1,472 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * UNIX Serial Port Mouse Driver
+ * 
+ * This driver opens a serial port directly, and interprets serial data.
+ * Microsoft, PC, Logitech and PS/2 mice are supported.
+ * The PS/2 mouse is supported by using the /dev/psaux device.
+ *
+ * The following environment variables control the mouse type expected
+ * and the serial port to open.
+ *
+ * Environment Var	Default		Allowed
+ * MOUSE_TYPE		pc		ms, pc, logi, ps2
+ * MOUSE_PORT		/dev/ttyS1	any serial port or /dev/psaux
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include "device.h"
+
+#define TERMIOS		1	/* set to use termios serial port control*/
+#define SGTTY		0	/* set to use sgtty serial port control*/
+
+#define	SCALE		3	/* default scaling factor for acceleration */
+#define	THRESH		5	/* default threshhold for acceleration */
+
+#if TERMIOS
+#include <termios.h>
+#endif
+#if SGTTY
+#include <sgtty.h>
+#endif
+
+/* default settings*/
+#if _MINIX
+#define	MOUSE_PORT	"/dev/mouse"
+#define	MOUSE_TYPE	"ms"
+#else
+#if ELKS
+#define	MOUSE_PORT	"/dev/ttys0"	/* default mouse tty port */
+#else
+#define	MOUSE_PORT	"/dev/ttyS1"	/* default mouse tty port */
+#endif
+#define	MOUSE_TYPE	"pc"		/* default mouse type "ms","pc","ps2" */
+#endif
+#define MAX_BYTES	128		/* number of bytes for buffer */
+
+/* states for the mouse*/
+#define	IDLE			0		/* start of byte sequence */
+#define	XSET			1		/* setting x delta */
+#define	YSET			2		/* setting y delta */
+#define	XADD			3		/* adjusting x delta */
+#define	YADD			4		/* adjusting y delta */
+
+/* values in the bytes returned by the mouse for the buttons*/
+#define	PC_LEFT_BUTTON		4
+#define PC_MIDDLE_BUTTON	2
+#define PC_RIGHT_BUTTON		1
+
+#define	MS_LEFT_BUTTON		2
+#define MS_RIGHT_BUTTON		1
+
+#define PS2_CTRL_BYTE		0x08
+#define PS2_LEFT_BUTTON		1
+#define PS2_RIGHT_BUTTON	2
+
+/* Bit fields in the bytes sent by the mouse.*/
+#define TOP_FIVE_BITS		0xf8
+#define BOTTOM_THREE_BITS	0x07
+#define TOP_BIT			0x80
+#define SIXTH_BIT		0x40
+#define BOTTOM_TWO_BITS		0x03
+#define THIRD_FOURTH_BITS	0x0c
+#define BOTTOM_SIX_BITS  	0x3f
+
+/* local data*/
+static int		mouse_fd;	/* file descriptor for mouse */
+static int		state;		/* IDLE, XSET, ... */
+static int		buttons;	/* current mouse buttons pressed*/
+static int		availbuttons;	/* which buttons are available */
+static MWCOORD		xd;		/* change in x */
+static MWCOORD		yd;		/* change in y */
+
+static int		left;		/* because the button values change */
+static int		middle;		/* between mice, the buttons are */
+static int		right;		/* redefined */
+
+static unsigned char	*bp;		/* buffer pointer */
+static int		nbytes;		/* number of bytes left */
+static unsigned char	buffer[MAX_BYTES];	/* data bytes read */
+static int		(*parse)();	/* parse routine */
+
+/* local routines*/
+static int  	MOU_Open(MOUSEDEVICE *pmd);
+static void 	MOU_Close(void);
+static int  	MOU_GetButtonInfo(void);
+static void	MOU_GetDefaultAccel(int *pscale,int *pthresh);
+static int  	MOU_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz, int *bptr);
+static int	MOU_Poll(void);
+static int  	ParsePC(int);		/* routine to interpret PC mouse */
+static int  	ParseMS(int);		/* routine to interpret MS mouse */
+static int  	ParsePS2(int);		/* routine to interpret PS/2 mouse */
+
+MOUSEDEVICE mousedev = {
+	MOU_Open,
+	MOU_Close,
+	MOU_GetButtonInfo,
+	MOU_GetDefaultAccel,
+	MOU_Read,
+#if _MINIX
+	MOU_Poll
+#else
+	NULL
+#endif
+};
+
+/*
+ * Open up the mouse device.
+ * Returns the fd if successful, or negative if unsuccessful.
+ */
+static int
+MOU_Open(MOUSEDEVICE *pmd)
+{
+	char	*type;
+	char	*port;
+	struct termios termios;
+
+	/* get mouse type and port*/
+	if( !(type = getenv("MOUSE_TYPE")))
+		type = MOUSE_TYPE;
+
+	if( !(port = getenv("MOUSE_PORT")))
+		port = MOUSE_PORT;
+
+	/* set button bits and parse procedure*/
+	if(!strcmp(type, "pc") || !strcmp(type, "logi")) {
+		/* pc or logitech mouse*/
+		left = PC_LEFT_BUTTON;
+		middle = PC_MIDDLE_BUTTON;
+		right = PC_RIGHT_BUTTON;
+		parse = ParsePC;
+	} else if (strcmp(type, "ms") == 0) {
+		/* microsoft mouse*/
+		left = MS_LEFT_BUTTON;
+		right = MS_RIGHT_BUTTON;
+		middle = 0;
+		parse = ParseMS;
+	} else if (strcmp(type, "ps2") == 0) {
+		/* PS/2 mouse*/
+		left = PS2_LEFT_BUTTON;
+		right = PS2_RIGHT_BUTTON;
+		middle = 0;
+		parse = ParsePS2;
+	} else
+		return -1;
+
+	/* open mouse port*/
+	mouse_fd = open(port, O_NONBLOCK);
+	if (mouse_fd < 0) {
+		EPRINTF("Error %d opening serial mouse type %s on port %s.\n",
+			errno, type, port);
+ 		return -1;
+	}
+
+#if SGTTY
+	/* set rawmode serial port using sgtty*/
+	struct sgttyb sgttyb;
+
+	if (ioctl(fd, TIOCGETP, &sgttyb) == -1)
+		goto err;
+	sgttyb.sg_flags |= RAW;
+	sgttyb.sg_flags &= ~(EVENP | ODDP | ECHO | XTABS | CRMOD);
+
+	if (ioctl(fd, TIOCSETP, &sgttyb) == -1)
+		goto err;
+	if (ioctl(fd, TIOCFLUSH, 0) < 0)
+		goto err;
+#endif
+
+#if TERMIOS
+	/*
+	 * Note we don't check success for the tcget/setattr calls,
+	 * some kernels don't support them for certain devices
+	 * (like /dev/psaux).
+	 */
+
+	/* set rawmode serial port using termios*/
+	tcgetattr(mouse_fd, &termios);
+
+	/* These functions appear to be broken in ELKS Dev86 */
+	if(cfgetispeed(&termios) != B1200)
+		cfsetispeed(&termios, B1200);
+#if _MINIX
+	if(cfgetospeed(&termios) != B1200)
+		cfsetospeed(&termios, B1200);
+#endif
+
+#if !_MINIX
+	termios.c_cflag &= ~CBAUD;
+	termios.c_cflag |= B1200;
+#endif
+	termios.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN | ISIG);
+	termios.c_iflag &= ~(ICRNL | INPCK | ISTRIP | IXON | BRKINT | IGNBRK);
+	termios.c_cflag &= ~(CSIZE | PARENB);
+	termios.c_cflag |= CS8;
+	termios.c_cc[VMIN] = 0;
+	termios.c_cc[VTIME] = 0;
+
+	tcsetattr(mouse_fd, TCSAFLUSH, &termios);
+#endif /* TERMIOS*/
+
+	/* initialize data*/
+	availbuttons = left | middle | right;
+	state = IDLE;
+	nbytes = 0;
+	buttons = 0;
+	xd = 0;
+	yd = 0;
+	return mouse_fd;
+err:
+	close(mouse_fd);
+	mouse_fd = 0;
+	return -1;
+}
+
+/*
+ * Close the mouse device.
+ */
+static void
+MOU_Close(void)
+{
+	if (mouse_fd > 0) {
+		close(mouse_fd);
+	}
+	mouse_fd = 0;
+}
+
+/*
+ * Get mouse buttons supported
+ */
+static int
+MOU_GetButtonInfo(void)
+{
+	return availbuttons;
+}
+
+/*
+ * Get default mouse acceleration settings
+ */
+static void
+MOU_GetDefaultAccel(int *pscale,int *pthresh)
+{
+	*pscale = SCALE;
+	*pthresh = THRESH;
+}
+
+/*
+ * Attempt to read bytes from the mouse and interpret them.
+ * Returns -1 on error, 0 if either no bytes were read or not enough
+ * was read for a complete state, or 1 if the new state was read.
+ * When a new state is read, the current buttons and x and y deltas
+ * are returned.  This routine does not block.
+ */
+static int
+MOU_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz, int *bptr)
+{
+	int	b;
+
+	/*
+	 * If there are no more bytes left, then read some more,
+	 * waiting for them to arrive.  On a signal or a non-blocking
+	 * error, return saying there is no new state available yet.
+	 */
+	if (nbytes <= 0) {
+		bp = buffer;
+		nbytes = read(mouse_fd, bp, MAX_BYTES);
+		if (nbytes < 0) {
+			if (errno == EINTR || errno == EAGAIN)
+				return 0;
+#if _MINIX
+			return 0;
+#else
+			return -1;
+#endif
+		}
+	}
+
+	/*
+	 * Loop over all the bytes read in the buffer, parsing them.
+	 * When a complete state has been read, return the results,
+	 * leaving further bytes in the buffer for later calls.
+	 */
+	while (nbytes-- > 0) {
+		if ((*parse)((int) *bp++)) {
+			*dx = xd;
+			*dy = yd;
+			*dz = 0;
+			b = 0;
+			if(buttons & left)
+				b |= MWBUTTON_L;
+			if(buttons & right)
+				b |= MWBUTTON_R;
+			if(buttons & middle)
+				b |= MWBUTTON_M;
+			*bptr = b;
+			return 1;
+		}
+	}
+	return 0;
+}
+
+/*
+ * Input routine for PC mouse.
+ * Returns nonzero when a new mouse state has been completed.
+ */
+static int
+ParsePC(int byte)
+{
+	int	sign;			/* sign of movement */
+
+	switch (state) {
+		case IDLE:
+			if ((byte & TOP_FIVE_BITS) == TOP_BIT) {
+				buttons = ~byte & BOTTOM_THREE_BITS;
+				state = XSET;
+			}
+			break;
+
+		case XSET:
+			sign = 1;
+			if (byte > 127) {
+				byte = 256 - byte;
+				sign = -1;
+			}
+			xd = byte * sign;
+			state = YSET;
+			break;
+
+		case YSET:
+			sign = 1;
+			if (byte > 127) {
+				byte = 256 - byte;
+				sign = -1;
+			}
+			yd = -byte * sign;
+			state = XADD;
+			break;
+
+		case XADD:
+			sign = 1;
+			if (byte > 127) {
+				byte = 256 - byte;
+				sign = -1;
+			}
+			xd += byte * sign;
+			state = YADD;
+			break;
+
+		case YADD:
+			sign = 1;
+			if (byte > 127) {
+				byte = 256 - byte;
+				sign = -1;
+			}
+			yd -= byte * sign;
+			state = IDLE;
+			return 1;
+	}
+	return 0;
+}
+
+
+/*
+ * Input routine for Microsoft mouse.
+ * Returns nonzero when a new mouse state has been completed.
+ */
+static int
+ParseMS(int byte)
+{
+	switch (state) {
+		case IDLE:
+			if (byte & SIXTH_BIT) {
+				buttons = (byte >> 4) & BOTTOM_TWO_BITS;
+				yd = ((byte & THIRD_FOURTH_BITS) << 4);
+				xd = ((byte & BOTTOM_TWO_BITS) << 6);
+				state = XADD;
+			}
+			break;
+
+		case XADD:
+			xd |= (byte & BOTTOM_SIX_BITS);
+			state = YADD;
+			break;
+
+		case YADD:
+			yd |= (byte & BOTTOM_SIX_BITS);
+			state = IDLE;
+			if (xd > 127)
+				xd -= 256;
+			if (yd > 127)
+				yd -= 256;
+			return 1;
+	}
+	return 0;
+}
+
+/*
+ * Input routine for PS/2 mouse.
+ * Returns nonzero when a new mouse state has been completed.
+ */
+static int
+ParsePS2(int byte)
+{
+	switch (state) {
+		case IDLE:
+			if (byte & PS2_CTRL_BYTE) {
+				buttons = byte & 
+					(PS2_LEFT_BUTTON|PS2_RIGHT_BUTTON);
+				state = XSET;
+			}
+			break;
+
+		case XSET:
+			if(byte > 127)
+				byte -= 256;
+			xd = byte;
+			state = YSET;
+			break;
+
+		case YSET:
+			if(byte > 127)
+				byte -= 256;
+			yd = -byte;
+			state = IDLE;
+			return 1;
+	}
+	return 0;
+}
+
+static int
+MOU_Poll(void)
+{
+	return 1;	/* used by _MINIX only*/
+}
+
+/*  #define TEST 1  */
+#if TEST
+main()
+{
+	MWCOORD x, y, z;
+	int	b;
+
+	DPRINTF("Open Mouse\n");
+	if( MOU_Open(0) < 0)
+		DPRINTF("open failed mouse\n" );
+
+	while(1) 
+	{
+		if(MOU_Read(&x, &y, &z, &b) == 1) 
+		{
+	     		DPRINTF("%d,%d,%d\n", x, y, b);
+		}
+	}
+}
+#endif
diff -urN lib/microwindows/src/drivers/mou_tp.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_tp.c
--- lib/microwindows/src/drivers/mou_tp.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_tp.c	2005-02-21 16:13:09.000000000 +0100
@@ -0,0 +1,455 @@
+/*
+ * drivers/mou_tp.c
+ *
+ * Touch-panel driver
+ *
+ * Designed for for use with the Linux-VR project touch-panel kernel driver.
+ * This includes the VTech Helio.
+ * Also runs with Embedded Planet's PowerPC LinuxPlanet.
+ *
+ * Requires /dev/tpanel kernel driver (char special 10,11)
+ *
+ * Copyright (C) 1999 Bradley D. LaRonde <brad@ltc.com>
+ * Portions Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1991 David I. Bell
+ *
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <math.h>
+#include <sys/ioctl.h>
+#ifndef TPHELIO
+#include <linux/tpanel.h>
+#endif
+#include "device.h"
+#include "mou_tp.h"
+
+#define EMBEDDEDPLANET	0	/* =1 for embeddedplanet ppc framebuffer*/
+#if EMBEDDEDPLANET
+#define DATACHANGELIMIT	50
+#else
+#define DATACHANGELIMIT	100
+#endif
+
+/*
+ * Enable absolute coordinate transformation.
+ * Normally this should be left at 1.
+ * To disable transformation, set it to 0 before calling MwMain().
+ * This is done by the pointer calibration utility since it's used
+ * to produce the pointer calibration data file.
+ */
+int enable_pointing_coordinate_transform = 1;
+
+static TRANSFORMATION_COEFFICIENTS tc;
+
+/* file descriptor for touch panel */
+static int pd_fd;
+
+int GetPointerCalibrationData(void)
+{
+	/*
+	 * Read the calibration data from the calibration file.
+	 * Calibration file format is seven coefficients separated by spaces.
+	 */
+
+	/* Get pointer calibration data from this file */
+	const char cal_filename[] = "/etc/pointercal";
+
+	int items;
+
+	FILE* f = fopen(cal_filename, "r");
+	if ( f == NULL )
+	{
+		EPRINTF("Error %d opening pointer calibration file %s.\n",
+			errno, cal_filename);
+		return -1;
+	}
+
+	items = fscanf(f, "%d %d %d %d %d %d %d",
+		&tc.a, &tc.b, &tc.c, &tc.d, &tc.e, &tc.f, &tc.s);
+	if ( items != 7 )
+	{
+		EPRINTF("Improperly formatted pointer calibration file %s.\n",
+			cal_filename);
+		return -1;
+	}
+
+#if TEST
+		EPRINTF("a=%d b=%d c=%d d=%d e=%d f=%d s=%d\n",
+			tc.a, tc.b, tc.c, tc.d, tc.e, tc.f, tc.s);
+#endif
+
+	return 0;
+}
+
+inline MWPOINT DeviceToScreen(MWPOINT p)
+{
+	/*
+	 * Transform device coordinates to screen coordinates.
+	 * Take a point p in device coordinates and return the corresponding
+	 * point in screen coodinates.
+	 * This can scale, translate, rotate and/or skew, based on the
+	 * coefficients calculated above based on the list of screen
+	 * vs. device coordinates.
+	 */
+
+	static MWPOINT prev;
+	/* set slop at 3/4 pixel */
+	const short slop = TRANSFORMATION_UNITS_PER_PIXEL * 3 / 4;
+	MWPOINT new, out;
+
+	/* transform */
+	new.x = (tc.a * p.x + tc.b * p.y + tc.c) / tc.s;
+	new.y = (tc.d * p.x + tc.e * p.y + tc.f) / tc.s;
+
+	/* hysteresis (thanks to John Siau) */
+	if ( abs(new.x - prev.x) >= slop )
+		out.x = (new.x | 0x3) ^ 0x3;
+	else
+		out.x = prev.x;
+
+	if ( abs(new.y - prev.y) >= slop )
+		out.y = (new.y | 0x3) ^ 0x3;
+	else
+		out.y = prev.y;
+
+	prev = out;
+
+	return out;
+}
+
+static int PD_Open(MOUSEDEVICE *pmd)
+{
+ 	/*
+	 * open up the touch-panel device.
+	 * Return the fd if successful, or negative if unsuccessful.
+	 */
+#ifndef TPHELIO
+	struct scanparam s;
+	int settle_upper_limit;
+	int result;
+#endif
+
+	pd_fd = open("/dev/tpanel", O_NONBLOCK);
+	if (pd_fd < 0) {
+		EPRINTF("Error %d opening touch panel\n", errno);
+		return -1;
+	}
+
+#ifndef TPHELIO
+	/* set interval to 5000us (200Hz) */
+	s.interval = 5000;
+	/*
+	 * Upper limit on settle time is approximately (scan_interval / 5) - 60
+	 * (5 conversions and some fixed overhead)
+	 * The opmtimal value is the lowest that doesn't cause significant
+	 * distortion.
+	 * 50% of upper limit works well on my Clio.  25% gets into distortion.
+	 */
+	settle_upper_limit = (s.interval / 5) - 60;
+	s.settletime = settle_upper_limit * 50 / 100;
+	result = ioctl(pd_fd, TPSETSCANPARM, &s);
+	if ( result < 0 )
+		EPRINTF("Error %d, result %d setting scan parameters.\n",
+			result, errno);
+#endif
+
+	if (enable_pointing_coordinate_transform)
+	{ 
+		if (GetPointerCalibrationData() < 0)
+		{
+			close(pd_fd);
+			return -1;
+		}
+	}
+
+	return pd_fd;
+}
+
+static void PD_Close(void)
+{
+ 	/* Close the touch panel device. */
+	if (pd_fd > 0)
+		close(pd_fd);
+	pd_fd = 0;
+}
+
+static int PD_GetButtonInfo(void)
+{
+ 	/* get "mouse" buttons supported */
+	return MWBUTTON_L;
+}
+
+static void PD_GetDefaultAccel(int *pscale,int *pthresh)
+{
+	/*
+	 * Get default mouse acceleration settings
+	 * This doesn't make sense for a touch panel.
+	 * Just return something inconspicuous for now.
+	 */
+	*pscale = 3;
+	*pthresh = 5;
+}
+
+static int PD_Read(MWCOORD *px, MWCOORD *py, MWCOORD *pz, int *pb)
+{
+	/*
+	 * Read the tpanel state and position.
+         * Returns the position data in x, y, and button data in b.
+	 * Returns -1 on error.
+	 * Returns 0 if no new data is available.
+	 * Returns 1 if position data is relative (i.e. mice).
+	 * Returns 2 if position data is absolute (i.e. touch panels).
+	 * Returns 3 if position data is not available, but button data is.
+	 * This routine does not block.
+	 *
+	 * Unlike a mouse, this driver returns absolute postions, not deltas.
+	 */
+
+	/* If z is below this value, ignore the data. */
+	/* const int low_z_limit = 900; EVEREX*/
+#ifndef TPHELIO
+	const int low_z_limit = 815;
+#endif
+	/*
+	 * I do some error masking by tossing out really wild data points.
+	 * Lower data_change_limit value means pointer get's "left behind"
+	 * more easily.  Higher value means less errors caught.
+	 * The right setting of this value is just slightly higher than
+	 * the number of units traversed per sample during a "quick" stroke.
+	 */
+#ifndef TPHELIO
+	const int data_change_limit = DATACHANGELIMIT;
+#endif
+	static int have_last_data = 0;
+	static int last_data_x = 0;
+	static int last_data_y = 0;
+
+	/*
+	 * Thanks to John Siau <jsiau@benchmarkmedia.com> for help with the
+	 * noise filter.  I use an infinite impulse response low-pass filter
+	 * on the data to filter out high-frequency noise.  Results look
+	 * better than a finite impulse response filter.
+	 * If I understand it right, the nice thing is that the noise now
+	 * acts as a dither signal that effectively increases the resolution
+	 * of the a/d converter by a few bits and drops the noise level by
+	 * about 10db.
+	 * Please don't quote me on those db numbers however. :-)
+	 * The end result is that the pointer goes from very fuzzy to much
+	 * more steady.  Hysteresis really calms it down in the end (elsewhere).
+	 *
+	 * iir_shift_bits effectively sets the number of samples used by
+	 * the filter * (number of samples is 2^iir_shift_bits).
+	 * Lower iir_width means less pointer lag, higher iir_width means
+	 * steadier pointer.
+	 */
+	const int iir_shift_bits = 3;
+	const int iir_sample_depth = (1 << iir_shift_bits);
+	static int iir_accum_x = 0;
+	static int iir_accum_y = 0;
+	static int iir_accum_z = 0;
+	static int iir_count = 0;
+	int data_x, data_y, data_z;
+
+	/* read a data point */
+#if TPHELIO
+	short data[3];
+#else
+	short data[6];
+#endif
+	int bytes_read;
+	bytes_read = read(pd_fd, data, sizeof(data));
+	if (bytes_read != sizeof(data)) {
+		if (errno == EINTR || errno == EAGAIN) {
+			return 0;
+		}
+		return -1;
+	}
+#ifndef TPHELIO
+	/* did we lose any data? */
+	if ( (data[0] & 0x2000) )
+		EPRINTF("Lost touch panel data\n");
+
+	/* do we only have contact state data (no position data)? */
+	if ( (data[0] & 0x8000) == 0 )
+	{
+		/* is it a pen-release? */
+		if ( (data[0] & 0x4000) == 0 )
+		{
+			/* reset the limiter */
+			have_last_data = 0;
+
+			/* reset the filter */
+			iir_count = 0;
+			iir_accum_x = 0;
+			iir_accum_y = 0;
+			iir_accum_z = 0;
+
+			/* return the pen (button) state only, */
+			/* indicating that the pen is up (no buttons are down)*/
+			*pb = 0;
+			return 3;
+		}
+
+		/* ignore pen-down since we don't know where it is */
+		return 0;
+	}
+#endif
+	/* we have position data */
+#if TPHELIO
+        data_x = data[1];
+        data_y = data[2];
+	data_z = data[0] ? 2000 : 0;
+#else
+	/*
+	 * Combine the complementary panel readings into one value (except z)
+	 * This effectively doubles the sampling freqency, reducing noise
+	 * by approx 3db.
+	 * Again, please don't quote the 3db figure.  I think it also
+	 * cancels out changes in the overall resistance of the panel
+	 * such as may be caused by changes in panel temperature.
+	 */
+	data_x = data[2] - data[1];
+	data_y = data[4] - data[3];
+	data_z = data[5];
+
+	/* isn't z big enough for valid position data? */
+	if ( data_z <= low_z_limit ) {
+		return 0;
+	}
+
+	/* has the position changed more than we will allow? */
+	if ( have_last_data )
+		if ( (abs(data_x - last_data_x) > data_change_limit)
+			|| ( abs(data_y - last_data_y) > data_change_limit ) ) {
+			return 0;
+		}
+#endif
+
+	/* save last position */
+	last_data_x = data_x;
+	last_data_y = data_y;
+	have_last_data = 1;
+
+	/* is filter ready? */
+	if ( iir_count == iir_sample_depth )
+	{
+#if TPHELIO
+                if (enable_pointing_coordinate_transform) {
+			MWPOINT transformed = {data_x, data_y};
+			transformed = DeviceToScreen(transformed);
+
+			*px = transformed.x >> 2;
+			*py = transformed.y >> 2;
+		} else {
+			*px = data_x;
+			*py = data_y;
+		}
+		*pb = data[0] ? MWBUTTON_L : 0;
+#else
+		/* make room for new sample */
+		iir_accum_x -= iir_accum_x >> iir_shift_bits;
+		iir_accum_y -= iir_accum_y >> iir_shift_bits;
+		iir_accum_z -= iir_accum_z >> iir_shift_bits;
+
+		/* feed new sample to filter */
+		iir_accum_x += data_x;
+		iir_accum_y += data_y;
+		iir_accum_z += data_z;
+
+		/* transformation enabled? */
+		if (enable_pointing_coordinate_transform)
+		{
+			/* transform x,y to screen coords */
+			MWPOINT transformed = {iir_accum_x, iir_accum_y};
+			transformed = DeviceToScreen(transformed);
+			/*
+			 * HACK: move this from quarter pixels to whole
+			 * pixels for now at least until I decide on the
+			 * right interface to get the quarter-pixel data
+			 * up to the next layer.
+			 */
+			*px = transformed.x >> 2;
+			*py = transformed.y >> 2;
+		}
+		else
+		{
+			/* return untransformed coords (for calibration) */
+			*px = iir_accum_x;
+			*py = iir_accum_y;
+		}
+		*pb = MWBUTTON_L;
+#endif
+		/* return filtered pressure */
+		*pz = iir_accum_z;
+
+#ifdef TEST
+		EPRINTF("In: %hd, %hd, %hd  Filtered: %d %d %d  Out: %d, %d, %d\n",
+			data_x, data_y, data_z, iir_accum_x, iir_accum_y,
+			iir_accum_z, *px, *py, *pz);
+#endif
+		return 2;
+	}
+
+	/* prime the filter */
+	iir_accum_x += data_x;
+	iir_accum_y += data_y;
+	iir_accum_z += data_z;
+	iir_count += 1;
+
+	return 0;
+}
+
+MOUSEDEVICE mousedev = {
+	PD_Open,
+	PD_Close,
+	PD_GetButtonInfo,
+	PD_GetDefaultAccel,
+	PD_Read,
+	NULL
+};
+
+#ifdef TEST
+int main()
+{
+	MWCOORD x, y, z;
+	int	b;
+	int result;
+
+	enable_pointing_coordinate_transform = 1;
+
+	DPRINTF("Opening touch panel...\n");
+
+	if((result=PD_Open(0)) < 0)
+		DPRINTF("Error %d, result %d opening touch-panel\n", errno, result);
+
+	DPRINTF("Reading touch panel...\n");
+
+	while(1) {
+		result = PD_Read(&x, &y, &z, &b);
+		if( result > 0) {
+			/* DPRINTF("%d,%d,%d,%d,%d\n", result, x, y, z, b); */
+		}
+	}
+}
+#endif
diff -urN lib/microwindows/src/drivers/mou_tp.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_tp.h
--- lib/microwindows/src/drivers/mou_tp.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_tp.h	2005-02-21 16:03:17.000000000 +0100
@@ -0,0 +1,19 @@
+/* mou_tp.h */
+
+#define TRANSFORMATION_UNITS_PER_PIXEL 4
+
+typedef struct
+{
+	/*
+	 * Coefficients for the transformation formulas:
+	 *
+	 *     m = (ax + by + c) / s
+	 *     n = (dx + ey + f) / s
+	 *
+	 * These formulas will transform a device point (x, y) to a
+	 * screen point (m, n) in fractional pixels.  The fraction
+	 * is 1 / TRANSFORMATION_UNITS_PER_PIXEL.
+	 */
+
+	int a, b, c, d, e, f, s;
+} TRANSFORMATION_COEFFICIENTS;
diff -urN lib/microwindows/src/drivers/mou_x11.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_x11.c
--- lib/microwindows/src/drivers/mou_x11.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_x11.c	2005-02-21 16:13:09.000000000 +0100
@@ -0,0 +1,147 @@
+/*
+ * Author: Tony Rogvall <tony@bluetail.com>
+ *
+ */
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <X11/Xlib.h>
+#include "device.h"
+
+#define	SCALE		3	/* default scaling factor for acceleration */
+#define	THRESH		5	/* default threshhold for acceleration */
+
+static int  	X11_Open(MOUSEDEVICE *pmd);
+static void 	X11_Close(void);
+static int  	X11_GetButtonInfo(void);
+static void	X11_GetDefaultAccel(int *pscale,int *pthresh);
+static int  	X11_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz, int *bp);
+
+extern Display*     x11_dpy;
+extern int          x11_scr;
+extern Visual*      x11_vis;
+extern Window       x11_win;
+extern GC           x11_gc;
+extern unsigned int x11_event_mask;
+extern int          x11_setup_display();
+extern void         x11_handle_event(XEvent*);
+
+MOUSEDEVICE mousedev = {
+    X11_Open,
+    X11_Close,
+    X11_GetButtonInfo,
+    X11_GetDefaultAccel,
+    X11_Read,
+    NULL
+};
+
+/*
+ * Open up the mouse device.
+ * Returns the fd if successful, or negative if unsuccessful.
+ */
+static int X11_Open(MOUSEDEVICE *pmd)
+{
+    if (x11_setup_display() < 0)
+	return -1;
+    /* return the x11 file descriptor for select */
+    return ConnectionNumber(x11_dpy);  
+}
+
+/*
+ * Close the mouse device.
+ */
+static void
+X11_Close(void)
+{
+    /* nop */
+}
+
+/*
+ * Get mouse buttons supported
+ */
+static int
+X11_GetButtonInfo(void)
+{
+	return MWBUTTON_L | MWBUTTON_M | MWBUTTON_R;
+}
+
+/*
+ * Get default mouse acceleration settings
+ */
+static void
+X11_GetDefaultAccel(int *pscale,int *pthresh)
+{
+    *pscale = SCALE;
+    *pthresh = THRESH;
+}
+
+/*
+ * Attempt to read bytes from the mouse and interpret them.
+ * Returns -1 on error, 0 if either no bytes were read or not enough
+ * was read for a complete state, or 1 if the new state was read.
+ * When a new state is read, the current buttons and x and y deltas
+ * are returned.  This routine does not block.
+ */
+static int
+X11_Read(MWCOORD *dx, MWCOORD *dy, MWCOORD *dz, int *bp)
+{
+    XEvent ev;
+    int events = 0;
+    long mask = x11_event_mask | 
+#ifdef USE_EXPOSURE
+      ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ExposureMask;
+#else
+      ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
+#endif
+
+    while (XCheckMaskEvent(x11_dpy, mask, &ev)) {
+	if (ev.type == MotionNotify) {
+	    if (ev.xmotion.window == x11_win) {
+		int button = 0;
+		*dx = ev.xmotion.x;
+		*dy = ev.xmotion.y;
+		*dz = 0;
+		if (ev.xmotion.state & Button1Mask)
+		    button |= MWBUTTON_L;
+		if (ev.xmotion.state & Button2Mask)
+		    button |= MWBUTTON_M;
+		if (ev.xmotion.state & Button3Mask)
+		    button |= MWBUTTON_R;
+		*bp = button;
+		events++;
+	    }
+	}
+	else if (ev.type == ButtonPress) {
+	    /* FIXME: handle multiple buttons (should be simple) */
+	    if (ev.xbutton.window == x11_win) {
+		if (ev.xbutton.button == 1)
+		    *bp = MWBUTTON_L;
+		else if (ev.xbutton.button == 2)
+		    *bp = MWBUTTON_M;
+		else if (ev.xbutton.button == 3)
+		    *bp = MWBUTTON_R;
+		else
+		    *bp = 0;
+		*dx = ev.xbutton.x;
+		*dy = ev.xbutton.y;
+		*dz = 0;
+		events++;
+	    }
+	}
+	else if (ev.type == ButtonRelease) {
+	    if (ev.xbutton.window == x11_win) {
+		*bp = 0;
+		*dx = ev.xbutton.x;
+		*dy = ev.xbutton.y;
+		*dz = 0;
+		events++;
+	    }
+	}
+	else {
+	    x11_handle_event(&ev);
+	}
+    }
+    if (events == 0)
+	return 0;
+    return 2;		/* absolute position returned*/
+}
diff -urN lib/microwindows/src/drivers/mou_yopy.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_yopy.c
--- lib/microwindows/src/drivers/mou_yopy.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mou_yopy.c	2005-02-21 16:03:17.000000000 +0100
@@ -0,0 +1,223 @@
+/*
+ * Microwindows touch screen driver for G.Mate YOPY
+ *
+ * Copyright (c) 2000 Century Software Embedded Technologies
+ *
+ * Requires /dev/yopy-ts kernel mouse driver.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <math.h>
+#include <sys/ioctl.h>
+#include "device.h"
+
+/* file descriptor for touch panel */
+static int pd_fd = -1;
+
+/* Hack extern to used when hiding the mouse cursor
+ * There needs to be a better way to do this
+*/
+extern SCREENDEVICE scrdev;
+
+static int cal[7];
+
+typedef struct {
+        int x, y;
+} XYPOINT;
+
+#define TRANSFORMATION_UNITS_PER_PIXEL 4
+static int GetPointerCalibrationData(void)
+{
+  /*
+   * Read the calibration data from the calibration file.
+   * Calibration file format is seven coefficients separated by spaces.
+   */
+  
+  /* Get pointer calibration data from this file */
+  const char cal_filename[] = "/etc/ts.conf";
+
+  int items;
+
+  FILE* f = fopen(cal_filename, "r");
+  if ( f == NULL )
+    {
+      EPRINTF("Error %d opening pointer calibration file %s.\n",
+	      errno, cal_filename);
+      return -1;
+    }
+
+  items = fscanf(f, "%d %d %d %d %d %d %d",
+		 &cal[0], &cal[1], &cal[2], &cal[3], &cal[4], &cal[5], &cal[6]);
+  if ( items != 7 )
+    {
+      EPRINTF("Improperly formatted pointer calibration file %s.\n",
+	      cal_filename);
+      return -1;
+    }
+
+#ifdef TEST
+  EPRINTF("a=%d b=%d c=%d d=%d e=%d f=%d s=%d\n",
+	  cal[0], cal[1], cal[2], cal[3], cal[4], cal[5], cal[6]);
+#endif
+
+  return 0;
+}
+
+static XYPOINT DeviceToScreen(XYPOINT p)
+{
+  /*
+   * Transform device coordinates to screen coordinates.
+   * Take a point p in device coordinates and return the corresponding
+   * point in screen coodinates.
+   * This can scale, translate, rotate and/or skew, based on the coefficients
+   * calculated above based on the list of screen vs. device coordinates.
+   */
+  
+  static XYPOINT prev;
+  /* set slop at 3/4 pixel */
+  const short slop = TRANSFORMATION_UNITS_PER_PIXEL * 3 / 4;
+  XYPOINT new, out;
+  
+  /* transform */
+  new.x = (cal[0] * p.x + cal[1] * p.y + cal[2]) / cal[6];
+  new.y = (cal[3] * p.x + cal[4] * p.y + cal[5]) / cal[6];
+  
+  /* hysteresis (thanks to John Siau) */
+  if ( abs(new.x - prev.x) >= slop )
+    out.x = (new.x | 0x3) ^ 0x3;
+  else
+    out.x = prev.x;
+  
+  if ( abs(new.y - prev.y) >= slop )
+    out.y = (new.y | 0x3) ^ 0x3;
+  else
+    out.y = prev.y;
+  
+  prev = out;
+  
+  return out;
+}
+
+static int PD_Open(MOUSEDEVICE *pmd)
+{
+  /*
+   * open up the touch-panel device.
+   * Return the fd if successful, or negative if unsuccessful.
+   */
+  
+  pd_fd = open("/dev/yopy-ts", O_NONBLOCK);
+  if (pd_fd < 0) {
+    EPRINTF("Error %d opening touch panel\n", errno);
+    return -1;
+  }
+  
+  GetPointerCalibrationData();
+  GdHideCursor(&scrdev);
+  
+  return pd_fd;
+}
+
+static void PD_Close(void)
+{
+  /* Close the touch panel device. */
+  if (pd_fd >= 0)
+    close(pd_fd);
+  pd_fd = -1;
+}
+
+static int PD_GetButtonInfo(void)
+{
+  /* get "mouse" buttons supported */
+  return MWBUTTON_L;
+}
+
+static void PD_GetDefaultAccel(int *pscale,int *pthresh)
+{
+  /*
+   * Get default mouse acceleration settings
+   * This doesn't make sense for a touch panel.
+   * Just return something inconspicuous for now.
+   */
+  *pscale = 3;
+  *pthresh = 5;
+}
+
+
+static int PD_Read(MWCOORD *px, MWCOORD *py, MWCOORD *pz, int *pb)
+{
+  /* read a data point */
+
+  unsigned long data;
+  int bytes_read;
+
+  XYPOINT transformed;
+
+  bytes_read = read(pd_fd, &data, sizeof(data));
+
+  if (bytes_read != sizeof(data)) {
+    if (errno == EINTR || errno == EAGAIN) {
+      return 0;
+    }
+    return 0;
+  }
+	
+  transformed.x = (data & 0x3ff);
+  transformed.y = (data >> 10) & 0x3ff;
+	
+  transformed = DeviceToScreen(transformed);
+	
+  transformed.x >>= 2;
+  transformed.y >>= 2;
+
+  *px = transformed.x;
+  *py = transformed.y;
+
+  *pb = (((data >> 31) & 0x1) ? MWBUTTON_L : 0);
+
+  *pz = 0;
+
+  if(! *pb )
+    return 3;			/* only have button data */
+  else 
+    return 2;			/* have full set of data */
+}
+
+MOUSEDEVICE mousedev = {
+  PD_Open,
+  PD_Close,
+  PD_GetButtonInfo,
+  PD_GetDefaultAccel,
+  PD_Read,
+  NULL
+};
+
+#ifdef TEST
+int main(int argc, char ** v)
+{
+  MWCOORD x, y, z;
+  int	b;
+  int result;
+  int mouse = -1;
+  DPRINTF("Opening touch panel...\n");
+  
+  if((result=PD_Open(0)) < 0)
+    DPRINTF("Error %d, result %d opening touch-panel\n", errno, result);
+  
+  while(1) {
+    result = PD_Read(&x, &y, &z, &b);
+    if( result > 0) {
+      if(mouse != b) {
+	mouse = b;
+	if(mouse) 
+	  DPRINTF("Pen Down\n");
+	else
+	  DPRINTF("Pen Up\n");
+      }
+      DPRINTF("%d,%d,%d,%d,%d\n", result, x, y, z, b);
+    }
+  }
+}
+#endif
diff -urN lib/microwindows/src/drivers/mwselect_rtems.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mwselect_rtems.c
--- lib/microwindows/src/drivers/mwselect_rtems.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/mwselect_rtems.c	2005-02-21 16:13:09.000000000 +0100
@@ -0,0 +1,114 @@
+/*
+/////////////////////////////////////////////////////////////////////////////
+// $Header: $
+//
+// Copyright (c) 2000 - Rosimildo da Silva
+//  
+// MODULE DESCRIPTION: 
+// This module implements the "GsSelect()" function for MicroWindows.
+//
+// MODIFICATION/HISTORY:
+//
+// $Log: $
+//
+/////////////////////////////////////////////////////////////////////////////
+*/
+#include <stdio.h>
+#include <errno.h>
+
+#include <rtems/mw_uid.h>
+#include "device.h"
+#include "windef.h"
+
+extern MWBOOL MwCheckMouseEvent();
+extern MWBOOL MwCheckKeyboardEvent();
+
+#if ANIMATEPALETTE
+static int fade = 0;
+#endif
+
+extern struct MW_UID_MESSAGE m_kbd;
+extern struct MW_UID_MESSAGE m_mou;
+
+extern HWND  dragwp;	 /* window user is dragging*/
+/*
+ * "Select() routine called by the Microwindows framework to receive events 
+ * from the input devices.
+ */
+void MwSelect(void)
+{
+  struct MW_UID_MESSAGE m;
+  int rc;
+  unsigned int timeout = 0;
+
+  /* perform pre-select duties, if any*/
+  if(scrdev.PreSelect)
+  {
+     scrdev.PreSelect(&scrdev);
+  }
+	/* Set up the timeout for the main select().  If
+	 * the mouse is captured we're probably moving a window,
+	 * so poll quickly to allow other windows to repaint while
+	 * checking for more event input.
+	 */
+	if( !dragwp )
+   {
+		timeout = MwGetNextTimeoutValue();	/* returns ms*/
+#if ANIMATEPALETTE
+		if(fade < 100)
+			timeout = 40;
+		else 
+#endif
+		if(timeout == 0)
+			timeout = 10;	/* 10ms required for vt fb switch*/
+	}
+
+  /* let's make sure that the type is invalid */
+  m.type = MV_UID_INVALID;
+
+  /* wait up to 100 milisecons for events */
+  rc = uid_read_message( &m, timeout );
+
+  /* return if timed-out or something went wrong */
+  if( rc < 0 )
+  {
+     if( errno != ETIMEDOUT )
+        EPRINTF( " rc= %d, errno=%d\n", rc, errno );
+     else
+     {
+#if ANIMATEPALETTE
+       if(fade <= 100) {
+		   	setfadelevel( &scrdev, fade );
+			   fade += 5;
+		 }
+#endif
+		MwHandleTimers();
+     }
+     return;
+  }
+
+  /* let's pass the event up to microwindows */
+  switch( m.type )
+  {
+    /* Mouse or Touch Screen event */
+    case MV_UID_REL_POS:
+    case MV_UID_ABS_POS:
+        m_mou = m;
+        while( MwCheckMouseEvent() )
+  		         continue;
+        break;
+
+    /* KBD event */
+    case MV_UID_KBD:
+        m_kbd = m;
+        MwCheckKeyboardEvent();
+        break;
+
+    /* micro-windows does nothing with those.. */
+    case MV_UID_TIMER:
+    case MV_UID_INVALID:
+    default:
+       ;
+  }
+}
+
diff -urN lib/microwindows/src/drivers/nofont.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/nofont.c
--- lib/microwindows/src/drivers/nofont.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/nofont.c	2005-02-21 16:03:17.000000000 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Screen Driver Utilities
+ * 
+ * Microwindows null font stub
+ */
+#include <stdio.h>
+#include "device.h"
+#include "genfont.h"
+
+/* no compiled in fonts*/
+
+static MWCFONT nullfont = {
+	"", 0, 0, 0, 0, 0, NULL, NULL, NULL
+};
+
+/* handling routines for MWCOREFONT*/
+static MWFONTPROCS fontprocs = {
+	MWTF_ASCII,		/* routines expect ascii*/
+	NULL,			/* getfontinfo*/
+	NULL,			/* gettextsize*/
+	NULL,			/* gettextbits*/
+	NULL,			/* unloadfont*/
+	NULL,			/* xxx_drawtext*/
+	NULL,			/* setfontsize*/
+	NULL,			/* setfontrotation*/
+	NULL,			/* setfontattr*/
+};
+
+/* first font is default font if no match*/
+MWCOREFONT gen_fonts[NUMBER_FONTS] = {
+	{&fontprocs, 0, 0, 0, MWFONT_SYSTEM_VAR, &nullfont},
+	{&fontprocs, 0, 0, 0, MWFONT_SYSTEM_VAR, &nullfont},
+	{&fontprocs, 0, 0, 0, MWFONT_SYSTEM_VAR, &nullfont},
+	{&fontprocs, 0, 0, 0, MWFONT_SYSTEM_VAR, &nullfont},
+};
diff -urN lib/microwindows/src/drivers/romfont.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/romfont.c
--- lib/microwindows/src/drivers/romfont.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/romfont.c	2005-02-21 16:03:17.000000000 +0100
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Screen Driver Utilities
+ * 
+ * PC ROM Font Routine Header (PC ROM font format)
+ *
+ * This file contains the PC ROM format low-level font/text
+ * drawing routines.  Only fixed pitch fonts are supported.
+ * The ROM character matrix is used for the text bitmaps.
+ *
+ * The environment variable CHARHEIGHT if set will set the assumed rom
+ * font character height, which defaults to 14.
+ */
+#include <stdlib.h>
+#include "device.h"
+#include "vgaplan4.h"
+#include "romfont.h"
+
+/* local data*/
+int	ROM_CHAR_HEIGHT = 14;	/* number of scan lines in fonts in ROM */
+FARADDR rom_char_addr;
+
+/* handling routines for core rom fonts*/
+static MWFONTPROCS fontprocs = {
+	MWTF_ASCII,		/* routines expect ascii*/
+	pcrom_getfontinfo,
+	pcrom_gettextsize,
+	pcrom_gettextbits,
+	pcrom_unloadfont,
+	corefont_drawtext,
+	NULL,			/* setfontsize*/
+	NULL,			/* setfontrotation*/
+	NULL,			/* setfontattr*/
+};
+
+/* first font is default font if no match*/
+MWCOREFONT pcrom_fonts[NUMBER_FONTS] = {
+	{&fontprocs, 0, 0, 0, MWFONT_OEM_FIXED, NULL}
+};
+
+/* init PC ROM routines, must be called in graphics mode*/
+void
+pcrom_init(PSD psd)
+{
+	char *	p;
+
+	/* use INT 10h to get address of rom character table*/
+	rom_char_addr = int10(FNGETROMADDR, GETROM8x14);
+#if 0
+	/* check bios data area for actual character height,
+	 * as the returned font isn't always 14 high
+	 */
+	ROM_CHAR_HEIGHT = GETBYTE_FP(MK_FP(0x0040, 0x0085));
+	if(ROM_CHAR_HEIGHT > MAX_ROM_HEIGHT)
+		ROM_CHAR_HEIGHT = MAX_ROM_HEIGHT;
+#endif
+	p = getenv("CHARHEIGHT");
+	if(p)
+		ROM_CHAR_HEIGHT = atoi(p);
+}
+
+/*
+ * PC ROM low level get font info routine.  This routine
+ * returns info on a single bios ROM font.
+ */
+MWBOOL
+pcrom_getfontinfo(PMWFONT pfont,PMWFONTINFO pfontinfo)
+{
+	int	i;
+
+	pfontinfo->maxwidth = ROM_CHAR_WIDTH;
+	pfontinfo->height = ROM_CHAR_HEIGHT;
+	pfontinfo->baseline = ROM_CHAR_HEIGHT;
+	pfontinfo->firstchar = 0;
+	pfontinfo->lastchar = 255;
+	pfontinfo->fixed = TRUE;
+	for (i = 0; i < 256; i++)
+		pfontinfo->widths[i] = ROM_CHAR_WIDTH;
+	return TRUE;
+}
+
+/*
+ * PC ROM low level routine to calc bounding box for text output.
+ * Handles bios ROM font only.
+ */
+void
+pcrom_gettextsize(PMWFONT pfont, const void *str, int cc,
+	MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase)
+{
+	*pwidth = ROM_CHAR_WIDTH * cc;
+	*pheight = ROM_CHAR_HEIGHT;
+	*pbase = ROM_CHAR_HEIGHT;
+}
+
+/*
+ * PC ROM low level routine to get the bitmap associated
+ * with a character.  Handles bios ROM font only.
+ */
+void
+pcrom_gettextbits(PMWFONT pfont, int ch, MWIMAGEBITS *retmap,
+	MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase)
+{
+	FARADDR	bits;
+	int	n;
+
+	/* read character bits from rom*/
+	bits = rom_char_addr + ch * ROM_CHAR_HEIGHT;
+	for(n=0; n<ROM_CHAR_HEIGHT; ++n)
+		*retmap++ = GETBYTE_FP(bits++) << 8;
+
+	*pwidth = ROM_CHAR_WIDTH;
+	*pheight = ROM_CHAR_HEIGHT;
+	*pbase = ROM_CHAR_HEIGHT;
+}
+
+void
+pcrom_unloadfont(PMWFONT pfont)
+{
+	/* rom fonts can't be unloaded*/
+}
+
+#if NOTUSED
+/* 
+ * Low level text draw routine, called only if no clipping
+ * is required.  This routine draws ROM font characters only.
+ */
+void
+pcrom_drawtext(PMWFONT pfont, PSD psd, COORD x, COORD y,
+	const void *text, int n, PIXELVAL fg)
+{
+	const unsigned char *	str = text;
+	COORD 			width;		/* width of character */
+	COORD 			height;		/* height of character */
+	IMAGEBITS 	bitmap[MAX_ROM_HEIGHT];	/* bitmap for character */
+
+ 	/* x,y is bottom left corner*/
+	y -= (ROM_CHAR_HEIGHT - 1);
+	while (n-- > 0) {
+		pfont->GetTextBits(pfont, *s++, bitmap, &width, &height);
+		gen_drawbitmap(psd, x, y, width, height, bitmap, fg);
+		x += width;
+	}
+}
+
+/*
+ * Generalized low level bitmap output routine, called
+ * only if no clipping is required.  Only the set bits
+ * in the bitmap are drawn, in the foreground color.
+ */
+void
+gen_drawbitmap(PSD psd,COORD x, COORD y, COORD width, COORD height,
+	IMAGEBITS *table, PIXELVAL fgcolor)
+{
+  COORD minx;
+  COORD maxx;
+  IMAGEBITS bitvalue;	/* bitmap word value */
+  int bitcount;			/* number of bits left in bitmap word */
+
+  minx = x;
+  maxx = x + width - 1;
+  bitcount = 0;
+  while (height > 0) {
+	if (bitcount <= 0) {
+		bitcount = IMAGE_BITSPERIMAGE;
+		bitvalue = *table++;
+	}
+	if (IMAGE_TESTBIT(bitvalue))
+		psd->DrawPixel(psd, x, y, fgcolor);
+	bitvalue = IMAGE_SHIFTBIT(bitvalue);
+	--bitcount;
+	if (x++ == maxx) {
+		x = minx;
+		++y;
+		--height;
+		bitcount = 0;
+	}
+  }
+}
+#endif /* NOTUSED*/
diff -urN lib/microwindows/src/drivers/romfont.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/romfont.h
--- lib/microwindows/src/drivers/romfont.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/romfont.h	2005-02-21 16:03:17.000000000 +0100
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Screen Driver Utilities
+ *
+ * PC ROM Font Routine Header (PC ROM font format)
+ *
+ * These routines are screen driver entry points.
+ */
+
+/* compiled in fonts*/
+#define NUMBER_FONTS	1	/* rom font only for now*/
+
+#define	ROM_CHAR_WIDTH	8	/* number of pixels for character width */
+#define MAX_ROM_HEIGHT	16	/* max rom character height*/
+#define	FONT_CHARS	256	/* number of characters in font tables */
+
+/* int10 functions*/
+#define FNGETROMADDR	0x1130	/* function for address of rom character table*/
+#define GETROM8x14	0x0200	/* want address of ROM 8x14 char table*/
+
+/* entry points*/
+void	pcrom_init(PSD psd);
+MWBOOL	pcrom_getfontinfo(PMWFONT pfont,PMWFONTINFO pfontinfo);
+void	pcrom_gettextsize(PMWFONT pfont, const void *text, int cc,
+		MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+void	pcrom_gettextbits(PMWFONT pfont, int ch, MWIMAGEBITS *retmap,
+		MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+void	pcrom_unloadfont(PMWFONT pfont);
+
+void	corefont_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+		const void *text, int cc, int flags);
+
+/* local data*/
+extern int	ROM_CHAR_HEIGHT; /* number of scan lines in fonts in ROM */
+extern FARADDR 	rom_char_addr;
+extern MWCOREFONT pcrom_fonts[NUMBER_FONTS];
+
+/* the following aren't used yet*/
+void	pcrom_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+		const void *text, int n, MWPIXELVAL fg);
+void 	gen_drawbitmap(PSD psd,MWCOORD x,MWCOORD y,MWCOORD width,MWCOORD height,
+		MWIMAGEBITS *table, MWPIXELVAL fgcolor);
diff -urN lib/microwindows/src/drivers/scr_bios.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_bios.c
--- lib/microwindows/src/drivers/scr_bios.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_bios.c	2005-02-21 16:03:18.000000000 +0100
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * EGA/VGA 16 color 4 planes Screen Driver, direct hardware or bios
+ * 	If HWINIT 1 is #defined, the file vgainit.c is
+ * 	used to provide non-bios direct hw initialization of the VGA
+ * 	chipset.  Otherwise, this driver uses int10 bios to 
+ * 	set/reset graphics/text modes.
+ *
+ * 	If ROMFONT is #defined, the file romfont.c is used to
+ * 	draw all fonts, afte the bios is called to
+ * 	get the address of the ROM character font which
+ * 	is used for the character bitmaps.  Otherwise, the
+ * 	file genfont.c is used to draw linked in fonts, without
+ * 	consulting the bios.
+ *
+ * 	All other access to the hardware is controlled through this driver.
+ *
+ * 	Blitting enabled with #define HAVEBLIT in vgaplan4.h
+ *
+ * 	This driver links with one of two other files, vgaplan4.c,
+ * 	the portable VGA 4 planes 16 color driver, or asmplan4.s, which
+ * 	is 8086 assembly language for speed.  This file itself
+ * 	doesn't know about any planar or packed arrangement, relying soley
+ * 	on the following external routines for all graphics drawing:
+ * 		ega_init, ega_drawpixel, ega_readpixel,
+ * 		ega_drawhorzline, ega_drawvertline
+ *
+ * 	All text/font drawing code is based on the above routines and
+ * 	the included entry points for getting the ROM bitmap data.
+ *
+ * 	If the environment variable EGAMODE is set, the driver implements
+ *	the EGA 640x350 (mode 10h) resolution, otherwise 640x480 (mode 12h)
+ *	graphics mode is set.
+ *
+ *	The environment variable CHARHEIGHT if set will set the assumed rom
+ *	font character height, which defaults to 14.
+ *
+ */
+#if _MINIX
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <ibm/int86.h>
+#include <sys/ioctl.h>
+#define HWINIT		0	/* =1 for non-bios direct hardware init*/
+#define ROMFONT		0	/* =0 no bios rom fonts available*/
+#else
+#ifdef __rtems__
+#define HWINIT		1	/* =1 for non-bios direct hardware init*/
+#define ROMFONT		0	/* =0 no bios rom fonts available*/
+#else
+#define HWINIT		0	/* =1 for non-bios direct hardware init*/
+#define ROMFONT		1	/* =1 uses PC rom fonts */
+#endif
+#endif
+
+#if ELKS
+#include <linuxmt/ntty.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include "device.h"
+#include "vgaplan4.h"
+#if ROMFONT
+#include "romfont.h"
+#else
+#include "genfont.h"
+#endif
+#include "genmem.h"
+#include "fb.h"
+
+/* VGA driver entry points*/
+static PSD  VGA_open(PSD psd);
+static void VGA_close(PSD psd);
+#if _MINIX
+static void VGA_getscreeninfo(PSD psd,PMWSCREENINFO psi);
+#else
+static void VGA_getscreeninfo(PSD psd,PMWSCREENINFO psi);;
+#endif
+static void VGA_setpalette(PSD psd,int first,int count,MWPALENTRY *pal);
+static MWBOOL VGA_mapmemgc(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,
+		int linelen,int size,void *addr);
+static void NULL_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w,
+		MWCOORD h, PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op) {}
+static PSD  NULL_allocatememgc(PSD psd) { return NULL; }
+static MWBOOL NULL_mapmemgc(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,
+			int linelen,int size,void *addr) { return 0; }
+static void NULL_freememgc(PSD mempsd) {}
+
+SCREENDEVICE	scrdev = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
+	VGA_open,
+	VGA_close,
+	VGA_getscreeninfo,
+	VGA_setpalette,
+	ega_drawpixel,
+	ega_readpixel,
+	ega_drawhorzline,
+	ega_drawvertline,
+	gen_fillrect,
+#if ROMFONT
+	pcrom_fonts,
+#else
+	gen_fonts,
+#endif
+#if HAVEBLIT
+	ega_blit,		/* Blit*/
+#else
+	NULL_blit,		/* Blit*/
+#endif
+	NULL,			/* PreSelect*/
+	NULL,			/* DrawArea*/
+	NULL,			/* SetIOPermissions*/
+	gen_allocatememgc,
+	VGA_mapmemgc,
+	gen_freememgc
+};
+
+/* operating mode*/
+static MWBOOL VGAMODE = TRUE;	/* ega or vga screen rows*/
+
+/* int10 functions*/
+#define FNGR640x480	0x0012	/* function for graphics mode 640x480x16*/
+#define FNGR640x350	0x0010	/* function for graphics mode 640x350x16*/
+#define FNTEXT		0x0003	/* function for 80x25 text mode*/
+
+#if _MINIX
+FARADDR int10(int mode, int z)
+{
+int fd;
+struct mio_int86 mint86;
+
+   fd = open("/dev/mem", O_RDONLY);
+   memset(&mint86, 0, sizeof(mint86));
+   ioctl(fd, MIOCINT86, &mint86);
+   mint86.reg86.b.intno = 0x10;
+   mint86.reg86.b.al = mode & 0xFF;
+   ioctl(fd, MIOCINT86, &mint86);
+   close(fd);
+}
+#endif
+
+static PSD
+VGA_open(PSD psd)
+{
+#if _MINIX
+int s;
+struct mio_ldt86 mldt86;
+struct segdesc_s {              /* segment descriptor for protected mode */
+	u16_t limit_low;
+	u16_t base_low;
+	u8_t base_middle;
+	u8_t access;                  /* |P|DL|1|X|E|R|A| */
+	u8_t granularity;             /* |G|X|0|A|LIMT| */
+	u8_t base_high;
+} *dp;
+int fd;
+unsigned long vidmem = 0xA0000;
+
+	fd = open("/dev/mem", O_RDONLY);
+	dp = (struct segdesc_s *) mldt86.entry;
+	mldt86.idx = 1;
+	s = ioctl(fd, MIOCGLDT86, &mldt86);
+	dp->limit_low    = 0xFFFF;
+	dp->base_low     = (vidmem >>  0) & 0xFFFF;
+	dp->base_middle  = (vidmem >> 16) & 0xFF;
+	dp->base_high    = (vidmem >> 24) & 0xFF;
+	dp->granularity |= 0x80;
+	mldt86.idx = 2;
+	s = ioctl(fd, MIOCSLDT86, &mldt86);
+	close(fd);
+#endif
+	/* setup operating mode from environment variable*/
+	if(getenv("EGAMODE"))
+		VGAMODE = FALSE;
+	else VGAMODE = TRUE;
+
+#if ELKS
+	/* disallow console switching while in graphics mode*/
+	if(ioctl(0, DCGET_GRAPH) != 0)
+		return NULL;
+#endif
+
+#if HWINIT
+	/* enter graphics mode*/
+	ega_hwinit();
+#else
+	/* init bios graphics mode*/
+	int10(VGAMODE? FNGR640x480: FNGR640x350, 0);
+#endif
+
+	/* init driver variables depending on ega/vga mode*/
+	psd->xres = psd->xvirtres = 640;
+	psd->yres = psd->yvirtres = VGAMODE? 480: 350;
+	psd->planes = 4;
+	psd->bpp = 4;
+	psd->ncolors = 16;
+	psd->pixtype = MWPF_PALETTE;
+#if HAVEBLIT
+	psd->flags = PSF_SCREEN | PSF_HAVEBLIT;
+#else
+	psd->flags = PSF_SCREEN;
+#endif
+
+	/* init planes driver (sets psd->addr and psd->linelen)*/
+	ega_init(psd);
+
+#if ROMFONT
+	/* init pc rom font routines*/
+	pcrom_init(psd);
+#endif
+#if 0
+	ROM_CHAR_HEIGHT = VGAMODE? 16: 14;
+#endif
+	/* FIXME: add palette code*/
+	return psd;
+}
+
+static void
+VGA_close(PSD psd)
+{
+#if ELKS
+	/* allow console switching again*/
+	ioctl(0, DCREL_GRAPH);
+#endif
+#if HWINIT
+	ega_hwterm();
+#else
+	/* init bios 80x25 text mode*/
+	int10(FNTEXT, 0);
+#endif
+}
+
+static void
+VGA_getscreeninfo(PSD psd,PMWSCREENINFO psi)
+{
+	psi->rows = psd->yvirtres;
+	psi->cols = psd->xvirtres;
+	psi->planes = psd->planes;
+	psi->bpp = psd->bpp;
+	psi->ncolors = psd->ncolors;
+	psi->pixtype = psd->pixtype;
+	psi->fonts = NUMBER_FONTS;
+
+	if(VGAMODE) {
+		/* VGA 640x480*/
+		psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 27;	/* assumes screen height of 18 cm*/
+	} else {
+		/* EGA 640x350*/
+		psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 19;	/* assumes screen height of 18 cm*/
+	}
+
+#if ETA4000
+	/* SVGA 800x600*/
+	psi->xdpcm = 33;		/* assumes screen width of 24 cm*/
+	psi->ydpcm = 33;		/* assumes screen height of 18 cm*/
+#endif
+}
+
+static void
+VGA_setpalette(PSD psd,int first,int count,MWPALENTRY *pal)
+{
+	/* not yet implemented, std 16 color palette assumed*/
+}
+
+#if HAVEBLIT
+/* initialize memory device with passed parms, and select suitable fb driver*/
+static MWBOOL
+VGA_mapmemgc(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,int linelen,
+	int size,void *addr)
+{
+	extern SUBDRIVER memplan4;
+
+	/* initialize mem screen driver*/
+	initmemgc(mempsd, w, h, planes, bpp, linelen, size, addr);
+
+	/* set and initialize subdriver into mem screen driver*/
+	if (!set_subdriver(mempsd, &memplan4, TRUE))
+		return 0;
+
+	return 1;
+}
+#endif
diff -urN lib/microwindows/src/drivers/scr_bogl.x /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_bogl.x
--- lib/microwindows/src/drivers/scr_bogl.x	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_bogl.x	2005-02-21 16:03:18.000000000 +0100
@@ -0,0 +1,401 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Screen Driver using BOGL Library
+ *
+ * This driver now requires only the following BOGL entry points:
+ * 	bogl_init, bogl_done, 
+ * 	bogl_pixel, bogl_readpixel,
+ * 	bogl_vline, bogl_hline
+ *
+ * All graphics drawing primitives are based on top of these functions.
+ *
+ * This file also contains the generalized low-level font/text
+ * drawing routines, which will be split out into another file.
+ * Both fixed and proportional fonts are supported, with fixed
+ * pitch structure allowing much smaller font files.
+ */
+#include <stdio.h>
+#include "../device.h"
+#include "bogl/bogl.h"
+
+/* specific bogl driver entry points*/
+static int  BOGL_open(SCREENDEVICE *psd);
+static void BOGL_close(void);
+static void BOGL_getscreeninfo(PSCREENINFO psi);
+static void BOGL_setpalette(int first,int count,RGBENTRY *pal);
+static void BOGL_drawpixel(COORD x, COORD y, PIXELVAL c);
+static PIXELVAL BOGL_readpixel(COORD x, COORD y);
+static void BOGL_drawhline(COORD x1, COORD x2, COORD y, PIXELVAL c);
+static void BOGL_drawvline(COORD x, COORD y1, COORD y2, PIXELVAL c);
+static void BOGL_fillrect(COORD x1, COORD y1, COORD x2, COORD y2, PIXELVAL c);
+
+/* generalized text/font routines*/
+static BOOL gen_getfontinfo(FONTID fontid,PFONTINFO pfontinfo);
+static void gen_gettextsize(const UCHAR *str,int cc,COORD *retwd,
+		COORD *retht,FONTID fontid);
+static void gen_gettextbits(UCHAR ch,IMAGEBITS *retmap,COORD *retwd,
+		COORD *retht,FONTID fontid);
+/*static void gen_drawtext(COORD x, COORD y, const UCHAR *s, int n,
+			PIXELVAL fg, FONTID fontid);
+static void gen_drawbitmap(COORD x, COORD y, COORD width, COORD height,
+			IMAGEBITS *table, PIXELVAL fgcolor);*/
+
+SCREENDEVICE	scrdev = {
+	BOGL_open,
+	BOGL_close,
+	BOGL_getscreeninfo,
+	BOGL_setpalette,
+	BOGL_drawpixel,
+	BOGL_readpixel,
+	BOGL_drawhline,
+	BOGL_drawvline,
+	BOGL_fillrect,
+	gen_getfontinfo,
+	gen_gettextsize,
+	gen_gettextbits,
+	640, 480, 256, PF_PALETTE
+};
+
+/* compiled in fonts*/
+#define NUMBER_FONTS	3
+extern FONT font_rom8x16, font_rom8x8;
+extern FONT font_winFreeSansSerif11x13;
+extern FONT font_winFreeSystem14x16;
+extern FONT font_winSystem14x16;
+extern FONT font_winMSSansSerif11x13;
+extern FONT font_winTerminal8x12;
+extern FONT font_helvB10, font_helvB12, font_helvR10;
+
+/* first font is default font*/
+PFONT fonts[NUMBER_FONTS] = {
+#if HAVEMSFONTS
+	&font_winSystem14x16,		/* FONT_SYSTEM_VAR*/
+	&font_winMSSansSerif11x13,	/* FONT_GUI_VAR*/
+	&font_winTerminal8x12		/* FONT_OEM_FIXED*/
+#else
+	&font_winFreeSystem14x16,	/* FONT_SYSTEM_VAR*/
+	&font_winFreeSansSerif11x13,	/* FONT_GUI_VAR*/
+	&font_rom8x16			/* FONT_OEM_FIXED*/
+#endif
+};
+
+static int
+BOGL_open(SCREENDEVICE *psd)
+{
+	if(bogl_init() == 0)
+		return -1;
+	psd->xres = bogl_xres;
+	psd->yres = bogl_yres;
+	psd->ncolors = bogl_ncols;
+
+	/* set pixel format*/
+	if(bogl_ncols > 256)
+		psd->pixtype = PF_TRUECOLOR24;
+	else if(bogl_ncols == 256 && bogl_truecolor)
+		psd->pixtype = PF_TRUECOLOR332;
+	else
+		psd->pixtype = PF_PALETTE;
+	return 1;
+}
+
+static void
+BOGL_close(void)
+{
+	bogl_done();
+}
+
+static void
+BOGL_getscreeninfo(PSCREENINFO psi)
+{
+	psi->rows = scrdev.yres;
+	psi->cols = scrdev.xres;
+	psi->ncolors = scrdev.ncolors;
+	psi->pixtype = scrdev.pixtype;
+	psi->black = 0;
+	psi->white = 15;
+	psi->fonts = NUMBER_FONTS;
+
+	if(scrdev.yres > 480) {
+		/* SVGA 800x600*/
+		psi->xdpcm = 33;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 33;	/* assumes screen height of 18 cm*/
+	} else if(scrdev.yres > 350) {
+		/* VGA 640x480*/
+		psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 27;	/* assumes screen height of 18 cm*/
+	} else {
+		/* EGA 640x350*/
+		psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 19;	/* assumes screen height of 18 cm*/
+	}
+}
+
+/*
+ * Set count palette entries starting from first
+ */
+static void
+BOGL_setpalette(int first,int count,RGBENTRY *pal)
+{
+	bogl_set_palette(first, count, (void*)pal);
+}
+
+static void
+BOGL_drawpixel(COORD x, COORD y, PIXELVAL c)
+{
+	bogl_pixel(x, y, c);
+}
+
+static PIXELVAL
+BOGL_readpixel(COORD x, COORD y)
+{
+	return bogl_readpixel(x, y);
+}
+
+static void
+BOGL_drawhline(COORD x1, COORD x2, COORD y, PIXELVAL c)
+{
+	/*
+	 * bogl uses type 2 line drawing, the last point is not drawn
+	 */
+	bogl_hline(x1, x2+1, y, c);
+
+	/*
+	 * Uncomment the following if driver doesn't support hline
+	while(x1 <= x2)
+		bogl_pixel(x1++, y, c);
+	 */
+}
+
+static void
+BOGL_drawvline(COORD x, COORD y1, COORD y2, PIXELVAL c)
+{
+	/*
+	 * bogl uses type 2 line drawing, the last point is not drawn
+	 */
+	bogl_vline(x, y1, y2+1, c);
+
+	/*
+	 * Uncomment the following if driver doesn't support vline
+	while(y1 <= y2)
+		bogl_pixel(x, y1++, c);
+	 */
+}
+
+static void
+BOGL_fillrect(COORD x1, COORD y1, COORD x2, COORD y2, PIXELVAL c)
+{
+	/*
+	 * Call bogl hline (type 2) to save size
+	 */
+	++x2;		/* fix bogl last point not drawn*/
+	while(y1 <= y2)
+		bogl_hline(x1, x2, y1++, c);
+	/*
+	 * Uncomment the following if driver doesn't support fillrect
+	while(y1 <= y2)
+		BOGL_drawhline(x1, x2, y1++, c);
+	 */
+}
+
+#if 0000
+/* 
+ * Generalized low level text draw routine, called only
+ * if no clipping is required
+ */
+static void
+gen_drawtext(COORD x,COORD y,const UCHAR *s,int n,PIXELVAL fg,FONTID fontid)
+{
+	COORD 		width;			/* width of character */
+	COORD 		height;			/* height of character */
+	PFONT		pf;
+	IMAGEBITS 	bitmap[MAX_CHAR_HEIGHT];/* bitmap for character */
+
+	if(fontid >= NUMBER_FONTS)
+		return;
+	pf = fonts[fontid];
+
+	/* x, y is bottom left corner*/
+	y -= pf->height - 1;
+	while (n-- > 0) {
+		gen_gettextbits(*s++, bitmap, &width, &height, pf);
+		gen_drawbitmap(x, y, width, height, bitmap, fg);
+		x += width;
+	}
+}
+
+/*
+ * Generalized low level bitmap output routine, called
+ * only if no clipping is required.  Only the set bits
+ * in the bitmap are drawn, in the foreground color.
+ */
+static void
+gen_drawbitmap(COORD x, COORD y, COORD width, COORD height, IMAGEBITS *table,
+	PIXELVAL fgcolor)
+{
+  COORD minx;
+  COORD maxx;
+  IMAGEBITS bitvalue;	/* bitmap word value */
+  int bitcount;			/* number of bits left in bitmap word */
+
+  minx = x;
+  maxx = x + width - 1;
+  bitcount = 0;
+  while (height > 0) {
+	if (bitcount <= 0) {
+		bitcount = IMAGE_BITSPERIMAGE;
+		bitvalue = *table++;
+	}
+	if (IMAGE_TESTBIT(bitvalue))
+		BOGL_drawpixel(x, y, fgcolor);
+	bitvalue = IMAGE_SHIFTBIT(bitvalue);
+	--bitcount;
+	if (x++ == maxx) {
+		x = minx;
+		++y;
+		--height;
+		bitcount = 0;
+	}
+  }
+}
+#endif
+
+/*
+ * Generalized low level get font info routine.  This
+ * routine works with fixed and proportional fonts.
+ */
+static BOOL
+gen_getfontinfo(FONTID fontid,PFONTINFO pfontinfo)
+{
+	PFONT	pf;
+	int	i;
+
+	if(fontid >= NUMBER_FONTS)
+		return FALSE;
+	pf = fonts[fontid];
+
+	pfontinfo->font = fontid;
+	pfontinfo->height = pf->height;
+	pfontinfo->maxwidth = pf->maxwidth;
+	pfontinfo->baseline = 0;
+	pfontinfo->fixed = pf->width == NULL? TRUE: FALSE;
+	for(i=0; i<256; ++i) {
+		if(pf->width == NULL)
+			pfontinfo->widths[i] = pf->maxwidth;
+		else {
+			if(i<pf->firstchar || i >= pf->firstchar+pf->size)
+				pfontinfo->widths[i] = 0;
+			else pfontinfo->widths[i] = pf->width[i-pf->firstchar];
+		}
+	}
+	return TRUE;
+}
+
+/*
+ * Generalized low level routine to calc bounding box for text output.
+ * Handles both fixed and proportional fonts.
+ */
+static void
+gen_gettextsize(const UCHAR *str,int cc,COORD *retwd,COORD *retht,
+	FONTID fontid)
+{
+	PFONT	pf;
+	int	c;
+	int	width;
+
+	if(fontid >= NUMBER_FONTS) {
+		*retht = 0;
+		*retwd = 0;
+		return;
+	}
+	pf = fonts[fontid];
+
+	if(pf->width == NULL)
+		width = cc * pf->maxwidth;
+	else {
+		width = 0;
+		while(--cc >= 0) {
+			if( (c = *str++) >= pf->firstchar &&
+			     c < pf->firstchar+pf->size)
+				width += pf->width[c - pf->firstchar];
+		}
+	}
+
+	*retwd = width;
+	*retht = pf->height;
+
+}
+
+/*
+ * Generalized low level routine to get the bitmap associated
+ * with a character.  Handles fixed and proportional fonts.
+ */
+static void
+gen_gettextbits(UCHAR ch,IMAGEBITS *retmap,COORD *retwd, COORD *retht,
+	FONTID fontid)
+{
+	int		n;
+	PFONT		pf = NULL;
+	IMAGEBITS *	bits;
+
+	if(fontid < NUMBER_FONTS)
+		pf = fonts[fontid];
+
+	if(!pf || ch < pf->firstchar || ch >= pf->firstchar+pf->size) {
+		*retht = 0;
+		*retwd = 0;
+		return;
+	}
+	ch -= pf->firstchar;
+
+	/* get font bitmap depending on fixed pitch or not*/
+	bits = pf->bits + (pf->offset? pf->offset[ch]: (pf->height * ch));
+	for(n=0; n<pf->height; ++n)
+		*retmap++ = *bits++;
+
+	/* return width depending on fixed pitch or not*/
+	*retwd = pf->width? pf->width[ch]: pf->maxwidth;
+	*retht = pf->height;
+}
+
+#if 0
+static unsigned char palette[16+16][3] = {
+  /* Linux 16 color palette*/
+  { 0x00,0x00,0x00 },
+  { 0x00,0x00,0xaa },
+  { 0x00,0xaa,0x00 },
+  { 0x00,0xaa,0xaa },
+  { 0xaa,0x00,0x00 },
+  { 0xaa,0x00,0xaa },
+  { 0xaa,0x55,0x00 },	/* adjust to brown*/
+  //{ 0xaa,0xaa,0x00 },
+  { 0xaa,0xaa,0xaa },
+  { 0x55,0x55,0x55 },
+  { 0x55,0x55,0xff },
+  { 0x55,0xff,0x55 },
+  { 0x55,0xff,0xff },
+  { 0xff,0x55,0x55 },
+  { 0xff,0x55,0xff },
+  { 0xff,0xff,0x55 },
+  { 0xff,0xff,0xff },
+
+  /* 16 entry std palette*/
+  {0x00, 0x00, 0x00},
+  {0x00, 0x00, 0xbf},
+  {0x00, 0xbf, 0x00},
+  {0x00, 0xbf, 0xbf},
+  {0xbf, 0x00, 0x00},
+  {0xbf, 0x00, 0xbf},
+  {0xbf, 0x60, 0x00},	/* adjust to brown*/
+  //{0xbf, 0xbf, 0x00},
+  {0xc0, 0xc0, 0xc0},
+  {0x80, 0x80, 0x80},
+  {0x00, 0x00, 0xff},
+  {0x00, 0xff, 0x00},
+  {0x00, 0xff, 0xff},
+  {0xff, 0x00, 0x00},
+  {0xff, 0x00, 0xff},
+  {0xff, 0xff, 0x00},
+  {0xff, 0xff, 0xff},
+};
+#endif
diff -urN lib/microwindows/src/drivers/scr_debug.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_debug.c
--- lib/microwindows/src/drivers/scr_debug.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_debug.c	2005-02-21 16:13:10.000000000 +0100
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Experimental debug screen driver for Microwindows
+ *
+ * 21-Feb-2000 ajr@ecs.soton.ac.uk
+ * Stripped down the VGA driver to make a debug driver so that I can debug the
+ * rest of the code.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "device.h"
+#include "genfont.h"
+#include "genmem.h"
+
+/* DBG driver entry points*/
+static PSD  DBG_open(PSD psd);
+static void DBG_close(PSD psd);
+static void DBG_getscreeninfo(PSD psd,PMWSCREENINFO psi);;
+static void DBG_setpalette(PSD psd,int first,int count,MWPALENTRY *pal);
+static void DBG_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c);
+static MWPIXELVAL DBG_readpixel(PSD psd,MWCOORD x, MWCOORD y);
+static void DBG_drawhline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c);
+static void DBG_drawvline(PSD psd,MWCOORD x,MWCOORD y1,MWCOORD y2,MWPIXELVAL c);
+static void DBG_fillrect(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,
+		MWPIXELVAL c);
+void DBG_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+		PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op);
+
+SCREENDEVICE	scrdev = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
+	DBG_open,
+	DBG_close,
+	DBG_getscreeninfo,
+	DBG_setpalette,
+	DBG_drawpixel,
+	DBG_readpixel,
+	DBG_drawhline,
+	DBG_drawvline,
+	DBG_fillrect,
+	gen_fonts,
+	DBG_blit,
+	NULL,			/* PreSelect*/
+	NULL,			/* DrawArea subdriver*/
+	NULL,			/* SetIOPermissions*/
+	gen_allocatememgc,
+	NULL,			/* MapMemGC*/
+	NULL			/* FreeMemGC*/
+};
+
+#define printd(_a)
+
+static PSD
+DBG_open(PSD psd)
+{
+	/* init driver variables depending on ega/vga mode*/
+	psd->xres = psd->xvirtres = 640;
+	psd->yres = psd->yvirtres = 480;
+	psd->planes = 4;
+	psd->bpp = 4;
+	psd->ncolors = 16;
+	psd->pixtype = MWPF_PALETTE;
+	psd->flags = PSF_SCREEN;
+
+	return psd;
+}
+
+static void
+DBG_close(PSD psd)
+{
+	printd("DBG_close()\n");
+}
+
+static void
+DBG_getscreeninfo(PSD psd,PMWSCREENINFO psi)
+{
+	psi->rows = psd->yvirtres;
+	psi->cols = psd->xvirtres;
+	psi->planes = psd->planes;
+	psi->bpp = psd->bpp;
+	psi->ncolors = psd->ncolors;
+	psi->pixtype = psd->pixtype;
+	psi->fonts = 1;
+
+	/* DBG 640x480*/
+	psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+	psi->ydpcm = 27;	/* assumes screen height of 18 cm*/
+	printd("DBG_getscreeninfo()\n");
+}
+
+static void
+DBG_setpalette(PSD psd,int first,int count,MWPALENTRY *pal)
+{
+	printd("DBG_setpalette()\n");
+}
+
+static void
+DBG_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	printd("DBG_drawpixel()\n");
+}
+
+static MWPIXELVAL
+DBG_readpixel(PSD psd,MWCOORD x, MWCOORD y)
+{
+	printd("DBG_readpixel()\n");
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+DBG_drawhline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	printd("DBG_drawhline()\n");
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+DBG_drawvline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	printd("DBG_drawvline()\n");
+}
+
+static void
+DBG_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2,
+	MWPIXELVAL c)
+{
+	printd("DBG_fillrect()\n");
+}
+
+void DBG_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	printd("DBG_blit()\n");
+}
diff -urN lib/microwindows/src/drivers/scr_djgr.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_djgr.c
--- lib/microwindows/src/drivers/scr_djgr.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_djgr.c	2005-02-21 16:13:10.000000000 +0100
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com> 
+ *
+ * Copyright (c) 1999 Victor Rogachev <rogach@sut.ru>
+ *
+ * Screen Driver using DJGPP & GRX  Library
+ *
+ *  For only GRX lib 
+ *
+ * This driver requires the following GRX entry points:
+ * 	GrSetMode, GrSetColor, GrPlot, GrPixel,
+ * 	GrHLine, GrVLine, GrFilledBox
+ *
+ * All graphics drawing primitives are based on top of these functions.
+ */
+
+#include <stdio.h>
+#include "device.h"
+#include "genfont.h"
+
+#include <grx20.h>
+
+/* specific grxlib driver entry points*/
+static PSD  DJGR_open(PSD psd);
+static void DJGR_close(PSD psd);
+static void DJGR_getscreeninfo(PSD psd,PMWSCREENINFO psi);
+static void DJGR_setpalette(PSD psd,int first,int count,MWPALENTRY *pal);
+static void DJGR_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c);
+static MWPIXELVAL DJGR_readpixel(PSD psd,MWCOORD x, MWCOORD y);
+static void DJGR_drawhline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c);
+static void DJGR_drawvline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c);
+static void DJGR_fillrect(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,MWPIXELVAL c);
+static void DJGR_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,
+		MWCOORD h,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op);
+static PSD  DJGR_allocatememgc(PSD psd);
+
+SCREENDEVICE	scrdev = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
+	DJGR_open,
+	DJGR_close,
+	DJGR_getscreeninfo,
+	DJGR_setpalette,
+	DJGR_drawpixel,
+	DJGR_readpixel,
+	DJGR_drawhline,
+	DJGR_drawvline,
+	DJGR_fillrect,
+	gen_fonts,
+	DJGR_blit,
+	NULL,			/* PreSelect*/
+	NULL,			/* DrawArea subdriver*/
+	NULL,			/* SetIOPermissions*/
+	DJGR_allocatememgc,
+	NULL,			/* MapMemGC*/
+	NULL			/* FreeMemGC*/
+};
+
+extern int gr_mode;	/* temp kluge*/
+
+
+/*
+**	Open graphics
+*/
+static PSD
+DJGR_open(PSD psd)
+{
+	int		x;
+	int		y;
+	int		c;
+        GrVideoMode	*md_info;
+
+	x = 640;
+	y = 480;
+	c = 16;
+
+        GrSetMode(GR_width_height_color_graphics,x,y,c);
+
+        md_info = (GrVideoMode *) GrCurrentVideoMode();
+
+	psd->xres = psd->xvirtres = GrScreenX();
+	psd->yres = psd->yvirtres = GrScreenY();
+	psd->linelen = md_info->lineoffset;
+	psd->planes = 1;
+	psd->bpp = md_info->bpp;
+	psd->ncolors = GrNumColors();
+	psd->flags = PSF_SCREEN;
+	psd->addr = 0;		/* FIXME */
+
+	/* note: must change psd->pixtype here for truecolor systems*/
+	psd->pixtype = MWPF_PALETTE;
+
+	return psd;
+}
+
+/*
+**	Close graphics
+*/
+static void
+DJGR_close(PSD psd)
+{
+	GrSetMode(GR_default_text);
+}
+
+/*
+**	Get Screen Info
+*/
+static void
+DJGR_getscreeninfo(PSD psd,PMWSCREENINFO psi)
+{
+	psi->rows = psd->yvirtres;
+	psi->cols = psd->xvirtres;
+	psi->planes = psd->planes;
+	psi->bpp = psd->bpp;
+	psi->ncolors = psd->ncolors;
+	psi->pixtype = psd->pixtype;
+	psi->fonts = NUMBER_FONTS;
+        
+	if(scrdev.yvirtres > 480) {
+		/* SVGA 800x600*/
+		psi->xdpcm = 33;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 33;	/* assumes screen height of 18 cm*/
+	} else if(scrdev.yvirtres > 350) {
+		/* VGA 640x480*/
+		psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 27;	/* assumes screen height of 18 cm*/
+	} else {
+		/* EGA 640x350*/
+		psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 19;	/* assumes screen height of 18 cm*/
+	}
+}
+
+/*
+**	Set Palette
+*/
+static void
+DJGR_setpalette(PSD psd,int first,int count,MWPALENTRY *pal)
+{
+	while(first < 256 && count-- > 0) {
+		GrSetColor(first++, pal->r, pal->g, pal->b);
+		++pal;
+	}
+}
+
+/*
+**	Draw Pixel
+*/
+static void
+DJGR_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	GrPlot(x, y, c);
+}
+
+/*
+**	Read Pixel
+*/
+static MWPIXELVAL
+DJGR_readpixel(PSD psd,MWCOORD x, MWCOORD y)
+{
+	return GrPixel(x, y);
+}
+
+/*
+**	Draw Horizontal Line
+*/
+static void
+DJGR_drawhline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	GrHLine(x1, x2, y, c);
+}
+
+/*
+**	Draw Vertical Line
+*/
+static void
+DJGR_drawvline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	GrVLine(x, y1, y2, c);
+}
+
+/*
+**	Filled Box
+*/
+static void
+DJGR_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2, MWPIXELVAL c)
+{
+	GrFilledBox(x1, y1, x2, y2, c);
+}
+
+/*
+**	Blit
+*/
+static void
+DJGR_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,MWCOORD h,
+		PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op)
+{
+	/* FIXME*/
+}
+
+/* allocate a memory screen device*/
+static PSD 
+DJGR_allocatememgc(PSD psd)
+{
+	/* if driver doesn't have blit, fail*/
+	return NULL;
+}
diff -urN lib/microwindows/src/drivers/scr_ecos_assabet.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_ecos_assabet.c
--- lib/microwindows/src/drivers/scr_ecos_assabet.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_ecos_assabet.c	2005-02-21 16:13:13.000000000 +0100
@@ -0,0 +1,154 @@
+/* Driver for eCos on assabet,
+ *  Based on Greg Haerr's scr_fb.c
+ * Copyright (c) 2001 I-Jui Sung <ijsung@csie.nctu.edu.tw>
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ */
+#include <pkgconf/system.h>
+
+#include <cyg/infra/diag.h>
+#include <cyg/hal/hal_io.h>       // IO macros
+#include <cyg/hal/hal_arch.h>     // Register state info
+#include <cyg/hal/hal_intr.h>     // HAL interrupt macros
+
+#include <cyg/hal/hal_sa11x0.h>   // Board definitions
+#include <cyg/hal/assabet.h>
+#include <cyg/hal/hal_cache.h>
+
+#include <cyg/kernel/kapi.h>
+#include <cyg/infra/diag.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "device.h"
+#include "vgaplan4.h"
+#include "genfont.h"
+#include "genmem.h"
+
+#include "fb.h"
+
+static PSD  assabet_open(PSD psd);
+static void assabet_close(PSD psd);
+
+static void assabet_getscreeninfo(PSD psd,PMWSCREENINFO psi);
+static void assabet_setpalette(PSD psd,int first,int count,MWPALENTRY *pal);
+
+extern MWBOOL fb_mapmemgc(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,
+		int linelen,int size,void *addr);
+
+SCREENDEVICE	scrdev = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
+	assabet_open,		/* Open */
+	assabet_close,	/* Close */
+	assabet_getscreeninfo,
+	assabet_setpalette,			//Setpalette
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,			/* FillRect */
+	gen_fonts,		/* PMWCOREFONT builtin_fonts */
+	NULL,			/* Blitting */
+	NULL,			/* PreSelect*/
+	NULL,			/* DrawArea*/
+	NULL,			/* SetIOPermissions*/
+	gen_allocatememgc,
+	fb_mapmemgc,
+	gen_freememgc
+};
+
+static struct lcd_frame {
+    unsigned short palette[16];
+    unsigned short pixels[240][320];
+    unsigned char  pad[256];
+} lcd_frame_buffer;
+
+static volatile struct lcd_frame *fp;
+
+/* Return FB address, NULL if failed */
+static void *
+OpenFB(void)
+{
+	// Currently only color/16bpp supported
+	unsigned long _fp;
+	// Frame buffer must be aligned on a 16 byte boundary
+	_fp = (((unsigned long)&lcd_frame_buffer) + 15) & ~15;
+	fp = (struct lcd_frame *)(_fp + SA11X0_RAM_BANK0_BASE);
+	// Enable LCD in 320x240 16bpp
+	*SA1110_DBAR1 = (unsigned long)&(fp->palette);
+	*SA1110_LCCR1 = 0x1D1D0930;
+	*SA1110_LCCR2 = 0xEF;
+	*SA1110_LCCR3 = 0x0c;
+	fp->palette[0] = 0x2000;  // Tell controller 16 bits
+//    *SA1110_LCCR0 = 0xBB;  // B&W
+	*SA1110_LCCR0 = 0xB9;  // Color
+//    assabet_BCR(SA1110_BCR_LCD_BPP, SA1110_BCR_LCD_12BPP);
+	assabet_BCR(SA1110_BCR_LCD_BPP, SA1110_BCR_LCD_16BPP);
+	assabet_BCR(SA1110_BCR_LCD, SA1110_BCR_LCD_ON);
+	assabet_BCR(SA1110_BCR_BACKLIGHT, SA1110_BCR_BACKLIGHT);
+	return (void *)fp->pixels;
+}
+static PSD
+assabet_open(PSD psd)
+{
+	PSUBDRIVER subdriver;
+
+	/* framebuffer attributes are fixed*/
+	psd->xres = psd->xvirtres = 320;	/*defined in gtkserv.h*/
+	psd->yres = psd->yvirtres = 240;
+	psd->planes = 1;
+	psd->bpp = 16;
+	psd->pixtype = MWPF_TRUECOLOR565;
+
+	/* set linelen to pixel nr (>8 bit)*/
+	psd->linelen = psd->xvirtres*2;
+
+	psd->ncolors = (psd->bpp >= 24)? (1 << 24): (1 << psd->bpp);
+	psd->size = 0; /* force subdriver init of size*/
+	psd->addr=OpenFB();
+	psd->flags = PSF_SCREEN | PSF_HAVEBLIT;
+	/* select a framebuffer subdriver based on planes and bpp*/
+	subdriver = select_fb_subdriver(psd);
+	if (!subdriver) {
+        	EPRINTF("No driver for screen bpp %d\n", psd->bpp);
+        	return NULL;
+	}
+	/*
+	 * set and initialize subdriver into screen driver
+	 * psd->size is calculated by subdriver init
+	 */
+	if(!set_subdriver(psd, subdriver, TRUE)) {
+        	EPRINTF("Driver initialize failed for bpp %d\n", psd->bpp);
+        	return NULL;
+	}
+	if(psd->addr == NULL || psd->addr == (unsigned char *)-1) return NULL;
+	return psd;
+}
+static void
+assabet_close(PSD psd)
+{
+	/* Exit from graphic mode here*/
+	/* Todo: detach from shared memeory */
+}
+
+static void
+assabet_getscreeninfo(PSD psd,PMWSCREENINFO psi)
+{
+	psi->rows = psd->yvirtres;
+	psi->cols = psd->xvirtres;
+	psi->planes = psd->planes;
+	psi->bpp = psd->bpp;
+	psi->ncolors = psd->ncolors;
+	psi->pixtype = psd->pixtype;
+	psi->fonts = NUMBER_FONTS;
+
+	psi->xdpcm = 24;	/* assumes screen width of 24 cm*/
+	psi->ydpcm = 18;	/* assumes screen height of 18 cm*/
+}
+
+static void
+assabet_setpalette(PSD psd,int first,int count,MWPALENTRY *pal)
+{
+	/* not yet implemented, std 16 color palette assumed*/
+}
diff -urN lib/microwindows/src/drivers/scr_ecos_gtkserver.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_ecos_gtkserver.c
--- lib/microwindows/src/drivers/scr_ecos_gtkserver.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_ecos_gtkserver.c	2005-02-21 16:13:13.000000000 +0100
@@ -0,0 +1,204 @@
+/* X11 GTK+ Framebuffer simulator for eCos driver,
+ *  Based on Greg Haerr's scr_vga.c 
+ * Copyright (c) 2001 I-Jui Sung <ijsung@csie.nctu.edu.tw>
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ */
+#include <cyg/kernel/kapi.h>
+#include <cyg/infra/diag.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "device.h"
+#include "vgaplan4.h"
+#include "genfont.h"
+#include "genmem.h"
+
+#include<linux/net.h>
+#include<linux/un.h>
+
+#include<asm/ipc.h>
+#include "gtkserv.h"
+#include "fb.h"
+
+#define __NR_ipc                117
+
+/* Copied and modified from asm/unistd.h :( */
+/* user-visible error numbers are in the range -1 - -122: see <asm-i386/errno.h> */
+
+#define __syscall_return(type, res) do { \
+	if ((unsigned long)(res) >= (unsigned long)(-125)) { \
+		res = -1; \
+	} \
+	return (type) (res); \
+} while (0)
+
+#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
+          type5,arg5) \
+type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
+{ \
+long __res; \
+__asm__ volatile ("int $0x80" \
+        : "=a" (__res) \
+        : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
+          "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \
+__syscall_return(type,__res); \
+}
+
+static inline _syscall5(int, ipc, int, call, int, first,int,second,int, third,void*, ptr);
+
+static void * 
+Shmat(int shmid, const void *shmaddr, int shmflg)
+{
+	unsigned long r;
+	if(ipc(SHMAT,shmid,shmflg,(int)&r,(void *)shmaddr))
+		return (void *)-1;
+	else
+		return (void *)r;
+}
+static int 
+Socket(int domain,int type,int protocol)
+{
+	unsigned long args[3]={domain,type,protocol};
+	return cyg_hal_sys_socketcall(SYS_SOCKET,args);
+}
+
+static int 
+connect(int sockfd, struct sockaddr_un *serv_addr,int addrlen)
+{
+	unsigned long args[3]={sockfd,(unsigned long)serv_addr,addrlen};
+	return cyg_hal_sys_socketcall(SYS_CONNECT,args);
+}
+
+/* GTK Server under X11&Linux driver entry points*/
+static PSD  GTKServer_open(PSD psd);
+static void GTKServer_close(PSD psd);
+
+static void GTKServer_getscreeninfo(PSD psd,PMWSCREENINFO psi);
+static void GTKServer_setpalette(PSD psd,int first,int count,MWPALENTRY *pal);
+
+extern MWBOOL fb_mapmemgc(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,
+		int linelen,int size,void *addr);
+
+SCREENDEVICE	scrdev = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
+	GTKServer_open,		/* Open */
+	GTKServer_close,	/* Close */
+	GTKServer_getscreeninfo,
+	GTKServer_setpalette,			//Setpalette
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,			/* FillRect */
+	gen_fonts,		/* PMWCOREFONT builtin_fonts */
+	NULL,			/* Blitting */
+	NULL,			/* PreSelect*/
+	NULL,			/* DrawArea*/
+	NULL,			/* SetIOPermissions*/
+	gen_allocatememgc,
+	fb_mapmemgc,
+	gen_freememgc
+};
+static int sock;	//unix domain socket for simulator
+
+serverinfo * ServerInfo=NULL;	//structure for gathering information from simulator
+static void *
+OpenFB(void)
+{
+	struct sockaddr_un address;
+	int shm_id;
+	int addrlen;
+	void * buf;
+	diag_printf("Trying to connect to GTKServer\n");
+#define SOCK_STREAM 1
+#undef  PF_UNIX
+#define PF_UNIX	1
+	if((sock=Socket(PF_UNIX, SOCK_STREAM,0))<0) {
+		diag_printf("Can't open unix domain socket\n");
+		return NULL;
+	}
+#define AF_UNIX 1
+	address.sun_family=AF_UNIX;
+	strcpy(address.sun_path, UDS);
+	addrlen=sizeof(address.sun_family)+strlen(address.sun_path);
+	if(connect(sock,&address,addrlen))
+	{
+		return NULL;
+        	diag_printf("Can't connect\n");
+	}
+	else
+		diag_printf("Connection Established.\n");
+	//get shm id
+	cyg_hal_sys_read(sock,&shm_id,sizeof(shm_id));
+	diag_printf("FB Shm id=%d\n",shm_id);
+	//Attach..
+        buf=Shmat(shm_id,NULL,0);
+        if(buf==(void*)-1) diag_printf("Shmat: Can't Attatch Shm. Permission Denied??\n");
+	ServerInfo=(serverinfo *)buf;
+	return buf+sizeof(serverinfo);
+}
+static PSD
+GTKServer_open(PSD psd)
+{
+	PSUBDRIVER subdriver;
+
+	/* framebuffer attributes are fixed*/
+	psd->xres = psd->xvirtres = BUFFER_WIDTH;	/*defined in gtkserv.h*/
+	psd->yres = psd->yvirtres = BUFFER_HEIGHT;
+	psd->planes = 1;
+	psd->bpp = 24;
+	psd->pixtype = MWPF_TRUECOLOR888;
+
+	/* set linelen to pixel nr (>8 bit)*/
+	psd->linelen = psd->xvirtres*3;
+	psd->ncolors = (psd->bpp >= 24)? (1 << 24): (1 << psd->bpp);
+	psd->size = 0; /* force subdriver init of size*/
+	psd->addr=OpenFB();
+	psd->flags = PSF_SCREEN | PSF_HAVEBLIT;
+	/* select a framebuffer subdriver based on planes and bpp*/
+	subdriver = select_fb_subdriver(psd);
+	if (!subdriver) {
+        	EPRINTF("No driver for screen bpp %d\n", psd->bpp);
+        	return NULL;
+	}
+	/*
+	 * set and initialize subdriver into screen driver
+	 * psd->size is calculated by subdriver init
+	 */
+	if(!set_subdriver(psd, subdriver, TRUE)) {
+        	EPRINTF("Driver initialize failed for bpp %d\n", psd->bpp);
+        	return NULL;
+	}
+	if(psd->addr == NULL || psd->addr == (unsigned char *)-1) return NULL;
+	return psd;
+}
+static void
+GTKServer_close(PSD psd)
+{
+	/* Exit from graphic mode here*/
+	cyg_hal_sys_close(sock);
+	/* Todo: detach from shared memeory */
+}
+
+static void
+GTKServer_getscreeninfo(PSD psd,PMWSCREENINFO psi)
+{
+	psi->rows = psd->yvirtres;
+	psi->cols = psd->xvirtres;
+	psi->planes = psd->planes;
+	psi->bpp = psd->bpp;
+	psi->ncolors = psd->ncolors;
+	psi->pixtype = psd->pixtype;
+	psi->fonts = NUMBER_FONTS;
+
+	psi->xdpcm = 24;	/* assumes screen width of 24 cm*/
+	psi->ydpcm = 18;	/* assumes screen height of 18 cm*/
+}
+
+static void
+GTKServer_setpalette(PSD psd,int first,int count,MWPALENTRY *pal)
+{
+	/* not yet implemented, std 16 color palette assumed*/
+}
diff -urN lib/microwindows/src/drivers/scr_fb.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_fb.c
--- lib/microwindows/src/drivers/scr_fb.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_fb.c	2005-02-21 16:13:10.000000000 +0100
@@ -0,0 +1,455 @@
+/*
+ * Copyright (c) 1999, 2000, 2001 Greg Haerr <greg@censoft.com>
+ *
+ * Microwindows Screen Driver for Linux kernel framebuffers
+ *
+ * Portions used from Ben Pfaff's BOGL <pfaffben@debian.org>
+ * 
+ * Note: modify select_fb_driver() to add new framebuffer subdrivers
+ */
+#define _GNU_SOURCE 1
+#include <assert.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <linux/fb.h>
+#include <linux/kd.h>
+#include <linux/vt.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#ifndef ARCH_LINUX_POWERPPC
+#include <sys/io.h>
+/*#include <asm/io.h>*/
+#endif
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include "device.h"
+#include "genfont.h"
+#include "genmem.h"
+#include "fb.h"
+
+/* for Osprey and Embedded Planet boards, set HAVETEXTMODE=0*/
+#define HAVETEXTMODE	1	/* =0 for graphics only systems*/
+#define EMBEDDEDPLANET	0	/* =1 for kluge embeddedplanet ppc framebuffer*/
+
+#ifndef FB_TYPE_VGA_PLANES
+#define FB_TYPE_VGA_PLANES 4
+#endif
+
+static PSD  fb_open(PSD psd);
+static void fb_close(PSD psd);
+static void fb_setpalette(PSD psd,int first, int count, MWPALENTRY *palette);
+static void gen_getscreeninfo(PSD psd,PMWSCREENINFO psi);
+
+SCREENDEVICE	scrdev = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
+	fb_open,
+	fb_close,
+	gen_getscreeninfo,
+	fb_setpalette,
+	NULL,			/* DrawPixel subdriver*/
+	NULL,			/* ReadPixel subdriver*/
+	NULL,			/* DrawHorzLine subdriver*/
+	NULL,			/* DrawVertLine subdriver*/
+	NULL,			/* FillRect subdriver*/
+	gen_fonts,
+	NULL,			/* Blit subdriver*/
+	NULL,			/* PreSelect*/
+	NULL,			/* DrawArea subdriver*/
+	NULL,			/* SetIOPermissions*/
+	gen_allocatememgc,
+	fb_mapmemgc,
+	gen_freememgc
+};
+
+/* static variables*/
+static int fb;			/* Framebuffer file handle. */
+static int status;		/* 0=never inited, 1=once inited, 2=inited. */
+static short saved_red[16];	/* original hw palette*/
+static short saved_green[16];
+static short saved_blue[16];
+#if PORTRAIT
+int gr_portraitmode = PORTRAIT;	/* =1 portrait left, =2 portrait right*/
+#endif
+
+/* local functions*/
+static void	set_directcolor_palette(PSD psd);
+
+/* init framebuffer*/
+static PSD
+fb_open(PSD psd)
+{
+	char *	env;
+	int	type, visual;
+	PSUBDRIVER subdriver;
+#if EMBEDDEDPLANET
+	env = "/dev/lcd";
+	fb = open(env, O_RDWR);
+	if(fb < 0) {
+		EPRINTF("Error opening %s: %m", env);
+		return NULL;
+	}
+	/* framebuffer attributes are fixed*/
+	type = FB_TYPE_PACKED_PIXELS;
+	visual = FB_VISUAL_PSEUDOCOLOR;
+	psd->xres = psd->xvirtres = 640;
+	psd->yres = psd->yvirtres = 480;
+	psd->planes = 1;
+	psd->bpp = 8;
+	/* set linelen to byte length, possibly converted later*/
+	psd->linelen = psd->xvirtres;
+	psd->ncolors = (psd->bpp >= 24)? (1 << 24): (1 << psd->bpp);
+	psd->size = 0;		/* force subdriver init of size*/
+
+        if (ioctl(fb, 1, 0) < 0) {
+		EPRINTF("Error: can't enable LCD");
+		goto fail;
+	}
+#else
+	int	tty;
+	struct fb_fix_screeninfo fb_fix;
+	struct fb_var_screeninfo fb_var;
+
+	assert(status < 2);
+
+	/* locate and open framebuffer, get info*/
+	if(!(env = getenv("FRAMEBUFFER")))
+		env = "/dev/fb0";
+	fb = open(env, O_RDWR);
+	if(fb < 0) {
+		EPRINTF("Error opening %s: %m. Check kernel config\n", env);
+		return NULL;
+	}
+	if(ioctl(fb, FBIOGET_FSCREENINFO, &fb_fix) == -1 ||
+		ioctl(fb, FBIOGET_VSCREENINFO, &fb_var) == -1) {
+			EPRINTF("Error reading screen info: %m\n");
+			goto fail;
+	}
+	/* setup screen device from framebuffer info*/
+	type = fb_fix.type;
+	visual = fb_fix.visual;
+
+	psd->xres = psd->xvirtres = fb_var.xres;
+	psd->yres = psd->yvirtres = fb_var.yres;
+#if PORTRAIT
+	/* init global here in case used as shared library*/
+	gr_portraitmode = PORTRAIT;
+
+	/* automatic portrait mode if y resolution is greater than x res*/
+	/*** commented out, PORTRAIT_MODE=[R,L] used for compile time option***/
+	/***if(psd->yres > psd->xres)
+		gr_portraitmode = 1;***/
+#endif
+	/* set planes from fb type*/
+	if (type == FB_TYPE_VGA_PLANES)
+		psd->planes = 4;
+	else if (type == FB_TYPE_PACKED_PIXELS)
+		psd->planes = 1;
+	else psd->planes = 0;	/* force error later*/
+
+	psd->bpp = fb_var.bits_per_pixel;
+	psd->ncolors = (psd->bpp >= 24)? (1 << 24): (1 << psd->bpp);
+
+	/* set linelen to byte length, possibly converted later*/
+	psd->linelen = fb_fix.line_length;
+	psd->size = 0;		/* force subdriver init of size*/
+#endif /* !EMBEDDEDPLANET*/
+
+	psd->flags = PSF_SCREEN | PSF_HAVEBLIT;
+	if (psd->bpp == 16)
+		psd->flags |= PSF_HAVEOP_COPY;
+
+#if PORTRAIT
+	/* determine whether to run in portrait mode*/
+	if(gr_portraitmode) {
+		psd->flags |= PSF_PORTRAIT;
+
+		/* swap x, y*/
+		psd->xvirtres = psd->yres;
+		psd->yvirtres = psd->xres;
+	}
+#endif
+
+	/* set pixel format*/
+#ifndef TPHELIO /* temp kluge: VTech Helio kernel needs changing*/
+	if(visual == FB_VISUAL_TRUECOLOR || visual == FB_VISUAL_DIRECTCOLOR) {
+		switch(psd->bpp) {
+		case 8:
+			psd->pixtype = MWPF_TRUECOLOR332;
+			break;
+		case 16:
+			if (fb_var.green.length == 5)
+				psd->pixtype = MWPF_TRUECOLOR555;
+			else
+				psd->pixtype = MWPF_TRUECOLOR565;
+			break;
+		case 24:
+			psd->pixtype = MWPF_TRUECOLOR888;
+			break;
+		case 32:
+			psd->pixtype = MWPF_TRUECOLOR0888;
+			break;
+		default:
+			EPRINTF(
+			"Unsupported %d color (%d bpp) truecolor framebuffer\n",
+				psd->ncolors, psd->bpp);
+			goto fail;
+		}
+	} else 
+#endif
+		psd->pixtype = MWPF_PALETTE;
+
+	/*DPRINTF("%dx%dx%d linelen %d type %d visual %d bpp %d\n", psd->xres,
+	 	psd->yres, psd->ncolors, psd->linelen, type, visual,
+		psd->bpp);*/
+
+	/* select a framebuffer subdriver based on planes and bpp*/
+	subdriver = select_fb_subdriver(psd);
+	if (!subdriver) {
+		EPRINTF("No driver for screen type %d visual %d bpp %d\n",
+			type, visual, psd->bpp);
+		goto fail;
+	}
+
+	/*
+	 * set and initialize subdriver into screen driver
+	 * psd->size is calculated by subdriver init
+	 */
+	if(!set_subdriver(psd, subdriver, TRUE)) {
+		EPRINTF("Driver initialize failed type %d visual %d bpp %d\n",
+			type, visual, psd->bpp);
+		goto fail;
+	}
+
+#if PORTRAIT
+	if(psd->flags & PSF_PORTRAIT) {
+		/* remember original subdriver*/
+		_subdriver = subdriver;
+
+		/* assign portrait subdriver which calls original subdriver*/
+		set_subdriver(psd, &fbportrait, FALSE);
+	}
+#endif
+#if HAVETEXTMODE
+	/* open tty, enter graphics mode*/
+	tty = open ("/dev/tty0", O_RDWR);
+	if(tty < 0) {
+		EPRINTF("Error can't open /dev/tty0: %m\n");
+		goto fail;
+	}
+	if(ioctl (tty, KDSETMODE, KD_GRAPHICS) == -1) {
+		EPRINTF("Error setting graphics mode: %m\n");
+		close(tty);
+		goto fail;
+	}
+	close(tty);
+#endif
+	/* mmap framebuffer into this address space*/
+	psd->size = (psd->size + getpagesize () - 1)
+			/ getpagesize () * getpagesize ();
+	psd->addr = mmap(NULL, psd->size, PROT_READ|PROT_WRITE,MAP_SHARED,fb,0);
+	if(psd->addr == NULL || psd->addr == (unsigned char *)-1) {
+		EPRINTF("Error mmaping %s: %m\n", env);
+		goto fail;
+	}
+
+	/* save original palette*/
+	ioctl_getpalette(0, 16, saved_red, saved_green, saved_blue);
+
+	/* setup direct color palette if required (ATI cards)*/
+	if(visual == FB_VISUAL_DIRECTCOLOR)
+		set_directcolor_palette(psd);
+
+	status = 2;
+	return psd;	/* success*/
+
+fail:
+	close(fb);
+	return NULL;
+}
+
+/* close framebuffer*/
+static void
+fb_close(PSD psd)
+{
+	int	tty;
+
+	/* if not opened, return*/
+	if(status != 2)
+		return;
+	status = 1;
+
+  	/* reset hw palette*/
+	ioctl_setpalette(0, 16, saved_red, saved_green, saved_blue);
+  
+	/* unmap framebuffer*/
+	munmap(psd->addr, psd->size);
+  
+#if HAVETEXTMODE
+	/* enter text mode*/
+	tty = open ("/dev/tty0", O_RDWR);
+	ioctl(tty, KDSETMODE, KD_TEXT);
+	close(tty);
+#endif
+	/* close framebuffer*/
+	close(fb);
+}
+
+/* setup directcolor palette - required for ATI cards*/
+static void
+set_directcolor_palette(PSD psd)
+{
+	int i;
+	short r[256];
+
+	/* 16bpp uses 32 palette entries*/
+	if(psd->bpp == 16) {
+		for(i=0; i<32; ++i)
+			r[i] = i<<11;
+		ioctl_setpalette(0, 32, r, r, r);
+	} else {
+		/* 32bpp uses 256 entries*/
+		for(i=0; i<256; ++i)
+			r[i] = i<<8;
+		ioctl_setpalette(0, 256, r, r, r);
+	}
+}
+
+static int fade = 100;
+
+/* convert Microwindows palette to framebuffer format and set it*/
+static void
+fb_setpalette(PSD psd,int first, int count, MWPALENTRY *palette)
+{
+	int 	i;
+	unsigned short 	red[count];
+	unsigned short 	green[count];
+	unsigned short 	blue[count];
+
+	/* convert palette to framebuffer format*/
+	for(i=0; i < count; i++) {
+		MWPALENTRY *p = &palette[i];
+
+		/* grayscale computation:
+		 * red[i] = green[i] = blue[i] =
+		 *	(p->r * 77 + p->g * 151 + p->b * 28);
+		 */
+		red[i] = (p->r * fade / 100) << 8;
+		green[i] = (p->g * fade / 100) << 8;
+		blue[i] = (p->b * fade / 100) << 8;
+	}
+	ioctl_setpalette(first, count, red, green, blue);
+}
+
+/* get framebuffer palette*/
+void
+ioctl_getpalette(int start, int len, short *red, short *green, short *blue)
+{
+#if EMBEDDEDPLANET
+	int 		i;
+	unsigned short 	colors[256];
+
+	ioctl(fb, 4, colors);
+	for (i = start; ((i - start) < len) && (i < 256); i++) {
+		red[i - start] = (colors[i] & 0xf00) << 4;
+		green[i - start] = (colors[i] & 0x0f0) << 8;
+		blue[i - start] = (colors[i] & 0x00f) << 12;
+	}
+#else
+	struct fb_cmap cmap;
+
+	cmap.start = start;
+	cmap.len = len;
+	cmap.red = red;
+	cmap.green = green;
+	cmap.blue = blue;
+	cmap.transp = NULL;
+
+	ioctl(fb, FBIOGETCMAP, &cmap);
+#endif
+}
+
+/* set framebuffer palette*/
+void
+ioctl_setpalette(int start, int len, short *red, short *green, short *blue)
+{
+#if EMBEDDEDPLANET
+	int 		i;
+	unsigned short 	colors[256];
+
+	ioctl(fb, 4, colors);
+	for (i = start; ((i - start) < len) && (i < 256); i++) {
+		colors[i] = ((red[i - start] & 0xf000) >> 4)
+			| ((green[i - start] & 0xf000) >> 8)
+			| ((blue[i - start] & 0xf000) >> 12);
+	}
+	ioctl(fb, 3, colors);
+#else
+	struct fb_cmap cmap;
+
+	cmap.start = start;
+	cmap.len = len;
+	cmap.red = red;
+	cmap.green = green;
+	cmap.blue = blue;
+	cmap.transp = NULL;
+
+	ioctl(fb, FBIOPUTCMAP, &cmap);
+#endif
+}
+
+/* experimental palette animation*/
+void
+setfadelevel(PSD psd, int f)
+{
+	int 		i;
+	unsigned short 	r[256], g[256], b[256];
+	extern MWPALENTRY gr_palette[256];
+
+	if(psd->pixtype != MWPF_PALETTE)
+		return;
+
+	fade = f;
+	if(fade > 100)
+		fade = 100;
+	for(i=0; i<256; ++i) {
+		r[i] = (gr_palette[i].r * fade / 100) << 8;
+		g[i] = (gr_palette[i].g * fade / 100) << 8;
+		b[i] = (gr_palette[i].b * fade / 100) << 8;
+	}
+	ioctl_setpalette(0, 256, r, g, b);
+}
+
+static void
+gen_getscreeninfo(PSD psd,PMWSCREENINFO psi)
+{
+	psi->rows = psd->yvirtres;
+	psi->cols = psd->xvirtres;
+	psi->planes = psd->planes;
+	psi->bpp = psd->bpp;
+	psi->ncolors = psd->ncolors;
+	psi->pixtype = psd->pixtype;
+	psi->fonts = NUMBER_FONTS;
+
+	if(psd->yvirtres > 480) {
+		/* SVGA 800x600*/
+		psi->xdpcm = 33;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 33;	/* assumes screen height of 18 cm*/
+	} else if(psd->yvirtres > 350) {
+		/* VGA 640x480*/
+		psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 27;	/* assumes screen height of 18 cm*/
+        } else if(psd->yvirtres <= 240) {
+		/* half VGA 640x240 */
+		psi->xdpcm = 14;        /* assumes screen width of 24 cm*/ 
+		psi->ydpcm =  5;
+	} else {
+		/* EGA 640x350*/
+		psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 19;	/* assumes screen height of 18 cm*/
+	}
+}
diff -urN lib/microwindows/src/drivers/scr_fbsd.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_fbsd.c
--- lib/microwindows/src/drivers/scr_fbsd.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_fbsd.c	2005-02-21 16:03:18.000000000 +0100
@@ -0,0 +1,436 @@
+/*
+ * Copyright (C) 2000 Andrew K. Milton -- akm@theinternet.com.au
+ *
+ * Basically I stole stuff from all the other drivers, a bit here
+ * a bit there. Don't look in here for a "good" example of a driver.
+ *
+ * FreeBSD VGL screen driver for Microwindows
+ */
+
+#include <stdio.h>
+#include <machine/console.h>
+#include <vgl.h>
+#include <signal.h>
+#include <osreldate.h>
+
+/*#include "def.h" */
+/*#include "hardware.h" */
+/*##include "title_gz.h" */
+
+#include "device.h"
+#include "fb.h"
+#include "genmem.h"
+#include "genfont.h"
+
+#ifndef SCREEN_WIDTH
+#define SCREEN_WIDTH 800
+#endif
+
+#ifndef SCREEN_HEIGHT
+#define SCREEN_HEIGHT 600
+#endif
+
+#ifndef SCREEN_DEPTH
+#define SCREEN_DEPTH 8
+#endif
+
+
+#ifndef MWPIXEL_FORMAT
+#define MWPIXEL_FORMAT MWPF_PALETTE
+#endif
+
+#if ALPHABLEND
+/*
+ * Alpha lookup tables for 256 color palette systems
+ * A 5 bit alpha value is used to keep tables smaller.
+ *
+ * Two tables are created.  The first, alpha_to_rgb contains 15 bit RGB 
+ * values for each alpha value for each color: 32*256 short words.
+ * RGB values can then be blended.  The second, rgb_to_palindex contains
+ * the closest color (palette index) for each of the 5-bit
+ * R, G, and B values: 32*32*32 bytes.
+ */
+static unsigned short *alpha_to_rgb = NULL;
+static unsigned char  *rgb_to_palindex = NULL;
+static void init_alpha_lookup(void);
+#endif
+
+static SCREENDEVICE savebits;	/* permanent offscreen drawing buffer*/
+
+static PSD  FBSD_open(PSD psd);
+static void FBSD_close(PSD psd);
+static void FBSD_getscreeninfo(PSD psd,PMWSCREENINFO psi);
+static void FBSD_setpalette(PSD psd,int first,int count,MWPALENTRY *pal);
+static void FBSD_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c);
+static MWPIXELVAL FBSD_readpixel(PSD psd,MWCOORD x, MWCOORD y);
+static void FBSD_drawhline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c);
+static void FBSD_drawvline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c);
+static void FBSD_fillrect(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,MWPIXELVAL c);
+
+static void FBSD_preselect(PSD psd);
+static void FBSD_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,
+		      MWCOORD w,MWCOORD h,
+		      PSD srcpsd,MWCOORD srcx,MWCOORD srcy, long op);
+
+static void FBSD_blit2(PSD dstpsd,MWCOORD destx,MWCOORD desty,
+		      MWCOORD w,MWCOORD h,
+		      PSD srcpsd,MWCOORD srcx,MWCOORD srcy, long op);
+
+
+SCREENDEVICE	scrdev = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
+	FBSD_open,
+	FBSD_close,
+	FBSD_getscreeninfo,
+	FBSD_setpalette,
+	FBSD_drawpixel,
+	FBSD_readpixel,
+	FBSD_drawhline,
+	FBSD_drawvline,
+	FBSD_fillrect,
+	gen_fonts,
+	FBSD_blit2,
+	FBSD_preselect,
+	NULL,			/* DrawArea*/
+	NULL,			/* SetIOPermissions*/
+	gen_allocatememgc,
+	fb_mapmemgc,
+	gen_freememgc
+};
+
+void FBSD_handle_event(void)
+{
+    VGLCheckSwitch();
+}
+
+static void FBSD_close(PSD psd)
+{
+    VGLEnd();
+}
+
+static PSD FBSD_open(PSD psd)
+{
+    PSUBDRIVER subdriver;
+    int size, linelen;
+
+    if (geteuid() != 0) 
+    {
+	fprintf(stderr, "The current graphics console architecture ");
+	fprintf(stderr, "only permits super-user to access it, ");
+	fprintf(stderr, "therefore you either have to obtain such ");
+	fprintf(stderr, "permissions or ask your sysadmin to put ");
+	fprintf(stderr, "set-user-id on");
+	exit(1);
+    }
+
+
+
+    if (VGLInit(SW_VESA_CG800x600) != 0) 
+    {
+	fprintf(stderr, "WARNING! Could not initialise VESA mode. ");
+	fprintf(stderr, "Trying to fallback to the VGA 640x480 mode\n");
+	perror("microwin");
+
+	if (VGLInit(SW_CG640x480) != 0)
+	{
+	    fprintf(stderr, "WARNING! Could not initialise VGA mode ");
+	    fprintf(stderr, "either. Please check your kernel.\n");
+	    perror("microwin");
+	    return NULL;
+
+	}
+    }
+
+    psd -> xres    = psd->xvirtres = VGLDisplay->Xsize;
+    psd -> yres    = psd->yvirtres = VGLDisplay->Ysize;
+    psd -> linelen = VGLDisplay->Xsize;
+    psd -> planes  = 1;
+    psd -> pixtype = MWPIXEL_FORMAT;
+    psd -> bpp = 8;
+
+/*     switch(psd->pixtype) { */
+/*     case MWPF_PALETTE: */
+/* 	    psd->bpp = SCREEN_DEPTH; */
+/* 	    break; */
+/*     case MWPF_TRUECOLOR0888: */
+/*     default: */
+/* 	    psd->bpp = 32; */
+/* 	    break; */
+/*     case MWPF_TRUECOLOR888: */
+/* 	    psd->bpp = 24; */
+/* 	    break; */
+/*     case MWPF_TRUECOLOR565: */
+/* 	    psd->bpp = 16; */
+/* 	    break; */
+/*     case MWPF_TRUECOLOR332: */
+/* 	    psd->bpp = 8; */
+/* 	    break; */
+/*     } */
+
+
+    /*    psd->ncolors = psd->bpp >= 24? (1 << 24): (1 << psd->bpp); */
+    psd->ncolors = 256;
+    psd->size = 0;
+    psd->addr = NULL;
+    psd->flags = PSF_SCREEN|PSF_HAVEBLIT;
+
+    savebits=*psd;
+    savebits.flags=PSF_MEMORY | PSF_HAVEBLIT;
+    /* select a fb subdriver matching our planes and bpp */
+    subdriver = select_fb_subdriver(&savebits);
+    if (!subdriver) 
+    {
+	fprintf(stderr,"Subdriver allocation failed!\n");
+	return NULL;
+    }
+    /* calc size and linelen of savebits alloc*/
+    GdCalcMemGCAlloc(&savebits, savebits.xvirtres, savebits.yvirtres, 
+		     0, 0, &size, &linelen);
+
+    savebits.linelen = linelen;
+    savebits.size = size;
+    if ((savebits.addr = malloc(size)) == NULL)
+    {
+	fprintf(stderr,"Malloc for %d Failed!\n",size);
+	return NULL;
+    }
+
+    set_subdriver(&savebits, subdriver, TRUE);
+    return psd;
+}
+
+static void FBSD_getscreeninfo(PSD psd, PMWSCREENINFO psi)
+{
+    psi->rows = psd->yvirtres;
+    psi->cols = psd->xvirtres;
+    psi->planes = psd->planes;
+    psi->bpp = psd->bpp;
+    psi->ncolors = psd->ncolors;
+    psi->pixtype = psd->pixtype;
+    psi->fonts = NUMBER_FONTS;
+    if(psd->yvirtres > 480) 
+    {
+	/* SVGA 800x600*/
+	psi->xdpcm = 33;	/* assumes screen width of 24 cm*/
+	psi->ydpcm = 33;	/* assumes screen height of 18 cm*/
+    } 
+    else if(psd->yvirtres > 350) 
+    {
+	/* VGA 640x480*/
+	psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+	psi->ydpcm = 27;	/* assumes screen height of 18 cm*/
+    } 
+    else 
+    {
+	/* EGA 640x350*/
+	psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+	psi->ydpcm = 19;	/* assumes screen height of 18 cm*/
+    }
+}
+
+static void FBSD_setpalette(PSD psd, int first, int count, 
+			    MWPALENTRY *pal)
+{
+    while(first < 256 && count-- > 0) 
+    {
+	VGLSetPaletteIndex(first++, pal->r>>2, pal->g>>2, pal->b>>2);
+	++pal;
+    }
+
+}
+
+static void FBSD_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+    VGLSetXY(VGLDisplay, x, y, (unsigned char)c);
+    savebits.DrawPixel(&savebits, x, y, c);
+}
+
+static MWPIXELVAL FBSD_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+    return savebits.ReadPixel(&savebits,x,y);
+/*    return(VGLGetXY(VGLDisplay, x, y)); */
+}
+
+static void FBSD_drawhline(PSD psd, MWCOORD x1, MWCOORD x2, 
+			   MWCOORD y, MWPIXELVAL c)
+{
+    VGLLine(VGLDisplay, x1, y, x2, y, c);
+    savebits.DrawHorzLine(&savebits,x1,x2,y,c);
+}
+
+static void FBSD_drawvline(PSD psd, MWCOORD x, MWCOORD y1, 
+			   MWCOORD y2, MWPIXELVAL c)
+{
+    VGLLine(VGLDisplay, x, y1, x, y2, (unsigned char)c);
+    savebits.DrawVertLine(&savebits,x, y1, y2, c);
+}
+
+static void FBSD_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2, MWPIXELVAL c)
+{
+    VGLFilledBox(VGLDisplay,x1, y1, x2, y2, (unsigned char)c);
+    savebits.FillRect(&savebits,x1, y1, x2, y2, c);
+}
+
+static void FBSD_preselect(PSD psd)
+{
+    VGLCheckSwitch();
+}
+
+/*
+ * Really Really stupid blit 
+ */
+static void FBSD_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,
+		      MWCOORD w,MWCOORD h,
+		      PSD srcpsd,MWCOORD srcx,MWCOORD srcy, long op)
+{
+
+    int x, y;
+
+    if (dstpsd == srcpsd)
+    {
+	if(dstpsd->flags & PSF_SCREEN)
+	{
+ 	    VGLBitmapCopy(VGLDisplay, srcx, srcy, VGLDisplay, 
+ 			  destx, desty,  w, h); 
+ 	    savebits.Blit(&savebits, destx, desty, w, h,
+ 			  &savebits, srcx, srcy, op); 
+	}
+	else
+	{
+	    /* memory to memory blit, use offscreen blitter*/
+	    dstpsd->Blit(dstpsd, destx, desty, w, h, srcpsd, srcx, srcy, op);
+	}
+    }
+    else if (dstpsd->flags & PSF_SCREEN)
+    {
+	VGLBitmap *bitmap;
+	
+	bitmap=VGLBitmapCreate(MEMBUF , w, h, NULL);
+	VGLBitmapAllocateBits(bitmap);
+	for (y = 0; y < h; y++) 
+	{
+	    for (x = 0; x < w; x++) 
+	    {
+		MWPIXELVAL c = srcpsd->ReadPixel(srcpsd,srcx+x,srcy+y);
+		VGLSetXY(bitmap, x, y, c);
+		/* update screen savebits*/
+		savebits.DrawPixel(&savebits, destx+x, desty+y, c);
+	    }
+	}
+	VGLBitmapCopy(bitmap, srcx, srcy, VGLDisplay, 
+		      destx, desty,  w, h); 
+	VGLBitmapDestroy(bitmap);
+    }
+    else if (srcpsd->flags & PSF_SCREEN)
+    {
+	for (y = 0; y < h; y++) 
+	{
+	    for (x = 0; x < w; x++) 
+	    {	
+		MWPIXELVAL c = srcpsd->ReadPixel(srcpsd,srcx+x,srcy+y);
+		dstpsd->DrawPixel(dstpsd, destx+x, desty+y, c);
+	    }
+	}
+    }
+}
+
+/* srccopy bitblt*/
+static void
+FBSD_blit2(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	   PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+#if ALPHABLEND
+
+    unsigned int srcalpha, dstalpha;
+
+    if((op & MWROP_EXTENSION) != MWROP_BLENDCONSTANT)
+	goto stdblit;
+    srcalpha = op & 0xff;
+
+    /* FIXME create lookup table after palette is stabilized...*/
+    if(!rgb_to_palindex || !alpha_to_rgb) 
+    {
+	init_alpha_lookup();
+	if(!rgb_to_palindex || !alpha_to_rgb)
+	    goto stdblit;
+    }
+
+    /* Create 5 bit alpha value index for 256 color indexing*/
+
+    /* destination alpha is (1 - source) alpha*/
+    dstalpha = ((srcalpha>>3) ^ 31) << 8;
+    srcalpha = (srcalpha>>3) << 8;
+
+    while(--h >= 0) 
+    {
+	int	i;
+	for(i=0; i<w; ++i) 
+	{
+	    int c;
+	    /* Get source RGB555 value for source alpha value*/
+	    unsigned short s = alpha_to_rgb[srcalpha + 
+					   srcpsd->ReadPixel(
+					       srcpsd,srcx+i,srcy+h)];
+
+	    /* Get destination RGB555 value for dest alpha value*/
+	    unsigned short d = alpha_to_rgb[dstalpha +
+					   dstpsd->ReadPixel(
+					       srcpsd,dstx+i,dsty+h)];
+
+	    /* Add RGB values together and get closest palette index to it*/
+	    VGLSetXY(VGLDisplay, dstx+i, dsty+h,
+		     c=rgb_to_palindex[s + d]);
+	    savebits.DrawPixel(&savebits, dstx+i, dsty+h, c);
+	}
+    }
+    return;
+ stdblit:
+#endif
+    FBSD_blit(dstpsd, dstx, dsty, w, h, srcpsd, srcx, srcy, op);
+}
+
+
+#if ALPHABLEND
+static void init_alpha_lookup(void)
+{
+    int	i, a;
+    int	r, g, b;
+    extern MWPALENTRY gr_palette[256];
+
+    if(!alpha_to_rgb)
+	alpha_to_rgb = (unsigned short *)malloc(
+	    sizeof(unsigned short)*32*256);
+    if(!rgb_to_palindex)
+	rgb_to_palindex = (unsigned char *)malloc(
+	    sizeof(unsigned char)*32*32*32);
+    if(!rgb_to_palindex || !alpha_to_rgb)
+	return;
+
+    /*
+     * Precompute alpha to rgb lookup by premultiplying
+     * each palette rgb value by each possible alpha
+     * and storing it as RGB555.
+     */
+    for(i=0; i<256; ++i) {
+	MWPALENTRY *p = &gr_palette[i];
+	for(a=0; a<32; ++a) {
+	    alpha_to_rgb[(a<<8)+i] =
+		(((p->r * a / 31)>>3) << 10) |
+		(((p->g * a / 31)>>3) << 5) |
+		((p->b * a / 31)>>3);
+	}
+    }
+
+    /*
+     * Precompute RGB555 to palette index table by
+     * finding the nearest palette index for all RGB555 colors.
+     */
+    for(r=0; r<32; ++r) {
+	for(g=0; g<32; ++g)
+	    for(b=0; b<32; ++b)
+		rgb_to_palindex[ (r<<10)|(g<<5)|b] =
+		    GdFindNearestColor(gr_palette, 256,
+				       MWRGB(r<<3, g<<3, b<<3));
+    }
+}
+#endif
diff -urN lib/microwindows/src/drivers/scr_herc.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_herc.c
--- lib/microwindows/src/drivers/scr_herc.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_herc.c	2005-02-21 16:03:18.000000000 +0100
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ * Based on code by Jakob Eriksson.
+ *
+ * Hercules Graphics Screen Driver, PC bios version
+ * 	This driver uses int10 bios to to get the address of the 
+ * 	ROM character font which is used for the character bitmaps.  
+ * 	All other access to the hardware is controlled through this driver.
+ *
+ * 	All text/font drawing code is based on the above routines and
+ * 	the included entry points for getting the ROM bitmap data.  Compiled
+ * 	in fonts aren't supported for size reasons.  scr_bogl supports them.
+ *
+ *	The environment variable CHARHEIGHT if set will set the assumed rom
+ *	font character height, which defaults to 14.
+ */
+#if ELKS
+#include <linuxmt/ntty.h>
+#endif
+#include <stdio.h>
+#include "device.h"
+#include "vgaplan4.h"
+#include "romfont.h"
+
+/* assumptions for speed: NOTE: psd is ignored in these routines*/
+#define SCREENADDR(offset) 	MK_FP(0xb000, (offset))
+
+#define SCREEN_ON 		8
+#define BLINKER_ON 		0x20
+
+/* HERC driver entry points*/
+static PSD  HERC_open(PSD psd);
+static void HERC_close(PSD psd);
+static void HERC_getscreeninfo(PSD psd,PMWSCREENINFO psi);;
+static void HERC_setpalette(PSD psd,int first,int count,MWPALENTRY *pal);
+static void HERC_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c);
+static MWPIXELVAL HERC_readpixel(PSD psd,MWCOORD x, MWCOORD y);
+static void HERC_drawhline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c);
+static void HERC_drawvline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c);
+static void HERC_fillrect(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,
+		MWPIXELVAL c);
+static void HERC_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,MWCOORD h,
+		PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op);
+static PSD  HERC_allocatememgc(PSD psd);
+
+SCREENDEVICE	scrdev = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
+	HERC_open,
+	HERC_close,
+	HERC_getscreeninfo,
+	HERC_setpalette,
+	HERC_drawpixel,
+	HERC_readpixel,
+	HERC_drawhline,
+	HERC_drawvline,
+	HERC_fillrect,
+	pcrom_fonts,
+	HERC_blit,
+	NULL,			/* PreSelect*/
+	NULL,			/* DrawArea subdriver*/
+	NULL,			/* SetIOPermissions*/
+	HERC_allocatememgc,
+	NULL,			/* MapMemGC*/
+	NULL			/* FreeMemGC*/
+};
+
+static PSD
+HERC_open(PSD psd)
+{
+#if HAVEIOPERM
+	/* get permission to write to the hercules ports*/
+	if(ioperm(0x3b4, 0x0d, 1))
+		return NULL;
+#endif
+#if ELKS
+	/* disallow console switching while in graphics mode*/
+	if(ioctl(0, DCGET_GRAPH) != 0)
+		return NULL;
+#endif
+
+	/* enter graphics mode*/
+	outportb(0x3bf, 1+2);
+	outportb(0x3b8, 0);
+	outport(0x3b4, 0x3500);
+	outport(0x3b4, 0x2d01);
+	outport(0x3b4, 0x2e02); /* Linesync at 46th character */
+	outport(0x3b4, 0x0703); /* linesync width 7 chrclock ticks */
+	outport(0x3b4, 0x5b04); /* height 92 chars (368 lines) */
+	outport(0x3b4, 0x0205); /* height adjust */
+	outport(0x3b4, 0x5706); /* lines / picture (348 lines)  */
+	outport(0x3b4, 0x5707); /* picturesync: after 87 character lines */
+	outport(0x3b4, 0x0309); /* character height: 4 lines / char */
+	outportb(0x3b8, 2+8); 	/* Allow graphics mode and video on */
+
+	/* init driver variables*/
+	psd->xres = psd->xvirtres = 720;
+	psd->yres = psd->yvirtres = 350;
+	psd->planes = 1;
+	psd->bpp = 1;
+	psd->ncolors = 2;
+	psd->pixtype = MWPF_PALETTE;
+	psd->flags = PSF_SCREEN;
+	psd->addr = SCREENADDR(0);
+	psd->linelen = 90;
+
+	/* init pc rom font routines*/
+	pcrom_init(psd);
+
+	return psd;
+}
+
+static void
+HERC_close(PSD psd)
+{
+	int			i;
+	volatile FARADDR	dst;
+	static char 		herc_txt_tbl[12]= {
+		0x61,0x50,0x52,0x0f,0x19,6,0x19,0x19,2,0x0d,0x0b,0x0c
+	};
+
+#if ELKS
+	/* allow console switching again*/
+	ioctl(0, DCREL_GRAPH);
+#endif
+
+	/* switch back to text mode*/
+	outportb(0x3bf, 0);
+	outportb(0x3b8, 0);
+
+	for(i = 0; i < 12; ++i) {
+		outportb(0x3b4, i);
+		outportb(0x3b5, herc_txt_tbl[i]);
+	}
+
+	/* blank screen*/
+	dst = SCREENADDR(0);
+	for(i = 0; i <= 0x3fff; ++i) {
+		PUTBYTE_FP(dst++, 0x00);
+		PUTBYTE_FP(dst++, 0x07);
+	}
+	outportb(0x3b8, BLINKER_ON | SCREEN_ON);
+}
+
+static void
+HERC_getscreeninfo(PSD psd,PMWSCREENINFO psi)
+{
+	psi->rows = psd->yvirtres;
+	psi->cols = psd->xvirtres;
+	psi->planes = psd->planes;
+	psi->bpp = psd->bpp;
+	psi->ncolors = psd->ncolors;
+	psi->pixtype = psd->pixtype;
+	psi->fonts = NUMBER_FONTS;
+	psi->xdpcm = 30;		/* assumes screen width of 24 cm*/
+	psi->ydpcm = 19;		/* assumes screen height of 18 cm*/
+}
+
+static void
+HERC_setpalette(PSD psd,int first,int count,MWPALENTRY *pal)
+{
+	/* no palette available*/
+}
+
+static void
+HERC_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	unsigned int 		offset;
+	unsigned char 		mask = 128;
+	volatile FARADDR	dst;
+
+	offset = 0x2000 * (y&3);
+	offset += 90*(y/4) + x/8;
+	dst = SCREENADDR(offset);
+	mask >>= x & 7;
+	if(c)
+		ORBYTE_FP(dst, mask);
+	else ANDBYTE_FP(dst, ~mask);
+}
+
+static MWPIXELVAL
+HERC_readpixel(PSD psd,MWCOORD x, MWCOORD y)
+{
+	unsigned int 		offset;
+	unsigned char 		mask = 128;
+	volatile FARADDR	dst;
+
+	offset = 0x2000 * (y&3);
+	offset += 90*(y/4) + x/8;
+	dst = SCREENADDR(offset);
+	mask >>= x & 7;
+	return GETBYTE_FP(dst) & mask? 1: 0;
+}
+
+static void
+HERC_drawhline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	/*Optimized HERC_drawhline() by thomas_d_stewart@hotmail.com*/
+	unsigned int rowoffset, x1yoffset, x2yoffset;
+	unsigned int startbyte, endbyte;
+	volatile FARADDR dst;
+
+	/*offset of the row */
+	rowoffset = 8192 * (y % 4) + (y / 4) * 90;
+	
+	/*offset of first byte in line */
+	x1yoffset = rowoffset + (x1 / 8);
+	
+	/*ofset of the last byte in line */
+	x2yoffset = rowoffset + (x2 / 8);
+
+
+	/*shift "11111111" > buy (x1%8) to fill with 0's*/
+	startbyte = 0xff >> (x1 % 8);
+	/*same but in < dir*
+	endbyte = 0xff << (x2 % 8);
+
+	/* convert x1yoffset to a screen address */
+	dst = SCREENADDR(x1yoffset);
+
+	if(c)
+		ORBYTE_FP(dst, startbyte);    /* output byte to mem */
+	else ANDBYTE_FP(dst, ~startbyte);
+
+	x1yoffset++; /* increment so we are writing to the next byte */
+	while(x1yoffset < x2yoffset) {
+	       	dst = SCREENADDR(x1yoffset); /*convert x1yoffset to a scr address */
+		if(c)
+			ORBYTE_FP(dst, 0xff); /*ouput bytes */
+		else ANDBYTE_FP(dst, ~0xff);
+		x1yoffset++;
+		}
+
+	dst = SCREENADDR(x2yoffset); /* convert x2yoffset to a screen address */
+	if(c)
+		ORBYTE_FP(dst, endbyte); /* output byte to mem */
+	else ANDBYTE_FP(dst, ~endbyte);
+
+
+
+	/*NON Optimized version left in case my one goes wroung */
+	/*while(x1 <= x2)
+	  HERC_drawpixel(x1++, y, c);*/
+}
+
+static void
+HERC_drawvline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	/* fixme write optimized vline*/
+	/*
+	 * Driver doesn't support vline yet
+	 */
+	while(y1 <= y2)
+		HERC_drawpixel(x, y1++, c);
+}
+
+static void
+HERC_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2, MWPIXELVAL c)
+{
+	while(y1 <= y2)
+		HERC_drawhline(x1, x2, y1++, c);
+}
+
+static void
+HERC_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,MWCOORD h,
+	PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op)
+{
+	/* FIXME*/
+}
+
+/* allocate a memory screen device*/
+static PSD 
+HERC_allocatememgc(PSD psd)
+{
+	/* if driver doesn't have blit, fail*/
+	return NULL;
+}
diff -urN lib/microwindows/src/drivers/scr_prsm.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_prsm.c
--- lib/microwindows/src/drivers/scr_prsm.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_prsm.c	2005-02-21 16:03:19.000000000 +0100
@@ -0,0 +1,296 @@
+/*
+ * scr_prsm.c
+ *
+ * Microwindows screen driver for the Isicad Prisma diskless workstation
+ * by George Harvey.
+ *
+ * This is mostly 'glue' code, the real work is done by assembler routines
+ * in asm_prsm.s.
+ *
+ * The Prisma has a custom graphics controller with a fixed resolution
+ * 1280 x 1024, 256 color display. This would be great except that it
+ * was desgined for CAD work, not graphical desktops. The only interface
+ * to the the video display is through a set of control registers. These
+ * support line drawing in hardware (any angle, any length, any colour)
+ * but there is no way to access the video memory as a frame buffer.
+ * There is a way to read and write individual pixels but it is VERY
+ * slow so blitting is bad news.
+ *
+ * 26/02/00	first tests with Microwindows 0.87
+ * 24/03/00	added blitter code
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "device.h"
+#ifdef _MINIX
+#include <sys/types.h>
+#endif
+#include "genfont.h"
+#include "genmem.h"
+
+#define	MY_PSD_ADDR	0x01000000	/* dummy video memory addr */
+
+/* VB driver entry points*/
+static PSD  VB_open(PSD psd);
+static void VB_close(PSD psd);
+static void VB_getscreeninfo(PSD psd,PMWSCREENINFO psi);;
+static void VB_setpalette(PSD psd,int first,int count,MWPALENTRY *pal);
+static void VB_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c);
+static MWPIXELVAL VB_readpixel(PSD psd,MWCOORD x, MWCOORD y);
+static void VB_drawhline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y,
+	 MWPIXELVAL c);
+static void VB_drawvline(PSD psd,MWCOORD x,MWCOORD y1,MWCOORD y2,MWPIXELVAL c);
+static void VB_fillrect(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,
+	MWPIXELVAL c);
+static void VB_blit(PSD destpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,MWCOORD h,
+	PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op);
+
+/* low-level routines in asm_prsm.s */
+void init_scr(void);
+void c_pcmap(int cnt, int *map);
+void c_ldraw4(int x1, int y1, int x2, int y2, int inten, int sel);
+/* optimised block drawing routines */
+void c_ldraw5y(int x1, int y1, int x2, int y2, int inten);
+void c_ldraw5x(int x1, int y1, int x2, int y2, int inten);
+int  r1pix3(int x, int y, int selmask);
+void rd_rect2(int x1, int x2, int y1, int y2, unsigned char *buf);
+void w1pix3(int x, int y, int selmask, int pixdata);
+void wr_rect2(int x1, int x2, int y1, int y2, unsigned char *buf);
+
+/* dummy routines for now */
+static MWBOOL VB_mapmemgc(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,
+	int linelen,int size,void *addr);
+
+
+SCREENDEVICE	scrdev = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
+	VB_open,
+	VB_close,
+	VB_getscreeninfo,
+	VB_setpalette,
+	VB_drawpixel,
+	VB_readpixel,
+	VB_drawhline,
+	VB_drawvline,
+	VB_fillrect,
+	gen_fonts,
+	VB_blit,
+	NULL,			/* preSelect */
+	NULL,			/* DrawArea */
+	NULL,			/* SetIOPermissions */
+	gen_allocatememgc,
+	VB_mapmemgc,
+	gen_freememgc
+};
+
+static int *pr_cmap;		/* Prisma colour map */
+
+static PSD
+VB_open(PSD psd)
+{
+	/* allocate space for the colour map */
+	if ((pr_cmap = (int *)malloc((size_t)(256 * sizeof(int)))) == NULL) {
+		perror("malloc cmap");
+		return(0);
+	}
+	memset(pr_cmap, 0, (256 * sizeof(int)));	/* clear colour map */
+
+	/* init driver variables */
+	psd->xres = psd->xvirtres = 1280;
+	psd->yres = psd->yvirtres = 1024;
+	psd->planes = 1;
+	psd->bpp = 8;
+	psd->ncolors = 256;
+	psd->pixtype = MWPF_PALETTE;
+#if HAVEBLIT
+	psd->flags = PSF_SCREEN | PSF_HAVEBLIT;
+#else
+	psd->flags = PSF_SCREEN;
+#endif
+	psd->addr = (void *)MY_PSD_ADDR;	/* dummy addr. */
+	psd->linelen = 1280;
+	init_scr();				/* init VB and clear screen */
+	printf("VB_open: finished open\n");	/* DEBUG */
+	return psd;
+}
+
+static void
+VB_close(PSD psd)
+{
+	/* should probably restore the default palette here */
+	/* empty for now */
+}
+
+static void
+VB_getscreeninfo(PSD psd,PMWSCREENINFO psi)
+{
+	psi->rows = psd->yvirtres;
+	psi->cols = psd->xvirtres;
+	psi->planes = psd->planes;
+	psi->bpp = psd->bpp;
+	psi->ncolors = psd->ncolors;
+	psi->pixtype = psd->pixtype;
+	psi->fonts = 1;
+
+	/* 1280 x 1024 on a 16in monitor */
+	psi->xdpcm = 40;	/* assumes screen width of 32 cm*/
+	psi->ydpcm = 43;	/* assumes screen height of 24 cm*/
+}
+
+static void
+VB_setpalette(PSD psd,int first,int count,MWPALENTRY *pal)
+{
+	int i, ind;
+	MWPALENTRY *p;
+
+	ind = first;
+	for (i = 0; i < count; i++) {
+		p = &pal[i];
+		if (ind > 255) {
+			fprintf(stderr, "VB_setpalette: index out of range: %d\n", ind);
+			return;
+		}
+		*(pr_cmap + ind) = (ind << 24) | (p->r << 16) | (p->g << 8) |
+			(p->b);
+		ind++;
+	}
+	/* to try and debug palette code in VNC... */
+/*	if (count == 1) {
+		printf("VB_setpalette: setting %d to %08x\n", first, \
+			*(pr_cmap + first));
+	}
+ */
+	/* write a maximum of 16 entries at a time, any more doesn't work
+	 * reliably (no idea why not)
+	 */
+	ind = first;
+	while (count) {
+		if (count >= 16) {
+			c_pcmap(16, (pr_cmap + ind));
+			count -= 16;
+			ind += 16;
+		} else {
+			c_pcmap(count, (pr_cmap + ind));
+			count = 0;
+		}
+	}
+
+}
+
+static void
+VB_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	w1pix3(x, y, 255, (int)c);
+}
+
+static MWPIXELVAL
+VB_readpixel(PSD psd,MWCOORD x, MWCOORD y)
+{
+	return((MWPIXELVAL)r1pix3(x, y, 255));
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+static void
+VB_drawhline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+/*	++x2;		/* draw final point*/
+	y = 1023 - y;	/* flip y axis */
+	c_ldraw4(x1, y, x2, y, (int)c, 255);
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+static void
+VB_drawvline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+/*	++y2;		/* draw final point*/
+	y1 = 1023 - y1;
+	y2 = 1023 - y2;
+	c_ldraw4(x, y1, x, y2, (int)c, 255);
+}
+
+static void
+VB_fillrect(PSD psd, MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2, MWPIXELVAL c)
+{
+	register int w, h;
+
+	w = ((x2 - x1) >= 0) ? (x2 - x1) : (x1 - x2);	/* abs width */
+	h = ((y2 - y1) >= 0) ? (y2 - y1) : (y1 - y2);	/* abs height */
+	/* sanity check */
+	if ((w > 1279) || (h > 1023))
+		return;
+	y1 = 1023 - y1;			/* flip origin to top corner */
+	y2 = 1023 - y2;
+	if (w >= h) {
+		/* width is greater, draw horizontal lines */
+#if 0
+		while(y2 <= y1) {
+			c_ldraw4(x1, y2, x2, y2, (int)c, 255);
+			y2++;
+		}
+#endif
+		c_ldraw5y(x1, y2, x2, y1, (int)c);
+	} else {
+		/* height is greater, draw vertical lines */
+#if 0
+		while(x1 <= x2) {
+			c_ldraw4(x1, y2, x1, y1, (int)c, 255);
+			x1++;
+		}
+#endif
+		c_ldraw5x(x1, y2, x2, y1, (int)c);
+	}
+}
+
+/*
+ * Blitting is going to be very slow on the Prisma!
+ */
+static void
+VB_blit(PSD destpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,MWCOORD h,
+        PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op)
+{
+	int x1s, x1e, x2s, x2e, y1s, y1e, y2s, y2e;
+	unsigned char *rect;
+
+/*	printf("VB_blit\n");			/* DEBUG */
+	if ((rect = (unsigned char *)malloc((size_t)(w * h * sizeof(char))))
+			== NULL) {
+		perror("malloc rect");
+		return;
+        }
+	/* always copy in +ve direction */
+	x1s = (w >= 0) ? srcx : (srcx + w);
+	x2s = (w >= 0) ? destx : (destx + w);
+	x1e = (w >= 0) ? (srcx + w) : srcx;
+	x2e = (w >= 0) ? (destx + w) : destx;
+	y1s = (h >= 0) ? srcy : (srcy + h);
+	y2s = (h >= 0) ? desty : (desty + h);
+	y1e = (h >= 0) ? (srcy + h) : srcy;
+	y2e = (h >= 0) ? (desty + h) : desty;
+
+	/* determine which PSD is the screen */
+	if ((srcpsd->addr == MY_PSD_ADDR) && (destpsd->addr == MY_PSD_ADDR)) {
+		/* screen to screen copy */
+		/* copy rectangle into buffer */
+		rd_rect2(x1s, y1s, x1e, y1e, rect);
+		/* copy rectangle out of buffer */
+		wr_rect2(x2s, y2s, x2e, y2e, rect);
+	} else if (srcpsd->addr == MY_PSD_ADDR) {
+		/* screen to off-screen */
+	} else if (destpsd->addr == MY_PSD_ADDR) {
+		/* off-screen to screen */
+	} else {
+		/* error ! */
+		printf("VB_blit with no screen!\n");
+	}
+	free(rect);
+}
+
+static MWBOOL
+VB_mapmemgc(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,int linelen,
+	int size,void *addr)
+{
+	return 0;
+}
+
diff -urN lib/microwindows/src/drivers/scr_rtems.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_rtems.c
--- lib/microwindows/src/drivers/scr_rtems.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_rtems.c	2005-02-21 16:13:10.000000000 +0100
@@ -0,0 +1,354 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Microwindows Screen Driver for RTEMS (uses Microframebuffer api)
+ *
+ * Portions used from Ben Pfaff's BOGL <pfaffben@debian.org>
+ * 
+ * Note: modify select_fb_driver() to add new framebuffer subdrivers
+ */
+#define _GNU_SOURCE 1
+#include <assert.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include "device.h"
+#include "genfont.h"
+#include "genmem.h"
+#include "fb.h"
+#include <rtems/mw_fb.h>
+
+#ifndef FB_TYPE_VGA_PLANES
+#define FB_TYPE_VGA_PLANES 4
+#endif
+
+static PSD  fb_open(PSD psd);
+static void fb_close(PSD psd);
+static void fb_setpalette(PSD psd,int first, int count, MWPALENTRY *palette);
+static void gen_getscreeninfo(PSD psd,PMWSCREENINFO psi);
+
+SCREENDEVICE	scrdev = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
+	fb_open,
+	fb_close,
+	gen_getscreeninfo,
+	fb_setpalette,
+	NULL,			/* DrawPixel subdriver*/
+	NULL,			/* ReadPixel subdriver*/
+	NULL,			/* DrawHorzLine subdriver*/
+	NULL,			/* DrawVertLine subdriver*/
+	NULL,			/* FillRect subdriver*/
+	gen_fonts,
+	NULL,			/* Blit subdriver*/
+	NULL,			/* PreSelect*/
+	NULL,			/* DrawArea subdriver*/
+	NULL,			/* SetIOPermissions*/
+	gen_allocatememgc,
+	fb_mapmemgc,
+	gen_freememgc
+};
+
+/* static variables*/
+static int fb;			/* Framebuffer file handle. */
+static int status;		/* 0=never inited, 1=once inited, 2=inited. */
+static short saved_red[16];	/* original hw palette*/
+static short saved_green[16];
+static short saved_blue[16];
+
+/* local functions*/
+static void	set_directcolor_palette(PSD psd);
+#if 0
+static void 	ioctl_getpalette(int start, int len, short *red, short *green,
+			short *blue);
+static void	ioctl_setpalette(int start, int len, short *red, short *green,
+			short *blue);
+#endif
+
+/* init framebuffer*/
+static PSD
+fb_open(PSD psd)
+{
+	char *	env;
+	int	type, visual;
+	int	tty;
+	PSUBDRIVER subdriver;
+	struct fb_screeninfo fb_info;
+
+	assert(status < 2);
+  
+	/* locate and open framebuffer, get info*/
+	if(!(env = getenv("FRAMEBUFFER")))
+		env = "/dev/fb0";
+	fb = open( env, O_RDWR);
+	if(fb < 0) {
+		EPRINTF("Error opening %s: %m\n", env);
+      return NULL;
+   }
+   
+   if( ufb_get_screen_info( fb, &fb_info ) )
+   {
+      EPRINTF("Error getting screen info\n" );
+      return NULL;
+   }
+	/* setup screen device from framebuffer info*/
+	type = fb_info.type;
+	visual = fb_info.visual;
+
+	psd->xres = psd->xvirtres = fb_info.xres;
+	psd->yres = psd->yvirtres = fb_info.yres;
+
+	/* set planes from fb type*/
+	if (type == FB_TYPE_VGA_PLANES)
+		psd->planes = 4;
+	else if (type == FB_TYPE_PACKED_PIXELS)
+		psd->planes = 1;
+	else psd->planes = 0;	/* force error later*/
+
+	psd->bpp = fb_info.bits_per_pixel;
+	psd->ncolors = (psd->bpp >= 24)? (1 << 24): (1 << psd->bpp);
+
+	/* set linelen to byte length, possibly converted later*/
+	psd->linelen = fb_info.line_length;
+	psd->size = 0;		/* force subdriver init of size*/
+
+#if HAVEBLIT
+	psd->flags = PSF_SCREEN | PSF_HAVEBLIT;
+#else
+	psd->flags = PSF_SCREEN;
+#endif
+	if (psd->bpp == 16)
+		psd->flags |= PSF_HAVEOP_COPY;
+
+	/* set pixel format*/
+	if(visual == FB_VISUAL_TRUECOLOR || visual == FB_VISUAL_DIRECTCOLOR) {
+		switch(psd->bpp) {
+		case 8:
+			psd->pixtype = MWPF_TRUECOLOR332;
+			break;
+		case 16:
+			psd->pixtype = MWPF_TRUECOLOR565;
+			break;
+		case 24:
+			psd->pixtype = MWPF_TRUECOLOR888;
+			break;
+		case 32:
+			psd->pixtype = MWPF_TRUECOLOR0888;
+			break;
+		default:
+			EPRINTF(
+			"Unsupported %d color (%d bpp) truecolor framebuffer\n",
+				psd->ncolors, psd->bpp);
+			goto fail;
+		}
+	} else psd->pixtype = MWPF_PALETTE;
+
+	psd->size = fb_info.smem_len;
+   /* maps FB memory to user space */
+   if( ufb_mmap_to_user_space( fb, &psd->addr, 
+                              ( void *)fb_info.smem_start, fb_info.smem_len ) )
+   {
+      EPRINTF("Error mapping FB memory to user space\n" );
+      goto fail;
+   }
+
+	/*DPRINTF("%dx%dx%d linelen %d type %d visual %d bpp %d\n", psd->xres,
+	 	psd->yres, psd->ncolors, psd->linelen, type, visual,
+		psd->bpp);*/
+
+	/* select a framebuffer subdriver based on planes and bpp*/
+	subdriver = select_fb_subdriver(psd);
+	if (!subdriver) {
+		EPRINTF("No driver for screen type %d visual %d bpp %d\n",
+			type, visual, psd->bpp);
+		goto fail;
+	}
+
+   if( ufb_enter_graphics( fb, 0 ) )
+   {
+      EPRINTF("Error entering graphics\n");
+      return NULL;
+   }
+
+	/*
+	 * set and initialize subdriver into screen driver
+	 * psd->size is calculated by subdriver init
+	 */
+	if(!set_subdriver(psd, subdriver, TRUE )) 
+	{
+		EPRINTF("Driver initialize failed type %d visual %d bpp %d\n",
+			type, visual, psd->bpp);
+		goto fail;
+	}
+
+	/* save original palette*/
+	ioctl_getpalette(0, 16, saved_red, saved_green, saved_blue);
+
+	/* setup direct color palette if required (ATI cards)*/
+	if(visual == FB_VISUAL_DIRECTCOLOR)
+		set_directcolor_palette(psd);
+
+	status = 2;
+	return psd;	/* success*/
+
+fail:
+	close( fb );
+   return NULL;
+}
+
+/* close framebuffer*/
+static void
+fb_close(PSD psd)
+{
+	/* if not opened, return*/
+	if(status != 2)
+		return;
+	status = 1;
+
+  	/* reset hw palette*/
+	ioctl_setpalette(0, 16, saved_red, saved_green, saved_blue);
+
+   /* unmaps memory from user's space */
+   ufb_unmmap_from_user_space( fb, psd->addr );
+
+   /* restore TEXT mode */
+   ufb_exit_graphics( fb );
+  
+	/* close tty and framebuffer*/
+	close( fb );
+}
+
+/* setup directcolor palette - required for ATI cards*/
+static void
+set_directcolor_palette(PSD psd)
+{
+	int i;
+	short r[256], g[256], b[256];
+
+	/* 16bpp uses 32 palette entries*/
+	if(psd->bpp == 16) {
+		/* FIXME: this still doesn't work*/
+		for(i=0; i<32; ++i) {
+			//r[i] = g[i] = b[i] = ((i<<11)|(i<<6)|i)<<8;
+			//r[i] = g[i] = b[i] = ((i<<5)|i)<<10;
+			//r[i] = g[i] = b[i] = i<<11;
+			r[i] = g[i] = b[i] = (i<<11) | (i<<3);
+		}
+		ioctl_setpalette(0, 32, r, g, b);
+	} else {
+		/* 32bpp uses 256 entries*/
+		for(i=0; i<256; ++i)
+			r[i] = i<<8;
+		ioctl_setpalette(0, 256, r, r, r);
+	}
+}
+
+static int fade = 100;
+
+/* convert Microwindows palette to framebuffer format and set it*/
+static void
+fb_setpalette(PSD psd,int first, int count, MWPALENTRY *palette)
+{
+	int 	i;
+	unsigned short 	red[count];
+	unsigned short 	green[count];
+	unsigned short 	blue[count];
+
+	/* convert palette to framebuffer format*/
+	for(i=0; i < count; i++) {
+		MWPALENTRY *p = &palette[i];
+
+		/* grayscale computation:
+		 * red[i] = green[i] = blue[i] =
+		 *	(p->r * 77 + p->g * 151 + p->b * 28);
+		 */
+		red[i] = (p->r * fade / 100) << 8;
+		green[i] = (p->g * fade / 100) << 8;
+		blue[i] = (p->b * fade / 100) << 8;
+	}
+	ioctl_setpalette(first, count, red, green, blue);
+}
+
+/* get framebuffer palette*/
+static void
+ioctl_getpalette(int start, int len, short *red, short *green, short *blue)
+{
+	struct fb_cmap cmap;
+
+	cmap.start = start;
+	cmap.len = len;
+	cmap.red = red;
+	cmap.green = green;
+	cmap.blue = blue;
+	cmap.transp = NULL;
+
+   ufb_get_palette( fb, &cmap );
+}
+
+/* set framebuffer palette*/
+static void
+ioctl_setpalette(int start, int len, short *red, short *green, short *blue)
+{
+	struct fb_cmap cmap;
+
+	cmap.start = start;
+	cmap.len = len;
+	cmap.red = red;
+	cmap.green = green;
+	cmap.blue = blue;
+	cmap.transp = NULL;
+
+   ufb_set_palette( fb, &cmap );
+}
+
+static void
+gen_getscreeninfo(PSD psd,PMWSCREENINFO psi)
+{
+	psi->rows = psd->yvirtres;
+	psi->cols = psd->xvirtres;
+	psi->planes = psd->planes;
+	psi->bpp = psd->bpp;
+	psi->ncolors = psd->ncolors;
+	psi->pixtype = psd->pixtype;
+	psi->fonts = NUMBER_FONTS;
+
+	if(psd->yvirtres > 480) {
+		/* SVGA 800x600*/
+		psi->xdpcm = 33;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 33;	/* assumes screen height of 18 cm*/
+	} else if(psd->yvirtres > 350) {
+		/* VGA 640x480*/
+		psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 27;	/* assumes screen height of 18 cm*/
+	} else {
+		/* EGA 640x350*/
+		psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 19;	/* assumes screen height of 18 cm*/
+	}
+}
+
+/* experimental palette animation*/
+void
+setfadelevel(PSD psd, int f)
+{
+	int 		i;
+	unsigned short 	r[256], g[256], b[256];
+	extern MWPALENTRY gr_palette[256];
+
+	if(psd->pixtype != MWPF_PALETTE)
+		return;
+
+	fade = f;
+	if(fade > 100)
+		fade = 100;
+	for(i=0; i<256; ++i) {
+		r[i] = (gr_palette[i].r * fade / 100) << 8;
+		g[i] = (gr_palette[i].g * fade / 100) << 8;
+		b[i] = (gr_palette[i].b * fade / 100) << 8;
+	}
+	ioctl_setpalette(0, 256, r, g, b);
+}
diff -urN lib/microwindows/src/drivers/scr_svga.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_svga.c
--- lib/microwindows/src/drivers/scr_svga.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_svga.c	2005-02-21 16:13:10.000000000 +0100
@@ -0,0 +1,284 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Microwindows Screen Driver using SVGA Library
+ *
+ * This driver requires the following SVGA entry points:
+ * 	vga_init, vga_setmode,
+ * 	vga_drawpixel, vga_getpixel,
+ * 	vga_setegacolor, vga_drawline,
+ *	vga_getscansegment, vga_drawscansegment
+ *
+ * All graphics drawing primitives are based on top of these functions.
+ */
+/*#define NDEBUG*/
+#include <assert.h>
+#include <stdio.h>
+#include <vga.h>
+#include "device.h"
+#include "genfont.h"
+#include "genmem.h"
+
+#define MAXLINELEN	800	/* max line byte/pixel length*/
+
+/* specific driver entry points*/
+static PSD  SVGA_open(PSD psd);
+static void SVGA_close(PSD psd);
+static void SVGA_getscreeninfo(PSD psd,PMWSCREENINFO psi);
+static void SVGA_setpalette(PSD psd,int first,int count,MWPALENTRY *pal);
+static void SVGA_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c);
+static MWPIXELVAL SVGA_readpixel(PSD psd,MWCOORD x, MWCOORD y);
+static void SVGA_drawhline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c);
+static void SVGA_drawvline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c);
+static void SVGA_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2,
+		MWCOORD y2, MWPIXELVAL c);
+static void SVGA_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w,
+		MWCOORD h, PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op);
+
+SCREENDEVICE	scrdev = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
+	SVGA_open,
+	SVGA_close,
+	SVGA_getscreeninfo,
+	SVGA_setpalette,
+	SVGA_drawpixel,
+	SVGA_readpixel,
+	SVGA_drawhline,
+	SVGA_drawvline,
+	SVGA_fillrect,
+	gen_fonts,
+	SVGA_blit,
+	NULL,			/* PreSelect*/
+	NULL,			/* DrawArea subdriver*/
+	NULL,			/* SetIOPermissions*/
+	gen_allocatememgc,
+	NULL,			/* MapMemGC*/
+	NULL			/* FreeMemGC*/
+};
+
+extern int gr_mode;	/* temp kluge*/
+
+static PSD
+SVGA_open(PSD psd)
+{
+	int		mode;
+	vga_modeinfo *	modeinfo;
+
+	vga_init();
+
+	mode = G800x600x256;
+	if(!vga_hasmode(mode))
+		mode = G640x480x256;
+	if(!vga_hasmode(mode))
+		mode = G640x480x16;
+	if(vga_setmode(mode) == -1)
+		return NULL;
+	modeinfo = vga_getmodeinfo(mode);
+
+	psd->xres = psd->xvirtres = modeinfo->width;
+	psd->yres = psd->yvirtres = modeinfo->height;
+	psd->linelen = modeinfo->linewidth;
+	psd->ncolors = modeinfo->colors;
+	if(psd->ncolors == 256) {
+		psd->planes = 1;
+		psd->bpp = 8;
+	} else {
+		psd->planes = 4;
+		psd->bpp = 4;
+	}
+	/* note: must change psd->pixtype here for truecolor systems*/
+	psd->pixtype = MWPF_PALETTE;
+	psd->flags = PSF_SCREEN;
+	psd->size = 0;
+	psd->addr = NULL;
+
+	/*DPRINTF("mode: %dx%dx%d bpp %d\n", psd->xres, psd->yres,
+	 	psd->ncolors, psd->bpp);*/
+
+	return psd;
+}
+
+static void
+SVGA_close(PSD psd)
+{
+	vga_setmode(TEXT);
+}
+
+static void
+SVGA_getscreeninfo(PSD psd,PMWSCREENINFO psi)
+{
+	psi->rows = psd->yvirtres;
+	psi->cols = psd->xvirtres;
+	psi->planes = psd->planes;
+	psi->bpp = psd->bpp;
+	psi->ncolors = psd->ncolors;
+	psi->pixtype = psd->pixtype;
+	psi->fonts = NUMBER_FONTS;
+
+	if(psd->yvirtres > 480) {
+		/* SVGA 800x600*/
+		psi->xdpcm = 33;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 33;	/* assumes screen height of 18 cm*/
+	} else if(psd->yvirtres > 350) {
+		/* VGA 640x480*/
+		psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 27;	/* assumes screen height of 18 cm*/
+	} else {
+		/* EGA 640x350*/
+		psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 19;	/* assumes screen height of 18 cm*/
+	}
+}
+
+static void
+SVGA_setpalette(PSD psd,int first,int count,MWPALENTRY *pal)
+{
+	while(first < 256 && count-- > 0) {
+		vga_setpalette(first++, pal->r>>2, pal->g>>2, pal->b>>2);
+		++pal;
+	}
+}
+
+static void
+SVGA_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	unsigned char gline, line = c;
+
+	if(gr_mode == MWMODE_SET) {
+		/* vga_drawpixel apparently doesn't work with 256 colors...
+		 * vga_setegacolor(c);
+		 * vga_drawpixel(x, y);
+		 */
+		vga_drawscansegment(&line, x, y, 1);
+		return;
+	}
+	/*
+	 * This fishery is required because vgalib doesn't support
+	 * xor drawing mode without acceleration.
+	 */
+	vga_getscansegment(&gline, x, y, 1);
+	line ^= gline;
+	vga_drawscansegment(&line, x, y, 1);
+}
+
+static MWPIXELVAL
+SVGA_readpixel(PSD psd,MWCOORD x, MWCOORD y)
+{
+	return vga_getpixel(x, y);
+}
+
+static void
+SVGA_drawhline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	int 	i, width;
+	unsigned char getline[MAXLINELEN];
+	static int lastcolor = -1;
+	static int lastwidth = -1;
+	static unsigned char line[MAXLINELEN];
+
+	/*
+	 * All this fishery is required for two reasons:
+	 * one, vga_drawline is way too slow to be called to fill
+	 * rectangles, so vga_drawscansegment is used instead.  In
+	 * addition, vgalib doesn't support xor drawing mode
+	 * without acceleration!!, so we've got to do it ourselves
+	 * with vga_getscansegment...
+	 */
+	width = x2-x1+1;
+
+	/* this is faster than calling vga_drawline !!!*/
+	if(width != lastwidth || c != lastcolor) {
+		lastwidth = width;
+		lastcolor = c;
+		for(i=0; i<width; ++i)
+			line[i] = c;
+	}
+	if(gr_mode == MWMODE_XOR) {
+		vga_getscansegment(getline, x1, y, width);
+		for(i=0; i<width; ++i)
+			line[i] ^= getline[i];
+		lastwidth = -1;
+	}
+	vga_drawscansegment(line, x1, y, width);
+
+	/*
+	 * Non-fishery version is *slow* and doesn't support XOR.
+	vga_setegacolor(c);
+	vga_drawline(x1, y, x2, y2);
+	 */
+}
+
+static void
+SVGA_drawvline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	if(gr_mode == MWMODE_SET) {
+		vga_setegacolor(c);
+		vga_drawline(x, y1, x, y2);
+	}
+
+	/* slower version required for XOR drawing support*/
+	while(y1 <= y2)
+		SVGA_drawpixel(psd, x, y1++, c);
+}
+
+static void
+SVGA_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2, MWPIXELVAL c)
+{
+	while(y1 <= y2)
+		SVGA_drawhline(psd, x1, x2, y1++, c);
+}
+
+/* only screen-to-screen blit implemented, op ignored*/
+/* FIXME*/
+static void
+SVGA_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w, MWCOORD h,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long op)
+{
+	unsigned char line[MAXLINELEN];
+
+	assert (dstx >= 0 && dstx < dstpsd->xres);
+	assert (dsty >= 0 && dsty < dstpsd->yres);
+	assert (w > 0);
+	assert (h > 0);
+	assert (srcx >= 0 && srcx < srcpsd->xres);
+	assert (srcy >= 0 && srcy < srcpsd->yres);
+	assert (dstx+w <= dstpsd->xres);
+	assert (dsty+h <= dstpsd->yres);
+	assert (srcx+w <= srcpsd->xres);
+	assert (srcy+h <= srcpsd->yres);
+
+	if(!(srcpsd->flags & PSF_SCREEN) || !(dstpsd->flags & PSF_SCREEN))
+		return;
+
+	while(--h >= 0) {
+		vga_getscansegment(line, srcx, srcy, w);
+		vga_drawscansegment(line, dstx, dsty, w);
+		++dsty;
+		++srcy;
+	}
+}
+
+static int fade = 100;
+/* experimental palette animation*/
+void
+setfadelevel(PSD psd, int f)
+{
+	int 		i;
+	extern MWPALENTRY gr_palette[256];
+	MWPALENTRY local_palette[256];
+
+	if(psd->pixtype != MWPF_PALETTE)
+		return;
+
+	fade = f;
+	if(fade > 100)
+		fade = 100;
+	for(i=0; i<256; ++i) {
+
+		local_palette[i].r = (gr_palette[i].r * fade / 100);
+		local_palette[i].g = (gr_palette[i].g * fade / 100);
+		local_palette[i].b = (gr_palette[i].b * fade / 100);
+	}
+   SVGA_setpalette( psd, 0,256,local_palette );
+}
+
diff -urN lib/microwindows/src/drivers/scr_tc.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_tc.c
--- lib/microwindows/src/drivers/scr_tc.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_tc.c	2005-02-21 16:13:11.000000000 +0100
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Copyright (c) 2000 Victor Larionov, Victor Rogachev <rogach@sut.ru>
+ * Modified by mlkao
+ *
+ * Screen Driver using BGI for DOS TURBOC
+ *
+ * This driver requires the following BGI entry points:
+ * 	initgraph, closegraph, 
+ * 	putpixel, getpixel
+ * 	setcolor, line, setfillstyle, bar
+ *
+ * All graphics drawing primitives are based on top of these functions.
+ *
+ * This file also contains the generalized low-level font/text
+ * drawing routines, which will be split out into another file.
+ * Both fixed and proportional fonts are supported.
+ */
+
+#include <stdio.h>
+#include <graphics.h>
+#include "device.h"
+#include "genfont.h"
+
+/* specific bgi driver entry points*/
+static PSD  BGI_open(PSD psd);
+static void BGI_close(PSD psd);
+static void BGI_getscreeninfo(PSD psd,PMWSCREENINFO psi);
+static void BGI_setpalette(PSD psd,int first,int count,MWPALENTRY *pal);
+static void BGI_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c);
+static MWPIXELVAL BGI_readpixel(PSD psd,MWCOORD x, MWCOORD y);
+static void BGI_drawhline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c);
+static void BGI_drawvline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c);
+static void BGI_fillrect(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,MWPIXELVAL c);
+static void BGI_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,MWCOORD h,
+		PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op);
+static PSD  BGI_allocatememgc(PSD psd);
+
+SCREENDEVICE	scrdev = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
+	BGI_open,
+	BGI_close,
+	BGI_getscreeninfo,
+	BGI_setpalette,
+	BGI_drawpixel,
+	BGI_readpixel,
+	BGI_drawhline,
+	BGI_drawvline,
+	BGI_fillrect,
+	gen_fonts,
+	BGI_blit,
+	NULL,			/* PreSelect*/
+	NULL,			/* DrawArea subdriver*/
+	NULL,			/* SetIOPermissions*/
+	BGI_allocatememgc,
+	NULL,			/* MapMemGC*/
+	NULL			/* FreeMemGC*/
+};
+
+//add by mlkao
+extern int gr_mode;	/* temp kluge*/
+static struct linesettingstype lineinfo;
+static struct palettetype bgi_pal;
+
+static PSD
+BGI_open(PSD psd)
+{
+	int		gd=VGA;
+	int		gm=VGAHI;
+
+	registerbgidriver(EGAVGA_driver);
+	initgraph(&gd,&gm,"");
+
+	getlinesettings(&lineinfo);
+
+	psd->xres = psd->xvirtres = getmaxx()+1;
+	psd->yres = psd->yvirtres = getmaxy()+1;
+	psd->linelen = lineinfo.thickness;
+	psd->planes = 1;
+	psd->bpp = 4;		// FIXME??
+	psd->ncolors = getmaxcolor() + 1;
+	psd->flags = PSF_SCREEN;
+	psd->addr = 0;		// FIXME
+
+	/* note: must change psd->pixtype here for truecolor systems*/
+	psd->pixtype = MWPF_PALETTE;
+	return psd;
+}
+
+static void
+BGI_close(PSD psd)
+{
+	closegraph();
+}
+
+static void
+BGI_getscreeninfo(PSD psd,PMWSCREENINFO psi)
+{
+	psi->rows = psd->yvirtres;
+	psi->cols = psd->xvirtres;
+	psi->planes = psd->planes;
+	psi->bpp = psd->bpp;
+	psi->ncolors = psd->ncolors;
+	psi->pixtype = psd->pixtype;
+	psi->fonts = NUMBER_FONTS;
+
+	if(scrdev.yvirtres > 480) {
+		/* SVGA 800x600*/
+		psi->xdpcm = 33;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 33;	/* assumes screen height of 18 cm*/
+	} else if(scrdev.yvirtres > 350) {
+		/* VGA 640x480*/
+		psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 27;	/* assumes screen height of 18 cm*/
+	} else {
+		/* EGA 640x350*/
+		psi->xdpcm = 27;	/* assumes screen width of 24 cm*/
+		psi->ydpcm = 19;	/* assumes screen height of 18 cm*/
+	}
+}
+
+static void
+BGI_setpalette(PSD psd,int first,int count,MWPALENTRY *pal)
+{
+	/* std 16 color palette assumed*/
+}
+
+static void
+BGI_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	switch(gr_mode) {
+		case MWMODE_SET: break;
+		case MWMODE_XOR: c ^= getpixel(x, y); break;
+		case MWMODE_OR:  c |= getpixel(x, y); break;
+		case MWMODE_AND: c &= getpixel(x, y); break;
+	}
+	putpixel(x, y, c);
+}
+
+static MWPIXELVAL
+BGI_readpixel(PSD psd,MWCOORD x, MWCOORD y)
+{
+	return getpixel(x, y);
+}
+
+static void
+BGI_drawhline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	MWCOORD x;
+
+	if (x1 > x2) {
+		x  = x1;
+		x1 = x2;
+		x2 = x;
+	}
+
+	setcolor(c);
+	switch(gr_mode) {
+		case MWMODE_SET:
+			setwritemode(COPY_PUT);
+			break;
+		case MWMODE_XOR:
+			setwritemode(XOR_PUT);
+			break;
+		case MWMODE_OR: 
+			for(x = x1; x <= x2; x++)
+				putpixel(x, y, c | getpixel(x, y));
+			return;
+		case MWMODE_AND:
+			for(x = x1; x <= x2; x++)
+				putpixel(x, y, c & getpixel(x, y));
+			return;
+	}
+	line(x1, y, x2, y);
+}
+
+static void
+BGI_drawvline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	MWCOORD y;
+
+	if (y1 > y2) {
+		y  = y1;
+		y1 = y2;
+		y2 = y;
+	}
+
+	setcolor(c);
+	switch(gr_mode) {
+		case MWMODE_SET:
+			setwritemode(COPY_PUT);
+			break;
+		case MWMODE_XOR:
+			setwritemode(XOR_PUT); 
+			break;
+		case MWMODE_OR: 
+			for(y = y1; y <= y2; y++)
+				putpixel(x, y, c | getpixel(x, y));
+				return;
+		case MWMODE_AND:
+			for(y = y1; y <= y2; y++)
+				putpixel(x, y, c & getpixel(x, y));
+				return;
+	}
+	line(x, y1, x, y2);
+}
+
+static void
+BGI_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2,
+	MWPIXELVAL c)
+{
+	MWCOORD x, y;
+
+	if (x1 > x2) {
+		x  = x1;
+		x1 = x2;
+		x2 = x;
+	}
+	if (y1 > y2) {
+		y  = y1;
+		y1 = y2;
+		y2 = y;
+	}
+
+	switch(gr_mode) {
+		case MWMODE_SET:
+			setfillstyle(1,c);
+			bar(x1, y1, x2, y2);
+			break;
+
+		case MWMODE_XOR:
+			for(x = x1; x <= x2; x++)
+				for(y = y1; y <= y2; y++)
+					putpixel(x, y, c ^ getpixel(x, y));
+			break;
+
+		case MWMODE_OR:
+			for(x = x1; x <= x2; x++)
+				for(y = y1; y <= y2; y++)
+					putpixel(x, y, c | getpixel(x, y));
+			break;
+
+		case MWMODE_AND:
+			for(x = x1; x <= x2; x++)
+				for(y = y1; y <= y2; y++)
+					putpixel(x, y, c & getpixel(x, y));
+			break;
+
+		default:
+			break;
+	}
+}
+
+static void
+BGI_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,MWCOORD h,
+		PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op)
+{
+	/* FIXME*/
+}
+
+/* allocate a memory screen device*/
+static PSD 
+BGI_allocatememgc(PSD psd)
+{
+	/* if driver doesn't have blit, fail*/
+	return NULL;
+}
diff -urN lib/microwindows/src/drivers/scr_x11.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_x11.c
--- lib/microwindows/src/drivers/scr_x11.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/scr_x11.c	2005-02-21 16:13:11.000000000 +0100
@@ -0,0 +1,893 @@
+/*
+ * Copyright (c) 2000, 2001 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1999 Tony Rogvall <tony@bluetail.com>
+ * 	Rewritten to avoid multiple function calls by Greg Haerr
+ *      Alpha blending added by Erik Hill
+ *      (brought to life in a dark laboratory on a stormy night
+ *      in an ancient castle by Dr. Frankenstein)
+ *
+ * X11 screen driver for Microwindows
+ */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <assert.h>
+#include "device.h"
+#include "fb.h"
+#include "genmem.h"
+#include "genfont.h"
+
+/* define the Casio E-15 (allow override) */
+#ifdef SCREEN_E15
+#ifndef SCREEN_WIDTH
+#define    SCREEN_WIDTH  200
+#endif
+#ifndef SCREEN_HEIGHT
+#define    SCREEN_HEIGHT 320
+#endif
+#ifndef SCREEN_DEPTH
+#define    SCREEN_DEPTH  4
+#endif
+#ifndef MWPIXEL_FORMAT
+#define    MWPIXEL_FORMAT MWPF_PALETTE
+#endif
+#endif
+
+
+#ifndef SCREEN_WIDTH
+#define SCREEN_WIDTH 200
+#endif
+
+#ifndef SCREEN_HEIGHT
+#define SCREEN_HEIGHT 320
+#endif
+
+#ifndef SCREEN_DEPTH
+#define SCREEN_DEPTH 4
+#endif
+
+#ifndef MWPIXEL_FORMAT
+#if SCREEN_DEPTH <= 8
+#define MWPIXEL_FORMAT MWPF_PALETTE
+#elif SCREEN_DEPTH == 16
+#define MWPIXEL_FORMAT MWPF_TRUECOLOR565
+#elif SCREEN_DEPTH == 15
+#define MWPIXEL_FORMAT MWPF_TRUECOLOR555
+#elif SCREEN_DEPTH == 24
+#define MWPIXEL_FORMAT MWPF_TRUECOLOR888
+#elif SCREEN_DEPTH == 32
+#define MWPIXEL_FORMAT MWPF_TRUECOLOR0888
+#else
+#error "bad screen depth"
+#endif
+#endif
+
+
+/* specific x11 driver entry points*/
+static PSD  X11_open(PSD psd);
+static void X11_close(PSD psd);
+static void X11_getscreeninfo(PSD psd,PMWSCREENINFO psi);
+static void X11_setpalette(PSD psd,int first,int count,MWPALENTRY *pal);
+static void X11_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c);
+static MWPIXELVAL X11_readpixel(PSD psd,MWCOORD x, MWCOORD y);
+static void X11_drawhline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c);
+static void X11_drawvline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c);
+static void X11_fillrect(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,MWPIXELVAL c);
+static void X11_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,MWCOORD h,
+		     PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op);
+static void X11_preselect(PSD psd);
+
+SCREENDEVICE	scrdev = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
+	X11_open,
+	X11_close,
+	X11_getscreeninfo,
+	X11_setpalette,
+	X11_drawpixel,
+	X11_readpixel,
+	X11_drawhline,
+	X11_drawvline,
+	X11_fillrect,
+	gen_fonts,
+	X11_blit,
+	X11_preselect,
+	NULL,			/* DrawArea*/
+	NULL,			/* SetIOPermissions*/
+	gen_allocatememgc,
+	fb_mapmemgc,
+	gen_freememgc
+};
+
+/* called from keyboard/mouse/screen */
+Display*     x11_dpy;
+int          x11_scr;
+Visual*      x11_vis;
+Colormap     x11_colormap;
+Window       x11_win;
+GC           x11_gc;
+unsigned int x11_event_mask;
+
+static int   x11_colormap_installed = 0;
+static SCREENDEVICE savebits;	/* permanent offscreen drawing buffer*/
+
+
+/* Color cache for true color lookups
+** FIXME: for 24 bit i belive we could do the pixel direct but...
+*/
+
+#define COLOR_CACHE_SIZE 1001
+struct color_cache {
+	int    		init;  /* 1 if first use */
+	unsigned short	r;
+	unsigned short 	g;
+	unsigned short 	b;
+	XColor 		c;
+};
+static struct color_cache ccache[COLOR_CACHE_SIZE];
+
+/* color palette for color indexe */
+static XColor       x11_palette[256];
+static int          x11_pal_max = 0;
+static int          x11_pixtype;
+
+static unsigned long
+lookup_color(unsigned short r, unsigned short g, unsigned short b)
+{
+    int ix = ((r << 16) + (g << 8) + b) % COLOR_CACHE_SIZE;
+
+    if (ccache[ix].init ||
+	(ccache[ix].r != r) || (ccache[ix].g != g) || (ccache[ix].b != b)) {
+	char spec[20];
+	XColor exact;
+	XColor def;
+
+	ccache[ix].init = 0;
+	ccache[ix].r = r;
+	ccache[ix].g = g;
+	ccache[ix].b = b;
+	sprintf(spec, "#%02x%02x%02x", r, g, b);
+	XLookupColor(x11_dpy, x11_colormap, spec, &exact, &def);
+	XAllocColor(x11_dpy, x11_colormap, &def);
+	ccache[ix].c = def;
+
+	/* DPRINTF("lookup: exact(%d,%d,%d) = %d, def(%d,%d,%d)=%d\n",
+	   exact.red>>8, exact.green>>8, exact.blue>>8, exact.pixel,
+	   def.red>>8, def.green>>8, def.blue>>8, def.pixel); */
+    }
+    return (unsigned long) ccache[ix].c.pixel;
+}
+
+static unsigned long
+PIXELVAL_to_pixel(MWPIXELVAL c, int type)
+{
+	assert (type == MWPIXEL_FORMAT);
+
+#if MWPIXEL_FORMAT == MWPF_TRUECOLOR0888 || MWPIXELFORMAT == MWPF_TRUECOLOR888
+	/* calc truecolor conversions directly*/
+	if (x11_vis->class >= TrueColor) {
+		switch (x11_vis->bits_per_rgb) {
+		case 8:
+			return c;
+		case 6:
+			return RGB2PIXEL565(PIXEL888RED(c), PIXEL888GREEN(c),
+				PIXEL888BLUE(c));
+		case 5:
+			return RGB2PIXEL555(PIXEL888RED(c), PIXEL888GREEN(c),
+				PIXEL888BLUE(c));
+		case 3:
+		case 2:
+			return RGB2PIXEL332(PIXEL888RED(c), PIXEL888GREEN(c),
+				PIXEL888BLUE(c));
+		}
+	}
+	return lookup_color(PIXEL888RED(c), PIXEL888GREEN(c), PIXEL888BLUE(c));
+#endif
+#if MWPIXEL_FORMAT == MWPF_TRUECOLOR565
+	/* calc truecolor conversions directly*/
+	if (x11_vis->class >= TrueColor) {
+		switch (x11_vis->bits_per_rgb) {
+		case 8:
+			return RGB2PIXEL888(PIXEL565RED(c)<<3,
+				PIXEL565GREEN(c)<<2, PIXEL565BLUE(c)<<3);
+		case 6:
+		case 5:
+			return c;
+		case 3:
+		case 2:
+			return RGB2PIXEL332(PIXEL565RED(c)<<3,
+				PIXEL565GREEN(c)<<2, PIXEL565BLUE(c)<<3);
+		}
+	}
+	return lookup_color(PIXEL565RED(c)<<3, PIXEL565GREEN(c)<<2,
+			PIXEL565BLUE(c)<<3);
+#endif
+#if MWPIXEL_FORMAT == MWPF_TRUECOLOR555
+	/* calc truecolor conversions directly*/
+	if (x11_vis->class >= TrueColor) {
+		switch (x11_vis->bits_per_rgb) {
+		case 8:
+			return RGB2PIXEL888(PIXEL555RED(c)<<3,
+				PIXEL555GREEN(c)<<3, PIXEL555BLUE(c)<<3);
+		case 6:
+		case 5:
+			return c;
+		case 3:
+		case 2:
+			return RGB2PIXEL332(PIXEL555RED(c)<<3,
+				PIXEL555GREEN(c)<<3, PIXEL555BLUE(c)<<3);
+		}
+	}
+	return lookup_color(PIXEL555RED(c)<<3, PIXEL555GREEN(c)<<3,
+			PIXEL555BLUE(c)<<3);
+#endif
+#if MWPIXEL_FORMAT == MWPF_TRUECOLOR332
+	/* calc truecolor conversions directly*/
+	if (x11_vis->class >= TrueColor) {
+		switch (x11_vis->bits_per_rgb) {
+		case 8:
+			return RGB2PIXEL888(PIXEL332RED(c)<<5,
+				PIXEL332GREEN(c)<<5, PIXEL332BLUE(c)<<6);
+		case 6:
+			return RGB2PIXEL565(PIXEL332RED(c)<<5,
+				PIXEL332GREEN(c)<<5, PIXEL332BLUE(c)<<6);
+		case 5:
+			return RGB2PIXEL555(PIXEL332RED(c)<<5,
+				PIXEL332GREEN(c)<<5, PIXEL332BLUE(c)<<6);
+		case 3:
+		case 2:
+			return c;
+		}
+	}
+	return lookup_color(PIXEL332RED(c)<<5, PIXEL332GREEN(c)<<5,
+			PIXEL332BLUE(c)<<6);
+#endif
+#if MWPIXEL_FORMAT == MWPF_PALETTE
+	if (c > x11_pal_max) {
+	    DPRINTF("Warning: palette index out of range (%ld)\n", c);
+	    return 0;
+	}
+	return x11_palette[c].pixel;
+#endif
+#if 0
+    switch(type) {
+    case MWPF_TRUECOLOR0888:
+    case MWPF_TRUECOLOR888:
+	r = PIXEL888RED(c);
+	g = PIXEL888GREEN(c);
+	b = PIXEL888BLUE(c);
+	return lookup_color(r, g, b);
+	
+    case MWPF_TRUECOLOR565:
+	r = PIXEL565RED(c) << 3;
+	g = PIXEL565GREEN(c) << 2;
+	b = PIXEL565BLUE(c) << 3;
+	return lookup_color(r, g, b);
+
+    case MWPF_TRUECOLOR555:
+	r = PIXEL555RED(c) << 3;
+	g = PIXEL555GREEN(c) << 3;
+	b = PIXEL555BLUE(c) << 3;
+	return lookup_color(r, g, b);
+
+    case MWPF_TRUECOLOR332:
+	r = PIXEL332RED(c) << 5;
+	g = PIXEL332GREEN(c) << 5;
+	b = PIXEL332BLUE(c) << 6;
+	return lookup_color(r, g, b);
+
+    case MWPF_PALETTE:
+	if (c > x11_pal_max) {
+	    DPRINTF("Warning: palette index out of range (%ld)\n", c);
+	    return 0;
+	}
+	return x11_palette[c].pixel;
+    }
+#endif
+    return 0;
+}
+
+
+static void set_color(MWPIXELVAL c)
+{
+    static unsigned long oldc = 0x80000001;
+
+    if (c != oldc) {
+        oldc = c;
+        XSetForeground(x11_dpy, x11_gc, PIXELVAL_to_pixel(c, x11_pixtype));
+    }
+}
+
+
+static void set_mode(int new_mode)
+{
+    static int old_mode = -1;
+    
+    if (new_mode != old_mode) {
+	int func = GXcopy;
+	switch(new_mode) {
+	case MWMODE_SET: func = GXcopy; break;
+	case MWMODE_XOR: func = GXxor; break;
+	case MWMODE_OR:  func = GXor; break;
+	case MWMODE_AND: func = GXand; break;
+	default: return;
+	}
+	XSetFunction(x11_dpy, x11_gc, func);
+	old_mode = new_mode;
+    }
+}
+
+#ifdef USE_EXPOSURE
+static void _expose(int _x, int _y, int w, int h)
+{
+  XImage* img;
+  int depth = XDefaultDepth(x11_dpy, x11_scr);
+  int x = _x, y = _y;
+  char* data;
+  
+  /* allocate buffer */
+  if (depth >= 24)
+    data = malloc(w*4*h);
+  else if (depth > 8) /* 15, 16 */
+    data = malloc(w*2*h);
+  else  /* 1,2,4,8 */
+    data = malloc((w*depth+7)/8 * h);
+  
+  /* copy from offscreen to screen */
+  img = XCreateImage(x11_dpy, x11_vis, depth, ZPixmap,
+		     0, data, w, h, 8, 0);
+  for (y = _y; y < h + _y; y++) {
+    for (x = _x; x < w + _x; x++) {
+      MWPIXELVAL c = savebits.ReadPixel(&savebits,x,y);
+      unsigned long pixel = PIXELVAL_to_pixel(c, savebits.pixtype);
+      XPutPixel(img, x - _x, y - _y, pixel);
+    }
+  }
+  
+  XPutImage(x11_dpy, x11_win, x11_gc, img, 0, 0, _x, _y, w, h);
+  XDestroyImage(img);
+}
+#endif
+
+/* called from mou_x11 (handels x11_event_mask events) */
+void x11_handle_event(XEvent* ev)
+{
+    static int inited = 0;
+
+    if (ev->type == ColormapNotify) {
+	if (ev->xcolormap.window == x11_win) {
+	    if (ev->xcolormap.state == ColormapInstalled) {
+		DPRINTF("colormap uninstalled\n"); 
+		x11_colormap_installed = 0;
+	    }
+	    else if (ev->xcolormap.state == ColormapInstalled) {
+		x11_colormap_installed = 1;
+		DPRINTF("colormap installed\n");
+	    }
+	}
+    }
+    else if (ev->type == FocusIn) {
+	if (!x11_colormap_installed) {
+	    DPRINTF("setting colormap\n");
+	    XInstallColormap(x11_dpy, x11_colormap);
+	    inited = 1;
+	}
+    }
+#if 0
+    else if (ev->type == EnterNotify) {
+	    if(inited)
+	    GdShowCursor(&scrdev);
+    } else if (ev->type == LeaveNotify) {
+	    if(inited)
+	    GdHideCursor(&scrdev);
+    }
+#endif
+
+#ifdef USE_EXPOSURE
+    else if(ev->type == Expose) {
+      _expose(ev->xexpose.x,ev->xexpose.y, ev->xexpose.width,ev->xexpose.height);
+    }
+#endif
+}
+
+
+static int x11_error(Display* dpy, XErrorEvent* ev)
+{
+    char err_string[256];
+
+    XGetErrorText(dpy, ev->error_code, err_string, 256);
+    EPRINTF("X11 error: %s\n", err_string);
+    return 0;
+}
+
+char* classnm[] = { "StaticGray", "GrayScale", "StaticColor",
+		    "PseudoColor", "TrueColor", "DirectColor" };
+
+static void show_visual(Visual* v)
+{
+    char* name = ((v->class < 0) || (v->class > 5)) ? "???" : 
+	classnm[v->class];
+    DPRINTF("  Visual  class: %s (%d)\n", name, v->class);
+    DPRINTF("             id: %ld\n", v->visualid);
+    DPRINTF("   bits_per_rgb: %d\n", v->bits_per_rgb);
+    DPRINTF("    map_entries: %d\n", v->map_entries);
+}
+
+static Visual* select_visual(Display* dpy, int scr)
+{
+    Visual* vis = XDefaultVisual(dpy, scr);
+    Screen* screen = XScreenOfDisplay(dpy, scr);
+    int d;
+
+    DPRINTF("XDefaultVisual:\n");
+    show_visual(vis);
+
+    DPRINTF("Screen RootDepth: %d\n", screen->root_depth);
+    
+    DPRINTF("Screen RootVisual\n");
+    show_visual(screen->root_visual);
+    
+    /* print all depths/visuals */
+
+    for (d = 0; d < screen->ndepths; d++) {
+	Depth* dp = screen->depths + d;
+	int v;
+	DPRINTF("Depth: %d\n", dp->depth);
+	for (v = 0; v < dp->nvisuals; v++) {
+	    DPRINTF("Visual: %d\n", v);
+	    show_visual(dp->visuals + v);
+	}
+    }
+    return vis;
+}
+
+
+int x11_setup_display()
+{
+    static int setup_needed = 1;
+    
+    if (setup_needed) {
+	char* name;
+	int i;
+
+	if ((name = getenv("DISPLAY")) == NULL)
+	    name = ":0";
+	if ((x11_dpy = XOpenDisplay(name)) == NULL)
+	    return -1;
+
+	XSetErrorHandler(x11_error);
+
+	x11_scr = XDefaultScreen(x11_dpy);
+	x11_vis = select_visual(x11_dpy, x11_scr);
+
+	x11_gc = XDefaultGC(x11_dpy, x11_scr);
+
+	for (i = 0; i < COLOR_CACHE_SIZE; i++)
+	    ccache[i].init = 1;
+
+	set_mode(gr_mode);
+
+	setup_needed = 0;
+	return 0;
+    }
+    return 0;
+}
+
+/* Note: only single screen */
+static PSD
+X11_open(PSD psd)
+{
+    XSetWindowAttributes attr;
+    Pixmap cur_empty;
+    unsigned long valuemask;
+    unsigned int  event_mask;
+    XColor color;
+    Cursor cursor;
+    XEvent ev;
+    PSUBDRIVER subdriver;
+    int size, linelen;
+
+    if (x11_setup_display() < 0)
+	return NULL;
+
+    x11_event_mask = ColormapChangeMask | FocusChangeMask;
+/*x11_event_mask |= EnterWindowMask | LeaveWindowMask;*/
+
+    event_mask = x11_event_mask |
+                     ExposureMask |
+	             KeyPressMask |       /* handled by kbd_x11 */
+	             KeyReleaseMask |     /* handled by kbd_x11 */
+	             ButtonPressMask |    /* handled by mou_x11 */
+		     ButtonReleaseMask |  /* handled by mou_x11 */
+		     PointerMotionMask;   /* handled by mou_x11 */
+		     
+
+#ifdef USE_EXPOSURE
+    valuemask = CWSaveUnder |
+      CWEventMask;
+#else
+    valuemask = CWSaveUnder |
+      CWEventMask |
+      CWBackingStore;
+#endif
+    
+    attr.backing_store = Always;     /* auto expose */
+    attr.save_under    = True;       /* popups ... */
+    attr.event_mask    = event_mask;
+
+    x11_win = XCreateWindow(x11_dpy,
+			    XDefaultRootWindow(x11_dpy),
+			    100,             /* x */
+			    100,             /* y */
+			    SCREEN_WIDTH,    /* width */
+			    SCREEN_HEIGHT,   /* height */
+			    2,               /* border */
+			    CopyFromParent,  /* depth */
+			    CopyFromParent,  /* depth */
+			    x11_vis,         /* Visual */
+			    valuemask,	     /* valuemask */
+			    &attr            /* attributes */
+			    );
+
+    /* Create a new empty colormap, the colormap will be
+     ** filled by lookup_color in the case of
+     ** GrayScale, PseduoColor and DirectColor,
+     ** or looked up in the case of 
+     **  StaticGray, StaticColor and TrueColor
+     */
+
+    x11_colormap = XDefaultColormap(x11_dpy, x11_scr);
+    if (x11_vis->class & 1)
+	x11_colormap = XCopyColormapAndFree(x11_dpy, x11_colormap);
+
+    /* If you need more colors, create it from scratch
+     *
+     * x11_colormap = XCreateColormap(x11_dpy, x11_win, x11_vis,
+     * AllocNone);  
+     *
+     * or: for same visual etc.
+     * x11_colormap = XCopyColormapAndFree(x11_dpy, x11_colormap);
+     */
+
+    /* Create an empty (invisible) cursor */
+    cur_empty = XCreateBitmapFromData(x11_dpy, x11_win, "\0", 1, 1);
+    cursor = XCreatePixmapCursor(x11_dpy, cur_empty, cur_empty,
+				 &color, &color, 0, 0);
+    XDefineCursor(x11_dpy, x11_win, cursor);
+    XStoreName(x11_dpy, x11_win, "Microwindows");
+
+    XMapWindow(x11_dpy, x11_win);
+    XFlush(x11_dpy);
+
+    /*
+     * The following code insures that the colormap
+     * is installed before display
+     */
+    XMaskEvent(x11_dpy, x11_event_mask, &ev);
+    XPutBackEvent(x11_dpy, &ev);
+    XInstallColormap(x11_dpy, x11_colormap);
+
+    psd->xres    = psd->xvirtres    = SCREEN_WIDTH;
+    psd->yres    = psd->yvirtres    = SCREEN_HEIGHT;
+    psd->linelen = SCREEN_WIDTH;
+    psd->planes  = 1;
+    psd->pixtype = x11_pixtype = MWPIXEL_FORMAT;
+    switch(psd->pixtype) {
+    case MWPF_PALETTE:
+	    psd->bpp = SCREEN_DEPTH;
+	    break;
+    case MWPF_TRUECOLOR0888:
+    default:
+	    psd->bpp = 32;
+	    break;
+    case MWPF_TRUECOLOR888:
+	    psd->bpp = 24;
+	    break;
+    case MWPF_TRUECOLOR565:
+    case MWPF_TRUECOLOR555:
+	    psd->bpp = 16;
+	    break;
+    case MWPF_TRUECOLOR332:
+	    psd->bpp = 8;
+	    break;
+    }
+    psd->ncolors = psd->bpp >= 24? (1 << 24): (1 << psd->bpp);
+    psd->flags   = PSF_SCREEN | PSF_HAVEBLIT;
+    psd->size = 0;
+    psd->addr = NULL;
+
+    /* create permanent savebits memory device from screen device*/
+    savebits = *psd;
+    savebits.flags = PSF_MEMORY | PSF_HAVEBLIT;
+
+    /* select a fb subdriver matching our planes and bpp*/
+    subdriver = select_fb_subdriver(&savebits);
+    if (!subdriver)
+	    return NULL;
+
+    /* calc size and linelen of savebits alloc*/
+    GdCalcMemGCAlloc(&savebits, savebits.xvirtres, savebits.yvirtres, 0, 0,
+		&size, &linelen);
+    savebits.linelen = linelen;
+    savebits.size = size;
+    if ((savebits.addr = malloc(size)) == NULL)
+	return NULL;
+
+    set_subdriver(&savebits, subdriver, TRUE);
+
+
+    /* set X11 psd to savebits memaddr for screen->offscreen blits...*/
+    psd->addr = savebits.addr;
+
+    return psd;
+}
+
+static void
+X11_close(PSD psd)
+{
+    /* free savebits memory*/
+    free(savebits.addr);
+
+    XCloseDisplay(x11_dpy);
+}
+
+
+static void
+X11_getscreeninfo(PSD psd,PMWSCREENINFO psi)
+{
+    psi->rows = psd->yvirtres;
+    psi->cols = psd->xvirtres;
+    psi->planes = psd->planes;
+    psi->bpp = psd->bpp;
+    psi->ncolors = psd->ncolors;
+    psi->pixtype = psd->pixtype;
+    psi->fonts = NUMBER_FONTS;
+    psi->xdpcm = (DisplayWidth(x11_dpy,x11_scr)*10)/
+	    DisplayWidthMM(x11_dpy,x11_scr);
+    psi->ydpcm = (DisplayHeight(x11_dpy,x11_scr)*10)/
+	    DisplayHeightMM(x11_dpy,x11_scr);
+}
+
+static void
+X11_setpalette(PSD psd, int first, int count, MWPALENTRY *pal)
+{
+    int i;
+    int n;
+
+    for (i = 0; i < count; i++) {
+	char spec[20];
+	unsigned short r, g, b;
+	XColor exact;
+	XColor def;
+
+	r = pal[i].r;
+	g = pal[i].g;
+	b = pal[i].b;
+	sprintf(spec, "#%02x%02x%02x", r, g, b);
+	XLookupColor(x11_dpy, x11_colormap, spec, &exact, &def);
+	XAllocColor(x11_dpy, x11_colormap, &def);
+	 /* DPRINTF("lookup: exact(%d,%d,%d) = %d, def(%d,%d,%d)=%d\n",
+	   exact.red, exact.green, exact.blue, exact.pixel,
+	   def.red, def.green, def.blue, def.pixel); */
+	x11_palette[first+i] = def;
+    }
+    n = first + count - 1;
+    if (n > x11_pal_max)
+	x11_pal_max = n;
+}
+
+
+static void
+X11_drawpixel(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c)
+{
+	set_color(c);
+	set_mode(gr_mode);
+	XDrawPoint(x11_dpy, x11_win, x11_gc, x, y);
+
+	/* draw savebits for readpixel or blit*/
+	savebits.DrawPixel(&savebits, x, y, c);
+}
+
+static MWPIXELVAL
+X11_readpixel(PSD psd, MWCOORD x, MWCOORD y)
+{
+	/* read savebits for pixel value, rather than ask X11*/
+	return savebits.ReadPixel(&savebits,x,y);
+}
+
+static void
+X11_drawhline(PSD psd,MWCOORD x1, MWCOORD x2, MWCOORD y, MWPIXELVAL c)
+{
+	set_color(c);
+	set_mode(gr_mode);
+	XDrawLine(x11_dpy, x11_win, x11_gc, x1, y, x2, y);
+
+	/* draw savebits for readpixel or blit*/
+	savebits.DrawHorzLine(&savebits, x1, x2, y, c);
+}
+
+static void
+X11_drawvline(PSD psd,MWCOORD x, MWCOORD y1, MWCOORD y2, MWPIXELVAL c)
+{
+	set_color(c);
+	set_mode(gr_mode);
+	XDrawLine(x11_dpy, x11_win, x11_gc, x, y1, x, y2);
+	savebits.DrawVertLine(&savebits, x, y1, y2, c);
+}
+
+static void
+X11_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2, MWPIXELVAL c)
+{
+	set_color(c);
+	set_mode(gr_mode);
+	XFillRectangle(x11_dpy, x11_win, x11_gc, x1, y1, (x2-x1)+1, (y2-y1)+1);
+
+	/* draw savebits for readpixel or blit*/
+	savebits.FillRect(&savebits, x1, y1, x2, y2, c);
+}
+
+static void
+X11_srccopyblit_screen_to_screen(PMWBLITARGS pb)
+{
+}
+
+static void
+X11_blendconstantblit_screen_to_mem(PMWBLITARGS pb)
+{
+}
+
+static void
+X11_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,MWCOORD h,
+	 PSD srcpsd,MWCOORD srcx,MWCOORD srcy, long op)
+{
+#if ALPHABLEND
+    unsigned int alpha;
+#endif
+
+    set_mode(gr_mode);
+    if (dstpsd == srcpsd) {
+	if (dstpsd->flags & PSF_SCREEN) {
+	    XCopyArea(x11_dpy, x11_win, x11_win, x11_gc,
+		      srcx, srcy, w, h, destx, desty);
+
+	    /* update screen savebits as well*/
+	    savebits.Blit(&savebits, destx, desty, w, h,
+			&savebits, srcx, srcy, op);
+	}
+	else
+	    /* memory to memory blit, use offscreen blitter*/
+	    dstpsd->Blit(dstpsd, destx, desty, w, h, srcpsd, srcx, srcy, op);
+    }
+    else if (dstpsd->flags & PSF_SCREEN) {
+	XImage* img;
+	int depth = XDefaultDepth(x11_dpy, x11_scr);
+	int x, y;
+	char* data;
+
+	/* allocate buffer */
+	if (depth >= 24)
+	    data = malloc(w*4*h);
+	else if (depth > 8) /* 15, 16 */
+	    data = malloc(w*2*h);
+	else  /* 1,2,4,8 */
+	    data = malloc((w*depth+7)/8 * h);
+
+	/* copy from offscreen to screen */
+	img = XCreateImage(x11_dpy, x11_vis, depth, ZPixmap,
+			   0, data, w, h, 8, 0);
+#if ALPHABLEND && (MWPIXEL_FORMAT != MWPF_PALETTE)
+	if ((op & MWROP_EXTENSION) == MWROP_BLENDCONSTANT) {
+		alpha = op & 0xff;
+
+		for (y = 0; y < h; y++) {
+	  		for (x = 0; x < w; x++) {
+				MWPIXELVAL c = srcpsd->ReadPixel(srcpsd,srcx+x,srcy+y);
+				MWPIXELVAL cd = dstpsd->ReadPixel(dstpsd,destx+x,desty+y);
+				unsigned char nred = ALPHAPIXELRED(c, cd, alpha);
+				unsigned char ngreen = ALPHAPIXELGREEN(c, cd, alpha);
+				unsigned char nblue = ALPHAPIXELBLUE(c, cd, alpha);
+				unsigned long pixel = PIXELVAL_to_pixel(RGB2PIXEL(nred, ngreen, nblue), srcpsd->pixtype);
+				XPutPixel(img, x, y, pixel);
+
+				/* update screen savebits*/
+				savebits.DrawPixel(&savebits, destx+x, desty+y, RGB2PIXEL(nred, ngreen, nblue));
+	    		}
+		}
+	}
+	else {
+    		MWPIXELVAL c = 0;
+		unsigned long pixel;
+
+		for (y = 0; y < h; y++) {
+	    		for (x = 0; x < w; x++) {
+				switch (op) {
+				case MWROP_SRCCOPY:
+					c = srcpsd->ReadPixel(srcpsd,srcx+x,srcy+y);
+					pixel = PIXELVAL_to_pixel(c, srcpsd->pixtype);
+					XPutPixel(img, x, y, pixel);
+					break;
+				case MWROP_SRCAND:
+					c = (srcpsd->ReadPixel(srcpsd,srcx+x,srcy+y)) & (dstpsd->ReadPixel(dstpsd,destx+x,desty+y));
+					pixel = PIXELVAL_to_pixel(c, srcpsd->pixtype);
+					XPutPixel(img, x, y, pixel);
+					break;
+				case MWROP_SRCINVERT:
+					c = (srcpsd->ReadPixel(srcpsd,srcx+x,srcy+y)) ^ (dstpsd->ReadPixel(dstpsd,destx+x,desty+y));
+					pixel = PIXELVAL_to_pixel(c, srcpsd->pixtype);
+					XPutPixel(img, x, y, pixel);
+					break;
+				case MWROP_BLACKNESS:
+					c = 0;
+					pixel = PIXELVAL_to_pixel(c, srcpsd->pixtype);
+					XPutPixel(img, x, y, pixel);
+					break;
+				}
+
+				/* update screen savebits*/
+				savebits.DrawPixel(&savebits, destx+x, desty+y, c);
+			}
+		}
+	}
+#else
+	for (y = 0; y < h; y++) {
+	    for (x = 0; x < w; x++) {
+		MWPIXELVAL c = srcpsd->ReadPixel(srcpsd,srcx+x,srcy+y);
+		unsigned long pixel = PIXELVAL_to_pixel(c, srcpsd->pixtype);
+		XPutPixel(img, x, y, pixel);
+		/* update screen savebits*/
+		savebits.DrawPixel(&savebits, destx+x, desty+y, c);
+	    }
+	}
+#endif
+
+	XPutImage(x11_dpy, x11_win, x11_gc, img, 0, 0, destx, desty, w, h);
+	XDestroyImage(img);
+    }
+    else if (srcpsd->flags & PSF_SCREEN) {
+	int x, y;
+
+#if ALPHABLEND && (MWPIXEL_FORMAT != MWPF_PALETTE)
+	if ((op & MWROP_EXTENSION) == MWROP_BLENDCONSTANT) {
+		alpha = op & 0xff;
+
+		for (y = 0; y < h; y++) {
+	  		for (x = 0; x < w; x++) {
+				MWPIXELVAL c = srcpsd->ReadPixel(srcpsd,srcx+x,srcy+y);
+				MWPIXELVAL cd = dstpsd->ReadPixel(dstpsd,destx+x,desty+y);
+				unsigned char nred = ALPHAPIXELRED(c, cd, alpha);
+				unsigned char ngreen = ALPHAPIXELGREEN(c, cd, alpha);
+				unsigned char nblue = ALPHAPIXELBLUE(c, cd, alpha);
+				dstpsd->DrawPixel(dstpsd, destx+x, desty+y, RGB2PIXEL(nred, ngreen, nblue));
+			}
+		}
+	}
+	else {
+		/* copy from screen to offscreen,
+		 * emulated by copy from offscreen bits, no alpha
+		 */
+		for (y = 0; y < h; y++) {
+			for (x = 0; x < w; x++) {	
+				MWPIXELVAL c = srcpsd->ReadPixel(srcpsd,srcx+x,srcy+y);
+				dstpsd->DrawPixel(dstpsd, destx+x, desty+y, c);
+			}
+		}
+	}
+#else
+	/* copy from screen to offscreen, emulated by copy from offscreen bits*/
+	for (y = 0; y < h; y++) {
+	    for (x = 0; x < w; x++) {	
+		MWPIXELVAL c = srcpsd->ReadPixel(srcpsd,srcx+x,srcy+y);
+		dstpsd->DrawPixel(dstpsd, destx+x, desty+y, c);
+	    }
+	}
+#endif
+    }
+}
+
+/* perform pre-select() duties*/
+static void
+X11_preselect(PSD psd)
+{
+	XFlush(x11_dpy);
+}
diff -urN lib/microwindows/src/drivers/vgainit.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/vgainit.c
--- lib/microwindows/src/drivers/vgainit.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/vgainit.c	2005-02-21 16:13:11.000000000 +0100
@@ -0,0 +1,758 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Alternate EGA/VGA Screen Driver Init, direct hw programming
+ */
+#include "device.h"
+#include "vgaplan4.h"
+
+#ifdef __rtems__
+#define ROMFONT		0	/* =0 no bios rom fonts available*/
+#else
+#define ROMFONT		1	/* =1 uses PC rom fonts */
+#endif
+
+/* Define one and only one of the following to be nonzero*/
+#define	VGA_ET4000	0	/* TSENG LABS ET4000 chip 800x600*/
+#define	VGA_STANDARD	1	/* standard VGA 640x480*/
+#define	EGA_STANDARD	0	/* standard EGA 640x350*/
+
+#define	DONE	0
+#define	IN	1
+#define	OUT	2
+
+#define	RAM_SCAN_LINES	32	/* number of scan lines in fonts in RAM */
+#define	FONT_CHARS	256	/* number of characters in font tables */
+#define	CHAR_WIDTH	8	/* number of pixels for character width */
+
+#define	PALREG	0x3c0
+#define	SEQREG	0x3c4
+#define	SEQVAL	0x3c5
+#define	GRREG	0x3ce
+#define	GRVAL	0x3cf
+#define	ATTRREG	0x3da
+#define	CRTCREG	0x3d4
+#define	CRTCVAL	0x3d5
+
+#define	GENREG1	0x3c2
+#define	GENREG2	0x3cc
+#define	GENREG3	0x3ca
+
+#define	DATA_ROTATE	3	/* register number for data rotate */
+
+typedef struct {
+  int action;
+  int port1;
+  int data1;
+  int port2;
+  int data2;
+} REGIO;
+
+/* extern data*/
+#if ROMFONT
+extern FARADDR 		rom_char_addr;		/* address of ROM font*/
+extern int		ROM_CHAR_HEIGHT;	/* ROM character height*/
+#endif
+
+/* local data*/
+extern REGIO 		graphics_on[];
+extern REGIO 		graph_off[];
+
+/* entry points*/
+void		ega_hwinit(void);
+void		ega_hwterm(void);
+
+/* local routines*/
+static void writeregs(REGIO *rp);
+static void out_word(unsigned int p,unsigned int d);
+static void setmode(int mode);
+
+void
+ega_hwinit(void)
+{
+	writeregs(graphics_on);
+}
+
+void
+ega_hwterm(void)
+{
+  setmode(MWMODE_SET);
+
+  /* Copy character table from ROM back into bit plane 2 before turning
+   * off graphics.
+   */
+  out_word(SEQREG, 0x0100);	/* syn reset */
+  out_word(SEQREG, 0x0402);	/* cpu writes only to map 2 */
+  out_word(SEQREG, 0x0704);	/* sequential addressing */
+  out_word(SEQREG, 0x0300);	/* clear synchronous reset */
+
+  out_word(GRREG, 0x0204);	/* select map 2 for CPU reads */
+  out_word(GRREG, 0x0005);	/* disable odd-even addressing */
+
+#if ROMFONT
+  {
+	  FARADDR	srcoffset;
+	  FARADDR	destoffset;
+	  int 		data;
+	  int 		ch;
+	  int 		row;
+
+	  srcoffset = rom_char_addr;
+	  destoffset = EGA_BASE;
+	  for (ch = 0; ch < FONT_CHARS; ch++) {
+		for(row = 0; row < ROM_CHAR_HEIGHT; row++) {
+			data = GETBYTE_FP(srcoffset++);
+			PUTBYTE_FP(destoffset++, data);
+		}
+		destoffset += (RAM_SCAN_LINES - ROM_CHAR_HEIGHT);
+	  }
+  }
+#endif
+
+  /* Finally set the registers back for text mode. */
+  writeregs(graph_off);
+}
+
+/* Set the graphics registers as indicated by the given table */
+static void
+writeregs(REGIO *rp)
+{
+  for (; rp->action != DONE; rp++) {
+	switch (rp->action) {
+	    case IN:
+			inp(rp->port1);
+			break;
+	    case OUT:
+			outp(rp->port1, rp->data1);
+			if (rp->port2)
+				outp(rp->port2, rp->data2);
+			break;
+	}
+  }
+}
+
+/* Output a word to an I/O port. */
+static void
+out_word(unsigned int p,unsigned int d)
+{
+  outp(p, d & 0xff);
+  outp(p + 1, (d >> 8) & 0xff);
+}
+
+
+/* Values for the data rotate register to implement drawing modes. */
+static unsigned char mode_table[MWMODE_MAX + 1] = {
+  0x00, 0x18, 0x10, 0x08
+};
+
+/* Set the drawing mode.
+ * This is either SET, OR, AND, or XOR.
+ */
+static void
+setmode(int mode)
+{
+  if (mode > MWMODE_MAX)
+  	return;
+  outp(GRREG, DATA_ROTATE);
+  outp(GRVAL, mode_table[mode]);
+}
+
+
+#if VGA_ET4000
+
+/* VGA 800x600 16-color graphics (BIOS mode 0x29).
+ */
+static REGIO graphics_on[] = {
+  /* Reset attr F/F */
+  IN, ATTRREG, 0, 0, 0,
+
+  /* Disable palette */
+  OUT, PALREG, 0, 0, 0,
+
+  /* Reset sequencer regs */
+  OUT, SEQREG, 0, SEQVAL, 0,
+  OUT, SEQREG, 1, SEQVAL, 1,
+  OUT, SEQREG, 2, SEQVAL, 0x0f,
+  OUT, SEQREG, 3, SEQVAL, 0,
+  OUT, SEQREG, 4, SEQVAL, 6,
+
+  /* Misc out reg */
+  OUT, GENREG1, 0xe3, 0, 0,
+
+  /* Sequencer enable */
+  OUT, SEQREG, 0, SEQVAL, 0x03,
+
+  /* Unprotect crtc regs 0-7 */
+  OUT, CRTCREG, 0x11, CRTCVAL, 0,
+
+  /* Crtc */
+  OUT, CRTCREG, 0, CRTCVAL, 0x7a,
+  OUT, CRTCREG, 1, CRTCVAL, 0x63,
+  OUT, CRTCREG, 2, CRTCVAL, 0x64,
+  OUT, CRTCREG, 3, CRTCVAL, 0x1d,
+  OUT, CRTCREG, 4, CRTCVAL, 0x68,
+  OUT, CRTCREG, 5, CRTCVAL, 0x9a,
+  OUT, CRTCREG, 6, CRTCVAL, 0x78,
+  OUT, CRTCREG, 7, CRTCVAL, 0xf0,
+  OUT, CRTCREG, 8, CRTCVAL, 0x00,
+  OUT, CRTCREG, 9, CRTCVAL, 0x60,
+  OUT, CRTCREG, 10, CRTCVAL, 0x00,
+  OUT, CRTCREG, 11, CRTCVAL, 0x00,
+  OUT, CRTCREG, 12, CRTCVAL, 0x00,
+  OUT, CRTCREG, 13, CRTCVAL, 0x00,
+  OUT, CRTCREG, 14, CRTCVAL, 0x00,
+  OUT, CRTCREG, 15, CRTCVAL, 0x00,
+  OUT, CRTCREG, 16, CRTCVAL, 0x5c,
+  OUT, CRTCREG, 17, CRTCVAL, 0x8e,
+  OUT, CRTCREG, 18, CRTCVAL, 0x57,
+  OUT, CRTCREG, 19, CRTCVAL, 0x32,
+  OUT, CRTCREG, 20, CRTCVAL, 0x00,
+  OUT, CRTCREG, 21, CRTCVAL, 0x5b,
+  OUT, CRTCREG, 22, CRTCVAL, 0x75,
+  OUT, CRTCREG, 23, CRTCVAL, 0xc3,
+  OUT, CRTCREG, 24, CRTCVAL, 0xff,
+
+  /* Graphics controller */
+  OUT, GENREG2, 0x00, 0, 0,
+  OUT, GENREG3, 0x01, 0, 0,
+  OUT, GRREG, 0, GRVAL, 0x00,
+  OUT, GRREG, 1, GRVAL, 0x00,
+  OUT, GRREG, 2, GRVAL, 0x00,
+  OUT, GRREG, 3, GRVAL, 0x00,
+  OUT, GRREG, 4, GRVAL, 0x00,
+  OUT, GRREG, 5, GRVAL, 0x00,
+  OUT, GRREG, 6, GRVAL, 0x05,
+  OUT, GRREG, 7, GRVAL, 0x0f,
+  OUT, GRREG, 8, GRVAL, 0xff,
+
+  /* Reset attribute flip/flop */
+  IN, ATTRREG, 0, 0, 0,
+
+  /* Palette */
+  OUT, PALREG, 0, PALREG, 0x00,
+  OUT, PALREG, 1, PALREG, 0x01,
+  OUT, PALREG, 2, PALREG, 0x02,
+  OUT, PALREG, 3, PALREG, 0x03,
+  OUT, PALREG, 4, PALREG, 0x04,
+  OUT, PALREG, 5, PALREG, 0x05,
+  OUT, PALREG, 6, PALREG, 0x06,
+  OUT, PALREG, 7, PALREG, 0x07,
+  OUT, PALREG, 8, PALREG, 0x38,
+  OUT, PALREG, 9, PALREG, 0x39,
+  OUT, PALREG, 10, PALREG, 0x3a,
+  OUT, PALREG, 11, PALREG, 0x3b,
+  OUT, PALREG, 12, PALREG, 0x3c,
+  OUT, PALREG, 13, PALREG, 0x3d,
+  OUT, PALREG, 14, PALREG, 0x3e,
+  OUT, PALREG, 15, PALREG, 0x3f,
+  OUT, PALREG, 16, PALREG, 0x01,
+  OUT, PALREG, 17, PALREG, 0x00,
+  OUT, PALREG, 18, PALREG, 0x0f,
+  OUT, PALREG, 19, PALREG, 0x00,
+
+  /* Enable palette */
+  OUT, PALREG, 0x20, 0, 0,
+
+  /* End of table */
+  DONE, 0, 0, 0, 0
+};
+
+
+/* VGA 80x25 text (BIOS mode 3).
+ */
+static REGIO graph_off[] = {
+  /* Reset attr F/F */
+  IN, ATTRREG, 0, 0, 0,
+
+  /* Disable palette */
+  OUT, PALREG, 0, 0, 0,
+
+  /* Reset sequencer regs */
+  OUT, SEQREG, 0, SEQVAL, 1,
+  OUT, SEQREG, 1, SEQVAL, 1,
+  OUT, SEQREG, 2, SEQVAL, 3,
+  OUT, SEQREG, 3, SEQVAL, 0,
+  OUT, SEQREG, 4, SEQVAL, 2,
+
+  /* Misc out reg */
+  OUT, GENREG1, 0x63, 0, 0,
+
+  /* Sequencer enable */
+  OUT, SEQREG, 0, SEQVAL, 3,
+
+  /* Unprotect crtc regs 0-7 */
+  OUT, CRTCREG, 0x11, CRTCVAL, 0,
+
+  /* Crtc */
+  OUT, CRTCREG, 0, CRTCVAL, 0x5f,	/* horiz total */
+  OUT, CRTCREG, 1, CRTCVAL, 0x4f,	/* horiz end */
+  OUT, CRTCREG, 2, CRTCVAL, 0x50,	/* horiz blank */
+  OUT, CRTCREG, 3, CRTCVAL, 0x82,	/* end blank */
+  OUT, CRTCREG, 4, CRTCVAL, 0x55,	/* horiz retrace */
+  OUT, CRTCREG, 5, CRTCVAL, 0x81,	/* end retrace */
+  OUT, CRTCREG, 6, CRTCVAL, 0xbf,	/* vert total */
+  OUT, CRTCREG, 7, CRTCVAL, 0x1f,	/* overflows */
+  OUT, CRTCREG, 8, CRTCVAL, 0x00,	/* row scan */
+  OUT, CRTCREG, 9, CRTCVAL, 0x4f,	/* max scan line */
+  OUT, CRTCREG, 10, CRTCVAL, 0x00,	/* cursor start */
+  OUT, CRTCREG, 11, CRTCVAL, 0x0f,	/* cursor end */
+  OUT, CRTCREG, 12, CRTCVAL, 0x0e,	/* start high addr */
+  OUT, CRTCREG, 13, CRTCVAL, 0xb0,	/* low addr */
+  OUT, CRTCREG, 14, CRTCVAL, 0x16,	/* cursor high */
+  OUT, CRTCREG, 15, CRTCVAL, 0x30,	/* cursor low */
+  OUT, CRTCREG, 16, CRTCVAL, 0x9c,	/* vert retrace */
+  OUT, CRTCREG, 17, CRTCVAL, 0x8e,	/* retrace end */
+  OUT, CRTCREG, 18, CRTCVAL, 0x8f,	/* vert end */
+  OUT, CRTCREG, 19, CRTCVAL, 0x28,	/* offset */
+  OUT, CRTCREG, 20, CRTCVAL, 0x1f,	/* underline */
+  OUT, CRTCREG, 21, CRTCVAL, 0x96,	/* vert blank */
+  OUT, CRTCREG, 22, CRTCVAL, 0xb9,	/* end blank */
+  OUT, CRTCREG, 23, CRTCVAL, 0xa3,	/* crt mode */
+  OUT, CRTCREG, 24, CRTCVAL, 0xff,	/* line compare */
+
+  /* Graphics controller */
+  OUT, GENREG2, 0x00, 0, 0,
+  OUT, GENREG3, 0x01, 0, 0,
+  OUT, GRREG, 0, GRVAL, 0x00,
+  OUT, GRREG, 1, GRVAL, 0x00,
+  OUT, GRREG, 2, GRVAL, 0x00,
+  OUT, GRREG, 3, GRVAL, 0x00,
+  OUT, GRREG, 4, GRVAL, 0x00,
+  OUT, GRREG, 5, GRVAL, 0x10,
+  OUT, GRREG, 6, GRVAL, 0x0e,
+  OUT, GRREG, 7, GRVAL, 0x00,
+  OUT, GRREG, 8, GRVAL, 0xff,
+
+  /* Reset attribute flip/flop */
+  IN, ATTRREG, 0, 0, 0,
+
+  /* Palette */
+  OUT, PALREG, 0, PALREG, 0x00,
+  OUT, PALREG, 1, PALREG, 0x01,
+  OUT, PALREG, 2, PALREG, 0x02,
+  OUT, PALREG, 3, PALREG, 0x03,
+  OUT, PALREG, 4, PALREG, 0x04,
+  OUT, PALREG, 5, PALREG, 0x05,
+  OUT, PALREG, 6, PALREG, 0x06,
+  OUT, PALREG, 7, PALREG, 0x07,
+  OUT, PALREG, 8, PALREG, 0x10,
+  OUT, PALREG, 9, PALREG, 0x11,
+  OUT, PALREG, 10, PALREG, 0x12,
+  OUT, PALREG, 11, PALREG, 0x13,
+  OUT, PALREG, 12, PALREG, 0x14,
+  OUT, PALREG, 13, PALREG, 0x15,
+  OUT, PALREG, 14, PALREG, 0x16,
+  OUT, PALREG, 15, PALREG, 0x17,
+  OUT, PALREG, 16, PALREG, 0x08,
+  OUT, PALREG, 17, PALREG, 0x00,
+  OUT, PALREG, 18, PALREG, 0x0f,
+  OUT, PALREG, 19, PALREG, 0x00,
+
+  /* Enable palette */
+  OUT, PALREG, 0x20, 0, 0,
+
+  /* End of table */
+  DONE, 0, 0, 0, 0
+};
+
+#endif
+
+
+#if VGA_STANDARD
+
+/* VGA 640x480 16-color graphics (BIOS mode 0x12).
+ */
+static REGIO graphics_on[] = {
+  /* Reset attr F/F */
+  IN, ATTRREG, 0, 0, 0,
+
+  /* Disable palette */
+  OUT, PALREG, 0, 0, 0,
+
+  /* Reset sequencer regs */
+  OUT, SEQREG, 0, SEQVAL, 0,
+  OUT, SEQREG, 1, SEQVAL, 1,
+  OUT, SEQREG, 2, SEQVAL, 0x0f,
+  OUT, SEQREG, 3, SEQVAL, 0,
+  OUT, SEQREG, 4, SEQVAL, 6,
+
+  /* Misc out reg */
+  OUT, GENREG1, 0xe3, 0, 0,
+
+  /* Sequencer enable */
+  OUT, SEQREG, 0, SEQVAL, 0x03,
+
+  /* Unprotect crtc regs 0-7 */
+  OUT, CRTCREG, 0x11, CRTCVAL, 0,
+
+  /* Crtc */
+  OUT, CRTCREG, 0, CRTCVAL, 0x5f,
+  OUT, CRTCREG, 1, CRTCVAL, 0x4f,
+  OUT, CRTCREG, 2, CRTCVAL, 0x50,
+  OUT, CRTCREG, 3, CRTCVAL, 0x82,
+  OUT, CRTCREG, 4, CRTCVAL, 0x54,
+  OUT, CRTCREG, 5, CRTCVAL, 0x80,
+  OUT, CRTCREG, 6, CRTCVAL, 0x0b,
+  OUT, CRTCREG, 7, CRTCVAL, 0x3e,
+  OUT, CRTCREG, 8, CRTCVAL, 0x00,
+  OUT, CRTCREG, 9, CRTCVAL, 0x40,
+  OUT, CRTCREG, 10, CRTCVAL, 0x00,
+  OUT, CRTCREG, 11, CRTCVAL, 0x00,
+  OUT, CRTCREG, 12, CRTCVAL, 0x00,
+  OUT, CRTCREG, 13, CRTCVAL, 0x00,
+  OUT, CRTCREG, 14, CRTCVAL, 0x00,
+  OUT, CRTCREG, 15, CRTCVAL, 0x59,
+  OUT, CRTCREG, 16, CRTCVAL, 0xea,
+  OUT, CRTCREG, 17, CRTCVAL, 0x8c,
+  OUT, CRTCREG, 18, CRTCVAL, 0xdf,
+  OUT, CRTCREG, 19, CRTCVAL, 0x28,
+  OUT, CRTCREG, 20, CRTCVAL, 0x00,
+  OUT, CRTCREG, 21, CRTCVAL, 0xe7,
+  OUT, CRTCREG, 22, CRTCVAL, 0x04,
+  OUT, CRTCREG, 23, CRTCVAL, 0xe3,
+  OUT, CRTCREG, 24, CRTCVAL, 0xff,
+
+  /* Graphics controller */
+  OUT, GENREG2, 0x00, 0, 0,
+  OUT, GENREG3, 0x01, 0, 0,
+  OUT, GRREG, 0, GRVAL, 0x00,
+  OUT, GRREG, 1, GRVAL, 0x00,
+  OUT, GRREG, 2, GRVAL, 0x00,
+  OUT, GRREG, 3, GRVAL, 0x00,
+  OUT, GRREG, 4, GRVAL, 0x00,
+  OUT, GRREG, 5, GRVAL, 0x00,
+  OUT, GRREG, 6, GRVAL, 0x05,
+  OUT, GRREG, 7, GRVAL, 0x0f,
+  OUT, GRREG, 8, GRVAL, 0xff,
+
+  /* Reset attribute flip/flop */
+  IN, ATTRREG, 0, 0, 0,
+
+  /* Palette */
+  OUT, PALREG, 0, PALREG, 0x00,
+  OUT, PALREG, 1, PALREG, 0x01,
+  OUT, PALREG, 2, PALREG, 0x02,
+  OUT, PALREG, 3, PALREG, 0x03,
+  OUT, PALREG, 4, PALREG, 0x04,
+  OUT, PALREG, 5, PALREG, 0x05,
+  OUT, PALREG, 6, PALREG, 0x06,
+  OUT, PALREG, 7, PALREG, 0x07,
+  OUT, PALREG, 8, PALREG, 0x38,
+  OUT, PALREG, 9, PALREG, 0x39,
+  OUT, PALREG, 10, PALREG, 0x3a,
+  OUT, PALREG, 11, PALREG, 0x3b,
+  OUT, PALREG, 12, PALREG, 0x3c,
+  OUT, PALREG, 13, PALREG, 0x3d,
+  OUT, PALREG, 14, PALREG, 0x3e,
+  OUT, PALREG, 15, PALREG, 0x3f,
+  OUT, PALREG, 16, PALREG, 0x01,
+  OUT, PALREG, 17, PALREG, 0x00,
+  OUT, PALREG, 18, PALREG, 0x0f,
+  OUT, PALREG, 19, PALREG, 0x00,
+
+  /* Enable palette */
+  OUT, PALREG, 0x20, 0, 0,
+
+  /* End of table */
+  DONE, 0, 0, 0, 0
+};
+
+
+/* VGA 80x25 text (BIOS mode 3).
+ */
+static REGIO graph_off[] = {
+  /* Reset attr F/F */
+  IN, ATTRREG, 0, 0, 0,
+
+  /* Disable palette */
+  OUT, PALREG, 0, 0, 0,
+
+  /* Reset sequencer regs */
+  OUT, SEQREG, 0, SEQVAL, 1,
+  OUT, SEQREG, 1, SEQVAL, 1,
+  OUT, SEQREG, 2, SEQVAL, 3,
+  OUT, SEQREG, 3, SEQVAL, 0,
+  OUT, SEQREG, 4, SEQVAL, 2,
+
+  /* Misc out reg */
+  OUT, GENREG1, 0x63, 0, 0,
+
+  /* Sequencer enable */
+  OUT, SEQREG, 0, SEQVAL, 3,
+
+  /* Unprotect crtc regs 0-7 */
+  OUT, CRTCREG, 0x11, CRTCVAL, 0,
+
+  /* Crtc */
+  OUT, CRTCREG, 0, CRTCVAL, 0x5f,	/* horiz total */
+  OUT, CRTCREG, 1, CRTCVAL, 0x4f,	/* horiz end */
+  OUT, CRTCREG, 2, CRTCVAL, 0x50,	/* horiz blank */
+  OUT, CRTCREG, 3, CRTCVAL, 0x82,	/* end blank */
+  OUT, CRTCREG, 4, CRTCVAL, 0x55,	/* horiz retrace */
+  OUT, CRTCREG, 5, CRTCVAL, 0x81,	/* end retrace */
+  OUT, CRTCREG, 6, CRTCVAL, 0xbf,	/* vert total */
+  OUT, CRTCREG, 7, CRTCVAL, 0x1f,	/* overflows */
+  OUT, CRTCREG, 8, CRTCVAL, 0x00,	/* row scan */
+  OUT, CRTCREG, 9, CRTCVAL, 0x4f,	/* max scan line */
+  OUT, CRTCREG, 10, CRTCVAL, 0x00,	/* cursor start */
+  OUT, CRTCREG, 11, CRTCVAL, 0x0f,	/* cursor end */
+  OUT, CRTCREG, 12, CRTCVAL, 0x0e,	/* start high addr */
+  OUT, CRTCREG, 13, CRTCVAL, 0xb0,	/* low addr */
+  OUT, CRTCREG, 14, CRTCVAL, 0x16,	/* cursor high */
+  OUT, CRTCREG, 15, CRTCVAL, 0x30,	/* cursor low */
+  OUT, CRTCREG, 16, CRTCVAL, 0x9c,	/* vert retrace */
+  OUT, CRTCREG, 17, CRTCVAL, 0x8e,	/* retrace end */
+  OUT, CRTCREG, 18, CRTCVAL, 0x8f,	/* vert end */
+  OUT, CRTCREG, 19, CRTCVAL, 0x28,	/* offset */
+  OUT, CRTCREG, 20, CRTCVAL, 0x1f,	/* underline */
+  OUT, CRTCREG, 21, CRTCVAL, 0x96,	/* vert blank */
+  OUT, CRTCREG, 22, CRTCVAL, 0xb9,	/* end blank */
+  OUT, CRTCREG, 23, CRTCVAL, 0xa3,	/* crt mode */
+  OUT, CRTCREG, 24, CRTCVAL, 0xff,	/* line compare */
+
+  /* Graphics controller */
+  OUT, GENREG2, 0x00, 0, 0,
+  OUT, GENREG3, 0x01, 0, 0,
+  OUT, GRREG, 0, GRVAL, 0x00,
+  OUT, GRREG, 1, GRVAL, 0x00,
+  OUT, GRREG, 2, GRVAL, 0x00,
+  OUT, GRREG, 3, GRVAL, 0x00,
+  OUT, GRREG, 4, GRVAL, 0x00,
+  OUT, GRREG, 5, GRVAL, 0x10,
+  OUT, GRREG, 6, GRVAL, 0x0e,
+  OUT, GRREG, 7, GRVAL, 0x00,
+  OUT, GRREG, 8, GRVAL, 0xff,
+
+  /* Reset attribute flip/flop */
+  IN, ATTRREG, 0, 0, 0,
+
+  /* Palette */
+  OUT, PALREG, 0, PALREG, 0x00,
+  OUT, PALREG, 1, PALREG, 0x01,
+  OUT, PALREG, 2, PALREG, 0x02,
+  OUT, PALREG, 3, PALREG, 0x03,
+  OUT, PALREG, 4, PALREG, 0x04,
+  OUT, PALREG, 5, PALREG, 0x05,
+  OUT, PALREG, 6, PALREG, 0x06,
+  OUT, PALREG, 7, PALREG, 0x07,
+  OUT, PALREG, 8, PALREG, 0x10,
+  OUT, PALREG, 9, PALREG, 0x11,
+  OUT, PALREG, 10, PALREG, 0x12,
+  OUT, PALREG, 11, PALREG, 0x13,
+  OUT, PALREG, 12, PALREG, 0x14,
+  OUT, PALREG, 13, PALREG, 0x15,
+  OUT, PALREG, 14, PALREG, 0x16,
+  OUT, PALREG, 15, PALREG, 0x17,
+  OUT, PALREG, 16, PALREG, 0x08,
+  OUT, PALREG, 17, PALREG, 0x00,
+  OUT, PALREG, 18, PALREG, 0x0f,
+  OUT, PALREG, 19, PALREG, 0x00,
+
+  /* Enable palette */
+  OUT, PALREG, 0x20, 0, 0,
+
+  /* End of table */
+  DONE, 0, 0, 0, 0
+};
+
+#endif
+
+
+#if EGA_STANDARD
+
+/* EGA 640x350 16-color graphics (BIOS mode 0x10).
+ */
+static REGIO graphics_on[] = {
+  /* Reset attr F/F */
+  IN, ATTRREG, 0, 0, 0,
+
+  /* Disable palette */
+  OUT, PALREG, 0, 0, 0,
+
+  /* Reset sequencer regs */
+  OUT, SEQREG, 0, SEQVAL, 0,
+  OUT, SEQREG, 1, SEQVAL, 1,
+  OUT, SEQREG, 2, SEQVAL, 0x0f,
+  OUT, SEQREG, 3, SEQVAL, 0,
+  OUT, SEQREG, 4, SEQVAL, 6,
+
+  /* Misc out reg */
+  OUT, GENREG1, 0xa7, 0, 0,
+
+  /* Sequencer enable */
+  OUT, SEQREG, 0, SEQVAL, 0x03,
+
+  /* Unprotect crtc regs 0-7 */
+  OUT, CRTCREG, 0x11, CRTCVAL, 0,
+
+  /* Crtc */
+  OUT, CRTCREG, 0, CRTCVAL, 0x5b,
+  OUT, CRTCREG, 1, CRTCVAL, 0x4f,
+  OUT, CRTCREG, 2, CRTCVAL, 0x53,
+  OUT, CRTCREG, 3, CRTCVAL, 0x37,
+  OUT, CRTCREG, 4, CRTCVAL, 0x52,
+  OUT, CRTCREG, 5, CRTCVAL, 0x00,
+  OUT, CRTCREG, 6, CRTCVAL, 0x6c,
+  OUT, CRTCREG, 7, CRTCVAL, 0x1f,
+  OUT, CRTCREG, 8, CRTCVAL, 0x00,
+  OUT, CRTCREG, 9, CRTCVAL, 0x00,
+  OUT, CRTCREG, 10, CRTCVAL, 0x00,
+  OUT, CRTCREG, 11, CRTCVAL, 0x00,
+  OUT, CRTCREG, 12, CRTCVAL, 0x00,
+  OUT, CRTCREG, 13, CRTCVAL, 0x00,
+  OUT, CRTCREG, 14, CRTCVAL, 0x00,
+  OUT, CRTCREG, 15, CRTCVAL, 0x00,
+  OUT, CRTCREG, 16, CRTCVAL, 0x5e,
+  OUT, CRTCREG, 17, CRTCVAL, 0x2b,
+  OUT, CRTCREG, 18, CRTCVAL, 0x5d,
+  OUT, CRTCREG, 19, CRTCVAL, 0x28,
+  OUT, CRTCREG, 20, CRTCVAL, 0x0f,
+  OUT, CRTCREG, 21, CRTCVAL, 0x5f,
+  OUT, CRTCREG, 22, CRTCVAL, 0x0a,
+  OUT, CRTCREG, 23, CRTCVAL, 0xe3,
+  OUT, CRTCREG, 24, CRTCVAL, 0xff,
+
+  /* Graphics controller */
+  OUT, GENREG2, 0x00, 0, 0,
+  OUT, GENREG3, 0x01, 0, 0,
+  OUT, GRREG, 0, GRVAL, 0x00,
+  OUT, GRREG, 1, GRVAL, 0x00,
+  OUT, GRREG, 2, GRVAL, 0x00,
+  OUT, GRREG, 3, GRVAL, 0x00,
+  OUT, GRREG, 4, GRVAL, 0x00,
+  OUT, GRREG, 5, GRVAL, 0x00,
+  OUT, GRREG, 6, GRVAL, 0x05,
+  OUT, GRREG, 7, GRVAL, 0x0f,
+  OUT, GRREG, 8, GRVAL, 0xff,
+
+  /* Reset attribute flip/flop */
+  IN, ATTRREG, 0, 0, 0,
+
+  /* Palette */
+  OUT, PALREG, 0, PALREG, 0x00,
+  OUT, PALREG, 1, PALREG, 0x01,
+  OUT, PALREG, 2, PALREG, 0x02,
+  OUT, PALREG, 3, PALREG, 0x03,
+  OUT, PALREG, 4, PALREG, 0x04,
+  OUT, PALREG, 5, PALREG, 0x05,
+  OUT, PALREG, 6, PALREG, 0x06,
+  OUT, PALREG, 7, PALREG, 0x07,
+  OUT, PALREG, 8, PALREG, 0x38,
+  OUT, PALREG, 9, PALREG, 0x39,
+  OUT, PALREG, 10, PALREG, 0x3a,
+  OUT, PALREG, 11, PALREG, 0x3b,
+  OUT, PALREG, 12, PALREG, 0x3c,
+  OUT, PALREG, 13, PALREG, 0x3d,
+  OUT, PALREG, 14, PALREG, 0x3e,
+  OUT, PALREG, 15, PALREG, 0x3f,
+  OUT, PALREG, 16, PALREG, 0x01,
+  OUT, PALREG, 17, PALREG, 0x00,
+  OUT, PALREG, 18, PALREG, 0x0f,
+  OUT, PALREG, 19, PALREG, 0x00,
+
+  /* Enable palette */
+  OUT, PALREG, 0x20, 0, 0,
+
+  /* End of table */
+  DONE, 0, 0, 0, 0
+};
+
+
+/* EGA 80x25 text (BIOS mode 3).
+ */
+static REGIO graph_off[] = {
+  /* Reset attr F/F */
+  IN, ATTRREG, 0, 0, 0,
+
+  /* Disable palette */
+  OUT, PALREG, 0, 0, 0,
+
+  /* Reset sequencer regs */
+  OUT, SEQREG, 0, SEQVAL, 1,
+  OUT, SEQREG, 1, SEQVAL, 1,
+  OUT, SEQREG, 2, SEQVAL, 3,
+  OUT, SEQREG, 3, SEQVAL, 0,
+  OUT, SEQREG, 4, SEQVAL, 3,
+
+  /* Misc out reg */
+  OUT, GENREG1, 0xa7, 0, 0,
+
+  /* Sequencer enable */
+  OUT, SEQREG, 0, SEQVAL, 3,
+
+  /* Crtc */
+  OUT, CRTCREG, 0, CRTCVAL, 0x5b,	/* horiz total */
+  OUT, CRTCREG, 1, CRTCVAL, 0x4f,	/* horiz end */
+  OUT, CRTCREG, 2, CRTCVAL, 0x53,	/* horiz blank */
+  OUT, CRTCREG, 3, CRTCVAL, 0x37,	/* end blank */
+  OUT, CRTCREG, 4, CRTCVAL, 0x51,	/* horiz retrace */
+  OUT, CRTCREG, 5, CRTCVAL, 0x5b,	/* end retrace */
+  OUT, CRTCREG, 6, CRTCVAL, 0x6c,	/* vert total */
+  OUT, CRTCREG, 7, CRTCVAL, 0x1f,	/* overflows */
+  OUT, CRTCREG, 8, CRTCVAL, 0x00,	/* row scan */
+  OUT, CRTCREG, 9, CRTCVAL, 0x0d,	/* max scan line */
+  OUT, CRTCREG, 10, CRTCVAL, 0x00,	/* cursor start */
+  OUT, CRTCREG, 11, CRTCVAL, 0x0f,	/* cursor end */
+  OUT, CRTCREG, 12, CRTCVAL, 0x00,	/* start high addr */
+  OUT, CRTCREG, 13, CRTCVAL, 0x00,	/* low addr */
+  OUT, CRTCREG, 14, CRTCVAL, 0x00,	/* cursor high */
+  OUT, CRTCREG, 15, CRTCVAL, 0x00,	/* cursor low */
+  OUT, CRTCREG, 16, CRTCVAL, 0x5e,	/* vert retrace */
+  OUT, CRTCREG, 17, CRTCVAL, 0x2b,	/* retrace end */
+  OUT, CRTCREG, 18, CRTCVAL, 0x5d,	/* vert end */
+  OUT, CRTCREG, 19, CRTCVAL, 0x28,	/* offset */
+  OUT, CRTCREG, 20, CRTCVAL, 0x0f,	/* underline */
+  OUT, CRTCREG, 21, CRTCVAL, 0x5e,	/* vert blank */
+  OUT, CRTCREG, 22, CRTCVAL, 0x0a,	/* end blank */
+  OUT, CRTCREG, 23, CRTCVAL, 0xa3,	/* crt mode */
+  OUT, CRTCREG, 24, CRTCVAL, 0xff,	/* line compare */
+
+  /* Graphics controller */
+  OUT, GENREG2, 0x00, 0, 0,
+  OUT, GENREG3, 0x01, 0, 0,
+  OUT, GRREG, 0, GRVAL, 0x00,
+  OUT, GRREG, 1, GRVAL, 0x00,
+  OUT, GRREG, 2, GRVAL, 0x00,
+  OUT, GRREG, 3, GRVAL, 0x00,
+  OUT, GRREG, 4, GRVAL, 0x00,
+  OUT, GRREG, 5, GRVAL, 0x10,
+  OUT, GRREG, 6, GRVAL, 0x0e,
+  OUT, GRREG, 7, GRVAL, 0x00,
+  OUT, GRREG, 8, GRVAL, 0xff,
+
+  /* Reset attribute flip/flop */
+  IN, ATTRREG, 0, 0, 0,
+
+  /* Palette */
+  OUT, PALREG, 0, PALREG, 0x00,
+  OUT, PALREG, 1, PALREG, 0x01,
+  OUT, PALREG, 2, PALREG, 0x02,
+  OUT, PALREG, 3, PALREG, 0x03,
+  OUT, PALREG, 4, PALREG, 0x04,
+  OUT, PALREG, 5, PALREG, 0x05,
+  OUT, PALREG, 6, PALREG, 0x14,
+  OUT, PALREG, 7, PALREG, 0x07,
+  OUT, PALREG, 8, PALREG, 0x38,
+  OUT, PALREG, 9, PALREG, 0x39,
+  OUT, PALREG, 10, PALREG, 0x3a,
+  OUT, PALREG, 11, PALREG, 0x3b,
+  OUT, PALREG, 12, PALREG, 0x3c,
+  OUT, PALREG, 13, PALREG, 0x3d,
+  OUT, PALREG, 14, PALREG, 0x3e,
+  OUT, PALREG, 15, PALREG, 0x3f,
+  OUT, PALREG, 16, PALREG, 0x08,
+  OUT, PALREG, 17, PALREG, 0x00,
+  OUT, PALREG, 18, PALREG, 0x0f,
+  OUT, PALREG, 19, PALREG, 0x00,
+
+  /* Enable palette */
+  OUT, PALREG, 0x20, 0, 0,
+
+  /* End of table */
+  DONE, 0, 0, 0, 0
+};
+
+#endif
diff -urN lib/microwindows/src/drivers/vgaplan4.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/vgaplan4.c
--- lib/microwindows/src/drivers/vgaplan4.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/vgaplan4.c	2005-02-21 16:13:11.000000000 +0100
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * 16 color 4 planes EGA/VGA Planar Video Driver for Microwindows
+ * Portable C version
+ *
+ * Based on BOGL - Ben's Own Graphics Library.
+ *   Written by Ben Pfaff <pfaffben@debian.org>.
+ *	 BOGL is licensed under the terms of the GNU General Public License
+ *
+ * In this driver, psd->linelen is line byte length, not line pixel length
+ *
+ * This file is meant to compile under Linux, ELKS, and MSDOS
+ * without changes.  Please try to keep it that way.
+ * 
+ */
+/*#define NDEBUG*/
+#if _MINIX
+#include <ibm/portio.h>
+#endif
+#include <assert.h>
+#include "device.h"
+#include "vgaplan4.h"
+#include "fb.h"
+
+#if MSDOS | ELKS | __rtems__
+/* assumptions for speed: NOTE: psd is ignored in these routines*/
+#define SCREENBASE 		EGA_BASE
+#define BYTESPERLINE		80
+#else
+/* run on top of framebuffer*/
+#define SCREENBASE 		((char *)psd->addr)
+#define BYTESPERLINE		(psd->linelen)
+#endif
+
+/* extern data*/
+extern int gr_mode;	/* temp kluge*/
+
+/* Values for the data rotate register to implement drawing modes. */
+static unsigned char mode_table[MWMODE_MAX + 1] = {
+	0x00, 0x18, 0x10, 0x08
+};
+
+/* precalculated mask bits*/
+static unsigned char mask[8] = {
+	0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
+};
+
+#if HAVEIOPERM
+static int
+fbvga_setiopermissions(PSD psd)
+{
+	/* allow direct access to vga controller space*/
+	return ioperm(0x3c0, 0x20, 1);
+}
+#endif
+
+/* Init VGA controller, calc linelen and mmap size, return 0 on fail*/
+int
+ega_init(PSD psd)
+{
+#if HAVEIOPERM
+	if(fbvga_setiopermissions(psd) == -1) {
+		EPRINTF("Can't set i/o permissions: %m\n");
+		return 0;
+	}
+
+	/* 
+	 * Fill in entry point for applications to call to
+	 * regain i/o permissions.  This is required after 
+	 * calling pthreads_create because pthreads resets 
+	 * the i/o permissions after thread creation.
+	 * Note that this requires that systems using pthreads
+	 * and VGA16 framebuffer to run setuid root :-(
+	 */
+	psd->SetIOPermissions = fbvga_setiopermissions;
+#endif
+
+#if MSDOS | ELKS | __rtems__
+	/* fill in screendevice struct if not framebuffer driver*/
+	psd->addr = SCREENBASE;		/* long ptr -> short on 16bit sys*/
+	psd->linelen = BYTESPERLINE;
+#endif
+#if _MINIX
+	psd->addr = 0;			/* long ptr -> short on 16bit sys*/
+	psd->linelen = 80;
+#endif
+	/* framebuffer mmap size*/
+	psd->size = 0x10000;
+	/* Set up some default values for the VGA Graphics Registers. */
+	set_enable_sr (0x0f);
+	set_op (0);
+	set_mode (0);
+	return 1;
+}
+
+/* draw a pixel at x,y of color c*/
+void
+ega_drawpixel(PSD psd,unsigned int x, unsigned int y, MWPIXELVAL c)
+{
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+  
+	DRAWON;
+	set_op(mode_table[gr_mode]);
+	set_color (c);
+	select_and_set_mask (mask[x&7]);
+	RMW_FP ((FARADDR)SCREENBASE + (x>>3) + y * BYTESPERLINE);
+	DRAWOFF;
+}
+
+/* Return 4-bit pixel value at x,y*/
+MWPIXELVAL
+ega_readpixel(PSD psd,unsigned int x,unsigned int y)
+{
+	FARADDR		src;
+	int		plane;
+	MWPIXELVAL	c = 0;
+	
+	assert (x >= 0 && x < psd->xres);
+	assert (y >= 0 && y < psd->yres);
+  
+	DRAWON;
+#if _MINIX
+	src = (unsigned char *)(SCREENBASE + (x>>3) + y * BYTESPERLINE);
+#else
+	src = SCREENBASE + (x>>3) + y * BYTESPERLINE;
+#endif
+	for(plane=0; plane<4; ++plane) {
+		set_read_plane(plane);
+		if(GETBYTE_FP(src) & mask[x&7])
+			c |= 1 << plane;
+	}
+	DRAWOFF;
+	return c;
+}
+
+/* Draw horizontal line from x1,y to x2,y including final point*/
+void
+ega_drawhorzline(PSD psd, unsigned int x1, unsigned int x2, unsigned int y,
+	MWPIXELVAL c)
+{
+	FARADDR dst, last;
+
+	assert (x1 >= 0 && x1 < psd->xres);
+	assert (x2 >= 0 && x2 < psd->xres);
+	assert (x2 >= x1);
+	assert (y >= 0 && y < psd->yres);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	set_color (c);
+	set_op(mode_table[gr_mode]);
+	/*
+	* The following fast drawhline code is buggy for XOR drawing,
+	* for some reason.  So, we use the equivalent slower drawpixel
+	* method when not drawing MWMODE_SET.
+	*/
+	if(gr_mode == MWMODE_SET) {
+#if _MINIX
+		dst = (unsigned char *)(SCREENBASE + (x1>>3) + y*BYTESPERLINE);
+#else
+		dst = SCREENBASE + (x1>>3) + y * BYTESPERLINE;
+#endif
+		if ((x1>>3) == (x2>>3)) {
+			select_and_set_mask ((0xff >> (x1 & 7)) & (0xff << (7 - (x2 & 7))));
+			RMW_FP (dst);
+		} else {
+			select_and_set_mask (0xff >> (x1 & 7));
+			RMW_FP (dst++);
+
+			set_mask (0xff);
+#if _MINIX
+			last = (unsigned char *)(SCREENBASE + (x2>>3) + y * BYTESPERLINE);
+#else
+			last = SCREENBASE + (x2>>3) + y * BYTESPERLINE;
+#endif
+			while (dst < last)
+				PUTBYTE_FP(dst++, 1);
+
+			set_mask (0xff << (7 - (x2 & 7)));
+			RMW_FP (dst);
+		}
+	} else {
+		/* slower method, draw pixel by pixel*/
+		select_mask ();
+		while(x1 <= x2) {
+			set_mask (mask[x1&7]);
+			RMW_FP ((FARADDR)SCREENBASE + (x1++>>3) + y * BYTESPERLINE);
+		}
+	}
+	DRAWOFF;
+}
+
+/* Draw a vertical line from x,y1 to x,y2 including final point*/
+void
+ega_drawvertline(PSD psd,unsigned int x, unsigned int y1, unsigned int y2,
+	MWPIXELVAL c)
+{
+	FARADDR dst, last;
+
+	assert (x >= 0 && x < psd->xres);
+	assert (y1 >= 0 && y1 < psd->yres);
+	assert (y2 >= 0 && y2 < psd->yres);
+	assert (y2 >= y1);
+	assert (c < psd->ncolors);
+
+	DRAWON;
+	set_op(mode_table[gr_mode]);
+	set_color (c);
+	select_and_set_mask (mask[x&7]);
+#if _MINIX
+	dst = (unsigned char *)(SCREENBASE + (x>>3) + y1 * BYTESPERLINE);
+	last = (unsigned char *)(SCREENBASE + (x>>3) + y2 * BYTESPERLINE);
+#else
+	dst = SCREENBASE + (x>>3) + y1 * BYTESPERLINE;
+	last = SCREENBASE + (x>>3) + y2 * BYTESPERLINE;
+#endif
+	while (dst <= last) {
+		RMW_FP (dst);
+		dst += BYTESPERLINE;
+	}
+	DRAWOFF;
+}
+
+#if FBVGA
+SUBDRIVER vgaplan4 = {
+	(void *)ega_init,
+	(void *)ega_drawpixel,
+	(void *)ega_readpixel,
+	(void *)ega_drawhorzline,
+	(void *)ega_drawvertline,
+	(void *)gen_fillrect,
+	(void *)ega_blit
+};
+#endif /* FBVGA*/
diff -urN lib/microwindows/src/drivers/vgaplan4.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/vgaplan4.h
--- lib/microwindows/src/drivers/vgaplan4.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/vgaplan4.h	2005-02-21 16:13:11.000000000 +0100
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Header file for EGA/VGA 16 color 4 planes screen driver
+ * Added functions for Hercules access
+ *
+ */
+#define SLOWVGA		0	/* =1 for outb rather than outw instructions*/
+
+#ifdef __PACIFIC__
+#define HAVEBLIT	0
+#else
+#define HAVEBLIT	1	/* =0 to exclude blitting in vgaplan4 drivers*/
+#endif
+
+#if UNIX & !ELKS
+#define HAVEFARPTR	1
+#define FAR
+#endif
+
+#if LINUX
+#include <sys/io.h>		/* for outb def's, requires -O */
+/*#include <asm/io.h>*/		/* for outb def's on 2.3.x*/
+#define HAVEFARPTR	1
+#define FAR
+#define HAVEIOPERM	1	/* has ioperm() system call*/
+#endif
+
+#if MSDOS
+#define HAVEFARPTR	1	/* compiler has _far extension*/
+#ifdef __PACIFIC__
+#include <dos.h>
+#define FAR		far
+#else
+#define FAR		_far
+#endif
+#endif
+
+#if __rtems__
+#define HAVEFARPTR	1
+#define FAR
+#include <i386_io.h>
+#endif
+
+#if MSDOS | ELKS
+/* make far ptr*/
+#define MK_FP(seg,ofs)	((FARADDR)(((unsigned long)(seg) << 16) | (unsigned)(ofs)))
+#define EGA_BASE 	MK_FP(0xa000, 0)
+#else
+#define EGA_BASE 	((unsigned char *)0xa0000)
+#endif
+
+#if HAVEFARPTR
+/* far ptr access to screen*/
+typedef volatile unsigned char FAR * FARADDR;
+
+#if _MINIX
+/* get byte at address*/
+extern unsigned char GETBYTE_FP(FARADDR);
+
+/* put byte at address*/
+extern void PUTBYTE_FP(FARADDR,unsigned char);
+
+/* read-modify-write at address*/
+extern void RMW_FP(FARADDR);
+#else
+/* get byte at address*/
+#define GETBYTE_FP(addr)	(*(FARADDR)(addr))
+
+/* put byte at address*/
+#define PUTBYTE_FP(addr,val)	((*(FARADDR)(addr)) = (val))
+
+/* read-modify-write at address*/
+#define RMW_FP(addr)		((*(FARADDR)(addr)) |= 1)
+
+/* or byte at address*/
+#define ORBYTE_FP(addr,val)	((*(FARADDR)(addr)) |= (val))
+
+/* and byte at address*/
+#define ANDBYTE_FP(addr,val)	((*(FARADDR)(addr)) &= (val))
+#endif
+#else
+
+/* for bcc with no _far extension*/
+typedef unsigned long	FARADDR;
+
+/* get byte at address*/
+extern unsigned char GETBYTE_FP(FARADDR);
+
+/* put byte at address*/
+extern void PUTBYTE_FP(FARADDR,unsigned char);
+
+/* read-modify-write at address*/
+extern void RMW_FP(FARADDR);
+
+/* or byte at address*/
+extern void ORBYTE_FP(FARADDR,unsigned char);
+
+/* and byte at address*/
+extern void ANDBYTE_FP(FARADDR,unsigned char);
+#endif
+
+
+#if MSDOS
+#define outb(val,port)	outp(port,val)
+#endif
+
+#if ELKS
+#define outb(val,port)	outportb(port,val)
+#define outw(val,port)	outport(port,val)
+
+extern int  inportb(int port);
+extern void outportb(int port,unsigned char data);
+extern void outport(int port,int data);
+#endif
+
+/* external routines*/
+FARADDR		int10(int ax,int bx);
+
+/* external routines implementing planar ega/vga access*/
+
+/* vgaplan4.c portable C, asmplan4.s asm, or ELKS asm elkplan4.c driver*/
+int		ega_init(PSD psd);
+void 		ega_drawpixel(PSD psd,unsigned int x,unsigned int y,
+			MWPIXELVAL c);
+MWPIXELVAL 	ega_readpixel(PSD psd,unsigned int x,unsigned int y);
+void		ega_drawhorzline(PSD psd,unsigned int x1,unsigned int x2,
+			unsigned int y,MWPIXELVAL c);
+void		ega_drawvertline(PSD psd,unsigned int x,unsigned int y1,
+			unsigned int y2, MWPIXELVAL c);
+#if HAVEBLIT
+/* memplan4.c*/
+void	 	ega_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w,
+			MWCOORD h,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op);
+#endif
+
+/* vgainit.c - direct hw init*/
+void		ega_hwinit(void);
+void		ega_hwterm(void);
+
+#if _MINIX
+#define	outb(v, p)	outb(p, v)
+#define	outw(v, p)	outw(p, v)
+#endif
+
+#if SLOWVGA
+/* use outb rather than outw instructions for older, slower VGA's*/
+
+/* Program the Set/Reset Register for drawing in color COLOR for write
+   mode 0. */
+#define set_color(c)		{ outb (0, 0x3ce); outb (c, 0x3cf); }
+
+/* Set the Enable Set/Reset Register. */
+#define set_enable_sr(mask) { outb (1, 0x3ce); outb (mask, 0x3cf); }
+
+/* Select the Bit Mask Register on the Graphics Controller. */
+#define select_mask() 		{ outb (8, 0x3ce); }
+
+/* Program the Bit Mask Register to affect only the pixels selected in
+   MASK.  The Bit Mask Register must already have been selected with
+   select_mask (). */
+#define set_mask(mask)		{ outb (mask, 0x3cf); }
+
+#define select_and_set_mask(mask) { outb (8, 0x3ce); outb (mask, 0x3cf); }
+
+/* Set the Data Rotate Register.  Bits 0-2 are rotate count, bits 3-4
+   are logical operation (0=NOP, 1=AND, 2=OR, 3=XOR). */
+#define set_op(op) 		{ outb (3, 0x3ce); outb (op, 0x3cf); }
+
+/* Set the Memory Plane Write Enable register. */
+#define set_write_planes(mask) { outb (2, 0x3c4); outb (mask, 0x3c5); }
+
+/* Set the Read Map Select register. */
+#define set_read_plane(plane)	{ outb (4, 0x3ce); outb (plane, 0x3cf); }
+
+/* Set the Graphics Mode Register.  The write mode is in bits 0-1, the
+   read mode is in bit 3. */
+#define set_mode(mode) 		{ outb (5, 0x3ce); outb (mode, 0x3cf); }
+
+#else /* !SLOWVGA*/
+/* use outw rather than outb instructions for new VGAs*/
+
+/* Program the Set/Reset Register for drawing in color COLOR for write
+   mode 0. */
+#define set_color(c)		{ outw ((c)<<8, 0x3ce); }
+
+/* Set the Enable Set/Reset Register. */
+#define set_enable_sr(mask) 	{ outw (1|((mask)<<8), 0x3ce); }
+
+/* Select the Bit Mask Register on the Graphics Controller. */
+#define select_mask() 		{ outb (8, 0x3ce); }
+
+/* Program the Bit Mask Register to affect only the pixels selected in
+   MASK.  The Bit Mask Register must already have been selected with
+   select_mask (). */
+#define set_mask(mask)		{ outb (mask, 0x3cf); }
+
+#define select_and_set_mask(mask) { outw (8|((mask)<<8), 0x3ce); }
+
+/* Set the Data Rotate Register.  Bits 0-2 are rotate count, bits 3-4
+   are logical operation (0=NOP, 1=AND, 2=OR, 3=XOR). */
+#define set_op(op) 		{ outw (3|((op)<<8), 0x3ce); }
+
+/* Set the Memory Plane Write Enable register. */
+#define set_write_planes(mask) { outw (2|((mask)<<8), 0x3c4); }
+
+/* Set the Read Map Select register. */
+#define set_read_plane(plane)	{ outw (4|((plane)<<8), 0x3ce); }
+
+/* Set the Graphics Mode Register.  The write mode is in bits 0-1, the
+   read mode is in bit 3. */
+#define set_mode(mode) 		{ outw (5|((mode)<<8), 0x3ce); }
+
+#endif /* SLOWVGA*/
diff -urN lib/microwindows/src/drivers/vtswitch.1 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/vtswitch.1
--- lib/microwindows/src/drivers/vtswitch.1	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/vtswitch.1	2005-02-21 16:13:13.000000000 +0100
@@ -0,0 +1,217 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <linux/vt.h>
+#include "device.h"
+#include "fb.h"
+/*
+ * VT switch handling code for Linux
+ */
+
+/* signal to use when VT swithing*/
+#ifndef SIGUNUSED
+#define SIGUNUSED	SIGUSR1		/* some systems lack SIGUNUSED*/
+#endif
+
+#define SIGVTSWITCH	SIGUNUSED	/* SIGUSR2 is used by pthreads...*/
+
+int	mwvterm;		/* the VT we were started on */
+volatile int mwdrawing;		/* nonzero when drawing is happening*/
+static int mwcvt, mwocvt;
+static int ttyfd = -1;		/* /dev/tty0*/
+static int visible = 1;		/* VT visible flag*/
+static struct vt_mode mode;	/* terminal mode*/
+static SUBDRIVER save;		/* saved subdriver when VT switched*/
+
+extern SCREENDEVICE	scrdev;	//FIXME
+
+/* entry points*/
+int 	MwInitVt(void);
+int  	MwCurrentVt(void);
+int  	MwCheckVtChange(void);
+void 	MwRedrawVt(int t);
+
+/* local routines*/
+static void  	draw_enable(void);
+static void 	draw_disable(void);
+static void	vt_switch(int sig);
+
+/* null subdriver for drawing when switched out*/
+static void 	null_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c) {}
+static MWPIXELVAL null_readpixel(PSD psd,MWCOORD x, MWCOORD y) { return 0;}
+static void	null_drawhorzline(PSD psd,MWCOORD x1,MWCOORD x2,MWCOORD y,
+			MWPIXELVAL c) {}
+static void	null_drawvertline(PSD psd,MWCOORD x,MWCOORD y1,MWCOORD y2,
+			MWPIXELVAL c) {}
+static void	null_fillrect(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,
+			MWCOORD y2,MWPIXELVAL c) {}
+static void	null_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,
+			MWCOORD h,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,
+			long op) {}
+static void 	null_drawarea(PSD psd, driver_gc_t *gc, int op) {}
+static SUBDRIVER nulldriver = {
+	NULL,
+	null_drawpixel,
+	null_readpixel,
+	null_drawhorzline,
+	null_drawvertline,
+	null_fillrect,
+	null_blit,
+	null_drawarea
+};
+
+static void
+draw_enable(void)
+{
+	if(visible)
+		return;
+	visible = 1;
+
+	/* restore screen drawing functions*/
+	set_subdriver(&scrdev, &save, FALSE);
+}
+      
+static void
+draw_disable(void)
+{
+	if(!visible)
+		return;
+	visible = 0;
+
+	/* save screen drawing functions and reroute drawing*/
+	get_subdriver(&scrdev, &save);
+
+	/* set null driver*/
+	set_subdriver(&scrdev, &nulldriver, FALSE);
+}
+
+/* Signal handler called when kernel switches to or from our tty*/
+static void
+vt_switch(int sig)
+{
+    struct itimerval duration;
+    static unsigned short r[16], g[16], b[16];
+
+    signal(SIGVTSWITCH, vt_switch);
+
+    /* If a drawing function is in progress then we cannot mode
+     * switch right now because the drawing function would continue to
+     * scribble on the screen after the switch.  So disable further
+     * drawing and schedule an alarm to try again in .1 second.
+     */
+    if(mwdrawing) {
+    	draw_disable ();
+
+    	signal(SIGALRM, vt_switch);
+
+	duration.it_interval.tv_sec = 0;
+	duration.it_interval.tv_usec = 0;
+	duration.it_value.tv_sec = 0;
+	duration.it_value.tv_usec = 100000;
+    	setitimer (ITIMER_REAL, &duration, NULL);
+    	return;
+    }
+      
+    if(visible) {
+    	draw_disable ();
+	ioctl_getpalette(0, 16, r, g, b);
+
+	if(ioctl (ttyfd, VT_RELDISP, 1) == -1)
+	    EPRINTF("Error can't switch away from VT: %m\n");
+    } else {
+	ioctl_setpalette(0, 16, r, g, b);
+    	draw_enable ();
+      
+	if(ioctl (ttyfd, VT_RELDISP, VT_ACKACQ) == -1)
+		EPRINTF("Error can't acknowledge VT switch: %m\n");
+    }
+}
+
+/*
+ * Init VT switch catching code
+ * 	return 0 on success, -1 on error
+ */
+int
+MwInitVt(void)
+{
+	ttyfd = open("/dev/tty0", O_RDONLY);
+	if(ttyfd == -1)
+		return EPRINTF("Error can't open tty0: %m\n");
+	
+	/* setup new tty mode*/
+	if(ioctl (ttyfd, VT_GETMODE, &mode) == -1)
+		return EPRINTF("Error can't get VT mode: %m\n");
+
+	mode.mode = VT_PROCESS;
+	mode.relsig = SIGVTSWITCH;
+	mode.acqsig = SIGVTSWITCH;
+	signal (SIGVTSWITCH, vt_switch);
+	if(ioctl (ttyfd, VT_SETMODE, &mode) == -1)
+		return EPRINTF("Error can't set VT mode: %m\n");
+
+	mwcvt = mwocvt = mwvterm = MwCurrentVt();
+	/*
+	 * Note: this hack is required to get Linux
+	 * to orient virtual 0,0 with physical 0,0
+	 * I have no idea why this kluge is required...
+	 */
+	MwRedrawVt(mwvterm);
+
+	return 0;
+}
+
+/*
+ * This function is used to find out what the current active VT is.
+ */
+int
+MwCurrentVt(void)
+{
+	struct vt_stat stat;
+
+	ioctl(ttyfd, VT_GETSTATE, &stat);
+	return stat.v_active;
+}
+
+/*
+ * Check if our VT has changed.  Return 1 if so.
+ */
+int
+MwCheckVtChange(void)
+{
+	mwcvt = MwCurrentVt();
+	if(mwcvt != mwocvt && mwcvt == mwvterm) {
+		mwocvt = mwcvt;
+		return 1;
+	}
+	mwocvt = mwcvt;
+	return 0;
+}
+
+/*
+ * This function is used to cause a redraw of the text console.
+ * FIXME: Switching to another console and
+ * back works, but that's a really dirty hack
+ */
+void
+MwRedrawVt(int t)
+{
+	if(MwCurrentVt() == mwvterm) {
+		ioctl(ttyfd, VT_ACTIVATE, t == 1 ? 2 : 1); /* Awful hack!!*/
+		ioctl(ttyfd, VT_ACTIVATE, t);
+	}
+}
+
+void
+MwExitVt(void)
+{
+	signal(SIGVTSWITCH, SIG_DFL);
+	mode.mode = VT_AUTO;
+	mode.relsig = 0;
+	mode.acqsig = 0;
+	ioctl(ttyfd, VT_SETMODE, &mode);
+
+	if(ttyfd != -1)
+		close(ttyfd);
+}
diff -urN lib/microwindows/src/drivers/vtswitch.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/vtswitch.c
--- lib/microwindows/src/drivers/vtswitch.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/drivers/vtswitch.c	2005-02-21 16:13:11.000000000 +0100
@@ -0,0 +1,216 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <linux/vt.h>
+#include "device.h"
+#include "fb.h"
+/*
+ * VT switch handling code for Linux
+ */
+
+/* signal to use when VT swithing*/
+#ifndef SIGUNUSED
+#define SIGUNUSED	SIGUSR1		/* some systems lack SIGUNUSED*/
+#endif
+
+#define SIGVTSWITCH	SIGUNUSED	/* SIGUSR2 is used by pthreads...*/
+
+int	mwvterm;		/* the VT we were started on */
+volatile int mwdrawing;		/* nonzero when drawing is happening*/
+static int mwcvt, mwocvt;
+static int ttyfd = -1;		/* /dev/tty0*/
+static int visible = 1;		/* VT visible flag*/
+static struct vt_mode mode;	/* terminal mode*/
+static SUBDRIVER save;		/* saved subdriver when VT switched*/
+
+extern SCREENDEVICE	scrdev;	//FIXME
+
+/* entry points*/
+int 	MwInitVt(void);
+int  	MwCurrentVt(void);
+int  	MwCheckVtChange(void);
+void 	MwRedrawVt(int t);
+
+/* local routines*/
+static void  	draw_enable(void);
+static void 	draw_disable(void);
+static void	vt_switch(int sig);
+
+/* null subdriver for drawing when switched out*/
+static void 	null_drawpixel(PSD psd,MWCOORD x, MWCOORD y, MWPIXELVAL c) {}
+static MWPIXELVAL null_readpixel(PSD psd,MWCOORD x, MWCOORD y) { return 0;}
+static void	null_drawhorzline(PSD psd,MWCOORD x1,MWCOORD x2,MWCOORD y,
+			MWPIXELVAL c) {}
+static void	null_drawvertline(PSD psd,MWCOORD x,MWCOORD y1,MWCOORD y2,
+			MWPIXELVAL c) {}
+static void	null_fillrect(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,
+			MWCOORD y2,MWPIXELVAL c) {}
+static void	null_blit(PSD dstpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,
+			MWCOORD h,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,
+			long op) {}
+static void 	null_drawarea(PSD psd, driver_gc_t *gc, int op) {}
+static SUBDRIVER nulldriver = {
+	NULL,
+	null_drawpixel,
+	null_readpixel,
+	null_drawhorzline,
+	null_drawvertline,
+	null_fillrect,
+	null_blit,
+	null_drawarea
+};
+
+static void
+draw_enable(void)
+{
+	if(visible)
+		return;
+	visible = 1;
+
+	/* restore screen drawing functions*/
+	set_subdriver(&scrdev, &save, FALSE);
+}
+      
+static void
+draw_disable(void)
+{
+	if(!visible)
+		return;
+	visible = 0;
+
+	/* save screen drawing functions and reroute drawing*/
+	get_subdriver(&scrdev, &save);
+
+	/* set null driver*/
+	set_subdriver(&scrdev, &nulldriver, FALSE);
+}
+
+/* Timer handler used to do the VT switch at a time when not drawing */
+static void
+vt_do_switch(void *arg)
+{
+    static unsigned short r[16], g[16], b[16];
+
+    /*
+     * If a drawing function is in progress then we cannot mode
+     * switch right now because the drawing function would continue to
+     * scribble on the screen after the switch.  So disable further
+     * drawing and schedule an alarm to try again in .1 second.
+     */
+    if(mwdrawing) {
+    	draw_disable ();
+	GdAddTimer(100, vt_do_switch, NULL);
+    	return;
+    }
+      
+    if(visible) {
+    	draw_disable ();
+	ioctl_getpalette(0, 16, r, g, b);
+
+	if(ioctl (ttyfd, VT_RELDISP, 1) == -1)
+	    EPRINTF("Error can't switch away from VT: %m\n");
+    } else {
+	ioctl_setpalette(0, 16, r, g, b);
+    	draw_enable ();
+      
+	if(ioctl (ttyfd, VT_RELDISP, VT_ACKACQ) == -1)
+		EPRINTF("Error can't acknowledge VT switch: %m\n");
+    }
+}
+
+/* Signal handler called when kernel switches to or from our tty*/
+static void
+vt_switch(int sig)
+{
+	signal(SIGVTSWITCH, vt_switch);
+	vt_do_switch(NULL);
+}
+
+/*
+ * Init VT switch catching code
+ * 	return 0 on success, -1 on error
+ */
+int
+MwInitVt(void)
+{
+	ttyfd = open("/dev/tty0", O_RDONLY);
+	if(ttyfd == -1)
+		return EPRINTF("Error can't open tty0: %m\n");
+	
+	/* setup new tty mode*/
+	if(ioctl (ttyfd, VT_GETMODE, &mode) == -1)
+		return EPRINTF("Error can't get VT mode: %m\n");
+
+	mode.mode = VT_PROCESS;
+	mode.relsig = SIGVTSWITCH;
+	mode.acqsig = SIGVTSWITCH;
+	signal (SIGVTSWITCH, vt_switch);
+	if(ioctl (ttyfd, VT_SETMODE, &mode) == -1)
+		return EPRINTF("Error can't set VT mode: %m\n");
+
+	mwcvt = mwocvt = mwvterm = MwCurrentVt();
+	/*
+	 * Note: this hack is required to get Linux
+	 * to orient virtual 0,0 with physical 0,0
+	 * I have no idea why this kluge is required...
+	 */
+	MwRedrawVt(mwvterm);
+
+	return 0;
+}
+
+/*
+ * This function is used to find out what the current active VT is.
+ */
+int
+MwCurrentVt(void)
+{
+	struct vt_stat stat;
+
+	ioctl(ttyfd, VT_GETSTATE, &stat);
+	return stat.v_active;
+}
+
+/*
+ * Check if our VT has changed.  Return 1 if so.
+ */
+int
+MwCheckVtChange(void)
+{
+	mwcvt = MwCurrentVt();
+	if(mwcvt != mwocvt && mwcvt == mwvterm) {
+		mwocvt = mwcvt;
+		return 1;
+	}
+	mwocvt = mwcvt;
+	return 0;
+}
+
+/*
+ * This function is used to cause a redraw of the text console.
+ * FIXME: Switching to another console and
+ * back works, but that's a really dirty hack
+ */
+void
+MwRedrawVt(int t)
+{
+	if(MwCurrentVt() == mwvterm) {
+		ioctl(ttyfd, VT_ACTIVATE, t == 1 ? 2 : 1); /* Awful hack!!*/
+		ioctl(ttyfd, VT_ACTIVATE, t);
+	}
+}
+
+void
+MwExitVt(void)
+{
+	signal(SIGVTSWITCH, SIG_DFL);
+	mode.mode = VT_AUTO;
+	mode.relsig = 0;
+	mode.acqsig = 0;
+	ioctl(ttyfd, VT_SETMODE, &mode);
+
+	if(ttyfd != -1)
+		close(ttyfd);
+}
diff -urN lib/microwindows/src/engine/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/Makefile
--- lib/microwindows/src/engine/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/Makefile	2005-02-21 16:13:15.000000000 +0100
@@ -0,0 +1,61 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME = libmwengine.a
+LIBNAMESO = libmwengine.so
+
+# List of objects to compile
+OBJS =	devopen.o devdraw.o devfont.o devmouse.o devkbd.o devclip.o devrgn.o \
+	devpal1.o devpal2.o devimage.o devlist.o selfont.o error.o \
+	devrgn2.o devarc.o
+
+ifeq ($(ECOS),Y)
+
+else
+
+ifeq ($(UNIX), Y)
+OBJS += devtimer.o
+endif
+
+endif
+
+ifneq ($(FREETYPE_FONTS_DIR), )
+CFLAGS += -DFREETYPE_FONTS_DIR="\"$(FREETYPE_FONTS_DIR)"\"
+endif
+
+ifneq ($(ARCH), ELKS)
+OBJS += devpal8.o
+endif
+
+ifeq ($(GRAYPALETTE), Y)
+OBJS += devpalgray4.o
+else
+OBJS += devpal4.o
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
diff -urN lib/microwindows/src/engine/devarc.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devarc.c
--- lib/microwindows/src/engine/devarc.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devarc.c	2005-02-21 16:13:13.000000000 +0100
@@ -0,0 +1,606 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Device-independent arc, pie and ellipse routines.
+ * GdArc is integer only and requires start/end points.
+ * GdArcAngle requires floating point and uses angles.
+ * GdArcAngle uses qsin() and qcos() instead of sin() / cos() 
+ * so no math lib needed.
+ *
+ * Portions Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Line clipping portions used from GPL software by
+ * Copyright (C) 1997-1998 by Eero Tamminen
+ * Copyright (C) 1994-1997 by Torsten Scherer, Kay Roemer and Eero Tamminen
+ * Heavily bugfixed by Greg Haerr
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * NOTES
+ */
+
+#include <stdio.h>
+#include "device.h"
+
+#if HAVEFLOAT			/* =1 compiles in GdArcAngle*/
+#define HIGHPRECISION	0	/* =1 for high precision angles, uses mathlib*/
+
+#if !HIGHPRECISION
+typedef float	FLOAT;
+/*
+ * qsin/qcos - calculate sin() and cos() approximations from a lookup table
+ *
+ * This uses a cosine lookup table of 0-90 degrees at one degree steps
+ * with the difference between successive values used for interpolation.
+ * The achieved accuracy should be about +/-0.0001.  If you want more
+ * accuracy, use doubles and smaller steps.  If you want more speed, use
+ * fixed point arithmetics.
+ */
+static float cosine[91][2] = {
+	{ 1.000000, -1.523048e-04 },
+	{ 0.999848, -4.568681e-04 },
+	{ 0.999391, -7.612923e-04 },
+	{ 0.998630, -1.065484e-03 },
+	{ 0.997564, -1.369352e-03 },
+	{ 0.996195, -1.672803e-03 },
+	{ 0.994522, -1.975744e-03 },
+	{ 0.992546, -2.278083e-03 },
+	{ 0.990268, -2.579728e-03 },
+	{ 0.987688, -2.880588e-03 },
+	{ 0.984808, -3.180570e-03 },
+	{ 0.981627, -3.479583e-03 },
+	{ 0.978148, -3.777536e-03 },
+	{ 0.974370, -4.074339e-03 },
+	{ 0.970296, -4.369900e-03 },
+	{ 0.965926, -4.664130e-03 },
+	{ 0.961262, -4.956940e-03 },
+	{ 0.956305, -5.248240e-03 },
+	{ 0.951057, -5.537941e-03 },
+	{ 0.945519, -5.825955e-03 },
+	{ 0.939693, -6.112194e-03 },
+	{ 0.933580, -6.396572e-03 },
+	{ 0.927184, -6.679001e-03 },
+	{ 0.920505, -6.959396e-03 },
+	{ 0.913545, -7.237671e-03 },
+	{ 0.906308, -7.513741e-03 },
+	{ 0.898794, -7.787522e-03 },
+	{ 0.891007, -8.058931e-03 },
+	{ 0.882948, -8.327886e-03 },
+	{ 0.874620, -8.594303e-03 },
+	{ 0.866025, -8.858103e-03 },
+	{ 0.857167, -9.119205e-03 },
+	{ 0.848048, -9.377528e-03 },
+	{ 0.838671, -9.632995e-03 },
+	{ 0.829038, -9.885528e-03 },
+	{ 0.819152, -1.013505e-02 },
+	{ 0.809017, -1.038148e-02 },
+	{ 0.798636, -1.062476e-02 },
+	{ 0.788011, -1.086479e-02 },
+	{ 0.777146, -1.110152e-02 },
+	{ 0.766044, -1.133486e-02 },
+	{ 0.754710, -1.156475e-02 },
+	{ 0.743145, -1.179112e-02 },
+	{ 0.731354, -1.201390e-02 },
+	{ 0.719340, -1.223302e-02 },
+	{ 0.707107, -1.244841e-02 },
+	{ 0.694658, -1.266001e-02 },
+	{ 0.681998, -1.286775e-02 },
+	{ 0.669131, -1.307158e-02 },
+	{ 0.656059, -1.327142e-02 },
+	{ 0.642788, -1.346722e-02 },
+	{ 0.629320, -1.365892e-02 },
+	{ 0.615661, -1.384645e-02 },
+	{ 0.601815, -1.402977e-02 },
+	{ 0.587785, -1.420882e-02 },
+	{ 0.573576, -1.438353e-02 },
+	{ 0.559193, -1.455387e-02 },
+	{ 0.544639, -1.471977e-02 },
+	{ 0.529919, -1.488119e-02 },
+	{ 0.515038, -1.503807e-02 },
+	{ 0.500000, -1.519038e-02 },
+	{ 0.484810, -1.533806e-02 },
+	{ 0.469472, -1.548106e-02 },
+	{ 0.453990, -1.561935e-02 },
+	{ 0.438371, -1.575289e-02 },
+	{ 0.422618, -1.588162e-02 },
+	{ 0.406737, -1.600551e-02 },
+	{ 0.390731, -1.612454e-02 },
+	{ 0.374607, -1.623864e-02 },
+	{ 0.358368, -1.634781e-02 },
+	{ 0.342020, -1.645199e-02 },
+	{ 0.325568, -1.655116e-02 },
+	{ 0.309017, -1.664529e-02 },
+	{ 0.292372, -1.673435e-02 },
+	{ 0.275637, -1.681831e-02 },
+	{ 0.258819, -1.689715e-02 },
+	{ 0.241922, -1.697084e-02 },
+	{ 0.224951, -1.703936e-02 },
+	{ 0.207912, -1.710270e-02 },
+	{ 0.190809, -1.716082e-02 },
+	{ 0.173648, -1.721371e-02 },
+	{ 0.156434, -1.726136e-02 },
+	{ 0.139173, -1.730376e-02 },
+	{ 0.121869, -1.734088e-02 },
+	{ 0.104528, -1.737272e-02 },
+	{ 0.087156, -1.739927e-02 },
+	{ 0.069756, -1.742052e-02 },
+	{ 0.052336, -1.743646e-02 },
+	{ 0.034899, -1.744709e-02 },
+	{ 0.017452, -1.745241e-02 },
+	{ 0.000000, -1.745241e-02 }
+};
+
+static float
+qcos(FLOAT angle)
+{
+	short a, b, c;
+
+	a = angle;
+	if (a < 0) {
+		angle = a - angle;
+		a = -a;
+	} else {
+		angle = angle - a;
+	}
+	b = a / 90;
+	c = a - b * 90;
+
+	/* interpolate according to angle */
+	switch(b&3) {
+		case 3:
+			c = 90 - c;
+			return cosine[c][0] - cosine[c-1][1] * angle;
+		case 2:
+			return -(cosine[c][0] + cosine[c][1] * angle);
+		case 1:
+			c = 90 - c;
+			return cosine[c-1][1] * angle - cosine[c][0];
+		default:
+			return cosine[c][0] + cosine[c][1] * angle;
+	}
+}
+
+static float
+qsin(FLOAT angle)
+{
+	short a, b, c;
+
+	/* change to cosine by subtracting 90 */
+	a = (int)angle - 90;
+	if (a < 0) {
+		angle = (a + 90) - angle;
+		a = -a;
+	} else {
+		angle = angle - (a + 90);
+	}
+	b = a / 90;
+	c = a - b * 90;
+
+	/* interpolate according to angle */
+	switch(b&3) {
+		case 3:
+			c = 90 - c;
+			return cosine[c][0] - cosine[c-1][1] * angle;
+		case 2:
+			return -(cosine[c][0] + cosine[c][1] * angle);
+		case 1:
+			c = 90 - c;
+			return cosine[c-1][1] * angle - cosine[c][0];
+		default:
+			return cosine[c][0] + cosine[c][1] * angle;
+	}
+}
+#else /* HIGHPRECISION*/
+
+#include <math.h>
+#define qcos	QCOS
+#define qsin	QSIN
+typedef double	FLOAT;
+
+FLOAT QCOS(FLOAT a)
+{
+	return cos(a * M_PI / 180.);
+}
+
+FLOAT QSIN(FLOAT a)
+{
+	return sin(a * M_PI / 180.);
+}
+#endif /* HIGHPRECISION*/
+#endif /* HAVEFLOAT*/
+
+/* 
+ * Draw an arc or pie, angles are specified in 64th's of a degree.
+ * This function requires floating point, use GdArc for integer only.
+ */
+void
+GdArcAngle(PSD psd, MWCOORD x0, MWCOORD y0, MWCOORD rx, MWCOORD ry,
+	MWCOORD angle1, MWCOORD angle2, int type)
+{
+#if HAVEFLOAT
+	MWCOORD	ax, ay, bx, by;
+	FLOAT	a, b;
+
+	/* calculate pie edge offsets from center to the ellipse rim */
+	ax = qcos(angle1/64.) * rx;
+	bx = qcos(angle2/64.) * rx;
+
+	a = -qsin(angle1/64.);
+	b = -qsin(angle2/64.);
+	ay = a * ry;
+	by = b * ry;
+
+	/* call integer routine*/
+	GdArc(psd, x0, y0, rx, ry, ax, ay, bx, by, type);
+#endif /* HAVEFLOAT*/
+}
+
+/* argument holder for pie, arc and ellipse functions*/
+typedef struct {
+	PSD	psd;
+	MWCOORD	x0, y0;
+	MWCOORD	rx, ry;
+	MWCOORD	ax, ay;
+	MWCOORD	bx, by;
+	int	adir, bdir;
+	int	type;
+} SLICE;
+
+extern void drawpoint(PSD psd, MWCOORD x, MWCOORD y);
+extern void drawrow(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y);
+
+/*
+ * Clip a line segment for arc or pie drawing.
+ * Returns 0 if line is clipped or on acceptable side, 1 if it's vertically
+ * on other side, otherwise 3.
+ */
+static int
+clip_line(SLICE *slice, MWCOORD xe, MWCOORD ye, int dir, MWCOORD y, MWCOORD *x0,
+	MWCOORD *x1)
+{
+#if 0
+	/*
+	 * kluge: handle 180 degree case
+	 */
+	if (y >= 0 && ye == 0) {
+/*printf("cl %d,%d %d,%d %d,%d %d,%d %d,%d\n", xe, ye, y, dir,
+slice->ax, slice->ay, slice->bx, slice->by, slice->adir, slice->bdir);*/
+		/* bottom 180*/
+		if (slice->adir < 0) {
+			if (slice->ay || slice->by)
+				return 1;
+			if (slice->ax == -slice->bx)
+				return 0;
+		}
+		return 3;
+	}
+#endif
+	/* hline on the same vertical side with the given edge? */
+	if ((y >= 0 && ye >= 0) || (y < 0 && ye < 0)) {
+		MWCOORD x;
+
+		if (ye == 0) x = xe; else
+		x = (MWCOORD)(long)xe * y / ye;
+
+		if (x >= *x0 && x <= *x1) {
+			if (dir > 0)
+				*x0 = x;
+			else
+				*x1 = x;
+			return 0;
+		} else {
+			if (dir > 0) {
+				if (x <= *x0)
+					return 0;
+			} else {
+				if (x >= *x1)
+					return 0;
+			}
+		}
+		return 3;
+	}
+	return 1;
+}
+
+/* relative offsets, direction from left to right. */
+static void
+draw_line(SLICE *slice, MWCOORD x0, MWCOORD y, MWCOORD x1)
+{
+	int	dbl = (slice->adir > 0 && slice->bdir < 0);
+	int 	discard, ret;
+	MWCOORD	x2 = x0, x3 = x1;
+
+	if (y == 0) {
+		if (slice->type != MWPIE)
+			return;
+		/* edges on different sides */
+		if ((slice->ay <= 0 && slice->by >= 0) ||
+		    (slice->ay >= 0 && slice->by <= 0)) {
+			if (slice->adir < 0)  {
+				if (x1 > 0)
+					x1 = 0;
+			}
+			if (slice->bdir > 0) {
+				if (x0 < 0)
+					x0 = 0;
+			}
+		} else {
+			if (!dbl) {
+				/* FIXME leaving in draws dot in center*/
+				drawpoint(slice->psd, slice->x0, slice->y0);
+				return;
+			}
+		}
+		drawrow(slice->psd, slice->x0 + x0, slice->x0 + x1, slice->y0);
+		return;
+	}
+
+	/* clip left edge / line */
+	ret = clip_line(slice, slice->ax, slice->ay, slice->adir, y, &x0, &x1);
+
+	if (dbl) {
+		if (!ret) {
+			/* edges separate line to two parts */
+			drawrow(slice->psd, slice->x0 + x0, slice->x0 + x1,
+				slice->y0 + y);
+			x0 = x2;
+			x1 = x3;
+		}
+	} else {
+		if (ret > 1) {
+			return;
+		}
+	}
+
+	discard = ret;
+	ret = clip_line(slice, slice->bx, slice->by, slice->bdir, y, &x0, &x1);
+
+	discard += ret;
+	if (discard > 2 && !(dbl && ret == 0 && discard == 3)) {
+		return;
+	}
+	if (discard == 2) {
+		/* line on other side than slice */
+		if (slice->adir < 0 || slice->bdir > 0) {
+			return;
+		}
+	}
+	drawrow(slice->psd, slice->x0 + x0, slice->x0 + x1, slice->y0 + y);
+}
+
+/* draw one line segment or set of points, called from drawarc routine*/
+static void
+drawarcsegment(SLICE *slice, MWCOORD xp, MWCOORD yp)
+{
+	switch (slice->type) {
+	case MWELLIPSEFILL:
+		/* draw ellipse fill segment*/
+		drawrow(slice->psd, slice->x0-xp, slice->x0+xp, slice->y0-yp);
+		drawrow(slice->psd, slice->x0-xp, slice->x0+xp, slice->y0+yp);
+		return;
+
+	case MWELLIPSE:
+		/* set four points symmetrically situated around a point*/
+		drawpoint(slice->psd, slice->x0 + xp, slice->y0 + yp);
+		drawpoint(slice->psd, slice->x0 - xp, slice->y0 + yp);
+		drawpoint(slice->psd, slice->x0 + xp, slice->y0 - yp);
+		drawpoint(slice->psd, slice->x0 - xp, slice->y0 - yp);
+		return;
+
+	case MWPIE:
+		/* draw top and bottom halfs of pie*/
+		draw_line(slice, -xp, -yp, +xp);
+		draw_line(slice, -xp, +yp, +xp);
+		return;
+
+	default:	/* MWARC, MWARCOUTLINE*/
+		/* set four points symmetrically around a point and clip*/
+		draw_line(slice, +xp, +yp, +xp);
+		draw_line(slice, -xp, +yp, -xp);
+		draw_line(slice, +xp, -yp, +xp);
+		draw_line(slice, -xp, -yp, -xp);
+		return;
+	}
+}
+
+/* General routine to plot points on an arc.  Used by arc, pie and ellipse*/
+static void
+drawarc(SLICE *slice)
+{
+	MWCOORD xp, yp;		/* current point (based on center) */
+	MWCOORD rx, ry;
+	long Asquared;		/* square of x semi axis */
+	long TwoAsquared;
+	long Bsquared;		/* square of y semi axis */
+	long TwoBsquared;
+	long d;
+	long dx, dy;
+
+	rx = slice->rx;
+	ry = slice->ry;
+
+	xp = 0;
+	yp = ry;
+	Asquared = rx * rx;
+	TwoAsquared = 2 * Asquared;
+	Bsquared = ry * ry;
+	TwoBsquared = 2 * Bsquared;
+	d = Bsquared - Asquared * ry + (Asquared >> 2);
+	dx = 0;
+	dy = TwoAsquared * ry;
+
+	while (dx < dy) {
+		drawarcsegment(slice, xp, yp);
+		if (d > 0) {
+			yp--;
+			dy -= TwoAsquared;
+			d -= dy;
+		}
+		xp++;
+		dx += TwoBsquared;
+		d += (Bsquared + dx);
+	}
+
+	d += ((3L * (Asquared - Bsquared) / 2L - (dx + dy)) >> 1);
+
+	while (yp >= 0) {
+		drawarcsegment(slice, xp, yp);
+		if (d < 0) {
+			xp++;
+			dx += TwoBsquared;
+			d += dx;
+		}
+		yp--;
+		dy -= TwoAsquared;
+		d += (Asquared - dy);
+	}
+
+}
+
+/* 
+ * Draw an arc or pie using start/end points.
+ * Integer only routine.  To specify start/end angles, 
+ * use GdArcAngle, which requires floating point.
+ */
+void
+GdArc(PSD psd, MWCOORD x0, MWCOORD y0, MWCOORD rx, MWCOORD ry,
+	MWCOORD ax, MWCOORD ay, MWCOORD bx, MWCOORD by, int type)
+{
+	MWCOORD	adir, bdir;
+	SLICE	slice;
+
+	if (rx <= 0 || ry <= 0)
+		return;
+
+	/*
+	 * Calculate right/left side clipping, based on quadrant.
+	 * dir is positive when right side is filled and negative when
+	 * left side is to be filled.
+	 *
+	 * >= 0 is bottom half
+	 */
+	if (ay >= 0)
+		adir = 1;
+	else
+		adir = -1;
+
+	if (by >= 0)
+		bdir = -1;
+	else
+		bdir = 1;
+
+	/*
+	 * The clip_line routine has problems around the 0 and
+	 * 180 degree axes.
+	 * This <fix> is required to make the clip_line algorithm
+	 * work.  Getting these routines to work for all angles is
+	 * a bitch.  And they're still buggy.  Doing this causes
+	 * half circles to be outlined with a slightly bent line
+	 * on the x axis. FIXME
+	 */
+	if (ay == 0) ++ay;
+	if (by == 0) ++by;
+
+	/* swap rightmost edge first */
+	if (bx > ax) {
+		MWCOORD swap;
+
+		swap = ax;
+		ax = bx;
+		bx = swap;
+
+		swap = ay;
+		ay = by;
+		by = swap;
+
+		swap = adir;
+		adir = bdir;
+		bdir = swap;
+	}
+
+	/* check for entire area clipped, draw with per-point clipping*/
+	if (GdClipArea(psd, x0-rx, y0-ry, x0+rx, y0+ry) == CLIP_INVISIBLE)
+		return;
+
+	slice.psd = psd;
+	slice.x0 = x0;
+	slice.y0 = y0;
+	slice.rx = rx;
+	slice.ry = ry;
+	slice.ax = ax;
+	slice.ay = ay;
+	slice.bx = bx;
+	slice.by = by;
+	slice.adir = adir;
+	slice.bdir = bdir;
+	slice.type = type;
+
+	drawarc(&slice);
+
+	if (type & MWOUTLINE) {
+		/* draw two lines from rx,ry to arc endpoints*/
+		GdLine(psd, x0, y0, x0+ax, y0+ay, TRUE);
+		GdLine(psd, x0, y0, x0+bx, y0+by, TRUE);
+	}
+
+	GdFixCursor(psd);
+}
+
+/*
+ * Draw an ellipse using the current clipping region and foreground color.
+ * This draws in the outline of the ellipse, or fills it.
+ * Integer only routine.
+ */
+void
+GdEllipse(PSD psd, MWCOORD x, MWCOORD y, MWCOORD rx, MWCOORD ry, MWBOOL fill)
+{
+	SLICE	slice;
+
+	if (rx < 0 || ry < 0)
+		return;
+
+	/* Check if the ellipse bounding box is either totally visible
+	 * or totally invisible.  Draw with per-point clipping.
+	 */
+	switch (GdClipArea(psd, x - rx, y - ry, x + rx, y + ry)) {
+	case CLIP_VISIBLE:
+		/*
+		 * For size considerations, there's no low-level ellipse
+		 * draw, so we've got to draw all ellipses
+		 * with per-point clipping for the time being
+		psd->DrawEllipse(psd, x, y, rx, ry, fill, gr_foreground);
+		GdFixCursor(psd);
+		return;
+		 */
+		break;
+
+	case CLIP_INVISIBLE:
+		return;
+  	}
+
+	slice.psd = psd;
+	slice.x0 = x;
+	slice.y0 = y;
+	slice.rx = rx;
+	slice.ry = ry;
+	slice.type = fill? MWELLIPSEFILL: MWELLIPSE;
+	/* other elements unused*/
+
+	drawarc(&slice);
+
+	GdFixCursor(psd);
+}
diff -urN lib/microwindows/src/engine/devclip.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devclip.c
--- lib/microwindows/src/engine/devclip.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devclip.c	2005-02-21 16:03:20.000000000 +0100
@@ -0,0 +1,7 @@
+#include "device.h"
+
+#if DYNAMICREGIONS
+#include "devclip2.c"
+#else
+#include "devclip1.c"
+#endif
diff -urN lib/microwindows/src/engine/devclip1.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devclip1.c
--- lib/microwindows/src/engine/devclip1.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devclip1.c	2005-02-21 16:03:20.000000000 +0100
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Device-independent routines to determine clipping regions.
+ */
+#include "device.h"
+
+/* Clip cache rectangle information.
+ * After calling GdClipPoint, this rectangle is guaranteed to contain the
+ * specified point (among others), and all points in the rectangle are
+ * plottable or not according to the value of clipresult.
+ */
+MWCOORD clipminx;		/* minimum x value of cache rectangle */
+MWCOORD clipminy;		/* minimum y value of cache rectangle */
+MWCOORD clipmaxx;		/* maximum x value of cache rectangle */
+MWCOORD clipmaxy;		/* maximum y value of cache rectangle */
+
+static MWBOOL	clipresult;	/* whether clip rectangle is plottable */
+int 	clipcount;		/* number of clip rectangles */
+MWCLIPRECT cliprects[MAX_CLIPRECTS];	/* clip rectangles */
+
+/*
+ * Set an array of clip rectangles for future drawing actions.
+ * Each pixel will be drawn only if lies in one or more of the specified
+ * clip rectangles.  As a special case, specifying no rectangles implies
+ * clipping is for the complete screen.  All clip rectangles are modified
+ * if necessary to lie within the device area.  Call only after device
+ * has been initialized.
+ */
+void
+GdSetClipRects(PSD psd,int count, MWCLIPRECT *table)
+{
+  register MWCLIPRECT *rp;		/* current rectangle */
+
+  /* If there are no clip rectangles, then default to the full device area. */
+  if (count <= 0) {
+	clipminx = 0;
+	clipminy = 0;
+	clipmaxx = psd->xvirtres - 1;
+	clipmaxy = psd->yvirtres - 1;
+	clipcount = 0;
+	clipresult = TRUE;
+	return;
+  }
+
+  /* Copy the clip table to our own static array, modifying each
+   * rectangle as necesary to fit within the device area.  If the clip
+   * rectangle lies entirely outside of the device area, then skip it.
+   */
+  rp = cliprects;
+  clipcount = 0;
+  if (count > MAX_CLIPRECTS) count = MAX_CLIPRECTS;
+  while (count-- > 0) {
+	*rp = *table++;
+	if (rp->x < 0) {
+		rp->width += rp->x;
+		rp->x = 0;
+	}
+	if (rp->y < 0) {
+		rp->height += rp->y;
+		rp->y = 0;
+	}
+	if ((rp->x >= psd->xvirtres) || (rp->width <= 0) ||
+	    (rp->y >= psd->yvirtres) || (rp->height <= 0))
+		continue;
+	if (rp->x + rp->width > psd->xvirtres)
+		rp->width = psd->xvirtres - rp->x;
+	if (rp->y + rp->height > psd->yvirtres)
+		rp->height = psd->yvirtres - rp->y;
+	rp++;
+	clipcount++;
+  }
+
+  /* If there were no surviving clip rectangles, then set the clip
+   * cache to prevent all drawing.
+   */
+  if (clipcount == 0) {
+	clipminx = MIN_MWCOORD;
+	clipminy = MIN_MWCOORD;
+	clipmaxx = MAX_MWCOORD;
+	clipmaxy = MAX_MWCOORD;
+	clipresult = FALSE;
+	return;
+  }
+
+  /* There was at least one valid clip rectangle. Default the clip
+   * cache to be the first clip rectangle.
+   */
+  clipminx = cliprects[0].x;
+  clipminy = cliprects[0].y;
+  clipmaxx = clipminx + cliprects[0].width - 1;
+  clipmaxy = clipminy + cliprects[0].height - 1;
+  clipresult = TRUE;
+}
+
+
+/* Check a point against the list of clip rectangles.
+ * Returns TRUE if the point is within one or more rectangles and thus
+ * can be plotted, or FALSE if the point is not within any rectangle and
+ * thus cannot be plotted.  Also remembers the coordinates of a clip cache
+ * rectangle containing the specified point such that every point in the
+ * rectangle would give the same result.  By examining this clip cache
+ * rectangle after a call to this routine, the caller can efficiently
+ * check many nearby points without needing any further calls.  If the
+ * point lies within the cursor, then the cursor is removed.
+ */
+MWBOOL
+GdClipPoint(PSD psd,MWCOORD x,MWCOORD y)
+{
+  int count;
+  MWCLIPRECT *rp;
+  MWCOORD temp;
+
+  /* First see whether the point lies within the current clip cache
+   * rectangle.  If so, then we already know the result.
+   */
+  if ((x >= clipminx) && (x <= clipmaxx) &&
+      (y >= clipminy) && (y <= clipmaxy)) {
+	if (clipresult) GdCheckCursor(psd, x, y, x, y);
+	return clipresult;
+  }
+
+  /* If the point is outside of the screen area, then it is not
+   * plottable, and the clip cache rectangle is the whole half-plane
+   * outside of the screen area.
+   */
+  if (x < 0) {
+	clipminx = MIN_MWCOORD;
+	clipmaxx = -1;
+	clipminy = MIN_MWCOORD;
+	clipmaxy = MAX_MWCOORD;
+	clipresult = FALSE;
+	return FALSE;
+  }
+  if (y < 0) {
+	clipminx = MIN_MWCOORD;
+	clipmaxx = MAX_MWCOORD;
+	clipminy = MIN_MWCOORD;
+	clipmaxy = -1;
+	clipresult = FALSE;
+	return FALSE;
+  }
+  if (x >= psd->xvirtres) {
+	clipminx = psd->xvirtres;
+	clipmaxx = MAX_MWCOORD;
+	clipminy = MIN_MWCOORD;
+	clipmaxy = MAX_MWCOORD;
+	clipresult = FALSE;
+	return FALSE;
+  }
+  if (y >= psd->yvirtres) {
+	clipminx = MIN_MWCOORD;
+	clipmaxx = MAX_MWCOORD;
+	clipminy = psd->yvirtres;
+	clipmaxy = MAX_MWCOORD;
+	clipresult = FALSE;
+	return FALSE;
+  }
+
+  /* The point is within the screen area. If there are no clip
+   * rectangles, then the point is plottable and the rectangle is the
+   * whole screen.
+   */
+  count = clipcount;
+  if (count <= 0) {
+	clipminx = 0;
+	clipmaxx = psd->xvirtres - 1;
+	clipminy = 0;
+	clipmaxy = psd->yvirtres - 1;
+	clipresult = TRUE;
+	GdCheckCursor(psd, x, y, x, y);
+	return TRUE;
+  }
+
+  /* We need to scan the list of clip rectangles to calculate a new
+   * clip cache rectangle containing this point, and the result. First
+   * see if the point lies within any of the clip rectangles. If so,
+   * then it is plottable and use that clip rectangle as the cache
+   * rectangle.  This is not necessarily the best result, but works ok
+   * and is fast.
+   */
+  for (rp = cliprects; count-- > 0; rp++) {
+	if ((x >= rp->x) && (y >= rp->y) && (x < rp->x + rp->width)
+	    && (y < rp->y + rp->height)) {
+		clipminx = rp->x;
+		clipminy = rp->y;
+		clipmaxx = rp->x + rp->width - 1;
+		clipmaxy = rp->y + rp->height - 1;
+		clipresult = TRUE;
+		GdCheckCursor(psd, x, y, x, y);
+		return TRUE;
+	}
+  }
+
+  /* The point is not plottable. Scan the clip rectangles again to
+   * determine a rectangle containing more non-plottable points.
+   * Simply pick the largest rectangle whose area doesn't contain any
+   * of the same coordinates as appropriate sides of the clip
+   * rectangles.  This is not necessarily the best result, but works ok
+   * and is fast.
+   */
+  clipminx = MIN_MWCOORD;
+  clipminy = MIN_MWCOORD;
+  clipmaxx = MAX_MWCOORD;
+  clipmaxy = MAX_MWCOORD;
+  count = clipcount;
+  for (rp = cliprects; count-- > 0; rp++) {
+	if ((x < rp->x) && (rp->x <= clipmaxx)) clipmaxx = rp->x - 1;
+	temp = rp->x + rp->width - 1;
+	if ((x > temp) && (temp >= clipminx)) clipminx = temp + 1;
+	if ((y < rp->y) && (rp->y <= clipmaxy)) clipmaxy = rp->y - 1;
+	temp = rp->y + rp->height - 1;
+	if ((y > temp) && (temp >= clipminy)) clipminy = temp + 1;
+  }
+  clipresult = FALSE;
+  return FALSE;
+}
+
+
+/* Check the area determined by the specified pair of points against the
+ * list of clip rectangles.  The area will either be totally visible,
+ * totally visible, or possibly partially visible.  This routine updates
+ * the clip cache rectangle, and returns one of the following values:
+ *	CLIP_VISIBLE		The whole rectangle is visible
+ *	CLIP_INVISIBLE		The whole rectangle is invisible
+ *	CLIP_PARTIAL		The rectangle may be partially visible
+ * In the case that the area is totally visible, the cursor is removed
+ * if it overlaps the clip area.
+ */
+int
+GdClipArea(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2)
+{
+  if ((x1 < clipminx) || (x1 > clipmaxx) ||
+      (y1 < clipminy) || (y1 > clipmaxy))
+	GdClipPoint(psd, x1, y1);
+
+  if ((x2 >= clipminx) && (x2 <= clipmaxx) &&
+      (y2 >= clipminy) && (y2 <= clipmaxy)) {
+	if (!clipresult) return CLIP_INVISIBLE;
+	GdCheckCursor(psd, x1, y1, x2, y2);
+	return CLIP_VISIBLE;
+  }
+  return CLIP_PARTIAL;
+}
diff -urN lib/microwindows/src/engine/devclip2.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devclip2.c
--- lib/microwindows/src/engine/devclip2.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devclip2.c	2005-02-21 16:13:13.000000000 +0100
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * DYNAMICREGIONS Device-independent routines to set clipping regions.
+ */
+#include <stdio.h>
+#include "device.h"
+
+/* Clip cache rectangle information.
+ * After calling GdClipPoint, this rectangle is guaranteed to contain the
+ * specified point (among others), and all points in the rectangle are
+ * plottable or not according to the value of clipresult.
+ */
+MWCOORD clipminx;		/* minimum x value of cache rectangle */
+MWCOORD clipminy;		/* minimum y value of cache rectangle */
+MWCOORD clipmaxx;		/* maximum x value of cache rectangle */
+MWCOORD clipmaxy;		/* maximum y value of cache rectangle */
+
+static MWBOOL	clipresult;	/* whether clip rectangle is plottable */
+MWCLIPREGION *clipregion = NULL;
+
+/*
+ * Set a clip region for future drawing actions.
+ * Each pixel will be drawn only if lies in one or more of the contained
+ * clip rectangles.  All clip rectangles are modified
+ * if necessary to lie within the device area.  Call only after device
+ * has been initialized.
+ */
+void
+GdSetClipRegion(PSD psd, MWCLIPREGION *reg)
+{
+  if(clipregion)
+  	GdDestroyRegion(clipregion);
+
+  if(!reg)
+	  reg = GdAllocRegion();
+
+  clipregion = reg;
+
+
+#if 0
+  MWRECT	rc;
+  /* Copy the clip table to our own static array, modifying each
+   * rectangle as necesary to fit within the device area.  If the clip
+   * rectangle lies entirely outside of the device area, then skip it.
+   */
+  while (count-- > 0) {
+	MWCLIPRECT cr;
+	MWCLIPRECT *rp = &cr;
+
+	*rp = *table++;
+	if (rp->x < 0) {
+		rp->width += rp->x;
+		rp->x = 0;
+	}
+	if (rp->y < 0) {
+		rp->height += rp->y;
+		rp->y = 0;
+	}
+	if ((rp->x >= psd->xvirtres) || (rp->width <= 0) ||
+	    (rp->y >= psd->yvirtres) || (rp->height <= 0))
+		continue;
+	if (rp->x + rp->width > psd->xvirtres)
+		rp->width = psd->xvirtres - rp->x;
+	if (rp->y + rp->height > psd->yvirtres)
+		rp->height = psd->yvirtres - rp->y;
+	rc.left = rp->x;
+	rc.top = rp->y;
+	rc.right = rp->x+rp->width;
+	rc.bottom = rp->y+rp->height;
+	GdUnionRectWithRegion(&rc, clipregion);
+  }
+#endif
+
+  /* If there were no surviving clip rectangles, then set the clip
+   * cache to prevent all drawing.
+   */
+  if (clipregion->numRects == 0) {
+	clipminx = MIN_MWCOORD;
+	clipminy = MIN_MWCOORD;
+	clipmaxx = MAX_MWCOORD;
+	clipmaxy = MAX_MWCOORD;
+	clipresult = FALSE;
+	return;
+  }
+
+  /* There was at least one valid clip rectangle. Default the clip
+   * cache to be the first clip rectangle.
+   */
+  clipminx = clipregion->rects[0].left;
+  clipminy = clipregion->rects[0].top;
+  clipmaxx = clipregion->rects[0].right - 1;
+  clipmaxy = clipregion->rects[0].bottom - 1;
+  clipresult = TRUE;
+}
+
+
+/* Check a point against the list of clip rectangles.
+ * Returns TRUE if the point is within one or more rectangles and thus
+ * can be plotted, or FALSE if the point is not within any rectangle and
+ * thus cannot be plotted.  Also remembers the coordinates of a clip cache
+ * rectangle containing the specified point such that every point in the
+ * rectangle would give the same result.  By examining this clip cache
+ * rectangle after a call to this routine, the caller can efficiently
+ * check many nearby points without needing any further calls.  If the
+ * point lies within the cursor, then the cursor is removed.
+ */
+MWBOOL
+GdClipPoint(PSD psd,MWCOORD x,MWCOORD y)
+{
+  int count;
+  MWRECT *rp;
+  MWCOORD temp;
+
+  /* First see whether the point lies within the current clip cache
+   * rectangle.  If so, then we already know the result.
+   */
+  if ((x >= clipminx) && (x <= clipmaxx) &&
+      (y >= clipminy) && (y <= clipmaxy)) {
+	if (clipresult) GdCheckCursor(psd, x, y, x, y);
+	return clipresult;
+  }
+
+  /* If the point is outside of the screen area, then it is not
+   * plottable, and the clip cache rectangle is the whole half-plane
+   * outside of the screen area.
+   */
+  if (x < 0) {
+	clipminx = MIN_MWCOORD;
+	clipmaxx = -1;
+	clipminy = MIN_MWCOORD;
+	clipmaxy = MAX_MWCOORD;
+	clipresult = FALSE;
+	return FALSE;
+  }
+  if (y < 0) {
+	clipminx = MIN_MWCOORD;
+	clipmaxx = MAX_MWCOORD;
+	clipminy = MIN_MWCOORD;
+	clipmaxy = -1;
+	clipresult = FALSE;
+	return FALSE;
+  }
+  if (x >= psd->xvirtres) {
+	clipminx = psd->xvirtres;
+	clipmaxx = MAX_MWCOORD;
+	clipminy = MIN_MWCOORD;
+	clipmaxy = MAX_MWCOORD;
+	clipresult = FALSE;
+	return FALSE;
+  }
+  if (y >= psd->yvirtres) {
+	clipminx = MIN_MWCOORD;
+	clipmaxx = MAX_MWCOORD;
+	clipminy = psd->yvirtres;
+	clipmaxy = MAX_MWCOORD;
+	clipresult = FALSE;
+	return FALSE;
+  }
+
+  /* The point is within the screen area. If there are no clip
+   * rectangles, then the point is plottable and the rectangle is the
+   * whole screen.
+   */
+  count = clipregion->numRects;
+  if (count <= 0) {
+	clipminx = 0;
+	clipmaxx = psd->xvirtres - 1;
+	clipminy = 0;
+	clipmaxy = psd->yvirtres - 1;
+	clipresult = TRUE;
+	GdCheckCursor(psd, x, y, x, y);
+	return TRUE;
+  }
+
+  /* We need to scan the list of clip rectangles to calculate a new
+   * clip cache rectangle containing this point, and the result. First
+   * see if the point lies within any of the clip rectangles. If so,
+   * then it is plottable and use that clip rectangle as the cache
+   * rectangle.  This is not necessarily the best result, but works ok
+   * and is fast.
+   */
+  for (rp = clipregion->rects; count-- > 0; rp++) {
+	if ((x >= rp->left) && (y >= rp->top) && (x < rp->right)
+	    && (y < rp->bottom)) {
+		clipminx = rp->left;
+		clipminy = rp->top;
+		clipmaxx = rp->right - 1;
+		clipmaxy = rp->bottom - 1;
+		clipresult = TRUE;
+		GdCheckCursor(psd, x, y, x, y);
+		return TRUE;
+	}
+  }
+
+  /* The point is not plottable. Scan the clip rectangles again to
+   * determine a rectangle containing more non-plottable points.
+   * Simply pick the largest rectangle whose area doesn't contain any
+   * of the same coordinates as appropriate sides of the clip
+   * rectangles.  This is not necessarily the best result, but works ok
+   * and is fast.
+   */
+  clipminx = MIN_MWCOORD;
+  clipminy = MIN_MWCOORD;
+  clipmaxx = MAX_MWCOORD;
+  clipmaxy = MAX_MWCOORD;
+  count = clipregion->numRects;
+  for (rp = clipregion->rects; count-- > 0; rp++) {
+	if ((x < rp->left) && (rp->left <= clipmaxx)) clipmaxx = rp->left - 1;
+	temp = rp->right - 1;
+	if ((x > temp) && (temp >= clipminx)) clipminx = temp + 1;
+	if ((y < rp->top) && (rp->top <= clipmaxy)) clipmaxy = rp->top - 1;
+	temp = rp->bottom - 1;
+	if ((y > temp) && (temp >= clipminy)) clipminy = temp + 1;
+  }
+  clipresult = FALSE;
+  return FALSE;
+}
+
+
+/* Check the area determined by the specified pair of points against the
+ * list of clip rectangles.  The area will either be totally visible,
+ * totally visible, or possibly partially visible.  This routine updates
+ * the clip cache rectangle, and returns one of the following values:
+ *	CLIP_VISIBLE		The whole rectangle is visible
+ *	CLIP_INVISIBLE		The whole rectangle is invisible
+ *	CLIP_PARTIAL		The rectangle may be partially visible
+ * In the case that the area is totally visible, the cursor is removed
+ * if it overlaps the clip area.
+ */
+int
+GdClipArea(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2)
+{
+  if ((x1 < clipminx) || (x1 > clipmaxx) ||
+      (y1 < clipminy) || (y1 > clipmaxy))
+	GdClipPoint(psd, x1, y1);
+
+  if ((x2 >= clipminx) && (x2 <= clipmaxx) &&
+      (y2 >= clipminy) && (y2 <= clipmaxy)) {
+	if (!clipresult) return CLIP_INVISIBLE;
+	GdCheckCursor(psd, x1, y1, x2, y2);
+	return CLIP_VISIBLE;
+  }
+  return CLIP_PARTIAL;
+}
diff -urN lib/microwindows/src/engine/devdraw.1 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devdraw.1
--- lib/microwindows/src/engine/devdraw.1	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devdraw.1	2005-02-21 16:13:16.000000000 +0100
@@ -0,0 +1,1490 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Device-independent mid level drawing and color routines.
+ *
+ * These routines do the necessary range checking, clipping, and cursor
+ * overwriting checks, and then call the lower level device dependent
+ * routines to actually do the drawing.  The lower level routines are
+ * only called when it is known that all the pixels to be drawn are
+ * within the device area and are visible.
+ */
+/*#define NDEBUG*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "device.h"
+
+extern MWPIXELVAL gr_foreground;      /* current foreground color */
+extern MWPIXELVAL gr_background;      /* current background color */
+extern MWBOOL 	  gr_usebg;    	      /* TRUE if background drawn in pixmaps */
+extern int 	  gr_mode; 	      /* drawing mode */
+extern MWPALENTRY gr_palette[256];    /* current palette*/
+extern int	  gr_firstuserpalentry;/* first user-changable palette entry*/
+extern int 	  gr_nextpalentry;    /* next available palette entry*/
+
+/*static*/ void drawpoint(PSD psd,MWCOORD x, MWCOORD y);
+/*static*/ void drawrow(PSD psd,MWCOORD x1,MWCOORD x2,MWCOORD y);
+static void drawcol(PSD psd,MWCOORD x,MWCOORD y1,MWCOORD y2);
+static void extendrow(MWCOORD y,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,
+		MWCOORD *minxptr,MWCOORD *maxxptr);
+
+/*
+ * Set the drawing mode for future calls.
+ */
+int
+GdSetMode(int mode)
+{
+	int	oldmode = gr_mode;
+
+	gr_mode = mode;
+	return oldmode;
+}
+
+/*
+ * Set whether or not the background is used for drawing pixmaps and text.
+ */
+MWBOOL
+GdSetUseBackground(MWBOOL flag)
+{
+	MWBOOL	oldusebg = gr_usebg;
+
+	gr_usebg = flag;
+	return oldusebg;
+}
+
+/*
+ * Set the foreground color for drawing.
+ */
+MWPIXELVAL
+GdSetForeground(MWPIXELVAL fg)
+{
+	MWPIXELVAL	oldfg = gr_foreground;
+
+	gr_foreground = fg;
+	return oldfg;
+}
+
+/*
+ * Set the background color for bitmap and text backgrounds.
+ */
+MWPIXELVAL
+GdSetBackground(MWPIXELVAL bg)
+{
+	MWPIXELVAL	oldbg = gr_background;
+
+	gr_background = bg;
+	return oldbg;
+}
+
+/*
+ * Draw a point using the current clipping region and foreground color.
+ */
+void
+GdPoint(PSD psd, MWCOORD x, MWCOORD y)
+{
+	if (GdClipPoint(psd, x, y)) {
+		psd->DrawPixel(psd, x, y, gr_foreground);
+		GdFixCursor(psd);
+	}
+}
+
+/*
+ * Draw an arbitrary line using the current clipping region and foreground color
+ * If bDrawLastPoint is FALSE, draw up to but not including point x2, y2.
+ *
+ * This routine is the only routine that adjusts coordinates for supporting
+ * two different types of upper levels, those that draw the last point
+ * in a line, and those that draw up to the last point.  All other local
+ * routines draw the last point.  This gives this routine a bit more overhead,
+ * but keeps overall complexity down.
+ */
+void
+GdLine(PSD psd, MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2,
+	MWBOOL bDrawLastPoint)
+{
+  int xdelta;			/* width of rectangle around line */
+  int ydelta;			/* height of rectangle around line */
+  int xinc;			/* increment for moving x coordinate */
+  int yinc;			/* increment for moving y coordinate */
+  int rem;			/* current remainder */
+  MWCOORD temp;
+
+  /* See if the line is horizontal or vertical. If so, then call
+   * special routines.
+   */
+  if (y1 == y2) {
+	/*
+	 * Adjust coordinates if not drawing last point.  Tricky.
+	 */
+	if(!bDrawLastPoint) {
+		if (x1 > x2) {
+			temp = x1;
+			x1 = x2 + 1;
+			x2 = temp;
+		} else
+			--x2;
+	}
+
+	/* call faster line drawing routine*/
+	drawrow(psd, x1, x2, y1);
+	GdFixCursor(psd);
+	return;
+  }
+  if (x1 == x2) {
+	/*
+	 * Adjust coordinates if not drawing last point.  Tricky.
+	 */
+	if(!bDrawLastPoint) {
+		if (y1 > y2) {
+			temp = y1;
+			y1 = y2 + 1;
+			y2 = temp;
+		} else
+			--y2;
+	}
+
+	/* call faster line drawing routine*/
+	drawcol(psd, x1, y1, y2);
+	GdFixCursor(psd);
+	return;
+  }
+
+  /* See if the line is either totally visible or totally invisible. If
+   * so, then the line drawing is easy.
+   */
+  switch (GdClipArea(psd, x1, y1, x2, y2)) {
+      case CLIP_VISIBLE:
+	/*
+	 * For size considerations, there's no low-level bresenham
+	 * line draw, so we've got to draw all non-vertical
+	 * and non-horizontal lines with per-point
+	 * clipping for the time being
+	psd->Line(psd, x1, y1, x2, y2, gr_foreground);
+	GdFixCursor(psd);
+	return;
+	 */
+	break;
+      case CLIP_INVISIBLE:
+	return;
+  }
+
+  /* The line may be partially obscured. Do the draw line algorithm
+   * checking each point against the clipping regions.
+   */
+  xdelta = x2 - x1;
+  ydelta = y2 - y1;
+  if (xdelta < 0) xdelta = -xdelta;
+  if (ydelta < 0) ydelta = -ydelta;
+  xinc = (x2 > x1) ? 1 : -1;
+  yinc = (y2 > y1) ? 1 : -1;
+  if (GdClipPoint(psd, x1, y1))
+	  psd->DrawPixel(psd, x1, y1, gr_foreground);
+  if (xdelta >= ydelta) {
+	rem = xdelta / 2;
+	for(;;) {
+		if(!bDrawLastPoint && x1 == x2)
+			break;
+		x1 += xinc;
+		rem += ydelta;
+		if (rem >= xdelta) {
+			rem -= xdelta;
+			y1 += yinc;
+		}
+		if (GdClipPoint(psd, x1, y1))
+			psd->DrawPixel(psd, x1, y1, gr_foreground);
+		if(bDrawLastPoint && x1 == x2)
+			break;
+	}
+  } else {
+	rem = ydelta / 2;
+	for(;;) {
+		if(!bDrawLastPoint && y1 == y2)
+			break;
+		y1 += yinc;
+		rem += xdelta;
+		if (rem >= ydelta) {
+			rem -= ydelta;
+			x1 += xinc;
+		}
+		if (GdClipPoint(psd, x1, y1))
+			psd->DrawPixel(psd, x1, y1, gr_foreground);
+		if(bDrawLastPoint && y1 == y2)
+			break;
+	}
+  }
+  GdFixCursor(psd);
+}
+
+/* Draw a point in the foreground color, applying clipping if necessary*/
+/*static*/ void
+drawpoint(PSD psd, MWCOORD x, MWCOORD y)
+{
+	if (GdClipPoint(psd, x, y))
+		psd->DrawPixel(psd, x, y, gr_foreground);
+}
+
+/* Draw a horizontal line from x1 to and including x2 in the
+ * foreground color, applying clipping if necessary.
+ */
+/*static*/ void
+drawrow(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y)
+{
+  MWCOORD temp;
+
+  /* reverse endpoints if necessary*/
+  if (x1 > x2) {
+	temp = x1;
+	x1 = x2;
+	x2 = temp;
+  }
+
+  /* clip to physical device*/
+  if (x1 < 0)
+	  x1 = 0;
+  if (x2 >= psd->xvirtres)
+	  x2 = psd->xvirtres - 1;
+
+  /* check cursor intersect once for whole line*/
+  GdCheckCursor(psd, x1, y, x2, y);
+
+  while (x1 <= x2) {
+	if (GdClipPoint(psd, x1, y)) {
+		temp = MWMIN(clipmaxx, x2);
+		psd->DrawHorzLine(psd, x1, temp, y, gr_foreground);
+	} else
+		temp = MWMIN(clipmaxx, x2);
+	x1 = temp + 1;
+  }
+}
+
+/* Draw a vertical line from y1 to and including y2 in the
+ * foreground color, applying clipping if necessary.
+ */
+static void
+drawcol(PSD psd, MWCOORD x,MWCOORD y1,MWCOORD y2)
+{
+  MWCOORD temp;
+
+  /* reverse endpoints if necessary*/
+  if (y1 > y2) {
+	temp = y1;
+	y1 = y2;
+	y2 = temp;
+  }
+
+  /* clip to physical device*/
+  if (y1 < 0)
+	  y1 = 0;
+  if (y2 >= psd->yvirtres)
+	  y2 = psd->yvirtres - 1;
+
+  /* check cursor intersect once for whole line*/
+  GdCheckCursor(psd, x, y1, x, y2);
+
+  while (y1 <= y2) {
+	if (GdClipPoint(psd, x, y1)) {
+		temp = MWMIN(clipmaxy, y2);
+		psd->DrawVertLine(psd, x, y1, temp, gr_foreground);
+	} else
+		temp = MWMIN(clipmaxy, y2);
+	y1 = temp + 1;
+  }
+}
+
+/* Draw a rectangle in the foreground color, applying clipping if necessary.
+ * This is careful to not draw points multiple times in case the rectangle
+ * is being drawn using XOR.
+ */
+void
+GdRect(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height)
+{
+  MWCOORD maxx;
+  MWCOORD maxy;
+
+  if (width <= 0 || height <= 0)
+	  return;
+  maxx = x + width - 1;
+  maxy = y + height - 1;
+  drawrow(psd, x, maxx, y);
+  if (height > 1)
+	  drawrow(psd, x, maxx, maxy);
+  if (height < 3)
+	  return;
+  y++;
+  maxy--;
+  drawcol(psd, x, y, maxy);
+  if (width > 1)
+	  drawcol(psd, maxx, y, maxy);
+  GdFixCursor(psd);
+}
+
+/* Draw a filled in rectangle in the foreground color, applying
+ * clipping if necessary.
+ */
+void
+GdFillRect(PSD psd, MWCOORD x1, MWCOORD y1, MWCOORD width, MWCOORD height)
+{
+  MWCOORD x2 = x1+width-1;
+  MWCOORD y2 = y1+height-1;
+
+  if (width <= 0 || height <= 0)
+	  return;
+
+  /* See if the rectangle is either totally visible or totally
+   * invisible. If so, then the rectangle drawing is easy.
+   */
+  switch (GdClipArea(psd, x1, y1, x2, y2)) {
+      case CLIP_VISIBLE:
+	psd->FillRect(psd, x1, y1, x2, y2, gr_foreground);
+	GdFixCursor(psd);
+	return;
+
+      case CLIP_INVISIBLE:
+	return;
+  }
+
+  /* The rectangle may be partially obstructed. So do it line by line. */
+  while (y1 <= y2)
+	  drawrow(psd, x1, x2, y1++);
+  GdFixCursor(psd);
+}
+
+/*
+ * Draw a rectangular area using the current clipping region and the
+ * specified bit map.  This differs from rectangle drawing in that the
+ * rectangle is drawn using the foreground color and possibly the background
+ * color as determined by the bit map.  Each row of bits is aligned to the
+ * next bitmap word boundary (so there is padding at the end of the row).
+ * The background bit values are only written if the gr_usebg flag
+ * is set.
+ */
+void
+GdBitmap(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height,
+	MWIMAGEBITS *imagebits)
+{
+  MWCOORD minx;
+  MWCOORD maxx;
+  MWPIXELVAL savecolor;		/* saved foreground color */
+  MWIMAGEBITS bitvalue = 0;	/* bitmap word value */
+  int bitcount;			/* number of bits left in bitmap word */
+
+  switch (GdClipArea(psd, x, y, x + width - 1, y + height - 1)) {
+      case CLIP_VISIBLE:
+	/*
+	 * For size considerations, there's no low-level bitmap
+	 * draw so we've got to draw everything with per-point
+	 * clipping for the time being.
+	if (gr_usebg)
+		psd->FillRect(psd, x, y, x + width - 1, y + height - 1,
+			gr_background);
+	psd->DrawBitmap(psd, x, y, width, height, imagebits, gr_foreground);
+	return;
+	*/
+	break;
+
+      case CLIP_INVISIBLE:
+	return;
+  }
+
+  /* The rectangle is partially visible, so must do clipping. First
+   * fill a rectangle in the background color if necessary.
+   */
+  if (gr_usebg) {
+	savecolor = gr_foreground;
+	gr_foreground = gr_background;
+	/* note: change to fillrect*/
+	GdFillRect(psd, x, y, width, height);
+	gr_foreground = savecolor;
+  }
+  minx = x;
+  maxx = x + width - 1;
+  bitcount = 0;
+  while (height > 0) {
+	if (bitcount <= 0) {
+		bitcount = MWIMAGE_BITSPERIMAGE;
+		bitvalue = *imagebits++;
+	}
+	if (MWIMAGE_TESTBIT(bitvalue) && GdClipPoint(psd, x, y))
+		psd->DrawPixel(psd, x, y, gr_foreground);
+	bitvalue = MWIMAGE_SHIFTBIT(bitvalue);
+	bitcount--;
+	if (x++ == maxx) {
+		x = minx;
+		y++;
+		height--;
+		bitcount = 0;
+	}
+  }
+  GdFixCursor(psd);
+}
+
+/*
+ * Return true if color is in palette
+ */
+MWBOOL
+GdColorInPalette(MWCOLORVAL cr,MWPALENTRY *palette,int palsize)
+{
+	int	i;
+
+	for(i=0; i<palsize; ++i)
+		if(GETPALENTRY(palette, i) == cr)
+			return TRUE;
+	return FALSE;
+}
+
+/*
+ * Create a MWPIXELVAL conversion table between the passed palette
+ * and the in-use palette.  The system palette is loaded/merged according
+ * to fLoadType.
+ */
+void
+GdMakePaletteConversionTable(PSD psd,MWPALENTRY *palette,int palsize,
+	MWPIXELVAL *convtable,int fLoadType)
+{
+	int		i;
+	MWCOLORVAL	cr;
+	int		newsize, nextentry;
+	MWPALENTRY	newpal[256];
+
+	/*
+	 * Check for load palette completely, or add colors
+	 * from passed palette to system palette until full.
+	 */
+	if(psd->pixtype == MWPF_PALETTE) {
+	    switch(fLoadType) {
+	    case LOADPALETTE:
+		/* Load palette from beginning with image's palette.
+		 * First palette entries are Microwindows colors
+		 * and not changed.
+		 */
+		GdSetPalette(psd, gr_firstuserpalentry, palsize, palette);
+		break;
+
+	    case MERGEPALETTE:
+		/* get system palette*/
+		for(i=0; i<(int)psd->ncolors; ++i)
+			newpal[i] = gr_palette[i];
+
+		/* merge passed palette into system palette*/
+		newsize = 0;
+		nextentry = gr_nextpalentry;
+
+		/* if color missing and there's room, add it*/
+		for(i=0; i<palsize && nextentry < (int)psd->ncolors; ++i) {
+			cr = GETPALENTRY(palette, i);
+			if(!GdColorInPalette(cr, newpal, nextentry)) {
+				newpal[nextentry++] = palette[i];
+				++newsize;
+			}
+		}
+
+		/* set the new palette if any color was added*/
+		if(newsize) {
+			GdSetPalette(psd, gr_nextpalentry, newsize,
+				&newpal[gr_nextpalentry]);
+			gr_nextpalentry += newsize;
+		}
+		break;
+	    }
+	}
+
+	/*
+	 * Build conversion table from inuse system palette and
+	 * passed palette.  This will load RGB values directly
+	 * if running truecolor, otherwise it will find the
+	 * nearest color from the inuse palette.
+	 * FIXME: tag the conversion table to the bitmap image
+	 */
+	for(i=0; i<palsize; ++i) {
+		cr = GETPALENTRY(palette, i);
+		convtable[i] = GdFindColor(cr);
+	}
+}
+
+/*
+ * Draw a color bitmap image in 1, 4, 8, 24 or 32 bits per pixel.  The
+ * Microwindows color image format is DWORD padded bytes, with
+ * the upper bits corresponding to the left side (identical to 
+ * the MS Windows format).  This format is currently different
+ * than the MWIMAGEBITS format, which uses word-padded bits
+ * for monochrome display only, where the upper bits in the word
+ * correspond with the left side.
+ */
+void
+GdDrawImage(PSD psd, MWCOORD x, MWCOORD y, PMWIMAGEHDR pimage)
+{
+  MWCOORD minx;
+  MWCOORD maxx;
+  MWUCHAR bitvalue = 0;
+  int bitcount;
+  MWUCHAR *imagebits;
+  MWCOORD	height, width;
+  MWPIXELVAL pixel;
+  int clip;
+  int extra, linesize;
+  int	rgborder;
+  MWCOLORVAL cr;
+  MWCOORD yoff;
+  unsigned long transcolor;
+  MWPIXELVAL convtable[256];
+
+  height = pimage->height;
+  width = pimage->width;
+
+  /* determine if entire image is clipped out, save clipresult for later*/
+  clip = GdClipArea(psd, x, y, x + width - 1, y + height - 1);
+  if(clip == CLIP_INVISIBLE)
+	return;
+
+  transcolor = pimage->transcolor;
+
+  /*
+   * Merge the images's palette and build a palette index conversion table.
+   */
+  if (pimage->bpp <= 8) {
+	if(!pimage->palette) {
+		/* for jpeg's without a palette*/
+		for(yoff=0; yoff<pimage->palsize; ++yoff)
+			convtable[yoff] = yoff;
+	} else GdMakePaletteConversionTable(psd, pimage->palette,
+		pimage->palsize, convtable, MERGEPALETTE);
+	/* convert transcolor to converted palette index for speed*/
+	if (transcolor != -1L)
+		transcolor = (unsigned long)convtable[transcolor];
+  }
+
+  minx = x;
+  maxx = x + width - 1;
+  imagebits = pimage->imagebits;
+
+  /* check for bottom-up image*/
+  if(pimage->compression & MWIMAGE_UPSIDEDOWN) {
+	y += height - 1;
+	yoff = -1;
+  } else
+	yoff = 1;
+
+#define PIX2BYTES(n)	(((n)+7)/8)
+  /* imagebits are dword aligned*/
+  switch(pimage->bpp) {
+  default:
+  case 8:
+	linesize = width;
+	break;
+  case 32:
+	linesize = width*4;
+	break;
+  case 24:
+	linesize = width*3;
+	break;
+  case 4:
+	linesize = PIX2BYTES(width<<2);
+	break;
+  case 1:
+	linesize = PIX2BYTES(width);
+	break;
+  }
+  extra = pimage->pitch - linesize;
+
+  /* 24bpp RGB rather than BGR byte order?*/
+  rgborder = pimage->compression & MWIMAGE_RGB; 
+
+  bitcount = 0;
+  while(height > 0) {
+	if (bitcount <= 0) {
+		bitcount = sizeof(MWUCHAR) * 8;
+		bitvalue = *imagebits++;
+	}
+	switch(pimage->bpp) {
+	case 24:
+	case 32:
+		cr = rgborder? MWRGB(bitvalue, imagebits[0], imagebits[1]):
+			MWRGB(imagebits[1], imagebits[0], bitvalue);
+
+		if (pimage->bpp == 32)
+			imagebits += 3;
+		else imagebits += 2;
+		bitcount = 0;
+
+		/* handle transparent color*/
+		if (transcolor == (unsigned long)cr)
+			goto next;
+
+		switch(psd->pixtype) {
+		case MWPF_PALETTE:
+		default:
+			pixel = GdFindColor(cr);
+			break;
+		case MWPF_TRUECOLOR0888:
+		case MWPF_TRUECOLOR888:
+			pixel = COLOR2PIXEL888(cr);
+			break;
+		case MWPF_TRUECOLOR565:
+			pixel = COLOR2PIXEL565(cr);
+			break;
+		case MWPF_TRUECOLOR332:
+			pixel = COLOR2PIXEL332(cr);
+			break;
+		}
+		break;
+	default:
+	case 8:
+		pixel = convtable[bitvalue];
+		bitcount = 0;
+		break;
+	case 4:
+		pixel = convtable[(bitvalue & 0xf0) >> 4];
+		bitvalue <<= 4;
+		bitcount -= 4;
+		break;
+	case 1:
+		pixel = convtable[(bitvalue & 0x80)? 1: 0];
+		bitvalue <<= 1;
+		--bitcount;
+		break;
+	}
+
+	if((unsigned long)pixel != transcolor &&
+		(clip == CLIP_VISIBLE || GdClipPoint(psd, x, y))) {
+			psd->DrawPixel(psd, x, y, pixel);
+	}
+#if 0
+	/* fix: use clipmaxx to clip quicker*/
+	else if(clip != CLIP_VISIBLE && !clipresult && x > clipmaxx) {
+		x = maxx;
+	}
+#endif
+next:
+	if(x++ == maxx) {
+		x = minx;
+		y += yoff;
+		height--;
+		bitcount = 0;
+		imagebits += extra;
+	}
+  }
+  GdFixCursor(psd);
+}
+
+/* Draw a polygon in the foreground color, applying clipping if necessary.
+ * The polygon is only closed if the first point is repeated at the end.
+ * Some care is taken to plot the endpoints correctly if the current
+ * drawing mode is XOR.  However, internal crossings are not handled
+ * correctly.
+ */
+void
+GdPoly(PSD psd, int count, MWPOINT *points)
+{
+  MWCOORD firstx;
+  MWCOORD firsty;
+  MWBOOL didline;
+
+  if (count < 2)
+	  return;
+  firstx = points->x;
+  firsty = points->y;
+  didline = FALSE;
+
+  while (count-- > 1) {
+	if (didline && (gr_mode == MWMODE_XOR))
+		drawpoint(psd, points->x, points->y);
+	/* note: change to drawline*/
+	GdLine(psd, points[0].x, points[0].y, points[1].x, points[1].y, TRUE);
+	points++;
+	didline = TRUE;
+  }
+  if (gr_mode == MWMODE_XOR) {
+	  points--;
+	  if (points->x == firstx && points->y == firsty)
+		drawpoint(psd, points->x, points->y);
+  }
+  GdFixCursor(psd);
+}
+
+/*
+ * Fill a polygon in the foreground color, applying clipping if necessary.
+ * The last point may be a duplicate of the first point, but this is
+ * not required.
+ * Note: this routine currently only correctly fills convex polygons.
+ */
+void
+GdFillPoly(PSD psd, int count, MWPOINT *points)
+{
+  MWPOINT *pp;		/* current point */
+  MWCOORD miny;		/* minimum row */
+  MWCOORD maxy;		/* maximum row */
+  MWCOORD minx;		/* minimum column */
+  MWCOORD maxx;		/* maximum column */
+  int i;		/* counter */
+
+  if (count <= 0)
+	  return;
+
+  /* First determine the minimum and maximum rows for the polygon. */
+  pp = points;
+  miny = pp->y;
+  maxy = pp->y;
+  for (i = count; i-- > 0; pp++) {
+	if (miny > pp->y) miny = pp->y;
+	if (maxy < pp->y) maxy = pp->y;
+  }
+  if (miny < 0)
+	  miny = 0;
+  if (maxy >= psd->yvirtres)
+	  maxy = psd->yvirtres - 1;
+  if (miny > maxy)
+	  return;
+
+  /* Now for each row, scan the list of points and determine the
+   * minimum and maximum x coordinate for each line, and plot the row.
+   * The last point connects with the first point automatically.
+   */
+  for (; miny <= maxy; miny++) {
+	minx = MAX_MWCOORD;
+	maxx = MIN_MWCOORD;
+	pp = points;
+	for (i = count; --i > 0; pp++)
+		extendrow(miny, pp[0].x, pp[0].y, pp[1].x, pp[1].y,
+			&minx, &maxx);
+	extendrow(miny, pp[0].x, pp[0].y, points[0].x, points[0].y,
+		&minx, &maxx);
+
+	if (minx <= maxx)
+		drawrow(psd, minx, maxx, miny);
+  }
+  GdFixCursor(psd);
+}
+
+/* Utility routine for filling polygons.  Find the intersection point (if
+ * any) of a horizontal line with an arbitrary line, and extend the current
+ * minimum and maximum x values as needed to include the intersection point.
+ * Input parms:
+ *	y 	row to check for intersection
+ *	x1, y1	first endpoint
+ *	x2, y2	second enpoint
+ *	minxptr	address of current minimum x
+ *	maxxptr	address of current maximum x
+ */
+static void
+extendrow(MWCOORD y,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,
+	MWCOORD *minxptr,MWCOORD *maxxptr)
+{
+  MWCOORD x;			/* x coordinate of intersection */
+  typedef long NUM;
+  NUM num;			/* numerator of fraction */
+
+  /* First make sure the specified line segment includes the specified
+   * row number.  If not, then there is no intersection.
+   */
+  if (((y < y1) || (y > y2)) && ((y < y2) || (y > y1)))
+	return;
+
+  /* If a horizontal line, then check the two endpoints. */
+  if (y1 == y2) {
+	if (*minxptr > x1) *minxptr = x1;
+	if (*minxptr > x2) *minxptr = x2;
+	if (*maxxptr < x1) *maxxptr = x1;
+	if (*maxxptr < x2) *maxxptr = x2;
+	return;
+  }
+
+  /* If a vertical line, then check the x coordinate. */
+  if (x1 == x2) {
+	if (*minxptr > x1) *minxptr = x1;
+	if (*maxxptr < x1) *maxxptr = x1;
+	return;
+  }
+
+  /* An arbitrary line.  Calculate the intersection point using the
+   * formula x = x1 + (y - y1) * (x2 - x1) / (y2 - y1).
+   */
+  num = ((NUM) (y - y1)) * (x2 - x1);
+  x = x1 + num / (y2 - y1);
+  if (*minxptr > x) *minxptr = x;
+  if (*maxxptr < x) *maxxptr = x;
+}
+
+/*
+ * Read a rectangular area of the screen.  
+ * The color table is indexed row by row.
+ */
+void
+GdReadArea(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height,
+	MWPIXELVAL *pixels)
+{
+	MWCOORD 		row;
+	MWCOORD 		col;
+
+	if (width <= 0 || height <= 0)
+		return;
+
+	GdCheckCursor(psd, x, y, x+width-1, y+height-1);
+	for (row = 0; row < height; row++)
+		for (col = 0; col < width; col++)
+			*pixels++ = psd->ReadPixel(psd, x + col, y + row);
+
+	GdFixCursor(psd);
+}
+
+/* Draw a rectangle of color values, clipping if necessary.
+ * If a color matches the background color,
+ * then that pixel is only drawn if the gr_usebg flag is set.
+ *
+ * The pixels are packed according to pixtype:
+ *
+ * pixtype		array of
+ * MWPF_RGB		MWCOLORVAL (unsigned long)
+ * MWPF_PIXELVAL	MWPIXELVAL (compile-time dependent)
+ * MWPF_PALETTE		unsigned char
+ * MWPF_TRUECOLOR0888	unsigned long
+ * MWPF_TRUECOLOR888	packed struct {char r,char g,char b} (24 bits)
+ * MWPF_TRUECOLOR565	unsigned short
+ * MWPF_TRUECOLOR332	unsigned char
+ *
+ * NOTE: Currently, no translation is performed if the pixtype
+ * is not MWPF_RGB.  Pixtype is only then used to determine the 
+ * packed size of the pixel data, and is then stored unmodified
+ * in a MWPIXELVAL and passed to the screen driver.  Virtually,
+ * this means there's only three reasonable options for client
+ * programs: (1) pass all data as RGB MWCOLORVALs, (2) pass
+ * data as unpacked 32-bit MWPIXELVALs in the format the current
+ * screen driver is running, or (3) pass data as packed values
+ * in the format the screen driver is running.  Options 2 and 3
+ * are identical except for the packing structure.
+ */
+void
+GdArea(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height, void *pixels,
+	int pixtype)
+{
+	unsigned char *PIXELS = pixels;	/* for ANSI compilers, can't use void*/
+	long cellstodo;			/* remaining number of cells */
+	long count;			/* number of cells of same color */
+	long cc;			/* current cell count */
+	long rows;			/* number of complete rows */
+	MWCOORD minx;			/* minimum x value */
+	MWCOORD maxx;			/* maximum x value */
+	MWPIXELVAL savecolor;		/* saved foreground color */
+	MWBOOL dodraw;			/* TRUE if draw these points */
+	MWCOLORVAL rgbcolor = 0L;
+	int pixsize;
+	unsigned char r, g, b;
+	driver_gc_t hwgc;
+	int px1, px2, py1, py2, pw, ph, rx1, rx2, ry1, ry2;
+#if DYNAMICREGIONS
+	MWRECT *prc;
+	extern MWCLIPREGION *clipregion;
+#else
+	MWCLIPRECT *prc;
+	extern MWCLIPRECT cliprects[];
+	extern int clipcount;
+#endif
+
+	minx = x;
+	maxx = x + width - 1;
+
+	hwgc.pixels = PIXELS;
+	hwgc.src_linelen = width;
+	hwgc.gr_usebg = gr_usebg;
+	hwgc.bg_color = gr_background;
+
+	/* Set up area clipping, and just return if nothing is visible */
+	if ( GdClipArea(psd, minx, y, maxx, y + height - 1) == CLIP_INVISIBLE )
+		return;
+
+#if HAVE_T1LIB_SUPPORT | HAVE_FREETYPE_SUPPORT
+	/* can't use drawarea driver in 16 bpp mode yet with font routines*/
+	goto fallback;
+#endif
+	if ( !(psd->flags & PSF_HAVEOP_COPY) )
+		goto fallback;
+
+#if DYNAMICREGIONS
+	prc = clipregion->rects;
+	count = clipregion->numRects;
+#else
+	prc = cliprects;
+	count = clipcount;
+#endif
+
+	while ( count-- > 0 ) {
+#if DYNAMICREGIONS
+		rx1 = prc->left;
+		ry1 = prc->top;
+		rx2 = prc->right;
+		ry2 = prc->bottom;
+#else
+		/* New clip-code by Morten */
+		rx1 = prc->x;
+		ry1 = prc->y;
+		rx2 = prc->x + prc->width;
+		ry2 = prc->y + prc->height;
+#endif
+
+		/* Check if this rect intersects with the one we draw */
+		px1 = x;
+		py1 = y;
+		px2 = x + width;
+		py2 = y + height;
+		if ( px1 < rx1 ) px1 = rx1;
+		if ( py1 < ry1 ) py1 = ry1;
+		if ( px2 > rx2 ) px2 = rx2;
+		if ( py2 > ry2 ) py2 = ry2;
+
+		pw = px2 - px1;
+		ph = py2 - py1;
+
+		if ( pw > 0 && ph > 0 ) {
+			hwgc.dstx = px1;
+			hwgc.dsty = py1;
+			hwgc.dstw = pw;
+			hwgc.dsth = ph;
+			hwgc.srcx = px1 - x;
+			hwgc.srcy = py1 - y;
+			GdCheckCursor(psd,px1,py1,px1+pw-1,py1+ph-1);
+			psd->DrawArea(psd,&hwgc,PSDOP_COPY);
+		}
+		prc++;
+	}
+	GdFixCursor(psd);
+	return;
+
+ fallback:
+
+	/* Calculate size of packed pixels*/
+	switch(pixtype) {
+	case MWPF_RGB:
+		pixsize = sizeof(MWCOLORVAL);
+		break;
+	case MWPF_PIXELVAL:
+		pixsize = sizeof(MWPIXELVAL);
+		break;
+	case MWPF_PALETTE:
+	case MWPF_TRUECOLOR332:
+		pixsize = sizeof(unsigned char);
+		break;
+	case MWPF_TRUECOLOR0888:
+		pixsize = sizeof(unsigned long);
+		break;
+	case MWPF_TRUECOLOR888:
+		pixsize = 3;
+		break;
+	case MWPF_TRUECOLOR565:
+		pixsize = sizeof(unsigned short);
+		break;
+	default:
+		return;
+	}
+
+  savecolor = gr_foreground;
+  cellstodo = (long)width * height;
+  while (cellstodo > 0) {
+	/* read the pixel value from the pixtype*/
+	switch(pixtype) {
+	case MWPF_RGB:
+		rgbcolor = *(MWCOLORVAL *)PIXELS;
+		PIXELS += sizeof(MWCOLORVAL);
+		gr_foreground = GdFindColor(rgbcolor);
+		break;
+	case MWPF_PIXELVAL:
+		gr_foreground = *(MWPIXELVAL *)PIXELS;
+		PIXELS += sizeof(MWPIXELVAL);
+		break;
+	case MWPF_PALETTE:
+	case MWPF_TRUECOLOR332:
+		gr_foreground = *PIXELS++;
+		break;
+	case MWPF_TRUECOLOR0888:
+		gr_foreground = *(unsigned long *)PIXELS;
+		PIXELS += sizeof(unsigned long);
+		break;
+	case MWPF_TRUECOLOR888:
+		r = *PIXELS++;
+		g = *PIXELS++;
+		b = *PIXELS++;
+		gr_foreground = (MWPIXELVAL)MWRGB(r, g, b);
+		break;
+	case MWPF_TRUECOLOR565:
+		gr_foreground = *(unsigned short *)PIXELS;
+		PIXELS += sizeof(unsigned short);
+		break;
+	}
+	dodraw = (gr_usebg || (gr_foreground != gr_background));
+	count = 1;
+	--cellstodo;
+
+	/* See how many of the adjacent remaining points have the
+	 * same color as the next point.
+	 *
+	 * NOTE: Yes, with the addition of the pixel unpacking,
+	 * it's almost slower to look ahead than to just draw
+	 * the pixel...  FIXME
+	 */
+	while (cellstodo > 0) {
+		switch(pixtype) {
+		case MWPF_RGB:
+			if(rgbcolor != *(MWCOLORVAL *)PIXELS)
+				goto breakwhile;
+			PIXELS += sizeof(MWCOLORVAL);
+			break;
+		case MWPF_PIXELVAL:
+			if(gr_foreground != *(MWPIXELVAL *)PIXELS)
+				goto breakwhile;
+			PIXELS += sizeof(MWPIXELVAL);
+			break;
+		case MWPF_PALETTE:
+		case MWPF_TRUECOLOR332:
+			if(gr_foreground != *(unsigned char *)PIXELS)
+				goto breakwhile;
+			++PIXELS;
+			break;
+		case MWPF_TRUECOLOR0888:
+			if(gr_foreground != *(unsigned long *)PIXELS)
+				goto breakwhile;
+			PIXELS += sizeof(unsigned long);
+			break;
+		case MWPF_TRUECOLOR888:
+			r = *(unsigned char *)PIXELS;
+			g = *(unsigned char *)(PIXELS + 1);
+			b = *(unsigned char *)(PIXELS + 2);
+			if(gr_foreground != (MWPIXELVAL)MWRGB(r, g, b))
+				goto breakwhile;
+			PIXELS += 3;
+			break;
+		case MWPF_TRUECOLOR565:
+			if(gr_foreground != *(unsigned short *)PIXELS)
+				goto breakwhile;
+			PIXELS += sizeof(unsigned short);
+			break;
+		}
+		++count;
+		--cellstodo;
+	}
+breakwhile:
+
+	/* If there is only one point with this color, then draw it
+	 * by itself.
+	 */
+	if (count == 1) {
+		if (dodraw)
+			drawpoint(psd, x, y);
+		if (++x > maxx) {
+			x = minx;
+			y++;
+		}
+		continue;
+	}
+
+	/* There are multiple points with the same color. If we are
+	 * not at the start of a row of the rectangle, then draw this
+	 * first row specially.
+	 */
+	if (x != minx) {
+		cc = count;
+		if (x + cc - 1 > maxx)
+			cc = maxx - x + 1;
+		if (dodraw)
+			drawrow(psd, x, x + cc - 1, y);
+		count -= cc;
+		x += cc;
+		if (x > maxx) {
+			x = minx;
+			y++;
+		}
+	}
+
+	/* Now the x value is at the beginning of a row if there are
+	 * any points left to be drawn.  Draw all the complete rows
+	 * with one call.
+	 */
+	rows = count / width;
+	if (rows > 0) {
+		if (dodraw) {
+			/* note: change to fillrect, (parm types changed)*/
+			/*GdFillRect(psd, x, y, maxx, y + rows - 1);*/
+			GdFillRect(psd, x, y, maxx - x + 1, rows);
+		}
+		count %= width;
+		y += rows;
+	}
+
+	/* If there is a final partial row of pixels left to be
+	 * drawn, then do that.
+	 */
+	if (count > 0) {
+		if (dodraw)
+			drawrow(psd, x, x + count - 1, y);
+		x += count;
+	}
+  }
+  gr_foreground = savecolor;
+  GdFixCursor(psd);
+}
+
+#if NOTYET
+/* Copy a rectangular area from one screen area to another.
+ * This bypasses clipping.
+ */
+void
+GdCopyArea(PSD psd, MWCOORD srcx, MWCOORD srcy, MWCOORD width, MWCOORD height,
+	MWCOORD destx, MWCOORD desty)
+{
+	if (width <= 0 || height <= 0)
+		return;
+
+	if (srcx == destx && srcy == desty)
+		return;
+	GdCheckCursor(psd, srcx, srcy, srcx + width - 1, srcy + height - 1);
+	GdCheckCursor(psd, destx, desty, destx + width - 1, desty + height - 1);
+	psd->CopyArea(psd, srcx, srcy, width, height, destx, desty);
+	GdFixCursor(psd);
+}
+#endif
+
+#define NEWBLIT 1 /* Kaben's clipping fix for blitting*/
+
+/* Copy source rectangle of pixels to destination rectangle quickly*/
+void
+GdBlit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD width, MWCOORD height,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long rop)
+{
+#if NEWBLIT
+	int rx1, rx2, ry1, ry2;
+	int px1, px2, py1, py2;
+	int pw, ph;
+	int count;
+#else
+	int	DSTX, DSTY, WIDTH, HEIGHT;
+	int	SRCX, SRCY;
+	int		count, dx, dy;
+#endif
+#if DYNAMICREGIONS
+	MWRECT *	prc;
+	extern MWCLIPREGION *clipregion;
+#else
+	MWCLIPRECT *	prc;
+	extern MWCLIPRECT cliprects[];
+	extern int clipcount;
+#endif
+
+	/*FIXME: compare bpp's and convert if necessary*/
+	assert(dstpsd->planes == srcpsd->planes);
+	assert(dstpsd->bpp == srcpsd->bpp);
+	
+	/* clip blit rectangle to source screen/bitmap size*/
+	/* we must do this because there isn't any source clipping setup*/
+	if(srcx+width > srcpsd->xvirtres)
+		width = srcpsd->xvirtres - srcx;
+	if(srcy+height > srcpsd->yvirtres)
+		height = srcpsd->yvirtres - srcy;
+
+	switch(GdClipArea(dstpsd, dstx, dsty, dstx+width-1, dsty+height-1)) {
+	case CLIP_VISIBLE:
+		/* check cursor in src region*/
+		GdCheckCursor(dstpsd, srcx, srcy, srcx+width-1, srcy+height-1);
+		dstpsd->Blit(dstpsd, dstx, dsty, width, height,
+			srcpsd, srcx, srcy, rop);
+		GdFixCursor(dstpsd);
+		return;
+
+	case CLIP_INVISIBLE:
+		return;
+	}
+
+	/* Partly clipped, we'll blit using destination clip
+	 * rectangles, and offset the blit accordingly.
+	 * Since the destination is already clipped, we
+	 * only need to clip the source here.
+	 */
+#if DYNAMICREGIONS
+	prc = clipregion->rects;
+	count = clipregion->numRects;
+#else
+	prc = cliprects;
+	count = clipcount;
+#endif
+	while(--count >= 0) {
+#if NEWBLIT
+#if DYNAMICREGIONS
+		rx1 = prc->left;
+		ry1 = prc->top;
+		rx2 = prc->right;
+		ry2 = prc->bottom;
+#else
+		rx1 = prc->x;
+		ry1 = prc->y;
+		rx2 = prc->x + prc->width;
+		ry2 = prc->y + prc->height;
+#endif
+		/* Check:  does this rect intersect the one we want to draw? */
+		px1 = dstx;
+		py1 = dsty;
+		px2 = dstx + width;
+		py2 = dsty + height;
+		if (px1 < rx1) px1 = rx1;
+		if (py1 < ry1) py1 = ry1;
+		if (px2 > rx2) px2 = rx2;
+		if (py2 > ry2) py2 = ry2;
+
+		pw = px2 - px1;
+		ph = py2 - py1;
+		if(pw > 0 && ph > 0) {
+			/* check cursor in dest and src regions*/
+			GdCheckCursor(dstpsd, px1, py1, px2-1, py2-1);
+			GdCheckCursor(dstpsd, srcx, srcy,
+				srcx+width, srcy+height);
+			dstpsd->Blit(dstpsd, px1, py1, pw, ph, srcpsd,
+				srcx + (px1-dstx), srcy + (py1-dsty), rop);
+		}
+#else /* !NEWBLIT*/
+#if DYNAMICREGIONS
+		dx = prc->left - dstx;
+		dy = prc->top - dsty;
+		WIDTH = prc->right - prc->left;
+		HEIGHT = prc->bottom - prc->top;
+#else
+		dx = prc->x - dstx;
+		dy = prc->y - dsty;
+		WIDTH = prc->width;
+		HEIGHT = prc->height;
+#endif
+		/*
+		 * This shouldn't have to be here, but is required
+		 * to fix a bug where negative dx, dy values get
+		 * generated when UPDATEREGIONS is defined, and
+		 * the entire client area is obscured.  Yes, the
+		 * above CLIP_INVISIBLE should be returned, but
+		 * is not.  So we check for negative values, and
+		 * don't blit in that case.
+		 *
+		 * This bug only occurs when the cursor is moved
+		 * on non-client area during complete obscuration
+		 * of client area.  Normally, a WM_MOUSEMOVE
+		 * shouldn't be generated, which was causing
+		 * the app to redraw.  Perhaps the nRcUpdate 
+		 * member should be cleared, or the clipping
+		 * region completely reset...
+		 */
+		if(dx >= 0 && dy >= 0) {
+			/* calc offset into blit*/
+			DSTX = dstx + dx;
+			SRCX = srcx + dx;
+			DSTY = dsty + dy;
+			SRCY = srcy + dy;
+
+			/* clip source rectangle*/
+			if(SRCX + WIDTH > srcpsd->xvirtres)
+				WIDTH = srcpsd->xvirtres - SRCX;
+			if(SRCY + HEIGHT > srcpsd->yvirtres)
+				HEIGHT = srcpsd->yvirtres - SRCY;
+
+			GdCheckCursor(dstpsd, DSTX, DSTY, DSTX+WIDTH-1,
+				DSTY+HEIGHT-1);
+			dstpsd->Blit(dstpsd, DSTX, DSTY, WIDTH, HEIGHT,
+				srcpsd, SRCX, SRCY, rop);
+		}
+#endif /* !NEWBLIT*/
+		++prc;
+	}
+	GdFixCursor(dstpsd);
+}
+
+/*
+ * Calculate size and linelen of memory gc.
+ * If bpp or planes is 0, use passed psd's bpp/planes.
+ * Note: linelen is calculated to be DWORD aligned for speed
+ * for bpp <= 8.  Linelen is converted to bytelen for bpp > 8.
+ */
+int
+GdCalcMemGCAlloc(PSD psd, unsigned int width, unsigned int height, int planes,
+	int bpp, int *psize, int *plinelen)
+{
+	int	bytelen, linelen, tmp;
+
+	if(!planes)
+		planes = psd->planes;
+	if(!bpp)
+		bpp = psd->bpp;
+	/* 
+	 * swap width and height in portrait mode,
+	 * so imagesize is calculated properly
+	 */
+	if(psd->flags & PSF_PORTRAIT) {
+		tmp = width;
+		width = height;
+		height = tmp;
+	}
+
+	/*
+	 * use bpp and planes to create size and linelen.
+	 * linelen is in bytes for bpp 1, 2, 4, 8, and pixels for bpp 16,24,32.
+	 */
+	if(planes == 1) {
+		switch(bpp) {
+		case 1:
+			linelen = (width+7)/8;
+			bytelen = linelen = (linelen+3) & ~3;
+			break;
+		case 2:
+			linelen = (width+3)/4;
+			bytelen = linelen = (linelen+3) & ~3;
+			break;
+		case 4:
+			linelen = (width+1)/2;
+			bytelen = linelen = (linelen+3) & ~3;
+			break;
+		case 8:
+			bytelen = linelen = (width+3) & ~3;
+			break;
+		case 16:
+			linelen = width;
+			bytelen = width * 2;
+			break;
+		case 24:
+			linelen = width;
+			bytelen = width * 3;
+			break;
+		case 32:
+			linelen = width;
+			bytelen = width * 4;
+			break;
+		default:
+			return 0;
+		}
+	} else if(planes == 4) {
+		/* FIXME assumes VGA 4 planes 4bpp*/
+		/* we use 4bpp linear for memdc format*/
+		linelen = (width+1)/2;
+		linelen = (linelen+3) & ~3;
+		bytelen = linelen;
+	} else {
+		*psize = *plinelen = 0;
+		return 0;
+	}
+
+	*plinelen = linelen;
+	*psize = bytelen * height;
+	return 1;
+}
+
+/* Translate a rectangle of color values
+ *
+ * The pixels are packed according to inpixtype/outpixtype:
+ *
+ * pixtype		array of
+ * MWPF_RGB		MWCOLORVAL (unsigned long)
+ * MWPF_PIXELVAL	MWPIXELVAL (compile-time dependent)
+ * MWPF_PALETTE		unsigned char
+ * MWPF_TRUECOLOR0888	unsigned long
+ * MWPF_TRUECOLOR888	packed struct {char r,char g,char b} (24 bits)
+ * MWPF_TRUECOLOR565	unsigned short
+ * MWPF_TRUECOLOR332	unsigned char
+ */
+void
+GdTranslateArea(MWCOORD width, MWCOORD height, void *in, int inpixtype,
+	MWCOORD inpitch, void *out, int outpixtype, int outpitch)
+{
+	unsigned char *	inbuf = in;
+	unsigned char *	outbuf = out;
+	unsigned long	pixelval;
+	MWCOLORVAL	colorval;
+	MWCOORD		x, y;
+	unsigned char 	r, g, b;
+	extern MWPALENTRY gr_palette[256];
+	int	  gr_palsize = 256;	/* FIXME*/
+
+	for(y=0; y<height; ++y) {
+	    for(x=0; x<width; ++x) {
+		/* read pixel value and convert to BGR colorval (0x00BBGGRR)*/
+		switch (inpixtype) {
+		case MWPF_RGB:
+			colorval = *(MWCOLORVAL *)inbuf;
+			inbuf += sizeof(MWCOLORVAL);
+			break;
+		case MWPF_PIXELVAL:
+			pixelval = *(MWPIXELVAL *)inbuf;
+			inbuf += sizeof(MWPIXELVAL);
+			/* convert based on compile-time MWPIXEL_FORMAT*/
+#if MWPIXEL_FORMAT == MWPF_PALETTE
+			colorval = GETPALENTRY(gr_palette, pixelval);
+#else
+			colorval = PIXELVALTOCOLORVAL(pixelval);
+#endif
+			break;
+		case MWPF_PALETTE:
+			pixelval = *inbuf++;
+			colorval = GETPALENTRY(gr_palette, pixelval);
+			break;
+		case MWPF_TRUECOLOR332:
+			pixelval = *inbuf++;
+			colorval = PIXEL332TOCOLORVAL(pixelval);
+			break;
+		case MWPF_TRUECOLOR0888:
+			pixelval = *(unsigned long *)inbuf;
+			colorval = PIXEL888TOCOLORVAL(pixelval);
+			inbuf += sizeof(unsigned long);
+			break;
+		case MWPF_TRUECOLOR888:
+			r = *inbuf++;
+			g = *inbuf++;
+			b = *inbuf++;
+			colorval = (MWPIXELVAL)MWRGB(r, g, b);
+			break;
+		case MWPF_TRUECOLOR565:
+			pixelval = *(unsigned short *)inbuf;
+			colorval = PIXEL565TOCOLORVAL(pixelval);
+			inbuf += sizeof(unsigned short);
+			break;
+		default:
+			return;
+		}
+
+		/* convert from BGR colorval to desired output pixel format*/
+		switch (outpixtype) {
+		case MWPF_RGB:
+			*(MWCOLORVAL *)outbuf = colorval;
+			outbuf += sizeof(MWCOLORVAL);
+			break;
+		case MWPF_PIXELVAL:
+			/* convert based on compile-time MWPIXEL_FORMAT*/
+#if MWPIXEL_FORMAT == MWPF_PALETTE
+			*(MWPIXELVAL *)outbuf = GdFindNearestColor(gr_palette,
+					gr_palsize, colorval);
+#else
+			*(MWPIXELVAL *)outbuf = COLORVALTOPIXELVAL(colorval);
+#endif
+			outbuf += sizeof(MWPIXELVAL);
+			break;
+		case MWPF_PALETTE:
+			*outbuf++ = GdFindNearestColor(gr_palette, gr_palsize,
+					colorval);
+			break;
+		case MWPF_TRUECOLOR332:
+			*outbuf++ = COLOR2PIXEL332(colorval);
+			break;
+		case MWPF_TRUECOLOR0888:
+			*(unsigned long *)outbuf = COLOR2PIXEL888(colorval);
+			outbuf += sizeof(unsigned long);
+			break;
+		case MWPF_TRUECOLOR888:
+			*outbuf++ = REDVALUE(colorval);
+			*outbuf++ = GREENVALUE(colorval);
+			*outbuf++ = BLUEVALUE(colorval);
+			break;
+		case MWPF_TRUECOLOR565:
+			*(unsigned short *)outbuf = COLOR2PIXEL565(colorval);
+			outbuf += sizeof(unsigned short);
+			break;
+		}
+	    }
+
+	    /* adjust line widths, if necessary*/
+	    if(inpitch > width)
+		    inbuf += inpitch - width;
+	    if(outpitch > width)
+		    outbuf += outpitch - width;
+	}
+}
diff -urN lib/microwindows/src/engine/devdraw.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devdraw.c
--- lib/microwindows/src/engine/devdraw.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devdraw.c	2005-02-21 16:13:13.000000000 +0100
@@ -0,0 +1,1705 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Device-independent mid level drawing and color routines.
+ *
+ * These routines do the necessary range checking, clipping, and cursor
+ * overwriting checks, and then call the lower level device dependent
+ * routines to actually do the drawing.  The lower level routines are
+ * only called when it is known that all the pixels to be drawn are
+ * within the device area and are visible.
+ */
+/*#define NDEBUG*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "device.h"
+
+extern MWPIXELVAL gr_foreground;      /* current foreground color */
+extern MWPIXELVAL gr_background;      /* current background color */
+extern MWBOOL 	  gr_usebg;    	      /* TRUE if background drawn in pixmaps */
+extern int 	  gr_mode; 	      /* drawing mode */
+extern MWPALENTRY gr_palette[256];    /* current palette*/
+extern int	  gr_firstuserpalentry;/* first user-changable palette entry*/
+extern int 	  gr_nextpalentry;    /* next available palette entry*/
+
+/*static*/ void drawpoint(PSD psd,MWCOORD x, MWCOORD y);
+/*static*/ void drawrow(PSD psd,MWCOORD x1,MWCOORD x2,MWCOORD y);
+static void drawcol(PSD psd,MWCOORD x,MWCOORD y1,MWCOORD y2);
+static void extendrow(MWCOORD y,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,
+		MWCOORD *minxptr,MWCOORD *maxxptr);
+
+/*
+ * Set the drawing mode for future calls.
+ */
+int
+GdSetMode(int mode)
+{
+	int	oldmode = gr_mode;
+
+	gr_mode = mode;
+	return oldmode;
+}
+
+/*
+ * Set whether or not the background is used for drawing pixmaps and text.
+ */
+MWBOOL
+GdSetUseBackground(MWBOOL flag)
+{
+	MWBOOL	oldusebg = gr_usebg;
+
+	gr_usebg = flag;
+	return oldusebg;
+}
+
+/*
+ * Set the foreground color for drawing.
+ */
+MWPIXELVAL
+GdSetForeground(MWPIXELVAL fg)
+{
+	MWPIXELVAL	oldfg = gr_foreground;
+
+	gr_foreground = fg;
+	return oldfg;
+}
+
+/*
+ * Set the background color for bitmap and text backgrounds.
+ */
+MWPIXELVAL
+GdSetBackground(MWPIXELVAL bg)
+{
+	MWPIXELVAL	oldbg = gr_background;
+
+	gr_background = bg;
+	return oldbg;
+}
+
+/*
+ * Draw a point using the current clipping region and foreground color.
+ */
+void
+GdPoint(PSD psd, MWCOORD x, MWCOORD y)
+{
+	if (GdClipPoint(psd, x, y)) {
+		psd->DrawPixel(psd, x, y, gr_foreground);
+		GdFixCursor(psd);
+	}
+}
+
+/*
+ * Draw an arbitrary line using the current clipping region and foreground color
+ * If bDrawLastPoint is FALSE, draw up to but not including point x2, y2.
+ *
+ * This routine is the only routine that adjusts coordinates for supporting
+ * two different types of upper levels, those that draw the last point
+ * in a line, and those that draw up to the last point.  All other local
+ * routines draw the last point.  This gives this routine a bit more overhead,
+ * but keeps overall complexity down.
+ */
+void
+GdLine(PSD psd, MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2,
+	MWBOOL bDrawLastPoint)
+{
+  int xdelta;			/* width of rectangle around line */
+  int ydelta;			/* height of rectangle around line */
+  int xinc;			/* increment for moving x coordinate */
+  int yinc;			/* increment for moving y coordinate */
+  int rem;			/* current remainder */
+  MWCOORD temp;
+
+  /* See if the line is horizontal or vertical. If so, then call
+   * special routines.
+   */
+  if (y1 == y2) {
+	/*
+	 * Adjust coordinates if not drawing last point.  Tricky.
+	 */
+	if(!bDrawLastPoint) {
+		if (x1 > x2) {
+			temp = x1;
+			x1 = x2 + 1;
+			x2 = temp;
+		} else
+			--x2;
+	}
+
+	/* call faster line drawing routine*/
+	drawrow(psd, x1, x2, y1);
+	GdFixCursor(psd);
+	return;
+  }
+  if (x1 == x2) {
+	/*
+	 * Adjust coordinates if not drawing last point.  Tricky.
+	 */
+	if(!bDrawLastPoint) {
+		if (y1 > y2) {
+			temp = y1;
+			y1 = y2 + 1;
+			y2 = temp;
+		} else
+			--y2;
+	}
+
+	/* call faster line drawing routine*/
+	drawcol(psd, x1, y1, y2);
+	GdFixCursor(psd);
+	return;
+  }
+
+  /* See if the line is either totally visible or totally invisible. If
+   * so, then the line drawing is easy.
+   */
+  switch (GdClipArea(psd, x1, y1, x2, y2)) {
+      case CLIP_VISIBLE:
+	/*
+	 * For size considerations, there's no low-level bresenham
+	 * line draw, so we've got to draw all non-vertical
+	 * and non-horizontal lines with per-point
+	 * clipping for the time being
+	psd->Line(psd, x1, y1, x2, y2, gr_foreground);
+	GdFixCursor(psd);
+	return;
+	 */
+	break;
+      case CLIP_INVISIBLE:
+	return;
+  }
+
+  /* The line may be partially obscured. Do the draw line algorithm
+   * checking each point against the clipping regions.
+   */
+  xdelta = x2 - x1;
+  ydelta = y2 - y1;
+  if (xdelta < 0) xdelta = -xdelta;
+  if (ydelta < 0) ydelta = -ydelta;
+  xinc = (x2 > x1) ? 1 : -1;
+  yinc = (y2 > y1) ? 1 : -1;
+  if (GdClipPoint(psd, x1, y1))
+	  psd->DrawPixel(psd, x1, y1, gr_foreground);
+  if (xdelta >= ydelta) {
+	rem = xdelta / 2;
+	for(;;) {
+		if(!bDrawLastPoint && x1 == x2)
+			break;
+		x1 += xinc;
+		rem += ydelta;
+		if (rem >= xdelta) {
+			rem -= xdelta;
+			y1 += yinc;
+		}
+		if (GdClipPoint(psd, x1, y1))
+			psd->DrawPixel(psd, x1, y1, gr_foreground);
+		if(bDrawLastPoint && x1 == x2)
+			break;
+	}
+  } else {
+	rem = ydelta / 2;
+	for(;;) {
+		if(!bDrawLastPoint && y1 == y2)
+			break;
+		y1 += yinc;
+		rem += xdelta;
+		if (rem >= ydelta) {
+			rem -= ydelta;
+			x1 += xinc;
+		}
+		if (GdClipPoint(psd, x1, y1))
+			psd->DrawPixel(psd, x1, y1, gr_foreground);
+		if(bDrawLastPoint && y1 == y2)
+			break;
+	}
+  }
+  GdFixCursor(psd);
+}
+
+/* Draw a point in the foreground color, applying clipping if necessary*/
+/*static*/ void
+drawpoint(PSD psd, MWCOORD x, MWCOORD y)
+{
+	if (GdClipPoint(psd, x, y))
+		psd->DrawPixel(psd, x, y, gr_foreground);
+}
+
+/* Draw a horizontal line from x1 to and including x2 in the
+ * foreground color, applying clipping if necessary.
+ */
+/*static*/ void
+drawrow(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y)
+{
+  MWCOORD temp;
+
+  /* reverse endpoints if necessary*/
+  if (x1 > x2) {
+	temp = x1;
+	x1 = x2;
+	x2 = temp;
+  }
+
+  /* clip to physical device*/
+  if (x1 < 0)
+	  x1 = 0;
+  if (x2 >= psd->xvirtres)
+	  x2 = psd->xvirtres - 1;
+
+  /* check cursor intersect once for whole line*/
+  GdCheckCursor(psd, x1, y, x2, y);
+
+  while (x1 <= x2) {
+	if (GdClipPoint(psd, x1, y)) {
+		temp = MWMIN(clipmaxx, x2);
+		psd->DrawHorzLine(psd, x1, temp, y, gr_foreground);
+	} else
+		temp = MWMIN(clipmaxx, x2);
+	x1 = temp + 1;
+  }
+}
+
+/* Draw a vertical line from y1 to and including y2 in the
+ * foreground color, applying clipping if necessary.
+ */
+static void
+drawcol(PSD psd, MWCOORD x,MWCOORD y1,MWCOORD y2)
+{
+  MWCOORD temp;
+
+  /* reverse endpoints if necessary*/
+  if (y1 > y2) {
+	temp = y1;
+	y1 = y2;
+	y2 = temp;
+  }
+
+  /* clip to physical device*/
+  if (y1 < 0)
+	  y1 = 0;
+  if (y2 >= psd->yvirtres)
+	  y2 = psd->yvirtres - 1;
+
+  /* check cursor intersect once for whole line*/
+  GdCheckCursor(psd, x, y1, x, y2);
+
+  while (y1 <= y2) {
+	if (GdClipPoint(psd, x, y1)) {
+		temp = MWMIN(clipmaxy, y2);
+		psd->DrawVertLine(psd, x, y1, temp, gr_foreground);
+	} else
+		temp = MWMIN(clipmaxy, y2);
+	y1 = temp + 1;
+  }
+}
+
+/* Draw a rectangle in the foreground color, applying clipping if necessary.
+ * This is careful to not draw points multiple times in case the rectangle
+ * is being drawn using XOR.
+ */
+void
+GdRect(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height)
+{
+  MWCOORD maxx;
+  MWCOORD maxy;
+
+  if (width <= 0 || height <= 0)
+	  return;
+  maxx = x + width - 1;
+  maxy = y + height - 1;
+  drawrow(psd, x, maxx, y);
+  if (height > 1)
+	  drawrow(psd, x, maxx, maxy);
+  if (height < 3)
+	  return;
+  y++;
+  maxy--;
+  drawcol(psd, x, y, maxy);
+  if (width > 1)
+	  drawcol(psd, maxx, y, maxy);
+  GdFixCursor(psd);
+}
+
+/* Draw a filled in rectangle in the foreground color, applying
+ * clipping if necessary.
+ */
+void
+GdFillRect(PSD psd, MWCOORD x1, MWCOORD y1, MWCOORD width, MWCOORD height)
+{
+  MWCOORD x2 = x1+width-1;
+  MWCOORD y2 = y1+height-1;
+
+  if (width <= 0 || height <= 0)
+	  return;
+
+  /* See if the rectangle is either totally visible or totally
+   * invisible. If so, then the rectangle drawing is easy.
+   */
+  switch (GdClipArea(psd, x1, y1, x2, y2)) {
+      case CLIP_VISIBLE:
+	psd->FillRect(psd, x1, y1, x2, y2, gr_foreground);
+	GdFixCursor(psd);
+	return;
+
+      case CLIP_INVISIBLE:
+	return;
+  }
+
+  /* The rectangle may be partially obstructed. So do it line by line. */
+  while (y1 <= y2)
+	  drawrow(psd, x1, x2, y1++);
+  GdFixCursor(psd);
+}
+
+/*
+ * Draw a rectangular area using the current clipping region and the
+ * specified bit map.  This differs from rectangle drawing in that the
+ * rectangle is drawn using the foreground color and possibly the background
+ * color as determined by the bit map.  Each row of bits is aligned to the
+ * next bitmap word boundary (so there is padding at the end of the row).
+ * The background bit values are only written if the gr_usebg flag
+ * is set.
+ */
+void
+GdBitmap(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height,
+	MWIMAGEBITS *imagebits)
+{
+  MWCOORD minx;
+  MWCOORD maxx;
+  MWPIXELVAL savecolor;		/* saved foreground color */
+  MWIMAGEBITS bitvalue = 0;	/* bitmap word value */
+  int bitcount;			/* number of bits left in bitmap word */
+
+  switch (GdClipArea(psd, x, y, x + width - 1, y + height - 1)) {
+      case CLIP_VISIBLE:
+	/*
+	 * For size considerations, there's no low-level bitmap
+	 * draw so we've got to draw everything with per-point
+	 * clipping for the time being.
+	if (gr_usebg)
+		psd->FillRect(psd, x, y, x + width - 1, y + height - 1,
+			gr_background);
+	psd->DrawBitmap(psd, x, y, width, height, imagebits, gr_foreground);
+	return;
+	*/
+	break;
+
+      case CLIP_INVISIBLE:
+	return;
+  }
+
+  /* The rectangle is partially visible, so must do clipping. First
+   * fill a rectangle in the background color if necessary.
+   */
+  if (gr_usebg) {
+	savecolor = gr_foreground;
+	gr_foreground = gr_background;
+	/* note: change to fillrect*/
+	GdFillRect(psd, x, y, width, height);
+	gr_foreground = savecolor;
+  }
+  minx = x;
+  maxx = x + width - 1;
+  bitcount = 0;
+  while (height > 0) {
+	if (bitcount <= 0) {
+		bitcount = MWIMAGE_BITSPERIMAGE;
+		bitvalue = *imagebits++;
+	}
+	if (MWIMAGE_TESTBIT(bitvalue) && GdClipPoint(psd, x, y))
+		psd->DrawPixel(psd, x, y, gr_foreground);
+	bitvalue = MWIMAGE_SHIFTBIT(bitvalue);
+	bitcount--;
+	if (x++ == maxx) {
+		x = minx;
+		y++;
+		height--;
+		bitcount = 0;
+	}
+  }
+  GdFixCursor(psd);
+}
+
+/*
+ * Return true if color is in palette
+ */
+MWBOOL
+GdColorInPalette(MWCOLORVAL cr,MWPALENTRY *palette,int palsize)
+{
+	int	i;
+
+	for(i=0; i<palsize; ++i)
+		if(GETPALENTRY(palette, i) == cr)
+			return TRUE;
+	return FALSE;
+}
+
+/*
+ * Create a MWPIXELVAL conversion table between the passed palette
+ * and the in-use palette.  The system palette is loaded/merged according
+ * to fLoadType.
+ */
+void
+GdMakePaletteConversionTable(PSD psd,MWPALENTRY *palette,int palsize,
+	MWPIXELVAL *convtable,int fLoadType)
+{
+	int		i;
+	MWCOLORVAL	cr;
+	int		newsize, nextentry;
+	MWPALENTRY	newpal[256];
+
+	/*
+	 * Check for load palette completely, or add colors
+	 * from passed palette to system palette until full.
+	 */
+	if(psd->pixtype == MWPF_PALETTE) {
+	    switch(fLoadType) {
+	    case LOADPALETTE:
+		/* Load palette from beginning with image's palette.
+		 * First palette entries are Microwindows colors
+		 * and not changed.
+		 */
+		GdSetPalette(psd, gr_firstuserpalentry, palsize, palette);
+		break;
+
+	    case MERGEPALETTE:
+		/* get system palette*/
+		for(i=0; i<(int)psd->ncolors; ++i)
+			newpal[i] = gr_palette[i];
+
+		/* merge passed palette into system palette*/
+		newsize = 0;
+		nextentry = gr_nextpalentry;
+
+		/* if color missing and there's room, add it*/
+		for(i=0; i<palsize && nextentry < (int)psd->ncolors; ++i) {
+			cr = GETPALENTRY(palette, i);
+			if(!GdColorInPalette(cr, newpal, nextentry)) {
+				newpal[nextentry++] = palette[i];
+				++newsize;
+			}
+		}
+
+		/* set the new palette if any color was added*/
+		if(newsize) {
+			GdSetPalette(psd, gr_nextpalentry, newsize,
+				&newpal[gr_nextpalentry]);
+			gr_nextpalentry += newsize;
+		}
+		break;
+	    }
+	}
+
+	/*
+	 * Build conversion table from inuse system palette and
+	 * passed palette.  This will load RGB values directly
+	 * if running truecolor, otherwise it will find the
+	 * nearest color from the inuse palette.
+	 * FIXME: tag the conversion table to the bitmap image
+	 */
+	for(i=0; i<palsize; ++i) {
+		cr = GETPALENTRY(palette, i);
+		convtable[i] = GdFindColor(cr);
+	}
+}
+
+/*
+ * Draw a color bitmap image in 1, 4, 8, 24 or 32 bits per pixel.  The
+ * Microwindows color image format is DWORD padded bytes, with
+ * the upper bits corresponding to the left side (identical to 
+ * the MS Windows format).  This format is currently different
+ * than the MWIMAGEBITS format, which uses word-padded bits
+ * for monochrome display only, where the upper bits in the word
+ * correspond with the left side.
+ */
+void
+GdDrawImage(PSD psd, MWCOORD x, MWCOORD y, PMWIMAGEHDR pimage)
+{
+  MWCOORD minx;
+  MWCOORD maxx;
+  MWUCHAR bitvalue = 0;
+  int bitcount;
+  MWUCHAR *imagebits;
+  MWCOORD	height, width;
+  MWPIXELVAL pixel;
+  int clip;
+  int extra, linesize;
+  int	rgborder;
+  MWCOLORVAL cr;
+  MWCOORD yoff;
+  unsigned long transcolor;
+  MWPIXELVAL convtable[256];
+
+  height = pimage->height;
+  width = pimage->width;
+
+  /* determine if entire image is clipped out, save clipresult for later*/
+  clip = GdClipArea(psd, x, y, x + width - 1, y + height - 1);
+  if(clip == CLIP_INVISIBLE)
+	return;
+
+  transcolor = pimage->transcolor;
+
+  /*
+   * Merge the images's palette and build a palette index conversion table.
+   */
+  if (pimage->bpp <= 8) {
+	if(!pimage->palette) {
+		/* for jpeg's without a palette*/
+		for(yoff=0; yoff<pimage->palsize; ++yoff)
+			convtable[yoff] = yoff;
+	} else GdMakePaletteConversionTable(psd, pimage->palette,
+		pimage->palsize, convtable, MERGEPALETTE);
+
+	/* The following is no longer used.  One reason is that it required */
+	/* the transparent color to be unique, which was unnessecary        */
+
+	/* convert transcolor to converted palette index for speed*/
+	/* if (transcolor != -1L)
+	   transcolor = (unsigned long) convtable[transcolor];  */
+  }
+
+  minx = x;
+  maxx = x + width - 1;
+  imagebits = pimage->imagebits;
+
+  /* check for bottom-up image*/
+  if(pimage->compression & MWIMAGE_UPSIDEDOWN) {
+	y += height - 1;
+	yoff = -1;
+  } else
+	yoff = 1;
+
+#define PIX2BYTES(n)	(((n)+7)/8)
+  /* imagebits are dword aligned*/
+  switch(pimage->bpp) {
+  default:
+  case 8:
+	linesize = width;
+	break;
+  case 32:
+	linesize = width*4;
+	break;
+  case 24:
+	linesize = width*3;
+	break;
+  case 4:
+	linesize = PIX2BYTES(width<<2);
+	break;
+  case 1:
+	linesize = PIX2BYTES(width);
+	break;
+  }
+  extra = pimage->pitch - linesize;
+
+  /* 24bpp RGB rather than BGR byte order?*/
+  rgborder = pimage->compression & MWIMAGE_RGB; 
+
+  bitcount = 0;
+  while(height > 0) {
+	unsigned long trans = 0;
+
+	if (bitcount <= 0) {
+		bitcount = sizeof(MWUCHAR) * 8;
+		bitvalue = *imagebits++;
+	}
+	switch(pimage->bpp) {
+	case 24:
+	case 32:
+		cr = rgborder? MWRGB(bitvalue, imagebits[0], imagebits[1]):
+			MWRGB(imagebits[1], imagebits[0], bitvalue);
+                 
+		/* Include the upper bits for transcolor stuff */
+		if (imagebits[2])	// FIXME: 24bpp error
+		    trans = cr | 0x01000000L;
+
+		if (pimage->bpp == 32)
+			imagebits += 3;
+		else imagebits += 2;
+		bitcount = 0;
+
+		/* handle transparent color*/
+		if (transcolor == trans)
+		    goto next;
+
+		switch(psd->pixtype) {
+		case MWPF_PALETTE:
+		default:
+			pixel = GdFindColor(cr);
+			break;
+		case MWPF_TRUECOLOR0888:
+		case MWPF_TRUECOLOR888:
+			pixel = COLOR2PIXEL888(cr);
+			break;
+		case MWPF_TRUECOLOR565:
+			pixel = COLOR2PIXEL565(cr);
+			break;
+		case MWPF_TRUECOLOR555:
+			pixel = COLOR2PIXEL555(cr);
+			break;
+		case MWPF_TRUECOLOR332:
+			pixel = COLOR2PIXEL332(cr);
+			break;
+		}
+		break;
+	default:
+	case 8:
+	  bitcount = 0;
+	  if (bitvalue == transcolor)
+	      goto next;
+
+	  pixel = convtable[bitvalue];
+	  break;
+	case 4:
+	  if (((bitvalue & 0xf0) >> 4) == transcolor) {
+	       bitvalue <<= 4;
+	       bitcount -= 4;
+	       goto next;
+	  }
+
+	  pixel = convtable[(bitvalue & 0xf0) >> 4];
+	  bitvalue <<= 4;
+	  bitcount -= 4;
+	  break;
+	case 1:
+	  --bitcount;
+	  if (((bitvalue & 0x80) ? 1 : 0) == transcolor) {
+	      bitvalue <<= 1;
+	      goto next;
+	    }
+	
+	  pixel = convtable[(bitvalue & 0x80)? 1: 0];
+	  bitvalue <<= 1;
+	  break;
+	}
+
+	/* if((unsigned long)pixel != transcolor &&*/
+	if (clip == CLIP_VISIBLE || GdClipPoint(psd, x, y))
+	    psd->DrawPixel(psd, x, y, pixel);
+#if 0
+	/* fix: use clipmaxx to clip quicker*/
+	else if(clip != CLIP_VISIBLE && !clipresult && x > clipmaxx) {
+		x = maxx;
+	}
+#endif
+next:
+	if(x++ == maxx) {
+		x = minx;
+		y += yoff;
+		height--;
+		bitcount = 0;
+		imagebits += extra;
+	}
+  }
+  GdFixCursor(psd);
+}
+
+/* Draw a polygon in the foreground color, applying clipping if necessary.
+ * The polygon is only closed if the first point is repeated at the end.
+ * Some care is taken to plot the endpoints correctly if the current
+ * drawing mode is XOR.  However, internal crossings are not handled
+ * correctly.
+ */
+void
+GdPoly(PSD psd, int count, MWPOINT *points)
+{
+  MWCOORD firstx;
+  MWCOORD firsty;
+  MWBOOL didline;
+
+  if (count < 2)
+	  return;
+  firstx = points->x;
+  firsty = points->y;
+  didline = FALSE;
+
+  while (count-- > 1) {
+	if (didline && (gr_mode == MWMODE_XOR))
+		drawpoint(psd, points->x, points->y);
+	/* note: change to drawline*/
+	GdLine(psd, points[0].x, points[0].y, points[1].x, points[1].y, TRUE);
+	points++;
+	didline = TRUE;
+  }
+  if (gr_mode == MWMODE_XOR) {
+	  points--;
+	  if (points->x == firstx && points->y == firsty)
+		drawpoint(psd, points->x, points->y);
+  }
+  GdFixCursor(psd);
+}
+
+#if 1	/* correct polygon fill, uses malloc, qsort*/
+/*
+ * Fill a polygon in the foreground color, applying clipping if necessary.
+ * The last point may be a duplicate of the first point, but this is
+ * not required.
+ * Note: this routine correctly draws convex, concave, regular, 
+ * and irregular polygons.
+ */
+#define USE_FLOAT	0	/* HAVEFLOAT set this to use floating point*/
+
+#define swap(a,b) do { a ^= b; b ^= a; a ^= b; } while (0)
+
+typedef struct {
+	int     x1, y1, x2, y2;
+#if USE_FLOAT
+	double  x, m;
+#else
+	int     cx, fn, mn, d;
+#endif
+} edge_t;
+
+static int 
+edge_cmp(const void *lvp, const void *rvp)
+{
+	/* convert from void pointers to structure pointers */
+	const edge_t *lp = (const edge_t *)lvp;
+	const edge_t *rp = (const edge_t *)rvp;
+
+	/* if the minimum y values are different, sort on minimum y */
+	if (lp->y1 != rp->y1)
+		return lp->y1 - rp->y1;
+
+	/* if the current x values are different, sort on current x */
+#if USE_FLOAT
+	if (lp->x < rp->x)
+		return -1;
+	else if (lp->x > rp->x)
+		return +1;
+#else
+	if (lp->cx != rp->cx)
+		return lp->cx - rp->cx;
+#endif
+
+	/* otherwise they are equal */
+	return 0;
+}
+
+void
+GdFillPoly(PSD psd, int count, MWPOINT * pointtable)
+{
+	edge_t *get;		/* global edge table */
+	int     nge = 0;	/* num global edges */
+	int     cge = 0;	/* cur global edge */
+
+	edge_t *aet;		/* active edge table */
+	int     nae = 0;	/* num active edges */
+
+	int     i, y;
+
+	if (count < 3) {
+		/* error, polygons require at least three edges (a triangle) */
+		return;
+	}
+	get = (edge_t *) calloc(count, sizeof(edge_t));
+	aet = (edge_t *) calloc(count, sizeof(edge_t));
+
+	if ((get == 0) || (aet == 0)) {
+		/* error, couldn't allocate one or both of the needed tables */
+		if (get)
+			free(get);
+		if (aet)
+			free(aet);
+		return;
+	}
+	/* setup the global edge table */
+	for (i = 0; i < count; ++i) {
+		get[nge].x1 = pointtable[i].x;
+		get[nge].y1 = pointtable[i].y;
+		get[nge].x2 = pointtable[(i + 1) % count].x;
+		get[nge].y2 = pointtable[(i + 1) % count].y;
+		if (get[nge].y1 != get[nge].y2) {
+			if (get[nge].y1 > get[nge].y2) {
+				swap(get[nge].x1, get[nge].x2);
+				swap(get[nge].y1, get[nge].y2);
+			}
+#if USE_FLOAT
+			get[nge].x = get[nge].x1;
+			get[nge].m = get[nge].x2 - get[nge].x1;
+			get[nge].m /= get[nge].y2 - get[nge].y1;
+#else
+			get[nge].cx = get[nge].x1;
+			get[nge].mn = get[nge].x2 - get[nge].x1;
+			get[nge].d = get[nge].y2 - get[nge].y1;
+			get[nge].fn = get[nge].mn / 2;
+#endif
+			++nge;
+		}
+	}
+
+	qsort(get, nge, sizeof(get[0]), edge_cmp);
+
+	/* start with the lowest y in the table */
+	y = get[0].y1;
+
+	do {
+
+		/* add edges to the active table from the global table */
+		while ((nge > 0) && (get[cge].y1 == y)) {
+			aet[nae] = get[cge++];
+			--nge;
+			aet[nae++].y1 = 0;
+		}
+
+		qsort(aet, nae, sizeof(aet[0]), edge_cmp);
+
+		/* using odd parity, render alternating line segments */
+		for (i = 1; i < nae; i += 2) {
+#if USE_FLOAT
+			int     l = (int)aet[i - 1].x;
+			int     r = (int)aet[i].x;
+#else
+			int     l = (int)aet[i - 1].cx;
+			int     r = (int)aet[i].cx;
+#endif
+			if (r > l)
+				drawrow(psd, l, r - 1, y);
+		}
+
+		/* prepare for the next scan line */
+		++y;
+
+		/* remove inactive edges from the active edge table */
+		/* or update the current x position of active edges */
+		for (i = 0; i < nae; ++i) {
+			if (aet[i].y2 == y)
+				aet[i--] = aet[--nae];
+			else {
+#if USE_FLOAT
+				aet[i].x += aet[i].m;
+#else
+				aet[i].fn += aet[i].mn;
+				if (aet[i].fn < 0) {
+					aet[i].cx += aet[i].fn / aet[i].d - 1;
+					aet[i].fn %= aet[i].d;
+					aet[i].fn += aet[i].d;
+				}
+				if (aet[i].fn >= aet[i].d) {
+					aet[i].cx += aet[i].fn / aet[i].d;
+					aet[i].fn %= aet[i].d;
+				}
+#endif
+			}
+		}
+
+		/* keep doing this while there are any edges left */
+	} while ((nae > 0) || (nge > 0));
+
+	/* all done, free the edge tables */
+	free(get);
+	free(aet);
+
+	GdFixCursor(psd);
+}
+#else
+/*
+ * Fill a polygon in the foreground color, applying clipping if necessary.
+ * The last point may be a duplicate of the first point, but this is
+ * not required.
+ * Note: this routine currently only correctly fills convex polygons.
+ */
+void
+GdFillPoly(PSD psd, int count, MWPOINT *points)
+{
+  MWPOINT *pp;		/* current point */
+  MWCOORD miny;		/* minimum row */
+  MWCOORD maxy;		/* maximum row */
+  MWCOORD minx;		/* minimum column */
+  MWCOORD maxx;		/* maximum column */
+  int i;		/* counter */
+
+  if (count <= 0)
+	  return;
+
+  /* First determine the minimum and maximum rows for the polygon. */
+  pp = points;
+  miny = pp->y;
+  maxy = pp->y;
+  for (i = count; i-- > 0; pp++) {
+	if (miny > pp->y) miny = pp->y;
+	if (maxy < pp->y) maxy = pp->y;
+  }
+  if (miny < 0)
+	  miny = 0;
+  if (maxy >= psd->yvirtres)
+	  maxy = psd->yvirtres - 1;
+  if (miny > maxy)
+	  return;
+
+  /* Now for each row, scan the list of points and determine the
+   * minimum and maximum x coordinate for each line, and plot the row.
+   * The last point connects with the first point automatically.
+   */
+  for (; miny <= maxy; miny++) {
+	minx = MAX_MWCOORD;
+	maxx = MIN_MWCOORD;
+	pp = points;
+	for (i = count; --i > 0; pp++)
+		extendrow(miny, pp[0].x, pp[0].y, pp[1].x, pp[1].y,
+			&minx, &maxx);
+	extendrow(miny, pp[0].x, pp[0].y, points[0].x, points[0].y,
+		&minx, &maxx);
+
+	if (minx <= maxx)
+		drawrow(psd, minx, maxx, miny);
+  }
+  GdFixCursor(psd);
+}
+#endif
+
+/* Utility routine for filling polygons.  Find the intersection point (if
+ * any) of a horizontal line with an arbitrary line, and extend the current
+ * minimum and maximum x values as needed to include the intersection point.
+ * Input parms:
+ *	y 	row to check for intersection
+ *	x1, y1	first endpoint
+ *	x2, y2	second enpoint
+ *	minxptr	address of current minimum x
+ *	maxxptr	address of current maximum x
+ */
+static void
+extendrow(MWCOORD y,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,
+	MWCOORD *minxptr,MWCOORD *maxxptr)
+{
+  MWCOORD x;			/* x coordinate of intersection */
+  typedef long NUM;
+  NUM num;			/* numerator of fraction */
+
+  /* First make sure the specified line segment includes the specified
+   * row number.  If not, then there is no intersection.
+   */
+  if (((y < y1) || (y > y2)) && ((y < y2) || (y > y1)))
+	return;
+
+  /* If a horizontal line, then check the two endpoints. */
+  if (y1 == y2) {
+	if (*minxptr > x1) *minxptr = x1;
+	if (*minxptr > x2) *minxptr = x2;
+	if (*maxxptr < x1) *maxxptr = x1;
+	if (*maxxptr < x2) *maxxptr = x2;
+	return;
+  }
+
+  /* If a vertical line, then check the x coordinate. */
+  if (x1 == x2) {
+	if (*minxptr > x1) *minxptr = x1;
+	if (*maxxptr < x1) *maxxptr = x1;
+	return;
+  }
+
+  /* An arbitrary line.  Calculate the intersection point using the
+   * formula x = x1 + (y - y1) * (x2 - x1) / (y2 - y1).
+   */
+  num = ((NUM) (y - y1)) * (x2 - x1);
+  x = x1 + num / (y2 - y1);
+  if (*minxptr > x) *minxptr = x;
+  if (*maxxptr < x) *maxxptr = x;
+}
+
+/*
+ * Read a rectangular area of the screen.  
+ * The color table is indexed row by row.
+ */
+void
+GdReadArea(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height,
+	MWPIXELVAL *pixels)
+{
+	MWCOORD 		row;
+	MWCOORD 		col;
+
+	if (width <= 0 || height <= 0)
+		return;
+
+	GdCheckCursor(psd, x, y, x+width-1, y+height-1);
+	for (row = 0; row < height; row++)
+		for (col = 0; col < width; col++)
+			*pixels++ = psd->ReadPixel(psd, x + col, y + row);
+
+	GdFixCursor(psd);
+}
+
+/* Draw a rectangle of color values, clipping if necessary.
+ * If a color matches the background color,
+ * then that pixel is only drawn if the gr_usebg flag is set.
+ *
+ * The pixels are packed according to pixtype:
+ *
+ * pixtype		array of
+ * MWPF_RGB		MWCOLORVAL (unsigned long)
+ * MWPF_PIXELVAL	MWPIXELVAL (compile-time dependent)
+ * MWPF_PALETTE		unsigned char
+ * MWPF_TRUECOLOR0888	unsigned long
+ * MWPF_TRUECOLOR888	packed struct {char r,char g,char b} (24 bits)
+ * MWPF_TRUECOLOR565	unsigned short
+ * MWPF_TRUECOLOR555	unsigned short
+ * MWPF_TRUECOLOR332	unsigned char
+ *
+ * NOTE: Currently, no translation is performed if the pixtype
+ * is not MWPF_RGB.  Pixtype is only then used to determine the 
+ * packed size of the pixel data, and is then stored unmodified
+ * in a MWPIXELVAL and passed to the screen driver.  Virtually,
+ * this means there's only three reasonable options for client
+ * programs: (1) pass all data as RGB MWCOLORVALs, (2) pass
+ * data as unpacked 32-bit MWPIXELVALs in the format the current
+ * screen driver is running, or (3) pass data as packed values
+ * in the format the screen driver is running.  Options 2 and 3
+ * are identical except for the packing structure.
+ */
+void
+GdArea(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height, void *pixels,
+	int pixtype)
+{
+	unsigned char *PIXELS = pixels;	/* for ANSI compilers, can't use void*/
+	long cellstodo;			/* remaining number of cells */
+	long count;			/* number of cells of same color */
+	long cc;			/* current cell count */
+	long rows;			/* number of complete rows */
+	MWCOORD minx;			/* minimum x value */
+	MWCOORD maxx;			/* maximum x value */
+	MWPIXELVAL savecolor;		/* saved foreground color */
+	MWBOOL dodraw;			/* TRUE if draw these points */
+	MWCOLORVAL rgbcolor = 0L;
+	int pixsize;
+	unsigned char r, g, b;
+	driver_gc_t hwgc;
+	int px1, px2, py1, py2, pw, ph, rx1, rx2, ry1, ry2;
+#if DYNAMICREGIONS
+	MWRECT *prc;
+	extern MWCLIPREGION *clipregion;
+#else
+	MWCLIPRECT *prc;
+	extern MWCLIPRECT cliprects[];
+	extern int clipcount;
+#endif
+
+	minx = x;
+	maxx = x + width - 1;
+
+	hwgc.pixels = PIXELS;
+	hwgc.src_linelen = width;
+	hwgc.gr_usebg = gr_usebg;
+	hwgc.bg_color = gr_background;
+
+	/* Set up area clipping, and just return if nothing is visible */
+	if ( GdClipArea(psd, minx, y, maxx, y + height - 1) == CLIP_INVISIBLE )
+		return;
+
+#if HAVE_T1LIB_SUPPORT | HAVE_FREETYPE_SUPPORT
+	/* can't use drawarea driver in 16 bpp mode yet with font routines*/
+	goto fallback;
+#endif
+	if ( !(psd->flags & PSF_HAVEOP_COPY) )
+		goto fallback;
+
+#if DYNAMICREGIONS
+	prc = clipregion->rects;
+	count = clipregion->numRects;
+#else
+	prc = cliprects;
+	count = clipcount;
+#endif
+
+	while ( count-- > 0 ) {
+#if DYNAMICREGIONS
+		rx1 = prc->left;
+		ry1 = prc->top;
+		rx2 = prc->right;
+		ry2 = prc->bottom;
+#else
+		/* New clip-code by Morten */
+		rx1 = prc->x;
+		ry1 = prc->y;
+		rx2 = prc->x + prc->width;
+		ry2 = prc->y + prc->height;
+#endif
+
+		/* Check if this rect intersects with the one we draw */
+		px1 = x;
+		py1 = y;
+		px2 = x + width;
+		py2 = y + height;
+		if ( px1 < rx1 ) px1 = rx1;
+		if ( py1 < ry1 ) py1 = ry1;
+		if ( px2 > rx2 ) px2 = rx2;
+		if ( py2 > ry2 ) py2 = ry2;
+
+		pw = px2 - px1;
+		ph = py2 - py1;
+
+		if ( pw > 0 && ph > 0 ) {
+			hwgc.dstx = px1;
+			hwgc.dsty = py1;
+			hwgc.dstw = pw;
+			hwgc.dsth = ph;
+			hwgc.srcx = px1 - x;
+			hwgc.srcy = py1 - y;
+			GdCheckCursor(psd,px1,py1,px1+pw-1,py1+ph-1);
+			psd->DrawArea(psd,&hwgc,PSDOP_COPY);
+		}
+		prc++;
+	}
+	GdFixCursor(psd);
+	return;
+
+ fallback:
+
+	/* Calculate size of packed pixels*/
+	switch(pixtype) {
+	case MWPF_RGB:
+		pixsize = sizeof(MWCOLORVAL);
+		break;
+	case MWPF_PIXELVAL:
+		pixsize = sizeof(MWPIXELVAL);
+		break;
+	case MWPF_PALETTE:
+	case MWPF_TRUECOLOR332:
+		pixsize = sizeof(unsigned char);
+		break;
+	case MWPF_TRUECOLOR0888:
+		pixsize = sizeof(unsigned long);
+		break;
+	case MWPF_TRUECOLOR888:
+		pixsize = 3;
+		break;
+	case MWPF_TRUECOLOR565:
+	case MWPF_TRUECOLOR555:
+		pixsize = sizeof(unsigned short);
+		break;
+	default:
+		return;
+	}
+
+  savecolor = gr_foreground;
+  cellstodo = (long)width * height;
+  while (cellstodo > 0) {
+	/* read the pixel value from the pixtype*/
+	switch(pixtype) {
+	case MWPF_RGB:
+		rgbcolor = *(MWCOLORVAL *)PIXELS;
+		PIXELS += sizeof(MWCOLORVAL);
+		gr_foreground = GdFindColor(rgbcolor);
+		break;
+	case MWPF_PIXELVAL:
+		gr_foreground = *(MWPIXELVAL *)PIXELS;
+		PIXELS += sizeof(MWPIXELVAL);
+		break;
+	case MWPF_PALETTE:
+	case MWPF_TRUECOLOR332:
+		gr_foreground = *PIXELS++;
+		break;
+	case MWPF_TRUECOLOR0888:
+		gr_foreground = *(unsigned long *)PIXELS;
+		PIXELS += sizeof(unsigned long);
+		break;
+	case MWPF_TRUECOLOR888:
+		r = *PIXELS++;
+		g = *PIXELS++;
+		b = *PIXELS++;
+		gr_foreground = (MWPIXELVAL)MWRGB(r, g, b);
+		break;
+	case MWPF_TRUECOLOR565:
+	case MWPF_TRUECOLOR555:
+		gr_foreground = *(unsigned short *)PIXELS;
+		PIXELS += sizeof(unsigned short);
+		break;
+	}
+	dodraw = (gr_usebg || (gr_foreground != gr_background));
+	count = 1;
+	--cellstodo;
+
+	/* See how many of the adjacent remaining points have the
+	 * same color as the next point.
+	 *
+	 * NOTE: Yes, with the addition of the pixel unpacking,
+	 * it's almost slower to look ahead than to just draw
+	 * the pixel...  FIXME
+	 */
+	while (cellstodo > 0) {
+		switch(pixtype) {
+		case MWPF_RGB:
+			if(rgbcolor != *(MWCOLORVAL *)PIXELS)
+				goto breakwhile;
+			PIXELS += sizeof(MWCOLORVAL);
+			break;
+		case MWPF_PIXELVAL:
+			if(gr_foreground != *(MWPIXELVAL *)PIXELS)
+				goto breakwhile;
+			PIXELS += sizeof(MWPIXELVAL);
+			break;
+		case MWPF_PALETTE:
+		case MWPF_TRUECOLOR332:
+			if(gr_foreground != *(unsigned char *)PIXELS)
+				goto breakwhile;
+			++PIXELS;
+			break;
+		case MWPF_TRUECOLOR0888:
+			if(gr_foreground != *(unsigned long *)PIXELS)
+				goto breakwhile;
+			PIXELS += sizeof(unsigned long);
+			break;
+		case MWPF_TRUECOLOR888:
+			r = *(unsigned char *)PIXELS;
+			g = *(unsigned char *)(PIXELS + 1);
+			b = *(unsigned char *)(PIXELS + 2);
+			if(gr_foreground != (MWPIXELVAL)MWRGB(r, g, b))
+				goto breakwhile;
+			PIXELS += 3;
+			break;
+		case MWPF_TRUECOLOR565:
+		case MWPF_TRUECOLOR555:
+			if(gr_foreground != *(unsigned short *)PIXELS)
+				goto breakwhile;
+			PIXELS += sizeof(unsigned short);
+			break;
+		}
+		++count;
+		--cellstodo;
+	}
+breakwhile:
+
+	/* If there is only one point with this color, then draw it
+	 * by itself.
+	 */
+	if (count == 1) {
+		if (dodraw)
+			drawpoint(psd, x, y);
+		if (++x > maxx) {
+			x = minx;
+			y++;
+		}
+		continue;
+	}
+
+	/* There are multiple points with the same color. If we are
+	 * not at the start of a row of the rectangle, then draw this
+	 * first row specially.
+	 */
+	if (x != minx) {
+		cc = count;
+		if (x + cc - 1 > maxx)
+			cc = maxx - x + 1;
+		if (dodraw)
+			drawrow(psd, x, x + cc - 1, y);
+		count -= cc;
+		x += cc;
+		if (x > maxx) {
+			x = minx;
+			y++;
+		}
+	}
+
+	/* Now the x value is at the beginning of a row if there are
+	 * any points left to be drawn.  Draw all the complete rows
+	 * with one call.
+	 */
+	rows = count / width;
+	if (rows > 0) {
+		if (dodraw) {
+			/* note: change to fillrect, (parm types changed)*/
+			/*GdFillRect(psd, x, y, maxx, y + rows - 1);*/
+			GdFillRect(psd, x, y, maxx - x + 1, rows);
+		}
+		count %= width;
+		y += rows;
+	}
+
+	/* If there is a final partial row of pixels left to be
+	 * drawn, then do that.
+	 */
+	if (count > 0) {
+		if (dodraw)
+			drawrow(psd, x, x + count - 1, y);
+		x += count;
+	}
+  }
+  gr_foreground = savecolor;
+  GdFixCursor(psd);
+}
+
+#if NOTYET
+/* Copy a rectangular area from one screen area to another.
+ * This bypasses clipping.
+ */
+void
+GdCopyArea(PSD psd, MWCOORD srcx, MWCOORD srcy, MWCOORD width, MWCOORD height,
+	MWCOORD destx, MWCOORD desty)
+{
+	if (width <= 0 || height <= 0)
+		return;
+
+	if (srcx == destx && srcy == desty)
+		return;
+	GdCheckCursor(psd, srcx, srcy, srcx + width - 1, srcy + height - 1);
+	GdCheckCursor(psd, destx, desty, destx + width - 1, desty + height - 1);
+	psd->CopyArea(psd, srcx, srcy, width, height, destx, desty);
+	GdFixCursor(psd);
+}
+#endif
+
+#define NEWBLIT 1 /* Kaben's clipping fix for blitting*/
+
+/* Copy source rectangle of pixels to destination rectangle quickly*/
+void
+GdBlit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD width, MWCOORD height,
+	PSD srcpsd, MWCOORD srcx, MWCOORD srcy, long rop)
+{
+#if NEWBLIT
+	int rx1, rx2, ry1, ry2;
+	int px1, px2, py1, py2;
+	int pw, ph;
+	int count;
+#else
+	int	DSTX, DSTY, WIDTH, HEIGHT;
+	int	SRCX, SRCY;
+	int		count, dx, dy;
+#endif
+#if DYNAMICREGIONS
+	MWRECT *	prc;
+	extern MWCLIPREGION *clipregion;
+#else
+	MWCLIPRECT *	prc;
+	extern MWCLIPRECT cliprects[];
+	extern int clipcount;
+#endif
+
+	/*FIXME: compare bpp's and convert if necessary*/
+	assert(dstpsd->planes == srcpsd->planes);
+	assert(dstpsd->bpp == srcpsd->bpp);
+	
+	/* clip blit rectangle to source screen/bitmap size*/
+	/* we must do this because there isn't any source clipping setup*/
+	if(srcx < 0) {
+		width += srcx;
+		dstx -= srcx;
+		srcx = 0;
+	}
+	if(srcy < 0) {
+		height += srcy;
+		dsty -= srcy;
+		srcy = 0;
+	}
+	if(srcx+width > srcpsd->xvirtres)
+		width = srcpsd->xvirtres - srcx;
+	if(srcy+height > srcpsd->yvirtres)
+		height = srcpsd->yvirtres - srcy;
+
+	switch(GdClipArea(dstpsd, dstx, dsty, dstx+width-1, dsty+height-1)) {
+	case CLIP_VISIBLE:
+		/* check cursor in src region*/
+		GdCheckCursor(dstpsd, srcx, srcy, srcx+width-1, srcy+height-1);
+		dstpsd->Blit(dstpsd, dstx, dsty, width, height,
+			srcpsd, srcx, srcy, rop);
+		GdFixCursor(dstpsd);
+		return;
+
+	case CLIP_INVISIBLE:
+		return;
+	}
+
+	/* Partly clipped, we'll blit using destination clip
+	 * rectangles, and offset the blit accordingly.
+	 * Since the destination is already clipped, we
+	 * only need to clip the source here.
+	 */
+#if DYNAMICREGIONS
+	prc = clipregion->rects;
+	count = clipregion->numRects;
+#else
+	prc = cliprects;
+	count = clipcount;
+#endif
+	while(--count >= 0) {
+#if NEWBLIT
+#if DYNAMICREGIONS
+		rx1 = prc->left;
+		ry1 = prc->top;
+		rx2 = prc->right;
+		ry2 = prc->bottom;
+#else
+		rx1 = prc->x;
+		ry1 = prc->y;
+		rx2 = prc->x + prc->width;
+		ry2 = prc->y + prc->height;
+#endif
+		/* Check:  does this rect intersect the one we want to draw? */
+		px1 = dstx;
+		py1 = dsty;
+		px2 = dstx + width;
+		py2 = dsty + height;
+		if (px1 < rx1) px1 = rx1;
+		if (py1 < ry1) py1 = ry1;
+		if (px2 > rx2) px2 = rx2;
+		if (py2 > ry2) py2 = ry2;
+
+		pw = px2 - px1;
+		ph = py2 - py1;
+		if(pw > 0 && ph > 0) {
+			/* check cursor in dest and src regions*/
+			GdCheckCursor(dstpsd, px1, py1, px2-1, py2-1);
+			GdCheckCursor(dstpsd, srcx, srcy,
+				srcx+width, srcy+height);
+			dstpsd->Blit(dstpsd, px1, py1, pw, ph, srcpsd,
+				srcx + (px1-dstx), srcy + (py1-dsty), rop);
+		}
+#else /* !NEWBLIT*/
+#if DYNAMICREGIONS
+		dx = prc->left - dstx;
+		dy = prc->top - dsty;
+		WIDTH = prc->right - prc->left;
+		HEIGHT = prc->bottom - prc->top;
+#else
+		dx = prc->x - dstx;
+		dy = prc->y - dsty;
+		WIDTH = prc->width;
+		HEIGHT = prc->height;
+#endif
+		/*
+		 * This shouldn't have to be here, but is required
+		 * to fix a bug where negative dx, dy values get
+		 * generated when UPDATEREGIONS is defined, and
+		 * the entire client area is obscured.  Yes, the
+		 * above CLIP_INVISIBLE should be returned, but
+		 * is not.  So we check for negative values, and
+		 * don't blit in that case.
+		 *
+		 * This bug only occurs when the cursor is moved
+		 * on non-client area during complete obscuration
+		 * of client area.  Normally, a WM_MOUSEMOVE
+		 * shouldn't be generated, which was causing
+		 * the app to redraw.  Perhaps the nRcUpdate 
+		 * member should be cleared, or the clipping
+		 * region completely reset...
+		 */
+		if(dx >= 0 && dy >= 0) {
+			/* calc offset into blit*/
+			DSTX = dstx + dx;
+			SRCX = srcx + dx;
+			DSTY = dsty + dy;
+			SRCY = srcy + dy;
+
+			/* clip source rectangle*/
+			if(SRCX + WIDTH > srcpsd->xvirtres)
+				WIDTH = srcpsd->xvirtres - SRCX;
+			if(SRCY + HEIGHT > srcpsd->yvirtres)
+				HEIGHT = srcpsd->yvirtres - SRCY;
+
+			GdCheckCursor(dstpsd, DSTX, DSTY, DSTX+WIDTH-1,
+				DSTY+HEIGHT-1);
+			dstpsd->Blit(dstpsd, DSTX, DSTY, WIDTH, HEIGHT,
+				srcpsd, SRCX, SRCY, rop);
+		}
+#endif /* !NEWBLIT*/
+		++prc;
+	}
+	GdFixCursor(dstpsd);
+}
+
+/*
+ * Calculate size and linelen of memory gc.
+ * If bpp or planes is 0, use passed psd's bpp/planes.
+ * Note: linelen is calculated to be DWORD aligned for speed
+ * for bpp <= 8.  Linelen is converted to bytelen for bpp > 8.
+ */
+int
+GdCalcMemGCAlloc(PSD psd, unsigned int width, unsigned int height, int planes,
+	int bpp, int *psize, int *plinelen)
+{
+	int	bytelen, linelen, tmp;
+
+	if(!planes)
+		planes = psd->planes;
+	if(!bpp)
+		bpp = psd->bpp;
+	/* 
+	 * swap width and height in portrait mode,
+	 * so imagesize is calculated properly
+	 */
+	if(psd->flags & PSF_PORTRAIT) {
+		tmp = width;
+		width = height;
+		height = tmp;
+	}
+
+	/*
+	 * use bpp and planes to create size and linelen.
+	 * linelen is in bytes for bpp 1, 2, 4, 8, and pixels for bpp 16,24,32.
+	 */
+	if(planes == 1) {
+		switch(bpp) {
+		case 1:
+			linelen = (width+7)/8;
+			bytelen = linelen = (linelen+3) & ~3;
+			break;
+		case 2:
+			linelen = (width+3)/4;
+			bytelen = linelen = (linelen+3) & ~3;
+			break;
+		case 4:
+			linelen = (width+1)/2;
+			bytelen = linelen = (linelen+3) & ~3;
+			break;
+		case 8:
+			bytelen = linelen = (width+3) & ~3;
+			break;
+		case 16:
+			linelen = width;
+			bytelen = width * 2;
+			break;
+		case 24:
+			linelen = width;
+			bytelen = width * 3;
+			break;
+		case 32:
+			linelen = width;
+			bytelen = width * 4;
+			break;
+		default:
+			return 0;
+		}
+	} else if(planes == 4) {
+		/* FIXME assumes VGA 4 planes 4bpp*/
+		/* we use 4bpp linear for memdc format*/
+		linelen = (width+1)/2;
+		linelen = (linelen+3) & ~3;
+		bytelen = linelen;
+	} else {
+		*psize = *plinelen = 0;
+		return 0;
+	}
+
+	*plinelen = linelen;
+	*psize = bytelen * height;
+	return 1;
+}
+
+/* Translate a rectangle of color values
+ *
+ * The pixels are packed according to inpixtype/outpixtype:
+ *
+ * pixtype		array of
+ * MWPF_RGB		MWCOLORVAL (unsigned long)
+ * MWPF_PIXELVAL	MWPIXELVAL (compile-time dependent)
+ * MWPF_PALETTE		unsigned char
+ * MWPF_TRUECOLOR0888	unsigned long
+ * MWPF_TRUECOLOR888	packed struct {char r,char g,char b} (24 bits)
+ * MWPF_TRUECOLOR565	unsigned short
+ * MWPF_TRUECOLOR555	unsigned short
+ * MWPF_TRUECOLOR332	unsigned char
+ */
+void
+GdTranslateArea(MWCOORD width, MWCOORD height, void *in, int inpixtype,
+	MWCOORD inpitch, void *out, int outpixtype, int outpitch)
+{
+	unsigned char *	inbuf = in;
+	unsigned char *	outbuf = out;
+	unsigned long	pixelval;
+	MWCOLORVAL	colorval;
+	MWCOORD		x, y;
+	unsigned char 	r, g, b;
+	extern MWPALENTRY gr_palette[256];
+	int	  gr_palsize = 256;	/* FIXME*/
+
+	for(y=0; y<height; ++y) {
+	    for(x=0; x<width; ++x) {
+		/* read pixel value and convert to BGR colorval (0x00BBGGRR)*/
+		switch (inpixtype) {
+		case MWPF_RGB:
+			colorval = *(MWCOLORVAL *)inbuf;
+			inbuf += sizeof(MWCOLORVAL);
+			break;
+		case MWPF_PIXELVAL:
+			pixelval = *(MWPIXELVAL *)inbuf;
+			inbuf += sizeof(MWPIXELVAL);
+			/* convert based on compile-time MWPIXEL_FORMAT*/
+#if MWPIXEL_FORMAT == MWPF_PALETTE
+			colorval = GETPALENTRY(gr_palette, pixelval);
+#else
+			colorval = PIXELVALTOCOLORVAL(pixelval);
+#endif
+			break;
+		case MWPF_PALETTE:
+			pixelval = *inbuf++;
+			colorval = GETPALENTRY(gr_palette, pixelval);
+			break;
+		case MWPF_TRUECOLOR332:
+			pixelval = *inbuf++;
+			colorval = PIXEL332TOCOLORVAL(pixelval);
+			break;
+		case MWPF_TRUECOLOR0888:
+			pixelval = *(unsigned long *)inbuf;
+			colorval = PIXEL888TOCOLORVAL(pixelval);
+			inbuf += sizeof(unsigned long);
+			break;
+		case MWPF_TRUECOLOR888:
+			r = *inbuf++;
+			g = *inbuf++;
+			b = *inbuf++;
+			colorval = (MWPIXELVAL)MWRGB(r, g, b);
+			break;
+		case MWPF_TRUECOLOR565:
+			pixelval = *(unsigned short *)inbuf;
+			colorval = PIXEL565TOCOLORVAL(pixelval);
+			inbuf += sizeof(unsigned short);
+			break;
+		case MWPF_TRUECOLOR555:
+			pixelval = *(unsigned short *)inbuf;
+			colorval = PIXEL555TOCOLORVAL(pixelval);
+			inbuf += sizeof(unsigned short);
+			break;
+		default:
+			return;
+		}
+
+		/* convert from BGR colorval to desired output pixel format*/
+		switch (outpixtype) {
+		case MWPF_RGB:
+			*(MWCOLORVAL *)outbuf = colorval;
+			outbuf += sizeof(MWCOLORVAL);
+			break;
+		case MWPF_PIXELVAL:
+			/* convert based on compile-time MWPIXEL_FORMAT*/
+#if MWPIXEL_FORMAT == MWPF_PALETTE
+			*(MWPIXELVAL *)outbuf = GdFindNearestColor(gr_palette,
+					gr_palsize, colorval);
+#else
+			*(MWPIXELVAL *)outbuf = COLORVALTOPIXELVAL(colorval);
+#endif
+			outbuf += sizeof(MWPIXELVAL);
+			break;
+		case MWPF_PALETTE:
+			*outbuf++ = GdFindNearestColor(gr_palette, gr_palsize,
+					colorval);
+			break;
+		case MWPF_TRUECOLOR332:
+			*outbuf++ = COLOR2PIXEL332(colorval);
+			break;
+		case MWPF_TRUECOLOR0888:
+			*(unsigned long *)outbuf = COLOR2PIXEL888(colorval);
+			outbuf += sizeof(unsigned long);
+			break;
+		case MWPF_TRUECOLOR888:
+			*outbuf++ = REDVALUE(colorval);
+			*outbuf++ = GREENVALUE(colorval);
+			*outbuf++ = BLUEVALUE(colorval);
+			break;
+		case MWPF_TRUECOLOR565:
+			*(unsigned short *)outbuf = COLOR2PIXEL565(colorval);
+			outbuf += sizeof(unsigned short);
+			break;
+		case MWPF_TRUECOLOR555:
+			*(unsigned short *)outbuf = COLOR2PIXEL555(colorval);
+			outbuf += sizeof(unsigned short);
+			break;
+		}
+	    }
+
+	    /* adjust line widths, if necessary*/
+	    if(inpitch > width)
+		    inbuf += inpitch - width;
+	    if(outpitch > width)
+		    outbuf += outpitch - width;
+	}
+}
diff -urN lib/microwindows/src/engine/devfont.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devfont.c
--- lib/microwindows/src/engine/devfont.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devfont.c	2005-02-21 16:13:14.000000000 +0100
@@ -0,0 +1,2488 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * T1lib Adobe type1 routines contributed by Vidar Hokstad
+ * Freetype TrueType routines contributed by Martin Jolicoeur
+ * Han Zi Ku routines contributed by Tanghao and Jauming
+ *
+ * Device-independent font and text drawing routines
+ *
+ * These routines do the necessary range checking, clipping, and cursor
+ * overwriting checks, and then call the lower level device dependent
+ * routines to actually do the drawing.  The lower level routines are
+ * only called when it is known that all the pixels to be drawn are
+ * within the device area and are visible.
+ */
+/*#define NDEBUG*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <string.h>
+
+#include "device.h"
+#if (UNIX | DOS_DJGPP)
+#define strcmpi	strcasecmp
+#endif
+
+#if ECOS
+#include <ctype.h>
+static int
+strcmpi(const char *s1, const char *s2)
+{
+	while (*s1 != '\0' && tolower(*s1) == tolower(*s2))
+	{
+		s1++;
+		s2++;
+	}
+    	return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2);
+}
+#endif
+
+#if HAVE_T1LIB_SUPPORT
+#include <t1lib.h>
+#define T1LIB_USE_AA_HIGH
+
+typedef struct {
+	PMWFONTPROCS	fontprocs;	/* common hdr*/
+	MWCOORD		fontsize;
+	int		fontrotation;
+	int		fontattr;		
+
+	int		fontid;		/* t1lib stuff*/
+} MWT1LIBFONT, *PMWT1LIBFONT;
+
+static int  t1lib_init(PSD psd);
+static PMWT1LIBFONT t1lib_createfont(const char *name, MWCOORD height,int attr);
+static void t1lib_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+		const void *text, int cc, int flags);
+static MWBOOL t1lib_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo);
+static void t1lib_gettextsize(PMWFONT pfont, const void *text, int cc,
+		MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+static void t1lib_destroyfont(PMWFONT pfont);
+
+/* handling routines for MWT1LIBFONT*/
+static MWFONTPROCS t1lib_procs = {
+	MWTF_ASCII,			/* routines expect ascii*/
+	t1lib_getfontinfo,
+	t1lib_gettextsize,
+	NULL,				/* gettextbits*/
+	t1lib_destroyfont,
+	t1lib_drawtext,
+	NULL,				/* setfontsize*/
+	NULL,				/* setfontrotation*/
+	NULL,				/* setfontattr*/
+};
+#endif
+
+#ifdef T1LIB_USE_AA_HIGH
+typedef unsigned long OUTPIXELVAL;
+#else
+typedef MWPIXELVAL OUTPIXELVAL;
+#endif
+
+#if HAVE_FREETYPE_SUPPORT
+#include <freetype/freetype.h>
+#include <freetype/ftxkern.h>
+#include <freetype/ftnameid.h>
+#include <freetype/ftxcmap.h>
+#include <freetype/ftxwidth.h>
+#include <math.h>
+
+#ifndef FREETYPE_FONT_DIR
+#define FREETYPE_FONT_DIR "/usr/local/microwin/fonts"
+#endif
+
+#if TT_FREETYPE_MAJOR != 1 | TT_FREETYPE_MINOR < 3
+#error "You must link with freetype lib version 1.3.x +, and not freetype 2. \
+Download it at http://www.freetype.org or http://microwindows.org"
+#endif
+
+typedef struct {
+	PMWFONTPROCS	fontprocs;	/* common hdr*/
+	MWCOORD		fontsize;
+	int		fontrotation;
+	int		fontattr;		
+
+	TT_Face 	face;		/* freetype stuff*/
+	TT_Instance	instance;
+	TT_CharMap 	char_map;
+	TT_Kerning 	directory;
+	TT_Matrix 	matrix;
+	TT_Glyph 	glyph;
+	MWBOOL 		can_kern;
+	short 		last_glyph_code;
+	short 		last_pen_pos;
+} MWFREETYPEFONT, *PMWFREETYPEFONT;
+
+static int  freetype_init(PSD psd);
+static PMWFREETYPEFONT freetype_createfont(const char *name, MWCOORD height,
+		int attr);
+static MWBOOL freetype_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo);
+static void freetype_gettextsize(PMWFONT pfont, const void *text,
+		int cc, MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+static void freetype_destroyfont(PMWFONT pfont);
+static void freetype_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+		const void *text, int cc, int flags);
+static void freetype_setfontsize(PMWFONT pfont, MWCOORD fontsize);
+static void freetype_setfontrotation(PMWFONT pfont, int tenthdegrees);
+		
+/* handling routines for MWFREETYPEFONT*/
+static MWFONTPROCS freetype_procs = {
+	MWTF_UC16,			/* routines expect unicode 16*/
+	freetype_getfontinfo,
+	freetype_gettextsize,
+	NULL,				/* gettextbits*/
+	freetype_destroyfont,
+	freetype_drawtext,
+	freetype_setfontsize,
+	freetype_setfontrotation,
+	NULL,				/* setfontattr*/
+};
+
+static TT_Engine 	engine;		/* THE ONLY freetype engine */
+#endif /* HAVE_FREETYPE_SUPPORT*/
+
+#if HAVE_HZK_SUPPORT
+/*
+ * 12x12 and 16x16 ascii and chinese fonts
+ * Big5 and GB2312 encodings supported
+ */
+#define MAX_PATH	256
+typedef struct {
+	int	width;
+	int	height;
+	int	size;
+	unsigned long use_count;
+	char *	pFont;
+	char	file[MAX_PATH + 1];
+} HZKFONT;
+
+static int use_big5=1;
+static HZKFONT CFont[2];//font cache
+static HZKFONT AFont[2];//font cache
+
+//jmt: moved inside MWHZKFONT
+static int afont_width = 8;
+static int cfont_width = 16;
+static int font_height = 16;
+static char *afont_address;
+static char *cfont_address;
+
+typedef struct {
+	PMWFONTPROCS	fontprocs;	/* common hdr*/
+	MWCOORD		fontsize;
+	int		fontrotation;
+	int		fontattr;		
+
+	HZKFONT 	CFont;		/* hzkfont stuff */
+	HZKFONT 	AFont;
+	int 		afont_width;
+	int 		cfont_width;
+	int 		font_height;
+	char 		*afont_address;
+	char 		*cfont_address;
+} MWHZKFONT, *PMWHZKFONT;
+
+static int  hzk_init(PSD psd);
+static PMWHZKFONT hzk_createfont(const char *name, MWCOORD height,int fontattr);
+static MWBOOL hzk_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo);
+static void hzk_gettextsize(PMWFONT pfont, const void *text,
+		int cc, MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+//static void hzk_gettextbits(PMWFONT pfont, int ch, IMAGEBITS *retmap,
+//		MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+static void hzk_destroyfont(PMWFONT pfont);
+static void hzk_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+		const void *text, int cc, int flags);
+static void hzk_setfontsize(PMWFONT pfont, MWCOORD fontsize);
+//static void hzk_setfontrotation(PMWFONT pfont, int tenthdegrees);
+		
+/* handling routines for MWHZKFONT*/
+static MWFONTPROCS hzk_procs = {
+	MWTF_ASCII,			/* routines expect ASCII*/
+	hzk_getfontinfo,
+	hzk_gettextsize,
+	NULL,				/* hzk_gettextbits*/
+	hzk_destroyfont,
+	hzk_drawtext,
+	hzk_setfontsize,
+	NULL, 				/* setfontrotation*/
+	NULL,				/* setfontattr*/
+};
+
+static int
+UC16_to_GB(const unsigned char *uc16, int cc, unsigned char *ascii);
+#endif /* HAVE_HZK_SUPPORT*/
+
+static PMWFONT	gr_pfont;            	/* current font*/
+
+/* temp extern decls*/
+extern MWPIXELVAL gr_foreground;
+extern MWPIXELVAL gr_background;
+extern MWBOOL gr_usebg;
+
+static int  utf8_to_utf16(const unsigned char *utf8, int cc,
+		unsigned short *unicode16);
+
+#if FONTMAPPER
+/* entry point for font selection*/
+int select_font(const PMWLOGFONT plogfont, char *physname);
+#endif
+
+/*
+ * Set the font for future calls.
+ */
+PMWFONT
+GdSetFont(PMWFONT pfont)
+{
+	PMWFONT	oldfont = gr_pfont;
+
+	gr_pfont = pfont;
+	return oldfont;
+}
+
+/*
+ * Select a font, based on various parameters.
+ * If plogfont is specified, name and height parms are ignored
+ * and instead used from MWLOGFONT.
+ * 
+ * If height is 0, return builtin font from passed name.
+ * Otherwise find builtin font best match based on height.
+ */
+PMWFONT
+GdCreateFont(PSD psd, const char *name, MWCOORD height,
+	const PMWLOGFONT plogfont)
+{
+	int 		i;
+	int		fontht;
+	int		fontno;
+ 	int		fontclass;
+	int		fontattr = 0;
+	PMWFONT		pfont;
+	PMWCOREFONT	pf = psd->builtin_fonts;
+	MWFONTINFO	fontinfo;
+	MWSCREENINFO 	scrinfo;
+ 	char		fontname[128];
+
+	GdGetScreenInfo(psd, &scrinfo);
+
+	/* if plogfont not specified, use name and height*/
+	if (!plogfont) {
+		if (!name)
+			name = MWFONT_SYSTEM_VAR;
+		strcpy(fontname, name);
+		fontclass = MWLF_CLASS_ANY;
+	} else {
+#if FONTMAPPER
+		/* otherwise, use MWLOGFONT name and height*/
+ 		fontclass = select_font(plogfont, fontname);
+#else
+		if (!name)
+			name = MWFONT_SYSTEM_VAR;
+		strcpy(fontname, name);
+		fontclass = MWLF_CLASS_ANY;
+#endif
+		height = plogfont->lfHeight;
+		if (plogfont->lfUnderline)
+			fontattr = MWTF_UNDERLINE;
+	}
+	height = abs(height);
+ 
+ 	if (!fontclass)
+ 		goto first;
+ 
+	/* use builtin screen fonts, FONT_xxx, if height is 0 */
+ 	if (height == 0 || fontclass == MWLF_CLASS_ANY ||
+	    fontclass == MWLF_CLASS_BUILTIN) {
+  		for(i = 0; i < scrinfo.fonts; ++i) {
+ 			if(!strcmpi(pf[i].name, fontname)) {
+  				pf[i].fontsize = pf[i].cfont->height;
+				pf[i].fontattr = fontattr;
+  				return (PMWFONT)&pf[i];
+  			}
+  		}
+ 
+		/* return first builtin font*/
+		if (height == 0 || fontclass == MWLF_CLASS_BUILTIN)
+			goto first;
+  	}
+
+#if HAVE_HZK_SUPPORT
+        /* Make sure the library is initialized */
+	if (hzk_init(psd)) {
+		pfont = (PMWFONT)hzk_createfont(name, height, fontattr);
+		if(pfont)		
+			return pfont;
+		printf("hzk_createfont: %s not found\n", name);
+	}
+#endif
+
+#if HAVE_FREETYPE_SUPPORT
+ 	if (fontclass == MWLF_CLASS_ANY || fontclass == MWLF_CLASS_FREETYPE) {
+		if (freetype_init(psd)) {
+		/* auto antialias for height > 14 for kaffe*/
+			if (plogfont && plogfont->lfHeight > 14 &&
+				plogfont->lfQuality)
+					fontattr |= MWTF_ANTIALIAS;
+
+			pfont = (PMWFONT)freetype_createfont(fontname, height,
+					fontattr);
+			if(pfont) {
+				/* temp kaffe kluge*/
+				pfont->fontattr |= FS_FREETYPE;
+				return pfont;
+			}
+ 			DPRINTF("freetype_createfont: %s,%d not found\n",
+				fontname, height);
+		}
+  	}
+#endif
+
+#if HAVE_T1LIB_SUPPORT
+	if (fontclass == MWLF_CLASS_ANY || fontclass == MWLF_CLASS_T1LIB) {
+		if (t1lib_init(psd)) {
+			pfont = (PMWFONT)t1lib_createfont(fontname, height,
+					fontattr);
+			if(pfont)
+				return pfont;
+			DPRINTF("t1lib_createfont: %s,%d not found\n",
+				fontname, height);
+		}
+  	}
+#endif
+
+	/* find builtin font closest in height*/
+	if(height != 0) {
+		fontno = 0;
+		height = abs(height);
+		fontht = MAX_MWCOORD;
+		for(i = 0; i < scrinfo.fonts; ++i) {
+			pfont = (PMWFONT)&pf[i];
+			GdGetFontInfo(pfont, &fontinfo);
+			if(fontht > abs(height-fontinfo.height)) { 
+				fontno = i;
+				fontht = abs(height-fontinfo.height);
+			}
+		}
+		pf[fontno].fontsize = pf[fontno].cfont->height;
+		pf[fontno].fontattr = fontattr;
+		return (PMWFONT)&pf[fontno];
+	}
+
+first:
+	/* Return first builtin font*/
+	pf->fontsize = pf->cfont->height;
+	pf->fontattr = fontattr;
+	return (PMWFONT)&pf[0];
+}
+
+/* Set the font size for the passed font*/
+MWCOORD
+GdSetFontSize(PMWFONT pfont, MWCOORD fontsize)
+{
+	MWCOORD	oldfontsize = pfont->fontsize;
+
+	pfont->fontsize = fontsize;
+
+	if (pfont->fontprocs->SetFontSize)
+	    pfont->fontprocs->SetFontSize(pfont, fontsize);
+
+	return oldfontsize;
+}
+
+/* Set the font rotation angle in tenths of degrees for the passed font*/
+int
+GdSetFontRotation(PMWFONT pfont, int tenthdegrees)
+{
+	MWCOORD	oldrotation = pfont->fontrotation;
+
+	pfont->fontrotation = tenthdegrees;
+
+	if (pfont->fontprocs->SetFontRotation)
+	    pfont->fontprocs->SetFontRotation(pfont, tenthdegrees);
+	
+	return oldrotation;
+}
+
+/*
+ * Set/reset font attributes (MWTF_KERNING, MWTF_ANTIALIAS)
+ * for the passed font.
+ */
+int
+GdSetFontAttr(PMWFONT pfont, int setflags, int clrflags)
+{
+	MWCOORD	oldattr = pfont->fontattr;
+
+	pfont->fontattr &= ~clrflags;
+	pfont->fontattr |= setflags;
+
+	if (pfont->fontprocs->SetFontAttr)
+	    pfont->fontprocs->SetFontAttr(pfont, setflags, clrflags);
+	
+	return oldattr;
+}
+
+/* Unload and deallocate font*/
+void
+GdDestroyFont(PMWFONT pfont)
+{
+	if (pfont->fontprocs->DestroyFont)
+		pfont->fontprocs->DestroyFont(pfont);
+}
+
+/* Return information about a specified font*/
+MWBOOL
+GdGetFontInfo(PMWFONT pfont, PMWFONTINFO pfontinfo)
+{
+	if(!pfont || !pfont->fontprocs->GetFontInfo)
+		return FALSE;
+
+	return pfont->fontprocs->GetFontInfo(pfont, pfontinfo);
+}
+
+/*
+ * Convert from one encoding to another
+ * Input cc and returned cc is character count, not bytes
+ * Return < 0 on error or can't translate
+ */
+int
+GdConvertEncoding(const void *istr, int iflags, int cc, void *ostr, int oflags)
+{
+	const unsigned char 	*istr8;
+	const unsigned short 	*istr16;
+	const unsigned long	*istr32;
+	unsigned char 		*ostr8;
+	unsigned short 		*ostr16;
+	unsigned long		*ostr32;
+	unsigned int		ch;
+	int			icc;
+	unsigned short		buf16[512];
+
+	iflags &= MWTF_PACKMASK;
+	oflags &= MWTF_PACKMASK;
+
+	/* allow -1 for len with ascii*/
+	if(cc == -1 && (iflags == MWTF_ASCII))
+		cc = strlen((char *)istr);
+
+	/* first check for utf8 input encoding*/
+	if(iflags == MWTF_UTF8) {
+		/* we've only got uc16 now so convert to uc16...*/
+		cc = utf8_to_utf16((unsigned char *)istr, cc,
+			oflags==MWTF_UC16?(unsigned short*) ostr: buf16);
+
+		if(oflags == MWTF_UC16 || cc < 0)
+			return cc;
+
+		/* will decode again to requested format (probably ascii)*/
+		iflags = MWTF_UC16;
+		istr = buf16;
+	}
+
+#if HAVE_HZK_SUPPORT
+	if(iflags == MWTF_UC16 && oflags == MWTF_ASCII) {
+		/* only support uc16 convert to ascii now...*/
+		cc = UC16_to_GB( istr, cc, ostr);
+		return cc;
+	}
+#endif
+
+	icc = cc;
+	istr8 = istr;
+	istr16 = istr;
+	istr32 = istr;
+	ostr8 = ostr;
+	ostr16 = ostr;
+	ostr32 = ostr;
+
+	/* Convert between formats.  Note that there's no error
+	 * checking here yet.
+	 */
+	while(--icc >= 0) {
+		switch(iflags) {
+		default:
+			ch = *istr8++;
+			break;
+		case MWTF_UC16:
+			ch = *istr16++;
+			break;
+		case MWTF_UC32:
+			ch = *istr32++;
+		}
+		switch(oflags) {
+		default:
+			*ostr8++ = (unsigned char)ch;
+			break;
+		case MWTF_UC16:
+			*ostr16++ = (unsigned short)ch;
+			break;
+		case MWTF_UC32:
+			*ostr32++ = ch;
+		}
+	}
+	return cc;
+}
+
+/* Get the width and height of passed text string in the passed font*/
+void
+GdGetTextSize(PMWFONT pfont, const void *str, int cc, MWCOORD *pwidth,
+	MWCOORD *pheight, MWCOORD *pbase, int flags)
+{
+	const void *	text;
+	unsigned long	buf[256];
+	int		defencoding = pfont->fontprocs->encoding;
+
+	/* convert encoding if required*/
+	if((flags & MWTF_PACKMASK) != defencoding) {
+		cc = GdConvertEncoding(str, flags, cc, buf, defencoding);
+		flags &= ~MWTF_PACKMASK;
+		flags |= defencoding;
+		text = buf;
+	} else text = str;
+
+	if(cc == -1 && (flags & MWTF_PACKMASK) == MWTF_ASCII)
+		cc = strlen((char *)str);
+
+	if(cc <= 0 || !pfont->fontprocs->GetTextSize) {
+		*pwidth = *pheight = *pbase = 0;
+		return;
+	}
+
+	/* calc height and width of string*/
+	pfont->fontprocs->GetTextSize(pfont, text, cc, pwidth, pheight, pbase);
+}
+
+/* Draw a text string at a specifed coordinates in the foreground color
+ * (and possibly the background color), applying clipping if necessary.
+ * The background color is only drawn if the gr_usebg flag is set.
+ * Use the current font.
+ */
+void
+GdText(PSD psd, MWCOORD x, MWCOORD y, const void *str, int cc, int flags)
+{
+	const void *	text;
+	unsigned long	buf[256];
+	int		defencoding = gr_pfont->fontprocs->encoding;
+
+	/* convert encoding if required*/
+	if((flags & MWTF_PACKMASK) != defencoding) {
+		cc = GdConvertEncoding(str, flags, cc, buf, defencoding);
+		flags &= ~MWTF_PACKMASK;
+		flags |= defencoding;
+		text = buf;
+	} else text = str;
+
+	if(cc == -1 && (flags & MWTF_PACKMASK) == MWTF_ASCII)
+		cc = strlen((char *)str);
+
+	if(cc <= 0 || !gr_pfont->fontprocs->DrawText)
+		return;
+
+	/* draw text string*/
+	gr_pfont->fontprocs->DrawText(gr_pfont, psd, x, y, text, cc, flags);
+}
+
+/*
+ * Draw ascii text using COREFONT type font.
+ */
+void
+corefont_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+	const void *text, int cc, int flags)
+{
+	const unsigned char *str = text;
+	MWCOORD		width;			/* width of text area */
+	MWCOORD 	height;			/* height of text area */
+	MWCOORD		base;			/* baseline of text*/
+	MWCOORD		startx, starty;
+						/* bitmap for characters */
+	MWIMAGEBITS bitmap[MAX_CHAR_HEIGHT*MAX_CHAR_WIDTH/MWIMAGE_BITSPERIMAGE];
+
+	pfont->fontprocs->GetTextSize(pfont, str, cc, &width, &height, &base);
+	
+	if(flags & MWTF_BASELINE)
+		y -= base;
+	else if(flags & MWTF_BOTTOM)
+		y -= (height - 1);
+	startx = x;
+	starty = y + base;
+
+	switch (GdClipArea(psd, x, y, x + width - 1, y + height - 1)) {
+	case CLIP_VISIBLE:
+		/*
+		 * For size considerations, there's no low-level text
+		 * draw, so we've got to draw all text
+		 * with per-point clipping for the time being
+		if (gr_usebg)
+			psd->FillRect(psd, x, y, x + width - 1, y + height - 1,
+				gr_background);
+		psd->DrawText(psd, x, y, str, cc, gr_foreground, pfont);
+		GdFixCursor(psd);
+		return;
+		*/
+		break;
+
+	case CLIP_INVISIBLE:
+		return;
+	}
+
+	/* Get the bitmap for each character individually, and then display
+	 * them using clipping for each one.
+	 */
+	while (--cc >= 0 && x < psd->xvirtres) {
+		unsigned int ch = *str++;
+#if HAVE_BIG5_SUPPORT
+		/* chinese big5 decoding*/
+		if (ch >= 0xA1 && ch <= 0xF9 && cc >= 1 &&
+			((*str >= 0x40 && *str <= 0x7E) ||
+			 (*str >= 0xA1 && *str <= 0xFE)) ) {
+				ch = (ch << 8) | *str++;
+				--cc;
+		}
+#endif
+#if HAVE_GB2312_SUPPORT
+		/* chinese gb2312 decoding*/
+		if (ch >= 0xA1 && ch < 0xF8 && cc >= 1 &&
+			*str >= 0xA1 && *str < 0xFF) {
+				ch = (ch << 8) | *str++;
+				--cc;
+		}
+#endif
+		pfont->fontprocs->GetTextBits(pfont, ch, bitmap, &width,
+			&height, &base);
+
+		/* note: change to bitmap*/
+		GdBitmap(psd, x, y, width, height, bitmap);
+		x += width;
+	}
+
+	if (pfont->fontattr & MWTF_UNDERLINE)
+		GdLine(psd, startx, starty, x, starty, FALSE);
+
+	GdFixCursor(psd);
+}
+
+#if HAVE_T1LIB_SUPPORT | HAVE_FREETYPE_SUPPORT
+/*
+ * Produce blend table from src and dst based on passed alpha table
+ * Used because we don't quite yet have GdArea with alphablending,
+ * so we pre-blend fg/bg colors for fade effect.
+ */
+static void
+alphablend(PSD psd, OUTPIXELVAL *out, MWPIXELVAL src, MWPIXELVAL dst,
+	unsigned char *alpha, int count)
+{
+	unsigned int	a, d;
+	unsigned char	r, g, b;
+	MWCOLORVAL	palsrc, paldst;
+	extern MWPALENTRY gr_palette[256];
+
+	while (--count >= 0) {
+	    a = *alpha++;
+
+#define BITS(pixel,shift,mask)	(((pixel)>>shift)&(mask))
+	    if(a == 0)
+		*out++ = dst;
+	    else if(a == 255)
+		*out++ = src;
+	    else 
+		switch(psd->pixtype) {
+	        case MWPF_TRUECOLOR0888:
+	        case MWPF_TRUECOLOR888:
+		    d = BITS(dst, 16, 0xff);
+		    r = (unsigned char)(((BITS(src, 16, 0xff) - d)*a)>>8) + d;
+		    d = BITS(dst, 8, 0xff);
+		    g = (unsigned char)(((BITS(src, 8, 0xff) - d)*a)>>8) + d;
+		    d = BITS(dst, 0, 0xff);
+		    b = (unsigned char)(((BITS(src, 0, 0xff) - d)*a)>>8) + d;
+		    *out++ = (r << 16) | (g << 8) | b;
+		    break;
+
+	        case MWPF_TRUECOLOR565:
+		    d = BITS(dst, 11, 0x1f);
+		    r = (unsigned char)(((BITS(src, 11, 0x1f) - d)*a)>>8) + d;
+		    d = BITS(dst, 5, 0x3f);
+		    g = (unsigned char)(((BITS(src, 5, 0x3f) - d)*a)>>8) + d;
+		    d = BITS(dst, 0, 0x1f);
+		    b = (unsigned char)(((BITS(src, 0, 0x1f) - d)*a)>>8) + d;
+		    *out++ = (r << 11) | (g << 5) | b;
+		    break;
+
+	        case MWPF_TRUECOLOR555:
+		    d = BITS(dst, 10, 0x1f);
+		    r = (unsigned char)(((BITS(src, 10, 0x1f) - d)*a)>>8) + d;
+		    d = BITS(dst, 5, 0x1f);
+		    g = (unsigned char)(((BITS(src, 5, 0x1f) - d)*a)>>8) + d;
+		    d = BITS(dst, 0, 0x1f);
+		    b = (unsigned char)(((BITS(src, 0, 0x1f) - d)*a)>>8) + d;
+		    *out++ = (r << 10) | (g << 5) | b;
+		    break;
+
+	        case MWPF_TRUECOLOR332:
+		    d = BITS(dst, 5, 0x07);
+		    r = (unsigned char)(((BITS(src, 5, 0x07) - d)*a)>>8) + d;
+		    d = BITS(dst, 2, 0x07);
+		    g = (unsigned char)(((BITS(src, 2, 0x07) - d)*a)>>8) + d;
+		    d = BITS(dst, 0, 0x03);
+		    b = (unsigned char)(((BITS(src, 0, 0x03) - d)*a)>>8) + d;
+		    *out++ = (r << 5) | (g << 2) | b;
+		    break;
+
+	        case MWPF_PALETTE:
+		    /* reverse lookup palette entry for blend ;-)*/
+		    palsrc = GETPALENTRY(gr_palette, src);
+		    paldst = GETPALENTRY(gr_palette, dst);
+		    d = REDVALUE(paldst);
+		    r = (unsigned char)(((REDVALUE(palsrc) - d)*a)>>8) + d;
+		    d = GREENVALUE(paldst);
+		    g = (unsigned char)(((GREENVALUE(palsrc) - d)*a)>>8) + d;
+		    d = BLUEVALUE(paldst);
+		    b = (unsigned char)(((BLUEVALUE(palsrc) - d)*a)>>8) + d;
+		    *out++ = GdFindNearestColor(gr_palette, (int)psd->ncolors,
+				MWRGB(r, g, b));
+		    break;
+	  	}
+	}
+}
+#endif /*HAVE_T1LIB_SUPPORT | HAVE_FREETYPE_SUPPORT*/
+
+#if HAVE_T1LIB_SUPPORT
+/* contributed by Vidar Hokstad*/
+
+static int
+t1lib_init(PSD psd)
+{
+	static int inited = 0;
+
+	if (inited)
+		return 1;
+
+	T1_SetBitmapPad(8);
+	if (!T1_InitLib(0))
+		return 0;
+#ifdef T1LIB_USE_AA_HIGH	 
+	T1_AASetLevel(T1_AA_HIGH);
+#else
+	T1_AASetLevel(T1_AA_LOW);
+#endif	 
+#if 0
+	/* kluge: this is required if 16bpp drawarea driver is used*/
+	if(psd->bpp == 16)
+		T1_AASetBitsPerPixel(16);
+	else
+#endif
+		T1_AASetBitsPerPixel(sizeof(MWPIXELVAL)*8);
+
+	inited = 1;
+	return 1;
+}
+
+static PMWT1LIBFONT
+t1lib_createfont(const char *name, MWCOORD height, int attr)
+{
+	PMWT1LIBFONT	pf;
+	int		id;
+	char *		p;
+	char		buf[256];
+
+	/* match name against t1 font id's from t1 font database*/
+	for(id=0; id<T1_Get_no_fonts(); ++id) {
+		strncpy(buf, T1_GetFontFileName(id), sizeof(buf));
+
+		/* remove extension*/
+		for(p=buf; *p; ++p) {
+			if(*p == '.') {
+				*p = 0;
+				break;
+			}
+		}
+
+		if(!strcmpi(name, buf)) {
+			/* allocate font structure*/
+			pf = (PMWT1LIBFONT)calloc(sizeof(MWT1LIBFONT), 1);
+			if (!pf)
+				return NULL;
+			pf->fontprocs = &t1lib_procs;
+			GdSetFontSize((PMWFONT)pf, height);
+			GdSetFontRotation((PMWFONT)pf, 0);
+			GdSetFontAttr((PMWFONT)pf, attr, 0);
+			pf->fontid = id;
+			return pf;
+		}
+	}
+	return NULL;
+}
+
+/*
+ * Draw ascii text string using T1LIB type font
+ */
+static void
+t1lib_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+	const void *text, int cc, int flags)
+{
+	PMWT1LIBFONT	pf = (PMWT1LIBFONT)pfont;
+	const unsigned char *str = text;
+   	MWCOORD		width;			/* width of text area */
+	MWCOORD 	height;			/* height of text area */
+	MWCOORD		underliney;
+        GLYPH * g; /* T1lib glyph structure. Memory handling by T1lib */
+#ifdef T1LIB_USE_AA_HIGH   
+        OUTPIXELVAL	gvals[17];
+
+        /* Blending array for antialiasing. The steeper the values increase
+	 * near the end, the sharper the characters look, but also more jagged
+	 */
+        static unsigned char blend[17] = {
+	   0x00, 0x00, 0x04, 0x0c, 0x10, 0x14, 0x18, 0x20,
+	   0x30, 0x38, 0x40, 0x50, 0x70, 0x80, 0xa0, 0xc0, 0xff
+	};
+#else   
+        OUTPIXELVAL	gvals[5];
+        static unsigned char blend[5] = { 0x00, 0x44, 0x88, 0xcc, 0xff };
+#endif   
+
+        /* Check if we should throw out some fonts */
+
+        if (pf->fontattr&MWTF_ANTIALIAS) {
+#ifdef T1LIB_USE_AA_HIGH      
+	   alphablend(psd, gvals, gr_foreground, gr_background, blend, 17);
+           T1_AAHSetGrayValues(gvals);
+#else      
+	   alphablend(psd, gvals, gr_foreground, gr_background, blend, 5);
+           T1_AASetGrayValues(gvals[0],gvals[1],gvals[2],gvals[3],gvals[4]);
+#endif
+	   g = T1_AASetString(pf->fontid,(char *)str,cc,0,
+		(pf->fontattr&MWTF_KERNING)? T1_KERNING: 0,
+		pf->fontsize * 1.0, 0);
+
+	   if (g && g->bits) {
+	      /*MWPIXELVAL save = gr_background;*/
+	      width = g->metrics.rightSideBearing - g->metrics.leftSideBearing;
+	      height = g->metrics.ascent - g->metrics.descent;
+
+	      if(flags & MWTF_BASELINE)
+		y -= g->metrics.ascent;
+	      else if(flags & MWTF_BOTTOM)
+		y -= (height - 1);
+	      underliney = y + g->metrics.ascent;
+
+	      /* FIXME: Looks damn ugly if usebg is false.
+	       * Will be handled when using alphablending in GdArea...
+	       */
+	      /* clipping handled in GdArea*/
+	      /*FIXME kluge for transparency*/
+	      /*gr_background = gr_foreground + 1;*/
+	      /*gr_usebg = 0;*/
+	      GdArea(psd,x,y, width, height, g->bits, MWPF_PIXELVAL);
+	      /*gr_background = save;*/
+
+	      if (pf->fontattr & MWTF_UNDERLINE)
+		   GdLine(psd, x, underliney, x+width, underliney, FALSE);
+
+	   }
+	} else {
+	   /* Do non-aa drawing */
+	   g = T1_SetString(pf->fontid,(char *)str,cc,0,
+			(pf->fontattr&MWTF_KERNING)? T1_KERNING: 0,
+			pf->fontsize * 1.0, 0);
+
+	   if (g && g->bits) {
+	      unsigned char * b;
+	      int xoff;
+	      int maxy;
+	      int xmod;
+	      
+	      /* I'm sure this sorry excuse for a bitmap rendering routine can
+	       * be optimized quite a bit ;)
+	       */
+	      width = g->metrics.rightSideBearing - g->metrics.leftSideBearing;
+	      height = g->metrics.ascent - g->metrics.descent;
+
+	      if(flags & MWTF_BASELINE)
+		y -= g->metrics.ascent;
+	      else if(flags & MWTF_BOTTOM)
+		y -= (height - 1);
+	      underliney = y + g->metrics.ascent;
+	      
+	      b = g->bits;
+	      maxy = y + height;
+	      
+/*	      if ((x + width) > psd->xvirtres) {
+		 xmod = (x + width - psd->xvirtres + 7) >> 3;
+		 width = width + x + width - psd->xvirtres;
+	      } else xmod = 0;
+*/
+	      xmod = 0;
+	      while (y < maxy) {
+		 unsigned char data;
+		 xoff = 0;
+		 while (xoff < width ) {
+		    if (!(xoff % 8)) {
+		       data = *b;
+		       b++;
+		    }
+		    
+		    if (GdClipPoint(psd, x+xoff,y)) {
+		       if (gr_usebg) {
+	 		  psd->DrawPixel(psd,x+xoff,y,
+			      data & (1 << (xoff % 8)) ?
+			            gr_foreground : gr_background);
+		       } else if (data & (1 << (xoff % 8))) {
+			  psd->DrawPixel(psd,x+xoff,y, gr_foreground);
+		       }
+		    }
+		    xoff++;
+		 }
+		 b += xmod;
+		 y++;
+	      }
+	      if (pf->fontattr & MWTF_UNDERLINE)
+		   GdLine(psd, x, underliney, x+xoff, underliney, FALSE);
+	   }
+        }
+
+   if (g && g->bits) {
+	   /* Save some memory */
+	   free(g->bits);
+           g->bits = 0; /* Make sure T1lib doesnt try to free it again */
+   }
+
+   GdFixCursor(psd);
+}
+
+static MWBOOL
+t1lib_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo)
+{
+	int	i;
+	MWCOORD	width, height, baseline;
+
+	/* FIXME, guess all sizes*/
+	GdGetTextSize(pfont, "A", 1, &width, &height, &baseline, MWTF_ASCII);
+	pfontinfo->height = height;
+	pfontinfo->maxwidth = width;
+	pfontinfo->baseline = 0;
+	pfontinfo->firstchar = 32;
+	pfontinfo->lastchar = 255;
+	pfontinfo->fixed = TRUE;
+	for(i=0; i<256; ++i)
+		pfontinfo->widths[i] = width;
+	return TRUE;
+}
+
+/* Get the width and height of passed text string in the current font*/
+static void
+t1lib_gettextsize(PMWFONT pfont, const void *text, int cc,
+	MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase)
+{
+	PMWT1LIBFONT		pf = (PMWT1LIBFONT)pfont;
+	const unsigned char *	str = text;
+	GLYPH *			g;
+
+	g = T1_SetString(pf->fontid, (char *)str, cc, 0,
+			(pf->fontattr&MWTF_KERNING)? T1_KERNING: 0, pf->fontsize * 1.0, 0);
+	*pwidth = g->metrics.rightSideBearing - g->metrics.leftSideBearing;
+	*pheight = g->metrics.ascent - g->metrics.descent;
+	if(g && g->bits) {
+		free(g->bits);
+		g->bits = 0;
+	}
+#if 0
+	BBox 			b;
+
+	/* FIXME. Something is *VERY* wrong here */
+	b = T1_GetStringBBox(pf->fontid, str, cc, 0, (pf->fontattr&MWTF_KERNING)?T1_KERNING:0);
+
+	DPRINTF("b.urx = %d, b.llx = %d\n",b.urx, b.llx);
+	DPRINTF("b.ury = %d, b.lly = %d\n",b.ury, b.lly);
+	*pwidth = (b.urx - b.llx);
+	*pheight = (b.lly - b.ury);
+#endif
+}
+
+static void
+t1lib_destroyfont(PMWFONT pfont)
+{
+	PMWT1LIBFONT	pf = (PMWT1LIBFONT)pfont;
+
+	T1_DeleteAllSizes(pf->fontid);
+	free(pf);
+}
+
+#endif /* HAVE_T1LIB_SUPPORT*/
+
+#if HAVE_FREETYPE_SUPPORT
+static OUTPIXELVAL gray_palette[5];
+
+static int
+freetype_init(PSD psd)
+{
+	static int inited = 0;
+
+	if (inited)
+		return 1;
+	
+	/* Init freetype library */
+	if (TT_Init_FreeType (&engine) != TT_Err_Ok) {
+		return 0;
+	}
+
+	/* Init kerning extension */
+	if (TT_Init_Kerning_Extension (engine) != TT_Err_Ok)
+		return 0;
+
+	inited = 1;
+	return 1;
+}
+
+static PMWFREETYPEFONT
+freetype_createfont(const char *name, MWCOORD height, int attr)
+{
+	PMWFREETYPEFONT 	pf;
+	unsigned short 		i, n;
+	unsigned short 		platform, encoding;
+	TT_Face_Properties 	properties;
+	char *			p;
+	char			fontname[128];
+
+	/* check for pathname prefix*/
+	if (strchr(name, '/') != NULL)
+		strcpy(fontname, name);
+	else {
+		strcpy(fontname, FREETYPE_FONT_DIR);
+		strcat(fontname, "/");
+		strcat(fontname, name);
+	}
+
+	/* check for extension*/
+	if ((p = strrchr(fontname, '.')) == NULL ||
+	    strcmp(p, ".ttf") != 0) {
+		strcat(fontname, ".ttf");
+	}
+
+	/* allocate font structure*/
+	pf = (PMWFREETYPEFONT)calloc(sizeof(MWFREETYPEFONT), 1);
+	if (!pf)
+		return NULL;
+	pf->fontprocs = &freetype_procs;
+
+	/* Load face */
+	if (TT_Open_Face (engine, fontname, &pf->face) != TT_Err_Ok)
+		goto out;
+
+	/* Load first kerning table */
+	pf->can_kern = TRUE;
+	if (TT_Load_Kerning_Table (pf->face, 0) != TT_Err_Ok)
+		pf->can_kern = FALSE;
+	else {
+		if (TT_Get_Kerning_Directory (pf->face, &pf->directory)
+		    != TT_Err_Ok)
+			pf->can_kern = FALSE;
+		else {
+			/* Support only version 0 kerning table ... */
+			if ((pf->directory.version != 0) ||
+				(pf->directory.nTables <= 0) ||
+				(pf->directory.tables->loaded != 1) ||
+				(pf->directory.tables->version != 0) ||
+				(pf->directory.tables->t.kern0.nPairs <= 0))
+					pf->can_kern = FALSE;
+		}
+	}
+
+	/* get face properties and allocate preload arrays */
+	TT_Get_Face_Properties (pf->face, &properties);
+
+#if 0
+	/*
+	 * Use header information for ascent and descent
+	 * to compute scaled ascent/descent for current font height.
+	 */
+	h = properties.os2->sTypoAscender - properties.os2->sTypoDescender
+		+ properties.os2->sTypoLineGap;
+	ascent = properties.os2->sTypoAscender
+		+ properties.os2->sTypoLineGap/2;
+	pf->ascent = (ascent * height + h/2) / h;
+	pf->descent = height - pf->ascent;
+#endif
+	/* Create a glyph container */
+	if (TT_New_Glyph (pf->face, &pf->glyph) != TT_Err_Ok)
+		goto out;
+
+	/* create instance */
+	if (TT_New_Instance (pf->face, &pf->instance) != TT_Err_Ok)
+		goto out;
+
+	/* Set the instance resolution */
+	if (TT_Set_Instance_Resolutions (pf->instance, 96, 96) != TT_Err_Ok)
+		goto out;
+
+	/* Look for a Unicode charmap: Windows flavor of Apple flavor only */
+	n = properties.num_CharMaps;
+
+	for (i = 0; i < n; i++) {
+		TT_Get_CharMap_ID (pf->face, i, &platform, &encoding);
+		if (((platform == TT_PLATFORM_MICROSOFT) &&
+			(encoding == TT_MS_ID_UNICODE_CS)) ||
+				((platform == TT_PLATFORM_APPLE_UNICODE) &&
+			 		(encoding == TT_APPLE_ID_DEFAULT)))
+		{
+			TT_Get_CharMap (pf->face, i, &pf->char_map);
+			i = n + 1;
+		}
+	}
+	if (i == n) {
+		DPRINTF("freetype_createfont: no unicode map table\n");
+		goto out;
+	}
+	
+	GdSetFontSize((PMWFONT)pf, height);
+	GdSetFontRotation((PMWFONT)pf, 0);
+	GdSetFontAttr((PMWFONT)pf, attr, 0);
+
+	return pf;
+
+out:
+	free(pf);
+	return NULL;
+}
+
+static int
+compute_kernval(PMWFREETYPEFONT pf, short current_glyph_code)
+{
+	int 		i = 0;
+	int 		kernval;
+	int 		nPairs = pf->directory.tables->t.kern0.nPairs;
+	TT_Kern_0_Pair *pair = pf->directory.tables->t.kern0.pairs;
+
+	if (pf->last_glyph_code != -1) {
+		while ((pair->left != pf->last_glyph_code)
+			&& (pair->right != current_glyph_code))
+		{
+			pair++;
+			i++;
+			if (i == nPairs)
+			break;
+		}
+
+		if (i == nPairs)
+			kernval = 0;
+		else
+			/* We round the value (hence the +32) */
+			kernval = (pair->value + 32) & -64;
+	} else
+		kernval = 0;
+
+	return kernval;
+}
+
+static TT_UShort
+Get_Glyph_Width(PMWFREETYPEFONT pf, TT_UShort glyph_index)
+{
+	TT_Glyph_Metrics metrics;
+	
+    	if (TT_Load_Glyph ( pf->instance, pf->glyph,
+		TT_Char_Index (pf->char_map,glyph_index),
+		TTLOAD_SCALE_GLYPH|TTLOAD_HINT_GLYPH) != TT_Err_Ok)
+    	{
+		/* Try to load default glyph: index 0 */
+		if (TT_Load_Glyph ( pf->instance, pf->glyph, 0,
+			TTLOAD_SCALE_GLYPH|TTLOAD_HINT_GLYPH) != TT_Err_Ok)
+		    return 0;
+	}
+
+	TT_Get_Glyph_Metrics (pf->glyph, &metrics);
+	return((metrics.advance & 0xFFFFFFC0) >> 6);
+}
+
+/* Render a single glyph*/
+static void
+drawchar(PMWFREETYPEFONT pf, PSD psd, TT_Glyph glyph, int x_offset,
+	int y_offset)
+{
+	TT_F26Dot6 	xmin, ymin, xmax, ymax, x, y, z;
+	unsigned char 	*src, *srcptr;
+	MWPIXELVAL 	*dst, *dstptr;
+	MWPIXELVAL 	*bitmap;
+	int 		size, width, height;
+	TT_Outline 	outline;
+	TT_BBox 	bbox;
+	TT_Raster_Map 	Raster;
+	TT_Error 	error;
+	/*MWPIXELVAL 	save;*/
+
+	/* we begin by grid-fitting the bounding box */
+	TT_Get_Glyph_Outline (pf->glyph, &outline);
+	TT_Get_Outline_BBox (&outline, &bbox);
+
+	xmin = (bbox.xMin & -64) >> 6;
+	ymin = (bbox.yMin & -64) >> 6;
+	xmax = ((bbox.xMax + 63) & -64) >> 6;
+	ymax = ((bbox.yMax + 63) & -64) >> 6;
+	width = xmax - xmin;
+	height = ymax - ymin;
+	size = width * height;
+
+	/* now re-allocate the raster bitmap */
+	Raster.rows = height;
+	Raster.width = width;
+
+	if (pf->fontattr&MWTF_ANTIALIAS)
+		Raster.cols = (Raster.width + 3) & -4;	/* pad to 32-bits */
+	else
+		Raster.cols = (Raster.width + 7) & -8;	/* pad to 64-bits ??? */
+
+	Raster.flow = TT_Flow_Up;
+	Raster.size = Raster.rows * Raster.cols;
+	Raster.bitmap = malloc (Raster.size);
+
+	memset (Raster.bitmap, 0, Raster.size);
+
+	/* now render the glyph in the small pixmap */
+
+	/* IMPORTANT NOTE: the offset parameters passed to the function     */
+	/* TT_Get_Glyph_Bitmap() must be integer pixel values, i.e.,        */
+	/* multiples of 64.  HINTING WILL BE RUINED IF THIS ISN'T THE CASE! */
+	/* This is why we _did_ grid-fit the bounding box, especially xmin  */
+	/* and ymin.                                                        */
+
+	if (!(pf->fontattr&MWTF_ANTIALIAS))
+		error = TT_Get_Glyph_Bitmap (pf->glyph, &Raster,
+				-xmin * 64, -ymin * 64);
+	else
+		error = TT_Get_Glyph_Pixmap (pf->glyph, &Raster,
+				-xmin * 64, -ymin * 64);
+
+	if (error) {
+		free (Raster.bitmap);
+		return;
+	}
+
+	bitmap = malloc (size * sizeof (MWPIXELVAL));
+	memset (bitmap, 0, size * sizeof (MWPIXELVAL));
+
+	src = (char *) Raster.bitmap;
+	dst = bitmap + (size - width);
+
+	for (y = ymin; y < ymax; y++) {
+		srcptr = src;
+		dstptr = dst;
+
+		for (x = xmin; x < xmax; x++) {
+			if (pf->fontattr&MWTF_ANTIALIAS)
+				*dstptr++ = gray_palette[(int) *srcptr];
+			else {
+				for(z=0;
+				    z <= ((xmax-x-1) < 7 ? (xmax-x-1) : 7);
+				    z++) {
+					*dstptr++ = ((*srcptr << z) & 0x80)?
+						gr_foreground: gr_background;
+				}
+				x += 7;
+			}
+
+			srcptr++;
+		}
+
+		src += Raster.cols;
+		dst -= width;
+	}
+
+	/* FIXME - must clear background upstairs if not gr_usebg*/
+	/* FIXME: GdArea problem if fg == bg*/
+	/*save = gr_background;*/
+	/*gr_background = gr_foreground + 1;*/
+
+	/* Now draw the bitmap ... */
+	GdArea(psd, x_offset + xmin, y_offset - (ymin + height), width, height,
+		bitmap, MWPF_PIXELVAL);
+
+	/*gr_background = save;*/
+
+	free (bitmap);
+	free (Raster.bitmap);
+}
+
+/*
+ * Draw unicode 16 text string using FREETYPE type font
+ */
+static void
+freetype_drawtext(PMWFONT pfont, PSD psd, MWCOORD ax, MWCOORD ay,
+	const void *text, int cc, int flags)
+{
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	const unsigned short *	str = text;
+	TT_F26Dot6 	x = ax, y = ay;
+	TT_Pos 		vec_x, vec_y;
+	int 		i;
+	TT_F26Dot6	startx, starty;
+	TT_Outline 	outline;
+	TT_UShort 	curchar;
+	TT_Glyph_Metrics metrics;
+	TT_Face_Properties properties;
+	TT_Instance_Metrics imetrics;
+	TT_F26Dot6 ascent, descent;
+	static unsigned char blend[5] = { 0x00, 0x44, 0x88, 0xcc, 0xff };
+	static unsigned char virtual_palette[5] = { 0, 1, 2, 3, 4 };
+
+	pf->last_glyph_code = -1;		/* reset kerning*/
+	pf->last_pen_pos = -32767;
+
+	/* 
+	 * Compute instance ascent & descent values
+	 * in fractional units (1/64th pixel)
+	 */
+	TT_Get_Face_Properties (pf->face, &properties);
+	TT_Get_Instance_Metrics(pf->instance, &imetrics);	
+  
+	ascent = ((properties.horizontal->Ascender * imetrics.y_scale)/0x10000);
+	descent = ((properties.horizontal->Descender*imetrics.y_scale)/0x10000);
+
+	/* 
+	 * Offset the starting point if necessary,
+	 * FreeType always aligns at baseline
+	 */
+	if (flags&MWTF_BOTTOM) {
+		vec_x = 0;
+		vec_y = descent;
+		TT_Transform_Vector(&vec_x, &vec_y,&pf->matrix);
+		x -= vec_x / 64;
+		y += vec_y / 64;
+	} else if (flags&MWTF_TOP) {
+		vec_x = 0;
+		vec_y = ascent;
+		TT_Transform_Vector(&vec_x, &vec_y,&pf->matrix);
+		x -= vec_x / 64;
+		y += vec_y / 64;
+	}
+
+	/* Set the "graylevels" */
+	if (pf->fontattr&MWTF_ANTIALIAS) {
+		TT_Set_Raster_Gray_Palette (engine, virtual_palette);
+
+		alphablend(psd, gray_palette, gr_foreground, gr_background,
+			blend, 5);
+	}
+
+	startx = x;
+	starty = y;
+	for (i = 0; i < cc; i++) {
+		curchar = TT_Char_Index (pf->char_map, str[i]);
+
+		if (TT_Load_Glyph (pf->instance, pf->glyph, curchar,
+			TTLOAD_DEFAULT) != TT_Err_Ok)
+				continue;
+
+		if (pf->fontrotation) {
+			TT_Get_Glyph_Outline (pf->glyph, &outline);
+			TT_Transform_Outline (&outline, &pf->matrix);
+		}
+
+		TT_Get_Glyph_Metrics (pf->glyph, &metrics);
+
+		if ((pf->fontattr&MWTF_KERNING) && pf->can_kern) {
+			if (pf->fontrotation) {
+				vec_x = compute_kernval(pf, curchar);
+				vec_y = 0;
+				TT_Transform_Vector(&vec_x, &vec_y,&pf->matrix);
+
+				x += vec_x / 64;
+				y -= vec_y / 64;
+			} else
+				x += compute_kernval(pf, curchar) / 64;
+		}
+			
+		drawchar(pf, psd, pf->glyph, x, y);
+
+		if (pf->fontrotation) {
+			vec_x = metrics.advance;
+			vec_y = 0;
+			TT_Transform_Vector (&vec_x, &vec_y, &pf->matrix);
+
+			x += vec_x / 64;
+			y -= vec_y / 64;
+		} else {
+			x += metrics.advance / 64;
+
+			/* Kerning point syndrome avoidance */
+			if (pf->last_pen_pos > x)
+				x = pf->last_pen_pos;
+			pf->last_pen_pos = x;
+		}
+
+		pf->last_glyph_code = curchar;
+	}
+
+	if (pf->fontattr & MWTF_UNDERLINE)
+		GdLine(psd, startx, starty, x, y, FALSE);
+}
+
+/*
+ * Return information about a specified font.
+ */
+static MWBOOL
+freetype_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo)
+{
+	int	i;
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	TT_Face_Properties 	properties;
+    TT_Instance_Metrics imetrics;
+    TT_UShort last_glyph_index;
+
+	TT_Get_Face_Properties (pf->face, &properties);
+    TT_Get_Instance_Metrics(pf->instance, &imetrics);
+
+    /* Fill up the fields */
+	pfontinfo->height = (((properties.horizontal->Ascender * \
+	                        imetrics.y_scale)/ 0x10000) >> 6) -
+	                    (((properties.horizontal->Descender * \
+	                        imetrics.y_scale)/ 0x10000) >> 6);
+	pfontinfo->maxwidth = ((properties.horizontal->xMax_Extent * \
+	                        imetrics.x_scale)/ 0x10000) >> 6;
+	pfontinfo->baseline = ((properties.horizontal->Ascender * \
+	                        imetrics.y_scale)/ 0x10000) >> 6;
+	pfontinfo->firstchar = TT_CharMap_First(pf->char_map, NULL);
+	pfontinfo->lastchar = TT_CharMap_Last(pf->char_map, NULL);
+	pfontinfo->fixed = properties.postscript->isFixedPitch;
+		
+    last_glyph_index = properties.num_Glyphs > 255 ? 255: properties.num_Glyphs-1;
+
+    /* Doesn't work ... don't know why ....*/
+#if 0
+    if (TT_Get_Face_Widths( pf->face, 0,
+                            last_glyph_index, widths, NULL ) != TT_Err_Ok) {
+        return TRUE;
+    }
+
+    for(i=0; i<=last_glyph_index; i++)
+		DPRINTF("widths[%d]: %d\n", i, widths[i]);
+#endif
+
+    /* Get glyphs widths */
+	for(i=0; i<=last_glyph_index; i++)
+		pfontinfo->widths[i] = Get_Glyph_Width(pf, i);
+
+#if 0
+    DPRINTF("x_ppem: %d\ny_ppem: %d\nx_scale: %d\ny_scale: %d\n\
+    x_resolution: %d\ny_resolution: %d\n",
+    imetrics.x_ppem, imetrics.y_ppem, imetrics.x_scale, \
+    imetrics.y_scale, imetrics.x_resolution, imetrics.y_resolution);
+
+    DPRINTF("Ascender: %d\nDescender: %d\nxMax_Extent: %d\n\
+    Mac Style Say Italic?: %d\nMac Style Say Bold?: %d\n\
+    sTypoAscender: %d\nsTypoDescender: %d\nusWinAscent: %d\n\
+    usWinDescent: %d\nusFirstCharIndex: %d\nusLastCharIndex: %d\n\
+    OS2 Say Italic?: %d\nOS2 Say Bold?: %d\nOS2 Say monospaced?: %d\n\
+    Postscript Say monospaced?: %d\n",\
+    properties.horizontal->Ascender,
+    properties.horizontal->Descender,
+    properties.horizontal->xMax_Extent,
+    (properties.header->Mac_Style & 0x2)?1:0,
+    (properties.header->Mac_Style & 0x1)?1:0,
+    properties.os2->sTypoAscender,
+    properties.os2->sTypoDescender,
+    properties.os2->usWinAscent,
+    properties.os2->usWinDescent,
+    properties.os2->usFirstCharIndex,
+    properties.os2->usLastCharIndex,
+    (properties.os2->fsSelection & 0x1)?1:0,
+    (properties.os2->fsSelection & 0x20)?1:0,
+    properties.postscript->isFixedPitch,
+    (properties.os2->panose[3] == 9)?1:0);
+#endif	
+			
+	return TRUE;
+}
+
+static void
+freetype_gettextsize(PMWFONT pfont, const void *text, int cc,
+	MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase)
+{
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	const unsigned short *	str = text;
+	TT_F26Dot6 	x = 0;
+	int 		i;
+	TT_UShort 	curchar;
+	TT_Glyph_Metrics metrics;
+	TT_Face_Properties 	properties;
+	TT_Instance_Metrics imetrics;
+
+	TT_Get_Face_Properties (pf->face, &properties);
+	TT_Get_Instance_Metrics(pf->instance, &imetrics);
+	
+	pf->last_glyph_code = -1;		/* reset kerning*/
+	pf->last_pen_pos = -32767;
+	
+	for (i = 0; i < cc; i++) {
+		curchar = TT_Char_Index (pf->char_map, str[i]);
+
+		if (TT_Load_Glyph (pf->instance, pf->glyph, curchar,
+			TTLOAD_SCALE_GLYPH|TTLOAD_HINT_GLYPH) != TT_Err_Ok)
+				continue;
+
+		TT_Get_Glyph_Metrics (pf->glyph, &metrics);
+
+		if ((pf->fontattr&MWTF_KERNING) && pf->can_kern) {
+				x += compute_kernval(pf, curchar) / 64;
+		}
+		
+		x += metrics.advance / 64;
+
+		/* Kerning point syndrome avoidance */
+		if (pf->last_pen_pos > x)
+			x = pf->last_pen_pos;
+		pf->last_pen_pos = x;
+
+		pf->last_glyph_code = curchar;
+	}
+
+	*pwidth = x;
+	*pheight =  (((properties.horizontal->Ascender * 
+	                imetrics.y_scale)/ 0x10000) >> 6) -
+	            (((properties.horizontal->Descender * 
+	            imetrics.y_scale)/ 0x10000) >> 6);
+    	/* FIXME: is it what's required ?? */
+	*pbase = (((-properties.horizontal->Descender) * 
+	            imetrics.y_scale)/ 0x10000) >> 6;
+}
+
+static void
+freetype_destroyfont(PMWFONT pfont)
+{
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+
+	TT_Close_Face(pf->face);
+	free(pf);
+}
+
+static void
+freetype_setfontsize(PMWFONT pfont, MWCOORD fontsize)
+{
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	
+	pf->fontsize = fontsize;
+	
+	/* We want real pixel sizes ... not points ...*/
+	TT_Set_Instance_PixelSizes( pf->instance, pf->fontsize,
+                                pf->fontsize, pf->fontsize * 64 );
+#if 0
+	/* set charsize (convert to points for freetype)*/
+	TT_Set_Instance_CharSize (pf->instance,
+		((pf->fontsize * 72 + 96/2) / 96) * 64);
+#endif
+}
+
+static void
+freetype_setfontrotation(PMWFONT pfont, int tenthdegrees)
+{
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	float 		angle;
+	
+	pf->fontrotation = tenthdegrees;
+
+	/* Build the rotation matrix with the given angle */
+	TT_Set_Instance_Transform_Flags (pf->instance, TRUE, FALSE);
+
+	angle = pf->fontrotation * M_PI / 1800;
+	pf->matrix.yy = (TT_Fixed) (cos (angle) * (1 << 16));
+	pf->matrix.yx = (TT_Fixed) (sin (angle) * (1 << 16));
+	pf->matrix.xx = pf->matrix.yy;
+	pf->matrix.xy = -pf->matrix.yx;
+}
+
+#endif /* HAVE_FREETYPE_SUPPORT*/
+
+/* UTF-8 to UTF-16 conversion.  Surrogates are handeled properly, e.g.
+ * a single 4-byte UTF-8 character is encoded into a surrogate pair.
+ * On the other hand, if the UTF-8 string contains surrogate values, this
+ * is considered an error and returned as such.
+ *
+ * The destination array must be able to hold as many Unicode-16 characters
+ * as there are ASCII characters in the UTF-8 string.  This in case all UTF-8
+ * characters are ASCII characters.  No more will be needed.
+ *
+ * Copyright (c) 2000 Morten Rolland, Screen Media
+ */
+static int
+utf8_to_utf16(const unsigned char *utf8, int cc, unsigned short *unicode16)
+{
+	int count = 0;
+	unsigned char c0, c1;
+	unsigned long scalar;
+
+	while(--cc >= 0) {
+		c0 = *utf8++;
+		/*DPRINTF("Trying: %02x\n",c0);*/
+
+		if ( c0 < 0x80 ) {
+			/* Plain ASCII character, simple translation :-) */
+			*unicode16++ = c0;
+			count++;
+			continue;
+		}
+
+		if ( (c0 & 0xc0) == 0x80 )
+			/* Illegal; starts with 10xxxxxx */
+			return -1;
+
+		/* c0 must be 11xxxxxx if we get here => at least 2 bytes */
+		scalar = c0;
+		if(--cc < 0)
+			return -1;
+		c1 = *utf8++;
+		/*DPRINTF("c1=%02x\n",c1);*/
+		if ( (c1 & 0xc0) != 0x80 )
+			/* Bad byte */
+			return -1;
+		scalar <<= 6;
+		scalar |= (c1 & 0x3f);
+
+		if ( !(c0 & 0x20) ) {
+			/* Two bytes UTF-8 */
+			if ( scalar < 0x80 )
+				return -1;	/* Overlong encoding */
+			*unicode16++ = scalar & 0x7ff;
+			count++;
+			continue;
+		}
+
+		/* c0 must be 111xxxxx if we get here => at least 3 bytes */
+		if(--cc < 0)
+			return -1;
+		c1 = *utf8++;
+		/*DPRINTF("c1=%02x\n",c1);*/
+		if ( (c1 & 0xc0) != 0x80 )
+			/* Bad byte */
+			return -1;
+		scalar <<= 6;
+		scalar |= (c1 & 0x3f);
+
+		if ( !(c0 & 0x10) ) {
+			/*DPRINTF("####\n");*/
+			/* Three bytes UTF-8 */
+			if ( scalar < 0x800 )
+				return -1;	/* Overlong encoding */
+			if ( scalar >= 0xd800 && scalar < 0xe000 )
+				return -1;	/* UTF-16 high/low halfs */
+			*unicode16++ = scalar & 0xffff;
+			count++;
+			continue;
+		}
+
+		/* c0 must be 1111xxxx if we get here => at least 4 bytes */
+		c1 = *utf8++;
+		if(--cc < 0)
+			return -1;
+		/*DPRINTF("c1=%02x\n",c1);*/
+		if ( (c1 & 0xc0) != 0x80 )
+			/* Bad byte */
+			return -1;
+		scalar <<= 6;
+		scalar |= (c1 & 0x3f);
+
+		if ( !(c0 & 0x08) ) {
+			/* Four bytes UTF-8, needs encoding as surrogates */
+			if ( scalar < 0x10000 )
+				return -1;	/* Overlong encoding */
+			scalar -= 0x10000;
+			*unicode16++ = ((scalar >> 10) & 0x3ff) + 0xd800;
+			*unicode16++ = (scalar & 0x3ff) + 0xdc00;
+			count += 2;
+			continue;
+		}
+
+		return -1;	/* No support for more than four byte UTF-8 */
+	}
+	return count;
+}
+
+#if HAVE_HZK_SUPPORT
+
+/* UniCode-16 (MWTF_UC16) to GB(MWTF_ASCII) Chinese Characters conversion.
+ * a single 2-byte UC16 character is encoded into a surrogate pair.
+ * return -1 ,if error;
+ * The destination array must be able to hold as many
+ * as there are Unicode-16 characters.
+ *
+ * Copyright (c) 2000 Tang Hao (TownHall)(tang_hao@263.net).
+ */
+static int
+UC16_to_GB(const unsigned char *uc16, int cc, unsigned char *ascii)
+{
+	FILE* fp;
+	char buffer[256];
+	unsigned char *uc16p;
+	int i=0,j=0, k;
+	unsigned char *filebuffer;
+	unsigned short *uc16pp,*table;
+	unsigned short uc16px;
+	int length=31504;
+
+	if (use_big5)
+		length=54840;
+
+    	uc16p=(unsigned char *) uc16;
+	uc16pp=(unsigned short *) uc16;
+
+	strcpy(buffer,HZK_FONT_DIR);
+	if (use_big5)
+    		strcat(buffer,"/BG2UBG.KU");
+	else
+    		strcat(buffer,"/UGB2GB.KU");
+	if(!(fp = fopen(buffer, "rb"))) 
+	{
+   	  	 fprintf (stderr, "Error.\nThe %s file can not be found!\n",buffer);
+   		 return -1;
+    	}
+
+	filebuffer= (unsigned char *)malloc ( length);
+
+	if(fread(filebuffer, sizeof(char),length, fp) < length) {
+	   	  fprintf (stderr, "Error in reading ugb2gb.ku file!\n");
+	   	  fclose(fp);
+ 	     	  return -1;
+	}
+    	fclose(fp);
+
+	if (use_big5)
+	{
+		table=(unsigned short *)filebuffer;
+		while(1)
+		{
+			if(j>=cc)
+			{
+				ascii[i]=0;
+				break;
+			}
+			uc16px=*uc16pp;
+			if((uc16px)<=0x00ff)
+			{
+				ascii[i]=(char)(*uc16pp);
+				i++;
+			}
+			else
+			{
+				ascii[i]=0xa1; ascii[i+1]=0x40;
+				for (k=0; k<13710; k++)
+				{
+					if (*(table+(k*2+1))==(uc16px))
+					{
+						ascii[i]=(char)((*(table+(k*2)) & 0xff00) >> 8);
+						ascii[i+1]=(char)(*(table+(k*2)) & 0x00ff);
+						break;
+					}
+				}
+				i+=2;
+			}
+			uc16pp++; j++;
+		}
+	}
+	else
+	{
+	while(1)
+	{
+		if(j>=cc)
+		{
+			ascii[i]=0;
+			break;
+		}
+		if((*((uc16p)+j)==0)&&(*((uc16p)+j+1)==0))
+		{
+			ascii[i]=0;
+			break;
+		}
+		else
+		{
+			if(*((uc16p)+j+1)==0)
+			{
+				ascii[i]=*((uc16p)+j);
+				i++;
+				j+=2;
+			}
+			else
+			{
+			//*	 to find the place of unicode charater .���ַ�ƥ��
+            		{
+				int p1=0,p2=length-4,p;
+				unsigned int c1,c2,c,d;
+				c1=((unsigned int )filebuffer[p1])*0x100+(filebuffer[p1+1]);
+                		c2=((unsigned int )filebuffer[p2])*0x100+(filebuffer[p2+1]);
+				d=((unsigned int )*((uc16p)+j))*0x100+*((uc16p)+j+1);
+                		if(c1==d)
+				{
+					ascii[i]=filebuffer[p1+2];
+					ascii[i+1]=filebuffer[p1+3];
+					goto findit;
+ 	            		}
+                		if(c2==d)
+				{
+					ascii[i]=filebuffer[p2+2];
+					ascii[i+1]=filebuffer[p2+3];
+					goto findit;
+                		}
+				while(1)
+				{
+					p=(((p2-p1)/2+p1)>>2)<<2;
+					c=((unsigned int )filebuffer[p])*0x100+(filebuffer[p+1]);
+					if(d==c)	//find it
+					{
+						ascii[i]=filebuffer[p+2];
+						ascii[i+1]=filebuffer[p+3];
+						break;
+          	   	   		}
+					else if(p2<=p1+4) //can't find.
+					{
+						ascii[i]='.';//*((uc16p)+j);
+						ascii[i+1]='.';//*((uc16p)+j+1);
+						break;
+					}
+					else if(d<c)
+					{
+						p2=p;
+						c2=c;										
+                  			}
+					else
+					{
+						p1=p;
+						c1=c;														
+					}
+				}
+	            	}
+			findit:
+  			i+=2;
+			j+=2;
+			}
+		}
+	}
+	}//jmt+
+	free(filebuffer);
+
+	return i;
+}
+
+/************************** functions definition ******************************/
+
+static int hzk_id( PMWHZKFONT pf )
+{
+	switch(pf->font_height)
+	{
+	case 12:
+		return 0;
+	case 16: default:
+		return 1;
+	}
+}
+
+/* This function get Chinese font info from etc file.*/
+static MWBOOL GetCFontInfo( PMWHZKFONT pf )
+{
+	int charset;
+
+	if (use_big5)
+		charset=(13094+408);
+	else
+		charset=8178;
+
+    	CFont[hzk_id(pf)].width = pf->cfont_width;
+    	pf->CFont.width = pf->cfont_width;
+
+    	CFont[hzk_id(pf)].height = pf->font_height;
+    	pf->CFont.height = pf->font_height;
+
+    	CFont[hzk_id(pf)].size = ((pf->CFont.width + 7) / 8) *
+		pf->CFont.height * charset;
+    	pf->CFont.size = ((pf->CFont.width + 7) / 8) * pf->CFont.height * charset;
+
+    	if(pf->CFont.size < charset * 8)
+        	return FALSE;
+
+	strcpy(CFont[hzk_id(pf)].file,HZK_FONT_DIR);
+	strcpy(pf->CFont.file,HZK_FONT_DIR);
+
+	if(pf->font_height==16)
+	{
+		strcat(CFont[hzk_id(pf)].file,"/hzk16");
+		strcat(pf->CFont.file,"/hzk16");
+	}
+	else
+	{
+		strcat(CFont[hzk_id(pf)].file,"/hzk12");
+		strcat(pf->CFont.file,"/hzk12");
+	}
+
+    	if (use_big5)//jmt+
+    	{
+		CFont[hzk_id(pf)].file[strlen(pf->CFont.file)-3]+=use_big5;
+		pf->CFont.file[strlen(pf->CFont.file)-3]+=use_big5;
+    	}
+
+    	return TRUE;
+}
+
+// This function get ASCII font info from etc file.
+static MWBOOL GetAFontInfo( PMWHZKFONT pf )
+{
+    	AFont[hzk_id(pf)].width = pf->afont_width;
+    	pf->AFont.width = pf->afont_width;
+
+    	AFont[hzk_id(pf)].height = pf->font_height;
+    	pf->AFont.height = pf->font_height;
+
+    	AFont[hzk_id(pf)].size = ((pf->AFont.width + 7) / 8) *
+		pf->AFont.height * 255;
+    	pf->AFont.size = ((pf->AFont.width + 7) / 8) * pf->AFont.height * 255;
+    
+	if(pf->AFont.size < 255 * 8)
+        	return FALSE;
+
+	strcpy(AFont[hzk_id(pf)].file,HZK_FONT_DIR);
+	strcpy(pf->AFont.file,HZK_FONT_DIR);
+	
+	if(pf->font_height==16)
+	{
+	    	strcat(AFont[hzk_id(pf)].file,"/asc16");
+	    	strcat(pf->AFont.file,"/asc16");
+	}
+  	else
+	{
+	    	strcat(AFont[hzk_id(pf)].file,"/asc12");
+	    	strcat(pf->AFont.file,"/asc12");
+	}
+    	return TRUE;
+}
+
+// This function load system font into memory.
+static MWBOOL LoadFont( PMWHZKFONT pf )
+{
+    	FILE* fp;
+
+	if(!GetCFontInfo(pf))
+	{
+		fprintf (stderr, "Get Chinese HZK font info failure!\n");
+		return FALSE;
+	}
+    	if(CFont[hzk_id(pf)].pFont == NULL)//check font cache
+	{
+		
+
+ 	   	// Allocate system memory for Chinese font.
+ 		if( !(CFont[hzk_id(pf)].pFont = (char *)malloc(pf->CFont.size)) )
+ 		{
+	 	       	fprintf (stderr, "Allocate memory for Chinese HZK font failure.\n");
+		        return FALSE;
+	 	}
+ 	
+		// Open font file and read information to the system memory.
+ 		fprintf (stderr, "Loading Chinese HZK font from file(%s)..." ,pf->CFont.file);
+		if(!(fp = fopen(CFont[hzk_id(pf)].file, "rb"))) 
+		{
+   		  	fprintf (stderr, "Error.\nThe Chinese HZK font file can not be found!\n");
+   	    	 	return FALSE;
+    		}
+	    	if(fread(CFont[hzk_id(pf)].pFont, sizeof(char), pf->CFont.size, fp) < pf->CFont.size) 
+		{
+	      	  	fprintf (stderr, "Error in reading Chinese HZK font file!\n");
+	 	     	fclose(fp);
+ 	       		return FALSE;
+		}
+
+		fclose(fp);
+
+		CFont[hzk_id(pf)].use_count=0;//
+
+		fprintf (stderr, "done.\n" );
+
+	}
+	cfont_address = CFont[hzk_id(pf)].pFont;
+	pf->cfont_address = CFont[hzk_id(pf)].pFont;
+	pf->CFont.pFont = CFont[hzk_id(pf)].pFont;
+
+	CFont[hzk_id(pf)].use_count++;//jmt+
+
+	if(!GetAFontInfo(pf))
+	{
+	       fprintf (stderr, "Get ASCII HZK font info failure!\n");
+	       return FALSE;
+	}
+    	if(AFont[hzk_id(pf)].pFont == NULL)//check font cache
+	{
+		
+ 		
+ 		// Allocate system memory for ASCII font.
+ 		if( !(AFont[hzk_id(pf)].pFont = (char *)malloc(pf->AFont.size)) )
+ 		{
+ 		       	fprintf (stderr, "Allocate memory for ASCII HZK font failure.\n");
+ 		       	free(CFont[hzk_id(pf)].pFont);
+ 		       	CFont[hzk_id(pf)].pFont = NULL;
+			return FALSE;
+ 		}
+ 	
+	 	// Load ASCII font information to the near memory.
+ 		fprintf (stderr, "Loading ASCII HZK font..." );
+ 		if(!(fp = fopen(AFont[hzk_id(pf)].file, "rb"))) 
+		{
+ 		       	fprintf (stderr, "Error.\nThe ASCII HZK font file can not be found!\n");
+ 		       	return FALSE;
+ 		}
+	 	if(fread(AFont[hzk_id(pf)].pFont, sizeof(char), pf->AFont.size, fp) < pf->AFont.size) 
+		{
+ 		       	fprintf (stderr, "Error in reading ASCII HZK font file!\n");
+ 		       	fclose(fp);
+ 		       	return FALSE;
+	 	}
+ 	
+ 		fclose(fp);
+ 	
+		AFont[hzk_id(pf)].use_count=0;//
+
+		fprintf (stderr, "done.\n" );
+
+  	}
+	afont_address = AFont[hzk_id(pf)].pFont;
+	pf->afont_address = AFont[hzk_id(pf)].pFont;
+	pf->AFont.pFont = AFont[hzk_id(pf)].pFont;
+
+	AFont[hzk_id(pf)].use_count++;//jmt+
+
+  	return TRUE;
+}
+
+// This function unload system font from memory.
+static void UnloadFont( PMWHZKFONT pf )
+{
+	CFont[hzk_id(pf)].use_count--;
+	AFont[hzk_id(pf)].use_count--;
+
+	if (!CFont[hzk_id(pf)].use_count)
+	{	
+	    	free(pf->CFont.pFont);
+	    	free(pf->AFont.pFont);
+
+	    	CFont[hzk_id(pf)].pFont = NULL;
+	    	AFont[hzk_id(pf)].pFont = NULL;
+	}
+}
+
+static int
+hzk_init(PSD psd)
+{
+	/* FIXME: *.KU file should be opened and
+	 * read in here...*/
+	return 1;
+}
+
+static PMWHZKFONT
+hzk_createfont(const char *name, MWCOORD height, int attr)
+{
+	PMWHZKFONT	pf;
+
+	if(strcmp(name,"HZKFONT")!=0 && strcmp(name,"HZXFONT")!=0)
+		return FALSE;
+
+printf("hzk_createfont(%s,%d)\n",name,height);
+
+	use_big5=name[2]-'K';
+
+	/* allocate font structure*/
+	pf = (PMWHZKFONT)calloc(sizeof(MWHZKFONT), 1);
+	if (!pf)
+		return NULL;
+	pf->fontprocs = &hzk_procs;
+
+	pf->fontsize=height;
+	//GdSetFontSize((PMWFONT)pf, height);
+	GdSetFontRotation((PMWFONT)pf, 0);
+	GdSetFontAttr((PMWFONT)pf, attr, 0);
+
+	if(height==12)
+	{		
+		afont_width = 6;
+		cfont_width = 12;
+		font_height = 12;
+
+		pf->afont_width = 6;
+		pf->cfont_width = 12;
+		pf->font_height = 12;
+	}
+	else 	
+	{		
+		afont_width = 8;
+		cfont_width = 16;
+		font_height = 16;
+
+		pf->afont_width = 8;
+		pf->cfont_width = 16;
+		pf->font_height = 16;
+	}
+
+    	// Load the font library to the system memory.
+	if(!LoadFont(pf))
+  	      	return FALSE;
+
+	return pf;
+}
+
+int IsBig5(int i)//jmt+
+{
+	if ((i>=0xa140 && i<=0xa3bf) || /* a140-a3bf(!a3e0) */
+	    (i>=0xa440 && i<=0xc67e) || /* a440-c67e        */
+	    (i>=0xc6a1 && i<=0xc8d3) || /* c6a1-c8d3(!c8fe) */
+	    (i>=0xc940 && i<=0xf9fe))   /* c940-f9fe        */
+		return 1;
+	else
+		return 0;
+}
+
+/*
+ * following several function is used in hzk_drawtext
+ */
+
+static int getnextchar(char* s, unsigned char* cc)
+{
+    	if( s[0] == '\0') return 0;
+
+    	cc[0] = (unsigned char)(*s);
+    	cc[1] = (unsigned char)(*(s + 1));
+
+    	if (use_big5)
+    	{
+		if( IsBig5( (int) ( (cc[0] << 8) + cc[1]) ) )
+			return 1;
+    	}
+    	else
+	{
+    		if( ((unsigned char)cc[0] > 0xa0) &&
+		    ((unsigned char)cc[1] > 0xa0) )
+        		return 1;
+	}
+
+    	cc[1] = '\0';
+
+    	return 1;
+}
+
+static void
+expandcchar(PMWHZKFONT pf, int bg, int fg, unsigned char* c, MWPIXELVAL* bitmap)
+{
+	int i=0;
+    	int c1, c2, seq;
+	int x,y;
+    	unsigned char *font;
+    	int b = 0;		/* keep gcc happy with b = 0 - MW */
+
+	int pixelsize;
+	pixelsize=sizeof(MWPIXELVAL);
+
+   	c1 = c[0];
+    	c2 = c[1];
+	if (use_big5)//jmt+
+	{
+		seq=0;
+		//ladd=loby-(if(loby<127)?64:98)
+		c2-=(c2<127?64:98);   
+
+		//hadd=(hiby-164)*157
+		if (c1>=0xa4)//standard font
+		{
+			seq=(((c1-164)*157)+c2);
+			if (seq>=5809) seq-=408;
+		}
+
+		//hadd=(hiby-161)*157
+		if (c1<=0xa3)//special font
+			seq=(((c1-161)*157)+c2)+13094;
+	}
+	else
+    		seq=((c1 - 161)*94 + c2 - 161); 
+
+	font = pf->cfont_address + ((seq) *
+		  (pf->font_height * ((pf->cfont_width + 7) / 8)));
+
+     	for (y = 0; y < pf->font_height; y++)
+        	for (x = 0; x < pf->cfont_width; x++) 
+		{
+            		if (x % 8 == 0)
+                		b = *font++;
+
+            		if (b & (128 >> (x % 8)))   /* pixel */
+			  	bitmap[i++]=fg;
+			else
+				bitmap[i++]=bg;
+		}		
+}
+
+static void expandchar(PMWHZKFONT pf, int bg, int fg, int c, MWPIXELVAL* bitmap)
+{
+	int i=0;
+	int x,y;
+    	unsigned char *font;
+	int pixelsize;
+    	int b = 0;		/* keep gcc happy with b = 0 - MW */
+
+	pixelsize=sizeof(MWPIXELVAL);
+
+    	font = pf->afont_address + c * (pf->font_height *
+		((pf->afont_width + 7) / 8));
+
+  	for (y = 0; y < pf->font_height; y++)
+		for (x = 0; x < pf->afont_width; x++) 
+		{
+	    		if (x % 8 == 0)
+				b = *font++;
+	    		if (b & (128 >> (x % 8)))	/* pixel */
+				bitmap[i++]=fg;
+			else
+				bitmap[i++]=bg;
+  		}
+}
+
+/*
+ * Draw ASCII text string using HZK type font
+ */
+static void
+hzk_drawtext(PMWFONT pfont, PSD psd, MWCOORD ax, MWCOORD ay,
+	const void *text, int cc, int flags)
+{
+	PMWHZKFONT pf=(PMWHZKFONT)pfont;
+
+    	unsigned char c[2];
+	MWPIXELVAL *bitmap;
+    	unsigned char s1[3];
+ 	char *s,*sbegin;
+
+	s=(char *)text;
+
+	if(cc==1)
+	{
+		s1[0]=*((unsigned char*)text);
+		s1[1]=0x0;
+		s1[2]=0x0;
+		s=s1;
+    	}
+
+	sbegin=s;
+    	bitmap = (MWPIXELVAL *)ALLOCA(pf->cfont_width * pf->font_height *
+			sizeof(MWPIXELVAL));
+
+    	while( getnextchar(s, c) )
+	{
+              	if( c[1] != '\0') 
+		{
+                	expandcchar(pf, gr_background,gr_foreground,
+                            c, bitmap);
+			/* Now draw the bitmap ... */
+			
+			if (flags&MWTF_TOP)//jmt+ 
+				GdArea(psd,ax, ay, pf->cfont_width,
+					pf->font_height, bitmap, MWPF_PIXELVAL);
+			else
+				GdArea(psd,ax, ay-pf->font_height+2,
+					pf->cfont_width, pf->font_height,
+					bitmap, MWPF_PIXELVAL);
+
+                	s += 2;
+                	ax += pf->cfont_width;
+            	}
+            	else 
+		{
+                	expandchar(pf, gr_background,gr_foreground,
+                           c[0], bitmap);
+			/* Now draw the bitmap ... */
+
+			if (flags&MWTF_TOP) 
+				GdArea(psd,ax, ay, pf->afont_width,
+					pf->font_height, bitmap, MWPF_PIXELVAL);
+			else
+				GdArea(psd,ax, ay-pf->font_height+2,
+					pf->afont_width, pf->font_height,
+					bitmap, MWPF_PIXELVAL);
+
+                	s += 1;
+                	ax += pf->afont_width;
+            	}
+						
+		if(s>=sbegin+cc)break;
+    	}
+
+	FREEA(bitmap);
+}
+
+/*
+ * Return information about a specified font.
+ */
+static MWBOOL
+hzk_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo)
+{
+	PMWHZKFONT pf=(PMWHZKFONT)pfont;
+
+	int i;
+
+	pfontinfo->height = pf->font_height;
+	pfontinfo->maxwidth = pf->cfont_width;
+	pfontinfo->baseline = pf->font_height-2;
+	pfontinfo->firstchar = 0;
+	pfontinfo->lastchar = 0;
+	pfontinfo->fixed = TRUE;
+		
+	for(i=0; i<=256; i++)
+		pfontinfo->widths[i] = pf->afont_width;
+
+	return TRUE;
+}
+
+static void
+hzk_gettextsize(PMWFONT pfont, const void *text, int cc,
+	MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase)
+{
+	PMWHZKFONT pf=(PMWHZKFONT)pfont;
+
+   	unsigned char c[2];
+ 	char *s,*sbegin;
+    	unsigned char s1[3];
+
+	int ax=0;
+	s=(char *)text;
+	if(cc==0)
+	{
+		*pwidth = 0;
+		*pheight = pf->font_height;
+		*pbase = pf->font_height-2;
+
+	}
+	if(cc==1)
+	{
+		s1[0]=*((unsigned char*)text);
+		s1[1]=0x0;
+		s1[2]=0x0;
+		s=s1;
+    	}
+	sbegin=s;
+    	while( getnextchar(s, c) )
+	{
+		if( c[1] != '\0') 
+		{
+           		s += 2;
+           		ax += pf->cfont_width;
+        	}
+        	else 
+		{
+           		s += 1;
+           		ax += pf->afont_width;
+        	}
+		if(s>=sbegin+cc)break;
+		//	fprintf(stderr,"s=%x,sbegin=%x,cc=%x\n",s,sbegin,cc);
+
+    	}
+//	fprintf(stderr,"ax=%d,\n",ax);
+
+	*pwidth = ax;
+	*pheight = pf->font_height;
+	*pbase = pf->font_height-2;
+}
+
+static void
+hzk_destroyfont(PMWFONT pfont)
+{
+	PMWHZKFONT pf=(PMWHZKFONT)pfont;
+	UnloadFont(pf);
+	free(pf);
+}
+
+static void
+hzk_setfontsize(PMWFONT pfont, MWCOORD fontsize)
+{
+	PMWHZKFONT pf=(PMWHZKFONT)pfont;
+	//jmt: hzk_setfontsize not supported
+	//jmt: & pf->fontsize can't be changed
+	//jmt: because of hzk_id() :p
+	pf->fontsize=pf->font_height;
+}
+#endif /* HAVE_HZK_SUPPORT*/
+
+/* FIXME: this routine should work for all font renderers...*/
+int
+GdGetTextSizeEx(PMWFONT pfont, const void *str, int cc,int nMaxExtent,
+	int* lpnFit, int* alpDx,MWCOORD *pwidth,MWCOORD *pheight,
+	MWCOORD *pbase, int flags)
+{
+#ifdef HAVE_FREETYPE_SUPPORT
+	unsigned short	buf[256];
+	unsigned short* text;
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	int		defencoding = pf->fontprocs->encoding;
+	int 		x = 0;
+	int 		i;
+	TT_UShort 	curchar;
+	TT_Glyph_Metrics metrics;
+	TT_Face_Properties 	properties;
+	TT_Instance_Metrics imetrics;
+
+	if ((cc<0)||(!str))
+	{
+		*pwidth = *pheight = *pbase = 0;
+		return 0;
+	}
+	/* convert encoding if required*/
+	if((flags & MWTF_PACKMASK) != defencoding) 
+	{
+		cc = GdConvertEncoding(str, flags, cc, buf, defencoding);
+		flags &= ~MWTF_PACKMASK;
+		flags |= defencoding;
+		text=buf;
+	} else text =(unsigned short*)str;
+	if(cc <= 0)
+	{
+		*pwidth = *pheight = *pbase = 0;
+		return 0;
+	}
+
+	TT_Get_Face_Properties (pf->face, &properties);
+	TT_Get_Instance_Metrics(pf->instance, &imetrics);
+	
+	pf->last_glyph_code = -1;		/* reset kerning*/
+	pf->last_pen_pos = -32767;
+	if (lpnFit)
+	     *lpnFit=-1;
+	for (i = 0; i < cc; i++) 
+	{
+		curchar = TT_Char_Index (pf->char_map,text[i]);
+		
+		if (TT_Load_Glyph (pf->instance, pf->glyph, curchar,
+			TTLOAD_SCALE_GLYPH|TTLOAD_HINT_GLYPH) != TT_Err_Ok)			
+		{		
+		     printf("Unable to load glyph with index=%d\n",curchar);    
+			return 0;
+		}
+		TT_Get_Glyph_Metrics (pf->glyph, &metrics);
+		if ((pf->fontattr&MWTF_KERNING) && pf->can_kern)
+		{
+			x += compute_kernval(pf, curchar) / 64;
+		}
+		x += metrics.advance / 64;
+     		if((lpnFit)&&(alpDx))
+		{
+			if (x<=nMaxExtent)
+			     alpDx[i]=x;
+			else
+			     if (*lpnFit==-1)
+					(*lpnFit)=i;               		     
+		}
+		/* Kerning point syndrome avoidance */
+		if (pf->last_pen_pos > x)
+			x = pf->last_pen_pos;
+		pf->last_pen_pos = x;
+		pf->last_glyph_code = curchar;
+	}
+     	if ((lpnFit)&&(*lpnFit==-1))
+    		*lpnFit=cc;
+	*pwidth = x;
+	*pheight = (((properties.horizontal->Ascender * 
+	                imetrics.y_scale)/ 0x10000) >> 6) -
+			    (((properties.horizontal->Descender * 
+			    imetrics.y_scale)/ 0x10000) >> 6);
+	//FIXME: is it what's required ??
+	if (pbase)
+		*pbase = (((-properties.horizontal->Descender) * 
+			    imetrics.y_scale)/ 0x10000) >> 6;
+	return 1;
+#else /* HAVE_FREETYPE_SUPPORT*/
+	*pwidth = *pheight = *pbase = 0;
+	return 0;
+#endif
+}
diff -urN lib/microwindows/src/engine/devfont.caching.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devfont.caching.c
--- lib/microwindows/src/engine/devfont.caching.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devfont.caching.c	2005-02-21 16:13:16.000000000 +0100
@@ -0,0 +1,2921 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * T1lib Adobe type1 routines contributed by Vidar Hokstad
+ * Freetype TrueType routines contributed by Martin Jolicoeur
+ * Han Zi Ku routines contributed by Tanghao and Jauming
+ *
+ * Device-independent font and text drawing routines
+ *
+ * These routines do the necessary range checking, clipping, and cursor
+ * overwriting checks, and then call the lower level device dependent
+ * routines to actually do the drawing.  The lower level routines are
+ * only called when it is known that all the pixels to be drawn are
+ * within the device area and are visible.
+ */
+/*#define NDEBUG*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <string.h>
+
+#include "device.h"
+#if (UNIX | DOS_DJGPP)
+#define strcmpi	strcasecmp
+#endif
+
+#if HAVE_T1LIB_SUPPORT
+#include <t1lib.h>
+#define T1LIB_USE_AA_HIGH
+
+typedef struct {
+	PMWFONTPROCS	fontprocs;	/* common hdr*/
+	MWCOORD		fontsize;
+	int		fontrotation;
+	int		fontattr;		
+
+	int		fontid;		/* t1lib stuff*/
+} MWT1LIBFONT, *PMWT1LIBFONT;
+
+static int  t1lib_init(PSD psd);
+static PMWT1LIBFONT t1lib_createfont(const char *name, MWCOORD height,int attr);
+static void t1lib_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+		const void *text, int cc, int flags);
+static MWBOOL t1lib_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo);
+static void t1lib_gettextsize(PMWFONT pfont, const void *text, int cc,
+		MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+static void t1lib_destroyfont(PMWFONT pfont);
+
+/* handling routines for MWT1LIBFONT*/
+static MWFONTPROCS t1lib_procs = {
+	MWTF_ASCII,			/* routines expect ascii*/
+	t1lib_getfontinfo,
+	t1lib_gettextsize,
+	NULL,				/* gettextbits*/
+	t1lib_destroyfont,
+	t1lib_drawtext,
+	NULL,				/* setfontsize*/
+	NULL,				/* setfontrotation*/
+	NULL,				/* setfontattr*/
+};
+#endif
+
+#ifdef T1LIB_USE_AA_HIGH
+typedef unsigned long OUTPIXELVAL;
+#else
+typedef MWPIXELVAL OUTPIXELVAL;
+#endif
+
+#if HAVE_FREETYPE_SUPPORT
+#include <freetype/freetype.h>
+#include <freetype/ftxkern.h>
+#include <freetype/ftnameid.h>
+#include <freetype/ftxcmap.h>
+#include <freetype/ftxwidth.h>
+#include <math.h>
+
+/************/
+
+typedef struct xTT_Glyph_Cache_ {
+
+  TT_Error  error;
+  TT_Glyph  glyph;
+  TT_UShort index;
+  TT_UShort flags;
+
+  struct xTT_Glyph_Cache_ * l;
+  struct xTT_Glyph_Cache_ * r;
+
+} xTT_Glyph_Cache;
+
+typedef struct xTT_Instance_Object_ {
+
+  TT_Face     face;
+  TT_Instance instance;
+
+  xTT_Glyph_Cache * head;
+
+} xTT_Instance_Object;
+
+typedef struct xTT_Instance_ {
+
+  xTT_Instance_Object * instance;
+
+} xTT_Instance;
+
+typedef struct xTT_Outline_Object_ {
+
+  TT_Outline outline;
+  TT_BBox    bbox;
+
+} xTT_Outline_Object;
+
+typedef struct xTT_Outline_ {
+
+  xTT_Outline_Object * outline;
+
+} xTT_Outline;
+
+typedef struct xTT_Glyph_Object_ {
+
+  TT_Glyph * glyph;
+
+  xTT_Outline_Object outline;
+
+} xTT_Glyph_Object;
+
+typedef struct xTT_Glyph_ {
+
+  xTT_Glyph_Object * glyph;
+
+} xTT_Glyph;
+
+TT_Error
+xTT_Glyph_Cache_Find ( xTT_Instance instance,
+		       xTT_Glyph glyph,
+		       TT_UShort glyphIndex,
+		       TT_UShort loadFlags )
+{
+  xTT_Glyph_Cache  * node;
+  xTT_Glyph_Cache ** inode = &instance.instance->head;
+
+  int miss = 0;
+
+  while ( 1 )
+  {
+    if (*inode == 0) 
+    {
+      miss = 1;
+
+      node = *inode = calloc(1,sizeof(**inode));
+
+      if (node == 0)
+	return TT_Err_Out_Of_Memory;
+
+      node->error = TT_New_Glyph(instance.instance->face,&(node->glyph));
+
+      if (node->error == 0)
+	node->error = TT_Load_Glyph(instance.instance->instance,
+				    node->glyph,
+				    (node->index = glyphIndex),
+				    (node->flags = loadFlags));
+
+      if (node->error != 0)
+	TT_Done_Glyph(node->glyph);
+    } 
+    else 
+    {
+      node = *inode;
+    }
+
+    if (glyphIndex < node->index)
+      inode = &node->l;
+    else if (glyphIndex > node->index)
+      inode = &node->r;
+    else if (loadFlags < node->flags)
+      inode = &node->l;
+    else if (loadFlags > node->flags)
+      inode = &node->r;
+    else
+    {
+      static int count [] = { 0, 0 };
+      ++count[miss];
+      printf("\r(%s | hit %d | miss %d)",__TIME__,count[0],count[1]);
+      glyph.glyph->glyph = &node->glyph;
+      return node->error;
+    }
+  }
+}
+
+void
+xTT_Glyph_Cache_Free ( xTT_Glyph_Cache ** pnode )
+{
+  xTT_Glyph_Cache * node;
+
+  if (pnode == 0)
+    return;
+
+  node = *pnode;
+
+  if (node == 0)
+    return;
+
+  if (node->l)
+    xTT_Glyph_Cache_Free(&node->l);
+
+  if (node->r)
+    xTT_Glyph_Cache_Free(&node->r);
+
+  TT_Done_Glyph(node->glyph);
+  free(node);
+
+  *pnode = 0;
+}
+
+TT_Error
+xTT_New_Instance ( TT_Face face,
+		   xTT_Instance * instance )
+{
+  instance->instance = calloc(1,sizeof(*instance->instance));
+  if (instance->instance == 0)
+    return TT_Err_Out_Of_Memory;
+
+  instance->instance->face = face;
+  instance->instance->head = 0;
+
+  return TT_New_Instance(face,&instance->instance->instance);
+}
+
+TT_Error
+xTT_Done_Instance ( xTT_Instance instance )
+{
+  TT_Error error;
+
+  xTT_Glyph_Cache_Free(&instance.instance->head);
+  error = TT_Done_Instance(instance.instance->instance);
+
+  free(instance.instance);
+
+  return error;
+}
+
+TT_Error
+xTT_Get_Instance_Metrics ( xTT_Instance instance,
+			   TT_Instance_Metrics * imetrics )
+{
+  return TT_Get_Instance_Metrics(instance.instance->instance,imetrics);
+}
+
+TT_Error
+xTT_Set_Instance_CharSize ( xTT_Instance instance,
+			    TT_F26Dot6 charsize )
+{
+  xTT_Glyph_Cache_Free(&instance.instance->head);
+  return TT_Set_Instance_CharSize(instance.instance->instance,charsize);
+}
+
+TT_Error
+xTT_Set_Instance_PixelSizes ( xTT_Instance instance,
+			      TT_UShort pixelWidth,
+			      TT_UShort pixelHeight,
+			      TT_F26Dot6 pointSize )
+{
+  xTT_Glyph_Cache_Free(&instance.instance->head);
+  return TT_Set_Instance_PixelSizes(instance.instance->instance,
+				    pixelWidth,
+				    pixelHeight,
+				    pointSize);
+}
+
+TT_Error
+xTT_Set_Instance_Transform_Flags ( xTT_Instance instance, 
+				   TT_Bool rotated,
+				   TT_Bool stretched )
+{
+  xTT_Glyph_Cache_Free(&instance.instance->head);
+  return TT_Set_Instance_Resolutions(instance.instance->instance,
+				     rotated,
+				     stretched);
+}
+
+TT_Error
+xTT_Set_Instance_Resolutions ( xTT_Instance instance,
+			       TT_UShort xResolution,
+			       TT_UShort yResolution )
+{
+  xTT_Glyph_Cache_Free(&instance.instance->head);
+  return TT_Set_Instance_Resolutions(instance.instance->instance,
+				     xResolution,
+				     yResolution);
+}
+
+TT_Error
+xTT_New_Glyph ( TT_Face face,
+		xTT_Glyph * glyph )
+{
+  glyph->glyph = calloc(1,sizeof(*glyph->glyph));
+  if (glyph->glyph == 0)
+    return TT_Err_Out_Of_Memory;
+  return 0;
+}
+
+TT_Error
+xTT_Done_Glyph ( xTT_Glyph glyph )
+{
+  free(glyph.glyph);
+  return 0;
+}
+
+TT_Error
+xTT_Load_Glyph ( xTT_Instance instance,
+		 xTT_Glyph glyph,
+		 TT_UShort glyphIndex,
+		 TT_UShort loadFlags )
+{
+  TT_Error error;
+  error = xTT_Glyph_Cache_Find(instance,glyph,glyphIndex,loadFlags);
+  TT_Get_Glyph_Outline(*glyph.glyph->glyph,
+		       &glyph.glyph->outline.outline);
+  TT_Get_Outline_BBox(&glyph.glyph->outline.outline,
+		      &glyph.glyph->outline.bbox);
+  return error;
+}
+
+TT_Error
+xTT_Get_Glyph_Metrics ( xTT_Glyph glyph,
+			TT_Glyph_Metrics * metrics )
+{
+  return TT_Get_Glyph_Metrics(*glyph.glyph->glyph,metrics);
+}
+
+TT_Error
+xTT_Get_Glyph_Outline ( xTT_Glyph glyph,
+			xTT_Outline * outline )
+{
+  outline->outline = &glyph.glyph->outline;
+  return 0;
+}
+
+TT_Error
+xTT_Get_Outline_BBox ( xTT_Outline * outline,
+		       TT_BBox * bbox )
+{
+  *bbox = outline->outline->bbox;
+  return 0;
+}
+
+void
+xTT_Transform_Outline ( xTT_Outline * outline,
+			TT_Matrix * matrix )
+{
+  TT_Transform_Outline(&outline->outline->outline,matrix);
+  TT_Get_Outline_BBox(&outline->outline->outline,
+		      &outline->outline->bbox);
+}
+
+TT_Error
+xTT_Get_Glyph_Bitmap ( xTT_Glyph glyph,
+		       TT_Raster_Map * bitmap,
+		       TT_F26Dot6 xOffset,
+		       TT_F26Dot6 yOffset )
+{
+  return TT_Get_Glyph_Bitmap(*glyph.glyph->glyph,
+			     bitmap,
+			     xOffset,
+			     yOffset);
+}
+
+TT_Error
+xTT_Get_Glyph_Pixmap ( xTT_Glyph glyph,
+		       TT_Raster_Map * pixmap,
+		       TT_F26Dot6 xOffset,
+		       TT_F26Dot6 yOffset )
+{
+  return TT_Get_Glyph_Pixmap(*glyph.glyph->glyph,
+			     pixmap,
+			     xOffset,
+			     yOffset);
+}
+
+#ifndef xTT_ALIAS
+#define xTT_ALIAS 1
+#endif
+
+#if xTT_ALIAS
+
+#define TT_Instance                     xTT_Instance
+#define TT_Outline                      xTT_Outline
+#define TT_Glyph                        xTT_Glyph
+
+#define TT_New_Instance                 xTT_New_Instance
+#define TT_Done_Instance                xTT_Done_Instance
+
+#define TT_Get_Instance_Metrics         xTT_Get_Instance_Metrics
+#define TT_Set_Instance_CharSize        xTT_Set_Instance_CharSize
+#define TT_Set_Instance_PixelSizes      xTT_Set_Instance_PixelSizes
+#define TT_Set_Instance_Transform_Flags xTT_Set_Instance_Transform_Flags
+#define TT_Set_Instance_Resolutions     xTT_Set_Instance_Resolutions
+
+#define TT_New_Glyph                    xTT_New_Glyph
+#define TT_Done_Glyph                   xTT_Done_Glyph
+
+#define TT_Load_Glyph                   xTT_Load_Glyph
+#define TT_Get_Glyph_Metrics            xTT_Get_Glyph_Metrics
+#define TT_Get_Glyph_Outline            xTT_Get_Glyph_Outline
+#define TT_Get_Glyph_Bitmap             xTT_Get_Glyph_Bitmap
+#define TT_Get_Glyph_Pixmap             xTT_Get_Glyph_Pixmap
+
+#define TT_Get_Outline_BBox             xTT_Get_Outline_BBox
+#define TT_Transform_Outline            xTT_Transform_Outline
+
+#endif
+
+/************/
+
+#ifndef FREETYPE_FONT_DIR
+#define FREETYPE_FONT_DIR "/usr/local/microwin/fonts"
+#endif
+
+#if TT_FREETYPE_MAJOR != 1 | TT_FREETYPE_MINOR < 3
+#error "You must link with freetype lib version 1.3.x +, and not freetype 2. \
+Download it at http://www.freetype.org or http://microwindows.org"
+#endif
+
+#ifndef MWFREETYPEFONT_CACHE
+#define MWFREETYPEFONT_CACHE 1
+#endif
+
+#if MWFREETYPEFONT_CACHE
+
+#ifndef MWFREETYPEFONT_CACHEBITMAP
+#define MWFREETYPEFONT_CACHEBITMAP 1
+#endif
+
+typedef struct mwfreetypefontcache {
+  unsigned curchar;
+  void * buffer;
+#if MWFREETYPEFONT_CACHEBITMAP
+  MWPIXELVAL fg;
+  MWPIXELVAL bg;
+  MWBOOL usebg;
+  void * bitmap;
+#endif
+  struct mwfreetypefontcache * l;
+  struct mwfreetypefontcache * r;
+} MWFREETYPEFONTCACHE;
+
+#endif
+
+typedef struct {
+
+	PMWFONTPROCS	fontprocs;	/* common hdr*/
+	MWCOORD		fontsize;
+	int		fontrotation;
+	int		fontattr;		
+
+	TT_Face 	face;		/* freetype stuff*/
+	TT_Instance	instance;
+	TT_CharMap 	char_map;
+	TT_Kerning 	directory;
+	TT_Matrix 	matrix;
+	TT_Glyph 	glyph;
+	MWBOOL 		can_kern;
+	short 		last_glyph_code;
+	short 		last_pen_pos;
+
+#if MWFREETYPEFONT_CACHE
+        MWFREETYPEFONTCACHE * glyph_cache;
+#endif
+
+} MWFREETYPEFONT, *PMWFREETYPEFONT;
+
+static int  freetype_init(PSD psd);
+static PMWFREETYPEFONT freetype_createfont(const char *name, MWCOORD height,
+		int attr);
+static MWBOOL freetype_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo);
+static void freetype_gettextsize(PMWFONT pfont, const void *text,
+		int cc, MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+static void freetype_destroyfont(PMWFONT pfont);
+static void freetype_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+		const void *text, int cc, int flags);
+static void freetype_setfontsize(PMWFONT pfont, MWCOORD fontsize);
+static void freetype_setfontrotation(PMWFONT pfont, int tenthdegrees);
+		
+/* handling routines for MWFREETYPEFONT*/
+static MWFONTPROCS freetype_procs = {
+	MWTF_UC16,			/* routines expect unicode 16*/
+	freetype_getfontinfo,
+	freetype_gettextsize,
+	NULL,				/* gettextbits*/
+	freetype_destroyfont,
+	freetype_drawtext,
+	freetype_setfontsize,
+	freetype_setfontrotation,
+	NULL,				/* setfontattr*/
+};
+
+static TT_Engine 	engine;		/* THE ONLY freetype engine */
+#endif /* HAVE_FREETYPE_SUPPORT*/
+
+#if HAVE_HZK_SUPPORT
+/*
+ * 12x12 and 16x16 ascii and chinese fonts
+ * Big5 and GB2312 encodings supported
+ */
+#define MAX_PATH	256
+typedef struct {
+	int	width;
+	int	height;
+	int	size;
+	unsigned long use_count;
+	char *	pFont;
+	char	file[MAX_PATH + 1];
+} HZKFONT;
+
+static int use_big5=1;
+static HZKFONT CFont[2];	/* font cache*/
+static HZKFONT AFont[2];	/* font cache*/
+
+/*jmt: moved inside MWHZKFONT*/
+static int afont_width = 8;
+static int cfont_width = 16;
+static int font_height = 16;
+static char *afont_address;
+static char *cfont_address;
+
+typedef struct {
+	PMWFONTPROCS	fontprocs;	/* common hdr*/
+	MWCOORD		fontsize;
+	int		fontrotation;
+	int		fontattr;		
+
+	HZKFONT 	CFont;		/* hzkfont stuff */
+	HZKFONT 	AFont;
+	int 		afont_width;
+	int 		cfont_width;
+	int 		font_height;
+	char 		*afont_address;
+	char 		*cfont_address;
+} MWHZKFONT, *PMWHZKFONT;
+
+static int  hzk_init(PSD psd);
+static PMWHZKFONT hzk_createfont(const char *name, MWCOORD height,int fontattr);
+static MWBOOL hzk_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo);
+static void hzk_gettextsize(PMWFONT pfont, const void *text,
+		int cc, MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+/*static void hzk_gettextbits(PMWFONT pfont, int ch, IMAGEBITS *retmap,
+		MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);*/
+static void hzk_destroyfont(PMWFONT pfont);
+static void hzk_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+		const void *text, int cc, int flags);
+static void hzk_setfontsize(PMWFONT pfont, MWCOORD fontsize);
+/*static void hzk_setfontrotation(PMWFONT pfont, int tenthdegrees);*/
+		
+/* handling routines for MWHZKFONT*/
+static MWFONTPROCS hzk_procs = {
+	MWTF_ASCII,			/* routines expect ASCII*/
+	hzk_getfontinfo,
+	hzk_gettextsize,
+	NULL,				/* hzk_gettextbits*/
+	hzk_destroyfont,
+	hzk_drawtext,
+	hzk_setfontsize,
+	NULL, 				/* setfontrotation*/
+	NULL,				/* setfontattr*/
+};
+
+static int
+UC16_to_GB(const unsigned char *uc16, int cc, unsigned char *ascii);
+#endif /* HAVE_HZK_SUPPORT*/
+
+static PMWFONT	gr_pfont;            	/* current font*/
+
+/* temp extern decls*/
+extern MWPIXELVAL gr_foreground;
+extern MWPIXELVAL gr_background;
+extern MWBOOL gr_usebg;
+
+static int  utf8_to_utf16(const unsigned char *utf8, int cc,
+		unsigned short *unicode16);
+
+#if FONTMAPPER
+/* entry point for font selection*/
+int select_font(const PMWLOGFONT plogfont, char *physname);
+#endif
+
+/*
+ * Set the font for future calls.
+ */
+PMWFONT
+GdSetFont(PMWFONT pfont)
+{
+	PMWFONT	oldfont = gr_pfont;
+	gr_pfont = pfont;
+	return oldfont;
+}
+
+/*
+ * Select a font, based on various parameters.
+ * If plogfont is specified, name and height parms are ignored
+ * and instead used from MWLOGFONT.
+ * 
+ * If height is 0, return builtin font from passed name.
+ * Otherwise find builtin font best match based on height.
+ */
+PMWFONT
+GdCreateFont(PSD psd, const char *name, MWCOORD height,
+	const PMWLOGFONT plogfont)
+{
+	int 		i;
+	int		fontht;
+	int		fontno;
+ 	int		fontclass;
+	int		fontattr = 0;
+	PMWFONT		pfont;
+	PMWCOREFONT	pf = psd->builtin_fonts;
+	MWFONTINFO	fontinfo;
+	MWSCREENINFO 	scrinfo;
+ 	char		fontname[128];
+
+	GdGetScreenInfo(psd, &scrinfo);
+
+	/* if plogfont not specified, use name and height*/
+	if (!plogfont) {
+		if (!name)
+			name = MWFONT_SYSTEM_VAR;
+		strcpy(fontname, name);
+		fontclass = MWLF_CLASS_ANY;
+	} else {
+#if FONTMAPPER
+		/* otherwise, use MWLOGFONT name and height*/
+ 		fontclass = select_font(plogfont, fontname);
+#else
+		if (!name)
+			name = MWFONT_SYSTEM_VAR;
+		strcpy(fontname, name);
+		fontclass = MWLF_CLASS_ANY;
+#endif
+		height = plogfont->lfHeight;
+		if (plogfont->lfUnderline)
+			fontattr = MWTF_UNDERLINE;
+	}
+	height = abs(height);
+ 
+ 	if (!fontclass)
+ 		goto first;
+ 
+	/* use builtin screen fonts, FONT_xxx, if height is 0 */
+ 	if (height == 0 || fontclass == MWLF_CLASS_ANY ||
+	    fontclass == MWLF_CLASS_BUILTIN) {
+  		for(i = 0; i < scrinfo.fonts; ++i) {
+ 			if(!strcmpi(pf[i].name, fontname)) {
+  				pf[i].fontsize = pf[i].cfont->height;
+				pf[i].fontattr = fontattr;
+  				return (PMWFONT)&pf[i];
+  			}
+  		}
+ 
+		/* return first builtin font*/
+		if (height == 0 || fontclass == MWLF_CLASS_BUILTIN)
+			goto first;
+  	}
+
+#if HAVE_HZK_SUPPORT
+        /* Make sure the library is initialized */
+	if (hzk_init(psd)) {
+		pfont = (PMWFONT)hzk_createfont(name, height, fontattr);
+		if(pfont)		
+			return pfont;
+		printf("hzk_createfont: %s not found\n", name);
+	}
+#endif
+
+#if HAVE_FREETYPE_SUPPORT
+ 	if (fontclass == MWLF_CLASS_ANY || fontclass == MWLF_CLASS_FREETYPE) {
+		if (freetype_init(psd)) {
+		/* auto antialias for height > 14 for kaffe*/
+			if (plogfont && plogfont->lfHeight > 14 &&
+				plogfont->lfQuality)
+					fontattr |= MWTF_ANTIALIAS;
+
+			pfont = (PMWFONT)freetype_createfont(fontname, height,
+					fontattr);
+			if(pfont) {
+				/* temp kaffe kluge*/
+				pfont->fontattr |= FS_FREETYPE;
+				return pfont;
+			}
+ 			DPRINTF("freetype_createfont: %s,%d not found\n",
+				fontname, height);
+		}
+  	}
+#endif
+
+#if HAVE_T1LIB_SUPPORT
+	if (fontclass == MWLF_CLASS_ANY || fontclass == MWLF_CLASS_T1LIB) {
+		if (t1lib_init(psd)) {
+			pfont = (PMWFONT)t1lib_createfont(fontname, height,
+					fontattr);
+			if(pfont)
+				return pfont;
+			DPRINTF("t1lib_createfont: %s,%d not found\n",
+				fontname, height);
+		}
+  	}
+#endif
+
+	/* find builtin font closest in height*/
+	if(height != 0) {
+		fontno = 0;
+		height = abs(height);
+		fontht = MAX_MWCOORD;
+		for(i = 0; i < scrinfo.fonts; ++i) {
+			pfont = (PMWFONT)&pf[i];
+			GdGetFontInfo(pfont, &fontinfo);
+			if(fontht > abs(height-fontinfo.height)) { 
+				fontno = i;
+				fontht = abs(height-fontinfo.height);
+			}
+		}
+		pf[fontno].fontsize = pf[fontno].cfont->height;
+		pf[fontno].fontattr = fontattr;
+		return (PMWFONT)&pf[fontno];
+	}
+
+first:
+	/* Return first builtin font*/
+	pf->fontsize = pf->cfont->height;
+	pf->fontattr = fontattr;
+	return (PMWFONT)&pf[0];
+}
+
+/* Set the font size for the passed font*/
+MWCOORD
+GdSetFontSize(PMWFONT pfont, MWCOORD fontsize)
+{
+	MWCOORD	oldfontsize = pfont->fontsize;
+
+	pfont->fontsize = fontsize;
+
+	if (pfont->fontprocs->SetFontSize)
+	    pfont->fontprocs->SetFontSize(pfont, fontsize);
+
+	return oldfontsize;
+}
+
+/* Set the font rotation angle in tenths of degrees for the passed font*/
+int
+GdSetFontRotation(PMWFONT pfont, int tenthdegrees)
+{
+	MWCOORD	oldrotation = pfont->fontrotation;
+
+	pfont->fontrotation = tenthdegrees;
+
+	if (pfont->fontprocs->SetFontRotation)
+	    pfont->fontprocs->SetFontRotation(pfont, tenthdegrees);
+	
+	return oldrotation;
+}
+
+/*
+ * Set/reset font attributes (MWTF_KERNING, MWTF_ANTIALIAS)
+ * for the passed font.
+ */
+int
+GdSetFontAttr(PMWFONT pfont, int setflags, int clrflags)
+{
+	MWCOORD	oldattr = pfont->fontattr;
+
+	pfont->fontattr &= ~clrflags;
+	pfont->fontattr |= setflags;
+
+	if (pfont->fontprocs->SetFontAttr)
+	    pfont->fontprocs->SetFontAttr(pfont, setflags, clrflags);
+	
+	return oldattr;
+}
+
+/* Unload and deallocate font*/
+void
+GdDestroyFont(PMWFONT pfont)
+{
+	if (pfont->fontprocs->DestroyFont)
+		pfont->fontprocs->DestroyFont(pfont);
+}
+
+/* Return information about a specified font*/
+MWBOOL
+GdGetFontInfo(PMWFONT pfont, PMWFONTINFO pfontinfo)
+{
+	if(!pfont || !pfont->fontprocs->GetFontInfo)
+		return FALSE;
+
+	return pfont->fontprocs->GetFontInfo(pfont, pfontinfo);
+}
+
+/*
+ * Convert from one encoding to another
+ * Input cc and returned cc is character count, not bytes
+ * Return < 0 on error or can't translate
+ */
+int
+GdConvertEncoding(const void *istr, int iflags, int cc, void *ostr, int oflags)
+{
+	const unsigned char 	*istr8;
+	const unsigned short 	*istr16;
+	const unsigned long	*istr32;
+	unsigned char 		*ostr8;
+	unsigned short 		*ostr16;
+	unsigned long		*ostr32;
+	unsigned int		ch;
+	int			icc;
+	unsigned short		buf16[512];
+
+	iflags &= MWTF_PACKMASK;
+	oflags &= MWTF_PACKMASK;
+
+	/* allow -1 for len with ascii*/
+	if(cc == -1 && (iflags == MWTF_ASCII))
+		cc = strlen((char *)istr);
+
+	/* first check for utf8 input encoding*/
+	if(iflags == MWTF_UTF8) {
+		/* we've only got uc16 now so convert to uc16...*/
+		cc = utf8_to_utf16((unsigned char *)istr, cc,
+			oflags==MWTF_UC16?(unsigned short*) ostr: buf16);
+
+		if(oflags == MWTF_UC16 || cc < 0)
+			return cc;
+
+		/* will decode again to requested format (probably ascii)*/
+		iflags = MWTF_UC16;
+		istr = buf16;
+	}
+
+#if HAVE_HZK_SUPPORT
+	if(iflags == MWTF_UC16 && oflags == MWTF_ASCII) {
+		/* only support uc16 convert to ascii now...*/
+		cc = UC16_to_GB( istr, cc, ostr);
+		return cc;
+	}
+#endif
+
+	icc = cc;
+	istr8 = istr;
+	istr16 = istr;
+	istr32 = istr;
+	ostr8 = ostr;
+	ostr16 = ostr;
+	ostr32 = ostr;
+
+	/* Convert between formats.  Note that there's no error
+	 * checking here yet.
+	 */
+	while(--icc >= 0) {
+		switch(iflags) {
+		default:
+			ch = *istr8++;
+			break;
+		case MWTF_UC16:
+			ch = *istr16++;
+			break;
+		case MWTF_UC32:
+			ch = *istr32++;
+		}
+		switch(oflags) {
+		default:
+			*ostr8++ = (unsigned char)ch;
+			break;
+		case MWTF_UC16:
+			*ostr16++ = (unsigned short)ch;
+			break;
+		case MWTF_UC32:
+			*ostr32++ = ch;
+		}
+	}
+	return cc;
+}
+
+/* Get the width and height of passed text string in the passed font*/
+void
+GdGetTextSize(PMWFONT pfont, const void *str, int cc, MWCOORD *pwidth,
+	MWCOORD *pheight, MWCOORD *pbase, int flags)
+{
+	const void *	text;
+	unsigned long	buf[256];
+	int		defencoding = pfont->fontprocs->encoding;
+
+	/* convert encoding if required*/
+	if((flags & MWTF_PACKMASK) != defencoding) {
+		cc = GdConvertEncoding(str, flags, cc, buf, defencoding);
+		flags &= ~MWTF_PACKMASK;
+		flags |= defencoding;
+		text = buf;
+	} else text = str;
+
+	if(cc == -1 && (flags & MWTF_PACKMASK) == MWTF_ASCII)
+		cc = strlen((char *)str);
+
+	if(cc <= 0 || !pfont->fontprocs->GetTextSize) {
+		*pwidth = *pheight = *pbase = 0;
+		return;
+	}
+
+	/* calc height and width of string*/
+	pfont->fontprocs->GetTextSize(pfont, text, cc, pwidth, pheight, pbase);
+}
+
+/* Draw a text string at a specifed coordinates in the foreground color
+ * (and possibly the background color), applying clipping if necessary.
+ * The background color is only drawn if the gr_usebg flag is set.
+ * Use the current font.
+ */
+void
+GdText(PSD psd, MWCOORD x, MWCOORD y, const void *str, int cc, int flags)
+{
+	const void *	text;
+	unsigned long	buf[256];
+	int		defencoding = gr_pfont->fontprocs->encoding;
+
+	/* convert encoding if required*/
+	if((flags & MWTF_PACKMASK) != defencoding) {
+		cc = GdConvertEncoding(str, flags, cc, buf, defencoding);
+		flags &= ~MWTF_PACKMASK;
+		flags |= defencoding;
+		text = buf;
+	} else text = str;
+
+	if(cc == -1 && (flags & MWTF_PACKMASK) == MWTF_ASCII)
+		cc = strlen((char *)str);
+
+	if(cc <= 0 || !gr_pfont->fontprocs->DrawText)
+		return;
+
+	/* draw text string*/
+	gr_pfont->fontprocs->DrawText(gr_pfont, psd, x, y, text, cc, flags);
+}
+
+/*
+ * Draw ascii text using COREFONT type font.
+ */
+void
+corefont_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+	const void *text, int cc, int flags)
+{
+	const unsigned char *str = text;
+	MWCOORD		width;			/* width of text area */
+	MWCOORD 	height;			/* height of text area */
+	MWCOORD		base;			/* baseline of text*/
+	MWCOORD		startx, starty;
+						/* bitmap for characters */
+	MWIMAGEBITS bitmap[MAX_CHAR_HEIGHT*MAX_CHAR_WIDTH/MWIMAGE_BITSPERIMAGE];
+
+	pfont->fontprocs->GetTextSize(pfont, str, cc, &width, &height, &base);
+	
+	if(flags & MWTF_BASELINE)
+		y -= base;
+	else if(flags & MWTF_BOTTOM)
+		y -= (height - 1);
+	startx = x;
+	starty = y + base;
+
+	switch (GdClipArea(psd, x, y, x + width - 1, y + height - 1)) {
+	case CLIP_VISIBLE:
+		/*
+		 * For size considerations, there's no low-level text
+		 * draw, so we've got to draw all text
+		 * with per-point clipping for the time being
+		if (gr_usebg)
+			psd->FillRect(psd, x, y, x + width - 1, y + height - 1,
+				gr_background);
+		psd->DrawText(psd, x, y, str, cc, gr_foreground, pfont);
+		GdFixCursor(psd);
+		return;
+		*/
+		break;
+
+	case CLIP_INVISIBLE:
+		return;
+	}
+
+	/* Get the bitmap for each character individually, and then display
+	 * them using clipping for each one.
+	 */
+	while (--cc >= 0 && x < psd->xvirtres) {
+		unsigned int ch = *str++;
+#if HAVE_BIG5_SUPPORT
+		/* chinese big5 decoding*/
+		if (ch >= 0xA1 && ch <= 0xF9 && cc >= 1 &&
+			((*str >= 0x40 && *str <= 0x7E) ||
+			 (*str >= 0xA1 && *str <= 0xFE)) ) {
+				ch = (ch << 8) | *str++;
+				--cc;
+		}
+#endif
+#if HAVE_GB2312_SUPPORT
+		/* chinese gb2312 decoding*/
+		if (ch >= 0xA1 && ch < 0xF8 && cc >= 1 &&
+			*str >= 0xA1 && *str < 0xFF) {
+				ch = (ch << 8) | *str++;
+				--cc;
+		}
+#endif
+		pfont->fontprocs->GetTextBits(pfont, ch, bitmap, &width,
+			&height, &base);
+
+		/* note: change to bitmap*/
+		GdBitmap(psd, x, y, width, height, bitmap);
+		x += width;
+	}
+
+	if (pfont->fontattr & MWTF_UNDERLINE)
+		GdLine(psd, startx, starty, x, starty, FALSE);
+
+	GdFixCursor(psd);
+}
+
+#if HAVE_T1LIB_SUPPORT | HAVE_FREETYPE_SUPPORT
+/*
+ * Produce blend table from src and dst based on passed alpha table
+ * Used because we don't quite yet have GdArea with alphablending,
+ * so we pre-blend fg/bg colors for fade effect.
+ */
+static void
+alphablend(PSD psd, OUTPIXELVAL *out, MWPIXELVAL src, MWPIXELVAL dst,
+	unsigned char *alpha, int count)
+{
+	unsigned int	a, d;
+	unsigned char	r, g, b;
+	MWCOLORVAL	palsrc, paldst;
+	extern MWPALENTRY gr_palette[256];
+
+	while (--count >= 0) {
+	    a = *alpha++;
+
+#define BITS(pixel,shift,mask)	(((pixel)>>shift)&(mask))
+	    if(a == 0)
+		*out++ = dst;
+	    else if(a == 255)
+		*out++ = src;
+	    else 
+		switch(psd->pixtype) {
+	        case MWPF_TRUECOLOR0888:
+	        case MWPF_TRUECOLOR888:
+		    d = BITS(dst, 16, 0xff);
+		    r = (unsigned char)(((BITS(src, 16, 0xff) - d)*a)>>8) + d;
+		    d = BITS(dst, 8, 0xff);
+		    g = (unsigned char)(((BITS(src, 8, 0xff) - d)*a)>>8) + d;
+		    d = BITS(dst, 0, 0xff);
+		    b = (unsigned char)(((BITS(src, 0, 0xff) - d)*a)>>8) + d;
+		    *out++ = (r << 16) | (g << 8) | b;
+		    break;
+
+	        case MWPF_TRUECOLOR565:
+		    d = BITS(dst, 11, 0x1f);
+		    r = (unsigned char)(((BITS(src, 11, 0x1f) - d)*a)>>8) + d;
+		    d = BITS(dst, 5, 0x3f);
+		    g = (unsigned char)(((BITS(src, 5, 0x3f) - d)*a)>>8) + d;
+		    d = BITS(dst, 0, 0x1f);
+		    b = (unsigned char)(((BITS(src, 0, 0x1f) - d)*a)>>8) + d;
+		    *out++ = (r << 11) | (g << 5) | b;
+		    break;
+
+	        case MWPF_TRUECOLOR555:
+		    d = BITS(dst, 10, 0x1f);
+		    r = (unsigned char)(((BITS(src, 10, 0x1f) - d)*a)>>8) + d;
+		    d = BITS(dst, 5, 0x1f);
+		    g = (unsigned char)(((BITS(src, 5, 0x1f) - d)*a)>>8) + d;
+		    d = BITS(dst, 0, 0x1f);
+		    b = (unsigned char)(((BITS(src, 0, 0x1f) - d)*a)>>8) + d;
+		    *out++ = (r << 10) | (g << 5) | b;
+		    break;
+
+	        case MWPF_TRUECOLOR332:
+		    d = BITS(dst, 5, 0x07);
+		    r = (unsigned char)(((BITS(src, 5, 0x07) - d)*a)>>8) + d;
+		    d = BITS(dst, 2, 0x07);
+		    g = (unsigned char)(((BITS(src, 2, 0x07) - d)*a)>>8) + d;
+		    d = BITS(dst, 0, 0x03);
+		    b = (unsigned char)(((BITS(src, 0, 0x03) - d)*a)>>8) + d;
+		    *out++ = (r << 5) | (g << 2) | b;
+		    break;
+
+	        case MWPF_PALETTE:
+		    /* reverse lookup palette entry for blend ;-)*/
+		    palsrc = GETPALENTRY(gr_palette, src);
+		    paldst = GETPALENTRY(gr_palette, dst);
+		    d = REDVALUE(paldst);
+		    r = (unsigned char)(((REDVALUE(palsrc) - d)*a)>>8) + d;
+		    d = GREENVALUE(paldst);
+		    g = (unsigned char)(((GREENVALUE(palsrc) - d)*a)>>8) + d;
+		    d = BLUEVALUE(paldst);
+		    b = (unsigned char)(((BLUEVALUE(palsrc) - d)*a)>>8) + d;
+		    *out++ = GdFindNearestColor(gr_palette, (int)psd->ncolors,
+				MWRGB(r, g, b));
+		    break;
+	  	}
+	}
+}
+#endif /*HAVE_T1LIB_SUPPORT | HAVE_FREETYPE_SUPPORT*/
+
+#if HAVE_T1LIB_SUPPORT
+/* contributed by Vidar Hokstad*/
+
+static int
+t1lib_init(PSD psd)
+{
+	static int inited = 0;
+
+	if (inited)
+		return 1;
+
+	T1_SetBitmapPad(8);
+	if (!T1_InitLib(0))
+		return 0;
+#ifdef T1LIB_USE_AA_HIGH	 
+	T1_AASetLevel(T1_AA_HIGH);
+#else
+	T1_AASetLevel(T1_AA_LOW);
+#endif	 
+#if 0
+	/* kluge: this is required if 16bpp drawarea driver is used*/
+	if(psd->bpp == 16)
+		T1_AASetBitsPerPixel(16);
+	else
+#endif
+		T1_AASetBitsPerPixel(sizeof(MWPIXELVAL)*8);
+
+	inited = 1;
+	return 1;
+}
+
+static PMWT1LIBFONT
+t1lib_createfont(const char *name, MWCOORD height, int attr)
+{
+	PMWT1LIBFONT	pf;
+	int		id;
+	char *		p;
+	char		buf[256];
+
+	/* match name against t1 font id's from t1 font database*/
+	for(id=0; id<T1_Get_no_fonts(); ++id) {
+		strncpy(buf, T1_GetFontFileName(id), sizeof(buf));
+
+		/* remove extension*/
+		for(p=buf; *p; ++p) {
+			if(*p == '.') {
+				*p = 0;
+				break;
+			}
+		}
+
+		if(!strcmpi(name, buf)) {
+			/* allocate font structure*/
+			pf = (PMWT1LIBFONT)calloc(sizeof(MWT1LIBFONT), 1);
+			if (!pf)
+				return NULL;
+			pf->fontprocs = &t1lib_procs;
+			GdSetFontSize((PMWFONT)pf, height);
+			GdSetFontRotation((PMWFONT)pf, 0);
+			GdSetFontAttr((PMWFONT)pf, attr, 0);
+			pf->fontid = id;
+			return pf;
+		}
+	}
+	return NULL;
+}
+
+/*
+ * Draw ascii text string using T1LIB type font
+ */
+static void
+t1lib_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+	const void *text, int cc, int flags)
+{
+	PMWT1LIBFONT	pf = (PMWT1LIBFONT)pfont;
+	const unsigned char *str = text;
+   	MWCOORD		width;			/* width of text area */
+	MWCOORD 	height;			/* height of text area */
+	MWCOORD		underliney;
+        GLYPH * g; /* T1lib glyph structure. Memory handling by T1lib */
+#ifdef T1LIB_USE_AA_HIGH   
+        OUTPIXELVAL	gvals[17];
+
+        /* Blending array for antialiasing. The steeper the values increase
+	 * near the end, the sharper the characters look, but also more jagged
+	 */
+        static unsigned char blend[17] = {
+	   0x00, 0x00, 0x04, 0x0c, 0x10, 0x14, 0x18, 0x20,
+	   0x30, 0x38, 0x40, 0x50, 0x70, 0x80, 0xa0, 0xc0, 0xff
+	};
+#else   
+        OUTPIXELVAL	gvals[5];
+        static unsigned char blend[5] = { 0x00, 0x44, 0x88, 0xcc, 0xff };
+#endif   
+
+        /* Check if we should throw out some fonts */
+
+        if (pf->fontattr&MWTF_ANTIALIAS) {
+#ifdef T1LIB_USE_AA_HIGH      
+	   alphablend(psd, gvals, gr_foreground, gr_background, blend, 17);
+           T1_AAHSetGrayValues(gvals);
+#else      
+	   alphablend(psd, gvals, gr_foreground, gr_background, blend, 5);
+           T1_AASetGrayValues(gvals[0],gvals[1],gvals[2],gvals[3],gvals[4]);
+#endif
+	   g = T1_AASetString(pf->fontid,(char *)str,cc,0,
+		(pf->fontattr&MWTF_KERNING)? T1_KERNING: 0,
+		pf->fontsize * 1.0, 0);
+
+	   if (g && g->bits) {
+	      /*MWPIXELVAL save = gr_background;*/
+	      width = g->metrics.rightSideBearing - g->metrics.leftSideBearing;
+	      height = g->metrics.ascent - g->metrics.descent;
+
+	      if(flags & MWTF_BASELINE)
+		y -= g->metrics.ascent;
+	      else if(flags & MWTF_BOTTOM)
+		y -= (height - 1);
+	      underliney = y + g->metrics.ascent;
+
+	      /* FIXME: Looks damn ugly if usebg is false.
+	       * Will be handled when using alphablending in GdArea...
+	       */
+	      /* clipping handled in GdArea*/
+	      /*FIXME kluge for transparency*/
+	      /*gr_background = gr_foreground + 1;*/
+	      /*gr_usebg = 0;*/
+	      GdArea(psd,x,y, width, height, g->bits, MWPF_PIXELVAL);
+	      /*gr_background = save;*/
+
+	      if (pf->fontattr & MWTF_UNDERLINE)
+		   GdLine(psd, x, underliney, x+width, underliney, FALSE);
+
+	   }
+	} else {
+	   /* Do non-aa drawing */
+	   g = T1_SetString(pf->fontid,(char *)str,cc,0,
+			(pf->fontattr&MWTF_KERNING)? T1_KERNING: 0,
+			pf->fontsize * 1.0, 0);
+
+	   if (g && g->bits) {
+	      unsigned char * b;
+	      int xoff;
+	      int maxy;
+	      int xmod;
+	      
+	      /* I'm sure this sorry excuse for a bitmap rendering routine can
+	       * be optimized quite a bit ;)
+	       */
+	      width = g->metrics.rightSideBearing - g->metrics.leftSideBearing;
+	      height = g->metrics.ascent - g->metrics.descent;
+
+	      if(flags & MWTF_BASELINE)
+		y -= g->metrics.ascent;
+	      else if(flags & MWTF_BOTTOM)
+		y -= (height - 1);
+	      underliney = y + g->metrics.ascent;
+	      
+	      b = g->bits;
+	      maxy = y + height;
+	      
+/*	      if ((x + width) > psd->xvirtres) {
+		 xmod = (x + width - psd->xvirtres + 7) >> 3;
+		 width = width + x + width - psd->xvirtres;
+	      } else xmod = 0;
+*/
+	      xmod = 0;
+	      while (y < maxy) {
+		 unsigned char data;
+		 xoff = 0;
+		 while (xoff < width ) {
+		    if (!(xoff % 8)) {
+		       data = *b;
+		       b++;
+		    }
+		    
+		    if (GdClipPoint(psd, x+xoff,y)) {
+		       if (gr_usebg) {
+	 		  psd->DrawPixel(psd,x+xoff,y,
+			      data & (1 << (xoff % 8)) ?
+			            gr_foreground : gr_background);
+		       } else if (data & (1 << (xoff % 8))) {
+			  psd->DrawPixel(psd,x+xoff,y, gr_foreground);
+		       }
+		    }
+		    xoff++;
+		 }
+		 b += xmod;
+		 y++;
+	      }
+	      if (pf->fontattr & MWTF_UNDERLINE)
+		   GdLine(psd, x, underliney, x+xoff, underliney, FALSE);
+	   }
+        }
+
+   if (g && g->bits) {
+	   /* Save some memory */
+	   free(g->bits);
+           g->bits = 0; /* Make sure T1lib doesnt try to free it again */
+   }
+
+   GdFixCursor(psd);
+}
+
+static MWBOOL
+t1lib_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo)
+{
+	int	i;
+	MWCOORD	width, height, baseline;
+
+	/* FIXME, guess all sizes*/
+	GdGetTextSize(pfont, "A", 1, &width, &height, &baseline, MWTF_ASCII);
+	pfontinfo->height = height;
+	pfontinfo->maxwidth = width;
+	pfontinfo->baseline = 0;
+	pfontinfo->firstchar = 32;
+	pfontinfo->lastchar = 255;
+	pfontinfo->fixed = TRUE;
+	for(i=0; i<256; ++i)
+		pfontinfo->widths[i] = width;
+	return TRUE;
+}
+
+/* Get the width and height of passed text string in the current font*/
+static void
+t1lib_gettextsize(PMWFONT pfont, const void *text, int cc,
+	MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase)
+{
+	PMWT1LIBFONT		pf = (PMWT1LIBFONT)pfont;
+	const unsigned char *	str = text;
+	GLYPH *			g;
+
+	g = T1_SetString(pf->fontid, (char *)str, cc, 0,
+			(pf->fontattr&MWTF_KERNING)? T1_KERNING: 0, pf->fontsize * 1.0, 0);
+	*pwidth = g->metrics.rightSideBearing - g->metrics.leftSideBearing;
+	*pheight = g->metrics.ascent - g->metrics.descent;
+	if(g && g->bits) {
+		free(g->bits);
+		g->bits = 0;
+	}
+#if 0
+	BBox 			b;
+
+	/* FIXME. Something is *VERY* wrong here */
+	b = T1_GetStringBBox(pf->fontid, str, cc, 0, (pf->fontattr&MWTF_KERNING)?T1_KERNING:0);
+
+	DPRINTF("b.urx = %d, b.llx = %d\n",b.urx, b.llx);
+	DPRINTF("b.ury = %d, b.lly = %d\n",b.ury, b.lly);
+	*pwidth = (b.urx - b.llx);
+	*pheight = (b.lly - b.ury);
+#endif
+}
+
+static void
+t1lib_destroyfont(PMWFONT pfont)
+{
+	PMWT1LIBFONT	pf = (PMWT1LIBFONT)pfont;
+
+	T1_DeleteAllSizes(pf->fontid);
+	free(pf);
+}
+
+#endif /* HAVE_T1LIB_SUPPORT*/
+
+#if HAVE_FREETYPE_SUPPORT
+static OUTPIXELVAL gray_palette[5];
+
+static int
+freetype_init(PSD psd)
+{
+	static int inited = 0;
+
+	if (inited)
+		return 1;
+	
+	/* Init freetype library */
+	if (TT_Init_FreeType (&engine) != TT_Err_Ok) {
+		return 0;
+	}
+
+	/* Init kerning extension */
+	if (TT_Init_Kerning_Extension (engine) != TT_Err_Ok)
+		return 0;
+
+	inited = 1;
+	return 1;
+}
+
+static PMWFREETYPEFONT
+freetype_createfont(const char *name, MWCOORD height, int attr)
+{
+	PMWFREETYPEFONT 	pf;
+	unsigned short 		i, n;
+	unsigned short 		platform, encoding;
+	TT_Face_Properties 	properties;
+	char *			p;
+	char			fontname[128];
+
+	/* check for pathname prefix*/
+	if (strchr(name, '/') != NULL)
+		strcpy(fontname, name);
+	else {
+		strcpy(fontname, FREETYPE_FONT_DIR);
+		strcat(fontname, "/");
+		strcat(fontname, name);
+	}
+
+	/* check for extension*/
+	if ((p = strrchr(fontname, '.')) == NULL ||
+	    strcmp(p, ".ttf") != 0) {
+		strcat(fontname, ".ttf");
+	}
+
+	/* allocate font structure*/
+	pf = (PMWFREETYPEFONT)calloc(sizeof(MWFREETYPEFONT), 1);
+	if (!pf)
+		return NULL;
+	pf->fontprocs = &freetype_procs;
+
+	/* Load face */
+	if (TT_Open_Face (engine, fontname, &pf->face) != TT_Err_Ok)
+		goto out;
+
+	/* Load first kerning table */
+	pf->can_kern = TRUE;
+	if (TT_Load_Kerning_Table (pf->face, 0) != TT_Err_Ok)
+		pf->can_kern = FALSE;
+	else {
+		if (TT_Get_Kerning_Directory (pf->face, &pf->directory)
+		    != TT_Err_Ok)
+			pf->can_kern = FALSE;
+		else {
+			/* Support only version 0 kerning table ... */
+			if ((pf->directory.version != 0) ||
+				(pf->directory.nTables <= 0) ||
+				(pf->directory.tables->loaded != 1) ||
+				(pf->directory.tables->version != 0) ||
+				(pf->directory.tables->t.kern0.nPairs <= 0))
+					pf->can_kern = FALSE;
+		}
+	}
+
+	/* get face properties and allocate preload arrays */
+	TT_Get_Face_Properties (pf->face, &properties);
+
+#if 0
+	/*
+	 * Use header information for ascent and descent
+	 * to compute scaled ascent/descent for current font height.
+	 */
+	h = properties.os2->sTypoAscender - properties.os2->sTypoDescender
+		+ properties.os2->sTypoLineGap;
+	ascent = properties.os2->sTypoAscender
+		+ properties.os2->sTypoLineGap/2;
+	pf->ascent = (ascent * height + h/2) / h;
+	pf->descent = height - pf->ascent;
+#endif
+	/* Create a glyph container */
+	if (TT_New_Glyph (pf->face, &pf->glyph) != TT_Err_Ok)
+		goto out;
+
+	/* create instance */
+	if (TT_New_Instance (pf->face, &pf->instance) != TT_Err_Ok)
+		goto out;
+
+	/* Set the instance resolution */
+	if (TT_Set_Instance_Resolutions (pf->instance, 96, 96) != TT_Err_Ok)
+		goto out;
+
+	/* Look for a Unicode charmap: Windows flavor of Apple flavor only */
+	n = properties.num_CharMaps;
+
+	for (i = 0; i < n; i++) {
+		TT_Get_CharMap_ID (pf->face, i, &platform, &encoding);
+		if (((platform == TT_PLATFORM_MICROSOFT) &&
+			(encoding == TT_MS_ID_UNICODE_CS)) ||
+				((platform == TT_PLATFORM_APPLE_UNICODE) &&
+			 		(encoding == TT_APPLE_ID_DEFAULT)))
+		{
+			TT_Get_CharMap (pf->face, i, &pf->char_map);
+			i = n + 1;
+		}
+	}
+	if (i == n) {
+		DPRINTF("freetype_createfont: no unicode map table\n");
+		goto out;
+	}
+	
+	GdSetFontSize((PMWFONT)pf, height);
+	GdSetFontRotation((PMWFONT)pf, 0);
+	GdSetFontAttr((PMWFONT)pf, attr, 0);
+
+	return pf;
+
+out:
+	free(pf);
+	return NULL;
+}
+
+static int
+compute_kernval(PMWFREETYPEFONT pf, short current_glyph_code)
+{
+	int 		i = 0;
+	int 		kernval;
+	int 		nPairs = pf->directory.tables->t.kern0.nPairs;
+	TT_Kern_0_Pair *pair = pf->directory.tables->t.kern0.pairs;
+
+	if (pf->last_glyph_code != -1) {
+		while ((pair->left != pf->last_glyph_code)
+			&& (pair->right != current_glyph_code))
+		{
+			pair++;
+			i++;
+			if (i == nPairs)
+			break;
+		}
+
+		if (i == nPairs)
+			kernval = 0;
+		else
+			/* We round the value (hence the +32) */
+			kernval = (pair->value + 32) & -64;
+	} else
+		kernval = 0;
+
+	return kernval;
+}
+
+static TT_UShort
+Get_Glyph_Width(PMWFREETYPEFONT pf, TT_UShort glyph_index)
+{
+	TT_Glyph_Metrics metrics;
+
+    	if (TT_Load_Glyph ( pf->instance, pf->glyph,
+		TT_Char_Index (pf->char_map,glyph_index),
+		TTLOAD_SCALE_GLYPH|TTLOAD_HINT_GLYPH) != TT_Err_Ok)
+    	{
+		/* Try to load default glyph: index 0 */
+		if (TT_Load_Glyph ( pf->instance, pf->glyph, 0,
+			TTLOAD_SCALE_GLYPH|TTLOAD_HINT_GLYPH) != TT_Err_Ok)
+		    return 0;
+	}
+
+	TT_Get_Glyph_Metrics (pf->glyph, &metrics);
+	return((metrics.advance & 0xFFFFFFC0) >> 6);
+}
+
+static MWFREETYPEFONTCACHE *
+find_cache_glyph ( PMWFREETYPEFONT pf, unsigned curchar )
+{
+  MWFREETYPEFONTCACHE ** inode = &pf->glyph_cache;
+
+  while (1)
+    {
+      if (*inode == 0)
+	{
+	  *inode = calloc(sizeof(MWFREETYPEFONTCACHE),1);
+	  (*inode)->curchar = curchar;
+	}
+
+      if (curchar < (*inode)->curchar)
+	inode = &(*inode)->l;
+      else if (curchar > (*inode)->curchar)
+	inode = &(*inode)->r;
+      else
+	return *inode;
+    }
+}
+
+static void
+free_cache_glyph ( MWFREETYPEFONTCACHE * node )
+{
+  if (node->l != 0)
+    free_cache_glyph(node->l);
+
+  if (node->r != 0)
+    free_cache_glyph(node->r);
+
+  free(node);
+}
+
+/* Render a single glyph*/
+static void
+drawchar(PMWFREETYPEFONT pf, PSD psd, unsigned curchar, int x_offset,
+	int y_offset)
+{
+	TT_F26Dot6 	xmin, ymin, xmax, ymax, x, y, z;
+	unsigned char 	*src, *srcptr;
+	MWPIXELVAL 	*dst, *dstptr;
+	MWPIXELVAL 	*bitmap;
+	int 		size, width, height;
+	TT_Outline 	outline;
+	TT_BBox 	bbox;
+	TT_Raster_Map 	Raster;
+	TT_Error 	error;
+	/*MWPIXELVAL 	save;*/
+        MWFREETYPEFONTCACHE * cache;
+
+	/* we begin by grid-fitting the bounding box */
+	TT_Get_Glyph_Outline (pf->glyph, &outline);
+	TT_Get_Outline_BBox (&outline, &bbox);
+
+	xmin = (bbox.xMin & -64) >> 6;
+	ymin = (bbox.yMin & -64) >> 6;
+	xmax = ((bbox.xMax + 63) & -64) >> 6;
+	ymax = ((bbox.yMax + 63) & -64) >> 6;
+	width = xmax - xmin;
+	height = ymax - ymin;
+	size = width * height;
+
+	/* now re-allocate the raster bitmap */
+	Raster.rows = height;
+	Raster.width = width;
+
+	if (pf->fontattr&MWTF_ANTIALIAS)
+		Raster.cols = (Raster.width + 3) & -4;	/* pad to 32-bits */
+	else
+		Raster.cols = (Raster.width + 7) & -8;	/* pad to 64-bits ??? */
+
+        cache = find_cache_glyph(pf,curchar);
+        /* SDR: if cache is 0 here, something really really bad happened */
+
+	Raster.flow = TT_Flow_Up;
+	Raster.size = Raster.rows * Raster.cols;
+	Raster.bitmap = cache->buffer;
+
+	if (Raster.bitmap == 0)
+	  {
+	    Raster.bitmap = malloc (Raster.size);
+
+	    memset (Raster.bitmap, 0, Raster.size);
+
+	    /* now render the glyph in the small pixmap */
+
+	    /* IMPORTANT NOTE: the offset parameters passed to the function     */
+	    /* TT_Get_Glyph_Bitmap() must be integer pixel values, i.e.,        */
+	    /* multiples of 64.  HINTING WILL BE RUINED IF THIS ISN'T THE CASE! */
+	    /* This is why we _did_ grid-fit the bounding box, especially xmin  */
+	    /* and ymin.                                                        */
+
+	    if (!(pf->fontattr&MWTF_ANTIALIAS))
+	      error = TT_Get_Glyph_Bitmap (pf->glyph, &Raster,
+					   -xmin * 64, -ymin * 64);
+	    else
+	      error = TT_Get_Glyph_Pixmap (pf->glyph, &Raster,
+					   -xmin * 64, -ymin * 64);
+
+	    if (error) {
+	      free (Raster.bitmap);
+	      return;
+	    }
+
+            cache->buffer = Raster.bitmap;
+	  }
+
+#if MWFREETYPEFONT_CACHEBITMAP
+	if ((memcmp(&gr_foreground,&cache->fg,sizeof(gr_foreground)) != 0) || 
+	    (memcmp(&gr_background,&cache->bg,sizeof(gr_background)) != 0) || 
+	    (gr_usebg != cache->usebg))
+	  {
+	    if (cache->bitmap)
+	      {
+		free(cache->bitmap);
+		cache->bitmap = 0;
+	      }
+	  }
+
+	bitmap = cache->bitmap;
+#else
+	bitmap = 0;
+#endif
+
+	if (bitmap == 0)
+	  {
+	    bitmap = malloc (size * sizeof (MWPIXELVAL));
+	    memset (bitmap, 0, size * sizeof (MWPIXELVAL));
+
+	    src = (char *) Raster.bitmap;
+	    dst = bitmap + (size - width);
+
+	    for (y = ymin; y < ymax; y++) 
+	      {
+		srcptr = src;
+		dstptr = dst;
+
+		for (x = xmin; x < xmax; x++) 
+		  {
+		    if (pf->fontattr&MWTF_ANTIALIAS)
+		      *dstptr++ = gray_palette[(int) *srcptr];
+		    else
+		      {
+		        for ( z=0;
+			      z <= ((xmax-x-1) < 7 ? (xmax-x-1) : 7);
+			      z++ )
+			    *dstptr++ = ((*srcptr << z) & 0x80) ? gr_foreground : gr_background;
+			x += 7;
+		      }
+
+		    srcptr++;
+		  }
+
+		src += Raster.cols;
+		dst -= width;
+	      }
+#if MWFREETYPEFONT_CACHEBITMAP
+	    cache->fg = gr_foreground;
+	    cache->bg = gr_background;
+	    cache->usebg = gr_usebg;
+	    cache->bitmap = bitmap;
+#endif
+	  }
+
+	/* Now draw the bitmap ... */
+	GdArea(psd, x_offset + xmin, y_offset - (ymin + height), width, height,
+		bitmap, MWPF_PIXELVAL);
+
+#if !MWFREETYPEFONT_CACHEBITMAP
+	free(bitmap);
+#endif
+}
+
+/*
+ * Draw unicode 16 text string using FREETYPE type font
+ */
+static void
+freetype_drawtext(PMWFONT pfont, PSD psd, MWCOORD ax, MWCOORD ay,
+	const void *text, int cc, int flags)
+{
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	const unsigned short *	str = text;
+	TT_F26Dot6 	x = ax, y = ay;
+	TT_Pos 		vec_x, vec_y;
+	int 		i;
+	TT_F26Dot6	startx, starty;
+	TT_Outline 	outline;
+	TT_UShort 	curchar;
+	TT_Glyph_Metrics metrics;
+	TT_Face_Properties properties;
+	TT_Instance_Metrics imetrics;
+	TT_F26Dot6 ascent, descent;
+	static unsigned char blend[5] = { 0x00, 0x44, 0x88, 0xcc, 0xff };
+	static unsigned char virtual_palette[5] = { 0, 1, 2, 3, 4 };
+
+	pf->last_glyph_code = -1;		/* reset kerning*/
+	pf->last_pen_pos = -32767;
+
+	/* 
+	 * Compute instance ascent & descent values
+	 * in fractional units (1/64th pixel)
+	 */
+	TT_Get_Face_Properties (pf->face, &properties);
+	TT_Get_Instance_Metrics(pf->instance, &imetrics);	
+  
+	ascent = ((properties.horizontal->Ascender * imetrics.y_scale)/0x10000);
+	descent = ((properties.horizontal->Descender*imetrics.y_scale)/0x10000);
+
+	/* 
+	 * Offset the starting point if necessary,
+	 * FreeType always aligns at baseline
+	 */
+	if (flags&MWTF_BOTTOM) {
+		vec_x = 0;
+		vec_y = descent;
+		TT_Transform_Vector(&vec_x, &vec_y,&pf->matrix);
+		x -= vec_x / 64;
+		y += vec_y / 64;
+	} else if (flags&MWTF_TOP) {
+		vec_x = 0;
+		vec_y = ascent;
+		TT_Transform_Vector(&vec_x, &vec_y,&pf->matrix);
+		x -= vec_x / 64;
+		y += vec_y / 64;
+	}
+
+	/* Set the "graylevels" */
+	if (pf->fontattr&MWTF_ANTIALIAS) {
+		TT_Set_Raster_Gray_Palette (engine, virtual_palette);
+
+		alphablend(psd, gray_palette, gr_foreground, gr_background,
+			blend, 5);
+	}
+
+	startx = x;
+	starty = y;
+	for (i = 0; i < cc; i++) {
+		curchar = TT_Char_Index (pf->char_map, str[i]);
+
+		if (TT_Load_Glyph (pf->instance, pf->glyph, curchar,
+			TTLOAD_DEFAULT) != TT_Err_Ok)
+				continue;
+
+		if (pf->fontrotation) {
+			TT_Get_Glyph_Outline (pf->glyph, &outline);
+			TT_Transform_Outline (&outline, &pf->matrix);
+		}
+
+		TT_Get_Glyph_Metrics (pf->glyph, &metrics);
+
+		if ((pf->fontattr&MWTF_KERNING) && pf->can_kern) {
+			if (pf->fontrotation) {
+				vec_x = compute_kernval(pf, curchar);
+				vec_y = 0;
+				TT_Transform_Vector(&vec_x, &vec_y,&pf->matrix);
+
+				x += vec_x / 64;
+				y -= vec_y / 64;
+			} else
+				x += compute_kernval(pf, curchar) / 64;
+		}
+			
+		drawchar(pf, psd, curchar, x, y);
+
+		if (pf->fontrotation) {
+			vec_x = metrics.advance;
+			vec_y = 0;
+			TT_Transform_Vector (&vec_x, &vec_y, &pf->matrix);
+
+			x += vec_x / 64;
+			y -= vec_y / 64;
+		} else {
+			x += metrics.advance / 64;
+
+			/* Kerning point syndrome avoidance */
+			if (pf->last_pen_pos > x)
+				x = pf->last_pen_pos;
+			pf->last_pen_pos = x;
+		}
+
+		pf->last_glyph_code = curchar;
+	}
+
+	if (pf->fontattr & MWTF_UNDERLINE)
+		GdLine(psd, startx, starty, x, y, FALSE);
+}
+
+/*
+ * Return information about a specified font.
+ */
+static MWBOOL
+freetype_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo)
+{
+	int	i;
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	TT_Face_Properties 	properties;
+	TT_Instance_Metrics imetrics;
+	TT_UShort last_glyph_index;
+
+	TT_Get_Face_Properties (pf->face, &properties);
+	TT_Get_Instance_Metrics(pf->instance, &imetrics);
+
+	/* Fill up the fields */
+	pfontinfo->height = (((properties.horizontal->Ascender * \
+	                        imetrics.y_scale)/ 0x10000) >> 6) -
+	                    (((properties.horizontal->Descender * \
+	                        imetrics.y_scale)/ 0x10000) >> 6);
+	pfontinfo->maxwidth = ((properties.horizontal->xMax_Extent * \
+	                        imetrics.x_scale)/ 0x10000) >> 6;
+	pfontinfo->baseline = ((properties.horizontal->Ascender * \
+	                        imetrics.y_scale)/ 0x10000) >> 6;
+	pfontinfo->firstchar = TT_CharMap_First(pf->char_map, NULL);
+	pfontinfo->lastchar = TT_CharMap_Last(pf->char_map, NULL);
+	pfontinfo->fixed = properties.postscript->isFixedPitch;
+		
+	last_glyph_index = properties.num_Glyphs > 255 ? 255: properties.num_Glyphs-1;
+
+	/* Doesn't work ... don't know why ....*/
+#if 0
+	if (TT_Get_Face_Widths( pf->face, 0,
+				last_glyph_index, widths, NULL ) != TT_Err_Ok) {
+	  return TRUE;
+	}
+
+	for(i=0; i<=last_glyph_index; i++)
+	  DPRINTF("widths[%d]: %d\n", i, widths[i]);
+#endif
+
+	/* Get glyphs widths */
+	for(i=0; i<=last_glyph_index; i++)
+	  pfontinfo->widths[i] = Get_Glyph_Width(pf, i);
+
+#if 0
+	DPRINTF("x_ppem: %d\ny_ppem: %d\nx_scale: %d\ny_scale: %d\n\
+    x_resolution: %d\ny_resolution: %d\n",
+    imetrics.x_ppem, imetrics.y_ppem, imetrics.x_scale, \
+    imetrics.y_scale, imetrics.x_resolution, imetrics.y_resolution);
+
+    DPRINTF("Ascender: %d\nDescender: %d\nxMax_Extent: %d\n\
+    Mac Style Say Italic?: %d\nMac Style Say Bold?: %d\n\
+    sTypoAscender: %d\nsTypoDescender: %d\nusWinAscent: %d\n\
+    usWinDescent: %d\nusFirstCharIndex: %d\nusLastCharIndex: %d\n\
+    OS2 Say Italic?: %d\nOS2 Say Bold?: %d\nOS2 Say monospaced?: %d\n\
+    Postscript Say monospaced?: %d\n",\
+    properties.horizontal->Ascender,
+    properties.horizontal->Descender,
+    properties.horizontal->xMax_Extent,
+    (properties.header->Mac_Style & 0x2)?1:0,
+    (properties.header->Mac_Style & 0x1)?1:0,
+    properties.os2->sTypoAscender,
+    properties.os2->sTypoDescender,
+    properties.os2->usWinAscent,
+    properties.os2->usWinDescent,
+    properties.os2->usFirstCharIndex,
+    properties.os2->usLastCharIndex,
+    (properties.os2->fsSelection & 0x1)?1:0,
+    (properties.os2->fsSelection & 0x20)?1:0,
+    properties.postscript->isFixedPitch,
+    (properties.os2->panose[3] == 9)?1:0);
+#endif	
+			
+	return TRUE;
+}
+
+static void
+freetype_gettextsize(PMWFONT pfont, const void *text, int cc,
+	MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase)
+{
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	const unsigned short *	str = text;
+	TT_F26Dot6 	x = 0;
+	int 		i;
+	TT_UShort 	curchar;
+	TT_Glyph_Metrics metrics;
+	TT_Face_Properties 	properties;
+	TT_Instance_Metrics imetrics;
+
+	TT_Get_Face_Properties (pf->face, &properties);
+	TT_Get_Instance_Metrics(pf->instance, &imetrics);
+	
+	pf->last_glyph_code = -1;		/* reset kerning*/
+	pf->last_pen_pos = -32767;
+	
+	for (i = 0; i < cc; i++) {
+		curchar = TT_Char_Index (pf->char_map, str[i]);
+
+		if (TT_Load_Glyph (pf->instance, pf->glyph, curchar,
+			TTLOAD_SCALE_GLYPH|TTLOAD_HINT_GLYPH) != TT_Err_Ok)
+				continue;
+
+		TT_Get_Glyph_Metrics (pf->glyph, &metrics);
+
+		if ((pf->fontattr&MWTF_KERNING) && pf->can_kern) {
+				x += compute_kernval(pf, curchar) / 64;
+		}
+		
+		x += metrics.advance / 64;
+
+		/* Kerning point syndrome avoidance */
+		if (pf->last_pen_pos > x)
+			x = pf->last_pen_pos;
+		pf->last_pen_pos = x;
+
+		pf->last_glyph_code = curchar;
+	}
+
+	*pwidth = x;
+	*pheight =  (((properties.horizontal->Ascender * 
+	                imetrics.y_scale)/ 0x10000) >> 6) -
+	            (((properties.horizontal->Descender * 
+	            imetrics.y_scale)/ 0x10000) >> 6);
+    	/* FIXME: is it what's required ?? */
+	*pbase = (((-properties.horizontal->Descender) * 
+	            imetrics.y_scale)/ 0x10000) >> 6;
+}
+
+static void
+freetype_destroyfont(PMWFONT pfont)
+{
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+
+	TT_Close_Face(pf->face);
+
+	/*----------*/
+
+	if (pf->glyph_cache != 0)
+	  free_cache_glyph(pf->glyph_cache);
+
+	/*----------*/
+
+	free(pf);
+}
+
+static void
+freetype_setfontsize(PMWFONT pfont, MWCOORD fontsize)
+{
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	
+	pf->fontsize = fontsize;
+	
+	/* We want real pixel sizes ... not points ...*/
+	TT_Set_Instance_PixelSizes( pf->instance, pf->fontsize,
+                                pf->fontsize, pf->fontsize * 64 );
+#if 0
+	/* set charsize (convert to points for freetype)*/
+	TT_Set_Instance_CharSize (pf->instance,
+		((pf->fontsize * 72 + 96/2) / 96) * 64);
+#endif
+}
+
+static void
+freetype_setfontrotation(PMWFONT pfont, int tenthdegrees)
+{
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	float 		angle;
+	
+	pf->fontrotation = tenthdegrees;
+
+	/* Build the rotation matrix with the given angle */
+	TT_Set_Instance_Transform_Flags (pf->instance, TRUE, FALSE);
+
+	angle = pf->fontrotation * M_PI / 1800;
+	pf->matrix.yy = (TT_Fixed) (cos (angle) * (1 << 16));
+	pf->matrix.yx = (TT_Fixed) (sin (angle) * (1 << 16));
+	pf->matrix.xx = pf->matrix.yy;
+	pf->matrix.xy = -pf->matrix.yx;
+}
+
+#endif /* HAVE_FREETYPE_SUPPORT*/
+
+/* UTF-8 to UTF-16 conversion.  Surrogates are handeled properly, e.g.
+ * a single 4-byte UTF-8 character is encoded into a surrogate pair.
+ * On the other hand, if the UTF-8 string contains surrogate values, this
+ * is considered an error and returned as such.
+ *
+ * The destination array must be able to hold as many Unicode-16 characters
+ * as there are ASCII characters in the UTF-8 string.  This in case all UTF-8
+ * characters are ASCII characters.  No more will be needed.
+ *
+ * Copyright (c) 2000 Morten Rolland, Screen Media
+ */
+static int
+utf8_to_utf16(const unsigned char *utf8, int cc, unsigned short *unicode16)
+{
+	int count = 0;
+	unsigned char c0, c1;
+	unsigned long scalar;
+
+	while(--cc >= 0) {
+		c0 = *utf8++;
+		/*DPRINTF("Trying: %02x\n",c0);*/
+
+		if ( c0 < 0x80 ) {
+			/* Plain ASCII character, simple translation :-) */
+			*unicode16++ = c0;
+			count++;
+			continue;
+		}
+
+		if ( (c0 & 0xc0) == 0x80 )
+			/* Illegal; starts with 10xxxxxx */
+			return -1;
+
+		/* c0 must be 11xxxxxx if we get here => at least 2 bytes */
+		scalar = c0;
+		if(--cc < 0)
+			return -1;
+		c1 = *utf8++;
+		/*DPRINTF("c1=%02x\n",c1);*/
+		if ( (c1 & 0xc0) != 0x80 )
+			/* Bad byte */
+			return -1;
+		scalar <<= 6;
+		scalar |= (c1 & 0x3f);
+
+		if ( !(c0 & 0x20) ) {
+			/* Two bytes UTF-8 */
+			if ( scalar < 0x80 )
+				return -1;	/* Overlong encoding */
+			*unicode16++ = scalar & 0x7ff;
+			count++;
+			continue;
+		}
+
+		/* c0 must be 111xxxxx if we get here => at least 3 bytes */
+		if(--cc < 0)
+			return -1;
+		c1 = *utf8++;
+		/*DPRINTF("c1=%02x\n",c1);*/
+		if ( (c1 & 0xc0) != 0x80 )
+			/* Bad byte */
+			return -1;
+		scalar <<= 6;
+		scalar |= (c1 & 0x3f);
+
+		if ( !(c0 & 0x10) ) {
+			/*DPRINTF("####\n");*/
+			/* Three bytes UTF-8 */
+			if ( scalar < 0x800 )
+				return -1;	/* Overlong encoding */
+			if ( scalar >= 0xd800 && scalar < 0xe000 )
+				return -1;	/* UTF-16 high/low halfs */
+			*unicode16++ = scalar & 0xffff;
+			count++;
+			continue;
+		}
+
+		/* c0 must be 1111xxxx if we get here => at least 4 bytes */
+		c1 = *utf8++;
+		if(--cc < 0)
+			return -1;
+		/*DPRINTF("c1=%02x\n",c1);*/
+		if ( (c1 & 0xc0) != 0x80 )
+			/* Bad byte */
+			return -1;
+		scalar <<= 6;
+		scalar |= (c1 & 0x3f);
+
+		if ( !(c0 & 0x08) ) {
+			/* Four bytes UTF-8, needs encoding as surrogates */
+			if ( scalar < 0x10000 )
+				return -1;	/* Overlong encoding */
+			scalar -= 0x10000;
+			*unicode16++ = ((scalar >> 10) & 0x3ff) + 0xd800;
+			*unicode16++ = (scalar & 0x3ff) + 0xdc00;
+			count += 2;
+			continue;
+		}
+
+		return -1;	/* No support for more than four byte UTF-8 */
+	}
+	return count;
+}
+
+#if HAVE_HZK_SUPPORT
+
+/* UniCode-16 (MWTF_UC16) to GB(MWTF_ASCII) Chinese Characters conversion.
+ * a single 2-byte UC16 character is encoded into a surrogate pair.
+ * return -1 ,if error;
+ * The destination array must be able to hold as many
+ * as there are Unicode-16 characters.
+ *
+ * Copyright (c) 2000 Tang Hao (TownHall)(tang_hao@263.net).
+ */
+static int
+UC16_to_GB(const unsigned char *uc16, int cc, unsigned char *ascii)
+{
+	FILE* fp;
+	char buffer[256];
+	unsigned char *uc16p;
+	int i=0,j=0, k;
+	unsigned char *filebuffer;
+	unsigned short *uc16pp,*table;
+	unsigned short uc16px;
+	int length=31504;
+
+	if (use_big5)
+		length=54840;
+
+    	uc16p=(unsigned char *) uc16;
+	uc16pp=(unsigned short *) uc16;
+
+	strcpy(buffer,HZK_FONT_DIR);
+	if (use_big5)
+    		strcat(buffer,"/BG2UBG.KU");
+	else
+    		strcat(buffer,"/UGB2GB.KU");
+	if(!(fp = fopen(buffer, "rb"))) 
+	{
+   	  	 fprintf (stderr, "Error.\nThe %s file can not be found!\n",buffer);
+   		 return -1;
+    	}
+
+	filebuffer= (unsigned char *)malloc ( length);
+
+	if(fread(filebuffer, sizeof(char),length, fp) < length) {
+	   	  fprintf (stderr, "Error in reading ugb2gb.ku file!\n");
+	   	  fclose(fp);
+ 	     	  return -1;
+	}
+    	fclose(fp);
+
+	if (use_big5)
+	{
+		table=(unsigned short *)filebuffer;
+		while(1)
+		{
+			if(j>=cc)
+			{
+				ascii[i]=0;
+				break;
+			}
+			uc16px=*uc16pp;
+			if((uc16px)<=0x00ff)
+			{
+				ascii[i]=(char)(*uc16pp);
+				i++;
+			}
+			else
+			{
+				ascii[i]=0xa1; ascii[i+1]=0x40;
+				for (k=0; k<13710; k++)
+				{
+					if (*(table+(k*2+1))==(uc16px))
+					{
+						ascii[i]=(char)((*(table+(k*2)) & 0xff00) >> 8);
+						ascii[i+1]=(char)(*(table+(k*2)) & 0x00ff);
+						break;
+					}
+				}
+				i+=2;
+			}
+			uc16pp++; j++;
+		}
+	}
+	else
+	{
+	while(1)
+	{
+		if(j>=cc)
+		{
+			ascii[i]=0;
+			break;
+		}
+		if((*((uc16p)+j)==0)&&(*((uc16p)+j+1)==0))
+		{
+			ascii[i]=0;
+			break;
+		}
+		else
+		{
+			if(*((uc16p)+j+1)==0)
+			{
+				ascii[i]=*((uc16p)+j);
+				i++;
+				j+=2;
+			}
+			else
+			{
+			/*	 to find the place of unicode charater .���ַ�ƥ��*/
+            		{
+				int p1=0,p2=length-4,p;
+				unsigned int c1,c2,c,d;
+				c1=((unsigned int )filebuffer[p1])*0x100+(filebuffer[p1+1]);
+                		c2=((unsigned int )filebuffer[p2])*0x100+(filebuffer[p2+1]);
+				d=((unsigned int )*((uc16p)+j))*0x100+*((uc16p)+j+1);
+                		if(c1==d)
+				{
+					ascii[i]=filebuffer[p1+2];
+					ascii[i+1]=filebuffer[p1+3];
+					goto findit;
+ 	            		}
+                		if(c2==d)
+				{
+					ascii[i]=filebuffer[p2+2];
+					ascii[i+1]=filebuffer[p2+3];
+					goto findit;
+                		}
+				while(1)
+				{
+					p=(((p2-p1)/2+p1)>>2)<<2;
+					c=((unsigned int )filebuffer[p])*0x100+(filebuffer[p+1]);
+					if(d==c)	/*find it*/
+					{
+						ascii[i]=filebuffer[p+2];
+						ascii[i+1]=filebuffer[p+3];
+						break;
+          	   	   		}
+					else if(p2<=p1+4) /*can't find.*/
+					{
+						ascii[i]='.';/*((uc16p)+j);*/
+						ascii[i+1]='.';/*((uc16p)+j+1);*/
+						break;
+					}
+					else if(d<c)
+					{
+						p2=p;
+						c2=c;										
+                  			}
+					else
+					{
+						p1=p;
+						c1=c;														
+					}
+				}
+	            	}
+			findit:
+  			i+=2;
+			j+=2;
+			}
+		}
+	}
+	}
+	free(filebuffer);
+
+	return i;
+}
+
+/************************** functions definition ******************************/
+
+static int hzk_id( PMWHZKFONT pf )
+{
+	switch(pf->font_height)
+	{
+	case 12:
+		return 0;
+	case 16: default:
+		return 1;
+	}
+}
+
+/* This function get Chinese font info from etc file.*/
+static MWBOOL GetCFontInfo( PMWHZKFONT pf )
+{
+	int charset;
+
+	if (use_big5)
+		charset=(13094+408);
+	else
+		charset=8178;
+
+    	CFont[hzk_id(pf)].width = pf->cfont_width;
+    	pf->CFont.width = pf->cfont_width;
+
+    	CFont[hzk_id(pf)].height = pf->font_height;
+    	pf->CFont.height = pf->font_height;
+
+    	CFont[hzk_id(pf)].size = ((pf->CFont.width + 7) / 8) *
+		pf->CFont.height * charset;
+    	pf->CFont.size = ((pf->CFont.width + 7) / 8) * pf->CFont.height * charset;
+
+    	if(pf->CFont.size < charset * 8)
+        	return FALSE;
+
+	strcpy(CFont[hzk_id(pf)].file,HZK_FONT_DIR);
+	strcpy(pf->CFont.file,HZK_FONT_DIR);
+
+	if(pf->font_height==16)
+	{
+		strcat(CFont[hzk_id(pf)].file,"/hzk16");
+		strcat(pf->CFont.file,"/hzk16");
+	}
+	else
+	{
+		strcat(CFont[hzk_id(pf)].file,"/hzk12");
+		strcat(pf->CFont.file,"/hzk12");
+	}
+
+    	if (use_big5)
+    	{
+		CFont[hzk_id(pf)].file[strlen(pf->CFont.file)-3]+=use_big5;
+		pf->CFont.file[strlen(pf->CFont.file)-3]+=use_big5;
+    	}
+
+    	return TRUE;
+}
+
+/* This function get ASCII font info from etc file.*/
+static MWBOOL GetAFontInfo( PMWHZKFONT pf )
+{
+    	AFont[hzk_id(pf)].width = pf->afont_width;
+    	pf->AFont.width = pf->afont_width;
+
+    	AFont[hzk_id(pf)].height = pf->font_height;
+    	pf->AFont.height = pf->font_height;
+
+    	AFont[hzk_id(pf)].size = ((pf->AFont.width + 7) / 8) *
+		pf->AFont.height * 255;
+    	pf->AFont.size = ((pf->AFont.width + 7) / 8) * pf->AFont.height * 255;
+    
+	if(pf->AFont.size < 255 * 8)
+        	return FALSE;
+
+	strcpy(AFont[hzk_id(pf)].file,HZK_FONT_DIR);
+	strcpy(pf->AFont.file,HZK_FONT_DIR);
+	
+	if(pf->font_height==16)
+	{
+	    	strcat(AFont[hzk_id(pf)].file,"/asc16");
+	    	strcat(pf->AFont.file,"/asc16");
+	}
+  	else
+	{
+	    	strcat(AFont[hzk_id(pf)].file,"/asc12");
+	    	strcat(pf->AFont.file,"/asc12");
+	}
+    	return TRUE;
+}
+
+/* This function load system font into memory.*/
+static MWBOOL LoadFont( PMWHZKFONT pf )
+{
+    	FILE* fp;
+
+	if(!GetCFontInfo(pf))
+	{
+		fprintf (stderr, "Get Chinese HZK font info failure!\n");
+		return FALSE;
+	}
+    	if(CFont[hzk_id(pf)].pFont == NULL)/*check font cache*/
+	{
+		
+
+ 	   	/* Allocate system memory for Chinese font.*/
+ 		if( !(CFont[hzk_id(pf)].pFont = (char *)malloc(pf->CFont.size)) )
+ 		{
+	 	       	fprintf (stderr, "Allocate memory for Chinese HZK font failure.\n");
+		        return FALSE;
+	 	}
+ 	
+		/* Open font file and read information to the system memory.*/
+ 		fprintf (stderr, "Loading Chinese HZK font from file(%s)..." ,pf->CFont.file);
+		if(!(fp = fopen(CFont[hzk_id(pf)].file, "rb"))) 
+		{
+   		  	fprintf (stderr, "Error.\nThe Chinese HZK font file can not be found!\n");
+   	    	 	return FALSE;
+    		}
+	    	if(fread(CFont[hzk_id(pf)].pFont, sizeof(char), pf->CFont.size, fp) < pf->CFont.size) 
+		{
+	      	  	fprintf (stderr, "Error in reading Chinese HZK font file!\n");
+	 	     	fclose(fp);
+ 	       		return FALSE;
+		}
+
+		fclose(fp);
+
+		CFont[hzk_id(pf)].use_count=0;
+
+		fprintf (stderr, "done.\n" );
+
+	}
+	cfont_address = CFont[hzk_id(pf)].pFont;
+	pf->cfont_address = CFont[hzk_id(pf)].pFont;
+	pf->CFont.pFont = CFont[hzk_id(pf)].pFont;
+
+	CFont[hzk_id(pf)].use_count++;
+
+	if(!GetAFontInfo(pf))
+	{
+	       fprintf (stderr, "Get ASCII HZK font info failure!\n");
+	       return FALSE;
+	}
+    	if(AFont[hzk_id(pf)].pFont == NULL)/*check font cache*/
+	{
+		
+ 		
+ 		/* Allocate system memory for ASCII font.*/
+ 		if( !(AFont[hzk_id(pf)].pFont = (char *)malloc(pf->AFont.size)) )
+ 		{
+ 		       	fprintf (stderr, "Allocate memory for ASCII HZK font failure.\n");
+ 		       	free(CFont[hzk_id(pf)].pFont);
+ 		       	CFont[hzk_id(pf)].pFont = NULL;
+			return FALSE;
+ 		}
+ 	
+	 	/* Load ASCII font information to the near memory.*/
+ 		fprintf (stderr, "Loading ASCII HZK font..." );
+ 		if(!(fp = fopen(AFont[hzk_id(pf)].file, "rb"))) 
+		{
+ 		       	fprintf (stderr, "Error.\nThe ASCII HZK font file can not be found!\n");
+ 		       	return FALSE;
+ 		}
+	 	if(fread(AFont[hzk_id(pf)].pFont, sizeof(char), pf->AFont.size, fp) < pf->AFont.size) 
+		{
+ 		       	fprintf (stderr, "Error in reading ASCII HZK font file!\n");
+ 		       	fclose(fp);
+ 		       	return FALSE;
+	 	}
+ 	
+ 		fclose(fp);
+ 	
+		AFont[hzk_id(pf)].use_count=0;
+
+		fprintf (stderr, "done.\n" );
+
+  	}
+	afont_address = AFont[hzk_id(pf)].pFont;
+	pf->afont_address = AFont[hzk_id(pf)].pFont;
+	pf->AFont.pFont = AFont[hzk_id(pf)].pFont;
+
+	AFont[hzk_id(pf)].use_count++;
+
+  	return TRUE;
+}
+
+/* This function unload system font from memory.*/
+static void UnloadFont( PMWHZKFONT pf )
+{
+	CFont[hzk_id(pf)].use_count--;
+	AFont[hzk_id(pf)].use_count--;
+
+	if (!CFont[hzk_id(pf)].use_count)
+	{	
+	    	free(pf->CFont.pFont);
+	    	free(pf->AFont.pFont);
+
+	    	CFont[hzk_id(pf)].pFont = NULL;
+	    	AFont[hzk_id(pf)].pFont = NULL;
+	}
+}
+
+static int
+hzk_init(PSD psd)
+{
+	/* FIXME: *.KU file should be opened and
+	 * read in here...*/
+	return 1;
+}
+
+static PMWHZKFONT
+hzk_createfont(const char *name, MWCOORD height, int attr)
+{
+	PMWHZKFONT	pf;
+
+	if(strcmp(name,"HZKFONT")!=0 && strcmp(name,"HZXFONT")!=0)
+		return FALSE;
+
+printf("hzk_createfont(%s,%d)\n",name,height);
+
+	use_big5=name[2]-'K';
+
+	/* allocate font structure*/
+	pf = (PMWHZKFONT)calloc(sizeof(MWHZKFONT), 1);
+	if (!pf)
+		return NULL;
+	pf->fontprocs = &hzk_procs;
+
+	pf->fontsize=height;
+	/*GdSetFontSize((PMWFONT)pf, height);*/
+	GdSetFontRotation((PMWFONT)pf, 0);
+	GdSetFontAttr((PMWFONT)pf, attr, 0);
+
+	if(height==12)
+	{		
+		afont_width = 6;
+		cfont_width = 12;
+		font_height = 12;
+
+		pf->afont_width = 6;
+		pf->cfont_width = 12;
+		pf->font_height = 12;
+	}
+	else 	
+	{		
+		afont_width = 8;
+		cfont_width = 16;
+		font_height = 16;
+
+		pf->afont_width = 8;
+		pf->cfont_width = 16;
+		pf->font_height = 16;
+	}
+
+    	/* Load the font library to the system memory.*/
+	if(!LoadFont(pf))
+  	      	return FALSE;
+
+	return pf;
+}
+
+int IsBig5(int i)
+{
+	if ((i>=0xa140 && i<=0xa3bf) || /* a140-a3bf(!a3e0) */
+	    (i>=0xa440 && i<=0xc67e) || /* a440-c67e        */
+	    (i>=0xc6a1 && i<=0xc8d3) || /* c6a1-c8d3(!c8fe) */
+	    (i>=0xc940 && i<=0xf9fe))   /* c940-f9fe        */
+		return 1;
+	else
+		return 0;
+}
+
+/*
+ * following several function is used in hzk_drawtext
+ */
+
+static int getnextchar(char* s, unsigned char* cc)
+{
+    	if( s[0] == '\0') return 0;
+
+    	cc[0] = (unsigned char)(*s);
+    	cc[1] = (unsigned char)(*(s + 1));
+
+    	if (use_big5)
+    	{
+		if( IsBig5( (int) ( (cc[0] << 8) + cc[1]) ) )
+			return 1;
+    	}
+    	else
+	{
+    		if( ((unsigned char)cc[0] > 0xa0) &&
+		    ((unsigned char)cc[1] > 0xa0) )
+        		return 1;
+	}
+
+    	cc[1] = '\0';
+
+    	return 1;
+}
+
+static void
+expandcchar(PMWHZKFONT pf, int bg, int fg, unsigned char* c, MWPIXELVAL* bitmap)
+{
+	int i=0;
+    	int c1, c2, seq;
+	int x,y;
+    	unsigned char *font;
+    	int b = 0;		/* keep gcc happy with b = 0 - MW */
+
+	int pixelsize;
+	pixelsize=sizeof(MWPIXELVAL);
+
+   	c1 = c[0];
+    	c2 = c[1];
+	if (use_big5)
+	{
+		seq=0;
+		/*ladd=loby-(if(loby<127)?64:98)*/
+		c2-=(c2<127?64:98);   
+
+		/*hadd=(hiby-164)*157*/
+		if (c1>=0xa4)/*standard font*/
+		{
+			seq=(((c1-164)*157)+c2);
+			if (seq>=5809) seq-=408;
+		}
+
+		/*hadd=(hiby-161)*157*/
+		if (c1<=0xa3)/*special font*/
+			seq=(((c1-161)*157)+c2)+13094;
+	}
+	else
+    		seq=((c1 - 161)*94 + c2 - 161); 
+
+	font = pf->cfont_address + ((seq) *
+		  (pf->font_height * ((pf->cfont_width + 7) / 8)));
+
+     	for (y = 0; y < pf->font_height; y++)
+        	for (x = 0; x < pf->cfont_width; x++) 
+		{
+            		if (x % 8 == 0)
+                		b = *font++;
+
+            		if (b & (128 >> (x % 8)))   /* pixel */
+			  	bitmap[i++]=fg;
+			else
+				bitmap[i++]=bg;
+		}		
+}
+
+static void expandchar(PMWHZKFONT pf, int bg, int fg, int c, MWPIXELVAL* bitmap)
+{
+	int i=0;
+	int x,y;
+    	unsigned char *font;
+	int pixelsize;
+    	int b = 0;		/* keep gcc happy with b = 0 - MW */
+
+	pixelsize=sizeof(MWPIXELVAL);
+
+    	font = pf->afont_address + c * (pf->font_height *
+		((pf->afont_width + 7) / 8));
+
+  	for (y = 0; y < pf->font_height; y++)
+		for (x = 0; x < pf->afont_width; x++) 
+		{
+	    		if (x % 8 == 0)
+				b = *font++;
+	    		if (b & (128 >> (x % 8)))	/* pixel */
+				bitmap[i++]=fg;
+			else
+				bitmap[i++]=bg;
+  		}
+}
+
+/*
+ * Draw ASCII text string using HZK type font
+ */
+static void
+hzk_drawtext(PMWFONT pfont, PSD psd, MWCOORD ax, MWCOORD ay,
+	const void *text, int cc, int flags)
+{
+	PMWHZKFONT pf=(PMWHZKFONT)pfont;
+
+    	unsigned char c[2];
+	MWPIXELVAL *bitmap;
+    	unsigned char s1[3];
+ 	char *s,*sbegin;
+
+	s=(char *)text;
+
+	if(cc==1)
+	{
+		s1[0]=*((unsigned char*)text);
+		s1[1]=0x0;
+		s1[2]=0x0;
+		s=s1;
+    	}
+
+	sbegin=s;
+    	bitmap = (MWPIXELVAL *)ALLOCA(pf->cfont_width * pf->font_height *
+			sizeof(MWPIXELVAL));
+
+    	while( getnextchar(s, c) )
+	{
+              	if( c[1] != '\0') 
+		{
+                	expandcchar(pf, gr_background,gr_foreground,
+                            c, bitmap);
+			/* Now draw the bitmap ... */
+			
+			if (flags&MWTF_TOP)
+				GdArea(psd,ax, ay, pf->cfont_width,
+					pf->font_height, bitmap, MWPF_PIXELVAL);
+			else
+				GdArea(psd,ax, ay-pf->font_height+2,
+					pf->cfont_width, pf->font_height,
+					bitmap, MWPF_PIXELVAL);
+
+                	s += 2;
+                	ax += pf->cfont_width;
+            	}
+            	else 
+		{
+                	expandchar(pf, gr_background,gr_foreground,
+                           c[0], bitmap);
+			/* Now draw the bitmap ... */
+
+			if (flags&MWTF_TOP) 
+				GdArea(psd,ax, ay, pf->afont_width,
+					pf->font_height, bitmap, MWPF_PIXELVAL);
+			else
+				GdArea(psd,ax, ay-pf->font_height+2,
+					pf->afont_width, pf->font_height,
+					bitmap, MWPF_PIXELVAL);
+
+                	s += 1;
+                	ax += pf->afont_width;
+            	}
+						
+		if(s>=sbegin+cc)break;
+    	}
+
+	FREEA(bitmap);
+}
+
+/*
+ * Return information about a specified font.
+ */
+static MWBOOL
+hzk_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo)
+{
+	PMWHZKFONT pf=(PMWHZKFONT)pfont;
+
+	int i;
+
+	pfontinfo->height = pf->font_height;
+	pfontinfo->maxwidth = pf->cfont_width;
+	pfontinfo->baseline = pf->font_height-2;
+	pfontinfo->firstchar = 0;
+	pfontinfo->lastchar = 0;
+	pfontinfo->fixed = TRUE;
+		
+	for(i=0; i<=256; i++)
+		pfontinfo->widths[i] = pf->afont_width;
+
+	return TRUE;
+}
+
+static void
+hzk_gettextsize(PMWFONT pfont, const void *text, int cc,
+	MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase)
+{
+	PMWHZKFONT pf=(PMWHZKFONT)pfont;
+
+   	unsigned char c[2];
+ 	char *s,*sbegin;
+    	unsigned char s1[3];
+
+	int ax=0;
+
+
+
+	s=(char *)text;
+	if(cc==0)
+	{
+		*pwidth = 0;
+		*pheight = pf->font_height;
+		*pbase = pf->font_height-2;
+
+	}
+	if(cc==1)
+	{
+		s1[0]=*((unsigned char*)text);
+		s1[1]=0x0;
+		s1[2]=0x0;
+		s=s1;
+    	}
+	sbegin=s;
+    	while( getnextchar(s, c) )
+	{
+		if( c[1] != '\0') 
+		{
+           		s += 2;
+           		ax += pf->cfont_width;
+        	}
+        	else 
+		{
+           		s += 1;
+           		ax += pf->afont_width;
+        	}
+		if(s>=sbegin+cc)break;
+		/*	fprintf(stderr,"s=%x,sbegin=%x,cc=%x\n",s,sbegin,cc);*/
+
+    	}
+/*	fprintf(stderr,"ax=%d,\n",ax);*/
+
+	*pwidth = ax;
+	*pheight = pf->font_height;
+	*pbase = pf->font_height-2;
+}
+
+static void
+hzk_destroyfont(PMWFONT pfont)
+{
+	PMWHZKFONT pf=(PMWHZKFONT)pfont;
+
+	UnloadFont(pf);
+	free(pf);
+}
+
+static void
+hzk_setfontsize(PMWFONT pfont, MWCOORD fontsize)
+{
+	PMWHZKFONT pf=(PMWHZKFONT)pfont;
+
+	/*jmt: hzk_setfontsize not supported*/
+	/*jmt: & pf->fontsize can't be changed*/
+	/*jmt: because of hzk_id() :p*/
+	pf->fontsize=pf->font_height;
+}
+#endif /* HAVE_HZK_SUPPORT*/
+
+/* FIXME: this routine should work for all font renderers...*/
+int
+GdGetTextSizeEx(PMWFONT pfont, const void *str, int cc,int nMaxExtent,
+	int* lpnFit, int* alpDx,MWCOORD *pwidth,MWCOORD *pheight,
+	MWCOORD *pbase, int flags)
+{
+#ifdef HAVE_FREETYPE_SUPPORT
+	unsigned short	buf[256];
+	unsigned short* text;
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	int		defencoding = pf->fontprocs->encoding;
+	int 		x = 0;
+	int 		i;
+	TT_UShort 	curchar;
+	TT_Glyph_Metrics metrics;
+	TT_Face_Properties 	properties;
+	TT_Instance_Metrics imetrics;
+
+	if ((cc<0)||(!str))
+	{
+		*pwidth = *pheight = *pbase = 0;
+		return 0;
+	}
+	/* convert encoding if required*/
+	if((flags & MWTF_PACKMASK) != defencoding) 
+	{
+		cc = GdConvertEncoding(str, flags, cc, buf, defencoding);
+		flags &= ~MWTF_PACKMASK;
+		flags |= defencoding;
+		text=buf;
+	} else text =(unsigned short*)str;
+	if(cc <= 0)
+	{
+		*pwidth = *pheight = *pbase = 0;
+		return 0;
+	}
+
+	TT_Get_Face_Properties (pf->face, &properties);
+	TT_Get_Instance_Metrics(pf->instance, &imetrics);
+	
+	pf->last_glyph_code = -1;		/* reset kerning*/
+	pf->last_pen_pos = -32767;
+	if (lpnFit)
+	     *lpnFit=-1;
+	for (i = 0; i < cc; i++) 
+	{
+		curchar = TT_Char_Index (pf->char_map,text[i]);
+		
+		if (TT_Load_Glyph (pf->instance, pf->glyph, curchar,
+			TTLOAD_SCALE_GLYPH|TTLOAD_HINT_GLYPH) != TT_Err_Ok)			
+		{		
+		     printf("Unable to load glyph with index=%d\n",curchar);    
+			return 0;
+		}
+		TT_Get_Glyph_Metrics (pf->glyph, &metrics);
+		if ((pf->fontattr&MWTF_KERNING) && pf->can_kern)
+		{
+			x += compute_kernval(pf, curchar) / 64;
+		}
+		x += metrics.advance / 64;
+     		if((lpnFit)&&(alpDx))
+		{
+			if (x<=nMaxExtent)
+			     alpDx[i]=x;
+			else
+			     if (*lpnFit==-1)
+					(*lpnFit)=i;               		     
+		}
+		/* Kerning point syndrome avoidance */
+		if (pf->last_pen_pos > x)
+			x = pf->last_pen_pos;
+		pf->last_pen_pos = x;
+		pf->last_glyph_code = curchar;
+	}
+     	if ((lpnFit)&&(*lpnFit==-1))
+    		*lpnFit=cc;
+	*pwidth = x;
+	*pheight = (((properties.horizontal->Ascender * 
+	                imetrics.y_scale)/ 0x10000) >> 6) -
+			    (((properties.horizontal->Descender * 
+			    imetrics.y_scale)/ 0x10000) >> 6);
+	/*FIXME: is it what's required ??*/
+	if (pbase)
+		*pbase = (((-properties.horizontal->Descender) * 
+			    imetrics.y_scale)/ 0x10000) >> 6;
+	return 1;
+#else /* HAVE_FREETYPE_SUPPORT*/
+	*pwidth = *pheight = *pbase = 0;
+	return 0;
+#endif
+}
diff -urN lib/microwindows/src/engine/devfont.noncaching.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devfont.noncaching.c
--- lib/microwindows/src/engine/devfont.noncaching.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devfont.noncaching.c	2005-02-21 16:13:16.000000000 +0100
@@ -0,0 +1,2474 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * T1lib Adobe type1 routines contributed by Vidar Hokstad
+ * Freetype TrueType routines contributed by Martin Jolicoeur
+ * Han Zi Ku routines contributed by Tanghao and Jauming
+ *
+ * Device-independent font and text drawing routines
+ *
+ * These routines do the necessary range checking, clipping, and cursor
+ * overwriting checks, and then call the lower level device dependent
+ * routines to actually do the drawing.  The lower level routines are
+ * only called when it is known that all the pixels to be drawn are
+ * within the device area and are visible.
+ */
+/*#define NDEBUG*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <string.h>
+
+#include "device.h"
+#if (UNIX | DOS_DJGPP)
+#define strcmpi	strcasecmp
+#endif
+
+#if HAVE_T1LIB_SUPPORT
+#include <t1lib.h>
+#define T1LIB_USE_AA_HIGH
+
+typedef struct {
+	PMWFONTPROCS	fontprocs;	/* common hdr*/
+	MWCOORD		fontsize;
+	int		fontrotation;
+	int		fontattr;		
+
+	int		fontid;		/* t1lib stuff*/
+} MWT1LIBFONT, *PMWT1LIBFONT;
+
+static int  t1lib_init(PSD psd);
+static PMWT1LIBFONT t1lib_createfont(const char *name, MWCOORD height,int attr);
+static void t1lib_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+		const void *text, int cc, int flags);
+static MWBOOL t1lib_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo);
+static void t1lib_gettextsize(PMWFONT pfont, const void *text, int cc,
+		MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+static void t1lib_destroyfont(PMWFONT pfont);
+
+/* handling routines for MWT1LIBFONT*/
+static MWFONTPROCS t1lib_procs = {
+	MWTF_ASCII,			/* routines expect ascii*/
+	t1lib_getfontinfo,
+	t1lib_gettextsize,
+	NULL,				/* gettextbits*/
+	t1lib_destroyfont,
+	t1lib_drawtext,
+	NULL,				/* setfontsize*/
+	NULL,				/* setfontrotation*/
+	NULL,				/* setfontattr*/
+};
+#endif
+
+#ifdef T1LIB_USE_AA_HIGH
+typedef unsigned long OUTPIXELVAL;
+#else
+typedef MWPIXELVAL OUTPIXELVAL;
+#endif
+
+#if HAVE_FREETYPE_SUPPORT
+#include <freetype/freetype.h>
+#include <freetype/ftxkern.h>
+#include <freetype/ftnameid.h>
+#include <freetype/ftxcmap.h>
+#include <freetype/ftxwidth.h>
+#include <math.h>
+
+#ifndef FREETYPE_FONT_DIR
+#define FREETYPE_FONT_DIR "/usr/local/microwin/fonts"
+#endif
+
+#if TT_FREETYPE_MAJOR != 1 | TT_FREETYPE_MINOR < 3
+#error "You must link with freetype lib version 1.3.x +, and not freetype 2. \
+Download it at http://www.freetype.org or http://microwindows.org"
+#endif
+
+typedef struct {
+	PMWFONTPROCS	fontprocs;	/* common hdr*/
+	MWCOORD		fontsize;
+	int		fontrotation;
+	int		fontattr;		
+
+	TT_Face 	face;		/* freetype stuff*/
+	TT_Instance	instance;
+	TT_CharMap 	char_map;
+	TT_Kerning 	directory;
+	TT_Matrix 	matrix;
+	TT_Glyph 	glyph;
+	MWBOOL 		can_kern;
+	short 		last_glyph_code;
+	short 		last_pen_pos;
+} MWFREETYPEFONT, *PMWFREETYPEFONT;
+
+static int  freetype_init(PSD psd);
+static PMWFREETYPEFONT freetype_createfont(const char *name, MWCOORD height,
+		int attr);
+static MWBOOL freetype_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo);
+static void freetype_gettextsize(PMWFONT pfont, const void *text,
+		int cc, MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+static void freetype_destroyfont(PMWFONT pfont);
+static void freetype_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+		const void *text, int cc, int flags);
+static void freetype_setfontsize(PMWFONT pfont, MWCOORD fontsize);
+static void freetype_setfontrotation(PMWFONT pfont, int tenthdegrees);
+		
+/* handling routines for MWFREETYPEFONT*/
+static MWFONTPROCS freetype_procs = {
+	MWTF_UC16,			/* routines expect unicode 16*/
+	freetype_getfontinfo,
+	freetype_gettextsize,
+	NULL,				/* gettextbits*/
+	freetype_destroyfont,
+	freetype_drawtext,
+	freetype_setfontsize,
+	freetype_setfontrotation,
+	NULL,				/* setfontattr*/
+};
+
+static TT_Engine 	engine;		/* THE ONLY freetype engine */
+#endif /* HAVE_FREETYPE_SUPPORT*/
+
+#if HAVE_HZK_SUPPORT
+/*
+ * 12x12 and 16x16 ascii and chinese fonts
+ * Big5 and GB2312 encodings supported
+ */
+#define MAX_PATH	256
+typedef struct {
+	int	width;
+	int	height;
+	int	size;
+	unsigned long use_count;
+	char *	pFont;
+	char	file[MAX_PATH + 1];
+} HZKFONT;
+
+static int use_big5=1;
+static HZKFONT CFont[2];//font cache
+static HZKFONT AFont[2];//font cache
+
+//jmt: moved inside MWHZKFONT
+static int afont_width = 8;
+static int cfont_width = 16;
+static int font_height = 16;
+static char *afont_address;
+static char *cfont_address;
+
+typedef struct {
+	PMWFONTPROCS	fontprocs;	/* common hdr*/
+	MWCOORD		fontsize;
+	int		fontrotation;
+	int		fontattr;		
+
+	HZKFONT 	CFont;		/* hzkfont stuff */
+	HZKFONT 	AFont;
+	int 		afont_width;
+	int 		cfont_width;
+	int 		font_height;
+	char 		*afont_address;
+	char 		*cfont_address;
+} MWHZKFONT, *PMWHZKFONT;
+
+static int  hzk_init(PSD psd);
+static PMWHZKFONT hzk_createfont(const char *name, MWCOORD height,int fontattr);
+static MWBOOL hzk_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo);
+static void hzk_gettextsize(PMWFONT pfont, const void *text,
+		int cc, MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+//static void hzk_gettextbits(PMWFONT pfont, int ch, IMAGEBITS *retmap,
+//		MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+static void hzk_destroyfont(PMWFONT pfont);
+static void hzk_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+		const void *text, int cc, int flags);
+static void hzk_setfontsize(PMWFONT pfont, MWCOORD fontsize);
+//static void hzk_setfontrotation(PMWFONT pfont, int tenthdegrees);
+		
+/* handling routines for MWHZKFONT*/
+static MWFONTPROCS hzk_procs = {
+	MWTF_ASCII,			/* routines expect ASCII*/
+	hzk_getfontinfo,
+	hzk_gettextsize,
+	NULL,				/* hzk_gettextbits*/
+	hzk_destroyfont,
+	hzk_drawtext,
+	hzk_setfontsize,
+	NULL, 				/* setfontrotation*/
+	NULL,				/* setfontattr*/
+};
+
+static int
+UC16_to_GB(const unsigned char *uc16, int cc, unsigned char *ascii);
+#endif /* HAVE_HZK_SUPPORT*/
+
+static PMWFONT	gr_pfont;            	/* current font*/
+
+/* temp extern decls*/
+extern MWPIXELVAL gr_foreground;
+extern MWPIXELVAL gr_background;
+extern MWBOOL gr_usebg;
+
+static int  utf8_to_utf16(const unsigned char *utf8, int cc,
+		unsigned short *unicode16);
+
+#if FONTMAPPER
+/* entry point for font selection*/
+int select_font(const PMWLOGFONT plogfont, char *physname);
+#endif
+
+/*
+ * Set the font for future calls.
+ */
+PMWFONT
+GdSetFont(PMWFONT pfont)
+{
+	PMWFONT	oldfont = gr_pfont;
+
+	gr_pfont = pfont;
+	return oldfont;
+}
+
+/*
+ * Select a font, based on various parameters.
+ * If plogfont is specified, name and height parms are ignored
+ * and instead used from MWLOGFONT.
+ * 
+ * If height is 0, return builtin font from passed name.
+ * Otherwise find builtin font best match based on height.
+ */
+PMWFONT
+GdCreateFont(PSD psd, const char *name, MWCOORD height,
+	const PMWLOGFONT plogfont)
+{
+	int 		i;
+	int		fontht;
+	int		fontno;
+ 	int		fontclass;
+	int		fontattr = 0;
+	PMWFONT		pfont;
+	PMWCOREFONT	pf = psd->builtin_fonts;
+	MWFONTINFO	fontinfo;
+	MWSCREENINFO 	scrinfo;
+ 	char		fontname[128];
+
+	GdGetScreenInfo(psd, &scrinfo);
+
+	/* if plogfont not specified, use name and height*/
+	if (!plogfont) {
+		if (!name)
+			name = MWFONT_SYSTEM_VAR;
+		strcpy(fontname, name);
+		fontclass = MWLF_CLASS_ANY;
+	} else {
+#if FONTMAPPER
+		/* otherwise, use MWLOGFONT name and height*/
+ 		fontclass = select_font(plogfont, fontname);
+#else
+		if (!name)
+			name = MWFONT_SYSTEM_VAR;
+		strcpy(fontname, name);
+		fontclass = MWLF_CLASS_ANY;
+#endif
+		height = plogfont->lfHeight;
+		if (plogfont->lfUnderline)
+			fontattr = MWTF_UNDERLINE;
+	}
+	height = abs(height);
+ 
+ 	if (!fontclass)
+ 		goto first;
+ 
+	/* use builtin screen fonts, FONT_xxx, if height is 0 */
+ 	if (height == 0 || fontclass == MWLF_CLASS_ANY ||
+	    fontclass == MWLF_CLASS_BUILTIN) {
+  		for(i = 0; i < scrinfo.fonts; ++i) {
+ 			if(!strcmpi(pf[i].name, fontname)) {
+  				pf[i].fontsize = pf[i].cfont->height;
+				pf[i].fontattr = fontattr;
+  				return (PMWFONT)&pf[i];
+  			}
+  		}
+ 
+		/* return first builtin font*/
+		if (height == 0 || fontclass == MWLF_CLASS_BUILTIN)
+			goto first;
+  	}
+
+#if HAVE_HZK_SUPPORT
+        /* Make sure the library is initialized */
+	if (hzk_init(psd)) {
+		pfont = (PMWFONT)hzk_createfont(name, height, fontattr);
+		if(pfont)		
+			return pfont;
+		printf("hzk_createfont: %s not found\n", name);
+	}
+#endif
+
+#if HAVE_FREETYPE_SUPPORT
+ 	if (fontclass == MWLF_CLASS_ANY || fontclass == MWLF_CLASS_FREETYPE) {
+		if (freetype_init(psd)) {
+		/* auto antialias for height > 14 for kaffe*/
+			if (plogfont && plogfont->lfHeight > 14 &&
+				plogfont->lfQuality)
+					fontattr |= MWTF_ANTIALIAS;
+
+			pfont = (PMWFONT)freetype_createfont(fontname, height,
+					fontattr);
+			if(pfont) {
+				/* temp kaffe kluge*/
+				pfont->fontattr |= FS_FREETYPE;
+				return pfont;
+			}
+ 			DPRINTF("freetype_createfont: %s,%d not found\n",
+				fontname, height);
+		}
+  	}
+#endif
+
+#if HAVE_T1LIB_SUPPORT
+	if (fontclass == MWLF_CLASS_ANY || fontclass == MWLF_CLASS_T1LIB) {
+		if (t1lib_init(psd)) {
+			pfont = (PMWFONT)t1lib_createfont(fontname, height,
+					fontattr);
+			if(pfont)
+				return pfont;
+			DPRINTF("t1lib_createfont: %s,%d not found\n",
+				fontname, height);
+		}
+  	}
+#endif
+
+	/* find builtin font closest in height*/
+	if(height != 0) {
+		fontno = 0;
+		height = abs(height);
+		fontht = MAX_MWCOORD;
+		for(i = 0; i < scrinfo.fonts; ++i) {
+			pfont = (PMWFONT)&pf[i];
+			GdGetFontInfo(pfont, &fontinfo);
+			if(fontht > abs(height-fontinfo.height)) { 
+				fontno = i;
+				fontht = abs(height-fontinfo.height);
+			}
+		}
+		pf[fontno].fontsize = pf[fontno].cfont->height;
+		pf[fontno].fontattr = fontattr;
+		return (PMWFONT)&pf[fontno];
+	}
+
+first:
+	/* Return first builtin font*/
+	pf->fontsize = pf->cfont->height;
+	pf->fontattr = fontattr;
+	return (PMWFONT)&pf[0];
+}
+
+/* Set the font size for the passed font*/
+MWCOORD
+GdSetFontSize(PMWFONT pfont, MWCOORD fontsize)
+{
+	MWCOORD	oldfontsize = pfont->fontsize;
+
+	pfont->fontsize = fontsize;
+
+	if (pfont->fontprocs->SetFontSize)
+	    pfont->fontprocs->SetFontSize(pfont, fontsize);
+
+	return oldfontsize;
+}
+
+/* Set the font rotation angle in tenths of degrees for the passed font*/
+int
+GdSetFontRotation(PMWFONT pfont, int tenthdegrees)
+{
+	MWCOORD	oldrotation = pfont->fontrotation;
+
+	pfont->fontrotation = tenthdegrees;
+
+	if (pfont->fontprocs->SetFontRotation)
+	    pfont->fontprocs->SetFontRotation(pfont, tenthdegrees);
+	
+	return oldrotation;
+}
+
+/*
+ * Set/reset font attributes (MWTF_KERNING, MWTF_ANTIALIAS)
+ * for the passed font.
+ */
+int
+GdSetFontAttr(PMWFONT pfont, int setflags, int clrflags)
+{
+	MWCOORD	oldattr = pfont->fontattr;
+
+	pfont->fontattr &= ~clrflags;
+	pfont->fontattr |= setflags;
+
+	if (pfont->fontprocs->SetFontAttr)
+	    pfont->fontprocs->SetFontAttr(pfont, setflags, clrflags);
+	
+	return oldattr;
+}
+
+/* Unload and deallocate font*/
+void
+GdDestroyFont(PMWFONT pfont)
+{
+	if (pfont->fontprocs->DestroyFont)
+		pfont->fontprocs->DestroyFont(pfont);
+}
+
+/* Return information about a specified font*/
+MWBOOL
+GdGetFontInfo(PMWFONT pfont, PMWFONTINFO pfontinfo)
+{
+	if(!pfont || !pfont->fontprocs->GetFontInfo)
+		return FALSE;
+
+	return pfont->fontprocs->GetFontInfo(pfont, pfontinfo);
+}
+
+/*
+ * Convert from one encoding to another
+ * Input cc and returned cc is character count, not bytes
+ * Return < 0 on error or can't translate
+ */
+int
+GdConvertEncoding(const void *istr, int iflags, int cc, void *ostr, int oflags)
+{
+	const unsigned char 	*istr8;
+	const unsigned short 	*istr16;
+	const unsigned long	*istr32;
+	unsigned char 		*ostr8;
+	unsigned short 		*ostr16;
+	unsigned long		*ostr32;
+	unsigned int		ch;
+	int			icc;
+	unsigned short		buf16[512];
+
+	iflags &= MWTF_PACKMASK;
+	oflags &= MWTF_PACKMASK;
+
+	/* allow -1 for len with ascii*/
+	if(cc == -1 && (iflags == MWTF_ASCII))
+		cc = strlen((char *)istr);
+
+	/* first check for utf8 input encoding*/
+	if(iflags == MWTF_UTF8) {
+		/* we've only got uc16 now so convert to uc16...*/
+		cc = utf8_to_utf16((unsigned char *)istr, cc,
+			oflags==MWTF_UC16?(unsigned short*) ostr: buf16);
+
+		if(oflags == MWTF_UC16 || cc < 0)
+			return cc;
+
+		/* will decode again to requested format (probably ascii)*/
+		iflags = MWTF_UC16;
+		istr = buf16;
+	}
+
+#if HAVE_HZK_SUPPORT
+	if(iflags == MWTF_UC16 && oflags == MWTF_ASCII) {
+		/* only support uc16 convert to ascii now...*/
+		cc = UC16_to_GB( istr, cc, ostr);
+		return cc;
+	}
+#endif
+
+	icc = cc;
+	istr8 = istr;
+	istr16 = istr;
+	istr32 = istr;
+	ostr8 = ostr;
+	ostr16 = ostr;
+	ostr32 = ostr;
+
+	/* Convert between formats.  Note that there's no error
+	 * checking here yet.
+	 */
+	while(--icc >= 0) {
+		switch(iflags) {
+		default:
+			ch = *istr8++;
+			break;
+		case MWTF_UC16:
+			ch = *istr16++;
+			break;
+		case MWTF_UC32:
+			ch = *istr32++;
+		}
+		switch(oflags) {
+		default:
+			*ostr8++ = (unsigned char)ch;
+			break;
+		case MWTF_UC16:
+			*ostr16++ = (unsigned short)ch;
+			break;
+		case MWTF_UC32:
+			*ostr32++ = ch;
+		}
+	}
+	return cc;
+}
+
+/* Get the width and height of passed text string in the passed font*/
+void
+GdGetTextSize(PMWFONT pfont, const void *str, int cc, MWCOORD *pwidth,
+	MWCOORD *pheight, MWCOORD *pbase, int flags)
+{
+	const void *	text;
+	unsigned long	buf[256];
+	int		defencoding = pfont->fontprocs->encoding;
+
+	/* convert encoding if required*/
+	if((flags & MWTF_PACKMASK) != defencoding) {
+		cc = GdConvertEncoding(str, flags, cc, buf, defencoding);
+		flags &= ~MWTF_PACKMASK;
+		flags |= defencoding;
+		text = buf;
+	} else text = str;
+
+	if(cc == -1 && (flags & MWTF_PACKMASK) == MWTF_ASCII)
+		cc = strlen((char *)str);
+
+	if(cc <= 0 || !pfont->fontprocs->GetTextSize) {
+		*pwidth = *pheight = *pbase = 0;
+		return;
+	}
+
+	/* calc height and width of string*/
+	pfont->fontprocs->GetTextSize(pfont, text, cc, pwidth, pheight, pbase);
+}
+
+/* Draw a text string at a specifed coordinates in the foreground color
+ * (and possibly the background color), applying clipping if necessary.
+ * The background color is only drawn if the gr_usebg flag is set.
+ * Use the current font.
+ */
+void
+GdText(PSD psd, MWCOORD x, MWCOORD y, const void *str, int cc, int flags)
+{
+	const void *	text;
+	unsigned long	buf[256];
+	int		defencoding = gr_pfont->fontprocs->encoding;
+
+	/* convert encoding if required*/
+	if((flags & MWTF_PACKMASK) != defencoding) {
+		cc = GdConvertEncoding(str, flags, cc, buf, defencoding);
+		flags &= ~MWTF_PACKMASK;
+		flags |= defencoding;
+		text = buf;
+	} else text = str;
+
+	if(cc == -1 && (flags & MWTF_PACKMASK) == MWTF_ASCII)
+		cc = strlen((char *)str);
+
+	if(cc <= 0 || !gr_pfont->fontprocs->DrawText)
+		return;
+
+	/* draw text string*/
+	gr_pfont->fontprocs->DrawText(gr_pfont, psd, x, y, text, cc, flags);
+}
+
+/*
+ * Draw ascii text using COREFONT type font.
+ */
+void
+corefont_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+	const void *text, int cc, int flags)
+{
+	const unsigned char *str = text;
+	MWCOORD		width;			/* width of text area */
+	MWCOORD 	height;			/* height of text area */
+	MWCOORD		base;			/* baseline of text*/
+	MWCOORD		startx, starty;
+						/* bitmap for characters */
+	MWIMAGEBITS bitmap[MAX_CHAR_HEIGHT*MAX_CHAR_WIDTH/MWIMAGE_BITSPERIMAGE];
+
+	pfont->fontprocs->GetTextSize(pfont, str, cc, &width, &height, &base);
+	
+	if(flags & MWTF_BASELINE)
+		y -= base;
+	else if(flags & MWTF_BOTTOM)
+		y -= (height - 1);
+	startx = x;
+	starty = y + base;
+
+	switch (GdClipArea(psd, x, y, x + width - 1, y + height - 1)) {
+	case CLIP_VISIBLE:
+		/*
+		 * For size considerations, there's no low-level text
+		 * draw, so we've got to draw all text
+		 * with per-point clipping for the time being
+		if (gr_usebg)
+			psd->FillRect(psd, x, y, x + width - 1, y + height - 1,
+				gr_background);
+		psd->DrawText(psd, x, y, str, cc, gr_foreground, pfont);
+		GdFixCursor(psd);
+		return;
+		*/
+		break;
+
+	case CLIP_INVISIBLE:
+		return;
+	}
+
+	/* Get the bitmap for each character individually, and then display
+	 * them using clipping for each one.
+	 */
+	while (--cc >= 0 && x < psd->xvirtres) {
+		unsigned int ch = *str++;
+#if HAVE_BIG5_SUPPORT
+		/* chinese big5 decoding*/
+		if (ch >= 0xA1 && ch <= 0xF9 && cc >= 1 &&
+			((*str >= 0x40 && *str <= 0x7E) ||
+			 (*str >= 0xA1 && *str <= 0xFE)) ) {
+				ch = (ch << 8) | *str++;
+				--cc;
+		}
+#endif
+#if HAVE_GB2312_SUPPORT
+		/* chinese gb2312 decoding*/
+		if (ch >= 0xA1 && ch < 0xF8 && cc >= 1 &&
+			*str >= 0xA1 && *str < 0xFF) {
+				ch = (ch << 8) | *str++;
+				--cc;
+		}
+#endif
+		pfont->fontprocs->GetTextBits(pfont, ch, bitmap, &width,
+			&height, &base);
+
+		/* note: change to bitmap*/
+		GdBitmap(psd, x, y, width, height, bitmap);
+		x += width;
+	}
+
+	if (pfont->fontattr & MWTF_UNDERLINE)
+		GdLine(psd, startx, starty, x, starty, FALSE);
+
+	GdFixCursor(psd);
+}
+
+#if HAVE_T1LIB_SUPPORT | HAVE_FREETYPE_SUPPORT
+/*
+ * Produce blend table from src and dst based on passed alpha table
+ * Used because we don't quite yet have GdArea with alphablending,
+ * so we pre-blend fg/bg colors for fade effect.
+ */
+static void
+alphablend(PSD psd, OUTPIXELVAL *out, MWPIXELVAL src, MWPIXELVAL dst,
+	unsigned char *alpha, int count)
+{
+	unsigned int	a, d;
+	unsigned char	r, g, b;
+	MWCOLORVAL	palsrc, paldst;
+	extern MWPALENTRY gr_palette[256];
+
+	while (--count >= 0) {
+	    a = *alpha++;
+
+#define BITS(pixel,shift,mask)	(((pixel)>>shift)&(mask))
+	    if(a == 0)
+		*out++ = dst;
+	    else if(a == 255)
+		*out++ = src;
+	    else 
+		switch(psd->pixtype) {
+	        case MWPF_TRUECOLOR0888:
+	        case MWPF_TRUECOLOR888:
+		    d = BITS(dst, 16, 0xff);
+		    r = (unsigned char)(((BITS(src, 16, 0xff) - d)*a)>>8) + d;
+		    d = BITS(dst, 8, 0xff);
+		    g = (unsigned char)(((BITS(src, 8, 0xff) - d)*a)>>8) + d;
+		    d = BITS(dst, 0, 0xff);
+		    b = (unsigned char)(((BITS(src, 0, 0xff) - d)*a)>>8) + d;
+		    *out++ = (r << 16) | (g << 8) | b;
+		    break;
+
+	        case MWPF_TRUECOLOR565:
+		    d = BITS(dst, 11, 0x1f);
+		    r = (unsigned char)(((BITS(src, 11, 0x1f) - d)*a)>>8) + d;
+		    d = BITS(dst, 5, 0x3f);
+		    g = (unsigned char)(((BITS(src, 5, 0x3f) - d)*a)>>8) + d;
+		    d = BITS(dst, 0, 0x1f);
+		    b = (unsigned char)(((BITS(src, 0, 0x1f) - d)*a)>>8) + d;
+		    *out++ = (r << 11) | (g << 5) | b;
+		    break;
+
+	        case MWPF_TRUECOLOR555:
+		    d = BITS(dst, 10, 0x1f);
+		    r = (unsigned char)(((BITS(src, 10, 0x1f) - d)*a)>>8) + d;
+		    d = BITS(dst, 5, 0x1f);
+		    g = (unsigned char)(((BITS(src, 5, 0x1f) - d)*a)>>8) + d;
+		    d = BITS(dst, 0, 0x1f);
+		    b = (unsigned char)(((BITS(src, 0, 0x1f) - d)*a)>>8) + d;
+		    *out++ = (r << 10) | (g << 5) | b;
+		    break;
+
+	        case MWPF_TRUECOLOR332:
+		    d = BITS(dst, 5, 0x07);
+		    r = (unsigned char)(((BITS(src, 5, 0x07) - d)*a)>>8) + d;
+		    d = BITS(dst, 2, 0x07);
+		    g = (unsigned char)(((BITS(src, 2, 0x07) - d)*a)>>8) + d;
+		    d = BITS(dst, 0, 0x03);
+		    b = (unsigned char)(((BITS(src, 0, 0x03) - d)*a)>>8) + d;
+		    *out++ = (r << 5) | (g << 2) | b;
+		    break;
+
+	        case MWPF_PALETTE:
+		    /* reverse lookup palette entry for blend ;-)*/
+		    palsrc = GETPALENTRY(gr_palette, src);
+		    paldst = GETPALENTRY(gr_palette, dst);
+		    d = REDVALUE(paldst);
+		    r = (unsigned char)(((REDVALUE(palsrc) - d)*a)>>8) + d;
+		    d = GREENVALUE(paldst);
+		    g = (unsigned char)(((GREENVALUE(palsrc) - d)*a)>>8) + d;
+		    d = BLUEVALUE(paldst);
+		    b = (unsigned char)(((BLUEVALUE(palsrc) - d)*a)>>8) + d;
+		    *out++ = GdFindNearestColor(gr_palette, (int)psd->ncolors,
+				MWRGB(r, g, b));
+		    break;
+	  	}
+	}
+}
+#endif /*HAVE_T1LIB_SUPPORT | HAVE_FREETYPE_SUPPORT*/
+
+#if HAVE_T1LIB_SUPPORT
+/* contributed by Vidar Hokstad*/
+
+static int
+t1lib_init(PSD psd)
+{
+	static int inited = 0;
+
+	if (inited)
+		return 1;
+
+	T1_SetBitmapPad(8);
+	if (!T1_InitLib(0))
+		return 0;
+#ifdef T1LIB_USE_AA_HIGH	 
+	T1_AASetLevel(T1_AA_HIGH);
+#else
+	T1_AASetLevel(T1_AA_LOW);
+#endif	 
+#if 0
+	/* kluge: this is required if 16bpp drawarea driver is used*/
+	if(psd->bpp == 16)
+		T1_AASetBitsPerPixel(16);
+	else
+#endif
+		T1_AASetBitsPerPixel(sizeof(MWPIXELVAL)*8);
+
+	inited = 1;
+	return 1;
+}
+
+static PMWT1LIBFONT
+t1lib_createfont(const char *name, MWCOORD height, int attr)
+{
+	PMWT1LIBFONT	pf;
+	int		id;
+	char *		p;
+	char		buf[256];
+
+	/* match name against t1 font id's from t1 font database*/
+	for(id=0; id<T1_Get_no_fonts(); ++id) {
+		strncpy(buf, T1_GetFontFileName(id), sizeof(buf));
+
+		/* remove extension*/
+		for(p=buf; *p; ++p) {
+			if(*p == '.') {
+				*p = 0;
+				break;
+			}
+		}
+
+		if(!strcmpi(name, buf)) {
+			/* allocate font structure*/
+			pf = (PMWT1LIBFONT)calloc(sizeof(MWT1LIBFONT), 1);
+			if (!pf)
+				return NULL;
+			pf->fontprocs = &t1lib_procs;
+			GdSetFontSize((PMWFONT)pf, height);
+			GdSetFontRotation((PMWFONT)pf, 0);
+			GdSetFontAttr((PMWFONT)pf, attr, 0);
+			pf->fontid = id;
+			return pf;
+		}
+	}
+	return NULL;
+}
+
+/*
+ * Draw ascii text string using T1LIB type font
+ */
+static void
+t1lib_drawtext(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+	const void *text, int cc, int flags)
+{
+	PMWT1LIBFONT	pf = (PMWT1LIBFONT)pfont;
+	const unsigned char *str = text;
+   	MWCOORD		width;			/* width of text area */
+	MWCOORD 	height;			/* height of text area */
+	MWCOORD		underliney;
+        GLYPH * g; /* T1lib glyph structure. Memory handling by T1lib */
+#ifdef T1LIB_USE_AA_HIGH   
+        OUTPIXELVAL	gvals[17];
+
+        /* Blending array for antialiasing. The steeper the values increase
+	 * near the end, the sharper the characters look, but also more jagged
+	 */
+        static unsigned char blend[17] = {
+	   0x00, 0x00, 0x04, 0x0c, 0x10, 0x14, 0x18, 0x20,
+	   0x30, 0x38, 0x40, 0x50, 0x70, 0x80, 0xa0, 0xc0, 0xff
+	};
+#else   
+        OUTPIXELVAL	gvals[5];
+        static unsigned char blend[5] = { 0x00, 0x44, 0x88, 0xcc, 0xff };
+#endif   
+
+        /* Check if we should throw out some fonts */
+
+        if (pf->fontattr&MWTF_ANTIALIAS) {
+#ifdef T1LIB_USE_AA_HIGH      
+	   alphablend(psd, gvals, gr_foreground, gr_background, blend, 17);
+           T1_AAHSetGrayValues(gvals);
+#else      
+	   alphablend(psd, gvals, gr_foreground, gr_background, blend, 5);
+           T1_AASetGrayValues(gvals[0],gvals[1],gvals[2],gvals[3],gvals[4]);
+#endif
+	   g = T1_AASetString(pf->fontid,(char *)str,cc,0,
+		(pf->fontattr&MWTF_KERNING)? T1_KERNING: 0,
+		pf->fontsize * 1.0, 0);
+
+	   if (g && g->bits) {
+	      /*MWPIXELVAL save = gr_background;*/
+	      width = g->metrics.rightSideBearing - g->metrics.leftSideBearing;
+	      height = g->metrics.ascent - g->metrics.descent;
+
+	      if(flags & MWTF_BASELINE)
+		y -= g->metrics.ascent;
+	      else if(flags & MWTF_BOTTOM)
+		y -= (height - 1);
+	      underliney = y + g->metrics.ascent;
+
+	      /* FIXME: Looks damn ugly if usebg is false.
+	       * Will be handled when using alphablending in GdArea...
+	       */
+	      /* clipping handled in GdArea*/
+	      /*FIXME kluge for transparency*/
+	      /*gr_background = gr_foreground + 1;*/
+	      /*gr_usebg = 0;*/
+	      GdArea(psd,x,y, width, height, g->bits, MWPF_PIXELVAL);
+	      /*gr_background = save;*/
+
+	      if (pf->fontattr & MWTF_UNDERLINE)
+		   GdLine(psd, x, underliney, x+width, underliney, FALSE);
+
+	   }
+	} else {
+	   /* Do non-aa drawing */
+	   g = T1_SetString(pf->fontid,(char *)str,cc,0,
+			(pf->fontattr&MWTF_KERNING)? T1_KERNING: 0,
+			pf->fontsize * 1.0, 0);
+
+	   if (g && g->bits) {
+	      unsigned char * b;
+	      int xoff;
+	      int maxy;
+	      int xmod;
+	      
+	      /* I'm sure this sorry excuse for a bitmap rendering routine can
+	       * be optimized quite a bit ;)
+	       */
+	      width = g->metrics.rightSideBearing - g->metrics.leftSideBearing;
+	      height = g->metrics.ascent - g->metrics.descent;
+
+	      if(flags & MWTF_BASELINE)
+		y -= g->metrics.ascent;
+	      else if(flags & MWTF_BOTTOM)
+		y -= (height - 1);
+	      underliney = y + g->metrics.ascent;
+	      
+	      b = g->bits;
+	      maxy = y + height;
+	      
+/*	      if ((x + width) > psd->xvirtres) {
+		 xmod = (x + width - psd->xvirtres + 7) >> 3;
+		 width = width + x + width - psd->xvirtres;
+	      } else xmod = 0;
+*/
+	      xmod = 0;
+	      while (y < maxy) {
+		 unsigned char data;
+		 xoff = 0;
+		 while (xoff < width ) {
+		    if (!(xoff % 8)) {
+		       data = *b;
+		       b++;
+		    }
+		    
+		    if (GdClipPoint(psd, x+xoff,y)) {
+		       if (gr_usebg) {
+	 		  psd->DrawPixel(psd,x+xoff,y,
+			      data & (1 << (xoff % 8)) ?
+			            gr_foreground : gr_background);
+		       } else if (data & (1 << (xoff % 8))) {
+			  psd->DrawPixel(psd,x+xoff,y, gr_foreground);
+		       }
+		    }
+		    xoff++;
+		 }
+		 b += xmod;
+		 y++;
+	      }
+	      if (pf->fontattr & MWTF_UNDERLINE)
+		   GdLine(psd, x, underliney, x+xoff, underliney, FALSE);
+	   }
+        }
+
+   if (g && g->bits) {
+	   /* Save some memory */
+	   free(g->bits);
+           g->bits = 0; /* Make sure T1lib doesnt try to free it again */
+   }
+
+   GdFixCursor(psd);
+}
+
+static MWBOOL
+t1lib_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo)
+{
+	int	i;
+	MWCOORD	width, height, baseline;
+
+	/* FIXME, guess all sizes*/
+	GdGetTextSize(pfont, "A", 1, &width, &height, &baseline, MWTF_ASCII);
+	pfontinfo->height = height;
+	pfontinfo->maxwidth = width;
+	pfontinfo->baseline = 0;
+	pfontinfo->firstchar = 32;
+	pfontinfo->lastchar = 255;
+	pfontinfo->fixed = TRUE;
+	for(i=0; i<256; ++i)
+		pfontinfo->widths[i] = width;
+	return TRUE;
+}
+
+/* Get the width and height of passed text string in the current font*/
+static void
+t1lib_gettextsize(PMWFONT pfont, const void *text, int cc,
+	MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase)
+{
+	PMWT1LIBFONT		pf = (PMWT1LIBFONT)pfont;
+	const unsigned char *	str = text;
+	GLYPH *			g;
+
+	g = T1_SetString(pf->fontid, (char *)str, cc, 0,
+			(pf->fontattr&MWTF_KERNING)? T1_KERNING: 0, pf->fontsize * 1.0, 0);
+	*pwidth = g->metrics.rightSideBearing - g->metrics.leftSideBearing;
+	*pheight = g->metrics.ascent - g->metrics.descent;
+	if(g && g->bits) {
+		free(g->bits);
+		g->bits = 0;
+	}
+#if 0
+	BBox 			b;
+
+	/* FIXME. Something is *VERY* wrong here */
+	b = T1_GetStringBBox(pf->fontid, str, cc, 0, (pf->fontattr&MWTF_KERNING)?T1_KERNING:0);
+
+	DPRINTF("b.urx = %d, b.llx = %d\n",b.urx, b.llx);
+	DPRINTF("b.ury = %d, b.lly = %d\n",b.ury, b.lly);
+	*pwidth = (b.urx - b.llx);
+	*pheight = (b.lly - b.ury);
+#endif
+}
+
+static void
+t1lib_destroyfont(PMWFONT pfont)
+{
+	PMWT1LIBFONT	pf = (PMWT1LIBFONT)pfont;
+
+	T1_DeleteAllSizes(pf->fontid);
+	free(pf);
+}
+
+#endif /* HAVE_T1LIB_SUPPORT*/
+
+#if HAVE_FREETYPE_SUPPORT
+static OUTPIXELVAL gray_palette[5];
+
+static int
+freetype_init(PSD psd)
+{
+	static int inited = 0;
+
+	if (inited)
+		return 1;
+	
+	/* Init freetype library */
+	if (TT_Init_FreeType (&engine) != TT_Err_Ok) {
+		return 0;
+	}
+
+	/* Init kerning extension */
+	if (TT_Init_Kerning_Extension (engine) != TT_Err_Ok)
+		return 0;
+
+	inited = 1;
+	return 1;
+}
+
+static PMWFREETYPEFONT
+freetype_createfont(const char *name, MWCOORD height, int attr)
+{
+	PMWFREETYPEFONT 	pf;
+	unsigned short 		i, n;
+	unsigned short 		platform, encoding;
+	TT_Face_Properties 	properties;
+	char *			p;
+	char			fontname[128];
+
+	/* check for pathname prefix*/
+	if (strchr(name, '/') != NULL)
+		strcpy(fontname, name);
+	else {
+		strcpy(fontname, FREETYPE_FONT_DIR);
+		strcat(fontname, "/");
+		strcat(fontname, name);
+	}
+
+	/* check for extension*/
+	if ((p = strrchr(fontname, '.')) == NULL ||
+	    strcmp(p, ".ttf") != 0) {
+		strcat(fontname, ".ttf");
+	}
+
+	/* allocate font structure*/
+	pf = (PMWFREETYPEFONT)calloc(sizeof(MWFREETYPEFONT), 1);
+	if (!pf)
+		return NULL;
+	pf->fontprocs = &freetype_procs;
+
+	/* Load face */
+	if (TT_Open_Face (engine, fontname, &pf->face) != TT_Err_Ok)
+		goto out;
+
+	/* Load first kerning table */
+	pf->can_kern = TRUE;
+	if (TT_Load_Kerning_Table (pf->face, 0) != TT_Err_Ok)
+		pf->can_kern = FALSE;
+	else {
+		if (TT_Get_Kerning_Directory (pf->face, &pf->directory)
+		    != TT_Err_Ok)
+			pf->can_kern = FALSE;
+		else {
+			/* Support only version 0 kerning table ... */
+			if ((pf->directory.version != 0) ||
+				(pf->directory.nTables <= 0) ||
+				(pf->directory.tables->loaded != 1) ||
+				(pf->directory.tables->version != 0) ||
+				(pf->directory.tables->t.kern0.nPairs <= 0))
+					pf->can_kern = FALSE;
+		}
+	}
+
+	/* get face properties and allocate preload arrays */
+	TT_Get_Face_Properties (pf->face, &properties);
+
+#if 0
+	/*
+	 * Use header information for ascent and descent
+	 * to compute scaled ascent/descent for current font height.
+	 */
+	h = properties.os2->sTypoAscender - properties.os2->sTypoDescender
+		+ properties.os2->sTypoLineGap;
+	ascent = properties.os2->sTypoAscender
+		+ properties.os2->sTypoLineGap/2;
+	pf->ascent = (ascent * height + h/2) / h;
+	pf->descent = height - pf->ascent;
+#endif
+	/* Create a glyph container */
+	if (TT_New_Glyph (pf->face, &pf->glyph) != TT_Err_Ok)
+		goto out;
+
+	/* create instance */
+	if (TT_New_Instance (pf->face, &pf->instance) != TT_Err_Ok)
+		goto out;
+
+	/* Set the instance resolution */
+	if (TT_Set_Instance_Resolutions (pf->instance, 96, 96) != TT_Err_Ok)
+		goto out;
+
+	/* Look for a Unicode charmap: Windows flavor of Apple flavor only */
+	n = properties.num_CharMaps;
+
+	for (i = 0; i < n; i++) {
+		TT_Get_CharMap_ID (pf->face, i, &platform, &encoding);
+		if (((platform == TT_PLATFORM_MICROSOFT) &&
+			(encoding == TT_MS_ID_UNICODE_CS)) ||
+				((platform == TT_PLATFORM_APPLE_UNICODE) &&
+			 		(encoding == TT_APPLE_ID_DEFAULT)))
+		{
+			TT_Get_CharMap (pf->face, i, &pf->char_map);
+			i = n + 1;
+		}
+	}
+	if (i == n) {
+		DPRINTF("freetype_createfont: no unicode map table\n");
+		goto out;
+	}
+	
+	GdSetFontSize((PMWFONT)pf, height);
+	GdSetFontRotation((PMWFONT)pf, 0);
+	GdSetFontAttr((PMWFONT)pf, attr, 0);
+
+	return pf;
+
+out:
+	free(pf);
+	return NULL;
+}
+
+static int
+compute_kernval(PMWFREETYPEFONT pf, short current_glyph_code)
+{
+	int 		i = 0;
+	int 		kernval;
+	int 		nPairs = pf->directory.tables->t.kern0.nPairs;
+	TT_Kern_0_Pair *pair = pf->directory.tables->t.kern0.pairs;
+
+	if (pf->last_glyph_code != -1) {
+		while ((pair->left != pf->last_glyph_code)
+			&& (pair->right != current_glyph_code))
+		{
+			pair++;
+			i++;
+			if (i == nPairs)
+			break;
+		}
+
+		if (i == nPairs)
+			kernval = 0;
+		else
+			/* We round the value (hence the +32) */
+			kernval = (pair->value + 32) & -64;
+	} else
+		kernval = 0;
+
+	return kernval;
+}
+
+static TT_UShort
+Get_Glyph_Width(PMWFREETYPEFONT pf, TT_UShort glyph_index)
+{
+	TT_Glyph_Metrics metrics;
+	
+    	if (TT_Load_Glyph ( pf->instance, pf->glyph,
+		TT_Char_Index (pf->char_map,glyph_index),
+		TTLOAD_SCALE_GLYPH|TTLOAD_HINT_GLYPH) != TT_Err_Ok)
+    	{
+		/* Try to load default glyph: index 0 */
+		if (TT_Load_Glyph ( pf->instance, pf->glyph, 0,
+			TTLOAD_SCALE_GLYPH|TTLOAD_HINT_GLYPH) != TT_Err_Ok)
+		    return 0;
+	}
+
+	TT_Get_Glyph_Metrics (pf->glyph, &metrics);
+	return((metrics.advance & 0xFFFFFFC0) >> 6);
+}
+
+/* Render a single glyph*/
+static void
+drawchar(PMWFREETYPEFONT pf, PSD psd, TT_Glyph glyph, int x_offset,
+	int y_offset)
+{
+	TT_F26Dot6 	xmin, ymin, xmax, ymax, x, y, z;
+	unsigned char 	*src, *srcptr;
+	MWPIXELVAL 	*dst, *dstptr;
+	MWPIXELVAL 	*bitmap;
+	int 		size, width, height;
+	TT_Outline 	outline;
+	TT_BBox 	bbox;
+	TT_Raster_Map 	Raster;
+	TT_Error 	error;
+	/*MWPIXELVAL 	save;*/
+
+	/* we begin by grid-fitting the bounding box */
+	TT_Get_Glyph_Outline (pf->glyph, &outline);
+	TT_Get_Outline_BBox (&outline, &bbox);
+
+	xmin = (bbox.xMin & -64) >> 6;
+	ymin = (bbox.yMin & -64) >> 6;
+	xmax = ((bbox.xMax + 63) & -64) >> 6;
+	ymax = ((bbox.yMax + 63) & -64) >> 6;
+	width = xmax - xmin;
+	height = ymax - ymin;
+	size = width * height;
+
+	/* now re-allocate the raster bitmap */
+	Raster.rows = height;
+	Raster.width = width;
+
+	if (pf->fontattr&MWTF_ANTIALIAS)
+		Raster.cols = (Raster.width + 3) & -4;	/* pad to 32-bits */
+	else
+		Raster.cols = (Raster.width + 7) & -8;	/* pad to 64-bits ??? */
+
+	Raster.flow = TT_Flow_Up;
+	Raster.size = Raster.rows * Raster.cols;
+	Raster.bitmap = malloc (Raster.size);
+
+	memset (Raster.bitmap, 0, Raster.size);
+
+	/* now render the glyph in the small pixmap */
+
+	/* IMPORTANT NOTE: the offset parameters passed to the function     */
+	/* TT_Get_Glyph_Bitmap() must be integer pixel values, i.e.,        */
+	/* multiples of 64.  HINTING WILL BE RUINED IF THIS ISN'T THE CASE! */
+	/* This is why we _did_ grid-fit the bounding box, especially xmin  */
+	/* and ymin.                                                        */
+
+	if (!(pf->fontattr&MWTF_ANTIALIAS))
+		error = TT_Get_Glyph_Bitmap (pf->glyph, &Raster,
+				-xmin * 64, -ymin * 64);
+	else
+		error = TT_Get_Glyph_Pixmap (pf->glyph, &Raster,
+				-xmin * 64, -ymin * 64);
+
+	if (error) {
+		free (Raster.bitmap);
+		return;
+	}
+
+	bitmap = malloc (size * sizeof (MWPIXELVAL));
+	memset (bitmap, 0, size * sizeof (MWPIXELVAL));
+
+	src = (char *) Raster.bitmap;
+	dst = bitmap + (size - width);
+
+	for (y = ymin; y < ymax; y++) {
+		srcptr = src;
+		dstptr = dst;
+
+		for (x = xmin; x < xmax; x++) {
+			if (pf->fontattr&MWTF_ANTIALIAS)
+				*dstptr++ = gray_palette[(int) *srcptr];
+			else {
+				for(z=0;
+				    z <= ((xmax-x-1) < 7 ? (xmax-x-1) : 7);
+				    z++) {
+					*dstptr++ = ((*srcptr << z) & 0x80)?
+						gr_foreground: gr_background;
+				}
+				x += 7;
+			}
+
+			srcptr++;
+		}
+
+		src += Raster.cols;
+		dst -= width;
+	}
+
+	/* FIXME - must clear background upstairs if not gr_usebg*/
+	/* FIXME: GdArea problem if fg == bg*/
+	/*save = gr_background;*/
+	/*gr_background = gr_foreground + 1;*/
+
+	/* Now draw the bitmap ... */
+	GdArea(psd, x_offset + xmin, y_offset - (ymin + height), width, height,
+		bitmap, MWPF_PIXELVAL);
+
+	/*gr_background = save;*/
+
+	free (bitmap);
+	free (Raster.bitmap);
+}
+
+/*
+ * Draw unicode 16 text string using FREETYPE type font
+ */
+static void
+freetype_drawtext(PMWFONT pfont, PSD psd, MWCOORD ax, MWCOORD ay,
+	const void *text, int cc, int flags)
+{
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	const unsigned short *	str = text;
+	TT_F26Dot6 	x = ax, y = ay;
+	TT_Pos 		vec_x, vec_y;
+	int 		i;
+	TT_F26Dot6	startx, starty;
+	TT_Outline 	outline;
+	TT_UShort 	curchar;
+	TT_Glyph_Metrics metrics;
+	TT_Face_Properties properties;
+	TT_Instance_Metrics imetrics;
+	TT_F26Dot6 ascent, descent;
+	static unsigned char blend[5] = { 0x00, 0x44, 0x88, 0xcc, 0xff };
+	static unsigned char virtual_palette[5] = { 0, 1, 2, 3, 4 };
+
+	pf->last_glyph_code = -1;		/* reset kerning*/
+	pf->last_pen_pos = -32767;
+
+	/* 
+	 * Compute instance ascent & descent values
+	 * in fractional units (1/64th pixel)
+	 */
+	TT_Get_Face_Properties (pf->face, &properties);
+	TT_Get_Instance_Metrics(pf->instance, &imetrics);	
+  
+	ascent = ((properties.horizontal->Ascender * imetrics.y_scale)/0x10000);
+	descent = ((properties.horizontal->Descender*imetrics.y_scale)/0x10000);
+
+	/* 
+	 * Offset the starting point if necessary,
+	 * FreeType always aligns at baseline
+	 */
+	if (flags&MWTF_BOTTOM) {
+		vec_x = 0;
+		vec_y = descent;
+		TT_Transform_Vector(&vec_x, &vec_y,&pf->matrix);
+		x -= vec_x / 64;
+		y += vec_y / 64;
+	} else if (flags&MWTF_TOP) {
+		vec_x = 0;
+		vec_y = ascent;
+		TT_Transform_Vector(&vec_x, &vec_y,&pf->matrix);
+		x -= vec_x / 64;
+		y += vec_y / 64;
+	}
+
+	/* Set the "graylevels" */
+	if (pf->fontattr&MWTF_ANTIALIAS) {
+		TT_Set_Raster_Gray_Palette (engine, virtual_palette);
+
+		alphablend(psd, gray_palette, gr_foreground, gr_background,
+			blend, 5);
+	}
+
+	startx = x;
+	starty = y;
+	for (i = 0; i < cc; i++) {
+		curchar = TT_Char_Index (pf->char_map, str[i]);
+
+		if (TT_Load_Glyph (pf->instance, pf->glyph, curchar,
+			TTLOAD_DEFAULT) != TT_Err_Ok)
+				continue;
+
+		if (pf->fontrotation) {
+			TT_Get_Glyph_Outline (pf->glyph, &outline);
+			TT_Transform_Outline (&outline, &pf->matrix);
+		}
+
+		TT_Get_Glyph_Metrics (pf->glyph, &metrics);
+
+		if ((pf->fontattr&MWTF_KERNING) && pf->can_kern) {
+			if (pf->fontrotation) {
+				vec_x = compute_kernval(pf, curchar);
+				vec_y = 0;
+				TT_Transform_Vector(&vec_x, &vec_y,&pf->matrix);
+
+				x += vec_x / 64;
+				y -= vec_y / 64;
+			} else
+				x += compute_kernval(pf, curchar) / 64;
+		}
+			
+		drawchar(pf, psd, pf->glyph, x, y);
+
+		if (pf->fontrotation) {
+			vec_x = metrics.advance;
+			vec_y = 0;
+			TT_Transform_Vector (&vec_x, &vec_y, &pf->matrix);
+
+			x += vec_x / 64;
+			y -= vec_y / 64;
+		} else {
+			x += metrics.advance / 64;
+
+			/* Kerning point syndrome avoidance */
+			if (pf->last_pen_pos > x)
+				x = pf->last_pen_pos;
+			pf->last_pen_pos = x;
+		}
+
+		pf->last_glyph_code = curchar;
+	}
+
+	if (pf->fontattr & MWTF_UNDERLINE)
+		GdLine(psd, startx, starty, x, y, FALSE);
+}
+
+/*
+ * Return information about a specified font.
+ */
+static MWBOOL
+freetype_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo)
+{
+	int	i;
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	TT_Face_Properties 	properties;
+    TT_Instance_Metrics imetrics;
+    TT_UShort last_glyph_index;
+
+	TT_Get_Face_Properties (pf->face, &properties);
+    TT_Get_Instance_Metrics(pf->instance, &imetrics);
+
+    /* Fill up the fields */
+	pfontinfo->height = (((properties.horizontal->Ascender * \
+	                        imetrics.y_scale)/ 0x10000) >> 6) -
+	                    (((properties.horizontal->Descender * \
+	                        imetrics.y_scale)/ 0x10000) >> 6);
+	pfontinfo->maxwidth = ((properties.horizontal->xMax_Extent * \
+	                        imetrics.x_scale)/ 0x10000) >> 6;
+	pfontinfo->baseline = ((properties.horizontal->Ascender * \
+	                        imetrics.y_scale)/ 0x10000) >> 6;
+	pfontinfo->firstchar = TT_CharMap_First(pf->char_map, NULL);
+	pfontinfo->lastchar = TT_CharMap_Last(pf->char_map, NULL);
+	pfontinfo->fixed = properties.postscript->isFixedPitch;
+		
+    last_glyph_index = properties.num_Glyphs > 255 ? 255: properties.num_Glyphs-1;
+
+    /* Doesn't work ... don't know why ....*/
+#if 0
+    if (TT_Get_Face_Widths( pf->face, 0,
+                            last_glyph_index, widths, NULL ) != TT_Err_Ok) {
+        return TRUE;
+    }
+
+    for(i=0; i<=last_glyph_index; i++)
+		DPRINTF("widths[%d]: %d\n", i, widths[i]);
+#endif
+
+    /* Get glyphs widths */
+	for(i=0; i<=last_glyph_index; i++)
+		pfontinfo->widths[i] = Get_Glyph_Width(pf, i);
+
+#if 0
+    DPRINTF("x_ppem: %d\ny_ppem: %d\nx_scale: %d\ny_scale: %d\n\
+    x_resolution: %d\ny_resolution: %d\n",
+    imetrics.x_ppem, imetrics.y_ppem, imetrics.x_scale, \
+    imetrics.y_scale, imetrics.x_resolution, imetrics.y_resolution);
+
+    DPRINTF("Ascender: %d\nDescender: %d\nxMax_Extent: %d\n\
+    Mac Style Say Italic?: %d\nMac Style Say Bold?: %d\n\
+    sTypoAscender: %d\nsTypoDescender: %d\nusWinAscent: %d\n\
+    usWinDescent: %d\nusFirstCharIndex: %d\nusLastCharIndex: %d\n\
+    OS2 Say Italic?: %d\nOS2 Say Bold?: %d\nOS2 Say monospaced?: %d\n\
+    Postscript Say monospaced?: %d\n",\
+    properties.horizontal->Ascender,
+    properties.horizontal->Descender,
+    properties.horizontal->xMax_Extent,
+    (properties.header->Mac_Style & 0x2)?1:0,
+    (properties.header->Mac_Style & 0x1)?1:0,
+    properties.os2->sTypoAscender,
+    properties.os2->sTypoDescender,
+    properties.os2->usWinAscent,
+    properties.os2->usWinDescent,
+    properties.os2->usFirstCharIndex,
+    properties.os2->usLastCharIndex,
+    (properties.os2->fsSelection & 0x1)?1:0,
+    (properties.os2->fsSelection & 0x20)?1:0,
+    properties.postscript->isFixedPitch,
+    (properties.os2->panose[3] == 9)?1:0);
+#endif	
+			
+	return TRUE;
+}
+
+static void
+freetype_gettextsize(PMWFONT pfont, const void *text, int cc,
+	MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase)
+{
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	const unsigned short *	str = text;
+	TT_F26Dot6 	x = 0;
+	int 		i;
+	TT_UShort 	curchar;
+	TT_Glyph_Metrics metrics;
+	TT_Face_Properties 	properties;
+	TT_Instance_Metrics imetrics;
+
+	TT_Get_Face_Properties (pf->face, &properties);
+	TT_Get_Instance_Metrics(pf->instance, &imetrics);
+	
+	pf->last_glyph_code = -1;		/* reset kerning*/
+	pf->last_pen_pos = -32767;
+	
+	for (i = 0; i < cc; i++) {
+		curchar = TT_Char_Index (pf->char_map, str[i]);
+
+		if (TT_Load_Glyph (pf->instance, pf->glyph, curchar,
+			TTLOAD_SCALE_GLYPH|TTLOAD_HINT_GLYPH) != TT_Err_Ok)
+				continue;
+
+		TT_Get_Glyph_Metrics (pf->glyph, &metrics);
+
+		if ((pf->fontattr&MWTF_KERNING) && pf->can_kern) {
+				x += compute_kernval(pf, curchar) / 64;
+		}
+		
+		x += metrics.advance / 64;
+
+		/* Kerning point syndrome avoidance */
+		if (pf->last_pen_pos > x)
+			x = pf->last_pen_pos;
+		pf->last_pen_pos = x;
+
+		pf->last_glyph_code = curchar;
+	}
+
+	*pwidth = x;
+	*pheight =  (((properties.horizontal->Ascender * 
+	                imetrics.y_scale)/ 0x10000) >> 6) -
+	            (((properties.horizontal->Descender * 
+	            imetrics.y_scale)/ 0x10000) >> 6);
+    	/* FIXME: is it what's required ?? */
+	*pbase = (((-properties.horizontal->Descender) * 
+	            imetrics.y_scale)/ 0x10000) >> 6;
+}
+
+static void
+freetype_destroyfont(PMWFONT pfont)
+{
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+
+	TT_Close_Face(pf->face);
+	free(pf);
+}
+
+static void
+freetype_setfontsize(PMWFONT pfont, MWCOORD fontsize)
+{
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	
+	pf->fontsize = fontsize;
+	
+	/* We want real pixel sizes ... not points ...*/
+	TT_Set_Instance_PixelSizes( pf->instance, pf->fontsize,
+                                pf->fontsize, pf->fontsize * 64 );
+#if 0
+	/* set charsize (convert to points for freetype)*/
+	TT_Set_Instance_CharSize (pf->instance,
+		((pf->fontsize * 72 + 96/2) / 96) * 64);
+#endif
+}
+
+static void
+freetype_setfontrotation(PMWFONT pfont, int tenthdegrees)
+{
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	float 		angle;
+	
+	pf->fontrotation = tenthdegrees;
+
+	/* Build the rotation matrix with the given angle */
+	TT_Set_Instance_Transform_Flags (pf->instance, TRUE, FALSE);
+
+	angle = pf->fontrotation * M_PI / 1800;
+	pf->matrix.yy = (TT_Fixed) (cos (angle) * (1 << 16));
+	pf->matrix.yx = (TT_Fixed) (sin (angle) * (1 << 16));
+	pf->matrix.xx = pf->matrix.yy;
+	pf->matrix.xy = -pf->matrix.yx;
+}
+
+#endif /* HAVE_FREETYPE_SUPPORT*/
+
+/* UTF-8 to UTF-16 conversion.  Surrogates are handeled properly, e.g.
+ * a single 4-byte UTF-8 character is encoded into a surrogate pair.
+ * On the other hand, if the UTF-8 string contains surrogate values, this
+ * is considered an error and returned as such.
+ *
+ * The destination array must be able to hold as many Unicode-16 characters
+ * as there are ASCII characters in the UTF-8 string.  This in case all UTF-8
+ * characters are ASCII characters.  No more will be needed.
+ *
+ * Copyright (c) 2000 Morten Rolland, Screen Media
+ */
+static int
+utf8_to_utf16(const unsigned char *utf8, int cc, unsigned short *unicode16)
+{
+	int count = 0;
+	unsigned char c0, c1;
+	unsigned long scalar;
+
+	while(--cc >= 0) {
+		c0 = *utf8++;
+		/*DPRINTF("Trying: %02x\n",c0);*/
+
+		if ( c0 < 0x80 ) {
+			/* Plain ASCII character, simple translation :-) */
+			*unicode16++ = c0;
+			count++;
+			continue;
+		}
+
+		if ( (c0 & 0xc0) == 0x80 )
+			/* Illegal; starts with 10xxxxxx */
+			return -1;
+
+		/* c0 must be 11xxxxxx if we get here => at least 2 bytes */
+		scalar = c0;
+		if(--cc < 0)
+			return -1;
+		c1 = *utf8++;
+		/*DPRINTF("c1=%02x\n",c1);*/
+		if ( (c1 & 0xc0) != 0x80 )
+			/* Bad byte */
+			return -1;
+		scalar <<= 6;
+		scalar |= (c1 & 0x3f);
+
+		if ( !(c0 & 0x20) ) {
+			/* Two bytes UTF-8 */
+			if ( scalar < 0x80 )
+				return -1;	/* Overlong encoding */
+			*unicode16++ = scalar & 0x7ff;
+			count++;
+			continue;
+		}
+
+		/* c0 must be 111xxxxx if we get here => at least 3 bytes */
+		if(--cc < 0)
+			return -1;
+		c1 = *utf8++;
+		/*DPRINTF("c1=%02x\n",c1);*/
+		if ( (c1 & 0xc0) != 0x80 )
+			/* Bad byte */
+			return -1;
+		scalar <<= 6;
+		scalar |= (c1 & 0x3f);
+
+		if ( !(c0 & 0x10) ) {
+			/*DPRINTF("####\n");*/
+			/* Three bytes UTF-8 */
+			if ( scalar < 0x800 )
+				return -1;	/* Overlong encoding */
+			if ( scalar >= 0xd800 && scalar < 0xe000 )
+				return -1;	/* UTF-16 high/low halfs */
+			*unicode16++ = scalar & 0xffff;
+			count++;
+			continue;
+		}
+
+		/* c0 must be 1111xxxx if we get here => at least 4 bytes */
+		c1 = *utf8++;
+		if(--cc < 0)
+			return -1;
+		/*DPRINTF("c1=%02x\n",c1);*/
+		if ( (c1 & 0xc0) != 0x80 )
+			/* Bad byte */
+			return -1;
+		scalar <<= 6;
+		scalar |= (c1 & 0x3f);
+
+		if ( !(c0 & 0x08) ) {
+			/* Four bytes UTF-8, needs encoding as surrogates */
+			if ( scalar < 0x10000 )
+				return -1;	/* Overlong encoding */
+			scalar -= 0x10000;
+			*unicode16++ = ((scalar >> 10) & 0x3ff) + 0xd800;
+			*unicode16++ = (scalar & 0x3ff) + 0xdc00;
+			count += 2;
+			continue;
+		}
+
+		return -1;	/* No support for more than four byte UTF-8 */
+	}
+	return count;
+}
+
+#if HAVE_HZK_SUPPORT
+
+/* UniCode-16 (MWTF_UC16) to GB(MWTF_ASCII) Chinese Characters conversion.
+ * a single 2-byte UC16 character is encoded into a surrogate pair.
+ * return -1 ,if error;
+ * The destination array must be able to hold as many
+ * as there are Unicode-16 characters.
+ *
+ * Copyright (c) 2000 Tang Hao (TownHall)(tang_hao@263.net).
+ */
+static int
+UC16_to_GB(const unsigned char *uc16, int cc, unsigned char *ascii)
+{
+	FILE* fp;
+	char buffer[256];
+	unsigned char *uc16p;
+	int i=0,j=0, k;
+	unsigned char *filebuffer;
+	unsigned short *uc16pp,*table;
+	unsigned short uc16px;
+	int length=31504;
+
+	if (use_big5)
+		length=54840;
+
+    	uc16p=(unsigned char *) uc16;
+	uc16pp=(unsigned short *) uc16;
+
+	strcpy(buffer,HZK_FONT_DIR);
+	if (use_big5)
+    		strcat(buffer,"/BG2UBG.KU");
+	else
+    		strcat(buffer,"/UGB2GB.KU");
+	if(!(fp = fopen(buffer, "rb"))) 
+	{
+   	  	 fprintf (stderr, "Error.\nThe %s file can not be found!\n",buffer);
+   		 return -1;
+    	}
+
+	filebuffer= (unsigned char *)malloc ( length);
+
+	if(fread(filebuffer, sizeof(char),length, fp) < length) {
+	   	  fprintf (stderr, "Error in reading ugb2gb.ku file!\n");
+	   	  fclose(fp);
+ 	     	  return -1;
+	}
+    	fclose(fp);
+
+	if (use_big5)
+	{
+		table=(unsigned short *)filebuffer;
+		while(1)
+		{
+			if(j>=cc)
+			{
+				ascii[i]=0;
+				break;
+			}
+			uc16px=*uc16pp;
+			if((uc16px)<=0x00ff)
+			{
+				ascii[i]=(char)(*uc16pp);
+				i++;
+			}
+			else
+			{
+				ascii[i]=0xa1; ascii[i+1]=0x40;
+				for (k=0; k<13710; k++)
+				{
+					if (*(table+(k*2+1))==(uc16px))
+					{
+						ascii[i]=(char)((*(table+(k*2)) & 0xff00) >> 8);
+						ascii[i+1]=(char)(*(table+(k*2)) & 0x00ff);
+						break;
+					}
+				}
+				i+=2;
+			}
+			uc16pp++; j++;
+		}
+	}
+	else
+	{
+	while(1)
+	{
+		if(j>=cc)
+		{
+			ascii[i]=0;
+			break;
+		}
+		if((*((uc16p)+j)==0)&&(*((uc16p)+j+1)==0))
+		{
+			ascii[i]=0;
+			break;
+		}
+		else
+		{
+			if(*((uc16p)+j+1)==0)
+			{
+				ascii[i]=*((uc16p)+j);
+				i++;
+				j+=2;
+			}
+			else
+			{
+			//*	 to find the place of unicode charater .���ַ�ƥ��
+            		{
+				int p1=0,p2=length-4,p;
+				unsigned int c1,c2,c,d;
+				c1=((unsigned int )filebuffer[p1])*0x100+(filebuffer[p1+1]);
+                		c2=((unsigned int )filebuffer[p2])*0x100+(filebuffer[p2+1]);
+				d=((unsigned int )*((uc16p)+j))*0x100+*((uc16p)+j+1);
+                		if(c1==d)
+				{
+					ascii[i]=filebuffer[p1+2];
+					ascii[i+1]=filebuffer[p1+3];
+					goto findit;
+ 	            		}
+                		if(c2==d)
+				{
+					ascii[i]=filebuffer[p2+2];
+					ascii[i+1]=filebuffer[p2+3];
+					goto findit;
+                		}
+				while(1)
+				{
+					p=(((p2-p1)/2+p1)>>2)<<2;
+					c=((unsigned int )filebuffer[p])*0x100+(filebuffer[p+1]);
+					if(d==c)	//find it
+					{
+						ascii[i]=filebuffer[p+2];
+						ascii[i+1]=filebuffer[p+3];
+						break;
+          	   	   		}
+					else if(p2<=p1+4) //can't find.
+					{
+						ascii[i]='.';//*((uc16p)+j);
+						ascii[i+1]='.';//*((uc16p)+j+1);
+						break;
+					}
+					else if(d<c)
+					{
+						p2=p;
+						c2=c;										
+                  			}
+					else
+					{
+						p1=p;
+						c1=c;														
+					}
+				}
+	            	}
+			findit:
+  			i+=2;
+			j+=2;
+			}
+		}
+	}
+	}//jmt+
+	free(filebuffer);
+
+	return i;
+}
+
+/************************** functions definition ******************************/
+
+static int hzk_id( PMWHZKFONT pf )
+{
+	switch(pf->font_height)
+	{
+	case 12:
+		return 0;
+	case 16: default:
+		return 1;
+	}
+}
+
+/* This function get Chinese font info from etc file.*/
+static MWBOOL GetCFontInfo( PMWHZKFONT pf )
+{
+	int charset;
+
+	if (use_big5)
+		charset=(13094+408);
+	else
+		charset=8178;
+
+    	CFont[hzk_id(pf)].width = pf->cfont_width;
+    	pf->CFont.width = pf->cfont_width;
+
+    	CFont[hzk_id(pf)].height = pf->font_height;
+    	pf->CFont.height = pf->font_height;
+
+    	CFont[hzk_id(pf)].size = ((pf->CFont.width + 7) / 8) *
+		pf->CFont.height * charset;
+    	pf->CFont.size = ((pf->CFont.width + 7) / 8) * pf->CFont.height * charset;
+
+    	if(pf->CFont.size < charset * 8)
+        	return FALSE;
+
+	strcpy(CFont[hzk_id(pf)].file,HZK_FONT_DIR);
+	strcpy(pf->CFont.file,HZK_FONT_DIR);
+
+	if(pf->font_height==16)
+	{
+		strcat(CFont[hzk_id(pf)].file,"/hzk16");
+		strcat(pf->CFont.file,"/hzk16");
+	}
+	else
+	{
+		strcat(CFont[hzk_id(pf)].file,"/hzk12");
+		strcat(pf->CFont.file,"/hzk12");
+	}
+
+    	if (use_big5)//jmt+
+    	{
+		CFont[hzk_id(pf)].file[strlen(pf->CFont.file)-3]+=use_big5;
+		pf->CFont.file[strlen(pf->CFont.file)-3]+=use_big5;
+    	}
+
+    	return TRUE;
+}
+
+// This function get ASCII font info from etc file.
+static MWBOOL GetAFontInfo( PMWHZKFONT pf )
+{
+    	AFont[hzk_id(pf)].width = pf->afont_width;
+    	pf->AFont.width = pf->afont_width;
+
+    	AFont[hzk_id(pf)].height = pf->font_height;
+    	pf->AFont.height = pf->font_height;
+
+    	AFont[hzk_id(pf)].size = ((pf->AFont.width + 7) / 8) *
+		pf->AFont.height * 255;
+    	pf->AFont.size = ((pf->AFont.width + 7) / 8) * pf->AFont.height * 255;
+    
+	if(pf->AFont.size < 255 * 8)
+        	return FALSE;
+
+	strcpy(AFont[hzk_id(pf)].file,HZK_FONT_DIR);
+	strcpy(pf->AFont.file,HZK_FONT_DIR);
+	
+	if(pf->font_height==16)
+	{
+	    	strcat(AFont[hzk_id(pf)].file,"/asc16");
+	    	strcat(pf->AFont.file,"/asc16");
+	}
+  	else
+	{
+	    	strcat(AFont[hzk_id(pf)].file,"/asc12");
+	    	strcat(pf->AFont.file,"/asc12");
+	}
+    	return TRUE;
+}
+
+// This function load system font into memory.
+static MWBOOL LoadFont( PMWHZKFONT pf )
+{
+    	FILE* fp;
+
+	if(!GetCFontInfo(pf))
+	{
+		fprintf (stderr, "Get Chinese HZK font info failure!\n");
+		return FALSE;
+	}
+    	if(CFont[hzk_id(pf)].pFont == NULL)//check font cache
+	{
+		
+
+ 	   	// Allocate system memory for Chinese font.
+ 		if( !(CFont[hzk_id(pf)].pFont = (char *)malloc(pf->CFont.size)) )
+ 		{
+	 	       	fprintf (stderr, "Allocate memory for Chinese HZK font failure.\n");
+		        return FALSE;
+	 	}
+ 	
+		// Open font file and read information to the system memory.
+ 		fprintf (stderr, "Loading Chinese HZK font from file(%s)..." ,pf->CFont.file);
+		if(!(fp = fopen(CFont[hzk_id(pf)].file, "rb"))) 
+		{
+   		  	fprintf (stderr, "Error.\nThe Chinese HZK font file can not be found!\n");
+   	    	 	return FALSE;
+    		}
+	    	if(fread(CFont[hzk_id(pf)].pFont, sizeof(char), pf->CFont.size, fp) < pf->CFont.size) 
+		{
+	      	  	fprintf (stderr, "Error in reading Chinese HZK font file!\n");
+	 	     	fclose(fp);
+ 	       		return FALSE;
+		}
+
+		fclose(fp);
+
+		CFont[hzk_id(pf)].use_count=0;//
+
+		fprintf (stderr, "done.\n" );
+
+	}
+	cfont_address = CFont[hzk_id(pf)].pFont;
+	pf->cfont_address = CFont[hzk_id(pf)].pFont;
+	pf->CFont.pFont = CFont[hzk_id(pf)].pFont;
+
+	CFont[hzk_id(pf)].use_count++;//jmt+
+
+	if(!GetAFontInfo(pf))
+	{
+	       fprintf (stderr, "Get ASCII HZK font info failure!\n");
+	       return FALSE;
+	}
+    	if(AFont[hzk_id(pf)].pFont == NULL)//check font cache
+	{
+		
+ 		
+ 		// Allocate system memory for ASCII font.
+ 		if( !(AFont[hzk_id(pf)].pFont = (char *)malloc(pf->AFont.size)) )
+ 		{
+ 		       	fprintf (stderr, "Allocate memory for ASCII HZK font failure.\n");
+ 		       	free(CFont[hzk_id(pf)].pFont);
+ 		       	CFont[hzk_id(pf)].pFont = NULL;
+			return FALSE;
+ 		}
+ 	
+	 	// Load ASCII font information to the near memory.
+ 		fprintf (stderr, "Loading ASCII HZK font..." );
+ 		if(!(fp = fopen(AFont[hzk_id(pf)].file, "rb"))) 
+		{
+ 		       	fprintf (stderr, "Error.\nThe ASCII HZK font file can not be found!\n");
+ 		       	return FALSE;
+ 		}
+	 	if(fread(AFont[hzk_id(pf)].pFont, sizeof(char), pf->AFont.size, fp) < pf->AFont.size) 
+		{
+ 		       	fprintf (stderr, "Error in reading ASCII HZK font file!\n");
+ 		       	fclose(fp);
+ 		       	return FALSE;
+	 	}
+ 	
+ 		fclose(fp);
+ 	
+		AFont[hzk_id(pf)].use_count=0;//
+
+		fprintf (stderr, "done.\n" );
+
+  	}
+	afont_address = AFont[hzk_id(pf)].pFont;
+	pf->afont_address = AFont[hzk_id(pf)].pFont;
+	pf->AFont.pFont = AFont[hzk_id(pf)].pFont;
+
+	AFont[hzk_id(pf)].use_count++;//jmt+
+
+  	return TRUE;
+}
+
+// This function unload system font from memory.
+static void UnloadFont( PMWHZKFONT pf )
+{
+	CFont[hzk_id(pf)].use_count--;
+	AFont[hzk_id(pf)].use_count--;
+
+	if (!CFont[hzk_id(pf)].use_count)
+	{	
+	    	free(pf->CFont.pFont);
+	    	free(pf->AFont.pFont);
+
+	    	CFont[hzk_id(pf)].pFont = NULL;
+	    	AFont[hzk_id(pf)].pFont = NULL;
+	}
+}
+
+static int
+hzk_init(PSD psd)
+{
+	/* FIXME: *.KU file should be opened and
+	 * read in here...*/
+	return 1;
+}
+
+static PMWHZKFONT
+hzk_createfont(const char *name, MWCOORD height, int attr)
+{
+	PMWHZKFONT	pf;
+
+	if(strcmp(name,"HZKFONT")!=0 && strcmp(name,"HZXFONT")!=0)
+		return FALSE;
+
+printf("hzk_createfont(%s,%d)\n",name,height);
+
+	use_big5=name[2]-'K';
+
+	/* allocate font structure*/
+	pf = (PMWHZKFONT)calloc(sizeof(MWHZKFONT), 1);
+	if (!pf)
+		return NULL;
+	pf->fontprocs = &hzk_procs;
+
+	pf->fontsize=height;
+	//GdSetFontSize((PMWFONT)pf, height);
+	GdSetFontRotation((PMWFONT)pf, 0);
+	GdSetFontAttr((PMWFONT)pf, attr, 0);
+
+	if(height==12)
+	{		
+		afont_width = 6;
+		cfont_width = 12;
+		font_height = 12;
+
+		pf->afont_width = 6;
+		pf->cfont_width = 12;
+		pf->font_height = 12;
+	}
+	else 	
+	{		
+		afont_width = 8;
+		cfont_width = 16;
+		font_height = 16;
+
+		pf->afont_width = 8;
+		pf->cfont_width = 16;
+		pf->font_height = 16;
+	}
+
+    	// Load the font library to the system memory.
+	if(!LoadFont(pf))
+  	      	return FALSE;
+
+	return pf;
+}
+
+int IsBig5(int i)//jmt+
+{
+	if ((i>=0xa140 && i<=0xa3bf) || /* a140-a3bf(!a3e0) */
+	    (i>=0xa440 && i<=0xc67e) || /* a440-c67e        */
+	    (i>=0xc6a1 && i<=0xc8d3) || /* c6a1-c8d3(!c8fe) */
+	    (i>=0xc940 && i<=0xf9fe))   /* c940-f9fe        */
+		return 1;
+	else
+		return 0;
+}
+
+/*
+ * following several function is used in hzk_drawtext
+ */
+
+static int getnextchar(char* s, unsigned char* cc)
+{
+    	if( s[0] == '\0') return 0;
+
+    	cc[0] = (unsigned char)(*s);
+    	cc[1] = (unsigned char)(*(s + 1));
+
+    	if (use_big5)
+    	{
+		if( IsBig5( (int) ( (cc[0] << 8) + cc[1]) ) )
+			return 1;
+    	}
+    	else
+	{
+    		if( ((unsigned char)cc[0] > 0xa0) &&
+		    ((unsigned char)cc[1] > 0xa0) )
+        		return 1;
+	}
+
+    	cc[1] = '\0';
+
+    	return 1;
+}
+
+static void
+expandcchar(PMWHZKFONT pf, int bg, int fg, unsigned char* c, MWPIXELVAL* bitmap)
+{
+	int i=0;
+    	int c1, c2, seq;
+	int x,y;
+    	unsigned char *font;
+    	int b = 0;		/* keep gcc happy with b = 0 - MW */
+
+	int pixelsize;
+	pixelsize=sizeof(MWPIXELVAL);
+
+   	c1 = c[0];
+    	c2 = c[1];
+	if (use_big5)//jmt+
+	{
+		seq=0;
+		//ladd=loby-(if(loby<127)?64:98)
+		c2-=(c2<127?64:98);   
+
+		//hadd=(hiby-164)*157
+		if (c1>=0xa4)//standard font
+		{
+			seq=(((c1-164)*157)+c2);
+			if (seq>=5809) seq-=408;
+		}
+
+		//hadd=(hiby-161)*157
+		if (c1<=0xa3)//special font
+			seq=(((c1-161)*157)+c2)+13094;
+	}
+	else
+    		seq=((c1 - 161)*94 + c2 - 161); 
+
+	font = pf->cfont_address + ((seq) *
+		  (pf->font_height * ((pf->cfont_width + 7) / 8)));
+
+     	for (y = 0; y < pf->font_height; y++)
+        	for (x = 0; x < pf->cfont_width; x++) 
+		{
+            		if (x % 8 == 0)
+                		b = *font++;
+
+            		if (b & (128 >> (x % 8)))   /* pixel */
+			  	bitmap[i++]=fg;
+			else
+				bitmap[i++]=bg;
+		}		
+}
+
+static void expandchar(PMWHZKFONT pf, int bg, int fg, int c, MWPIXELVAL* bitmap)
+{
+	int i=0;
+	int x,y;
+    	unsigned char *font;
+	int pixelsize;
+    	int b = 0;		/* keep gcc happy with b = 0 - MW */
+
+	pixelsize=sizeof(MWPIXELVAL);
+
+    	font = pf->afont_address + c * (pf->font_height *
+		((pf->afont_width + 7) / 8));
+
+  	for (y = 0; y < pf->font_height; y++)
+		for (x = 0; x < pf->afont_width; x++) 
+		{
+	    		if (x % 8 == 0)
+				b = *font++;
+	    		if (b & (128 >> (x % 8)))	/* pixel */
+				bitmap[i++]=fg;
+			else
+				bitmap[i++]=bg;
+  		}
+}
+
+/*
+ * Draw ASCII text string using HZK type font
+ */
+static void
+hzk_drawtext(PMWFONT pfont, PSD psd, MWCOORD ax, MWCOORD ay,
+	const void *text, int cc, int flags)
+{
+	PMWHZKFONT pf=(PMWHZKFONT)pfont;
+
+    	unsigned char c[2];
+	MWPIXELVAL *bitmap;
+    	unsigned char s1[3];
+ 	char *s,*sbegin;
+
+	s=(char *)text;
+
+	if(cc==1)
+	{
+		s1[0]=*((unsigned char*)text);
+		s1[1]=0x0;
+		s1[2]=0x0;
+		s=s1;
+    	}
+
+	sbegin=s;
+    	bitmap = (MWPIXELVAL *)ALLOCA(pf->cfont_width * pf->font_height *
+			sizeof(MWPIXELVAL));
+
+    	while( getnextchar(s, c) )
+	{
+              	if( c[1] != '\0') 
+		{
+                	expandcchar(pf, gr_background,gr_foreground,
+                            c, bitmap);
+			/* Now draw the bitmap ... */
+			
+			if (flags&MWTF_TOP)//jmt+ 
+				GdArea(psd,ax, ay, pf->cfont_width,
+					pf->font_height, bitmap, MWPF_PIXELVAL);
+			else
+				GdArea(psd,ax, ay-pf->font_height+2,
+					pf->cfont_width, pf->font_height,
+					bitmap, MWPF_PIXELVAL);
+
+                	s += 2;
+                	ax += pf->cfont_width;
+            	}
+            	else 
+		{
+                	expandchar(pf, gr_background,gr_foreground,
+                           c[0], bitmap);
+			/* Now draw the bitmap ... */
+
+			if (flags&MWTF_TOP) 
+				GdArea(psd,ax, ay, pf->afont_width,
+					pf->font_height, bitmap, MWPF_PIXELVAL);
+			else
+				GdArea(psd,ax, ay-pf->font_height+2,
+					pf->afont_width, pf->font_height,
+					bitmap, MWPF_PIXELVAL);
+
+                	s += 1;
+                	ax += pf->afont_width;
+            	}
+						
+		if(s>=sbegin+cc)break;
+    	}
+
+	FREEA(bitmap);
+}
+
+/*
+ * Return information about a specified font.
+ */
+static MWBOOL
+hzk_getfontinfo(PMWFONT pfont, PMWFONTINFO pfontinfo)
+{
+	PMWHZKFONT pf=(PMWHZKFONT)pfont;
+
+	int i;
+
+	pfontinfo->height = pf->font_height;
+	pfontinfo->maxwidth = pf->cfont_width;
+	pfontinfo->baseline = pf->font_height-2;
+	pfontinfo->firstchar = 0;
+	pfontinfo->lastchar = 0;
+	pfontinfo->fixed = TRUE;
+		
+	for(i=0; i<=256; i++)
+		pfontinfo->widths[i] = pf->afont_width;
+
+	return TRUE;
+}
+
+static void
+hzk_gettextsize(PMWFONT pfont, const void *text, int cc,
+	MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase)
+{
+	PMWHZKFONT pf=(PMWHZKFONT)pfont;
+
+   	unsigned char c[2];
+ 	char *s,*sbegin;
+    	unsigned char s1[3];
+
+	int ax=0;
+	s=(char *)text;
+	if(cc==0)
+	{
+		*pwidth = 0;
+		*pheight = pf->font_height;
+		*pbase = pf->font_height-2;
+
+	}
+	if(cc==1)
+	{
+		s1[0]=*((unsigned char*)text);
+		s1[1]=0x0;
+		s1[2]=0x0;
+		s=s1;
+    	}
+	sbegin=s;
+    	while( getnextchar(s, c) )
+	{
+		if( c[1] != '\0') 
+		{
+           		s += 2;
+           		ax += pf->cfont_width;
+        	}
+        	else 
+		{
+           		s += 1;
+           		ax += pf->afont_width;
+        	}
+		if(s>=sbegin+cc)break;
+		//	fprintf(stderr,"s=%x,sbegin=%x,cc=%x\n",s,sbegin,cc);
+
+    	}
+//	fprintf(stderr,"ax=%d,\n",ax);
+
+	*pwidth = ax;
+	*pheight = pf->font_height;
+	*pbase = pf->font_height-2;
+}
+
+static void
+hzk_destroyfont(PMWFONT pfont)
+{
+	PMWHZKFONT pf=(PMWHZKFONT)pfont;
+	UnloadFont(pf);
+	free(pf);
+}
+
+static void
+hzk_setfontsize(PMWFONT pfont, MWCOORD fontsize)
+{
+	PMWHZKFONT pf=(PMWHZKFONT)pfont;
+	//jmt: hzk_setfontsize not supported
+	//jmt: & pf->fontsize can't be changed
+	//jmt: because of hzk_id() :p
+	pf->fontsize=pf->font_height;
+}
+#endif /* HAVE_HZK_SUPPORT*/
+
+/* FIXME: this routine should work for all font renderers...*/
+int
+GdGetTextSizeEx(PMWFONT pfont, const void *str, int cc,int nMaxExtent,
+	int* lpnFit, int* alpDx,MWCOORD *pwidth,MWCOORD *pheight,
+	MWCOORD *pbase, int flags)
+{
+#ifdef HAVE_FREETYPE_SUPPORT
+	unsigned short	buf[256];
+	unsigned short* text;
+	PMWFREETYPEFONT	pf = (PMWFREETYPEFONT)pfont;
+	int		defencoding = pf->fontprocs->encoding;
+	int 		x = 0;
+	int 		i;
+	TT_UShort 	curchar;
+	TT_Glyph_Metrics metrics;
+	TT_Face_Properties 	properties;
+	TT_Instance_Metrics imetrics;
+
+	if ((cc<0)||(!str))
+	{
+		*pwidth = *pheight = *pbase = 0;
+		return 0;
+	}
+	/* convert encoding if required*/
+	if((flags & MWTF_PACKMASK) != defencoding) 
+	{
+		cc = GdConvertEncoding(str, flags, cc, buf, defencoding);
+		flags &= ~MWTF_PACKMASK;
+		flags |= defencoding;
+		text=buf;
+	} else text =(unsigned short*)str;
+	if(cc <= 0)
+	{
+		*pwidth = *pheight = *pbase = 0;
+		return 0;
+	}
+
+	TT_Get_Face_Properties (pf->face, &properties);
+	TT_Get_Instance_Metrics(pf->instance, &imetrics);
+	
+	pf->last_glyph_code = -1;		/* reset kerning*/
+	pf->last_pen_pos = -32767;
+	if (lpnFit)
+	     *lpnFit=-1;
+	for (i = 0; i < cc; i++) 
+	{
+		curchar = TT_Char_Index (pf->char_map,text[i]);
+		
+		if (TT_Load_Glyph (pf->instance, pf->glyph, curchar,
+			TTLOAD_SCALE_GLYPH|TTLOAD_HINT_GLYPH) != TT_Err_Ok)			
+		{		
+		     printf("Unable to load glyph with index=%d\n",curchar);    
+			return 0;
+		}
+		TT_Get_Glyph_Metrics (pf->glyph, &metrics);
+		if ((pf->fontattr&MWTF_KERNING) && pf->can_kern)
+		{
+			x += compute_kernval(pf, curchar) / 64;
+		}
+		x += metrics.advance / 64;
+     		if((lpnFit)&&(alpDx))
+		{
+			if (x<=nMaxExtent)
+			     alpDx[i]=x;
+			else
+			     if (*lpnFit==-1)
+					(*lpnFit)=i;               		     
+		}
+		/* Kerning point syndrome avoidance */
+		if (pf->last_pen_pos > x)
+			x = pf->last_pen_pos;
+		pf->last_pen_pos = x;
+		pf->last_glyph_code = curchar;
+	}
+     	if ((lpnFit)&&(*lpnFit==-1))
+    		*lpnFit=cc;
+	*pwidth = x;
+	*pheight = (((properties.horizontal->Ascender * 
+	                imetrics.y_scale)/ 0x10000) >> 6) -
+			    (((properties.horizontal->Descender * 
+			    imetrics.y_scale)/ 0x10000) >> 6);
+	//FIXME: is it what's required ??
+	if (pbase)
+		*pbase = (((-properties.horizontal->Descender) * 
+			    imetrics.y_scale)/ 0x10000) >> 6;
+	return 1;
+#else /* HAVE_FREETYPE_SUPPORT*/
+	*pwidth = *pheight = *pbase = 0;
+	return 0;
+#endif
+}
diff -urN lib/microwindows/src/engine/devimage.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devimage.c
--- lib/microwindows/src/engine/devimage.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devimage.c	2005-02-21 16:13:14.000000000 +0100
@@ -0,0 +1,2209 @@
+#define FASTJPEG	1	/* =1 for temp quick jpeg 8bpp display*/
+
+#if defined(HAVE_FILEIO)	/* temp for entire file*/
+/*
+ * Copyright (c) 2000, 2001 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 2000 Martin Jolicoeur <martinj@visuaide.com>
+ * Portions Copyright (c) 2000 Alex Holden <alex@linuxhacker.org>
+ * Portions Copyright (c) Independant JPEG group (ijg)
+ *
+ * Image load/cache/resize/display routines
+ *
+ * GIF, BMP, JPEG, PPM, PGM, PBM, PNG, and XPM formats are supported.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include "device.h"
+
+/* cached image list*/
+typedef struct {
+	MWLIST		link;		/* link list*/
+	int		id;		/* image id*/
+	PMWIMAGEHDR	pimage;		/* image data*/
+	PSD		psd;		/* FIXME shouldn't need this*/
+} IMAGEITEM, *PIMAGEITEM;
+
+static MWLISTHEAD imagehead;		/* global image list*/
+static int nextimageid = 1;
+
+static void ComputePitch(int bpp, int width, int *pitch, int *bytesperpixel);
+#if defined(HAVE_BMP_SUPPORT)
+static int  LoadBMP(FILE *fp, PMWIMAGEHDR pimage);
+#endif
+#if defined(HAVE_JPEG_SUPPORT)
+static int  LoadJPEG(FILE *fp, PMWIMAGEHDR pimage, PSD psd,
+		MWBOOL fast_grayscale);
+#endif
+#if defined(HAVE_PNG_SUPPORT)
+static int  LoadPNG(FILE *fp, PMWIMAGEHDR pimage);
+#endif
+#if defined(HAVE_GIF_SUPPORT)
+static int  LoadGIF(FILE *fp, PMWIMAGEHDR pimage);
+#endif
+#if defined(HAVE_PNM_SUPPORT)
+static int LoadPNM(FILE *fp, PMWIMAGEHDR pimage);
+#endif
+#if defined(HAVE_XPM_SUPPORT)
+static int LoadXPM(FILE *fp, PMWIMAGEHDR pimage, PSD psd) ;
+#endif
+
+/*
+ * Image decoding and display
+ * NOTE: This routine and APIs will change in subsequent releases.
+ *
+ * Decodes and loads a graphics file, then resizes to width/height,
+ * then displays image at x, y
+ * If width/height == -1, don't resize, use image size.
+ * Clipping is not currently supported, just stretch/shrink to fit.
+ *
+ */
+void
+GdDrawImageFromFile(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width,
+	MWCOORD height, char *path, int flags)
+{
+	int	id;
+
+	id = GdLoadImageFromFile(psd, path, flags);
+	if (id) {
+		GdDrawImageToFit(psd, x, y, width, height, id);
+		GdFreeImage(id);
+	}
+}
+
+int
+GdLoadImageFromFile(PSD psd, char *path, int flags)
+{
+	FILE *		fp;
+	int		loadOK = 0;
+	PMWIMAGEHDR	pimage;
+	PIMAGEITEM	pItem;
+
+	if ((fp = fopen(path, "rb")) == NULL) {
+		EPRINTF("GdLoadImageFromFile: can't open image: %s\n", path);
+		return 0;
+	}
+
+	/* allocate image struct*/
+	pimage = (PMWIMAGEHDR)malloc(sizeof(MWIMAGEHDR));
+	if(!pimage) {
+		fclose(fp);
+		return 0;
+	}
+	pimage->imagebits = NULL;
+	pimage->palette = NULL;
+	pimage->transcolor = -1L;
+
+#if defined(HAVE_BMP_SUPPORT)
+	if (loadOK == 0) 
+		loadOK = LoadBMP(fp, pimage);
+#endif
+#if defined(HAVE_GIF_SUPPORT)
+	if (loadOK == 0) 
+		loadOK = LoadGIF(fp, pimage);
+#endif
+#if defined(HAVE_JPEG_SUPPORT)
+	if (loadOK == 0) 
+		loadOK = LoadJPEG(fp, pimage, psd, flags);
+#endif
+#if defined(HAVE_PNG_SUPPORT)
+	if (loadOK == 0) 
+		loadOK = LoadPNG(fp, pimage);
+#endif
+#if defined(HAVE_PNM_SUPPORT)
+	if(loadOK == 0)
+		loadOK = LoadPNM(fp, pimage);
+#endif
+#if defined(HAVE_XPM_SUPPORT)
+	if (loadOK == 0) 
+		loadOK = LoadXPM(fp, pimage, psd);
+#endif
+
+	fclose(fp);
+	if (loadOK == 0) {
+		EPRINTF("GdLoadImageFromFile: unknown image type: %s\n", path);
+		goto err;		/* image loading error*/
+	}
+	if (loadOK != 1)
+		goto err;		/* image loading error*/
+
+	/* allocate id*/
+	pItem = GdItemNew(IMAGEITEM);
+	if (!pItem)
+		goto err;
+	pItem->id = nextimageid++;
+	pItem->pimage = pimage;
+	pItem->psd = psd;
+	GdListAdd(&imagehead, &pItem->link);
+
+	return pItem->id;
+
+err:
+	free(pimage);
+	return 0;			/* image loading error*/
+}
+
+static PIMAGEITEM
+findimage(int id)
+{
+	PMWLIST		p;
+	PIMAGEITEM	pimagelist;
+
+	for (p=imagehead.head; p; p=p->next) {
+		pimagelist = GdItemAddr(p, IMAGEITEM, link);
+		if (pimagelist->id == id)
+			return pimagelist;
+	}
+	return NULL;
+}
+
+void
+GdDrawImageToFit(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height,
+	int id)
+{
+	PIMAGEITEM	pItem;
+	PMWIMAGEHDR	pimage;
+
+	pItem = findimage(id);
+	if (!pItem)
+		return;
+	pimage = pItem->pimage;
+
+	/*
+	 * Display image, possibly stretch/shrink to resize
+	 */
+	if (height < 0)
+		height = pimage->height;
+	if (width < 0)
+		width = pimage->width;
+
+	if (height != pimage->height || width != pimage->width) {
+		MWCLIPRECT	rcDst;
+		MWIMAGEHDR	image2;
+
+		/* create similar image, different width/height*/
+
+		image2.width = width;
+		image2.height = height;
+		image2.planes = pimage->planes;
+		image2.bpp = pimage->bpp;
+		ComputePitch(pimage->bpp, width, &image2.pitch,
+			&image2.bytesperpixel);
+		image2.compression = pimage->compression;
+		image2.palsize = pimage->palsize;
+		image2.palette = pimage->palette;	/* already allocated*/
+		image2.transcolor = pimage->transcolor;
+		if( (image2.imagebits = malloc(image2.pitch*height)) == NULL) {
+			EPRINTF("GdDrawImageToFit: no memory\n");
+			return;
+		}
+
+		rcDst.x = 0;
+		rcDst.y = 0;
+		rcDst.width = width;
+		rcDst.height = height;
+
+		/* Stretch full soruce to destination rectangle*/
+		GdStretchImage(pimage, NULL, &image2, &rcDst);
+		GdDrawImage(psd, x, y, &image2);
+		free(image2.imagebits);
+	} else
+		GdDrawImage(psd, x, y, pimage);
+}
+
+void
+GdFreeImage(int id)
+{
+	PIMAGEITEM	pItem;
+	PMWIMAGEHDR	pimage;
+
+	pItem = findimage(id);
+	if (pItem) {
+		GdListRemove(&imagehead, &pItem->link);
+		pimage = pItem->pimage;
+
+		/* delete image bits*/
+		if(pimage->imagebits)
+			free(pimage->imagebits);
+		if(pimage->palette)
+			free(pimage->palette);
+
+		free(pimage);
+		GdItemFree(pItem);
+	}
+}
+
+MWBOOL
+GdGetImageInfo(int id, PMWIMAGEINFO pii)
+{
+	PMWIMAGEHDR	pimage;
+	PIMAGEITEM	pItem;
+	int		i;
+
+	pItem = findimage(id);
+	if (!pItem) {
+		memset(pii, 0, sizeof(*pii));
+		return FALSE;
+	}
+	pimage = pItem->pimage;
+	pii->id = id;
+	pii->width = pimage->width;
+	pii->height = pimage->height;
+	pii->planes = pimage->planes;
+	pii->bpp = pimage->bpp;
+	pii->pitch = pimage->pitch;
+	pii->bytesperpixel = pimage->bytesperpixel;
+	pii->compression = pimage->compression;
+	pii->palsize = pimage->palsize;
+	if (pimage->palsize) {
+		if (pimage->palette) {
+			for (i=0; i<pimage->palsize; ++i)
+				pii->palette[i] = pimage->palette[i];
+		} else {
+			/* FIXME handle jpeg's without palette*/
+			GdGetPalette(pItem->psd, 0, pimage->palsize,
+				pii->palette);
+		}
+	}
+	return TRUE;
+}
+
+#define PIX2BYTES(n)	(((n)+7)/8)
+/*
+ * compute image line size and bytes per pixel
+ * from bits per pixel and width
+ */
+static void
+ComputePitch(int bpp, int width, int *pitch, int *bytesperpixel)
+{
+	int	linesize;
+	int	bytespp = 1;
+
+	if(bpp == 1)
+		linesize = PIX2BYTES(width);
+	else if(bpp <= 4)
+		linesize = PIX2BYTES(width<<2);
+	else if(bpp <= 8)
+		linesize = width;
+	else if(bpp <= 16) {
+		linesize = width * 2;
+		bytespp = 2;
+	} else if(bpp <= 24) {
+		linesize = width * 3;
+		bytespp = 3;
+	} else {
+		linesize = width * 4;
+		bytespp = 4;
+	}
+
+	/* rows are DWORD right aligned*/
+	*pitch = (linesize + 3) & ~3;
+	*bytesperpixel = bytespp;
+}
+
+/*
+ * StretchImage - Resize an image
+ *
+ * Major portions from SDL Simple DirectMedia Layer by Sam Lantinga
+ * Copyright (C) 1997, 1998, 1999, 2000  Sam Lantinga <slouken@devolution.com>
+ * This a stretch blit implementation based on ideas given to me by
+ *  Tomasz Cejner - thanks! :)
+ */
+/*
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#define DEFINE_COPY_ROW(name, type)					\
+static void name(type *src, int src_w, type *dst, int dst_w)		\
+{									\
+	int i;								\
+	int pos, inc;							\
+	type pixel = 0;							\
+									\
+	pos = 0x10000;							\
+	inc = (src_w << 16) / dst_w;					\
+	for ( i=dst_w; i>0; --i ) {					\
+		while ( pos >= 0x10000L ) {				\
+			pixel = *src++;					\
+			pos -= 0x10000L;				\
+		}							\
+		*dst++ = pixel;						\
+		pos += inc;						\
+	}								\
+}
+
+DEFINE_COPY_ROW(copy_row1, unsigned char)
+DEFINE_COPY_ROW(copy_row2, unsigned short)
+DEFINE_COPY_ROW(copy_row4, unsigned long)
+
+static void copy_row3(unsigned char *src, int src_w, unsigned char *dst,
+	int dst_w)
+{
+	int i;
+	int pos, inc;
+	unsigned char r = 0;
+	unsigned char g = 0;
+	unsigned char b = 0;
+
+	pos = 0x10000;
+	inc = (src_w << 16) / dst_w;
+	for ( i=dst_w; i>0; --i ) {
+		while ( pos >= 0x10000L ) {
+			b = *src++;
+			g = *src++;
+			r = *src++;
+			pos -= 0x10000L;
+		}
+		*dst++ = b;
+		*dst++ = g;
+		*dst++ = r;
+		pos += inc;
+	}
+}
+
+/* Perform a stretch blit between two image structs of the same format.*/
+void
+GdStretchImage(PMWIMAGEHDR src, MWCLIPRECT *srcrect, PMWIMAGEHDR dst,
+	MWCLIPRECT *dstrect)
+{
+	int pos, inc;
+	int bytesperpixel;
+	int dst_maxrow;
+	int src_row, dst_row;
+	MWUCHAR *srcp = 0;
+	MWUCHAR *dstp;
+	MWCLIPRECT full_src;
+	MWCLIPRECT full_dst;
+
+	if ( src->bytesperpixel != dst->bytesperpixel ) {
+		EPRINTF("GdStretchImage: bytesperpixel mismatch\n");
+		return;
+	}
+
+	/* Verify the blit rectangles */
+	if ( srcrect ) {
+		if ( (srcrect->x < 0) || (srcrect->y < 0) ||
+		     ((srcrect->x+srcrect->width) > src->width) ||
+		     ((srcrect->y+srcrect->height) > src->height) ) {
+			EPRINTF("GdStretchImage: invalid source rect\n");
+			return;
+		}
+	} else {
+		full_src.x = 0;
+		full_src.y = 0;
+		full_src.width = src->width;
+		full_src.height = src->height;
+		srcrect = &full_src;
+	}
+	if ( dstrect ) {
+		/* if stretching to nothing, return*/
+		if (!dstrect->width || !dstrect->height)
+			return;
+		if ( (dstrect->x < 0) || (dstrect->y < 0) ||
+		     ((dstrect->x+dstrect->width) > dst->width) ||
+		     ((dstrect->y+dstrect->height) > dst->height) ) {
+			EPRINTF("GdStretchImage: invalid dest rect\n");
+			return;
+		}
+	} else {
+		full_dst.x = 0;
+		full_dst.y = 0;
+		full_dst.width = dst->width;
+		full_dst.height = dst->height;
+		dstrect = &full_dst;
+	}
+
+	/* Set up the data... */
+	pos = 0x10000;
+	inc = (srcrect->height << 16) / dstrect->height;
+	src_row = srcrect->y;
+	dst_row = dstrect->y;
+	bytesperpixel = dst->bytesperpixel;
+
+	/* Perform the stretch blit */
+	for ( dst_maxrow = dst_row+dstrect->height; dst_row<dst_maxrow;
+								++dst_row ) {
+		dstp = (MWUCHAR *)dst->imagebits + (dst_row*dst->pitch)
+				    + (dstrect->x*bytesperpixel);
+		while ( pos >= 0x10000L ) {
+			srcp = (MWUCHAR *)src->imagebits + (src_row*src->pitch)
+				    + (srcrect->x*bytesperpixel);
+			++src_row;
+			pos -= 0x10000L;
+		}
+
+		switch (bytesperpixel) {
+		case 1:
+			copy_row1(srcp, srcrect->width, dstp, dstrect->width);
+			break;
+		case 2:
+			copy_row2((unsigned short *)srcp, srcrect->width,
+				(unsigned short *)dstp, dstrect->width);
+			break;
+		case 3:
+			copy_row3(srcp, srcrect->width, dstp, dstrect->width);
+			break;
+		case 4:
+			copy_row4((unsigned long *)srcp, srcrect->width,
+				(unsigned long *)dstp, dstrect->width);
+			break;
+		}
+
+		pos += inc;
+	}
+}
+
+#if defined(HAVE_FILEIO) && defined(HAVE_JPEG_SUPPORT)
+#include "jpeglib.h"
+/*
+ * JPEG decompression routine
+ *
+ * JPEG support must be enabled (see README.txt in contrib/jpeg)
+ *
+ * SOME FINE POINTS: (from libjpeg)
+ * In the below code, we ignored the return value of jpeg_read_scanlines,
+ * which is the number of scanlines actually read.  We could get away with
+ * this because we asked for only one line at a time and we weren't using
+ * a suspending data source.  See libjpeg.doc for more info.
+ *
+ * We cheated a bit by calling alloc_sarray() after jpeg_start_decompress();
+ * we should have done it beforehand to ensure that the space would be
+ * counted against the JPEG max_memory setting.  In some systems the above
+ * code would risk an out-of-memory error.  However, in general we don't
+ * know the output image dimensions before jpeg_start_decompress(), unless we
+ * call jpeg_calc_output_dimensions().  See libjpeg.doc for more about this.
+ *
+ * Scanlines are returned in the same order as they appear in the JPEG file,
+ * which is standardly top-to-bottom.  If you must emit data bottom-to-top,
+ * you can use one of the virtual arrays provided by the JPEG memory manager
+ * to invert the data.  See wrbmp.c for an example.
+ *
+ * As with compression, some operating modes may require temporary files.
+ * On some systems you may need to set up a signal handler to ensure that
+ * temporary files are deleted if the program is interrupted.  See libjpeg.doc.
+ */
+static int
+LoadJPEG(FILE *fp, PMWIMAGEHDR pimage, PSD psd, MWBOOL fast_grayscale)
+{
+	int 	i;
+	int	ret = 2;	/* image load error*/
+	unsigned char magic[4];
+#if FASTJPEG
+	extern MWPALENTRY mwstdpal8[256];
+#else
+	MWPALENTRY palette[256];
+#endif
+	/* This struct contains the JPEG decompression parameters
+	 * and pointers to working space 
+	 * (which is allocated as needed by the JPEG library).
+	 */
+	struct jpeg_decompress_struct cinfo;
+	struct jpeg_error_mgr jerr;
+
+	/* first determine if JPEG file since decoder will error if not*/
+	fseek(fp, 0L, 0);
+	if(!fread(magic, 2, 1, fp))
+		return 0;		/* not JPEG image*/
+	if (magic[0] != 0xFF || magic[1] != 0xD8)
+		return 0;		/* not JPEG image*/
+	fread(magic, 4, 1, fp);
+	fread(magic, 4, 1, fp);
+	if (strncmp(magic, "JFIF", 4) != 0)
+		return 0;		/* not JPEG image*/
+
+	fseek(fp, 0L, 0);
+	pimage->imagebits = NULL;
+	pimage->palette = NULL;
+
+	/* Step 1: allocate and initialize JPEG decompression object */
+
+	/* We set up the normal JPEG error routines. */
+	cinfo.err = jpeg_std_error (&jerr);
+
+	/* Now we can initialize the JPEG decompression object. */
+	jpeg_create_decompress (&cinfo);
+
+	/* Step 2: specify data source (eg, a file) */
+	jpeg_stdio_src (&cinfo, fp);
+
+	/* Step 3: read file parameters with jpeg_read_header() */
+	jpeg_read_header (&cinfo, TRUE);
+
+	/* Step 4: set parameters for decompression */
+	cinfo.out_color_space = fast_grayscale? JCS_GRAYSCALE: JCS_RGB;
+	cinfo.quantize_colors = FALSE;
+
+#if FASTJPEG
+	goto fastjpeg;
+#endif
+	if (!fast_grayscale)
+	{
+		if (psd->pixtype == MWPF_PALETTE)
+		{
+fastjpeg:
+			cinfo.quantize_colors = TRUE;
+
+#if FASTJPEG
+			cinfo.actual_number_of_colors = 256;
+#else
+			/* Get system palette */
+			cinfo.actual_number_of_colors = 
+				GdGetPalette(psd, 0, psd->ncolors, palette);
+#endif
+	
+			/* Allocate jpeg colormap space */
+			cinfo.colormap = (*cinfo.mem->alloc_sarray)
+				((j_common_ptr) &cinfo, JPOOL_IMAGE,
+			       	(JDIMENSION)cinfo.actual_number_of_colors,
+				(JDIMENSION)3);
+
+			/* Set colormap from system palette */
+			for(i = 0; i < cinfo.actual_number_of_colors; ++i)
+			{
+#if FASTJPEG
+				cinfo.colormap[0][i] = mwstdpal8[i].r;
+				cinfo.colormap[1][i] = mwstdpal8[i].g;
+				cinfo.colormap[2][i] = mwstdpal8[i].b;
+#else
+				cinfo.colormap[0][i] = palette[i].r;
+				cinfo.colormap[1][i] = palette[i].g;
+				cinfo.colormap[2][i] = palette[i].b;
+#endif
+			}
+		}
+	}
+	else 
+	{
+		/* Grayscale output asked */
+		cinfo.quantize_colors = TRUE;
+		cinfo.out_color_space = JCS_GRAYSCALE;
+		cinfo.desired_number_of_colors = psd->ncolors;
+	}
+	jpeg_calc_output_dimensions(&cinfo);
+
+	pimage->width = cinfo.output_width;
+	pimage->height = cinfo.output_height;
+	pimage->planes = 1;
+#if FASTJPEG
+	pimage->bpp = 8;
+#else
+	pimage->bpp = (fast_grayscale || psd->pixtype == MWPF_PALETTE)?
+		8: cinfo.output_components*8;
+#endif
+	ComputePitch(pimage->bpp, pimage->width, &pimage->pitch,
+		&pimage->bytesperpixel);
+	pimage->compression = MWIMAGE_RGB;	/* RGB not BGR order*/
+	pimage->palsize = (pimage->bpp == 8)? 256: 0;
+	pimage->imagebits = malloc(pimage->pitch * pimage->height);
+	if(!pimage->imagebits)
+		goto err;
+	pimage->palette = NULL;
+#if FASTJPEG
+	if(pimage->bpp == 8) {
+		pimage->palette = malloc(256*sizeof(MWPALENTRY));
+		if(!pimage->palette)
+			goto err;
+		for (i=0; i<256; ++i)
+			pimage->palette[i] = mwstdpal8[i];
+	}
+#endif
+
+	/* Step 5: Start decompressor */
+	jpeg_start_decompress (&cinfo);
+
+	/* Step 6: while (scan lines remain to be read) */
+	while(cinfo.output_scanline < cinfo.output_height) {
+		JSAMPROW rowptr[1];
+		rowptr[0] = (JSAMPROW)(pimage->imagebits +
+			cinfo.output_scanline * pimage->pitch);
+		jpeg_read_scanlines (&cinfo, rowptr, 1);
+	}
+	ret = 1;
+
+err:
+	/* Step 7: Finish decompression */
+	jpeg_finish_decompress (&cinfo);
+
+	/* Step 8: Release JPEG decompression object */
+	jpeg_destroy_decompress (&cinfo);
+
+	/* May want to check to see whether any corrupt-data
+	 * warnings occurred (test whether jerr.pub.num_warnings is nonzero).
+	 */
+	return ret;
+}
+#endif /* defined(HAVE_FILEIO) && defined(HAVE_JPEG_SUPPORT)*/
+
+#if defined(HAVE_FILEIO) && defined(HAVE_PNG_SUPPORT)
+#include "png.h"
+/*
+ * Load a PNG file.
+ * Currently for simplicity we get the PNG library to convert the file to
+ * 24 bit RGB format with no alpha channel information even if we could
+ * potentially store the image more efficiently by taking note of the image
+ * type and depth and acting accordingly. Similarly, > 8 bits per channel,
+ * gamma correction, etc. are not supported.
+ */
+static int
+LoadPNG(FILE *fp, PMWIMAGEHDR pimage)
+{
+	unsigned char hdr[8], **rows;
+	png_structp state;
+	png_infop pnginfo;
+	png_uint_32 width, height;
+	int bit_depth, colourtype, i;
+
+	fseek(fp, 0L, 0);
+
+	if(fread(hdr, 1, 8, fp) != 8) return 0;
+
+	if(png_sig_cmp(hdr, 0, 8)) return 0;
+
+	if(!(state = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, 
+						NULL, NULL))) goto nomem;
+
+	if(!(pnginfo = png_create_info_struct(state))) {
+		png_destroy_read_struct(&state, NULL, NULL);
+		goto nomem;
+	}
+
+	if(setjmp(png_jmpbuf(state))) {
+		png_destroy_read_struct(&state, &pnginfo, NULL);
+		return 2;
+	}
+
+	png_init_io(state, fp);
+	png_set_sig_bytes(state, 8);
+	png_read_info(state, pnginfo);
+	png_get_IHDR(state, pnginfo, &width, &height, &bit_depth, &colourtype,
+							NULL, NULL, NULL);
+
+	pimage->width = width;
+	pimage->height = height;
+	pimage->bpp = 24;
+	pimage->planes = 1;
+	ComputePitch(pimage->bpp, pimage->width, &pimage->pitch,
+						&pimage->bytesperpixel);
+	pimage->compression = MWIMAGE_RGB;
+        if(!(pimage->imagebits = malloc(pimage->pitch * pimage->height))) {
+		png_destroy_read_struct(&state, &pnginfo, NULL);
+		goto nomem;
+        }
+        if(!(rows = malloc(pimage->height * sizeof(unsigned char *)))) {
+		png_destroy_read_struct(&state, &pnginfo, NULL);
+		goto nomem;
+        }
+	for(i = 0; i < pimage->height; i++)
+		rows[i] = pimage->imagebits + (i * pimage->pitch);
+
+	png_set_expand(state);
+	if(bit_depth == 16)
+		png_set_strip_16(state);
+	if(colourtype & PNG_COLOR_MASK_ALPHA)
+		png_set_strip_alpha(state);
+	if(colourtype == PNG_COLOR_TYPE_GRAY ||
+			colourtype == PNG_COLOR_TYPE_GRAY_ALPHA)
+		png_set_gray_to_rgb(state);
+
+	png_read_image(state, rows);
+
+	png_read_end(state, NULL);
+	free(rows);
+	png_destroy_read_struct(&state, &pnginfo, NULL);
+
+	return 1;
+
+nomem:
+	EPRINTF("LoadPNG: Out of memory\n");
+	return 2;
+}
+#endif /* defined(HAVE_FILEIO) && defined(HAVE_PNG_SUPPORT)*/
+
+#if defined(HAVE_FILEIO) && defined(HAVE_BMP_SUPPORT)
+/* BMP stuff*/
+#define BI_RGB		0L
+#define BI_RLE8		1L
+#define BI_RLE4		2L
+#define BI_BITFIELDS	3L
+
+typedef unsigned char	BYTE;
+typedef unsigned short	WORD;
+typedef unsigned long	DWORD;
+typedef long		LONG;
+
+typedef struct {
+	/* BITMAPFILEHEADER*/
+	BYTE	bfType[2];
+	DWORD	bfSize;
+	WORD	bfReserved1;
+	WORD	bfReserved2;
+	DWORD	bfOffBits;
+} BMPFILEHEAD;
+
+#define FILEHEADSIZE 14
+
+/* windows style*/
+typedef struct {
+	/* BITMAPINFOHEADER*/
+	DWORD	BiSize;
+	DWORD	BiWidth;
+	DWORD	BiHeight;
+	WORD	BiPlanes;
+	WORD	BiBitCount;
+	DWORD	BiCompression;
+	DWORD	BiSizeImage;
+	DWORD	BiXpelsPerMeter;
+	DWORD	BiYpelsPerMeter;
+	DWORD	BiClrUsed;
+	DWORD	BiClrImportant;
+} BMPINFOHEAD;
+
+#define INFOHEADSIZE 40
+
+/* os/2 style*/
+typedef struct {
+	/* BITMAPCOREHEADER*/
+	DWORD	bcSize;
+	WORD	bcWidth;
+	WORD	bcHeight;
+	WORD	bcPlanes;
+	WORD	bcBitCount;
+} BMPCOREHEAD;
+
+#define COREHEADSIZE 12
+
+static int	DecodeRLE8(MWUCHAR *buf,FILE *fp);
+static int	DecodeRLE4(MWUCHAR *buf,FILE *fp);
+static void	put4(int b);
+
+/*
+ * BMP decoding routine
+ */
+static int
+LoadBMP(FILE *fp, PMWIMAGEHDR pimage)
+{
+	int		h, i, compression;
+	int		headsize;
+	MWUCHAR		*imagebits;
+	BMPFILEHEAD	bmpf;
+	BMPINFOHEAD	bmpi;
+	BMPCOREHEAD	bmpc;
+	MWUCHAR 	headbuffer[INFOHEADSIZE];
+
+	fseek(fp, 0L, 0);
+	pimage->imagebits = NULL;
+	pimage->palette = NULL;
+
+	/* read BMP file header*/
+	if(fread(&headbuffer, 1, FILEHEADSIZE, fp) != FILEHEADSIZE)
+		return 0;	/* not bmp image*/
+
+	bmpf.bfType[0] = headbuffer[0];
+	bmpf.bfType[1] = headbuffer[1];
+	bmpf.bfSize = *(DWORD*)&headbuffer[2];
+	bmpf.bfOffBits = *(DWORD*)&headbuffer[10];
+
+	/* Is it really a bmp file ? */
+	if (*(WORD*)&bmpf.bfType[0] != 0x4D42) /* 'BM' */
+		return 0;	/* not bmp image*/
+
+	/* Read remaining header size */
+	if (fread(&headsize, 1, sizeof(DWORD), fp) != sizeof(DWORD))
+		return 0;	/* not bmp image*/
+
+	/* might be windows or os/2 header */
+	if(headsize == COREHEADSIZE) {
+
+		/* read os/2 header */
+		if(fread(&headbuffer, 1, COREHEADSIZE-sizeof(DWORD), fp) !=
+			COREHEADSIZE-sizeof(DWORD))
+				return 0;	/* not bmp image*/
+
+		/* Get data */
+		bmpc.bcWidth = *(WORD*)&headbuffer[0];
+		bmpc.bcHeight = *(WORD*)&headbuffer[2];
+		bmpc.bcPlanes = *(WORD*)&headbuffer[4];
+		bmpc.bcBitCount = *(WORD*)&headbuffer[6];
+		
+		pimage->width = (int)bmpc.bcWidth;
+		pimage->height = (int)bmpc.bcHeight;
+		pimage->bpp = bmpc.bcBitCount;
+		if (pimage->bpp <= 8)
+			pimage->palsize = 1 << pimage->bpp;
+		else pimage->palsize = 0;
+		compression = BI_RGB;
+	} else {
+		/* read windows header */
+		if(fread(&headbuffer, 1, INFOHEADSIZE-sizeof(DWORD), fp) !=
+			INFOHEADSIZE-sizeof(DWORD))
+				return 0;	/* not bmp image*/
+
+		/* Get data */
+		bmpi.BiWidth = *(DWORD*)&headbuffer[0];
+		bmpi.BiHeight = *(DWORD*)&headbuffer[4];
+		bmpi.BiPlanes = *(WORD*)&headbuffer[8];
+		bmpi.BiBitCount = *(WORD*)&headbuffer[10];
+		bmpi.BiCompression = *(DWORD*)&headbuffer[12];
+		bmpi.BiSizeImage = *(DWORD*)&headbuffer[16];
+		bmpi.BiXpelsPerMeter = *(DWORD*)&headbuffer[20];
+		bmpi.BiYpelsPerMeter = *(DWORD*)&headbuffer[24];
+		bmpi.BiClrUsed = *(DWORD*)&headbuffer[28];
+		bmpi.BiClrImportant = *(DWORD*)&headbuffer[32];
+
+		pimage->width = (int)bmpi.BiWidth;
+		pimage->height = (int)bmpi.BiHeight;
+		pimage->bpp = bmpi.BiBitCount;
+		pimage->palsize = (int)bmpi.BiClrUsed;
+		if (pimage->palsize > 256)
+			pimage->palsize = 0;
+		else if(pimage->palsize == 0 && pimage->bpp <= 8)
+			pimage->palsize = 1 << pimage->bpp;
+		compression = bmpi.BiCompression;
+	}
+	pimage->compression = MWIMAGE_BGR;	/* right side up, BGR order*/
+	pimage->planes = 1;
+
+	/* currently only 1, 4, 8 and 24 bpp bitmaps*/
+	if(pimage->bpp > 8 && pimage->bpp != 24) {
+		EPRINTF("LoadBMP: image bpp not 1, 4, 8 or 24\n");
+		return 2;	/* image loading error*/
+	}
+
+	/* compute byte line size and bytes per pixel*/
+	ComputePitch(pimage->bpp, pimage->width, &pimage->pitch,
+		&pimage->bytesperpixel);
+
+	/* Allocate image */
+	if( (pimage->imagebits = malloc(pimage->pitch*pimage->height)) == NULL)
+		goto err;
+	if( (pimage->palette = malloc(256*sizeof(MWPALENTRY))) == NULL)
+		goto err;
+
+	/* get colormap*/
+	if(pimage->bpp <= 8) {
+		for(i=0; i<pimage->palsize; i++) {
+			pimage->palette[i].b = fgetc(fp);
+			pimage->palette[i].g = fgetc(fp);
+			pimage->palette[i].r = fgetc(fp);
+			if(headsize != COREHEADSIZE)
+				fgetc(fp);
+		}
+	}
+
+	/* decode image data*/
+	fseek(fp, bmpf.bfOffBits, SEEK_SET);
+
+	h = pimage->height;
+	/* For every row ... */
+	while (--h >= 0) {
+		/* turn image rightside up*/
+		imagebits = pimage->imagebits + h*pimage->pitch;
+
+		/* Get row data from file */
+		if(compression == BI_RLE8) {
+			if(!DecodeRLE8(imagebits, fp))
+				break;
+		} else if(compression == BI_RLE4) {
+			if(!DecodeRLE4(imagebits, fp))
+				break;
+		} else {
+			if(fread(imagebits, 1, pimage->pitch, fp) !=
+				pimage->pitch)
+					goto err;
+		}
+	}
+	return 1;		/* bmp image ok*/
+	
+err:
+	EPRINTF("LoadBMP: image loading error\n");
+	if(pimage->imagebits)
+		free(pimage->imagebits);
+	if(pimage->palette)
+		free(pimage->palette);
+	return 2;		/* bmp image error*/
+}
+
+/*
+ * Decode one line of RLE8, return 0 when done with all bitmap data
+ */
+static int
+DecodeRLE8(MWUCHAR *buf,FILE *fp)
+{
+	int		c, n;
+	MWUCHAR *	p = buf;
+
+	for( ;;) {
+		switch( n = fgetc( fp)) {
+		case EOF:
+			return( 0);
+		case 0:			/* 0 = escape*/
+			switch( n = fgetc( fp)) {
+			case 0: 	/* 0 0 = end of current scan line*/
+				return( 1);
+			case 1:		/* 0 1 = end of data*/
+				return( 1);
+			case 2:		/* 0 2 xx yy delta mode NOT SUPPORTED*/
+				(void)fgetc( fp);
+				(void)fgetc( fp);
+				continue;
+			default:	/* 0 3..255 xx nn uncompressed data*/
+				for( c=0; c<n; c++)
+					*p++ = fgetc( fp);
+				if( n & 1)
+					(void)fgetc( fp);
+				continue;
+			}
+		default:
+			c = fgetc( fp);
+			while( n--)
+				*p++ = c;
+			continue;
+		}
+	}
+}
+
+/*
+ * Decode one line of RLE4, return 0 when done with all bitmap data
+ */
+static MWUCHAR *p;
+static int	once;
+
+static void
+put4(int b)
+{
+	static int	last;
+
+	last = (last << 4) | b;
+	if( ++once == 2) {
+		*p++ = last;
+		once = 0;
+	}
+}
+	
+static int
+DecodeRLE4(MWUCHAR *buf,FILE *fp)
+{
+	int		c, n, c1, c2;
+
+	p = buf;
+	once = 0;
+	c1 = 0;
+
+	for( ;;) {
+		switch( n = fgetc( fp)) {
+		case EOF:
+			return( 0);
+		case 0:			/* 0 = escape*/
+			switch( n = fgetc( fp)) {
+			case 0: 	/* 0 0 = end of current scan line*/
+				if( once)
+					put4( 0);
+				return( 1);
+			case 1:		/* 0 1 = end of data*/
+				if( once)
+					put4( 0);
+				return( 1);
+			case 2:		/* 0 2 xx yy delta mode NOT SUPPORTED*/
+				(void)fgetc( fp);
+				(void)fgetc( fp);
+				continue;
+			default:	/* 0 3..255 xx nn uncompressed data*/
+				c2 = (n+3) & ~3;
+				for( c=0; c<c2; c++) {
+					if( (c & 1) == 0)
+							c1 = fgetc( fp);
+					if( c < n)
+							put4( (c1 >> 4) & 0x0f);
+					c1 <<= 4;
+				}
+				continue;
+			}
+		default:
+			c = fgetc( fp);
+			c1 = (c >> 4) & 0x0f;
+			c2 = c & 0x0f;
+			for( c=0; c<n; c++)
+				put4( (c&1)? c2: c1);
+			continue;
+		}
+	}
+}
+#endif /* defined(HAVE_FILEIO) && defined(HAVE_BMP_SUPPORT)*/
+
+#if 0
+void print_image(PMWIMAGEHDR image)
+{
+	int i;
+
+	DPRINTF("Image:\n\n");
+	DPRINTF("height: %d\n", image->height);
+	DPRINTF("width: %d\n", image->width);
+	DPRINTF("planes: %d\n", image->planes);
+	DPRINTF("bpp: %d\n", image->bpp);
+	DPRINTF("compression: %d\n", image->compression);
+	DPRINTF("palsize: %d\n", image->palsize);
+
+	for (i=0;i<image->palsize;i++)
+		DPRINTF("palette: %d, %d, %d\n", image->palette[i].r,
+			image->palette[i].g, image->palette[i].b);
+
+	for(i=0;i<(image->width*image->height);i++)
+		DPRINTF("imagebits: %d\n", image->imagebits[i]);
+}
+#endif
+
+#if defined(HAVE_FILEIO) && defined(HAVE_GIF_SUPPORT)
+/* Code for GIF decoding has been adapted from XPaint:                   */
+/* +-------------------------------------------------------------------+ */
+/* | Copyright 1990, 1991, 1993 David Koblas.			       | */
+/* | Copyright 1996 Torsten Martinsen.				       | */
+/* |   Permission to use, copy, modify, and distribute this software   | */
+/* |   and its documentation for any purpose and without fee is hereby | */
+/* |   granted, provided that the above copyright notice appear in all | */
+/* |   copies and that both that copyright notice and this permission  | */
+/* |   notice appear in supporting documentation.  This software is    | */
+/* |   provided "as is" without express or implied warranty.	       | */
+/* +-------------------------------------------------------------------+ */
+/* Portions Copyright (C) 1999  Sam Lantinga*/
+/* Adapted for use in SDL by Sam Lantinga -- 7/20/98 */
+/*
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/* GIF stuff*/
+/*
+ * GIF decoding routine
+ */
+#define	MAXCOLORMAPSIZE		256
+#define	MAX_LWZ_BITS		12
+#define INTERLACE		0x40
+#define LOCALCOLORMAP		0x80
+
+#define CM_RED		0
+#define CM_GREEN	1
+#define CM_BLUE		2
+
+#define BitSet(byte, bit)	(((byte) & (bit)) == (bit))
+#define	ReadOK(file,buffer,len)	fread(buffer, len, 1, file)
+#define LM_to_uint(a,b)		(((b)<<8)|(a))
+
+struct {
+    unsigned int Width;
+    unsigned int Height;
+    unsigned char ColorMap[3][MAXCOLORMAPSIZE];
+    unsigned int BitPixel;
+    unsigned int ColorResolution;
+    unsigned int Background;
+    unsigned int AspectRatio;
+    int GrayScale;
+} GifScreen;
+
+static struct {
+    int transparent;
+    int delayTime;
+    int inputFlag;
+    int disposal;
+} Gif89;
+
+static int ReadColorMap(FILE* src, int number,
+		unsigned char buffer[3][MAXCOLORMAPSIZE], int *flag);
+static int DoExtension(FILE* src, int label);
+static int GetDataBlock(FILE* src, unsigned char *buf);
+static int GetCode(FILE* src, int code_size, int flag);
+static int LWZReadByte(FILE* src, int flag, int input_code_size);
+static int ReadImage(FILE* src, PMWIMAGEHDR pimage, int len, int height, int,
+		unsigned char cmap[3][MAXCOLORMAPSIZE],
+		int gray, int interlace, int ignore);
+
+static int
+LoadGIF(FILE *src, PMWIMAGEHDR pimage)
+{
+    unsigned char buf[16];
+    unsigned char c;
+    unsigned char localColorMap[3][MAXCOLORMAPSIZE];
+    int grayScale;
+    int useGlobalColormap;
+    int bitPixel;
+    int imageCount = 0;
+    char version[4];
+    int imageNumber = 1;
+    int ok = 0;
+
+    fseek(src, 0L, 0);
+    pimage->imagebits = NULL;
+    pimage->palette = NULL;
+
+    if (!ReadOK(src, buf, 6))
+        return 0;		/* not gif image*/
+    if (strncmp((char *) buf, "GIF", 3) != 0)
+        return 0;
+    strncpy(version, (char *) buf + 3, 3);
+    version[3] = '\0';
+
+    if (strcmp(version, "87a") != 0 && strcmp(version, "89a") != 0) {
+	EPRINTF("LoadGIF: GIF version number not 87a or 89a\n");
+        return 2;		/* image loading error*/
+    }
+    Gif89.transparent = -1;
+    Gif89.delayTime = -1;
+    Gif89.inputFlag = -1;
+    Gif89.disposal = 0;
+
+    if (!ReadOK(src, buf, 7)) {
+	EPRINTF("LoadGIF: bad screen descriptor\n");
+        return 2;		/* image loading error*/
+    }
+    GifScreen.Width = LM_to_uint(buf[0], buf[1]);
+    GifScreen.Height = LM_to_uint(buf[2], buf[3]);
+    GifScreen.BitPixel = 2 << (buf[4] & 0x07);
+    GifScreen.ColorResolution = (((buf[4] & 0x70) >> 3) + 1);
+    GifScreen.Background = buf[5];
+    GifScreen.AspectRatio = buf[6];
+
+    if (BitSet(buf[4], LOCALCOLORMAP)) {	/* Global Colormap */
+	if (ReadColorMap(src, GifScreen.BitPixel, GifScreen.ColorMap,
+			 &GifScreen.GrayScale)) {
+	    EPRINTF("LoadGIF: bad global colormap\n");
+            return 2;		/* image loading error*/
+	}
+    }
+
+    do {
+	if (!ReadOK(src, &c, 1)) {
+	    EPRINTF("LoadGIF: EOF on image data\n");
+            goto done;
+	}
+	if (c == ';') {		/* GIF terminator */
+	    if (imageCount < imageNumber) {
+		EPRINTF("LoadGIF: no image %d of %d\n", imageNumber,imageCount);
+                goto done;
+	    }
+	}
+	if (c == '!') {		/* Extension */
+	    if (!ReadOK(src, &c, 1)) {
+		EPRINTF("LoadGIF: EOF on extension function code\n");
+                goto done;
+	    }
+	    DoExtension(src, c);
+	    continue;
+	}
+	if (c != ',') {		/* Not a valid start character */
+	    continue;
+	}
+	++imageCount;
+
+	if (!ReadOK(src, buf, 9)) {
+	    EPRINTF("LoadGIF: bad image size\n");
+            goto done;
+	}
+	useGlobalColormap = !BitSet(buf[8], LOCALCOLORMAP);
+
+	bitPixel = 1 << ((buf[8] & 0x07) + 1);
+
+	if (!useGlobalColormap) {
+	    if (ReadColorMap(src, bitPixel, localColorMap, &grayScale)) {
+		EPRINTF("LoadGIF: bad local colormap\n");
+                goto done;
+	    }
+	    ok = ReadImage(src, pimage, LM_to_uint(buf[4], buf[5]),
+			      LM_to_uint(buf[6], buf[7]),
+			      bitPixel, localColorMap, grayScale,
+			      BitSet(buf[8], INTERLACE),
+			      imageCount != imageNumber);
+	} else {
+	    ok = ReadImage(src, pimage, LM_to_uint(buf[4], buf[5]),
+			      LM_to_uint(buf[6], buf[7]),
+			      GifScreen.BitPixel, GifScreen.ColorMap,
+			      GifScreen.GrayScale, BitSet(buf[8], INTERLACE),
+			      imageCount != imageNumber);
+	}
+    } while (ok == 0);
+
+    /* set transparent color, if any*/
+    pimage->transcolor = Gif89.transparent;
+
+    if (ok)
+	    return 1;		/* image load ok*/
+
+done:
+    if (pimage->imagebits)
+	    free(pimage->imagebits);
+    if (pimage->palette)
+	    free(pimage->palette);
+    return 2;			/* image load error*/
+}
+
+static int
+ReadColorMap(FILE *src, int number, unsigned char buffer[3][MAXCOLORMAPSIZE],
+    int *gray)
+{
+    int i;
+    unsigned char rgb[3];
+    int flag;
+
+    flag = TRUE;
+
+    for (i = 0; i < number; ++i) {
+	if (!ReadOK(src, rgb, sizeof(rgb)))
+	    return 1;
+	buffer[CM_RED][i] = rgb[0];
+	buffer[CM_GREEN][i] = rgb[1];
+	buffer[CM_BLUE][i] = rgb[2];
+	flag &= (rgb[0] == rgb[1] && rgb[1] == rgb[2]);
+    }
+
+#if 0
+    if (flag)
+	*gray = (number == 2) ? PBM_TYPE : PGM_TYPE;
+    else
+	*gray = PPM_TYPE;
+#else
+    *gray = 0;
+#endif
+
+    return FALSE;
+}
+
+static int
+DoExtension(FILE *src, int label)
+{
+    static unsigned char buf[256];
+
+    switch (label) {
+    case 0x01:			/* Plain Text Extension */
+	break;
+    case 0xff:			/* Application Extension */
+	break;
+    case 0xfe:			/* Comment Extension */
+	while (GetDataBlock(src, (unsigned char *) buf) != 0);
+	return FALSE;
+    case 0xf9:			/* Graphic Control Extension */
+	GetDataBlock(src, (unsigned char *) buf);
+	Gif89.disposal = (buf[0] >> 2) & 0x7;
+	Gif89.inputFlag = (buf[0] >> 1) & 0x1;
+	Gif89.delayTime = LM_to_uint(buf[1], buf[2]);
+	if ((buf[0] & 0x1) != 0)
+	    Gif89.transparent = buf[3];
+
+	while (GetDataBlock(src, (unsigned char *) buf) != 0);
+	return FALSE;
+    default:
+	break;
+    }
+
+    while (GetDataBlock(src, (unsigned char *) buf) != 0);
+
+    return FALSE;
+}
+
+static int ZeroDataBlock = FALSE;
+
+static int
+GetDataBlock(FILE *src, unsigned char *buf)
+{
+    unsigned char count;
+
+    if (!ReadOK(src, &count, 1))
+	return -1;
+    ZeroDataBlock = count == 0;
+
+    if ((count != 0) && (!ReadOK(src, buf, count)))
+	return -1;
+    return count;
+}
+
+static int
+GetCode(FILE *src, int code_size, int flag)
+{
+    static unsigned char buf[280];
+    static int curbit, lastbit, done, last_byte;
+    int i, j, ret;
+    unsigned char count;
+
+    if (flag) {
+	curbit = 0;
+	lastbit = 0;
+	done = FALSE;
+	return 0;
+    }
+    if ((curbit + code_size) >= lastbit) {
+	if (done) {
+	    if (curbit >= lastbit)
+		EPRINTF("LoadGIF: bad decode\n");
+	    return -1;
+	}
+	buf[0] = buf[last_byte - 2];
+	buf[1] = buf[last_byte - 1];
+
+	if ((count = GetDataBlock(src, &buf[2])) == 0)
+	    done = TRUE;
+
+	last_byte = 2 + count;
+	curbit = (curbit - lastbit) + 16;
+	lastbit = (2 + count) * 8;
+    }
+    ret = 0;
+    for (i = curbit, j = 0; j < code_size; ++i, ++j)
+	ret |= ((buf[i / 8] & (1 << (i % 8))) != 0) << j;
+
+    curbit += code_size;
+
+    return ret;
+}
+
+static int
+LWZReadByte(FILE *src, int flag, int input_code_size)
+{
+    int code, incode;
+    register int i;
+    static int fresh = FALSE;
+    static int code_size, set_code_size;
+    static int max_code, max_code_size;
+    static int firstcode, oldcode;
+    static int clear_code, end_code;
+    static int table[2][(1 << MAX_LWZ_BITS)];
+    static int stack[(1 << (MAX_LWZ_BITS)) * 2], *sp;
+
+    if (flag) {
+	set_code_size = input_code_size;
+	code_size = set_code_size + 1;
+	clear_code = 1 << set_code_size;
+	end_code = clear_code + 1;
+	max_code_size = 2 * clear_code;
+	max_code = clear_code + 2;
+
+	GetCode(src, 0, TRUE);
+
+	fresh = TRUE;
+
+	for (i = 0; i < clear_code; ++i) {
+	    table[0][i] = 0;
+	    table[1][i] = i;
+	}
+	for (; i < (1 << MAX_LWZ_BITS); ++i)
+	    table[0][i] = table[1][0] = 0;
+
+	sp = stack;
+
+	return 0;
+    } else if (fresh) {
+	fresh = FALSE;
+	do {
+	    firstcode = oldcode = GetCode(src, code_size, FALSE);
+	} while (firstcode == clear_code);
+	return firstcode;
+    }
+    if (sp > stack)
+	return *--sp;
+
+    while ((code = GetCode(src, code_size, FALSE)) >= 0) {
+	if (code == clear_code) {
+	    for (i = 0; i < clear_code; ++i) {
+		table[0][i] = 0;
+		table[1][i] = i;
+	    }
+	    for (; i < (1 << MAX_LWZ_BITS); ++i)
+		table[0][i] = table[1][i] = 0;
+	    code_size = set_code_size + 1;
+	    max_code_size = 2 * clear_code;
+	    max_code = clear_code + 2;
+	    sp = stack;
+	    firstcode = oldcode = GetCode(src, code_size, FALSE);
+	    return firstcode;
+	} else if (code == end_code) {
+	    int count;
+	    unsigned char buf[260];
+
+	    if (ZeroDataBlock)
+		return -2;
+
+	    while ((count = GetDataBlock(src, buf)) > 0);
+
+	    if (count != 0) {
+		/*
+		 * EPRINTF("missing EOD in data stream (common occurence)");
+		 */
+	    }
+	    return -2;
+	}
+	incode = code;
+
+	if (code >= max_code) {
+	    *sp++ = firstcode;
+	    code = oldcode;
+	}
+	while (code >= clear_code) {
+	    *sp++ = table[1][code];
+	    if (code == table[0][code])
+		EPRINTF("LoadGIF: circular table entry\n");
+	    code = table[0][code];
+	}
+
+	*sp++ = firstcode = table[1][code];
+
+	if ((code = max_code) < (1 << MAX_LWZ_BITS)) {
+	    table[0][code] = oldcode;
+	    table[1][code] = firstcode;
+	    ++max_code;
+	    if ((max_code >= max_code_size) &&
+		(max_code_size < (1 << MAX_LWZ_BITS))) {
+		max_code_size *= 2;
+		++code_size;
+	    }
+	}
+	oldcode = incode;
+
+	if (sp > stack)
+	    return *--sp;
+    }
+    return code;
+}
+
+static int
+ReadImage(FILE* src, PMWIMAGEHDR pimage, int len, int height, int cmapSize,
+	  unsigned char cmap[3][MAXCOLORMAPSIZE],
+	  int gray, int interlace, int ignore)
+{
+    unsigned char c;
+    int i, v;
+    int xpos = 0, ypos = 0, pass = 0;
+
+    /*
+     *	Initialize the compression routines
+     */
+    if (!ReadOK(src, &c, 1)) {
+	EPRINTF("LoadGIF: EOF on image data\n");
+	return 0;
+    }
+    if (LWZReadByte(src, TRUE, c) < 0) {
+	EPRINTF("LoadGIF: error reading image\n");
+	return 0;
+    }
+
+    /*
+     *	If this is an "uninteresting picture" ignore it.
+     */
+    if (ignore) {
+	while (LWZReadByte(src, FALSE, c) >= 0);
+	return 0;
+    }
+    /*image = ImageNewCmap(len, height, cmapSize);*/
+    pimage->width = len;
+    pimage->height = height;
+    pimage->planes = 1;
+    pimage->bpp = 8;
+    ComputePitch(8, len, &pimage->pitch, &pimage->bytesperpixel);
+    pimage->compression = 0;
+    pimage->palsize = cmapSize;
+    pimage->palette = malloc(256*sizeof(MWPALENTRY));
+    pimage->imagebits = malloc(height*pimage->pitch);
+    if(!pimage->imagebits || !pimage->palette)
+	    return 0;
+
+    for (i = 0; i < cmapSize; i++) {
+	/*ImageSetCmap(image, i, cmap[CM_RED][i],
+		     cmap[CM_GREEN][i], cmap[CM_BLUE][i]);*/
+	pimage->palette[i].r = cmap[CM_RED][i];
+	pimage->palette[i].g = cmap[CM_GREEN][i];
+	pimage->palette[i].b = cmap[CM_BLUE][i];
+    }
+
+    while ((v = LWZReadByte(src, FALSE, c)) >= 0) {
+	pimage->imagebits[ypos * pimage->pitch + xpos] = v;
+
+	++xpos;
+	if (xpos == len) {
+	    xpos = 0;
+	    if (interlace) {
+		switch (pass) {
+		case 0:
+		case 1:
+		    ypos += 8;
+		    break;
+		case 2:
+		    ypos += 4;
+		    break;
+		case 3:
+		    ypos += 2;
+		    break;
+		}
+
+		if (ypos >= height) {
+		    ++pass;
+		    switch (pass) {
+		    case 1:
+			ypos = 4;
+			break;
+		    case 2:
+			ypos = 2;
+			break;
+		    case 3:
+			ypos = 1;
+			break;
+		    default:
+			goto fini;
+		    }
+		}
+	    } else {
+		++ypos;
+	    }
+	}
+	if (ypos >= height)
+	    break;
+    }
+
+fini:
+    return 1;
+}
+#endif /* defined(HAVE_FILEIO) && defined(HAVE_GIF_SUPPORT)*/
+
+#if defined(HAVE_FILEIO) && defined(HAVE_PNM_SUPPORT)
+enum {
+	PNM_TYPE_NOTPNM,
+	PNM_TYPE_PBM,
+	PNM_TYPE_PGM,
+	PNM_TYPE_PPM
+};
+static int LoadPNM(FILE *fp, PMWIMAGEHDR pimage)
+{
+	char buf[256], *p;
+	int type = PNM_TYPE_NOTPNM, binary = 0, gothdrs = 0, scale = 0;
+	int ch, x = 0, y = 0, i, n, mask, col1, col2, col3;
+
+	fseek(fp, 0L, 0);
+
+	if(!fgets(buf, 4, fp)) return 0;
+
+	if(!strcmp("P1\n", buf)) type = PNM_TYPE_PBM;
+	else if(!strcmp("P2\n", buf)) type = PNM_TYPE_PGM;
+	else if(!strcmp("P3\n", buf)) type = PNM_TYPE_PPM;
+	else if(!strcmp("P4\n", buf)) {
+		type = PNM_TYPE_PBM;
+		binary = 1;
+	}
+	else if(!strcmp("P5\n", buf)) {
+		type = PNM_TYPE_PGM;
+		binary = 1;
+	}
+	else if(!strcmp("P6\n", buf)) {
+		type = PNM_TYPE_PPM;
+		binary = 1;
+	}
+
+	if(type == PNM_TYPE_NOTPNM) return 0;
+
+	n = 0;
+	while((p = fgets(buf, 256, fp))) {
+		if(*buf == '#') continue;
+		if(type == PNM_TYPE_PBM) {
+			if(sscanf(buf, "%i %i", &pimage->width,
+					&pimage->height) == 2) {
+				pimage->bpp = 1;
+				gothdrs = 1;
+				if(!(pimage->palette = malloc(
+						sizeof(MWPALENTRY) * 2))) {
+					EPRINTF("Out of memory\n");
+					return 2;
+				}
+				pimage->palsize = 2;
+				pimage->palette[0].r = 0xff;
+				pimage->palette[0].g = 0xff;
+				pimage->palette[0].b = 0xff;
+				pimage->palette[1].r = 0;
+				pimage->palette[1].g = 0;
+				pimage->palette[1].b = 0;
+			}
+			break;
+		}
+		if((type == PNM_TYPE_PGM) || (type == PNM_TYPE_PPM)) {
+			if(!n++) {
+				if(sscanf(buf, "%i %i", &pimage->width,
+					&pimage->height) != 2) break;
+			} else {
+				if(sscanf(buf, "%i", &i) != 1) break;
+				pimage->bpp = 24;
+				if(i > 255) {
+					EPRINTF("LoadPNM: PPM files must be "
+						"24bpp\n");
+					return 2;
+				}
+				for(scale = 7, n = 2; scale; scale--, n *= 2)
+					if(i < n) break;
+				gothdrs = 1;
+				break;
+			}
+		}
+	}
+
+	if(!gothdrs) {
+		EPRINTF("LoadPNM: bad image headers\n");
+		if(pimage->palette) free(pimage->palette);
+		return 2;
+	}
+
+	pimage->planes = 1;
+	ComputePitch(pimage->bpp, pimage->width, &pimage->pitch,
+						&pimage->bytesperpixel);
+	pimage->compression = MWIMAGE_RGB;
+	if(!(pimage->imagebits = malloc(pimage->pitch * pimage->height))) {
+		EPRINTF("LoadPNM: couldn't allocate memory for image\n");
+		if(pimage->palette) free(pimage->palette);
+		return 2;
+	}
+
+	p = pimage->imagebits;
+
+	if(type == PNM_TYPE_PBM) {
+		if(binary) {
+			x = 0;
+			y = 0;
+			while((ch = fgetc(fp)) != EOF) {
+				for(i = 0; i < 8; i++) {
+					mask = 0x80 >> i;
+					if(ch & mask) *p |= mask;
+					else *p &= ~mask;
+					if(++x == pimage->width) {
+						if(++y == pimage->height)
+							return 1;
+						p = pimage->imagebits - 1 +
+							(y * pimage->pitch);
+						x = 0;
+						break;
+					}
+				}
+				p++;
+			}
+		} else {
+			n = 0;
+			while((ch = fgetc(fp)) != EOF) {
+				if(isspace(ch)) continue;
+				mask = 0x80 >> n;
+				if(ch == '1') *p |= mask;
+				else if(ch == '0') *p &= ~mask;
+				else goto baddata;
+				if(++n == 8) {
+					n = 0;
+					p++;
+				}
+				if(++x == pimage->width) {
+					if(++y == pimage->height)
+						return 1;
+					p = pimage->imagebits +
+						(y * pimage->pitch);
+					n = 0;
+					x = 0;
+				}
+			}
+		}
+	} else {
+		while(1) {
+			if(type == PNM_TYPE_PGM) {
+				if(binary) {
+					if((ch = fgetc(fp)) == EOF)
+						goto baddata;
+				} else {
+					if(fscanf(fp, "%i", &ch) != 1)
+						goto baddata;
+				}
+				*p++ = ch << scale;
+				*p++ = ch << scale;
+				*p++ = ch << scale;
+			} else {
+				if(binary) {
+					if(((col1 = fgetc(fp)) == EOF) ||
+					 	((col2 = fgetc(fp)) == EOF) ||
+					 	((col3 = fgetc(fp)) == EOF))
+						goto baddata;
+				} else {
+					if(fscanf(fp, "%i %i %i", &col1, &col2,
+								&col3) != 3)
+						goto baddata;
+				}
+				*p++ = col1 << scale;
+				*p++ = col2 << scale;
+				*p++ = col3 << scale;
+			}
+			if(++x == pimage->width) {
+				if(++y == pimage->height) return 1;
+				p = pimage->imagebits + (y * pimage->pitch);
+				x = 0;
+			}
+		}
+	}
+
+baddata:
+	EPRINTF("LoadPNM: bad image data\n");
+	free(pimage->imagebits);
+	if(pimage->palette) free(pimage->palette);
+	return 2;
+}
+#endif /* defined(HAVE_FILEIO) && defined(HAVE_PNM_SUPPORT) */
+
+#if defined(HAVE_FILEIO) && defined(HAVE_XPM_SUPPORT)
+struct xpm_cmap {
+  char mapstr[3];
+  long palette_entry;
+  long color;
+  struct xpm_cmap *next;
+};
+
+ 
+static long XPM_parse_color(char *color)
+{
+  /* This will parse the string into a color value of some sort */
+
+  if (color[0] != '#')
+    {
+      if (!strcmp(color, "None"))
+	return(-1); /* Transparent */
+      else
+	return(0); /* If its an X color, then we bail */
+    }
+  else
+    {
+      /* This is ugly! */
+
+      char *sptr = color + 1;
+      char rstr[5], gstr[5], bstr[5];
+      long r,g,b;
+
+      switch(strlen(sptr))
+	{
+	case 6:
+	  return(strtol(sptr, NULL, 16));
+
+	case 9: /* RRRGGGBBB */
+	  strncpy(rstr, sptr, 3);
+	  strncpy(gstr, sptr + 3, 3);
+	  strncpy(bstr, sptr + 6, 3);
+
+	  rstr[3] = 0;
+	  gstr[3] = 0;
+	  bstr[3] = 0;
+
+	  r = strtol(rstr, NULL, 16) >> 4;
+	  g = strtol(gstr, NULL, 16) >> 4;
+	  b = strtol(bstr, NULL, 16) >> 4;
+
+	  return( (long) ( r << 16 | g << 8 | b));
+
+	case 12:
+	  strncpy(rstr, sptr, 4);
+	  strncpy(gstr, sptr + 4, 4);
+	  strncpy(bstr, sptr + 8, 4);
+	  
+	  rstr[4] = 0;
+	  gstr[4] = 0;
+	  bstr[4] = 0;
+
+	  r = strtol(rstr, NULL, 16) >> 8;
+	  g = strtol(gstr, NULL, 16) >> 8;
+	  b = strtol(bstr, NULL, 16) >> 8;
+	  
+	  return( (long) ( (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF)));
+	}
+    }
+
+  return(0);
+}
+
+/* A series of status indicators that let us know whats going on */
+/* It could be an enum if you want */
+
+#define LOAD_HEADER 1
+#define LOAD_COLORS 2
+#define LOAD_PALETTE 3
+#define LOAD_PIXELS 4
+#define LOAD_DONE 5
+
+/* The magic that "should" indicate an XPM (does it really?) */
+#define XPM_MAGIC "/* XPM */"
+#define XPM_TRANSCOLOR 0x01000000
+
+static int LoadXPM(FILE *fp, PMWIMAGEHDR pimage, PSD psd) 
+{
+  struct xpm_cmap *colorheap = 0;  /* A "heap" of color structs */
+  struct xpm_cmap *colormap[256];  /* A quick hash of 256 spots for colors */
+  
+  unsigned char *imageptr = 0;
+
+  MWSCREENINFO sinfo;
+
+  char xline[300];
+  char dline[300];
+
+  char *c;
+  int a;
+
+  int col, row, colors, cpp;
+  int in_color = 0;
+  int read_xline = 0;
+
+  int status = LOAD_HEADER;
+
+  /* Very first thing, get the screen info */
+  GdGetScreenInfo(psd, &sinfo);
+
+  for(a = 0; a < 256; a++)
+    colormap[a] = 0;
+
+  pimage->imagebits = NULL;
+  pimage->palette = NULL;
+
+  /* Start over at the beginning with the file */
+  rewind(fp);
+
+  fgets(xline, 300, fp);
+  /* Chop the EOL */
+  xline[strlen(xline) - 1] = 0;
+
+  /* Check the magic */
+  if (strncmp(xline, XPM_MAGIC, sizeof(XPM_MAGIC))) return(0);
+
+  while(!feof(fp))
+    {
+      /* Get the next line from the file */
+      fgets(xline, 300, fp);
+      xline[strlen(xline) - 1] = 0;
+
+      /* Check it out */
+      if (xline[0] == '/' && xline[1] == '*') /* Comment */
+	continue;
+
+      if (xline[0] != '\"')
+	continue;
+
+      /* remove the quotes from the line */
+      for(c = xline + 1, a = 0; *c != '\"' && *c != 0; c++, a++)
+	dline[a] = *c;
+
+      dline[a] = 0;
+
+      /* Is it the header? */
+      if (status == LOAD_HEADER)
+	{
+	  sscanf(dline, "%i %i %i %i", &col, &row, &colors, &cpp);
+
+	  pimage->width = col;
+	  pimage->height = row;
+	  pimage->planes = 1;
+
+	  if (sinfo.bpp <= 8)
+	    {
+	      pimage->bpp = sinfo.bpp;
+	      pimage->compression = 0;
+	      pimage->transcolor = -1;
+	    }
+	  else
+	    {
+	      pimage->bpp = 32;
+	      pimage->transcolor = XPM_TRANSCOLOR;
+	      pimage->compression = MWIMAGE_BGR;	  
+	    }
+
+	  pimage->palsize = colors;
+
+	  ComputePitch(pimage->bpp, col, &pimage->pitch, &pimage->bytesperpixel);
+
+	  pimage->imagebits = malloc(pimage->pitch * pimage->height); 
+	  imageptr = (unsigned char *) pimage->imagebits;
+
+	  /* Allocate enough room for all the colors */
+	  colorheap = (struct xpm_cmap *) malloc(colors * sizeof(struct xpm_cmap));
+
+	  /* Allocate the palette space (if required) */
+
+	  if (sinfo.bpp <= 8)
+	      pimage->palette = malloc(256*sizeof(MWPALENTRY));
+
+	  if (!colorheap)
+	    {
+	      EPRINTF("Couldn't allocate any memory for the colors\n");
+	      return(0);
+	    }
+
+	  status = LOAD_COLORS;
+	  in_color = 0;
+	  continue;
+	}
+
+      /* Are we in load colors? */
+      if (status == LOAD_COLORS)
+	{
+	  struct xpm_cmap *n;
+
+	  char tstr[5];
+	  char cstr[256];
+
+	  unsigned char m;
+
+	  c = dline;
+
+	  /* Go at at least 1 charater, and then count until we have
+	     two spaces in a row */
+
+	  strncpy(tstr, c, cpp);
+
+	  c += cpp;	  
+	  for(; *c == '\t' || *c == ' '; c++); /* Skip over whitespace */
+
+	  /* FIXME: We assume that a 'c' follows.  What if it doesn't? */
+	  c +=2;
+	  
+	  tstr[cpp] = 0;
+
+	  /* Now we put it into the array for easy lookup   */
+	  /* We base it off the first charater, even though */
+	  /* there may be up to 4                           */
+
+	  m = tstr[0];
+	  
+	  if (colormap[m])
+	    {
+	      n = colormap[m];
+	      
+	      while(n->next) n = n->next;
+	      n->next = &colorheap[in_color];
+	      n = n->next;
+	    }
+	  else
+	    {
+	      colormap[m] = &colorheap[in_color];
+	      n = colormap[m];
+	    }
+	  
+	  n->next = 0;
+
+	  /* Record the string */
+	  strncpy(n->mapstr, tstr, cpp);
+	  n->mapstr[cpp] = 0;
+
+	  /* Now record the palette entry */
+	  n->palette_entry = (long) in_color;
+
+	  /* This is the color */
+	  sscanf(c, "%65535s", cstr);
+
+	  /* Turn it into a real value */
+	  n->color = XPM_parse_color(cstr);
+
+	  /* If we are in palette mode, then we need to */
+	  /* load the palette (duh..) */
+
+	  if (sinfo.bpp <= 8)
+	    {
+	      if (n->color == -1)
+		{
+		  pimage->transcolor = in_color;
+		  n->color = -1;
+		}
+		
+	      pimage->palette[in_color].r = (n->color >> 16) & 0xFF;
+	      pimage->palette[in_color].g = (n->color >> 8) & 0xFF;
+	      pimage->palette[in_color].b = n->color & 0xFF;  
+	    }
+	  else
+	    {
+	      if (n->color == -1)
+		n->color = XPM_TRANSCOLOR;
+	    }
+
+	  if (++in_color == colors)
+	    {
+	      read_xline = 0;
+	      status = LOAD_PIXELS;
+	    }
+
+	  continue;	 
+	}
+      
+      if (status == LOAD_PIXELS)
+      {
+	int bytecount = 0;
+	int bitcount = 0;
+	long dwordcolor = 0;
+	int i;
+	char pxlstr[3];
+
+	c = dline;
+	
+	while(*c)
+	  {
+	    unsigned char z = 0;
+
+	    if (cpp == 1)
+	      {		
+		z = *c;
+		
+		if (!colormap[z])
+		  {
+		    EPRINTF("No color entry for (%c)\n", z);
+		    return(0);
+		  }
+
+		if (sinfo.bpp <= 8)
+		  dwordcolor = (long) colormap[z]->palette_entry;
+		else
+		  dwordcolor = colormap[z]->color;	
+
+		c++;
+	      }
+	    else
+	      {
+		struct xpm_cmap *n; 
+
+		/* We grab the largest possible, and then compare */
+
+		strncpy(pxlstr, c, cpp);
+		z = pxlstr[0];
+
+		if (!colormap[z])
+		  {
+		    EPRINTF("No color entry for (%s)\n", pxlstr);
+		    return(0);
+		  }
+			
+		n = colormap[z];
+
+		while(n)
+		  {
+		    if (!strncmp(n->mapstr, pxlstr, cpp))
+		      break;
+
+		    n = n->next;
+		  }
+
+		if (!n)
+		  {
+		    EPRINTF("No color found for (%s)\n", pxlstr);	    
+		    return(0);
+		  }
+
+		if (sinfo.bpp <= 8)
+		  dwordcolor = (long) n->palette_entry;
+		else
+		  dwordcolor = n->color;
+		
+		c += cpp;
+	      }
+
+	    /* 
+	     * This ugly thing is needed to ensure that we
+	     * work well in all modes.
+	     */
+	    switch(sinfo.bpp)
+	      {
+	      case 2:
+		if (bitcount == 0)
+		  imageptr[0] = 0;
+		
+		imageptr[0] |= (dwordcolor & 0x3) << (4 - bitcount);
+		bitcount++;
+		
+		if (bitcount == 4)
+		  {
+		    imageptr++;
+		    bytecount += pimage->bytesperpixel;
+		    bitcount = 0;
+		  }
+		
+		break;
+
+	      case 4:
+		if (bitcount == 0)
+		  imageptr[0] = 0;
+		
+		imageptr[0] |= (dwordcolor & 0xF) << (2 - bitcount);
+		bitcount++;
+		
+		if (bitcount == 2)
+		  {
+		    imageptr++;
+		    bytecount += pimage->bytesperpixel;
+		    bitcount = 0;
+		  }
+		
+		break;
+
+	      case 8:
+	      case 16:
+	      case 24:
+	      case 32:
+	      
+		for(i = 0; i < pimage->bytesperpixel; i++)
+		  imageptr[i] = (dwordcolor >> (8 * i)) & 0xFF;
+		
+		imageptr += pimage->bytesperpixel;
+		bytecount += pimage->bytesperpixel;
+		break;
+
+#ifdef NOTUSED
+	      case 8:
+		imageptr[0] = (unsigned char) (dwordcolor & 0xFF);
+		imageptr += pimage->bytesperpixel;
+		bytecount += pimage->bytesperpixel;
+		break;
+
+	      case 16:
+	      case 24:
+	      case 32:
+		imageptr[0] = (unsigned char) (dwordcolor >> 24) & 0xFF;
+		imageptr[1] = (unsigned char) (dwordcolor >> 16) & 0xFF;
+		imageptr[2] = (unsigned char) (dwordcolor >> 8) & 0xFF;
+		imageptr[3] = (unsigned char) (dwordcolor & 0xFF);
+		imageptr += pimage->bytesperpixel;
+		bytecount += pimage->bytesperpixel;
+		break;
+#endif
+	      }
+	  }
+
+	/* Pad to the end of the line */
+	if (bytecount < pimage->pitch)
+	  for(i = 0; i < (pimage->pitch - bytecount); i++)
+	    *imageptr++ = 0x00;
+
+	read_xline++;
+	
+	if (read_xline == row)
+	  status = LOAD_DONE;
+
+	continue;
+      }
+    }
+
+  free(colorheap);
+
+  if (status != LOAD_DONE)
+    return(-1);
+  return(1);
+}
+#endif /* defined(HAVE_FILEIO) && defined(HAVE_XPM_SUPPORT)*/
+
+#endif /* defined(HAVE_FILEIO)*/
diff -urN lib/microwindows/src/engine/devkbd.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devkbd.c
--- lib/microwindows/src/engine/devkbd.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devkbd.c	2005-02-21 16:03:22.000000000 +0100
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Device-independent keyboard routines
+ */
+#include "device.h"
+
+/*
+ * Open the keyboard.
+ */
+int
+GdOpenKeyboard(void)
+{
+	int	fd;
+
+	if ((fd = kbddev.Open(&kbddev)) == -1)
+		return -1;
+
+	/* possible -2 return means no kbd*/
+	return fd;
+}
+
+/*
+ * Close the keyboard.
+ */
+void
+GdCloseKeyboard(void)
+{
+	kbddev.Close();
+}
+
+/*
+ * Return the possible modifiers for the keyboard.
+ */
+void
+GdGetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers)
+{
+	kbddev.GetModifierInfo(modifiers, curmodifiers);
+}
+
+/*
+ * This reads one keystroke from the keyboard, and the current state of
+ * the mode keys (ALT, SHIFT, CTRL).  Returns -1 on error, 0 if no data
+ * is ready, 1 if keypress, 2 if keyrelease.
+ * This is a non-blocking call.  Returns -2 if ESC pressed.
+ */
+int
+GdReadKeyboard(MWKEY *buf, MWKEYMOD *modifiers, MWSCANCODE *scancode)
+{
+	return kbddev.Read(buf, modifiers, scancode);
+}
diff -urN lib/microwindows/src/engine/devlist.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devlist.c
--- lib/microwindows/src/engine/devlist.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devlist.c	2005-02-21 16:03:22.000000000 +0100
@@ -0,0 +1,59 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "device.h"
+/*
+ * linked list routines
+ *
+ * 1/28/98 g haerr
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ */
+
+void *
+GdItemAlloc(unsigned int size)
+{
+	return (void *)calloc(size, 1);
+}
+
+/* insert at tail of list*/
+void
+GdListAdd(PMWLISTHEAD pHead,PMWLIST pItem)
+{
+	if( pHead->tail) {
+		pItem->prev = pHead->tail;
+		pHead->tail->next = pItem;
+	} else
+		pItem->prev = NULL;
+	pItem->next = NULL;
+	pHead->tail = pItem;
+	if( !pHead->head)
+		pHead->head = pItem;
+}
+
+/* insert at head of list*/
+void
+GdListInsert(PMWLISTHEAD pHead,PMWLIST pItem)
+{
+	if( pHead->head) {
+		pItem->next = pHead->head;
+		pHead->head->prev = pItem;
+	} else
+		pItem->next = NULL;
+	pItem->prev = NULL;
+	pHead->head = pItem;
+	if( !pHead->head)
+		pHead->head = pItem;
+}
+
+void
+GdListRemove(PMWLISTHEAD pHead,PMWLIST pItem)
+{
+	if( pItem->next)
+		pItem->next->prev = pItem->prev;
+	if( pItem->prev)
+		pItem->prev->next = pItem->next;
+	if( pHead->head == pItem)
+		pHead->head = pItem->next;
+	if( pHead->tail == pItem)
+		pHead->tail = pItem->prev;
+	pItem->next = pItem->prev = NULL;
+}
diff -urN lib/microwindows/src/engine/devmouse.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devmouse.c
--- lib/microwindows/src/engine/devmouse.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devmouse.c	2005-02-21 16:13:14.000000000 +0100
@@ -0,0 +1,449 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (C) 1999 Bradley D. LaRonde (brad@ltc.com)
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Device-independent top level mouse and cursor routines
+ *
+ * Reads data from mouse driver and tracks real position on the screen.
+ * Intersection detection for cursor with auto removal
+ *
+ * Bradley D. LaRonde added absolute coordinates and z (pen pressure) Oct-1999
+ */
+#include <string.h>
+#include "device.h"
+
+/*
+ * The following define specifies whether returned mouse
+ * driver coordinates are adjusted when running in portrait
+ * mode.  If the mouse driver doesn't adjust returned values
+ * when in portrait mode (as is the case for the iPAQ), then
+ * this define should be set on.
+ */
+#define FLIP_MOUSE_IN_PORTRAIT_MODE	1
+
+static MWCOORD	xpos;		/* current x position of mouse */
+static MWCOORD	ypos;		/* current y position of mouse */
+static MWCOORD	minx;		/* minimum allowed x position */
+static MWCOORD	maxx;		/* maximum allowed x position */
+static MWCOORD	miny;		/* minimum allowed y position */
+static MWCOORD	maxy;		/* maximum allowed y position */
+static int	scale;		/* acceleration scale factor */
+static int	thresh;		/* acceleration threshhold */
+static int	buttons;	/* current state of buttons */
+static MWBOOL	changed;	/* mouse state has changed */
+
+static MWCOORD 	curminx;	/* minimum x value of cursor */
+static MWCOORD 	curminy;	/* minimum y value of cursor */
+static MWCOORD 	curmaxx;	/* maximum x value of cursor */
+static MWCOORD 	curmaxy;	/* maximum y value of cursor */
+static int	curvisible;	/* >0 if cursor is visible*/
+static MWBOOL 	curneedsrestore;/* cursor needs restoration after drawing*/
+static MWCOORD 	cursavx;	/* saved cursor location*/
+static MWCOORD 	cursavy;
+static MWCOORD	cursavx2;
+static MWCOORD	cursavy2;
+static MWPIXELVAL curfg;		/* foreground color of cursor */
+static MWPIXELVAL curbg;		/* background color of cursor */
+static MWPIXELVAL cursavbits[MWMAX_CURSOR_SIZE * MWMAX_CURSOR_SIZE];
+static MWIMAGEBITS cursormask[MWMAX_CURSOR_SIZE];
+static MWIMAGEBITS cursorcolor[MWMAX_CURSOR_SIZE];
+
+extern int gr_mode;
+extern int gr_portraitmode;
+
+/*
+ * Initialize the mouse.
+ * This sets its position to (0, 0) with no boundaries and no buttons pressed.
+ * Returns < 0 on error, or mouse fd on success
+ */
+int
+GdOpenMouse(void)
+{
+	int fd;
+
+	/* init mouse position info*/
+	buttons = 0;
+	xpos = 0;
+	ypos = 0;
+	minx = MIN_MWCOORD;
+	miny = MIN_MWCOORD;
+	maxx = MAX_MWCOORD;
+	maxy = MAX_MWCOORD;
+	changed = TRUE;
+
+	/* init cursor position and size info*/
+	curvisible = 0;
+	curneedsrestore = FALSE;
+	curminx = minx;
+	curminy = miny;
+	curmaxx = curminx + MWMAX_CURSOR_SIZE - 1;
+	curmaxy = curminy + MWMAX_CURSOR_SIZE - 1;
+
+	if ((fd = mousedev.Open(&mousedev)) == -1)
+		return -1;
+
+	/* get default acceleration settings*/
+	mousedev.GetDefaultAccel(&scale, &thresh);
+
+	/* handle null mouse driver by hiding cursor*/
+	if(fd == -2)
+		GdHideCursor(&scrdev);
+	return fd;
+}
+
+/*
+ * Terminate the use of the mouse.
+ */
+void
+GdCloseMouse(void)
+{
+	mousedev.Close();
+}
+
+void
+GdGetButtonInfo(int *buttons)
+{
+	*buttons = mousedev.GetButtonInfo();
+}
+
+/*
+ * Restrict the coordinates of the mouse to the specified coordinates.
+ */
+void
+GdRestrictMouse(MWCOORD newminx, MWCOORD newminy, MWCOORD newmaxx,
+	MWCOORD newmaxy)
+{
+	minx = newminx;
+	miny = newminy;
+	maxx = newmaxx;
+	maxy = newmaxy;
+	GdMoveMouse(xpos, ypos);
+}
+
+/*
+ * Set the acceleration threshhold and scale factors.
+ * Acceleration makes the cursor move further for faster movements.
+ * Basically, at mouse speeds above the threshold, the excess distance
+ * moved is multiplied by the scale factor.  For example, with a threshhold
+ * of 5 and a scale of 3, the following gives examples of the original and
+ * modified mouse movements:
+ *	input:		0	4	5	6	9	20
+ *	output:		0	4	5	8	17	50
+ */
+void
+GdSetAccelMouse(int newthresh, int newscale)
+{
+	if (newthresh < 0)
+		newthresh = 0;
+	if (newscale < 0)
+		newscale = 0;
+	thresh = newthresh;
+	scale = newscale;
+}
+
+/*
+ * Move the mouse to the specified coordinates.
+ * The location is limited by the current mouse coordinate restrictions.
+ */
+void
+GdMoveMouse(MWCOORD newx, MWCOORD newy)
+{
+	if (newx < minx)
+		newx = minx;
+	if (newx > maxx)
+		newx = maxx;
+	if (newy < miny)
+		newy = miny;
+	if (newy > maxy)
+		newy = maxy;
+	if (newx == xpos && newy == ypos)
+		return;
+
+	changed = TRUE;
+	xpos = newx;
+	ypos = newy;
+}
+
+/*
+ * Read the current location and button states of the mouse.
+ * Returns -1 on read error.
+ * Returns 0 if no new data is available from the mouse driver,
+ * or if the new data shows no change in button state or position.
+ * Returns 1 if the mouse driver tells us a changed button state
+ * or position. Button state and position are always both returned,
+ * even if only one or the other changes.
+ * Do not block.
+ */
+int
+GdReadMouse(MWCOORD *px, MWCOORD *py, int *pb)
+{
+	MWCOORD	x, y, z;
+	int	newbuttons;	/* new button state */
+	int	sign;		/* sign of change */
+	int	status;		/* status of reading mouse */
+
+	*px = xpos;
+	*py = ypos;
+	*pb = buttons;
+
+	if (changed) {
+		changed = FALSE;
+		return 1;
+	}
+
+	/* read the mouse position */
+	status = mousedev.Read(&x, &y, &z, &newbuttons);
+	if (status < 0)
+		return -1;
+
+	/* no new info from the mouse driver? */
+	if (status == 0)
+		return 0;
+
+	/* has the button state changed? */
+	if (buttons != newbuttons) {
+		changed = TRUE;
+		buttons = newbuttons;
+	}
+
+	/* depending on the kind of data that we have */
+	switch(status) {
+	case 1:	/* relative position change reported, figure new position */
+		sign = 1;
+		if (x < 0) {
+			sign = -1;
+			x = -x;
+		}
+		if (x > thresh)
+			x = thresh + (x - thresh) * scale;
+		x *= sign;
+
+		sign = 1;
+		if (y < 0) {
+			sign = -1;
+			y = -y;
+		}
+		if (y > thresh)
+			y = thresh + (y - thresh) * scale;
+		y *= sign;
+
+#if FLIP_MOUSE_IN_PORTRAIT_MODE
+		if (gr_portraitmode == 2)
+			GdMoveMouse(xpos + y, ypos - x);	/* right*/
+		else if (gr_portraitmode == 1)
+			GdMoveMouse(xpos - y, ypos + x);	/* left*/
+		else 
+#endif
+			GdMoveMouse(xpos + x, ypos + y);
+		break;
+
+	case 2:	/* absolute position reported */
+#if FLIP_MOUSE_IN_PORTRAIT_MODE
+		if (gr_portraitmode == 2)
+			GdMoveMouse(y, scrdev.xres - x - 1);	/* right*/
+		else if (gr_portraitmode == 1)
+			GdMoveMouse(scrdev.yres - y - 1, x);	/* left*/
+		else 
+#endif
+			GdMoveMouse(x, y);
+		break;
+
+	case 3:	/* only button data is available */
+		break;
+	}
+ 
+	/* didn't anything change? */
+	if (!changed)
+		return 0;
+
+	/* report new mouse data */
+	changed = FALSE;
+	*px = xpos;
+	*py = ypos;
+	*pb = buttons;
+	return 1;
+}
+
+/*
+ * Set the cursor position.
+ */
+void
+GdMoveCursor(MWCOORD newx, MWCOORD newy)
+{
+	MWCOORD shiftx;
+	MWCOORD shifty;
+
+	shiftx = newx - curminx;
+	shifty = newy - curminy;
+	if(shiftx == 0 && shifty == 0)
+		return;
+	curminx += shiftx;
+	curmaxx += shiftx;
+	curminy += shifty;
+	curmaxy += shifty;
+
+	/* Restore the screen under the mouse pointer*/
+	GdHideCursor(&scrdev);
+
+	/* Draw the new pointer*/
+	GdShowCursor(&scrdev);
+}
+
+/* return current mouse position in x, y*/
+MWBOOL
+GdGetCursorPos(MWCOORD *px, MWCOORD *py)
+{
+	*px = xpos;
+	*py = ypos;
+	return curvisible > 0;	/* return TRUE if visible*/
+}
+
+/*
+ * Set the cursor size and bitmaps.
+ */
+void
+GdSetCursor(PMWCURSOR pcursor)
+{
+	int	bytes;
+
+	GdHideCursor(&scrdev);
+	curmaxx = curminx + pcursor->width - 1;
+	curmaxy = curminy + pcursor->height - 1;
+
+	curfg = GdFindColor(pcursor->fgcolor);
+	curbg = GdFindColor(pcursor->bgcolor);
+	bytes = MWIMAGE_WORDS(pcursor->width) * pcursor->height
+			* sizeof(MWIMAGEBITS);
+	memcpy(cursorcolor, pcursor->image, bytes);
+	memcpy(cursormask, pcursor->mask, bytes);
+
+	GdShowCursor(&scrdev);
+}
+
+
+/*
+ * Draw the mouse pointer.  Save the screen contents underneath
+ * before drawing. Returns previous cursor state.
+ */
+int
+GdShowCursor(PSD psd)
+{
+	MWCOORD 		x;
+	MWCOORD 		y;
+	MWPIXELVAL *	saveptr;
+	MWIMAGEBITS *	cursorptr;
+	MWIMAGEBITS *	maskptr;
+	MWIMAGEBITS 	curbit, cbits, mbits;
+	MWPIXELVAL 	oldcolor;
+	MWPIXELVAL 	newcolor;
+	int 		oldmode;
+	int		prevcursor = curvisible;
+
+	if(++curvisible != 1)
+		return prevcursor;
+	oldmode = gr_mode;
+	gr_mode = MWMODE_SET;
+
+	saveptr = cursavbits;
+	cursavx = curminx;
+	cursavy = curminy;
+	cursavx2 = curmaxx;
+	cursavy2 = curmaxy;
+	cursorptr = cursorcolor;
+	maskptr = cursormask;
+
+	for (y = curminy; y <= curmaxy; y++) {
+		cbits = *cursorptr++;
+		mbits = *maskptr++;
+		curbit = MWIMAGE_FIRSTBIT;
+		for (x = curminx; x <= curmaxx; x++) {
+			if(x >= 0 && x < psd->xvirtres &&
+			   y >= 0 && y < psd->yvirtres) {
+				oldcolor = psd->ReadPixel(psd, x, y);
+				if (curbit & mbits) {
+					newcolor = (curbit&cbits)? curbg: curfg;
+					if (oldcolor != newcolor)
+					       psd->DrawPixel(psd, x, y, newcolor);
+				}
+				*saveptr++ = oldcolor;
+			}
+			curbit = MWIMAGE_NEXTBIT(curbit);
+		}
+	}
+
+	gr_mode = oldmode;
+	return prevcursor;
+}
+
+/*
+ * Restore the screen overwritten by the cursor.
+ */
+int
+GdHideCursor(PSD psd)
+{
+	MWPIXELVAL *	saveptr;
+	MWCOORD 		x, y;
+	int 		oldmode;
+	int		prevcursor = curvisible;
+
+	if(curvisible-- <= 0)
+		return prevcursor;
+	oldmode = gr_mode;
+	gr_mode = MWMODE_SET;
+
+	saveptr = cursavbits;
+	for (y = cursavy; y <= cursavy2; y++) {
+		for (x = cursavx; x <= cursavx2; x++) {
+			if(x >= 0 && x < psd->xvirtres &&
+			   y >= 0 && y < psd->yvirtres) {
+				psd->DrawPixel(psd, x, y, *saveptr++);
+			}
+		}
+	}
+ 	gr_mode = oldmode;
+	return prevcursor;
+}
+
+/* Check to see if the mouse pointer is about to be overwritten.
+ * If so, then remove the cursor so that the graphics operation
+ * works correctly.  If the cursor is removed, then this fact will
+ * be remembered and a later call to GdFixCursor will restore it.
+ */
+void
+GdCheckCursor(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2)
+{
+	MWCOORD temp;
+
+	if (curvisible <= 0 || (psd->flags & PSF_SCREEN) == 0)
+		return;
+
+	if (x1 > x2) {
+		temp = x1;
+		x1 = x2;
+		x2 = temp;
+	}
+	if (y1 > y2) {
+		temp = y1;
+		y1 = y2;
+		y2 = temp;
+	}
+	if (x1 > curmaxx || x2 < curminx || y1 > curmaxy || y2 < curminy)
+		return;
+
+	GdHideCursor(psd);
+	curneedsrestore = TRUE;
+}
+
+
+/* Redisplay the cursor if it was removed because of a graphics operation. */
+void
+GdFixCursor(PSD psd)
+{
+	if (curneedsrestore && (psd->flags & PSF_SCREEN)) {
+		GdShowCursor(psd);
+		curneedsrestore = FALSE;
+	}
+}
diff -urN lib/microwindows/src/engine/devopen.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devopen.c
--- lib/microwindows/src/engine/devopen.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devopen.c	2005-02-21 16:13:14.000000000 +0100
@@ -0,0 +1,326 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Device-independent mid level screen device init routines
+ *
+ * These routines implement the smallest Microwindows engine level
+ * interface to the screen driver.  By setting the NOFONTSORCLIPPING
+ * config option, only these routines will be included, which can
+ * be used to generate a low-level interface to the screen drivers
+ * without dragging in any other GdXXX routines.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "device.h"
+
+#if MSDOS | ELKS
+#define NOSTDPAL8
+#endif
+
+/*
+ * The following define can change depending on the window manager
+ * usage of colors and layout of the 8bpp palette devpal8.c.
+ * Color entries below this value won't be overwritten by user
+ * programs or bitmap display conversion tables.
+ */
+#define FIRSTUSERPALENTRY	24  /* first writable pal entry over 16 color*/
+
+       MWPIXELVAL gr_foreground;      /* current foreground color */
+       MWPIXELVAL gr_background;      /* current background color */
+       MWBOOL 	gr_usebg;    	    /* TRUE if background drawn in pixmaps */
+       int 	gr_mode = MWMODE_SET; 	    /* drawing mode */
+static MWSCREENINFO gr_sinfo;	    /* screen info for local routines*/
+/*static*/ MWPALENTRY	gr_palette[256];    /* current palette*/
+/*static*/ int	gr_firstuserpalentry;/* first user-changable palette entry*/
+/*static*/ int 	gr_nextpalentry;    /* next available palette entry*/
+	int	gr_portraitmode;    /* =1 for portrait mode*/
+
+/*
+ * Open low level graphics driver
+ */
+PSD
+GdOpenScreen(void)
+{
+	PSD			psd;
+	MWPALENTRY *		stdpal;
+
+	psd = scrdev.Open(&scrdev);
+	if (!psd)
+		return NULL;
+	GdGetScreenInfo(psd, &gr_sinfo);
+
+	/* assume no user changable palette entries*/
+	gr_firstuserpalentry = (int)psd->ncolors;
+
+	/* set palette according to system colors and devpalX.c*/
+	switch((int)psd->ncolors) {
+
+#if !defined(NOSTDPAL1) /* don't require stdpal1 if not needed */
+	case 2:		/* 1bpp*/
+	{
+		extern MWPALENTRY	mwstdpal1[2];
+		stdpal = mwstdpal1;
+	}
+	break;
+#endif
+
+#if !defined(NOSTDPAL2) /* don't require stdpal2 if not needed */
+	case 4:		/* 2bpp*/
+	{
+		extern MWPALENTRY	mwstdpal2[4];
+		stdpal = mwstdpal2;
+	}
+	break;
+#endif
+
+#if !defined(NOSTDPAL4)
+	/* don't require stdpal4 if not needed */
+	case 8:		/* 3bpp - not fully supported*/
+	case 16:	/* 4bpp*/
+	{
+		extern MWPALENTRY	mwstdpal4[16];
+		stdpal = mwstdpal4;
+	}
+	break;
+#endif
+
+#if !defined(NOSTDPAL8) /* don't require large stdpal8 if not needed */
+	case 256:	/* 8bpp*/
+	{
+		extern MWPALENTRY	mwstdpal8[256];
+#if xxxALPHABLEND
+		/* don't change uniform palette if alpha blending*/
+		gr_firstuserpalentry = 256;
+#else
+		/* start after last system-reserved color*/
+		gr_firstuserpalentry = FIRSTUSERPALENTRY;
+#endif
+		stdpal = mwstdpal8;
+	} 
+	break;
+#endif	/* !defined(NOSTDPAL8)*/
+
+	default:	/* truecolor*/
+		/* no palette*/
+		gr_firstuserpalentry = 0;
+		stdpal = NULL;
+	}
+
+	/* reset next user palette entry, write hardware palette*/
+	GdResetPalette();
+	GdSetPalette(psd, 0, (int)psd->ncolors, stdpal);
+#if xxxALPHABLEND
+	/* one-time create alpha lookup table for 8bpp systems (takes ~1 sec)*/
+	if(psd->ncolors == 256)
+		init_alpha_lookup();
+#endif
+
+#if !NOFONTSORCLIPPING
+	/* init local vars*/
+	GdSetMode(MWMODE_SET);
+	GdSetForeground(GdFindColor(MWRGB(255, 255, 255)));	/* WHITE*/
+	GdSetBackground(GdFindColor(MWRGB(0, 0, 0)));		/* BLACK*/
+	GdSetUseBackground(TRUE);
+	GdSetFont(GdCreateFont(psd, MWFONT_SYSTEM_VAR, 0, NULL));
+#if DYNAMICREGIONS
+	GdSetClipRegion(psd, 
+		GdAllocRectRegion(0, 0, psd->xvirtres, psd->yvirtres));
+#else
+	GdSetClipRects(psd, 0, NULL);
+#endif /* DYNAMICREGIONS*/
+#endif /* NOFONTSORCLIPPING*/
+
+	/* fill black (actually fill to first palette entry or truecolor 0*/
+	psd->FillRect(psd, 0, 0, psd->xvirtres-1, psd->yvirtres-1, 0);
+	return psd;
+}
+
+/*
+ * Close low level graphics driver
+ */
+void 
+GdCloseScreen(PSD psd)
+{
+	psd->Close(psd);
+}
+
+/*
+ * Return about the screen.
+ */
+void
+GdGetScreenInfo(PSD psd, PMWSCREENINFO psi)
+{
+	psd->GetScreenInfo(psd, psi);
+	GdGetButtonInfo(&psi->buttons);
+	GdGetModifierInfo(&psi->modifiers, NULL);
+	GdGetCursorPos(&psi->xpos, &psi->ypos);
+}
+
+/* reset palette to empty except for system colors*/
+void
+GdResetPalette(void)
+{
+	/* note: when palette entries are changed, all 
+	 * windows may need to be redrawn
+	 */
+	gr_nextpalentry = gr_firstuserpalentry;
+}
+
+/* set the system palette section to the passed palette entries*/
+void
+GdSetPalette(PSD psd, int first, int count, MWPALENTRY *palette)
+{
+	int	i;
+
+	/* no palette management needed if running truecolor*/
+	if(psd->pixtype != MWPF_PALETTE)
+		return;
+
+	/* bounds check against # of device color entries*/
+	if(first + count > (int)psd->ncolors)
+		count = (int)psd->ncolors - first;
+	if(count >= 0 && first < (int)psd->ncolors) {
+		psd->SetPalette(psd, first, count, palette);
+
+		/* copy palette for GdFind*Color*/
+		for(i=0; i<count; ++i)
+			gr_palette[i+first] = palette[i];
+	}
+}
+
+/* get system palette entries, return count*/
+int
+GdGetPalette(PSD psd, int first, int count, MWPALENTRY *palette)
+{
+	int	i;
+
+	/* no palette if running truecolor*/
+	if(psd->pixtype != MWPF_PALETTE)
+		return 0;
+
+	/* bounds check against # of device color entries*/
+	if(first + count > (int)psd->ncolors)
+		if( (count = (int)psd->ncolors - first) <= 0)
+			return 0;
+
+	for(i=0; i<count; ++i)
+		*palette++ = gr_palette[i+first];
+
+	return count;
+}
+
+/*
+ * Convert a palette-independent value to a hardware color
+ */
+MWPIXELVAL
+GdFindColor(MWCOLORVAL c)
+{
+	/*
+	 * Handle truecolor displays.  Note that the MWF_PALINDEX
+	 * bit is ignored when running truecolor drivers.
+	 */
+	switch(gr_sinfo.pixtype) {
+	case MWPF_TRUECOLOR0888:
+	case MWPF_TRUECOLOR888:
+		/* create 24 bit 8/8/8 pixel (0x00RRGGBB) from RGB colorval*/
+		/*RGB2PIXEL888(REDVALUE(c), GREENVALUE(c), BLUEVALUE(c))*/
+		return COLOR2PIXEL888(c);
+
+	case MWPF_TRUECOLOR565:
+		/* create 16 bit 5/6/5 format pixel from RGB colorval*/
+		/*RGB2PIXEL565(REDVALUE(c), GREENVALUE(c), BLUEVALUE(c))*/
+		return COLOR2PIXEL565(c);
+
+	case MWPF_TRUECOLOR555:
+		/* create 16 bit 5/5/5 format pixel from RGB colorval*/
+		/*RGB2PIXEL555(REDVALUE(c), GREENVALUE(c), BLUEVALUE(c))*/
+		return COLOR2PIXEL555(c);
+
+	case MWPF_TRUECOLOR332:
+		/* create 8 bit 3/3/2 format pixel from RGB colorval*/
+		/*RGB2PIXEL332(REDVALUE(c), GREENVALUE(c), BLUEVALUE(c))*/
+		return COLOR2PIXEL332(c);
+	}
+
+	/* case MWPF_PALETTE: must be running 1, 2, 4 or 8 bit palette*/
+
+	/*
+	 * Check if color is a palette index.  Note that the index
+	 * isn't error checked against the system palette, for speed.
+	 */
+	if(c & MWF_PALINDEX)
+		return (c & 0xff);
+
+	/* search palette for closest match*/
+	return GdFindNearestColor(gr_palette, (int)gr_sinfo.ncolors, c);
+}
+
+/*
+ * Search a palette to find the nearest color requested.
+ * Uses a weighted squares comparison.
+ */
+MWPIXELVAL
+GdFindNearestColor(MWPALENTRY *pal, int size, MWCOLORVAL cr)
+{
+	MWPALENTRY *	rgb;
+	int		r, g, b;
+	int		R, G, B;
+	long		diff = 0x7fffffffL;
+	long		sq;
+	int		best = 0;
+
+	r = REDVALUE(cr);
+	g = GREENVALUE(cr);
+	b = BLUEVALUE(cr);
+	for(rgb=pal; diff && rgb < &pal[size]; ++rgb) {
+		R = rgb->r - r;
+		G = rgb->g - g;
+		B = rgb->b - b;
+#if 1
+		/* speedy linear distance method*/
+		sq = abs(R) + abs(G) + abs(B);
+#else
+		/* slower distance-cubed with luminance adjustment*/
+		/* gray is .30R + .59G + .11B*/
+		/* = (R*77 + G*151 + B*28)/256*/
+		sq = (long)R*R*30*30 + (long)G*G*59*59 + (long)B*B*11*11;
+#endif
+
+		if(sq < diff) {
+			best = rgb - pal;
+			if((diff = sq) == 0)
+				return best;
+		}
+	}
+	return best;
+}
+
+#if !VXWORKS
+#include <unistd.h>
+#include <fcntl.h>
+/* capture the screen contents to a file for later makebmp processing*/
+int
+GdCaptureScreen(char *path)
+{
+	int n, ifd, ofd;
+	long i;
+	char buf[256];
+
+	ifd = open("/dev/fb0", 0);
+	ofd = creat(path, 0666);
+	for(n=0; n<256; ++n)
+		write(ofd, &gr_palette[n], 3);
+	for(i=scrdev.xvirtres*scrdev.yvirtres; i > 0; ) {
+		if((n = read(ifd, buf, 256)) > 0) {
+			write(ofd, buf, n);
+			i -= n;
+		}
+	}
+	close(ifd);
+	close(ofd);
+	return (ifd == -1 || ofd == -1);
+}
+#endif /* !VXWORKS*/
diff -urN lib/microwindows/src/engine/devpal1.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devpal1.c
--- lib/microwindows/src/engine/devpal1.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devpal1.c	2005-02-21 16:03:22.000000000 +0100
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * 1bpp (2 color) standard palette definition
+ */
+#include "device.h"
+
+/*
+ * Standard palette for 2 color (monochrome) systems.
+ */
+MWPALENTRY mwstdpal1[2] = {
+	RGBDEF( 0  , 0  , 0   ),	/* black*/
+	RGBDEF( 255, 255, 255 )		/* white*/
+};
diff -urN lib/microwindows/src/engine/devpal2.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devpal2.c
--- lib/microwindows/src/engine/devpal2.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devpal2.c	2005-02-21 16:03:22.000000000 +0100
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * 2pbb (4 color) standard palette definition
+ */
+#include "device.h"
+
+/*
+ * Standard palette for Everex Freestyle Palm PC
+ * This palette is in reverse order from some 2bpp systems.
+ * That is, white is pixel value 0, while black is 3.
+ */
+MWPALENTRY mwstdpal2[4] = {
+	RGBDEF( 255, 255, 255 ),	/* white*/
+	RGBDEF( 192, 192, 192 ),	/* ltgray*/
+	RGBDEF( 128, 128, 128 ),	/* gray*/
+	RGBDEF( 0  , 0  , 0   )		/* black*/
+};
diff -urN lib/microwindows/src/engine/devpal4.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devpal4.c
--- lib/microwindows/src/engine/devpal4.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devpal4.c	2005-02-21 16:03:22.000000000 +0100
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * 4bpp (16 color) standard palette definition
+ */
+#include "device.h"
+
+/*
+ * Standard palette for 16 color systems.
+ */
+MWPALENTRY mwstdpal4[16] = {
+	/* 16 EGA colors, arranged in VGA standard palette order*/
+	RGBDEF( 0  , 0  , 0   ),	/* black*/
+	RGBDEF( 0  , 0  , 128 ),	/* blue*/
+	RGBDEF( 0  , 128, 0   ),	/* green*/
+	RGBDEF( 0  , 128, 128 ),	/* cyan*/
+	RGBDEF( 128, 0  , 0   ),	/* red*/
+	RGBDEF( 128, 0  , 128 ),	/* magenta*/
+	RGBDEF( 128, 64 , 0   ),	/* adjusted brown*/
+	RGBDEF( 192, 192, 192 ),	/* ltgray*/
+	RGBDEF( 128, 128, 128 ),	/* gray*/
+	RGBDEF( 0  , 0  , 255 ),	/* ltblue*/
+	RGBDEF( 0  , 255, 0   ),	/* ltgreen*/
+	RGBDEF( 0  , 255, 255 ),	/* ltcyan*/
+	RGBDEF( 255, 0  , 0   ),	/* ltred*/
+	RGBDEF( 255, 0  , 255 ),	/* ltmagenta*/
+	RGBDEF( 255, 255, 0   ),	/* yellow*/
+	RGBDEF( 255, 255, 255 ),	/* white*/
+};
diff -urN lib/microwindows/src/engine/devpal8.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devpal8.c
--- lib/microwindows/src/engine/devpal8.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devpal8.c	2005-02-21 16:03:23.000000000 +0100
@@ -0,0 +1,302 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * 8bpp (256 color) standard palette definition
+ */
+#include "device.h"
+
+/*
+ * Special palette for supporting 48 Windows colors and a 216 color
+ * uniform color distribution.
+ * Note: the first 20 colors are used internally as system colors.
+ */
+MWPALENTRY mwstdpal8[256] = {
+	/* 16 EGA colors, arranged for direct predefined palette indexing*/
+	RGBDEF( 0  , 0  , 0   ),	/* black*/
+	RGBDEF( 0  , 0  , 128 ),	/* blue*/
+	RGBDEF( 0  , 128, 0   ),	/* green*/
+	RGBDEF( 0  , 128, 128 ),	/* cyan*/ /* COLOR_BACKGROUND*/
+	RGBDEF( 128, 0  , 0   ),	/* red*/  /* COLOR_ACTIVECAPTION A*/
+	RGBDEF( 128, 0  , 128 ),	/* magenta*/ /* COLOR_ACTIVECAPTION B*/
+	RGBDEF( 128, 64 , 0   ),	/* adjusted brown*/
+	RGBDEF( 192, 192, 192 ),	/* ltgray*/
+	RGBDEF( 128, 128, 128 ),	/* gray*/
+	RGBDEF( 0  , 0  , 255 ),	/* ltblue*/
+	RGBDEF( 0  , 255, 0   ),	/* ltgreen*/
+	RGBDEF( 0  , 255, 255 ),	/* ltcyan*/
+	RGBDEF( 255, 0  , 0   ),	/* ltred*/
+	RGBDEF( 255, 0  , 255 ),	/* ltmagenta*/
+	RGBDEF( 255, 255, 0   ),	/* yellow*/
+	RGBDEF( 255, 255, 255 ),	/* white*/
+
+	/* 32 basic windows colors (first 8 are most important)*/
+	RGBDEF( 32 , 32 , 32  ),	/* DKGRAY_BRUSH*/
+	RGBDEF( 128, 128, 0   ),	/* non-adjusted brown*/
+	RGBDEF( 223, 223, 223 ),	/* COLOR_3DLIGHT B*/
+	RGBDEF( 160, 160, 160 ), 	/* COLOR_3DLIGHT C*/
+
+	RGBDEF( 234, 230, 221 ),	/* COLOR_BTNHIGHLIGHT A*/
+	RGBDEF( 213, 204, 187 ),	/* COLOR_BTNFACE A*/
+	RGBDEF( 162, 141, 104 ),	/* COLOR_BTNSHADOW A*/
+	RGBDEF( 0  , 64 , 128 ),	/* COLOR_INACTIVECAPTION C*/
+	/*RGBDEF( 0  , 0  , 64  ),*/
+	/*RGBDEF( 0  , 64 , 0   ),*/
+	/*RGBDEF( 0  , 64 , 64  ),*/
+	/*RGBDEF( 0  , 128, 64  ),*/
+	RGBDEF( 0  , 128, 255 ),
+	RGBDEF( 0  , 255, 128 ),
+	RGBDEF( 64 , 0  , 0   ),
+	RGBDEF( 64 , 0  , 64  ),
+	RGBDEF( 64 , 0  , 128 ),
+	RGBDEF( 64 , 128, 128 ),
+	RGBDEF( 128, 0  , 64  ),
+	RGBDEF( 128, 0  , 255 ),
+	RGBDEF( 128, 64 , 64  ),
+	RGBDEF( 128, 128, 64  ),
+	RGBDEF( 128, 128, 192 ),
+	RGBDEF( 128, 128, 255 ),
+	RGBDEF( 128, 255, 0   ),
+	RGBDEF( 128, 255, 255 ),
+	RGBDEF( 164, 200, 240 ),
+	RGBDEF( 192, 220, 192 ),
+	RGBDEF( 255, 0  , 128 ),
+	RGBDEF( 255, 128, 0   ),
+	RGBDEF( 255, 128, 192 ),
+	RGBDEF( 255, 128, 255 ),
+	RGBDEF( 255, 128, 128 ),
+	RGBDEF( 255, 255, 128 ),
+	RGBDEF( 255, 251, 240 ),
+	RGBDEF( 255, 255, 232 ),
+
+	/* 216 colors spread uniformly across rgb spectrum*/
+	/* 8 colors removed that are duplicated above*/
+	/*RGBDEF( 0x00, 0x00, 0x00 ),*/
+	RGBDEF( 0x00, 0x00, 0x33 ),
+	RGBDEF( 0x00, 0x00, 0x66 ),
+	RGBDEF( 0x00, 0x00, 0x99 ),
+	RGBDEF( 0x00, 0x00, 0xcc ),
+	/*RGBDEF( 0x00, 0x00, 0xff ),*/
+	RGBDEF( 0x33, 0x00, 0x00 ),
+	RGBDEF( 0x33, 0x00, 0x33 ),
+	RGBDEF( 0x33, 0x00, 0x66 ),
+	RGBDEF( 0x33, 0x00, 0x99 ),
+	RGBDEF( 0x33, 0x00, 0xcc ),
+	RGBDEF( 0x33, 0x00, 0xff ),
+	RGBDEF( 0x66, 0x00, 0x00 ),
+	RGBDEF( 0x66, 0x00, 0x33 ),
+	RGBDEF( 0x66, 0x00, 0x66 ),
+	RGBDEF( 0x66, 0x00, 0x99 ),
+	RGBDEF( 0x66, 0x00, 0xcc ),
+	RGBDEF( 0x66, 0x00, 0xff ),
+	RGBDEF( 0x99, 0x00, 0x00 ),
+	RGBDEF( 0x99, 0x00, 0x33 ),
+	RGBDEF( 0x99, 0x00, 0x66 ),
+	RGBDEF( 0x99, 0x00, 0x99 ),
+	RGBDEF( 0x99, 0x00, 0xcc ),
+	RGBDEF( 0x99, 0x00, 0xff ),
+	RGBDEF( 0xcc, 0x00, 0x00 ),
+	RGBDEF( 0xcc, 0x00, 0x33 ),
+	RGBDEF( 0xcc, 0x00, 0x66 ),
+	RGBDEF( 0xcc, 0x00, 0x99 ),
+	RGBDEF( 0xcc, 0x00, 0xcc ),
+	RGBDEF( 0xcc, 0x00, 0xff ),
+	/*RGBDEF( 0xff, 0x00, 0x00 ),*/
+	RGBDEF( 0xff, 0x00, 0x33 ),
+	RGBDEF( 0xff, 0x00, 0x66 ),
+	RGBDEF( 0xff, 0x00, 0x99 ),
+	RGBDEF( 0xff, 0x00, 0xcc ),
+	/*RGBDEF( 0xff, 0x00, 0xff ),*/
+	RGBDEF( 0x00, 0x33, 0x00 ),
+	RGBDEF( 0x00, 0x33, 0x33 ),
+	RGBDEF( 0x00, 0x33, 0x66 ),
+	RGBDEF( 0x00, 0x33, 0x99 ),
+	RGBDEF( 0x00, 0x33, 0xcc ),
+	RGBDEF( 0x00, 0x33, 0xff ),
+	RGBDEF( 0x33, 0x33, 0x00 ),
+	RGBDEF( 0x33, 0x33, 0x33 ),
+	RGBDEF( 0x33, 0x33, 0x66 ),
+	RGBDEF( 0x33, 0x33, 0x99 ),
+	RGBDEF( 0x33, 0x33, 0xcc ),
+	RGBDEF( 0x33, 0x33, 0xff ),
+	RGBDEF( 0x66, 0x33, 0x00 ),
+	RGBDEF( 0x66, 0x33, 0x33 ),
+	RGBDEF( 0x66, 0x33, 0x66 ),
+	RGBDEF( 0x66, 0x33, 0x99 ),
+	RGBDEF( 0x66, 0x33, 0xcc ),
+	RGBDEF( 0x66, 0x33, 0xff ),
+	RGBDEF( 0x99, 0x33, 0x00 ),
+	RGBDEF( 0x99, 0x33, 0x33 ),
+	RGBDEF( 0x99, 0x33, 0x66 ),
+	RGBDEF( 0x99, 0x33, 0x99 ),
+	RGBDEF( 0x99, 0x33, 0xcc ),
+	RGBDEF( 0x99, 0x33, 0xff ),
+	RGBDEF( 0xcc, 0x33, 0x00 ),
+	RGBDEF( 0xcc, 0x33, 0x33 ),
+	RGBDEF( 0xcc, 0x33, 0x66 ),
+	RGBDEF( 0xcc, 0x33, 0x99 ),
+	RGBDEF( 0xcc, 0x33, 0xcc ),
+	RGBDEF( 0xcc, 0x33, 0xff ),
+	RGBDEF( 0xff, 0x33, 0x00 ),
+	RGBDEF( 0xff, 0x33, 0x33 ),
+	RGBDEF( 0xff, 0x33, 0x66 ),
+	RGBDEF( 0xff, 0x33, 0x99 ),
+	RGBDEF( 0xff, 0x33, 0xcc ),
+	RGBDEF( 0xff, 0x33, 0xff ),
+	RGBDEF( 0x00, 0x66, 0x00 ),
+	RGBDEF( 0x00, 0x66, 0x33 ),
+	RGBDEF( 0x00, 0x66, 0x66 ),
+	RGBDEF( 0x00, 0x66, 0x99 ),
+	RGBDEF( 0x00, 0x66, 0xcc ),
+	RGBDEF( 0x00, 0x66, 0xff ),
+	RGBDEF( 0x33, 0x66, 0x00 ),
+	RGBDEF( 0x33, 0x66, 0x33 ),
+	RGBDEF( 0x33, 0x66, 0x66 ),
+	RGBDEF( 0x33, 0x66, 0x99 ),
+	RGBDEF( 0x33, 0x66, 0xcc ),
+	RGBDEF( 0x33, 0x66, 0xff ),
+	RGBDEF( 0x66, 0x66, 0x00 ),
+	RGBDEF( 0x66, 0x66, 0x33 ),
+	RGBDEF( 0x66, 0x66, 0x66 ),
+	RGBDEF( 0x66, 0x66, 0x99 ),
+	RGBDEF( 0x66, 0x66, 0xcc ),
+	RGBDEF( 0x66, 0x66, 0xff ),
+	RGBDEF( 0x99, 0x66, 0x00 ),
+	RGBDEF( 0x99, 0x66, 0x33 ),
+	RGBDEF( 0x99, 0x66, 0x66 ),
+	RGBDEF( 0x99, 0x66, 0x99 ),
+	RGBDEF( 0x99, 0x66, 0xcc ),
+	RGBDEF( 0x99, 0x66, 0xff ),
+	RGBDEF( 0xcc, 0x66, 0x00 ),
+	RGBDEF( 0xcc, 0x66, 0x33 ),
+	RGBDEF( 0xcc, 0x66, 0x66 ),
+	RGBDEF( 0xcc, 0x66, 0x99 ),
+	RGBDEF( 0xcc, 0x66, 0xcc ),
+	RGBDEF( 0xcc, 0x66, 0xff ),
+	RGBDEF( 0xff, 0x66, 0x00 ),
+	RGBDEF( 0xff, 0x66, 0x33 ),
+	RGBDEF( 0xff, 0x66, 0x66 ),
+	RGBDEF( 0xff, 0x66, 0x99 ),
+	RGBDEF( 0xff, 0x66, 0xcc ),
+	RGBDEF( 0xff, 0x66, 0xff ),
+	RGBDEF( 0x00, 0x99, 0x00 ),
+	RGBDEF( 0x00, 0x99, 0x33 ),
+	RGBDEF( 0x00, 0x99, 0x66 ),
+	RGBDEF( 0x00, 0x99, 0x99 ),
+	RGBDEF( 0x00, 0x99, 0xcc ),
+	RGBDEF( 0x00, 0x99, 0xff ),
+	RGBDEF( 0x33, 0x99, 0x00 ),
+	RGBDEF( 0x33, 0x99, 0x33 ),
+	RGBDEF( 0x33, 0x99, 0x66 ),
+	RGBDEF( 0x33, 0x99, 0x99 ),
+	RGBDEF( 0x33, 0x99, 0xcc ),
+	RGBDEF( 0x33, 0x99, 0xff ),
+	RGBDEF( 0x66, 0x99, 0x00 ),
+	RGBDEF( 0x66, 0x99, 0x33 ),
+	RGBDEF( 0x66, 0x99, 0x66 ),
+	RGBDEF( 0x66, 0x99, 0x99 ),
+	RGBDEF( 0x66, 0x99, 0xcc ),
+	RGBDEF( 0x66, 0x99, 0xff ),
+	RGBDEF( 0x99, 0x99, 0x00 ),
+	RGBDEF( 0x99, 0x99, 0x33 ),
+	RGBDEF( 0x99, 0x99, 0x66 ),
+	RGBDEF( 0x99, 0x99, 0x99 ),
+	RGBDEF( 0x99, 0x99, 0xcc ),
+	RGBDEF( 0x99, 0x99, 0xff ),
+	RGBDEF( 0xcc, 0x99, 0x00 ),
+	RGBDEF( 0xc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xff, 0x99 ),
+	RGBDEF( 0xcc, 0xff, 0xcc ),
+	RGBDEF( 0xcc, 0xff, 0xff ),
+	/*RGBDEF( 0xff, 0xff, 0x00 ),*/
+	RGBDEF( 0xff, 0xff, 0x33 ),
+	RGBDEF( 0xff, 0xff, 0x66 ),
+	RGBDEF( 0xff, 0xff, 0x99 ),
+	RGBDEF( 0xff, 0xff, 0xcc ),
+	/*RGBDEF( 0xff, 0xff, 0xff )*/
+};
+
+#if TEST
+main()
+{
+	int	c;
+
+	DPRINTF("%d\n", ((int)&stdpalette[1]) - (int)&stdpalette[0]);
+
+	c = FindNearestColor(stdpalette, 224, 224, 224);
+	DPRINTF("%d = %02x %02x %02x\n", c, stdpalette[c].r, stdpalette[c].g,
+		stdpalette[c].b);
+}
+#endif
diff -urN lib/microwindows/src/engine/devpalgray4.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devpalgray4.c
--- lib/microwindows/src/engine/devpalgray4.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devpalgray4.c	2005-02-21 16:03:23.000000000 +0100
@@ -0,0 +1,23 @@
+/*
+ * 4bpp (16 color) grayscale palette
+ */
+#include "device.h"
+
+MWPALENTRY mwstdpal4[16] = {
+    RGBDEF( 0, 0, 0 ),
+    RGBDEF( 17, 17, 17 ),
+    RGBDEF( 34, 34, 34 ),
+    RGBDEF( 51, 51, 51 ),
+    RGBDEF( 68, 68, 68 ),
+    RGBDEF( 85, 85, 85 ),
+    RGBDEF( 102, 102, 102 ),
+    RGBDEF( 119, 119, 119 ),
+    RGBDEF( 136, 136, 136 ),
+    RGBDEF( 153, 153, 153 ),
+    RGBDEF( 170, 170, 170 ),
+    RGBDEF( 187, 187, 187 ),
+    RGBDEF( 204, 204, 204 ),
+    RGBDEF( 221, 221, 221 ),
+    RGBDEF( 238, 238, 238 ),
+    RGBDEF( 255, 255, 255 )
+};
diff -urN lib/microwindows/src/engine/devrgn.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devrgn.c
--- lib/microwindows/src/engine/devrgn.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devrgn.c	2005-02-21 16:13:15.000000000 +0100
@@ -0,0 +1,1426 @@
+/*
+ * Portions Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *	Somewhat less shamelessly ripped from the Wine distribution
+ *
+ * Device-independent multi-rectangle clipping routines.
+ *
+ * GDI region objects. Shamelessly ripped out from the X11 distribution
+ * Thanks for the nice licence.
+ *
+ * Copyright 1993, 1994, 1995 Alexandre Julliard
+ * Modifications and additions: Copyright 1998 Huw Davies
+ */
+/************************************************************************
+
+Copyright (c) 1987, 1988  X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+			All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+************************************************************************/
+/*
+ * The functions in this file implement the Region abstraction, similar to one
+ * used in the X11 sample server. A Region is simply an area, as the name
+ * implies, and is implemented as a "y-x-banded" array of rectangles. To
+ * explain: Each Region is made up of a certain number of rectangles sorted
+ * by y coordinate first, and then by x coordinate.
+ *
+ * Furthermore, the rectangles are banded such that every rectangle with a
+ * given upper-left y coordinate (y1) will have the same lower-right y
+ * coordinate (y2) and vice versa. If a rectangle has scanlines in a band, it
+ * will span the entire vertical distance of the band. This means that some
+ * areas that could be merged into a taller rectangle will be represented as
+ * several shorter rectangles to account for shorter rectangles to its left
+ * or right but within its "vertical scope".
+ *
+ * An added constraint on the rectangles is that they must cover as much
+ * horizontal area as possible. E.g. no two rectangles in a band are allowed
+ * to touch.
+ *
+ * Whenever possible, bands will be merged together to cover a greater vertical
+ * distance (and thus reduce the number of rectangles). Two bands can be merged
+ * only if the bottom of one touches the top of the other and they have
+ * rectangles in the same places (of the same width, of course). This maintains
+ * the y-x-banding that's so nice to have...
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "device.h"
+
+typedef void (*voidProcp)();
+
+/*  1 if two RECTs overlap.
+ *  0 if two RECTs do not overlap.
+ */
+#define EXTENTCHECK(r1, r2) \
+	((r1)->right > (r2)->left && \
+	 (r1)->left < (r2)->right && \
+	 (r1)->bottom > (r2)->top && \
+	 (r1)->top < (r2)->bottom)
+
+/*
+ *   Check to see if there is enough memory in the present region.
+ */
+#define MEMCHECK(reg, rect, firstrect){\
+        if ((reg)->numRects >= ((reg)->size - 1)){\
+          (firstrect) = realloc(\
+           (firstrect), (2 * (sizeof(MWRECT)) * ((reg)->size)));\
+          if ((firstrect) == 0)\
+            return;\
+          (reg)->size *= 2;\
+          (rect) = &(firstrect)[(reg)->numRects];\
+         }\
+       }
+
+#define REGION_NOT_EMPTY(pReg) pReg->numRects
+
+#define EMPTY_REGION(pReg) { \
+    (pReg)->numRects = 0; \
+    (pReg)->extents.left = (pReg)->extents.top = 0; \
+    (pReg)->extents.right = (pReg)->extents.bottom = 0; \
+    (pReg)->type = MWREGION_NULL; \
+ }
+
+#define INRECT(r, x, y) \
+      ( ( ((r).right >  x)) && \
+        ( ((r).left <= x)) && \
+        ( ((r).bottom >  y)) && \
+        ( ((r).top <= y)) )
+
+/* return TRUE if point is in region*/
+MWBOOL
+GdPtInRegion(MWCLIPREGION *rgn, MWCOORD x, MWCOORD y)
+{
+    int i;
+
+    if (rgn->numRects > 0 && INRECT(rgn->extents, x, y))
+	for (i = 0; i < rgn->numRects; i++)
+	    if (INRECT (rgn->rects[i], x, y))
+		return TRUE;
+    return FALSE;
+}
+
+/* return whether rectangle is all in, partly in, or out of region*/
+int 
+GdRectInRegion(MWCLIPREGION *rgn, const MWRECT *rect)
+{
+    MWRECT *	pCurRect;
+    MWRECT *	pRectEnd;
+    MWCOORD	rx, ry;
+    MWBOOL	partIn, partOut;
+
+    /* this is (just) a useful optimization */
+    if (!rgn->numRects || !EXTENTCHECK(&rgn->extents, rect))
+        return MWRECT_OUT;
+
+    partOut = FALSE;
+    partIn = FALSE;
+    rx = rect->left;
+    ry = rect->top;
+
+    /* 
+     * can stop when both partOut and partIn are TRUE,
+     * or we reach rect->bottom
+     */
+    for (pCurRect = rgn->rects, pRectEnd = pCurRect + rgn->numRects;
+		 pCurRect < pRectEnd; pCurRect++) {
+
+	if (pCurRect->bottom <= ry)
+	   continue;		/* not far enough down yet*/
+
+	if (pCurRect->top > ry) {
+	   partOut = TRUE;	/* missed part of rectangle above */
+	   if (partIn || (pCurRect->top >= rect->bottom))
+	      break;
+	   ry = pCurRect->top;	/* x guaranteed to be == rect->left */
+	}
+
+	if (pCurRect->right <= rx)
+	   continue;		/* not far enough over yet */
+
+	if (pCurRect->left > rx) {
+	   partOut = TRUE;	/* missed part of rectangle to left */
+	   if (partIn)
+	      break;
+	}
+
+	if (pCurRect->left < rect->right) {
+	    partIn = TRUE;	/* definitely overlap */
+	    if (partOut)
+	       break;
+	}
+
+	if (pCurRect->right >= rect->right) {
+	   ry = pCurRect->bottom;	/* finished with this band */
+	   if (ry >= rect->bottom)
+	      break;
+	   rx = rect->left;	/* reset x out to left again */
+	} else {
+	    /*
+	     * Because boxes in a band are maximal width, if the first box
+	     * to overlap the rectangle doesn't completely cover it in that
+	     * band, the rectangle must be partially out, since some of it
+	     * will be uncovered in that band. partIn will have been set true
+	     * by now...
+	     */
+	    break;
+	}
+    }
+
+    return(partIn ? ((ry < rect->bottom) ? MWRECT_PARTIN : MWRECT_ALLIN) : 
+		MWRECT_OUT);
+}
+
+#if 0000
+/* Returns TRUE if rect is at least partly inside rgn*/
+MWBOOL
+GdRectInRegion(MWCLIPREGION *rgn, const MWRECT *rect)
+{
+    MWRECT *pCurRect, *pRectEnd;
+    MWBOOL ret = FALSE;
+
+    /* this is (just) a useful optimization */
+	if ((rgn->numRects > 0) && EXTENTCHECK(&rgn->extents, rect))
+	{
+	    for (pCurRect = rgn->rects, pRectEnd = pCurRect +
+	     rgn->numRects; pCurRect < pRectEnd; pCurRect++)
+	    {
+	        if (pCurRect->bottom <= rect->top)
+			continue;             /* not far enough down yet */
+
+		if (pCurRect->top >= rect->bottom) {
+		    ret = FALSE;          /* too far down */
+		    break;
+		}
+
+		if (pCurRect->right <= rect->left)
+		    continue;              /* not far enough over yet */
+
+		if (pCurRect->left >= rect->right) {
+		    continue;
+		}
+
+		ret = TRUE;
+		break;
+	    }
+	}
+	return ret;
+}
+#endif
+
+static MWBOOL
+EQUALRECT(MWRECT *r1, MWRECT *r2)
+{
+	return ((r1->left == r2->left) && (r1->right == r2->right) &&
+		(r1->top == r2->top) && (r1->bottom == r2->bottom));
+}
+
+MWBOOL
+GdEqualRegion(MWCLIPREGION *r1, MWCLIPREGION *r2)
+{
+	int	i;
+
+	if (r1->numRects != r2->numRects)
+		return FALSE;
+	if (r1->numRects == 0)
+		return TRUE;
+	if (!EQUALRECT(&r1->extents, &r2->extents))
+		return FALSE;
+	for (i = 0; i < r1->numRects; i++) {
+		if (!EQUALRECT(r1->rects + i, r2->rects + i))
+			return FALSE;
+	}
+	return TRUE;
+}
+
+MWBOOL
+GdEmptyRegion(MWCLIPREGION *rgn)
+{
+	return rgn->numRects == 0;
+}
+
+/*
+ *            Create a new empty MWCLIPREGION.
+ */
+MWCLIPREGION *
+GdAllocRegion(void)    
+{
+    MWCLIPREGION *rgn;
+
+    if ((rgn = malloc(sizeof( MWCLIPREGION ))))
+    {
+	if ((rgn->rects = malloc(sizeof( MWRECT ))))
+	{
+	    rgn->size = 1;
+	    EMPTY_REGION(rgn);
+	    return rgn;
+	}
+	free(rgn);
+    }
+    return NULL;
+}
+
+MWCLIPREGION *
+GdAllocRectRegion(MWCOORD left, MWCOORD top, MWCOORD right, MWCOORD bottom)
+{
+	MWCLIPREGION *rgn;
+
+	rgn = GdAllocRegion();
+	if (rgn)
+		GdSetRectRegion(rgn, left, top, right, bottom);
+	return rgn;
+}
+
+MWCLIPREGION *
+GdAllocRectRegionIndirect(MWRECT *prc)
+{
+	return GdAllocRectRegion(prc->left, prc->top, prc->right, prc->bottom);
+}
+
+void
+GdSetRectRegion(MWCLIPREGION *rgn, MWCOORD left, MWCOORD top, MWCOORD right,
+	MWCOORD bottom)
+{
+	if (left != right && top != bottom) {
+		rgn->rects->left = rgn->extents.left = left;
+		rgn->rects->top = rgn->extents.top = top;
+		rgn->rects->right = rgn->extents.right = right;
+		rgn->rects->bottom = rgn->extents.bottom = bottom;
+		rgn->numRects = 1;
+		rgn->type = MWREGION_SIMPLE;
+	} else
+		EMPTY_REGION(rgn);
+}
+
+void
+GdSetRectRegionIndirect(MWCLIPREGION *rgn, MWRECT *prc)
+{
+	GdSetRectRegion(rgn, prc->left, prc->top, prc->right, prc->bottom);
+}
+
+void
+GdDestroyRegion(MWCLIPREGION *rgn)
+{
+	if(rgn) {
+		free(rgn->rects);
+		free(rgn);
+	}
+}
+
+void
+GdOffsetRegion(MWCLIPREGION *rgn, MWCOORD x, MWCOORD y)
+{
+	int	nbox = rgn->numRects;
+	MWRECT *pbox = rgn->rects;
+
+	if(nbox && (x || y)) {
+		while(nbox--) {
+			pbox->left += x;
+			pbox->right += x;
+			pbox->top += y;
+			pbox->bottom += y;
+			pbox++;
+		}
+		rgn->extents.left += x;
+		rgn->extents.right += x;
+		rgn->extents.top += y;
+		rgn->extents.bottom += y;
+	}
+}
+
+/* get bounding box for region, return region type*/
+int
+GdGetRegionBox(MWCLIPREGION *rgn, MWRECT *prc)
+{
+	*prc = rgn->extents;
+	return rgn->type;
+}
+
+/***********************************************************************
+ *           GdUnionRectWithRegion
+ *           Adds a rectangle to a MWCLIPREGION
+ */
+void
+GdUnionRectWithRegion(const MWRECT *rect, MWCLIPREGION *rgn)
+{
+    MWCLIPREGION region;
+
+    region.rects = &region.extents;
+    region.numRects = 1;
+    region.size = 1;
+    region.type = MWREGION_SIMPLE;
+    region.extents = *rect;
+    GdUnionRegion(rgn, rgn, &region);
+}
+
+/***********************************************************************
+ *           GdSubtractRectWithRegion
+ *           Subtracts a rectangle from a MWCLIPREGION
+ */
+void
+GdSubtractRectFromRegion(const MWRECT *rect, MWCLIPREGION *rgn)
+{
+    MWCLIPREGION region;
+
+    region.rects = &region.extents;
+    region.numRects = 1;
+    region.size = 1;
+    region.type = MWREGION_SIMPLE;
+    region.extents = *rect;
+    GdSubtractRegion(rgn, rgn, &region);
+}
+
+
+/***********************************************************************
+ *           GdCopyRegion
+ */
+void
+GdCopyRegion(MWCLIPREGION *dst, MWCLIPREGION *src)
+{
+    if (dst != src) /*  don't want to copy to itself */
+    {  
+	if (dst->size < src->numRects)
+	{
+	    if (! (dst->rects = realloc( dst->rects, src->numRects * sizeof(MWRECT))))
+		return;
+	    dst->size = src->numRects;
+	}
+	dst->numRects = src->numRects;
+	dst->extents.left = src->extents.left;
+	dst->extents.top = src->extents.top;
+	dst->extents.right = src->extents.right;
+	dst->extents.bottom = src->extents.bottom;
+	dst->type = src->type;
+
+	memcpy((char *) dst->rects, (char *) src->rects,
+	       (int) (src->numRects * sizeof(MWRECT)));
+    }
+}
+
+
+/***********************************************************************
+ *           REGION_SetExtents
+ *           Re-calculate the extents of a region
+ */
+static void
+REGION_SetExtents (MWCLIPREGION *pReg)
+{
+    MWRECT *pRect, *pRectEnd, *pExtents;
+
+    if (pReg->numRects == 0)
+    {
+	pReg->extents.left = 0;
+	pReg->extents.top = 0;
+	pReg->extents.right = 0;
+	pReg->extents.bottom = 0;
+	return;
+    }
+
+    pExtents = &pReg->extents;
+    pRect = pReg->rects;
+    pRectEnd = &pRect[pReg->numRects - 1];
+
+    /*
+     * Since pRect is the first rectangle in the region, it must have the
+     * smallest top and since pRectEnd is the last rectangle in the region,
+     * it must have the largest bottom, because of banding. Initialize left and
+     * right from pRect and pRectEnd, resp., as good things to initialize them
+     * to...
+     */
+    pExtents->left = pRect->left;
+    pExtents->top = pRect->top;
+    pExtents->right = pRectEnd->right;
+    pExtents->bottom = pRectEnd->bottom;
+
+    while (pRect <= pRectEnd)
+    {
+	if (pRect->left < pExtents->left)
+	    pExtents->left = pRect->left;
+	if (pRect->right > pExtents->right)
+	    pExtents->right = pRect->right;
+	pRect++;
+    }
+}
+
+
+/***********************************************************************
+ *           REGION_Coalesce
+ *
+ *      Attempt to merge the rects in the current band with those in the
+ *      previous one. Used only by REGION_RegionOp.
+ *
+ * Results:
+ *      The new index for the previous band.
+ *
+ * Side Effects:
+ *      If coalescing takes place:
+ *          - rectangles in the previous band will have their bottom fields
+ *            altered.
+ *          - pReg->numRects will be decreased.
+ *
+ */
+static MWCOORD
+REGION_Coalesce (
+	     MWCLIPREGION *pReg, /* Region to coalesce */
+	     MWCOORD prevStart,  /* Index of start of previous band */
+	     MWCOORD curStart    /* Index of start of current band */
+) {
+    MWRECT *pPrevRect;          /* Current rect in previous band */
+    MWRECT *pCurRect;           /* Current rect in current band */
+    MWRECT *pRegEnd;            /* End of region */
+    MWCOORD curNumRects;          /* Number of rectangles in current band */
+    MWCOORD prevNumRects;         /* Number of rectangles in previous band */
+    MWCOORD bandtop;               /* top coordinate for current band */
+
+    pRegEnd = &pReg->rects[pReg->numRects];
+
+    pPrevRect = &pReg->rects[prevStart];
+    prevNumRects = curStart - prevStart;
+
+    /*
+     * Figure out how many rectangles are in the current band. Have to do
+     * this because multiple bands could have been added in REGION_RegionOp
+     * at the end when one region has been exhausted.
+     */
+    pCurRect = &pReg->rects[curStart];
+    bandtop = pCurRect->top;
+    for (curNumRects = 0;
+	 (pCurRect != pRegEnd) && (pCurRect->top == bandtop);
+	 curNumRects++)
+    {
+	pCurRect++;
+    }
+    
+    if (pCurRect != pRegEnd)
+    {
+	/*
+	 * If more than one band was added, we have to find the start
+	 * of the last band added so the next coalescing job can start
+	 * at the right place... (given when multiple bands are added,
+	 * this may be pointless -- see above).
+	 */
+	pRegEnd--;
+	while (pRegEnd[-1].top == pRegEnd->top)
+	{
+	    pRegEnd--;
+	}
+	curStart = pRegEnd - pReg->rects;
+	pRegEnd = pReg->rects + pReg->numRects;
+    }
+	
+    if ((curNumRects == prevNumRects) && (curNumRects != 0)) {
+	pCurRect -= curNumRects;
+	/*
+	 * The bands may only be coalesced if the bottom of the previous
+	 * matches the top scanline of the current.
+	 */
+	if (pPrevRect->bottom == pCurRect->top)
+	{
+	    /*
+	     * Make sure the bands have rects in the same places. This
+	     * assumes that rects have been added in such a way that they
+	     * cover the most area possible. I.e. two rects in a band must
+	     * have some horizontal space between them.
+	     */
+	    do
+	    {
+		if ((pPrevRect->left != pCurRect->left) ||
+		    (pPrevRect->right != pCurRect->right))
+		{
+		    /*
+		     * The bands don't line up so they can't be coalesced.
+		     */
+		    return (curStart);
+		}
+		pPrevRect++;
+		pCurRect++;
+		prevNumRects -= 1;
+	    } while (prevNumRects != 0);
+
+	    pReg->numRects -= curNumRects;
+	    pCurRect -= curNumRects;
+	    pPrevRect -= curNumRects;
+
+	    /*
+	     * The bands may be merged, so set the bottom of each rect
+	     * in the previous band to that of the corresponding rect in
+	     * the current band.
+	     */
+	    do
+	    {
+		pPrevRect->bottom = pCurRect->bottom;
+		pPrevRect++;
+		pCurRect++;
+		curNumRects -= 1;
+	    } while (curNumRects != 0);
+
+	    /*
+	     * If only one band was added to the region, we have to backup
+	     * curStart to the start of the previous band.
+	     *
+	     * If more than one band was added to the region, copy the
+	     * other bands down. The assumption here is that the other bands
+	     * came from the same region as the current one and no further
+	     * coalescing can be done on them since it's all been done
+	     * already... curStart is already in the right place.
+	     */
+	    if (pCurRect == pRegEnd)
+	    {
+		curStart = prevStart;
+	    }
+	    else
+	    {
+		do
+		{
+		    *pPrevRect++ = *pCurRect++;
+		} while (pCurRect != pRegEnd);
+	    }
+	    
+	}
+    }
+    return (curStart);
+}
+
+/***********************************************************************
+ *           REGION_RegionOp
+ *
+ *      Apply an operation to two regions. Called by GdUnion,
+ *      GdXor, GdSubtract, GdIntersect...
+ *
+ * Results:
+ *      None.
+ *
+ * Side Effects:
+ *      The new region is overwritten.
+ *
+ * Notes:
+ *      The idea behind this function is to view the two regions as sets.
+ *      Together they cover a rectangle of area that this function divides
+ *      into horizontal bands where points are covered only by one region
+ *      or by both. For the first case, the nonOverlapFunc is called with
+ *      each the band and the band's upper and lower extents. For the
+ *      second, the overlapFunc is called to process the entire band. It
+ *      is responsible for clipping the rectangles in the band, though
+ *      this function provides the boundaries.
+ *      At the end of each band, the new region is coalesced, if possible,
+ *      to reduce the number of rectangles in the region.
+ *
+ */
+static void
+REGION_RegionOp(
+	    MWCLIPREGION *newReg, /* Place to store result */
+	    MWCLIPREGION *reg1,   /* First region in operation */
+            MWCLIPREGION *reg2,   /* 2nd region in operation */
+	    void (*overlapFunc)(),     /* Function to call for over-lapping bands */
+	    void (*nonOverlap1Func)(), /* Function to call for non-overlapping bands in region 1 */
+	    void (*nonOverlap2Func)()  /* Function to call for non-overlapping bands in region 2 */
+) {
+    MWRECT *r1;                         /* Pointer into first region */
+    MWRECT *r2;                         /* Pointer into 2d region */
+    MWRECT *r1End;                      /* End of 1st region */
+    MWRECT *r2End;                      /* End of 2d region */
+    MWCOORD ybot;                         /* Bottom of intersection */
+    MWCOORD ytop;                         /* Top of intersection */
+    MWRECT *oldRects;                   /* Old rects for newReg */
+    MWCOORD prevBand;                     /* Index of start of
+						 * previous band in newReg */
+    MWCOORD curBand;                      /* Index of start of current
+						 * band in newReg */
+    MWRECT *r1BandEnd;                  /* End of current band in r1 */
+    MWRECT *r2BandEnd;                  /* End of current band in r2 */
+    MWCOORD top;                          /* Top of non-overlapping band */
+    MWCOORD bot;                          /* Bottom of non-overlapping band */
+    
+    /*
+     * Initialization:
+     *  set r1, r2, r1End and r2End appropriately, preserve the important
+     * parts of the destination region until the end in case it's one of
+     * the two source regions, then mark the "new" region empty, allocating
+     * another array of rectangles for it to use.
+     */
+    r1 = reg1->rects;
+    r2 = reg2->rects;
+    r1End = r1 + reg1->numRects;
+    r2End = r2 + reg2->numRects;
+    
+
+    /*
+     * newReg may be one of the src regions so we can't empty it. We keep a 
+     * note of its rects pointer (so that we can free them later), preserve its
+     * extents and simply set numRects to zero. 
+     */
+
+    oldRects = newReg->rects;
+    newReg->numRects = 0;
+
+    /*
+     * Allocate a reasonable number of rectangles for the new region. The idea
+     * is to allocate enough so the individual functions don't need to
+     * reallocate and copy the array, which is time consuming, yet we don't
+     * have to worry about using too much memory. I hope to be able to
+     * nuke the Xrealloc() at the end of this function eventually.
+     */
+    newReg->size = MWMAX(reg1->numRects,reg2->numRects) * 2;
+
+    if (! (newReg->rects = malloc( sizeof(MWRECT) * newReg->size )))
+    {
+	newReg->size = 0;
+	return;
+    }
+    
+    /*
+     * Initialize ybot and ytop.
+     * In the upcoming loop, ybot and ytop serve different functions depending
+     * on whether the band being handled is an overlapping or non-overlapping
+     * band.
+     *  In the case of a non-overlapping band (only one of the regions
+     * has points in the band), ybot is the bottom of the most recent
+     * intersection and thus clips the top of the rectangles in that band.
+     * ytop is the top of the next intersection between the two regions and
+     * serves to clip the bottom of the rectangles in the current band.
+     *  For an overlapping band (where the two regions intersect), ytop clips
+     * the top of the rectangles of both regions and ybot clips the bottoms.
+     */
+    if (reg1->extents.top < reg2->extents.top)
+	ybot = reg1->extents.top;
+    else
+	ybot = reg2->extents.top;
+    
+    /*
+     * prevBand serves to mark the start of the previous band so rectangles
+     * can be coalesced into larger rectangles. qv. miCoalesce, above.
+     * In the beginning, there is no previous band, so prevBand == curBand
+     * (curBand is set later on, of course, but the first band will always
+     * start at index 0). prevBand and curBand must be indices because of
+     * the possible expansion, and resultant moving, of the new region's
+     * array of rectangles.
+     */
+    prevBand = 0;
+    
+    do
+    {
+	curBand = newReg->numRects;
+
+	/*
+	 * This algorithm proceeds one source-band (as opposed to a
+	 * destination band, which is determined by where the two regions
+	 * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the
+	 * rectangle after the last one in the current band for their
+	 * respective regions.
+	 */
+	r1BandEnd = r1;
+	while ((r1BandEnd != r1End) && (r1BandEnd->top == r1->top))
+	{
+	    r1BandEnd++;
+	}
+	
+	r2BandEnd = r2;
+	while ((r2BandEnd != r2End) && (r2BandEnd->top == r2->top))
+	{
+	    r2BandEnd++;
+	}
+	
+	/*
+	 * First handle the band that doesn't intersect, if any.
+	 *
+	 * Note that attention is restricted to one band in the
+	 * non-intersecting region at once, so if a region has n
+	 * bands between the current position and the next place it overlaps
+	 * the other, this entire loop will be passed through n times.
+	 */
+	if (r1->top < r2->top)
+	{
+	    top = MWMAX(r1->top,ybot);
+	    bot = MWMIN(r1->bottom,r2->top);
+
+	    if ((top != bot) && (nonOverlap1Func != (void (*)())NULL))
+	    {
+		(* nonOverlap1Func) (newReg, r1, r1BandEnd, top, bot);
+	    }
+
+	    ytop = r2->top;
+	}
+	else if (r2->top < r1->top)
+	{
+	    top = MWMAX(r2->top,ybot);
+	    bot = MWMIN(r2->bottom,r1->top);
+
+	    if ((top != bot) && (nonOverlap2Func != (void (*)())NULL))
+	    {
+		(* nonOverlap2Func) (newReg, r2, r2BandEnd, top, bot);
+	    }
+
+	    ytop = r1->top;
+	}
+	else
+	{
+	    ytop = r1->top;
+	}
+
+	/*
+	 * If any rectangles got added to the region, try and coalesce them
+	 * with rectangles from the previous band. Note we could just do
+	 * this test in miCoalesce, but some machines incur a not
+	 * inconsiderable cost for function calls, so...
+	 */
+	if (newReg->numRects != curBand)
+	{
+	    prevBand = REGION_Coalesce (newReg, prevBand, curBand);
+	}
+
+	/*
+	 * Now see if we've hit an intersecting band. The two bands only
+	 * intersect if ybot > ytop
+	 */
+	ybot = MWMIN(r1->bottom, r2->bottom);
+	curBand = newReg->numRects;
+	if (ybot > ytop)
+	{
+	    (* overlapFunc) (newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot);
+
+	}
+	
+	if (newReg->numRects != curBand)
+	{
+	    prevBand = REGION_Coalesce (newReg, prevBand, curBand);
+	}
+
+	/*
+	 * If we've finished with a band (bottom == ybot) we skip forward
+	 * in the region to the next band.
+	 */
+	if (r1->bottom == ybot)
+	{
+	    r1 = r1BandEnd;
+	}
+	if (r2->bottom == ybot)
+	{
+	    r2 = r2BandEnd;
+	}
+    } while ((r1 != r1End) && (r2 != r2End));
+
+    /*
+     * Deal with whichever region still has rectangles left.
+     */
+    curBand = newReg->numRects;
+    if (r1 != r1End)
+    {
+	if (nonOverlap1Func != (void (*)())NULL)
+	{
+	    do
+	    {
+		r1BandEnd = r1;
+		while ((r1BandEnd < r1End) && (r1BandEnd->top == r1->top))
+		{
+		    r1BandEnd++;
+		}
+		(* nonOverlap1Func) (newReg, r1, r1BandEnd,
+				     MWMAX(r1->top,ybot), r1->bottom);
+		r1 = r1BandEnd;
+	    } while (r1 != r1End);
+	}
+    }
+    else if ((r2 != r2End) && (nonOverlap2Func != (void (*)())NULL))
+    {
+	do
+	{
+	    r2BandEnd = r2;
+	    while ((r2BandEnd < r2End) && (r2BandEnd->top == r2->top))
+	    {
+		 r2BandEnd++;
+	    }
+	    (* nonOverlap2Func) (newReg, r2, r2BandEnd,
+				MWMAX(r2->top,ybot), r2->bottom);
+	    r2 = r2BandEnd;
+	} while (r2 != r2End);
+    }
+
+    if (newReg->numRects != curBand)
+    {
+	(void) REGION_Coalesce (newReg, prevBand, curBand);
+    }
+
+    /*
+     * A bit of cleanup. To keep regions from growing without bound,
+     * we shrink the array of rectangles to match the new number of
+     * rectangles in the region. This never goes to 0, however...
+     *
+     * Only do this stuff if the number of rectangles allocated is more than
+     * twice the number of rectangles in the region (a simple optimization...).
+     */
+    if (newReg->numRects < (newReg->size >> 1))
+    {
+	if (REGION_NOT_EMPTY(newReg))
+	{
+	    MWRECT *prev_rects = newReg->rects;
+	    newReg->size = newReg->numRects;
+	    newReg->rects = realloc( newReg->rects, sizeof(MWRECT) * newReg->size );
+	    if (! newReg->rects)
+		newReg->rects = prev_rects;
+	}
+	else
+	{
+	    /*
+	     * No point in doing the extra work involved in an Xrealloc if
+	     * the region is empty
+	     */
+	    newReg->size = 1;
+	    free( newReg->rects );
+	    newReg->rects = malloc( sizeof(MWRECT) );
+	}
+    }
+    free( oldRects );
+}
+
+/***********************************************************************
+ *          Region Intersection
+ ***********************************************************************/
+
+
+/***********************************************************************
+ *	     REGION_IntersectO
+ *
+ * Handle an overlapping band for REGION_Intersect.
+ *
+ * Results:
+ *      None.
+ *
+ * Side Effects:
+ *      Rectangles may be added to the region.
+ *
+ */
+static void
+REGION_IntersectO(MWCLIPREGION *pReg,  MWRECT *r1, MWRECT *r1End,
+			MWRECT *r2, MWRECT *r2End, MWCOORD top, MWCOORD bottom)
+
+{
+    MWCOORD       left, right;
+    MWRECT      *pNextRect;
+
+    pNextRect = &pReg->rects[pReg->numRects];
+
+    while ((r1 != r1End) && (r2 != r2End))
+    {
+	left = MWMAX(r1->left, r2->left);
+	right =	MWMIN(r1->right, r2->right);
+
+	/*
+	 * If there's any overlap between the two rectangles, add that
+	 * overlap to the new region.
+	 * There's no need to check for subsumption because the only way
+	 * such a need could arise is if some region has two rectangles
+	 * right next to each other. Since that should never happen...
+	 */
+	if (left < right)
+	{
+	    MEMCHECK(pReg, pNextRect, pReg->rects);
+	    pNextRect->left = left;
+	    pNextRect->top = top;
+	    pNextRect->right = right;
+	    pNextRect->bottom = bottom;
+	    pReg->numRects += 1;
+	    pNextRect++;
+	}
+
+	/*
+	 * Need to advance the pointers. Shift the one that extends
+	 * to the right the least, since the other still has a chance to
+	 * overlap with that region's next rectangle, if you see what I mean.
+	 */
+	if (r1->right < r2->right)
+	{
+	    r1++;
+	}
+	else if (r2->right < r1->right)
+	{
+	    r2++;
+	}
+	else
+	{
+	    r1++;
+	    r2++;
+	}
+    }
+}
+
+/***********************************************************************
+ *	     GdIntersectRegion
+ */
+void
+GdIntersectRegion(MWCLIPREGION *newReg, MWCLIPREGION *reg1, MWCLIPREGION *reg2)
+{
+   /* check for trivial reject */
+    if ( (!(reg1->numRects)) || (!(reg2->numRects))  ||
+	(!EXTENTCHECK(&reg1->extents, &reg2->extents)))
+	newReg->numRects = 0;
+    else
+	REGION_RegionOp (newReg, reg1, reg2, 
+	 (voidProcp) REGION_IntersectO, (voidProcp) NULL, (voidProcp) NULL);
+    
+    /*
+     * Can't alter newReg's extents before we call miRegionOp because
+     * it might be one of the source regions and miRegionOp depends
+     * on the extents of those regions being the same. Besides, this
+     * way there's no checking against rectangles that will be nuked
+     * due to coalescing, so we have to examine fewer rectangles.
+     */
+    REGION_SetExtents(newReg);
+    newReg->type = (newReg->numRects) ? MWREGION_COMPLEX : MWREGION_NULL ;
+}
+
+/***********************************************************************
+ *	     Region Union
+ ***********************************************************************/
+
+/***********************************************************************
+ *	     REGION_UnionNonO
+ *
+ *      Handle a non-overlapping band for the union operation. Just
+ *      Adds the rectangles into the region. Doesn't have to check for
+ *      subsumption or anything.
+ *
+ * Results:
+ *      None.
+ *
+ * Side Effects:
+ *      pReg->numRects is incremented and the final rectangles overwritten
+ *      with the rectangles we're passed.
+ *
+ */
+static void
+REGION_UnionNonO(MWCLIPREGION *pReg,MWRECT *r,MWRECT *rEnd,MWCOORD top,
+	MWCOORD bottom)
+{
+    MWRECT *pNextRect;
+
+    pNextRect = &pReg->rects[pReg->numRects];
+
+    while (r != rEnd)
+    {
+	MEMCHECK(pReg, pNextRect, pReg->rects);
+	pNextRect->left = r->left;
+	pNextRect->top = top;
+	pNextRect->right = r->right;
+	pNextRect->bottom = bottom;
+	pReg->numRects += 1;
+	pNextRect++;
+	r++;
+    }
+}
+
+/***********************************************************************
+ *	     REGION_UnionO
+ *
+ *      Handle an overlapping band for the union operation. Picks the
+ *      left-most rectangle each time and merges it into the region.
+ *
+ * Results:
+ *      None.
+ *
+ * Side Effects:
+ *      Rectangles are overwritten in pReg->rects and pReg->numRects will
+ *      be changed.
+ *
+ */
+static void
+REGION_UnionO(MWCLIPREGION *pReg, MWRECT *r1, MWRECT *r1End,
+	MWRECT *r2, MWRECT *r2End, MWCOORD top, MWCOORD bottom)
+{
+    MWRECT *pNextRect;
+    
+    pNextRect = &pReg->rects[pReg->numRects];
+
+#define MERGERECT(r) \
+    if ((pReg->numRects != 0) &&  \
+	(pNextRect[-1].top == top) &&  \
+	(pNextRect[-1].bottom == bottom) &&  \
+	(pNextRect[-1].right >= r->left))  \
+    {  \
+	if (pNextRect[-1].right < r->right)  \
+	{  \
+	    pNextRect[-1].right = r->right;  \
+	}  \
+    }  \
+    else  \
+    {  \
+	MEMCHECK(pReg, pNextRect, pReg->rects);  \
+	pNextRect->top = top;  \
+	pNextRect->bottom = bottom;  \
+	pNextRect->left = r->left;  \
+	pNextRect->right = r->right;  \
+	pReg->numRects += 1;  \
+	pNextRect += 1;  \
+    }  \
+    r++;
+    
+    while ((r1 != r1End) && (r2 != r2End))
+    {
+	if (r1->left < r2->left)
+	{
+	    MERGERECT(r1);
+	}
+	else
+	{
+	    MERGERECT(r2);
+	}
+    }
+    
+    if (r1 != r1End)
+    {
+	do
+	{
+	    MERGERECT(r1);
+	} while (r1 != r1End);
+    }
+    else while (r2 != r2End)
+    {
+	MERGERECT(r2);
+    }
+}
+
+/***********************************************************************
+ *	     GdUnionRegion
+ */
+void
+GdUnionRegion(MWCLIPREGION *newReg, MWCLIPREGION *reg1, MWCLIPREGION *reg2)
+{
+    /*  checks all the simple cases */
+
+    /*
+     * Region 1 and 2 are the same or region 1 is empty
+     */
+    if ( (reg1 == reg2) || (!(reg1->numRects)) )
+    {
+	if (newReg != reg2)
+	    GdCopyRegion(newReg, reg2);
+	return;
+    }
+
+    /*
+     * if nothing to union (region 2 empty)
+     */
+    if (!(reg2->numRects))
+    {
+	if (newReg != reg1)
+	    GdCopyRegion(newReg, reg1);
+	return;
+    }
+
+    /*
+     * Region 1 completely subsumes region 2
+     */
+    if ((reg1->numRects == 1) && 
+	(reg1->extents.left <= reg2->extents.left) &&
+	(reg1->extents.top <= reg2->extents.top) &&
+	(reg1->extents.right >= reg2->extents.right) &&
+	(reg1->extents.bottom >= reg2->extents.bottom))
+    {
+	if (newReg != reg1)
+	    GdCopyRegion(newReg, reg1);
+	return;
+    }
+
+    /*
+     * Region 2 completely subsumes region 1
+     */
+    if ((reg2->numRects == 1) && 
+	(reg2->extents.left <= reg1->extents.left) &&
+	(reg2->extents.top <= reg1->extents.top) &&
+	(reg2->extents.right >= reg1->extents.right) &&
+	(reg2->extents.bottom >= reg1->extents.bottom))
+    {
+	if (newReg != reg2)
+	    GdCopyRegion(newReg, reg2);
+	return;
+    }
+
+    REGION_RegionOp (newReg, reg1, reg2, (voidProcp) REGION_UnionO, 
+		(voidProcp) REGION_UnionNonO, (voidProcp) REGION_UnionNonO);
+
+    newReg->extents.left = MWMIN(reg1->extents.left, reg2->extents.left);
+    newReg->extents.top = MWMIN(reg1->extents.top, reg2->extents.top);
+    newReg->extents.right = MWMAX(reg1->extents.right, reg2->extents.right);
+    newReg->extents.bottom = MWMAX(reg1->extents.bottom, reg2->extents.bottom);
+    newReg->type = (newReg->numRects) ? MWREGION_COMPLEX : MWREGION_NULL ;
+}
+
+/***********************************************************************
+ *	     Region Subtraction
+ ***********************************************************************/
+
+/***********************************************************************
+ *	     REGION_SubtractNonO1
+ *
+ *      Deal with non-overlapping band for subtraction. Any parts from
+ *      region 2 we discard. Anything from region 1 we add to the region.
+ *
+ * Results:
+ *      None.
+ *
+ * Side Effects:
+ *      pReg may be affected.
+ *
+ */
+static void
+REGION_SubtractNonO1(MWCLIPREGION *pReg, MWRECT *r, MWRECT *rEnd,
+	MWCOORD top, MWCOORD bottom)
+{
+    MWRECT *pNextRect;
+	
+    pNextRect = &pReg->rects[pReg->numRects];
+	
+    while (r != rEnd)
+    {
+	MEMCHECK(pReg, pNextRect, pReg->rects);
+	pNextRect->left = r->left;
+	pNextRect->top = top;
+	pNextRect->right = r->right;
+	pNextRect->bottom = bottom;
+	pReg->numRects += 1;
+	pNextRect++;
+	r++;
+    }
+}
+
+
+/***********************************************************************
+ *	     REGION_SubtractO
+ *
+ *      Overlapping band subtraction. x1 is the left-most point not yet
+ *      checked.
+ *
+ * Results:
+ *      None.
+ *
+ * Side Effects:
+ *      pReg may have rectangles added to it.
+ *
+ */
+static void
+REGION_SubtractO(MWCLIPREGION *pReg, MWRECT *r1, MWRECT *r1End,
+	MWRECT *r2, MWRECT *r2End, MWCOORD top, MWCOORD bottom)
+{
+    MWRECT *pNextRect;
+    MWCOORD left;
+    
+    left = r1->left;
+    pNextRect = &pReg->rects[pReg->numRects];
+
+    while ((r1 != r1End) && (r2 != r2End))
+    {
+	if (r2->right <= left)
+	{
+	    /*
+	     * Subtrahend missed the boat: go to next subtrahend.
+	     */
+	    r2++;
+	}
+	else if (r2->left <= left)
+	{
+	    /*
+	     * Subtrahend preceeds minuend: nuke left edge of minuend.
+	     */
+	    left = r2->right;
+	    if (left >= r1->right)
+	    {
+		/*
+		 * Minuend completely covered: advance to next minuend and
+		 * reset left fence to edge of new minuend.
+		 */
+		r1++;
+		if (r1 != r1End)
+		    left = r1->left;
+	    }
+	    else
+	    {
+		/*
+		 * Subtrahend now used up since it doesn't extend beyond
+		 * minuend
+		 */
+		r2++;
+	    }
+	}
+	else if (r2->left < r1->right)
+	{
+	    /*
+	     * Left part of subtrahend covers part of minuend: add uncovered
+	     * part of minuend to region and skip to next subtrahend.
+	     */
+	    MEMCHECK(pReg, pNextRect, pReg->rects);
+	    pNextRect->left = left;
+	    pNextRect->top = top;
+	    pNextRect->right = r2->left;
+	    pNextRect->bottom = bottom;
+	    pReg->numRects += 1;
+	    pNextRect++;
+	    left = r2->right;
+	    if (left >= r1->right)
+	    {
+		/*
+		 * Minuend used up: advance to new...
+		 */
+		r1++;
+		if (r1 != r1End)
+		    left = r1->left;
+	    }
+	    else
+	    {
+		/*
+		 * Subtrahend used up
+		 */
+		r2++;
+	    }
+	}
+	else
+	{
+	    /*
+	     * Minuend used up: add any remaining piece before advancing.
+	     */
+	    if (r1->right > left)
+	    {
+		MEMCHECK(pReg, pNextRect, pReg->rects);
+		pNextRect->left = left;
+		pNextRect->top = top;
+		pNextRect->right = r1->right;
+		pNextRect->bottom = bottom;
+		pReg->numRects += 1;
+		pNextRect++;
+	    }
+	    r1++;
+	    left = r1->left;
+	}
+    }
+
+    /*
+     * Add remaining minuend rectangles to region.
+     */
+    while (r1 != r1End)
+    {
+	MEMCHECK(pReg, pNextRect, pReg->rects);
+	pNextRect->left = left;
+	pNextRect->top = top;
+	pNextRect->right = r1->right;
+	pNextRect->bottom = bottom;
+	pReg->numRects += 1;
+	pNextRect++;
+	r1++;
+	if (r1 != r1End)
+	{
+	    left = r1->left;
+	}
+    }
+}
+	
+/***********************************************************************
+ *	     GdSubtractRegion
+ *
+ *      Subtract regS from regM and leave the result in regD.
+ *      S stands for subtrahend, M for minuend and D for difference.
+ *
+ * Results:
+ *      TRUE.
+ *
+ * Side Effects:
+ *      regD is overwritten.
+ *
+ */
+void
+GdSubtractRegion(MWCLIPREGION *regD, MWCLIPREGION *regM, MWCLIPREGION *regS )
+{
+   /* check for trivial reject */
+    if ( (!(regM->numRects)) || (!(regS->numRects))  ||
+	(!EXTENTCHECK(&regM->extents, &regS->extents)) )
+    {
+	GdCopyRegion(regD, regM);
+	return;
+    }
+ 
+    REGION_RegionOp (regD, regM, regS, (voidProcp) REGION_SubtractO, 
+		(voidProcp) REGION_SubtractNonO1, (voidProcp) NULL);
+
+    /*
+     * Can't alter newReg's extents before we call miRegionOp because
+     * it might be one of the source regions and miRegionOp depends
+     * on the extents of those regions being the unaltered. Besides, this
+     * way there's no checking against rectangles that will be nuked
+     * due to coalescing, so we have to examine fewer rectangles.
+     */
+    REGION_SetExtents (regD);
+    regD->type = (regD->numRects) ? MWREGION_COMPLEX : MWREGION_NULL ;
+}
+
+/***********************************************************************
+ *	     GdXorRegion
+ */
+void
+GdXorRegion(MWCLIPREGION *dr, MWCLIPREGION *sra, MWCLIPREGION *srb)
+{
+    MWCLIPREGION *tra, *trb;
+
+    if ((! (tra = GdAllocRegion())) || (! (trb = GdAllocRegion())))
+	return;
+    GdSubtractRegion(tra,sra,srb);
+    GdSubtractRegion(trb,srb,sra);
+    GdUnionRegion(dr,tra,trb);
+    GdDestroyRegion(tra);
+    GdDestroyRegion(trb);
+}
+
+#if 0
+/***********************************************************************
+ *            DumpRegion
+ *            Outputs the contents of a MWCLIPREGION
+ */
+void
+DumpRegion(MWCLIPREGION *pReg)
+{
+    MWRECT *pRect, *pRectEnd = pReg->rects + pReg->numRects;
+
+    DPRINTF("Region %p: %d,%d - %d,%d %d rects\n", pReg,
+	    pReg->extents.left, pReg->extents.top,
+	    pReg->extents.right, pReg->extents.bottom, pReg->numRects);
+    for(pRect = pReg->rects; pRect < pRectEnd; pRect++)
+        DPRINTF("\t%d,%d - %d,%d\n", pRect->left, pRect->top,
+		pRect->right, pRect->bottom);
+}
+#endif
diff -urN lib/microwindows/src/engine/devrgn2.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devrgn2.c
--- lib/microwindows/src/engine/devrgn2.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devrgn2.c	2005-02-21 16:03:23.000000000 +0100
@@ -0,0 +1,910 @@
+/*
+ * Portions Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *	Somewhat less shamelessly ripped from the Wine distribution
+ *	and the X Window System.
+ *
+ * Device-independent Microwindows polygon regions, implemented using
+ * multiple rectangles.
+ *
+ * Shamelessly ripped out from the X11 distribution
+ * Thanks for the nice licence.
+ *
+ * Copyright 1993, 1994, 1995 Alexandre Julliard
+ * Modifications and additions: Copyright 1998 Huw Davies
+ */
+
+/************************************************************************
+
+Copyright (c) 1987, 1988  X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+
+
+Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "device.h"
+
+#if POLYREGIONS
+
+/*
+ * number of points to buffer before sending them off
+ * to scanlines() :  Must be an even number
+ */
+#define NUMPTSTOBUFFER 200
+  
+/*
+ * used to allocate buffers for points and link
+ * the buffers together
+ */
+
+typedef struct _POINTBLOCK {  
+    MWPOINT pts[NUMPTSTOBUFFER];
+    struct _POINTBLOCK *next;
+} POINTBLOCK;
+
+/*
+ *     This file contains a few macros to help track
+ *     the edge of a filled object.  The object is assumed
+ *     to be filled in scanline order, and thus the
+ *     algorithm used is an extension of Bresenham's line
+ *     drawing algorithm which assumes that y is always the
+ *     major axis.
+ *     Since these pieces of code are the same for any filled shape,
+ *     it is more convenient to gather the library in one
+ *     place, but since these pieces of code are also in 
+ *     the inner loops of output primitives, procedure call
+ *     overhead is out of the question.
+ *     See the author for a derivation if needed.
+ */
+
+/* 
+ *  In scan converting polygons, we want to choose those pixels
+ *  which are inside the polygon.  Thus, we add .5 to the starting
+ *  x coordinate for both left and right edges.  Now we choose the
+ *  first pixel which is inside the pgon for the left edge and the
+ *  first pixel which is outside the pgon for the right edge.
+ *  Draw the left pixel, but not the right.
+ *
+ *  How to add .5 to the starting x coordinate:
+ *      If the edge is moving to the right, then subtract dy from the
+ *  error term from the general form of the algorithm.
+ *      If the edge is moving to the left, then add dy to the error term.
+ *
+ *  The reason for the difference between edges moving to the left
+ *  and edges moving to the right is simple:  If an edge is moving
+ *  to the right, then we want the algorithm to flip immediately. 
+ *  If it is moving to the left, then we don't want it to flip until
+ *  we traverse an entire pixel.
+ */
+
+#define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2) { \
+    int dx;      /* local storage */ \
+\
+    /* \
+     *  if the edge is horizontal, then it is ignored \
+     *  and assumed not to be processed.  Otherwise, do this stuff. \
+     */ \
+    if ((dy) != 0) { \
+        xStart = (x1); \
+        dx = (x2) - xStart; \
+        if (dx < 0) { \
+            m = dx / (dy); \
+            m1 = m - 1; \
+            incr1 = (-2) * (dx) + 2 * (dy) * (m1); \
+            incr2 = (-2) * (dx) + 2 * (dy) * (m); \
+            d = 2 * (m) * (dy) - 2 * (dx) - 2 * (dy); \
+        } else { \
+            m = dx / (dy); \
+            m1 = m + 1; \
+            incr1 = (2 * dx) - 2 * (dy) * m1; \
+            incr2 = (2 * dx) - 2 * (dy) * m; \
+            d = (-2) * m * (dy) + 2 * dx; \
+        } \
+    } \
+}
+
+#define BRESINCRPGON(d, minval, m, m1, incr1, incr2) { \
+    if (m1 > 0) { \
+        if (d > 0) { \
+            minval += m1; \
+            d += incr1; \
+        } \
+        else { \
+            minval += m; \
+            d += incr2; \
+        } \
+    } else {\
+        if (d >= 0) { \
+            minval += m1; \
+            d += incr1; \
+        } \
+        else { \
+            minval += m; \
+            d += incr2; \
+        } \
+    } \
+}
+
+
+/*
+ *     This structure contains all of the information needed
+ *     to run the bresenham algorithm.
+ *     The variables may be hardcoded into the declarations
+ *     instead of using this structure to make use of
+ *     register declarations.
+ */
+typedef struct {
+    MWCOORD minor_axis; /* minor axis        */
+    int d;              /* decision variable */
+    int m, m1;          /* slope and slope+1 */
+    int incr1, incr2;   /* error increments */
+} BRESINFO;
+
+#define BRESINITPGONSTRUCT(dmaj, min1, min2, bres) \
+        BRESINITPGON(dmaj, min1, min2, bres.minor_axis, bres.d, \
+                     bres.m, bres.m1, bres.incr1, bres.incr2)
+
+#define BRESINCRPGONSTRUCT(bres) \
+        BRESINCRPGON(bres.d, bres.minor_axis, bres.m, bres.m1, bres.incr1, bres.incr2)
+
+
+/*
+ *     These are the data structures needed to scan   
+ *     convert regions.  Two different scan conversion  
+ *     methods are available -- the even-odd method, and
+ *     the winding number method.
+ *     The even-odd rule states that a point is inside  
+ *     the polygon if a ray drawn from that point in any
+ *     direction will pass through an odd number of
+ *     path segments.
+ *     By the winding number rule, a point is decided   
+ *     to be inside the polygon if a ray drawn from that
+ *     point in any direction passes through a different
+ *     number of clockwise and counter-clockwise path
+ *     segments.
+ *
+ *     These data structures are adapted somewhat from
+ *     the algorithm in (Foley/Van Dam) for scan converting
+ *     polygons.
+ *     The basic algorithm is to start at the top (smallest y)
+ *     of the polygon, stepping down to the bottom of   
+ *     the polygon by incrementing the y coordinate.  We
+ *     keep a list of edges which the current scanline crosses,
+ *     sorted by x.  This list is called the Active Edge Table (AET)
+ *     As we change the y-coordinate, we update each entry in 
+ *     in the active edge table to reflect the edges new xcoord.
+ *     This list must be sorted at each scanline in case
+ *     two edges intersect.
+ *     We also keep a data structure known as the Edge Table (ET),
+ *     which keeps track of all the edges which the current
+ *     scanline has not yet reached.  The ET is basically a
+ *     list of ScanLineList structures containing a list of
+ *     edges which are entered at a given scanline.  There is one
+ *     ScanLineList per scanline at which an edge is entered.
+ *     When we enter a new edge, we move it from the ET to the AET.
+ *
+ *     From the AET, we can implement the even-odd rule as in
+ *     (Foley/Van Dam).
+ *     The winding number rule is a little trickier.  We also
+ *     keep the EdgeTableEntries in the AET linked by the
+ *     nextWETE (winding EdgeTableEntry) link.  This allows
+ *     the edges to be linked just as before for updating  
+ *     purposes, but only uses the edges linked by the nextWETE
+ *     link as edges representing spans of the polygon to
+ *     drawn (as with the even-odd rule).
+ */
+
+/*
+ * for the winding number rule
+ */
+#define CLOCKWISE          1
+#define COUNTERCLOCKWISE  -1
+
+typedef struct _EdgeTableEntry {
+     MWCOORD ymax;           /* ycoord at which we exit this edge. */  
+     BRESINFO bres;        /* Bresenham info to run the edge     */
+     struct _EdgeTableEntry *next;       /* next in the list     */
+     struct _EdgeTableEntry *back;       /* for insertion sort   */
+     struct _EdgeTableEntry *nextWETE;   /* for winding num rule */
+     int ClockWise;        /* flag for winding number rule       */
+} EdgeTableEntry;
+
+
+typedef struct _ScanLineList{
+     int scanline;            /* the scanline represented */  
+     EdgeTableEntry *edgelist;  /* header node              */
+     struct _ScanLineList *next;  /* next in the list       */
+} ScanLineList;
+
+
+typedef struct {
+     MWCOORD ymax;               /* ymax for the polygon     */
+     MWCOORD ymin;               /* ymin for the polygon     */
+     ScanLineList scanlines;   /* header node              */
+} EdgeTable;
+
+
+/*
+ * Here is a struct to help with storage allocation
+ * so we can allocate a big chunk at a time, and then take
+ * pieces from this heap when we need to.
+ */
+#define SLLSPERBLOCK 25
+
+typedef struct _ScanLineListBlock {
+     ScanLineList SLLs[SLLSPERBLOCK];
+     struct _ScanLineListBlock *next;
+} ScanLineListBlock;
+
+/*
+ *
+ *     a few macros for the inner loops of the fill code where
+ *     performance considerations don't allow a procedure call.
+ *
+ *     Evaluate the given edge at the given scanline.
+ *     If the edge has expired, then we leave it and fix up
+ *     the active edge table; otherwise, we increment the  
+ *     x value to be ready for the next scanline.
+ *     The winding number rule is in effect, so we must notify
+ *     the caller when the edge has been removed so he
+ *     can reorder the Winding Active Edge Table.
+ */
+#define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET) { \
+   if (pAET->ymax == y) {          /* leaving this edge */ \
+      pPrevAET->next = pAET->next; \
+      pAET = pPrevAET->next; \
+      fixWAET = 1; \
+      if (pAET) \
+         pAET->back = pPrevAET; \
+   } \
+   else { \
+      BRESINCRPGONSTRUCT(pAET->bres); \
+      pPrevAET = pAET; \
+      pAET = pAET->next; \
+   } \
+}
+
+
+/*
+ *     Evaluate the given edge at the given scanline.
+ *     If the edge has expired, then we leave it and fix up
+ *     the active edge table; otherwise, we increment the  
+ *     x value to be ready for the next scanline.
+ *     The even-odd rule is in effect.
+ */
+#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y) { \
+   if (pAET->ymax == y) {          /* leaving this edge */ \
+      pPrevAET->next = pAET->next; \
+      pAET = pPrevAET->next; \
+      if (pAET) \
+         pAET->back = pPrevAET; \
+   } \
+   else { \
+      BRESINCRPGONSTRUCT(pAET->bres); \
+      pPrevAET = pAET; \
+      pAET = pAET->next; \
+   } \
+}
+
+
+
+#define LARGE_COORDINATE  0x7fffffff /* FIXME */
+#define SMALL_COORDINATE  0x80000000
+
+/*
+ *     REGION_InsertEdgeInET
+ *
+ *     Insert the given edge into the edge table.
+ *     First we must find the correct bucket in the
+ *     Edge table, then find the right slot in the
+ *     bucket.  Finally, we can insert it.
+ *
+ */
+static void REGION_InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE,
+                int scanline, ScanLineListBlock **SLLBlock, int *iSLLBlock) 
+
+{
+    EdgeTableEntry *start, *prev;
+    ScanLineList *pSLL, *pPrevSLL;
+    ScanLineListBlock *tmpSLLBlock;
+
+    /*
+     * find the right bucket to put the edge into
+     */
+    pPrevSLL = &ET->scanlines;
+    pSLL = pPrevSLL->next;
+    while (pSLL && (pSLL->scanline < scanline))
+    {
+        pPrevSLL = pSLL;
+        pSLL = pSLL->next;
+    }
+
+    /*
+     * reassign pSLL (pointer to ScanLineList) if necessary
+     */
+    if ((!pSLL) || (pSLL->scanline > scanline))
+    {
+        if (*iSLLBlock > SLLSPERBLOCK-1)
+        {
+            tmpSLLBlock = malloc( sizeof(ScanLineListBlock)); 
+            if(!tmpSLLBlock)
+            {
+                return;
+            }
+            (*SLLBlock)->next = tmpSLLBlock;
+            tmpSLLBlock->next = (ScanLineListBlock *)NULL;
+            *SLLBlock = tmpSLLBlock;
+            *iSLLBlock = 0;
+        }
+        pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]);
+
+        pSLL->next = pPrevSLL->next;
+        pSLL->edgelist = (EdgeTableEntry *)NULL;
+        pPrevSLL->next = pSLL;
+    }
+    pSLL->scanline = scanline;
+
+    /*
+     * now insert the edge in the right bucket
+     */
+    prev = (EdgeTableEntry *)NULL;
+    start = pSLL->edgelist;
+    while (start && (start->bres.minor_axis < ETE->bres.minor_axis))
+    {
+        prev = start;
+        start = start->next;
+    }
+    ETE->next = start;
+
+    if (prev)
+        prev->next = ETE;
+    else
+        pSLL->edgelist = ETE;
+}
+
+
+/*
+ *     REGION_CreateEdgeTable
+ *
+ *     This routine creates the edge table for
+ *     scan converting polygons.
+ *     The Edge Table (ET) looks like:
+ *
+ *    EdgeTable
+ *     --------
+ *    |  ymax  |        ScanLineLists
+ *    |scanline|-->------------>-------------->...
+ *     --------   |scanline|   |scanline|
+ *                |edgelist|   |edgelist|
+ *                ---------    ---------
+ *                    |             |
+ *                    |             |
+ *                    V             V
+ *              list of ETEs   list of ETEs
+ *
+ *     where ETE is an EdgeTableEntry data structure,
+ *     and there is one ScanLineList per scanline at
+ *     which an edge is initially entered.
+ *
+ */
+static void REGION_CreateETandAET(int *Count, int nbpolygons,
+            MWPOINT *pts, EdgeTable *ET, EdgeTableEntry *AET,
+            EdgeTableEntry *pETEs, ScanLineListBlock *pSLLBlock)
+{
+    MWPOINT *top, *bottom;
+    MWPOINT *PrevPt, *CurrPt, *EndPt;
+    int poly, count;
+    int iSLLBlock = 0;
+    int dy;
+
+
+    /*
+     *  initialize the Active Edge Table
+     */
+    AET->next = (EdgeTableEntry *)NULL;
+    AET->back = (EdgeTableEntry *)NULL;
+    AET->nextWETE = (EdgeTableEntry *)NULL;
+    AET->bres.minor_axis = SMALL_COORDINATE;
+
+    /*
+     *  initialize the Edge Table.
+     */
+    ET->scanlines.next = (ScanLineList *)NULL;
+    ET->ymax = SMALL_COORDINATE;
+    ET->ymin = LARGE_COORDINATE;
+    pSLLBlock->next = (ScanLineListBlock *)NULL;
+
+    EndPt = pts - 1;
+    for(poly = 0; poly < nbpolygons; poly++)
+    {
+        count = Count[poly];
+        EndPt += count;
+        if(count < 2)
+            continue;
+
+        PrevPt = EndPt;
+
+    /*
+     *  for each vertex in the array of points.
+     *  In this loop we are dealing with two vertices at
+     *  a time -- these make up one edge of the polygon.
+     */
+        while (count--)
+        {
+            CurrPt = pts++;
+        /*
+         *  find out which point is above and which is below.
+         */
+            if (PrevPt->y > CurrPt->y)
+            {
+                bottom = PrevPt, top = CurrPt;
+                pETEs->ClockWise = 0;
+            }
+            else
+            {
+                bottom = CurrPt, top = PrevPt;
+                pETEs->ClockWise = 1;
+            }
+
+        /*
+         * don't add horizontal edges to the Edge table.
+         */
+            if (bottom->y != top->y)
+            {
+                pETEs->ymax = bottom->y-1;
+                                /* -1 so we don't get last scanline */
+
+            /*
+             *  initialize integer edge algorithm
+             */
+                dy = bottom->y - top->y;
+                
+                BRESINITPGONSTRUCT(dy, top->x, bottom->x, pETEs->bres);
+
+                REGION_InsertEdgeInET(ET, pETEs, top->y, &pSLLBlock,
+                                                                &iSLLBlock);
+
+                if (PrevPt->y > ET->ymax)
+                  ET->ymax = PrevPt->y;
+                if (PrevPt->y < ET->ymin)
+                  ET->ymin = PrevPt->y;
+                pETEs++;
+            }
+
+            PrevPt = CurrPt;
+        }
+    }
+}
+
+/*
+ *     REGION_loadAET
+ *
+ *     This routine moves EdgeTableEntries from the
+ *     EdgeTable into the Active Edge Table,
+ *     leaving them sorted by smaller x coordinate.
+ *
+ */
+static void REGION_loadAET(EdgeTableEntry *AET, EdgeTableEntry *ETEs)
+{
+    EdgeTableEntry *pPrevAET;
+    EdgeTableEntry *tmp;
+
+    pPrevAET = AET;
+    AET = AET->next;
+    while (ETEs)
+    {
+        while (AET && (AET->bres.minor_axis < ETEs->bres.minor_axis))
+        {
+            pPrevAET = AET;
+            AET = AET->next;
+        }
+        tmp = ETEs->next;
+        ETEs->next = AET;
+        if (AET)
+            AET->back = ETEs;
+        ETEs->back = pPrevAET;
+        pPrevAET->next = ETEs;
+        pPrevAET = ETEs;
+
+        ETEs = tmp;
+    }
+}
+
+/*
+ *     REGION_computeWAET
+ *
+ *     This routine links the AET by the
+ *     nextWETE (winding EdgeTableEntry) link for
+ *     use by the winding number rule.  The final
+ *     Active Edge Table (AET) might look something
+ *     like:
+ *
+ *     AET
+ *     ----------  ---------   ---------
+ *     |ymax    |  |ymax    |  |ymax    |
+ *     | ...    |  |...     |  |...     |
+ *     |next    |->|next    |->|next    |->...
+ *     |nextWETE|  |nextWETE|  |nextWETE|
+ *     ---------   ---------   ^--------
+ *         |                   |       |
+ *         V------------------->       V---> ...
+ *
+ */
+static void REGION_computeWAET(EdgeTableEntry *AET)
+{
+    EdgeTableEntry *pWETE;
+    int inside = 1;
+    int isInside = 0;
+
+    AET->nextWETE = (EdgeTableEntry *)NULL;
+    pWETE = AET;
+    AET = AET->next;
+    while (AET)
+    {
+        if (AET->ClockWise)
+            isInside++;
+        else
+            isInside--;
+
+        if ((!inside && !isInside) ||
+            ( inside &&  isInside))
+        {
+            pWETE->nextWETE = AET;
+            pWETE = AET;
+            inside = !inside;
+        }
+        AET = AET->next;
+    }
+    pWETE->nextWETE = (EdgeTableEntry *)NULL;
+}
+
+/*
+ *     REGION_InsertionSort
+ *
+ *     Just a simple insertion sort using
+ *     pointers and back pointers to sort the Active
+ *     Edge Table.
+ *
+ */
+static MWBOOL REGION_InsertionSort(EdgeTableEntry *AET)
+{
+    EdgeTableEntry *pETEchase;
+    EdgeTableEntry *pETEinsert;
+    EdgeTableEntry *pETEchaseBackTMP;
+    MWBOOL changed = FALSE;
+
+    AET = AET->next;
+    while (AET)
+    {
+        pETEinsert = AET;
+        pETEchase = AET;
+        while (pETEchase->back->bres.minor_axis > AET->bres.minor_axis)
+            pETEchase = pETEchase->back;
+
+        AET = AET->next;
+        if (pETEchase != pETEinsert)
+        {
+            pETEchaseBackTMP = pETEchase->back;
+            pETEinsert->back->next = AET;
+            if (AET)
+                AET->back = pETEinsert->back;
+            pETEinsert->next = pETEchase;
+            pETEchase->back->next = pETEinsert;
+            pETEchase->back = pETEinsert;
+            pETEinsert->back = pETEchaseBackTMP;
+            changed = TRUE;
+        }
+    }
+    return changed;
+}
+
+/*
+ *     REGION_FreeStorage
+ *
+ *     Clean up our act.
+ */
+static void REGION_FreeStorage(ScanLineListBlock *pSLLBlock)
+{
+    ScanLineListBlock   *tmpSLLBlock;
+
+    while (pSLLBlock)
+    {
+        tmpSLLBlock = pSLLBlock->next;
+        free( pSLLBlock );
+        pSLLBlock = tmpSLLBlock;
+    }
+}
+
+
+/*
+ *     REGION_PtsToRegion
+ *
+ *     Create an array of rectangles from a list of points.
+ */
+static int REGION_PtsToRegion(int numFullPtBlocks, int iCurPtBlock,
+                       POINTBLOCK *FirstPtBlock, MWCLIPREGION *reg)
+{
+    MWRECT *rects;
+    MWPOINT *pts;
+    POINTBLOCK *CurPtBlock;
+    int i;
+    MWRECT *extents;
+    int numRects;
+
+    extents = &reg->extents;
+
+    numRects = ((numFullPtBlocks * NUMPTSTOBUFFER) + iCurPtBlock) >> 1;
+
+    if (!(reg->rects = realloc( reg->rects, sizeof(MWRECT) * numRects )))
+        return(0);
+
+    reg->size = numRects;
+    CurPtBlock = FirstPtBlock;
+    rects = reg->rects - 1;
+    numRects = 0;
+    extents->left = LARGE_COORDINATE,  extents->right = SMALL_COORDINATE;
+
+    for ( ; numFullPtBlocks >= 0; numFullPtBlocks--) {
+        /* the loop uses 2 points per iteration */
+        i = NUMPTSTOBUFFER >> 1;
+        if (!numFullPtBlocks)
+            i = iCurPtBlock >> 1;
+        for (pts = CurPtBlock->pts; i--; pts += 2) {
+            if (pts->x == pts[1].x)
+                continue;
+            if (numRects && pts->x == rects->left && pts->y == rects->bottom && 
+                pts[1].x == rects->right &&
+                (numRects == 1 || rects[-1].top != rects->top) &&
+                (i && pts[2].y > pts[1].y)) {
+                rects->bottom = pts[1].y + 1;
+                continue;
+            }
+            numRects++;
+            rects++;
+            rects->left = pts->x;  rects->top = pts->y;
+            rects->right = pts[1].x;  rects->bottom = pts[1].y + 1;
+            if (rects->left < extents->left)
+                extents->left = rects->left;
+            if (rects->right > extents->right)
+                extents->right = rects->right;
+        }
+        CurPtBlock = CurPtBlock->next;
+    }
+
+    if (numRects) {
+        extents->top = reg->rects->top;
+        extents->bottom = rects->bottom;
+    } else {
+        extents->left = 0;
+        extents->top = 0;
+        extents->right = 0;
+        extents->bottom = 0;
+    }
+    reg->numRects = numRects;
+
+    return(TRUE);
+}
+
+/*
+ *           GdAllocPolygonRegion
+ */
+MWCLIPREGION *
+GdAllocPolygonRegion(MWPOINT *points, int count, int mode)
+{
+    return GdAllocPolyPolygonRegion(points, &count, 1, mode );
+}
+
+/*
+ *           GdAllocPolyPolygonRegion
+ */
+MWCLIPREGION *
+GdAllocPolyPolygonRegion(MWPOINT *points, int *count, int nbpolygons, int mode)
+{
+    MWCLIPREGION *rgn;
+    EdgeTableEntry *pAET;   /* Active Edge Table       */
+    int y;                  /* current scanline        */
+    int iPts = 0;           /* number of pts in buffer */
+    EdgeTableEntry *pWETE;  /* Winding Edge Table Entry*/
+    ScanLineList *pSLL;     /* current scanLineList    */
+    MWPOINT *pts;           /* output buffer           */
+    EdgeTableEntry *pPrevAET;        /* ptr to previous AET     */
+    EdgeTable ET;                    /* header node for ET      */
+    EdgeTableEntry AET;              /* header node for AET     */
+    EdgeTableEntry *pETEs;           /* EdgeTableEntries pool   */
+    ScanLineListBlock SLLBlock;      /* header for scanlinelist */
+    int fixWAET = FALSE;
+    POINTBLOCK FirstPtBlock, *curPtBlock; /* PtBlock buffers    */
+    POINTBLOCK *tmpPtBlock;                              
+    int numFullPtBlocks = 0;
+    int poly, total;
+
+    if(!(rgn = GdAllocRegion()))
+        return NULL;
+    
+    /* special case a rectangle */
+
+    if (((nbpolygons == 1) && ((*count == 4) ||
+       ((*count == 5) && (points[4].x == points[0].x)
+        && (points[4].y == points[0].y)))) && 
+        (((points[0].y == points[1].y) &&
+          (points[1].x == points[2].x) &&
+          (points[2].y == points[3].y) &&
+          (points[3].x == points[0].x)) ||
+         ((points[0].x == points[1].x) &&
+          (points[1].y == points[2].y) &&
+          (points[2].x == points[3].x) &&
+          (points[3].y == points[0].y))))
+    {
+        GdSetRectRegion( rgn, 
+	    MWMIN(points[0].x, points[2].x), MWMIN(points[0].y, points[2].y),
+	    MWMAX(points[0].x, points[2].x), MWMAX(points[0].y, points[2].y) );
+        return rgn;
+    }
+
+    for(poly = total = 0; poly < nbpolygons; poly++)
+        total += count[poly];
+    if (! (pETEs = malloc( sizeof(EdgeTableEntry) * total ))) 
+    {
+        GdDestroyRegion( rgn );
+        return 0;
+    }
+    pts = FirstPtBlock.pts;
+    REGION_CreateETandAET(count, nbpolygons, points, &ET, &AET,
+        pETEs, &SLLBlock); 
+    pSLL = ET.scanlines.next;
+    curPtBlock = &FirstPtBlock;
+
+    if (mode != MWPOLY_WINDING) {
+        /*
+         *  for each scanline
+         */
+        for (y = ET.ymin; y < ET.ymax; y++) {
+            /*
+             *  Add a new edge to the active edge table when we
+             *  get to the next edge.
+             */
+            if (pSLL != NULL && y == pSLL->scanline) {
+                REGION_loadAET(&AET, pSLL->edgelist);
+                pSLL = pSLL->next;
+            }
+            pPrevAET = &AET;
+            pAET = AET.next;
+
+            /*
+             *  for each active edge
+             */
+            while (pAET) {
+                pts->x = pAET->bres.minor_axis,  pts->y = y;
+                pts++, iPts++;
+
+                /*
+                 *  send out the buffer
+                 */
+                if (iPts == NUMPTSTOBUFFER) {
+                    tmpPtBlock = malloc( sizeof(POINTBLOCK)); 
+                    if(!tmpPtBlock) {
+                        return 0;
+                    }
+                    curPtBlock->next = tmpPtBlock;
+                    curPtBlock = tmpPtBlock;
+                    pts = curPtBlock->pts;
+                    numFullPtBlocks++;
+                    iPts = 0;
+                }
+                EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
+
+            }
+            REGION_InsertionSort(&AET);
+        }
+    }
+    else {
+        /*
+         *  for each scanline
+         */
+        for (y = ET.ymin; y < ET.ymax; y++) {
+            /*
+             *  Add a new edge to the active edge table when we
+             *  get to the next edge.
+             */
+            if (pSLL != NULL && y == pSLL->scanline) { 
+                REGION_loadAET(&AET, pSLL->edgelist);
+                REGION_computeWAET(&AET);
+                pSLL = pSLL->next;
+            }
+            pPrevAET = &AET;
+            pAET = AET.next;
+            pWETE = pAET;
+
+            /*
+             *  for each active edge
+             */
+            while (pAET) {
+                /*
+                 *  add to the buffer only those edges that
+                 *  are in the Winding active edge table.
+                 */
+                if (pWETE == pAET) {
+                    pts->x = pAET->bres.minor_axis,  pts->y = y;
+                    pts++, iPts++;
+
+                    /*
+                     *  send out the buffer
+                     */                        
+                    if (iPts == NUMPTSTOBUFFER) {
+                        tmpPtBlock = malloc( sizeof(POINTBLOCK) );
+                        if(!tmpPtBlock) {
+                            return 0;
+                        }
+                        curPtBlock->next = tmpPtBlock;
+                        curPtBlock = tmpPtBlock;
+                        pts = curPtBlock->pts;
+                        numFullPtBlocks++;    iPts = 0;
+                    }
+                    pWETE = pWETE->nextWETE;
+                }
+                EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET);
+            }
+
+            /*
+             *  recompute the winding active edge table if
+             *  we just resorted or have exited an edge.
+             */
+            if (REGION_InsertionSort(&AET) || fixWAET) {
+                REGION_computeWAET(&AET); 
+                fixWAET = FALSE;
+            }
+        }
+    }
+    REGION_FreeStorage(SLLBlock.next);
+    REGION_PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, rgn);
+    for (curPtBlock = FirstPtBlock.next; --numFullPtBlocks >= 0;) {
+        tmpPtBlock = curPtBlock->next;
+        free( curPtBlock );
+        curPtBlock = tmpPtBlock;
+    }
+    free( pETEs );
+    return rgn;
+}
+
+#endif /* POLYREGIONS*/
diff -urN lib/microwindows/src/engine/devtimer.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devtimer.c
--- lib/microwindows/src/engine/devtimer.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/devtimer.c	2005-02-21 16:13:15.000000000 +0100
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2000 Alex Holden <alex@linuxhacker.org>
+ *
+ * This file implements the device independant timer functions.
+ *
+ * When a part of the server wishes to set a timer, it should call the
+ * GdAddTimer() function with the timeout parameter set to the number of
+ * milliseconds before the timer should activate, the callback argument
+ * set to the function which should be called when the timer expires, and
+ * the arg argument set to the (void * type) argument which should be supplied
+ * to the timer handler function. The GdAddTimer() returns a pointer to the
+ * timer structure * which was created (or NULL if the creation failed for
+ * some reason). The prototype for the callback function should look like:
+ * void callbackfn(void *arg);
+ *
+ * If a part of the server wishes to destroy a timer before it has expired
+ * (it is not necessary to do so after the timer has expired, as the timer
+ * structure is automatically destroyed after the callback function is called),
+ * it should call the GdDestroyTimer() function with the address of the timer
+ * structure (which was returned by GdAddTimer()).
+ *
+ * If a part of the server wishes to destroy a timer but does not know the
+ * address of it's timer structure, it can call GdFindTimer() with the
+ * callback argument as a parameter. The argument must be unique to that
+ * timer (the address of a structure or function is probably a good choice).
+ * This function returns the address of the first timer found with that
+ * argument, or NULL if no matching timer was found.
+ *
+ * The main select() loop needs to be called with a timeout obtained using the
+ * GdGetNextTimeout(). GdGetNextTimeout() is called with the event loop
+ * timeout in ms, and fills in the specified timeout structure, which should
+ * be used as the argument to the select() call. The timeout returned by the
+ * GdGetNextTimeout() call is decided by looking through the timer list for
+ * the timer with the shortest amount of time remaining, and also at the
+ * maximum delay parameter. If there are no timers on the timer list and the
+ * timeout argument is 0, it will return FALSE, otherwise it will return TRUE.
+ *
+ * When the main select() loop times out, the GdTimeout() function should be
+ * called. This will go through the timer list and call the callback functions
+ * of all timers which have expired, then remove them from the timer list. At
+ * the same time, you should check the value of the maximum timeout parameter
+ * to see if it has expired (in which case you can then return to the client
+ * with a timeout event). This function returns TRUE if the timeout specified in
+ * the last GdGetNextTimeout() call has expired, or FALSE otherwise.
+ *
+ * Note that no guarantees can be made as to when exactly the timer callback
+ * will be called as it depends on how often the GdTimeout() function is
+ * called and how long any other timeouts in the queue before you take to
+ * complete. Especially in the case where the client is linked into the server,
+ * the client must call into the server on a regular basis, otherwise the
+ * timers may run late.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include "device.h"
+
+static MWTIMER *timerlist = NULL;
+static struct timeval mainloop_timeout;
+static struct timeval current_time;
+
+static void calculate_timeval(struct timeval *tv, MWTIMEOUT to); 
+static signed long time_to_expiry(struct timeval *t);
+
+MWTIMER *GdAddTimer(MWTIMEOUT timeout, MWTIMERCB callback, void *arg)
+{
+	MWTIMER *newtimer;
+
+	if(!(newtimer = malloc(sizeof(MWTIMER)))) return NULL;
+
+	gettimeofday(&current_time, NULL);
+
+	if(timerlist) timerlist->prev = newtimer;
+
+	calculate_timeval(&newtimer->timeout, timeout);
+	newtimer->callback = callback;
+	newtimer->arg = arg;
+	newtimer->next = timerlist;
+	newtimer->prev = NULL;
+	timerlist = newtimer;
+
+	return newtimer;
+}
+
+void GdDestroyTimer(MWTIMER *timer)
+{
+	if(timer->next) timer->next->prev = timer->prev;
+	if(timer->prev) timer->prev->next = timer->next;
+	if(timer == timerlist) {
+		if(timer->next) timerlist = timer->next;
+		else timerlist = timer->prev;
+	}
+	free(timer);
+}
+
+MWTIMER *GdFindTimer(void *arg)
+{
+	MWTIMER *t = timerlist;
+
+	while(t) {
+		if(t->arg == arg) break;
+		t = t->next;
+	}
+
+	return t;
+}
+
+MWBOOL GdGetNextTimeout(struct timeval *tv, MWTIMEOUT timeout)
+{
+	signed long i, lowest_timeout;
+	MWTIMER *t = timerlist;
+
+	if(!timeout && !timerlist) return FALSE;
+
+	gettimeofday(&current_time, NULL);
+
+	if(timeout) {
+		calculate_timeval(&mainloop_timeout, timeout);
+		lowest_timeout = time_to_expiry(&mainloop_timeout);
+	} else {
+		lowest_timeout = time_to_expiry(&t->timeout);
+		mainloop_timeout.tv_sec = -1;
+		t = t->next;
+	}
+
+	while(t) {
+		i = time_to_expiry(&t->timeout);
+		if(i < lowest_timeout) lowest_timeout = i;
+		t = t->next;
+	}
+
+	if(lowest_timeout <= 0) {
+		tv->tv_sec = 0;
+		tv->tv_usec = 0;
+	} else {
+		tv->tv_sec = lowest_timeout / 1000;
+		tv->tv_usec = (lowest_timeout % 1000) * 1000;
+	}
+
+	return TRUE;
+}
+
+MWBOOL GdTimeout(void)
+{
+	MWTIMER *n, *t = timerlist;
+
+	gettimeofday(&current_time, NULL);
+
+	while(t) {
+		n = t->next;
+		if(time_to_expiry(&t->timeout) <= 0) {
+			t->callback(t->arg);
+			GdDestroyTimer(t);
+		}
+		t = n;
+	}
+
+	if(mainloop_timeout.tv_sec > 0)
+		if(time_to_expiry(&mainloop_timeout) <= 0)
+			return TRUE;
+
+	return FALSE;
+}
+
+static void calculate_timeval(struct timeval *tv, MWTIMEOUT to)
+{
+	tv->tv_sec = current_time.tv_sec + (to / 1000);
+	tv->tv_usec = current_time.tv_usec + ((to % 1000) * 1000);
+	if(tv->tv_usec > 1000000) {
+		tv->tv_sec++;
+		tv->tv_usec -= 1000000;
+	}
+}
+
+static signed long time_to_expiry(struct timeval *t)
+{
+	MWTIMEOUT ret = (((t->tv_sec - current_time.tv_sec) * 1000) +
+			((t->tv_usec - current_time.tv_usec) / 1000));
+
+	return ret;
+}
diff -urN lib/microwindows/src/engine/error.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/error.c
--- lib/microwindows/src/engine/error.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/error.c	2005-02-21 16:13:15.000000000 +0100
@@ -0,0 +1,25 @@
+/*
+ * Reconfigurable error handler
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#if (UNIX | DOS_DJGPP)
+#include <unistd.h>
+#endif
+#include "device.h"
+
+/* output error message and return -1*/
+int
+GdError(const char *format, ...)
+{
+	va_list args;
+	char 	buf[512];
+
+	va_start(args, format);
+	vsprintf(buf, format, args);
+	va_end(args);
+	write(2, buf, strlen(buf));
+	return -1;
+}
diff -urN lib/microwindows/src/engine/file /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/file
--- lib/microwindows/src/engine/file	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/file	2005-02-21 16:13:16.000000000 +0100
@@ -0,0 +1,811 @@
+76a77,414
+> /************/
+> 
+> typedef struct xTT_Glyph_Cache_ {
+> 
+>   TT_Error  error;
+>   TT_Glyph  glyph;
+>   TT_UShort index;
+>   TT_UShort flags;
+> 
+>   struct xTT_Glyph_Cache_ * l;
+>   struct xTT_Glyph_Cache_ * r;
+> 
+> } xTT_Glyph_Cache;
+> 
+> typedef struct xTT_Instance_Object_ {
+> 
+>   TT_Face     face;
+>   TT_Instance instance;
+> 
+>   xTT_Glyph_Cache * head;
+> 
+> } xTT_Instance_Object;
+> 
+> typedef struct xTT_Instance_ {
+> 
+>   xTT_Instance_Object * instance;
+> 
+> } xTT_Instance;
+> 
+> typedef struct xTT_Outline_Object_ {
+> 
+>   TT_Outline outline;
+>   TT_BBox    bbox;
+> 
+> } xTT_Outline_Object;
+> 
+> typedef struct xTT_Outline_ {
+> 
+>   xTT_Outline_Object * outline;
+> 
+> } xTT_Outline;
+> 
+> typedef struct xTT_Glyph_Object_ {
+> 
+>   TT_Glyph * glyph;
+> 
+>   xTT_Outline_Object outline;
+> 
+> } xTT_Glyph_Object;
+> 
+> typedef struct xTT_Glyph_ {
+> 
+>   xTT_Glyph_Object * glyph;
+> 
+> } xTT_Glyph;
+> 
+> TT_Error
+> xTT_Glyph_Cache_Find ( xTT_Instance instance,
+> 		       xTT_Glyph glyph,
+> 		       TT_UShort glyphIndex,
+> 		       TT_UShort loadFlags )
+> {
+>   xTT_Glyph_Cache  * node;
+>   xTT_Glyph_Cache ** inode = &instance.instance->head;
+> 
+>   int miss = 0;
+> 
+>   while ( 1 )
+>   {
+>     if (*inode == 0) 
+>     {
+>       miss = 1;
+> 
+>       node = *inode = calloc(1,sizeof(**inode));
+> 
+>       if (node == 0)
+> 	return TT_Err_Out_Of_Memory;
+> 
+>       node->error = TT_New_Glyph(instance.instance->face,&(node->glyph));
+> 
+>       if (node->error == 0)
+> 	node->error = TT_Load_Glyph(instance.instance->instance,
+> 				    node->glyph,
+> 				    (node->index = glyphIndex),
+> 				    (node->flags = loadFlags));
+> 
+>       if (node->error != 0)
+> 	TT_Done_Glyph(node->glyph);
+>     } 
+>     else 
+>     {
+>       node = *inode;
+>     }
+> 
+>     if (glyphIndex < node->index)
+>       inode = &node->l;
+>     else if (glyphIndex > node->index)
+>       inode = &node->r;
+>     else if (loadFlags < node->flags)
+>       inode = &node->l;
+>     else if (loadFlags > node->flags)
+>       inode = &node->r;
+>     else
+>     {
+>       static int count [] = { 0, 0 };
+>       ++count[miss];
+>       printf("\r(%s | hit %d | miss %d)",__TIME__,count[0],count[1]);
+>       glyph.glyph->glyph = &node->glyph;
+>       return node->error;
+>     }
+>   }
+> }
+> 
+> void
+> xTT_Glyph_Cache_Free ( xTT_Glyph_Cache ** pnode )
+> {
+>   xTT_Glyph_Cache * node;
+> 
+>   if (pnode == 0)
+>     return;
+> 
+>   node = *pnode;
+> 
+>   if (node == 0)
+>     return;
+> 
+>   if (node->l)
+>     xTT_Glyph_Cache_Free(&node->l);
+> 
+>   if (node->r)
+>     xTT_Glyph_Cache_Free(&node->r);
+> 
+>   TT_Done_Glyph(node->glyph);
+>   free(node);
+> 
+>   *pnode = 0;
+> }
+> 
+> TT_Error
+> xTT_New_Instance ( TT_Face face,
+> 		   xTT_Instance * instance )
+> {
+>   instance->instance = calloc(1,sizeof(*instance->instance));
+>   if (instance->instance == 0)
+>     return TT_Err_Out_Of_Memory;
+> 
+>   instance->instance->face = face;
+>   instance->instance->head = 0;
+> 
+>   return TT_New_Instance(face,&instance->instance->instance);
+> }
+> 
+> TT_Error
+> xTT_Done_Instance ( xTT_Instance instance )
+> {
+>   TT_Error error;
+> 
+>   xTT_Glyph_Cache_Free(&instance.instance->head);
+>   error = TT_Done_Instance(instance.instance->instance);
+> 
+>   free(instance.instance);
+> 
+>   return error;
+> }
+> 
+> TT_Error
+> xTT_Get_Instance_Metrics ( xTT_Instance instance,
+> 			   TT_Instance_Metrics * imetrics )
+> {
+>   return TT_Get_Instance_Metrics(instance.instance->instance,imetrics);
+> }
+> 
+> TT_Error
+> xTT_Set_Instance_CharSize ( xTT_Instance instance,
+> 			    TT_F26Dot6 charsize )
+> {
+>   xTT_Glyph_Cache_Free(&instance.instance->head);
+>   return TT_Set_Instance_CharSize(instance.instance->instance,charsize);
+> }
+> 
+> TT_Error
+> xTT_Set_Instance_PixelSizes ( xTT_Instance instance,
+> 			      TT_UShort pixelWidth,
+> 			      TT_UShort pixelHeight,
+> 			      TT_F26Dot6 pointSize )
+> {
+>   xTT_Glyph_Cache_Free(&instance.instance->head);
+>   return TT_Set_Instance_PixelSizes(instance.instance->instance,
+> 				    pixelWidth,
+> 				    pixelHeight,
+> 				    pointSize);
+> }
+> 
+> TT_Error
+> xTT_Set_Instance_Transform_Flags ( xTT_Instance instance, 
+> 				   TT_Bool rotated,
+> 				   TT_Bool stretched )
+> {
+>   xTT_Glyph_Cache_Free(&instance.instance->head);
+>   return TT_Set_Instance_Resolutions(instance.instance->instance,
+> 				     rotated,
+> 				     stretched);
+> }
+> 
+> TT_Error
+> xTT_Set_Instance_Resolutions ( xTT_Instance instance,
+> 			       TT_UShort xResolution,
+> 			       TT_UShort yResolution )
+> {
+>   xTT_Glyph_Cache_Free(&instance.instance->head);
+>   return TT_Set_Instance_Resolutions(instance.instance->instance,
+> 				     xResolution,
+> 				     yResolution);
+> }
+> 
+> TT_Error
+> xTT_New_Glyph ( TT_Face face,
+> 		xTT_Glyph * glyph )
+> {
+>   glyph->glyph = calloc(1,sizeof(*glyph->glyph));
+>   if (glyph->glyph == 0)
+>     return TT_Err_Out_Of_Memory;
+>   return 0;
+> }
+> 
+> TT_Error
+> xTT_Done_Glyph ( xTT_Glyph glyph )
+> {
+>   free(glyph.glyph);
+>   return 0;
+> }
+> 
+> TT_Error
+> xTT_Load_Glyph ( xTT_Instance instance,
+> 		 xTT_Glyph glyph,
+> 		 TT_UShort glyphIndex,
+> 		 TT_UShort loadFlags )
+> {
+>   TT_Error error;
+>   error = xTT_Glyph_Cache_Find(instance,glyph,glyphIndex,loadFlags);
+>   TT_Get_Glyph_Outline(*glyph.glyph->glyph,
+> 		       &glyph.glyph->outline.outline);
+>   TT_Get_Outline_BBox(&glyph.glyph->outline.outline,
+> 		      &glyph.glyph->outline.bbox);
+>   return error;
+> }
+> 
+> TT_Error
+> xTT_Get_Glyph_Metrics ( xTT_Glyph glyph,
+> 			TT_Glyph_Metrics * metrics )
+> {
+>   return TT_Get_Glyph_Metrics(*glyph.glyph->glyph,metrics);
+> }
+> 
+> TT_Error
+> xTT_Get_Glyph_Outline ( xTT_Glyph glyph,
+> 			xTT_Outline * outline )
+> {
+>   outline->outline = &glyph.glyph->outline;
+>   return 0;
+> }
+> 
+> TT_Error
+> xTT_Get_Outline_BBox ( xTT_Outline * outline,
+> 		       TT_BBox * bbox )
+> {
+>   *bbox = outline->outline->bbox;
+>   return 0;
+> }
+> 
+> void
+> xTT_Transform_Outline ( xTT_Outline * outline,
+> 			TT_Matrix * matrix )
+> {
+>   TT_Transform_Outline(&outline->outline->outline,matrix);
+>   TT_Get_Outline_BBox(&outline->outline->outline,
+> 		      &outline->outline->bbox);
+> }
+> 
+> TT_Error
+> xTT_Get_Glyph_Bitmap ( xTT_Glyph glyph,
+> 		       TT_Raster_Map * bitmap,
+> 		       TT_F26Dot6 xOffset,
+> 		       TT_F26Dot6 yOffset )
+> {
+>   return TT_Get_Glyph_Bitmap(*glyph.glyph->glyph,
+> 			     bitmap,
+> 			     xOffset,
+> 			     yOffset);
+> }
+> 
+> TT_Error
+> xTT_Get_Glyph_Pixmap ( xTT_Glyph glyph,
+> 		       TT_Raster_Map * pixmap,
+> 		       TT_F26Dot6 xOffset,
+> 		       TT_F26Dot6 yOffset )
+> {
+>   return TT_Get_Glyph_Pixmap(*glyph.glyph->glyph,
+> 			     pixmap,
+> 			     xOffset,
+> 			     yOffset);
+> }
+> 
+> #ifndef xTT_ALIAS
+> #define xTT_ALIAS 1
+> #endif
+> 
+> #if xTT_ALIAS
+> 
+> #define TT_Instance                     xTT_Instance
+> #define TT_Outline                      xTT_Outline
+> #define TT_Glyph                        xTT_Glyph
+> 
+> #define TT_New_Instance                 xTT_New_Instance
+> #define TT_Done_Instance                xTT_Done_Instance
+> 
+> #define TT_Get_Instance_Metrics         xTT_Get_Instance_Metrics
+> #define TT_Set_Instance_CharSize        xTT_Set_Instance_CharSize
+> #define TT_Set_Instance_PixelSizes      xTT_Set_Instance_PixelSizes
+> #define TT_Set_Instance_Transform_Flags xTT_Set_Instance_Transform_Flags
+> #define TT_Set_Instance_Resolutions     xTT_Set_Instance_Resolutions
+> 
+> #define TT_New_Glyph                    xTT_New_Glyph
+> #define TT_Done_Glyph                   xTT_Done_Glyph
+> 
+> #define TT_Load_Glyph                   xTT_Load_Glyph
+> #define TT_Get_Glyph_Metrics            xTT_Get_Glyph_Metrics
+> #define TT_Get_Glyph_Outline            xTT_Get_Glyph_Outline
+> #define TT_Get_Glyph_Bitmap             xTT_Get_Glyph_Bitmap
+> #define TT_Get_Glyph_Pixmap             xTT_Get_Glyph_Pixmap
+> 
+> #define TT_Get_Outline_BBox             xTT_Get_Outline_BBox
+> #define TT_Transform_Outline            xTT_Transform_Outline
+> 
+> #endif
+> 
+> /************/
+> 
+85a424,448
+> #ifndef MWFREETYPEFONT_CACHE
+> #define MWFREETYPEFONT_CACHE 1
+> #endif
+> 
+> #if MWFREETYPEFONT_CACHE
+> 
+> #ifndef MWFREETYPEFONT_CACHEBITMAP
+> #define MWFREETYPEFONT_CACHEBITMAP 1
+> #endif
+> 
+> typedef struct mwfreetypefontcache {
+>   unsigned curchar;
+>   void * buffer;
+> #if MWFREETYPEFONT_CACHEBITMAP
+>   MWPIXELVAL fg;
+>   MWPIXELVAL bg;
+>   MWBOOL usebg;
+>   void * bitmap;
+> #endif
+>   struct mwfreetypefontcache * l;
+>   struct mwfreetypefontcache * r;
+> } MWFREETYPEFONTCACHE;
+> 
+> #endif
+> 
+86a450
+> 
+100a465,469
+> 
+> #if MWFREETYPEFONT_CACHE
+>         MWFREETYPEFONTCACHE * glyph_cache;
+> #endif
+> 
+147,148c516,517
+< static HZKFONT CFont[2];//font cache
+< static HZKFONT AFont[2];//font cache
+---
+> static HZKFONT CFont[2];	/* font cache*/
+> static HZKFONT AFont[2];	/* font cache*/
+150c519
+< //jmt: moved inside MWHZKFONT
+---
+> /*jmt: moved inside MWHZKFONT*/
+177,178c546,547
+< //static void hzk_gettextbits(PMWFONT pfont, int ch, IMAGEBITS *retmap,
+< //		MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+---
+> /*static void hzk_gettextbits(PMWFONT pfont, int ch, IMAGEBITS *retmap,
+> 		MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);*/
+183c552
+< //static void hzk_setfontrotation(PMWFONT pfont, int tenthdegrees);
+---
+> /*static void hzk_setfontrotation(PMWFONT pfont, int tenthdegrees);*/
+224d592
+< 
+694a1063,1072
+> 	        case MWPF_TRUECOLOR555:
+> 		    d = BITS(dst, 10, 0x1f);
+> 		    r = (unsigned char)(((BITS(src, 10, 0x1f) - d)*a)>>8) + d;
+> 		    d = BITS(dst, 5, 0x1f);
+> 		    g = (unsigned char)(((BITS(src, 5, 0x1f) - d)*a)>>8) + d;
+> 		    d = BITS(dst, 0, 0x1f);
+> 		    b = (unsigned char)(((BITS(src, 0, 0x1f) - d)*a)>>8) + d;
+> 		    *out++ = (r << 10) | (g << 5) | b;
+> 		    break;
+> 
+988c1366
+< static MWPIXELVAL gray_palette[5];
+---
+> static OUTPIXELVAL gray_palette[5];
+1155c1533
+< 	
+---
+> 
+1169a1548,1581
+> static MWFREETYPEFONTCACHE *
+> find_cache_glyph ( PMWFREETYPEFONT pf, unsigned curchar )
+> {
+>   MWFREETYPEFONTCACHE ** inode = &pf->glyph_cache;
+> 
+>   while (1)
+>     {
+>       if (*inode == 0)
+> 	{
+> 	  *inode = calloc(sizeof(MWFREETYPEFONTCACHE),1);
+> 	  (*inode)->curchar = curchar;
+> 	}
+> 
+>       if (curchar < (*inode)->curchar)
+> 	inode = &(*inode)->l;
+>       else if (curchar > (*inode)->curchar)
+> 	inode = &(*inode)->r;
+>       else
+> 	return *inode;
+>     }
+> }
+> 
+> static void
+> free_cache_glyph ( MWFREETYPEFONTCACHE * node )
+> {
+>   if (node->l != 0)
+>     free_cache_glyph(node->l);
+> 
+>   if (node->r != 0)
+>     free_cache_glyph(node->r);
+> 
+>   free(node);
+> }
+> 
+1172c1584
+< drawchar(PMWFREETYPEFONT pf, PSD psd, TT_Glyph glyph, int x_offset,
+---
+> drawchar(PMWFREETYPEFONT pf, PSD psd, unsigned curchar, int x_offset,
+1184a1597
+>         MWFREETYPEFONTCACHE * cache;
+1206a1620,1622
+>         cache = find_cache_glyph(pf,curchar);
+>         /* SDR: if cache is 0 here, something really really bad happened */
+> 
+1209,1213c1625
+< 	Raster.bitmap = malloc (Raster.size);
+< 
+< 	memset (Raster.bitmap, 0, Raster.size);
+< 
+< 	/* now render the glyph in the small pixmap */
+---
+> 	Raster.bitmap = cache->buffer;
+1215,1226c1627,1666
+< 	/* IMPORTANT NOTE: the offset parameters passed to the function     */
+< 	/* TT_Get_Glyph_Bitmap() must be integer pixel values, i.e.,        */
+< 	/* multiples of 64.  HINTING WILL BE RUINED IF THIS ISN'T THE CASE! */
+< 	/* This is why we _did_ grid-fit the bounding box, especially xmin  */
+< 	/* and ymin.                                                        */
+< 
+< 	if (!(pf->fontattr&MWTF_ANTIALIAS))
+< 		error = TT_Get_Glyph_Bitmap (pf->glyph, &Raster,
+< 				-xmin * 64, -ymin * 64);
+< 	else
+< 		error = TT_Get_Glyph_Pixmap (pf->glyph, &Raster,
+< 				-xmin * 64, -ymin * 64);
+---
+> 	if (Raster.bitmap == 0)
+> 	  {
+> 	    Raster.bitmap = malloc (Raster.size);
+> 
+> 	    memset (Raster.bitmap, 0, Raster.size);
+> 
+> 	    /* now render the glyph in the small pixmap */
+> 
+> 	    /* IMPORTANT NOTE: the offset parameters passed to the function     */
+> 	    /* TT_Get_Glyph_Bitmap() must be integer pixel values, i.e.,        */
+> 	    /* multiples of 64.  HINTING WILL BE RUINED IF THIS ISN'T THE CASE! */
+> 	    /* This is why we _did_ grid-fit the bounding box, especially xmin  */
+> 	    /* and ymin.                                                        */
+> 
+> 	    if (!(pf->fontattr&MWTF_ANTIALIAS))
+> 	      error = TT_Get_Glyph_Bitmap (pf->glyph, &Raster,
+> 					   -xmin * 64, -ymin * 64);
+> 	    else
+> 	      error = TT_Get_Glyph_Pixmap (pf->glyph, &Raster,
+> 					   -xmin * 64, -ymin * 64);
+> 
+> 	    if (error) {
+> 	      free (Raster.bitmap);
+> 	      return;
+> 	    }
+> 
+>             cache->buffer = Raster.bitmap;
+> 	  }
+> 
+> #if MWFREETYPEFONT_CACHEBITMAP
+> 	if ((memcmp(&gr_foreground,&cache->fg,sizeof(gr_foreground)) != 0) || 
+> 	    (memcmp(&gr_background,&cache->bg,sizeof(gr_background)) != 0) || 
+> 	    (gr_usebg != cache->usebg))
+> 	  {
+> 	    if (cache->bitmap)
+> 	      {
+> 		free(cache->bitmap);
+> 		cache->bitmap = 0;
+> 	      }
+> 	  }
+1228,1231c1668,1671
+< 	if (error) {
+< 		free (Raster.bitmap);
+< 		return;
+< 	}
+---
+> 	bitmap = cache->bitmap;
+> #else
+> 	bitmap = 0;
+> #endif
+1233,1234c1673,1676
+< 	bitmap = malloc (size * sizeof (MWPIXELVAL));
+< 	memset (bitmap, 0, size * sizeof (MWPIXELVAL));
+---
+> 	if (bitmap == 0)
+> 	  {
+> 	    bitmap = malloc (size * sizeof (MWPIXELVAL));
+> 	    memset (bitmap, 0, size * sizeof (MWPIXELVAL));
+1236,1237c1678,1679
+< 	src = (char *) Raster.bitmap;
+< 	dst = bitmap + (size - width);
+---
+> 	    src = (char *) Raster.bitmap;
+> 	    dst = bitmap + (size - width);
+1239c1681,1682
+< 	for (y = ymin; y < ymax; y++) {
+---
+> 	    for (y = ymin; y < ymax; y++) 
+> 	      {
+1243,1254c1686,1697
+< 		for (x = xmin; x < xmax; x++) {
+< 			if (pf->fontattr&MWTF_ANTIALIAS)
+< 				*dstptr++ = gray_palette[(int) *srcptr];
+< 			else {
+< 				for(z=0;
+< 				    z <= ((xmax-x-1) < 7 ? (xmax-x-1) : 7);
+< 				    z++) {
+< 					*dstptr++ = ((*srcptr << z) & 0x80)?
+< 						gr_foreground: gr_background;
+< 				}
+< 				x += 7;
+< 			}
+---
+> 		for (x = xmin; x < xmax; x++) 
+> 		  {
+> 		    if (pf->fontattr&MWTF_ANTIALIAS)
+> 		      *dstptr++ = gray_palette[(int) *srcptr];
+> 		    else
+> 		      {
+> 		        for ( z=0;
+> 			      z <= ((xmax-x-1) < 7 ? (xmax-x-1) : 7);
+> 			      z++ )
+> 			    *dstptr++ = ((*srcptr << z) & 0x80) ? gr_foreground : gr_background;
+> 			x += 7;
+> 		      }
+1256,1257c1699,1700
+< 			srcptr++;
+< 		}
+---
+> 		    srcptr++;
+> 		  }
+1261,1266c1704,1711
+< 	}
+< 
+< 	/* FIXME - must clear background upstairs if not gr_usebg*/
+< 	/* FIXME: GdArea problem if fg == bg*/
+< 	/*save = gr_background;*/
+< 	/*gr_background = gr_foreground + 1;*/
+---
+> 	      }
+> #if MWFREETYPEFONT_CACHEBITMAP
+> 	    cache->fg = gr_foreground;
+> 	    cache->bg = gr_background;
+> 	    cache->usebg = gr_usebg;
+> 	    cache->bitmap = bitmap;
+> #endif
+> 	  }
+1272,1275c1717,1719
+< 	/*gr_background = save;*/
+< 
+< 	free (bitmap);
+< 	free (Raster.bitmap);
+---
+> #if !MWFREETYPEFONT_CACHEBITMAP
+> 	free(bitmap);
+> #endif
+1367c1811
+< 		drawchar(pf, psd, pf->glyph, x, y);
+---
+> 		drawchar(pf, psd, curchar, x, y);
+1401,1402c1845,1846
+<     TT_Instance_Metrics imetrics;
+<     TT_UShort last_glyph_index;
+---
+> 	TT_Instance_Metrics imetrics;
+> 	TT_UShort last_glyph_index;
+1405c1849
+<     TT_Get_Instance_Metrics(pf->instance, &imetrics);
+---
+> 	TT_Get_Instance_Metrics(pf->instance, &imetrics);
+1407c1851
+<     /* Fill up the fields */
+---
+> 	/* Fill up the fields */
+1420c1864
+<     last_glyph_index = properties.num_Glyphs > 255 ? 255: properties.num_Glyphs-1;
+---
+> 	last_glyph_index = properties.num_Glyphs > 255 ? 255: properties.num_Glyphs-1;
+1422c1866
+<     /* Doesn't work ... don't know why ....*/
+---
+> 	/* Doesn't work ... don't know why ....*/
+1424,1427c1868,1871
+<     if (TT_Get_Face_Widths( pf->face, 0,
+<                             last_glyph_index, widths, NULL ) != TT_Err_Ok) {
+<         return TRUE;
+<     }
+---
+> 	if (TT_Get_Face_Widths( pf->face, 0,
+> 				last_glyph_index, widths, NULL ) != TT_Err_Ok) {
+> 	  return TRUE;
+> 	}
+1429,1430c1873,1874
+<     for(i=0; i<=last_glyph_index; i++)
+< 		DPRINTF("widths[%d]: %d\n", i, widths[i]);
+---
+> 	for(i=0; i<=last_glyph_index; i++)
+> 	  DPRINTF("widths[%d]: %d\n", i, widths[i]);
+1433c1877
+<     /* Get glyphs widths */
+---
+> 	/* Get glyphs widths */
+1435c1879
+< 		pfontinfo->widths[i] = Get_Glyph_Width(pf, i);
+---
+> 	  pfontinfo->widths[i] = Get_Glyph_Width(pf, i);
+1438c1882
+<     DPRINTF("x_ppem: %d\ny_ppem: %d\nx_scale: %d\ny_scale: %d\n\
+---
+> 	DPRINTF("x_ppem: %d\ny_ppem: %d\nx_scale: %d\ny_scale: %d\n\
+1526a1971,1978
+> 
+> 	/*----------*/
+> 
+> 	if (pf->glyph_cache != 0)
+> 	  free_cache_glyph(pf->glyph_cache);
+> 
+> 	/*----------*/
+> 
+1776c2228
+< 			//*	 to find the place of unicode charater .���ַ�ƥ��
+---
+> 			/*	 to find the place of unicode charater .���ַ�ƥ��*/
+1799c2251
+< 					if(d==c)	//find it
+---
+> 					if(d==c)	/*find it*/
+1805c2257
+< 					else if(p2<=p1+4) //can't find.
+---
+> 					else if(p2<=p1+4) /*can't find.*/
+1807,1808c2259,2260
+< 						ascii[i]='.';//*((uc16p)+j);
+< 						ascii[i+1]='.';//*((uc16p)+j+1);
+---
+> 						ascii[i]='.';/*((uc16p)+j);*/
+> 						ascii[i+1]='.';/*((uc16p)+j+1);*/
+1829c2281
+< 	}//jmt+
+---
+> 	}
+1885c2337
+<     	if (use_big5)//jmt+
+---
+>     	if (use_big5)
+1894c2346
+< // This function get ASCII font info from etc file.
+---
+> /* This function get ASCII font info from etc file.*/
+1926c2378
+< // This function load system font into memory.
+---
+> /* This function load system font into memory.*/
+1936c2388
+<     	if(CFont[hzk_id(pf)].pFont == NULL)//check font cache
+---
+>     	if(CFont[hzk_id(pf)].pFont == NULL)/*check font cache*/
+1940c2392
+<  	   	// Allocate system memory for Chinese font.
+---
+>  	   	/* Allocate system memory for Chinese font.*/
+1947c2399
+< 		// Open font file and read information to the system memory.
+---
+> 		/* Open font file and read information to the system memory.*/
+1963c2415
+< 		CFont[hzk_id(pf)].use_count=0;//
+---
+> 		CFont[hzk_id(pf)].use_count=0;
+1972c2424
+< 	CFont[hzk_id(pf)].use_count++;//jmt+
+---
+> 	CFont[hzk_id(pf)].use_count++;
+1979c2431
+<     	if(AFont[hzk_id(pf)].pFont == NULL)//check font cache
+---
+>     	if(AFont[hzk_id(pf)].pFont == NULL)/*check font cache*/
+1983c2435
+<  		// Allocate system memory for ASCII font.
+---
+>  		/* Allocate system memory for ASCII font.*/
+1992c2444
+< 	 	// Load ASCII font information to the near memory.
+---
+> 	 	/* Load ASCII font information to the near memory.*/
+2008c2460
+< 		AFont[hzk_id(pf)].use_count=0;//
+---
+> 		AFont[hzk_id(pf)].use_count=0;
+2017c2469
+< 	AFont[hzk_id(pf)].use_count++;//jmt+
+---
+> 	AFont[hzk_id(pf)].use_count++;
+2022c2474
+< // This function unload system font from memory.
+---
+> /* This function unload system font from memory.*/
+2065c2517
+< 	//GdSetFontSize((PMWFONT)pf, height);
+---
+> 	/*GdSetFontSize((PMWFONT)pf, height);*/
+2090c2542
+<     	// Load the font library to the system memory.
+---
+>     	/* Load the font library to the system memory.*/
+2097c2549
+< int IsBig5(int i)//jmt+
+---
+> int IsBig5(int i)
+2150c2602
+< 	if (use_big5)//jmt+
+---
+> 	if (use_big5)
+2153c2605
+< 		//ladd=loby-(if(loby<127)?64:98)
+---
+> 		/*ladd=loby-(if(loby<127)?64:98)*/
+2156,2157c2608,2609
+< 		//hadd=(hiby-164)*157
+< 		if (c1>=0xa4)//standard font
+---
+> 		/*hadd=(hiby-164)*157*/
+> 		if (c1>=0xa4)/*standard font*/
+2163,2164c2615,2616
+< 		//hadd=(hiby-161)*157
+< 		if (c1<=0xa3)//special font
+---
+> 		/*hadd=(hiby-161)*157*/
+> 		if (c1<=0xa3)/*special font*/
+2247c2699
+< 			if (flags&MWTF_TOP)//jmt+ 
+---
+> 			if (flags&MWTF_TOP)
+2315a2768,2770
+> 
+> 
+> 
+2345c2800
+< 		//	fprintf(stderr,"s=%x,sbegin=%x,cc=%x\n",s,sbegin,cc);
+---
+> 		/*	fprintf(stderr,"s=%x,sbegin=%x,cc=%x\n",s,sbegin,cc);*/
+2348c2803
+< //	fprintf(stderr,"ax=%d,\n",ax);
+---
+> /*	fprintf(stderr,"ax=%d,\n",ax);*/
+2358a2814
+> 
+2367,2369c2823,2826
+< 	//jmt: hzk_setfontsize not supported
+< 	//jmt: & pf->fontsize can't be changed
+< 	//jmt: because of hzk_id() :p
+---
+> 
+> 	/*jmt: hzk_setfontsize not supported*/
+> 	/*jmt: & pf->fontsize can't be changed*/
+> 	/*jmt: because of hzk_id() :p*/
+2455c2912
+< 	//FIXME: is it what's required ??
+---
+> 	/*FIXME: is it what's required ??*/
diff -urN lib/microwindows/src/engine/selfont.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/selfont.c
--- lib/microwindows/src/engine/selfont.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/engine/selfont.c	2005-02-21 16:03:24.000000000 +0100
@@ -0,0 +1,813 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 2000 Morten Rolland
+ *
+ * Device-independent font selection routines
+ */
+/*#define NDEBUG*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <ctype.h>		/* toupper*/
+#include <string.h>
+
+#include "device.h"
+#if (UNIX | DOS_DJGPP)
+#define strcmpi	strcasecmp
+#endif
+
+#if FONTMAPPER
+
+/* entry points*/
+int select_font(const PMWLOGFONT plogfont, char *physname);
+
+/*
+ * The following structure, defines and variables are used to administrate
+ * a set of fonts that are scanned when a font is requested.  The set of
+ * fonts can be configured with the GdClearFontList and GdAddFont functions.
+ */
+
+struct available_font {
+	MWLOGFONT	lf;
+	char *foundry;
+	char *family;
+	char *fontname;
+	int fontclass, alias;
+	struct available_font *next;
+};
+
+static struct available_font *all_fonts = 0;
+
+/*
+ * Stupid little function to perform a comparison of two strings,
+ * returning one of STREQ_EXACT, STREQ_CASE or STREQ_NOMATCH.
+ */
+#define STREQ_EXACT	0
+#define STREQ_CASE	1
+#define STREQ_NOMATCH	2
+
+static int streq(const char *a, const char *b)
+{
+	int rc;
+
+	for ( rc = STREQ_EXACT;  *a != 0; a++, b++ ) {
+		if ( *a == *b )
+			continue;
+		if ( toupper((unsigned char)*a) != toupper((unsigned char)*b) )
+			return STREQ_NOMATCH;
+		rc = STREQ_CASE;
+	}
+	if ( *b != 0 )
+		return STREQ_NOMATCH;
+	return rc;
+}
+
+/*
+ * Decode the "foundry" information into a MWLF_CLASS_ value denoting
+ * which rendering system should be used to render the font.
+ */
+static int decode_font_class(const char *class)
+{
+	if ( class == NULL )
+		return 0;
+	if ( !strcmp("T1",class) )
+		return MWLF_CLASS_T1LIB;
+	if ( !strcmp("FT",class) )
+		return MWLF_CLASS_FREETYPE;
+	if ( !strcmp("MWF",class) )
+		return MWLF_CLASS_BUILTIN;
+	return 0;
+}
+
+/*
+ * Try to find a font that matches the foundry and font name
+ * requested.
+ */
+void test_font_naming(const char *foundry, const char *fontname,
+		      struct available_font *af,
+		      struct available_font **best, int *goodness)
+{
+	int penalty = 0;
+
+	if ( foundry != 0 ) {
+		if ( af->foundry != 0 ) {
+			switch ( streq(foundry,af->foundry) ) {
+				case STREQ_EXACT:
+					break;
+				case STREQ_CASE:
+					penalty += 2;
+					break;
+				default:
+					penalty += 8;
+					break;
+			}
+		} else {
+			penalty += 4;
+		}
+	}
+
+	switch ( streq(fontname,af->fontname) ) {
+		case STREQ_EXACT:
+			break;
+		case STREQ_CASE:
+			penalty += 1;
+			break;
+		default:
+			penalty += 16;
+			break;
+	}
+
+	if ( *goodness < 0 || penalty < *goodness ) {
+		*best = af;
+		*goodness = penalty;
+	}
+}
+
+
+/*
+ * The 'test_font_goodness' function attempts to find how suitable a font is
+ * compared to a desired one.  The desired font is specified by:
+ *
+ *   foundry (can be NULL), family and the MWLOGFONT
+ *   structure (can be NULL).
+ *
+ * If any fonts are configured, one will always be returned from here,
+ * but the goodness may be very bad.  The goodness (or similarity)
+ * factor is computed by adding up:
+ */
+
+#define GOODNESS_NO_FONTNAME		1000	/* No matching font-name found*/
+#define GOODNESS_WEIGHT_DIFF		1	/* 0-900 for weight difference*/
+
+#define GOODNESS_NO_FOUNDRY		100	/* No foundry */
+
+#define GOODNESS_FOUNDRY_UNKNOWN	16	/* Foundry unknown */
+#define GOODNESS_CASE_FAMILY		8
+#define GOODNESS_CASE_FONTNAME		4
+#define GOODNESS_CASE_FOUNDRY		2
+#define GOODNESS_EXACT_FAMILY		1	/* Matched font family */
+
+#define GOODNESS_EXACT_FOUNDRY		0	/* Clean match */
+#define GOODNESS_EXACT_FONTNAME		0	/* Clean match */
+
+#define GOODNESS_FAMILY_UNKNOWN		3000
+#define GOODNESS_NOMATCH_FAMILY		10000
+
+#define GOODNESS_EXACT_FONTFAMILY	0
+#define GOODNESS_CASE_FONTFAMILY	32
+#define GOODNESS_CLOSE_SLANT		128
+#define GOODNESS_BAD_SLANT		256
+#define GOODNESS_WRONG_SPACING		2048
+
+#define GOODNESS_WRONG_SERIFSTYLE	1024
+
+#define GOODNESS_WANTED_SMALLCAPS_NOT_AVAILABLE		4096
+#define GOODNESS_ONLY_SMALLCAPS_AVAILABLE		8192
+
+
+static int find_foundry_penalty(const struct available_font *have,
+			 const char *foundry)
+{
+	if ( foundry == 0 )
+		return 0;
+
+	if ( have->foundry == 0 )
+		return GOODNESS_FOUNDRY_UNKNOWN;
+
+	switch ( streq(foundry,have->foundry) ) {
+		case STREQ_EXACT:
+			return GOODNESS_EXACT_FOUNDRY;
+			break;
+		case STREQ_CASE:
+			return GOODNESS_CASE_FOUNDRY;
+			break;
+		default:
+			return GOODNESS_NO_FOUNDRY;
+			break;
+	}
+}
+
+static int find_family_penalty(const struct available_font *have,
+			       const char *family)
+{
+	if ( family == 0 )
+		return 0;
+
+	if ( have->family == 0 )
+		return GOODNESS_FAMILY_UNKNOWN;
+
+	switch ( streq(family,have->family) ) {
+		case STREQ_EXACT:
+			return GOODNESS_EXACT_FAMILY;
+			break;
+		case STREQ_CASE:
+			return GOODNESS_CASE_FAMILY;
+			break;
+		default:
+			return GOODNESS_NOMATCH_FAMILY;
+			break;
+	}
+}
+
+static int find_fontname_penalty(const struct available_font *have,
+				 const char *fontname)
+{
+	switch ( streq(have->fontname,fontname) ) {
+		case STREQ_EXACT:
+			return GOODNESS_EXACT_FONTNAME;
+			break;
+		case STREQ_CASE:
+			return GOODNESS_CASE_FONTNAME;
+			break;
+		default:
+			break;
+	}
+
+	/* Test Fontname against font family name */
+	if ( have->family != 0 ) {
+		switch ( streq(have->family,fontname) ) {
+			case STREQ_EXACT:
+				return GOODNESS_EXACT_FONTFAMILY;
+				break;
+			case STREQ_CASE:
+				return GOODNESS_CASE_FONTFAMILY;
+				break;
+			default:
+				/* No suitable fontname found */
+				break;
+		}
+	}
+	return GOODNESS_NO_FONTNAME;
+}
+
+static int find_weight_penalty(PMWLOGFONT want, PMWLOGFONT have)
+{
+	int weight_diff;
+
+	weight_diff = want->lfWeight - have->lfWeight;
+	if ( weight_diff < 0 )
+		weight_diff = -weight_diff;
+	return weight_diff * GOODNESS_WEIGHT_DIFF;
+}
+
+static int find_slant_penalty(PMWLOGFONT want, PMWLOGFONT have)
+{
+	/* See if slant is acceptable */
+
+	if ( !want->lfItalic && !want->lfRoman && !want->lfOblique ) {
+		/* Try to default to Romans if not specified */
+		if ( have->lfItalic || have->lfOblique )
+			return GOODNESS_CLOSE_SLANT;
+		return 0;
+	}
+
+	if ( want->lfItalic && have->lfItalic )
+		return 0;
+
+	if ( want->lfRoman && have->lfRoman )
+		return 0;
+
+	if ( want->lfOblique && have->lfOblique )
+		return 0;
+
+	/* No perfect match for the slant, try "closest" one */
+
+	if ( want->lfItalic && have->lfOblique )
+		return GOODNESS_CLOSE_SLANT;
+
+	if ( want->lfOblique && have->lfItalic )
+		return GOODNESS_CLOSE_SLANT;
+
+	return GOODNESS_BAD_SLANT;
+}
+
+static int find_spacing_penalty(PMWLOGFONT want, PMWLOGFONT have)
+{
+	if ( want->lfProportional && have->lfProportional )
+		return 0;
+	if ( want->lfMonospace && have->lfMonospace )
+		return 0;
+	if ( want->lfMonospace || want->lfProportional )
+		return GOODNESS_WRONG_SPACING;
+
+	return 0;	/* No special desires */
+}
+
+static int find_serif_penalty(PMWLOGFONT want, PMWLOGFONT have)
+{
+	if ( !want->lfSerif && !want->lfSansSerif )
+		return 0;
+	if ( want->lfSerif && have->lfSerif )
+		return 0;
+	if ( want->lfSansSerif && have->lfSansSerif )
+		return 0;
+
+	return GOODNESS_WRONG_SERIFSTYLE;
+}
+
+static int find_smallcaps_penalty(PMWLOGFONT want, PMWLOGFONT have)
+{
+	if ( !want->lfSmallCaps && !have->lfSmallCaps )
+		return 0;
+	if ( want->lfSmallCaps && have->lfSmallCaps )
+		return 0;
+	if ( want->lfSmallCaps )
+		return GOODNESS_WANTED_SMALLCAPS_NOT_AVAILABLE;
+	return GOODNESS_ONLY_SMALLCAPS_AVAILABLE;
+}
+		
+
+static void test_font_goodness(const char *foundry, const char *family,
+			       const char *fontname, const PMWLOGFONT lf,
+			       struct available_font *af,
+			       struct available_font **best, int *goodness)
+{
+	int penalty = 0;
+
+	penalty += find_foundry_penalty(af,foundry);
+	penalty += find_family_penalty(af,family);
+
+	/* Test Fontname, but only if there is no family */
+	if ( family == 0 )
+		penalty += find_fontname_penalty(af,fontname);
+
+	if ( lf != 0 ) {
+		/* Check logical font attributes */
+		penalty += find_weight_penalty(lf,&af->lf);
+		penalty += find_slant_penalty(lf,&af->lf);
+		penalty += find_spacing_penalty(lf,&af->lf);
+		penalty += find_serif_penalty(lf,&af->lf);
+		penalty += find_smallcaps_penalty(lf,&af->lf);
+	}
+
+	/* See if this font is better than the previous one */
+	if ( *goodness < 0 || penalty < *goodness ) {
+		/* Yes, this font is better; change to it */
+		*best = af;
+		*goodness = penalty;
+	}
+}
+
+static struct available_font *find_suitable_font(const char *foundry,
+					       const char *fontname,
+					       const PMWLOGFONT plogfont)
+{
+	struct available_font *af, *best;
+	char *family;
+	int goodness;
+
+	/*
+	 * Try to find a font that matches the name specified as the
+	 * desired font (and foundry if possible).  If we find a
+	 * suitable font, we will use the family name when trying to
+	 * find a font that matches the MWLOGFONT attributes.  This
+	 * makes it possible to ask for an Italic version of
+	 * "Times Roman" and the expected thing will happen (get the
+	 * font "Times Italic").
+	 */
+	goodness = -1;
+	for ( af = best = all_fonts; af != 0; af = af->next ) {
+		test_font_naming(foundry,fontname,af,&best,&goodness);
+	}
+	family = 0;
+	if ( goodness != -1 ) {
+		/* A font with a name that kind of matched was found,
+		 * make a note of its family.  If it has no family, we
+		 * can't make any use of the 
+		 */
+		family = best->family;
+	}
+
+	/*
+	 * Try to find the closest font that matches the font family
+	 * we have established.  If no family was found above, all
+	 * fonts will be considered.
+	 */
+	goodness = -1;
+	for ( af = best = all_fonts; af != 0; af = af->next ) {
+		test_font_goodness(foundry,family,fontname,plogfont,af,
+				   &best,&goodness);
+	}
+	
+	return best;
+}
+
+
+int select_font(const PMWLOGFONT plogfont, char *physname)
+{
+	struct available_font *font;
+	char fndry[128], *foundry;
+	const char *fontname;
+	char *tmp;
+	int t, comma;
+	int fontclass = 0;
+	int found_font = 0;
+
+	fontname = plogfont->lfFaceName;
+
+	for ( t=0; t < 20; t++ ) {
+		/* Only follow 20 aliases deep, assume failure if more ... */
+
+		/* Find foundry for the current font */
+		foundry = NULL;
+		if ( (tmp = index(fontname,',')) != NULL ) {
+			/*
+			 * We have a font name like T1,c0934345 or
+			 * Adobe,Times (e.g. it includes foundry or
+			 * rendering method).  Separate them here.
+			 */
+			comma = tmp - fontname;
+			tmp++;
+			strncpy(fndry,fontname,comma);
+			fndry[comma] = '\0';
+			foundry = fndry;
+			fontname = tmp;
+		}
+
+		fontclass = decode_font_class(foundry);
+
+		if ( plogfont == NULL && fontclass == 0 )
+			fontclass = MWLF_CLASS_BUILTIN;
+
+		if ( fontclass ) {
+			/* The font is a "physical" font, use it directly */
+			strcpy(physname,fontname);
+			return fontclass;
+		}
+
+		if ( found_font ) {
+			/* Oops, should not get here, unless a font definition
+			 * resulted in a non-existent font, e.g. the fontclass
+			 * is unknown.
+			 */
+			goto default_font;
+		}
+
+		font = find_suitable_font(foundry,fontname,plogfont);
+
+		if ( font == NULL ) {
+			goto default_font;
+		}
+
+		if ( !font->alias )
+			found_font = 1;
+
+		fontname = font->lf.lfFaceName;
+	}
+
+ default_font:
+
+	strcpy(physname, MWFONT_SYSTEM_VAR);
+	return MWLF_CLASS_BUILTIN;
+}
+
+/* This function can be used to clear the existing, possibly default list
+ * of fonts on the system.  This is typically done before reading a
+ * configuration file that defines the available fonts.
+ */
+void
+GdClearFontList(void)
+{
+	struct available_font *font, *next_font;
+
+	font = all_fonts;
+	while ( font != 0 ) {
+		next_font = font->next;
+		if ( font->foundry != 0 )
+			free(font->foundry);
+		if ( font->family != 0 )
+			free(font->family);
+		free(font->fontname);
+		free(font);
+		font = next_font;
+	}
+
+	all_fonts = 0;
+}
+
+/* This function will add a font to the list of available fonts.
+ * The physical name is the name as used by the underlying font
+ * rendering engine.
+ */
+int
+GdAddFont(char *fndry, char *fmly, char *fontname, PMWLOGFONT lf,
+	unsigned int flags)
+{
+	struct available_font *font, *walk;
+	int fontclass = 0;
+	char *physname = lf->lfFaceName;
+
+	if ( !strncmp(physname,"T1,",3) ) {
+#ifdef HAVE_T1LIB_SUPPORT
+		/* Can handle Type 1 fonts */
+		physname += 3;
+		fontclass = MWLF_CLASS_T1LIB;
+		goto do_font;
+#else
+		/* Can't handle Type 1 fonts */
+		return -1;
+#endif
+	}
+
+	if ( !strncmp(physname,"FT,",3) ) {
+#if HAVE_FREETYPE_SUPPORT
+		/* Can handle FreeType fonts */
+		physname += 3;
+		fontclass = MWLF_CLASS_FREETYPE;
+		goto do_font;
+#else
+		/* Can't handle Type 1 fonts */
+		return -1;
+#endif
+	}
+
+	if ( !strncmp(physname,"MWF,",4) ) {
+		/* This is a Microwindows built in font */
+		physname += 4;
+		fontclass = MWLF_CLASS_BUILTIN;
+		goto do_font;
+	}
+
+	/* Only aliases does not need to use T1, FT or MWF description */
+	if ( !(flags & MWLF_FLAGS_ALIAS) )
+		return -1;
+
+ do_font:
+
+	font = malloc(sizeof(*font));
+	if ( font == 0 )
+		return -1;
+
+	font->foundry = 0;
+	if ( strcmp("-",fndry) ) {
+		font->foundry = strdup(fndry);
+		if ( font->foundry == 0 ) {
+			free(font);
+			return -1;
+		}
+	}
+
+	font->family = 0;
+	if ( strcmp("-",fmly) ) {
+		font->family = strdup(fmly);
+		if ( font->family == 0 ) {
+			free(font->foundry);
+			free(font);
+			return -1;
+		}
+	}
+
+	font->fontname = strdup(fontname);
+	if ( font->fontname == 0 ) {
+		free(font->foundry);
+		free(font->family);
+		free(font);
+		return -1;
+	}
+
+	memcpy(&font->lf,lf,sizeof(*lf));
+
+	printf("Adding font: '%s' '%s' '%s' '%s'\n",font->foundry,
+	       font->family,font->fontname,font->lf.lfFaceName);
+
+	font->next = 0;
+	font->alias = (flags & MWLF_FLAGS_ALIAS) ? 1 : 0;
+	font->fontclass = fontclass;
+
+	/* Stupid append at end of list code */
+	if ( all_fonts == 0 ) {
+		all_fonts = font;
+	} else {
+		for ( walk = all_fonts; walk->next != 0; walk = walk->next )
+			;
+		walk->next = font;
+	}
+
+	return 0;
+}
+
+/*
+ * These functions are used to set attributes in a logical font
+ * structure, called through a table of function pointers.
+ */
+static void font_set_light(PMWLOGFONT lf)
+	{ lf->lfWeight = MWLF_WEIGHT_LIGHT; }
+static void font_set_regular(PMWLOGFONT lf)
+	{ lf->lfWeight = MWLF_WEIGHT_REGULAR; }
+static void font_set_medium(PMWLOGFONT lf)
+	{ lf->lfWeight = MWLF_WEIGHT_MEDIUM; }
+static void font_set_demibold(PMWLOGFONT lf)
+	{ lf->lfWeight = MWLF_WEIGHT_DEMIBOLD; }
+static void font_set_bold(PMWLOGFONT lf)
+	{ lf->lfWeight = MWLF_WEIGHT_BOLD; }
+static void font_set_black(PMWLOGFONT lf)
+	{ lf->lfWeight = MWLF_WEIGHT_BLACK; }
+
+static void font_set_italic(PMWLOGFONT lf) { lf->lfItalic = 1; }
+static void font_set_roman(PMWLOGFONT lf) { lf->lfRoman = 1; }
+static void font_set_oblique(PMWLOGFONT lf) { lf->lfOblique = 1; }
+
+static void font_set_normal(PMWLOGFONT lf)
+	{ lf->lfPitch = MWLF_PITCH_NORMAL; }
+static void font_set_semicondensed(PMWLOGFONT lf)
+	{ lf->lfPitch = MWLF_PITCH_SEMICONDENSED; }
+static void font_set_condensed(PMWLOGFONT lf)
+	{ lf->lfPitch = MWLF_PITCH_CONDENSED; }
+
+static void font_set_serif(PMWLOGFONT lf) { lf->lfSerif = 1; }
+static void font_set_sansserif(PMWLOGFONT lf) { lf->lfSansSerif = 1; }
+static void font_set_monospace(PMWLOGFONT lf) { lf->lfMonospace = 1; }
+static void font_set_proportional(PMWLOGFONT lf) { lf->lfProportional = 1; }
+
+int config_font(char *file, int line, int argc, char *argv[])
+{
+	unsigned int flags = 0;
+	MWLOGFONT lf;
+	char tmp[512];
+	char *p, *q, *fndry, *family, *fontname;
+	int size, t;
+
+	static struct {
+		char *name;
+		void (*function)(PMWLOGFONT lf);
+	} attrs[] = {
+		/* Weight */
+		{ "Light",		font_set_light },
+		{ "Regular",		font_set_regular },
+		{ "Medium",		font_set_medium },
+		{ "DemiBold",		font_set_demibold },
+		{ "Demibold",		font_set_demibold },
+		{ "Bold",		font_set_bold },
+		{ "Black",		font_set_black },
+
+		/* Slant */
+		{ "Italic",		font_set_italic },
+		{ "Italics",		font_set_italic },
+		{ "Roman",		font_set_roman },
+		{ "Oblique",		font_set_oblique },
+
+		/* Width */
+		{ "Normal",		font_set_normal },
+		{ "Semicondensed",	font_set_semicondensed },
+		{ "Condensed",		font_set_condensed },
+
+		/* Class */
+		{ "Serif",		font_set_serif },
+		{ "Sans-serif",		font_set_sansserif },
+		{ "Monospace",		font_set_monospace },
+		{ "Proportional",	font_set_proportional },
+
+		{ 0, 0 }
+	};
+
+	MWLF_Clear(&lf);
+
+	if ( argc != 6 ) {
+		fprintf(stderr,"Bad font description %s:%d\n",file,line);
+		return 1;
+	}
+
+	if ( !strcmp("alias",argv[1]) ) {
+		flags |= MWLF_FLAGS_ALIAS;
+		fndry = "-";
+	} else {
+		fndry = argv[1];
+	}
+
+	family = argv[2];
+	fontname = argv[3];
+	strcpy(lf.lfFaceName,argv[5]);
+	p = argv[4];
+
+	while ( *p != '\0' ) {
+		/* Parse attributes */
+		q = strchr(p,',');
+		if ( q != 0 ) {
+			size = q - p;
+			strncpy(tmp,p,size);
+			tmp[size] = '\0';
+			p = q + 1;
+		} else {
+			strcpy(tmp,p);
+			p += strlen(tmp);
+		}
+
+		for ( t = 0; attrs[t].name != 0; t++ ) {
+			if ( !strcmp(attrs[t].name,tmp) ) {
+				attrs[t].function(&lf);
+				goto next;
+			}
+		}
+
+		fprintf(stderr,"No such font attribute '%s' in %s:%d\n",
+			tmp,file,line);
+		return 1;
+
+	next: ;
+	}
+
+	GdAddFont(fndry,family,fontname,&lf,flags);
+
+	return 0;
+}
+
+/*
+ * Handle a single configuration line entery.  Arguments as for
+ * function 'main(int argc, char **argv)' -- argv[0] is name of
+ * original configuration file.  Return negative value for error,
+ * zero for OK.
+ */
+
+int config_line(char *file, int line, int argc, char *argv[])
+{
+	if ( !argc )
+		return 0;	/* Empty line */
+
+	if ( argv[0][0] == '#' )
+		return 0;	/* Comment line */
+
+	if ( !strcmp("font", argv[0]) )
+		return config_font(file,line,argc,argv);
+
+	if ( !strcmp("clear-fonts", argv[0]) ) {
+		GdClearFontList();
+		return 0;
+	}
+
+	return -1;
+}
+
+
+/*
+ * Read (one of) the configuration files.
+ */
+#define MAXCONFIGLINESIZE	1024
+#define MAXCONFIGELEMENTS	  64
+
+int read_configfile(char *file)
+{
+	FILE *cf;
+	char buffer[MAXCONFIGLINESIZE+1];
+	char *args[MAXCONFIGELEMENTS+1];
+	unsigned char *p;
+	int argc, s, rc, t, line;
+
+	if ( (cf = fopen(file,"r")) == 0 ) {
+		fprintf(stderr,"Unable to read config file '%s'\n",file);
+		return -1;
+	}
+
+	line = 0;
+	while ( !feof(cf) ) {
+		if ( fgets(buffer,1000,cf) == 0 )
+			break;
+		line++;
+		s = strlen(buffer) - 1;
+		while ( s >= 0 && buffer[s] == '\n' )
+			buffer[s--] = '\0';
+		p = (unsigned char *)buffer;
+		argc = 0;
+		for ( t=0; t < MAXCONFIGELEMENTS; t++ ) {
+			while ( *p != '\0' && isspace(*p) )
+				p++;
+			if ( *p == '\"' ) {
+				/* Quoted string */
+				p++;
+				args[t] = p;
+				argc++;
+				while ( *p != '\0' && *p != '\"' )
+					p++;
+				if ( *p == '\0' ) {
+					fprintf(stderr,"Unbalanced quotes in %s:%d\n",
+						file,line);
+					break;
+				}
+				*p++ = '\0';
+			} else {
+				if ( *p == '\0' )
+					break;
+				args[t] = p;
+				argc++;
+				while ( *p != '\0' && !isspace(*p) )
+					p++;
+				*p++ = '\0';
+			}
+		}
+#if 0
+		{
+			int t;
+			for ( t=0; t < argc; t++ )
+				printf("#%d: '%s'\n",t,args[t]);
+		}
+#endif
+		rc = config_line(file, line, argc, args);
+		if ( rc < 0 )
+			return rc;
+	}
+
+	fclose(cf);
+
+	return 0;
+}
+#endif /* FONTMAPPER*/
diff -urN lib/microwindows/src/fonts/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/Makefile
--- lib/microwindows/src/fonts/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/Makefile	2005-02-21 16:13:18.000000000 +0100
@@ -0,0 +1,61 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+ifndef TOP
+TOP = ..
+CONFIG = $(TOP)/config
+endif
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME = libmwfonts.a
+LIBNAMESO = libmwfonts.so
+
+# List of objects to compile
+OBJS =	helvB10.o helvB12.o helvR10.o symbol.o rom8x16.o rom8x8.o\
+	winFreeSansSerif11x13.o winFreeSystem14x16.o X5x7.o X6x13.o
+#	timBI18.o
+
+ifeq ($(HAVEMSFONTS), Y)
+OBJS += winMSSansSerif11x13.o winSystem14x16.o winTerminal8x12.o
+endif
+
+ifeq ($(HAVE_BIG5_SUPPORT), Y)
+OBJS += chinese/big5font.o
+endif
+
+ifeq ($(HAVE_GB2312_SUPPORT), Y)
+OBJS += chinese/gb2312font.o
+endif
+
+%.c:%.bdf
+	echo "Generating $@ from font file ..."
+	./convbdf $< > $@
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
+realclean: clean
+	$(RM) helvB10.c helvB12.c helvR10.c timBI18.c X5x7.c X6x13.c
diff -urN lib/microwindows/src/fonts/X5x7.bdf /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/X5x7.bdf
--- lib/microwindows/src/fonts/X5x7.bdf	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/X5x7.bdf	2005-02-21 16:03:28.000000000 +0100
@@ -0,0 +1,3179 @@
+STARTFONT 2.1
+COMMENT  
+COMMENT  Copyright 1991 X Consortium
+COMMENT  
+COMMENT  WARNING:  This bdf file was generated from a font server using
+COMMENT  fstobdf.  The resulting font is subject to the same copyright,
+COMMENT  license, and trademark restrictions as the original font.  The
+COMMENT  authors and distributors of fstobdf disclaim all liability for
+COMMENT  misuse of the program or its output.
+COMMENT  
+FONT -Misc-Fixed-Medium-R-Normal--7-70-75-75-C-50-ISO8859-1
+SIZE 7 75 75
+FONTBOUNDINGBOX 6 7 0 -1
+STARTPROPERTIES 26
+FONTNAME_REGISTRY ""
+FOUNDRY "Misc"
+FAMILY_NAME "Fixed"
+WEIGHT_NAME "Medium"
+SLANT "R"
+SETWIDTH_NAME "Normal"
+ADD_STYLE_NAME ""
+PIXEL_SIZE 7
+POINT_SIZE 70
+RESOLUTION_X 75
+RESOLUTION_Y 75
+SPACING "C"
+AVERAGE_WIDTH 50
+CHARSET_REGISTRY "ISO8859"
+CHARSET_ENCODING "1"
+UNDERLINE_POSITION 0
+DESTINATION 1
+COPYRIGHT "Copyright 1991 X Consortium"
+FONT "-Misc-Fixed-Medium-R-Normal--7-70-75-75-C-50-ISO8859-1"
+WEIGHT 10
+RESOLUTION 103
+X_HEIGHT 6
+QUAD_WIDTH 5
+DEFAULT_CHAR 0
+FONT_ASCENT 6
+FONT_DESCENT 1
+ENDPROPERTIES
+CHARS 224
+STARTCHAR C000
+ENCODING 0
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+f0
+f0
+f0
+f0
+f0
+f0
+00
+ENDCHAR
+STARTCHAR C001
+ENCODING 1
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+20
+70
+f8
+70
+20
+00
+ENDCHAR
+STARTCHAR C002
+ENCODING 2
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+50
+a0
+50
+a0
+50
+a0
+00
+ENDCHAR
+STARTCHAR C003
+ENCODING 3
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+a0
+e0
+a0
+a0
+70
+20
+20
+ENDCHAR
+STARTCHAR C004
+ENCODING 4
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+c0
+80
+c0
+b0
+20
+30
+20
+ENDCHAR
+STARTCHAR C005
+ENCODING 5
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+c0
+80
+c0
+60
+50
+60
+50
+ENDCHAR
+STARTCHAR C006
+ENCODING 6
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+80
+80
+c0
+30
+20
+30
+20
+ENDCHAR
+STARTCHAR C007
+ENCODING 7
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+50
+20
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR C010
+ENCODING 8
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+70
+20
+00
+70
+00
+00
+ENDCHAR
+STARTCHAR C011
+ENCODING 9
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+90
+d0
+b0
+90
+20
+20
+30
+ENDCHAR
+STARTCHAR C012
+ENCODING 10
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+a0
+a0
+a0
+40
+70
+20
+20
+ENDCHAR
+STARTCHAR C013
+ENCODING 11
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+20
+20
+e0
+00
+00
+00
+ENDCHAR
+STARTCHAR C014
+ENCODING 12
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+e0
+20
+20
+20
+ENDCHAR
+STARTCHAR C015
+ENCODING 13
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+38
+20
+20
+20
+ENDCHAR
+STARTCHAR C016
+ENCODING 14
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+20
+20
+38
+00
+00
+00
+ENDCHAR
+STARTCHAR C017
+ENCODING 15
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+20
+20
+f8
+20
+20
+20
+ENDCHAR
+STARTCHAR C020
+ENCODING 16
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+f8
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR C021
+ENCODING 17
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 6 7 0 -1
+BITMAP
+00
+00
+f8
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR C022
+ENCODING 18
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+f8
+00
+00
+00
+ENDCHAR
+STARTCHAR C023
+ENCODING 19
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+00
+f8
+00
+00
+ENDCHAR
+STARTCHAR C024
+ENCODING 20
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+00
+00
+f8
+00
+ENDCHAR
+STARTCHAR C025
+ENCODING 21
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+20
+20
+38
+20
+20
+20
+ENDCHAR
+STARTCHAR C026
+ENCODING 22
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+20
+20
+e0
+20
+20
+20
+ENDCHAR
+STARTCHAR C027
+ENCODING 23
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 6 7 0 -1
+BITMAP
+20
+20
+20
+f8
+00
+00
+00
+ENDCHAR
+STARTCHAR C030
+ENCODING 24
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+f8
+20
+20
+20
+ENDCHAR
+STARTCHAR C031
+ENCODING 25
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+20
+20
+20
+20
+20
+20
+ENDCHAR
+STARTCHAR C032
+ENCODING 26
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+10
+20
+40
+20
+10
+70
+00
+ENDCHAR
+STARTCHAR C033
+ENCODING 27
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+20
+10
+20
+40
+70
+00
+ENDCHAR
+STARTCHAR C034
+ENCODING 28
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+70
+50
+50
+50
+00
+ENDCHAR
+STARTCHAR C035
+ENCODING 29
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+10
+70
+20
+70
+40
+00
+ENDCHAR
+STARTCHAR C036
+ENCODING 30
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+30
+40
+e0
+40
+b0
+00
+ENDCHAR
+STARTCHAR C037
+ENCODING 31
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+20
+00
+00
+00
+ENDCHAR
+STARTCHAR space
+ENCODING 32
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR exclam
+ENCODING 33
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+20
+20
+20
+00
+20
+00
+ENDCHAR
+STARTCHAR quotedbl
+ENCODING 34
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+50
+50
+50
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR numbersign
+ENCODING 35
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+50
+f8
+50
+f8
+50
+00
+ENDCHAR
+STARTCHAR dollar
+ENCODING 36
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+70
+a0
+70
+28
+70
+00
+ENDCHAR
+STARTCHAR percent
+ENCODING 37
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+80
+90
+20
+40
+90
+10
+00
+ENDCHAR
+STARTCHAR ampersand
+ENCODING 38
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+40
+a0
+40
+a0
+50
+00
+ENDCHAR
+STARTCHAR apostrophe
+ENCODING 39
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+40
+80
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR parenleft
+ENCODING 40
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+40
+40
+40
+40
+20
+00
+ENDCHAR
+STARTCHAR parenright
+ENCODING 41
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+20
+20
+20
+20
+40
+00
+ENDCHAR
+STARTCHAR asterisk
+ENCODING 42
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+a0
+40
+e0
+40
+a0
+00
+ENDCHAR
+STARTCHAR plus
+ENCODING 43
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+20
+20
+f8
+20
+20
+00
+ENDCHAR
+STARTCHAR comma
+ENCODING 44
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+00
+60
+40
+80
+ENDCHAR
+STARTCHAR minus
+ENCODING 45
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+f0
+00
+00
+00
+ENDCHAR
+STARTCHAR period
+ENCODING 46
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+00
+60
+60
+00
+ENDCHAR
+STARTCHAR slash
+ENCODING 47
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+10
+20
+40
+80
+00
+00
+ENDCHAR
+STARTCHAR 0
+ENCODING 48
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+a0
+a0
+a0
+a0
+40
+00
+ENDCHAR
+STARTCHAR 1
+ENCODING 49
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+c0
+40
+40
+40
+e0
+00
+ENDCHAR
+STARTCHAR 2
+ENCODING 50
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+10
+20
+40
+f0
+00
+ENDCHAR
+STARTCHAR 3
+ENCODING 51
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+f0
+10
+60
+10
+90
+60
+00
+ENDCHAR
+STARTCHAR 4
+ENCODING 52
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+60
+a0
+f0
+20
+20
+00
+ENDCHAR
+STARTCHAR 5
+ENCODING 53
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+f0
+80
+e0
+10
+90
+60
+00
+ENDCHAR
+STARTCHAR 6
+ENCODING 54
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+80
+e0
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR 7
+ENCODING 55
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+f0
+10
+20
+20
+40
+40
+00
+ENDCHAR
+STARTCHAR 8
+ENCODING 56
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+60
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR 9
+ENCODING 57
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+90
+70
+10
+60
+00
+ENDCHAR
+STARTCHAR colon
+ENCODING 58
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+60
+60
+00
+60
+60
+00
+ENDCHAR
+STARTCHAR semicolon
+ENCODING 59
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+60
+60
+00
+60
+40
+80
+ENDCHAR
+STARTCHAR less
+ENCODING 60
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+20
+40
+80
+40
+20
+00
+ENDCHAR
+STARTCHAR equal
+ENCODING 61
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+f0
+00
+f0
+00
+00
+ENDCHAR
+STARTCHAR greater
+ENCODING 62
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+80
+40
+20
+40
+80
+00
+ENDCHAR
+STARTCHAR question
+ENCODING 63
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+a0
+20
+40
+00
+40
+00
+ENDCHAR
+STARTCHAR at
+ENCODING 64
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+b0
+b0
+80
+60
+00
+ENDCHAR
+STARTCHAR A
+ENCODING 65
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+90
+f0
+90
+90
+00
+ENDCHAR
+STARTCHAR B
+ENCODING 66
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+e0
+90
+e0
+90
+90
+e0
+00
+ENDCHAR
+STARTCHAR C
+ENCODING 67
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+80
+80
+90
+60
+00
+ENDCHAR
+STARTCHAR D
+ENCODING 68
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+e0
+90
+90
+90
+90
+e0
+00
+ENDCHAR
+STARTCHAR E
+ENCODING 69
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+f0
+80
+e0
+80
+80
+f0
+00
+ENDCHAR
+STARTCHAR F
+ENCODING 70
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+f0
+80
+e0
+80
+80
+80
+00
+ENDCHAR
+STARTCHAR G
+ENCODING 71
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+80
+b0
+90
+70
+00
+ENDCHAR
+STARTCHAR H
+ENCODING 72
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+90
+90
+f0
+90
+90
+90
+00
+ENDCHAR
+STARTCHAR I
+ENCODING 73
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+e0
+40
+40
+40
+40
+e0
+00
+ENDCHAR
+STARTCHAR J
+ENCODING 74
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+10
+10
+10
+10
+90
+60
+00
+ENDCHAR
+STARTCHAR K
+ENCODING 75
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+90
+a0
+c0
+c0
+a0
+90
+00
+ENDCHAR
+STARTCHAR L
+ENCODING 76
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+80
+80
+80
+80
+80
+f0
+00
+ENDCHAR
+STARTCHAR M
+ENCODING 77
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+90
+f0
+f0
+90
+90
+90
+00
+ENDCHAR
+STARTCHAR N
+ENCODING 78
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+90
+d0
+d0
+b0
+b0
+90
+00
+ENDCHAR
+STARTCHAR O
+ENCODING 79
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+90
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR P
+ENCODING 80
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+e0
+90
+90
+e0
+80
+80
+00
+ENDCHAR
+STARTCHAR Q
+ENCODING 81
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+90
+90
+d0
+60
+10
+ENDCHAR
+STARTCHAR R
+ENCODING 82
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+e0
+90
+90
+e0
+a0
+90
+00
+ENDCHAR
+STARTCHAR S
+ENCODING 83
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+40
+20
+90
+60
+00
+ENDCHAR
+STARTCHAR T
+ENCODING 84
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+e0
+40
+40
+40
+40
+40
+00
+ENDCHAR
+STARTCHAR U
+ENCODING 85
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+90
+90
+90
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR V
+ENCODING 86
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+90
+90
+90
+90
+60
+60
+00
+ENDCHAR
+STARTCHAR W
+ENCODING 87
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+90
+90
+90
+f0
+f0
+90
+00
+ENDCHAR
+STARTCHAR X
+ENCODING 88
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+90
+90
+60
+60
+90
+90
+00
+ENDCHAR
+STARTCHAR Y
+ENCODING 89
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+a0
+a0
+a0
+40
+40
+40
+00
+ENDCHAR
+STARTCHAR Z
+ENCODING 90
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+f0
+10
+20
+40
+80
+f0
+00
+ENDCHAR
+STARTCHAR bracketleft
+ENCODING 91
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+e0
+80
+80
+80
+80
+e0
+00
+ENDCHAR
+STARTCHAR backslash
+ENCODING 92
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+80
+40
+20
+10
+00
+00
+ENDCHAR
+STARTCHAR bracketright
+ENCODING 93
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+e0
+20
+20
+20
+20
+e0
+00
+ENDCHAR
+STARTCHAR asciicircum
+ENCODING 94
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+a0
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR underscore
+ENCODING 95
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+00
+00
+f0
+00
+ENDCHAR
+STARTCHAR grave
+ENCODING 96
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+c0
+40
+20
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR a
+ENCODING 97
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+70
+90
+b0
+50
+00
+ENDCHAR
+STARTCHAR b
+ENCODING 98
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+80
+80
+e0
+90
+90
+e0
+00
+ENDCHAR
+STARTCHAR c
+ENCODING 99
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+60
+80
+80
+60
+00
+ENDCHAR
+STARTCHAR d
+ENCODING 100
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+10
+10
+70
+90
+90
+70
+00
+ENDCHAR
+STARTCHAR e
+ENCODING 101
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+60
+b0
+c0
+60
+00
+ENDCHAR
+STARTCHAR f
+ENCODING 102
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+50
+40
+e0
+40
+40
+00
+ENDCHAR
+STARTCHAR g
+ENCODING 103
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+70
+90
+60
+80
+70
+ENDCHAR
+STARTCHAR h
+ENCODING 104
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+80
+80
+e0
+90
+90
+90
+00
+ENDCHAR
+STARTCHAR i
+ENCODING 105
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+00
+c0
+40
+40
+e0
+00
+ENDCHAR
+STARTCHAR j
+ENCODING 106
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+00
+20
+20
+20
+a0
+40
+ENDCHAR
+STARTCHAR k
+ENCODING 107
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+80
+80
+a0
+c0
+a0
+90
+00
+ENDCHAR
+STARTCHAR l
+ENCODING 108
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+c0
+40
+40
+40
+40
+e0
+00
+ENDCHAR
+STARTCHAR m
+ENCODING 109
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+a0
+f0
+90
+90
+00
+ENDCHAR
+STARTCHAR n
+ENCODING 110
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+e0
+90
+90
+90
+00
+ENDCHAR
+STARTCHAR o
+ENCODING 111
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+60
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR p
+ENCODING 112
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+e0
+90
+90
+e0
+80
+ENDCHAR
+STARTCHAR q
+ENCODING 113
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+70
+90
+90
+70
+10
+ENDCHAR
+STARTCHAR r
+ENCODING 114
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+e0
+90
+80
+80
+00
+ENDCHAR
+STARTCHAR s
+ENCODING 115
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 6 7 0 -1
+BITMAP
+00
+00
+70
+c0
+30
+e0
+00
+ENDCHAR
+STARTCHAR t
+ENCODING 116
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+40
+e0
+40
+40
+30
+00
+ENDCHAR
+STARTCHAR u
+ENCODING 117
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+90
+90
+90
+70
+00
+ENDCHAR
+STARTCHAR v
+ENCODING 118
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+a0
+a0
+a0
+40
+00
+ENDCHAR
+STARTCHAR w
+ENCODING 119
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+90
+90
+f0
+f0
+00
+ENDCHAR
+STARTCHAR x
+ENCODING 120
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+90
+60
+60
+90
+00
+ENDCHAR
+STARTCHAR y
+ENCODING 121
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+90
+90
+50
+20
+40
+ENDCHAR
+STARTCHAR z
+ENCODING 122
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+f0
+20
+40
+f0
+00
+ENDCHAR
+STARTCHAR braceleft
+ENCODING 123
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+40
+c0
+40
+40
+20
+00
+ENDCHAR
+STARTCHAR bar
+ENCODING 124
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+40
+40
+40
+40
+40
+00
+ENDCHAR
+STARTCHAR braceright
+ENCODING 125
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 6 7 0 -1
+BITMAP
+80
+40
+60
+40
+40
+80
+00
+ENDCHAR
+STARTCHAR asciitilde
+ENCODING 126
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+50
+a0
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR C177
+ENCODING 127
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR nobreakspace
+ENCODING 160
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR exclamdown
+ENCODING 161
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+00
+20
+20
+20
+20
+00
+ENDCHAR
+STARTCHAR cent
+ENCODING 162
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+20
+70
+a0
+a0
+70
+20
+ENDCHAR
+STARTCHAR sterling
+ENCODING 163
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+30
+40
+e0
+40
+b0
+00
+ENDCHAR
+STARTCHAR currency
+ENCODING 164
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+88
+70
+50
+70
+88
+00
+ENDCHAR
+STARTCHAR yen
+ENCODING 165
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+a0
+a0
+40
+e0
+40
+40
+00
+ENDCHAR
+STARTCHAR brokenbar
+ENCODING 166
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+20
+20
+00
+20
+20
+00
+ENDCHAR
+STARTCHAR section
+ENCODING 167
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+30
+40
+60
+50
+30
+10
+60
+ENDCHAR
+STARTCHAR diaeresis
+ENCODING 168
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+50
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR copyright
+ENCODING 169
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+70
+88
+a8
+c8
+a8
+88
+70
+ENDCHAR
+STARTCHAR ordfeminine
+ENCODING 170
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+a0
+60
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR guillemotleft
+ENCODING 171
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+48
+90
+48
+00
+00
+ENDCHAR
+STARTCHAR notsign
+ENCODING 172
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+f0
+10
+00
+00
+00
+ENDCHAR
+STARTCHAR hyphen
+ENCODING 173
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+f0
+00
+00
+00
+ENDCHAR
+STARTCHAR registered
+ENCODING 174
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+70
+88
+e8
+c8
+c8
+88
+70
+ENDCHAR
+STARTCHAR macron
+ENCODING 175
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+f0
+00
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR degree
+ENCODING 176
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+50
+20
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR plusminus
+ENCODING 177
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+20
+f8
+20
+20
+f8
+00
+ENDCHAR
+STARTCHAR twosuperior
+ENCODING 178
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+20
+40
+60
+00
+00
+00
+ENDCHAR
+STARTCHAR threesuperior
+ENCODING 179
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+60
+20
+60
+00
+00
+00
+ENDCHAR
+STARTCHAR acute
+ENCODING 180
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+40
+00
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR mu
+ENCODING 181
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+90
+90
+90
+e0
+80
+ENDCHAR
+STARTCHAR paragraph
+ENCODING 182
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+70
+d0
+d0
+50
+50
+50
+00
+ENDCHAR
+STARTCHAR periodcentered
+ENCODING 183
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+60
+60
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR cedilla
+ENCODING 184
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+00
+00
+00
+20
+40
+ENDCHAR
+STARTCHAR onesuperior
+ENCODING 185
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+60
+20
+70
+00
+00
+00
+ENDCHAR
+STARTCHAR masculine
+ENCODING 186
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+a0
+40
+00
+00
+00
+00
+ENDCHAR
+STARTCHAR guillemotright
+ENCODING 187
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+90
+48
+90
+00
+00
+ENDCHAR
+STARTCHAR onequarter
+ENCODING 188
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+80
+80
+80
+90
+30
+70
+10
+ENDCHAR
+STARTCHAR onehalf
+ENCODING 189
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+80
+80
+80
+b0
+10
+20
+30
+ENDCHAR
+STARTCHAR threequarters
+ENCODING 190
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+c0
+c0
+40
+d0
+30
+70
+10
+ENDCHAR
+STARTCHAR questiondown
+ENCODING 191
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+00
+40
+80
+a0
+40
+00
+ENDCHAR
+STARTCHAR Agrave
+ENCODING 192
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+90
+f0
+90
+90
+00
+ENDCHAR
+STARTCHAR Aacute
+ENCODING 193
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+90
+f0
+90
+90
+00
+ENDCHAR
+STARTCHAR Acircumflex
+ENCODING 194
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+90
+f0
+90
+90
+00
+ENDCHAR
+STARTCHAR Atilde
+ENCODING 195
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+90
+f0
+90
+90
+00
+ENDCHAR
+STARTCHAR Adiaeresis
+ENCODING 196
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+90
+f0
+90
+90
+00
+ENDCHAR
+STARTCHAR Aring
+ENCODING 197
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+90
+f0
+90
+90
+00
+ENDCHAR
+STARTCHAR AE
+ENCODING 198
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+70
+a0
+b0
+e0
+a0
+b0
+00
+ENDCHAR
+STARTCHAR Ccedilla
+ENCODING 199
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+80
+80
+90
+60
+40
+ENDCHAR
+STARTCHAR Egrave
+ENCODING 200
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+f0
+80
+e0
+80
+80
+f0
+00
+ENDCHAR
+STARTCHAR Eacute
+ENCODING 201
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+f0
+80
+e0
+80
+80
+f0
+00
+ENDCHAR
+STARTCHAR Ecircumflex
+ENCODING 202
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+f0
+80
+e0
+80
+80
+f0
+00
+ENDCHAR
+STARTCHAR Ediaeresis
+ENCODING 203
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+f0
+80
+e0
+80
+80
+f0
+00
+ENDCHAR
+STARTCHAR Igrave
+ENCODING 204
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+e0
+40
+40
+40
+40
+e0
+00
+ENDCHAR
+STARTCHAR Iacute
+ENCODING 205
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+e0
+40
+40
+40
+40
+e0
+00
+ENDCHAR
+STARTCHAR Icircumflex
+ENCODING 206
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+e0
+40
+40
+40
+40
+e0
+00
+ENDCHAR
+STARTCHAR Idiaeresis
+ENCODING 207
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+e0
+40
+40
+40
+40
+e0
+00
+ENDCHAR
+STARTCHAR ETH
+ENCODING 208
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+e0
+50
+d0
+50
+50
+e0
+00
+ENDCHAR
+STARTCHAR Ntilde
+ENCODING 209
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+b0
+90
+d0
+b0
+b0
+90
+00
+ENDCHAR
+STARTCHAR Ograve
+ENCODING 210
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+90
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR Oacute
+ENCODING 211
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+90
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR Ocircumflex
+ENCODING 212
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+90
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR Otilde
+ENCODING 213
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+90
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR Odiaeresis
+ENCODING 214
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+90
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR multiply
+ENCODING 215
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+90
+60
+60
+90
+00
+ENDCHAR
+STARTCHAR Ooblique
+ENCODING 216
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+70
+b0
+b0
+d0
+d0
+e0
+00
+ENDCHAR
+STARTCHAR Ugrave
+ENCODING 217
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+90
+90
+90
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR Uacute
+ENCODING 218
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+90
+90
+90
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR Ucircumflex
+ENCODING 219
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+90
+90
+90
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR Udiaeresis
+ENCODING 220
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+90
+90
+90
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR Yacute
+ENCODING 221
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+a0
+a0
+a0
+40
+40
+40
+00
+ENDCHAR
+STARTCHAR THORN
+ENCODING 222
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+80
+e0
+90
+e0
+80
+80
+00
+ENDCHAR
+STARTCHAR ssharp
+ENCODING 223
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+90
+e0
+90
+d0
+a0
+80
+ENDCHAR
+STARTCHAR agrave
+ENCODING 224
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+20
+70
+90
+b0
+50
+00
+ENDCHAR
+STARTCHAR aacute
+ENCODING 225
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+40
+70
+90
+b0
+50
+00
+ENDCHAR
+STARTCHAR acircumflex
+ENCODING 226
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+50
+70
+90
+b0
+50
+00
+ENDCHAR
+STARTCHAR atilde
+ENCODING 227
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+50
+a0
+70
+90
+b0
+50
+00
+ENDCHAR
+STARTCHAR adiaeresis
+ENCODING 228
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+50
+00
+70
+90
+b0
+50
+00
+ENDCHAR
+STARTCHAR aring
+ENCODING 229
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+60
+70
+90
+b0
+50
+00
+ENDCHAR
+STARTCHAR ae
+ENCODING 230
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+70
+b0
+a0
+70
+00
+ENDCHAR
+STARTCHAR ccedilla
+ENCODING 231
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+60
+80
+80
+60
+40
+ENDCHAR
+STARTCHAR egrave
+ENCODING 232
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+20
+60
+b0
+c0
+60
+00
+ENDCHAR
+STARTCHAR eacute
+ENCODING 233
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+40
+60
+b0
+c0
+60
+00
+ENDCHAR
+STARTCHAR ecircumflex
+ENCODING 234
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+a0
+60
+b0
+c0
+60
+00
+ENDCHAR
+STARTCHAR ediaeresis
+ENCODING 235
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+a0
+00
+60
+b0
+c0
+60
+00
+ENDCHAR
+STARTCHAR igrave
+ENCODING 236
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+80
+40
+c0
+40
+40
+e0
+00
+ENDCHAR
+STARTCHAR iacute
+ENCODING 237
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+80
+c0
+40
+40
+e0
+00
+ENDCHAR
+STARTCHAR icircumflex
+ENCODING 238
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+a0
+c0
+40
+40
+e0
+00
+ENDCHAR
+STARTCHAR idiaeresis
+ENCODING 239
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+a0
+00
+c0
+40
+40
+e0
+00
+ENDCHAR
+STARTCHAR eth
+ENCODING 240
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+30
+60
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR ntilde
+ENCODING 241
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+50
+a0
+e0
+90
+90
+90
+00
+ENDCHAR
+STARTCHAR ograve
+ENCODING 242
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+20
+60
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR oacute
+ENCODING 243
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+40
+60
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR ocircumflex
+ENCODING 244
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+00
+60
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR otilde
+ENCODING 245
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+50
+a0
+60
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR odiaeresis
+ENCODING 246
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+a0
+00
+60
+90
+90
+60
+00
+ENDCHAR
+STARTCHAR division
+ENCODING 247
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+60
+00
+f0
+00
+60
+00
+ENDCHAR
+STARTCHAR oslash
+ENCODING 248
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+00
+70
+b0
+d0
+e0
+00
+ENDCHAR
+STARTCHAR ugrave
+ENCODING 249
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+40
+20
+90
+90
+90
+70
+00
+ENDCHAR
+STARTCHAR uacute
+ENCODING 250
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+40
+90
+90
+90
+70
+00
+ENDCHAR
+STARTCHAR ucircumflex
+ENCODING 251
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+60
+00
+90
+90
+90
+70
+00
+ENDCHAR
+STARTCHAR udiaeresis
+ENCODING 252
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+50
+00
+90
+90
+90
+70
+00
+ENDCHAR
+STARTCHAR yacute
+ENCODING 253
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+20
+40
+90
+90
+50
+20
+40
+ENDCHAR
+STARTCHAR thorn
+ENCODING 254
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+00
+80
+e0
+90
+90
+e0
+80
+ENDCHAR
+STARTCHAR ydiaeresis
+ENCODING 255
+SWIDTH 685 0
+DWIDTH 5 0
+BBX 5 7 0 -1
+BITMAP
+50
+00
+90
+90
+50
+20
+40
+ENDCHAR
+ENDFONT
diff -urN lib/microwindows/src/fonts/X5x7.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/X5x7.c
--- lib/microwindows/src/fonts/X5x7.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/X5x7.c	2005-02-21 16:03:28.000000000 +0100
@@ -0,0 +1,2702 @@
+/* Generated by convbdf on Tue Oct  3 00:24:24 MDT 2000. */
+#include "device.h"
+
+/* Font information:
+
+   name: "-Misc-Fixed-Medium-R-Normal--7-70-75-75-C-50-ISO8859-1"
+   pixel size: 7
+   ascent: 6
+   descent: 1
+*/
+
+/* Font character bitmap data. */
+static MWIMAGEBITS X5x7_bits[] = {
+
+/* Character (0x00):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |****            |
+   |****            |
+   |****            |
+   |****            |
+   |****            |
+   |****            |
+   |                |
+   +----------------+ */
+0xf000, 
+0xf000, 
+0xf000, 
+0xf000, 
+0xf000, 
+0xf000, 
+0x0000, 
+
+/* Character (0x01):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |  *             |
+   | ***            |
+   |*****           |
+   | ***            |
+   |  *             |
+   |                |
+   +----------------+ */
+0x0000, 
+0x2000, 
+0x7000, 
+0xf800, 
+0x7000, 
+0x2000, 
+0x0000, 
+
+/* Character (0x02):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | * *            |
+   |* *             |
+   | * *            |
+   |* *             |
+   | * *            |
+   |* *             |
+   |                |
+   +----------------+ */
+0x5000, 
+0xa000, 
+0x5000, 
+0xa000, 
+0x5000, 
+0xa000, 
+0x0000, 
+
+/* Character (0x03):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |* *             |
+   |***             |
+   |* *             |
+   |* *             |
+   | ***            |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0xa000, 
+0xe000, 
+0xa000, 
+0xa000, 
+0x7000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x04):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |**              |
+   |*               |
+   |**              |
+   |* **            |
+   |  *             |
+   |  **            |
+   |  *             |
+   +----------------+ */
+0xc000, 
+0x8000, 
+0xc000, 
+0xb000, 
+0x2000, 
+0x3000, 
+0x2000, 
+
+/* Character (0x05):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |**              |
+   |*               |
+   |**              |
+   | **             |
+   | * *            |
+   | **             |
+   | * *            |
+   +----------------+ */
+0xc000, 
+0x8000, 
+0xc000, 
+0x6000, 
+0x5000, 
+0x6000, 
+0x5000, 
+
+/* Character (0x06):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*               |
+   |*               |
+   |**              |
+   |  **            |
+   |  *             |
+   |  **            |
+   |  *             |
+   +----------------+ */
+0x8000, 
+0x8000, 
+0xc000, 
+0x3000, 
+0x2000, 
+0x3000, 
+0x2000, 
+
+/* Character (0x07):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |  *             |
+   | * *            |
+   |  *             |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x2000, 
+0x5000, 
+0x2000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x08):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |  *             |
+   | ***            |
+   |  *             |
+   |                |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x2000, 
+0x7000, 
+0x2000, 
+0x0000, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x09):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*  *            |
+   |** *            |
+   |* **            |
+   |*  *            |
+   |  *             |
+   |  *             |
+   |  **            |
+   +----------------+ */
+0x9000, 
+0xd000, 
+0xb000, 
+0x9000, 
+0x2000, 
+0x2000, 
+0x3000, 
+
+/* Character (0x0a):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |* *             |
+   |* *             |
+   |* *             |
+   | *              |
+   | ***            |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0xa000, 
+0xa000, 
+0xa000, 
+0x4000, 
+0x7000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x0b):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |  *             |
+   |  *             |
+   |  *             |
+   |***             |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x2000, 
+0x2000, 
+0x2000, 
+0xe000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x0c):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |***             |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0xe000, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x0d):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |  ***           |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x3800, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x0e):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |  *             |
+   |  *             |
+   |  *             |
+   |  ***           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x2000, 
+0x2000, 
+0x2000, 
+0x3800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x0f):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |  *             |
+   |  *             |
+   |  *             |
+   |*****           |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x2000, 
+0x2000, 
+0x2000, 
+0xf800, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x10):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |*****           |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0xf800, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x11):
+   bbw=6, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x12):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |*****           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0xf800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x13):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x14):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |*****           |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xf800, 
+0x0000, 
+
+/* Character (0x15):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |  *             |
+   |  *             |
+   |  *             |
+   |  ***           |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x2000, 
+0x2000, 
+0x2000, 
+0x3800, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x16):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |  *             |
+   |  *             |
+   |  *             |
+   |***             |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x2000, 
+0x2000, 
+0x2000, 
+0xe000, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x17):
+   bbw=6, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |  *             |
+   |  *             |
+   |  *             |
+   |*****           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x2000, 
+0x2000, 
+0x2000, 
+0xf800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x18):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |*****           |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0xf800, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x19):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x1a):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |   *            |
+   |  *             |
+   | *              |
+   |  *             |
+   |   *            |
+   | ***            |
+   |                |
+   +----------------+ */
+0x1000, 
+0x2000, 
+0x4000, 
+0x2000, 
+0x1000, 
+0x7000, 
+0x0000, 
+
+/* Character (0x1b):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | *              |
+   |  *             |
+   |   *            |
+   |  *             |
+   | *              |
+   | ***            |
+   |                |
+   +----------------+ */
+0x4000, 
+0x2000, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x7000, 
+0x0000, 
+
+/* Character (0x1c):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   | * *            |
+   | * *            |
+   | * *            |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x5000, 
+0x5000, 
+0x5000, 
+0x0000, 
+
+/* Character (0x1d):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |   *            |
+   | ***            |
+   |  *             |
+   | ***            |
+   | *              |
+   |                |
+   +----------------+ */
+0x0000, 
+0x1000, 
+0x7000, 
+0x2000, 
+0x7000, 
+0x4000, 
+0x0000, 
+
+/* Character (0x1e):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |  **            |
+   | *              |
+   |***             |
+   | *              |
+   |* **            |
+   |                |
+   +----------------+ */
+0x0000, 
+0x3000, 
+0x4000, 
+0xe000, 
+0x4000, 
+0xb000, 
+0x0000, 
+
+/* Character (0x1f):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |  *             |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x2000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x20):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x21):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |                |
+   |  *             |
+   |                |
+   +----------------+ */
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x0000, 
+0x2000, 
+0x0000, 
+
+/* Character (0x22):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | * *            |
+   | * *            |
+   | * *            |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x5000, 
+0x5000, 
+0x5000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x23):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   | * *            |
+   |*****           |
+   | * *            |
+   |*****           |
+   | * *            |
+   |                |
+   +----------------+ */
+0x0000, 
+0x5000, 
+0xf800, 
+0x5000, 
+0xf800, 
+0x5000, 
+0x0000, 
+
+/* Character (0x24):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   | ***            |
+   |* *             |
+   | ***            |
+   |  * *           |
+   | ***            |
+   |                |
+   +----------------+ */
+0x0000, 
+0x7000, 
+0xa000, 
+0x7000, 
+0x2800, 
+0x7000, 
+0x0000, 
+
+/* Character (0x25):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*               |
+   |*  *            |
+   |  *             |
+   | *              |
+   |*  *            |
+   |   *            |
+   |                |
+   +----------------+ */
+0x8000, 
+0x9000, 
+0x2000, 
+0x4000, 
+0x9000, 
+0x1000, 
+0x0000, 
+
+/* Character (0x26):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   | *              |
+   |* *             |
+   | *              |
+   |* *             |
+   | * *            |
+   |                |
+   +----------------+ */
+0x0000, 
+0x4000, 
+0xa000, 
+0x4000, 
+0xa000, 
+0x5000, 
+0x0000, 
+
+/* Character (0x27):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | **             |
+   | *              |
+   |*               |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x6000, 
+0x4000, 
+0x8000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x28):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |  *             |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |  *             |
+   |                |
+   +----------------+ */
+0x2000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x2000, 
+0x0000, 
+
+/* Character (0x29):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | *              |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   | *              |
+   |                |
+   +----------------+ */
+0x4000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x4000, 
+0x0000, 
+
+/* Character (0x2a):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |* *             |
+   | *              |
+   |***             |
+   | *              |
+   |* *             |
+   |                |
+   +----------------+ */
+0x0000, 
+0xa000, 
+0x4000, 
+0xe000, 
+0x4000, 
+0xa000, 
+0x0000, 
+
+/* Character (0x2b):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |  *             |
+   |  *             |
+   |*****           |
+   |  *             |
+   |  *             |
+   |                |
+   +----------------+ */
+0x0000, 
+0x2000, 
+0x2000, 
+0xf800, 
+0x2000, 
+0x2000, 
+0x0000, 
+
+/* Character (0x2c):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | **             |
+   | *              |
+   |*               |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6000, 
+0x4000, 
+0x8000, 
+
+/* Character (0x2d):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |****            |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0xf000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2e):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | **             |
+   | **             |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x2f):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |   *            |
+   |  *             |
+   | *              |
+   |*               |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x8000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x30):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | *              |
+   |* *             |
+   |* *             |
+   |* *             |
+   |* *             |
+   | *              |
+   |                |
+   +----------------+ */
+0x4000, 
+0xa000, 
+0xa000, 
+0xa000, 
+0xa000, 
+0x4000, 
+0x0000, 
+
+/* Character (0x31):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | *              |
+   |**              |
+   | *              |
+   | *              |
+   | *              |
+   |***             |
+   |                |
+   +----------------+ */
+0x4000, 
+0xc000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0xe000, 
+0x0000, 
+
+/* Character (0x32):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | **             |
+   |*  *            |
+   |   *            |
+   |  *             |
+   | *              |
+   |****            |
+   |                |
+   +----------------+ */
+0x6000, 
+0x9000, 
+0x1000, 
+0x2000, 
+0x4000, 
+0xf000, 
+0x0000, 
+
+/* Character (0x33):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |****            |
+   |   *            |
+   | **             |
+   |   *            |
+   |*  *            |
+   | **             |
+   |                |
+   +----------------+ */
+0xf000, 
+0x1000, 
+0x6000, 
+0x1000, 
+0x9000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x34):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |  *             |
+   | **             |
+   |* *             |
+   |****            |
+   |  *             |
+   |  *             |
+   |                |
+   +----------------+ */
+0x2000, 
+0x6000, 
+0xa000, 
+0xf000, 
+0x2000, 
+0x2000, 
+0x0000, 
+
+/* Character (0x35):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |****            |
+   |*               |
+   |***             |
+   |   *            |
+   |*  *            |
+   | **             |
+   |                |
+   +----------------+ */
+0xf000, 
+0x8000, 
+0xe000, 
+0x1000, 
+0x9000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x36):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | **             |
+   |*               |
+   |***             |
+   |*  *            |
+   |*  *            |
+   | **             |
+   |                |
+   +----------------+ */
+0x6000, 
+0x8000, 
+0xe000, 
+0x9000, 
+0x9000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x37):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |****            |
+   |   *            |
+   |  *             |
+   |  *             |
+   | *              |
+   | *              |
+   |                |
+   +----------------+ */
+0xf000, 
+0x1000, 
+0x2000, 
+0x2000, 
+0x4000, 
+0x4000, 
+0x0000, 
+
+/* Character (0x38):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | **             |
+   |*  *            |
+   | **             |
+   |*  *            |
+   |*  *            |
+   | **             |
+   |                |
+   +----------------+ */
+0x6000, 
+0x9000, 
+0x6000, 
+0x9000, 
+0x9000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x39):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | **             |
+   |*  *            |
+   |*  *            |
+   | ***            |
+   |   *            |
+   | **             |
+   |                |
+   +----------------+ */
+0x6000, 
+0x9000, 
+0x9000, 
+0x7000, 
+0x1000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x3a):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   | **             |
+   | **             |
+   |                |
+   | **             |
+   | **             |
+   |                |
+   +----------------+ */
+0x0000, 
+0x6000, 
+0x6000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x3b):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   | **             |
+   | **             |
+   |                |
+   | **             |
+   | *              |
+   |*               |
+   +----------------+ */
+0x0000, 
+0x6000, 
+0x6000, 
+0x0000, 
+0x6000, 
+0x4000, 
+0x8000, 
+
+/* Character (0x3c):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |  *             |
+   | *              |
+   |*               |
+   | *              |
+   |  *             |
+   |                |
+   +----------------+ */
+0x0000, 
+0x2000, 
+0x4000, 
+0x8000, 
+0x4000, 
+0x2000, 
+0x0000, 
+
+/* Character (0x3d):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |****            |
+   |                |
+   |****            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf000, 
+0x0000, 
+0xf000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3e):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |*               |
+   | *              |
+   |  *             |
+   | *              |
+   |*               |
+   |                |
+   +----------------+ */
+0x0000, 
+0x8000, 
+0x4000, 
+0x2000, 
+0x4000, 
+0x8000, 
+0x0000, 
+
+/* Character (0x3f):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | *              |
+   |* *             |
+   |  *             |
+   | *              |
+   |                |
+   | *              |
+   |                |
+   +----------------+ */
+0x4000, 
+0xa000, 
+0x2000, 
+0x4000, 
+0x0000, 
+0x4000, 
+0x0000, 
+
+/* Character (0x40):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | **             |
+   |*  *            |
+   |* **            |
+   |* **            |
+   |*               |
+   | **             |
+   |                |
+   +----------------+ */
+0x6000, 
+0x9000, 
+0xb000, 
+0xb000, 
+0x8000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x41):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | **             |
+   |*  *            |
+   |*  *            |
+   |****            |
+   |*  *            |
+   |*  *            |
+   |                |
+   +----------------+ */
+0x6000, 
+0x9000, 
+0x9000, 
+0xf000, 
+0x9000, 
+0x9000, 
+0x0000, 
+
+/* Character (0x42):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |***             |
+   |*  *            |
+   |***             |
+   |*  *            |
+   |*  *            |
+   |***             |
+   |                |
+   +----------------+ */
+0xe000, 
+0x9000, 
+0xe000, 
+0x9000, 
+0x9000, 
+0xe000, 
+0x0000, 
+
+/* Character (0x43):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | **             |
+   |*  *            |
+   |*               |
+   |*               |
+   |*  *            |
+   | **             |
+   |                |
+   +----------------+ */
+0x6000, 
+0x9000, 
+0x8000, 
+0x8000, 
+0x9000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x44):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |***             |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   |***             |
+   |                |
+   +----------------+ */
+0xe000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0xe000, 
+0x0000, 
+
+/* Character (0x45):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |****            |
+   |*               |
+   |***             |
+   |*               |
+   |*               |
+   |****            |
+   |                |
+   +----------------+ */
+0xf000, 
+0x8000, 
+0xe000, 
+0x8000, 
+0x8000, 
+0xf000, 
+0x0000, 
+
+/* Character (0x46):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |****            |
+   |*               |
+   |***             |
+   |*               |
+   |*               |
+   |*               |
+   |                |
+   +----------------+ */
+0xf000, 
+0x8000, 
+0xe000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x0000, 
+
+/* Character (0x47):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | **             |
+   |*  *            |
+   |*               |
+   |* **            |
+   |*  *            |
+   | ***            |
+   |                |
+   +----------------+ */
+0x6000, 
+0x9000, 
+0x8000, 
+0xb000, 
+0x9000, 
+0x7000, 
+0x0000, 
+
+/* Character (0x48):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*  *            |
+   |*  *            |
+   |****            |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   |                |
+   +----------------+ */
+0x9000, 
+0x9000, 
+0xf000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0x0000, 
+
+/* Character (0x49):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |***             |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |***             |
+   |                |
+   +----------------+ */
+0xe000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0xe000, 
+0x0000, 
+
+/* Character (0x4a):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |   *            |
+   |   *            |
+   |   *            |
+   |   *            |
+   |*  *            |
+   | **             |
+   |                |
+   +----------------+ */
+0x1000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x9000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x4b):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*  *            |
+   |* *             |
+   |**              |
+   |**              |
+   |* *             |
+   |*  *            |
+   |                |
+   +----------------+ */
+0x9000, 
+0xa000, 
+0xc000, 
+0xc000, 
+0xa000, 
+0x9000, 
+0x0000, 
+
+/* Character (0x4c):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |****            |
+   |                |
+   +----------------+ */
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0xf000, 
+0x0000, 
+
+/* Character (0x4d):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*  *            |
+   |****            |
+   |****            |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   |                |
+   +----------------+ */
+0x9000, 
+0xf000, 
+0xf000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0x0000, 
+
+/* Character (0x4e):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*  *            |
+   |** *            |
+   |** *            |
+   |* **            |
+   |* **            |
+   |*  *            |
+   |                |
+   +----------------+ */
+0x9000, 
+0xd000, 
+0xd000, 
+0xb000, 
+0xb000, 
+0x9000, 
+0x0000, 
+
+/* Character (0x4f):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | **             |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   | **             |
+   |                |
+   +----------------+ */
+0x6000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x50):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |***             |
+   |*  *            |
+   |*  *            |
+   |***             |
+   |*               |
+   |*               |
+   |                |
+   +----------------+ */
+0xe000, 
+0x9000, 
+0x9000, 
+0xe000, 
+0x8000, 
+0x8000, 
+0x0000, 
+
+/* Character (0x51):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | **             |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   |** *            |
+   | **             |
+   |   *            |
+   +----------------+ */
+0x6000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0xd000, 
+0x6000, 
+0x1000, 
+
+/* Character (0x52):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |***             |
+   |*  *            |
+   |*  *            |
+   |***             |
+   |* *             |
+   |*  *            |
+   |                |
+   +----------------+ */
+0xe000, 
+0x9000, 
+0x9000, 
+0xe000, 
+0xa000, 
+0x9000, 
+0x0000, 
+
+/* Character (0x53):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | **             |
+   |*  *            |
+   | *              |
+   |  *             |
+   |*  *            |
+   | **             |
+   |                |
+   +----------------+ */
+0x6000, 
+0x9000, 
+0x4000, 
+0x2000, 
+0x9000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x54):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |***             |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |                |
+   +----------------+ */
+0xe000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x0000, 
+
+/* Character (0x55):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   | **             |
+   |                |
+   +----------------+ */
+0x9000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x56):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   | **             |
+   | **             |
+   |                |
+   +----------------+ */
+0x9000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0x6000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x57):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   |****            |
+   |****            |
+   |*  *            |
+   |                |
+   +----------------+ */
+0x9000, 
+0x9000, 
+0x9000, 
+0xf000, 
+0xf000, 
+0x9000, 
+0x0000, 
+
+/* Character (0x58):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*  *            |
+   |*  *            |
+   | **             |
+   | **             |
+   |*  *            |
+   |*  *            |
+   |                |
+   +----------------+ */
+0x9000, 
+0x9000, 
+0x6000, 
+0x6000, 
+0x9000, 
+0x9000, 
+0x0000, 
+
+/* Character (0x59):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |* *             |
+   |* *             |
+   |* *             |
+   | *              |
+   | *              |
+   | *              |
+   |                |
+   +----------------+ */
+0xa000, 
+0xa000, 
+0xa000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x0000, 
+
+/* Character (0x5a):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |****            |
+   |   *            |
+   |  *             |
+   | *              |
+   |*               |
+   |****            |
+   |                |
+   +----------------+ */
+0xf000, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x8000, 
+0xf000, 
+0x0000, 
+
+/* Character (0x5b):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |***             |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |***             |
+   |                |
+   +----------------+ */
+0xe000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0xe000, 
+0x0000, 
+
+/* Character (0x5c):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |*               |
+   | *              |
+   |  *             |
+   |   *            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x8000, 
+0x4000, 
+0x2000, 
+0x1000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5d):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |***             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |***             |
+   |                |
+   +----------------+ */
+0xe000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0xe000, 
+0x0000, 
+
+/* Character (0x5e):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | *              |
+   |* *             |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x4000, 
+0xa000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5f):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |****            |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xf000, 
+0x0000, 
+
+/* Character (0x60):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |**              |
+   | *              |
+   |  *             |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0xc000, 
+0x4000, 
+0x2000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x61):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*  *            |
+   |* **            |
+   | * *            |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x9000, 
+0xb000, 
+0x5000, 
+0x0000, 
+
+/* Character (0x62):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*               |
+   |*               |
+   |***             |
+   |*  *            |
+   |*  *            |
+   |***             |
+   |                |
+   +----------------+ */
+0x8000, 
+0x8000, 
+0xe000, 
+0x9000, 
+0x9000, 
+0xe000, 
+0x0000, 
+
+/* Character (0x63):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   | **             |
+   |*               |
+   |*               |
+   | **             |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6000, 
+0x8000, 
+0x8000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x64):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |   *            |
+   |   *            |
+   | ***            |
+   |*  *            |
+   |*  *            |
+   | ***            |
+   |                |
+   +----------------+ */
+0x1000, 
+0x1000, 
+0x7000, 
+0x9000, 
+0x9000, 
+0x7000, 
+0x0000, 
+
+/* Character (0x65):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   | **             |
+   |* **            |
+   |**              |
+   | **             |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6000, 
+0xb000, 
+0xc000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x66):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |  *             |
+   | * *            |
+   | *              |
+   |***             |
+   | *              |
+   | *              |
+   |                |
+   +----------------+ */
+0x2000, 
+0x5000, 
+0x4000, 
+0xe000, 
+0x4000, 
+0x4000, 
+0x0000, 
+
+/* Character (0x67):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*  *            |
+   | **             |
+   |*               |
+   | ***            |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x9000, 
+0x6000, 
+0x8000, 
+0x7000, 
+
+/* Character (0x68):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*               |
+   |*               |
+   |***             |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   |                |
+   +----------------+ */
+0x8000, 
+0x8000, 
+0xe000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0x0000, 
+
+/* Character (0x69):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | *              |
+   |                |
+   |**              |
+   | *              |
+   | *              |
+   |***             |
+   |                |
+   +----------------+ */
+0x4000, 
+0x0000, 
+0xc000, 
+0x4000, 
+0x4000, 
+0xe000, 
+0x0000, 
+
+/* Character (0x6a):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |  *             |
+   |                |
+   |  *             |
+   |  *             |
+   |  *             |
+   |* *             |
+   | *              |
+   +----------------+ */
+0x2000, 
+0x0000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0xa000, 
+0x4000, 
+
+/* Character (0x6b):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*               |
+   |*               |
+   |* *             |
+   |**              |
+   |* *             |
+   |*  *            |
+   |                |
+   +----------------+ */
+0x8000, 
+0x8000, 
+0xa000, 
+0xc000, 
+0xa000, 
+0x9000, 
+0x0000, 
+
+/* Character (0x6c):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |**              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |***             |
+   |                |
+   +----------------+ */
+0xc000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0xe000, 
+0x0000, 
+
+/* Character (0x6d):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |* *             |
+   |****            |
+   |*  *            |
+   |*  *            |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xa000, 
+0xf000, 
+0x9000, 
+0x9000, 
+0x0000, 
+
+/* Character (0x6e):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |***             |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xe000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0x0000, 
+
+/* Character (0x6f):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   | **             |
+   |*  *            |
+   |*  *            |
+   | **             |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6000, 
+0x9000, 
+0x9000, 
+0x6000, 
+0x0000, 
+
+/* Character (0x70):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |***             |
+   |*  *            |
+   |*  *            |
+   |***             |
+   |*               |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xe000, 
+0x9000, 
+0x9000, 
+0xe000, 
+0x8000, 
+
+/* Character (0x71):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*  *            |
+   |*  *            |
+   | ***            |
+   |   *            |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x9000, 
+0x9000, 
+0x7000, 
+0x1000, 
+
+/* Character (0x72):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |***             |
+   |*  *            |
+   |*               |
+   |*               |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xe000, 
+0x9000, 
+0x8000, 
+0x8000, 
+0x0000, 
+
+/* Character (0x73):
+   bbw=6, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |**              |
+   |  **            |
+   |***             |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0xc000, 
+0x3000, 
+0xe000, 
+0x0000, 
+
+/* Character (0x74):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | *              |
+   | *              |
+   |***             |
+   | *              |
+   | *              |
+   |  **            |
+   |                |
+   +----------------+ */
+0x4000, 
+0x4000, 
+0xe000, 
+0x4000, 
+0x4000, 
+0x3000, 
+0x0000, 
+
+/* Character (0x75):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   | ***            |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0x7000, 
+0x0000, 
+
+/* Character (0x76):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |* *             |
+   |* *             |
+   |* *             |
+   | *              |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xa000, 
+0xa000, 
+0xa000, 
+0x4000, 
+0x0000, 
+
+/* Character (0x77):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |*  *            |
+   |*  *            |
+   |****            |
+   |****            |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x9000, 
+0x9000, 
+0xf000, 
+0xf000, 
+0x0000, 
+
+/* Character (0x78):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |*  *            |
+   | **             |
+   | **             |
+   |*  *            |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x9000, 
+0x6000, 
+0x6000, 
+0x9000, 
+0x0000, 
+
+/* Character (0x79):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |*  *            |
+   |*  *            |
+   | * *            |
+   |  *             |
+   | *              |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x9000, 
+0x9000, 
+0x5000, 
+0x2000, 
+0x4000, 
+
+/* Character (0x7a):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |                |
+   |                |
+   |****            |
+   |  *             |
+   | *              |
+   |****            |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf000, 
+0x2000, 
+0x4000, 
+0xf000, 
+0x0000, 
+
+/* Character (0x7b):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |  *             |
+   | *              |
+   |**              |
+   | *              |
+   | *              |
+   |  *             |
+   |                |
+   +----------------+ */
+0x2000, 
+0x4000, 
+0xc000, 
+0x4000, 
+0x4000, 
+0x2000, 
+0x0000, 
+
+/* Character (0x7c):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |                |
+   +----------------+ */
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x0000, 
+
+/* Character (0x7d):
+   bbw=6, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   |*               |
+   | *              |
+   | **             |
+   | *              |
+   | *              |
+   |*               |
+   |                |
+   +----------------+ */
+0x8000, 
+0x4000, 
+0x6000, 
+0x4000, 
+0x4000, 
+0x8000, 
+0x0000, 
+
+/* Character (0x7e):
+   bbw=5, bbh=7, bbx=0, bby=-1, width=5
+   +----------------+
+   | * *            |
+   |* *             |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x5000, 
+0xa000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+};
+
+/* Character->glyph data. */
+static unsigned short X5x7_offset[] = {
+  0,	/* (0x00) */
+  7,	/* (0x01) */
+  14,	/* (0x02) */
+  21,	/* (0x03) */
+  28,	/* (0x04) */
+  35,	/* (0x05) */
+  42,	/* (0x06) */
+  49,	/* (0x07) */
+  56,	/* (0x08) */
+  63,	/* (0x09) */
+  70,	/* (0x0a) */
+  77,	/* (0x0b) */
+  84,	/* (0x0c) */
+  91,	/* (0x0d) */
+  98,	/* (0x0e) */
+  105,	/* (0x0f) */
+  112,	/* (0x10) */
+  119,	/* (0x11) */
+  126,	/* (0x12) */
+  133,	/* (0x13) */
+  140,	/* (0x14) */
+  147,	/* (0x15) */
+  154,	/* (0x16) */
+  161,	/* (0x17) */
+  168,	/* (0x18) */
+  175,	/* (0x19) */
+  182,	/* (0x1a) */
+  189,	/* (0x1b) */
+  196,	/* (0x1c) */
+  203,	/* (0x1d) */
+  210,	/* (0x1e) */
+  217,	/* (0x1f) */
+  224,	/* (0x20) */
+  231,	/* (0x21) */
+  238,	/* (0x22) */
+  245,	/* (0x23) */
+  252,	/* (0x24) */
+  259,	/* (0x25) */
+  266,	/* (0x26) */
+  273,	/* (0x27) */
+  280,	/* (0x28) */
+  287,	/* (0x29) */
+  294,	/* (0x2a) */
+  301,	/* (0x2b) */
+  308,	/* (0x2c) */
+  315,	/* (0x2d) */
+  322,	/* (0x2e) */
+  329,	/* (0x2f) */
+  336,	/* (0x30) */
+  343,	/* (0x31) */
+  350,	/* (0x32) */
+  357,	/* (0x33) */
+  364,	/* (0x34) */
+  371,	/* (0x35) */
+  378,	/* (0x36) */
+  385,	/* (0x37) */
+  392,	/* (0x38) */
+  399,	/* (0x39) */
+  406,	/* (0x3a) */
+  413,	/* (0x3b) */
+  420,	/* (0x3c) */
+  427,	/* (0x3d) */
+  434,	/* (0x3e) */
+  441,	/* (0x3f) */
+  448,	/* (0x40) */
+  455,	/* (0x41) */
+  462,	/* (0x42) */
+  469,	/* (0x43) */
+  476,	/* (0x44) */
+  483,	/* (0x45) */
+  490,	/* (0x46) */
+  497,	/* (0x47) */
+  504,	/* (0x48) */
+  511,	/* (0x49) */
+  518,	/* (0x4a) */
+  525,	/* (0x4b) */
+  532,	/* (0x4c) */
+  539,	/* (0x4d) */
+  546,	/* (0x4e) */
+  553,	/* (0x4f) */
+  560,	/* (0x50) */
+  567,	/* (0x51) */
+  574,	/* (0x52) */
+  581,	/* (0x53) */
+  588,	/* (0x54) */
+  595,	/* (0x55) */
+  602,	/* (0x56) */
+  609,	/* (0x57) */
+  616,	/* (0x58) */
+  623,	/* (0x59) */
+  630,	/* (0x5a) */
+  637,	/* (0x5b) */
+  644,	/* (0x5c) */
+  651,	/* (0x5d) */
+  658,	/* (0x5e) */
+  665,	/* (0x5f) */
+  672,	/* (0x60) */
+  679,	/* (0x61) */
+  686,	/* (0x62) */
+  693,	/* (0x63) */
+  700,	/* (0x64) */
+  707,	/* (0x65) */
+  714,	/* (0x66) */
+  721,	/* (0x67) */
+  728,	/* (0x68) */
+  735,	/* (0x69) */
+  742,	/* (0x6a) */
+  749,	/* (0x6b) */
+  756,	/* (0x6c) */
+  763,	/* (0x6d) */
+  770,	/* (0x6e) */
+  777,	/* (0x6f) */
+  784,	/* (0x70) */
+  791,	/* (0x71) */
+  798,	/* (0x72) */
+  805,	/* (0x73) */
+  812,	/* (0x74) */
+  819,	/* (0x75) */
+  826,	/* (0x76) */
+  833,	/* (0x77) */
+  840,	/* (0x78) */
+  847,	/* (0x79) */
+  854,	/* (0x7a) */
+  861,	/* (0x7b) */
+  868,	/* (0x7c) */
+  875,	/* (0x7d) */
+  882,	/* (0x7e) */
+};
+
+/* Character width data. */
+static unsigned char X5x7_width[] = {
+  5,	/* (0x00) */
+  5,	/* (0x01) */
+  5,	/* (0x02) */
+  5,	/* (0x03) */
+  5,	/* (0x04) */
+  5,	/* (0x05) */
+  5,	/* (0x06) */
+  5,	/* (0x07) */
+  5,	/* (0x08) */
+  5,	/* (0x09) */
+  5,	/* (0x0a) */
+  5,	/* (0x0b) */
+  5,	/* (0x0c) */
+  5,	/* (0x0d) */
+  5,	/* (0x0e) */
+  5,	/* (0x0f) */
+  5,	/* (0x10) */
+  5,	/* (0x11) */
+  5,	/* (0x12) */
+  5,	/* (0x13) */
+  5,	/* (0x14) */
+  5,	/* (0x15) */
+  5,	/* (0x16) */
+  5,	/* (0x17) */
+  5,	/* (0x18) */
+  5,	/* (0x19) */
+  5,	/* (0x1a) */
+  5,	/* (0x1b) */
+  5,	/* (0x1c) */
+  5,	/* (0x1d) */
+  5,	/* (0x1e) */
+  5,	/* (0x1f) */
+  5,	/* (0x20) */
+  5,	/* (0x21) */
+  5,	/* (0x22) */
+  5,	/* (0x23) */
+  5,	/* (0x24) */
+  5,	/* (0x25) */
+  5,	/* (0x26) */
+  5,	/* (0x27) */
+  5,	/* (0x28) */
+  5,	/* (0x29) */
+  5,	/* (0x2a) */
+  5,	/* (0x2b) */
+  5,	/* (0x2c) */
+  5,	/* (0x2d) */
+  5,	/* (0x2e) */
+  5,	/* (0x2f) */
+  5,	/* (0x30) */
+  5,	/* (0x31) */
+  5,	/* (0x32) */
+  5,	/* (0x33) */
+  5,	/* (0x34) */
+  5,	/* (0x35) */
+  5,	/* (0x36) */
+  5,	/* (0x37) */
+  5,	/* (0x38) */
+  5,	/* (0x39) */
+  5,	/* (0x3a) */
+  5,	/* (0x3b) */
+  5,	/* (0x3c) */
+  5,	/* (0x3d) */
+  5,	/* (0x3e) */
+  5,	/* (0x3f) */
+  5,	/* (0x40) */
+  5,	/* (0x41) */
+  5,	/* (0x42) */
+  5,	/* (0x43) */
+  5,	/* (0x44) */
+  5,	/* (0x45) */
+  5,	/* (0x46) */
+  5,	/* (0x47) */
+  5,	/* (0x48) */
+  5,	/* (0x49) */
+  5,	/* (0x4a) */
+  5,	/* (0x4b) */
+  5,	/* (0x4c) */
+  5,	/* (0x4d) */
+  5,	/* (0x4e) */
+  5,	/* (0x4f) */
+  5,	/* (0x50) */
+  5,	/* (0x51) */
+  5,	/* (0x52) */
+  5,	/* (0x53) */
+  5,	/* (0x54) */
+  5,	/* (0x55) */
+  5,	/* (0x56) */
+  5,	/* (0x57) */
+  5,	/* (0x58) */
+  5,	/* (0x59) */
+  5,	/* (0x5a) */
+  5,	/* (0x5b) */
+  5,	/* (0x5c) */
+  5,	/* (0x5d) */
+  5,	/* (0x5e) */
+  5,	/* (0x5f) */
+  5,	/* (0x60) */
+  5,	/* (0x61) */
+  5,	/* (0x62) */
+  5,	/* (0x63) */
+  5,	/* (0x64) */
+  5,	/* (0x65) */
+  5,	/* (0x66) */
+  5,	/* (0x67) */
+  5,	/* (0x68) */
+  5,	/* (0x69) */
+  5,	/* (0x6a) */
+  5,	/* (0x6b) */
+  5,	/* (0x6c) */
+  5,	/* (0x6d) */
+  5,	/* (0x6e) */
+  5,	/* (0x6f) */
+  5,	/* (0x70) */
+  5,	/* (0x71) */
+  5,	/* (0x72) */
+  5,	/* (0x73) */
+  5,	/* (0x74) */
+  5,	/* (0x75) */
+  5,	/* (0x76) */
+  5,	/* (0x77) */
+  5,	/* (0x78) */
+  5,	/* (0x79) */
+  5,	/* (0x7a) */
+  5,	/* (0x7b) */
+  5,	/* (0x7c) */
+  5,	/* (0x7d) */
+  5,	/* (0x7e) */
+};
+
+/* Exported structure definition. */
+MWCFONT font_X5x7 = {
+  "X5x7",
+  5,
+  7,
+  6,
+  0,
+  127,
+  X5x7_bits,
+  X5x7_offset,
+  X5x7_width,
+};
diff -urN lib/microwindows/src/fonts/X6x13.bdf /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/X6x13.bdf
--- lib/microwindows/src/fonts/X6x13.bdf	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/X6x13.bdf	2005-02-21 16:03:28.000000000 +0100
@@ -0,0 +1,3388 @@
+STARTFONT 2.1
+COMMENT  
+COMMENT  Public domain font.  Share and enjoy.
+COMMENT  
+COMMENT  WARNING:  This bdf file was generated from a font server using
+COMMENT  fstobdf.  The resulting font is subject to the same copyright,
+COMMENT  license, and trademark restrictions as the original font.  The
+COMMENT  authors and distributors of fstobdf disclaim all liability for
+COMMENT  misuse of the program or its output.
+COMMENT  
+FONT -Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO8859-1
+SIZE 12 75 75
+FONTBOUNDINGBOX 6 13 0 -2
+STARTPROPERTIES 24
+FONTNAME_REGISTRY ""
+FOUNDRY "Misc"
+FAMILY_NAME "Fixed"
+WEIGHT_NAME "Medium"
+SLANT "R"
+SETWIDTH_NAME "SemiCondensed"
+ADD_STYLE_NAME ""
+PIXEL_SIZE 13
+POINT_SIZE 120
+RESOLUTION_X 75
+RESOLUTION_Y 75
+SPACING "C"
+AVERAGE_WIDTH 60
+CHARSET_REGISTRY "ISO8859"
+CHARSET_ENCODING "1"
+COPYRIGHT "Public domain font.  Share and enjoy."
+FONT "-Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO8859-1"
+WEIGHT 10
+RESOLUTION 107
+X_HEIGHT 11
+QUAD_WIDTH 6
+DEFAULT_CHAR 0
+FONT_ASCENT 11
+FONT_DESCENT 2
+ENDPROPERTIES
+CHARS 224
+STARTCHAR C000
+ENCODING 0
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 4 11 1 -1
+BITMAP
+f0
+f0
+f0
+f0
+f0
+f0
+f0
+f0
+f0
+f0
+f0
+ENDCHAR
+STARTCHAR C001
+ENCODING 1
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 5 0 1
+BITMAP
+20
+70
+f8
+70
+20
+ENDCHAR
+STARTCHAR C002
+ENCODING 2
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 6 12 0 -2
+BITMAP
+54
+a8
+54
+a8
+54
+a8
+54
+a8
+54
+a8
+54
+a8
+ENDCHAR
+STARTCHAR C003
+ENCODING 3
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 4 9 0 -2
+BITMAP
+a0
+a0
+e0
+a0
+a0
+70
+20
+20
+20
+ENDCHAR
+STARTCHAR C004
+ENCODING 4
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 4 9 0 -2
+BITMAP
+e0
+80
+c0
+80
+f0
+40
+60
+40
+40
+ENDCHAR
+STARTCHAR C005
+ENCODING 5
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 -2
+BITMAP
+70
+80
+80
+70
+70
+48
+70
+50
+48
+ENDCHAR
+STARTCHAR C006
+ENCODING 6
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 4 9 0 -2
+BITMAP
+80
+80
+80
+e0
+70
+40
+60
+40
+40
+ENDCHAR
+STARTCHAR C007
+ENCODING 7
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 4 4 0 5
+BITMAP
+60
+90
+90
+60
+ENDCHAR
+STARTCHAR C010
+ENCODING 8
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 7 0 0
+BITMAP
+20
+20
+f8
+20
+20
+00
+f8
+ENDCHAR
+STARTCHAR C011
+ENCODING 9
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 -2
+BITMAP
+88
+c8
+a8
+98
+88
+40
+40
+40
+78
+ENDCHAR
+STARTCHAR C012
+ENCODING 10
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 -2
+BITMAP
+88
+88
+50
+20
+00
+f8
+20
+20
+20
+ENDCHAR
+STARTCHAR C013
+ENCODING 11
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 8 0 3
+BITMAP
+20
+20
+20
+20
+20
+20
+20
+e0
+ENDCHAR
+STARTCHAR C014
+ENCODING 12
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 6 0 -2
+BITMAP
+e0
+20
+20
+20
+20
+20
+ENDCHAR
+STARTCHAR C015
+ENCODING 13
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 4 6 2 -2
+BITMAP
+f0
+80
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR C016
+ENCODING 14
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 4 8 2 3
+BITMAP
+80
+80
+80
+80
+80
+80
+80
+f0
+ENDCHAR
+STARTCHAR C017
+ENCODING 15
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 6 13 0 -2
+BITMAP
+20
+20
+20
+20
+20
+20
+20
+fc
+20
+20
+20
+20
+20
+ENDCHAR
+STARTCHAR C020
+ENCODING 16
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 6 1 0 7
+BITMAP
+fc
+ENDCHAR
+STARTCHAR C021
+ENCODING 17
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 6 1 0 5
+BITMAP
+fc
+ENDCHAR
+STARTCHAR C022
+ENCODING 18
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 6 1 0 3
+BITMAP
+fc
+ENDCHAR
+STARTCHAR C023
+ENCODING 19
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 6 1 0 1
+BITMAP
+fc
+ENDCHAR
+STARTCHAR C024
+ENCODING 20
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 6 1 0 -1
+BITMAP
+fc
+ENDCHAR
+STARTCHAR C025
+ENCODING 21
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 4 13 2 -2
+BITMAP
+80
+80
+80
+80
+80
+80
+80
+f0
+80
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR C026
+ENCODING 22
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 13 0 -2
+BITMAP
+20
+20
+20
+20
+20
+20
+20
+e0
+20
+20
+20
+20
+20
+ENDCHAR
+STARTCHAR C027
+ENCODING 23
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 6 8 0 3
+BITMAP
+20
+20
+20
+20
+20
+20
+20
+fc
+ENDCHAR
+STARTCHAR C030
+ENCODING 24
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 6 6 0 -2
+BITMAP
+fc
+20
+20
+20
+20
+20
+ENDCHAR
+STARTCHAR C031
+ENCODING 25
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 1 13 2 -2
+BITMAP
+80
+80
+80
+80
+80
+80
+80
+80
+80
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR C032
+ENCODING 26
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+08
+10
+20
+40
+20
+10
+08
+f8
+ENDCHAR
+STARTCHAR C033
+ENCODING 27
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+80
+40
+20
+10
+20
+40
+80
+f8
+ENDCHAR
+STARTCHAR C034
+ENCODING 28
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+f8
+50
+50
+50
+50
+90
+ENDCHAR
+STARTCHAR C035
+ENCODING 29
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 5 0 1
+BITMAP
+08
+f8
+20
+f8
+80
+ENDCHAR
+STARTCHAR C036
+ENCODING 30
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+30
+48
+40
+40
+e0
+40
+40
+48
+b0
+ENDCHAR
+STARTCHAR C037
+ENCODING 31
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 1 1 2 2
+BITMAP
+80
+ENDCHAR
+STARTCHAR space
+ENCODING 32
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 0 0 0 0
+BITMAP
+ENDCHAR
+STARTCHAR exclam
+ENCODING 33
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 1 9 2 0
+BITMAP
+80
+80
+80
+80
+80
+80
+80
+00
+80
+ENDCHAR
+STARTCHAR quotedbl
+ENCODING 34
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 3 1 6
+BITMAP
+a0
+a0
+a0
+ENDCHAR
+STARTCHAR numbersign
+ENCODING 35
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 7 0 1
+BITMAP
+50
+50
+f8
+50
+f8
+50
+50
+ENDCHAR
+STARTCHAR dollar
+ENCODING 36
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+20
+78
+a0
+a0
+70
+28
+28
+f0
+20
+ENDCHAR
+STARTCHAR percent
+ENCODING 37
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+48
+a8
+50
+10
+20
+40
+50
+a8
+90
+ENDCHAR
+STARTCHAR ampersand
+ENCODING 38
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 8 0 1
+BITMAP
+40
+a0
+a0
+40
+a0
+98
+90
+68
+ENDCHAR
+STARTCHAR apostrophe
+ENCODING 39
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 3 1 6
+BITMAP
+60
+40
+80
+ENDCHAR
+STARTCHAR parenleft
+ENCODING 40
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 9 1 0
+BITMAP
+20
+40
+40
+80
+80
+80
+40
+40
+20
+ENDCHAR
+STARTCHAR parenright
+ENCODING 41
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 9 1 0
+BITMAP
+80
+40
+40
+20
+20
+20
+40
+40
+80
+ENDCHAR
+STARTCHAR asterisk
+ENCODING 42
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 7 0 1
+BITMAP
+20
+a8
+f8
+70
+f8
+a8
+20
+ENDCHAR
+STARTCHAR plus
+ENCODING 43
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 5 0 2
+BITMAP
+20
+20
+f8
+20
+20
+ENDCHAR
+STARTCHAR comma
+ENCODING 44
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 3 1 -1
+BITMAP
+60
+40
+80
+ENDCHAR
+STARTCHAR minus
+ENCODING 45
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 1 0 4
+BITMAP
+f8
+ENDCHAR
+STARTCHAR period
+ENCODING 46
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 3 1 -1
+BITMAP
+40
+e0
+40
+ENDCHAR
+STARTCHAR slash
+ENCODING 47
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+08
+08
+10
+10
+20
+40
+40
+80
+80
+ENDCHAR
+STARTCHAR 0
+ENCODING 48
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+20
+50
+88
+88
+88
+88
+88
+50
+20
+ENDCHAR
+STARTCHAR 1
+ENCODING 49
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+20
+60
+a0
+20
+20
+20
+20
+20
+f8
+ENDCHAR
+STARTCHAR 2
+ENCODING 50
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+70
+88
+88
+08
+10
+20
+40
+80
+f8
+ENDCHAR
+STARTCHAR 3
+ENCODING 51
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+f8
+08
+10
+20
+70
+08
+08
+88
+70
+ENDCHAR
+STARTCHAR 4
+ENCODING 52
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+10
+10
+30
+50
+50
+90
+f8
+10
+10
+ENDCHAR
+STARTCHAR 5
+ENCODING 53
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+f8
+80
+80
+b0
+c8
+08
+08
+88
+70
+ENDCHAR
+STARTCHAR 6
+ENCODING 54
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+70
+88
+80
+80
+f0
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR 7
+ENCODING 55
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+f8
+08
+10
+10
+20
+20
+40
+40
+40
+ENDCHAR
+STARTCHAR 8
+ENCODING 56
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+70
+88
+88
+88
+70
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR 9
+ENCODING 57
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+70
+88
+88
+88
+78
+08
+08
+88
+70
+ENDCHAR
+STARTCHAR colon
+ENCODING 58
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 8 1 -1
+BITMAP
+40
+e0
+40
+00
+00
+40
+e0
+40
+ENDCHAR
+STARTCHAR semicolon
+ENCODING 59
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 8 1 -1
+BITMAP
+40
+e0
+40
+00
+00
+60
+40
+80
+ENDCHAR
+STARTCHAR less
+ENCODING 60
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+08
+10
+20
+40
+80
+40
+20
+10
+08
+ENDCHAR
+STARTCHAR equal
+ENCODING 61
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 4 0 2
+BITMAP
+f8
+00
+00
+f8
+ENDCHAR
+STARTCHAR greater
+ENCODING 62
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+80
+40
+20
+10
+08
+10
+20
+40
+80
+ENDCHAR
+STARTCHAR question
+ENCODING 63
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+70
+88
+88
+08
+10
+20
+20
+00
+20
+ENDCHAR
+STARTCHAR at
+ENCODING 64
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+70
+88
+88
+98
+a8
+a8
+b0
+80
+78
+ENDCHAR
+STARTCHAR A
+ENCODING 65
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+20
+50
+88
+88
+88
+f8
+88
+88
+88
+ENDCHAR
+STARTCHAR B
+ENCODING 66
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+f0
+48
+48
+48
+70
+48
+48
+48
+f0
+ENDCHAR
+STARTCHAR C
+ENCODING 67
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+70
+88
+80
+80
+80
+80
+80
+88
+70
+ENDCHAR
+STARTCHAR D
+ENCODING 68
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+f0
+48
+48
+48
+48
+48
+48
+48
+f0
+ENDCHAR
+STARTCHAR E
+ENCODING 69
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+f8
+80
+80
+80
+f0
+80
+80
+80
+f8
+ENDCHAR
+STARTCHAR F
+ENCODING 70
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+f8
+80
+80
+80
+f0
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR G
+ENCODING 71
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+70
+88
+80
+80
+80
+98
+88
+88
+70
+ENDCHAR
+STARTCHAR H
+ENCODING 72
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+88
+88
+88
+88
+f8
+88
+88
+88
+88
+ENDCHAR
+STARTCHAR I
+ENCODING 73
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 9 1 0
+BITMAP
+e0
+40
+40
+40
+40
+40
+40
+40
+e0
+ENDCHAR
+STARTCHAR J
+ENCODING 74
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+38
+10
+10
+10
+10
+10
+10
+90
+60
+ENDCHAR
+STARTCHAR K
+ENCODING 75
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+88
+88
+90
+a0
+c0
+a0
+90
+88
+88
+ENDCHAR
+STARTCHAR L
+ENCODING 76
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+80
+80
+80
+80
+80
+80
+80
+80
+f8
+ENDCHAR
+STARTCHAR M
+ENCODING 77
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+88
+88
+d8
+a8
+a8
+88
+88
+88
+88
+ENDCHAR
+STARTCHAR N
+ENCODING 78
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+88
+c8
+c8
+a8
+a8
+98
+98
+88
+88
+ENDCHAR
+STARTCHAR O
+ENCODING 79
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+70
+88
+88
+88
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR P
+ENCODING 80
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+f0
+88
+88
+88
+f0
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR Q
+ENCODING 81
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 -1
+BITMAP
+70
+88
+88
+88
+88
+88
+88
+a8
+70
+08
+ENDCHAR
+STARTCHAR R
+ENCODING 82
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+f0
+88
+88
+88
+f0
+a0
+90
+88
+88
+ENDCHAR
+STARTCHAR S
+ENCODING 83
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+70
+88
+80
+80
+70
+08
+08
+88
+70
+ENDCHAR
+STARTCHAR T
+ENCODING 84
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+f8
+20
+20
+20
+20
+20
+20
+20
+20
+ENDCHAR
+STARTCHAR U
+ENCODING 85
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+88
+88
+88
+88
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR V
+ENCODING 86
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+88
+88
+88
+88
+50
+50
+50
+20
+20
+ENDCHAR
+STARTCHAR W
+ENCODING 87
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+88
+88
+88
+88
+a8
+a8
+a8
+d8
+88
+ENDCHAR
+STARTCHAR X
+ENCODING 88
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+88
+88
+50
+50
+20
+50
+50
+88
+88
+ENDCHAR
+STARTCHAR Y
+ENCODING 89
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+88
+88
+50
+50
+20
+20
+20
+20
+20
+ENDCHAR
+STARTCHAR Z
+ENCODING 90
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+f8
+08
+10
+10
+20
+40
+40
+80
+f8
+ENDCHAR
+STARTCHAR bracketleft
+ENCODING 91
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 9 1 0
+BITMAP
+e0
+80
+80
+80
+80
+80
+80
+80
+e0
+ENDCHAR
+STARTCHAR backslash
+ENCODING 92
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+80
+80
+40
+40
+20
+10
+10
+08
+08
+ENDCHAR
+STARTCHAR bracketright
+ENCODING 93
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 9 1 0
+BITMAP
+e0
+20
+20
+20
+20
+20
+20
+20
+e0
+ENDCHAR
+STARTCHAR asciicircum
+ENCODING 94
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 3 0 6
+BITMAP
+20
+50
+88
+ENDCHAR
+STARTCHAR underscore
+ENCODING 95
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 1 0 -1
+BITMAP
+f8
+ENDCHAR
+STARTCHAR grave
+ENCODING 96
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 3 2 6
+BITMAP
+c0
+40
+20
+ENDCHAR
+STARTCHAR a
+ENCODING 97
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+70
+08
+78
+88
+88
+78
+ENDCHAR
+STARTCHAR b
+ENCODING 98
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+80
+80
+80
+f0
+88
+88
+88
+88
+f0
+ENDCHAR
+STARTCHAR c
+ENCODING 99
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+70
+88
+80
+80
+88
+70
+ENDCHAR
+STARTCHAR d
+ENCODING 100
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+08
+08
+08
+78
+88
+88
+88
+88
+78
+ENDCHAR
+STARTCHAR e
+ENCODING 101
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+70
+88
+f8
+80
+88
+70
+ENDCHAR
+STARTCHAR f
+ENCODING 102
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+30
+48
+40
+40
+f0
+40
+40
+40
+40
+ENDCHAR
+STARTCHAR g
+ENCODING 103
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 8 0 -2
+BITMAP
+70
+88
+88
+88
+78
+08
+88
+70
+ENDCHAR
+STARTCHAR h
+ENCODING 104
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+80
+80
+80
+b0
+c8
+88
+88
+88
+88
+ENDCHAR
+STARTCHAR i
+ENCODING 105
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 8 1 0
+BITMAP
+40
+00
+c0
+40
+40
+40
+40
+e0
+ENDCHAR
+STARTCHAR j
+ENCODING 106
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 4 10 0 -2
+BITMAP
+10
+00
+30
+10
+10
+10
+10
+90
+90
+60
+ENDCHAR
+STARTCHAR k
+ENCODING 107
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+80
+80
+80
+90
+a0
+c0
+a0
+90
+88
+ENDCHAR
+STARTCHAR l
+ENCODING 108
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 9 1 0
+BITMAP
+c0
+40
+40
+40
+40
+40
+40
+40
+e0
+ENDCHAR
+STARTCHAR m
+ENCODING 109
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+d0
+a8
+a8
+a8
+a8
+88
+ENDCHAR
+STARTCHAR n
+ENCODING 110
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+b0
+c8
+88
+88
+88
+88
+ENDCHAR
+STARTCHAR o
+ENCODING 111
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+70
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR p
+ENCODING 112
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 8 0 -2
+BITMAP
+f0
+88
+88
+88
+f0
+80
+80
+80
+ENDCHAR
+STARTCHAR q
+ENCODING 113
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 8 0 -2
+BITMAP
+78
+88
+88
+88
+78
+08
+08
+08
+ENDCHAR
+STARTCHAR r
+ENCODING 114
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+b0
+c8
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR s
+ENCODING 115
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+70
+88
+60
+10
+88
+70
+ENDCHAR
+STARTCHAR t
+ENCODING 116
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+40
+40
+f0
+40
+40
+40
+48
+30
+ENDCHAR
+STARTCHAR u
+ENCODING 117
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+88
+88
+88
+88
+98
+68
+ENDCHAR
+STARTCHAR v
+ENCODING 118
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+88
+88
+88
+50
+50
+20
+ENDCHAR
+STARTCHAR w
+ENCODING 119
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+88
+88
+a8
+a8
+a8
+50
+ENDCHAR
+STARTCHAR x
+ENCODING 120
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+88
+50
+20
+20
+50
+88
+ENDCHAR
+STARTCHAR y
+ENCODING 121
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 8 0 -2
+BITMAP
+88
+88
+88
+98
+68
+08
+88
+70
+ENDCHAR
+STARTCHAR z
+ENCODING 122
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+f8
+10
+20
+40
+80
+f8
+ENDCHAR
+STARTCHAR braceleft
+ENCODING 123
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+18
+20
+20
+20
+c0
+20
+20
+20
+18
+ENDCHAR
+STARTCHAR bar
+ENCODING 124
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 1 9 2 0
+BITMAP
+80
+80
+80
+80
+80
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR braceright
+ENCODING 125
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+c0
+20
+20
+20
+18
+20
+20
+20
+c0
+ENDCHAR
+STARTCHAR asciitilde
+ENCODING 126
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 3 0 6
+BITMAP
+48
+a8
+90
+ENDCHAR
+STARTCHAR C177
+ENCODING 127
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 0 0 0 0
+BITMAP
+ENDCHAR
+STARTCHAR nobreakspace
+ENCODING 160
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 0 0 0 0
+BITMAP
+ENDCHAR
+STARTCHAR exclamdown
+ENCODING 161
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 1 9 2 0
+BITMAP
+80
+00
+80
+80
+80
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR cent
+ENCODING 162
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 8 0 1
+BITMAP
+20
+70
+a8
+a0
+a0
+a8
+70
+20
+ENDCHAR
+STARTCHAR sterling
+ENCODING 163
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+30
+48
+40
+40
+e0
+40
+40
+48
+b0
+ENDCHAR
+STARTCHAR currency
+ENCODING 164
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 1
+BITMAP
+88
+70
+50
+50
+70
+88
+ENDCHAR
+STARTCHAR yen
+ENCODING 165
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+88
+88
+50
+50
+f8
+20
+f8
+20
+20
+ENDCHAR
+STARTCHAR brokenbar
+ENCODING 166
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 1 9 2 0
+BITMAP
+80
+80
+80
+80
+00
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR section
+ENCODING 167
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 4 10 1 0
+BITMAP
+60
+90
+80
+60
+90
+90
+60
+10
+90
+60
+ENDCHAR
+STARTCHAR diaeresis
+ENCODING 168
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 1 0 8
+BITMAP
+d8
+ENDCHAR
+STARTCHAR copyright
+ENCODING 169
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 1
+BITMAP
+70
+88
+a8
+d8
+c8
+d8
+a8
+88
+70
+ENDCHAR
+STARTCHAR ordfeminine
+ENCODING 170
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 7 0 2
+BITMAP
+70
+08
+78
+88
+78
+00
+f8
+ENDCHAR
+STARTCHAR guillemotleft
+ENCODING 171
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 1
+BITMAP
+28
+50
+a0
+a0
+50
+28
+ENDCHAR
+STARTCHAR notsign
+ENCODING 172
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 3 0 2
+BITMAP
+f8
+08
+08
+ENDCHAR
+STARTCHAR hyphen
+ENCODING 173
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 1 0 4
+BITMAP
+f8
+ENDCHAR
+STARTCHAR registered
+ENCODING 174
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 1
+BITMAP
+70
+88
+e8
+d8
+d8
+e8
+d8
+88
+70
+ENDCHAR
+STARTCHAR macron
+ENCODING 175
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 1 0 8
+BITMAP
+f8
+ENDCHAR
+STARTCHAR degree
+ENCODING 176
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 4 4 1 5
+BITMAP
+60
+90
+90
+60
+ENDCHAR
+STARTCHAR plusminus
+ENCODING 177
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 7 0 1
+BITMAP
+20
+20
+f8
+20
+20
+00
+f8
+ENDCHAR
+STARTCHAR twosuperior
+ENCODING 178
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 5 0 5
+BITMAP
+40
+a0
+20
+40
+e0
+ENDCHAR
+STARTCHAR threesuperior
+ENCODING 179
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 5 0 5
+BITMAP
+40
+a0
+40
+20
+c0
+ENDCHAR
+STARTCHAR acute
+ENCODING 180
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 2 2 2 8
+BITMAP
+40
+80
+ENDCHAR
+STARTCHAR mu
+ENCODING 181
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 7 0 -1
+BITMAP
+88
+88
+88
+88
+98
+e8
+80
+ENDCHAR
+STARTCHAR paragraph
+ENCODING 182
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+78
+e8
+e8
+e8
+e8
+68
+28
+28
+28
+ENDCHAR
+STARTCHAR periodcentered
+ENCODING 183
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 2 1 2 4
+BITMAP
+c0
+ENDCHAR
+STARTCHAR cedilla
+ENCODING 184
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 2 2 2 -2
+BITMAP
+40
+80
+ENDCHAR
+STARTCHAR onesuperior
+ENCODING 185
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 3 5 0 5
+BITMAP
+40
+c0
+40
+40
+e0
+ENDCHAR
+STARTCHAR masculine
+ENCODING 186
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 4 6 1 3
+BITMAP
+60
+90
+90
+60
+00
+f0
+ENDCHAR
+STARTCHAR guillemotright
+ENCODING 187
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 1
+BITMAP
+a0
+50
+28
+28
+50
+a0
+ENDCHAR
+STARTCHAR onequarter
+ENCODING 188
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+40
+c0
+40
+40
+e0
+08
+18
+28
+38
+08
+ENDCHAR
+STARTCHAR onehalf
+ENCODING 189
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+40
+c0
+40
+40
+e0
+10
+28
+08
+10
+38
+ENDCHAR
+STARTCHAR threequarters
+ENCODING 190
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+40
+a0
+40
+20
+a0
+48
+18
+28
+38
+08
+ENDCHAR
+STARTCHAR questiondown
+ENCODING 191
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+20
+00
+20
+20
+40
+80
+88
+88
+70
+ENDCHAR
+STARTCHAR Agrave
+ENCODING 192
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+20
+10
+00
+20
+50
+88
+88
+f8
+88
+88
+ENDCHAR
+STARTCHAR Aacute
+ENCODING 193
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+10
+20
+00
+20
+50
+88
+88
+f8
+88
+88
+ENDCHAR
+STARTCHAR Acircumflex
+ENCODING 194
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+30
+48
+00
+20
+50
+88
+88
+f8
+88
+88
+ENDCHAR
+STARTCHAR Atilde
+ENCODING 195
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+28
+50
+00
+20
+50
+88
+88
+f8
+88
+88
+ENDCHAR
+STARTCHAR Adiaeresis
+ENCODING 196
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+50
+50
+00
+20
+50
+88
+88
+f8
+88
+88
+ENDCHAR
+STARTCHAR Aring
+ENCODING 197
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+20
+50
+20
+20
+50
+88
+88
+f8
+88
+88
+ENDCHAR
+STARTCHAR AE
+ENCODING 198
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+58
+a0
+a0
+a0
+b0
+e0
+a0
+a0
+b8
+ENDCHAR
+STARTCHAR Ccedilla
+ENCODING 199
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 11 0 -2
+BITMAP
+70
+88
+80
+80
+80
+80
+80
+88
+70
+20
+40
+ENDCHAR
+STARTCHAR Egrave
+ENCODING 200
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+20
+10
+00
+f8
+80
+80
+f0
+80
+80
+f8
+ENDCHAR
+STARTCHAR Eacute
+ENCODING 201
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+10
+20
+00
+f8
+80
+80
+f0
+80
+80
+f8
+ENDCHAR
+STARTCHAR Ecircumflex
+ENCODING 202
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+60
+90
+00
+f8
+80
+80
+f0
+80
+80
+f8
+ENDCHAR
+STARTCHAR Ediaeresis
+ENCODING 203
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+50
+50
+00
+f8
+80
+80
+f0
+80
+80
+f8
+ENDCHAR
+STARTCHAR Igrave
+ENCODING 204
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+20
+10
+00
+f8
+20
+20
+20
+20
+20
+f8
+ENDCHAR
+STARTCHAR Iacute
+ENCODING 205
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+10
+20
+00
+f8
+20
+20
+20
+20
+20
+f8
+ENDCHAR
+STARTCHAR Icircumflex
+ENCODING 206
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+30
+48
+00
+f8
+20
+20
+20
+20
+20
+f8
+ENDCHAR
+STARTCHAR Idiaeresis
+ENCODING 207
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+50
+50
+00
+f8
+20
+20
+20
+20
+20
+f8
+ENDCHAR
+STARTCHAR ETH
+ENCODING 208
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+f0
+48
+48
+48
+e8
+48
+48
+48
+f0
+ENDCHAR
+STARTCHAR Ntilde
+ENCODING 209
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+28
+50
+00
+88
+88
+c8
+a8
+98
+88
+88
+ENDCHAR
+STARTCHAR Ograve
+ENCODING 210
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+20
+10
+00
+70
+88
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR Oacute
+ENCODING 211
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+10
+20
+00
+70
+88
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR Ocircumflex
+ENCODING 212
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+30
+48
+00
+70
+88
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR Otilde
+ENCODING 213
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+28
+50
+00
+70
+88
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR Odiaeresis
+ENCODING 214
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+50
+50
+00
+70
+88
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR multiply
+ENCODING 215
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 5 0 1
+BITMAP
+88
+50
+20
+50
+88
+ENDCHAR
+STARTCHAR Ooblique
+ENCODING 216
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 11 0 -1
+BITMAP
+08
+70
+98
+98
+a8
+a8
+a8
+c8
+c8
+70
+80
+ENDCHAR
+STARTCHAR Ugrave
+ENCODING 217
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+20
+10
+00
+88
+88
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR Uacute
+ENCODING 218
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+10
+20
+00
+88
+88
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR Ucircumflex
+ENCODING 219
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+30
+48
+00
+88
+88
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR Udiaeresis
+ENCODING 220
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+50
+50
+00
+88
+88
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR Yacute
+ENCODING 221
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+10
+20
+00
+88
+88
+50
+20
+20
+20
+20
+ENDCHAR
+STARTCHAR THORN
+ENCODING 222
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+80
+f0
+88
+88
+88
+f0
+80
+80
+80
+ENDCHAR
+STARTCHAR ssharp
+ENCODING 223
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 9 0 -1
+BITMAP
+70
+88
+88
+f0
+88
+88
+c8
+b0
+80
+ENDCHAR
+STARTCHAR agrave
+ENCODING 224
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+20
+10
+00
+00
+70
+08
+78
+88
+98
+68
+ENDCHAR
+STARTCHAR aacute
+ENCODING 225
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+10
+20
+00
+00
+70
+08
+78
+88
+98
+68
+ENDCHAR
+STARTCHAR acircumflex
+ENCODING 226
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+30
+48
+00
+00
+70
+08
+78
+88
+98
+68
+ENDCHAR
+STARTCHAR atilde
+ENCODING 227
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+28
+50
+00
+00
+70
+08
+78
+88
+98
+68
+ENDCHAR
+STARTCHAR adiaeresis
+ENCODING 228
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+50
+50
+00
+00
+70
+08
+78
+88
+98
+68
+ENDCHAR
+STARTCHAR aring
+ENCODING 229
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+30
+48
+30
+00
+70
+08
+78
+88
+98
+68
+ENDCHAR
+STARTCHAR ae
+ENCODING 230
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+70
+28
+70
+a0
+a8
+50
+ENDCHAR
+STARTCHAR ccedilla
+ENCODING 231
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 8 0 -2
+BITMAP
+70
+88
+80
+80
+88
+70
+20
+40
+ENDCHAR
+STARTCHAR egrave
+ENCODING 232
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+20
+10
+00
+00
+70
+88
+f8
+80
+88
+70
+ENDCHAR
+STARTCHAR eacute
+ENCODING 233
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+10
+20
+00
+00
+70
+88
+f8
+80
+88
+70
+ENDCHAR
+STARTCHAR ecircumflex
+ENCODING 234
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+30
+48
+00
+00
+70
+88
+f8
+80
+88
+70
+ENDCHAR
+STARTCHAR ediaeresis
+ENCODING 235
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+50
+50
+00
+00
+70
+88
+f8
+80
+88
+70
+ENDCHAR
+STARTCHAR igrave
+ENCODING 236
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+20
+10
+00
+00
+60
+20
+20
+20
+20
+f8
+ENDCHAR
+STARTCHAR iacute
+ENCODING 237
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+10
+20
+00
+00
+60
+20
+20
+20
+20
+f8
+ENDCHAR
+STARTCHAR icircumflex
+ENCODING 238
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+30
+48
+00
+00
+60
+20
+20
+20
+20
+f8
+ENDCHAR
+STARTCHAR idiaeresis
+ENCODING 239
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+50
+50
+00
+00
+60
+20
+20
+20
+20
+f8
+ENDCHAR
+STARTCHAR eth
+ENCODING 240
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+50
+20
+60
+10
+70
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR ntilde
+ENCODING 241
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+28
+50
+00
+00
+b0
+c8
+88
+88
+88
+88
+ENDCHAR
+STARTCHAR ograve
+ENCODING 242
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+20
+10
+00
+00
+70
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR oacute
+ENCODING 243
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+10
+20
+00
+00
+70
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR ocircumflex
+ENCODING 244
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+30
+48
+00
+00
+70
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR otilde
+ENCODING 245
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+28
+50
+00
+00
+70
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR odiaeresis
+ENCODING 246
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+50
+50
+00
+00
+70
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR division
+ENCODING 247
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 7 0 1
+BITMAP
+20
+20
+00
+f8
+00
+20
+20
+ENDCHAR
+STARTCHAR oslash
+ENCODING 248
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 8 0 -1
+BITMAP
+08
+70
+98
+a8
+a8
+c8
+70
+80
+ENDCHAR
+STARTCHAR ugrave
+ENCODING 249
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+20
+10
+00
+00
+88
+88
+88
+88
+88
+78
+ENDCHAR
+STARTCHAR uacute
+ENCODING 250
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+10
+20
+00
+00
+88
+88
+88
+88
+88
+78
+ENDCHAR
+STARTCHAR ucircumflex
+ENCODING 251
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+30
+48
+00
+00
+88
+88
+88
+88
+88
+78
+ENDCHAR
+STARTCHAR udiaeresis
+ENCODING 252
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+50
+50
+00
+00
+88
+88
+88
+88
+88
+78
+ENDCHAR
+STARTCHAR yacute
+ENCODING 253
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 12 0 -2
+BITMAP
+10
+20
+00
+00
+88
+88
+88
+98
+68
+08
+88
+70
+ENDCHAR
+STARTCHAR thorn
+ENCODING 254
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 10 0 -2
+BITMAP
+80
+80
+b0
+c8
+88
+88
+c8
+b0
+80
+80
+ENDCHAR
+STARTCHAR ydiaeresis
+ENCODING 255
+SWIDTH 480 0
+DWIDTH 6 0
+BBX 5 12 0 -2
+BITMAP
+50
+50
+00
+00
+88
+88
+88
+98
+68
+08
+88
+70
+ENDCHAR
+ENDFONT
diff -urN lib/microwindows/src/fonts/X6x13.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/X6x13.c
--- lib/microwindows/src/fonts/X6x13.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/X6x13.c	2005-02-21 16:03:28.000000000 +0100
@@ -0,0 +1,4226 @@
+/* Generated by convbdf on Tue Oct  3 00:24:25 MDT 2000. */
+#include "device.h"
+
+/* Font information:
+
+   name: "-Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO8859-1"
+   pixel size: 13
+   ascent: 11
+   descent: 2
+*/
+
+/* Font character bitmap data. */
+static MWIMAGEBITS X6x13_bits[] = {
+
+/* Character (0x00):
+   bbw=4, bbh=11, bbx=1, bby=-1, width=6
+   +----------------+
+   |                |
+   | ****           |
+   | ****           |
+   | ****           |
+   | ****           |
+   | ****           |
+   | ****           |
+   | ****           |
+   | ****           |
+   | ****           |
+   | ****           |
+   | ****           |
+   |                |
+   +----------------+ */
+0x0000, 
+0x7800, 
+0x7800, 
+0x7800, 
+0x7800, 
+0x7800, 
+0x7800, 
+0x7800, 
+0x7800, 
+0x7800, 
+0x7800, 
+0x7800, 
+0x0000, 
+
+/* Character (0x01):
+   bbw=5, bbh=5, bbx=0, bby=1, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |  *             |
+   | ***            |
+   |*****           |
+   | ***            |
+   |  *             |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x2000, 
+0x7000, 
+0xf800, 
+0x7000, 
+0x2000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x02):
+   bbw=6, bbh=12, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   | * * *          |
+   |* * *           |
+   | * * *          |
+   |* * *           |
+   | * * *          |
+   |* * *           |
+   | * * *          |
+   |* * *           |
+   | * * *          |
+   |* * *           |
+   | * * *          |
+   |* * *           |
+   +----------------+ */
+0x0000, 
+0x5400, 
+0xa800, 
+0x5400, 
+0xa800, 
+0x5400, 
+0xa800, 
+0x5400, 
+0xa800, 
+0x5400, 
+0xa800, 
+0x5400, 
+0xa800, 
+
+/* Character (0x03):
+   bbw=4, bbh=9, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |* *             |
+   |* *             |
+   |***             |
+   |* *             |
+   |* *             |
+   | ***            |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xa000, 
+0xa000, 
+0xe000, 
+0xa000, 
+0xa000, 
+0x7000, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x04):
+   bbw=4, bbh=9, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |***             |
+   |*               |
+   |**              |
+   |*               |
+   |****            |
+   | *              |
+   | **             |
+   | *              |
+   | *              |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xe000, 
+0x8000, 
+0xc000, 
+0x8000, 
+0xf000, 
+0x4000, 
+0x6000, 
+0x4000, 
+0x4000, 
+
+/* Character (0x05):
+   bbw=5, bbh=9, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ***            |
+   |*               |
+   |*               |
+   | ***            |
+   | ***            |
+   | *  *           |
+   | ***            |
+   | * *            |
+   | *  *           |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7000, 
+0x8000, 
+0x8000, 
+0x7000, 
+0x7000, 
+0x4800, 
+0x7000, 
+0x5000, 
+0x4800, 
+
+/* Character (0x06):
+   bbw=4, bbh=9, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |*               |
+   |*               |
+   |*               |
+   |***             |
+   | ***            |
+   | *              |
+   | **             |
+   | *              |
+   | *              |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0xe000, 
+0x7000, 
+0x4000, 
+0x6000, 
+0x4000, 
+0x4000, 
+
+/* Character (0x07):
+   bbw=4, bbh=4, bbx=0, bby=5, width=6
+   +----------------+
+   |                |
+   |                |
+   | **             |
+   |*  *            |
+   |*  *            |
+   | **             |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6000, 
+0x9000, 
+0x9000, 
+0x6000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x08):
+   bbw=5, bbh=7, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |  *             |
+   |  *             |
+   |*****           |
+   |  *             |
+   |  *             |
+   |                |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x2000, 
+0x2000, 
+0xf800, 
+0x2000, 
+0x2000, 
+0x0000, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x09):
+   bbw=5, bbh=9, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |*   *           |
+   |**  *           |
+   |* * *           |
+   |*  **           |
+   |*   *           |
+   | *              |
+   | *              |
+   | *              |
+   | ****           |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x8800, 
+0xc800, 
+0xa800, 
+0x9800, 
+0x8800, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x7800, 
+
+/* Character (0x0a):
+   bbw=5, bbh=9, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |*   *           |
+   |*   *           |
+   | * *            |
+   |  *             |
+   |                |
+   |*****           |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x8800, 
+0x8800, 
+0x5000, 
+0x2000, 
+0x0000, 
+0xf800, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x0b):
+   bbw=3, bbh=8, bbx=0, bby=3, width=6
+   +----------------+
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |***             |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0xe000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x0c):
+   bbw=3, bbh=6, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |***             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xe000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x0d):
+   bbw=4, bbh=6, bbx=2, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |  ****          |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x3c00, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x0e):
+   bbw=4, bbh=8, bbx=2, bby=3, width=6
+   +----------------+
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  ****          |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x3c00, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x0f):
+   bbw=6, bbh=13, bbx=0, bby=-2, width=6
+   +----------------+
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |******          |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0xfc00, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x10):
+   bbw=6, bbh=1, bbx=0, bby=7, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |******          |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0xfc00, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x11):
+   bbw=6, bbh=1, bbx=0, bby=5, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |******          |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xfc00, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x12):
+   bbw=6, bbh=1, bbx=0, bby=3, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |******          |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xfc00, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x13):
+   bbw=6, bbh=1, bbx=0, bby=1, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |******          |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xfc00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x14):
+   bbw=6, bbh=1, bbx=0, bby=-1, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |******          |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xfc00, 
+0x0000, 
+
+/* Character (0x15):
+   bbw=4, bbh=13, bbx=2, bby=-2, width=6
+   +----------------+
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  ****          |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x3c00, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x16):
+   bbw=3, bbh=13, bbx=0, bby=-2, width=6
+   +----------------+
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |***             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0xe000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x17):
+   bbw=6, bbh=8, bbx=0, bby=3, width=6
+   +----------------+
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |******          |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0xfc00, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x18):
+   bbw=6, bbh=6, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |******          |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xfc00, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x19):
+   bbw=1, bbh=13, bbx=2, bby=-2, width=6
+   +----------------+
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   +----------------+ */
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+
+/* Character (0x1a):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |    *           |
+   |   *            |
+   |  *             |
+   | *              |
+   |  *             |
+   |   *            |
+   |    *           |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0800, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x2000, 
+0x1000, 
+0x0800, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x1b):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |*               |
+   | *              |
+   |  *             |
+   |   *            |
+   |  *             |
+   | *              |
+   |*               |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x8000, 
+0x4000, 
+0x2000, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x8000, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x1c):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |*****           |
+   | * *            |
+   | * *            |
+   | * *            |
+   | * *            |
+   |*  *            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xf800, 
+0x5000, 
+0x5000, 
+0x5000, 
+0x5000, 
+0x9000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x1d):
+   bbw=5, bbh=5, bbx=0, bby=1, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |    *           |
+   |*****           |
+   |  *             |
+   |*****           |
+   |*               |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0800, 
+0xf800, 
+0x2000, 
+0xf800, 
+0x8000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x1e):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |  **            |
+   | *  *           |
+   | *              |
+   | *              |
+   |***             |
+   | *              |
+   | *              |
+   | *  *           |
+   |* **            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3000, 
+0x4800, 
+0x4000, 
+0x4000, 
+0xe000, 
+0x4000, 
+0x4000, 
+0x4800, 
+0xb000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x1f):
+   bbw=1, bbh=1, bbx=2, bby=2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |  *             |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x2000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x20):
+   bbw=0, bbh=0, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x21):
+   bbw=1, bbh=9, bbx=2, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |                |
+   |  *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x0000, 
+0x2000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x22):
+   bbw=3, bbh=3, bbx=1, bby=6, width=6
+   +----------------+
+   |                |
+   |                |
+   | * *            |
+   | * *            |
+   | * *            |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x5000, 
+0x5000, 
+0x5000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x23):
+   bbw=5, bbh=7, bbx=0, bby=1, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   | * *            |
+   | * *            |
+   |*****           |
+   | * *            |
+   |*****           |
+   | * *            |
+   | * *            |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x5000, 
+0x5000, 
+0xf800, 
+0x5000, 
+0xf800, 
+0x5000, 
+0x5000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x24):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   | ****           |
+   |* *             |
+   |* *             |
+   | ***            |
+   |  * *           |
+   |  * *           |
+   |****            |
+   |  *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x7800, 
+0xa000, 
+0xa000, 
+0x7000, 
+0x2800, 
+0x2800, 
+0xf000, 
+0x2000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x25):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | *  *           |
+   |* * *           |
+   | * *            |
+   |   *            |
+   |  *             |
+   | *              |
+   | * *            |
+   |* * *           |
+   |*  *            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4800, 
+0xa800, 
+0x5000, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x5000, 
+0xa800, 
+0x9000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x26):
+   bbw=5, bbh=8, bbx=0, bby=1, width=6
+   +----------------+
+   |                |
+   |                |
+   | *              |
+   |* *             |
+   |* *             |
+   | *              |
+   |* *             |
+   |*  **           |
+   |*  *            |
+   | ** *           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4000, 
+0xa000, 
+0xa000, 
+0x4000, 
+0xa000, 
+0x9800, 
+0x9000, 
+0x6800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x27):
+   bbw=3, bbh=3, bbx=1, bby=6, width=6
+   +----------------+
+   |                |
+   |                |
+   |  **            |
+   |  *             |
+   | *              |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3000, 
+0x2000, 
+0x4000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x28):
+   bbw=3, bbh=9, bbx=1, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |   *            |
+   |  *             |
+   |  *             |
+   | *              |
+   | *              |
+   | *              |
+   |  *             |
+   |  *             |
+   |   *            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1000, 
+0x2000, 
+0x2000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x2000, 
+0x2000, 
+0x1000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x29):
+   bbw=3, bbh=9, bbx=1, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | *              |
+   |  *             |
+   |  *             |
+   |   *            |
+   |   *            |
+   |   *            |
+   |  *             |
+   |  *             |
+   | *              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4000, 
+0x2000, 
+0x2000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x2000, 
+0x2000, 
+0x4000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2a):
+   bbw=5, bbh=7, bbx=0, bby=1, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |  *             |
+   |* * *           |
+   |*****           |
+   | ***            |
+   |*****           |
+   |* * *           |
+   |  *             |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x2000, 
+0xa800, 
+0xf800, 
+0x7000, 
+0xf800, 
+0xa800, 
+0x2000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2b):
+   bbw=5, bbh=5, bbx=0, bby=2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |  *             |
+   |  *             |
+   |*****           |
+   |  *             |
+   |  *             |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x2000, 
+0x2000, 
+0xf800, 
+0x2000, 
+0x2000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2c):
+   bbw=3, bbh=3, bbx=1, bby=-1, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |  **            |
+   |  *             |
+   | *              |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x3000, 
+0x2000, 
+0x4000, 
+0x0000, 
+
+/* Character (0x2d):
+   bbw=5, bbh=1, bbx=0, bby=4, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |*****           |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xf800, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2e):
+   bbw=3, bbh=3, bbx=1, bby=-1, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |  *             |
+   | ***            |
+   |  *             |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x2000, 
+0x7000, 
+0x2000, 
+0x0000, 
+
+/* Character (0x2f):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |    *           |
+   |    *           |
+   |   *            |
+   |   *            |
+   |  *             |
+   | *              |
+   | *              |
+   |*               |
+   |*               |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0800, 
+0x0800, 
+0x1000, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x4000, 
+0x8000, 
+0x8000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x30):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   | * *            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | * *            |
+   |  *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x5000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x5000, 
+0x2000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x31):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   | **             |
+   |* *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x6000, 
+0xa000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x32):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*   *           |
+   |    *           |
+   |   *            |
+   |  *             |
+   | *              |
+   |*               |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8800, 
+0x0800, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x8000, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x33):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |    *           |
+   |   *            |
+   |  *             |
+   | ***            |
+   |    *           |
+   |    *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0x0800, 
+0x1000, 
+0x2000, 
+0x7000, 
+0x0800, 
+0x0800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x34):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |   *            |
+   |   *            |
+   |  **            |
+   | * *            |
+   | * *            |
+   |*  *            |
+   |*****           |
+   |   *            |
+   |   *            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1000, 
+0x1000, 
+0x3000, 
+0x5000, 
+0x5000, 
+0x9000, 
+0xf800, 
+0x1000, 
+0x1000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x35):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |*               |
+   |*               |
+   |* **            |
+   |**  *           |
+   |    *           |
+   |    *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0x8000, 
+0x8000, 
+0xb000, 
+0xc800, 
+0x0800, 
+0x0800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x36):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*               |
+   |*               |
+   |****            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8000, 
+0x8000, 
+0xf000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x37):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |    *           |
+   |   *            |
+   |   *            |
+   |  *             |
+   |  *             |
+   | *              |
+   | *              |
+   | *              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0x0800, 
+0x1000, 
+0x1000, 
+0x2000, 
+0x2000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x38):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | ***            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x7000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x39):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | ****           |
+   |    *           |
+   |    *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x7800, 
+0x0800, 
+0x0800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3a):
+   bbw=3, bbh=8, bbx=1, bby=-1, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |  *             |
+   | ***            |
+   |  *             |
+   |                |
+   |                |
+   |  *             |
+   | ***            |
+   |  *             |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x2000, 
+0x7000, 
+0x2000, 
+0x0000, 
+0x0000, 
+0x2000, 
+0x7000, 
+0x2000, 
+0x0000, 
+
+/* Character (0x3b):
+   bbw=3, bbh=8, bbx=1, bby=-1, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |  *             |
+   | ***            |
+   |  *             |
+   |                |
+   |                |
+   |  **            |
+   |  *             |
+   | *              |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x2000, 
+0x7000, 
+0x2000, 
+0x0000, 
+0x0000, 
+0x3000, 
+0x2000, 
+0x4000, 
+0x0000, 
+
+/* Character (0x3c):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |    *           |
+   |   *            |
+   |  *             |
+   | *              |
+   |*               |
+   | *              |
+   |  *             |
+   |   *            |
+   |    *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0800, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x8000, 
+0x4000, 
+0x2000, 
+0x1000, 
+0x0800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3d):
+   bbw=5, bbh=4, bbx=0, bby=2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |*****           |
+   |                |
+   |                |
+   |*****           |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xf800, 
+0x0000, 
+0x0000, 
+0xf800, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3e):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   | *              |
+   |  *             |
+   |   *            |
+   |    *           |
+   |   *            |
+   |  *             |
+   | *              |
+   |*               |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0x4000, 
+0x2000, 
+0x1000, 
+0x0800, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x8000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3f):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*   *           |
+   |    *           |
+   |   *            |
+   |  *             |
+   |  *             |
+   |                |
+   |  *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8800, 
+0x0800, 
+0x1000, 
+0x2000, 
+0x2000, 
+0x0000, 
+0x2000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x40):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*   *           |
+   |*  **           |
+   |* * *           |
+   |* * *           |
+   |* **            |
+   |*               |
+   | ****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8800, 
+0x9800, 
+0xa800, 
+0xa800, 
+0xb000, 
+0x8000, 
+0x7800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x41):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   | * *            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*****           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x5000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0xf800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x42):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |****            |
+   | *  *           |
+   | *  *           |
+   | *  *           |
+   | ***            |
+   | *  *           |
+   | *  *           |
+   | *  *           |
+   |****            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf000, 
+0x4800, 
+0x4800, 
+0x4800, 
+0x7000, 
+0x4800, 
+0x4800, 
+0x4800, 
+0xf000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x43):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x44):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |****            |
+   | *  *           |
+   | *  *           |
+   | *  *           |
+   | *  *           |
+   | *  *           |
+   | *  *           |
+   | *  *           |
+   |****            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf000, 
+0x4800, 
+0x4800, 
+0x4800, 
+0x4800, 
+0x4800, 
+0x4800, 
+0x4800, 
+0xf000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x45):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |*               |
+   |*               |
+   |*               |
+   |****            |
+   |*               |
+   |*               |
+   |*               |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0x8000, 
+0x8000, 
+0x8000, 
+0xf000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x46):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |*               |
+   |*               |
+   |*               |
+   |****            |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0x8000, 
+0x8000, 
+0x8000, 
+0xf000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x47):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*               |
+   |*               |
+   |*               |
+   |*  **           |
+   |*   *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x9800, 
+0x8800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x48):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*****           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0xf800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x49):
+   bbw=3, bbh=9, bbx=1, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4a):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |  ***           |
+   |   *            |
+   |   *            |
+   |   *            |
+   |   *            |
+   |   *            |
+   |   *            |
+   |*  *            |
+   | **             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3800, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x9000, 
+0x6000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4b):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*   *           |
+   |*   *           |
+   |*  *            |
+   |* *             |
+   |**              |
+   |* *             |
+   |*  *            |
+   |*   *           |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8800, 
+0x8800, 
+0x9000, 
+0xa000, 
+0xc000, 
+0xa000, 
+0x9000, 
+0x8800, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4c):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4d):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*   *           |
+   |*   *           |
+   |** **           |
+   |* * *           |
+   |* * *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8800, 
+0x8800, 
+0xd800, 
+0xa800, 
+0xa800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4e):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*   *           |
+   |**  *           |
+   |**  *           |
+   |* * *           |
+   |* * *           |
+   |*  **           |
+   |*  **           |
+   |*   *           |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8800, 
+0xc800, 
+0xc800, 
+0xa800, 
+0xa800, 
+0x9800, 
+0x9800, 
+0x8800, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4f):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x50):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |****            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |****            |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0xf000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x51):
+   bbw=5, bbh=10, bbx=0, bby=-1, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |* * *           |
+   | ***            |
+   |    *           |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0xa800, 
+0x7000, 
+0x0800, 
+0x0000, 
+
+/* Character (0x52):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |****            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |****            |
+   |* *             |
+   |*  *            |
+   |*   *           |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0xf000, 
+0xa000, 
+0x9000, 
+0x8800, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x53):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*               |
+   |*               |
+   | ***            |
+   |    *           |
+   |    *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8000, 
+0x8000, 
+0x7000, 
+0x0800, 
+0x0800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x54):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x55):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x56):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | * *            |
+   | * *            |
+   | * *            |
+   |  *             |
+   |  *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x5000, 
+0x5000, 
+0x5000, 
+0x2000, 
+0x2000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x57):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |* * *           |
+   |* * *           |
+   |* * *           |
+   |** **           |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0xa800, 
+0xa800, 
+0xa800, 
+0xd800, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x58):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*   *           |
+   |*   *           |
+   | * *            |
+   | * *            |
+   |  *             |
+   | * *            |
+   | * *            |
+   |*   *           |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8800, 
+0x8800, 
+0x5000, 
+0x5000, 
+0x2000, 
+0x5000, 
+0x5000, 
+0x8800, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x59):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*   *           |
+   |*   *           |
+   | * *            |
+   | * *            |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8800, 
+0x8800, 
+0x5000, 
+0x5000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5a):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |    *           |
+   |   *            |
+   |   *            |
+   |  *             |
+   | *              |
+   | *              |
+   |*               |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0x0800, 
+0x1000, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x4000, 
+0x8000, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5b):
+   bbw=3, bbh=9, bbx=1, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5c):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   |*               |
+   | *              |
+   | *              |
+   |  *             |
+   |   *            |
+   |   *            |
+   |    *           |
+   |    *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0x8000, 
+0x4000, 
+0x4000, 
+0x2000, 
+0x1000, 
+0x1000, 
+0x0800, 
+0x0800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5d):
+   bbw=3, bbh=9, bbx=1, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |   *            |
+   |   *            |
+   |   *            |
+   |   *            |
+   |   *            |
+   |   *            |
+   |   *            |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5e):
+   bbw=5, bbh=3, bbx=0, bby=6, width=6
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   | * *            |
+   |*   *           |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x5000, 
+0x8800, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5f):
+   bbw=5, bbh=1, bbx=0, bby=-1, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |*****           |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xf800, 
+0x0000, 
+
+/* Character (0x60):
+   bbw=3, bbh=3, bbx=2, bby=6, width=6
+   +----------------+
+   |                |
+   |                |
+   |  **            |
+   |   *            |
+   |    *           |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3000, 
+0x1000, 
+0x0800, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x61):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | ***            |
+   |    *           |
+   | ****           |
+   |*   *           |
+   |*   *           |
+   | ****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7000, 
+0x0800, 
+0x7800, 
+0x8800, 
+0x8800, 
+0x7800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x62):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   |*               |
+   |*               |
+   |****            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |****            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0xf000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0xf000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x63):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*               |
+   |*               |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8000, 
+0x8000, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x64):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |    *           |
+   |    *           |
+   |    *           |
+   | ****           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | ****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0800, 
+0x0800, 
+0x0800, 
+0x7800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x7800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x65):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*****           |
+   |*               |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0xf800, 
+0x8000, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x66):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |  **            |
+   | *  *           |
+   | *              |
+   | *              |
+   |****            |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3000, 
+0x4800, 
+0x4000, 
+0x4000, 
+0xf000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x67):
+   bbw=5, bbh=8, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | ****           |
+   |    *           |
+   |*   *           |
+   | ***            |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x7800, 
+0x0800, 
+0x8800, 
+0x7000, 
+
+/* Character (0x68):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   |*               |
+   |*               |
+   |* **            |
+   |**  *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0xb000, 
+0xc800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x69):
+   bbw=3, bbh=8, bbx=1, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |  *             |
+   |                |
+   | **             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x2000, 
+0x0000, 
+0x6000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6a):
+   bbw=4, bbh=10, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |   *            |
+   |                |
+   |  **            |
+   |   *            |
+   |   *            |
+   |   *            |
+   |   *            |
+   |*  *            |
+   |*  *            |
+   | **             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x1000, 
+0x0000, 
+0x3000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x9000, 
+0x9000, 
+0x6000, 
+
+/* Character (0x6b):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   |*               |
+   |*               |
+   |*  *            |
+   |* *             |
+   |**              |
+   |* *             |
+   |*  *            |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x9000, 
+0xa000, 
+0xc000, 
+0xa000, 
+0x9000, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6c):
+   bbw=3, bbh=9, bbx=1, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | **             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6d):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |** *            |
+   |* * *           |
+   |* * *           |
+   |* * *           |
+   |* * *           |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xd000, 
+0xa800, 
+0xa800, 
+0xa800, 
+0xa800, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6e):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |* **            |
+   |**  *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xb000, 
+0xc800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6f):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x70):
+   bbw=5, bbh=8, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |****            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |****            |
+   |*               |
+   |*               |
+   |*               |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xf000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0xf000, 
+0x8000, 
+0x8000, 
+0x8000, 
+
+/* Character (0x71):
+   bbw=5, bbh=8, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | ****           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | ****           |
+   |    *           |
+   |    *           |
+   |    *           |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x7800, 
+0x0800, 
+0x0800, 
+0x0800, 
+
+/* Character (0x72):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |* **            |
+   |**  *           |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xb000, 
+0xc800, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x73):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   | **             |
+   |   *            |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x6000, 
+0x1000, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x74):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   | *              |
+   | *              |
+   |****            |
+   | *              |
+   | *              |
+   | *              |
+   | *  *           |
+   |  **            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x4000, 
+0x4000, 
+0xf000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4800, 
+0x3000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x75):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*  **           |
+   | ** *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x9800, 
+0x6800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x76):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | * *            |
+   | * *            |
+   |  *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x5000, 
+0x5000, 
+0x2000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x77):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |*   *           |
+   |*   *           |
+   |* * *           |
+   |* * *           |
+   |* * *           |
+   | * *            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x8800, 
+0x8800, 
+0xa800, 
+0xa800, 
+0xa800, 
+0x5000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x78):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |*   *           |
+   | * *            |
+   |  *             |
+   |  *             |
+   | * *            |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x8800, 
+0x5000, 
+0x2000, 
+0x2000, 
+0x5000, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x79):
+   bbw=5, bbh=8, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*  **           |
+   | ** *           |
+   |    *           |
+   |*   *           |
+   | ***            |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x9800, 
+0x6800, 
+0x0800, 
+0x8800, 
+0x7000, 
+
+/* Character (0x7a):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |*****           |
+   |   *            |
+   |  *             |
+   | *              |
+   |*               |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xf800, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x8000, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x7b):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |   **           |
+   |  *             |
+   |  *             |
+   |  *             |
+   |**              |
+   |  *             |
+   |  *             |
+   |  *             |
+   |   **           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1800, 
+0x2000, 
+0x2000, 
+0x2000, 
+0xc000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x1800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x7c):
+   bbw=1, bbh=9, bbx=2, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x7d):
+   bbw=5, bbh=9, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |  *             |
+   |  *             |
+   |  *             |
+   |   **           |
+   |  *             |
+   |  *             |
+   |  *             |
+   |**              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x1800, 
+0x2000, 
+0x2000, 
+0x2000, 
+0xc000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x7e):
+   bbw=5, bbh=3, bbx=0, bby=6, width=6
+   +----------------+
+   |                |
+   |                |
+   | *  *           |
+   |* * *           |
+   |*  *            |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4800, 
+0xa800, 
+0x9000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+};
+
+/* Character->glyph data. */
+static unsigned short X6x13_offset[] = {
+  0,	/* (0x00) */
+  13,	/* (0x01) */
+  26,	/* (0x02) */
+  39,	/* (0x03) */
+  52,	/* (0x04) */
+  65,	/* (0x05) */
+  78,	/* (0x06) */
+  91,	/* (0x07) */
+  104,	/* (0x08) */
+  117,	/* (0x09) */
+  130,	/* (0x0a) */
+  143,	/* (0x0b) */
+  156,	/* (0x0c) */
+  169,	/* (0x0d) */
+  182,	/* (0x0e) */
+  195,	/* (0x0f) */
+  208,	/* (0x10) */
+  221,	/* (0x11) */
+  234,	/* (0x12) */
+  247,	/* (0x13) */
+  260,	/* (0x14) */
+  273,	/* (0x15) */
+  286,	/* (0x16) */
+  299,	/* (0x17) */
+  312,	/* (0x18) */
+  325,	/* (0x19) */
+  338,	/* (0x1a) */
+  351,	/* (0x1b) */
+  364,	/* (0x1c) */
+  377,	/* (0x1d) */
+  390,	/* (0x1e) */
+  403,	/* (0x1f) */
+  416,	/* (0x20) */
+  429,	/* (0x21) */
+  442,	/* (0x22) */
+  455,	/* (0x23) */
+  468,	/* (0x24) */
+  481,	/* (0x25) */
+  494,	/* (0x26) */
+  507,	/* (0x27) */
+  520,	/* (0x28) */
+  533,	/* (0x29) */
+  546,	/* (0x2a) */
+  559,	/* (0x2b) */
+  572,	/* (0x2c) */
+  585,	/* (0x2d) */
+  598,	/* (0x2e) */
+  611,	/* (0x2f) */
+  624,	/* (0x30) */
+  637,	/* (0x31) */
+  650,	/* (0x32) */
+  663,	/* (0x33) */
+  676,	/* (0x34) */
+  689,	/* (0x35) */
+  702,	/* (0x36) */
+  715,	/* (0x37) */
+  728,	/* (0x38) */
+  741,	/* (0x39) */
+  754,	/* (0x3a) */
+  767,	/* (0x3b) */
+  780,	/* (0x3c) */
+  793,	/* (0x3d) */
+  806,	/* (0x3e) */
+  819,	/* (0x3f) */
+  832,	/* (0x40) */
+  845,	/* (0x41) */
+  858,	/* (0x42) */
+  871,	/* (0x43) */
+  884,	/* (0x44) */
+  897,	/* (0x45) */
+  910,	/* (0x46) */
+  923,	/* (0x47) */
+  936,	/* (0x48) */
+  949,	/* (0x49) */
+  962,	/* (0x4a) */
+  975,	/* (0x4b) */
+  988,	/* (0x4c) */
+  1001,	/* (0x4d) */
+  1014,	/* (0x4e) */
+  1027,	/* (0x4f) */
+  1040,	/* (0x50) */
+  1053,	/* (0x51) */
+  1066,	/* (0x52) */
+  1079,	/* (0x53) */
+  1092,	/* (0x54) */
+  1105,	/* (0x55) */
+  1118,	/* (0x56) */
+  1131,	/* (0x57) */
+  1144,	/* (0x58) */
+  1157,	/* (0x59) */
+  1170,	/* (0x5a) */
+  1183,	/* (0x5b) */
+  1196,	/* (0x5c) */
+  1209,	/* (0x5d) */
+  1222,	/* (0x5e) */
+  1235,	/* (0x5f) */
+  1248,	/* (0x60) */
+  1261,	/* (0x61) */
+  1274,	/* (0x62) */
+  1287,	/* (0x63) */
+  1300,	/* (0x64) */
+  1313,	/* (0x65) */
+  1326,	/* (0x66) */
+  1339,	/* (0x67) */
+  1352,	/* (0x68) */
+  1365,	/* (0x69) */
+  1378,	/* (0x6a) */
+  1391,	/* (0x6b) */
+  1404,	/* (0x6c) */
+  1417,	/* (0x6d) */
+  1430,	/* (0x6e) */
+  1443,	/* (0x6f) */
+  1456,	/* (0x70) */
+  1469,	/* (0x71) */
+  1482,	/* (0x72) */
+  1495,	/* (0x73) */
+  1508,	/* (0x74) */
+  1521,	/* (0x75) */
+  1534,	/* (0x76) */
+  1547,	/* (0x77) */
+  1560,	/* (0x78) */
+  1573,	/* (0x79) */
+  1586,	/* (0x7a) */
+  1599,	/* (0x7b) */
+  1612,	/* (0x7c) */
+  1625,	/* (0x7d) */
+  1638,	/* (0x7e) */
+};
+
+/* Character width data. */
+static unsigned char X6x13_width[] = {
+  6,	/* (0x00) */
+  6,	/* (0x01) */
+  6,	/* (0x02) */
+  6,	/* (0x03) */
+  6,	/* (0x04) */
+  6,	/* (0x05) */
+  6,	/* (0x06) */
+  6,	/* (0x07) */
+  6,	/* (0x08) */
+  6,	/* (0x09) */
+  6,	/* (0x0a) */
+  6,	/* (0x0b) */
+  6,	/* (0x0c) */
+  6,	/* (0x0d) */
+  6,	/* (0x0e) */
+  6,	/* (0x0f) */
+  6,	/* (0x10) */
+  6,	/* (0x11) */
+  6,	/* (0x12) */
+  6,	/* (0x13) */
+  6,	/* (0x14) */
+  6,	/* (0x15) */
+  6,	/* (0x16) */
+  6,	/* (0x17) */
+  6,	/* (0x18) */
+  6,	/* (0x19) */
+  6,	/* (0x1a) */
+  6,	/* (0x1b) */
+  6,	/* (0x1c) */
+  6,	/* (0x1d) */
+  6,	/* (0x1e) */
+  6,	/* (0x1f) */
+  6,	/* (0x20) */
+  6,	/* (0x21) */
+  6,	/* (0x22) */
+  6,	/* (0x23) */
+  6,	/* (0x24) */
+  6,	/* (0x25) */
+  6,	/* (0x26) */
+  6,	/* (0x27) */
+  6,	/* (0x28) */
+  6,	/* (0x29) */
+  6,	/* (0x2a) */
+  6,	/* (0x2b) */
+  6,	/* (0x2c) */
+  6,	/* (0x2d) */
+  6,	/* (0x2e) */
+  6,	/* (0x2f) */
+  6,	/* (0x30) */
+  6,	/* (0x31) */
+  6,	/* (0x32) */
+  6,	/* (0x33) */
+  6,	/* (0x34) */
+  6,	/* (0x35) */
+  6,	/* (0x36) */
+  6,	/* (0x37) */
+  6,	/* (0x38) */
+  6,	/* (0x39) */
+  6,	/* (0x3a) */
+  6,	/* (0x3b) */
+  6,	/* (0x3c) */
+  6,	/* (0x3d) */
+  6,	/* (0x3e) */
+  6,	/* (0x3f) */
+  6,	/* (0x40) */
+  6,	/* (0x41) */
+  6,	/* (0x42) */
+  6,	/* (0x43) */
+  6,	/* (0x44) */
+  6,	/* (0x45) */
+  6,	/* (0x46) */
+  6,	/* (0x47) */
+  6,	/* (0x48) */
+  6,	/* (0x49) */
+  6,	/* (0x4a) */
+  6,	/* (0x4b) */
+  6,	/* (0x4c) */
+  6,	/* (0x4d) */
+  6,	/* (0x4e) */
+  6,	/* (0x4f) */
+  6,	/* (0x50) */
+  6,	/* (0x51) */
+  6,	/* (0x52) */
+  6,	/* (0x53) */
+  6,	/* (0x54) */
+  6,	/* (0x55) */
+  6,	/* (0x56) */
+  6,	/* (0x57) */
+  6,	/* (0x58) */
+  6,	/* (0x59) */
+  6,	/* (0x5a) */
+  6,	/* (0x5b) */
+  6,	/* (0x5c) */
+  6,	/* (0x5d) */
+  6,	/* (0x5e) */
+  6,	/* (0x5f) */
+  6,	/* (0x60) */
+  6,	/* (0x61) */
+  6,	/* (0x62) */
+  6,	/* (0x63) */
+  6,	/* (0x64) */
+  6,	/* (0x65) */
+  6,	/* (0x66) */
+  6,	/* (0x67) */
+  6,	/* (0x68) */
+  6,	/* (0x69) */
+  6,	/* (0x6a) */
+  6,	/* (0x6b) */
+  6,	/* (0x6c) */
+  6,	/* (0x6d) */
+  6,	/* (0x6e) */
+  6,	/* (0x6f) */
+  6,	/* (0x70) */
+  6,	/* (0x71) */
+  6,	/* (0x72) */
+  6,	/* (0x73) */
+  6,	/* (0x74) */
+  6,	/* (0x75) */
+  6,	/* (0x76) */
+  6,	/* (0x77) */
+  6,	/* (0x78) */
+  6,	/* (0x79) */
+  6,	/* (0x7a) */
+  6,	/* (0x7b) */
+  6,	/* (0x7c) */
+  6,	/* (0x7d) */
+  6,	/* (0x7e) */
+};
+
+/* Exported structure definition. */
+MWCFONT font_X6x13 = {
+  "X6x13",
+  6,
+  13,
+  11,
+  0,
+  127,
+  X6x13_bits,
+  X6x13_offset,
+  X6x13_width,
+};
diff -urN lib/microwindows/src/fonts/bdftobogl /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/bdftobogl
--- lib/microwindows/src/fonts/bdftobogl	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/bdftobogl	2005-02-21 16:03:24.000000000 +0100
@@ -0,0 +1,119 @@
+#! /usr/bin/perl -w
+
+use POSIX;
+
+if ($#ARGV < 0) {
+    print "Usage: bdftobogl font.bdf > font.c\n";
+    exit -1;
+}
+
+$file = $ARGV[0];
+
+$font = $file;
+$font =~ s/\.bdf//;
+$font =~ tr/a-zA-Z0-9_/_/cs;
+
+print "/* Generated by bdftobogl on ", substr(`date`, 0, -1), ". */\n";
+print "#include \"bogl.h\"\n\n";
+
+open BDF, "<$file" || die;
+while (<BDF>) {
+    chop;
+    $pixel_size = $1 if /^PIXEL_SIZE (\d+)$/;
+    $font_ascent = $1 if /^FONT_ASCENT (\d+)$/;
+    $font_descent = $1 if /^FONT_DESCENT (\d+)$/;
+    $font_name = $1 if /^FONT (.*)$/;
+    $default_char = $1 if /^DEFAULT_CHAR (\d+)$/;
+    
+    last if /^CHARS /;
+}
+
+print "/* Font information:\n\n";
+print "   name: $font_name\n";
+print "   pixel size: $pixel_size\n";
+print "   ascent: $font_ascent\n";
+print "   descent: $font_descent\n";
+print "*/\n\n";
+
+print "/* Font character content data. */\n";
+print "static unsigned long ${font}_content[] = {\n";
+
+$pixel_size = $font_ascent + $font_descent;
+$ofs = 0;
+$maxwidth = 0;
+while (<BDF>) {
+    chop;
+    undef $encoding, undef $width, undef $bbx, undef $bby, undef $bbw, undef $bbh if /^STARTCHAR /;
+    $encoding = $1 if /^ENCODING (\d+)/;
+    $width = $1 if /^DWIDTH (-?\d+)/;
+    ($bbw, $bbh, $bbx, $bby) = ($1, $2, $3, $4) if /^BBX (-?\d+) (-?\d+) (-?\d+) (-?\d+)/;
+
+    if (/^BITMAP$/) {
+	next if !defined $encoding;
+	$encoding_tab[$encoding] = $ofs;
+	$width -= $bbx, $bbx = 0 if $bbx < 0;
+	$width[$encoding] = $width;
+	$maxwidth = $width if $width > $maxwidth;
+	for (my $i = 0; $i < $pixel_size; $i++) {
+	    $bm[$i] = 0;
+	}
+	for (my $i = 0; ; $i++) {
+	    $_ = <BDF>;
+	    chop;
+	    last if /^ENDCHAR$/;
+	
+	    $value = hex($_);
+	    $bm[$pixel_size - $font_descent - $bby - $bbh + $i] = $value << (32 - 4 * length($_) - $bbx);
+	}
+
+	printf "\n/* Character %c (0x%02x):\n", $encoding, $encoding;
+	print "   bbw=$bbw, bbh=$bbh, bbx=$bbx, bby=$bby, width=$width\n";
+	print "   +", ("-" x 32), "+\n";
+	for (my $i = 0; $i < $pixel_size; $i++) {
+	    print "   |";
+	    for ($j = 31; $j >= 0; $j--) {
+		print $bm[$i] & (1 << $j) ? "*" : " ";
+	    }
+	    print "|\n";
+	}
+	print "   +", ("-" x 32), "+ */\n";
+
+	for (my $i = 0; $i < $pixel_size; $i++) {
+	    $ofs++;
+	    printf "0x%08x,\n", $bm[$i];
+	}
+    }
+}
+
+print "};\n\n";
+
+#print STDERR "Maximum character width=$maxwidth\n";
+
+print "/* Character->glyph data. */\n";
+print "static short ${font}_ofs[256] = {\n";
+for (my $i = 0; $i < 256; $i++) {
+    my $char = $i;
+    my $ofs = $encoding_tab[$i];
+    $ofs = $encoding_tab[$default_char], $char = $default_char if !defined $ofs;
+    printf "  $ofs,\t/* %c (0x%02x) */\n", $char, $i;
+}
+print "};\n\n";
+
+print "/* Character width data. */\n";
+print "static unsigned char ${font}_width[256] = {\n";
+for (my $i = 0; $i < 256; $i++) {
+    my $char = $i;
+    my $width = $width[$i];
+    $width = $width[$default_char], $char = $default_char if !defined $encoding_tab[$i];
+    printf "  $width,\t/* %c (0x%02x) */\n", $char, $i;
+}
+print "};\n\n";
+
+print "/* Exported structure definition. */\n";
+print "const struct bogl_font font_${font} = {\n";
+print "  \"$font\",\n";
+print "  $pixel_size,\n";
+print "  ${font}_content,\n";
+print "  ${font}_ofs,\n";
+print "  ${font}_width,\n";
+print "};\n";
diff -urN lib/microwindows/src/fonts/convbdf /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convbdf
--- lib/microwindows/src/fonts/convbdf	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convbdf	2005-02-21 16:03:24.000000000 +0100
@@ -0,0 +1,166 @@
+#! /usr/bin/perl -w
+#
+# Convert BDF files to nano-X font files
+# modified by G Haerr from bdftobogl for 16 bit MWIMAGEBITS
+# modified on 2/10/00 by K Harris to accept any size input character
+# modified on 3/26/00 by G Haerr added ascent field, fixed $IMAGE_BITS
+# originally from BOGL - Ben's Own Graphics Library <pfaffben@debian.org>.
+#
+
+use POSIX;
+
+if ($#ARGV < 0) {
+    print "Usage: convbdf font.bdf > font.c\n";
+    exit -1;
+}
+
+$LAST_CHAR = 0x7e;
+$IMAGE_BITS = 16;
+$IMAGE_NIBBLES = $IMAGE_BITS/4;
+$IMAGE_MASK = 0xffff;
+
+$file = $ARGV[0];
+
+$font = $file;
+$font =~ s/\.bdf//;
+$font =~ tr/a-zA-Z0-9_/_/cs;
+
+print "/* Generated by convbdf on ", substr(`date`, 0, -1), ". */\n";
+print "#include \"device.h\"\n\n";
+
+open BDF, "<$file" || die;
+while (<BDF>) {
+    chop;
+    $pixel_size = $1 if /^PIXEL_SIZE (\d+)$/;
+    $font_ascent = $1 if /^FONT_ASCENT (\d+)$/;
+    $font_descent = $1 if /^FONT_DESCENT (\d+)$/;
+    $font_name = $1 if /^FONT (.*)$/;
+    $default_char = $1 if /^DEFAULT_CHAR (\d+)$/;
+    
+    last if /^CHARS /;
+}
+
+print "/* Font information:\n\n";
+print "   name: $font_name\n";
+print "   pixel size: $pixel_size\n";
+print "   ascent: $font_ascent\n";
+print "   descent: $font_descent\n";
+print "*/\n\n";
+
+print "/* Font character bitmap data. */\n";
+print "static MWIMAGEBITS ${font}_bits[] = {\n";
+
+$ch_height = $font_ascent + $font_descent;
+$ofs = 0;
+$maxwidth = 0;
+$firstchar = -1;
+while (<BDF>) {
+    chop;
+    undef $encoding, undef $width, undef $bbx, undef $bby, undef $bbw, undef $bbh if /^STARTCHAR /;
+    $encoding = $1 if /^ENCODING (\d+)/;
+	 last if defined $encoding && $encoding > $LAST_CHAR;
+    $width = $1 if /^DWIDTH (-?\d+)/;
+    ($bbw, $bbh, $bbx, $bby) = ($1, $2, $3, $4) if /^BBX (-?\d+) (-?\d+) (-?\d+) (-?\d+)/;
+
+   if (/^BITMAP$/) {
+		next if !defined $encoding;
+		$firstchar = $encoding if $firstchar < 0;
+		$encoding_tab[$encoding] = $ofs;
+		$width -= $bbx, $bbx = 0 if $bbx < 0;
+		$width[$encoding] = $width;
+		$maxwidth = $width if $width > $maxwidth;
+		$ch_words  = int (($width+$IMAGE_BITS-1)/$IMAGE_BITS);
+		$ch_bits   = $ch_words*$IMAGE_BITS;
+		for (my $i = 0; $i < $ch_height; $i++) {
+			for (my $k = 0; $k < $ch_words; $k++) {
+	    		$bm[$i][$k] = 0;
+			}
+		}
+		for (my $i = 0; ; $i++) {
+	    	$_ = <BDF>;
+	    	chop;
+	    	last if /^ENDCHAR$/;
+		
+		   @hexnibbles = split //,$_;
+			for (my $k=0; $k<$ch_words; $k++) {
+			   $ndx = $k*$IMAGE_NIBBLES;
+				$padnibbles = @hexnibbles - $ndx;
+				last if $padnibbles <= 0; # if bbx pushes bits into next word
+												 # and no more bits from bdf file
+				$padnibbles = 0 if $padnibbles >= $IMAGE_NIBBLES;
+			   $value = hex join '',@hexnibbles[$ndx..($ndx+$IMAGE_NIBBLES-1-$padnibbles)];
+	   		$value = $value << ($padnibbles*$IMAGE_NIBBLES);	
+	   		$bm[$ch_height - $font_descent - $bby - $bbh + $i][$k] |= 
+						$value >> ($bbx);	
+				if ($bbx) {	# handle overflow into next image_word
+	   			$bm[$ch_height - $font_descent - $bby - $bbh + $i][$k+1] =
+						($value << ($IMAGE_BITS - $bbx)) & $IMAGE_MASK;	
+				}
+			}
+		}
+	
+###		printf "\n/* Character %c (0x%02x):\n", $encoding, $encoding;
+		printf "\n/* Character (0x%02x):\n", $encoding;
+		print "   bbw=$bbw, bbh=$bbh, bbx=$bbx, bby=$bby, width=$width\n";
+		print "   +", ("-" x $ch_bits), "+\n";
+		for (my $i = 0; $i < $ch_height; $i++) {
+			print "   |";
+			for (my $k = 0; $k < $ch_words; $k++) {
+	   		for (my $j = $IMAGE_BITS - 1; $j >= 0; $j--) {
+					print $bm[$i][$k] & (1 << $j) ? "*" : " ";
+	   		}
+			}
+	   	print "|\n";
+		}
+		print "   +", ("-" x $ch_bits), "+ */\n";
+	
+		for (my $i = 0; $i < $ch_height; $i++) {
+			for ($k=0; $k<$ch_words; $k++) {
+   			$ofs++;
+	   		printf "0x%04x, ", $bm[$i][$k];
+			}
+	   	printf "\n";
+		}
+   }
+}
+
+print "};\n\n";
+
+#print STDERR "Maximum character width=$maxwidth\n";
+
+print "/* Character->glyph data. */\n";
+print "static unsigned short ${font}_offset[] = {\n";
+for (my $i = $firstchar; $i <= $LAST_CHAR; $i++) {
+    my $char = $i;
+    my $ofs = $encoding_tab[$i];
+    $ofs = $encoding_tab[$default_char], $char = $default_char if !defined $ofs;
+### printf "  $ofs,\t/* %c (0x%02x) */\n", $char, $i;
+    printf "  $ofs,\t/* (0x%02x) */\n", $i;
+}
+print "};\n\n";
+
+print "/* Character width data. */\n";
+print "static unsigned char ${font}_width[] = {\n";
+for (my $i = $firstchar; $i <= $LAST_CHAR; $i++) {
+    my $char = $i;
+    my $width = $width[$i];
+    $width = $width[$default_char], $char = $default_char if !defined $encoding_tab[$i];
+### printf "  $width,\t/* %c (0x%02x) */\n", $char, $i;
+    printf "  $width,\t/* (0x%02x) */\n", $i;
+}
+print "};\n\n";
+
+$size = $LAST_CHAR - $firstchar + 1;
+
+print "/* Exported structure definition. */\n";
+print "MWCFONT font_${font} = {\n";
+print "  \"$font\",\n";
+print "  $maxwidth,\n";
+print "  $ch_height,\n";
+print "  $font_ascent,\n";
+print "  $firstchar,\n";
+print "  $size,\n";
+print "  ${font}_bits,\n";
+print "  ${font}_offset,\n";
+print "  ${font}_width,\n";
+print "};\n";
diff -urN lib/microwindows/src/fonts/convfnt.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convfnt.c
--- lib/microwindows/src/fonts/convfnt.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convfnt.c	2005-02-21 16:13:17.000000000 +0100
@@ -0,0 +1,420 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * MS Windows Font Grabber for Micro-Windows
+ *
+ * Usage: convfnt32 [1|2|3|4|<fontname>]
+ *
+ * Note: a Microsoft License is required to use MS Fonts
+ */
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <util.h>
+
+#define MAX_CHAR_HEIGHT	16	/* max character height*/
+typedef unsigned short	IMAGEBITS;	/* bitmap image unit size*/
+
+/* IMAGEBITS macros*/
+#define	IMAGE_SIZE(width, height)  ((height) * (((width) + sizeof(IMAGEBITS) * 8 - 1) / (sizeof(IMAGEBITS) * 8)))
+#define IMAGE_WORDS(x)		(((x)+15)/16)
+#define	IMAGE_BITSPERIMAGE	(sizeof(IMAGEBITS) * 8)
+#define	IMAGE_FIRSTBIT		((IMAGEBITS) 0x8000)
+#define	IMAGE_NEXTBIT(m)	((IMAGEBITS) ((m) >> 1))
+#define	IMAGE_TESTBIT(m)	((m) & IMAGE_FIRSTBIT)	  /* use with shiftbit*/
+#define	IMAGE_SHIFTBIT(m)	((IMAGEBITS) ((m) << 1))  /* for testbit*/
+
+/* global data*/
+HINSTANCE	ghInstance;
+char 		APPWINCLASS[] = "convfnt";
+int 		CHAR_WIDTH;
+int 		CHAR_HEIGHT;
+int		CHAR_ASCENT;
+char 		fontname[64];
+FILE *		fp;
+HFONT		hfont;
+int 		FIRST_CHAR = ' ';
+int 		LAST_CHAR = 256;
+int 		curoff = 0;
+int 		offsets[256];
+int 		widths[256];
+
+
+/* forward decls*/
+LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wp,LPARAM lp);
+
+HWND InitApp(void);
+int  InitClasses(void);
+void doit(HDC hdc);
+void convfnt(HDC hdc);
+void print_char(int ch,IMAGEBITS *b, int w, int h);
+void print_bits(IMAGEBITS *bits, int width, int height);
+HFONT WINAPI GetFont(HDC hDC, LPSTR fontName,int fontSize,int fontStyle);
+HFONT WINAPI GetFontEx(HDC hDC, LPSTR fontName,int fontSize,int fontStyle,
+		int charset);
+
+int WINAPI 
+WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
+	int nShowCmd)
+{
+	MSG		msg;
+	HDC		hdc;
+	int		i;
+	char *	q;
+	char	arg[80];
+
+	ghInstance = hInstance;
+	InitClasses();
+	InitApp();
+
+	i = atoi(lpCmdLine);
+	hdc = GetDC(NULL);
+	switch(i) {
+	case 0:
+		if(*lpCmdLine == 0)
+			lpCmdLine = "MS Sans Serif";
+		q = arg;
+		for(q=arg; *lpCmdLine; ++lpCmdLine) {
+			if(*lpCmdLine == '"' || *lpCmdLine == '\'')
+				continue;
+			*q++ = *lpCmdLine;
+		}
+		*q = 0;
+		hfont = GetFont(hdc, arg, 8, 0);
+		break;
+	case 1:
+		hfont = GetStockObject(DEFAULT_GUI_FONT);	// winMSSansSerif11x13
+		break;
+	case 2:
+		hfont = GetStockObject(SYSTEM_FONT);		// winSystem14x16
+		break;
+	case 3:
+		hfont = GetStockObject(OEM_FIXED_FONT);	// winTerminal8x12
+		break;
+	case 4:
+		hfont = GetStockObject(ANSI_VAR_FONT);	// winMSSansSerif11x13
+		break;
+	}
+	ReleaseDC(NULL, hdc);
+
+	while(GetMessage(&msg, NULL, 0, 0)) {
+		TranslateMessage(&msg);
+		DispatchMessage(&msg);
+	}
+	return 0;
+}
+
+int
+InitClasses(void)
+{
+	WNDCLASS	wc;
+
+	wc.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW;
+	wc.lpfnWndProc = (WNDPROC)WndProc;
+	wc.cbClsExtra = 0;
+	wc.cbWndExtra = 0;
+	wc.hInstance = ghInstance;
+	wc.hIcon = LoadIcon(ghInstance, MAKEINTRESOURCE( 1));
+	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+	wc.hbrBackground = GetStockObject(LTGRAY_BRUSH);
+	wc.lpszMenuName = NULL;
+	wc.lpszClassName =  APPWINCLASS;
+	return RegisterClass( &wc);
+}
+
+HWND
+InitApp(void)
+{
+	HWND	hwnd;
+
+	hwnd = CreateWindowEx( 0L, APPWINCLASS,
+		"Font Grabber",
+		WS_OVERLAPPEDWINDOW,
+		CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+		NULL,
+		NULL,
+		ghInstance,
+		NULL);
+
+	if( hwnd == NULL)
+		return( 0);
+
+	ShowWindow( hwnd, SW_SHOW);
+	return hwnd;
+}
+
+
+LRESULT CALLBACK
+WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
+{
+	PAINTSTRUCT		ps;
+	HDC				hdc;
+	LOGFONT			lf;
+	TEXTMETRIC		tm;
+	char			outfile[64];
+	char 			*p, *q;
+
+	switch( msg) {
+	case WM_CREATE:
+		break;
+
+	case WM_DESTROY:
+		PostQuitMessage(0);
+		break;
+
+	case WM_PAINT:
+		hdc = BeginPaint(hwnd, &ps);
+		SelectObject(hdc, hfont);
+
+		GetObject(hfont, sizeof(lf), &lf);
+		GetTextMetrics(hdc, &tm);
+		CHAR_WIDTH = tm.tmMaxCharWidth;
+		CHAR_HEIGHT = tm.tmHeight;
+		CHAR_ASCENT = tm.tmAscent;
+		FIRST_CHAR = tm.tmFirstChar;
+		LAST_CHAR = tm.tmLastChar + 1;
+		strcpy(fontname, lf.lfFaceName);
+		q = p = fontname;
+		while(*p) {
+			if(*p != ' ')
+				*q++ = *p;
+			++p;
+		}
+		*q = 0;
+
+		wsprintf(outfile, "win%s%dx%d.c", fontname, CHAR_WIDTH, CHAR_HEIGHT);
+		fp = fopen(outfile, "wt");
+		doit(hdc);
+		fclose(fp);
+		exit(1);
+		EndPaint(hwnd, &ps);
+		break;
+
+	case WM_LBUTTONDOWN:
+		break;
+
+	default:
+		return DefWindowProc( hwnd, msg, wp, lp);
+	}
+	return( 0);
+}
+
+
+void
+convfnt(HDC hdc)
+{
+	SIZE	size;
+   	unsigned char	ch;
+	int		i;
+	int		x, y;
+	USHORT 	c;
+	IMAGEBITS	image[MAX_CHAR_HEIGHT];
+	static USHORT mask[] = { 
+		0x8000, 0x4000, 0x2000, 0x1000, 0x0800, 0x0400, 0x0200, 0x0100,
+		0x0080, 0x0040, 0x0020, 0x0010, 0x0008, 0x0004, 0x0002, 0x0001
+	};
+
+	for(i=FIRST_CHAR; i<LAST_CHAR; ++i) {
+		ch = i;
+		TextOut(hdc, 0, 0, &ch, 1);
+		GetTextExtentPoint32(hdc, &ch, 1, &size);
+		for(y=0; y<size.cy; ++y) {
+			image[y] = 0;
+			for(x=0; x<size.cx; ++x) {
+				c = GetPixel(hdc, x, y)? 0: 1;
+				image[y] = (image[y] & ~mask[x&15]) | (c << (15 - (x & 15)));
+			}
+		}
+		offsets[ch] = curoff;
+		widths[ch] = size.cx;
+		print_char(ch, image, size.cx, size.cy);
+		print_bits(image, size.cx, size.cy);
+		curoff += size.cy;
+		fprintf(fp, "\n");
+	}
+}
+
+
+void
+doit(HDC hdc)
+{
+	int		i;
+
+	fprintf(fp, "/* Generated by convfnt.exe*/\n");
+	fprintf(fp, "#include \"device.h\"\n\n");
+	fprintf(fp, "/* Windows %s %dx%d Font */\n\n",
+		fontname, CHAR_WIDTH, CHAR_HEIGHT);
+	fprintf(fp, "static MWIMAGEBITS win%s%dx%d_bits[] = {\n\n",
+		fontname, CHAR_WIDTH, CHAR_HEIGHT);
+
+	convfnt(hdc);
+
+	fprintf(fp, "};\n\n");
+
+	fprintf(fp, "/* Character->glyph data. */\n");
+	fprintf(fp, "static unsigned short win%s%dx%d_offset[] = {\n",
+		fontname, CHAR_WIDTH, CHAR_HEIGHT);
+	for(i=FIRST_CHAR; i<LAST_CHAR; ++i)
+		fprintf(fp, "  %d,\t /* %c (0x%02x) */\n", offsets[i], i<' '? ' ':i , i);
+	fprintf(fp, "};\n\n");
+
+	fprintf(fp, "/* Character width data. */\n");
+	fprintf(fp, "static unsigned char win%s%dx%d_width[] = {\n",
+		fontname, CHAR_WIDTH, CHAR_HEIGHT);
+	for(i=FIRST_CHAR; i<LAST_CHAR; ++i)
+		fprintf(fp, "  %d,\t /* %c (0x%02x) */\n", widths[i], i<' '? ' ':i , i);
+	fprintf(fp, "};\n\n");
+
+
+	fprintf(fp, "/* Exported structure definition. */\n"
+		"MWCFONT font_win%s%dx%d = {\n",
+		fontname, CHAR_WIDTH, CHAR_HEIGHT);
+	fprintf(fp, "\t\"win%s%dx%d\",\n", fontname, CHAR_WIDTH, CHAR_HEIGHT);
+	fprintf(fp, "\t%d,\n", CHAR_WIDTH);
+	fprintf(fp, "\t%d,\n", CHAR_HEIGHT);
+	fprintf(fp, "\t%d,\n", CHAR_ASCENT);
+	fprintf(fp, "\t%d,\n\t%d,\n", FIRST_CHAR, LAST_CHAR-FIRST_CHAR);
+	fprintf(fp, "\twin%s%dx%d_bits,\n", fontname, CHAR_WIDTH, CHAR_HEIGHT);
+	fprintf(fp, "\twin%s%dx%d_offset,\n", fontname, CHAR_WIDTH, CHAR_HEIGHT);
+	fprintf(fp, "\twin%s%dx%d_width,\n", fontname, CHAR_WIDTH, CHAR_HEIGHT);
+	fprintf(fp, "};\n");
+}
+
+/* Character ! (0x21):
+   ht=16, width=8
+   +----------------+
+   |                |
+   |                |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |                |
+   | *              |
+   |                |
+   |                |
+   +----------------+ */
+
+void
+print_char(int ch,IMAGEBITS *bits, int width, int height)
+{
+	int 		x;
+	int 		bitcount;	/* number of bits left in bitmap word */
+	IMAGEBITS	bitvalue;	/* bitmap word value */
+
+	fprintf(fp, "/* Character %c (0x%02x):\n", (ch < ' '? ' ': ch), ch);
+	fprintf(fp, "   ht=%d, width=%d\n", height, width);
+	fprintf(fp, "   +");
+	for(x=0; x<width; ++x)
+		fprintf(fp, "-");
+	fprintf(fp, "+\n");
+	x = 0;
+	bitcount = 0;
+	while (height > 0) {
+	    if (bitcount <= 0) {
+		    fprintf(fp, "   |");
+		    bitcount = IMAGE_BITSPERIMAGE;
+		    bitvalue = *bits++;
+	    }
+		if (IMAGE_TESTBIT(bitvalue))
+			    fprintf(fp, "*");
+		else fprintf(fp, " ");
+	    bitvalue = IMAGE_SHIFTBIT(bitvalue);
+	    --bitcount;
+	    if (x++ == width-1) {
+		    x = 0;
+		    --height;
+		    bitcount = 0;
+		    fprintf(fp, "|\n");
+	    }
+	}
+	fprintf(fp, "   +");
+	for(x=0; x<width; ++x)
+		fprintf(fp, "-");
+	fprintf(fp, "+ */\n");
+}
+
+#define	IMAGE_GETBIT4(m)	(((m) & 0xf000) >> 12)
+#define	IMAGE_SHIFTBIT4(m)	((IMAGEBITS) ((m) << 4))
+
+void
+print_bits(IMAGEBITS *bits, int width, int height)
+{
+	int 		x;
+	int 		bitcount;	/* number of bits left in bitmap word */
+	IMAGEBITS	bitvalue;	/* bitmap word value */
+
+	x = 0;
+	bitcount = 0;
+	while (height > 0) {
+	    if (bitcount <= 0) {
+		    fprintf(fp, "0x");
+		    bitcount = IMAGE_BITSPERIMAGE;
+		    bitvalue = *bits++;
+	    }
+		fprintf(fp, "%x", IMAGE_GETBIT4(bitvalue));
+	    bitvalue = IMAGE_SHIFTBIT4(bitvalue);
+	    bitcount -= 4;
+		x += 4;
+	    if (x >= width) {
+			if(IMAGE_BITSPERIMAGE > width)
+				for(x=IMAGE_BITSPERIMAGE-width; x>3; ) {
+					fprintf(fp, "0");
+					x -= 4;
+				}
+		    x = 0;
+		    --height;
+		    bitcount = 0;
+		    fprintf(fp, ",\n");
+	    }
+	}
+}
+
+/*
+ * WIN Draw Library
+ *
+ * GetFont style bits:
+ *			01 bold
+ *			02 italic
+ * fontSize > 0		points (must pass hDC for non-screen font)
+ * fontSize < 0		pixels (no HDC needed)
+ */
+
+HFONT WINAPI
+GetFont(HDC hDC, LPSTR fontName,int fontSize,int fontStyle)
+{
+	return GetFontEx(hDC, fontName, fontSize, fontStyle, ANSI_CHARSET);
+}
+
+HFONT WINAPI
+GetFontEx(HDC hDC, LPSTR fontName,int fontSize,int fontStyle,int charset)
+{
+	LOGFONT	lf;
+	HDC		hdc;
+
+	memset( &lf, 0, sizeof(LOGFONT));
+
+	if( fontSize < 0 || hDC)
+		hdc = hDC;
+	else hdc = GetDC( GetDesktopWindow());
+
+	/* calculate font size from passed point size*/
+	if( fontSize < 0)
+		lf.lfHeight = -fontSize;
+	else lf.lfHeight = -MulDiv( fontSize,
+				GetDeviceCaps( hdc, LOGPIXELSY), 72);
+	if( fontName)
+		strncpy( lf.lfFaceName, fontName, LF_FACESIZE);
+	else lf.lfFaceName[ 0] = '\0';
+	lf.lfWeight = (fontStyle & 01)? FW_BOLD: FW_NORMAL;
+	if( fontStyle & 02)
+		lf.lfItalic = 1;
+	lf.lfCharSet = charset;
+
+	if( fontSize > 0 && !hDC)
+		ReleaseDC( GetDesktopWindow(), hdc);
+	return CreateFontIndirect( &lf);
+}
diff -urN lib/microwindows/src/fonts/convfnt.def /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convfnt.def
--- lib/microwindows/src/fonts/convfnt.def	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convfnt.def	2005-02-21 16:03:24.000000000 +0100
@@ -0,0 +1,10 @@
+NAME		test2
+DESCRIPTION	'test2'
+EXETYPE		WINDOWS
+STUB		'WINSTUB.EXE'
+CODE		MOVEABLE LOADONCALL DISCARDABLE
+DATA		PRELOAD FIXED MULTIPLE
+
+HEAPSIZE  8192
+STACKSIZE 8192
+;EXPORTS
diff -urN lib/microwindows/src/fonts/convfnt.mak /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convfnt.mak
--- lib/microwindows/src/fonts/convfnt.mak	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convfnt.mak	2005-02-21 16:13:17.000000000 +0100
@@ -0,0 +1,13 @@
+#
+# TEST2 makefile for Windows (SCROLLCREDITS)
+#
+MODEL=M
+CFLAGS=-DSTRICT -W3
+LFLAGS32=/map:convfnt.map
+OBJS=convfnt.obj
+WINPROG=convfnt
+xLIBS32=fwiniow.lib futilw.lib jpeg\fjpgw.lib
+
+all: $(WINPROG).exe
+
+include <stddefs.mak>
diff -urN lib/microwindows/src/fonts/convfnt.rc /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convfnt.rc
--- lib/microwindows/src/fonts/convfnt.rc	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convfnt.rc	2005-02-21 16:03:25.000000000 +0100
@@ -0,0 +1,15 @@
+/* 4 Mar 93*/
+#include <ver.h>
+#include "version.h"		//zzz fix
+/*
+ * Generic Windows Application RC file
+ */
+
+/* version info*/
+#define DESCRIPTION             Test Application
+#define EXE_NAME                TEST
+#define ORIGINAL_NAME           TEST
+#define PRODUCT_NAME            TEST
+#define TRADEMARKS		Copyright 1994 by Century Software, Inc.
+#include <exe.rcv>
+
Binary files lib/microwindows/src/fonts/convfnt32.exe and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convfnt32.exe differ
diff -urN lib/microwindows/src/fonts/convrom.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convrom.c
--- lib/microwindows/src/fonts/convrom.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convrom.c	2005-02-21 16:13:17.000000000 +0100
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * PC Bios ROM font extractor
+ * Note: ascent field of produced C file must be hand-editted
+ */
+#include "../../device.h"
+#include "../vga.h"
+
+/* rom font constants*/
+int	ROM_CHAR_HEIGHT = 16;	/* number of scan lines in fonts in ROM */
+#define	ROM_CHAR_WIDTH	8	/* number of pixels for character width */
+#define MAX_ROM_HEIGHT	16	/* max rom character height*/
+#define	FONT_CHARS	256	/* number of characters in font tables */
+
+/* int10 functions*/
+#define FNGR640x480	0x0012	/* function for graphics mode 640x480x16*/
+#define FNGR640x350	0x0010	/* function for graphics mode 640x350x16*/
+#define FNTEXT		0x0003	/* function for 80x25 text mode*/
+#define FNGETROMADDR	0x1130	/* function for address of rom character table*/
+#define GETROM8x14	0x0200	/* want address of ROM 8x14 char table*/
+#define GETROM8x8	0x0300	/* want address of ROM 8x8 char table*/
+#define GETROM8x16	0x0600	/* want address of ROM 8x16 char table*/
+
+
+#define GRMODE		FNGR640x350
+
+/* local data*/
+FARADDR 		rom_char_addr;
+
+void print_rom_table(void);
+void print_char(int ch,MWIMAGEBITS *b, int w, int h);
+void print_bits(MWIMAGEBITS *bits, int width, int height);
+
+main()
+{
+	/* init bios graphics mode*/
+	int10(GRMODE, 0);
+
+	/* get address of rom character table*/
+	rom_char_addr = int10(FNGETROMADDR, GETROM8x14);
+
+	/* check bios data area for actual character height,
+	 * as the returned font isn't always 14 high
+	 */
+	//ROM_CHAR_HEIGHT = GETBYTE_FP(MK_FP(0x0040, 0x0085));
+ROM_CHAR_HEIGHT = 16;
+
+	printf("/* Generated by convrom.exe*/\n");
+	printf("#include \"device.h\"\n\n");
+	printf("/* ROM %dx%d Font bios mode %x */\n\n",
+		ROM_CHAR_WIDTH, ROM_CHAR_HEIGHT, GRMODE);
+	printf("static MWIMAGEBITS rom%dx%d_bits[] = {\n\n",
+		ROM_CHAR_WIDTH, ROM_CHAR_HEIGHT);
+
+	print_rom_table();
+
+	printf("};\n\n");
+	printf("/* Exported structure definition. */\n"
+		"MWCFONT font_rom%dx%d = {\n",
+		ROM_CHAR_WIDTH, ROM_CHAR_HEIGHT);
+	printf("\t\"rom%dx%d\",\n", ROM_CHAR_WIDTH, ROM_CHAR_HEIGHT);
+	printf("\t%d,\n", ROM_CHAR_WIDTH);
+	printf("\t%d,\n", ROM_CHAR_HEIGHT);
+	printf("\t%d,\n", ROM_CHAR_HEIGHT);	/* ascent*/
+	printf("\t0,\n\t256,\n");
+	printf("\trom%dx%d_bits,\n", ROM_CHAR_WIDTH, ROM_CHAR_HEIGHT);
+	printf("\t0,\n\t0\n");
+	printf("};\n");
+
+	/* init bios 80x25 text mode*/
+	int10(FNTEXT, 0);
+}
+
+void
+print_rom_table(void)
+{
+	FARADDR		bits;
+	int		n;
+	int		ch;
+	MWIMAGEBITS *	p;
+	MWIMAGEBITS	image[MAX_ROM_HEIGHT];
+
+	for(ch=0; ch < 256; ++ch) {
+		bits = rom_char_addr + ch * ROM_CHAR_HEIGHT;
+		p = image;
+		for(n=0; n<ROM_CHAR_HEIGHT; ++n)
+		    *p++ = GETBYTE_FP(bits++) << 8;
+		print_char(ch, image, ROM_CHAR_WIDTH, ROM_CHAR_HEIGHT);
+		print_bits(image, ROM_CHAR_WIDTH, ROM_CHAR_HEIGHT);
+		printf("\n");
+	}
+}
+
+/* Character ! (0x21):
+   ht=16, width=8
+   +----------------+
+   |                |
+   |                |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |                |
+   | *              |
+   |                |
+   |                |
+   +----------------+ */
+
+void
+print_char(int ch,MWIMAGEBITS *bits, int width, int height)
+{
+	COORD 		x;
+	int 		bitcount;	/* number of bits left in bitmap word */
+	MWIMAGEBITS	bitvalue;	/* bitmap word value */
+
+	printf("/* Character %c (0x%02x):\n", ch? ch: ' ', ch);
+	printf("   ht=%d, width=%d\n", height, width);
+	printf("   +");
+	for(x=0; x<width; ++x)
+		printf("-");
+	printf("+\n");
+	x = 0;
+	bitcount = 0;
+	while (height > 0) {
+	    if (bitcount <= 0) {
+		    printf("   |");
+		    bitcount = MWIMAGE_BITSPERIMAGE;
+		    bitvalue = *bits++;
+	    }
+		if (MWIMAGE_TESTBIT(bitvalue))
+			    printf("*");
+		else printf(" ");
+	    bitvalue = MWIMAGE_SHIFTBIT(bitvalue);
+	    --bitcount;
+	    if (x++ == width-1) {
+		    x = 0;
+		    --height;
+		    bitcount = 0;
+		    printf("|\n");
+	    }
+	}
+	printf("   +");
+	for(x=0; x<width; ++x)
+		printf("-");
+	printf("+ */\n");
+}
+
+#define	MWIMAGE_GETBIT4(m)	(((m) & 0xf000) >> 12)
+#define	MWIMAGE_SHIFTBIT4(m)	((IMAGEBITS) ((m) << 4))
+
+void
+print_bits(MWIMAGEBITS *bits, int width, int height)
+{
+	COORD 		x;
+	int 		bitcount;	/* number of bits left in bitmap word */
+	MWIMAGEBITS	bitvalue;	/* bitmap word value */
+
+	x = 0;
+	bitcount = 0;
+	while (height > 0) {
+	    if (bitcount <= 0) {
+		    printf("0x");
+		    bitcount = MWIMAGE_BITSPERIMAGE;
+		    bitvalue = *bits++;
+	    }
+		printf("%x", MWIMAGE_GETBIT4(bitvalue));
+	    bitvalue = MWIMAGE_SHIFTBIT4(bitvalue);
+	    bitcount -= 4;
+		x += 4;
+	    if (x >= width-1) {
+			if(MWIMAGE_BITSPERIMAGE > width)
+				for(x=MWIMAGE_BITSPERIMAGE-width; x>0; ) {
+					printf("0");
+					x -= 4;
+				}
+		    x = 0;
+		    --height;
+		    bitcount = 0;
+		    printf(",\n");
+	    }
+	}
+}
Binary files lib/microwindows/src/fonts/convrom.exe and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convrom.exe differ
diff -urN lib/microwindows/src/fonts/convrom.mak /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convrom.mak
--- lib/microwindows/src/fonts/convrom.mak	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/convrom.mak	2005-02-21 16:03:25.000000000 +0100
@@ -0,0 +1,41 @@
+#
+# CONVROM - PC Bios ROM based font extractor
+#
+# Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+#
+CC=cl -c -Gs -Ols -AM -Ic:\tools\msc5\include
+CFLAGS=-W1
+LFLAGS=/NOI
+LIBDIR=c:\tools\msc5
+
+OBJS=convrom.obj ..\asmbios.obj
+LIBS=
+
+all: convrom
+
+clean:
+	erase *.obj
+	erase *.map
+	erase convrom.exe
+
+.c.obj:
+	$(CC) $(CFLAGS) -Fo$@ $<
+
+.s.obj:
+	masm -Dmem_S -D__MEDIUM__ -Mx $<.s;;;
+
+..\asmbios.obj: ..\asmbios.s
+	masm -Dmem_S -D__MEDIUM__ -Mx ..\asmbios.s;;;
+
+convrom: $(OBJS)
+	@set LIB=$(LIBDOS)
+	link @<<
+$(LFLAGS) /NOE+
+$(OBJS: =+^
+)
+convrom
+convrom/stack:16384/seg:256/f/packc:50000
+$(LIBS) $(LIBDIR)\mlibce
+nul
+<<
+
Binary files lib/microwindows/src/fonts/freesans.fon and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/freesans.fon differ
Binary files lib/microwindows/src/fonts/freesys.fon and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/freesys.fon differ
diff -urN lib/microwindows/src/fonts/helvB10.bdf /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/helvB10.bdf
--- lib/microwindows/src/fonts/helvB10.bdf	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/helvB10.bdf	2005-02-21 16:03:26.000000000 +0100
@@ -0,0 +1,3305 @@
+STARTFONT 2.1
+FONT -Adobe-Helvetica-Bold-R-Normal--10-100-75-75-P-60-ISO8859-1
+SIZE 10 75 75
+FONTBOUNDINGBOX 11 13 -1 -2
+COMMENT $XConsortium: helvB10.bdf,v 1.13 95/01/26 18:01:30 gildea Exp $
+COMMENT 
+COMMENT +
+COMMENT  Copyright 1984-1989, 1994 Adobe Systems Incorporated.
+COMMENT  Copyright 1988, 1994 Digital Equipment Corporation.
+COMMENT
+COMMENT  Adobe is a trademark of Adobe Systems Incorporated which may be
+COMMENT  registered in certain jurisdictions.
+COMMENT  Permission to use these trademarks is hereby granted only in
+COMMENT  association with the images described in this file.
+COMMENT
+COMMENT  Permission to use, copy, modify, distribute and sell this software
+COMMENT  and its documentation for any purpose and without fee is hereby
+COMMENT  granted, provided that the above copyright notices appear in all
+COMMENT  copies and that both those copyright notices and this permission
+COMMENT  notice appear in supporting documentation, and that the names of
+COMMENT  Adobe Systems and Digital Equipment Corporation not be used in
+COMMENT  advertising or publicity pertaining to distribution of the software
+COMMENT  without specific, written prior permission.  Adobe Systems and
+COMMENT  Digital Equipment Corporation make no representations about the
+COMMENT  suitability of this software for any purpose.  It is provided "as
+COMMENT  is" without express or implied warranty.
+COMMENT -
+STARTPROPERTIES 28
+FOUNDRY "Adobe"
+FAMILY_NAME "Helvetica"
+WEIGHT_NAME "Bold"
+SLANT "R"
+SETWIDTH_NAME "Normal"
+ADD_STYLE_NAME ""
+PIXEL_SIZE 10
+POINT_SIZE 100
+RESOLUTION_X 75
+RESOLUTION_Y 75
+SPACING "P"
+AVERAGE_WIDTH 60
+CHARSET_REGISTRY "ISO8859"
+CHARSET_ENCODING "1"
+CAP_HEIGHT 8
+X_HEIGHT 6
+FONT_ASCENT 10
+FONT_DESCENT 2
+FACE_NAME "Helvetica Bold"
+COPYRIGHT "Copyright (c) 1984, 1987 Adobe Systems Incorporated. All Rights Reserved. Copyright (c) 1988, 1991 Digital Equipment Corporation. All Rights Reserved."
+NOTICE "Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries.  "
+_DEC_DEVICE_FONTNAMES "PS=Helvetica-Bold"
+_DEC_PRODUCTINFO "DECwindows Fonts V2.2, 07-Nov-1991"
+DEFAULT_CHAR 32
+RELATIVE_SETWIDTH 50
+RELATIVE_WEIGHT 70
+CHARSET_COLLECTIONS "ASCII ISO8859-1 ADOBE-STANDARD"
+FULL_NAME "Helvetica Bold"
+ENDPROPERTIES
+CHARS 229
+STARTCHAR space
+ENCODING 32
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 1 1 0 0
+BITMAP
+00
+ENDCHAR
+STARTCHAR exclam
+ENCODING 33
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 2 8 1 0
+BITMAP
+C0
+C0
+C0
+C0
+80
+80
+00
+C0
+ENDCHAR
+STARTCHAR quotedbl
+ENCODING 34
+SWIDTH 474 0
+DWIDTH 5 0
+BBX 3 3 1 5
+BITMAP
+A0
+A0
+A0
+ENDCHAR
+STARTCHAR numbersign
+ENCODING 35
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 7 0 0
+BITMAP
+50
+50
+FC
+50
+F8
+A0
+A0
+ENDCHAR
+STARTCHAR dollar
+ENCODING 36
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 9 0 -1
+BITMAP
+20
+70
+A8
+E0
+70
+38
+A8
+70
+20
+ENDCHAR
+STARTCHAR percent
+ENCODING 37
+SWIDTH 889 0
+DWIDTH 8 0
+BBX 7 8 0 0
+BITMAP
+62
+B4
+68
+10
+10
+2C
+56
+8C
+ENDCHAR
+STARTCHAR ampersand
+ENCODING 38
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 8 0 0
+BITMAP
+70
+D8
+D8
+70
+DE
+CC
+DC
+76
+ENDCHAR
+STARTCHAR quoteright
+ENCODING 39
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 3 0 5
+BITMAP
+C0
+40
+80
+ENDCHAR
+STARTCHAR parenleft
+ENCODING 40
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 10 0 -2
+BITMAP
+20
+60
+40
+C0
+C0
+C0
+C0
+40
+60
+20
+ENDCHAR
+STARTCHAR parenright
+ENCODING 41
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 10 0 -2
+BITMAP
+80
+C0
+40
+60
+60
+60
+60
+40
+C0
+80
+ENDCHAR
+STARTCHAR asterisk
+ENCODING 42
+SWIDTH 389 0
+DWIDTH 4 0
+BBX 3 3 0 5
+BITMAP
+A0
+40
+A0
+ENDCHAR
+STARTCHAR plus
+ENCODING 43
+SWIDTH 584 0
+DWIDTH 6 0
+BBX 6 5 0 1
+BITMAP
+30
+30
+FC
+30
+30
+ENDCHAR
+STARTCHAR comma
+ENCODING 44
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 4 0 -2
+BITMAP
+40
+40
+40
+80
+ENDCHAR
+STARTCHAR minus
+ENCODING 45
+SWIDTH 584 0
+DWIDTH 7 0
+BBX 5 1 1 3
+BITMAP
+F8
+ENDCHAR
+STARTCHAR period
+ENCODING 46
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 1 2 1 0
+BITMAP
+80
+80
+ENDCHAR
+STARTCHAR slash
+ENCODING 47
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 4 8 0 0
+BITMAP
+10
+10
+20
+20
+40
+40
+80
+80
+ENDCHAR
+STARTCHAR zero
+ENCODING 48
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+70
+D8
+D8
+D8
+D8
+D8
+D8
+70
+ENDCHAR
+STARTCHAR one
+ENCODING 49
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 4 8 0 0
+BITMAP
+30
+F0
+30
+30
+30
+30
+30
+30
+ENDCHAR
+STARTCHAR two
+ENCODING 50
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+70
+D8
+18
+18
+30
+60
+C0
+F8
+ENDCHAR
+STARTCHAR three
+ENCODING 51
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+70
+D8
+18
+30
+18
+18
+D8
+70
+ENDCHAR
+STARTCHAR four
+ENCODING 52
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 8 0 0
+BITMAP
+18
+38
+58
+58
+98
+FC
+18
+18
+ENDCHAR
+STARTCHAR five
+ENCODING 53
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+F8
+C0
+C0
+F0
+18
+98
+D8
+70
+ENDCHAR
+STARTCHAR six
+ENCODING 54
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+70
+D8
+C0
+F0
+D8
+D8
+D8
+70
+ENDCHAR
+STARTCHAR seven
+ENCODING 55
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+F8
+18
+18
+30
+30
+30
+60
+60
+ENDCHAR
+STARTCHAR eight
+ENCODING 56
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+70
+D8
+D8
+70
+D8
+D8
+D8
+70
+ENDCHAR
+STARTCHAR nine
+ENCODING 57
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+70
+D8
+D8
+D8
+78
+18
+D8
+70
+ENDCHAR
+STARTCHAR colon
+ENCODING 58
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 1 6 1 0
+BITMAP
+80
+80
+00
+00
+80
+80
+ENDCHAR
+STARTCHAR semicolon
+ENCODING 59
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 2 8 0 -2
+BITMAP
+40
+40
+00
+00
+40
+40
+40
+80
+ENDCHAR
+STARTCHAR less
+ENCODING 60
+SWIDTH 584 0
+DWIDTH 5 0
+BBX 4 5 0 1
+BITMAP
+30
+60
+C0
+60
+30
+ENDCHAR
+STARTCHAR equal
+ENCODING 61
+SWIDTH 584 0
+DWIDTH 6 0
+BBX 5 3 0 2
+BITMAP
+F8
+00
+F8
+ENDCHAR
+STARTCHAR greater
+ENCODING 62
+SWIDTH 584 0
+DWIDTH 5 0
+BBX 4 5 0 1
+BITMAP
+C0
+60
+30
+60
+C0
+ENDCHAR
+STARTCHAR question
+ENCODING 63
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+70
+D8
+18
+30
+60
+60
+00
+60
+ENDCHAR
+STARTCHAR at
+ENCODING 64
+SWIDTH 975 0
+DWIDTH 11 0
+BBX 10 9 0 -2
+BITMAP
+1F00
+6080
+4D40
+9240
+A240
+A480
+9B00
+4000
+3E00
+ENDCHAR
+STARTCHAR A
+ENCODING 65
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 8 0 0
+BITMAP
+38
+38
+6C
+6C
+6C
+FE
+C6
+C6
+ENDCHAR
+STARTCHAR B
+ENCODING 66
+SWIDTH 722 0
+DWIDTH 7 0
+BBX 6 8 0 0
+BITMAP
+F8
+CC
+CC
+F8
+CC
+CC
+CC
+F8
+ENDCHAR
+STARTCHAR C
+ENCODING 67
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 8 0 0
+BITMAP
+3C
+66
+C2
+C0
+C0
+C2
+66
+3C
+ENDCHAR
+STARTCHAR D
+ENCODING 68
+SWIDTH 722 0
+DWIDTH 7 0
+BBX 6 8 0 0
+BITMAP
+F0
+D8
+CC
+CC
+CC
+CC
+D8
+F0
+ENDCHAR
+STARTCHAR E
+ENCODING 69
+SWIDTH 667 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+F8
+C0
+C0
+F8
+C0
+C0
+C0
+F8
+ENDCHAR
+STARTCHAR F
+ENCODING 70
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+F8
+C0
+C0
+F0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR G
+ENCODING 71
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 7 8 0 0
+BITMAP
+3C
+66
+C2
+C0
+CE
+C6
+66
+3A
+ENDCHAR
+STARTCHAR H
+ENCODING 72
+SWIDTH 722 0
+DWIDTH 7 0
+BBX 6 8 0 0
+BITMAP
+CC
+CC
+CC
+FC
+CC
+CC
+CC
+CC
+ENDCHAR
+STARTCHAR I
+ENCODING 73
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 8 0 0
+BITMAP
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR J
+ENCODING 74
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+18
+18
+18
+18
+18
+18
+D8
+70
+ENDCHAR
+STARTCHAR K
+ENCODING 75
+SWIDTH 722 0
+DWIDTH 7 0
+BBX 7 8 0 0
+BITMAP
+CC
+D8
+F0
+E0
+F0
+D8
+CC
+C6
+ENDCHAR
+STARTCHAR L
+ENCODING 76
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+F8
+ENDCHAR
+STARTCHAR M
+ENCODING 77
+SWIDTH 833 0
+DWIDTH 10 0
+BBX 9 8 0 0
+BITMAP
+C180
+E380
+E380
+F780
+D580
+DD80
+C980
+C980
+ENDCHAR
+STARTCHAR N
+ENCODING 78
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 8 0 0
+BITMAP
+C6
+E6
+E6
+D6
+D6
+CE
+CE
+C6
+ENDCHAR
+STARTCHAR O
+ENCODING 79
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 7 8 0 0
+BITMAP
+38
+6C
+C6
+C6
+C6
+C6
+6C
+38
+ENDCHAR
+STARTCHAR P
+ENCODING 80
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 6 8 0 0
+BITMAP
+F8
+CC
+CC
+CC
+F8
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR Q
+ENCODING 81
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 7 9 0 -1
+BITMAP
+38
+6C
+C6
+C6
+C6
+D6
+6C
+3C
+02
+ENDCHAR
+STARTCHAR R
+ENCODING 82
+SWIDTH 722 0
+DWIDTH 7 0
+BBX 6 8 0 0
+BITMAP
+F8
+CC
+CC
+CC
+F8
+CC
+CC
+CC
+ENDCHAR
+STARTCHAR S
+ENCODING 83
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 6 8 0 0
+BITMAP
+78
+CC
+E0
+78
+1C
+8C
+CC
+78
+ENDCHAR
+STARTCHAR T
+ENCODING 84
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 8 0 0
+BITMAP
+FC
+30
+30
+30
+30
+30
+30
+30
+ENDCHAR
+STARTCHAR U
+ENCODING 85
+SWIDTH 722 0
+DWIDTH 7 0
+BBX 6 8 0 0
+BITMAP
+CC
+CC
+CC
+CC
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR V
+ENCODING 86
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 7 8 0 0
+BITMAP
+C6
+C6
+6C
+6C
+6C
+38
+38
+10
+ENDCHAR
+STARTCHAR W
+ENCODING 87
+SWIDTH 944 0
+DWIDTH 11 0
+BBX 10 8 0 0
+BITMAP
+CCC0
+CCC0
+CCC0
+6D80
+6D80
+7F80
+3300
+2100
+ENDCHAR
+STARTCHAR X
+ENCODING 88
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 7 8 0 0
+BITMAP
+C6
+C6
+6C
+38
+38
+6C
+C6
+C6
+ENDCHAR
+STARTCHAR Y
+ENCODING 89
+SWIDTH 667 0
+DWIDTH 9 0
+BBX 8 8 0 0
+BITMAP
+C3
+C3
+66
+66
+3C
+18
+18
+18
+ENDCHAR
+STARTCHAR Z
+ENCODING 90
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 8 0 0
+BITMAP
+FC
+0C
+18
+30
+70
+60
+C0
+FC
+ENDCHAR
+STARTCHAR bracketleft
+ENCODING 91
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 10 0 -2
+BITMAP
+E0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+E0
+ENDCHAR
+STARTCHAR backslash
+ENCODING 92
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 4 8 0 0
+BITMAP
+80
+80
+40
+40
+20
+20
+10
+10
+ENDCHAR
+STARTCHAR bracketright
+ENCODING 93
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 10 0 -2
+BITMAP
+E0
+60
+60
+60
+60
+60
+60
+60
+60
+E0
+ENDCHAR
+STARTCHAR asciicircum
+ENCODING 94
+SWIDTH 584 0
+DWIDTH 5 0
+BBX 5 4 0 4
+BITMAP
+20
+70
+D8
+88
+ENDCHAR
+STARTCHAR underscore
+ENCODING 95
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 1 0 -2
+BITMAP
+FC
+ENDCHAR
+STARTCHAR quoteleft
+ENCODING 96
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 3 0 5
+BITMAP
+40
+80
+C0
+ENDCHAR
+STARTCHAR a
+ENCODING 97
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 6 0 0
+BITMAP
+70
+98
+78
+D8
+D8
+6C
+ENDCHAR
+STARTCHAR b
+ENCODING 98
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+C0
+C0
+F0
+D8
+C8
+C8
+D8
+F0
+ENDCHAR
+STARTCHAR c
+ENCODING 99
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 6 0 0
+BITMAP
+70
+D0
+C0
+C0
+D0
+70
+ENDCHAR
+STARTCHAR d
+ENCODING 100
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+18
+18
+78
+D8
+98
+98
+D8
+78
+ENDCHAR
+STARTCHAR e
+ENCODING 101
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+70
+D8
+F8
+C0
+D8
+70
+ENDCHAR
+STARTCHAR f
+ENCODING 102
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 4 8 0 0
+BITMAP
+70
+C0
+E0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR g
+ENCODING 103
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 8 0 -2
+BITMAP
+68
+D8
+98
+98
+D8
+78
+18
+70
+ENDCHAR
+STARTCHAR h
+ENCODING 104
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+C0
+C0
+F0
+D8
+D8
+D8
+D8
+D8
+ENDCHAR
+STARTCHAR i
+ENCODING 105
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 8 0 0
+BITMAP
+C0
+00
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR j
+ENCODING 106
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 10 0 -2
+BITMAP
+C0
+00
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+80
+ENDCHAR
+STARTCHAR k
+ENCODING 107
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 8 0 0
+BITMAP
+C0
+C0
+D8
+F0
+E0
+F0
+D8
+CC
+ENDCHAR
+STARTCHAR l
+ENCODING 108
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 8 0 0
+BITMAP
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR m
+ENCODING 109
+SWIDTH 889 0
+DWIDTH 9 0
+BBX 8 6 0 0
+BITMAP
+B6
+DB
+DB
+DB
+DB
+DB
+ENDCHAR
+STARTCHAR n
+ENCODING 110
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+B0
+D8
+D8
+D8
+D8
+D8
+ENDCHAR
+STARTCHAR o
+ENCODING 111
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+70
+D8
+D8
+D8
+D8
+70
+ENDCHAR
+STARTCHAR p
+ENCODING 112
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 8 0 -2
+BITMAP
+B0
+D8
+C8
+C8
+D8
+F0
+C0
+C0
+ENDCHAR
+STARTCHAR q
+ENCODING 113
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 8 0 -2
+BITMAP
+68
+D8
+98
+98
+D8
+78
+18
+18
+ENDCHAR
+STARTCHAR r
+ENCODING 114
+SWIDTH 389 0
+DWIDTH 4 0
+BBX 4 6 0 0
+BITMAP
+B0
+E0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR s
+ENCODING 115
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+70
+D8
+70
+18
+D8
+70
+ENDCHAR
+STARTCHAR t
+ENCODING 116
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 8 0 0
+BITMAP
+C0
+C0
+E0
+C0
+C0
+C0
+C0
+60
+ENDCHAR
+STARTCHAR u
+ENCODING 117
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+D8
+D8
+D8
+D8
+D8
+68
+ENDCHAR
+STARTCHAR v
+ENCODING 118
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+D8
+D8
+D8
+50
+70
+20
+ENDCHAR
+STARTCHAR w
+ENCODING 119
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 7 6 0 0
+BITMAP
+D6
+D6
+D6
+6C
+6C
+6C
+ENDCHAR
+STARTCHAR x
+ENCODING 120
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 6 0 0
+BITMAP
+CC
+78
+30
+78
+CC
+CC
+ENDCHAR
+STARTCHAR y
+ENCODING 121
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 -2
+BITMAP
+D8
+D8
+D8
+D8
+78
+30
+30
+60
+ENDCHAR
+STARTCHAR z
+ENCODING 122
+SWIDTH 500 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+F8
+18
+30
+60
+C0
+F8
+ENDCHAR
+STARTCHAR braceleft
+ENCODING 123
+SWIDTH 389 0
+DWIDTH 5 0
+BBX 4 10 0 -2
+BITMAP
+30
+60
+60
+60
+C0
+60
+60
+60
+60
+30
+ENDCHAR
+STARTCHAR bar
+ENCODING 124
+SWIDTH 280 0
+DWIDTH 3 0
+BBX 1 10 1 -2
+BITMAP
+80
+80
+80
+80
+80
+80
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR braceright
+ENCODING 125
+SWIDTH 389 0
+DWIDTH 5 0
+BBX 4 10 0 -2
+BITMAP
+C0
+60
+60
+60
+30
+60
+60
+60
+60
+C0
+ENDCHAR
+STARTCHAR asciitilde
+ENCODING 126
+SWIDTH 584 0
+DWIDTH 6 0
+BBX 6 2 0 2
+BITMAP
+6C
+D8
+ENDCHAR
+STARTCHAR space
+ENCODING 160
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 1 1 0 0
+BITMAP
+00
+ENDCHAR
+STARTCHAR exclamdown
+ENCODING 161
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 2 8 1 -2
+BITMAP
+C0
+00
+40
+40
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR cent
+ENCODING 162
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 -1
+BITMAP
+10
+70
+D8
+A0
+A0
+D8
+70
+40
+ENDCHAR
+STARTCHAR sterling
+ENCODING 163
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+38
+68
+60
+F0
+60
+60
+68
+D8
+ENDCHAR
+STARTCHAR currency
+ENCODING 164
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 6 0 1
+BITMAP
+D8
+70
+D8
+D8
+70
+D8
+ENDCHAR
+STARTCHAR yen
+ENCODING 165
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 8 0 0
+BITMAP
+84
+CC
+48
+78
+FC
+30
+FC
+30
+ENDCHAR
+STARTCHAR brokenbar
+ENCODING 166
+SWIDTH 280 0
+DWIDTH 3 0
+BBX 1 10 1 -2
+BITMAP
+80
+80
+80
+80
+00
+00
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR section
+ENCODING 167
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 10 0 -2
+BITMAP
+70
+C8
+E0
+70
+98
+C8
+70
+38
+98
+70
+ENDCHAR
+STARTCHAR dieresis
+ENCODING 168
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 3 1 0 7
+BITMAP
+A0
+ENDCHAR
+STARTCHAR copyright
+ENCODING 169
+SWIDTH 737 0
+DWIDTH 10 0
+BBX 8 8 1 0
+BITMAP
+3C
+42
+99
+A5
+A1
+9D
+42
+3C
+ENDCHAR
+STARTCHAR ordfeminine
+ENCODING 170
+SWIDTH 370 0
+DWIDTH 5 0
+BBX 3 5 1 3
+BITMAP
+E0
+20
+A0
+00
+E0
+ENDCHAR
+STARTCHAR guillemotleft
+ENCODING 171
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 3 0 1
+BITMAP
+6C
+D8
+6C
+ENDCHAR
+STARTCHAR logicalnot
+ENCODING 172
+SWIDTH 584 0
+DWIDTH 7 0
+BBX 5 3 1 2
+BITMAP
+F8
+08
+08
+ENDCHAR
+STARTCHAR hyphen
+ENCODING 173
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 4 1 0 3
+BITMAP
+F0
+ENDCHAR
+STARTCHAR registered
+ENCODING 174
+SWIDTH 737 0
+DWIDTH 10 0
+BBX 8 8 1 0
+BITMAP
+3C
+42
+BD
+A5
+B9
+A5
+42
+3C
+ENDCHAR
+STARTCHAR macron
+ENCODING 175
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 3 1 0 7
+BITMAP
+E0
+ENDCHAR
+STARTCHAR degree
+ENCODING 176
+SWIDTH 400 0
+DWIDTH 4 0
+BBX 3 3 1 4
+BITMAP
+60
+A0
+C0
+ENDCHAR
+STARTCHAR plusminus
+ENCODING 177
+SWIDTH 584 0
+DWIDTH 6 0
+BBX 6 7 0 0
+BITMAP
+30
+30
+FC
+30
+30
+00
+FC
+ENDCHAR
+STARTCHAR twosuperior
+ENCODING 178
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 3 4 0 3
+BITMAP
+60
+A0
+40
+E0
+ENDCHAR
+STARTCHAR threesuperior
+ENCODING 179
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 3 4 0 3
+BITMAP
+E0
+40
+20
+C0
+ENDCHAR
+STARTCHAR acute
+ENCODING 180
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 2 2 0 7
+BITMAP
+40
+80
+ENDCHAR
+STARTCHAR mu
+ENCODING 181
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 8 0 -2
+BITMAP
+D8
+D8
+D8
+D8
+D8
+E8
+C0
+C0
+ENDCHAR
+STARTCHAR paragraph
+ENCODING 182
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 10 0 -2
+BITMAP
+7C
+E8
+E8
+E8
+68
+28
+28
+28
+28
+28
+ENDCHAR
+STARTCHAR periodcentered
+ENCODING 183
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 1 0 3
+BITMAP
+C0
+ENDCHAR
+STARTCHAR cedilla
+ENCODING 184
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 2 2 0 -2
+BITMAP
+40
+C0
+ENDCHAR
+STARTCHAR onesuperior
+ENCODING 185
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 2 4 0 3
+BITMAP
+40
+C0
+40
+40
+ENDCHAR
+STARTCHAR ordmasculine
+ENCODING 186
+SWIDTH 365 0
+DWIDTH 5 0
+BBX 3 5 1 3
+BITMAP
+E0
+A0
+E0
+00
+E0
+ENDCHAR
+STARTCHAR guillemotright
+ENCODING 187
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 3 0 1
+BITMAP
+D8
+6C
+D8
+ENDCHAR
+STARTCHAR onequarter
+ENCODING 188
+SWIDTH 834 0
+DWIDTH 9 0
+BBX 8 8 0 0
+BITMAP
+42
+C4
+48
+48
+12
+26
+2F
+42
+ENDCHAR
+STARTCHAR onehalf
+ENCODING 189
+SWIDTH 834 0
+DWIDTH 9 0
+BBX 7 8 0 0
+BITMAP
+42
+C4
+48
+48
+16
+2A
+24
+4E
+ENDCHAR
+STARTCHAR threequarters
+ENCODING 190
+SWIDTH 834 0
+DWIDTH 9 0
+BBX 8 8 0 0
+BITMAP
+E2
+44
+28
+C8
+12
+26
+2F
+42
+ENDCHAR
+STARTCHAR questiondown
+ENCODING 191
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 8 0 -2
+BITMAP
+30
+00
+30
+30
+60
+C0
+D8
+70
+ENDCHAR
+STARTCHAR Agrave
+ENCODING 192
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 11 0 0
+BITMAP
+20
+10
+00
+38
+38
+6C
+6C
+6C
+FE
+C6
+C6
+ENDCHAR
+STARTCHAR Aacute
+ENCODING 193
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 11 0 0
+BITMAP
+08
+10
+00
+38
+38
+6C
+6C
+6C
+FE
+C6
+C6
+ENDCHAR
+STARTCHAR Acircumflex
+ENCODING 194
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 11 0 0
+BITMAP
+10
+28
+00
+38
+38
+6C
+6C
+6C
+FE
+C6
+C6
+ENDCHAR
+STARTCHAR Atilde
+ENCODING 195
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 11 0 0
+BITMAP
+14
+28
+00
+38
+38
+6C
+6C
+6C
+FE
+C6
+C6
+ENDCHAR
+STARTCHAR Adieresis
+ENCODING 196
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 10 0 0
+BITMAP
+28
+00
+38
+38
+6C
+6C
+6C
+FE
+C6
+C6
+ENDCHAR
+STARTCHAR Aring
+ENCODING 197
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 11 0 0
+BITMAP
+10
+28
+10
+38
+38
+6C
+6C
+6C
+FE
+C6
+C6
+ENDCHAR
+STARTCHAR AE
+ENCODING 198
+SWIDTH 1000 0
+DWIDTH 10 0
+BBX 9 8 0 0
+BITMAP
+3F80
+3C00
+6C00
+6F80
+6C00
+FC00
+CC00
+CF80
+ENDCHAR
+STARTCHAR Ccedilla
+ENCODING 199
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 10 0 -2
+BITMAP
+3C
+66
+C2
+C0
+C0
+C2
+66
+3C
+10
+30
+ENDCHAR
+STARTCHAR Egrave
+ENCODING 200
+SWIDTH 667 0
+DWIDTH 6 0
+BBX 5 11 0 0
+BITMAP
+40
+20
+00
+F8
+C0
+C0
+F8
+C0
+C0
+C0
+F8
+ENDCHAR
+STARTCHAR Eacute
+ENCODING 201
+SWIDTH 667 0
+DWIDTH 6 0
+BBX 5 11 0 0
+BITMAP
+10
+20
+00
+F8
+C0
+C0
+F8
+C0
+C0
+C0
+F8
+ENDCHAR
+STARTCHAR Ecircumflex
+ENCODING 202
+SWIDTH 667 0
+DWIDTH 6 0
+BBX 5 11 0 0
+BITMAP
+20
+50
+00
+F8
+C0
+C0
+F8
+C0
+C0
+C0
+F8
+ENDCHAR
+STARTCHAR Edieresis
+ENCODING 203
+SWIDTH 667 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+50
+00
+F8
+C0
+C0
+F8
+C0
+C0
+C0
+F8
+ENDCHAR
+STARTCHAR Igrave
+ENCODING 204
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 11 0 0
+BITMAP
+80
+40
+00
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR Iacute
+ENCODING 205
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 11 0 0
+BITMAP
+40
+80
+00
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR Icircumflex
+ENCODING 206
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 3 11 0 0
+BITMAP
+40
+A0
+00
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR Idieresis
+ENCODING 207
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 3 10 0 0
+BITMAP
+A0
+00
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR Eth
+ENCODING 208
+SWIDTH 722 0
+DWIDTH 7 0
+BBX 6 8 0 0
+BITMAP
+F0
+D8
+CC
+EC
+CC
+CC
+D8
+F0
+ENDCHAR
+STARTCHAR Ntilde
+ENCODING 209
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 11 0 0
+BITMAP
+14
+28
+00
+C6
+C6
+E6
+D6
+D6
+CE
+CE
+C6
+ENDCHAR
+STARTCHAR Ograve
+ENCODING 210
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 7 11 0 0
+BITMAP
+20
+10
+00
+38
+6C
+C6
+C6
+C6
+C6
+6C
+38
+ENDCHAR
+STARTCHAR Oacute
+ENCODING 211
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 7 11 0 0
+BITMAP
+04
+08
+00
+38
+6C
+C6
+C6
+C6
+C6
+6C
+38
+ENDCHAR
+STARTCHAR Ocircumflex
+ENCODING 212
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 7 11 0 0
+BITMAP
+10
+28
+00
+38
+6C
+C6
+C6
+C6
+C6
+6C
+38
+ENDCHAR
+STARTCHAR Otilde
+ENCODING 213
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 7 11 0 0
+BITMAP
+14
+28
+00
+38
+6C
+C6
+C6
+C6
+C6
+6C
+38
+ENDCHAR
+STARTCHAR Odieresis
+ENCODING 214
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 7 10 0 0
+BITMAP
+28
+00
+38
+6C
+C6
+C6
+C6
+C6
+6C
+38
+ENDCHAR
+STARTCHAR multiply
+ENCODING 215
+SWIDTH 584 0
+DWIDTH 6 0
+BBX 6 5 0 1
+BITMAP
+CC
+78
+30
+78
+CC
+ENDCHAR
+STARTCHAR Oslash
+ENCODING 216
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 7 8 0 0
+BITMAP
+3A
+6C
+CE
+D6
+D6
+E6
+6C
+B8
+ENDCHAR
+STARTCHAR Ugrave
+ENCODING 217
+SWIDTH 722 0
+DWIDTH 7 0
+BBX 6 11 0 0
+BITMAP
+20
+10
+00
+CC
+CC
+CC
+CC
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR Uacute
+ENCODING 218
+SWIDTH 722 0
+DWIDTH 7 0
+BBX 6 11 0 0
+BITMAP
+08
+10
+00
+CC
+CC
+CC
+CC
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR Ucircumflex
+ENCODING 219
+SWIDTH 722 0
+DWIDTH 7 0
+BBX 6 11 0 0
+BITMAP
+10
+28
+00
+CC
+CC
+CC
+CC
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR Udieresis
+ENCODING 220
+SWIDTH 722 0
+DWIDTH 7 0
+BBX 6 10 0 0
+BITMAP
+28
+00
+CC
+CC
+CC
+CC
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR Yacute
+ENCODING 221
+SWIDTH 667 0
+DWIDTH 9 0
+BBX 8 11 0 0
+BITMAP
+04
+08
+00
+C3
+C3
+66
+66
+3C
+18
+18
+18
+ENDCHAR
+STARTCHAR Thorn
+ENCODING 222
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 6 8 0 0
+BITMAP
+C0
+F8
+CC
+CC
+CC
+F8
+C0
+C0
+ENDCHAR
+STARTCHAR germandbls
+ENCODING 223
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+70
+C8
+C8
+D0
+C8
+C8
+C8
+D0
+ENDCHAR
+STARTCHAR agrave
+ENCODING 224
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 9 0 0
+BITMAP
+40
+20
+00
+70
+98
+78
+D8
+D8
+6C
+ENDCHAR
+STARTCHAR aacute
+ENCODING 225
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 9 0 0
+BITMAP
+08
+10
+00
+70
+98
+78
+D8
+D8
+6C
+ENDCHAR
+STARTCHAR acircumflex
+ENCODING 226
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 9 0 0
+BITMAP
+30
+68
+00
+70
+98
+78
+D8
+D8
+6C
+ENDCHAR
+STARTCHAR atilde
+ENCODING 227
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 9 0 0
+BITMAP
+28
+50
+00
+70
+98
+78
+D8
+D8
+6C
+ENDCHAR
+STARTCHAR adieresis
+ENCODING 228
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 9 0 0
+BITMAP
+50
+50
+00
+70
+98
+78
+D8
+D8
+6C
+ENDCHAR
+STARTCHAR aring
+ENCODING 229
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 9 0 0
+BITMAP
+20
+50
+20
+70
+98
+78
+D8
+D8
+6C
+ENDCHAR
+STARTCHAR ae
+ENCODING 230
+SWIDTH 889 0
+DWIDTH 9 0
+BBX 8 6 0 0
+BITMAP
+7E
+9B
+7F
+D8
+DB
+6E
+ENDCHAR
+STARTCHAR ccedilla
+ENCODING 231
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 8 0 -2
+BITMAP
+70
+D0
+C0
+C0
+D0
+70
+20
+60
+ENDCHAR
+STARTCHAR egrave
+ENCODING 232
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+40
+20
+00
+70
+D8
+F8
+C0
+D8
+70
+ENDCHAR
+STARTCHAR eacute
+ENCODING 233
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+10
+20
+00
+70
+D8
+F8
+C0
+D8
+70
+ENDCHAR
+STARTCHAR ecircumflex
+ENCODING 234
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+20
+50
+00
+70
+D8
+F8
+C0
+D8
+70
+ENDCHAR
+STARTCHAR edieresis
+ENCODING 235
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+50
+50
+00
+70
+D8
+F8
+C0
+D8
+70
+ENDCHAR
+STARTCHAR igrave
+ENCODING 236
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 9 0 0
+BITMAP
+80
+40
+00
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR iacute
+ENCODING 237
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 3 9 0 0
+BITMAP
+20
+40
+00
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR icircumflex
+ENCODING 238
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 3 9 -1 0
+BITMAP
+40
+A0
+00
+60
+60
+60
+60
+60
+60
+ENDCHAR
+STARTCHAR idieresis
+ENCODING 239
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 3 9 0 0
+BITMAP
+A0
+A0
+00
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR eth
+ENCODING 240
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+50
+60
+A0
+70
+D8
+D8
+D8
+D8
+70
+ENDCHAR
+STARTCHAR ntilde
+ENCODING 241
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+28
+50
+00
+B0
+D8
+D8
+D8
+D8
+D8
+ENDCHAR
+STARTCHAR ograve
+ENCODING 242
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+40
+20
+00
+70
+D8
+D8
+D8
+D8
+70
+ENDCHAR
+STARTCHAR oacute
+ENCODING 243
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+10
+20
+00
+70
+D8
+D8
+D8
+D8
+70
+ENDCHAR
+STARTCHAR ocircumflex
+ENCODING 244
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+20
+50
+00
+70
+D8
+D8
+D8
+D8
+70
+ENDCHAR
+STARTCHAR otilde
+ENCODING 245
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+50
+A0
+00
+70
+D8
+D8
+D8
+D8
+70
+ENDCHAR
+STARTCHAR odieresis
+ENCODING 246
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+50
+50
+00
+70
+D8
+D8
+D8
+D8
+70
+ENDCHAR
+STARTCHAR divide
+ENCODING 247
+SWIDTH 584 0
+DWIDTH 6 0
+BBX 6 5 0 1
+BITMAP
+30
+00
+FC
+00
+30
+ENDCHAR
+STARTCHAR oslash
+ENCODING 248
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 6 6 0 0
+BITMAP
+74
+D8
+F8
+D8
+D8
+70
+ENDCHAR
+STARTCHAR ugrave
+ENCODING 249
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+40
+20
+00
+D8
+D8
+D8
+D8
+D8
+68
+ENDCHAR
+STARTCHAR uacute
+ENCODING 250
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+10
+20
+00
+D8
+D8
+D8
+D8
+D8
+68
+ENDCHAR
+STARTCHAR ucircumflex
+ENCODING 251
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+20
+50
+00
+D8
+D8
+D8
+D8
+D8
+68
+ENDCHAR
+STARTCHAR udieresis
+ENCODING 252
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+50
+50
+00
+D8
+D8
+D8
+D8
+D8
+68
+ENDCHAR
+STARTCHAR yacute
+ENCODING 253
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 11 0 -2
+BITMAP
+10
+20
+00
+D8
+D8
+D8
+D8
+78
+30
+30
+60
+ENDCHAR
+STARTCHAR thorn
+ENCODING 254
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 10 0 -2
+BITMAP
+C0
+C0
+F0
+D8
+C8
+C8
+D8
+F0
+C0
+C0
+ENDCHAR
+STARTCHAR ydieresis
+ENCODING 255
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 11 0 -2
+BITMAP
+50
+50
+00
+D8
+D8
+D8
+D8
+78
+30
+30
+60
+ENDCHAR
+STARTCHAR Lslash
+ENCODING -1
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 6 8 -1 0
+BITMAP
+60
+60
+60
+70
+E0
+60
+60
+7C
+ENDCHAR
+STARTCHAR OE
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 10 0
+BBX 9 8 0 0
+BITMAP
+3F80
+6C00
+CC00
+CF80
+CC00
+CC00
+6C00
+3F80
+ENDCHAR
+STARTCHAR Scaron
+ENCODING -1
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+28
+10
+00
+78
+CC
+70
+3C
+CC
+78
+ENDCHAR
+STARTCHAR Ydieresis
+ENCODING -1
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 8 8 0 0
+BITMAP
+14
+00
+C3
+66
+3C
+18
+18
+18
+ENDCHAR
+STARTCHAR Zcaron
+ENCODING -1
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+28
+10
+00
+FC
+18
+30
+60
+C0
+FC
+ENDCHAR
+STARTCHAR breve
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 4 2 0 6
+BITMAP
+90
+60
+ENDCHAR
+STARTCHAR bullet
+ENCODING -1
+SWIDTH 350 0
+DWIDTH 4 0
+BBX 2 2 1 2
+BITMAP
+C0
+C0
+ENDCHAR
+STARTCHAR caron
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 2 0 6
+BITMAP
+A0
+40
+ENDCHAR
+STARTCHAR circumflex
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 2 0 6
+BITMAP
+40
+A0
+ENDCHAR
+STARTCHAR dagger
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 10 0 -2
+BITMAP
+30
+30
+FC
+30
+30
+30
+30
+30
+30
+30
+ENDCHAR
+STARTCHAR daggerdbl
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 10 0 -2
+BITMAP
+30
+30
+FC
+30
+30
+30
+FC
+30
+30
+30
+ENDCHAR
+STARTCHAR dotaccent
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 2 0
+BBX 1 1 0 7
+BITMAP
+80
+ENDCHAR
+STARTCHAR dotlessi
+ENCODING -1
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 6 0 0
+BITMAP
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR ellipsis
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 10 0
+BBX 8 1 1 0
+BITMAP
+DB
+ENDCHAR
+STARTCHAR emdash
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 10 0
+BBX 10 1 0 3
+BITMAP
+FFC0
+ENDCHAR
+STARTCHAR endash
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 1 0 3
+BITMAP
+FC
+ENDCHAR
+STARTCHAR fi
+ENCODING -1
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 7 8 -1 0
+BITMAP
+36
+60
+F6
+66
+66
+66
+66
+66
+ENDCHAR
+STARTCHAR fl
+ENCODING -1
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 7 8 -1 0
+BITMAP
+36
+66
+F6
+66
+66
+66
+66
+66
+ENDCHAR
+STARTCHAR florin
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 9 0 -2
+BITMAP
+38
+60
+F8
+60
+60
+60
+60
+60
+C0
+ENDCHAR
+STARTCHAR fraction
+ENCODING -1
+SWIDTH 167 0
+DWIDTH 4 0
+BBX 5 7 -1 0
+BITMAP
+08
+10
+10
+20
+40
+40
+80
+ENDCHAR
+STARTCHAR grave
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 2 2 0 6
+BITMAP
+80
+40
+ENDCHAR
+STARTCHAR guilsinglleft
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 3 3 1 1
+BITMAP
+60
+C0
+60
+ENDCHAR
+STARTCHAR guilsinglright
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 3 3 1 1
+BITMAP
+C0
+60
+C0
+ENDCHAR
+STARTCHAR hungarumlaut
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 4 2 0 6
+BITMAP
+50
+A0
+ENDCHAR
+STARTCHAR lslash
+ENCODING -1
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 4 8 -1 0
+BITMAP
+60
+60
+60
+70
+E0
+60
+60
+60
+ENDCHAR
+STARTCHAR oe
+ENCODING -1
+SWIDTH 944 0
+DWIDTH 10 0
+BBX 9 6 0 0
+BITMAP
+7700
+CD80
+CF80
+CC00
+CD80
+7700
+ENDCHAR
+STARTCHAR ogonek
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 2 2 0 -2
+BITMAP
+80
+C0
+ENDCHAR
+STARTCHAR perthousand
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 11 0
+BBX 10 7 0 0
+BITMAP
+6200
+B400
+6800
+1000
+2D80
+56C0
+8D80
+ENDCHAR
+STARTCHAR quotedblbase
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 6 0
+BBX 5 3 0 -2
+BITMAP
+D8
+48
+90
+ENDCHAR
+STARTCHAR quotedblleft
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 6 0
+BBX 5 3 0 5
+BITMAP
+48
+90
+D8
+ENDCHAR
+STARTCHAR quotedblright
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 6 0
+BBX 5 3 0 5
+BITMAP
+D8
+48
+90
+ENDCHAR
+STARTCHAR quotesinglbase
+ENCODING -1
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 3 0 -2
+BITMAP
+C0
+40
+80
+ENDCHAR
+STARTCHAR quotesingle
+ENCODING -1
+SWIDTH 238 0
+DWIDTH 3 0
+BBX 1 3 1 5
+BITMAP
+80
+80
+80
+ENDCHAR
+STARTCHAR ring
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 3 0 5
+BITMAP
+40
+A0
+40
+ENDCHAR
+STARTCHAR scaron
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+50
+20
+00
+70
+D8
+70
+18
+D8
+70
+ENDCHAR
+STARTCHAR tilde
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 4 2 0 6
+BITMAP
+50
+A0
+ENDCHAR
+STARTCHAR trademark
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 11 0
+BBX 9 4 1 3
+BITMAP
+E880
+4D80
+4A80
+4A80
+ENDCHAR
+STARTCHAR zcaron
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 5 0
+BBX 5 9 0 0
+BITMAP
+50
+20
+00
+F8
+18
+30
+60
+C0
+F8
+ENDCHAR
+ENDFONT
diff -urN lib/microwindows/src/fonts/helvB10.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/helvB10.c
--- lib/microwindows/src/fonts/helvB10.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/helvB10.c	2005-02-21 16:03:26.000000000 +0100
@@ -0,0 +1,2980 @@
+/* Generated by convbdf on Tue Oct  3 00:24:22 MDT 2000. */
+#include "device.h"
+
+/* Font information:
+
+   name: -Adobe-Helvetica-Bold-R-Normal--10-100-75-75-P-60-ISO8859-1
+   pixel size: 10
+   ascent: 10
+   descent: 2
+*/
+
+/* Font character bitmap data. */
+static MWIMAGEBITS helvB10_bits[] = {
+
+/* Character (0x20):
+   bbw=1, bbh=1, bbx=0, bby=0, width=3
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x21):
+   bbw=2, bbh=8, bbx=1, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | *              |
+   | *              |
+   |                |
+   | **             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x4000, 
+0x4000, 
+0x0000, 
+0x6000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x22):
+   bbw=3, bbh=3, bbx=1, bby=5, width=5
+   +----------------+
+   |                |
+   |                |
+   | * *            |
+   | * *            |
+   | * *            |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x5000, 
+0x5000, 
+0x5000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x23):
+   bbw=6, bbh=7, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   | * *            |
+   | * *            |
+   |******          |
+   | * *            |
+   |*****           |
+   |* *             |
+   |* *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x5000, 
+0x5000, 
+0xfc00, 
+0x5000, 
+0xf800, 
+0xa000, 
+0xa000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x24):
+   bbw=5, bbh=9, bbx=0, bby=-1, width=6
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   | ***            |
+   |* * *           |
+   |***             |
+   | ***            |
+   |  ***           |
+   |* * *           |
+   | ***            |
+   |  *             |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x7000, 
+0xa800, 
+0xe000, 
+0x7000, 
+0x3800, 
+0xa800, 
+0x7000, 
+0x2000, 
+0x0000, 
+
+/* Character (0x25):
+   bbw=7, bbh=8, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   | **   *         |
+   |* ** *          |
+   | ** *           |
+   |   *            |
+   |   *            |
+   |  * **          |
+   | * * **         |
+   |*   **          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6200, 
+0xb400, 
+0x6800, 
+0x1000, 
+0x1000, 
+0x2c00, 
+0x5600, 
+0x8c00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x26):
+   bbw=7, bbh=8, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |** **           |
+   |** **           |
+   | ***            |
+   |** ****         |
+   |**  **          |
+   |** ***          |
+   | *** **         |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0xd800, 
+0xd800, 
+0x7000, 
+0xde00, 
+0xcc00, 
+0xdc00, 
+0x7600, 
+0x0000, 
+0x0000, 
+
+/* Character (0x27):
+   bbw=2, bbh=3, bbx=0, bby=5, width=3
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   | *              |
+   |*               |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0x4000, 
+0x8000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x28):
+   bbw=3, bbh=10, bbx=0, bby=-2, width=4
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   | **             |
+   | *              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   | *              |
+   | **             |
+   |  *             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x6000, 
+0x4000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0x4000, 
+0x6000, 
+0x2000, 
+
+/* Character (0x29):
+   bbw=3, bbh=10, bbx=0, bby=-2, width=4
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   |**              |
+   | *              |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | *              |
+   |**              |
+   |*               |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0xc000, 
+0x4000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x4000, 
+0xc000, 
+0x8000, 
+
+/* Character (0x2a):
+   bbw=3, bbh=3, bbx=0, bby=5, width=4
+   +----------------+
+   |                |
+   |                |
+   |* *             |
+   | *              |
+   |* *             |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xa000, 
+0x4000, 
+0xa000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2b):
+   bbw=6, bbh=5, bbx=0, bby=1, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |  **            |
+   |  **            |
+   |******          |
+   |  **            |
+   |  **            |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x3000, 
+0x3000, 
+0xfc00, 
+0x3000, 
+0x3000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2c):
+   bbw=2, bbh=4, bbx=0, bby=-2, width=3
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | *              |
+   | *              |
+   | *              |
+   |*               |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x8000, 
+
+/* Character (0x2d):
+   bbw=5, bbh=1, bbx=1, bby=3, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | *****          |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7c00, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2e):
+   bbw=1, bbh=2, bbx=1, bby=0, width=3
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | *              |
+   | *              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x4000, 
+0x4000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2f):
+   bbw=4, bbh=8, bbx=0, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   |   *            |
+   |   *            |
+   |  *             |
+   |  *             |
+   | *              |
+   | *              |
+   |*               |
+   |*               |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1000, 
+0x1000, 
+0x2000, 
+0x2000, 
+0x4000, 
+0x4000, 
+0x8000, 
+0x8000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x30):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |** **           |
+   |** **           |
+   |** **           |
+   |** **           |
+   |** **           |
+   |** **           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0xd800, 
+0xd800, 
+0xd800, 
+0xd800, 
+0xd800, 
+0xd800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x31):
+   bbw=4, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |  **            |
+   |****            |
+   |  **            |
+   |  **            |
+   |  **            |
+   |  **            |
+   |  **            |
+   |  **            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3000, 
+0xf000, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x32):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |** **           |
+   |   **           |
+   |   **           |
+   |  **            |
+   | **             |
+   |**              |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0xd800, 
+0x1800, 
+0x1800, 
+0x3000, 
+0x6000, 
+0xc000, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x33):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |** **           |
+   |   **           |
+   |  **            |
+   |   **           |
+   |   **           |
+   |** **           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0xd800, 
+0x1800, 
+0x3000, 
+0x1800, 
+0x1800, 
+0xd800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x34):
+   bbw=6, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |   **           |
+   |  ***           |
+   | * **           |
+   | * **           |
+   |*  **           |
+   |******          |
+   |   **           |
+   |   **           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1800, 
+0x3800, 
+0x5800, 
+0x5800, 
+0x9800, 
+0xfc00, 
+0x1800, 
+0x1800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x35):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |**              |
+   |**              |
+   |****            |
+   |   **           |
+   |*  **           |
+   |** **           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0xc000, 
+0xc000, 
+0xf000, 
+0x1800, 
+0x9800, 
+0xd800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x36):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |** **           |
+   |**              |
+   |****            |
+   |** **           |
+   |** **           |
+   |** **           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0xd800, 
+0xc000, 
+0xf000, 
+0xd800, 
+0xd800, 
+0xd800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x37):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |   **           |
+   |   **           |
+   |  **            |
+   |  **            |
+   |  **            |
+   | **             |
+   | **             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0x1800, 
+0x1800, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x6000, 
+0x6000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x38):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |** **           |
+   |** **           |
+   | ***            |
+   |** **           |
+   |** **           |
+   |** **           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0xd800, 
+0xd800, 
+0x7000, 
+0xd800, 
+0xd800, 
+0xd800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x39):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |** **           |
+   |** **           |
+   |** **           |
+   | ****           |
+   |   **           |
+   |** **           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0xd800, 
+0xd800, 
+0xd800, 
+0x7800, 
+0x1800, 
+0xd800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3a):
+   bbw=1, bbh=6, bbx=1, bby=0, width=3
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | *              |
+   | *              |
+   |                |
+   |                |
+   | *              |
+   | *              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x4000, 
+0x4000, 
+0x0000, 
+0x0000, 
+0x4000, 
+0x4000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3b):
+   bbw=2, bbh=8, bbx=0, bby=-2, width=3
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | *              |
+   | *              |
+   |                |
+   |                |
+   | *              |
+   | *              |
+   | *              |
+   |*               |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x4000, 
+0x4000, 
+0x0000, 
+0x0000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x8000, 
+
+/* Character (0x3c):
+   bbw=4, bbh=5, bbx=0, bby=1, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |  **            |
+   | **             |
+   |**              |
+   | **             |
+   |  **            |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x3000, 
+0x6000, 
+0xc000, 
+0x6000, 
+0x3000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3d):
+   bbw=5, bbh=3, bbx=0, bby=2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |*****           |
+   |                |
+   |*****           |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xf800, 
+0x0000, 
+0xf800, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3e):
+   bbw=4, bbh=5, bbx=0, bby=1, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |**              |
+   | **             |
+   |  **            |
+   | **             |
+   |**              |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xc000, 
+0x6000, 
+0x3000, 
+0x6000, 
+0xc000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3f):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |** **           |
+   |   **           |
+   |  **            |
+   | **             |
+   | **             |
+   |                |
+   | **             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0xd800, 
+0x1800, 
+0x3000, 
+0x6000, 
+0x6000, 
+0x0000, 
+0x6000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x40):
+   bbw=10, bbh=9, bbx=0, bby=-2, width=11
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |   *****        |
+   | **     *       |
+   | *  ** * *      |
+   |*  *  *  *      |
+   |* *   *  *      |
+   |* *  *  *       |
+   |*  ** **        |
+   | *              |
+   |  *****         |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x1f00, 
+0x6080, 
+0x4d40, 
+0x9240, 
+0xa240, 
+0xa480, 
+0x9b00, 
+0x4000, 
+0x3e00, 
+
+/* Character (0x41):
+   bbw=7, bbh=8, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |  ***           |
+   |  ***           |
+   | ** **          |
+   | ** **          |
+   | ** **          |
+   |*******         |
+   |**   **         |
+   |**   **         |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3800, 
+0x3800, 
+0x6c00, 
+0x6c00, 
+0x6c00, 
+0xfe00, 
+0xc600, 
+0xc600, 
+0x0000, 
+0x0000, 
+
+/* Character (0x42):
+   bbw=6, bbh=8, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |**  **          |
+   |**  **          |
+   |*****           |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0xcc00, 
+0xcc00, 
+0xf800, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x43):
+   bbw=7, bbh=8, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |  ****          |
+   | **  **         |
+   |**    *         |
+   |**              |
+   |**              |
+   |**    *         |
+   | **  **         |
+   |  ****          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3c00, 
+0x6600, 
+0xc200, 
+0xc000, 
+0xc000, 
+0xc200, 
+0x6600, 
+0x3c00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x44):
+   bbw=6, bbh=8, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |****            |
+   |** **           |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |** **           |
+   |****            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf000, 
+0xd800, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xd800, 
+0xf000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x45):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |**              |
+   |**              |
+   |*****           |
+   |**              |
+   |**              |
+   |**              |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0xc000, 
+0xc000, 
+0xf800, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x46):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |**              |
+   |**              |
+   |****            |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0xc000, 
+0xc000, 
+0xf000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x47):
+   bbw=7, bbh=8, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |  ****          |
+   | **  **         |
+   |**    *         |
+   |**              |
+   |**  ***         |
+   |**   **         |
+   | **  **         |
+   |  *** *         |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3c00, 
+0x6600, 
+0xc200, 
+0xc000, 
+0xce00, 
+0xc600, 
+0x6600, 
+0x3a00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x48):
+   bbw=6, bbh=8, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |******          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xfc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x49):
+   bbw=2, bbh=8, bbx=0, bby=0, width=3
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4a):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |   **           |
+   |   **           |
+   |   **           |
+   |   **           |
+   |   **           |
+   |   **           |
+   |** **           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x1800, 
+0xd800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4b):
+   bbw=7, bbh=8, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |**  **          |
+   |** **           |
+   |****            |
+   |***             |
+   |****            |
+   |** **           |
+   |**  **          |
+   |**   **         |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xcc00, 
+0xd800, 
+0xf000, 
+0xe000, 
+0xf000, 
+0xd800, 
+0xcc00, 
+0xc600, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4c):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4d):
+   bbw=9, bbh=8, bbx=0, bby=0, width=10
+   +----------------+
+   |                |
+   |                |
+   |**     **       |
+   |***   ***       |
+   |***   ***       |
+   |**** ****       |
+   |** * * **       |
+   |** *** **       |
+   |**  *  **       |
+   |**  *  **       |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc180, 
+0xe380, 
+0xe380, 
+0xf780, 
+0xd580, 
+0xdd80, 
+0xc980, 
+0xc980, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4e):
+   bbw=7, bbh=8, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |**   **         |
+   |***  **         |
+   |***  **         |
+   |** * **         |
+   |** * **         |
+   |**  ***         |
+   |**  ***         |
+   |**   **         |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc600, 
+0xe600, 
+0xe600, 
+0xd600, 
+0xd600, 
+0xce00, 
+0xce00, 
+0xc600, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4f):
+   bbw=7, bbh=8, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |  ***           |
+   | ** **          |
+   |**   **         |
+   |**   **         |
+   |**   **         |
+   |**   **         |
+   | ** **          |
+   |  ***           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3800, 
+0x6c00, 
+0xc600, 
+0xc600, 
+0xc600, 
+0xc600, 
+0x6c00, 
+0x3800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x50):
+   bbw=6, bbh=8, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |*****           |
+   |**              |
+   |**              |
+   |**              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xf800, 
+0xc000, 
+0xc000, 
+0xc000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x51):
+   bbw=7, bbh=9, bbx=0, bby=-1, width=8
+   +----------------+
+   |                |
+   |                |
+   |  ***           |
+   | ** **          |
+   |**   **         |
+   |**   **         |
+   |**   **         |
+   |** * **         |
+   | ** **          |
+   |  ****          |
+   |      *         |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3800, 
+0x6c00, 
+0xc600, 
+0xc600, 
+0xc600, 
+0xd600, 
+0x6c00, 
+0x3c00, 
+0x0200, 
+0x0000, 
+
+/* Character (0x52):
+   bbw=6, bbh=8, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |*****           |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xf800, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x53):
+   bbw=6, bbh=8, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | ****           |
+   |**  **          |
+   |***             |
+   | ****           |
+   |   ***          |
+   |*   **          |
+   |**  **          |
+   | ****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7800, 
+0xcc00, 
+0xe000, 
+0x7800, 
+0x1c00, 
+0x8c00, 
+0xcc00, 
+0x7800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x54):
+   bbw=6, bbh=8, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |******          |
+   |  **            |
+   |  **            |
+   |  **            |
+   |  **            |
+   |  **            |
+   |  **            |
+   |  **            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xfc00, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x55):
+   bbw=6, bbh=8, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   | ****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0x7800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x56):
+   bbw=7, bbh=8, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |**   **         |
+   |**   **         |
+   | ** **          |
+   | ** **          |
+   | ** **          |
+   |  ***           |
+   |  ***           |
+   |   *            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc600, 
+0xc600, 
+0x6c00, 
+0x6c00, 
+0x6c00, 
+0x3800, 
+0x3800, 
+0x1000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x57):
+   bbw=10, bbh=8, bbx=0, bby=0, width=11
+   +----------------+
+   |                |
+   |                |
+   |**  **  **      |
+   |**  **  **      |
+   |**  **  **      |
+   | ** ** **       |
+   | ** ** **       |
+   | ********       |
+   |  **  **        |
+   |  *    *        |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xccc0, 
+0xccc0, 
+0xccc0, 
+0x6d80, 
+0x6d80, 
+0x7f80, 
+0x3300, 
+0x2100, 
+0x0000, 
+0x0000, 
+
+/* Character (0x58):
+   bbw=7, bbh=8, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |**   **         |
+   |**   **         |
+   | ** **          |
+   |  ***           |
+   |  ***           |
+   | ** **          |
+   |**   **         |
+   |**   **         |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc600, 
+0xc600, 
+0x6c00, 
+0x3800, 
+0x3800, 
+0x6c00, 
+0xc600, 
+0xc600, 
+0x0000, 
+0x0000, 
+
+/* Character (0x59):
+   bbw=8, bbh=8, bbx=0, bby=0, width=9
+   +----------------+
+   |                |
+   |                |
+   |**    **        |
+   |**    **        |
+   | **  **         |
+   | **  **         |
+   |  ****          |
+   |   **           |
+   |   **           |
+   |   **           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc300, 
+0xc300, 
+0x6600, 
+0x6600, 
+0x3c00, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5a):
+   bbw=6, bbh=8, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |******          |
+   |    **          |
+   |   **           |
+   |  **            |
+   | ***            |
+   | **             |
+   |**              |
+   |******          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xfc00, 
+0x0c00, 
+0x1800, 
+0x3000, 
+0x7000, 
+0x6000, 
+0xc000, 
+0xfc00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5b):
+   bbw=3, bbh=10, bbx=0, bby=-2, width=4
+   +----------------+
+   |                |
+   |                |
+   |***             |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |***             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xe000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xe000, 
+
+/* Character (0x5c):
+   bbw=4, bbh=8, bbx=0, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   |*               |
+   | *              |
+   | *              |
+   |  *             |
+   |  *             |
+   |   *            |
+   |   *            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0x8000, 
+0x4000, 
+0x4000, 
+0x2000, 
+0x2000, 
+0x1000, 
+0x1000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5d):
+   bbw=3, bbh=10, bbx=0, bby=-2, width=4
+   +----------------+
+   |                |
+   |                |
+   |***             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   |***             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xe000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0xe000, 
+
+/* Character (0x5e):
+   bbw=5, bbh=4, bbx=0, bby=4, width=5
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   | ***            |
+   |** **           |
+   |*   *           |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x7000, 
+0xd800, 
+0x8800, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5f):
+   bbw=6, bbh=1, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |******          |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xfc00, 
+
+/* Character (0x60):
+   bbw=2, bbh=3, bbx=0, bby=5, width=3
+   +----------------+
+   |                |
+   |                |
+   | *              |
+   |*               |
+   |**              |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4000, 
+0x8000, 
+0xc000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x61):
+   bbw=6, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ***            |
+   |*  **           |
+   | ****           |
+   |** **           |
+   |** **           |
+   | ** **          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7000, 
+0x9800, 
+0x7800, 
+0xd800, 
+0xd800, 
+0x6c00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x62):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |**              |
+   |****            |
+   |** **           |
+   |**  *           |
+   |**  *           |
+   |** **           |
+   |****            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0xc000, 
+0xf000, 
+0xd800, 
+0xc800, 
+0xc800, 
+0xd800, 
+0xf000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x63):
+   bbw=4, bbh=6, bbx=0, bby=0, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ***            |
+   |** *            |
+   |**              |
+   |**              |
+   |** *            |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7000, 
+0xd000, 
+0xc000, 
+0xc000, 
+0xd000, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x64):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |   **           |
+   |   **           |
+   | ****           |
+   |** **           |
+   |*  **           |
+   |*  **           |
+   |** **           |
+   | ****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1800, 
+0x1800, 
+0x7800, 
+0xd800, 
+0x9800, 
+0x9800, 
+0xd800, 
+0x7800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x65):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ***            |
+   |** **           |
+   |*****           |
+   |**              |
+   |** **           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7000, 
+0xd800, 
+0xf800, 
+0xc000, 
+0xd800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x66):
+   bbw=4, bbh=8, bbx=0, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |**              |
+   |***             |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0xc000, 
+0xe000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x67):
+   bbw=5, bbh=8, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ** *           |
+   |** **           |
+   |*  **           |
+   |*  **           |
+   |** **           |
+   | ****           |
+   |   **           |
+   | ***            |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6800, 
+0xd800, 
+0x9800, 
+0x9800, 
+0xd800, 
+0x7800, 
+0x1800, 
+0x7000, 
+
+/* Character (0x68):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |**              |
+   |****            |
+   |** **           |
+   |** **           |
+   |** **           |
+   |** **           |
+   |** **           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0xc000, 
+0xf000, 
+0xd800, 
+0xd800, 
+0xd800, 
+0xd800, 
+0xd800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x69):
+   bbw=2, bbh=8, bbx=0, bby=0, width=3
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |                |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0x0000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6a):
+   bbw=2, bbh=10, bbx=0, bby=-2, width=3
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |                |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |*               |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0x0000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0x8000, 
+
+/* Character (0x6b):
+   bbw=6, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |**              |
+   |** **           |
+   |****            |
+   |***             |
+   |****            |
+   |** **           |
+   |**  **          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0xc000, 
+0xd800, 
+0xf000, 
+0xe000, 
+0xf000, 
+0xd800, 
+0xcc00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6c):
+   bbw=2, bbh=8, bbx=0, bby=0, width=3
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6d):
+   bbw=8, bbh=6, bbx=0, bby=0, width=9
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |* ** **         |
+   |** ** **        |
+   |** ** **        |
+   |** ** **        |
+   |** ** **        |
+   |** ** **        |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xb600, 
+0xdb00, 
+0xdb00, 
+0xdb00, 
+0xdb00, 
+0xdb00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6e):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |* **            |
+   |** **           |
+   |** **           |
+   |** **           |
+   |** **           |
+   |** **           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xb000, 
+0xd800, 
+0xd800, 
+0xd800, 
+0xd800, 
+0xd800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6f):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ***            |
+   |** **           |
+   |** **           |
+   |** **           |
+   |** **           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7000, 
+0xd800, 
+0xd800, 
+0xd800, 
+0xd800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x70):
+   bbw=5, bbh=8, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |* **            |
+   |** **           |
+   |**  *           |
+   |**  *           |
+   |** **           |
+   |****            |
+   |**              |
+   |**              |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xb000, 
+0xd800, 
+0xc800, 
+0xc800, 
+0xd800, 
+0xf000, 
+0xc000, 
+0xc000, 
+
+/* Character (0x71):
+   bbw=5, bbh=8, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ** *           |
+   |** **           |
+   |*  **           |
+   |*  **           |
+   |** **           |
+   | ****           |
+   |   **           |
+   |   **           |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6800, 
+0xd800, 
+0x9800, 
+0x9800, 
+0xd800, 
+0x7800, 
+0x1800, 
+0x1800, 
+
+/* Character (0x72):
+   bbw=4, bbh=6, bbx=0, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |* **            |
+   |***             |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xb000, 
+0xe000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x73):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ***            |
+   |** **           |
+   | ***            |
+   |   **           |
+   |** **           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7000, 
+0xd800, 
+0x7000, 
+0x1800, 
+0xd800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x74):
+   bbw=3, bbh=8, bbx=0, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |**              |
+   |***             |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   | **             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0xc000, 
+0xe000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0x6000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x75):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |** **           |
+   |** **           |
+   |** **           |
+   |** **           |
+   |** **           |
+   | ** *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xd800, 
+0xd800, 
+0xd800, 
+0xd800, 
+0xd800, 
+0x6800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x76):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |** **           |
+   |** **           |
+   |** **           |
+   | * *            |
+   | ***            |
+   |  *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xd800, 
+0xd800, 
+0xd800, 
+0x5000, 
+0x7000, 
+0x2000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x77):
+   bbw=7, bbh=6, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |** * **         |
+   |** * **         |
+   |** * **         |
+   | ** **          |
+   | ** **          |
+   | ** **          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xd600, 
+0xd600, 
+0xd600, 
+0x6c00, 
+0x6c00, 
+0x6c00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x78):
+   bbw=6, bbh=6, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |**  **          |
+   | ****           |
+   |  **            |
+   | ****           |
+   |**  **          |
+   |**  **          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xcc00, 
+0x7800, 
+0x3000, 
+0x7800, 
+0xcc00, 
+0xcc00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x79):
+   bbw=5, bbh=8, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |** **           |
+   |** **           |
+   |** **           |
+   |** **           |
+   | ****           |
+   |  **            |
+   |  **            |
+   | **             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xd800, 
+0xd800, 
+0xd800, 
+0xd800, 
+0x7800, 
+0x3000, 
+0x3000, 
+0x6000, 
+
+/* Character (0x7a):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |*****           |
+   |   **           |
+   |  **            |
+   | **             |
+   |**              |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xf800, 
+0x1800, 
+0x3000, 
+0x6000, 
+0xc000, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x7b):
+   bbw=4, bbh=10, bbx=0, bby=-2, width=5
+   +----------------+
+   |                |
+   |                |
+   |  **            |
+   | **             |
+   | **             |
+   | **             |
+   |**              |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   |  **            |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0xc000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x3000, 
+
+/* Character (0x7c):
+   bbw=1, bbh=10, bbx=1, bby=-2, width=3
+   +----------------+
+   |                |
+   |                |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+
+/* Character (0x7d):
+   bbw=4, bbh=10, bbx=0, bby=-2, width=5
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   | **             |
+   | **             |
+   | **             |
+   |  **            |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   |**              |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x3000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0xc000, 
+
+/* Character (0x7e):
+   bbw=6, bbh=2, bbx=0, bby=2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | ** **          |
+   |** **           |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6c00, 
+0xd800, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+};
+
+/* Character->glyph data. */
+static unsigned short helvB10_offset[] = {
+  0,	/* (0x20) */
+  12,	/* (0x21) */
+  24,	/* (0x22) */
+  36,	/* (0x23) */
+  48,	/* (0x24) */
+  60,	/* (0x25) */
+  72,	/* (0x26) */
+  84,	/* (0x27) */
+  96,	/* (0x28) */
+  108,	/* (0x29) */
+  120,	/* (0x2a) */
+  132,	/* (0x2b) */
+  144,	/* (0x2c) */
+  156,	/* (0x2d) */
+  168,	/* (0x2e) */
+  180,	/* (0x2f) */
+  192,	/* (0x30) */
+  204,	/* (0x31) */
+  216,	/* (0x32) */
+  228,	/* (0x33) */
+  240,	/* (0x34) */
+  252,	/* (0x35) */
+  264,	/* (0x36) */
+  276,	/* (0x37) */
+  288,	/* (0x38) */
+  300,	/* (0x39) */
+  312,	/* (0x3a) */
+  324,	/* (0x3b) */
+  336,	/* (0x3c) */
+  348,	/* (0x3d) */
+  360,	/* (0x3e) */
+  372,	/* (0x3f) */
+  384,	/* (0x40) */
+  396,	/* (0x41) */
+  408,	/* (0x42) */
+  420,	/* (0x43) */
+  432,	/* (0x44) */
+  444,	/* (0x45) */
+  456,	/* (0x46) */
+  468,	/* (0x47) */
+  480,	/* (0x48) */
+  492,	/* (0x49) */
+  504,	/* (0x4a) */
+  516,	/* (0x4b) */
+  528,	/* (0x4c) */
+  540,	/* (0x4d) */
+  552,	/* (0x4e) */
+  564,	/* (0x4f) */
+  576,	/* (0x50) */
+  588,	/* (0x51) */
+  600,	/* (0x52) */
+  612,	/* (0x53) */
+  624,	/* (0x54) */
+  636,	/* (0x55) */
+  648,	/* (0x56) */
+  660,	/* (0x57) */
+  672,	/* (0x58) */
+  684,	/* (0x59) */
+  696,	/* (0x5a) */
+  708,	/* (0x5b) */
+  720,	/* (0x5c) */
+  732,	/* (0x5d) */
+  744,	/* (0x5e) */
+  756,	/* (0x5f) */
+  768,	/* (0x60) */
+  780,	/* (0x61) */
+  792,	/* (0x62) */
+  804,	/* (0x63) */
+  816,	/* (0x64) */
+  828,	/* (0x65) */
+  840,	/* (0x66) */
+  852,	/* (0x67) */
+  864,	/* (0x68) */
+  876,	/* (0x69) */
+  888,	/* (0x6a) */
+  900,	/* (0x6b) */
+  912,	/* (0x6c) */
+  924,	/* (0x6d) */
+  936,	/* (0x6e) */
+  948,	/* (0x6f) */
+  960,	/* (0x70) */
+  972,	/* (0x71) */
+  984,	/* (0x72) */
+  996,	/* (0x73) */
+  1008,	/* (0x74) */
+  1020,	/* (0x75) */
+  1032,	/* (0x76) */
+  1044,	/* (0x77) */
+  1056,	/* (0x78) */
+  1068,	/* (0x79) */
+  1080,	/* (0x7a) */
+  1092,	/* (0x7b) */
+  1104,	/* (0x7c) */
+  1116,	/* (0x7d) */
+  1128,	/* (0x7e) */
+};
+
+/* Character width data. */
+static unsigned char helvB10_width[] = {
+  3,	/* (0x20) */
+  4,	/* (0x21) */
+  5,	/* (0x22) */
+  6,	/* (0x23) */
+  6,	/* (0x24) */
+  8,	/* (0x25) */
+  8,	/* (0x26) */
+  3,	/* (0x27) */
+  4,	/* (0x28) */
+  4,	/* (0x29) */
+  4,	/* (0x2a) */
+  6,	/* (0x2b) */
+  3,	/* (0x2c) */
+  7,	/* (0x2d) */
+  3,	/* (0x2e) */
+  4,	/* (0x2f) */
+  6,	/* (0x30) */
+  6,	/* (0x31) */
+  6,	/* (0x32) */
+  6,	/* (0x33) */
+  6,	/* (0x34) */
+  6,	/* (0x35) */
+  6,	/* (0x36) */
+  6,	/* (0x37) */
+  6,	/* (0x38) */
+  6,	/* (0x39) */
+  3,	/* (0x3a) */
+  3,	/* (0x3b) */
+  5,	/* (0x3c) */
+  6,	/* (0x3d) */
+  5,	/* (0x3e) */
+  6,	/* (0x3f) */
+  11,	/* (0x40) */
+  8,	/* (0x41) */
+  7,	/* (0x42) */
+  8,	/* (0x43) */
+  7,	/* (0x44) */
+  6,	/* (0x45) */
+  6,	/* (0x46) */
+  8,	/* (0x47) */
+  7,	/* (0x48) */
+  3,	/* (0x49) */
+  6,	/* (0x4a) */
+  7,	/* (0x4b) */
+  6,	/* (0x4c) */
+  10,	/* (0x4d) */
+  8,	/* (0x4e) */
+  8,	/* (0x4f) */
+  7,	/* (0x50) */
+  8,	/* (0x51) */
+  7,	/* (0x52) */
+  7,	/* (0x53) */
+  7,	/* (0x54) */
+  7,	/* (0x55) */
+  8,	/* (0x56) */
+  11,	/* (0x57) */
+  8,	/* (0x58) */
+  9,	/* (0x59) */
+  7,	/* (0x5a) */
+  4,	/* (0x5b) */
+  4,	/* (0x5c) */
+  4,	/* (0x5d) */
+  5,	/* (0x5e) */
+  6,	/* (0x5f) */
+  3,	/* (0x60) */
+  6,	/* (0x61) */
+  6,	/* (0x62) */
+  5,	/* (0x63) */
+  6,	/* (0x64) */
+  6,	/* (0x65) */
+  4,	/* (0x66) */
+  6,	/* (0x67) */
+  6,	/* (0x68) */
+  3,	/* (0x69) */
+  3,	/* (0x6a) */
+  6,	/* (0x6b) */
+  3,	/* (0x6c) */
+  9,	/* (0x6d) */
+  6,	/* (0x6e) */
+  6,	/* (0x6f) */
+  6,	/* (0x70) */
+  6,	/* (0x71) */
+  4,	/* (0x72) */
+  6,	/* (0x73) */
+  4,	/* (0x74) */
+  6,	/* (0x75) */
+  6,	/* (0x76) */
+  8,	/* (0x77) */
+  7,	/* (0x78) */
+  6,	/* (0x79) */
+  6,	/* (0x7a) */
+  5,	/* (0x7b) */
+  3,	/* (0x7c) */
+  5,	/* (0x7d) */
+  6,	/* (0x7e) */
+};
+
+/* Exported structure definition. */
+MWCFONT font_helvB10 = {
+  "helvB10",
+  11,
+  12,
+  10,
+  32,
+  95,
+  helvB10_bits,
+  helvB10_offset,
+  helvB10_width,
+};
diff -urN lib/microwindows/src/fonts/helvB12.bdf /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/helvB12.bdf
--- lib/microwindows/src/fonts/helvB12.bdf	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/helvB12.bdf	2005-02-21 16:03:26.000000000 +0100
@@ -0,0 +1,3522 @@
+STARTFONT 2.1
+FONT -Adobe-Helvetica-Bold-R-Normal--12-120-75-75-P-70-ISO8859-1
+SIZE 12 75 75
+FONTBOUNDINGBOX 14 15 -1 -3
+COMMENT $XConsortium: helvB12.bdf,v 1.13 95/01/26 18:01:34 gildea Exp $
+COMMENT 
+COMMENT +
+COMMENT  Copyright 1984-1989, 1994 Adobe Systems Incorporated.
+COMMENT  Copyright 1988, 1994 Digital Equipment Corporation.
+COMMENT
+COMMENT  Adobe is a trademark of Adobe Systems Incorporated which may be
+COMMENT  registered in certain jurisdictions.
+COMMENT  Permission to use these trademarks is hereby granted only in
+COMMENT  association with the images described in this file.
+COMMENT
+COMMENT  Permission to use, copy, modify, distribute and sell this software
+COMMENT  and its documentation for any purpose and without fee is hereby
+COMMENT  granted, provided that the above copyright notices appear in all
+COMMENT  copies and that both those copyright notices and this permission
+COMMENT  notice appear in supporting documentation, and that the names of
+COMMENT  Adobe Systems and Digital Equipment Corporation not be used in
+COMMENT  advertising or publicity pertaining to distribution of the software
+COMMENT  without specific, written prior permission.  Adobe Systems and
+COMMENT  Digital Equipment Corporation make no representations about the
+COMMENT  suitability of this software for any purpose.  It is provided "as
+COMMENT  is" without express or implied warranty.
+COMMENT -
+STARTPROPERTIES 28
+FOUNDRY "Adobe"
+FAMILY_NAME "Helvetica"
+WEIGHT_NAME "Bold"
+SLANT "R"
+SETWIDTH_NAME "Normal"
+ADD_STYLE_NAME ""
+PIXEL_SIZE 12
+POINT_SIZE 120
+RESOLUTION_X 75
+RESOLUTION_Y 75
+SPACING "P"
+AVERAGE_WIDTH 70
+CHARSET_REGISTRY "ISO8859"
+CHARSET_ENCODING "1"
+CAP_HEIGHT 9
+X_HEIGHT 7
+FONT_ASCENT 11
+FONT_DESCENT 3
+FACE_NAME "Helvetica Bold"
+COPYRIGHT "Copyright (c) 1984, 1987 Adobe Systems Incorporated. All Rights Reserved. Copyright (c) 1988, 1991 Digital Equipment Corporation. All Rights Reserved."
+NOTICE "Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries.  "
+_DEC_DEVICE_FONTNAMES "PS=Helvetica-Bold"
+_DEC_PRODUCTINFO "DECwindows Fonts V2.2, 07-Nov-1991"
+DEFAULT_CHAR 32
+RELATIVE_SETWIDTH 50
+RELATIVE_WEIGHT 70
+CHARSET_COLLECTIONS "ASCII ISO8859-1 ADOBE-STANDARD"
+FULL_NAME "Helvetica Bold"
+ENDPROPERTIES
+CHARS 229
+STARTCHAR space
+ENCODING 32
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 1 1 0 0
+BITMAP
+00
+ENDCHAR
+STARTCHAR exclam
+ENCODING 33
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 2 9 1 0
+BITMAP
+C0
+C0
+C0
+C0
+C0
+80
+00
+C0
+C0
+ENDCHAR
+STARTCHAR quotedbl
+ENCODING 34
+SWIDTH 474 0
+DWIDTH 5 0
+BBX 3 3 1 6
+BITMAP
+A0
+A0
+A0
+ENDCHAR
+STARTCHAR numbersign
+ENCODING 35
+SWIDTH 556 0
+DWIDTH 8 0
+BBX 7 8 0 0
+BITMAP
+14
+14
+7E
+28
+28
+FC
+50
+50
+ENDCHAR
+STARTCHAR dollar
+ENCODING 36
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 11 0 -2
+BITMAP
+10
+78
+D4
+D0
+78
+1C
+94
+D4
+78
+10
+10
+ENDCHAR
+STARTCHAR percent
+ENCODING 37
+SWIDTH 889 0
+DWIDTH 12 0
+BBX 11 9 0 0
+BITMAP
+7100
+DB00
+DA00
+7400
+0400
+09C0
+0B60
+1B60
+11C0
+ENDCHAR
+STARTCHAR ampersand
+ENCODING 38
+SWIDTH 722 0
+DWIDTH 9 0
+BBX 9 9 0 0
+BITMAP
+3800
+6C00
+6C00
+3800
+7900
+CF00
+C600
+CF00
+7980
+ENDCHAR
+STARTCHAR quoteright
+ENCODING 39
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 2 3 1 6
+BITMAP
+C0
+40
+80
+ENDCHAR
+STARTCHAR parenleft
+ENCODING 40
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 4 12 1 -3
+BITMAP
+30
+60
+60
+C0
+C0
+C0
+C0
+C0
+C0
+60
+60
+30
+ENDCHAR
+STARTCHAR parenright
+ENCODING 41
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 4 12 1 -3
+BITMAP
+C0
+60
+60
+30
+30
+30
+30
+30
+30
+60
+60
+C0
+ENDCHAR
+STARTCHAR asterisk
+ENCODING 42
+SWIDTH 389 0
+DWIDTH 6 0
+BBX 5 4 0 5
+BITMAP
+20
+F8
+70
+50
+ENDCHAR
+STARTCHAR plus
+ENCODING 43
+SWIDTH 584 0
+DWIDTH 7 0
+BBX 6 5 0 1
+BITMAP
+30
+30
+FC
+30
+30
+ENDCHAR
+STARTCHAR comma
+ENCODING 44
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 2 4 1 -2
+BITMAP
+C0
+C0
+40
+80
+ENDCHAR
+STARTCHAR minus
+ENCODING 45
+SWIDTH 584 0
+DWIDTH 8 0
+BBX 5 1 1 3
+BITMAP
+F8
+ENDCHAR
+STARTCHAR period
+ENCODING 46
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 2 2 1 0
+BITMAP
+C0
+C0
+ENDCHAR
+STARTCHAR slash
+ENCODING 47
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 4 9 0 0
+BITMAP
+30
+30
+20
+60
+60
+40
+40
+C0
+C0
+ENDCHAR
+STARTCHAR zero
+ENCODING 48
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+78
+CC
+CC
+CC
+CC
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR one
+ENCODING 49
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 4 9 0 0
+BITMAP
+30
+F0
+30
+30
+30
+30
+30
+30
+30
+ENDCHAR
+STARTCHAR two
+ENCODING 50
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+78
+CC
+0C
+18
+30
+60
+C0
+C0
+FC
+ENDCHAR
+STARTCHAR three
+ENCODING 51
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+78
+CC
+0C
+38
+0C
+0C
+0C
+CC
+78
+ENDCHAR
+STARTCHAR four
+ENCODING 52
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 7 9 0 0
+BITMAP
+0C
+1C
+2C
+2C
+4C
+8C
+FE
+0C
+0C
+ENDCHAR
+STARTCHAR five
+ENCODING 53
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+7C
+60
+C0
+F8
+0C
+0C
+CC
+CC
+78
+ENDCHAR
+STARTCHAR six
+ENCODING 54
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+78
+CC
+C0
+C0
+F8
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR seven
+ENCODING 55
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+FC
+0C
+18
+18
+30
+30
+30
+60
+60
+ENDCHAR
+STARTCHAR eight
+ENCODING 56
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+78
+CC
+CC
+78
+CC
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR nine
+ENCODING 57
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+78
+CC
+CC
+CC
+7C
+0C
+0C
+CC
+78
+ENDCHAR
+STARTCHAR colon
+ENCODING 58
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 2 7 1 0
+BITMAP
+C0
+C0
+00
+00
+00
+C0
+C0
+ENDCHAR
+STARTCHAR semicolon
+ENCODING 59
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 2 9 1 -2
+BITMAP
+C0
+C0
+00
+00
+00
+C0
+C0
+40
+80
+ENDCHAR
+STARTCHAR less
+ENCODING 60
+SWIDTH 584 0
+DWIDTH 7 0
+BBX 5 5 1 1
+BITMAP
+18
+70
+C0
+70
+18
+ENDCHAR
+STARTCHAR equal
+ENCODING 61
+SWIDTH 584 0
+DWIDTH 7 0
+BBX 6 3 0 2
+BITMAP
+FC
+00
+FC
+ENDCHAR
+STARTCHAR greater
+ENCODING 62
+SWIDTH 584 0
+DWIDTH 7 0
+BBX 5 5 1 1
+BITMAP
+C0
+70
+18
+70
+C0
+ENDCHAR
+STARTCHAR question
+ENCODING 63
+SWIDTH 611 0
+DWIDTH 8 0
+BBX 6 9 1 0
+BITMAP
+78
+CC
+CC
+18
+30
+30
+00
+30
+30
+ENDCHAR
+STARTCHAR at
+ENCODING 64
+SWIDTH 975 0
+DWIDTH 12 0
+BBX 10 10 1 -1
+BITMAP
+1F00
+6080
+4040
+8D40
+9240
+A240
+A680
+9B00
+4000
+3E00
+ENDCHAR
+STARTCHAR A
+ENCODING 65
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 8 9 0 0
+BITMAP
+18
+3C
+24
+66
+66
+7E
+C3
+C3
+C3
+ENDCHAR
+STARTCHAR B
+ENCODING 66
+SWIDTH 722 0
+DWIDTH 9 0
+BBX 7 9 1 0
+BITMAP
+FC
+C6
+C6
+C6
+FC
+C6
+C6
+C6
+FC
+ENDCHAR
+STARTCHAR C
+ENCODING 67
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 9 1 0
+BITMAP
+3C
+66
+C0
+C0
+C0
+C0
+C0
+66
+3C
+ENDCHAR
+STARTCHAR D
+ENCODING 68
+SWIDTH 722 0
+DWIDTH 9 0
+BBX 7 9 1 0
+BITMAP
+F8
+CC
+C6
+C6
+C6
+C6
+C6
+CC
+F8
+ENDCHAR
+STARTCHAR E
+ENCODING 69
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 6 9 1 0
+BITMAP
+FC
+C0
+C0
+C0
+FC
+C0
+C0
+C0
+FC
+ENDCHAR
+STARTCHAR F
+ENCODING 70
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 9 1 0
+BITMAP
+FC
+C0
+C0
+C0
+F8
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR G
+ENCODING 71
+SWIDTH 778 0
+DWIDTH 10 0
+BBX 8 9 1 0
+BITMAP
+3E
+63
+C0
+C0
+CF
+C3
+C3
+63
+3D
+ENDCHAR
+STARTCHAR H
+ENCODING 72
+SWIDTH 722 0
+DWIDTH 9 0
+BBX 7 9 1 0
+BITMAP
+C6
+C6
+C6
+C6
+FE
+C6
+C6
+C6
+C6
+ENDCHAR
+STARTCHAR I
+ENCODING 73
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 2 9 1 0
+BITMAP
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR J
+ENCODING 74
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+0C
+0C
+0C
+0C
+0C
+0C
+CC
+CC
+78
+ENDCHAR
+STARTCHAR K
+ENCODING 75
+SWIDTH 722 0
+DWIDTH 9 0
+BBX 8 9 1 0
+BITMAP
+C6
+CC
+D8
+F0
+F0
+D8
+CC
+C6
+C3
+ENDCHAR
+STARTCHAR L
+ENCODING 76
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 9 1 0
+BITMAP
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+FC
+ENDCHAR
+STARTCHAR M
+ENCODING 77
+SWIDTH 833 0
+DWIDTH 11 0
+BBX 9 9 1 0
+BITMAP
+C180
+C180
+E380
+E380
+F780
+D580
+DD80
+C980
+C980
+ENDCHAR
+STARTCHAR N
+ENCODING 78
+SWIDTH 722 0
+DWIDTH 9 0
+BBX 7 9 1 0
+BITMAP
+C6
+E6
+E6
+D6
+D6
+CE
+CE
+C6
+C6
+ENDCHAR
+STARTCHAR O
+ENCODING 79
+SWIDTH 778 0
+DWIDTH 10 0
+BBX 8 9 1 0
+BITMAP
+3C
+66
+C3
+C3
+C3
+C3
+C3
+66
+3C
+ENDCHAR
+STARTCHAR P
+ENCODING 80
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 7 9 1 0
+BITMAP
+FC
+C6
+C6
+C6
+FC
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR Q
+ENCODING 81
+SWIDTH 778 0
+DWIDTH 10 0
+BBX 8 9 1 0
+BITMAP
+3C
+66
+C3
+C3
+C3
+CB
+CF
+66
+3F
+ENDCHAR
+STARTCHAR R
+ENCODING 82
+SWIDTH 722 0
+DWIDTH 9 0
+BBX 7 9 1 0
+BITMAP
+FC
+C6
+C6
+C6
+FC
+CC
+C6
+C6
+C6
+ENDCHAR
+STARTCHAR S
+ENCODING 83
+SWIDTH 667 0
+DWIDTH 9 0
+BBX 7 9 1 0
+BITMAP
+7C
+C6
+C6
+70
+1C
+0E
+C6
+C6
+7C
+ENDCHAR
+STARTCHAR T
+ENCODING 84
+SWIDTH 611 0
+DWIDTH 8 0
+BBX 8 9 0 0
+BITMAP
+FF
+18
+18
+18
+18
+18
+18
+18
+18
+ENDCHAR
+STARTCHAR U
+ENCODING 85
+SWIDTH 722 0
+DWIDTH 9 0
+BBX 7 9 1 0
+BITMAP
+C6
+C6
+C6
+C6
+C6
+C6
+C6
+6C
+7C
+ENDCHAR
+STARTCHAR V
+ENCODING 86
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 8 9 0 0
+BITMAP
+C3
+C3
+66
+66
+66
+24
+3C
+18
+18
+ENDCHAR
+STARTCHAR W
+ENCODING 87
+SWIDTH 944 0
+DWIDTH 10 0
+BBX 10 9 0 0
+BITMAP
+CCC0
+CCC0
+CCC0
+4C80
+6D80
+6D80
+3300
+3300
+3300
+ENDCHAR
+STARTCHAR X
+ENCODING 88
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 8 9 0 0
+BITMAP
+C3
+C3
+66
+3C
+18
+3C
+66
+C3
+C3
+ENDCHAR
+STARTCHAR Y
+ENCODING 89
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 8 9 0 0
+BITMAP
+C3
+C3
+66
+66
+3C
+18
+18
+18
+18
+ENDCHAR
+STARTCHAR Z
+ENCODING 90
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 7 9 0 0
+BITMAP
+FE
+06
+0C
+18
+30
+30
+60
+C0
+FE
+ENDCHAR
+STARTCHAR bracketleft
+ENCODING 91
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 12 1 -3
+BITMAP
+E0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+E0
+ENDCHAR
+STARTCHAR backslash
+ENCODING 92
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 4 9 0 0
+BITMAP
+C0
+C0
+40
+60
+60
+20
+20
+30
+30
+ENDCHAR
+STARTCHAR bracketright
+ENCODING 93
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 12 0 -3
+BITMAP
+E0
+60
+60
+60
+60
+60
+60
+60
+60
+60
+60
+E0
+ENDCHAR
+STARTCHAR asciicircum
+ENCODING 94
+SWIDTH 584 0
+DWIDTH 7 0
+BBX 7 4 0 5
+BITMAP
+10
+38
+6C
+C6
+ENDCHAR
+STARTCHAR underscore
+ENCODING 95
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 7 1 0 -3
+BITMAP
+FE
+ENDCHAR
+STARTCHAR quoteleft
+ENCODING 96
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 2 3 1 6
+BITMAP
+40
+80
+C0
+ENDCHAR
+STARTCHAR a
+ENCODING 97
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 7 7 0 0
+BITMAP
+78
+CC
+0C
+7C
+CC
+CC
+76
+ENDCHAR
+STARTCHAR b
+ENCODING 98
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+C0
+C0
+D8
+EC
+CC
+CC
+CC
+EC
+D8
+ENDCHAR
+STARTCHAR c
+ENCODING 99
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 7 0 0
+BITMAP
+78
+CC
+C0
+C0
+C0
+CC
+78
+ENDCHAR
+STARTCHAR d
+ENCODING 100
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+0C
+0C
+6C
+DC
+CC
+CC
+CC
+DC
+6C
+ENDCHAR
+STARTCHAR e
+ENCODING 101
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 7 0 0
+BITMAP
+78
+CC
+CC
+FC
+C0
+CC
+78
+ENDCHAR
+STARTCHAR f
+ENCODING 102
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 5 9 0 0
+BITMAP
+38
+60
+F0
+60
+60
+60
+60
+60
+60
+ENDCHAR
+STARTCHAR g
+ENCODING 103
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 10 0 -3
+BITMAP
+6C
+DC
+CC
+CC
+CC
+DC
+6C
+0C
+CC
+78
+ENDCHAR
+STARTCHAR h
+ENCODING 104
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+C0
+C0
+D8
+EC
+CC
+CC
+CC
+CC
+CC
+ENDCHAR
+STARTCHAR i
+ENCODING 105
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 9 0 0
+BITMAP
+C0
+00
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR j
+ENCODING 106
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 3 12 -1 -3
+BITMAP
+60
+00
+60
+60
+60
+60
+60
+60
+60
+60
+60
+C0
+ENDCHAR
+STARTCHAR k
+ENCODING 107
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 7 9 0 0
+BITMAP
+C0
+C0
+CC
+D8
+F0
+F0
+D8
+CC
+C6
+ENDCHAR
+STARTCHAR l
+ENCODING 108
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 9 0 0
+BITMAP
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR m
+ENCODING 109
+SWIDTH 889 0
+DWIDTH 11 0
+BBX 10 7 0 0
+BITMAP
+BB80
+CCC0
+CCC0
+CCC0
+CCC0
+CCC0
+CCC0
+ENDCHAR
+STARTCHAR n
+ENCODING 110
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 7 0 0
+BITMAP
+D8
+EC
+CC
+CC
+CC
+CC
+CC
+ENDCHAR
+STARTCHAR o
+ENCODING 111
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 7 0 0
+BITMAP
+78
+CC
+CC
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR p
+ENCODING 112
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 10 0 -3
+BITMAP
+D8
+EC
+CC
+CC
+CC
+EC
+D8
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR q
+ENCODING 113
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 10 0 -3
+BITMAP
+74
+DC
+CC
+CC
+CC
+DC
+6C
+0C
+0C
+0C
+ENDCHAR
+STARTCHAR r
+ENCODING 114
+SWIDTH 389 0
+DWIDTH 5 0
+BBX 5 7 0 0
+BITMAP
+D8
+F8
+E0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR s
+ENCODING 115
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 7 0 0
+BITMAP
+78
+CC
+E0
+38
+1C
+CC
+78
+ENDCHAR
+STARTCHAR t
+ENCODING 116
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 5 9 0 0
+BITMAP
+60
+60
+F0
+60
+60
+60
+60
+68
+30
+ENDCHAR
+STARTCHAR u
+ENCODING 117
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 7 0 0
+BITMAP
+CC
+CC
+CC
+CC
+CC
+DC
+6C
+ENDCHAR
+STARTCHAR v
+ENCODING 118
+SWIDTH 556 0
+DWIDTH 8 0
+BBX 7 7 0 0
+BITMAP
+C6
+C6
+6C
+6C
+38
+38
+10
+ENDCHAR
+STARTCHAR w
+ENCODING 119
+SWIDTH 778 0
+DWIDTH 11 0
+BBX 10 7 0 0
+BITMAP
+CCC0
+CCC0
+6D80
+6D80
+6D80
+3300
+3300
+ENDCHAR
+STARTCHAR x
+ENCODING 120
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 7 0 0
+BITMAP
+CC
+CC
+78
+30
+78
+CC
+CC
+ENDCHAR
+STARTCHAR y
+ENCODING 121
+SWIDTH 556 0
+DWIDTH 8 0
+BBX 7 10 0 -3
+BITMAP
+C6
+C6
+6C
+6C
+38
+38
+18
+10
+30
+60
+ENDCHAR
+STARTCHAR z
+ENCODING 122
+SWIDTH 500 0
+DWIDTH 6 0
+BBX 5 7 0 0
+BITMAP
+F8
+18
+30
+20
+60
+C0
+F8
+ENDCHAR
+STARTCHAR braceleft
+ENCODING 123
+SWIDTH 389 0
+DWIDTH 5 0
+BBX 4 12 0 -3
+BITMAP
+30
+60
+60
+60
+60
+C0
+60
+60
+60
+60
+60
+30
+ENDCHAR
+STARTCHAR bar
+ENCODING 124
+SWIDTH 280 0
+DWIDTH 4 0
+BBX 2 12 1 -3
+BITMAP
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR braceright
+ENCODING 125
+SWIDTH 389 0
+DWIDTH 5 0
+BBX 4 12 0 -3
+BITMAP
+C0
+60
+60
+60
+60
+30
+60
+60
+60
+60
+60
+C0
+ENDCHAR
+STARTCHAR asciitilde
+ENCODING 126
+SWIDTH 584 0
+DWIDTH 7 0
+BBX 7 2 0 3
+BITMAP
+76
+DC
+ENDCHAR
+STARTCHAR space
+ENCODING 160
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 1 1 0 0
+BITMAP
+00
+ENDCHAR
+STARTCHAR exclamdown
+ENCODING 161
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 2 10 1 -3
+BITMAP
+C0
+C0
+00
+40
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR cent
+ENCODING 162
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 9 0 -1
+BITMAP
+10
+78
+DC
+90
+A0
+A0
+EC
+78
+40
+ENDCHAR
+STARTCHAR sterling
+ENCODING 163
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+38
+6C
+60
+60
+F8
+60
+60
+EC
+D8
+ENDCHAR
+STARTCHAR currency
+ENCODING 164
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 6 0 1
+BITMAP
+CC
+78
+48
+48
+78
+CC
+ENDCHAR
+STARTCHAR yen
+ENCODING 165
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+CC
+CC
+48
+FC
+30
+FC
+30
+30
+30
+ENDCHAR
+STARTCHAR brokenbar
+ENCODING 166
+SWIDTH 280 0
+DWIDTH 4 0
+BBX 2 11 1 -2
+BITMAP
+C0
+C0
+C0
+C0
+00
+00
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR section
+ENCODING 167
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 12 0 -3
+BITMAP
+78
+CC
+E0
+70
+D8
+CC
+CC
+6C
+38
+1C
+CC
+78
+ENDCHAR
+STARTCHAR dieresis
+ENCODING 168
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 5 1 0 8
+BITMAP
+D8
+ENDCHAR
+STARTCHAR copyright
+ENCODING 169
+SWIDTH 737 0
+DWIDTH 11 0
+BBX 9 9 1 0
+BITMAP
+3E00
+4100
+9C80
+A280
+A080
+A280
+9C80
+4100
+3E00
+ENDCHAR
+STARTCHAR ordfeminine
+ENCODING 170
+SWIDTH 370 0
+DWIDTH 6 0
+BBX 4 6 1 3
+BITMAP
+E0
+30
+F0
+B0
+00
+F0
+ENDCHAR
+STARTCHAR guillemotleft
+ENCODING 171
+SWIDTH 556 0
+DWIDTH 8 0
+BBX 6 5 1 1
+BITMAP
+24
+6C
+D8
+6C
+24
+ENDCHAR
+STARTCHAR logicalnot
+ENCODING 172
+SWIDTH 584 0
+DWIDTH 8 0
+BBX 6 4 1 2
+BITMAP
+FC
+04
+04
+04
+ENDCHAR
+STARTCHAR hyphen
+ENCODING 173
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 4 1 0 3
+BITMAP
+F0
+ENDCHAR
+STARTCHAR registered
+ENCODING 174
+SWIDTH 737 0
+DWIDTH 11 0
+BBX 9 9 1 0
+BITMAP
+3E00
+4100
+9C80
+9480
+9880
+9480
+9480
+4100
+3E00
+ENDCHAR
+STARTCHAR macron
+ENCODING 175
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 4 1 0 8
+BITMAP
+F0
+ENDCHAR
+STARTCHAR degree
+ENCODING 176
+SWIDTH 400 0
+DWIDTH 5 0
+BBX 4 4 0 4
+BITMAP
+60
+90
+90
+60
+ENDCHAR
+STARTCHAR plusminus
+ENCODING 177
+SWIDTH 584 0
+DWIDTH 7 0
+BBX 6 7 0 0
+BITMAP
+30
+30
+FC
+30
+30
+00
+FC
+ENDCHAR
+STARTCHAR twosuperior
+ENCODING 178
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 4 5 0 4
+BITMAP
+60
+B0
+60
+C0
+F0
+ENDCHAR
+STARTCHAR threesuperior
+ENCODING 179
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 4 5 0 4
+BITMAP
+60
+B0
+60
+30
+E0
+ENDCHAR
+STARTCHAR acute
+ENCODING 180
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 2 0 8
+BITMAP
+60
+C0
+ENDCHAR
+STARTCHAR mu
+ENCODING 181
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 10 0 -3
+BITMAP
+CC
+CC
+CC
+CC
+CC
+DC
+EC
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR paragraph
+ENCODING 182
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 7 12 0 -3
+BITMAP
+3E
+74
+F4
+F4
+F4
+74
+34
+14
+14
+14
+14
+14
+ENDCHAR
+STARTCHAR periodcentered
+ENCODING 183
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 2 2 1 3
+BITMAP
+C0
+C0
+ENDCHAR
+STARTCHAR cedilla
+ENCODING 184
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 4 4 0 -3
+BITMAP
+60
+30
+30
+E0
+ENDCHAR
+STARTCHAR onesuperior
+ENCODING 185
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 5 0 4
+BITMAP
+60
+E0
+60
+60
+60
+ENDCHAR
+STARTCHAR ordmasculine
+ENCODING 186
+SWIDTH 365 0
+DWIDTH 6 0
+BBX 4 6 1 3
+BITMAP
+60
+D0
+D0
+60
+00
+F0
+ENDCHAR
+STARTCHAR guillemotright
+ENCODING 187
+SWIDTH 556 0
+DWIDTH 8 0
+BBX 6 5 1 1
+BITMAP
+90
+D8
+6C
+D8
+90
+ENDCHAR
+STARTCHAR onequarter
+ENCODING 188
+SWIDTH 834 0
+DWIDTH 10 0
+BBX 10 9 0 0
+BITMAP
+6300
+E600
+6600
+6C00
+6D80
+0B80
+1A80
+37C0
+3180
+ENDCHAR
+STARTCHAR onehalf
+ENCODING 189
+SWIDTH 834 0
+DWIDTH 10 0
+BBX 10 9 0 0
+BITMAP
+6300
+E600
+6600
+6C00
+6D80
+0AC0
+1980
+3300
+33C0
+ENDCHAR
+STARTCHAR threequarters
+ENCODING 190
+SWIDTH 834 0
+DWIDTH 10 0
+BBX 10 9 0 0
+BITMAP
+6300
+B300
+6600
+3600
+ED80
+0B80
+1A80
+37C0
+3180
+ENDCHAR
+STARTCHAR questiondown
+ENCODING 191
+SWIDTH 611 0
+DWIDTH 8 0
+BBX 6 10 1 -3
+BITMAP
+30
+30
+00
+30
+30
+30
+60
+CC
+CC
+78
+ENDCHAR
+STARTCHAR Agrave
+ENCODING 192
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 8 12 0 0
+BITMAP
+30
+18
+00
+18
+18
+3C
+24
+66
+7E
+C3
+C3
+C3
+ENDCHAR
+STARTCHAR Aacute
+ENCODING 193
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 8 12 0 0
+BITMAP
+0C
+18
+00
+18
+18
+3C
+24
+66
+7E
+C3
+C3
+C3
+ENDCHAR
+STARTCHAR Acircumflex
+ENCODING 194
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 8 12 0 0
+BITMAP
+1C
+36
+00
+18
+18
+3C
+24
+66
+7E
+C3
+C3
+C3
+ENDCHAR
+STARTCHAR Atilde
+ENCODING 195
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 8 12 0 0
+BITMAP
+1A
+2C
+00
+18
+18
+3C
+24
+66
+7E
+C3
+C3
+C3
+ENDCHAR
+STARTCHAR Adieresis
+ENCODING 196
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 8 11 0 0
+BITMAP
+36
+00
+18
+18
+3C
+24
+66
+7E
+C3
+C3
+C3
+ENDCHAR
+STARTCHAR Aring
+ENCODING 197
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 8 12 0 0
+BITMAP
+18
+24
+18
+18
+18
+3C
+24
+66
+7E
+C3
+C3
+C3
+ENDCHAR
+STARTCHAR AE
+ENCODING 198
+SWIDTH 1000 0
+DWIDTH 13 0
+BBX 11 9 1 0
+BITMAP
+1FE0
+3600
+2600
+6600
+67E0
+7E00
+C600
+C600
+C7E0
+ENDCHAR
+STARTCHAR Ccedilla
+ENCODING 199
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 12 1 -3
+BITMAP
+3C
+66
+C0
+C0
+C0
+C0
+C0
+66
+3C
+18
+18
+70
+ENDCHAR
+STARTCHAR Egrave
+ENCODING 200
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 6 12 1 0
+BITMAP
+60
+30
+00
+FC
+C0
+C0
+C0
+FC
+C0
+C0
+C0
+FC
+ENDCHAR
+STARTCHAR Eacute
+ENCODING 201
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 6 12 1 0
+BITMAP
+18
+30
+00
+FC
+C0
+C0
+C0
+FC
+C0
+C0
+C0
+FC
+ENDCHAR
+STARTCHAR Ecircumflex
+ENCODING 202
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 6 12 1 0
+BITMAP
+38
+6C
+00
+FC
+C0
+C0
+C0
+FC
+C0
+C0
+C0
+FC
+ENDCHAR
+STARTCHAR Edieresis
+ENCODING 203
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 6 11 1 0
+BITMAP
+6C
+00
+FC
+C0
+C0
+C0
+FC
+C0
+C0
+C0
+FC
+ENDCHAR
+STARTCHAR Igrave
+ENCODING 204
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 3 12 0 0
+BITMAP
+C0
+60
+00
+60
+60
+60
+60
+60
+60
+60
+60
+60
+ENDCHAR
+STARTCHAR Iacute
+ENCODING 205
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 3 12 1 0
+BITMAP
+60
+C0
+00
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR Icircumflex
+ENCODING 206
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 5 12 0 0
+BITMAP
+70
+D8
+00
+60
+60
+60
+60
+60
+60
+60
+60
+60
+ENDCHAR
+STARTCHAR Idieresis
+ENCODING 207
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 5 11 0 0
+BITMAP
+D8
+00
+60
+60
+60
+60
+60
+60
+60
+60
+60
+ENDCHAR
+STARTCHAR Eth
+ENCODING 208
+SWIDTH 722 0
+DWIDTH 9 0
+BBX 8 9 0 0
+BITMAP
+7C
+66
+63
+63
+F3
+63
+63
+66
+7C
+ENDCHAR
+STARTCHAR Ntilde
+ENCODING 209
+SWIDTH 722 0
+DWIDTH 9 0
+BBX 7 12 1 0
+BITMAP
+34
+58
+00
+C6
+C6
+E6
+E6
+F6
+CE
+CE
+C6
+C6
+ENDCHAR
+STARTCHAR Ograve
+ENCODING 210
+SWIDTH 778 0
+DWIDTH 10 0
+BBX 8 12 1 0
+BITMAP
+30
+18
+00
+3C
+66
+C3
+C3
+C3
+C3
+C3
+66
+3C
+ENDCHAR
+STARTCHAR Oacute
+ENCODING 211
+SWIDTH 778 0
+DWIDTH 10 0
+BBX 8 12 1 0
+BITMAP
+0C
+18
+00
+3C
+66
+C3
+C3
+C3
+C3
+C3
+66
+3C
+ENDCHAR
+STARTCHAR Ocircumflex
+ENCODING 212
+SWIDTH 778 0
+DWIDTH 10 0
+BBX 8 12 1 0
+BITMAP
+1C
+36
+00
+3C
+66
+C3
+C3
+C3
+C3
+C3
+66
+3C
+ENDCHAR
+STARTCHAR Otilde
+ENCODING 213
+SWIDTH 778 0
+DWIDTH 10 0
+BBX 8 12 1 0
+BITMAP
+1A
+2C
+00
+3C
+66
+C3
+C3
+C3
+C3
+C3
+66
+3C
+ENDCHAR
+STARTCHAR Odieresis
+ENCODING 214
+SWIDTH 778 0
+DWIDTH 10 0
+BBX 8 11 1 0
+BITMAP
+66
+00
+3C
+66
+C3
+C3
+C3
+C3
+C3
+66
+3C
+ENDCHAR
+STARTCHAR multiply
+ENCODING 215
+SWIDTH 584 0
+DWIDTH 7 0
+BBX 6 5 0 1
+BITMAP
+CC
+78
+30
+78
+CC
+ENDCHAR
+STARTCHAR Oslash
+ENCODING 216
+SWIDTH 778 0
+DWIDTH 10 0
+BBX 8 10 1 -1
+BITMAP
+3D
+66
+CF
+CB
+DB
+D3
+F3
+66
+7C
+80
+ENDCHAR
+STARTCHAR Ugrave
+ENCODING 217
+SWIDTH 722 0
+DWIDTH 9 0
+BBX 7 12 1 0
+BITMAP
+30
+18
+00
+C6
+C6
+C6
+C6
+C6
+C6
+C6
+6C
+7C
+ENDCHAR
+STARTCHAR Uacute
+ENCODING 218
+SWIDTH 722 0
+DWIDTH 9 0
+BBX 7 12 1 0
+BITMAP
+0C
+18
+00
+C6
+C6
+C6
+C6
+C6
+C6
+C6
+6C
+7C
+ENDCHAR
+STARTCHAR Ucircumflex
+ENCODING 219
+SWIDTH 722 0
+DWIDTH 9 0
+BBX 7 12 1 0
+BITMAP
+38
+6C
+00
+C6
+C6
+C6
+C6
+C6
+C6
+C6
+6C
+7C
+ENDCHAR
+STARTCHAR Udieresis
+ENCODING 220
+SWIDTH 722 0
+DWIDTH 9 0
+BBX 7 11 1 0
+BITMAP
+6C
+00
+C6
+C6
+C6
+C6
+C6
+C6
+C6
+6C
+7C
+ENDCHAR
+STARTCHAR Yacute
+ENCODING 221
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 8 12 0 0
+BITMAP
+0C
+18
+00
+C3
+C3
+66
+66
+24
+3C
+18
+18
+18
+ENDCHAR
+STARTCHAR Thorn
+ENCODING 222
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 7 9 1 0
+BITMAP
+C0
+C0
+FC
+C6
+C6
+C6
+FC
+C0
+C0
+ENDCHAR
+STARTCHAR germandbls
+ENCODING 223
+SWIDTH 611 0
+DWIDTH 8 0
+BBX 6 9 1 0
+BITMAP
+78
+CC
+CC
+CC
+D8
+CC
+CC
+CC
+D8
+ENDCHAR
+STARTCHAR agrave
+ENCODING 224
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 7 10 0 0
+BITMAP
+30
+18
+00
+78
+CC
+0C
+7C
+CC
+CC
+76
+ENDCHAR
+STARTCHAR aacute
+ENCODING 225
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 7 10 0 0
+BITMAP
+18
+30
+00
+78
+CC
+0C
+7C
+CC
+CC
+76
+ENDCHAR
+STARTCHAR acircumflex
+ENCODING 226
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 7 10 0 0
+BITMAP
+38
+6C
+00
+78
+CC
+0C
+7C
+CC
+CC
+76
+ENDCHAR
+STARTCHAR atilde
+ENCODING 227
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 7 10 0 0
+BITMAP
+34
+58
+00
+78
+CC
+0C
+7C
+CC
+CC
+76
+ENDCHAR
+STARTCHAR adieresis
+ENCODING 228
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 7 9 0 0
+BITMAP
+6C
+00
+78
+CC
+0C
+7C
+CC
+CC
+76
+ENDCHAR
+STARTCHAR aring
+ENCODING 229
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 7 11 0 0
+BITMAP
+30
+48
+30
+00
+78
+CC
+0C
+7C
+CC
+CC
+76
+ENDCHAR
+STARTCHAR ae
+ENCODING 230
+SWIDTH 889 0
+DWIDTH 11 0
+BBX 10 7 0 0
+BITMAP
+7780
+CCC0
+0CC0
+7FC0
+CC00
+CCC0
+7780
+ENDCHAR
+STARTCHAR ccedilla
+ENCODING 231
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 10 0 -3
+BITMAP
+78
+CC
+C0
+C0
+C0
+CC
+78
+10
+18
+70
+ENDCHAR
+STARTCHAR egrave
+ENCODING 232
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 10 0 0
+BITMAP
+60
+30
+00
+78
+CC
+CC
+FC
+C0
+CC
+78
+ENDCHAR
+STARTCHAR eacute
+ENCODING 233
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 10 0 0
+BITMAP
+18
+30
+00
+78
+CC
+CC
+FC
+C0
+CC
+78
+ENDCHAR
+STARTCHAR ecircumflex
+ENCODING 234
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 10 0 0
+BITMAP
+38
+6C
+00
+78
+CC
+CC
+FC
+C0
+CC
+78
+ENDCHAR
+STARTCHAR edieresis
+ENCODING 235
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+6C
+00
+78
+CC
+CC
+FC
+C0
+CC
+78
+ENDCHAR
+STARTCHAR igrave
+ENCODING 236
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 3 10 -1 0
+BITMAP
+C0
+60
+00
+60
+60
+60
+60
+60
+60
+60
+ENDCHAR
+STARTCHAR iacute
+ENCODING 237
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 3 10 0 0
+BITMAP
+60
+C0
+00
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR icircumflex
+ENCODING 238
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 5 10 -1 0
+BITMAP
+70
+D8
+00
+60
+60
+60
+60
+60
+60
+60
+ENDCHAR
+STARTCHAR idieresis
+ENCODING 239
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 5 9 -1 0
+BITMAP
+D8
+00
+60
+60
+60
+60
+60
+60
+60
+ENDCHAR
+STARTCHAR eth
+ENCODING 240
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 10 0 0
+BITMAP
+D8
+70
+90
+18
+7C
+CC
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR ntilde
+ENCODING 241
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 10 0 0
+BITMAP
+34
+58
+00
+D8
+EC
+CC
+CC
+CC
+CC
+CC
+ENDCHAR
+STARTCHAR ograve
+ENCODING 242
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 10 0 0
+BITMAP
+60
+30
+00
+78
+CC
+CC
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR oacute
+ENCODING 243
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 10 0 0
+BITMAP
+18
+30
+00
+78
+CC
+CC
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR ocircumflex
+ENCODING 244
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 10 0 0
+BITMAP
+38
+6C
+00
+78
+CC
+CC
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR otilde
+ENCODING 245
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 10 0 0
+BITMAP
+34
+58
+00
+78
+CC
+CC
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR odieresis
+ENCODING 246
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+6C
+00
+78
+CC
+CC
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR divide
+ENCODING 247
+SWIDTH 584 0
+DWIDTH 7 0
+BBX 6 5 0 1
+BITMAP
+30
+00
+FC
+00
+30
+ENDCHAR
+STARTCHAR oslash
+ENCODING 248
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 8 7 -1 0
+BITMAP
+3D
+66
+6E
+76
+66
+66
+BC
+ENDCHAR
+STARTCHAR ugrave
+ENCODING 249
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 10 0 0
+BITMAP
+60
+30
+00
+CC
+CC
+CC
+CC
+CC
+DC
+6C
+ENDCHAR
+STARTCHAR uacute
+ENCODING 250
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 10 0 0
+BITMAP
+18
+30
+00
+CC
+CC
+CC
+CC
+CC
+DC
+6C
+ENDCHAR
+STARTCHAR ucircumflex
+ENCODING 251
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 10 0 0
+BITMAP
+38
+6C
+00
+CC
+CC
+CC
+CC
+CC
+DC
+6C
+ENDCHAR
+STARTCHAR udieresis
+ENCODING 252
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 9 0 0
+BITMAP
+6C
+00
+CC
+CC
+CC
+CC
+CC
+DC
+6C
+ENDCHAR
+STARTCHAR yacute
+ENCODING 253
+SWIDTH 556 0
+DWIDTH 8 0
+BBX 7 13 0 -3
+BITMAP
+0C
+18
+00
+C6
+C6
+6C
+6C
+38
+38
+18
+10
+30
+60
+ENDCHAR
+STARTCHAR thorn
+ENCODING 254
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 6 12 0 -3
+BITMAP
+C0
+C0
+D8
+EC
+CC
+CC
+CC
+EC
+D8
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR ydieresis
+ENCODING 255
+SWIDTH 556 0
+DWIDTH 8 0
+BBX 7 12 0 -3
+BITMAP
+6C
+00
+C6
+C6
+6C
+6C
+38
+38
+18
+10
+30
+60
+ENDCHAR
+STARTCHAR Lslash
+ENCODING -1
+SWIDTH 611 0
+DWIDTH 8 0
+BBX 7 9 0 0
+BITMAP
+60
+60
+78
+70
+E0
+60
+60
+60
+7E
+ENDCHAR
+STARTCHAR OE
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 13 0
+BBX 11 9 1 0
+BITMAP
+3FE0
+6600
+C600
+C600
+C7E0
+C600
+C600
+6600
+3FE0
+ENDCHAR
+STARTCHAR Scaron
+ENCODING -1
+SWIDTH 667 0
+DWIDTH 9 0
+BBX 7 10 1 0
+BITMAP
+6C
+38
+00
+78
+CC
+E0
+78
+1C
+CE
+7C
+ENDCHAR
+STARTCHAR Ydieresis
+ENCODING -1
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 8 9 0 0
+BITMAP
+6C
+00
+C3
+66
+24
+3C
+18
+18
+18
+ENDCHAR
+STARTCHAR Zcaron
+ENCODING -1
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 7 10 0 0
+BITMAP
+6C
+38
+00
+FC
+18
+30
+30
+60
+C0
+FE
+ENDCHAR
+STARTCHAR breve
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 5 2 0 8
+BITMAP
+88
+70
+ENDCHAR
+STARTCHAR bullet
+ENCODING -1
+SWIDTH 350 0
+DWIDTH 4 0
+BBX 4 3 0 2
+BITMAP
+60
+F0
+60
+ENDCHAR
+STARTCHAR caron
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 5 2 0 8
+BITMAP
+D8
+70
+ENDCHAR
+STARTCHAR circumflex
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 5 2 0 8
+BITMAP
+70
+D8
+ENDCHAR
+STARTCHAR dagger
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 12 0 -3
+BITMAP
+30
+30
+30
+FC
+30
+30
+30
+30
+30
+30
+30
+30
+ENDCHAR
+STARTCHAR daggerdbl
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 12 0 -3
+BITMAP
+30
+30
+30
+FC
+30
+30
+30
+FC
+30
+30
+30
+30
+ENDCHAR
+STARTCHAR dotaccent
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 2 1 1 8
+BITMAP
+C0
+ENDCHAR
+STARTCHAR dotlessi
+ENCODING -1
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 7 0 0
+BITMAP
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR ellipsis
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 12 0
+BBX 10 1 1 0
+BITMAP
+CCC0
+ENDCHAR
+STARTCHAR emdash
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 12 0
+BBX 12 1 0 3
+BITMAP
+FFF0
+ENDCHAR
+STARTCHAR endash
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 7 1 0 3
+BITMAP
+FE
+ENDCHAR
+STARTCHAR fi
+ENCODING -1
+SWIDTH 611 0
+DWIDTH 8 0
+BBX 7 9 0 0
+BITMAP
+36
+60
+F6
+66
+66
+66
+66
+66
+66
+ENDCHAR
+STARTCHAR fl
+ENCODING -1
+SWIDTH 611 0
+DWIDTH 8 0
+BBX 7 9 0 0
+BITMAP
+36
+66
+F6
+66
+66
+66
+66
+66
+66
+ENDCHAR
+STARTCHAR florin
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 7 11 0 -3
+BITMAP
+0E
+18
+18
+7C
+30
+30
+30
+30
+30
+E0
+C0
+ENDCHAR
+STARTCHAR fraction
+ENCODING -1
+SWIDTH 167 0
+DWIDTH 4 0
+BBX 5 8 -1 0
+BITMAP
+18
+18
+30
+30
+60
+60
+C0
+C0
+ENDCHAR
+STARTCHAR grave
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 2 0 8
+BITMAP
+C0
+60
+ENDCHAR
+STARTCHAR guilsinglleft
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 3 5 1 1
+BITMAP
+20
+60
+C0
+60
+20
+ENDCHAR
+STARTCHAR guilsinglright
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 3 5 1 1
+BITMAP
+80
+C0
+60
+C0
+80
+ENDCHAR
+STARTCHAR hungarumlaut
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 5 2 1 8
+BITMAP
+68
+B0
+ENDCHAR
+STARTCHAR lslash
+ENCODING -1
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 4 9 -1 0
+BITMAP
+60
+60
+70
+60
+E0
+60
+60
+60
+60
+ENDCHAR
+STARTCHAR oe
+ENCODING -1
+SWIDTH 944 0
+DWIDTH 11 0
+BBX 10 7 0 0
+BITMAP
+7780
+CCC0
+CCC0
+CFC0
+CC00
+CCC0
+7780
+ENDCHAR
+STARTCHAR ogonek
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 4 4 0 -3
+BITMAP
+60
+C0
+C0
+70
+ENDCHAR
+STARTCHAR perthousand
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 13 0
+BBX 13 8 0 0
+BITMAP
+7100
+DB00
+DA00
+7400
+05B0
+0B68
+1B68
+11B0
+ENDCHAR
+STARTCHAR quotedblbase
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 7 0
+BBX 5 3 1 -2
+BITMAP
+D8
+48
+90
+ENDCHAR
+STARTCHAR quotedblleft
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 7 0
+BBX 5 3 1 6
+BITMAP
+48
+90
+D8
+ENDCHAR
+STARTCHAR quotedblright
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 7 0
+BBX 5 3 1 6
+BITMAP
+D8
+48
+90
+ENDCHAR
+STARTCHAR quotesinglbase
+ENCODING -1
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 2 3 1 -2
+BITMAP
+C0
+40
+80
+ENDCHAR
+STARTCHAR quotesingle
+ENCODING -1
+SWIDTH 238 0
+DWIDTH 3 0
+BBX 1 3 1 6
+BITMAP
+80
+80
+80
+ENDCHAR
+STARTCHAR ring
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 5 3 0 7
+BITMAP
+70
+D8
+70
+ENDCHAR
+STARTCHAR scaron
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 7 0
+BBX 6 10 0 0
+BITMAP
+D8
+70
+00
+78
+CC
+E0
+38
+1C
+CC
+78
+ENDCHAR
+STARTCHAR tilde
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 5 2 0 8
+BITMAP
+68
+B0
+ENDCHAR
+STARTCHAR trademark
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 11 0
+BBX 9 5 1 3
+BITMAP
+E880
+4D80
+4A80
+4A80
+4A80
+ENDCHAR
+STARTCHAR zcaron
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 6 0
+BBX 5 10 0 0
+BITMAP
+D8
+70
+00
+F8
+18
+30
+20
+60
+C0
+F8
+ENDCHAR
+ENDFONT
diff -urN lib/microwindows/src/fonts/helvB12.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/helvB12.c
--- lib/microwindows/src/fonts/helvB12.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/helvB12.c	2005-02-21 16:03:26.000000000 +0100
@@ -0,0 +1,3360 @@
+/* Generated by convbdf on Tue Oct  3 00:24:23 MDT 2000. */
+#include "device.h"
+
+/* Font information:
+
+   name: -Adobe-Helvetica-Bold-R-Normal--12-120-75-75-P-70-ISO8859-1
+   pixel size: 12
+   ascent: 11
+   descent: 3
+*/
+
+/* Font character bitmap data. */
+static MWIMAGEBITS helvB12_bits[] = {
+
+/* Character (0x20):
+   bbw=1, bbh=1, bbx=0, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x21):
+   bbw=2, bbh=9, bbx=1, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | *              |
+   |                |
+   | **             |
+   | **             |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x4000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x22):
+   bbw=3, bbh=3, bbx=1, bby=6, width=5
+   +----------------+
+   |                |
+   |                |
+   | * *            |
+   | * *            |
+   | * *            |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x5000, 
+0x5000, 
+0x5000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x23):
+   bbw=7, bbh=8, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |   * *          |
+   |   * *          |
+   | ******         |
+   |  * *           |
+   |  * *           |
+   |******          |
+   | * *            |
+   | * *            |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x1400, 
+0x1400, 
+0x7e00, 
+0x2800, 
+0x2800, 
+0xfc00, 
+0x5000, 
+0x5000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x24):
+   bbw=6, bbh=11, bbx=0, bby=-2, width=7
+   +----------------+
+   |                |
+   |                |
+   |   *            |
+   | ****           |
+   |** * *          |
+   |** *            |
+   | ****           |
+   |   ***          |
+   |*  * *          |
+   |** * *          |
+   | ****           |
+   |   *            |
+   |   *            |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1000, 
+0x7800, 
+0xd400, 
+0xd000, 
+0x7800, 
+0x1c00, 
+0x9400, 
+0xd400, 
+0x7800, 
+0x1000, 
+0x1000, 
+0x0000, 
+
+/* Character (0x25):
+   bbw=11, bbh=9, bbx=0, bby=0, width=12
+   +----------------+
+   |                |
+   |                |
+   | ***   *        |
+   |** ** **        |
+   |** ** *         |
+   | *** *          |
+   |     *          |
+   |    *  ***      |
+   |    * ** **     |
+   |   ** ** **     |
+   |   *   ***      |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7100, 
+0xdb00, 
+0xda00, 
+0x7400, 
+0x0400, 
+0x09c0, 
+0x0b60, 
+0x1b60, 
+0x11c0, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x26):
+   bbw=9, bbh=9, bbx=0, bby=0, width=9
+   +----------------+
+   |                |
+   |                |
+   |  ***           |
+   | ** **          |
+   | ** **          |
+   |  ***           |
+   | ****  *        |
+   |**  ****        |
+   |**   **         |
+   |**  ****        |
+   | ****  **       |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3800, 
+0x6c00, 
+0x6c00, 
+0x3800, 
+0x7900, 
+0xcf00, 
+0xc600, 
+0xcf00, 
+0x7980, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x27):
+   bbw=2, bbh=3, bbx=1, bby=6, width=4
+   +----------------+
+   |                |
+   |                |
+   | **             |
+   |  *             |
+   | *              |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6000, 
+0x2000, 
+0x4000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x28):
+   bbw=4, bbh=12, bbx=1, bby=-3, width=6
+   +----------------+
+   |                |
+   |                |
+   |   **           |
+   |  **            |
+   |  **            |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   |  **            |
+   |  **            |
+   |   **           |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1800, 
+0x3000, 
+0x3000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x3000, 
+0x3000, 
+0x1800, 
+
+/* Character (0x29):
+   bbw=4, bbh=12, bbx=1, bby=-3, width=6
+   +----------------+
+   |                |
+   |                |
+   | **             |
+   |  **            |
+   |  **            |
+   |   **           |
+   |   **           |
+   |   **           |
+   |   **           |
+   |   **           |
+   |   **           |
+   |  **            |
+   |  **            |
+   | **             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6000, 
+0x3000, 
+0x3000, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x3000, 
+0x3000, 
+0x6000, 
+
+/* Character (0x2a):
+   bbw=5, bbh=4, bbx=0, bby=5, width=6
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   |*****           |
+   | ***            |
+   | * *            |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0xf800, 
+0x7000, 
+0x5000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2b):
+   bbw=6, bbh=5, bbx=0, bby=1, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |  **            |
+   |  **            |
+   |******          |
+   |  **            |
+   |  **            |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x3000, 
+0x3000, 
+0xfc00, 
+0x3000, 
+0x3000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2c):
+   bbw=2, bbh=4, bbx=1, bby=-2, width=4
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | **             |
+   | **             |
+   |  *             |
+   | *              |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0x2000, 
+0x4000, 
+0x0000, 
+
+/* Character (0x2d):
+   bbw=5, bbh=1, bbx=1, bby=3, width=8
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | *****          |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7c00, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2e):
+   bbw=2, bbh=2, bbx=1, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | **             |
+   | **             |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2f):
+   bbw=4, bbh=9, bbx=0, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   |  **            |
+   |  **            |
+   |  *             |
+   | **             |
+   | **             |
+   | *              |
+   | *              |
+   |**              |
+   |**              |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3000, 
+0x3000, 
+0x2000, 
+0x6000, 
+0x6000, 
+0x4000, 
+0x4000, 
+0xc000, 
+0xc000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x30):
+   bbw=6, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | ****           |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   | ****           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7800, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0x7800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x31):
+   bbw=4, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |  **            |
+   |****            |
+   |  **            |
+   |  **            |
+   |  **            |
+   |  **            |
+   |  **            |
+   |  **            |
+   |  **            |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3000, 
+0xf000, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x32):
+   bbw=6, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | ****           |
+   |**  **          |
+   |    **          |
+   |   **           |
+   |  **            |
+   | **             |
+   |**              |
+   |**              |
+   |******          |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7800, 
+0xcc00, 
+0x0c00, 
+0x1800, 
+0x3000, 
+0x6000, 
+0xc000, 
+0xc000, 
+0xfc00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x33):
+   bbw=6, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | ****           |
+   |**  **          |
+   |    **          |
+   |  ***           |
+   |    **          |
+   |    **          |
+   |    **          |
+   |**  **          |
+   | ****           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7800, 
+0xcc00, 
+0x0c00, 
+0x3800, 
+0x0c00, 
+0x0c00, 
+0x0c00, 
+0xcc00, 
+0x7800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x34):
+   bbw=7, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |    **          |
+   |   ***          |
+   |  * **          |
+   |  * **          |
+   | *  **          |
+   |*   **          |
+   |*******         |
+   |    **          |
+   |    **          |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0c00, 
+0x1c00, 
+0x2c00, 
+0x2c00, 
+0x4c00, 
+0x8c00, 
+0xfe00, 
+0x0c00, 
+0x0c00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x35):
+   bbw=6, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | *****          |
+   | **             |
+   |**              |
+   |*****           |
+   |    **          |
+   |    **          |
+   |**  **          |
+   |**  **          |
+   | ****           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7c00, 
+0x6000, 
+0xc000, 
+0xf800, 
+0x0c00, 
+0x0c00, 
+0xcc00, 
+0xcc00, 
+0x7800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x36):
+   bbw=6, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | ****           |
+   |**  **          |
+   |**              |
+   |**              |
+   |*****           |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   | ****           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7800, 
+0xcc00, 
+0xc000, 
+0xc000, 
+0xf800, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0x7800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x37):
+   bbw=6, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |******          |
+   |    **          |
+   |   **           |
+   |   **           |
+   |  **            |
+   |  **            |
+   |  **            |
+   | **             |
+   | **             |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xfc00, 
+0x0c00, 
+0x1800, 
+0x1800, 
+0x3000, 
+0x3000, 
+0x3000, 
+0x6000, 
+0x6000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x38):
+   bbw=6, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | ****           |
+   |**  **          |
+   |**  **          |
+   | ****           |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   | ****           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7800, 
+0xcc00, 
+0xcc00, 
+0x7800, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0x7800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x39):
+   bbw=6, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | ****           |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   | *****          |
+   |    **          |
+   |    **          |
+   |**  **          |
+   | ****           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7800, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0x7c00, 
+0x0c00, 
+0x0c00, 
+0xcc00, 
+0x7800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3a):
+   bbw=2, bbh=7, bbx=1, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | **             |
+   | **             |
+   |                |
+   |                |
+   |                |
+   | **             |
+   | **             |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3b):
+   bbw=2, bbh=9, bbx=1, bby=-2, width=4
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | **             |
+   | **             |
+   |                |
+   |                |
+   |                |
+   | **             |
+   | **             |
+   |  *             |
+   | *              |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0x2000, 
+0x4000, 
+0x0000, 
+
+/* Character (0x3c):
+   bbw=5, bbh=5, bbx=1, bby=1, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |    **          |
+   |  ***           |
+   | **             |
+   |  ***           |
+   |    **          |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0c00, 
+0x3800, 
+0x6000, 
+0x3800, 
+0x0c00, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3d):
+   bbw=6, bbh=3, bbx=0, bby=2, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |******          |
+   |                |
+   |******          |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xfc00, 
+0x0000, 
+0xfc00, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3e):
+   bbw=5, bbh=5, bbx=1, bby=1, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | **             |
+   |  ***           |
+   |    **          |
+   |  ***           |
+   | **             |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6000, 
+0x3800, 
+0x0c00, 
+0x3800, 
+0x6000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3f):
+   bbw=6, bbh=9, bbx=1, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |  ****          |
+   | **  **         |
+   | **  **         |
+   |    **          |
+   |   **           |
+   |   **           |
+   |                |
+   |   **           |
+   |   **           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3c00, 
+0x6600, 
+0x6600, 
+0x0c00, 
+0x1800, 
+0x1800, 
+0x0000, 
+0x1800, 
+0x1800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x40):
+   bbw=10, bbh=10, bbx=1, bby=-1, width=12
+   +----------------+
+   |                |
+   |                |
+   |    *****       |
+   |  **     *      |
+   |  *       *     |
+   | *   ** * *     |
+   | *  *  *  *     |
+   | * *   *  *     |
+   | * *  ** *      |
+   | *  ** **       |
+   |  *             |
+   |   *****        |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0f80, 
+0x3040, 
+0x2020, 
+0x46a0, 
+0x4920, 
+0x5120, 
+0x5340, 
+0x4d80, 
+0x2000, 
+0x1f00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x41):
+   bbw=8, bbh=9, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |   **           |
+   |  ****          |
+   |  *  *          |
+   | **  **         |
+   | **  **         |
+   | ******         |
+   |**    **        |
+   |**    **        |
+   |**    **        |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1800, 
+0x3c00, 
+0x2400, 
+0x6600, 
+0x6600, 
+0x7e00, 
+0xc300, 
+0xc300, 
+0xc300, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x42):
+   bbw=7, bbh=9, bbx=1, bby=0, width=9
+   +----------------+
+   |                |
+   |                |
+   | ******         |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   | ******         |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   | ******         |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7e00, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x7e00, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x7e00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x43):
+   bbw=7, bbh=9, bbx=1, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |   ****         |
+   |  **  **        |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   |  **  **        |
+   |   ****         |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1e00, 
+0x3300, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x3300, 
+0x1e00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x44):
+   bbw=7, bbh=9, bbx=1, bby=0, width=9
+   +----------------+
+   |                |
+   |                |
+   | *****          |
+   | **  **         |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   | **  **         |
+   | *****          |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7c00, 
+0x6600, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x6600, 
+0x7c00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x45):
+   bbw=6, bbh=9, bbx=1, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   | ******         |
+   | **             |
+   | **             |
+   | **             |
+   | ******         |
+   | **             |
+   | **             |
+   | **             |
+   | ******         |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7e00, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x7e00, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x7e00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x46):
+   bbw=6, bbh=9, bbx=1, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | ******         |
+   | **             |
+   | **             |
+   | **             |
+   | *****          |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7e00, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x7c00, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x47):
+   bbw=8, bbh=9, bbx=1, bby=0, width=10
+   +----------------+
+   |                |
+   |                |
+   |   *****        |
+   |  **   **       |
+   | **             |
+   | **             |
+   | **  ****       |
+   | **    **       |
+   | **    **       |
+   |  **   **       |
+   |   **** *       |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1f00, 
+0x3180, 
+0x6000, 
+0x6000, 
+0x6780, 
+0x6180, 
+0x6180, 
+0x3180, 
+0x1e80, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x48):
+   bbw=7, bbh=9, bbx=1, bby=0, width=9
+   +----------------+
+   |                |
+   |                |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   | *******        |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x7f00, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x49):
+   bbw=2, bbh=9, bbx=1, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4a):
+   bbw=6, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |    **          |
+   |    **          |
+   |    **          |
+   |    **          |
+   |    **          |
+   |    **          |
+   |**  **          |
+   |**  **          |
+   | ****           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0c00, 
+0x0c00, 
+0x0c00, 
+0x0c00, 
+0x0c00, 
+0x0c00, 
+0xcc00, 
+0xcc00, 
+0x7800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4b):
+   bbw=8, bbh=9, bbx=1, bby=0, width=9
+   +----------------+
+   |                |
+   |                |
+   | **   **        |
+   | **  **         |
+   | ** **          |
+   | ****           |
+   | ****           |
+   | ** **          |
+   | **  **         |
+   | **   **        |
+   | **    **       |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6300, 
+0x6600, 
+0x6c00, 
+0x7800, 
+0x7800, 
+0x6c00, 
+0x6600, 
+0x6300, 
+0x6180, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4c):
+   bbw=6, bbh=9, bbx=1, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | ******         |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x7e00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4d):
+   bbw=9, bbh=9, bbx=1, bby=0, width=11
+   +----------------+
+   |                |
+   |                |
+   | **     **      |
+   | **     **      |
+   | ***   ***      |
+   | ***   ***      |
+   | **** ****      |
+   | ** * * **      |
+   | ** *** **      |
+   | **  *  **      |
+   | **  *  **      |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x60c0, 
+0x60c0, 
+0x71c0, 
+0x71c0, 
+0x7bc0, 
+0x6ac0, 
+0x6ec0, 
+0x64c0, 
+0x64c0, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4e):
+   bbw=7, bbh=9, bbx=1, bby=0, width=9
+   +----------------+
+   |                |
+   |                |
+   | **   **        |
+   | ***  **        |
+   | ***  **        |
+   | ** * **        |
+   | ** * **        |
+   | **  ***        |
+   | **  ***        |
+   | **   **        |
+   | **   **        |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6300, 
+0x7300, 
+0x7300, 
+0x6b00, 
+0x6b00, 
+0x6700, 
+0x6700, 
+0x6300, 
+0x6300, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4f):
+   bbw=8, bbh=9, bbx=1, bby=0, width=10
+   +----------------+
+   |                |
+   |                |
+   |   ****         |
+   |  **  **        |
+   | **    **       |
+   | **    **       |
+   | **    **       |
+   | **    **       |
+   | **    **       |
+   |  **  **        |
+   |   ****         |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1e00, 
+0x3300, 
+0x6180, 
+0x6180, 
+0x6180, 
+0x6180, 
+0x6180, 
+0x3300, 
+0x1e00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x50):
+   bbw=7, bbh=9, bbx=1, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   | ******         |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   | ******         |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7e00, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x7e00, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x51):
+   bbw=8, bbh=9, bbx=1, bby=0, width=10
+   +----------------+
+   |                |
+   |                |
+   |   ****         |
+   |  **  **        |
+   | **    **       |
+   | **    **       |
+   | **    **       |
+   | **  * **       |
+   | **  ****       |
+   |  **  **        |
+   |   ******       |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1e00, 
+0x3300, 
+0x6180, 
+0x6180, 
+0x6180, 
+0x6580, 
+0x6780, 
+0x3300, 
+0x1f80, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x52):
+   bbw=7, bbh=9, bbx=1, bby=0, width=9
+   +----------------+
+   |                |
+   |                |
+   | ******         |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   | ******         |
+   | **  **         |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7e00, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x7e00, 
+0x6600, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x53):
+   bbw=7, bbh=9, bbx=1, bby=0, width=9
+   +----------------+
+   |                |
+   |                |
+   |  *****         |
+   | **   **        |
+   | **   **        |
+   |  ***           |
+   |    ***         |
+   |     ***        |
+   | **   **        |
+   | **   **        |
+   |  *****         |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3e00, 
+0x6300, 
+0x6300, 
+0x3800, 
+0x0e00, 
+0x0700, 
+0x6300, 
+0x6300, 
+0x3e00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x54):
+   bbw=8, bbh=9, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |********        |
+   |   **           |
+   |   **           |
+   |   **           |
+   |   **           |
+   |   **           |
+   |   **           |
+   |   **           |
+   |   **           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xff00, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x55):
+   bbw=7, bbh=9, bbx=1, bby=0, width=9
+   +----------------+
+   |                |
+   |                |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   | **   **        |
+   |  ** **         |
+   |  *****         |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x6300, 
+0x3600, 
+0x3e00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x56):
+   bbw=8, bbh=9, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |**    **        |
+   |**    **        |
+   | **  **         |
+   | **  **         |
+   | **  **         |
+   |  *  *          |
+   |  ****          |
+   |   **           |
+   |   **           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc300, 
+0xc300, 
+0x6600, 
+0x6600, 
+0x6600, 
+0x2400, 
+0x3c00, 
+0x1800, 
+0x1800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x57):
+   bbw=10, bbh=9, bbx=0, bby=0, width=10
+   +----------------+
+   |                |
+   |                |
+   |**  **  **      |
+   |**  **  **      |
+   |**  **  **      |
+   | *  **  *       |
+   | ** ** **       |
+   | ** ** **       |
+   |  **  **        |
+   |  **  **        |
+   |  **  **        |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xccc0, 
+0xccc0, 
+0xccc0, 
+0x4c80, 
+0x6d80, 
+0x6d80, 
+0x3300, 
+0x3300, 
+0x3300, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x58):
+   bbw=8, bbh=9, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |**    **        |
+   |**    **        |
+   | **  **         |
+   |  ****          |
+   |   **           |
+   |  ****          |
+   | **  **         |
+   |**    **        |
+   |**    **        |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc300, 
+0xc300, 
+0x6600, 
+0x3c00, 
+0x1800, 
+0x3c00, 
+0x6600, 
+0xc300, 
+0xc300, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x59):
+   bbw=8, bbh=9, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |**    **        |
+   |**    **        |
+   | **  **         |
+   | **  **         |
+   |  ****          |
+   |   **           |
+   |   **           |
+   |   **           |
+   |   **           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc300, 
+0xc300, 
+0x6600, 
+0x6600, 
+0x3c00, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x1800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5a):
+   bbw=7, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |*******         |
+   |     **         |
+   |    **          |
+   |   **           |
+   |  **            |
+   |  **            |
+   | **             |
+   |**              |
+   |*******         |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xfe00, 
+0x0600, 
+0x0c00, 
+0x1800, 
+0x3000, 
+0x3000, 
+0x6000, 
+0xc000, 
+0xfe00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5b):
+   bbw=3, bbh=12, bbx=1, bby=-3, width=4
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | ***            |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x7000, 
+
+/* Character (0x5c):
+   bbw=4, bbh=9, bbx=0, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |**              |
+   | *              |
+   | **             |
+   | **             |
+   |  *             |
+   |  *             |
+   |  **            |
+   |  **            |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0xc000, 
+0x4000, 
+0x6000, 
+0x6000, 
+0x2000, 
+0x2000, 
+0x3000, 
+0x3000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5d):
+   bbw=3, bbh=12, bbx=0, bby=-3, width=4
+   +----------------+
+   |                |
+   |                |
+   |***             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   |***             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xe000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0xe000, 
+
+/* Character (0x5e):
+   bbw=7, bbh=4, bbx=0, bby=5, width=7
+   +----------------+
+   |                |
+   |                |
+   |   *            |
+   |  ***           |
+   | ** **          |
+   |**   **         |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1000, 
+0x3800, 
+0x6c00, 
+0xc600, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5f):
+   bbw=7, bbh=1, bbx=0, bby=-3, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |*******         |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xfe00, 
+
+/* Character (0x60):
+   bbw=2, bbh=3, bbx=1, bby=6, width=4
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   | *              |
+   | **             |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x4000, 
+0x6000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x61):
+   bbw=7, bbh=7, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ****           |
+   |**  **          |
+   |    **          |
+   | *****          |
+   |**  **          |
+   |**  **          |
+   | *** **         |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7800, 
+0xcc00, 
+0x0c00, 
+0x7c00, 
+0xcc00, 
+0xcc00, 
+0x7600, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x62):
+   bbw=6, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |**              |
+   |** **           |
+   |*** **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |*** **          |
+   |** **           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0xc000, 
+0xd800, 
+0xec00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xec00, 
+0xd800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x63):
+   bbw=6, bbh=7, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ****           |
+   |**  **          |
+   |**              |
+   |**              |
+   |**              |
+   |**  **          |
+   | ****           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7800, 
+0xcc00, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xcc00, 
+0x7800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x64):
+   bbw=6, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |    **          |
+   |    **          |
+   | ** **          |
+   |** ***          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |** ***          |
+   | ** **          |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0c00, 
+0x0c00, 
+0x6c00, 
+0xdc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xdc00, 
+0x6c00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x65):
+   bbw=6, bbh=7, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ****           |
+   |**  **          |
+   |**  **          |
+   |******          |
+   |**              |
+   |**  **          |
+   | ****           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7800, 
+0xcc00, 
+0xcc00, 
+0xfc00, 
+0xc000, 
+0xcc00, 
+0x7800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x66):
+   bbw=5, bbh=9, bbx=0, bby=0, width=5
+   +----------------+
+   |                |
+   |                |
+   |  ***           |
+   | **             |
+   |****            |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3800, 
+0x6000, 
+0xf000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x67):
+   bbw=6, bbh=10, bbx=0, bby=-3, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ** **          |
+   |** ***          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |** ***          |
+   | ** **          |
+   |    **          |
+   |**  **          |
+   | ****           |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6c00, 
+0xdc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xdc00, 
+0x6c00, 
+0x0c00, 
+0xcc00, 
+0x7800, 
+
+/* Character (0x68):
+   bbw=6, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |**              |
+   |** **           |
+   |*** **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0xc000, 
+0xd800, 
+0xec00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x69):
+   bbw=2, bbh=9, bbx=0, bby=0, width=3
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |                |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0x0000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6a):
+   bbw=3, bbh=12, bbx=0, bby=-3, width=4
+   +----------------+
+   |                |
+   |                |
+   | **             |
+   |                |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   |**              |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0xc000, 
+
+/* Character (0x6b):
+   bbw=7, bbh=9, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |**              |
+   |**  **          |
+   |** **           |
+   |****            |
+   |****            |
+   |** **           |
+   |**  **          |
+   |**   **         |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0xc000, 
+0xcc00, 
+0xd800, 
+0xf000, 
+0xf000, 
+0xd800, 
+0xcc00, 
+0xc600, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6c):
+   bbw=2, bbh=9, bbx=0, bby=0, width=3
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6d):
+   bbw=10, bbh=7, bbx=0, bby=0, width=11
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |* *** ***       |
+   |**  **  **      |
+   |**  **  **      |
+   |**  **  **      |
+   |**  **  **      |
+   |**  **  **      |
+   |**  **  **      |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xbb80, 
+0xccc0, 
+0xccc0, 
+0xccc0, 
+0xccc0, 
+0xccc0, 
+0xccc0, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6e):
+   bbw=6, bbh=7, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |** **           |
+   |*** **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xd800, 
+0xec00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6f):
+   bbw=6, bbh=7, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ****           |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   | ****           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7800, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0x7800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x70):
+   bbw=6, bbh=10, bbx=0, bby=-3, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |** **           |
+   |*** **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |*** **          |
+   |** **           |
+   |**              |
+   |**              |
+   |**              |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xd800, 
+0xec00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xec00, 
+0xd800, 
+0xc000, 
+0xc000, 
+0xc000, 
+
+/* Character (0x71):
+   bbw=6, bbh=10, bbx=0, bby=-3, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | *** *          |
+   |** ***          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |** ***          |
+   | ** **          |
+   |    **          |
+   |    **          |
+   |    **          |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7400, 
+0xdc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xdc00, 
+0x6c00, 
+0x0c00, 
+0x0c00, 
+0x0c00, 
+
+/* Character (0x72):
+   bbw=5, bbh=7, bbx=0, bby=0, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |** **           |
+   |*****           |
+   |***             |
+   |**              |
+   |**              |
+   |**              |
+   |**              |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xd800, 
+0xf800, 
+0xe000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0xc000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x73):
+   bbw=6, bbh=7, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ****           |
+   |**  **          |
+   |***             |
+   |  ***           |
+   |   ***          |
+   |**  **          |
+   | ****           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7800, 
+0xcc00, 
+0xe000, 
+0x3800, 
+0x1c00, 
+0xcc00, 
+0x7800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x74):
+   bbw=5, bbh=9, bbx=0, bby=0, width=5
+   +----------------+
+   |                |
+   |                |
+   | **             |
+   | **             |
+   |****            |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | ** *           |
+   |  **            |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0xf000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6800, 
+0x3000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x75):
+   bbw=6, bbh=7, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |**  **          |
+   |** ***          |
+   | ** **          |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xcc00, 
+0xdc00, 
+0x6c00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x76):
+   bbw=7, bbh=7, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |**   **         |
+   |**   **         |
+   | ** **          |
+   | ** **          |
+   |  ***           |
+   |  ***           |
+   |   *            |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xc600, 
+0xc600, 
+0x6c00, 
+0x6c00, 
+0x3800, 
+0x3800, 
+0x1000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x77):
+   bbw=10, bbh=7, bbx=0, bby=0, width=11
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |**  **  **      |
+   |**  **  **      |
+   | ** ** **       |
+   | ** ** **       |
+   | ** ** **       |
+   |  **  **        |
+   |  **  **        |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xccc0, 
+0xccc0, 
+0x6d80, 
+0x6d80, 
+0x6d80, 
+0x3300, 
+0x3300, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x78):
+   bbw=6, bbh=7, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |**  **          |
+   |**  **          |
+   | ****           |
+   |  **            |
+   | ****           |
+   |**  **          |
+   |**  **          |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xcc00, 
+0xcc00, 
+0x7800, 
+0x3000, 
+0x7800, 
+0xcc00, 
+0xcc00, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x79):
+   bbw=7, bbh=10, bbx=0, bby=-3, width=8
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |**   **         |
+   |**   **         |
+   | ** **          |
+   | ** **          |
+   |  ***           |
+   |  ***           |
+   |   **           |
+   |   *            |
+   |  **            |
+   | **             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xc600, 
+0xc600, 
+0x6c00, 
+0x6c00, 
+0x3800, 
+0x3800, 
+0x1800, 
+0x1000, 
+0x3000, 
+0x6000, 
+
+/* Character (0x7a):
+   bbw=5, bbh=7, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |*****           |
+   |   **           |
+   |  **            |
+   |  *             |
+   | **             |
+   |**              |
+   |*****           |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xf800, 
+0x1800, 
+0x3000, 
+0x2000, 
+0x6000, 
+0xc000, 
+0xf800, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x7b):
+   bbw=4, bbh=12, bbx=0, bby=-3, width=5
+   +----------------+
+   |                |
+   |                |
+   |  **            |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   |**              |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   |  **            |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0xc000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x3000, 
+
+/* Character (0x7c):
+   bbw=2, bbh=12, bbx=1, bby=-3, width=4
+   +----------------+
+   |                |
+   |                |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+
+/* Character (0x7d):
+   bbw=4, bbh=12, bbx=0, bby=-3, width=5
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   |  **            |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   | **             |
+   |**              |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x3000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0x6000, 
+0xc000, 
+
+/* Character (0x7e):
+   bbw=7, bbh=2, bbx=0, bby=3, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | *** **         |
+   |** ***          |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7600, 
+0xdc00, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+};
+
+/* Character->glyph data. */
+static unsigned short helvB12_offset[] = {
+  0,	/* (0x20) */
+  14,	/* (0x21) */
+  28,	/* (0x22) */
+  42,	/* (0x23) */
+  56,	/* (0x24) */
+  70,	/* (0x25) */
+  84,	/* (0x26) */
+  98,	/* (0x27) */
+  112,	/* (0x28) */
+  126,	/* (0x29) */
+  140,	/* (0x2a) */
+  154,	/* (0x2b) */
+  168,	/* (0x2c) */
+  182,	/* (0x2d) */
+  196,	/* (0x2e) */
+  210,	/* (0x2f) */
+  224,	/* (0x30) */
+  238,	/* (0x31) */
+  252,	/* (0x32) */
+  266,	/* (0x33) */
+  280,	/* (0x34) */
+  294,	/* (0x35) */
+  308,	/* (0x36) */
+  322,	/* (0x37) */
+  336,	/* (0x38) */
+  350,	/* (0x39) */
+  364,	/* (0x3a) */
+  378,	/* (0x3b) */
+  392,	/* (0x3c) */
+  406,	/* (0x3d) */
+  420,	/* (0x3e) */
+  434,	/* (0x3f) */
+  448,	/* (0x40) */
+  462,	/* (0x41) */
+  476,	/* (0x42) */
+  490,	/* (0x43) */
+  504,	/* (0x44) */
+  518,	/* (0x45) */
+  532,	/* (0x46) */
+  546,	/* (0x47) */
+  560,	/* (0x48) */
+  574,	/* (0x49) */
+  588,	/* (0x4a) */
+  602,	/* (0x4b) */
+  616,	/* (0x4c) */
+  630,	/* (0x4d) */
+  644,	/* (0x4e) */
+  658,	/* (0x4f) */
+  672,	/* (0x50) */
+  686,	/* (0x51) */
+  700,	/* (0x52) */
+  714,	/* (0x53) */
+  728,	/* (0x54) */
+  742,	/* (0x55) */
+  756,	/* (0x56) */
+  770,	/* (0x57) */
+  784,	/* (0x58) */
+  798,	/* (0x59) */
+  812,	/* (0x5a) */
+  826,	/* (0x5b) */
+  840,	/* (0x5c) */
+  854,	/* (0x5d) */
+  868,	/* (0x5e) */
+  882,	/* (0x5f) */
+  896,	/* (0x60) */
+  910,	/* (0x61) */
+  924,	/* (0x62) */
+  938,	/* (0x63) */
+  952,	/* (0x64) */
+  966,	/* (0x65) */
+  980,	/* (0x66) */
+  994,	/* (0x67) */
+  1008,	/* (0x68) */
+  1022,	/* (0x69) */
+  1036,	/* (0x6a) */
+  1050,	/* (0x6b) */
+  1064,	/* (0x6c) */
+  1078,	/* (0x6d) */
+  1092,	/* (0x6e) */
+  1106,	/* (0x6f) */
+  1120,	/* (0x70) */
+  1134,	/* (0x71) */
+  1148,	/* (0x72) */
+  1162,	/* (0x73) */
+  1176,	/* (0x74) */
+  1190,	/* (0x75) */
+  1204,	/* (0x76) */
+  1218,	/* (0x77) */
+  1232,	/* (0x78) */
+  1246,	/* (0x79) */
+  1260,	/* (0x7a) */
+  1274,	/* (0x7b) */
+  1288,	/* (0x7c) */
+  1302,	/* (0x7d) */
+  1316,	/* (0x7e) */
+};
+
+/* Character width data. */
+static unsigned char helvB12_width[] = {
+  4,	/* (0x20) */
+  4,	/* (0x21) */
+  5,	/* (0x22) */
+  8,	/* (0x23) */
+  7,	/* (0x24) */
+  12,	/* (0x25) */
+  9,	/* (0x26) */
+  4,	/* (0x27) */
+  6,	/* (0x28) */
+  6,	/* (0x29) */
+  6,	/* (0x2a) */
+  7,	/* (0x2b) */
+  4,	/* (0x2c) */
+  8,	/* (0x2d) */
+  4,	/* (0x2e) */
+  4,	/* (0x2f) */
+  7,	/* (0x30) */
+  7,	/* (0x31) */
+  7,	/* (0x32) */
+  7,	/* (0x33) */
+  7,	/* (0x34) */
+  7,	/* (0x35) */
+  7,	/* (0x36) */
+  7,	/* (0x37) */
+  7,	/* (0x38) */
+  7,	/* (0x39) */
+  4,	/* (0x3a) */
+  4,	/* (0x3b) */
+  7,	/* (0x3c) */
+  7,	/* (0x3d) */
+  7,	/* (0x3e) */
+  8,	/* (0x3f) */
+  12,	/* (0x40) */
+  8,	/* (0x41) */
+  9,	/* (0x42) */
+  8,	/* (0x43) */
+  9,	/* (0x44) */
+  8,	/* (0x45) */
+  7,	/* (0x46) */
+  10,	/* (0x47) */
+  9,	/* (0x48) */
+  4,	/* (0x49) */
+  7,	/* (0x4a) */
+  9,	/* (0x4b) */
+  7,	/* (0x4c) */
+  11,	/* (0x4d) */
+  9,	/* (0x4e) */
+  10,	/* (0x4f) */
+  8,	/* (0x50) */
+  10,	/* (0x51) */
+  9,	/* (0x52) */
+  9,	/* (0x53) */
+  8,	/* (0x54) */
+  9,	/* (0x55) */
+  8,	/* (0x56) */
+  10,	/* (0x57) */
+  8,	/* (0x58) */
+  8,	/* (0x59) */
+  7,	/* (0x5a) */
+  4,	/* (0x5b) */
+  4,	/* (0x5c) */
+  4,	/* (0x5d) */
+  7,	/* (0x5e) */
+  7,	/* (0x5f) */
+  4,	/* (0x60) */
+  7,	/* (0x61) */
+  7,	/* (0x62) */
+  7,	/* (0x63) */
+  7,	/* (0x64) */
+  7,	/* (0x65) */
+  5,	/* (0x66) */
+  7,	/* (0x67) */
+  7,	/* (0x68) */
+  3,	/* (0x69) */
+  4,	/* (0x6a) */
+  7,	/* (0x6b) */
+  3,	/* (0x6c) */
+  11,	/* (0x6d) */
+  7,	/* (0x6e) */
+  7,	/* (0x6f) */
+  7,	/* (0x70) */
+  7,	/* (0x71) */
+  5,	/* (0x72) */
+  7,	/* (0x73) */
+  5,	/* (0x74) */
+  7,	/* (0x75) */
+  8,	/* (0x76) */
+  11,	/* (0x77) */
+  7,	/* (0x78) */
+  8,	/* (0x79) */
+  6,	/* (0x7a) */
+  5,	/* (0x7b) */
+  4,	/* (0x7c) */
+  5,	/* (0x7d) */
+  7,	/* (0x7e) */
+};
+
+/* Exported structure definition. */
+MWCFONT font_helvB12 = {
+  "helvB12",
+  12,
+  14,
+  11,
+  32,
+  95,
+  helvB12_bits,
+  helvB12_offset,
+  helvB12_width,
+};
diff -urN lib/microwindows/src/fonts/helvR10.bdf /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/helvR10.bdf
--- lib/microwindows/src/fonts/helvR10.bdf	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/helvR10.bdf	2005-02-21 16:03:26.000000000 +0100
@@ -0,0 +1,3301 @@
+STARTFONT 2.1
+FONT -Adobe-Helvetica-Medium-R-Normal--10-100-75-75-P-56-ISO8859-1
+SIZE 10 75 75
+FONTBOUNDINGBOX 11 13 -1 -2
+COMMENT $XConsortium: helvR10.bdf,v 1.13 95/01/26 18:02:53 gildea Exp $
+COMMENT 
+COMMENT +
+COMMENT  Copyright 1984-1989, 1994 Adobe Systems Incorporated.
+COMMENT  Copyright 1988, 1994 Digital Equipment Corporation.
+COMMENT
+COMMENT  Adobe is a trademark of Adobe Systems Incorporated which may be
+COMMENT  registered in certain jurisdictions.
+COMMENT  Permission to use these trademarks is hereby granted only in
+COMMENT  association with the images described in this file.
+COMMENT
+COMMENT  Permission to use, copy, modify, distribute and sell this software
+COMMENT  and its documentation for any purpose and without fee is hereby
+COMMENT  granted, provided that the above copyright notices appear in all
+COMMENT  copies and that both those copyright notices and this permission
+COMMENT  notice appear in supporting documentation, and that the names of
+COMMENT  Adobe Systems and Digital Equipment Corporation not be used in
+COMMENT  advertising or publicity pertaining to distribution of the software
+COMMENT  without specific, written prior permission.  Adobe Systems and
+COMMENT  Digital Equipment Corporation make no representations about the
+COMMENT  suitability of this software for any purpose.  It is provided "as
+COMMENT  is" without express or implied warranty.
+COMMENT -
+STARTPROPERTIES 28
+FOUNDRY "Adobe"
+FAMILY_NAME "Helvetica"
+WEIGHT_NAME "Medium"
+SLANT "R"
+SETWIDTH_NAME "Normal"
+ADD_STYLE_NAME ""
+PIXEL_SIZE 10
+POINT_SIZE 100
+RESOLUTION_X 75
+RESOLUTION_Y 75
+SPACING "P"
+AVERAGE_WIDTH 56
+CHARSET_REGISTRY "ISO8859"
+CHARSET_ENCODING "1"
+CAP_HEIGHT 8
+X_HEIGHT 6
+FONT_ASCENT 10
+FONT_DESCENT 2
+FACE_NAME "Helvetica"
+COPYRIGHT "Copyright (c) 1984, 1987 Adobe Systems Incorporated. All Rights Reserved. Copyright (c) 1988, 1991 Digital Equipment Corporation. All Rights Reserved."
+NOTICE "Helvetica is a trademark of Linotype-Hell AG and/or its subsidiaries.  "
+_DEC_DEVICE_FONTNAMES "PS=Helvetica"
+_DEC_PRODUCTINFO "DECwindows Fonts V2.2, 07-Nov-1991"
+DEFAULT_CHAR 32
+RELATIVE_SETWIDTH 50
+RELATIVE_WEIGHT 50
+CHARSET_COLLECTIONS "ASCII ISO8859-1 ADOBE-STANDARD"
+FULL_NAME "Helvetica"
+ENDPROPERTIES
+CHARS 229
+STARTCHAR space
+ENCODING 32
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 1 1 0 0
+BITMAP
+00
+ENDCHAR
+STARTCHAR exclam
+ENCODING 33
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 1 8 1 0
+BITMAP
+80
+80
+80
+80
+80
+80
+00
+80
+ENDCHAR
+STARTCHAR quotedbl
+ENCODING 34
+SWIDTH 355 0
+DWIDTH 4 0
+BBX 3 2 1 6
+BITMAP
+A0
+A0
+ENDCHAR
+STARTCHAR numbersign
+ENCODING 35
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 7 0 0
+BITMAP
+28
+28
+7C
+28
+F8
+50
+50
+ENDCHAR
+STARTCHAR dollar
+ENCODING 36
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 9 0 -1
+BITMAP
+20
+70
+A8
+A0
+70
+28
+A8
+70
+20
+ENDCHAR
+STARTCHAR percent
+ENCODING 37
+SWIDTH 889 0
+DWIDTH 9 0
+BBX 8 8 0 0
+BITMAP
+64
+94
+68
+08
+10
+16
+29
+26
+ENDCHAR
+STARTCHAR ampersand
+ENCODING 38
+SWIDTH 667 0
+DWIDTH 8 0
+BBX 6 8 1 0
+BITMAP
+20
+50
+50
+60
+A4
+98
+98
+64
+ENDCHAR
+STARTCHAR quoteright
+ENCODING 39
+SWIDTH 222 0
+DWIDTH 3 0
+BBX 2 3 1 5
+BITMAP
+40
+40
+80
+ENDCHAR
+STARTCHAR parenleft
+ENCODING 40
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 10 0 -2
+BITMAP
+20
+40
+40
+80
+80
+80
+80
+40
+40
+20
+ENDCHAR
+STARTCHAR parenright
+ENCODING 41
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 10 1 -2
+BITMAP
+80
+40
+40
+20
+20
+20
+20
+40
+40
+80
+ENDCHAR
+STARTCHAR asterisk
+ENCODING 42
+SWIDTH 389 0
+DWIDTH 4 0
+BBX 3 3 0 5
+BITMAP
+A0
+40
+A0
+ENDCHAR
+STARTCHAR plus
+ENCODING 43
+SWIDTH 584 0
+DWIDTH 6 0
+BBX 5 5 0 1
+BITMAP
+20
+20
+F8
+20
+20
+ENDCHAR
+STARTCHAR comma
+ENCODING 44
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 3 0 -2
+BITMAP
+40
+40
+80
+ENDCHAR
+STARTCHAR minus
+ENCODING 45
+SWIDTH 584 0
+DWIDTH 7 0
+BBX 5 1 1 3
+BITMAP
+F8
+ENDCHAR
+STARTCHAR period
+ENCODING 46
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 1 1 1 0
+BITMAP
+80
+ENDCHAR
+STARTCHAR slash
+ENCODING 47
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 3 8 0 0
+BITMAP
+20
+20
+40
+40
+40
+40
+80
+80
+ENDCHAR
+STARTCHAR zero
+ENCODING 48
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+70
+88
+88
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR one
+ENCODING 49
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 2 8 1 0
+BITMAP
+40
+C0
+40
+40
+40
+40
+40
+40
+ENDCHAR
+STARTCHAR two
+ENCODING 50
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+70
+88
+08
+08
+30
+40
+80
+F8
+ENDCHAR
+STARTCHAR three
+ENCODING 51
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+70
+88
+08
+30
+08
+08
+88
+70
+ENDCHAR
+STARTCHAR four
+ENCODING 52
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+10
+30
+50
+50
+90
+F8
+10
+10
+ENDCHAR
+STARTCHAR five
+ENCODING 53
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+F8
+80
+80
+F0
+08
+08
+88
+70
+ENDCHAR
+STARTCHAR six
+ENCODING 54
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+70
+88
+80
+B0
+C8
+88
+88
+70
+ENDCHAR
+STARTCHAR seven
+ENCODING 55
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+F8
+08
+10
+10
+20
+20
+40
+40
+ENDCHAR
+STARTCHAR eight
+ENCODING 56
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+70
+88
+88
+70
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR nine
+ENCODING 57
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+70
+88
+88
+98
+68
+08
+88
+70
+ENDCHAR
+STARTCHAR colon
+ENCODING 58
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 1 6 1 0
+BITMAP
+80
+00
+00
+00
+00
+80
+ENDCHAR
+STARTCHAR semicolon
+ENCODING 59
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 8 0 -2
+BITMAP
+40
+00
+00
+00
+00
+40
+40
+80
+ENDCHAR
+STARTCHAR less
+ENCODING 60
+SWIDTH 584 0
+DWIDTH 6 0
+BBX 3 5 1 1
+BITMAP
+20
+40
+80
+40
+20
+ENDCHAR
+STARTCHAR equal
+ENCODING 61
+SWIDTH 584 0
+DWIDTH 5 0
+BBX 4 3 0 2
+BITMAP
+F0
+00
+F0
+ENDCHAR
+STARTCHAR greater
+ENCODING 62
+SWIDTH 584 0
+DWIDTH 6 0
+BBX 3 5 1 1
+BITMAP
+80
+40
+20
+40
+80
+ENDCHAR
+STARTCHAR question
+ENCODING 63
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 4 8 1 0
+BITMAP
+60
+90
+10
+20
+40
+40
+00
+40
+ENDCHAR
+STARTCHAR at
+ENCODING 64
+SWIDTH 1015 0
+DWIDTH 11 0
+BBX 10 10 0 -2
+BITMAP
+1F00
+2080
+4D40
+9240
+A240
+A480
+A480
+9B00
+4000
+3E00
+ENDCHAR
+STARTCHAR A
+ENCODING 65
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 7 8 0 0
+BITMAP
+10
+10
+28
+28
+44
+7C
+82
+82
+ENDCHAR
+STARTCHAR B
+ENCODING 66
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 5 8 1 0
+BITMAP
+F0
+88
+88
+F0
+88
+88
+88
+F0
+ENDCHAR
+STARTCHAR C
+ENCODING 67
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 6 8 1 0
+BITMAP
+78
+84
+80
+80
+80
+80
+84
+78
+ENDCHAR
+STARTCHAR D
+ENCODING 68
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 6 8 1 0
+BITMAP
+F0
+88
+84
+84
+84
+84
+88
+F0
+ENDCHAR
+STARTCHAR E
+ENCODING 69
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 5 8 1 0
+BITMAP
+F8
+80
+80
+F8
+80
+80
+80
+F8
+ENDCHAR
+STARTCHAR F
+ENCODING 70
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 5 8 1 0
+BITMAP
+F8
+80
+80
+F0
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR G
+ENCODING 71
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 6 8 1 0
+BITMAP
+78
+84
+80
+80
+8C
+84
+8C
+74
+ENDCHAR
+STARTCHAR H
+ENCODING 72
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 6 8 1 0
+BITMAP
+84
+84
+84
+FC
+84
+84
+84
+84
+ENDCHAR
+STARTCHAR I
+ENCODING 73
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 1 8 1 0
+BITMAP
+80
+80
+80
+80
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR J
+ENCODING 74
+SWIDTH 500 0
+DWIDTH 5 0
+BBX 4 8 0 0
+BITMAP
+10
+10
+10
+10
+10
+10
+90
+60
+ENDCHAR
+STARTCHAR K
+ENCODING 75
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 5 8 1 0
+BITMAP
+88
+90
+A0
+E0
+90
+90
+88
+88
+ENDCHAR
+STARTCHAR L
+ENCODING 76
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 4 8 1 0
+BITMAP
+80
+80
+80
+80
+80
+80
+80
+F0
+ENDCHAR
+STARTCHAR M
+ENCODING 77
+SWIDTH 833 0
+DWIDTH 9 0
+BBX 7 8 1 0
+BITMAP
+82
+C6
+C6
+AA
+AA
+92
+92
+92
+ENDCHAR
+STARTCHAR N
+ENCODING 78
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 6 8 1 0
+BITMAP
+C4
+C4
+A4
+A4
+94
+94
+8C
+8C
+ENDCHAR
+STARTCHAR O
+ENCODING 79
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 6 8 1 0
+BITMAP
+78
+84
+84
+84
+84
+84
+84
+78
+ENDCHAR
+STARTCHAR P
+ENCODING 80
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 5 8 1 0
+BITMAP
+F0
+88
+88
+F0
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR Q
+ENCODING 81
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 7 9 1 -1
+BITMAP
+78
+84
+84
+84
+84
+94
+8C
+7C
+02
+ENDCHAR
+STARTCHAR R
+ENCODING 82
+SWIDTH 722 0
+DWIDTH 7 0
+BBX 5 8 1 0
+BITMAP
+F0
+88
+88
+F0
+88
+88
+88
+88
+ENDCHAR
+STARTCHAR S
+ENCODING 83
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 5 8 1 0
+BITMAP
+70
+88
+80
+70
+08
+88
+88
+70
+ENDCHAR
+STARTCHAR T
+ENCODING 84
+SWIDTH 611 0
+DWIDTH 5 0
+BBX 5 8 0 0
+BITMAP
+F8
+20
+20
+20
+20
+20
+20
+20
+ENDCHAR
+STARTCHAR U
+ENCODING 85
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 6 8 1 0
+BITMAP
+84
+84
+84
+84
+84
+84
+84
+78
+ENDCHAR
+STARTCHAR V
+ENCODING 86
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 7 8 0 0
+BITMAP
+82
+82
+44
+44
+44
+28
+28
+10
+ENDCHAR
+STARTCHAR W
+ENCODING 87
+SWIDTH 944 0
+DWIDTH 9 0
+BBX 9 8 0 0
+BITMAP
+8880
+8880
+4900
+4900
+5500
+2200
+2200
+2200
+ENDCHAR
+STARTCHAR X
+ENCODING 88
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 5 8 1 0
+BITMAP
+88
+88
+50
+20
+50
+50
+88
+88
+ENDCHAR
+STARTCHAR Y
+ENCODING 89
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 7 8 0 0
+BITMAP
+82
+44
+44
+28
+28
+10
+10
+10
+ENDCHAR
+STARTCHAR Z
+ENCODING 90
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 5 8 1 0
+BITMAP
+F8
+08
+10
+20
+20
+40
+80
+F8
+ENDCHAR
+STARTCHAR bracketleft
+ENCODING 91
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 10 1 -2
+BITMAP
+C0
+80
+80
+80
+80
+80
+80
+80
+80
+C0
+ENDCHAR
+STARTCHAR backslash
+ENCODING 92
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 3 8 0 0
+BITMAP
+80
+80
+40
+40
+40
+40
+20
+20
+ENDCHAR
+STARTCHAR bracketright
+ENCODING 93
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 10 0 -2
+BITMAP
+C0
+40
+40
+40
+40
+40
+40
+40
+40
+C0
+ENDCHAR
+STARTCHAR asciicircum
+ENCODING 94
+SWIDTH 469 0
+DWIDTH 6 0
+BBX 5 5 0 3
+BITMAP
+20
+20
+50
+50
+88
+ENDCHAR
+STARTCHAR underscore
+ENCODING 95
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 1 0 -2
+BITMAP
+FC
+ENDCHAR
+STARTCHAR quoteleft
+ENCODING 96
+SWIDTH 222 0
+DWIDTH 3 0
+BBX 2 3 0 5
+BITMAP
+40
+80
+80
+ENDCHAR
+STARTCHAR a
+ENCODING 97
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 5 6 0 0
+BITMAP
+E0
+10
+70
+90
+90
+68
+ENDCHAR
+STARTCHAR b
+ENCODING 98
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+80
+80
+B0
+C8
+88
+88
+C8
+B0
+ENDCHAR
+STARTCHAR c
+ENCODING 99
+SWIDTH 500 0
+DWIDTH 5 0
+BBX 4 6 0 0
+BITMAP
+60
+90
+80
+80
+90
+60
+ENDCHAR
+STARTCHAR d
+ENCODING 100
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+08
+08
+68
+98
+88
+88
+98
+68
+ENDCHAR
+STARTCHAR e
+ENCODING 101
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 6 0 0
+BITMAP
+60
+90
+F0
+80
+90
+60
+ENDCHAR
+STARTCHAR f
+ENCODING 102
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 4 8 0 0
+BITMAP
+30
+40
+E0
+40
+40
+40
+40
+40
+ENDCHAR
+STARTCHAR g
+ENCODING 103
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 -2
+BITMAP
+68
+98
+88
+88
+98
+68
+08
+70
+ENDCHAR
+STARTCHAR h
+ENCODING 104
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+80
+80
+B0
+C8
+88
+88
+88
+88
+ENDCHAR
+STARTCHAR i
+ENCODING 105
+SWIDTH 222 0
+DWIDTH 2 0
+BBX 1 8 0 0
+BITMAP
+80
+00
+80
+80
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR j
+ENCODING 106
+SWIDTH 222 0
+DWIDTH 2 0
+BBX 1 9 0 -1
+BITMAP
+80
+00
+80
+80
+80
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR k
+ENCODING 107
+SWIDTH 500 0
+DWIDTH 5 0
+BBX 4 8 0 0
+BITMAP
+80
+80
+90
+A0
+C0
+A0
+90
+90
+ENDCHAR
+STARTCHAR l
+ENCODING 108
+SWIDTH 222 0
+DWIDTH 2 0
+BBX 1 8 0 0
+BITMAP
+80
+80
+80
+80
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR m
+ENCODING 109
+SWIDTH 833 0
+DWIDTH 8 0
+BBX 7 6 0 0
+BITMAP
+EC
+92
+92
+92
+92
+92
+ENDCHAR
+STARTCHAR n
+ENCODING 110
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+B0
+C8
+88
+88
+88
+88
+ENDCHAR
+STARTCHAR o
+ENCODING 111
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+70
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR p
+ENCODING 112
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 -2
+BITMAP
+B0
+C8
+88
+88
+C8
+B0
+80
+80
+ENDCHAR
+STARTCHAR q
+ENCODING 113
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 -2
+BITMAP
+68
+98
+88
+88
+98
+68
+08
+08
+ENDCHAR
+STARTCHAR r
+ENCODING 114
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 6 0 0
+BITMAP
+A0
+C0
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR s
+ENCODING 115
+SWIDTH 500 0
+DWIDTH 5 0
+BBX 4 6 0 0
+BITMAP
+60
+90
+60
+10
+90
+60
+ENDCHAR
+STARTCHAR t
+ENCODING 116
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 3 8 0 0
+BITMAP
+40
+40
+E0
+40
+40
+40
+40
+60
+ENDCHAR
+STARTCHAR u
+ENCODING 117
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 6 0 0
+BITMAP
+90
+90
+90
+90
+90
+70
+ENDCHAR
+STARTCHAR v
+ENCODING 118
+SWIDTH 500 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+88
+88
+50
+50
+20
+20
+ENDCHAR
+STARTCHAR w
+ENCODING 119
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 6 0 0
+BITMAP
+92
+92
+54
+54
+28
+28
+ENDCHAR
+STARTCHAR x
+ENCODING 120
+SWIDTH 500 0
+DWIDTH 6 0
+BBX 5 6 0 0
+BITMAP
+88
+50
+20
+50
+88
+88
+ENDCHAR
+STARTCHAR y
+ENCODING 121
+SWIDTH 500 0
+DWIDTH 5 0
+BBX 4 8 0 -2
+BITMAP
+90
+90
+A0
+A0
+60
+40
+40
+80
+ENDCHAR
+STARTCHAR z
+ENCODING 122
+SWIDTH 500 0
+DWIDTH 5 0
+BBX 4 6 0 0
+BITMAP
+F0
+10
+20
+40
+80
+F0
+ENDCHAR
+STARTCHAR braceleft
+ENCODING 123
+SWIDTH 334 0
+DWIDTH 3 0
+BBX 3 10 0 -2
+BITMAP
+20
+40
+40
+40
+80
+40
+40
+40
+40
+20
+ENDCHAR
+STARTCHAR bar
+ENCODING 124
+SWIDTH 260 0
+DWIDTH 3 0
+BBX 1 10 1 -2
+BITMAP
+80
+80
+80
+80
+80
+80
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR braceright
+ENCODING 125
+SWIDTH 334 0
+DWIDTH 3 0
+BBX 3 10 0 -2
+BITMAP
+80
+40
+40
+40
+20
+40
+40
+40
+40
+80
+ENDCHAR
+STARTCHAR asciitilde
+ENCODING 126
+SWIDTH 584 0
+DWIDTH 7 0
+BBX 6 2 0 3
+BITMAP
+64
+98
+ENDCHAR
+STARTCHAR space
+ENCODING 160
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 1 1 0 0
+BITMAP
+00
+ENDCHAR
+STARTCHAR exclamdown
+ENCODING 161
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 1 8 1 -2
+BITMAP
+80
+00
+80
+80
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR cent
+ENCODING 162
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 -1
+BITMAP
+10
+70
+A8
+A0
+A0
+A8
+70
+40
+ENDCHAR
+STARTCHAR sterling
+ENCODING 163
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+30
+48
+40
+E0
+40
+40
+48
+B0
+ENDCHAR
+STARTCHAR currency
+ENCODING 164
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 6 0 1
+BITMAP
+90
+60
+90
+90
+60
+90
+ENDCHAR
+STARTCHAR yen
+ENCODING 165
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+88
+88
+50
+50
+F8
+20
+F8
+20
+ENDCHAR
+STARTCHAR brokenbar
+ENCODING 166
+SWIDTH 260 0
+DWIDTH 3 0
+BBX 1 10 1 -2
+BITMAP
+80
+80
+80
+80
+00
+00
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR section
+ENCODING 167
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 10 0 -2
+BITMAP
+70
+88
+C0
+70
+98
+C8
+70
+18
+88
+70
+ENDCHAR
+STARTCHAR dieresis
+ENCODING 168
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 3 1 0 7
+BITMAP
+A0
+ENDCHAR
+STARTCHAR copyright
+ENCODING 169
+SWIDTH 737 0
+DWIDTH 9 0
+BBX 7 7 1 0
+BITMAP
+38
+44
+9A
+A2
+9A
+44
+38
+ENDCHAR
+STARTCHAR ordfeminine
+ENCODING 170
+SWIDTH 370 0
+DWIDTH 4 0
+BBX 3 5 0 3
+BITMAP
+E0
+20
+A0
+00
+E0
+ENDCHAR
+STARTCHAR guillemotleft
+ENCODING 171
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 5 0 0
+BITMAP
+28
+50
+A0
+50
+28
+ENDCHAR
+STARTCHAR logicalnot
+ENCODING 172
+SWIDTH 584 0
+DWIDTH 7 0
+BBX 5 3 1 2
+BITMAP
+F8
+08
+08
+ENDCHAR
+STARTCHAR hyphen
+ENCODING 173
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 1 0 3
+BITMAP
+E0
+ENDCHAR
+STARTCHAR registered
+ENCODING 174
+SWIDTH 737 0
+DWIDTH 9 0
+BBX 7 7 1 0
+BITMAP
+38
+44
+BA
+B2
+AA
+44
+38
+ENDCHAR
+STARTCHAR macron
+ENCODING 175
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 3 1 0 7
+BITMAP
+E0
+ENDCHAR
+STARTCHAR degree
+ENCODING 176
+SWIDTH 400 0
+DWIDTH 4 0
+BBX 4 4 0 3
+BITMAP
+60
+90
+90
+60
+ENDCHAR
+STARTCHAR plusminus
+ENCODING 177
+SWIDTH 584 0
+DWIDTH 6 0
+BBX 5 7 0 0
+BITMAP
+20
+20
+F8
+20
+20
+00
+F8
+ENDCHAR
+STARTCHAR twosuperior
+ENCODING 178
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 3 4 0 3
+BITMAP
+60
+A0
+40
+E0
+ENDCHAR
+STARTCHAR threesuperior
+ENCODING 179
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 3 4 0 3
+BITMAP
+E0
+40
+20
+C0
+ENDCHAR
+STARTCHAR acute
+ENCODING 180
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 2 2 0 6
+BITMAP
+40
+80
+ENDCHAR
+STARTCHAR mu
+ENCODING 181
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 8 0 -2
+BITMAP
+90
+90
+90
+90
+90
+F0
+80
+80
+ENDCHAR
+STARTCHAR paragraph
+ENCODING 182
+SWIDTH 537 0
+DWIDTH 6 0
+BBX 6 10 0 -2
+BITMAP
+7C
+E8
+E8
+E8
+68
+28
+28
+28
+28
+28
+ENDCHAR
+STARTCHAR periodcentered
+ENCODING 183
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 1 0 3
+BITMAP
+C0
+ENDCHAR
+STARTCHAR cedilla
+ENCODING 184
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 2 2 0 -2
+BITMAP
+40
+C0
+ENDCHAR
+STARTCHAR onesuperior
+ENCODING 185
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 2 4 0 3
+BITMAP
+40
+C0
+40
+40
+ENDCHAR
+STARTCHAR ordmasculine
+ENCODING 186
+SWIDTH 365 0
+DWIDTH 4 0
+BBX 3 5 0 3
+BITMAP
+E0
+A0
+E0
+00
+E0
+ENDCHAR
+STARTCHAR guillemotright
+ENCODING 187
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 5 0 0
+BITMAP
+A0
+50
+28
+50
+A0
+ENDCHAR
+STARTCHAR onequarter
+ENCODING 188
+SWIDTH 834 0
+DWIDTH 9 0
+BBX 9 8 0 0
+BITMAP
+4200
+C400
+4400
+4800
+0900
+1300
+1780
+2100
+ENDCHAR
+STARTCHAR onehalf
+ENCODING 189
+SWIDTH 834 0
+DWIDTH 9 0
+BBX 8 8 0 0
+BITMAP
+42
+C4
+44
+48
+0B
+15
+12
+27
+ENDCHAR
+STARTCHAR threequarters
+ENCODING 190
+SWIDTH 834 0
+DWIDTH 9 0
+BBX 9 8 0 0
+BITMAP
+E200
+4400
+2400
+C800
+0900
+1300
+1780
+2100
+ENDCHAR
+STARTCHAR questiondown
+ENCODING 191
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 4 8 1 -2
+BITMAP
+20
+00
+20
+20
+40
+80
+90
+60
+ENDCHAR
+STARTCHAR Agrave
+ENCODING 192
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 7 11 0 0
+BITMAP
+20
+10
+00
+10
+10
+28
+28
+44
+7C
+82
+82
+ENDCHAR
+STARTCHAR Aacute
+ENCODING 193
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 7 11 0 0
+BITMAP
+08
+10
+00
+10
+10
+28
+28
+44
+7C
+82
+82
+ENDCHAR
+STARTCHAR Acircumflex
+ENCODING 194
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 7 11 0 0
+BITMAP
+10
+28
+00
+10
+10
+28
+28
+44
+7C
+82
+82
+ENDCHAR
+STARTCHAR Atilde
+ENCODING 195
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 7 11 0 0
+BITMAP
+14
+28
+00
+10
+10
+28
+28
+44
+7C
+82
+82
+ENDCHAR
+STARTCHAR Adieresis
+ENCODING 196
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 7 10 0 0
+BITMAP
+28
+00
+10
+10
+28
+28
+44
+7C
+82
+82
+ENDCHAR
+STARTCHAR Aring
+ENCODING 197
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 7 11 0 0
+BITMAP
+10
+28
+10
+10
+10
+28
+28
+44
+7C
+82
+82
+ENDCHAR
+STARTCHAR AE
+ENCODING 198
+SWIDTH 1000 0
+DWIDTH 10 0
+BBX 9 8 0 0
+BITMAP
+1F80
+1800
+2800
+2F80
+4800
+7800
+8800
+8F80
+ENDCHAR
+STARTCHAR Ccedilla
+ENCODING 199
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 6 10 1 -2
+BITMAP
+78
+84
+80
+80
+80
+80
+84
+78
+10
+30
+ENDCHAR
+STARTCHAR Egrave
+ENCODING 200
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 5 11 1 0
+BITMAP
+40
+20
+00
+F8
+80
+80
+F8
+80
+80
+80
+F8
+ENDCHAR
+STARTCHAR Eacute
+ENCODING 201
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 5 11 1 0
+BITMAP
+10
+20
+00
+F8
+80
+80
+F8
+80
+80
+80
+F8
+ENDCHAR
+STARTCHAR Ecircumflex
+ENCODING 202
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 5 11 1 0
+BITMAP
+20
+50
+00
+F8
+80
+80
+80
+F8
+80
+80
+F8
+ENDCHAR
+STARTCHAR Edieresis
+ENCODING 203
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 5 10 1 0
+BITMAP
+50
+00
+F8
+80
+80
+F8
+80
+80
+80
+F8
+ENDCHAR
+STARTCHAR Igrave
+ENCODING 204
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 11 0 0
+BITMAP
+80
+40
+00
+40
+40
+40
+40
+40
+40
+40
+40
+ENDCHAR
+STARTCHAR Iacute
+ENCODING 205
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 2 11 1 0
+BITMAP
+40
+80
+00
+80
+80
+80
+80
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR Icircumflex
+ENCODING 206
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 3 11 0 0
+BITMAP
+40
+A0
+00
+40
+40
+40
+40
+40
+40
+40
+40
+ENDCHAR
+STARTCHAR Idieresis
+ENCODING 207
+SWIDTH 278 0
+DWIDTH 3 0
+BBX 3 10 0 0
+BITMAP
+A0
+00
+40
+40
+40
+40
+40
+40
+40
+40
+ENDCHAR
+STARTCHAR Eth
+ENCODING 208
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 7 8 0 0
+BITMAP
+78
+44
+42
+F2
+42
+42
+44
+78
+ENDCHAR
+STARTCHAR Ntilde
+ENCODING 209
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 6 11 1 0
+BITMAP
+28
+50
+00
+C4
+C4
+A4
+A4
+94
+94
+8C
+8C
+ENDCHAR
+STARTCHAR Ograve
+ENCODING 210
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 6 11 1 0
+BITMAP
+20
+10
+00
+78
+84
+84
+84
+84
+84
+84
+78
+ENDCHAR
+STARTCHAR Oacute
+ENCODING 211
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 6 11 1 0
+BITMAP
+08
+10
+00
+78
+84
+84
+84
+84
+84
+84
+78
+ENDCHAR
+STARTCHAR Ocircumflex
+ENCODING 212
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 6 11 1 0
+BITMAP
+10
+28
+00
+78
+84
+84
+84
+84
+84
+84
+78
+ENDCHAR
+STARTCHAR Otilde
+ENCODING 213
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 6 11 1 0
+BITMAP
+28
+50
+00
+78
+84
+84
+84
+84
+84
+84
+78
+ENDCHAR
+STARTCHAR Odieresis
+ENCODING 214
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 6 10 1 0
+BITMAP
+48
+00
+78
+84
+84
+84
+84
+84
+84
+78
+ENDCHAR
+STARTCHAR multiply
+ENCODING 215
+SWIDTH 584 0
+DWIDTH 6 0
+BBX 5 5 0 1
+BITMAP
+88
+50
+20
+50
+88
+ENDCHAR
+STARTCHAR Oslash
+ENCODING 216
+SWIDTH 778 0
+DWIDTH 8 0
+BBX 6 10 1 -1
+BITMAP
+04
+78
+8C
+94
+94
+A4
+A4
+C4
+78
+80
+ENDCHAR
+STARTCHAR Ugrave
+ENCODING 217
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 6 11 1 0
+BITMAP
+20
+10
+00
+84
+84
+84
+84
+84
+84
+84
+78
+ENDCHAR
+STARTCHAR Uacute
+ENCODING 218
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 6 11 1 0
+BITMAP
+10
+20
+00
+84
+84
+84
+84
+84
+84
+84
+78
+ENDCHAR
+STARTCHAR Ucircumflex
+ENCODING 219
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 6 11 1 0
+BITMAP
+10
+28
+00
+84
+84
+84
+84
+84
+84
+84
+78
+ENDCHAR
+STARTCHAR Udieresis
+ENCODING 220
+SWIDTH 722 0
+DWIDTH 8 0
+BBX 6 10 1 0
+BITMAP
+48
+00
+84
+84
+84
+84
+84
+84
+84
+78
+ENDCHAR
+STARTCHAR Yacute
+ENCODING 221
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 7 11 0 0
+BITMAP
+08
+10
+00
+82
+44
+44
+28
+28
+10
+10
+10
+ENDCHAR
+STARTCHAR Thorn
+ENCODING 222
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 5 8 1 0
+BITMAP
+80
+80
+F0
+88
+88
+F0
+80
+80
+ENDCHAR
+STARTCHAR germandbls
+ENCODING 223
+SWIDTH 611 0
+DWIDTH 5 0
+BBX 4 8 0 0
+BITMAP
+60
+90
+90
+A0
+90
+90
+90
+A0
+ENDCHAR
+STARTCHAR agrave
+ENCODING 224
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 5 9 0 0
+BITMAP
+40
+20
+00
+E0
+10
+70
+90
+90
+68
+ENDCHAR
+STARTCHAR aacute
+ENCODING 225
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 5 9 0 0
+BITMAP
+10
+20
+00
+E0
+10
+70
+90
+90
+68
+ENDCHAR
+STARTCHAR acircumflex
+ENCODING 226
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 5 9 0 0
+BITMAP
+20
+50
+00
+E0
+10
+70
+90
+90
+68
+ENDCHAR
+STARTCHAR atilde
+ENCODING 227
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 5 9 0 0
+BITMAP
+50
+A0
+00
+E0
+10
+70
+90
+90
+68
+ENDCHAR
+STARTCHAR adieresis
+ENCODING 228
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 5 8 0 0
+BITMAP
+50
+00
+E0
+10
+70
+90
+90
+68
+ENDCHAR
+STARTCHAR aring
+ENCODING 229
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 5 9 0 0
+BITMAP
+20
+50
+20
+E0
+10
+70
+90
+90
+68
+ENDCHAR
+STARTCHAR ae
+ENCODING 230
+SWIDTH 889 0
+DWIDTH 8 0
+BBX 7 6 0 0
+BITMAP
+EC
+12
+7E
+90
+92
+6C
+ENDCHAR
+STARTCHAR ccedilla
+ENCODING 231
+SWIDTH 500 0
+DWIDTH 5 0
+BBX 4 8 0 -2
+BITMAP
+60
+90
+80
+80
+90
+60
+20
+60
+ENDCHAR
+STARTCHAR egrave
+ENCODING 232
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 9 0 0
+BITMAP
+40
+20
+00
+60
+90
+F0
+80
+90
+60
+ENDCHAR
+STARTCHAR eacute
+ENCODING 233
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 9 0 0
+BITMAP
+20
+40
+00
+60
+90
+F0
+80
+90
+60
+ENDCHAR
+STARTCHAR ecircumflex
+ENCODING 234
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 9 0 0
+BITMAP
+20
+50
+00
+60
+90
+F0
+80
+90
+60
+ENDCHAR
+STARTCHAR edieresis
+ENCODING 235
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 8 0 0
+BITMAP
+50
+00
+60
+90
+F0
+80
+90
+60
+ENDCHAR
+STARTCHAR igrave
+ENCODING 236
+SWIDTH 278 0
+DWIDTH 2 0
+BBX 2 9 -1 0
+BITMAP
+80
+40
+00
+40
+40
+40
+40
+40
+40
+ENDCHAR
+STARTCHAR iacute
+ENCODING 237
+SWIDTH 278 0
+DWIDTH 2 0
+BBX 2 9 0 0
+BITMAP
+40
+80
+00
+80
+80
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR icircumflex
+ENCODING 238
+SWIDTH 278 0
+DWIDTH 2 0
+BBX 3 9 -1 0
+BITMAP
+40
+A0
+00
+40
+40
+40
+40
+40
+40
+ENDCHAR
+STARTCHAR idieresis
+ENCODING 239
+SWIDTH 278 0
+DWIDTH 2 0
+BBX 3 8 0 0
+BITMAP
+A0
+00
+40
+40
+40
+40
+40
+40
+ENDCHAR
+STARTCHAR eth
+ENCODING 240
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+50
+60
+90
+78
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR ntilde
+ENCODING 241
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 9 0 0
+BITMAP
+50
+A0
+00
+E0
+90
+90
+90
+90
+90
+ENDCHAR
+STARTCHAR ograve
+ENCODING 242
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+40
+20
+00
+70
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR oacute
+ENCODING 243
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+10
+20
+00
+70
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR ocircumflex
+ENCODING 244
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+20
+50
+00
+70
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR otilde
+ENCODING 245
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 9 0 0
+BITMAP
+28
+50
+00
+70
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR odieresis
+ENCODING 246
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+50
+00
+70
+88
+88
+88
+88
+70
+ENDCHAR
+STARTCHAR divide
+ENCODING 247
+SWIDTH 584 0
+DWIDTH 6 0
+BBX 5 5 0 1
+BITMAP
+20
+00
+F8
+00
+20
+ENDCHAR
+STARTCHAR oslash
+ENCODING 248
+SWIDTH 611 0
+DWIDTH 6 0
+BBX 6 6 0 0
+BITMAP
+74
+98
+A8
+C8
+88
+70
+ENDCHAR
+STARTCHAR ugrave
+ENCODING 249
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 9 0 0
+BITMAP
+40
+20
+00
+90
+90
+90
+90
+90
+70
+ENDCHAR
+STARTCHAR uacute
+ENCODING 250
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 9 0 0
+BITMAP
+20
+40
+00
+90
+90
+90
+90
+90
+70
+ENDCHAR
+STARTCHAR ucircumflex
+ENCODING 251
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 9 0 0
+BITMAP
+20
+50
+00
+90
+90
+90
+90
+90
+70
+ENDCHAR
+STARTCHAR udieresis
+ENCODING 252
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 8 0 0
+BITMAP
+50
+00
+90
+90
+90
+90
+90
+70
+ENDCHAR
+STARTCHAR yacute
+ENCODING 253
+SWIDTH 500 0
+DWIDTH 5 0
+BBX 4 11 0 -2
+BITMAP
+10
+20
+00
+90
+90
+A0
+A0
+60
+40
+40
+80
+ENDCHAR
+STARTCHAR thorn
+ENCODING 254
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 10 0 -2
+BITMAP
+80
+80
+B0
+C8
+88
+88
+C8
+B0
+80
+80
+ENDCHAR
+STARTCHAR ydieresis
+ENCODING 255
+SWIDTH 500 0
+DWIDTH 5 0
+BBX 4 10 0 -2
+BITMAP
+50
+00
+90
+90
+A0
+A0
+60
+40
+40
+80
+ENDCHAR
+STARTCHAR Lslash
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+40
+40
+40
+60
+C0
+40
+40
+78
+ENDCHAR
+STARTCHAR OE
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 11 0
+BBX 9 8 1 0
+BITMAP
+7F80
+8800
+8800
+8F80
+8800
+8800
+8800
+7F80
+ENDCHAR
+STARTCHAR Scaron
+ENCODING -1
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 5 9 1 0
+BITMAP
+50
+20
+00
+78
+80
+78
+08
+88
+70
+ENDCHAR
+STARTCHAR Ydieresis
+ENCODING -1
+SWIDTH 667 0
+DWIDTH 7 0
+BBX 5 8 1 0
+BITMAP
+50
+00
+88
+88
+50
+20
+20
+20
+ENDCHAR
+STARTCHAR Zcaron
+ENCODING -1
+SWIDTH 611 0
+DWIDTH 7 0
+BBX 5 9 1 0
+BITMAP
+50
+20
+00
+F8
+10
+20
+40
+80
+F8
+ENDCHAR
+STARTCHAR breve
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 4 2 0 6
+BITMAP
+90
+60
+ENDCHAR
+STARTCHAR bullet
+ENCODING -1
+SWIDTH 350 0
+DWIDTH 4 0
+BBX 2 2 1 3
+BITMAP
+C0
+C0
+ENDCHAR
+STARTCHAR caron
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 3 2 0 6
+BITMAP
+A0
+40
+ENDCHAR
+STARTCHAR circumflex
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 3 2 0 6
+BITMAP
+40
+A0
+ENDCHAR
+STARTCHAR dagger
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 10 0 -2
+BITMAP
+20
+20
+F8
+20
+20
+20
+20
+20
+20
+20
+ENDCHAR
+STARTCHAR daggerdbl
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 5 10 0 -2
+BITMAP
+20
+20
+F8
+20
+20
+20
+20
+F8
+20
+20
+ENDCHAR
+STARTCHAR dotaccent
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 1 1 1 7
+BITMAP
+80
+ENDCHAR
+STARTCHAR dotlessi
+ENCODING -1
+SWIDTH 278 0
+DWIDTH 2 0
+BBX 1 6 0 0
+BITMAP
+80
+80
+80
+80
+80
+80
+ENDCHAR
+STARTCHAR ellipsis
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 9 0
+BBX 7 1 1 0
+BITMAP
+92
+ENDCHAR
+STARTCHAR emdash
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 10 0
+BBX 10 1 0 3
+BITMAP
+FFC0
+ENDCHAR
+STARTCHAR endash
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 6 0
+BBX 6 1 0 3
+BITMAP
+FC
+ENDCHAR
+STARTCHAR fi
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+38
+40
+E8
+48
+48
+48
+48
+48
+ENDCHAR
+STARTCHAR fl
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+38
+48
+E8
+48
+48
+48
+48
+48
+ENDCHAR
+STARTCHAR florin
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 5 0
+BBX 4 9 0 -2
+BITMAP
+30
+40
+E0
+40
+40
+40
+40
+40
+80
+ENDCHAR
+STARTCHAR fraction
+ENCODING -1
+SWIDTH 167 0
+DWIDTH 3 0
+BBX 4 7 -1 0
+BITMAP
+10
+10
+20
+20
+40
+40
+80
+ENDCHAR
+STARTCHAR grave
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 2 2 0 6
+BITMAP
+80
+40
+ENDCHAR
+STARTCHAR guilsinglleft
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 5 0 0
+BITMAP
+20
+40
+80
+40
+20
+ENDCHAR
+STARTCHAR guilsinglright
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 3 5 0 0
+BITMAP
+80
+40
+20
+40
+80
+ENDCHAR
+STARTCHAR hungarumlaut
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 5 2 0 6
+BITMAP
+48
+90
+ENDCHAR
+STARTCHAR lslash
+ENCODING -1
+SWIDTH 222 0
+DWIDTH 2 0
+BBX 3 8 -1 0
+BITMAP
+40
+40
+40
+60
+C0
+40
+40
+40
+ENDCHAR
+STARTCHAR oe
+ENCODING -1
+SWIDTH 944 0
+DWIDTH 9 0
+BBX 8 6 0 0
+BITMAP
+76
+89
+8F
+88
+89
+76
+ENDCHAR
+STARTCHAR ogonek
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 2 2 1 -2
+BITMAP
+80
+C0
+ENDCHAR
+STARTCHAR perthousand
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 11 0
+BBX 10 7 0 0
+BITMAP
+4800
+A800
+5000
+3000
+2880
+5540
+4880
+ENDCHAR
+STARTCHAR quotedblbase
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 4 2 0 -1
+BITMAP
+50
+A0
+ENDCHAR
+STARTCHAR quotedblleft
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 4 2 0 6
+BITMAP
+A0
+50
+ENDCHAR
+STARTCHAR quotedblright
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 4 2 0 6
+BITMAP
+50
+A0
+ENDCHAR
+STARTCHAR quotesinglbase
+ENCODING -1
+SWIDTH 222 0
+DWIDTH 2 0
+BBX 2 2 0 -1
+BITMAP
+40
+80
+ENDCHAR
+STARTCHAR quotesingle
+ENCODING -1
+SWIDTH 191 0
+DWIDTH 2 0
+BBX 1 2 0 6
+BITMAP
+80
+80
+ENDCHAR
+STARTCHAR ring
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 3 0
+BBX 3 3 0 5
+BITMAP
+40
+A0
+40
+ENDCHAR
+STARTCHAR scaron
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 5 0
+BBX 4 9 0 0
+BITMAP
+A0
+40
+00
+60
+90
+60
+10
+90
+60
+ENDCHAR
+STARTCHAR tilde
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 4 0
+BBX 4 2 0 6
+BITMAP
+50
+A0
+ENDCHAR
+STARTCHAR trademark
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 10 0
+BBX 8 4 1 3
+BITMAP
+F1
+5B
+55
+55
+ENDCHAR
+STARTCHAR zcaron
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 5 0
+BBX 4 9 0 0
+BITMAP
+A0
+40
+00
+F0
+10
+20
+40
+80
+F0
+ENDCHAR
+ENDFONT
diff -urN lib/microwindows/src/fonts/helvR10.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/helvR10.c
--- lib/microwindows/src/fonts/helvR10.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/helvR10.c	2005-02-21 16:03:26.000000000 +0100
@@ -0,0 +1,2980 @@
+/* Generated by convbdf on Tue Oct  3 00:24:24 MDT 2000. */
+#include "device.h"
+
+/* Font information:
+
+   name: -Adobe-Helvetica-Medium-R-Normal--10-100-75-75-P-56-ISO8859-1
+   pixel size: 10
+   ascent: 10
+   descent: 2
+*/
+
+/* Font character bitmap data. */
+static MWIMAGEBITS helvR10_bits[] = {
+
+/* Character (0x20):
+   bbw=1, bbh=1, bbx=0, bby=0, width=3
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x21):
+   bbw=1, bbh=8, bbx=1, bby=0, width=3
+   +----------------+
+   |                |
+   |                |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |                |
+   | *              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x0000, 
+0x4000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x22):
+   bbw=3, bbh=2, bbx=1, bby=6, width=4
+   +----------------+
+   |                |
+   |                |
+   | * *            |
+   | * *            |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x5000, 
+0x5000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x23):
+   bbw=6, bbh=7, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |  * *           |
+   |  * *           |
+   | *****          |
+   |  * *           |
+   |*****           |
+   | * *            |
+   | * *            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x2800, 
+0x2800, 
+0x7c00, 
+0x2800, 
+0xf800, 
+0x5000, 
+0x5000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x24):
+   bbw=5, bbh=9, bbx=0, bby=-1, width=6
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   | ***            |
+   |* * *           |
+   |* *             |
+   | ***            |
+   |  * *           |
+   |* * *           |
+   | ***            |
+   |  *             |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x7000, 
+0xa800, 
+0xa000, 
+0x7000, 
+0x2800, 
+0xa800, 
+0x7000, 
+0x2000, 
+0x0000, 
+
+/* Character (0x25):
+   bbw=8, bbh=8, bbx=0, bby=0, width=9
+   +----------------+
+   |                |
+   |                |
+   | **  *          |
+   |*  * *          |
+   | ** *           |
+   |    *           |
+   |   *            |
+   |   * **         |
+   |  * *  *        |
+   |  *  **         |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6400, 
+0x9400, 
+0x6800, 
+0x0800, 
+0x1000, 
+0x1600, 
+0x2900, 
+0x2600, 
+0x0000, 
+0x0000, 
+
+/* Character (0x26):
+   bbw=6, bbh=8, bbx=1, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |   *            |
+   |  * *           |
+   |  * *           |
+   |  **            |
+   | * *  *         |
+   | *  **          |
+   | *  **          |
+   |  **  *         |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1000, 
+0x2800, 
+0x2800, 
+0x3000, 
+0x5200, 
+0x4c00, 
+0x4c00, 
+0x3200, 
+0x0000, 
+0x0000, 
+
+/* Character (0x27):
+   bbw=2, bbh=3, bbx=1, bby=5, width=3
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   |  *             |
+   | *              |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x2000, 
+0x4000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x28):
+   bbw=3, bbh=10, bbx=0, bby=-2, width=4
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   | *              |
+   | *              |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   | *              |
+   | *              |
+   |  *             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x4000, 
+0x4000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x4000, 
+0x4000, 
+0x2000, 
+
+/* Character (0x29):
+   bbw=3, bbh=10, bbx=1, bby=-2, width=4
+   +----------------+
+   |                |
+   |                |
+   | *              |
+   |  *             |
+   |  *             |
+   |   *            |
+   |   *            |
+   |   *            |
+   |   *            |
+   |  *             |
+   |  *             |
+   | *              |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4000, 
+0x2000, 
+0x2000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x2000, 
+0x2000, 
+0x4000, 
+
+/* Character (0x2a):
+   bbw=3, bbh=3, bbx=0, bby=5, width=4
+   +----------------+
+   |                |
+   |                |
+   |* *             |
+   | *              |
+   |* *             |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xa000, 
+0x4000, 
+0xa000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2b):
+   bbw=5, bbh=5, bbx=0, bby=1, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |  *             |
+   |  *             |
+   |*****           |
+   |  *             |
+   |  *             |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x2000, 
+0x2000, 
+0xf800, 
+0x2000, 
+0x2000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2c):
+   bbw=2, bbh=3, bbx=0, bby=-2, width=3
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | *              |
+   | *              |
+   |*               |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x4000, 
+0x4000, 
+0x8000, 
+
+/* Character (0x2d):
+   bbw=5, bbh=1, bbx=1, bby=3, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | *****          |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7c00, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2e):
+   bbw=1, bbh=1, bbx=1, bby=0, width=3
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | *              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x4000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x2f):
+   bbw=3, bbh=8, bbx=0, bby=0, width=3
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   |  *             |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |*               |
+   |*               |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x2000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x8000, 
+0x8000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x30):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x31):
+   bbw=2, bbh=8, bbx=1, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   | **             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x6000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x32):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |    *           |
+   |    *           |
+   |  **            |
+   | *              |
+   |*               |
+   |*****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x0800, 
+0x0800, 
+0x3000, 
+0x4000, 
+0x8000, 
+0xf800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x33):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |    *           |
+   |  **            |
+   |    *           |
+   |    *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x0800, 
+0x3000, 
+0x0800, 
+0x0800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x34):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |   *            |
+   |  **            |
+   | * *            |
+   | * *            |
+   |*  *            |
+   |*****           |
+   |   *            |
+   |   *            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1000, 
+0x3000, 
+0x5000, 
+0x5000, 
+0x9000, 
+0xf800, 
+0x1000, 
+0x1000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x35):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |*               |
+   |*               |
+   |****            |
+   |    *           |
+   |    *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0x8000, 
+0x8000, 
+0xf000, 
+0x0800, 
+0x0800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x36):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*               |
+   |* **            |
+   |**  *           |
+   |*   *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8000, 
+0xb000, 
+0xc800, 
+0x8800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x37):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |    *           |
+   |   *            |
+   |   *            |
+   |  *             |
+   |  *             |
+   | *              |
+   | *              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0x0800, 
+0x1000, 
+0x1000, 
+0x2000, 
+0x2000, 
+0x4000, 
+0x4000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x38):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*   *           |
+   | ***            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8800, 
+0x7000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x39):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*   *           |
+   |*  **           |
+   | ** *           |
+   |    *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8800, 
+0x9800, 
+0x6800, 
+0x0800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3a):
+   bbw=1, bbh=6, bbx=1, bby=0, width=3
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | *              |
+   |                |
+   |                |
+   |                |
+   |                |
+   | *              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x4000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x4000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3b):
+   bbw=2, bbh=8, bbx=0, bby=-2, width=3
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | *              |
+   |                |
+   |                |
+   |                |
+   |                |
+   | *              |
+   | *              |
+   |*               |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x4000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x4000, 
+0x4000, 
+0x8000, 
+
+/* Character (0x3c):
+   bbw=3, bbh=5, bbx=1, bby=1, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |   *            |
+   |  *             |
+   | *              |
+   |  *             |
+   |   *            |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x2000, 
+0x1000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3d):
+   bbw=4, bbh=3, bbx=0, bby=2, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |****            |
+   |                |
+   |****            |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xf000, 
+0x0000, 
+0xf000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3e):
+   bbw=3, bbh=5, bbx=1, bby=1, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | *              |
+   |  *             |
+   |   *            |
+   |  *             |
+   | *              |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x4000, 
+0x2000, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x3f):
+   bbw=4, bbh=8, bbx=1, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |  **            |
+   | *  *           |
+   |    *           |
+   |   *            |
+   |  *             |
+   |  *             |
+   |                |
+   |  *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3000, 
+0x4800, 
+0x0800, 
+0x1000, 
+0x2000, 
+0x2000, 
+0x0000, 
+0x2000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x40):
+   bbw=10, bbh=10, bbx=0, bby=-2, width=11
+   +----------------+
+   |                |
+   |                |
+   |   *****        |
+   |  *     *       |
+   | *  ** * *      |
+   |*  *  *  *      |
+   |* *   *  *      |
+   |* *  *  *       |
+   |* *  *  *       |
+   |*  ** **        |
+   | *              |
+   |  *****         |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1f00, 
+0x2080, 
+0x4d40, 
+0x9240, 
+0xa240, 
+0xa480, 
+0xa480, 
+0x9b00, 
+0x4000, 
+0x3e00, 
+
+/* Character (0x41):
+   bbw=7, bbh=8, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |   *            |
+   |   *            |
+   |  * *           |
+   |  * *           |
+   | *   *          |
+   | *****          |
+   |*     *         |
+   |*     *         |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1000, 
+0x1000, 
+0x2800, 
+0x2800, 
+0x4400, 
+0x7c00, 
+0x8200, 
+0x8200, 
+0x0000, 
+0x0000, 
+
+/* Character (0x42):
+   bbw=5, bbh=8, bbx=1, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | ****           |
+   | *   *          |
+   | *   *          |
+   | ****           |
+   | *   *          |
+   | *   *          |
+   | *   *          |
+   | ****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7800, 
+0x4400, 
+0x4400, 
+0x7800, 
+0x4400, 
+0x4400, 
+0x4400, 
+0x7800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x43):
+   bbw=6, bbh=8, bbx=1, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |  ****          |
+   | *    *         |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *    *         |
+   |  ****          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3c00, 
+0x4200, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4200, 
+0x3c00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x44):
+   bbw=6, bbh=8, bbx=1, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   | ****           |
+   | *   *          |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   | *   *          |
+   | ****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7800, 
+0x4400, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x4400, 
+0x7800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x45):
+   bbw=5, bbh=8, bbx=1, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | *****          |
+   | *              |
+   | *              |
+   | *****          |
+   | *              |
+   | *              |
+   | *              |
+   | *****          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7c00, 
+0x4000, 
+0x4000, 
+0x7c00, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x7c00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x46):
+   bbw=5, bbh=8, bbx=1, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | *****          |
+   | *              |
+   | *              |
+   | ****           |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7c00, 
+0x4000, 
+0x4000, 
+0x7800, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x47):
+   bbw=6, bbh=8, bbx=1, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |  ****          |
+   | *    *         |
+   | *              |
+   | *              |
+   | *   **         |
+   | *    *         |
+   | *   **         |
+   |  *** *         |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3c00, 
+0x4200, 
+0x4000, 
+0x4000, 
+0x4600, 
+0x4200, 
+0x4600, 
+0x3a00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x48):
+   bbw=6, bbh=8, bbx=1, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   | ******         |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x7e00, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x0000, 
+0x0000, 
+
+/* Character (0x49):
+   bbw=1, bbh=8, bbx=1, bby=0, width=3
+   +----------------+
+   |                |
+   |                |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4a):
+   bbw=4, bbh=8, bbx=0, bby=0, width=5
+   +----------------+
+   |                |
+   |                |
+   |   *            |
+   |   *            |
+   |   *            |
+   |   *            |
+   |   *            |
+   |   *            |
+   |*  *            |
+   | **             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x9000, 
+0x6000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4b):
+   bbw=5, bbh=8, bbx=1, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | *   *          |
+   | *  *           |
+   | * *            |
+   | ***            |
+   | *  *           |
+   | *  *           |
+   | *   *          |
+   | *   *          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4400, 
+0x4800, 
+0x5000, 
+0x7000, 
+0x4800, 
+0x4800, 
+0x4400, 
+0x4400, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4c):
+   bbw=4, bbh=8, bbx=1, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | ****           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x7800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4d):
+   bbw=7, bbh=8, bbx=1, bby=0, width=9
+   +----------------+
+   |                |
+   |                |
+   | *     *        |
+   | **   **        |
+   | **   **        |
+   | * * * *        |
+   | * * * *        |
+   | *  *  *        |
+   | *  *  *        |
+   | *  *  *        |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4100, 
+0x6300, 
+0x6300, 
+0x5500, 
+0x5500, 
+0x4900, 
+0x4900, 
+0x4900, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4e):
+   bbw=6, bbh=8, bbx=1, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   | **   *         |
+   | **   *         |
+   | * *  *         |
+   | * *  *         |
+   | *  * *         |
+   | *  * *         |
+   | *   **         |
+   | *   **         |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6200, 
+0x6200, 
+0x5200, 
+0x5200, 
+0x4a00, 
+0x4a00, 
+0x4600, 
+0x4600, 
+0x0000, 
+0x0000, 
+
+/* Character (0x4f):
+   bbw=6, bbh=8, bbx=1, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |  ****          |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   |  ****          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3c00, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x3c00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x50):
+   bbw=5, bbh=8, bbx=1, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | ****           |
+   | *   *          |
+   | *   *          |
+   | ****           |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7800, 
+0x4400, 
+0x4400, 
+0x7800, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x51):
+   bbw=7, bbh=9, bbx=1, bby=-1, width=8
+   +----------------+
+   |                |
+   |                |
+   |  ****          |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   | *  * *         |
+   | *   **         |
+   |  *****         |
+   |       *        |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3c00, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x4a00, 
+0x4600, 
+0x3e00, 
+0x0100, 
+0x0000, 
+
+/* Character (0x52):
+   bbw=5, bbh=8, bbx=1, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | ****           |
+   | *   *          |
+   | *   *          |
+   | ****           |
+   | *   *          |
+   | *   *          |
+   | *   *          |
+   | *   *          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7800, 
+0x4400, 
+0x4400, 
+0x7800, 
+0x4400, 
+0x4400, 
+0x4400, 
+0x4400, 
+0x0000, 
+0x0000, 
+
+/* Character (0x53):
+   bbw=5, bbh=8, bbx=1, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |  ***           |
+   | *   *          |
+   | *              |
+   |  ***           |
+   |     *          |
+   | *   *          |
+   | *   *          |
+   |  ***           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3800, 
+0x4400, 
+0x4000, 
+0x3800, 
+0x0400, 
+0x4400, 
+0x4400, 
+0x3800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x54):
+   bbw=5, bbh=8, bbx=0, bby=0, width=5
+   +----------------+
+   |                |
+   |                |
+   |*****           |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |  *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xf800, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x2000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x55):
+   bbw=6, bbh=8, bbx=1, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   | *    *         |
+   |  ****          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x4200, 
+0x3c00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x56):
+   bbw=7, bbh=8, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |*     *         |
+   |*     *         |
+   | *   *          |
+   | *   *          |
+   | *   *          |
+   |  * *           |
+   |  * *           |
+   |   *            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8200, 
+0x8200, 
+0x4400, 
+0x4400, 
+0x4400, 
+0x2800, 
+0x2800, 
+0x1000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x57):
+   bbw=9, bbh=8, bbx=0, bby=0, width=9
+   +----------------+
+   |                |
+   |                |
+   |*   *   *       |
+   |*   *   *       |
+   | *  *  *        |
+   | *  *  *        |
+   | * * * *        |
+   |  *   *         |
+   |  *   *         |
+   |  *   *         |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8880, 
+0x8880, 
+0x4900, 
+0x4900, 
+0x5500, 
+0x2200, 
+0x2200, 
+0x2200, 
+0x0000, 
+0x0000, 
+
+/* Character (0x58):
+   bbw=5, bbh=8, bbx=1, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | *   *          |
+   | *   *          |
+   |  * *           |
+   |   *            |
+   |  * *           |
+   |  * *           |
+   | *   *          |
+   | *   *          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4400, 
+0x4400, 
+0x2800, 
+0x1000, 
+0x2800, 
+0x2800, 
+0x4400, 
+0x4400, 
+0x0000, 
+0x0000, 
+
+/* Character (0x59):
+   bbw=7, bbh=8, bbx=0, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   |*     *         |
+   | *   *          |
+   | *   *          |
+   |  * *           |
+   |  * *           |
+   |   *            |
+   |   *            |
+   |   *            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8200, 
+0x4400, 
+0x4400, 
+0x2800, 
+0x2800, 
+0x1000, 
+0x1000, 
+0x1000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5a):
+   bbw=5, bbh=8, bbx=1, bby=0, width=7
+   +----------------+
+   |                |
+   |                |
+   | *****          |
+   |     *          |
+   |    *           |
+   |   *            |
+   |   *            |
+   |  *             |
+   | *              |
+   | *****          |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x7c00, 
+0x0400, 
+0x0800, 
+0x1000, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x7c00, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5b):
+   bbw=2, bbh=10, bbx=1, bby=-2, width=3
+   +----------------+
+   |                |
+   |                |
+   | **             |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | **             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x6000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x6000, 
+
+/* Character (0x5c):
+   bbw=3, bbh=8, bbx=0, bby=0, width=3
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   |*               |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |  *             |
+   |  *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0x8000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x2000, 
+0x2000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5d):
+   bbw=2, bbh=10, bbx=0, bby=-2, width=3
+   +----------------+
+   |                |
+   |                |
+   |**              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |**              |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0xc000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0xc000, 
+
+/* Character (0x5e):
+   bbw=5, bbh=5, bbx=0, bby=3, width=6
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   |  *             |
+   | * *            |
+   | * *            |
+   |*   *           |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x2000, 
+0x5000, 
+0x5000, 
+0x8800, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x5f):
+   bbw=6, bbh=1, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |******          |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xfc00, 
+
+/* Character (0x60):
+   bbw=2, bbh=3, bbx=0, bby=5, width=3
+   +----------------+
+   |                |
+   |                |
+   | *              |
+   |*               |
+   |*               |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4000, 
+0x8000, 
+0x8000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x61):
+   bbw=5, bbh=6, bbx=0, bby=0, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |***             |
+   |   *            |
+   | ***            |
+   |*  *            |
+   |*  *            |
+   | ** *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xe000, 
+0x1000, 
+0x7000, 
+0x9000, 
+0x9000, 
+0x6800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x62):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   |*               |
+   |* **            |
+   |**  *           |
+   |*   *           |
+   |*   *           |
+   |**  *           |
+   |* **            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0x8000, 
+0xb000, 
+0xc800, 
+0x8800, 
+0x8800, 
+0xc800, 
+0xb000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x63):
+   bbw=4, bbh=6, bbx=0, bby=0, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | **             |
+   |*  *            |
+   |*               |
+   |*               |
+   |*  *            |
+   | **             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6000, 
+0x9000, 
+0x8000, 
+0x8000, 
+0x9000, 
+0x6000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x64):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |    *           |
+   |    *           |
+   | ** *           |
+   |*  **           |
+   |*   *           |
+   |*   *           |
+   |*  **           |
+   | ** *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0800, 
+0x0800, 
+0x6800, 
+0x9800, 
+0x8800, 
+0x8800, 
+0x9800, 
+0x6800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x65):
+   bbw=4, bbh=6, bbx=0, bby=0, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | **             |
+   |*  *            |
+   |****            |
+   |*               |
+   |*  *            |
+   | **             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6000, 
+0x9000, 
+0xf000, 
+0x8000, 
+0x9000, 
+0x6000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x66):
+   bbw=4, bbh=8, bbx=0, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   |  **            |
+   | *              |
+   |***             |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x3000, 
+0x4000, 
+0xe000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x67):
+   bbw=5, bbh=8, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ** *           |
+   |*  **           |
+   |*   *           |
+   |*   *           |
+   |*  **           |
+   | ** *           |
+   |    *           |
+   | ***            |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6800, 
+0x9800, 
+0x8800, 
+0x8800, 
+0x9800, 
+0x6800, 
+0x0800, 
+0x7000, 
+
+/* Character (0x68):
+   bbw=5, bbh=8, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   |*               |
+   |* **            |
+   |**  *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0x8000, 
+0xb000, 
+0xc800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x69):
+   bbw=1, bbh=8, bbx=0, bby=0, width=2
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   |                |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0x0000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6a):
+   bbw=1, bbh=9, bbx=0, bby=-1, width=2
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   |                |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0x0000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x0000, 
+
+/* Character (0x6b):
+   bbw=4, bbh=8, bbx=0, bby=0, width=5
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   |*               |
+   |*  *            |
+   |* *             |
+   |**              |
+   |* *             |
+   |*  *            |
+   |*  *            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0x8000, 
+0x9000, 
+0xa000, 
+0xc000, 
+0xa000, 
+0x9000, 
+0x9000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6c):
+   bbw=1, bbh=8, bbx=0, bby=0, width=2
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6d):
+   bbw=7, bbh=6, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |*** **          |
+   |*  *  *         |
+   |*  *  *         |
+   |*  *  *         |
+   |*  *  *         |
+   |*  *  *         |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xec00, 
+0x9200, 
+0x9200, 
+0x9200, 
+0x9200, 
+0x9200, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6e):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |* **            |
+   |**  *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xb000, 
+0xc800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x6f):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ***            |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   |*   *           |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x7000, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x8800, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x70):
+   bbw=5, bbh=8, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |* **            |
+   |**  *           |
+   |*   *           |
+   |*   *           |
+   |**  *           |
+   |* **            |
+   |*               |
+   |*               |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xb000, 
+0xc800, 
+0x8800, 
+0x8800, 
+0xc800, 
+0xb000, 
+0x8000, 
+0x8000, 
+
+/* Character (0x71):
+   bbw=5, bbh=8, bbx=0, bby=-2, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | ** *           |
+   |*  **           |
+   |*   *           |
+   |*   *           |
+   |*  **           |
+   | ** *           |
+   |    *           |
+   |    *           |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6800, 
+0x9800, 
+0x8800, 
+0x8800, 
+0x9800, 
+0x6800, 
+0x0800, 
+0x0800, 
+
+/* Character (0x72):
+   bbw=3, bbh=6, bbx=0, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |* *             |
+   |**              |
+   |*               |
+   |*               |
+   |*               |
+   |*               |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xa000, 
+0xc000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x8000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x73):
+   bbw=4, bbh=6, bbx=0, bby=0, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   | **             |
+   |*  *            |
+   | **             |
+   |   *            |
+   |*  *            |
+   | **             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6000, 
+0x9000, 
+0x6000, 
+0x1000, 
+0x9000, 
+0x6000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x74):
+   bbw=3, bbh=8, bbx=0, bby=0, width=4
+   +----------------+
+   |                |
+   |                |
+   | *              |
+   | *              |
+   |***             |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | **             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4000, 
+0x4000, 
+0xe000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x6000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x75):
+   bbw=4, bbh=6, bbx=0, bby=0, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   |*  *            |
+   | ***            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0x9000, 
+0x7000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x76):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |*   *           |
+   |*   *           |
+   | * *            |
+   | * *            |
+   |  *             |
+   |  *             |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x8800, 
+0x8800, 
+0x5000, 
+0x5000, 
+0x2000, 
+0x2000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x77):
+   bbw=7, bbh=6, bbx=0, bby=0, width=8
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |*  *  *         |
+   |*  *  *         |
+   | * * *          |
+   | * * *          |
+   |  * *           |
+   |  * *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x9200, 
+0x9200, 
+0x5400, 
+0x5400, 
+0x2800, 
+0x2800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x78):
+   bbw=5, bbh=6, bbx=0, bby=0, width=6
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |*   *           |
+   | * *            |
+   |  *             |
+   | * *            |
+   |*   *           |
+   |*   *           |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x8800, 
+0x5000, 
+0x2000, 
+0x5000, 
+0x8800, 
+0x8800, 
+0x0000, 
+0x0000, 
+
+/* Character (0x79):
+   bbw=4, bbh=8, bbx=0, bby=-2, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |*  *            |
+   |*  *            |
+   |* *             |
+   |* *             |
+   | **             |
+   | *              |
+   | *              |
+   |*               |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x9000, 
+0x9000, 
+0xa000, 
+0xa000, 
+0x6000, 
+0x4000, 
+0x4000, 
+0x8000, 
+
+/* Character (0x7a):
+   bbw=4, bbh=6, bbx=0, bby=0, width=5
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |****            |
+   |   *            |
+   |  *             |
+   | *              |
+   |*               |
+   |****            |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0xf000, 
+0x1000, 
+0x2000, 
+0x4000, 
+0x8000, 
+0xf000, 
+0x0000, 
+0x0000, 
+
+/* Character (0x7b):
+   bbw=3, bbh=10, bbx=0, bby=-2, width=3
+   +----------------+
+   |                |
+   |                |
+   |  *             |
+   | *              |
+   | *              |
+   | *              |
+   |*               |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |  *             |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x2000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x8000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x2000, 
+
+/* Character (0x7c):
+   bbw=1, bbh=10, bbx=1, bby=-2, width=3
+   +----------------+
+   |                |
+   |                |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+
+/* Character (0x7d):
+   bbw=3, bbh=10, bbx=0, bby=-2, width=3
+   +----------------+
+   |                |
+   |                |
+   |*               |
+   | *              |
+   | *              |
+   | *              |
+   |  *             |
+   | *              |
+   | *              |
+   | *              |
+   | *              |
+   |*               |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x8000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x2000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x4000, 
+0x8000, 
+
+/* Character (0x7e):
+   bbw=6, bbh=2, bbx=0, bby=3, width=7
+   +----------------+
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   | **  *          |
+   |*  **           |
+   |                |
+   |                |
+   |                |
+   |                |
+   |                |
+   +----------------+ */
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x6400, 
+0x9800, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+0x0000, 
+};
+
+/* Character->glyph data. */
+static unsigned short helvR10_offset[] = {
+  0,	/* (0x20) */
+  12,	/* (0x21) */
+  24,	/* (0x22) */
+  36,	/* (0x23) */
+  48,	/* (0x24) */
+  60,	/* (0x25) */
+  72,	/* (0x26) */
+  84,	/* (0x27) */
+  96,	/* (0x28) */
+  108,	/* (0x29) */
+  120,	/* (0x2a) */
+  132,	/* (0x2b) */
+  144,	/* (0x2c) */
+  156,	/* (0x2d) */
+  168,	/* (0x2e) */
+  180,	/* (0x2f) */
+  192,	/* (0x30) */
+  204,	/* (0x31) */
+  216,	/* (0x32) */
+  228,	/* (0x33) */
+  240,	/* (0x34) */
+  252,	/* (0x35) */
+  264,	/* (0x36) */
+  276,	/* (0x37) */
+  288,	/* (0x38) */
+  300,	/* (0x39) */
+  312,	/* (0x3a) */
+  324,	/* (0x3b) */
+  336,	/* (0x3c) */
+  348,	/* (0x3d) */
+  360,	/* (0x3e) */
+  372,	/* (0x3f) */
+  384,	/* (0x40) */
+  396,	/* (0x41) */
+  408,	/* (0x42) */
+  420,	/* (0x43) */
+  432,	/* (0x44) */
+  444,	/* (0x45) */
+  456,	/* (0x46) */
+  468,	/* (0x47) */
+  480,	/* (0x48) */
+  492,	/* (0x49) */
+  504,	/* (0x4a) */
+  516,	/* (0x4b) */
+  528,	/* (0x4c) */
+  540,	/* (0x4d) */
+  552,	/* (0x4e) */
+  564,	/* (0x4f) */
+  576,	/* (0x50) */
+  588,	/* (0x51) */
+  600,	/* (0x52) */
+  612,	/* (0x53) */
+  624,	/* (0x54) */
+  636,	/* (0x55) */
+  648,	/* (0x56) */
+  660,	/* (0x57) */
+  672,	/* (0x58) */
+  684,	/* (0x59) */
+  696,	/* (0x5a) */
+  708,	/* (0x5b) */
+  720,	/* (0x5c) */
+  732,	/* (0x5d) */
+  744,	/* (0x5e) */
+  756,	/* (0x5f) */
+  768,	/* (0x60) */
+  780,	/* (0x61) */
+  792,	/* (0x62) */
+  804,	/* (0x63) */
+  816,	/* (0x64) */
+  828,	/* (0x65) */
+  840,	/* (0x66) */
+  852,	/* (0x67) */
+  864,	/* (0x68) */
+  876,	/* (0x69) */
+  888,	/* (0x6a) */
+  900,	/* (0x6b) */
+  912,	/* (0x6c) */
+  924,	/* (0x6d) */
+  936,	/* (0x6e) */
+  948,	/* (0x6f) */
+  960,	/* (0x70) */
+  972,	/* (0x71) */
+  984,	/* (0x72) */
+  996,	/* (0x73) */
+  1008,	/* (0x74) */
+  1020,	/* (0x75) */
+  1032,	/* (0x76) */
+  1044,	/* (0x77) */
+  1056,	/* (0x78) */
+  1068,	/* (0x79) */
+  1080,	/* (0x7a) */
+  1092,	/* (0x7b) */
+  1104,	/* (0x7c) */
+  1116,	/* (0x7d) */
+  1128,	/* (0x7e) */
+};
+
+/* Character width data. */
+static unsigned char helvR10_width[] = {
+  3,	/* (0x20) */
+  3,	/* (0x21) */
+  4,	/* (0x22) */
+  6,	/* (0x23) */
+  6,	/* (0x24) */
+  9,	/* (0x25) */
+  8,	/* (0x26) */
+  3,	/* (0x27) */
+  4,	/* (0x28) */
+  4,	/* (0x29) */
+  4,	/* (0x2a) */
+  6,	/* (0x2b) */
+  3,	/* (0x2c) */
+  7,	/* (0x2d) */
+  3,	/* (0x2e) */
+  3,	/* (0x2f) */
+  6,	/* (0x30) */
+  6,	/* (0x31) */
+  6,	/* (0x32) */
+  6,	/* (0x33) */
+  6,	/* (0x34) */
+  6,	/* (0x35) */
+  6,	/* (0x36) */
+  6,	/* (0x37) */
+  6,	/* (0x38) */
+  6,	/* (0x39) */
+  3,	/* (0x3a) */
+  3,	/* (0x3b) */
+  6,	/* (0x3c) */
+  5,	/* (0x3d) */
+  6,	/* (0x3e) */
+  6,	/* (0x3f) */
+  11,	/* (0x40) */
+  7,	/* (0x41) */
+  7,	/* (0x42) */
+  8,	/* (0x43) */
+  8,	/* (0x44) */
+  7,	/* (0x45) */
+  6,	/* (0x46) */
+  8,	/* (0x47) */
+  8,	/* (0x48) */
+  3,	/* (0x49) */
+  5,	/* (0x4a) */
+  7,	/* (0x4b) */
+  6,	/* (0x4c) */
+  9,	/* (0x4d) */
+  8,	/* (0x4e) */
+  8,	/* (0x4f) */
+  7,	/* (0x50) */
+  8,	/* (0x51) */
+  7,	/* (0x52) */
+  7,	/* (0x53) */
+  5,	/* (0x54) */
+  8,	/* (0x55) */
+  7,	/* (0x56) */
+  9,	/* (0x57) */
+  7,	/* (0x58) */
+  7,	/* (0x59) */
+  7,	/* (0x5a) */
+  3,	/* (0x5b) */
+  3,	/* (0x5c) */
+  3,	/* (0x5d) */
+  6,	/* (0x5e) */
+  6,	/* (0x5f) */
+  3,	/* (0x60) */
+  5,	/* (0x61) */
+  6,	/* (0x62) */
+  5,	/* (0x63) */
+  6,	/* (0x64) */
+  5,	/* (0x65) */
+  4,	/* (0x66) */
+  6,	/* (0x67) */
+  6,	/* (0x68) */
+  2,	/* (0x69) */
+  2,	/* (0x6a) */
+  5,	/* (0x6b) */
+  2,	/* (0x6c) */
+  8,	/* (0x6d) */
+  6,	/* (0x6e) */
+  6,	/* (0x6f) */
+  6,	/* (0x70) */
+  6,	/* (0x71) */
+  4,	/* (0x72) */
+  5,	/* (0x73) */
+  4,	/* (0x74) */
+  5,	/* (0x75) */
+  6,	/* (0x76) */
+  8,	/* (0x77) */
+  6,	/* (0x78) */
+  5,	/* (0x79) */
+  5,	/* (0x7a) */
+  3,	/* (0x7b) */
+  3,	/* (0x7c) */
+  3,	/* (0x7d) */
+  7,	/* (0x7e) */
+};
+
+/* Exported structure definition. */
+MWCFONT font_helvR10 = {
+  "helvR10",
+  11,
+  12,
+  10,
+  32,
+  95,
+  helvR10_bits,
+  helvR10_offset,
+  helvR10_width,
+};
diff -urN lib/microwindows/src/fonts/rom8x16.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/rom8x16.c
--- lib/microwindows/src/fonts/rom8x16.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/rom8x16.c	2005-02-21 16:03:27.000000000 +0100
@@ -0,0 +1,9494 @@
+/* Generated by convrom.exe*/
+#include "device.h"
+
+/* ROM 8x16 Font bios mode 12 */
+
+static MWIMAGEBITS rom8x16_bits[] = {
+
+/* Character   (0x00):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x01):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | ****** |
+   |*      *|
+   |* *  * *|
+   |*      *|
+   |*      *|
+   |* **** *|
+   |*  **  *|
+   |*      *|
+   |*      *|
+   | ****** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7e00,
+0x8100,
+0xa500,
+0x8100,
+0x8100,
+0xbd00,
+0x9900,
+0x8100,
+0x8100,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x02):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |******* |
+   |******* |
+   |** * ** |
+   |******* |
+   |******* |
+   |* *** * |
+   |**   ** |
+   |******* |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xfe00,
+0xfe00,
+0xd600,
+0xfe00,
+0xfe00,
+0xba00,
+0xc600,
+0xfe00,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x03):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | ** **  |
+   |*** *** |
+   |******* |
+   |******* |
+   |******* |
+   |******* |
+   | *****  |
+   |  ***   |
+   |   *    |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x6c00,
+0xee00,
+0xfe00,
+0xfe00,
+0xfe00,
+0xfe00,
+0x7c00,
+0x3800,
+0x1000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x04):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |   *    |
+   |  ***   |
+   | *****  |
+   |******* |
+   | *****  |
+   |  ***   |
+   |   *    |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x1000,
+0x3800,
+0x7c00,
+0xfe00,
+0x7c00,
+0x3800,
+0x1000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x05):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |   *    |
+   |  ***   |
+   |  ***   |
+   |   *    |
+   | ** **  |
+   |*** *** |
+   | ** **  |
+   |   *    |
+   |  ***   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x1000,
+0x3800,
+0x3800,
+0x1000,
+0x6c00,
+0xee00,
+0x6c00,
+0x1000,
+0x3800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x06):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   *    |
+   |  ***   |
+   | *****  |
+   | *****  |
+   |******* |
+   |******* |
+   |******* |
+   | ** **  |
+   |   *    |
+   |  ***   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1000,
+0x3800,
+0x7c00,
+0x7c00,
+0xfe00,
+0xfe00,
+0xfe00,
+0x6c00,
+0x1000,
+0x3800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x07):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |   **   |
+   |  ****  |
+   |  ****  |
+   |  ****  |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1800,
+0x3c00,
+0x3c00,
+0x3c00,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x08):
+   ht=16, width=8
+   +--------+
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |***  ***|
+   |**    **|
+   |**    **|
+   |**    **|
+   |***  ***|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   +--------+ */
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xe700,
+0xc300,
+0xc300,
+0xc300,
+0xe700,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+
+/* Character 	 (0x09):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |   **   |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1800,
+0x3c00,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 
+ (0x0a):
+   ht=16, width=8
+   +--------+
+   |********|
+   |********|
+   |********|
+   |********|
+   |***  ***|
+   |**    **|
+   |*  **  *|
+   |*  **  *|
+   |*  **  *|
+   |**    **|
+   |***  ***|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   +--------+ */
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xe700,
+0xc300,
+0x9900,
+0x9900,
+0x9900,
+0xc300,
+0xe700,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+
+/* Character  (0x0b):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **** |
+   |    *** |
+   |   **** |
+   |  ** ** |
+   | ****   |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   | ****   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1e00,
+0x0e00,
+0x1e00,
+0x3600,
+0x7800,
+0xcc00,
+0xcc00,
+0xcc00,
+0xcc00,
+0x7800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x0c):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |   **   |
+   | ****** |
+   |   **   |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x1800,
+0x7e00,
+0x1800,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x0d):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **** |
+   |   ** * |
+   |   **** |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   | ****   |
+   |*****   |
+   | ***    |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1e00,
+0x1a00,
+0x1e00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x7800,
+0xf800,
+0x7000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x0e):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ***** |
+   |  ** ** |
+   |  ***** |
+   |  ** ** |
+   |  ** ** |
+   | *** ** |
+   |**** ** |
+   | **  ** |
+   |    *** |
+   |   **** |
+   |    **  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3e00,
+0x3600,
+0x3e00,
+0x3600,
+0x3600,
+0x7600,
+0xf600,
+0x6600,
+0x0e00,
+0x1e00,
+0x0c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x0f):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |** ** **|
+   | ****** |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   | ****** |
+   |** ** **|
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0xdb00,
+0x7e00,
+0x3c00,
+0x6600,
+0x6600,
+0x3c00,
+0x7e00,
+0xdb00,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x10):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |*       |
+   |***     |
+   |****    |
+   |******  |
+   |******* |
+   |******  |
+   |****    |
+   |***     |
+   |*       |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x8000,
+0xe000,
+0xf000,
+0xfc00,
+0xfe00,
+0xfc00,
+0xf000,
+0xe000,
+0x8000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x11):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |      * |
+   |    *** |
+   |  ***** |
+   | ****** |
+   |******* |
+   | ****** |
+   |  ***** |
+   |    *** |
+   |      * |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0200,
+0x0e00,
+0x3e00,
+0x7e00,
+0xfe00,
+0x7e00,
+0x3e00,
+0x0e00,
+0x0200,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x12):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |  ****  |
+   | ****** |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   | ****** |
+   |  ****  |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x3c00,
+0x7e00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x7e00,
+0x3c00,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x13):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |        |
+   | **  ** |
+   | **  ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x0000,
+0x6600,
+0x6600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x14):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *******|
+   |** ** **|
+   |** ** **|
+   |** ** **|
+   |** ** **|
+   | **** **|
+   |   ** **|
+   |   ** **|
+   |   ** **|
+   |   ** **|
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7f00,
+0xdb00,
+0xdb00,
+0xdb00,
+0xdb00,
+0x7b00,
+0x1b00,
+0x1b00,
+0x1b00,
+0x1b00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x15):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   | **     |
+   | *****  |
+   |**** ** |
+   |** **** |
+   | *****  |
+   |    **  |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0x6000,
+0x7c00,
+0xf600,
+0xde00,
+0x7c00,
+0x0c00,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+
+/* Character  (0x16):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |******* |
+   |******* |
+   |******* |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xfe00,
+0xfe00,
+0xfe00,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x17):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |  ****  |
+   | ****** |
+   |   **   |
+   |   **   |
+   |   **   |
+   | ****** |
+   |  ****  |
+   |   **   |
+   | ****** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x3c00,
+0x7e00,
+0x1800,
+0x1800,
+0x1800,
+0x7e00,
+0x3c00,
+0x1800,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x18):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |  ****  |
+   | ****** |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x3c00,
+0x7e00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x19):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   | ****** |
+   |  ****  |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x7e00,
+0x3c00,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character -> (0x1a):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |    **  |
+   |    *** |
+   |********|
+   |    *** |
+   |    **  |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0c00,
+0x0e00,
+0xff00,
+0x0e00,
+0x0c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x1b):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |  **    |
+   | ***    |
+   |******* |
+   | ***    |
+   |  **    |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3000,
+0x7000,
+0xfe00,
+0x7000,
+0x3000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x1c):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |**      |
+   |**      |
+   |**      |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xc000,
+0xc000,
+0xc000,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x1d):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |  *  *  |
+   | **  ** |
+   |********|
+   | **  ** |
+   |  *  *  |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x2400,
+0x6600,
+0xff00,
+0x6600,
+0x2400,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x1e):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |   *    |
+   |  ***   |
+   |  ***   |
+   |  ***   |
+   | *****  |
+   | *****  |
+   |******* |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x1000,
+0x3800,
+0x3800,
+0x3800,
+0x7c00,
+0x7c00,
+0xfe00,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x1f):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |******* |
+   |******* |
+   | *****  |
+   | *****  |
+   | *****  |
+   |  ***   |
+   |  ***   |
+   |   *    |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0xfe00,
+0xfe00,
+0x7c00,
+0x7c00,
+0x7c00,
+0x3800,
+0x3800,
+0x1000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character   (0x20):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ! (0x21):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |  ****  |
+   |  ****  |
+   |  ****  |
+   |  ****  |
+   |   **   |
+   |   **   |
+   |        |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x3c00,
+0x3c00,
+0x3c00,
+0x3c00,
+0x1800,
+0x1800,
+0x0000,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character " (0x22):
+   ht=16, width=8
+   +--------+
+   |        |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |   * *  |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x1400,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character # (0x23):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | ** **  |
+   | ** **  |
+   | ** **  |
+   |******* |
+   | ** **  |
+   | ** **  |
+   |******* |
+   | ** **  |
+   | ** **  |
+   | ** **  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x6c00,
+0x6c00,
+0x6c00,
+0xfe00,
+0x6c00,
+0x6c00,
+0xfe00,
+0x6c00,
+0x6c00,
+0x6c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character $ (0x24):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   | *****  |
+   |**   ** |
+   |**      |
+   | ****   |
+   |  ****  |
+   |     ** |
+   |**   ** |
+   | *****  |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x7c00,
+0xc600,
+0xc000,
+0x7800,
+0x3c00,
+0x0600,
+0xc600,
+0x7c00,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+
+/* Character % (0x25):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | **   * |
+   | **  ** |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **  ** |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6200,
+0x6600,
+0x0c00,
+0x1800,
+0x3000,
+0x6600,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character & (0x26):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ***   |
+   | ** **  |
+   |  ***   |
+   |  **    |
+   | *** ** |
+   | ****** |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   | *** ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3800,
+0x6c00,
+0x3800,
+0x3000,
+0x7600,
+0x7e00,
+0xcc00,
+0xcc00,
+0xcc00,
+0x7600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ' (0x27):
+   ht=16, width=8
+   +--------+
+   |        |
+   |    **  |
+   |    **  |
+   |    **  |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0c00,
+0x0c00,
+0x0c00,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ( (0x28):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |    **  |
+   |   **   |
+   |  **    |
+   |  **    |
+   |  **    |
+   |  **    |
+   |  **    |
+   |  **    |
+   |   **   |
+   |    **  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0c00,
+0x1800,
+0x3000,
+0x3000,
+0x3000,
+0x3000,
+0x3000,
+0x3000,
+0x1800,
+0x0c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ) (0x29):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  **    |
+   |   **   |
+   |    **  |
+   |    **  |
+   |    **  |
+   |    **  |
+   |    **  |
+   |    **  |
+   |   **   |
+   |  **    |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3000,
+0x1800,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x1800,
+0x3000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character * (0x2a):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | ** **  |
+   |  ***   |
+   |******* |
+   |  ***   |
+   | ** **  |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6c00,
+0x3800,
+0xfe00,
+0x3800,
+0x6c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character + (0x2b):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   | ****** |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x7e00,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character , (0x2c):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |    **  |
+   |    **  |
+   |    **  |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0c00,
+0x0c00,
+0x0c00,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character - (0x2d):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character . (0x2e):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character / (0x2f):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |      * |
+   |     ** |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **     |
+   |**      |
+   |*       |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0200,
+0x0600,
+0x0c00,
+0x1800,
+0x3000,
+0x6000,
+0xc000,
+0x8000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 0 (0x30):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**  *** |
+   |** **** |
+   |**** ** |
+   |***  ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xce00,
+0xde00,
+0xf600,
+0xe600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 1 (0x31):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   | ****   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   | ****** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x7800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 2 (0x32):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |     ** |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **     |
+   |**   ** |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0x0600,
+0x0c00,
+0x1800,
+0x3000,
+0x6000,
+0xc600,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 3 (0x33):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |     ** |
+   |     ** |
+   |  ****  |
+   |     ** |
+   |     ** |
+   |     ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0x0600,
+0x0600,
+0x3c00,
+0x0600,
+0x0600,
+0x0600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 4 (0x34):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |    **  |
+   |   ***  |
+   |  ****  |
+   | ** **  |
+   |**  **  |
+   |**  **  |
+   |******* |
+   |    **  |
+   |    **  |
+   |   **** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0c00,
+0x1c00,
+0x3c00,
+0x6c00,
+0xcc00,
+0xcc00,
+0xfe00,
+0x0c00,
+0x0c00,
+0x1e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 5 (0x35):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |******* |
+   |**      |
+   |**      |
+   |**      |
+   |******  |
+   |     ** |
+   |     ** |
+   |     ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xfe00,
+0xc000,
+0xc000,
+0xc000,
+0xfc00,
+0x0600,
+0x0600,
+0x0600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 6 (0x36):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**      |
+   |**      |
+   |******  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc000,
+0xc000,
+0xfc00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 7 (0x37):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |******* |
+   |**   ** |
+   |     ** |
+   |    **  |
+   |   **   |
+   |  **    |
+   |  **    |
+   |  **    |
+   |  **    |
+   |  **    |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xfe00,
+0xc600,
+0x0600,
+0x0c00,
+0x1800,
+0x3000,
+0x3000,
+0x3000,
+0x3000,
+0x3000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 8 (0x38):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 9 (0x39):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | ****** |
+   |     ** |
+   |     ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x7e00,
+0x0600,
+0x0600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character : (0x3a):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |    **  |
+   |    **  |
+   |        |
+   |        |
+   |    **  |
+   |    **  |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0c00,
+0x0c00,
+0x0000,
+0x0000,
+0x0c00,
+0x0c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ; (0x3b):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |    **  |
+   |    **  |
+   |        |
+   |        |
+   |    **  |
+   |    **  |
+   |    **  |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0c00,
+0x0c00,
+0x0000,
+0x0000,
+0x0c00,
+0x0c00,
+0x0c00,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character < (0x3c):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **     |
+   |**      |
+   | **     |
+   |  **    |
+   |   **   |
+   |    **  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0c00,
+0x1800,
+0x3000,
+0x6000,
+0xc000,
+0x6000,
+0x3000,
+0x1800,
+0x0c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character = (0x3d):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |******* |
+   |        |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xfe00,
+0x0000,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character > (0x3e):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | **     |
+   |  **    |
+   |   **   |
+   |    **  |
+   |     ** |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **     |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x3000,
+0x1800,
+0x0c00,
+0x0600,
+0x0c00,
+0x1800,
+0x3000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ? (0x3f):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |    **  |
+   |   **   |
+   |   **   |
+   |   **   |
+   |        |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0x0c00,
+0x1800,
+0x1800,
+0x1800,
+0x0000,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character @ (0x40):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |** **** |
+   |** **** |
+   |** **** |
+   |** ***  |
+   |**      |
+   | ****** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0xde00,
+0xde00,
+0xde00,
+0xdc00,
+0xc000,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character A (0x41):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |******* |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3800,
+0x6c00,
+0xc600,
+0xc600,
+0xc600,
+0xfe00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character B (0x42):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |******  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | *****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |******  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xfc00,
+0x6600,
+0x6600,
+0x6600,
+0x7c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0xfc00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character C (0x43):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   |**    * |
+   |**      |
+   |**      |
+   |**      |
+   |**      |
+   |**    * |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0xc200,
+0xc000,
+0xc000,
+0xc000,
+0xc000,
+0xc200,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character D (0x44):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |*****   |
+   | ** **  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | ** **  |
+   |*****   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xf800,
+0x6c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6c00,
+0xf800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character E (0x45):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |******* |
+   | **  ** |
+   | **     |
+   | **  *  |
+   | *****  |
+   | **  *  |
+   | **     |
+   | **     |
+   | **  ** |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xfe00,
+0x6600,
+0x6000,
+0x6400,
+0x7c00,
+0x6400,
+0x6000,
+0x6000,
+0x6600,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character F (0x46):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |******* |
+   | **  ** |
+   | **     |
+   | **  *  |
+   | *****  |
+   | **  *  |
+   | **     |
+   | **     |
+   | **     |
+   |****    |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xfe00,
+0x6600,
+0x6000,
+0x6400,
+0x7c00,
+0x6400,
+0x6000,
+0x6000,
+0x6000,
+0xf000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character G (0x47):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**      |
+   |**      |
+   |**      |
+   |**  *** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xc000,
+0xc000,
+0xc000,
+0xce00,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character H (0x48):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |******* |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xfe00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character I (0x49):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character J (0x4a):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |** **   |
+   |** **   |
+   | ***    |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xd800,
+0xd800,
+0x7000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character K (0x4b):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**  **  |
+   |** **   |
+   |****    |
+   |****    |
+   |** **   |
+   |**  **  |
+   |**   ** |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0xcc00,
+0xd800,
+0xf000,
+0xf000,
+0xd800,
+0xcc00,
+0xc600,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character L (0x4c):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |****    |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **   * |
+   | **  ** |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xf000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6200,
+0x6600,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character M (0x4d):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   |*** *** |
+   |*** *** |
+   |******* |
+   |** * ** |
+   |** * ** |
+   |** * ** |
+   |**   ** |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0xee00,
+0xee00,
+0xfe00,
+0xd600,
+0xd600,
+0xd600,
+0xc600,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character N (0x4e):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   |***  ** |
+   |***  ** |
+   |**** ** |
+   |** **** |
+   |**  *** |
+   |**  *** |
+   |**   ** |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0xe600,
+0xe600,
+0xf600,
+0xde00,
+0xce00,
+0xce00,
+0xc600,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character O (0x4f):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character P (0x50):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |******  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | *****  |
+   | **     |
+   | **     |
+   | **     |
+   |****    |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xfc00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x7c00,
+0x6000,
+0x6000,
+0x6000,
+0xf000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character Q (0x51):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |** * ** |
+   |** * ** |
+   | *****  |
+   |     ** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xd600,
+0xd600,
+0x7c00,
+0x0600,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character R (0x52):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |******  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | *****  |
+   | ****   |
+   | ** **  |
+   | **  ** |
+   | **  ** |
+   |***  ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xfc00,
+0x6600,
+0x6600,
+0x6600,
+0x7c00,
+0x7800,
+0x6c00,
+0x6600,
+0x6600,
+0xe600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character S (0x53):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**      |
+   |**      |
+   | ***    |
+   |   ***  |
+   |     ** |
+   |     ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc000,
+0xc000,
+0x7000,
+0x1c00,
+0x0600,
+0x0600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character T (0x54):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | ****** |
+   | * ** * |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7e00,
+0x5a00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character U (0x55):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character V (0x56):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | ** **  |
+   |  ***   |
+   |   *    |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x6c00,
+0x3800,
+0x1000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character W (0x57):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |** * ** |
+   |** * ** |
+   |** * ** |
+   |******* |
+   |*** *** |
+   |**   ** |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0xc600,
+0xd600,
+0xd600,
+0xd600,
+0xfe00,
+0xee00,
+0xc600,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character X (0x58):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | ** **  |
+   |  ***   |
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0xc600,
+0x6c00,
+0x3800,
+0x3800,
+0x6c00,
+0xc600,
+0xc600,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character Y (0x59):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x1800,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character Z (0x5a):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |******* |
+   |**   ** |
+   |*    ** |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **     |
+   |**    * |
+   |**   ** |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xfe00,
+0xc600,
+0x8600,
+0x0c00,
+0x1800,
+0x3000,
+0x6000,
+0xc200,
+0xc600,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character [ (0x5b):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character \ (0x5c):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |*       |
+   |**      |
+   | **     |
+   |  **    |
+   |   **   |
+   |    **  |
+   |     ** |
+   |      * |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x8000,
+0xc000,
+0x6000,
+0x3000,
+0x1800,
+0x0c00,
+0x0600,
+0x0200,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ] (0x5d):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |    **  |
+   |    **  |
+   |    **  |
+   |    **  |
+   |    **  |
+   |    **  |
+   |    **  |
+   |    **  |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ^ (0x5e):
+   ht=16, width=8
+   +--------+
+   |        |
+   |   *    |
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x1000,
+0x3800,
+0x6c00,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character _ (0x5f):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |********|
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xff00,
+0x0000,
+0x0000,
+
+/* Character ` (0x60):
+   ht=16, width=8
+   +--------+
+   |        |
+   |   **   |
+   |   **   |
+   |   **   |
+   |    **  |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x1800,
+0x1800,
+0x1800,
+0x0c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character a (0x61):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | ****   |
+   |    **  |
+   | *****  |
+   |**  **  |
+   |**  **  |
+   |** ***  |
+   | *** ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7800,
+0x0c00,
+0x7c00,
+0xcc00,
+0xcc00,
+0xdc00,
+0x7600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character b (0x62):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |***     |
+   | **     |
+   | **     |
+   | *****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |******  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xe000,
+0x6000,
+0x6000,
+0x7c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0xfc00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character c (0x63):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**      |
+   |**      |
+   |**      |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc000,
+0xc000,
+0xc000,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character d (0x64):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   ***  |
+   |    **  |
+   |    **  |
+   | *****  |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   | ****** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1c00,
+0x0c00,
+0x0c00,
+0x7c00,
+0xcc00,
+0xcc00,
+0xcc00,
+0xcc00,
+0xcc00,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character e (0x65):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |******* |
+   |**      |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xfe00,
+0xc000,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character f (0x66):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   ***  |
+   |  ** ** |
+   |  **    |
+   |  **    |
+   |******  |
+   |  **    |
+   |  **    |
+   |  **    |
+   |  **    |
+   | ****   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1c00,
+0x3600,
+0x3000,
+0x3000,
+0xfc00,
+0x3000,
+0x3000,
+0x3000,
+0x3000,
+0x7800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character g (0x67):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | *** ** |
+   |**  *** |
+   |**   ** |
+   |**   ** |
+   |**  *** |
+   | *** ** |
+   |     ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7600,
+0xce00,
+0xc600,
+0xc600,
+0xce00,
+0x7600,
+0x0600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+
+/* Character h (0x68):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |***     |
+   | **     |
+   | **     |
+   | *****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |***  ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xe000,
+0x6000,
+0x6000,
+0x7c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0xe600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character i (0x69):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   |        |
+   |  ***   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x0000,
+0x3800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character j (0x6a):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |    **  |
+   |    **  |
+   |        |
+   |   ***  |
+   |    **  |
+   |    **  |
+   |    **  |
+   |    **  |
+   |    **  |
+   |**  **  |
+   |**  **  |
+   | ****   |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0c00,
+0x0c00,
+0x0000,
+0x1c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0xcc00,
+0xcc00,
+0x7800,
+0x0000,
+0x0000,
+
+/* Character k (0x6b):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |***     |
+   | **     |
+   | **     |
+   | **  ** |
+   | **  ** |
+   | ** **  |
+   | ****   |
+   | ** **  |
+   | **  ** |
+   |***  ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xe000,
+0x6000,
+0x6000,
+0x6600,
+0x6600,
+0x6c00,
+0x7800,
+0x6c00,
+0x6600,
+0xe600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character l (0x6c):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   ***  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character m (0x6d):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | ** **  |
+   |******* |
+   |** * ** |
+   |** * ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6c00,
+0xfe00,
+0xd600,
+0xd600,
+0xc600,
+0xc600,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character n (0x6e):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |** ***  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xdc00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character o (0x6f):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character p (0x70):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |** ***  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | *****  |
+   | **     |
+   | **     |
+   |****    |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xdc00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x7c00,
+0x6000,
+0x6000,
+0xf000,
+0x0000,
+0x0000,
+
+/* Character q (0x71):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | *** ** |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   | *****  |
+   |    **  |
+   |    **  |
+   |   **** |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7600,
+0xcc00,
+0xcc00,
+0xcc00,
+0xcc00,
+0x7c00,
+0x0c00,
+0x0c00,
+0x1e00,
+0x0000,
+0x0000,
+
+/* Character r (0x72):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |** ***  |
+   | **  ** |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   |****    |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xdc00,
+0x6600,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0xf000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character s (0x73):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**      |
+   | *****  |
+   |     ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc000,
+0x7c00,
+0x0600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character t (0x74):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  **    |
+   |  **    |
+   |  **    |
+   |******  |
+   |  **    |
+   |  **    |
+   |  **    |
+   |  **    |
+   |  ** ** |
+   |   ***  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3000,
+0x3000,
+0x3000,
+0xfc00,
+0x3000,
+0x3000,
+0x3000,
+0x3000,
+0x3600,
+0x1c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character u (0x75):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   | *** ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xcc00,
+0xcc00,
+0xcc00,
+0xcc00,
+0xcc00,
+0xcc00,
+0x7600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character v (0x76):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | ** **  |
+   |  ***   |
+   |   *    |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x6c00,
+0x3800,
+0x1000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character w (0x77):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   |** * ** |
+   |** * ** |
+   |** * ** |
+   |******* |
+   | ** **  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0xd600,
+0xd600,
+0xd600,
+0xfe00,
+0x6c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character x (0x78):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   | ** **  |
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0x6c00,
+0x3800,
+0x6c00,
+0xc600,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character y (0x79):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**  *** |
+   | *** ** |
+   |     ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xce00,
+0x7600,
+0x0600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+
+/* Character z (0x7a):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |******* |
+   |*    ** |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **   * |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xfe00,
+0x8600,
+0x0c00,
+0x1800,
+0x3000,
+0x6200,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character { (0x7b):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |    *** |
+   |   **   |
+   |   **   |
+   |   **   |
+   | ***    |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |    *** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0e00,
+0x1800,
+0x1800,
+0x1800,
+0x7000,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x0e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character | (0x7c):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |        |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x0000,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character } (0x7d):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | ***    |
+   |   **   |
+   |   **   |
+   |   **   |
+   |    *** |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   | ***    |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7000,
+0x1800,
+0x1800,
+0x1800,
+0x0e00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x7000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ~ (0x7e):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *** ** |
+   |** ***  |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7600,
+0xdc00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x7f):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |   *    |
+   |  ***   |
+   |  ***   |
+   | ** **  |
+   | ** **  |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1000,
+0x3800,
+0x3800,
+0x6c00,
+0x6c00,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x80):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   |**      |
+   |**      |
+   |**      |
+   |**   ** |
+   | **  ** |
+   |  ****  |
+   |   **   |
+   |    **  |
+   |**  **  |
+   |  ***   |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0xc000,
+0xc000,
+0xc000,
+0xc600,
+0x6600,
+0x3c00,
+0x1800,
+0x0c00,
+0xcc00,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0x81):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |**   ** |
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**  *** |
+   | *** ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc600,
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xce00,
+0x7600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x82):
+   ht=16, width=8
+   +--------+
+   |        |
+   |    **  |
+   |   **   |
+   |  **    |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |******* |
+   |**      |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0c00,
+0x1800,
+0x3000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xfe00,
+0xc000,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x83):
+   ht=16, width=8
+   +--------+
+   |        |
+   |  **    |
+   | ****   |
+   |**  **  |
+   |        |
+   | ****   |
+   |    **  |
+   | *****  |
+   |**  **  |
+   |**  **  |
+   |** ***  |
+   | *** ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x3000,
+0x7800,
+0xcc00,
+0x0000,
+0x7800,
+0x0c00,
+0x7c00,
+0xcc00,
+0xcc00,
+0xdc00,
+0x7600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x84):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |**  **  |
+   |        |
+   |        |
+   | ****   |
+   |    **  |
+   | *****  |
+   |**  **  |
+   |**  **  |
+   |** ***  |
+   | *** ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xcc00,
+0x0000,
+0x0000,
+0x7800,
+0x0c00,
+0x7c00,
+0xcc00,
+0xcc00,
+0xdc00,
+0x7600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x85):
+   ht=16, width=8
+   +--------+
+   |        |
+   | **     |
+   |  **    |
+   |   **   |
+   |        |
+   | ****   |
+   |    **  |
+   | *****  |
+   |**  **  |
+   |**  **  |
+   |** ***  |
+   | *** ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x6000,
+0x3000,
+0x1800,
+0x0000,
+0x7800,
+0x0c00,
+0x7c00,
+0xcc00,
+0xcc00,
+0xdc00,
+0x7600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x86):
+   ht=16, width=8
+   +--------+
+   |        |
+   |  ***   |
+   | ** **  |
+   |  ***   |
+   |        |
+   | ****   |
+   |    **  |
+   | *****  |
+   |**  **  |
+   |**  **  |
+   |** ***  |
+   | *** ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x3800,
+0x6c00,
+0x3800,
+0x0000,
+0x7800,
+0x0c00,
+0x7c00,
+0xcc00,
+0xcc00,
+0xdc00,
+0x7600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x87):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**      |
+   |**      |
+   |**   ** |
+   | *****  |
+   |   **   |
+   |    **  |
+   | ** **  |
+   |  ***   |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc000,
+0xc000,
+0xc600,
+0x7c00,
+0x1800,
+0x0c00,
+0x6c00,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0x88):
+   ht=16, width=8
+   +--------+
+   |        |
+   |  **    |
+   | ****   |
+   |**  **  |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |******* |
+   |**      |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x3000,
+0x7800,
+0xcc00,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xfe00,
+0xc000,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x89):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |**  **  |
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |******* |
+   |**      |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xcc00,
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xfe00,
+0xc000,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x8a):
+   ht=16, width=8
+   +--------+
+   |        |
+   |  **    |
+   |   **   |
+   |    **  |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |******* |
+   |**      |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x3000,
+0x1800,
+0x0c00,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xfe00,
+0xc000,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x8b):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | **  ** |
+   |        |
+   |        |
+   |  ***   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x6600,
+0x0000,
+0x0000,
+0x3800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x8c):
+   ht=16, width=8
+   +--------+
+   |        |
+   |   **   |
+   |  ****  |
+   | **  ** |
+   |        |
+   |  ***   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x1800,
+0x3c00,
+0x6600,
+0x0000,
+0x3800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x8d):
+   ht=16, width=8
+   +--------+
+   |        |
+   | **     |
+   |  **    |
+   |   **   |
+   |        |
+   |  ***   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x6000,
+0x3000,
+0x1800,
+0x0000,
+0x3800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x8e):
+   ht=16, width=8
+   +--------+
+   |        |
+   |**   ** |
+   |        |
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |******* |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0xc600,
+0x0000,
+0x3800,
+0x6c00,
+0xc600,
+0xc600,
+0xc600,
+0xfe00,
+0xc600,
+0xc600,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x8f):
+   ht=16, width=8
+   +--------+
+   |  ***   |
+   | ** **  |
+   |  ***   |
+   |        |
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |**   ** |
+   |******* |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3800,
+0x6c00,
+0x3800,
+0x0000,
+0x3800,
+0x6c00,
+0xc600,
+0xc600,
+0xfe00,
+0xc600,
+0xc600,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x90):
+   ht=16, width=8
+   +--------+
+   |    **  |
+   |   **   |
+   |  **    |
+   |        |
+   |******* |
+   | **     |
+   | **     |
+   | *****  |
+   | **     |
+   | **     |
+   | **     |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0c00,
+0x1800,
+0x3000,
+0x0000,
+0xfe00,
+0x6000,
+0x6000,
+0x7c00,
+0x6000,
+0x6000,
+0x6000,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x91):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   | **  ** |
+   |** ** **|
+   |   ** **|
+   | *******|
+   |** **   |
+   |** **   |
+   |** *****|
+   | *** ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6600,
+0xdb00,
+0x1b00,
+0x7f00,
+0xd800,
+0xd800,
+0xdf00,
+0x7600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x92):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | ****** |
+   |** **   |
+   |** **   |
+   |** **   |
+   |** **   |
+   |******* |
+   |** **   |
+   |** **   |
+   |** **   |
+   |** **** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7e00,
+0xd800,
+0xd800,
+0xd800,
+0xd800,
+0xfe00,
+0xd800,
+0xd800,
+0xd800,
+0xde00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x93):
+   ht=16, width=8
+   +--------+
+   |        |
+   |  **    |
+   | ****   |
+   |**  **  |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x3000,
+0x7800,
+0xcc00,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x94):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |**   ** |
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc600,
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x95):
+   ht=16, width=8
+   +--------+
+   |        |
+   |  **    |
+   |   **   |
+   |    **  |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x3000,
+0x1800,
+0x0c00,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x96):
+   ht=16, width=8
+   +--------+
+   |        |
+   |  **    |
+   | ****   |
+   |**  **  |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**  *** |
+   | *** ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x3000,
+0x7800,
+0xcc00,
+0x0000,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xce00,
+0x7600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x97):
+   ht=16, width=8
+   +--------+
+   |        |
+   | **     |
+   |  **    |
+   |   **   |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**  *** |
+   | *** ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x6000,
+0x3000,
+0x1800,
+0x0000,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xce00,
+0x7600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x98):
+   ht=16, width=8
+   +--------+
+   |        |
+   |**   ** |
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**  *** |
+   | *** ** |
+   |     ** |
+   |     ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0xc600,
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xce00,
+0x7600,
+0x0600,
+0x0600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+
+/* Character � (0x99):
+   ht=16, width=8
+   +--------+
+   |        |
+   |**   ** |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0xc600,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x9a):
+   ht=16, width=8
+   +--------+
+   |        |
+   |**   ** |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0xc600,
+0x0000,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x9b):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   | *****  |
+   |**   ** |
+   |**      |
+   |**      |
+   |**   ** |
+   | *****  |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x7c00,
+0xc600,
+0xc000,
+0xc000,
+0xc600,
+0x7c00,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x9c):
+   ht=16, width=8
+   +--------+
+   |        |
+   |  ***   |
+   | ** **  |
+   | **     |
+   | **     |
+   |****    |
+   | **     |
+   | **     |
+   | **     |
+   | **  ** |
+   |**** ** |
+   | ** **  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x3800,
+0x6c00,
+0x6000,
+0x6000,
+0xf000,
+0x6000,
+0x6000,
+0x6000,
+0x6600,
+0xf600,
+0x6c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x9d):
+   ht=16, width=8
+   +--------+
+   |        |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |   **   |
+   | ****** |
+   |   **   |
+   |  ****  |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x1800,
+0x7e00,
+0x1800,
+0x3c00,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x9e):
+   ht=16, width=8
+   +--------+
+   |        |
+   |******  |
+   |**   ** |
+   |**   ** |
+   |******  |
+   |**      |
+   |**  **  |
+   |** **** |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0xfc00,
+0xc600,
+0xc600,
+0xfc00,
+0xc000,
+0xcc00,
+0xde00,
+0xcc00,
+0xcc00,
+0xcc00,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x9f):
+   ht=16, width=8
+   +--------+
+   |        |
+   |    *** |
+   |   ** **|
+   |   **   |
+   |   **   |
+   |   **   |
+   | ****** |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |** **   |
+   | ***    |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0e00,
+0x1b00,
+0x1800,
+0x1800,
+0x1800,
+0x7e00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xd800,
+0x7000,
+0x0000,
+0x0000,
+
+/* Character � (0xa0):
+   ht=16, width=8
+   +--------+
+   |        |
+   |    **  |
+   |   **   |
+   |  **    |
+   |        |
+   | ****   |
+   |    **  |
+   | *****  |
+   |**  **  |
+   |**  **  |
+   |** ***  |
+   | *** ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0c00,
+0x1800,
+0x3000,
+0x0000,
+0x7800,
+0x0c00,
+0x7c00,
+0xcc00,
+0xcc00,
+0xdc00,
+0x7600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa1):
+   ht=16, width=8
+   +--------+
+   |        |
+   |    **  |
+   |   **   |
+   |  **    |
+   |        |
+   |  ***   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0c00,
+0x1800,
+0x3000,
+0x0000,
+0x3800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa2):
+   ht=16, width=8
+   +--------+
+   |        |
+   |    **  |
+   |   **   |
+   |  **    |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0c00,
+0x1800,
+0x3000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa3):
+   ht=16, width=8
+   +--------+
+   |        |
+   |   **   |
+   |  **    |
+   | **     |
+   |        |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   |** ***  |
+   | *** ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x1800,
+0x3000,
+0x6000,
+0x0000,
+0xcc00,
+0xcc00,
+0xcc00,
+0xcc00,
+0xcc00,
+0xdc00,
+0x7600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa4):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *** ** |
+   |** ***  |
+   |        |
+   |* ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |***  ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7600,
+0xdc00,
+0x0000,
+0xbc00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0xe600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa5):
+   ht=16, width=8
+   +--------+
+   |        |
+   | *** ** |
+   |** ***  |
+   |        |
+   |**   ** |
+   |**   ** |
+   |***  ** |
+   |**** ** |
+   |** **** |
+   |**  *** |
+   |**   ** |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x7600,
+0xdc00,
+0x0000,
+0xc600,
+0xc600,
+0xe600,
+0xf600,
+0xde00,
+0xce00,
+0xc600,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa6):
+   ht=16, width=8
+   +--------+
+   |        |
+   |  ****  |
+   | ** **  |
+   | ** **  |
+   |  ***** |
+   |        |
+   | ****** |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x3c00,
+0x6c00,
+0x6c00,
+0x3e00,
+0x0000,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa7):
+   ht=16, width=8
+   +--------+
+   |        |
+   |  ***   |
+   | ** **  |
+   | ** **  |
+   |  ***   |
+   |        |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x3800,
+0x6c00,
+0x6c00,
+0x3800,
+0x0000,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa8):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  **    |
+   |  **    |
+   |        |
+   |  **    |
+   |  **    |
+   |  **    |
+   | **     |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3000,
+0x3000,
+0x0000,
+0x3000,
+0x3000,
+0x3000,
+0x6000,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa9):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | ****** |
+   | **     |
+   | **     |
+   | **     |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7e00,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xaa):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | ****** |
+   |     ** |
+   |     ** |
+   |     ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7e00,
+0x0600,
+0x0600,
+0x0600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xab):
+   ht=16, width=8
+   +--------+
+   |        |
+   | **     |
+   | **     |
+   | **   * |
+   | **  ** |
+   | ** **  |
+   |   **   |
+   |  **    |
+   | **     |
+   |** ***  |
+   |  ** ** |
+   |    **  |
+   |   **   |
+   |  ***** |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x6000,
+0x6000,
+0x6200,
+0x6600,
+0x6c00,
+0x1800,
+0x3000,
+0x6000,
+0xdc00,
+0x3600,
+0x0c00,
+0x1800,
+0x3e00,
+0x0000,
+0x0000,
+
+/* Character � (0xac):
+   ht=16, width=8
+   +--------+
+   |        |
+   | **     |
+   | **     |
+   | **   * |
+   | **  ** |
+   | ** **  |
+   |   **   |
+   |  ** ** |
+   | ** *** |
+   |** **** |
+   |  ** ** |
+   | ****** |
+   |     ** |
+   |     ** |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x6000,
+0x6000,
+0x6200,
+0x6600,
+0x6c00,
+0x1800,
+0x3600,
+0x6e00,
+0xde00,
+0x3600,
+0x7e00,
+0x0600,
+0x0600,
+0x0000,
+0x0000,
+
+/* Character � (0xad):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   |        |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |  ****  |
+   |  ****  |
+   |  ****  |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x0000,
+0x1800,
+0x1800,
+0x3c00,
+0x3c00,
+0x3c00,
+0x3c00,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xae):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |  ** ** |
+   | ** **  |
+   |** **   |
+   | ** **  |
+   |  ** ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3600,
+0x6c00,
+0xd800,
+0x6c00,
+0x3600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xaf):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |** **   |
+   | ** **  |
+   |  ** ** |
+   | ** **  |
+   |** **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xd800,
+0x6c00,
+0x3600,
+0x6c00,
+0xd800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xb0):
+   ht=16, width=8
+   +--------+
+   |   *   *|
+   | *   *  |
+   |   *   *|
+   | *   *  |
+   |   *   *|
+   | *   *  |
+   |   *   *|
+   | *   *  |
+   |   *   *|
+   | *   *  |
+   |   *   *|
+   | *   *  |
+   |   *   *|
+   | *   *  |
+   |   *   *|
+   | *   *  |
+   +--------+ */
+0x1100,
+0x4400,
+0x1100,
+0x4400,
+0x1100,
+0x4400,
+0x1100,
+0x4400,
+0x1100,
+0x4400,
+0x1100,
+0x4400,
+0x1100,
+0x4400,
+0x1100,
+0x4400,
+
+/* Character � (0xb1):
+   ht=16, width=8
+   +--------+
+   |* * * * |
+   | * * * *|
+   |* * * * |
+   | * * * *|
+   |* * * * |
+   | * * * *|
+   |* * * * |
+   | * * * *|
+   |* * * * |
+   | * * * *|
+   |* * * * |
+   | * * * *|
+   |* * * * |
+   | * * * *|
+   |* * * * |
+   | * * * *|
+   +--------+ */
+0xaa00,
+0x5500,
+0xaa00,
+0x5500,
+0xaa00,
+0x5500,
+0xaa00,
+0x5500,
+0xaa00,
+0x5500,
+0xaa00,
+0x5500,
+0xaa00,
+0x5500,
+0xaa00,
+0x5500,
+
+/* Character � (0xb2):
+   ht=16, width=8
+   +--------+
+   |** *** *|
+   | *** ***|
+   |** *** *|
+   | *** ***|
+   |** *** *|
+   | *** ***|
+   |** *** *|
+   | *** ***|
+   |** *** *|
+   | *** ***|
+   |** *** *|
+   | *** ***|
+   |** *** *|
+   | *** ***|
+   |** *** *|
+   | *** ***|
+   +--------+ */
+0xdd00,
+0x7700,
+0xdd00,
+0x7700,
+0xdd00,
+0x7700,
+0xdd00,
+0x7700,
+0xdd00,
+0x7700,
+0xdd00,
+0x7700,
+0xdd00,
+0x7700,
+0xdd00,
+0x7700,
+
+/* Character � (0xb3):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xb4):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |*****   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xf800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xb5):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |*****   |
+   |   **   |
+   |*****   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xf800,
+0x1800,
+0xf800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xb6):
+   ht=16, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |**** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0xf600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xb7):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |******* |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xfe00,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xb8):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |*****   |
+   |   **   |
+   |*****   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xf800,
+0x1800,
+0xf800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xb9):
+   ht=16, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |**** ** |
+   |     ** |
+   |**** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0xf600,
+0x0600,
+0xf600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xba):
+   ht=16, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xbb):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |******* |
+   |     ** |
+   |**** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xfe00,
+0x0600,
+0xf600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xbc):
+   ht=16, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |**** ** |
+   |     ** |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0xf600,
+0x0600,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xbd):
+   ht=16, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xbe):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |*****   |
+   |   **   |
+   |*****   |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xf800,
+0x1800,
+0xf800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xbf):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |*****   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xf800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xc0):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   *****|
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1f00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc1):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |********|
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xff00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc2):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |********|
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xff00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xc3):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   *****|
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1f00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xc4):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |********|
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xff00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc5):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |********|
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xff00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xc6):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   *****|
+   |   **   |
+   |   *****|
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1f00,
+0x1800,
+0x1f00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xc7):
+   ht=16, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ***|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3700,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xc8):
+   ht=16, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ***|
+   |  **    |
+   |  ******|
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3700,
+0x3000,
+0x3f00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc9):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |  ******|
+   |  **    |
+   |  ** ***|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3f00,
+0x3000,
+0x3700,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xca):
+   ht=16, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |**** ***|
+   |        |
+   |********|
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0xf700,
+0x0000,
+0xff00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xcb):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |********|
+   |        |
+   |**** ***|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xff00,
+0x0000,
+0xf700,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xcc):
+   ht=16, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ***|
+   |  **    |
+   |  ** ***|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3700,
+0x3000,
+0x3700,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xcd):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |********|
+   |        |
+   |********|
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xff00,
+0x0000,
+0xff00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xce):
+   ht=16, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |**** ***|
+   |        |
+   |**** ***|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0xf700,
+0x0000,
+0xf700,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xcf):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |********|
+   |        |
+   |********|
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xff00,
+0x0000,
+0xff00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd0):
+   ht=16, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |********|
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0xff00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd1):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |********|
+   |        |
+   |********|
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xff00,
+0x0000,
+0xff00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xd2):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |********|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xff00,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xd3):
+   ht=16, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ******|
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3f00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd4):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   *****|
+   |   **   |
+   |   *****|
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1f00,
+0x1800,
+0x1f00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd5):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |   *****|
+   |   **   |
+   |   *****|
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1f00,
+0x1800,
+0x1f00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xd6):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |  ******|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3f00,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xd7):
+   ht=16, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |********|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0xff00,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xd8):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |********|
+   |   **   |
+   |********|
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xff00,
+0x1800,
+0xff00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xd9):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |*****   |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xf800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xda):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |   *****|
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1f00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xdb):
+   ht=16, width=8
+   +--------+
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   +--------+ */
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+
+/* Character � (0xdc):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+
+/* Character � (0xdd):
+   ht=16, width=8
+   +--------+
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   +--------+ */
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+
+/* Character � (0xde):
+   ht=16, width=8
+   +--------+
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   +--------+ */
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+
+/* Character � (0xdf):
+   ht=16, width=8
+   +--------+
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe0):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   | *** ** |
+   |** ***  |
+   |** **   |
+   |** **   |
+   |** **   |
+   |** **   |
+   |** ***  |
+   | *** ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7600,
+0xdc00,
+0xd800,
+0xd800,
+0xd800,
+0xd800,
+0xdc00,
+0x7600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe1):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | ****   |
+   |**  **  |
+   |**  **  |
+   |** **   |
+   |******  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**  **  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7800,
+0xcc00,
+0xcc00,
+0xd800,
+0xfc00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xcc00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe2):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |******* |
+   | **  ** |
+   | **   * |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xfe00,
+0x6600,
+0x6200,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe3):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |******* |
+   | ** **  |
+   | ** **  |
+   | ** **  |
+   | ** **  |
+   | ** **  |
+   | ** **  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xfe00,
+0x6c00,
+0x6c00,
+0x6c00,
+0x6c00,
+0x6c00,
+0x6c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe4):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |******* |
+   |**   ** |
+   | **   * |
+   |  **    |
+   |   **   |
+   |   **   |
+   |  **    |
+   | **   * |
+   |**   ** |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xfe00,
+0xc600,
+0x6200,
+0x3000,
+0x1800,
+0x1800,
+0x3000,
+0x6200,
+0xc600,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe5):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | ****** |
+   |** **   |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   |** **   |
+   | ***    |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7e00,
+0xd800,
+0xcc00,
+0xcc00,
+0xcc00,
+0xd800,
+0x7000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe6):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | *****  |
+   | **     |
+   |**      |
+   |*       |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x7c00,
+0x6000,
+0xc000,
+0x8000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe7):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | *** ** |
+   |** ***  |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7600,
+0xdc00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe8):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |******* |
+   |  ***   |
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |**   ** |
+   | ** **  |
+   |  ***   |
+   |  ***   |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xfe00,
+0x3800,
+0x3800,
+0x6c00,
+0xc600,
+0xc600,
+0x6c00,
+0x3800,
+0x3800,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe9):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |**   ** |
+   |******* |
+   |**   ** |
+   |**   ** |
+   | ** **  |
+   |  ***   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x3800,
+0x6c00,
+0xc600,
+0xc600,
+0xfe00,
+0xc600,
+0xc600,
+0x6c00,
+0x3800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xea):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | ** **  |
+   | ** **  |
+   | ** **  |
+   |*** *** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3800,
+0x6c00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x6c00,
+0x6c00,
+0x6c00,
+0xee00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xeb):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ***** |
+   | **     |
+   | **     |
+   |  ****  |
+   | **  ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**  **  |
+   | ****   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3e00,
+0x6000,
+0x6000,
+0x3c00,
+0x6600,
+0xc600,
+0xc600,
+0xc600,
+0xcc00,
+0x7800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xec):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | ****** |
+   |** ** **|
+   |** ** **|
+   |** ** **|
+   | ****** |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7e00,
+0xdb00,
+0xdb00,
+0xdb00,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xed):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |      * |
+   |     ** |
+   | *****  |
+   |**  *** |
+   |** **** |
+   |**** ** |
+   |**** ** |
+   | *****  |
+   | **     |
+   |**      |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0200,
+0x0600,
+0x7c00,
+0xce00,
+0xde00,
+0xf600,
+0xf600,
+0x7c00,
+0x6000,
+0xc000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xee):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |   ***  |
+   |  **    |
+   | **     |
+   | **     |
+   | *****  |
+   | **     |
+   | **     |
+   |  **    |
+   |   ***  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x1c00,
+0x3000,
+0x6000,
+0x6000,
+0x7c00,
+0x6000,
+0x6000,
+0x3000,
+0x1c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xef):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf0):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |******* |
+   |        |
+   |        |
+   |******* |
+   |        |
+   |        |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xfe00,
+0x0000,
+0x0000,
+0xfe00,
+0x0000,
+0x0000,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf1):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   | ****** |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   | ****** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x7e00,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf2):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  **    |
+   |   **   |
+   |    **  |
+   |     ** |
+   |    **  |
+   |   **   |
+   |  **    |
+   |        |
+   |        |
+   | ****** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3000,
+0x1800,
+0x0c00,
+0x0600,
+0x0c00,
+0x1800,
+0x3000,
+0x0000,
+0x0000,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf3):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **     |
+   |  **    |
+   |   **   |
+   |    **  |
+   |        |
+   |        |
+   | ****** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0c00,
+0x1800,
+0x3000,
+0x6000,
+0x3000,
+0x1800,
+0x0c00,
+0x0000,
+0x0000,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf4):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |    **  |
+   |   **** |
+   |   ** * |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0c00,
+0x1e00,
+0x1a00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xf5):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   | * **   |
+   | ****   |
+   |  **    |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x5800,
+0x7800,
+0x3000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf6):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   |        |
+   | ****** |
+   |        |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x0000,
+0x7e00,
+0x0000,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf7):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | *** ** |
+   |** ***  |
+   |        |
+   | *** ** |
+   |** ***  |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7600,
+0xdc00,
+0x0000,
+0x7600,
+0xdc00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf8):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | ****   |
+   |**  **  |
+   |**  **  |
+   | ****   |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7800,
+0xcc00,
+0xcc00,
+0x7800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf9):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xfa):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xfb):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   *****|
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |** **   |
+   |** **   |
+   | ****   |
+   |  ***   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1f00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xd800,
+0xd800,
+0x7800,
+0x3800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xfc):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |** **   |
+   | ** **  |
+   | ** **  |
+   | ** **  |
+   | ** **  |
+   | ** **  |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xd800,
+0x6c00,
+0x6c00,
+0x6c00,
+0x6c00,
+0x6c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xfd):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | ***    |
+   |** **   |
+   |   **   |
+   |  **    |
+   | **     |
+   |*****   |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7000,
+0xd800,
+0x1800,
+0x3000,
+0x6000,
+0xf800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xfe):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | ****** |
+   | ****** |
+   | ****** |
+   | ****** |
+   | ****** |
+   | ****** |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7e00,
+0x7e00,
+0x7e00,
+0x7e00,
+0x7e00,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xff):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+};
+
+/* Exported structure definition. */
+MWCFONT font_rom8x16 = {
+	"rom8x16",
+	8,
+	16,
+	12,
+	0,
+	256,
+	rom8x16_bits,
+	0,
+	0
+};
diff -urN lib/microwindows/src/fonts/rom8x8.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/rom8x8.c
--- lib/microwindows/src/fonts/rom8x8.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/rom8x8.c	2005-02-21 16:03:27.000000000 +0100
@@ -0,0 +1,5398 @@
+/* Generated by convrom.exe*/
+#include "device.h"
+
+/* ROM 8x8 Font bios mode 10 */
+
+static MWIMAGEBITS rom8x8_bits[] = {
+
+/* Character   (0x00):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x01):
+   ht=8, width=8
+   +--------+
+   | ****** |
+   |*      *|
+   |* *  * *|
+   |*      *|
+   |* **** *|
+   |*  **  *|
+   |*      *|
+   | ****** |
+   +--------+ */
+0x7e00,
+0x8100,
+0xa500,
+0x8100,
+0xbd00,
+0x9900,
+0x8100,
+0x7e00,
+
+/* Character  (0x02):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |******* |
+   |** * ** |
+   |* *** * |
+   |**   ** |
+   |******* |
+   | *****  |
+   |        |
+   +--------+ */
+0x7c00,
+0xfe00,
+0xd600,
+0xba00,
+0xc600,
+0xfe00,
+0x7c00,
+0x0000,
+
+/* Character  (0x03):
+   ht=8, width=8
+   +--------+
+   |**   ** |
+   |*** *** |
+   |******* |
+   |******* |
+   | *****  |
+   |  ***   |
+   |   *    |
+   |        |
+   +--------+ */
+0xc600,
+0xee00,
+0xfe00,
+0xfe00,
+0x7c00,
+0x3800,
+0x1000,
+0x0000,
+
+/* Character  (0x04):
+   ht=8, width=8
+   +--------+
+   |   *    |
+   |  ***   |
+   | *****  |
+   |******* |
+   | *****  |
+   |  ***   |
+   |   *    |
+   |        |
+   +--------+ */
+0x1000,
+0x3800,
+0x7c00,
+0xfe00,
+0x7c00,
+0x3800,
+0x1000,
+0x0000,
+
+/* Character  (0x05):
+   ht=8, width=8
+   +--------+
+   |   *    |
+   |  ***   |
+   |   *    |
+   |*** *** |
+   |*** *** |
+   |   *    |
+   |  ***   |
+   |        |
+   +--------+ */
+0x1000,
+0x3800,
+0x1000,
+0xee00,
+0xee00,
+0x1000,
+0x3800,
+0x0000,
+
+/* Character  (0x06):
+   ht=8, width=8
+   +--------+
+   |  ***   |
+   | *****  |
+   |******* |
+   |******* |
+   | ** **  |
+   |   *    |
+   |  ***   |
+   |        |
+   +--------+ */
+0x3800,
+0x7c00,
+0xfe00,
+0xfe00,
+0x6c00,
+0x1000,
+0x3800,
+0x0000,
+
+/* Character  (0x07):
+   ht=8, width=8
+   +--------+
+   |        |
+   |   **   |
+   |  ****  |
+   | ****** |
+   |  ****  |
+   |   **   |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x1800,
+0x3c00,
+0x7e00,
+0x3c00,
+0x1800,
+0x0000,
+0x0000,
+
+/* Character  (0x08):
+   ht=8, width=8
+   +--------+
+   |********|
+   |***  ***|
+   |**    **|
+   |*      *|
+   |**    **|
+   |***  ***|
+   |********|
+   |********|
+   +--------+ */
+0xff00,
+0xe700,
+0xc300,
+0x8100,
+0xc300,
+0xe700,
+0xff00,
+0xff00,
+
+/* Character 	 (0x09):
+   ht=8, width=8
+   +--------+
+   |        |
+   |   **   |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |   **   |
+   |        |
+   +--------+ */
+0x0000,
+0x1800,
+0x3c00,
+0x6600,
+0x6600,
+0x3c00,
+0x1800,
+0x0000,
+
+/* Character 
+ (0x0a):
+   ht=8, width=8
+   +--------+
+   |********|
+   |***  ***|
+   |**    **|
+   |*  **  *|
+   |*  **  *|
+   |**    **|
+   |***  ***|
+   |********|
+   +--------+ */
+0xff00,
+0xe700,
+0xc300,
+0x9900,
+0x9900,
+0xc300,
+0xe700,
+0xff00,
+
+/* Character  (0x0b):
+   ht=8, width=8
+   +--------+
+   |   **** |
+   |    *** |
+   |   **** |
+   |  ** ** |
+   | ****   |
+   |**  **  |
+   |**  **  |
+   | ****   |
+   +--------+ */
+0x1e00,
+0x0e00,
+0x1e00,
+0x3600,
+0x7800,
+0xcc00,
+0xcc00,
+0x7800,
+
+/* Character  (0x0c):
+   ht=8, width=8
+   +--------+
+   | ****** |
+   |**    **|
+   |**    **|
+   | ****** |
+   |   **   |
+   | ****** |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x7e00,
+0xc300,
+0xc300,
+0x7e00,
+0x1800,
+0x7e00,
+0x1800,
+0x1800,
+
+/* Character  (0x0d):
+   ht=8, width=8
+   +--------+
+   |   **** |
+   |   ** * |
+   |   **** |
+   |   **   |
+   |   **   |
+   | ***    |
+   |****    |
+   | **     |
+   +--------+ */
+0x1e00,
+0x1a00,
+0x1e00,
+0x1800,
+0x1800,
+0x7000,
+0xf000,
+0x6000,
+
+/* Character  (0x0e):
+   ht=8, width=8
+   +--------+
+   |  ***** |
+   |  ***** |
+   |  ** ** |
+   |  ** ** |
+   |**** ** |
+   | **  ** |
+   |   **** |
+   |    **  |
+   +--------+ */
+0x3e00,
+0x3e00,
+0x3600,
+0x3600,
+0xf600,
+0x6600,
+0x1e00,
+0x0c00,
+
+/* Character  (0x0f):
+   ht=8, width=8
+   +--------+
+   |** ** **|
+   |  ****  |
+   | **  ** |
+   |***  ***|
+   | **  ** |
+   |  ****  |
+   |** ** **|
+   |        |
+   +--------+ */
+0xdb00,
+0x3c00,
+0x6600,
+0xe700,
+0x6600,
+0x3c00,
+0xdb00,
+0x0000,
+
+/* Character  (0x10):
+   ht=8, width=8
+   +--------+
+   |*       |
+   |**      |
+   |****    |
+   |*****   |
+   |****    |
+   |**      |
+   |*       |
+   |        |
+   +--------+ */
+0x8000,
+0xc000,
+0xf000,
+0xf800,
+0xf000,
+0xc000,
+0x8000,
+0x0000,
+
+/* Character  (0x11):
+   ht=8, width=8
+   +--------+
+   |      * |
+   |     ** |
+   |   **** |
+   |  ***** |
+   |   **** |
+   |     ** |
+   |      * |
+   |        |
+   +--------+ */
+0x0200,
+0x0600,
+0x1e00,
+0x3e00,
+0x1e00,
+0x0600,
+0x0200,
+0x0000,
+
+/* Character  (0x12):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |  ****  |
+   | ****** |
+   |   **   |
+   | ****** |
+   |  ****  |
+   |   **   |
+   |        |
+   +--------+ */
+0x1800,
+0x3c00,
+0x7e00,
+0x1800,
+0x7e00,
+0x3c00,
+0x1800,
+0x0000,
+
+/* Character  (0x13):
+   ht=8, width=8
+   +--------+
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |        |
+   | **  ** |
+   |        |
+   +--------+ */
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x0000,
+0x6600,
+0x0000,
+
+/* Character  (0x14):
+   ht=8, width=8
+   +--------+
+   | *******|
+   |** ** **|
+   | **** **|
+   |  *** **|
+   |   ** **|
+   |   ** **|
+   |   ** **|
+   |        |
+   +--------+ */
+0x7f00,
+0xdb00,
+0x7b00,
+0x3b00,
+0x1b00,
+0x1b00,
+0x1b00,
+0x0000,
+
+/* Character  (0x15):
+   ht=8, width=8
+   +--------+
+   |  ****  |
+   | **  ** |
+   |  ***   |
+   | ** **  |
+   | ** **  |
+   |  ***   |
+   |**  **  |
+   | ****   |
+   +--------+ */
+0x3c00,
+0x6600,
+0x3800,
+0x6c00,
+0x6c00,
+0x3800,
+0xcc00,
+0x7800,
+
+/* Character  (0x16):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |******* |
+   |******* |
+   |******* |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xfe00,
+0xfe00,
+0xfe00,
+0x0000,
+
+/* Character  (0x17):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |  ****  |
+   | ****** |
+   |   **   |
+   | ****** |
+   |  ****  |
+   |   **   |
+   | ****** |
+   +--------+ */
+0x1800,
+0x3c00,
+0x7e00,
+0x1800,
+0x7e00,
+0x3c00,
+0x1800,
+0x7e00,
+
+/* Character  (0x18):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |  ****  |
+   | ****** |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |        |
+   +--------+ */
+0x1800,
+0x3c00,
+0x7e00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x0000,
+
+/* Character  (0x19):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   | ****** |
+   |  ****  |
+   |   **   |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x7e00,
+0x3c00,
+0x1800,
+0x0000,
+
+/* Character -> (0x1a):
+   ht=8, width=8
+   +--------+
+   |        |
+   |   **   |
+   |   ***  |
+   |******* |
+   |   ***  |
+   |   **   |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x1800,
+0x1c00,
+0xfe00,
+0x1c00,
+0x1800,
+0x0000,
+0x0000,
+
+/* Character  (0x1b):
+   ht=8, width=8
+   +--------+
+   |        |
+   |  **    |
+   | ***    |
+   |******* |
+   | ***    |
+   |  **    |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x3000,
+0x7000,
+0xfe00,
+0x7000,
+0x3000,
+0x0000,
+0x0000,
+
+/* Character  (0x1c):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |**      |
+   |**      |
+   |**      |
+   |******* |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc000,
+0xc000,
+0xc000,
+0xfe00,
+0x0000,
+0x0000,
+
+/* Character  (0x1d):
+   ht=8, width=8
+   +--------+
+   |        |
+   |  *  *  |
+   | **  ** |
+   |********|
+   | **  ** |
+   |  *  *  |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x2400,
+0x6600,
+0xff00,
+0x6600,
+0x2400,
+0x0000,
+0x0000,
+
+/* Character  (0x1e):
+   ht=8, width=8
+   +--------+
+   |        |
+   |   *    |
+   |  ***   |
+   | *****  |
+   | *****  |
+   |******* |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x1000,
+0x3800,
+0x7c00,
+0x7c00,
+0xfe00,
+0x0000,
+0x0000,
+
+/* Character  (0x1f):
+   ht=8, width=8
+   +--------+
+   |        |
+   |******* |
+   | *****  |
+   | *****  |
+   |  ***   |
+   |   *    |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0xfe00,
+0x7c00,
+0x7c00,
+0x3800,
+0x1000,
+0x0000,
+0x0000,
+
+/* Character   (0x20):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ! (0x21):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |  ****  |
+   |  ****  |
+   |   **   |
+   |   **   |
+   |        |
+   |   **   |
+   |        |
+   +--------+ */
+0x1800,
+0x3c00,
+0x3c00,
+0x1800,
+0x1800,
+0x0000,
+0x1800,
+0x0000,
+
+/* Character " (0x22):
+   ht=8, width=8
+   +--------+
+   | ** **  |
+   | ** **  |
+   | ** **  |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x6c00,
+0x6c00,
+0x6c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character # (0x23):
+   ht=8, width=8
+   +--------+
+   | ** **  |
+   | ** **  |
+   |******* |
+   | ** **  |
+   |******* |
+   | ** **  |
+   | ** **  |
+   |        |
+   +--------+ */
+0x6c00,
+0x6c00,
+0xfe00,
+0x6c00,
+0xfe00,
+0x6c00,
+0x6c00,
+0x0000,
+
+/* Character $ (0x24):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   | ****** |
+   |**      |
+   | *****  |
+   |     ** |
+   |******  |
+   |   **   |
+   |        |
+   +--------+ */
+0x1800,
+0x7e00,
+0xc000,
+0x7c00,
+0x0600,
+0xfc00,
+0x1800,
+0x0000,
+
+/* Character % (0x25):
+   ht=8, width=8
+   +--------+
+   |        |
+   |**   ** |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **     |
+   |**   ** |
+   |        |
+   +--------+ */
+0x0000,
+0xc600,
+0x0c00,
+0x1800,
+0x3000,
+0x6000,
+0xc600,
+0x0000,
+
+/* Character & (0x26):
+   ht=8, width=8
+   +--------+
+   |  ***   |
+   | ** **  |
+   |  ***   |
+   | *** ** |
+   |**  **  |
+   |**  **  |
+   | *** ** |
+   |        |
+   +--------+ */
+0x3800,
+0x6c00,
+0x3800,
+0x7600,
+0xcc00,
+0xcc00,
+0x7600,
+0x0000,
+
+/* Character ' (0x27):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |  **    |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x3000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ( (0x28):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |  **    |
+   | **     |
+   | **     |
+   | **     |
+   |  **    |
+   |   **   |
+   |        |
+   +--------+ */
+0x1800,
+0x3000,
+0x6000,
+0x6000,
+0x6000,
+0x3000,
+0x1800,
+0x0000,
+
+/* Character ) (0x29):
+   ht=8, width=8
+   +--------+
+   | **     |
+   |  **    |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  **    |
+   | **     |
+   |        |
+   +--------+ */
+0x6000,
+0x3000,
+0x1800,
+0x1800,
+0x1800,
+0x3000,
+0x6000,
+0x0000,
+
+/* Character * (0x2a):
+   ht=8, width=8
+   +--------+
+   |        |
+   |*** *** |
+   | *****  |
+   |******* |
+   | *****  |
+   |*** *** |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0xee00,
+0x7c00,
+0xfe00,
+0x7c00,
+0xee00,
+0x0000,
+0x0000,
+
+/* Character + (0x2b):
+   ht=8, width=8
+   +--------+
+   |        |
+   |   **   |
+   |   **   |
+   | ****** |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x1800,
+0x1800,
+0x7e00,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+
+/* Character , (0x2c):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   |  **    |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x3000,
+0x0000,
+
+/* Character - (0x2d):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |******* |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character . (0x2e):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |  ***   |
+   |  ***   |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3800,
+0x3800,
+0x0000,
+
+/* Character / (0x2f):
+   ht=8, width=8
+   +--------+
+   |     ** |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **     |
+   |**      |
+   |*       |
+   |        |
+   +--------+ */
+0x0600,
+0x0c00,
+0x1800,
+0x3000,
+0x6000,
+0xc000,
+0x8000,
+0x0000,
+
+/* Character 0 (0x30):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |**  *** |
+   |** **** |
+   |**** ** |
+   |***  ** |
+   | *****  |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0xce00,
+0xde00,
+0xf600,
+0xe600,
+0x7c00,
+0x0000,
+
+/* Character 1 (0x31):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   | ****   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   | ****** |
+   |        |
+   +--------+ */
+0x1800,
+0x7800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x7e00,
+0x0000,
+
+/* Character 2 (0x32):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **  ** |
+   |******* |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0x0c00,
+0x1800,
+0x3000,
+0x6600,
+0xfe00,
+0x0000,
+
+/* Character 3 (0x33):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |     ** |
+   |  ****  |
+   |     ** |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0x0600,
+0x3c00,
+0x0600,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character 4 (0x34):
+   ht=8, width=8
+   +--------+
+   |    **  |
+   |   ***  |
+   |  ****  |
+   | ** **  |
+   |******* |
+   |    **  |
+   |    **  |
+   |        |
+   +--------+ */
+0x0c00,
+0x1c00,
+0x3c00,
+0x6c00,
+0xfe00,
+0x0c00,
+0x0c00,
+0x0000,
+
+/* Character 5 (0x35):
+   ht=8, width=8
+   +--------+
+   |******* |
+   |**      |
+   |******  |
+   |     ** |
+   |     ** |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0xfe00,
+0xc000,
+0xfc00,
+0x0600,
+0x0600,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character 6 (0x36):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |**      |
+   |******  |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0xc000,
+0xfc00,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character 7 (0x37):
+   ht=8, width=8
+   +--------+
+   |******* |
+   |**   ** |
+   |     ** |
+   |    **  |
+   |   **   |
+   |   **   |
+   |   **   |
+   |        |
+   +--------+ */
+0xfe00,
+0xc600,
+0x0600,
+0x0c00,
+0x1800,
+0x1800,
+0x1800,
+0x0000,
+
+/* Character 8 (0x38):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0xc600,
+0x7c00,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character 9 (0x39):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |**   ** |
+   | ****** |
+   |     ** |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0xc600,
+0x7e00,
+0x0600,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character : (0x3a):
+   ht=8, width=8
+   +--------+
+   |        |
+   |   ***  |
+   |   ***  |
+   |        |
+   |        |
+   |   ***  |
+   |   ***  |
+   |        |
+   +--------+ */
+0x0000,
+0x1c00,
+0x1c00,
+0x0000,
+0x0000,
+0x1c00,
+0x1c00,
+0x0000,
+
+/* Character ; (0x3b):
+   ht=8, width=8
+   +--------+
+   |        |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   |  **    |
+   +--------+ */
+0x0000,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x3000,
+
+/* Character < (0x3c):
+   ht=8, width=8
+   +--------+
+   |    **  |
+   |   **   |
+   |  **    |
+   | **     |
+   |  **    |
+   |   **   |
+   |    **  |
+   |        |
+   +--------+ */
+0x0c00,
+0x1800,
+0x3000,
+0x6000,
+0x3000,
+0x1800,
+0x0c00,
+0x0000,
+
+/* Character = (0x3d):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |******* |
+   |        |
+   |        |
+   |******* |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xfe00,
+0x0000,
+0x0000,
+0xfe00,
+0x0000,
+0x0000,
+
+/* Character > (0x3e):
+   ht=8, width=8
+   +--------+
+   | **     |
+   |  **    |
+   |   **   |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **     |
+   |        |
+   +--------+ */
+0x6000,
+0x3000,
+0x1800,
+0x0c00,
+0x1800,
+0x3000,
+0x6000,
+0x0000,
+
+/* Character ? (0x3f):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |     ** |
+   |    **  |
+   |   **   |
+   |        |
+   |   **   |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0x0600,
+0x0c00,
+0x1800,
+0x0000,
+0x1800,
+0x0000,
+
+/* Character @ (0x40):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |** **** |
+   |** ***  |
+   |**      |
+   | ****** |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0xc600,
+0xde00,
+0xdc00,
+0xc000,
+0x7e00,
+0x0000,
+
+/* Character A (0x41):
+   ht=8, width=8
+   +--------+
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |**   ** |
+   |******* |
+   |**   ** |
+   |**   ** |
+   |        |
+   +--------+ */
+0x3800,
+0x6c00,
+0xc600,
+0xc600,
+0xfe00,
+0xc600,
+0xc600,
+0x0000,
+
+/* Character B (0x42):
+   ht=8, width=8
+   +--------+
+   |******  |
+   | **  ** |
+   | **  ** |
+   | *****  |
+   | **  ** |
+   | **  ** |
+   |******  |
+   |        |
+   +--------+ */
+0xfc00,
+0x6600,
+0x6600,
+0x7c00,
+0x6600,
+0x6600,
+0xfc00,
+0x0000,
+
+/* Character C (0x43):
+   ht=8, width=8
+   +--------+
+   |  ****  |
+   | **  ** |
+   |**      |
+   |**      |
+   |**      |
+   | **  ** |
+   |  ****  |
+   |        |
+   +--------+ */
+0x3c00,
+0x6600,
+0xc000,
+0xc000,
+0xc000,
+0x6600,
+0x3c00,
+0x0000,
+
+/* Character D (0x44):
+   ht=8, width=8
+   +--------+
+   |*****   |
+   | ** **  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | ** **  |
+   |*****   |
+   |        |
+   +--------+ */
+0xf800,
+0x6c00,
+0x6600,
+0x6600,
+0x6600,
+0x6c00,
+0xf800,
+0x0000,
+
+/* Character E (0x45):
+   ht=8, width=8
+   +--------+
+   |******* |
+   |**    * |
+   |**      |
+   |*****   |
+   |**      |
+   |**    * |
+   |******* |
+   |        |
+   +--------+ */
+0xfe00,
+0xc200,
+0xc000,
+0xf800,
+0xc000,
+0xc200,
+0xfe00,
+0x0000,
+
+/* Character F (0x46):
+   ht=8, width=8
+   +--------+
+   |******* |
+   | **   * |
+   | **     |
+   | *****  |
+   | **     |
+   | **     |
+   |****    |
+   |        |
+   +--------+ */
+0xfe00,
+0x6200,
+0x6000,
+0x7c00,
+0x6000,
+0x6000,
+0xf000,
+0x0000,
+
+/* Character G (0x47):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |**      |
+   |**      |
+   |** **** |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0xc000,
+0xc000,
+0xde00,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character H (0x48):
+   ht=8, width=8
+   +--------+
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |******* |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |        |
+   +--------+ */
+0xc600,
+0xc600,
+0xc600,
+0xfe00,
+0xc600,
+0xc600,
+0xc600,
+0x0000,
+
+/* Character I (0x49):
+   ht=8, width=8
+   +--------+
+   |  ****  |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   +--------+ */
+0x3c00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+
+/* Character J (0x4a):
+   ht=8, width=8
+   +--------+
+   |  ****  |
+   |   **   |
+   |   **   |
+   |   **   |
+   |** **   |
+   |** **   |
+   | ***    |
+   |        |
+   +--------+ */
+0x3c00,
+0x1800,
+0x1800,
+0x1800,
+0xd800,
+0xd800,
+0x7000,
+0x0000,
+
+/* Character K (0x4b):
+   ht=8, width=8
+   +--------+
+   |**   ** |
+   |**  **  |
+   |** **   |
+   |****    |
+   |** **   |
+   |**  **  |
+   |**   ** |
+   |        |
+   +--------+ */
+0xc600,
+0xcc00,
+0xd800,
+0xf000,
+0xd800,
+0xcc00,
+0xc600,
+0x0000,
+
+/* Character L (0x4c):
+   ht=8, width=8
+   +--------+
+   |****    |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **   * |
+   |******* |
+   |        |
+   +--------+ */
+0xf000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6200,
+0xfe00,
+0x0000,
+
+/* Character M (0x4d):
+   ht=8, width=8
+   +--------+
+   |**   ** |
+   |*** *** |
+   |******* |
+   |** * ** |
+   |** * ** |
+   |**   ** |
+   |**   ** |
+   |        |
+   +--------+ */
+0xc600,
+0xee00,
+0xfe00,
+0xd600,
+0xd600,
+0xc600,
+0xc600,
+0x0000,
+
+/* Character N (0x4e):
+   ht=8, width=8
+   +--------+
+   |**   ** |
+   |***  ** |
+   |***  ** |
+   |**** ** |
+   |** **** |
+   |**  *** |
+   |**   ** |
+   |        |
+   +--------+ */
+0xc600,
+0xe600,
+0xe600,
+0xf600,
+0xde00,
+0xce00,
+0xc600,
+0x0000,
+
+/* Character O (0x4f):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character P (0x50):
+   ht=8, width=8
+   +--------+
+   |******  |
+   | **  ** |
+   | **  ** |
+   | *****  |
+   | **     |
+   | **     |
+   |****    |
+   |        |
+   +--------+ */
+0xfc00,
+0x6600,
+0x6600,
+0x7c00,
+0x6000,
+0x6000,
+0xf000,
+0x0000,
+
+/* Character Q (0x51):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |** * ** |
+   | *****  |
+   |     ** |
+   +--------+ */
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xd600,
+0x7c00,
+0x0600,
+
+/* Character R (0x52):
+   ht=8, width=8
+   +--------+
+   |******  |
+   |**   ** |
+   |**   ** |
+   |******  |
+   |** **   |
+   |**  **  |
+   |**   ** |
+   |        |
+   +--------+ */
+0xfc00,
+0xc600,
+0xc600,
+0xfc00,
+0xd800,
+0xcc00,
+0xc600,
+0x0000,
+
+/* Character S (0x53):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |**      |
+   | *****  |
+   |     ** |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0xc000,
+0x7c00,
+0x0600,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character T (0x54):
+   ht=8, width=8
+   +--------+
+   | ****** |
+   | * ** * |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   +--------+ */
+0x7e00,
+0x5a00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+
+/* Character U (0x55):
+   ht=8, width=8
+   +--------+
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character V (0x56):
+   ht=8, width=8
+   +--------+
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | ** **  |
+   |  ***   |
+   |   *    |
+   |        |
+   +--------+ */
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x6c00,
+0x3800,
+0x1000,
+0x0000,
+
+/* Character W (0x57):
+   ht=8, width=8
+   +--------+
+   |**   ** |
+   |**   ** |
+   |** * ** |
+   |** * ** |
+   |******* |
+   |*** *** |
+   |**   ** |
+   |        |
+   +--------+ */
+0xc600,
+0xc600,
+0xd600,
+0xd600,
+0xfe00,
+0xee00,
+0xc600,
+0x0000,
+
+/* Character X (0x58):
+   ht=8, width=8
+   +--------+
+   |**   ** |
+   | ** **  |
+   |  ***   |
+   |  ***   |
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |        |
+   +--------+ */
+0xc600,
+0x6c00,
+0x3800,
+0x3800,
+0x3800,
+0x6c00,
+0xc600,
+0x0000,
+
+/* Character Y (0x59):
+   ht=8, width=8
+   +--------+
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   +--------+ */
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+
+/* Character Z (0x5a):
+   ht=8, width=8
+   +--------+
+   |******* |
+   |*    ** |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **   * |
+   |******* |
+   |        |
+   +--------+ */
+0xfe00,
+0x8600,
+0x0c00,
+0x1800,
+0x3000,
+0x6200,
+0xfe00,
+0x0000,
+
+/* Character [ (0x5b):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | *****  |
+   |        |
+   +--------+ */
+0x7c00,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x7c00,
+0x0000,
+
+/* Character \ (0x5c):
+   ht=8, width=8
+   +--------+
+   |**      |
+   | **     |
+   |  **    |
+   |   **   |
+   |    **  |
+   |     ** |
+   |      * |
+   |        |
+   +--------+ */
+0xc000,
+0x6000,
+0x3000,
+0x1800,
+0x0c00,
+0x0600,
+0x0200,
+0x0000,
+
+/* Character ] (0x5d):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |    **  |
+   |    **  |
+   |    **  |
+   |    **  |
+   |    **  |
+   | *****  |
+   |        |
+   +--------+ */
+0x7c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x7c00,
+0x0000,
+
+/* Character ^ (0x5e):
+   ht=8, width=8
+   +--------+
+   |   *    |
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1000,
+0x3800,
+0x6c00,
+0xc600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character _ (0x5f):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |********|
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xff00,
+
+/* Character ` (0x60):
+   ht=8, width=8
+   +--------+
+   |  **    |
+   |  **    |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3000,
+0x3000,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character a (0x61):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   | ****   |
+   |    **  |
+   | *****  |
+   |**  **  |
+   | ****** |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7800,
+0x0c00,
+0x7c00,
+0xcc00,
+0x7e00,
+0x0000,
+
+/* Character b (0x62):
+   ht=8, width=8
+   +--------+
+   |***     |
+   | **     |
+   | *****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |******  |
+   |        |
+   +--------+ */
+0xe000,
+0x6000,
+0x7c00,
+0x6600,
+0x6600,
+0x6600,
+0xfc00,
+0x0000,
+
+/* Character c (0x63):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**      |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc000,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character d (0x64):
+   ht=8, width=8
+   +--------+
+   |   ***  |
+   |    **  |
+   | *****  |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   | ****** |
+   |        |
+   +--------+ */
+0x1c00,
+0x0c00,
+0x7c00,
+0xcc00,
+0xcc00,
+0xcc00,
+0x7e00,
+0x0000,
+
+/* Character e (0x65):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |******* |
+   |**      |
+   | *****  |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xfe00,
+0xc000,
+0x7c00,
+0x0000,
+
+/* Character f (0x66):
+   ht=8, width=8
+   +--------+
+   |   ***  |
+   |  ** ** |
+   |  **    |
+   |******  |
+   |  **    |
+   |  **    |
+   | ****   |
+   |        |
+   +--------+ */
+0x1c00,
+0x3600,
+0x3000,
+0xfc00,
+0x3000,
+0x3000,
+0x7800,
+0x0000,
+
+/* Character g (0x67):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   | *** ** |
+   |**  *** |
+   |**   ** |
+   | ****** |
+   |     ** |
+   | *****  |
+   +--------+ */
+0x0000,
+0x0000,
+0x7600,
+0xce00,
+0xc600,
+0x7e00,
+0x0600,
+0x7c00,
+
+/* Character h (0x68):
+   ht=8, width=8
+   +--------+
+   |***     |
+   | **     |
+   | *****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |***  ** |
+   |        |
+   +--------+ */
+0xe000,
+0x6000,
+0x7c00,
+0x6600,
+0x6600,
+0x6600,
+0xe600,
+0x0000,
+
+/* Character i (0x69):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |        |
+   |  ***   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   +--------+ */
+0x1800,
+0x0000,
+0x3800,
+0x1800,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+
+/* Character j (0x6a):
+   ht=8, width=8
+   +--------+
+   |    **  |
+   |        |
+   |   ***  |
+   |    **  |
+   |    **  |
+   |    **  |
+   |**  **  |
+   | ****   |
+   +--------+ */
+0x0c00,
+0x0000,
+0x1c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0xcc00,
+0x7800,
+
+/* Character k (0x6b):
+   ht=8, width=8
+   +--------+
+   |***     |
+   | **     |
+   | **  ** |
+   | ** **  |
+   | ****   |
+   | ** **  |
+   |***  ** |
+   |        |
+   +--------+ */
+0xe000,
+0x6000,
+0x6600,
+0x6c00,
+0x7800,
+0x6c00,
+0xe600,
+0x0000,
+
+/* Character l (0x6c):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   ***  |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1c00,
+0x0000,
+
+/* Character m (0x6d):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   | ** **  |
+   |******* |
+   |** * ** |
+   |** * ** |
+   |**   ** |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x6c00,
+0xfe00,
+0xd600,
+0xd600,
+0xc600,
+0x0000,
+
+/* Character n (0x6e):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |** ***  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xdc00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x0000,
+
+/* Character o (0x6f):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character p (0x70):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |** ***  |
+   | **  ** |
+   | **  ** |
+   | *****  |
+   | **     |
+   |****    |
+   +--------+ */
+0x0000,
+0x0000,
+0xdc00,
+0x6600,
+0x6600,
+0x7c00,
+0x6000,
+0xf000,
+
+/* Character q (0x71):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   | *** ** |
+   |**  **  |
+   |**  **  |
+   | *****  |
+   |    **  |
+   |   **** |
+   +--------+ */
+0x0000,
+0x0000,
+0x7600,
+0xcc00,
+0xcc00,
+0x7c00,
+0x0c00,
+0x1e00,
+
+/* Character r (0x72):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |** ***  |
+   | **  ** |
+   | **     |
+   | **     |
+   |****    |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xdc00,
+0x6600,
+0x6000,
+0x6000,
+0xf000,
+0x0000,
+
+/* Character s (0x73):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**      |
+   | *****  |
+   |     ** |
+   | *****  |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc000,
+0x7c00,
+0x0600,
+0x7c00,
+0x0000,
+
+/* Character t (0x74):
+   ht=8, width=8
+   +--------+
+   |  **    |
+   |  **    |
+   |******  |
+   |  **    |
+   |  **    |
+   |  ** ** |
+   |   ***  |
+   |        |
+   +--------+ */
+0x3000,
+0x3000,
+0xfc00,
+0x3000,
+0x3000,
+0x3600,
+0x1c00,
+0x0000,
+
+/* Character u (0x75):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   |**  **  |
+   | *** ** |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xcc00,
+0xcc00,
+0xcc00,
+0xcc00,
+0x7600,
+0x0000,
+
+/* Character v (0x76):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   | ** **  |
+   |  ***   |
+   |   *    |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0x6c00,
+0x3800,
+0x1000,
+0x0000,
+
+/* Character w (0x77):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   |** * ** |
+   |******* |
+   | ** **  |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0xd600,
+0xfe00,
+0x6c00,
+0x0000,
+
+/* Character x (0x78):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |**   ** |
+   | ** **  |
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc600,
+0x6c00,
+0x3800,
+0x6c00,
+0xc600,
+0x0000,
+
+/* Character y (0x79):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**  *** |
+   | *** ** |
+   |     ** |
+   | *****  |
+   +--------+ */
+0x0000,
+0x0000,
+0xc600,
+0xc600,
+0xce00,
+0x7600,
+0x0600,
+0x7c00,
+
+/* Character z (0x7a):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |******  |
+   |*  **   |
+   |  **    |
+   | **  *  |
+   |******  |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xfc00,
+0x9800,
+0x3000,
+0x6400,
+0xfc00,
+0x0000,
+
+/* Character { (0x7b):
+   ht=8, width=8
+   +--------+
+   |    *** |
+   |   **   |
+   |   **   |
+   | ***    |
+   |   **   |
+   |   **   |
+   |    *** |
+   |        |
+   +--------+ */
+0x0e00,
+0x1800,
+0x1800,
+0x7000,
+0x1800,
+0x1800,
+0x0e00,
+0x0000,
+
+/* Character | (0x7c):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |        |
+   |   **   |
+   |   **   |
+   |   **   |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x0000,
+0x1800,
+0x1800,
+0x1800,
+0x0000,
+
+/* Character } (0x7d):
+   ht=8, width=8
+   +--------+
+   | ***    |
+   |   **   |
+   |   **   |
+   |    *** |
+   |   **   |
+   |   **   |
+   | ***    |
+   |        |
+   +--------+ */
+0x7000,
+0x1800,
+0x1800,
+0x0e00,
+0x1800,
+0x1800,
+0x7000,
+0x0000,
+
+/* Character ~ (0x7e):
+   ht=8, width=8
+   +--------+
+   | *** ** |
+   |** ***  |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x7600,
+0xdc00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x7f):
+   ht=8, width=8
+   +--------+
+   |        |
+   |   *    |
+   |  ***   |
+   |  ***   |
+   | ** **  |
+   | ** **  |
+   |******* |
+   |        |
+   +--------+ */
+0x0000,
+0x1000,
+0x3800,
+0x3800,
+0x6c00,
+0x6c00,
+0xfe00,
+0x0000,
+
+/* Character � (0x80):
+   ht=8, width=8
+   +--------+
+   |  ****  |
+   | **  ** |
+   |**      |
+   | **  ** |
+   |  ****  |
+   |   **   |
+   |**  **  |
+   | ****   |
+   +--------+ */
+0x3c00,
+0x6600,
+0xc000,
+0x6600,
+0x3c00,
+0x1800,
+0xcc00,
+0x7800,
+
+/* Character � (0x81):
+   ht=8, width=8
+   +--------+
+   |        |
+   |**   ** |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**  *** |
+   | *** ** |
+   |        |
+   +--------+ */
+0x0000,
+0xc600,
+0x0000,
+0xc600,
+0xc600,
+0xce00,
+0x7600,
+0x0000,
+
+/* Character � (0x82):
+   ht=8, width=8
+   +--------+
+   |    *** |
+   |        |
+   | *****  |
+   |**   ** |
+   |******* |
+   |**      |
+   | *****  |
+   |        |
+   +--------+ */
+0x0e00,
+0x0000,
+0x7c00,
+0xc600,
+0xfe00,
+0xc000,
+0x7c00,
+0x0000,
+
+/* Character � (0x83):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   | ****   |
+   |    **  |
+   | *****  |
+   |**  **  |
+   | ****** |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0x7800,
+0x0c00,
+0x7c00,
+0xcc00,
+0x7e00,
+0x0000,
+
+/* Character � (0x84):
+   ht=8, width=8
+   +--------+
+   |**   ** |
+   |        |
+   | ****   |
+   |    **  |
+   | *****  |
+   |**  **  |
+   | ****** |
+   |        |
+   +--------+ */
+0xc600,
+0x0000,
+0x7800,
+0x0c00,
+0x7c00,
+0xcc00,
+0x7e00,
+0x0000,
+
+/* Character � (0x85):
+   ht=8, width=8
+   +--------+
+   |***     |
+   |        |
+   | ****   |
+   |    **  |
+   | *****  |
+   |**  **  |
+   | ****** |
+   |        |
+   +--------+ */
+0xe000,
+0x0000,
+0x7800,
+0x0c00,
+0x7c00,
+0xcc00,
+0x7e00,
+0x0000,
+
+/* Character � (0x86):
+   ht=8, width=8
+   +--------+
+   |  ***   |
+   |  ***   |
+   | ****   |
+   |    **  |
+   | *****  |
+   |**  **  |
+   | ****** |
+   |        |
+   +--------+ */
+0x3800,
+0x3800,
+0x7800,
+0x0c00,
+0x7c00,
+0xcc00,
+0x7e00,
+0x0000,
+
+/* Character � (0x87):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   |**      |
+   | *****  |
+   |   **   |
+   | ** **  |
+   |  ***   |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0xc000,
+0x7c00,
+0x1800,
+0x6c00,
+0x3800,
+
+/* Character � (0x88):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   | *****  |
+   |**   ** |
+   |******* |
+   |**      |
+   | *****  |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0x7c00,
+0xc600,
+0xfe00,
+0xc000,
+0x7c00,
+0x0000,
+
+/* Character � (0x89):
+   ht=8, width=8
+   +--------+
+   |**   ** |
+   |        |
+   | *****  |
+   |**   ** |
+   |******* |
+   |**      |
+   | *****  |
+   |        |
+   +--------+ */
+0xc600,
+0x0000,
+0x7c00,
+0xc600,
+0xfe00,
+0xc000,
+0x7c00,
+0x0000,
+
+/* Character � (0x8a):
+   ht=8, width=8
+   +--------+
+   |***     |
+   |        |
+   | *****  |
+   |**   ** |
+   |******* |
+   |**      |
+   | *****  |
+   |        |
+   +--------+ */
+0xe000,
+0x0000,
+0x7c00,
+0xc600,
+0xfe00,
+0xc000,
+0x7c00,
+0x0000,
+
+/* Character � (0x8b):
+   ht=8, width=8
+   +--------+
+   | **  ** |
+   |        |
+   |  ***   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   +--------+ */
+0x6600,
+0x0000,
+0x3800,
+0x1800,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+
+/* Character � (0x8c):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |  ***   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0x3800,
+0x1800,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+
+/* Character � (0x8d):
+   ht=8, width=8
+   +--------+
+   |***     |
+   |        |
+   |  ***   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   +--------+ */
+0xe000,
+0x0000,
+0x3800,
+0x1800,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+
+/* Character � (0x8e):
+   ht=8, width=8
+   +--------+
+   |**   ** |
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |******* |
+   |**   ** |
+   |**   ** |
+   |        |
+   +--------+ */
+0xc600,
+0x3800,
+0x6c00,
+0xc600,
+0xfe00,
+0xc600,
+0xc600,
+0x0000,
+
+/* Character � (0x8f):
+   ht=8, width=8
+   +--------+
+   |  ***   |
+   |  ***   |
+   |        |
+   | *****  |
+   |**   ** |
+   |******* |
+   |**   ** |
+   |        |
+   +--------+ */
+0x3800,
+0x3800,
+0x0000,
+0x7c00,
+0xc600,
+0xfe00,
+0xc600,
+0x0000,
+
+/* Character � (0x90):
+   ht=8, width=8
+   +--------+
+   |    *** |
+   |        |
+   |******* |
+   |**      |
+   |*****   |
+   |**      |
+   |******* |
+   |        |
+   +--------+ */
+0x0e00,
+0x0000,
+0xfe00,
+0xc000,
+0xf800,
+0xc000,
+0xfe00,
+0x0000,
+
+/* Character � (0x91):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   | ** **  |
+   |*  ** * |
+   | ****** |
+   |** **   |
+   | ** *** |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x6c00,
+0x9a00,
+0x7e00,
+0xd800,
+0x6e00,
+0x0000,
+
+/* Character � (0x92):
+   ht=8, width=8
+   +--------+
+   | ****** |
+   |** **   |
+   |** **   |
+   |******* |
+   |** **   |
+   |** **   |
+   |** **** |
+   |        |
+   +--------+ */
+0x7e00,
+0xd800,
+0xd800,
+0xfe00,
+0xd800,
+0xd800,
+0xde00,
+0x0000,
+
+/* Character � (0x93):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character � (0x94):
+   ht=8, width=8
+   +--------+
+   |        |
+   |**   ** |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0x0000,
+0xc600,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character � (0x95):
+   ht=8, width=8
+   +--------+
+   |        |
+   |***     |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0x0000,
+0xe000,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character � (0x96):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**  *** |
+   | *** ** |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0x0000,
+0xc600,
+0xc600,
+0xce00,
+0x7600,
+0x0000,
+
+/* Character � (0x97):
+   ht=8, width=8
+   +--------+
+   |        |
+   |***     |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**  *** |
+   | *** ** |
+   |        |
+   +--------+ */
+0x0000,
+0xe000,
+0x0000,
+0xc600,
+0xc600,
+0xce00,
+0x7600,
+0x0000,
+
+/* Character � (0x98):
+   ht=8, width=8
+   +--------+
+   |        |
+   |**   ** |
+   |        |
+   |**   ** |
+   |**  *** |
+   | *** ** |
+   |     ** |
+   | *****  |
+   +--------+ */
+0x0000,
+0xc600,
+0x0000,
+0xc600,
+0xce00,
+0x7600,
+0x0600,
+0x7c00,
+
+/* Character � (0x99):
+   ht=8, width=8
+   +--------+
+   |**   ** |
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |**   ** |
+   | ** **  |
+   |  ***   |
+   |        |
+   +--------+ */
+0xc600,
+0x3800,
+0x6c00,
+0xc600,
+0xc600,
+0x6c00,
+0x3800,
+0x0000,
+
+/* Character � (0x9a):
+   ht=8, width=8
+   +--------+
+   |**   ** |
+   |        |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0xc600,
+0x0000,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character � (0x9b):
+   ht=8, width=8
+   +--------+
+   |        |
+   |   **   |
+   | ****** |
+   |** **   |
+   |** **   |
+   | ****** |
+   |   **   |
+   |        |
+   +--------+ */
+0x0000,
+0x1800,
+0x7e00,
+0xd800,
+0xd800,
+0x7e00,
+0x1800,
+0x0000,
+
+/* Character � (0x9c):
+   ht=8, width=8
+   +--------+
+   |  ***   |
+   | ** **  |
+   | **     |
+   |****    |
+   | **  ** |
+   |**** ** |
+   | ** **  |
+   |        |
+   +--------+ */
+0x3800,
+0x6c00,
+0x6000,
+0xf000,
+0x6600,
+0xf600,
+0x6c00,
+0x0000,
+
+/* Character � (0x9d):
+   ht=8, width=8
+   +--------+
+   |**    **|
+   | **  ** |
+   |  ****  |
+   | ****** |
+   |   **   |
+   |  ****  |
+   |   **   |
+   |        |
+   +--------+ */
+0xc300,
+0x6600,
+0x3c00,
+0x7e00,
+0x1800,
+0x3c00,
+0x1800,
+0x0000,
+
+/* Character � (0x9e):
+   ht=8, width=8
+   +--------+
+   |******  |
+   |**   ** |
+   |******  |
+   |**  **  |
+   |** **** |
+   |**  **  |
+   |**  *** |
+   |        |
+   +--------+ */
+0xfc00,
+0xc600,
+0xfc00,
+0xcc00,
+0xde00,
+0xcc00,
+0xce00,
+0x0000,
+
+/* Character � (0x9f):
+   ht=8, width=8
+   +--------+
+   |    **  |
+   |   **** |
+   |   **   |
+   | ****** |
+   |   **   |
+   |   **   |
+   |** **   |
+   | ***    |
+   +--------+ */
+0x0c00,
+0x1e00,
+0x1800,
+0x7e00,
+0x1800,
+0x1800,
+0xd800,
+0x7000,
+
+/* Character � (0xa0):
+   ht=8, width=8
+   +--------+
+   |    *** |
+   |        |
+   | ****   |
+   |    **  |
+   | *****  |
+   |**  **  |
+   | ****** |
+   |        |
+   +--------+ */
+0x0e00,
+0x0000,
+0x7800,
+0x0c00,
+0x7c00,
+0xcc00,
+0x7e00,
+0x0000,
+
+/* Character � (0xa1):
+   ht=8, width=8
+   +--------+
+   |   ***  |
+   |        |
+   |  ***   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |        |
+   +--------+ */
+0x1c00,
+0x0000,
+0x3800,
+0x1800,
+0x1800,
+0x1800,
+0x3c00,
+0x0000,
+
+/* Character � (0xa2):
+   ht=8, width=8
+   +--------+
+   |        |
+   |    *** |
+   |        |
+   | *****  |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   +--------+ */
+0x0000,
+0x0e00,
+0x0000,
+0x7c00,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+
+/* Character � (0xa3):
+   ht=8, width=8
+   +--------+
+   |        |
+   |    *** |
+   |        |
+   |**  **  |
+   |**  **  |
+   |** ***  |
+   | *** ** |
+   |        |
+   +--------+ */
+0x0000,
+0x0e00,
+0x0000,
+0xcc00,
+0xcc00,
+0xdc00,
+0x7600,
+0x0000,
+
+/* Character � (0xa4):
+   ht=8, width=8
+   +--------+
+   |        |
+   |******  |
+   |        |
+   |* ****  |
+   | **  ** |
+   | **  ** |
+   |***  ** |
+   |        |
+   +--------+ */
+0x0000,
+0xfc00,
+0x0000,
+0xbc00,
+0x6600,
+0x6600,
+0xe600,
+0x0000,
+
+/* Character � (0xa5):
+   ht=8, width=8
+   +--------+
+   |******* |
+   |        |
+   |**   ** |
+   |***  ** |
+   |**** ** |
+   |**  *** |
+   |**   ** |
+   |        |
+   +--------+ */
+0xfe00,
+0x0000,
+0xc600,
+0xe600,
+0xf600,
+0xce00,
+0xc600,
+0x0000,
+
+/* Character � (0xa6):
+   ht=8, width=8
+   +--------+
+   |  ***   |
+   | ** **  |
+   |  ***** |
+   |        |
+   | ****** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3800,
+0x6c00,
+0x3e00,
+0x0000,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa7):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   | *****  |
+   |        |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0x7c00,
+0x0000,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa8):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |        |
+   |   **   |
+   |  **    |
+   | **     |
+   | **  ** |
+   |  ****  |
+   |        |
+   +--------+ */
+0x1800,
+0x0000,
+0x1800,
+0x3000,
+0x6000,
+0x6600,
+0x3c00,
+0x0000,
+
+/* Character � (0xa9):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | *****  |
+   | **     |
+   | **     |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x7c00,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+
+/* Character � (0xaa):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | *****  |
+   |    **  |
+   |    **  |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x7c00,
+0x0c00,
+0x0c00,
+0x0000,
+0x0000,
+
+/* Character � (0xab):
+   ht=8, width=8
+   +--------+
+   |**      |
+   |**  **  |
+   |** **   |
+   |  **    |
+   | *****  |
+   |  ** ** |
+   |    **  |
+   |  ***** |
+   +--------+ */
+0xc000,
+0xcc00,
+0xd800,
+0x3000,
+0x7c00,
+0x3600,
+0x0c00,
+0x3e00,
+
+/* Character � (0xac):
+   ht=8, width=8
+   +--------+
+   |**      |
+   |**  **  |
+   |** **   |
+   |  **    |
+   | ** **  |
+   |  ****  |
+   | ****** |
+   |    **  |
+   +--------+ */
+0xc000,
+0xcc00,
+0xd800,
+0x3000,
+0x6c00,
+0x3c00,
+0x7e00,
+0x0c00,
+
+/* Character � (0xad):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |        |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |  ****  |
+   |   **   |
+   |        |
+   +--------+ */
+0x1800,
+0x0000,
+0x1800,
+0x1800,
+0x3c00,
+0x3c00,
+0x1800,
+0x0000,
+
+/* Character � (0xae):
+   ht=8, width=8
+   +--------+
+   |        |
+   |  ** ** |
+   | ** **  |
+   |** **   |
+   | ** **  |
+   |  ** ** |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x3600,
+0x6c00,
+0xd800,
+0x6c00,
+0x3600,
+0x0000,
+0x0000,
+
+/* Character � (0xaf):
+   ht=8, width=8
+   +--------+
+   |        |
+   |** **   |
+   | ** **  |
+   |  ** ** |
+   | ** **  |
+   |** **   |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0xd800,
+0x6c00,
+0x3600,
+0x6c00,
+0xd800,
+0x0000,
+0x0000,
+
+/* Character � (0xb0):
+   ht=8, width=8
+   +--------+
+   |  *   * |
+   |*   *   |
+   |  *   * |
+   |*   *   |
+   |  *   * |
+   |*   *   |
+   |  *   * |
+   |*   *   |
+   +--------+ */
+0x2200,
+0x8800,
+0x2200,
+0x8800,
+0x2200,
+0x8800,
+0x2200,
+0x8800,
+
+/* Character � (0xb1):
+   ht=8, width=8
+   +--------+
+   | * * * *|
+   |* * * * |
+   | * * * *|
+   |* * * * |
+   | * * * *|
+   |* * * * |
+   | * * * *|
+   |* * * * |
+   +--------+ */
+0x5500,
+0xaa00,
+0x5500,
+0xaa00,
+0x5500,
+0xaa00,
+0x5500,
+0xaa00,
+
+/* Character � (0xb2):
+   ht=8, width=8
+   +--------+
+   |** *** *|
+   | *** ***|
+   |** *** *|
+   | *** ***|
+   |** *** *|
+   | *** ***|
+   |** *** *|
+   | *** ***|
+   +--------+ */
+0xdd00,
+0x7700,
+0xdd00,
+0x7700,
+0xdd00,
+0x7700,
+0xdd00,
+0x7700,
+
+/* Character � (0xb3):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xb4):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |*****   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xf800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xb5):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |*****   |
+   |   **   |
+   |*****   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x1800,
+0x1800,
+0xf800,
+0x1800,
+0xf800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xb6):
+   ht=8, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |**** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0xf600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xb7):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |******* |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xfe00,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xb8):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |*****   |
+   |   **   |
+   |*****   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x0000,
+0x0000,
+0xf800,
+0x1800,
+0xf800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xb9):
+   ht=8, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |**** ** |
+   |     ** |
+   |**** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x3600,
+0x3600,
+0xf600,
+0x0600,
+0xf600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xba):
+   ht=8, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xbb):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |******* |
+   |     ** |
+   |**** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x0000,
+0x0000,
+0xfe00,
+0x0600,
+0xf600,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xbc):
+   ht=8, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |**** ** |
+   |     ** |
+   |******* |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3600,
+0x3600,
+0xf600,
+0x0600,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xbd):
+   ht=8, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |******* |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xbe):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |*****   |
+   |   **   |
+   |*****   |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0xf800,
+0x1800,
+0xf800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xbf):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |*****   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xf800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xc0):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   *****|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1f00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc1):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |********|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xff00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc2):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |********|
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xff00,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xc3):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   *****|
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1f00,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xc4):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |********|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xff00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc5):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |********|
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xff00,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xc6):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   *****|
+   |   **   |
+   |   *****|
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x1800,
+0x1800,
+0x1f00,
+0x1800,
+0x1f00,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xc7):
+   ht=8, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ***|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3700,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xc8):
+   ht=8, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ***|
+   |  **    |
+   |  ******|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3600,
+0x3600,
+0x3700,
+0x3000,
+0x3f00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc9):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |  ******|
+   |  **    |
+   |  ** ***|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x0000,
+0x0000,
+0x3f00,
+0x3000,
+0x3700,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xca):
+   ht=8, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |**** ***|
+   |        |
+   |********|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3600,
+0x3600,
+0xf700,
+0x0000,
+0xff00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xcb):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |********|
+   |        |
+   |**** ***|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x0000,
+0x0000,
+0xff00,
+0x0000,
+0xf700,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xcc):
+   ht=8, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ***|
+   |  **    |
+   |  ** ***|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x3600,
+0x3600,
+0x3700,
+0x3000,
+0x3700,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xcd):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |********|
+   |        |
+   |********|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xff00,
+0x0000,
+0xff00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xce):
+   ht=8, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |**** ***|
+   |        |
+   |**** ***|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x3600,
+0x3600,
+0xf700,
+0x0000,
+0xf700,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xcf):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |********|
+   |        |
+   |********|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0xff00,
+0x0000,
+0xff00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd0):
+   ht=8, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |********|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0xff00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd1):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |********|
+   |        |
+   |********|
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x0000,
+0x0000,
+0xff00,
+0x0000,
+0xff00,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xd2):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |********|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xff00,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xd3):
+   ht=8, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ******|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0x3f00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd4):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   *****|
+   |   **   |
+   |   *****|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x1f00,
+0x1800,
+0x1f00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd5):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |   *****|
+   |   **   |
+   |   *****|
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x0000,
+0x0000,
+0x1f00,
+0x1800,
+0x1f00,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xd6):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |  ******|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3f00,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xd7):
+   ht=8, width=8
+   +--------+
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   |********|
+   |  ** ** |
+   |  ** ** |
+   |  ** ** |
+   +--------+ */
+0x3600,
+0x3600,
+0x3600,
+0x3600,
+0xff00,
+0x3600,
+0x3600,
+0x3600,
+
+/* Character � (0xd8):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |********|
+   |   **   |
+   |********|
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x1800,
+0x1800,
+0xff00,
+0x1800,
+0xff00,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xd9):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |*****   |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xf800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xda):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |   *****|
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1f00,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xdb):
+   ht=8, width=8
+   +--------+
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   |********|
+   +--------+ */
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+
+/* Character � (0xdc):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |********|
+   |********|
+   |********|
+   |********|
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+
+/* Character � (0xdd):
+   ht=8, width=8
+   +--------+
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   |****    |
+   +--------+ */
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+0xf000,
+
+/* Character � (0xde):
+   ht=8, width=8
+   +--------+
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   |    ****|
+   +--------+ */
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+0x0f00,
+
+/* Character � (0xdf):
+   ht=8, width=8
+   +--------+
+   |********|
+   |********|
+   |********|
+   |********|
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0xff00,
+0xff00,
+0xff00,
+0xff00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe0):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   | **  ** |
+   |** ***  |
+   |** **   |
+   |** ***  |
+   | **  ** |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x6600,
+0xdc00,
+0xd800,
+0xdc00,
+0x6600,
+0x0000,
+
+/* Character � (0xe1):
+   ht=8, width=8
+   +--------+
+   |        |
+   | ****   |
+   |**  **  |
+   |*****   |
+   |**  **  |
+   |**   ** |
+   |**  **  |
+   |        |
+   +--------+ */
+0x0000,
+0x7800,
+0xcc00,
+0xf800,
+0xcc00,
+0xc600,
+0xcc00,
+0x0000,
+
+/* Character � (0xe2):
+   ht=8, width=8
+   +--------+
+   |        |
+   |******* |
+   | **   * |
+   | **     |
+   | **     |
+   | **     |
+   |***     |
+   |        |
+   +--------+ */
+0x0000,
+0xfe00,
+0x6200,
+0x6000,
+0x6000,
+0x6000,
+0xe000,
+0x0000,
+
+/* Character � (0xe3):
+   ht=8, width=8
+   +--------+
+   |        |
+   |******* |
+   | ** **  |
+   | ** **  |
+   | ** **  |
+   | ** **  |
+   | ** **  |
+   |        |
+   +--------+ */
+0x0000,
+0xfe00,
+0x6c00,
+0x6c00,
+0x6c00,
+0x6c00,
+0x6c00,
+0x0000,
+
+/* Character � (0xe4):
+   ht=8, width=8
+   +--------+
+   |******* |
+   |**   ** |
+   | **     |
+   |  **    |
+   | **     |
+   |**   ** |
+   |******* |
+   |        |
+   +--------+ */
+0xfe00,
+0xc600,
+0x6000,
+0x3000,
+0x6000,
+0xc600,
+0xfe00,
+0x0000,
+
+/* Character � (0xe5):
+   ht=8, width=8
+   +--------+
+   |        |
+   | ****** |
+   |** **   |
+   |**  **  |
+   |**  **  |
+   |** **   |
+   | ***    |
+   |        |
+   +--------+ */
+0x0000,
+0x7e00,
+0xd800,
+0xcc00,
+0xcc00,
+0xd800,
+0x7000,
+0x0000,
+
+/* Character � (0xe6):
+   ht=8, width=8
+   +--------+
+   |        |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | *****  |
+   |**      |
+   |        |
+   +--------+ */
+0x0000,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x7c00,
+0xc000,
+0x0000,
+
+/* Character � (0xe7):
+   ht=8, width=8
+   +--------+
+   |        |
+   | *** ** |
+   |** ***  |
+   |   **   |
+   |   **   |
+   |   **   |
+   |  ***   |
+   |        |
+   +--------+ */
+0x0000,
+0x7600,
+0xdc00,
+0x1800,
+0x1800,
+0x1800,
+0x3800,
+0x0000,
+
+/* Character � (0xe8):
+   ht=8, width=8
+   +--------+
+   |******* |
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   | ** **  |
+   |  ***   |
+   |******* |
+   |        |
+   +--------+ */
+0xfe00,
+0x3800,
+0x6c00,
+0xc600,
+0x6c00,
+0x3800,
+0xfe00,
+0x0000,
+
+/* Character � (0xe9):
+   ht=8, width=8
+   +--------+
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |******* |
+   |**   ** |
+   | ** **  |
+   |  ***   |
+   |        |
+   +--------+ */
+0x3800,
+0x6c00,
+0xc600,
+0xfe00,
+0xc600,
+0x6c00,
+0x3800,
+0x0000,
+
+/* Character � (0xea):
+   ht=8, width=8
+   +--------+
+   |  ***   |
+   | ** **  |
+   |**   ** |
+   |**   ** |
+   | ** **  |
+   | ** **  |
+   |*** *** |
+   |        |
+   +--------+ */
+0x3800,
+0x6c00,
+0xc600,
+0xc600,
+0x6c00,
+0x6c00,
+0xee00,
+0x0000,
+
+/* Character � (0xeb):
+   ht=8, width=8
+   +--------+
+   |  ***** |
+   | **     |
+   |  ***   |
+   | **  ** |
+   |**   ** |
+   |**  **  |
+   | ****   |
+   |        |
+   +--------+ */
+0x3e00,
+0x6000,
+0x3800,
+0x6600,
+0xc600,
+0xcc00,
+0x7800,
+0x0000,
+
+/* Character � (0xec):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   | ****** |
+   |** ** **|
+   |** ** **|
+   | ****** |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7e00,
+0xdb00,
+0xdb00,
+0x7e00,
+0x0000,
+0x0000,
+
+/* Character � (0xed):
+   ht=8, width=8
+   +--------+
+   |     ** |
+   | *****  |
+   |** **** |
+   |**** ** |
+   |***  ** |
+   | *****  |
+   |**      |
+   |        |
+   +--------+ */
+0x0600,
+0x7c00,
+0xde00,
+0xf600,
+0xe600,
+0x7c00,
+0xc000,
+0x0000,
+
+/* Character � (0xee):
+   ht=8, width=8
+   +--------+
+   |  ***   |
+   | **     |
+   |**      |
+   |*****   |
+   |**      |
+   | **     |
+   |  ***   |
+   |        |
+   +--------+ */
+0x3800,
+0x6000,
+0xc000,
+0xf800,
+0xc000,
+0x6000,
+0x3800,
+0x0000,
+
+/* Character � (0xef):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |**   ** |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0xc600,
+0x0000,
+
+/* Character � (0xf0):
+   ht=8, width=8
+   +--------+
+   |        |
+   |******* |
+   |        |
+   |******* |
+   |        |
+   |******* |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0xfe00,
+0x0000,
+0xfe00,
+0x0000,
+0xfe00,
+0x0000,
+0x0000,
+
+/* Character � (0xf1):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   | ****** |
+   |   **   |
+   |   **   |
+   |        |
+   | ****** |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x7e00,
+0x1800,
+0x1800,
+0x0000,
+0x7e00,
+0x0000,
+
+/* Character � (0xf2):
+   ht=8, width=8
+   +--------+
+   |  **    |
+   |   **   |
+   |    **  |
+   |   **   |
+   |  **    |
+   |        |
+   | ****** |
+   |        |
+   +--------+ */
+0x3000,
+0x1800,
+0x0c00,
+0x1800,
+0x3000,
+0x0000,
+0x7e00,
+0x0000,
+
+/* Character � (0xf3):
+   ht=8, width=8
+   +--------+
+   |    **  |
+   |   **   |
+   |  **    |
+   |   **   |
+   |    **  |
+   |        |
+   | ****** |
+   |        |
+   +--------+ */
+0x0c00,
+0x1800,
+0x3000,
+0x1800,
+0x0c00,
+0x0000,
+0x7e00,
+0x0000,
+
+/* Character � (0xf4):
+   ht=8, width=8
+   +--------+
+   |    **  |
+   |   **** |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   +--------+ */
+0x0c00,
+0x1e00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+
+/* Character � (0xf5):
+   ht=8, width=8
+   +--------+
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   | ****   |
+   |  **    |
+   |        |
+   +--------+ */
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x7800,
+0x3000,
+0x0000,
+
+/* Character � (0xf6):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |        |
+   | ****** |
+   |        |
+   |   **   |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x0000,
+0x7e00,
+0x0000,
+0x1800,
+0x0000,
+
+/* Character � (0xf7):
+   ht=8, width=8
+   +--------+
+   |        |
+   | *** ** |
+   |** ***  |
+   |        |
+   | *** ** |
+   |** ***  |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x7600,
+0xdc00,
+0x0000,
+0x7600,
+0xdc00,
+0x0000,
+0x0000,
+
+/* Character � (0xf8):
+   ht=8, width=8
+   +--------+
+   | *****  |
+   |**   ** |
+   |**   ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x7c00,
+0xc600,
+0xc600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf9):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xfa):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xfb):
+   ht=8, width=8
+   +--------+
+   |   *****|
+   |   **   |
+   |   **   |
+   |   **   |
+   |*****   |
+   |  ***   |
+   |   **   |
+   |        |
+   +--------+ */
+0x1f00,
+0x1800,
+0x1800,
+0x1800,
+0xf800,
+0x3800,
+0x1800,
+0x0000,
+
+/* Character � (0xfc):
+   ht=8, width=8
+   +--------+
+   |** **   |
+   | ** **  |
+   | ** **  |
+   | ** **  |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0xd800,
+0x6c00,
+0x6c00,
+0x6c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xfd):
+   ht=8, width=8
+   +--------+
+   | ***    |
+   |** **   |
+   |  **    |
+   |*****   |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x7000,
+0xd800,
+0x3000,
+0xf800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xfe):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   | *****  |
+   | *****  |
+   | *****  |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0x7c00,
+0x7c00,
+0x7c00,
+0x0000,
+0x0000,
+
+/* Character � (0xff):
+   ht=8, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+};
+
+/* Exported structure definition. */
+MWCFONT font_rom8x8 = {
+	"rom8x8",
+	8,
+	8,
+	7,
+	0,
+	256,
+	rom8x8_bits,
+	0,
+	0
+};
diff -urN lib/microwindows/src/fonts/symbol.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/symbol.c
--- lib/microwindows/src/fonts/symbol.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/symbol.c	2005-02-21 16:03:27.000000000 +0100
@@ -0,0 +1,148 @@
+/* 
+ * Originally from BOGL - Ben's Own Graphics Library.
+ * Written by Ben Pfaff <pfaffben@debian.org>.
+ */
+#include "device.h"
+
+/* Symbol font definition. */
+
+MWIMAGEBITS symbol_bits[] = {
+/* Character 0x00:
+   +--------------------------------+
+   |                                |
+   |                                |
+   |*******                         |
+   |*     *                         |
+   |*     *                         |
+   |*     *                         |
+   |*     *                         |
+   |*     *                         |
+   |*******                         |
+   |                                |
+   |                                |
+   |                                |
+   +--------------------------------+ */
+0x0000,
+0x0000,
+0xfe00,
+0x8200,
+0x8200,
+0x8200,
+0x8200,
+0x8200,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 0x01:
+   +--------------------------------+
+   |                                |
+   |                                |
+   |*******                         |
+   |*     *                         |
+   |* * * *                         |
+   |*  *  *                         |
+   |* * * *                         |
+   |*     *                         |
+   |*******                         |
+   |                                |
+   |                                |
+   |                                |
+   +--------------------------------+ */
+0x0000,
+0x0000,
+0xfe00,
+0x8200,
+0xaa00,
+0x9200,
+0xaa00,
+0x8200,
+0xfe00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 0x02:
+   +--------------------------------+
+   |                                |
+   |                                |
+   |  *                             |
+   | ***                            |
+   |*****                           |
+   |  *                             |
+   |  *                             |
+   |  *                             |
+   |  *                             |
+   |                                |
+   |                                |
+   |                                |
+   +--------------------------------+ */
+0x0000,
+0x0000,
+0x2000,
+0x7000,
+0xf800,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 0x03:
+   +--------------------------------+
+   |                                |
+   |                                |
+   |  *                             |
+   |  *                             |
+   |  *                             |
+   |  *                             |
+   |*****                           |
+   | ***                            |
+   |  *                             |
+   |                                |
+   |                                |
+   |                                |
+   +--------------------------------+ */
+0x0000,
+0x0000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0xf800,
+0x7000,
+0x2000,
+0x0000,
+0x0000,
+0x0000,
+
+};
+
+static unsigned short symbol_offset[] = {
+  0,	/* 0x00 */
+  12,	/* 0x01 */
+  24,	/* 0x02 */
+  36,	/* 0x03 */
+};
+
+static unsigned char symbol_width[] = {
+  8,	/* 0x00 */
+  8,	/* 0x01 */
+  5,	/* 0x02 */
+  5,	/* 0x03 */
+};
+
+MWCFONT font_symbol = {
+	"symbol",
+	8,
+	12,
+	9,
+	0,
+	4,
+	symbol_bits,
+	symbol_offset,
+	symbol_width,
+};
diff -urN lib/microwindows/src/fonts/timBI18.bdf /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/timBI18.bdf
--- lib/microwindows/src/fonts/timBI18.bdf	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/timBI18.bdf	2005-02-21 16:03:27.000000000 +0100
@@ -0,0 +1,4237 @@
+STARTFONT 2.1
+FONT -Adobe-Times-Bold-I-Normal--18-180-75-75-P-98-ISO8859-1
+SIZE 18 75 75
+FONTBOUNDINGBOX 22 21 -3 -4
+COMMENT $XConsortium: timBI18.bdf,v 1.14 95/01/26 18:06:27 gildea Exp $
+COMMENT 
+COMMENT +
+COMMENT  Copyright 1984-1989, 1994 Adobe Systems Incorporated.
+COMMENT  Copyright 1988, 1994 Digital Equipment Corporation.
+COMMENT
+COMMENT  Adobe is a trademark of Adobe Systems Incorporated which may be
+COMMENT  registered in certain jurisdictions.
+COMMENT  Permission to use these trademarks is hereby granted only in
+COMMENT  association with the images described in this file.
+COMMENT
+COMMENT  Permission to use, copy, modify, distribute and sell this software
+COMMENT  and its documentation for any purpose and without fee is hereby
+COMMENT  granted, provided that the above copyright notices appear in all
+COMMENT  copies and that both those copyright notices and this permission
+COMMENT  notice appear in supporting documentation, and that the names of
+COMMENT  Adobe Systems and Digital Equipment Corporation not be used in
+COMMENT  advertising or publicity pertaining to distribution of the software
+COMMENT  without specific, written prior permission.  Adobe Systems and
+COMMENT  Digital Equipment Corporation make no representations about the
+COMMENT  suitability of this software for any purpose.  It is provided "as
+COMMENT  is" without express or implied warranty.
+COMMENT -
+STARTPROPERTIES 28
+FOUNDRY "Adobe"
+FAMILY_NAME "Times"
+WEIGHT_NAME "Bold"
+SLANT "I"
+SETWIDTH_NAME "Normal"
+ADD_STYLE_NAME ""
+PIXEL_SIZE 18
+POINT_SIZE 180
+RESOLUTION_X 75
+RESOLUTION_Y 75
+SPACING "P"
+AVERAGE_WIDTH 98
+CHARSET_REGISTRY "ISO8859"
+CHARSET_ENCODING "1"
+CAP_HEIGHT 13
+X_HEIGHT 8
+FONT_ASCENT 15
+FONT_DESCENT 4
+FACE_NAME "Times Bold Italic"
+COPYRIGHT "Copyright (c) 1984, 1987 Adobe Systems Incorporated. All Rights Reserved. Copyright (c) 1988, 1991 Digital Equipment Corporation. All Rights Reserved."
+NOTICE "Times is a trademark of Linotype-Hell AG and/or its subsidiaries."
+_DEC_DEVICE_FONTNAMES "PS=Times-BoldItalic"
+_DEC_PRODUCTINFO "DECwindows Fonts V2.2, 07-Nov-1991"
+DEFAULT_CHAR 32
+RELATIVE_SETWIDTH 50
+RELATIVE_WEIGHT 70
+CHARSET_COLLECTIONS "ASCII ISO8859-1 ADOBE-STANDARD"
+FULL_NAME "Times Bold Italic"
+ENDPROPERTIES
+CHARS 229
+STARTCHAR space
+ENCODING 32
+SWIDTH 250 0
+DWIDTH 4 0
+BBX 1 1 0 0
+BITMAP
+00
+ENDCHAR
+STARTCHAR exclam
+ENCODING 33
+SWIDTH 389 0
+DWIDTH 7 0
+BBX 6 13 1 0
+BITMAP
+1C
+1C
+18
+38
+38
+30
+70
+60
+40
+00
+00
+C0
+C0
+ENDCHAR
+STARTCHAR quotedbl
+ENCODING 34
+SWIDTH 555 0
+DWIDTH 9 0
+BBX 7 5 1 8
+BITMAP
+66
+66
+CC
+CC
+88
+ENDCHAR
+STARTCHAR numbersign
+ENCODING 35
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 9 13 0 0
+BITMAP
+1B00
+1B00
+1B00
+7F80
+7F80
+3600
+3600
+3600
+FF00
+FF00
+6C00
+6C00
+6C00
+ENDCHAR
+STARTCHAR dollar
+ENCODING 36
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 8 16 0 -2
+BITMAP
+02
+1E
+25
+65
+68
+78
+3C
+1E
+1F
+17
+13
+A3
+A6
+7C
+40
+40
+ENDCHAR
+STARTCHAR percent
+ENCODING 37
+SWIDTH 833 0
+DWIDTH 15 0
+BBX 14 13 0 0
+BITMAP
+3C30
+77F0
+E460
+C4C0
+CCC0
+D980
+71B8
+0374
+02E4
+06C4
+0CCC
+0CD8
+1870
+ENDCHAR
+STARTCHAR ampersand
+ENCODING 38
+SWIDTH 778 0
+DWIDTH 15 0
+BBX 13 13 1 0
+BITMAP
+0780
+0EC0
+0E40
+0EC0
+0780
+0E00
+3E78
+7730
+E760
+E3C0
+E380
+F7D8
+7CF0
+ENDCHAR
+STARTCHAR quoteright
+ENCODING 39
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 3 5 2 8
+BITMAP
+E0
+E0
+60
+40
+80
+ENDCHAR
+STARTCHAR parenleft
+ENCODING 40
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 6 16 0 -3
+BITMAP
+0C
+18
+30
+30
+60
+60
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+60
+60
+30
+ENDCHAR
+STARTCHAR parenright
+ENCODING 41
+SWIDTH 333 0
+DWIDTH 7 0
+BBX 6 16 0 -3
+BITMAP
+30
+18
+18
+0C
+0C
+0C
+0C
+0C
+0C
+0C
+18
+18
+30
+30
+60
+C0
+ENDCHAR
+STARTCHAR asterisk
+ENCODING 42
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 8 8 1 5
+BITMAP
+18
+18
+DB
+7E
+18
+7E
+DB
+18
+ENDCHAR
+STARTCHAR plus
+ENCODING 43
+SWIDTH 570 0
+DWIDTH 10 0
+BBX 8 8 1 1
+BITMAP
+18
+18
+18
+FF
+FF
+18
+18
+18
+ENDCHAR
+STARTCHAR comma
+ENCODING 44
+SWIDTH 250 0
+DWIDTH 5 0
+BBX 3 4 0 -2
+BITMAP
+60
+60
+20
+C0
+ENDCHAR
+STARTCHAR minus
+ENCODING 45
+SWIDTH 606 0
+DWIDTH 11 0
+BBX 9 2 1 4
+BITMAP
+FF80
+FF80
+ENDCHAR
+STARTCHAR period
+ENCODING 46
+SWIDTH 250 0
+DWIDTH 5 0
+BBX 2 2 1 0
+BITMAP
+C0
+C0
+ENDCHAR
+STARTCHAR slash
+ENCODING 47
+SWIDTH 278 0
+DWIDTH 6 0
+BBX 6 13 0 0
+BITMAP
+0C
+0C
+18
+18
+18
+30
+30
+60
+60
+60
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR zero
+ENCODING 48
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 9 13 0 0
+BITMAP
+1E00
+3B00
+7180
+7180
+E380
+E380
+E380
+C700
+C700
+C600
+CE00
+EC00
+7800
+ENDCHAR
+STARTCHAR one
+ENCODING 49
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 7 13 0 0
+BITMAP
+0E
+3E
+0E
+0E
+1C
+1C
+1C
+1C
+1C
+38
+38
+38
+FE
+ENDCHAR
+STARTCHAR two
+ENCODING 50
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 9 13 -1 0
+BITMAP
+1F00
+3F80
+4780
+0380
+0380
+0700
+0600
+0C00
+1800
+3080
+7F80
+FF00
+FE00
+ENDCHAR
+STARTCHAR three
+ENCODING 51
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 9 13 -1 0
+BITMAP
+1F00
+3780
+0380
+0380
+0700
+1C00
+1F00
+0780
+0380
+0380
+6380
+E700
+7C00
+ENDCHAR
+STARTCHAR four
+ENCODING 52
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 8 13 0 0
+BITMAP
+03
+07
+0F
+1F
+16
+36
+66
+CE
+FF
+FF
+0C
+1C
+1C
+ENDCHAR
+STARTCHAR five
+ENCODING 53
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 8 13 0 0
+BITMAP
+1F
+3F
+3E
+20
+78
+7E
+1E
+07
+07
+07
+CE
+DC
+78
+ENDCHAR
+STARTCHAR six
+ENCODING 54
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 8 13 0 0
+BITMAP
+03
+0E
+1C
+38
+70
+6E
+FF
+E3
+E3
+C7
+C7
+6E
+3C
+ENDCHAR
+STARTCHAR seven
+ENCODING 55
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 9 13 0 0
+BITMAP
+3F80
+3F80
+6380
+4300
+0600
+0C00
+0C00
+1800
+3000
+3000
+6000
+C000
+C000
+ENDCHAR
+STARTCHAR eight
+ENCODING 56
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 9 13 0 0
+BITMAP
+1E00
+7380
+7180
+7180
+3B00
+1E00
+3E00
+7700
+C700
+C380
+C380
+EF00
+3C00
+ENDCHAR
+STARTCHAR nine
+ENCODING 57
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 9 13 -1 0
+BITMAP
+1E00
+3B80
+7180
+7180
+7180
+7380
+3380
+1F00
+0700
+0E00
+1C00
+3800
+E000
+ENDCHAR
+STARTCHAR colon
+ENCODING 58
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 4 8 1 0
+BITMAP
+30
+30
+00
+00
+00
+00
+C0
+C0
+ENDCHAR
+STARTCHAR semicolon
+ENCODING 59
+SWIDTH 333 0
+DWIDTH 7 0
+BBX 5 10 0 -2
+BITMAP
+18
+18
+00
+00
+00
+00
+60
+60
+20
+C0
+ENDCHAR
+STARTCHAR less
+ENCODING 60
+SWIDTH 570 0
+DWIDTH 12 0
+BBX 9 8 2 0
+BITMAP
+0380
+0E00
+3800
+E000
+E000
+3800
+0E00
+0380
+ENDCHAR
+STARTCHAR equal
+ENCODING 61
+SWIDTH 570 0
+DWIDTH 11 0
+BBX 9 5 1 2
+BITMAP
+FF80
+FF80
+0000
+FF80
+FF80
+ENDCHAR
+STARTCHAR greater
+ENCODING 62
+SWIDTH 570 0
+DWIDTH 12 0
+BBX 9 8 1 0
+BITMAP
+E000
+3800
+0E00
+0380
+0380
+0E00
+3800
+E000
+ENDCHAR
+STARTCHAR question
+ENCODING 63
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 7 13 2 0
+BITMAP
+3C
+66
+66
+0E
+1E
+3C
+30
+60
+60
+40
+00
+C0
+C0
+ENDCHAR
+STARTCHAR at
+ENCODING 64
+SWIDTH 832 0
+DWIDTH 17 0
+BBX 15 15 1 -3
+BITMAP
+03E0
+0F38
+1C0C
+3804
+71D6
+6372
+E672
+C462
+CC66
+CCE4
+EFEC
+6738
+7000
+3C30
+0FC0
+ENDCHAR
+STARTCHAR A
+ENCODING 65
+SWIDTH 667 0
+DWIDTH 13 0
+BBX 14 13 -1 0
+BITMAP
+00C0
+01C0
+01C0
+03E0
+02E0
+0660
+0C70
+0C70
+1FF0
+1870
+3038
+7038
+F87C
+ENDCHAR
+STARTCHAR B
+ENCODING 66
+SWIDTH 667 0
+DWIDTH 13 0
+BBX 12 13 0 0
+BITMAP
+3FE0
+1CF0
+1C70
+1C70
+1860
+3FC0
+38E0
+3870
+3070
+7070
+70F0
+71E0
+FF80
+ENDCHAR
+STARTCHAR C
+ENCODING 67
+SWIDTH 667 0
+DWIDTH 13 0
+BBX 12 13 1 0
+BITMAP
+07D0
+1E70
+3830
+7030
+7000
+6000
+E000
+E000
+E000
+F000
+7060
+7DC0
+1F00
+ENDCHAR
+STARTCHAR D
+ENCODING 68
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 13 13 0 0
+BITMAP
+3F80
+1DE0
+1C70
+1C70
+3838
+3838
+3838
+3838
+7070
+70F0
+70E0
+73C0
+FF00
+ENDCHAR
+STARTCHAR E
+ENCODING 69
+SWIDTH 667 0
+DWIDTH 12 0
+BBX 12 13 0 0
+BITMAP
+3FF0
+1C70
+1C20
+1C20
+3880
+3980
+3F80
+3980
+3100
+7020
+7060
+70E0
+FFC0
+ENDCHAR
+STARTCHAR F
+ENCODING 70
+SWIDTH 667 0
+DWIDTH 12 0
+BBX 12 13 0 0
+BITMAP
+3FF0
+1C70
+1C20
+1C20
+1880
+3980
+3F80
+3980
+3100
+7000
+7000
+7000
+F800
+ENDCHAR
+STARTCHAR G
+ENCODING 71
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 12 13 1 0
+BITMAP
+07D0
+1E70
+3830
+7030
+7000
+6000
+E000
+E1F0
+E0E0
+F0E0
+70C0
+7DC0
+1FC0
+ENDCHAR
+STARTCHAR H
+ENCODING 72
+SWIDTH 778 0
+DWIDTH 15 0
+BBX 15 13 0 0
+BITMAP
+3E3E
+1C1C
+1C1C
+1C1C
+3838
+3838
+3FF8
+3838
+3838
+7070
+7070
+7070
+F8F8
+ENDCHAR
+STARTCHAR I
+ENCODING 73
+SWIDTH 389 0
+DWIDTH 7 0
+BBX 7 13 0 0
+BITMAP
+3E
+1C
+1C
+1C
+38
+38
+38
+38
+70
+70
+70
+70
+F8
+ENDCHAR
+STARTCHAR J
+ENCODING 74
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 10 14 -1 -1
+BITMAP
+07C0
+0380
+0380
+0300
+0700
+0700
+0700
+0600
+0E00
+0E00
+0E00
+EC00
+FC00
+7000
+ENDCHAR
+STARTCHAR K
+ENCODING 75
+SWIDTH 667 0
+DWIDTH 12 0
+BBX 14 13 -1 0
+BITMAP
+3E7C
+1C30
+1C60
+1CC0
+3980
+3F00
+3F00
+3B80
+3B80
+71C0
+71C0
+70E0
+F9F0
+ENDCHAR
+STARTCHAR L
+ENCODING 76
+SWIDTH 611 0
+DWIDTH 11 0
+BBX 11 13 0 0
+BITMAP
+3E00
+1C00
+1C00
+1C00
+3800
+3800
+3800
+3800
+3000
+7020
+7060
+70E0
+FFC0
+ENDCHAR
+STARTCHAR M
+ENCODING 77
+SWIDTH 889 0
+DWIDTH 17 0
+BBX 18 13 0 0
+BITMAP
+3E07C0
+1E0780
+1E0F00
+161300
+373600
+372600
+276600
+274C00
+63CC00
+638C00
+638C00
+631C00
+F23E00
+ENDCHAR
+STARTCHAR N
+ENCODING 78
+SWIDTH 722 0
+DWIDTH 13 0
+BBX 16 13 -1 0
+BITMAP
+3C1F
+1C0E
+1E0C
+1E0C
+1B18
+3398
+3398
+31D8
+31D0
+60F0
+60F0
+6060
+F060
+ENDCHAR
+STARTCHAR O
+ENCODING 79
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 12 13 1 0
+BITMAP
+07C0
+1EE0
+3870
+7070
+7070
+E070
+E070
+E070
+E0E0
+E0E0
+E1C0
+7780
+3E00
+ENDCHAR
+STARTCHAR P
+ENCODING 80
+SWIDTH 611 0
+DWIDTH 11 0
+BBX 12 13 0 0
+BITMAP
+3FE0
+1CF0
+1C70
+1C70
+3870
+38E0
+3FC0
+3800
+3000
+7000
+7000
+7000
+F800
+ENDCHAR
+STARTCHAR Q
+ENCODING 81
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 12 16 1 -3
+BITMAP
+07C0
+1EE0
+3870
+7070
+7070
+E070
+E070
+E070
+E0E0
+E0E0
+E1C0
+7780
+3E00
+1820
+7FC0
+DF80
+ENDCHAR
+STARTCHAR R
+ENCODING 82
+SWIDTH 667 0
+DWIDTH 12 0
+BBX 12 13 0 0
+BITMAP
+3FE0
+1CF0
+1C70
+1870
+3870
+38E0
+3FC0
+3B80
+39C0
+71C0
+70E0
+70E0
+F8F0
+ENDCHAR
+STARTCHAR S
+ENCODING 83
+SWIDTH 556 0
+DWIDTH 11 0
+BBX 10 13 0 0
+BITMAP
+0F40
+1DC0
+38C0
+3840
+3C00
+1E00
+0F00
+0F80
+0780
+C380
+C380
+E700
+FE00
+ENDCHAR
+STARTCHAR T
+ENCODING 84
+SWIDTH 611 0
+DWIDTH 11 0
+BBX 11 13 1 0
+BITMAP
+FFE0
+CE60
+8E20
+0E00
+1C00
+1C00
+1C00
+1C00
+1800
+3800
+3800
+3800
+7C00
+ENDCHAR
+STARTCHAR U
+ENCODING 85
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 14 13 1 0
+BITMAP
+7E7C
+3838
+3830
+7830
+7060
+7060
+7060
+F060
+E0C0
+E0C0
+E0C0
+F180
+7F00
+ENDCHAR
+STARTCHAR V
+ENCODING 86
+SWIDTH 667 0
+DWIDTH 13 0
+BBX 12 13 2 0
+BITMAP
+F9F0
+70E0
+70C0
+7180
+7180
+7300
+7600
+7600
+7C00
+7800
+7800
+7000
+6000
+ENDCHAR
+STARTCHAR W
+ENCODING 87
+SWIDTH 889 0
+DWIDTH 17 0
+BBX 17 13 1 0
+BITMAP
+F3E780
+71C300
+71C600
+71C400
+71CC00
+73C800
+73D800
+75D000
+3CF000
+38E000
+38E000
+30C000
+30C000
+ENDCHAR
+STARTCHAR X
+ENCODING 88
+SWIDTH 667 0
+DWIDTH 13 0
+BBX 15 13 -1 0
+BITMAP
+3F3E
+0E18
+0E30
+0760
+07C0
+0380
+0380
+07C0
+0DC0
+19C0
+30E0
+60E0
+F1F8
+ENDCHAR
+STARTCHAR Y
+ENCODING 89
+SWIDTH 611 0
+DWIDTH 11 0
+BBX 12 13 0 0
+BITMAP
+F8F0
+7060
+70C0
+3980
+3B00
+1E00
+1C00
+1C00
+1C00
+3800
+3800
+3800
+FE00
+ENDCHAR
+STARTCHAR Z
+ENCODING 90
+SWIDTH 611 0
+DWIDTH 11 0
+BBX 13 13 -1 0
+BITMAP
+1FF8
+38F0
+20E0
+01C0
+0380
+0700
+0F00
+0E00
+1C00
+3820
+7060
+F0E0
+FFC0
+ENDCHAR
+STARTCHAR bracketleft
+ENCODING 91
+SWIDTH 333 0
+DWIDTH 7 0
+BBX 8 16 0 -3
+BITMAP
+0F
+0C
+18
+18
+18
+18
+30
+30
+30
+30
+60
+60
+60
+60
+C0
+F0
+ENDCHAR
+STARTCHAR backslash
+ENCODING 92
+SWIDTH 278 0
+DWIDTH 8 0
+BBX 8 13 1 0
+BITMAP
+C0
+C0
+60
+60
+30
+30
+18
+18
+0C
+0C
+06
+06
+03
+ENDCHAR
+STARTCHAR bracketright
+ENCODING 93
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 8 16 -2 -3
+BITMAP
+0F
+03
+06
+06
+06
+06
+0C
+0C
+0C
+0C
+18
+18
+18
+18
+30
+F0
+ENDCHAR
+STARTCHAR asciicircum
+ENCODING 94
+SWIDTH 570 0
+DWIDTH 11 0
+BBX 8 8 1 5
+BITMAP
+0C
+1C
+1C
+36
+66
+66
+C3
+C3
+ENDCHAR
+STARTCHAR underscore
+ENCODING 95
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 9 1 0 -3
+BITMAP
+FF80
+ENDCHAR
+STARTCHAR quoteleft
+ENCODING 96
+SWIDTH 333 0
+DWIDTH 5 0
+BBX 3 5 1 8
+BITMAP
+20
+40
+C0
+E0
+E0
+ENDCHAR
+STARTCHAR a
+ENCODING 97
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 10 8 0 0
+BITMAP
+1E80
+7B80
+7380
+E300
+E700
+E700
+EF40
+3B80
+ENDCHAR
+STARTCHAR b
+ENCODING 98
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 9 13 0 0
+BITMAP
+7800
+3800
+3800
+3000
+3000
+7700
+7B80
+7380
+7380
+E380
+E700
+E600
+7800
+ENDCHAR
+STARTCHAR c
+ENCODING 99
+SWIDTH 444 0
+DWIDTH 8 0
+BBX 8 8 0 0
+BITMAP
+1F
+73
+63
+E0
+E0
+E0
+F6
+3C
+ENDCHAR
+STARTCHAR d
+ENCODING 100
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 10 13 0 0
+BITMAP
+03C0
+01C0
+01C0
+0180
+0380
+1B80
+7780
+6300
+E300
+E300
+E700
+EF40
+7B80
+ENDCHAR
+STARTCHAR e
+ENCODING 101
+SWIDTH 444 0
+DWIDTH 9 0
+BBX 8 8 0 0
+BITMAP
+1E
+77
+67
+EE
+F8
+E3
+F6
+7C
+ENDCHAR
+STARTCHAR f
+ENCODING 102
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 11 17 -2 -4
+BITMAP
+03C0
+0760
+0660
+0E00
+0E00
+3F80
+0E00
+0E00
+0C00
+1C00
+1C00
+1C00
+1C00
+1800
+D800
+D800
+7000
+ENDCHAR
+STARTCHAR g
+ENCODING 103
+SWIDTH 500 0
+DWIDTH 8 0
+BBX 10 12 -1 -4
+BITMAP
+1F40
+3B80
+7380
+6380
+7700
+3E00
+7000
+3E00
+EF80
+C380
+C380
+7F00
+ENDCHAR
+STARTCHAR h
+ENCODING 104
+SWIDTH 556 0
+DWIDTH 11 0
+BBX 10 13 1 0
+BITMAP
+7800
+3800
+3800
+3000
+7000
+7700
+7F80
+7380
+6380
+E300
+E700
+E740
+E380
+ENDCHAR
+STARTCHAR i
+ENCODING 105
+SWIDTH 278 0
+DWIDTH 5 0
+BBX 5 13 0 0
+BITMAP
+38
+38
+00
+00
+00
+F0
+70
+70
+60
+60
+E0
+E8
+70
+ENDCHAR
+STARTCHAR j
+ENCODING 106
+SWIDTH 278 0
+DWIDTH 4 0
+BBX 8 17 -3 -4
+BITMAP
+07
+07
+00
+00
+00
+1E
+0E
+0E
+0C
+0C
+1C
+1C
+18
+18
+D8
+F0
+60
+ENDCHAR
+STARTCHAR k
+ENCODING 107
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 10 13 -1 0
+BITMAP
+3C00
+1C00
+1C00
+1800
+3800
+3BC0
+3380
+3600
+3C00
+7400
+7600
+E780
+E700
+ENDCHAR
+STARTCHAR l
+ENCODING 108
+SWIDTH 278 0
+DWIDTH 5 0
+BBX 5 13 0 0
+BITMAP
+78
+38
+38
+30
+70
+70
+70
+70
+60
+E0
+E0
+E8
+70
+ENDCHAR
+STARTCHAR m
+ENCODING 109
+SWIDTH 778 0
+DWIDTH 14 0
+BBX 14 8 0 0
+BITMAP
+F770
+7BB8
+7338
+7338
+7330
+E670
+E674
+E678
+ENDCHAR
+STARTCHAR n
+ENCODING 110
+SWIDTH 556 0
+DWIDTH 10 0
+BBX 10 8 0 0
+BITMAP
+F700
+7B80
+7380
+7380
+6300
+E700
+E740
+E380
+ENDCHAR
+STARTCHAR o
+ENCODING 111
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 9 8 0 0
+BITMAP
+1F00
+7380
+6380
+E380
+E380
+E300
+E700
+7C00
+ENDCHAR
+STARTCHAR p
+ENCODING 112
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 11 12 -2 -4
+BITMAP
+3BC0
+1EE0
+1CE0
+1CE0
+38E0
+39C0
+3980
+3700
+3000
+7000
+7000
+F800
+ENDCHAR
+STARTCHAR q
+ENCODING 113
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 9 12 0 -4
+BITMAP
+1D80
+7780
+6380
+E300
+E700
+E700
+FF00
+3600
+0600
+0E00
+0E00
+1F00
+ENDCHAR
+STARTCHAR r
+ENCODING 114
+SWIDTH 389 0
+DWIDTH 6 0
+BBX 7 8 0 0
+BITMAP
+EE
+7E
+70
+70
+60
+E0
+E0
+E0
+ENDCHAR
+STARTCHAR s
+ENCODING 115
+SWIDTH 389 0
+DWIDTH 7 0
+BBX 8 8 -1 0
+BITMAP
+3E
+77
+72
+38
+1C
+4E
+EE
+7C
+ENDCHAR
+STARTCHAR t
+ENCODING 116
+SWIDTH 278 0
+DWIDTH 6 0
+BBX 6 10 0 0
+BITMAP
+30
+70
+FC
+70
+70
+60
+E0
+E0
+E8
+70
+ENDCHAR
+STARTCHAR u
+ENCODING 117
+SWIDTH 556 0
+DWIDTH 10 0
+BBX 10 8 0 0
+BITMAP
+F380
+7380
+7300
+6700
+E700
+EF00
+FB40
+7380
+ENDCHAR
+STARTCHAR v
+ENCODING 118
+SWIDTH 444 0
+DWIDTH 7 0
+BBX 8 8 -1 0
+BITMAP
+F7
+73
+73
+72
+36
+3C
+38
+30
+ENDCHAR
+STARTCHAR w
+ENCODING 119
+SWIDTH 667 0
+DWIDTH 11 0
+BBX 12 8 -1 0
+BITMAP
+E270
+7330
+7330
+77A0
+37E0
+3DC0
+3980
+1080
+ENDCHAR
+STARTCHAR x
+ENCODING 120
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 9 8 0 0
+BITMAP
+7B80
+3B00
+1E00
+1C00
+3C00
+6E00
+CE80
+E700
+ENDCHAR
+STARTCHAR y
+ENCODING 121
+SWIDTH 444 0
+DWIDTH 7 0
+BBX 9 12 -2 -4
+BITMAP
+7B80
+3980
+3980
+3900
+1B00
+1E00
+1E00
+0C00
+0C00
+0800
+D000
+E000
+ENDCHAR
+STARTCHAR z
+ENCODING 122
+SWIDTH 389 0
+DWIDTH 7 0
+BBX 7 9 0 -1
+BITMAP
+3E
+7E
+4C
+18
+30
+60
+E6
+F6
+1C
+ENDCHAR
+STARTCHAR braceleft
+ENCODING 123
+SWIDTH 348 0
+DWIDTH 6 0
+BBX 7 16 0 -3
+BITMAP
+0E
+18
+30
+30
+30
+30
+60
+C0
+60
+60
+60
+C0
+C0
+C0
+C0
+70
+ENDCHAR
+STARTCHAR bar
+ENCODING 124
+SWIDTH 220 0
+DWIDTH 6 0
+BBX 2 13 2 0
+BITMAP
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR braceright
+ENCODING 125
+SWIDTH 348 0
+DWIDTH 7 0
+BBX 6 16 -1 -3
+BITMAP
+38
+0C
+0C
+0C
+0C
+18
+18
+18
+0C
+18
+30
+30
+30
+30
+60
+C0
+ENDCHAR
+STARTCHAR asciitilde
+ENCODING 126
+SWIDTH 570 0
+DWIDTH 10 0
+BBX 8 3 1 4
+BITMAP
+71
+FF
+8E
+ENDCHAR
+STARTCHAR space
+ENCODING 160
+SWIDTH 250 0
+DWIDTH 4 0
+BBX 1 1 0 0
+BITMAP
+00
+ENDCHAR
+STARTCHAR exclamdown
+ENCODING 161
+SWIDTH 389 0
+DWIDTH 6 0
+BBX 6 13 -1 -4
+BITMAP
+0C
+0C
+00
+00
+08
+18
+38
+30
+70
+70
+60
+E0
+E0
+ENDCHAR
+STARTCHAR cent
+ENCODING 162
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 8 12 0 -2
+BITMAP
+01
+02
+1F
+77
+64
+E8
+E8
+F0
+F6
+7C
+20
+40
+ENDCHAR
+STARTCHAR sterling
+ENCODING 163
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 10 13 -1 0
+BITMAP
+0380
+06C0
+0CC0
+0C00
+1C00
+1800
+7F00
+1800
+1800
+3800
+7C40
+DF80
+E700
+ENDCHAR
+STARTCHAR currency
+ENCODING 164
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 9 9 0 2
+BITMAP
+9C80
+FF80
+6300
+C180
+C180
+C180
+6300
+FF80
+9C80
+ENDCHAR
+STARTCHAR yen
+ENCODING 165
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 11 13 0 0
+BITMAP
+F9E0
+70C0
+7180
+3900
+3B00
+1E00
+7F00
+1C00
+7F00
+1800
+3800
+3800
+7E00
+ENDCHAR
+STARTCHAR brokenbar
+ENCODING 166
+SWIDTH 220 0
+DWIDTH 6 0
+BBX 2 13 2 0
+BITMAP
+C0
+C0
+C0
+C0
+C0
+00
+00
+00
+C0
+C0
+C0
+C0
+C0
+ENDCHAR
+STARTCHAR section
+ENCODING 167
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 9 16 0 -3
+BITMAP
+0F00
+1B80
+1300
+1800
+1C00
+2E00
+6700
+6300
+6300
+7300
+3A00
+1C00
+0C00
+C400
+EC00
+7800
+ENDCHAR
+STARTCHAR dieresis
+ENCODING 168
+SWIDTH 333 0
+DWIDTH 7 0
+BBX 6 2 1 9
+BITMAP
+CC
+CC
+ENDCHAR
+STARTCHAR copyright
+ENCODING 169
+SWIDTH 747 0
+DWIDTH 15 0
+BBX 13 13 1 0
+BITMAP
+0F80
+38E0
+6030
+4FD0
+DCD8
+9848
+9808
+9808
+DCD8
+4F90
+6030
+38E0
+0F80
+ENDCHAR
+STARTCHAR ordfeminine
+ENCODING 170
+SWIDTH 266 0
+DWIDTH 7 0
+BBX 7 7 0 5
+BITMAP
+1E
+36
+6C
+6E
+74
+00
+F8
+ENDCHAR
+STARTCHAR guillemotleft
+ENCODING 171
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 9 8 0 0
+BITMAP
+0880
+1980
+3300
+6600
+CC00
+6600
+3300
+1100
+ENDCHAR
+STARTCHAR logicalnot
+ENCODING 172
+SWIDTH 606 0
+DWIDTH 11 0
+BBX 9 6 1 1
+BITMAP
+FF80
+FF80
+0180
+0180
+0180
+0180
+ENDCHAR
+STARTCHAR hyphen
+ENCODING 173
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 5 2 0 3
+BITMAP
+F8
+F8
+ENDCHAR
+STARTCHAR registered
+ENCODING 174
+SWIDTH 747 0
+DWIDTH 15 0
+BBX 13 13 1 0
+BITMAP
+0F80
+38E0
+6030
+5F90
+CCD8
+8CC8
+8F88
+8D88
+CCD8
+5EF0
+6030
+38E0
+0F80
+ENDCHAR
+STARTCHAR macron
+ENCODING 175
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 5 1 1 11
+BITMAP
+F8
+ENDCHAR
+STARTCHAR degree
+ENCODING 176
+SWIDTH 400 0
+DWIDTH 7 0
+BBX 6 5 1 8
+BITMAP
+78
+CC
+CC
+CC
+78
+ENDCHAR
+STARTCHAR plusminus
+ENCODING 177
+SWIDTH 570 0
+DWIDTH 10 0
+BBX 8 11 1 0
+BITMAP
+18
+18
+18
+FF
+FF
+18
+18
+18
+00
+FF
+FF
+ENDCHAR
+STARTCHAR twosuperior
+ENCODING 178
+SWIDTH 300 0
+DWIDTH 5 0
+BBX 6 8 -1 5
+BITMAP
+38
+4C
+0C
+18
+10
+20
+64
+F8
+ENDCHAR
+STARTCHAR threesuperior
+ENCODING 179
+SWIDTH 300 0
+DWIDTH 5 0
+BBX 6 8 0 5
+BITMAP
+38
+4C
+18
+30
+18
+18
+B0
+E0
+ENDCHAR
+STARTCHAR acute
+ENCODING 180
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 5 3 1 10
+BITMAP
+38
+70
+C0
+ENDCHAR
+STARTCHAR mu
+ENCODING 181
+SWIDTH 576 0
+DWIDTH 10 0
+BBX 12 12 -2 -4
+BITMAP
+3CE0
+1CE0
+1CC0
+19C0
+39C0
+3BC0
+3ED0
+7CE0
+6000
+4000
+E000
+6000
+ENDCHAR
+STARTCHAR paragraph
+ENCODING 182
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 9 17 1 -4
+BITMAP
+0F80
+3D00
+7D00
+FA00
+FA00
+FA00
+FA00
+7400
+1400
+1400
+2800
+2800
+2800
+2800
+5000
+5000
+5000
+ENDCHAR
+STARTCHAR periodcentered
+ENCODING 183
+SWIDTH 250 0
+DWIDTH 5 0
+BBX 3 2 1 4
+BITMAP
+E0
+E0
+ENDCHAR
+STARTCHAR cedilla
+ENCODING 184
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 5 4 -1 -4
+BITMAP
+30
+38
+98
+70
+ENDCHAR
+STARTCHAR onesuperior
+ENCODING 185
+SWIDTH 300 0
+DWIDTH 5 0
+BBX 4 8 0 5
+BITMAP
+10
+70
+30
+30
+60
+60
+60
+F0
+ENDCHAR
+STARTCHAR ordmasculine
+ENCODING 186
+SWIDTH 300 0
+DWIDTH 7 0
+BBX 7 7 0 5
+BITMAP
+1C
+36
+66
+6C
+38
+00
+F8
+ENDCHAR
+STARTCHAR guillemotright
+ENCODING 187
+SWIDTH 500 0
+DWIDTH 11 0
+BBX 9 8 1 0
+BITMAP
+4400
+6600
+3300
+1980
+3300
+6600
+CC00
+8800
+ENDCHAR
+STARTCHAR onequarter
+ENCODING 188
+SWIDTH 750 0
+DWIDTH 13 0
+BBX 12 13 0 0
+BITMAP
+1060
+70C0
+30C0
+3180
+6180
+6330
+6270
+F6E0
+0CA0
+0D60
+1BF0
+18C0
+30C0
+ENDCHAR
+STARTCHAR onehalf
+ENCODING 189
+SWIDTH 750 0
+DWIDTH 13 0
+BBX 13 13 0 0
+BITMAP
+1060
+70C0
+30C0
+3180
+6180
+6370
+6298
+F618
+0C30
+0C20
+1840
+18C8
+31F0
+ENDCHAR
+STARTCHAR threequarters
+ENCODING 190
+SWIDTH 750 0
+DWIDTH 13 0
+BBX 12 13 0 0
+BITMAP
+3860
+4CC0
+18C0
+3180
+1980
+1B30
+B270
+E6E0
+0CA0
+0D60
+1BF0
+18C0
+30C0
+ENDCHAR
+STARTCHAR questiondown
+ENCODING 191
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 7 13 0 -4
+BITMAP
+06
+06
+00
+04
+0C
+0C
+18
+78
+F0
+E0
+CC
+CC
+78
+ENDCHAR
+STARTCHAR Agrave
+ENCODING 192
+SWIDTH 667 0
+DWIDTH 13 0
+BBX 14 17 -1 0
+BITMAP
+0700
+0380
+0040
+0000
+00C0
+01C0
+01C0
+03E0
+02E0
+0660
+0C70
+0C70
+1FF0
+1870
+3038
+7038
+F87C
+ENDCHAR
+STARTCHAR Aacute
+ENCODING 193
+SWIDTH 667 0
+DWIDTH 13 0
+BBX 14 17 -1 0
+BITMAP
+0038
+0070
+0080
+0000
+00C0
+01C0
+01C0
+03E0
+02E0
+0660
+0C70
+0C70
+1FF0
+1870
+3038
+7038
+F87C
+ENDCHAR
+STARTCHAR Acircumflex
+ENCODING 194
+SWIDTH 667 0
+DWIDTH 13 0
+BBX 14 17 -1 0
+BITMAP
+00C0
+01E0
+0210
+0000
+00C0
+01C0
+01C0
+03E0
+02E0
+0660
+0C70
+0C70
+1FF0
+1870
+3038
+7038
+F87C
+ENDCHAR
+STARTCHAR Atilde
+ENCODING 195
+SWIDTH 667 0
+DWIDTH 13 0
+BBX 14 16 -1 0
+BITMAP
+01D0
+02E0
+0000
+00C0
+01C0
+01C0
+03E0
+02E0
+0660
+0C70
+0C70
+1FF0
+1870
+3038
+7038
+F87C
+ENDCHAR
+STARTCHAR Adieresis
+ENCODING 196
+SWIDTH 667 0
+DWIDTH 13 0
+BBX 14 16 -1 0
+BITMAP
+0330
+0330
+0000
+00C0
+01C0
+01C0
+03E0
+02E0
+0660
+0C70
+0C70
+1FF0
+1870
+3038
+7038
+F87C
+ENDCHAR
+STARTCHAR Aring
+ENCODING 197
+SWIDTH 667 0
+DWIDTH 13 0
+BBX 14 17 -1 0
+BITMAP
+00C0
+0120
+0120
+00C0
+00C0
+01C0
+01C0
+03E0
+02E0
+0660
+0C70
+0C70
+1FF0
+1870
+3038
+7038
+F87C
+ENDCHAR
+STARTCHAR AE
+ENCODING 198
+SWIDTH 944 0
+DWIDTH 18 0
+BBX 19 13 -1 0
+BITMAP
+01FFE0
+00F8E0
+01B840
+033840
+033100
+067300
+0C7F00
+0C7300
+1FE200
+18E040
+30E0C0
+70E1C0
+F9FF80
+ENDCHAR
+STARTCHAR Ccedilla
+ENCODING 199
+SWIDTH 667 0
+DWIDTH 13 0
+BBX 12 17 1 -4
+BITMAP
+07D0
+1E70
+3830
+7030
+7000
+6000
+E000
+E000
+E000
+F000
+7060
+7DC0
+1F00
+0600
+0700
+1300
+0E00
+ENDCHAR
+STARTCHAR Egrave
+ENCODING 200
+SWIDTH 667 0
+DWIDTH 12 0
+BBX 12 17 0 0
+BITMAP
+1C00
+0E00
+0100
+0000
+3FF0
+1C70
+1C20
+1C20
+3880
+3980
+3F80
+3980
+3100
+7020
+7060
+70E0
+FFC0
+ENDCHAR
+STARTCHAR Eacute
+ENCODING 201
+SWIDTH 667 0
+DWIDTH 12 0
+BBX 12 17 0 0
+BITMAP
+00E0
+01C0
+0200
+0000
+3FF0
+1C70
+1C20
+1C20
+3880
+3980
+3F80
+3980
+3100
+7020
+7060
+70E0
+FFC0
+ENDCHAR
+STARTCHAR Ecircumflex
+ENCODING 202
+SWIDTH 667 0
+DWIDTH 12 0
+BBX 12 17 0 0
+BITMAP
+0180
+03C0
+0420
+0000
+3FF0
+1C70
+1C20
+1C20
+3880
+3980
+3F80
+3980
+3100
+7020
+7060
+70E0
+FFC0
+ENDCHAR
+STARTCHAR Edieresis
+ENCODING 203
+SWIDTH 667 0
+DWIDTH 12 0
+BBX 12 16 0 0
+BITMAP
+0660
+0660
+0000
+3FF0
+1C70
+1C20
+1C20
+3880
+3980
+3F80
+3980
+3100
+7020
+7060
+70E0
+FFC0
+ENDCHAR
+STARTCHAR Igrave
+ENCODING 204
+SWIDTH 389 0
+DWIDTH 7 0
+BBX 7 17 0 0
+BITMAP
+70
+38
+04
+00
+3E
+1C
+1C
+1C
+38
+38
+38
+38
+70
+70
+70
+70
+F8
+ENDCHAR
+STARTCHAR Iacute
+ENCODING 205
+SWIDTH 389 0
+DWIDTH 7 0
+BBX 8 17 0 0
+BITMAP
+07
+0E
+10
+00
+3E
+1C
+1C
+1C
+38
+38
+38
+38
+70
+70
+70
+70
+F8
+ENDCHAR
+STARTCHAR Icircumflex
+ENCODING 206
+SWIDTH 389 0
+DWIDTH 7 0
+BBX 8 17 0 0
+BITMAP
+0C
+1E
+21
+00
+3E
+1C
+1C
+1C
+38
+38
+38
+38
+70
+70
+70
+70
+F8
+ENDCHAR
+STARTCHAR Idieresis
+ENCODING 207
+SWIDTH 389 0
+DWIDTH 7 0
+BBX 8 16 0 0
+BITMAP
+33
+33
+00
+3E
+1C
+1C
+1C
+38
+38
+38
+38
+70
+70
+70
+70
+F8
+ENDCHAR
+STARTCHAR Eth
+ENCODING 208
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 13 13 0 0
+BITMAP
+3F80
+1DE0
+1C70
+1C70
+3838
+FF38
+FF38
+3838
+7070
+70F0
+70E0
+73C0
+FF00
+ENDCHAR
+STARTCHAR Ntilde
+ENCODING 209
+SWIDTH 722 0
+DWIDTH 13 0
+BBX 16 16 -1 0
+BITMAP
+01D0
+02E0
+0000
+3C1F
+1C0E
+1E0C
+1E0C
+1B18
+3398
+3398
+31D8
+31D0
+60F0
+60F0
+6060
+F060
+ENDCHAR
+STARTCHAR Ograve
+ENCODING 210
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 12 17 1 0
+BITMAP
+0E00
+0700
+0080
+0000
+07C0
+1EE0
+3870
+7070
+7070
+E070
+E070
+E070
+E0E0
+E0E0
+E1C0
+7780
+3E00
+ENDCHAR
+STARTCHAR Oacute
+ENCODING 211
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 12 17 1 0
+BITMAP
+0070
+00E0
+0100
+0000
+07C0
+1EE0
+3870
+7070
+7070
+E070
+E070
+E070
+E0E0
+E0E0
+E1C0
+7780
+3E00
+ENDCHAR
+STARTCHAR Ocircumflex
+ENCODING 212
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 12 17 1 0
+BITMAP
+0180
+03C0
+0420
+0000
+07C0
+1EE0
+3870
+7070
+7070
+E070
+E070
+E070
+E0E0
+E0E0
+E1C0
+7780
+3E00
+ENDCHAR
+STARTCHAR Otilde
+ENCODING 213
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 12 16 1 0
+BITMAP
+03A0
+05C0
+0000
+07C0
+1EE0
+3870
+7070
+7070
+E070
+E070
+E070
+E0E0
+E0E0
+E1C0
+7780
+3E00
+ENDCHAR
+STARTCHAR Odieresis
+ENCODING 214
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 12 16 1 0
+BITMAP
+0660
+0660
+0000
+07C0
+1EE0
+3870
+7070
+7070
+E070
+E070
+E070
+E0E0
+E0E0
+E1C0
+7780
+3E00
+ENDCHAR
+STARTCHAR multiply
+ENCODING 215
+SWIDTH 570 0
+DWIDTH 10 0
+BBX 9 8 0 1
+BITMAP
+C180
+6300
+3600
+1C00
+1C00
+3600
+6300
+C180
+ENDCHAR
+STARTCHAR Oslash
+ENCODING 216
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 13 15 1 -1
+BITMAP
+0018
+07F0
+1EE0
+38F0
+71F0
+7170
+E370
+E670
+EC70
+E8E0
+F8E0
+F1C0
+7780
+7E00
+C000
+ENDCHAR
+STARTCHAR Ugrave
+ENCODING 217
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 14 17 1 0
+BITMAP
+0E00
+0700
+0080
+0000
+7E7C
+3838
+3830
+7830
+7060
+7060
+7060
+F060
+E0C0
+E0C0
+E0C0
+F180
+7F00
+ENDCHAR
+STARTCHAR Uacute
+ENCODING 218
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 14 17 1 0
+BITMAP
+0070
+00E0
+0100
+0000
+7E7C
+3838
+3830
+7830
+7060
+7060
+7060
+F060
+E0C0
+E0C0
+E0C0
+F180
+7F00
+ENDCHAR
+STARTCHAR Ucircumflex
+ENCODING 219
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 14 17 1 0
+BITMAP
+0180
+03C0
+0420
+0000
+7E7C
+3838
+3830
+7830
+7060
+7060
+7060
+F060
+E0C0
+E0C0
+E0C0
+F180
+7F00
+ENDCHAR
+STARTCHAR Udieresis
+ENCODING 220
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 14 16 1 0
+BITMAP
+0660
+0660
+0000
+7E7C
+3838
+3830
+7830
+7060
+7060
+7060
+F060
+E0C0
+E0C0
+E0C0
+F180
+7F00
+ENDCHAR
+STARTCHAR Yacute
+ENCODING 221
+SWIDTH 611 0
+DWIDTH 11 0
+BBX 12 17 0 0
+BITMAP
+01C0
+0380
+0400
+0000
+F8F0
+7060
+70C0
+3980
+3B00
+1E00
+1C00
+1C00
+1C00
+3800
+3800
+3800
+FE00
+ENDCHAR
+STARTCHAR Thorn
+ENCODING 222
+SWIDTH 611 0
+DWIDTH 11 0
+BBX 11 13 0 0
+BITMAP
+3E00
+1C00
+1C00
+1FC0
+39E0
+38E0
+38E0
+38E0
+31C0
+7F80
+7000
+7000
+F800
+ENDCHAR
+STARTCHAR germandbls
+ENCODING 223
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 12 17 -2 -4
+BITMAP
+01E0
+0370
+0670
+0670
+06E0
+0E80
+0EC0
+0CE0
+0CE0
+1CE0
+1CE0
+19C0
+1B80
+1800
+D800
+D800
+7000
+ENDCHAR
+STARTCHAR agrave
+ENCODING 224
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 10 12 0 0
+BITMAP
+3800
+1C00
+0200
+0000
+1E80
+7B80
+7380
+E300
+E700
+E700
+EF40
+3B80
+ENDCHAR
+STARTCHAR aacute
+ENCODING 225
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 10 12 0 0
+BITMAP
+0380
+0700
+0800
+0000
+1E80
+7B80
+7380
+E300
+E700
+E700
+EF40
+3B80
+ENDCHAR
+STARTCHAR acircumflex
+ENCODING 226
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 10 12 0 0
+BITMAP
+0600
+0F00
+1080
+0000
+1E80
+7B80
+7380
+E300
+E700
+E700
+EF40
+3B80
+ENDCHAR
+STARTCHAR atilde
+ENCODING 227
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 10 11 0 0
+BITMAP
+0E80
+1700
+0000
+1E80
+7B80
+7380
+E300
+E700
+E700
+EF40
+3B80
+ENDCHAR
+STARTCHAR adieresis
+ENCODING 228
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 10 11 0 0
+BITMAP
+1980
+1980
+0000
+1E80
+7B80
+7380
+E300
+E700
+E700
+EF40
+3B80
+ENDCHAR
+STARTCHAR aring
+ENCODING 229
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 10 13 0 0
+BITMAP
+0600
+0900
+0900
+0600
+0000
+1E80
+7B80
+7380
+E300
+E700
+E700
+EF40
+3B80
+ENDCHAR
+STARTCHAR ae
+ENCODING 230
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 13 8 0 0
+BITMAP
+1D70
+7BB8
+7338
+E370
+E7C0
+E718
+EFB0
+3BE0
+ENDCHAR
+STARTCHAR ccedilla
+ENCODING 231
+SWIDTH 444 0
+DWIDTH 8 0
+BBX 8 12 0 -4
+BITMAP
+1F
+7B
+60
+E0
+E0
+E0
+F6
+3C
+30
+18
+98
+F0
+ENDCHAR
+STARTCHAR egrave
+ENCODING 232
+SWIDTH 444 0
+DWIDTH 9 0
+BBX 8 12 0 0
+BITMAP
+38
+1C
+02
+00
+1E
+77
+67
+EE
+F8
+E3
+F6
+7C
+ENDCHAR
+STARTCHAR eacute
+ENCODING 233
+SWIDTH 444 0
+DWIDTH 9 0
+BBX 8 12 0 0
+BITMAP
+07
+0E
+10
+00
+1E
+77
+67
+EE
+F8
+E3
+F6
+7C
+ENDCHAR
+STARTCHAR ecircumflex
+ENCODING 234
+SWIDTH 444 0
+DWIDTH 9 0
+BBX 8 12 0 0
+BITMAP
+0C
+1E
+21
+00
+1E
+77
+67
+EE
+F8
+E3
+F6
+7C
+ENDCHAR
+STARTCHAR edieresis
+ENCODING 235
+SWIDTH 444 0
+DWIDTH 9 0
+BBX 8 11 0 0
+BITMAP
+33
+33
+00
+1E
+77
+67
+EE
+F8
+E3
+F6
+7C
+ENDCHAR
+STARTCHAR igrave
+ENCODING 236
+SWIDTH 278 0
+DWIDTH 5 0
+BBX 5 12 0 0
+BITMAP
+E0
+70
+08
+00
+F0
+70
+70
+60
+60
+E0
+F0
+60
+ENDCHAR
+STARTCHAR iacute
+ENCODING 237
+SWIDTH 278 0
+DWIDTH 5 0
+BBX 6 12 0 0
+BITMAP
+1C
+38
+40
+00
+F0
+70
+70
+60
+60
+E0
+F0
+60
+ENDCHAR
+STARTCHAR icircumflex
+ENCODING 238
+SWIDTH 278 0
+DWIDTH 5 0
+BBX 6 12 0 0
+BITMAP
+30
+78
+84
+00
+F0
+70
+70
+60
+60
+E0
+F0
+60
+ENDCHAR
+STARTCHAR idieresis
+ENCODING 239
+SWIDTH 278 0
+DWIDTH 5 0
+BBX 5 11 0 0
+BITMAP
+D8
+D8
+00
+F0
+70
+70
+60
+60
+E0
+F0
+60
+ENDCHAR
+STARTCHAR eth
+ENCODING 240
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 9 12 0 0
+BITMAP
+3000
+1B00
+1C00
+2600
+1F00
+7380
+6380
+E380
+E380
+E300
+E700
+7C00
+ENDCHAR
+STARTCHAR ntilde
+ENCODING 241
+SWIDTH 556 0
+DWIDTH 10 0
+BBX 10 11 0 0
+BITMAP
+1D00
+2E00
+0000
+F700
+7B80
+7380
+7380
+6300
+E700
+E740
+E780
+ENDCHAR
+STARTCHAR ograve
+ENCODING 242
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 9 12 0 0
+BITMAP
+3800
+1C00
+0200
+0000
+1F00
+7380
+6380
+E380
+E380
+E300
+E700
+7C00
+ENDCHAR
+STARTCHAR oacute
+ENCODING 243
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 9 12 0 0
+BITMAP
+0380
+0700
+0800
+0000
+1F00
+7380
+6380
+E380
+E380
+E300
+E700
+7C00
+ENDCHAR
+STARTCHAR ocircumflex
+ENCODING 244
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 9 12 0 0
+BITMAP
+0C00
+1E00
+2100
+0000
+1F00
+7380
+6380
+E380
+E380
+E300
+E700
+7C00
+ENDCHAR
+STARTCHAR otilde
+ENCODING 245
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 9 11 0 0
+BITMAP
+1D00
+2E00
+0000
+1F00
+7380
+6380
+E380
+E380
+E300
+E700
+7C00
+ENDCHAR
+STARTCHAR odieresis
+ENCODING 246
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 9 11 0 0
+BITMAP
+3300
+3300
+0000
+1F00
+7380
+6380
+E380
+E380
+E300
+E700
+7C00
+ENDCHAR
+STARTCHAR divide
+ENCODING 247
+SWIDTH 570 0
+DWIDTH 10 0
+BBX 8 8 1 1
+BITMAP
+18
+18
+00
+FF
+FF
+00
+18
+18
+ENDCHAR
+STARTCHAR oslash
+ENCODING 248
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 9 12 0 -2
+BITMAP
+0180
+0300
+1F00
+7780
+6D80
+E980
+CB80
+D300
+F700
+7C00
+6000
+C000
+ENDCHAR
+STARTCHAR ugrave
+ENCODING 249
+SWIDTH 556 0
+DWIDTH 10 0
+BBX 10 12 0 0
+BITMAP
+7000
+3800
+0400
+0000
+F380
+7380
+7300
+6700
+E700
+EF00
+FB40
+7380
+ENDCHAR
+STARTCHAR uacute
+ENCODING 250
+SWIDTH 556 0
+DWIDTH 10 0
+BBX 10 12 0 0
+BITMAP
+0380
+0700
+0800
+0000
+F380
+7380
+7300
+6700
+E700
+EF00
+FB40
+7380
+ENDCHAR
+STARTCHAR ucircumflex
+ENCODING 251
+SWIDTH 556 0
+DWIDTH 10 0
+BBX 10 12 0 0
+BITMAP
+0C00
+1E00
+2100
+0000
+F380
+7380
+7300
+6700
+E700
+EF00
+FB40
+7380
+ENDCHAR
+STARTCHAR udieresis
+ENCODING 252
+SWIDTH 556 0
+DWIDTH 10 0
+BBX 10 11 0 0
+BITMAP
+3300
+3300
+0000
+F380
+7380
+7300
+6700
+E700
+EF00
+FB40
+7380
+ENDCHAR
+STARTCHAR yacute
+ENCODING 253
+SWIDTH 444 0
+DWIDTH 7 0
+BBX 10 16 -2 -4
+BITMAP
+01C0
+0380
+0400
+0000
+7B80
+3980
+3980
+3900
+1B00
+1E00
+1E00
+0C00
+0C00
+C800
+D800
+7000
+ENDCHAR
+STARTCHAR thorn
+ENCODING 254
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 11 17 -2 -4
+BITMAP
+1E00
+0E00
+0E00
+0C00
+0C00
+1DC0
+1EE0
+1CE0
+1CE0
+38E0
+39C0
+3980
+3700
+3000
+7000
+7000
+F800
+ENDCHAR
+STARTCHAR ydieresis
+ENCODING 255
+SWIDTH 444 0
+DWIDTH 7 0
+BBX 9 15 -2 -4
+BITMAP
+3300
+3300
+0000
+7B80
+3980
+3980
+3900
+1B00
+1E00
+1E00
+0C00
+0C00
+C800
+D800
+7000
+ENDCHAR
+STARTCHAR Lslash
+ENCODING -1
+SWIDTH 611 0
+DWIDTH 11 0
+BBX 11 13 0 0
+BITMAP
+3E00
+1C00
+1C00
+1800
+3A00
+3C00
+3800
+7000
+B000
+7060
+7060
+71C0
+FFC0
+ENDCHAR
+STARTCHAR OE
+ENCODING -1
+SWIDTH 944 0
+DWIDTH 18 0
+BBX 18 13 0 0
+BITMAP
+07FFC0
+1E71C0
+387080
+707080
+706200
+E0E600
+E0FE00
+E0E600
+E0C400
+E1C080
+71C180
+73C380
+1FFF00
+ENDCHAR
+STARTCHAR Scaron
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 11 0
+BBX 10 17 0 0
+BITMAP
+0840
+0780
+0300
+0000
+0F40
+1DC0
+38C0
+3840
+3C00
+1E00
+0F00
+0F80
+0780
+C380
+C380
+E700
+FE00
+ENDCHAR
+STARTCHAR Ydieresis
+ENCODING -1
+SWIDTH 611 0
+DWIDTH 11 0
+BBX 12 16 0 0
+BITMAP
+0CC0
+0CC0
+0000
+F8F0
+7060
+70C0
+3980
+3B00
+1E00
+1C00
+1C00
+1C00
+3800
+3800
+3800
+FE00
+ENDCHAR
+STARTCHAR Zcaron
+ENCODING -1
+SWIDTH 611 0
+DWIDTH 11 0
+BBX 13 17 -1 0
+BITMAP
+0420
+03C0
+0180
+0000
+1FF8
+38F0
+20E0
+01C0
+0380
+0700
+0F00
+0E00
+1C00
+3820
+7060
+F0E0
+FFC0
+ENDCHAR
+STARTCHAR breve
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 5 3 1 9
+BITMAP
+88
+F8
+70
+ENDCHAR
+STARTCHAR bullet
+ENCODING -1
+SWIDTH 350 0
+DWIDTH 7 0
+BBX 5 5 1 3
+BITMAP
+70
+F8
+F8
+F8
+70
+ENDCHAR
+STARTCHAR caron
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 6 3 1 9
+BITMAP
+84
+78
+30
+ENDCHAR
+STARTCHAR circumflex
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 6 3 1 9
+BITMAP
+30
+78
+84
+ENDCHAR
+STARTCHAR dagger
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 8 16 0 -2
+BITMAP
+0C
+0C
+08
+08
+FF
+CB
+08
+18
+18
+18
+10
+30
+30
+20
+20
+20
+ENDCHAR
+STARTCHAR daggerdbl
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 10 0
+BBX 9 16 0 -2
+BITMAP
+0600
+0600
+0400
+0400
+7F80
+6580
+0C00
+0C00
+0800
+0800
+FF00
+D300
+1000
+1000
+3000
+3000
+ENDCHAR
+STARTCHAR dotaccent
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 2 2 2 9
+BITMAP
+C0
+C0
+ENDCHAR
+STARTCHAR dotlessi
+ENCODING -1
+SWIDTH 278 0
+DWIDTH 5 0
+BBX 5 8 0 0
+BITMAP
+F0
+70
+70
+60
+60
+E0
+E8
+70
+ENDCHAR
+STARTCHAR ellipsis
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 18 0
+BBX 15 2 1 0
+BITMAP
+E38E
+E38E
+ENDCHAR
+STARTCHAR emdash
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 19 0
+BBX 19 2 0 4
+BITMAP
+FFFFE0
+FFFFE0
+ENDCHAR
+STARTCHAR endash
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 9 2 0 4
+BITMAP
+FF80
+FF80
+ENDCHAR
+STARTCHAR fi
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 10 0
+BBX 12 17 -2 -4
+BITMAP
+03F0
+0730
+0630
+0E00
+0E00
+3FE0
+0E60
+0EE0
+0CC0
+1CC0
+1DC0
+1DE0
+1CC0
+1800
+D800
+D800
+7000
+ENDCHAR
+STARTCHAR fl
+ENCODING -1
+SWIDTH 556 0
+DWIDTH 10 0
+BBX 12 17 -2 -4
+BITMAP
+03F0
+0770
+0670
+0E60
+0E60
+3FE0
+0EE0
+0EE0
+0CC0
+1CC0
+1DC0
+1DE0
+1CC0
+1800
+D800
+D800
+7000
+ENDCHAR
+STARTCHAR florin
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 10 17 -1 -4
+BITMAP
+03C0
+06C0
+0600
+0600
+0E00
+3F80
+0E00
+0E00
+0C00
+0C00
+1C00
+1C00
+1800
+1800
+D800
+D800
+7000
+ENDCHAR
+STARTCHAR fraction
+ENCODING -1
+SWIDTH 167 0
+DWIDTH 7 0
+BBX 9 13 -1 0
+BITMAP
+0180
+0300
+0300
+0600
+0600
+0C00
+1800
+1800
+3000
+3000
+6000
+6000
+C000
+ENDCHAR
+STARTCHAR grave
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 5 3 1 10
+BITMAP
+E0
+70
+18
+ENDCHAR
+STARTCHAR guilsinglleft
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 5 8 0 0
+BITMAP
+08
+18
+30
+60
+C0
+60
+30
+10
+ENDCHAR
+STARTCHAR guilsinglright
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 7 0
+BBX 5 8 1 0
+BITMAP
+40
+60
+30
+18
+30
+60
+C0
+80
+ENDCHAR
+STARTCHAR hungarumlaut
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 8 0
+BBX 8 3 1 10
+BITMAP
+77
+66
+CC
+ENDCHAR
+STARTCHAR lslash
+ENCODING -1
+SWIDTH 278 0
+DWIDTH 6 0
+BBX 7 13 0 0
+BITMAP
+3C
+1C
+1C
+18
+3A
+3C
+78
+B8
+30
+70
+70
+74
+38
+ENDCHAR
+STARTCHAR oe
+ENCODING -1
+SWIDTH 722 0
+DWIDTH 14 0
+BBX 13 8 0 0
+BITMAP
+1EF0
+73B8
+6338
+E370
+E3C0
+E318
+E7B0
+7DE0
+ENDCHAR
+STARTCHAR ogonek
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 5 4 0 -4
+BITMAP
+60
+C0
+D8
+70
+ENDCHAR
+STARTCHAR perthousand
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 20 0
+BBX 19 13 0 0
+BITMAP
+3CC000
+778000
+E58000
+CD0000
+DB0000
+720000
+060000
+04E1C0
+0DD3A0
+0B9720
+1B3660
+1366C0
+31C380
+ENDCHAR
+STARTCHAR quotedblbase
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 7 5 0 -3
+BITMAP
+EE
+EE
+66
+44
+88
+ENDCHAR
+STARTCHAR quotedblleft
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 7 5 1 8
+BITMAP
+22
+44
+CC
+EE
+EE
+ENDCHAR
+STARTCHAR quotedblright
+ENCODING -1
+SWIDTH 500 0
+DWIDTH 9 0
+BBX 7 5 2 8
+BITMAP
+EE
+EE
+66
+44
+88
+ENDCHAR
+STARTCHAR quotesinglbase
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 3 5 1 -3
+BITMAP
+E0
+E0
+60
+40
+80
+ENDCHAR
+STARTCHAR quotesingle
+ENCODING -1
+SWIDTH 278 0
+DWIDTH 5 0
+BBX 4 5 1 8
+BITMAP
+70
+60
+C0
+C0
+80
+ENDCHAR
+STARTCHAR ring
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 4 4 1 9
+BITMAP
+60
+90
+90
+60
+ENDCHAR
+STARTCHAR scaron
+ENCODING -1
+SWIDTH 389 0
+DWIDTH 7 0
+BBX 8 12 -1 0
+BITMAP
+21
+1E
+0C
+00
+3E
+77
+72
+38
+1C
+4E
+EE
+7C
+ENDCHAR
+STARTCHAR tilde
+ENCODING -1
+SWIDTH 333 0
+DWIDTH 6 0
+BBX 6 2 1 9
+BITMAP
+74
+B8
+ENDCHAR
+STARTCHAR trademark
+ENCODING -1
+SWIDTH 1000 0
+DWIDTH 19 0
+BBX 17 7 1 6
+BITMAP
+FEC180
+926300
+106300
+105500
+105D00
+104900
+38C980
+ENDCHAR
+STARTCHAR zcaron
+ENCODING -1
+SWIDTH 389 0
+DWIDTH 7 0
+BBX 8 13 0 -1
+BITMAP
+21
+1E
+0C
+00
+3E
+7E
+4C
+18
+30
+60
+E6
+F6
+1C
+ENDCHAR
+ENDFONT
diff -urN lib/microwindows/src/fonts/winFreeSansSerif11x13.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/winFreeSansSerif11x13.c
--- lib/microwindows/src/fonts/winFreeSansSerif11x13.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/winFreeSansSerif11x13.c	2005-02-21 16:03:27.000000000 +0100
@@ -0,0 +1,7427 @@
+/* Generated by convfnt.exe*/
+#include "device.h"
+
+/* Windows FreeSansSerif 11x13 Font */
+
+/*
+ * #FONTRES 100,96,96:Free Sans Serif 8
+ * Distributed under the MPL (c) 1999 darran@rimron.co.uk v0.3 
+ * Free Sans Serif
+ */
+
+static MWIMAGEBITS winFreeSansSerif11x13_bits[] = {
+
+/* Character   (0x20):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ! (0x21):
+   ht=13, width=3
+   +---+
+   |   |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   |   |
+   |   |
+   | * |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character " (0x22):
+   ht=13, width=5
+   +-----+
+   |     |
+   | *  *|
+   | *  *|
+   | *  *|
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x4800,
+0x4800,
+0x4800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character # (0x23):
+   ht=13, width=7
+   +-------+
+   |       |
+   |  *  * |
+   |  *  * |
+   | ******|
+   |  *  * |
+   |  *  * |
+   |  *  * |
+   |  *  * |
+   | ******|
+   |  *  * |
+   |  *  * |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x2400,
+0x2400,
+0x7e00,
+0x2400,
+0x2400,
+0x2400,
+0x2400,
+0x7e00,
+0x2400,
+0x2400,
+0x0000,
+0x0000,
+
+/* Character $ (0x24):
+   ht=13, width=6
+   +------+
+   |      |
+   |   *  |
+   |  *** |
+   | * * *|
+   | * *  |
+   |  **  |
+   |   ** |
+   |   * *|
+   | * * *|
+   |  *** |
+   |   *  |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x1000,
+0x3800,
+0x5400,
+0x5000,
+0x3000,
+0x1800,
+0x1400,
+0x5400,
+0x3800,
+0x1000,
+0x0000,
+0x0000,
+
+/* Character % (0x25):
+   ht=13, width=8
+   +--------+
+   |        |
+   |  **    |
+   | *  *   |
+   | *  *  *|
+   |  **  * |
+   |     *  |
+   |    *   |
+   |   * ** |
+   |  * *  *|
+   | *  *  *|
+   |     ** |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x3000,
+0x4800,
+0x4900,
+0x3200,
+0x0400,
+0x0800,
+0x1600,
+0x2900,
+0x4900,
+0x0600,
+0x0000,
+0x0000,
+
+/* Character & (0x26):
+   ht=13, width=6
+   +------+
+   |      |
+   |  *   |
+   | * *  |
+   | * *  |
+   |  *   |
+   |  *   |
+   | * * *|
+   | *  * |
+   | *  * |
+   | *  * |
+   |  ** *|
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x2000,
+0x5000,
+0x5000,
+0x2000,
+0x2000,
+0x5400,
+0x4800,
+0x4800,
+0x4800,
+0x3400,
+0x0000,
+0x0000,
+
+/* Character ' (0x27):
+   ht=13, width=2
+   +--+
+   |  |
+   | *|
+   | *|
+   | *|
+   |  |
+   |  |
+   |  |
+   |  |
+   |  |
+   |  |
+   |  |
+   |  |
+   |  |
+   +--+ */
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ( (0x28):
+   ht=13, width=3
+   +---+
+   |   |
+   |  *|
+   | **|
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | **|
+   |  *|
+   |   |
+   +---+ */
+0x0000,
+0x2000,
+0x6000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x6000,
+0x2000,
+0x0000,
+
+/* Character ) (0x29):
+   ht=13, width=3
+   +---+
+   |   |
+   | * |
+   | **|
+   |  *|
+   |  *|
+   |  *|
+   |  *|
+   |  *|
+   |  *|
+   |  *|
+   | **|
+   | * |
+   |   |
+   +---+ */
+0x0000,
+0x4000,
+0x6000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x6000,
+0x4000,
+0x0000,
+
+/* Character * (0x2a):
+   ht=13, width=4
+   +----+
+   |    |
+   |    |
+   |*  *|
+   | ** |
+   |****|
+   | ** |
+   |*  *|
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x9000,
+0x6000,
+0xf000,
+0x6000,
+0x9000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character + (0x2b):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |   *  |
+   |   *  |
+   | ** **|
+   |   *  |
+   |   *  |
+   |      |
+   |      |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1000,
+0x1000,
+0x6c00,
+0x1000,
+0x1000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character , (0x2c):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |  *|
+   |  *|
+   | * |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x2000,
+0x2000,
+0x4000,
+0x0000,
+
+/* Character - (0x2d):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   | **|
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character . (0x2e):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   | * |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character / (0x2f):
+   ht=13, width=5
+   +-----+
+   |     |
+   |    *|
+   |    *|
+   |    *|
+   |   * |
+   |   * |
+   |  *  |
+   |  *  |
+   | *   |
+   | *   |
+   | *   |
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x0800,
+0x0800,
+0x0800,
+0x1000,
+0x1000,
+0x2000,
+0x2000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character 0 (0x30):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character 1 (0x31):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |   *  |
+   | ***  |
+   |   *  |
+   |   *  |
+   |   *  |
+   |   *  |
+   |   *  |
+   |   *  |
+   |   *  |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x1000,
+0x7000,
+0x1000,
+0x1000,
+0x1000,
+0x1000,
+0x1000,
+0x1000,
+0x1000,
+0x0000,
+0x0000,
+
+/* Character 2 (0x32):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   |     *|
+   |     *|
+   |    * |
+   |   *  |
+   |  *   |
+   | *****|
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x0400,
+0x0400,
+0x0800,
+0x1000,
+0x2000,
+0x7c00,
+0x0000,
+0x0000,
+
+/* Character 3 (0x33):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   |     *|
+   |   ** |
+   |     *|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x0400,
+0x1800,
+0x0400,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character 4 (0x34):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   | *  * |
+   | *  * |
+   | *  * |
+   | *  * |
+   | *  * |
+   | *****|
+   |    * |
+   |    * |
+   |    * |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x4800,
+0x4800,
+0x4800,
+0x4800,
+0x4800,
+0x7c00,
+0x0800,
+0x0800,
+0x0800,
+0x0000,
+0x0000,
+
+/* Character 5 (0x35):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   | *****|
+   | *    |
+   | *    |
+   | *    |
+   | **** |
+   |     *|
+   |     *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x7c00,
+0x4000,
+0x4000,
+0x4000,
+0x7800,
+0x0400,
+0x0400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character 6 (0x36):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | *    |
+   | *    |
+   | **** |
+   | *   *|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4000,
+0x4000,
+0x7800,
+0x4400,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character 7 (0x37):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   | *****|
+   |     *|
+   |    * |
+   |    * |
+   |   *  |
+   |   *  |
+   |  *   |
+   |  *   |
+   |  *   |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x7c00,
+0x0400,
+0x0800,
+0x0800,
+0x1000,
+0x1000,
+0x2000,
+0x2000,
+0x2000,
+0x0000,
+0x0000,
+
+/* Character 8 (0x38):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   | *   *|
+   |  *** |
+   | *   *|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x4400,
+0x3800,
+0x4400,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character 9 (0x39):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   | *   *|
+   |  *** |
+   |     *|
+   |     *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x4400,
+0x3800,
+0x0400,
+0x0400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character : (0x3a):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   |   |
+   | * |
+   |   |
+   |   |
+   |   |
+   |   |
+   | * |
+   |   |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x4000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x4000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ; (0x3b):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   |   |
+   |  *|
+   |   |
+   |   |
+   |   |
+   |   |
+   |  *|
+   | * |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x2000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x2000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character < (0x3c):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |    * |
+   |   *  |
+   |  *   |
+   | *    |
+   |  *   |
+   |   *  |
+   |    * |
+   |      |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0800,
+0x1000,
+0x2000,
+0x4000,
+0x2000,
+0x1000,
+0x0800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character = (0x3d):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   | *****|
+   |      |
+   | *****|
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7c00,
+0x0000,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character > (0x3e):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   | *    |
+   |  *   |
+   |   *  |
+   |    * |
+   |   *  |
+   |  *   |
+   | *    |
+   |      |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x4000,
+0x2000,
+0x1000,
+0x0800,
+0x1000,
+0x2000,
+0x4000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ? (0x3f):
+   ht=13, width=6
+   +------+
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   |     *|
+   |     *|
+   |    * |
+   |   *  |
+   |   *  |
+   |      |
+   |   *  |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x0400,
+0x0400,
+0x0800,
+0x1000,
+0x1000,
+0x0000,
+0x1000,
+0x0000,
+0x0000,
+
+/* Character @ (0x40):
+   ht=13, width=11
+   +-----------+
+   |           |
+   |    ****   |
+   |  **    ** |
+   |  *      * |
+   | *   ***  *|
+   | *  *  *  *|
+   | *  *  *  *|
+   | *   ** ***|
+   |  *        |
+   |  *        |
+   |   ******  |
+   |           |
+   |           |
+   +-----------+ */
+0x0000,
+0x0f00,
+0x30c0,
+0x2040,
+0x4720,
+0x4920,
+0x4920,
+0x46e0,
+0x2000,
+0x2000,
+0x1f80,
+0x0000,
+0x0000,
+
+/* Character A (0x41):
+   ht=13, width=7
+   +-------+
+   |       |
+   |       |
+   |   *   |
+   |   *   |
+   |  * *  |
+   |  * *  |
+   | *   * |
+   | *   * |
+   | ***** |
+   |*     *|
+   |*     *|
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x1000,
+0x1000,
+0x2800,
+0x2800,
+0x4400,
+0x4400,
+0x7c00,
+0x8200,
+0x8200,
+0x0000,
+0x0000,
+
+/* Character B (0x42):
+   ht=13, width=7
+   +-------+
+   |       |
+   |       |
+   | ****  |
+   | *   * |
+   | *   * |
+   | *   * |
+   | ****  |
+   | *   * |
+   | *   * |
+   | *   * |
+   | ****  |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x7800,
+0x4400,
+0x4400,
+0x4400,
+0x7800,
+0x4400,
+0x4400,
+0x4400,
+0x7800,
+0x0000,
+0x0000,
+
+/* Character C (0x43):
+   ht=13, width=7
+   +-------+
+   |       |
+   |       |
+   |  **** |
+   | *    *|
+   | *    *|
+   | *     |
+   | *     |
+   | *     |
+   | *    *|
+   | *    *|
+   |  **** |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x4200,
+0x4200,
+0x4000,
+0x4000,
+0x4000,
+0x4200,
+0x4200,
+0x3c00,
+0x0000,
+0x0000,
+
+/* Character D (0x44):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   |  *   * |
+   |  *    *|
+   |  *    *|
+   |  *    *|
+   |  *    *|
+   |  *    *|
+   |  *   * |
+   |  ****  |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x2200,
+0x2100,
+0x2100,
+0x2100,
+0x2100,
+0x2100,
+0x2200,
+0x3c00,
+0x0000,
+0x0000,
+
+/* Character E (0x45):
+   ht=13, width=7
+   +-------+
+   |       |
+   |       |
+   |  *****|
+   |  *    |
+   |  *    |
+   |  *    |
+   |  **** |
+   |  *    |
+   |  *    |
+   |  *    |
+   |  *****|
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x3e00,
+0x2000,
+0x2000,
+0x2000,
+0x3c00,
+0x2000,
+0x2000,
+0x2000,
+0x3e00,
+0x0000,
+0x0000,
+
+/* Character F (0x46):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   | *****|
+   | *    |
+   | *    |
+   | *    |
+   | *****|
+   | *    |
+   | *    |
+   | *    |
+   | *    |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x7c00,
+0x4000,
+0x4000,
+0x4000,
+0x7c00,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character G (0x47):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   |   **** |
+   |  *    *|
+   |  *     |
+   |  *     |
+   |  *  ***|
+   |  *    *|
+   |  *    *|
+   |  *   **|
+   |   *** *|
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1e00,
+0x2100,
+0x2000,
+0x2000,
+0x2700,
+0x2100,
+0x2100,
+0x2300,
+0x1d00,
+0x0000,
+0x0000,
+
+/* Character H (0x48):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   |  *    *|
+   |  *    *|
+   |  *    *|
+   |  *    *|
+   |  ******|
+   |  *    *|
+   |  *    *|
+   |  *    *|
+   |  *    *|
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x2100,
+0x2100,
+0x2100,
+0x2100,
+0x3f00,
+0x2100,
+0x2100,
+0x2100,
+0x2100,
+0x0000,
+0x0000,
+
+/* Character I (0x49):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character J (0x4a):
+   ht=13, width=5
+   +-----+
+   |     |
+   |     |
+   |    *|
+   |    *|
+   |    *|
+   |    *|
+   |    *|
+   |    *|
+   | *  *|
+   | *  *|
+   |  ** |
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x0000,
+0x0800,
+0x0800,
+0x0800,
+0x0800,
+0x0800,
+0x0800,
+0x4800,
+0x4800,
+0x3000,
+0x0000,
+0x0000,
+
+/* Character K (0x4b):
+   ht=13, width=7
+   +-------+
+   |       |
+   |       |
+   | *    *|
+   | *   * |
+   | *  *  |
+   | * *   |
+   | **    |
+   | * *   |
+   | *  *  |
+   | *   * |
+   | *    *|
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x4200,
+0x4400,
+0x4800,
+0x5000,
+0x6000,
+0x5000,
+0x4800,
+0x4400,
+0x4200,
+0x0000,
+0x0000,
+
+/* Character L (0x4c):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   | *    |
+   | *    |
+   | *    |
+   | *    |
+   | *    |
+   | *    |
+   | *    |
+   | *    |
+   | *****|
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x7c00,
+0x0000,
+0x0000,
+
+/* Character M (0x4d):
+   ht=13, width=9
+   +---------+
+   |         |
+   |         |
+   | *     * |
+   | **   ** |
+   | **   ** |
+   | * * * * |
+   | * * * * |
+   | *  *  * |
+   | *  *  * |
+   | *     * |
+   | *     * |
+   |         |
+   |         |
+   +---------+ */
+0x0000,
+0x0000,
+0x4100,
+0x6300,
+0x6300,
+0x5500,
+0x5500,
+0x4900,
+0x4900,
+0x4100,
+0x4100,
+0x0000,
+0x0000,
+
+/* Character N (0x4e):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   | *    * |
+   | **   * |
+   | **   * |
+   | * *  * |
+   | *  * * |
+   | *  * * |
+   | *   ** |
+   | *   ** |
+   | *    * |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x4200,
+0x6200,
+0x6200,
+0x5200,
+0x4a00,
+0x4a00,
+0x4600,
+0x4600,
+0x4200,
+0x0000,
+0x0000,
+
+/* Character O (0x4f):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   |  ****  |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x3c00,
+0x0000,
+0x0000,
+
+/* Character P (0x50):
+   ht=13, width=7
+   +-------+
+   |       |
+   |       |
+   | ***** |
+   | *    *|
+   | *    *|
+   | *    *|
+   | *    *|
+   | ***** |
+   | *     |
+   | *     |
+   | *     |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x7c00,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x7c00,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character Q (0x51):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *  * * |
+   | *   ** |
+   |  ****  |
+   |      * |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4a00,
+0x4600,
+0x3c00,
+0x0200,
+0x0000,
+
+/* Character R (0x52):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *****  |
+   | *  *   |
+   | *   *  |
+   | *    * |
+   | *    * |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0x4200,
+0x4200,
+0x4200,
+0x7c00,
+0x4800,
+0x4400,
+0x4200,
+0x4200,
+0x0000,
+0x0000,
+
+/* Character S (0x53):
+   ht=13, width=7
+   +-------+
+   |       |
+   |       |
+   |  ***  |
+   | *   * |
+   | *   * |
+   | *     |
+   |  ***  |
+   |     * |
+   | *   * |
+   | *   * |
+   |  ***  |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x4000,
+0x3800,
+0x0400,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character T (0x54):
+   ht=13, width=7
+   +-------+
+   |       |
+   |       |
+   | ***** |
+   |   *   |
+   |   *   |
+   |   *   |
+   |   *   |
+   |   *   |
+   |   *   |
+   |   *   |
+   |   *   |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x7c00,
+0x1000,
+0x1000,
+0x1000,
+0x1000,
+0x1000,
+0x1000,
+0x1000,
+0x1000,
+0x0000,
+0x0000,
+
+/* Character U (0x55):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   |  ****  |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x3c00,
+0x0000,
+0x0000,
+
+/* Character V (0x56):
+   ht=13, width=7
+   +-------+
+   |       |
+   |       |
+   |*     *|
+   |*     *|
+   | *   * |
+   | *   * |
+   | *   * |
+   |  * *  |
+   |  * *  |
+   |  * *  |
+   |   *   |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x8200,
+0x8200,
+0x4400,
+0x4400,
+0x4400,
+0x2800,
+0x2800,
+0x2800,
+0x1000,
+0x0000,
+0x0000,
+
+/* Character W (0x57):
+   ht=13, width=11
+   +-----------+
+   |           |
+   |           |
+   |*         *|
+   |*         *|
+   | *   *   * |
+   | *   *   * |
+   | *   *   * |
+   |  * * * *  |
+   |  * * * *  |
+   |  * * * *  |
+   |   *   *   |
+   |           |
+   |           |
+   +-----------+ */
+0x0000,
+0x0000,
+0x8020,
+0x8020,
+0x4440,
+0x4440,
+0x4440,
+0x2a80,
+0x2a80,
+0x2a80,
+0x1100,
+0x0000,
+0x0000,
+
+/* Character X (0x58):
+   ht=13, width=7
+   +-------+
+   |       |
+   |       |
+   |*     *|
+   |*     *|
+   | *   * |
+   |  * *  |
+   |   *   |
+   |  * *  |
+   | *   * |
+   |*     *|
+   |*     *|
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x8200,
+0x8200,
+0x4400,
+0x2800,
+0x1000,
+0x2800,
+0x4400,
+0x8200,
+0x8200,
+0x0000,
+0x0000,
+
+/* Character Y (0x59):
+   ht=13, width=7
+   +-------+
+   |       |
+   |       |
+   |*     *|
+   |*     *|
+   | *   * |
+   | *   * |
+   |  * *  |
+   |  * *  |
+   |   *   |
+   |   *   |
+   |   *   |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x8200,
+0x8200,
+0x4400,
+0x4400,
+0x2800,
+0x2800,
+0x1000,
+0x1000,
+0x1000,
+0x0000,
+0x0000,
+
+/* Character Z (0x5a):
+   ht=13, width=7
+   +-------+
+   |       |
+   |       |
+   |*******|
+   |     * |
+   |     * |
+   |    *  |
+   |   *   |
+   |  *    |
+   | *     |
+   | *     |
+   |*******|
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0xfe00,
+0x0400,
+0x0400,
+0x0800,
+0x1000,
+0x2000,
+0x4000,
+0x4000,
+0xfe00,
+0x0000,
+0x0000,
+
+/* Character [ (0x5b):
+   ht=13, width=3
+   +---+
+   |   |
+   | **|
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x6000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x6000,
+0x0000,
+
+/* Character \ (0x5c):
+   ht=13, width=5
+   +-----+
+   |     |
+   | *   |
+   | *   |
+   | *   |
+   |  *  |
+   |  *  |
+   |   * |
+   |   * |
+   |    *|
+   |    *|
+   |    *|
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x2000,
+0x2000,
+0x1000,
+0x1000,
+0x0800,
+0x0800,
+0x0800,
+0x0000,
+0x0000,
+
+/* Character ] (0x5d):
+   ht=13, width=3
+   +---+
+   |   |
+   | **|
+   |  *|
+   |  *|
+   |  *|
+   |  *|
+   |  *|
+   |  *|
+   |  *|
+   |  *|
+   |  *|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x6000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x6000,
+0x0000,
+
+/* Character ^ (0x5e):
+   ht=13, width=6
+   +------+
+   |      |
+   |   *  |
+   |  * * |
+   | *   *|
+   | *   *|
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x1000,
+0x2800,
+0x4400,
+0x4400,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character _ (0x5f):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |******|
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xfc00,
+
+/* Character ` (0x60):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   | * |
+   |  *|
+   |  *|
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x4000,
+0x2000,
+0x2000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character a (0x61):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |  *** |
+   |     *|
+   |  ****|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3800,
+0x0400,
+0x3c00,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character b (0x62):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   | *    |
+   | *    |
+   | *    |
+   | **** |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x7800,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character c (0x63):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | *    |
+   | *    |
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4000,
+0x4000,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character d (0x64):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |     *|
+   |     *|
+   |     *|
+   |  ****|
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0400,
+0x0400,
+0x0400,
+0x3c00,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character e (0x65):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | **** |
+   | *    |
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x7800,
+0x4000,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character f (0x66):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |  *|
+   | * |
+   | * |
+   | * |
+   | **|
+   | * |
+   | * |
+   | * |
+   | * |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x2000,
+0x4000,
+0x4000,
+0x4000,
+0x6000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character g (0x67):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   |  ****|
+   |     *|
+   | **** |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x3c00,
+0x0400,
+0x7800,
+
+/* Character h (0x68):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   | *    |
+   | *    |
+   | *    |
+   | * ** |
+   | **  *|
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x5800,
+0x6400,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x0000,
+0x0000,
+
+/* Character i (0x69):
+   ht=13, width=2
+   +--+
+   |  |
+   |  |
+   | *|
+   |  |
+   |  |
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   |  |
+   |  |
+   +--+ */
+0x0000,
+0x0000,
+0x4000,
+0x0000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character j (0x6a):
+   ht=13, width=2
+   +--+
+   |  |
+   |  |
+   | *|
+   |  |
+   |  |
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   |* |
+   +--+ */
+0x0000,
+0x0000,
+0x4000,
+0x0000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x8000,
+
+/* Character k (0x6b):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   | *    |
+   | *    |
+   | *    |
+   | *   *|
+   | *  * |
+   | ***  |
+   | * *  |
+   | *  * |
+   | *   *|
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4400,
+0x4800,
+0x7000,
+0x5000,
+0x4800,
+0x4400,
+0x0000,
+0x0000,
+
+/* Character l (0x6c):
+   ht=13, width=2
+   +--+
+   |  |
+   |  |
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   |  |
+   |  |
+   +--+ */
+0x0000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character m (0x6d):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | *** ** |
+   | *  *  *|
+   | *  *  *|
+   | *  *  *|
+   | *  *  *|
+   | *  *  *|
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7600,
+0x4900,
+0x4900,
+0x4900,
+0x4900,
+0x4900,
+0x0000,
+0x0000,
+
+/* Character n (0x6e):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   | * ** |
+   | **  *|
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x5800,
+0x6400,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x0000,
+0x0000,
+
+/* Character o (0x6f):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character p (0x70):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   | **** |
+   | *    |
+   | *    |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x7800,
+0x4000,
+0x4000,
+
+/* Character q (0x71):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   |  ****|
+   |     *|
+   |     *|
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x3c00,
+0x0400,
+0x0400,
+
+/* Character r (0x72):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |  *|
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x2000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character s (0x73):
+   ht=13, width=5
+   +-----+
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |  ** |
+   | *  *|
+   |  *  |
+   |   * |
+   | *  *|
+   |  ** |
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3000,
+0x4800,
+0x2000,
+0x1000,
+0x4800,
+0x3000,
+0x0000,
+0x0000,
+
+/* Character t (0x74):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | * |
+   | * |
+   | **|
+   | * |
+   | * |
+   | * |
+   | * |
+   |  *|
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x4000,
+0x4000,
+0x6000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x2000,
+0x0000,
+0x0000,
+
+/* Character u (0x75):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   | *  **|
+   |  ** *|
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x4c00,
+0x3400,
+0x0000,
+0x0000,
+
+/* Character v (0x76):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   | *   *|
+   | *   *|
+   |  * * |
+   |  * * |
+   |   *  |
+   |   *  |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x4400,
+0x4400,
+0x2800,
+0x2800,
+0x1000,
+0x1000,
+0x0000,
+0x0000,
+
+/* Character w (0x77):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | *     *|
+   | *  *  *|
+   | *  *  *|
+   | * * * *|
+   | * * * *|
+   |  *   * |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x4100,
+0x4900,
+0x4900,
+0x5500,
+0x5500,
+0x2200,
+0x0000,
+0x0000,
+
+/* Character x (0x78):
+   ht=13, width=5
+   +-----+
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   | *  *|
+   | *  *|
+   |  ** |
+   |  ** |
+   | *  *|
+   | *  *|
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x4800,
+0x4800,
+0x3000,
+0x3000,
+0x4800,
+0x4800,
+0x0000,
+0x0000,
+
+/* Character y (0x79):
+   ht=13, width=5
+   +-----+
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   | *  *|
+   | *  *|
+   | *  *|
+   | *  *|
+   |  ** |
+   |  *  |
+   |  *  |
+   |**   |
+   +-----+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x4800,
+0x4800,
+0x4800,
+0x4800,
+0x3000,
+0x2000,
+0x2000,
+0xc000,
+
+/* Character z (0x7a):
+   ht=13, width=5
+   +-----+
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   | ****|
+   |    *|
+   |   * |
+   |  *  |
+   | *   |
+   | ****|
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7800,
+0x0800,
+0x1000,
+0x2000,
+0x4000,
+0x7800,
+0x0000,
+0x0000,
+
+/* Character { (0x7b):
+   ht=13, width=4
+   +----+
+   |    |
+   |   *|
+   |  * |
+   |  * |
+   |  * |
+   |  * |
+   | *  |
+   |  * |
+   |  * |
+   |  * |
+   |  * |
+   |   *|
+   |    |
+   +----+ */
+0x0000,
+0x1000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x4000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x1000,
+0x0000,
+
+/* Character | (0x7c):
+   ht=13, width=2
+   +--+
+   |  |
+   |  |
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   |  |
+   +--+ */
+0x0000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+
+/* Character } (0x7d):
+   ht=13, width=4
+   +----+
+   |    |
+   | *  |
+   |  * |
+   |  * |
+   |  * |
+   |  * |
+   |   *|
+   |  * |
+   |  * |
+   |  * |
+   |  * |
+   | *  |
+   |    |
+   +----+ */
+0x0000,
+0x4000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x1000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x4000,
+0x0000,
+
+/* Character ~ (0x7e):
+   ht=13, width=7
+   +-------+
+   |       |
+   |       |
+   |       |
+   |  **  *|
+   | *  ** |
+   |       |
+   |       |
+   |       |
+   |       |
+   |       |
+   |       |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x0000,
+0x3200,
+0x4c00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x7f):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x80):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   |****  |
+   | *    |
+   |****  |
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0xf000,
+0x4000,
+0xf000,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0x81):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x82):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x83):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x84):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x85):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x86):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x87):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x88):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x89):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x8a):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x8b):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x8c):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x8d):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x8e):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x8f):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x90):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x91):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |  *|
+   |  *|
+   | * |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x2000,
+0x2000,
+0x4000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x92):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |  *|
+   |  *|
+   | * |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x2000,
+0x2000,
+0x4000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x93):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x94):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x95):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x96):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x97):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x98):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x99):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x9a):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x9b):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x9c):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x9d):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x9e):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0x9f):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   | **|
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+
+/* Character � (0xa0):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa1):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   |   |
+   | * |
+   |   |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x4000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+
+/* Character � (0xa2):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |    * |
+   |  *** |
+   | * * *|
+   | * *  |
+   | * *  |
+   | * * *|
+   |  *** |
+   |  *   |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0800,
+0x3800,
+0x5400,
+0x5000,
+0x5000,
+0x5400,
+0x3800,
+0x2000,
+0x0000,
+
+/* Character � (0xa3):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | *    |
+   |***** |
+   | *    |
+   |***** |
+   | *    |
+   | *    |
+   | *****|
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4000,
+0xf800,
+0x4000,
+0xf800,
+0x4000,
+0x4000,
+0x7c00,
+0x0000,
+0x0000,
+
+/* Character � (0xa4):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   | *   *|
+   |  *** |
+   |  * * |
+   | *   *|
+   |  * * |
+   |  *** |
+   | *   *|
+   |      |
+   |      |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x4400,
+0x3800,
+0x2800,
+0x4400,
+0x2800,
+0x3800,
+0x4400,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa5):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   | *   *|
+   | *   *|
+   |  * * |
+   |  * * |
+   | *****|
+   |   *  |
+   | *****|
+   |   *  |
+   |   *  |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x4400,
+0x4400,
+0x2800,
+0x2800,
+0x7c00,
+0x1000,
+0x7c00,
+0x1000,
+0x1000,
+0x0000,
+0x0000,
+
+/* Character � (0xa6):
+   ht=13, width=2
+   +--+
+   |  |
+   |  |
+   |  |
+   | *|
+   | *|
+   | *|
+   | *|
+   |  |
+   | *|
+   | *|
+   | *|
+   | *|
+   |  |
+   +--+ */
+0x0000,
+0x0000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+
+/* Character � (0xa7):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   |  *   |
+   | * *  |
+   | *  * |
+   |  *  *|
+   |   * *|
+   |    * |
+   | *   *|
+   |  *** |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x2000,
+0x5000,
+0x4800,
+0x2400,
+0x1400,
+0x0800,
+0x4400,
+0x3800,
+0x0000,
+
+/* Character � (0xa8):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |* *|
+   |* *|
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0xa000,
+0xa000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa9):
+   ht=13, width=9
+   +---------+
+   |         |
+   |         |
+   |   ****  |
+   |  *    * |
+   | *  **  *|
+   | * *    *|
+   | *  **  *|
+   |  *    * |
+   |   ****  |
+   |         |
+   |         |
+   |         |
+   |         |
+   +---------+ */
+0x0000,
+0x0000,
+0x1e00,
+0x2100,
+0x4c80,
+0x5080,
+0x4c80,
+0x2100,
+0x1e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xaa):
+   ht=13, width=4
+   +----+
+   |    |
+   |    |
+   | ** |
+   |  **|
+   | * *|
+   | ***|
+   |    |
+   | ***|
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x6000,
+0x3000,
+0x5000,
+0x7000,
+0x0000,
+0x7000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xab):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |   * *|
+   |  * * |
+   | * *  |
+   |  * * |
+   |   * *|
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1400,
+0x2800,
+0x5000,
+0x2800,
+0x1400,
+0x0000,
+0x0000,
+
+/* Character � (0xac):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   | *****|
+   |     *|
+   |     *|
+   |      |
+   |      |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7c00,
+0x0400,
+0x0400,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xad):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   | **|
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xae):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   |  ***** |
+   | * *** *|
+   | * * * *|
+   | * **  *|
+   | * * * *|
+   | * * * *|
+   |  ***** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3e00,
+0x5d00,
+0x5500,
+0x5900,
+0x5500,
+0x5500,
+0x3e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xaf):
+   ht=13, width=6
+   +------+
+   |      |
+   |******|
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0xfc00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xb0):
+   ht=13, width=4
+   +----+
+   |    |
+   |    |
+   |  * |
+   | * *|
+   |  * |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x2000,
+0x5000,
+0x2000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xb1):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |   *  |
+   |   *  |
+   | *****|
+   |   *  |
+   |   *  |
+   |      |
+   | *****|
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1000,
+0x1000,
+0x7c00,
+0x1000,
+0x1000,
+0x0000,
+0x7c00,
+0x0000,
+0x0000,
+
+/* Character � (0xb2):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |** |
+   |  *|
+   | * |
+   |*  |
+   |***|
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0xc000,
+0x2000,
+0x4000,
+0x8000,
+0xe000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xb3):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |** |
+   |  *|
+   |** |
+   |  *|
+   |** |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0xc000,
+0x2000,
+0xc000,
+0x2000,
+0xc000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xb4):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |  *|
+   | * |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x2000,
+0x4000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xb5):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   | *  * |
+   | *  * |
+   | *  * |
+   | *  * |
+   | *  * |
+   | *** *|
+   | *    |
+   | *    |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x4800,
+0x4800,
+0x4800,
+0x4800,
+0x4800,
+0x7400,
+0x4000,
+0x4000,
+
+/* Character � (0xb6):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  ****|
+   | *****|
+   | *****|
+   | *****|
+   |  ****|
+   |   * *|
+   |   * *|
+   |   * *|
+   |   * *|
+   |   * *|
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x7c00,
+0x7c00,
+0x7c00,
+0x3c00,
+0x1400,
+0x1400,
+0x1400,
+0x1400,
+0x1400,
+0x0000,
+
+/* Character � (0xb7):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   | * |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x4000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xb8):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |  *|
+   | **|
+   +---+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x2000,
+0x6000,
+
+/* Character � (0xb9):
+   ht=13, width=3
+   +---+
+   |   |
+   |   |
+   |  *|
+   | **|
+   |  *|
+   |  *|
+   |  *|
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   |   |
+   +---+ */
+0x0000,
+0x0000,
+0x2000,
+0x6000,
+0x2000,
+0x2000,
+0x2000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xba):
+   ht=13, width=4
+   +----+
+   |    |
+   |    |
+   | ***|
+   | * *|
+   | * *|
+   | ***|
+   |    |
+   | ***|
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x7000,
+0x5000,
+0x5000,
+0x7000,
+0x0000,
+0x7000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xbb):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   | * *  |
+   |  * * |
+   |   * *|
+   |   * *|
+   |  * * |
+   | * *  |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x5000,
+0x2800,
+0x1400,
+0x1400,
+0x2800,
+0x5000,
+0x0000,
+0x0000,
+
+/* Character � (0xbc):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   |  *     |
+   | **    *|
+   |  *   * |
+   |  *  *  |
+   |  * *  *|
+   |   *  **|
+   |  *  * *|
+   | *   ***|
+   |       *|
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x2000,
+0x6100,
+0x2200,
+0x2400,
+0x2900,
+0x1300,
+0x2500,
+0x4700,
+0x0100,
+0x0000,
+0x0000,
+
+/* Character � (0xbd):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   |  *     |
+   | **    *|
+   |  *   * |
+   |  *  *  |
+   |  * * * |
+   |   * * *|
+   |  *   * |
+   | *   *  |
+   |     ***|
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x2000,
+0x6100,
+0x2200,
+0x2400,
+0x2a00,
+0x1500,
+0x2200,
+0x4400,
+0x0700,
+0x0000,
+0x0000,
+
+/* Character � (0xbe):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   | **     |
+   |   *   *|
+   |  **  * |
+   |   * *  |
+   | ** *  *|
+   |   *  **|
+   |  *  * *|
+   | *   ***|
+   |       *|
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x6000,
+0x1100,
+0x3200,
+0x1400,
+0x6900,
+0x1300,
+0x2500,
+0x4700,
+0x0100,
+0x0000,
+0x0000,
+
+/* Character � (0xbf):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |   *  |
+   |      |
+   |   *  |
+   |   *  |
+   |  *   |
+   | *    |
+   | *    |
+   | *   *|
+   |  *** |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1000,
+0x0000,
+0x1000,
+0x1000,
+0x2000,
+0x4000,
+0x4000,
+0x4400,
+0x3800,
+
+/* Character � (0xc0):
+   ht=13, width=7
+   +-------+
+   |  *    |
+   |   *   |
+   |   *   |
+   |   *   |
+   |  * *  |
+   |  * *  |
+   | *   * |
+   | ***** |
+   | *   * |
+   |*     *|
+   |*     *|
+   |       |
+   |       |
+   +-------+ */
+0x2000,
+0x1000,
+0x1000,
+0x1000,
+0x2800,
+0x2800,
+0x4400,
+0x7c00,
+0x4400,
+0x8200,
+0x8200,
+0x0000,
+0x0000,
+
+/* Character � (0xc1):
+   ht=13, width=7
+   +-------+
+   |    *  |
+   |   *   |
+   |   *   |
+   |   *   |
+   |  * *  |
+   |  * *  |
+   | *   * |
+   | ***** |
+   | *   * |
+   |*     *|
+   |*     *|
+   |       |
+   |       |
+   +-------+ */
+0x0800,
+0x1000,
+0x1000,
+0x1000,
+0x2800,
+0x2800,
+0x4400,
+0x7c00,
+0x4400,
+0x8200,
+0x8200,
+0x0000,
+0x0000,
+
+/* Character � (0xc2):
+   ht=13, width=7
+   +-------+
+   |   *   |
+   |  * *  |
+   |       |
+   |   *   |
+   |  * *  |
+   |  * *  |
+   | *   * |
+   | ***** |
+   | *   * |
+   |*     *|
+   |*     *|
+   |       |
+   |       |
+   +-------+ */
+0x1000,
+0x2800,
+0x0000,
+0x1000,
+0x2800,
+0x2800,
+0x4400,
+0x7c00,
+0x4400,
+0x8200,
+0x8200,
+0x0000,
+0x0000,
+
+/* Character � (0xc3):
+   ht=13, width=7
+   +-------+
+   |  ** * |
+   | * **  |
+   |   *   |
+   |   *   |
+   |  * *  |
+   |  * *  |
+   | *   * |
+   | ***** |
+   | *   * |
+   |*     *|
+   |*     *|
+   |       |
+   |       |
+   +-------+ */
+0x3400,
+0x5800,
+0x1000,
+0x1000,
+0x2800,
+0x2800,
+0x4400,
+0x7c00,
+0x4400,
+0x8200,
+0x8200,
+0x0000,
+0x0000,
+
+/* Character � (0xc4):
+   ht=13, width=7
+   +-------+
+   | *   * |
+   |       |
+   |   *   |
+   |   *   |
+   |  * *  |
+   |  * *  |
+   | *   * |
+   | ***** |
+   | *   * |
+   |*     *|
+   |*     *|
+   |       |
+   |       |
+   +-------+ */
+0x4400,
+0x0000,
+0x1000,
+0x1000,
+0x2800,
+0x2800,
+0x4400,
+0x7c00,
+0x4400,
+0x8200,
+0x8200,
+0x0000,
+0x0000,
+
+/* Character � (0xc5):
+   ht=13, width=7
+   +-------+
+   |   *   |
+   |  * *  |
+   |   *   |
+   |   *   |
+   |  * *  |
+   |  * *  |
+   | *   * |
+   | ***** |
+   | *   * |
+   |*     *|
+   |*     *|
+   |       |
+   |       |
+   +-------+ */
+0x1000,
+0x2800,
+0x1000,
+0x1000,
+0x2800,
+0x2800,
+0x4400,
+0x7c00,
+0x4400,
+0x8200,
+0x8200,
+0x0000,
+0x0000,
+
+/* Character � (0xc6):
+   ht=13, width=10
+   +----------+
+   |          |
+   |          |
+   |   ****** |
+   |   **     |
+   |  * *     |
+   |  * *     |
+   | ******** |
+   | *  *     |
+   | *  *     |
+   |*   *     |
+   |*   ***** |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x1f80,
+0x1800,
+0x2800,
+0x2800,
+0x7f80,
+0x4800,
+0x4800,
+0x8800,
+0x8f80,
+0x0000,
+0x0000,
+
+/* Character � (0xc7):
+   ht=13, width=7
+   +-------+
+   |       |
+   |       |
+   |  **** |
+   | *    *|
+   | *    *|
+   | *     |
+   | *     |
+   | *     |
+   | *    *|
+   | *    *|
+   |  **** |
+   |    *  |
+   |   **  |
+   +-------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x4200,
+0x4200,
+0x4000,
+0x4000,
+0x4000,
+0x4200,
+0x4200,
+0x3c00,
+0x0800,
+0x1800,
+
+/* Character � (0xc8):
+   ht=13, width=7
+   +-------+
+   |  *    |
+   |   *   |
+   | ***** |
+   | *     |
+   | *     |
+   | *     |
+   | ***** |
+   | *     |
+   | *     |
+   | *     |
+   | ***** |
+   |       |
+   |       |
+   +-------+ */
+0x2000,
+0x1000,
+0x7c00,
+0x4000,
+0x4000,
+0x4000,
+0x7c00,
+0x4000,
+0x4000,
+0x4000,
+0x7c00,
+0x0000,
+0x0000,
+
+/* Character � (0xc9):
+   ht=13, width=7
+   +-------+
+   |    *  |
+   |   *   |
+   | ***** |
+   | *     |
+   | *     |
+   | *     |
+   | ***** |
+   | *     |
+   | *     |
+   | *     |
+   | ***** |
+   |       |
+   |       |
+   +-------+ */
+0x0800,
+0x1000,
+0x7c00,
+0x4000,
+0x4000,
+0x4000,
+0x7c00,
+0x4000,
+0x4000,
+0x4000,
+0x7c00,
+0x0000,
+0x0000,
+
+/* Character � (0xca):
+   ht=13, width=7
+   +-------+
+   |   *   |
+   |  * *  |
+   | ***** |
+   | *     |
+   | *     |
+   | *     |
+   | ***** |
+   | *     |
+   | *     |
+   | *     |
+   | ***** |
+   |       |
+   |       |
+   +-------+ */
+0x1000,
+0x2800,
+0x7c00,
+0x4000,
+0x4000,
+0x4000,
+0x7c00,
+0x4000,
+0x4000,
+0x4000,
+0x7c00,
+0x0000,
+0x0000,
+
+/* Character � (0xcb):
+   ht=13, width=7
+   +-------+
+   | *   * |
+   |       |
+   | ***** |
+   | *     |
+   | *     |
+   | *     |
+   | ***** |
+   | *     |
+   | *     |
+   | *     |
+   | ***** |
+   |       |
+   |       |
+   +-------+ */
+0x4400,
+0x0000,
+0x7c00,
+0x4000,
+0x4000,
+0x4000,
+0x7c00,
+0x4000,
+0x4000,
+0x4000,
+0x7c00,
+0x0000,
+0x0000,
+
+/* Character � (0xcc):
+   ht=13, width=3
+   +---+
+   |*  |
+   | * |
+   |   |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   |   |
+   |   |
+   +---+ */
+0x8000,
+0x4000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character � (0xcd):
+   ht=13, width=3
+   +---+
+   |  *|
+   | * |
+   |   |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   |   |
+   |   |
+   +---+ */
+0x2000,
+0x4000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character � (0xce):
+   ht=13, width=3
+   +---+
+   | * |
+   |* *|
+   |   |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   |   |
+   |   |
+   +---+ */
+0x4000,
+0xa000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character � (0xcf):
+   ht=13, width=3
+   +---+
+   |* *|
+   |   |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   | * |
+   |   |
+   |   |
+   +---+ */
+0xa000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character � (0xd0):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   | *****  |
+   | *    * |
+   | *    * |
+   | *    * |
+   |***** * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *****  |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7c00,
+0x4200,
+0x4200,
+0x4200,
+0xfa00,
+0x4200,
+0x4200,
+0x4200,
+0x7c00,
+0x0000,
+0x0000,
+
+/* Character � (0xd1):
+   ht=13, width=8
+   +--------+
+   |  **  * |
+   | *  **  |
+   | *    * |
+   | **   * |
+   | **   * |
+   | * *  * |
+   | *  * * |
+   | *  * * |
+   | *   ** |
+   | *   ** |
+   | *    * |
+   |        |
+   |        |
+   +--------+ */
+0x3200,
+0x4c00,
+0x4200,
+0x6200,
+0x6200,
+0x5200,
+0x4a00,
+0x4a00,
+0x4600,
+0x4600,
+0x4200,
+0x0000,
+0x0000,
+
+/* Character � (0xd2):
+   ht=13, width=8
+   +--------+
+   |   *    |
+   |    *   |
+   |  ****  |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   |  ****  |
+   |        |
+   |        |
+   +--------+ */
+0x1000,
+0x0800,
+0x3c00,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x3c00,
+0x0000,
+0x0000,
+
+/* Character � (0xd3):
+   ht=13, width=8
+   +--------+
+   |    *   |
+   |   *    |
+   |  ****  |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   |  ****  |
+   |        |
+   |        |
+   +--------+ */
+0x0800,
+0x1000,
+0x3c00,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x3c00,
+0x0000,
+0x0000,
+
+/* Character � (0xd4):
+   ht=13, width=8
+   +--------+
+   |   **   |
+   |  *  *  |
+   |  ****  |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   |  ****  |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x2400,
+0x3c00,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x3c00,
+0x0000,
+0x0000,
+
+/* Character � (0xd5):
+   ht=13, width=8
+   +--------+
+   |  **  * |
+   | *  **  |
+   |  ****  |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   |  ****  |
+   |        |
+   |        |
+   +--------+ */
+0x3200,
+0x4c00,
+0x3c00,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x3c00,
+0x0000,
+0x0000,
+
+/* Character � (0xd6):
+   ht=13, width=8
+   +--------+
+   |  *  *  |
+   |        |
+   |  ****  |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   |  ****  |
+   |        |
+   |        |
+   +--------+ */
+0x2400,
+0x0000,
+0x3c00,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x3c00,
+0x0000,
+0x0000,
+
+/* Character � (0xd7):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   | *   *|
+   |  * * |
+   |   *  |
+   |  * * |
+   | *   *|
+   |      |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x4400,
+0x2800,
+0x1000,
+0x2800,
+0x4400,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd8):
+   ht=13, width=8
+   +--------+
+   |        |
+   |        |
+   |  ***** |
+   | *   ** |
+   | *  * * |
+   | *  * * |
+   | * *  * |
+   | * *  * |
+   | **   * |
+   | **   * |
+   | *****  |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3e00,
+0x4600,
+0x4a00,
+0x4a00,
+0x5200,
+0x5200,
+0x6200,
+0x6200,
+0x7c00,
+0x0000,
+0x0000,
+
+/* Character � (0xd9):
+   ht=13, width=8
+   +--------+
+   |   *    |
+   |    *   |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   |  ****  |
+   |        |
+   |        |
+   +--------+ */
+0x1000,
+0x0800,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x3c00,
+0x0000,
+0x0000,
+
+/* Character � (0xda):
+   ht=13, width=8
+   +--------+
+   |    *   |
+   |   *    |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   |  ****  |
+   |        |
+   |        |
+   +--------+ */
+0x0800,
+0x1000,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x3c00,
+0x0000,
+0x0000,
+
+/* Character � (0xdb):
+   ht=13, width=8
+   +--------+
+   |   **   |
+   |  *  *  |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   |  ****  |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x2400,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x3c00,
+0x0000,
+0x0000,
+
+/* Character � (0xdc):
+   ht=13, width=8
+   +--------+
+   |  *  *  |
+   |        |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   | *    * |
+   |  ****  |
+   |        |
+   |        |
+   +--------+ */
+0x2400,
+0x0000,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x4200,
+0x3c00,
+0x0000,
+0x0000,
+
+/* Character � (0xdd):
+   ht=13, width=7
+   +-------+
+   |    *  |
+   |   *   |
+   |*     *|
+   |*     *|
+   | *   * |
+   |  * *  |
+   |   *   |
+   |   *   |
+   |   *   |
+   |   *   |
+   |   *   |
+   |       |
+   |       |
+   +-------+ */
+0x0800,
+0x1000,
+0x8200,
+0x8200,
+0x4400,
+0x2800,
+0x1000,
+0x1000,
+0x1000,
+0x1000,
+0x1000,
+0x0000,
+0x0000,
+
+/* Character � (0xde):
+   ht=13, width=7
+   +-------+
+   |       |
+   |       |
+   | *     |
+   | *     |
+   | ***** |
+   | *    *|
+   | *    *|
+   | *    *|
+   | ***** |
+   | *     |
+   | *     |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x4000,
+0x4000,
+0x7c00,
+0x4200,
+0x4200,
+0x4200,
+0x7c00,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character � (0xdf):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  **  |
+   | *  * |
+   | *  * |
+   | *  * |
+   | * ** |
+   | *   *|
+   | *   *|
+   | *   *|
+   | * ** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x3000,
+0x4800,
+0x4800,
+0x4800,
+0x5800,
+0x4400,
+0x4400,
+0x4400,
+0x5800,
+0x0000,
+0x0000,
+
+/* Character � (0xe0):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  *   |
+   |   *  |
+   |      |
+   |  *** |
+   |     *|
+   |  ****|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x2000,
+0x1000,
+0x0000,
+0x3800,
+0x0400,
+0x3c00,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xe1):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |    * |
+   |   *  |
+   |      |
+   |  *** |
+   |     *|
+   |  ****|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0800,
+0x1000,
+0x0000,
+0x3800,
+0x0400,
+0x3c00,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xe2):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |   *  |
+   |  * * |
+   |      |
+   |  *** |
+   |     *|
+   |  ****|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x1000,
+0x2800,
+0x0000,
+0x3800,
+0x0400,
+0x3c00,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xe3):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  ** *|
+   | * ** |
+   |      |
+   |  *** |
+   |     *|
+   |  ****|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x3400,
+0x5800,
+0x0000,
+0x3800,
+0x0400,
+0x3c00,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xe4):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  *  *|
+   |      |
+   |      |
+   |  *** |
+   |     *|
+   |  ****|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x2400,
+0x0000,
+0x0000,
+0x3800,
+0x0400,
+0x3c00,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xe5):
+   ht=13, width=6
+   +------+
+   |      |
+   |   *  |
+   |  * * |
+   |   *  |
+   |      |
+   |  *** |
+   |     *|
+   |  ****|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x1000,
+0x2800,
+0x1000,
+0x0000,
+0x3800,
+0x0400,
+0x3c00,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xe6):
+   ht=13, width=10
+   +----------+
+   |          |
+   |          |
+   |          |
+   |          |
+   |          |
+   |  *** *** |
+   |     *   *|
+   |  ******* |
+   | *   *    |
+   | *   *   *|
+   |  *** *** |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3b80,
+0x0440,
+0x3f80,
+0x4400,
+0x4440,
+0x3b80,
+0x0000,
+0x0000,
+
+/* Character � (0xe7):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | *    |
+   | *    |
+   | *   *|
+   |  *** |
+   |   *  |
+   |  **  |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4000,
+0x4000,
+0x4400,
+0x3800,
+0x1000,
+0x3000,
+
+/* Character � (0xe8):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  *   |
+   |   *  |
+   |      |
+   |  *** |
+   | *   *|
+   | **** |
+   | *    |
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x2000,
+0x1000,
+0x0000,
+0x3800,
+0x4400,
+0x7800,
+0x4000,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xe9):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |    * |
+   |   *  |
+   |      |
+   |  *** |
+   | *   *|
+   | **** |
+   | *    |
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0800,
+0x1000,
+0x0000,
+0x3800,
+0x4400,
+0x7800,
+0x4000,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xea):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |   *  |
+   |  * * |
+   |      |
+   |  *** |
+   | *   *|
+   | **** |
+   | *    |
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x1000,
+0x2800,
+0x0000,
+0x3800,
+0x4400,
+0x7800,
+0x4000,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xeb):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   | *   *|
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | **** |
+   | *    |
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x4400,
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x7800,
+0x4000,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xec):
+   ht=13, width=2
+   +--+
+   |  |
+   |  |
+   |* |
+   | *|
+   |  |
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   | *|
+   |  |
+   |  |
+   +--+ */
+0x0000,
+0x0000,
+0x8000,
+0x4000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x4000,
+0x0000,
+0x0000,
+
+/* Character � (0xed):
+   ht=13, width=4
+   +----+
+   |    |
+   |    |
+   |   *|
+   |  * |
+   |    |
+   |  * |
+   |  * |
+   |  * |
+   |  * |
+   |  * |
+   |  * |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x1000,
+0x2000,
+0x0000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x0000,
+0x0000,
+
+/* Character � (0xee):
+   ht=13, width=4
+   +----+
+   |    |
+   |    |
+   |  * |
+   | * *|
+   |    |
+   |  * |
+   |  * |
+   |  * |
+   |  * |
+   |  * |
+   |  * |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x2000,
+0x5000,
+0x0000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x0000,
+0x0000,
+
+/* Character � (0xef):
+   ht=13, width=4
+   +----+
+   |    |
+   |    |
+   | * *|
+   |    |
+   |    |
+   |  * |
+   |  * |
+   |  * |
+   |  * |
+   |  * |
+   |  * |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x5000,
+0x0000,
+0x0000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x2000,
+0x0000,
+0x0000,
+
+/* Character � (0xf0):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  * * |
+   |   *  |
+   |  * * |
+   |    * |
+   |  ****|
+   | *   *|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x2800,
+0x1000,
+0x2800,
+0x0800,
+0x3c00,
+0x4400,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xf1):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  ** *|
+   | * ** |
+   |      |
+   | * ** |
+   | **  *|
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x3400,
+0x5800,
+0x0000,
+0x5800,
+0x6400,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x0000,
+0x0000,
+
+/* Character � (0xf2):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  *   |
+   |   *  |
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x2000,
+0x1000,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xf3):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |    * |
+   |   *  |
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0800,
+0x1000,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xf4):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |   *  |
+   |  * * |
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x1000,
+0x2800,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xf5):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  ** *|
+   | * ** |
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x3400,
+0x5800,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xf6):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   | *   *|
+   |      |
+   |      |
+   |  *** |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   |  *** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x4400,
+0x0000,
+0x0000,
+0x3800,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x3800,
+0x0000,
+0x0000,
+
+/* Character � (0xf7):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |   *  |
+   |      |
+   | *****|
+   |      |
+   |   *  |
+   |      |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1000,
+0x0000,
+0x7c00,
+0x0000,
+0x1000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf8):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |  ****|
+   | *  **|
+   | * * *|
+   | * * *|
+   | **  *|
+   | **** |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3c00,
+0x4c00,
+0x5400,
+0x5400,
+0x6400,
+0x7800,
+0x0000,
+0x0000,
+
+/* Character � (0xf9):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |  *   |
+   |   *  |
+   |      |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   | *  **|
+   |  ** *|
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x2000,
+0x1000,
+0x0000,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x4c00,
+0x3400,
+0x0000,
+0x0000,
+
+/* Character � (0xfa):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |    * |
+   |   *  |
+   |      |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   | *  **|
+   |  ** *|
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0800,
+0x1000,
+0x0000,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x4c00,
+0x3400,
+0x0000,
+0x0000,
+
+/* Character � (0xfb):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   |   *  |
+   |  * * |
+   |      |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   | *  **|
+   |  ** *|
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x1000,
+0x2800,
+0x0000,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x4c00,
+0x3400,
+0x0000,
+0x0000,
+
+/* Character � (0xfc):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   | *   *|
+   |      |
+   |      |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   | *  **|
+   |  ** *|
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x4400,
+0x0000,
+0x0000,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x4c00,
+0x3400,
+0x0000,
+0x0000,
+
+/* Character � (0xfd):
+   ht=13, width=5
+   +-----+
+   |     |
+   |     |
+   |   * |
+   |  *  |
+   |     |
+   | *  *|
+   | *  *|
+   | *  *|
+   | *  *|
+   |  ** |
+   |  *  |
+   |  *  |
+   |**   |
+   +-----+ */
+0x0000,
+0x0000,
+0x1000,
+0x2000,
+0x0000,
+0x4800,
+0x4800,
+0x4800,
+0x4800,
+0x3000,
+0x2000,
+0x2000,
+0xc000,
+
+/* Character � (0xfe):
+   ht=13, width=6
+   +------+
+   |      |
+   |      |
+   | *    |
+   | *    |
+   | *    |
+   | **** |
+   | *   *|
+   | *   *|
+   | *   *|
+   | *   *|
+   | **** |
+   | *    |
+   | *    |
+   +------+ */
+0x0000,
+0x0000,
+0x4000,
+0x4000,
+0x4000,
+0x7800,
+0x4400,
+0x4400,
+0x4400,
+0x4400,
+0x7800,
+0x4000,
+0x4000,
+
+/* Character � (0xff):
+   ht=13, width=5
+   +-----+
+   |     |
+   |     |
+   | *  *|
+   |     |
+   |     |
+   | *  *|
+   | *  *|
+   | *  *|
+   | *  *|
+   |  ** |
+   |  *  |
+   |  *  |
+   |**   |
+   +-----+ */
+0x0000,
+0x0000,
+0x4800,
+0x0000,
+0x0000,
+0x4800,
+0x4800,
+0x4800,
+0x4800,
+0x3000,
+0x2000,
+0x2000,
+0xc000,
+
+};
+
+/* Character->glyph data. */
+static unsigned short winFreeSansSerif11x13_offset[] = {
+  0,	 /*   (0x20) */
+  13,	 /* ! (0x21) */
+  26,	 /* " (0x22) */
+  39,	 /* # (0x23) */
+  52,	 /* $ (0x24) */
+  65,	 /* % (0x25) */
+  78,	 /* & (0x26) */
+  91,	 /* ' (0x27) */
+  104,	 /* ( (0x28) */
+  117,	 /* ) (0x29) */
+  130,	 /* * (0x2a) */
+  143,	 /* + (0x2b) */
+  156,	 /* , (0x2c) */
+  169,	 /* - (0x2d) */
+  182,	 /* . (0x2e) */
+  195,	 /* / (0x2f) */
+  208,	 /* 0 (0x30) */
+  221,	 /* 1 (0x31) */
+  234,	 /* 2 (0x32) */
+  247,	 /* 3 (0x33) */
+  260,	 /* 4 (0x34) */
+  273,	 /* 5 (0x35) */
+  286,	 /* 6 (0x36) */
+  299,	 /* 7 (0x37) */
+  312,	 /* 8 (0x38) */
+  325,	 /* 9 (0x39) */
+  338,	 /* : (0x3a) */
+  351,	 /* ; (0x3b) */
+  364,	 /* < (0x3c) */
+  377,	 /* = (0x3d) */
+  390,	 /* > (0x3e) */
+  403,	 /* ? (0x3f) */
+  416,	 /* @ (0x40) */
+  429,	 /* A (0x41) */
+  442,	 /* B (0x42) */
+  455,	 /* C (0x43) */
+  468,	 /* D (0x44) */
+  481,	 /* E (0x45) */
+  494,	 /* F (0x46) */
+  507,	 /* G (0x47) */
+  520,	 /* H (0x48) */
+  533,	 /* I (0x49) */
+  546,	 /* J (0x4a) */
+  559,	 /* K (0x4b) */
+  572,	 /* L (0x4c) */
+  585,	 /* M (0x4d) */
+  598,	 /* N (0x4e) */
+  611,	 /* O (0x4f) */
+  624,	 /* P (0x50) */
+  637,	 /* Q (0x51) */
+  650,	 /* R (0x52) */
+  663,	 /* S (0x53) */
+  676,	 /* T (0x54) */
+  689,	 /* U (0x55) */
+  702,	 /* V (0x56) */
+  715,	 /* W (0x57) */
+  728,	 /* X (0x58) */
+  741,	 /* Y (0x59) */
+  754,	 /* Z (0x5a) */
+  767,	 /* [ (0x5b) */
+  780,	 /* \ (0x5c) */
+  793,	 /* ] (0x5d) */
+  806,	 /* ^ (0x5e) */
+  819,	 /* _ (0x5f) */
+  832,	 /* ` (0x60) */
+  845,	 /* a (0x61) */
+  858,	 /* b (0x62) */
+  871,	 /* c (0x63) */
+  884,	 /* d (0x64) */
+  897,	 /* e (0x65) */
+  910,	 /* f (0x66) */
+  923,	 /* g (0x67) */
+  936,	 /* h (0x68) */
+  949,	 /* i (0x69) */
+  962,	 /* j (0x6a) */
+  975,	 /* k (0x6b) */
+  988,	 /* l (0x6c) */
+  1001,	 /* m (0x6d) */
+  1014,	 /* n (0x6e) */
+  1027,	 /* o (0x6f) */
+  1040,	 /* p (0x70) */
+  1053,	 /* q (0x71) */
+  1066,	 /* r (0x72) */
+  1079,	 /* s (0x73) */
+  1092,	 /* t (0x74) */
+  1105,	 /* u (0x75) */
+  1118,	 /* v (0x76) */
+  1131,	 /* w (0x77) */
+  1144,	 /* x (0x78) */
+  1157,	 /* y (0x79) */
+  1170,	 /* z (0x7a) */
+  1183,	 /* { (0x7b) */
+  1196,	 /* | (0x7c) */
+  1209,	 /* } (0x7d) */
+  1222,	 /* ~ (0x7e) */
+  1235,	 /*  (0x7f) */
+  1248,	 /* � (0x80) */
+  1261,	 /* � (0x81) */
+  1274,	 /* � (0x82) */
+  1287,	 /* � (0x83) */
+  1300,	 /* � (0x84) */
+  1313,	 /* � (0x85) */
+  1326,	 /* � (0x86) */
+  1339,	 /* � (0x87) */
+  1352,	 /* � (0x88) */
+  1365,	 /* � (0x89) */
+  1378,	 /* � (0x8a) */
+  1391,	 /* � (0x8b) */
+  1404,	 /* � (0x8c) */
+  1417,	 /* � (0x8d) */
+  1430,	 /* � (0x8e) */
+  1443,	 /* � (0x8f) */
+  1456,	 /* � (0x90) */
+  1469,	 /* � (0x91) */
+  1482,	 /* � (0x92) */
+  1495,	 /* � (0x93) */
+  1508,	 /* � (0x94) */
+  1521,	 /* � (0x95) */
+  1534,	 /* � (0x96) */
+  1547,	 /* � (0x97) */
+  1560,	 /* � (0x98) */
+  1573,	 /* � (0x99) */
+  1586,	 /* � (0x9a) */
+  1599,	 /* � (0x9b) */
+  1612,	 /* � (0x9c) */
+  1625,	 /* � (0x9d) */
+  1638,	 /* � (0x9e) */
+  1651,	 /* � (0x9f) */
+  1664,	 /* � (0xa0) */
+  1677,	 /* � (0xa1) */
+  1690,	 /* � (0xa2) */
+  1703,	 /* � (0xa3) */
+  1716,	 /* � (0xa4) */
+  1729,	 /* � (0xa5) */
+  1742,	 /* � (0xa6) */
+  1755,	 /* � (0xa7) */
+  1768,	 /* � (0xa8) */
+  1781,	 /* � (0xa9) */
+  1794,	 /* � (0xaa) */
+  1807,	 /* � (0xab) */
+  1820,	 /* � (0xac) */
+  1833,	 /* � (0xad) */
+  1846,	 /* � (0xae) */
+  1859,	 /* � (0xaf) */
+  1872,	 /* � (0xb0) */
+  1885,	 /* � (0xb1) */
+  1898,	 /* � (0xb2) */
+  1911,	 /* � (0xb3) */
+  1924,	 /* � (0xb4) */
+  1937,	 /* � (0xb5) */
+  1950,	 /* � (0xb6) */
+  1963,	 /* � (0xb7) */
+  1976,	 /* � (0xb8) */
+  1989,	 /* � (0xb9) */
+  2002,	 /* � (0xba) */
+  2015,	 /* � (0xbb) */
+  2028,	 /* � (0xbc) */
+  2041,	 /* � (0xbd) */
+  2054,	 /* � (0xbe) */
+  2067,	 /* � (0xbf) */
+  2080,	 /* � (0xc0) */
+  2093,	 /* � (0xc1) */
+  2106,	 /* � (0xc2) */
+  2119,	 /* � (0xc3) */
+  2132,	 /* � (0xc4) */
+  2145,	 /* � (0xc5) */
+  2158,	 /* � (0xc6) */
+  2171,	 /* � (0xc7) */
+  2184,	 /* � (0xc8) */
+  2197,	 /* � (0xc9) */
+  2210,	 /* � (0xca) */
+  2223,	 /* � (0xcb) */
+  2236,	 /* � (0xcc) */
+  2249,	 /* � (0xcd) */
+  2262,	 /* � (0xce) */
+  2275,	 /* � (0xcf) */
+  2288,	 /* � (0xd0) */
+  2301,	 /* � (0xd1) */
+  2314,	 /* � (0xd2) */
+  2327,	 /* � (0xd3) */
+  2340,	 /* � (0xd4) */
+  2353,	 /* � (0xd5) */
+  2366,	 /* � (0xd6) */
+  2379,	 /* � (0xd7) */
+  2392,	 /* � (0xd8) */
+  2405,	 /* � (0xd9) */
+  2418,	 /* � (0xda) */
+  2431,	 /* � (0xdb) */
+  2444,	 /* � (0xdc) */
+  2457,	 /* � (0xdd) */
+  2470,	 /* � (0xde) */
+  2483,	 /* � (0xdf) */
+  2496,	 /* � (0xe0) */
+  2509,	 /* � (0xe1) */
+  2522,	 /* � (0xe2) */
+  2535,	 /* � (0xe3) */
+  2548,	 /* � (0xe4) */
+  2561,	 /* � (0xe5) */
+  2574,	 /* � (0xe6) */
+  2587,	 /* � (0xe7) */
+  2600,	 /* � (0xe8) */
+  2613,	 /* � (0xe9) */
+  2626,	 /* � (0xea) */
+  2639,	 /* � (0xeb) */
+  2652,	 /* � (0xec) */
+  2665,	 /* � (0xed) */
+  2678,	 /* � (0xee) */
+  2691,	 /* � (0xef) */
+  2704,	 /* � (0xf0) */
+  2717,	 /* � (0xf1) */
+  2730,	 /* � (0xf2) */
+  2743,	 /* � (0xf3) */
+  2756,	 /* � (0xf4) */
+  2769,	 /* � (0xf5) */
+  2782,	 /* � (0xf6) */
+  2795,	 /* � (0xf7) */
+  2808,	 /* � (0xf8) */
+  2821,	 /* � (0xf9) */
+  2834,	 /* � (0xfa) */
+  2847,	 /* � (0xfb) */
+  2860,	 /* � (0xfc) */
+  2873,	 /* � (0xfd) */
+  2886,	 /* � (0xfe) */
+  2899,	 /* � (0xff) */
+};
+
+/* Character width data. */
+static unsigned char winFreeSansSerif11x13_width[] = {
+  3,	 /*   (0x20) */
+  3,	 /* ! (0x21) */
+  5,	 /* " (0x22) */
+  7,	 /* # (0x23) */
+  6,	 /* $ (0x24) */
+  8,	 /* % (0x25) */
+  6,	 /* & (0x26) */
+  2,	 /* ' (0x27) */
+  3,	 /* ( (0x28) */
+  3,	 /* ) (0x29) */
+  4,	 /* * (0x2a) */
+  6,	 /* + (0x2b) */
+  3,	 /* , (0x2c) */
+  3,	 /* - (0x2d) */
+  3,	 /* . (0x2e) */
+  5,	 /* / (0x2f) */
+  6,	 /* 0 (0x30) */
+  6,	 /* 1 (0x31) */
+  6,	 /* 2 (0x32) */
+  6,	 /* 3 (0x33) */
+  6,	 /* 4 (0x34) */
+  6,	 /* 5 (0x35) */
+  6,	 /* 6 (0x36) */
+  6,	 /* 7 (0x37) */
+  6,	 /* 8 (0x38) */
+  6,	 /* 9 (0x39) */
+  3,	 /* : (0x3a) */
+  3,	 /* ; (0x3b) */
+  6,	 /* < (0x3c) */
+  6,	 /* = (0x3d) */
+  6,	 /* > (0x3e) */
+  6,	 /* ? (0x3f) */
+  11,	 /* @ (0x40) */
+  7,	 /* A (0x41) */
+  7,	 /* B (0x42) */
+  7,	 /* C (0x43) */
+  8,	 /* D (0x44) */
+  7,	 /* E (0x45) */
+  6,	 /* F (0x46) */
+  8,	 /* G (0x47) */
+  8,	 /* H (0x48) */
+  3,	 /* I (0x49) */
+  5,	 /* J (0x4a) */
+  7,	 /* K (0x4b) */
+  6,	 /* L (0x4c) */
+  9,	 /* M (0x4d) */
+  8,	 /* N (0x4e) */
+  8,	 /* O (0x4f) */
+  7,	 /* P (0x50) */
+  8,	 /* Q (0x51) */
+  8,	 /* R (0x52) */
+  7,	 /* S (0x53) */
+  7,	 /* T (0x54) */
+  8,	 /* U (0x55) */
+  7,	 /* V (0x56) */
+  11,	 /* W (0x57) */
+  7,	 /* X (0x58) */
+  7,	 /* Y (0x59) */
+  7,	 /* Z (0x5a) */
+  3,	 /* [ (0x5b) */
+  5,	 /* \ (0x5c) */
+  3,	 /* ] (0x5d) */
+  6,	 /* ^ (0x5e) */
+  6,	 /* _ (0x5f) */
+  3,	 /* ` (0x60) */
+  6,	 /* a (0x61) */
+  6,	 /* b (0x62) */
+  6,	 /* c (0x63) */
+  6,	 /* d (0x64) */
+  6,	 /* e (0x65) */
+  3,	 /* f (0x66) */
+  6,	 /* g (0x67) */
+  6,	 /* h (0x68) */
+  2,	 /* i (0x69) */
+  2,	 /* j (0x6a) */
+  6,	 /* k (0x6b) */
+  2,	 /* l (0x6c) */
+  8,	 /* m (0x6d) */
+  6,	 /* n (0x6e) */
+  6,	 /* o (0x6f) */
+  6,	 /* p (0x70) */
+  6,	 /* q (0x71) */
+  3,	 /* r (0x72) */
+  5,	 /* s (0x73) */
+  3,	 /* t (0x74) */
+  6,	 /* u (0x75) */
+  6,	 /* v (0x76) */
+  8,	 /* w (0x77) */
+  5,	 /* x (0x78) */
+  5,	 /* y (0x79) */
+  5,	 /* z (0x7a) */
+  4,	 /* { (0x7b) */
+  2,	 /* | (0x7c) */
+  4,	 /* } (0x7d) */
+  7,	 /* ~ (0x7e) */
+  3,	 /*  (0x7f) */
+  6,	 /* � (0x80) */
+  3,	 /* � (0x81) */
+  3,	 /* � (0x82) */
+  3,	 /* � (0x83) */
+  3,	 /* � (0x84) */
+  3,	 /* � (0x85) */
+  3,	 /* � (0x86) */
+  3,	 /* � (0x87) */
+  3,	 /* � (0x88) */
+  3,	 /* � (0x89) */
+  3,	 /* � (0x8a) */
+  3,	 /* � (0x8b) */
+  3,	 /* � (0x8c) */
+  3,	 /* � (0x8d) */
+  3,	 /* � (0x8e) */
+  3,	 /* � (0x8f) */
+  3,	 /* � (0x90) */
+  3,	 /* � (0x91) */
+  3,	 /* � (0x92) */
+  3,	 /* � (0x93) */
+  3,	 /* � (0x94) */
+  3,	 /* � (0x95) */
+  3,	 /* � (0x96) */
+  3,	 /* � (0x97) */
+  3,	 /* � (0x98) */
+  3,	 /* � (0x99) */
+  3,	 /* � (0x9a) */
+  3,	 /* � (0x9b) */
+  3,	 /* � (0x9c) */
+  3,	 /* � (0x9d) */
+  3,	 /* � (0x9e) */
+  3,	 /* � (0x9f) */
+  3,	 /* � (0xa0) */
+  3,	 /* � (0xa1) */
+  6,	 /* � (0xa2) */
+  6,	 /* � (0xa3) */
+  6,	 /* � (0xa4) */
+  6,	 /* � (0xa5) */
+  2,	 /* � (0xa6) */
+  6,	 /* � (0xa7) */
+  3,	 /* � (0xa8) */
+  9,	 /* � (0xa9) */
+  4,	 /* � (0xaa) */
+  6,	 /* � (0xab) */
+  6,	 /* � (0xac) */
+  3,	 /* � (0xad) */
+  8,	 /* � (0xae) */
+  6,	 /* � (0xaf) */
+  4,	 /* � (0xb0) */
+  6,	 /* � (0xb1) */
+  3,	 /* � (0xb2) */
+  3,	 /* � (0xb3) */
+  3,	 /* � (0xb4) */
+  6,	 /* � (0xb5) */
+  6,	 /* � (0xb6) */
+  3,	 /* � (0xb7) */
+  3,	 /* � (0xb8) */
+  3,	 /* � (0xb9) */
+  4,	 /* � (0xba) */
+  6,	 /* � (0xbb) */
+  8,	 /* � (0xbc) */
+  8,	 /* � (0xbd) */
+  8,	 /* � (0xbe) */
+  6,	 /* � (0xbf) */
+  7,	 /* � (0xc0) */
+  7,	 /* � (0xc1) */
+  7,	 /* � (0xc2) */
+  7,	 /* � (0xc3) */
+  7,	 /* � (0xc4) */
+  7,	 /* � (0xc5) */
+  10,	 /* � (0xc6) */
+  7,	 /* � (0xc7) */
+  7,	 /* � (0xc8) */
+  7,	 /* � (0xc9) */
+  7,	 /* � (0xca) */
+  7,	 /* � (0xcb) */
+  3,	 /* � (0xcc) */
+  3,	 /* � (0xcd) */
+  3,	 /* � (0xce) */
+  3,	 /* � (0xcf) */
+  8,	 /* � (0xd0) */
+  8,	 /* � (0xd1) */
+  8,	 /* � (0xd2) */
+  8,	 /* � (0xd3) */
+  8,	 /* � (0xd4) */
+  8,	 /* � (0xd5) */
+  8,	 /* � (0xd6) */
+  6,	 /* � (0xd7) */
+  8,	 /* � (0xd8) */
+  8,	 /* � (0xd9) */
+  8,	 /* � (0xda) */
+  8,	 /* � (0xdb) */
+  8,	 /* � (0xdc) */
+  7,	 /* � (0xdd) */
+  7,	 /* � (0xde) */
+  6,	 /* � (0xdf) */
+  6,	 /* � (0xe0) */
+  6,	 /* � (0xe1) */
+  6,	 /* � (0xe2) */
+  6,	 /* � (0xe3) */
+  6,	 /* � (0xe4) */
+  6,	 /* � (0xe5) */
+  10,	 /* � (0xe6) */
+  6,	 /* � (0xe7) */
+  6,	 /* � (0xe8) */
+  6,	 /* � (0xe9) */
+  6,	 /* � (0xea) */
+  6,	 /* � (0xeb) */
+  2,	 /* � (0xec) */
+  4,	 /* � (0xed) */
+  4,	 /* � (0xee) */
+  4,	 /* � (0xef) */
+  6,	 /* � (0xf0) */
+  6,	 /* � (0xf1) */
+  6,	 /* � (0xf2) */
+  6,	 /* � (0xf3) */
+  6,	 /* � (0xf4) */
+  6,	 /* � (0xf5) */
+  6,	 /* � (0xf6) */
+  6,	 /* � (0xf7) */
+  6,	 /* � (0xf8) */
+  6,	 /* � (0xf9) */
+  6,	 /* � (0xfa) */
+  6,	 /* � (0xfb) */
+  6,	 /* � (0xfc) */
+  5,	 /* � (0xfd) */
+  6,	 /* � (0xfe) */
+  5,	 /* � (0xff) */
+};
+
+/* Exported structure definition. */
+MWCFONT font_winFreeSansSerif11x13 = {
+	"winFreeSansSerif11x13",
+	11,
+	13,
+	11,
+	32,
+	224,
+	winFreeSansSerif11x13_bits,
+	winFreeSansSerif11x13_offset,
+	winFreeSansSerif11x13_width,
+};
diff -urN lib/microwindows/src/fonts/winFreeSystem14x16.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/winFreeSystem14x16.c
--- lib/microwindows/src/fonts/winFreeSystem14x16.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/fonts/winFreeSystem14x16.c	2005-02-21 16:03:28.000000000 +0100
@@ -0,0 +1,8771 @@
+/* Generated by convfnt.exe*/
+#include "device.h"
+
+/* Windows FreeSystem 14x16 Font */
+
+/*
+ * FONTRES 100,96,96:Free System 10
+ * Distributed under the MPL (c) 1999 darran@rimron.co.uk v0.1 
+ * Free System
+ */
+
+static MWIMAGEBITS winFreeSystem14x16_bits[] = {
+
+/* Character   (0x20):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ! (0x21):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character " (0x22):
+   ht=16, width=6
+   +------+
+   |      |
+   |      |
+   |**  **|
+   |**  **|
+   |**  **|
+   |**  **|
+   |**  **|
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0xcc00,
+0xcc00,
+0xcc00,
+0xcc00,
+0xcc00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character # (0x23):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ** ** |
+   |  ** ** |
+   | *******|
+   | *******|
+   |  ** ** |
+   |  ** ** |
+   | ** **  |
+   | ** **  |
+   |******* |
+   |******* |
+   | ** **  |
+   | ** **  |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3600,
+0x3600,
+0x7f00,
+0x7f00,
+0x3600,
+0x3600,
+0x6c00,
+0x6c00,
+0xfe00,
+0xfe00,
+0x6c00,
+0x6c00,
+0x0000,
+0x0000,
+
+/* Character $ (0x24):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   | ****** |
+   |** ** **|
+   |** ** **|
+   |** **   |
+   |******  |
+   |  ***** |
+   |   ** **|
+   |** ** **|
+   |** ** **|
+   | ****** |
+   |   **   |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x7e00,
+0xdb00,
+0xdb00,
+0xd800,
+0xfc00,
+0x3e00,
+0x1b00,
+0xdb00,
+0xdb00,
+0x7e00,
+0x1800,
+0x0000,
+0x0000,
+
+/* Character % (0x25):
+   ht=16, width=11
+   +-----------+
+   |           |
+   |           |
+   | ***     **|
+   |** **   ** |
+   |** **  **  |
+   |** ** **   |
+   | *** **    |
+   |     **    |
+   |    ** *** |
+   |   ** ** **|
+   |  **  ** **|
+   | **   ** **|
+   |**     *** |
+   |           |
+   |           |
+   |           |
+   +-----------+ */
+0x0000,
+0x0000,
+0x7060,
+0xd8c0,
+0xd980,
+0xdb00,
+0x7600,
+0x0600,
+0x0dc0,
+0x1b60,
+0x3360,
+0x6360,
+0xc1c0,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character & (0x26):
+   ht=16, width=9
+   +---------+
+   |         |
+   |         |
+   |   ***   |
+   |  ** **  |
+   |  *   *  |
+   |  *   *  |
+   |  ** **  |
+   |   ***   |
+   |  ***  * |
+   | ** ** * |
+   | *   *** |
+   | **  **  |
+   |  ****** |
+   |         |
+   |         |
+   |         |
+   +---------+ */
+0x0000,
+0x0000,
+0x1c00,
+0x3600,
+0x2200,
+0x2200,
+0x3600,
+0x1c00,
+0x3900,
+0x6d00,
+0x4700,
+0x6600,
+0x3f00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ' (0x27):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ( (0x28):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |  **|
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |  **|
+   +----+ */
+0x0000,
+0x0000,
+0x3000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x3000,
+
+/* Character ) (0x29):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |**  |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |**  |
+   +----+ */
+0x0000,
+0x0000,
+0xc000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0xc000,
+
+/* Character * (0x2a):
+   ht=16, width=6
+   +------+
+   |      |
+   |      |
+   |  **  |
+   |  **  |
+   |******|
+   |  **  |
+   | **** |
+   | *  * |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x3000,
+0x3000,
+0xfc00,
+0x3000,
+0x7800,
+0x4800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character + (0x2b):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |********|
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0xff00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character , (0x2c):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   |**  |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0xc000,
+0x0000,
+0x0000,
+
+/* Character - (0x2d):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |****|
+   |****|
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xf000,
+0xf000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character . (0x2e):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |*** |
+   |*** |
+   |*** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xe000,
+0xe000,
+0xe000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character / (0x2f):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |  **|
+   |  **|
+   |  **|
+   |  **|
+   | ***|
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |*** |
+   |**  |
+   |**  |
+   |**  |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x3000,
+0x3000,
+0x3000,
+0x3000,
+0x7000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0xe000,
+0xc000,
+0xc000,
+0xc000,
+0x0000,
+
+/* Character 0 (0x30):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 1 (0x31):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   | ****   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x7800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 2 (0x32):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |     ** |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **     |
+   | **     |
+   | ****** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x6600,
+0x0600,
+0x0c00,
+0x1800,
+0x3000,
+0x6000,
+0x6000,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 3 (0x33):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   |     ** |
+   |     ** |
+   |   ***  |
+   |     ** |
+   |     ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x0600,
+0x0600,
+0x1c00,
+0x0600,
+0x0600,
+0x6600,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 4 (0x34):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | ****** |
+   | ****** |
+   |     ** |
+   |     ** |
+   |     ** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x7e00,
+0x7e00,
+0x0600,
+0x0600,
+0x0600,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 5 (0x35):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | ****** |
+   | **     |
+   | **     |
+   | **     |
+   | *****  |
+   | **  ** |
+   |     ** |
+   |     ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7e00,
+0x6000,
+0x6000,
+0x6000,
+0x7c00,
+0x6600,
+0x0600,
+0x0600,
+0x6600,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 6 (0x36):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **     |
+   | **     |
+   | *****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x6000,
+0x6000,
+0x7c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 7 (0x37):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | ****** |
+   |     ** |
+   |     ** |
+   |    **  |
+   |    **  |
+   | ****** |
+   |   **   |
+   |   **   |
+   |  **    |
+   |  **    |
+   |  **    |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7e00,
+0x0600,
+0x0600,
+0x0c00,
+0x0c00,
+0x7e00,
+0x1800,
+0x1800,
+0x3000,
+0x3000,
+0x3000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 8 (0x38):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character 9 (0x39):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |     ** |
+   |     ** |
+   |     ** |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3e00,
+0x0600,
+0x0600,
+0x0600,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character : (0x3a):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ; (0x3b):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   |**  |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0xc000,
+0x0000,
+0x0000,
+
+/* Character < (0x3c):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |     ** |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **     |
+   | **     |
+   |  **    |
+   |   **   |
+   |    **  |
+   |     ** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0600,
+0x0c00,
+0x1800,
+0x3000,
+0x6000,
+0x6000,
+0x3000,
+0x1800,
+0x0c00,
+0x0600,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character = (0x3d):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | ****** |
+   | ****** |
+   |        |
+   | ****** |
+   | ****** |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7e00,
+0x7e00,
+0x0000,
+0x7e00,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character > (0x3e):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | **     |
+   |  **    |
+   |   **   |
+   |    **  |
+   |     ** |
+   |     ** |
+   |    **  |
+   |   **   |
+   |  **    |
+   | **     |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x3000,
+0x1800,
+0x0c00,
+0x0600,
+0x0600,
+0x0c00,
+0x1800,
+0x3000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character ? (0x3f):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |     ** |
+   |    **  |
+   |   **   |
+   |   **   |
+   |        |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x6600,
+0x0600,
+0x0c00,
+0x1800,
+0x1800,
+0x0000,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character @ (0x40):
+   ht=16, width=14
+   +--------------+
+   |              |
+   |     ****     |
+   |   ***  ***   |
+   |  ***    ***  |
+   |  **  **  **  |
+   | **  ****  ** |
+   | **  ** ** ** |
+   | ** **  ** ** |
+   | ** **  ** ** |
+   | ** ** **  ** |
+   | **  ****  ** |
+   |  **  * ****  |
+   |  **          |
+   |   ***   ***  |
+   |     *****    |
+   |              |
+   +--------------+ */
+0x0000,
+0x0780,
+0x1ce0,
+0x3870,
+0x3330,
+0x6798,
+0x66d8,
+0x6cd8,
+0x6cd8,
+0x6d98,
+0x6798,
+0x32f0,
+0x3000,
+0x1c70,
+0x07c0,
+0x0000,
+
+/* Character A (0x41):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |  ****  |
+   |  *  *  |
+   | **  ** |
+   | ****** |
+   | ****** |
+   |***  ***|
+   |**    **|
+   |**    **|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x3c00,
+0x3c00,
+0x2400,
+0x6600,
+0x7e00,
+0x7e00,
+0xe700,
+0xc300,
+0xc300,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character B (0x42):
+   ht=16, width=10
+   +----------+
+   |          |
+   |          |
+   | *******  |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | *******  |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | *******  |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x7f00,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x7f00,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x7f00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character C (0x43):
+   ht=16, width=9
+   +---------+
+   |         |
+   |         |
+   |   ****  |
+   |  **  ** |
+   | **    * |
+   | **    * |
+   | **      |
+   | **      |
+   | **      |
+   | **    * |
+   | **    * |
+   |  **  ** |
+   |   ****  |
+   |         |
+   |         |
+   |         |
+   +---------+ */
+0x0000,
+0x0000,
+0x1e00,
+0x3300,
+0x6100,
+0x6100,
+0x6000,
+0x6000,
+0x6000,
+0x6100,
+0x6100,
+0x3300,
+0x1e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character D (0x44):
+   ht=16, width=10
+   +----------+
+   |          |
+   |          |
+   | ******   |
+   | **   **  |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **   **  |
+   | ******   |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x7e00,
+0x6300,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6300,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character E (0x45):
+   ht=16, width=9
+   +---------+
+   |         |
+   |         |
+   | ******* |
+   | **      |
+   | **      |
+   | **      |
+   | **      |
+   | ******* |
+   | **      |
+   | **      |
+   | **      |
+   | **      |
+   | ******* |
+   |         |
+   |         |
+   |         |
+   +---------+ */
+0x0000,
+0x0000,
+0x7f00,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x7f00,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x7f00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character F (0x46):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | *******|
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | *******|
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x7f00,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x7f00,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character G (0x47):
+   ht=16, width=10
+   +----------+
+   |          |
+   |          |
+   |   *****  |
+   |  **   ** |
+   | **     * |
+   | **     * |
+   | **       |
+   | **       |
+   | **  **** |
+   | **    ** |
+   | **    ** |
+   |  **   ** |
+   |   **** * |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x1f00,
+0x3180,
+0x6080,
+0x6080,
+0x6000,
+0x6000,
+0x6780,
+0x6180,
+0x6180,
+0x3180,
+0x1e80,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character H (0x48):
+   ht=16, width=10
+   +----------+
+   |          |
+   |          |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | ******** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x7f80,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character I (0x49):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character J (0x4a):
+   ht=16, width=7
+   +-------+
+   |       |
+   |       |
+   |    ** |
+   |    ** |
+   |    ** |
+   |    ** |
+   |    ** |
+   |    ** |
+   |    ** |
+   |**  ** |
+   |**  ** |
+   |**  ** |
+   | ****  |
+   |       |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0xcc00,
+0xcc00,
+0xcc00,
+0x7800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character K (0x4b):
+   ht=16, width=9
+   +---------+
+   |         |
+   |         |
+   | **    **|
+   | **   ** |
+   | **  **  |
+   | ** **   |
+   | ****    |
+   | ***     |
+   | ****    |
+   | ** **   |
+   | **  **  |
+   | **   ** |
+   | **    **|
+   |         |
+   |         |
+   |         |
+   +---------+ */
+0x0000,
+0x0000,
+0x6180,
+0x6300,
+0x6600,
+0x6c00,
+0x7800,
+0x7000,
+0x7800,
+0x6c00,
+0x6600,
+0x6300,
+0x6180,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character L (0x4c):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | *******|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x7f00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character M (0x4d):
+   ht=16, width=12
+   +------------+
+   |            |
+   |            |
+   | **      ** |
+   | **      ** |
+   | ***    *** |
+   | ***    *** |
+   | ****  **** |
+   | ****  **** |
+   | ** **** ** |
+   | ** **** ** |
+   | **  **  ** |
+   | **  **  ** |
+   | **      ** |
+   |            |
+   |            |
+   |            |
+   +------------+ */
+0x0000,
+0x0000,
+0x6060,
+0x6060,
+0x70e0,
+0x70e0,
+0x79e0,
+0x79e0,
+0x6f60,
+0x6f60,
+0x6660,
+0x6660,
+0x6060,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character N (0x4e):
+   ht=16, width=10
+   +----------+
+   |          |
+   |          |
+   | **    ** |
+   | ***   ** |
+   | ***   ** |
+   | ****  ** |
+   | ***** ** |
+   | ** ** ** |
+   | ** ***** |
+   | **  **** |
+   | **   *** |
+   | **   *** |
+   | **    ** |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x6180,
+0x7180,
+0x7180,
+0x7980,
+0x7d80,
+0x6d80,
+0x6f80,
+0x6780,
+0x6380,
+0x6380,
+0x6180,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character O (0x4f):
+   ht=16, width=10
+   +----------+
+   |          |
+   |          |
+   |   ****   |
+   |  **  **  |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   |  **  **  |
+   |   ****   |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x1e00,
+0x3300,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x3300,
+0x1e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character P (0x50):
+   ht=16, width=9
+   +---------+
+   |         |
+   |         |
+   | ******* |
+   | **    **|
+   | **    **|
+   | **    **|
+   | **    **|
+   | **    **|
+   | ******* |
+   | **      |
+   | **      |
+   | **      |
+   | **      |
+   |         |
+   |         |
+   |         |
+   +---------+ */
+0x0000,
+0x0000,
+0x7f00,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x7f00,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character Q (0x51):
+   ht=16, width=10
+   +----------+
+   |          |
+   |          |
+   |   ****   |
+   |  **  **  |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **  * ** |
+   | **  **** |
+   |  **  **  |
+   |   ****** |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x1e00,
+0x3300,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6580,
+0x6780,
+0x3300,
+0x1f80,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character R (0x52):
+   ht=16, width=10
+   +----------+
+   |          |
+   |          |
+   | *******  |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | *******  |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **     **|
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x7f00,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x7f00,
+0x6180,
+0x6180,
+0x6180,
+0x60c0,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character S (0x53):
+   ht=16, width=9
+   +---------+
+   |         |
+   |         |
+   |  *****  |
+   | **   ** |
+   | **   ** |
+   | **   ** |
+   |  ***    |
+   |    ***  |
+   |      ** |
+   | **   ** |
+   | **   ** |
+   | **   ** |
+   |  *****  |
+   |         |
+   |         |
+   |         |
+   +---------+ */
+0x0000,
+0x0000,
+0x3e00,
+0x6300,
+0x6300,
+0x6300,
+0x3800,
+0x0e00,
+0x0300,
+0x6300,
+0x6300,
+0x6300,
+0x3e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character T (0x54):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |********|
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xff00,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character U (0x55):
+   ht=16, width=10
+   +----------+
+   |          |
+   |          |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   |  **  **  |
+   |   ****   |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x3300,
+0x1e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character V (0x56):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |**    **|
+   |**    **|
+   |**    **|
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  *  *  |
+   |  ****  |
+   |  ****  |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc300,
+0xc300,
+0xc300,
+0x6600,
+0x6600,
+0x6600,
+0x2400,
+0x3c00,
+0x3c00,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character W (0x57):
+   ht=16, width=14
+   +--------------+
+   |              |
+   |              |
+   |**          **|
+   |**    **    **|
+   |**    **    **|
+   |**    **    **|
+   | **  ****  ** |
+   | **  ****  ** |
+   |  ** *  * **  |
+   |  ****  ****  |
+   |   **    **   |
+   |   **    **   |
+   |   **    **   |
+   |              |
+   |              |
+   |              |
+   +--------------+ */
+0x0000,
+0x0000,
+0xc00c,
+0xc30c,
+0xc30c,
+0xc30c,
+0x6798,
+0x6798,
+0x34b0,
+0x3cf0,
+0x1860,
+0x1860,
+0x1860,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character X (0x58):
+   ht=16, width=9
+   +---------+
+   |         |
+   |         |
+   |**     **|
+   |**     **|
+   | **   ** |
+   |  ** **  |
+   |   ***   |
+   |   ***   |
+   |   ***   |
+   |  ** **  |
+   | **   ** |
+   |**     **|
+   |**     **|
+   |         |
+   |         |
+   |         |
+   +---------+ */
+0x0000,
+0x0000,
+0xc180,
+0xc180,
+0x6300,
+0x3600,
+0x1c00,
+0x1c00,
+0x1c00,
+0x3600,
+0x6300,
+0xc180,
+0xc180,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character Y (0x59):
+   ht=16, width=10
+   +----------+
+   |          |
+   |          |
+   |**      **|
+   |**      **|
+   |**      **|
+   | **    ** |
+   |  **  **  |
+   |   ****   |
+   |    **    |
+   |    **    |
+   |    **    |
+   |    **    |
+   |    **    |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0xc0c0,
+0xc0c0,
+0xc0c0,
+0x6180,
+0x3300,
+0x1e00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character Z (0x5a):
+   ht=16, width=9
+   +---------+
+   |         |
+   |         |
+   |*********|
+   |       **|
+   |      ** |
+   |     **  |
+   |    **   |
+   |    *    |
+   |   **    |
+   |  **     |
+   | **      |
+   |**       |
+   |*********|
+   |         |
+   |         |
+   |         |
+   +---------+ */
+0x0000,
+0x0000,
+0xff80,
+0x0180,
+0x0300,
+0x0600,
+0x0c00,
+0x0800,
+0x1800,
+0x3000,
+0x6000,
+0xc000,
+0xff80,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character [ (0x5b):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   | ***|
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ***|
+   +----+ */
+0x0000,
+0x0000,
+0x7000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x7000,
+
+/* Character \ (0x5c):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |**  |
+   |**  |
+   |**  |
+   |**  |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |  **|
+   |  **|
+   |  **|
+   |  **|
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0xc000,
+0xc000,
+0xc000,
+0xc000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x3000,
+0x3000,
+0x3000,
+0x3000,
+0x0000,
+
+/* Character ] (0x5d):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |*** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |*** |
+   +----+ */
+0x0000,
+0x0000,
+0xe000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0xe000,
+
+/* Character ^ (0x5e):
+   ht=16, width=5
+   +-----+
+   |     |
+   |     |
+   |  *  |
+   | *** |
+   |*****|
+   |** **|
+   |*   *|
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x0000,
+0x2000,
+0x7000,
+0xf800,
+0xd800,
+0x8800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character _ (0x5f):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |********|
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xff00,
+
+/* Character ` (0x60):
+   ht=16, width=5
+   +-----+
+   |     |
+   | **  |
+   | *** |
+   |  ** |
+   |   **|
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x6000,
+0x7000,
+0x3000,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character a (0x61):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   | *   ** |
+   |   **** |
+   |  ** ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x4600,
+0x1e00,
+0x3600,
+0x6600,
+0x6600,
+0x3e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character b (0x62):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | *****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x7c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character c (0x63):
+   ht=16, width=7
+   +-------+
+   |       |
+   |       |
+   |       |
+   |       |
+   |       |
+   |  **** |
+   | **  **|
+   | **    |
+   | **    |
+   | **    |
+   | **    |
+   | **  **|
+   |  **** |
+   |       |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character d (0x64):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |     ** |
+   |     ** |
+   |     ** |
+   |     ** |
+   |  ***** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0600,
+0x0600,
+0x0600,
+0x0600,
+0x3e00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character e (0x65):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | ****** |
+   | **     |
+   | **     |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x7e00,
+0x6000,
+0x6000,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character f (0x66):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |  **|
+   | ** |
+   | ** |
+   | ** |
+   |****|
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x3000,
+0x6000,
+0x6000,
+0x6000,
+0xf000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character g (0x67):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |  ***** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |     ** |
+   | **  ** |
+   |  ****  |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3e00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3e00,
+0x0600,
+0x6600,
+0x3c00,
+
+/* Character h (0x68):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | **     |
+   | **     |
+   | **     |
+   | **     |
+   | *****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x7c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character i (0x69):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   | ** |
+   | ** |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character j (0x6a):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   | ** |
+   | ** |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |**  |
+   +----+ */
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0xc000,
+
+/* Character k (0x6b):
+   ht=16, width=7
+   +-------+
+   |       |
+   |       |
+   | **    |
+   | **    |
+   | **    |
+   | **    |
+   | **  **|
+   | ** ** |
+   | ****  |
+   | ***   |
+   | ****  |
+   | ** ** |
+   | **  **|
+   |       |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6600,
+0x6c00,
+0x7800,
+0x7000,
+0x7800,
+0x6c00,
+0x6600,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character l (0x6c):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character m (0x6d):
+   ht=16, width=12
+   +------------+
+   |            |
+   |            |
+   |            |
+   |            |
+   |            |
+   | *********  |
+   | **  **  ** |
+   | **  **  ** |
+   | **  **  ** |
+   | **  **  ** |
+   | **  **  ** |
+   | **  **  ** |
+   | **  **  ** |
+   |            |
+   |            |
+   |            |
+   +------------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7fc0,
+0x6660,
+0x6660,
+0x6660,
+0x6660,
+0x6660,
+0x6660,
+0x6660,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character n (0x6e):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | *****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character o (0x6f):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character p (0x70):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | *****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | *****  |
+   | **     |
+   | **     |
+   | **     |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x7c00,
+0x6000,
+0x6000,
+0x6000,
+
+/* Character q (0x71):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |  ***** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |     ** |
+   |     ** |
+   |     ** |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3e00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3e00,
+0x0600,
+0x0600,
+0x0600,
+
+/* Character r (0x72):
+   ht=16, width=5
+   +-----+
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   | ****|
+   | *** |
+   | **  |
+   | **  |
+   | **  |
+   | **  |
+   | **  |
+   | **  |
+   |     |
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7800,
+0x7000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character s (0x73):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **   * |
+   |  ***   |
+   |   ***  |
+   | *   ** |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x6200,
+0x3800,
+0x1c00,
+0x4600,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character t (0x74):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   |****|
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |  **|
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0xf000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x3000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character u (0x75):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character v (0x76):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |**    **|
+   |**    **|
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xc300,
+0xc300,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character w (0x77):
+   ht=16, width=10
+   +----------+
+   |          |
+   |          |
+   |          |
+   |          |
+   |          |
+   |**      **|
+   |**  **  **|
+   |**  **  **|
+   | ** ** ** |
+   | ** ** ** |
+   | ******** |
+   |  **  **  |
+   |  **  **  |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xc0c0,
+0xccc0,
+0xccc0,
+0x6d80,
+0x6d80,
+0x7f80,
+0x3300,
+0x3300,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character x (0x78):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |**    **|
+   | **  ** |
+   |  ****  |
+   |   **   |
+   |   **   |
+   |  ****  |
+   | **  ** |
+   |**    **|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xc300,
+0x6600,
+0x3c00,
+0x1800,
+0x1800,
+0x3c00,
+0x6600,
+0xc300,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character y (0x79):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |**    **|
+   |**    **|
+   |**    **|
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |  ****  |
+   |   **   |
+   |   **   |
+   |  **    |
+   | **     |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xc300,
+0xc300,
+0xc300,
+0x6600,
+0x6600,
+0x3c00,
+0x3c00,
+0x1800,
+0x1800,
+0x3000,
+0x6000,
+
+/* Character z (0x7a):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | ****** |
+   |     ** |
+   |    **  |
+   |   **   |
+   |   **   |
+   |  **    |
+   | **     |
+   | ****** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7e00,
+0x0600,
+0x0c00,
+0x1800,
+0x1800,
+0x3000,
+0x6000,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character { (0x7b):
+   ht=16, width=5
+   +-----+
+   |     |
+   |     |
+   |   **|
+   |  ** |
+   |  ** |
+   |  ** |
+   |  ** |
+   |  ** |
+   | **  |
+   | **  |
+   |  ** |
+   |  ** |
+   |  ** |
+   |  ** |
+   |  ** |
+   |   **|
+   +-----+ */
+0x0000,
+0x0000,
+0x1800,
+0x3000,
+0x3000,
+0x3000,
+0x3000,
+0x3000,
+0x6000,
+0x6000,
+0x3000,
+0x3000,
+0x3000,
+0x3000,
+0x3000,
+0x1800,
+
+/* Character | (0x7c):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   +----+ */
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+
+/* Character } (0x7d):
+   ht=16, width=5
+   +-----+
+   |     |
+   |     |
+   |**   |
+   | **  |
+   | **  |
+   | **  |
+   | **  |
+   | **  |
+   |  ** |
+   |  ** |
+   | **  |
+   | **  |
+   | **  |
+   | **  |
+   | **  |
+   |**   |
+   +-----+ */
+0x0000,
+0x0000,
+0xc000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x3000,
+0x3000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0xc000,
+
+/* Character ~ (0x7e):
+   ht=16, width=5
+   +-----+
+   |     |
+   |     |
+   |*** *|
+   |* ***|
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x0000,
+0xe800,
+0xb800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character  (0x7f):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x80):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x81):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x82):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x83):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x84):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x85):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x86):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x87):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x88):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x89):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x8a):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x8b):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x8c):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x8d):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x8e):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x8f):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x90):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x91):
+   ht=16, width=4
+   +----+
+   |    |
+   |  **|
+   |  **|
+   | ** |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x3000,
+0x3000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x92):
+   ht=16, width=4
+   +----+
+   |    |
+   | ** |
+   | ** |
+   |**  |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x6000,
+0x6000,
+0xc000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x93):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x94):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x95):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x96):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x97):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x98):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x99):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x9a):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x9b):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x9c):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x9d):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x9e):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0x9f):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa0):
+   ht=16, width=9
+   +---------+
+   |         |
+   |         |
+   |         |
+   |         |
+   |         |
+   |         |
+   |         |
+   |         |
+   |         |
+   |         |
+   |         |
+   |         |
+   |         |
+   |         |
+   |         |
+   |         |
+   +---------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa1):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   | ** |
+   | ** |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa2):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |    **  |
+   |  ****  |
+   | ** *** |
+   | ** *   |
+   | ** *   |
+   | ** *   |
+   | ***    |
+   | *** ** |
+   |  ****  |
+   |  **    |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0c00,
+0x3c00,
+0x6e00,
+0x6800,
+0x6800,
+0x6800,
+0x7000,
+0x7600,
+0x3c00,
+0x3000,
+0x0000,
+0x0000,
+
+/* Character � (0xa3):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ***   |
+   | ** **  |
+   | **     |
+   | **     |
+   | **     |
+   |  **    |
+   | ****   |
+   |  **    |
+   |  **    |
+   | **  ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3800,
+0x6c00,
+0x6000,
+0x6000,
+0x6000,
+0x3000,
+0x7800,
+0x3000,
+0x3000,
+0x6600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa4):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   | **  ** |
+   |  ****  |
+   |  *  *  |
+   |  *  *  |
+   |  *  *  |
+   |  ****  |
+   | **  ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x6600,
+0x3c00,
+0x2400,
+0x2400,
+0x2400,
+0x3c00,
+0x6600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa5):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |**    **|
+   |**    **|
+   |**    **|
+   | **  ** |
+   | **  ** |
+   |********|
+   |   **   |
+   |********|
+   |   **   |
+   |   **   |
+   |   **   |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0xc300,
+0xc300,
+0xc300,
+0x6600,
+0x6600,
+0xff00,
+0x1800,
+0xff00,
+0x1800,
+0x1800,
+0x1800,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa6):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   +----+ */
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+
+/* Character � (0xa7):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   |  *  *  |
+   |  ***   |
+   |  ***   |
+   | ** **  |
+   |  ** ** |
+   |   ***  |
+   |   ***  |
+   |  *  *  |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x2400,
+0x3800,
+0x3800,
+0x6c00,
+0x3600,
+0x1c00,
+0x1c00,
+0x2400,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+
+/* Character � (0xa8):
+   ht=16, width=5
+   +-----+
+   |     |
+   |     |
+   |** **|
+   |** **|
+   |** **|
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x0000,
+0xd800,
+0xd800,
+0xd800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xa9):
+   ht=16, width=10
+   +----------+
+   |          |
+   |          |
+   |  ******  |
+   | **    ** |
+   |**  **  **|
+   |** *  * **|
+   |** *  * **|
+   |** *    **|
+   |** *  * **|
+   |** *  * **|
+   |**  **  **|
+   | **    ** |
+   |  ******  |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x3f00,
+0x6180,
+0xccc0,
+0xd2c0,
+0xd2c0,
+0xd0c0,
+0xd2c0,
+0xd2c0,
+0xccc0,
+0x6180,
+0x3f00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xaa):
+   ht=16, width=5
+   +-----+
+   |     |
+   |     |
+   |     |
+   |  *  |
+   |   * |
+   |  ** |
+   | * * |
+   |  ** |
+   |     |
+   | *** |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x0000,
+0x0000,
+0x2000,
+0x1000,
+0x3000,
+0x5000,
+0x3000,
+0x0000,
+0x7000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xab):
+   ht=16, width=7
+   +-------+
+   |       |
+   |       |
+   |       |
+   |       |
+   |       |
+   |       |
+   |       |
+   |  ** **|
+   | ** ** |
+   |** **  |
+   | ** ** |
+   |  ** **|
+   |       |
+   |       |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3600,
+0x6c00,
+0xd800,
+0x6c00,
+0x3600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xac):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | ****** |
+   |     ** |
+   |     ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x7e00,
+0x0600,
+0x0600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xad):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |****|
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xf000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xae):
+   ht=16, width=10
+   +----------+
+   |          |
+   |          |
+   |  ******  |
+   | **    ** |
+   |** ***  **|
+   |** *  * **|
+   |** *  * **|
+   |** *  * **|
+   |** ***  **|
+   |** * *  **|
+   |** *  * **|
+   | **    ** |
+   |  ******  |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x3f00,
+0x6180,
+0xdcc0,
+0xd2c0,
+0xd2c0,
+0xd2c0,
+0xdcc0,
+0xd4c0,
+0xd2c0,
+0x6180,
+0x3f00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xaf):
+   ht=16, width=8
+   +--------+
+   |        |
+   |********|
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0xff00,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xb0):
+   ht=16, width=5
+   +-----+
+   |     |
+   |     |
+   |     |
+   | *** |
+   | * * |
+   | * * |
+   | *** |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x0000,
+0x0000,
+0x7000,
+0x5000,
+0x5000,
+0x7000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xb1):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   | ****** |
+   |   **   |
+   |   **   |
+   |        |
+   | ****** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x7e00,
+0x1800,
+0x1800,
+0x0000,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xb2):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   |* **|
+   |  **|
+   | ** |
+   |****|
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0xb000,
+0x3000,
+0x6000,
+0xf000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xb3):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   |* **|
+   | ** |
+   |* **|
+   | ** |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0xb000,
+0x6000,
+0xb000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xb4):
+   ht=16, width=5
+   +-----+
+   |     |
+   |     |
+   |  ***|
+   |  ** |
+   | **  |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x0000,
+0x3800,
+0x3000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xb5):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | *******|
+   | **     |
+   | **     |
+   | **     |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x7f00,
+0x6000,
+0x6000,
+0x6000,
+
+/* Character � (0xb6):
+   ht=16, width=7
+   +-------+
+   |       |
+   |       |
+   |       |
+   |  **** |
+   | ***** |
+   | ***** |
+   | ***** |
+   | ***** |
+   |  **** |
+   |    ** |
+   |    ** |
+   |    ** |
+   |    ** |
+   |       |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x0000,
+0x3c00,
+0x7c00,
+0x7c00,
+0x7c00,
+0x7c00,
+0x3c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xb7):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xb8):
+   ht=16, width=5
+   +-----+
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |  ** |
+   |   **|
+   | *** |
+   +-----+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3000,
+0x1800,
+0x7000,
+
+/* Character � (0xb9):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   | ** |
+   |*** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0xe000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xba):
+   ht=16, width=5
+   +-----+
+   |     |
+   |     |
+   |     |
+   | *** |
+   | * * |
+   | * * |
+   | * * |
+   | *** |
+   |     |
+   | *** |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   |     |
+   +-----+ */
+0x0000,
+0x0000,
+0x0000,
+0x7000,
+0x5000,
+0x5000,
+0x5000,
+0x7000,
+0x0000,
+0x7000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xbb):
+   ht=16, width=7
+   +-------+
+   |       |
+   |       |
+   |       |
+   |       |
+   |       |
+   |       |
+   |       |
+   |** **  |
+   | ** ** |
+   |  ** **|
+   | ** ** |
+   |** **  |
+   |       |
+   |       |
+   |       |
+   |       |
+   +-------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0xd800,
+0x6c00,
+0x3600,
+0x6c00,
+0xd800,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xbc):
+   ht=16, width=11
+   +-----------+
+   |           |
+   |           |
+   |           |
+   |  **     **|
+   | ***    ** |
+   |  **   **  |
+   |  **  **   |
+   |  ** **    |
+   |    **  ** |
+   |   **  *** |
+   |  **  ** * |
+   | **   **** |
+   |**      ** |
+   |           |
+   |           |
+   |           |
+   +-----------+ */
+0x0000,
+0x0000,
+0x0000,
+0x3060,
+0x70c0,
+0x3180,
+0x3300,
+0x3600,
+0x0cc0,
+0x19c0,
+0x3340,
+0x63c0,
+0xc0c0,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xbd):
+   ht=16, width=11
+   +-----------+
+   |           |
+   |           |
+   |           |
+   |  **     **|
+   | ***    ** |
+   |  **   **  |
+   |  **  **   |
+   |  ** **    |
+   |    ** **  |
+   |   ** * ** |
+   |  **    ** |
+   | **    **  |
+   |**    **** |
+   |           |
+   |           |
+   |           |
+   +-----------+ */
+0x0000,
+0x0000,
+0x0000,
+0x3060,
+0x70c0,
+0x3180,
+0x3300,
+0x3600,
+0x0d80,
+0x1ac0,
+0x30c0,
+0x6180,
+0xc3c0,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xbe):
+   ht=16, width=11
+   +-----------+
+   |           |
+   |           |
+   |           |
+   |  **     **|
+   | * **   ** |
+   |  **   **  |
+   | * ** **   |
+   |  ** **    |
+   |    **  ** |
+   |   **  *** |
+   |  **  ** * |
+   | **   **** |
+   |**      ** |
+   |           |
+   |           |
+   |           |
+   +-----------+ */
+0x0000,
+0x0000,
+0x0000,
+0x3060,
+0x58c0,
+0x3180,
+0x5b00,
+0x3600,
+0x0cc0,
+0x19c0,
+0x3340,
+0x63c0,
+0xc0c0,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xbf):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |   **   |
+   |   **   |
+   |        |
+   |   **   |
+   |   **   |
+   |  **    |
+   | **     |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x1800,
+0x1800,
+0x0000,
+0x1800,
+0x1800,
+0x3000,
+0x6000,
+0x6600,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc0):
+   ht=16, width=8
+   +--------+
+   |  ***   |
+   |   **   |
+   |    **  |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |  ****  |
+   |  *  *  |
+   | **  ** |
+   | **  ** |
+   | ****** |
+   |**    **|
+   |**    **|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x3800,
+0x1800,
+0x0c00,
+0x1800,
+0x1800,
+0x3c00,
+0x3c00,
+0x2400,
+0x6600,
+0x6600,
+0x7e00,
+0xc300,
+0xc300,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc1):
+   ht=16, width=8
+   +--------+
+   |   ***  |
+   |   **   |
+   |  **    |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |  ****  |
+   |  *  *  |
+   | **  ** |
+   | **  ** |
+   | ****** |
+   |**    **|
+   |**    **|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1c00,
+0x1800,
+0x3000,
+0x1800,
+0x1800,
+0x3c00,
+0x3c00,
+0x2400,
+0x6600,
+0x6600,
+0x7e00,
+0xc300,
+0xc300,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc2):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |  ****  |
+   | **  ** |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |  ****  |
+   |  *  *  |
+   | **  ** |
+   | **  ** |
+   | ****** |
+   |**    **|
+   |**    **|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x3c00,
+0x6600,
+0x1800,
+0x1800,
+0x3c00,
+0x3c00,
+0x2400,
+0x6600,
+0x6600,
+0x7e00,
+0xc300,
+0xc300,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc3):
+   ht=16, width=8
+   +--------+
+   | **** * |
+   | * **** |
+   |        |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |  ****  |
+   |  *  *  |
+   | **  ** |
+   | **  ** |
+   | ****** |
+   |**    **|
+   |**    **|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x7a00,
+0x5e00,
+0x0000,
+0x1800,
+0x1800,
+0x3c00,
+0x3c00,
+0x2400,
+0x6600,
+0x6600,
+0x7e00,
+0xc300,
+0xc300,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc4):
+   ht=16, width=8
+   +--------+
+   | **  ** |
+   | **  ** |
+   |        |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |  ****  |
+   |  *  *  |
+   | **  ** |
+   | **  ** |
+   | ****** |
+   |**    **|
+   |**    **|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x6600,
+0x6600,
+0x0000,
+0x1800,
+0x1800,
+0x3c00,
+0x3c00,
+0x2400,
+0x6600,
+0x6600,
+0x7e00,
+0xc300,
+0xc300,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc5):
+   ht=16, width=8
+   +--------+
+   |   **   |
+   |  ****  |
+   |   **   |
+   |        |
+   |   **   |
+   |   **   |
+   |  ****  |
+   |  *  *  |
+   | **  ** |
+   | **  ** |
+   | ****** |
+   |**    **|
+   |**    **|
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x1800,
+0x3c00,
+0x1800,
+0x0000,
+0x1800,
+0x1800,
+0x3c00,
+0x2400,
+0x6600,
+0x6600,
+0x7e00,
+0xc300,
+0xc300,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc6):
+   ht=16, width=13
+   +-------------+
+   |             |
+   |             |
+   |             |
+   |   ********* |
+   |   ****      |
+   |  ** **      |
+   |  ** **      |
+   |  ** ******  |
+   | **  **      |
+   | **  **      |
+   | ******      |
+   |**   **      |
+   |**   ******* |
+   |             |
+   |             |
+   |             |
+   +-------------+ */
+0x0000,
+0x0000,
+0x0000,
+0x1ff0,
+0x1e00,
+0x3600,
+0x3600,
+0x37e0,
+0x6600,
+0x6600,
+0x7e00,
+0xc600,
+0xc7f0,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc7):
+   ht=16, width=9
+   +---------+
+   |         |
+   |         |
+   |         |
+   |   ****  |
+   |  **  ** |
+   | **    * |
+   | **      |
+   | **      |
+   | **      |
+   | **      |
+   | **    * |
+   |  **  ** |
+   |   ****  |
+   |    **   |
+   |     **  |
+   |   ***   |
+   +---------+ */
+0x0000,
+0x0000,
+0x0000,
+0x1e00,
+0x3300,
+0x6100,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6100,
+0x3300,
+0x1e00,
+0x0c00,
+0x0600,
+0x1c00,
+
+/* Character � (0xc8):
+   ht=16, width=9
+   +---------+
+   |   ***   |
+   |    **   |
+   |     **  |
+   | ******* |
+   | **      |
+   | **      |
+   | **      |
+   | ******  |
+   | **      |
+   | **      |
+   | **      |
+   | **      |
+   | ******* |
+   |         |
+   |         |
+   |         |
+   +---------+ */
+0x1c00,
+0x0c00,
+0x0600,
+0x7f00,
+0x6000,
+0x6000,
+0x6000,
+0x7e00,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x7f00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xc9):
+   ht=16, width=9
+   +---------+
+   |    ***  |
+   |    **   |
+   |   **    |
+   | ******* |
+   | **      |
+   | **      |
+   | **      |
+   | ******  |
+   | **      |
+   | **      |
+   | **      |
+   | **      |
+   | ******* |
+   |         |
+   |         |
+   |         |
+   +---------+ */
+0x0e00,
+0x0c00,
+0x1800,
+0x7f00,
+0x6000,
+0x6000,
+0x6000,
+0x7e00,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x7f00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xca):
+   ht=16, width=9
+   +---------+
+   |    **   |
+   |   ****  |
+   |  **  ** |
+   | ******* |
+   | **      |
+   | **      |
+   | **      |
+   | ******  |
+   | **      |
+   | **      |
+   | **      |
+   | **      |
+   | ******* |
+   |         |
+   |         |
+   |         |
+   +---------+ */
+0x0c00,
+0x1e00,
+0x3300,
+0x7f00,
+0x6000,
+0x6000,
+0x6000,
+0x7e00,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x7f00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xcb):
+   ht=16, width=9
+   +---------+
+   |  **  ** |
+   |  **  ** |
+   |         |
+   | ******* |
+   | **      |
+   | **      |
+   | **      |
+   | ******  |
+   | **      |
+   | **      |
+   | **      |
+   | **      |
+   | ******* |
+   |         |
+   |         |
+   |         |
+   +---------+ */
+0x3300,
+0x3300,
+0x0000,
+0x7f00,
+0x6000,
+0x6000,
+0x6000,
+0x7e00,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x7f00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xcc):
+   ht=16, width=4
+   +----+
+   |**  |
+   | ** |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0xc000,
+0x6000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xcd):
+   ht=16, width=4
+   +----+
+   |  **|
+   | ** |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x3000,
+0x6000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xce):
+   ht=16, width=4
+   +----+
+   | ** |
+   |*  *|
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x6000,
+0x9000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xcf):
+   ht=16, width=4
+   +----+
+   |*  *|
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x9000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd0):
+   ht=16, width=10
+   +----------+
+   |          |
+   |          |
+   |          |
+   | ******   |
+   | **   **  |
+   | **    ** |
+   | **    ** |
+   |*****  ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **   **  |
+   | ******   |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x0000,
+0x7e00,
+0x6300,
+0x6180,
+0x6180,
+0xf980,
+0x6180,
+0x6180,
+0x6180,
+0x6300,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd1):
+   ht=16, width=10
+   +----------+
+   |  **** *  |
+   |  * ****  |
+   |          |
+   | **    ** |
+   | ***   ** |
+   | ****  ** |
+   | ****  ** |
+   | ** ** ** |
+   | ** ** ** |
+   | **  **** |
+   | **  **** |
+   | **   *** |
+   | **    ** |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x3d00,
+0x2f00,
+0x0000,
+0x6180,
+0x7180,
+0x7980,
+0x7980,
+0x6d80,
+0x6d80,
+0x6780,
+0x6780,
+0x6380,
+0x6180,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd2):
+   ht=16, width=10
+   +----------+
+   |   ***    |
+   |    **    |
+   |     **   |
+   |   ****   |
+   |  **  **  |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   |  **  **  |
+   |   ****   |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x1c00,
+0x0c00,
+0x0600,
+0x1e00,
+0x3300,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x3300,
+0x1e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd3):
+   ht=16, width=10
+   +----------+
+   |    ***   |
+   |    **    |
+   |   **     |
+   |   ****   |
+   |  **  **  |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   |  **  **  |
+   |   ****   |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0e00,
+0x0c00,
+0x1800,
+0x1e00,
+0x3300,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x3300,
+0x1e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd4):
+   ht=16, width=10
+   +----------+
+   |    **    |
+   |   ****   |
+   |  **  **  |
+   |   ****   |
+   |  **  **  |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   |  **  **  |
+   |   ****   |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0c00,
+0x1e00,
+0x3300,
+0x1e00,
+0x3300,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x3300,
+0x1e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd5):
+   ht=16, width=10
+   +----------+
+   |  **** *  |
+   |  * ****  |
+   |          |
+   |   ****   |
+   |  **  **  |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   |  **  **  |
+   |   ****   |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x3d00,
+0x2f00,
+0x0000,
+0x1e00,
+0x3300,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x3300,
+0x1e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd6):
+   ht=16, width=10
+   +----------+
+   |  **  **  |
+   |  **  **  |
+   |          |
+   |   ****   |
+   |  **  **  |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   |  **  **  |
+   |   ****   |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x3300,
+0x3300,
+0x0000,
+0x1e00,
+0x3300,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x3300,
+0x1e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd7):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   | **  ** |
+   |  ****  |
+   |   **   |
+   |  ****  |
+   | **  ** |
+   |        |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x6600,
+0x3c00,
+0x1800,
+0x3c00,
+0x6600,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd8):
+   ht=16, width=10
+   +----------+
+   |          |
+   |          |
+   |          |
+   |   ****** |
+   |  **  **  |
+   | **   *** |
+   | **  **** |
+   | ** ** ** |
+   | ** ** ** |
+   | ****  ** |
+   | ***   ** |
+   |  **  **  |
+   | ******   |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0000,
+0x0000,
+0x0000,
+0x1f80,
+0x3300,
+0x6380,
+0x6780,
+0x6d80,
+0x6d80,
+0x7980,
+0x7180,
+0x3300,
+0x7e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xd9):
+   ht=16, width=10
+   +----------+
+   |   ***    |
+   |    **    |
+   |     **   |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   |  **  **  |
+   |   ****   |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x1c00,
+0x0c00,
+0x0600,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x3300,
+0x1e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xda):
+   ht=16, width=10
+   +----------+
+   |    ***   |
+   |    **    |
+   |   **     |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   |  **  **  |
+   |   ****   |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0e00,
+0x0c00,
+0x1800,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x3300,
+0x1e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xdb):
+   ht=16, width=10
+   +----------+
+   |    **    |
+   |   ****   |
+   |  **  **  |
+   |          |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   |  **  **  |
+   |   ****   |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0c00,
+0x1e00,
+0x3300,
+0x0000,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x3300,
+0x1e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xdc):
+   ht=16, width=10
+   +----------+
+   |  **  **  |
+   |  **  **  |
+   |          |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   | **    ** |
+   |  **  **  |
+   |   ****   |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x3300,
+0x3300,
+0x0000,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x6180,
+0x3300,
+0x1e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xdd):
+   ht=16, width=10
+   +----------+
+   |    ***   |
+   |    **    |
+   |   **     |
+   |**      **|
+   |**      **|
+   | **    ** |
+   |  **  **  |
+   |   ****   |
+   |    **    |
+   |    **    |
+   |    **    |
+   |    **    |
+   |    **    |
+   |          |
+   |          |
+   |          |
+   +----------+ */
+0x0e00,
+0x0c00,
+0x1800,
+0xc0c0,
+0xc0c0,
+0x6180,
+0x3300,
+0x1e00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xde):
+   ht=16, width=9
+   +---------+
+   |         |
+   |         |
+   |         |
+   | **      |
+   | **      |
+   | ******  |
+   | **   ** |
+   | **   ** |
+   | **   ** |
+   | **   ** |
+   | ******  |
+   | **      |
+   | **      |
+   |         |
+   |         |
+   |         |
+   +---------+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x7e00,
+0x6300,
+0x6300,
+0x6300,
+0x6300,
+0x7e00,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xdf):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | ** **  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | ** **  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x6600,
+0x6c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe0):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ***   |
+   |   **   |
+   |    **  |
+   |        |
+   |  ****  |
+   | **  ** |
+   |   **** |
+   |  ** ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3800,
+0x1800,
+0x0c00,
+0x0000,
+0x3c00,
+0x6600,
+0x1e00,
+0x3600,
+0x6600,
+0x6600,
+0x3e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe1):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   ***  |
+   |   **   |
+   |  **    |
+   |        |
+   |  ****  |
+   | **  ** |
+   |   **** |
+   |  ** ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1c00,
+0x1800,
+0x3000,
+0x0000,
+0x3c00,
+0x6600,
+0x1e00,
+0x3600,
+0x6600,
+0x6600,
+0x3e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe2):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |  ****  |
+   | **  ** |
+   |        |
+   |  ****  |
+   | **  ** |
+   |   **** |
+   |  ** ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x3c00,
+0x6600,
+0x0000,
+0x3c00,
+0x6600,
+0x1e00,
+0x3600,
+0x6600,
+0x6600,
+0x3e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe3):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | **** * |
+   | * **** |
+   |        |
+   |  ****  |
+   | **  ** |
+   |   **** |
+   |  ** ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x7a00,
+0x5e00,
+0x0000,
+0x3c00,
+0x6600,
+0x1e00,
+0x3600,
+0x6600,
+0x6600,
+0x3e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe4):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | **  ** |
+   | **  ** |
+   |        |
+   |  ****  |
+   | **  ** |
+   |   **** |
+   |  ** ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x6600,
+0x6600,
+0x0000,
+0x3c00,
+0x6600,
+0x1e00,
+0x3600,
+0x6600,
+0x6600,
+0x3e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe5):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |  ****  |
+   |   **   |
+   |        |
+   |  ****  |
+   | **  ** |
+   |   **** |
+   |  ** ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x3c00,
+0x1800,
+0x0000,
+0x3c00,
+0x6600,
+0x1e00,
+0x3600,
+0x6600,
+0x6600,
+0x3e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe6):
+   ht=16, width=12
+   +------------+
+   |            |
+   |            |
+   |            |
+   |            |
+   |            |
+   |            |
+   |  ********  |
+   | **  **  ** |
+   |   ******** |
+   |  ** **     |
+   | **  **     |
+   | **  **  ** |
+   |  ********  |
+   |            |
+   |            |
+   |            |
+   +------------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3fc0,
+0x6660,
+0x1fe0,
+0x3600,
+0x6600,
+0x6660,
+0x3fc0,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe7):
+   ht=16, width=7
+   +-------+
+   |       |
+   |       |
+   |       |
+   |       |
+   |       |
+   |       |
+   |  **** |
+   | **  **|
+   | **    |
+   | **    |
+   | **    |
+   | **  **|
+   |  **** |
+   |   **  |
+   |    ** |
+   |  ***  |
+   +-------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3c00,
+0x6600,
+0x6000,
+0x6000,
+0x6000,
+0x6600,
+0x3c00,
+0x1800,
+0x0c00,
+0x3800,
+
+/* Character � (0xe8):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ***   |
+   |   **   |
+   |    **  |
+   |        |
+   |  ****  |
+   | **  ** |
+   | ****** |
+   | **     |
+   | **     |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3800,
+0x1800,
+0x0c00,
+0x0000,
+0x3c00,
+0x6600,
+0x7e00,
+0x6000,
+0x6000,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xe9):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   ***  |
+   |   **   |
+   |  **    |
+   |        |
+   |  ****  |
+   | **  ** |
+   | ****** |
+   | **     |
+   | **     |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1c00,
+0x1800,
+0x3000,
+0x0000,
+0x3c00,
+0x6600,
+0x7e00,
+0x6000,
+0x6000,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xea):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |  ****  |
+   | **  ** |
+   |        |
+   |  ****  |
+   | **  ** |
+   | ****** |
+   | **     |
+   | **     |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x3c00,
+0x6600,
+0x0000,
+0x3c00,
+0x6600,
+0x7e00,
+0x6000,
+0x6000,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xeb):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | **  ** |
+   | **  ** |
+   |        |
+   |  ****  |
+   | **  ** |
+   | ****** |
+   | **     |
+   | **     |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x6600,
+0x6600,
+0x0000,
+0x3c00,
+0x6600,
+0x7e00,
+0x6000,
+0x6000,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xec):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |*** |
+   | ** |
+   |  **|
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0xe000,
+0x6000,
+0x3000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xed):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   | ***|
+   | ** |
+   |**  |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x7000,
+0x6000,
+0xc000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xee):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   | ** |
+   |****|
+   |    |
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x6000,
+0xf000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xef):
+   ht=16, width=4
+   +----+
+   |    |
+   |    |
+   |    |
+   |*  *|
+   |*  *|
+   |    |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   | ** |
+   |    |
+   |    |
+   |    |
+   +----+ */
+0x0000,
+0x0000,
+0x0000,
+0x9000,
+0x9000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x6000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf0):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | *** ** |
+   |   **   |
+   | ** **  |
+   |    **  |
+   |  ***** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x7600,
+0x1800,
+0x6c00,
+0x0c00,
+0x3e00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf1):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | **** * |
+   | * **** |
+   |        |
+   | *****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x7a00,
+0x5e00,
+0x0000,
+0x7c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf2):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ***   |
+   |   **   |
+   |    **  |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3800,
+0x1800,
+0x0c00,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf3):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   ***  |
+   |   **   |
+   |  **    |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1c00,
+0x1800,
+0x3000,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf4):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |  ****  |
+   | **  ** |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x3c00,
+0x6600,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf5):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | **** * |
+   | * **** |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x7a00,
+0x5e00,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf6):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | **  ** |
+   | **  ** |
+   |        |
+   |  ****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x6600,
+0x6600,
+0x0000,
+0x3c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf7):
+   ht=16, width=6
+   +------+
+   |      |
+   |      |
+   |      |
+   |      |
+   |      |
+   |  **  |
+   |  **  |
+   |      |
+   | **** |
+   |      |
+   |  **  |
+   |  **  |
+   |      |
+   |      |
+   |      |
+   |      |
+   +------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3000,
+0x3000,
+0x0000,
+0x7800,
+0x0000,
+0x3000,
+0x3000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf8):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |        |
+   |  ***** |
+   | ** *** |
+   | ** *** |
+   | **  ** |
+   | *** ** |
+   | *** ** |
+   | *****  |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x0000,
+0x3e00,
+0x6e00,
+0x6e00,
+0x6600,
+0x7600,
+0x7600,
+0x7c00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xf9):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |  ***   |
+   |   **   |
+   |    **  |
+   |        |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x3800,
+0x1800,
+0x0c00,
+0x0000,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xfa):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   ***  |
+   |   **   |
+   |  **    |
+   |        |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1c00,
+0x1800,
+0x3000,
+0x0000,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xfb):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   **   |
+   |  ****  |
+   | **  ** |
+   |        |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x1800,
+0x3c00,
+0x6600,
+0x0000,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xfc):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | **  ** |
+   | **  ** |
+   |        |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   |  ***** |
+   |        |
+   |        |
+   |        |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x6600,
+0x6600,
+0x0000,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x3e00,
+0x0000,
+0x0000,
+0x0000,
+
+/* Character � (0xfd):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |   ***  |
+   |   **   |
+   |  **    |
+   |        |
+   |**    **|
+   |**    **|
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |  ****  |
+   |   **   |
+   |   **   |
+   |  **    |
+   | **     |
+   +--------+ */
+0x0000,
+0x0000,
+0x1c00,
+0x1800,
+0x3000,
+0x0000,
+0xc300,
+0xc300,
+0x6600,
+0x6600,
+0x3c00,
+0x3c00,
+0x1800,
+0x1800,
+0x3000,
+0x6000,
+
+/* Character � (0xfe):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | **     |
+   | **     |
+   | **     |
+   | *****  |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | **  ** |
+   | *****  |
+   | **     |
+   | **     |
+   | **     |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x6000,
+0x6000,
+0x6000,
+0x7c00,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x6600,
+0x7c00,
+0x6000,
+0x6000,
+0x6000,
+
+/* Character � (0xff):
+   ht=16, width=8
+   +--------+
+   |        |
+   |        |
+   |        |
+   | **  ** |
+   | **  ** |
+   |        |
+   |**    **|
+   |**    **|
+   | **  ** |
+   | **  ** |
+   |  ****  |
+   |  ****  |
+   |   **   |
+   |   **   |
+   |  **    |
+   | **     |
+   +--------+ */
+0x0000,
+0x0000,
+0x0000,
+0x6600,
+0x6600,
+0x0000,
+0xc300,
+0xc300,
+0x6600,
+0x6600,
+0x3c00,
+0x3c00,
+0x1800,
+0x1800,
+0x3000,
+0x6000,
+
+};
+
+/* Character->glyph data. */
+static unsigned short winFreeSystem14x16_offset[] = {
+  0,	 /*   (0x20) */
+  16,	 /* ! (0x21) */
+  32,	 /* " (0x22) */
+  48,	 /* # (0x23) */
+  64,	 /* $ (0x24) */
+  80,	 /* % (0x25) */
+  96,	 /* & (0x26) */
+  112,	 /* ' (0x27) */
+  128,	 /* ( (0x28) */
+  144,	 /* ) (0x29) */
+  160,	 /* * (0x2a) */
+  176,	 /* + (0x2b) */
+  192,	 /* , (0x2c) */
+  208,	 /* - (0x2d) */
+  224,	 /* . (0x2e) */
+  240,	 /* / (0x2f) */
+  256,	 /* 0 (0x30) */
+  272,	 /* 1 (0x31) */
+  288,	 /* 2 (0x32) */
+  304,	 /* 3 (0x33) */
+  320,	 /* 4 (0x34) */
+  336,	 /* 5 (0x35) */
+  352,	 /* 6 (0x36) */
+  368,	 /* 7 (0x37) */
+  384,	 /* 8 (0x38) */
+  400,	 /* 9 (0x39) */
+  416,	 /* : (0x3a) */
+  432,	 /* ; (0x3b) */
+  448,	 /* < (0x3c) */
+  464,	 /* = (0x3d) */
+  480,	 /* > (0x3e) */
+  496,	 /* ? (0x3f) */
+  512,	 /* @ (0x40) */
+  528,	 /* A (0x41) */
+  544,	 /* B (0x42) */
+  560,	 /* C (0x43) */
+  576,	 /* D (0x44) */
+  592,	 /* E (0x45) */
+  608,	 /* F (0x46) */
+  624,	 /* G (0x47) */
+  640,	 /* H (0x48) */
+  656,	 /* I (0x49) */
+  672,	 /* J (0x4a) */
+  688,	 /* K (0x4b) */
+  704,	 /* L (0x4c) */
+  720,	 /* M (0x4d) */
+  736,	 /* N (0x4e) */
+  752,	 /* O (0x4f) */
+  768,	 /* P (0x50) */
+  784,	 /* Q (0x51) */
+  800,	 /* R (0x52) */
+  816,	 /* S (0x53) */
+  832,	 /* T (0x54) */
+  848,	 /* U (0x55) */
+  864,	 /* V (0x56) */
+  880,	 /* W (0x57) */
+  896,	 /* X (0x58) */
+  912,	 /* Y (0x59) */
+  928,	 /* Z (0x5a) */
+  944,	 /* [ (0x5b) */
+  960,	 /* \ (0x5c) */
+  976,	 /* ] (0x5d) */
+  992,	 /* ^ (0x5e) */
+  1008,	 /* _ (0x5f) */
+  1024,	 /* ` (0x60) */
+  1040,	 /* a (0x61) */
+  1056,	 /* b (0x62) */
+  1072,	 /* c (0x63) */
+  1088,	 /* d (0x64) */
+  1104,	 /* e (0x65) */
+  1120,	 /* f (0x66) */
+  1136,	 /* g (0x67) */
+  1152,	 /* h (0x68) */
+  1168,	 /* i (0x69) */
+  1184,	 /* j (0x6a) */
+  1200,	 /* k (0x6b) */
+  1216,	 /* l (0x6c) */
+  1232,	 /* m (0x6d) */
+  1248,	 /* n (0x6e) */
+  1264,	 /* o (0x6f) */
+  1280,	 /* p (0x70) */
+  1296,	 /* q (0x71) */
+  1312,	 /* r (0x72) */
+  1328,	 /* s (0x73) */
+  1344,	 /* t (0x74) */
+  1360,	 /* u (0x75) */
+  1376,	 /* v (0x76) */
+  1392,	 /* w (0x77) */
+  1408,	 /* x (0x78) */
+  1424,	 /* y (0x79) */
+  1440,	 /* z (0x7a) */
+  1456,	 /* { (0x7b) */
+  1472,	 /* | (0x7c) */
+  1488,	 /* } (0x7d) */
+  1504,	 /* ~ (0x7e) */
+  1520,	 /*  (0x7f) */
+  1536,	 /* � (0x80) */
+  1552,	 /* � (0x81) */
+  1568,	 /* � (0x82) */
+  1584,	 /* � (0x83) */
+  1600,	 /* � (0x84) */
+  1616,	 /* � (0x85) */
+  1632,	 /* � (0x86) */
+  1648,	 /* � (0x87) */
+  1664,	 /* � (0x88) */
+  1680,	 /* � (0x89) */
+  1696,	 /* � (0x8a) */
+  1712,	 /* � (0x8b) */
+  1728,	 /* � (0x8c) */
+  1744,	 /* � (0x8d) */
+  1760,	 /* � (0x8e) */
+  1776,	 /* � (0x8f) */
+  1792,	 /* � (0x90) */
+  1808,	 /* � (0x91) */
+  1824,	 /* � (0x92) */
+  1840,	 /* � (0x93) */
+  1856,	 /* � (0x94) */
+  1872,	 /* � (0x95) */
+  1888,	 /* � (0x96) */
+  1904,	 /* � (0x97) */
+  1920,	 /* � (0x98) */
+  1936,	 /* � (0x99) */
+  1952,	 /* � (0x9a) */
+  1968,	 /* � (0x9b) */
+  1984,	 /* � (0x9c) */
+  2000,	 /* � (0x9d) */
+  2016,	 /* � (0x9e) */
+  2032,	 /* � (0x9f) */
+  2048,	 /* � (0xa0) */
+  2064,	 /* � (0xa1) */
+  2080,	 /* � (0xa2) */
+  2096,	 /* � (0xa3) */
+  2112,	 /* � (0xa4) */
+  2128,	 /* � (0xa5) */
+  2144,	 /* � (0xa6) */
+  2160,	 /* � (0xa7) */
+  2176,	 /* � (0xa8) */
+  2192,	 /* � (0xa9) */
+  2208,	 /* � (0xaa) */
+  2224,	 /* � (0xab) */
+  2240,	 /* � (0xac) */
+  2256,	 /* � (0xad) */
+  2272,	 /* � (0xae) */
+  2288,	 /* � (0xaf) */
+  2304,	 /* � (0xb0) */
+  2320,	 /* � (0xb1) */
+  2336,	 /* � (0xb2) */
+  2352,	 /* � (0xb3) */
+  2368,	 /* � (0xb4) */
+  2384,	 /* � (0xb5) */
+  2400,	 /* � (0xb6) */
+  2416,	 /* � (0xb7) */
+  2432,	 /* � (0xb8) */
+  2448,	 /* � (0xb9) */
+  2464,	 /* � (0xba) */
+  2480,	 /* � (0xbb) */
+  2496,	 /* � (0xbc) */
+  2512,	 /* � (0xbd) */
+  2528,	 /* � (0xbe) */
+  2544,	 /* � (0xbf) */
+  2560,	 /* � (0xc0) */
+  2576,	 /* � (0xc1) */
+  2592,	 /* � (0xc2) */
+  2608,	 /* � (0xc3) */
+  2624,	 /* � (0xc4) */
+  2640,	 /* � (0xc5) */
+  2656,	 /* � (0xc6) */
+  2672,	 /* � (0xc7) */
+  2688,	 /* � (0xc8) */
+  2704,	 /* � (0xc9) */
+  2720,	 /* � (0xca) */
+  2736,	 /* � (0xcb) */
+  2752,	 /* � (0xcc) */
+  2768,	 /* � (0xcd) */
+  2784,	 /* � (0xce) */
+  2800,	 /* � (0xcf) */
+  2816,	 /* � (0xd0) */
+  2832,	 /* � (0xd1) */
+  2848,	 /* � (0xd2) */
+  2864,	 /* � (0xd3) */
+  2880,	 /* � (0xd4) */
+  2896,	 /* � (0xd5) */
+  2912,	 /* � (0xd6) */
+  2928,	 /* � (0xd7) */
+  2944,	 /* � (0xd8) */
+  2960,	 /* � (0xd9) */
+  2976,	 /* � (0xda) */
+  2992,	 /* � (0xdb) */
+  3008,	 /* � (0xdc) */
+  3024,	 /* � (0xdd) */
+  3040,	 /* � (0xde) */
+  3056,	 /* � (0xdf) */
+  3072,	 /* � (0xe0) */
+  3088,	 /* � (0xe1) */
+  3104,	 /* � (0xe2) */
+  3120,	 /* � (0xe3) */
+  3136,	 /* � (0xe4) */
+  3152,	 /* � (0xe5) */
+  3168,	 /* � (0xe6) */
+  3184,	 /* � (0xe7) */
+  3200,	 /* � (0xe8) */
+  3216,	 /* � (0xe9) */
+  3232,	 /* � (0xea) */
+  3248,	 /* � (0xeb) */
+  3264,	 /* � (0xec) */
+  3280,	 /* � (0xed) */
+  3296,	 /* � (0xee) */
+  3312,	 /* � (0xef) */
+  3328,	 /* � (0xf0) */
+  3344,	 /* � (0xf1) */
+  3360,	 /* � (0xf2) */
+  3376,	 /* � (0xf3) */
+  3392,	 /* � (0xf4) */
+  3408,	 /* � (0xf5) */
+  3424,	 /* � (0xf6) */
+  3440,	 /* � (0xf7) */
+  3456,	 /* � (0xf8) */
+  3472,	 /* � (0xf9) */
+  3488,	 /* � (0xfa) */
+  3504,	 /* � (0xfb) */
+  3520,	 /* � (0xfc) */
+  3536,	 /* � (0xfd) */
+  3552,	 /* � (0xfe) */
+  3568,	 /* � (0xff) */
+};
+
+/* Character width data. */
+static unsigned char winFreeSystem14x16_width[] = {
+  4,	 /*   (0x20) */
+  4,	 /* ! (0x21) */
+  6,	 /* " (0x22) */
+  8,	 /* # (0x23) */
+  8,	 /* $ (0x24) */
+  11,	 /* % (0x25) */
+  9,	 /* & (0x26) */
+  4,	 /* ' (0x27) */
+  4,	 /* ( (0x28) */
+  4,	 /* ) (0x29) */
+  6,	 /* * (0x2a) */
+  8,	 /* + (0x2b) */
+  4,	 /* , (0x2c) */
+  4,	 /* - (0x2d) */
+  4,	 /* . (0x2e) */
+  4,	 /* / (0x2f) */
+  8,	 /* 0 (0x30) */
+  8,	 /* 1 (0x31) */
+  8,	 /* 2 (0x32) */
+  8,	 /* 3 (0x33) */
+  8,	 /* 4 (0x34) */
+  8,	 /* 5 (0x35) */
+  8,	 /* 6 (0x36) */
+  8,	 /* 7 (0x37) */
+  8,	 /* 8 (0x38) */
+  8,	 /* 9 (0x39) */
+  4,	 /* : (0x3a) */
+  4,	 /* ; (0x3b) */
+  8,	 /* < (0x3c) */
+  8,	 /* = (0x3d) */
+  8,	 /* > (0x3e) */
+  8,	 /* ? (0x3f) */
+  14,	 /* @ (0x40) */
+  8,	 /* A (0x41) */
+  10,	 /* B (0x42) */
+  9,	 /* C (0x43) */
+  10,	 /* D (0x44) */
+  9,	 /* E (0x45) */
+  8,	 /* F (0x46) */
+  10,	 /* G (0x47) */
+  10,	 /* H (0x48) */
+  4,	 /* I (0x49) */
+  7,	 /* J (0x4a) */
+  9,	 /* K (0x4b) */
+  8,	 /* L (0x4c) */
+  12,	 /* M (0x4d) */
+  10,	 /* N (0x4e) */
+  10,	 /* O (0x4f) */
+  9,	 /* P (0x50) */
+  10,	 /* Q (0x51) */
+  10,	 /* R (0x52) */
+  9,	 /* S (0x53) */
+  8,	 /* T (0x54) */
+  10,	 /* U (0x55) */
+  8,	 /* V (0x56) */
+  14,	 /* W (0x57) */
+  9,	 /* X (0x58) */
+  10,	 /* Y (0x59) */
+  9,	 /* Z (0x5a) */
+  4,	 /* [ (0x5b) */
+  4,	 /* \ (0x5c) */
+  4,	 /* ] (0x5d) */
+  5,	 /* ^ (0x5e) */
+  8,	 /* _ (0x5f) */
+  5,	 /* ` (0x60) */
+  8,	 /* a (0x61) */
+  8,	 /* b (0x62) */
+  7,	 /* c (0x63) */
+  8,	 /* d (0x64) */
+  8,	 /* e (0x65) */
+  4,	 /* f (0x66) */
+  8,	 /* g (0x67) */
+  8,	 /* h (0x68) */
+  4,	 /* i (0x69) */
+  4,	 /* j (0x6a) */
+  7,	 /* k (0x6b) */
+  4,	 /* l (0x6c) */
+  12,	 /* m (0x6d) */
+  8,	 /* n (0x6e) */
+  8,	 /* o (0x6f) */
+  8,	 /* p (0x70) */
+  8,	 /* q (0x71) */
+  5,	 /* r (0x72) */
+  8,	 /* s (0x73) */
+  4,	 /* t (0x74) */
+  8,	 /* u (0x75) */
+  8,	 /* v (0x76) */
+  10,	 /* w (0x77) */
+  8,	 /* x (0x78) */
+  8,	 /* y (0x79) */
+  8,	 /* z (0x7a) */
+  5,	 /* { (0x7b) */
+  4,	 /* | (0x7c) */
+  5,	 /* } (0x7d) */
+  5,	 /* ~ (0x7e) */
+  4,	 /*  (0x7f) */
+  4,	 /* � (0x80) */
+  4,	 /* � (0x81) */
+  4,	 /* � (0x82) */
+  4,	 /* � (0x83) */
+  4,	 /* � (0x84) */
+  4,	 /* � (0x85) */
+  4,	 /* � (0x86) */
+  4,	 /* � (0x87) */
+  4,	 /* � (0x88) */
+  4,	 /* � (0x89) */
+  4,	 /* � (0x8a) */
+  4,	 /* � (0x8b) */
+  4,	 /* � (0x8c) */
+  4,	 /* � (0x8d) */
+  4,	 /* � (0x8e) */
+  4,	 /* � (0x8f) */
+  4,	 /* � (0x90) */
+  4,	 /* � (0x91) */
+  4,	 /* � (0x92) */
+  4,	 /* � (0x93) */
+  4,	 /* � (0x94) */
+  4,	 /* � (0x95) */
+  4,	 /* � (0x96) */
+  4,	 /* � (0x97) */
+  4,	 /* � (0x98) */
+  4,	 /* � (0x99) */
+  4,	 /* � (0x9a) */
+  4,	 /* � (0x9b) */
+  4,	 /* � (0x9c) */
+  4,	 /* � (0x9d) */
+  4,	 /* � (0x9e) */
+  4,	 /* � (0x9f) */
+  9,	 /* � (0xa0) */
+  4,	 /* � (0xa1) */
+  8,	 /* � (0xa2) */
+  8,	 /* � (0xa3) */
+  8,	 /* � (0xa4) */
+  8,	 /* � (0xa5) */
+  4,	 /* � (0xa6) */
+  8,	 /* � (0xa7) */
+  5,	 /* � (0xa8) */
+  10,	 /* � (0xa9) */
+  5,	 /* � (0xaa) */
+  7,	 /* � (0xab) */
+  8,	 /* � (0xac) */
+  4,	 /* � (0xad) */
+  10,	 /* � (0xae) */
+  8,	 /* � (0xaf) */
+  5,	 /* � (0xb0) */
+  8,	 /* � (0xb1) */
+  4,	 /* � (0xb2) */
+  4,	 /* � (0xb3) */
+  5,	 /* � (0xb4) */
+  8,	 /* � (0xb5) */
+  7,	 /* � (0xb6) */
+  4,	 /* � (0xb7) */
+  5,	 /* � (0xb8) */
+  4,	 /* � (0xb9) */
+  5,	 /* � (0xba) */
+  7,	 /* � (0xbb) */
+  11,	 /* � (0xbc) */
+  11,	 /* � (0xbd) */
+  11,	 /* � (0xbe) */
+  8,	 /* � (0xbf) */
+  8,	 /* � (0xc0) */
+  8,	 /* � (0xc1) */
+  8,	 /* � (0xc2) */
+  8,	 /* � (0xc3) */
+  8,	 /* � (0xc4) */
+  8,	 /* � (0xc5) */
+  13,	 /* � (0xc6) */
+  9,	 /* � (0xc7) */
+  9,	 /* � (0xc8) */
+  9,	 /* � (0xc9) */
+  9,	 /* � (0xca) */
+  9,	 /* � (0xcb) */
+  4,	 /* � (0xcc) */
+  4,	 /* � (0xcd) */
+  4,	 /* � (0xce) */
+  4,	 /* � (0xcf) */
+  10,	 /* � (0xd0) */
+  10,	 /* � (0xd1) */
+  10,	 /* � (0xd2) */
+  10,	 /* � (0xd3) */
+  10,	 /* � (0xd4) */
+  10,	 /* � (0xd5) */
+  10,	 /* � (0xd6) */
+  8,	 /* � (0xd7) */
+  10,	 /* � (0xd8) */
+  10,	 /* � (0xd9) */
+  10,	 /* � (0xda) */
+  10,	 /* � (0xdb) */
+  10,	 /* � (0xdc) */
+  10,	 /* � (0xdd) */
+  9,	 /* � (0xde) */
+  8,	 /* � (0xdf) */
+  8,	 /* � (0xe0) */
+  8,	 /* � (0xe1) */
+  8,	 /* � (0xe2) */
+  8,	 /* � (0xe3) */
+  8,	 /* � (0xe4) */
+  8,	 /* � (0xe5) */
+  12,	 /* � (0xe6) */
+  7,	 /* � (0xe7) */
+  8,	 /* � (0xe8) */
+  8,	 /* � (0xe9) */
+  8,	 /* � (0xea) */
+  8,	 /* � (0xeb) */
+  4,	 /* � (0xec) */
+  4,	 /* � (0xed) */
+  4,	 /* � (0xee) */
+  4,	 /* � (0xef) */
+  8,	 /* � (0xf0) */
+  8,	 /* � (0xf1) */
+  8,	 /* � (0xf2) */
+  8,	 /* � (0xf3) */
+  8,	 /* � (0xf4) */
+  8,	 /* � (0xf5) */
+  8,	 /* � (0xf6) */
+  6,	 /* � (0xf7) */
+  8,	 /* � (0xf8) */
+  8,	 /* � (0xf9) */
+  8,	 /* � (0xfa) */
+  8,	 /* � (0xfb) */
+  8,	 /* � (0xfc) */
+  8,	 /* � (0xfd) */
+  8,	 /* � (0xfe) */
+  8,	 /* � (0xff) */
+};
+
+/* Exported structure definition. */
+MWCFONT font_winFreeSystem14x16 = {
+	"winFreeSystem14x16",
+	14,
+	16,
+	13,
+	32,
+	224,
+	winFreeSystem14x16_bits,
+	winFreeSystem14x16_offset,
+	winFreeSystem14x16_width,
+};
diff -urN lib/microwindows/src/ftdemo.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/ftdemo.sh
--- lib/microwindows/src/ftdemo.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/ftdemo.sh	2005-02-21 16:13:42.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X & bin/nanowm & bin/ftdemo
diff -urN lib/microwindows/src/ftdemo.txt /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/ftdemo.txt
--- lib/microwindows/src/ftdemo.txt	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/ftdemo.txt	2005-02-21 16:13:42.000000000 +0100
@@ -0,0 +1 @@
+gEût été ôté de là ...
diff -urN lib/microwindows/src/include/XtoNX.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/XtoNX.h
--- lib/microwindows/src/include/XtoNX.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/XtoNX.h	2005-02-21 16:13:19.000000000 +0100
@@ -0,0 +1,98 @@
+#ifndef __XTONX_H
+#define __XTONX_H
+/*
+ * Copyright (c) 2001 by Greg Haerr <greg@centurysoftware.com>
+ *
+ * XtoNX.h - X to Nano-X macro conversion header file
+ *
+ * Yes, this is a vain attempt at making things easier when
+ * porting Xlib programs to Nano-X!
+ */
+
+extern "C" {
+
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+typedef struct _display		Display;
+typedef GR_WINDOW_ID		Window;
+typedef GR_WINDOW_ID		Pixmap;
+typedef GR_GC_ID		GC;
+typedef GR_FONT_ID		Font;
+typedef MWCURSOR		Cursor;
+typedef unsigned long		Time;		/* change to GR_TIME*/
+typedef GR_EVENT		XEvent;
+typedef GR_FONT_INFO		XFontStruct;
+typedef GR_POINT		XPoint;
+
+// kluge structs
+#define XCharStruct		char
+
+#define RootWindow(d,s)		GR_ROOT_WINDOW_ID
+#define DefaultScreen(d)	0
+#define DefaultDepth(d,s)	16
+#define BlackPixel(d,s)		BLACK
+#define WhitePixel(d,s)		WHITE
+#define False			0
+#define True			1
+
+// events
+#define EnterWindowMask		GR_EVENT_MASK_MOUSE_ENTER
+#define LeaveWindowMask		GR_EVENT_MASK_MOUSE_EXIT
+#define ButtonPressMask		GR_EVENT_MASK_BUTTON_DOWN
+#define ButtonReleaseMask	GR_EVENT_MASK_BUTTON_UP
+#define KeyPressMask		GR_EVENT_MASK_KEY_DOWN
+#define KeyReleaseMask		GR_EVENT_MASK_KEY_UP
+#define ExposureMask		GR_EVENT_MASK_EXPOSURE
+
+#define EnterNotify		GR_EVENT_TYPE_MOUSE_ENTER
+#define LeaveNotify		GR_EVENT_TYPE_MOUSE_EXIT
+#define ButtonPress		GR_EVENT_TYPE_BUTTON_DOWN
+#define ButtonRelease		GR_EVENT_TYPE_BUTTON_UP
+#define KeyPress		GR_EVENT_TYPE_KEY_DOWN
+#define KeyRelease		GR_EVENT_TYPE_KEY_UP
+#define Expose			GR_EVENT_TYPE_EXPOSURE
+
+#define XNextEvent(d,ep)			GrGetNextEvent(ep)
+#define XSelectInput(d,w,m)			GrSelectEvents(w,m)
+#define XFlush(d)				GrFlush()
+#define XSync(d,f)				GrFlush()
+
+// graphics functions
+#define XCreateSimpleWindow(d,p,x,y,w,h,bw,bordc,backc) \
+			GrNewWindow(p,x,y,w,h,bw,backc,bordc)
+#define XCreatePixmapFromBitmapData(d,w,bm,W,H,f,b,depth) \
+			GrNewPixmapFromData(W,H,f,b,(void *)bm, \
+				GR_BMDATA_BYTEREVERSE|GR_BMDATA_BYTESWAP)
+#define XDestroyWindow(d,w)			GrDestroyWindow(w)
+#define XReparentWindow(d,w,p,x,y) /* FIXME GrReparentWindow(w,p,x,y)*/
+#define XMapWindow(d,w)				GrMapWindow(w)
+#define XUnmapWindow(d,w)			GrUnmapWindow(w)
+#define XClearWindow(d,w)			GrClearWindow(w,0)
+#define XRaiseWindow(d,w)			GrRaiseWindow(w)
+#define XLowerWindow(d,w)			GrLowerWindow(w)
+#define XMoveWindow(d,w,x,y)			GrMoveWindow(w,x,y)
+#define XResizeWindow(d,w,W,H)			GrResizeWindow(w,W,H)
+
+#define XCreateGC(d,a,b,c)			GrNewGC()
+#define XSetFunction(d,g,f)			GrSetGCMode(g,f)
+#define GXxor		GR_MODE_XOR
+#define XSetForeground(d,g,c)			GrSetGCForeground(g,c)
+#define XSetWindowBackgroundPixmap(d,w,p) \
+			GrSetBackgroundPixmap(w,p,GR_BACKGROUND_TILE)
+#define XSetWindowBackground(d,w,c)		GrSetWindowBackgroundColor(w,c)
+#define XSetWindowBorderWidth(d,w,bw)		GrSetWindowBorderSize(w,bw)
+#define XSetWindowBorder(d,w,c)			GrSetWindowBorderColor(w,c)
+#define XStoreName(d,w,n) 			GrSetWindowTitle(w,n)
+#define XSetIconName(d,w,n)	/* nyi*/
+#define XDrawLines(d,w,g,ar,cnt,B)		GrDrawLines(w,g,ar,cnt)
+#define XFillRectangle(d,w,g,x,y,W,H)		GrFillRect(w,g,x,y,W,H)
+#define XDrawString(d,w,g,x,y,s,c)	GrText(w,g,x,y,(void *)s,c,GR_TFASCII)
+#define XSetFont(d,g,f)				GrSetGCFont(g,f)
+#define XLoadFont(d,f)				GrCreateFont(0, 0, 0)
+#define XDefineCursor(d,w,c)	/* nyi*/
+#define XUndefineCursor(d,w)	/* nyi*/
+
+} // extern "C"
+
+#endif /* __XTONX_H*/
diff -urN lib/microwindows/src/include/device.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/device.h
--- lib/microwindows/src/include/device.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/device.h	2005-02-21 16:13:18.000000000 +0100
@@ -0,0 +1,631 @@
+#ifndef _DEVICE_H
+#define _DEVICE_H
+#define GTKHACK 1
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Engine-level Screen, Mouse and Keyboard device driver API's and types
+ * 
+ * Contents of this file are not for general export
+ */
+#include "mwtypes.h"				/* public export typedefs*/
+
+/* Changeable limits and options*/
+#define ALPHABLEND	1			/* =1 to include blending code*/
+#define DYNAMICREGIONS	1			/* =1 to use MWCLIPREGIONS*/
+#define HAVEFLOAT	1			/* =1 incl float, GdArcAngle*/
+#define POLYREGIONS	1			/* =1 includes polygon regions*/
+#define ANIMATEPALETTE	0			/* =1 animated palette test*/
+#define FONTMAPPER	0			/* =1 for Morten's font mapper*/
+#define USE_ALLOCA	1			/* alloca() is available */
+#if ECOS
+#define EPRINTF		diag_printf
+#define DPRINTF		diag_printf
+#else
+#define EPRINTF		GdError			/* error output*/
+#define DPRINTF		GdError			/* debug output*/
+#endif
+/* max char height/width must be >= 16 and a multiple of sizeof(MWIMAGEBITS)*/
+#define MAX_CHAR_HEIGHT	128			/* maximum text bitmap height*/
+#define MAX_CHAR_WIDTH	128			/* maximum text bitmap width*/
+#define	MIN_MWCOORD	((MWCOORD) -32768)	/* minimum coordinate value */
+#define	MAX_MWCOORD	((MWCOORD) 32767)	/* maximum coordinate value */
+#define	MAX_CLIPRECTS 	200			/* max clip rects (obsolete)*/
+
+typedef struct _mwscreendevice *PSD;
+
+/* builtin C-based proportional/fixed font structure*/
+typedef struct {
+	char *		name;		/* font name*/
+	int		maxwidth;	/* max width in pixels*/
+	int		height;		/* height in pixels*/
+	int		ascent;		/* ascent (baseline) height*/
+	int		firstchar;	/* first character in bitmap*/
+	int		size;		/* font size in characters*/
+	MWIMAGEBITS *	bits;		/* 16-bit right-padded bitmap data*/
+	unsigned short *offset;		/* 256 offsets into bitmap data*/
+	unsigned char *	width;		/* 256 character widths or 0 if fixed*/
+} MWCFONT, *PMWCFONT;
+
+/* draw procs associated with fonts.  Strings are [re]packed using defencoding*/
+typedef struct {
+	int	encoding;	/* routines expect this encoding*/
+	MWBOOL	(*GetFontInfo)(PMWFONT pfont, PMWFONTINFO pfontinfo);
+	void 	(*GetTextSize)(PMWFONT pfont, const void *text, int cc,
+			MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+	void	(*GetTextBits)(PMWFONT pfont, int ch, MWIMAGEBITS *retmap,
+			MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
+	void	(*DestroyFont)(PMWFONT pfont);
+	void	(*DrawText)(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
+			const void *str, int count, int flags);
+	void    (*SetFontSize)(PMWFONT pfont, MWCOORD fontsize);
+	void    (*SetFontRotation)(PMWFONT pfont, int tenthdegrees);
+	void    (*SetFontAttr)(PMWFONT pfont, int setflags, int clrflags);
+} MWFONTPROCS, *PMWFONTPROCS;
+
+/* new multi-renderer font struct*/
+typedef struct _mwfont {		/* common hdr for all font structures*/
+	PMWFONTPROCS	fontprocs;	/* font-specific rendering routines*/
+	MWCOORD		fontsize;	/* font height in pixels*/
+	int		fontrotation;	/* font rotation*/
+	int		fontattr;	/* font attributes: kerning/antialias*/
+	/* font-specific rendering data here*/
+} MWFONT;
+
+/* fontattr flags*/
+#define FS_FREETYPE      0x0800
+
+/* builtin core font struct*/
+typedef struct {
+	PMWFONTPROCS	fontprocs;	/* common hdr*/
+	MWCOORD		fontsize;
+	int		fontrotation;
+	int		fontattr;
+
+	char *		name;		/* Microwindows font name*/
+	PMWCFONT	cfont;		/* builtin font data*/
+} MWCOREFONT, *PMWCOREFONT;
+
+/* This structure is used to pass parameters into the low
+ * level device driver functions.
+ */
+typedef struct {
+	MWCOORD dstx, dsty, dstw, dsth, dst_linelen;
+	MWCOORD srcx, srcy, src_linelen;
+	void *pixels, *misc;
+	MWPIXELVAL bg_color, fg_color;
+	int gr_usebg;
+} driver_gc_t;
+
+/* Operations for the Blitter/Area functions */
+#define PSDOP_COPY	0
+#define PSDOP_COPYALL	1
+#define PSDOP_COPYTRANS 2
+#define PSDOP_ALPHAMAP	3
+#define PSDOP_ALPHACOL	4
+#define PSDOP_PIXMAP_COPYALL	5
+
+/* common blitter parameter structure*/
+typedef struct {
+	PSD		dstpsd;		/* dst drawable*/
+	MWCOORD		dstx, dsty;	/* dst x,y,w,h*/
+	MWCOORD		dstw, dsth;
+	MWCOORD		srcx, srcy;	/* src x,y*/
+	MWCOORD		srcw, srch;	/* src w,h if stretchblit*/
+	PSD		srcpsd;		/* src drawable*/
+	unsigned long 	rop;		/* raster opcode*/
+	PSD		alphachan;	/* alpha chan for MWROP_BLENDCHANNEL*/
+	MWPIXELVAL	fgcolor;	/* fg/bg color for MWROP_BLENDFGBG*/
+	MWPIXELVAL	bgcolor;
+	MWPIXELVAL	transcolor;	/* trans color for MWROP_SRCTRANSCOPY*/
+} MWBLITARGS, *PMWBLITARGS;
+
+/*
+ * Interface to Screen Device Driver
+ * This structure is also allocated for memory (offscreen) drawing and blitting.
+ */
+typedef struct _mwscreendevice {
+	MWCOORD	xres;		/* X screen res (real) */
+	MWCOORD	yres;		/* Y screen res (real) */
+	MWCOORD	xvirtres;	/* X drawing res (will be flipped in portrait mode) */
+	MWCOORD	yvirtres;	/* Y drawing res (will be flipped in portrait mode) */
+	int	planes;		/* # planes*/
+	int	bpp;		/* # bpp*/
+	int	linelen;	/* line length in bytes for bpp 1,2,4,8*/
+				/* line length in pixels for bpp 16, 24, 32*/
+	int	size;		/* size of memory allocated*/
+	long	ncolors;	/* # screen colors*/
+	int	pixtype;	/* format of pixel value*/
+	int	flags;		/* device flags*/
+	void *	addr;		/* address of memory allocated (memdc or fb)*/
+
+	PSD	(*Open)(PSD psd);
+	void	(*Close)(PSD psd);
+	void	(*GetScreenInfo)(PSD psd,PMWSCREENINFO psi);
+	void	(*SetPalette)(PSD psd,int first,int count,MWPALENTRY *pal);
+	void	(*DrawPixel)(PSD psd,MWCOORD x,MWCOORD y,MWPIXELVAL c);
+	MWPIXELVAL (*ReadPixel)(PSD psd,MWCOORD x,MWCOORD y);
+	void	(*DrawHorzLine)(PSD psd,MWCOORD x1,MWCOORD x2,MWCOORD y,
+			MWPIXELVAL c);
+	void	(*DrawVertLine)(PSD psd,MWCOORD x,MWCOORD y1,MWCOORD y2,
+			MWPIXELVAL c);
+	void	(*FillRect)(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,
+			MWPIXELVAL c);
+	PMWCOREFONT builtin_fonts;
+
+	/***void (*DrawText)(PSD psd,MWCOORD x,MWCOORD y,const MWUCHAR *str,
+			int count, MWPIXELVAL fg, PMWFONT pfont);***/
+
+	void	(*Blit)(PSD destpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,
+			MWCOORD h,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op);
+	void	(*PreSelect)(PSD psd);
+	void	(*DrawArea)(PSD psd, driver_gc_t *gc, int op);
+	int	(*SetIOPermissions)(PSD psd);
+	PSD	(*AllocateMemGC)(PSD psd);
+	MWBOOL	(*MapMemGC)(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,
+			int linelen,int size,void *addr);
+	void	(*FreeMemGC)(PSD mempsd);
+} SCREENDEVICE;
+
+/* PSD flags*/
+#define	PSF_SCREEN		0x0001	/* screen device*/
+#define PSF_MEMORY		0x0002	/* memory device*/
+#define PSF_HAVEBLIT		0x0004	/* have bitblit*/
+#define PSF_PORTRAIT		0x0008	/* in portrait mode*/
+#define PSF_HAVEOP_COPY		0x0010	/* psd->DrawArea can do area copy*/
+#define PSF_ADDRMALLOC		0x0020	/* psd->addr was malloc'd*/
+#define PSF_ADDRSHAREDMEM	0x0040	/* psd->addr is shared memory*/
+
+/* Interface to Mouse Device Driver*/
+typedef struct _mousedevice {
+	int	(*Open)(struct _mousedevice *);
+	void	(*Close)(void);
+	int	(*GetButtonInfo)(void);
+	void	(*GetDefaultAccel)(int *pscale,int *pthresh);
+	int	(*Read)(MWCOORD *dx,MWCOORD *dy,MWCOORD *dz,int *bp);
+	int	(*Poll)(void);		/* not required if have select()*/
+} MOUSEDEVICE;
+
+/* Interface to Keyboard Device Driver*/
+typedef struct _kbddevice {
+	int  (*Open)(struct _kbddevice *pkd);
+	void (*Close)(void);
+	void (*GetModifierInfo)(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers);
+	int  (*Read)(MWKEY *buf,MWKEYMOD *modifiers,MWSCANCODE *scancode);
+	int  (*Poll)(void);		/* not required if have select()*/
+} KBDDEVICE;
+
+/* Clip areas*/
+#define CLIP_VISIBLE		0
+#define CLIP_INVISIBLE		1
+#define CLIP_PARTIAL		2
+
+/* static clip rectangle: drawing allowed if point within rectangle*/
+typedef struct {
+	MWCOORD 	x;		/* x coordinate of top left corner */
+	MWCOORD 	y;		/* y coordinate of top left corner */
+	MWCOORD 	width;		/* width of rectangle */
+	MWCOORD 	height;		/* height of rectangle */
+} MWCLIPRECT;
+
+#ifndef TRUE
+#define TRUE			1
+#endif
+#ifndef FALSE
+#define FALSE			0
+#endif
+
+#define	MWMIN(a,b)		((a) < (b) ? (a) : (b))
+#define	MWMAX(a,b) 		((a) > (b) ? (a) : (b))
+
+/* MWIMAGEBITS macros*/
+#define	MWIMAGE_SIZE(width, height)  ((height) * (((width) + MWIMAGE_BITSPERIMAGE - 1) / MWIMAGE_BITSPERIMAGE))
+#define MWIMAGE_WORDS(x)	(((x)+15)/16)
+#define MWIMAGE_BYTES(x)	(((x)+7)/8)
+#define	MWIMAGE_BITSPERIMAGE	(sizeof(MWIMAGEBITS) * 8)
+#define	MWIMAGE_FIRSTBIT	((MWIMAGEBITS) 0x8000)
+#define	MWIMAGE_NEXTBIT(m)	((MWIMAGEBITS) ((m) >> 1))
+#define	MWIMAGE_TESTBIT(m)	((m) & MWIMAGE_FIRSTBIT)  /* use with shiftbit*/
+#define	MWIMAGE_SHIFTBIT(m)	((MWIMAGEBITS) ((m) << 1))  /* for testbit*/
+
+/* color and palette defines*/
+#define RGBDEF(r,g,b)	{r, g, b}
+
+#define GETPALENTRY(pal,index) ((unsigned long)(pal[index].r |\
+				(pal[index].g << 8) | (pal[index].b << 16)))
+/*#define GETPALENTRY(pal,index) ((*(unsigned long *)&pal[index])&0x00ffffff)*/
+
+#define REDVALUE(rgb)	((rgb) & 0xff)
+#define GREENVALUE(rgb) (((rgb) >> 8) & 0xff)
+#define BLUEVALUE(rgb)	(((rgb) >> 16) & 0xff)
+
+/* Truecolor color conversion and extraction macros*/
+/*
+ * Conversion from RGB to MWPIXELVAL
+ */
+/* create 24 bit 8/8/8 format pixel (0x00RRGGBB) from RGB triplet*/
+//Note: for BBGGRR systems, do not change this macro
+
+#define RGB2PIXEL888(r,g,b)	\
+	(((r) << 16) | ((g) << 8) | (b))
+
+/* create 16 bit 5/6/5 format pixel from RGB triplet */
+#define RGB2PIXEL565(r,g,b)	\
+	((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))
+
+/* create 16 bit 5/5/5 format pixel from RGB triplet */
+#define RGB2PIXEL555(r,g,b)	\
+	((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3))
+
+/* create 8 bit 3/3/2 format pixel from RGB triplet*/
+#define RGB2PIXEL332(r,g,b)	\
+	(((r) & 0xe0) | (((g) & 0xe0) >> 3) | (((b) & 0xc0) >> 6))
+
+/*
+ * Conversion from MWCOLORVAL to MWPIXELVAL
+ */
+
+#ifdef GTKHACK
+
+/* create 24 bit 8/8/8 format pixel from RGB colorval (0x00BBGGRR)*/
+#define COLOR2PIXEL888(c)	(c)
+
+#else
+
+/* create 24 bit 8/8/8 format pixel from RGB colorval (0x00BBGGRR)*/
+#define COLOR2PIXEL888(c)	\
+	((((c) & 0xff) << 16) | ((c) & 0xff00) | (((c) & 0xff0000) >> 16))
+
+#endif
+
+/* create 16 bit 5/6/5 format pixel from RGB colorval (0x00BBGGRR)*/
+#define COLOR2PIXEL565(c)	\
+	((((c) & 0xf8) << 8) | (((c) & 0xfc00) >> 5) | (((c) & 0xf80000) >> 19))
+
+/* create 16 bit 5/5/5 format pixel from RGB colorval (0x00BBGGRR)*/
+#define COLOR2PIXEL555(c)	\
+	((((c) & 0xf8) << 7) | (((c) & 0xf800) >> 6) | (((c) & 0xf80000) >> 19))
+
+/* create 8 bit 3/3/2 format pixel from RGB colorval (0x00BBGGRR)*/
+#define COLOR2PIXEL332(c)	\
+	(((c) & 0xe0) | (((c) & 0xe000) >> 11) | (((c) & 0xc00000) >> 22))
+
+/*
+ * Conversion from MWPIXELVAL to red, green or blue components
+ */
+/* return 8/8/8 bit r, g or b component of 24 bit pixelval*/
+
+//Note: for BBGGRR systems, do not change these macros
+
+#define PIXEL888RED(pixelval)		(((pixelval) >> 16) & 0xff)
+#define PIXEL888GREEN(pixelval)		(((pixelval) >> 8) & 0xff)
+#define PIXEL888BLUE(pixelval)		((pixelval) & 0xff)
+
+/* return 5/6/5 bit r, g or b component of 16 bit pixelval*/
+#define PIXEL565RED(pixelval)		(((pixelval) >> 11) & 0x1f)
+#define PIXEL565GREEN(pixelval)		(((pixelval) >> 5) & 0x3f)
+#define PIXEL565BLUE(pixelval)		((pixelval) & 0x1f)
+
+/* return 5/5/5 bit r, g or b component of 16 bit pixelval*/
+#define PIXEL555RED(pixelval)		(((pixelval) >> 10) & 0x1f)
+#define PIXEL555GREEN(pixelval)		(((pixelval) >> 5) & 0x1f)
+#define PIXEL555BLUE(pixelval)		((pixelval) & 0x1f)
+
+/* return 3/3/2 bit r, g or b component of 8 bit pixelval*/
+#define PIXEL332RED(pixelval)		(((pixelval) >> 5) & 0x07)
+#define PIXEL332GREEN(pixelval)		(((pixelval) >> 2) & 0x07)
+#define PIXEL332BLUE(pixelval)		((pixelval) & 0x03)
+
+/*
+ * Conversion from MWPIXELVAL to MWCOLORVAL
+ */
+/* create RGB colorval (0x00BBGGRR) from 8/8/8 format pixel*/
+#ifdef GTKHACK
+#define PIXEL888TOCOLORVAL(p)	(p)
+#else
+#define PIXEL888TOCOLORVAL(p)	\
+	((((p) & 0xff0000) >> 16) | ((p) & 0xff00) | (((p) & 0xff) << 16))
+#endif
+
+/* create RGB colorval (0x00BBGGRR) from 5/6/5 format pixel*/
+#define PIXEL565TOCOLORVAL(p)	\
+	((((p) & 0xf800) >> 8) | (((p) & 0x07e0) << 5) | (((p) & 0x1f) << 19))
+
+#define PIXEL555TOCOLORVAL(p)	\
+	((((p) & 0x7c00) >> 7) | (((p) & 0x03e0) << 6) | (((p) & 0x1f) << 19))
+
+/* create RGB colorval (0x00BBGGRR) from 3/3/2 format pixel*/
+#define PIXEL332TOCOLORVAL(p)	\
+	((((p) & 0xe0)) | (((p) & 0x18) << 11) | (((p) & 0x03) << 19))
+
+#if (MWPIXEL_FORMAT == MWPF_TRUECOLOR888) || (MWPIXEL_FORMAT == MWPF_TRUECOLOR0888)
+#define RGB2PIXEL(r,g,b)	RGB2PIXEL888(r,g,b)
+#define COLORVALTOPIXELVAL(c)	COLOR2PIXEL888(c)
+#define PIXELVALTOCOLORVAL(p)	PIXEL888TOCOLORVAL(p)
+#define PIXEL2RED(p)		PIXEL888RED(p)
+#define PIXEL2GREEN(p)		PIXEL888GREEN(p)
+#define PIXEL2BLUE(p)		PIXEL888BLUE(p)
+#endif
+
+#if MWPIXEL_FORMAT == MWPF_TRUECOLOR565
+#define RGB2PIXEL(r,g,b)	RGB2PIXEL565(r,g,b)
+#define COLORVALTOPIXELVAL(c)	COLOR2PIXEL565(c)
+#define PIXELVALTOCOLORVAL(p)	PIXEL565TOCOLORVAL(p)
+#define PIXEL2RED(p)		PIXEL565RED(p)
+#define PIXEL2GREEN(p)		PIXEL565GREEN(p)
+#define PIXEL2BLUE(p)		PIXEL565BLUE(p)
+#endif
+
+#if MWPIXEL_FORMAT == MWPF_TRUECOLOR555
+#define RGB2PIXEL(r,g,b)	RGB2PIXEL555(r,g,b)
+#define COLORVALTOPIXELVAL(c)	COLOR2PIXEL555(c)
+#define PIXELVALTOCOLORVAL(p)	PIXEL555TOCOLORVAL(p)
+#define PIXEL2RED(p)		PIXEL555RED(p)
+#define PIXEL2GREEN(p)		PIXEL555GREEN(p)
+#define PIXEL2BLUE(p)		PIXEL555BLUE(p)
+#endif
+
+#if MWPIXEL_FORMAT == MWPF_TRUECOLOR332
+#define RGB2PIXEL(r,g,b)	RGB2PIXEL332(r,g,b)
+#define COLORVALTOPIXELVAL(c)	COLOR2PIXEL332(c)
+#define PIXELVALTOCOLORVAL(p)	PIXEL332TOCOLORVAL(p)
+#define PIXEL2RED(p)		PIXEL332RED(p)
+#define PIXEL2GREEN(p)		PIXEL332GREEN(p)
+#define PIXEL2BLUE(p)		PIXEL332BLUE(p)
+#endif
+
+/* Alpha blend two pixels using 8-bit alpha */
+/* FIXME this will be quite a bit faster as an inlined function */
+#define ALPHAPIXELRED(pixelvalsrc, pixelvaldest, alpha)	\
+	(unsigned char)((((PIXEL2RED(pixelvalsrc) - PIXEL2RED(pixelvaldest))\
+			  * alpha) >> 8) + PIXEL2RED(pixelvaldest))
+
+#define ALPHAPIXELGREEN(pixelvalsrc, pixelvaldest, alpha)	\
+	(unsigned char)((((PIXEL2GREEN(pixelvalsrc)-PIXEL2GREEN(pixelvaldest))\
+			  * alpha) >> 8) + PIXEL2GREEN(pixelvaldest))
+
+#define ALPHAPIXELBLUE(pixelvalsrc, pixelvaldest, alpha)	\
+	(unsigned char)((((PIXEL2BLUE(pixelvalsrc) - PIXEL2BLUE(pixelvaldest))\
+			  * alpha) >> 8) + PIXEL2BLUE(pixelvaldest))
+
+#if 0000
+/* colors assumed in first 16 palette entries*/
+/* note: don't use palette indices if the palette may
+ * be reloaded.  Use the RGB values instead.
+ */
+#define BLACK		PALINDEX(0)		/*   0,   0,   0*/
+#define BLUE		PALINDEX(1)
+#define GREEN		PALINDEX(2)
+#define CYAN		PALINDEX(3)
+#define RED		PALINDEX(4)
+#define MAGENTA		PALINDEX(5)
+#define BROWN		PALINDEX(6)
+#define LTGRAY		PALINDEX(7)		/* 192, 192, 192*/
+#define GRAY		PALINDEX(8)		/* 128, 128, 128*/
+#define LTBLUE		PALINDEX(9)
+#define LTGREEN		PALINDEX(10)
+#define LTCYAN		PALINDEX(11)
+#define LTRED		PALINDEX(12)
+#define LTMAGENTA	PALINDEX(13)
+#define YELLOW		PALINDEX(14)
+#define WHITE		PALINDEX(15)		/* 255, 255, 255*/
+#endif
+
+/* GdMakePaletteConversionTable bLoadType types*/
+#define LOADPALETTE	1	/* load image palette into system palette*/
+#define MERGEPALETTE	2	/* merge image palette into system palette*/
+
+/* entry points*/
+
+/* devdraw.c*/
+PSD	GdOpenScreen(void);
+void	GdCloseScreen(PSD psd);
+int	GdSetMode(int mode);
+MWBOOL	GdSetUseBackground(MWBOOL flag);
+MWPIXELVAL GdSetForeground(MWPIXELVAL fg);
+MWPIXELVAL GdSetBackground(MWPIXELVAL bg);
+void	GdResetPalette(void);
+void	GdSetPalette(PSD psd,int first, int count, MWPALENTRY *palette);
+int	GdGetPalette(PSD psd,int first, int count, MWPALENTRY *palette);
+MWPIXELVAL GdFindColor(MWCOLORVAL c);
+MWPIXELVAL GdFindNearestColor(MWPALENTRY *pal, int size, MWCOLORVAL cr);
+int	GdCaptureScreen(char *path);
+void	GdGetScreenInfo(PSD psd,PMWSCREENINFO psi);
+void	GdPoint(PSD psd,MWCOORD x, MWCOORD y);
+void	GdLine(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,
+		MWBOOL bDrawLastPoint);
+void	GdRect(PSD psd,MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height);
+void	GdFillRect(PSD psd,MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height);
+void	GdBitmap(PSD psd,MWCOORD x,MWCOORD y,MWCOORD width,MWCOORD height,
+		MWIMAGEBITS *imagebits);
+MWBOOL	GdColorInPalette(MWCOLORVAL cr,MWPALENTRY *palette,int palsize);
+void	GdMakePaletteConversionTable(PSD psd,MWPALENTRY *palette,int palsize,
+		MWPIXELVAL *convtable,int fLoadType);
+void	GdDrawImage(PSD psd,MWCOORD x, MWCOORD y, PMWIMAGEHDR pimage);
+void	GdPoly(PSD psd,int count, MWPOINT *points);
+void	GdFillPoly(PSD psd,int count, MWPOINT *points);
+void	GdReadArea(PSD psd,MWCOORD x,MWCOORD y,MWCOORD width,MWCOORD height,
+		MWPIXELVAL *pixels);
+void	GdArea(PSD psd,MWCOORD x,MWCOORD y,MWCOORD width,MWCOORD height,
+		void *pixels, int pixtype);
+void	GdTranslateArea(MWCOORD width, MWCOORD height, void *in, int inpixtype,
+		MWCOORD inpitch, void *out, int outpixtype, int outpitch);
+void	GdCopyArea(PSD psd,MWCOORD srcx,MWCOORD srcy,MWCOORD width,
+		MWCOORD height, MWCOORD destx, MWCOORD desty);
+void	GdBlit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD width,
+		MWCOORD height,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long rop);
+int	GdCalcMemGCAlloc(PSD psd, unsigned int width, unsigned int height,
+		int planes, int bpp, int *size, int *linelen);
+extern SCREENDEVICE scrdev;
+
+/* devarc.c*/
+/* requires float*/
+void	GdArcAngle(PSD psd, MWCOORD x0, MWCOORD y0, MWCOORD rx, MWCOORD ry,
+		MWCOORD angle1, MWCOORD angle2, int type);
+/* integer only*/
+void	GdArc(PSD psd, MWCOORD x0, MWCOORD y0, MWCOORD rx, MWCOORD ry,
+		MWCOORD ax, MWCOORD ay, MWCOORD bx, MWCOORD by, int type);
+void	GdEllipse(PSD psd,MWCOORD x, MWCOORD y, MWCOORD rx, MWCOORD ry,
+		MWBOOL fill);
+
+/* devfont.c*/
+void	GdClearFontList(void);
+int	GdAddFont(char *fndry, char *family, char *fontname, PMWLOGFONT lf,
+		  unsigned int flags);
+PMWFONT	GdSetFont(PMWFONT pfont);
+PMWFONT GdCreateFont(PSD psd, const char *name, MWCOORD height,
+		const PMWLOGFONT plogfont);
+MWCOORD	GdSetFontSize(PMWFONT pfont, MWCOORD fontsize);
+int	GdSetFontRotation(PMWFONT pfont, int tenthdegrees);
+int	GdSetFontAttr(PMWFONT pfont, int setflags, int clrflags);
+void	GdDestroyFont(PMWFONT pfont);
+MWBOOL	GdGetFontInfo(PMWFONT pfont, PMWFONTINFO pfontinfo);
+int	GdConvertEncoding(const void *istr, int iflags, int cc, void *ostr,
+		int oflags);
+void	GdGetTextSize(PMWFONT pfont, const void *str, int cc, MWCOORD *pwidth,
+		MWCOORD *pheight, MWCOORD *pbase, int flags);
+int	GdGetTextSizeEx(PMWFONT pfont, const void *str, int cc,
+		int nMaxExtent, int *lpnFit, int *alpDx, MWCOORD *pwidth,
+		MWCOORD *pheight, MWCOORD *pbase, int flags);	
+void	GdText(PSD psd,MWCOORD x,MWCOORD y,const void *str,int count,int flags);
+
+/* devclip1.c*/
+void 	GdSetClipRects(PSD psd,int count,MWCLIPRECT *table);
+MWBOOL	GdClipPoint(PSD psd,MWCOORD x,MWCOORD y);
+int	GdClipArea(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2);
+extern MWCOORD clipminx, clipminy, clipmaxx, clipmaxy;
+
+/* devclip2.c*/
+void	GdSetClipRegion(PSD psd, MWCLIPREGION *reg);
+
+/* devrgn.c - multi-rectangle region entry points*/
+MWBOOL GdPtInRegion(MWCLIPREGION *rgn, MWCOORD x, MWCOORD y);
+int    GdRectInRegion(MWCLIPREGION *rgn, const MWRECT *rect);
+MWBOOL GdEqualRegion(MWCLIPREGION *r1, MWCLIPREGION *r2);
+MWBOOL GdEmptyRegion(MWCLIPREGION *rgn);
+MWCLIPREGION *GdAllocRegion(void);
+MWCLIPREGION *GdAllocRectRegion(MWCOORD left,MWCOORD top,MWCOORD right,MWCOORD bottom);
+MWCLIPREGION *GdAllocRectRegionIndirect(MWRECT *prc);
+void GdSetRectRegion(MWCLIPREGION *rgn, MWCOORD left, MWCOORD top,
+		MWCOORD right, MWCOORD bottom);
+void GdSetRectRegionIndirect(MWCLIPREGION *rgn, MWRECT *prc);
+void GdDestroyRegion(MWCLIPREGION *rgn);
+void GdOffsetRegion(MWCLIPREGION *rgn, MWCOORD x, MWCOORD y);
+int  GdGetRegionBox(MWCLIPREGION *rgn, MWRECT *prc);
+void GdUnionRectWithRegion(const MWRECT *rect, MWCLIPREGION *rgn);
+void GdSubtractRectFromRegion(const MWRECT *rect, MWCLIPREGION *rgn);
+void GdCopyRegion(MWCLIPREGION *d, MWCLIPREGION *s);
+void GdIntersectRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2);
+void GdUnionRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2);
+void GdSubtractRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2);
+void GdXorRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2);
+
+/* devrgn2.c*/
+MWCLIPREGION *GdAllocPolygonRegion(MWPOINT *points, int count, int mode);
+MWCLIPREGION *GdAllocPolyPolygonRegion(MWPOINT *points, int *count,
+		int nbpolygons, int mode);
+
+/* devmouse.c*/
+int	GdOpenMouse(void);
+void	GdCloseMouse(void);
+void	GdGetButtonInfo(int *buttons);
+void	GdRestrictMouse(MWCOORD newminx,MWCOORD newminy,MWCOORD newmaxx,
+		MWCOORD newmaxy);
+void	GdSetAccelMouse(int newthresh, int newscale);
+void	GdMoveMouse(MWCOORD newx, MWCOORD newy);
+int	GdReadMouse(MWCOORD *px, MWCOORD *py, int *pb);
+void	GdMoveCursor(MWCOORD x, MWCOORD y);
+MWBOOL	GdGetCursorPos(MWCOORD *px, MWCOORD *py);
+void	GdSetCursor(PMWCURSOR pcursor);
+int 	GdShowCursor(PSD psd);
+int 	GdHideCursor(PSD psd);
+void	GdCheckCursor(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2);
+void 	GdFixCursor(PSD psd);
+extern MOUSEDEVICE mousedev;
+
+/* devkbd.c*/
+int  	GdOpenKeyboard(void);
+void 	GdCloseKeyboard(void);
+void 	GdGetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers);
+int  	GdReadKeyboard(MWKEY *buf, MWKEYMOD *modifiers, MWSCANCODE *scancode);
+extern KBDDEVICE kbddev;
+
+/* devimage.c */
+void	GdDrawImageFromFile(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width,
+		MWCOORD height, char *path, int flags);
+int	GdLoadImageFromFile(PSD psd, char *path, int flags);
+void	GdDrawImageToFit(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width,
+		MWCOORD height, int id);
+void	GdFreeImage(int id);
+MWBOOL	GdGetImageInfo(int id, PMWIMAGEINFO pii);
+void	GdStretchImage(PMWIMAGEHDR src, MWCLIPRECT *srcrect, PMWIMAGEHDR dst,
+		MWCLIPRECT *dstrect);
+
+/* devlist.c*/
+/* field offset*/
+#define MWITEM_OFFSET(type, field)    ((long)&(((type *)0)->field))
+
+void * 	GdItemAlloc(unsigned int size);
+void	GdListAdd(PMWLISTHEAD pHead,PMWLIST pItem);
+void	GdListInsert(PMWLISTHEAD pHead,PMWLIST pItem);
+void	GdListRemove(PMWLISTHEAD pHead,PMWLIST pItem);
+#define GdItemNew(type)	((type *)GdItemAlloc(sizeof(type)))
+#define GdItemFree(ptr)	free((void *)ptr)
+
+/* return base item address from list ptr*/
+#define GdItemAddr(p,type,list)	((type *)((long)p - MWITEM_OFFSET(type,list)))
+
+#if UNIX
+
+#include <sys/time.h>
+
+typedef void (*MWTIMERCB)(void *);
+
+typedef struct mw_timer MWTIMER;
+struct mw_timer {
+	struct timeval	timeout;
+	MWTIMERCB	callback;
+	void		*arg;
+	MWTIMER		*next;
+	MWTIMER		*prev;
+};
+
+MWTIMER		*GdAddTimer(MWTIMEOUT timeout, MWTIMERCB callback, void *arg);
+void		GdDestroyTimer(MWTIMER *timer);
+MWTIMER		*GdFindTimer(void *arg);
+MWBOOL		GdGetNextTimeout(struct timeval *tv, MWTIMEOUT timeout);
+MWBOOL		GdTimeout(void);
+
+#endif
+
+/* error.c*/
+int	GdError(const char *format, ...);
+
+#ifdef USE_ALLOCA
+/* alloca() is available, so use it for better performance */
+#define ALLOCA(size)	alloca(size)
+#define FREEA(pmem)
+#else
+/* no alloca(), so use malloc()/free() instead */
+#define ALLOCA(size)	malloc(size)
+#define FREEA(pmem)	free(pmem)
+#endif
+
+/* no assert() in MSDOS or ELKS...*/
+#if MSDOS | ELKS
+#undef assert
+#define assert(x)
+#endif
+
+/* RTEMS requires rtems_main()*/
+#if __rtems__
+#define main	rtems_main
+#endif
+
+#if !_MINIX
+#ifndef __rtems__
+#define HAVESELECT	1	/* has select system call*/
+#endif
+#endif
+
+#endif /*_DEVICE_H*/
diff -urN lib/microwindows/src/include/graph3d.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/graph3d.h
--- lib/microwindows/src/include/graph3d.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/graph3d.h	2005-02-21 16:03:29.000000000 +0100
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * 3D Graphics Library for Micro-Windows
+ */
+
+#ifndef _GRAPH3D_H_
+#define _GRAPH3D_H_
+
+#include <math.h>
+
+#define pi	3.1415926535
+#define epsilon	0.000001
+#define MAXPOLY	32		/* max polygon points*/
+
+typedef FLOAT	vec1;
+
+typedef struct {
+	FLOAT x, y;
+} vec2;
+
+typedef struct {
+	FLOAT x, y, z;
+} vec3;
+
+/* entry points*/
+void init3(HDC hDC,HWND hwndmem);
+void paint3(HDC hDC);
+void setcolor3(MWCOLORVAL c);
+void moveto3(vec2 pt);
+void lineto3(vec2 pt);
+void polyfill(int n, vec2 points[]);
+void square(void);
+void circle3(vec1 r);
+void daisy(vec1 r,int points);
+void rose(vec1 r,int levels,int points);
+void triangle(vec2 v0, vec2 v1, vec2 v2);
+void quadrilateral(vec2 v0, vec2 v1, vec2 v2, vec2 v3);
+void look3(vec1 x, vec1 y, vec1 z);
+void drawgrid(vec1 xmin, vec1 xmax, int nx, vec1 zmin, vec1 zmax, int nz);
+void scale3(vec1 sx, vec1 sy, vec1 sz, double A[][5]);
+void tran3(vec1 tx, vec1 ty, vec1 tz, double A[][5]);
+void rot3(int m, vec1 theta, double A[][5]);
+void mult3(double A[][5], double B[][5], double C[][5]);
+void findQ(void);
+
+#endif
diff -urN lib/microwindows/src/include/mwobjects.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/mwobjects.h
--- lib/microwindows/src/include/mwobjects.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/mwobjects.h	2005-02-21 16:03:29.000000000 +0100
@@ -0,0 +1,494 @@
+/*
+  Copyright (C) Chris Johns (ccj@acm.org)
+
+  MicroWindows C++ Wrappers.
+
+ */
+
+#if !defined (_MWOBJECTS_H_)
+#define _MWOBJECTS_H_
+
+extern "C" 
+{  
+#include "windows.h"
+#include "wintern.h"
+#include "graph3d.h"
+};
+
+#include <set>
+#include <iostream>
+
+namespace MicroWindowsObjects
+{
+  class FileDescriptor;
+
+  //
+  // Manage Window Classes. Notice you do not need to specify
+  // a Window Procedure function pointer. This is handled for 
+  // you.
+  //
+
+  class WindowClass
+  {
+  public:
+    
+    WindowClass ();
+    WindowClass (LPCSTR    lpszClassName,
+                 UINT      style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW,
+                 int       cbClsExtra = 0,
+                 int       cbWndExtra = 0,
+                 HINSTANCE hInstance = 0,
+                 HICON     hIcon = 0,
+                 HCURSOR   hCursor = 0,
+                 HBRUSH    hbrBackground = 0,
+                 LPCSTR    lpszMenuName = 0);
+    
+    void set_style (UINT style)
+      { wclass.style = style; }
+
+    void set_class_extra (int cbClsExtra)
+      { wclass.cbClsExtra = cbClsExtra; }
+
+    void set_window_extra (int cbWndExtra)
+      { wclass.cbWndExtra = cbWndExtra; }
+
+    void set_instance (HINSTANCE hInstance)
+      { wclass.hInstance = hInstance; }
+
+    void set_icon (HICON hIcon)
+      { wclass.hIcon = hIcon; }
+
+    void set_cursor (HCURSOR hCursor)
+      { wclass.hCursor = hCursor; }
+
+    void set_background (HBRUSH hbrBackground)
+      { wclass.hbrBackground = hbrBackground; }
+
+    void set_menu_name (LPCSTR lpszMenuName)
+      { wclass.lpszMenuName = lpszMenuName; }
+    
+    ATOM register_class ();
+    
+  private:
+
+    //
+    // This variable is a local copy which is 
+    // registered. After that is class does little.
+    //
+
+    WNDCLASS wclass;
+  };
+  
+  class Window
+  {
+    friend WindowClass;
+    
+  public:
+
+    Window ();
+    Window (DWORD     dwExStyle,
+            LPCSTR    lpClassName,
+            LPCSTR    lpWindowName,
+            DWORD     dwStyle,
+            int       x, 
+            int       y,
+            int       nWidth,
+            int       nHeight,
+            HWND      hwndParent,
+            HMENU     hMenu,
+            HINSTANCE hInstance,
+            LPVOID    lpParam);
+
+    virtual ~Window ();
+    
+    HWND create (DWORD     dwExStyle,
+                 LPCSTR    lpClassName,
+                 LPCSTR    lpWindowName,
+                 DWORD     dwStyle,
+                 int       x, 
+                 int       y,
+                 int       nWidth,
+                 int       nHeight,
+                 HWND      hwndParent,
+                 HMENU     hMenu,
+                 HINSTANCE hInstance,
+                 LPVOID    lpParam);
+
+    BOOL destory ();
+
+    HWND get_handle () const
+      { return hwnd; }
+    operator HWND () const
+      { return get_handle (); }
+        
+    BOOL is_visible ()
+      { return IsWindowVisible (hwnd); }
+    BOOL show (int nCmdShow)
+      { return ::ShowWindow (hwnd, nCmdShow); }
+    BOOL update ()
+      { return ::UpdateWindow (hwnd); }
+    BOOL invalidate_rect (CONST RECT *lpRect, BOOL bErase)
+      { return ::InvalidateRect (hwnd, lpRect, bErase); }
+
+    HWND get_focus ()
+      { return ::GetFocus (); }
+    HWND set_focus ()
+      { return ::SetFocus (hwnd); }
+
+    BOOL move (int x, int y, int nWidth, int nHeight, BOOL bRepaint)
+      { return MoveWindow (hwnd, x, y, nWidth, nHeight, bRepaint); }
+
+    // FIXME: Should these be here ?
+    BOOL client_to_screen (LPPOINT lpPoint)
+      { return ::ClientToScreen (hwnd, lpPoint); }
+    BOOL screen_to_client (LPPOINT lpPoint)
+      { return ::ClientToScreen (hwnd, lpPoint); }
+
+    LONG get_long (int nIndex)
+      { return ::GetWindowLong (hwnd, nIndex); }
+    LONG set_long (int nIndex, LONG wNewLong)
+      { return ::SetWindowWord (hwnd, nIndex, wNewLong); }
+    WORD get_word (int nIndex)
+      { return ::GetWindowWord (hwnd, nIndex); }
+    WORD set_word (int nIndex, WORD wNewWord)
+      { return ::SetWindowWord (hwnd, nIndex, wNewWord); }
+
+    DWORD get_class_long (int nIndex)
+      { return ::GetClassLong (hwnd, nIndex); }
+
+    int get_text (LPSTR lpString, int nMaxCount)
+      { return GetWindowText (hwnd, lpString, nMaxCount); }
+    BOOL set_text (LPCSTR lpString)
+      { return SetWindowText (hwnd, lpString); }
+
+    //
+    // File Descriptor handlers.
+    //
+
+    virtual bool attach (const int fd, FileDescriptor& file_descriptor);
+    virtual bool detach (FileDescriptor& file_descriptor);
+
+  protected:
+
+    //
+    // The message handler. Insure you call this class's default
+    // handler for default message handling so any special
+    // filtering can occur.
+    //
+
+    virtual LRESULT message_handler (UINT   msg,
+                                     WPARAM wParam,
+                                     LPARAM lParam);
+
+  private:
+
+    //
+    // We only need one WndProc.
+    //
+
+    static LRESULT CALLBACK WndProc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
+
+    HWND   hwnd;
+    LPVOID lpCreateParams;
+    
+    //
+    // Set of FileDescriptor objects
+    //
+
+    struct ltint 
+    {
+      bool operator() (const FileDescriptor* f1, const FileDescriptor* f2) const;
+    };
+
+    set<FileDescriptor*, ltint> file_descriptors;
+    
+  };
+  
+  class Rect
+  {
+  public:
+
+    Rect () 
+      { empty (); }
+    Rect (int xLeft, int yTop, int xRight, int yBottom) 
+      { set (xLeft, yTop, xRight, yBottom); }
+    Rect (HWND hwnd)
+      { get_window (hwnd); }
+        
+    BOOL get_window (HWND hwnd)
+       { return GetWindowRect (hwnd, &rect); }
+    BOOL get_client (HWND hwnd)
+       { return GetClientRect (hwnd, &rect); }
+
+    BOOL set (int xLeft, int yTop, int xRight, int yBottom)
+      { return ::SetRect (&rect, xLeft, yTop, xRight, yBottom); }
+
+    BOOL empty () 
+      { return ::SetRectEmpty (&rect); }
+
+    Rect& operator= (const Rect& other)
+      { CopyRect (&rect, &other.rect); return *this; }
+
+    operator bool () const
+      { return ::IsRectEmpty (&rect); }
+
+    operator RECT* ()
+      { return &rect; }
+        
+    BOOL copy (LPRECT lpRectDst)
+      { return ::CopyRect (lpRectDst, &rect); }
+
+    BOOL inflate (int dx, int dy) 
+      { return ::InflateRect (&rect, dx, dy); }
+
+    BOOL offset (int dx, int dy)
+      { return ::OffsetRect (&rect, dx, dy); }
+
+    BOOL point_inside (POINT Point)
+      { return PtInRect (&rect, Point); }
+
+    MWCOORD left () const
+      { return rect.left; }
+    MWCOORD top () const
+      { return rect.top; }
+    MWCOORD right () const
+      { return rect.right; }
+    MWCOORD bottom () const
+      { return rect.bottom; }
+        
+  private:
+
+    RECT rect;
+  };
+
+  inline ostream& operator<< (ostream& s, const Rect& r) {
+    s << "rect"
+      << "(l=" << r.left ()  << ",t=" << r.top ()
+      << ",r=" << r.right () << ",b=" << r.bottom ()
+      << ")";
+    return s;
+  }
+
+  //
+  // Generic Paint class. Try to help the paint message.
+  //
+
+  class Paint
+  {
+  public:
+
+    enum { TEXT_BUF_SIZE = 512 };
+    
+    Paint (HWND hwnd);
+    Paint (HWND hwnd, LPARAM lpParam);
+    virtual ~Paint ();
+    
+    //
+    // These begin and end a paint session.
+    //
+
+    void begin (bool init_3d = false, bool draw_3d_in_memory = false);
+    void end ();
+    
+    //
+    // Aspects of the client paint area under our control.
+    //
+
+    operator HWND () 
+      { return hwnd; }
+    operator RECT* ()
+      { return r; }
+    operator HDC () 
+      { return hdc; }
+    operator PAINTSTRUCT* () 
+      { return &ps; }
+    operator POINT* () 
+      { return &pt; }
+
+    GDICOORD get_point_x () const
+      { return pt.x; }
+    GDICOORD get_point_y () const
+      { return pt.y; }
+    
+    MWCOORD left () const
+      { return r.left (); }
+    MWCOORD top () const
+      { return r.top (); }
+    MWCOORD right () const
+      { return r.right (); }
+    MWCOORD bottom () const
+      { return r.bottom (); }
+    
+    //
+    // Colour Control.
+    //
+
+    DWORD get_system_colour (int nIndex)
+      { return ::GetSysColor (nIndex); }
+    
+    //
+    // Pixel, line and rectange draw support.
+    //
+
+    COLORREF set_pixel (int x, int y, COLORREF crColour)
+      { return ::SetPixel (hdc, x, y, crColour); }
+
+    BOOL move_to (int x, int y)
+      { return ::MoveToEx (hdc, x, y, 0); }
+
+    BOOL line_to (int x, int y)
+      { return ::LineTo (hdc, x, y); }
+
+    BOOL line_to (int x1, int y1, int x2, int y2)
+      { if (!move_to (x1, y1)) return FALSE;
+        return line_to (x2, y2); }
+
+    BOOL rectangle (int x1, int y1, int x2, int y2)
+      { return ::Rectangle (hdc, x1, y1, x2, y2); }
+
+    BOOL fill_rectangle (int x1, int y1, int x2, int y2, HBRUSH hbr)
+      { Rect r (x1, y1, x2, y2);
+        return ::FillRect (hdc, r, hbr); }
+    
+    //
+    // Paint any 3d objects.
+    //
+
+    void initialise_3d (bool draw_3d_in_mem) 
+      { if (!draw_3d) { 
+        draw_3d = true; ::init3 (hdc, draw_3d_in_mem ? hwnd : 0); } }
+    void paint_3d ()
+      { if (draw_3d) { ::paint3 (hdc); draw_3d = false; } }
+        
+    //
+    // Text Output.
+    //
+
+    void set_text_fromat (UINT uFormat) 
+       { text_format = uFormat; }
+     
+    int text_out (int x, int y, const char *format, ...);
+
+  private:
+
+    HWND        hwnd;
+    bool        draw_3d;
+    bool        drawing;
+    Rect        r;
+    HDC         hdc;
+    PAINTSTRUCT ps;
+    POINT       pt;
+    UINT        text_format;
+    
+    char        format_buf[TEXT_BUF_SIZE];
+    
+  };
+
+  //
+  // FileDescriptor handles fd event from the  User Registered File 
+  // Descriptor support.
+  //
+
+  class FileDescriptor
+  {
+    friend class Window;
+    
+  public:
+
+    FileDescriptor ();
+    virtual ~FileDescriptor ();
+
+    //
+    // Enable/disable controls.
+    //
+
+    bool enable_read ();
+    bool disable_read ();
+    bool read_enabled () const
+      { return read_is_enabled; }
+    
+    bool enable_write ();
+    bool disable_write ();
+    bool write_enabled () const
+      { return write_is_enabled; }
+    
+    bool enable_except ();
+    bool disable_except ();
+    bool except_enabled () const
+      { return except_is_enabled; }
+    
+    int fd () const
+      { return file_desc; }
+    
+    operator int () const
+      { return fd (); }
+    
+    const Window *get_window () const
+      { return window; }
+    
+  protected:
+
+    //
+    // These are called in responce to user fd messages to the window.
+    //
+
+    virtual LRESULT read ();
+    virtual LRESULT write ();
+    virtual LRESULT except ();
+    
+  private:
+
+    int    file_desc;
+    bool   read_is_enabled;
+    bool   write_is_enabled;
+    bool   except_is_enabled;
+    Window *window;
+    
+  };
+  
+  class Application
+  {
+  public:
+  
+    Application ();
+    Application (MWIMAGEHDR& background);
+    virtual ~Application ();
+    
+    HINSTANCE instance () const
+      { return app_instance; }
+    
+    HINSTANCE prev_instance () const
+      { return app_prev_instance; }
+
+    LPSTR cmd_line () const
+      { return app_cmd_line; }
+
+    int show_cmd ()
+      { return app_show_cmd; }
+        
+    //
+    // This is called the public C linkage WinMain. Do not call.
+    //
+
+    static int WINAPI WinMain (HINSTANCE hInstance, 
+                               HINSTANCE hPrevInstance, 
+                               LPSTR     lpCmdLine,
+                               int       nShowCmd);
+  protected:
+    
+    virtual int initialise ();
+    virtual int shutdown ();
+
+  private:
+    
+    MWIMAGEHDR  *background;
+    HINSTANCE app_instance;
+    HINSTANCE app_prev_instance;
+    LPSTR     app_cmd_line;
+    int       app_show_cmd;
+
+  };
+}
+
+#endif
+
diff -urN lib/microwindows/src/include/mwtypes.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/mwtypes.h
--- lib/microwindows/src/include/mwtypes.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/mwtypes.h	2005-02-21 16:13:18.000000000 +0100
@@ -0,0 +1,581 @@
+#ifndef _MWTYPES_H
+#define _MWTYPES_H
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Exported Microwindows engine typedefs and defines
+ */
+
+/* builtin font std names*/
+#define MWFONT_SYSTEM_VAR	"System"	/* winSystem 14x16 (ansi)*/
+#define MWFONT_GUI_VAR		"Helvetica"	/* winMSSansSerif 11x13 (ansi)*/
+#define MWFONT_OEM_FIXED	"Terminal"	/* rom8x16 (oem)*/
+#define MWFONT_SYSTEM_FIXED	"SystemFixed"	/* X6x13 (should be ansi)*/
+
+/* Text/GetTextSize encoding flags*/
+#define MWTF_ASCII	0x0000	/* 8 bit packing, ascii*/
+#define MWTF_UTF8	0x0001	/* 8 bit packing, utf8*/
+#define MWTF_UC16	0x0002	/* 16 bit packing, unicode 16*/
+#define MWTF_UC32	0x0004	/* 32 bit packing, unicode 32*/
+#define MWTF_PACKMASK	0x0007	/* packing mask*/
+
+/* Text alignment flags*/
+#define MWTF_TOP	0x0010	/* align on top*/
+#define MWTF_BASELINE	0x0020	/* align on baseline*/
+#define MWTF_BOTTOM	0x0040	/* align on bottom*/
+
+/* SetFontAttr flags*/
+#define MWTF_KERNING	0x1000	/* font kerning*/
+#define MWTF_ANTIALIAS	0x2000	/* antialiased output*/
+#define MWTF_UNDERLINE	0x4000	/* draw underline*/
+
+/* Drawing modes*/
+#define	MWMODE_SET	0	/* draw pixels as given (default) */
+#define	MWMODE_XOR	1	/* draw pixels using XOR */
+#define	MWMODE_OR	2	/* draw pixels using OR (notimp)*/
+#define	MWMODE_AND	3	/* draw pixels using AND (notimp)*/
+#define MWMODE_MAX	3
+
+/* Mouse button bits*/
+#define MWBUTTON_L	04
+#define MWBUTTON_M	02
+#define MWBUTTON_R	01
+
+/* Color defines*/
+#define MWRGB(r,g,b)	((MWCOLORVAL)(((unsigned char)(r)|\
+				((unsigned short)((unsigned char)(g))<<8))|\
+				(((unsigned long)(unsigned char)(b))<<16)))
+#define MWF_PALINDEX	0x01000000
+#define MWPALINDEX(x)	((MWCOLORVAL)MWF_PALINDEX | (x))
+
+/* 
+ * ROP blitter opcodes
+ */
+#define MWROP_EXTENSION		0xff000000L	/* rop extension bits*/
+
+/* copy src -> dst*/
+#define MWROP_SRCCOPY		0x00000000L
+
+/* copy src -> dst except for transparent color in src*/
+#define MWROP_SRCTRANSCOPY	0x01000000L
+
+/* alpha blend src -> dst with constant alpha, alpha value in low 8 bits*/
+#define MWROP_BLENDCONSTANT	0x02000000L
+
+/* alpha blend fg/bg color -> dst with src as alpha channel*/
+#define MWROP_BLENDFGBG		0x03000000L
+
+/* alpha blend src -> dst with separate per pixel alpha channel*/
+#define MWROP_BLENDCHANNEL	0x04000000L
+
+/* stretch src -> dst*/
+#define MWROP_STRETCH		0x05000000L
+
+#define MWROP_SRCAND		0x06000000L
+#define MWROP_SRCINVERT		0x07000000L
+#define MWROP_BLACKNESS     	0x08000000L
+
+/* 
+ * Pixel formats
+ * Note the two pseudo pixel formats are never returned by display drivers,
+ * but rather used as a data structure type in GrArea.  The other
+ * types are both returned by display drivers and used as pixel packing
+ * specifiers.
+ */
+#define MWPF_RGB	   0	/* pseudo, convert from packed 32 bit RGB*/
+#define MWPF_PIXELVAL	   1	/* pseudo, no convert from packed PIXELVAL*/
+#define MWPF_PALETTE	   2	/* pixel is packed 8 bits 1, 4 or 8 pal index*/
+#define MWPF_TRUECOLOR0888 3	/* pixel is packed 32 bits 8/8/8 truecolor*/
+#define MWPF_TRUECOLOR888  4	/* pixel is packed 24 bits 8/8/8 truecolor*/
+#define MWPF_TRUECOLOR565  5	/* pixel is packed 16 bits 5/6/5 truecolor*/
+#define MWPF_TRUECOLOR555  6	/* pixel is packed 16 bits 5/5/5 truecolor*/
+#define MWPF_TRUECOLOR332  7	/* pixel is packed 8 bits 3/3/2 truecolor*/
+
+/*
+ * MWPIXELVAL definition: changes based on target system
+ * Set using -DMWPIXEL_FORMAT=MWPF_XXX
+ *
+ * For the Nano-X server, it is important to use the correct MWPF_* value
+ * for the MWPIXEL_FORMAT macro in order to match the hardware,
+ * while the Nano-X clients that includes this file can get away with
+ * a default pixel format of 24-bit color as the client will either:
+ *    1) Use the MWPF_PIXELVAL native format when calling GrReadArea, in
+ *       which case we have to have enough spare room to hold 32-bit
+ *       pixlevalues (hence the default MWPF_TRUECOLOR0888 format), or
+ *    2) Will use some other PF_* format, in which case the application
+ *       is well aware of which pixel-format it uses and can avoid the
+ *       device specific RGB2PIXEL and use RGB2PIXEL565 etc. instead,
+ *       and specifiy the pixel fomar as MWPF_TRUECOLOR565 etc. when
+ *       calling the GrArea function(s).
+ */
+#ifndef MWPIXEL_FORMAT
+#define MWPIXEL_FORMAT	MWPF_TRUECOLOR0888
+#endif
+
+#if defined(__AS386_16__)
+/* Force 8 bit palettized display for ELKS*/
+#undef MWPIXEL_FORMAT
+#define MWPIXEL_FORMAT	MWPF_PALETTE
+#endif
+
+#if MWPIXEL_FORMAT == MWPF_TRUECOLOR565
+typedef unsigned short MWPIXELVAL;
+#else
+  #if MWPIXEL_FORMAT == MWPF_TRUECOLOR332
+  typedef unsigned char MWPIXELVAL;
+  #else
+    #if MWPIXEL_FORMAT == MWPF_PALETTE
+    typedef unsigned char MWPIXELVAL;
+    #else
+      typedef unsigned long MWPIXELVAL;
+    #endif
+  #endif
+#endif
+
+/*
+ * Type definitions
+ */
+typedef int		MWCOORD;	/* device coordinates*/
+typedef int		MWBOOL;		/* boolean value*/
+typedef unsigned char	MWUCHAR;	/* unsigned char*/
+typedef unsigned long	MWCOLORVAL;	/* device-independent color value*/
+typedef unsigned short	MWIMAGEBITS;	/* bitmap image unit size*/
+typedef unsigned long	MWTIMEOUT;	/* timeout value */
+
+/* dbl linked list data structure*/
+typedef struct _mwlist {		/* LIST must be first decl in struct*/
+	struct _mwlist *next;		/* next item*/
+	struct _mwlist *prev;		/* previous item*/
+} MWLIST, *PMWLIST;
+
+/* dbl linked list head data structure*/
+typedef struct _mwlisthead {
+	struct _mwlist *head;		/* first item*/
+	struct _mwlist *tail;		/* last item*/
+} MWLISTHEAD, *PMWLISTHEAD;
+
+/* GetScreenInfo structure*/
+typedef struct {
+	MWCOORD  rows;		/* number of rows on screen */
+	MWCOORD  cols;		/* number of columns on screen */
+	int 	 xdpcm;		/* dots/centimeter in x direction */
+	int 	 ydpcm;		/* dots/centimeter in y direction */
+	int	 planes;	/* hw # planes*/
+	int	 bpp;		/* hw bpp*/
+	long	 ncolors;	/* hw number of colors supported*/
+	int 	 fonts;		/* number of built-in fonts */
+	int 	 buttons;	/* buttons which are implemented */
+	int	 modifiers;	/* modifiers which are implemented */
+	int	 pixtype;	/* format of pixel value*/
+	MWCOORD	 xpos;		/* current x mouse position*/
+	MWCOORD	 ypos;		/* current y mouse position*/
+
+/* items below are get/set by the window manager and not used internally*/
+	int	vs_width;	/* virtual screen width/height*/
+	int	vs_height;
+	int	ws_width;	/* workspace width/height*/
+	int	ws_height;
+} MWSCREENINFO, *PMWSCREENINFO;
+
+/* GetFontInfo structure*/
+typedef struct {
+	int 	maxwidth;	/* maximum width of any char */
+	int 	height;		/* height of font in pixels*/
+	int 	baseline;	/* baseline (ascent) of font */
+	int	firstchar;	/* first character in font*/
+	int	lastchar;	/* last character in font*/
+	MWBOOL	fixed;		/* TRUE if font is fixed width */
+	MWUCHAR	widths[256];	/* table of character widths */
+} MWFONTINFO, *PMWFONTINFO;
+
+/* logical font descriptor*/
+
+/* font classes - used internally*/
+#define MWLF_CLASS_BUILTIN	1	/* Builtin fonts (bitmaps) */
+#define MWLF_CLASS_FREETYPE	2	/* FreeType fonts in TT format */
+#define MWLF_CLASS_T1LIB	3	/* T1LIB outlined Adobe Type 1 fonts */
+#define MWLF_CLASS_ANY		4	/* Any font*/
+
+#define MWLF_FACESIZE		64	/* max facename size*/
+
+/* font type selection - lfOutPrecision*/
+#define MWLF_TYPE_DEFAULT	0	/* any font*/
+#define MWLF_TYPE_SCALED	4	/* outlined font (tt or adobe)*/
+#define MWLF_TYPE_RASTER	5	/* raster only*/
+#define MWLF_TYPE_TRUETYPE	7	/* truetype only*/
+#define MWLF_TYPE_ADOBE		10	/* adobe type 1 only*/
+
+/* font weights - lfWeight*/
+#define MWLF_WEIGHT_DEFAULT	0	/* any weight*/
+#define MWLF_WEIGHT_THIN	100	/* thin*/
+#define MWLF_WEIGHT_EXTRALIGHT	200
+#define MWLF_WEIGHT_LIGHT	300	/* light */
+#define MWLF_WEIGHT_NORMAL	400	/* regular*/
+#define MWLF_WEIGHT_REGULAR	400
+#define MWLF_WEIGHT_MEDIUM	500	/* medium */
+#define MWLF_WEIGHT_DEMIBOLD	600
+#define MWLF_WEIGHT_BOLD	700	/* bold*/
+#define MWLF_WEIGTH_EXTRABOLD	800
+#define MWLF_WEIGHT_BLACK	900	/* black */
+
+/* font charset - lfCharSet*/
+#define MWLF_CHARSET_ANSI	0	/* win32 ansi*/
+#define MWLF_CHARSET_DEFAULT	1	/* any charset*/
+#define MWLF_CHARSET_UNICODE	254	/* unicode*/
+#define MWLF_CHARSET_OEM	255	/* local hw*/
+
+/* font pitch - lfPitch */
+#define MWLF_PITCH_DEFAULT		0	/* any pitch */
+#define MWLF_PITCH_ULTRACONDENSED	10
+#define MWLF_PITCH_EXTRACONDENSED	20
+#define MWLF_PITCH_CONDENSED		30
+#define MWLF_PITCH_SEMICONDENSED	40
+#define MWLF_PITCH_NORMAL		50
+#define MWLF_PITCH_SEMIEXPANDED		60
+#define MWLF_PITCH_EXPANDED		70
+#define MWLF_PITCH_EXTRAEXPANDED	80
+#define MWLF_PITCH_ULTRAEXPANDED	90
+
+/* flags for the GdAddFont function */
+#define MWLF_FLAGS_ALIAS	1
+
+typedef struct {
+	long	lfHeight;		/* desired height in pixels*/
+	long	lfWidth;		/* desired width in pixels or 0*/
+	long	lfEscapement;		/* rotation in tenths of degree*/
+	long	lfOrientation;		/* not used*/
+	long	lfWeight;		/* font weight*/
+	MWUCHAR	lfItalic;		/* =1 for italic */
+	MWUCHAR	lfUnderline;		/* =1 for underline */
+	MWUCHAR	lfStrikeOut;		/* not used*/
+	MWUCHAR	lfCharSet;		/* font character set*/
+	MWUCHAR	lfOutPrecision;		/* font type selection*/
+	MWUCHAR	lfClipPrecision;	/* not used*/
+	MWUCHAR	lfQuality;		/* not used*/
+
+	/* the following differs from windows font model*/
+	MWUCHAR	lfRoman;		/* =1 for Roman letters (upright) */
+	MWUCHAR	lfSerif;		/* =1 for Serifed font */
+	MWUCHAR	lfSansSerif;		/* =1 for Sans-serif font */
+	MWUCHAR	lfModern;		/* =1 for Modern font */
+	MWUCHAR	lfMonospace;		/* =1 for Monospaced font */
+	MWUCHAR	lfProportional;		/* =1 for Proportional font */
+	MWUCHAR	lfOblique;		/* =1 for Oblique (kind of Italic) */
+	MWUCHAR	lfSmallCaps;		/* =1 for small caps */
+	MWUCHAR	lfPitch;		/* font pitch (width) */
+
+	char	lfFaceName[MWLF_FACESIZE];	/* font name, may be aliased*/
+} MWLOGFONT, *PMWLOGFONT;
+
+/*
+ * Macros to initialize the MWLOGFONT structure to the most common defaults
+ * needed by application programs and the nano-X server program.
+ */
+
+#define MWLF_Clear(lf)					\
+	do {						\
+		(lf)->lfHeight = 0;			\
+		(lf)->lfWidth = 0;			\
+		(lf)->lfEscapement = 0;			\
+		(lf)->lfOrientation = 0;		\
+		(lf)->lfWeight = MWLF_WEIGHT_REGULAR;	\
+		(lf)->lfPitch = 0;			\
+		(lf)->lfItalic = 0;			\
+		(lf)->lfOblique = 0;			\
+		(lf)->lfRoman = 0;			\
+		(lf)->lfSerif = 0;			\
+		(lf)->lfSansSerif = 0;			\
+		(lf)->lfModern = 0;			\
+		(lf)->lfMonospace = 0;			\
+		(lf)->lfProportional = 0;		\
+		(lf)->lfSmallCaps = 0;			\
+		(lf)->lfUnderline = 0;			\
+		(lf)->lfStrikeOut = 0;			\
+		(lf)->lfCharSet = 0;			\
+		(lf)->lfOutPrecision = 0;		\
+		(lf)->lfClipPrecision = 0;		\
+		(lf)->lfQuality = 0;			\
+		(lf)->lfFaceName[0] = '\0';		\
+	} while (0)
+
+#define MWLF_SetBold(lf)				\
+	do {						\
+		(lf)->lfWeight = MWLF_WEIGHT_BOLD;	\
+	} while (0)
+
+#define MWLF_SetRegular(lf)				\
+	do {						\
+		(lf)->lfWeight = MWLF_WEIGHT_REGULAR;	\
+	} while (0)
+
+#define MWLF_SetItalics(lf)				\
+	do {						\
+		(lf)->lfItalic = 1;			\
+		(lf)->lfOblique = 0;			\
+		(lf)->lfRoman = 0;			\
+	} while (0)
+
+#define MWLF_SetRoman(lf)				\
+	do {						\
+		(lf)->lfItalic = 0;			\
+		(lf)->lfOblique = 0;			\
+		(lf)->lfRoman = 1;			\
+	} while (0)
+
+/*
+ * Rectangle and point structures.
+ * These structures are "inherited" in wingdi.h for
+ * the Win32 RECT and POINT structures, so they must match
+ * Microsoft's definition.
+ */
+
+/* MWPOINT used in GdPoly, GdFillPoly*/
+typedef struct {
+	MWCOORD x;
+	MWCOORD y;
+} MWPOINT;
+
+/* MWRECT used in region routines*/
+typedef struct {
+	MWCOORD	left;
+	MWCOORD	top;
+	MWCOORD	right;
+	MWCOORD	bottom;
+} MWRECT;
+
+/* dynamically allocated multi-rectangle clipping region*/
+typedef struct {
+	int	size;		/* malloc'd # of rectangles*/
+	int	numRects;	/* # rectangles in use*/
+	int	type; 		/* region type*/
+	MWRECT *rects;		/* rectangle array*/
+	MWRECT	extents;	/* bounding box of region*/
+} MWCLIPREGION;
+
+/* region types */
+#define MWREGION_ERROR		0
+#define MWREGION_NULL		1
+#define MWREGION_SIMPLE		2
+#define MWREGION_COMPLEX	3
+
+/* GdRectInRegion return codes*/
+#define MWRECT_OUT	0	/* rectangle not in region*/
+#define MWRECT_ALLIN	1	/* rectangle all in region*/
+#define MWRECT_PARTIN	2	/* rectangle partly in region*/
+
+/* GdAllocPolyRegion types*/
+#define MWPOLY_EVENODD		1
+#define MWPOLY_WINDING		2
+
+/* In-core color palette structure*/
+typedef struct {
+	MWUCHAR	r;
+	MWUCHAR	g;
+	MWUCHAR	b;
+} MWPALENTRY;
+
+/* In-core mono and color image structure*/
+#define MWIMAGE_UPSIDEDOWN	01	/* compression flag: upside down image*/
+#define MWIMAGE_BGR		00	/* compression flag: BGR byte order*/
+#define MWIMAGE_RGB		02	/* compression flag: RGB not BGR bytes*/
+
+typedef struct {
+	int		width;		/* image width in pixels*/
+	int		height;		/* image height in pixels*/
+	int		planes;		/* # image planes*/
+	int		bpp;		/* bits per pixel (1, 4 or 8)*/
+	int		pitch;		/* bytes per line*/
+	int		bytesperpixel;	/* bytes per pixel*/
+	int		compression;	/* compression algorithm*/
+	int		palsize;	/* palette size*/
+	long		transcolor;	/* transparent color or -1 if none*/
+	MWPALENTRY *	palette;	/* palette*/
+	MWUCHAR *	imagebits;	/* image bits (dword right aligned)*/
+} MWIMAGEHDR, *PMWIMAGEHDR;
+
+/* image information structure - returned by GdGetImageInfo*/
+typedef struct {
+	int		id;		/* image id*/
+	int		width;		/* image width in pixels*/
+	int		height;		/* image height in pixels*/
+	int		planes;		/* # image planes*/
+	int		bpp;		/* bits per pixel (1, 4 or 8)*/
+	int		pitch;		/* bytes per line*/
+	int		bytesperpixel;	/* bytes per pixel*/
+	int		compression;	/* compression algorithm*/
+	int		palsize;	/* palette size*/
+	MWPALENTRY 	palette[256];	/* palette*/
+} MWIMAGEINFO, *PMWIMAGEINFO;
+
+#define	MWMAX_CURSOR_SIZE 16		/* maximum cursor x and y size*/
+
+/* In-core software cursor structure*/
+typedef struct {
+	int		width;			/* cursor width in pixels*/
+	int		height;			/* cursor height in pixels*/
+	MWCOORD		hotx;			/* relative x pos of hot spot*/
+	MWCOORD		hoty;			/* relative y pos of hot spot*/
+	MWCOLORVAL	fgcolor;		/* foreground color*/
+	MWCOLORVAL	bgcolor;		/* background color*/
+	MWIMAGEBITS	image[MWMAX_CURSOR_SIZE];/* cursor image bits*/
+	MWIMAGEBITS	mask[MWMAX_CURSOR_SIZE];/* cursor mask bits*/
+} MWCURSOR, *PMWCURSOR;
+
+typedef struct _mwfont *	PMWFONT;
+
+/* outline and filled arc and pie types*/
+#define MWARC		0x0001	/* arc*/
+#define MWOUTLINE	0x0002
+#define MWARCOUTLINE	0x0003	/* arc + outline*/
+#define MWPIE		0x0004	/* pie (filled)*/
+#define MWELLIPSE	0x0008	/* ellipse outline*/
+#define MWELLIPSEFILL	0x0010	/* ellipse filled*/
+
+#ifdef MWINCLUDECOLORS
+/*
+ * Common colors - note any color including these may not be
+ * available on palettized systems, and the system will
+ * then use the nearest color already in the system palette,
+ * or allocate a new color entry.
+ * These colors are the first 16 entries in the std palette,
+ * and are written to the system palette if writable.
+ */
+#define BLACK		MWRGB( 0  , 0  , 0   )
+#define BLUE		MWRGB( 0  , 0  , 128 )
+#define GREEN		MWRGB( 0  , 128, 0   )
+#define CYAN		MWRGB( 0  , 128, 128 )
+#define RED		MWRGB( 128, 0  , 0   )
+#define MAGENTA		MWRGB( 128, 0  , 128 )
+#define BROWN		MWRGB( 128, 64 , 0   )
+#define LTGRAY		MWRGB( 192, 192, 192 )
+#define GRAY		MWRGB( 128, 128, 128 )
+#define LTBLUE		MWRGB( 0  , 0  , 255 )
+#define LTGREEN		MWRGB( 0  , 255, 0   )
+#define LTCYAN		MWRGB( 0  , 255, 255 )
+#define LTRED		MWRGB( 255, 0  , 0   )
+#define LTMAGENTA	MWRGB( 255, 0  , 255 )
+#define YELLOW		MWRGB( 255, 255, 0   )
+#define WHITE		MWRGB( 255, 255, 255 )
+
+/* other common colors*/
+#define DKGRAY		MWRGB( 32,  32,  32)
+#endif /* MWINCLUDECOLORS*/
+
+/* Keyboard values*/
+typedef unsigned short	MWKEY;
+typedef unsigned char	MWSCANCODE;
+
+#define MWKEY_UNKNOWN		0
+/* Following special control keysyms are mapped to ASCII*/
+#define MWKEY_BACKSPACE		8
+#define MWKEY_TAB		9
+#define MWKEY_ENTER		13
+#define MWKEY_ESCAPE		27
+/* Keysyms from 32-126 are mapped to ASCII*/
+
+#define MWKEY_NONASCII_MASK	0xFF00
+/* Following keysyms are mapped to private use portion of Unicode-16*/
+/* arrows + home/end pad*/
+#define MWKEY_FIRST		0xF800
+#define MWKEY_LEFT		0xF800
+#define MWKEY_RIGHT		0xF801
+#define MWKEY_UP		0xF802
+#define MWKEY_DOWN		0xF803
+#define MWKEY_INSERT		0xF804
+#define MWKEY_DELETE		0xF805
+#define MWKEY_HOME		0xF806
+#define MWKEY_END		0xF807
+#define MWKEY_PAGEUP		0xF808
+#define MWKEY_PAGEDOWN		0xF809
+
+/* Numeric keypad*/
+#define MWKEY_KP0		0xF80A
+#define MWKEY_KP1		0xF80B
+#define MWKEY_KP2		0xF80C
+#define MWKEY_KP3		0xF80D
+#define MWKEY_KP4		0xF80E
+#define MWKEY_KP5		0xF80F
+#define MWKEY_KP6		0xF810
+#define MWKEY_KP7		0xF811
+#define MWKEY_KP8		0xF812
+#define MWKEY_KP9		0xF813
+#define MWKEY_KP_PERIOD		0xF814
+#define MWKEY_KP_DIVIDE		0xF815
+#define MWKEY_KP_MULTIPLY	0xF816
+#define MWKEY_KP_MINUS		0xF817
+#define MWKEY_KP_PLUS		0xF818
+#define MWKEY_KP_ENTER		0xF819
+#define MWKEY_KP_EQUALS		0xF81A
+
+/* Function keys */
+#define MWKEY_F1		0xF81B
+#define MWKEY_F2		0xF81C
+#define MWKEY_F3		0xF81D
+#define MWKEY_F4		0xF81E
+#define MWKEY_F5		0xF81F
+#define MWKEY_F6		0xF820
+#define MWKEY_F7		0xF821
+#define MWKEY_F8		0xF822
+#define MWKEY_F9		0xF823
+#define MWKEY_F10		0xF824
+#define MWKEY_F11		0xF825
+#define MWKEY_F12		0xF827
+
+/* Key state modifier keys*/
+#define MWKEY_NUMLOCK		0xF828
+#define MWKEY_CAPSLOCK		0xF829
+#define MWKEY_SCROLLOCK		0xF82A
+#define MWKEY_LSHIFT		0xF82B
+#define MWKEY_RSHIFT		0xF82C
+#define MWKEY_LCTRL		0xF82D
+#define MWKEY_RCTRL		0xF82E
+#define MWKEY_LALT		0xF82F
+#define MWKEY_RALT		0xF830
+#define MWKEY_LMETA		0xF831
+#define MWKEY_RMETA		0xF832
+#define MWKEY_ALTGR		0xF833
+
+/* Misc function keys*/
+#define MWKEY_PRINT		0xF834
+#define MWKEY_SYSREQ		0xF835
+#define MWKEY_PAUSE		0xF836
+#define MWKEY_BREAK		0xF837
+#define MWKEY_QUIT		0xF838	/* virtual key*/
+#define MWKEY_MENU		0xF839	/* virtual key*/
+#define MWKEY_REDRAW		0xF83A	/* virtual key*/
+
+/* Handheld function keys*/
+#define MWKEY_RECORD		0xF840
+#define MWKEY_PLAY		0xF841
+#define MWKEY_CONTRAST		0xF842
+#define MWKEY_BRIGHTNESS	0xF843
+#define MWKEY_SELECTUP		0xF844
+#define MWKEY_SELECTDOWN	0xF845
+#define MWKEY_ACCEPT		0xF846
+#define MWKEY_CANCEL		0xF847
+#define MWKEY_APP1		0xF848
+#define MWKEY_APP2		0xF849
+#define MWKEY_LAST		0xF849
+
+/* Keyboard state modifiers*/
+typedef unsigned int	MWKEYMOD;
+
+#define MWKMOD_NONE  		0x0000
+#define MWKMOD_LSHIFT		0x0001
+#define MWKMOD_RSHIFT		0x0002
+#define MWKMOD_LCTRL 		0x0040
+#define MWKMOD_RCTRL 		0x0080
+#define MWKMOD_LALT  		0x0100
+#define MWKMOD_RALT  		0x0200
+#define MWKMOD_LMETA 		0x0400		/* Windows key*/
+#define MWKMOD_RMETA 		0x0800		/* Windows key*/
+#define MWKMOD_NUM   		0x1000
+#define MWKMOD_CAPS  		0x2000
+#define MWKMOD_ALTGR 		0x4000
+
+#define MWKMOD_CTRL	(MWKMOD_LCTRL|MWKMOD_RCTRL)
+#define MWKMOD_SHIFT	(MWKMOD_LSHIFT|MWKMOD_RSHIFT)
+#define MWKMOD_ALT	(MWKMOD_LALT|MWKMOD_RALT)
+#define MWKMOD_META	(MWKMOD_LMETA|MWKMOD_RMETA)
+
+#endif /* _MWTYPES_H*/
diff -urN lib/microwindows/src/include/nano-X.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nano-X.h
--- lib/microwindows/src/include/nano-X.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nano-X.h	2005-02-21 16:13:18.000000000 +0100
@@ -0,0 +1,725 @@
+#ifndef	_NANO_X_H
+#define	_NANO_X_H
+
+#ifdef HAVE_PREFIX
+#define PREFIX(x) SERVERSIDE_ ## x
+#else
+#define PREFIX(x) x
+#endif
+
+/* Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 2000 Alex Holden <alex@linuxhacker.org>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Nano-X public definition header file:  user applications should
+ * include only this header file.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mwtypes.h"			/* exported engine MW* types*/
+
+/*
+ * The following typedefs are inherited from the Microwindows
+ * engine layer.
+ */
+typedef MWCOORD 	GR_COORD;	/* coordinate value */
+typedef MWCOORD 	GR_SIZE;	/* size value */
+typedef MWCOLORVAL 	GR_COLOR;	/* full color value */
+typedef MWPIXELVAL 	GR_PIXELVAL;	/* hw pixel value*/
+typedef MWIMAGEBITS 	GR_BITMAP;	/* bitmap unit */
+typedef MWUCHAR 	GR_CHAR;	/* filename, window title */
+typedef MWKEY	 	GR_KEY;		/* keystroke value*/
+typedef MWSCANCODE	GR_SCANCODE;	/* oem keystroke scancode value*/
+typedef MWKEYMOD	GR_KEYMOD;	/* keystroke modifiers*/
+typedef MWSCREENINFO	GR_SCREEN_INFO;	/* screen information*/
+typedef MWFONTINFO	GR_FONT_INFO;	/* font information*/
+typedef MWIMAGEINFO	GR_IMAGE_INFO;	/* image information*/
+typedef MWIMAGEHDR	GR_IMAGE_HDR;	/* multicolor image representation*/
+typedef MWLOGFONT	GR_LOGFONT;	/* logical font descriptor*/
+typedef MWPALENTRY	GR_PALENTRY;	/* palette entry*/
+typedef MWPOINT		GR_POINT;	/* definition of a point*/
+typedef MWTIMEOUT	GR_TIMEOUT;	/* timeout value */
+
+/* Basic typedefs. */
+typedef int 		GR_COUNT;	/* number of items */
+typedef unsigned char	GR_CHAR_WIDTH;	/* width of character */
+typedef unsigned int	GR_ID;		/* resource ids */
+typedef GR_ID		GR_DRAW_ID;	/* drawable id */
+typedef GR_DRAW_ID	GR_WINDOW_ID;	/* window or pixmap id */
+typedef GR_ID		GR_GC_ID;	/* graphics context id */
+typedef GR_ID		GR_REGION_ID;	/* region id */
+typedef GR_ID		GR_FONT_ID;	/* font id */
+typedef GR_ID		GR_IMAGE_ID;	/* image id */
+typedef unsigned short	GR_BOOL;	/* boolean value */
+typedef int		GR_ERROR;	/* error types*/
+typedef int		GR_EVENT_TYPE;	/* event types */
+typedef int		GR_UPDATE_TYPE;	/* window update types */
+typedef unsigned long	GR_EVENT_MASK;	/* event masks */
+typedef char		GR_FUNC_NAME[25];/* function name */
+typedef unsigned long	GR_WM_PROPS;	/* window property flags */
+typedef unsigned long	GR_SERIALNO;	/* Selection request ID number */
+typedef unsigned short	GR_MIMETYPE;	/* Index into mime type list */
+typedef unsigned long	GR_LENGTH;	/* Length of a block of data */
+typedef unsigned int	GR_BUTTON;	/* mouse button value*/
+
+/* Nano-X rectangle, different from MWRECT*/
+typedef struct {
+	GR_COORD x;
+	GR_COORD y;
+	GR_SIZE  width;
+	GR_SIZE  height;
+} GR_RECT;
+
+/* The root window id. */
+#define	GR_ROOT_WINDOW_ID	((GR_WINDOW_ID) 1)
+
+/* GR_COLOR color constructor*/
+#define GR_RGB(r,g,b)		MWRGB(r,g,b)
+
+/* Drawing modes for GrSetGCMode*/
+#define	GR_MODE_SET		MWMODE_SET
+#define	GR_MODE_XOR		MWMODE_XOR
+#define	GR_MODE_OR		MWMODE_OR
+#define	GR_MODE_AND		MWMODE_AND
+#define GR_MODE_DRAWMASK	0x00FF
+#define GR_MODE_EXCLUDECHILDREN	0x0100		/* exclude children on clip*/
+
+/* builtin font std names*/
+#define GR_FONT_SYSTEM_VAR	MWFONT_SYSTEM_VAR
+#define GR_FONT_GUI_VAR		MWFONT_GUI_VAR
+#define GR_FONT_OEM_FIXED	MWFONT_OEM_FIXED
+#define GR_FONT_SYSTEM_FIXED	MWFONT_SYSTEM_FIXED
+
+/* GrText/GrGetTextSize encoding flags*/
+#define GR_TFASCII		MWTF_ASCII
+#define GR_TFUTF8		MWTF_UTF8
+#define GR_TFUC16		MWTF_UC16
+#define GR_TFUC32		MWTF_UC32
+#define GR_TFPACKMASK		MWTF_PACKMASK
+
+/* GrText alignment flags*/
+#define GR_TFTOP		MWTF_TOP
+#define GR_TFBASELINE		MWTF_BASELINE
+#define GR_TFBOTTOM		MWTF_BOTTOM
+
+/* GrSetFontAttr flags*/
+#define GR_TFKERNING		MWTF_KERNING
+#define GR_TFANTIALIAS		MWTF_ANTIALIAS
+#define GR_TFUNDERLINE		MWTF_UNDERLINE
+
+/* GrArc, GrArcAngle types*/
+#define GR_ARC		MWARC		/* arc only*/
+#define GR_ARCOUTLINE	MWARCOUTLINE	/* arc + outline*/
+#define GR_PIE		MWPIE		/* pie (filled)*/
+
+/* Booleans */
+#define	GR_FALSE		0
+#define	GR_TRUE			1
+
+/* Loadable Image support definition */
+#define GR_IMAGE_MAX_SIZE	(-1)
+
+/* Button flags */
+#define	GR_BUTTON_R		MWBUTTON_R 	/* right button*/
+#define	GR_BUTTON_M		MWBUTTON_M	/* middle button*/
+#define	GR_BUTTON_L		MWBUTTON_L	/* left button */
+#define	GR_BUTTON_ANY		(MWBUTTON_R|MWBUTTON_M|MWBUTTON_L) /* any*/
+
+/* GrSetBackgroundPixmap flags */
+#define GR_BACKGROUND_TILE	0	/* Tile across the window */
+#define GR_BACKGROUND_CENTER	1	/* Draw in center of window */
+#define GR_BACKGROUND_TOPLEFT	2	/* Draw at top left of window */
+#define GR_BACKGROUND_STRETCH	4	/* Stretch image to fit window*/
+#define GR_BACKGROUND_TRANS	8	/* Don't fill in gaps */
+
+/* GrNewPixmapFromData flags*/
+#define GR_BMDATA_BYTEREVERSE	01	/* byte-reverse bitmap data*/
+#define GR_BMDATA_BYTESWAP	02	/* byte-swap bitmap data*/
+
+#if 0 /* don't define unimp'd flags*/
+/* Window property flags */
+#define GR_WM_PROP_NORESIZE	0x04	/* don't let user resize window */
+#define GR_WM_PROP_NOICONISE	0x08	/* don't let user iconise window */
+#define GR_WM_PROP_NOWINMENU	0x10	/* don't display a window menu button */
+#define GR_WM_PROP_NOROLLUP	0x20	/* don't let user roll window up */
+#define GR_WM_PROP_ONTOP	0x200	/* try to keep window always on top */
+#define GR_WM_PROP_STICKY	0x400	/* keep window after desktop change */
+#define GR_WM_PROP_DND		0x2000	/* accept drag and drop icons */
+#endif
+
+/* Window properties*/
+#define GR_WM_PROPS_NOBACKGROUND 0x00000001L/* Don't draw window background*/
+#define GR_WM_PROPS_NOFOCUS	 0x00000002L /* Don't set focus to this window*/
+#define GR_WM_PROPS_NOMOVE	 0x00000004L /* Don't let user move window*/
+#define GR_WM_PROPS_NORAISE	 0x00000008L /* Don't let user raise window*/
+#define GR_WM_PROPS_NODECORATE	 0x00000010L /* Don't redecorate window*/
+#define GR_WM_PROPS_NOAUTOMOVE	 0x00000020L /* Don't move window on 1st map*/
+#define GR_WM_PROPS_NOAUTORESIZE 0x00000040L /* Don't resize window on 1st map*/
+
+/* default decoration style*/
+#define GR_WM_PROPS_APPWINDOW	0x00000000L /* Leave appearance to WM*/
+#define GR_WM_PROPS_APPMASK	0xF0000000L /* Appearance mask*/
+#define GR_WM_PROPS_BORDER	0x80000000L /* Single line border*/
+#define GR_WM_PROPS_APPFRAME	0x40000000L /* 3D app frame (overrides border)*/
+#define GR_WM_PROPS_CAPTION	0x20000000L /* Title bar*/
+#define GR_WM_PROPS_CLOSEBOX	0x10000000L /* Close box*/
+#define GR_WM_PROPS_MAXIMIZE	0x08000000L /* Application is maximized*/
+
+/* Flags for indicating valid bits in GrSetWMProperties call*/
+#define GR_WM_FLAGS_PROPS	0x0001	/* Properties*/
+#define GR_WM_FLAGS_TITLE	0x0002	/* Title*/
+#define GR_WM_FLAGS_BACKGROUND	0x0004	/* Background color*/
+#define GR_WM_FLAGS_BORDERSIZE	0x0008	/* Border size*/
+#define GR_WM_FLAGS_BORDERCOLOR	0x0010	/* Border color*/
+
+/* Window manager properties used by the Gr[GS]etWMProperties calls. */
+/* NOTE: this struct must be hand-packed to a DWORD boundary for nxproto.h*/
+typedef struct {
+  GR_WM_PROPS flags;		/* Which properties valid in struct for set*/
+  GR_WM_PROPS props;		/* Window property bits*/
+  GR_CHAR *title;		/* Window title*/
+  GR_COLOR background;		/* Window background color*/
+  GR_SIZE bordersize;		/* Window border size*/
+  GR_COLOR bordercolor;		/* Window border color*/
+} GR_WM_PROPERTIES;
+
+/* Window properties returned by the GrGetWindowInfo call. */
+typedef struct {
+  GR_WINDOW_ID wid;		/* window id (or 0 if no such window) */
+  GR_WINDOW_ID parent;		/* parent window id */
+  GR_WINDOW_ID child;		/* first child window id (or 0) */
+  GR_WINDOW_ID sibling;		/* next sibling window id (or 0) */
+  GR_BOOL inputonly;		/* TRUE if window is input only */
+  GR_BOOL mapped;		/* TRUE if window is mapped */
+  GR_COUNT unmapcount;		/* reasons why window is unmapped */
+  GR_COORD x;			/* absolute x position of window */
+  GR_COORD y;			/* absolute y position of window */
+  GR_SIZE width;		/* width of window */
+  GR_SIZE height;		/* height of window */
+  GR_SIZE bordersize;		/* size of border */
+  GR_COLOR bordercolor;		/* color of border */
+  GR_COLOR background;		/* background color */
+  GR_EVENT_MASK eventmask;	/* current event mask for this client */
+  GR_WM_PROPS props;		/* window properties */
+} GR_WINDOW_INFO;
+
+/* Graphics context properties returned by the GrGetGCInfo call. */
+typedef struct {
+  GR_GC_ID gcid;		/* GC id (or 0 if no such GC) */
+  int mode;			/* drawing mode */
+  GR_REGION_ID region;		/* user region */
+  GR_FONT_ID font;		/* font number */
+  GR_COLOR foreground;		/* foreground color */
+  GR_COLOR background;		/* background color */
+  GR_BOOL usebackground;	/* use background in bitmaps */
+} GR_GC_INFO;
+
+/* color palette*/
+typedef struct {
+  GR_COUNT count;		/* # valid entries*/
+  GR_PALENTRY palette[256];	/* palette*/
+} GR_PALETTE;
+
+/* Error codes */
+#define	GR_ERROR_BAD_WINDOW_ID		1
+#define	GR_ERROR_BAD_GC_ID		2
+#define	GR_ERROR_BAD_CURSOR_SIZE	3
+#define	GR_ERROR_MALLOC_FAILED		4
+#define	GR_ERROR_BAD_WINDOW_SIZE	5
+#define	GR_ERROR_KEYBOARD_ERROR		6
+#define	GR_ERROR_MOUSE_ERROR		7
+#define	GR_ERROR_INPUT_ONLY_WINDOW	8
+#define	GR_ERROR_ILLEGAL_ON_ROOT_WINDOW	9
+#define	GR_ERROR_TOO_MUCH_CLIPPING	10
+#define	GR_ERROR_SCREEN_ERROR		11
+#define	GR_ERROR_UNMAPPED_FOCUS_WINDOW	12
+#define	GR_ERROR_BAD_DRAWING_MODE	13
+
+/* Event types.
+ * Mouse motion is generated for every motion of the mouse, and is used to
+ * track the entire history of the mouse (many events and lots of overhead).
+ * Mouse position ignores the history of the motion, and only reports the
+ * latest position of the mouse by only queuing the latest such event for
+ * any single client (good for rubber-banding).
+ */
+#define	GR_EVENT_TYPE_ERROR		(-1)
+#define	GR_EVENT_TYPE_NONE		0
+#define	GR_EVENT_TYPE_EXPOSURE		1
+#define	GR_EVENT_TYPE_BUTTON_DOWN	2
+#define	GR_EVENT_TYPE_BUTTON_UP		3
+#define	GR_EVENT_TYPE_MOUSE_ENTER	4
+#define	GR_EVENT_TYPE_MOUSE_EXIT	5
+#define	GR_EVENT_TYPE_MOUSE_MOTION	6
+#define	GR_EVENT_TYPE_MOUSE_POSITION	7
+#define	GR_EVENT_TYPE_KEY_DOWN		8
+#define	GR_EVENT_TYPE_KEY_UP		9
+#define	GR_EVENT_TYPE_FOCUS_IN		10
+#define	GR_EVENT_TYPE_FOCUS_OUT		11
+#define GR_EVENT_TYPE_FDINPUT		12
+#define GR_EVENT_TYPE_UPDATE		13
+#define GR_EVENT_TYPE_CHLD_UPDATE	14	/* never sent*/
+#define GR_EVENT_TYPE_CLOSE_REQ		15
+#define GR_EVENT_TYPE_TIMEOUT		16
+#define GR_EVENT_TYPE_SCREENSAVER	17
+#define GR_EVENT_TYPE_CLIENT_DATA_REQ	18
+#define GR_EVENT_TYPE_CLIENT_DATA	19
+#define GR_EVENT_TYPE_SELECTION_CHANGED 20
+
+/* Event masks */
+#define	GR_EVENTMASK(n)			(((GR_EVENT_MASK) 1) << (n))
+
+#define	GR_EVENT_MASK_NONE		GR_EVENTMASK(GR_EVENT_TYPE_NONE)
+#define	GR_EVENT_MASK_ERROR		GR_EVENTMASK(GR_EVENT_TYPE_ERROR)
+#define	GR_EVENT_MASK_EXPOSURE		GR_EVENTMASK(GR_EVENT_TYPE_EXPOSURE)
+#define	GR_EVENT_MASK_BUTTON_DOWN	GR_EVENTMASK(GR_EVENT_TYPE_BUTTON_DOWN)
+#define	GR_EVENT_MASK_BUTTON_UP		GR_EVENTMASK(GR_EVENT_TYPE_BUTTON_UP)
+#define	GR_EVENT_MASK_MOUSE_ENTER	GR_EVENTMASK(GR_EVENT_TYPE_MOUSE_ENTER)
+#define	GR_EVENT_MASK_MOUSE_EXIT	GR_EVENTMASK(GR_EVENT_TYPE_MOUSE_EXIT)
+#define	GR_EVENT_MASK_MOUSE_MOTION	GR_EVENTMASK(GR_EVENT_TYPE_MOUSE_MOTION)
+#define	GR_EVENT_MASK_MOUSE_POSITION	GR_EVENTMASK(GR_EVENT_TYPE_MOUSE_POSITION)
+#define	GR_EVENT_MASK_KEY_DOWN		GR_EVENTMASK(GR_EVENT_TYPE_KEY_DOWN)
+#define	GR_EVENT_MASK_KEY_UP		GR_EVENTMASK(GR_EVENT_TYPE_KEY_UP)
+#define	GR_EVENT_MASK_FOCUS_IN		GR_EVENTMASK(GR_EVENT_TYPE_FOCUS_IN)
+#define	GR_EVENT_MASK_FOCUS_OUT		GR_EVENTMASK(GR_EVENT_TYPE_FOCUS_OUT)
+#define	GR_EVENT_MASK_FDINPUT		GR_EVENTMASK(GR_EVENT_TYPE_FDINPUT)
+#define	GR_EVENT_MASK_UPDATE		GR_EVENTMASK(GR_EVENT_TYPE_UPDATE)
+#define	GR_EVENT_MASK_CHLD_UPDATE	GR_EVENTMASK(GR_EVENT_TYPE_CHLD_UPDATE)
+#define	GR_EVENT_MASK_CLOSE_REQ		GR_EVENTMASK(GR_EVENT_TYPE_CLOSE_REQ)
+#define	GR_EVENT_MASK_TIMEOUT		GR_EVENTMASK(GR_EVENT_TYPE_TIMEOUT)
+#define GR_EVENT_MASK_SCREENSAVER	GR_EVENTMASK(GR_EVENT_TYPE_SCREENSAVER)
+#define GR_EVENT_MASK_CLIENT_DATA_REQ	GR_EVENTMASK(GR_EVENT_TYPE_CLIENT_DATA_REQ)
+#define GR_EVENT_MASK_CLIENT_DATA	GR_EVENTMASK(GR_EVENT_TYPE_CLIENT_DATA)
+#define GR_EVENT_MASK_SELECTION_CHANGED GR_EVENTMASK(GR_EVENT_TYPE_SELECTION_CHANGED)
+#define	GR_EVENT_MASK_ALL		((GR_EVENT_MASK) -1L)
+
+/* update event types */
+#define GR_UPDATE_MAP		1
+#define GR_UPDATE_UNMAP		2
+#define GR_UPDATE_MOVE		3
+#define GR_UPDATE_SIZE		4
+#define GR_UPDATE_UNMAPTEMP	5	/* unmap during window move/resize*/
+#define GR_UPDATE_ACTIVATE	6	/* toplevel window [de]activate*/
+#define GR_UPDATE_DESTROY	7
+
+/* Event for errors detected by the server.
+ * These events are not delivered to GrGetNextEvent, but instead call
+ * the user supplied error handling function.  Only the first one of
+ * these errors at a time is saved for delivery to the client since
+ * there is not much to be done about errors anyway except complain
+ * and exit.
+ */
+typedef struct {
+  GR_EVENT_TYPE type;		/* event type */
+  GR_FUNC_NAME name;		/* function name which failed */
+  GR_ERROR code;		/* error code */
+  GR_ID id;			/* resource id (maybe useless) */
+} GR_EVENT_ERROR;
+
+/* Event for a mouse button pressed down or released. */
+typedef struct {
+  GR_EVENT_TYPE type;		/* event type */
+  GR_WINDOW_ID wid;		/* window id event delivered to */
+  GR_WINDOW_ID subwid;		/* sub-window id (pointer was in) */
+  GR_COORD rootx;		/* root window x coordinate */
+  GR_COORD rooty;		/* root window y coordinate */
+  GR_COORD x;			/* window x coordinate of mouse */
+  GR_COORD y;			/* window y coordinate of mouse */
+  GR_BUTTON buttons;		/* current state of all buttons */
+  GR_BUTTON changebuttons;	/* buttons which went down or up */
+  GR_KEYMOD modifiers;		/* modifiers (MWKMOD_SHIFT, etc)*/
+  GR_TIMEOUT time;		/* tickcount time value*/
+} GR_EVENT_BUTTON;
+
+/* Event for a keystroke typed for the window with has focus. */
+typedef struct {
+  GR_EVENT_TYPE type;		/* event type */
+  GR_WINDOW_ID wid;		/* window id event delived to */
+  GR_WINDOW_ID subwid;		/* sub-window id (pointer was in) */
+  GR_COORD rootx;		/* root window x coordinate */
+  GR_COORD rooty;		/* root window y coordinate */
+  GR_COORD x;			/* window x coordinate of mouse */
+  GR_COORD y;			/* window y coordinate of mouse */
+  GR_BUTTON buttons;		/* current state of buttons */
+  GR_KEYMOD modifiers;		/* modifiers (MWKMOD_SHIFT, etc)*/
+  GR_KEY ch;			/* 16-bit unicode key value, MWKEY_xxx */
+  GR_SCANCODE scancode;		/* OEM scancode value if available*/
+} GR_EVENT_KEYSTROKE;
+
+/* Event for exposure for a region of a window. */
+typedef struct {
+  GR_EVENT_TYPE type;		/* event type */
+  GR_WINDOW_ID wid;		/* window id */
+  GR_COORD x;			/* window x coordinate of exposure */
+  GR_COORD y;			/* window y coordinate of exposure */
+  GR_SIZE width;		/* width of exposure */
+  GR_SIZE height;		/* height of exposure */
+} GR_EVENT_EXPOSURE;
+
+/* General events for focus in or focus out for a window, or mouse enter
+ * or mouse exit from a window, or window unmapping or mapping, etc.
+ */
+typedef struct {
+  GR_EVENT_TYPE type;		/* event type */
+  GR_WINDOW_ID wid;		/* window id */
+  GR_WINDOW_ID otherid;		/* new/old focus id for focus events*/
+} GR_EVENT_GENERAL;
+
+/* Events for mouse motion or mouse position. */
+typedef struct {
+  GR_EVENT_TYPE type;		/* event type */
+  GR_WINDOW_ID wid;		/* window id event delivered to */
+  GR_WINDOW_ID subwid;		/* sub-window id (pointer was in) */
+  GR_COORD rootx;		/* root window x coordinate */
+  GR_COORD rooty;		/* root window y coordinate */
+  GR_COORD x;			/* window x coordinate of mouse */
+  GR_COORD y;			/* window y coordinate of mouse */
+  GR_BUTTON buttons;		/* current state of buttons */
+  GR_KEYMOD modifiers;		/* modifiers (MWKMOD_SHIFT, etc)*/
+} GR_EVENT_MOUSE;
+
+/* GrRegisterInput event*/
+typedef struct {
+  GR_EVENT_TYPE type;		/* event type */
+  int		fd;		/* input fd*/
+} GR_EVENT_FDINPUT;
+
+/* GR_EVENT_TYPE_UPDATE */
+typedef struct {
+  GR_EVENT_TYPE type;		/* event type */
+  GR_WINDOW_ID wid;		/* select window id*/
+  GR_WINDOW_ID subwid;		/* update window id (=wid for UPDATE event)*/
+  GR_COORD x;			/* new window x coordinate */
+  GR_COORD y;			/* new window y coordinate */
+  GR_SIZE width;		/* new width */
+  GR_SIZE height;		/* new height */
+  GR_UPDATE_TYPE utype;		/* update_type */
+} GR_EVENT_UPDATE;
+
+/* GR_EVENT_TYPE_SCREENSAVER */
+typedef struct {
+  GR_EVENT_TYPE type;		/* event type */
+  GR_BOOL activate;		/* true = activate, false = deactivate */
+} GR_EVENT_SCREENSAVER;
+
+/* GR_EVENT_TYPE_CLIENT_DATA_REQ */
+typedef struct {
+  GR_EVENT_TYPE type;		/* event type */
+  GR_WINDOW_ID wid;		/* ID of requested window */
+  GR_WINDOW_ID rid;		/* ID of window to send data to */
+  GR_SERIALNO serial;		/* Serial number of transaction */
+  GR_MIMETYPE mimetype;		/* Type to supply data as */
+} GR_EVENT_CLIENT_DATA_REQ;
+
+/* GR_EVENT_TYPE_CLIENT_DATA */
+typedef struct {
+  GR_EVENT_TYPE type;		/* event type */
+  GR_WINDOW_ID wid;		/* ID of window data is destined for */
+  GR_WINDOW_ID rid;		/* ID of window data is from */
+  GR_SERIALNO serial;		/* Serial number of transaction */
+  unsigned long len;		/* Total length of data */
+  unsigned long datalen;	/* Length of following data */
+  void *data;			/* Pointer to data (filled in on client side) */
+} GR_EVENT_CLIENT_DATA;
+
+/* GR_EVENT_TYPE_SELECTION_CHANGED */
+typedef struct {
+  GR_EVENT_TYPE type;		/* event type */
+  GR_WINDOW_ID new_owner;	/* ID of new selection owner */
+} GR_EVENT_SELECTION_CHANGED;
+
+/*
+ * Union of all possible event structures.
+ * This is the structure returned by the GrGetNextEvent and similar routines.
+ */
+typedef union {
+  GR_EVENT_TYPE type;			/* event type */
+  GR_EVENT_ERROR error;			/* error event */
+  GR_EVENT_GENERAL general;		/* general window events */
+  GR_EVENT_BUTTON button;		/* button events */
+  GR_EVENT_KEYSTROKE keystroke;		/* keystroke events */
+  GR_EVENT_EXPOSURE exposure;		/* exposure events */
+  GR_EVENT_MOUSE mouse;			/* mouse motion events */
+  GR_EVENT_FDINPUT fdinput;		/* fd input events*/
+  GR_EVENT_UPDATE update;		/* window update events */
+  GR_EVENT_SCREENSAVER screensaver; 	/* Screen saver events */
+  GR_EVENT_CLIENT_DATA_REQ clientdatareq; /* Request for client data events */
+  GR_EVENT_CLIENT_DATA clientdata;	/* Client data events */
+  GR_EVENT_SELECTION_CHANGED selectionchanged; /* Selection owner changed */
+} GR_EVENT;
+
+typedef void (*GR_FNCALLBACKEVENT)(GR_EVENT *);
+
+/* Pixel packings within words. */
+#define	GR_BITMAPBITS	(sizeof(GR_BITMAP) * 8)
+#define	GR_ZEROBITS	((GR_BITMAP) 0x0000)
+#define	GR_ONEBITS	((GR_BITMAP) 0xffff)
+#define	GR_FIRSTBIT	((GR_BITMAP) 0x8000)
+#define	GR_LASTBIT	((GR_BITMAP) 0x0001)
+#define	GR_BITVALUE(n)	((GR_BITMAP) (((GR_BITMAP) 1) << (n)))
+#define	GR_SHIFTBIT(m)	((GR_BITMAP) ((m) << 1))
+#define	GR_NEXTBIT(m)	((GR_BITMAP) ((m) >> 1))
+#define	GR_TESTBIT(m)	(((m) & GR_FIRSTBIT) != 0)
+
+/* Size of bitmaps. */
+#define	GR_BITMAP_SIZE(width, height)	((height) * \
+  (((width) + sizeof(GR_BITMAP) * 8 - 1) / (sizeof(GR_BITMAP) * 8)))
+
+#define	GR_MAX_BITMAP_SIZE \
+  GR_BITMAP_SIZE(MAX_CURSOR_SIZE, MAX_CURSOR_SIZE)
+
+/* GrGetSysColor colors*/
+/* desktop background*/
+#define GR_COLOR_DESKTOP           0
+
+/* caption colors*/
+#define GR_COLOR_ACTIVECAPTION     1
+#define GR_COLOR_ACTIVECAPTIONTEXT 2
+#define GR_COLOR_INACTIVECAPTION   3
+#define GR_COLOR_INACTIVECAPTIONTEXT 4
+
+/* 3d border shades*/
+#define GR_COLOR_WINDOWFRAME       5
+#define GR_COLOR_BTNSHADOW         6
+#define GR_COLOR_3DLIGHT           7
+#define GR_COLOR_BTNHIGHLIGHT      8
+
+/* top level application window backgrounds/text*/
+#define GR_COLOR_APPWINDOW         9
+#define GR_COLOR_APPTEXT           10
+
+/* button control backgrounds/text (usually same as app window colors)*/
+#define GR_COLOR_BTNFACE           11
+#define GR_COLOR_BTNTEXT           12
+
+/* edit/listbox control backgrounds/text, selected highlights*/
+#define GR_COLOR_WINDOW            13
+#define GR_COLOR_WINDOWTEXT        14
+#define GR_COLOR_HIGHLIGHT         15
+#define GR_COLOR_HIGHLIGHTTEXT     16
+#define GR_COLOR_GRAYTEXT          17
+
+/* menu backgrounds/text*/
+#define GR_COLOR_MENUTEXT          18
+#define GR_COLOR_MENU              19
+
+/* Error strings per error number*/
+#define GR_ERROR_STRINGS		\
+	"",				\
+	"Bad window id: %d\n",		\
+	"Bad graphics context: %d\n",	\
+	"Bad cursor size\n",		\
+	"Out of server memory\n",	\
+	"Bad window size: %d\n",	\
+	"Keyboard error\n",		\
+	"Mouse error\n",		\
+	"Input only window: %d\n",	\
+	"Illegal on root window: %d\n",	\
+	"Clipping overflow\n",		\
+	"Screen error\n",		\
+	"Unmapped focus window: %d\n",	\
+	"Bad drawing mode gc: %d\n"
+
+extern const char *const  nxErrorStrings[];
+
+/* Public graphics routines. */
+void		GrFlush(void);
+int		PREFIX(GrOpen)(void);
+void		PREFIX(GrClose)(void);
+void		PREFIX(GrGetScreenInfo)(GR_SCREEN_INFO *sip);
+GR_COLOR	PREFIX(GrGetSysColor)(int index);
+GR_WINDOW_ID	PREFIX(GrNewWindow)(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y,
+			GR_SIZE width, GR_SIZE height, GR_SIZE bordersize,
+			GR_COLOR background, GR_COLOR bordercolor);
+GR_WINDOW_ID    PREFIX(GrNewPixmap)(GR_SIZE width, GR_SIZE height, void * addr);
+GR_WINDOW_ID	PREFIX(GrNewInputWindow)(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y,
+				GR_SIZE width, GR_SIZE height);
+void		PREFIX(GrDestroyWindow)(GR_WINDOW_ID wid);
+GR_GC_ID	PREFIX(GrNewGC)(void);
+GR_GC_ID	PREFIX(GrCopyGC)(GR_GC_ID gc);
+void		PREFIX(GrGetGCInfo)(GR_GC_ID gc, GR_GC_INFO *gcip);
+void		PREFIX(GrDestroyGC)(GR_GC_ID gc);
+GR_REGION_ID	PREFIX(GrNewRegion)(void);
+GR_REGION_ID	PREFIX(GrNewPolygonRegion)(int mode, GR_COUNT count, GR_POINT *points);
+void		PREFIX(GrDestroyRegion)(GR_REGION_ID region);
+void		PREFIX(GrUnionRectWithRegion)(GR_REGION_ID region, GR_RECT *rect);
+void		PREFIX(GrUnionRegion)(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+			GR_REGION_ID src_rgn2);
+void		PREFIX(GrIntersectRegion)(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+			GR_REGION_ID src_rgn2);
+void		PREFIX(GrSubtractRegion)(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+			GR_REGION_ID src_rgn2);
+void		PREFIX(GrXorRegion)(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+			GR_REGION_ID src_rgn2);
+void		PREFIX(GrSetGCRegion)(GR_GC_ID gc, GR_REGION_ID region);
+GR_BOOL		PREFIX(GrPointInRegion)(GR_REGION_ID region, GR_COORD x, GR_COORD y);
+int		PREFIX(GrRectInRegion)(GR_REGION_ID region, GR_COORD x, GR_COORD y,
+			GR_COORD w, GR_COORD h);
+GR_BOOL		PREFIX(GrEmptyRegion)(GR_REGION_ID region);
+GR_BOOL		PREFIX(GrEqualRegion)(GR_REGION_ID rgn1, GR_REGION_ID rgn2);
+void		PREFIX(GrOffsetRegion)(GR_REGION_ID region, GR_SIZE dx, GR_SIZE dy);
+int		PREFIX(GrGetRegionBox)(GR_REGION_ID region, GR_RECT *rect);
+void		PREFIX(GrMapWindow)(GR_WINDOW_ID wid);
+void		PREFIX(GrUnmapWindow)(GR_WINDOW_ID wid);
+void		PREFIX(GrRaiseWindow)(GR_WINDOW_ID wid);
+void		PREFIX(GrLowerWindow)(GR_WINDOW_ID wid);
+void		PREFIX(GrMoveWindow)(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y);
+void		PREFIX(GrResizeWindow)(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height);
+void		PREFIX(GrReparentWindow)(GR_WINDOW_ID wid, GR_WINDOW_ID pwid,
+			GR_COORD x, GR_COORD y);
+void		PREFIX(GrGetWindowInfo)(GR_WINDOW_ID wid, GR_WINDOW_INFO *infoptr);
+void		PREFIX(GrSetWMProperties)(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props);
+void		PREFIX(GrGetWMProperties)(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props);
+GR_FONT_ID	PREFIX(GrCreateFont)(GR_CHAR *name, GR_COORD height,
+			GR_LOGFONT *plogfont);
+void		PREFIX(GrSetFontSize)(GR_FONT_ID fontid, GR_COORD size);
+void		PREFIX(GrSetFontRotation)(GR_FONT_ID fontid, int tenthsdegrees);
+void		PREFIX(GrSetFontAttr)(GR_FONT_ID fontid, int setflags, int clrflags);
+void		PREFIX(GrDestroyFont)(GR_FONT_ID fontid);
+void		PREFIX(GrGetFontInfo)(GR_FONT_ID font, GR_FONT_INFO *fip);
+GR_WINDOW_ID	PREFIX(GrGetFocus)(void);
+void		PREFIX(GrSetFocus)(GR_WINDOW_ID wid);
+void		PREFIX(GrSetBorderColor)(GR_WINDOW_ID wid, GR_COLOR color);
+void		PREFIX(GrClearWindow)(GR_WINDOW_ID wid, GR_BOOL exposeflag);
+void		PREFIX(GrSelectEvents)(GR_WINDOW_ID wid, GR_EVENT_MASK eventmask);
+void		PREFIX(GrGetNextEvent)(GR_EVENT *ep);
+void		PREFIX(GrGetNextEventTimeout)(GR_EVENT *ep, GR_TIMEOUT timeout);
+void		PREFIX(GrCheckNextEvent)(GR_EVENT *ep);
+int		PREFIX(GrPeekEvent)(GR_EVENT *ep);
+void		PREFIX(GrLine)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x1, GR_COORD y1,
+			GR_COORD x2, GR_COORD y2);
+void		PREFIX(GrPoint)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y);
+void		PREFIX(GrPoints)(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count,
+			GR_POINT *pointtable);
+void		PREFIX(GrRect)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+			GR_SIZE width, GR_SIZE height);
+void		PREFIX(GrFillRect)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+			GR_SIZE width, GR_SIZE height);
+void		PREFIX(GrPoly)(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count,
+			GR_POINT *pointtable);
+void		PREFIX(GrFillPoly)(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count,
+			GR_POINT *pointtable);
+void		PREFIX(GrEllipse)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+			GR_SIZE rx, GR_SIZE ry);
+void		PREFIX(GrFillEllipse)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x,
+			GR_COORD y, GR_SIZE rx, GR_SIZE ry);
+void		PREFIX(GrArc)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+			GR_SIZE rx, GR_SIZE ry, GR_COORD ax, GR_COORD ay,
+			GR_COORD bx, GR_COORD by, int type);
+void		PREFIX(GrArcAngle)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+			GR_SIZE rx, GR_SIZE ry, GR_COORD angle1,
+			GR_COORD angle2, int type); /* floating point required*/
+void		PREFIX(GrSetGCForeground)(GR_GC_ID gc, GR_COLOR foreground);
+void		PREFIX(GrSetGCBackground)(GR_GC_ID gc, GR_COLOR background);
+void		PREFIX(GrSetGCUseBackground)(GR_GC_ID gc, GR_BOOL flag);
+void		PREFIX(GrSetGCMode)(GR_GC_ID gc, int mode);
+void		PREFIX(GrSetGCFont)(GR_GC_ID gc, GR_FONT_ID font);
+void		PREFIX(GrGetGCTextSize)(GR_GC_ID gc, void *str, int count, int flags,
+			GR_SIZE *retwidth, GR_SIZE *retheight,GR_SIZE *retbase);
+void		PREFIX(GrReadArea)(GR_DRAW_ID id, GR_COORD x, GR_COORD y, GR_SIZE width,
+			GR_SIZE height, GR_PIXELVAL *pixels);
+void		PREFIX(GrArea)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+			GR_SIZE width,GR_SIZE height,void *pixels,int pixtype);
+void            PREFIX(GrCopyArea)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+			GR_SIZE width, GR_SIZE height, GR_DRAW_ID srcid,
+			GR_COORD srcx, GR_COORD srcy, int op);
+void		PREFIX(GrBitmap)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+			GR_SIZE width, GR_SIZE height, GR_BITMAP *imagebits);
+void		PREFIX(GrDrawImageBits)(GR_DRAW_ID id,GR_GC_ID gc,GR_COORD x,GR_COORD y,
+			GR_IMAGE_HDR *pimage);
+void		PREFIX(GrDrawImageFromFile)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x,
+			GR_COORD y, GR_SIZE width, GR_SIZE height,
+			char *path, int flags);
+GR_IMAGE_ID	PREFIX(GrLoadImageFromFile)(char *path, int flags);
+void		PREFIX(GrDrawImageToFit)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x,
+			GR_COORD y, GR_SIZE width, GR_SIZE height,
+			GR_IMAGE_ID imageid);
+void		PREFIX(GrFreeImage)(GR_IMAGE_ID id);
+void		PREFIX(GrGetImageInfo)(GR_IMAGE_ID id, GR_IMAGE_INFO *iip);
+void		PREFIX(GrText)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+			void *str, GR_COUNT count, int flags);
+void		PREFIX(GrSetCursor)(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height,
+			GR_COORD hotx, GR_COORD hoty, GR_COLOR foreground,
+			GR_COLOR background, GR_BITMAP *fbbitmap,
+			GR_BITMAP *bgbitmap);
+void		PREFIX(GrMoveCursor)(GR_COORD x, GR_COORD y);
+void		PREFIX(GrGetSystemPalette)(GR_PALETTE *pal);
+void		PREFIX(GrSetSystemPalette)(GR_COUNT first, GR_PALETTE *pal);
+void		PREFIX(GrFindColor)(GR_COLOR c, GR_PIXELVAL *retpixel);
+void		PREFIX(GrReqShmCmds)(long shmsize);
+void		PREFIX(GrInjectPointerEvent)(MWCOORD x, MWCOORD y,
+			int button, int visible);
+void		PREFIX(GrInjectKeyboardEvent)(GR_WINDOW_ID wid, GR_KEY keyvalue,
+			GR_KEYMOD modifiers, GR_SCANCODE scancode,
+			GR_BOOL pressed);
+void		PREFIX(GrCloseWindow)(GR_WINDOW_ID wid);
+void		PREFIX(GrKillWindow)(GR_WINDOW_ID wid);
+void		PREFIX(GrSetScreenSaverTimeout)(GR_TIMEOUT timeout);
+void		PREFIX(GrSetSelectionOwner)(GR_WINDOW_ID wid, GR_CHAR *typelist);
+GR_WINDOW_ID	PREFIX(GrGetSelectionOwner)(GR_CHAR **typelist);
+void		PREFIX(GrRequestClientData)(GR_WINDOW_ID wid, GR_WINDOW_ID rid,
+			GR_SERIALNO serial, GR_MIMETYPE mimetype);
+void		PREFIX(GrSendClientData)(GR_WINDOW_ID wid, GR_WINDOW_ID did,
+			GR_SERIALNO serial, GR_LENGTH len, GR_LENGTH thislen,
+			void *data);
+void		PREFIX(GrBell)(void);
+void		PREFIX(GrSetBackgroundPixmap)(GR_WINDOW_ID wid, GR_WINDOW_ID pixmap,
+			int flags);
+void		GrRegisterInput(int fd);
+void		GrMainLoop(GR_FNCALLBACKEVENT fncb);
+GR_FNCALLBACKEVENT GrSetErrorHandler(GR_FNCALLBACKEVENT fncb);
+void		GrDefaultErrorHandler(GR_EVENT *ep);
+
+/* passive library entry points - available with client/server only*/
+void		GrPrepareSelect(int *maxfd,void *rfdset);
+void		GrServiceSelect(void *rfdset, GR_FNCALLBACKEVENT fncb);
+
+/* nxutil.c - utility routines*/
+GR_WINDOW_ID	GrNewWindowEx(GR_WM_PROPS props, GR_CHAR *title,
+			GR_WINDOW_ID parent, GR_COORD x, GR_COORD y,
+			GR_SIZE width, GR_SIZE height, GR_COLOR background);
+void		GrDrawLines(GR_DRAW_ID w, GR_GC_ID gc, GR_POINT *points,
+			GR_COUNT count);
+GR_WINDOW_ID    GrNewPixmapFromData(GR_SIZE width, GR_SIZE height, 
+			GR_COLOR foreground, GR_COLOR background, void * bits,
+			int flags);
+
+/* useful function macros*/
+#define GrSetWindowBackgroundColor(wid,color) \
+		{	GR_WM_PROPERTIES props;	\
+			props.flags = GR_WM_FLAGS_BACKGROUND; \
+			props.background = color; \
+			GrSetWMProperties(wid, &props); \
+		}
+#define GrSetWindowBorderSize(wid,width) \
+		{	GR_WM_PROPERTIES props;	\
+			props.flags = GR_WM_FLAGS_BORDERSIZE; \
+			props.bordersize = width; \
+			GrSetWMProperties(wid, &props); \
+		}
+#define GrSetWindowBorderColor(wid,color) \
+		{	GR_WM_PROPERTIES props;	\
+			props.flags = GR_WM_FLAGS_BORDERCOLOR; \
+			props.bordercolor = color; \
+			GrSetWMProperties(wid, &props); \
+		}
+#define GrSetWindowTitle(wid,name) \
+		{	GR_WM_PROPERTIES props;	\
+			props.flags = GR_WM_FLAGS_TITLE; \
+			props.title = (GR_CHAR *)name; \
+			GrSetWMProperties(wid, &props); \
+		}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* RTEMS requires rtems_main()*/
+#if __rtems__
+#define main	rtems_main
+#endif
+
+#endif /* _NANO_X_H*/
diff -urN lib/microwindows/src/include/nbutton.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nbutton.h
--- lib/microwindows/src/include/nbutton.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nbutton.h	2005-02-21 16:13:19.000000000 +0100
@@ -0,0 +1,34 @@
+/*
+ * NanoWidgets v0.1
+ * (C) 1999 Screen Media AS
+ * 
+ * Written by Vidar Hokstad
+ * 
+ * Contains code from The Nano Toolkit,
+ * (C) 1999 by Alexander Peuchert.
+ *
+ */
+
+#ifndef __NBUTTON_H
+#define __NBUTTON_H
+
+DEFINE_NOBJECT(button,widget)
+   int pressed;
+   char * text;
+   void (*onclick_handler) (struct button_nobject *, unsigned int);
+END_NOBJECT
+
+DEFINE_NCLASS(button,widget)
+   NSLOT(int,init);
+   NSLOT(void,onclick);    /* Set an onclick handler */
+END_NCLASS
+
+#define n_button_init(__this__,__parent__,__text__) n_call(button,init,__this__,(__this__,__parent__,__text__))
+#define n_button_onclick(__this__,__handler__) n_call(button,onclick,__this__,(__this__,__handler__))
+
+/* Define a simpler name for the instance structure */
+typedef struct button_nobject NBUTTON;
+
+void n_init_button_class(void);		/* Initialise the button class */
+
+#endif
diff -urN lib/microwindows/src/include/nclass.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nclass.h
--- lib/microwindows/src/include/nclass.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nclass.h	2005-02-21 16:13:20.000000000 +0100
@@ -0,0 +1,89 @@
+/*
+ * NanoClasses v0.1
+ * (C) 1999 by Screen Media
+ * 
+ * Minimal toolkit to build a C based class hierarchy
+ * 
+ */
+
+#ifndef __NCLASS_H
+#define __NCLASS_H
+
+#define NWTRUE 1
+#define NWFALSE 0
+
+#define NCLASS(__c__) (__ ## __c__ ## _nclass)
+#define DEFINE_NCLASS(__c__,__super__) \
+struct __c__ ## _nclass; struct __c__ ## _nclass __ ## __c__ ## _nclass; \
+struct __c__ ## _nclass { \
+    struct __super__ ## _nclass __data;
+
+#define END_NCLASS };
+
+#define DEFINE_NOBJECT(__class__,__super__) \
+  struct __class__ ## _nobject { struct __super__ ## _nobject __super;
+#define END_NOBJECT };
+
+#define INIT_NCLASS(__class__,__super__) \
+static int __ ## __class__ ## _class_init = 0;\
+void n_init_ ## __class__ ## _class (void) {\
+   struct __class__ ## _nclass * this = &__ ## __class__ ## _nclass; \
+   if (__ ## __class__ ## _class_init) return; \
+   n_init_ ## __super__ ## _class (); \
+   memcpy(&this->__data,&__ ## __super__ ## _nclass,sizeof(struct __super__ ## _nclass)); \
+   ((struct nclass *)this)->__super = (struct nclass *)&__ ## __super__ ## _nclass; \
+   __ ## __class__ ## _class_init = 1;
+#define END_INIT  }
+
+#define NMETHOD(__class__,__slot__,__func__) \
+  ((struct __class__ ## _nclass *)this)->##__slot__##_func = ##__func__;
+
+#define NSLOT(__ret__,__name__) __ret__ (* __name__ ## _func) ()
+
+#ifdef DEBUG
+# define n_call(__class__,__slot__,__object__,__args__) \
+  (fprintf(stderr,__FILE__ ",line %d: %p::" # __class__ "_" # __slot__ # __args__ "\n",__LINE__,__object__)), \
+  ((struct __class__ ## _nclass *)(((NOBJECT *)__object__)->__class))->##__slot__##_func ## __args__
+#else
+# define n_call(__class__,__slot__,__object__,__args__) \
+  ((struct __class__ ## _nclass *)(((NOBJECT *)__object__)->__class))->##__slot__##_func ## __args__
+#endif
+
+#define n_super(__class__,__slot__,__object__, __args__) \
+  ((struct __class__ ## _nclass *)((struct nclass *)(((NOBJECT *)__object__)->__class)->__super))->##__slot__##_func ## __args__
+
+#define NEW_NOBJECT(__class__) ((struct __class__ ## _nobject *)n_new_object((NCLASS *)&__ ## __class__ ## _nclass, sizeof(struct __class__ ## _nobject)))
+#define DELETE_OBJECT(__ob__) n_delete_object((NOBJECT *)__ob__)
+
+struct nclass {
+   struct nclass * __super;
+};
+
+struct nobject {
+   struct nclass * __class;
+};
+
+typedef struct nobject NOBJECT;
+typedef struct nclass NCLASS;
+
+struct object_nobject {
+   NOBJECT __super;
+};
+
+struct object_nclass {
+   NCLASS * __super;
+   
+   NSLOT(int,init);
+   NSLOT(void,cleanup);
+};
+
+void n_init_object_class(void);
+extern struct object_nclass __object_nclass;
+
+#define n_object_init(__this__) n_call(object,init,__this__,(__this__))
+#define n_object_cleanup(__this__) n_call(object,cleanup,__this__,(__this__))
+
+NOBJECT * n_new_object(NCLASS * c, int size);
+void n_delete_object(NOBJECT * ob);
+
+#endif
diff -urN lib/microwindows/src/include/ncolors.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/ncolors.h
--- lib/microwindows/src/include/ncolors.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/ncolors.h	2005-02-21 16:13:20.000000000 +0100
@@ -0,0 +1,33 @@
+#ifndef __ncolors_H
+#define __ncolors_H
+
+/*
+ * Taken from device.h in Microwindows
+ * 
+ */
+
+#ifndef MWIN
+#if 0000
+/* colors assumed in first 16 palette entries*/
+/* note: don't use palette indices if the palette may
+ * be reloaded.  Use the RGB values instead.
+ */
+#define BLACK		PALINDEX(0)		/*   0,   0,   0*/
+#define BLUE		PALINDEX(1)
+#define GREEN		PALINDEX(2)
+#define CYAN		PALINDEX(3)
+#define RED		PALINDEX(4)
+#define MAGENTA		PALINDEX(5)
+#define BROWN		PALINDEX(6)
+#define LTGRAY		PALINDEX(7)		/* 192, 192, 192*/
+#define GRAY		PALINDEX(8)		/* 128, 128, 128*/
+#define LTBLUE		PALINDEX(9)
+#define LTGREEN		PALINDEX(10)
+#define LTCYAN		PALINDEX(11)
+#define LTRED		PALINDEX(12)
+#define LTMAGENTA	PALINDEX(13)
+#define YELLOW		PALINDEX(14)
+#define WHITE		PALINDEX(15)		/* 255, 255, 255*/
+#endif
+#endif
+#endif
diff -urN lib/microwindows/src/include/nlistview.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nlistview.h
--- lib/microwindows/src/include/nlistview.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nlistview.h	2005-02-21 16:13:20.000000000 +0100
@@ -0,0 +1,38 @@
+/*
+ * NanoWidgets v0.1
+ * (C) 1999 Screen Media AS
+ * 
+ * Written by Vidar Hokstad
+ * 
+ * Contains code from The Nano Toolkit,
+ * (C) 1999 by Alexander Peuchert.
+ *
+ */
+
+#ifndef __NLISTVIEW_H
+#define __NLISTVIEW_H
+
+DEFINE_NOBJECT(listview,widget)
+    const char ** entries;
+
+    int numentries;
+    int maxentries;  /* Maximum number of entries in listbox. If this is exceeded, we allocated a new array. */
+    int topentry;    /* Entry shown at the top of the listbox. */
+    int selected;    /* Number of selected list entry. -1 if none */
+END_NOBJECT
+
+DEFINE_NCLASS(listview,widget)
+    NSLOT(void,init);
+    NSLOT(void,setselected);
+    NSLOT(int,addentries);
+    NSLOT(int,addentry);
+    NSLOT(const char * ,getselected);
+END_NCLASS
+
+#define n_listview_init(__this__,__parent__,__text__) n_call(listview,init,__this__,(__this__,__parent__,__text__))
+
+typedef struct listview_nobject NLISTVIEW;
+
+void n_init_listview_class(void);	/* Initialise listview class */
+
+#endif
diff -urN lib/microwindows/src/include/nradio.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nradio.h
--- lib/microwindows/src/include/nradio.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nradio.h	2005-02-21 16:13:20.000000000 +0100
@@ -0,0 +1,33 @@
+/*
+ * NanoWidgets v0.1
+ * (C) 1999 Screen Media AS
+ * 
+ * Written by Vidar Hokstad
+ * 
+ * Contains code from The Nano Toolkit,
+ * (C) 1999 by Alexander Peuchert.
+ *
+ */
+
+#ifndef __NRADIO_H
+#define __NRADIO_H
+
+DEFINE_NOBJECT(radio,toggle)
+   struct radio_nobject * next_radio;
+   struct radio_nobject * last_radio;
+END_NOBJECT
+
+DEFINE_NCLASS(radio,toggle)
+   /* setstate modified to change state of entire ring (rest.selected == !this.selected */
+   NSLOT(int,init);
+   NSLOT(void,connect);    /* Connect another radio button to this radio button ring */
+END_NCLASS
+
+#define n_radio_init(__this__,__parent__) n_call(radio,init,__this__,(__this__,__parent__))
+#define n_radio_connect(__this__,__radio__) n_call(radio,connect,__this__,(__this__,__radio__))
+
+typedef struct radio_nobject NRADIO;
+
+void n_init_radio_class(void);		/* Initialise radio class */
+
+#endif
diff -urN lib/microwindows/src/include/nrender.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nrender.h
--- lib/microwindows/src/include/nrender.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nrender.h	2005-02-21 16:13:20.000000000 +0100
@@ -0,0 +1,51 @@
+/*
+ * NanoWidgets v0.2
+ * (C) 1999 Screen Media AS
+ * 
+ * Written by Vidar Hokstad
+ * 
+ * Contains code from The Nano Toolkit,
+ * (C) 1999 by Alexander Peuchert.
+ *
+ */
+
+#ifndef __NRENDER_H
+#define __NRENDER_H
+
+enum {
+   RCOL_WIDGET_BACKGROUND,
+   RCOL_WIDGET_TEXT,
+   RCOL_WIDGET_TEXTBACKGROUND,
+   RCOL_WIDGET_LIGHT,
+   RCOL_WIDGET_MEDIUM,
+   RCOL_WIDGET_DARK,
+   RCOL_HIGHLIGHTED,
+   RCOL_CURSOR,
+   RCOL_MAXCOL
+};
+
+DEFINE_NOBJECT(render,object)
+   MWCOLORVAL colors[RCOL_MAXCOL];
+END_NOBJECT
+
+DEFINE_NCLASS(render,object)
+    NSLOT(int,init);
+    NSLOT(void,border);               /* Draw a pressed or unpressed border, typically for buttons etc. */
+    NSLOT(void,panel);                /* Draw a pressed or unpressed panel, with surrounding border */
+    NSLOT(void,widgetbackground);     /* Draw a pressed or unpressed widget background. How the background is
+				       * rendered is undefined. The background is assumed to be drawn before
+				       * the border, and before any "inner parts" of the widget is drawn
+				       */
+    NSLOT(MWCOLORVAL,getcolor);
+END_NCLASS
+
+#define n_render_init(__this__) n_call(render,init,__this__,(__this__))
+#define n_render_getcolor(__this__,__col__) n_call(render,getcolor,__this__,(__this__,__col__))
+#define n_render_border(__this__,widget,x,y,w,h,pressed) n_call(render,border,__this__,(__this__,widget,x,y,w,h,pressed))
+#define n_render_panel(__this__,widget,x,y,w,h,pressed) n_call(render,panel,__this__,(__this__,widget,x,y,w,h,pressed))
+
+typedef struct render_nobject NRENDER;
+
+void n_init_render_class(void);		/* Initialise render class */
+
+#endif
diff -urN lib/microwindows/src/include/nslider.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nslider.h
--- lib/microwindows/src/include/nslider.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nslider.h	2005-02-21 16:13:20.000000000 +0100
@@ -0,0 +1,49 @@
+/*
+ * NanoWidgets v0.1
+ * (C) 1999 Screen Media AS
+ * 
+ * Written by Vidar Hokstad
+ * 
+ * Contains code from The Nano Toolkit,
+ * (C) 1999 by Alexander Peuchert.
+ *
+ */
+
+#ifndef __NSLIDER_H
+#define __NSLIDER_H
+
+DEFINE_NOBJECT(slider,widget)
+   int pressed;
+   int freedom;     /* 1 = horizontal, 2 = vertical, 4 = both */
+
+   /* Relative extent of the slider */
+   long rel_maxw;  
+   long rel_maxh;
+
+   /* Relative dimensions and position */
+   long rel_w;
+   long rel_h;
+   long rel_x;
+   long rel_y;
+
+   /* X position to start move from */
+   long ox,oy;
+
+   /* Callback used when the slider is being moved */
+   void (* move_handler) (struct slider_nobject *, unsigned int);
+END_NOBJECT
+
+#define NSLIDER_FREEDOM_HORIZONTAL (1)
+#define NSLIDER_FREEDOM_VERTICAL (2)
+
+typedef struct slider_nobject NSLIDER;
+
+DEFINE_NCLASS(slider,widget)
+    NSLOT(int,init);
+END_NCLASS
+
+#define n_slider_init(__this__,__parent__) n_call(slider,init,__this__,(__this__,__parent__))
+
+void n_init_slider_class(void);		/* Initialise slider class */
+
+#endif
diff -urN lib/microwindows/src/include/ntextfield.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/ntextfield.h
--- lib/microwindows/src/include/ntextfield.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/ntextfield.h	2005-02-21 16:13:21.000000000 +0100
@@ -0,0 +1,43 @@
+/*
+ * NanoWidgets v0.1
+ * (C) 1999 Screen Media AS
+ * 
+ * Written by Vidar Hokstad
+ * 
+ * Contains code from The Nano Toolkit,
+ * (C) 1999 by Alexander Peuchert.
+ *
+ */
+
+#ifndef __NTEXTFIELD_H
+#define __NTEXTFIELD_H
+
+DEFINE_NOBJECT(textfield,widget)
+    char * textbuf;
+
+    long maxsize;    /* Maximum number of characters */
+    int curpos;      /* Current cursor position */
+    int firstpos;    /* First visible character */
+    long overwrite;  /* Overwrite if 1, insert if 0 */
+
+    int esc;         /* 1 if currently processing an escape sequence */
+
+    /* Handler to be called to verify input - Can be used to restrict input
+     * to for instance integers, or hexadecimal, or whatever format you want
+     */
+    int (* verify_handler)(struct textfield_nobject *,char *);
+END_NOBJECT
+
+DEFINE_NCLASS(textfield,widget)
+    NSLOT(int,init);
+    NSLOT(void,settext);
+    NSLOT(const char * ,gettext);
+END_NCLASS
+
+#define n_textfield_init(__this__,__parent__,__text__) n_call(textfield,init,__this__,(__this__,__parent__,__text__))
+
+typedef struct textfield_nobject NTEXTFIELD;
+
+void n_init_textfield_class(void);	/* Initialise textfield class */
+
+#endif
diff -urN lib/microwindows/src/include/ntoggle.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/ntoggle.h
--- lib/microwindows/src/include/ntoggle.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/ntoggle.h	2005-02-21 16:13:21.000000000 +0100
@@ -0,0 +1,40 @@
+/*
+ * NanoWidgets v0.1
+ * (C) 1999 Screen Media AS
+ * 
+ * Written by Vidar Hokstad
+ * 
+ * Contains code from The Nano Toolkit,
+ * (C) 1999 by Alexander Peuchert.
+ *
+ */
+
+#ifndef __NTOGGLE_H
+#define __NTOGGLE_H
+
+DEFINE_NOBJECT(toggle,widget)
+   int pressed;
+   int selected;
+   void (* onchange_handler) (struct toggle_nobject *, int selected);
+END_NOBJECT
+
+DEFINE_NCLASS(toggle,widget)
+   NSLOT(int,init);
+   NSLOT(void,onchange);    /* Set an onchange handler */
+   NSLOT(void,setstate);    /* Set state of the toggle */
+   NSLOT(int,isselected);  /* Is this button selected? */
+   NSLOT(void,paintstate);
+END_NCLASS
+
+#define n_toggle_init(__this__,__parent__) n_call(toggle,init,__this__,(__this__,__parent__))
+#define n_toggle_onchange(__this__,__handler__) n_call(toggle,onchange,__this__,(__this__,__handler__))
+#define n_toggle_setstate(__this__,__state__) n_call(toggle,setstate,__this__,(__this__,__state__))
+#define n_toggle_isselected(__this__) n_call(toggle,isselected,__this__,(__this__))
+#define n_toggle_paintstate(__this__,__state__) n_call(toggle,paintstate,__this__,(__this__,__state__))
+
+/* Define a simpler name for the instance structure */
+typedef struct toggle_nobject NTOGGLE;
+
+void n_init_toggle_class(void);		/* Initialise toggle class */
+
+#endif
diff -urN lib/microwindows/src/include/nwidget.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nwidget.h
--- lib/microwindows/src/include/nwidget.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nwidget.h	2005-02-21 16:13:21.000000000 +0100
@@ -0,0 +1,118 @@
+/*
+ * NanoWidgets v0.1
+ * (C) 1999 Screen Media AS
+ * 
+ * Written by Vidar Hokstad
+ * 
+ * Contains code from The Nano Toolkit,
+ * (C) 1999 by Alexander Peuchert.
+ * 
+ * In theory, only the widget class should depend on the underlying windowing
+ * system. In practice, bitmap formats etc. may also end up being system
+ * specific, though.
+ */
+
+#ifndef __NWIDGET_H
+#define __NWIDGET_H
+
+/* Define the instance structure */
+
+DEFINE_NOBJECT(widget,object)
+   struct widget_nobject * parent;
+   struct widget_nobject * sibling;
+   struct widget_nobject * children;     /* All widgets can be containers, but not all are well suited */
+
+   int x,y,w,h;
+   int shown;
+   int infocus;        /* Is this widget in focus? That is, is it the last one that has been pressed?
+			* The widget set keeps track of this via the static variable "infocusob"
+			*/
+
+   int id;             /* Nano X window id */
+   GR_GC_ID gc;        /* Graphics contexts. Defaults to a shared GC */
+
+   NOBJECT * renderob; /* This object (of class "renderer" is used for most rendering, and
+			* make widgets "themeable". Widgets by default inherit the renderer of their parent
+			*/
+   NOBJECT * layout;    /* This object is called to do layout (by attach, resize etc.). FIXME: Currently not used. */
+END_NOBJECT
+
+/* Define class wide data and method slots */
+
+DEFINE_NCLASS(widget,object)
+   NSLOT(int,init);         // My init function.
+
+   NSLOT(void,attach);      /* Attach the widget argument as a child of this widget */
+   NSLOT(void,show);        /* Set this widget drawable. Will repaint widget */
+   NSLOT(void,hide);        /* Set this widget hidden. Will repaint parent. */
+   NSLOT(void,showall);     /* show() this wiget, and showAll() its children. */
+   NSLOT(void,hideall);     /* hide() this widget, and hideAll() its children. */
+   NSLOT(void,repaint);     /* Called to let widget (re)paint itself on the screen */
+   NSLOT(void,resize);      /* Set width and height */
+   NSLOT(void,move);        /* Move to a specific position. */
+   NSLOT(int,ishit);        /* Returns NWTRUE if widget is "hit" by the */
+                            /* (x,y) pair given as args, NWFALSE else. */
+   NSLOT(void,mousemove);   /* Mouse moved while this widget was active. */
+   NSLOT(void,buttondown);  /* Change in mouse button status */
+   NSLOT(void,buttonup);    /* Button was released outside widget it was pressed in */
+   NSLOT(void,clicked);     /* Button was pressed, *AND* released over the target area. */
+
+   NSLOT(void,keypress);    /* Key press event. */
+
+   NSLOT(struct render_nobject *,getrenderob);  /* Get rendering object */
+   NSLOT(MWCOLORVAL,getrendercol);  /* Get color to use to render something yourself */
+
+   NSLOT(void,fillrect);    /* Fill a rectangle */
+   NSLOT(void,rect);        /* Draw a rectangle */
+   NSLOT(void,line);        /* Draw a line */
+   NSLOT(void,setfg);       /* Change the foreground color of the current GC */
+   NSLOT(void,setbg);       /* Change the background color of the current GC */
+   NSLOT(void,setmode);     /* Change drawing mode */
+   NSLOT(void,getgeometry); /* Fill in integer pointers with geometry */
+
+   NSLOT(void,textextent);  /* Get the extent (width, height, baseline) of a string for this widgets GC/font */
+   NSLOT(void,text);        /* Draw text */
+
+   NSLOT(int,isinfocus);    /* Is this widget currently in focus? */
+   NSLOT(void,setfocus);    /* Set focus to this widget */
+   NSLOT(void,leavefocus);  /* This widget is not in focus anymore */
+END_NCLASS
+
+/* Define macros to simplify method calling */
+
+#define n_widget_init(__this__,__parent__) n_call(widget,init,__this__,(__this__,__parent__))
+#define n_widget_attach(__this__,__child__) n_call(widget,attach,__this__,(__this__,__child__))
+#define n_widget_show(__this__) n_call(widget,show,__this__,(__this__))
+#define n_widget_hide(__this__) n_call(widget,hide,__this__,(__this__))
+#define n_widget_repaint(__this__) n_call(widget,repaint,__this__,(__this__))
+#define n_widget_fillrect(__this__,x,y,w,h) n_call(widget,fillrect,__this__,(__this__,(x),(y),(w),(h)))
+#define n_widget_rect(__this__,x,y,w,h) n_call(widget,rect,__this__,(__this__,(x),(y),(w),(h)))
+#define n_widget_line(__this__,x1,y1,x2,y2) n_call(widget,line,__this__,(__this__,(x1),(y1),(x2),(y2)))
+#define n_widget_setfg(__this__,c) n_call(widget,setfg,__this__,(__this__,(c)))
+#define n_widget_setmode(__this__,c) n_call(widget,setmode,__this__,(__this__,(c)))
+#define n_widget_setbg(__this__,c) n_call(widget,setbg,__this__,(__this__,(c)))
+#define n_widget_move(__this__,x,y) n_call(widget,move,__this__,(__this__,(x),(y)))
+#define n_widget_resize(__this__,w,h) n_call(widget,resize,__this__,(__this__,(w),(h)))
+#define n_widget_getgeometry(__this__,x,y,w,h) n_call(widget,getgeometry,__this__,(__this__,(x),(y),(w),(h)))
+#define n_widget_buttondown(__this__,__x__,__y__,__button__) n_call(widget,buttondown,__this__,(__this__,__x__,__y__,__button__))
+#define n_widget_buttonup(__this__,__x__,__y__,__button__) n_call(widget,buttonup,__this__,(__this__,__x__,__y__,__button__))
+#define n_widget_keypress(__this__,__key__,__mod__,__b__) n_call(widget,keypress,__this__,(__this__,__key__,__mod__,__b__)) 
+#define n_widget_mousemove(__this__,__x__,__y__,__button__) n_call(widget,mousemove,__this__,(__this__,__x__,__y__,__button__))
+#define n_widget_clicked(__this__,__x__,__y__,__button__) n_call(widget,clicked,__this__,(__this__,__x__,__y__,__button__))
+#define n_widget_text(__this__,__x__,__y__,__text__,__count__) n_call(widget,text,__this__,(__this__,__x__,__y__,__text__,__count__))
+#define n_widget_textextent(__this__,__text__,__count__,__retw__,__reth__,__retb__) n_call(widget,textextent,__this__,(__this__,__text__,__count__,__retw__,__reth__,__retb__))
+
+#define n_widget_isinfocus(__this__) n_call(widget,isinfocus,__this__,(__this__))
+#define n_widget_setfocus(__this__) n_call(widget,setfocus,__this__,(__this__))
+#define n_widget_leavefocus(__this__) n_call(widget,leavefocus,__this__,(__this__))
+#define n_widget_getrenderob(__this__) n_call(widget,getrenderob,__this__,(__this__))
+#define n_widget_getrendercol(__this__,__c__) n_call(widget,getrendercol,__this__,(__this__,__c__))
+#define n_main() {while(1)n_handle_event();}
+
+/* Define a simpler name for the instance structure */
+typedef struct widget_nobject NWIDGET;
+
+void n_handle_event(void);		/* Handle a single event */
+void n_init_widget_class(void);		/* Initialise the widget class */
+
+#endif
diff -urN lib/microwindows/src/include/nwidgets.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nwidgets.h
--- lib/microwindows/src/include/nwidgets.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nwidgets.h	2005-02-21 16:13:21.000000000 +0100
@@ -0,0 +1,21 @@
+/*
+ * Provided as a convenience to include all of the header files
+ * needed for NanoWidgets at once.
+ */
+ 
+#ifndef __NWIDGETS_H
+#define __NWIDGETS_H
+
+#define MWINCLUDECOLORS
+#include <nano-X.h>
+#include <nclass.h>
+#include <nwidget.h>
+#include <nrender.h>
+#include <nbutton.h>
+#include <nlistview.h>
+#include <nslider.h>
+#include <ntextfield.h>
+#include <ntoggle.h>
+#include <nradio.h>
+
+#endif
diff -urN lib/microwindows/src/include/nxdraw.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nxdraw.h
--- lib/microwindows/src/include/nxdraw.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/nxdraw.h	2005-02-21 16:03:31.000000000 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Nano-X Draw Library
+ *	nxPaintNCArea - paint non-client area
+ *	nxDraw3dShadow - draws a shadow with bottom-left and top-right missing
+ *	nxDraw3dBox - draws a complete shadow
+ *	nxDraw3dInset - draw a 2 line 3d inset
+ *	nxDraw3dOutset - draw a 2 line 3d outset
+ */
+void		nxPaintNCArea(GR_DRAW_ID id, int w, int h, GR_CHAR *title,
+			GR_BOOL active, GR_WM_PROPS props);
+
+void		nxInflateRect(GR_RECT *prc, GR_SIZE dx, GR_SIZE dy);
+void		nxDraw3dBox(GR_WINDOW_ID id,int x,int y,int w,int h,
+			GR_COLOR crTop,GR_COLOR crBottom);
+void		nxDraw3dInset(GR_DRAW_ID id,int x,int y,int w,int h);
+void		nxDraw3dOutset(GR_WINDOW_ID id,int x,int y,int w,int h);
+void		nxDraw3dPushDown(GR_DRAW_ID id, int x, int y, int w, int h);
+void		nxDraw3dUpDownState(GR_DRAW_ID id, int x, int y, int w, int h,
+			GR_BOOL fDown);
+void		nxDraw3dUpFrame(GR_DRAW_ID id, int l, int t, int r, int b);
+
+/* nxPaintNCArea offsets*/
+#define CXBORDER	3				/* 3d border width*/
+#define CYBORDER	3				/* 3d border height*/
+#define CYCAPTION	12				/* height of caption*/
+#define CXCLOSEBOX	9				/* width of closebox*/
+#define CYCLOSEBOX	9				/* height of closebox*/
+#define CXFRAME		(CXBORDER*2)			/* width of frame*/
+#define CYFRAME		(CYBORDER*2)			/* height of frame*/
diff -urN lib/microwindows/src/include/winctl.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/winctl.h
--- lib/microwindows/src/include/winctl.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/winctl.h	2005-02-21 16:03:31.000000000 +0100
@@ -0,0 +1,434 @@
+/* winctl.h*/
+/*
+ * Header file for builtin controls
+ * This currently includes button, progressbar, listbox, edit
+ */
+
+/* entry points*/
+int WINAPI	MwRegisterButtonControl(HINSTANCE hInstance);
+int WINAPI	MwRegisterListboxControl(HINSTANCE hInstance);
+int WINAPI	MwRegisterEditControl(HINSTANCE hInstance);
+int WINAPI	MwRegisterStaticControl(HINSTANCE hInstance);
+int WINAPI	MwRegisterProgressBarControl(HINSTANCE hInstance);
+int WINAPI	MwRegisterComboboxControl(HINSTANCE hInstance);
+int WINAPI	MwRegisterScrollbarControl(HINSTANCE hInstance);
+int WINAPI	MwRegisterMEditControl(HINSTANCE hInstance);
+
+/* temporarily in button.c*/
+void WINAPI	CheckRadioButton(HWND hDlg, int nIDFirst,int nIDLast,
+			int nIDCheckButton);
+
+/* Dialog Codes*/
+#define DLGC_WANTARROWS     0x0001      /* Control wants arrow keys         */
+#define DLGC_WANTTAB        0x0002      /* Control wants tab keys           */
+#define DLGC_WANTALLKEYS    0x0004      /* Control wants all keys           */
+#define DLGC_WANTMESSAGE    0x0004      /* Pass message to control          */
+#define DLGC_HASSETSEL      0x0008      /* Understands EM_SETSEL message    */
+#define DLGC_DEFPUSHBUTTON  0x0010      /* Default pushbutton               */
+#define DLGC_UNDEFPUSHBUTTON 0x0020     /* Non-default pushbutton           */
+#define DLGC_RADIOBUTTON    0x0040      /* Radio button                     */
+#define DLGC_WANTCHARS      0x0080      /* Want WM_CHAR messages            */
+#define DLGC_STATIC         0x0100      /* Static item: don't include       */
+#define DLGC_BUTTON         0x2000      /* Button item: can be checked      */
+
+/* Button Control Styles*/
+#define BS_PUSHBUTTON       0x00000000L
+#define BS_DEFPUSHBUTTON    0x00000001L
+#define BS_CHECKBOX         0x00000002L
+#define BS_AUTOCHECKBOX     0x00000003L
+#define BS_RADIOBUTTON      0x00000004L
+#define BS_3STATE           0x00000005L
+#define BS_AUTO3STATE       0x00000006L
+#define BS_GROUPBOX         0x00000007L
+#define BS_USERBUTTON       0x00000008L
+#define BS_AUTORADIOBUTTON  0x00000009L
+#define BS_OWNERDRAW        0x0000000BL
+#define BS_LEFTTEXT         0x00000020L
+#define BS_TEXT             0x00000000L
+#define BS_ICON             0x00000040L
+#define BS_BITMAP           0x00000080L
+#define BS_LEFT             0x00000100L
+#define BS_RIGHT            0x00000200L
+#define BS_CENTER           0x00000300L
+#define BS_TOP              0x00000400L
+#define BS_BOTTOM           0x00000800L
+#define BS_VCENTER          0x00000C00L
+#define BS_PUSHLIKE         0x00001000L
+#define BS_MULTILINE        0x00002000L
+#define BS_NOTIFY           0x00004000L
+#define BS_FLAT             0x00008000L
+#define BS_RIGHTBUTTON      BS_LEFTTEXT
+
+/* User Button Notification Codes*/
+#define BN_CLICKED          0
+#define BN_PAINT            1
+#define BN_HILITE           2
+#define BN_UNHILITE         3
+#define BN_DISABLE          4
+#define BN_DOUBLECLICKED    5
+#define BN_PUSHED           BN_HILITE
+#define BN_UNPUSHED         BN_UNHILITE
+#define BN_DBLCLK           BN_DOUBLECLICKED
+#define BN_SETFOCUS         6
+#define BN_KILLFOCUS        7
+
+/* Button Control Messages*/
+#define BM_GETCHECK        0x00F0
+#define BM_SETCHECK        0x00F1
+#define BM_GETSTATE        0x00F2
+#define BM_SETSTATE        0x00F3
+#define BM_SETSTYLE        0x00F4
+#define BM_CLICK           0x00F5
+#define BM_GETIMAGE        0x00F6
+#define BM_SETIMAGE        0x00F7
+
+#define BST_UNCHECKED      0x0000
+#define BST_CHECKED        0x0001
+#define BST_INDETERMINATE  0x0002
+#define BST_PUSHED         0x0004
+#define BST_FOCUS          0x0008
+
+/* Progress Bar messages*/
+#define PBM_SETRANGE		0xF0A0
+#define PBM_SETSTEP		0xF0A1
+#define PBM_SETPOS		0xF0A2
+#define PBM_DELTAPOS		0xF0A3
+#define PBM_STEPIT		0xF0A4
+
+/* Progress Bar styles */
+#define PBS_NOTIFY              0x0001L
+#define PBS_VERTICAL            0x0002L
+
+/* Progress Bar notification code */
+#define PBN_REACHMAX            1
+#define PBN_REACHMIN            2
+
+/* Listbox messages*/
+#define LB_ADDSTRING            0xF180
+#define LB_INSERTSTRING         0xF181
+#define LB_DELETESTRING         0xF182
+#define LB_SELITEMRANGEEX       0xF183
+#define LB_RESETCONTENT         0xF184
+#define LB_SETSEL               0xF185
+#define LB_SETCURSEL            0xF186
+#define LB_GETSEL               0xF187
+#define LB_GETCURSEL            0xF188
+#define LB_GETTEXT              0xF189
+#define LB_GETTEXTLEN           0xF18A
+#define LB_GETCOUNT             0xF18B
+#define LB_SELECTSTRING         0xF18C
+#define LB_DIR                  0xF18D
+#define LB_GETTOPINDEX          0xF18E
+#define LB_FINDSTRING           0xF18F
+#define LB_GETSELCOUNT          0xF190
+#define LB_GETSELITEMS          0xF191
+#define LB_SETTABSTOPS          0xF192
+#define LB_GETHORIZONTALEXTENT  0xF193
+#define LB_SETHORIZONTALEXTENT  0xF194
+#define LB_SETCOLUMNWIDTH       0xF195
+#define LB_ADDFILE              0xF196
+#define LB_SETTOPINDEX          0xF197
+#define LB_GETITEMRECT          0xF198
+#define LB_GETITEMDATA          0xF199
+#define LB_SETITEMDATA          0xF19A
+#define LB_SELITEMRANGE         0xF19B
+#define LB_SETANCHORINDEX       0xF19C
+#define LB_GETANCHORINDEX       0xF19D
+#define LB_SETCARETINDEX        0xF19E
+#define LB_GETCARETINDEX        0xF19F
+#define LB_SETITEMHEIGHT        0xF1A0
+#define LB_GETITEMHEIGHT        0xF1A1
+#define LB_FINDSTRINGEXACT      0xF1A2
+#define LB_SETLOCALE            0xF1A5
+#define LB_GETLOCALE            0xF1A6
+#define LB_SETCOUNT             0xF1A7
+#define LB_INITSTORAGE          0xF1A8
+#define LB_ITEMFROMPOINT        0xF1A9
+#define LB_SETTEXT              0xF1AA
+#define LB_GETCHECKMARK         0xF1AB
+#define LB_SETCHECKMARK         0xF1AC
+#define LB_GETITEMADDDATA       0xF1AD
+#define LB_SETITEMADDDATA       0xF1AE
+#define LB_MSGMAX               0xF1B0
+
+/* Listbox styles */
+#define LBS_NOTIFY              0x0001L
+#define LBS_SORT                0x0002L
+#define LBS_NOREDRAW            0x0004L		/* not supported*/
+#define LBS_MULTIPLESEL         0x0008L
+#define LBS_OWNERDRAWFIXED      0x0010L		/* nyi*/
+#define LBS_OWNERDRAWVARIABLE   0x0020L		/* nyi*/
+#define LBS_HASSTRINGS          0x0040L		/* not supported*/
+#define LBS_USETABSTOPS         0x0080L		/* nyi*/
+#define LBS_NOINTEGRALHEIGHT    0x0100L		/* not supported*/
+#define LBS_MULTICOLUMN         0x0200L		/* nyi*/
+#define LBS_WANTKEYBOARDINPUT   0x0400L		/* not supported*/
+#define LBS_EXTENDEDSEL         0x0800L		/* not supported*/
+#define LBS_STANDARD		(LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER)
+#define LBS_CHECKBOX            0x1000L		/* non std*/
+#define LBS_USEICON             0x2000L		/* non std*/
+#define LBS_AUTOCHECK           0x4000L		/* non std*/
+#define LBS_AUTOCHECKBOX        0x5000L		/* non std*/
+/* private Microwindows styles for combobox*/
+#define	LBS_PRELOADED		0x4000L		/* Microwindows private*/
+#define	LBS_COMBOLBOX		0x8000L		/* Microwindows private*/
+
+#if 0
+#define LBS_DISABLENOSCROLL	0x1000L
+#define LBS_NODATA		0x2000L
+#define LBS_NOSEL		0x4000L
+#endif
+
+/* Listbox Notification Codes */
+#define LBN_ERRSPACE        (-2)
+#define LBN_SELCHANGE       1
+#define LBN_DBLCLK          2
+#define LBN_SELCANCEL       3
+#define LBN_SETFOCUS        4
+#define LBN_KILLFOCUS       5
+#define LBN_CLICKCHECKMARK  6		/* non std*/
+
+/* Listbox return value */
+#define LB_OKAY             0
+#define LB_ERR              (-1)
+#define LB_ERRSPACE         (-2)
+
+/* Edit Control Notification Codes*/
+#define EN_SETFOCUS         0x0100
+#define EN_KILLFOCUS        0x0200
+#define EN_CHANGE           0x0300
+#define EN_UPDATE           0x0400
+#define EN_ERRSPACE         0x0500
+#define EN_MAXTEXT          0x0501
+#define EN_HSCROLL          0x0601
+#define EN_VSCROLL          0x0602
+
+/* Edit Control Styles*/
+#define ES_LEFT             0x0000L
+#define ES_CENTER           0x0001L
+#define ES_RIGHT            0x0002L
+#define ES_MULTILINE        0x0004L
+#define ES_UPPERCASE        0x0008L
+#define ES_LOWERCASE        0x0010L
+#define ES_PASSWORD         0x0020L
+#define ES_AUTOVSCROLL      0x0040L
+#define ES_AUTOHSCROLL      0x0080L
+#define ES_NOHIDESEL        0x0100L
+#define ES_OEMCONVERT       0x0400L
+#define ES_READONLY         0x0800L
+#define ES_WANTRETURN       0x1000L
+#define ES_NUMBER           0x2000L
+
+/* Edit Control Messages*/
+#define EM_GETSEL               0xF0B0
+#define EM_SETSEL               0xF0B1
+#define EM_GETRECT              0xF0B2
+#define EM_SETRECT              0xF0B3
+#define EM_SETRECTNP            0xF0B4
+#define EM_SCROLL               0xF0B5
+#define EM_LINESCROLL           0xF0B6
+#define EM_SCROLLCARET          0xF0B7
+#define EM_GETMODIFY            0xF0B8
+#define EM_SETMODIFY            0xF0B9
+#define EM_GETLINECOUNT         0xF0BA
+#define EM_LINEINDEX            0xF0BB
+#define EM_SETHANDLE            0xF0BC
+#define EM_GETHANDLE            0xF0BD
+#define EM_GETTHUMB             0xF0BE
+#define EM_LINELENGTH           0xF0C1
+#define EM_REPLACESEL           0xF0C2
+#define EM_GETLINE              0xF0C4
+#define EM_LIMITTEXT            0xF0C5
+#define EM_CANUNDO              0xF0C6
+#define EM_UNDO                 0xF0C7
+#define EM_FMTLINES             0xF0C8
+#define EM_LINEFROMCHAR         0xF0C9
+#define EM_SETTABSTOPS          0xF0CB
+#define EM_SETPASSWORDCHAR      0xF0CC
+#define EM_EMPTYUNDOBUFFER      0xF0CD
+#define EM_GETFIRSTVISIBLELINE  0xF0CE
+#define EM_SETREADONLY          0xF0CF
+#define EM_SETWORDBREAKPROC     0xF0D0
+#define EM_GETWORDBREAKPROC     0xF0D1
+#define EM_GETPASSWORDCHAR      0xF0D2
+#define EM_SETMARGINS           0xF0D3
+#define EM_GETMARGINS           0xF0D4
+#define EM_SETLIMITTEXT         EM_LIMITTEXT
+#define EM_GETLIMITTEXT         0xF0D5
+#define EM_POSFROMCHAR          0xF0D6
+#define EM_CHARFROMPOS          0xF0D7
+#define EM_SETIMESTATUS         0xF0D8
+#define EM_GETIMESTATUS         0xF0D9
+
+/* Static Control messages*/
+#define STM_SETICON         0xF170
+#define STM_GETICON         0xF171
+#define STM_SETIMAGE        0xF172
+#define STM_GETIMAGE        0xF173
+#define STM_MSGMAX          0xF174
+
+/* Static Control notification code*/
+#define STN_CLICKED         0
+#define STN_DBLCLK          1
+#define STN_ENABLE          2
+#define STN_DISABLE         3
+
+/* Static Control Styles */
+#define SS_LEFT             0x00000000L
+#define SS_CENTER           0x00000001L
+#define SS_RIGHT            0x00000002L
+#define SS_ICON             0x00000003L
+#define SS_BLACKRECT        0x00000004L
+#define SS_GRAYRECT         0x00000005L
+#define SS_WHITERECT        0x00000006L
+#define SS_BLACKFRAME       0x00000007L
+#define SS_GRAYFRAME        0x00000008L
+#define SS_WHITEFRAME       0x00000009L
+#define SS_GROUPBOX         0x0000000AL
+#define SS_SIMPLE           0x0000000BL
+#define SS_LEFTNOWORDWRAP   0x0000000CL
+#define SS_OWNERDRAW        0x0000000DL
+#define SS_BITMAP           0x0000000EL
+#define SS_ENHMETAFILE      0x0000000FL
+#define SS_TYPEMASK         0x0000000FL
+#define SS_NOPREFIX         0x00000080L
+#define SS_ETCHEDHORZ       0x00000010L
+#define SS_ETCHEDVERT       0x00000011L
+#define SS_ETCHEDFRAME      0x00000012L
+#define SS_ETCTYPEMAKS      0x0000001FL
+#define SS_NOTIFY           0x00000100L
+#define SS_CENTERIMAGE      0x00000200L
+#define SS_RIGHTJUST        0x00000400L
+#define SS_REALSIZEIMAGE    0x00000800L
+#define SS_SUNKEN           0x00001000L		/* notimp*/
+#define SS_ENDELLIPSIS      0x00004000L		/* notimp*/
+#define SS_PATHELLIPSIS     0x00008000L		/* notimp*/
+#define SS_WORDELLIPSIS     0x0000C000L		/* notimp*/
+#define SS_ELLIPSISMASK     0x0000C000L		/* notimp*/
+
+/* Combo Box styles*/
+#define CBS_SIMPLE            0x0001L
+#define CBS_DROPDOWN          0x0002L
+#define CBS_DROPDOWNLIST      0x0003L
+#define CBS_OWNERDRAWFIXED    0x0010L
+#define CBS_OWNERDRAWVARIABLE 0x0020L
+#define CBS_AUTOHSCROLL       0x0040L
+#define CBS_OEMCONVERT        0x0080L
+#define CBS_SORT              0x0100L
+#define CBS_HASSTRINGS        0x0200L
+#define CBS_NOINTEGRALHEIGHT  0x0400L
+#define CBS_DISABLENOSCROLL   0x0800L
+#define CBS_UPPERCASE         0x2000L
+#define CBS_LOWERCASE         0x4000L
+
+/* Combo box messages */
+#define CB_GETEDITSEL               0xF140
+#define CB_LIMITTEXT                0xF141
+#define CB_SETEDITSEL               0xF142
+#define CB_ADDSTRING                0xF143
+#define CB_DELETESTRING             0xF144
+#define CB_DIR                      0xF145
+#define CB_GETCOUNT                 0xF146
+#define CB_GETCURSEL                0xF147
+#define CB_GETLBTEXT                0xF148
+#define CB_GETLBTEXTLEN             0xF149
+#define CB_INSERTSTRING             0xF14A
+#define CB_RESETCONTENT             0xF14B
+#define CB_FINDSTRING               0xF14C
+#define CB_SELECTSTRING             0xF14D
+#define CB_SETCURSEL                0xF14E
+#define CB_SHOWDROPDOWN             0xF14F
+#define CB_GETITEMDATA              0xF150
+#define CB_SETITEMDATA              0xF151
+#define CB_GETDROPPEDCONTROLRECT    0xF152
+#define CB_SETITEMHEIGHT            0xF153
+#define CB_GETITEMHEIGHT            0xF154
+#define CB_SETEXTENDEDUI            0xF155
+#define CB_GETEXTENDEDUI            0xF156
+#define CB_GETDROPPEDSTATE          0xF157
+#define CB_FINDSTRINGEXACT          0xF158
+#define CB_SETLOCALE                0xF159	/* notimp*/
+#define CB_GETLOCALE                0xF15A	/* notimp*/
+#define CB_GETTOPINDEX              0xF15b	/* notimp*/
+#define CB_SETTOPINDEX              0xF15c	/* notimp*/
+#define CB_GETHORIZONTALEXTENT      0xF15d	/* notimp*/
+#define CB_SETHORIZONTALEXTENT      0xF15e	/* notimp*/
+#define CB_GETDROPPEDWIDTH          0xF15f	/* notimp*/
+#define CB_SETDROPPEDWIDTH          0xF160	/* notimp*/
+#define CB_INITSTORAGE              0xF161	/* notimp*/
+#define CB_MSGMAX                   0xF162
+
+/* Combo box notification codes */
+#define CBN_ERRSPACE        (-1)
+#define CBN_SELCHANGE       1
+#define CBN_DBLCLK          2
+#define CBN_SETFOCUS        3
+#define CBN_KILLFOCUS       4
+#define CBN_EDITCHANGE      5
+#define CBN_EDITUPDATE      6
+#define CBN_DROPDOWN        7
+#define CBN_CLOSEUP         8
+#define CBN_SELENDOK        9
+#define CBN_SELENDCANCEL    10
+
+/* Combo box message return values */
+#define CB_OKAY         0
+#define CB_ERR          (-1)
+#define CB_ERRSPACE     (-2)
+
+/* scroll bar control styles*/
+#define SBS_HORZ                    0x0000L
+#define SBS_VERT                    0x0001L
+#define SBS_TYPEMASK		    0x0001L
+#define SBS_TOPALIGN                0x0002L
+#define SBS_LEFTALIGN               0x0002L
+#define SBS_BOTTOMALIGN             0x0004L
+#define SBS_RIGHTALIGN              0x0004L
+#define SBS_SIZEBOXTOPLEFTALIGN     0x0002L
+#define SBS_SIZEBOXBOTTOMRIGHTALIGN 0x0004L
+#define SBS_SIZEBOX                 0x0008L
+#define SBS_SIZEGRIP                0x0010L
+
+/* scroll bar constants*/
+#define SB_HORZ             0
+#define SB_VERT             1
+#define SB_CTL              2
+#define SB_BOTH             3
+
+/* scroll bar notify codes*/
+#define SB_LINEUP           0
+#define SB_LINELEFT         0
+#define SB_LINEDOWN         1
+#define SB_LINERIGHT        1
+#define SB_PAGEUP           2
+#define SB_PAGELEFT         2
+#define SB_PAGEDOWN         3
+#define SB_PAGERIGHT        3
+#define SB_THUMBPOSITION    4
+#define SB_THUMBTRACK       5
+#define SB_TOP              6
+#define SB_LEFT             6
+#define SB_BOTTOM           7
+#define SB_RIGHT            7
+#define SB_ENDSCROLL        8
+
+#define SIF_RANGE           0x0001
+#define SIF_PAGE            0x0002
+#define SIF_POS             0x0004
+#define SIF_DISABLENOSCROLL 0x0008
+#define SIF_TRACKPOS        0x0010
+#define SIF_ALL             (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS)
+
+typedef struct tagSCROLLINFO {
+    UINT    cbSize;
+    UINT    fMask;
+    int     nMin;
+    int     nMax;
+    UINT    nPage;
+    int     nPos;
+    int     nTrackPos;
+} SCROLLINFO, *LPSCROLLINFO;
+typedef SCROLLINFO CONST *LPCSCROLLINFO;
+
+int     WINAPI SetScrollInfo(HWND, int, LPCSCROLLINFO, BOOL);
+BOOL    WINAPI GetScrollInfo(HWND, int, LPSCROLLINFO);
diff -urN lib/microwindows/src/include/windef.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/windef.h
--- lib/microwindows/src/include/windef.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/windef.h	2005-02-21 16:13:19.000000000 +0100
@@ -0,0 +1,177 @@
+/* windef.h*/
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Win32 API base type definitions
+ */
+
+#define _WINDEF_H
+
+
+#ifdef VXWORKS
+/* Don't include the internal Tornado header file <ntcontext.h>, **
+** as the definitions in it conflict with these definitions.     */
+#define __INCntcontexth
+/* Bring in the core VxWorks definitions as they could conflict **
+** with the ones below if they are brought in later.            */
+#include <vxWorks.h>
+#endif
+
+
+#ifndef NULL
+#define NULL    ((void *)0)
+#endif
+
+#ifndef FALSE
+#define FALSE               0
+#endif
+
+#ifndef TRUE
+#define TRUE                1
+#endif
+
+#ifndef NOMINMAX
+#ifndef max
+#define max(a,b)            (((a) > (b)) ? (a) : (b))
+#endif
+
+#ifndef min
+#define min(a,b)            (((a) < (b)) ? (a) : (b))
+#endif
+#endif  /* NOMINMAX */
+
+#define CALLBACK
+#define WINAPI
+#define WINAPIV
+#define APIENTRY    	WINAPI
+#define APIPRIVATE
+#define PASCAL
+
+#define FAR
+#define NEAR
+#define CONST		const
+#define CDECL
+
+#define VOID void
+typedef void *PVOID;
+typedef char CHAR;
+typedef short SHORT;
+typedef long LONG;
+typedef SHORT *PSHORT;  
+typedef LONG *PLONG;    
+
+#ifndef VXWORKS
+typedef unsigned char 		UCHAR;
+typedef unsigned short 		USHORT;
+typedef unsigned long		ULONG;
+typedef unsigned int		UINT;
+
+#ifndef __ITRON_TYPES_h_ /* FIXME RTEMS hack*/
+#ifndef COMMON_H	 /* MiniGUI hack*/
+typedef int			BOOL;
+#endif
+#endif
+
+#endif /* !VXWORKS*/
+
+typedef ULONG *			PULONG;
+typedef USHORT *		PUSHORT;
+typedef UCHAR *			PUCHAR;
+typedef char *			PSZ;
+typedef int                 	INT;
+typedef unsigned int        	*PUINT;
+
+typedef unsigned long       DWORD;
+typedef unsigned char       BYTE;
+typedef unsigned short      WORD;
+
+typedef float               FLOAT;
+typedef FLOAT               *PFLOAT;
+typedef BOOL NEAR           *PBOOL;
+typedef BOOL FAR            *LPBOOL;
+typedef BYTE NEAR           *PBYTE;
+typedef BYTE FAR            *LPBYTE;
+typedef int NEAR            *PINT;
+typedef int FAR             *LPINT;
+typedef WORD NEAR           *PWORD;
+typedef WORD FAR            *LPWORD;
+typedef long FAR            *LPLONG;
+typedef DWORD NEAR          *PDWORD;
+typedef DWORD FAR           *LPDWORD;
+typedef void FAR            *LPVOID;
+typedef CONST void FAR      *LPCVOID;
+
+typedef unsigned short WCHAR;
+typedef WCHAR *PWCHAR;
+typedef WCHAR *LPWCH, *PWCH;
+typedef CONST WCHAR *LPCWCH, *PCWCH;
+typedef WCHAR *NWPSTR;
+typedef WCHAR *LPWSTR, *PWSTR;
+typedef CONST WCHAR *LPCWSTR, *PCWSTR;
+
+typedef CHAR *PCHAR;
+typedef CHAR *LPCH, *PCH;
+typedef CONST CHAR *LPCCH, *PCCH;
+typedef CHAR *NPSTR;
+typedef CHAR *LPSTR, *PSTR;
+typedef CONST CHAR *LPCSTR, *PCSTR;
+typedef char TCHAR, *PTCHAR;
+typedef unsigned char TBYTE , *PTBYTE ;
+typedef LPSTR LPTCH, PTCH;
+typedef LPSTR PTSTR, LPTSTR;
+typedef LPCSTR LPCTSTR;
+
+#define __TEXT(quote) quote
+#define TEXT(quote) __TEXT(quote)
+
+typedef int (FAR WINAPI *FARPROC)();
+typedef int (NEAR WINAPI *NEARPROC)();
+typedef int (WINAPI *PROC)();
+
+typedef UINT WPARAM;
+typedef LONG LPARAM;
+typedef LONG LRESULT;
+typedef LONG HRESULT;
+
+#define MAKEWORD(a, b)      ((WORD)(((BYTE)(a)) | ((WORD)((BYTE)(b))) << 8))
+#define MAKELONG(a, b)      ((LONG)(((WORD)(a)) | ((DWORD)((WORD)(b))) << 16))
+#define LOWORD(l)           ((WORD)(l))
+#define HIWORD(l)           ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
+#define LOBYTE(w)           ((BYTE)(w))
+#define HIBYTE(w)           ((BYTE)(((WORD)(w) >> 8) & 0xFF))
+
+#define PALETTEINDEX(i)     ((COLORREF)(0x01000000 | (DWORD)(WORD)(i)))
+
+typedef DWORD   COLORREF;
+typedef DWORD   *LPCOLORREF;
+
+/* handle typedef*/
+typedef PVOID HANDLE;
+
+typedef HANDLE *PHANDLE;
+typedef HANDLE NEAR         *SPHANDLE;
+typedef HANDLE FAR          *LPHANDLE;
+typedef HANDLE              HGLOBAL;
+typedef HANDLE              HLOCAL;
+typedef HANDLE              GLOBALHANDLE;
+typedef HANDLE              LOCALHANDLE;
+
+typedef WORD                ATOM;
+
+typedef struct hwnd *	HWND;
+typedef struct hdc *	HDC;
+typedef struct hcursor *HCURSOR;
+typedef struct hgdiobj *HGDIOBJ;
+typedef struct hgdiobj *HBRUSH;
+typedef struct hgdiobj *HPEN;
+typedef struct hgdiobj *HFONT;
+typedef struct hgdiobj *HBITMAP;
+typedef struct hgdiobj *HRGN;
+typedef struct hgdiobj *HPALETTE;
+typedef HANDLE		HICON;
+typedef HANDLE		HINSTANCE;
+typedef HANDLE		HMENU;
+
+/* moved to winuser.h for resource compiler*/
+/*typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);*/
+
diff -urN lib/microwindows/src/include/windows.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/windows.h
--- lib/microwindows/src/include/windows.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/windows.h	2005-02-21 16:03:31.000000000 +0100
@@ -0,0 +1,149 @@
+#ifndef _WINDOWS_H
+#define _WINDOWS_H
+/* windows.h*/
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Microwindows Win32 API master public header file
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mwtypes.h"
+#include "windef.h"
+#include "wingdi.h"
+#include "winfont.h"
+#include "winkbd.h"
+#include "winuser.h"	/* now includes winctl.h for resource compiler*/
+
+/* external routines*/
+int WINAPI 	WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
+    			LPSTR lpCmdLine, int nShowCmd);
+
+int		MwUserInit(int ac, char **av);
+
+/* Internal Microwindows non-win32 definitions*/
+
+/* GDI Objects*/
+
+typedef struct {			/* GDI object hdr*/
+	int		type;		/* OBJ_xxx type*/
+	BOOL		stockobj;	/* TRUE if stock (unallocated) object*/
+} MWGDIOBJHDR;
+
+/* gdiobj*/
+struct hgdiobj {
+	MWGDIOBJHDR	hdr;		/* all gdi object start with this hdr*/
+	/* additional data...*/		/* allocated per object type*/
+};
+
+typedef struct {
+	MWGDIOBJHDR	hdr;
+	int		style;		/* pen style*/
+	COLORREF	color;		/* pen color*/
+} MWPENOBJ;
+
+typedef struct {
+	MWGDIOBJHDR	hdr;
+	int		style;		/* brush style*/
+	COLORREF	color;		/* brush color*/
+} MWBRUSHOBJ;
+
+typedef struct {
+	MWGDIOBJHDR	hdr;
+	PMWFONT		pfont;		/* allocated font*/
+	char		name[32];	/* font name (stock objects only)*/
+} MWFONTOBJ;
+
+typedef struct {
+	MWGDIOBJHDR	hdr;
+	int		width;		/* width*/
+	int		height;		/* height*/
+	int		planes;		/* # planes*/
+	int		bpp;		/* bits per pixel*/
+	int		linelen;	/* bytes per line*/
+	int		size;		/* allocated size in bytes*/
+	char 		bits[1];	/* beginning of bitmap*/
+} MWBITMAPOBJ;
+
+typedef struct {
+	MWGDIOBJHDR   	hdr;
+	MWCLIPREGION  *	rgn;		/* clip region*/
+} MWRGNOBJ;
+
+/* device context*/
+struct hdc {
+	struct _mwscreendevice *psd;	/* screen or memory device*/
+	HWND		hwnd;		/* associated window*/
+	DWORD		flags;		/* clipping flags*/
+	int		bkmode;		/* background mode*/
+	UINT		textalign;	/* text alignment flags*/
+	MWCOLORVAL	bkcolor;	/* text background color*/
+	MWCOLORVAL	textcolor;	/* text color*/
+	MWBRUSHOBJ *	brush;		/* current brush*/
+	MWPENOBJ *	pen;		/* current pen*/
+	MWFONTOBJ *	font;		/* current font*/
+	MWBITMAPOBJ *	bitmap;		/* current bitmap (mem dc's only)*/
+	MWRGNOBJ *	region;		/* user specified clip region*/
+	int		drawmode;	/* rop2 drawing mode */
+	POINT		pt;		/* current pen pos in client coords*/
+};
+
+/* cursor*/
+struct hcursor {
+	int		usecount;	/* use counter */
+	MWCURSOR	cursor;		/* software cursor definition*/
+};
+
+/* built-in scrollbars*/
+typedef struct {
+	int		minPos;        /* min value of scroll range.*/
+	int		maxPos;        /* max value of scroll range.*/
+	int		curPos;        /* current scroll pos.*/
+	int		pageStep;      /* steps per page.*/
+	int		barStart;      /* start pixel of bar.*/
+	int		barLen;        /* length of bar.*/
+	int		status;        /* status of scroll bar.*/
+	RECT		rc;	       /* screen coordinates position*/
+} MWSCROLLBARINFO, *PMWSCROLLBARINFO;
+
+/* window*/
+struct hwnd {
+	RECT		winrect;	/* window rect in screen coords*/
+	RECT		clirect;	/* client rect in screen coords*/
+	RECT		restorerc;	/* restore rect from maximized*/
+	DWORD		style;		/* window style*/
+	DWORD		exstyle;	/* window extended style*/
+	PWNDCLASS	pClass;		/* window class*/
+	struct hwnd	*parent;	/* z-order parent window */
+	struct hwnd	*owner;		/* owner window*/
+	struct hwnd	*children;	/* first child window */
+	struct hwnd	*siblings;	/* next sibling window */
+	struct hwnd	*next;		/* next window in complete list */
+	struct hcursor	*cursor;	/* cursor for this window */
+	struct hdc *	owndc;		/* owndc if CS_OWNDC*/
+	int		unmapcount;	/* count of reasons not really mapped */
+	int		id;		/* window id */
+	CHAR		szTitle[64];	/* window title*/
+	int		gotPaintMsg;	/* window had WM_PAINT PostMessage*/
+	int		paintSerial;	/* experimental serial # for alphblend*/
+	int		paintNC;	/* experimental NC paint handling*/
+	MWCLIPREGION *	update;		/* update region in screen coords*/
+	DWORD		userdata;	/* setwindowlong user data*/
+	DWORD		userdata2;	/* additional user data (will remove)*/
+	MWSCROLLBARINFO	hscroll;	/* NC scrollbars*/
+	MWSCROLLBARINFO	vscroll;
+	int		nextrabytes;	/* # window extra bytes*/
+	char		extrabytes[1];	/* window extra bytes - must be last*/
+};
+
+/* misc apis - will move to another header file*/
+DWORD WINAPI	GetTickCount(VOID);
+VOID WINAPI	Sleep(DWORD dwMilliseconds);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WINDOWS_H*/
diff -urN lib/microwindows/src/include/windowsx.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/windowsx.h
--- lib/microwindows/src/include/windowsx.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/windowsx.h	2005-02-21 16:03:31.000000000 +0100
@@ -0,0 +1,55 @@
+#define HANDLE_WM_COMMAND(hwnd, wParam, lParam, fn) \
+    ((fn)((hwnd), (int)(LOWORD(wParam)), (HWND)(lParam), (UINT)HIWORD(wParam)), 0L)
+#define FORWARD_WM_COMMAND(hwnd, id, hwndCtl, codeNotify, fn) \
+    (void)(fn)((hwnd), WM_COMMAND, MAKEWPARAM((UINT)(id),(UINT)(codeNotify)), (LPARAM)(HWND)(hwndCtl))
+
+#define HANDLE_WM_CREATE(hwnd, wParam, lParam, fn) \
+    ((fn)((hwnd), (LPCREATESTRUCT)(lParam)) ? 0L : (LRESULT)-1L)
+#define FORWARD_WM_CREATE(hwnd, lpCreateStruct, fn) \
+    (BOOL)(DWORD)(fn)((hwnd), WM_CREATE, 0L, (LPARAM)(LPCREATESTRUCT)(lpCreateStruct))
+
+#define HANDLE_WM_DESTROY(hwnd, wParam, lParam, fn) \
+    ((fn)(hwnd), 0L)
+#define FORWARD_WM_DESTROY(hwnd, fn) \
+    (void)(fn)((hwnd), WM_DESTROY, 0L, 0L)
+
+#define HANDLE_WM_ERASEBKGND(hwnd, wParam, lParam, fn) \
+    (LRESULT)(DWORD)(BOOL)(fn)((hwnd), (HDC)(wParam))
+#define FORWARD_WM_ERASEBKGND(hwnd, hdc, fn) \
+   (BOOL)(DWORD)(fn)((hwnd), WM_ERASEBKGND, (WPARAM)(HDC)(hdc), 0L)
+
+#define HANDLE_WM_LBUTTONDOWN(hwnd, wParam, lParam, fn) \
+    ((fn)((hwnd), FALSE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
+#define FORWARD_WM_LBUTTONDOWN(hwnd, fDoubleClick, x, y, keyFlags, fn) \
+    (void)(fn)((hwnd), (fDoubleClick) ? WM_LBUTTONDBLCLK : WM_LBUTTONDOWN, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
+
+#define HANDLE_WM_LBUTTONDBLCLK(hwnd, wParam, lParam, fn) \
+    ((fn)((hwnd), TRUE, (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
+
+#define HANDLE_WM_LBUTTONUP(hwnd, wParam, lParam, fn) \
+    ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
+#define FORWARD_WM_LBUTTONUP(hwnd, x, y, keyFlags, fn) \
+    (void)(fn)((hwnd), WM_LBUTTONUP, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
+
+#define HANDLE_WM_MOUSEMOVE(hwnd, wParam, lParam, fn) \
+    ((fn)((hwnd), (int)(short)LOWORD(lParam), (int)(short)HIWORD(lParam), (UINT)(wParam)), 0L)
+#define FORWARD_WM_MOUSEMOVE(hwnd, x, y, keyFlags, fn) \
+    (void)(fn)((hwnd), WM_MOUSEMOVE, (WPARAM)(UINT)(keyFlags), MAKELPARAM((x), (y)))
+
+#define HANDLE_WM_SETFOCUS(hwnd, wParam, lParam, fn) \
+    ((fn)((hwnd), (HWND)(wParam)), 0L)
+#define FORWARD_WM_SETFOCUS(hwnd, hwndOldFocus, fn) \
+    (void)(fn)((hwnd), WM_SETFOCUS, (WPARAM)(HWND)(hwndOldFocus), 0L)
+
+#define HANDLE_WM_KILLFOCUS(hwnd, wParam, lParam, fn) \
+    ((fn)((hwnd), (HWND)(wParam)), 0L)
+#define FORWARD_WM_KILLFOCUS(hwnd, hwndNewFocus, fn) \
+    (void)(fn)((hwnd), WM_KILLFOCUS, (WPARAM)(HWND)(hwndNewFocus), 0L)
+
+#define HANDLE_WM_SETTEXT(hwnd, wParam, lParam, fn) \
+    ((fn)((hwnd), (LPCTSTR)(lParam)), 0L)
+#define FORWARD_WM_SETTEXT(hwnd, lpszText, fn) \
+    (void)(fn)((hwnd), WM_SETTEXT, 0L, (LPARAM)(LPCTSTR)(lpszText))
+
+#define HANDLE_MSG(hwnd, message, fn)    \
+    case (message): return HANDLE_##message((hwnd), (wParam), (lParam), (fn))
diff -urN lib/microwindows/src/include/winfont.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/winfont.h
--- lib/microwindows/src/include/winfont.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/winfont.h	2005-02-21 16:03:31.000000000 +0100
@@ -0,0 +1,156 @@
+/* winfont.h*/
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Win32 font structures and API
+ */
+
+/* tmPitchAndFamily flags*/
+#define TMPF_FIXED_PITCH    0x01	/* win32 bug: means variable*/
+#define TMPF_VECTOR         0x02
+#define TMPF_TRUETYPE       0x04
+#define TMPF_DEVICE         0x08
+
+typedef struct tagTEXTMETRIC {
+    LONG        tmHeight;
+    LONG        tmAscent;
+    LONG        tmDescent;
+    LONG        tmInternalLeading;
+    LONG        tmExternalLeading;
+    LONG        tmAveCharWidth;
+    LONG        tmMaxCharWidth;
+    LONG        tmWeight;
+    LONG        tmOverhang;
+    LONG        tmDigitizedAspectX;
+    LONG        tmDigitizedAspectY;
+    BYTE        tmFirstChar;
+    BYTE        tmLastChar;
+    BYTE        tmDefaultChar;
+    BYTE        tmBreakChar;
+    BYTE        tmItalic;
+    BYTE        tmUnderlined;
+    BYTE        tmStruckOut;
+    BYTE        tmPitchAndFamily;
+    BYTE        tmCharSet;
+} TEXTMETRIC, *PTEXTMETRIC, NEAR *NPTEXTMETRIC, FAR *LPTEXTMETRIC;
+
+BOOL WINAPI GetTextMetrics(HDC hdc, LPTEXTMETRIC lptm);
+BOOL WINAPI GetCharWidth(HDC hdc,UINT iFirstChar,UINT iLastChar,LPINT lpBuffer);
+BOOL WINAPI GetTextExtentPoint(HDC hdc,LPCTSTR lpszStr,int cchString,
+		LPSIZE lpSize);
+BOOL WINAPI GetTextExtentExPoint(HDC hdc,LPCTSTR lpszStr,int cchString,
+		int nMaxExtent,LPINT lpnFit,LPINT alpDx,LPSIZE lpSize);
+
+/* inherit logical font descriptor from engine*/
+
+typedef struct {
+	LONG	lfHeight;		/* desired height in pixels*/
+	LONG	lfWidth;		/* desired width in pixels or 0*/
+	LONG	lfEscapement;		/* rotation in tenths of degree*/
+	LONG	lfOrientation;		/* not used*/
+	LONG	lfWeight;		/* font weight*/
+	BYTE	lfItalic;		/* =1 for italic*/
+	BYTE	lfUnderline;		/* =1 for underline*/
+	BYTE	lfStrikeOut;		/* not used*/
+	BYTE	lfCharSet;		/* font character set*/
+	BYTE	lfOutPrecision;		/* font type selection*/
+	BYTE	lfClipPrecision;	/* not used*/
+	BYTE	lfQuality;		/* not used*/
+	BYTE	lfPitchAndFamily;	/* font pitch and family*/
+	CHAR	lfFaceName[MWLF_FACESIZE];	/* font name, may be aliased*/
+} LOGFONT, *PLOGFONT, NEAR *NPLOGFONT, FAR *LPLOGFONT;
+
+#define LF_FACESIZE		MWLF_FACESIZE
+
+/* font weights*/
+#define FW_DONTCARE		MWLF_WEIGHT_DEFAULT
+#define FW_THIN			MWLF_WEIGHT_THIN
+#define FW_EXTRALIGHT		MWLF_WEIGHT_EXTRALIGHT
+#define FW_LIGHT		MWLF_WEIGHT_LIGHT
+#define FW_NORMAL		MWLF_WEIGHT_NORMAL
+#define FW_MEDIUM		MWLF_WEIGHT_MEDIUM
+#define FW_SEMIBOLD		MWLF_WEIGHT_DEMIBOLD
+#define FW_BOLD			MWLF_WEIGHT_BOLD
+#define FW_EXTRABOLD		MWLF_WEIGHT_EXTRABOLD
+#define FW_HEAVY		MWLF_WEIGHT_BLACK
+#define FW_ULTRALIGHT		FW_EXTRALIGHT
+#define FW_REGULAR		FW_NORMAL
+#define FW_DEMIBOLD		FW_SEMIBOLD
+#define FW_ULTRABOLD		FW_EXTRABOLD
+#define FW_BLACK		FW_HEAVY
+
+/* output precision - used for font selection*/
+#define OUT_DEFAULT_PRECIS          MWLF_TYPE_DEFAULT
+#define OUT_STRING_PRECIS           1
+#define OUT_CHARACTER_PRECIS        2
+#define OUT_STROKE_PRECIS           3
+#define OUT_TT_PRECIS               MWLF_TYPE_SCALED
+#define OUT_DEVICE_PRECIS           MFLF_TYPE_RASTER
+#define OUT_RASTER_PRECIS           MFLF_TYPE_RASTER
+#define OUT_TT_ONLY_PRECIS          MWLF_TYPE_TRUETYPE
+#define OUT_OUTLINE_PRECIS          8
+#define OUT_SCREEN_OUTLINE_PRECIS   9
+
+/* clip precision - unused*/
+#define CLIP_DEFAULT_PRECIS     0
+#define CLIP_CHARACTER_PRECIS   1
+#define CLIP_STROKE_PRECIS      2
+#define CLIP_MASK               0xf
+#define CLIP_LH_ANGLES          (1<<4)
+#define CLIP_TT_ALWAYS          (2<<4)
+#define CLIP_EMBEDDED           (8<<4)
+
+/* output quality - unused*/
+#define DEFAULT_QUALITY         0
+#define DRAFT_QUALITY           1
+#define PROOF_QUALITY           2
+#define NONANTIALIASED_QUALITY  3
+#define ANTIALIASED_QUALITY     4
+
+/* font charset*/
+#define ANSI_CHARSET            MWLF_CHARSET_ANSI
+#define DEFAULT_CHARSET         MWLF_CHARSET_DEFAULT
+#define SYMBOL_CHARSET          2
+#define OEM_CHARSET             MWLF_CHARSET_OEM
+
+/* font pitch - lfPitchAndFamily*/
+#define MWLF_PITCH_DEFAULT	0	/* any pitch*/
+#define MWLF_PITCH_FIXED	1	/* fixed pitch*/
+#define MWLF_PITCH_VARIABLE	2	/* variable pitch*/
+
+/* font pitch*/
+#define DEFAULT_PITCH           MWLF_PITCH_DEFAULT
+#define FIXED_PITCH             MWLF_PITCH_FIXED
+#define VARIABLE_PITCH          MWLF_PITCH_VARIABLE
+#define MONO_FONT               8
+
+/* 
+ * font family - lfPitchAndFamily
+ *
+ * MWF_FAMILY_SERIF	- Times Roman, Century Schoolbook
+ * MWF_FAMILY_SANSSERIF	- Helvetica, Swiss
+ * MWF_FAMILY_MODERN	- Pica, Elite, Courier
+ */
+#define MWLF_FAMILY_DEFAULT	(0<<4)	/* any family*/
+#define MWLF_FAMILY_SERIF	(1<<4)	/* variable stroke width, serif*/
+#define MWLF_FAMILY_SANSSERIF	(2<<4)	/* variable stroke width, sans-serif*/
+#define MWLF_FAMILY_MODERN	(3<<4)	/* constant stroke width*/
+
+/* add definitions here for font mapper extensions*/
+#define MWLF_FAMILY_BITSTREAM	(6<<4)	/* bitstream*/
+#define MWLF_FAMILY_ADOBE	(7<<4)	/* adobe*/
+
+/* font family*/
+#define FF_DONTCARE         	MWLF_FAMILY_DEFAULT
+#define FF_ROMAN            	MWLF_FAMILY_SERIF
+#define FF_SWISS            	MWLF_FAMILY_SANSSERIF
+#define FF_MODERN           	MWLF_FAMILY_MODERN
+#define FF_SCRIPT           	(4<<4)  /* Cursive, etc. */
+#define FF_DECORATIVE       	(5<<4)  /* Old English, etc. */
+
+HFONT WINAPI CreateFont(int nHeight, int nWidth, int nEscapement,
+		int nOrientation, int fnWeight, DWORD fdwItalic,
+		DWORD fdwUnderline, DWORD fdwStrikeOut,DWORD fdwCharSet,
+		DWORD fdwOutputPrecision,DWORD fdwClipPrecision,
+		DWORD fdwQuality, DWORD fdwPitchAndFamily, LPCSTR lpszFace);
+HFONT WINAPI CreateFontIndirect(CONST LOGFONT *lplf);
diff -urN lib/microwindows/src/include/wingdi.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/wingdi.h
--- lib/microwindows/src/include/wingdi.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/wingdi.h	2005-02-21 16:13:19.000000000 +0100
@@ -0,0 +1,379 @@
+/* wingdi.h*/
+/*
+ * Copyright (c) 1999,2000 Greg Haerr <greg@censoft.com>
+ *
+ * Win32 GDI structures and API
+ */
+
+/* portable coordinate definition*/
+typedef MWCOORD	GDICOORD;
+
+/* inherit RECT and POINT from mwtypes.h*/
+typedef MWRECT	RECT;
+typedef MWPOINT	POINT;
+
+#if 0000
+typedef struct  tagRECT {
+    GDICOORD left;
+    GDICOORD top;
+    GDICOORD right;
+    GDICOORD bottom;
+} RECT;
+
+typedef struct  tagPOINT {
+    GDICOORD x;
+    GDICOORD y;
+} POINT; 
+#endif
+
+typedef RECT NEAR *PRECT, FAR *LPRECT;
+
+typedef POINT NEAR *PPOINT, FAR *LPPOINT;
+
+typedef struct  tagSIZE {
+    GDICOORD cx;
+    GDICOORD cy;
+} SIZE, NEAR *PSIZE, FAR *LPSIZE;
+
+/* GetDCEx flags*/
+#define DCX_WINDOW           0x00000001L
+#define DCX_CACHE            0x00000002L
+#define DCX_NORESETATTRS     0x00000004L
+#define DCX_CLIPCHILDREN     0x00000008L
+#define DCX_CLIPSIBLINGS     0x00000010L
+#define DCX_PARENTCLIP       0x00000020L
+#define DCX_EXCLUDERGN       0x00000040L
+#define DCX_INTERSECTRGN     0x00000080L
+#define DCX_EXCLUDEUPDATE    0x00000100L
+#define DCX_INTERSECTUPDATE  0x00000200L
+#define DCX_LOCKWINDOWUPDATE 0x00000400L
+#define DCX_VALIDATE         0x00200000L
+#define DCX_DEFAULTCLIP      0x80000000L	/* microwin only*/
+
+HDC WINAPI	GetDCEx(HWND hwnd,HRGN hrgnClip,DWORD flags);
+HDC WINAPI	GetDC(HWND hWnd);
+HDC WINAPI 	GetWindowDC(HWND hWnd);
+int WINAPI 	ReleaseDC(HWND hWnd, HDC hDC);
+BOOL WINAPI	DeleteDC(HDC hdc);
+
+typedef struct tagPAINTSTRUCT {
+    HDC         hdc;
+    BOOL        fErase;			/* indicates bkgnd needs erasing*/
+    RECT        rcPaint;		/* nyi*/
+    BOOL        fRestore;		/* nyi*/
+    BOOL        fIncUpdate;		/* nyi*/
+    BYTE        rgbReserved[32];
+} PAINTSTRUCT, *PPAINTSTRUCT, *NPPAINTSTRUCT, FAR *LPPAINTSTRUCT;
+
+HDC WINAPI 	BeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint);
+BOOL WINAPI 	EndPaint(HWND hWnd, CONST PAINTSTRUCT *lpPaint);
+
+#define RGB(r,g,b)	    MWRGB(r,g,b)
+#define GetRValue(rgb)      ((BYTE)(rgb))
+#define GetGValue(rgb)      ((BYTE)(((WORD)(rgb)) >> 8))
+#define GetBValue(rgb)      ((BYTE)((rgb)>>16))
+
+/* Background Modes */
+#define TRANSPARENT	1
+#define OPAQUE		2
+
+/* Text Alignment*/
+#define TA_NOUPDATECP                0
+#define TA_UPDATECP                  1
+
+#define TA_LEFT                      0
+#define TA_RIGHT                     2
+#define TA_CENTER                    6
+
+#define TA_TOP                       0
+#define TA_BOTTOM                    8
+#define TA_BASELINE                  24
+#define TA_RTLREADING                256
+#define TA_MASK       (TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING)
+
+COLORREF WINAPI	SetTextColor(HDC, COLORREF);
+COLORREF WINAPI	SetBkColor(HDC, COLORREF);
+int WINAPI 	SetBkMode(HDC, int);
+UINT WINAPI     SetTextAlign(HDC hdc, UINT fMode);
+
+/* Binary raster ops */
+#define R2_BLACK            1   /*  0       */
+#define R2_NOTMERGEPEN      2   /* DPon     */
+#define R2_MASKNOTPEN       3   /* DPna     */
+#define R2_NOTCOPYPEN       4   /* PN       */
+#define R2_MASKPENNOT       5   /* PDna     */
+#define R2_NOT              6   /* Dn       */
+#define R2_XORPEN           7   /* DPx      */
+#define R2_NOTMASKPEN       8   /* DPan     */
+#define R2_MASKPEN          9   /* DPa      */
+#define R2_NOTXORPEN        10  /* DPxn     */
+#define R2_NOP              11  /* D        */
+#define R2_MERGENOTPEN      12  /* DPno     */
+#define R2_COPYPEN          13  /* P        */
+#define R2_MERGEPENNOT      14  /* PDno     */
+#define R2_MERGEPEN         15  /* DPo      */
+#define R2_WHITE            16  /*  1       */
+#define R2_LAST             16
+
+int WINAPI	SetROP2(HDC hdc, int fnDrawMode);
+
+#define GDI_ERROR	(0xFFFFFFFFL)
+#define CLR_INVALID     0xFFFFFFFF
+
+COLORREF WINAPI GetPixel(HDC hdc, int x, int y);
+COLORREF WINAPI	SetPixel(HDC hdc, int x, int y, COLORREF crColor);
+BOOL WINAPI 	MoveToEx(HDC hdc, int x, int y, LPPOINT lpPoint);
+BOOL WINAPI 	LineTo(HDC hdc, int x, int y);
+BOOL WINAPI	Polyline(HDC hdc, CONST POINT *lppt, int cPoints);
+BOOL WINAPI	PolyPolygon(HDC hdc, CONST POINT *lpPoints, LPINT lpPolyCounts,
+			int nCount);
+BOOL WINAPI	Rectangle(HDC hdc, int nLeft, int nTop, int nRight,int nBottom);
+BOOL WINAPI	Ellipse(HDC hdc, int nLeftRect, int nTopRect, int nRightRect,
+			int nBottomRect);
+BOOL WINAPI	Arc(HDC hdc, int nLeftRect, int nTopRect, int nRightRect,
+			int nBottomRect, int nXStartArc, int nYStartArc,
+			int nXEndArc, int nYEndArc);
+BOOL WINAPI	Pie(HDC hdc, int nLeftRect, int nTopRect, int nRightRect,
+			int nBottomRect, int nXRadial1, int nYRadial1,
+			int nXRadial2, int nYRadial2);
+BOOL WINAPI	Polygon(HDC hdc, CONST POINT *lpPoints, int nCount);
+int WINAPI	FillRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr);
+
+/* ExTextOut options*/
+#define ETO_OPAQUE	0x0002
+#define ETO_CLIPPED	0x0004		/* nyi*/
+
+BOOL WINAPI	TextOut(HDC hdc, int x, int y, LPCSTR lpszString, int cbString);
+BOOL WINAPI	ExtTextOut(HDC hdc, int x, int y, UINT fuOptions,
+			CONST RECT *lprc, LPCSTR lpszString, UINT cbCount,
+			CONST INT *lpDx);
+BOOL WINAPI	ExtTextOutW(HDC hdc, int x, int y, UINT fuOptions,
+			CONST RECT *lprc, LPCWSTR lpszString, UINT cbCount,
+			CONST INT *lpDx);
+
+/* DrawText options*/
+#define DT_TOP              0x00000000
+#define DT_LEFT             0x00000000
+#define DT_CENTER           0x00000001
+#define DT_RIGHT            0x00000002
+#define DT_VCENTER          0x00000004
+#define DT_BOTTOM           0x00000008
+#define DT_WORDBREAK        0x00000010
+#define DT_SINGLELINE       0x00000020
+#define DT_EXPANDTABS       0x00000040
+#define DT_TABSTOP          0x00000080
+#define DT_NOCLIP           0x00000100
+#define DT_EXTERNALLEADING  0x00000200
+#define DT_CALCRECT         0x00000400
+#define DT_NOPREFIX         0x00000800
+#define DT_INTERNAL         0x00001000
+#define DT_EDITCONTROL      0x00002000
+#define DT_PATH_ELLIPSIS    0x00004000
+#define DT_END_ELLIPSIS     0x00008000
+#define DT_MODIFYSTRING     0x00010000
+#define DT_RTLREADING       0x00020000
+#define DT_WORD_ELLIPSIS    0x00040000
+
+int WINAPI	DrawTextA(HDC hdc, LPCSTR lpString, int nCount, LPRECT lpRect,
+			UINT uFormat);
+int WINAPI	DrawTextW(HDC hdc, LPCWSTR lpString, int nCount, LPRECT lpRect,
+			UINT uFormat);
+#define DrawText DrawTextA
+
+BOOL WINAPI	DrawDIB(HDC hdc,int x, int y,PMWIMAGEHDR pimage); /* microwin*/
+
+/* GetSysColor, FillRect colors*/
+#define COLOR_SCROLLBAR         0
+#define COLOR_BACKGROUND        1
+#define COLOR_ACTIVECAPTION     2
+#define COLOR_INACTIVECAPTION   3
+#define COLOR_MENU              4
+#define COLOR_WINDOW            5
+#define COLOR_WINDOWFRAME       6
+#define COLOR_MENUTEXT          7
+#define COLOR_WINDOWTEXT        8
+#define COLOR_CAPTIONTEXT       9
+#define COLOR_ACTIVEBORDER      10
+#define COLOR_INACTIVEBORDER    11
+#define COLOR_APPWORKSPACE      12
+#define COLOR_HIGHLIGHT         13
+#define COLOR_HIGHLIGHTTEXT     14
+#define COLOR_BTNFACE           15
+#define COLOR_BTNSHADOW         16
+#define COLOR_GRAYTEXT          17
+#define COLOR_BTNTEXT           18
+#define COLOR_INACTIVECAPTIONTEXT 19
+#define COLOR_BTNHIGHLIGHT      20
+#define COLOR_3DDKSHADOW        21
+#define COLOR_3DLIGHT           22
+#define COLOR_INFOTEXT          23
+#define COLOR_INFOBK            24
+#define COLOR_DESKTOP           COLOR_BACKGROUND
+#define COLOR_3DFACE            COLOR_BTNFACE
+#define COLOR_3DSHADOW          COLOR_BTNSHADOW
+#define COLOR_3DHIGHLIGHT       COLOR_BTNHIGHLIGHT
+#define COLOR_3DHILIGHT         COLOR_BTNHIGHLIGHT
+#define COLOR_BTNHILIGHT        COLOR_BTNHIGHLIGHT
+#define COLOR_ALTERNATEBUTTONFACE	25
+#define COLOR_HOTLIGHT                  26
+#define COLOR_GRADIENTACTIVECAPTION     27
+#define COLOR_GRADIENTINACTIVECAPTION   28
+
+DWORD WINAPI	GetSysColor(int nIndex);
+COLORREF WINAPI	SetSysColor(int nIndex, COLORREF crColor);/* Microwindows only*/
+
+/* Stock Logical Objects */
+#define WHITE_BRUSH         0
+#define LTGRAY_BRUSH        1
+#define GRAY_BRUSH          2
+#define DKGRAY_BRUSH        3
+#define BLACK_BRUSH         4
+#define NULL_BRUSH          5
+#define HOLLOW_BRUSH        NULL_BRUSH
+#define WHITE_PEN           6
+#define BLACK_PEN           7
+#define NULL_PEN            8
+#define OEM_FIXED_FONT      10
+#define ANSI_FIXED_FONT     11
+#define ANSI_VAR_FONT       12
+#define SYSTEM_FONT         13
+#define DEVICE_DEFAULT_FONT 14
+#define DEFAULT_PALETTE     15
+#define SYSTEM_FIXED_FONT   16
+#define DEFAULT_GUI_FONT    17
+#define DC_BRUSH            18
+#define DC_PEN              19
+#define STOCK_LAST          19
+
+/* Object types*/
+#define OBJ_PEN             1
+#define OBJ_BRUSH           2
+#define OBJ_DC              3
+#define OBJ_METADC          4
+#define OBJ_PAL             5
+#define OBJ_FONT            6
+#define OBJ_BITMAP          7
+#define OBJ_REGION          8
+#define OBJ_METAFILE        9
+#define OBJ_MEMDC           10
+#define OBJ_EXTPEN          11
+#define OBJ_ENHMETADC       12
+#define OBJ_ENHMETAFILE     13
+
+HGDIOBJ WINAPI	GetStockObject(int nObject);
+HGDIOBJ WINAPI	SelectObject(HDC hdc, HGDIOBJ hObject);
+BOOL WINAPI	DeleteObject(HGDIOBJ hObject);
+int WINAPI	SelectClipRgn(HDC hdc, HRGN hrgn);
+int WINAPI	ExtSelectClipRgn(HDC hdc, HRGN hrgn, int fnMode);
+int WINAPI	GetUpdateRgn(HWND hwnd, HRGN hrgn, BOOL bErase);
+BOOL WINAPI	GetUpdateRect(HWND hwnd, LPRECT lpRect, BOOL bErase);
+
+/* Brush Styles */
+#define BS_SOLID            0
+#define BS_NULL             1
+#define BS_HOLLOW           BS_NULL
+
+HBRUSH WINAPI	CreateSolidBrush(COLORREF crColor);
+
+/* Pen Styles */
+#define PS_SOLID            0
+#define PS_NULL             5
+
+HPEN WINAPI	CreatePen(int nPenStyle, int nWidth, COLORREF crColor);
+
+HBITMAP WINAPI	CreateCompatibleBitmap(HDC hdc, int nWidth, int nHeight);
+HDC WINAPI	CreateCompatibleDC(HDC hdc);
+
+/* BitBlit raster opcodes*/
+#define SRCCOPY		(DWORD)MWROP_SRCCOPY	/* win32 is 0x00CC0020*/
+#define SRCAND		(DWORD)MWROP_SRCAND
+#define SRCINVERT	(DWORD)MWROP_SRCINVERT
+#define BLACKNESS   	(DWORD)MWROP_BLACKNESS
+
+BOOL WINAPI	BitBlt(HDC hdcDest,int nXDest,int nYDest,int nWidth,int nHeight,
+			HDC hdcSrc,int nXSrc,int nYSrc,DWORD dwRop);
+
+/* Palette entry flags*/
+#define PC_RESERVED	0x01
+#define PC_EXPLICIT	0x02
+#define PC_NOCOLLAPSE	0x04
+
+typedef struct tagPALETTEENTRY {
+	BYTE	peRed;
+	BYTE	peGreen;
+	BYTE	peBlue;
+	BYTE	peFlags;
+} PALETTEENTRY, *PPALETTEENTRY, FAR *LPPALETTEENTRY;
+
+UINT WINAPI	GetSystemPaletteEntries(HDC hdc,UINT iStartIndex,UINT nEntries,
+			LPPALETTEENTRY lppe);
+
+/* GetDeviceCaps parameters*/
+#define HORZRES       8     /* Horizontal width in pixels               */
+#define VERTRES       10    /* Vertical height in pixels                */
+#define BITSPIXEL     12    /* Number of bits per pixel                 */
+#define PLANES        14    /* Number of planes                         */
+#define LOGPIXELSX    88    /* Logical pixels/inch in X                 */
+#define LOGPIXELSY    90    /* Logical pixels/inch in Y                 */
+#define SIZEPALETTE  104    /* Number of entries in physical palette    */
+
+int WINAPI	GetDeviceCaps(HDC hdc, int nIndex);
+
+/* Region flags*/
+#define ERRORREGION		MWREGION_ERROR
+#define NULLREGION		MWREGION_NULL
+#define SIMPLEREGION		MWREGION_SIMPLE
+#define COMPLEXREGION		MWREGION_COMPLEX
+/* kluge for VxWorks*/
+#ifdef ERROR
+#undef ERROR
+#endif
+#define ERROR			ERRORREGION
+#define RGN_ERROR		ERRORREGION
+
+/* CombineRgn() Styles */
+#define RGN_AND             1
+#define RGN_OR              2
+#define RGN_XOR             3
+#define RGN_DIFF            4
+#define RGN_COPY            5
+#define RGN_MIN             RGN_AND
+#define RGN_MAX             RGN_COPY
+
+/* GetRegionData/ExtCreateRegion */
+#define RDH_RECTANGLES  1
+typedef struct _RGNDATAHEADER {
+    DWORD   dwSize;
+    DWORD   iType;
+    DWORD   nCount;
+    DWORD   nRgnSize;
+    RECT    rcBound;
+} RGNDATAHEADER, *PRGNDATAHEADER;
+
+typedef struct _RGNDATA {
+    RGNDATAHEADER   rdh;
+    char            Buffer[1];
+} RGNDATA, *PRGNDATA, *NPRGNDATA, *LPRGNDATA;
+
+/* Region entry points*/
+INT  WINAPI OffsetRgn(HRGN hrgn, INT x, INT y );
+INT  WINAPI GetRgnBox(HRGN hrgn, LPRECT rect );
+HRGN WINAPI CreateRectRgn(INT left, INT top, INT right, INT bottom);
+HRGN WINAPI CreateRectRgnIndirect(const RECT* rect );
+VOID WINAPI SetRectRgn(HRGN hrgn, INT left, INT top, INT right, INT bottom );
+HRGN WINAPI CreateRoundRectRgn(INT left, INT top, INT right, INT bottom,
+		INT ellipse_width, INT ellipse_height );
+HRGN WINAPI CreateEllipticRgn(INT left, INT top, INT right, INT bottom );
+HRGN WINAPI CreateEllipticRgnIndirect(const RECT *rect );
+DWORD WINAPI GetRegionData(HRGN hrgn, DWORD count, LPRGNDATA rgndata);
+BOOL WINAPI PtInRegion(HRGN hrgn, INT x, INT y );
+BOOL WINAPI RectInRegion(HRGN hrgn, const RECT *rect );
+BOOL WINAPI EqualRgn(HRGN hrgn1, HRGN hrgn2 );
+INT  WINAPI CombineRgn(HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode);
+
+/* Rect entry points*/
+BOOL WINAPI IntersectRect(LPRECT dest, const RECT *src1, const RECT *src2 );
+BOOL WINAPI UnionRect(LPRECT dest, const RECT *src1, const RECT *src2 );
+BOOL WINAPI EqualRect(const RECT* rect1, const RECT* rect2 );
+BOOL WINAPI SubtractRect(LPRECT dest, const RECT *src1, const RECT *src2 );
+
diff -urN lib/microwindows/src/include/winkbd.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/winkbd.h
--- lib/microwindows/src/include/winkbd.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/winkbd.h	2005-02-21 16:03:32.000000000 +0100
@@ -0,0 +1,128 @@
+/* winkbd.h*/
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Win32 keyboard defines and API
+ */
+
+/* virtual key codes*/
+#define VK_LBUTTON        0x01
+#define VK_RBUTTON        0x02
+#define VK_CANCEL         0x03		/* ctrl-break*/
+#define VK_MBUTTON        0x04
+#define VK_BACK           0x08		/* backspace*/
+#define VK_TAB            0x09
+#define VK_CLEAR          0x0C		/* kp5 w/numlock off*/
+#define VK_RETURN         0x0D
+#define VK_SHIFT          0x10		/* either shift*/
+#define VK_CONTROL        0x11		/* either control*/
+#define VK_MENU           0x12		/* alt*/
+#define VK_PAUSE          0x13
+#define VK_CAPITAL        0x14		/* caps lock*/
+#define VK_KANA           0x15
+#define VK_HANGEUL        VK_KANA
+#define VK_HANGUL         0x15
+#define VK_JUNJA          0x17
+#define VK_FINAL          0x18
+#define VK_HANJA          0x19
+#define VK_KANJI          0x19
+#define VK_ESCAPE         0x1B		/* esc*/
+#define VK_CONVERT        0x1C
+#define VK_NONCONVERT     0x1D
+#define VK_ACCEPT         0x1E
+#define VK_MODECHANGE     0x1F
+#define VK_SPACE          0x20		/* spacebar*/
+#define VK_PRIOR          0x21		/* page up*/
+#define VK_NEXT           0x22		/* page dn*/
+#define VK_END            0x23
+#define VK_HOME           0x24
+#define VK_LEFT           0x25
+#define VK_UP             0x26
+#define VK_RIGHT          0x27
+#define VK_DOWN           0x28
+#define VK_SELECT         0x29
+#define VK_PRINT          0x2A
+#define VK_EXECUTE        0x2B
+#define VK_SNAPSHOT       0x2C
+#define VK_INSERT         0x2D
+#define VK_DELETE         0x2E
+#define VK_HELP           0x2F
+
+/* 0x30 - 0x39 ASCII 0 - 9*/
+/* 0x41 - 0x5a ASCII A - Z*/
+
+#define VK_LWIN           0x5B
+#define VK_RWIN           0x5C
+#define VK_APPS           0x5D
+
+/* numeric keypad keys*/
+#define VK_NUMPAD0        0x60
+#define VK_NUMPAD1        0x61
+#define VK_NUMPAD2        0x62
+#define VK_NUMPAD3        0x63
+#define VK_NUMPAD4        0x64
+#define VK_NUMPAD5        0x65
+#define VK_NUMPAD6        0x66
+#define VK_NUMPAD7        0x67
+#define VK_NUMPAD8        0x68
+#define VK_NUMPAD9        0x69
+#define VK_MULTIPLY       0x6A		/* kp * */
+#define VK_ADD            0x6B		/* kp + */
+#define VK_SEPARATOR      0x6C
+#define VK_SUBTRACT       0x6D		/* kp - */
+#define VK_DECIMAL        0x6E		/* kp . */
+#define VK_DIVIDE         0x6F		/* kp / */
+
+#define VK_F1             0x70
+#define VK_F2             0x71
+#define VK_F3             0x72
+#define VK_F4             0x73
+#define VK_F5             0x74
+#define VK_F6             0x75
+#define VK_F7             0x76
+#define VK_F8             0x77
+#define VK_F9             0x78
+#define VK_F10            0x79
+#define VK_F11            0x7A
+#define VK_F12            0x7B
+#define VK_F13            0x7C
+#define VK_F14            0x7D
+#define VK_F15            0x7E
+#define VK_F16            0x7F
+#define VK_F17            0x80
+#define VK_F18            0x81
+#define VK_F19            0x82
+#define VK_F20            0x83
+#define VK_F21            0x84
+#define VK_F22            0x85
+#define VK_F23            0x86
+#define VK_F24            0x87
+#define VK_NUMLOCK        0x90		/* num lock*/
+#define VK_SCROLL         0x91		/* scroll lock*/
+
+/* param to GetAsyncKeyState and GetKeyState only*/
+#define VK_LSHIFT         0xA0
+#define VK_RSHIFT         0xA1
+#define VK_LCONTROL       0xA2
+#define VK_RCONTROL       0xA3
+#define VK_LMENU          0xA4
+#define VK_RMENU          0xA5
+
+#define VK_PROCESSKEY     0xE5
+#define VK_ATTN           0xF6
+#define VK_CRSEL          0xF7
+#define VK_EXSEL          0xF8
+#define VK_EREOF          0xF9
+#define VK_PLAY           0xFA
+#define VK_ZOOM           0xFB
+#define VK_NONAME         0xFC
+#define VK_PA1            0xFD
+#define VK_OEM_CLEAR      0xFE
+
+/* WM_KEYUP/WM_KEYDOWN/WM_CHAR hiword lparam flags*/
+#define KF_EXTENDED         0x0100
+#define KF_DLGMODE          0x0800
+#define KF_MENUMODE         0x1000
+#define KF_ALTDOWN          0x2000
+#define KF_REPEAT           0x4000
+#define KF_UP               0x8000
diff -urN lib/microwindows/src/include/wintern.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/wintern.h
--- lib/microwindows/src/include/wintern.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/wintern.h	2005-02-21 16:03:32.000000000 +0100
@@ -0,0 +1,134 @@
+/* wintern.h*/
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Microwindows internal routines header file
+ */
+#include <string.h>
+
+#if (UNIX | DOS_DJGPP)
+#define strcmpi	strcasecmp
+#elif (VXWORKS)
+int strcmpi(const char *s1, const char *s2);
+#endif
+
+#ifdef __PACIFIC__
+#define strcmpi		stricmp
+#endif  
+
+#define DBLCLICKSPEED	750		/* mouse dblclik speed msecs (was 450)*/
+
+/* gotPaintMsg values*/
+#define PAINT_PAINTED		0	/* WM_PAINT msg has been processed*/
+#define PAINT_NEEDSPAINT	1	/* WM_PAINT seen, paint when can*/
+#define PAINT_DELAYPAINT	2	/* WM_PAINT seen,paint after user move*/
+
+/* non-win32 api access for microwin*/
+BOOL		MwSetDesktopWallpaper(PMWIMAGEHDR pImage);
+void		MwRegisterFdInput(HWND hwnd,int fd);
+void		MwUnregisterFdInput(HWND hwnd,int fd);
+void		MwRegisterFdOutput(HWND hwnd,int fd);
+void		MwUnregisterFdOutput(HWND hwnd,int fd);
+void		MwRegisterFdExcept(HWND hwnd,int fd);
+void		MwUnregisterFdExcept(HWND hwnd,int fd);
+
+/* internal routines*/
+
+/* winuser.c*/
+PWNDCLASS 	MwFindClassByName(LPCSTR lpClassName);
+void		MwDestroyWindow(HWND hwnd,BOOL bSendMsg);
+HWND		MwGetTopWindow(HWND hwnd);
+void		MwCalcClientRect(HWND hwnd);
+void		MwSendSizeMove(HWND hwnd, BOOL bSize, BOOL bMove);
+void		MwSetCursor(HWND wp, PMWCURSOR pcursor);
+
+/* wingdi.c*/
+#define MwIsClientDC(hdc)	(((hdc)->flags & DCX_WINDOW) == 0)
+#define MwIsMemDC(hdc)		((hdc)->psd->flags == PSF_MEMORY)
+void		MwPaintNCArea(HWND hwnd);
+HWND		MwPrepareDC(HDC hdc);
+void		MwSetClipWindow(HDC hdc);
+
+/* winsbar.c*/
+void		MwAdjustNCScrollbars(HWND hwnd);
+void		MwPaintNCScrollbars(HWND hwnd, HDC hdc);
+void		MwHandleNCMessageScrollbar(HWND hwnd, UINT msg, WPARAM hitcode,
+			LPARAM lParam);
+
+/* winexpos.c*/
+void		MwRedrawScreen(void);
+void		MwHideWindow(HWND hwnd,BOOL bChangeFocus,BOOL bSendMsg);
+void		MwShowWindow(HWND hwnd,BOOL bSendMsg);
+void		MwRaiseWindow(HWND hwnd);
+void		MwLowerWindow(HWND hwnd);
+BOOL		MwCheckOverlap(HWND topwp, HWND botwp);
+void		MwClearWindow(HWND wp,MWCOORD x,MWCOORD y,MWCOORD width,
+			MWCOORD height,BOOL exposeflag);
+void		MwExposeArea(HWND wp, MWCOORD rootx,MWCOORD rooty,
+			MWCOORD width,MWCOORD height);
+/* winevent.c*/
+BOOL		MwCheckMouseEvent(void);
+BOOL		MwCheckKeyboardEvent(void);
+void 		MwHandleMouseStatus(MWCOORD newx, MWCOORD newy, int newbuttons);
+void		MwTranslateMouseMessage(HWND hwnd,UINT msg,int hittest);
+void		MwDeliverMouseEvent(int buttons, int changebuttons,
+			MWKEYMOD modifiers);
+void		MwDeliverKeyboardEvent(MWKEY keyvalue, MWKEYMOD modifiers,
+			MWSCANCODE scancode, BOOL pressed);
+void		MwDeliverExposureEvent(HWND wp, MWCOORD x, MWCOORD y,
+			MWCOORD width,MWCOORD height);
+void		MwUnionUpdateRegion(HWND wp, MWCOORD x, MWCOORD y,
+			MWCOORD width,MWCOORD height, BOOL bUnion);
+void		MwMoveCursor(MWCOORD x, MWCOORD y);
+void		MwCheckCursor(void);
+HWND		MwFindVisibleWindow(MWCOORD x, MWCOORD y);
+void		MwCheckMouseWindow(void);
+int		strzcpy(char *dst,const char *src,int dstsiz);
+
+/* winuser.c*/
+extern int	mwSYSMETRICS_CYCAPTION;
+extern int	mwSYSMETRICS_CXBORDER;
+extern int	mwSYSMETRICS_CYBORDER;
+extern int	mwSYSMETRICS_CXFRAME;
+extern int	mwSYSMETRICS_CYFRAME;
+extern int	mwSYSMETRICS_CXDOUBLECLK;
+extern int	mwSYSMETRICS_CYDOUBLECLK;
+extern int	mwSYSMETRICS_CYHSCROLL;
+extern int	mwSYSMETRICS_CXHSCROLL;
+extern int	mwSYSMETRICS_CXVSCROLL;
+extern int	mwSYSMETRICS_CYVSCROLL;
+
+/* wingdi.c*/
+extern BOOL	mwERASEMOVE;	/* default repaint algorithm*/
+
+/* winmain.c*/
+int		MwOpen(void);
+void		MwClose(void);
+void		MwSelect(void);
+int		MwInitialize(void);
+void		MwTerminate(void);
+extern	HWND	listwp;			/* list of all windows */
+extern	HWND	rootwp;			/* root window pointer */
+extern	HWND	focuswp;		/* focus window for keyboard */
+extern	HWND	mousewp;		/* window mouse is currently in */
+extern	HWND	capturewp;		/* capture window*/
+extern  HWND	dragwp;			/* window user is dragging*/
+extern	HCURSOR	curcursor;		/* currently enabled cursor */
+extern	MWCOORD	cursorx;		/* x position of cursor */
+extern	MWCOORD	cursory;		/* y position of cursor */
+extern	MWSCREENINFO	sinfo;		/* screen information */
+extern  DWORD	startTicks;		/* tickcount on startup */
+extern  int	mwpaintNC;		/* experimental nonclient regions*/
+extern  BOOL	mwforceNCpaint;		/* force NC paint for alphablend*/
+
+#if VTSWITCH
+/* temp framebuffer vt switch stuff at upper level
+ * this should be handled at the lower level, just like vgalib does.
+ */
+void MwInitVt(void);
+int  MwCurrentVt(void);
+int  MwCheckVtChange(void);
+void MwRedrawVt(int t);
+void MwExitVt(void);
+extern int mwvterm;
+#endif /* VTSWITCH*/
diff -urN lib/microwindows/src/include/wintools.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/wintools.h
--- lib/microwindows/src/include/wintools.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/wintools.h	2005-02-21 16:03:32.000000000 +0100
@@ -0,0 +1,27 @@
+/*
+ * wintools.h - MS Windows tools library header
+ *
+ * WINGEN	General Purpose Library
+ * WINMEM	Windows Memory Mgmt Library
+ * WINFX	Special Effects Library
+ * WINDRAW	Draw Library
+ * WINCTL	Custom Control Library
+ * WIN Class Procedures: ToolsTips, AutoMove, AutoEdit
+ * WINVID	Windows Digital Video
+ *
+ * original version 1/6/95 by g haerr
+ */
+
+void WINAPI	Draw3dShadow(HDC hDC,int x,int y,int w,int h,COLORREF crTop,
+			COLORREF crBottom);
+void WINAPI 	Draw3dBox(HDC hDC,int x,int y,int w,int h,COLORREF crTop,
+			COLORREF crBottom);
+void WINAPI	Draw3dInset(HDC hDC,int x,int y,int w,int h);
+void WINAPI	Draw3dOutset(HDC hDC,int x,int y,int w,int h);
+void WINAPI	Draw3dPushDown(HDC hDC, int x, int y, int w, int h);
+void WINAPI	Draw3dUpDownState(HDC hDC, int x, int y, int w, int h,
+			BOOL fDown);
+void WINAPI	Draw3dUpFrame(HDC hDC, int l, int t, int r, int b);
+void WINAPI	FastFillRect(HDC hdc,LPRECT lprect,COLORREF cr);
+void WINAPI	InsetR(LPRECT lprc,int h,int v);
+BOOL WINAPI	PtInsideWindow(HWND hwnd,UINT x,UINT y);
diff -urN lib/microwindows/src/include/winuser.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/winuser.h
--- lib/microwindows/src/include/winuser.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/include/winuser.h	2005-02-21 16:13:19.000000000 +0100
@@ -0,0 +1,504 @@
+/* winuser.h*/
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Win32 USER structures and API
+ */
+#include "winctl.h"	/* required compatibility for resource compiler*/
+
+/* moved from windef.h for resource compiler*/
+typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);
+typedef LRESULT (CALLBACK* DLGPROC)(HWND, UINT, WPARAM, LPARAM);
+
+/* win api*/
+LRESULT WINAPI 	DefWindowProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
+
+/* Class styles*/
+#define CS_VREDRAW          0x0001
+#define CS_HREDRAW          0x0002
+#define CS_DBLCLKS          0x0008
+#define CS_OWNDC            0x0020
+#define CS_CLASSDC          0x0040
+#define CS_PARENTDC         0x0080
+#define CS_NOCLOSE          0x0200
+#define CS_SAVEBITS         0x0800
+#define CS_BYTEALIGNCLIENT  0x1000
+#define CS_BYTEALIGNWINDOW  0x2000
+#define CS_GLOBALCLASS      0x4000
+
+typedef struct tagWNDCLASSA {
+    MWLIST	link;			/* microwin*/
+    UINT        style;
+    WNDPROC     lpfnWndProc;
+    int         cbClsExtra;		/* nyi*/
+    int         cbWndExtra;
+    HINSTANCE   hInstance;		/* nyi*/
+    HICON       hIcon;			/* nyi*/
+    HCURSOR     hCursor;		/* nyi*/
+    HBRUSH      hbrBackground;
+    LPCSTR      lpszMenuName;		/* nyi*/
+    LPCSTR      lpszClassName;
+    CHAR	szClassName[40];	/* microwin*/
+} WNDCLASS, *PWNDCLASS, NEAR *NPWNDCLASS, FAR *LPWNDCLASS;
+
+ATOM WINAPI	RegisterClass(CONST WNDCLASS *lpWndClass);
+
+/*
+ * Message structure
+ */
+typedef struct tagMSG {
+    MWLIST	link;			/* microwin*/
+    HWND        hwnd;
+    UINT        message;
+    WPARAM      wParam;
+    LPARAM      lParam;
+    DWORD       time;
+    POINT       pt;
+} MSG, *PMSG, NEAR *NPMSG, FAR *LPMSG;
+
+#define POINTSTOPOINT(pt, pts)                          \
+        { (pt).x = (LONG)(SHORT)LOWORD(*(LONG*)&pts);   \
+          (pt).y = (LONG)(SHORT)HIWORD(*(LONG*)&pts); }
+
+#define POINTTOPOINTS(pt)      (MAKELONG((short)((pt).x), (short)((pt).y)))
+#define MAKEWPARAM(l, h)      (WPARAM)MAKELONG(l, h)
+#define MAKELPARAM(l, h)      (LPARAM)MAKELONG(l, h)
+#define MAKELRESULT(l, h)     (LRESULT)MAKELONG(l, h)
+
+/* window messages*/
+#define WM_NULL                         0x0000
+#define WM_CREATE                       0x0001
+#define WM_DESTROY                      0x0002
+#define WM_MOVE                         0x0003
+#define WM_SIZE                         0x0005
+#define WM_ACTIVATE                     0x0006
+#define WM_SETFOCUS                     0x0007
+#define WM_KILLFOCUS                    0x0008
+#define WM_ENABLE                       0x000A
+#define WM_SETTEXT                      0x000C
+#define WM_GETTEXT                      0x000D
+#define WM_GETTEXTLENGTH                0x000E
+#define WM_PAINT                        0x000F
+#define WM_CLOSE                        0x0010
+#define WM_QUIT                         0x0012
+#define WM_ERASEBKGND                   0x0014
+#define WM_SHOWWINDOW                   0x0018
+#define WM_SETFONT          		0x0030
+#define WM_GETFONT      		0x0031
+#define WM_WINDOWPOSCHANGED             0x0047
+#define WM_NCCALCSIZE                   0x0083
+#define WM_NCHITTEST                    0x0084
+#define WM_NCPAINT                      0x0085
+#define WM_GETDLGCODE                   0x0087
+#define WM_NCMOUSEMOVE                  0x00A0
+#define WM_NCLBUTTONDOWN                0x00A1
+#define WM_NCLBUTTONUP                  0x00A2
+#define WM_NCLBUTTONDBLCLK              0x00A3
+#define WM_NCRBUTTONDOWN                0x00A4
+#define WM_NCRBUTTONUP                  0x00A5
+#define WM_NCRBUTTONDBLCLK              0x00A6
+#define WM_KEYFIRST                     0x0100
+#define WM_KEYDOWN                      0x0100
+#define WM_KEYUP                        0x0101
+#define WM_CHAR                         0x0102
+#define WM_DEADCHAR                     0x0103	/* notimp*/
+#define WM_SYSKEYDOWN                   0x0104	/* nyi*/
+#define WM_SYSKEYUP                     0x0105	/* nyi*/
+#define WM_SYSCHAR                      0x0106	/* nyi*/
+#define WM_SYSDEADCHAR                  0x0107	/* notimp*/
+#define WM_KEYLAST                      0x0108
+#define WM_COMMAND                      0x0111
+#define WM_TIMER                        0x0113
+#define WM_HSCROLL                      0x0114
+#define WM_VSCROLL                      0x0115
+
+#define WM_MOUSEFIRST                   0x0200
+#define WM_MOUSEMOVE                    0x0200
+#define WM_LBUTTONDOWN                  0x0201
+#define WM_LBUTTONUP                    0x0202
+#define WM_LBUTTONDBLCLK                0x0203
+#define WM_RBUTTONDOWN                  0x0204
+#define WM_RBUTTONUP                    0x0205
+#define WM_RBUTTONDBLCLK                0x0206
+#define WM_MBUTTONDOWN                  0x0207
+#define WM_MBUTTONUP                    0x0208
+#define WM_MBUTTONDBLCLK                0x0209
+#define WM_MOUSEWHEEL                   0x020A
+#define WM_MOUSELAST                    0x020A
+
+#define WM_CARET_CREATE    		0x03E0 /* Microwindows only*/
+#define WM_CARET_DESTROY   		0x03E1 /* Microwindows only*/
+#define WM_CARET_BLINK      		0x03E2 /* Microwindows only*/
+#define WM_FDINPUT                      0x03F0 /* Microwindows only*/
+#define WM_FDOUTPUT                     0x03F1 /* Microwindows only*/
+#define WM_FDEXCEPT                     0x03F2 /* Microwindows only*/
+#define WM_USER                         0x0400
+
+/* WM_ACTIVATE state values*/
+#define WA_INACTIVE     0
+#define WA_ACTIVE       1
+#define WA_CLICKACTIVE  2
+
+/* WM_NCHITTEST codes*/
+#define HTERROR             (-2)
+#define HTTRANSPARENT       (-1)
+#define HTNOWHERE           0
+#define HTCLIENT            1
+#define HTCAPTION           2
+#define HTSYSMENU           3
+#define HTGROWBOX           4
+#define HTSIZE              HTGROWBOX
+#define HTMENU              5
+#define HTHSCROLL           6
+#define HTVSCROLL           7
+#define HTMINBUTTON         8
+#define HTMAXBUTTON         9
+#define HTLEFT              10
+#define HTRIGHT             11
+#define HTTOP               12
+#define HTTOPLEFT           13
+#define HTTOPRIGHT          14
+#define HTBOTTOM            15
+#define HTBOTTOMLEFT        16
+#define HTBOTTOMRIGHT       17
+#define HTBORDER            18
+#define HTREDUCE            HTMINBUTTON
+#define HTZOOM              HTMAXBUTTON
+#define HTSIZEFIRST         HTLEFT
+#define HTSIZELAST          HTBOTTOMRIGHT
+#define HTOBJECT            19
+#define HTCLOSE             20
+#define HTHELP              21
+
+/* WM_SIZE wparam values*/
+#define SIZE_RESTORED       0
+#define SIZE_MINIMIZED      1
+#define SIZE_MAXIMIZED      2
+#define SIZE_MAXSHOW        3
+#define SIZE_MAXHIDE        4
+
+LRESULT WINAPI  CallWindowProc(WNDPROC lpPrevWndFunc, HWND hwnd, UINT Msg,
+			WPARAM wParam, LPARAM lParam);
+LRESULT WINAPI	SendMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);
+BOOL WINAPI	PostMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);
+BOOL WINAPI	PostThreadMessage(DWORD dwThreadId, UINT Msg, WPARAM wParam,
+			LPARAM lParam);
+VOID WINAPI	PostQuitMessage(int nExitCode);
+
+/* PeekMessage options*/
+#define PM_NOREMOVE		0x0000
+#define PM_REMOVE		0x0001
+#define PM_NOYIELD		0x0002
+
+BOOL WINAPI	PeekMessage(LPMSG lpMsg, HWND hwnd, UINT uMsgFilterMin,
+			UINT uMsgFilterMax, UINT wRemoveMsg);
+BOOL WINAPI 	GetMessage(LPMSG lpMsg,HWND hwnd,UINT wMsgFilterMin,
+			UINT wMsgFilterMax);
+BOOL WINAPI 	TranslateMessage(CONST MSG *lpMsg);
+LONG WINAPI	DispatchMessage(CONST MSG *lpMsg);
+
+/* note: the following struct is in reverse order from the
+ * microsoft version since WINAPI is cdecl in this implementation
+ */
+typedef struct tagCREATESTRUCT {
+    DWORD       dwExStyle;
+    LPCSTR      lpszClass;
+    LPCSTR      lpszName;
+    LONG        style;
+    int         x;
+    int         y;
+    int         cx;
+    int         cy;
+    HWND        hwndParent;
+    HMENU       hMenu;
+    HINSTANCE   hInstance;
+    LPVOID      lpCreateParams;
+} CREATESTRUCT, *LPCREATESTRUCT;
+
+/*
+ * Window Styles
+ */
+#define WS_OVERLAPPED       0x00000000L
+#define WS_POPUP            0x80000000L
+#define WS_CHILD            0x40000000L
+#define WS_MINIMIZE         0x20000000L
+#define WS_VISIBLE          0x10000000L
+#define WS_DISABLED         0x08000000L
+#define WS_CLIPSIBLINGS     0x04000000L
+#define WS_CLIPCHILDREN     0x02000000L
+#define WS_MAXIMIZE         0x01000000L
+#define WS_CAPTION          0x00C00000L     /* WS_BORDER | WS_DLGFRAME  */
+#define WS_BORDER           0x00800000L
+#define WS_DLGFRAME         0x00400000L
+#define WS_VSCROLL          0x00200000L
+#define WS_HSCROLL          0x00100000L
+#define WS_SYSMENU          0x00080000L
+#define WS_THICKFRAME       0x00040000L
+#define WS_GROUP            0x00020000L
+#define WS_TABSTOP          0x00010000L
+
+#define WS_MINIMIZEBOX      0x00020000L
+#define WS_MAXIMIZEBOX      0x00010000L
+
+
+#define WS_TILED            WS_OVERLAPPED
+#define WS_ICONIC           WS_MINIMIZE
+#define WS_SIZEBOX          WS_THICKFRAME
+#define WS_TILEDWINDOW      WS_OVERLAPPEDWINDOW
+
+/*
+ * Common Window Styles
+ */
+#define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED     | \
+                             WS_CAPTION        | \
+                             WS_SYSMENU        | \
+                             WS_THICKFRAME     | \
+                             WS_MINIMIZEBOX    | \
+                             WS_MAXIMIZEBOX)
+
+#define WS_POPUPWINDOW      (WS_POPUP          | \
+                             WS_BORDER         | \
+                             WS_SYSMENU)
+
+#define WS_CHILDWINDOW      (WS_CHILD)
+
+/*
+ * Extended Window Styles
+ */
+#define WS_EX_DLGMODALFRAME     0x00000001L
+#define WS_EX_NOPARENTNOTIFY    0x00000004L
+#define WS_EX_TOPMOST           0x00000008L
+#define WS_EX_ACCEPTFILES       0x00000010L
+#define WS_EX_TRANSPARENT       0x00000020L
+#define WS_EX_MDICHILD          0x00000040L
+#define WS_EX_TOOLWINDOW        0x00000080L
+#define WS_EX_WINDOWEDGE        0x00000100L
+#define WS_EX_CLIENTEDGE        0x00000200L
+#define WS_EX_CONTEXTHELP       0x00000400L
+
+#define WS_EX_RIGHT             0x00001000L
+#define WS_EX_LEFT              0x00000000L
+#define WS_EX_RTLREADING        0x00002000L
+#define WS_EX_LTRREADING        0x00000000L
+#define WS_EX_LEFTSCROLLBAR     0x00004000L
+#define WS_EX_RIGHTSCROLLBAR    0x00000000L
+
+#define WS_EX_CONTROLPARENT     0x00010000L
+#define WS_EX_STATICEDGE        0x00020000L
+#define WS_EX_APPWINDOW         0x00040000L
+#define WS_EX_LAYERED		0x00080000L
+
+#define WS_EX_OVERLAPPEDWINDOW  (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE)
+#define WS_EX_PALETTEWINDOW     (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST)
+
+#define CW_USEDEFAULT       ((int)0x80000000)
+
+#define HWND_DESKTOP        ((HWND)0)
+
+#define CreateWindow(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hwndParent, hMenu, hInstance, lpParam)\
+		CreateWindowEx(0L, lpClassName, lpWindowName, dwStyle, x, y,\
+		nWidth, nHeight, hwndParent, hMenu, hInstance, lpParam)
+
+HWND WINAPI	CreateWindowEx(DWORD dwExStyle, LPCSTR lpClassName,
+    			LPCSTR lpWindowName, DWORD dwStyle, int X, int Y,
+			int nWidth, int nHeight, HWND hwndParent, HMENU hMenu,
+			HINSTANCE hInstance, LPVOID lpParam);
+BOOL WINAPI 	DestroyWindow(HWND hwnd);
+BOOL WINAPI	IsWindow(HWND hwnd);
+#define IsWindowVisible(hwnd)	((BOOL)((hwnd)->unmapcount == 0))
+
+/*
+ * ShowWindow() Commands
+ */
+#define SW_HIDE             0
+#define SW_SHOWNORMAL       1
+#define SW_NORMAL           1
+#define SW_SHOWMINIMIZED    2
+#define SW_SHOWMAXIMIZED    3
+#define SW_MAXIMIZE         3
+#define SW_SHOWNOACTIVATE   4
+#define SW_SHOW             5
+#define SW_MINIMIZE         6
+#define SW_SHOWMINNOACTIVE  7
+#define SW_SHOWNA           8
+#define SW_RESTORE          9
+#define SW_SHOWDEFAULT      10
+#define SW_FORCEMINIMIZE    11
+#define SW_MAX              11
+
+BOOL WINAPI 	ShowWindow(HWND hwnd, int nCmdShow);
+BOOL WINAPI	InvalidateRect(HWND hwnd, CONST RECT *lpRect, BOOL bErase);
+BOOL WINAPI	InvalidateRgn(HWND hwnd, HRGN hrgn, BOOL bErase);
+BOOL WINAPI	ValidateRect(HWND hwnd, CONST RECT *lprc);
+BOOL WINAPI	ValidateRgn(HWND hwnd, HRGN hrgn);
+BOOL WINAPI	UpdateWindow(HWND hwnd);
+
+BOOL WINAPI	SetLayeredWindowAttributes(HWND hwnd, COLORREF crKey,
+			BYTE bAlpha, DWORD dwFlags);
+#define LWA_COLORKEY	0x00000001
+#define LWA_ALPHA	0x00000002
+
+HWND WINAPI	GetFocus(VOID);
+HWND WINAPI	SetFocus(HWND hwnd);
+BOOL WINAPI	SetForegroundWindow(HWND hwnd);
+HWND WINAPI	SetActiveWindow(HWND hwnd);
+HWND WINAPI	GetActiveWindow(VOID);
+BOOL WINAPI	BringWindowToTop(HWND hwnd);
+HWND WINAPI	GetDesktopWindow(VOID);
+HWND WINAPI	GetParent(HWND hwnd);
+BOOL WINAPI	EnableWindow(HWND hwnd, BOOL bEnable);
+#define IsWindowEnabled(hwnd)	((BOOL)(((hwnd)->style&WS_DISABLED) == 0))
+
+BOOL WINAPI	AdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu,
+			DWORD dwExStyle);
+BOOL WINAPI	GetClientRect(HWND hwnd, LPRECT lpRect);
+BOOL WINAPI	GetWindowRect(HWND hwnd, LPRECT lpRect);
+
+BOOL WINAPI 	ClientToScreen(HWND hwnd, LPPOINT lpPoint);
+BOOL WINAPI 	ScreenToClient(HWND hwnd, LPPOINT lpPoint);
+int  WINAPI	MapWindowPoints(HWND hwndFrom, HWND hwndTo, LPPOINT lpPoints,
+			UINT cPoints);
+
+BOOL WINAPI	SetRect(LPRECT lprc,int xLeft,int yTop,int xRight,int yBottom);
+BOOL WINAPI	SetRectEmpty(LPRECT lprc);
+BOOL WINAPI	CopyRect(LPRECT lprcDst, CONST RECT *lprcSrc);
+BOOL WINAPI	IsRectEmpty(CONST RECT *lprc);
+BOOL WINAPI	InflateRect(LPRECT lprc, int dx, int dy);
+BOOL WINAPI	OffsetRect(LPRECT lprc, int dx, int dy);
+/* The bcc compiler doesn't work passing structs by value, so we have this*/
+#if ELKS
+#define		PtInRect(lprc,pt)	MwPTINRECT(lprc, *(long *)&(pt))
+#else
+#define		PtInRect(lprc,pt)	MwPTINRECT(lprc, pt)
+#endif
+BOOL WINAPI	MwPTINRECT(CONST RECT *lprc, POINT pt);
+
+/*
+ * Window field offsets for GetWindowLong()
+ */
+#define GWL_WNDPROC         (-4)
+#define GWL_HINSTANCE       (-6)
+#define GWL_HWNDPARENT      (-8)
+#define GWL_STYLE           (-16)
+#define GWL_EXSTYLE         (-20)
+#define GWL_USERDATA        (-21)
+#define GWL_ID              (-12)
+
+/*
+ * Class field offsets for GetClassLong()
+ */
+#define GCL_MENUNAME        (-8)
+#define GCL_HBRBACKGROUND   (-10)
+#define GCL_HCURSOR         (-12)
+#define GCL_HICON           (-14)
+#define GCL_HMODULE         (-16)
+#define GCL_CBWNDEXTRA      (-18)
+#define GCL_CBCLSEXTRA      (-20)
+#define GCL_WNDPROC         (-24)
+#define GCL_STYLE           (-26)
+#define GCW_ATOM            (-32)
+#define GCL_HICONSM         (-34)
+
+LONG WINAPI	GetWindowLong(HWND hwnd, int nIndex);
+LONG WINAPI	SetWindowLong(HWND hwnd, int nIndex, LONG lNewLong);
+WORD WINAPI	GetWindowWord(HWND hwnd, int nIndex);
+WORD WINAPI	SetWindowWord(HWND hwnd, int nIndex, WORD wNewWord);
+#define GetDlgCtrlID(hwnd)	((int)(hwnd)->id)
+DWORD WINAPI	GetClassLong(HWND hwnd, int nIndex);
+int WINAPI	GetWindowTextLength(HWND hwnd);
+int WINAPI	GetWindowText(HWND hwnd, LPSTR lpString, int nMaxCount);
+BOOL WINAPI	SetWindowText(HWND hwnd, LPCSTR lpString);
+
+BOOL WINAPI 	MoveWindow(HWND hwnd, int x, int y, int nWidth, int nHeight,
+    			BOOL bRepaint);
+
+/* SetWindowPos Flags*/
+#define SWP_NOSIZE          0x0001
+#define SWP_NOMOVE          0x0002
+#define SWP_NOZORDER        0x0004
+#define SWP_NOREDRAW        0x0008
+#define SWP_NOACTIVATE      0x0010	/* nyi*/
+#define SWP_FRAMECHANGED    0x0020	/* nyi*/
+#define SWP_SHOWWINDOW      0x0040
+#define SWP_HIDEWINDOW      0x0080
+#define SWP_NOCOPYBITS      0x0100	/* nyi*/
+#define SWP_NOOWNERZORDER   0x0200	/* nyi*/
+#define SWP_NOSENDCHANGING  0x0400	/* nyi*/
+#define SWP_DRAWFRAME       SWP_FRAMECHANGED
+#define SWP_NOREPOSITION    SWP_NOOWNERZORDER
+#define SWP_DEFERERASE      0x2000	/* nyi*/
+#define SWP_ASYNCWINDOWPOS  0x4000	/* nyi*/
+
+#define HWND_TOP        ((HWND)0)	/* nyi*/
+#define HWND_BOTTOM     ((HWND)1)	/* nyi*/
+#define HWND_TOPMOST    ((HWND)-1)	/* nyi*/
+#define HWND_NOTOPMOST  ((HWND)-2)	/* nyi*/
+
+/* WM_WINDOWPOSCHANGED message*/
+typedef struct tagWINDOWPOS {
+	HWND    hwnd;
+	HWND    hwndInsertAfter;
+	int     x;
+	int     y;
+	int     cx;
+	int     cy;
+	UINT    flags;
+} WINDOWPOS, *LPWINDOWPOS, *PWINDOWPOS;
+
+BOOL WINAPI	SetWindowPos(HWND hwnd, HWND hwndInsertAfter, int x, int y,
+			int cx, int cy, UINT fuFlags);
+
+BOOL WINAPI	GetCursorPos(LPPOINT lpPoint);
+HWND WINAPI	GetCapture(VOID);
+HWND WINAPI	SetCapture(HWND hwnd);
+BOOL WINAPI	ReleaseCapture(VOID);
+
+/*
+ * WM_NCCALCSIZE parameter structure
+ */
+typedef struct tagNCCALCSIZE_PARAMS {
+    RECT       rgrc[3];
+    /*PWINDOWPOS lppos;*/		/* removed for microwin*/
+} NCCALCSIZE_PARAMS, *LPNCCALCSIZE_PARAMS;
+
+typedef FARPROC TIMERPROC;
+
+UINT WINAPI	SetTimer(HWND hwnd, UINT idTimer, UINT uTimeout,
+			TIMERPROC lpTimerFunc);
+BOOL WINAPI	KillTimer(HWND hwnd, UINT idTimer);
+UINT		MwGetNextTimeoutValue(void);
+void		MwHandleTimers(void);
+
+/* GetSystemMetrics indices*/
+#define SM_CXSCREEN             0
+#define SM_CYSCREEN             1
+#define SM_CXVSCROLL            2
+#define SM_CYHSCROLL            3
+#define SM_CYCAPTION            4
+#define SM_CXBORDER             5
+#define SM_CYBORDER             6
+#define SM_CXDLGFRAME           7
+#define SM_CYDLGFRAME           8
+#define SM_CXFIXEDFRAME		SM_CXDLGFRAME
+#define SM_CYFIXEDFRAME		SM_CYDLGFRAME
+#define SM_CYMENU               15
+#define SM_CYVSCROLL            20
+#define SM_CXHSCROLL            21
+#define SM_CXFRAME              32
+#define SM_CYFRAME              33
+#define SM_CXSIZEFRAME		SM_CXFRAME
+#define SM_CYSIZEFRAME		SM_CYFRAME
+
+int WINAPI	GetSystemMetrics(int nIndex);
+
+HWND WINAPI	GetDlgItem(HWND hDlg, int nIDDlgItem);
+
+/**************************** Caret support **********************************/
+BOOL WINAPI CreateCaret(HWND hwnd, HBITMAP hBitmap, int nWidth, int nHeight);
+BOOL WINAPI DestroyCaret(VOID);
+BOOL WINAPI HideCaret (HWND hwnd);
+BOOL WINAPI ShowCaret(HWND hwnd);
+BOOL WINAPI SetCaretPos(int nX, int nY);
+BOOL WINAPI GetCaretPos(LPPOINT lpPoint);
+UINT WINAPI GetCaretBlinkTime(VOID);
+BOOL WINAPI SetCaretBlinkTime(UINT uMSeconds);
diff -urN lib/microwindows/src/launcher.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/launcher.sh
--- lib/microwindows/src/launcher.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/launcher.sh	2005-02-21 16:13:39.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X & bin/nanowm & bin/launcher bin/launcher.cnf & sleep 10000
diff -urN lib/microwindows/src/logfont.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/logfont.sh
--- lib/microwindows/src/logfont.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/logfont.sh	2005-02-21 16:13:42.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X & bin/logfont
diff -urN lib/microwindows/src/mcmwin.mak /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mcmwin.mak
--- lib/microwindows/src/mcmwin.mak	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mcmwin.mak	2005-02-21 16:03:53.000000000 +0100
@@ -0,0 +1,66 @@
+#
+# Microwindows Makefile for MSDOS using Microsoft C 5.10
+#
+# Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+#
+CC=cl -c -Gs -Ols -AM -I. -Ic:\tools\msc5\include
+xCFLAGS=-W1 -DUPDATEREGIONS=1 -DERASEMOVE=1
+CFLAGS=-W1 -DERASEMOVE=1
+LFLAGS=/NOI
+LIBDIR=c:\tools\msc5
+
+SERV=mwin\winmain.obj mwin\winuser.obj mwin\wingdi.obj mwin\winexpos.obj\
+	mwin\winclip.obj mwin\winevent.obj mwin\windefw.obj mwin\list.obj\
+	engine\devdraw.obj engine\devmouse.obj engine\devkbd.obj\
+	engine\devclip.obj\
+	engine\devpal1.obj engine\devpal2.obj engine\devpal4.obj\
+	mwin\winlib\draw3d.obj mwin\winlib\fastfill.obj mwin\winlib\insetr.obj\
+	mwin\winlib\ptinsid.obj mwin\winlib\graph3d.obj
+VGA_NEW=drivers\vgaplan4.obj drivers\mempl4.obj
+VGA_OLD=drivers\asmplan4.obj
+VGA_HWINIT=drivers\vgainit.obj
+DRIVERS=drivers\scr_bios.obj drivers\romfont.obj drivers\kbd_bios.obj\
+	drivers\mou_dos.obj drivers\asmbios.obj $(VGA_NEW)
+DEMO=demos\mwin\demo.obj mwin\winctl\button.obj mwin\bmp\cs1.obj
+OBJS=$(SERV) $(DRIVERS) $(DEMO)
+LIBS=
+
+all: mwindemo
+
+clean:
+	erase *.map
+	erase mwindemo.exe
+	erase drivers\*.obj
+	erase demos\mwin\*.obj
+	erase engine\*.obj
+	erase mwin\*.obj
+	erase mwin\bmp\*.obj
+	erase mwin\winctl\*.obj
+	erase mwin\winlib\*.obj
+
+
+.c.obj:
+	$(CC) $(CFLAGS) -Fo$@ $<
+
+drivers\asmbios.obj: drivers\asmbios.s
+	cd drivers
+	masm -Dmem_S -D__MEDIUM__ -Mx asmbios.s;;;
+	cd ..
+
+drivers\asmplan4.obj: drivers\asmplan4.s
+	cd drivers
+	masm -Dmem_S -D__MEDIUM__ -Mx asmplan4.s;;;
+	cd ..
+
+mwindemo: $(OBJS)
+	@set LIB=$(LIBDOS)
+	link @<<
+$(LFLAGS) /NOE+
+$(OBJS: =+^
+)
+mwindemo
+mwindemo/map/stack:3000/seg:256/f/packc:50000
+$(LIBS) $(LIBDIR)\mlibce
+nul
+<<
+
diff -urN lib/microwindows/src/mcnanox.mak /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mcnanox.mak
--- lib/microwindows/src/mcnanox.mak	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mcnanox.mak	2005-02-21 16:03:53.000000000 +0100
@@ -0,0 +1,61 @@
+#
+# Nano-X Makefile for MSDOS using Microsoft C 5.10
+#
+# Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+#
+CC=cl -c -Gs -Ols -AM -I. -Ic:\tools\msc5\include
+CFLAGS=-W1 -DNONETWORK=1
+LFLAGS=/NOI
+LIBDIR=c:\tools\msc5
+
+SERV=nanox\srvmain.obj nanox\srvfunc.obj nanox\srvutil.obj nanox\srvevent.obj\
+	engine\devdraw.obj engine\devmouse.obj engine\devkbd.obj\
+	engine\devclip.obj\
+	engine\devpal1.obj engine\devpal2.obj engine\devpal4.obj
+VGA_NEW=drivers\vgaplan4.obj drivers\mempl4.obj
+VGA_OLD=drivers\asmplan4.obj
+VGA_HWINIT=drivers\vgainit.obj
+DRIVERS=drivers\scr_bios.obj drivers\romfont.obj drivers\kbd_bios.obj\
+	drivers\mou_dos.obj drivers\asmbios.obj $(VGA_NEW)
+xDEMO=demos\nanox\demo.obj nanox\stubs.obj
+DEMO=demos\nanox\landmine.obj nanox\stubs.obj
+xDEMO=demos\nanox\world.obj nanox\stubs.obj
+xDEMO=test.obj
+OBJS=$(SERV) $(DRIVERS) $(DEMO)
+LIBS=
+
+all: nanox
+
+clean:
+	erase *.map
+	erase nanox.exe
+	erase nanox\*.obj
+	erase engine\*.obj
+	erase drivers\*.obj
+	erase demos\nanox\*.obj
+
+.c.obj:
+	$(CC) $(CFLAGS) -Fo$@ $<
+
+drivers\asmbios.obj: drivers\asmbios.s
+	cd drivers
+	masm -Dmem_S -D__MEDIUM__ -Mx asmbios.s;;;
+	cd ..
+
+drivers\asmplan4.obj: drivers\asmplan4.s
+	cd drivers
+	masm -Dmem_S -D__MEDIUM__ -Mx asmplan4.s;;;
+	cd ..
+
+nanox: $(OBJS)
+	@set LIB=$(LIBDOS)
+	link @<<
+$(LFLAGS) /NOE+
+$(OBJS: =+^
+)
+nanox
+nanox/map/stack:16384/seg:256/f/packc:50000
+$(LIBS) $(LIBDIR)\mlibce
+nul
+<<
+
diff -urN lib/microwindows/src/mouse.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mouse.sh
--- lib/microwindows/src/mouse.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mouse.sh	2005-02-21 16:03:53.000000000 +0100
@@ -0,0 +1,4 @@
+# kill old mouse driver
+gpm -k
+# start mouse driver in repeater mode
+gpm -R -t ps2
diff -urN lib/microwindows/src/move.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/move.sh
--- lib/microwindows/src/move.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/move.sh	2005-02-21 16:13:42.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X -p & bin/move; #sleep 10000
diff -urN lib/microwindows/src/move2.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/move2.sh
--- lib/microwindows/src/move2.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/move2.sh	2005-02-21 16:13:43.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X -p & bin/nanowm & bin/move; #sleep 10000
diff -urN lib/microwindows/src/mwin/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/Makefile
--- lib/microwindows/src/mwin/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/Makefile	2005-02-21 16:13:28.000000000 +0100
@@ -0,0 +1,53 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+ifndef TOP
+TOP = ..
+CONFIG = $(TOP)/config
+endif
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+
+# Defines for preprocessor
+ifeq ($(ERASEMOVE), Y)
+DEFINES += -DERASEMOVE=1
+endif
+
+ifeq ($(UPDATEREGIONS), Y)
+DEFINES += -DUPDATEREGIONS=1
+endif
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(MICROWIN), Y)
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME = libmwin.a
+LIBNAMESO = libmwin.so
+
+# List of objects to compile
+OBJS = winmain.o winuser.o wingdi.o winexpos.o winclip.o winevent.o\
+	windefw.o winrgn.o winfont.o winsbar.o
+
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
diff -urN lib/microwindows/src/mwin/bmp/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/Makefile
--- lib/microwindows/src/mwin/bmp/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/Makefile	2005-02-21 16:13:22.000000000 +0100
@@ -0,0 +1,64 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+ifndef TOP
+TOP = ../..
+CONFIG = $(TOP)/config
+endif
+
+include $(CONFIG)
+
+#all: $(TOP)/bin/convbmp
+#HOSTCC=gcc
+#HOSTCFLAGS=-I../../include
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(MICROWIN), Y)
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME = libmwimages.a
+LIBNAMESO = libmwimages.so
+
+# List of objects to compile
+OBJS = car8.o min4.o max4.o close4.o under4.o\
+	zion208.o cs1.o rle8.o microwin.o penguin.o
+
+all: $(TOP)/bin/convbmp $(TOP)/bin/makebmp default
+
+convbmp: convbmp.c
+	$(HOSTCC) $(HOSTCFLAGS) $< -o $@
+
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
+realclean: clean
+	$(RM) car8.c min4.c max4.c close4.c under4.c zion208.c cs1.c rle8.c \
+	microwin.c penguin.c
+
+$(TOP)/bin/convbmp: convbmp.c
+	$(HOSTCC) $(HOSTCFLAGS) $< -o $@
+
+$(TOP)/bin/makebmp: makebmp.c
+	$(HOSTCC) $(HOSTCFLAGS) $< -o $@
Binary files lib/microwindows/src/mwin/bmp/car8.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/car8.bmp differ
diff -urN lib/microwindows/src/mwin/bmp/car8.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/car8.c
--- lib/microwindows/src/mwin/bmp/car8.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/car8.c	2005-02-21 16:03:33.000000000 +0100
@@ -0,0 +1,438 @@
+/* Generated by convbmp*/
+#include "device.h"
+
+/* MWIMAGEHDR image_car8 converted from car8.bmp*/
+
+static MWPALENTRY palette[256] = {
+  RGBDEF(   0,   0,   0 ),	/* pal 0*/
+  RGBDEF( 165,   0,   0 ),	/* pal 1*/
+  RGBDEF( 132,   0,   8 ),	/* pal 2*/
+  RGBDEF( 140,   0,   8 ),	/* pal 3*/
+  RGBDEF(  16,  16,  16 ),	/* pal 4*/
+  RGBDEF(  24,  16,  16 ),	/* pal 5*/
+  RGBDEF(  41,  16,  16 ),	/* pal 6*/
+  RGBDEF(  49,   0,  16 ),	/* pal 7*/
+  RGBDEF(  66,   8,  16 ),	/* pal 8*/
+  RGBDEF(  90,   8,  16 ),	/* pal 9*/
+  RGBDEF(  16,  16,  24 ),	/* pal 10*/
+  RGBDEF(  16,  24,  24 ),	/* pal 11*/
+  RGBDEF(  24,  24,  24 ),	/* pal 12*/
+  RGBDEF(  49,  16,  24 ),	/* pal 13*/
+  RGBDEF(  74,  24,  24 ),	/* pal 14*/
+  RGBDEF(  99,  24,  24 ),	/* pal 15*/
+  RGBDEF( 132,   8,  24 ),	/* pal 16*/
+  RGBDEF(  16,  24,  33 ),	/* pal 17*/
+  RGBDEF(  41,  41,  33 ),	/* pal 18*/
+  RGBDEF(  49,  33,  33 ),	/* pal 19*/
+  RGBDEF(  74,  33,  33 ),	/* pal 20*/
+  RGBDEF(  99, 107,  33 ),	/* pal 21*/
+  RGBDEF( 107,  24,  33 ),	/* pal 22*/
+  RGBDEF( 115,  33,  33 ),	/* pal 23*/
+  RGBDEF( 132,  24,  33 ),	/* pal 24*/
+  RGBDEF( 140,  16,  33 ),	/* pal 25*/
+  RGBDEF( 156,   8,  33 ),	/* pal 26*/
+  RGBDEF( 156,  16,  33 ),	/* pal 27*/
+  RGBDEF(  33,  33,  41 ),	/* pal 28*/
+  RGBDEF(  41,  41,  41 ),	/* pal 29*/
+  RGBDEF( 107,  41,  41 ),	/* pal 30*/
+  RGBDEF( 140,  33,  41 ),	/* pal 31*/
+  RGBDEF(  33,  41,  49 ),	/* pal 32*/
+  RGBDEF(  33,  49,  49 ),	/* pal 33*/
+  RGBDEF(  41,  49,  49 ),	/* pal 34*/
+  RGBDEF(  74,  49,  49 ),	/* pal 35*/
+  RGBDEF( 140,  49,  49 ),	/* pal 36*/
+  RGBDEF( 148, 140,  49 ),	/* pal 37*/
+  RGBDEF( 148, 148,  49 ),	/* pal 38*/
+  RGBDEF(  49,  57,  57 ),	/* pal 39*/
+  RGBDEF(  49,  66,  57 ),	/* pal 40*/
+  RGBDEF(  90,  99,  57 ),	/* pal 41*/
+  RGBDEF( 107, 115,  57 ),	/* pal 42*/
+  RGBDEF( 132, 107,  57 ),	/* pal 43*/
+  RGBDEF(  49,  66,  66 ),	/* pal 44*/
+  RGBDEF(  57,  66,  66 ),	/* pal 45*/
+  RGBDEF(  90,  66,  66 ),	/* pal 46*/
+  RGBDEF( 123,  66,  66 ),	/* pal 47*/
+  RGBDEF( 140,  66,  66 ),	/* pal 48*/
+  RGBDEF(  66,  74,  74 ),	/* pal 49*/
+  RGBDEF(  74,  82,  74 ),	/* pal 50*/
+  RGBDEF(  90,  74,  74 ),	/* pal 51*/
+  RGBDEF( 140, 148,  74 ),	/* pal 52*/
+  RGBDEF( 156, 165,  74 ),	/* pal 53*/
+  RGBDEF(  74,  82,  82 ),	/* pal 54*/
+  RGBDEF(  74,  90,  82 ),	/* pal 55*/
+  RGBDEF( 115,  99,  82 ),	/* pal 56*/
+  RGBDEF( 123,  82,  82 ),	/* pal 57*/
+  RGBDEF( 140,  74,  82 ),	/* pal 58*/
+  RGBDEF(  57,  82,  90 ),	/* pal 59*/
+  RGBDEF(  66,  82,  90 ),	/* pal 60*/
+  RGBDEF(  66,  90,  90 ),	/* pal 61*/
+  RGBDEF(  66,  90, 107 ),	/* pal 62*/
+  RGBDEF(  66,  99, 115 ),	/* pal 63*/
+  RGBDEF(  66, 107, 123 ),	/* pal 64*/
+  RGBDEF(  74,  90,  90 ),	/* pal 65*/
+  RGBDEF(  82, 107, 115 ),	/* pal 66*/
+  RGBDEF(  82, 107, 123 ),	/* pal 67*/
+  RGBDEF(  82, 115, 123 ),	/* pal 68*/
+  RGBDEF(  82, 115, 140 ),	/* pal 69*/
+  RGBDEF(  90, 107, 107 ),	/* pal 70*/
+  RGBDEF(  90, 107, 115 ),	/* pal 71*/
+  RGBDEF(  90, 115, 123 ),	/* pal 72*/
+  RGBDEF(  99,  82,  90 ),	/* pal 73*/
+  RGBDEF(  99, 115, 107 ),	/* pal 74*/
+  RGBDEF(  99, 115, 115 ),	/* pal 75*/
+  RGBDEF( 107,  90,  90 ),	/* pal 76*/
+  RGBDEF( 107, 107, 115 ),	/* pal 77*/
+  RGBDEF( 115, 123, 115 ),	/* pal 78*/
+  RGBDEF( 131, 102,  94 ),	/* pal 79*/
+  RGBDEF( 123, 107, 123 ),	/* pal 80*/
+  RGBDEF( 156, 115, 123 ),	/* pal 81*/
+  RGBDEF(  99, 123, 132 ),	/* pal 82*/
+  RGBDEF(  99, 123, 140 ),	/* pal 83*/
+  RGBDEF( 107, 132, 132 ),	/* pal 84*/
+  RGBDEF( 123, 132, 132 ),	/* pal 85*/
+  RGBDEF( 139, 152, 111 ),	/* pal 86*/
+  RGBDEF( 148, 165, 132 ),	/* pal 87*/
+  RGBDEF( 123, 148, 140 ),	/* pal 88*/
+  RGBDEF( 156, 140, 140 ),	/* pal 89*/
+  RGBDEF(  82, 123, 148 ),	/* pal 90*/
+  RGBDEF(  99, 140, 148 ),	/* pal 91*/
+  RGBDEF( 107, 132, 148 ),	/* pal 92*/
+  RGBDEF( 107, 140, 148 ),	/* pal 93*/
+  RGBDEF( 132, 148, 148 ),	/* pal 94*/
+  RGBDEF(  82, 123, 156 ),	/* pal 95*/
+  RGBDEF(  99, 132, 156 ),	/* pal 96*/
+  RGBDEF( 107, 140, 156 ),	/* pal 97*/
+  RGBDEF( 132, 156, 156 ),	/* pal 98*/
+  RGBDEF( 123, 156, 165 ),	/* pal 99*/
+  RGBDEF( 148, 165, 165 ),	/* pal 100*/
+  RGBDEF(  99, 140, 173 ),	/* pal 101*/
+  RGBDEF( 115, 148, 173 ),	/* pal 102*/
+  RGBDEF( 123, 156, 181 ),	/* pal 103*/
+  RGBDEF( 132, 165, 181 ),	/* pal 104*/
+  RGBDEF( 148, 173, 181 ),	/* pal 105*/
+  RGBDEF( 107, 148, 189 ),	/* pal 106*/
+  RGBDEF( 115, 156, 189 ),	/* pal 107*/
+  RGBDEF( 132, 173, 189 ),	/* pal 108*/
+  RGBDEF( 123, 173, 198 ),	/* pal 109*/
+  RGBDEF( 140, 181, 198 ),	/* pal 110*/
+  RGBDEF( 123, 189, 206 ),	/* pal 111*/
+  RGBDEF( 132, 173, 206 ),	/* pal 112*/
+  RGBDEF( 156, 189, 206 ),	/* pal 113*/
+  RGBDEF( 140, 189, 214 ),	/* pal 114*/
+  RGBDEF( 123, 156, 222 ),	/* pal 115*/
+  RGBDEF( 123, 173, 222 ),	/* pal 116*/
+  RGBDEF( 140, 198, 231 ),	/* pal 117*/
+  RGBDEF( 156, 206, 231 ),	/* pal 118*/
+  RGBDEF( 156, 206, 239 ),	/* pal 119*/
+  RGBDEF( 165,   0,  24 ),	/* pal 120*/
+  RGBDEF( 198,   0,  24 ),	/* pal 121*/
+  RGBDEF( 173,   0,  33 ),	/* pal 122*/
+  RGBDEF( 181,   0,  33 ),	/* pal 123*/
+  RGBDEF( 206,   0,  33 ),	/* pal 124*/
+  RGBDEF( 214,   0,  41 ),	/* pal 125*/
+  RGBDEF( 222,   0,  41 ),	/* pal 126*/
+  RGBDEF( 231,   0,  41 ),	/* pal 127*/
+  RGBDEF( 231,   0,  49 ),	/* pal 128*/
+  RGBDEF( 165,   8,  24 ),	/* pal 129*/
+  RGBDEF( 173,   8,  33 ),	/* pal 130*/
+  RGBDEF( 198,   8,  41 ),	/* pal 131*/
+  RGBDEF( 214,   8,  41 ),	/* pal 132*/
+  RGBDEF( 222,   8,  41 ),	/* pal 133*/
+  RGBDEF( 222,   8,  49 ),	/* pal 134*/
+  RGBDEF( 239,   8,  49 ),	/* pal 135*/
+  RGBDEF( 173,  16,   0 ),	/* pal 136*/
+  RGBDEF( 173,  16,  33 ),	/* pal 137*/
+  RGBDEF( 165,  16,  41 ),	/* pal 138*/
+  RGBDEF( 206,  16,  41 ),	/* pal 139*/
+  RGBDEF( 222,  16,  41 ),	/* pal 140*/
+  RGBDEF( 231,  16,  41 ),	/* pal 141*/
+  RGBDEF( 181,  24,  33 ),	/* pal 142*/
+  RGBDEF( 165,  24,  41 ),	/* pal 143*/
+  RGBDEF( 206,  24,  41 ),	/* pal 144*/
+  RGBDEF( 247,  24,  41 ),	/* pal 145*/
+  RGBDEF( 189,  24,  49 ),	/* pal 146*/
+  RGBDEF( 222,  24,  49 ),	/* pal 147*/
+  RGBDEF( 206,  33,  41 ),	/* pal 148*/
+  RGBDEF( 239,  33,  41 ),	/* pal 149*/
+  RGBDEF( 181,  41,  33 ),	/* pal 150*/
+  RGBDEF( 165,  41,  49 ),	/* pal 151*/
+  RGBDEF( 214,  41,  57 ),	/* pal 152*/
+  RGBDEF( 189,  49,  49 ),	/* pal 153*/
+  RGBDEF( 165,  66,  66 ),	/* pal 154*/
+  RGBDEF( 206,  66,  66 ),	/* pal 155*/
+  RGBDEF( 189,  74,  66 ),	/* pal 156*/
+  RGBDEF( 181,  99,  37 ),	/* pal 157*/
+  RGBDEF( 173,  90,  66 ),	/* pal 158*/
+  RGBDEF( 189,  99,  74 ),	/* pal 159*/
+  RGBDEF( 214,  74,  74 ),	/* pal 160*/
+  RGBDEF( 222,  74,  74 ),	/* pal 161*/
+  RGBDEF( 206,  90,  82 ),	/* pal 162*/
+  RGBDEF( 165, 107,  99 ),	/* pal 163*/
+  RGBDEF( 181, 107,  99 ),	/* pal 164*/
+  RGBDEF( 222,  90,  82 ),	/* pal 165*/
+  RGBDEF( 222,  99,  74 ),	/* pal 166*/
+  RGBDEF( 222,  99,  90 ),	/* pal 167*/
+  RGBDEF( 231,  66,  66 ),	/* pal 168*/
+  RGBDEF( 239,  41,  57 ),	/* pal 169*/
+  RGBDEF( 239,  90,  82 ),	/* pal 170*/
+  RGBDEF( 247,  66,  74 ),	/* pal 171*/
+  RGBDEF( 247,  90,  90 ),	/* pal 172*/
+  RGBDEF( 255,  41,  66 ),	/* pal 173*/
+  RGBDEF( 255,  57,  74 ),	/* pal 174*/
+  RGBDEF( 255,  74,  82 ),	/* pal 175*/
+  RGBDEF( 255,  90,  82 ),	/* pal 176*/
+  RGBDEF( 255,  90,  90 ),	/* pal 177*/
+  RGBDEF( 255,  99,  82 ),	/* pal 178*/
+  RGBDEF( 255,  99,  99 ),	/* pal 179*/
+  RGBDEF( 181, 139,  78 ),	/* pal 180*/
+  RGBDEF( 198, 107, 107 ),	/* pal 181*/
+  RGBDEF( 222, 123, 123 ),	/* pal 182*/
+  RGBDEF( 222, 132, 115 ),	/* pal 183*/
+  RGBDEF( 247, 107,  99 ),	/* pal 184*/
+  RGBDEF( 247, 132, 115 ),	/* pal 185*/
+  RGBDEF( 255, 107, 107 ),	/* pal 186*/
+  RGBDEF( 255, 132, 115 ),	/* pal 187*/
+  RGBDEF( 255, 140, 123 ),	/* pal 188*/
+  RGBDEF( 222, 156, 132 ),	/* pal 189*/
+  RGBDEF( 239, 140, 132 ),	/* pal 190*/
+  RGBDEF( 255, 148, 140 ),	/* pal 191*/
+  RGBDEF( 255, 165, 140 ),	/* pal 192*/
+  RGBDEF( 198, 148, 148 ),	/* pal 193*/
+  RGBDEF( 173, 140, 156 ),	/* pal 194*/
+  RGBDEF( 193, 181,  65 ),	/* pal 195*/
+  RGBDEF( 189, 185,  90 ),	/* pal 196*/
+  RGBDEF( 208, 208,  90 ),	/* pal 197*/
+  RGBDEF( 230, 226,  82 ),	/* pal 198*/
+  RGBDEF( 243, 251,  82 ),	/* pal 199*/
+  RGBDEF( 255, 255, 107 ),	/* pal 200*/
+  RGBDEF( 255, 255, 115 ),	/* pal 201*/
+  RGBDEF( 231, 222, 123 ),	/* pal 202*/
+  RGBDEF( 247, 255, 123 ),	/* pal 203*/
+  RGBDEF( 247, 173, 148 ),	/* pal 204*/
+  RGBDEF( 255, 173, 148 ),	/* pal 205*/
+  RGBDEF( 255, 189, 148 ),	/* pal 206*/
+  RGBDEF( 165, 173, 156 ),	/* pal 207*/
+  RGBDEF( 181, 198, 156 ),	/* pal 208*/
+  RGBDEF( 247, 181, 156 ),	/* pal 209*/
+  RGBDEF( 192, 186, 170 ),	/* pal 210*/
+  RGBDEF( 185, 185, 197 ),	/* pal 211*/
+  RGBDEF( 173, 206, 222 ),	/* pal 212*/
+  RGBDEF( 198, 214, 214 ),	/* pal 213*/
+  RGBDEF( 222, 181, 181 ),	/* pal 214*/
+  RGBDEF( 231, 206, 206 ),	/* pal 215*/
+  RGBDEF( 255, 181, 156 ),	/* pal 216*/
+  RGBDEF( 255, 231, 156 ),	/* pal 217*/
+  RGBDEF( 255, 181, 165 ),	/* pal 218*/
+  RGBDEF( 255, 181, 173 ),	/* pal 219*/
+  RGBDEF( 255, 189, 173 ),	/* pal 220*/
+  RGBDEF( 255, 206, 181 ),	/* pal 221*/
+  RGBDEF( 255, 214, 198 ),	/* pal 222*/
+  RGBDEF( 255, 222, 202 ),	/* pal 223*/
+  RGBDEF( 255, 231, 214 ),	/* pal 224*/
+  RGBDEF( 255, 247, 222 ),	/* pal 225*/
+  RGBDEF( 165, 206, 231 ),	/* pal 226*/
+  RGBDEF( 165, 214, 239 ),	/* pal 227*/
+  RGBDEF( 181, 222, 239 ),	/* pal 228*/
+  RGBDEF( 206, 222, 239 ),	/* pal 229*/
+  RGBDEF( 222, 231, 239 ),	/* pal 230*/
+  RGBDEF( 255, 247, 239 ),	/* pal 231*/
+  RGBDEF( 231, 239, 247 ),	/* pal 232*/
+  RGBDEF( 165, 247, 255 ),	/* pal 233*/
+  RGBDEF( 173, 222, 255 ),	/* pal 234*/
+  RGBDEF( 189, 239, 255 ),	/* pal 235*/
+  RGBDEF( 206, 239, 255 ),	/* pal 236*/
+  RGBDEF( 222, 247, 255 ),	/* pal 237*/
+  RGBDEF( 247, 255, 255 ),	/* pal 238*/
+  RGBDEF( 255, 255, 255 ),	/* pal 239*/
+  RGBDEF(   0,   0,   0 ),	/* pal 240*/
+  RGBDEF( 191,   0,   0 ),	/* pal 241*/
+  RGBDEF(   0, 191,   0 ),	/* pal 242*/
+  RGBDEF( 191, 191,   0 ),	/* pal 243*/
+  RGBDEF(   0,   0, 191 ),	/* pal 244*/
+  RGBDEF( 191,   0, 191 ),	/* pal 245*/
+  RGBDEF(   0, 191, 191 ),	/* pal 246*/
+  RGBDEF( 192, 192, 192 ),	/* pal 247*/
+  RGBDEF( 128, 128, 128 ),	/* pal 248*/
+  RGBDEF( 255,   0,   0 ),	/* pal 249*/
+  RGBDEF(   0, 255,   0 ),	/* pal 250*/
+  RGBDEF( 255, 255,   0 ),	/* pal 251*/
+  RGBDEF(   0,   0, 255 ),	/* pal 252*/
+  RGBDEF( 255,   0, 255 ),	/* pal 253*/
+  RGBDEF(   0, 255, 255 ),	/* pal 254*/
+  RGBDEF( 255, 255, 255 ),	/* pal 255*/
+};
+
+static MWUCHAR imagebits[] = {
+54,54,54,55,54,54,54,54,54,55,54,55,54,55,54,55,54,54,54,55,55,54,54,55,54,54,54,49,55,54,54,54,54,54,54,54,54,54,54,55,54,55,54,54,55,54,55,54,54,54,54,54,54,54,54,49,55,54,54,54,54,55,54,54,54,55,54,55,55,54,54,54,54,55,54,54,54,54,54,54,54,54,54,54,54,54,54,55,54,54,54,55,54,54,54,54,55,55,54,54,54,55,54,55,55,55,54,55,60,54,55,54,54,54,54,54,54,54,54,55,54,54,54,49,54,54,54,54,50,55,54,49,54,54,54,50,54,55,54,50,54,49,55,54,49,54,54,55,55,54,54,54,49,55,54,55,54,55,54,54,54,54,50,54,54,54,54,49,50,54,49,54,49,54,54,49,54,49,54,49,54,54,49,54,54,49,49,54,54,54,54,49,54,49,49,49,54,49,49,54,49,49,49,54,49,54,49,54,49,54,54,54,49,54,54,49,54,54,49,49,54,54,49,54,54,54,49,54,54,49,59,49,59,49,49,49,54,49,49,54,54,49,49,49,59,49,54,49,49,59,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,45,49,49,49,49,49,45,49,49,49,49,44,49,45,49,45,49,49,49,45,49,49,45,45,49,49,45,
+54,54,54,54,55,54,54,54,55,54,54,54,55,54,55,54,54,55,54,54,49,55,54,54,54,54,54,54,54,54,54,54,54,55,55,54,54,54,55,54,54,54,54,54,54,54,55,54,55,54,55,49,55,54,54,54,59,54,54,54,54,54,54,54,54,54,54,54,49,55,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,55,54,54,54,54,49,54,55,54,54,54,54,49,55,54,54,54,54,54,54,54,54,54,54,54,54,49,50,55,54,54,54,54,54,50,54,49,49,54,54,54,54,49,54,49,54,54,54,49,54,49,54,54,55,49,49,49,54,49,54,49,54,49,54,49,49,54,54,54,49,54,49,54,49,54,54,49,54,54,49,50,49,54,49,54,49,54,49,54,49,54,49,54,49,49,54,54,49,54,49,54,54,54,54,49,54,49,54,54,54,49,54,49,54,54,49,54,54,49,54,49,54,49,54,54,49,54,54,49,49,49,49,49,54,59,49,54,54,49,54,49,59,49,49,49,59,49,49,49,54,49,49,59,49,49,49,49,59,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,45,49,45,49,49,49,49,49,44,49,49,49,45,49,49,49,45,49,49,49,45,49,45,49,45,45,45,49,45,45,45,
+54,54,55,55,54,55,54,55,54,54,55,54,54,54,54,54,55,54,54,55,54,55,54,54,54,55,54,54,54,55,54,54,55,49,55,55,54,54,54,55,54,55,54,54,55,54,54,54,55,49,59,54,54,55,54,54,55,49,54,54,54,54,54,55,54,54,55,49,59,54,54,55,54,55,54,54,54,54,54,55,54,54,54,54,54,54,54,54,54,54,54,55,54,54,54,54,55,49,54,55,54,55,54,55,55,54,54,54,54,55,54,54,54,54,55,49,54,54,54,54,54,49,54,54,49,54,49,54,54,54,54,55,50,54,55,54,54,54,49,54,55,49,54,54,54,49,49,54,54,54,55,54,54,54,54,54,54,54,54,54,54,49,54,49,54,54,49,54,49,50,49,50,49,54,49,49,54,49,54,49,54,54,49,54,54,49,54,54,50,49,54,49,54,49,49,49,49,49,54,54,49,49,49,54,49,54,49,49,54,49,54,54,49,54,49,49,50,49,49,49,49,49,54,54,54,49,49,49,54,49,49,49,49,49,49,54,49,49,49,49,59,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,45,49,45,49,45,49,45,49,49,49,45,49,49,49,49,49,45,45,49,45,45,49,45,45,45,49,45,49,45,45,45,49,45,45,49,49,45,
+55,54,54,54,54,54,55,54,54,54,54,54,55,54,54,54,54,54,54,54,54,54,54,55,54,54,54,54,55,54,54,54,54,54,49,54,54,54,54,54,54,54,55,49,54,54,54,54,54,54,54,54,54,49,54,54,54,55,49,54,49,55,54,54,55,54,54,54,55,54,54,54,55,49,59,54,55,55,49,59,54,55,54,59,54,55,55,54,54,55,49,54,54,55,54,54,54,54,54,54,54,54,54,54,54,54,54,55,54,55,54,54,54,54,54,54,54,49,49,54,54,54,54,54,54,54,54,49,54,49,54,49,50,49,49,54,50,55,50,54,49,54,50,49,55,49,54,49,54,49,49,54,49,54,49,54,49,54,54,54,54,49,54,49,54,49,54,50,49,49,54,49,49,49,54,49,49,54,49,54,49,54,54,49,54,54,49,54,49,49,49,54,49,54,49,54,49,54,49,54,49,54,49,54,49,49,54,54,49,54,49,54,49,54,49,54,49,54,49,54,49,54,49,49,54,54,49,54,54,49,54,59,49,59,54,49,59,49,49,49,49,49,59,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,45,49,49,49,45,49,49,49,45,49,45,49,45,49,45,49,49,45,49,45,49,49,45,49,45,49,45,45,49,45,49,45,45,49,45,49,45,45,49,45,45,45,45,
+54,54,54,54,54,54,54,54,55,54,55,55,54,54,55,54,54,55,54,54,55,54,54,49,55,54,54,55,54,54,55,54,49,55,54,54,54,54,54,55,54,54,54,54,54,54,55,54,54,54,54,55,54,55,54,49,55,55,54,54,59,49,54,54,54,54,54,54,54,54,54,54,54,54,55,54,49,54,54,54,54,54,54,54,54,54,49,55,54,54,54,54,54,49,55,54,55,54,54,55,49,55,54,54,54,55,54,54,54,54,54,55,54,54,55,54,54,54,54,54,54,49,50,54,54,54,49,54,54,54,54,50,54,50,54,54,54,49,54,49,54,54,54,54,49,54,54,54,54,54,54,54,54,54,49,54,54,49,54,54,54,49,54,49,49,54,49,49,49,54,50,49,54,54,54,54,49,49,54,49,49,49,54,54,49,49,54,49,50,54,54,49,54,49,54,54,49,54,49,54,49,54,54,49,54,49,54,49,49,54,49,54,54,49,54,49,54,49,49,54,49,49,49,49,49,49,54,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,45,49,45,49,45,49,49,45,49,45,49,45,49,45,49,45,49,45,49,45,45,45,49,45,45,49,45,49,45,45,45,49,45,45,45,45,45,45,
+54,55,54,54,55,54,55,54,54,54,54,54,54,54,54,54,54,54,54,54,49,55,54,54,54,49,55,49,55,54,54,54,55,54,54,54,54,55,54,54,54,54,49,55,54,54,54,54,49,54,54,54,54,49,54,54,54,49,49,55,54,54,54,54,54,54,54,54,54,59,54,49,55,54,54,55,54,54,54,54,54,54,54,54,54,54,54,59,54,55,54,49,55,54,54,49,54,54,54,49,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,49,54,54,54,54,54,50,54,54,50,54,50,54,54,54,49,54,50,49,54,54,54,50,54,49,54,49,54,49,49,54,50,54,50,54,49,54,49,54,54,49,54,54,49,54,49,54,49,54,54,49,50,50,50,49,49,54,54,49,50,49,49,54,50,49,49,54,49,50,49,54,49,49,54,49,49,54,49,54,49,49,54,49,54,49,54,49,50,49,54,49,54,49,54,49,54,49,49,54,49,49,49,49,50,49,49,49,49,49,49,49,49,49,49,49,59,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,45,45,49,49,49,49,49,49,49,45,49,49,45,45,49,49,45,49,45,45,49,45,49,45,45,45,45,45,49,45,45,49,45,45,45,45,45,45,45,45,49,45,45,45,45,45,45,45,
+54,49,55,54,54,54,49,55,54,54,54,54,55,54,54,54,54,54,54,55,54,54,54,54,54,55,49,54,54,55,54,54,54,54,54,55,54,49,54,54,54,54,54,54,54,55,54,54,54,54,54,54,54,54,54,54,54,54,54,49,54,49,54,54,55,54,54,54,54,54,54,54,54,54,54,54,55,49,54,55,54,54,55,49,54,54,54,55,49,54,54,54,54,54,54,54,54,54,55,54,54,55,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,49,54,54,54,49,54,54,49,54,54,54,49,54,55,49,54,54,50,50,54,54,54,49,54,54,49,54,54,49,54,54,49,54,49,54,54,54,50,50,54,49,54,49,54,49,54,49,49,50,49,49,49,50,49,49,49,49,49,49,50,49,49,50,50,49,49,49,54,49,54,49,49,50,49,49,49,49,49,54,49,49,49,49,49,49,49,54,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,45,49,49,49,49,49,45,45,45,45,49,45,45,49,45,49,45,45,49,45,49,45,45,45,49,45,45,49,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+55,49,54,54,54,55,49,54,55,54,54,54,54,55,55,54,50,55,50,49,55,54,54,55,54,54,54,50,49,54,54,54,54,50,54,54,54,55,49,54,54,55,55,54,54,54,54,54,55,54,54,54,54,54,55,49,54,55,49,54,54,54,55,54,54,54,55,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,55,55,49,54,55,54,55,49,54,54,49,54,49,54,54,54,54,54,55,49,54,50,54,49,54,54,54,54,49,54,54,50,49,54,50,49,54,54,54,54,49,54,50,54,55,49,50,54,54,49,54,50,54,50,49,54,49,54,54,49,54,50,49,54,54,50,49,54,49,54,49,49,50,49,50,50,50,49,49,49,50,49,50,49,50,50,49,50,49,49,49,50,49,49,50,49,49,50,49,50,50,49,50,49,50,49,54,49,49,49,50,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,45,49,49,49,49,49,45,49,45,45,49,49,49,49,49,49,49,45,49,45,45,45,45,49,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,49,45,45,45,45,45,45,45,45,45,
+49,55,54,54,54,54,55,54,54,54,50,55,50,49,49,55,50,54,49,54,49,55,54,49,54,50,54,54,54,54,54,49,50,54,49,55,54,54,54,54,54,54,54,50,54,55,54,54,54,49,55,50,54,54,54,54,54,49,55,55,54,54,49,54,54,54,54,55,54,55,54,59,49,55,54,54,54,55,54,54,54,54,54,54,54,54,54,54,49,49,49,49,49,55,49,54,54,54,54,55,54,54,54,54,54,54,50,54,50,54,50,55,54,54,54,50,54,54,54,54,49,54,54,54,54,49,54,49,54,49,54,49,49,54,49,49,54,49,54,54,49,54,54,49,54,49,49,54,49,54,49,50,50,49,49,50,50,49,54,49,50,49,49,49,49,49,50,49,49,50,49,50,49,49,49,49,49,50,49,49,49,49,49,49,49,49,49,49,50,49,50,49,49,50,49,49,49,49,49,50,49,49,49,50,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,45,49,45,45,49,49,49,45,49,45,49,45,49,49,49,45,49,45,49,49,49,49,49,49,45,49,49,49,45,49,45,49,49,49,49,49,45,45,45,45,45,45,45,45,45,49,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,
+54,54,55,54,55,55,49,55,54,54,49,55,49,55,54,49,55,54,55,54,54,54,49,55,49,55,54,54,55,50,54,54,54,54,54,49,55,54,55,54,54,54,50,54,50,49,55,54,54,54,55,49,54,54,55,49,55,55,49,50,49,55,54,54,55,54,54,49,54,54,54,54,54,54,49,54,54,49,55,49,55,54,54,49,49,55,49,54,54,54,55,54,54,54,54,54,54,54,49,54,49,55,54,54,49,54,54,49,54,49,54,49,50,54,50,49,50,50,50,54,50,54,54,54,50,50,49,50,54,54,54,54,54,50,50,54,54,54,49,50,50,50,49,50,50,50,50,50,50,50,49,50,49,50,49,50,49,50,50,50,49,50,50,50,49,50,49,49,50,49,50,49,49,49,49,49,49,49,49,50,49,49,49,49,49,49,49,49,49,49,49,49,50,49,45,50,49,45,50,49,49,49,50,45,50,50,49,49,49,49,49,49,49,49,49,49,49,49,49,49,45,49,49,49,45,49,49,45,49,49,45,45,49,49,49,49,49,45,49,45,49,49,45,49,45,49,49,45,45,49,45,45,45,45,49,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,39,45,45,45,
+54,54,49,55,49,49,54,54,54,55,55,49,55,49,55,49,55,49,54,55,49,55,49,49,55,50,49,50,49,55,50,55,50,50,49,55,49,50,49,54,55,50,55,49,54,54,49,54,55,49,49,54,55,49,49,55,49,49,55,49,49,54,55,54,49,54,54,54,54,55,54,55,54,55,54,55,49,54,49,54,54,54,55,54,54,54,54,54,55,49,49,54,49,54,55,55,54,54,54,55,49,50,54,55,54,50,54,54,54,54,50,54,50,50,54,50,54,54,50,50,49,50,49,50,49,50,50,49,50,50,50,49,50,49,50,49,50,49,50,50,49,49,50,49,49,50,49,50,45,50,50,49,50,50,49,50,49,49,49,49,49,50,45,49,49,49,50,49,45,49,49,49,49,49,49,49,49,50,45,49,49,49,49,49,49,50,50,45,49,49,49,49,49,45,50,45,49,49,45,49,45,50,45,50,45,50,45,49,49,45,49,45,49,45,45,49,45,45,45,45,49,45,45,45,49,45,45,45,45,45,49,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,44,45,45,45,45,45,45,45,45,45,45,45,45,45,45,44,45,
+55,55,54,55,55,55,55,55,55,49,55,49,54,54,55,49,55,49,55,49,55,49,55,49,49,49,54,55,55,49,50,50,49,55,49,54,49,54,50,50,49,49,50,54,49,54,54,49,54,54,54,54,49,55,55,49,54,55,49,55,54,49,49,54,54,54,54,55,49,54,49,54,54,49,54,54,54,55,54,55,49,55,49,55,49,55,49,54,49,55,49,54,55,49,49,49,54,54,49,49,50,49,50,49,49,49,50,50,49,50,50,49,49,49,49,50,49,49,49,50,50,50,50,50,50,49,50,49,50,49,50,49,50,50,50,50,49,49,49,50,50,50,50,50,50,49,50,50,50,49,50,49,49,49,50,45,50,49,49,49,50,49,50,49,50,45,50,50,50,45,50,45,49,49,49,45,45,45,49,49,45,49,45,49,45,45,45,50,45,45,45,45,49,45,49,45,45,50,45,49,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,44,45,45,45,45,45,45,45,45,45,45,45,45,45,44,45,45,45,39,39,39,45,39,
+49,49,55,49,55,49,55,49,55,50,49,49,55,55,49,55,49,49,55,49,49,50,49,50,55,49,54,49,49,54,49,49,55,49,54,50,54,49,54,54,50,49,54,49,55,50,49,55,54,49,54,49,55,49,49,55,49,55,49,49,54,54,55,55,54,54,49,49,55,55,54,49,55,54,54,49,55,54,49,49,55,49,49,49,49,49,49,49,54,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,50,49,49,49,50,50,50,49,50,49,49,49,49,49,45,50,49,49,49,50,45,50,45,50,50,45,50,45,50,50,50,45,45,50,45,50,45,50,45,50,45,50,45,46,49,49,45,50,45,45,50,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,40,45,45,45,45,45,45,45,40,45,45,40,45,45,45,45,45,45,45,45,45,45,45,40,45,45,39,45,39,45,39,45,45,45,45,45,45,45,45,45,45,45,45,45,39,45,45,45,45,40,45,45,45,45,45,45,45,44,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,44,45,45,45,45,45,45,45,44,45,45,45,44,45,45,39,45,45,45,44,39,44,39,45,44,39,45,39,45,44,45,45,39,39,45,45,45,44,45,44,
+49,49,55,49,49,50,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,55,49,49,55,50,54,54,49,50,49,50,49,50,49,50,50,54,49,54,49,54,49,49,54,49,49,54,50,49,49,49,49,49,49,49,49,49,49,49,49,49,49,55,49,55,49,49,49,54,54,49,49,55,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,45,49,49,45,49,49,49,49,45,49,49,49,45,45,49,45,50,45,49,49,45,50,45,50,45,49,49,45,50,45,49,49,45,40,50,40,50,45,45,45,50,40,45,45,45,45,45,40,45,45,45,40,45,45,45,45,45,45,45,45,40,45,45,40,45,40,40,39,45,45,45,45,45,40,45,40,45,45,45,39,45,39,39,45,45,39,45,39,40,45,45,39,45,39,39,45,45,39,40,39,45,45,39,45,45,45,45,45,39,45,45,45,39,45,39,45,45,45,45,45,39,45,45,39,45,45,39,39,39,45,39,45,39,45,44,44,44,45,45,45,45,44,45,45,45,45,45,45,45,44,45,44,45,45,45,44,45,45,39,39,45,45,45,44,45,39,39,45,44,45,45,44,45,45,44,39,45,39,39,39,45,45,39,44,44,39,39,44,39,44,39,44,39,44,39,44,39,44,45,39,39,44,44,39,39,39,39,39,
+49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,50,49,49,50,49,50,49,50,50,50,49,50,49,49,50,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,55,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,45,49,49,49,49,49,45,49,49,45,49,49,45,45,49,49,45,45,49,40,49,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,40,49,45,45,45,45,45,45,45,45,45,40,45,45,45,45,40,45,45,45,39,45,45,45,40,45,45,45,45,39,45,45,45,45,45,45,40,40,40,39,45,45,40,45,45,39,45,39,45,45,40,39,45,45,45,40,39,45,45,39,45,45,45,39,45,45,39,45,39,45,39,45,39,45,39,44,45,45,45,39,45,45,39,45,39,45,39,39,45,39,39,45,45,39,45,45,39,39,45,39,45,45,45,45,45,44,45,45,45,45,44,45,45,45,45,45,45,45,45,45,45,44,45,45,45,44,45,44,39,44,44,45,39,44,44,45,39,44,45,39,44,39,39,44,39,44,44,44,44,39,39,39,39,39,39,44,39,39,39,39,39,39,39,44,39,39,39,39,39,39,39,44,39,39,39,39,
+49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,50,49,50,50,49,50,49,50,49,50,49,49,49,49,49,50,49,50,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,45,49,49,49,49,49,49,49,49,49,49,49,45,49,49,49,49,49,49,49,49,49,45,49,45,45,49,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,40,45,45,45,45,45,45,45,45,45,45,40,39,45,45,40,45,45,45,45,45,40,45,45,45,45,45,40,39,45,45,45,39,45,40,40,45,45,40,40,40,39,45,39,40,39,40,40,45,39,40,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,45,39,39,39,45,39,39,39,39,39,39,39,45,39,44,45,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,45,39,44,45,39,44,44,44,45,44,39,45,44,44,44,44,44,44,45,44,44,44,39,44,45,44,39,44,45,39,44,39,44,39,44,39,39,39,44,39,44,39,39,34,39,44,34,44,44,44,44,39,44,44,34,39,39,44,44,44,39,44,39,44,44,44,44,39,44,34,39,39,44,34,34,
+49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,50,49,49,49,49,49,49,49,49,49,49,49,49,50,50,49,50,50,49,49,49,49,49,49,50,49,50,50,49,49,49,49,49,49,49,49,49,45,49,49,49,49,49,45,49,49,49,45,49,45,49,45,45,49,45,45,45,49,45,45,45,49,45,45,45,45,45,49,45,45,45,45,45,45,45,45,45,45,45,39,40,39,45,40,45,40,40,40,40,39,40,39,40,45,44,45,39,45,40,45,39,40,40,45,39,39,40,39,45,39,39,39,40,45,45,40,45,39,39,40,39,40,39,39,45,39,39,45,39,40,45,39,39,40,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,44,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,44,39,39,44,39,39,44,45,39,44,44,44,44,39,44,44,44,44,44,39,39,44,39,39,44,39,44,39,45,39,39,44,44,39,44,44,44,44,44,44,39,39,34,44,44,39,44,34,44,34,34,34,34,34,34,34,44,34,44,34,34,34,44,34,34,34,34,34,34,39,34,34,34,34,34,34,34,
+49,45,49,49,45,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,50,40,50,49,40,45,50,45,50,45,50,45,45,45,45,45,49,45,49,45,45,45,45,45,49,45,45,45,45,45,45,45,49,45,45,45,45,45,45,49,45,45,45,45,45,45,45,45,40,45,45,45,39,45,40,40,40,45,39,39,40,39,39,39,39,39,40,39,40,39,39,39,40,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,44,39,39,39,39,39,39,39,39,39,39,39,39,39,44,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,44,39,39,39,39,39,39,39,39,39,39,34,39,39,34,39,39,39,34,39,34,39,34,39,39,39,39,44,34,39,39,39,39,39,39,34,39,39,39,39,39,44,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,34,34,39,34,39,39,39,39,44,39,39,39,44,39,39,39,44,44,44,44,44,39,44,44,44,45,45,39,45,39,44,39,44,39,44,39,39,39,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,
+49,49,45,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,40,49,49,49,49,40,49,49,40,49,49,49,45,40,50,45,45,45,50,40,45,40,40,45,40,40,45,40,39,40,39,40,40,40,40,40,39,40,40,40,40,40,45,45,45,40,45,45,45,45,45,45,40,40,45,44,45,45,40,45,45,44,45,40,40,40,39,39,39,39,39,39,39,39,39,39,39,39,34,39,39,34,39,39,39,34,39,39,39,39,39,39,39,39,39,39,39,34,39,39,39,39,34,39,34,39,39,39,39,34,39,39,39,34,39,39,39,39,39,39,34,39,34,39,34,39,34,39,39,39,34,39,39,39,39,39,34,39,39,34,39,34,39,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,39,34,34,34,34,34,34,34,34,34,39,34,34,34,34,39,39,39,34,34,34,34,34,34,34,34,34,34,39,34,39,34,34,39,39,34,34,34,34,34,34,39,34,34,34,34,34,34,34,39,34,34,39,34,39,39,39,39,39,39,39,34,44,34,39,39,39,39,34,34,34,39,34,39,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,32,34,34,32,34,34,34,34,34,34,34,32,34,34,34,32,34,34,34,34,34,34,34,34,34,
+49,45,49,45,45,49,45,49,45,45,49,49,40,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,45,45,45,45,45,39,40,39,39,39,39,39,39,34,34,34,34,34,34,34,29,34,29,29,28,34,29,33,28,28,28,33,28,28,28,28,28,28,28,28,28,28,28,33,28,28,28,28,28,28,28,28,28,28,28,28,32,34,28,28,32,28,28,32,28,28,32,32,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,32,18,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,18,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,17,28,17,28,17,28,17,28,17,17,17,28,17,28,17,17,17,28,17,17,17,28,17,17,17,17,17,12,28,17,12,28,17,12,28,17,17,17,17,12,17,12,17,17,12,17,17,12,28,17,17,17,17,28,17,12,28,17,17,28,17,17,17,17,17,11,11,10,12,11,10,10,12,10,10,10,12,12,12,12,17,12,12,12,10,12,11,11,10,11,10,12,11,12,12,17,17,17,28,17,28,28,17,28,17,28,28,28,28,28,28,28,28,28,28,29,29,32,32,34,34,28,34,34,32,29,32,32,34,32,29,28,34,
+49,49,45,49,49,49,49,49,49,49,49,49,49,49,49,45,40,39,39,34,34,34,29,29,28,28,28,28,12,17,17,12,12,12,12,11,11,10,10,11,10,4,11,10,12,10,4,11,12,10,11,10,10,4,10,4,10,4,10,4,10,4,10,4,10,4,11,10,12,11,12,11,17,12,11,17,12,17,12,12,17,11,4,10,4,10,10,4,11,10,4,10,11,10,4,11,10,4,11,10,4,11,10,10,4,11,10,10,10,4,10,4,11,4,10,10,4,10,10,10,4,4,10,4,10,10,4,10,11,4,10,10,4,10,10,10,4,10,4,10,4,4,10,4,10,4,10,4,12,10,4,10,4,10,4,12,4,10,10,10,4,10,4,10,4,10,4,10,4,10,10,4,10,10,4,10,4,10,4,10,10,4,10,4,12,10,4,4,10,4,10,4,10,4,10,4,10,4,4,11,4,10,10,4,4,10,4,4,10,10,4,10,11,4,10,10,12,4,10,4,11,4,10,5,10,4,11,11,10,4,10,10,4,10,4,11,10,10,4,10,4,10,12,17,10,10,12,17,12,17,11,17,17,17,17,17,17,17,17,17,12,10,10,10,10,10,11,10,4,10,10,10,11,4,10,10,10,10,5,10,11,10,10,11,10,10,10,10,10,10,17,17,17,13,28,17,29,29,28,28,28,28,28,32,29,28,34,28,
+45,45,49,45,40,40,40,40,39,29,29,28,17,12,10,4,10,4,10,4,4,4,4,4,4,4,4,4,10,4,4,10,4,10,4,10,4,10,11,4,10,11,10,10,4,10,11,4,10,11,4,10,4,11,10,11,4,10,4,11,10,11,10,11,10,11,11,17,17,12,17,12,12,17,12,11,17,12,17,17,12,18,17,12,11,10,11,10,10,10,10,11,10,4,11,10,11,10,10,11,10,10,4,10,11,10,4,11,4,10,11,10,10,11,10,4,10,10,4,10,4,10,10,10,12,10,10,10,5,10,10,4,12,10,4,10,12,10,10,10,12,10,10,10,12,10,10,10,10,10,12,10,10,5,10,10,10,12,4,12,10,12,10,10,10,12,10,12,10,4,10,12,10,4,12,10,10,10,10,12,4,10,10,10,4,10,10,12,10,12,4,11,10,12,10,10,10,11,10,10,10,11,4,10,10,10,10,11,10,11,10,5,10,10,4,10,10,11,12,11,10,4,11,10,11,10,10,10,4,11,10,10,11,10,10,10,10,10,10,4,28,32,17,17,12,17,17,11,17,12,12,12,12,12,12,17,17,12,17,17,17,17,12,11,10,11,10,10,11,12,10,11,10,10,11,4,12,10,10,11,10,4,11,10,4,11,10,12,10,12,12,12,12,17,17,18,17,17,29,28,28,28,28,28,28,28,28,32,
+45,45,40,35,40,40,29,29,33,18,17,12,12,12,10,12,10,10,4,10,10,10,11,10,10,12,11,10,4,11,10,10,11,4,11,4,11,4,10,11,4,10,11,4,10,11,4,10,11,4,10,11,11,4,10,4,10,11,10,10,11,10,10,11,17,28,17,17,11,17,17,17,17,12,11,11,17,17,17,17,17,17,12,17,28,11,12,10,11,10,11,10,10,11,10,12,4,10,11,4,10,11,10,11,10,10,10,4,11,10,10,12,10,4,10,10,10,10,12,10,12,4,12,10,4,10,12,10,10,10,12,10,10,12,10,10,10,12,10,10,4,10,10,4,10,10,12,10,12,10,12,10,12,10,12,10,12,10,12,10,5,10,12,12,10,10,4,10,12,10,12,10,10,12,10,4,12,12,4,10,12,10,12,10,12,10,12,10,4,10,10,10,4,10,10,4,10,10,10,10,10,10,12,10,10,12,10,10,10,5,10,10,10,10,12,10,10,10,10,10,10,12,10,11,4,10,11,10,10,10,11,10,10,11,10,12,4,4,10,44,45,32,10,17,17,11,17,12,17,17,17,17,17,17,17,17,17,17,12,17,12,12,28,17,12,12,11,11,10,11,10,4,11,10,11,10,11,10,11,4,10,10,5,10,10,10,10,10,12,12,12,17,18,17,17,17,28,17,17,28,28,28,28,28,28,28,28,28,
+40,40,40,40,39,40,29,29,29,29,18,17,12,12,12,10,12,4,10,12,4,10,10,4,12,10,10,10,10,10,12,4,10,10,10,10,5,11,4,10,10,11,10,10,11,10,10,11,5,10,4,10,10,10,11,10,4,10,4,11,5,11,11,28,17,11,11,11,11,240,240,240,11,11,33,33,12,4,240,240,240,11,11,11,12,28,17,12,11,11,10,11,10,4,10,10,11,11,10,10,11,4,10,10,4,10,12,10,10,12,10,10,10,12,10,12,10,12,10,5,10,12,10,12,10,12,10,5,10,12,10,12,10,12,12,12,12,5,12,12,12,12,12,12,10,12,4,12,10,12,12,10,12,12,10,12,10,12,10,10,12,10,10,12,10,12,10,12,12,10,10,12,10,5,10,12,10,10,12,10,12,10,10,12,10,12,10,10,12,10,12,10,12,10,10,12,10,10,10,12,10,4,10,12,4,10,5,10,12,10,12,10,4,12,10,10,12,4,12,11,4,10,10,10,11,10,4,11,11,11,10,11,4,10,10,240,17,44,59,45,12,10,12,17,12,12,17,11,4,240,240,240,240,240,240,240,240,4,17,17,17,17,12,17,17,17,10,10,11,10,11,10,10,11,10,11,10,10,10,10,10,10,10,10,10,12,12,12,12,17,17,17,17,17,28,17,28,28,17,28,17,28,28,28,28,28,28,28,
+40,40,35,40,39,39,39,29,29,29,33,18,28,12,12,12,12,12,12,10,10,12,10,10,10,10,4,12,10,12,4,10,10,5,10,4,10,4,10,10,4,12,10,10,5,10,10,4,10,11,10,11,5,11,4,10,11,10,11,10,11,17,28,12,11,11,4,4,11,49,94,113,212,229,235,228,228,212,105,78,44,10,4,4,11,17,28,17,17,10,11,10,11,10,11,11,10,10,10,12,10,10,12,10,12,10,10,10,5,10,12,4,12,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,5,12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,12,12,12,12,12,10,12,10,12,10,12,12,4,12,12,12,4,12,12,12,10,5,10,12,10,12,4,12,12,10,5,10,12,12,10,10,12,12,10,10,4,10,12,10,12,10,10,12,10,12,10,10,12,10,12,4,10,10,10,10,4,10,4,10,11,4,11,44,49,60,34,10,17,12,17,12,17,11,4,4,17,49,74,85,94,94,89,78,65,33,4,240,11,17,17,12,12,28,17,12,10,11,10,12,10,10,10,4,10,10,10,10,10,12,12,12,12,12,17,12,17,17,13,17,17,17,29,17,29,17,28,28,28,17,28,28,28,28,28,28,
+39,40,39,39,39,39,19,39,18,29,29,29,28,28,12,12,12,12,12,12,12,12,12,12,5,12,12,12,12,12,12,5,12,10,12,12,10,12,12,5,12,10,4,10,10,5,10,10,10,10,10,4,11,10,10,11,4,11,10,4,28,17,11,17,4,4,49,103,255,236,229,118,107,97,96,96,102,109,228,229,237,236,93,33,4,12,11,17,34,28,11,11,10,11,10,4,10,12,11,11,12,10,10,12,10,12,12,12,12,12,12,12,12,5,12,12,12,5,12,12,12,12,12,5,12,12,12,12,5,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,5,12,12,12,12,12,12,5,12,12,12,12,12,12,12,12,12,12,12,5,12,12,12,12,12,12,12,12,12,12,12,12,12,12,5,12,12,12,12,12,12,12,12,5,12,12,12,12,10,12,12,12,12,10,12,5,12,10,12,5,12,12,5,12,12,4,12,10,12,4,10,12,10,4,10,12,10,10,4,10,10,11,10,11,4,10,54,49,17,10,10,12,12,17,12,11,4,17,66,113,237,236,233,227,227,227,227,235,255,255,230,74,28,4,4,17,17,17,12,28,17,12,11,11,10,10,12,10,12,12,12,12,12,12,17,17,17,17,17,17,17,17,17,17,13,28,17,29,17,29,28,17,28,28,28,28,28,28,28,28,
+40,39,40,39,39,39,39,29,39,19,29,29,29,28,28,13,12,12,12,12,5,12,5,10,10,10,10,5,10,5,4,10,5,5,12,4,5,5,5,10,4,10,10,4,4,4,4,10,4,5,4,10,10,4,11,4,10,4,12,28,17,11,18,4,33,83,237,229,114,63,44,39,39,33,33,28,28,33,33,44,90,235,235,212,62,4,11,17,11,34,17,10,11,11,11,12,11,4,10,5,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,5,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,5,12,12,12,12,12,12,12,12,12,12,5,12,12,12,12,5,12,12,12,12,12,12,12,12,12,12,12,12,12,5,12,12,12,12,12,12,12,12,5,5,12,10,12,10,4,12,10,4,10,10,4,4,11,34,28,12,12,12,17,11,17,17,4,12,49,102,235,234,116,106,101,101,101,101,106,106,116,119,229,238,230,74,33,4,12,17,17,12,17,17,4,10,12,12,12,12,12,12,12,12,17,17,17,18,17,13,18,17,28,28,29,17,17,17,17,18,28,17,28,28,28,28,28,28,17,28,28,28,
+39,40,39,39,39,39,39,39,39,39,29,29,18,18,12,12,5,12,7,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,8,20,8,9,20,14,20,9,14,14,12,10,12,4,11,4,10,10,11,17,28,11,11,240,44,110,255,228,106,63,4,240,11,11,11,11,11,11,11,4,240,44,64,109,235,237,96,4,11,17,12,28,28,5,10,10,10,10,10,12,12,12,4,12,4,5,5,5,5,5,12,5,5,5,5,5,5,5,12,5,5,5,5,5,5,5,5,12,5,5,5,5,5,5,5,5,5,5,5,5,12,5,12,5,12,5,12,12,5,12,12,5,12,12,5,12,12,5,5,12,5,5,12,12,5,5,12,5,12,12,5,12,12,12,12,5,12,5,12,12,10,12,5,12,5,12,5,12,4,12,5,12,5,12,12,12,12,5,12,5,5,12,5,5,12,4,5,12,5,5,12,5,12,5,12,12,12,5,12,12,10,5,5,12,12,10,12,12,10,12,10,11,10,11,12,10,10,17,10,12,12,17,240,33,64,119,119,106,64,59,59,49,44,44,49,59,65,69,95,115,117,235,255,105,39,11,12,17,12,17,28,17,12,17,12,17,17,12,17,17,18,12,18,17,17,17,17,17,18,28,13,17,18,29,29,17,17,28,28,28,29,28,28,28,28,28,17,28,28,
+39,40,39,40,39,39,40,19,6,20,20,20,20,22,22,22,22,22,23,23,24,24,24,24,24,24,31,31,25,31,138,24,31,31,138,31,138,31,138,31,138,31,31,31,31,143,31,31,143,24,12,4,4,11,10,4,11,12,28,11,11,4,49,226,235,109,119,64,90,103,59,240,4,18,12,18,11,4,28,68,68,59,234,101,111,255,68,240,12,17,17,34,17,12,12,12,12,12,12,5,12,13,13,13,13,13,13,13,19,12,13,13,13,13,13,13,13,13,13,13,13,13,19,13,13,19,6,13,19,13,19,13,19,13,13,19,13,19,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,13,13,13,12,13,13,13,12,13,12,13,13,13,13,12,13,13,12,13,13,13,12,6,12,13,12,13,12,13,12,13,12,12,13,12,12,13,12,5,13,12,12,12,5,12,5,5,12,12,5,5,12,4,10,5,5,5,4,10,10,4,10,4,11,10,4,10,12,17,12,17,17,4,44,96,227,117,117,64,55,240,4,12,5,12,12,12,5,240,44,212,237,226,117,236,230,49,12,12,17,12,17,28,12,12,17,17,17,17,17,28,17,17,17,17,18,28,17,28,17,17,17,29,17,17,17,28,28,28,28,17,17,17,28,28,17,28,28,28,28,
+39,40,39,39,39,40,20,164,164,2,3,129,137,142,138,138,131,131,130,131,131,122,131,122,130,123,123,122,122,122,138,122,122,130,138,122,138,122,138,130,138,138,130,130,130,130,138,26,138,31,9,10,10,10,4,11,10,17,12,12,4,11,228,237,113,90,212,96,61,49,68,97,29,5,40,18,12,61,66,40,44,101,82,64,106,118,227,60,240,11,11,28,28,17,17,17,12,12,5,13,20,23,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,15,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,15,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,22,23,23,23,23,23,23,23,22,22,23,22,23,22,23,22,23,22,23,22,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,20,20,13,5,12,10,10,10,4,10,4,12,12,11,17,11,240,45,96,116,112,95,235,44,44,91,28,4,17,18,17,5,240,65,102,59,63,236,116,114,237,237,44,4,12,17,12,17,28,28,17,18,28,28,28,28,17,29,29,28,29,17,29,18,29,28,28,28,17,29,28,29,28,28,28,28,28,29,28,28,28,28,18,17,28,
+39,39,40,39,40,35,24,185,231,223,187,179,187,186,171,169,126,147,134,144,134,134,146,134,131,131,131,131,131,131,131,146,123,123,123,123,123,123,123,122,123,123,123,123,123,123,123,130,25,25,22,10,4,11,10,4,12,12,11,12,240,93,237,212,235,82,4,240,99,93,11,55,93,65,18,44,66,59,11,70,118,33,240,49,116,229,233,227,39,4,17,12,17,12,4,10,12,4,12,22,24,25,31,138,138,138,138,130,131,138,142,146,146,138,146,142,138,138,138,138,137,138,26,122,27,26,27,27,130,129,26,26,129,120,120,120,120,120,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,3,3,3,3,3,2,2,2,2,3,2,2,2,2,2,2,2,2,2,16,16,16,16,16,16,16,16,16,24,16,16,24,23,24,24,24,24,24,16,16,16,24,16,24,24,24,24,16,24,24,24,24,24,24,24,16,16,24,24,24,24,24,23,24,24,24,24,24,24,24,24,13,4,12,10,10,10,12,10,17,10,10,12,4,33,90,116,116,212,62,44,211,66,33,93,49,240,4,240,34,99,97,44,62,119,96,102,255,228,237,229,44,4,17,12,12,17,28,28,17,28,28,28,28,29,17,28,17,28,28,18,17,17,18,18,17,29,17,29,17,29,17,28,28,28,17,28,17,28,17,17,28,17,
+39,39,39,39,40,35,151,1,160,255,168,124,147,132,131,123,131,131,123,131,131,123,123,122,123,123,123,122,123,122,122,122,130,122,122,130,122,138,130,122,122,130,130,130,130,130,130,138,25,31,9,4,11,5,11,10,17,11,12,240,44,234,101,117,237,65,39,29,4,105,229,59,44,70,82,65,59,49,113,237,18,18,44,44,114,235,95,117,109,11,4,12,17,17,12,10,10,4,13,31,25,138,26,130,131,131,132,134,147,147,169,168,174,175,170,177,179,179,186,186,187,186,187,188,188,187,188,190,191,191,191,191,191,218,219,219,220,219,219,222,221,221,221,221,221,221,220,220,220,220,219,218,219,219,216,204,205,204,209,191,191,190,191,190,190,185,185,185,183,186,183,186,167,167,167,161,167,161,161,161,161,160,155,152,155,152,152,152,144,146,146,146,131,146,146,146,130,146,130,131,123,138,122,138,130,122,138,26,122,138,138,26,26,138,26,26,26,26,26,26,25,16,24,25,25,31,24,5,12,4,5,10,4,12,10,12,12,17,10,68,106,117,237,107,59,18,61,255,211,90,102,59,45,82,108,103,97,229,230,11,63,59,232,232,227,237,105,39,4,10,11,17,28,28,18,28,29,28,28,28,28,29,29,29,28,28,28,29,17,28,29,17,29,17,17,28,28,28,28,28,28,28,28,28,28,28,17,28,
+39,39,39,39,39,19,30,27,137,255,129,129,26,122,122,138,138,138,138,138,26,26,26,26,26,26,26,138,25,26,138,26,26,138,26,26,26,138,138,138,26,138,26,138,26,138,138,25,24,143,9,4,10,4,4,12,11,12,12,11,114,235,49,33,114,75,55,40,18,240,93,237,103,90,69,97,103,236,255,240,5,29,70,59,114,33,44,106,119,66,240,11,12,28,12,10,12,10,13,27,143,138,138,123,131,131,131,132,131,131,131,132,131,131,124,124,124,124,124,124,132,132,132,139,134,132,134,147,147,147,152,169,168,168,161,168,168,172,172,172,172,186,186,186,186,185,186,185,185,188,188,188,188,188,188,191,191,191,191,205,205,205,205,216,216,218,218,218,220,223,223,221,216,191,188,188,188,188,188,186,187,188,187,187,187,187,187,186,186,184,186,179,184,184,172,172,175,175,171,171,175,171,171,169,169,169,147,134,134,132,139,132,132,139,139,132,132,132,131,131,132,139,131,26,138,25,25,12,5,12,10,10,10,17,12,12,17,240,49,101,116,106,227,227,95,65,240,59,255,255,237,113,108,212,237,255,255,231,240,18,82,69,238,118,116,118,238,72,12,11,12,17,28,29,28,28,12,12,12,12,12,12,17,18,29,19,34,34,29,34,29,34,29,29,34,29,34,28,28,28,28,28,28,28,28,28,28,28,
+34,39,39,39,39,39,39,23,179,155,9,25,138,25,25,24,16,24,16,16,24,16,24,24,24,24,16,24,16,24,16,24,24,24,16,24,24,16,24,16,24,16,24,24,25,16,25,24,24,143,13,10,4,10,10,12,12,12,240,62,228,102,18,240,66,93,72,74,5,18,240,66,255,228,228,119,237,255,240,4,40,45,82,82,103,240,12,59,117,119,18,4,11,17,17,5,12,4,13,143,138,138,122,122,122,123,131,131,131,134,131,144,131,131,131,139,139,139,134,131,139,139,132,139,132,131,132,132,132,132,131,124,131,124,124,124,124,124,124,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,124,140,169,175,177,175,168,135,126,124,124,124,121,121,121,121,121,121,121,121,121,121,121,121,124,123,124,123,124,123,124,123,123,124,131,131,131,131,132,131,131,132,131,131,131,132,131,131,131,131,131,131,132,134,122,26,138,25,12,10,10,4,4,12,17,12,17,12,17,91,107,83,17,64,235,106,96,5,4,63,237,237,255,255,255,238,255,88,240,5,67,97,102,212,59,95,116,119,212,49,4,12,10,28,17,4,10,10,10,4,4,13,14,13,13,18,17,12,13,18,29,34,34,34,39,39,34,34,32,34,32,32,32,32,32,28,32,28,28,
+29,34,34,34,39,40,29,8,192,161,16,24,24,24,24,24,23,16,23,24,16,23,16,16,24,16,23,24,16,16,23,24,16,16,23,24,16,23,24,24,24,24,24,16,24,24,16,24,24,143,8,4,10,12,12,17,11,12,4,108,234,49,4,4,33,110,93,99,29,240,5,59,235,237,229,232,255,113,34,4,4,70,101,102,68,240,17,34,63,112,72,240,11,12,17,12,5,12,12,143,138,122,138,122,123,123,123,123,123,123,131,131,131,131,131,131,131,131,144,131,139,139,139,131,139,139,139,139,139,139,139,131,139,139,139,139,139,139,139,139,139,146,134,139,139,139,139,139,139,139,139,139,131,134,139,139,139,131,131,131,131,131,139,131,131,131,131,131,131,131,131,123,123,123,134,152,168,171,171,171,169,168,147,152,132,131,123,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,123,131,123,131,123,131,131,123,131,123,123,123,123,123,122,122,123,122,122,131,123,26,138,31,7,5,10,12,10,12,17,12,12,240,60,102,103,17,240,17,236,235,117,4,240,97,238,229,232,232,255,255,55,240,12,12,112,227,117,70,11,63,106,115,234,92,12,10,12,17,28,10,11,4,10,10,13,30,24,24,23,24,22,22,20,20,13,13,13,13,12,29,39,39,34,34,34,34,34,34,32,34,32,32,32,
+34,34,29,29,34,29,29,19,183,36,31,25,24,24,24,24,24,23,16,23,23,23,23,23,23,23,16,23,23,23,24,23,23,24,24,23,24,24,24,24,24,16,24,24,24,24,24,24,25,25,13,4,11,5,17,12,12,240,49,119,91,33,4,11,4,99,107,110,55,33,99,98,69,255,255,255,212,63,110,72,34,107,106,114,39,4,12,17,44,106,114,4,11,12,28,17,10,12,5,143,130,138,138,122,122,122,122,123,123,123,123,123,123,123,122,123,123,123,123,123,123,123,123,131,123,131,123,131,123,131,131,131,131,131,131,131,131,131,131,131,131,144,146,139,131,139,131,139,146,131,131,131,131,131,146,131,123,131,131,123,131,123,123,131,123,123,123,123,131,123,123,123,131,123,123,123,122,122,122,122,131,144,152,169,169,168,169,152,134,131,124,131,123,123,122,122,123,122,123,122,123,122,123,122,122,122,122,122,122,122,122,122,138,138,138,138,138,26,138,26,26,26,138,26,138,138,25,5,12,5,4,12,17,17,12,10,10,83,101,65,4,17,240,110,255,237,28,39,83,229,230,237,238,228,114,68,18,240,33,237,238,235,4,10,54,66,107,116,110,45,4,17,10,32,10,10,11,10,10,13,24,24,23,24,16,16,23,24,23,16,23,22,22,14,13,12,39,39,34,39,34,34,34,34,34,34,34,32,
+29,29,29,29,29,29,29,20,15,48,167,3,31,24,24,24,23,24,23,24,24,24,24,24,24,24,24,24,24,24,16,24,24,24,24,24,24,16,24,24,24,24,24,24,24,24,24,24,24,138,13,4,5,4,17,12,12,240,93,109,59,18,11,18,240,55,114,109,97,65,99,102,110,105,88,105,99,111,103,82,62,117,112,102,4,11,17,12,28,63,112,49,240,12,28,12,12,5,12,31,138,138,130,130,122,122,122,123,122,123,122,122,123,123,123,123,123,123,123,123,123,123,123,122,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,122,123,123,122,123,123,123,123,123,123,122,122,122,122,138,122,122,122,122,123,122,123,122,123,122,123,122,123,123,122,123,122,122,122,122,138,122,26,138,146,152,152,169,152,152,144,144,131,131,122,122,138,122,138,122,138,122,138,122,122,122,138,122,138,138,138,31,24,24,24,24,24,24,24,138,138,25,138,138,24,4,5,12,10,12,17,17,12,4,34,102,97,17,5,17,240,90,255,235,96,97,97,109,255,232,237,237,110,96,102,70,92,255,255,105,240,12,28,59,69,101,116,67,4,12,12,28,12,10,4,12,4,13,24,24,24,24,23,23,16,23,16,23,23,23,23,22,22,14,19,45,39,39,39,39,34,34,34,34,34,34,
+33,29,29,29,29,29,18,35,15,79,255,1,16,31,24,24,24,24,24,24,24,24,24,16,24,24,24,24,24,24,24,24,16,24,24,16,24,24,24,24,24,24,24,25,24,24,24,24,138,31,7,10,10,12,17,12,5,11,114,96,29,12,12,12,4,33,93,103,117,70,64,228,34,240,5,240,12,63,111,59,111,111,106,49,29,40,11,17,17,32,107,84,240,17,17,28,5,12,12,25,138,130,138,122,122,122,122,123,146,142,146,152,146,153,146,146,153,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,131,142,131,131,138,131,123,131,122,123,131,130,123,130,122,122,122,122,122,122,122,122,122,26,122,122,138,122,130,122,130,122,122,122,122,122,138,122,122,122,122,138,26,26,26,138,24,16,16,23,23,16,24,143,153,168,171,148,131,122,122,122,122,26,138,138,138,138,138,138,138,26,26,138,138,138,24,25,31,25,138,25,138,25,138,138,16,10,12,10,5,12,17,12,12,4,66,92,49,240,17,17,4,44,236,115,67,97,234,65,240,4,10,55,232,229,83,62,212,255,238,33,4,17,11,28,59,69,107,102,29,10,12,17,17,5,10,10,4,13,24,23,16,23,16,24,23,16,23,16,23,23,23,22,22,15,19,45,44,44,44,44,39,34,34,34,34,34,
+28,29,28,29,29,29,18,29,24,9,255,210,3,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,24,25,24,24,24,24,24,24,25,25,138,13,4,4,12,12,12,4,39,112,68,28,11,11,18,5,44,93,102,101,109,97,40,18,39,52,41,41,18,49,102,106,103,103,70,40,28,10,11,17,18,101,104,240,12,12,28,12,12,5,31,138,130,122,122,122,122,130,138,143,143,25,138,27,25,143,143,27,138,27,31,138,143,27,143,143,138,138,138,143,143,143,143,143,143,143,143,151,146,151,146,151,143,151,151,146,151,146,146,151,146,146,146,146,146,146,153,153,153,155,153,153,152,146,152,146,146,142,138,138,26,122,138,138,130,138,122,138,122,138,26,26,26,138,138,25,138,25,25,24,24,24,23,22,15,22,14,15,151,152,173,152,146,122,122,138,138,26,138,26,26,26,138,26,26,26,138,138,138,25,138,25,138,25,25,26,138,23,4,5,12,12,17,17,12,17,240,96,101,39,4,17,10,12,44,64,101,83,97,34,5,39,17,17,4,10,229,104,72,235,234,103,11,10,17,17,28,45,67,101,107,39,4,17,17,17,12,10,4,10,13,24,24,23,24,23,16,23,16,23,23,23,16,23,22,22,22,13,45,45,44,44,44,39,44,39,39,34,39,
+28,34,29,29,29,29,29,18,20,2,214,255,3,16,31,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,24,24,25,25,25,25,25,24,25,138,6,4,12,12,17,12,240,49,103,61,18,12,12,5,44,71,68,64,108,237,88,4,39,53,197,198,41,44,34,113,229,103,69,82,65,39,4,11,11,11,90,108,4,5,12,28,12,12,10,24,138,130,130,122,122,122,26,25,25,138,27,138,138,138,27,138,138,138,27,138,26,138,138,26,138,27,26,27,26,138,138,26,138,27,138,27,138,27,138,27,138,25,138,25,27,25,25,25,138,25,25,25,25,138,25,25,138,138,143,143,138,151,143,151,146,151,143,31,143,143,143,138,138,26,26,138,26,26,138,138,138,25,138,25,138,25,24,24,24,24,23,22,22,20,14,14,19,5,6,14,36,152,173,152,123,26,138,26,26,138,26,138,26,25,138,25,138,138,26,25,138,25,138,138,26,138,23,4,12,5,12,12,17,12,11,10,96,97,28,12,17,12,44,62,101,96,72,40,18,50,33,52,196,28,39,44,112,109,112,116,83,49,18,11,12,17,34,63,96,106,60,5,12,12,17,10,4,12,4,13,24,24,24,16,16,23,16,23,16,23,23,23,23,23,22,22,14,35,45,44,44,44,45,44,44,44,39,39,
+28,29,28,28,29,29,29,18,20,2,164,255,36,16,25,24,25,24,24,25,24,31,24,25,24,25,24,25,25,24,24,25,24,25,25,24,25,31,25,25,25,25,25,31,25,24,25,24,138,25,13,4,5,17,17,12,4,49,99,59,5,11,17,49,70,68,113,255,238,255,70,40,50,197,21,196,52,55,33,108,255,237,237,113,63,65,39,4,4,11,67,109,11,11,12,28,12,12,5,25,138,130,130,122,122,138,25,138,138,25,138,27,138,26,138,27,26,138,138,138,138,26,25,138,26,138,138,138,138,27,130,138,27,138,27,138,27,138,27,138,138,27,138,27,138,138,138,138,138,27,138,138,138,27,138,138,27,27,27,27,138,27,26,27,27,138,25,138,25,25,25,138,138,26,138,138,138,138,25,138,25,138,31,25,24,24,24,24,23,23,22,22,14,20,14,14,14,14,19,6,4,240,20,31,152,173,146,130,26,26,138,25,26,138,138,138,25,26,25,31,138,24,25,26,138,138,16,10,5,12,12,17,29,10,11,11,103,108,11,11,17,44,59,115,101,95,113,12,39,39,53,198,53,197,17,18,62,255,114,106,96,65,54,28,11,12,32,65,95,101,65,240,17,12,17,5,10,10,4,13,24,24,16,23,23,24,23,24,23,16,23,23,16,22,22,22,20,13,4,39,49,44,45,44,44,44,45,44,
+28,29,28,18,29,29,29,29,35,2,36,231,158,3,25,31,25,25,25,25,25,25,25,31,25,24,25,31,24,25,25,25,31,24,25,31,25,25,25,31,25,31,25,25,25,138,25,138,25,143,13,10,4,12,17,12,4,49,102,49,5,12,45,49,105,229,211,238,99,69,65,40,88,52,196,197,73,75,18,66,69,114,228,104,236,104,44,33,11,11,68,110,4,5,17,18,12,5,10,24,138,123,122,130,130,138,24,138,138,138,138,138,25,31,138,138,138,25,138,25,138,138,138,138,138,26,138,25,26,138,25,138,138,138,138,138,138,138,138,138,25,138,138,138,138,27,26,138,25,138,138,138,138,25,138,27,138,138,138,138,138,27,138,138,27,138,138,26,138,31,138,24,25,138,138,25,138,25,138,24,25,24,24,24,24,24,22,23,22,14,20,20,14,14,14,19,8,19,6,13,6,5,6,4,5,14,151,169,152,138,26,138,25,138,25,25,138,25,31,138,25,138,138,26,26,138,23,4,12,5,12,17,17,12,12,4,103,113,17,12,49,33,119,227,107,114,114,4,55,40,198,37,38,203,49,18,59,212,255,114,112,102,44,49,33,10,17,60,90,96,65,5,17,17,18,10,10,12,4,20,24,24,23,24,16,16,23,16,23,23,16,23,23,23,23,15,15,20,4,4,49,45,44,44,45,44,44,44,
+28,29,29,33,29,28,18,29,12,159,181,89,255,159,154,151,151,153,151,143,31,31,31,25,25,25,24,25,24,25,31,25,25,25,25,25,25,31,25,25,25,25,31,25,25,25,25,25,138,143,8,4,5,12,12,12,4,44,102,61,29,33,70,213,255,40,240,68,102,97,94,40,61,211,208,213,255,18,40,108,102,111,40,240,44,255,213,49,33,29,69,108,4,12,17,28,12,12,12,25,138,130,130,26,138,25,16,138,25,138,138,25,138,25,138,25,25,138,31,138,25,138,25,138,25,138,31,138,31,138,31,138,25,138,25,138,25,138,25,138,138,27,31,25,138,31,25,138,138,138,138,25,138,138,31,138,138,138,138,25,138,138,138,25,138,25,138,25,25,138,25,138,16,24,138,25,31,24,24,24,24,24,24,23,22,22,22,20,15,15,20,14,20,14,14,14,19,8,12,6,6,5,13,5,5,10,240,7,23,169,146,26,26,26,138,138,25,138,25,25,25,25,25,138,26,138,24,10,5,12,12,17,28,12,11,4,103,109,59,39,44,114,255,33,82,115,112,28,39,74,42,196,196,53,39,18,59,62,99,84,44,119,211,65,44,39,44,49,69,96,62,240,17,12,17,12,4,10,10,8,24,24,24,16,23,23,23,24,23,16,23,16,23,23,23,22,22,14,14,40,33,49,49,44,44,45,45,45,
+33,28,18,28,29,29,29,29,5,81,213,80,105,49,6,6,13,13,20,22,31,31,31,143,143,151,143,25,138,25,25,25,25,25,24,25,25,25,25,25,25,138,25,25,24,138,25,25,26,138,13,4,12,12,17,12,4,18,104,61,32,72,232,87,240,4,18,33,110,103,93,45,4,70,237,213,12,55,70,91,102,99,240,12,240,240,213,213,66,33,96,99,240,12,12,28,12,5,12,31,130,122,26,138,138,16,23,25,25,25,25,25,25,24,25,24,25,24,25,24,24,24,25,24,25,24,25,25,25,24,25,31,25,31,25,31,25,24,31,24,25,31,25,31,24,138,31,31,25,31,25,31,25,25,25,31,25,25,25,31,25,25,138,31,31,138,31,138,31,138,25,31,24,24,24,24,24,24,24,24,23,23,22,22,22,20,15,20,14,20,14,14,14,14,14,14,19,13,13,5,13,5,13,12,13,5,12,5,4,7,151,173,138,26,25,138,31,138,25,138,24,138,25,138,26,138,25,5,5,5,12,17,28,12,12,4,96,113,83,82,211,229,240,240,240,96,212,105,18,105,208,87,87,65,11,28,72,92,66,240,4,4,93,237,113,32,33,61,67,96,65,240,12,17,17,10,12,10,5,20,24,24,23,16,24,24,24,16,23,16,23,23,16,23,23,22,15,6,211,255,231,4,49,49,44,44,45,44,
+28,28,28,29,28,28,29,29,18,20,24,154,222,23,2,30,20,14,13,13,8,7,7,7,13,9,22,24,31,143,143,146,143,31,138,138,25,25,138,25,25,25,25,25,138,25,25,138,27,143,9,10,4,12,18,12,12,11,110,66,88,229,240,240,18,18,18,18,70,33,34,49,84,55,33,11,70,88,40,29,40,55,5,11,4,240,240,55,237,66,96,72,240,12,28,29,12,12,5,31,131,138,138,26,24,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,24,23,23,23,23,23,23,23,23,24,23,24,23,24,23,24,23,24,24,24,24,24,24,24,24,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,25,24,25,25,25,24,24,24,24,23,22,22,22,22,22,22,22,20,22,14,15,14,20,14,20,14,20,14,14,14,19,6,19,6,6,13,5,12,5,5,12,5,12,6,5,5,4,7,152,146,26,25,138,25,25,31,138,25,138,25,138,138,25,12,5,12,12,17,29,12,12,240,64,228,113,255,50,240,4,240,240,66,109,108,49,18,55,74,49,4,18,49,72,72,72,240,12,5,240,11,237,230,44,60,67,96,45,4,17,17,17,12,10,5,4,20,24,24,16,24,23,16,23,16,24,23,16,16,23,23,23,22,22,9,20,100,235,49,44,49,45,59,45,45,
+18,28,18,29,28,29,29,29,29,20,137,136,215,221,1,129,137,143,143,143,25,31,23,22,14,13,7,7,7,7,13,13,9,22,24,31,143,146,143,143,138,138,138,26,25,25,26,138,27,146,15,4,10,12,17,12,12,240,93,83,70,49,33,59,65,66,66,70,65,65,65,55,61,97,83,91,82,44,55,70,65,62,82,90,90,83,83,33,44,49,106,49,240,12,17,18,12,5,12,27,138,122,130,138,31,23,22,24,23,23,22,22,22,22,22,22,22,15,22,22,15,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,24,23,23,23,24,23,24,23,23,23,23,22,23,22,22,15,22,22,15,20,14,20,14,14,20,14,20,14,20,14,20,14,14,19,8,19,6,6,13,5,5,12,5,13,12,12,12,5,12,12,6,5,4,4,138,138,138,25,25,25,138,25,25,25,138,138,138,31,7,4,12,12,12,28,17,17,5,49,237,88,4,240,39,65,85,88,71,44,54,84,65,240,240,240,19,54,65,62,70,66,29,29,28,12,240,240,100,100,62,72,97,17,12,17,18,17,4,12,12,5,22,24,24,24,24,24,23,16,23,23,16,23,23,23,23,16,23,22,22,8,19,49,49,59,49,44,45,45,45,
+28,28,28,28,29,29,29,18,18,19,150,192,238,238,255,150,129,142,138,138,138,138,143,138,143,143,138,31,24,22,9,8,13,7,8,7,7,7,9,22,24,143,31,146,146,146,138,138,138,131,24,4,5,12,12,17,12,240,59,98,40,62,235,255,238,237,234,212,102,66,65,61,61,90,91,101,66,55,65,61,90,212,234,236,255,255,255,119,59,63,114,4,10,12,29,17,12,12,13,143,122,122,130,130,138,25,25,138,138,138,143,143,138,143,138,31,138,31,31,25,31,24,24,24,23,23,24,22,22,22,22,22,15,22,15,22,22,22,22,15,22,15,15,20,22,22,22,22,15,15,22,22,15,22,15,22,15,22,22,20,22,22,22,22,15,22,22,22,22,15,22,14,22,14,20,14,20,20,14,14,14,14,20,14,14,14,14,14,19,14,14,14,14,19,13,6,13,5,13,5,12,5,12,12,5,5,12,5,12,5,5,6,5,4,138,138,25,138,25,25,25,138,25,138,26,26,138,13,10,5,12,12,28,28,12,12,17,119,212,229,237,235,236,255,255,255,226,97,61,232,229,90,99,97,65,70,62,65,54,54,60,61,64,69,67,40,45,72,67,92,12,17,17,17,12,5,10,5,12,22,24,24,16,24,24,24,24,16,16,23,24,16,16,23,23,23,22,22,20,20,60,49,45,45,59,45,59,44,
+28,28,18,28,28,29,28,28,18,19,24,142,225,255,238,225,1,123,137,138,130,130,138,138,138,138,27,138,138,138,138,143,138,31,25,23,22,20,13,7,13,7,7,7,8,9,24,31,143,146,146,5,5,5,17,28,12,5,4,110,66,108,228,237,255,255,255,255,237,236,84,65,49,97,212,228,66,55,63,101,237,255,255,237,232,213,114,235,82,96,93,240,12,17,34,12,5,10,13,143,131,122,122,122,130,25,138,122,130,122,122,130,122,130,122,130,138,130,130,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,143,143,143,25,31,143,31,31,25,25,24,24,24,24,24,23,23,23,22,22,22,22,22,15,22,22,22,20,22,14,22,14,20,14,20,20,20,20,14,20,14,14,14,14,14,14,14,14,14,14,19,14,14,14,14,14,13,19,13,13,13,6,13,5,5,5,12,12,12,12,12,12,12,5,12,12,12,12,12,4,9,31,25,31,138,25,25,25,138,25,138,26,143,8,4,5,12,10,28,28,12,12,240,101,236,228,255,255,255,255,255,255,255,229,83,113,229,117,235,90,70,65,61,33,61,97,212,237,236,237,117,83,60,67,83,65,240,17,17,28,11,10,12,10,13,23,24,24,24,16,24,16,24,23,24,16,23,24,23,24,16,23,23,22,15,14,49,59,49,44,49,44,45,49,
+28,28,28,28,18,28,29,18,29,18,19,27,136,216,255,255,185,121,147,123,131,130,130,122,130,138,138,138,138,138,138,138,138,138,138,146,138,143,143,143,138,24,22,22,8,8,13,7,8,14,8,12,4,12,12,29,12,12,240,72,107,103,105,240,240,34,34,40,49,237,212,68,49,88,207,210,59,65,90,230,210,11,4,240,18,240,28,90,90,114,28,4,12,28,29,12,12,4,20,131,122,123,122,123,130,25,138,122,122,122,122,122,122,122,122,122,122,130,122,138,122,130,122,130,138,122,130,138,138,138,130,138,138,138,138,138,138,138,138,130,138,138,138,138,138,138,138,138,138,138,138,138,138,138,143,138,138,138,138,143,138,143,31,138,31,25,31,24,24,24,23,23,22,22,22,22,20,22,14,20,20,20,14,13,14,13,13,13,13,12,13,13,13,13,12,12,10,10,4,10,4,4,4,4,4,4,4,10,4,5,5,5,4,4,20,31,25,25,25,25,138,25,25,138,25,138,143,9,4,12,5,12,12,28,28,17,6,44,235,236,96,33,55,75,94,99,255,236,97,92,255,235,227,72,65,60,34,113,229,255,232,229,210,101,228,61,66,67,102,17,12,17,17,28,10,10,5,10,13,24,24,24,24,24,24,24,24,16,24,24,24,16,24,24,23,23,23,22,22,13,50,49,49,49,49,59,44,44,
+28,18,28,28,28,28,18,29,18,18,28,19,25,144,144,156,162,184,185,132,1,123,131,123,122,122,138,122,130,130,130,138,138,130,130,130,130,138,130,130,138,138,146,131,146,138,138,142,138,25,25,23,5,5,12,17,17,12,5,240,99,97,44,5,5,5,19,18,4,240,101,119,112,18,240,240,49,106,227,99,240,5,18,12,11,4,34,59,116,55,240,12,17,29,12,12,12,4,22,144,123,123,122,123,130,26,138,123,122,122,122,122,122,122,122,122,122,122,122,123,122,122,122,122,122,122,122,122,130,122,130,122,130,130,130,138,130,130,138,130,138,130,138,130,138,130,130,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,130,138,130,130,138,122,130,130,130,130,130,130,138,26,138,138,130,138,138,138,138,138,138,138,31,26,138,31,25,25,24,24,24,24,24,23,23,22,22,22,22,20,20,20,14,14,13,13,13,14,23,25,138,25,138,25,138,25,138,138,26,138,138,143,24,10,5,12,12,17,32,28,17,17,5,69,237,105,4,240,240,240,240,11,72,83,103,63,240,18,71,65,32,236,213,240,240,240,240,240,17,67,69,66,96,60,240,17,17,28,17,5,12,10,5,9,24,25,24,24,24,24,24,16,24,24,24,16,24,24,16,23,24,23,23,22,14,35,49,49,59,49,49,49,49,
+28,28,28,29,18,18,28,28,18,18,29,18,20,31,27,120,120,120,160,187,185,121,1,123,131,123,131,123,122,122,122,131,130,130,122,130,130,130,130,122,130,130,123,130,122,131,130,130,131,138,144,146,13,4,12,12,29,28,12,5,11,114,71,49,12,11,11,18,40,18,28,235,233,66,5,4,101,233,238,4,18,39,28,17,11,12,59,102,99,240,12,12,34,34,12,12,12,6,151,149,139,131,131,123,123,25,138,123,123,122,123,123,122,123,123,123,122,122,122,122,123,122,122,122,123,122,122,122,122,122,122,130,122,130,130,122,122,122,122,122,122,130,130,130,122,122,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,122,138,138,138,138,122,138,138,122,138,138,138,138,138,138,25,138,138,122,122,138,122,138,138,130,122,138,122,122,138,122,130,122,122,122,130,130,122,122,146,130,130,131,130,130,138,138,138,138,138,138,138,26,26,26,26,26,138,138,26,26,26,138,26,138,143,7,12,5,12,12,28,32,28,17,17,4,114,234,93,28,4,12,12,4,39,97,96,114,240,12,34,62,114,238,240,240,12,12,11,12,45,72,67,67,92,240,12,17,28,28,4,10,10,5,12,23,24,24,16,25,16,24,24,24,24,24,24,24,24,24,24,24,16,23,23,22,15,29,65,59,49,49,44,49,44,
+28,28,28,12,28,28,18,28,18,28,18,17,18,19,23,31,142,137,120,123,188,190,184,121,1,123,123,123,131,130,122,122,122,122,123,123,122,122,122,122,130,122,122,122,123,130,130,131,130,131,123,131,22,4,4,12,17,34,12,12,240,62,97,61,40,12,18,11,18,40,4,113,237,105,240,11,228,255,213,240,18,17,12,11,12,39,106,212,240,5,12,17,29,17,5,12,5,12,31,151,151,153,148,152,169,143,148,147,148,144,131,131,131,123,123,123,123,122,122,123,122,122,122,122,122,122,123,122,122,122,123,122,122,122,122,130,122,122,123,123,122,122,122,122,123,122,122,122,122,122,123,122,122,122,130,122,122,122,122,122,122,130,130,130,130,122,130,130,130,130,130,122,130,130,122,122,138,26,26,122,138,138,122,138,122,138,138,138,138,138,122,138,138,138,138,138,138,138,138,138,138,122,138,138,138,138,138,138,138,138,138,122,138,138,26,138,26,26,26,26,26,26,26,138,26,138,26,146,9,4,12,12,12,12,34,32,17,17,5,32,234,234,72,12,18,28,12,4,83,106,237,78,240,32,96,255,210,240,17,12,12,12,44,69,72,64,108,12,4,17,17,28,17,10,12,12,4,13,24,24,25,24,24,25,16,24,24,16,16,16,24,16,24,24,16,24,16,23,22,22,14,60,49,59,49,49,49,49,
+28,28,28,28,28,28,18,28,28,28,18,18,18,18,18,20,31,143,138,26,1,131,205,221,186,1,123,131,123,123,131,123,131,123,123,123,123,123,123,123,122,123,123,123,123,123,123,123,122,123,123,142,27,7,10,5,12,28,28,17,12,240,114,102,59,29,55,12,11,12,240,63,255,232,240,49,238,255,65,240,12,17,17,18,40,64,117,11,4,12,17,34,28,5,12,12,5,5,13,8,13,13,13,12,13,13,20,22,22,31,31,31,151,146,151,146,146,147,144,146,139,134,131,131,131,123,123,123,122,122,122,122,122,122,122,123,122,122,138,122,122,122,123,123,122,122,123,122,123,122,122,122,122,123,122,122,123,122,122,122,122,122,122,122,122,122,123,122,122,122,122,122,122,122,122,122,130,138,26,138,122,122,122,122,122,122,122,122,122,138,122,122,122,138,122,138,122,138,122,138,122,138,138,122,138,122,138,138,138,122,138,138,138,26,138,26,26,138,26,26,138,26,26,138,26,138,26,138,24,12,5,12,5,12,17,34,28,12,17,240,60,235,117,49,84,29,4,4,32,119,227,211,240,32,235,255,5,4,12,17,17,45,82,63,63,109,34,240,12,28,17,17,12,4,12,10,4,22,24,25,25,25,24,24,24,25,25,31,24,24,16,24,16,24,24,24,16,23,23,22,14,49,49,59,49,59,45,49,
+28,28,28,28,28,28,28,28,28,28,28,18,29,18,18,17,20,146,148,153,143,129,3,164,220,209,144,1,1,123,131,142,123,123,131,123,123,123,123,123,123,123,123,123,123,123,123,123,131,123,123,131,146,14,4,5,12,10,34,28,12,4,240,110,99,61,12,5,5,12,5,240,236,255,240,98,255,238,240,5,12,17,12,33,90,119,39,240,12,17,39,34,12,12,5,12,4,22,143,31,25,31,24,22,22,13,8,13,13,13,14,8,8,13,13,13,13,13,20,22,22,22,24,31,138,146,153,146,147,148,152,132,144,139,131,123,131,123,131,122,123,123,122,122,123,122,123,122,122,122,122,123,123,122,123,123,122,123,122,123,123,122,122,123,123,122,122,122,122,122,122,122,122,122,122,122,122,130,26,138,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,138,122,122,122,122,122,122,122,138,138,122,138,138,122,138,138,122,26,138,122,26,138,26,26,26,26,26,138,143,7,12,5,12,5,28,34,34,32,17,17,240,61,235,116,59,34,12,12,4,90,234,230,240,67,234,62,240,12,12,28,60,83,62,67,109,44,240,17,28,17,28,17,5,10,12,5,6,23,25,25,25,16,25,25,25,25,25,25,25,25,24,24,24,24,24,16,24,23,23,22,14,49,54,49,49,44,45,49,
+28,28,28,28,28,28,28,28,28,28,18,17,29,29,18,18,18,13,184,147,152,148,151,36,23,204,225,255,209,150,1,120,123,142,142,131,123,131,123,123,131,123,123,123,123,131,123,123,137,143,123,123,131,25,11,12,5,12,28,34,29,12,4,240,93,108,91,18,4,4,12,4,44,255,40,213,255,33,4,12,4,4,44,112,233,59,240,12,17,34,29,12,12,12,12,5,13,31,138,137,138,138,143,142,131,31,143,142,146,143,143,31,31,24,24,22,22,9,20,8,8,13,8,14,14,13,7,13,13,8,20,22,23,31,31,151,146,146,148,147,152,147,134,152,144,144,131,131,131,123,131,123,123,123,122,123,123,122,123,123,123,123,123,122,123,123,123,123,123,123,122,123,123,122,122,123,123,122,138,26,123,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,138,138,138,138,138,138,138,138,138,138,138,122,122,138,122,138,26,130,23,4,12,12,12,17,34,34,34,28,12,17,240,59,234,116,64,39,29,34,34,102,114,28,104,101,17,5,17,34,63,67,62,69,109,44,240,10,28,17,28,32,4,12,12,12,4,20,25,25,26,25,25,25,25,25,25,25,25,25,25,25,25,25,25,24,24,24,16,23,22,22,35,60,49,59,49,59,45,
+28,28,28,28,28,28,28,18,28,28,28,29,17,18,18,18,18,11,56,188,132,124,132,138,36,24,24,210,255,255,222,166,148,121,129,142,142,123,131,123,123,123,131,124,123,123,131,142,23,24,138,131,123,146,9,4,12,5,12,17,32,28,12,5,240,40,212,103,93,40,4,4,12,44,18,33,33,5,4,17,59,112,110,104,4,240,12,17,39,39,12,12,5,12,12,5,22,143,137,137,157,138,130,142,138,27,138,122,122,130,130,123,138,131,138,138,131,138,142,138,138,143,27,25,25,24,24,22,22,9,20,13,13,13,14,8,14,8,13,13,8,20,22,22,31,36,36,151,146,153,153,152,144,148,147,146,134,131,131,131,131,123,131,131,123,122,122,122,122,123,123,123,122,131,123,123,123,123,122,26,122,123,123,123,123,123,123,123,123,123,123,122,123,122,123,122,122,123,122,123,122,122,122,122,122,122,123,122,122,122,122,138,138,138,122,138,138,122,138,138,122,138,138,138,138,138,138,138,26,143,7,4,12,5,12,17,34,34,32,28,17,17,240,17,110,112,95,44,45,44,44,45,44,44,45,59,44,49,60,60,67,106,97,17,240,17,28,17,17,28,12,10,4,12,4,12,23,31,25,24,138,25,24,138,25,25,25,25,26,25,25,25,25,25,25,24,24,24,16,22,14,35,60,49,45,49,49,49,
+28,28,28,28,28,28,28,17,28,28,28,18,28,28,17,29,18,18,240,40,205,175,124,132,134,153,36,2,30,193,255,255,231,185,149,121,137,142,131,138,131,131,123,123,123,123,123,123,158,159,130,123,131,131,138,4,4,12,12,4,28,34,28,17,12,240,240,59,110,110,112,99,68,59,49,59,59,83,109,110,119,105,33,240,4,12,28,39,39,12,12,5,12,5,4,14,31,142,138,195,199,157,129,130,138,26,137,123,122,122,122,122,123,122,122,123,123,123,123,123,142,131,131,144,144,144,144,148,144,148,148,144,146,146,143,143,143,25,24,23,9,20,14,13,13,13,8,14,14,14,8,13,19,20,20,22,30,36,36,36,151,153,153,153,153,152,147,147,147,139,139,131,131,123,123,123,123,123,123,138,122,123,122,122,122,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,122,123,122,123,122,122,122,122,122,122,122,122,122,130,122,138,138,122,138,122,138,138,138,138,131,24,10,5,12,5,12,17,34,44,34,32,10,12,5,240,65,227,102,95,59,44,34,39,39,45,44,45,59,69,101,99,45,240,5,17,28,28,28,32,17,10,12,12,12,4,20,24,138,25,138,25,25,138,25,138,25,138,25,25,25,26,25,26,25,25,25,24,24,23,151,153,35,54,59,59,49,49,49,
+17,29,28,28,28,28,28,28,28,28,18,17,29,18,18,29,18,29,19,4,12,47,143,135,126,132,131,152,151,2,15,163,255,231,255,204,140,142,129,121,144,131,123,131,131,123,131,123,131,131,123,131,123,123,144,24,10,4,12,5,10,28,34,32,17,12,12,240,240,28,66,104,113,212,114,114,119,113,98,65,11,240,4,12,12,34,34,29,17,5,12,12,12,5,13,24,142,123,158,199,38,199,157,123,139,26,138,123,131,131,123,131,138,131,146,131,138,146,131,131,146,131,131,131,146,131,131,131,144,131,131,139,139,139,126,134,147,147,147,147,147,147,147,147,144,146,148,138,143,31,25,23,22,22,20,20,13,13,13,20,14,14,20,20,20,20,20,22,30,36,36,151,151,152,152,147,152,147,147,144,138,152,139,134,131,131,131,123,123,123,123,123,122,122,123,123,122,122,123,123,123,123,123,123,123,123,123,123,122,122,122,122,122,122,122,122,122,122,122,122,122,122,130,138,122,138,122,122,138,138,138,9,4,11,12,12,12,28,32,34,34,32,28,17,12,240,12,84,211,114,99,102,97,97,96,96,97,112,102,44,4,240,12,17,28,17,32,34,17,12,4,12,12,4,13,24,138,138,26,26,138,138,26,138,25,26,25,138,25,138,25,25,25,25,25,25,25,25,151,155,30,51,49,49,49,49,45,49,
+28,17,28,28,28,28,28,28,28,29,17,28,18,17,28,17,18,17,29,19,17,17,19,23,144,135,132,169,205,153,24,2,9,47,215,255,255,188,168,150,1,131,131,123,131,131,123,131,123,123,131,123,131,131,131,144,9,10,11,12,5,12,10,44,44,32,28,12,10,4,240,240,240,11,11,17,11,240,240,240,5,12,12,32,39,44,34,4,12,12,12,5,5,12,23,146,138,122,195,199,20,37,198,123,146,131,138,146,144,144,146,131,144,146,131,142,131,131,138,131,131,138,142,131,131,142,131,131,131,131,144,146,139,139,125,146,144,134,139,134,134,139,134,139,134,134,134,147,134,141,147,141,134,147,144,134,144,144,146,142,138,138,31,24,22,22,20,20,13,13,14,20,15,20,13,20,20,20,20,30,22,31,36,36,154,153,153,155,168,168,152,169,169,147,152,144,134,131,131,131,123,123,123,123,122,122,123,123,122,123,122,122,122,122,123,123,122,122,122,122,122,122,122,122,122,122,122,138,122,138,131,143,13,4,12,12,12,12,17,28,34,44,32,28,17,17,17,240,240,28,54,75,84,82,82,70,49,28,240,240,17,17,17,17,28,32,34,17,4,10,12,12,12,5,22,143,26,26,26,26,26,26,26,26,26,138,26,26,26,26,25,138,25,26,25,25,25,36,36,35,54,54,49,59,49,45,59,44,
+28,29,17,28,29,29,17,29,17,18,29,17,28,28,29,28,28,18,29,29,18,18,18,17,20,142,140,124,171,192,166,143,31,15,9,15,210,255,255,255,189,136,121,124,123,131,131,123,131,131,131,131,123,124,123,131,146,8,4,12,12,12,5,17,34,39,34,34,32,28,12,17,12,12,12,10,12,17,12,17,17,34,44,34,34,34,5,5,12,5,12,5,10,22,143,131,146,138,199,14,43,201,199,153,144,138,138,144,131,131,131,144,131,131,138,131,142,142,131,142,131,131,131,142,131,131,142,131,131,131,139,139,131,139,131,126,139,139,131,139,131,134,139,134,139,134,139,139,134,139,132,139,134,134,134,139,134,134,139,134,132,134,141,134,133,147,134,147,134,144,146,142,138,138,31,24,22,22,22,20,20,20,8,20,9,14,14,13,13,19,20,20,30,30,36,36,154,153,153,155,152,168,168,169,169,169,152,134,152,131,131,123,131,123,123,122,122,122,122,122,122,122,122,138,122,122,122,122,122,122,122,138,25,12,4,12,12,5,12,17,34,34,44,44,32,32,17,10,17,12,4,4,240,240,4,240,240,12,12,17,28,32,32,34,44,34,4,4,12,5,12,4,4,20,138,138,26,26,26,26,26,26,26,26,26,26,26,26,26,138,26,138,26,25,138,25,25,154,45,54,54,59,49,49,59,45,49,49,
+28,17,28,28,17,17,28,28,28,17,17,18,28,28,17,19,29,17,29,17,29,18,19,18,17,19,22,146,121,127,179,179,184,155,143,15,2,14,210,255,255,238,183,149,126,121,131,124,131,123,131,124,131,131,131,131,124,142,6,4,4,12,12,4,4,17,29,32,44,39,34,34,32,32,32,32,32,34,34,39,44,45,34,28,5,10,12,12,12,5,4,10,22,142,144,144,147,142,199,201,14,201,200,150,139,131,138,139,139,131,131,131,131,131,131,123,131,131,123,131,138,123,123,131,123,131,131,131,131,131,131,139,132,139,139,134,139,134,134,134,134,134,139,134,134,139,134,134,139,134,134,134,139,132,134,134,134,139,132,134,134,134,139,139,134,134,139,132,139,134,134,134,134,134,134,134,147,134,147,147,144,138,148,146,142,138,138,25,24,22,22,8,13,13,7,7,8,8,8,7,13,7,13,20,22,22,23,36,36,151,153,152,155,152,169,169,169,169,152,147,152,131,146,131,131,131,123,123,122,122,122,122,131,24,10,12,5,12,5,12,4,28,32,34,44,34,34,28,28,32,17,17,28,28,17,17,17,17,17,32,34,32,34,32,28,4,4,12,10,10,12,4,20,138,26,26,138,26,26,26,26,26,26,26,138,26,26,26,26,26,26,26,26,26,26,138,31,46,54,54,54,49,49,59,49,59,44,49,
+17,28,28,28,28,28,28,28,17,29,28,28,29,18,28,17,17,29,17,29,29,18,17,29,18,18,17,13,22,31,121,124,175,186,172,184,162,24,14,2,163,215,255,221,187,176,149,133,124,124,131,131,131,123,131,124,131,132,138,22,4,4,12,12,5,12,4,17,28,32,34,28,34,34,34,34,34,34,34,17,34,17,12,12,5,12,5,12,4,4,13,24,144,147,131,144,139,146,202,203,196,203,202,153,139,131,122,144,139,131,131,123,123,123,123,123,122,123,138,123,123,123,131,123,131,123,124,124,131,131,124,132,139,132,132,139,132,132,132,132,134,132,134,134,134,132,134,132,134,134,132,132,134,132,132,132,132,134,134,134,132,132,132,134,134,132,134,132,134,134,132,132,132,132,134,132,132,132,134,134,134,123,131,134,134,134,134,134,134,134,134,147,134,144,146,146,131,138,138,25,16,23,22,9,20,8,13,8,8,8,9,9,9,9,20,20,20,22,22,23,31,151,143,146,151,146,146,139,144,147,152,152,147,169,24,12,12,12,12,12,12,12,5,32,34,44,44,44,34,34,34,32,34,32,34,32,34,34,44,34,34,34,32,4,4,12,12,5,12,4,4,20,138,138,26,138,26,138,138,26,138,26,138,26,138,26,138,26,138,26,26,26,26,26,26,25,47,54,59,49,59,59,49,59,44,49,49,49,
+28,17,28,17,28,17,18,17,18,17,29,17,17,17,29,28,18,28,18,18,17,28,18,18,28,18,29,18,17,17,18,22,16,123,132,141,172,192,191,183,154,31,2,36,192,191,188,192,179,174,141,124,124,132,131,131,131,131,132,133,143,13,10,12,12,12,12,5,12,10,5,5,12,5,12,5,12,5,12,12,4,12,12,5,12,12,12,4,13,23,148,133,144,134,134,134,139,147,131,156,181,142,123,132,132,131,123,141,140,141,141,169,147,152,168,165,168,146,131,131,123,131,129,120,171,174,171,174,174,174,174,174,173,171,173,173,173,145,173,145,145,169,149,135,141,141,128,128,126,126,128,126,134,126,134,134,134,132,132,134,134,132,132,132,132,132,132,132,134,132,132,132,132,132,132,132,132,132,132,132,134,131,131,132,132,132,132,132,132,132,132,132,132,132,132,132,132,126,134,126,134,128,128,128,127,133,128,132,134,147,131,146,138,138,138,25,24,22,22,9,20,14,14,14,9,14,14,14,13,13,7,7,7,20,9,12,5,5,12,5,12,12,12,12,5,4,28,34,34,34,34,45,45,44,34,45,44,34,34,17,4,10,5,10,12,5,12,5,4,13,24,131,122,122,122,138,122,138,26,138,138,138,138,138,138,26,26,26,26,26,26,138,26,26,26,138,47,54,54,59,49,49,49,49,49,49,49,45,
+28,17,28,28,28,28,17,17,29,17,28,18,28,28,17,29,17,29,17,29,28,18,17,28,28,18,18,18,18,18,19,17,18,20,24,143,121,126,173,188,206,216,189,36,154,123,147,187,206,187,179,177,171,147,124,124,131,132,131,124,132,146,9,5,4,5,5,12,12,12,12,12,12,12,12,12,5,12,12,12,12,12,12,12,5,4,5,20,143,147,134,134,132,139,132,132,132,132,132,126,132,141,145,169,174,171,152,188,186,188,191,216,218,221,205,168,131,122,122,122,120,1,121,187,206,192,192,191,191,191,188,191,188,188,188,188,188,188,187,187,186,186,186,179,179,179,177,177,177,177,175,175,174,174,173,173,169,173,145,135,135,128,134,126,134,126,132,134,132,132,134,134,132,132,132,132,132,132,132,132,132,132,123,146,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,131,132,131,132,132,132,132,132,126,134,126,126,127,133,134,132,132,146,142,146,138,138,25,25,23,22,22,9,8,14,13,13,10,4,12,12,12,12,12,5,12,5,12,12,17,17,17,12,12,12,12,12,5,12,12,12,12,5,12,12,12,12,20,146,146,146,146,146,146,146,122,130,131,130,122,130,122,122,122,122,122,26,122,138,138,26,138,26,26,26,151,54,60,49,59,49,49,49,59,45,49,45,
+17,29,17,28,17,28,17,28,17,29,17,28,17,13,28,17,28,17,18,17,19,29,28,29,13,29,17,29,18,29,29,18,18,18,17,20,22,143,123,121,127,174,188,206,187,165,144,124,121,186,192,187,186,179,179,175,147,124,124,131,132,124,131,143,22,13,4,10,5,12,5,12,5,12,5,12,12,5,12,12,12,4,4,4,5,13,25,144,140,139,132,132,132,132,132,132,126,126,127,169,175,177,186,187,191,223,184,209,205,218,221,221,225,218,1,120,122,130,122,123,168,191,221,221,216,221,218,218,205,206,216,216,205,216,205,205,205,216,205,205,216,216,216,216,192,205,205,205,205,191,191,188,188,187,187,186,186,186,186,179,179,177,175,175,174,174,173,169,135,135,128,127,126,134,132,126,132,132,134,132,132,132,139,134,132,132,132,134,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,131,132,131,132,132,131,131,131,132,131,132,131,132,131,132,132,132,132,132,134,132,126,126,140,134,144,147,144,138,22,13,10,4,12,5,12,12,12,12,12,12,5,12,12,5,12,12,12,12,12,12,12,12,5,12,12,5,5,5,8,20,9,20,22,22,24,36,151,146,151,146,146,146,146,146,146,146,146,131,146,138,138,122,138,26,138,138,146,51,59,49,49,49,49,49,45,45,49,45,
+17,17,28,17,17,18,13,28,17,28,28,29,17,18,17,29,29,29,17,29,17,17,29,17,18,17,18,29,17,29,17,29,18,18,18,18,17,19,20,24,138,123,121,127,171,187,186,172,152,124,124,168,187,188,186,186,179,187,172,169,134,124,124,124,131,143,24,9,13,5,12,10,10,10,10,10,10,10,10,4,5,7,13,22,24,146,134,139,124,132,124,121,121,127,149,171,184,188,216,221,216,218,221,221,221,221,184,178,186,179,177,177,175,121,130,131,131,123,169,175,179,186,177,175,175,176,177,177,177,177,179,186,187,188,188,191,191,192,205,205,216,216,218,216,218,221,221,220,218,218,216,218,216,218,216,216,216,205,205,205,191,188,188,188,187,187,186,186,179,177,177,177,175,173,173,173,169,135,128,127,134,128,132,168,128,132,134,132,132,134,132,134,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,131,132,131,132,131,132,131,132,131,132,131,132,131,132,132,131,132,131,131,26,122,134,142,22,7,10,10,12,12,12,12,5,12,12,12,12,12,12,12,12,12,12,12,5,12,10,12,7,13,13,13,13,5,5,7,7,7,7,7,5,12,10,10,12,7,13,20,20,20,22,22,24,24,31,151,151,146,138,130,146,51,49,49,49,59,49,49,45,59,45,45,
+28,17,17,29,17,17,17,17,29,17,17,17,28,17,29,17,17,17,18,17,28,18,17,18,17,18,17,18,28,18,18,29,29,29,19,29,29,18,18,18,19,20,24,27,123,121,132,174,172,175,168,139,121,132,170,186,186,179,179,186,186,186,170,169,134,132,124,131,123,25,16,15,9,9,14,8,9,9,15,23,24,143,146,144,131,124,121,121,126,147,175,186,205,218,221,218,221,223,216,188,186,175,171,145,145,127,127,132,169,145,141,129,16,22,23,143,174,173,173,169,173,145,169,169,169,173,169,173,169,173,173,145,145,145,135,135,135,145,145,145,169,169,169,174,175,177,177,186,187,188,191,205,205,216,218,220,220,220,218,220,220,218,218,216,218,216,216,205,205,191,191,188,188,187,186,186,179,177,177,177,175,175,169,147,172,135,128,128,126,126,134,132,134,132,134,132,134,134,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,131,132,131,132,131,132,131,131,132,131,131,122,131,139,132,139,133,146,24,8,5,10,10,12,12,12,12,12,12,5,12,5,5,5,12,4,12,13,9,24,142,131,138,138,138,138,138,25,16,16,23,22,22,9,20,9,8,8,7,7,12,7,7,12,7,7,7,7,7,7,4,14,146,51,49,60,45,49,49,45,49,45,45,45,
+17,28,17,17,28,17,28,17,17,28,28,17,28,28,17,28,29,17,28,18,17,29,28,28,29,17,29,17,18,17,17,19,17,18,17,18,18,29,29,18,18,18,18,19,20,24,25,26,123,132,173,173,152,131,123,121,147,175,179,177,177,177,177,179,179,179,179,179,174,174,173,169,169,147,144,147,132,134,133,126,126,126,126,141,169,171,184,191,206,205,192,205,205,186,175,169,145,127,127,145,145,169,173,173,174,174,176,171,171,177,175,15,20,22,15,148,177,176,176,178,178,176,176,177,176,176,175,176,176,175,176,176,175,175,175,175,174,174,174,173,173,173,173,169,173,169,173,145,135,135,127,145,135,145,145,169,174,171,175,177,186,188,188,205,216,218,220,221,221,221,221,218,218,216,216,216,216,205,191,188,188,187,188,169,186,186,179,177,175,174,173,173,145,135,135,128,128,126,126,134,134,132,134,134,134,132,132,134,132,134,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,131,131,122,131,132,131,131,132,131,132,134,131,138,23,8,7,5,7,12,10,10,12,10,4,5,6,13,22,25,138,139,132,131,124,123,131,124,123,131,131,131,131,132,123,131,131,131,138,131,138,138,143,138,138,138,138,138,24,24,23,22,22,20,16,168,49,49,49,60,45,60,45,59,45,45,45,
+28,17,17,28,17,28,28,17,28,17,13,17,28,17,29,17,18,17,18,17,29,17,17,18,18,28,18,17,29,28,29,17,29,28,28,28,18,28,18,18,29,29,18,29,18,18,19,20,22,31,26,130,144,132,124,124,123,121,123,134,168,175,177,175,175,175,175,177,177,179,179,179,186,179,186,186,187,187,186,187,187,188,188,188,188,188,188,186,172,169,145,127,145,135,174,171,174,171,171,171,175,175,175,176,176,176,175,174,169,146,173,155,9,14,31,177,174,175,174,174,174,174,173,173,173,174,174,174,174,174,174,174,175,174,175,175,175,176,175,176,176,176,178,176,176,176,176,175,175,175,174,174,173,173,173,173,169,173,169,145,135,145,127,145,145,141,145,173,174,177,177,186,191,205,216,220,221,221,221,218,218,218,220,188,172,218,188,188,188,187,186,186,179,177,177,175,175,174,174,169,145,135,135,128,128,128,134,126,126,134,134,134,134,134,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,139,131,122,131,132,131,132,132,131,132,132,131,132,132,132,139,146,138,31,25,24,24,16,25,138,138,138,131,132,132,132,123,131,123,123,131,123,131,131,124,123,123,123,123,123,131,123,131,123,123,122,123,123,123,123,122,123,123,123,123,131,123,131,26,160,161,44,49,49,49,45,45,45,45,45,45,45,
+17,28,17,28,17,28,17,17,17,29,17,29,17,29,17,17,28,17,17,18,17,13,28,17,17,18,17,29,17,18,17,29,17,29,13,28,17,29,28,29,18,29,18,29,18,29,18,18,18,19,20,30,23,31,143,138,131,131,123,123,123,123,132,169,171,175,175,175,174,171,174,173,173,173,171,171,171,171,171,171,171,171,169,169,135,169,135,173,169,173,174,171,169,169,141,135,149,169,175,179,179,177,178,175,168,152,153,153,154,159,30,160,31,9,23,36,36,31,24,31,31,31,36,31,30,30,9,15,15,24,24,31,151,151,151,153,155,152,168,169,174,174,174,175,175,175,176,176,177,176,177,178,176,178,178,178,176,178,178,175,175,175,174,174,173,173,173,169,169,145,135,135,127,127,127,145,149,173,171,172,186,188,216,221,184,223,223,223,220,218,218,220,216,216,191,188,187,186,186,179,179,177,177,177,177,175,174,174,174,169,145,135,128,128,126,126,134,126,134,126,134,134,132,132,132,132,132,132,132,132,144,138,131,131,132,132,131,132,131,132,131,132,131,132,131,132,131,132,132,132,132,126,132,132,132,132,132,132,131,124,131,131,131,124,131,131,131,123,131,123,123,131,131,131,123,131,123,124,123,123,131,131,123,123,123,123,131,123,123,123,123,123,123,122,122,138,48,49,45,45,59,45,59,45,45,44,45,45,
+17,28,17,17,28,17,17,29,17,17,17,17,17,17,17,28,17,28,28,17,17,28,29,17,28,28,17,28,18,17,18,17,29,17,18,28,29,29,29,17,29,28,29,18,29,29,29,29,18,29,18,18,19,29,20,30,30,24,27,142,138,137,123,123,123,123,131,144,169,171,171,175,175,175,175,174,175,174,175,171,175,174,175,171,169,169,147,126,126,121,121,133,147,172,187,192,191,187,185,162,154,47,35,35,35,39,40,34,40,44,59,44,193,2,23,30,22,22,22,14,14,14,20,14,8,78,106,83,82,82,71,74,76,55,51,46,35,35,29,19,19,14,14,15,15,2,24,143,153,155,152,168,171,171,175,178,178,177,177,179,179,177,177,177,177,177,176,178,175,176,176,175,175,174,174,173,173,169,173,145,127,127,127,135,141,135,169,171,186,188,192,218,221,223,224,223,220,219,219,218,218,216,191,188,187,187,187,186,186,179,177,178,175,174,174,173,169,169,135,128,126,126,132,134,134,126,134,132,134,147,131,131,132,132,132,132,132,131,132,132,132,131,132,131,132,131,132,132,132,131,132,131,132,131,132,131,131,131,131,131,131,132,123,131,124,131,124,131,123,131,131,123,124,123,131,124,131,123,131,123,123,123,123,123,131,123,123,123,123,123,123,123,123,123,131,31,49,49,49,49,49,45,49,45,45,45,45,39,
+17,28,17,28,17,28,17,17,28,17,28,28,17,28,28,28,17,17,28,28,17,18,17,28,13,17,28,18,17,18,17,18,17,29,17,29,17,29,29,28,28,18,17,28,28,29,29,29,29,29,29,29,29,29,29,29,29,35,35,20,30,24,31,25,143,27,130,130,123,120,123,123,123,123,131,144,139,132,146,134,139,131,132,169,171,171,178,187,192,192,187,205,204,185,164,78,56,41,40,33,40,49,55,70,70,68,82,65,45,45,55,59,92,181,136,25,23,23,22,22,22,22,22,15,8,80,236,235,233,235,235,235,235,236,235,235,234,227,226,118,113,114,108,102,96,91,84,74,73,51,46,35,35,14,14,9,15,2,31,150,160,161,176,177,177,179,179,179,179,177,179,177,178,175,175,177,177,177,175,174,174,171,173,174,169,169,173,135,135,127,127,127,127,141,169,171,172,188,192,219,221,222,223,223,221,221,220,219,221,221,220,219,216,205,188,187,186,179,175,175,174,173,145,135,128,134,127,147,147,146,131,134,134,132,132,139,134,132,132,132,132,132,131,132,132,132,131,131,132,131,132,131,132,131,131,132,131,131,132,131,131,131,132,131,131,131,131,124,131,124,131,131,131,131,123,131,123,131,123,131,123,131,124,123,123,124,123,123,131,123,123,123,123,123,123,31,49,44,54,45,49,45,45,45,45,45,45,45,
+17,17,28,17,29,28,17,28,17,28,17,17,17,17,17,13,28,17,13,17,17,17,17,18,17,18,28,17,18,28,17,28,17,29,17,18,17,28,17,19,29,29,29,18,28,29,18,17,18,29,29,29,29,29,29,29,29,29,29,39,29,35,35,30,30,30,36,31,143,143,27,138,130,130,123,123,131,144,124,131,131,131,146,152,152,160,159,154,36,89,211,88,73,54,70,97,103,111,108,93,82,71,70,70,70,70,66,82,54,44,54,65,62,194,193,3,16,25,24,31,24,31,24,27,129,36,63,99,114,119,227,235,235,235,233,235,234,234,234,228,234,228,234,234,235,235,235,233,235,235,235,233,233,233,119,118,114,103,98,83,70,76,46,47,36,154,156,156,161,172,177,176,175,173,173,135,175,217,135,134,134,128,128,128,134,135,173,169,173,173,174,174,174,173,169,173,135,127,127,127,127,145,145,171,171,184,185,205,218,221,223,224,225,225,223,222,220,220,221,220,218,188,179,176,175,175,171,147,123,126,127,126,134,134,134,134,134,132,132,132,132,132,132,132,132,132,132,132,132,132,131,132,131,132,131,131,131,132,131,131,132,131,131,131,131,131,124,131,123,131,124,123,131,123,131,123,131,123,124,123,124,123,123,131,123,123,123,131,123,123,123,123,123,123,131,143,50,49,44,49,45,49,45,45,45,44,45,44,
+17,17,18,17,17,17,17,17,17,17,18,28,28,28,17,17,28,17,17,18,28,28,17,17,17,28,17,28,17,18,29,13,28,17,29,17,18,29,29,17,29,17,29,17,29,18,17,29,28,28,18,28,29,28,29,29,29,29,29,34,39,39,39,39,39,35,35,35,35,35,30,36,30,36,31,31,31,31,36,30,22,30,30,12,12,12,12,18,11,33,93,235,236,233,114,103,108,108,109,103,93,82,71,70,70,70,66,66,72,70,40,49,65,68,81,225,2,3,120,26,122,120,121,168,175,143,33,39,29,44,59,63,68,83,96,97,102,103,103,109,109,109,109,111,112,109,111,111,112,114,114,113,119,113,113,212,211,212,110,113,105,71,40,39,49,44,34,39,34,34,35,35,48,156,152,145,135,127,135,135,128,135,128,134,134,128,134,128,128,128,128,128,128,169,173,169,171,175,171,173,169,169,169,173,169,173,135,169,169,169,169,169,169,174,170,172,186,191,191,219,221,223,221,220,218,186,165,161,186,176,174,173,169,145,169,135,135,141,141,134,134,134,134,134,132,132,134,132,132,132,134,132,132,132,132,132,132,132,131,132,131,132,131,131,132,131,131,131,132,131,131,131,131,132,124,124,131,131,123,131,123,131,131,123,123,123,123,123,123,123,123,131,123,123,123,130,40,49,49,44,45,45,45,45,45,45,44,45,
+17,17,17,17,17,29,17,17,18,17,17,17,17,17,29,17,28,17,28,17,17,28,13,29,17,18,17,13,17,17,17,17,29,18,17,29,29,17,17,29,17,18,17,29,17,28,28,28,28,28,28,28,18,29,28,29,28,29,29,29,34,34,34,39,39,39,39,40,40,40,45,40,45,45,49,50,49,50,59,54,40,29,50,50,49,40,19,29,19,39,18,4,44,113,238,228,114,102,99,103,103,103,97,82,82,71,71,70,70,72,65,39,40,60,65,182,218,155,165,168,171,177,179,191,205,163,40,70,65,65,54,49,49,40,49,40,40,40,44,40,44,44,44,44,44,44,39,34,34,28,18,12,5,4,4,4,240,4,4,5,6,5,6,12,19,39,19,17,18,18,34,34,17,34,45,46,152,135,135,135,135,128,128,141,128,135,135,135,128,135,128,135,135,128,128,128,128,128,134,128,128,128,128,128,141,171,173,169,169,171,175,172,177,172,176,175,175,171,169,149,145,135,149,184,134,183,223,223,222,223,224,220,205,188,186,186,179,177,175,175,174,173,173,145,169,135,134,134,134,134,134,134,134,134,132,134,132,132,134,132,132,139,132,132,131,132,132,131,131,131,131,132,131,131,131,131,131,124,131,124,131,124,123,124,123,131,124,123,131,124,123,123,123,123,131,123,46,45,49,45,45,45,45,45,45,45,45,44,
+17,17,17,17,17,17,17,17,17,17,13,17,17,17,17,18,17,17,29,17,17,17,17,17,17,17,18,17,29,17,18,17,17,28,17,17,28,29,17,28,28,28,28,18,29,28,18,28,28,29,28,28,28,28,28,29,29,28,29,29,34,29,34,34,39,39,39,39,39,40,39,45,40,45,40,49,49,49,49,54,54,49,40,40,49,50,40,39,29,29,29,40,18,240,44,212,238,228,111,99,99,102,103,102,93,68,71,71,70,66,72,39,39,40,61,58,188,220,221,188,175,174,173,127,181,114,5,65,65,65,61,65,61,60,55,60,61,61,60,61,55,54,60,61,60,60,61,61,61,65,65,65,65,65,65,65,65,54,54,50,50,39,18,18,18,39,34,13,18,34,39,45,18,12,45,44,46,168,145,135,135,135,135,128,135,128,128,135,135,135,135,128,128,128,135,135,135,169,173,169,135,169,128,128,128,173,135,134,128,128,134,128,128,128,128,128,169,169,173,171,171,176,172,169,169,171,145,169,175,188,218,225,225,221,222,219,205,191,188,187,186,179,177,175,175,175,173,173,173,145,135,169,147,128,141,134,134,134,134,134,134,134,134,134,132,132,132,134,132,132,132,131,132,131,132,131,131,131,132,131,131,131,131,131,124,123,131,131,123,131,131,123,131,124,123,123,36,45,49,45,45,45,45,45,45,44,45,44,
+17,17,17,17,17,17,17,18,17,17,17,17,13,17,17,17,17,28,17,17,28,28,28,17,18,17,17,17,17,17,17,17,29,17,13,28,17,29,17,29,29,17,29,17,17,29,17,29,29,17,29,28,28,18,28,28,28,29,28,28,28,34,34,29,34,34,39,39,39,39,40,40,45,39,45,49,45,49,49,49,49,54,54,49,39,39,29,39,39,29,29,29,39,29,5,240,61,228,235,118,106,99,99,102,102,99,91,82,71,71,71,71,29,40,44,65,79,162,179,177,171,173,145,181,93,114,39,65,65,65,65,65,65,65,65,65,65,65,61,65,65,65,65,65,61,65,65,61,65,61,65,61,65,61,65,65,65,65,65,65,65,70,49,12,18,39,34,18,18,45,45,45,19,19,45,39,45,36,174,174,174,174,169,174,173,145,173,135,135,135,135,135,135,135,135,135,128,128,135,135,173,135,135,135,135,135,135,135,135,135,135,135,135,135,128,135,128,128,134,128,128,128,134,134,169,135,171,173,169,135,135,149,171,188,221,231,225,221,222,221,218,191,191,187,186,186,177,177,177,177,175,174,174,174,173,173,173,173,169,135,169,128,147,134,134,134,134,134,134,132,132,134,132,132,132,131,132,131,131,131,131,132,131,131,131,131,124,123,124,123,131,123,124,123,123,131,31,45,45,49,45,45,45,45,44,45,44,45,
+17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,28,17,13,17,17,18,17,17,17,17,17,18,17,28,17,18,28,17,28,17,28,17,18,28,17,17,28,28,28,29,28,17,29,17,29,28,28,28,18,28,28,28,29,32,29,34,34,28,34,34,34,34,34,39,39,39,39,39,40,45,40,45,45,45,45,49,45,49,49,54,49,44,40,40,44,45,29,34,29,39,40,5,240,91,238,227,114,103,96,98,98,97,97,83,82,72,82,71,28,39,49,61,75,77,163,164,164,89,100,69,108,66,45,65,65,65,65,61,65,65,65,65,65,65,65,61,65,61,55,55,61,61,60,55,61,54,55,54,54,54,55,55,55,54,54,54,65,50,28,34,45,44,29,17,39,45,45,17,18,45,39,45,35,171,175,175,174,173,175,175,174,175,174,174,174,174,174,173,174,173,173,173,173,145,173,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,173,135,173,169,173,147,147,173,173,169,173,135,173,173,173,173,173,145,145,169,184,205,222,224,225,222,221,221,218,205,191,188,187,186,186,186,179,179,179,179,175,175,175,174,174,174,173,173,173,173,169,135,141,141,134,134,134,134,134,134,134,132,132,132,132,131,131,131,131,131,131,131,131,131,131,123,131,123,131,124,138,45,45,45,45,45,45,45,45,44,45,44,
+12,17,17,17,28,17,17,17,17,18,17,17,17,17,17,18,17,17,18,17,17,17,17,28,17,17,17,28,13,17,17,29,17,28,28,28,28,17,28,28,28,18,17,29,17,29,28,29,28,28,28,28,28,28,28,28,28,28,28,28,28,28,34,28,33,34,34,34,34,34,39,39,39,39,39,39,39,45,45,45,45,45,49,45,49,49,54,54,54,54,55,49,39,34,34,29,39,40,240,39,113,237,227,111,101,91,93,97,98,93,66,55,70,49,29,34,44,70,68,68,66,59,64,101,83,97,103,18,65,65,65,65,61,61,61,55,61,54,61,61,59,60,55,59,54,59,55,54,54,54,54,54,60,59,54,59,49,59,59,59,59,55,49,12,29,44,45,34,17,44,44,45,18,19,39,39,39,39,155,175,175,174,174,175,174,174,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,174,173,173,173,173,145,173,145,135,135,173,135,135,135,135,135,135,134,147,135,145,135,173,145,173,173,173,173,174,174,175,174,173,145,145,171,179,192,222,225,225,222,221,218,216,205,191,191,187,188,188,186,186,186,175,179,177,175,175,175,175,175,174,174,174,173,173,173,147,141,134,134,134,132,134,132,134,134,134,132,132,132,131,132,131,124,131,131,131,131,123,132,142,35,45,45,45,45,45,45,44,45,44,44,
+17,17,17,17,13,17,17,17,17,17,17,17,18,17,17,17,17,17,17,17,17,17,28,13,17,13,17,17,17,17,18,17,17,18,17,17,28,28,17,28,28,28,29,17,28,17,29,17,28,28,18,28,28,28,28,28,28,28,28,28,29,28,28,29,28,29,34,33,34,34,34,34,39,39,39,39,45,39,45,45,45,45,45,45,45,49,45,49,49,49,59,54,55,49,40,29,29,39,40,29,240,44,212,237,118,111,101,91,91,97,97,60,45,49,40,28,34,45,66,68,68,70,61,91,83,82,112,18,54,65,61,54,55,61,60,61,55,60,54,54,54,54,54,59,55,49,59,49,59,59,59,59,49,59,49,49,59,49,49,49,49,49,49,28,34,44,45,29,28,34,45,45,12,18,39,35,39,39,158,175,174,174,174,174,173,173,173,173,173,173,173,173,173,145,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,145,173,135,173,145,135,135,147,141,135,128,135,135,128,135,128,135,128,128,135,128,135,147,135,169,135,135,141,145,175,187,218,223,224,221,220,218,218,216,192,192,191,188,188,188,186,186,186,179,179,175,179,175,175,175,175,175,174,174,174,173,173,173,173,147,169,147,134,134,134,134,134,152,132,134,134,132,132,131,132,131,131,131,35,40,39,45,45,45,45,45,44,39,44,
+17,17,17,17,17,17,17,28,17,17,17,13,17,17,12,17,17,17,17,17,13,17,17,17,17,17,17,18,28,17,17,17,18,17,17,18,17,28,28,28,17,29,17,29,29,28,28,17,29,28,17,29,28,28,28,28,28,28,28,29,28,29,28,32,28,34,32,29,34,33,34,34,34,34,39,39,39,39,45,39,45,40,45,39,45,45,45,45,49,49,49,49,59,54,54,49,44,39,39,40,40,18,240,59,228,236,226,109,91,82,88,97,66,49,49,39,18,29,49,62,66,70,61,82,83,68,109,49,45,65,54,54,54,54,55,54,54,60,54,59,59,59,59,59,49,59,49,59,49,49,49,49,49,49,49,49,44,49,49,49,49,49,49,28,28,44,45,34,18,34,45,45,19,20,20,19,35,39,58,174,145,173,174,173,145,173,145,173,145,173,135,145,173,135,169,145,145,145,135,145,173,135,169,135,145,135,145,135,135,135,135,135,135,135,135,135,135,135,135,135,135,134,134,128,128,135,128,128,128,128,128,135,128,128,128,128,128,135,141,128,141,135,135,135,127,127,173,184,191,221,223,221,220,220,218,218,216,216,205,188,188,188,187,186,186,186,186,186,186,186,175,179,175,175,175,175,175,175,174,174,173,173,173,169,141,141,133,141,134,134,134,134,134,144,131,131,139,36,39,39,39,45,45,45,44,39,39,39,
+12,17,17,17,17,17,17,13,17,17,17,17,17,17,17,18,17,13,17,17,17,17,17,18,17,28,17,17,17,13,28,17,17,17,18,17,18,28,17,17,29,17,29,28,17,17,18,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,33,28,28,28,29,29,32,34,34,34,34,34,34,39,39,39,39,39,39,39,45,45,45,45,45,45,45,45,45,45,49,49,49,59,54,45,40,34,39,40,39,5,240,70,235,236,119,103,91,82,93,71,55,55,40,28,39,49,62,62,62,66,82,63,103,59,44,60,60,54,54,59,54,49,59,49,59,59,49,49,49,49,49,49,49,49,49,49,49,44,49,44,45,45,45,45,45,45,45,45,45,29,34,45,45,34,17,45,44,44,34,31,31,22,30,46,48,146,134,152,152,134,147,152,134,134,134,144,134,134,134,134,134,134,134,134,134,132,134,134,134,134,134,134,134,134,134,134,134,134,134,134,128,134,128,134,134,134,134,144,134,128,128,128,128,128,128,128,128,128,128,128,135,128,135,128,128,128,128,127,127,135,135,173,171,174,175,175,175,190,220,221,220,218,216,205,205,216,216,216,191,191,191,188,188,186,186,186,186,186,186,186,179,175,179,175,175,175,175,175,175,174,174,173,173,169,135,147,147,128,134,134,134,134,134,31,39,39,39,39,39,39,44,44,39,39,
+17,17,12,18,17,17,17,17,17,13,17,17,18,17,17,17,17,17,18,17,18,17,17,17,17,13,17,18,17,17,17,28,13,17,17,17,17,17,28,28,17,29,17,28,28,29,17,28,28,28,29,28,28,28,28,28,28,28,28,29,28,28,28,29,28,33,28,33,29,29,32,34,34,34,34,34,34,34,39,39,39,39,39,40,39,39,39,39,45,45,45,45,49,45,45,49,49,59,49,45,40,34,34,40,29,4,240,68,236,233,117,101,82,91,72,65,55,40,28,34,49,61,61,59,66,82,60,45,45,60,49,59,59,49,59,59,49,49,49,49,49,49,49,49,49,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,34,34,44,45,34,28,45,49,49,20,153,174,23,23,15,159,188,173,175,175,171,173,135,169,169,135,169,147,147,147,147,147,141,147,147,134,134,134,134,134,134,147,134,134,134,141,134,134,133,134,134,132,134,134,134,134,134,134,139,134,134,128,134,128,134,128,128,141,128,128,128,127,127,135,135,173,174,175,172,179,179,179,179,172,162,160,151,120,121,140,174,187,205,218,220,218,216,216,205,216,205,191,191,191,188,188,188,188,188,186,186,186,186,186,186,186,179,179,175,175,175,175,175,175,174,174,173,173,169,169,134,134,141,147,146,34,39,39,39,39,39,39,39,39,39,
+12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,18,17,17,17,17,17,17,29,17,17,17,28,28,17,17,28,13,18,17,17,28,17,18,17,28,17,29,17,29,17,28,28,28,28,28,28,28,28,28,28,28,28,28,28,29,28,28,29,34,32,32,34,29,34,34,34,34,34,39,39,39,39,39,39,39,39,39,45,45,40,45,45,45,45,45,45,49,59,49,44,34,34,34,34,28,4,4,83,237,119,111,96,83,72,65,65,40,18,44,49,59,59,59,66,60,45,44,45,59,49,49,49,49,49,59,49,49,49,49,45,45,45,44,45,45,45,45,44,45,45,44,45,44,39,45,44,44,44,45,39,45,39,34,45,44,39,34,45,49,44,29,153,173,27,23,23,153,187,127,135,135,135,135,135,135,128,135,135,135,128,128,135,128,135,128,135,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,134,128,134,134,128,144,134,128,134,134,128,127,127,127,135,169,173,171,172,179,179,179,179,167,167,160,153,151,16,16,16,16,22,23,24,23,23,16,129,148,174,186,188,216,218,216,205,191,205,191,191,205,191,191,191,188,188,188,188,188,186,186,186,186,186,186,186,179,175,175,175,175,175,175,174,174,171,173,173,147,173,146,35,39,39,39,39,39,44,34,39,39,
+17,12,17,17,17,17,12,17,17,17,12,17,17,17,17,18,17,12,17,17,17,17,17,17,18,17,17,17,28,17,17,29,17,17,13,28,28,28,17,17,28,28,18,28,28,17,18,28,17,29,28,28,28,17,28,28,18,28,28,28,28,28,28,28,28,28,32,28,32,32,28,29,34,34,34,34,34,33,34,34,34,34,39,34,39,39,39,39,44,39,39,44,40,45,45,45,45,44,45,45,49,49,49,44,34,34,33,29,18,240,33,228,237,227,109,96,71,61,65,45,29,40,49,59,59,49,59,45,44,45,49,49,49,49,49,49,44,45,45,44,45,45,45,45,45,45,44,44,44,45,44,39,44,44,44,44,44,44,39,39,44,39,44,39,39,44,44,39,39,49,50,45,35,155,173,138,31,23,143,186,127,135,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,134,128,128,134,128,128,135,128,134,131,126,128,141,173,174,175,179,179,179,179,179,179,171,138,25,16,16,16,16,16,16,25,25,31,31,24,24,24,24,24,23,23,22,15,15,16,144,175,179,188,205,205,191,191,205,191,191,191,205,191,191,191,188,188,188,188,188,186,186,186,186,186,186,179,179,179,175,175,175,175,174,174,174,173,173,168,35,34,39,39,39,39,34,44,39,34,
+12,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,13,17,17,17,17,17,17,17,13,28,17,17,17,18,17,17,28,17,17,28,28,17,17,17,18,28,17,17,29,17,28,17,29,28,28,28,17,28,28,28,28,28,28,28,28,28,28,28,28,28,28,32,33,28,28,34,28,29,34,34,34,34,34,34,34,34,39,39,39,39,40,39,39,44,44,44,44,45,45,45,45,45,45,45,49,44,39,29,32,28,5,240,59,228,237,119,111,68,55,55,40,18,45,49,49,59,44,44,44,44,59,45,49,44,45,45,44,45,45,45,45,44,44,44,44,44,44,44,44,34,44,44,44,39,44,34,44,34,44,44,34,44,39,44,44,44,45,45,39,35,35,47,22,152,147,131,23,23,143,179,135,128,127,128,128,128,128,128,128,128,128,128,128,134,127,128,128,128,128,128,134,128,128,128,134,128,134,134,134,128,134,134,126,127,128,135,135,135,135,145,173,168,177,177,184,167,163,79,57,46,45,45,35,47,154,168,147,130,26,138,25,25,31,24,31,24,24,24,24,24,24,23,24,22,22,22,20,14,14,15,27,148,174,179,187,191,205,191,205,205,191,205,191,205,191,191,191,191,191,191,188,188,188,186,186,186,179,175,175,179,175,175,175,175,175,174,174,175,30,33,39,39,34,39,34,34,34,34,
+17,17,17,17,17,17,17,13,17,17,17,17,13,17,17,17,17,18,17,17,17,17,13,17,17,17,18,17,17,17,17,28,17,17,17,28,13,17,17,28,17,28,28,18,17,17,28,29,17,28,28,29,17,28,28,28,28,28,28,28,29,28,28,28,28,28,28,28,28,28,33,28,28,32,29,32,34,28,34,32,32,34,34,34,34,34,34,34,34,34,34,39,39,39,39,39,39,39,44,44,44,44,45,44,45,45,45,44,44,39,33,28,4,240,40,83,235,228,118,90,65,49,40,45,49,44,44,44,34,44,45,45,44,45,45,45,45,45,44,45,44,44,44,44,44,44,39,44,39,44,44,34,44,34,34,44,34,44,34,39,34,34,34,34,34,39,39,39,39,39,30,24,23,146,173,134,143,23,25,177,135,128,134,128,128,128,128,128,128,128,128,128,128,128,128,128,134,128,134,128,128,128,134,128,128,127,128,128,128,135,173,173,171,171,161,160,155,158,154,58,57,51,50,45,34,34,33,33,33,44,44,45,44,44,44,46,46,48,154,153,152,151,138,26,25,24,24,24,24,24,23,23,22,22,22,20,15,20,20,14,19,14,14,15,25,144,171,177,179,187,188,191,191,191,191,191,191,205,205,191,216,191,191,191,191,191,191,191,188,186,186,186,179,179,175,175,174,179,36,33,34,34,39,34,34,34,34,34,
+17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,18,17,17,17,18,17,17,28,17,17,28,17,17,28,28,17,28,18,17,17,18,17,18,17,17,17,29,17,28,18,17,28,29,17,28,17,28,28,17,28,28,28,28,28,28,28,28,28,32,28,33,28,34,28,34,34,29,32,34,34,32,34,34,34,34,34,34,34,34,34,34,39,39,39,39,39,39,44,39,39,44,44,44,45,45,45,44,34,28,28,28,240,240,69,237,228,117,66,49,29,49,49,44,44,44,44,44,44,45,44,44,44,44,45,44,39,44,44,39,44,34,44,34,44,34,44,34,44,34,44,34,34,34,34,34,34,34,34,33,34,34,34,34,39,34,39,20,24,23,151,145,135,144,23,24,175,135,128,128,128,128,128,128,128,128,128,128,128,128,127,135,128,128,128,128,141,135,145,145,169,173,171,171,168,161,156,158,48,47,46,35,44,33,33,33,33,33,34,44,44,45,44,44,45,45,45,45,45,45,45,45,44,44,44,44,45,46,48,155,153,151,143,16,23,22,22,22,22,22,20,15,14,20,14,14,20,14,20,14,14,13,19,8,15,148,169,174,177,186,187,188,191,188,191,191,191,205,205,205,216,216,216,216,216,216,216,216,191,191,191,191,191,186,188,154,28,34,34,34,34,34,34,34,32,
+17,17,17,12,17,17,17,17,17,18,17,17,17,17,17,17,17,17,17,17,18,17,17,17,17,17,17,17,17,17,17,13,28,17,17,17,29,17,17,18,17,17,17,29,17,17,17,28,28,28,17,17,28,17,28,28,17,17,29,28,17,29,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,32,28,32,34,28,34,32,34,28,34,28,34,34,33,34,34,34,34,34,39,39,39,44,34,44,44,39,44,44,44,44,39,45,45,39,34,33,33,28,240,240,97,237,228,102,49,18,49,49,39,33,44,44,34,44,44,44,39,44,39,44,44,44,34,44,34,44,34,44,34,44,34,34,34,34,34,34,34,33,32,34,34,33,34,34,34,34,34,34,34,34,34,29,31,22,153,173,133,146,23,25,175,127,127,135,127,135,135,135,135,135,135,145,135,145,173,169,169,169,168,168,155,155,154,154,48,47,46,35,35,39,34,33,33,34,44,45,45,45,45,45,39,44,45,44,44,44,45,45,45,44,44,44,45,45,45,45,45,45,45,45,45,44,34,44,46,47,154,153,151,138,23,22,9,20,22,20,20,15,14,20,14,20,14,20,20,20,14,20,18,12,14,23,155,174,174,173,173,174,177,177,179,177,177,177,177,175,177,175,179,175,186,186,187,188,191,216,218,191,219,182,4,34,34,34,34,34,34,34,34,
+12,17,17,17,12,17,17,17,17,17,17,17,17,17,18,17,17,17,17,17,17,17,17,28,17,17,13,17,17,18,17,17,17,13,28,17,17,18,17,17,29,17,29,17,17,18,17,28,17,29,28,17,29,17,28,28,28,28,28,17,28,28,17,28,28,28,28,28,28,28,28,28,28,28,28,28,28,29,32,28,34,28,32,28,33,28,33,34,33,34,32,34,34,33,34,33,34,33,34,34,34,34,44,34,39,44,34,44,39,44,44,39,44,44,39,34,32,34,28,240,4,104,238,226,61,12,49,49,33,44,44,44,39,44,39,44,44,44,44,44,34,44,44,34,44,34,34,34,34,33,34,34,34,34,33,34,32,34,34,33,34,33,34,33,34,32,34,34,34,29,29,30,24,146,177,134,36,15,9,175,173,173,174,168,171,174,168,168,168,155,153,154,154,36,47,47,46,35,35,39,39,33,33,33,34,34,44,39,45,45,44,45,45,45,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,45,44,45,45,45,45,45,45,45,44,34,34,46,47,154,156,36,31,23,9,14,14,20,20,20,20,20,14,20,14,14,14,14,14,14,14,12,35,46,154,168,174,169,135,135,135,127,127,127,135,128,128,141,141,141,141,147,135,135,135,135,173,172,188,167,28,34,34,34,32,34,32,34,32,
+17,17,17,17,17,12,17,17,17,17,17,13,17,17,17,17,17,13,17,17,17,17,17,17,17,17,17,17,17,17,17,18,17,17,29,17,17,17,28,17,17,17,17,28,17,17,29,17,28,17,28,17,17,28,17,28,17,17,28,28,28,28,28,28,17,28,28,28,28,28,28,28,28,28,28,28,28,28,28,32,28,28,32,28,28,32,32,28,32,34,34,29,32,34,32,34,32,34,32,32,34,34,34,34,34,39,34,39,39,39,39,44,39,39,44,44,44,34,32,34,17,240,17,229,228,102,33,49,49,39,32,59,61,44,39,44,34,34,34,34,44,34,34,34,34,34,34,33,34,34,32,34,32,34,34,33,32,32,32,32,33,34,34,28,34,34,34,34,34,34,34,29,23,142,168,24,18,105,47,142,169,151,30,236,78,6,35,34,34,34,34,32,33,33,33,33,34,39,39,39,39,44,39,39,44,39,44,44,39,44,39,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,39,44,44,44,44,44,45,45,45,45,44,34,34,35,36,154,155,154,31,22,22,20,22,20,14,20,20,20,20,20,30,20,20,20,20,29,35,39,34,47,160,175,177,169,135,135,135,135,171,177,186,186,187,187,186,186,179,171,171,141,141,141,152,29,34,34,34,34,34,34,32,32,
+17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,13,17,17,17,12,17,17,17,17,17,17,17,18,17,17,17,18,17,17,28,17,28,17,17,28,17,28,28,28,17,28,28,17,29,18,17,28,17,28,17,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,32,28,28,28,32,34,34,29,32,29,32,34,34,34,33,34,33,34,34,34,34,34,34,39,34,34,44,34,39,39,39,44,44,34,34,28,5,240,78,212,109,102,62,18,39,59,65,34,39,34,44,34,44,34,34,34,33,34,33,33,34,34,32,34,32,34,32,32,32,29,34,34,32,34,32,32,34,32,28,34,32,34,34,29,34,28,20,20,20,5,17,235,229,6,8,240,59,235,82,4,34,34,34,39,39,39,39,34,39,39,34,39,44,44,39,44,44,39,44,39,34,44,44,44,44,44,34,44,34,44,34,44,34,44,44,34,34,44,44,44,34,44,44,34,44,34,44,44,44,44,44,44,44,44,39,44,39,44,44,39,44,44,44,44,34,34,34,46,47,31,31,24,23,23,23,22,22,22,22,23,23,23,23,23,31,36,30,36,30,30,22,31,167,188,188,191,191,191,204,190,183,181,162,154,153,156,155,167,184,187,186,186,186,20,28,34,34,34,32,34,34,32,
+17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,18,17,17,17,17,17,28,17,17,28,17,17,17,28,17,17,28,17,28,17,28,28,17,18,28,17,18,28,17,17,28,17,29,28,28,28,17,28,28,28,28,28,28,28,17,28,28,28,28,28,28,28,28,28,32,28,28,28,28,32,32,32,32,32,28,33,32,32,32,32,32,32,29,28,32,34,32,34,33,34,32,34,32,34,34,34,34,34,44,34,39,44,44,44,34,28,240,240,44,97,97,62,44,49,59,34,34,34,34,34,34,34,34,34,34,34,34,34,34,32,34,34,32,34,34,34,34,32,32,32,32,28,28,34,28,34,29,34,29,29,28,29,32,34,28,33,19,5,44,234,118,4,18,5,64,228,72,4,34,34,34,34,34,34,34,34,34,34,34,34,34,34,44,39,34,44,34,44,44,44,44,34,44,34,44,34,44,34,34,34,34,34,34,44,34,44,34,34,44,34,34,34,44,34,34,34,44,44,34,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,34,33,44,35,35,23,31,31,31,24,24,24,24,23,23,24,24,24,24,24,24,24,31,31,138,16,16,31,151,36,15,2,9,9,9,15,15,23,23,23,16,16,120,151,167,190,20,32,34,32,34,32,32,32,32,
+17,17,12,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,18,17,28,17,18,28,17,29,17,29,17,28,17,17,17,29,17,17,17,17,29,28,28,17,28,28,17,28,28,28,17,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,32,28,32,28,28,28,32,32,32,32,32,28,32,32,32,32,32,32,32,32,32,34,32,34,34,32,34,34,34,33,34,34,34,34,34,44,34,32,17,240,240,62,65,39,34,32,34,33,33,34,34,34,34,34,32,32,34,32,34,32,34,34,32,32,34,32,33,32,32,28,32,28,33,28,33,32,28,32,32,32,28,28,32,34,34,29,29,29,240,62,234,102,4,12,240,106,235,71,5,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,44,34,34,44,34,34,34,34,34,34,44,34,34,34,44,34,34,34,34,34,34,34,34,44,34,44,34,44,34,34,44,44,34,44,44,44,44,34,44,44,44,44,34,44,34,44,44,44,34,44,44,34,44,44,35,35,35,30,30,30,31,31,24,24,23,24,24,24,31,24,23,22,30,22,22,20,20,30,30,22,22,22,22,23,23,24,24,24,24,24,23,20,12,28,34,28,34,32,32,32,32,32,
+12,17,17,12,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,13,17,17,17,18,17,17,17,17,17,17,28,13,17,18,17,17,17,17,17,17,17,17,18,17,17,17,17,17,17,17,18,17,17,28,28,28,17,17,28,17,28,28,28,28,17,28,28,28,17,28,28,28,28,28,28,28,28,28,28,28,28,32,28,28,28,28,28,28,28,28,32,32,28,28,28,32,32,32,32,28,32,32,32,32,32,32,32,32,32,34,32,32,34,33,34,34,34,34,34,32,34,34,33,39,34,34,39,39,17,32,39,32,34,34,34,34,32,34,32,32,34,34,34,29,34,32,34,33,32,32,32,32,32,28,28,32,28,32,28,28,32,28,28,28,28,28,32,32,28,28,28,28,32,34,29,34,83,90,49,29,29,17,112,116,65,12,34,28,34,34,32,34,32,34,34,34,32,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,33,34,34,34,34,34,34,34,34,34,34,34,34,44,34,34,34,34,44,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,33,34,34,34,39,39,45,35,39,35,39,39,39,35,34,39,34,39,39,35,20,20,20,20,30,22,30,22,22,20,22,20,20,29,28,29,34,34,34,32,28,32,28,28,32,
+17,17,17,17,17,17,17,12,17,17,17,12,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,28,17,17,17,17,28,28,17,28,17,29,17,29,17,17,17,28,29,17,28,28,17,28,17,28,28,28,18,28,28,17,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,32,28,28,28,28,28,28,32,32,28,28,32,28,28,32,28,32,32,32,32,32,32,32,28,32,32,32,32,34,32,34,32,34,32,34,44,34,28,34,34,34,33,32,32,32,34,34,34,32,32,32,33,33,28,32,28,28,32,28,32,32,32,32,28,28,32,32,28,28,32,28,28,28,28,28,32,32,28,28,28,28,28,28,32,4,70,61,55,28,29,34,97,34,49,28,34,34,28,34,29,34,34,32,28,34,34,32,32,32,34,34,34,32,34,34,34,34,33,34,34,34,34,34,34,34,34,32,34,34,34,34,34,34,34,34,34,34,34,32,34,33,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,33,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,19,34,34,34,34,29,34,29,29,29,29,29,29,32,29,29,29,32,34,32,32,32,32,32,32,32,28,
+17,17,12,17,17,17,17,17,17,17,17,17,17,12,17,12,17,17,17,17,17,17,17,17,17,12,17,28,10,17,17,17,17,17,28,17,17,17,17,28,17,28,17,28,17,17,17,17,28,17,17,17,17,28,28,17,17,17,28,17,28,28,28,17,18,17,17,17,28,28,28,17,28,28,28,28,28,28,28,17,28,28,28,28,28,17,28,28,28,28,28,28,28,28,28,28,28,32,28,28,28,28,28,28,32,32,28,28,32,32,28,32,28,28,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,28,32,32,32,32,32,32,32,34,32,32,28,28,32,28,32,32,32,28,32,28,28,32,28,32,28,28,28,28,28,32,28,28,28,28,28,28,28,32,28,28,28,28,28,28,32,61,44,28,28,17,70,66,44,28,32,32,32,28,32,32,32,34,32,32,28,34,34,34,34,32,32,34,34,32,34,32,34,32,34,32,34,32,34,32,32,34,32,32,32,34,32,34,32,34,32,34,34,34,34,34,34,34,34,34,34,34,32,34,34,34,34,34,32,34,32,34,34,34,34,34,32,34,34,34,32,34,34,32,34,32,34,32,34,32,34,34,34,34,34,34,34,34,32,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,29,34,34,34,32,32,28,32,32,32,28,28,28,28,28,32,
+10,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,12,12,17,17,13,28,17,17,28,17,17,17,18,17,18,17,13,17,17,18,17,29,17,29,17,17,28,17,29,28,28,17,28,17,17,18,17,28,17,18,17,17,28,17,28,28,28,17,28,28,17,28,28,28,28,17,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,32,28,28,28,28,28,28,32,32,28,32,28,32,28,32,32,32,32,32,28,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,28,32,28,28,32,32,28,32,32,32,32,32,28,28,28,28,28,28,28,28,28,28,28,28,28,32,28,28,28,28,28,32,28,28,28,28,28,28,28,32,28,28,33,28,32,28,32,28,32,28,32,32,32,32,28,32,32,32,32,32,32,34,34,32,34,32,34,32,34,32,34,32,34,32,34,34,34,32,34,34,32,34,32,34,32,32,34,32,34,32,34,32,34,32,34,34,32,34,34,34,34,34,32,34,34,34,34,34,32,34,32,34,32,34,32,32,34,32,34,34,34,34,34,34,34,34,32,34,34,34,32,34,32,34,34,34,32,34,34,34,32,34,32,32,32,32,28,32,28,34,28,32,32,28,32,28,28,32,32,32,28,28,28,32,28,28,28,
+17,17,17,17,17,17,17,12,17,17,17,17,12,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,13,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,28,28,17,17,28,17,28,17,28,17,28,28,17,28,17,28,17,28,28,28,17,17,28,28,28,28,28,28,28,17,28,28,28,28,28,28,28,28,28,28,28,28,28,32,17,28,28,28,28,28,28,28,28,32,32,28,28,32,28,32,32,32,28,28,28,28,28,32,28,32,28,32,32,32,32,32,32,28,28,32,32,32,28,28,32,32,32,32,32,32,32,32,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,32,28,28,28,28,28,17,28,28,28,28,28,28,28,32,28,32,28,28,28,32,28,32,32,32,28,28,28,32,28,32,32,32,32,32,28,32,32,32,32,34,32,34,32,34,34,32,34,32,34,32,32,32,32,32,32,34,32,34,32,34,32,34,32,32,34,32,32,32,32,32,32,34,32,32,34,32,34,32,34,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,34,32,34,34,32,34,32,34,32,34,32,32,32,32,32,32,32,32,32,28,32,28,32,28,28,32,28,28,32,32,32,28,32,28,32,28,28,32,32,28,28,32,28,32,
+12,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,12,17,17,17,17,17,17,17,17,17,17,17,17,18,17,17,17,17,17,17,17,17,17,17,18,17,17,17,17,17,28,17,17,29,17,28,17,17,28,17,28,17,28,17,17,17,28,17,28,28,17,17,28,28,28,28,17,17,28,28,28,29,17,17,28,28,28,28,28,17,28,28,28,28,28,17,28,28,28,28,28,17,28,28,28,28,17,28,28,28,17,28,28,32,28,28,32,17,32,17,28,32,32,28,28,28,32,28,32,32,32,32,28,32,28,32,32,28,28,32,32,32,32,28,28,32,28,32,28,28,32,32,32,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,32,17,28,28,17,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,32,32,28,28,28,28,32,32,28,28,32,32,28,28,32,32,28,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,28,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,28,32,28,32,32,28,32,32,28,28,28,32,32,28,17,32,32,32,17,28,32,28,17,28,28,
+17,17,12,17,17,12,17,17,17,12,17,17,17,17,17,17,17,17,17,17,12,17,12,17,17,17,17,17,17,17,17,17,17,18,17,17,17,17,17,18,17,17,28,17,17,17,29,17,17,17,17,17,18,28,28,17,17,28,28,28,28,17,28,17,28,28,17,28,28,17,17,28,17,28,28,17,28,28,17,28,28,17,28,28,28,17,28,28,28,28,28,28,28,28,28,17,28,28,28,28,28,28,28,28,17,32,28,28,17,28,17,32,28,28,28,28,28,17,28,17,32,28,28,28,32,28,28,28,17,32,32,32,28,28,32,28,28,32,28,32,28,28,32,32,28,28,28,28,32,32,32,32,28,28,28,28,28,17,28,28,28,28,28,28,17,28,28,28,28,32,17,28,17,28,17,28,28,28,28,28,28,28,28,28,32,28,32,28,28,28,28,32,28,28,32,28,32,32,28,28,32,32,28,32,32,32,32,32,28,32,32,32,32,32,32,28,32,32,32,28,32,32,32,28,32,32,32,28,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,28,32,32,32,32,32,28,28,32,32,32,32,28,32,28,28,28,28,17,32,28,28,17,32,28,32,28,17,32,28,28,17,32,28,28,17,
+17,12,17,17,17,17,17,17,12,17,12,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,13,17,18,17,17,17,17,28,17,28,17,17,17,17,17,28,17,17,17,17,17,17,28,17,17,17,28,17,17,28,17,17,28,17,28,28,28,17,28,17,28,28,17,28,28,28,28,28,17,28,17,28,28,17,28,28,28,28,17,28,28,28,28,17,28,17,28,17,17,28,28,17,28,28,28,28,28,17,28,17,32,28,28,28,28,28,17,17,32,28,17,28,32,28,32,28,17,32,28,28,28,28,28,28,28,28,28,32,28,28,32,28,28,32,17,32,28,28,28,28,28,17,28,28,28,28,17,28,17,28,28,28,17,28,17,28,28,28,28,28,28,28,28,17,28,28,17,32,28,28,28,28,28,32,28,32,28,28,28,28,28,28,28,32,28,28,28,32,32,28,32,32,28,32,32,32,32,32,28,32,32,32,28,28,28,32,28,32,32,32,32,28,32,32,32,28,32,28,32,32,32,32,32,32,32,32,32,32,32,28,32,32,28,32,32,32,32,32,32,32,28,32,32,32,32,32,28,32,28,28,32,32,32,28,32,28,32,32,32,28,28,28,28,32,32,32,28,28,17,32,28,32,28,28,32,32,28,17,32,28,32,28,17,32,28,28,28,17,28,28,32,17,32,
+17,17,12,17,17,17,12,17,17,17,17,17,17,12,17,17,12,17,17,17,12,17,17,12,18,17,17,17,12,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,28,17,17,28,17,17,28,17,28,17,28,17,28,28,17,28,28,17,17,28,17,28,17,28,17,28,17,28,28,17,28,28,28,28,28,28,28,17,28,17,28,28,28,28,17,28,28,17,28,28,28,28,17,28,17,28,17,32,17,28,28,28,32,17,17,32,17,32,17,28,28,32,28,28,32,17,28,17,28,28,17,28,32,28,28,17,28,32,28,28,28,32,28,28,32,17,28,28,17,28,32,28,32,28,28,17,28,17,28,28,28,28,28,17,28,28,28,28,28,17,28,17,28,28,17,28,28,28,28,28,28,28,28,28,28,28,28,28,17,28,28,28,28,28,28,28,32,32,17,32,28,28,28,28,32,32,28,32,28,28,32,32,28,32,28,28,28,28,32,32,32,28,28,32,32,28,32,32,32,28,32,32,32,32,32,32,28,32,32,32,32,32,32,32,32,32,32,32,32,28,32,32,32,32,17,32,32,32,32,32,28,32,28,32,32,32,32,32,32,28,32,32,32,32,32,32,32,17,32,32,32,32,28,32,17,32,17,17,17,32,28,17,28,17,28,32,17,32,17,28,28,28,17,28,28,28,
+17,17,17,12,17,12,17,10,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,13,17,17,28,13,17,29,17,17,17,18,17,28,28,17,17,28,17,17,28,17,28,17,28,17,17,28,17,28,28,17,28,28,28,28,17,28,28,17,28,17,28,17,28,28,28,28,28,17,28,17,28,28,17,28,28,17,17,17,28,28,17,28,17,28,17,32,17,32,17,28,28,28,17,28,17,28,17,28,17,32,17,28,28,28,32,17,28,28,28,17,28,28,28,28,17,28,17,28,32,28,17,28,28,28,28,28,28,17,28,17,28,28,28,28,28,17,28,17,28,28,28,28,17,28,17,28,28,28,28,28,28,28,17,28,28,17,28,17,28,17,28,17,28,28,28,28,28,28,17,32,28,32,28,17,28,28,28,28,32,28,32,28,32,28,32,32,28,28,28,28,17,28,32,28,28,17,28,32,32,32,28,28,32,17,28,28,32,32,17,28,32,32,32,32,32,28,28,32,28,32,32,17,28,32,17,32,32,32,17,32,32,32,32,17,32,28,28,32,28,28,28,32,17,28,32,32,32,17,32,17,32,32,17,32,32,28,32,17,32,17,28,28,28,28,32,17,17,32,17,28,17,32,17,28,17,32,17,28,17,32,17,17,17,
+17,12,17,17,17,17,17,12,12,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,12,17,17,17,17,17,17,18,17,17,17,17,13,28,17,28,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,28,17,17,28,17,17,28,28,17,17,28,17,28,17,17,28,17,17,17,17,28,17,17,28,17,28,28,28,28,17,28,17,28,28,28,17,28,17,28,28,17,28,28,28,17,28,17,28,28,17,28,17,28,17,28,17,28,17,32,17,28,17,28,17,28,28,17,28,17,32,17,28,28,17,28,28,17,28,17,28,28,28,28,28,17,28,28,28,28,32,28,28,28,28,28,28,28,28,17,17,28,28,28,28,28,17,28,17,28,17,28,28,17,28,17,28,17,28,28,28,17,28,28,28,28,28,28,28,28,28,28,28,28,28,28,32,17,32,28,28,28,28,17,32,17,28,28,28,28,32,28,17,28,17,32,28,28,28,28,17,32,28,32,32,17,32,17,32,32,28,32,17,32,28,28,32,32,28,28,17,32,32,28,17,28,32,17,28,32,32,28,28,17,32,28,28,17,32,28,32,28,32,32,17,28,28,32,32,28,28,28,17,32,32,32,28,32,17,28,32,17,32,17,32,28,32,32,17,32,17,17,32,28,17,17,28,17,17,17,32,17,17,28,17,28,17,28,28,28,
+17,17,17,12,17,17,17,17,17,17,17,17,17,12,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,18,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,18,17,17,18,17,17,18,28,17,17,17,17,28,17,28,17,17,28,17,17,28,17,29,17,28,17,28,28,28,17,17,18,28,28,17,28,28,28,28,28,28,17,28,28,28,28,28,17,28,28,28,17,28,17,28,17,17,28,17,28,28,17,17,28,17,28,28,17,28,17,28,17,28,28,17,28,17,28,17,28,17,28,17,28,28,17,28,17,28,28,28,28,28,28,17,28,17,28,28,28,17,28,17,28,28,28,17,28,17,28,17,28,28,28,17,28,28,17,28,17,28,28,28,28,17,28,28,28,17,28,28,28,17,28,17,28,17,28,28,17,28,17,28,17,28,17,28,17,28,28,28,17,28,17,28,28,28,28,28,28,17,28,17,28,32,28,28,28,28,28,17,28,28,28,17,28,17,28,28,28,28,17,28,17,32,28,32,17,32,17,32,28,32,32,17,32,28,32,32,28,32,32,17,17,32,32,32,28,17,32,28,32,17,32,17,28,28,32,32,32,17,32,28,32,32,28,28,17,32,17,32,32,17,28,17,32,17,17,28,17,32,17,28,28,17,17,17,28,17,28,17,28,17,17,28,28,17,17,17,28,17,17,
+17,12,17,17,12,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,12,17,17,17,17,18,17,17,17,17,18,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,18,17,17,28,28,17,28,17,18,17,17,29,17,28,28,28,17,29,17,17,17,28,28,28,17,28,17,17,17,28,17,28,17,28,17,28,28,17,28,28,17,28,17,28,28,17,28,17,17,28,28,17,28,17,17,28,17,28,17,28,17,17,28,17,28,17,28,17,28,17,28,17,17,28,17,28,28,17,28,28,17,28,28,28,28,28,17,28,28,28,28,17,28,28,28,28,17,28,28,28,17,28,28,28,17,28,17,28,17,17,17,28,28,17,28,17,28,28,17,17,28,28,28,28,17,28,17,28,28,28,28,28,28,28,28,28,28,17,28,28,28,28,17,28,28,17,28,17,28,17,28,28,28,17,28,17,28,28,32,17,17,28,17,28,28,32,17,28,17,28,17,28,28,17,28,32,17,28,17,32,17,32,28,17,32,17,17,32,17,28,28,28,17,28,17,28,32,17,32,17,28,32,32,32,17,28,17,28,32,17,32,17,32,17,32,17,28,32,17,17,32,28,28,17,32,32,17,28,17,28,17,17,28,17,28,17,17,28,17,17,28,28,17,17,28,28,17,28,17,28,
+17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,18,17,17,17,17,17,28,18,17,17,17,17,17,17,28,28,17,28,17,17,29,17,28,17,17,28,17,28,28,28,28,17,28,28,17,28,17,28,17,17,28,17,28,17,28,17,28,28,17,28,28,17,28,17,28,28,17,28,28,17,28,17,28,17,28,17,28,17,28,17,28,17,28,28,28,17,28,17,17,28,17,28,28,17,28,17,28,28,28,17,28,17,28,32,17,28,17,28,28,17,28,17,28,17,17,28,28,28,17,28,28,28,28,17,28,17,28,28,17,28,28,28,17,17,28,28,28,17,28,17,28,17,28,17,28,17,17,28,28,28,17,28,17,28,28,17,28,17,28,17,28,28,17,32,17,28,28,28,17,17,28,28,17,28,17,17,17,17,28,17,32,17,28,17,32,17,28,17,28,17,32,17,32,17,32,17,28,32,32,17,28,17,28,32,17,28,32,17,28,32,17,32,17,17,28,17,32,17,32,17,28,32,28,28,17,28,28,32,17,28,32,17,17,17,28,17,17,28,17,28,17,17,28,17,17,28,17,17,28,17,28,17,17,17,28,17,17,17,28,17,28,17,
+12,17,17,12,17,17,12,12,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,13,17,17,18,17,17,18,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,28,17,17,17,17,17,28,17,17,17,17,28,17,28,28,17,28,17,17,28,17,28,17,28,28,28,28,17,28,17,28,17,17,28,17,28,17,28,17,28,17,17,28,17,28,17,17,28,17,28,17,28,28,17,28,17,28,28,28,17,28,17,17,17,28,17,28,28,17,28,17,28,28,17,28,28,17,28,28,28,28,28,17,28,28,28,17,28,28,17,28,28,17,28,17,17,28,28,28,17,17,28,28,28,28,28,17,28,17,17,17,28,28,17,28,17,28,28,28,17,28,17,28,17,28,17,28,28,17,28,28,28,17,28,28,17,28,28,28,17,28,28,17,28,28,17,17,28,28,17,28,28,28,28,28,28,28,17,28,17,28,17,28,17,17,28,28,17,28,28,17,28,17,28,17,28,17,17,28,17,28,28,17,28,28,17,28,17,28,28,17,28,28,17,28,17,28,28,17,28,17,17,28,28,17,32,17,28,17,17,28,28,28,28,17,28,17,28,17,17,28,17,28,28,17,28,17,17,28,17,17,28,28,28,17,28,17,28,17,28,17,
+17,12,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,12,17,12,17,17,17,17,17,17,17,17,17,17,17,17,18,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,18,17,17,28,17,17,18,17,17,28,17,17,28,28,17,28,17,29,17,18,28,17,17,28,28,17,17,28,17,17,17,18,28,17,17,28,28,28,17,28,17,28,17,17,28,17,28,28,17,17,17,28,17,28,17,17,28,17,28,17,28,17,28,17,28,28,17,17,28,17,28,17,17,17,28,28,17,28,28,17,17,28,17,17,28,17,28,17,28,17,17,28,17,28,17,28,17,28,28,17,28,17,28,17,28,28,17,17,28,17,28,28,17,17,28,17,28,17,17,28,17,28,17,28,28,28,28,17,28,17,28,17,28,17,28,17,28,17,28,17,28,17,17,28,17,28,17,28,28,17,28,28,17,17,28,17,17,17,32,17,17,28,28,17,28,17,28,17,28,17,17,17,28,17,28,17,17,28,17,28,17,17,17,28,17,17,28,17,28,17,28,17,28,28,17,28,17,28,17,17,28,17,32,17,17,17,28,17,17,28,17,28,17,28,17,28,28,28,17,17,28,17,28,17,28,28,17,17,17,28,28,17,28,17,28,17,28,17,17,17,17,28,17,17,28,28,17,17,17,17,17,17,17,28,17,28,
+17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,28,17,18,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,28,28,18,17,18,17,17,17,28,29,17,17,17,28,17,17,17,28,17,28,17,17,28,17,17,28,17,17,28,17,17,17,28,17,28,28,28,17,17,28,17,28,17,28,17,28,17,28,28,17,28,28,28,17,17,28,28,17,28,17,28,17,28,28,17,28,17,28,17,28,28,17,28,28,17,28,28,28,17,28,28,28,17,28,17,28,28,28,17,28,17,17,17,17,28,28,17,28,28,17,17,28,17,28,17,28,17,28,17,28,17,28,17,28,17,28,17,28,17,28,17,28,28,28,28,17,28,28,17,28,17,17,28,17,28,28,28,28,17,28,28,17,28,28,28,17,28,17,17,28,28,17,17,28,17,28,28,17,17,28,17,28,28,17,28,28,17,17,28,17,17,28,17,17,17,28,17,28,28,28,17,28,17,28,28,17,28,17,28,17,28,17,28,28,17,17,17,17,28,28,17,28,17,28,17,17,28,28,28,17,17,28,28,17,28,28,17,28,28,17,28,17,28,28,17,17,28,17,28,17,28,17,17,28,17,17,
+17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,29,17,17,17,17,17,17,17,17,18,17,17,17,17,29,17,17,17,17,28,28,17,28,17,17,17,17,17,17,17,17,17,28,29,17,17,17,17,17,17,28,17,28,17,28,28,28,28,28,17,28,17,28,28,17,17,17,28,17,28,17,17,17,17,28,17,28,28,17,28,17,28,17,17,17,17,28,17,17,17,28,17,17,17,17,17,28,17,28,17,17,28,17,28,17,28,17,28,28,17,28,28,17,17,28,28,17,28,17,28,17,28,17,17,17,28,28,28,17,28,17,17,17,28,17,28,28,17,28,28,17,28,17,28,28,28,17,28,17,28,17,28,17,28,17,28,17,28,17,17,17,28,17,28,17,28,28,17,28,17,28,17,17,17,28,17,17,28,17,17,17,17,28,17,28,17,17,28,28,17,28,17,17,17,28,17,17,17,17,28,17,17,17,28,17,17,28,28,17,28,17,28,17,28,17,17,28,28,17,28,17,17,28,17,28,17,28,17,28,17,28,28,28,28,17,17,17,28,17,17,28,28,29,17,17,28,28,28,17,17,28,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
+17,12,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,12,17,17,17,17,17,17,17,13,28,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,18,17,28,28,17,28,28,28,17,28,17,28,17,17,28,28,17,17,17,29,17,17,17,17,17,28,28,28,17,28,17,17,28,28,17,28,17,17,17,28,17,28,28,28,17,17,28,28,28,28,17,28,17,28,28,17,17,28,28,17,28,28,17,28,17,17,28,28,28,17,28,17,28,17,28,17,28,28,28,17,17,17,28,17,28,17,28,17,17,28,17,17,28,17,28,17,28,17,17,17,28,17,28,17,28,17,28,17,28,17,28,17,28,28,17,28,28,28,17,28,17,28,17,17,17,28,17,28,17,28,28,17,17,17,17,28,17,17,17,17,17,17,17,28,17,17,17,28,17,28,17,28,17,17,17,17,17,28,17,28,17,17,28,17,28,17,28,28,17,28,17,17,17,17,28,28,17,17,28,17,17,28,17,17,17,17,17,17,28,17,28,17,28,17,28,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,
+17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,13,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,28,17,17,17,28,17,28,17,17,28,17,17,17,28,17,17,18,17,17,17,18,17,17,17,17,17,28,28,17,17,28,28,28,17,17,17,17,17,17,17,17,28,17,28,17,17,17,28,17,17,17,17,17,17,28,17,28,17,17,17,17,17,17,28,17,17,17,17,28,17,28,28,28,17,17,28,17,28,17,17,28,17,17,28,28,28,17,28,17,28,17,28,17,28,17,17,17,17,28,28,28,17,17,17,17,28,17,28,17,17,28,17,17,17,28,17,28,28,28,17,17,28,17,28,17,28,17,28,17,28,17,17,28,17,17,17,17,17,17,17,28,17,28,17,28,28,17,28,17,17,28,17,17,17,17,17,17,17,17,28,17,17,28,17,17,17,17,17,17,17,17,17,28,17,17,17,17,28,17,17,17,17,17,28,17,17,28,17,17,17,17,28,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,28,17,28,17,28,17,17,17,17,17,28,17,17,28,28,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,
+17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,12,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,18,17,17,17,17,17,17,18,17,17,17,28,28,13,17,17,28,28,17,17,28,17,17,17,17,17,17,17,17,28,17,17,28,17,17,28,28,17,18,17,17,17,28,17,17,17,28,17,17,28,17,28,28,17,17,28,17,28,28,17,17,17,28,28,28,28,28,28,28,17,17,28,17,17,17,17,28,28,17,17,28,28,17,28,28,28,17,17,17,28,17,17,17,28,28,28,17,28,17,28,17,17,28,28,17,17,17,17,17,17,17,17,28,17,28,28,28,17,28,17,28,17,28,28,17,17,28,28,17,28,17,17,17,28,17,28,17,28,28,17,28,28,17,17,17,28,17,17,17,28,17,28,17,28,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,28,17,17,17,28,17,28,28,28,28,17,17,28,17,28,28,17,17,28,17,17,28,17,17,17,17,17,28,17,17,17,17,28,17,17,28,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,
+17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,12,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,28,13,17,17,17,17,17,17,17,17,17,17,17,28,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,18,17,17,17,17,17,28,17,29,17,17,17,17,17,28,28,17,17,28,17,17,17,17,17,28,17,17,17,17,28,17,17,17,17,17,28,17,28,17,28,17,17,17,17,17,17,17,28,17,17,28,17,17,17,28,28,28,17,17,17,28,17,17,28,17,17,17,28,28,28,17,28,17,28,13,17,17,17,28,17,28,28,28,28,17,28,17,17,17,17,17,28,28,17,17,17,17,28,17,28,13,17,17,28,17,28,17,28,17,17,28,17,28,17,17,28,17,28,17,17,28,17,17,17,17,17,28,17,17,17,17,17,17,17,17,28,28,17,28,17,17,17,28,28,17,17,17,17,28,17,17,17,28,17,28,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,17,28,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,
+17,17,17,12,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,13,28,17,17,17,17,17,13,28,17,17,17,17,28,17,17,17,17,17,17,28,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,28,28,17,17,28,17,17,17,17,17,17,17,17,18,17,17,17,17,17,13,17,17,17,28,17,17,17,17,28,17,17,17,28,17,28,17,28,17,17,17,17,17,17,17,17,17,17,17,17,28,28,17,17,17,17,17,28,17,17,17,28,28,28,28,17,17,17,13,17,28,28,28,17,17,17,17,13,28,17,17,28,17,28,17,17,17,17,17,28,17,28,28,17,28,17,28,17,17,28,17,28,17,17,28,17,17,28,17,17,17,17,17,28,17,17,28,28,28,17,17,17,17,28,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,12,17,17,17,17,
+17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,12,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,13,28,17,17,17,13,17,17,17,17,17,18,17,28,28,17,28,17,17,17,17,17,17,17,28,17,28,17,17,17,17,17,17,17,28,17,17,17,17,17,28,28,17,17,28,17,17,28,28,17,17,17,17,17,17,17,17,28,17,17,28,17,17,28,17,17,28,17,17,17,28,17,17,28,17,17,17,28,17,28,17,28,17,17,17,17,17,17,13,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,17,28,28,17,28,17,28,17,28,17,17,28,17,28,17,17,28,17,28,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,12,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,
+17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,12,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,28,17,17,17,17,17,13,17,17,17,17,17,17,13,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,13,17,28,13,17,18,17,18,17,17,28,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,28,17,17,28,17,17,17,17,17,17,17,28,28,17,17,28,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,28,17,17,17,17,17,17,28,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,17,13,17,17,17,17,28,17,17,17,28,17,17,28,17,28,17,28,17,17,28,17,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,28,17,28,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,10,17,12,17,10,17,17,17,17,
+17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,13,17,17,17,17,17,17,17,17,28,17,17,17,17,13,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,28,13,17,17,17,17,17,17,17,17,18,17,17,28,17,17,28,28,17,17,17,17,17,28,17,17,28,28,17,17,17,17,17,28,29,17,17,17,17,17,17,28,28,28,17,17,28,17,17,17,28,17,17,17,17,17,17,17,17,17,28,13,17,17,28,17,17,17,28,28,17,28,17,28,28,17,17,28,28,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,12,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,12,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,10,17,17,12,17,17,17,12,17,17,17,17,17,17,17,17,17,17,12,17,17,17,10,17,17,12,17,10,
+17,12,17,17,12,17,17,12,17,17,17,17,17,17,17,17,12,17,17,17,12,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,13,28,17,17,17,17,17,17,17,17,28,17,17,17,18,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,28,17,17,17,17,29,17,28,17,17,17,17,17,17,28,28,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,28,17,28,17,17,28,28,28,17,28,17,17,17,17,17,17,28,17,28,17,17,17,17,17,17,17,17,17,13,17,17,17,17,17,17,17,17,17,17,17,17,17,13,28,17,17,13,28,17,28,17,28,17,13,28,17,28,28,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,10,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,12,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,12,17,12,17,17,17,17,17,17,12,17,12,17,12,17,17,12,17,17,17,17,17,10,17,12,17,17,17,17,
+17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,13,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,13,28,17,17,13,17,17,18,17,17,17,17,17,17,17,17,17,17,17,18,17,28,17,17,17,17,17,17,17,17,28,17,17,17,17,28,17,17,17,17,13,28,17,17,17,17,17,17,17,17,29,17,17,13,17,17,28,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,28,17,17,17,17,28,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,10,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,12,17,17,17,17,17,17,17,17,12,17,12,10,17,17,12,17,10,17,17,17,12,17,
+17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,28,13,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,13,17,17,17,17,17,17,17,28,17,28,17,29,17,17,17,29,17,17,17,17,29,17,17,17,13,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,12,17,17,17,17,17,12,17,12,17,17,17,17,17,17,17,17,10,17,17,17,17,17,17,17,17,10,
+17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,13,17,17,17,13,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,13,17,17,17,28,13,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,28,17,17,17,17,17,17,28,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,12,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,12,17,12,17,17,12,17,17,17,17,12,17,17,17,17,17,17,17,17,10,17,10,17,10,10,17,17,17,
+17,17,17,17,12,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,12,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,28,17,17,17,17,28,17,28,17,17,17,17,13,17,17,17,17,17,17,17,12,17,17,17,17,12,17,17,17,17,17,12,17,17,17,17,12,12,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,10,17,17,12,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,12,17,12,17,10,17,17,12,17,17,12,17,17,17,17,17,17,17,17,12,17,17,10,17,17,17,17,10,17,17,17,17,12,17,17,17,12,17,17,17,17,12,17,10,17,17,12,17,17,10,10,
+17,17,10,17,17,17,17,17,17,17,17,17,12,17,17,17,17,12,17,17,17,17,17,17,17,12,17,17,12,17,17,17,17,10,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,28,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,12,17,17,17,17,17,17,13,17,17,17,17,13,28,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,12,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,12,17,12,17,12,17,17,17,12,17,17,17,17,17,17,12,17,10,17,17,17,12,17,17,12,17,17,12,17,17,12,17,10,17,17,12,17,17,10,17,12,17,17,12,10,17,17,17,17,17,17,12,17,12,17,17,17,17,12,17,10,17,10,17,12,17,17,17,10,17,10,17,17,10,17,12,10,17,17,10,17,17,
+10,17,17,12,17,17,10,10,17,17,12,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,12,17,17,17,17,17,17,17,17,17,17,17,12,17,12,17,17,17,17,17,17,17,12,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,12,17,17,17,17,17,17,12,17,12,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,12,17,12,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,12,10,12,17,12,17,17,17,12,17,17,17,17,12,17,17,12,17,17,12,17,17,12,17,17,10,17,17,12,17,17,17,10,17,17,17,17,12,17,17,10,17,17,17,17,17,17,12,10,17,17,17,12,17,17,17,17,12,17,17,12,17,10,17,12,17,17,10,17,10,17,10,10,
+17,10,17,10,17,10,17,17,10,17,17,17,12,17,17,17,10,17,17,12,17,17,17,17,17,17,17,12,17,17,17,10,17,17,10,17,17,12,17,17,17,17,17,17,17,17,12,17,17,17,12,17,17,17,17,17,17,17,12,12,17,17,17,17,17,17,17,17,17,12,17,10,17,17,17,17,17,17,17,12,17,12,17,17,17,12,17,17,17,12,17,17,17,17,17,17,12,17,17,17,17,17,12,17,17,12,17,17,17,17,17,17,17,17,17,12,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,12,17,17,17,17,17,17,17,12,17,17,17,17,12,17,17,17,17,17,12,17,17,17,17,17,17,12,17,17,17,17,17,17,17,10,17,17,17,12,17,17,17,17,17,10,17,17,17,17,12,17,17,17,17,17,17,17,17,17,17,12,17,17,10,17,12,17,10,10,12,17,10,12,17,17,12,17,17,10,17,17,12,17,12,17,17,10,17,17,17,12,17,10,17,17,10,17,17,12,17,17,17,17,17,17,10,17,17,10,10,17,10,17,
+17,10,10,17,17,17,10,11,17,10,17,10,17,17,17,17,12,17,17,17,17,12,17,10,17,12,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,12,17,17,10,17,17,17,17,17,17,17,17,17,12,17,17,17,12,17,17,12,17,17,12,17,17,17,12,17,17,17,17,12,17,17,17,12,17,17,17,17,17,17,17,17,12,17,17,17,12,17,12,17,12,17,17,12,17,17,17,17,12,17,17,17,12,17,17,12,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,17,12,17,17,17,17,12,17,12,17,12,17,12,17,17,10,17,17,12,10,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,17,17,12,17,17,17,12,17,17,17,12,17,17,12,17,17,17,12,17,17,12,17,17,12,17,12,17,17,17,17,12,17,17,17,17,17,12,10,17,10,17,12,17,12,17,17,17,17,12,17,17,12,17,12,17,10,17,17,17,17,12,17,17,12,17,17,17,17,17,10,12,17,17,17,17,12,17,10,17,17,17,17,17,12,17,12,17,10,17,10,17,12,17,10,17,10,17,17,12,10,17,17,10,10,17,17,17,10,11,
+10,10,17,10,17,10,17,17,11,17,17,17,10,17,17,12,17,17,12,17,10,17,17,17,10,17,17,10,17,10,17,12,17,17,17,12,10,17,17,17,10,17,12,17,17,12,17,17,17,17,17,12,17,12,17,17,12,10,17,10,17,17,17,17,17,17,12,17,17,12,17,17,12,17,12,17,17,17,12,17,17,17,12,10,17,17,12,17,10,17,17,17,12,17,17,17,17,17,17,12,17,17,17,12,17,17,17,12,17,17,12,10,17,17,17,17,12,17,17,12,17,12,17,17,17,17,17,17,12,17,12,17,12,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,17,12,17,12,17,17,17,12,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,12,17,10,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,12,17,17,17,17,17,12,17,17,17,12,17,17,17,12,17,17,17,17,17,17,17,17,12,17,17,17,12,17,17,17,17,17,17,17,17,12,17,17,10,17,17,17,12,17,17,10,17,17,12,17,10,17,17,12,10,17,17,17,17,12,17,17,17,12,17,17,17,10,17,12,10,10,11,17,17,17,10,17,12,17,17,17,10,10,17,12,10,17,10,17,17,12,10,17,10,17,10,17,17,10,10,10,17,10,10,17,10,17,17,10,10,17,10,
+17,17,10,17,10,10,10,10,10,17,10,10,17,12,17,10,17,17,10,17,10,17,10,12,17,17,10,17,10,17,17,17,17,12,17,17,12,17,17,12,17,17,17,12,17,17,17,17,12,17,10,17,17,17,17,12,17,17,10,17,10,17,10,17,12,17,17,10,17,17,12,17,10,17,17,17,17,17,17,17,12,10,17,17,10,17,17,12,17,10,12,17,17,12,17,17,12,17,12,17,17,12,17,17,17,17,12,17,17,17,17,12,17,17,12,17,17,17,17,17,17,12,17,17,17,17,12,17,17,17,17,17,17,17,12,17,12,17,17,12,17,17,12,17,12,17,17,17,12,17,12,17,17,17,17,12,10,12,17,10,17,12,17,12,17,10,12,17,12,17,17,17,17,17,10,17,12,17,17,17,12,10,17,17,12,17,12,17,12,17,17,17,12,17,17,12,17,17,12,17,17,12,17,17,17,12,17,17,17,17,17,12,17,17,17,17,10,17,17,17,10,17,10,17,17,17,17,10,12,17,17,10,17,12,10,17,10,17,10,12,17,12,17,17,10,12,10,17,17,10,12,10,17,12,17,12,17,10,10,10,17,12,17,10,10,17,10,17,10,17,12,17,17,17,10,17,10,17,12,17,17,10,12,17,10,10,17,10,17,12,17,10,12,17,17,17,10,17,17,17,10,17,11,10,10,17,10,10,
+10,17,17,10,17,17,17,10,17,10,17,10,17,17,17,10,10,10,17,10,17,10,17,11,10,17,17,10,17,12,17,12,17,17,10,17,17,12,17,10,17,12,17,17,10,17,17,10,17,10,10,12,17,10,17,17,10,10,17,11,10,17,10,17,17,10,17,17,12,17,17,17,17,12,17,17,10,17,12,17,17,10,12,17,12,10,12,17,17,17,17,12,17,17,12,17,17,17,10,10,17,17,10,12,17,17,17,10,17,10,17,17,10,17,17,10,10,12,17,17,12,17,10,17,12,17,17,12,17,17,12,17,17,17,17,17,17,17,17,17,17,17,17,17,17,10,12,17,17,17,17,17,10,12,17,17,17,17,10,17,17,17,10,17,10,10,17,10,17,10,10,12,17,10,17,10,17,12,17,17,17,12,17,12,17,17,17,17,17,17,12,12,17,17,17,17,12,17,17,17,12,17,12,17,12,17,12,17,10,12,17,17,12,12,12,17,12,10,17,17,17,12,17,12,17,12,17,17,17,10,17,17,17,17,17,10,12,17,17,10,17,17,10,17,17,10,17,17,10,17,10,17,12,17,10,17,10,12,17,10,10,17,11,17,11,10,17,10,10,10,17,10,12,17,10,17,12,17,10,10,17,17,10,17,17,17,10,17,10,17,10,17,10,10,10,10,17,10,10,17,10,17,10,17,17,10,17,10,
+10,11,17,10,11,10,11,17,10,10,17,11,10,10,17,10,17,17,10,17,17,10,10,17,17,11,17,10,10,17,17,17,11,10,11,10,11,17,17,10,10,17,10,10,10,10,11,17,10,17,17,17,10,17,17,11,17,17,10,17,17,10,17,17,10,17,10,11,17,17,10,17,10,17,17,12,17,10,17,17,10,17,10,11,17,17,17,12,17,17,12,17,12,10,17,10,10,10,17,12,17,10,17,10,17,17,12,17,12,17,10,17,12,17,10,12,17,17,17,12,17,10,17,12,10,17,17,17,12,17,17,17,12,17,10,17,12,17,12,10,12,17,17,17,12,17,17,10,12,17,12,10,17,17,10,17,10,10,17,10,10,10,10,17,12,17,10,10,11,12,17,17,17,17,12,10,17,17,17,17,10,17,17,17,12,17,17,12,17,12,17,17,12,12,10,17,17,12,17,12,17,17,10,17,12,12,17,12,17,17,17,12,17,17,17,17,17,17,12,10,17,17,10,17,10,17,17,12,10,17,12,10,10,10,11,17,10,17,12,10,10,17,10,12,17,17,17,12,17,17,10,11,17,10,17,12,10,17,17,12,17,17,10,10,10,17,10,10,17,12,10,17,17,10,10,17,10,10,17,17,10,10,17,10,17,10,10,10,10,10,10,17,17,17,10,17,10,10,17,10,17,10,17,10,17,10,10,10,
+10,10,11,10,10,17,17,10,11,17,10,10,10,17,11,10,17,10,17,17,10,17,17,10,10,10,11,10,17,10,17,10,10,17,10,17,17,10,11,17,10,17,10,17,17,17,10,10,17,17,10,10,17,17,10,10,17,10,17,10,11,10,17,10,17,10,17,10,17,12,10,12,10,17,10,17,10,17,10,11,10,12,17,10,11,10,11,17,12,10,17,17,10,10,17,12,17,17,17,10,12,10,12,10,10,11,17,12,17,12,11,17,17,10,10,17,17,12,10,17,12,12,10,17,12,17,17,12,17,17,12,17,17,12,17,17,17,17,17,10,17,17,12,10,17,17,10,10,17,10,17,12,17,12,17,12,10,17,12,10,17,17,12,17,10,10,11,17,10,11,17,10,17,10,17,17,12,17,12,10,17,12,17,10,17,17,12,17,17,17,17,12,17,17,12,10,10,17,17,17,17,17,12,17,17,17,17,17,17,12,17,17,17,12,12,17,10,10,17,17,12,17,12,17,10,17,12,10,17,10,17,17,17,10,17,10,17,10,17,17,17,10,10,17,10,17,10,17,17,10,10,10,12,17,10,11,17,10,10,17,10,10,17,10,12,17,10,10,17,10,17,12,17,10,17,17,10,10,17,11,10,17,10,10,17,10,11,17,10,10,17,10,10,10,11,10,10,17,11,17,10,10,17,10,10,11,17,17,
+10,17,10,17,17,10,10,11,10,10,11,17,11,10,10,17,10,10,10,10,17,11,11,10,17,17,10,17,10,17,10,17,10,17,10,10,10,17,10,17,11,10,17,10,10,11,10,17,11,10,17,10,11,10,17,17,17,10,10,17,10,17,17,10,17,10,10,17,10,17,17,11,17,10,17,10,17,10,17,10,17,17,10,10,17,11,17,10,17,12,17,10,12,17,10,17,10,12,10,17,17,17,10,17,10,11,10,17,17,10,10,17,10,17,12,17,10,17,17,10,17,10,10,17,10,10,17,12,17,10,17,10,10,17,10,12,17,10,12,17,10,17,17,17,10,10,17,12,17,10,17,17,17,17,12,17,17,10,17,17,10,17,10,17,11,10,10,11,10,12,11,10,12,10,12,17,10,10,17,12,10,17,12,17,12,17,17,10,17,10,17,17,12,17,17,10,12,17,10,17,12,10,17,12,10,17,10,12,17,17,12,17,17,17,17,10,12,17,11,10,17,10,17,10,12,17,17,10,17,11,10,10,10,17,10,17,10,11,17,11,10,17,11,10,10,12,17,11,10,17,12,17,10,10,17,10,17,17,11,10,17,10,10,17,11,12,17,10,17,11,17,10,10,11,17,10,17,11,10,10,17,11,17,10,10,17,10,10,11,11,11,10,17,17,10,17,11,10,10,10,17,10,11,10,11,10,11,10,
+17,11,10,10,10,17,10,10,17,10,10,10,17,11,10,11,10,17,11,10,17,10,17,10,11,10,17,10,10,11,10,10,17,10,17,10,17,10,17,17,10,11,10,17,10,17,11,10,10,17,11,17,10,11,10,11,11,17,11,11,17,10,17,10,17,10,17,11,17,11,10,10,11,10,10,17,12,17,10,17,12,17,10,11,10,10,17,11,11,17,10,10,11,10,17,12,17,11,10,12,17,10,12,11,17,10,12,10,17,17,10,10,17,12,17,10,10,10,12,17,10,17,17,12,17,12,17,11,10,12,17,17,10,12,17,10,17,17,17,17,12,10,17,10,17,12,17,10,17,12,17,10,10,17,17,10,12,17,10,10,10,12,10,17,10,17,12,10,17,10,17,10,17,10,17,10,17,17,11,10,10,10,17,10,17,10,12,17,17,12,17,10,17,17,10,10,17,10,17,12,17,10,17,17,12,17,17,17,10,12,17,10,10,10,17,17,17,10,10,17,10,10,10,17,10,10,10,10,17,10,17,10,17,10,17,11,17,10,11,10,11,10,10,17,11,10,17,10,10,17,10,10,17,10,10,17,11,10,17,11,10,17,11,10,17,10,10,17,11,10,17,10,17,10,10,11,11,10,11,10,10,10,10,10,17,10,11,10,10,10,17,10,10,11,10,11,10,17,11,10,10,17,10,17,10,17,10,10,
+10,10,11,17,10,10,17,10,11,10,11,11,10,10,17,10,10,11,10,17,11,10,11,11,10,11,10,11,10,17,10,17,10,10,11,11,17,10,11,10,17,10,10,11,10,17,10,11,17,11,10,10,10,17,10,10,10,11,10,17,10,10,11,17,10,11,17,10,10,10,17,10,17,11,17,12,17,10,11,10,17,11,17,11,10,11,10,10,10,10,17,10,17,10,17,10,17,10,17,10,11,10,11,10,10,12,10,17,12,10,17,10,10,11,17,10,17,12,10,17,12,10,12,10,11,17,10,17,10,11,10,12,17,10,10,17,12,10,12,10,10,17,12,17,10,17,17,10,11,10,17,12,17,10,10,17,10,10,17,10,17,10,17,12,10,10,11,10,11,10,11,10,10,10,10,11,11,11,10,17,10,12,17,12,10,17,17,17,12,10,11,17,12,10,17,12,17,10,12,10,10,12,11,10,17,10,10,10,17,10,11,17,12,17,12,10,10,11,12,10,10,12,17,10,17,12,17,10,11,10,17,10,10,10,11,10,11,10,10,10,10,11,10,17,10,11,17,11,10,10,10,17,10,11,17,10,10,11,10,10,11,10,10,11,10,11,10,11,17,10,10,17,10,11,10,10,11,10,11,11,10,17,10,11,10,17,10,11,10,17,10,10,17,10,10,17,10,11,10,11,17,10,10,10,11,10,10,11,
+10,17,10,11,10,11,10,11,10,11,10,10,10,11,10,10,17,10,10,11,10,10,10,10,10,10,17,10,11,10,11,10,11,17,10,10,11,10,10,10,11,10,17,10,17,10,11,10,10,10,11,10,17,10,17,10,11,10,10,10,10,17,10,10,11,10,10,11,10,17,10,17,10,10,10,10,11,10,11,10,11,10,10,10,11,10,11,17,10,11,10,11,10,11,10,11,10,10,11,11,10,17,10,10,11,10,11,17,10,17,10,12,17,10,10,17,11,10,11,10,11,10,11,17,10,10,10,11,10,11,10,17,10,11,17,10,17,10,17,17,17,10,11,10,17,10,11,17,10,10,17,10,10,11,17,10,10,17,10,12,10,10,17,10,10,11,10,10,10,11,10,17,10,17,17,10,10,10,12,11,12,10,11,17,12,17,10,10,10,17,10,17,10,17,10,10,11,17,10,11,17,10,10,10,12,10,11,17,10,17,10,11,10,11,10,17,10,11,10,17,10,11,10,11,10,10,11,10,11,10,10,11,11,17,10,10,10,11,10,17,17,10,11,10,17,10,10,10,17,10,11,17,10,10,10,10,11,10,11,17,10,11,17,10,10,10,10,10,11,10,10,11,10,10,11,11,10,10,10,10,11,10,17,10,11,10,10,10,10,11,10,11,10,17,10,11,10,17,10,10,10,10,11,11,10,10,17,10,
+10,11,11,10,10,10,11,10,10,10,11,10,11,10,11,10,10,11,10,10,17,10,11,10,11,11,11,10,11,10,10,10,17,11,10,11,10,17,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,10,11,10,11,10,11,10,11,10,17,11,10,10,11,10,11,10,17,10,11,17,11,11,10,11,10,10,10,11,10,11,10,11,10,11,11,10,10,10,11,10,10,10,10,11,10,10,10,11,11,11,10,10,11,10,17,10,11,10,10,11,10,11,10,10,10,11,10,11,10,11,10,12,17,11,10,10,17,11,10,17,10,11,11,17,10,10,11,10,10,10,11,10,10,11,10,17,11,17,10,11,10,17,11,17,10,10,17,11,10,11,10,10,11,10,11,10,10,11,10,11,10,17,10,11,10,10,10,11,10,10,17,10,17,10,11,11,10,10,10,11,10,11,10,12,10,11,11,10,12,17,11,10,12,10,10,12,17,10,12,10,11,10,11,10,10,10,17,10,11,10,11,11,10,17,10,11,10,11,10,11,10,17,11,10,10,11,10,10,17,11,10,11,17,11,10,17,10,11,10,17,11,17,10,17,10,11,10,10,10,11,10,11,10,11,10,10,11,10,10,11,10,10,11,11,17,10,10,10,11,11,10,10,11,10,11,10,11,10,17,10,11,10,11,10,10,17,11,10,10,10,10,10,11,10,
+10,10,10,11,10,11,10,11,10,17,10,11,10,11,10,10,11,10,11,10,11,10,10,11,10,10,10,11,10,11,10,11,10,10,10,11,10,10,11,10,10,11,10,11,10,10,10,10,11,10,10,11,10,11,10,11,10,10,10,11,10,10,11,10,11,11,10,10,11,10,11,10,10,11,10,10,17,11,10,11,11,10,11,10,11,10,11,10,10,11,11,11,10,11,11,10,11,10,11,11,11,10,10,10,17,11,10,17,11,10,10,10,11,10,11,10,17,11,10,10,11,10,10,11,10,11,10,10,11,11,10,10,11,10,11,10,10,11,10,11,10,17,11,10,11,10,11,10,10,11,10,10,11,10,11,11,10,11,10,10,10,11,10,10,11,10,10,11,10,11,10,10,10,10,11,11,10,10,11,10,11,10,10,17,10,10,10,11,10,10,17,10,10,11,10,10,11,10,10,10,11,10,10,11,10,11,10,17,10,17,10,11,11,10,10,11,10,11,10,10,10,11,10,11,10,11,10,10,10,10,11,10,10,11,10,10,10,11,10,10,11,10,10,10,11,10,10,10,11,10,11,10,11,10,10,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,10,11,10,10,11,10,11,10,10,10,11,10,10,11,10,10,10,10,10,11,10,11,10,11,10,11,10,11,10,10,10,11,10,10,
+10,11,10,10,10,10,11,10,11,10,10,10,11,10,10,11,10,10,10,11,10,11,10,10,11,10,11,10,10,11,11,10,11,10,11,10,11,10,10,10,11,10,11,10,10,11,11,10,10,11,10,10,10,11,10,10,11,11,10,10,11,10,10,11,10,10,11,11,11,10,10,11,10,11,10,11,10,10,11,10,10,11,11,10,10,11,10,11,10,10,10,10,11,10,11,10,10,11,10,4,10,11,10,11,10,10,10,11,10,11,10,11,10,11,10,11,10,10,11,10,11,10,11,10,11,10,11,10,10,10,11,10,10,11,10,11,10,11,10,10,10,11,10,11,10,11,10,11,11,10,10,11,10,10,10,11,10,10,11,10,11,10,10,11,10,11,10,11,10,10,11,10,11,10,10,10,11,10,10,11,10,10,11,10,10,11,17,10,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,12,10,11,10,10,11,10,10,11,10,17,10,11,10,10,11,10,10,11,10,11,10,10,10,11,10,11,10,11,10,10,11,10,11,10,11,10,11,10,11,10,11,10,10,10,11,10,11,10,10,11,10,10,11,10,10,10,10,10,11,10,10,10,11,10,10,11,10,11,10,10,10,10,11,10,11,10,10,11,10,11,10,11,11,10,10,11,10,10,10,10,10,10,10,10,11,10,10,10,11,
+10,10,11,10,11,10,10,10,10,11,10,11,10,10,11,10,11,10,11,10,10,11,10,11,10,10,10,4,11,10,10,10,4,10,10,10,10,10,11,11,10,10,10,10,11,10,10,10,11,10,11,10,11,10,10,11,10,10,10,11,10,10,11,10,10,11,10,10,10,11,10,11,10,10,11,10,10,11,10,10,11,10,11,10,11,10,11,10,10,11,10,11,10,10,10,4,11,10,10,10,11,10,11,10,10,10,11,10,11,10,10,11,10,10,11,10,10,11,10,11,10,11,10,10,10,11,10,11,11,11,10,10,11,10,11,10,11,10,11,10,10,11,10,11,10,10,10,11,10,10,11,10,11,10,11,10,10,11,10,11,10,10,11,10,11,10,10,10,10,11,10,11,10,11,10,11,10,10,11,10,11,10,10,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,10,10,11,10,11,10,11,10,10,10,11,10,11,10,10,11,10,11,10,10,10,11,10,10,10,11,10,10,10,10,11,10,10,10,11,10,10,10,11,10,11,10,10,11,10,10,11,17,10,10,11,10,11,10,11,10,10,11,10,10,11,10,11,10,4,11,10,10,11,10,11,10,10,11,10,10,10,11,10,10,11,10,11,10,10,11,10,11,10,10,10,10,10,11,10,10,11,10,11,10,11,10,11,10,10,11,10,10,
+10,11,10,11,10,11,10,10,11,10,11,10,10,11,10,11,4,10,10,11,10,10,11,10,10,11,10,10,10,11,10,11,10,10,11,10,11,10,10,10,10,11,10,11,10,10,4,11,10,10,10,11,10,10,11,10,11,10,11,10,10,11,10,10,11,10,10,10,11,10,11,10,10,11,10,10,11,10,10,11,10,10,10,11,10,10,11,10,11,10,10,10,11,4,11,10,10,11,10,11,4,10,10,11,10,11,10,10,11,10,11,10,10,11,10,10,11,10,4,10,10,4,10,11,10,10,11,10,10,10,11,11,10,10,11,10,10,11,10,11,10,10,11,10,11,10,11,10,10,11,10,10,10,11,10,10,11,10,10,10,11,10,10,11,10,10,11,10,11,10,11,10,10,10,11,10,10,11,10,10,10,11,10,11,10,10,11,10,10,11,10,10,11,10,10,11,10,10,10,11,10,11,10,10,11,10,10,11,10,11,10,11,10,11,11,10,10,10,11,10,11,10,11,10,11,10,11,10,10,11,10,10,11,10,10,11,10,11,4,10,10,10,11,10,10,11,10,10,10,11,10,11,10,11,10,10,11,10,10,11,10,10,10,11,10,10,11,10,10,11,10,11,10,10,11,10,11,10,11,10,10,10,10,10,11,10,10,10,11,10,11,10,11,10,11,10,11,10,10,4,10,10,10,11,4,10,11,10,
+11,10,10,10,10,10,10,11,4,10,10,11,10,10,10,10,10,11,10,10,11,10,10,11,10,10,11,10,10,10,10,10,10,11,10,4,10,11,10,11,10,10,10,10,11,10,11,10,11,10,11,10,10,11,10,10,10,11,10,11,10,10,10,11,10,11,10,11,10,10,10,11,10,10,11,10,10,11,10,10,11,10,11,10,11,10,10,11,10,10,11,10,10,10,10,11,10,10,11,10,10,11,10,10,11,10,11,10,10,4,10,10,11,10,11,10,10,11,10,11,10,11,10,10,11,10,10,11,10,11,10,10,11,10,10,11,10,10,10,10,10,11,10,10,10,10,10,11,10,4,10,11,10,10,11,10,10,10,11,10,10,11,10,10,10,11,10,11,10,10,10,11,10,10,10,11,10,10,11,11,10,10,11,10,11,10,10,10,11,10,11,10,10,11,10,10,11,10,11,10,11,10,11,10,10,11,10,10,11,10,10,10,11,10,10,11,10,11,10,11,10,10,10,11,10,10,10,10,11,10,10,11,10,11,10,10,10,10,11,10,10,11,10,10,11,10,11,10,11,10,10,11,10,10,11,10,10,11,10,10,11,10,11,10,11,10,10,10,11,10,11,10,10,11,10,11,10,10,10,11,10,11,10,11,10,11,10,11,10,10,10,10,10,11,10,10,10,10,11,10,10,11,10,10,11,10,10,10,
+10,10,11,10,11,10,10,10,10,10,11,10,10,11,10,11,10,10,11,10,10,11,10,10,10,11,10,11,11,11,11,10,11,10,4,10,11,10,11,10,11,10,11,10,10,10,10,11,10,10,10,10,4,10,10,10,11,10,10,10,11,10,11,10,10,10,10,10,10,11,10,10,10,11,10,10,11,4,10,11,10,11,10,10,10,11,10,10,11,10,10,11,10,11,10,10,11,10,10,10,11,4,10,10,10,11,10,11,10,11,10,11,10,10,10,11,10,10,10,10,11,10,11,10,10,11,10,10,11,10,11,10,10,11,11,10,11,10,11,10,11,10,11,10,11,10,11,4,11,10,11,10,10,11,10,10,11,10,10,11,10,10,11,10,10,10,10,10,11,10,11,10,11,10,11,10,11,4,10,10,11,10,11,10,10,11,10,11,10,11,10,11,10,10,11,10,10,11,10,10,10,11,10,11,10,10,11,10,10,11,10,11,10,11,10,10,11,10,10,10,11,10,11,10,10,11,10,11,10,10,11,10,10,10,11,10,11,10,10,11,10,10,11,10,10,11,10,11,10,11,10,10,10,11,10,11,10,10,11,10,10,10,10,11,10,10,11,10,10,10,10,11,10,10,10,10,11,4,11,10,11,10,10,10,11,10,11,10,11,10,11,10,11,10,4,11,10,11,10,10,10,10,10,10,10,11,10,10,
+10,10,11,10,10,10,11,10,10,11,10,10,10,10,11,10,10,11,10,10,11,10,10,11,10,4,10,10,4,10,10,4,11,10,10,11,10,10,10,10,10,4,10,4,10,11,10,10,10,11,4,11,10,11,10,11,10,10,11,10,10,10,10,4,11,10,11,4,11,10,11,10,11,4,11,10,10,11,10,4,10,10,11,10,11,10,4,11,10,11,10,10,4,10,11,10,10,11,10,11,10,10,11,10,11,10,11,10,10,10,11,10,11,10,11,10,10,11,10,11,10,11,10,10,11,10,10,11,10,11,10,10,11,10,10,11,10,11,10,11,10,10,10,11,10,11,10,10,10,11,10,10,11,10,11,10,10,4,11,10,11,4,10,11,10,10,10,11,10,11,10,11,10,10,10,11,10,11,10,11,10,10,10,10,11,10,11,10,10,10,11,10,10,11,10,10,11,10,10,11,11,10,10,11,10,11,10,10,11,10,11,10,11,10,11,10,10,11,10,11,10,10,10,10,11,10,11,10,11,10,10,11,10,11,10,10,10,10,11,10,10,11,10,11,10,10,11,10,11,10,11,10,11,10,10,10,10,11,10,11,4,10,11,10,10,11,10,10,11,10,11,10,11,10,4,11,10,10,10,10,10,11,10,11,10,11,10,10,11,10,10,11,11,10,11,10,11,10,10,11,10,11,10,11,10,10,11,10,
+10,10,10,10,11,10,4,10,11,10,10,10,11,4,10,10,11,10,10,10,10,10,11,4,10,10,11,10,10,11,10,10,10,4,11,4,10,10,4,11,10,11,10,11,10,10,10,11,4,10,10,10,10,10,10,4,11,10,4,10,11,4,10,11,10,10,10,11,10,4,10,11,10,10,10,11,10,10,10,11,10,11,10,11,4,10,11,10,10,4,11,10,10,11,10,11,4,10,10,4,10,11,10,4,10,10,10,10,11,11,10,10,4,11,10,10,11,10,11,10,10,10,10,11,10,10,11,10,11,10,10,11,10,10,11,10,10,11,10,4,10,11,10,10,10,10,10,11,11,10,10,11,10,4,10,10,10,11,10,10,10,11,10,10,11,10,11,10,10,4,10,4,11,10,11,10,10,10,11,10,10,10,11,10,11,10,10,11,10,11,10,10,11,10,11,10,10,11,10,4,10,10,11,10,10,4,10,11,10,11,10,10,10,10,10,10,11,10,11,10,10,11,10,11,10,10,10,10,10,11,4,10,10,10,11,10,4,11,10,4,11,10,10,10,11,10,10,10,11,10,10,11,10,10,11,10,10,10,11,10,10,11,10,10,11,10,11,10,10,11,10,10,10,10,11,10,10,11,10,10,11,4,10,11,10,10,10,11,10,11,10,10,10,10,10,4,10,11,10,4,10,10,11,10,10,10,10,10,
+10,11,10,4,10,10,10,11,4,10,10,11,10,10,10,4,10,10,11,10,10,11,10,10,11,10,10,10,10,10,4,11,10,10,10,11,10,10,11,10,4,10,10,4,10,11,4,10,10,10,10,11,10,11,4,10,10,10,11,10,10,10,11,10,10,11,10,10,11,10,10,10,4,11,10,4,10,10,11,10,10,10,10,10,10,10,10,11,10,10,10,11,10,10,10,10,11,10,11,10,10,4,11,10,10,11,10,10,10,10,10,11,10,10,11,10,10,11,10,10,11,10,11,10,10,11,10,11,4,10,10,10,11,10,10,11,10,10,11,10,10,10,11,10,10,11,10,10,10,11,10,10,11,10,10,4,11,10,4,11,10,10,10,10,10,11,10,10,10,11,10,10,10,11,10,11,10,11,10,10,11,11,10,10,4,11,10,10,11,10,10,11,10,10,10,11,10,10,11,10,11,10,10,10,11,10,11,10,10,10,10,11,10,11,10,11,10,10,4,11,10,10,11,10,10,11,11,10,10,10,11,10,10,11,10,10,11,10,10,11,10,10,11,10,4,11,10,10,10,11,10,10,11,10,10,11,4,11,10,10,11,4,10,11,4,10,10,4,11,10,11,10,11,10,10,4,11,10,10,11,10,11,10,10,11,10,11,10,10,10,11,4,10,11,10,11,10,10,10,11,10,10,4,10,11,10,10,4,
+10,10,4,11,10,4,11,10,10,11,10,10,10,11,10,11,10,4,10,10,11,4,10,10,10,4,11,4,10,11,10,10,4,10,11,4,10,4,10,10,11,10,11,10,10,10,11,4,10,4,11,10,10,4,11,4,10,10,10,4,11,10,10,10,10,10,4,11,10,4,11,10,10,10,10,11,10,11,4,11,10,11,10,11,10,11,10,4,11,10,11,10,4,11,10,4,10,11,10,4,11,10,10,11,10,10,11,10,4,11,10,10,10,11,4,11,10,4,10,11,10,4,10,11,10,10,10,10,11,10,10,11,4,11,10,10,11,4,10,11,10,10,10,4,11,10,11,10,10,4,11,10,4,10,10,11,10,10,11,10,4,11,10,11,4,10,10,4,11,10,10,11,10,10,4,10,10,10,11,10,10,4,11,10,11,10,11,10,4,10,11,4,11,10,10,10,11,10,4,10,10,4,11,10,4,10,10,11,10,4,11,10,11,10,10,10,11,10,11,10,10,11,10,11,10,10,4,11,10,10,10,4,11,10,11,10,10,11,10,10,10,11,10,10,11,10,10,11,10,10,11,10,4,11,10,10,10,10,11,10,10,11,10,4,10,11,10,10,10,10,4,10,10,10,11,10,10,10,11,10,10,10,11,4,10,10,4,11,10,4,10,11,10,10,10,10,11,10,11,10,10,11,10,10,10,4,11,10,
+10,10,10,10,11,10,10,10,10,10,11,10,10,10,4,10,10,10,11,4,10,10,11,4,10,10,10,11,4,10,4,10,11,10,4,10,11,10,11,10,4,10,4,11,10,4,10,11,10,10,10,10,11,10,10,11,10,4,11,10,10,11,4,10,11,10,11,10,4,10,10,10,10,11,10,10,4,10,10,10,10,10,4,10,4,10,10,11,10,10,4,11,10,10,10,10,11,4,10,10,4,10,10,4,11,10,10,11,10,10,4,11,10,10,10,10,11,10,10,10,10,10,11,10,11,10,10,11,10,11,4,10,10,10,11,10,10,10,10,10,11,10,11,10,10,10,4,11,10,10,10,11,10,11,10,10,10,10,10,4,11,10,4,10,10,10,11,10,10,4,11,10,10,11,10,10,4,11,10,11,10,10,10,4,10,10,4,11,10,11,10,10,10,11,10,11,10,11,10,10,11,10,10,10,11,10,10,4,10,10,10,10,10,4,11,10,10,4,10,11,4,10,10,4,11,10,10,10,4,11,10,10,10,4,10,10,10,10,4,11,10,10,10,11,10,11,10,10,10,4,11,10,10,10,11,4,11,10,4,10,10,10,10,10,11,10,10,11,4,11,10,11,10,10,4,11,10,11,10,4,11,10,10,10,11,10,10,10,11,10,11,10,11,4,11,10,10,10,10,11,4,10,10,11,4,10,10,11,
+4,10,11,4,10,10,11,4,11,10,10,4,11,10,10,10,11,10,4,10,11,10,4,11,10,11,10,4,10,10,11,10,4,10,11,10,4,10,4,10,11,10,10,4,10,11,4,10,10,11,4,10,4,11,4,10,10,10,10,10,4,10,11,10,4,10,10,10,11,10,4,11,10,10,4,11,10,4,11,10,11,4,10,11,10,11,10,10,4,11,10,10,10,4,11,10,4,10,11,4,10,11,4,10,4,10,4,10,10,10,11,10,10,4,11,10,10,10,11,4,11,10,4,10,10,11,4,10,10,10,10,10,11,4,10,10,11,10,11,4,10,10,10,4,11,10,10,10,10,11,10,4,10,10,10,10,11,4,11,10,10,10,10,4,11,10,4,10,11,10,10,4,10,10,11,10,11,10,4,10,4,11,10,10,11,10,10,10,10,10,10,11,10,4,11,10,10,4,10,11,10,10,11,4,10,11,10,11,10,11,4,10,11,10,10,11,10,11,10,10,10,10,11,10,10,11,10,10,10,10,4,11,10,11,10,11,10,11,10,10,4,11,4,10,10,4,10,10,11,10,10,10,11,10,10,11,10,11,10,10,11,10,11,10,4,10,11,4,10,10,10,4,11,10,10,4,10,10,10,10,10,11,4,10,4,11,10,10,10,10,4,10,4,10,10,4,10,11,4,10,10,11,4,10,10,11,10,10,
+10,11,10,10,10,4,10,10,10,4,10,11,10,10,10,11,10,10,11,4,10,10,10,4,10,10,10,11,10,4,10,4,11,4,10,4,10,11,10,4,10,4,11,10,10,10,10,11,4,10,10,11,10,10,10,10,4,11,10,4,11,4,10,11,10,10,11,10,10,10,11,4,10,10,11,4,10,11,4,10,10,10,4,10,10,4,11,10,10,10,10,11,10,10,10,10,10,11,10,10,4,10,11,10,11,10,10,11,4,10,10,10,11,10,4,10,11,4,10,10,10,10,11,10,10,4,10,10,11,4,11,10,10,10,11,10,4,10,4,10,10,11,10,10,10,4,11,10,11,4,10,11,10,10,11,4,10,10,10,10,11,4,10,11,10,10,10,11,4,10,11,10,11,4,10,4,10,10,11,10,10,10,4,11,10,4,11,10,4,11,4,10,10,10,10,10,11,10,4,10,10,11,4,10,10,4,10,10,4,10,11,10,4,10,4,10,10,10,4,11,10,11,10,10,4,10,10,10,11,4,10,10,4,10,10,4,10,4,10,11,10,10,10,10,11,10,10,11,10,11,10,10,10,11,4,10,10,10,11,4,10,10,4,10,11,10,4,10,4,11,10,10,10,10,11,10,10,4,11,10,10,10,10,11,10,10,4,11,10,11,10,11,10,11,10,10,11,4,10,10,11,10,10,4,11,10,10,4,
+10,10,4,11,10,10,10,11,4,11,10,4,10,11,4,10,10,10,4,10,10,11,4,10,4,11,4,10,10,11,10,10,10,4,10,10,11,4,10,11,10,11,10,4,11,4,10,4,10,4,11,10,10,11,4,10,11,10,4,11,10,10,10,4,10,10,4,10,4,11,10,11,4,11,10,10,10,10,10,4,11,10,10,10,11,10,10,4,11,10,4,10,4,11,10,4,11,10,4,11,10,10,4,10,10,4,11,4,10,4,11,10,10,10,11,4,10,10,10,11,10,10,10,4,11,10,11,10,4,10,10,4,11,10,10,10,11,10,11,10,10,4,10,11,10,10,10,10,10,10,10,10,4,11,10,10,10,11,4,10,10,11,10,10,4,11,10,10,10,11,10,10,10,11,10,11,10,4,10,4,11,10,10,10,10,10,10,10,11,10,10,4,11,10,10,4,10,4,11,10,4,10,10,4,11,10,11,4,10,10,4,10,10,11,10,10,11,4,10,10,4,10,4,11,10,10,4,11,10,10,11,10,10,10,11,10,10,11,10,4,10,11,10,4,10,10,11,10,10,10,11,10,10,10,10,10,11,10,10,10,10,10,11,10,10,10,11,10,10,4,10,11,10,11,10,10,10,11,10,11,4,10,11,4,10,11,10,10,4,10,10,4,10,4,11,10,4,10,11,10,10,10,11,10,10,10,11,10,
+4,10,10,4,11,10,4,10,10,10,4,10,11,10,10,10,11,4,10,10,4,10,11,10,10,10,11,4,10,4,11,10,4,10,4,11,10,4,10,4,10,10,4,10,10,10,10,11,4,10,4,10,4,10,11,4,10,4,10,4,10,10,11,10,11,10,11,10,10,10,4,10,10,10,4,10,11,4,10,10,4,11,10,4,10,11,4,10,10,10,10,11,10,4,11,10,10,10,10,4,10,4,10,11,10,10,10,4,10,11,10,4,11,4,10,10,11,10,4,10,11,4,10,10,10,10,4,10,10,11,10,10,10,11,4,10,10,4,10,4,11,10,10,4,11,10,4,11,10,11,4,10,10,4,10,11,4,10,10,11,4,10,4,11,10,10,10,11,10,4,10,11,10,10,10,10,4,11,10,10,10,4,10,11,4,10,11,4,10,4,10,10,10,11,4,10,11,10,10,4,10,11,4,10,10,10,4,11,4,10,10,11,4,10,4,10,10,11,4,10,11,10,10,10,11,4,10,10,4,10,10,11,10,4,10,4,11,10,4,11,10,4,10,10,11,10,4,10,11,10,10,10,11,10,10,11,10,10,10,11,10,11,10,4,11,10,4,10,11,10,11,4,10,10,11,4,10,10,10,10,11,10,10,10,11,10,4,10,11,10,10,10,11,10,10,10,11,10,10,4,11,10,4,11,10,10,10,11,
+10,11,4,10,10,11,10,10,11,4,10,4,10,10,11,4,10,11,4,10,11,10,10,4,11,4,10,4,11,10,4,11,10,10,11,4,10,10,11,10,11,4,10,11,4,11,10,4,10,11,10,10,11,4,10,10,10,11,4,10,11,4,10,10,4,10,4,11,10,4,10,11,10,10,11,4,10,11,10,10,10,4,10,11,4,10,11,10,10,11,4,10,4,11,10,4,4,11,10,10,10,11,4,10,4,11,10,11,10,4,10,10,10,10,11,10,4,11,10,4,10,10,11,10,11,4,10,11,10,4,10,11,4,10,11,10,4,11,10,10,10,11,10,10,10,11,10,10,4,10,11,10,4,11,4,10,10,11,10,10,10,11,10,10,4,11,10,4,10,11,10,4,10,10,4,11,10,10,10,4,10,11,10,10,11,4,10,10,10,11,10,11,4,10,10,10,10,4,10,11,10,4,10,4,11,4,10,10,11,10,10,4,11,10,10,11,4,10,10,10,4,10,11,4,10,11,10,10,10,11,4,10,4,10,11,10,10,10,10,4,10,10,11,10,10,10,11,10,4,10,11,4,10,11,10,4,10,11,10,10,4,10,11,10,10,10,11,10,4,10,10,10,11,10,10,11,10,10,11,4,10,11,10,10,4,10,11,10,10,11,4,10,10,10,11,4,10,10,11,10,4,10,10,10,10,11,4,10,
+10,4,11,4,10,4,10,11,4,10,10,11,10,10,4,10,4,10,11,10,10,4,10,11,10,10,10,11,4,4,10,4,10,11,10,10,4,11,4,10,4,10,4,10,10,10,10,11,4,10,11,4,10,10,4,11,4,10,10,4,10,10,4,11,10,4,10,10,4,11,4,10,11,4,10,10,4,10,4,11,10,11,4,10,10,4,10,11,4,10,10,11,4,10,4,11,4,10,4,10,11,10,10,4,10,4,4,10,11,10,4,10,4,11,10,4,10,10,10,11,4,10,10,10,10,11,4,10,10,10,11,4,10,4,10,10,10,4,10,11,4,10,10,11,4,10,10,10,11,4,10,10,10,10,10,11,4,10,10,11,4,10,11,10,10,10,4,11,4,10,11,10,10,4,11,10,4,11,10,10,11,10,10,10,10,10,10,11,4,10,10,10,10,11,4,11,10,11,10,4,4,11,10,11,4,10,11,4,10,10,11,10,4,10,4,10,10,4,11,10,11,4,10,10,10,4,10,11,4,10,10,10,10,11,4,10,4,11,10,11,10,10,10,10,11,4,10,10,10,11,10,10,10,4,10,11,10,4,10,11,10,10,4,10,11,4,10,11,10,10,4,11,10,4,10,10,4,11,10,10,10,4,10,11,10,10,10,10,10,10,10,11,4,11,10,10,10,4,10,10,11,10,11,4,10,10,10,4,
+10,10,10,10,11,10,10,4,10,11,4,10,4,11,10,10,11,10,10,4,11,10,4,10,4,11,4,10,4,11,10,10,4,10,4,11,10,10,4,10,11,10,10,4,11,4,10,4,10,10,4,10,11,10,11,4,10,4,11,10,4,10,11,10,4,11,10,4,10,10,10,4,4,10,11,4,11,10,10,10,4,10,10,11,4,10,10,4,10,11,4,10,10,10,10,4,10,10,11,4,10,4,11,10,4,10,10,10,4,10,10,11,10,10,10,11,10,4,10,10,10,11,4,10,4,10,10,11,4,10,10,10,10,11,10,11,10,10,10,4,10,11,4,10,10,10,4,11,10,10,10,11,4,10,10,4,10,11,4,10,10,4,10,4,11,4,10,10,10,10,4,10,11,10,10,4,10,10,4,10,10,4,11,4,10,11,10,4,10,4,11,4,10,4,10,10,4,10,4,11,10,10,10,4,10,10,4,10,11,4,10,10,11,10,10,11,10,10,10,4,10,10,4,11,10,10,10,4,10,11,4,11,10,10,10,10,11,10,4,10,10,11,4,10,10,10,10,11,10,10,10,11,10,11,10,10,4,11,10,10,4,11,10,10,10,10,10,4,10,10,11,10,4,11,10,4,10,10,4,11,10,10,10,4,10,11,10,4,11,10,10,10,4,10,10,11,10,10,11,10,10,10,4,10,4,11,10,10,
+10,4,11,4,10,4,4,11,4,10,11,10,10,10,11,4,10,4,11,10,10,4,11,10,4,10,11,4,10,4,11,4,10,11,10,4,4,10,11,10,4,11,4,10,4,11,4,10,11,4,10,11,4,10,4,11,4,4,10,4,11,10,10,4,10,4,11,10,10,11,4,10,11,10,4,11,10,4,11,10,10,11,4,10,11,10,4,11,4,10,11,4,10,11,4,10,11,4,4,4,11,10,4,11,10,4,11,4,10,11,10,4,4,11,4,10,11,10,10,11,4,10,11,10,10,11,4,10,11,10,4,11,10,10,4,4,11,10,10,11,10,4,11,10,4,11,10,10,4,11,4,10,11,10,4,11,10,4,11,10,4,11,10,10,4,11,10,4,11,4,10,11,10,4,11,10,11,10,11,4,11,10,10,11,10,10,4,11,10,10,4,11,10,10,11,4,10,11,10,10,4,11,4,10,11,4,11,4,10,11,10,11,4,11,10,10,4,11,10,10,11,10,10,4,11,10,4,11,10,4,10,10,4,11,4,10,10,4,10,11,4,10,11,10,10,11,4,10,4,11,10,4,11,10,4,11,10,10,4,11,10,4,11,10,4,11,4,10,11,10,10,4,10,4,11,10,10,11,10,10,11,4,10,11,10,4,11,10,10,4,11,4,10,11,4,10,11,4,10,4,11,4,10,11,10,10,4,11,
+4,10,4,10,10,4,10,4,10,10,10,10,11,10,4,10,10,10,10,10,4,10,10,4,10,10,4,10,10,10,10,10,10,4,10,4,10,10,10,10,10,4,10,4,10,10,10,4,10,10,10,4,10,10,10,10,10,10,4,10,10,4,10,10,4,10,10,4,10,4,10,4,10,4,10,4,10,10,10,10,10,4,10,10,10,4,10,10,10,4,10,10,10,10,10,4,4,10,10,10,4,10,10,4,10,10,10,10,10,4,10,10,10,10,10,10,10,10,4,10,10,10,10,10,10,10,10,10,10,10,10,10,4,10,10,10,10,4,10,10,4,10,10,4,10,10,10,10,10,10,10,4,10,10,10,4,10,10,10,10,10,10,4,10,10,10,4,10,10,10,4,10,4,10,4,10,10,4,10,10,10,4,10,10,10,10,10,10,10,4,10,10,10,4,10,10,10,4,10,10,10,10,10,10,4,10,10,10,4,10,4,10,10,10,10,10,10,10,4,10,10,4,10,10,10,10,10,10,10,4,10,10,10,10,11,10,10,11,10,10,10,10,10,4,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,4,10,10,4,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
+10,4,10,4,4,4,4,10,4,4,10,4,4,10,4,4,4,4,10,4,10,4,4,10,4,4,10,4,4,10,4,10,4,4,4,10,4,4,4,4,10,4,4,10,4,10,4,4,4,4,10,4,4,4,10,4,4,4,10,4,4,10,4,4,10,4,4,10,4,10,4,10,4,10,4,10,4,10,4,10,4,4,10,4,10,4,10,4,4,10,4,4,4,10,4,4,10,4,4,10,4,10,4,10,4,4,10,4,4,10,4,4,10,4,10,4,10,4,10,4,10,4,10,4,10,4,10,10,10,4,10,4,10,4,4,10,4,10,4,10,4,10,4,10,4,4,10,4,10,4,4,10,4,4,4,10,4,10,10,4,10,4,10,4,4,4,10,4,4,10,4,10,10,10,4,10,4,10,4,10,4,10,10,4,10,4,10,4,4,10,4,10,4,10,4,10,4,10,10,4,10,10,4,10,4,10,4,4,10,4,10,4,10,4,4,10,10,4,10,4,4,10,4,4,4,10,4,10,4,10,4,4,10,4,10,4,10,10,4,10,4,10,10,10,10,4,10,10,10,4,10,10,4,10,10,4,10,4,10,4,10,10,4,10,4,10,4,10,10,4,10,10,4,10,10,4,10,10,4,10,4,10,4,10,4,10,4,10,4,10,4,10,10,4,10,10,4,10,4,10,4,10,4,10,10,4,10,4,
+240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
+240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,
+};
+
+MWIMAGEHDR image_car8 = {
+  308, 162,	/* width, height*/
+  1, 8,		/* planes, bpp*/
+  308, 1,	/* pitch, bytesperpixel*/
+  1, 256,	/* compression, palsize*/
+  -1L,		/* transcolor*/
+  palette,
+  imagebits,
+};
Binary files lib/microwindows/src/mwin/bmp/close4.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/close4.bmp differ
diff -urN lib/microwindows/src/mwin/bmp/close4.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/close4.c
--- lib/microwindows/src/mwin/bmp/close4.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/close4.c	2005-02-21 16:03:34.000000000 +0100
@@ -0,0 +1,46 @@
+/* Generated by convbmp*/
+#include "device.h"
+
+/* MWIMAGEHDR image_close4 converted from close4.bmp*/
+
+static MWPALENTRY palette[16] = {
+  RGBDEF(   0,   0,   0 ),	/* pal 0*/
+  RGBDEF( 191,   0,   0 ),	/* pal 1*/
+  RGBDEF(   0, 191,   0 ),	/* pal 2*/
+  RGBDEF( 191, 191,   0 ),	/* pal 3*/
+  RGBDEF(   0,   0, 191 ),	/* pal 4*/
+  RGBDEF( 191,   0, 191 ),	/* pal 5*/
+  RGBDEF(   0, 191, 191 ),	/* pal 6*/
+  RGBDEF( 192, 192, 192 ),	/* pal 7*/
+  RGBDEF( 128, 128, 128 ),	/* pal 8*/
+  RGBDEF( 255,   0,   0 ),	/* pal 9*/
+  RGBDEF(   0, 255,   0 ),	/* pal 10*/
+  RGBDEF( 255, 255,   0 ),	/* pal 11*/
+  RGBDEF(   0,   0, 255 ),	/* pal 12*/
+  RGBDEF( 255,   0, 255 ),	/* pal 13*/
+  RGBDEF(   0, 255, 255 ),	/* pal 14*/
+  RGBDEF( 255, 255, 255 ),	/* pal 15*/
+};
+
+static MWUCHAR imagebits[] = {
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0xf8,0x88,0x88,0x88,0x88,0x80,0x00,0x00,
+0xf7,0x00,0x77,0x77,0x00,0x80,0x00,0x00,
+0xf7,0x70,0x07,0x70,0x07,0x80,0x00,0x00,
+0xf7,0x77,0x00,0x00,0x77,0x80,0x00,0x00,
+0xf7,0x77,0x70,0x07,0x77,0x80,0x00,0x00,
+0xf7,0x77,0x00,0x00,0x77,0x80,0x00,0x00,
+0xf7,0x70,0x07,0x70,0x07,0x80,0x00,0x00,
+0xf7,0x00,0x77,0x77,0x00,0x80,0x00,0x00,
+0xff,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,
+};
+
+MWIMAGEHDR image_close4 = {
+  12, 10,	/* width, height*/
+  1, 4,		/* planes, bpp*/
+  8, 1,	/* pitch, bytesperpixel*/
+  1, 16,	/* compression, palsize*/
+  -1L,		/* transcolor*/
+  palette,
+  imagebits,
+};
diff -urN lib/microwindows/src/mwin/bmp/convbmp.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/convbmp.c
--- lib/microwindows/src/mwin/bmp/convbmp.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/convbmp.c	2005-02-21 16:13:21.000000000 +0100
@@ -0,0 +1,508 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Windows BMP to Microwindows image converter
+ *
+ * 6/9/1999 g haerr
+ *
+ * 05/01/2000 Michael Temari <Michael@TemWare.Com>
+ * Modified to output .s ACK format for Minix
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "device.h"
+
+/* separators for DOS & Unix file systems */
+#define OS_FILE_SEPARATOR   "/\\"
+
+#define PIX2BYTES(n)	(((n)+7)/8)
+
+#define BI_RGB		0L
+#define BI_RLE8		1L
+#define BI_RLE4		2L
+#define BI_BITFIELDS	3L
+
+typedef unsigned char	UCHAR;
+typedef unsigned char	BYTE;
+
+#if !_MINIX
+typedef unsigned short	WORD;
+typedef unsigned long	DWORD;
+typedef long		LONG;
+#define	CASTWORD
+#define	CASTDWORD
+#define	CASTLONG
+#else
+/* The Minix ACK compiler cannot pack a structure so we do it the hardway */
+typedef unsigned char	WORD[2];
+typedef unsigned char	DWORD[4];
+typedef unsigned char	LONG[4];
+#define	CASTWORD	*(unsigned short *)&
+#define	CASTDWORD	*(unsigned long *)&
+#define	CASTLONG	*(long *)&
+#endif
+
+#pragma pack(1)
+/* windows style*/
+typedef struct {
+	/* BITMAPFILEHEADER*/
+	BYTE	bfType[2];
+	DWORD	bfSize;
+	WORD	bfReserved1;
+	WORD	bfReserved2;
+	DWORD	bfOffBits;
+	/* BITMAPINFOHEADER*/
+	DWORD	BiSize;
+	LONG	BiWidth;
+	LONG	BiHeight;
+	WORD	BiPlanes;
+	WORD	BiBitCount;
+	DWORD	BiCompression;
+	DWORD	BiSizeImage;
+	LONG	BiXpelsPerMeter;
+	LONG	BiYpelsPerMeter;
+	DWORD	BiClrUsed;
+	DWORD	BiClrImportant;
+} BMPHEAD;
+
+/* os/2 style*/
+typedef struct {
+	/* BITMAPFILEHEADER*/
+	BYTE	bfType[2];
+	DWORD	bfSize;
+	WORD	bfReserved1;
+	WORD	bfReserved2;
+	DWORD	bfOffBits;
+	/* BITMAPCOREHEADER*/
+	DWORD	bcSize;
+	WORD	bcWidth;
+	WORD	bcHeight;
+	WORD	bcPlanes;
+	WORD	bcBitCount;
+} BMPCOREHEAD;
+#pragma pack()
+
+int	ConvBMP(FILE *fp,char *name);
+void	outline(UCHAR *linebuffer, int bitdepth, int linesize, int y);
+int	DecodeRLE8(UCHAR *buf,FILE *fp);
+int	DecodeRLE4(UCHAR *buf,FILE *fp);
+void	put4(int b);
+
+int	s_flag = 0;
+
+int main(int argc,char *argv[])
+{
+FILE	*fp;
+char 	*p;
+char	name[64];
+char	oname[64];
+
+   /* skip the program name */
+   argc--;
+   argv++;
+
+   /* check for -s flag */
+   if(argc && strcmp(*argv, "-s") == 0) {
+	s_flag = -1;
+	argc--;
+	argv++;
+   }
+
+   /* need at least one file to convert */
+   if(argc == 0) {
+	fprintf(stderr, "Usage: convbmp [-s] <bmpfile>\n");
+	return(-1);
+   }
+
+   /* go back one since the first thing in the loop is to increment */
+   argv--;
+   while(argc--) {
+	argv++;
+	if((p = strrchr(*argv, '.')) != (char *)NULL)
+		*p = '\0';
+	strcpy(name, *argv);
+	strcpy(oname, *argv);
+	if(s_flag)
+		strcat(oname, ".s");
+	else
+		strcat(oname, ".c");
+	if(p != (char *)NULL)
+		*p = '.';
+	if((fp = fopen(*argv, "rb")) == (FILE *)NULL) {
+		fprintf(stderr, "Can't open file: %s\n", *argv);
+		continue;
+	}
+	if(freopen(oname, "w", stdout) == (FILE *)NULL) {
+		fclose(fp);
+		fprintf(stderr, "Could not open output file %s\n", oname);
+		continue;
+	}
+
+   /* 
+      let's strip any directory from the path passed in.
+      This prevent problems if this utility is given 
+      path is not for the curent directory.
+   */
+   p = name;
+   while( 1 )
+   {
+      char *p1 = p;
+      p1 = strpbrk( p, OS_FILE_SEPARATOR );
+      if( p1 )
+      {
+         p = p1+1;
+      }
+      else
+      {
+          break;
+      }
+   }
+	if(ConvBMP(fp, p)) {
+		fprintf(stderr, "Conversion failed: %s\n", *argv);
+		fclose(fp);
+		continue;
+	}
+	fclose(fp);
+   }
+   return(0);
+}
+
+/* decode a bmp file*/
+int ConvBMP(FILE *fp, char *name)
+{
+BMPHEAD		bmp;
+BMPCOREHEAD	*bmc;
+int		i, palsize;
+UCHAR		*linebuffer = NULL;
+unsigned int	cx, cy, bitdepth, linesize;
+long		compression;
+MWPALENTRY	cmap[256];
+long l;
+int g;
+int bytesperpixel;
+UCHAR *p = (UCHAR *)&l;
+
+   /* read BMP header*/
+   if(fread(&bmp, 1, sizeof(BMPHEAD), fp) != sizeof(BMPHEAD)) {
+   	fprintf(stderr, "Error reading .bmp file header\n");
+	return(-1);
+   }
+
+   /* might be windows or os/2 header*/
+   if(CASTDWORD bmp.BiSize == 12) {
+	bmc = (BMPCOREHEAD *)&bmp;
+	cx = (int)CASTWORD bmc->bcWidth;
+	cy = (int)CASTWORD bmc->bcHeight;
+	bitdepth = CASTWORD bmc->bcBitCount;
+	palsize = 1 << bitdepth;
+	compression = BI_RGB;
+	fseek(fp, sizeof(BMPCOREHEAD), SEEK_SET);
+   } else {
+	cx = (int)CASTLONG bmp.BiWidth;
+	cy = (int)CASTLONG bmp.BiHeight;
+	bitdepth = CASTWORD bmp.BiBitCount;
+	palsize = (int)CASTDWORD bmp.BiClrUsed;
+	if(palsize == 0)
+		palsize = 1 << bitdepth;
+	compression = CASTDWORD bmp.BiCompression;
+   }
+
+   if(bitdepth > 8)
+	   palsize = 0;
+
+   /* currently only 1, 4, 8 and 24 bpp bitmaps*/
+   if(bitdepth > 8 && bitdepth != 24) {
+	fprintf(stderr, "Error: bits per pixel must be 1, 4, 8 or 24\n");
+	return(-1);
+   }
+
+   /* compute image line size and allocate line buffer*/
+   if(bitdepth == 1) {
+	linesize = PIX2BYTES(cx);
+	bytesperpixel = 1;
+   } else if(bitdepth <= 4) {
+	linesize = PIX2BYTES(cx<<2);
+	bytesperpixel = 1;
+   } else if(bitdepth <= 8) {
+	linesize = cx;
+	bytesperpixel = 1;
+   } else if(bitdepth <= 16) {
+	linesize = cx * 2;
+	bytesperpixel = 2;
+   } else if(bitdepth <= 24) {
+	linesize = cx * 3;
+	bytesperpixel = 3;
+   } else {
+	linesize = cx * 4;
+	bytesperpixel = 4;
+   }
+
+   linesize = (linesize+3) & ~3;
+
+   if((linebuffer = malloc(linesize)) == (UCHAR *)NULL) {
+   	fprintf(stderr, "Error with malloc(%d)\n", linesize);
+	return(-1);
+   }
+
+   if(!s_flag) {
+	printf("/* Generated by convbmp*/\n");
+	printf("#include \"device.h\"\n\n");
+	printf("/* MWIMAGEHDR image_%s converted from %s.bmp*/\n\n",
+		name, name);
+   }
+
+   /* get colormap*/
+   if(bitdepth <= 8) {
+	for(i=0; i<palsize; i++) {
+		cmap[i].b = fgetc(fp);
+		cmap[i].g = fgetc(fp);
+		cmap[i].r = fgetc(fp);
+		if(CASTDWORD bmp.BiSize != 12)
+			fgetc(fp);
+	}
+
+	if(!s_flag) {
+		/* extract palette*/
+		printf("static MWPALENTRY palette[%d] = {\n", palsize);
+		for(i=0; i<palsize; ++i)
+			printf("  RGBDEF( %3d, %3d, %3d ),\t/* pal %d*/\n",
+				cmap[i].r, cmap[i].g, cmap[i].b, i);
+		printf("};\n\n");
+	} else {
+		printf(".sect .text; .sect .rom; .sect .data; .sect .bss\n");
+		printf(".sect .data\n");
+		printf("__II0:\n");
+		l = 0L; g = 0; p = (UCHAR *)&l;
+		for(i=0; i<palsize; ++i) {
+			p[g++] = cmap[i].r;
+			if(g == 4)
+				{ g = 0; printf(".data4\t%ld\n", l); l = 0L; }
+			p[g++] = cmap[i].g;
+			if(g == 4)
+				{ g = 0; printf(".data4\t%ld\n", l); l = 0L; }
+			p[g++] = cmap[i].b;
+			if(g == 4)
+				{ g = 0; printf(".data4\t%ld\n", l); l = 0L; }
+		}
+		if(g)
+			printf(".data4\t%ld\n", l);
+	}
+   }
+
+   if(!s_flag) {
+	printf("static MWUCHAR imagebits[] = {\n");
+   } else {
+	printf("__II1:\n");
+	l = 0L; g = 0;
+   }
+
+   /* decode image data*/
+   fseek(fp, CASTDWORD bmp.bfOffBits, SEEK_SET);
+   if(compression == BI_RLE8) {
+	for(i = cy-1; i>= 0; i--) {
+		if(!DecodeRLE8(linebuffer, fp))
+			break;
+		outline(linebuffer, bitdepth, linesize, i);
+	}
+   } else if(compression == BI_RLE4) {
+	for(i = cy-1; i>= 0; i--) {
+		if(!DecodeRLE4(linebuffer, fp))
+			break;
+		outline(linebuffer, bitdepth, linesize, i);
+	}
+   } else {
+	for(i=0; i<cy; i++) {
+		if(fread(linebuffer, 1, linesize, fp) != (size_t)linesize) {
+			free(linebuffer);
+			fprintf(stderr, "Error fread\n");
+			return(-1);
+		}
+		outline(linebuffer, bitdepth, linesize, cy-i-1);
+	}
+   }
+
+   if(!s_flag) {
+	printf("};\n\n");
+
+	printf("MWIMAGEHDR image_%s = {\n", name);
+	printf("  %d, %d,\t/* width, height*/\n", cx, cy);
+	printf("  %d, %d,\t\t/* planes, bpp*/\n", 1, bitdepth);
+	printf("  %d, %d,\t/* pitch, bytesperpixel*/\n",
+		linesize, bytesperpixel);
+	printf("  %d, %d,\t/* compression, palsize*/\n", 1, palsize);
+	printf("  %ldL,\t\t/* transcolor*/\n", -1L);
+	if(palsize)
+		printf("  palette,\n");
+	else
+		printf("  0,\n");
+	printf("  imagebits,\n");
+	printf("};\n");
+   } else {
+	printf(".extern _image_%s\n", name);
+	printf("_image_%s:\n", name);
+	printf(".data4\t%ld\n",(long)cx);
+	printf(".data4\t%ld\n",(long)cy);
+	printf(".data4\t%ld\n",1L);
+	printf(".data4\t%ld\n",(long)bitdepth);
+	printf(".data4\t%ld\n",(long)linesize);
+	printf(".data4\t%ld\n",(long)bytesperpixel);
+	printf(".data4\t%ld\n",1L);
+	printf(".data4\t%ld\n",(long)palsize);
+	printf(".data4\t%ld\n",-1L);
+	printf(".data4\t__II0\n");
+	if(palsize)
+		printf(".data4\t__II1\n");
+	else
+		printf(".data4\t0\n");
+	printf(".sect .text\n");
+   }
+
+   free(linebuffer);
+
+   return(0);
+}
+
+void outline(UCHAR *linebuffer, int bitdepth, int linesize, int y)
+{
+static int bc = 0;
+static long l = 0;
+static char *p = (char *)&l;
+int	n;
+
+   switch(bitdepth) {
+	case 1:
+	case 4:
+		for(n=0; n<linesize; ++n) {
+			if(!s_flag)
+				printf("0x%02x,", linebuffer[n]);
+			else {
+				p[bc++] = linebuffer[n];
+				if(bc == 4) {
+					bc = 0;
+					printf(".data4\t%ld\n", l);
+					l = 0L;
+				}
+			}
+		}
+		break;
+	case 8:
+	default:
+		for(n=0; n<linesize; ++n) {
+			if(!s_flag)
+				printf("%d,", linebuffer[n]);
+			else {
+				p[bc++] = linebuffer[n];
+				if(bc == 4) {
+					bc = 0;
+					printf(".data4\t%ld\n", l);
+					l = 0L;
+				}
+			}
+		}
+   }
+   if(!s_flag)
+	printf("\n");
+}
+
+/*
+ * Decode one line of RLE8, return 0 when done with all bitmap data
+ */
+int DecodeRLE8(UCHAR *buf,FILE *fp)
+{
+int		c, n;
+UCHAR *	p = buf;
+
+   while(1) {
+	switch(n = fgetc(fp)) {
+		case EOF:
+			return(0);
+		case 0:					/* 0 = escape*/
+			switch(n = fgetc(fp)) {
+			case 0: 			/* 0 0 = end of current scan line*/
+				return(1);
+			case 1:				/* 0 1 = end of data*/
+				return(1);
+			case 2:				/* 0 2 xx yy delta mode - NOT SUPPORTED*/
+				(void)fgetc(fp);
+				(void)fgetc(fp);
+				continue;
+			default:			/* 0 3..255 xx nn uncompressed data*/
+				for(c=0; c<n; c++)
+					*p++ = fgetc(fp);
+				if(n & 1)
+					(void)fgetc(fp);
+				continue;
+			}
+		default:
+			c = fgetc(fp);
+			while(n--)
+				*p++ = c;
+			continue;
+		}
+	}
+}
+
+/*
+ * Decode one line of RLE4, return 0 when done with all bitmap data
+ */
+static UCHAR *p;
+static int	once;
+
+void put4(int b)
+{
+static int	last;
+
+   last = (last << 4) | b;
+   if(++once == 2) {
+	*p++ = last;
+	once = 0;
+   }
+}
+
+int DecodeRLE4(UCHAR *buf, FILE *fp)
+{
+int		c, n, c1, c2;
+
+   p = buf;
+   once = 0;
+   while(1) {
+	switch(n = fgetc(fp)) {
+		case EOF:
+			return(0);
+		case 0:					/* 0 = escape*/
+		switch(n = fgetc(fp)) {
+			case 0: 			/* 0 0 = end of current scan line*/
+				if(once)
+					put4(0);
+				return(1);
+			case 1:				/* 0 1 = end of data*/
+				if(once)
+					put4(0);
+				return(1);
+			case 2:				/* 0 2 xx yy delta mode - NOT SUPPORTED*/
+				(void)fgetc(fp);
+				(void)fgetc(fp);
+				continue;
+			default:			/* 0 3..255 xx nn uncompressed data*/
+				c2 = (n+3) & ~3;
+				for(c=0; c<c2; c++) {
+					if((c & 1) == 0)
+							c1 = fgetc(fp);
+					if(c < n)
+							put4((c1 >> 4) & 0x0f);
+					c1 <<= 4;
+				}
+				continue;
+			}
+		default:
+			c = fgetc(fp);
+			c1 = (c >> 4) & 0x0f;
+			c2 = c & 0x0f;
+			for(c=0; c<n; c++)
+				put4((c&1)? c2: c1);
+			continue;
+		}
+	}
+}
diff -urN lib/microwindows/src/mwin/bmp/convbmp.org /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/convbmp.org
--- lib/microwindows/src/mwin/bmp/convbmp.org	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/convbmp.org	2005-02-21 16:13:24.000000000 +0100
@@ -0,0 +1,460 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Windows BMP to Microwindows image converter
+ *
+ * 6/9/1999 g haerr
+ *
+ * 05/01/2000 Michael Temari <Michael@TemWare.Com
+ *
+ * Modified to output .s ACK format for Minix
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "device.h"
+
+#define PIX2BYTES(n)	(((n)+7)/8)
+
+#define BI_RGB		0L
+#define BI_RLE8		1L
+#define BI_RLE4		2L
+#define BI_BITFIELDS	3L
+
+typedef unsigned char	UCHAR;
+typedef unsigned char	BYTE;
+
+#ifndef _MINIX
+typedef unsigned short	WORD;
+typedef unsigned long	DWORD;
+typedef long		LONG;
+#define	CASTWORD
+#define	CASTDWORD
+#define	CASTLONG
+#else
+/* The Minix ACK compiler cannot pack a structure so we do it the hardway */
+typedef unsigned char	WORD[2];
+typedef unsigned char	DWORD[4];
+typedef unsigned char	LONG[4];
+#define	CASTWORD	*(unsigned short *)&
+#define	CASTDWORD	*(unsigned long *)&
+#define	CASTLONG	*(long *)&
+#endif
+
+#pragma pack(1)
+/* windows style*/
+typedef struct {
+	/* BITMAPFILEHEADER*/
+	BYTE	bfType[2];
+	DWORD	bfSize;
+	WORD	bfReserved1;
+	WORD	bfReserved2;
+	DWORD	bfOffBits;
+	/* BITMAPINFOHEADER*/
+	DWORD	BiSize;
+	LONG	BiWidth;
+	LONG	BiHeight;
+	WORD	BiPlanes;
+	WORD	BiBitCount;
+	DWORD	BiCompression;
+	DWORD	BiSizeImage;
+	LONG	BiXpelsPerMeter;
+	LONG	BiYpelsPerMeter;
+	DWORD	BiClrUsed;
+	DWORD	BiClrImportant;
+} BMPHEAD;
+
+/* os/2 style*/
+typedef struct {
+	/* BITMAPFILEHEADER*/
+	BYTE	bfType[2];
+	DWORD	bfSize;
+	WORD	bfReserved1;
+	WORD	bfReserved2;
+	DWORD	bfOffBits;
+	/* BITMAPCOREHEADER*/
+	DWORD	bcSize;
+	WORD	bcWidth;
+	WORD	bcHeight;
+	WORD	bcPlanes;
+	WORD	bcBitCount;
+} BMPCOREHEAD;
+#pragma pack()
+
+int	ConvBMP(FILE *fp,char *name);
+void	outline(UCHAR *linebuffer, int bitdepth, int linesize, int y);
+int	DecodeRLE8(UCHAR *buf,FILE *fp);
+int	DecodeRLE4(UCHAR *buf,FILE *fp);
+void	put4(int b);
+
+int	s_flag = 0;
+
+int main(int argc,char *argv[])
+{
+FILE	*fp;
+char 	*p;
+char	name[64];
+char	oname[64];
+
+   /* skip the program name */
+   argc--;
+   argv++;
+
+   /* check for -s flag */
+   if(argc && strcmp(*argv, "-s") == 0) {
+	s_flag = -1;
+	argc--;
+	argv++;
+   }
+
+   /* need at least one file to convert */
+   if(argc == 0) {
+	fprintf(stderr, "Usage: convbmp [-s] <bmpfile>\n");
+	return(-1);
+   }
+
+   /* go back one since the first thing in the loop is to increment */
+   argv--;
+   while(argc--) {
+	argv++;
+	if((p = strrchr(*argv, '.')) != (char *)NULL)
+		*p = '\0';
+	strcpy(name, *argv);
+	strcpy(oname, *argv);
+	if(s_flag)
+		strcat(oname, ".s");
+	else
+		strcat(oname, ".c");
+	if(p != (char *)NULL)
+		*p = '.';
+	if((fp = fopen(*argv, "rb")) == (FILE *)NULL) {
+		fprintf(stderr, "Can't open file: %s\n", *argv);
+		continue;
+	}
+	if(freopen(oname, "w", stdout) == (FILE *)NULL) {
+		fclose(fp);
+		fprintf(stderr, "Could not open output file %s\n", oname);
+		continue;
+	}
+	if(ConvBMP(fp, name)) {
+		fprintf(stderr, "Conversion failed: %s\n", *argv);
+		fclose(fp);
+		fclose(stdout);
+		continue;
+	}
+	fclose(fp);
+	fclose(stdout);
+   }
+   return(0);
+}
+
+/* decode a bmp file*/
+int ConvBMP(FILE *fp, char *name)
+{
+BMPHEAD		bmp;
+BMPCOREHEAD	*bmc;
+int		i, n;
+UCHAR		*linebuffer = NULL;
+unsigned int	cx, cy, bitdepth, linesize;
+long		compression;
+MWPALENTRY	cmap[256];
+long l;
+int g;
+UCHAR *p = (UCHAR *)&l;
+
+   /* read BMP header*/
+   if(fread(&bmp, 1, sizeof(BMPHEAD), fp) != sizeof(BMPHEAD)) {
+   	fprintf(stderr, "Error reading .bmp file header\n");
+	return(-1);
+   }
+
+   /* might be windows or os/2 header*/
+   if(CASTDWORD bmp.BiSize == 12) {
+	bmc = (BMPCOREHEAD *)&bmp;
+	cx = (int)CASTWORD bmc->bcWidth;
+	cy = (int)CASTWORD bmc->bcHeight;
+	bitdepth = CASTWORD bmc->bcBitCount;
+	n = 1 << bitdepth;
+	compression = BI_RGB;
+	fseek(fp, sizeof(BMPCOREHEAD), SEEK_SET);
+   } else {
+	cx = (int)CASTLONG bmp.BiWidth;
+	cy = (int)CASTLONG bmp.BiHeight;
+	bitdepth = CASTWORD bmp.BiBitCount;
+	n = (int)CASTDWORD bmp.BiClrUsed;
+	if(n == 0)
+		n = 1 << bitdepth;
+	compression = CASTDWORD bmp.BiCompression;
+   }
+
+   /* currently only decode palettized bitmaps*/
+   if(bitdepth > 8) {
+	fprintf(stderr, "Error: bits per pixel > 8\n");
+	return(-1);
+   }
+
+   /* compute image line size and allocate line buffer*/
+   if(bitdepth == 1)
+	linesize = PIX2BYTES(cx);
+   else if(bitdepth <= 4)
+	linesize = PIX2BYTES(cx<<2);
+   else if(bitdepth <= 8)
+	linesize = cx;
+   else if(bitdepth <= 16)
+	linesize = cx * 2;
+   else if(bitdepth <= 24)
+	linesize = cx * 3;
+   else
+	linesize = cx * 4;
+
+   linesize = (linesize+3) & ~3;
+
+   if((linebuffer = malloc(linesize)) == (UCHAR *)NULL) {
+   	fprintf(stderr, "Error with malloc(%d)\n", linesize);
+	return(-1);
+   }
+
+   /* get colormap*/
+   if(bitdepth <= 8) {
+	for(i=0; i<n; i++) {
+		cmap[i].b = fgetc(fp);
+		cmap[i].g = fgetc(fp);
+		cmap[i].r = fgetc(fp);
+		if(CASTDWORD bmp.BiSize != 12)
+			fgetc(fp);
+	}
+   }
+
+   if(!s_flag) {
+	printf("/* Generated by convbmp*/\n");
+	printf("#include \"device.h\"\n\n");
+	printf("/* MWIMAGEHDR image_%s converted from %s.bmp*/\n\n",
+		name, name);
+	/* extract palette*/
+	printf("static MWPALENTRY palette[%d] = {\n", n);
+	for(i=0; i<n; ++i)
+		printf("  RGBDEF( %3d, %3d, %3d ),\t/* pal %d*/\n",
+			cmap[i].r, cmap[i].g, cmap[i].b, i);
+	printf("};\n\n");
+   } else {
+	printf(".sect .text; .sect .rom; .sect .data; .sect .bss\n");
+	printf(".sect .data\n");
+	printf("__II0:\n");
+	l = 0L; g = 0; p = (UCHAR *)&l;
+	for(i=0; i<n; ++i) {
+		p[g++] = cmap[i].r;
+		if(g == 4) { g = 0; printf(".data4\t%ld\n", l); l = 0L; }
+		p[g++] = cmap[i].g;
+		if(g == 4) { g = 0; printf(".data4\t%ld\n", l); l = 0L; }
+		p[g++] = cmap[i].b;
+		if(g == 4) { g = 0; printf(".data4\t%ld\n", l); l = 0L; }
+	}
+	if(g)
+		printf(".data4\t%ld\n", l);
+   }
+
+   if(!s_flag) {
+	printf("static MWUCHAR imagebits[] = {\n");
+   } else {
+	printf("__II1:\n");
+	l = 0L; g = 0;
+   }
+
+   /* decode image data*/
+   fseek(fp, CASTDWORD bmp.bfOffBits, SEEK_SET);
+   if(compression == BI_RLE8) {
+	for(i = cy-1; i>= 0; i--) {
+		if(!DecodeRLE8(linebuffer, fp))
+			break;
+		outline(linebuffer, bitdepth, linesize, i);
+	}
+   } else if(compression == BI_RLE4) {
+	for(i = cy-1; i>= 0; i--) {
+		if(!DecodeRLE4(linebuffer, fp))
+			break;
+		outline(linebuffer, bitdepth, linesize, i);
+	}
+   } else {
+	for(i=0; i<cy; i++) {
+		if(fread(linebuffer, 1, linesize, fp) != (size_t)linesize) {
+			free(linebuffer);
+			fprintf(stderr, "Error fread\n");
+			return(-1);
+		}
+		outline(linebuffer, bitdepth, linesize, cy-i-1);
+	}
+   }
+
+   if(!s_flag) {
+	printf("};\n\n");
+
+	printf("MWIMAGEHDR image_%s = {\n", name);
+	printf("  %d, %d,\t/* width, height*/\n", cx, cy);
+	printf("  %d, %d,\t\t/* planes, bpp*/\n", 1, bitdepth);
+	printf("  %d, %d,\t/* compression, palsize*/\n", 1, n);
+	printf("  palette,\n");
+	printf("  imagebits,\n");
+	printf("};\n");
+   } else {
+	printf(".extern _image_%s\n", name);
+	printf("_image_%s:\n", name);
+	printf(".data4\t%ld\n",(long)cx);
+	printf(".data4\t%ld\n",(long)cy);
+	printf(".data4\t%ld\n",1L);
+	printf(".data4\t%ld\n",(long)bitdepth);
+	printf(".data4\t%ld\n",1L);
+	printf(".data4\t%ld\n",(long)n);
+	printf(".data4\t__II0\n");
+	printf(".data4\t__II1\n");
+	printf(".sect .text\n");
+   }
+
+   free(linebuffer);
+
+   return(0);
+}
+
+void outline(UCHAR *linebuffer, int bitdepth, int linesize, int y)
+{
+static int bc = 0;
+static long l = 0;
+static char *p = (char *)&l;
+int	n;
+
+   switch(bitdepth) {
+	case 1:
+	case 4:
+		for(n=0; n<linesize; ++n) {
+			if(!s_flag)
+				printf("0x%02x,", linebuffer[n]);
+			else {
+				p[bc++] = linebuffer[n];
+				if(bc == 4) {
+					bc = 0;
+					printf(".data4\t%ld\n", l);
+					l = 0L;
+				}
+			}
+		}
+		break;
+	case 8:
+	default:
+		for(n=0; n<linesize; ++n) {
+			if(!s_flag)
+				printf("%d,", linebuffer[n]);
+			else {
+				p[bc++] = linebuffer[n];
+				if(bc == 4) {
+					bc = 0;
+					printf(".data4\t%ld\n", l);
+					l = 0L;
+				}
+			}
+		}
+   }
+   if(!s_flag)
+	printf("\n");
+}
+
+/*
+ * Decode one line of RLE8, return 0 when done with all bitmap data
+ */
+int DecodeRLE8(UCHAR *buf,FILE *fp)
+{
+int		c, n;
+UCHAR *	p = buf;
+
+   while(1) {
+	switch(n = fgetc(fp)) {
+		case EOF:
+			return(0);
+		case 0:					/* 0 = escape*/
+			switch(n = fgetc(fp)) {
+			case 0: 			/* 0 0 = end of current scan line*/
+				return(1);
+			case 1:				/* 0 1 = end of data*/
+				return(1);
+			case 2:				/* 0 2 xx yy delta mode - NOT SUPPORTED*/
+				(void)fgetc(fp);
+				(void)fgetc(fp);
+				continue;
+			default:			/* 0 3..255 xx nn uncompressed data*/
+				for(c=0; c<n; c++)
+					*p++ = fgetc(fp);
+				if(n & 1)
+					(void)fgetc(fp);
+				continue;
+			}
+		default:
+			c = fgetc(fp);
+			while(n--)
+				*p++ = c;
+			continue;
+		}
+	}
+}
+
+/*
+ * Decode one line of RLE4, return 0 when done with all bitmap data
+ */
+static UCHAR *p;
+static int	once;
+
+void put4(int b)
+{
+static int	last;
+
+   last = (last << 4) | b;
+   if(++once == 2) {
+	*p++ = last;
+	once = 0;
+   }
+}
+
+int DecodeRLE4(UCHAR *buf, FILE *fp)
+{
+int		c, n, c1, c2;
+
+   p = buf;
+   once = 0;
+   while(1) {
+	switch(n = fgetc(fp)) {
+		case EOF:
+			return(0);
+		case 0:					/* 0 = escape*/
+		switch(n = fgetc(fp)) {
+			case 0: 			/* 0 0 = end of current scan line*/
+				if(once)
+					put4(0);
+				return(1);
+			case 1:				/* 0 1 = end of data*/
+				if(once)
+					put4(0);
+				return(1);
+			case 2:				/* 0 2 xx yy delta mode - NOT SUPPORTED*/
+				(void)fgetc(fp);
+				(void)fgetc(fp);
+				continue;
+			default:			/* 0 3..255 xx nn uncompressed data*/
+				c2 = (n+3) & ~3;
+				for(c=0; c<c2; c++) {
+					if((c & 1) == 0)
+							c1 = fgetc(fp);
+					if(c < n)
+							put4((c1 >> 4) & 0x0f);
+					c1 <<= 4;
+				}
+				continue;
+			}
+		default:
+			c = fgetc(fp);
+			c1 = (c >> 4) & 0x0f;
+			c2 = c & 0x0f;
+			for(c=0; c<n; c++)
+				put4((c&1)? c2: c1);
+			continue;
+		}
+	}
+}
diff -urN lib/microwindows/src/mwin/bmp/convxpm.perl /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/convxpm.perl
--- lib/microwindows/src/mwin/bmp/convxpm.perl	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/convxpm.perl	2005-02-21 16:03:34.000000000 +0100
@@ -0,0 +1,116 @@
+#!/bin/perl
+
+# This is a little perl script that converts XPM colors from
+# X colors to their true RGB format
+
+# Change this first, if you rgb.txt file lives somewhere else 
+$RFILE="/usr/X11R6/lib/X11/rgb.txt";
+
+# First, Open up the RGBFILE, and make a hash table
+
+open (RGBIN, $RFILE) || die "Can not file $RGBFILE!";
+
+while(<RGBIN>)
+{
+    chop($_);
+
+    $firstchar = substr($_, 0, 1);
+
+    if ($firstchar ne "!")
+    {
+	($r, $g, $b, $val) = /\s*(\d*)\s*(\d*)\s*(\d*)\s*(\w*)/;
+	$rgbvals{$val} = sprintf("#%2.2x%2.2x%2.2x", $r, $g, $b);
+    }
+}
+
+close(RGBIN);
+
+# Ok then, are we in batch mode or individual mode?
+
+if ($ARGV[0] eq "--batch")
+{
+    $srcdir = $ARGV[1];
+    $destdir = $ARGV[2];
+
+    # Batch mode, open up directory and fire 
+    opendir(INDIR, $srcdir) || die "Directory $ARGV[1] doesn't exist";
+    my @xpms = readdir(INDIR);
+    closedir(INDIR);
+
+    foreach $xpmfile (@xpms)
+    {
+	if ($xpmfile =~ /\.xpm/g)
+	{
+	    print "Converting $srcdir/$xpmfile to $destdir/$xpmfile...\n"
+	    &convert_xpm("$srcdir/$xpmfile", "$destdir/$xpmfile");
+	}
+    }
+}
+else
+{
+    # regular mode
+    &convert_xpm($ARGV[0], $ARGV[1]);
+}
+
+
+sub convert_xpm
+{
+    # Open up the file to convert it 
+
+    $filea = $_[0];
+    $fileb = $_[1];
+
+    print"Writing from $filea to $fileb...\n";
+
+    open(XPMIN, $filea) || die "Could not file $filea for processing...\n";
+    open(XPMOUT,">$fileb") || die "Could not open file $fileb for writing...\n";
+
+    $xpmline = <XPMIN>;
+    
+    die "$fila is Not an XPM file!\n" if (!($xpmline =~ /\/\* XPM \*\/\n/));
+    
+    $firstchar = substr($xpmline, 0, 1);   
+    
+    while($firstchar ne "\"")
+    {
+	print XPMOUT $xpmline;
+	$xpmline = <XPMIN>;
+	$firstchar = substr($xpmline, 0, 1);   
+    }
+    
+    # Now we have the numbers.  Grab em! 
+    
+    ($width, $height, $colors, $chars) = ($xpmline =~ /\"(\d*) (\d*) (\d*) (\d*)\",\n/);
+
+    print XPMOUT $xpmline;
+    
+    # Now read in the appropriate number of colors
+
+    for($i = 0; $i < $colors; $i++)
+    {
+	$xpmline = <XPMIN>;
+	chop($xpmline);
+	
+	($str, $val, $color) = ($xpmline =~ /\"(.+)\s+(\w*)\s+(.+)\"/);
+	
+	$firstchar = substr($color, 0, 1); 
+	
+	if ($firstchar ne "#")
+	{
+	    $color = $rgbvals{$color} if ($color ne "None");
+	}
+	
+	print XPMOUT "\"$str  $val $color\",\n";
+    }
+    
+    while(<XPMIN>)
+    {
+	print XPMOUT $_;
+    }
+    
+    close(XPMIN);
+    close(XPMOUT);
+}
+
+
+
Binary files lib/microwindows/src/mwin/bmp/cs1.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/cs1.bmp differ
diff -urN lib/microwindows/src/mwin/bmp/cs1.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/cs1.c
--- lib/microwindows/src/mwin/bmp/cs1.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/cs1.c	2005-02-21 16:03:34.000000000 +0100
@@ -0,0 +1,178 @@
+/* Generated by convbmp*/
+#include "device.h"
+
+/* MWIMAGEHDR image_cs1 converted from cs1.bmp*/
+
+static MWPALENTRY palette[2] = {
+  RGBDEF(   0,   0,   0 ),	/* pal 0*/
+  RGBDEF( 255, 255, 255 ),	/* pal 1*/
+};
+
+static MWUCHAR imagebits[] = {
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x83,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x00,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0xfe,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,0x03,0xf8,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x0f,0xe0,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x3f,0x80,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0xfe,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,0x03,0xf8,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x0f,0xe0,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x3f,0xc0,0x00,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0xff,0x00,0x00,0x0f,0xf7,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0x80,0x00,0x03,0xfc,0x00,0x00,0x3f,0xc1,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x0f,0xf0,0x00,0x00,0x7f,0x00,0x7f,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x3f,0xc0,0x00,0x01,0xfe,0x00,0x3f,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0xff,0x00,0x00,0x07,0xf8,0x00,0x0f,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0x80,0x00,0x03,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x07,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xfe,0x00,0x00,0x0f,0xf0,0x00,0x00,0x7f,0x80,0x00,0x07,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xf8,0x00,0x00,0x3f,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xf0,0x00,0x00,0xff,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xc0,0x00,0x03,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xff,0x1f,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0x00,0x00,0x0f,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xfc,0x07,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xfc,0x00,0x00,0x3f,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xf0,0x03,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xf0,0x00,0x00,0x7f,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0xc0,0x01,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xc0,0x00,0x01,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xff,0x00,0x00,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0x00,0x00,0x07,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xfc,0x00,0x00,0x3f,0xff,0xff,0x80,0x00,
+0xff,0xfc,0x00,0x00,0x1f,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xf0,0x00,0x00,0x1f,0xff,0xff,0x80,0x00,
+0xff,0xf0,0x00,0x00,0x7f,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0xc0,0x00,0x00,0x0f,0xff,0xff,0x80,0x00,
+0xff,0xc0,0x00,0x01,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xff,0x00,0x00,0x00,0x07,0xff,0xff,0x80,0x00,
+0xff,0x00,0x00,0x07,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xfc,0x00,0x00,0x00,0x03,0xff,0xff,0x80,0x00,
+0xf8,0x00,0x00,0x1f,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xf8,0x00,0x00,0x00,0x01,0xff,0xff,0x80,0x00,
+0xfe,0x00,0x00,0x7f,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0xe0,0x00,0x00,0x00,0x00,0xff,0xff,0x80,0x00,
+0xff,0x80,0x01,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xff,0x80,0x00,0x00,0x00,0x00,0x7f,0xff,0x80,0x00,
+0xff,0xc0,0x07,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xfe,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x80,0x00,
+0xff,0xf0,0x1f,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xf8,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x80,0x00,
+0xff,0xf8,0x7f,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0xe0,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0x80,0x00,
+0xff,0xfd,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0x80,0x00,
+0xff,0xff,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0x80,0x00,
+0xff,0xff,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0x80,0x00,
+0xff,0xff,0xe0,0x00,0x07,0xf8,0x00,0x00,0x3f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0x80,0x00,
+0xff,0xff,0xf8,0x00,0x1f,0xe0,0x00,0x00,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0x80,0x00,
+0xff,0xf9,0xfe,0x00,0x7f,0xc0,0x00,0x03,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x80,0x00,
+0xff,0xf0,0xff,0x01,0xff,0x00,0x00,0x0f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x80,0x00,
+0xff,0xe0,0x3f,0xe3,0xfc,0x00,0x00,0x3f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x80,0x00,
+0xff,0xe0,0x0f,0xcf,0xf0,0x00,0x00,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x80,0x00,
+0xff,0xc0,0x07,0xff,0xc0,0x00,0x01,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x80,0x00,
+0xff,0x80,0x01,0xfe,0x00,0x00,0x07,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x80,0x00,
+0xff,0x00,0x00,0xff,0x00,0x00,0x1f,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x80,0x00,
+0xff,0x00,0x00,0x3f,0xc0,0x00,0x7f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x80,0x00,
+0xfe,0x00,0x00,0x1f,0xe0,0x01,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x80,0x00,
+0xfe,0x00,0x00,0x07,0xf8,0x07,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x80,0x00,
+0xfc,0x00,0x00,0x01,0xfe,0x1f,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,
+0xf8,0x00,0x00,0x00,0xfe,0x7f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,
+0xf8,0x00,0x00,0x00,0x3f,0xff,0x00,0x00,0x1f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00,
+0xf8,0x00,0x00,0x00,0x1f,0xfc,0x00,0x00,0xff,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00,
+0xf0,0x00,0x00,0x00,0x07,0xf8,0x00,0x03,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00,
+0xf0,0x00,0x00,0x00,0x03,0xfe,0x00,0x0f,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00,
+0xe0,0x00,0x00,0x00,0x00,0xff,0x00,0x1f,0xff,0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0xe0,0x00,0x00,0x00,0x00,0x7f,0xc0,0x3f,0xff,0xff,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0xe0,0x00,0x00,0x00,0x00,0x1f,0xf0,0x7f,0xff,0xff,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0xc0,0x00,0x00,0x00,0x00,0x0f,0xf8,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0xc0,0x00,0x00,0x00,0x00,0x03,0xfc,0xff,0xff,0xff,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0xc0,0x00,0x00,0x00,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0xc0,0x00,0x00,0x00,0x00,0x00,0x7f,0xff,0xff,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0x80,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0x80,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,
+0x80,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,
+0x80,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,
+0x80,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x03,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x03,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x3f,0xe0,0x00,0x00,0x00,0x00,0x07,0x80,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xff,0xff,0xfe,0x1f,0xf8,0x00,0x00,0x00,0x00,0x07,0x80,0x00,
+0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xff,0xfc,0x07,0xfc,0x00,0x00,0x00,0x00,0x07,0x80,0x00,
+0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xf8,0x01,0xff,0x00,0x00,0x00,0x00,0x0f,0x80,0x00,
+0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xf0,0x00,0x7f,0xc0,0x00,0x00,0x00,0x0f,0x80,0x00,
+0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xe0,0x00,0x3f,0xe0,0x00,0x00,0x00,0x0f,0x80,0x00,
+0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x80,0x00,0x3f,0xf8,0x00,0x00,0x00,0x1f,0x80,0x00,
+0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xfc,0x00,0x00,0x7f,0xfc,0x00,0x00,0x00,0x1f,0x80,0x00,
+0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xfe,0x00,0x00,0x00,0x1f,0x80,0x00,
+0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xfe,0xff,0x80,0x00,0x00,0x3f,0x80,0x00,
+0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xf8,0x7f,0xc0,0x00,0x00,0x7f,0x80,0x00,
+0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xe0,0x1f,0xf0,0x00,0x00,0x7f,0x80,0x00,
+0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0x80,0x0f,0xf8,0x00,0x00,0xff,0x80,0x00,
+0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xfe,0x00,0x03,0xfe,0x00,0x00,0xff,0x80,0x00,
+0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xf8,0x00,0x00,0xff,0x80,0x01,0xff,0x80,0x00,
+0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xe0,0x00,0x01,0xff,0xc0,0x03,0xff,0x80,0x00,
+0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0x80,0x00,0x03,0xff,0xf0,0x03,0xff,0x80,0x00,
+0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xfe,0x00,0x00,0x0f,0xff,0xf8,0x07,0xff,0x80,0x00,
+0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xf8,0x00,0x00,0x3f,0xc3,0xfe,0x0f,0xff,0x80,0x00,
+0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xe0,0x00,0x00,0xff,0x01,0xff,0x1f,0xff,0x80,0x00,
+0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0x80,0x00,0x03,0xfc,0x00,0x7f,0x9f,0xff,0x80,0x00,
+0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xfe,0x00,0x00,0x0f,0xf0,0x00,0x1f,0xff,0xff,0x80,0x00,
+0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xf8,0x00,0x00,0x3f,0xc0,0x00,0x0f,0xff,0xff,0x80,0x00,
+0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xe0,0x00,0x00,0xff,0x00,0x00,0x07,0xff,0xff,0x80,0x00,
+0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x80,0x00,0x03,0xfc,0x00,0x00,0x1f,0xff,0xff,0x80,0x00,
+0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x03,0xfe,0x00,0x00,0x0f,0xf0,0x00,0x00,0x7f,0xff,0xff,0x80,0x00,
+0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x0f,0xfc,0x00,0x00,0x3f,0xc0,0x00,0x01,0xfe,0x3f,0xff,0x80,0x00,
+0xff,0xfc,0x00,0x00,0x00,0x00,0x00,0x3f,0xf0,0x00,0x00,0xff,0x00,0x00,0x07,0xf8,0x0f,0xff,0x80,0x00,
+0xff,0xfc,0x00,0x00,0x00,0x00,0x00,0xff,0xc0,0x00,0x03,0xfe,0x00,0x00,0x1f,0xe0,0x03,0xff,0x80,0x00,
+0xff,0xfe,0x00,0x00,0x00,0x00,0x03,0xff,0x00,0x00,0x07,0xf8,0x00,0x00,0x7f,0x80,0x01,0xff,0x80,0x00,
+0xff,0xff,0x00,0x00,0x00,0x00,0x0f,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x01,0xfe,0x00,0x00,0x7f,0x80,0x00,
+0xff,0xff,0x80,0x00,0x00,0x00,0x3f,0xf0,0x00,0x00,0x7f,0x80,0x00,0x07,0xf8,0x00,0x00,0x7f,0x80,0x00,
+0xff,0xff,0xe0,0x00,0x00,0x00,0xff,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xe0,0x00,0x00,0xff,0x80,0x00,
+0xff,0xff,0xe0,0x00,0x00,0x03,0xff,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0x80,0x00,0x03,0xff,0x80,0x00,
+0xff,0xff,0xf0,0x00,0x00,0x0f,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xfe,0x00,0x00,0x0f,0xff,0x80,0x00,
+0xff,0xff,0xfc,0x00,0x00,0x3f,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xf8,0x00,0x00,0x3f,0xff,0x80,0x00,
+0xff,0xff,0xfe,0x00,0x00,0xff,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xe0,0x00,0x00,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0x00,0x03,0xff,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0x80,0x00,0x03,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0x80,0x0f,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xfe,0x00,0x00,0x0f,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xc0,0x3f,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xf8,0x00,0x00,0x3f,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xf0,0x7f,0xc0,0x00,0x01,0xfe,0x00,0x00,0x0f,0xe0,0x00,0x00,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xf9,0xff,0x00,0x00,0x07,0xf8,0x00,0x00,0x3f,0x80,0x00,0x03,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xfc,0x00,0x00,0x1f,0xe0,0x00,0x00,0xfe,0x00,0x00,0x0f,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xf0,0x00,0x00,0x7f,0x80,0x00,0x03,0xf8,0x00,0x00,0x3f,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0x80,0x00,0x01,0xfe,0x00,0x00,0x0f,0xe0,0x00,0x00,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xc0,0x00,0x07,0xf8,0x00,0x00,0x3f,0x80,0x00,0x03,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xf0,0x00,0x1f,0xe0,0x00,0x00,0xff,0x00,0x00,0x0f,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xfc,0x00,0x7f,0x80,0x00,0x03,0xfc,0x00,0x00,0x3f,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xfe,0x01,0xfe,0x00,0x00,0x0f,0xf0,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0x87,0xf8,0x00,0x00,0x3f,0xc0,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xdf,0xe0,0x00,0x00,0xff,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,0x03,0xfc,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xfc,0x00,0x00,0x0f,0xf0,0x00,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xfe,0x00,0x00,0x3f,0xc0,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,0xff,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x03,0xfc,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x0f,0xf0,0x00,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x3f,0xc0,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xff,0x00,0x00,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x00,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x00,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x00,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0x00,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc1,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x00,
+};
+
+MWIMAGEHDR image_cs1 = {
+  145, 156,	/* width, height*/
+  1, 1,		/* planes, bpp*/
+  20, 1,	/* pitch, bytesperpixel*/
+  1, 2,	/* compression, palsize*/
+  -1L,		/* transcolor*/
+  palette,
+  imagebits,
+};
Binary files lib/microwindows/src/mwin/bmp/earth.jpg and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/earth.jpg differ
diff -urN lib/microwindows/src/mwin/bmp/layout /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/layout
--- lib/microwindows/src/mwin/bmp/layout	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/layout	2005-02-21 16:03:35.000000000 +0100
@@ -0,0 +1,21 @@
+0000000 4d42 00e6 0000 0000 0000 0076 0000 0028
+	[BM] [fbSize ] [r1] [r2] [bfOffbi] [biS
+0000020 0000 0010 0000 000e 0000 0001 0004 0000
+	ize] [biWidth] [Biheigh] plan bpp  comp
+0000040 0000 0070 0000 0000 0000 0000 0000 0010
+	ress imagesize xpelsperm ypelsperm colo
+0000060 0000 0010 0000 0000 0000 0000 00bf bf00
+	ruse clrimport
+0000100 0000 bf00 00bf 00bf 0000 00bf 00bf bfbf
+0000120 0000 c0c0 00c0 8080 0080 0000 00ff ff00
+0000140 0000 ff00 00ff 00ff 0000 00ff 00ff ffff
+0000160 0000 ffff 00ff 0000 0000 0000 0000 88f8
+		       bitmap->
+0000200 8888 8888 8088 77f7 7777 7777 8077 70f7
+0000220 0000 0000 8077 70f7 7777 7077 8077 70f7
+0000240 7777 7077 8077 70f7 7777 7077 8077 70f7
+*
+0000300 7777 7077 8077 70f7 0000 0000 8077 70f7
+0000320 0000 0000 8077 77f7 7777 7777 8077 ffff
+0000340 ffff ffff f0ff
+0000346
diff -urN lib/microwindows/src/mwin/bmp/makebmp.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/makebmp.c
--- lib/microwindows/src/mwin/bmp/makebmp.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/makebmp.c	2005-02-21 16:13:22.000000000 +0100
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Framebuffer data to .bmp file converter
+ *
+ * 10/4/1999 g haerr
+ */
+#include <stdio.h>
+#include <unistd.h>
+
+#define BI_RGB		0L
+#define BI_RLE8		1L
+#define BI_RLE4		2L
+#define BI_BITFIELDS	3L
+
+typedef unsigned char	BYTE;
+typedef unsigned short	WORD;
+typedef unsigned long	DWORD;
+typedef long		LONG;
+
+#pragma pack(1)
+/* windows style*/
+typedef struct {
+	/* BITMAPFILEHEADER*/
+	BYTE	bfType[2];
+	DWORD	bfSize;
+	WORD	bfReserved1;
+	WORD	bfReserved2;
+	DWORD	bfOffBits;
+	/* BITMAPINFOHEADER*/
+	DWORD	BiSize;
+	LONG	BiWidth;
+	LONG	BiHeight;
+	WORD	BiPlanes;
+	WORD	BiBitCount;
+	DWORD	BiCompression;
+	DWORD	BiSizeImage;
+	LONG	BiXpelsPerMeter;
+	LONG	BiYpelsPerMeter;
+	DWORD	BiClrUsed;
+	DWORD	BiClrImportant;
+} BMPHEAD;
+#pragma pack()
+
+int		MakeBMP(FILE *ifp,FILE *ofp);
+
+int
+main(int ac,char **av)
+{
+	FILE	*ifp;
+	FILE	*ofp;
+
+	if(ac < 3) {
+		fprintf(stderr, "Usage: makebmp <infile> <outfile>\n");
+		exit(1);
+	}
+	ifp = fopen(av[1], "rb");
+	if(!ifp) {
+		fprintf(stderr, "Can't open file: %s\n", av[1]);
+		exit(1);
+	}
+	ofp = fopen(av[2], "wb");
+	if(!ofp) {
+		fprintf(stderr, "Can't create file: %s\n", av[2]);
+		exit(1);
+	}
+	if(!MakeBMP(ifp, ofp)) {
+		fprintf(stderr, "Conversion failed: %s\n", av[2]);
+		fclose(ofp);
+		unlink(av[2]);
+		exit(1);
+	}
+	fclose(ifp);
+	fclose(ofp);
+	return 0;
+}
+
+/* create a bmp file*/
+int
+MakeBMP(FILE *ifp, FILE *ofp)
+{
+	BMPHEAD	bmp;
+	int	i, j;
+	int	cx, cy, extra, bitdepth, ncolors;
+
+	cx = 640;
+	cy = 480;
+	extra = (cx + 3) & 3;
+	bitdepth = 8;
+	if(bitdepth <= 8)
+		ncolors = 1<<bitdepth;
+	else ncolors = 0;
+
+	memset(&bmp, 0, sizeof(bmp));
+	bmp.bfType[0] = 'B';
+	bmp.bfType[1] = 'M';
+	bmp.bfSize = sizeof(bmp) + ncolors*4 + (long)cx*cy;
+	bmp.bfOffBits = sizeof(bmp) + ncolors*4;
+	bmp.BiSize = 40;
+	bmp.BiWidth = cx;
+	bmp.BiHeight = cy;
+	bmp.BiPlanes = 1;
+	bmp.BiBitCount = bitdepth;
+	bmp.BiCompression = BI_RGB;
+	//bmp.BiSizeImage = ??;
+	bmp.BiClrUsed = ncolors;
+	bmp.BiClrImportant = ncolors;
+
+	/* write header*/
+	fwrite(&bmp, sizeof(bmp), 1, ofp);
+
+	/* write palette*/
+	if(bitdepth <= 8) {
+		for(i=0; i<ncolors; i++) {
+			unsigned char r, g, b;
+			r = getc(ifp);
+			g = getc(ifp);
+			b = getc(ifp);
+			putc(b, ofp);
+			putc(g, ofp);
+			putc(r, ofp);
+			putc(0, ofp);
+		}
+	}
+
+	/* write image data, upside down ;)*/
+	for(i=cy-1; i>0; --i) {
+		long base = sizeof(bmp) + ncolors*4 + (long)i*cx;
+		fseek(ofp, base, SEEK_SET);
+		for(j=0; j<cx; ++j)
+			putc(getc(ifp), ofp);
+		for(j=0; j<extra; ++j)
+			putc(0, ofp);		/* DWORD pad each line*/
+	}
+	return 1;
+}
diff -urN lib/microwindows/src/mwin/bmp/makefile.conv /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/makefile.conv
--- lib/microwindows/src/mwin/bmp/makefile.conv	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/makefile.conv	2005-02-21 16:03:35.000000000 +0100
@@ -0,0 +1,61 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+ifndef TOP
+TOP = ../..
+CONFIG = $(TOP)/config
+endif
+
+include $(CONFIG)
+
+all: $(TOP)/bin/convbmp
+HOSTCC=gcc
+HOSTCFLAGS=-I../../include
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(MICROWIN), Y)
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME = libmwimages.a
+LIBNAMESO = libmwimages.so
+
+# List of objects to compile
+OBJS = car8.o min4.o max4.o close4.o under4.o\
+	zion208.o cs1.o rle8.o microwin.o penguin.o
+
+all: $(TOP)/bin/convbmp $(TOP)/bin/makebmp default
+
+endif
+
+######################### Makefile.rules section #############################
+
+#include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
+realclean: clean
+	$(RM) car8.c min4.c max4.c close4.c under4.c zion208.c cs1.c rle8.c \
+	microwin.c penguin.c
+
+$(TOP)/bin/convbmp: convbmp.c
+	$(HOSTCC) $(HOSTCFLAGS) $< -o $@
+
+$(TOP)/bin/makebmp: makebmp.c
+	$(HOSTCC) $(HOSTCFLAGS) $< -o $@
Binary files lib/microwindows/src/mwin/bmp/max4.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/max4.bmp differ
diff -urN lib/microwindows/src/mwin/bmp/max4.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/max4.c
--- lib/microwindows/src/mwin/bmp/max4.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/max4.c	2005-02-21 16:13:22.000000000 +0100
@@ -0,0 +1,50 @@
+/* Generated by convbmp*/
+#include "device.h"
+
+/* MWIMAGEHDR image_max4 converted from max4.bmp*/
+
+static MWPALENTRY palette[16] = {
+  RGBDEF(   0,   0,   0 ),	/* pal 0*/
+  RGBDEF( 191,   0,   0 ),	/* pal 1*/
+  RGBDEF(   0, 191,   0 ),	/* pal 2*/
+  RGBDEF( 191, 191,   0 ),	/* pal 3*/
+  RGBDEF(   0,   0, 191 ),	/* pal 4*/
+  RGBDEF( 191,   0, 191 ),	/* pal 5*/
+  RGBDEF(   0, 191, 191 ),	/* pal 6*/
+  RGBDEF( 192, 192, 192 ),	/* pal 7*/
+  RGBDEF( 128, 128, 128 ),	/* pal 8*/
+  RGBDEF( 255,   0,   0 ),	/* pal 9*/
+  RGBDEF(   0, 255,   0 ),	/* pal 10*/
+  RGBDEF( 255, 255,   0 ),	/* pal 11*/
+  RGBDEF(   0,   0, 255 ),	/* pal 12*/
+  RGBDEF( 255,   0, 255 ),	/* pal 13*/
+  RGBDEF(   0, 255, 255 ),	/* pal 14*/
+  RGBDEF( 255, 255, 255 ),	/* pal 15*/
+};
+
+static MWUCHAR imagebits[] = {
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0xf8,0x88,0x88,0x88,0x88,0x88,0x88,0x80,
+0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80,
+0xf7,0x70,0x00,0x00,0x00,0x00,0x77,0x80,
+0xf7,0x70,0x77,0x77,0x77,0x70,0x77,0x80,
+0xf7,0x70,0x77,0x77,0x77,0x70,0x77,0x80,
+0xf7,0x70,0x77,0x77,0x77,0x70,0x77,0x80,
+0xf7,0x70,0x77,0x77,0x77,0x70,0x77,0x80,
+0xf7,0x70,0x77,0x77,0x77,0x70,0x77,0x80,
+0xf7,0x70,0x77,0x77,0x77,0x70,0x77,0x80,
+0xf7,0x70,0x00,0x00,0x00,0x00,0x77,0x80,
+0xf7,0x70,0x00,0x00,0x00,0x00,0x77,0x80,
+0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
+};
+
+MWIMAGEHDR image_max4 = {
+  16, 14,	/* width, height*/
+  1, 4,		/* planes, bpp*/
+  8, 1,	/* pitch, bytesperpixel*/
+  1, 16,	/* compression, palsize*/
+  -1L,		/* transcolor*/
+  palette,
+  imagebits,
+};
Binary files lib/microwindows/src/mwin/bmp/micro2.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/micro2.bmp differ
Binary files lib/microwindows/src/mwin/bmp/microwin.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/microwin.bmp differ
diff -urN lib/microwindows/src/mwin/bmp/microwin.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/microwin.c
--- lib/microwindows/src/mwin/bmp/microwin.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/microwin.c	2005-02-21 16:03:36.000000000 +0100
@@ -0,0 +1,407 @@
+/* Generated by convbmp*/
+#include "device.h"
+
+/* MWIMAGEHDR image_microwin converted from microwin.bmp*/
+
+static MWPALENTRY palette[16] = {
+  RGBDEF(   0,   0,   0 ),	/* pal 0*/
+  RGBDEF(   0,   0,   0 ),	/* pal 1*/
+  RGBDEF(   0,   0,   0 ),	/* pal 2*/
+  RGBDEF(   0,   0,   0 ),	/* pal 3*/
+  RGBDEF(   0,   0,   0 ),	/* pal 4*/
+  RGBDEF(   0,   0,   0 ),	/* pal 5*/
+  RGBDEF(   0,   0,   0 ),	/* pal 6*/
+  RGBDEF(   0,   0,   0 ),	/* pal 7*/
+  RGBDEF(   0,   0,   0 ),	/* pal 8*/
+  RGBDEF(   0, 128,   0 ),	/* pal 9*/
+  RGBDEF(  63, 135, 163 ),	/* pal 10*/
+  RGBDEF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xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xdd,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee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88,0x88,0xf9,0xff,0xf9,0xff,0x9f,0xf9,0xff,0x9f,0x9f,0xf9,0xfc,0xf9,0xff,0x9f,0xf9,0xff,0x9f,0xf9,0xff,0x9f,0xff,0x9f,0xf9,0xff,0x9f,0x9f,0xf9,0xff,0xf9,0xf9,0xfc,0xff,0xf9,0xff,0x9f,0x9f,0xf9,0xff,0x9c,0xf9,0xff,0x9f,0xf9,0xff,0x9f,0xff,0x9f,0xf9,0xff,0xff,0x9f,0xf9,0xff,0x9f,0x9f,0xcf,0x9f,0xf9,0xff,0x9f,0x9f,0x9f,0x9f,0xcf,0x9f,0xcf,0xf9,0xff,0x9f,0xff,0xcf,0x9f,0xff,0xff,0x9f,0xff,0x9f,0x9f,0x9f,0xf9,0xf9,0xfc,0xf9,0xff,0x9f,0xf9,0xff,0xff,0xcf,0x9f,0x9f,0x8f,0x9f,0xff,0x9f,0x9f,0xf9,0x88,0x88,0x88,0x88,0x88,0xf9,0xff,0xf9,0xff,0x9f,0xf8,0x88,0x88,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x8f,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0x88,0xcf,0x9f,0xff,0x98,0x8f,0xff,0x88,0x9f,0xf8,0x88,0x8f,0x9f,0xff,0x98,0x88,0x88,0x88,0x8f,0xf8,0x88,0x8f,0xf8,0x88,0xff,0xff,0xff,0xff,0xf8,0xc8,0x8f,0xff,0xff,0x88,0xff,0xff,0xf9,0x88,0xff,0xff,0x88,0xff,0x8f,0x8c,0x88,0xff,0xff,0xf8,0x88,0x8f,0xff,0x98,0x88,0x8f,0xf8,0x8f,0xff,0xff,0x8f,0x9f,0xff,0xff,0xff,0x88,0xf8,0xff,0xff,0xf8,0x88,0x8f,0xff,0x98,0x88,0xff,0xff,0xff,0xf8,0xff,0xff,0xf8,0x8f,0xff,0xf8,0xff,0xff,0xff,0xff,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf9,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0x88,0xff,0x88,0xff,0xf8,0x8f,0xff,0x88,0xff,0xff,0x88,0x8f,0x88,0xff,0xff,0x88,0x88,0xf8,0x8f,0xff,0x88,0x8f,0xf8,0x88,0xff,0xff,0xff,0xf8,0x88,0xfc,0x8f,0xff,0xf8,0x8f,0xf8,0xff,0xff,0x88,0xff,0xf8,0x88,0xff,0x88,0xf9,0xf8,0xff,0xff,0xf8,0x88,0x8f,0xff,0xf8,0x88,0x8f,0xf8,0x88,0xff,0xf8,0x8f,0xf8,0x8f,0xff,0xf8,0x8f,0xcf,0x8f,0xff,0xff,0x88,0x8f,0xff,0xf8,0x88,0xff,0xff,0x88,0xf8,0x8f,0xff,0xf8,0xff,0xff,0x88,0x9f,0xff,0xff,0xff,0x88,0x8f,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0xff,0xf8,0xff,0xff,0x88,0xff,0xff,0x88,0x8f,0x98,0x88,0xff,0x88,0x88,0xff,0x8f,0xff,0x88,0x8f,0xf8,0x88,0xff,0xff,0xff,0x98,0x89,0xff,0xf9,0xff,0x88,0x8f,0xf8,0x88,0xff,0xff,0xff,0x88,0x88,0xf9,0x8f,0xff,0xff,0x89,0xff,0xff,0x88,0xff,0xff,0xff,0x88,0xff,0x88,0xff,0xff,0x88,0x8f,0xff,0xff,0xff,0x88,0xff,0xff,0xf9,0xff,0xff,0x88,0xff,0xff,0xf8,0x88,0xff,0xf8,0x88,0xff,0x88,0x8f,0xf8,0xff,0xf8,0x88,0xff,0xff,0xff,0xff,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0xff,0xf8,0xff,0xf8,0x88,0xff,0xff,0x88,0x8f,0xf8,0x88,0xff,0x88,0x88,0xff,0xff,0xff,0x88,0x8f,0xf8,0x88,0xff,0xff,0xff,0xf8,0x8f,0xff,0xff,0xf8,0x88,0x8f,0xf8,0x88,0xff,0xf9,0xf8,0x88,0x88,0xff,0xff,0xff,0x88,0x8f,0xff,0xf9,0x88,0x9f,0xff,0xff,0x88,0xff,0x88,0xff,0xff,0x88,0x8f,0xff,0x9f,0xff,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0xff,0xff,0xf8,0x88,0xff,0x88,0x88,0xff,0x88,0x8f,0xf8,0xff,0x88,0x88,0xff,0xff,0xff,0xff,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0x9f,0xf8,0xff,0xf8,0x88,0xff,0xff,0x88,0x8f,0xf8,0x88,0xff,0x88,0x88,0xff,0xff,0xff,0x88,0x8f,0x88,0x8f,0xff,0xff,0xff,0x88,0x8f,0xff,0xff,0xf8,0x88,0x8f,0xf8,0x88,0xff,0xff,0xf8,0x88,0x89,0xff,0xff,0x88,0x88,0x8f,0xff,0xff,0x88,0xff,0xff,0xf9,0x88,0xff,0x88,0xff,0xff,0x88,0x8f,0xff,0xff,0xf9,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0xff,0xff,0xf8,0x88,0xff,0x88,0x88,0xff,0x88,0x89,0xf8,0xff,0x88,0x88,0xff,0xff,0xff,0xff,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0xff,0xf8,0xf9,0x88,0x8f,0x9f,0xff,0x88,0x8f,0xf8,0x88,0xff,0x88,0x88,0x8f,0xff,0xff,0x88,0x8f,0x88,0x8f,0xff,0xff,0xff,0x88,0x8f,0xff,0xff,0x98,0x88,0x8f,0xf8,0x88,0x9f,0xff,0x88,0x88,0xff,0xff,0x88,0x88,0x88,0x8f,0xff,0xff,0x88,0xff,0xff,0xff,0x88,0x9f,0x88,0xff,0xff,0x88,0x8f,0xff,0xf9,0xff,0x88,0xff,0xff,0xff,0xff,0xf9,0x88,0x9f,0xff,0xf8,0x88,0xff,0x88,0x88,0xff,0x88,0x8f,0xf8,0xf8,0x88,0x88,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0xff,0xf8,0xf8,0x88,0xff,0xff,0xff,0x88,0x8f,0xf8,0x88,0xff,0x88,0x88,0xff,0xff,0xff,0x88,0x8f,0xf8,0x8f,0xff,0xff,0xff,0x88,0x8f,0xff,0xff,0xf8,0x88,0x8f,0xf8,0x88,0xff,0xf9,0x88,0x88,0xf8,0xf9,0x88,0x88,0x88,0xff,0xff,0xf9,0x88,0xff,0xff,0xff,0x88,0xff,0x88,0xff,0xff,0x88,0x8f,0xff,0xfc,0xff,0x88,0x9f,0xff,0xff,0xff,0xff,0x88,0xff,0xff,0xf8,0x88,0xff,0x88,0x88,0xf9,0x88,0x8f,0xf8,0xf8,0x88,0x8f,0x9f,0xff,0xff,0xff,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0x9f,0xff,0xf8,0x88,0xff,0x9f,0xff,0x88,0x8f,0x98,0x88,0xff,0x88,0x88,0xff,0xff,0xff,0x88,0x8f,0x98,0x88,0xff,0xff,0xff,0xf8,0x89,0xff,0xff,0xff,0x88,0x8f,0xf8,0x88,0xff,0xff,0x88,0x8f,0xf8,0xff,0x88,0x88,0xff,0xff,0xff,0xff,0x88,0xff,0xf8,0xf9,0x88,0xff,0x88,0xff,0xff,0x88,0x8f,0xff,0x9f,0xff,0x88,0xff,0xff,0xff,0x98,0xff,0x88,0xff,0xcf,0xf8,0x88,0xff,0x88,0x88,0xff,0x88,0x8f,0xf9,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0xff,0xff,0x88,0x88,0xff,0xff,0xff,0x88,0x8f,0xf8,0x88,0xff,0x88,0x88,0xff,0x8f,0xff,0x88,0x8f,0xf8,0x88,0xff,0xff,0xff,0xf8,0x8f,0xff,0xf8,0xff,0x88,0x8f,0xf8,0x88,0xff,0xf8,0x88,0x8f,0xf8,0xff,0x88,0x8f,0xff,0x8f,0xf8,0xff,0x88,0x9f,0x88,0xff,0x88,0xff,0x88,0xff,0xff,0x88,0x8f,0xff,0xff,0xff,0x88,0xff,0xff,0xff,0xf8,0xff,0x88,0xff,0xf9,0xf8,0x88,0xff,0xf8,0x88,0xff,0x88,0x8f,0xff,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xf8,0x8f,0xf8,0x88,0x8f,0xf8,0x8f,0xff,0x88,0x8f,0x88,0xff,0xff,0x88,0x88,0xf8,0x8f,0xff,0x88,0x8f,0x88,0x8f,0xff,0xff,0xff,0xff,0x88,0xff,0x88,0xff,0xf8,0x8f,0x98,0xff,0xff,0x88,0x88,0xff,0x88,0xff,0xf8,0x8f,0xff,0x8f,0xf8,0x8f,0x88,0xff,0x88,0xf8,0x88,0xf8,0x88,0xff,0xff,0x88,0x8f,0xff,0x88,0xff,0xf8,0x8f,0xf9,0x8f,0xf8,0xff,0x88,0xf8,0x8f,0xf8,0x88,0xff,0xff,0x88,0xf8,0x8f,0xff,0xf8,0x88,0x8f,0xff,0x8f,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff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0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf9,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0x88,0xff,0x88,0xff,0xf8,0x8f,0xff,0x88,0xff,0xff,0x88,0x8f,0x88,0xff,0xff,0x88,0x88,0xf8,0x8f,0xff,0x88,0x8f,0xf8,0x88,0xff,0xff,0xff,0xf8,0x88,0xfc,0x8f,0xff,0xf8,0x8f,0xf8,0xff,0xff,0x88,0xff,0xf8,0x88,0xff,0x88,0xf9,0xf8,0xff,0xff,0xf8,0x88,0x8f,0xff,0xf8,0x88,0x8f,0xf8,0x88,0xff,0xf8,0x8f,0xf8,0x8f,0xff,0xf8,0x8f,0xcf,0x8f,0xff,0xff,0x88,0x8f,0xff,0xf8,0x88,0xff,0xff,0x88,0xf8,0x8f,0xff,0xf8,0xff,0xff,0x88,0x9f,0xff,0xff,0xff,0x88,0x8f,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0xff,0xf8,0x9f,0xff,0x88,0xff,0xff,0x88,0x8f,0xf8,0x8f,0xff,0x88,0x88,0xff,0x8f,0xff,0x88,0x8f,0x98,0x88,0xff,0xff,0xff,0xf8,0x8f,0xff,0xff,0xff,0x88,0x8f,0xf8,0x8f,0xff,0xfc,0xff,0x88,0x88,0xff,0x88,0xff,0xff,0x8f,0xff,0xff,0x88,0xff,0xff,0xfc,0x88,0xff,0x88,0xcf,0xff,0x88,0x8f,0xff,0xff,0xff,0x88,0x9f,0xff,0x9f,0xff,0xf9,0x88,0xff,0xff,0xf8,0x88,0xff,0xf8,0x88,0xf9,0x88,0x8f,0xf8,0xff,0xff,0x88,0xff,0xff,0xff,0xff,0x88,0x88,0xff,0xff,0xff,0xff,0xf9,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0xff,0xf8,0xff,0xff,0x88,0xff,0xff,0x88,0x8f,0x98,0x88,0xff,0x88,0x88,0xff,0x8f,0xff,0x88,0x8f,0xf8,0x88,0xff,0xff,0xff,0x98,0x89,0xff,0xf9,0xff,0x88,0x8f,0xf8,0x88,0xff,0xff,0xff,0x88,0x88,0xf9,0x8f,0xff,0xff,0x89,0xff,0xff,0x88,0xff,0xff,0xff,0x88,0xff,0x88,0xff,0xff,0x88,0x8f,0xff,0xff,0xff,0x88,0xff,0xff,0xf9,0xff,0xff,0x88,0xff,0xff,0xf8,0x88,0xff,0xf8,0x88,0xff,0x88,0x8f,0xf8,0xff,0xf8,0x88,0xff,0xff,0xff,0xff,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0xff,0xf8,0xff,0xf8,0x88,0xff,0xff,0x88,0x8f,0xf8,0x88,0xff,0x88,0x88,0xff,0xff,0xff,0x88,0x8f,0xf8,0x88,0xff,0xff,0xff,0xf8,0x8f,0xff,0xff,0xf8,0x88,0x8f,0xf8,0x88,0xff,0xf9,0xf8,0x88,0x88,0xff,0xff,0xff,0x88,0x8f,0xff,0xf9,0x88,0x9f,0xff,0xff,0x88,0xff,0x88,0xff,0xff,0x88,0x8f,0xff,0x9f,0xff,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0xff,0xff,0xf8,0x88,0xff,0x88,0x88,0xff,0x88,0x8f,0xf8,0xff,0x88,0x88,0xff,0xff,0xff,0xff,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0x9f,0xf8,0xff,0xf8,0x88,0xff,0xff,0x88,0x8f,0xf8,0x88,0xff,0x88,0x88,0xff,0xff,0xff,0x88,0x8f,0x88,0x8f,0xff,0xff,0xff,0x88,0x8f,0xff,0xff,0xf8,0x88,0x8f,0xf8,0x88,0xff,0xff,0xf8,0x88,0x89,0xff,0xff,0x88,0x88,0x8f,0xff,0xff,0x88,0xff,0xff,0xf9,0x88,0xff,0x88,0xff,0xff,0x88,0x8f,0xff,0xff,0xf9,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0xff,0xff,0xf8,0x88,0xff,0x88,0x88,0xff,0x88,0x89,0xf8,0xff,0x88,0x88,0xff,0xff,0xff,0xff,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0xff,0xf8,0xf9,0x88,0x8f,0x9f,0xff,0x88,0x8f,0xf8,0x88,0xff,0x88,0x88,0x8f,0xff,0xff,0x88,0x8f,0x88,0x8f,0xff,0xff,0xff,0x88,0x8f,0xff,0xff,0x98,0x88,0x8f,0xf8,0x88,0x9f,0xff,0x88,0x88,0xff,0xff,0x88,0x88,0x88,0x8f,0xff,0xff,0x88,0xff,0xff,0xff,0x88,0x9f,0x88,0xff,0xff,0x88,0x8f,0xff,0xf9,0xff,0x88,0xff,0xff,0xff,0xff,0xf9,0x88,0x9f,0xff,0xf8,0x88,0xff,0x88,0x88,0xff,0x88,0x8f,0xf8,0xf8,0x88,0x88,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0xff,0xf8,0xf8,0x88,0xff,0xff,0xff,0x88,0x8f,0xf8,0x88,0xff,0x88,0x88,0xff,0xff,0xff,0x88,0x8f,0xf8,0x8f,0xff,0xff,0xff,0x88,0x8f,0xff,0xff,0xf8,0x88,0x8f,0xf8,0x88,0xff,0xf9,0x88,0x88,0xf8,0xf9,0x88,0x88,0x88,0xff,0xff,0xf9,0x88,0xff,0xff,0xff,0x88,0xff,0x88,0xff,0xff,0x88,0x8f,0xff,0xfc,0xff,0x88,0x9f,0xff,0xff,0xff,0xff,0x88,0xff,0xff,0xf8,0x88,0xff,0x88,0x88,0xf9,0x88,0x8f,0xf8,0xf8,0x88,0x8f,0x9f,0xff,0xff,0xff,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0xff,0xff,0x88,0x88,0xff,0xff,0xff,0x88,0x8f,0xf8,0x88,0xff,0x88,0x88,0xff,0x8f,0xff,0x88,0x8f,0xf8,0x88,0xff,0xff,0xff,0xf8,0x8f,0xff,0xf8,0xff,0x88,0x8f,0xf8,0x88,0xff,0xf8,0x88,0x8f,0xf8,0xff,0x88,0x8f,0xff,0x8f,0xf8,0xff,0x88,0x9f,0x88,0xff,0x88,0xff,0x88,0xff,0xff,0x88,0x8f,0xff,0xff,0xff,0x88,0xff,0xff,0xff,0xf8,0xff,0x88,0xff,0xf9,0xf8,0x88,0xff,0xf8,0x88,0xff,0x88,0x8f,0xff,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0x8f,0xf8,0x88,0x88,0xff,0x8f,0xff,0x88,0x8f,0xf8,0x8f,0xff,0x88,0x88,0xf8,0x8f,0xff,0x88,0x8f,0xf8,0x8f,0xff,0xff,0xff,0xf8,0x8f,0xff,0xf8,0xff,0x88,0x8f,0xf8,0x8f,0xff,0xf8,0x88,0xff,0xf8,0xff,0x88,0x8f,0xff,0x8f,0xf8,0xf9,0x88,0xff,0x88,0xff,0x88,0xf9,0x88,0xff,0xff,0x88,0x8f,0xff,0xf9,0xff,0x88,0x8f,0xff,0x8f,0x98,0xf9,0x88,0xf9,0x8f,0xf8,0x88,0xff,0xff,0x88,0xf8,0x88,0xff,0xf8,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0xf8,0x88,0xff,0xff,0xff,0xf8,0x88,0xff,0xf8,0x8f,0xf8,0x88,0x8f,0xf8,0x8f,0xff,0x88,0x8f,0x88,0xff,0xff,0x88,0x88,0xf8,0x8f,0xff,0x88,0x8f,0x88,0x8f,0xff,0xff,0xff,0xff,0x88,0xff,0x88,0xff,0xf8,0x8f,0x98,0xff,0xff,0x88,0x88,0xff,0x88,0xff,0xf8,0x8f,0xff,0x8f,0xf8,0x8f,0x88,0xff,0x88,0xf8,0x88,0xf8,0x88,0xff,0xff,0x88,0x8f,0xff,0x88,0xff,0xf8,0x8f,0xf9,0x8f,0xf8,0xff,0x88,0xf8,0x8f,0xf8,0x88,0xff,0xff,0x88,0xf8,0x8f,0xff,0xf8,0x88,0x8f,0xff,0x8f,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0x88,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0xff,0xff,0xff,0xff,0xff,0x88,0x88,0x88,0x88,0x88,0x8f,0xff,0xff,0xff,0xff,0xf8,0x8d,0xdd,0xdd,0xae,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xed,0xdd,0xdd,0xdd,0xda,0xed,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0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,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xaa,0x00,
+0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xea,0x00,
+0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0x00,
+};
+
+MWIMAGEHDR image_microwin = {
+  310, 371,	/* width, height*/
+  1, 4,		/* planes, bpp*/
+  156, 1,	/* pitch, bytesperpixel*/
+  1, 16,	/* compression, palsize*/
+  -1L,		/* transcolor*/
+  palette,
+  imagebits,
+};
Binary files lib/microwindows/src/mwin/bmp/min4.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/min4.bmp differ
diff -urN lib/microwindows/src/mwin/bmp/min4.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/min4.c
--- lib/microwindows/src/mwin/bmp/min4.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/min4.c	2005-02-21 16:13:23.000000000 +0100
@@ -0,0 +1,50 @@
+/* Generated by convbmp*/
+#include "device.h"
+
+/* MWIMAGEHDR image_min4 converted from min4.bmp*/
+
+static MWPALENTRY palette[16] = {
+  RGBDEF(   0,   0,   0 ),	/* pal 0*/
+  RGBDEF( 191,   0,   0 ),	/* pal 1*/
+  RGBDEF(   0, 191,   0 ),	/* pal 2*/
+  RGBDEF( 191, 191,   0 ),	/* pal 3*/
+  RGBDEF(   0,   0, 191 ),	/* pal 4*/
+  RGBDEF( 191,   0, 191 ),	/* pal 5*/
+  RGBDEF(   0, 191, 191 ),	/* pal 6*/
+  RGBDEF( 192, 192, 192 ),	/* pal 7*/
+  RGBDEF( 128, 128, 128 ),	/* pal 8*/
+  RGBDEF( 255,   0,   0 ),	/* pal 9*/
+  RGBDEF(   0, 255,   0 ),	/* pal 10*/
+  RGBDEF( 255, 255,   0 ),	/* pal 11*/
+  RGBDEF(   0,   0, 255 ),	/* pal 12*/
+  RGBDEF( 255,   0, 255 ),	/* pal 13*/
+  RGBDEF(   0, 255, 255 ),	/* pal 14*/
+  RGBDEF( 255, 255, 255 ),	/* pal 15*/
+};
+
+static MWUCHAR imagebits[] = {
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0xf8,0x88,0x88,0x88,0x88,0x88,0x88,0x80,
+0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80,
+0xf7,0x77,0x00,0x00,0x00,0x77,0x77,0x80,
+0xf7,0x77,0x00,0x00,0x00,0x77,0x77,0x80,
+0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80,
+0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80,
+0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80,
+0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80,
+0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80,
+0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80,
+0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80,
+0xf7,0x77,0x77,0x77,0x77,0x77,0x77,0x80,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
+};
+
+MWIMAGEHDR image_min4 = {
+  16, 14,	/* width, height*/
+  1, 4,		/* planes, bpp*/
+  8, 1,	/* pitch, bytesperpixel*/
+  1, 16,	/* compression, palsize*/
+  -1L,		/* transcolor*/
+  palette,
+  imagebits,
+};
Binary files lib/microwindows/src/mwin/bmp/penguin.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/penguin.bmp differ
diff -urN lib/microwindows/src/mwin/bmp/penguin.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/penguin.c
--- lib/microwindows/src/mwin/bmp/penguin.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/penguin.c	2005-02-21 16:03:36.000000000 +0100
@@ -0,0 +1,427 @@
+/* Generated by convbmp*/
+#include "device.h"
+
+/* MWIMAGEHDR image_penguin converted from penguin.bmp*/
+
+static MWPALENTRY palette[256] = {
+  RGBDEF(   0,   0,   0 ),	/* pal 0*/
+  RGBDEF(   8,   0,   0 ),	/* pal 1*/
+  RGBDEF(   8,   8,   0 ),	/* pal 2*/
+  RGBDEF(   8,   8,   8 ),	/* pal 3*/
+  RGBDEF(  18,  10,   0 ),	/* pal 4*/
+  RGBDEF(  33,   0,   0 ),	/* pal 5*/
+  RGBDEF(  16,  16,  16 ),	/* pal 6*/
+  RGBDEF(  24,  24,  24 ),	/* pal 7*/
+  RGBDEF(  39,  27,   4 ),	/* pal 8*/
+  RGBDEF(  63,  41,   2 ),	/* pal 9*/
+  RGBDEF(  66,  49,   0 ),	/* pal 10*/
+  RGBDEF(  74,  41,   0 ),	/* pal 11*/
+  RGBDEF(  74,  49,   0 ),	/* pal 12*/
+  RGBDEF(  78,  52,   3 ),	/* pal 13*/
+  RGBDEF(  90,  60,   2 ),	/* pal 14*/
+  RGBDEF(  99,  70,   4 ),	/* pal 15*/
+  RGBDEF(  33,  33,  33 ),	/* pal 16*/
+  RGBDEF(  41,  41,  41 ),	/* pal 17*/
+  RGBDEF(  41,  41,  66 ),	/* pal 18*/
+  RGBDEF(  49,  49,  49 ),	/* pal 19*/
+  RGBDEF(  63,  63,  60 ),	/* pal 20*/
+  RGBDEF(  82,  57,  41 ),	/* pal 21*/
+  RGBDEF(  74,  74,  66 ),	/* pal 22*/
+  RGBDEF(  74,  74,  74 ),	/* pal 23*/
+  RGBDEF(  74,  74,  82 ),	/* pal 24*/
+  RGBDEF(  82,  82,  82 ),	/* pal 25*/
+  RGBDEF(  90,  90,  90 ),	/* pal 26*/
+  RGBDEF(  99,  99,  90 ),	/* pal 27*/
+  RGBDEF(  90,  90,  99 ),	/* pal 28*/
+  RGBDEF(  99,  99,  99 ),	/* pal 29*/
+  RGBDEF(  99,  99, 107 ),	/* pal 30*/
+  RGBDEF(   0,   0, 255 ),	/* pal 31*/
+  RGBDEF( 141,  96,   1 ),	/* pal 32*/
+  RGBDEF( 158, 111,  24 ),	/* pal 33*/
+  RGBDEF( 196, 135,   9 ),	/* pal 34*/
+  RGBDEF( 211, 154,   5 ),	/* pal 35*/
+  RGBDEF( 226, 165,   4 ),	/* pal 36*/
+  RGBDEF( 229, 177,   1 ),	/* pal 37*/
+  RGBDEF( 237, 179,   8 ),	/* pal 38*/
+  RGBDEF( 237, 174,  16 ),	/* pal 39*/
+  RGBDEF( 233, 195,   8 ),	/* pal 40*/
+  RGBDEF( 247, 193,  12 ),	/* pal 41*/
+  RGBDEF( 243, 207,  10 ),	/* pal 42*/
+  RGBDEF( 255, 214,   8 ),	/* pal 43*/
+  RGBDEF( 255, 189,  16 ),	/* pal 44*/
+  RGBDEF( 247, 218,  16 ),	/* pal 45*/
+  RGBDEF( 247, 212,  24 ),	/* pal 46*/
+  RGBDEF( 249, 216,  47 ),	/* pal 47*/
+  RGBDEF( 117, 117, 120 ),	/* pal 48*/
+  RGBDEF( 142, 139, 139 ),	/* pal 49*/
+  RGBDEF( 181, 164, 145 ),	/* pal 50*/
+  RGBDEF( 173, 173, 177 ),	/* pal 51*/
+  RGBDEF( 189, 189, 189 ),	/* pal 52*/
+  RGBDEF( 202, 202, 202 ),	/* pal 53*/
+  RGBDEF( 198, 198, 231 ),	/* pal 54*/
+  RGBDEF( 218, 218, 218 ),	/* pal 55*/
+  RGBDEF( 231, 214, 140 ),	/* pal 56*/
+  RGBDEF( 231, 231, 222 ),	/* pal 57*/
+  RGBDEF( 222, 222, 239 ),	/* pal 58*/
+  RGBDEF( 239, 236, 236 ),	/* pal 59*/
+  RGBDEF( 247, 247, 239 ),	/* pal 60*/
+  RGBDEF( 239, 239, 247 ),	/* pal 61*/
+  RGBDEF( 247, 247, 247 ),	/* pal 62*/
+  RGBDEF( 255, 255, 255 ),	/* pal 63*/
+  RGBDEF(   0,   0,   0 ),	/* pal 64*/
+  RGBDEF( 191,   0,   0 ),	/* pal 65*/
+  RGBDEF(   0, 191,   0 ),	/* pal 66*/
+  RGBDEF( 191, 191,   0 ),	/* pal 67*/
+  RGBDEF(   0,   0, 191 ),	/* pal 68*/
+  RGBDEF( 191,   0, 191 ),	/* pal 69*/
+  RGBDEF(   0, 191, 191 ),	/* pal 70*/
+  RGBDEF( 192, 192, 192 ),	/* pal 71*/
+  RGBDEF( 128, 128, 128 ),	/* pal 72*/
+  RGBDEF( 255,   0,   0 ),	/* pal 73*/
+  RGBDEF(   0, 255,   0 ),	/* pal 74*/
+  RGBDEF( 255, 255,   0 ),	/* pal 75*/
+  RGBDEF(   0,   0, 255 ),	/* pal 76*/
+  RGBDEF( 255,   0, 255 ),	/* pal 77*/
+  RGBDEF(   0, 255, 255 ),	/* pal 78*/
+  RGBDEF( 255, 255, 255 ),	/* pal 79*/
+  RGBDEF(   0,   0,   0 ),	/* pal 80*/
+  RGBDEF(   0,   0,   0 ),	/* pal 81*/
+  RGBDEF(   0,   0,   0 ),	/* pal 82*/
+  RGBDEF(   0,   0,   0 ),	/* pal 83*/
+  RGBDEF(   0,   0,   0 ),	/* pal 84*/
+  RGBDEF(   0,   0,   0 ),	/* pal 85*/
+  RGBDEF(   0,   0,   0 ),	/* pal 86*/
+  RGBDEF(   0,   0,   0 ),	/* pal 87*/
+  RGBDEF(   0,   0,   0 ),	/* pal 88*/
+  RGBDEF(   0,   0,   0 ),	/* pal 89*/
+  RGBDEF(   0,   0,   0 ),	/* pal 90*/
+  RGBDEF(   0,   0,   0 ),	/* pal 91*/
+  RGBDEF(   0,   0,   0 ),	/* pal 92*/
+  RGBDEF(   0,   0,   0 ),	/* pal 93*/
+  RGBDEF(   0,   0,   0 ),	/* pal 94*/
+  RGBDEF(   0,   0,   0 ),	/* pal 95*/
+  RGBDEF(   0,   0,   0 ),	/* pal 96*/
+  RGBDEF(   0,   0,   0 ),	/* pal 97*/
+  RGBDEF(   0,   0,   0 ),	/* pal 98*/
+  RGBDEF(   0,   0,   0 ),	/* pal 99*/
+  RGBDEF(   0,   0,   0 ),	/* pal 100*/
+  RGBDEF(   0,   0,   0 ),	/* pal 101*/
+  RGBDEF(   0,   0,   0 ),	/* pal 102*/
+  RGBDEF(   0,   0,   0 ),	/* pal 103*/
+  RGBDEF(   0,   0,   0 ),	/* pal 104*/
+  RGBDEF(   0,   0,   0 ),	/* pal 105*/
+  RGBDEF(   0,   0,   0 ),	/* pal 106*/
+  RGBDEF(   0,   0,   0 ),	/* pal 107*/
+  RGBDEF(   0,   0,   0 ),	/* pal 108*/
+  RGBDEF(   0,   0,   0 ),	/* pal 109*/
+  RGBDEF(   0,   0,   0 ),	/* pal 110*/
+  RGBDEF(   0,   0,   0 ),	/* pal 111*/
+  RGBDEF(   0,   0,   0 ),	/* pal 112*/
+  RGBDEF(   0,   0,   0 ),	/* pal 113*/
+  RGBDEF(   0,   0,   0 ),	/* pal 114*/
+  RGBDEF(   0,   0,   0 ),	/* pal 115*/
+  RGBDEF(   0,   0,   0 ),	/* pal 116*/
+  RGBDEF(   0,   0,   0 ),	/* pal 117*/
+  RGBDEF(   0,   0,   0 ),	/* pal 118*/
+  RGBDEF(   0,   0,   0 ),	/* pal 119*/
+  RGBDEF(   0,   0,   0 ),	/* pal 120*/
+  RGBDEF(   0,   0,   0 ),	/* pal 121*/
+  RGBDEF(   0,   0,   0 ),	/* pal 122*/
+  RGBDEF(   0,   0,   0 ),	/* pal 123*/
+  RGBDEF(   0,   0,   0 ),	/* pal 124*/
+  RGBDEF(   0,   0,   0 ),	/* pal 125*/
+  RGBDEF(   0,   0,   0 ),	/* pal 126*/
+  RGBDEF(   0,   0,   0 ),	/* pal 127*/
+  RGBDEF(   0,   0,   0 ),	/* pal 128*/
+  RGBDEF(   0,   0,   0 ),	/* pal 129*/
+  RGBDEF(   0,   0,   0 ),	/* pal 130*/
+  RGBDEF(   0,   0,   0 ),	/* pal 131*/
+  RGBDEF(   0,   0,   0 ),	/* pal 132*/
+  RGBDEF(   0,   0,   0 ),	/* pal 133*/
+  RGBDEF(   0,   0,   0 ),	/* pal 134*/
+  RGBDEF(   0,   0,   0 ),	/* pal 135*/
+  RGBDEF(   0,   0,   0 ),	/* pal 136*/
+  RGBDEF(   0,   0,   0 ),	/* pal 137*/
+  RGBDEF(   0,   0,   0 ),	/* pal 138*/
+  RGBDEF(   0,   0,   0 ),	/* pal 139*/
+  RGBDEF(   0,   0,   0 ),	/* pal 140*/
+  RGBDEF(   0,   0,   0 ),	/* pal 141*/
+  RGBDEF(   0,   0,   0 ),	/* pal 142*/
+  RGBDEF(   0,   0,   0 ),	/* pal 143*/
+  RGBDEF(   0,   0,   0 ),	/* pal 144*/
+  RGBDEF(   0,   0,   0 ),	/* pal 145*/
+  RGBDEF(   0,   0,   0 ),	/* pal 146*/
+  RGBDEF(   0,   0,   0 ),	/* pal 147*/
+  RGBDEF(   0,   0,   0 ),	/* pal 148*/
+  RGBDEF(   0,   0,   0 ),	/* pal 149*/
+  RGBDEF(   0,   0,   0 ),	/* pal 150*/
+  RGBDEF(   0,   0,   0 ),	/* pal 151*/
+  RGBDEF(   0,   0,   0 ),	/* pal 152*/
+  RGBDEF(   0,   0,   0 ),	/* pal 153*/
+  RGBDEF(   0,   0,   0 ),	/* pal 154*/
+  RGBDEF(   0,   0,   0 ),	/* pal 155*/
+  RGBDEF(   0,   0,   0 ),	/* pal 156*/
+  RGBDEF(   0,   0,   0 ),	/* pal 157*/
+  RGBDEF(   0,   0,   0 ),	/* pal 158*/
+  RGBDEF(   0,   0,   0 ),	/* pal 159*/
+  RGBDEF(   0,   0,   0 ),	/* pal 160*/
+  RGBDEF(   0,   0,   0 ),	/* pal 161*/
+  RGBDEF(   0,   0,   0 ),	/* pal 162*/
+  RGBDEF(   0,   0,   0 ),	/* pal 163*/
+  RGBDEF(   0,   0,   0 ),	/* pal 164*/
+  RGBDEF(   0,   0,   0 ),	/* pal 165*/
+  RGBDEF(   0,   0,   0 ),	/* pal 166*/
+  RGBDEF(   0,   0,   0 ),	/* pal 167*/
+  RGBDEF(   0,   0,   0 ),	/* pal 168*/
+  RGBDEF(   0,   0,   0 ),	/* pal 169*/
+  RGBDEF(   0,   0,   0 ),	/* pal 170*/
+  RGBDEF(   0,   0,   0 ),	/* pal 171*/
+  RGBDEF(   0,   0,   0 ),	/* pal 172*/
+  RGBDEF(   0,   0,   0 ),	/* pal 173*/
+  RGBDEF(   0,   0,   0 ),	/* pal 174*/
+  RGBDEF(   0,   0,   0 ),	/* pal 175*/
+  RGBDEF(   0,   0,   0 ),	/* pal 176*/
+  RGBDEF(   0,   0,   0 ),	/* pal 177*/
+  RGBDEF(   0,   0,   0 ),	/* pal 178*/
+  RGBDEF(   0,   0,   0 ),	/* pal 179*/
+  RGBDEF(   0,   0,   0 ),	/* pal 180*/
+  RGBDEF(   0,   0,   0 ),	/* pal 181*/
+  RGBDEF(   0,   0,   0 ),	/* pal 182*/
+  RGBDEF(   0,   0,   0 ),	/* pal 183*/
+  RGBDEF(   0,   0,   0 ),	/* pal 184*/
+  RGBDEF(   0,   0,   0 ),	/* pal 185*/
+  RGBDEF(   0,   0,   0 ),	/* pal 186*/
+  RGBDEF(   0,   0,   0 ),	/* pal 187*/
+  RGBDEF(   0,   0,   0 ),	/* pal 188*/
+  RGBDEF(   0,   0,   0 ),	/* pal 189*/
+  RGBDEF(   0,   0,   0 ),	/* pal 190*/
+  RGBDEF(   0,   0,   0 ),	/* pal 191*/
+  RGBDEF(   0,   0,   0 ),	/* pal 192*/
+  RGBDEF(   0,   0,   0 ),	/* pal 193*/
+  RGBDEF(   0,   0,   0 ),	/* pal 194*/
+  RGBDEF(   0,   0,   0 ),	/* pal 195*/
+  RGBDEF(   0,   0,   0 ),	/* pal 196*/
+  RGBDEF(   0,   0,   0 ),	/* pal 197*/
+  RGBDEF(   0,   0,   0 ),	/* pal 198*/
+  RGBDEF(   0,   0,   0 ),	/* pal 199*/
+  RGBDEF(   0,   0,   0 ),	/* pal 200*/
+  RGBDEF(   0,   0,   0 ),	/* pal 201*/
+  RGBDEF(   0,   0,   0 ),	/* pal 202*/
+  RGBDEF(   0,   0,   0 ),	/* pal 203*/
+  RGBDEF(   0,   0,   0 ),	/* pal 204*/
+  RGBDEF(   0,   0,   0 ),	/* pal 205*/
+  RGBDEF(   0,   0,   0 ),	/* pal 206*/
+  RGBDEF(   0,   0,   0 ),	/* pal 207*/
+  RGBDEF(   0,   0,   0 ),	/* pal 208*/
+  RGBDEF(   0,   0,   0 ),	/* pal 209*/
+  RGBDEF(   0,   0,   0 ),	/* pal 210*/
+  RGBDEF(   0,   0,   0 ),	/* pal 211*/
+  RGBDEF(   0,   0,   0 ),	/* pal 212*/
+  RGBDEF(   0,   0,   0 ),	/* pal 213*/
+  RGBDEF(   0,   0,   0 ),	/* pal 214*/
+  RGBDEF(   0,   0,   0 ),	/* pal 215*/
+  RGBDEF(   0,   0,   0 ),	/* pal 216*/
+  RGBDEF(   0,   0,   0 ),	/* pal 217*/
+  RGBDEF(   0,   0,   0 ),	/* pal 218*/
+  RGBDEF(   0,   0,   0 ),	/* pal 219*/
+  RGBDEF(   0,   0,   0 ),	/* pal 220*/
+  RGBDEF(   0,   0,   0 ),	/* pal 221*/
+  RGBDEF(   0,   0,   0 ),	/* pal 222*/
+  RGBDEF(   0,   0,   0 ),	/* pal 223*/
+  RGBDEF(   0,   0,   0 ),	/* pal 224*/
+  RGBDEF(   0,   0,   0 ),	/* pal 225*/
+  RGBDEF(   0,   0,   0 ),	/* pal 226*/
+  RGBDEF(   0,   0,   0 ),	/* pal 227*/
+  RGBDEF(   0,   0,   0 ),	/* pal 228*/
+  RGBDEF(   0,   0,   0 ),	/* pal 229*/
+  RGBDEF(   0,   0,   0 ),	/* pal 230*/
+  RGBDEF(   0,   0,   0 ),	/* pal 231*/
+  RGBDEF(   0,   0,   0 ),	/* pal 232*/
+  RGBDEF(   0,   0,   0 ),	/* pal 233*/
+  RGBDEF(   0,   0,   0 ),	/* pal 234*/
+  RGBDEF(   0,   0,   0 ),	/* pal 235*/
+  RGBDEF(   0,   0,   0 ),	/* pal 236*/
+  RGBDEF(   0,   0,   0 ),	/* pal 237*/
+  RGBDEF(   0,   0,   0 ),	/* pal 238*/
+  RGBDEF(   0,   0,   0 ),	/* pal 239*/
+  RGBDEF(   0,   0,   0 ),	/* pal 240*/
+  RGBDEF(   0,   0,   0 ),	/* pal 241*/
+  RGBDEF(   0,   0,   0 ),	/* pal 242*/
+  RGBDEF(   0,   0,   0 ),	/* pal 243*/
+  RGBDEF(   0,   0,   0 ),	/* pal 244*/
+  RGBDEF(   0,   0,   0 ),	/* pal 245*/
+  RGBDEF(   0,   0,   0 ),	/* pal 246*/
+  RGBDEF(   0,   0,   0 ),	/* pal 247*/
+  RGBDEF(   0,   0,   0 ),	/* pal 248*/
+  RGBDEF(   0,   0,   0 ),	/* pal 249*/
+  RGBDEF(   0,   0,   0 ),	/* pal 250*/
+  RGBDEF(   0,   0,   0 ),	/* pal 251*/
+  RGBDEF(   0,   0,   0 ),	/* pal 252*/
+  RGBDEF(   0,   0,   0 ),	/* pal 253*/
+  RGBDEF(   0,   0,   0 ),	/* pal 254*/
+  RGBDEF(   0,   0,   0 ),	/* pal 255*/
+};
+
+static MWUCHAR imagebits[] = {
+76,76,76,76,76,31,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,11,13,14,15,15,15,15,11,11,11,21,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,76,76,76,76,76,76,31,31,31,76,76,76,76,76,76,76,76,76,76,76,76,76,12,11,11,10,11,14,14,15,14,11,14,11,11,76,76,76,76,76,76,76,76,76,76,31,31,31,31,31,31,31,31,31,76,31,31,31,31,31,76,76,
+76,76,76,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,76,76,76,76,31,31,31,76,76,76,76,76,9,11,14,15,15,32,15,32,15,15,15,15,15,11,11,76,76,76,76,31,31,31,31,76,76,76,76,76,31,31,31,31,31,31,31,76,76,76,76,76,76,31,31,76,31,31,31,31,76,76,76,76,76,76,76,76,12,9,11,14,15,65,32,32,32,32,32,32,15,15,15,11,11,76,76,76,76,31,76,76,31,31,31,76,76,31,31,31,31,31,31,31,31,31,31,31,76,76,
+76,76,76,31,31,31,76,31,76,76,76,76,76,76,76,76,31,31,31,31,31,31,76,76,76,76,76,76,13,15,32,32,32,32,32,32,32,32,32,32,32,15,15,15,11,11,76,76,76,31,31,31,31,31,76,76,76,76,31,31,31,31,31,31,31,31,31,31,76,76,31,31,76,76,76,76,76,31,31,31,31,31,31,76,76,12,9,11,14,15,32,32,33,33,33,33,34,32,34,32,32,32,15,21,76,76,76,76,76,76,31,31,31,31,31,31,31,76,76,76,76,76,76,76,31,31,31,76,
+76,76,76,31,31,31,76,31,31,76,76,76,76,31,31,31,76,76,76,76,76,76,76,76,76,11,13,15,32,32,33,32,33,32,34,32,33,32,33,33,32,32,32,15,15,14,11,76,76,76,76,76,31,31,31,76,76,31,31,76,76,76,31,31,31,31,76,31,31,76,31,76,76,76,76,76,76,76,76,76,31,31,31,76,76,12,11,15,32,32,32,32,34,33,34,33,33,34,32,33,33,32,32,15,21,76,76,76,76,31,76,76,31,31,31,31,31,31,31,76,76,76,76,76,31,31,31,76,
+76,76,76,31,76,31,31,76,31,31,31,31,31,31,31,31,76,76,76,76,76,13,13,15,32,32,32,32,33,32,33,33,34,33,34,33,34,33,33,33,33,32,32,32,15,15,14,11,3,255,76,76,76,76,31,76,76,76,76,76,31,76,76,31,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,12,9,14,32,32,33,34,33,34,32,34,34,34,34,34,34,33,34,33,32,32,20,76,76,76,76,76,76,31,76,31,31,31,31,31,76,76,31,76,31,31,31,31,76,
+76,76,31,31,76,76,31,76,31,31,76,76,76,76,76,76,76,15,15,32,32,32,32,32,33,33,32,34,33,34,34,33,34,34,34,34,34,34,34,33,33,34,32,32,32,32,14,11,8,255,255,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,10,13,32,32,32,33,33,33,34,34,34,34,34,34,35,34,34,34,33,34,32,32,9,76,76,76,76,76,31,76,76,31,76,31,31,76,76,31,76,76,31,31,76,76,
+76,76,31,76,76,76,76,76,76,76,76,76,76,13,15,32,32,32,33,33,33,33,33,34,33,33,34,34,34,34,34,35,35,35,35,35,35,34,35,34,34,33,33,33,32,32,15,15,9,3,255,255,255,255,255,255,255,255,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,255,255,255,255,9,14,15,32,33,34,34,34,34,34,34,35,35,35,34,35,35,34,34,34,33,34,32,13,76,76,76,76,76,76,76,31,76,31,76,31,76,31,76,76,31,31,76,76,
+76,76,76,76,76,76,76,76,76,76,32,32,33,33,33,33,34,33,33,33,34,33,34,34,34,34,34,35,34,36,36,36,36,36,37,36,36,35,35,35,34,34,34,33,32,32,32,15,13,9,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,9,14,32,32,34,33,34,34,34,35,35,35,35,35,36,35,35,35,35,34,34,34,33,33,32,9,76,76,76,76,76,31,76,31,76,31,76,31,31,76,76,31,31,76,
+76,76,76,76,76,32,32,32,33,33,33,33,34,34,34,34,34,34,34,34,34,34,34,34,35,35,35,35,39,39,40,41,41,41,38,44,38,38,36,36,35,35,34,34,33,32,32,32,13,11,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,12,15,32,32,34,34,34,34,36,35,36,36,40,36,35,36,36,36,35,35,35,34,35,34,33,33,9,76,76,76,76,76,76,31,76,31,31,76,31,31,76,31,31,76,
+76,76,33,32,33,33,33,34,33,34,34,34,34,34,34,35,35,34,35,35,35,35,35,35,35,36,36,39,39,41,41,41,46,38,47,38,44,39,39,39,38,35,35,34,34,33,32,32,15,9,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,12,15,32,34,34,34,35,35,36,36,39,37,39,39,46,38,39,37,39,36,36,36,35,34,35,34,34,21,76,76,76,76,76,76,76,76,31,76,76,31,76,31,31,76,
+76,34,34,34,34,34,34,34,34,34,34,35,35,35,35,34,35,36,35,35,35,39,39,38,38,38,39,44,39,41,36,44,44,40,41,41,41,46,39,44,37,39,35,35,34,33,34,32,15,11,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,13,32,32,34,34,34,35,36,37,41,39,39,46,39,44,39,44,39,44,39,39,39,39,36,35,35,35,34,33,11,76,76,76,76,76,76,31,76,76,31,76,31,76,76,
+76,34,35,34,35,34,34,39,34,35,35,35,35,36,36,36,39,35,38,36,38,36,40,39,41,44,41,40,44,41,35,46,41,47,47,38,46,40,44,35,44,39,36,35,34,34,33,32,15,9,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,13,15,33,34,35,35,35,36,40,39,44,46,39,44,40,39,41,36,44,39,44,39,39,39,39,39,39,35,35,34,33,76,76,76,76,76,31,76,76,31,31,31,76,76,
+31,35,35,35,34,39,35,35,39,36,36,39,36,39,37,39,36,39,41,38,44,44,39,41,46,40,40,46,46,35,44,40,41,39,41,36,41,46,41,41,35,39,39,36,35,34,33,32,13,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,13,32,33,34,34,35,38,38,39,39,46,46,40,47,38,44,35,39,44,40,47,35,44,44,44,39,44,38,39,35,35,33,33,76,76,76,76,76,76,76,31,76,31,76,
+31,34,39,34,39,35,36,39,36,39,37,37,39,39,39,41,41,47,38,36,39,46,40,47,38,41,46,41,39,40,47,38,41,41,35,44,36,39,41,36,41,40,39,35,35,34,34,32,9,255,255,255,255,255,255,3,255,255,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,13,32,32,35,35,35,38,36,41,41,46,38,44,40,46,35,44,47,40,47,39,41,35,44,35,44,39,47,39,47,47,35,35,35,35,76,76,76,76,76,76,76,31,76,
+31,39,35,35,35,39,39,39,40,39,44,47,38,46,40,41,47,39,38,47,46,46,39,46,41,39,41,41,41,47,38,47,40,41,44,35,41,46,41,41,41,36,36,35,35,34,33,32,9,255,255,255,25,62,62,62,62,62,62,62,62,62,53,20,255,255,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,9,15,33,34,35,36,36,39,40,39,46,44,40,47,41,44,35,44,44,35,44,44,41,46,40,41,47,40,41,35,46,46,39,36,36,35,35,76,76,76,76,76,76,76,
+31,35,34,39,39,39,39,39,44,44,40,39,44,47,41,36,44,41,47,35,44,41,41,44,35,44,46,39,41,41,44,35,41,41,46,40,41,41,38,41,38,39,39,35,35,35,33,15,9,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,49,19,255,255,255,255,255,255,255,255,255,255,255,255,255,255,8,15,33,34,35,35,36,37,41,41,46,39,41,47,41,36,44,35,41,44,35,44,46,39,47,35,44,41,39,47,41,36,44,39,46,36,36,35,35,76,76,76,76,76,
+76,35,39,34,39,39,46,41,46,40,44,36,44,35,39,46,41,44,41,44,40,40,47,35,44,35,44,46,35,44,41,46,47,38,46,41,39,36,44,41,37,39,37,67,35,34,32,9,52,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,255,255,255,8,15,32,34,35,35,36,39,38,41,36,46,40,35,44,40,41,41,41,41,44,35,41,44,35,36,44,41,46,44,35,44,36,46,38,41,36,44,35,34,76,76,76,76,
+76,35,34,39,35,39,41,40,39,39,36,39,46,41,47,39,41,39,41,39,44,41,41,41,46,46,39,41,36,41,41,39,46,41,41,40,46,46,39,38,40,37,40,39,35,34,15,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,255,6,15,32,34,35,35,36,37,40,41,41,41,41,41,41,47,39,46,44,40,36,39,41,41,41,36,44,35,41,46,39,46,47,39,41,35,39,46,44,44,35,35,76,76,
+76,35,39,34,39,39,39,47,40,46,44,44,41,35,41,47,40,41,46,40,44,35,41,36,41,39,41,47,38,41,47,35,46,39,47,35,39,36,44,40,39,40,40,37,34,33,33,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,3,255,255,255,255,255,255,255,14,32,34,34,36,36,37,41,41,39,36,44,39,46,39,38,46,41,36,41,46,44,40,41,35,39,42,46,41,36,41,41,41,41,47,35,44,40,35,44,35,36,76,
+76,35,35,34,39,47,39,41,35,46,39,41,44,44,47,39,41,36,46,41,36,41,46,38,36,41,46,44,36,44,41,47,38,41,44,47,41,39,41,39,40,40,40,39,34,32,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,13,32,33,35,36,36,39,39,41,41,46,40,47,46,44,47,35,41,41,47,39,46,44,47,38,47,38,47,40,40,44,47,40,39,36,44,41,47,40,44,35,35,35,
+76,35,34,39,34,39,39,46,47,38,41,46,35,44,35,44,40,47,39,35,41,36,38,47,38,47,39,36,39,41,41,41,47,40,44,40,41,41,41,39,40,42,40,35,34,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,3,255,255,255,3,13,32,34,34,35,36,37,40,41,41,41,41,35,44,35,39,47,38,47,40,47,39,44,41,47,39,47,40,44,47,38,41,41,41,44,40,41,47,44,41,47,35,41,
+76,34,34,39,35,47,39,39,46,46,39,44,35,44,40,39,44,39,46,44,46,39,47,40,47,41,41,41,41,46,41,46,40,41,36,46,36,39,41,41,40,40,39,35,33,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,12,32,34,34,35,36,37,41,39,41,46,40,47,44,47,40,44,39,46,41,41,41,35,46,44,44,40,44,35,44,41,44,40,47,41,36,47,38,36,41,41,47,41,
+76,34,34,35,39,39,39,44,40,44,46,44,40,47,40,39,36,41,41,36,40,44,36,35,44,40,41,46,38,36,44,40,41,47,38,41,36,39,41,38,42,40,35,35,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,3,255,255,255,12,32,33,35,35,36,38,38,38,41,42,47,40,40,40,47,40,47,39,40,47,40,41,41,44,40,46,41,41,41,35,44,47,46,39,44,39,40,46,44,40,41,40,
+76,34,34,39,35,39,40,47,39,39,36,36,39,46,39,44,47,44,40,41,47,40,41,41,47,39,36,39,46,39,36,44,46,47,39,47,38,41,40,40,42,36,35,6,17,20,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,3,255,255,12,32,34,34,35,36,36,41,39,41,41,41,40,46,47,35,46,46,39,47,40,41,46,39,40,39,46,38,46,36,44,46,41,40,40,40,44,47,40,36,41,44,44,
+76,34,34,39,39,39,46,41,41,46,47,40,44,40,46,47,40,46,39,46,44,35,44,36,41,36,41,46,41,47,38,36,39,38,41,46,47,38,41,42,40,35,3,255,255,255,255,25,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,53,255,8,32,33,34,35,35,38,38,40,41,41,44,41,44,41,44,39,41,46,40,47,40,44,46,44,47,38,41,36,39,41,41,41,36,44,46,40,47,40,41,46,40,41,
+76,34,35,39,39,46,41,39,36,44,40,47,35,41,36,39,36,41,46,38,36,39,36,44,41,40,47,39,36,44,35,44,41,47,38,46,38,41,41,46,39,34,3,255,255,255,255,255,29,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,53,53,6,32,34,34,35,35,36,38,41,39,39,41,40,39,41,40,44,41,41,39,41,41,40,41,46,40,47,35,46,41,46,44,35,44,41,46,41,41,36,41,41,76,76,
+76,34,35,39,39,39,39,47,40,44,47,35,44,41,44,44,46,41,41,47,39,47,38,46,39,46,39,36,44,40,44,46,39,41,46,39,41,40,46,36,35,3,255,255,255,255,255,255,255,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,71,53,32,33,34,34,36,37,38,37,40,44,39,39,39,39,39,39,39,39,40,44,38,40,46,41,40,40,47,39,36,41,46,44,35,41,39,41,36,38,41,76,76,76,
+76,34,47,35,39,44,36,44,41,46,39,46,36,39,46,35,41,41,46,41,44,38,36,41,47,41,36,44,35,44,36,44,46,41,44,35,41,42,40,35,3,255,255,255,255,255,255,255,255,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,71,71,33,33,34,35,35,38,36,39,37,40,38,38,39,36,36,39,38,38,39,40,44,41,38,46,41,46,44,35,41,44,39,41,41,46,39,46,41,76,76,76,31,31,
+76,34,35,39,41,39,47,35,44,41,44,40,41,47,40,41,41,39,41,41,41,47,39,35,41,41,39,46,40,35,46,35,41,41,44,41,40,40,36,35,255,255,255,255,255,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,53,53,53,33,33,34,35,36,36,38,36,38,36,38,36,39,36,39,36,39,38,36,40,38,39,47,47,35,44,46,41,41,39,46,47,40,41,47,39,76,76,76,31,76,31,
+76,34,39,39,40,39,40,46,41,36,35,44,47,40,39,41,47,41,47,41,41,47,40,47,40,47,40,41,47,41,41,41,46,38,41,40,46,36,35,3,255,255,255,255,255,255,255,255,22,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,71,53,53,72,34,34,35,38,36,36,36,38,36,36,36,35,36,35,36,36,36,36,39,40,39,46,40,39,41,46,41,41,47,35,41,44,41,40,76,76,76,31,31,31,31,
+76,35,35,39,40,40,41,41,39,41,41,41,39,41,47,46,40,36,44,35,46,44,47,39,41,41,36,44,44,40,41,47,41,47,40,40,40,36,6,255,255,255,255,3,255,255,255,6,48,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,53,71,53,33,34,34,36,37,38,36,37,35,36,35,35,35,35,35,35,35,36,36,36,37,39,41,46,40,47,38,46,41,41,41,41,36,41,76,76,76,76,31,76,31,76,
+76,34,35,39,39,39,39,39,46,37,39,46,44,46,39,44,39,39,41,36,44,35,44,40,47,39,46,35,46,39,41,41,41,39,41,46,36,35,255,255,255,255,255,255,255,255,255,30,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,52,53,53,34,34,36,39,38,36,36,36,35,35,35,35,34,35,34,34,34,35,35,35,37,39,40,41,36,41,36,38,41,41,41,46,40,76,76,76,31,31,31,76,31,76,
+76,36,35,36,36,39,39,37,39,39,39,40,39,39,39,39,46,44,40,44,35,44,41,40,47,40,47,40,40,47,38,46,41,41,41,40,35,3,255,255,255,255,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,71,71,53,50,35,36,39,38,39,36,35,35,35,34,34,34,34,34,34,34,34,34,35,35,36,40,39,41,41,41,41,41,41,40,41,44,76,76,76,31,31,31,76,31,76,
+76,76,32,36,39,37,39,39,39,39,39,39,39,39,39,39,39,46,44,39,36,41,44,41,46,38,41,41,47,40,41,41,41,41,40,39,3,255,255,255,255,255,255,255,20,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,71,71,53,50,36,35,39,37,39,36,35,34,34,34,34,33,34,34,33,34,33,34,34,34,35,37,39,40,39,41,41,44,41,41,41,76,76,76,76,31,31,31,31,31,76,
+76,76,76,33,34,37,39,36,35,35,34,35,35,39,39,39,39,39,44,35,44,44,35,41,41,47,38,47,40,41,41,41,41,45,40,35,3,255,255,255,255,255,255,16,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,53,71,53,53,50,35,44,39,38,35,36,34,34,34,33,34,32,33,32,32,33,34,33,34,33,34,35,36,39,40,39,41,40,46,41,76,31,76,76,31,31,31,31,76,31,76,
+76,76,76,31,76,76,76,34,33,34,34,34,34,35,39,35,39,39,39,39,39,36,41,44,39,41,40,41,46,44,35,41,41,38,40,255,255,255,255,255,255,6,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,53,53,53,34,39,35,44,39,38,35,34,34,34,33,15,9,255,255,255,255,255,8,14,33,34,34,36,38,37,38,41,41,38,38,76,76,76,76,31,31,31,31,76,31,76,
+76,76,76,31,76,31,76,76,76,76,76,33,34,34,35,35,39,39,39,44,41,47,44,35,44,46,39,46,40,41,41,41,41,40,35,255,255,255,3,255,3,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,52,53,33,47,44,44,39,38,35,34,33,32,15,8,255,255,255,255,255,255,255,255,9,32,34,35,40,40,41,39,41,41,38,76,76,76,76,76,76,31,31,76,31,76,
+76,76,76,76,76,76,76,76,76,76,76,76,34,33,34,35,35,39,39,39,39,46,41,46,35,44,44,41,41,40,41,41,41,39,255,255,255,255,255,16,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,53,34,36,36,39,41,38,35,34,33,12,255,255,255,255,255,255,255,255,255,255,255,255,33,35,39,46,40,40,41,40,39,76,76,76,31,76,76,31,31,76,31,31,
+76,76,31,76,76,76,76,76,31,76,76,31,76,76,34,35,35,35,39,39,47,39,46,41,46,35,41,39,46,47,38,46,37,255,255,255,255,3,20,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,50,35,39,39,39,39,37,34,15,255,255,255,255,255,255,255,255,255,255,255,255,255,255,32,35,46,40,45,46,40,46,76,76,76,76,76,76,76,76,76,76,31,
+76,76,31,76,31,76,76,76,31,76,76,76,76,76,76,34,34,35,39,35,39,44,39,46,39,36,44,46,39,41,41,46,36,255,255,255,6,25,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,34,39,40,44,41,46,40,33,15,255,255,255,255,255,255,255,255,255,255,255,255,6,255,255,34,40,40,40,67,47,40,76,76,76,76,31,31,31,31,31,76,31,
+76,76,31,31,31,31,76,76,31,31,76,76,76,76,76,34,34,35,35,39,35,44,36,41,46,40,36,44,40,41,46,39,255,255,255,16,50,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,39,35,39,46,46,67,42,39,51,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,8,45,46,67,46,47,40,76,76,31,31,31,31,31,31,31,31,31,
+76,76,31,31,76,31,76,76,31,31,31,31,76,76,31,76,35,35,35,35,47,35,46,38,41,46,38,41,46,41,38,255,255,255,19,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,35,39,39,46,40,47,40,67,33,3,3,255,255,255,255,255,255,255,255,255,255,255,7,3,6,8,40,47,40,40,46,76,76,31,31,31,31,31,31,31,31,31,
+76,76,31,76,76,31,31,76,76,76,31,31,76,76,76,76,76,35,35,39,41,46,39,46,46,39,36,41,38,41,255,255,255,25,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,39,39,47,67,40,67,40,40,33,3,255,255,255,255,255,255,255,255,255,255,255,255,3,16,6,255,33,42,38,41,76,76,31,31,31,31,31,31,31,31,31,31,
+76,76,31,76,76,31,31,31,76,76,31,76,76,76,76,76,76,35,35,44,39,46,41,47,38,46,41,41,41,255,255,255,23,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,35,40,40,47,39,47,41,15,255,255,255,255,255,255,255,255,255,255,255,255,255,255,16,16,16,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,76,31,76,31,31,31,31,31,31,76,76,31,76,35,35,46,36,41,41,46,41,41,41,255,255,3,52,52,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,39,35,35,39,35,34,20,255,255,255,255,255,255,255,255,255,255,255,255,255,255,16,19,19,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,76,31,31,31,76,76,76,31,76,76,76,76,35,39,36,41,36,39,39,41,255,255,255,51,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,16,3,255,255,255,255,255,255,255,255,255,255,255,255,255,16,29,22,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,76,31,31,76,76,31,31,76,76,255,255,255,44,35,46,41,36,255,255,255,19,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,29,255,16,6,255,255,255,255,255,255,255,255,255,255,255,6,27,29,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,76,76,31,31,76,76,31,76,76,255,255,255,255,44,41,255,255,255,255,30,51,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,255,255,19,16,255,255,255,255,255,255,3,16,19,18,19,16,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,76,255,255,255,255,255,255,255,255,255,16,53,255,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,25,26,16,3,19,19,19,16,6,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,76,31,31,76,76,76,76,76,255,255,255,255,255,255,255,255,3,48,255,255,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,20,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,76,76,76,255,255,255,255,255,255,255,255,20,51,255,255,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,3,255,255,255,255,255,18,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,76,31,76,76,31,31,31,76,76,255,255,255,255,255,255,16,19,25,255,255,255,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,6,19,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,76,31,31,76,76,76,76,76,76,76,255,255,255,255,255,6,16,22,24,255,255,255,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,23,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,76,
+31,31,31,31,31,31,31,31,76,31,31,76,76,31,76,76,76,76,255,255,255,255,255,255,6,19,23,255,255,255,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,3,255,255,255,255,255,255,26,16,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,76,31,31,31,31,31,76,76,76,76,255,255,255,255,255,255,255,6,48,255,255,255,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,6,16,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,255,255,16,48,255,255,255,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,25,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,76,255,255,255,255,255,6,29,255,255,255,71,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,3,255,255,3,3,255,255,255,25,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,255,16,23,255,255,255,49,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,23,3,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,76,
+76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,6,23,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,18,3,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,18,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,71,255,255,255,255,255,255,255,255,19,6,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,76,255,255,255,255,17,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,29,255,255,255,255,255,255,255,255,255,19,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,255,255,255,6,255,255,255,255,51,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,255,20,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,4,255,25,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,3,255,255,255,255,255,255,255,255,255,19,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,76,255,255,255,255,19,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,255,19,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,3,16,16,255,255,255,49,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,6,18,255,255,255,255,255,255,255,255,255,255,76,76,76,76,76,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,31,255,255,255,3,19,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,29,6,255,255,255,255,255,255,255,255,255,255,76,31,76,76,31,31,31,31,31,31,31,31,31,31,
+76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,255,255,255,19,255,255,255,255,49,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,26,255,255,255,255,255,255,255,255,255,255,76,76,76,76,76,31,31,31,31,31,31,31,31,31,31,
+76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,6,27,255,255,255,19,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,53,3,6,6,3,255,255,255,255,16,24,255,255,255,255,255,255,255,255,255,255,76,76,76,76,76,31,31,31,31,31,31,31,31,31,31,
+76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,18,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,22,7,16,19,19,16,3,3,255,25,16,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,
+76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,31,76,255,255,255,16,26,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,16,6,16,20,23,19,16,6,2,22,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,
+76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,30,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,52,255,255,16,18,24,20,16,255,19,16,255,255,255,255,255,255,255,255,255,255,76,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,
+76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,16,19,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,55,62,19,255,255,3,19,20,19,16,255,19,3,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,
+76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,20,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,71,53,62,255,255,255,6,16,16,6,3,18,6,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,76,
+76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,31,255,255,255,255,16,19,255,255,255,255,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,61,55,71,53,62,20,255,255,255,255,3,3,255,18,19,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,48,255,255,255,255,71,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,53,71,59,62,255,255,255,255,255,255,255,7,16,3,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,3,23,6,255,255,24,71,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,53,71,71,55,62,20,255,255,255,255,255,3,255,20,16,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,255,3,19,255,255,255,51,52,55,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,55,55,52,53,53,62,62,255,255,255,255,255,3,2,22,16,255,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,255,255,255,255,255,255,30,51,52,55,62,62,62,62,62,62,62,62,62,62,62,62,62,59,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,57,53,53,71,71,53,57,62,20,255,255,255,255,255,18,19,6,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,76,255,255,255,255,255,255,255,255,255,6,49,51,51,55,57,62,62,62,62,62,62,62,62,62,62,62,57,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,61,59,55,55,53,71,53,71,53,71,55,62,62,255,255,255,255,29,23,16,3,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,255,255,255,255,255,255,255,255,255,3,51,49,51,51,55,55,57,61,62,62,62,62,62,62,62,62,59,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,55,53,55,71,71,71,53,71,71,71,71,53,59,62,20,255,255,255,28,24,6,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,255,255,255,255,255,30,51,49,51,56,53,55,58,57,62,62,62,62,62,62,62,57,55,55,62,62,62,62,62,62,62,62,62,62,62,62,55,55,55,71,71,71,53,52,71,71,53,71,71,53,59,62,62,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,255,255,255,255,255,22,49,51,51,53,57,59,62,62,62,62,62,62,62,62,55,55,57,55,55,55,57,62,62,62,62,62,62,62,62,62,59,57,55,55,55,55,53,55,53,53,71,71,53,57,62,61,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,76,76,255,255,255,255,255,255,255,255,6,51,50,53,61,62,62,62,62,62,62,62,62,62,62,62,62,62,59,61,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,59,57,55,55,59,59,61,55,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,255,255,255,255,255,255,255,255,49,52,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,59,30,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,31,76,3,255,255,255,255,255,255,30,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,57,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,31,255,255,255,255,255,255,255,53,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,55,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,255,255,255,255,255,255,51,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,29,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,76,76,76,255,255,255,255,255,255,255,57,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,16,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,76,76,76,255,255,255,255,255,255,49,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,58,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,255,255,255,255,255,255,255,52,62,62,62,62,62,62,62,62,62,62,62,62,57,55,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,18,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,31,76,76,31,255,255,255,255,255,255,51,55,62,62,62,62,62,62,62,62,62,62,53,52,53,52,53,55,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,16,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,76,255,255,255,3,3,255,55,59,62,62,62,62,62,62,62,52,51,52,53,51,52,52,52,53,59,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,51,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,76,76,2,6,16,3,3,255,71,62,62,62,62,62,62,62,71,53,71,52,52,52,53,51,71,71,55,59,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,25,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,76,4,7,16,6,3,255,255,57,62,62,62,62,62,71,71,71,52,52,51,52,51,71,53,52,51,55,57,59,59,62,62,62,62,62,62,62,62,62,62,62,62,62,51,255,255,255,255,255,255,255,255,255,255,255,255,255,255,6,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,4,3,3,255,255,255,71,62,62,61,59,53,71,53,51,51,51,51,53,71,53,52,51,53,52,53,55,59,59,62,62,62,62,62,62,62,62,62,62,62,62,255,255,255,255,255,255,255,255,255,255,255,255,255,255,6,4,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,255,255,62,62,59,55,71,52,51,52,51,71,51,54,53,52,52,52,53,51,53,53,53,55,59,62,62,62,62,62,62,62,62,62,62,52,255,255,255,255,255,255,255,255,255,255,255,255,255,255,16,76,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,255,71,59,57,53,71,71,51,51,52,48,33,33,33,49,56,51,50,53,51,56,53,71,53,60,62,62,62,62,62,62,62,62,58,19,255,255,255,255,255,255,255,255,255,255,255,255,255,255,16,76,31,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,31,255,255,255,255,255,56,53,53,71,51,52,50,50,32,33,32,32,33,32,33,32,33,50,50,53,52,50,71,53,60,62,62,62,62,62,62,55,53,255,255,255,255,255,255,255,255,255,255,255,255,255,255,8,76,76,31,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,71,71,71,53,54,51,33,32,32,33,34,34,33,34,33,33,33,33,34,50,52,52,71,53,53,62,62,62,62,62,62,55,23,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,71,52,52,51,52,33,32,32,34,34,35,35,35,35,34,34,34,34,33,34,72,52,51,52,52,52,62,62,62,71,52,51,255,255,255,255,255,20,20,72,20,255,255,255,255,255,255,76,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,76,255,255,255,51,53,71,52,32,33,32,34,35,67,38,35,35,35,35,35,35,34,35,34,34,33,52,71,71,71,55,53,55,52,53,71,255,255,255,255,255,49,48,49,48,6,255,255,255,255,255,76,76,31,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,6,51,71,71,32,33,32,34,34,40,40,37,67,35,35,36,35,35,35,35,35,34,34,34,33,55,55,55,53,71,71,71,255,255,255,255,255,49,48,49,48,49,18,255,255,255,255,76,76,76,31,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,76,255,255,16,51,52,33,32,32,13,32,33,33,32,21,13,21,13,33,34,35,35,35,35,35,35,35,34,33,50,53,51,71,71,53,255,255,255,255,255,72,48,72,48,17,255,255,3,255,255,76,76,31,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,51,33,32,12,32,38,41,40,46,47,47,67,39,40,33,15,10,33,34,35,35,35,37,35,39,34,33,34,56,53,3,255,255,255,255,49,48,49,49,49,16,255,255,255,255,76,76,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,76,255,255,255,255,10,32,9,33,42,41,41,41,47,47,47,47,47,67,40,47,67,34,17,15,35,35,36,36,36,36,35,34,33,7,255,255,255,255,255,48,49,28,255,255,255,255,255,255,76,76,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,3,12,14,35,39,39,41,41,41,46,40,46,40,67,47,67,40,40,67,40,67,15,33,67,36,36,36,36,35,35,32,3,255,255,255,255,49,25,255,255,255,255,255,255,255,76,76,31,31,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,76,255,255,255,15,32,34,39,35,39,41,36,41,41,42,45,46,47,51,46,67,47,40,40,47,67,33,33,67,35,36,35,35,35,47,7,255,255,255,255,255,255,255,255,255,255,255,255,255,76,31,31,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,31,76,76,255,255,255,34,34,34,36,36,39,41,41,39,41,46,41,45,47,47,47,40,40,67,40,67,40,47,40,34,67,34,37,36,35,67,9,3,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,76,76,255,255,255,34,33,35,35,35,39,41,40,41,40,46,42,42,46,67,47,50,47,39,47,67,46,40,67,46,42,67,33,35,36,39,9,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,31,31,31,76,255,255,255,33,34,34,35,39,39,39,40,41,38,42,40,45,46,47,47,47,47,47,67,40,40,67,42,40,67,42,33,15,40,39,15,3,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,76,255,255,255,9,33,33,34,36,39,38,40,39,41,40,41,40,42,67,47,47,50,47,40,47,67,47,40,67,47,67,46,46,47,40,15,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,76,255,255,255,255,8,34,34,35,39,39,41,41,41,40,41,46,42,46,67,47,47,56,47,67,40,40,67,47,46,46,67,47,42,35,6,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,76,255,255,255,255,255,4,33,34,36,39,39,41,39,46,40,40,42,45,47,47,67,56,47,47,47,67,40,40,67,45,40,36,33,8,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,31,76,255,255,255,255,255,62,62,34,34,39,41,46,41,39,41,46,40,45,46,47,47,47,67,46,40,40,40,40,34,34,32,62,62,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,31,76,76,255,255,255,255,49,62,62,255,34,33,38,39,46,41,40,41,40,40,40,40,67,47,40,46,40,34,15,27,53,62,62,62,62,255,3,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,31,31,31,76,255,255,255,255,52,62,26,255,255,15,36,34,34,40,44,40,40,40,34,32,33,46,46,45,36,255,255,255,255,255,62,62,62,62,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,31,76,76,255,255,255,255,55,62,255,255,2,255,8,39,40,40,41,40,67,67,45,45,45,35,15,8,255,255,255,255,255,255,255,62,62,62,71,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,31,76,76,255,255,255,255,53,19,255,255,255,255,255,62,34,32,34,34,33,34,33,32,9,56,62,255,255,255,255,255,255,255,255,71,62,62,71,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,31,31,31,31,76,76,255,255,255,53,62,16,255,255,3,49,3,57,62,26,255,4,255,255,255,3,48,71,62,255,255,255,255,255,255,255,255,71,62,62,71,255,255,255,255,255,255,255,255,255,255,255,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,31,76,255,255,255,53,62,255,255,255,16,49,255,59,62,48,3,3,255,255,20,255,55,55,62,255,255,255,255,255,3,255,255,71,62,62,71,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,31,76,255,255,255,55,62,255,255,255,72,49,255,62,62,48,6,16,22,25,19,255,71,62,62,255,255,255,255,255,20,20,3,62,62,62,53,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,76,76,255,255,255,49,62,255,255,3,49,25,255,62,62,48,6,6,6,16,255,255,53,62,62,62,255,255,255,6,50,72,255,62,62,62,30,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,49,62,7,255,3,25,17,62,62,62,48,255,255,255,6,255,255,56,59,62,62,3,255,255,49,49,6,61,62,62,62,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,30,62,62,30,22,23,62,62,62,62,255,255,255,255,3,255,255,71,55,62,62,62,72,16,255,25,62,62,62,62,49,255,255,255,255,255,255,255,255,255,255,255,255,76,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,30,51,71,62,62,62,62,62,62,22,255,255,255,255,255,255,255,49,55,61,62,62,62,62,62,62,62,62,71,49,49,255,255,255,255,255,255,255,255,255,255,255,255,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,19,49,51,52,53,52,55,56,51,19,255,255,255,255,255,255,255,23,49,51,57,62,62,62,62,62,55,52,49,49,3,255,255,255,255,255,255,255,255,255,255,255,255,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,255,255,255,255,3,30,51,51,53,53,52,49,72,255,7,255,255,255,255,3,255,255,49,49,51,51,52,52,53,53,55,52,50,72,255,255,6,255,255,255,255,255,255,255,255,255,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,255,16,30,49,52,51,49,72,255,255,19,255,255,255,255,255,255,255,255,49,49,49,51,51,51,52,53,52,51,255,255,16,255,255,255,255,255,255,255,255,255,255,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,255,255,6,30,49,49,48,255,6,27,6,255,255,255,255,255,3,255,255,255,49,49,49,49,51,49,51,51,255,255,30,6,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,76,255,255,255,255,255,3,255,255,255,255,3,255,26,16,255,255,255,255,255,255,255,255,255,255,255,16,49,48,48,48,16,255,255,26,17,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,255,3,6,3,255,3,16,18,16,255,255,255,255,255,255,255,255,255,3,255,255,255,255,255,255,255,255,255,48,26,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,255,255,255,6,6,16,6,6,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,16,18,18,7,255,255,255,255,255,255,255,255,255,255,255,255,255,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,31,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,255,255,255,255,255,255,255,255,255,255,255,255,255,255,5,76,76,31,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,6,6,6,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,31,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,16,16,19,6,3,3,255,255,255,255,255,255,255,255,255,76,76,76,31,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,16,20,23,20,19,16,7,7,6,3,255,255,255,255,4,76,76,31,31,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,16,20,30,30,26,20,20,16,16,6,3,255,255,255,76,76,76,31,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,16,20,48,48,48,26,20,20,17,6,255,255,255,255,76,76,76,31,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,6,18,30,49,49,30,22,17,6,255,255,255,255,76,76,76,76,31,76,76,31,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,6,20,26,48,30,25,19,7,3,255,255,255,255,76,76,31,31,31,31,76,31,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,16,19,23,26,25,19,16,255,255,255,255,255,76,76,76,76,76,76,76,76,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,6,16,18,19,16,3,255,255,255,255,255,76,76,76,76,76,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,31,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,3,6,3,255,255,255,255,255,76,76,31,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,31,76,76,76,5,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,76,76,76,76,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,31,76,76,76,76,76,4,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,76,76,76,76,76,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,31,31,31,31,31,76,76,31,31,76,31,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,31,76,76,31,31,76,31,31,31,31,76,76,31,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,76,76,31,31,31,76,76,76,76,31,31,76,76,76,76,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,76,76,76,76,76,31,76,76,76,76,76,76,76,76,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,76,76,76,31,31,31,31,31,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,255,255,255,255,255,255,255,255,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,
+};
+
+MWIMAGEHDR image_penguin = {
+  128, 151,	/* width, height*/
+  1, 8,		/* planes, bpp*/
+  128, 1,	/* pitch, bytesperpixel*/
+  1, 256,	/* compression, palsize*/
+  -1L,		/* transcolor*/
+  palette,
+  imagebits,
+};
Binary files lib/microwindows/src/mwin/bmp/pngtest.png and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/pngtest.png differ
Binary files lib/microwindows/src/mwin/bmp/rle8.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/rle8.bmp differ
diff -urN lib/microwindows/src/mwin/bmp/rle8.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/rle8.c
--- lib/microwindows/src/mwin/bmp/rle8.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/rle8.c	2005-02-21 16:03:37.000000000 +0100
@@ -0,0 +1,476 @@
+/* Generated by convbmp*/
+#include "device.h"
+
+/* MWIMAGEHDR image_rle8 converted from rle8.bmp*/
+
+static MWPALENTRY palette[256] = {
+  RGBDEF(   8,   8,  16 ),	/* pal 0*/
+  RGBDEF(  16,  16,  24 ),	/* pal 1*/
+  RGBDEF(  24,  16,  24 ),	/* pal 2*/
+  RGBDEF(  74,  16,  24 ),	/* pal 3*/
+  RGBDEF(  90,  16,  24 ),	/* pal 4*/
+  RGBDEF(  33,  33,  33 ),	/* pal 5*/
+  RGBDEF(  41,  24,  33 ),	/* pal 6*/
+  RGBDEF(  41,  33,  33 ),	/* pal 7*/
+  RGBDEF(  74,  33,  33 ),	/* pal 8*/
+  RGBDEF(  24,  24,  41 ),	/* pal 9*/
+  RGBDEF(  41,  33,  41 ),	/* pal 10*/
+  RGBDEF(  49,  33,  41 ),	/* pal 11*/
+  RGBDEF(  49,  49,  41 ),	/* pal 12*/
+  RGBDEF(  57,  41,  41 ),	/* pal 13*/
+  RGBDEF(  57,  49,  41 ),	/* pal 14*/
+  RGBDEF(  74,  41,  41 ),	/* pal 15*/
+  RGBDEF(  74,  49,  41 ),	/* pal 16*/
+  RGBDEF(  90,  49,  41 ),	/* pal 17*/
+  RGBDEF( 107,  49,  41 ),	/* pal 18*/
+  RGBDEF( 115,  41,  41 ),	/* pal 19*/
+  RGBDEF( 123,  57,  41 ),	/* pal 20*/
+  RGBDEF(  57,  49,  49 ),	/* pal 21*/
+  RGBDEF(  90,  66,  49 ),	/* pal 22*/
+  RGBDEF(  99,  82,  49 ),	/* pal 23*/
+  RGBDEF( 115,  66,  49 ),	/* pal 24*/
+  RGBDEF(  33,  41,  57 ),	/* pal 25*/
+  RGBDEF(  49,  41,  57 ),	/* pal 26*/
+  RGBDEF(  49,  49,  57 ),	/* pal 27*/
+  RGBDEF(  57,  66,  57 ),	/* pal 28*/
+  RGBDEF(  82,  57,  57 ),	/* pal 29*/
+  RGBDEF(  90,  66,  57 ),	/* pal 30*/
+  RGBDEF( 107,  66,  57 ),	/* pal 31*/
+  RGBDEF( 107,  82,  57 ),	/* pal 32*/
+  RGBDEF( 123,  74,  57 ),	/* pal 33*/
+  RGBDEF( 123,  82,  57 ),	/* pal 34*/
+  RGBDEF(  74,  82,  66 ),	/* pal 35*/
+  RGBDEF(  99,  82,  66 ),	/* pal 36*/
+  RGBDEF( 123,  99,  66 ),	/* pal 37*/
+  RGBDEF(  41,  57,  74 ),	/* pal 38*/
+  RGBDEF(  57,  49,  74 ),	/* pal 39*/
+  RGBDEF(  57,  66,  74 ),	/* pal 40*/
+  RGBDEF(  66,  82,  74 ),	/* pal 41*/
+  RGBDEF(  90,  66,  74 ),	/* pal 42*/
+  RGBDEF( 107,  90,  74 ),	/* pal 43*/
+  RGBDEF( 115,  74,  74 ),	/* pal 44*/
+  RGBDEF( 115,  99,  74 ),	/* pal 45*/
+  RGBDEF( 123,  90,  74 ),	/* pal 46*/
+  RGBDEF( 132,  99,  74 ),	/* pal 47*/
+  RGBDEF( 132, 115,  74 ),	/* pal 48*/
+  RGBDEF(  90,  82,  82 ),	/* pal 49*/
+  RGBDEF(  99,  99,  82 ),	/* pal 50*/
+  RGBDEF(  41,  66,  90 ),	/* pal 51*/
+  RGBDEF(  33,  82, 148 ),	/* pal 52*/
+  RGBDEF(  49,  66, 115 ),	/* pal 53*/
+  RGBDEF(  49,  66, 123 ),	/* pal 54*/
+  RGBDEF(  49,  82, 140 ),	/* pal 55*/
+  RGBDEF(  49,  90, 156 ),	/* pal 56*/
+  RGBDEF(  57,  82, 107 ),	/* pal 57*/
+  RGBDEF(  57,  82, 132 ),	/* pal 58*/
+  RGBDEF(  66,  66,  90 ),	/* pal 59*/
+  RGBDEF(  66,  74,  90 ),	/* pal 60*/
+  RGBDEF(  66,  82, 148 ),	/* pal 61*/
+  RGBDEF(  66,  99, 132 ),	/* pal 62*/
+  RGBDEF(  66,  99, 148 ),	/* pal 63*/
+  RGBDEF(  74,  82,  90 ),	/* pal 64*/
+  RGBDEF(  79,  98, 109 ),	/* pal 65*/
+  RGBDEF( 107,  90, 107 ),	/* pal 66*/
+  RGBDEF( 103, 107, 107 ),	/* pal 67*/
+  RGBDEF( 123, 107,  94 ),	/* pal 68*/
+  RGBDEF( 115, 107, 123 ),	/* pal 69*/
+  RGBDEF( 127, 115, 107 ),	/* pal 70*/
+  RGBDEF(  74,  99, 132 ),	/* pal 71*/
+  RGBDEF(  82, 107, 132 ),	/* pal 72*/
+  RGBDEF(  90, 123, 132 ),	/* pal 73*/
+  RGBDEF( 115, 132, 132 ),	/* pal 74*/
+  RGBDEF( 107, 123, 148 ),	/* pal 75*/
+  RGBDEF(  74, 123, 156 ),	/* pal 76*/
+  RGBDEF(  99, 107, 156 ),	/* pal 77*/
+  RGBDEF( 123, 140, 156 ),	/* pal 78*/
+  RGBDEF(  99, 123, 165 ),	/* pal 79*/
+  RGBDEF(  49,  90, 173 ),	/* pal 80*/
+  RGBDEF(  57,  99, 173 ),	/* pal 81*/
+  RGBDEF(  66, 107, 173 ),	/* pal 82*/
+  RGBDEF(  49,  90, 181 ),	/* pal 83*/
+  RGBDEF(  66, 107, 181 ),	/* pal 84*/
+  RGBDEF(  66, 115, 181 ),	/* pal 85*/
+  RGBDEF(  90, 115, 181 ),	/* pal 86*/
+  RGBDEF( 107, 140, 181 ),	/* pal 87*/
+  RGBDEF(  66, 107, 189 ),	/* pal 88*/
+  RGBDEF(  74, 115, 189 ),	/* pal 89*/
+  RGBDEF(  74, 123, 198 ),	/* pal 90*/
+  RGBDEF(  90, 132, 198 ),	/* pal 91*/
+  RGBDEF(  99, 140, 198 ),	/* pal 92*/
+  RGBDEF( 115, 148, 198 ),	/* pal 93*/
+  RGBDEF( 123, 115, 198 ),	/* pal 94*/
+  RGBDEF(  82, 132, 206 ),	/* pal 95*/
+  RGBDEF(  99, 148, 206 ),	/* pal 96*/
+  RGBDEF( 115, 148, 206 ),	/* pal 97*/
+  RGBDEF( 115, 156, 206 ),	/* pal 98*/
+  RGBDEF(  57, 107, 214 ),	/* pal 99*/
+  RGBDEF(  74, 132, 214 ),	/* pal 100*/
+  RGBDEF( 107, 148, 214 ),	/* pal 101*/
+  RGBDEF(  99, 148, 222 ),	/* pal 102*/
+  RGBDEF( 115, 165, 222 ),	/* pal 103*/
+  RGBDEF( 140,  41,  24 ),	/* pal 104*/
+  RGBDEF( 140,  49,  41 ),	/* pal 105*/
+  RGBDEF( 140,  99,  66 ),	/* pal 106*/
+  RGBDEF( 148,  66,  33 ),	/* pal 107*/
+  RGBDEF( 148,  66,  49 ),	/* pal 108*/
+  RGBDEF( 148,  74,  57 ),	/* pal 109*/
+  RGBDEF( 148,  90,  57 ),	/* pal 110*/
+  RGBDEF( 156,  82,  57 ),	/* pal 111*/
+  RGBDEF( 165,  49,  41 ),	/* pal 112*/
+  RGBDEF( 165,  66,  49 ),	/* pal 113*/
+  RGBDEF( 165,  90,  57 ),	/* pal 114*/
+  RGBDEF( 189,  71,  55 ),	/* pal 115*/
+  RGBDEF( 165,  99,  66 ),	/* pal 116*/
+  RGBDEF( 148, 115,  74 ),	/* pal 117*/
+  RGBDEF( 165,  82,  74 ),	/* pal 118*/
+  RGBDEF( 165, 115,  74 ),	/* pal 119*/
+  RGBDEF( 156, 111,  82 ),	/* pal 120*/
+  RGBDEF( 152, 111, 115 ),	/* pal 121*/
+  RGBDEF( 181,  99,  66 ),	/* pal 122*/
+  RGBDEF( 181, 115,  74 ),	/* pal 123*/
+  RGBDEF( 181, 115,  82 ),	/* pal 124*/
+  RGBDEF( 198, 103,  70 ),	/* pal 125*/
+  RGBDEF( 198, 123,  74 ),	/* pal 126*/
+  RGBDEF( 219, 109,  71 ),	/* pal 127*/
+  RGBDEF( 231, 123,  74 ),	/* pal 128*/
+  RGBDEF( 145, 134,  87 ),	/* pal 129*/
+  RGBDEF( 162, 140,  98 ),	/* pal 130*/
+  RGBDEF( 151, 138, 130 ),	/* pal 131*/
+  RGBDEF( 181, 123,  82 ),	/* pal 132*/
+  RGBDEF( 189, 140,  90 ),	/* pal 133*/
+  RGBDEF( 178, 140, 126 ),	/* pal 134*/
+  RGBDEF( 189, 156,  82 ),	/* pal 135*/
+  RGBDEF( 198, 132,  82 ),	/* pal 136*/
+  RGBDEF( 198, 140,  82 ),	/* pal 137*/
+  RGBDEF( 214, 140,  82 ),	/* pal 138*/
+  RGBDEF( 198, 156,  90 ),	/* pal 139*/
+  RGBDEF( 214, 132,  90 ),	/* pal 140*/
+  RGBDEF( 201, 155, 112 ),	/* pal 141*/
+  RGBDEF( 239, 131,  82 ),	/* pal 142*/
+  RGBDEF( 247, 148,  82 ),	/* pal 143*/
+  RGBDEF( 231, 148,  90 ),	/* pal 144*/
+  RGBDEF( 247, 152,  90 ),	/* pal 145*/
+  RGBDEF( 255, 165,  90 ),	/* pal 146*/
+  RGBDEF( 232, 156, 109 ),	/* pal 147*/
+  RGBDEF( 251, 169, 115 ),	/* pal 148*/
+  RGBDEF( 214, 173, 115 ),	/* pal 149*/
+  RGBDEF( 247, 178, 101 ),	/* pal 150*/
+  RGBDEF( 239, 181, 123 ),	/* pal 151*/
+  RGBDEF( 240, 193, 113 ),	/* pal 152*/
+  RGBDEF( 255, 198, 123 ),	/* pal 153*/
+  RGBDEF( 255, 214, 132 ),	/* pal 154*/
+  RGBDEF( 132, 156, 181 ),	/* pal 155*/
+  RGBDEF( 132, 173, 206 ),	/* pal 156*/
+  RGBDEF( 140, 123, 148 ),	/* pal 157*/
+  RGBDEF( 140, 165, 165 ),	/* pal 158*/
+  RGBDEF( 140, 173, 198 ),	/* pal 159*/
+  RGBDEF( 140, 173, 222 ),	/* pal 160*/
+  RGBDEF( 140, 181, 231 ),	/* pal 161*/
+  RGBDEF( 148, 181, 222 ),	/* pal 162*/
+  RGBDEF( 148, 189, 247 ),	/* pal 163*/
+  RGBDEF( 156, 156, 165 ),	/* pal 164*/
+  RGBDEF( 156, 165, 165 ),	/* pal 165*/
+  RGBDEF( 156, 165, 189 ),	/* pal 166*/
+  RGBDEF( 156, 173, 198 ),	/* pal 167*/
+  RGBDEF( 156, 189, 222 ),	/* pal 168*/
+  RGBDEF( 156, 189, 231 ),	/* pal 169*/
+  RGBDEF( 165, 198, 198 ),	/* pal 170*/
+  RGBDEF( 165, 198, 222 ),	/* pal 171*/
+  RGBDEF( 165, 206, 173 ),	/* pal 172*/
+  RGBDEF( 173, 198, 239 ),	/* pal 173*/
+  RGBDEF( 173, 206, 247 ),	/* pal 174*/
+  RGBDEF( 181, 181, 198 ),	/* pal 175*/
+  RGBDEF( 181, 198, 189 ),	/* pal 176*/
+  RGBDEF( 181, 198, 239 ),	/* pal 177*/
+  RGBDEF( 181, 206, 206 ),	/* pal 178*/
+  RGBDEF( 181, 206, 231 ),	/* pal 179*/
+  RGBDEF( 189, 173, 148 ),	/* pal 180*/
+  RGBDEF( 206, 181, 140 ),	/* pal 181*/
+  RGBDEF( 231, 173, 140 ),	/* pal 182*/
+  RGBDEF( 247, 198, 140 ),	/* pal 183*/
+  RGBDEF( 255, 206, 140 ),	/* pal 184*/
+  RGBDEF( 231, 198, 148 ),	/* pal 185*/
+  RGBDEF( 255, 222, 148 ),	/* pal 186*/
+  RGBDEF( 198, 185, 156 ),	/* pal 187*/
+  RGBDEF( 210, 185, 172 ),	/* pal 188*/
+  RGBDEF( 222, 181, 189 ),	/* pal 189*/
+  RGBDEF( 189, 198, 198 ),	/* pal 190*/
+  RGBDEF( 238, 198, 165 ),	/* pal 191*/
+  RGBDEF( 222, 206, 201 ),	/* pal 192*/
+  RGBDEF( 247, 239, 181 ),	/* pal 193*/
+  RGBDEF( 189, 198, 222 ),	/* pal 194*/
+  RGBDEF( 198, 214, 222 ),	/* pal 195*/
+  RGBDEF( 206, 214, 222 ),	/* pal 196*/
+  RGBDEF( 255, 247, 222 ),	/* pal 197*/
+  RGBDEF( 198, 214, 231 ),	/* pal 198*/
+  RGBDEF( 206, 214, 239 ),	/* pal 199*/
+  RGBDEF( 214, 222, 239 ),	/* pal 200*/
+  RGBDEF( 231, 231, 239 ),	/* pal 201*/
+  RGBDEF( 198, 214, 247 ),	/* pal 202*/
+  RGBDEF( 198, 222, 247 ),	/* pal 203*/
+  RGBDEF( 214, 231, 247 ),	/* pal 204*/
+  RGBDEF( 231, 239, 255 ),	/* pal 205*/
+  RGBDEF( 247, 247, 255 ),	/* pal 206*/
+  RGBDEF(   0,   0,   0 ),	/* pal 207*/
+  RGBDEF(   0,   0,   0 ),	/* pal 208*/
+  RGBDEF(   0,   0,   0 ),	/* pal 209*/
+  RGBDEF(   0,   0,   0 ),	/* pal 210*/
+  RGBDEF(   0,   0,   0 ),	/* pal 211*/
+  RGBDEF(   0,   0,   0 ),	/* pal 212*/
+  RGBDEF(   0,   0,   0 ),	/* pal 213*/
+  RGBDEF(   0,   0,   0 ),	/* pal 214*/
+  RGBDEF(   0,   0,   0 ),	/* pal 215*/
+  RGBDEF(   0,   0,   0 ),	/* pal 216*/
+  RGBDEF(   0,   0,   0 ),	/* pal 217*/
+  RGBDEF(   0,   0,   0 ),	/* pal 218*/
+  RGBDEF(   0,   0,   0 ),	/* pal 219*/
+  RGBDEF(   0,   0,   0 ),	/* pal 220*/
+  RGBDEF(   0,   0,   0 ),	/* pal 221*/
+  RGBDEF(   0,   0,   0 ),	/* pal 222*/
+  RGBDEF(   0,   0,   0 ),	/* pal 223*/
+  RGBDEF(   0,   0,   0 ),	/* pal 224*/
+  RGBDEF(   0,   0,   0 ),	/* pal 225*/
+  RGBDEF(   0,   0,   0 ),	/* pal 226*/
+  RGBDEF(   0,   0,   0 ),	/* pal 227*/
+  RGBDEF(   0,   0,   0 ),	/* pal 228*/
+  RGBDEF(   0,   0,   0 ),	/* pal 229*/
+  RGBDEF(   0,   0,   0 ),	/* pal 230*/
+  RGBDEF(   0,   0,   0 ),	/* pal 231*/
+  RGBDEF(   0,   0,   0 ),	/* pal 232*/
+  RGBDEF(   0,   0,   0 ),	/* pal 233*/
+  RGBDEF(   0,   0,   0 ),	/* pal 234*/
+  RGBDEF(   0,   0,   0 ),	/* pal 235*/
+  RGBDEF(   0,   0,   0 ),	/* pal 236*/
+  RGBDEF(   0,   0,   0 ),	/* pal 237*/
+  RGBDEF(   0,   0,   0 ),	/* pal 238*/
+  RGBDEF(   0,   0,   0 ),	/* pal 239*/
+  RGBDEF(   0,   0,   0 ),	/* pal 240*/
+  RGBDEF(   0,   0,   0 ),	/* pal 241*/
+  RGBDEF(   0,   0,   0 ),	/* pal 242*/
+  RGBDEF(   0,   0,   0 ),	/* pal 243*/
+  RGBDEF(   0,   0,   0 ),	/* pal 244*/
+  RGBDEF(   0,   0,   0 ),	/* pal 245*/
+  RGBDEF(   0,   0,   0 ),	/* pal 246*/
+  RGBDEF(   0,   0,   0 ),	/* pal 247*/
+  RGBDEF(   0,   0,   0 ),	/* pal 248*/
+  RGBDEF(   0,   0,   0 ),	/* pal 249*/
+  RGBDEF(   0,   0,   0 ),	/* pal 250*/
+  RGBDEF(   0,   0,   0 ),	/* pal 251*/
+  RGBDEF(   0,   0,   0 ),	/* pal 252*/
+  RGBDEF(   0,   0,   0 ),	/* pal 253*/
+  RGBDEF(   0,   0,   0 ),	/* pal 254*/
+  RGBDEF(   0,   0,   0 ),	/* pal 255*/
+};
+
+static MWUCHAR imagebits[] = {
+5,5,13,12,22,11,5,2,2,2,5,2,2,2,1,2,5,2,13,7,11,5,2,2,2,5,2,5,2,1,1,1,1,2,5,2,2,2,2,9,1,1,2,14,1,1,1,1,0,1,1,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2,5,1,2,2,5,2,2,1,2,1,2,1,2,5,2,2,5,2,5,11,6,6,6,2,6,6,2,2,2,2,1,1,1,1,2,1,1,1,2,10,7,7,2,1,6,5,1,1,2,2,13,11,7,10,11,2,2,6,1,2,5,9,2,1,1,1,1,1,2,2,10,2,6,1,1,1,1,2,11,9,6,5,10,10,10,2,2,1,
+2,1,6,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,6,5,2,1,2,1,5,13,13,7,11,0,1,2,2,13,2,21,2,1,5,6,5,2,1,2,11,2,2,2,13,13,21,21,29,22,13,22,43,14,14,6,1,2,6,2,2,2,11,6,16,23,16,16,13,29,14,13,16,13,6,2,1,1,2,2,2,5,7,2,2,2,5,2,9,14,2,12,7,2,11,2,2,21,13,16,13,13,16,11,8,13,8,13,11,11,6,2,6,7,7,13,7,6,6,2,1,1,2,7,6,1,7,14,2,2,7,16,7,2,6,1,2,2,2,2,5,2,2,5,2,2,6,1,13,2,2,13,6,13,13,7,6,2,7,1,2,2,1,1,1,1,1,1,1,1,1,1,2,1,1,7,6,2,5,2,2,2,5,2,13,2,12,2,11,6,7,2,2,5,2,1,1,1,1,1,1,1,1,1,1,0,2,1,2,1,1,5,1,1,1,1,1,2,2,2,5,2,2,2,5,2,5,2,2,2,6,1,2,11,6,6,2,11,5,6,6,7,6,1,2,1,1,2,1,2,2,1,1,1,1,1,5,10,10,10,9,2,2,2,1,1,5,2,2,26,6,10,2,5,2,2,1,2,2,5,1,2,1,1,1,2,5,27,21,2,1,2,1,1,1,5,1,9,10,6,10,10,11,5,11,0,
+2,2,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,2,6,1,2,2,2,2,2,1,5,2,7,13,11,7,5,6,5,5,5,10,10,13,2,2,12,5,13,1,1,5,2,2,5,5,13,2,13,11,13,17,21,29,16,6,7,2,6,2,5,2,12,11,14,14,29,16,16,16,21,14,13,14,29,13,6,2,1,1,1,1,5,5,2,5,1,2,1,2,10,7,2,13,2,1,11,2,2,6,13,16,13,13,15,13,13,11,13,8,11,13,6,2,7,7,7,13,6,7,13,2,6,1,2,7,11,6,14,6,6,6,7,35,7,13,2,2,5,2,5,2,2,5,2,2,2,2,2,13,7,2,13,7,13,7,8,11,2,5,2,1,1,1,0,2,1,1,1,1,1,2,1,1,1,1,6,1,2,2,2,2,6,2,2,2,2,5,2,11,13,6,13,25,2,1,1,1,0,1,0,2,1,1,1,1,0,1,1,1,6,2,1,1,1,1,2,1,1,2,2,5,1,5,2,2,2,1,2,1,5,2,9,6,2,5,10,7,11,7,2,7,7,6,2,5,2,25,2,5,2,1,2,1,1,1,1,1,2,11,9,5,2,5,2,1,1,1,2,2,10,11,10,10,10,2,2,1,2,5,2,2,6,2,1,1,1,1,2,13,10,2,1,1,1,1,1,6,9,6,6,10,6,6,6,2,10,2,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,5,2,5,2,2,1,5,21,11,13,5,2,2,13,2,6,5,12,0,2,5,2,5,2,1,2,2,5,2,13,7,2,13,7,14,23,30,36,22,29,16,11,7,13,13,13,13,11,14,29,13,16,29,13,29,13,14,14,17,13,2,2,2,1,2,2,2,2,6,2,2,2,2,2,13,5,2,10,2,12,2,10,7,11,16,29,17,13,16,13,17,13,8,11,11,6,6,6,14,8,6,7,7,6,2,7,1,1,2,14,2,2,14,6,2,6,2,14,7,2,2,2,6,2,2,2,5,2,2,13,2,5,2,14,7,2,7,7,7,2,14,6,6,2,1,1,1,1,1,1,1,0,2,1,0,1,0,1,1,1,2,2,6,2,5,5,7,2,5,13,11,11,11,11,11,7,7,2,2,1,1,1,1,1,1,0,2,1,0,2,1,1,1,1,2,1,1,1,1,1,1,1,1,2,10,2,2,2,6,9,1,2,1,2,1,2,1,2,2,2,11,2,11,2,2,2,7,6,6,6,2,2,2,2,2,2,1,1,5,2,2,6,1,6,5,2,1,2,2,1,2,2,2,5,10,10,9,13,1,5,2,2,1,2,2,2,2,2,5,1,1,1,11,10,5,2,1,1,2,1,2,2,2,11,6,6,10,6,6,5,11,2,
+1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,2,1,1,1,2,5,2,2,2,2,2,6,1,10,21,13,13,2,1,6,13,21,11,2,2,0,1,11,2,2,5,1,2,2,5,11,6,5,5,11,7,30,23,34,68,11,22,17,13,11,7,6,2,21,13,11,11,14,17,21,14,36,13,21,29,14,11,2,6,1,1,2,6,1,6,1,2,2,2,5,6,5,2,13,2,14,13,12,2,2,7,16,21,14,13,11,13,13,16,13,11,13,6,6,2,7,7,13,6,7,7,6,7,1,1,7,14,2,2,14,2,2,6,2,14,13,2,5,1,2,2,2,5,2,6,5,2,2,2,2,21,13,5,7,7,2,7,6,13,2,2,2,1,1,1,0,2,0,2,0,1,1,1,1,1,2,6,1,5,2,2,2,2,5,1,2,2,2,5,2,2,13,5,2,2,1,0,1,1,0,1,0,2,1,1,1,1,1,1,1,1,2,1,1,1,1,2,1,1,1,1,2,2,5,2,2,2,1,1,5,2,2,1,2,2,5,2,7,11,6,2,6,6,5,13,6,2,2,6,2,1,2,1,1,1,2,1,6,1,1,2,1,5,2,2,5,1,1,2,2,10,10,10,10,2,5,2,1,1,2,5,2,25,2,5,2,1,1,5,10,10,2,1,2,1,1,1,2,5,9,11,6,6,6,10,6,10,11,2,
+1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,1,6,1,1,1,1,5,2,1,1,1,1,1,1,1,5,2,2,2,21,13,10,11,5,2,21,16,14,10,1,1,1,1,5,2,12,2,5,2,5,2,5,2,2,2,2,21,29,43,47,18,12,31,29,13,13,13,13,13,15,2,14,22,21,30,15,29,30,13,16,13,13,13,6,1,1,2,5,5,5,2,2,6,2,2,2,12,6,5,21,5,6,6,1,1,2,13,6,2,13,6,6,1,7,15,8,11,8,7,6,2,6,7,11,13,6,8,7,7,2,1,7,7,1,6,7,2,6,6,2,14,6,2,1,2,5,2,6,1,2,2,5,7,6,6,7,7,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2,2,11,7,10,10,10,5,2,5,11,1,1,2,2,1,5,2,2,1,2,6,2,13,2,2,6,6,21,30,45,49,34,47,13,37,21,13,21,13,7,7,16,13,14,14,29,16,29,30,13,21,14,14,14,14,2,6,2,5,2,2,5,2,2,2,2,2,13,12,1,27,2,6,7,5,2,1,1,2,2,21,6,2,6,13,17,15,15,13,11,11,6,7,11,7,14,7,13,2,5,2,6,1,2,2,2,2,5,2,2,6,2,6,2,1,1,6,2,6,13,2,2,2,2,13,1,6,7,2,2,2,2,2,7,8,7,6,1,1,1,1,1,1,0,1,1,0,1,1,1,1,1,1,6,1,7,13,2,2,5,1,1,2,1,2,2,2,11,13,13,1,1,2,1,1,1,1,2,0,1,1,1,1,1,1,1,1,1,2,1,2,5,1,1,1,1,1,1,1,5,2,2,2,10,1,1,6,1,1,5,2,5,2,2,2,5,11,13,1,2,10,11,6,2,6,2,2,2,6,2,5,1,2,1,2,5,1,1,2,1,1,2,5,2,1,1,2,2,2,5,2,10,10,2,2,1,1,5,11,2,10,2,11,11,5,11,10,2,2,1,2,1,5,1,1,1,5,9,6,6,2,10,11,9,6,6,2,
+2,5,2,5,5,5,1,2,5,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,2,1,2,5,2,7,5,5,2,2,11,5,12,13,2,2,5,2,5,2,13,1,1,5,1,5,2,2,7,2,13,22,49,45,16,45,47,21,32,2,13,11,13,13,13,21,11,29,22,30,43,29,22,12,21,14,11,13,29,1,2,2,2,5,2,1,2,5,2,5,2,13,1,12,2,5,5,2,2,2,5,1,2,11,11,13,6,2,11,17,15,15,15,7,11,6,6,11,7,7,2,6,5,2,2,1,1,2,1,2,2,2,2,6,2,2,7,2,2,1,1,2,7,6,2,5,5,13,2,2,2,6,1,6,1,6,6,14,7,6,7,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,5,5,2,2,2,2,2,6,2,5,1,13,11,13,13,13,2,1,0,2,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,2,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1,1,2,5,1,1,2,2,2,5,5,2,2,5,2,10,2,1,1,1,2,5,1,1,1,1,1,1,1,2,2,2,14,43,13,7,13,14,29,29,14,16,13,5,7,13,13,13,21,22,29,23,32,16,29,21,16,29,14,11,7,2,6,2,7,2,2,5,2,7,2,6,6,6,1,6,2,5,2,2,6,1,6,2,2,2,2,2,13,13,16,13,6,29,17,17,8,11,8,13,6,8,7,11,7,6,7,2,6,1,1,1,1,1,2,2,6,2,6,11,6,5,6,1,2,2,21,7,6,1,6,1,1,2,2,7,7,7,6,1,7,7,13,7,13,2,0,1,2,1,1,1,1,1,1,1,1,1,1,1,1,38,2,1,6,2,5,2,1,1,2,5,2,2,10,13,11,2,2,1,1,1,1,1,1,1,0,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,2,1,2,2,1,5,1,2,2,2,2,5,2,5,2,2,2,2,13,5,6,7,11,6,6,2,2,2,5,10,2,2,2,2,1,1,5,2,2,5,2,2,2,1,2,5,2,5,1,5,2,2,5,2,2,2,2,5,1,9,2,1,2,2,6,10,7,2,1,1,6,1,6,1,2,1,2,2,2,1,2,25,2,9,7,2,13,13,6,36,
+2,2,5,2,1,1,1,5,5,2,1,1,1,2,2,1,1,1,2,2,2,1,1,1,1,5,2,5,2,2,5,5,13,11,2,6,13,13,5,2,2,5,2,2,2,9,2,2,2,2,1,1,2,2,11,13,36,13,5,2,14,29,22,16,29,16,29,13,14,13,16,16,13,21,29,30,29,17,16,30,13,21,11,7,6,2,2,7,11,2,2,6,2,2,6,6,6,2,6,1,2,2,2,5,2,5,2,2,2,5,2,5,7,6,13,11,11,13,22,16,11,11,7,11,6,7,6,8,11,13,6,5,2,1,0,1,1,1,2,5,2,7,7,11,6,1,2,5,2,2,2,11,2,2,2,1,2,2,5,5,7,7,2,1,7,14,6,13,7,5,60,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,5,1,2,5,1,2,11,10,2,13,2,2,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,2,5,2,2,1,2,5,2,2,6,1,2,2,2,5,2,2,5,12,6,6,11,7,11,2,2,2,6,2,2,6,1,1,1,1,1,2,5,2,2,5,2,5,2,1,2,2,11,10,2,2,2,1,2,1,5,2,2,5,2,5,2,2,11,5,10,11,1,1,2,1,1,2,1,2,6,1,1,1,5,2,2,2,5,9,2,10,11,43,74,
+5,5,2,5,5,1,1,5,5,5,1,1,1,1,1,1,1,2,6,2,2,5,1,2,1,2,11,2,2,2,6,5,14,11,13,7,16,26,15,1,2,2,2,5,2,2,1,2,2,2,1,2,1,2,13,30,16,13,6,13,30,32,43,34,29,30,30,22,29,29,22,13,30,13,21,37,45,43,14,21,14,21,11,11,8,2,2,6,6,2,2,2,5,2,6,6,6,7,2,6,2,2,6,1,2,2,2,6,1,2,1,2,7,6,7,11,11,11,18,13,15,13,6,11,6,6,13,6,6,6,6,6,1,2,1,1,1,2,6,2,2,6,6,6,2,6,2,2,2,12,11,6,2,5,1,0,1,2,2,5,13,2,6,1,7,14,7,13,11,1,0,2,1,1,1,1,1,2,1,1,0,2,1,1,1,1,1,2,5,2,1,2,2,1,1,2,5,2,2,11,13,2,1,1,1,1,1,1,2,1,1,1,0,1,2,1,1,1,2,1,1,2,1,1,1,1,5,1,1,1,1,2,1,5,2,1,2,2,5,1,1,5,2,2,1,2,6,2,2,5,12,2,9,11,6,2,2,2,6,1,2,5,2,1,5,1,1,2,2,6,2,2,1,1,2,5,5,13,2,2,5,1,5,2,2,2,2,1,2,2,2,2,5,9,6,1,9,5,1,1,1,2,1,1,1,2,5,2,2,2,5,2,9,2,2,10,6,70,205,131,
+2,5,9,2,1,1,1,2,5,2,5,2,2,1,1,1,2,14,11,2,2,2,6,1,5,5,26,2,6,10,21,7,13,13,13,21,21,14,2,1,2,6,2,2,2,2,5,1,2,2,1,1,2,11,7,30,2,13,13,11,14,36,46,30,30,30,16,29,14,29,14,13,36,2,30,36,46,30,21,13,13,16,8,21,22,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11,5,2,9,2,6,2,1,1,5,1,2,2,2,5,2,6,10,10,7,11,2,2,2,2,2,2,25,2,5,2,2,2,6,1,9,11,11,16,192,205,201,200,74,
+2,6,5,1,2,1,1,5,2,5,2,2,6,2,2,5,2,13,12,5,2,5,2,5,2,6,2,5,21,16,11,2,30,16,14,21,16,2,2,2,2,2,6,2,2,2,21,2,28,13,22,15,6,7,17,9,2,11,22,30,22,34,43,30,22,29,14,29,14,15,13,21,17,29,16,30,30,17,17,17,17,16,13,15,8,2,14,11,2,2,6,2,2,2,7,7,7,6,2,2,2,5,5,2,6,1,2,13,2,5,2,5,13,7,2,6,7,13,6,2,17,7,2,11,7,11,8,13,11,6,2,2,6,1,1,1,1,2,1,2,2,2,2,6,2,7,2,11,5,13,7,2,5,2,1,1,1,7,5,13,1,5,1,2,2,14,6,14,8,2,2,1,1,1,1,1,1,1,1,1,2,1,0,2,0,2,1,1,2,2,2,1,1,1,2,5,2,2,6,2,11,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,2,1,2,2,2,6,1,6,1,11,7,6,2,6,2,2,10,2,2,11,11,2,6,2,2,5,6,2,2,1,1,2,1,5,1,1,5,1,2,9,2,5,9,6,2,2,6,1,2,2,6,2,1,2,2,2,11,6,2,11,10,6,10,2,1,5,2,2,25,2,2,2,9,2,25,1,2,6,11,13,165,205,201,201,204,201,131,
+2,2,2,6,1,1,1,2,1,2,11,7,2,2,2,10,2,13,10,10,2,5,2,1,2,2,5,11,14,21,15,21,22,29,13,14,11,6,2,5,2,5,1,2,2,2,13,5,21,22,117,29,2,30,17,2,6,14,20,15,22,31,32,33,29,29,21,13,14,13,14,16,47,106,31,16,24,17,33,29,29,15,13,29,11,0,29,11,2,6,6,2,6,6,7,7,13,7,0,6,2,2,5,6,1,5,6,1,2,2,2,6,5,7,6,2,7,7,7,7,16,6,7,8,11,11,13,11,17,6,6,2,2,1,1,1,1,2,2,2,5,2,5,2,2,2,13,5,12,7,2,6,2,2,1,1,1,2,7,5,2,2,1,2,13,13,7,17,13,2,2,2,1,1,5,2,1,1,9,40,2,5,2,1,1,1,1,1,2,2,1,2,5,1,2,2,5,1,2,2,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,2,1,2,2,2,2,11,11,6,6,6,2,6,5,11,2,7,13,12,1,1,2,5,1,9,7,7,1,2,2,21,1,1,2,1,2,6,2,5,2,5,2,2,5,1,6,2,5,1,1,2,6,2,11,2,5,11,10,5,10,6,1,2,2,5,2,2,2,5,2,2,5,2,2,9,11,13,13,205,201,201,204,201,201,74,
+2,5,1,1,6,2,1,5,2,7,13,11,2,5,7,29,14,15,13,21,13,5,5,2,6,1,2,5,7,21,21,29,22,22,13,29,7,2,2,2,2,2,6,2,2,12,7,21,12,29,130,18,15,120,6,6,1,14,22,18,22,122,37,29,16,16,13,14,13,15,47,106,43,18,15,24,24,29,33,18,30,22,11,8,8,1,16,7,1,11,2,2,2,7,6,7,13,2,2,2,5,2,2,2,12,7,2,13,2,5,7,2,13,7,6,6,7,13,8,6,16,6,13,17,13,11,11,11,11,11,6,6,2,0,1,1,1,1,1,5,2,2,2,2,6,1,14,6,2,2,1,2,2,6,1,1,2,7,7,2,2,13,1,5,13,14,7,7,13,2,2,7,5,5,65,7,2,2,1,9,9,51,9,10,59,1,2,1,2,1,5,2,1,2,5,2,2,5,2,5,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,6,5,2,5,2,11,2,10,6,6,7,11,6,2,2,7,11,11,10,2,2,2,5,2,6,2,10,5,2,2,25,51,11,1,1,5,2,2,5,2,12,2,5,2,2,6,1,2,2,6,1,6,1,2,25,2,11,6,2,9,11,5,2,2,26,38,64,10,5,2,5,2,2,9,5,6,26,8,130,205,204,201,201,200,201,74,
+2,1,1,6,1,1,1,2,5,10,7,12,5,2,12,21,14,14,14,13,13,10,10,12,1,5,6,5,12,21,13,16,29,22,13,29,2,2,2,5,2,2,14,14,13,2,12,16,29,36,47,37,106,33,11,2,2,21,22,30,18,132,24,33,30,22,29,13,29,47,46,17,109,33,22,33,33,17,33,33,30,17,13,15,11,6,16,11,2,2,2,6,2,13,7,13,7,2,2,2,5,2,5,2,6,7,2,2,2,2,13,1,7,6,2,7,13,7,11,13,6,6,7,11,11,17,13,8,8,11,11,2,6,1,1,2,1,2,2,2,2,2,2,7,2,13,2,2,2,1,1,2,2,2,1,1,2,2,6,1,6,2,2,13,13,6,6,13,7,2,12,2,2,1,71,72,40,1,1,2,2,2,5,57,27,1,1,2,6,2,2,2,5,2,2,6,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,11,2,11,6,8,11,6,2,6,6,5,12,1,6,1,2,2,2,10,2,13,11,1,2,2,5,2,5,2,2,2,5,2,5,2,2,5,2,5,2,2,5,2,2,2,2,5,2,2,9,2,11,1,10,2,2,5,2,9,2,2,2,9,2,9,2,5,10,2,12,8,166,206,200,201,204,204,201,201,69,
+2,6,1,2,1,1,1,2,13,13,13,5,2,2,16,29,26,2,21,15,12,10,5,12,10,5,2,12,21,29,13,13,16,22,29,13,1,6,2,2,2,13,13,2,2,2,13,21,13,23,43,31,31,11,8,6,6,6,16,21,29,47,46,24,31,21,22,11,34,47,31,31,46,105,29,46,18,31,33,18,30,17,11,17,8,2,14,11,2,6,6,1,7,6,11,13,7,6,6,1,2,2,2,2,5,2,5,6,2,6,2,2,2,6,6,6,7,11,11,13,13,11,7,11,17,11,11,8,7,7,6,2,6,2,1,2,1,2,2,2,2,12,6,7,2,2,2,6,2,1,0,2,2,5,1,1,2,5,2,6,1,2,1,2,6,6,7,7,13,2,1,2,1,64,40,5,9,1,1,1,40,25,38,6,1,0,1,1,2,1,2,6,2,2,5,2,5,1,2,1,5,1,2,2,5,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,1,1,1,5,2,1,5,2,6,6,6,7,11,11,13,7,6,6,2,11,2,6,1,2,2,2,5,1,13,11,2,2,2,6,2,2,1,2,5,2,2,2,2,5,12,7,2,12,1,5,2,5,2,5,2,2,2,11,2,11,10,9,10,5,2,2,2,6,1,5,2,2,6,2,5,2,9,9,21,176,205,201,201,201,201,201,201,204,131,
+2,2,1,5,1,2,2,10,13,14,13,2,2,13,21,12,12,2,14,21,6,2,7,10,5,13,7,16,13,14,13,13,16,24,16,13,6,1,5,2,2,2,7,2,13,7,11,14,21,36,30,18,13,6,11,2,2,11,16,22,30,34,109,110,109,31,8,32,123,31,24,18,31,33,33,113,44,8,33,18,31,30,13,15,11,2,29,2,2,2,7,13,5,2,7,11,13,2,2,2,2,6,1,6,1,6,2,6,2,7,6,6,12,2,11,7,6,13,11,11,29,7,13,11,17,11,11,11,11,11,6,7,2,2,6,2,1,5,1,2,7,13,11,5,1,1,1,2,7,2,1,1,2,2,1,1,2,2,2,1,1,5,2,13,7,6,7,7,7,6,1,6,25,9,2,2,1,1,1,5,27,60,1,1,1,1,1,1,1,2,1,2,2,9,51,2,2,1,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,5,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1,2,2,6,2,11,2,2,7,6,11,8,11,6,10,11,7,6,2,2,5,1,2,5,2,11,11,7,6,6,5,2,2,1,6,2,9,2,5,9,25,9,1,2,13,10,6,2,2,2,1,2,5,2,5,2,2,10,12,10,2,2,2,13,26,2,6,2,5,0,2,2,2,9,13,2,121,205,198,204,201,198,201,204,201,198,74,
+2,5,2,2,1,2,6,7,13,11,11,7,5,5,10,13,12,2,13,11,2,7,7,6,2,13,13,7,11,6,7,13,13,17,29,6,2,2,6,2,5,2,11,2,13,16,10,12,16,13,36,17,11,11,6,11,29,22,17,13,13,22,34,110,114,24,30,34,20,24,20,18,106,33,33,33,18,13,109,24,33,18,11,15,6,11,14,2,6,6,7,6,6,7,13,13,7,2,2,2,5,1,5,7,11,7,7,7,2,11,2,7,11,2,13,2,11,11,11,8,8,11,11,13,21,28,17,13,7,13,11,6,2,6,1,2,2,2,2,5,7,7,7,2,1,1,2,7,2,2,1,1,2,6,1,1,2,5,2,2,1,2,7,6,13,6,7,7,13,1,5,2,2,2,1,2,2,1,1,2,1,27,40,2,1,1,1,1,1,2,6,1,6,1,2,2,1,1,1,1,2,2,2,5,2,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,2,1,1,2,2,6,1,2,2,11,6,6,11,13,8,11,6,2,12,11,7,6,1,2,2,2,2,2,13,11,11,1,9,2,5,2,5,1,9,2,25,7,2,2,5,9,10,10,5,2,5,2,5,1,1,1,1,2,2,11,2,2,6,1,2,5,10,1,2,2,51,76,91,40,2,2,9,2,29,206,201,200,201,198,204,201,204,204,201,74,
+2,1,2,6,1,6,1,10,11,13,7,13,5,2,5,13,2,2,21,13,6,6,7,11,6,7,6,2,2,6,7,6,14,36,11,6,6,2,2,2,2,2,7,7,21,16,2,7,12,30,130,8,13,6,16,21,13,29,14,29,14,30,34,109,122,22,17,46,33,33,18,33,33,24,24,24,17,11,110,24,24,18,13,15,13,16,13,11,2,6,7,7,7,6,7,7,2,6,2,2,6,2,5,5,2,7,7,6,6,7,11,13,6,2,2,2,11,13,11,7,13,6,13,16,13,29,29,13,17,11,11,6,6,2,5,2,5,1,2,2,5,6,1,1,1,1,2,6,13,1,1,2,5,2,1,1,2,1,1,1,1,1,2,7,11,7,6,6,2,2,2,2,2,1,2,26,5,1,1,1,1,5,9,0,1,1,1,1,1,1,1,7,2,5,1,2,2,1,1,1,1,1,2,2,2,9,2,2,2,1,1,1,1,1,1,1,2,1,1,2,2,1,1,1,1,1,1,1,1,2,1,2,1,10,1,2,5,2,6,11,2,7,11,6,11,11,2,11,7,11,11,6,6,2,2,2,10,11,13,11,6,2,5,9,2,1,2,5,5,5,9,5,9,2,5,2,25,2,11,2,2,9,2,2,2,5,2,2,9,11,2,2,2,5,2,2,9,11,5,2,2,12,2,6,10,12,35,67,192,204,204,200,198,204,201,198,200,200,201,74,
+2,6,1,2,6,1,5,11,5,10,13,13,11,11,5,2,2,13,13,13,11,11,13,8,7,7,2,6,6,2,6,13,16,16,21,7,2,2,5,2,5,2,2,13,16,30,30,17,29,22,47,17,8,13,116,16,21,22,14,30,11,16,43,110,132,18,43,108,18,24,24,33,24,109,33,24,11,11,114,33,24,44,7,18,22,17,11,2,2,11,6,6,2,13,7,13,6,2,7,2,2,2,2,2,5,6,1,2,2,5,2,13,2,2,6,12,11,14,11,13,17,1,13,22,13,30,16,7,21,13,11,7,2,2,1,2,2,1,2,14,35,1,0,1,1,1,2,7,2,2,1,2,2,2,1,0,1,1,2,1,1,2,2,13,6,2,7,2,6,2,6,2,2,5,2,2,1,1,1,1,2,1,1,1,1,1,1,60,131,13,13,2,2,2,2,2,1,1,1,1,1,2,5,2,2,1,2,1,1,1,1,1,1,1,1,2,1,5,1,2,1,1,2,1,1,1,1,1,1,2,5,2,1,2,2,6,1,2,13,11,2,11,13,11,8,11,7,7,11,10,11,2,6,2,2,13,11,5,2,2,11,10,2,2,5,1,2,9,5,2,5,9,2,25,2,2,2,5,2,6,2,2,2,5,1,2,5,5,6,1,2,2,6,1,5,2,5,9,2,25,2,2,2,2,11,192,206,204,200,200,200,199,199,200,198,200,200,195,200,74,
+2,2,5,2,2,2,5,10,7,13,7,13,17,21,11,2,2,2,21,11,11,13,6,11,6,8,2,6,7,13,13,14,17,30,13,6,6,2,2,2,2,2,12,13,30,47,47,34,36,119,114,8,13,20,20,13,13,11,16,13,14,29,16,24,20,15,22,108,20,33,18,111,109,109,20,31,13,6,109,24,33,18,11,29,18,14,13,2,7,7,7,13,7,7,13,7,2,13,2,2,6,2,13,5,7,12,12,13,2,2,2,11,2,2,2,2,11,15,13,13,11,2,16,16,13,16,29,6,16,8,7,6,6,2,2,6,1,1,2,16,12,1,1,1,1,0,2,7,6,1,0,1,5,2,2,1,1,1,1,1,1,1,2,7,7,13,6,6,1,2,2,2,5,2,2,1,1,1,1,2,6,0,1,1,1,1,2,9,11,1,2,2,6,2,1,1,1,1,1,1,1,1,2,2,5,2,9,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,2,1,2,2,5,2,9,6,6,7,2,6,11,11,7,7,7,11,2,10,2,13,2,2,2,1,2,2,6,2,11,5,7,5,9,2,5,9,9,5,9,2,5,2,2,5,2,9,5,10,1,2,6,2,2,6,9,2,5,5,78,7,11,1,2,6,2,9,2,5,11,51,7,2,11,166,201,198,200,198,196,199,199,199,199,196,199,195,196,199,131,
+2,5,2,2,5,2,2,10,21,11,7,13,13,21,6,1,5,13,13,7,7,11,7,11,17,6,2,13,13,14,13,13,22,16,11,6,2,2,5,2,2,5,14,45,117,119,119,32,47,47,125,29,11,24,114,26,6,7,13,7,22,16,16,45,122,18,22,111,33,109,24,114,111,109,31,18,11,11,114,24,37,18,11,33,33,11,13,2,11,7,13,7,6,13,21,11,2,7,2,7,2,2,2,13,11,13,2,2,2,5,2,5,2,5,2,7,17,11,11,7,13,1,13,17,11,21,17,6,17,11,11,6,2,1,2,2,1,1,2,10,7,2,2,1,1,1,2,7,2,2,1,1,2,2,1,1,1,1,1,2,1,1,2,2,6,7,7,2,2,12,1,26,10,1,1,1,1,1,1,1,25,26,2,1,1,2,1,1,5,2,2,11,2,2,2,9,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,1,1,1,5,2,1,2,1,2,2,2,2,10,6,2,11,11,6,11,8,11,13,11,6,7,7,2,11,1,1,1,11,2,2,5,9,2,2,5,2,2,9,2,2,2,2,2,6,2,2,2,2,10,2,11,2,2,2,2,2,2,1,12,69,200,65,74,70,5,1,9,2,10,13,60,35,64,78,188,204,204,200,200,200,198,200,196,195,200,199,199,198,199,200,74,
+2,1,5,2,2,5,5,13,11,13,5,7,13,7,2,2,13,12,7,13,13,11,8,8,7,11,2,13,6,11,13,22,31,17,11,6,6,2,2,2,2,2,29,106,32,30,34,30,117,140,123,19,8,34,105,1,11,6,29,29,30,24,30,45,34,11,22,106,33,33,24,118,114,109,33,18,13,11,114,108,109,16,13,46,18,11,21,2,6,11,7,7,13,17,16,2,11,2,2,13,17,6,5,26,2,5,2,6,2,2,7,2,2,2,11,13,13,13,7,13,6,1,7,13,16,13,16,11,13,11,13,2,6,2,2,5,1,1,2,22,7,6,0,1,1,1,2,7,6,2,1,2,1,1,1,1,1,1,2,1,1,1,2,7,6,6,6,2,2,2,1,21,1,1,1,1,1,1,0,1,2,1,1,1,1,5,2,2,2,2,5,2,2,5,2,2,1,1,1,1,1,2,1,1,1,2,2,5,1,1,1,1,1,1,2,1,1,2,1,1,1,2,1,1,1,1,1,1,2,1,5,2,2,5,2,2,6,6,6,6,6,7,7,7,11,11,13,11,5,2,12,10,2,1,1,5,1,9,9,2,5,2,5,2,2,6,2,5,11,2,2,2,2,2,2,6,6,2,2,11,2,2,11,2,6,6,134,204,200,204,196,190,134,1,13,29,5,11,192,131,200,204,204,204,198,201,198,200,203,199,196,179,200,179,200,179,199,198,179,74,
+2,1,2,5,10,2,10,10,7,13,10,7,21,11,2,6,5,13,6,11,13,13,11,13,11,17,2,7,7,7,29,24,24,16,11,13,2,2,2,6,2,11,22,29,22,30,47,36,45,147,125,31,8,136,33,11,2,6,11,13,16,16,13,33,106,32,43,110,33,33,24,111,114,111,24,15,11,15,118,33,110,11,29,34,109,13,2,2,11,11,11,13,14,22,13,7,6,2,6,21,29,13,13,2,2,2,5,2,5,2,6,2,5,2,11,13,13,11,11,13,2,1,11,13,16,21,29,7,11,11,11,6,2,2,6,1,1,1,12,14,6,2,1,1,1,1,2,6,1,1,1,6,1,1,1,1,1,1,1,1,1,1,1,1,6,7,2,2,6,1,26,10,12,10,1,1,1,1,1,1,5,2,1,1,2,2,2,2,6,1,2,2,2,10,2,2,2,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,1,1,1,2,1,1,1,1,1,2,1,2,1,2,1,6,1,5,2,2,11,11,6,6,6,6,6,7,13,11,7,6,10,10,2,2,1,1,2,9,5,5,2,6,9,2,9,2,2,2,2,2,11,2,6,43,67,155,78,28,13,167,67,16,7,13,22,50,198,200,200,199,199,195,200,204,178,204,201,30,175,204,201,198,204,199,200,200,200,200,200,200,198,198,199,194,198,179,198,202,194,198,157,
+2,2,6,2,2,2,2,5,12,11,13,13,13,11,5,2,5,2,6,11,13,11,7,13,11,11,2,7,11,17,29,30,24,11,7,7,6,2,2,2,7,23,16,16,22,36,45,30,116,145,109,18,16,18,24,11,2,2,13,29,13,22,30,47,119,32,36,34,33,109,109,114,111,109,32,17,13,13,111,20,110,13,18,109,20,11,2,1,11,15,15,10,16,24,13,13,6,2,6,13,16,21,14,2,6,12,2,2,2,5,1,2,2,2,13,13,7,11,14,17,2,1,7,15,17,16,13,11,11,11,11,11,2,6,1,2,1,1,14,11,2,5,0,1,1,1,2,2,2,2,41,2,2,6,1,1,2,1,1,1,1,1,1,2,11,7,35,40,2,60,67,2,10,2,1,1,2,1,1,1,1,2,2,1,2,6,9,2,2,11,6,2,2,2,2,2,0,1,1,1,0,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,2,2,6,1,2,2,2,11,6,6,11,8,11,11,13,2,2,10,11,2,2,1,1,2,5,2,5,2,2,2,5,5,2,2,5,6,65,78,65,167,199,179,177,199,194,170,202,198,195,176,195,199,203,179,198,179,200,198,179,200,195,199,200,200,200,204,196,200,200,198,200,198,204,200,200,198,200,199,199,198,198,194,198,198,198,198,179,74,
+1,1,2,2,5,2,6,5,13,14,13,10,11,13,2,2,11,2,11,7,11,7,13,11,13,13,2,11,11,14,32,33,29,110,105,15,2,2,6,7,16,29,16,17,22,22,22,34,126,146,114,18,8,8,24,8,11,6,6,14,29,16,13,34,34,46,17,34,33,24,33,118,114,108,109,15,2,7,122,111,111,11,22,22,24,11,6,0,13,11,15,15,22,22,13,6,2,2,13,13,13,29,7,2,2,2,5,6,2,2,5,2,2,13,7,7,29,17,29,21,2,2,13,16,16,14,13,13,8,13,13,11,2,1,2,6,1,1,13,7,2,2,1,1,1,1,2,13,6,0,2,1,6,1,2,0,2,0,2,2,2,2,2,11,2,21,38,6,1,40,51,6,2,1,1,1,1,1,1,1,2,1,1,2,1,2,2,6,1,5,6,11,2,2,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,6,1,5,1,1,1,1,1,1,1,1,1,1,1,2,2,2,6,2,5,2,2,5,2,6,6,6,7,11,11,11,8,2,11,11,13,2,11,2,1,5,2,2,2,2,2,2,29,175,7,66,190,75,2,169,179,194,169,171,194,173,171,194,194,194,173,179,194,173,179,194,179,179,198,198,179,198,198,179,196,199,199,199,200,198,200,199,200,200,203,200,198,200,202,196,198,179,198,179,198,198,179,198,177,179,131,
+1,1,5,2,2,5,11,6,7,13,7,11,7,10,6,5,7,2,2,11,7,7,13,13,7,7,2,13,11,16,34,36,46,119,116,11,6,2,6,29,16,30,16,22,11,106,110,114,126,150,115,8,8,22,19,31,31,2,16,30,30,32,22,22,37,109,14,33,31,33,109,111,111,109,111,11,11,29,111,122,109,6,6,110,111,11,0,2,11,16,15,22,30,13,21,11,6,6,7,14,22,30,2,5,5,5,7,2,2,2,6,2,5,13,13,14,17,29,29,14,5,1,2,13,13,29,14,13,15,13,11,6,6,2,6,1,1,1,14,13,1,1,1,1,1,2,6,5,2,6,2,2,2,64,76,1,1,1,1,1,1,1,2,11,2,12,2,2,72,12,9,1,2,1,1,1,1,1,1,1,1,9,5,2,2,5,2,2,6,6,7,2,5,2,2,5,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,5,2,2,2,2,2,6,1,6,6,11,6,6,11,6,7,7,2,6,8,11,13,6,2,2,2,2,2,6,2,6,21,168,179,168,173,179,158,66,177,173,171,171,177,169,194,177,179,179,177,194,173,194,179,179,179,194,179,198,179,202,195,179,200,198,199,179,199,199,200,199,196,198,200,200,196,199,199,195,198,198,198,198,198,202,179,198,179,198,179,74,
+1,1,2,2,6,1,11,6,13,13,13,11,7,7,2,10,11,6,2,13,13,13,13,11,13,7,2,7,14,18,37,22,110,132,120,11,2,13,16,34,18,37,29,23,106,138,106,136,138,146,113,6,13,20,15,24,122,6,22,18,29,29,22,29,34,33,14,17,31,34,114,114,116,106,111,29,3,29,109,125,109,6,14,126,117,13,2,0,11,17,22,16,11,7,11,2,2,2,13,16,30,30,2,2,5,5,5,12,2,5,2,2,13,11,7,14,23,29,16,2,2,5,2,13,15,14,17,13,17,5,11,13,7,6,1,2,1,2,13,1,2,1,1,1,2,2,2,13,6,2,2,2,5,1,1,1,2,1,1,1,1,1,7,13,2,6,2,2,5,1,2,5,1,5,1,1,1,1,1,1,1,1,2,5,2,2,2,1,2,10,10,13,2,5,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,6,1,2,1,1,1,1,1,1,2,6,1,5,2,5,2,2,2,2,11,11,11,6,11,6,11,6,6,7,6,2,6,5,2,2,1,6,5,2,11,2,155,171,162,194,171,168,177,177,171,169,194,168,168,171,177,169,194,171,177,194,194,177,194,194,173,179,198,194,195,179,198,198,179,196,198,199,198,179,198,199,200,199,199,200,198,200,196,199,195,198,198,179,198,179,199,179,198,179,194,74,
+1,2,2,5,2,2,10,6,13,11,10,5,11,5,2,13,13,2,11,13,7,13,7,14,21,7,2,13,16,22,46,16,46,126,106,6,2,7,7,29,16,32,15,132,119,126,124,144,140,152,19,6,8,19,22,18,21,2,29,22,22,30,17,14,30,24,13,17,110,109,109,111,109,109,109,15,11,13,108,132,116,6,110,126,122,13,2,11,14,22,45,2,5,13,2,13,2,7,13,29,32,21,1,2,6,2,2,2,2,2,2,2,21,7,13,29,16,23,2,1,2,2,2,13,13,13,14,11,11,8,13,13,6,2,2,6,2,2,2,5,6,1,1,1,2,5,2,13,7,6,1,2,7,6,2,5,5,1,1,1,1,2,13,11,2,2,2,2,1,1,2,9,2,1,1,1,1,1,1,1,1,2,1,2,10,5,5,2,2,10,7,2,2,2,2,2,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,2,5,1,2,1,1,1,1,5,2,1,2,2,6,1,2,5,2,5,2,6,2,13,6,11,13,11,11,11,2,2,13,2,2,2,6,6,2,2,11,66,171,194,162,168,169,194,171,171,171,177,168,171,171,171,175,171,169,194,168,173,168,171,179,194,194,179,198,179,194,198,179,202,195,194,198,198,179,198,202,179,198,200,199,199,199,199,199,199,198,199,179,202,198,198,179,198,202,179,179,74,
+1,5,2,2,1,2,5,5,10,11,7,10,7,5,5,21,11,2,5,13,13,13,14,13,13,7,6,13,14,32,43,17,48,106,33,11,6,13,11,30,29,16,8,106,132,138,149,140,138,153,19,6,8,126,114,33,11,2,7,16,36,17,29,22,34,15,22,22,34,33,109,114,119,33,24,8,6,13,109,109,44,2,119,123,114,17,29,2,21,30,11,1,2,7,6,7,7,12,13,21,32,11,2,2,2,2,6,2,11,2,6,5,7,7,7,29,22,16,0,2,2,2,11,13,13,17,13,8,6,14,11,13,6,1,6,1,7,2,13,2,2,1,1,1,2,2,2,14,7,2,1,2,13,1,1,2,6,2,5,2,1,1,11,7,11,6,2,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,6,2,5,2,2,5,2,11,6,2,2,6,12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,2,6,1,5,2,2,2,6,2,2,2,2,11,7,7,7,6,14,11,6,6,2,6,1,2,6,11,11,6,6,6,42,194,169,168,162,171,162,168,162,168,171,173,169,171,168,171,171,162,168,168,171,194,168,194,168,169,179,177,179,179,198,198,179,198,179,195,179,179,198,195,194,179,195,179,202,195,202,179,200,195,198,198,198,179,199,179,198,198,179,179,179,69,
+1,2,2,5,1,1,2,5,12,11,7,10,13,2,5,13,11,11,2,14,13,13,13,13,7,5,2,13,29,36,22,16,18,119,120,11,7,7,7,34,11,17,29,119,123,125,140,138,140,148,4,13,15,126,33,13,13,29,14,29,32,29,13,13,32,11,13,24,110,106,106,114,116,110,18,13,6,15,111,132,18,11,116,119,111,15,29,6,6,13,11,2,2,2,2,5,13,7,11,30,30,2,12,2,5,5,1,2,21,2,2,2,13,13,14,30,30,29,1,1,1,2,12,11,8,13,11,13,13,13,11,13,2,2,2,5,2,13,6,2,2,2,1,1,2,5,5,6,7,6,2,2,2,2,6,1,2,7,7,6,1,2,5,11,2,2,6,1,1,1,1,1,1,1,1,2,5,1,1,1,1,2,1,2,2,2,5,2,2,9,6,1,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,2,1,2,1,2,1,1,1,1,1,1,1,1,1,1,2,6,1,2,1,5,1,5,2,2,11,2,11,2,10,10,13,10,7,11,1,2,2,6,11,11,11,11,2,69,169,162,162,167,169,169,168,171,175,169,171,168,168,171,171,162,169,168,168,168,168,169,168,171,194,177,175,171,177,179,179,195,202,179,198,179,179,179,198,179,179,198,198,198,179,198,198,198,177,198,194,179,179,198,179,198,198,179,198,179,194,74,
+1,2,6,6,1,6,5,10,2,2,5,11,5,2,13,13,13,11,6,13,14,14,16,16,13,29,7,16,16,33,13,13,22,106,119,15,7,11,13,22,7,17,22,133,116,116,137,144,139,150,8,13,16,122,29,11,13,16,16,16,16,13,5,6,109,6,7,34,110,116,34,123,106,111,24,11,6,15,111,141,8,13,122,122,116,22,18,2,6,13,6,2,2,5,2,5,2,10,16,43,6,7,6,2,2,2,6,2,12,2,6,5,14,7,16,30,23,13,2,1,2,1,2,13,11,11,16,6,13,13,11,13,6,1,2,2,2,5,2,7,1,1,2,6,2,2,11,6,2,2,5,2,11,2,1,13,5,11,13,6,2,6,2,21,36,21,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,5,2,5,5,11,2,2,2,10,6,7,2,1,1,1,1,1,1,1,1,26,5,1,1,1,1,1,1,1,1,5,2,1,1,1,2,1,2,1,1,1,1,1,1,1,2,1,2,5,2,2,6,2,2,5,2,10,10,5,11,13,13,6,5,10,2,11,11,11,15,11,2,6,66,169,166,162,169,162,168,162,169,162,162,162,171,171,168,168,169,168,168,168,177,162,168,168,177,162,171,171,169,177,194,194,177,177,179,202,179,179,179,179,177,198,202,179,177,199,179,198,179,179,179,179,179,179,179,173,195,179,195,202,179,179,177,74,
+1,2,2,11,5,1,2,7,2,5,2,5,2,5,21,13,13,13,13,11,13,13,13,13,11,13,6,14,22,32,8,11,22,106,114,15,13,2,16,22,11,15,119,141,110,106,144,138,128,150,4,11,24,24,6,16,16,29,13,13,13,6,6,7,114,2,29,37,110,106,106,123,116,46,8,13,6,17,118,138,6,13,122,122,120,20,15,2,2,13,6,2,2,2,2,2,2,13,6,11,13,6,2,2,2,5,2,2,13,2,2,2,14,7,14,29,30,13,2,1,2,2,2,21,13,29,16,13,14,8,7,13,2,2,2,6,5,2,13,1,1,1,1,2,2,2,12,2,11,2,2,12,2,2,5,11,2,12,11,7,6,2,2,35,30,2,2,1,1,1,1,2,1,1,1,1,2,1,1,1,1,1,5,2,2,2,11,2,12,2,11,6,7,2,6,1,1,1,1,1,1,2,1,2,6,9,2,1,1,1,1,1,1,2,2,1,2,5,1,1,1,1,1,1,1,1,1,1,5,2,1,6,1,1,2,2,6,5,7,6,2,6,7,17,13,2,9,2,7,10,13,13,11,6,66,159,169,162,169,162,162,162,162,162,162,162,169,168,168,168,169,168,168,168,169,162,168,168,168,168,168,169,168,168,194,162,171,171,194,179,194,179,179,194,173,198,194,173,194,179,198,194,194,179,194,179,179,202,179,177,194,179,173,179,179,202,194,179,171,74,
+1,2,5,2,2,2,6,5,5,2,1,2,10,12,11,11,13,13,17,11,11,11,13,13,6,11,2,29,16,33,13,13,33,116,116,31,17,6,22,16,7,37,144,139,110,117,141,127,138,150,4,6,17,24,11,22,16,7,13,13,7,6,2,14,111,2,34,109,47,122,33,47,116,22,17,6,2,22,116,126,1,22,122,122,116,33,7,11,2,6,6,2,6,2,2,6,2,13,13,13,13,2,7,2,5,2,2,2,13,2,2,6,2,6,7,13,22,11,6,1,2,1,2,15,13,11,7,6,13,13,13,11,2,2,5,1,2,2,13,2,1,1,2,5,2,5,2,6,2,6,7,6,2,2,6,5,6,7,13,13,7,7,13,7,2,2,5,2,1,1,1,1,1,1,1,5,2,1,1,1,1,2,2,2,6,2,5,2,7,6,7,6,11,6,6,0,6,1,1,1,1,1,1,1,2,51,2,1,1,1,1,1,5,2,5,2,1,2,2,2,1,2,1,1,1,1,1,2,1,2,2,2,2,6,1,5,1,2,2,2,6,6,21,16,11,10,5,9,11,1,13,10,13,42,168,162,162,162,167,169,168,162,167,169,169,167,168,162,162,162,168,162,168,162,171,162,171,162,168,168,162,162,171,171,162,168,171,171,177,171,177,194,194,177,194,179,179,194,173,179,177,179,179,173,194,179,194,177,194,173,179,177,179,179,179,194,179,169,173,74,
+1,1,2,2,5,2,2,5,2,2,6,1,2,2,2,5,11,13,22,11,6,8,11,8,11,13,7,29,16,30,11,15,44,122,122,106,17,7,46,17,16,133,139,149,106,132,144,138,138,153,113,19,22,44,17,21,13,13,13,13,6,2,2,13,110,2,36,22,106,34,33,31,114,11,6,6,6,18,106,106,2,114,126,126,122,108,6,2,2,2,7,6,2,2,2,2,11,7,14,14,13,2,6,2,2,2,2,5,7,13,1,7,6,14,13,17,22,7,2,2,2,5,7,6,6,2,6,11,13,11,13,7,1,2,2,13,1,7,7,6,1,1,2,2,6,11,11,6,2,7,5,2,5,1,5,7,2,11,13,13,7,13,6,7,6,2,2,1,2,2,1,1,1,1,2,2,1,1,1,1,2,5,2,2,5,2,10,11,6,7,8,11,11,6,2,2,2,1,5,2,2,1,1,1,1,1,1,2,1,1,1,1,2,1,2,2,2,5,2,2,5,1,2,1,1,1,1,1,2,5,2,5,2,2,2,6,2,5,11,2,6,11,14,15,13,2,5,11,11,5,15,13,15,69,162,162,162,162,162,169,162,162,162,162,171,162,168,162,168,162,162,168,162,162,162,168,162,168,168,162,162,171,162,171,169,194,160,171,162,194,171,177,171,194,169,179,194,177,179,194,194,173,173,194,179,179,171,179,171,179,177,194,173,179,179,179,173,171,171,74,
+2,5,2,5,10,27,21,7,2,5,2,6,2,5,2,2,13,11,16,11,6,13,13,13,13,11,6,17,16,22,13,17,34,119,120,111,17,6,109,18,30,130,144,133,119,132,144,149,142,150,115,147,113,13,13,13,13,16,29,14,7,6,6,22,8,13,116,24,116,110,46,139,108,8,13,2,15,18,46,6,11,123,138,132,123,109,11,6,6,6,11,6,2,6,6,2,11,7,17,15,13,2,2,6,2,13,2,2,7,6,6,2,6,7,7,22,32,6,2,2,1,2,2,7,2,6,11,13,11,7,13,6,1,2,6,2,5,11,7,2,1,2,2,2,13,13,14,8,2,7,6,2,2,2,5,2,13,13,11,13,11,11,14,2,5,2,2,5,2,5,1,1,2,1,1,1,1,1,2,1,2,1,5,2,2,7,13,11,11,13,11,11,17,6,2,6,1,1,1,0,2,1,6,0,1,1,2,51,2,0,1,1,2,6,1,5,1,1,1,2,2,5,1,2,1,1,1,1,1,2,2,2,2,5,2,2,2,2,9,13,6,14,13,21,26,10,27,11,11,6,11,49,166,169,162,159,162,162,162,162,162,168,169,162,168,168,160,175,169,162,168,162,162,168,162,168,162,169,162,168,168,162,171,162,194,162,194,171,177,162,168,171,169,194,171,173,177,171,177,171,179,179,177,194,179,179,194,179,177,179,179,194,173,179,173,171,177,171,162,74,
+2,2,5,2,5,5,1,5,5,11,1,1,2,2,6,2,11,13,29,15,11,15,15,13,11,11,6,16,29,16,8,22,36,116,123,122,8,11,119,122,37,133,149,137,133,132,132,136,149,150,113,150,115,6,11,11,17,16,13,7,6,1,6,18,2,32,111,46,119,138,34,133,105,13,18,6,29,24,15,2,14,144,136,116,126,111,15,6,11,1,13,11,2,2,11,7,13,11,23,17,11,2,2,2,7,2,2,2,13,7,6,7,2,7,13,22,17,6,2,2,1,2,7,2,2,13,7,13,13,11,13,2,2,2,13,2,2,13,6,2,2,2,2,6,7,13,6,14,7,6,2,2,2,2,5,6,7,13,13,11,11,7,11,2,2,6,2,2,1,2,1,1,1,2,1,1,1,1,1,1,1,2,2,5,11,11,11,11,6,11,13,11,8,11,2,2,2,2,72,72,73,27,38,10,1,1,2,27,25,10,1,1,1,2,2,2,6,2,5,2,6,1,1,1,1,1,1,1,2,6,1,5,2,2,2,11,11,10,11,2,21,7,13,7,10,5,10,11,40,155,168,168,162,159,162,162,169,159,162,162,168,162,168,168,168,162,171,169,162,162,168,169,162,162,168,168,168,168,168,168,162,171,162,168,162,168,169,169,162,171,162,167,168,168,168,171,168,168,171,169,171,179,177,194,173,169,179,173,194,169,173,179,194,179,194,173,194,173,162,74,
+5,1,1,2,5,2,6,10,7,13,2,1,5,2,2,2,2,13,17,22,6,11,15,13,11,11,6,16,17,17,6,33,109,132,116,125,17,6,123,122,116,132,130,133,126,126,133,144,150,153,115,150,114,2,6,6,7,7,6,2,6,6,2,7,2,106,22,114,132,123,34,122,114,33,33,2,33,109,15,2,22,138,140,150,126,29,8,2,2,2,11,11,2,2,5,11,13,13,21,2,2,2,6,2,7,2,6,2,1,11,2,6,5,7,13,22,11,11,6,1,2,2,6,7,12,2,6,13,13,13,13,6,6,7,5,2,2,2,12,2,1,2,7,7,7,6,13,7,7,13,2,5,1,1,12,6,7,11,13,7,6,11,6,2,5,2,2,5,2,2,5,2,1,1,1,1,1,1,1,1,2,5,2,2,2,13,11,11,6,13,11,17,15,11,6,2,5,1,9,25,9,38,51,38,51,10,1,9,25,9,1,5,2,2,1,5,2,2,2,2,2,2,1,1,2,1,1,2,5,2,2,2,5,2,2,11,10,7,11,2,11,13,10,10,28,11,17,43,169,162,160,162,162,162,162,162,160,169,162,162,162,162,167,169,169,162,162,162,168,168,169,169,169,169,169,169,168,168,168,168,162,169,162,162,169,162,167,169,169,162,171,162,162,162,168,169,162,168,169,173,162,173,179,177,194,194,171,177,171,177,194,169,179,173,179,171,173,171,168,74,
+2,6,2,5,5,1,2,5,5,2,1,2,2,5,2,5,6,13,22,15,11,17,8,7,13,11,16,43,17,29,13,34,34,119,110,132,18,11,117,119,34,130,132,133,150,123,133,144,150,152,143,148,105,6,6,6,6,6,6,6,2,6,6,6,16,123,18,132,114,123,144,125,114,34,106,6,34,114,15,2,34,148,144,124,114,8,11,2,2,6,16,6,2,6,7,13,11,7,2,6,7,6,1,7,6,2,13,6,13,7,5,7,6,13,12,8,13,6,2,6,2,1,7,2,2,2,11,13,13,16,7,13,6,2,7,6,2,2,13,1,2,2,13,11,6,8,7,7,7,7,2,2,2,1,5,7,7,10,7,11,11,11,6,2,2,2,5,2,2,6,2,5,1,1,1,1,2,1,1,2,5,2,2,5,2,11,11,6,13,8,13,8,17,8,2,2,2,2,1,2,27,10,1,1,1,1,1,10,1,1,2,2,5,2,2,2,2,2,5,2,2,5,2,2,5,2,1,2,2,2,1,6,2,5,2,6,10,9,11,6,13,10,21,13,14,11,22,169,160,160,162,160,162,169,167,160,167,160,168,162,162,171,162,168,162,168,168,169,169,162,168,168,168,169,162,168,168,171,162,168,162,162,162,162,162,162,162,162,171,169,162,162,162,162,167,171,162,171,162,171,171,173,171,169,177,194,179,177,171,169,177,173,194,173,173,194,171,173,169,74,
+2,1,2,6,2,2,5,2,5,2,1,5,2,6,1,2,7,13,17,15,5,13,15,8,13,13,36,109,32,16,16,47,46,106,110,126,31,13,106,132,129,123,136,130,136,119,130,139,146,153,143,143,113,11,17,8,11,6,6,6,6,2,6,2,110,116,31,123,126,140,144,136,126,116,108,7,32,110,31,2,106,138,138,122,110,17,2,6,2,21,17,11,1,2,11,16,13,11,6,7,7,2,2,2,7,7,7,2,6,2,13,1,7,13,8,13,7,11,6,2,6,6,2,2,13,7,13,14,11,8,6,14,6,1,12,1,2,13,6,7,2,5,7,13,7,13,13,8,6,2,2,2,2,2,2,2,12,11,6,13,8,17,6,2,2,5,2,2,6,1,1,2,2,1,1,1,1,1,1,1,2,2,5,2,5,11,13,15,13,17,11,13,17,11,6,1,2,5,2,1,1,1,5,1,2,2,1,1,1,2,5,2,2,2,1,6,5,1,2,2,5,2,5,2,2,2,1,2,6,1,1,2,2,2,2,5,2,2,5,11,10,6,21,28,15,64,155,162,169,166,162,162,162,167,169,162,168,162,162,169,162,162,168,162,168,162,169,169,171,168,168,171,162,169,171,168,171,168,168,162,162,171,162,162,162,162,162,168,169,162,171,162,167,169,162,162,167,162,168,162,175,169,171,171,177,194,169,173,171,173,171,177,171,173,171,169,177,194,162,74,
+1,2,1,2,2,5,5,1,6,2,1,2,2,2,2,6,13,11,15,33,8,14,14,13,13,16,109,33,31,13,29,34,34,126,31,126,109,15,46,132,119,137,137,141,120,132,117,133,153,150,150,142,113,17,122,17,6,6,7,6,2,2,7,6,123,122,106,126,116,139,138,122,122,119,111,16,109,132,109,6,126,138,138,126,114,24,19,15,18,24,18,2,6,7,13,13,13,2,2,7,2,2,6,2,6,11,7,6,7,2,2,13,6,7,11,13,7,13,6,2,2,13,1,6,2,7,11,13,13,11,11,2,2,2,13,2,5,11,7,13,17,11,13,11,6,7,7,7,6,6,2,1,2,2,2,13,11,13,13,11,7,17,7,2,6,2,2,5,1,1,1,1,1,2,9,2,1,1,1,5,1,6,1,6,2,10,11,15,17,15,8,17,17,15,2,2,2,2,2,60,5,2,1,9,38,25,1,6,1,1,2,6,2,5,1,2,2,2,5,2,6,5,2,10,2,13,11,2,2,6,2,2,5,2,5,2,5,2,2,13,15,157,168,169,162,169,160,162,160,169,162,168,162,162,162,162,162,162,162,162,167,162,162,168,168,168,171,171,171,162,169,177,162,194,162,168,168,162,168,169,162,162,162,168,167,169,162,167,162,162,162,162,168,162,168,168,162,171,162,171,162,168,168,171,171,169,194,177,173,171,171,169,179,173,171,171,177,169,168,74,
+1,1,5,2,6,2,2,5,1,2,1,2,5,2,5,2,13,13,32,46,17,21,13,13,7,22,32,22,17,13,14,34,106,124,22,123,111,8,120,110,106,151,114,139,144,132,132,132,148,153,150,115,114,17,114,13,6,6,7,2,6,2,2,12,140,108,116,132,144,151,150,144,137,119,110,16,36,106,18,13,137,138,138,126,110,18,22,6,17,22,11,13,15,13,13,2,2,2,11,6,2,6,2,2,7,7,11,2,6,2,11,7,7,7,16,11,7,11,6,6,2,2,13,1,5,13,7,6,6,6,1,6,1,2,7,2,2,13,11,14,11,13,13,7,6,7,13,7,7,5,2,1,1,2,6,13,7,11,13,7,17,8,7,2,2,5,2,2,5,2,1,1,1,2,2,1,2,1,1,1,1,2,5,2,2,10,13,15,18,29,11,15,17,15,6,2,2,5,2,2,1,2,1,2,2,0,1,1,1,6,5,1,2,2,6,2,5,2,1,2,5,2,10,11,7,13,13,11,6,2,2,25,2,2,2,2,9,2,11,78,162,161,160,162,162,162,160,167,169,162,162,162,167,169,162,162,167,169,162,162,162,162,168,162,162,171,171,168,169,169,168,171,171,169,168,168,169,168,171,167,169,162,162,162,162,162,159,169,162,162,162,162,167,162,162,162,168,162,162,171,162,168,169,168,194,169,177,171,169,179,173,194,168,177,171,173,168,171,168,74,
+2,1,2,1,2,2,6,2,2,1,1,1,2,2,2,2,11,13,20,36,33,10,11,11,13,22,33,36,32,13,30,24,37,123,8,119,114,33,119,34,119,145,114,122,137,136,133,139,153,146,142,127,18,33,18,6,2,6,2,2,2,6,2,34,24,129,138,144,149,146,153,138,119,120,8,36,15,33,8,22,144,138,147,126,114,6,18,13,13,16,13,117,29,11,13,11,2,13,7,7,6,2,7,14,7,7,13,1,12,6,10,13,10,11,13,13,11,11,13,7,7,2,2,2,13,13,7,7,2,6,13,1,5,10,13,1,10,7,13,13,13,7,11,7,2,7,2,13,2,2,6,1,1,1,12,7,7,7,7,13,13,17,2,6,2,2,2,5,2,1,1,1,1,2,2,5,1,1,1,1,1,7,2,2,5,11,11,17,15,8,13,17,31,15,2,2,2,2,5,51,11,1,1,1,1,1,1,1,2,2,2,2,5,2,2,2,2,6,1,2,10,7,13,13,11,13,13,21,13,6,2,2,2,2,6,10,5,10,11,87,160,159,162,160,159,162,162,162,162,167,169,162,162,162,162,168,162,168,168,169,169,169,162,162,162,162,168,168,168,169,162,168,168,168,162,167,168,162,162,162,162,167,169,162,162,162,162,162,167,171,162,168,162,162,175,162,162,162,162,162,168,168,162,168,169,171,171,169,194,173,194,171,177,171,173,173,171,173,168,74,
+1,2,1,2,1,6,1,2,5,2,1,5,2,2,5,2,11,13,22,18,110,6,13,16,11,32,37,34,36,13,30,16,123,125,29,37,34,43,136,149,151,138,144,132,138,139,132,133,149,152,143,143,113,18,18,11,6,2,6,6,2,7,6,37,24,144,144,138,150,152,150,136,137,116,5,126,11,13,2,106,146,153,144,123,8,13,13,17,17,22,11,14,6,2,13,2,6,6,11,11,7,6,7,29,13,7,2,6,5,2,12,13,11,7,13,17,7,7,2,2,6,6,12,2,12,11,13,6,2,13,2,1,2,10,2,2,12,13,13,13,11,13,7,6,7,7,16,16,11,2,2,1,2,1,7,11,13,13,13,7,11,8,2,2,2,5,2,2,2,1,5,1,1,1,2,1,1,1,1,5,1,5,2,6,1,5,13,13,15,15,15,30,29,6,6,2,2,1,9,12,10,1,1,1,1,1,1,1,2,5,1,6,2,2,5,2,5,1,12,1,5,10,7,11,7,11,21,24,111,46,131,131,11,2,2,9,11,6,29,163,162,162,162,162,162,162,162,162,162,162,162,162,162,167,169,162,162,171,167,168,168,169,169,162,168,162,171,168,168,168,168,168,169,168,168,162,162,162,162,162,162,168,162,162,167,169,162,162,162,162,162,168,162,162,162,162,162,162,162,162,168,169,168,173,171,173,173,194,169,194,177,171,173,171,173,171,169,177,169,74,
+2,5,1,2,1,2,2,10,2,1,2,2,2,6,2,12,1,14,36,114,119,6,21,29,14,29,34,45,17,29,23,45,132,122,33,31,44,132,122,132,183,138,149,123,147,132,132,138,154,145,150,146,127,20,31,6,6,2,2,2,6,1,2,33,24,144,144,149,149,144,147,139,137,116,16,31,8,8,11,136,144,144,123,122,11,14,14,29,22,16,11,2,2,2,2,40,41,41,40,27,40,73,73,49,2,2,2,2,6,2,11,7,13,13,11,6,11,6,2,2,2,5,2,2,13,13,7,7,5,2,2,2,2,5,2,2,13,13,13,13,11,6,7,13,6,7,15,6,6,2,2,2,1,2,7,11,13,13,6,6,11,17,2,2,6,2,2,5,1,2,2,9,2,2,2,1,1,1,1,2,1,2,5,1,2,5,11,8,17,15,18,30,30,11,2,38,6,1,1,1,1,1,5,2,2,1,1,2,2,2,6,1,2,5,2,2,2,6,10,2,5,9,13,13,26,29,120,45,180,173,198,202,30,2,5,2,2,42,156,162,162,161,168,168,162,162,168,168,169,162,169,162,168,162,168,168,162,162,162,162,167,169,169,162,162,162,162,162,168,169,168,162,168,162,162,169,162,162,167,162,162,162,162,162,162,162,167,169,162,162,162,162,168,162,162,162,162,168,162,169,171,171,162,177,171,171,177,171,177,177,173,171,177,173,171,173,171,171,171,74,
+2,2,5,2,1,5,5,25,2,1,2,5,2,2,11,7,13,30,34,46,109,13,16,22,15,22,46,34,22,29,32,30,106,140,33,110,18,126,114,151,153,126,126,48,150,140,119,139,184,146,154,146,145,24,114,19,7,6,6,2,6,2,2,32,109,139,144,149,144,150,150,137,139,109,22,33,21,117,6,126,126,138,136,114,30,11,7,13,30,16,7,11,2,5,2,2,6,1,6,2,2,1,2,5,2,2,5,2,2,2,2,11,13,13,11,13,8,2,2,6,2,2,6,2,12,13,11,2,7,2,2,2,2,5,2,2,12,7,7,2,7,11,13,13,6,11,7,6,6,2,6,1,2,13,7,13,13,13,15,29,16,29,7,2,2,2,2,6,2,1,2,1,1,1,2,2,1,1,5,2,1,2,10,2,5,11,6,17,15,17,33,17,36,2,2,2,2,2,6,1,1,2,6,57,21,5,1,2,5,2,2,2,5,2,5,2,5,10,2,5,10,10,12,14,7,117,132,129,194,179,171,179,159,2,65,41,159,162,160,171,160,162,168,162,162,169,168,169,168,168,162,168,169,162,162,167,162,162,168,168,162,171,162,168,168,162,169,162,171,160,162,162,162,162,162,167,162,160,162,162,168,162,167,171,169,162,168,162,169,168,169,162,162,168,168,162,168,169,171,171,171,173,171,173,169,171,179,173,171,171,194,171,173,171,173,171,171,173,162,74,
+2,5,2,2,1,2,2,2,1,1,2,2,5,2,7,13,21,29,22,34,33,8,29,32,16,36,117,46,29,22,17,22,120,132,114,116,120,110,144,153,183,144,120,117,153,144,106,133,150,153,153,146,150,115,33,8,6,2,2,6,6,6,2,117,126,133,147,150,149,144,147,139,144,31,22,34,18,109,1,126,126,128,125,126,109,24,29,6,2,6,11,13,2,2,1,2,2,6,1,2,6,2,2,2,1,1,2,1,5,2,5,11,11,11,8,15,13,6,2,2,2,2,7,2,13,11,7,7,7,13,1,1,2,10,2,2,21,11,11,6,13,13,14,11,11,13,11,11,8,2,6,2,2,11,7,13,13,11,18,29,18,20,11,6,2,5,2,2,2,6,1,1,1,1,1,2,2,1,2,1,5,2,2,5,2,2,11,8,15,29,31,24,17,6,2,6,6,2,2,1,1,1,2,1,1,1,1,2,2,5,2,6,2,2,2,2,2,21,2,6,5,1,21,164,18,119,141,176,179,179,173,173,171,194,173,173,169,171,162,162,162,162,162,171,169,171,169,162,168,169,168,168,162,162,162,168,162,162,162,168,162,168,168,168,168,162,171,162,167,169,168,162,169,160,162,162,160,167,169,169,171,169,171,162,171,177,168,177,171,162,168,171,162,173,162,171,171,173,194,171,194,179,171,179,194,177,171,177,194,173,179,194,173,173,171,177,171,171,169,74,
+2,2,2,5,1,2,5,1,1,1,5,2,2,2,13,13,13,16,30,43,17,13,16,46,17,29,23,45,16,30,46,106,110,126,126,132,109,106,149,183,144,144,126,45,152,149,106,144,153,183,153,152,142,19,108,8,11,6,2,6,2,2,6,37,110,138,144,149,151,150,146,123,136,15,29,24,24,109,13,144,122,127,125,122,24,22,11,2,2,2,8,13,2,6,2,5,7,2,11,2,2,2,6,1,1,2,5,1,2,2,2,6,13,8,15,22,15,2,6,2,2,13,10,13,13,7,6,6,7,2,1,1,2,13,2,2,13,11,2,11,14,15,11,7,8,17,11,11,13,2,6,2,2,13,5,11,11,13,24,31,108,109,6,2,2,2,2,5,1,1,2,2,12,1,2,2,5,5,2,2,6,1,5,2,5,2,11,15,15,17,33,24,34,15,6,6,2,11,6,2,2,1,1,2,1,6,1,2,6,1,2,2,2,2,5,2,2,21,13,7,6,68,202,198,176,176,179,179,179,179,179,169,173,171,171,168,171,162,162,162,168,169,162,162,171,162,169,162,171,162,168,168,169,168,168,168,162,162,168,171,162,168,169,169,162,171,162,162,168,162,162,168,162,160,169,162,162,162,168,168,168,171,168,169,194,168,171,171,173,173,171,179,171,171,171,173,194,173,179,179,179,173,194,173,179,179,179,194,173,194,173,179,179,179,194,169,179,173,169,74,
+2,6,5,1,2,1,6,2,1,1,2,2,6,2,21,13,13,14,31,34,29,7,33,37,22,17,29,32,22,106,120,116,122,126,132,138,126,119,153,184,141,144,140,36,154,144,117,149,153,154,153,154,127,34,20,15,11,6,6,6,6,2,2,29,24,150,151,144,139,146,138,138,122,11,16,24,18,24,22,145,142,122,140,20,31,17,13,2,5,2,15,17,2,2,2,2,5,2,7,11,2,2,2,1,1,1,1,1,2,5,2,7,15,13,15,17,13,6,6,2,2,10,7,11,13,10,13,5,11,6,2,0,2,13,2,11,11,13,13,11,7,13,13,11,14,11,8,13,11,6,2,6,2,13,13,21,17,13,18,24,33,24,2,2,2,6,2,2,5,1,2,9,9,1,1,1,1,2,2,1,2,2,6,1,2,11,13,17,22,30,109,24,15,36,11,7,13,110,16,22,2,1,2,2,6,1,2,6,1,11,2,2,6,2,2,6,5,29,30,21,78,198,198,179,179,202,179,171,179,171,179,173,171,173,168,194,162,168,168,168,168,169,162,171,171,169,171,177,162,171,162,169,168,168,168,162,162,167,171,162,168,168,162,168,162,171,162,169,168,162,162,168,168,162,162,162,162,162,168,168,169,173,162,171,171,173,171,173,171,179,179,194,173,179,179,194,179,177,179,179,179,179,202,179,179,179,194,179,202,179,179,179,194,179,179,179,179,171,169,74,
+2,2,6,2,6,1,2,1,2,5,2,5,1,2,14,16,16,32,46,30,16,7,117,130,114,11,16,109,24,106,33,106,126,126,122,141,126,147,153,151,139,149,128,23,154,151,153,150,154,153,152,152,143,17,24,105,26,6,2,11,2,2,6,7,24,149,144,144,144,144,126,138,34,6,17,17,22,6,24,138,143,128,126,46,33,29,11,6,2,11,8,17,11,2,6,2,2,2,13,6,2,2,5,1,1,1,1,2,6,2,13,16,17,15,15,13,6,2,2,2,7,13,6,14,13,8,2,13,13,2,6,1,1,13,2,13,11,11,2,11,13,14,14,13,13,11,17,15,15,13,2,2,15,21,13,21,29,22,29,18,109,17,11,6,2,2,2,12,9,2,2,1,1,1,1,2,5,2,1,2,5,2,2,2,6,5,13,29,33,109,109,31,13,30,109,33,127,106,114,22,1,2,12,5,21,36,2,2,2,11,6,2,2,2,2,2,12,11,30,196,198,179,179,198,179,179,179,194,179,179,171,179,171,173,171,169,171,162,168,168,168,162,194,162,169,171,171,171,171,171,171,162,168,168,168,168,162,162,168,168,171,162,171,169,162,168,168,168,168,168,168,162,169,168,162,167,169,169,162,171,194,171,173,171,171,171,194,169,179,179,179,198,179,195,179,179,177,179,179,194,179,179,195,202,195,173,179,198,179,198,198,173,198,198,173,198,173,179,179,74,
+2,7,32,17,8,2,5,2,1,2,2,2,6,7,29,13,36,45,22,36,24,12,117,132,29,2,22,34,34,110,31,122,126,138,122,123,149,133,139,139,141,144,140,36,153,150,154,186,153,153,152,150,143,20,20,127,18,11,2,2,11,6,2,13,22,123,122,138,144,145,141,126,18,11,11,22,24,3,110,151,144,128,123,32,31,11,2,2,2,13,15,17,6,2,1,2,13,2,7,2,5,2,2,1,1,1,2,1,2,2,15,8,13,15,13,6,11,6,7,6,6,13,7,16,16,13,11,13,11,2,2,1,6,13,13,6,13,7,2,21,21,29,13,11,11,15,17,15,29,11,7,13,14,15,13,13,13,18,22,34,33,6,6,2,6,6,2,2,5,1,1,1,1,1,2,5,2,5,2,1,2,2,5,2,2,2,13,13,34,44,108,18,13,119,19,114,115,47,136,133,11,6,9,11,29,18,11,11,2,11,2,6,2,6,2,2,15,24,200,179,179,179,179,179,179,179,179,179,179,179,179,179,171,179,171,173,171,171,171,171,171,171,171,169,177,168,173,168,194,168,194,168,168,169,169,162,168,169,168,162,171,168,169,168,169,171,171,171,162,169,162,171,169,162,162,162,168,162,168,171,171,169,179,179,177,179,194,173,194,179,194,179,195,198,179,179,179,198,202,194,198,198,179,198,198,198,179,179,179,179,198,195,198,202,198,198,198,179,179,69,
+2,13,22,114,33,15,16,11,2,6,9,2,2,12,36,30,47,16,21,33,29,18,47,46,11,6,29,17,18,36,24,122,138,144,109,130,110,136,149,122,123,132,148,24,154,183,186,154,183,153,153,153,142,18,24,127,108,6,1,6,6,2,2,6,114,126,122,136,144,138,144,132,17,6,6,17,110,8,137,150,140,139,33,30,33,6,2,2,5,15,11,6,6,2,2,2,2,2,12,2,2,2,5,1,1,2,5,2,5,2,21,16,29,17,11,11,17,6,8,7,13,13,11,13,16,7,11,13,13,7,1,1,7,21,21,29,17,7,10,13,13,13,11,29,32,32,15,22,15,11,11,13,14,7,13,21,29,17,33,116,116,36,34,34,13,22,2,2,2,1,2,1,1,1,1,2,2,1,1,5,2,5,2,2,5,10,13,13,33,109,33,15,13,109,32,46,33,46,117,133,11,5,10,1,11,11,119,109,1,2,2,11,6,2,29,29,16,179,179,179,179,179,179,194,179,179,179,194,179,179,179,179,179,173,171,171,171,173,168,171,173,173,171,171,169,171,194,171,171,171,168,168,168,169,171,168,169,162,169,168,169,171,162,168,168,169,162,171,171,194,162,171,162,168,162,162,167,171,162,168,171,179,173,179,179,179,179,195,179,198,179,199,198,195,198,179,198,198,179,195,199,196,198,195,198,195,198,196,198,198,198,203,203,198,200,203,195,198,179,74,
+1,2,29,34,34,22,17,22,2,2,2,6,1,7,29,30,49,2,14,34,22,18,21,22,8,13,21,22,22,16,33,116,144,144,18,116,106,149,123,146,140,149,154,24,183,153,183,154,153,153,153,153,128,10,18,114,142,11,2,2,11,2,6,6,110,116,126,145,145,150,138,124,6,11,6,30,123,8,138,137,138,119,33,16,13,2,5,2,13,33,11,2,11,6,2,2,6,1,15,11,6,2,2,1,2,5,2,2,2,2,12,16,13,17,11,7,6,6,7,6,7,16,11,13,30,11,13,16,21,11,1,1,13,16,29,29,16,11,2,13,14,29,14,22,30,16,22,16,11,11,13,13,13,13,14,14,14,33,132,125,120,34,13,126,122,138,2,2,2,1,1,2,5,1,1,2,5,2,2,1,2,2,5,2,2,6,13,21,110,20,33,8,17,117,109,116,32,45,47,133,114,10,121,119,10,26,132,70,11,6,2,6,11,8,32,30,194,195,179,179,179,194,202,179,194,198,179,179,179,169,179,173,179,171,171,173,173,171,173,171,171,173,171,169,171,162,171,162,168,168,168,162,162,162,162,168,168,168,169,162,194,161,173,171,171,169,177,162,194,168,169,194,171,169,168,168,162,162,162,194,171,169,194,194,179,179,198,179,198,199,196,199,199,199,199,198,199,199,196,199,199,196,199,199,199,199,198,198,203,200,198,204,201,200,204,200,195,198,198,131,
+2,6,21,36,21,6,18,109,15,2,6,1,12,12,13,16,13,11,6,16,18,30,33,17,13,13,11,16,16,13,34,149,138,34,122,149,116,138,138,186,141,186,183,110,185,151,153,153,154,153,153,146,142,8,122,150,125,2,2,11,6,6,11,8,110,144,150,143,146,146,122,24,2,11,11,24,114,22,119,149,123,106,33,18,5,2,2,11,8,110,15,29,106,6,2,2,2,11,13,14,13,6,2,6,2,2,2,6,2,7,22,13,18,29,6,6,6,7,7,13,6,16,11,13,18,1,21,17,13,6,2,1,13,16,29,16,17,7,14,21,29,16,21,29,18,22,22,17,33,8,13,13,13,13,14,29,29,30,125,111,15,11,20,145,126,136,2,2,2,2,5,2,2,2,1,6,1,2,6,1,6,2,2,5,2,2,21,29,117,37,22,11,16,29,36,33,43,22,109,124,21,2,132,37,6,2,182,204,74,11,6,11,20,180,198,203,198,198,179,179,179,179,179,179,179,179,179,194,179,194,169,179,179,194,173,194,169,173,173,171,194,169,173,173,171,171,169,171,168,162,168,162,160,162,168,162,175,169,169,171,171,169,194,168,173,171,169,171,173,171,173,171,169,171,168,168,169,194,169,171,162,194,173,179,179,179,195,179,198,198,196,199,199,200,199,199,195,199,203,203,199,203,199,196,199,200,200,200,200,204,200,198,204,204,200,204,198,203,196,74,
+2,2,10,11,1,13,122,114,33,11,2,1,2,6,36,16,13,14,13,7,29,24,22,43,17,13,11,17,16,13,37,140,126,149,149,138,119,149,123,153,152,153,150,24,130,149,153,152,153,153,152,150,142,116,125,128,16,2,2,2,2,6,6,6,116,150,150,143,143,125,136,17,2,11,22,33,18,15,129,144,123,116,33,11,2,6,2,7,13,110,18,13,15,11,16,12,6,7,13,14,14,17,1,1,2,2,11,2,2,29,16,16,22,11,6,7,13,11,13,6,13,22,11,22,17,1,21,29,17,6,2,1,13,29,17,33,29,13,13,16,29,30,21,29,16,30,15,29,17,11,17,14,13,14,29,16,21,18,116,114,3,6,138,127,126,110,6,2,5,1,2,2,5,2,2,2,2,6,1,2,2,2,2,2,2,5,10,29,106,114,106,2,21,68,29,50,106,46,133,188,6,7,29,16,117,130,203,203,172,7,30,130,180,199,198,198,179,198,195,179,179,179,179,179,179,179,179,179,171,171,194,171,173,171,194,179,171,171,173,194,194,179,171,169,173,171,168,162,171,162,162,171,162,162,171,162,171,162,171,168,171,173,173,171,173,168,171,173,173,171,173,171,171,171,169,168,168,171,169,168,171,171,177,179,179,194,173,195,179,196,199,199,199,199,199,199,199,199,199,199,199,200,198,200,200,203,198,204,198,196,204,200,204,204,201,200,200,195,199,74,
+2,5,0,2,1,12,106,111,109,29,2,5,2,7,16,11,13,11,13,11,22,33,22,29,13,10,22,46,13,17,36,119,129,149,140,139,138,149,132,149,153,150,147,16,47,133,153,154,152,153,153,153,125,115,122,109,2,6,2,2,11,6,6,6,34,144,128,128,142,138,125,6,13,24,116,120,125,8,22,22,123,125,8,6,2,2,2,13,2,22,29,3,22,16,17,2,6,7,14,29,13,17,6,6,2,2,2,2,6,30,14,17,22,11,7,11,13,13,13,13,13,20,29,32,13,1,13,22,17,17,2,2,21,22,32,30,31,11,13,29,22,16,30,16,16,29,15,17,11,2,21,21,11,13,16,16,16,24,33,125,6,113,145,126,147,119,2,2,2,2,6,2,2,5,2,13,13,2,5,11,2,6,2,2,6,2,12,29,32,122,125,6,16,66,116,141,29,21,106,6,15,43,15,47,47,195,198,202,198,131,47,141,176,198,179,200,202,198,179,198,198,179,202,179,179,179,179,179,171,171,171,171,173,171,171,171,194,171,179,179,179,179,179,173,171,173,162,168,168,162,162,162,162,162,162,162,168,162,168,171,171,194,169,173,194,177,171,177,171,179,177,173,171,173,171,171,171,171,171,179,177,179,194,179,179,179,179,179,173,198,195,195,195,199,195,199,199,198,198,199,196,200,198,204,200,200,200,204,201,200,204,204,204,195,204,204,204,204,196,74,
+2,2,5,1,2,7,34,109,108,108,11,2,2,5,11,1,6,2,7,13,16,37,31,13,12,16,29,13,33,106,141,122,120,149,18,106,119,147,129,152,183,152,144,8,22,183,153,154,153,153,153,150,125,138,111,11,2,2,2,2,7,6,6,11,34,143,128,138,128,126,125,17,22,119,122,138,126,11,6,7,136,111,11,6,2,2,2,13,11,18,18,22,11,15,11,2,7,11,13,13,13,6,7,21,11,2,2,11,7,18,15,24,30,2,13,7,11,13,13,11,13,16,30,37,11,1,2,22,18,15,6,2,16,30,22,32,31,11,7,13,17,29,18,29,16,17,30,22,13,11,21,17,6,21,29,29,29,17,34,111,120,140,127,149,144,144,8,2,6,2,2,6,2,2,2,15,11,2,34,37,36,7,13,11,2,2,11,36,34,120,123,121,170,48,124,141,106,4,15,106,11,17,18,106,200,202,195,179,198,179,8,175,198,199,198,179,200,179,198,198,179,179,198,179,198,179,179,179,179,171,171,173,169,179,173,179,174,179,179,179,169,179,173,171,177,171,171,171,162,168,168,162,166,161,162,162,162,171,160,168,168,171,169,194,169,171,177,169,194,179,179,194,179,169,179,169,171,173,173,168,171,194,179,179,194,179,175,179,194,173,198,199,199,200,199,199,195,200,200,198,200,198,204,200,204,201,200,200,204,201,201,195,204,204,200,201,204,201,204,131,
+2,5,2,1,1,12,32,37,111,109,18,2,6,26,2,5,1,5,13,15,16,31,31,16,12,16,11,23,130,117,150,148,37,30,8,47,141,132,37,123,144,154,153,8,36,150,147,153,154,184,150,147,125,125,8,11,2,6,2,2,6,6,6,6,138,143,125,127,126,114,122,6,36,132,139,122,24,2,11,11,126,19,6,11,6,2,11,16,11,16,24,16,15,11,2,2,21,13,21,16,22,6,17,6,13,2,2,12,16,32,30,46,13,2,12,11,6,11,7,21,22,17,29,33,1,1,1,13,24,2,13,11,13,31,32,34,31,7,13,16,22,30,17,30,15,17,15,31,15,2,14,29,11,16,30,22,22,46,110,18,114,119,140,140,144,151,116,2,2,1,2,2,2,6,2,11,6,29,46,36,32,13,10,21,10,5,13,36,68,108,123,137,19,6,24,109,106,154,110,43,16,45,190,202,198,198,179,199,195,198,203,203,200,179,198,203,203,199,198,179,198,198,179,179,198,179,179,179,171,171,169,179,171,173,179,169,179,171,173,179,171,171,171,194,169,177,171,177,162,169,168,169,169,169,168,169,168,162,168,162,162,168,169,162,194,171,173,171,171,194,179,177,194,177,179,194,169,173,171,177,173,171,179,194,171,171,173,171,177,194,173,199,199,199,199,204,200,200,200,203,200,203,200,198,200,204,204,204,201,204,201,201,204,205,201,205,201,205,204,74,
+2,2,2,1,2,16,30,30,33,37,109,22,0,1,2,2,6,2,2,13,32,2,43,122,16,17,21,22,37,130,137,151,119,123,24,47,149,114,32,133,153,153,152,8,130,147,154,184,153,150,150,143,126,127,8,6,6,2,6,2,11,6,11,14,128,128,128,128,138,114,138,145,109,109,128,136,18,6,6,13,116,11,15,11,2,2,34,15,22,29,22,22,33,18,6,2,17,29,30,33,30,13,36,11,17,2,2,29,16,30,30,32,2,6,2,11,7,7,13,16,29,16,22,29,2,1,2,21,11,17,44,7,10,32,46,24,33,5,10,29,18,33,16,29,16,20,29,111,18,1,13,18,14,30,30,30,22,109,110,109,18,144,132,147,153,150,143,6,2,2,6,2,11,6,6,6,22,23,43,34,34,29,13,1,10,10,13,17,124,142,125,142,140,109,44,30,47,121,165,194,190,200,179,202,198,179,198,179,198,198,179,198,179,198,199,198,198,199,179,203,198,179,198,198,179,179,179,179,179,179,179,179,179,179,179,179,179,179,173,171,179,171,173,173,171,171,171,169,171,168,168,169,171,171,171,162,169,162,162,171,162,168,169,168,168,168,171,171,171,169,179,177,171,194,177,179,194,169,179,179,179,194,179,171,173,173,171,171,171,177,179,194,199,199,200,200,204,204,200,201,200,201,203,200,200,200,204,201,204,201,201,204,201,201,205,201,205,204,201,74,
+2,2,2,9,1,7,32,46,36,34,24,29,2,2,5,2,2,2,11,106,20,21,129,130,14,21,16,22,34,119,181,149,106,22,15,130,120,119,110,183,153,153,150,8,152,152,150,150,153,148,147,139,114,127,8,11,2,2,2,2,6,6,6,33,143,150,138,143,128,47,139,148,112,126,138,140,17,11,6,17,116,6,13,8,2,11,119,6,30,30,16,37,17,46,8,11,11,23,30,10,21,21,13,21,13,2,6,16,21,30,30,13,2,2,7,13,21,14,21,34,30,15,30,18,1,1,2,13,15,29,16,2,21,24,46,33,33,11,7,16,29,14,22,17,29,34,114,109,22,2,21,29,8,18,15,13,29,110,116,132,106,126,139,153,150,147,136,10,6,16,11,8,8,8,13,11,30,49,36,29,36,29,17,21,50,172,15,130,114,116,133,129,70,166,130,33,134,177,194,177,194,173,194,179,202,198,194,198,202,179,203,198,198,195,198,199,198,199,195,200,195,198,198,198,171,198,179,179,179,198,179,202,179,179,173,179,179,179,179,179,173,179,169,179,177,171,177,171,169,169,171,169,194,169,173,179,168,162,162,160,162,168,162,162,168,168,171,162,179,171,194,179,177,179,177,171,173,171,179,179,179,179,173,179,194,169,171,173,194,171,173,179,198,199,199,204,204,201,200,200,204,200,200,204,200,200,204,201,205,204,201,201,205,206,204,201,206,201,201,69,
+9,1,2,2,9,5,30,109,116,120,109,10,2,6,2,2,5,13,45,130,106,13,14,15,11,45,141,34,47,117,132,144,18,119,109,45,32,120,36,133,153,153,147,24,138,138,150,153,148,126,149,122,123,128,3,11,6,6,2,2,11,6,8,132,149,146,144,149,128,116,144,145,138,126,136,151,116,29,36,48,29,6,11,15,17,16,123,6,16,36,30,36,29,29,18,21,14,30,7,7,11,21,6,7,13,13,21,7,7,30,47,6,2,7,13,17,21,7,17,29,29,16,24,17,2,1,1,11,13,16,5,10,29,34,43,33,44,6,15,16,29,29,43,36,22,46,109,32,31,2,7,15,22,29,11,6,16,132,120,116,110,149,153,150,148,144,140,8,21,17,11,17,18,20,17,2,29,21,29,14,33,132,29,30,46,3,13,106,123,46,11,35,163,162,168,169,171,169,171,194,177,198,179,194,202,179,179,198,202,202,198,203,179,200,179,200,199,195,198,196,203,203,198,198,198,198,179,202,198,179,179,198,198,202,198,202,179,179,179,179,179,179,178,169,171,171,171,171,173,171,177,171,179,194,179,177,179,168,162,162,156,162,162,171,162,162,168,162,168,171,169,194,179,194,194,173,194,179,179,179,179,194,179,194,171,171,173,177,194,173,194,198,179,198,200,200,204,204,204,204,201,204,200,204,204,204,201,204,201,201,201,201,205,201,206,205,201,206,205,74,
+2,6,1,2,1,2,29,34,123,111,109,33,116,119,16,6,6,32,130,120,32,21,16,26,2,36,132,132,149,151,140,149,8,126,111,15,106,124,32,117,144,144,106,15,137,144,149,150,144,144,144,111,125,140,17,6,6,2,2,2,11,6,22,133,147,150,145,136,144,140,138,127,126,122,141,141,14,24,19,22,6,6,2,13,13,36,122,1,17,22,30,16,48,31,119,30,30,13,29,16,12,47,2,29,36,29,29,1,30,32,10,2,5,11,13,13,13,14,23,22,16,30,17,24,2,1,2,11,2,16,2,11,22,30,33,32,46,34,31,13,13,21,28,29,22,30,33,33,18,1,12,17,15,7,13,18,33,119,106,116,147,152,150,150,148,140,146,115,109,11,6,6,17,6,2,6,2,13,43,13,30,119,106,106,30,13,32,126,22,159,166,162,162,160,162,162,168,171,171,171,194,169,194,179,202,179,198,179,198,179,200,199,199,195,198,199,199,199,195,196,198,198,200,198,200,203,198,198,179,198,198,179,198,179,179,198,179,202,179,179,179,179,179,179,179,168,173,173,171,171,171,169,194,179,177,179,179,179,168,162,162,162,162,162,162,162,168,168,168,171,171,194,179,179,179,179,173,195,179,179,179,179,173,194,171,194,171,169,179,194,179,179,195,179,200,195,204,200,201,204,200,204,201,201,204,204,201,201,204,201,204,204,201,206,206,201,205,206,201,74,
+2,1,2,2,1,5,30,47,126,122,116,46,149,152,34,43,106,132,119,130,15,14,21,12,6,14,22,152,151,120,133,132,15,116,33,13,24,123,133,133,123,145,109,16,137,138,149,153,153,115,47,106,115,142,15,6,6,11,2,6,6,6,34,144,144,144,136,138,138,123,113,126,47,13,122,110,6,16,33,17,8,2,30,32,129,133,130,6,36,30,36,117,120,6,32,32,43,11,45,21,21,50,14,36,29,21,13,33,47,29,1,2,11,2,13,8,13,29,17,30,29,32,46,20,2,1,2,13,13,13,11,11,29,32,31,120,140,46,17,13,17,15,21,13,15,33,109,32,17,6,2,16,11,11,16,30,46,106,106,140,152,148,153,152,150,136,149,113,20,6,2,11,6,18,8,15,11,10,11,11,36,120,119,147,128,108,109,118,141,161,162,160,162,160,171,169,162,171,171,162,171,171,171,169,194,194,177,179,194,198,198,202,200,199,199,198,199,196,203,198,200,203,203,195,198,203,198,198,198,198,179,198,198,198,203,195,203,195,198,202,202,179,179,179,171,173,171,179,171,173,171,173,171,179,179,198,179,179,179,168,162,162,156,161,156,162,162,168,162,173,171,171,169,194,179,179,194,179,179,198,179,179,179,194,179,171,177,194,173,194,179,198,194,198,199,199,200,201,200,204,204,201,204,201,200,204,201,201,204,201,201,205,201,205,201,206,206,201,206,131,
+2,2,1,1,2,2,16,36,122,126,116,46,122,116,33,36,139,133,70,15,6,7,7,2,13,13,43,153,147,120,120,4,29,126,109,40,133,137,20,22,33,145,105,31,147,136,153,154,145,125,31,31,18,140,8,6,6,2,2,2,7,6,117,138,144,138,128,137,126,114,109,22,6,22,138,15,6,16,24,18,44,34,29,30,120,18,32,2,29,23,30,117,29,13,30,43,29,29,17,22,15,6,21,29,34,6,36,21,17,10,1,2,5,2,11,15,13,22,22,30,29,34,31,24,2,1,2,14,17,1,5,13,45,47,117,129,120,106,34,106,17,21,11,15,37,31,33,33,20,2,2,29,22,16,17,29,106,110,116,124,152,148,146,142,144,139,139,136,15,6,6,6,6,8,17,15,17,6,2,36,16,119,132,142,125,109,116,149,169,162,162,162,168,167,162,167,171,169,171,169,171,162,168,194,168,177,171,173,194,202,179,199,199,199,203,199,199,199,198,203,200,198,196,203,200,195,198,200,203,198,198,203,179,200,198,203,199,203,199,179,198,198,173,179,179,194,179,169,173,171,171,171,179,179,194,179,198,198,179,179,171,168,168,162,168,162,168,168,171,194,171,177,171,171,177,194,179,179,179,179,179,194,194,179,179,179,179,179,179,179,179,179,198,198,179,200,195,195,200,199,204,200,200,204,204,204,201,204,201,201,205,201,205,201,206,206,201,206,205,74,
+82,10,2,2,1,5,16,33,106,126,144,139,136,44,7,132,185,132,46,1,5,1,1,2,16,139,148,153,144,124,17,13,24,153,18,29,34,109,106,24,29,138,114,146,126,147,153,144,150,142,105,15,8,126,4,5,2,2,5,2,11,11,133,149,150,149,126,146,125,126,14,2,6,22,114,5,7,16,13,114,111,115,18,33,29,6,11,2,29,32,17,32,16,33,32,34,47,123,122,31,22,13,13,43,32,2,34,34,29,12,1,2,2,2,13,109,15,31,18,29,17,106,33,17,2,1,2,21,22,6,0,29,45,106,46,109,46,109,34,106,24,5,11,14,24,33,33,29,24,6,6,16,29,16,29,8,47,46,114,142,145,139,150,153,149,147,123,126,2,11,6,6,6,11,18,22,17,13,29,10,29,106,33,140,125,114,131,160,168,168,162,162,162,162,162,162,168,169,171,177,171,169,168,168,171,173,171,169,194,179,179,195,198,198,200,199,196,204,200,200,200,200,200,200,204,203,203,198,196,198,198,199,199,179,195,179,200,179,198,198,179,198,179,179,171,179,179,179,171,194,171,179,173,194,179,198,199,199,179,179,179,179,171,171,168,168,173,171,168,171,171,171,173,194,179,173,179,179,179,194,179,179,179,179,202,179,171,194,179,198,179,198,179,198,179,198,196,199,203,200,200,200,204,201,201,200,204,201,201,205,201,204,201,205,206,201,206,201,201,74,
+95,53,6,0,1,2,29,29,47,133,130,136,126,118,21,149,132,141,13,2,2,1,2,13,22,149,138,146,136,46,11,17,109,143,20,16,46,116,148,24,32,154,127,126,144,146,145,128,144,142,105,8,46,128,6,17,13,2,2,2,11,16,133,141,147,144,150,122,113,111,13,6,6,22,109,2,11,13,18,114,33,111,115,31,8,17,6,6,13,16,22,22,30,106,46,37,119,129,120,47,106,31,2,47,43,14,22,15,17,2,2,5,2,11,11,106,11,20,31,15,15,116,110,15,1,1,2,29,18,2,2,21,30,22,17,43,34,111,37,110,30,9,2,34,31,31,24,24,15,1,11,33,30,22,36,29,110,106,127,138,146,145,153,154,147,145,124,144,6,2,2,6,6,13,20,17,17,8,49,39,129,106,106,111,115,164,162,169,168,162,171,169,169,162,168,168,168,171,171,169,168,168,168,168,171,194,171,173,171,177,194,202,203,195,198,204,199,200,200,198,204,204,200,200,204,200,200,203,198,203,198,198,202,199,203,199,203,195,179,198,198,179,198,202,179,179,179,179,194,169,173,179,168,179,179,198,199,199,196,203,198,195,179,179,179,179,168,171,174,173,171,171,171,169,173,194,173,194,179,194,179,179,195,179,194,198,202,179,179,198,179,198,198,198,198,179,198,198,179,200,195,200,204,204,204,201,201,200,201,201,205,201,205,201,206,201,206,206,206,131,
+89,84,38,5,2,2,13,21,32,34,139,147,149,130,117,133,149,136,6,2,2,6,2,7,29,110,153,150,111,6,8,114,144,152,4,14,46,24,24,13,16,137,128,3,114,142,150,150,115,142,114,11,109,115,31,110,7,6,2,2,11,16,110,122,145,140,115,137,154,123,6,6,2,47,20,2,6,7,16,109,119,108,126,8,15,17,17,2,21,31,30,16,30,47,34,68,110,48,132,31,46,24,15,34,24,13,16,30,13,2,2,7,2,7,13,18,21,24,31,15,43,20,109,8,2,1,5,11,22,6,2,13,30,32,30,24,106,46,47,32,33,6,2,18,30,36,16,117,6,2,30,37,43,22,30,45,106,132,125,144,153,153,153,153,151,151,149,126,11,2,2,6,6,6,18,31,33,14,13,8,49,47,8,111,164,169,169,169,162,168,162,168,168,169,171,168,171,169,171,168,168,169,168,162,194,169,179,171,171,194,179,179,196,199,200,203,204,199,198,200,200,198,204,198,201,200,199,199,199,199,198,198,179,202,195,203,196,179,198,198,179,202,179,198,179,179,179,179,171,179,171,177,179,179,194,179,199,199,199,199,196,203,195,198,198,179,179,179,179,169,173,174,194,171,179,179,194,169,179,179,179,179,179,198,179,198,194,179,179,198,198,179,198,199,179,198,203,198,198,198,195,203,198,204,201,200,204,201,204,201,205,205,201,201,205,206,201,206,201,74,
+89,90,91,90,71,2,7,22,47,119,139,182,149,140,106,132,150,132,11,2,2,2,6,7,16,119,154,151,17,13,29,152,150,140,2,14,119,110,29,1,7,117,33,126,147,128,150,150,105,138,127,6,109,109,128,37,7,2,2,5,6,14,123,144,126,127,128,153,152,125,8,6,6,119,19,5,6,14,34,122,109,111,47,19,13,13,11,6,16,13,13,22,34,106,32,36,106,33,34,18,33,18,31,29,18,13,29,11,2,2,6,2,2,2,12,11,17,108,33,24,109,31,122,6,2,1,2,13,22,8,6,16,34,33,16,46,106,120,116,132,144,109,5,121,16,22,129,122,2,5,36,30,29,29,22,47,36,132,127,139,151,153,153,148,151,137,149,34,2,6,2,11,17,22,21,17,22,109,157,166,171,78,157,166,169,169,169,171,168,168,169,169,169,162,168,168,168,168,168,169,162,168,169,171,171,173,173,171,171,179,202,179,203,200,198,203,200,199,200,198,204,196,204,196,198,196,199,203,199,198,198,203,179,198,179,198,198,203,195,179,198,198,198,179,179,198,173,179,179,194,194,177,179,179,179,198,179,198,199,200,196,203,199,199,198,198,198,202,179,179,198,194,202,179,179,179,179,179,179,173,179,179,198,179,198,179,198,179,198,179,179,198,199,198,198,198,195,198,198,203,195,200,200,203,200,204,201,200,201,205,201,201,205,205,201,201,205,201,206,74,
+90,90,91,90,90,38,11,129,130,47,120,133,133,123,29,149,147,125,16,7,11,6,2,11,22,130,146,136,11,6,33,150,137,144,111,24,33,43,114,22,132,119,109,106,8,8,138,148,8,146,125,11,114,18,46,18,2,2,2,2,2,29,116,114,126,145,153,152,144,128,16,6,6,137,20,6,6,6,11,20,109,18,114,22,6,13,11,11,6,6,30,30,29,106,30,30,46,17,36,17,30,24,15,30,15,4,7,6,2,2,2,6,6,2,6,13,1,16,11,8,33,32,136,2,1,2,6,12,17,11,6,30,34,34,46,109,116,124,141,140,141,136,126,8,32,134,149,17,1,2,43,30,16,21,36,133,43,120,125,144,150,183,150,149,146,147,129,6,6,11,8,17,34,17,31,21,24,78,168,162,160,168,162,162,167,171,171,169,168,168,168,168,169,169,168,169,162,169,171,168,168,168,171,171,177,179,179,179,194,179,198,202,199,199,203,198,198,203,199,196,196,199,203,199,199,203,195,199,198,179,198,198,198,198,198,203,179,198,203,195,203,198,196,198,179,179,194,179,179,179,194,179,194,179,179,198,198,198,199,199,199,203,198,198,179,198,179,199,203,196,196,199,179,198,179,179,198,178,173,198,195,198,198,198,198,195,199,198,198,195,179,198,198,198,198,200,203,199,196,198,199,199,196,198,199,203,200,201,204,201,201,205,206,201,205,206,201,206,205,131,
+82,90,89,90,91,82,38,30,32,34,132,139,138,133,119,147,137,140,11,13,11,11,13,13,32,124,153,19,11,30,132,126,144,145,115,119,122,21,22,22,17,29,8,6,17,106,143,105,114,150,111,6,33,114,17,34,2,6,2,2,11,16,123,138,126,153,143,143,115,140,8,6,6,135,111,6,6,7,7,24,24,24,114,19,11,13,13,22,2,11,4,16,30,46,17,30,116,22,14,17,16,30,16,45,32,164,2,7,6,7,2,10,9,11,7,14,6,13,24,119,15,34,132,1,1,2,2,11,30,11,7,29,37,24,119,149,149,141,139,144,139,133,136,109,47,130,136,109,5,2,36,30,29,43,120,130,106,120,139,147,148,145,147,141,140,33,6,10,13,16,36,16,21,29,16,68,169,162,156,156,160,162,162,162,168,168,194,162,194,162,168,160,162,168,168,168,169,169,162,168,169,171,173,171,179,179,198,179,179,202,199,179,200,195,196,198,203,200,200,199,198,198,199,198,195,199,203,179,198,179,202,179,194,198,179,179,202,198,179,196,199,199,203,195,198,202,179,179,179,179,198,179,179,202,179,179,198,179,198,199,203,199,198,179,198,203,196,200,199,199,203,196,199,203,198,195,179,198,198,198,179,196,203,198,199,199,199,195,199,198,198,198,199,203,200,195,198,204,198,198,195,200,195,198,199,196,203,198,204,204,201,201,205,205,205,201,205,201,205,74,
+89,86,89,89,89,90,86,7,21,116,140,144,139,147,120,144,151,108,13,11,13,13,13,18,43,119,141,11,17,144,138,133,144,128,24,137,125,116,31,13,16,33,17,15,24,24,31,20,142,150,18,29,123,146,144,31,6,11,2,2,7,7,106,137,136,148,138,146,108,136,6,6,13,147,122,6,13,1,7,22,34,17,109,111,13,15,15,18,15,33,44,23,22,33,13,34,47,106,43,22,47,31,35,29,46,40,2,29,13,13,2,1,5,21,13,11,2,119,133,116,15,130,22,2,1,2,2,35,28,2,13,30,119,132,149,183,133,141,133,133,141,132,130,33,132,130,117,43,2,7,21,36,37,47,47,47,120,118,120,138,147,148,146,142,116,13,13,15,30,11,21,28,66,165,29,159,162,162,162,160,162,162,160,169,162,168,162,168,162,162,162,162,160,162,168,162,162,169,169,168,168,169,194,173,194,173,179,202,198,196,179,200,202,199,199,200,198,204,198,204,199,199,199,195,203,195,179,198,198,202,179,198,179,179,179,198,179,198,199,203,199,199,199,203,198,202,198,179,198,198,203,198,179,198,198,198,198,198,179,199,198,203,198,199,195,179,196,198,179,198,198,198,179,199,195,202,203,199,199,199,195,179,199,199,199,203,198,200,200,196,199,200,195,200,203,200,200,198,200,203,199,199,199,195,199,199,199,199,198,201,204,204,201,206,201,205,201,205,200,74,
+84,85,85,86,85,89,89,7,32,36,132,130,144,132,139,144,140,19,17,13,13,13,34,111,22,34,142,11,114,144,147,149,144,125,125,140,32,32,31,44,119,114,21,34,109,114,151,18,150,140,6,135,152,144,122,17,30,34,11,2,5,11,133,135,32,138,146,151,108,125,6,6,24,139,109,2,6,13,13,32,34,34,136,31,8,17,17,18,33,46,22,29,34,22,11,106,132,34,118,119,18,120,14,48,46,2,5,5,1,5,2,5,1,2,5,1,11,117,110,33,18,132,11,2,1,2,5,29,13,2,21,130,134,130,141,149,149,133,133,139,133,119,117,46,141,110,47,1,5,5,28,30,110,31,117,106,116,106,109,116,142,142,20,140,32,16,36,15,120,164,162,173,169,171,166,171,194,162,169,168,168,162,171,160,168,162,162,162,160,161,162,169,160,160,98,160,160,160,162,162,168,171,169,171,179,179,198,177,198,203,195,198,199,204,198,200,200,198,200,200,200,199,198,199,203,199,195,179,198,198,179,179,179,179,179,179,179,179,198,195,199,199,198,199,198,179,195,198,198,179,198,199,195,198,179,199,179,198,202,198,179,196,200,203,203,199,178,203,198,195,198,198,203,198,203,198,200,198,200,195,200,195,198,198,198,196,203,203,198,204,200,203,200,204,198,204,200,200,200,200,195,203,200,198,199,199,198,199,199,198,204,201,204,201,201,201,205,201,201,131,
+89,89,89,89,90,90,95,26,13,32,132,139,182,138,140,128,125,125,20,11,11,13,17,116,33,130,144,11,116,122,111,109,115,114,111,110,16,29,16,130,109,44,13,34,106,119,126,126,144,132,133,144,144,122,139,109,29,106,13,2,31,21,48,47,16,126,149,146,138,133,16,13,119,116,17,6,6,11,13,22,24,116,120,11,17,46,17,17,24,15,17,36,119,130,6,106,119,132,149,122,130,24,11,37,20,1,2,5,7,2,2,2,5,2,2,6,21,34,34,120,116,15,6,1,2,2,2,30,3,6,30,33,132,46,129,180,133,133,141,132,119,129,120,141,139,149,31,1,2,11,29,22,33,116,119,116,116,129,132,122,145,125,110,18,16,22,16,74,179,169,169,162,171,169,194,169,171,169,175,169,171,169,168,162,160,162,156,159,160,160,169,159,160,160,156,159,160,160,168,162,162,168,173,194,177,179,179,198,179,200,195,179,196,200,204,200,204,204,199,204,199,196,199,198,199,195,203,198,179,202,198,179,179,179,179,202,198,198,179,200,203,179,200,198,198,198,202,179,196,203,196,203,199,195,199,199,195,179,179,198,202,179,199,196,203,195,199,195,203,199,196,198,198,203,200,198,200,200,195,203,203,195,200,199,199,196,198,200,200,204,198,201,201,200,203,198,201,200,204,198,201,199,199,203,199,198,199,199,198,195,200,200,200,204,204,205,201,204,201,74,
+89,90,89,90,85,91,90,27,32,119,139,136,137,136,126,127,143,145,109,11,11,14,16,106,126,132,106,17,119,140,18,108,125,114,114,106,24,16,22,119,16,110,21,46,43,110,151,145,33,116,149,126,150,126,138,20,13,13,2,2,5,33,11,6,7,140,151,127,126,34,109,70,34,11,6,6,6,7,14,34,109,119,24,2,44,106,126,43,33,30,30,47,123,11,29,106,147,137,149,136,124,132,11,132,24,1,2,2,5,13,1,2,2,5,2,2,23,46,32,132,132,21,2,5,2,2,2,70,68,16,21,130,133,120,133,117,182,133,133,119,130,120,120,149,133,141,24,1,2,13,21,43,125,118,109,116,132,119,114,124,144,140,36,17,66,168,167,168,168,168,194,171,173,171,171,173,171,171,173,162,194,160,168,160,162,160,160,162,162,162,156,159,160,160,97,156,160,160,162,167,169,171,171,179,177,179,199,179,199,203,199,199,203,195,198,204,200,199,204,199,200,203,203,195,203,179,179,198,202,198,179,179,179,202,179,179,198,179,198,198,199,202,198,198,179,198,198,202,198,203,198,204,199,195,199,195,199,199,195,179,198,202,198,198,199,203,199,199,198,200,199,198,200,198,200,200,200,198,200,198,198,200,198,198,198,203,198,196,198,204,200,200,198,204,200,204,200,204,198,204,198,204,200,198,195,198,200,199,199,199,199,198,200,200,204,200,204,204,200,74,
+89,90,91,90,91,90,91,71,133,120,130,114,109,114,119,128,150,146,33,11,13,21,22,46,110,37,24,46,138,126,8,46,144,149,126,34,17,22,30,22,34,22,16,31,34,123,149,126,18,148,108,138,138,126,139,116,2,2,11,6,11,14,2,11,11,123,130,19,148,125,115,15,11,7,7,2,6,7,29,132,133,106,123,6,36,106,120,34,33,15,46,126,116,11,34,183,149,151,139,132,129,124,11,37,13,2,6,10,5,2,2,2,5,2,2,7,43,110,110,133,130,2,2,2,2,9,13,13,2,6,21,130,144,149,145,133,47,139,147,125,132,132,129,141,133,132,33,1,2,35,11,117,120,109,44,114,120,124,118,106,149,31,69,14,78,168,168,168,171,169,171,169,177,194,169,173,171,177,173,173,171,169,162,160,160,159,160,162,160,160,160,159,159,160,156,160,162,160,162,168,168,171,173,194,179,198,179,202,199,196,195,179,196,203,203,204,199,196,203,204,196,199,196,200,203,195,202,198,179,194,179,179,179,177,179,198,198,202,198,179,195,198,198,179,198,198,177,198,199,198,203,198,200,199,203,196,203,203,203,195,179,198,179,198,199,196,203,199,198,196,198,200,200,195,200,195,200,198,204,195,200,195,198,198,200,198,195,198,203,200,204,204,200,201,200,204,201,200,200,203,200,198,204,198,196,196,198,198,200,203,199,198,199,204,200,196,200,200,204,131,
+89,89,89,89,89,90,85,71,6,17,125,138,139,137,136,147,150,139,86,60,29,16,22,67,101,92,96,46,126,114,15,116,126,144,132,34,22,120,22,30,47,13,16,129,106,132,144,115,32,150,136,123,144,126,144,18,11,22,123,13,47,13,2,11,24,122,18,139,138,126,143,19,6,6,6,6,2,13,8,116,18,36,110,16,16,106,132,123,33,36,136,181,109,37,120,181,136,141,138,120,33,22,10,30,2,2,2,5,2,11,2,1,2,2,6,5,45,33,120,119,33,1,2,2,2,1,11,21,6,2,30,133,124,47,151,147,31,132,144,149,126,119,132,144,126,144,34,1,11,21,29,117,120,109,109,118,116,124,128,43,45,163,162,98,173,162,168,171,169,169,175,171,169,173,173,169,177,171,177,171,168,162,162,162,162,160,160,162,169,167,169,160,162,159,160,156,169,162,162,168,171,173,194,202,198,198,203,198,199,203,203,195,198,200,200,195,203,198,199,198,204,203,203,198,179,198,179,179,198,179,179,198,198,198,202,179,198,179,198,198,179,198,179,198,177,198,198,179,203,199,199,203,198,199,199,198,200,198,195,203,195,179,198,198,203,196,200,198,204,200,200,198,196,204,195,204,200,204,198,204,204,198,200,204,195,204,204,200,204,198,195,204,201,204,201,201,203,201,203,200,200,204,200,200,203,199,199,203,199,198,200,198,198,200,199,204,198,201,200,74,
+89,89,89,85,90,91,89,90,6,13,123,144,140,136,119,140,148,79,89,90,79,75,75,90,92,91,96,59,13,33,138,144,149,182,96,53,22,32,30,34,20,31,26,23,132,144,149,114,22,150,136,122,136,133,150,8,29,114,126,8,119,13,7,2,132,105,119,144,34,16,150,20,11,6,6,2,2,6,29,115,32,114,136,8,22,132,130,133,132,130,141,126,33,130,119,151,110,130,133,138,109,16,14,6,2,5,6,2,10,2,6,1,1,2,7,6,30,123,109,109,15,6,1,2,5,2,2,2,11,1,36,151,123,34,149,144,106,133,141,133,132,116,144,144,145,147,17,2,2,22,31,36,36,116,109,116,122,113,148,169,162,171,169,171,162,171,171,169,171,177,177,168,177,175,171,171,168,169,194,171,169,162,160,162,162,159,169,162,162,162,162,160,162,160,162,160,167,162,162,168,171,202,194,202,179,198,179,196,196,200,199,203,198,200,198,199,198,200,200,203,198,200,198,179,198,198,198,179,179,179,179,179,202,179,198,198,179,198,179,198,199,198,198,198,179,179,198,199,196,198,199,199,199,204,200,198,200,198,200,198,199,198,198,179,198,199,198,205,203,198,200,200,204,198,204,204,204,195,201,204,195,201,195,204,195,204,195,204,195,200,200,198,204,204,201,200,201,200,201,200,203,200,200,204,200,200,198,200,199,196,199,199,196,198,199,203,199,198,200,131,
+89,86,89,90,86,88,91,100,6,6,33,126,142,138,122,106,48,90,89,90,86,90,90,91,91,90,92,59,106,116,119,117,48,87,96,96,49,11,32,29,7,33,33,21,47,36,29,11,114,150,144,123,106,138,151,105,34,114,120,29,129,119,123,104,114,18,137,132,11,24,153,19,2,11,6,6,2,7,17,123,106,106,135,20,36,130,110,132,132,120,130,24,24,139,133,130,120,106,136,123,130,116,2,2,2,2,2,11,2,2,2,2,1,2,2,2,34,109,111,33,2,2,6,2,2,5,2,5,7,11,29,136,122,36,133,149,24,141,145,136,136,133,140,141,133,126,8,2,21,36,13,46,109,109,118,118,125,127,140,194,160,171,168,168,168,168,167,168,169,171,171,177,171,171,177,175,173,171,162,168,162,162,162,161,162,169,162,162,168,162,162,162,162,168,162,162,168,162,171,171,194,173,179,198,179,198,203,199,199,196,198,200,196,198,200,203,199,199,198,196,198,203,198,199,195,179,179,179,194,198,179,198,202,179,179,179,202,179,202,179,198,179,198,179,198,179,198,179,199,200,200,203,198,200,198,204,198,200,200,203,203,195,179,198,199,199,200,198,201,203,200,204,195,201,201,204,201,204,200,204,201,204,201,201,201,204,201,201,204,195,204,201,204,204,204,204,204,201,200,200,204,201,203,198,200,200,198,204,199,198,200,199,199,199,195,196,199,203,195,74,
+85,85,85,85,89,89,86,90,58,11,126,128,128,132,134,77,95,89,91,90,90,91,86,90,86,91,92,71,66,68,77,100,91,92,91,96,96,62,34,16,30,123,18,13,32,8,11,16,149,150,147,33,106,128,146,144,120,133,31,34,110,133,149,154,148,22,122,105,11,24,145,8,11,7,2,2,7,6,37,125,45,47,106,106,30,117,106,129,136,46,29,24,110,144,109,34,136,120,137,124,126,116,0,6,1,11,2,2,6,6,2,6,1,1,6,2,46,138,125,15,6,2,2,2,6,1,2,2,31,31,30,144,137,117,37,133,30,153,149,145,133,119,138,122,119,124,11,2,2,8,43,111,126,33,33,111,125,115,145,198,168,162,169,168,168,162,168,162,168,168,162,171,169,162,171,171,171,171,168,168,162,168,162,160,168,168,162,168,168,169,162,162,171,162,168,168,162,168,171,173,179,198,198,202,194,198,195,203,199,203,195,198,204,203,196,203,200,199,200,199,198,179,199,198,203,179,198,179,179,179,202,179,179,179,198,179,198,198,198,198,202,179,198,198,202,173,195,199,198,195,198,201,200,198,204,200,200,203,198,200,200,200,203,196,198,199,200,204,204,201,205,201,204,201,204,201,204,201,204,201,204,204,204,201,204,201,201,200,204,201,195,204,204,200,201,204,200,204,204,204,199,200,200,195,200,200,200,198,204,200,203,198,199,203,203,199,198,199,195,74,
+89,89,89,85,85,89,89,85,90,61,36,123,121,78,84,89,82,85,85,90,76,90,91,89,91,90,86,90,91,85,91,90,91,91,91,91,92,102,39,11,17,138,17,13,30,7,2,29,123,149,126,20,139,152,151,138,136,125,10,130,147,153,153,144,147,126,144,114,17,106,145,11,7,7,6,2,6,6,119,116,34,106,47,106,33,47,34,47,126,11,8,109,141,143,29,132,116,119,141,144,151,24,2,1,2,11,2,6,2,7,13,2,2,6,1,2,129,122,132,22,2,2,2,5,1,5,2,6,36,129,116,129,141,122,120,132,30,126,133,133,136,140,132,132,110,125,11,2,13,46,110,126,146,127,29,24,150,128,147,169,169,169,168,162,162,162,168,162,168,162,169,169,162,168,171,173,171,169,168,168,168,169,162,162,162,162,162,168,169,162,171,169,162,162,160,162,171,171,171,194,179,202,179,198,198,203,199,198,204,200,200,200,203,198,200,195,198,204,198,196,200,198,203,195,196,198,202,179,179,179,194,202,179,179,202,179,195,179,198,179,198,179,198,179,198,198,179,203,199,203,200,195,204,204,200,198,200,200,204,199,198,196,198,199,204,200,201,201,204,201,201,204,205,201,201,204,201,201,204,201,204,201,201,204,201,204,201,204,204,204,201,200,201,204,204,201,204,204,204,200,199,200,200,200,198,199,202,200,198,200,199,199,200,200,195,200,200,198,200,131,
+85,85,86,88,85,89,84,84,89,89,89,82,84,84,82,84,89,85,90,91,90,90,85,89,91,85,90,90,89,90,89,91,89,86,91,91,92,96,62,30,46,122,16,32,30,13,2,24,144,152,148,20,149,144,142,124,106,110,15,120,153,151,144,111,149,139,128,127,8,138,144,6,7,6,2,2,13,7,132,33,106,128,127,108,29,22,116,44,123,8,11,116,136,136,16,124,132,114,153,141,68,11,2,2,5,1,11,2,11,13,21,6,2,2,2,6,117,149,132,13,2,2,5,25,1,2,6,7,47,120,120,120,124,151,105,31,18,132,120,132,133,124,123,110,47,117,6,2,11,33,116,136,140,138,104,113,141,126,130,169,169,168,162,171,169,160,168,168,171,171,171,177,168,171,194,169,177,171,169,162,171,168,169,169,169,169,162,162,169,169,162,168,160,160,159,160,162,171,171,194,173,198,179,202,179,200,198,200,203,199,200,199,200,200,200,200,203,198,200,179,196,199,196,203,179,179,179,179,202,179,198,179,198,198,179,195,179,203,178,202,195,179,196,199,198,179,200,198,198,198,200,200,203,200,198,200,200,204,196,200,204,200,200,200,195,204,201,201,201,206,201,205,201,205,206,201,204,201,204,201,201,201,204,201,201,205,201,204,201,201,204,201,200,200,201,200,201,203,200,204,199,199,202,199,199,199,198,199,203,198,200,202,199,198,198,199,199,202,179,74,
+89,89,85,89,82,84,84,82,84,82,84,84,84,84,89,85,86,89,85,85,91,89,90,91,82,91,85,91,88,91,90,90,89,91,90,86,90,86,92,75,130,43,30,29,11,11,7,141,152,151,144,151,138,143,150,128,119,8,43,110,148,147,143,145,115,109,132,126,15,153,128,6,7,14,29,16,11,13,136,15,30,138,143,20,11,34,124,24,132,31,36,133,124,132,34,119,149,119,144,124,6,2,5,2,2,6,6,2,14,47,22,21,13,6,2,2,68,125,33,2,6,10,2,1,2,5,1,13,119,119,15,32,133,116,130,133,33,106,120,110,130,132,139,120,110,6,2,6,13,106,132,119,132,127,140,126,18,69,156,162,162,168,169,169,162,171,169,171,169,171,171,162,194,162,171,171,162,194,168,194,162,171,171,162,171,169,162,169,162,160,162,156,156,156,156,156,160,169,168,171,194,179,179,179,198,198,202,179,200,202,199,199,199,200,200,200,199,200,199,198,199,203,199,200,198,198,179,173,198,198,179,202,179,198,198,203,195,179,202,194,198,203,199,203,199,198,198,199,203,200,200,203,198,198,204,198,200,195,204,204,198,200,204,204,200,201,204,205,205,206,206,201,206,201,206,205,201,201,205,201,204,201,201,201,204,201,201,204,201,200,204,201,204,204,204,204,200,204,204,195,202,194,198,199,198,177,198,179,198,179,179,198,198,179,198,179,198,177,179,74,
+89,84,84,85,84,84,84,84,82,84,84,84,84,82,84,84,84,85,89,85,85,90,89,85,91,90,91,89,89,89,89,90,91,90,85,91,90,90,91,91,95,13,13,2,16,17,6,120,151,137,141,144,150,142,142,138,17,13,33,37,153,152,146,145,142,115,110,111,122,124,13,6,7,36,110,114,109,22,47,2,29,129,150,20,23,34,116,47,123,116,117,133,149,126,68,133,141,130,149,125,2,2,2,1,2,2,2,11,106,36,47,22,46,29,31,18,117,139,136,2,2,2,6,2,2,5,2,13,116,29,18,17,36,109,43,116,29,29,119,106,130,123,106,106,132,24,2,2,11,119,110,120,132,144,140,45,159,161,156,162,161,168,162,169,169,162,171,171,171,173,171,171,171,162,169,169,169,171,171,169,171,168,168,171,162,169,162,160,160,156,98,103,98,103,103,156,156,160,162,168,171,171,171,177,179,177,198,177,194,202,179,198,196,199,204,204,204,199,195,198,198,202,198,179,200,179,198,198,179,179,198,198,202,179,195,179,198,198,198,179,199,179,198,203,200,203,199,200,200,200,198,200,200,203,200,195,200,204,200,204,200,204,201,200,203,204,201,204,201,205,201,205,206,206,201,205,205,204,201,205,201,204,201,204,201,201,204,201,204,204,204,201,204,201,200,200,200,198,199,199,198,198,198,179,198,177,194,179,202,179,194,173,179,199,194,173,194,171,171,74,
+84,84,84,84,84,84,84,84,82,84,82,84,84,84,84,88,85,85,89,89,89,91,85,90,85,85,85,89,89,89,89,91,90,89,91,90,90,89,90,90,95,12,11,6,22,24,7,130,149,148,145,138,150,143,150,106,15,24,13,47,147,149,127,143,115,17,18,17,132,29,2,11,7,24,109,125,149,106,30,6,16,34,132,15,16,34,138,117,133,140,139,182,186,22,120,149,136,151,37,132,3,5,2,2,2,6,5,6,106,114,48,16,15,22,136,119,181,24,130,6,2,5,2,2,2,2,2,21,116,124,29,34,120,33,110,46,18,29,30,119,120,130,119,47,47,32,6,2,13,43,119,132,133,124,17,87,160,160,156,156,160,162,162,169,162,169,168,168,168,168,168,169,162,160,159,160,162,162,168,168,162,162,162,162,161,160,160,156,103,98,98,98,98,98,98,98,98,98,160,161,168,169,168,171,171,171,171,177,179,179,194,179,179,199,203,199,199,198,198,203,199,179,198,203,198,198,202,179,198,198,198,179,200,199,203,199,179,198,179,198,179,198,198,199,199,200,200,203,196,200,203,200,200,200,200,200,200,200,198,204,200,201,200,204,201,204,200,201,201,204,201,201,206,201,206,201,205,201,201,201,204,201,201,201,204,201,204,201,205,204,201,203,200,198,204,200,203,199,198,194,177,179,179,177,194,194,179,177,194,173,173,194,194,177,179,173,169,160,162,69,
+82,84,82,82,84,82,82,82,82,84,82,84,84,84,84,88,89,85,86,89,89,89,86,88,90,85,86,82,85,89,89,85,85,89,89,89,89,89,89,89,95,61,14,129,129,29,34,116,141,149,144,138,145,150,115,4,22,122,15,117,140,127,149,143,150,111,18,192,18,7,2,6,13,13,24,128,126,110,15,2,21,110,126,6,22,130,141,45,133,153,151,144,116,6,181,132,47,120,34,106,20,2,5,11,6,2,6,7,123,122,109,11,22,17,110,123,141,14,20,2,11,6,2,12,2,5,2,13,106,120,30,32,46,106,46,36,106,43,47,120,132,120,120,45,106,24,15,11,29,31,47,149,120,97,87,98,103,159,160,161,156,160,169,162,160,169,156,160,162,168,162,161,160,156,160,156,156,162,168,169,168,162,156,160,156,160,103,98,98,96,102,92,92,92,98,98,98,103,93,159,161,162,162,156,168,162,169,160,173,171,171,173,194,202,194,203,203,200,195,199,199,203,199,179,200,198,198,198,179,198,200,199,202,196,198,200,203,198,199,203,198,179,198,179,196,204,200,204,200,200,200,200,198,200,199,199,199,199,203,200,200,204,200,200,204,204,204,201,200,201,205,204,201,201,205,205,201,206,205,204,201,201,201,205,201,201,201,204,204,200,200,198,199,200,179,198,179,177,179,179,169,194,162,168,177,177,169,194,169,162,171,177,171,173,171,194,162,171,169,74,
+84,84,82,82,82,82,84,84,84,82,84,82,82,82,84,85,89,85,85,85,85,85,88,85,85,85,85,88,84,84,84,88,89,84,89,85,86,89,89,89,90,61,14,23,29,29,22,119,106,122,47,34,149,146,146,114,18,46,17,139,150,145,153,152,125,153,114,27,2,11,2,7,7,13,34,146,149,124,6,2,47,153,153,8,45,141,110,106,47,150,148,138,6,120,119,132,22,119,45,47,111,2,31,125,33,13,11,11,117,24,109,15,13,13,106,147,125,36,126,2,21,16,2,1,1,2,11,13,116,47,17,36,43,43,31,43,116,43,43,46,46,47,119,46,133,106,24,34,33,116,132,164,92,97,103,98,98,103,160,160,160,161,160,156,162,160,160,162,168,162,160,156,159,160,156,160,156,162,162,160,161,160,160,161,156,160,98,92,92,92,96,92,96,101,92,92,98,98,98,98,98,103,98,160,156,160,159,160,169,167,169,171,171,171,173,194,179,198,179,199,195,198,202,199,199,198,179,179,198,198,179,200,198,199,200,200,200,195,199,198,179,200,198,203,195,200,200,198,204,204,204,199,203,200,198,199,179,200,179,200,199,199,199,199,204,204,201,204,200,204,204,201,205,205,205,201,205,204,197,205,201,204,204,204,205,201,204,205,200,200,199,179,202,179,199,194,173,194,177,171,169,169,169,169,171,171,177,169,162,168,171,171,168,168,162,168,162,169,162,69,
+84,82,81,82,84,81,88,84,82,82,82,84,82,84,84,84,84,84,82,85,89,84,85,84,88,84,84,82,84,82,84,85,85,85,90,85,90,85,89,95,91,82,0,2,11,106,11,106,36,46,22,22,153,145,148,127,17,29,8,149,149,142,153,154,144,153,20,5,2,11,7,6,7,13,34,126,138,32,16,5,36,147,149,8,129,136,31,16,132,146,140,11,33,123,147,141,15,47,29,43,114,4,123,105,182,185,3,13,30,110,33,24,20,126,147,124,136,129,147,2,7,13,2,5,2,2,11,47,130,29,29,47,116,116,124,114,33,31,138,116,136,132,138,114,186,144,120,46,23,35,71,96,96,93,98,98,98,98,160,159,160,156,160,156,160,156,160,156,162,156,160,156,103,156,160,156,162,169,160,160,162,160,160,160,161,98,96,102,92,92,92,92,91,92,92,92,92,96,101,98,98,98,98,98,98,98,103,159,160,160,160,162,162,168,169,168,173,194,179,179,198,179,179,179,179,198,179,194,179,179,198,203,198,198,198,199,204,204,202,196,199,199,179,199,203,195,203,200,200,203,198,203,198,179,179,179,179,198,179,198,179,202,179,198,179,199,199,199,200,200,204,201,204,201,201,205,206,201,204,201,200,201,204,200,201,204,200,200,203,199,198,198,202,194,169,177,171,171,177,168,162,162,162,169,169,169,171,168,168,169,169,169,168,160,162,162,160,162,160,73,
+82,82,84,82,84,84,81,82,82,82,81,85,81,84,82,82,84,82,84,84,82,90,89,88,84,84,88,84,84,84,84,85,88,85,88,89,85,90,90,88,89,95,40,2,14,133,2,45,30,47,11,29,150,146,142,142,33,11,43,144,152,151,126,140,123,152,109,2,5,6,6,7,6,11,13,110,109,17,30,2,21,144,133,11,20,114,109,36,133,149,128,22,138,141,144,122,30,33,33,23,116,144,128,130,136,136,6,11,33,106,120,123,109,141,146,123,129,119,116,0,5,72,64,2,2,6,7,37,22,7,117,120,130,120,129,120,120,43,119,130,132,130,31,138,154,149,111,120,77,95,95,91,97,102,98,98,98,98,103,160,159,103,97,160,156,160,156,161,160,160,156,160,160,156,160,160,162,162,156,169,169,160,156,160,156,98,98,96,92,91,91,91,91,91,91,91,92,92,91,92,92,92,98,92,98,98,98,98,156,156,156,160,156,160,160,162,162,169,171,168,168,168,169,168,173,179,179,179,179,171,179,199,198,179,198,198,198,179,200,202,203,198,203,200,203,203,200,199,204,202,200,199,198,179,169,171,173,173,171,177,179,194,177,194,173,198,198,198,198,199,200,204,200,201,201,204,201,205,201,201,204,201,201,201,204,203,199,198,179,198,177,177,179,177,162,162,168,168,168,162,168,162,167,168,162,162,160,169,162,171,162,162,162,162,160,160,160,159,159,73,
+84,84,82,84,82,82,84,84,84,81,85,83,85,81,82,84,82,84,82,84,88,85,85,82,84,84,84,84,84,84,84,88,84,89,88,88,89,88,85,90,90,88,54,7,43,33,6,5,33,20,13,16,148,150,143,148,122,16,47,144,120,122,15,106,46,138,33,2,2,11,6,6,6,7,13,31,33,14,30,5,7,119,124,11,37,106,120,36,151,153,127,111,124,138,132,33,30,30,22,43,114,186,140,147,132,17,6,21,118,30,116,137,132,136,130,110,36,139,120,2,5,6,2,38,2,11,11,43,2,11,119,37,120,36,120,47,124,110,47,47,132,31,46,144,154,119,46,85,89,89,90,85,92,87,98,98,98,103,98,156,103,159,103,156,160,156,156,160,162,160,156,160,156,160,160,160,162,161,156,160,156,160,160,98,103,98,96,92,92,91,101,91,90,91,91,91,92,91,92,92,92,101,92,93,98,98,103,98,103,98,98,98,98,103,156,160,103,156,156,160,156,98,103,159,156,169,171,173,179,179,179,194,179,179,179,194,179,198,198,179,198,179,179,198,179,199,200,200,199,203,199,199,198,179,168,168,162,162,169,168,162,169,169,171,168,171,177,198,179,202,200,204,201,203,201,205,204,201,201,204,201,201,203,204,200,202,179,198,177,194,173,171,169,171,162,162,168,162,162,162,162,162,162,162,160,168,162,162,162,160,162,160,162,160,156,160,156,156,156,71,
+81,84,81,84,81,81,84,82,81,81,85,81,81,82,81,84,81,88,84,84,84,84,88,85,84,84,84,82,84,84,84,88,85,85,88,88,85,88,88,88,85,85,85,7,5,2,2,6,29,17,17,138,153,152,150,144,125,112,24,132,119,20,109,34,120,127,13,2,11,2,7,6,6,11,17,46,33,16,116,1,2,130,126,3,45,130,114,106,151,148,127,125,126,125,128,31,109,18,36,116,151,183,153,132,46,13,115,125,136,33,47,130,141,150,120,8,119,133,17,1,6,2,2,25,1,2,12,1,6,37,132,47,120,118,106,132,141,109,29,106,20,113,140,124,120,130,65,90,89,90,86,90,91,91,92,98,98,98,98,103,98,98,103,160,156,160,160,160,156,160,156,161,160,156,160,160,156,160,161,156,160,160,98,103,98,98,98,96,92,91,90,91,91,91,91,102,91,92,96,91,102,91,96,102,92,101,98,98,92,101,96,96,91,96,96,98,98,98,102,96,92,92,92,92,98,98,160,169,169,173,171,173,173,173,171,171,171,169,173,179,173,173,171,173,179,198,202,179,179,198,202,179,179,173,169,160,160,156,159,160,156,160,162,160,160,169,171,179,194,203,198,204,201,200,204,204,204,204,204,204,200,204,200,179,198,198,177,171,168,169,169,168,162,160,162,161,162,162,162,162,162,169,169,162,162,162,162,160,162,162,162,160,160,160,160,103,98,103,98,72,
+81,81,84,84,81,81,85,81,81,81,81,81,82,84,82,84,82,84,84,84,82,84,84,82,82,84,82,84,81,84,84,84,84,84,88,85,84,84,84,88,88,88,95,51,2,2,5,2,13,22,109,150,153,150,128,125,139,153,122,132,132,31,18,110,132,15,5,2,2,11,2,7,14,123,126,116,37,11,106,2,6,106,144,22,30,116,110,34,145,144,132,127,125,151,151,24,106,33,45,141,149,142,153,122,15,21,138,153,142,132,114,147,114,132,138,130,138,110,6,2,2,9,2,2,2,6,5,2,2,130,130,44,130,117,47,47,123,33,33,136,153,124,149,30,65,86,90,86,84,88,90,91,90,91,91,87,97,96,98,98,98,103,98,159,103,159,160,161,160,160,160,98,103,160,161,161,160,161,156,160,156,98,103,98,92,96,98,101,92,92,91,92,91,101,92,102,92,91,92,92,92,91,91,92,92,92,92,91,91,92,91,91,90,79,92,91,92,92,87,92,91,90,91,92,92,87,98,98,159,97,160,161,168,162,160,168,162,162,156,169,173,162,169,169,171,173,194,202,194,179,179,194,162,167,156,156,98,98,98,160,156,98,98,97,159,156,173,194,202,179,198,199,198,200,202,200,200,200,200,200,200,199,199,202,194,169,171,162,162,162,160,156,162,156,160,156,162,156,160,162,162,160,169,160,156,160,160,160,161,160,156,161,156,103,98,156,98,98,98,72,
+81,81,81,56,84,81,81,81,81,85,80,81,85,84,81,82,81,81,82,82,84,84,84,81,88,84,82,81,84,84,84,84,84,88,84,84,84,88,85,88,85,88,90,84,1,5,2,2,13,34,123,152,150,145,152,126,126,153,142,114,51,11,18,33,18,2,2,5,6,2,10,6,106,124,126,24,34,8,31,11,2,47,116,15,30,110,15,47,138,137,114,126,183,183,125,46,34,33,36,144,137,128,154,145,15,11,133,136,124,126,141,148,183,116,151,136,140,149,164,75,11,2,2,6,1,6,2,2,2,47,109,106,119,46,114,116,114,13,141,137,140,43,87,82,91,85,90,84,84,86,90,91,85,90,90,90,91,92,96,92,103,98,103,98,159,156,160,156,161,160,98,160,103,160,156,160,160,161,160,161,156,103,103,97,96,92,102,92,96,91,91,91,92,101,101,92,96,91,91,92,91,91,91,91,91,92,91,91,90,86,92,91,91,90,90,91,90,91,90,89,91,90,91,91,91,92,92,92,97,101,98,98,98,156,98,98,159,160,98,156,160,160,156,162,162,160,171,179,173,169,177,169,162,160,98,98,97,92,98,98,103,98,98,98,156,162,169,194,179,198,202,179,198,198,202,179,199,203,203,196,198,179,198,179,177,169,162,162,162,160,162,160,160,160,156,160,160,160,162,156,162,160,156,160,160,156,160,160,160,156,160,156,98,98,98,98,101,101,92,71,
+81,81,81,81,56,81,81,81,81,85,83,81,81,85,81,81,85,84,81,82,82,81,82,84,81,84,81,84,81,84,84,84,84,84,84,84,84,88,88,81,88,88,89,100,5,2,2,5,21,120,126,150,144,145,141,35,144,153,145,125,110,17,24,32,6,6,1,2,11,6,7,11,22,122,124,7,12,29,23,11,2,36,109,8,16,22,18,110,138,128,142,145,149,153,19,34,43,22,29,130,153,143,153,110,111,151,8,130,144,133,153,153,151,137,37,117,45,67,62,38,9,2,5,25,5,11,11,2,2,47,124,120,126,111,46,142,140,17,120,132,183,131,90,90,85,85,85,82,85,89,90,90,85,90,85,91,91,92,92,98,103,98,103,160,160,160,156,98,103,98,103,103,98,98,98,101,98,103,98,160,98,98,102,98,96,91,92,92,91,92,92,91,92,102,92,101,91,91,91,91,91,95,92,91,91,90,91,91,91,89,86,90,86,95,90,90,89,90,85,90,91,89,90,82,91,91,91,91,92,92,98,98,101,96,101,92,98,98,98,98,96,98,98,160,156,160,168,162,171,171,171,168,160,98,96,92,92,96,96,98,93,98,98,160,160,161,162,177,173,173,179,198,179,202,179,202,202,179,202,179,202,179,171,171,168,168,160,160,160,160,156,160,160,156,160,161,160,156,160,156,160,160,160,160,156,160,160,159,103,98,103,98,98,93,102,92,96,92,92,62,
+81,81,81,81,81,81,56,81,81,83,85,81,81,81,56,85,81,81,85,81,81,84,81,84,84,84,84,81,84,82,84,84,84,81,84,84,84,84,84,84,88,88,89,100,25,2,5,2,2,106,144,124,144,148,3,22,185,148,122,188,197,121,11,6,5,2,1,7,7,10,2,2,29,126,125,6,21,22,106,11,2,48,136,11,22,114,132,123,153,186,186,154,151,143,125,22,31,21,13,136,154,153,138,45,46,46,116,144,132,110,183,133,123,132,29,46,60,85,82,58,12,9,1,10,5,5,29,11,2,30,46,47,114,111,20,133,15,46,130,184,185,86,89,85,90,86,90,85,88,85,86,88,88,85,89,91,91,91,101,92,98,103,98,103,98,98,98,98,98,96,91,92,97,96,91,91,92,98,98,96,101,98,87,91,91,95,90,91,91,91,91,91,91,91,87,91,91,91,91,86,95,91,91,91,91,91,90,89,85,91,90,91,90,89,76,91,85,90,89,90,89,89,90,91,91,90,91,91,92,96,92,92,92,92,92,92,101,92,97,92,91,92,98,156,103,162,162,162,168,168,162,161,97,97,92,92,92,92,96,101,101,98,98,160,159,162,169,171,171,171,179,173,194,179,179,194,173,194,173,194,177,171,171,169,162,160,160,156,156,156,103,156,156,159,160,159,160,103,156,98,160,162,156,160,156,98,98,98,98,98,101,101,97,102,92,92,96,96,90,58,
+56,81,56,81,81,56,84,81,81,56,81,81,81,85,81,81,81,88,81,81,85,81,81,81,81,81,81,88,81,84,84,84,84,81,88,84,84,84,84,84,84,85,88,90,53,2,2,2,5,31,127,144,150,140,8,14,132,138,11,36,138,8,1,6,11,2,1,10,12,11,11,5,119,151,29,13,37,17,117,2,2,130,136,6,37,137,132,151,186,186,153,186,145,150,142,8,11,6,17,139,144,149,114,14,47,46,141,147,126,134,153,19,24,131,29,81,90,88,88,90,40,58,28,5,10,2,26,9,21,134,182,182,191,120,67,34,46,47,141,191,87,90,86,90,90,89,91,85,85,90,85,86,89,90,86,90,91,91,91,92,96,93,98,98,98,98,98,96,101,91,91,91,91,92,85,91,91,91,91,89,91,91,90,90,90,86,90,91,91,91,91,92,91,91,90,91,91,91,91,91,86,91,90,91,92,91,91,90,92,90,92,91,85,91,89,90,91,85,86,89,89,89,90,91,90,91,90,91,91,87,101,92,92,91,92,92,91,91,91,91,91,87,101,98,98,160,156,103,156,160,169,156,102,92,92,92,96,92,92,96,98,98,103,93,156,156,156,169,169,169,169,173,173,171,171,173,171,177,173,171,168,169,168,168,162,162,156,160,160,103,97,98,98,98,98,156,103,159,103,160,156,160,156,103,97,98,97,101,98,97,97,101,98,97,97,92,92,97,96,58,
+81,81,81,81,81,81,81,81,81,81,56,81,81,81,56,88,81,81,56,85,81,81,81,85,81,82,82,81,84,84,84,84,84,84,81,84,88,85,84,84,88,84,88,85,85,26,2,5,2,30,144,151,146,153,148,34,132,10,2,5,1,2,1,5,2,2,1,13,1,10,12,8,187,45,2,21,50,2,126,11,2,133,32,2,30,119,132,149,186,153,153,144,141,138,151,6,6,6,6,148,119,148,45,30,46,106,145,140,30,136,130,115,136,44,59,71,89,84,88,90,63,95,61,13,5,5,5,14,148,180,180,45,151,141,144,181,31,149,193,158,90,91,89,91,91,90,90,85,85,91,85,90,90,90,85,89,90,90,85,91,90,90,92,92,91,92,92,91,91,95,90,91,90,89,91,90,90,91,89,91,90,90,85,85,86,90,85,90,91,91,92,91,90,91,91,91,91,91,91,91,91,91,91,92,92,91,90,90,86,91,90,92,90,90,90,91,85,89,85,85,89,89,91,89,90,79,91,91,90,91,91,91,89,91,90,92,91,91,91,91,90,91,92,98,98,92,98,101,103,156,160,160,97,92,96,92,92,96,98,98,98,98,98,98,103,98,156,160,156,162,169,169,169,162,169,173,171,177,171,169,162,168,162,162,168,162,160,160,156,98,98,98,98,98,98,98,103,98,98,98,103,156,98,103,98,98,97,93,102,92,98,98,98,98,96,93,102,91,92,71,
+81,80,82,81,81,81,56,82,81,81,81,81,81,80,81,81,81,81,81,81,81,81,81,81,81,85,81,84,81,82,84,84,81,84,85,84,81,81,88,84,84,84,88,88,85,99,2,2,12,30,132,144,148,150,122,141,5,6,2,2,5,1,2,2,12,2,1,2,5,6,2,14,140,110,2,21,29,2,137,17,2,130,20,2,43,106,147,153,186,154,144,136,108,139,116,2,13,11,11,151,132,144,8,29,119,133,124,109,30,119,132,149,93,96,95,90,85,88,88,88,88,89,100,40,5,11,26,40,197,182,141,119,185,130,182,154,187,149,158,85,91,85,90,89,91,91,91,90,91,89,91,89,85,88,89,89,91,85,90,86,90,89,91,88,91,91,91,95,90,89,89,90,89,91,90,89,91,89,91,90,85,86,85,91,90,82,86,90,91,91,91,91,91,96,92,91,91,91,90,90,91,91,92,92,91,91,91,91,91,89,91,90,86,90,91,89,85,89,89,89,85,86,90,91,90,85,91,89,92,91,91,90,91,91,91,91,91,91,91,85,91,91,91,92,91,91,92,92,97,98,160,156,98,96,102,92,92,92,96,97,98,97,92,96,96,96,98,98,98,156,161,162,168,169,169,171,173,171,173,169,169,168,162,162,160,161,156,160,156,98,98,98,98,98,103,93,156,98,97,101,98,98,101,97,97,101,98,101,92,96,97,92,97,97,101,102,93,93,101,71,
+81,81,56,82,82,81,81,81,83,56,81,81,83,85,81,81,81,81,81,56,81,81,81,85,81,81,81,85,84,84,84,84,84,84,83,85,85,81,88,85,84,85,84,88,85,83,21,26,13,16,106,151,142,143,94,26,9,2,5,2,1,2,1,2,10,2,1,6,10,12,6,106,151,114,2,10,13,5,130,8,2,37,114,2,21,48,153,154,153,145,125,138,132,116,124,7,145,114,17,124,130,148,13,34,124,136,136,30,24,132,134,91,91,91,89,91,89,85,85,84,84,84,84,99,71,72,13,13,181,186,191,121,117,147,149,141,70,87,90,86,90,90,91,91,91,90,92,89,89,90,85,89,89,84,89,88,85,88,90,90,90,89,89,88,89,89,89,85,91,89,88,91,85,91,85,91,85,95,90,85,89,90,90,90,89,85,90,91,91,91,91,90,91,92,91,92,91,91,91,90,91,92,96,92,92,91,91,90,86,92,91,91,90,89,85,89,88,85,85,89,89,89,90,90,91,90,90,90,91,90,91,92,92,91,91,91,92,91,91,91,90,90,91,91,90,79,91,91,92,98,103,98,103,92,92,92,91,92,96,92,96,92,92,92,92,92,92,96,98,98,161,156,162,162,169,169,168,168,168,162,162,162,162,160,159,156,98,98,98,98,98,98,97,97,98,98,103,98,97,97,98,97,97,102,92,101,92,97,101,92,101,102,93,92,97,93,101,102,93,71,
+81,81,80,81,81,56,84,82,81,81,81,56,81,81,56,81,81,81,56,84,56,81,81,81,82,81,81,81,82,84,82,82,85,81,85,81,81,81,85,81,81,83,85,81,88,85,59,21,22,32,153,93,71,69,85,6,2,2,2,9,5,1,2,11,2,2,1,2,5,9,21,141,132,21,6,1,2,2,36,113,2,47,37,2,36,120,154,153,145,146,150,31,106,116,15,11,144,145,115,140,133,31,13,36,34,141,22,15,36,69,95,90,91,90,90,85,85,88,88,84,84,84,84,88,90,85,63,64,40,130,180,185,147,67,130,192,90,88,85,91,90,91,89,90,86,91,90,89,91,85,95,89,89,85,89,85,84,88,89,88,89,82,84,84,88,85,89,89,84,89,91,85,90,89,91,90,90,86,85,91,85,91,95,85,86,90,91,91,90,90,89,92,91,96,96,91,91,91,91,91,91,92,92,96,102,91,90,89,91,90,90,85,85,89,89,85,86,89,84,89,84,90,86,89,90,90,89,89,91,91,90,89,86,90,92,91,92,90,91,88,90,86,88,90,89,90,91,91,97,98,98,98,98,96,91,91,92,91,91,92,92,91,91,92,91,91,91,92,98,98,98,98,156,160,169,169,168,162,160,156,160,162,160,98,156,98,97,98,102,93,98,98,97,98,98,97,98,97,98,103,98,97,97,92,92,92,92,92,101,97,97,101,92,97,102,93,97,98,97,71,
+81,56,81,81,56,81,81,81,56,82,56,81,56,81,81,81,80,81,81,81,81,85,83,85,85,82,81,85,81,85,84,81,81,81,88,81,88,81,81,81,85,90,81,81,88,88,63,50,85,85,86,84,84,84,80,6,7,2,6,2,2,2,5,1,11,1,2,2,6,10,37,133,181,8,2,6,6,7,43,130,11,45,30,5,30,130,136,136,148,144,140,6,32,124,11,13,136,146,147,116,147,24,34,33,132,29,36,65,64,58,89,89,85,90,89,85,89,88,85,84,84,84,85,90,85,90,86,100,57,11,129,131,77,76,86,86,89,89,90,90,91,85,91,90,91,91,91,89,90,91,85,89,89,89,85,88,84,89,90,85,86,88,88,84,85,86,89,88,89,89,85,91,89,95,89,86,90,90,85,90,89,85,85,91,85,91,85,91,85,91,91,91,91,92,92,91,91,91,91,91,97,96,101,91,91,91,91,90,86,95,91,89,89,89,89,85,85,85,85,88,85,90,85,86,90,86,88,91,85,91,90,90,90,91,85,92,90,86,89,89,85,89,88,90,89,85,91,92,92,92,96,101,92,91,91,91,91,91,91,91,91,91,91,89,90,76,96,91,92,98,98,103,156,156,161,162,160,160,159,103,156,156,103,98,98,97,92,92,92,101,98,98,97,92,96,101,101,97,98,98,98,98,91,91,91,91,91,91,92,101,91,92,92,101,91,92,101,97,92,72,
+56,81,82,81,56,81,56,56,81,80,81,81,81,81,56,81,81,84,56,81,81,81,81,81,83,56,85,81,81,85,80,85,81,88,81,81,81,88,81,81,81,81,83,85,81,81,81,88,81,88,85,85,88,85,90,6,2,2,7,2,2,5,2,5,21,34,2,5,1,21,132,140,148,18,22,11,11,10,21,132,11,27,39,10,16,116,136,138,144,122,148,29,29,22,2,30,146,140,136,136,144,130,141,34,151,44,40,95,84,88,90,89,89,89,88,88,88,88,85,88,85,84,88,85,90,91,90,85,91,82,85,85,90,90,85,89,89,89,88,95,90,90,88,91,90,91,90,90,91,85,91,85,84,85,89,85,89,90,85,89,84,89,85,89,85,90,85,89,90,85,90,90,91,89,91,90,85,91,85,91,90,90,91,90,85,89,91,85,91,90,89,92,92,92,92,91,92,92,91,91,91,92,92,91,91,91,91,89,91,85,85,89,84,84,88,88,84,88,82,84,88,85,90,85,85,85,90,90,90,85,89,89,89,89,90,90,90,85,89,89,89,85,86,89,89,90,91,91,91,87,96,91,92,92,85,90,91,91,91,91,91,91,89,79,95,89,86,92,92,92,98,98,103,98,98,98,98,103,98,98,97,98,92,92,92,92,91,91,91,92,96,98,92,96,96,96,96,92,101,92,97,101,97,91,91,91,91,92,91,91,91,92,92,92,92,101,92,97,97,72,
+81,81,80,81,81,84,81,81,56,81,81,56,81,56,84,56,82,81,81,81,81,84,81,81,81,83,85,83,81,83,85,81,81,81,83,85,83,81,81,81,81,81,81,81,81,83,85,88,81,81,88,81,88,81,83,11,2,2,9,5,2,2,2,2,5,29,2,2,6,22,139,120,17,124,114,16,11,2,123,190,2,12,9,2,29,106,106,106,136,144,43,29,119,29,11,123,125,142,133,133,116,133,138,110,22,21,58,88,84,84,88,84,88,88,85,84,84,85,88,84,88,89,89,88,89,90,90,82,89,85,88,88,89,88,85,89,90,82,88,88,88,85,90,90,85,90,86,95,90,90,90,85,85,88,88,88,89,90,90,91,85,89,85,90,85,86,90,84,88,90,86,95,89,90,85,91,88,85,91,85,91,91,85,85,89,90,89,89,86,85,90,91,92,91,90,91,91,85,92,91,91,92,96,91,90,91,92,90,89,91,85,86,88,84,84,84,84,84,84,84,82,84,88,90,82,88,88,89,89,85,88,90,89,90,91,85,89,89,88,89,89,85,90,86,89,88,90,90,90,90,86,91,90,89,91,79,90,91,91,91,92,90,92,90,90,90,92,91,91,92,92,96,97,98,101,92,96,92,92,92,101,92,92,91,91,91,86,91,91,91,92,98,96,92,92,92,92,92,91,92,91,92,101,92,92,91,91,91,91,91,91,91,91,91,91,92,92,91,92,71,
+56,81,56,81,56,81,56,81,84,81,56,81,81,81,81,81,81,56,82,81,81,81,81,81,81,81,81,81,81,56,81,83,81,81,81,81,81,81,81,56,85,81,81,81,81,81,81,81,83,81,83,81,83,81,99,10,25,6,2,2,2,6,2,2,2,30,2,6,1,36,144,136,132,116,11,15,6,11,16,11,11,11,2,2,11,13,31,46,125,17,33,47,180,43,134,108,109,132,114,149,123,147,46,66,75,57,84,82,84,81,85,84,84,88,84,84,88,88,85,88,88,89,89,85,88,85,88,88,85,88,89,85,90,90,88,85,88,88,85,84,84,88,90,83,90,90,90,88,91,90,89,89,85,88,84,84,88,90,89,85,90,90,85,91,90,90,85,89,90,88,90,90,85,89,88,84,89,90,91,90,89,85,91,90,86,89,90,90,90,90,91,91,92,92,90,92,90,91,90,91,92,92,101,91,91,91,90,86,90,90,90,82,85,84,84,84,84,84,84,82,82,84,84,88,84,84,84,84,88,84,84,88,90,86,90,89,89,89,89,84,85,88,85,89,89,89,90,85,91,90,90,85,91,90,90,91,90,90,92,90,92,85,91,85,91,89,79,90,91,91,92,97,92,92,92,92,91,91,92,92,92,92,91,91,91,91,91,91,91,91,92,96,92,92,91,91,91,91,91,91,91,91,92,92,86,91,86,91,91,92,92,91,91,91,91,91,91,91,91,62,
+81,56,82,56,81,56,81,56,56,81,81,80,56,82,56,82,84,81,56,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,83,84,81,81,83,81,81,81,81,81,81,81,90,1,2,9,2,5,9,2,2,2,12,119,17,2,5,117,147,116,122,8,15,24,17,13,29,10,2,12,9,5,21,17,29,47,110,14,134,24,34,138,46,29,33,151,144,144,119,116,35,91,82,56,81,81,88,81,81,83,84,81,88,84,81,88,84,84,88,84,88,84,84,84,84,88,88,88,88,88,89,89,85,89,89,88,84,85,81,90,81,88,85,90,81,88,85,90,85,88,85,88,85,85,90,89,90,88,89,89,90,90,86,85,88,90,81,88,88,89,85,84,85,84,84,88,90,85,91,90,89,85,90,90,90,85,86,88,91,85,90,86,91,91,90,91,85,90,86,92,96,91,90,86,90,90,90,85,85,85,88,82,84,88,85,82,84,85,84,84,84,88,85,84,84,84,84,84,84,84,89,85,90,90,86,89,89,89,89,89,84,89,89,89,89,85,86,89,89,89,85,89,85,90,86,91,82,91,89,95,89,91,89,95,89,91,91,91,92,92,91,91,91,91,91,91,87,92,91,91,91,91,91,91,91,91,91,91,96,96,92,91,91,90,91,91,91,91,91,91,92,92,91,91,91,91,92,92,91,91,91,91,92,91,92,91,91,58,
+56,81,80,82,81,81,56,84,81,56,81,81,81,81,81,81,56,84,82,84,81,81,81,81,81,81,56,84,81,81,81,81,81,81,81,81,81,81,80,81,81,81,81,81,81,81,81,81,81,81,81,81,83,81,83,2,5,9,2,2,2,21,6,6,2,43,126,3,2,30,17,34,29,2,15,127,127,125,109,10,13,2,2,2,7,106,140,133,21,21,106,142,146,151,109,10,37,151,140,36,48,74,57,83,81,80,81,84,81,81,81,81,81,81,81,88,88,84,81,81,88,85,85,88,85,88,84,84,84,84,84,84,88,89,90,88,88,85,84,88,85,81,88,81,85,81,88,85,88,88,88,81,88,85,81,88,88,85,88,85,88,90,88,90,90,88,85,81,88,85,88,85,88,81,84,84,88,91,85,91,90,89,91,90,85,88,85,85,89,88,90,90,91,90,90,91,85,89,89,90,90,90,96,90,92,91,85,91,90,89,89,88,88,85,84,81,88,81,85,81,88,81,84,82,84,84,84,84,84,84,84,88,90,89,86,89,85,89,89,89,90,89,89,89,89,89,86,88,85,85,89,89,85,86,90,90,85,91,91,90,90,86,95,85,91,89,92,85,91,91,91,91,91,91,89,91,91,91,91,91,91,91,91,91,91,92,91,92,96,92,92,92,92,92,91,79,89,91,91,91,91,86,91,91,91,91,91,92,91,91,91,91,92,91,91,87,91,91,91,58,
+81,81,81,81,56,56,81,56,56,84,56,81,84,56,81,81,56,81,81,56,81,81,80,81,81,56,81,56,81,81,81,81,81,80,82,81,81,81,81,81,81,81,81,81,84,56,81,81,81,80,81,81,81,81,88,26,9,9,5,2,10,21,11,2,2,22,138,15,10,30,129,6,2,2,24,125,128,124,126,109,106,106,6,6,48,149,138,130,30,21,109,122,181,182,8,5,119,136,33,50,63,81,81,81,80,81,81,81,81,81,81,81,81,81,89,81,81,81,83,88,88,81,81,81,81,85,81,84,85,88,85,84,84,88,88,84,84,85,83,85,88,85,88,85,85,88,81,81,88,85,88,85,83,85,81,81,81,83,88,88,85,83,85,88,81,81,81,81,81,81,81,88,81,88,85,85,84,88,90,89,90,90,84,84,85,88,90,81,84,84,89,89,89,90,86,85,90,89,90,85,90,91,88,91,89,90,91,85,86,89,84,84,84,84,84,81,81,81,83,85,80,85,84,84,84,84,84,84,84,84,84,84,89,88,85,90,89,89,90,89,88,85,89,89,89,90,85,91,90,91,85,89,85,90,86,91,90,89,92,85,86,90,90,91,90,89,85,89,91,91,91,91,79,90,79,90,90,91,91,91,91,91,86,92,92,92,92,92,91,92,92,92,91,91,91,91,91,91,92,91,91,91,86,91,91,91,91,91,92,92,92,91,91,91,91,91,91,91,86,58,
+56,81,56,82,81,84,81,56,81,81,56,81,56,81,80,82,81,81,56,56,84,81,81,81,84,81,56,82,81,81,82,81,81,81,56,81,56,56,81,81,81,81,81,81,81,81,80,81,80,81,80,81,81,81,56,81,6,10,7,9,12,7,9,11,2,12,21,10,12,21,13,11,5,11,116,132,145,115,123,46,130,109,21,119,116,116,43,46,26,21,130,137,184,118,2,6,106,132,60,81,81,81,81,81,80,81,81,83,81,81,81,81,81,81,81,81,81,84,81,81,81,81,88,81,81,88,81,85,83,82,84,81,85,84,84,82,88,88,85,81,81,81,81,85,83,81,81,81,81,81,81,81,88,81,81,81,81,81,83,81,81,81,90,80,81,81,81,81,81,81,81,81,81,81,88,81,88,85,85,88,85,88,85,84,84,84,81,85,84,81,88,89,89,90,90,89,84,88,85,89,91,88,89,85,91,90,85,90,85,89,89,88,84,84,81,88,81,81,81,81,88,84,84,84,85,84,81,82,84,82,84,84,84,89,89,88,85,86,88,89,86,89,86,89,90,85,85,89,90,86,91,89,90,90,91,91,86,91,82,91,90,91,85,91,91,90,90,85,90,90,91,91,90,90,90,91,91,91,91,91,91,91,91,86,91,91,92,91,92,92,91,91,91,91,91,91,91,82,91,86,91,91,91,91,91,91,91,91,91,92,91,91,91,91,91,91,86,86,95,57,
+81,81,84,56,81,56,84,81,81,56,81,56,81,56,81,81,56,81,81,56,81,81,56,56,81,56,81,81,80,80,56,81,81,81,81,80,82,80,82,56,81,81,80,80,80,61,81,81,81,81,81,81,80,81,80,99,10,2,10,2,2,29,32,2,6,9,27,10,2,5,10,13,10,11,119,116,122,116,111,21,47,18,110,120,106,181,144,45,39,26,30,181,138,8,2,21,149,66,58,81,81,80,81,81,81,81,81,84,80,81,80,81,81,81,81,81,83,81,81,81,83,81,81,88,81,81,88,81,81,90,84,83,81,85,88,85,81,81,81,88,81,88,88,81,83,85,88,80,81,81,81,81,81,81,83,80,56,81,81,81,81,83,81,81,81,83,80,81,81,85,81,81,83,81,81,83,85,83,89,88,88,89,85,84,84,88,81,85,88,85,84,88,88,88,85,88,85,88,85,88,84,88,85,84,88,91,88,88,85,88,85,84,84,81,84,85,81,81,81,81,85,81,84,84,84,85,85,84,84,84,82,84,84,88,82,90,89,89,85,91,85,85,90,90,89,86,91,91,91,91,90,79,91,91,91,90,91,90,89,91,90,86,92,91,91,91,90,90,86,91,91,91,91,91,91,90,90,91,91,91,86,91,91,91,91,91,92,92,92,92,91,91,91,91,91,86,91,91,86,91,91,91,91,91,91,91,92,91,92,86,91,91,86,90,91,91,92,90,89,58,
+81,56,56,81,56,81,81,81,56,82,56,56,56,81,81,61,81,56,84,56,81,56,81,56,81,81,81,56,81,81,81,81,81,81,80,56,56,61,83,82,56,82,80,80,82,56,56,80,82,80,81,80,81,80,81,81,54,2,2,9,10,17,106,17,2,6,5,5,2,62,40,15,11,9,6,46,138,147,109,11,141,32,138,46,141,132,119,46,11,2,29,132,141,11,2,22,77,81,81,80,81,81,80,80,81,80,80,61,81,81,81,80,81,80,81,81,80,84,81,81,81,81,81,90,83,81,81,81,81,81,81,81,81,84,81,81,81,88,81,88,85,88,81,81,81,81,83,85,83,85,81,81,81,81,81,81,81,81,80,81,81,81,83,81,81,83,81,81,83,81,83,85,81,81,81,81,81,81,81,88,88,85,88,85,88,81,81,81,85,81,88,84,84,84,84,88,85,84,84,81,84,84,84,84,89,90,89,85,84,84,84,84,84,84,84,80,81,88,81,81,81,88,84,82,88,82,88,85,89,89,84,84,84,84,89,88,89,85,91,85,92,91,90,91,86,90,91,91,91,91,91,91,91,91,91,86,90,86,91,91,91,92,91,101,96,92,92,92,92,92,92,92,91,91,91,86,91,86,90,79,90,91,91,86,92,91,91,91,92,91,91,91,91,91,91,91,91,91,91,91,91,91,92,92,91,91,91,91,91,91,90,89,86,91,90,86,86,86,91,58,
+56,84,82,81,82,81,56,81,56,80,81,56,82,56,56,80,61,80,56,81,81,56,82,81,56,80,56,82,56,81,56,81,56,80,56,80,80,80,56,80,80,80,81,80,80,80,80,81,80,80,61,81,81,81,81,81,81,6,9,5,5,43,130,136,6,53,26,54,2,2,2,18,22,2,6,36,136,126,118,13,141,34,120,43,136,136,134,30,26,2,141,119,29,2,117,187,80,80,61,81,80,81,81,81,81,81,81,80,80,81,81,80,80,61,83,81,81,81,81,81,81,81,81,81,81,81,81,81,88,81,88,81,81,81,81,81,81,81,90,80,81,81,81,81,81,81,81,83,81,81,83,85,81,81,81,80,81,81,80,80,81,83,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,88,85,88,81,88,81,81,85,83,81,81,85,88,84,84,84,84,88,85,84,88,82,84,84,84,85,90,89,84,84,84,84,84,84,81,84,81,81,81,88,81,84,81,84,82,84,88,85,85,84,89,84,85,84,84,84,89,89,90,90,86,90,91,89,92,91,91,91,91,91,91,92,91,91,91,91,91,91,92,91,91,92,92,92,92,96,92,92,92,91,92,92,91,91,91,91,91,91,91,90,90,90,86,91,91,91,90,86,91,91,91,91,91,91,91,91,91,91,91,91,91,92,92,91,91,91,91,91,91,89,91,90,91,86,90,89,91,89,90,85,62,
+56,81,81,80,56,56,56,81,56,61,56,80,56,56,82,56,81,56,56,63,80,80,56,56,63,80,56,61,63,81,80,61,80,80,61,80,56,80,61,81,80,80,61,81,80,56,80,61,81,80,80,56,80,61,81,80,81,51,2,2,9,46,123,136,42,88,82,83,2,6,2,29,111,112,16,116,133,182,111,29,132,119,130,139,46,43,48,197,147,122,49,120,32,26,78,80,56,81,80,56,80,81,61,83,56,80,82,80,56,83,80,80,83,80,61,56,81,81,81,81,81,81,81,81,81,80,80,81,81,81,81,84,81,81,83,81,81,81,83,88,83,81,81,85,81,81,85,81,83,81,81,81,81,83,81,80,81,81,81,56,80,81,56,81,81,81,81,81,81,83,81,81,81,81,56,81,81,81,81,81,81,88,81,81,81,81,83,81,88,82,84,84,84,85,84,84,88,84,81,84,81,84,84,84,88,85,84,84,82,84,82,81,81,84,81,81,56,81,81,85,81,84,84,84,84,84,88,88,85,85,84,84,85,89,85,85,91,90,91,82,91,90,91,90,90,91,90,91,91,91,86,91,90,91,91,91,92,91,92,91,92,92,92,92,92,91,91,92,92,92,101,92,96,93,92,92,96,91,91,86,91,90,90,92,86,79,91,95,90,91,91,90,86,91,91,91,91,91,87,92,91,92,91,92,91,91,91,91,91,90,79,89,85,86,91,86,89,91,85,58,
+81,56,56,56,82,56,81,56,81,56,80,56,82,56,56,80,82,56,61,56,56,63,80,56,61,80,56,80,80,56,56,81,80,56,80,80,80,56,80,80,56,80,56,80,80,80,56,56,80,80,56,80,80,56,80,80,61,83,26,2,2,129,124,132,77,80,80,85,26,1,2,5,29,18,132,32,110,141,114,47,138,32,70,138,120,44,193,134,176,180,17,130,82,81,80,80,80,56,80,82,80,56,80,80,80,80,80,80,80,81,56,81,83,80,80,81,83,81,81,80,81,81,81,81,81,81,80,81,80,81,81,56,84,81,81,81,81,81,83,81,90,83,81,83,81,83,81,81,83,81,81,81,81,81,83,81,81,81,81,83,81,56,84,81,80,81,81,81,81,81,81,80,56,82,81,80,81,81,81,88,81,84,81,56,81,81,81,81,84,84,84,84,88,88,84,84,84,84,84,81,88,85,84,84,84,84,88,84,81,84,81,84,82,81,84,81,81,81,83,81,85,84,84,84,82,84,84,84,84,84,88,84,85,82,89,89,89,89,85,90,85,85,89,85,89,89,90,91,90,90,89,91,91,92,90,91,86,86,92,91,91,91,91,91,91,79,91,91,91,92,92,92,97,96,92,97,92,92,91,91,89,86,92,90,90,85,85,90,85,86,85,90,90,91,85,91,91,91,91,91,92,91,91,91,86,91,91,79,91,90,90,91,91,89,91,89,92,90,85,58,
+81,82,81,81,81,56,56,56,56,84,56,80,56,81,56,56,56,56,56,80,56,56,56,80,80,56,56,56,81,80,80,56,56,80,80,56,81,80,80,56,80,80,80,80,56,81,80,80,56,80,80,81,80,80,80,56,80,80,81,11,5,119,133,157,80,80,81,81,54,29,1,12,2,43,123,120,120,126,29,119,69,61,29,192,188,130,132,129,120,43,58,56,80,81,80,80,56,80,80,80,81,80,81,80,56,81,80,80,56,56,81,80,80,81,81,81,81,81,80,81,81,80,81,81,80,81,80,81,81,80,81,83,81,81,84,81,81,81,81,81,83,81,81,81,81,81,81,81,83,81,83,80,81,81,81,81,56,81,81,81,80,83,81,80,81,81,81,81,81,81,81,81,81,80,81,81,80,81,82,80,81,81,81,81,81,81,81,81,81,88,84,84,84,84,82,84,84,84,88,81,81,81,88,84,84,84,81,82,81,84,81,81,81,81,84,81,81,81,81,81,81,84,81,81,84,84,84,84,84,85,84,84,88,88,89,84,84,88,89,88,84,85,84,88,82,89,89,85,90,89,90,91,90,86,91,91,90,86,86,92,91,90,91,91,91,91,90,91,91,91,92,92,92,96,96,96,96,91,91,91,91,90,85,86,89,89,90,91,90,82,91,85,86,86,90,91,91,91,91,91,91,87,92,91,91,91,86,95,90,90,79,89,90,90,90,91,89,91,82,57,
+82,82,81,84,82,56,82,81,81,56,56,56,56,56,81,56,80,56,56,56,56,56,80,56,56,80,56,56,56,56,56,80,56,80,56,80,56,80,56,80,56,56,80,56,80,56,80,56,80,56,80,56,56,80,56,80,56,80,56,56,38,67,72,56,80,56,56,81,56,35,141,33,2,10,45,132,144,141,64,82,80,56,80,52,38,65,65,85,58,80,56,80,56,80,56,81,80,56,80,56,80,56,80,56,80,56,80,56,80,56,80,56,81,80,80,81,80,83,80,81,81,81,81,81,81,80,81,80,83,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,80,81,81,81,81,81,80,81,81,80,81,81,80,81,81,81,83,80,80,81,80,81,81,81,81,80,81,80,81,81,81,81,88,84,81,81,88,81,82,81,84,82,82,81,81,81,81,81,88,84,84,82,84,81,84,81,81,81,81,81,81,81,81,81,81,81,81,88,81,84,81,88,84,84,84,84,84,84,84,88,84,84,84,88,85,84,84,84,84,84,84,84,89,84,89,89,85,90,90,90,85,91,90,91,89,92,79,90,91,91,91,91,91,91,91,91,92,92,92,92,92,91,91,91,91,90,86,85,89,85,86,85,86,91,89,85,90,85,90,91,82,86,91,90,91,91,91,91,91,91,91,91,91,79,91,90,91,79,90,91,79,90,91,89,58,
+82,81,82,81,81,56,81,56,56,56,81,56,81,56,56,56,56,80,80,80,56,80,56,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,56,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,81,80,6,14,28,39,133,149,157,80,80,80,56,80,80,81,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,81,80,81,80,81,83,80,80,56,80,80,81,83,56,81,80,81,80,81,81,83,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,80,80,80,81,81,80,81,81,81,56,83,80,56,80,83,56,83,81,80,80,81,81,81,83,81,80,81,81,81,81,81,80,81,81,81,81,81,81,84,81,81,84,84,81,84,84,84,81,81,81,81,81,84,84,84,84,81,84,81,84,81,81,82,81,81,81,81,56,81,81,81,81,81,81,84,81,84,81,82,81,82,84,84,81,81,84,82,84,84,84,84,84,84,84,84,84,84,84,84,84,89,89,90,89,89,85,89,90,90,90,90,90,91,90,91,90,90,91,91,92,92,92,91,92,91,91,91,90,90,90,90,90,85,90,89,89,90,85,89,89,85,89,85,89,90,90,85,91,90,86,90,90,86,90,85,86,90,85,85,90,90,90,90,86,90,90,90,90,58,
+};
+
+MWIMAGEHDR image_rle8 = {
+  320, 200,	/* width, height*/
+  1, 8,		/* planes, bpp*/
+  320, 1,	/* pitch, bytesperpixel*/
+  1, 256,	/* compression, palsize*/
+  -1L,		/* transcolor*/
+  palette,
+  imagebits,
+};
Binary files lib/microwindows/src/mwin/bmp/stdpal4.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/stdpal4.bmp differ
Binary files lib/microwindows/src/mwin/bmp/tux.gif and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/tux.gif differ
Binary files lib/microwindows/src/mwin/bmp/under4.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/under4.bmp differ
diff -urN lib/microwindows/src/mwin/bmp/under4.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/under4.c
--- lib/microwindows/src/mwin/bmp/under4.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/under4.c	2005-02-21 16:13:24.000000000 +0100
@@ -0,0 +1,59 @@
+/* Generated by convbmp*/
+#include "device.h"
+
+/* MWIMAGEHDR image_under4 converted from under4.bmp*/
+
+static MWPALENTRY palette[16] = {
+  RGBDEF(   0,   0,   0 ),	/* pal 0*/
+  RGBDEF( 191,   0,   0 ),	/* pal 1*/
+  RGBDEF(   0, 191,   0 ),	/* pal 2*/
+  RGBDEF( 191, 191,   0 ),	/* pal 3*/
+  RGBDEF(   0,   0, 191 ),	/* pal 4*/
+  RGBDEF( 191,   0, 191 ),	/* pal 5*/
+  RGBDEF(   0, 191, 191 ),	/* pal 6*/
+  RGBDEF( 192, 192, 192 ),	/* pal 7*/
+  RGBDEF( 128, 128, 128 ),	/* pal 8*/
+  RGBDEF( 255,   0,   0 ),	/* pal 9*/
+  RGBDEF(   0, 255,   0 ),	/* pal 10*/
+  RGBDEF( 255, 255,   0 ),	/* pal 11*/
+  RGBDEF(   0,   0, 255 ),	/* pal 12*/
+  RGBDEF( 255,   0, 255 ),	/* pal 13*/
+  RGBDEF(   0, 255, 255 ),	/* pal 14*/
+  RGBDEF( 255, 255, 255 ),	/* pal 15*/
+};
+
+static MWUCHAR imagebits[] = {
+0x03,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33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0x00,0x03,0xbb,0xbb,0x30,0x00,0x3b,0xbb,0x30,0x30,0x01,0x30,0x03,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x3b,0xbb,0xb3,0x00,0x00,0x00,0x03,0xbb,0x30,0x00,0x03,0xbb,0xbb,0xb3,0x30,0x00,0x33,0x03,0xbb,0xbb,0xbb,0xbb,0xb3,0x30,0x03,0x30,0x3b,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x0b,0xbb,0xb3,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x0b,0x00,0x3b,0xbb,0xbb,0xb0,0x00,0x00,0xbb,0xbb,0xb3,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xb3,0x00,0xbb,0xbb,0xb3,0x00,0x03,0xbb,0xbb,0xb0,0x00,0x03,0xbb,0xb3,0x00,0x00,0x00,0x33,0x00,0x03,0xbb,0xbb,0xb3,0x00,0x00,0x00,0xb3,0x00,0x00,0x3b,0xb3,0x00,0x00,0x00,0x3b,0xb0,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x3b,0x30,0x03,0xbb,0xbb,0xb3,0x00,0x03,0xb3,0x00,0x03,0xbb,0xbb,0x30,0x00,0x3b,0xbb,0xbb,0x00,0x00,0x3b,0xbb,0x30,0x00,0x33,0xb3,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x3b,0xbb,0xb3,0x00,0x00,0x00,0x03,0xb3,0x00,0x00,0x00,0x3b,0xbb,0x30,0x00,0x00,0x33,0x30,0x0b,0xbb,0xbb,0xbb,0x30,0x00,0x3b,0x33,0x00,0x3b,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x3b,0xbb,0xb3,0x00,0x00,0x00,0x03,0xbb,0xbb,0x30,0x00,0x3b,0x30,0x00,0x3b,0xbb,0xb3,0x00,0x03,0xbb,0xbb,0x30,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xbb,0x30,0x3b,0xbb,0xbb,0x30,0x0b,0xbb,0xbb,0x30,0x00,0x03,0xbb,0xbb,0x30,0x00,0x00,0x3b,0x30,0x00,0x3b,0xbb,0xbb,0x00,0x00,0x00,0xbb,0xb3,0x00,0x3b,0xbb,0x00,0x00,0x00,0xbb,0x30,0x00,0x00,0x30,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x03,0xbb,0xbb,0x30,0x3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,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xb3,0x03,0xb3,0x00,0x00,0x0b,0xbb,0x30,0x00,0x00,0xbb,0xbb,0x03,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xbb,0x30,0x3b,0xbb,0xbb,0x30,0x00,0x03,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xb0,0x00,0x00,0x3b,0xbb,0xb0,0x00,0x00,0x0b,0xbb,0xbb,0x30,0xbb,0xbb,0x30,0x00,0x03,0xbb,0xbb,0xbb,0x33,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xbb,0x30,0x00,0x03,0xbb,0xb3,0x00,0x00,0x3b,0xbb,0x30,0x3b,0xbb,0xb0,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xbb,0xbb,0x03,0xbb,0xbb,0xb0,0x3b,0xbb,0x30,0x00,0x00,0x03,0xbb,0xbb,0x30,0x00,0x00,0x3b,0x30,0x00,0x00,0x3b,0xbb,0x00,0x00,0x00,0xbb,0xb3,0xb3,0x3b,0xbb,0x00,0x00,0x00,0xbb,0x30,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x3b,0xb3,0x00,0x00,0x0b,0xbb,0x30,0x00,0x00,0x3b,0xbb,0x03,0xbb,0xb3,0x00,0x00,0x00,0x3b,0xbb,0x30,0xbb,0xbb,0x33,0x00,0x00,0x03,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xb0,0x00,0x00,0x3b,0xbb,0xb0,0x00,0x00,0x0b,0xbb,0xbb,0x30,0x3b,0xbb,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xbb,0x00,0x00,0x03,0xbb,0xb3,0x00,0x00,0x0b,0xbb,0x30,0x3b,0xbb,0x30,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xbb,0xbb,0x03,0xbb,0xbb,0xb0,0x3b,0xbb,0x00,0x00,0x00,0x0b,0xbb,0xbb,0x30,0x00,0x00,0x3b,0x30,0x00,0x00,0x3b,0xbb,0x00,0x00,0x00,0xbb,0x30,0xbb,0xbb,0xbb,0x00,0x00,0x00,0xbb,0x30,0x00,0x00,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x0b,0xbb,0x30,0x00,0x00,0x3b,0xbb,0x03,0xbb,0xb0,0x00,0x00,0x00,0xbb,0xbb,0x33,0xbb,0x33,0x00,0x00,0x00,0x03,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xb0,0x00,0x00,0x3b,0xbb,0xb0,0x00,0x00,0x0b,0xbb,0xbb,0x30,0x3b,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xb3,0x00,0x00,0x03,0xbb,0xb3,0x00,0x00,0x03,0xbb,0x30,0x3b,0xbb,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xbb,0xbb,0x03,0xbb,0xbb,0xb0,0x3b,0xb3,0x00,0x00,0x00,0x3b,0xbb,0xbb,0x30,0x00,0x00,0x3b,0x30,0x00,0x00,0x0b,0xbb,0x00,0x00,0x00,0xbb,0x00,0xbb,0xbb,0xbb,0x00,0x00,0x00,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x0b,0xbb,0x30,0x00,0x00,0x3b,0xbb,0x03,0xbb,0x30,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0x30,0x00,0x03,0xbb,0xbb,0xb0,0x00,0x00,0x0b,0xbb,0xbb,0x30,0x3b,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xb3,0x00,0x00,0x03,0xbb,0xb3,0x00,0x00,0x03,0xbb,0x30,0x3b,0xb3,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xbb,0xbb,0x03,0xbb,0xbb,0xb0,0x3b,0xb0,0x00,0x00,0x00,0xb3,0xbb,0xbb,0x30,0x00,0x00,0x3b,0x30,0x00,0x00,0x0b,0xbb,0x00,0x00,0x00,0xb3,0x00,0xbb,0xbb,0xbb,0x00,0x00,0x00,0xb0,0x00,0x33,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x0b,0xbb,0x30,0x00,0x00,0x3b,0xbb,0x03,0xbb,0x00,0x00,0x00,0x0b,0x3b,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x33,0x00,0x03,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x0b,0xbb,0xbb,0x30,0x3b,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xb3,0x00,0x00,0x03,0xbb,0xb3,0x00,0x00,0x03,0xbb,0x30,0x3b,0x30,0x00,0x00,0x03,0x33,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xbb,0xbb,0x03,0xbb,0xbb,0xb0,0x3b,0x30,0x00,0x00,0x03,0x33,0xbb,0xbb,0x30,0x00,0x00,0x3b,0x30,0x00,0x00,0x0b,0xbb,0x00,0x00,0x00,0xb0,0x00,0xbb,0xbb,0xbb,0x00,0x00,0x00,0xb3,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x0b,0xbb,0x30,0x00,0x00,0x3b,0xbb,0x03,0xb3,0x00,0x00,0x00,0x33,0x3b,0xbb,0xb0,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0x30,0x00,0x3b,0xbb,0xbb,0xb0,0x00,0x00,0x0b,0xbb,0xbb,0x30,0x3b,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xb3,0x00,0x00,0x03,0xbb,0xb3,0x00,0x00,0x03,0xbb,0x30,0x3b,0x00,0x00,0x00,0x0b,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xbb,0xbb,0x03,0xbb,0xbb,0xb0,0x3b,0x00,0x00,0x00,0x3b,0x03,0xbb,0xbb,0x30,0x00,0x00,0x3b,0x30,0x00,0x00,0x3b,0xbb,0x00,0x00,0x00,0xb3,0x00,0xbb,0xbb,0xbb,0x00,0x00,0x00,0xbb,0x30,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x0b,0xbb,0x30,0x00,0x00,0x3b,0xbb,0x03,0xb0,0x00,0x00,0x03,0xb0,0x3b,0xbb,0x30,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xb0,0x00,0x00,0xbb,0xbb,0xb0,0x00,0x00,0x0b,0xbb,0xbb,0x30,0x3b,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xb3,0x00,0x00,0x03,0xbb,0xb3,0x00,0x00,0x03,0xbb,0x30,0x33,0x00,0x00,0x00,0x33,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xbb,0xbb,0x03,0xbb,0xbb,0xb0,0x33,0x00,0x00,0x00,0x3b,0x03,0xbb,0xbb,0x30,0x00,0x00,0x3b,0x30,0x00,0x00,0x3b,0xbb,0x00,0x00,0x00,0xbb,0x30,0xbb,0xbb,0xbb,0x00,0x00,0x00,0xbb,0x30,0x00,0x00,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xb3,0x0b,0xb0,0x00,0x00,0x0b,0xbb,0x30,0x00,0x00,0x3b,0xbb,0x03,0x30,0x00,0x00,0x03,0xb0,0x3b,0xbb,0x30,0x00,0x00,0x00,0x03,0xbb,0xbb,0xb3,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xb3,0xbb,0x30,0x00,0x00,0x3b,0xb0,0x00,0x00,0x3b,0xbb,0xb0,0x00,0x00,0x0b,0xbb,0xbb,0x30,0x3b,0xbb,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x33,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xb3,0xbb,0x30,0x00,0x00,0x3b,0xb3,0x00,0x00,0x03,0xbb,0xb3,0x00,0x00,0x03,0xbb,0x30,0xb0,0x00,0x00,0x00,0xb3,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xbb,0xbb,0x03,0xbb,0xbb,0xb3,0x30,0x00,0x00,0x03,0xbb,0x03,0xbb,0xbb,0x30,0x00,0x00,0x3b,0x30,0x00,0x00,0x3b,0xbb,0x00,0x00,0x00,0xbb,0xb3,0xb3,0xbb,0xbb,0x00,0x00,0x00,0xbb,0x30,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x03,0xbb,0xbb,0xb3,0x03,0xb3,0x00,0x00,0x0b,0xbb,0x30,0x00,0x00,0x3b,0xbb,0x33,0x00,0x00,0x00,0x3b,0xb0,0x3b,0xbb,0x30,0x00,0x00,0x33,0xbb,0xb3,0x3b,0xb0,0x3b,0xb3,0x00,0x00,0x03,0xbb,0x30,0xbb,0x30,0x00,0x00,0x3b,0xb0,0x00,0x00,0x3b,0xbb,0xb0,0x00,0x00,0x0b,0xbb,0xbb,0x30,0x3b,0xbb,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x03,0xb3,0x0b,0xb3,0x00,0x00,0x03,0xbb,0x30,0x3b,0x30,0x00,0x00,0x3b,0xbb,0x00,0x00,0x03,0xbb,0xb3,0x00,0x00,0x0b,0xbb,0x33,0x30,0x00,0x00,0x03,0xb3,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xbb,0xbb,0x03,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x0b,0xbb,0x03,0xbb,0xbb,0x30,0x00,0x00,0x3b,0x30,0x00,0x00,0xbb,0xbb,0x00,0x00,0x00,0xbb,0xbb,0x30,0x3b,0xbb,0x00,0x00,0x00,0xbb,0x30,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x03,0xbb,0xbb,0xb0,0x03,0xb3,0x00,0x00,0x0b,0xbb,0x30,0x00,0x00,0xbb,0xbb,0xb0,0x00,0x00,0x00,0xbb,0xb0,0x3b,0xbb,0x30,0x00,0x03,0xbb,0xbb,0xb0,0x3b,0xb0,0x0b,0xb3,0x00,0x00,0x03,0xbb,0x00,0xbb,0x30,0x00,0x00,0x3b,0xb0,0x00,0x00,0x3b,0xbb,0xb0,0x00,0x00,0x0b,0xbb,0xbb,0x30,0x3b,0xbb,0x30,0x00,0x03,0xbb,0xbb,0xb3,0x03,0xb3,0x0b,0xb3,0x00,0x00,0x03,0xbb,0x30,0x3b,0x30,0x00,0x00,0x3b,0xbb,0x30,0x00,0x03,0xbb,0xb3,0x00,0x00,0x3b,0xbb,0xbb,0x00,0x00,0x00,0x0b,0xb3,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x10,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xbb,0xbb,0x03,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x3b,0xbb,0x03,0xbb,0xbb,0x30,0x00,0x00,0x3b,0x30,0x00,0x03,0xbb,0xbb,0x00,0x00,0x00,0xbb,0xbb,0x30,0x3b,0xbb,0x00,0x00,0x00,0xbb,0x30,0x00,0x00,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x03,0xbb,0xbb,0x30,0x03,0xbb,0x00,0x00,0x0b,0xbb,0x30,0x00,0x03,0xbb,0xbb,0x30,0x00,0x00,0x03,0xbb,0xb0,0x3b,0xbb,0x30,0x00,0x3b,0xbb,0xbb,0x30,0x3b,0xb0,0x0b,0xb3,0x00,0x00,0x03,0xbb,0x00,0xbb,0x30,0x00,0x00,0x3b,0xb0,0x00,0x00,0x3b,0xbb,0xb0,0x00,0x00,0x0b,0xbb,0xbb,0x30,0x3b,0xbb,0xb0,0x00,0x03,0xbb,0xbb,0xb0,0x03,0xb3,0x03,0xb3,0x00,0x00,0x03,0xbb,0x00,0x3b,0x30,0x00,0x00,0x3b,0xbb,0xb0,0x00,0x03,0xbb,0xb3,0x00,0x00,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x3b,0xb3,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x3b,0xbb,0xb3,0x00,0xbb,0xbb,0xb0,0x00,0x00,0x00,0xbb,0xb3,0x00,0xbb,0xbb,0x30,0x00,0x00,0x3b,0x30,0x00,0x3b,0xbb,0xbb,0x00,0x00,0x00,0xbb,0xb3,0x00,0x3b,0xbb,0x00,0x00,0x00,0xbb,0x30,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x03,0xbb,0xb3,0x00,0x03,0xbb,0x30,0x00,0x0b,0xbb,0x30,0x00,0x3b,0xbb,0xbb,0x00,0x00,0x00,0x0b,0xbb,0x30,0x0b,0xbb,0xb0,0x00,0x0b,0xbb,0xb3,0x00,0x3b,0xb0,0x03,0xb3,0x00,0x00,0x03,0xb3,0x00,0xbb,0x30,0x00,0x00,0x3b,0x30,0x00,0x00,0x3b,0xbb,0xb0,0x00,0x00,0x0b,0xbb,0xbb,0x30,0x3b,0xbb,0xb3,0x00,0x00,0xbb,0xbb,0x30,0x03,0xb3,0x00,0xb3,0x00,0x00,0x03,0xb3,0x00,0x3b,0x30,0x00,0x00,0x3b,0xbb,0xb3,0x00,0x00,0xbb,0xb0,0x00,0x03,0xbb,0xbb,0x30,0x00,0x00,0x03,0xbb,0xb3,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x3b,0xbb,0x30,0x00,0x3b,0xb3,0x00,0x00,0x00,0x03,0xbb,0x30,0x00,0x3b,0xb3,0x00,0x00,0x00,0x33,0x00,0x03,0xbb,0xbb,0xb3,0x00,0x00,0x00,0xb3,0x00,0x00,0x3b,0xb3,0x00,0x00,0x00,0xb3,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x3b,0x30,0x00,0x03,0xbb,0xb3,0x00,0x03,0xb3,0x00,0x03,0xbb,0xbb,0x30,0x00,0x00,0x00,0x3b,0xb3,0x00,0x03,0xbb,0xbb,0x00,0x03,0xbb,0x30,0x00,0x3b,0xb0,0x00,0x33,0x00,0x00,0x03,0x30,0x00,0xb3,0x00,0x00,0x00,0x33,0x00,0x00,0x03,0xbb,0xbb,0x30,0x00,0x00,0x03,0xbb,0xb3,0x00,0x03,0xbb,0xbb,0x30,0x00,0x3b,0x33,0x00,0x03,0xb3,0x00,0x33,0x00,0x00,0x03,0xb0,0x00,0x33,0x00,0x00,0x00,0x03,0xbb,0xbb,0x30,0x00,0x3b,0x30,0x00,0x3b,0xbb,0xb3,0x00,0x00,0x00,0x0b,0xbb,0x30,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x30,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,0x00,0x03,0xbb,0x30,0x00,0x03,0xb3,0x00,0x00,0x00,0x0b,0xbb,0x30,0x00,0x03,0xb0,0x00,0x00,0x00,0x33,0x03,0x3b,0xbb,0xbb,0x30,0x00,0x00,0x00,0xb0,0x00,0x00,0x3b,0x30,0x00,0x00,0x00,0xb0,0x00,0x33,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x30,0x33,0x03,0x33,0x03,0xbb,0xbb,0xb3,0x00,0x31,0x03,0x3b,0xbb,0xbb,0x30,0x00,0x00,0x00,0xbb,0xb3,0x00,0x00,0x3b,0xbb,0xb3,0x00,0x33,0x00,0x30,0x3b,0xb0,0x00,0x33,0x00,0x00,0x03,0x30,0x00,0xb3,0x00,0x00,0x00,0x33,0x00,0x03,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x3b,0xb0,0x00,0x00,0xbb,0xbb,0xbb,0x30,0x03,0x10,0x33,0x03,0xb3,0x00,0x33,0x00,0x00,0x03,0x30,0x00,0x33,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0x30,0x0b,0x00,0x3b,0xbb,0xbb,0xb0,0x00,0x00,0x00,0x3b,0xbb,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xb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00,0x00,0x00,0x00,0x00,0x3b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xbb,0xb0,0x00,0x00,
+};
+
+MWIMAGEHDR image_under4 = {
+  462, 23,	/* width, height*/
+  1, 4,		/* planes, bpp*/
+  232, 1,	/* pitch, bytesperpixel*/
+  1, 16,	/* compression, palsize*/
+  -1L,		/* transcolor*/
+  palette,
+  imagebits,
+};
Binary files lib/microwindows/src/mwin/bmp/win/button.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/win/button.bmp differ
Binary files lib/microwindows/src/mwin/bmp/win/chkbox.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/win/chkbox.bmp differ
Binary files lib/microwindows/src/mwin/bmp/win/chkbox_d.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/win/chkbox_d.bmp differ
Binary files lib/microwindows/src/mwin/bmp/win/edit.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/win/edit.bmp differ
Binary files lib/microwindows/src/mwin/bmp/win/radio.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/win/radio.bmp differ
Binary files lib/microwindows/src/mwin/bmp/win/radio2.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/win/radio2.bmp differ
Binary files lib/microwindows/src/mwin/bmp/zion208.bmp and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/zion208.bmp differ
diff -urN lib/microwindows/src/mwin/bmp/zion208.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/zion208.c
--- lib/microwindows/src/mwin/bmp/zion208.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/bmp/zion208.c	2005-02-21 16:13:24.000000000 +0100
@@ -0,0 +1,476 @@
+/* Generated by convbmp*/
+#include "device.h"
+
+/* MWIMAGEHDR image_zion208 converted from zion208.bmp*/
+
+static MWPALENTRY palette[256] = {
+  RGBDEF(   8,   8,  16 ),	/* pal 0*/
+  RGBDEF(  16,  16,  24 ),	/* pal 1*/
+  RGBDEF(  24,  16,  24 ),	/* pal 2*/
+  RGBDEF(  74,  16,  24 ),	/* pal 3*/
+  RGBDEF(  90,  16,  24 ),	/* pal 4*/
+  RGBDEF(  33,  33,  33 ),	/* pal 5*/
+  RGBDEF(  41,  24,  33 ),	/* pal 6*/
+  RGBDEF(  41,  33,  33 ),	/* pal 7*/
+  RGBDEF(  74,  33,  33 ),	/* pal 8*/
+  RGBDEF(  24,  24,  41 ),	/* pal 9*/
+  RGBDEF(  41,  33,  41 ),	/* pal 10*/
+  RGBDEF(  49,  33,  41 ),	/* pal 11*/
+  RGBDEF(  49,  49,  41 ),	/* pal 12*/
+  RGBDEF(  57,  41,  41 ),	/* pal 13*/
+  RGBDEF(  57,  49,  41 ),	/* pal 14*/
+  RGBDEF(  74,  41,  41 ),	/* pal 15*/
+  RGBDEF(  74,  49,  41 ),	/* pal 16*/
+  RGBDEF(  90,  49,  41 ),	/* pal 17*/
+  RGBDEF( 107,  49,  41 ),	/* pal 18*/
+  RGBDEF( 115,  41,  41 ),	/* pal 19*/
+  RGBDEF( 123,  57,  41 ),	/* pal 20*/
+  RGBDEF(  57,  49,  49 ),	/* pal 21*/
+  RGBDEF(  90,  66,  49 ),	/* pal 22*/
+  RGBDEF(  99,  82,  49 ),	/* pal 23*/
+  RGBDEF( 115,  66,  49 ),	/* pal 24*/
+  RGBDEF(  33,  41,  57 ),	/* pal 25*/
+  RGBDEF(  49,  41,  57 ),	/* pal 26*/
+  RGBDEF(  49,  49,  57 ),	/* pal 27*/
+  RGBDEF(  57,  66,  57 ),	/* pal 28*/
+  RGBDEF(  82,  57,  57 ),	/* pal 29*/
+  RGBDEF(  90,  66,  57 ),	/* pal 30*/
+  RGBDEF( 107,  66,  57 ),	/* pal 31*/
+  RGBDEF( 107,  82,  57 ),	/* pal 32*/
+  RGBDEF( 123,  74,  57 ),	/* pal 33*/
+  RGBDEF( 123,  82,  57 ),	/* pal 34*/
+  RGBDEF(  74,  82,  66 ),	/* pal 35*/
+  RGBDEF(  99,  82,  66 ),	/* pal 36*/
+  RGBDEF( 123,  99,  66 ),	/* pal 37*/
+  RGBDEF(  41,  57,  74 ),	/* pal 38*/
+  RGBDEF(  57,  49,  74 ),	/* pal 39*/
+  RGBDEF(  57,  66,  74 ),	/* pal 40*/
+  RGBDEF(  66,  82,  74 ),	/* pal 41*/
+  RGBDEF(  90,  66,  74 ),	/* pal 42*/
+  RGBDEF( 107,  90,  74 ),	/* pal 43*/
+  RGBDEF( 115,  74,  74 ),	/* pal 44*/
+  RGBDEF( 115,  99,  74 ),	/* pal 45*/
+  RGBDEF( 123,  90,  74 ),	/* pal 46*/
+  RGBDEF( 132,  99,  74 ),	/* pal 47*/
+  RGBDEF( 132, 115,  74 ),	/* pal 48*/
+  RGBDEF(  90,  82,  82 ),	/* pal 49*/
+  RGBDEF(  99,  99,  82 ),	/* pal 50*/
+  RGBDEF(  41,  66,  90 ),	/* pal 51*/
+  RGBDEF(  33,  82, 148 ),	/* pal 52*/
+  RGBDEF(  49,  66, 115 ),	/* pal 53*/
+  RGBDEF(  49,  66, 123 ),	/* pal 54*/
+  RGBDEF(  49,  82, 140 ),	/* pal 55*/
+  RGBDEF(  49,  90, 156 ),	/* pal 56*/
+  RGBDEF(  57,  82, 107 ),	/* pal 57*/
+  RGBDEF(  57,  82, 132 ),	/* pal 58*/
+  RGBDEF(  66,  66,  90 ),	/* pal 59*/
+  RGBDEF(  66,  74,  90 ),	/* pal 60*/
+  RGBDEF(  66,  82, 148 ),	/* pal 61*/
+  RGBDEF(  66,  99, 132 ),	/* pal 62*/
+  RGBDEF(  66,  99, 148 ),	/* pal 63*/
+  RGBDEF(  74,  82,  90 ),	/* pal 64*/
+  RGBDEF(  79,  98, 109 ),	/* pal 65*/
+  RGBDEF( 107,  90, 107 ),	/* pal 66*/
+  RGBDEF( 103, 107, 107 ),	/* pal 67*/
+  RGBDEF( 123, 107,  94 ),	/* pal 68*/
+  RGBDEF( 115, 107, 123 ),	/* pal 69*/
+  RGBDEF( 127, 115, 107 ),	/* pal 70*/
+  RGBDEF(  74,  99, 132 ),	/* pal 71*/
+  RGBDEF(  82, 107, 132 ),	/* pal 72*/
+  RGBDEF(  90, 123, 132 ),	/* pal 73*/
+  RGBDEF( 115, 132, 132 ),	/* pal 74*/
+  RGBDEF( 107, 123, 148 ),	/* pal 75*/
+  RGBDEF(  74, 123, 156 ),	/* pal 76*/
+  RGBDEF(  99, 107, 156 ),	/* pal 77*/
+  RGBDEF( 123, 140, 156 ),	/* pal 78*/
+  RGBDEF(  99, 123, 165 ),	/* pal 79*/
+  RGBDEF(  49,  90, 173 ),	/* pal 80*/
+  RGBDEF(  57,  99, 173 ),	/* pal 81*/
+  RGBDEF(  66, 107, 173 ),	/* pal 82*/
+  RGBDEF(  49,  90, 181 ),	/* pal 83*/
+  RGBDEF(  66, 107, 181 ),	/* pal 84*/
+  RGBDEF(  66, 115, 181 ),	/* pal 85*/
+  RGBDEF(  90, 115, 181 ),	/* pal 86*/
+  RGBDEF( 107, 140, 181 ),	/* pal 87*/
+  RGBDEF(  66, 107, 189 ),	/* pal 88*/
+  RGBDEF(  74, 115, 189 ),	/* pal 89*/
+  RGBDEF(  74, 123, 198 ),	/* pal 90*/
+  RGBDEF(  90, 132, 198 ),	/* pal 91*/
+  RGBDEF(  99, 140, 198 ),	/* pal 92*/
+  RGBDEF( 115, 148, 198 ),	/* pal 93*/
+  RGBDEF( 123, 115, 198 ),	/* pal 94*/
+  RGBDEF(  82, 132, 206 ),	/* pal 95*/
+  RGBDEF(  99, 148, 206 ),	/* pal 96*/
+  RGBDEF( 115, 148, 206 ),	/* pal 97*/
+  RGBDEF( 115, 156, 206 ),	/* pal 98*/
+  RGBDEF(  57, 107, 214 ),	/* pal 99*/
+  RGBDEF(  74, 132, 214 ),	/* pal 100*/
+  RGBDEF( 107, 148, 214 ),	/* pal 101*/
+  RGBDEF(  99, 148, 222 ),	/* pal 102*/
+  RGBDEF( 115, 165, 222 ),	/* pal 103*/
+  RGBDEF( 140,  41,  24 ),	/* pal 104*/
+  RGBDEF( 140,  49,  41 ),	/* pal 105*/
+  RGBDEF( 140,  99,  66 ),	/* pal 106*/
+  RGBDEF( 148,  66,  33 ),	/* pal 107*/
+  RGBDEF( 148,  66,  49 ),	/* pal 108*/
+  RGBDEF( 148,  74,  57 ),	/* pal 109*/
+  RGBDEF( 148,  90,  57 ),	/* pal 110*/
+  RGBDEF( 156,  82,  57 ),	/* pal 111*/
+  RGBDEF( 165,  49,  41 ),	/* pal 112*/
+  RGBDEF( 165,  66,  49 ),	/* pal 113*/
+  RGBDEF( 165,  90,  57 ),	/* pal 114*/
+  RGBDEF( 189,  71,  55 ),	/* pal 115*/
+  RGBDEF( 165,  99,  66 ),	/* pal 116*/
+  RGBDEF( 148, 115,  74 ),	/* pal 117*/
+  RGBDEF( 165,  82,  74 ),	/* pal 118*/
+  RGBDEF( 165, 115,  74 ),	/* pal 119*/
+  RGBDEF( 156, 111,  82 ),	/* pal 120*/
+  RGBDEF( 152, 111, 115 ),	/* pal 121*/
+  RGBDEF( 181,  99,  66 ),	/* pal 122*/
+  RGBDEF( 181, 115,  74 ),	/* pal 123*/
+  RGBDEF( 181, 115,  82 ),	/* pal 124*/
+  RGBDEF( 198, 103,  70 ),	/* pal 125*/
+  RGBDEF( 198, 123,  74 ),	/* pal 126*/
+  RGBDEF( 219, 109,  71 ),	/* pal 127*/
+  RGBDEF( 231, 123,  74 ),	/* pal 128*/
+  RGBDEF( 145, 134,  87 ),	/* pal 129*/
+  RGBDEF( 162, 140,  98 ),	/* pal 130*/
+  RGBDEF( 151, 138, 130 ),	/* pal 131*/
+  RGBDEF( 181, 123,  82 ),	/* pal 132*/
+  RGBDEF( 189, 140,  90 ),	/* pal 133*/
+  RGBDEF( 178, 140, 126 ),	/* pal 134*/
+  RGBDEF( 189, 156,  82 ),	/* pal 135*/
+  RGBDEF( 198, 132,  82 ),	/* pal 136*/
+  RGBDEF( 198, 140,  82 ),	/* pal 137*/
+  RGBDEF( 214, 140,  82 ),	/* pal 138*/
+  RGBDEF( 198, 156,  90 ),	/* pal 139*/
+  RGBDEF( 214, 132,  90 ),	/* pal 140*/
+  RGBDEF( 201, 155, 112 ),	/* pal 141*/
+  RGBDEF( 239, 131,  82 ),	/* pal 142*/
+  RGBDEF( 247, 148,  82 ),	/* pal 143*/
+  RGBDEF( 231, 148,  90 ),	/* pal 144*/
+  RGBDEF( 247, 152,  90 ),	/* pal 145*/
+  RGBDEF( 255, 165,  90 ),	/* pal 146*/
+  RGBDEF( 232, 156, 109 ),	/* pal 147*/
+  RGBDEF( 251, 169, 115 ),	/* pal 148*/
+  RGBDEF( 214, 173, 115 ),	/* pal 149*/
+  RGBDEF( 247, 178, 101 ),	/* pal 150*/
+  RGBDEF( 239, 181, 123 ),	/* pal 151*/
+  RGBDEF( 240, 193, 113 ),	/* pal 152*/
+  RGBDEF( 255, 198, 123 ),	/* pal 153*/
+  RGBDEF( 255, 214, 132 ),	/* pal 154*/
+  RGBDEF( 132, 156, 181 ),	/* pal 155*/
+  RGBDEF( 132, 173, 206 ),	/* pal 156*/
+  RGBDEF( 140, 123, 148 ),	/* pal 157*/
+  RGBDEF( 140, 165, 165 ),	/* pal 158*/
+  RGBDEF( 140, 173, 198 ),	/* pal 159*/
+  RGBDEF( 140, 173, 222 ),	/* pal 160*/
+  RGBDEF( 140, 181, 231 ),	/* pal 161*/
+  RGBDEF( 148, 181, 222 ),	/* pal 162*/
+  RGBDEF( 148, 189, 247 ),	/* pal 163*/
+  RGBDEF( 156, 156, 165 ),	/* pal 164*/
+  RGBDEF( 156, 165, 165 ),	/* pal 165*/
+  RGBDEF( 156, 165, 189 ),	/* pal 166*/
+  RGBDEF( 156, 173, 198 ),	/* pal 167*/
+  RGBDEF( 156, 189, 222 ),	/* pal 168*/
+  RGBDEF( 156, 189, 231 ),	/* pal 169*/
+  RGBDEF( 165, 198, 198 ),	/* pal 170*/
+  RGBDEF( 165, 198, 222 ),	/* pal 171*/
+  RGBDEF( 165, 206, 173 ),	/* pal 172*/
+  RGBDEF( 173, 198, 239 ),	/* pal 173*/
+  RGBDEF( 173, 206, 247 ),	/* pal 174*/
+  RGBDEF( 181, 181, 198 ),	/* pal 175*/
+  RGBDEF( 181, 198, 189 ),	/* pal 176*/
+  RGBDEF( 181, 198, 239 ),	/* pal 177*/
+  RGBDEF( 181, 206, 206 ),	/* pal 178*/
+  RGBDEF( 181, 206, 231 ),	/* pal 179*/
+  RGBDEF( 189, 173, 148 ),	/* pal 180*/
+  RGBDEF( 206, 181, 140 ),	/* pal 181*/
+  RGBDEF( 231, 173, 140 ),	/* pal 182*/
+  RGBDEF( 247, 198, 140 ),	/* pal 183*/
+  RGBDEF( 255, 206, 140 ),	/* pal 184*/
+  RGBDEF( 231, 198, 148 ),	/* pal 185*/
+  RGBDEF( 255, 222, 148 ),	/* pal 186*/
+  RGBDEF( 198, 185, 156 ),	/* pal 187*/
+  RGBDEF( 210, 185, 172 ),	/* pal 188*/
+  RGBDEF( 222, 181, 189 ),	/* pal 189*/
+  RGBDEF( 189, 198, 198 ),	/* pal 190*/
+  RGBDEF( 238, 198, 165 ),	/* pal 191*/
+  RGBDEF( 222, 206, 201 ),	/* pal 192*/
+  RGBDEF( 247, 239, 181 ),	/* pal 193*/
+  RGBDEF( 189, 198, 222 ),	/* pal 194*/
+  RGBDEF( 198, 214, 222 ),	/* pal 195*/
+  RGBDEF( 206, 214, 222 ),	/* pal 196*/
+  RGBDEF( 255, 247, 222 ),	/* pal 197*/
+  RGBDEF( 198, 214, 231 ),	/* pal 198*/
+  RGBDEF( 206, 214, 239 ),	/* pal 199*/
+  RGBDEF( 214, 222, 239 ),	/* pal 200*/
+  RGBDEF( 231, 231, 239 ),	/* pal 201*/
+  RGBDEF( 198, 214, 247 ),	/* pal 202*/
+  RGBDEF( 198, 222, 247 ),	/* pal 203*/
+  RGBDEF( 214, 231, 247 ),	/* pal 204*/
+  RGBDEF( 231, 239, 255 ),	/* pal 205*/
+  RGBDEF( 247, 247, 255 ),	/* pal 206*/
+  RGBDEF(   0,   0,   0 ),	/* pal 207*/
+  RGBDEF(   0,   0,   0 ),	/* pal 208*/
+  RGBDEF(   0,   0,   0 ),	/* pal 209*/
+  RGBDEF(   0,   0,   0 ),	/* pal 210*/
+  RGBDEF(   0,   0,   0 ),	/* pal 211*/
+  RGBDEF(   0,   0,   0 ),	/* pal 212*/
+  RGBDEF(   0,   0,   0 ),	/* pal 213*/
+  RGBDEF(   0,   0,   0 ),	/* pal 214*/
+  RGBDEF(   0,   0,   0 ),	/* pal 215*/
+  RGBDEF(   0,   0,   0 ),	/* pal 216*/
+  RGBDEF(   0,   0,   0 ),	/* pal 217*/
+  RGBDEF(   0,   0,   0 ),	/* pal 218*/
+  RGBDEF(   0,   0,   0 ),	/* pal 219*/
+  RGBDEF(   0,   0,   0 ),	/* pal 220*/
+  RGBDEF(   0,   0,   0 ),	/* pal 221*/
+  RGBDEF(   0,   0,   0 ),	/* pal 222*/
+  RGBDEF(   0,   0,   0 ),	/* pal 223*/
+  RGBDEF(   0,   0,   0 ),	/* pal 224*/
+  RGBDEF(   0,   0,   0 ),	/* pal 225*/
+  RGBDEF(   0,   0,   0 ),	/* pal 226*/
+  RGBDEF(   0,   0,   0 ),	/* pal 227*/
+  RGBDEF(   0,   0,   0 ),	/* pal 228*/
+  RGBDEF(   0,   0,   0 ),	/* pal 229*/
+  RGBDEF(   0,   0,   0 ),	/* pal 230*/
+  RGBDEF(   0,   0,   0 ),	/* pal 231*/
+  RGBDEF(   0,   0,   0 ),	/* pal 232*/
+  RGBDEF(   0,   0,   0 ),	/* pal 233*/
+  RGBDEF(   0,   0,   0 ),	/* pal 234*/
+  RGBDEF(   0,   0,   0 ),	/* pal 235*/
+  RGBDEF(   0,   0,   0 ),	/* pal 236*/
+  RGBDEF(   0,   0,   0 ),	/* pal 237*/
+  RGBDEF(   0,   0,   0 ),	/* pal 238*/
+  RGBDEF(   0,   0,   0 ),	/* pal 239*/
+  RGBDEF(   0,   0,   0 ),	/* pal 240*/
+  RGBDEF(   0,   0,   0 ),	/* pal 241*/
+  RGBDEF(   0,   0,   0 ),	/* pal 242*/
+  RGBDEF(   0,   0,   0 ),	/* pal 243*/
+  RGBDEF(   0,   0,   0 ),	/* pal 244*/
+  RGBDEF(   0,   0,   0 ),	/* pal 245*/
+  RGBDEF(   0,   0,   0 ),	/* pal 246*/
+  RGBDEF(   0,   0,   0 ),	/* pal 247*/
+  RGBDEF(   0,   0,   0 ),	/* pal 248*/
+  RGBDEF(   0,   0,   0 ),	/* pal 249*/
+  RGBDEF(   0,   0,   0 ),	/* pal 250*/
+  RGBDEF(   0,   0,   0 ),	/* pal 251*/
+  RGBDEF(   0,   0,   0 ),	/* pal 252*/
+  RGBDEF(   0,   0,   0 ),	/* pal 253*/
+  RGBDEF(   0,   0,   0 ),	/* pal 254*/
+  RGBDEF(   0,   0,   0 ),	/* pal 255*/
+};
+
+static MWUCHAR imagebits[] = {
+5,5,13,12,22,11,5,2,2,2,5,2,2,2,1,2,5,2,13,7,11,5,2,2,2,5,2,5,2,1,1,1,1,2,5,2,2,2,2,9,1,1,2,14,1,1,1,1,0,1,1,1,0,2,2,2,2,2,1,1,1,0,1,0,1,0,1,0,0,2,0,2,1,0,1,1,1,1,1,1,1,2,0,0,2,0,2,1,0,2,0,1,7,13,0,1,0,2,1,0,1,1,1,1,0,1,2,2,1,2,2,2,1,1,1,1,2,2,1,0,1,5,1,2,1,2,2,1,1,2,16,13,2,2,2,2,2,1,1,1,1,1,0,2,0,2,1,1,1,14,22,133,30,29,11,5,7,6,7,7,15,16,15,13,13,0,2,6,1,14,23,17,16,16,16,30,34,6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,5,1,11,1,6,6,10,7,2,1,1,1,1,2,2,10,2,2,25,2,2,25,2,
+1,1,1,1,1,2,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,2,5,2,2,2,1,13,13,7,2,13,2,1,1,1,1,2,10,2,1,1,1,2,5,1,5,7,5,2,2,6,13,21,17,21,12,29,14,29,24,13,2,2,2,5,2,2,6,5,13,16,13,14,13,14,14,15,13,13,16,13,1,2,2,5,2,2,5,2,2,1,2,2,5,1,2,14,13,2,7,2,2,21,7,6,17,14,11,7,13,29,11,8,7,11,11,2,2,2,7,6,13,7,7,13,2,1,1,1,13,14,2,7,7,2,2,2,2,6,2,5,2,2,2,6,13,7,2,2,2,2,5,2,11,7,6,2,5,13,2,14,13,6,2,6,0,1,1,1,2,2,2,2,2,1,1,1,1,2,2,2,5,13,7,1,2,5,2,5,2,13,10,13,13,2,6,6,6,6,1,2,5,2,1,1,2,1,1,0,2,1,1,1,1,1,1,1,6,1,1,1,1,1,2,5,2,2,5,2,6,1,2,1,2,2,2,2,2,5,2,5,5,2,13,6,6,6,6,6,2,6,1,6,1,2,2,1,1,1,1,1,1,5,6,2,2,12,2,1,5,2,1,1,5,6,6,6,7,13,5,2,6,1,1,2,5,2,1,1,9,10,2,5,1,11,9,2,5,1,1,1,5,2,5,10,9,5,2,9,2,2,1,
+2,1,1,1,1,1,1,1,2,5,2,2,1,1,1,1,1,1,1,1,1,1,1,2,6,9,2,5,2,2,5,2,5,6,21,13,11,11,14,6,1,1,1,2,12,12,1,1,0,2,2,2,2,2,2,2,5,1,2,21,21,23,15,30,36,30,36,17,14,6,2,2,2,2,5,2,13,21,7,14,29,29,29,14,13,13,13,16,13,0,2,2,2,1,6,2,2,2,5,2,5,2,5,5,21,2,5,11,6,2,13,6,6,22,13,11,7,17,15,13,13,13,11,13,6,2,13,7,7,11,7,6,8,6,1,1,2,7,7,6,14,7,6,2,2,6,1,2,2,2,2,13,2,7,2,6,2,13,2,2,2,5,7,7,2,2,14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,7,11,0,1,2,2,13,2,21,2,1,5,6,5,2,1,2,11,2,2,2,13,13,21,21,29,22,13,22,43,14,14,6,1,2,6,2,2,2,11,6,16,23,16,16,13,29,14,13,16,13,6,2,1,1,2,2,2,5,7,2,2,2,5,2,9,14,2,12,7,2,11,2,2,21,13,16,13,13,16,11,8,13,8,13,11,11,6,2,6,7,7,13,7,6,6,2,1,1,2,7,6,1,7,14,2,2,7,16,7,2,6,1,2,2,2,2,5,2,2,5,2,2,6,1,13,2,2,13,6,13,13,7,6,2,7,1,2,2,1,1,1,1,1,1,1,1,1,1,2,1,1,7,6,2,5,2,2,2,5,2,13,2,12,2,11,6,7,2,2,5,2,1,1,1,1,1,1,1,1,1,1,0,2,1,2,1,1,5,1,1,1,1,1,2,2,2,5,2,2,2,5,2,5,2,2,2,6,1,2,11,6,6,2,11,5,6,6,7,6,1,2,1,1,2,1,2,2,1,1,1,1,1,5,10,10,10,9,2,2,2,1,1,5,2,2,26,6,10,2,5,2,2,1,2,2,5,1,2,1,1,1,2,5,27,21,2,1,2,1,1,1,5,1,9,10,6,10,10,11,5,11,0,
+2,2,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,2,6,1,2,2,2,2,2,1,5,2,7,13,11,7,5,6,5,5,5,10,10,13,2,2,12,5,13,1,1,5,2,2,5,5,13,2,13,11,13,17,21,29,16,6,7,2,6,2,5,2,12,11,14,14,29,16,16,16,21,14,13,14,29,13,6,2,1,1,1,1,5,5,2,5,1,2,1,2,10,7,2,13,2,1,11,2,2,6,13,16,13,13,15,13,13,11,13,8,11,13,6,2,7,7,7,13,6,7,13,2,6,1,2,7,11,6,14,6,6,6,7,35,7,13,2,2,5,2,5,2,2,5,2,2,2,2,2,13,7,2,13,7,13,7,8,11,2,5,2,1,1,1,0,2,1,1,1,1,1,2,1,1,1,1,6,1,2,2,2,2,6,2,2,2,2,5,2,11,13,6,13,25,2,1,1,1,0,1,0,2,1,1,1,1,0,1,1,1,6,2,1,1,1,1,2,1,1,2,2,5,1,5,2,2,2,1,2,1,5,2,9,6,2,5,10,7,11,7,2,7,7,6,2,5,2,25,2,5,2,1,2,1,1,1,1,1,2,11,9,5,2,5,2,1,1,1,2,2,10,11,10,10,10,2,2,1,2,5,2,2,6,2,1,1,1,1,2,13,10,2,1,1,1,1,1,6,9,6,6,10,6,6,6,2,10,2,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,5,2,5,2,2,1,5,21,11,13,5,2,2,13,2,6,5,12,0,2,5,2,5,2,1,2,2,5,2,13,7,2,13,7,14,23,30,36,22,29,16,11,7,13,13,13,13,11,14,29,13,16,29,13,29,13,14,14,17,13,2,2,2,1,2,2,2,2,6,2,2,2,2,2,13,5,2,10,2,12,2,10,7,11,16,29,17,13,16,13,17,13,8,11,11,6,6,6,14,8,6,7,7,6,2,7,1,1,2,14,2,2,14,6,2,6,2,14,7,2,2,2,6,2,2,2,5,2,2,13,2,5,2,14,7,2,7,7,7,2,14,6,6,2,1,1,1,1,1,1,1,0,2,1,0,1,0,1,1,1,2,2,6,2,5,5,7,2,5,13,11,11,11,11,11,7,7,2,2,1,1,1,1,1,1,0,2,1,0,2,1,1,1,1,2,1,1,1,1,1,1,1,1,2,10,2,2,2,6,9,1,2,1,2,1,2,1,2,2,2,11,2,11,2,2,2,7,6,6,6,2,2,2,2,2,2,1,1,5,2,2,6,1,6,5,2,1,2,2,1,2,2,2,5,10,10,9,13,1,5,2,2,1,2,2,2,2,2,5,1,1,1,11,10,5,2,1,1,2,1,2,2,2,11,6,6,10,6,6,5,11,2,
+1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,2,1,1,1,2,5,2,2,2,2,2,6,1,10,21,13,13,2,1,6,13,21,11,2,2,0,1,11,2,2,5,1,2,2,5,11,6,5,5,11,7,30,23,34,68,11,22,17,13,11,7,6,2,21,13,11,11,14,17,21,14,36,13,21,29,14,11,2,6,1,1,2,6,1,6,1,2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,1,1,2,9,2,2,2,2,1,6,1,5,2,1,5,2,1,1,1,1,1,10,6,6,6,7,6,10,6,10,2,
+2,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,5,2,5,2,2,5,2,2,6,1,2,6,2,2,2,5,10,11,13,5,5,14,21,14,26,2,2,1,1,2,13,5,2,2,1,1,2,2,2,5,1,2,11,14,30,37,34,29,11,34,14,17,21,21,16,21,21,14,22,29,16,22,21,36,22,14,15,13,14,13,6,1,2,5,2,2,2,2,5,2,5,1,5,7,11,7,13,1,5,7,2,2,2,2,7,8,11,2,2,2,13,17,11,15,11,6,2,6,13,8,11,11,7,7,7,7,1,1,7,5,2,13,2,2,7,6,1,13,2,2,1,1,2,2,7,2,13,2,2,2,2,7,2,13,2,5,2,7,13,7,7,6,2,6,1,1,1,1,1,1,1,1,1,1,1,1,0,1,2,13,5,2,2,2,2,2,2,5,1,6,2,5,2,2,13,7,2,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,2,1,2,2,1,1,1,1,1,1,1,2,10,2,1,1,1,1,2,1,2,2,2,6,1,6,6,7,7,2,5,11,6,13,2,2,2,5,2,2,5,1,1,1,1,5,2,2,1,1,2,2,1,2,5,1,1,2,1,25,2,2,12,6,2,5,1,1,2,2,5,2,11,6,11,2,2,10,5,2,2,1,1,2,1,1,2,2,1,11,6,6,6,6,6,5,6,2,
+2,1,2,5,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,5,2,1,2,2,2,2,5,1,2,5,2,2,11,7,10,10,10,5,2,5,11,1,1,2,2,1,5,2,2,1,2,6,2,13,2,2,6,6,21,30,45,49,34,47,13,37,21,13,21,13,7,7,16,13,14,14,29,16,29,30,13,21,14,14,14,14,2,6,2,5,2,2,5,2,2,2,2,2,13,12,1,27,2,6,7,5,2,1,1,2,2,21,6,2,6,13,17,15,15,13,11,11,6,7,11,7,14,7,13,2,5,2,6,1,2,2,2,2,5,2,2,6,2,6,2,1,1,6,2,6,13,2,2,2,2,13,1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,1,1,1,1,1,10,13,10,5,5,10,10,10,1,2,6,2,2,2,5,2,5,1,2,2,5,2,11,2,2,14,30,30,29,35,45,21,43,16,5,5,30,14,13,14,14,21,37,22,34,30,29,16,21,29,14,13,16,7,2,2,2,6,2,1,2,2,2,2,2,2,7,1,2,2,2,2,2,5,2,2,2,2,7,11,13,11,6,7,17,8,15,13,7,8,6,6,6,6,6,6,2,6,7,2,1,1,1,1,1,1,6,6,2,6,2,5,2,2,1,2,5,5,7,2,2,2,12,2,6,1,7,5,2,2,7,7,6,7,13,7,6,1,1,1,0,2,1,1,1,1,0,1,1,1,1,1,2,5,2,2,2,5,2,5,1,2,2,5,2,2,2,13,2,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,2,1,6,1,2,1,2,2,6,1,2,2,5,2,10,1,7,11,2,6,13,7,11,6,6,6,7,12,11,2,1,2,1,1,2,2,2,6,1,2,5,2,2,5,2,10,2,2,9,25,2,13,7,10,6,2,1,1,2,26,2,2,10,11,6,13,2,2,1,5,1,1,1,1,1,2,1,2,5,9,6,6,6,6,6,6,11,2,
+2,1,1,2,5,2,5,2,2,1,1,1,1,1,1,1,1,2,1,1,5,1,1,1,1,1,1,1,1,1,1,1,1,5,10,10,1,5,5,1,2,12,1,9,2,2,5,2,5,7,2,2,2,5,2,2,5,2,6,29,22,30,30,117,36,29,30,13,7,13,22,5,14,29,16,21,30,23,43,15,21,16,17,22,11,5,13,7,6,2,5,1,2,6,6,2,2,6,2,2,6,6,2,5,2,5,2,1,2,2,5,1,2,21,13,16,11,7,22,15,29,11,6,11,6,6,6,13,6,7,13,5,7,6,0,1,1,0,2,2,7,7,6,1,2,2,5,2,1,2,2,2,13,2,2,13,7,2,2,5,6,1,2,5,7,2,14,7,11,13,1,1,2,1,1,1,1,1,1,1,1,1,0,1,0,2,2,2,2,5,2,1,2,2,6,2,1,2,5,2,11,11,2,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1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,5,1,2,1,2,11,2,2,2,6,5,14,11,13,7,16,26,15,1,2,2,2,5,2,2,1,2,2,2,1,2,1,2,13,30,16,13,6,13,30,32,43,34,29,30,30,22,29,29,22,13,30,13,21,37,45,43,14,21,14,21,11,11,8,2,2,6,6,2,2,2,5,2,6,6,6,7,2,6,2,2,6,1,2,2,2,6,1,2,1,2,7,6,7,11,11,11,18,13,15,13,6,11,6,6,13,6,6,6,6,6,1,2,1,1,1,2,6,2,2,6,6,6,2,6,2,2,2,12,11,6,2,5,1,0,1,2,2,5,13,2,6,1,7,14,7,13,11,1,0,2,1,1,1,1,1,2,1,1,0,2,1,1,1,1,1,2,5,2,1,2,2,1,1,2,5,2,2,11,13,2,1,1,1,1,1,1,2,1,1,1,0,1,2,1,1,1,2,1,1,2,1,1,1,1,5,1,1,1,1,2,1,5,2,1,2,2,5,1,1,5,2,2,1,2,6,2,2,5,12,2,9,11,6,2,2,2,6,1,2,5,2,1,5,1,1,2,2,6,2,2,1,1,2,5,5,13,2,2,5,1,5,2,2,2,2,1,2,2,2,2,5,9,6,1,9,5,1,1,1,2,1,1,1,2,5,2,2,2,5,2,9,2,2,10,6,70,205,131,
+2,5,9,2,1,1,1,2,5,2,5,2,2,1,1,1,2,14,11,2,2,2,6,1,5,5,26,2,6,10,21,7,13,13,13,21,21,14,2,1,2,6,2,2,2,2,5,1,2,2,1,1,2,11,7,30,2,13,13,11,14,36,46,30,30,30,16,29,14,29,14,13,36,2,30,36,46,30,21,13,13,16,8,21,22,2,2,7,2,6,1,2,2,6,6,7,6,6,2,2,2,5,2,5,5,2,5,2,5,2,2,5,2,2,7,7,11,8,16,13,13,11,6,13,6,7,11,11,11,6,2,6,2,2,1,0,1,2,2,2,6,7,11,6,2,2,2,6,2,5,12,2,2,1,1,1,1,2,7,7,13,7,2,2,13,13,6,7,13,6,1,0,1,0,2,1,0,0,2,1,1,1,1,1,1,1,1,2,2,2,5,2,1,1,5,1,2,5,7,6,2,2,0,1,0,1,1,1,1,1,1,0,1,0,2,1,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,6,1,2,6,1,1,2,6,2,2,2,2,13,2,2,2,5,6,2,2,6,1,2,2,2,2,1,2,2,5,1,1,6,1,2,5,1,2,6,2,11,13,2,5,2,2,1,5,1,2,1,1,25,6,2,5,9,2,2,25,6,2,1,5,2,2,5,2,2,2,2,5,2,9,2,2,6,5,10,5,131,201,201,74,
+2,2,2,6,2,2,1,1,6,2,2,2,2,5,2,2,5,13,26,2,5,2,2,2,2,5,2,5,7,21,10,13,16,15,13,14,13,27,2,2,5,2,2,5,2,2,2,6,12,2,2,6,2,7,29,10,2,11,17,11,22,34,32,30,16,29,13,13,14,14,13,21,29,2,21,43,22,13,21,29,16,29,13,17,15,1,6,17,2,2,7,6,2,7,6,13,6,6,2,6,2,2,2,2,2,5,2,2,2,2,2,2,2,6,6,6,7,7,13,13,8,11,6,11,13,8,11,7,6,6,6,2,2,2,1,0,1,5,2,5,7,11,13,7,11,2,2,2,2,6,5,2,2,2,1,1,1,2,2,2,5,7,6,2,2,14,2,13,13,2,2,1,1,1,1,1,57,38,0,2,1,1,1,1,1,1,0,2,2,5,2,1,2,2,1,2,5,2,2,5,1,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,2,9,5,2,2,2,6,2,2,6,2,2,2,7,2,6,2,2,13,11,1,2,5,9,11,2,6,1,2,2,2,1,1,1,2,6,2,5,2,2,2,11,5,2,9,2,6,2,1,1,5,1,2,2,2,5,2,6,10,10,7,11,2,2,2,2,2,2,25,2,5,2,2,2,6,1,9,11,11,16,192,205,201,200,74,
+2,6,5,1,2,1,1,5,2,5,2,2,6,2,2,5,2,13,12,5,2,5,2,5,2,6,2,5,21,16,11,2,30,16,14,21,16,2,2,2,2,2,6,2,2,2,21,2,28,13,22,15,6,7,17,9,2,11,22,30,22,34,43,30,22,29,14,29,14,15,13,21,17,29,16,30,30,17,17,17,17,16,13,15,8,2,14,11,2,2,6,2,2,2,7,7,7,6,2,2,2,5,5,2,6,1,2,13,2,5,2,5,13,7,2,6,7,13,6,2,17,7,2,11,7,11,8,13,11,6,2,2,6,1,1,1,1,2,1,2,2,2,2,6,2,7,2,11,5,13,7,2,5,2,1,1,1,7,5,13,1,5,1,2,2,14,6,14,8,2,2,1,1,1,1,1,1,1,1,1,2,1,0,2,0,2,1,1,2,2,2,1,1,1,2,5,2,2,6,2,11,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,2,1,2,2,2,6,1,6,1,11,7,6,2,6,2,2,10,2,2,11,11,2,6,2,2,5,6,2,2,1,1,2,1,5,1,1,5,1,2,9,2,5,9,6,2,2,6,1,2,2,6,2,1,2,2,2,11,6,2,11,10,6,10,2,1,5,2,2,25,2,2,2,9,2,25,1,2,6,11,13,165,205,201,201,204,201,131,
+2,2,2,6,1,1,1,2,1,2,11,7,2,2,2,10,2,13,10,10,2,5,2,1,2,2,5,11,14,21,15,21,22,29,13,14,11,6,2,5,2,5,1,2,2,2,13,5,21,22,117,29,2,30,17,2,6,14,20,15,22,31,32,33,29,29,21,13,14,13,14,16,47,106,31,16,24,17,33,29,29,15,13,29,11,0,29,11,2,6,6,2,6,6,7,7,13,7,0,6,2,2,5,6,1,5,6,1,2,2,2,6,5,7,6,2,7,7,7,7,16,6,7,8,11,11,13,11,17,6,6,2,2,1,1,1,1,2,2,2,5,2,5,2,2,2,13,5,12,7,2,6,2,2,1,1,1,2,7,5,2,2,1,2,13,13,7,17,13,2,2,2,1,1,5,2,1,1,9,40,2,5,2,1,1,1,1,1,2,2,1,2,5,1,2,2,5,1,2,2,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,2,1,2,2,2,2,11,11,6,6,6,2,6,5,11,2,7,13,12,1,1,2,5,1,9,7,7,1,2,2,21,1,1,2,1,2,6,2,5,2,5,2,2,5,1,6,2,5,1,1,2,6,2,11,2,5,11,10,5,10,6,1,2,2,5,2,2,2,5,2,2,5,2,2,9,11,13,13,205,201,201,204,201,201,74,
+2,5,1,1,6,2,1,5,2,7,13,11,2,5,7,29,14,15,13,21,13,5,5,2,6,1,2,5,7,21,21,29,22,22,13,29,7,2,2,2,2,2,6,2,2,12,7,21,12,29,130,18,15,120,6,6,1,14,22,18,22,122,37,29,16,16,13,14,13,15,47,106,43,18,15,24,24,29,33,18,30,22,11,8,8,1,16,7,1,11,2,2,2,7,6,7,13,2,2,2,5,2,2,2,12,7,2,13,2,5,7,2,13,7,6,6,7,13,8,6,16,6,13,17,13,11,11,11,11,11,6,6,2,0,1,1,1,1,1,5,2,2,2,2,6,1,14,6,2,2,1,2,2,6,1,1,2,7,7,2,2,13,1,5,13,14,7,7,13,2,2,7,5,5,65,7,2,2,1,9,9,51,9,10,59,1,2,1,2,1,5,2,1,2,5,2,2,5,2,5,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,6,5,2,5,2,11,2,10,6,6,7,11,6,2,2,7,11,11,10,2,2,2,5,2,6,2,10,5,2,2,25,51,11,1,1,5,2,2,5,2,12,2,5,2,2,6,1,2,2,6,1,6,1,2,25,2,11,6,2,9,11,5,2,2,26,38,64,10,5,2,5,2,2,9,5,6,26,8,130,205,204,201,201,200,201,74,
+2,1,1,6,1,1,1,2,5,10,7,12,5,2,12,21,14,14,14,13,13,10,10,12,1,5,6,5,12,21,13,16,29,22,13,29,2,2,2,5,2,2,14,14,13,2,12,16,29,36,47,37,106,33,11,2,2,21,22,30,18,132,24,33,30,22,29,13,29,47,46,17,109,33,22,33,33,17,33,33,30,17,13,15,11,6,16,11,2,2,2,6,2,13,7,13,7,2,2,2,5,2,5,2,6,7,2,2,2,2,13,1,7,6,2,7,13,7,11,13,6,6,7,11,11,17,13,8,8,11,11,2,6,1,1,2,1,2,2,2,2,2,2,7,2,13,2,2,2,1,1,2,2,2,1,1,2,2,6,1,6,2,2,13,13,6,6,13,7,2,12,2,2,1,71,72,40,1,1,2,2,2,5,57,27,1,1,2,6,2,2,2,5,2,2,6,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,11,2,11,6,8,11,6,2,6,6,5,12,1,6,1,2,2,2,10,2,13,11,1,2,2,5,2,5,2,2,2,5,2,5,2,2,5,2,5,2,2,5,2,2,2,2,5,2,2,9,2,11,1,10,2,2,5,2,9,2,2,2,9,2,9,2,5,10,2,12,8,166,206,200,201,204,204,201,201,69,
+2,6,1,2,1,1,1,2,13,13,13,5,2,2,16,29,26,2,21,15,12,10,5,12,10,5,2,12,21,29,13,13,16,22,29,13,1,6,2,2,2,13,13,2,2,2,13,21,13,23,43,31,31,11,8,6,6,6,16,21,29,47,46,24,31,21,22,11,34,47,31,31,46,105,29,46,18,31,33,18,30,17,11,17,8,2,14,11,2,6,6,1,7,6,11,13,7,6,6,1,2,2,2,2,5,2,5,6,2,6,2,2,2,6,6,6,7,11,11,13,13,11,7,11,17,11,11,8,7,7,6,2,6,2,1,2,1,2,2,2,2,12,6,7,2,2,2,6,2,1,0,2,2,5,1,1,2,5,2,6,1,2,1,2,6,6,7,7,13,2,1,2,1,64,40,5,9,1,1,1,40,25,38,6,1,0,1,1,2,1,2,6,2,2,5,2,5,1,2,1,5,1,2,2,5,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,1,1,1,5,2,1,5,2,6,6,6,7,11,11,13,7,6,6,2,11,2,6,1,2,2,2,5,1,13,11,2,2,2,6,2,2,1,2,5,2,2,2,2,5,12,7,2,12,1,5,2,5,2,5,2,2,2,11,2,11,10,9,10,5,2,2,2,6,1,5,2,2,6,2,5,2,9,9,21,176,205,201,201,201,201,201,201,204,131,
+2,2,1,5,1,2,2,10,13,14,13,2,2,13,21,12,12,2,14,21,6,2,7,10,5,13,7,16,13,14,13,13,16,24,16,13,6,1,5,2,2,2,7,2,13,7,11,14,21,36,30,18,13,6,11,2,2,11,16,22,30,34,109,110,109,31,8,32,123,31,24,18,31,33,33,113,44,8,33,18,31,30,13,15,11,2,29,2,2,2,7,13,5,2,7,11,13,2,2,2,2,6,1,6,1,6,2,6,2,7,6,6,12,2,11,7,6,13,11,11,29,7,13,11,17,11,11,11,11,11,6,7,2,2,6,2,1,5,1,2,7,13,11,5,1,1,1,2,7,2,1,1,2,2,1,1,2,2,2,1,1,5,2,13,7,6,7,7,7,6,1,6,25,9,2,2,1,1,1,5,27,60,1,1,1,1,1,1,1,2,1,2,2,9,51,2,2,1,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,5,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1,2,2,6,2,11,2,2,7,6,11,8,11,6,10,11,7,6,2,2,5,1,2,5,2,11,11,7,6,6,5,2,2,1,6,2,9,2,5,9,25,9,1,2,13,10,6,2,2,2,1,2,5,2,5,2,2,10,12,10,2,2,2,13,26,2,6,2,5,0,2,2,2,9,13,2,121,205,198,204,201,198,201,204,201,198,74,
+2,5,2,2,1,2,6,7,13,11,11,7,5,5,10,13,12,2,13,11,2,7,7,6,2,13,13,7,11,6,7,13,13,17,29,6,2,2,6,2,5,2,11,2,13,16,10,12,16,13,36,17,11,11,6,11,29,22,17,13,13,22,34,110,114,24,30,34,20,24,20,18,106,33,33,33,18,13,109,24,33,18,11,15,6,11,14,2,6,6,7,6,6,7,13,13,7,2,2,2,5,1,5,7,11,7,7,7,2,11,2,7,11,2,13,2,11,11,11,8,8,11,11,13,21,28,17,13,7,13,11,6,2,6,1,2,2,2,2,5,7,7,7,2,1,1,2,7,2,2,1,1,2,6,1,1,2,5,2,2,1,2,7,6,13,6,7,7,13,1,5,2,2,2,1,2,2,1,1,2,1,27,40,2,1,1,1,1,1,2,6,1,6,1,2,2,1,1,1,1,2,2,2,5,2,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,2,1,1,2,2,6,1,2,2,11,6,6,11,13,8,11,6,2,12,11,7,6,1,2,2,2,2,2,13,11,11,1,9,2,5,2,5,1,9,2,25,7,2,2,5,9,10,10,5,2,5,2,5,1,1,1,1,2,2,11,2,2,6,1,2,5,10,1,2,2,51,76,91,40,2,2,9,2,29,206,201,200,201,198,204,201,204,204,201,74,
+2,1,2,6,1,6,1,10,11,13,7,13,5,2,5,13,2,2,21,13,6,6,7,11,6,7,6,2,2,6,7,6,14,36,11,6,6,2,2,2,2,2,7,7,21,16,2,7,12,30,130,8,13,6,16,21,13,29,14,29,14,30,34,109,122,22,17,46,33,33,18,33,33,24,24,24,17,11,110,24,24,18,13,15,13,16,13,11,2,6,7,7,7,6,7,7,2,6,2,2,6,2,5,5,2,7,7,6,6,7,11,13,6,2,2,2,11,13,11,7,13,6,13,16,13,29,29,13,17,11,11,6,6,2,5,2,5,1,2,2,5,6,1,1,1,1,2,6,13,1,1,2,5,2,1,1,2,1,1,1,1,1,2,7,11,7,6,6,2,2,2,2,2,1,2,26,5,1,1,1,1,5,9,0,1,1,1,1,1,1,1,7,2,5,1,2,2,1,1,1,1,1,2,2,2,9,2,2,2,1,1,1,1,1,1,1,2,1,1,2,2,1,1,1,1,1,1,1,1,2,1,2,1,10,1,2,5,2,6,11,2,7,11,6,11,11,2,11,7,11,11,6,6,2,2,2,10,11,13,11,6,2,5,9,2,1,2,5,5,5,9,5,9,2,5,2,25,2,11,2,2,9,2,2,2,5,2,2,9,11,2,2,2,5,2,2,9,11,5,2,2,12,2,6,10,12,35,67,192,204,204,200,198,204,201,198,200,200,201,74,
+2,6,1,2,6,1,5,11,5,10,13,13,11,11,5,2,2,13,13,13,11,11,13,8,7,7,2,6,6,2,6,13,16,16,21,7,2,2,5,2,5,2,2,13,16,30,30,17,29,22,47,17,8,13,116,16,21,22,14,30,11,16,43,110,132,18,43,108,18,24,24,33,24,109,33,24,11,11,114,33,24,44,7,18,22,17,11,2,2,11,6,6,2,13,7,13,6,2,7,2,2,2,2,2,5,6,1,2,2,5,2,13,2,2,6,12,11,14,11,13,17,1,13,22,13,30,16,7,21,13,11,7,2,2,1,2,2,1,2,14,35,1,0,1,1,1,2,7,2,2,1,2,2,2,1,0,1,1,2,1,1,2,2,13,6,2,7,2,6,2,6,2,2,5,2,2,1,1,1,1,2,1,1,1,1,1,1,60,131,13,13,2,2,2,2,2,1,1,1,1,1,2,5,2,2,1,2,1,1,1,1,1,1,1,1,2,1,5,1,2,1,1,2,1,1,1,1,1,1,2,5,2,1,2,2,6,1,2,13,11,2,11,13,11,8,11,7,7,11,10,11,2,6,2,2,13,11,5,2,2,11,10,2,2,5,1,2,9,5,2,5,9,2,25,2,2,2,5,2,6,2,2,2,5,1,2,5,5,6,1,2,2,6,1,5,2,5,9,2,25,2,2,2,2,11,192,206,204,200,200,200,199,199,200,198,200,200,195,200,74,
+2,2,5,2,2,2,5,10,7,13,7,13,17,21,11,2,2,2,21,11,11,13,6,11,6,8,2,6,7,13,13,14,17,30,13,6,6,2,2,2,2,2,12,13,30,47,47,34,36,119,114,8,13,20,20,13,13,11,16,13,14,29,16,24,20,15,22,108,20,33,18,111,109,109,20,31,13,6,109,24,33,18,11,29,18,14,13,2,7,7,7,13,7,7,13,7,2,13,2,2,6,2,13,5,7,12,12,13,2,2,2,11,2,2,2,2,11,15,13,13,11,2,16,16,13,16,29,6,16,8,7,6,6,2,2,6,1,1,2,16,12,1,1,1,1,0,2,7,6,1,0,1,5,2,2,1,1,1,1,1,1,1,2,7,7,13,6,6,1,2,2,2,5,2,2,1,1,1,1,2,6,0,1,1,1,1,2,9,11,1,2,2,6,2,1,1,1,1,1,1,1,1,2,2,5,2,9,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,2,1,2,2,5,2,9,6,6,7,2,6,11,11,7,7,7,11,2,10,2,13,2,2,2,1,2,2,6,2,11,5,7,5,9,2,5,9,9,5,9,2,5,2,2,5,2,9,5,10,1,2,6,2,2,6,9,2,5,5,78,7,11,1,2,6,2,9,2,5,11,51,7,2,11,166,201,198,200,198,196,199,199,199,199,196,199,195,196,199,131,
+2,5,2,2,5,2,2,10,21,11,7,13,13,21,6,1,5,13,13,7,7,11,7,11,17,6,2,13,13,14,13,13,22,16,11,6,2,2,5,2,2,5,14,45,117,119,119,32,47,47,125,29,11,24,114,26,6,7,13,7,22,16,16,45,122,18,22,111,33,109,24,114,111,109,31,18,11,11,114,24,37,18,11,33,33,11,13,2,11,7,13,7,6,13,21,11,2,7,2,7,2,2,2,13,11,13,2,2,2,5,2,5,2,5,2,7,17,11,11,7,13,1,13,17,11,21,17,6,17,11,11,6,2,1,2,2,1,1,2,10,7,2,2,1,1,1,2,7,2,2,1,1,2,2,1,1,1,1,1,2,1,1,2,2,6,7,7,2,2,12,1,26,10,1,1,1,1,1,1,1,25,26,2,1,1,2,1,1,5,2,2,11,2,2,2,9,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,1,1,1,5,2,1,2,1,2,2,2,2,10,6,2,11,11,6,11,8,11,13,11,6,7,7,2,11,1,1,1,11,2,2,5,9,2,2,5,2,2,9,2,2,2,2,2,6,2,2,2,2,10,2,11,2,2,2,2,2,2,1,12,69,200,65,74,70,5,1,9,2,10,13,60,35,64,78,188,204,204,200,200,200,198,200,196,195,200,199,199,198,199,200,74,
+2,1,5,2,2,5,5,13,11,13,5,7,13,7,2,2,13,12,7,13,13,11,8,8,7,11,2,13,6,11,13,22,31,17,11,6,6,2,2,2,2,2,29,106,32,30,34,30,117,140,123,19,8,34,105,1,11,6,29,29,30,24,30,45,34,11,22,106,33,33,24,118,114,109,33,18,13,11,114,108,109,16,13,46,18,11,21,2,6,11,7,7,13,17,16,2,11,2,2,13,17,6,5,26,2,5,2,6,2,2,7,2,2,2,11,13,13,13,7,13,6,1,7,13,16,13,16,11,13,11,13,2,6,2,2,5,1,1,2,22,7,6,0,1,1,1,2,7,6,2,1,2,1,1,1,1,1,1,2,1,1,1,2,7,6,6,6,2,2,2,1,21,1,1,1,1,1,1,0,1,2,1,1,1,1,5,2,2,2,2,5,2,2,5,2,2,1,1,1,1,1,2,1,1,1,2,2,5,1,1,1,1,1,1,2,1,1,2,1,1,1,2,1,1,1,1,1,1,2,1,5,2,2,5,2,2,6,6,6,6,6,7,7,7,11,11,13,11,5,2,12,10,2,1,1,5,1,9,9,2,5,2,5,2,2,6,2,5,11,2,2,2,2,2,2,6,6,2,2,11,2,2,11,2,6,6,134,204,200,204,196,190,134,1,13,29,5,11,192,131,200,204,204,204,198,201,198,200,203,199,196,179,200,179,200,179,199,198,179,74,
+2,1,2,5,10,2,10,10,7,13,10,7,21,11,2,6,5,13,6,11,13,13,11,13,11,17,2,7,7,7,29,24,24,16,11,13,2,2,2,6,2,11,22,29,22,30,47,36,45,147,125,31,8,136,33,11,2,6,11,13,16,16,13,33,106,32,43,110,33,33,24,111,114,111,24,15,11,15,118,33,110,11,29,34,109,13,2,2,11,11,11,13,14,22,13,7,6,2,6,21,29,13,13,2,2,2,5,2,5,2,6,2,5,2,11,13,13,11,11,13,2,1,11,13,16,21,29,7,11,11,11,6,2,2,6,1,1,1,12,14,6,2,1,1,1,1,2,6,1,1,1,6,1,1,1,1,1,1,1,1,1,1,1,1,6,7,2,2,6,1,26,10,12,10,1,1,1,1,1,1,5,2,1,1,2,2,2,2,6,1,2,2,2,10,2,2,2,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,1,1,1,2,1,1,1,1,1,2,1,2,1,2,1,6,1,5,2,2,11,11,6,6,6,6,6,7,13,11,7,6,10,10,2,2,1,1,2,9,5,5,2,6,9,2,9,2,2,2,2,2,11,2,6,43,67,155,78,28,13,167,67,16,7,13,22,50,198,200,200,199,199,195,200,204,178,204,201,30,175,204,201,198,204,199,200,200,200,200,200,200,198,198,199,194,198,179,198,202,194,198,157,
+2,2,6,2,2,2,2,5,12,11,13,13,13,11,5,2,5,2,6,11,13,11,7,13,11,11,2,7,11,17,29,30,24,11,7,7,6,2,2,2,7,23,16,16,22,36,45,30,116,145,109,18,16,18,24,11,2,2,13,29,13,22,30,47,119,32,36,34,33,109,109,114,111,109,32,17,13,13,111,20,110,13,18,109,20,11,2,1,11,15,15,10,16,24,13,13,6,2,6,13,16,21,14,2,6,12,2,2,2,5,1,2,2,2,13,13,7,11,14,17,2,1,7,15,17,16,13,11,11,11,11,11,2,6,1,2,1,1,14,11,2,5,0,1,1,1,2,2,2,2,41,2,2,6,1,1,2,1,1,1,1,1,1,2,11,7,35,40,2,60,67,2,10,2,1,1,2,1,1,1,1,2,2,1,2,6,9,2,2,11,6,2,2,2,2,2,0,1,1,1,0,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,2,2,6,1,2,2,2,11,6,6,11,8,11,11,13,2,2,10,11,2,2,1,1,2,5,2,5,2,2,2,5,5,2,2,5,6,65,78,65,167,199,179,177,199,194,170,202,198,195,176,195,199,203,179,198,179,200,198,179,200,195,199,200,200,200,204,196,200,200,198,200,198,204,200,200,198,200,199,199,198,198,194,198,198,198,198,179,74,
+1,1,2,2,5,2,6,5,13,14,13,10,11,13,2,2,11,2,11,7,11,7,13,11,13,13,2,11,11,14,32,33,29,110,105,15,2,2,6,7,16,29,16,17,22,22,22,34,126,146,114,18,8,8,24,8,11,6,6,14,29,16,13,34,34,46,17,34,33,24,33,118,114,108,109,15,2,7,122,111,111,11,22,22,24,11,6,0,13,11,15,15,22,22,13,6,2,2,13,13,13,29,7,2,2,2,5,6,2,2,5,2,2,13,7,7,29,17,29,21,2,2,13,16,16,14,13,13,8,13,13,11,2,1,2,6,1,1,13,7,2,2,1,1,1,1,2,13,6,0,2,1,6,1,2,0,2,0,2,2,2,2,2,11,2,21,38,6,1,40,51,6,2,1,1,1,1,1,1,1,2,1,1,2,1,2,2,6,1,5,6,11,2,2,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,6,1,5,1,1,1,1,1,1,1,1,1,1,1,2,2,2,6,2,5,2,2,5,2,6,6,6,7,11,11,11,8,2,11,11,13,2,11,2,1,5,2,2,2,2,2,2,29,175,7,66,190,75,2,169,179,194,169,171,194,173,171,194,194,194,173,179,194,173,179,194,179,179,198,198,179,198,198,179,196,199,199,199,200,198,200,199,200,200,203,200,198,200,202,196,198,179,198,179,198,198,179,198,177,179,131,
+1,1,5,2,2,5,11,6,7,13,7,11,7,10,6,5,7,2,2,11,7,7,13,13,7,7,2,13,11,16,34,36,46,119,116,11,6,2,6,29,16,30,16,22,11,106,110,114,126,150,115,8,8,22,19,31,31,2,16,30,30,32,22,22,37,109,14,33,31,33,109,111,111,109,111,11,11,29,111,122,109,6,6,110,111,11,0,2,11,16,15,22,30,13,21,11,6,6,7,14,22,30,2,5,5,5,7,2,2,2,6,2,5,13,13,14,17,29,29,14,5,1,2,13,13,29,14,13,15,13,11,6,6,2,6,1,1,1,14,13,1,1,1,1,1,2,6,5,2,6,2,2,2,64,76,1,1,1,1,1,1,1,2,11,2,12,2,2,72,12,9,1,2,1,1,1,1,1,1,1,1,9,5,2,2,5,2,2,6,6,7,2,5,2,2,5,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,5,2,2,2,2,2,6,1,6,6,11,6,6,11,6,7,7,2,6,8,11,13,6,2,2,2,2,2,6,2,6,21,168,179,168,173,179,158,66,177,173,171,171,177,169,194,177,179,179,177,194,173,194,179,179,179,194,179,198,179,202,195,179,200,198,199,179,199,199,200,199,196,198,200,200,196,199,199,195,198,198,198,198,198,202,179,198,179,198,179,74,
+1,1,2,2,6,1,11,6,13,13,13,11,7,7,2,10,11,6,2,13,13,13,13,11,13,7,2,7,14,18,37,22,110,132,120,11,2,13,16,34,18,37,29,23,106,138,106,136,138,146,113,6,13,20,15,24,122,6,22,18,29,29,22,29,34,33,14,17,31,34,114,114,116,106,111,29,3,29,109,125,109,6,14,126,117,13,2,0,11,17,22,16,11,7,11,2,2,2,13,16,30,30,2,2,5,5,5,12,2,5,2,2,13,11,7,14,23,29,16,2,2,5,2,13,15,14,17,13,17,5,11,13,7,6,1,2,1,2,13,1,2,1,1,1,2,2,2,13,6,2,2,2,5,1,1,1,2,1,1,1,1,1,7,13,2,6,2,2,5,1,2,5,1,5,1,1,1,1,1,1,1,1,2,5,2,2,2,1,2,10,10,13,2,5,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,6,1,2,1,1,1,1,1,1,2,6,1,5,2,5,2,2,2,2,11,11,11,6,11,6,11,6,6,7,6,2,6,5,2,2,1,6,5,2,11,2,155,171,162,194,171,168,177,177,171,169,194,168,168,171,177,169,194,171,177,194,194,177,194,194,173,179,198,194,195,179,198,198,179,196,198,199,198,179,198,199,200,199,199,200,198,200,196,199,195,198,198,179,198,179,199,179,198,179,194,74,
+1,2,2,5,2,2,10,6,13,11,10,5,11,5,2,13,13,2,11,13,7,13,7,14,21,7,2,13,16,22,46,16,46,126,106,6,2,7,7,29,16,32,15,132,119,126,124,144,140,152,19,6,8,19,22,18,21,2,29,22,22,30,17,14,30,24,13,17,110,109,109,111,109,109,109,15,11,13,108,132,116,6,110,126,122,13,2,11,14,22,45,2,5,13,2,13,2,7,13,29,32,21,1,2,6,2,2,2,2,2,2,2,21,7,13,29,16,23,2,1,2,2,2,13,13,13,14,11,11,8,13,13,6,2,2,6,2,2,2,5,6,1,1,1,2,5,2,13,7,6,1,2,7,6,2,5,5,1,1,1,1,2,13,11,2,2,2,2,1,1,2,9,2,1,1,1,1,1,1,1,1,2,1,2,10,5,5,2,2,10,7,2,2,2,2,2,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,2,5,1,2,1,1,1,1,5,2,1,2,2,6,1,2,5,2,5,2,6,2,13,6,11,13,11,11,11,2,2,13,2,2,2,6,6,2,2,11,66,171,194,162,168,169,194,171,171,171,177,168,171,171,171,175,171,169,194,168,173,168,171,179,194,194,179,198,179,194,198,179,202,195,194,198,198,179,198,202,179,198,200,199,199,199,199,199,199,198,199,179,202,198,198,179,198,202,179,179,74,
+1,5,2,2,1,2,5,5,10,11,7,10,7,5,5,21,11,2,5,13,13,13,14,13,13,7,6,13,14,32,43,17,48,106,33,11,6,13,11,30,29,16,8,106,132,138,149,140,138,153,19,6,8,126,114,33,11,2,7,16,36,17,29,22,34,15,22,22,34,33,109,114,119,33,24,8,6,13,109,109,44,2,119,123,114,17,29,2,21,30,11,1,2,7,6,7,7,12,13,21,32,11,2,2,2,2,6,2,11,2,6,5,7,7,7,29,22,16,0,2,2,2,11,13,13,17,13,8,6,14,11,13,6,1,6,1,7,2,13,2,2,1,1,1,2,2,2,14,7,2,1,2,13,1,1,2,6,2,5,2,1,1,11,7,11,6,2,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,6,2,5,2,2,5,2,11,6,2,2,6,12,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,2,6,1,5,2,2,2,6,2,2,2,2,11,7,7,7,6,14,11,6,6,2,6,1,2,6,11,11,6,6,6,42,194,169,168,162,171,162,168,162,168,171,173,169,171,168,171,171,162,168,168,171,194,168,194,168,169,179,177,179,179,198,198,179,198,179,195,179,179,198,195,194,179,195,179,202,195,202,179,200,195,198,198,198,179,199,179,198,198,179,179,179,69,
+1,2,2,5,1,1,2,5,12,11,7,10,13,2,5,13,11,11,2,14,13,13,13,13,7,5,2,13,29,36,22,16,18,119,120,11,7,7,7,34,11,17,29,119,123,125,140,138,140,148,4,13,15,126,33,13,13,29,14,29,32,29,13,13,32,11,13,24,110,106,106,114,116,110,18,13,6,15,111,132,18,11,116,119,111,15,29,6,6,13,11,2,2,2,2,5,13,7,11,30,30,2,12,2,5,5,1,2,21,2,2,2,13,13,14,30,30,29,1,1,1,2,12,11,8,13,11,13,13,13,11,13,2,2,2,5,2,13,6,2,2,2,1,1,2,5,5,6,7,6,2,2,2,2,6,1,2,7,7,6,1,2,5,11,2,2,6,1,1,1,1,1,1,1,1,2,5,1,1,1,1,2,1,2,2,2,5,2,2,9,6,1,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,2,1,2,1,2,1,1,1,1,1,1,1,1,1,1,2,6,1,2,1,5,1,5,2,2,11,2,11,2,10,10,13,10,7,11,1,2,2,6,11,11,11,11,2,69,169,162,162,167,169,169,168,171,175,169,171,168,168,171,171,162,169,168,168,168,168,169,168,171,194,177,175,171,177,179,179,195,202,179,198,179,179,179,198,179,179,198,198,198,179,198,198,198,177,198,194,179,179,198,179,198,198,179,198,179,194,74,
+1,2,6,6,1,6,5,10,2,2,5,11,5,2,13,13,13,11,6,13,14,14,16,16,13,29,7,16,16,33,13,13,22,106,119,15,7,11,13,22,7,17,22,133,116,116,137,144,139,150,8,13,16,122,29,11,13,16,16,16,16,13,5,6,109,6,7,34,110,116,34,123,106,111,24,11,6,15,111,141,8,13,122,122,116,22,18,2,6,13,6,2,2,5,2,5,2,10,16,43,6,7,6,2,2,2,6,2,12,2,6,5,14,7,16,30,23,13,2,1,2,1,2,13,11,11,16,6,13,13,11,13,6,1,2,2,2,5,2,7,1,1,2,6,2,2,11,6,2,2,5,2,11,2,1,13,5,11,13,6,2,6,2,21,36,21,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,5,2,5,5,11,2,2,2,10,6,7,2,1,1,1,1,1,1,1,1,26,5,1,1,1,1,1,1,1,1,5,2,1,1,1,2,1,2,1,1,1,1,1,1,1,2,1,2,5,2,2,6,2,2,5,2,10,10,5,11,13,13,6,5,10,2,11,11,11,15,11,2,6,66,169,166,162,169,162,168,162,169,162,162,162,171,171,168,168,169,168,168,168,177,162,168,168,177,162,171,171,169,177,194,194,177,177,179,202,179,179,179,179,177,198,202,179,177,199,179,198,179,179,179,179,179,179,179,173,195,179,195,202,179,179,177,74,
+1,2,2,11,5,1,2,7,2,5,2,5,2,5,21,13,13,13,13,11,13,13,13,13,11,13,6,14,22,32,8,11,22,106,114,15,13,2,16,22,11,15,119,141,110,106,144,138,128,150,4,11,24,24,6,16,16,29,13,13,13,6,6,7,114,2,29,37,110,106,106,123,116,46,8,13,6,17,118,138,6,13,122,122,120,20,15,2,2,13,6,2,2,2,2,2,2,13,6,11,13,6,2,2,2,5,2,2,13,2,2,2,14,7,14,29,30,13,2,1,2,2,2,21,13,29,16,13,14,8,7,13,2,2,2,6,5,2,13,1,1,1,1,2,2,2,12,2,11,2,2,12,2,2,5,11,2,12,11,7,6,2,2,35,30,2,2,1,1,1,1,2,1,1,1,1,2,1,1,1,1,1,5,2,2,2,11,2,12,2,11,6,7,2,6,1,1,1,1,1,1,2,1,2,6,9,2,1,1,1,1,1,1,2,2,1,2,5,1,1,1,1,1,1,1,1,1,1,5,2,1,6,1,1,2,2,6,5,7,6,2,6,7,17,13,2,9,2,7,10,13,13,11,6,66,159,169,162,169,162,162,162,162,162,162,162,169,168,168,168,169,168,168,168,169,162,168,168,168,168,168,169,168,168,194,162,171,171,194,179,194,179,179,194,173,198,194,173,194,179,198,194,194,179,194,179,179,202,179,177,194,179,173,179,179,202,194,179,171,74,
+1,2,5,2,2,2,6,5,5,2,1,2,10,12,11,11,13,13,17,11,11,11,13,13,6,11,2,29,16,33,13,13,33,116,116,31,17,6,22,16,7,37,144,139,110,117,141,127,138,150,4,6,17,24,11,22,16,7,13,13,7,6,2,14,111,2,34,109,47,122,33,47,116,22,17,6,2,22,116,126,1,22,122,122,116,33,7,11,2,6,6,2,6,2,2,6,2,13,13,13,13,2,7,2,5,2,2,2,13,2,2,6,2,6,7,13,22,11,6,1,2,1,2,15,13,11,7,6,13,13,13,11,2,2,5,1,2,2,13,2,1,1,2,5,2,5,2,6,2,6,7,6,2,2,6,5,6,7,13,13,7,7,13,7,2,2,5,2,1,1,1,1,1,1,1,5,2,1,1,1,1,2,2,2,6,2,5,2,7,6,7,6,11,6,6,0,6,1,1,1,1,1,1,1,2,51,2,1,1,1,1,1,5,2,5,2,1,2,2,2,1,2,1,1,1,1,1,2,1,2,2,2,2,6,1,5,1,2,2,2,6,6,21,16,11,10,5,9,11,1,13,10,13,42,168,162,162,162,167,169,168,162,167,169,169,167,168,162,162,162,168,162,168,162,171,162,171,162,168,168,162,162,171,171,162,168,171,171,177,171,177,194,194,177,194,179,179,194,173,179,177,179,179,173,194,179,194,177,194,173,179,177,179,179,179,194,179,169,173,74,
+1,1,2,2,5,2,2,5,2,2,6,1,2,2,2,5,11,13,22,11,6,8,11,8,11,13,7,29,16,30,11,15,44,122,122,106,17,7,46,17,16,133,139,149,106,132,144,138,138,153,113,19,22,44,17,21,13,13,13,13,6,2,2,13,110,2,36,22,106,34,33,31,114,11,6,6,6,18,106,106,2,114,126,126,122,108,6,2,2,2,7,6,2,2,2,2,11,7,14,14,13,2,6,2,2,2,2,5,7,13,1,7,6,14,13,17,22,7,2,2,2,5,7,6,6,2,6,11,13,11,13,7,1,2,2,13,1,7,7,6,1,1,2,2,6,11,11,6,2,7,5,2,5,1,5,7,2,11,13,13,7,13,6,7,6,2,2,1,2,2,1,1,1,1,2,2,1,1,1,1,2,5,2,2,5,2,10,11,6,7,8,11,11,6,2,2,2,1,5,2,2,1,1,1,1,1,1,2,1,1,1,1,2,1,2,2,2,5,2,2,5,1,2,1,1,1,1,1,2,5,2,5,2,2,2,6,2,5,11,2,6,11,14,15,13,2,5,11,11,5,15,13,15,69,162,162,162,162,162,169,162,162,162,162,171,162,168,162,168,162,162,168,162,162,162,168,162,168,168,162,162,171,162,171,169,194,160,171,162,194,171,177,171,194,169,179,194,177,179,194,194,173,173,194,179,179,171,179,171,179,177,194,173,179,179,179,173,171,171,74,
+2,5,2,5,10,27,21,7,2,5,2,6,2,5,2,2,13,11,16,11,6,13,13,13,13,11,6,17,16,22,13,17,34,119,120,111,17,6,109,18,30,130,144,133,119,132,144,149,142,150,115,147,113,13,13,13,13,16,29,14,7,6,6,22,8,13,116,24,116,110,46,139,108,8,13,2,15,18,46,6,11,123,138,132,123,109,11,6,6,6,11,6,2,6,6,2,11,7,17,15,13,2,2,6,2,13,2,2,7,6,6,2,6,7,7,22,32,6,2,2,1,2,2,7,2,6,11,13,11,7,13,6,1,2,6,2,5,11,7,2,1,2,2,2,13,13,14,8,2,7,6,2,2,2,5,2,13,13,11,13,11,11,14,2,5,2,2,5,2,5,1,1,2,1,1,1,1,1,2,1,2,1,5,2,2,7,13,11,11,13,11,11,17,6,2,6,1,1,1,0,2,1,6,0,1,1,2,51,2,0,1,1,2,6,1,5,1,1,1,2,2,5,1,2,1,1,1,1,1,2,2,2,2,5,2,2,2,2,9,13,6,14,13,21,26,10,27,11,11,6,11,49,166,169,162,159,162,162,162,162,162,168,169,162,168,168,160,175,169,162,168,162,162,168,162,168,162,169,162,168,168,162,171,162,194,162,194,171,177,162,168,171,169,194,171,173,177,171,177,171,179,179,177,194,179,179,194,179,177,179,179,194,173,179,173,171,177,171,162,74,
+2,2,5,2,5,5,1,5,5,11,1,1,2,2,6,2,11,13,29,15,11,15,15,13,11,11,6,16,29,16,8,22,36,116,123,122,8,11,119,122,37,133,149,137,133,132,132,136,149,150,113,150,115,6,11,11,17,16,13,7,6,1,6,18,2,32,111,46,119,138,34,133,105,13,18,6,29,24,15,2,14,144,136,116,126,111,15,6,11,1,13,11,2,2,11,7,13,11,23,17,11,2,2,2,7,2,2,2,13,7,6,7,2,7,13,22,17,6,2,2,1,2,7,2,2,13,7,13,13,11,13,2,2,2,13,2,2,13,6,2,2,2,2,6,7,13,6,14,7,6,2,2,2,2,5,6,7,13,13,11,11,7,11,2,2,6,2,2,1,2,1,1,1,2,1,1,1,1,1,1,1,2,2,5,11,11,11,11,6,11,13,11,8,11,2,2,2,2,72,72,73,27,38,10,1,1,2,27,25,10,1,1,1,2,2,2,6,2,5,2,6,1,1,1,1,1,1,1,2,6,1,5,2,2,2,11,11,10,11,2,21,7,13,7,10,5,10,11,40,155,168,168,162,159,162,162,169,159,162,162,168,162,168,168,168,162,171,169,162,162,168,169,162,162,168,168,168,168,168,168,162,171,162,168,162,168,169,169,162,171,162,167,168,168,168,171,168,168,171,169,171,179,177,194,173,169,179,173,194,169,173,179,194,179,194,173,194,173,162,74,
+5,1,1,2,5,2,6,10,7,13,2,1,5,2,2,2,2,13,17,22,6,11,15,13,11,11,6,16,17,17,6,33,109,132,116,125,17,6,123,122,116,132,130,133,126,126,133,144,150,153,115,150,114,2,6,6,7,7,6,2,6,6,2,7,2,106,22,114,132,123,34,122,114,33,33,2,33,109,15,2,22,138,140,150,126,29,8,2,2,2,11,11,2,2,5,11,13,13,21,2,2,2,6,2,7,2,6,2,1,11,2,6,5,7,13,22,11,11,6,1,2,2,6,7,12,2,6,13,13,13,13,6,6,7,5,2,2,2,12,2,1,2,7,7,7,6,13,7,7,13,2,5,1,1,12,6,7,11,13,7,6,11,6,2,5,2,2,5,2,2,5,2,1,1,1,1,1,1,1,1,2,5,2,2,2,13,11,11,6,13,11,17,15,11,6,2,5,1,9,25,9,38,51,38,51,10,1,9,25,9,1,5,2,2,1,5,2,2,2,2,2,2,1,1,2,1,1,2,5,2,2,2,5,2,2,11,10,7,11,2,11,13,10,10,28,11,17,43,169,162,160,162,162,162,162,162,160,169,162,162,162,162,167,169,169,162,162,162,168,168,169,169,169,169,169,169,168,168,168,168,162,169,162,162,169,162,167,169,169,162,171,162,162,162,168,169,162,168,169,173,162,173,179,177,194,194,171,177,171,177,194,169,179,173,179,171,173,171,168,74,
+2,6,2,5,5,1,2,5,5,2,1,2,2,5,2,5,6,13,22,15,11,17,8,7,13,11,16,43,17,29,13,34,34,119,110,132,18,11,117,119,34,130,132,133,150,123,133,144,150,152,143,148,105,6,6,6,6,6,6,6,2,6,6,6,16,123,18,132,114,123,144,125,114,34,106,6,34,114,15,2,34,148,144,124,114,8,11,2,2,6,16,6,2,6,7,13,11,7,2,6,7,6,1,7,6,2,13,6,13,7,5,7,6,13,12,8,13,6,2,6,2,1,7,2,2,2,11,13,13,16,7,13,6,2,7,6,2,2,13,1,2,2,13,11,6,8,7,7,7,7,2,2,2,1,5,7,7,10,7,11,11,11,6,2,2,2,5,2,2,6,2,5,1,1,1,1,2,1,1,2,5,2,2,5,2,11,11,6,13,8,13,8,17,8,2,2,2,2,1,2,27,10,1,1,1,1,1,10,1,1,2,2,5,2,2,2,2,2,5,2,2,5,2,2,5,2,1,2,2,2,1,6,2,5,2,6,10,9,11,6,13,10,21,13,14,11,22,169,160,160,162,160,162,169,167,160,167,160,168,162,162,171,162,168,162,168,168,169,169,162,168,168,168,169,162,168,168,171,162,168,162,162,162,162,162,162,162,162,171,169,162,162,162,162,167,171,162,171,162,171,171,173,171,169,177,194,179,177,171,169,177,173,194,173,173,194,171,173,169,74,
+2,1,2,6,2,2,5,2,5,2,1,5,2,6,1,2,7,13,17,15,5,13,15,8,13,13,36,109,32,16,16,47,46,106,110,126,31,13,106,132,129,123,136,130,136,119,130,139,146,153,143,143,113,11,17,8,11,6,6,6,6,2,6,2,110,116,31,123,126,140,144,136,126,116,108,7,32,110,31,2,106,138,138,122,110,17,2,6,2,21,17,11,1,2,11,16,13,11,6,7,7,2,2,2,7,7,7,2,6,2,13,1,7,13,8,13,7,11,6,2,6,6,2,2,13,7,13,14,11,8,6,14,6,1,12,1,2,13,6,7,2,5,7,13,7,13,13,8,6,2,2,2,2,2,2,2,12,11,6,13,8,17,6,2,2,5,2,2,6,1,1,2,2,1,1,1,1,1,1,1,2,2,5,2,5,11,13,15,13,17,11,13,17,11,6,1,2,5,2,1,1,1,5,1,2,2,1,1,1,2,5,2,2,2,1,6,5,1,2,2,5,2,5,2,2,2,1,2,6,1,1,2,2,2,2,5,2,2,5,11,10,6,21,28,15,64,155,162,169,166,162,162,162,167,169,162,168,162,162,169,162,162,168,162,168,162,169,169,171,168,168,171,162,169,171,168,171,168,168,162,162,171,162,162,162,162,162,168,169,162,171,162,167,169,162,162,167,162,168,162,175,169,171,171,177,194,169,173,171,173,171,177,171,173,171,169,177,194,162,74,
+1,2,1,2,2,5,5,1,6,2,1,2,2,2,2,6,13,11,15,33,8,14,14,13,13,16,109,33,31,13,29,34,34,126,31,126,109,15,46,132,119,137,137,141,120,132,117,133,153,150,150,142,113,17,122,17,6,6,7,6,2,2,7,6,123,122,106,126,116,139,138,122,122,119,111,16,109,132,109,6,126,138,138,126,114,24,19,15,18,24,18,2,6,7,13,13,13,2,2,7,2,2,6,2,6,11,7,6,7,2,2,13,6,7,11,13,7,13,6,2,2,13,1,6,2,7,11,13,13,11,11,2,2,2,13,2,5,11,7,13,17,11,13,11,6,7,7,7,6,6,2,1,2,2,2,13,11,13,13,11,7,17,7,2,6,2,2,5,1,1,1,1,1,2,9,2,1,1,1,5,1,6,1,6,2,10,11,15,17,15,8,17,17,15,2,2,2,2,2,60,5,2,1,9,38,25,1,6,1,1,2,6,2,5,1,2,2,2,5,2,6,5,2,10,2,13,11,2,2,6,2,2,5,2,5,2,5,2,2,13,15,157,168,169,162,169,160,162,160,169,162,168,162,162,162,162,162,162,162,162,167,162,162,168,168,168,171,171,171,162,169,177,162,194,162,168,168,162,168,169,162,162,162,168,167,169,162,167,162,162,162,162,168,162,168,168,162,171,162,171,162,168,168,171,171,169,194,177,173,171,171,169,179,173,171,171,177,169,168,74,
+1,1,5,2,6,2,2,5,1,2,1,2,5,2,5,2,13,13,32,46,17,21,13,13,7,22,32,22,17,13,14,34,106,124,22,123,111,8,120,110,106,151,114,139,144,132,132,132,148,153,150,115,114,17,114,13,6,6,7,2,6,2,2,12,140,108,116,132,144,151,150,144,137,119,110,16,36,106,18,13,137,138,138,126,110,18,22,6,17,22,11,13,15,13,13,2,2,2,11,6,2,6,2,2,7,7,11,2,6,2,11,7,7,7,16,11,7,11,6,6,2,2,13,1,5,13,7,6,6,6,1,6,1,2,7,2,2,13,11,14,11,13,13,7,6,7,13,7,7,5,2,1,1,2,6,13,7,11,13,7,17,8,7,2,2,5,2,2,5,2,1,1,1,2,2,1,2,1,1,1,1,2,5,2,2,10,13,15,18,29,11,15,17,15,6,2,2,5,2,2,1,2,1,2,2,0,1,1,1,6,5,1,2,2,6,2,5,2,1,2,5,2,10,11,7,13,13,11,6,2,2,25,2,2,2,2,9,2,11,78,162,161,160,162,162,162,160,167,169,162,162,162,167,169,162,162,167,169,162,162,162,162,168,162,162,171,171,168,169,169,168,171,171,169,168,168,169,168,171,167,169,162,162,162,162,162,159,169,162,162,162,162,167,162,162,162,168,162,162,171,162,168,169,168,194,169,177,171,169,179,173,194,168,177,171,173,168,171,168,74,
+2,1,2,1,2,2,6,2,2,1,1,1,2,2,2,2,11,13,20,36,33,10,11,11,13,22,33,36,32,13,30,24,37,123,8,119,114,33,119,34,119,145,114,122,137,136,133,139,153,146,142,127,18,33,18,6,2,6,2,2,2,6,2,34,24,129,138,144,149,146,153,138,119,120,8,36,15,33,8,22,144,138,147,126,114,6,18,13,13,16,13,117,29,11,13,11,2,13,7,7,6,2,7,14,7,7,13,1,12,6,10,13,10,11,13,13,11,11,13,7,7,2,2,2,13,13,7,7,2,6,13,1,5,10,13,1,10,7,13,13,13,7,11,7,2,7,2,13,2,2,6,1,1,1,12,7,7,7,7,13,13,17,2,6,2,2,2,5,2,1,1,1,1,2,2,5,1,1,1,1,1,7,2,2,5,11,11,17,15,8,13,17,31,15,2,2,2,2,5,51,11,1,1,1,1,1,1,1,2,2,2,2,5,2,2,2,2,6,1,2,10,7,13,13,11,13,13,21,13,6,2,2,2,2,6,10,5,10,11,87,160,159,162,160,159,162,162,162,162,167,169,162,162,162,162,168,162,168,168,169,169,169,162,162,162,162,168,168,168,169,162,168,168,168,162,167,168,162,162,162,162,167,169,162,162,162,162,162,167,171,162,168,162,162,175,162,162,162,162,162,168,168,162,168,169,171,171,169,194,173,194,171,177,171,173,173,171,173,168,74,
+1,2,1,2,1,6,1,2,5,2,1,5,2,2,5,2,11,13,22,18,110,6,13,16,11,32,37,34,36,13,30,16,123,125,29,37,34,43,136,149,151,138,144,132,138,139,132,133,149,152,143,143,113,18,18,11,6,2,6,6,2,7,6,37,24,144,144,138,150,152,150,136,137,116,5,126,11,13,2,106,146,153,144,123,8,13,13,17,17,22,11,14,6,2,13,2,6,6,11,11,7,6,7,29,13,7,2,6,5,2,12,13,11,7,13,17,7,7,2,2,6,6,12,2,12,11,13,6,2,13,2,1,2,10,2,2,12,13,13,13,11,13,7,6,7,7,16,16,11,2,2,1,2,1,7,11,13,13,13,7,11,8,2,2,2,5,2,2,2,1,5,1,1,1,2,1,1,1,1,5,1,5,2,6,1,5,13,13,15,15,15,30,29,6,6,2,2,1,9,12,10,1,1,1,1,1,1,1,2,5,1,6,2,2,5,2,5,1,12,1,5,10,7,11,7,11,21,24,111,46,131,131,11,2,2,9,11,6,29,163,162,162,162,162,162,162,162,162,162,162,162,162,162,167,169,162,162,171,167,168,168,169,169,162,168,162,171,168,168,168,168,168,169,168,168,162,162,162,162,162,162,168,162,162,167,169,162,162,162,162,162,168,162,162,162,162,162,162,162,162,168,169,168,173,171,173,173,194,169,194,177,171,173,171,173,171,169,177,169,74,
+2,5,1,2,1,2,2,10,2,1,2,2,2,6,2,12,1,14,36,114,119,6,21,29,14,29,34,45,17,29,23,45,132,122,33,31,44,132,122,132,183,138,149,123,147,132,132,138,154,145,150,146,127,20,31,6,6,2,2,2,6,1,2,33,24,144,144,149,149,144,147,139,137,116,16,31,8,8,11,136,144,144,123,122,11,14,14,29,22,16,11,2,2,2,2,40,41,41,40,27,40,73,73,49,2,2,2,2,6,2,11,7,13,13,11,6,11,6,2,2,2,5,2,2,13,13,7,7,5,2,2,2,2,5,2,2,13,13,13,13,11,6,7,13,6,7,15,6,6,2,2,2,1,2,7,11,13,13,6,6,11,17,2,2,6,2,2,5,1,2,2,9,2,2,2,1,1,1,1,2,1,2,5,1,2,5,11,8,17,15,18,30,30,11,2,38,6,1,1,1,1,1,5,2,2,1,1,2,2,2,6,1,2,5,2,2,2,6,10,2,5,9,13,13,26,29,120,45,180,173,198,202,30,2,5,2,2,42,156,162,162,161,168,168,162,162,168,168,169,162,169,162,168,162,168,168,162,162,162,162,167,169,169,162,162,162,162,162,168,169,168,162,168,162,162,169,162,162,167,162,162,162,162,162,162,162,167,169,162,162,162,162,168,162,162,162,162,168,162,169,171,171,162,177,171,171,177,171,177,177,173,171,177,173,171,173,171,171,171,74,
+2,2,5,2,1,5,5,25,2,1,2,5,2,2,11,7,13,30,34,46,109,13,16,22,15,22,46,34,22,29,32,30,106,140,33,110,18,126,114,151,153,126,126,48,150,140,119,139,184,146,154,146,145,24,114,19,7,6,6,2,6,2,2,32,109,139,144,149,144,150,150,137,139,109,22,33,21,117,6,126,126,138,136,114,30,11,7,13,30,16,7,11,2,5,2,2,6,1,6,2,2,1,2,5,2,2,5,2,2,2,2,11,13,13,11,13,8,2,2,6,2,2,6,2,12,13,11,2,7,2,2,2,2,5,2,2,12,7,7,2,7,11,13,13,6,11,7,6,6,2,6,1,2,13,7,13,13,13,15,29,16,29,7,2,2,2,2,6,2,1,2,1,1,1,2,2,1,1,5,2,1,2,10,2,5,11,6,17,15,17,33,17,36,2,2,2,2,2,6,1,1,2,6,57,21,5,1,2,5,2,2,2,5,2,5,2,5,10,2,5,10,10,12,14,7,117,132,129,194,179,171,179,159,2,65,41,159,162,160,171,160,162,168,162,162,169,168,169,168,168,162,168,169,162,162,167,162,162,168,168,162,171,162,168,168,162,169,162,171,160,162,162,162,162,162,167,162,160,162,162,168,162,167,171,169,162,168,162,169,168,169,162,162,168,168,162,168,169,171,171,171,173,171,173,169,171,179,173,171,171,194,171,173,171,173,171,171,173,162,74,
+2,5,2,2,1,2,2,2,1,1,2,2,5,2,7,13,21,29,22,34,33,8,29,32,16,36,117,46,29,22,17,22,120,132,114,116,120,110,144,153,183,144,120,117,153,144,106,133,150,153,153,146,150,115,33,8,6,2,2,6,6,6,2,117,126,133,147,150,149,144,147,139,144,31,22,34,18,109,1,126,126,128,125,126,109,24,29,6,2,6,11,13,2,2,1,2,2,6,1,2,6,2,2,2,1,1,2,1,5,2,5,11,11,11,8,15,13,6,2,2,2,2,7,2,13,11,7,7,7,13,1,1,2,10,2,2,21,11,11,6,13,13,14,11,11,13,11,11,8,2,6,2,2,11,7,13,13,11,18,29,18,20,11,6,2,5,2,2,2,6,1,1,1,1,1,2,2,1,2,1,5,2,2,5,2,2,11,8,15,29,31,24,17,6,2,6,6,2,2,1,1,1,2,1,1,1,1,2,2,5,2,6,2,2,2,2,2,21,2,6,5,1,21,164,18,119,141,176,179,179,173,173,171,194,173,173,169,171,162,162,162,162,162,171,169,171,169,162,168,169,168,168,162,162,162,168,162,162,162,168,162,168,168,168,168,162,171,162,167,169,168,162,169,160,162,162,160,167,169,169,171,169,171,162,171,177,168,177,171,162,168,171,162,173,162,171,171,173,194,171,194,179,171,179,194,177,171,177,194,173,179,194,173,173,171,177,171,171,169,74,
+2,2,2,5,1,2,5,1,1,1,5,2,2,2,13,13,13,16,30,43,17,13,16,46,17,29,23,45,16,30,46,106,110,126,126,132,109,106,149,183,144,144,126,45,152,149,106,144,153,183,153,152,142,19,108,8,11,6,2,6,2,2,6,37,110,138,144,149,151,150,146,123,136,15,29,24,24,109,13,144,122,127,125,122,24,22,11,2,2,2,8,13,2,6,2,5,7,2,11,2,2,2,6,1,1,2,5,1,2,2,2,6,13,8,15,22,15,2,6,2,2,13,10,13,13,7,6,6,7,2,1,1,2,13,2,2,13,11,2,11,14,15,11,7,8,17,11,11,13,2,6,2,2,13,5,11,11,13,24,31,108,109,6,2,2,2,2,5,1,1,2,2,12,1,2,2,5,5,2,2,6,1,5,2,5,2,11,15,15,17,33,24,34,15,6,6,2,11,6,2,2,1,1,2,1,6,1,2,6,1,2,2,2,2,5,2,2,21,13,7,6,68,202,198,176,176,179,179,179,179,179,169,173,171,171,168,171,162,162,162,168,169,162,162,171,162,169,162,171,162,168,168,169,168,168,168,162,162,168,171,162,168,169,169,162,171,162,162,168,162,162,168,162,160,169,162,162,162,168,168,168,171,168,169,194,168,171,171,173,173,171,179,171,171,171,173,194,173,179,179,179,173,194,173,179,179,179,194,173,194,173,179,179,179,194,169,179,173,169,74,
+2,6,5,1,2,1,6,2,1,1,2,2,6,2,21,13,13,14,31,34,29,7,33,37,22,17,29,32,22,106,120,116,122,126,132,138,126,119,153,184,141,144,140,36,154,144,117,149,153,154,153,154,127,34,20,15,11,6,6,6,6,2,2,29,24,150,151,144,139,146,138,138,122,11,16,24,18,24,22,145,142,122,140,20,31,17,13,2,5,2,15,17,2,2,2,2,5,2,7,11,2,2,2,1,1,1,1,1,2,5,2,7,15,13,15,17,13,6,6,2,2,10,7,11,13,10,13,5,11,6,2,0,2,13,2,11,11,13,13,11,7,13,13,11,14,11,8,13,11,6,2,6,2,13,13,21,17,13,18,24,33,24,2,2,2,6,2,2,5,1,2,9,9,1,1,1,1,2,2,1,2,2,6,1,2,11,13,17,22,30,109,24,15,36,11,7,13,110,16,22,2,1,2,2,6,1,2,6,1,11,2,2,6,2,2,6,5,29,30,21,78,198,198,179,179,202,179,171,179,171,179,173,171,173,168,194,162,168,168,168,168,169,162,171,171,169,171,177,162,171,162,169,168,168,168,162,162,167,171,162,168,168,162,168,162,171,162,169,168,162,162,168,168,162,162,162,162,162,168,168,169,173,162,171,171,173,171,173,171,179,179,194,173,179,179,194,179,177,179,179,179,179,202,179,179,179,194,179,202,179,179,179,194,179,179,179,179,171,169,74,
+2,2,6,2,6,1,2,1,2,5,2,5,1,2,14,16,16,32,46,30,16,7,117,130,114,11,16,109,24,106,33,106,126,126,122,141,126,147,153,151,139,149,128,23,154,151,153,150,154,153,152,152,143,17,24,105,26,6,2,11,2,2,6,7,24,149,144,144,144,144,126,138,34,6,17,17,22,6,24,138,143,128,126,46,33,29,11,6,2,11,8,17,11,2,6,2,2,2,13,6,2,2,5,1,1,1,1,2,6,2,13,16,17,15,15,13,6,2,2,2,7,13,6,14,13,8,2,13,13,2,6,1,1,13,2,13,11,11,2,11,13,14,14,13,13,11,17,15,15,13,2,2,15,21,13,21,29,22,29,18,109,17,11,6,2,2,2,12,9,2,2,1,1,1,1,2,5,2,1,2,5,2,2,2,6,5,13,29,33,109,109,31,13,30,109,33,127,106,114,22,1,2,12,5,21,36,2,2,2,11,6,2,2,2,2,2,12,11,30,196,198,179,179,198,179,179,179,194,179,179,171,179,171,173,171,169,171,162,168,168,168,162,194,162,169,171,171,171,171,171,171,162,168,168,168,168,162,162,168,168,171,162,171,169,162,168,168,168,168,168,168,162,169,168,162,167,169,169,162,171,194,171,173,171,171,171,194,169,179,179,179,198,179,195,179,179,177,179,179,194,179,179,195,202,195,173,179,198,179,198,198,173,198,198,173,198,173,179,179,74,
+2,7,32,17,8,2,5,2,1,2,2,2,6,7,29,13,36,45,22,36,24,12,117,132,29,2,22,34,34,110,31,122,126,138,122,123,149,133,139,139,141,144,140,36,153,150,154,186,153,153,152,150,143,20,20,127,18,11,2,2,11,6,2,13,22,123,122,138,144,145,141,126,18,11,11,22,24,3,110,151,144,128,123,32,31,11,2,2,2,13,15,17,6,2,1,2,13,2,7,2,5,2,2,1,1,1,2,1,2,2,15,8,13,15,13,6,11,6,7,6,6,13,7,16,16,13,11,13,11,2,2,1,6,13,13,6,13,7,2,21,21,29,13,11,11,15,17,15,29,11,7,13,14,15,13,13,13,18,22,34,33,6,6,2,6,6,2,2,5,1,1,1,1,1,2,5,2,5,2,1,2,2,5,2,2,2,13,13,34,44,108,18,13,119,19,114,115,47,136,133,11,6,9,11,29,18,11,11,2,11,2,6,2,6,2,2,15,24,200,179,179,179,179,179,179,179,179,179,179,179,179,179,171,179,171,173,171,171,171,171,171,171,171,169,177,168,173,168,194,168,194,168,168,169,169,162,168,169,168,162,171,168,169,168,169,171,171,171,162,169,162,171,169,162,162,162,168,162,168,171,171,169,179,179,177,179,194,173,194,179,194,179,195,198,179,179,179,198,202,194,198,198,179,198,198,198,179,179,179,179,198,195,198,202,198,198,198,179,179,69,
+2,13,22,114,33,15,16,11,2,6,9,2,2,12,36,30,47,16,21,33,29,18,47,46,11,6,29,17,18,36,24,122,138,144,109,130,110,136,149,122,123,132,148,24,154,183,186,154,183,153,153,153,142,18,24,127,108,6,1,6,6,2,2,6,114,126,122,136,144,138,144,132,17,6,6,17,110,8,137,150,140,139,33,30,33,6,2,2,5,15,11,6,6,2,2,2,2,2,12,2,2,2,5,1,1,2,5,2,5,2,21,16,29,17,11,11,17,6,8,7,13,13,11,13,16,7,11,13,13,7,1,1,7,21,21,29,17,7,10,13,13,13,11,29,32,32,15,22,15,11,11,13,14,7,13,21,29,17,33,116,116,36,34,34,13,22,2,2,2,1,2,1,1,1,1,2,2,1,1,5,2,5,2,2,5,10,13,13,33,109,33,15,13,109,32,46,33,46,117,133,11,5,10,1,11,11,119,109,1,2,2,11,6,2,29,29,16,179,179,179,179,179,179,194,179,179,179,194,179,179,179,179,179,173,171,171,171,173,168,171,173,173,171,171,169,171,194,171,171,171,168,168,168,169,171,168,169,162,169,168,169,171,162,168,168,169,162,171,171,194,162,171,162,168,162,162,167,171,162,168,171,179,173,179,179,179,179,195,179,198,179,199,198,195,198,179,198,198,179,195,199,196,198,195,198,195,198,196,198,198,198,203,203,198,200,203,195,198,179,74,
+1,2,29,34,34,22,17,22,2,2,2,6,1,7,29,30,49,2,14,34,22,18,21,22,8,13,21,22,22,16,33,116,144,144,18,116,106,149,123,146,140,149,154,24,183,153,183,154,153,153,153,153,128,10,18,114,142,11,2,2,11,2,6,6,110,116,126,145,145,150,138,124,6,11,6,30,123,8,138,137,138,119,33,16,13,2,5,2,13,33,11,2,11,6,2,2,6,1,15,11,6,2,2,1,2,5,2,2,2,2,12,16,13,17,11,7,6,6,7,6,7,16,11,13,30,11,13,16,21,11,1,1,13,16,29,29,16,11,2,13,14,29,14,22,30,16,22,16,11,11,13,13,13,13,14,14,14,33,132,125,120,34,13,126,122,138,2,2,2,1,1,2,5,1,1,2,5,2,2,1,2,2,5,2,2,6,13,21,110,20,33,8,17,117,109,116,32,45,47,133,114,10,121,119,10,26,132,70,11,6,2,6,11,8,32,30,194,195,179,179,179,194,202,179,194,198,179,179,179,169,179,173,179,171,171,173,173,171,173,171,171,173,171,169,171,162,171,162,168,168,168,162,162,162,162,168,168,168,169,162,194,161,173,171,171,169,177,162,194,168,169,194,171,169,168,168,162,162,162,194,171,169,194,194,179,179,198,179,198,199,196,199,199,199,199,198,199,199,196,199,199,196,199,199,199,199,198,198,203,200,198,204,201,200,204,200,195,198,198,131,
+2,6,21,36,21,6,18,109,15,2,6,1,12,12,13,16,13,11,6,16,18,30,33,17,13,13,11,16,16,13,34,149,138,34,122,149,116,138,138,186,141,186,183,110,185,151,153,153,154,153,153,146,142,8,122,150,125,2,2,11,6,6,11,8,110,144,150,143,146,146,122,24,2,11,11,24,114,22,119,149,123,106,33,18,5,2,2,11,8,110,15,29,106,6,2,2,2,11,13,14,13,6,2,6,2,2,2,6,2,7,22,13,18,29,6,6,6,7,7,13,6,16,11,13,18,1,21,17,13,6,2,1,13,16,29,16,17,7,14,21,29,16,21,29,18,22,22,17,33,8,13,13,13,13,14,29,29,30,125,111,15,11,20,145,126,136,2,2,2,2,5,2,2,2,1,6,1,2,6,1,6,2,2,5,2,2,21,29,117,37,22,11,16,29,36,33,43,22,109,124,21,2,132,37,6,2,182,204,74,11,6,11,20,180,198,203,198,198,179,179,179,179,179,179,179,179,179,194,179,194,169,179,179,194,173,194,169,173,173,171,194,169,173,173,171,171,169,171,168,162,168,162,160,162,168,162,175,169,169,171,171,169,194,168,173,171,169,171,173,171,173,171,169,171,168,168,169,194,169,171,162,194,173,179,179,179,195,179,198,198,196,199,199,200,199,199,195,199,203,203,199,203,199,196,199,200,200,200,200,204,200,198,204,204,200,204,198,203,196,74,
+2,2,10,11,1,13,122,114,33,11,2,1,2,6,36,16,13,14,13,7,29,24,22,43,17,13,11,17,16,13,37,140,126,149,149,138,119,149,123,153,152,153,150,24,130,149,153,152,153,153,152,150,142,116,125,128,16,2,2,2,2,6,6,6,116,150,150,143,143,125,136,17,2,11,22,33,18,15,129,144,123,116,33,11,2,6,2,7,13,110,18,13,15,11,16,12,6,7,13,14,14,17,1,1,2,2,11,2,2,29,16,16,22,11,6,7,13,11,13,6,13,22,11,22,17,1,21,29,17,6,2,1,13,29,17,33,29,13,13,16,29,30,21,29,16,30,15,29,17,11,17,14,13,14,29,16,21,18,116,114,3,6,138,127,126,110,6,2,5,1,2,2,5,2,2,2,2,6,1,2,2,2,2,2,2,5,10,29,106,114,106,2,21,68,29,50,106,46,133,188,6,7,29,16,117,130,203,203,172,7,30,130,180,199,198,198,179,198,195,179,179,179,179,179,179,179,179,179,171,171,194,171,173,171,194,179,171,171,173,194,194,179,171,169,173,171,168,162,171,162,162,171,162,162,171,162,171,162,171,168,171,173,173,171,173,168,171,173,173,171,173,171,171,171,169,168,168,171,169,168,171,171,177,179,179,194,173,195,179,196,199,199,199,199,199,199,199,199,199,199,199,200,198,200,200,203,198,204,198,196,204,200,204,204,201,200,200,195,199,74,
+2,5,0,2,1,12,106,111,109,29,2,5,2,7,16,11,13,11,13,11,22,33,22,29,13,10,22,46,13,17,36,119,129,149,140,139,138,149,132,149,153,150,147,16,47,133,153,154,152,153,153,153,125,115,122,109,2,6,2,2,11,6,6,6,34,144,128,128,142,138,125,6,13,24,116,120,125,8,22,22,123,125,8,6,2,2,2,13,2,22,29,3,22,16,17,2,6,7,14,29,13,17,6,6,2,2,2,2,6,30,14,17,22,11,7,11,13,13,13,13,13,20,29,32,13,1,13,22,17,17,2,2,21,22,32,30,31,11,13,29,22,16,30,16,16,29,15,17,11,2,21,21,11,13,16,16,16,24,33,125,6,113,145,126,147,119,2,2,2,2,6,2,2,5,2,13,13,2,5,11,2,6,2,2,6,2,12,29,32,122,125,6,16,66,116,141,29,21,106,6,15,43,15,47,47,195,198,202,198,131,47,141,176,198,179,200,202,198,179,198,198,179,202,179,179,179,179,179,171,171,171,171,173,171,171,171,194,171,179,179,179,179,179,173,171,173,162,168,168,162,162,162,162,162,162,162,168,162,168,171,171,194,169,173,194,177,171,177,171,179,177,173,171,173,171,171,171,171,171,179,177,179,194,179,179,179,179,179,173,198,195,195,195,199,195,199,199,198,198,199,196,200,198,204,200,200,200,204,201,200,204,204,204,195,204,204,204,204,196,74,
+2,2,5,1,2,7,34,109,108,108,11,2,2,5,11,1,6,2,7,13,16,37,31,13,12,16,29,13,33,106,141,122,120,149,18,106,119,147,129,152,183,152,144,8,22,183,153,154,153,153,153,150,125,138,111,11,2,2,2,2,7,6,6,11,34,143,128,138,128,126,125,17,22,119,122,138,126,11,6,7,136,111,11,6,2,2,2,13,11,18,18,22,11,15,11,2,7,11,13,13,13,6,7,21,11,2,2,11,7,18,15,24,30,2,13,7,11,13,13,11,13,16,30,37,11,1,2,22,18,15,6,2,16,30,22,32,31,11,7,13,17,29,18,29,16,17,30,22,13,11,21,17,6,21,29,29,29,17,34,111,120,140,127,149,144,144,8,2,6,2,2,6,2,2,2,15,11,2,34,37,36,7,13,11,2,2,11,36,34,120,123,121,170,48,124,141,106,4,15,106,11,17,18,106,200,202,195,179,198,179,8,175,198,199,198,179,200,179,198,198,179,179,198,179,198,179,179,179,179,171,171,173,169,179,173,179,174,179,179,179,169,179,173,171,177,171,171,171,162,168,168,162,166,161,162,162,162,171,160,168,168,171,169,194,169,171,177,169,194,179,179,194,179,169,179,169,171,173,173,168,171,194,179,179,194,179,175,179,194,173,198,199,199,200,199,199,195,200,200,198,200,198,204,200,204,201,200,200,204,201,201,195,204,204,200,201,204,201,204,131,
+2,5,2,1,1,12,32,37,111,109,18,2,6,26,2,5,1,5,13,15,16,31,31,16,12,16,11,23,130,117,150,148,37,30,8,47,141,132,37,123,144,154,153,8,36,150,147,153,154,184,150,147,125,125,8,11,2,6,2,2,6,6,6,6,138,143,125,127,126,114,122,6,36,132,139,122,24,2,11,11,126,19,6,11,6,2,11,16,11,16,24,16,15,11,2,2,21,13,21,16,22,6,17,6,13,2,2,12,16,32,30,46,13,2,12,11,6,11,7,21,22,17,29,33,1,1,1,13,24,2,13,11,13,31,32,34,31,7,13,16,22,30,17,30,15,17,15,31,15,2,14,29,11,16,30,22,22,46,110,18,114,119,140,140,144,151,116,2,2,1,2,2,2,6,2,11,6,29,46,36,32,13,10,21,10,5,13,36,68,108,123,137,19,6,24,109,106,154,110,43,16,45,190,202,198,198,179,199,195,198,203,203,200,179,198,203,203,199,198,179,198,198,179,179,198,179,179,179,171,171,169,179,171,173,179,169,179,171,173,179,171,171,171,194,169,177,171,177,162,169,168,169,169,169,168,169,168,162,168,162,162,168,169,162,194,171,173,171,171,194,179,177,194,177,179,194,169,173,171,177,173,171,179,194,171,171,173,171,177,194,173,199,199,199,199,204,200,200,200,203,200,203,200,198,200,204,204,204,201,204,201,201,204,205,201,205,201,205,204,74,
+2,2,2,1,2,16,30,30,33,37,109,22,0,1,2,2,6,2,2,13,32,2,43,122,16,17,21,22,37,130,137,151,119,123,24,47,149,114,32,133,153,153,152,8,130,147,154,184,153,150,150,143,126,127,8,6,6,2,6,2,11,6,11,14,128,128,128,128,138,114,138,145,109,109,128,136,18,6,6,13,116,11,15,11,2,2,34,15,22,29,22,22,33,18,6,2,17,29,30,33,30,13,36,11,17,2,2,29,16,30,30,32,2,6,2,11,7,7,13,16,29,16,22,29,2,1,2,21,11,17,44,7,10,32,46,24,33,5,10,29,18,33,16,29,16,20,29,111,18,1,13,18,14,30,30,30,22,109,110,109,18,144,132,147,153,150,143,6,2,2,6,2,11,6,6,6,22,23,43,34,34,29,13,1,10,10,13,17,124,142,125,142,140,109,44,30,47,121,165,194,190,200,179,202,198,179,198,179,198,198,179,198,179,198,199,198,198,199,179,203,198,179,198,198,179,179,179,179,179,179,179,179,179,179,179,179,179,179,173,171,179,171,173,173,171,171,171,169,171,168,168,169,171,171,171,162,169,162,162,171,162,168,169,168,168,168,171,171,171,169,179,177,171,194,177,179,194,169,179,179,179,194,179,171,173,173,171,171,171,177,179,194,199,199,200,200,204,204,200,201,200,201,203,200,200,200,204,201,204,201,201,204,201,201,205,201,205,204,201,74,
+2,2,2,9,1,7,32,46,36,34,24,29,2,2,5,2,2,2,11,106,20,21,129,130,14,21,16,22,34,119,181,149,106,22,15,130,120,119,110,183,153,153,150,8,152,152,150,150,153,148,147,139,114,127,8,11,2,2,2,2,6,6,6,33,143,150,138,143,128,47,139,148,112,126,138,140,17,11,6,17,116,6,13,8,2,11,119,6,30,30,16,37,17,46,8,11,11,23,30,10,21,21,13,21,13,2,6,16,21,30,30,13,2,2,7,13,21,14,21,34,30,15,30,18,1,1,2,13,15,29,16,2,21,24,46,33,33,11,7,16,29,14,22,17,29,34,114,109,22,2,21,29,8,18,15,13,29,110,116,132,106,126,139,153,150,147,136,10,6,16,11,8,8,8,13,11,30,49,36,29,36,29,17,21,50,172,15,130,114,116,133,129,70,166,130,33,134,177,194,177,194,173,194,179,202,198,194,198,202,179,203,198,198,195,198,199,198,199,195,200,195,198,198,198,171,198,179,179,179,198,179,202,179,179,173,179,179,179,179,179,173,179,169,179,177,171,177,171,169,169,171,169,194,169,173,179,168,162,162,160,162,168,162,162,168,168,171,162,179,171,194,179,177,179,177,171,173,171,179,179,179,179,173,179,194,169,171,173,194,171,173,179,198,199,199,204,204,201,200,200,204,200,200,204,200,200,204,201,205,204,201,201,205,206,204,201,206,201,201,69,
+9,1,2,2,9,5,30,109,116,120,109,10,2,6,2,2,5,13,45,130,106,13,14,15,11,45,141,34,47,117,132,144,18,119,109,45,32,120,36,133,153,153,147,24,138,138,150,153,148,126,149,122,123,128,3,11,6,6,2,2,11,6,8,132,149,146,144,149,128,116,144,145,138,126,136,151,116,29,36,48,29,6,11,15,17,16,123,6,16,36,30,36,29,29,18,21,14,30,7,7,11,21,6,7,13,13,21,7,7,30,47,6,2,7,13,17,21,7,17,29,29,16,24,17,2,1,1,11,13,16,5,10,29,34,43,33,44,6,15,16,29,29,43,36,22,46,109,32,31,2,7,15,22,29,11,6,16,132,120,116,110,149,153,150,148,144,140,8,21,17,11,17,18,20,17,2,29,21,29,14,33,132,29,30,46,3,13,106,123,46,11,35,163,162,168,169,171,169,171,194,177,198,179,194,202,179,179,198,202,202,198,203,179,200,179,200,199,195,198,196,203,203,198,198,198,198,179,202,198,179,179,198,198,202,198,202,179,179,179,179,179,179,178,169,171,171,171,171,173,171,177,171,179,194,179,177,179,168,162,162,156,162,162,171,162,162,168,162,168,171,169,194,179,194,194,173,194,179,179,179,179,194,179,194,171,171,173,177,194,173,194,198,179,198,200,200,204,204,204,204,201,204,200,204,204,204,201,204,201,201,201,201,205,201,206,205,201,206,205,74,
+2,6,1,2,1,2,29,34,123,111,109,33,116,119,16,6,6,32,130,120,32,21,16,26,2,36,132,132,149,151,140,149,8,126,111,15,106,124,32,117,144,144,106,15,137,144,149,150,144,144,144,111,125,140,17,6,6,2,2,2,11,6,22,133,147,150,145,136,144,140,138,127,126,122,141,141,14,24,19,22,6,6,2,13,13,36,122,1,17,22,30,16,48,31,119,30,30,13,29,16,12,47,2,29,36,29,29,1,30,32,10,2,5,11,13,13,13,14,23,22,16,30,17,24,2,1,2,11,2,16,2,11,22,30,33,32,46,34,31,13,13,21,28,29,22,30,33,33,18,1,12,17,15,7,13,18,33,119,106,116,147,152,150,150,148,140,146,115,109,11,6,6,17,6,2,6,2,13,43,13,30,119,106,106,30,13,32,126,22,159,166,162,162,160,162,162,168,171,171,171,194,169,194,179,202,179,198,179,198,179,200,199,199,195,198,199,199,199,195,196,198,198,200,198,200,203,198,198,179,198,198,179,198,179,179,198,179,202,179,179,179,179,179,179,179,168,173,173,171,171,171,169,194,179,177,179,179,179,168,162,162,162,162,162,162,162,168,168,168,171,171,194,179,179,179,179,173,195,179,179,179,179,173,194,171,194,171,169,179,194,179,179,195,179,200,195,204,200,201,204,200,204,201,201,204,204,201,201,204,201,204,204,201,206,206,201,205,206,201,74,
+2,1,2,2,1,5,30,47,126,122,116,46,149,152,34,43,106,132,119,130,15,14,21,12,6,14,22,152,151,120,133,132,15,116,33,13,24,123,133,133,123,145,109,16,137,138,149,153,153,115,47,106,115,142,15,6,6,11,2,6,6,6,34,144,144,144,136,138,138,123,113,126,47,13,122,110,6,16,33,17,8,2,30,32,129,133,130,6,36,30,36,117,120,6,32,32,43,11,45,21,21,50,14,36,29,21,13,33,47,29,1,2,11,2,13,8,13,29,17,30,29,32,46,20,2,1,2,13,13,13,11,11,29,32,31,120,140,46,17,13,17,15,21,13,15,33,109,32,17,6,2,16,11,11,16,30,46,106,106,140,152,148,153,152,150,136,149,113,20,6,2,11,6,18,8,15,11,10,11,11,36,120,119,147,128,108,109,118,141,161,162,160,162,160,171,169,162,171,171,162,171,171,171,169,194,194,177,179,194,198,198,202,200,199,199,198,199,196,203,198,200,203,203,195,198,203,198,198,198,198,179,198,198,198,203,195,203,195,198,202,202,179,179,179,171,173,171,179,171,173,171,173,171,179,179,198,179,179,179,168,162,162,156,161,156,162,162,168,162,173,171,171,169,194,179,179,194,179,179,198,179,179,179,194,179,171,177,194,173,194,179,198,194,198,199,199,200,201,200,204,204,201,204,201,200,204,201,201,204,201,201,205,201,205,201,206,206,201,206,131,
+2,2,1,1,2,2,16,36,122,126,116,46,122,116,33,36,139,133,70,15,6,7,7,2,13,13,43,153,147,120,120,4,29,126,109,40,133,137,20,22,33,145,105,31,147,136,153,154,145,125,31,31,18,140,8,6,6,2,2,2,7,6,117,138,144,138,128,137,126,114,109,22,6,22,138,15,6,16,24,18,44,34,29,30,120,18,32,2,29,23,30,117,29,13,30,43,29,29,17,22,15,6,21,29,34,6,36,21,17,10,1,2,5,2,11,15,13,22,22,30,29,34,31,24,2,1,2,14,17,1,5,13,45,47,117,129,120,106,34,106,17,21,11,15,37,31,33,33,20,2,2,29,22,16,17,29,106,110,116,124,152,148,146,142,144,139,139,136,15,6,6,6,6,8,17,15,17,6,2,36,16,119,132,142,125,109,116,149,169,162,162,162,168,167,162,167,171,169,171,169,171,162,168,194,168,177,171,173,194,202,179,199,199,199,203,199,199,199,198,203,200,198,196,203,200,195,198,200,203,198,198,203,179,200,198,203,199,203,199,179,198,198,173,179,179,194,179,169,173,171,171,171,179,179,194,179,198,198,179,179,171,168,168,162,168,162,168,168,171,194,171,177,171,171,177,194,179,179,179,179,179,194,194,179,179,179,179,179,179,179,179,179,198,198,179,200,195,195,200,199,204,200,200,204,204,204,201,204,201,201,205,201,205,201,206,206,201,206,205,74,
+82,10,2,2,1,5,16,33,106,126,144,139,136,44,7,132,185,132,46,1,5,1,1,2,16,139,148,153,144,124,17,13,24,153,18,29,34,109,106,24,29,138,114,146,126,147,153,144,150,142,105,15,8,126,4,5,2,2,5,2,11,11,133,149,150,149,126,146,125,126,14,2,6,22,114,5,7,16,13,114,111,115,18,33,29,6,11,2,29,32,17,32,16,33,32,34,47,123,122,31,22,13,13,43,32,2,34,34,29,12,1,2,2,2,13,109,15,31,18,29,17,106,33,17,2,1,2,21,22,6,0,29,45,106,46,109,46,109,34,106,24,5,11,14,24,33,33,29,24,6,6,16,29,16,29,8,47,46,114,142,145,139,150,153,149,147,123,126,2,11,6,6,6,11,18,22,17,13,29,10,29,106,33,140,125,114,131,160,168,168,162,162,162,162,162,162,168,169,171,177,171,169,168,168,171,173,171,169,194,179,179,195,198,198,200,199,196,204,200,200,200,200,200,200,204,203,203,198,196,198,198,199,199,179,195,179,200,179,198,198,179,198,179,179,171,179,179,179,171,194,171,179,173,194,179,198,199,199,179,179,179,179,171,171,168,168,173,171,168,171,171,171,173,194,179,173,179,179,179,194,179,179,179,179,202,179,171,194,179,198,179,198,179,198,179,198,196,199,203,200,200,200,204,201,201,200,204,201,201,205,201,204,201,205,206,201,206,201,201,74,
+95,53,6,0,1,2,29,29,47,133,130,136,126,118,21,149,132,141,13,2,2,1,2,13,22,149,138,146,136,46,11,17,109,143,20,16,46,116,148,24,32,154,127,126,144,146,145,128,144,142,105,8,46,128,6,17,13,2,2,2,11,16,133,141,147,144,150,122,113,111,13,6,6,22,109,2,11,13,18,114,33,111,115,31,8,17,6,6,13,16,22,22,30,106,46,37,119,129,120,47,106,31,2,47,43,14,22,15,17,2,2,5,2,11,11,106,11,20,31,15,15,116,110,15,1,1,2,29,18,2,2,21,30,22,17,43,34,111,37,110,30,9,2,34,31,31,24,24,15,1,11,33,30,22,36,29,110,106,127,138,146,145,153,154,147,145,124,144,6,2,2,6,6,13,20,17,17,8,49,39,129,106,106,111,115,164,162,169,168,162,171,169,169,162,168,168,168,171,171,169,168,168,168,168,171,194,171,173,171,177,194,202,203,195,198,204,199,200,200,198,204,204,200,200,204,200,200,203,198,203,198,198,202,199,203,199,203,195,179,198,198,179,198,202,179,179,179,179,194,169,173,179,168,179,179,198,199,199,196,203,198,195,179,179,179,179,168,171,174,173,171,171,171,169,173,194,173,194,179,194,179,179,195,179,194,198,202,179,179,198,179,198,198,198,198,179,198,198,179,200,195,200,204,204,204,201,201,200,201,201,205,201,205,201,206,201,206,206,206,131,
+89,84,38,5,2,2,13,21,32,34,139,147,149,130,117,133,149,136,6,2,2,6,2,7,29,110,153,150,111,6,8,114,144,152,4,14,46,24,24,13,16,137,128,3,114,142,150,150,115,142,114,11,109,115,31,110,7,6,2,2,11,16,110,122,145,140,115,137,154,123,6,6,2,47,20,2,6,7,16,109,119,108,126,8,15,17,17,2,21,31,30,16,30,47,34,68,110,48,132,31,46,24,15,34,24,13,16,30,13,2,2,7,2,7,13,18,21,24,31,15,43,20,109,8,2,1,5,11,22,6,2,13,30,32,30,24,106,46,47,32,33,6,2,18,30,36,16,117,6,2,30,37,43,22,30,45,106,132,125,144,153,153,153,153,151,151,149,126,11,2,2,6,6,6,18,31,33,14,13,8,49,47,8,111,164,169,169,169,162,168,162,168,168,169,171,168,171,169,171,168,168,169,168,162,194,169,179,171,171,194,179,179,196,199,200,203,204,199,198,200,200,198,204,198,201,200,199,199,199,199,198,198,179,202,195,203,196,179,198,198,179,202,179,198,179,179,179,179,171,179,171,177,179,179,194,179,199,199,199,199,196,203,195,198,198,179,179,179,179,169,173,174,194,171,179,179,194,169,179,179,179,179,179,198,179,198,194,179,179,198,198,179,198,199,179,198,203,198,198,198,195,203,198,204,201,200,204,201,204,201,205,205,201,201,205,206,201,206,201,74,
+89,90,91,90,71,2,7,22,47,119,139,182,149,140,106,132,150,132,11,2,2,2,6,7,16,119,154,151,17,13,29,152,150,140,2,14,119,110,29,1,7,117,33,126,147,128,150,150,105,138,127,6,109,109,128,37,7,2,2,5,6,14,123,144,126,127,128,153,152,125,8,6,6,119,19,5,6,14,34,122,109,111,47,19,13,13,11,6,16,13,13,22,34,106,32,36,106,33,34,18,33,18,31,29,18,13,29,11,2,2,6,2,2,2,12,11,17,108,33,24,109,31,122,6,2,1,2,13,22,8,6,16,34,33,16,46,106,120,116,132,144,109,5,121,16,22,129,122,2,5,36,30,29,29,22,47,36,132,127,139,151,153,153,148,151,137,149,34,2,6,2,11,17,22,21,17,22,109,157,166,171,78,157,166,169,169,169,171,168,168,169,169,169,162,168,168,168,168,168,169,162,168,169,171,171,173,173,171,171,179,202,179,203,200,198,203,200,199,200,198,204,196,204,196,198,196,199,203,199,198,198,203,179,198,179,198,198,203,195,179,198,198,198,179,179,198,173,179,179,194,194,177,179,179,179,198,179,198,199,200,196,203,199,199,198,198,198,202,179,179,198,194,202,179,179,179,179,179,179,173,179,179,198,179,198,179,198,179,198,179,179,198,199,198,198,198,195,198,198,203,195,200,200,203,200,204,201,200,201,205,201,201,205,205,201,201,205,201,206,74,
+90,90,91,90,90,38,11,129,130,47,120,133,133,123,29,149,147,125,16,7,11,6,2,11,22,130,146,136,11,6,33,150,137,144,111,24,33,43,114,22,132,119,109,106,8,8,138,148,8,146,125,11,114,18,46,18,2,2,2,2,2,29,116,114,126,145,153,152,144,128,16,6,6,137,20,6,6,6,11,20,109,18,114,22,6,13,11,11,6,6,30,30,29,106,30,30,46,17,36,17,30,24,15,30,15,4,7,6,2,2,2,6,6,2,6,13,1,16,11,8,33,32,136,2,1,2,6,12,17,11,6,30,34,34,46,109,116,124,141,140,141,136,126,8,32,134,149,17,1,2,43,30,16,21,36,133,43,120,125,144,150,183,150,149,146,147,129,6,6,11,8,17,34,17,31,21,24,78,168,162,160,168,162,162,167,171,171,169,168,168,168,168,169,169,168,169,162,169,171,168,168,168,171,171,177,179,179,179,194,179,198,202,199,199,203,198,198,203,199,196,196,199,203,199,199,203,195,199,198,179,198,198,198,198,198,203,179,198,203,195,203,198,196,198,179,179,194,179,179,179,194,179,194,179,179,198,198,198,199,199,199,203,198,198,179,198,179,199,203,196,196,199,179,198,179,179,198,178,173,198,195,198,198,198,198,195,199,198,198,195,179,198,198,198,198,200,203,199,196,198,199,199,196,198,199,203,200,201,204,201,201,205,206,201,205,206,201,206,205,131,
+82,90,89,90,91,82,38,30,32,34,132,139,138,133,119,147,137,140,11,13,11,11,13,13,32,124,153,19,11,30,132,126,144,145,115,119,122,21,22,22,17,29,8,6,17,106,143,105,114,150,111,6,33,114,17,34,2,6,2,2,11,16,123,138,126,153,143,143,115,140,8,6,6,135,111,6,6,7,7,24,24,24,114,19,11,13,13,22,2,11,4,16,30,46,17,30,116,22,14,17,16,30,16,45,32,164,2,7,6,7,2,10,9,11,7,14,6,13,24,119,15,34,132,1,1,2,2,11,30,11,7,29,37,24,119,149,149,141,139,144,139,133,136,109,47,130,136,109,5,2,36,30,29,43,120,130,106,120,139,147,148,145,147,141,140,33,6,10,13,16,36,16,21,29,16,68,169,162,156,156,160,162,162,162,168,168,194,162,194,162,168,160,162,168,168,168,169,169,162,168,169,171,173,171,179,179,198,179,179,202,199,179,200,195,196,198,203,200,200,199,198,198,199,198,195,199,203,179,198,179,202,179,194,198,179,179,202,198,179,196,199,199,203,195,198,202,179,179,179,179,198,179,179,202,179,179,198,179,198,199,203,199,198,179,198,203,196,200,199,199,203,196,199,203,198,195,179,198,198,198,179,196,203,198,199,199,199,195,199,198,198,198,199,203,200,195,198,204,198,198,195,200,195,198,199,196,203,198,204,204,201,201,205,205,205,201,205,201,205,74,
+89,86,89,89,89,90,86,7,21,116,140,144,139,147,120,144,151,108,13,11,13,13,13,18,43,119,141,11,17,144,138,133,144,128,24,137,125,116,31,13,16,33,17,15,24,24,31,20,142,150,18,29,123,146,144,31,6,11,2,2,7,7,106,137,136,148,138,146,108,136,6,6,13,147,122,6,13,1,7,22,34,17,109,111,13,15,15,18,15,33,44,23,22,33,13,34,47,106,43,22,47,31,35,29,46,40,2,29,13,13,2,1,5,21,13,11,2,119,133,116,15,130,22,2,1,2,2,35,28,2,13,30,119,132,149,183,133,141,133,133,141,132,130,33,132,130,117,43,2,7,21,36,37,47,47,47,120,118,120,138,147,148,146,142,116,13,13,15,30,11,21,28,66,165,29,159,162,162,162,160,162,162,160,169,162,168,162,168,162,162,162,162,160,162,168,162,162,169,169,168,168,169,194,173,194,173,179,202,198,196,179,200,202,199,199,200,198,204,198,204,199,199,199,195,203,195,179,198,198,202,179,198,179,179,179,198,179,198,199,203,199,199,199,203,198,202,198,179,198,198,203,198,179,198,198,198,198,198,179,199,198,203,198,199,195,179,196,198,179,198,198,198,179,199,195,202,203,199,199,199,195,179,199,199,199,203,198,200,200,196,199,200,195,200,203,200,200,198,200,203,199,199,199,195,199,199,199,199,198,201,204,204,201,206,201,205,201,205,200,74,
+84,85,85,86,85,89,89,7,32,36,132,130,144,132,139,144,140,19,17,13,13,13,34,111,22,34,142,11,114,144,147,149,144,125,125,140,32,32,31,44,119,114,21,34,109,114,151,18,150,140,6,135,152,144,122,17,30,34,11,2,5,11,133,135,32,138,146,151,108,125,6,6,24,139,109,2,6,13,13,32,34,34,136,31,8,17,17,18,33,46,22,29,34,22,11,106,132,34,118,119,18,120,14,48,46,2,5,5,1,5,2,5,1,2,5,1,11,117,110,33,18,132,11,2,1,2,5,29,13,2,21,130,134,130,141,149,149,133,133,139,133,119,117,46,141,110,47,1,5,5,28,30,110,31,117,106,116,106,109,116,142,142,20,140,32,16,36,15,120,164,162,173,169,171,166,171,194,162,169,168,168,162,171,160,168,162,162,162,160,161,162,169,160,160,98,160,160,160,162,162,168,171,169,171,179,179,198,177,198,203,195,198,199,204,198,200,200,198,200,200,200,199,198,199,203,199,195,179,198,198,179,179,179,179,179,179,179,179,198,195,199,199,198,199,198,179,195,198,198,179,198,199,195,198,179,199,179,198,202,198,179,196,200,203,203,199,178,203,198,195,198,198,203,198,203,198,200,198,200,195,200,195,198,198,198,196,203,203,198,204,200,203,200,204,198,204,200,200,200,200,195,203,200,198,199,199,198,199,199,198,204,201,204,201,201,201,205,201,201,131,
+89,89,89,89,90,90,95,26,13,32,132,139,182,138,140,128,125,125,20,11,11,13,17,116,33,130,144,11,116,122,111,109,115,114,111,110,16,29,16,130,109,44,13,34,106,119,126,126,144,132,133,144,144,122,139,109,29,106,13,2,31,21,48,47,16,126,149,146,138,133,16,13,119,116,17,6,6,11,13,22,24,116,120,11,17,46,17,17,24,15,17,36,119,130,6,106,119,132,149,122,130,24,11,37,20,1,2,5,7,2,2,2,5,2,2,6,21,34,34,120,116,15,6,1,2,2,2,30,3,6,30,33,132,46,129,180,133,133,141,132,119,129,120,141,139,149,31,1,2,11,29,22,33,116,119,116,116,129,132,122,145,125,110,18,16,22,16,74,179,169,169,162,171,169,194,169,171,169,175,169,171,169,168,162,160,162,156,159,160,160,169,159,160,160,156,159,160,160,168,162,162,168,173,194,177,179,179,198,179,200,195,179,196,200,204,200,204,204,199,204,199,196,199,198,199,195,203,198,179,202,198,179,179,179,179,202,198,198,179,200,203,179,200,198,198,198,202,179,196,203,196,203,199,195,199,199,195,179,179,198,202,179,199,196,203,195,199,195,203,199,196,198,198,203,200,198,200,200,195,203,203,195,200,199,199,196,198,200,200,204,198,201,201,200,203,198,201,200,204,198,201,199,199,203,199,198,199,199,198,195,200,200,200,204,204,205,201,204,201,74,
+89,90,89,90,85,91,90,27,32,119,139,136,137,136,126,127,143,145,109,11,11,14,16,106,126,132,106,17,119,140,18,108,125,114,114,106,24,16,22,119,16,110,21,46,43,110,151,145,33,116,149,126,150,126,138,20,13,13,2,2,5,33,11,6,7,140,151,127,126,34,109,70,34,11,6,6,6,7,14,34,109,119,24,2,44,106,126,43,33,30,30,47,123,11,29,106,147,137,149,136,124,132,11,132,24,1,2,2,5,13,1,2,2,5,2,2,23,46,32,132,132,21,2,5,2,2,2,70,68,16,21,130,133,120,133,117,182,133,133,119,130,120,120,149,133,141,24,1,2,13,21,43,125,118,109,116,132,119,114,124,144,140,36,17,66,168,167,168,168,168,194,171,173,171,171,173,171,171,173,162,194,160,168,160,162,160,160,162,162,162,156,159,160,160,97,156,160,160,162,167,169,171,171,179,177,179,199,179,199,203,199,199,203,195,198,204,200,199,204,199,200,203,203,195,203,179,179,198,202,198,179,179,179,202,179,179,198,179,198,198,199,202,198,198,179,198,198,202,198,203,198,204,199,195,199,195,199,199,195,179,198,202,198,198,199,203,199,199,198,200,199,198,200,198,200,200,200,198,200,198,198,200,198,198,198,203,198,196,198,204,200,200,198,204,200,204,200,204,198,204,198,204,200,198,195,198,200,199,199,199,199,198,200,200,204,200,204,204,200,74,
+89,90,91,90,91,90,91,71,133,120,130,114,109,114,119,128,150,146,33,11,13,21,22,46,110,37,24,46,138,126,8,46,144,149,126,34,17,22,30,22,34,22,16,31,34,123,149,126,18,148,108,138,138,126,139,116,2,2,11,6,11,14,2,11,11,123,130,19,148,125,115,15,11,7,7,2,6,7,29,132,133,106,123,6,36,106,120,34,33,15,46,126,116,11,34,183,149,151,139,132,129,124,11,37,13,2,6,10,5,2,2,2,5,2,2,7,43,110,110,133,130,2,2,2,2,9,13,13,2,6,21,130,144,149,145,133,47,139,147,125,132,132,129,141,133,132,33,1,2,35,11,117,120,109,44,114,120,124,118,106,149,31,69,14,78,168,168,168,171,169,171,169,177,194,169,173,171,177,173,173,171,169,162,160,160,159,160,162,160,160,160,159,159,160,156,160,162,160,162,168,168,171,173,194,179,198,179,202,199,196,195,179,196,203,203,204,199,196,203,204,196,199,196,200,203,195,202,198,179,194,179,179,179,177,179,198,198,202,198,179,195,198,198,179,198,198,177,198,199,198,203,198,200,199,203,196,203,203,203,195,179,198,179,198,199,196,203,199,198,196,198,200,200,195,200,195,200,198,204,195,200,195,198,198,200,198,195,198,203,200,204,204,200,201,200,204,201,200,200,203,200,198,204,198,196,196,198,198,200,203,199,198,199,204,200,196,200,200,204,131,
+89,89,89,89,89,90,85,71,6,17,125,138,139,137,136,147,150,139,86,60,29,16,22,67,101,92,96,46,126,114,15,116,126,144,132,34,22,120,22,30,47,13,16,129,106,132,144,115,32,150,136,123,144,126,144,18,11,22,123,13,47,13,2,11,24,122,18,139,138,126,143,19,6,6,6,6,2,13,8,116,18,36,110,16,16,106,132,123,33,36,136,181,109,37,120,181,136,141,138,120,33,22,10,30,2,2,2,5,2,11,2,1,2,2,6,5,45,33,120,119,33,1,2,2,2,1,11,21,6,2,30,133,124,47,151,147,31,132,144,149,126,119,132,144,126,144,34,1,11,21,29,117,120,109,109,118,116,124,128,43,45,163,162,98,173,162,168,171,169,169,175,171,169,173,173,169,177,171,177,171,168,162,162,162,162,160,160,162,169,167,169,160,162,159,160,156,169,162,162,168,171,173,194,202,198,198,203,198,199,203,203,195,198,200,200,195,203,198,199,198,204,203,203,198,179,198,179,179,198,179,179,198,198,198,202,179,198,179,198,198,179,198,179,198,177,198,198,179,203,199,199,203,198,199,199,198,200,198,195,203,195,179,198,198,203,196,200,198,204,200,200,198,196,204,195,204,200,204,198,204,204,198,200,204,195,204,204,200,204,198,195,204,201,204,201,201,203,201,203,200,200,204,200,200,203,199,199,203,199,198,200,198,198,200,199,204,198,201,200,74,
+89,89,89,85,90,91,89,90,6,13,123,144,140,136,119,140,148,79,89,90,79,75,75,90,92,91,96,59,13,33,138,144,149,182,96,53,22,32,30,34,20,31,26,23,132,144,149,114,22,150,136,122,136,133,150,8,29,114,126,8,119,13,7,2,132,105,119,144,34,16,150,20,11,6,6,2,2,6,29,115,32,114,136,8,22,132,130,133,132,130,141,126,33,130,119,151,110,130,133,138,109,16,14,6,2,5,6,2,10,2,6,1,1,2,7,6,30,123,109,109,15,6,1,2,5,2,2,2,11,1,36,151,123,34,149,144,106,133,141,133,132,116,144,144,145,147,17,2,2,22,31,36,36,116,109,116,122,113,148,169,162,171,169,171,162,171,171,169,171,177,177,168,177,175,171,171,168,169,194,171,169,162,160,162,162,159,169,162,162,162,162,160,162,160,162,160,167,162,162,168,171,202,194,202,179,198,179,196,196,200,199,203,198,200,198,199,198,200,200,203,198,200,198,179,198,198,198,179,179,179,179,179,202,179,198,198,179,198,179,198,199,198,198,198,179,179,198,199,196,198,199,199,199,204,200,198,200,198,200,198,199,198,198,179,198,199,198,205,203,198,200,200,204,198,204,204,204,195,201,204,195,201,195,204,195,204,195,204,195,200,200,198,204,204,201,200,201,200,201,200,203,200,200,204,200,200,198,200,199,196,199,199,196,198,199,203,199,198,200,131,
+89,86,89,90,86,88,91,100,6,6,33,126,142,138,122,106,48,90,89,90,86,90,90,91,91,90,92,59,106,116,119,117,48,87,96,96,49,11,32,29,7,33,33,21,47,36,29,11,114,150,144,123,106,138,151,105,34,114,120,29,129,119,123,104,114,18,137,132,11,24,153,19,2,11,6,6,2,7,17,123,106,106,135,20,36,130,110,132,132,120,130,24,24,139,133,130,120,106,136,123,130,116,2,2,2,2,2,11,2,2,2,2,1,2,2,2,34,109,111,33,2,2,6,2,2,5,2,5,7,11,29,136,122,36,133,149,24,141,145,136,136,133,140,141,133,126,8,2,21,36,13,46,109,109,118,118,125,127,140,194,160,171,168,168,168,168,167,168,169,171,171,177,171,171,177,175,173,171,162,168,162,162,162,161,162,169,162,162,168,162,162,162,162,168,162,162,168,162,171,171,194,173,179,198,179,198,203,199,199,196,198,200,196,198,200,203,199,199,198,196,198,203,198,199,195,179,179,179,194,198,179,198,202,179,179,179,202,179,202,179,198,179,198,179,198,179,198,179,199,200,200,203,198,200,198,204,198,200,200,203,203,195,179,198,199,199,200,198,201,203,200,204,195,201,201,204,201,204,200,204,201,204,201,201,201,204,201,201,204,195,204,201,204,204,204,204,204,201,200,200,204,201,203,198,200,200,198,204,199,198,200,199,199,199,195,196,199,203,195,74,
+85,85,85,85,89,89,86,90,58,11,126,128,128,132,134,77,95,89,91,90,90,91,86,90,86,91,92,71,66,68,77,100,91,92,91,96,96,62,34,16,30,123,18,13,32,8,11,16,149,150,147,33,106,128,146,144,120,133,31,34,110,133,149,154,148,22,122,105,11,24,145,8,11,7,2,2,7,6,37,125,45,47,106,106,30,117,106,129,136,46,29,24,110,144,109,34,136,120,137,124,126,116,0,6,1,11,2,2,6,6,2,6,1,1,6,2,46,138,125,15,6,2,2,2,6,1,2,2,31,31,30,144,137,117,37,133,30,153,149,145,133,119,138,122,119,124,11,2,2,8,43,111,126,33,33,111,125,115,145,198,168,162,169,168,168,162,168,162,168,168,162,171,169,162,171,171,171,171,168,168,162,168,162,160,168,168,162,168,168,169,162,162,171,162,168,168,162,168,171,173,179,198,198,202,194,198,195,203,199,203,195,198,204,203,196,203,200,199,200,199,198,179,199,198,203,179,198,179,179,179,202,179,179,179,198,179,198,198,198,198,202,179,198,198,202,173,195,199,198,195,198,201,200,198,204,200,200,203,198,200,200,200,203,196,198,199,200,204,204,201,205,201,204,201,204,201,204,201,204,201,204,204,204,201,204,201,201,200,204,201,195,204,204,200,201,204,200,204,204,204,199,200,200,195,200,200,200,198,204,200,203,198,199,203,203,199,198,199,195,74,
+89,89,89,85,85,89,89,85,90,61,36,123,121,78,84,89,82,85,85,90,76,90,91,89,91,90,86,90,91,85,91,90,91,91,91,91,92,102,39,11,17,138,17,13,30,7,2,29,123,149,126,20,139,152,151,138,136,125,10,130,147,153,153,144,147,126,144,114,17,106,145,11,7,7,6,2,6,6,119,116,34,106,47,106,33,47,34,47,126,11,8,109,141,143,29,132,116,119,141,144,151,24,2,1,2,11,2,6,2,7,13,2,2,6,1,2,129,122,132,22,2,2,2,5,1,5,2,6,36,129,116,129,141,122,120,132,30,126,133,133,136,140,132,132,110,125,11,2,13,46,110,126,146,127,29,24,150,128,147,169,169,169,168,162,162,162,168,162,168,162,169,169,162,168,171,173,171,169,168,168,168,169,162,162,162,162,162,168,169,162,171,169,162,162,160,162,171,171,171,194,179,202,179,198,198,203,199,198,204,200,200,200,203,198,200,195,198,204,198,196,200,198,203,195,196,198,202,179,179,179,194,202,179,179,202,179,195,179,198,179,198,179,198,179,198,198,179,203,199,203,200,195,204,204,200,198,200,200,204,199,198,196,198,199,204,200,201,201,204,201,201,204,205,201,201,204,201,201,204,201,204,201,201,204,201,204,201,204,204,204,201,200,201,204,204,201,204,204,204,200,199,200,200,200,198,199,202,200,198,200,199,199,200,200,195,200,200,198,200,131,
+85,85,86,88,85,89,84,84,89,89,89,82,84,84,82,84,89,85,90,91,90,90,85,89,91,85,90,90,89,90,89,91,89,86,91,91,92,96,62,30,46,122,16,32,30,13,2,24,144,152,148,20,149,144,142,124,106,110,15,120,153,151,144,111,149,139,128,127,8,138,144,6,7,6,2,2,13,7,132,33,106,128,127,108,29,22,116,44,123,8,11,116,136,136,16,124,132,114,153,141,68,11,2,2,5,1,11,2,11,13,21,6,2,2,2,6,117,149,132,13,2,2,5,25,1,2,6,7,47,120,120,120,124,151,105,31,18,132,120,132,133,124,123,110,47,117,6,2,11,33,116,136,140,138,104,113,141,126,130,169,169,168,162,171,169,160,168,168,171,171,171,177,168,171,194,169,177,171,169,162,171,168,169,169,169,169,162,162,169,169,162,168,160,160,159,160,162,171,171,194,173,198,179,202,179,200,198,200,203,199,200,199,200,200,200,200,203,198,200,179,196,199,196,203,179,179,179,179,202,179,198,179,198,198,179,195,179,203,178,202,195,179,196,199,198,179,200,198,198,198,200,200,203,200,198,200,200,204,196,200,204,200,200,200,195,204,201,201,201,206,201,205,201,205,206,201,204,201,204,201,201,201,204,201,201,205,201,204,201,201,204,201,200,200,201,200,201,203,200,204,199,199,202,199,199,199,198,199,203,198,200,202,199,198,198,199,199,202,179,74,
+89,89,85,89,82,84,84,82,84,82,84,84,84,84,89,85,86,89,85,85,91,89,90,91,82,91,85,91,88,91,90,90,89,91,90,86,90,86,92,75,130,43,30,29,11,11,7,141,152,151,144,151,138,143,150,128,119,8,43,110,148,147,143,145,115,109,132,126,15,153,128,6,7,14,29,16,11,13,136,15,30,138,143,20,11,34,124,24,132,31,36,133,124,132,34,119,149,119,144,124,6,2,5,2,2,6,6,2,14,47,22,21,13,6,2,2,68,125,33,2,6,10,2,1,2,5,1,13,119,119,15,32,133,116,130,133,33,106,120,110,130,132,139,120,110,6,2,6,13,106,132,119,132,127,140,126,18,69,156,162,162,168,169,169,162,171,169,171,169,171,171,162,194,162,171,171,162,194,168,194,162,171,171,162,171,169,162,169,162,160,162,156,156,156,156,156,160,169,168,171,194,179,179,179,198,198,202,179,200,202,199,199,199,200,200,200,199,200,199,198,199,203,199,200,198,198,179,173,198,198,179,202,179,198,198,203,195,179,202,194,198,203,199,203,199,198,198,199,203,200,200,203,198,198,204,198,200,195,204,204,198,200,204,204,200,201,204,205,205,206,206,201,206,201,206,205,201,201,205,201,204,201,201,201,204,201,201,204,201,200,204,201,204,204,204,204,200,204,204,195,202,194,198,199,198,177,198,179,198,179,179,198,198,179,198,179,198,177,179,74,
+89,84,84,85,84,84,84,84,82,84,84,84,84,82,84,84,84,85,89,85,85,90,89,85,91,90,91,89,89,89,89,90,91,90,85,91,90,90,91,91,95,13,13,2,16,17,6,120,151,137,141,144,150,142,142,138,17,13,33,37,153,152,146,145,142,115,110,111,122,124,13,6,7,36,110,114,109,22,47,2,29,129,150,20,23,34,116,47,123,116,117,133,149,126,68,133,141,130,149,125,2,2,2,1,2,2,2,11,106,36,47,22,46,29,31,18,117,139,136,2,2,2,6,2,2,5,2,13,116,29,18,17,36,109,43,116,29,29,119,106,130,123,106,106,132,24,2,2,11,119,110,120,132,144,140,45,159,161,156,162,161,168,162,169,169,162,171,171,171,173,171,171,171,162,169,169,169,171,171,169,171,168,168,171,162,169,162,160,160,156,98,103,98,103,103,156,156,160,162,168,171,171,171,177,179,177,198,177,194,202,179,198,196,199,204,204,204,199,195,198,198,202,198,179,200,179,198,198,179,179,198,198,202,179,195,179,198,198,198,179,199,179,198,203,200,203,199,200,200,200,198,200,200,203,200,195,200,204,200,204,200,204,201,200,203,204,201,204,201,205,201,205,206,206,201,205,205,204,201,205,201,204,201,204,201,201,204,201,204,204,204,201,204,201,200,200,200,198,199,199,198,198,198,179,198,177,194,179,202,179,194,173,179,199,194,173,194,171,171,74,
+84,84,84,84,84,84,84,84,82,84,82,84,84,84,84,88,85,85,89,89,89,91,85,90,85,85,85,89,89,89,89,91,90,89,91,90,90,89,90,90,95,12,11,6,22,24,7,130,149,148,145,138,150,143,150,106,15,24,13,47,147,149,127,143,115,17,18,17,132,29,2,11,7,24,109,125,149,106,30,6,16,34,132,15,16,34,138,117,133,140,139,182,186,22,120,149,136,151,37,132,3,5,2,2,2,6,5,6,106,114,48,16,15,22,136,119,181,24,130,6,2,5,2,2,2,2,2,21,116,124,29,34,120,33,110,46,18,29,30,119,120,130,119,47,47,32,6,2,13,43,119,132,133,124,17,87,160,160,156,156,160,162,162,169,162,169,168,168,168,168,168,169,162,160,159,160,162,162,168,168,162,162,162,162,161,160,160,156,103,98,98,98,98,98,98,98,98,98,160,161,168,169,168,171,171,171,171,177,179,179,194,179,179,199,203,199,199,198,198,203,199,179,198,203,198,198,202,179,198,198,198,179,200,199,203,199,179,198,179,198,179,198,198,199,199,200,200,203,196,200,203,200,200,200,200,200,200,200,198,204,200,201,200,204,201,204,200,201,201,204,201,201,206,201,206,201,205,201,201,201,204,201,201,201,204,201,204,201,205,204,201,203,200,198,204,200,203,199,198,194,177,179,179,177,194,194,179,177,194,173,173,194,194,177,179,173,169,160,162,69,
+82,84,82,82,84,82,82,82,82,84,82,84,84,84,84,88,89,85,86,89,89,89,86,88,90,85,86,82,85,89,89,85,85,89,89,89,89,89,89,89,95,61,14,129,129,29,34,116,141,149,144,138,145,150,115,4,22,122,15,117,140,127,149,143,150,111,18,192,18,7,2,6,13,13,24,128,126,110,15,2,21,110,126,6,22,130,141,45,133,153,151,144,116,6,181,132,47,120,34,106,20,2,5,11,6,2,6,7,123,122,109,11,22,17,110,123,141,14,20,2,11,6,2,12,2,5,2,13,106,120,30,32,46,106,46,36,106,43,47,120,132,120,120,45,106,24,15,11,29,31,47,149,120,97,87,98,103,159,160,161,156,160,169,162,160,169,156,160,162,168,162,161,160,156,160,156,156,162,168,169,168,162,156,160,156,160,103,98,98,96,102,92,92,92,98,98,98,103,93,159,161,162,162,156,168,162,169,160,173,171,171,173,194,202,194,203,203,200,195,199,199,203,199,179,200,198,198,198,179,198,200,199,202,196,198,200,203,198,199,203,198,179,198,179,196,204,200,204,200,200,200,200,198,200,199,199,199,199,203,200,200,204,200,200,204,204,204,201,200,201,205,204,201,201,205,205,201,206,205,204,201,201,201,205,201,201,201,204,204,200,200,198,199,200,179,198,179,177,179,179,169,194,162,168,177,177,169,194,169,162,171,177,171,173,171,194,162,171,169,74,
+84,84,82,82,82,82,84,84,84,82,84,82,82,82,84,85,89,85,85,85,85,85,88,85,85,85,85,88,84,84,84,88,89,84,89,85,86,89,89,89,90,61,14,23,29,29,22,119,106,122,47,34,149,146,146,114,18,46,17,139,150,145,153,152,125,153,114,27,2,11,2,7,7,13,34,146,149,124,6,2,47,153,153,8,45,141,110,106,47,150,148,138,6,120,119,132,22,119,45,47,111,2,31,125,33,13,11,11,117,24,109,15,13,13,106,147,125,36,126,2,21,16,2,1,1,2,11,13,116,47,17,36,43,43,31,43,116,43,43,46,46,47,119,46,133,106,24,34,33,116,132,164,92,97,103,98,98,103,160,160,160,161,160,156,162,160,160,162,168,162,160,156,159,160,156,160,156,162,162,160,161,160,160,161,156,160,98,92,92,92,96,92,96,101,92,92,98,98,98,98,98,103,98,160,156,160,159,160,169,167,169,171,171,171,173,194,179,198,179,199,195,198,202,199,199,198,179,179,198,198,179,200,198,199,200,200,200,195,199,198,179,200,198,203,195,200,200,198,204,204,204,199,203,200,198,199,179,200,179,200,199,199,199,199,204,204,201,204,200,204,204,201,205,205,205,201,205,204,197,205,201,204,204,204,205,201,204,205,200,200,199,179,202,179,199,194,173,194,177,171,169,169,169,169,171,171,177,169,162,168,171,171,168,168,162,168,162,169,162,69,
+84,82,81,82,84,81,88,84,82,82,82,84,82,84,84,84,84,84,82,85,89,84,85,84,88,84,84,82,84,82,84,85,85,85,90,85,90,85,89,95,91,82,0,2,11,106,11,106,36,46,22,22,153,145,148,127,17,29,8,149,149,142,153,154,144,153,20,5,2,11,7,6,7,13,34,126,138,32,16,5,36,147,149,8,129,136,31,16,132,146,140,11,33,123,147,141,15,47,29,43,114,4,123,105,182,185,3,13,30,110,33,24,20,126,147,124,136,129,147,2,7,13,2,5,2,2,11,47,130,29,29,47,116,116,124,114,33,31,138,116,136,132,138,114,186,144,120,46,23,35,71,96,96,93,98,98,98,98,160,159,160,156,160,156,160,156,160,156,162,156,160,156,103,156,160,156,162,169,160,160,162,160,160,160,161,98,96,102,92,92,92,92,91,92,92,92,92,96,101,98,98,98,98,98,98,98,103,159,160,160,160,162,162,168,169,168,173,194,179,179,198,179,179,179,179,198,179,194,179,179,198,203,198,198,198,199,204,204,202,196,199,199,179,199,203,195,203,200,200,203,198,203,198,179,179,179,179,198,179,198,179,202,179,198,179,199,199,199,200,200,204,201,204,201,201,205,206,201,204,201,200,201,204,200,201,204,200,200,203,199,198,198,202,194,169,177,171,171,177,168,162,162,162,169,169,169,171,168,168,169,169,169,168,160,162,162,160,162,160,73,
+82,82,84,82,84,84,81,82,82,82,81,85,81,84,82,82,84,82,84,84,82,90,89,88,84,84,88,84,84,84,84,85,88,85,88,89,85,90,90,88,89,95,40,2,14,133,2,45,30,47,11,29,150,146,142,142,33,11,43,144,152,151,126,140,123,152,109,2,5,6,6,7,6,11,13,110,109,17,30,2,21,144,133,11,20,114,109,36,133,149,128,22,138,141,144,122,30,33,33,23,116,144,128,130,136,136,6,11,33,106,120,123,109,141,146,123,129,119,116,0,5,72,64,2,2,6,7,37,22,7,117,120,130,120,129,120,120,43,119,130,132,130,31,138,154,149,111,120,77,95,95,91,97,102,98,98,98,98,103,160,159,103,97,160,156,160,156,161,160,160,156,160,160,156,160,160,162,162,156,169,169,160,156,160,156,98,98,96,92,91,91,91,91,91,91,91,92,92,91,92,92,92,98,92,98,98,98,98,156,156,156,160,156,160,160,162,162,169,171,168,168,168,169,168,173,179,179,179,179,171,179,199,198,179,198,198,198,179,200,202,203,198,203,200,203,203,200,199,204,202,200,199,198,179,169,171,173,173,171,177,179,194,177,194,173,198,198,198,198,199,200,204,200,201,201,204,201,205,201,201,204,201,201,201,204,203,199,198,179,198,177,177,179,177,162,162,168,168,168,162,168,162,167,168,162,162,160,169,162,171,162,162,162,162,160,160,160,159,159,73,
+84,84,82,84,82,82,84,84,84,81,85,83,85,81,82,84,82,84,82,84,88,85,85,82,84,84,84,84,84,84,84,88,84,89,88,88,89,88,85,90,90,88,54,7,43,33,6,5,33,20,13,16,148,150,143,148,122,16,47,144,120,122,15,106,46,138,33,2,2,11,6,6,6,7,13,31,33,14,30,5,7,119,124,11,37,106,120,36,151,153,127,111,124,138,132,33,30,30,22,43,114,186,140,147,132,17,6,21,118,30,116,137,132,136,130,110,36,139,120,2,5,6,2,38,2,11,11,43,2,11,119,37,120,36,120,47,124,110,47,47,132,31,46,144,154,119,46,85,89,89,90,85,92,87,98,98,98,103,98,156,103,159,103,156,160,156,156,160,162,160,156,160,156,160,160,160,162,161,156,160,156,160,160,98,103,98,96,92,92,91,101,91,90,91,91,91,92,91,92,92,92,101,92,93,98,98,103,98,103,98,98,98,98,103,156,160,103,156,156,160,156,98,103,159,156,169,171,173,179,179,179,194,179,179,179,194,179,198,198,179,198,179,179,198,179,199,200,200,199,203,199,199,198,179,168,168,162,162,169,168,162,169,169,171,168,171,177,198,179,202,200,204,201,203,201,205,204,201,201,204,201,201,203,204,200,202,179,198,177,194,173,171,169,171,162,162,168,162,162,162,162,162,162,162,160,168,162,162,162,160,162,160,162,160,156,160,156,156,156,71,
+81,84,81,84,81,81,84,82,81,81,85,81,81,82,81,84,81,88,84,84,84,84,88,85,84,84,84,82,84,84,84,88,85,85,88,88,85,88,88,88,85,85,85,7,5,2,2,6,29,17,17,138,153,152,150,144,125,112,24,132,119,20,109,34,120,127,13,2,11,2,7,6,6,11,17,46,33,16,116,1,2,130,126,3,45,130,114,106,151,148,127,125,126,125,128,31,109,18,36,116,151,183,153,132,46,13,115,125,136,33,47,130,141,150,120,8,119,133,17,1,6,2,2,25,1,2,12,1,6,37,132,47,120,118,106,132,141,109,29,106,20,113,140,124,120,130,65,90,89,90,86,90,91,91,92,98,98,98,98,103,98,98,103,160,156,160,160,160,156,160,156,161,160,156,160,160,156,160,161,156,160,160,98,103,98,98,98,96,92,91,90,91,91,91,91,102,91,92,96,91,102,91,96,102,92,101,98,98,92,101,96,96,91,96,96,98,98,98,102,96,92,92,92,92,98,98,160,169,169,173,171,173,173,173,171,171,171,169,173,179,173,173,171,173,179,198,202,179,179,198,202,179,179,173,169,160,160,156,159,160,156,160,162,160,160,169,171,179,194,203,198,204,201,200,204,204,204,204,204,204,200,204,200,179,198,198,177,171,168,169,169,168,162,160,162,161,162,162,162,162,162,169,169,162,162,162,162,160,162,162,162,160,160,160,160,103,98,103,98,72,
+81,81,84,84,81,81,85,81,81,81,81,81,82,84,82,84,82,84,84,84,82,84,84,82,82,84,82,84,81,84,84,84,84,84,88,85,84,84,84,88,88,88,95,51,2,2,5,2,13,22,109,150,153,150,128,125,139,153,122,132,132,31,18,110,132,15,5,2,2,11,2,7,14,123,126,116,37,11,106,2,6,106,144,22,30,116,110,34,145,144,132,127,125,151,151,24,106,33,45,141,149,142,153,122,15,21,138,153,142,132,114,147,114,132,138,130,138,110,6,2,2,9,2,2,2,6,5,2,2,130,130,44,130,117,47,47,123,33,33,136,153,124,149,30,65,86,90,86,84,88,90,91,90,91,91,87,97,96,98,98,98,103,98,159,103,159,160,161,160,160,160,98,103,160,161,161,160,161,156,160,156,98,103,98,92,96,98,101,92,92,91,92,91,101,92,102,92,91,92,92,92,91,91,92,92,92,92,91,91,92,91,91,90,79,92,91,92,92,87,92,91,90,91,92,92,87,98,98,159,97,160,161,168,162,160,168,162,162,156,169,173,162,169,169,171,173,194,202,194,179,179,194,162,167,156,156,98,98,98,160,156,98,98,97,159,156,173,194,202,179,198,199,198,200,202,200,200,200,200,200,200,199,199,202,194,169,171,162,162,162,160,156,162,156,160,156,162,156,160,162,162,160,169,160,156,160,160,160,161,160,156,161,156,103,98,156,98,98,98,72,
+81,81,81,56,84,81,81,81,81,85,80,81,85,84,81,82,81,81,82,82,84,84,84,81,88,84,82,81,84,84,84,84,84,88,84,84,84,88,85,88,85,88,90,84,1,5,2,2,13,34,123,152,150,145,152,126,126,153,142,114,51,11,18,33,18,2,2,5,6,2,10,6,106,124,126,24,34,8,31,11,2,47,116,15,30,110,15,47,138,137,114,126,183,183,125,46,34,33,36,144,137,128,154,145,15,11,133,136,124,126,141,148,183,116,151,136,140,149,164,75,11,2,2,6,1,6,2,2,2,47,109,106,119,46,114,116,114,13,141,137,140,43,87,82,91,85,90,84,84,86,90,91,85,90,90,90,91,92,96,92,103,98,103,98,159,156,160,156,161,160,98,160,103,160,156,160,160,161,160,161,156,103,103,97,96,92,102,92,96,91,91,91,92,101,101,92,96,91,91,92,91,91,91,91,91,92,91,91,90,86,92,91,91,90,90,91,90,91,90,89,91,90,91,91,91,92,92,92,97,101,98,98,98,156,98,98,159,160,98,156,160,160,156,162,162,160,171,179,173,169,177,169,162,160,98,98,97,92,98,98,103,98,98,98,156,162,169,194,179,198,202,179,198,198,202,179,199,203,203,196,198,179,198,179,177,169,162,162,162,160,162,160,160,160,156,160,160,160,162,156,162,160,156,160,160,156,160,160,160,156,160,156,98,98,98,98,101,101,92,71,
+81,81,81,81,56,81,81,81,81,85,83,81,81,85,81,81,85,84,81,82,82,81,82,84,81,84,81,84,81,84,84,84,84,84,84,84,84,88,88,81,88,88,89,100,5,2,2,5,21,120,126,150,144,145,141,35,144,153,145,125,110,17,24,32,6,6,1,2,11,6,7,11,22,122,124,7,12,29,23,11,2,36,109,8,16,22,18,110,138,128,142,145,149,153,19,34,43,22,29,130,153,143,153,110,111,151,8,130,144,133,153,153,151,137,37,117,45,67,62,38,9,2,5,25,5,11,11,2,2,47,124,120,126,111,46,142,140,17,120,132,183,131,90,90,85,85,85,82,85,89,90,90,85,90,85,91,91,92,92,98,103,98,103,160,160,160,156,98,103,98,103,103,98,98,98,101,98,103,98,160,98,98,102,98,96,91,92,92,91,92,92,91,92,102,92,101,91,91,91,91,91,95,92,91,91,90,91,91,91,89,86,90,86,95,90,90,89,90,85,90,91,89,90,82,91,91,91,91,92,92,98,98,101,96,101,92,98,98,98,98,96,98,98,160,156,160,168,162,171,171,171,168,160,98,96,92,92,96,96,98,93,98,98,160,160,161,162,177,173,173,179,198,179,202,179,202,202,179,202,179,202,179,171,171,168,168,160,160,160,160,156,160,160,156,160,161,160,156,160,156,160,160,160,160,156,160,160,159,103,98,103,98,98,93,102,92,96,92,92,62,
+81,81,81,81,81,81,56,81,81,83,85,81,81,81,56,85,81,81,85,81,81,84,81,84,84,84,84,81,84,82,84,84,84,81,84,84,84,84,84,84,88,88,89,100,25,2,5,2,2,106,144,124,144,148,3,22,185,148,122,188,197,121,11,6,5,2,1,7,7,10,2,2,29,126,125,6,21,22,106,11,2,48,136,11,22,114,132,123,153,186,186,154,151,143,125,22,31,21,13,136,154,153,138,45,46,46,116,144,132,110,183,133,123,132,29,46,60,85,82,58,12,9,1,10,5,5,29,11,2,30,46,47,114,111,20,133,15,46,130,184,185,86,89,85,90,86,90,85,88,85,86,88,88,85,89,91,91,91,101,92,98,103,98,103,98,98,98,98,98,96,91,92,97,96,91,91,92,98,98,96,101,98,87,91,91,95,90,91,91,91,91,91,91,91,87,91,91,91,91,86,95,91,91,91,91,91,90,89,85,91,90,91,90,89,76,91,85,90,89,90,89,89,90,91,91,90,91,91,92,96,92,92,92,92,92,92,101,92,97,92,91,92,98,156,103,162,162,162,168,168,162,161,97,97,92,92,92,92,96,101,101,98,98,160,159,162,169,171,171,171,179,173,194,179,179,194,173,194,173,194,177,171,171,169,162,160,160,156,156,156,103,156,156,159,160,159,160,103,156,98,160,162,156,160,156,98,98,98,98,98,101,101,97,102,92,92,96,96,90,58,
+56,81,56,81,81,56,84,81,81,56,81,81,81,85,81,81,81,88,81,81,85,81,81,81,81,81,81,88,81,84,84,84,84,81,88,84,84,84,84,84,84,85,88,90,53,2,2,2,5,31,127,144,150,140,8,14,132,138,11,36,138,8,1,6,11,2,1,10,12,11,11,5,119,151,29,13,37,17,117,2,2,130,136,6,37,137,132,151,186,186,153,186,145,150,142,8,11,6,17,139,144,149,114,14,47,46,141,147,126,134,153,19,24,131,29,81,90,88,88,90,40,58,28,5,10,2,26,9,21,134,182,182,191,120,67,34,46,47,141,191,87,90,86,90,90,89,91,85,85,90,85,86,89,90,86,90,91,91,91,92,96,93,98,98,98,98,98,96,101,91,91,91,91,92,85,91,91,91,91,89,91,91,90,90,90,86,90,91,91,91,91,92,91,91,90,91,91,91,91,91,86,91,90,91,92,91,91,90,92,90,92,91,85,91,89,90,91,85,86,89,89,89,90,91,90,91,90,91,91,87,101,92,92,91,92,92,91,91,91,91,91,87,101,98,98,160,156,103,156,160,169,156,102,92,92,92,96,92,92,96,98,98,103,93,156,156,156,169,169,169,169,173,173,171,171,173,171,177,173,171,168,169,168,168,162,162,156,160,160,103,97,98,98,98,98,156,103,159,103,160,156,160,156,103,97,98,97,101,98,97,97,101,98,97,97,92,92,97,96,58,
+81,81,81,81,81,81,81,81,81,81,56,81,81,81,56,88,81,81,56,85,81,81,81,85,81,82,82,81,84,84,84,84,84,84,81,84,88,85,84,84,88,84,88,85,85,26,2,5,2,30,144,151,146,153,148,34,132,10,2,5,1,2,1,5,2,2,1,13,1,10,12,8,187,45,2,21,50,2,126,11,2,133,32,2,30,119,132,149,186,153,153,144,141,138,151,6,6,6,6,148,119,148,45,30,46,106,145,140,30,136,130,115,136,44,59,71,89,84,88,90,63,95,61,13,5,5,5,14,148,180,180,45,151,141,144,181,31,149,193,158,90,91,89,91,91,90,90,85,85,91,85,90,90,90,85,89,90,90,85,91,90,90,92,92,91,92,92,91,91,95,90,91,90,89,91,90,90,91,89,91,90,90,85,85,86,90,85,90,91,91,92,91,90,91,91,91,91,91,91,91,91,91,91,92,92,91,90,90,86,91,90,92,90,90,90,91,85,89,85,85,89,89,91,89,90,79,91,91,90,91,91,91,89,91,90,92,91,91,91,91,90,91,92,98,98,92,98,101,103,156,160,160,97,92,96,92,92,96,98,98,98,98,98,98,103,98,156,160,156,162,169,169,169,162,169,173,171,177,171,169,162,168,162,162,168,162,160,160,156,98,98,98,98,98,98,98,103,98,98,98,103,156,98,103,98,98,97,93,102,92,98,98,98,98,96,93,102,91,92,71,
+81,80,82,81,81,81,56,82,81,81,81,81,81,80,81,81,81,81,81,81,81,81,81,81,81,85,81,84,81,82,84,84,81,84,85,84,81,81,88,84,84,84,88,88,85,99,2,2,12,30,132,144,148,150,122,141,5,6,2,2,5,1,2,2,12,2,1,2,5,6,2,14,140,110,2,21,29,2,137,17,2,130,20,2,43,106,147,153,186,154,144,136,108,139,116,2,13,11,11,151,132,144,8,29,119,133,124,109,30,119,132,149,93,96,95,90,85,88,88,88,88,89,100,40,5,11,26,40,197,182,141,119,185,130,182,154,187,149,158,85,91,85,90,89,91,91,91,90,91,89,91,89,85,88,89,89,91,85,90,86,90,89,91,88,91,91,91,95,90,89,89,90,89,91,90,89,91,89,91,90,85,86,85,91,90,82,86,90,91,91,91,91,91,96,92,91,91,91,90,90,91,91,92,92,91,91,91,91,91,89,91,90,86,90,91,89,85,89,89,89,85,86,90,91,90,85,91,89,92,91,91,90,91,91,91,91,91,91,91,85,91,91,91,92,91,91,92,92,97,98,160,156,98,96,102,92,92,92,96,97,98,97,92,96,96,96,98,98,98,156,161,162,168,169,169,171,173,171,173,169,169,168,162,162,160,161,156,160,156,98,98,98,98,98,103,93,156,98,97,101,98,98,101,97,97,101,98,101,92,96,97,92,97,97,101,102,93,93,101,71,
+81,81,56,82,82,81,81,81,83,56,81,81,83,85,81,81,81,81,81,56,81,81,81,85,81,81,81,85,84,84,84,84,84,84,83,85,85,81,88,85,84,85,84,88,85,83,21,26,13,16,106,151,142,143,94,26,9,2,5,2,1,2,1,2,10,2,1,6,10,12,6,106,151,114,2,10,13,5,130,8,2,37,114,2,21,48,153,154,153,145,125,138,132,116,124,7,145,114,17,124,130,148,13,34,124,136,136,30,24,132,134,91,91,91,89,91,89,85,85,84,84,84,84,99,71,72,13,13,181,186,191,121,117,147,149,141,70,87,90,86,90,90,91,91,91,90,92,89,89,90,85,89,89,84,89,88,85,88,90,90,90,89,89,88,89,89,89,85,91,89,88,91,85,91,85,91,85,95,90,85,89,90,90,90,89,85,90,91,91,91,91,90,91,92,91,92,91,91,91,90,91,92,96,92,92,91,91,90,86,92,91,91,90,89,85,89,88,85,85,89,89,89,90,90,91,90,90,90,91,90,91,92,92,91,91,91,92,91,91,91,90,90,91,91,90,79,91,91,92,98,103,98,103,92,92,92,91,92,96,92,96,92,92,92,92,92,92,96,98,98,161,156,162,162,169,169,168,168,168,162,162,162,162,160,159,156,98,98,98,98,98,98,97,97,98,98,103,98,97,97,98,97,97,102,92,101,92,97,101,92,101,102,93,92,97,93,101,102,93,71,
+81,81,80,81,81,56,84,82,81,81,81,56,81,81,56,81,81,81,56,84,56,81,81,81,82,81,81,81,82,84,82,82,85,81,85,81,81,81,85,81,81,83,85,81,88,85,59,21,22,32,153,93,71,69,85,6,2,2,2,9,5,1,2,11,2,2,1,2,5,9,21,141,132,21,6,1,2,2,36,113,2,47,37,2,36,120,154,153,145,146,150,31,106,116,15,11,144,145,115,140,133,31,13,36,34,141,22,15,36,69,95,90,91,90,90,85,85,88,88,84,84,84,84,88,90,85,63,64,40,130,180,185,147,67,130,192,90,88,85,91,90,91,89,90,86,91,90,89,91,85,95,89,89,85,89,85,84,88,89,88,89,82,84,84,88,85,89,89,84,89,91,85,90,89,91,90,90,86,85,91,85,91,95,85,86,90,91,91,90,90,89,92,91,96,96,91,91,91,91,91,91,92,92,96,102,91,90,89,91,90,90,85,85,89,89,85,86,89,84,89,84,90,86,89,90,90,89,89,91,91,90,89,86,90,92,91,92,90,91,88,90,86,88,90,89,90,91,91,97,98,98,98,98,96,91,91,92,91,91,92,92,91,91,92,91,91,91,92,98,98,98,98,156,160,169,169,168,162,160,156,160,162,160,98,156,98,97,98,102,93,98,98,97,98,98,97,98,97,98,103,98,97,97,92,92,92,92,92,101,97,97,101,92,97,102,93,97,98,97,71,
+81,56,81,81,56,81,81,81,56,82,56,81,56,81,81,81,80,81,81,81,81,85,83,85,85,82,81,85,81,85,84,81,81,81,88,81,88,81,81,81,85,90,81,81,88,88,63,50,85,85,86,84,84,84,80,6,7,2,6,2,2,2,5,1,11,1,2,2,6,10,37,133,181,8,2,6,6,7,43,130,11,45,30,5,30,130,136,136,148,144,140,6,32,124,11,13,136,146,147,116,147,24,34,33,132,29,36,65,64,58,89,89,85,90,89,85,89,88,85,84,84,84,85,90,85,90,86,100,57,11,129,131,77,76,86,86,89,89,90,90,91,85,91,90,91,91,91,89,90,91,85,89,89,89,85,88,84,89,90,85,86,88,88,84,85,86,89,88,89,89,85,91,89,95,89,86,90,90,85,90,89,85,85,91,85,91,85,91,85,91,91,91,91,92,92,91,91,91,91,91,97,96,101,91,91,91,91,90,86,95,91,89,89,89,89,85,85,85,85,88,85,90,85,86,90,86,88,91,85,91,90,90,90,91,85,92,90,86,89,89,85,89,88,90,89,85,91,92,92,92,96,101,92,91,91,91,91,91,91,91,91,91,91,89,90,76,96,91,92,98,98,103,156,156,161,162,160,160,159,103,156,156,103,98,98,97,92,92,92,101,98,98,97,92,96,101,101,97,98,98,98,98,91,91,91,91,91,91,92,101,91,92,92,101,91,92,101,97,92,72,
+56,81,82,81,56,81,56,56,81,80,81,81,81,81,56,81,81,84,56,81,81,81,81,81,83,56,85,81,81,85,80,85,81,88,81,81,81,88,81,81,81,81,83,85,81,81,81,88,81,88,85,85,88,85,90,6,2,2,7,2,2,5,2,5,21,34,2,5,1,21,132,140,148,18,22,11,11,10,21,132,11,27,39,10,16,116,136,138,144,122,148,29,29,22,2,30,146,140,136,136,144,130,141,34,151,44,40,95,84,88,90,89,89,89,88,88,88,88,85,88,85,84,88,85,90,91,90,85,91,82,85,85,90,90,85,89,89,89,88,95,90,90,88,91,90,91,90,90,91,85,91,85,84,85,89,85,89,90,85,89,84,89,85,89,85,90,85,89,90,85,90,90,91,89,91,90,85,91,85,91,90,90,91,90,85,89,91,85,91,90,89,92,92,92,92,91,92,92,91,91,91,92,92,91,91,91,91,89,91,85,85,89,84,84,88,88,84,88,82,84,88,85,90,85,85,85,90,90,90,85,89,89,89,89,90,90,90,85,89,89,89,85,86,89,89,90,91,91,91,87,96,91,92,92,85,90,91,91,91,91,91,91,89,79,95,89,86,92,92,92,98,98,103,98,98,98,98,103,98,98,97,98,92,92,92,92,91,91,91,92,96,98,92,96,96,96,96,92,101,92,97,101,97,91,91,91,91,92,91,91,91,92,92,92,92,101,92,97,97,72,
+81,81,80,81,81,84,81,81,56,81,81,56,81,56,84,56,82,81,81,81,81,84,81,81,81,83,85,83,81,83,85,81,81,81,83,85,83,81,81,81,81,81,81,81,81,83,85,88,81,81,88,81,88,81,83,11,2,2,9,5,2,2,2,2,5,29,2,2,6,22,139,120,17,124,114,16,11,2,123,190,2,12,9,2,29,106,106,106,136,144,43,29,119,29,11,123,125,142,133,133,116,133,138,110,22,21,58,88,84,84,88,84,88,88,85,84,84,85,88,84,88,89,89,88,89,90,90,82,89,85,88,88,89,88,85,89,90,82,88,88,88,85,90,90,85,90,86,95,90,90,90,85,85,88,88,88,89,90,90,91,85,89,85,90,85,86,90,84,88,90,86,95,89,90,85,91,88,85,91,85,91,91,85,85,89,90,89,89,86,85,90,91,92,91,90,91,91,85,92,91,91,92,96,91,90,91,92,90,89,91,85,86,88,84,84,84,84,84,84,84,82,84,88,90,82,88,88,89,89,85,88,90,89,90,91,85,89,89,88,89,89,85,90,86,89,88,90,90,90,90,86,91,90,89,91,79,90,91,91,91,92,90,92,90,90,90,92,91,91,92,92,96,97,98,101,92,96,92,92,92,101,92,92,91,91,91,86,91,91,91,92,98,96,92,92,92,92,92,91,92,91,92,101,92,92,91,91,91,91,91,91,91,91,91,91,92,92,91,92,71,
+56,81,56,81,56,81,56,81,84,81,56,81,81,81,81,81,81,56,82,81,81,81,81,81,81,81,81,81,81,56,81,83,81,81,81,81,81,81,81,56,85,81,81,81,81,81,81,81,83,81,83,81,83,81,99,10,25,6,2,2,2,6,2,2,2,30,2,6,1,36,144,136,132,116,11,15,6,11,16,11,11,11,2,2,11,13,31,46,125,17,33,47,180,43,134,108,109,132,114,149,123,147,46,66,75,57,84,82,84,81,85,84,84,88,84,84,88,88,85,88,88,89,89,85,88,85,88,88,85,88,89,85,90,90,88,85,88,88,85,84,84,88,90,83,90,90,90,88,91,90,89,89,85,88,84,84,88,90,89,85,90,90,85,91,90,90,85,89,90,88,90,90,85,89,88,84,89,90,91,90,89,85,91,90,86,89,90,90,90,90,91,91,92,92,90,92,90,91,90,91,92,92,101,91,91,91,90,86,90,90,90,82,85,84,84,84,84,84,84,82,82,84,84,88,84,84,84,84,88,84,84,88,90,86,90,89,89,89,89,84,85,88,85,89,89,89,90,85,91,90,90,85,91,90,90,91,90,90,92,90,92,85,91,85,91,89,79,90,91,91,92,97,92,92,92,92,91,91,92,92,92,92,91,91,91,91,91,91,91,91,92,96,92,92,91,91,91,91,91,91,91,91,92,92,86,91,86,91,91,92,92,91,91,91,91,91,91,91,91,62,
+81,56,82,56,81,56,81,56,56,81,81,80,56,82,56,82,84,81,56,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,83,84,81,81,83,81,81,81,81,81,81,81,90,1,2,9,2,5,9,2,2,2,12,119,17,2,5,117,147,116,122,8,15,24,17,13,29,10,2,12,9,5,21,17,29,47,110,14,134,24,34,138,46,29,33,151,144,144,119,116,35,91,82,56,81,81,88,81,81,83,84,81,88,84,81,88,84,84,88,84,88,84,84,84,84,88,88,88,88,88,89,89,85,89,89,88,84,85,81,90,81,88,85,90,81,88,85,90,85,88,85,88,85,85,90,89,90,88,89,89,90,90,86,85,88,90,81,88,88,89,85,84,85,84,84,88,90,85,91,90,89,85,90,90,90,85,86,88,91,85,90,86,91,91,90,91,85,90,86,92,96,91,90,86,90,90,90,85,85,85,88,82,84,88,85,82,84,85,84,84,84,88,85,84,84,84,84,84,84,84,89,85,90,90,86,89,89,89,89,89,84,89,89,89,89,85,86,89,89,89,85,89,85,90,86,91,82,91,89,95,89,91,89,95,89,91,91,91,92,92,91,91,91,91,91,91,87,92,91,91,91,91,91,91,91,91,91,91,96,96,92,91,91,90,91,91,91,91,91,91,92,92,91,91,91,91,92,92,91,91,91,91,92,91,92,91,91,58,
+56,81,80,82,81,81,56,84,81,56,81,81,81,81,81,81,56,84,82,84,81,81,81,81,81,81,56,84,81,81,81,81,81,81,81,81,81,81,80,81,81,81,81,81,81,81,81,81,81,81,81,81,83,81,83,2,5,9,2,2,2,21,6,6,2,43,126,3,2,30,17,34,29,2,15,127,127,125,109,10,13,2,2,2,7,106,140,133,21,21,106,142,146,151,109,10,37,151,140,36,48,74,57,83,81,80,81,84,81,81,81,81,81,81,81,88,88,84,81,81,88,85,85,88,85,88,84,84,84,84,84,84,88,89,90,88,88,85,84,88,85,81,88,81,85,81,88,85,88,88,88,81,88,85,81,88,88,85,88,85,88,90,88,90,90,88,85,81,88,85,88,85,88,81,84,84,88,91,85,91,90,89,91,90,85,88,85,85,89,88,90,90,91,90,90,91,85,89,89,90,90,90,96,90,92,91,85,91,90,89,89,88,88,85,84,81,88,81,85,81,88,81,84,82,84,84,84,84,84,84,84,88,90,89,86,89,85,89,89,89,90,89,89,89,89,89,86,88,85,85,89,89,85,86,90,90,85,91,91,90,90,86,95,85,91,89,92,85,91,91,91,91,91,91,89,91,91,91,91,91,91,91,91,91,91,92,91,92,96,92,92,92,92,92,91,79,89,91,91,91,91,86,91,91,91,91,91,92,91,91,91,91,92,91,91,87,91,91,91,58,
+81,81,81,81,56,56,81,56,56,84,56,81,84,56,81,81,56,81,81,56,81,81,80,81,81,56,81,56,81,81,81,81,81,80,82,81,81,81,81,81,81,81,81,81,84,56,81,81,81,80,81,81,81,81,88,26,9,9,5,2,10,21,11,2,2,22,138,15,10,30,129,6,2,2,24,125,128,124,126,109,106,106,6,6,48,149,138,130,30,21,109,122,181,182,8,5,119,136,33,50,63,81,81,81,80,81,81,81,81,81,81,81,81,81,89,81,81,81,83,88,88,81,81,81,81,85,81,84,85,88,85,84,84,88,88,84,84,85,83,85,88,85,88,85,85,88,81,81,88,85,88,85,83,85,81,81,81,83,88,88,85,83,85,88,81,81,81,81,81,81,81,88,81,88,85,85,84,88,90,89,90,90,84,84,85,88,90,81,84,84,89,89,89,90,86,85,90,89,90,85,90,91,88,91,89,90,91,85,86,89,84,84,84,84,84,81,81,81,83,85,80,85,84,84,84,84,84,84,84,84,84,84,89,88,85,90,89,89,90,89,88,85,89,89,89,90,85,91,90,91,85,89,85,90,86,91,90,89,92,85,86,90,90,91,90,89,85,89,91,91,91,91,79,90,79,90,90,91,91,91,91,91,86,92,92,92,92,92,91,92,92,92,91,91,91,91,91,91,92,91,91,91,86,91,91,91,91,91,92,92,92,91,91,91,91,91,91,91,86,58,
+56,81,56,82,81,84,81,56,81,81,56,81,56,81,80,82,81,81,56,56,84,81,81,81,84,81,56,82,81,81,82,81,81,81,56,81,56,56,81,81,81,81,81,81,81,81,80,81,80,81,80,81,81,81,56,81,6,10,7,9,12,7,9,11,2,12,21,10,12,21,13,11,5,11,116,132,145,115,123,46,130,109,21,119,116,116,43,46,26,21,130,137,184,118,2,6,106,132,60,81,81,81,81,81,80,81,81,83,81,81,81,81,81,81,81,81,81,84,81,81,81,81,88,81,81,88,81,85,83,82,84,81,85,84,84,82,88,88,85,81,81,81,81,85,83,81,81,81,81,81,81,81,88,81,81,81,81,81,83,81,81,81,90,80,81,81,81,81,81,81,81,81,81,81,88,81,88,85,85,88,85,88,85,84,84,84,81,85,84,81,88,89,89,90,90,89,84,88,85,89,91,88,89,85,91,90,85,90,85,89,89,88,84,84,81,88,81,81,81,81,88,84,84,84,85,84,81,82,84,82,84,84,84,89,89,88,85,86,88,89,86,89,86,89,90,85,85,89,90,86,91,89,90,90,91,91,86,91,82,91,90,91,85,91,91,90,90,85,90,90,91,91,90,90,90,91,91,91,91,91,91,91,91,86,91,91,92,91,92,92,91,91,91,91,91,91,91,82,91,86,91,91,91,91,91,91,91,91,91,92,91,91,91,91,91,91,86,86,95,57,
+81,81,84,56,81,56,84,81,81,56,81,56,81,56,81,81,56,81,81,56,81,81,56,56,81,56,81,81,80,80,56,81,81,81,81,80,82,80,82,56,81,81,80,80,80,61,81,81,81,81,81,81,80,81,80,99,10,2,10,2,2,29,32,2,6,9,27,10,2,5,10,13,10,11,119,116,122,116,111,21,47,18,110,120,106,181,144,45,39,26,30,181,138,8,2,21,149,66,58,81,81,80,81,81,81,81,81,84,80,81,80,81,81,81,81,81,83,81,81,81,83,81,81,88,81,81,88,81,81,90,84,83,81,85,88,85,81,81,81,88,81,88,88,81,83,85,88,80,81,81,81,81,81,81,83,80,56,81,81,81,81,83,81,81,81,83,80,81,81,85,81,81,83,81,81,83,85,83,89,88,88,89,85,84,84,88,81,85,88,85,84,88,88,88,85,88,85,88,85,88,84,88,85,84,88,91,88,88,85,88,85,84,84,81,84,85,81,81,81,81,85,81,84,84,84,85,85,84,84,84,82,84,84,88,82,90,89,89,85,91,85,85,90,90,89,86,91,91,91,91,90,79,91,91,91,90,91,90,89,91,90,86,92,91,91,91,90,90,86,91,91,91,91,91,91,90,90,91,91,91,86,91,91,91,91,91,92,92,92,92,91,91,91,91,91,86,91,91,86,91,91,91,91,91,91,91,92,91,92,86,91,91,86,90,91,91,92,90,89,58,
+81,56,56,81,56,81,81,81,56,82,56,56,56,81,81,61,81,56,84,56,81,56,81,56,81,81,81,56,81,81,81,81,81,81,80,56,56,61,83,82,56,82,80,80,82,56,56,80,82,80,81,80,81,80,81,81,54,2,2,9,10,17,106,17,2,6,5,5,2,62,40,15,11,9,6,46,138,147,109,11,141,32,138,46,141,132,119,46,11,2,29,132,141,11,2,22,77,81,81,80,81,81,80,80,81,80,80,61,81,81,81,80,81,80,81,81,80,84,81,81,81,81,81,90,83,81,81,81,81,81,81,81,81,84,81,81,81,88,81,88,85,88,81,81,81,81,83,85,83,85,81,81,81,81,81,81,81,81,80,81,81,81,83,81,81,83,81,81,83,81,83,85,81,81,81,81,81,81,81,88,88,85,88,85,88,81,81,81,85,81,88,84,84,84,84,88,85,84,84,81,84,84,84,84,89,90,89,85,84,84,84,84,84,84,84,80,81,88,81,81,81,88,84,82,88,82,88,85,89,89,84,84,84,84,89,88,89,85,91,85,92,91,90,91,86,90,91,91,91,91,91,91,91,91,91,86,90,86,91,91,91,92,91,101,96,92,92,92,92,92,92,92,91,91,91,86,91,86,90,79,90,91,91,86,92,91,91,91,92,91,91,91,91,91,91,91,91,91,91,91,91,91,92,92,91,91,91,91,91,91,90,89,86,91,90,86,86,86,91,58,
+56,84,82,81,82,81,56,81,56,80,81,56,82,56,56,80,61,80,56,81,81,56,82,81,56,80,56,82,56,81,56,81,56,80,56,80,80,80,56,80,80,80,81,80,80,80,80,81,80,80,61,81,81,81,81,81,81,6,9,5,5,43,130,136,6,53,26,54,2,2,2,18,22,2,6,36,136,126,118,13,141,34,120,43,136,136,134,30,26,2,141,119,29,2,117,187,80,80,61,81,80,81,81,81,81,81,81,80,80,81,81,80,80,61,83,81,81,81,81,81,81,81,81,81,81,81,81,81,88,81,88,81,81,81,81,81,81,81,90,80,81,81,81,81,81,81,81,83,81,81,83,85,81,81,81,80,81,81,80,80,81,83,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,88,85,88,81,88,81,81,85,83,81,81,85,88,84,84,84,84,88,85,84,88,82,84,84,84,85,90,89,84,84,84,84,84,84,81,84,81,81,81,88,81,84,81,84,82,84,88,85,85,84,89,84,85,84,84,84,89,89,90,90,86,90,91,89,92,91,91,91,91,91,91,92,91,91,91,91,91,91,92,91,91,92,92,92,92,96,92,92,92,91,92,92,91,91,91,91,91,91,91,90,90,90,86,91,91,91,90,86,91,91,91,91,91,91,91,91,91,91,91,91,91,92,92,91,91,91,91,91,91,89,91,90,91,86,90,89,91,89,90,85,62,
+56,81,81,80,56,56,56,81,56,61,56,80,56,56,82,56,81,56,56,63,80,80,56,56,63,80,56,61,63,81,80,61,80,80,61,80,56,80,61,81,80,80,61,81,80,56,80,61,81,80,80,56,80,61,81,80,81,51,2,2,9,46,123,136,42,88,82,83,2,6,2,29,111,112,16,116,133,182,111,29,132,119,130,139,46,43,48,197,147,122,49,120,32,26,78,80,56,81,80,56,80,81,61,83,56,80,82,80,56,83,80,80,83,80,61,56,81,81,81,81,81,81,81,81,81,80,80,81,81,81,81,84,81,81,83,81,81,81,83,88,83,81,81,85,81,81,85,81,83,81,81,81,81,83,81,80,81,81,81,56,80,81,56,81,81,81,81,81,81,83,81,81,81,81,56,81,81,81,81,81,81,88,81,81,81,81,83,81,88,82,84,84,84,85,84,84,88,84,81,84,81,84,84,84,88,85,84,84,82,84,82,81,81,84,81,81,56,81,81,85,81,84,84,84,84,84,88,88,85,85,84,84,85,89,85,85,91,90,91,82,91,90,91,90,90,91,90,91,91,91,86,91,90,91,91,91,92,91,92,91,92,92,92,92,92,91,91,92,92,92,101,92,96,93,92,92,96,91,91,86,91,90,90,92,86,79,91,95,90,91,91,90,86,91,91,91,91,91,87,92,91,92,91,92,91,91,91,91,91,90,79,89,85,86,91,86,89,91,85,58,
+81,56,56,56,82,56,81,56,81,56,80,56,82,56,56,80,82,56,61,56,56,63,80,56,61,80,56,80,80,56,56,81,80,56,80,80,80,56,80,80,56,80,56,80,80,80,56,56,80,80,56,80,80,56,80,80,61,83,26,2,2,129,124,132,77,80,80,85,26,1,2,5,29,18,132,32,110,141,114,47,138,32,70,138,120,44,193,134,176,180,17,130,82,81,80,80,80,56,80,82,80,56,80,80,80,80,80,80,80,81,56,81,83,80,80,81,83,81,81,80,81,81,81,81,81,81,80,81,80,81,81,56,84,81,81,81,81,81,83,81,90,83,81,83,81,83,81,81,83,81,81,81,81,81,83,81,81,81,81,83,81,56,84,81,80,81,81,81,81,81,81,80,56,82,81,80,81,81,81,88,81,84,81,56,81,81,81,81,84,84,84,84,88,88,84,84,84,84,84,81,88,85,84,84,84,84,88,84,81,84,81,84,82,81,84,81,81,81,83,81,85,84,84,84,82,84,84,84,84,84,88,84,85,82,89,89,89,89,85,90,85,85,89,85,89,89,90,91,90,90,89,91,91,92,90,91,86,86,92,91,91,91,91,91,91,79,91,91,91,92,92,92,97,96,92,97,92,92,91,91,89,86,92,90,90,85,85,90,85,86,85,90,90,91,85,91,91,91,91,91,92,91,91,91,86,91,91,79,91,90,90,91,91,89,91,89,92,90,85,58,
+81,82,81,81,81,56,56,56,56,84,56,80,56,81,56,56,56,56,56,80,56,56,56,80,80,56,56,56,81,80,80,56,56,80,80,56,81,80,80,56,80,80,80,80,56,81,80,80,56,80,80,81,80,80,80,56,80,80,81,11,5,119,133,157,80,80,81,81,54,29,1,12,2,43,123,120,120,126,29,119,69,61,29,192,188,130,132,129,120,43,58,56,80,81,80,80,56,80,80,80,81,80,81,80,56,81,80,80,56,56,81,80,80,81,81,81,81,81,80,81,81,80,81,81,80,81,80,81,81,80,81,83,81,81,84,81,81,81,81,81,83,81,81,81,81,81,81,81,83,81,83,80,81,81,81,81,56,81,81,81,80,83,81,80,81,81,81,81,81,81,81,81,81,80,81,81,80,81,82,80,81,81,81,81,81,81,81,81,81,88,84,84,84,84,82,84,84,84,88,81,81,81,88,84,84,84,81,82,81,84,81,81,81,81,84,81,81,81,81,81,81,84,81,81,84,84,84,84,84,85,84,84,88,88,89,84,84,88,89,88,84,85,84,88,82,89,89,85,90,89,90,91,90,86,91,91,90,86,86,92,91,90,91,91,91,91,90,91,91,91,92,92,92,96,96,96,96,91,91,91,91,90,85,86,89,89,90,91,90,82,91,85,86,86,90,91,91,91,91,91,91,87,92,91,91,91,86,95,90,90,79,89,90,90,90,91,89,91,82,57,
+82,82,81,84,82,56,82,81,81,56,56,56,56,56,81,56,80,56,56,56,56,56,80,56,56,80,56,56,56,56,56,80,56,80,56,80,56,80,56,80,56,56,80,56,80,56,80,56,80,56,80,56,56,80,56,80,56,80,56,56,38,67,72,56,80,56,56,81,56,35,141,33,2,10,45,132,144,141,64,82,80,56,80,52,38,65,65,85,58,80,56,80,56,80,56,81,80,56,80,56,80,56,80,56,80,56,80,56,80,56,80,56,81,80,80,81,80,83,80,81,81,81,81,81,81,80,81,80,83,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,80,81,81,81,81,81,80,81,81,80,81,81,80,81,81,81,83,80,80,81,80,81,81,81,81,80,81,80,81,81,81,81,88,84,81,81,88,81,82,81,84,82,82,81,81,81,81,81,88,84,84,82,84,81,84,81,81,81,81,81,81,81,81,81,81,81,81,88,81,84,81,88,84,84,84,84,84,84,84,88,84,84,84,88,85,84,84,84,84,84,84,84,89,84,89,89,85,90,90,90,85,91,90,91,89,92,79,90,91,91,91,91,91,91,91,91,92,92,92,92,92,91,91,91,91,90,86,85,89,85,86,85,86,91,89,85,90,85,90,91,82,86,91,90,91,91,91,91,91,91,91,91,91,79,91,90,91,79,90,91,79,90,91,89,58,
+82,81,82,81,81,56,81,56,56,56,81,56,81,56,56,56,56,80,80,80,56,80,56,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,56,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,81,80,6,14,28,39,133,149,157,80,80,80,56,80,80,81,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,81,80,81,80,81,83,80,80,56,80,80,81,83,56,81,80,81,80,81,81,83,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,80,80,80,81,81,80,81,81,81,56,83,80,56,80,83,56,83,81,80,80,81,81,81,83,81,80,81,81,81,81,81,80,81,81,81,81,81,81,84,81,81,84,84,81,84,84,84,81,81,81,81,81,84,84,84,84,81,84,81,84,81,81,82,81,81,81,81,56,81,81,81,81,81,81,84,81,84,81,82,81,82,84,84,81,81,84,82,84,84,84,84,84,84,84,84,84,84,84,84,84,89,89,90,89,89,85,89,90,90,90,90,90,91,90,91,90,90,91,91,92,92,92,91,92,91,91,91,90,90,90,90,90,85,90,89,89,90,85,89,89,85,89,85,89,90,90,85,91,90,86,90,90,86,90,85,86,90,85,85,90,90,90,90,86,90,90,90,90,58,
+};
+
+MWIMAGEHDR image_zion208 = {
+  320, 200,	/* width, height*/
+  1, 8,		/* planes, bpp*/
+  320, 1,	/* pitch, bytesperpixel*/
+  1, 256,	/* compression, palsize*/
+  -1L,		/* transcolor*/
+  palette,
+  imagebits,
+};
diff -urN lib/microwindows/src/mwin/mwobjects/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/mwobjects/Makefile
--- lib/microwindows/src/mwin/mwobjects/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/mwobjects/Makefile	2005-02-21 16:03:38.000000000 +0100
@@ -0,0 +1,20 @@
+#
+# Copyright (C) Chris Johns (ccj@acm.org)
+#
+# Microwindows C++ Wrappers.
+#
+
+include $(CONFIG)
+
+LIBNAME = libmwobjects.a
+LIBNAMESO = libmwobjects.so
+
+ifeq ($(OBJFRAMEWORK), Y)
+CXXOBJS += mwobjects.o
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
diff -urN lib/microwindows/src/mwin/mwobjects/mwobjects.cc /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/mwobjects/mwobjects.cc
--- lib/microwindows/src/mwin/mwobjects/mwobjects.cc	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/mwobjects/mwobjects.cc	2005-02-21 16:03:38.000000000 +0100
@@ -0,0 +1,551 @@
+/*
+  Copyright (C) Chris Johns (ccj@acm.org)
+
+  Microwindows C++ Wrappers.
+
+ */
+
+#include <algorithm>
+#include <stdarg.h>
+#include <stdio.h>
+#include <mwobjects.h>
+
+namespace MicroWindowsObjects
+{
+
+  static Application *the_application = 0;
+
+  WindowClass::WindowClass ()
+  {
+    wclass.style         = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW;
+    wclass.lpfnWndProc   = 0;
+    wclass.lpfnWndProc   = 0;
+    wclass.cbClsExtra    = 0;
+    wclass.cbWndExtra    = 0;
+    wclass.hInstance     = 0;
+    wclass.hIcon         = 0;
+    wclass.hCursor       = 0;
+    wclass.hbrBackground = 0;
+    wclass.lpszMenuName  = 0;
+    wclass.lpszClassName = 0;
+  }
+
+  WindowClass::WindowClass (LPCSTR    lpszClassName,
+                            UINT      style,
+                            int       cbClsExtra,
+                            int       cbWndExtra,
+                            HINSTANCE hInstance,
+                            HICON     hIcon,
+                            HCURSOR   hCursor,
+                            HBRUSH    hbrBackground,
+                            LPCSTR    lpszMenuName)
+  {
+    wclass.style         = style;
+    wclass.lpfnWndProc   = (WNDPROC) Window::WndProc;
+    wclass.cbClsExtra    = cbClsExtra;
+    wclass.cbWndExtra    = cbWndExtra + sizeof (Window *);
+    wclass.hInstance     = hInstance;
+    wclass.hIcon         = hIcon;
+    wclass.hCursor       = hCursor;
+    wclass.hbrBackground = hbrBackground;
+    wclass.lpszMenuName  = lpszMenuName;
+    wclass.lpszClassName = lpszClassName; 
+  }
+
+  ATOM WindowClass::register_class ()
+  {
+    return RegisterClass (&wclass);
+  }
+
+  Window::Window ()
+    : hwnd (0)
+  {
+  }
+
+  Window::Window (DWORD     dwExStyle,
+                  LPCSTR    lpClassName,
+                  LPCSTR    lpWindowName,
+                  DWORD     dwStyle,
+                  int       x, 
+                  int       y,
+                  int       nWidth,
+                  int       nHeight,
+                  HWND      hwndParent,
+                  HMENU     hMenu,
+                  HINSTANCE hInstance,
+                  LPVOID    lpParam)
+    : hwnd (0)
+  {
+    create (dwExStyle,
+            lpClassName,
+            lpWindowName,
+            dwStyle,
+            x, y, nWidth, nHeight,
+            hwndParent,
+            hMenu,
+            hInstance,
+            lpParam);
+  }
+
+  Window::~Window ()
+  {
+    destory ();
+  }
+
+  HWND
+  Window::create (DWORD     dwExStyle,
+                  LPCSTR    lpClassName,
+                  LPCSTR    lpWindowName,
+                  DWORD     dwStyle,
+                  int       x, 
+                  int       y,
+                  int       nWidth,
+                  int       nHeight,
+                  HWND      hwndParent,
+                  HMENU     hMenu,
+                  HINSTANCE hInstance,
+                  LPVOID    lpParam)
+  {
+    lpCreateParams = lpParam;
+  
+    lpParam = (LPVOID) this;
+  
+    hwnd = ::CreateWindowEx (dwExStyle, 
+                             lpClassName,
+                             lpWindowName,
+                             dwStyle,
+                             x, y, nWidth, nHeight,
+                             hwndParent,
+                             hMenu,
+                             hInstance,
+                             lpParam);
+    return hwnd;
+  }
+
+  BOOL
+  Window::destory ()
+  {
+    if (hwnd)
+    {
+      HWND old_hwnd = hwnd;
+      hwnd = 0;
+      return ::DestroyWindow (old_hwnd);
+    }
+    return 0;
+  }
+
+  bool
+  Window::attach (const int fd, FileDescriptor& file_descriptor)
+  {
+    //
+    // The user must set the fd before being added to the set.
+    //
+
+    if ((fd < 0) || (fd >= FD_SETSIZE) || (file_descriptor.file_desc != -1))
+      return false;
+  
+    //
+    // If this fd is already taken do not add another.
+    //
+
+    file_descriptor.file_desc = fd;
+    file_descriptor.window    = this;
+
+    if (file_descriptors.find (&file_descriptor) != file_descriptors.end ())
+    {
+      file_descriptor.file_desc = -1;
+      file_descriptor.window    = 0;
+      return false;
+    }
+  
+    file_descriptors.insert (&file_descriptor);
+  
+    return true;
+  }
+
+  bool
+  Window::detach (FileDescriptor& file_descriptor)
+  {
+    //
+    // The user must set the fd before being added to the set.
+    //
+
+    if ((file_descriptor.fd () < 0) || (file_descriptor.fd () >= FD_SETSIZE))
+      return false;
+  
+    //
+    // If this fd is already taken do not add another.
+    //
+
+    if (file_descriptors.find (&file_descriptor) == file_descriptors.end ())
+      return false;
+  
+    file_descriptor.disable_read ();
+    file_descriptor.disable_write ();
+    file_descriptor.disable_except ();
+  
+    file_descriptors.erase (&file_descriptor);
+
+    file_descriptor.file_desc = -1;
+    file_descriptor.window    = 0;
+
+    return true;
+  }
+
+  struct eq_fd
+  {
+    const int fd;
+    eq_fd (const int fd) : fd (fd) {}
+    bool operator() (const FileDescriptor* f1) const 
+      { return (f1->fd () == fd); }
+  };
+  
+  LRESULT
+  Window::message_handler (UINT   msg,
+                           WPARAM wp,
+                           LPARAM lp)
+  {
+    switch (msg)
+    {
+      case WM_FDINPUT:
+      case WM_FDOUTPUT:
+      case WM_FDEXCEPT:
+      
+      {
+        //
+        // The iterator provides a reference to the object pointer
+        // as the set contains pointers.
+        //
+
+        set<FileDescriptor*>::iterator file_descriptor;
+ 
+        file_descriptor = find_if (file_descriptors.begin (), 
+                                   file_descriptors.end (), 
+                                   eq_fd ((int) wp));
+
+        if (file_descriptor != file_descriptors.end ())
+        {
+          switch (msg)
+          {
+            case WM_FDINPUT:
+              return (*file_descriptor)->read ();
+            
+            case WM_FDOUTPUT:
+              return (*file_descriptor)->write ();
+            
+            case WM_FDEXCEPT:
+              return (*file_descriptor)->except ();
+          }
+        }
+      }
+      break;
+      
+      default:
+        break;
+    }
+  
+    return ::DefWindowProc (hwnd, msg, wp, lp);
+  }
+
+  bool
+  Window::ltint::operator () (const FileDescriptor* f1, 
+                              const FileDescriptor* f2) const
+  {
+    return f1->fd () < f2->fd ();
+  }
+
+  LRESULT CALLBACK 
+  Window::WndProc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
+  {
+    int    offset  = GetClassLong (hwnd, GCL_CBWNDEXTRA) - sizeof (Window *);
+    Window *window = 0;
+  
+    if (msg == WM_CREATE)
+    {
+      LPCREATESTRUCT cs = (LPCREATESTRUCT) lp;
+    
+      window = dynamic_cast<Window*>((Window*) cs->lpCreateParams);
+
+      if (window)
+      {
+        window->hwnd = hwnd;
+        SetWindowLong (hwnd, offset, (DWORD) window);
+        cs->lpCreateParams = window->lpCreateParams;
+      }
+    }
+    else
+    {
+      window = dynamic_cast<Window*>((Window*) GetWindowLong (hwnd, offset));
+    }
+    
+    if (window)
+      return window->message_handler (msg, wp, lp);
+  
+    return ::DefWindowProc (hwnd, msg, wp, lp);
+  }
+
+  Paint::Paint (HWND hwnd)
+    : hwnd (hwnd),
+      draw_3d (false),
+      drawing (false),
+      r (0, 0, 0, 0),
+      text_format (0)
+  {
+  }
+
+  Paint::Paint (HWND hwnd, LPARAM lpParam)
+    : hwnd (hwnd),
+      draw_3d (false),
+      drawing (false),
+      r (0, 0, 0, 0),
+      text_format (0)
+  {
+    POINTSTOPOINT (pt, lpParam);  
+  }
+
+  Paint::~Paint ()
+  {
+    end ();
+  }
+
+  void
+  Paint::begin (bool init_3d, bool draw_3d_in_mem)
+  {
+    if (!drawing && hwnd)
+    {
+      hdc = ::BeginPaint (hwnd, &ps);
+    
+      r.get_client (hwnd);
+    
+      if (init_3d)
+        initialise_3d (draw_3d_in_mem);
+    
+      drawing = true;
+    }
+  }
+
+  void
+  Paint::end ()
+  {
+    if (drawing)
+    {
+      paint_3d ();
+
+      ::EndPaint (hwnd, &ps);
+
+      drawing = false;
+    }
+  }
+
+  int
+  Paint::text_out (int x, int y, const char *format, ...)
+  {
+    Rect    rect (x, y, x + 100, y + 100);
+    va_list arg;
+  
+    va_start (arg, format);
+    vsnprintf (format_buf, TEXT_BUF_SIZE, format, arg);
+    format_buf[TEXT_BUF_SIZE - 1] = '\0';
+
+    return ::DrawText (hdc, format_buf, -1, rect, text_format);
+  }
+
+  FileDescriptor::FileDescriptor ()
+    : file_desc (-1),
+      window (0)
+  {
+  }
+
+  FileDescriptor::~FileDescriptor ()
+  {
+    if (window)
+      window->detach (*this);
+  }
+
+  bool
+  FileDescriptor::enable_read ()
+  {
+    if (!read_is_enabled && window && (file_desc != -1))
+    {
+      ::MwRegisterFdInput (*window, file_desc);
+      read_is_enabled = true;
+      return true;
+    }
+    return false;
+  }
+
+  bool
+  FileDescriptor::disable_read ()
+  {
+    if (read_is_enabled && window && (file_desc != -1))
+    {
+      ::MwUnregisterFdInput (*window, file_desc);
+      read_is_enabled = false;
+      return true;
+    }
+    return false;
+  }
+
+
+  bool
+  FileDescriptor::enable_write ()
+  {
+    if (!write_is_enabled && window && (file_desc != -1))
+    {
+      ::MwRegisterFdOutput (*window, file_desc);
+      write_is_enabled = true;
+      return true;
+    }
+    return false;
+  }
+
+  bool
+  FileDescriptor::disable_write ()
+  {
+    if (write_is_enabled && window && (file_desc != -1))
+    {
+      ::MwUnregisterFdOutput (*window, file_desc);
+      write_is_enabled = false;
+      return true;
+    }
+    return false;
+  }
+
+  bool
+  FileDescriptor::enable_except ()
+  {
+    if (!except_is_enabled && window && (file_desc != -1))
+    {
+      ::MwRegisterFdExcept (*window, file_desc);
+      except_is_enabled = true;
+      return true;
+    }
+    return false;
+  }
+
+  bool
+  FileDescriptor::disable_except ()
+  {
+    if (except_is_enabled && window && (file_desc != -1))
+    {
+      ::MwUnregisterFdExcept (*window, file_desc);
+      except_is_enabled = false;
+      return true;
+    }
+    return false;
+  }
+
+  LRESULT
+  FileDescriptor::read ()
+  {
+    return 0;
+  }
+
+  LRESULT
+  FileDescriptor::write ()
+  {
+    return 0;
+  }
+
+  LRESULT
+  FileDescriptor::except ()
+  {
+    return 0;
+  }
+
+  Application::Application ()
+    : background (0)
+  {
+    if (!the_application)
+      the_application = this;
+  }
+
+  Application::Application (MWIMAGEHDR& background)
+    : background (&background)
+  {
+    if (!the_application)
+      the_application = this;
+  }
+
+  Application::~Application ()
+  {
+  }
+
+  int
+  Application::initialise ()
+  {
+    return 0;
+  }
+
+  int
+  Application::shutdown ()
+  {
+    return 0;
+  }
+
+  int WINAPI 
+  Application::WinMain (HINSTANCE hInstance, 
+                        HINSTANCE hPrevInstance, 
+                        LPSTR     lpCmdLine,
+                        int       nShowCmd)
+  {
+    if (the_application)
+    {
+      int result;
+    
+      MwRegisterButtonControl (0);
+    
+      result = the_application->initialise ();
+    
+      if (result)
+        return result;
+    
+      //
+      // Set background wallpaper
+      //
+    
+      if (the_application->background)
+        MwSetDesktopWallpaper (the_application->background);
+
+      MSG msg;
+    
+      //
+      // type ESC to quit...
+      //
+    
+      while (GetMessage (&msg, 0, 0, 0)) 
+      {
+        TranslateMessage (&msg);
+        DispatchMessage (&msg);
+      }
+
+      result = the_application->shutdown ();
+    
+      if (result)
+        return result;
+    
+      return 0;
+    }
+  
+    return 1;
+  }
+
+};
+
+//
+//  Global Microwindows WinMain () routine with "C" linkage
+//
+
+extern "C"
+{
+  int WinMain (HINSTANCE hInstance, 
+               HINSTANCE hPrevInstance, 
+               LPSTR     lpCmdLine, 
+               int       nShowCmd)
+  {
+    return MicroWindowsObjects::Application::WinMain (hInstance, 
+                                                      hPrevInstance, 
+                                                      lpCmdLine,  
+                                                      nShowCmd);
+  }
+};
diff -urN lib/microwindows/src/mwin/winclip.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winclip.c
--- lib/microwindows/src/mwin/winclip.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winclip.c	2005-02-21 16:03:42.000000000 +0100
@@ -0,0 +1,7 @@
+#include "device.h"
+
+#if DYNAMICREGIONS
+#include "winclip2.c"
+#else
+#include "winclip1.c"
+#endif
diff -urN lib/microwindows/src/mwin/winclip1.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winclip1.c
--- lib/microwindows/src/mwin/winclip1.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winclip1.c	2005-02-21 16:13:28.000000000 +0100
@@ -0,0 +1,398 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ */
+#include "windows.h"
+#include "wintern.h"
+
+/*
+ * Macro to distinguish cases of clipping.
+ */
+#define	GAPVAL(leftgap, rightgap, topgap, bottomgap) \
+	(((leftgap) << 3) + ((rightgap) << 2) + ((topgap) << 1) + (bottomgap))
+
+static BOOL MwExcludeClipRect(int minx,int miny,int maxx,int maxy,int *count,
+		MWCLIPRECT *cliprects);
+static int  MwSplitClipRect(MWCLIPRECT *srcrect, MWCLIPRECT *destrect,
+		MWCOORD minx, MWCOORD miny, MWCOORD maxx, MWCOORD maxy);
+
+/*
+ * Set the clip rectangles for a window taking into account other
+ * windows that may be obscuring it.  The windows that may be obscuring
+ * this one are the siblings of each direct ancestor which are higher
+ * in priority than those ancestors.  Also, each parent limits the visible
+ * area of the window.
+ */
+void
+MwSetClipWindow(HDC hdc)
+{
+	HWND		wp = hdc->hwnd;
+	HWND		pwp;		/* parent window */
+	HWND		sibwp;		/* sibling windows */
+	MWCLIPRECT	*clip;		/* first clip rectangle */
+	int		count;		/* number of clip rectangles */
+	MWCOORD		diff;		/* difference in coordinates */
+	BOOL		toomany;	/* TRUE if too many clip rects */
+	PRECT		prc;		/* client or window rectangle*/
+	MWCLIPRECT	cliprects[MAX_CLIPRECTS];	/* clip rectangles */
+
+	if (wp->unmapcount)
+		return;
+
+	/*
+	 * Start with the rectangle for the complete window.
+	 * We will then cut pieces out of it as needed.
+	 */
+	prc = MwIsClientDC(hdc)? &wp->clirect: &wp->winrect;
+	count = 1;
+	clip = cliprects;
+	clip->x = prc->left;
+	clip->y = prc->top;
+	clip->width = prc->right - prc->left;
+	clip->height = prc->bottom - prc->top;
+
+	/*
+	 * First walk upwards through all parent windows,
+	 * and restrict the visible part of this window to the part
+	 * that shows through all of those parent windows client areas.
+	 */
+	pwp = wp;
+	while (pwp != rootwp) {
+		pwp = pwp->parent;
+
+		diff = pwp->clirect.left - clip->x;
+		if (diff > 0) {
+			clip->width -= diff;
+			clip->x = pwp->clirect.left;
+		}
+
+		diff = pwp->clirect.right - (clip->x + clip->width);
+		if (diff < 0)
+			clip->width += diff;
+
+		diff = pwp->clirect.top - clip->y;
+		if (diff > 0) {
+			clip->height -= diff;
+			clip->y = pwp->clirect.top;
+		}
+
+		diff = pwp->clirect.bottom - (clip->y + clip->height);
+		if (diff < 0)
+			clip->height += diff;
+	}
+
+	/*
+	 * If the window is completely clipped out of view, then
+	 * set the clipping region to indicate that.
+	 */
+	if (clip->width <= 0 || clip->height <= 0) {
+		GdSetClipRects(hdc->psd, 1, cliprects);
+		return;
+	} 
+
+	/*
+	 * Now examine all windows that obscure this window, and
+	 * for each obscuration, break up the clip rectangles into
+	 * the smaller pieces that are still visible.  The windows
+	 * that can obscure us are the earlier siblings of all of
+	 * our parents. When clipping the root window, search all children.
+ 	 */
+	toomany = FALSE;
+	pwp = wp;
+	while (pwp != NULL) {
+		wp = pwp;
+		pwp = wp->parent;
+		if(!pwp) {
+			/* We're clipping the root window*/
+			if(hdc->flags & DCX_CLIPCHILDREN)
+				/* start with root's children*/
+				sibwp = rootwp->children;
+			else sibwp = NULL;	/* no search*/
+			wp = NULL;		/* search all root's children*/
+		} else {
+			if(hdc->flags & DCX_CLIPSIBLINGS)
+				sibwp = pwp->children;
+			else sibwp = wp;	/* no search*/
+		}
+		for (; sibwp != wp; sibwp = sibwp->siblings) {
+			if (sibwp->unmapcount)
+				continue;
+
+			toomany |= MwExcludeClipRect(sibwp->winrect.left,
+				sibwp->winrect.top, sibwp->winrect.right-1,
+				sibwp->winrect.bottom-1, &count, cliprects);
+
+		}
+
+		/* if not clipping the root window, stop when you reach it*/
+		if(pwp == rootwp)
+			break;
+	}
+
+	/*
+	 * If not the root window and we're going to be drawing
+	 * in the client area, clip all children.  This is
+	 * required for non-special paint handling for child windows.
+	 * Non-client dc's don't clip children in order to get
+	 * proper border clipping in the case of border-clipped children.
+	 */
+	wp = hdc->hwnd;
+	if(wp != rootwp && MwIsClientDC(hdc)) {
+		for (sibwp=wp->children; sibwp; sibwp = sibwp->siblings) {
+			if (sibwp->unmapcount)
+				continue;
+
+			toomany |= MwExcludeClipRect(sibwp->winrect.left,
+				sibwp->winrect.top, sibwp->winrect.right-1,
+				sibwp->winrect.bottom-1, &count, cliprects);
+		}
+	}
+
+	if (toomany) {
+		/*GsError(GR_ERROR_TOO_MUCH_CLIPPING, wp->id);*/
+		clip->x = 0;
+		clip->y = 0;
+		clip->width = -1;
+		clip->height = -1;
+		count = 1;
+	}
+
+	/*
+	 * Set the clip rectangles.
+	 */
+	GdSetClipRects(hdc->psd, count, cliprects);
+}
+
+static BOOL
+MwExcludeClipRect(int minx,int miny,int maxx,int maxy,int *count,
+	MWCLIPRECT *cliprects)
+{
+	int	i;		/* current index */
+	int	newcount;	/* number of new rectangles */
+	BOOL	toomany = FALSE;/* TRUE if too many clip rects */
+
+	newcount = *count;
+	for (i = 0; i < *count; i++) {
+		if (newcount > MAX_CLIPRECTS - 3) {
+			toomany = TRUE;
+			break;
+		}
+		newcount += MwSplitClipRect(&cliprects[i],
+			&cliprects[newcount],
+			minx, miny, maxx, maxy);
+	}
+	*count = newcount;
+	return toomany;
+}
+
+/*
+ * Check the specified clip rectangle against the specified rectangular
+ * region, and reduce it or split it up into multiple clip rectangles
+ * such that the specified region is not contained in any of the clip
+ * rectangles.  The source clip rectangle can be modified in place, and
+ * in addition more clip rectangles can be generated, which are placed in
+ * the indicated destination location.  The maximum number of new clip
+ * rectangles needed is 3.  Returns the number of clip rectangles added.
+ * If the source clip rectangle is totally obliterated, it is set to an
+ * impossible region and 0 is returned.  When splits are done, we prefer
+ * to create wide regions instead of high regions.
+ */
+static int
+MwSplitClipRect(MWCLIPRECT *srcrect, MWCLIPRECT *destrect, MWCOORD minx,
+	MWCOORD miny, MWCOORD maxx, MWCOORD maxy)
+{
+	MWCOORD		x;
+	MWCOORD		y;
+	MWCOORD		width;
+	MWCOORD		height;
+	MWCOORD		dx;
+	MWCOORD		dy;
+	int		gaps;
+
+	/*
+	 * First see if there is any overlap at all.
+	 * If not, then nothing to do.
+	 */
+	x = srcrect->x;
+	y = srcrect->y;
+	width = srcrect->width;
+	height = srcrect->height;
+
+	if ((minx > maxx) || (miny > maxy) || (maxx < x) || (maxy < y) ||
+		(x + width <= minx) || (y + height <= miny))
+			return 0;
+
+	/*
+	 * There is an overlap.  Calculate a value to differentiate
+	 * various cases, and then handle each case separately.  The
+	 * cases are classified on whether there are gaps on the left,
+	 * right, top, and bottom sides of the clip rectangle.
+	 */
+	gaps = 0;
+	if (x < minx)
+		gaps |= GAPVAL(1, 0, 0, 0);
+	if (x + width - 1 > maxx)
+		gaps |= GAPVAL(0, 1, 0, 0);
+	if (y < miny)
+		gaps |= GAPVAL(0, 0, 1, 0);
+	if (y + height - 1 > maxy)
+		gaps |= GAPVAL(0, 0, 0, 1);
+
+	switch (gaps) {
+		case GAPVAL(0, 0, 0, 0):	/* no gaps at all */
+			srcrect->x = 0;
+			srcrect->y = 0;
+			srcrect->width = 0;
+			srcrect->height = 0;
+			return 0;
+
+		case GAPVAL(0, 0, 0, 1):	/* gap on bottom */
+			dy = maxy - y + 1;
+			srcrect->y += dy;
+			srcrect->height -= dy;
+			return 0;
+
+		case GAPVAL(0, 0, 1, 0):	/* gap on top */
+			srcrect->height = miny - y;
+			return 0;
+
+		case GAPVAL(0, 0, 1, 1):	/* gap on top, bottom */
+			srcrect->height = miny - y;
+			destrect->x = x;
+			destrect->width = width;
+			destrect->y = maxy + 1;
+			destrect->height = y + height - maxy - 1;
+			return 1;
+
+		case GAPVAL(0, 1, 0, 0):	/* gap on right */
+			dx = maxx - x + 1;
+			srcrect->x += dx;
+			srcrect->width -= dx;
+			return 0;
+
+		case GAPVAL(0, 1, 0, 1):	/* gap on right, bottom */
+			dx = maxx - x + 1;
+			srcrect->x += dx;
+			srcrect->width -= dx;
+			srcrect->height = maxy - y + 1;
+			destrect->x = x;
+			destrect->width = width;
+			destrect->y = maxy + 1;
+			destrect->height = y + height - maxy - 1;
+			return 1;
+
+		case GAPVAL(0, 1, 1, 0):	/* gap on right, top */
+			dx = maxx - x + 1;
+			srcrect->height = miny - y;
+			destrect->x = x + dx;
+			destrect->width = width - dx;
+			destrect->y = miny;
+			destrect->height = y + height - miny;
+			return 1;
+
+		case GAPVAL(0, 1, 1, 1):	/* gap on right, top, bottom */
+			dx = maxx - x + 1;
+			srcrect->height = miny - y;
+			destrect->x = x;
+			destrect->width = width;
+			destrect->y = maxy + 1;
+			destrect->height = y + height - maxy - 1;
+			destrect++;
+			destrect->x = x + dx;
+			destrect->width = width - dx;
+			destrect->y = miny;
+			destrect->height = maxy - miny + 1;
+			return 2;
+
+		case GAPVAL(1, 0, 0, 0):	/* gap on left */
+			srcrect->width = minx - x;
+			return 0;
+
+		case GAPVAL(1, 0, 0, 1):	/* gap on left, bottom */
+			srcrect->width = minx - x;
+			srcrect->height = maxy - y + 1;
+			destrect->x = x;
+			destrect->width = width;
+			destrect->y = maxy + 1;
+			destrect->height = y + height - maxy - 1;
+			return 1;
+
+		case GAPVAL(1, 0, 1, 0):	/* gap on left, top */
+			srcrect->height = miny - y;
+			destrect->x = x;
+			destrect->width = minx - x;
+			destrect->y = miny;
+			destrect->height = y + height - miny;
+			return 1;
+
+		case GAPVAL(1, 0, 1, 1):	/* gap on left, top, bottom */
+			srcrect->height = miny - y;
+			destrect->x = x;
+			destrect->width = minx - x;
+			destrect->y = miny;
+			destrect->height = maxy - miny + 1;
+			destrect++;
+			destrect->x = x;
+			destrect->width = width;
+			destrect->y = maxy + 1;
+			destrect->height = y + height - maxy - 1;
+			return 2;
+
+		case GAPVAL(1, 1, 0, 0):	/* gap on left, right */
+			destrect->x = maxx + 1;
+			destrect->width = x + width - maxx - 1;
+			destrect->y = y;
+			destrect->height = height;
+			srcrect->width = minx - x;
+			return 1;
+
+		case GAPVAL(1, 1, 0, 1):	/* gap on left, right, bottom */
+			dy = maxy - y + 1;
+			srcrect->y += dy;
+			srcrect->height -= dy;
+			destrect->x = x;
+			destrect->width = minx - x;
+			destrect->y = y;
+			destrect->height = dy;
+			destrect++;
+			destrect->x = maxx + 1;
+			destrect->width = x + width - maxx - 1;
+			destrect->y = y;
+			destrect->height = dy;
+			return 2;
+
+		case GAPVAL(1, 1, 1, 0):	/* gap on left, right, top */
+			srcrect->height = miny - y;
+			destrect->x = x;
+			destrect->width = minx - x;
+			destrect->y = miny;
+			destrect->height = y + height - miny;
+			destrect++;
+			destrect->x = maxx + 1;
+			destrect->width = x + width - maxx - 1;
+			destrect->y = miny;
+			destrect->height = y + height - miny;
+			return 2;
+
+		case GAPVAL(1, 1, 1, 1):	/* gap on all sides */
+			srcrect->height = miny - y;
+			destrect->x = x;
+			destrect->width = minx - x;
+			destrect->y = miny;
+			destrect->height = maxy - miny + 1;
+			destrect++;
+			destrect->x = maxx + 1;
+			destrect->width = x + width - maxx - 1;
+			destrect->y = miny;
+			destrect->height = maxy - miny + 1;
+			destrect++;
+			destrect->x = x;
+			destrect->width = width;
+			destrect->y = maxy + 1;
+			destrect->height = y + height - maxy - 1;
+			return 3;
+	}
+	return 0; /* NOTREACHED */
+}
diff -urN lib/microwindows/src/mwin/winclip2.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winclip2.c
--- lib/microwindows/src/mwin/winclip2.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winclip2.c	2005-02-21 16:03:42.000000000 +0100
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * DYNAMICREGIONS MwSetClipWindow
+ */
+#include "windows.h"
+#include "wintern.h"
+
+/*
+ * Set the clip rectangles for a window taking into account other
+ * windows that may be obscuring it.  The windows that may be obscuring
+ * this one are the siblings of each direct ancestor which are higher
+ * in priority than those ancestors.  Also, each parent limits the visible
+ * area of the window.
+ */
+void
+MwSetClipWindow(HDC hdc)
+{
+	HWND		wp = hdc->hwnd;
+	HWND		pwp;		/* parent window */
+	HWND		sibwp;		/* sibling windows */
+	MWCOORD		diff;		/* difference in coordinates */
+	PRECT		prc;		/* client or window rectangle*/
+	MWCLIPREGION	*vis, *r;
+	MWCOORD		x, y, width, height;
+
+	/*
+	 * Start with the rectangle for the complete window.
+	 * We will then cut pieces out of it as needed.
+	 */
+	prc = MwIsClientDC(hdc)? &wp->clirect: &wp->winrect;
+	x = prc->left;
+	y = prc->top;
+	width = prc->right - prc->left;
+	height = prc->bottom - prc->top;
+
+	/*
+	 * First walk upwards through all parent windows,
+	 * and restrict the visible part of this window to the part
+	 * that shows through all of those parent windows client areas.
+	 */
+	pwp = wp;
+	while (pwp != rootwp) {
+		pwp = pwp->parent;
+
+		diff = pwp->clirect.left - x;
+		if (diff > 0) {
+			width -= diff;
+			x = pwp->clirect.left;
+		}
+
+		diff = pwp->clirect.right - (x + width);
+		if (diff < 0)
+			width += diff;
+
+		diff = pwp->clirect.top - y;
+		if (diff > 0) {
+			height -= diff;
+			y = pwp->clirect.top;
+		}
+
+		diff = pwp->clirect.bottom - (y + height);
+		if (diff < 0)
+			height += diff;
+	}
+
+	/*
+	 * If the window is completely clipped out of view, then
+	 * set the clipping region to indicate that.
+	 */
+	if (width <= 0 || height <= 0) {
+		GdSetClipRegion(hdc->psd, NULL);
+		return;
+	} 
+
+	/*
+	 * Allocate initial vis region to parent-clipped size of window
+	 */
+	vis = GdAllocRectRegion(x, y, x+width, y+height);
+
+	/* 
+	 * Allocate temp region
+	 */
+	r = GdAllocRegion();
+
+	/*
+	 * Now examine all windows that obscure this window, and
+	 * for each obscuration, break up the clip rectangles into
+	 * the smaller pieces that are still visible.  The windows
+	 * that can obscure us are the earlier siblings of all of
+	 * our parents. When clipping the root window, search all children.
+ 	 */
+	pwp = wp;
+	while (pwp != NULL) {
+		wp = pwp;
+		pwp = wp->parent;
+		if(!pwp) {
+			/* We're clipping the root window*/
+			if(hdc->flags & DCX_CLIPCHILDREN)
+				/* start with root's children*/
+				sibwp = rootwp->children;
+			else sibwp = NULL;	/* no search*/
+			wp = NULL;		/* search all root's children*/
+		} else {
+			if(hdc->flags & DCX_CLIPSIBLINGS)
+				sibwp = pwp->children;
+			else sibwp = wp;	/* no search*/
+		}
+		for (; sibwp != wp; sibwp = sibwp->siblings) {
+			if (sibwp->unmapcount)
+				continue;
+
+			GdSetRectRegionIndirect(r, &sibwp->winrect);
+			GdSubtractRegion(vis, vis, r);
+		}
+
+		/* if not clipping the root window, stop when you reach it*/
+		if(pwp == rootwp)
+			break;
+	}
+
+	/*
+	 * If not the root window and we're going to be drawing
+	 * in the client area, clip all children.  This is
+	 * required for non-special paint handling for child windows.
+	 * Non-client dc's don't clip children in order to get
+	 * proper border clipping in the case of border-clipped children.
+	 */
+	wp = hdc->hwnd;
+	if(wp != rootwp && MwIsClientDC(hdc)) {
+		for (sibwp=wp->children; sibwp; sibwp = sibwp->siblings) {
+			if (sibwp->unmapcount)
+				continue;
+
+			GdSetRectRegionIndirect(r, &sibwp->winrect);
+			GdSubtractRegion(vis, vis, r);
+		}
+	}
+
+#if UPDATEREGIONS
+	/*
+	 * Intersect with update region, unless requested not to.
+	 */
+	if(!(hdc->flags & DCX_EXCLUDEUPDATE))
+		GdIntersectRegion(vis, vis, wp->update);
+#endif
+	/*
+	 * Intersect with user region, if set.
+	 */
+	if (hdc->region)
+		GdIntersectRegion(vis, vis, hdc->region->rgn);
+	/*
+	 * Set the clip region (later destroy handled by GdSetClipRegion)
+	 */
+	GdSetClipRegion(hdc->psd, vis);
+
+	/*
+	 * Destroy temp region
+	 */
+	GdDestroyRegion(r);
+}
diff -urN lib/microwindows/src/mwin/windefw.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/windefw.c
--- lib/microwindows/src/mwin/windefw.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/windefw.c	2005-02-21 16:13:28.000000000 +0100
@@ -0,0 +1,402 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * DefWindowProc implementation for Micro-Windows
+ *	This file should ideally only include windows.h, and be built
+ *	on top of regular win32 api calls.  For speed, however,
+ *	certain knowledge of the internal hwnd is known...
+ */
+#include "windows.h"
+#include "wintern.h"
+#include "device.h"
+#include "wintools.h"		/* Draw3dBox, etc*/
+#include <string.h>
+
+/* desktop wallpaper image*/
+static PMWIMAGEHDR	pImageWallpaper = NULL;
+
+/* local routines*/
+static void	GetCloseBoxRect(HWND hwnd, LPRECT lprc);
+static void	DrawXORFrame(HWND hwnd,int x, int y, BOOL bDrawCurrent);
+static RECT	lastrc;
+
+BOOL
+MwSetDesktopWallpaper(PMWIMAGEHDR pImage)
+{
+	pImageWallpaper = pImage;
+	InvalidateRect(rootwp, NULL, TRUE);
+	return TRUE;
+}
+
+/* needed only for XORMOVE repaint algorithm*/
+static void
+DrawXORFrame(HWND hwnd,int x, int y, BOOL bDrawCurrent)
+{
+	HDC	hdc;
+	RECT	rc;
+
+	hdc = GetDCEx(NULL, NULL, DCX_WINDOW|DCX_EXCLUDEUPDATE);
+	SelectObject(hdc, GetStockObject(NULL_BRUSH));
+	SelectObject(hdc, GetStockObject(WHITE_PEN));
+	GdSetMode(MWMODE_XOR);
+	if(!IsRectEmpty(&lastrc))
+		Rectangle(hdc, lastrc.left, lastrc.top, lastrc.right,
+			lastrc.bottom);
+	GetWindowRect(hwnd, &rc);
+	SetRect(&lastrc, rc.left+x, rc.top+y, rc.right+x, rc.bottom+y);
+	if(bDrawCurrent)
+		Rectangle(hdc, lastrc.left, lastrc.top, lastrc.right,
+			lastrc.bottom);
+	ReleaseDC(NULL, hdc);
+	GdSetMode(MWMODE_SET);
+}
+
+/*
+ * This procedure implements the messages passed by the window
+ * manager for default processing on behalf of the window.
+ */
+LRESULT WINAPI
+DefWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+	HDC		hdc;
+	RECT		rc;
+	DWORD		dwStyle;
+	HBRUSH		hbr;
+	HPEN		hpen, holdpen;
+	PAINTSTRUCT	ps;
+	POINT		curpt;
+	int 		x, y;
+	HWND		wp;
+	HWND		oldActive;
+	COLORREF	crCaption;
+	LPNCCALCSIZE_PARAMS lpnc;
+	CHAR		szTitle[64];
+	static POINT 	startpt;
+
+	switch(msg) {
+	case WM_NCCALCSIZE:
+		/* calculate client rect from passed window rect in rgrc[0]*/
+		lpnc = (LPNCCALCSIZE_PARAMS)lParam;
+		dwStyle = GetWindowLong(hwnd, GWL_STYLE);
+		if(dwStyle & WS_BORDER) {
+			if((dwStyle & WS_CAPTION) == WS_CAPTION) {
+				InflateRect(&lpnc->rgrc[0],
+					-mwSYSMETRICS_CXFRAME,
+					-mwSYSMETRICS_CYFRAME);
+				lpnc->rgrc[0].top += mwSYSMETRICS_CYCAPTION + 1;
+			} else
+				InflateRect(&lpnc->rgrc[0], -1, -1);
+		}
+		break;
+
+	case WM_NCPAINT:
+		/* repaint all non-client area*/
+		dwStyle = GetWindowLong(hwnd, GWL_STYLE);
+
+		if(dwStyle & WS_BORDER) {
+			hdc = GetWindowDC(hwnd);
+			GetWindowRect(hwnd, &rc);
+
+			if((dwStyle & WS_CAPTION) == WS_CAPTION) {
+				/* draw 2-line 3d border around window*/
+				Draw3dOutset(hdc, rc.left, rc.top,
+					rc.right-rc.left, rc.bottom-rc.top);
+				InflateRect(&rc, -2, -2);
+
+				/* draw 1-line inset inside border*/
+				hpen = CreatePen(PS_SOLID, 1,
+					GetSysColor(COLOR_BTNFACE));
+				holdpen = SelectObject(hdc, hpen);
+				SelectObject(hdc, GetStockObject(NULL_BRUSH));
+				Rectangle(hdc, rc.left, rc.top, rc.right,
+					rc.bottom);
+				InflateRect(&rc, -1, -1);
+
+				/* fill caption*/
+				rc.bottom = rc.top + mwSYSMETRICS_CYCAPTION;
+				crCaption = GetActiveWindow()==hwnd?
+					GetSysColor(COLOR_ACTIVECAPTION):
+					GetSysColor(COLOR_INACTIVECAPTION);
+				hbr = CreateSolidBrush(crCaption);
+				FillRect(hdc, &rc, hbr);
+				DeleteObject(hbr);
+
+				/* draw 1 line under caption*/
+				MoveToEx(hdc, rc.left, rc.bottom, NULL);
+				LineTo(hdc, rc.right, rc.bottom);
+				DeleteObject(SelectObject(hdc, holdpen));
+
+				/* draw caption text*/
+				if(GetWindowText(hwnd, szTitle,
+				   sizeof(szTitle))) {
+					SetBkMode(hdc, TRANSPARENT);
+					/* set background color even though
+					 * transparent in case GdArea is used
+					 * to draw text which compares
+					 * gr_foreground != gr_background
+					 * when transparent...
+					 */
+					SetBkColor(hdc, crCaption);
+					SetTextColor(hdc,
+						GetActiveWindow()==hwnd?
+						GetSysColor(COLOR_CAPTIONTEXT):
+						GetSysColor(COLOR_INACTIVECAPTIONTEXT));
+					SelectObject(hdc,
+					    GetStockObject(DEFAULT_GUI_FONT));
+					GetWindowRect(hwnd, &rc);
+					TextOut(hdc, rc.left+4, rc.top+2,
+						szTitle, strlen(szTitle));
+				}
+
+				/* draw close box*/
+				GetCloseBoxRect(hwnd, &rc);
+				/*DrawDIB(hdc, rc.right-XSIZE_CLOSEBOX-3,
+					rc.top+3, &image_close4);*/
+				Draw3dBox(hdc, rc.left, rc.top,
+					rc.right-rc.left, rc.bottom-rc.top,
+					GetSysColor(COLOR_BTNHIGHLIGHT),
+					GetSysColor(COLOR_WINDOWFRAME));
+				InflateRect(&rc, -1, -1);
+				hbr = CreateSolidBrush(
+					GetSysColor(COLOR_BTNFACE));
+				FillRect(hdc, &rc, hbr);
+				DeleteObject(hbr);
+
+				InflateRect(&rc, -1, -1);
+				MoveToEx(hdc, rc.left, rc.top, NULL);
+				LineTo(hdc, rc.right-1, rc.bottom-1);
+				MoveToEx(hdc, rc.left, rc.bottom-1, NULL);
+				LineTo(hdc, rc.right-1, rc.top);
+			} else {
+				SelectObject(hdc, GetStockObject(NULL_BRUSH));
+				Rectangle(hdc, rc.left, rc.top, rc.right,
+					rc.bottom);
+			}
+			ReleaseDC(hwnd, hdc);
+		}
+		break;
+
+	case WM_NCHITTEST:
+		/* if system is dragging a window, always return caption*/
+		if(dragwp)
+			return HTCAPTION;
+
+		/* Determine what part of the window the mouse is over*/
+		POINTSTOPOINT(curpt, lParam);
+
+		if(PtInRect(&hwnd->clirect, curpt))
+			return HTCLIENT;
+
+		if(PtInRect(&hwnd->vscroll.rc, curpt))
+			return HTVSCROLL;
+		if(PtInRect(&hwnd->hscroll.rc, curpt))
+			return HTHSCROLL; 
+
+		dwStyle = GetWindowLong(hwnd, GWL_STYLE);
+		if((dwStyle & WS_CAPTION) == WS_CAPTION) {
+			GetCloseBoxRect(hwnd, &rc);
+			if(PtInRect(&rc, curpt))
+				return HTCLOSE;
+
+			GetWindowRect(hwnd, &rc);
+			InflateRect(&rc, -2, -2);
+			rc.bottom = rc.top + mwSYSMETRICS_CYCAPTION;
+			if(PtInRect(&rc, curpt))
+				return HTCAPTION;
+
+			GetWindowRect(hwnd, &rc);
+			InflateRect(&rc, -2, -2);
+			rc.top += mwSYSMETRICS_CYCAPTION;
+			if(PtInRect(&rc, curpt))
+				return HTCLIENT;
+
+			return HTBORDER;
+		}
+		return HTNOWHERE;
+
+	case WM_NCLBUTTONDOWN:
+		/* Handle default actions for mouse down on window*/
+		if(wParam == HTCLOSE) {
+			SendMessage(hwnd, WM_CLOSE, 0, 0L);
+			break;
+		}
+
+		/* set focus on mouse down, repaint if necessary*/
+		oldActive = GetActiveWindow();
+		if(wParam == HTCLIENT || wParam == HTVSCROLL ||
+		   wParam == HTHSCROLL)
+			/* activate and raise window if in client area*/
+			/* kaffe port requires this commented out*/
+			SetForegroundWindow(hwnd);
+		else {
+			/* otherwise just change focus window, same z order*/
+			/* this will activate it's top level parent*/
+			SetFocus(hwnd);
+		}
+		/* repaint captions now because of activation change*/
+		UpdateWindow(oldActive);
+		UpdateWindow(hwnd);
+
+		if(wParam == HTVSCROLL || wParam == HTHSCROLL) {
+			MwHandleNCMessageScrollbar(hwnd, msg, wParam, lParam);
+			break;
+		}
+
+		/* start window drag if in caption area*/
+		if(wParam == HTCAPTION && hwnd != rootwp) {
+			POINTSTOPOINT(startpt, lParam);
+			if(!(GetWindowLong(hwnd, GWL_STYLE) & WS_MAXIMIZE))
+				dragwp = hwnd;
+			SetRectEmpty(&lastrc);	/* XORMOVE only*/
+		}
+		break;
+
+	case WM_NCMOUSEMOVE:
+		if(wParam == HTVSCROLL || wParam == HTHSCROLL) {
+			MwHandleNCMessageScrollbar(hwnd, msg, wParam, lParam);
+			break;
+		}
+
+		/* drag window with mousemove after mousedown*/
+		if(dragwp == hwnd) {
+			POINTSTOPOINT(curpt, lParam);
+			x = curpt.x - startpt.x;
+			y = curpt.y - startpt.y;
+
+			if(mwERASEMOVE) {
+				GetWindowRect(hwnd, &rc);
+				MoveWindow(hwnd, rc.left+x, rc.top+y,
+					rc.right-rc.left, rc.bottom-rc.top,
+					TRUE);
+				startpt = curpt;
+			} else
+				DrawXORFrame(hwnd, x, y, TRUE);
+		}
+		break;
+
+	case WM_NCLBUTTONUP:
+		/* stop window drag*/
+		if(dragwp == hwnd) {
+			dragwp = NULL;
+
+			if(mwERASEMOVE) {
+				/*
+				 * User stopped moving window, repaint 
+				 * windows previously queued for painting.
+				 */
+				for(wp=listwp; wp; wp=wp->next)
+					if(wp->gotPaintMsg == PAINT_DELAYPAINT)
+					    wp->gotPaintMsg = PAINT_NEEDSPAINT;
+			} else {
+				POINTSTOPOINT(curpt, lParam);
+				x = curpt.x - startpt.x;
+				y = curpt.y - startpt.y;
+				DrawXORFrame(hwnd, x, y, FALSE);
+				GetWindowRect(hwnd, &rc);
+				MoveWindow(hwnd, rc.left+x, rc.top+y,
+				    rc.right-rc.left, rc.bottom-rc.top, TRUE);
+			}
+		}
+
+		if(wParam == HTVSCROLL || wParam == HTHSCROLL) {
+			MwHandleNCMessageScrollbar(hwnd, msg, wParam, lParam);
+			break;
+		}
+		break;
+
+	case WM_NCLBUTTONDBLCLK:
+		if(wParam == HTVSCROLL || wParam == HTHSCROLL) {
+			MwHandleNCMessageScrollbar(hwnd, msg, wParam, lParam);
+			break;
+		}
+
+		/* maximize/restore processing*/
+		if(wParam != HTCAPTION)
+			break;
+
+		if((hwnd->style & WS_CAPTION) == WS_CAPTION) {
+			if(hwnd->style & WS_MAXIMIZE) {
+				rc = hwnd->restorerc;
+				MoveWindow(hwnd, rc.left, rc.top,
+					rc.right-rc.left, rc.bottom-rc.top,
+					TRUE);
+				hwnd->style &= ~WS_MAXIMIZE;
+			} else {
+				hwnd->restorerc = hwnd->winrect;
+				GetWindowRect(rootwp, &rc);
+				MoveWindow(hwnd, -mwSYSMETRICS_CXFRAME,
+					-mwSYSMETRICS_CYFRAME,
+					rc.right+2*mwSYSMETRICS_CXFRAME,
+					rc.bottom+2*mwSYSMETRICS_CYFRAME, TRUE);
+				hwnd->style |= WS_MAXIMIZE;
+			}
+		}
+		break;
+
+	case WM_GETTEXTLENGTH:
+		/* Get window text length.  This routine requires
+		 * knowledge of the internal window structure
+		 */
+		return strlen(hwnd->szTitle);
+
+	case WM_GETTEXT:
+		/* Get window text.  This routine requires
+		 * knowledge of the internal window structure
+		 */
+		return strzcpy((LPSTR)lParam, hwnd->szTitle, wParam);
+
+	case WM_SETTEXT:
+		/* Set window text.  This routine requires
+		 * knowledge of the internal window structure.
+		 * Note that setting text doesn't invalidate the window.
+		 */
+		strzcpy(hwnd->szTitle, (LPSTR)lParam, sizeof(hwnd->szTitle));
+		return TRUE;
+
+	case WM_CLOSE:
+		DestroyWindow(hwnd);
+		if(hwnd == rootwp)
+			PostQuitMessage(0);
+		break;
+
+	case WM_ERASEBKGND:
+		/* erase background with class background brush*/
+		hbr = (HBRUSH)GetClassLong(hwnd, GCL_HBRBACKGROUND);
+		if(!hbr)
+			return 0;
+		/* don't exclude update region*/
+		hdc = GetDCEx(hwnd, NULL, DCX_DEFAULTCLIP);
+		FillRect(hdc, NULL, hbr);
+		ReleaseDC(hwnd, hdc);
+		return 1;
+
+	case WM_PAINT:
+		/* required to send erasebkgnd for desktop window*/
+		hdc = BeginPaint(hwnd, &ps);
+
+		/* draw desktop wallpaper*/
+		if(hwnd == rootwp && pImageWallpaper) {
+			GetWindowRect(hwnd, &rc);
+			DrawDIB(hdc,
+				(rc.right-rc.left-pImageWallpaper->width)/2,
+				(rc.bottom-rc.top-pImageWallpaper->height)/2,
+				pImageWallpaper);
+		}
+
+		EndPaint(hwnd, &ps);
+		break;
+	}
+	return 0;
+}
+
+static void
+GetCloseBoxRect(HWND hwnd, LPRECT lprc)
+{
+#define XSIZE_CLOSEBOX	9
+#define YSIZE_CLOSEBOX	9
+	GetWindowRect(hwnd, lprc);
+	lprc->left = lprc->right - XSIZE_CLOSEBOX - 5;
+	lprc->top = lprc->top + 5;
+	lprc->right = lprc->left + XSIZE_CLOSEBOX;
+	lprc->bottom = lprc->top + YSIZE_CLOSEBOX;
+}
diff -urN lib/microwindows/src/mwin/winevent.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winevent.c
--- lib/microwindows/src/mwin/winevent.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winevent.c	2005-02-21 16:13:28.000000000 +0100
@@ -0,0 +1,392 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Graphics server event routines for windows.
+ */
+#include "windows.h"
+#include "wintern.h"
+#include "device.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !(DOS_TURBOC | DOS_QUICKC | _MINIX | VXWORKS)
+static int
+abs(int n)
+{
+	return n >= 0? n: -n;
+}
+#endif
+
+/*
+ * Update mouse status and issue events on it if necessary.
+ * This function doesn't block, but is normally only called when
+ * there is known to be some data waiting to be read from the mouse.
+ */
+BOOL
+MwCheckMouseEvent(void)
+{
+	MWCOORD		rootx;		/* latest mouse x position */
+	MWCOORD		rooty;		/* latest mouse y position */
+	int		newbuttons;	/* latest buttons */
+	int		mousestatus;	/* latest mouse status */
+
+	/* Read the latest mouse status: */
+	mousestatus = GdReadMouse(&rootx, &rooty, &newbuttons);
+	if(mousestatus < 0) {
+		/*MwError(GR_ERROR_MOUSE_ERROR, 0);*/
+		return FALSE;
+	} else if(mousestatus) {	/* Deliver events as appropriate: */	
+		MwHandleMouseStatus(rootx, rooty, newbuttons);
+		return TRUE;
+	}
+	return FALSE;
+}
+
+/*
+ * Update keyboard status and issue events on it if necessary.
+ * This function doesn't block, but is normally only called when
+ * there is known to be some data waiting to be read from the keyboard.
+ */
+BOOL
+MwCheckKeyboardEvent(void)
+{
+	MWKEY	 	mwkey;		/* latest character */
+	MWKEYMOD 	modifiers;	/* latest modifiers */
+	MWSCANCODE	scancode;
+	int	 	keystatus;	/* latest keyboard status */
+
+	/* Read the latest keyboard status: */
+	keystatus = GdReadKeyboard(&mwkey, &modifiers, &scancode);
+	if(keystatus < 0) {
+		if(keystatus == -2)	/* special case for ESC pressed*/
+			MwTerminate();
+		/*MwError(GR_ERROR_KEYBOARD_ERROR, 0);*/
+		return FALSE;
+	} else if(keystatus) {		/* Deliver events as appropriate: */	
+		switch (mwkey) {
+		case MWKEY_QUIT:
+			MwTerminate();
+			/* no return*/
+		case MWKEY_REDRAW:
+			MwRedrawScreen();
+			break;
+		case MWKEY_PRINT:
+			GdCaptureScreen("file");
+			break;
+		}
+		MwDeliverKeyboardEvent(mwkey, modifiers, scancode,
+			keystatus==1? TRUE: FALSE);
+		return TRUE;
+	}
+	return FALSE;
+}
+
+/*
+ * Handle all mouse events.  These are mouse enter, mouse exit, mouse
+ * motion, mouse position, button down, and button up.  This also moves
+ * the cursor to the new mouse position and changes it shape if needed.
+ */
+void
+MwHandleMouseStatus(MWCOORD newx, MWCOORD newy, int newbuttons)
+{
+	int		changebuttons;	/* buttons that have changed */
+	MWKEYMOD	modifiers;	/* latest modifiers */
+	static int curbuttons;
+
+	GdGetModifierInfo(NULL, &modifiers); /* Read kbd modifiers */
+
+	/*
+	 * First, if the mouse has moved, then position the cursor to the
+	 * new location, which will send mouse enter, mouse exit, focus in,
+	 * and focus out events if needed.  Check here for mouse motion and
+	 * mouse position events.
+	 */
+	if (newx != cursorx || newy != cursory) {
+		MwMoveCursor(newx, newy);
+		MwDeliverMouseEvent(newbuttons, 0, modifiers);
+	}
+
+	/*
+	 * Next, generate a button up event if any buttons have been released.
+	 */
+	changebuttons = (curbuttons & ~newbuttons);
+	if (changebuttons)
+		MwDeliverMouseEvent(newbuttons, changebuttons, modifiers);
+
+	/*
+	 * Finally, generate a button down event if any buttons have been
+	 * pressed.
+	 */
+	changebuttons = (~curbuttons & newbuttons);
+	if (changebuttons)
+		MwDeliverMouseEvent(newbuttons, changebuttons, modifiers);
+
+	curbuttons = newbuttons;
+}
+
+/*
+ * Translate and deliver hardware mouse message to proper window.
+ */
+void
+MwTranslateMouseMessage(HWND hwnd,UINT msg,int hittest)
+{
+	POINT		pt;
+	DWORD		tick;
+	static UINT	lastmsg = 0;
+	static HWND	lasthwnd;
+	static DWORD	lasttick;
+	static int	lastx, lasty;
+
+	/* determine double click eligibility*/
+	if(msg == WM_LBUTTONDOWN || msg == WM_RBUTTONDOWN) {
+		tick = GetTickCount();
+		if((hwnd->pClass->style & CS_DBLCLKS) &&
+		    msg == lastmsg && hwnd == lasthwnd &&
+		    tick - lasttick < DBLCLICKSPEED &&
+		    abs(cursorx-lastx) < mwSYSMETRICS_CXDOUBLECLK &&
+		    abs(cursory-lasty) < mwSYSMETRICS_CYDOUBLECLK)
+			msg += (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN);
+		lastmsg = msg;
+		lasthwnd = hwnd;
+		lasttick = tick;
+		lastx = cursorx;
+		lasty = cursory;
+	}
+
+	/*
+	 * We always send nc mouse message
+	 * unlike Windows, for HTCLIENT default processing
+	 */
+	PostMessage(hwnd, msg + (WM_NCMOUSEMOVE-WM_MOUSEMOVE), hittest,
+		MAKELONG(cursorx, cursory));
+
+	/* then possibly send user mouse message*/
+	if(hittest == HTCLIENT) {
+		pt.x = cursorx;
+		pt.y = cursory;
+		ScreenToClient(hwnd, &pt);
+		PostMessage(hwnd, msg, 0, MAKELONG(pt.x, pt.y));
+	}
+}
+
+/*
+ * Deliver a mouse button or motion event.
+ */
+int mwCurrentButtons;
+
+void 
+MwDeliverMouseEvent(int buttons, int changebuttons, MWKEYMOD modifiers)
+{
+	HWND	hwnd;
+	int	hittest;
+	UINT	msg;
+
+	mwCurrentButtons = buttons;
+
+	hwnd = GetCapture();
+	if(!hwnd)
+		hwnd = mousewp;
+	hittest = SendMessage(hwnd, WM_NCHITTEST, 0, MAKELONG(cursorx,cursory));
+
+	if(!changebuttons)
+		MwTranslateMouseMessage(hwnd, WM_MOUSEMOVE, hittest);
+
+	if(changebuttons & MWBUTTON_L) {
+		msg = (buttons&MWBUTTON_L)? WM_LBUTTONDOWN: WM_LBUTTONUP;
+		MwTranslateMouseMessage(hwnd, msg, hittest);
+	}
+
+	if(changebuttons & MWBUTTON_M) {
+		msg = (buttons&MWBUTTON_M)? WM_MBUTTONDOWN: WM_MBUTTONUP;
+		MwTranslateMouseMessage(hwnd, msg, hittest);
+	}
+
+	if(changebuttons & MWBUTTON_R) {
+		msg = (buttons&MWBUTTON_R)? WM_RBUTTONDOWN: WM_RBUTTONUP;
+		MwTranslateMouseMessage(hwnd, msg, hittest);
+	}
+}
+
+/*
+ * Deliver a keyboard event.
+ */
+void
+MwDeliverKeyboardEvent(MWKEY keyvalue, MWKEYMOD modifiers, MWSCANCODE scancode,
+	BOOL pressed)
+{
+	/* FIXME no modifiers, must translate key values*/
+	if (pressed)
+		SendMessage(focuswp, WM_CHAR, (WPARAM)keyvalue, 0L);
+}
+
+/*
+ * Deliver a window expose event.
+ * Most of the work is in calculating the update region
+ * for better redraw look and feel, and then queuing a
+ * WM_PAINT message to the window.
+ */
+void
+MwDeliverExposureEvent(HWND wp, MWCOORD x, MWCOORD y, MWCOORD width,
+	MWCOORD height)
+{
+	if (wp->unmapcount)
+		return;
+
+	MwUnionUpdateRegion(wp, x, y, width, height, TRUE);
+	PostMessage(wp, WM_PAINT, 0, 0L);
+}
+
+/*
+ * Combine the passed rectangle with the update region for the given window.
+ * Coordinates are passed relative to window.
+ * If bUnion is TRUE, union the rectangle, otherwise subtract it.
+ */
+void
+MwUnionUpdateRegion(HWND wp, MWCOORD x, MWCOORD y, MWCOORD width,
+	MWCOORD height, BOOL bUnion)
+{
+#if UPDATEREGIONS
+	MWRECT rc;
+
+	if (wp->unmapcount)
+		return;
+
+	/* convert window relative coords to screen coords*/
+	rc.left = x + wp->winrect.left;
+	rc.top = y + wp->winrect.top;
+	rc.right = rc.left + width;
+	rc.bottom = rc.top + height;
+
+	if(bUnion)
+		GdUnionRectWithRegion(&rc, wp->update);
+	else
+		GdSubtractRectFromRegion(&rc, wp->update);
+#endif
+}
+
+/*
+ * Move the cursor to the specified absolute screen coordinates.
+ * The coordinates are that of the defined hot spot of the cursor.
+ * The cursor's appearance is changed to that defined for the window
+ * in which the cursor is moved to.  In addition, the window the
+ * cursor is in is recalculated.
+ */
+void MwMoveCursor(MWCOORD x, MWCOORD y)
+{
+	/*
+	 * Move the cursor only if necessary, offsetting it to
+	 * place the hot spot at the specified coordinates.
+	 */
+	if (x != cursorx || y != cursory) {
+		if(curcursor)
+			GdMoveCursor(x - curcursor->cursor.hotx,
+				y - curcursor->cursor.hoty);
+		cursorx = x;
+		cursory = y;
+	}
+
+	/*
+	 * Now check to see which window the mouse is in and whether or
+	 * not the cursor shape should be changed.
+	 */
+	MwCheckMouseWindow();
+	MwCheckCursor();
+}
+
+/*
+ * Check to see if the cursor shape is the correct shape for its current
+ * location.  If not, its shape is changed.
+ */
+void MwCheckCursor(void)
+{
+	HWND 		wp;		/* window cursor is in */
+	HCURSOR		cp;		/* cursor definition */
+
+	/*
+	 * Get the cursor at its current position, and if it is not the
+	 * currently defined one, then set the new cursor.  However,
+	 * if the window is currently captured, then leave it alone.
+	 */
+	wp = capturewp;
+	if (wp == NULL)
+		wp = mousewp;
+
+	cp = wp->cursor;
+	if (cp == curcursor)
+		return;
+
+	/*
+	 * It needs redefining, so do it.
+	 */
+	curcursor = cp;
+	GdMoveCursor(cursorx - cp->cursor.hotx, cursory - cp->cursor.hoty);
+	GdSetCursor(&cp->cursor);
+}
+
+/*
+ * Find the window which is currently visible for the specified coordinates.
+ * This just walks down the window tree looking for the deepest mapped
+ * window which contains the specified point.  If the coordinates are
+ * off the screen, the root window is returned.
+ */
+HWND
+MwFindVisibleWindow(MWCOORD x, MWCOORD y)
+{
+	HWND	wp;		/* current window */
+	HWND	retwp;		/* returned window */
+
+	wp = rootwp;
+	retwp = wp;
+	while (wp) {
+		if (!wp->unmapcount &&
+		    wp->winrect.left <= x && wp->winrect.top <= y &&
+		    wp->winrect.right > x && wp->winrect.bottom > y) {
+			retwp = wp;
+			wp = wp->children;
+			continue;
+		}
+		wp = wp->siblings;
+	}
+	return retwp;
+}
+
+/*
+ * Check to see if the window the mouse is currently in has changed.
+ */
+void MwCheckMouseWindow(void)
+{
+	HWND	wp;
+
+	/* Don't change if window drag or capture in progress*/
+	wp = dragwp;
+	if(!wp)
+		wp = capturewp;
+	if(!wp)
+		wp = MwFindVisibleWindow(cursorx, cursory);
+	mousewp = wp;
+}
+
+/*
+ *  Copy dstsiz bytes, including nul, from src to dst.
+ *  Return # bytes, excluding nul, copied.
+ */
+int
+strzcpy(char *dst,const char *src,int dstsiz)
+{
+	int	cc = dstsiz;
+
+	/* return 0 on NULL src*/
+	if(!src)
+		cc = dstsiz = 1;
+
+	while(--dstsiz > 0) {
+		if((*dst++ = *src++) == '\0')
+			return cc - dstsiz - 1;
+	}
+	*dst = 0;
+	return cc - dstsiz - 1;
+}
diff -urN lib/microwindows/src/mwin/winexpos.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winexpos.c
--- lib/microwindows/src/mwin/winexpos.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winexpos.c	2005-02-21 16:03:43.000000000 +0100
@@ -0,0 +1,369 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1991 David I. Bell
+ *
+ * Non-Win32 API helper routines for window showing/hiding/exposing
+ */
+#include "windows.h"
+#include "wintern.h"
+#include <stdlib.h>
+
+/* Redraw all windows*/
+void
+MwRedrawScreen(void)
+{
+	/* redraw all windows except desktop window*/
+	MwExposeArea(rootwp, 0, 0, rootwp->winrect.right,
+		rootwp->winrect.bottom);
+
+	/* redraw desktop window*/
+	PostMessage(rootwp, WM_PAINT, 0, 0L);
+}
+
+/*
+ * Hide the window to make it and its children invisible on the screen.
+ * This is a recursive routine which increments the unmapcount values for
+ * this window and all of its children, and causes exposure events for
+ * windows which are newly uncovered.
+ */
+void
+MwHideWindow(HWND hwnd,BOOL bChangeFocus, BOOL bSendMsg)
+{
+	HWND	wp = hwnd;
+	HWND	pwp;		/* parent window */
+	HWND	sibwp;		/* sibling window */
+	HWND	childwp;	/* child window */
+
+	if (wp == rootwp)
+		return;
+
+	++mwpaintNC;		/* experimental NC paint handling*/
+
+	/* send hide message if currently visible*/
+	if(bSendMsg && wp->unmapcount == 0)
+		SendMessage(wp, WM_SHOWWINDOW, FALSE, 0L);
+
+	wp->unmapcount++;
+
+	for (childwp = wp->children; childwp; childwp = childwp->siblings)
+		MwHideWindow(childwp, bChangeFocus, bSendMsg);
+
+	if (wp == mousewp) {
+		MwCheckMouseWindow();
+		MwCheckCursor();
+	}
+
+	if (bChangeFocus && wp == focuswp)
+		SetFocus(rootwp->children? rootwp->children: rootwp);
+
+	/*
+	 * If the parent window is still unmapped, then we are all done.
+	 */
+	if (wp->parent->unmapcount)
+		return;
+
+	/*
+	 * Clear the area in the parent for this window, causing an
+	 * exposure event for it.
+	 */
+	pwp = wp->parent;
+	MwClearWindow(pwp, wp->winrect.left - pwp->winrect.left,
+		wp->winrect.top - pwp->winrect.top,
+		wp->winrect.right - wp->winrect.left,
+		wp->winrect.bottom - wp->winrect.top, TRUE);
+
+	/*
+	 * Finally clear and redraw all parts of our lower sibling
+	 * windows that were covered by this window.
+	 */
+	sibwp = wp;
+	while (sibwp->siblings) {
+		sibwp = sibwp->siblings;
+		MwExposeArea(sibwp, wp->winrect.left, wp->winrect.top,
+			wp->winrect.right - wp->winrect.left,
+			wp->winrect.bottom - wp->winrect.top);
+	}
+}
+
+/*
+ * Map the window to possibly make it and its children visible on the screen.
+ * This is a recursive routine which decrements the unmapcount values for
+ * this window and all of its children, and causes exposure events for
+ * those windows which become visible.
+ */
+void
+MwShowWindow(HWND hwnd, BOOL bSendMsg)
+{
+	HWND	wp = hwnd;
+
+	if (wp == rootwp)
+		return;
+
+	++mwpaintNC;		/* experimental NC paint handling*/
+
+	if (wp->unmapcount)
+		wp->unmapcount--;
+
+	if (wp->unmapcount == 0) {
+		SendMessage(wp, WM_SHOWWINDOW, TRUE, 0L);
+		MwCheckMouseWindow();
+		MwCheckCursor();
+	}
+
+	/*
+	 * If the window just became visible,
+	 * then draw its border, clear it to the background color, and
+	 * generate an exposure event.
+	 */
+	if (wp->unmapcount == 0) {
+		/*MwDrawBorder(wp);*/
+		MwClearWindow(wp, 0, 0, wp->winrect.right - wp->winrect.left,
+			wp->winrect.bottom - wp->winrect.top, TRUE);
+	}
+
+	/*
+	 * Do the same thing for the children.
+	 */
+	for (wp = wp->children; wp; wp = wp->siblings)
+		MwShowWindow(wp, bSendMsg);
+}
+
+/*
+ * Raise a window to the highest level among its siblings.
+ */
+void
+MwRaiseWindow(HWND hwnd)
+{
+	HWND	wp = hwnd;
+	HWND	prevwp;
+	BOOL	overlap;
+
+	if (!wp || wp == rootwp)
+		return;
+
+	++mwpaintNC;		/* experimental NC paint handling*/
+
+	/*
+	 * If this is already the highest window then we are done.
+	 */
+	prevwp = wp->parent->children;
+	if (prevwp == wp)
+		return;
+
+	/*
+	 * Find the sibling just before this window so we can unlink it.
+	 * Also, determine if any sibling ahead of us overlaps the window.
+	 * Remember that for exposure events.
+	 */
+	overlap = FALSE;
+	while (prevwp->siblings != wp) {
+		overlap |= MwCheckOverlap(prevwp, wp);
+		prevwp = prevwp->siblings;
+	}
+	overlap |= MwCheckOverlap(prevwp, wp);
+
+	/*
+	 * Now unlink the window and relink it in at the front of the
+	 * sibling chain.
+	 */
+	prevwp->siblings = wp->siblings;
+	wp->siblings = wp->parent->children;
+	wp->parent->children = wp;
+
+	/*
+	 * Finally redraw the window if necessary.
+	 */
+	if (overlap) {
+		/*MwDrawBorder(wp);*/
+		MwExposeArea(wp, wp->winrect.left, wp->winrect.top,
+			wp->winrect.right - wp->winrect.left,
+			wp->winrect.bottom - wp->winrect.top);
+	}
+}
+
+/*
+ * Lower a window to the lowest level among its siblings.
+ */
+void
+MwLowerWindow(HWND hwnd)
+{
+	HWND	wp = hwnd;
+	HWND	prevwp;
+	HWND	sibwp;		/* sibling window */
+	HWND	expwp;		/* siblings being exposed */
+
+	if (!wp || wp == rootwp || !wp->siblings)
+		return;
+
+	++mwpaintNC;		/* experimental NC paint handling*/
+
+	/*
+	 * Find the sibling just before this window so we can unlink us.
+	 */
+	prevwp = wp->parent->children;
+	if (prevwp != wp) {
+		while (prevwp->siblings != wp)
+			prevwp = prevwp->siblings;
+	}
+
+	/*
+	 * Remember the first sibling that is after us, so we can
+	 * generate exposure events for the remaining siblings.  Then
+	 * walk down the sibling chain looking for the last sibling.
+	 */
+	expwp = wp->siblings;
+	sibwp = wp;
+	while (sibwp->siblings)
+		sibwp = sibwp->siblings;
+
+	/*
+	 * Now unlink the window and relink it in at the end of the
+	 * sibling chain.
+	 */
+	if (prevwp == wp)
+		wp->parent->children = wp->siblings;
+	else
+		prevwp->siblings = wp->siblings;
+	sibwp->siblings = wp;
+
+	wp->siblings = NULL;
+
+	/*
+	 * Finally redraw the sibling windows which this window covered
+	 * if they overlapped our window.
+	 */
+	while (expwp && (expwp != wp)) {
+		if (MwCheckOverlap(wp, expwp))
+			MwExposeArea(expwp, wp->winrect.left, wp->winrect.top,
+				wp->winrect.right - wp->winrect.left,
+				wp->winrect.bottom - wp->winrect.top);
+		expwp = expwp->siblings;
+	}
+}
+
+/*
+ * Check to see if the first window overlaps the second window.
+ */
+BOOL
+MwCheckOverlap(HWND topwp, HWND botwp)
+{
+	MWCOORD	minx1;
+	MWCOORD	miny1;
+	MWCOORD	maxx1;
+	MWCOORD	maxy1;
+	MWCOORD	minx2;
+	MWCOORD	miny2;
+	MWCOORD	maxx2;
+	MWCOORD	maxy2;
+
+	if (topwp->unmapcount || botwp->unmapcount)
+		return FALSE;
+
+	minx1 = topwp->winrect.left;
+	miny1 = topwp->winrect.top;
+	maxx1 = topwp->winrect.right - 1;
+	maxy1 = topwp->winrect.bottom - 1;
+
+	minx2 = botwp->winrect.left;
+	miny2 = botwp->winrect.top;
+	maxx2 = botwp->winrect.right - 1;
+	maxy2 = botwp->winrect.bottom - 1;
+
+	if (minx1 > maxx2 || minx2 > maxx1 || miny1 > maxy2 || miny2 > maxy1)
+		return FALSE;
+
+	return TRUE;
+}
+
+/*
+ * Clear the specified area of a window and possibly make an exposure event.
+ * This sets the area window to its background color.  If the exposeflag is
+ * nonzero, then this also creates an exposure event for the window.
+ */
+void
+MwClearWindow(HWND wp, MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height,
+	BOOL exposeflag)
+{
+	if (wp->unmapcount)
+		return;
+
+	/*
+	 * Reduce the arguments so that they actually lie within the window.
+	 */
+	if (x < 0) {
+		width += x;
+		x = 0;
+	}
+	if (y < 0) {
+		height += y;
+		y = 0;
+	}
+	if (x + width > wp->winrect.right - wp->winrect.left)
+		width = (wp->winrect.right - wp->winrect.left) - x;
+	if (y + height > wp->winrect.bottom - wp->winrect.top)
+		height = (wp->winrect.bottom - wp->winrect.top) - y;
+
+	/*
+	 * Now see if the region is really in the window.  If not, then
+	 * do nothing.
+	 */
+	if (x >= (wp->winrect.right - wp->winrect.left) ||
+	    y >= (wp->winrect.bottom - wp->winrect.top) ||
+	    width <= 0 || height <= 0)
+		return;
+
+	/*
+	 * Now do the exposure if required.
+	 */
+	if (exposeflag)
+		MwDeliverExposureEvent(wp, x, y, width, height);
+}
+
+/*
+ * Handle the exposing of the specified absolute region of the screen,
+ * starting with the specified window.  That window and all of its
+ * children will be redrawn and/or exposure events generated if they
+ * overlap the specified area.  This is a recursive routine.
+ */
+void
+MwExposeArea(HWND wp, MWCOORD rootx, MWCOORD rooty, MWCOORD width,
+	MWCOORD height)
+{
+	if (wp->unmapcount)
+		return;
+
+	++mwpaintNC;		/* experimental NC paint handling*/
+
+	/*
+	 * First see if the area overlaps the window including the border.
+	 * If not, then there is nothing more to do.
+	 */
+	if (rootx >= wp->winrect.right || rooty >= wp->winrect.bottom ||
+	    (rootx + width) <= wp->winrect.left ||
+	    (rooty + height) <= wp->winrect.top)
+		return;
+
+#if 0
+	/*
+	 * The area does overlap the window.  See if the area overlaps
+	 * the border, and if so, then redraw it.
+	 */
+	if (rootx < wp->winrect.left || rooty < wp->winrect.top ||
+		(rootx + width) > wp->winrect.right ||
+		(rooty + height) > wp->winrect.bottom)
+			MwDrawBorder(wp);
+#endif
+
+	/*
+	 * Now clear the window itself in the specified area,
+	 * which might cause an exposure event.
+	 */
+	MwClearWindow(wp, rootx - wp->winrect.left, rooty - wp->winrect.top,
+		width, height, TRUE);
+
+	/*
+	 * Now do the same for all the children.
+	 */
+	for (wp = wp->children; wp; wp = wp->siblings)
+		MwExposeArea(wp, rootx, rooty, width, height);
+}
diff -urN lib/microwindows/src/mwin/winfont.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winfont.c
--- lib/microwindows/src/mwin/winfont.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winfont.c	2005-02-21 16:13:28.000000000 +0100
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * GetTextExtent*Point by Roman Guseynov
+ * Original contributions by Shane Nay
+ *
+ * Win32 API upper level font selection routines
+ */
+#include "windows.h"
+#include "wintern.h"
+#include "device.h"
+#include <stdlib.h>
+#include <string.h>
+
+HFONT WINAPI
+CreateFont(int nHeight, int nWidth, int nEscapement, int nOrientation,
+	int fnWeight, DWORD fdwItalic, DWORD fdwUnderline, DWORD fdwStrikeOut,
+	DWORD fdwCharSet,DWORD fdwOutputPrecision,DWORD fdwClipPrecision,
+	DWORD fdwQuality, DWORD fdwPitchAndFamily, LPCSTR lpszFace)
+{
+	LOGFONT	lf;
+
+	lf.lfHeight = nHeight;
+	lf.lfWidth = nWidth;
+	lf.lfEscapement = nEscapement;
+	lf.lfOrientation = nOrientation;
+	lf.lfWeight = fnWeight;
+	lf.lfItalic = fdwItalic;
+	lf.lfUnderline = fdwUnderline;
+	lf.lfStrikeOut = fdwStrikeOut;
+	lf.lfCharSet = fdwCharSet;
+	lf.lfOutPrecision = fdwOutputPrecision;
+	lf.lfClipPrecision = fdwClipPrecision;
+	lf.lfQuality = fdwQuality;
+	lf.lfPitchAndFamily = fdwPitchAndFamily;
+	strncpy(lf.lfFaceName, lpszFace, sizeof(lf.lfFaceName));
+
+	return CreateFontIndirect(&lf);
+}
+
+HFONT WINAPI
+CreateFontIndirect(CONST LOGFONT *lplf)
+{
+	MWFONTOBJ * 	hfont;
+	int		family, pitch;
+	MWLOGFONT	mwlf;
+	char	szFacename[32];
+
+	/* create a gdi font object*/
+	hfont = GdItemNew(MWFONTOBJ);
+	if(!hfont)
+		return NULL;
+	hfont->hdr.type = OBJ_FONT;
+	hfont->hdr.stockobj = FALSE;
+
+	/* convert LOGFONT to MWLOGFONT*/
+	memset(&mwlf, 0, sizeof(mwlf));
+	mwlf.lfHeight = lplf->lfHeight;
+	mwlf.lfWidth = lplf->lfWidth;
+	mwlf.lfEscapement = lplf->lfEscapement;
+	mwlf.lfOrientation = lplf->lfOrientation;
+	mwlf.lfWeight = lplf->lfWeight;
+	mwlf.lfItalic = lplf->lfItalic;
+	mwlf.lfUnderline = lplf->lfUnderline;
+	mwlf.lfStrikeOut = lplf->lfStrikeOut;
+	mwlf.lfCharSet = lplf->lfCharSet;
+	mwlf.lfOutPrecision = lplf->lfOutPrecision;
+	mwlf.lfClipPrecision = lplf->lfClipPrecision;
+	mwlf.lfQuality = lplf->lfQuality;
+	strncpy(mwlf.lfFaceName, lplf->lfFaceName, sizeof(mwlf.lfFaceName));
+
+	family = lplf->lfPitchAndFamily & 0xf0;
+	switch(family) {
+	case FF_DONTCARE:
+		break;
+	case FF_ROMAN:
+		mwlf.lfRoman = 1;
+		mwlf.lfSerif = 1;
+		break;
+	case FF_SWISS:
+		mwlf.lfSansSerif = 1;
+		break;
+	case FF_MODERN:
+		mwlf.lfModern = 1;
+		break;
+	}
+
+	pitch = lplf->lfPitchAndFamily & 0x0f;
+	switch(pitch) {
+	case DEFAULT_PITCH:
+		break;
+	case FIXED_PITCH:
+	case MONO_FONT:
+		mwlf.lfMonospace = 1;
+		break;
+	case VARIABLE_PITCH:
+		mwlf.lfProportional = 1;
+		break;
+	}
+	/*mwlf.lfOblique = 0;*/
+	/*mwlf.lfSmallCaps = 0;*/
+	/*mwlf.lfPitch = 0;*/
+
+	/* select a font based on facename, bold/italic and height*/
+	strncpy(szFacename, lplf->lfFaceName, sizeof(szFacename));
+	if (lplf->lfWeight==FW_BOLD)
+		strcat(szFacename, "B");
+	if (lplf->lfItalic)
+		strcat(szFacename, "I");
+	hfont->pfont = GdCreateFont(&scrdev, szFacename, lplf->lfHeight, &mwlf);
+
+	return (HFONT)hfont;
+}
+
+BOOL WINAPI
+GetTextMetrics(HDC hdc, LPTEXTMETRIC lptm)
+{
+	MWFONTINFO 	fi;
+
+	if(!hdc)
+		return FALSE;
+
+	GdGetFontInfo(hdc->font->pfont, &fi);
+
+	/* FIXME many items are guessed for the time being*/
+	lptm->tmHeight = fi.height;
+
+   	 /* reversed for kaffe port
+	lptm->tmAscent = fi.height - fi.baseline;
+	lptm->tmDescent= fi.baseline;
+	 */
+
+	lptm->tmDescent = fi.height - fi.baseline;
+	lptm->tmAscent= fi.baseline;
+	lptm->tmInternalLeading = 0;
+	lptm->tmExternalLeading = 0;
+	lptm->tmAveCharWidth = fi.widths['x'];
+	lptm->tmMaxCharWidth = fi.maxwidth;
+	lptm->tmWeight = FW_NORMAL;
+	lptm->tmOverhang = 0;
+	lptm->tmDigitizedAspectX = fi.maxwidth;
+	lptm->tmDigitizedAspectY = fi.height;
+	lptm->tmFirstChar = 32;
+	lptm->tmLastChar = 255;
+	lptm->tmDefaultChar = '?';
+	lptm->tmBreakChar = 0;
+	lptm->tmItalic = 0;
+	lptm->tmUnderlined = 0;
+	lptm->tmStruckOut = 0;
+	/* note that win32 has the TMPF_FIXED_PITCH flags REVERSED...*/
+	lptm->tmPitchAndFamily = fi.fixed?
+			FF_DONTCARE: (FF_DONTCARE | TMPF_FIXED_PITCH);
+	lptm->tmCharSet = OEM_CHARSET;
+	return TRUE;
+}
+
+BOOL WINAPI
+GetCharWidth(HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer)
+{
+	int 		i;
+	int		j = 0;
+	MWFONTINFO	fi;
+
+	if(!hdc || iLastChar < iFirstChar)
+		return FALSE;
+
+	GdGetFontInfo(hdc->font->pfont, &fi);
+	for(i=iFirstChar; i <= iLastChar; ++i)
+		if(i < fi.firstchar || i > fi.lastchar || i > 255)
+			lpBuffer[j++] = 0;
+		else lpBuffer[j++] = fi.widths[i];
+		lpBuffer[j++] = fi.widths[i];
+
+	return TRUE;
+}
+
+BOOL WINAPI
+GetTextExtentPoint(
+	HDC hdc,		/* handle to DC*/
+	LPCTSTR lpszStr,	/* character string*/
+	int cchString,		/* number of characters*/
+	LPSIZE lpSize)		/* string dimensions*/
+{
+	int width = 1, height = 1, baseline = 0;
+
+	if (lpSize) {
+		lpSize->cx = 0;
+		lpSize->cy = 0;
+	}
+	if (!hdc || !lpszStr || !cchString || !lpSize)
+		return FALSE;
+	GdGetTextSize(hdc->font->pfont, lpszStr, cchString, &width, &height,
+		&baseline, MWTF_UTF8);
+	lpSize->cx = width;
+	lpSize->cy = height;
+
+	/*printf("<MWIN>: lpszStr=\"%s\", cchString=%d, lpsize->cx=%d, lpSize->cy=%d\n", lpszStr, cchString, lpSize->cx, lpSize->cy);*/
+	return TRUE;
+}
+
+BOOL WINAPI
+GetTextExtentExPoint(HDC hdc,	/* handle to DC*/
+	  LPCTSTR lpszStr,	/* character string*/
+	  int cchString,	/* number of characters*/
+	  int nMaxExtent,	/* maximum width of formatted string*/
+	  LPINT lpnFit,		/* maximum number of characters*/
+	  LPINT alpDx,	 	/* array of partial string widths*/
+	  LPSIZE lpSize)	/* string dimensions*/
+
+{
+	int attr,width=0,height=0;
+
+	if(!hdc || !lpszStr)
+		return FALSE;
+	if (cchString<0)
+		cchString = strlen((char *)lpszStr);
+	attr=hdc->font->pfont->fontattr;
+	if (attr&FS_FREETYPE)
+	{ 
+		if (GdGetTextSizeEx(hdc->font->pfont,lpszStr,cchString,
+			nMaxExtent,lpnFit,alpDx,&width,&height,NULL,MWTF_UTF8))
+		{
+			lpSize->cx=width;
+			lpSize->cy=height;
+			return TRUE;
+		}
+		return FALSE;
+	}
+	else
+	{
+		SIZE sz;
+		int i;
+
+		if (!GetTextExtentPoint(hdc, lpszStr, cchString, lpSize))
+			return FALSE;
+		if ((!nMaxExtent)||(!lpnFit)||(!alpDx))
+			return TRUE;
+		for (i=0; i<cchString; i++) {
+			if (!GetTextExtentPoint(hdc, lpszStr, i+1, &sz))
+				return FALSE;
+			if (sz.cx <= nMaxExtent)
+				alpDx[i] = sz.cx;
+			else {
+				(*lpnFit) = i;
+				return TRUE;
+			}
+		}
+		(*lpnFit) = cchString;
+		return TRUE;	
+	}
+}     
diff -urN lib/microwindows/src/mwin/wingdi.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/wingdi.c
--- lib/microwindows/src/mwin/wingdi.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/wingdi.c	2005-02-21 16:13:29.000000000 +0100
@@ -0,0 +1,1428 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Win32 API upper level graphics drawing routines
+ */
+#include "windows.h"
+#include "wintern.h"
+#include "device.h"
+#include <stdlib.h>
+#include <string.h>
+
+#define MAXSYSCOLORS	29	/* # of COLOR_* system colors*/
+#define MAXSTOCKOBJECTS	18	/* # of stock objects*/
+
+#if ERASEMOVE
+BOOL mwERASEMOVE = TRUE;	/* default XORMOVE repaint algorithm*/
+#else
+BOOL mwERASEMOVE = FALSE;	/* default ERASEMOVE repaint algorithm*/
+#endif
+
+/* cast a pointer to an integer*/
+#if DOS_TURBOC
+#define PTRTOINT	unsigned long
+#else
+#define PTRTOINT	unsigned int
+#endif
+
+static HDC	cliphdc;	/* current window cliprects*/
+
+/* default bitmap for new DCs*/
+static MWBITMAPOBJ default_bitmap = {
+	{OBJ_BITMAP, TRUE}, 1, 1, 1, 1, 1, 1
+};
+
+static BOOL MwExtTextOut(HDC hdc, int x, int y, UINT fuOptions,
+		CONST RECT *lprc, LPCVOID lpszString, UINT cbCount,
+		CONST INT *lpDx, int flags);
+static int  MwDrawText(HDC hdc, LPCVOID lpString, int nCount, LPRECT lpRect,
+		UINT uFormat, int flags);
+
+HDC WINAPI
+GetDCEx(HWND hwnd,HRGN hrgnClip,DWORD flags)
+{
+	HDC	hdc;
+
+	if(!hwnd)		/* handle NULL hwnd => desktop*/
+		hwnd = rootwp;
+
+	/* handle private DC's*/
+	if(hwnd->owndc && !(flags & DCX_WINDOW))
+		return hwnd->owndc;
+
+	/* add caching?*/
+	hdc = GdItemNew(struct hdc);
+	if(!hdc)
+		return NULL;
+
+	hdc->psd = &scrdev;
+	hdc->hwnd = hwnd;
+	if(flags & DCX_DEFAULTCLIP) {
+		flags &= ~DCX_DEFAULTCLIP;
+		if(hwnd->style & WS_CLIPSIBLINGS)
+			flags |= DCX_CLIPSIBLINGS;
+		if(hwnd->style & WS_CLIPCHILDREN)
+			flags |= DCX_CLIPCHILDREN;
+	}
+	hdc->flags = flags;
+	hdc->bkmode = OPAQUE;
+	hdc->textalign = TA_LEFT | TA_TOP | TA_NOUPDATECP;
+	hdc->bkcolor = RGB(255, 255, 255);	/* WHITE*/
+	hdc->textcolor = RGB(0, 0, 0);		/* BLACK*/
+	hdc->brush = (MWBRUSHOBJ *)GetStockObject(WHITE_BRUSH);
+	hdc->pen = (MWPENOBJ *)GetStockObject(BLACK_PEN);
+	hdc->font = (MWFONTOBJ *)GetStockObject(SYSTEM_FONT);
+#if UPDATEREGIONS
+	if(hrgnClip) {
+		/* make a copy of passed region*/
+		hdc->region = (MWRGNOBJ *)CreateRectRgn(0, 0, 0, 0);
+		CombineRgn((HRGN)hdc->region, hrgnClip, NULL, RGN_COPY);
+	}
+#endif
+
+	/* make default bitmap compatible with scrdev
+	 * otherwise problems occur later because selecting
+	 * in the default bitmap overwrite planes and bpp
+	 * in a memory dc, and thus it becomes incompatible
+	 * with scrdev.
+	 */
+	default_bitmap.planes = scrdev.planes;
+	default_bitmap.bpp = scrdev.bpp;
+	hdc->bitmap = &default_bitmap;
+
+	hdc->drawmode = R2_COPYPEN;
+	hdc->pt.x = 0;
+	hdc->pt.y = 0;
+
+	/* assign private DC if CS_OWNDC and not WindowDC*/
+	if((hwnd->pClass->style & CS_OWNDC) && !(flags & DCX_WINDOW)) {
+		/* must exclude update region due to BeginPaint GetDCEx call*/
+		hdc->flags |= DCX_EXCLUDEUPDATE;
+		hwnd->owndc = hdc;
+	}
+
+	return hdc;
+}
+
+HDC WINAPI
+GetDC(HWND hwnd)
+{
+	/*
+	 * Exclude update regions when drawing with GetDC.
+	 * This is required because some programs use GetDC
+	 * when painting outside of BeginPaint/EndPaint, and
+	 * the update region is empty then.
+	 */
+	return GetDCEx(hwnd, NULL, DCX_DEFAULTCLIP|DCX_EXCLUDEUPDATE);
+}
+
+HDC WINAPI
+GetWindowDC(HWND hwnd)
+{
+	/* 
+	 * Exclude update region for now, since we
+	 * don't keep track of non-client update regions yet
+	 */
+	return GetDCEx(hwnd, NULL,DCX_WINDOW|DCX_DEFAULTCLIP|DCX_EXCLUDEUPDATE);
+}
+
+/* free a DC allocated from GetDC*/
+int WINAPI 
+ReleaseDC(HWND hwnd, HDC hdc)
+{
+	/* don't delete a memory dc on release*/
+	if(!hdc || (hdc->psd->flags&PSF_MEMORY))
+		return 0;
+
+	if(hdc == cliphdc)
+		cliphdc = NULL;
+
+	/* handle private DC's*/
+	if(hdc->hwnd->owndc && !(hdc->flags & DCX_WINDOW))
+		return 1;
+
+	DeleteObject((HBRUSH)hdc->brush);
+	DeleteObject((HPEN)hdc->pen);
+#if 0 /* don't delete font resources on ReleaseDC... use DeleteObject instead*/
+	DeleteObject((HFONT)hdc->font);
+#endif
+	DeleteObject((HRGN)hdc->region);
+	/*
+	 * We can only select a bitmap in a memory DC,
+	 * so bitmaps aren't released except through DeleteDC.
+	 */
+	DeleteObject((HBITMAP)hdc->bitmap);
+	GdItemFree(hdc);
+	return 1;
+}
+
+/* free a dc allocated from CreateCompatibleDC*/
+BOOL WINAPI
+DeleteDC(HDC hdc)
+{
+	/* don't delete a normal dc, only memory dc's*/
+	if(!hdc || !(hdc->psd->flags&PSF_MEMORY))
+		return 0;
+
+	/* free allocated memory screen device*/
+	hdc->psd->FreeMemGC(hdc->psd);
+
+	/* make it look like a GetDC dc, and free it*/
+	hdc->psd = &scrdev;
+	return ReleaseDC(NULL, hdc);
+}
+
+void
+MwPaintNCArea(HWND hwnd)
+{
+	SendMessage(hwnd, WM_NCPAINT, 0, 0L);
+
+	/* for now, we always paint NC scrollbar areas*/
+	MwPaintNCScrollbars(hwnd, NULL);
+}
+
+HDC WINAPI 
+BeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint)
+{
+	HDC	hdc;
+
+	/* first update non-client area*/
+	if(mwforceNCpaint || hwnd->paintNC != mwpaintNC) {
+		MwPaintNCArea(hwnd);
+		hwnd->paintNC = mwpaintNC;
+	}
+
+	/* If ERASEMOVE:
+	 * Don't allow windows to repaint while user is moving
+	 * a window.  Instead, just erase backgrounds
+	 * and indicate delayed painting required, which
+	 * will occur after user completes window move.
+	 */
+	if(mwERASEMOVE && dragwp) {
+		hdc = NULL;
+		lpPaint->fErase = !DefWindowProc(hwnd, WM_ERASEBKGND, 0, 0L);
+		hwnd->gotPaintMsg = PAINT_DELAYPAINT;
+	} else {
+		HideCaret(hwnd);
+
+		/* FIXME: mdemo requires update excluded or draw errors occur*/
+		hdc = GetDCEx(hwnd, NULL, DCX_DEFAULTCLIP
+				|DCX_EXCLUDEUPDATE);	/* FIXME - bug*/
+
+		/* erase client background*/
+		lpPaint->fErase = !SendMessage(hwnd, WM_ERASEBKGND, (WPARAM)hdc,
+			0L);
+	}
+	lpPaint->hdc = hdc;
+
+	GetUpdateRect(hwnd, &lpPaint->rcPaint, FALSE);
+	return hdc;
+}
+
+BOOL WINAPI 
+EndPaint(HWND hwnd, CONST PAINTSTRUCT *lpPaint)
+{
+	ReleaseDC(hwnd, lpPaint->hdc);
+#if UPDATEREGIONS
+	/* don't clear update region until done dragging*/
+	if(mwERASEMOVE && !dragwp)
+		GdSetRectRegion(hwnd->update, 0, 0, 0, 0);
+#endif
+	ShowCaret(hwnd);
+	return TRUE;
+}
+
+COLORREF WINAPI
+SetTextColor(HDC hdc, COLORREF crColor)
+{
+	COLORREF	oldtextcolor;
+
+	if (!hdc)
+		return CLR_INVALID;
+	oldtextcolor = hdc->textcolor;
+	hdc->textcolor = (MWCOLORVAL)crColor;
+	return oldtextcolor;
+}
+
+COLORREF WINAPI
+SetBkColor(HDC hdc, COLORREF crColor)
+{
+	COLORREF	oldbkcolor;
+
+	if (!hdc)
+		return CLR_INVALID;
+	oldbkcolor = hdc->bkcolor;
+	hdc->bkcolor = crColor;
+	return oldbkcolor;
+}
+
+int WINAPI
+SetBkMode(HDC hdc, int iBkMode)
+{
+	int	oldbkmode;
+
+	if(!hdc)
+		return 0;
+	oldbkmode = hdc->bkmode;
+	hdc->bkmode = iBkMode;
+	return oldbkmode;
+}
+
+UINT WINAPI
+SetTextAlign(HDC hdc, UINT fMode)
+{
+	UINT	oldfMode;
+
+	if(!hdc)
+		return GDI_ERROR;
+	oldfMode = hdc->textalign;
+	hdc->textalign = fMode;
+	return oldfMode;
+}
+
+/* FIXME: releasing a DC does NOT change back the drawing mode!*/
+int WINAPI
+SetROP2(HDC hdc, int fnDrawMode)
+{
+	int	newmode, oldmode;
+
+	if(!hdc)
+		return 0;
+
+	oldmode = hdc->drawmode;
+	switch(fnDrawMode) {
+	case R2_XORPEN:
+		newmode = MWMODE_XOR;
+		break;
+	case R2_COPYPEN:
+	default:
+		newmode = MWMODE_SET;
+	}
+	hdc->drawmode = newmode;
+	GdSetMode(newmode);
+	return oldmode;
+}
+
+/* 
+ * Setup clip region from device context's associated window or bitmap.
+ * Memory DC's are always associated with the desktop window, and are
+ * always visible.  Return the DC's hwnd if window is visible.
+ */
+HWND
+MwPrepareDC(HDC hdc)
+{
+	HWND	hwnd;
+
+	if(!hdc || !hdc->hwnd)
+		return NULL;
+
+	hwnd = hdc->hwnd;
+	if (hwnd->unmapcount)
+		return NULL;
+
+	/*
+	 * If the window is not the currently clipped one, then
+	 * make it the current one and define its clip rectangles.
+	 */
+	if(hdc != cliphdc) {
+		/* clip memory dc's to the bitmap size*/
+		if(hdc->psd->flags&PSF_MEMORY) {
+#if DYNAMICREGIONS
+			GdSetClipRegion(hdc->psd,
+				GdAllocRectRegion(0, 0, hdc->psd->xvirtres,
+					hdc->psd->yvirtres));
+#else
+			static MWCLIPRECT crc = {0, 0, 0, 0};
+
+			crc.width = hdc->psd->xvirtres;
+			crc.height = hdc->psd->yvirtres;
+			GdSetClipRects(hdc->psd, 1, &crc);
+#endif
+		} else MwSetClipWindow(hdc);
+		cliphdc = hdc;
+	}
+
+	return hwnd;
+}
+
+/* return RGB value at specified coordinates*/
+COLORREF WINAPI
+GetPixel(HDC hdc, int x, int y)
+{
+	HWND		hwnd;
+	POINT		pt;
+	MWPIXELVAL	pixel;
+	MWPALENTRY	rgb;
+
+	hwnd = MwPrepareDC(hdc);
+	if(!hwnd)
+		return CLR_INVALID;
+	pt.x = x;
+	pt.y = y;
+	if(MwIsClientDC(hdc))
+		ClientToScreen(hwnd, &pt);
+
+	/* read pixel value*/
+	GdReadArea(hdc->psd, pt.x, pt.y, 1, 1, &pixel);
+
+	switch(hdc->psd->pixtype) {
+	case MWPF_TRUECOLOR0888:
+	case MWPF_TRUECOLOR888:
+		/* create RGB colorval from 8/8/8 pixel*/
+		return PIXEL888TOCOLORVAL(pixel);
+
+	case MWPF_TRUECOLOR565:
+		/* create RGB colorval from 5/6/5 pixel*/
+		return PIXEL565TOCOLORVAL(pixel);
+
+	case MWPF_TRUECOLOR555:
+		/* create RGB colorval from 5/5/5 pixel*/
+		return PIXEL555TOCOLORVAL(pixel);
+
+	case MWPF_TRUECOLOR332:
+		/* create RGB colorval from 3/3/2 pixel*/
+		return PIXEL332TOCOLORVAL(pixel);
+
+	case MWPF_PALETTE:
+		if(GdGetPalette(hdc->psd, pixel, 1, &rgb))
+			return RGB(rgb.r, rgb.g, rgb.b);
+	}
+	return CLR_INVALID;
+}
+
+COLORREF WINAPI
+SetPixel(HDC hdc, int x, int y, COLORREF crColor)
+{
+	HWND		hwnd;
+	POINT		pt;
+
+	hwnd = MwPrepareDC(hdc);
+	if(!hwnd)
+		return 0;	/* doesn't return previous color*/
+	pt.x = x;
+	pt.y = y;
+	if(MwIsClientDC(hdc))
+		ClientToScreen(hwnd, &pt);
+
+	/* draw point in passed color*/
+	GdSetForeground(GdFindColor(crColor));
+	GdPoint(hdc->psd, pt.x, pt.y);
+	return 0;		/* doesn't return previous color*/
+}
+
+BOOL WINAPI 
+MoveToEx(HDC hdc, int x, int y, LPPOINT lpPoint)
+{
+	if(!hdc)
+		return FALSE;
+	if(lpPoint)
+		*lpPoint = hdc->pt;
+	hdc->pt.x = x;
+	hdc->pt.y = y;
+	return TRUE;
+}
+
+BOOL WINAPI
+LineTo(HDC hdc, int x, int y)
+{
+	HWND		hwnd;
+	POINT		beg, end;
+
+	hwnd = MwPrepareDC(hdc);
+	if(!hwnd)
+		return FALSE;
+
+	beg.x = hdc->pt.x;
+	beg.y = hdc->pt.y;
+	end.x = x;
+	end.y = y;
+	if(MwIsClientDC(hdc)) {
+		ClientToScreen(hwnd, &beg);
+		ClientToScreen(hwnd, &end);
+	}
+
+	/* draw line in current pen color*/
+	if(hdc->pen->style != PS_NULL) {
+		GdSetForeground(GdFindColor(hdc->pen->color));
+		/* don't draw last point*/
+		GdLine(hdc->psd, beg.x, beg.y, end.x, end.y, FALSE);
+	}
+	hdc->pt.x = x;
+	hdc->pt.y = y;
+	return TRUE;
+}
+
+/* draw line segments by connecting passed points*/
+BOOL WINAPI
+Polyline(HDC hdc, CONST POINT *lppt, int cPoints)
+{
+	HWND		hwnd;
+	POINT		beg, end;
+
+	if(cPoints <= 1)
+		return FALSE;
+
+	hwnd = MwPrepareDC(hdc);
+	if(!hwnd)
+		return FALSE;
+
+	if(hdc->pen->style == PS_NULL)
+		return TRUE;
+
+	/* draw line in current pen color*/
+	GdSetForeground(GdFindColor(hdc->pen->color));
+
+	beg = *lppt++;
+	if(MwIsClientDC(hdc))
+		ClientToScreen(hwnd, &beg);
+	while(--cPoints > 0) {
+		end = *lppt++;
+		if(MwIsClientDC(hdc))
+			ClientToScreen(hwnd, &end);
+
+		/* don't draw last point*/
+		GdLine(hdc->psd, beg.x, beg.y, end.x, end.y, FALSE);
+
+		beg = end;
+	}
+	return TRUE;
+}
+
+BOOL WINAPI
+Rectangle(HDC hdc, int nLeft, int nTop, int nRight, int nBottom)
+{
+	HWND	hwnd;
+	RECT	rc;
+
+	hwnd = MwPrepareDC(hdc);
+	if(!hwnd)
+		return FALSE;
+
+	SetRect(&rc, nLeft, nTop, nRight, nBottom);
+	if(MwIsClientDC(hdc))
+		MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2);
+
+	/* draw rectangle in current pen color*/
+	if(hdc->pen->style != PS_NULL) {
+		GdSetForeground(GdFindColor(hdc->pen->color));
+		GdRect(hdc->psd, rc.left, rc.top,
+			rc.right - rc.left, rc.bottom - rc.top);
+	}
+
+	/* fill rectangle in current brush color*/
+	if(hdc->brush->style != BS_NULL) {
+		InflateRect(&rc, -1, -1);
+		GdSetForeground(GdFindColor(hdc->brush->color));
+		GdFillRect(hdc->psd, rc.left, rc.top, rc.right - rc.left,
+			rc.bottom - rc.top);
+	}
+
+	return TRUE;
+}
+
+BOOL WINAPI
+Ellipse(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
+{
+	HWND	hwnd;
+	int	rx, ry;
+	RECT	rc;
+
+	hwnd = MwPrepareDC(hdc);
+	if(!hwnd)
+		return FALSE;
+
+	SetRect(&rc, nLeftRect, nTopRect, nRightRect, nBottomRect);
+	if(MwIsClientDC(hdc))
+		MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2);
+
+	rx = (rc.right - rc.left)/2 - 1;
+	ry = (rc.bottom - rc.top)/2 - 1;
+	rc.left += rx;
+	rc.top += ry;
+
+	/* fill ellipse in current brush color*/
+	if(hdc->brush->style != BS_NULL) {
+		InflateRect(&rc, -1, -1);
+		GdSetForeground(GdFindColor(hdc->brush->color));
+		GdEllipse(hdc->psd, rc.left, rc.top, rx, ry, TRUE);
+	}
+
+	/* draw ellipse outline in current pen color*/
+	if(hdc->pen->style != PS_NULL) {
+		GdSetForeground(GdFindColor(hdc->pen->color));
+		GdEllipse(hdc->psd, rc.left, rc.top, rx, ry, FALSE);
+	}
+
+	return TRUE;
+}
+
+static void
+dopiearc(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect,
+	int ax, int ay, int bx, int by, int type)
+{
+	HWND	hwnd;
+	int	rx, ry;
+	RECT	rc, rc2;
+
+	hwnd = MwPrepareDC(hdc);
+	if(!hwnd)
+		return;
+
+	SetRect(&rc, nLeftRect, nTopRect, nRightRect, nBottomRect);
+	SetRect(&rc2, ax, ay, bx, by);
+	if(MwIsClientDC(hdc)) {
+		MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2);
+		MapWindowPoints(hwnd, NULL, (LPPOINT)&rc2, 2);
+	}
+
+	rx = (rc.right - rc.left)/2 - 1;
+	ry = (rc.bottom - rc.top)/2 - 1;
+	rc.left += rx;
+	rc.top += ry;
+
+	/* fill ellipse in current brush color*/
+	if(hdc->brush->style != BS_NULL && type == MWPIE) {
+		GdSetForeground(GdFindColor(hdc->brush->color));
+		GdArc(hdc->psd, rc.left, rc.top, rx, ry,
+			rc2.left, rc2.top, rc2.right, rc2.bottom, MWPIE);
+	}
+
+	/* draw ellipse outline in current pen color*/
+	if(hdc->pen->style != PS_NULL) {
+		GdSetForeground(GdFindColor(hdc->pen->color));
+		if(type == MWPIE)
+			type = MWARC;	/* MWARCOUTLINE?*/
+		GdArc(hdc->psd, rc.left, rc.top, rx, ry,
+			rc2.left, rc2.top, rc2.right, rc2.bottom, type);
+	}
+}
+
+BOOL WINAPI
+Arc(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect,
+	int nXStartArc, int nYStartArc, int nXEndArc, int nYEndArc)
+{
+	dopiearc(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect,
+		nXStartArc, nYStartArc, nXEndArc, nYEndArc, MWARC);
+	return TRUE;
+}
+
+BOOL WINAPI
+Pie(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect,
+	int nXRadial1, int nYRadial1, int nXRadial2, int nYRadial2)
+{
+	dopiearc(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect,
+		nXRadial1, nYRadial1, nXRadial2, nYRadial2, MWPIE);
+	return TRUE;
+}
+
+BOOL WINAPI
+Polygon(HDC hdc, CONST POINT *lpPoints, int nCount)
+{
+	HWND	hwnd;
+	int	i;
+	LPPOINT	pp, ppAlloc = NULL;
+
+	hwnd = MwPrepareDC(hdc);
+	if(!hwnd)
+		return FALSE;
+
+	if(MwIsClientDC(hdc)) {
+		/* convert points to client coords*/
+		ppAlloc = (LPPOINT)malloc(nCount * sizeof(POINT));
+		if(!ppAlloc)
+			return FALSE;
+		memcpy(ppAlloc, lpPoints, nCount*sizeof(POINT));
+		pp = ppAlloc;
+		for(i=0; i<nCount; ++i)
+			ClientToScreen(hwnd, pp++);
+		pp = ppAlloc;
+	} else pp = (LPPOINT)lpPoints;
+
+	/* fill polygon in current brush color*/
+	if(hdc->brush->style != BS_NULL) {
+		GdSetForeground(GdFindColor(hdc->brush->color));
+		GdFillPoly(hdc->psd, nCount, pp);
+	}
+
+	/* draw polygon outline in current pen color*/
+	if(hdc->pen->style != PS_NULL) {
+		GdSetForeground(GdFindColor(hdc->pen->color));
+		GdPoly(hdc->psd, nCount, pp);
+	}
+
+	if(ppAlloc)
+		free(ppAlloc);
+	return TRUE;
+}
+
+/* draw nCount polygons*/
+BOOL WINAPI
+PolyPolygon(HDC hdc, CONST POINT *lpPoints, LPINT lpPolyCounts, int nCount)
+{
+	while(--nCount >= 0) {
+		if (!Polygon(hdc, lpPoints, *lpPolyCounts))
+			return FALSE;
+		lpPoints += *lpPolyCounts++;
+	}
+	return TRUE;
+}
+
+int WINAPI
+FillRect(HDC hdc, CONST RECT *lprc, HBRUSH hbr)
+{
+	HWND		hwnd;
+	RECT 		rc;
+	MWBRUSHOBJ *	obr = (MWBRUSHOBJ *)hbr;
+	COLORREF	crFill;
+
+	hwnd = MwPrepareDC(hdc);
+	if(!hwnd || !obr)
+		return FALSE;
+
+	if(!lprc) {
+		if(MwIsClientDC(hdc))
+			GetClientRect(hwnd, &rc);
+		else
+			GetWindowRect(hwnd, &rc);
+		lprc = &rc;
+	} else
+		rc = *lprc;
+	if(MwIsClientDC(hdc))
+		MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2);
+
+	/* handle COLOR_xxx + 1 passed as HBRUSH*/
+	if((PTRTOINT)obr <= MAXSYSCOLORS)
+		crFill = GetSysColor((int)obr-1);
+	else {
+		/* get color from passed HBRUSH*/
+		if(obr->style == BS_NULL)
+			return TRUE;
+		crFill = obr->color;
+	}
+
+	/* fill rectangle in passed brush color*/
+	GdSetForeground(GdFindColor(crFill));
+	GdFillRect(hdc->psd, rc.left, rc.top,
+		rc.right - rc.left, rc.bottom - rc.top);
+	return TRUE;
+}
+
+/* ascii*/
+BOOL WINAPI
+TextOut(HDC hdc, int x, int y, LPCSTR lpszString, int cbString)
+{
+	/* kaffe port wants MWTF_UTF8 here...*/
+	return MwExtTextOut(hdc, x, y, 0, NULL, lpszString, cbString, NULL,
+		MWTF_ASCII);
+}
+
+/* ascii*/
+BOOL WINAPI
+ExtTextOut(HDC hdc, int x, int y, UINT fuOptions, CONST RECT *lprc,
+	LPCSTR lpszString, UINT cbCount, CONST INT *lpDx)
+{
+	return MwExtTextOut(hdc, x, y, fuOptions, lprc, lpszString,
+		cbCount, lpDx, MWTF_ASCII);
+}
+
+/* unicode*/
+BOOL WINAPI
+ExtTextOutW(HDC hdc, int x, int y, UINT fuOptions, CONST RECT *lprc,
+	LPCWSTR lpszString, UINT cbCount, CONST INT *lpDx)
+{
+	return MwExtTextOut(hdc, x, y, fuOptions, lprc, lpszString,
+		cbCount, lpDx, MWTF_UC16);
+}
+
+/* internal version of ExtTextOut, passed flags for text data type*/
+static BOOL
+MwExtTextOut(HDC hdc, int x, int y, UINT fuOptions, CONST RECT *lprc,
+	LPCVOID lpszString, UINT cbCount, CONST INT *lpDx, int flags)
+{
+	HWND	hwnd;
+	POINT	pt;
+	RECT	rc;
+
+	hwnd = MwPrepareDC(hdc);
+	if(!hwnd)
+		return FALSE;
+
+	pt.x = x;
+	pt.y = y;
+	if(MwIsClientDC(hdc))
+		ClientToScreen(hwnd, &pt);
+
+	/* optionally fill passed rectangle*/
+	if(lprc && (fuOptions&ETO_OPAQUE)) {
+		rc = *lprc;
+		if(MwIsClientDC(hdc))
+			MapWindowPoints(hwnd, NULL, (LPPOINT)&rc, 2);
+
+		/* fill rectangle with current background color*/
+		GdSetForeground(GdFindColor(hdc->bkcolor));
+		GdFillRect(hdc->psd, rc.left, rc.top, rc.right - rc.left,
+			rc.bottom - rc.top);
+		GdSetUseBackground(FALSE);
+	} else {
+		/* use current background mode for text background draw*/
+		GdSetUseBackground(hdc->bkmode == OPAQUE? TRUE: FALSE);
+		/* always set background color in case GdArea is
+		 * used to draw, which compares gr_foreground != gr_background
+		 * if gr_usebg is false...
+		 */
+		/*if(hdc->bkmode == OPAQUE)*/
+			GdSetBackground(GdFindColor(hdc->bkcolor));
+	}
+
+	/* nyi: lpDx*/
+
+	/* draw text in current text foreground and background color*/
+	GdSetForeground(GdFindColor(hdc->textcolor));
+	GdSetFont(hdc->font->pfont);
+
+	/* this whole text alignment thing needs rewriting*/
+	if((hdc->textalign & TA_BASELINE) == TA_BASELINE) {
+		 /* this is not right... changed for kaffe port
+		flags |= MWTF_TOP;
+		 */
+		flags |= MWTF_BASELINE;
+	} else if(hdc->textalign & TA_BOTTOM) {
+		MWCOORD	ph, pw, pb;
+
+		if(lprc)
+			pt.y += lprc->bottom - lprc->top;
+		else {
+			GdGetTextSize(hdc->font->pfont, lpszString, cbCount,
+				&pw, &ph, &pb, flags);
+			pt.y += ph;
+		}
+		flags |= MWTF_BOTTOM;
+	} else
+		flags |= MWTF_TOP;
+	GdText(hdc->psd, pt.x, pt.y, lpszString, cbCount, flags);
+
+	return TRUE;
+}
+
+/* ascii*/
+int WINAPI
+DrawTextA(HDC hdc, LPCSTR lpString, int nCount, LPRECT lpRect, UINT uFormat)
+{
+	return MwDrawText(hdc, lpString, nCount, lpRect, uFormat, MWTF_ASCII);
+}
+
+/* unicode*/
+int WINAPI
+DrawTextW(HDC hdc, LPCWSTR lpString, int nCount, LPRECT lpRect, UINT uFormat)
+{
+	return MwDrawText(hdc, lpString, nCount, lpRect, uFormat, MWTF_UC16);
+}
+
+/* note: many DT_x aren't implemented in this function*/
+/* internal version of DrawText, passed flags for text data type*/
+static int
+MwDrawText(HDC hdc, LPCVOID lpString, int nCount, LPRECT lpRect, UINT uFormat,
+	int flags)
+{
+	MWCOORD	x, y, width, height, baseline;
+
+	if(nCount == -1)
+		nCount = strlen(lpString);
+
+	if(uFormat & (DT_CALCRECT|DT_CENTER|DT_RIGHT)) {
+		if(!hdc)
+			return 0;
+		GdGetTextSize(hdc->font->pfont, lpString, nCount,
+			&width, &height, &baseline, MWTF_ASCII);
+	}
+	x = lpRect->left;
+	y = lpRect->top;
+
+	if(uFormat & DT_CALCRECT) {
+		lpRect->right = x + width;
+		lpRect->bottom = y + height;
+		return height;
+	}
+
+	if(uFormat & DT_CENTER)
+		x = (lpRect->left + lpRect->right - width) / 2;
+	else if(uFormat & DT_RIGHT)
+		x += lpRect->right - width;
+
+	/* draw text at DT_TOP using current fg, bg and bkmode*/
+	MwExtTextOut(hdc, x, y, 0, NULL, lpString, nCount, NULL, flags);
+	return height;
+}
+
+/* Microwindows only*/
+BOOL WINAPI
+DrawDIB(HDC hdc,int x,int y,PMWIMAGEHDR pimage)
+{
+	HWND		hwnd;
+	POINT		pt;
+
+	hwnd = MwPrepareDC(hdc);
+	if(!hwnd || !pimage)
+		return FALSE;
+	pt.x = x;
+	pt.y = y;
+	if(MwIsClientDC(hdc))
+		ClientToScreen(hwnd, &pt);
+
+	GdDrawImage(hdc->psd, pt.x, pt.y, pimage);
+	return TRUE;
+}
+
+/* define color scheme: A (tan), B (winstd) or C (old)*/
+#if ELKS
+#define B
+#else
+#define A
+#endif
+
+#define A_RGB(r,g,b)
+#define B_RGB(r,g,b)
+#define C_RGB(r,g,b)
+
+#ifdef A
+#undef  A_RGB
+#define A_RGB(r,g,b)	RGB(r,g,b),
+#endif
+#ifdef B
+#undef  B_RGB
+#define B_RGB(r,g,b)	RGB(r,g,b),
+#endif
+#ifdef C
+#undef  C_RGB
+#define C_RGB(r,g,b)	RGB(r,g,b),
+#endif
+
+static COLORREF sysColors[MAXSYSCOLORS] = {
+	RGB(192, 192, 192),	/* COLOR_SCROLLBAR          0*/
+	RGB(  0, 128, 128),     /* COLOR_BACKGROUND          */
+	A_RGB(128,   0,   0)	/* COLOR_ACTIVECAPTION       */
+	B_RGB(128,   0, 128)	/* COLOR_ACTIVECAPTION       */
+	C_RGB(128,   0, 128)	/* COLOR_ACTIVECAPTION       */
+	A_RGB(162, 141, 104)	/* COLOR_INACTIVECAPTION     */
+	B_RGB(128, 128, 128)  	/* COLOR_INACTIVECAPTION     */
+	C_RGB(  0,  64, 128)	/* COLOR_INACTIVECAPTION     */
+	RGB(192, 192, 192),     /* COLOR_MENU                */
+	RGB(255, 255, 255),     /* COLOR_WINDOW             5*/
+	RGB(  0,   0,   0),     /* COLOR_WINDOWFRAME         */
+	RGB(  0,   0,   0),     /* COLOR_MENUTEXT            */
+	RGB(  0,   0,   0),     /* COLOR_WINDOWTEXT          */
+	RGB(255, 255, 255),     /* COLOR_CAPTIONTEXT         */
+	RGB(192, 192, 192),   	/* COLOR_ACTIVEBORDER      10*/
+	RGB(192, 192, 192), 	/* COLOR_INACTIVEBORDER      */
+	RGB(128, 128, 128),   	/* COLOR_APPWORKSPACE        */
+	RGB(128,   0,   0),     /* COLOR_HIGHLIGHT           */
+	RGB(255, 255, 255),     /* COLOR_HIGHLIGHTTEXT       */
+	A_RGB(213, 204, 187)	/* COLOR_BTNFACE           15*/
+	B_RGB(192, 192, 192)	/* COLOR_BTNFACE           15*/
+	C_RGB(160, 160, 160)	/* COLOR_BTNFACE           15*/
+	A_RGB(162, 141, 104)	/* COLOR_BTNSHADOW           */
+	B_RGB(128, 128, 128)	/* COLOR_BTNSHADOW           */
+	C_RGB(128, 128, 128)	/* COLOR_BTNSHADOW           */
+	RGB( 64,  64,  64),     /* COLOR_GRAYTEXT            */
+	RGB(  0,   0,   0),     /* COLOR_BTNTEXT             */
+	RGB(192, 192, 192),    	/* COLOR_INACTIVECAPTIONTEXT */
+	A_RGB(234, 230, 221)  	/* COLOR_BTNHIGHLIGHT      20*/
+	B_RGB(255, 255, 255)  	/* COLOR_BTNHIGHLIGHT      20*/
+	C_RGB(223, 223, 223)  	/* COLOR_BTNHIGHLIGHT      20*/
+	RGB(  0,   0,   0),     /* COLOR_3DDKSHADOW          */
+	A_RGB(213, 204, 187)	/* COLOR_3DLIGHT             */
+	B_RGB(223, 223, 223)	/* COLOR_3DLIGHT             */
+	C_RGB(192, 192, 192)	/* COLOR_3DLIGHT             */
+	RGB(  0,   0,   0),     /* COLOR_INFOTEXT            */
+	RGB(225, 255, 255), 	/* COLOR_INFOBK              */
+	RGB(184, 180, 184),  	/* COLOR_ALTERNATEBTNFACE  25*/
+	RGB(  0,   0, 255),     /* COLOR_HOTLIGHT 	     */
+	RGB( 16, 132, 208),  	/* COLOR_GRADIENTACTIVECAPTION */
+	RGB(184, 180, 184) 	/* COLOR_GRADIENTINACTIVECAPTION 28*/
+};
+
+DWORD WINAPI
+GetSysColor(int nIndex)
+{
+	if(nIndex >= 0 && nIndex < MAXSYSCOLORS)
+		return sysColors[nIndex];
+	return 0;
+}
+
+COLORREF WINAPI
+SetSysColor(int nIndex, COLORREF crColor)	/* Microwindows only*/
+{
+	COLORREF oldColor;
+
+	if(nIndex >= 0 && nIndex < MAXSYSCOLORS) {
+		oldColor = sysColors[nIndex];
+		sysColors[nIndex] = crColor;
+		return oldColor;
+	}
+	return 0;
+}
+
+static MWBRUSHOBJ OBJ_WHITE_BRUSH = {
+	{OBJ_BRUSH, TRUE}, BS_SOLID, RGB(255, 255, 255)
+};
+
+static MWBRUSHOBJ OBJ_LTGRAY_BRUSH = {
+	{OBJ_BRUSH, TRUE}, BS_SOLID, RGB(192, 192, 192)
+};
+
+static MWBRUSHOBJ OBJ_GRAY_BRUSH = {
+	{OBJ_BRUSH, TRUE}, BS_SOLID, RGB(128, 128, 128)
+};
+
+static MWBRUSHOBJ OBJ_DKGRAY_BRUSH = {
+	{OBJ_BRUSH, TRUE}, BS_SOLID, RGB(32, 32, 32)
+};
+
+static MWBRUSHOBJ OBJ_BLACK_BRUSH = {
+	{OBJ_BRUSH, TRUE}, BS_SOLID, RGB(0, 0, 0)
+};
+
+static MWBRUSHOBJ OBJ_NULL_BRUSH = {
+	{OBJ_BRUSH, TRUE}, BS_NULL, RGB(0, 0, 0)
+};
+
+static MWPENOBJ OBJ_WHITE_PEN = {
+	{OBJ_PEN, TRUE}, PS_SOLID, RGB(255, 255, 255)
+};
+
+static MWPENOBJ OBJ_BLACK_PEN = {
+	{OBJ_PEN, TRUE}, PS_SOLID, RGB(0, 0, 0)
+};
+
+static MWPENOBJ OBJ_NULL_PEN = {
+	{OBJ_PEN, TRUE}, PS_NULL, RGB(0, 0, 0)
+};
+
+static MWFONTOBJ OBJ_OEM_FIXED_FONT = {
+	{OBJ_FONT, TRUE}, NULL, MWFONT_OEM_FIXED
+};
+
+static MWFONTOBJ OBJ_ANSI_FIXED_FONT = {
+	{OBJ_FONT, TRUE}, NULL, MWFONT_SYSTEM_FIXED
+};
+
+static MWFONTOBJ OBJ_ANSI_VAR_FONT = {
+	{OBJ_FONT, TRUE}, NULL, MWFONT_SYSTEM_VAR
+};
+
+static MWFONTOBJ OBJ_SYSTEM_FONT = {
+	{OBJ_FONT, TRUE}, NULL, MWFONT_SYSTEM_VAR
+};
+
+static MWFONTOBJ OBJ_DEVICE_DEFAULT_FONT = {
+	{OBJ_FONT, TRUE}, NULL, MWFONT_OEM_FIXED
+};
+
+static MWFONTOBJ OBJ_SYSTEM_FIXED_FONT = {
+	{OBJ_FONT, TRUE}, NULL, MWFONT_SYSTEM_FIXED
+};
+
+static MWFONTOBJ OBJ_DEFAULT_GUI_FONT = {
+	{OBJ_FONT, TRUE}, NULL, MWFONT_GUI_VAR
+};
+
+static struct hgdiobj *stockObjects[MAXSTOCKOBJECTS] = {
+	(struct hgdiobj *)&OBJ_WHITE_BRUSH,		/* WHITE_BRUSH*/
+	(struct hgdiobj *)&OBJ_LTGRAY_BRUSH,		/* LTGRAY_BRUSH*/
+	(struct hgdiobj *)&OBJ_GRAY_BRUSH,		/* GRAY_BRUSH*/
+	(struct hgdiobj *)&OBJ_DKGRAY_BRUSH,		/* DKGRAY_BRUSH*/
+	(struct hgdiobj *)&OBJ_BLACK_BRUSH,		/* BLACK_BRUSH*/
+	(struct hgdiobj *)&OBJ_NULL_BRUSH,		/* NULL_BRUSH*/
+	(struct hgdiobj *)&OBJ_WHITE_PEN,		/* WHITE_PEN*/
+	(struct hgdiobj *)&OBJ_BLACK_PEN,		/* BLACK_PEN*/
+	(struct hgdiobj *)&OBJ_NULL_PEN,		/* NULL_PEN*/
+	(struct hgdiobj *)NULL,
+	(struct hgdiobj *)&OBJ_OEM_FIXED_FONT,		/* OEM_FIXED_FONT*/
+	(struct hgdiobj *)&OBJ_ANSI_FIXED_FONT,		/* ANSI_FIXED_FONT*/
+	(struct hgdiobj *)&OBJ_ANSI_VAR_FONT,		/* ANSI_VAR_FONT*/
+	(struct hgdiobj *)&OBJ_SYSTEM_FONT,		/* SYSTEM_FONT*/
+	(struct hgdiobj *)&OBJ_DEVICE_DEFAULT_FONT,	/* DEVICE_DEFAULT_FONT*/
+	(struct hgdiobj *)NULL,				/* DEFAULT_PALETTE*/
+	(struct hgdiobj *)&OBJ_SYSTEM_FIXED_FONT,	/* SYSTEM_FIXED_FONT*/
+	(struct hgdiobj *)&OBJ_DEFAULT_GUI_FONT		/* DEFAULT_GUI_FONT*/
+};
+
+HGDIOBJ WINAPI
+GetStockObject(int nObject)
+{
+	HGDIOBJ		pObj;
+	MWFONTOBJ *	pFont;
+
+	if(nObject >= 0 && nObject < MAXSTOCKOBJECTS) {
+		pObj = stockObjects[nObject];
+
+		/* create stock fonts on first access*/
+		if(pObj->hdr.type == OBJ_FONT) {
+			pFont = (MWFONTOBJ *)pObj;
+			if(pFont->pfont == NULL) {
+				pFont->pfont = GdCreateFont(&scrdev,
+					pFont->name, 0, NULL);
+			}
+			return pObj;
+		}
+
+		/* implement multiple color schemes with
+		 * standard background brushes...
+		 */
+		switch(nObject) {
+		case LTGRAY_BRUSH:
+		case GRAY_BRUSH:
+			((MWBRUSHOBJ *)pObj)->color =GetSysColor(COLOR_BTNFACE);
+			break;
+		case DKGRAY_BRUSH:
+			((MWBRUSHOBJ *)pObj)->color =
+				GetSysColor(COLOR_BTNSHADOW);
+			break;
+		}
+		return pObj;
+	}
+	return NULL;
+}
+
+HGDIOBJ WINAPI
+SelectObject(HDC hdc, HGDIOBJ hObject)
+{
+	HGDIOBJ		objOrg;
+	MWBITMAPOBJ *	pb;
+
+	if(!hdc || !hObject)
+		return NULL;
+
+	switch(hObject->hdr.type) {
+	case OBJ_PEN:
+		objOrg = (HGDIOBJ)hdc->pen;
+		hdc->pen = (MWPENOBJ *)hObject;
+		break;
+	case OBJ_BRUSH:
+		objOrg = (HGDIOBJ)hdc->brush;
+		hdc->brush = (MWBRUSHOBJ *)hObject;
+		break;
+	case OBJ_FONT:
+		objOrg = (HGDIOBJ)hdc->font;
+		hdc->font = (MWFONTOBJ *)hObject;
+		break;
+	case OBJ_BITMAP:
+		/* must be memory dc to select bitmap*/
+		if(!(hdc->psd->flags&PSF_MEMORY))
+			return NULL;
+		objOrg = (HGDIOBJ)hdc->bitmap;
+
+		/* setup mem dc for drawing into bitmap*/
+		pb = (MWBITMAPOBJ *)hObject;
+
+		/* init memory context*/
+		if (!hdc->psd->MapMemGC(hdc->psd, pb->width, pb->height,
+			pb->planes, pb->bpp, pb->linelen, pb->size,
+			&pb->bits[0]))
+				return NULL;
+
+		hdc->bitmap = (MWBITMAPOBJ *)hObject;
+	    	break;
+#if UPDATEREGIONS
+	case OBJ_REGION:
+		/*objOrg = (HGDIOBJ)hdc->region;*/
+		objOrg = NULL;	/* FIXME? hdc->region is destroyed below*/
+		SelectClipRgn(hdc, (HRGN)hObject);
+		break;
+#endif
+	default:
+		return NULL;
+	}
+
+	return objOrg;
+}
+
+BOOL WINAPI
+DeleteObject(HGDIOBJ hObject)
+{
+	if(!hObject || hObject->hdr.stockobj)
+		return FALSE;
+	if(hObject->hdr.type == OBJ_FONT)
+		GdDestroyFont(((MWFONTOBJ *)hObject)->pfont);
+	if(hObject->hdr.type == OBJ_REGION)
+		GdDestroyRegion(((MWRGNOBJ *)hObject)->rgn);
+	GdItemFree(hObject);
+	return TRUE;
+}
+
+#if UPDATEREGIONS
+/* region is passed in client coords (win32 api doc bug)*/
+int WINAPI
+SelectClipRgn(HDC hdc, HRGN hrgn)
+{
+	return ExtSelectClipRgn(hdc, hrgn, RGN_COPY);
+}
+
+/*
+ * Select a user clip region into DC, recalculate final clipregion.
+ * Only a copy of the passed region is used.
+ */
+/* region is passed in client coords (win32 api doc bug)*/
+int WINAPI
+ExtSelectClipRgn(HDC hdc, HRGN hrgn, int fnMode)
+{
+	HRGN	newrgn;
+
+	if(!hdc)
+		return ERROR;
+	if(hdc->region != (MWRGNOBJ *)hrgn) {
+		/* combine region if not null*/
+		if(hrgn) {
+			newrgn = CreateRectRgn(0, 0, 0, 0);
+
+			/* 
+			 * Temporarily convert region from
+			 * client coords to screen coords, since
+			 * hwnd->update is kept in screen coords.
+			 */
+			OffsetRgn(hrgn, hdc->hwnd->clirect.left,
+				hdc->hwnd->clirect.top);
+
+			if(fnMode == RGN_COPY)
+				CombineRgn(newrgn, hrgn, NULL, fnMode);
+			else CombineRgn(newrgn, (HRGN)hdc->region, hrgn,fnMode);
+
+			/* convert passed region back to client coords*/
+			OffsetRgn(hrgn, -hdc->hwnd->clirect.left,
+				-hdc->hwnd->clirect.top);
+
+
+			hrgn = newrgn;
+		}
+		DeleteObject((HRGN)hdc->region);
+		hdc->region = (MWRGNOBJ *)hrgn;
+
+		/* force recalc of clipregion*/
+		cliphdc = NULL;
+		MwPrepareDC(hdc);
+	}
+	if(hrgn)
+		return ((MWRGNOBJ *)hrgn)->rgn->type;
+	return NULLREGION;
+}
+
+/* update region is returned in client coordinates*/
+int WINAPI
+GetUpdateRgn(HWND hwnd, HRGN hrgn, BOOL bErase)
+{
+	/* FIXME bErase*/
+	if(!hwnd)
+		return ERROR;
+
+	/* convert internal update region to client coords*/
+	GdOffsetRegion(hwnd->update, -hwnd->clirect.left, -hwnd->clirect.top);
+	GdCopyRegion(((MWRGNOBJ *)hrgn)->rgn, hwnd->update);
+	GdOffsetRegion(hwnd->update, hwnd->clirect.left, hwnd->clirect.top);
+	return hwnd->update->type;
+}
+#endif /* UPDATEREGIONS*/
+
+/* update rectangle is returned in client coords*/
+BOOL WINAPI
+GetUpdateRect(HWND hwnd, LPRECT lpRect, BOOL bErase)
+{
+	/* FIXME bErase*/
+	if(!hwnd)
+		return FALSE;
+#if UPDATEREGIONS
+	if(lpRect) {
+		*lpRect = hwnd->update->extents;
+		/* convert to client coords*/
+		ScreenToClient(hwnd, (LPPOINT)&lpRect->left);
+		ScreenToClient(hwnd, (LPPOINT)&lpRect->right);
+	}
+
+	/* return TRUE if update region is non-empty*/
+	return hwnd->update->type != NULLREGION;
+#else
+	GetClientRect(hwnd, lpRect);
+	return TRUE;
+#endif
+}
+
+HBRUSH WINAPI
+CreateSolidBrush(COLORREF crColor)
+{
+	MWBRUSHOBJ *hbr;
+
+	hbr = GdItemNew(MWBRUSHOBJ);
+	if(!hbr)
+		return NULL;
+	hbr->hdr.type = OBJ_BRUSH;
+	hbr->hdr.stockobj = FALSE;
+	hbr->style = BS_SOLID;
+	hbr->color = crColor;
+	return (HBRUSH)hbr;
+}
+
+HPEN WINAPI
+CreatePen(int nPenStyle, int nWidth, COLORREF crColor)
+{
+	MWPENOBJ *hpen;
+
+	/* fix: nWidth > 1*/
+	hpen = GdItemNew(MWPENOBJ);
+	if(!hpen)
+		return NULL;
+	hpen->hdr.type = OBJ_PEN;
+	hpen->hdr.stockobj = FALSE;
+	hpen->style = nPenStyle;
+	hpen->color = crColor;
+	return (HPEN)hpen;
+}
+
+HBITMAP WINAPI
+CreateCompatibleBitmap(HDC hdc, int nWidth, int nHeight)
+{
+	MWBITMAPOBJ *	hbitmap;
+	int		size;
+	int		linelen;
+
+	if(!hdc)
+		return NULL;
+
+	nWidth = MWMAX(nWidth, 1);
+	nHeight = MWMAX(nHeight, 1);
+
+	/* calc memory allocation size and linelen from width and height*/
+	if(!GdCalcMemGCAlloc(hdc->psd, nWidth, nHeight, 0, 0, &size, &linelen))
+		return NULL;
+
+	/* allocate gdi object*/
+	hbitmap = (MWBITMAPOBJ *)GdItemAlloc(sizeof(MWBITMAPOBJ)-1+size);
+	if(!hbitmap)
+		return NULL;
+	hbitmap->hdr.type = OBJ_BITMAP;
+	hbitmap->hdr.stockobj = FALSE;
+	hbitmap->width = nWidth;
+	hbitmap->height = nHeight;
+
+	/* create compatible with hdc*/
+	hbitmap->planes = hdc->psd->planes;
+	hbitmap->bpp = hdc->psd->bpp;
+	hbitmap->linelen = linelen;
+	hbitmap->size = size;
+
+	return (HBRUSH)hbitmap;
+}
+
+/* return NULL if no driver bitblit available*/
+HDC WINAPI
+CreateCompatibleDC(HDC hdc)
+{
+	HDC	hdcmem;
+	PSD	psd;
+	PSD	mempsd;
+
+	/* allow NULL hdc to mean screen*/
+	psd = hdc? hdc->psd: &scrdev;
+
+	/* allocate memory device, if driver doesn't blit will fail*/
+	mempsd = psd->AllocateMemGC(psd);
+	if(!mempsd)
+		return NULL;
+
+	/* allocate a DC for DesktopWindow*/
+	hdcmem = GetDCEx(NULL, NULL, DCX_DEFAULTCLIP);
+	if(!hdcmem) {
+		mempsd->FreeMemGC(mempsd);
+		return NULL;
+	}
+	hdcmem->psd = mempsd;
+
+	/* select in default bitmap to setup mem device parms*/
+	SelectObject(hdcmem, (HGDIOBJ)&default_bitmap);
+	return hdcmem;
+}
+
+BOOL WINAPI
+BitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight,
+	HDC hdcSrc, int nXSrc, int nYSrc, DWORD dwRop)
+{
+	HWND	hwnd;
+	POINT	dst, src;
+
+	if(!hdcDest || !hdcSrc)
+		return FALSE;
+	dst.x = nXDest;
+	dst.y = nYDest;
+	src.x = nXSrc;
+	src.y = nYSrc;
+
+	/* if src screen DC, convert coords*/
+	/* FIXME: src clipping isn't checked, only one set of cliprects also*/
+	if(!MwIsMemDC(hdcSrc) && MwIsClientDC(hdcSrc)) {
+		if(!(hwnd = MwPrepareDC(hdcSrc)))
+			return FALSE;
+		ClientToScreen(hwnd, &src);
+	}
+	/* if dst screen DC, convert coords and set clipping*/
+	/* FIXME: if dest is also screen, src clipping will be overwritten*/
+	if(!MwIsMemDC(hdcDest) && MwIsClientDC(hdcDest)) {
+		if(!(hwnd = MwPrepareDC(hdcDest)))
+			return FALSE;
+		ClientToScreen(hwnd, &dst);
+	}
+
+	GdBlit(hdcDest->psd, dst.x, dst.y, nWidth, nHeight,
+		hdcSrc->psd, src.x, src.y, dwRop);
+	return TRUE;
+}
+
+UINT WINAPI
+GetSystemPaletteEntries(HDC hdc,UINT iStartIndex,UINT nEntries,
+	LPPALETTEENTRY lppe)
+{
+	UINT		i;
+	MWPALENTRY	rgb;
+
+	/* currently, we only work for screen device*/
+	if(!hdc || hdc->psd != &scrdev)
+		return 0;
+
+	for(i=0; i<nEntries; ++i) {
+		if(!GdGetPalette(hdc->psd, i+iStartIndex, 1, &rgb))
+			break;
+		lppe->peRed = rgb.r;
+		lppe->peGreen = rgb.g;
+		lppe->peBlue = rgb.b;
+		lppe->peFlags = 0;
+		++lppe;
+	}
+	return i;
+}
+
+/* allow NULL hdc for scrdev*/
+int WINAPI
+GetDeviceCaps(HDC hdc, int nIndex)
+{
+	PSD	psd;
+
+	if (!hdc)
+		psd = &scrdev;
+	else psd = hdc->psd;
+
+	switch(nIndex) {
+	case HORZRES:
+		return psd->xvirtres;
+	case VERTRES:
+		return psd->yvirtres;
+	case BITSPIXEL:
+		return psd->bpp;
+	case PLANES:
+		return psd->planes;
+	case LOGPIXELSX:
+	case LOGPIXELSY:
+		return 96;
+	case SIZEPALETTE:
+		if (psd->bpp <= 8)
+			return psd->ncolors;
+		break;
+	}
+	return 0;
+}
diff -urN lib/microwindows/src/mwin/winlib/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/Makefile
--- lib/microwindows/src/mwin/winlib/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/Makefile	2005-02-21 16:03:41.000000000 +0100
@@ -0,0 +1,50 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+ifndef TOP
+TOP = ../..
+CONFIG = $(TOP)/config
+endif
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(MICROWIN), Y)
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME = libmwinlib.a
+LIBNAMESO = libmwinlib.so
+
+# List of objects to compile
+OBJS = draw3d.o ptinsid.o insetr.o fastfill.o graph3d.o mwuser.o
+
+ifneq ($(ARCH), ELKS)
+OBJS += button.o edit.o listbox.o progbar.o static.o combobox.o caret.o \
+	scrlbar.o medit.o
+endif
+
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
diff -urN lib/microwindows/src/mwin/winlib/button.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/button.c
--- lib/microwindows/src/mwin/winlib/button.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/button.c	2005-02-21 16:13:24.000000000 +0100
@@ -0,0 +1,898 @@
+#include "windows.h"
+#include "windowsx.h"
+#include "wintools.h"
+/*
+ * WINCTL Custom Control Library
+ * Push button Custom Control
+ *	This control implements a custom pushbutton control.
+ *
+ * 4/8/98 g haerr original version from control palette v2.00, Blaise Computing
+ */
+
+#define GET_PBSTATE(h)			(GetWindowWord(h, 0))
+#define GET_PBCAPTURE(h)		(GetWindowWord(h, 2))
+#define GET_PBWASINSIDE(h)		(GetWindowWord(h, 4))
+#define GET_PBDELETEFONT(h)		(GetWindowWord(h, 6))
+#define GET_PBFONT(h)			(GetWindowWord(h, 8))
+
+#define SET_PBSTATE(h,x)		(SetWindowWord(h, 0, x))
+#define SET_PBCAPTURE(h,x)		(SetWindowWord(h, 2, x))
+#define SET_PBWASINSIDE(h,x)		(SetWindowWord(h, 4, x))
+#define SET_PBDELETEFONT(h,x)		(SetWindowWord(h, 6, x))
+#define SET_PBFONT(h,x)			(SetWindowWord(h, 8, x))
+
+#define PARENT(hwnd)		((HWND)GetWindowLong(hwnd,GWL_HWNDPARENT))
+
+/* Internal state variable bit positions				*/
+#define PUSH_UP		0x0000
+#define PUSH_DOWN	0x0001	/* Button is down			*/
+#define PUSH_FOCUS	0x0002	/* Button is focused			*/
+#define PUSH_DISABLED	0x0004	/* Button is disabled			*/
+#define PUSH_DEFAULT	0x0008	/* Button is currently a default	*/
+#define PUSH_CHECKED	0x0010
+
+/* Push Button states */
+#define PBS_UP		0x0000			/* Normal button state.	*/
+#define PBS_FOCUSDOWN	0x0001			/* Button pressed.	*/
+#define PBS_FOCUSUP	0x0002			/* Focused state.	*/
+#define PBS_DISABLED	0x0004			/* Disabled state.	*/
+#define PBS_DEFAULT	0x0008			/* Default state.	*/
+#define PBS_CHECKED	0x0010			/* checked state.	*/
+
+#define WM_PAINT_SPECIAL	WM_PAINT
+#define HANDLE_WM_PAINT_SPECIAL(hwnd, wParam, lParam, fn) \
+    ((fn)((hwnd),(HDC)(wParam)), 0L)
+
+/* BOOL Cls_OnGetState( HWND hwnd); */
+#define HANDLE_BM_GETSTATE(hwnd, wParam, lParam, fn) ((fn)(hwnd))
+#define FORWARD_BM_GETSTATE(hwnd) \
+	(LONG)(fn)((hwnd), BM_GETSTATE, (WPARAM)0, (LPARAM)0)
+
+/* void Cls_OnSetState( HWND hwnd, WORD wState); */
+#define HANDLE_BM_SETSTATE( hwnd, wParam, lParam, fn) \
+	((fn)((hwnd), (WORD)wParam), 0)
+#define FORWARD_BM_SETSTATE( hwnd, wState) \
+	(fn)((hwnd), BM_SETSTATE, (WPARAM)wState, (LPARAM)0)
+
+/* void Cls_OnSetStyle( HWND hwnd, WORD style, BOOL bRedraw); */
+#define HANDLE_BM_SETSTYLE( hwnd, wParam, lParam, fn) \
+	((fn)((hwnd), (WORD)wParam, (BOOL)LOWORD(lParam)), 0)
+#define FORWARD_BM_SETSTYLE( hwnd, style, bRedraw, fn) \
+	(fn)((hwnd), BM_SETSTYLE, (WPARAM)style, MAKELPARAM(bRedraw, 0))
+
+/* entry points*/
+void WINAPI		CheckRadioButton(HWND hDlg, int nIDFirst,int nIDLast,
+				int nIDCheckButton);
+
+/* local procs*/
+static void WINAPI	cenButton_FnEnd( HWND, WORD);
+static WORD WINAPI	cenButton_FnStart( HWND);
+static BOOL WINAPI	cenButton_OnCreate( HWND, LPCREATESTRUCT);
+/*static void WINAPI	cenButton_OnDestroy( HWND);*/
+/*static void WINAPI	cenButton_OnEnable( HWND, BOOL);*/
+static BOOL WINAPI	cenButton_OnEraseBkgnd( HWND, HDC);
+/*static UINT WINAPI	cenButton_OnGetDlgCode( HWND, LPMSG);*/
+static LONG WINAPI	cenButton_OnGetState( HWND);
+/*static void WINAPI	cenButton_OnKey( HWND, UINT, BOOL, int, UINT);*/
+static void WINAPI	cenButton_OnKillFocus( HWND, HWND);
+static void WINAPI	cenButton_OnLButtonDown( HWND, BOOL, UINT, UINT, UINT);
+static void WINAPI	cenButton_OnLButtonUp( HWND, UINT, UINT, UINT);
+static void WINAPI	cenButton_OnMouseMove( HWND, UINT, UINT, UINT);
+static void WINAPI	cenButton_OnPaint( HWND, HDC);
+static void WINAPI 	DrawPushButton(HWND hwnd,HDC hDCwParam,UINT wEnumState,
+				DWORD dwStyle);
+static void WINAPI 	DrawGroupBox(HWND hwnd,HDC hDCwParam, DWORD dwStyle);
+static void WINAPI	cenButton_OnSetFocus( HWND, HWND);
+static void WINAPI	cenButton_OnSetStyle( HWND, WORD, BOOL);
+static void WINAPI	cenButton_OnSetState( HWND, WORD);
+static void WINAPI	cenButton_SetState( HWND, WORD, BOOL);
+static void WINAPI	cenButton_OnSetText( HWND, LPCSTR);
+
+static void WINAPI
+cenButton_FnEnd(
+HWND		hwnd,
+WORD		wState)
+{
+	if( wState != GET_PBSTATE( hwnd)) {
+		if( IsWindowVisible( hwnd))
+			UpdateWindow( hwnd);
+	}
+}
+
+static WORD WINAPI
+cenButton_FnStart(
+HWND		hwnd)
+{
+	return GET_PBSTATE( hwnd);
+}
+
+static BOOL WINAPI
+cenButton_OnCreate(
+HWND			hwnd,
+LPCREATESTRUCT	lpCreate)
+{
+	/* Set initial states */
+	/*SET_PBDELETEFONT( hwnd, FALSE);*/
+    	/*SET_PBFONT( hwnd, NULL);*/
+	SET_PBSTATE( hwnd, PUSH_UP );
+	SET_PBCAPTURE( hwnd, FALSE );
+	SET_PBWASINSIDE( hwnd, FALSE );
+
+	if ((lpCreate->style & 0x0f) == BS_DEFPUSHBUTTON)
+		cenButton_SetState( hwnd, PUSH_DEFAULT, TRUE );
+
+	if (lpCreate->style & WS_DISABLED)
+		cenButton_SetState( hwnd, PUSH_DISABLED, TRUE );
+
+	return( TRUE);
+}
+
+#if 0
+static void WINAPI
+cenButton_OnDestroy(
+HWND		hwnd)
+{
+	if( GET_PBDELETEFONT( hwnd)) {
+		DeleteObject( GET_PBFONT( hwnd));
+		SET_PBDELETEFONT( hwnd, FALSE);
+	}
+}
+
+static void WINAPI
+cenButton_OnEnable(
+HWND		hwnd,
+BOOL		bEnable)
+{
+	WORD		wState;
+
+	wState = cenButton_FnStart( hwnd);
+	cenButton_SetState( hwnd, PUSH_DISABLED, !bEnable);
+	cenButton_FnEnd( hwnd, wState);
+}
+#endif
+
+static BOOL WINAPI
+cenButton_OnEraseBkgnd(
+HWND		hwnd,
+HDC			hdc)
+{
+	/* Background is erased at WM_PAINT time, so return TRUE*/
+	return TRUE;
+}
+
+#if 0
+static UINT WINAPI
+cenButton_OnGetDlgCode(
+HWND	hwnd,
+LPMSG 	lpMsg)
+{
+	/* WM_GETDLGCODE is sent by the dialog manager to find	   */
+	/* what type/style of control is responding and/or to	   */
+	/* determine what keystrokes the control wants to process  */
+	/* itself.	In this case, the pushbutton identifies itself */
+	/* and also indicates whether it is currently the default  */
+	/* pushbutton.											   */
+
+	/*return( DLGC_BUTTON | ((GET_PBSTATE( hwnd) & PUSH_DEFAULT) ?
+				DLGC_DEFPUSHBUTTON : DLGC_UNDEFPUSHBUTTON));*/
+	return( DLGC_BUTTON);
+}
+#endif
+
+static LONG WINAPI
+cenButton_OnGetState(
+HWND		hwnd)
+{
+	/* BM_GETSTATE is sent to enquire about the state of the   */
+	/* control.	 It returns TRUE if the button is in the down  */
+	/* state.												   */
+
+	return( ( GET_PBSTATE( hwnd) & PUSH_DOWN) == PUSH_DOWN);
+}
+
+#if 0
+static void WINAPI
+cenButton_OnKey(
+HWND		hwnd,
+UINT		vk,
+BOOL		bDown,
+int			cRepeat,
+UINT		flag)
+{
+	WORD		wState;
+
+	wState = cenButton_FnStart( hwnd);
+	if (bDown) {
+	 	/* WM_KEYDOWN is sent when a non-system key is pressed.	   */
+		/* If a spacebar is detected and the previous key state	   */
+		/* was up, then the control should switch to the down	   */
+		/* state.												   */
+
+		if ( (vk == ' ') && !(HIBYTE(flag) & 0x40) )
+			cenButton_SetState( hwnd, PUSH_DOWN, TRUE );
+	}
+	else {
+		/* WM_KEYUP is sent when a non-system key is released.	   */
+		/* If a space bar is detected, change to the up state.	If */
+		/* the control is the focused control, send the BN_CLICKED */
+		/* notification message.								   */
+
+		if ( vk == ' ' )
+		{	cenButton_SetState( hwnd, PUSH_DOWN, FALSE );
+
+			if (GET_PBSTATE( hwnd) & PUSH_FOCUS) {
+				FORWARD_WM_COMMAND( PARENT( hwnd), GetDlgCtrlID( hwnd),
+					hwnd, BN_CLICKED, SendMessage);
+				if(!IsWindow(hwnd))
+					return;
+			}
+		}
+	}
+	cenButton_FnEnd( hwnd, wState);
+}
+#endif
+
+static void WINAPI
+cenButton_OnKillFocus(
+HWND		hwnd,
+HWND		hwndNewFocus)
+{
+	WORD		wState;
+
+	wState = cenButton_FnStart( hwnd);
+	cenButton_SetState( hwnd, PUSH_FOCUS, FALSE );
+	cenButton_FnEnd( hwnd, wState);
+}
+
+static void WINAPI
+cenButton_OnLButtonDown(
+HWND		hwnd,
+BOOL		bDblClick,
+UINT		x,
+UINT		y,
+UINT		keyState)
+{
+	WORD		wState;
+
+	wState = cenButton_FnStart( hwnd);
+	/* capture the mouse*/
+	SetCapture( hwnd );
+	/* set focus to ourself*/
+	SetFocus( hwnd );
+	SET_PBCAPTURE( hwnd, TRUE );
+	SET_PBWASINSIDE( hwnd, TRUE );
+	/* set down state*/
+	cenButton_SetState( hwnd, PUSH_DOWN, TRUE );
+	cenButton_FnEnd( hwnd, wState);
+}
+
+static void WINAPI
+cenButton_OnLButtonUp(
+HWND		hwnd,
+UINT		x,
+UINT		y,
+UINT		keys)
+{
+	WORD		wState;
+	DWORD		dwStyle;
+ 
+	dwStyle = GetWindowLong(hwnd, GWL_STYLE);
+	wState = cenButton_FnStart( hwnd);
+
+	/* only draw up state if we captured mouse*/
+	if(GetCapture() == hwnd)
+		cenButton_SetState( hwnd, PUSH_DOWN, FALSE );
+	/* release mouse capture*/
+	ReleaseCapture();
+
+	/* if cursor is inside control, send clicked notification to parent*/
+	if (GET_PBWASINSIDE( hwnd)) {
+		switch((int)(dwStyle & 0x0f)) {
+	        case BS_AUTOCHECKBOX:
+			SendMessage(hwnd,BM_SETCHECK,(wState & PBS_CHECKED)?0:1,0L);
+			break;
+	        case BS_AUTORADIOBUTTON:
+			CheckRadioButton(PARENT(hwnd),0,0xffff,hwnd->id);
+			break;
+		}
+		FORWARD_WM_COMMAND( PARENT( hwnd), GetDlgCtrlID( hwnd), hwnd,
+			BN_CLICKED, SendMessage);
+		if(!IsWindow(hwnd))
+			return;
+	}
+
+	SET_PBCAPTURE( hwnd, FALSE );
+	SET_PBWASINSIDE( hwnd, FALSE );
+	cenButton_FnEnd( hwnd, wState);
+}
+
+static void WINAPI
+cenButton_OnMouseMove(
+HWND		hwnd,
+UINT		x,
+UINT		y,
+UINT		keys)
+{
+	/* WM_MOUSEMOVE is sent at every discernable mouse		   */
+	/* movement.  It is necessary to detect this because if	   */
+	/* the mouse has been captured (because of a button down   */
+	/* message), the location of the cursor needs to be		   */
+	/* tracked.	 If it moves out of the confines of the		   */
+	/* control, the control should change to the focus/up	   */
+	/* state (and retain capture.)	If the cursor then moves   */
+	/* back into the control, change back to the down state.   */
+
+	WORD		wState;
+	DWORD		dwStyle;
+
+	wState = cenButton_FnStart( hwnd);
+	dwStyle = GetWindowLong(hwnd, GWL_STYLE);
+	if( GET_PBCAPTURE( hwnd)) {
+		if( !PtInsideWindow( hwnd, x, y) ) {
+			if( GET_PBWASINSIDE( hwnd)) {
+				cenButton_SetState( hwnd, PUSH_DOWN, FALSE);
+				SET_PBWASINSIDE( hwnd, FALSE );
+			}
+		} else {
+			if( !GET_PBWASINSIDE( hwnd) ) {
+				cenButton_SetState( hwnd, PUSH_DOWN, TRUE );
+				SET_PBWASINSIDE( hwnd, TRUE );
+			}
+		}
+	}
+	cenButton_FnEnd( hwnd, wState);
+}
+
+static void WINAPI
+cenButton_OnPaint(
+HWND		hwnd,
+HDC		hDCwParam)
+{
+	UINT		wEnumState;
+	DWORD		dwStyle;
+
+	if( GET_PBSTATE( hwnd) & PUSH_DISABLED)
+		wEnumState = PBS_DISABLED;
+	else if( GET_PBSTATE( hwnd) & PUSH_DOWN)
+		wEnumState = PBS_FOCUSDOWN;
+	else if( GET_PBSTATE( hwnd) & PUSH_CHECKED)
+		wEnumState = PBS_CHECKED;
+	else
+	{
+		if( GET_PBSTATE( hwnd) & PUSH_FOCUS)
+			wEnumState = PBS_FOCUSUP;
+		else
+			wEnumState = PBS_UP;
+		if( GET_PBSTATE( hwnd) & PUSH_DEFAULT)
+			wEnumState |= PBS_DEFAULT;
+	}
+
+	/* common draw code for button and checkbox*/
+	dwStyle = GetWindowLong(hwnd, GWL_STYLE);
+	switch((int)(dwStyle & 0x0f)) {
+	case BS_GROUPBOX:
+		DrawGroupBox( hwnd, hDCwParam, dwStyle);
+		break;
+	default:
+		DrawPushButton( hwnd, hDCwParam, wEnumState, dwStyle);
+	}
+}
+
+static void WINAPI
+DrawPushButton(HWND hwnd,HDC hDCwParam,UINT wEnumState,DWORD dwStyle)
+{
+	HDC		hdc;
+	HBRUSH		hNewBrush;
+	RECT		rect;
+	RECT		rectClient;
+	RECT		rectSave;
+	RECT		rc;
+	int		iFaceOffset = 0;
+	INT		uiHeight;
+	INT		uiWidth;
+	COLORREF	crOld;
+	COLORREF	crBkOld;
+	int		oldBkMode;
+	HFONT		hNewFont;
+	HFONT		hOldFont;
+	HPEN		hOldPen;
+	COLORREF	hOldColor;
+	PAINTSTRUCT	ps;
+	char		buf[256];
+#define uiWidthFrame	0
+#define uiWidthShadow	2
+
+	hdc = BeginPaint(hwnd, &ps);
+	if(!hdc)
+		goto Return;
+
+	GetWindowText(hwnd, buf, sizeof(buf));
+	GetClientRect( hwnd, &rectClient );
+	uiWidth	= rectClient.right - rectClient.left;
+	uiHeight = rectClient.bottom - rectClient.top;
+
+	hNewBrush = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
+	crOld = SetTextColor( hdc, GetSysColor( COLOR_BTNTEXT));
+	crBkOld = SetBkColor( hdc, GetSysColor( COLOR_BTNFACE));
+
+	rc = rectClient;
+	switch((int)(dwStyle & 0x0f)) {
+	case BS_PUSHBUTTON:
+	case BS_DEFPUSHBUTTON:
+		if( wEnumState & PBS_FOCUSDOWN) {
+			Draw3dBox(hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
+				GetSysColor(COLOR_WINDOWFRAME), GetSysColor(COLOR_WINDOWFRAME));
+			InsetR(&rc, 1, 1);
+			Draw3dBox(hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
+				GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNSHADOW));
+			InsetR(&rc, 1, 1);
+			FastFillRect(hdc, &rc, GetSysColor(COLOR_BTNFACE));
+			iFaceOffset = 1;
+		} else {
+			if(wEnumState & PBS_DEFAULT) {
+				Draw3dBox(hdc, rc.left, rc.top,
+					rc.right-rc.left, rc.bottom-rc.top,
+					GetSysColor(COLOR_WINDOWFRAME),
+					GetSysColor(COLOR_WINDOWFRAME));
+				InsetR(&rc, 1, 1);
+			}
+			Draw3dBox(hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
+				GetSysColor(COLOR_BTNHIGHLIGHT),GetSysColor(COLOR_WINDOWFRAME));
+			InsetR(&rc, 1, 1);
+			Draw3dBox(hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
+				GetSysColor(COLOR_3DLIGHT), GetSysColor(COLOR_BTNSHADOW));
+			InsetR(&rc, 1, 1);
+			FastFillRect(hdc, &rc, GetSysColor(COLOR_BTNFACE));
+			iFaceOffset = 0;
+		}
+		break;
+
+	case BS_CHECKBOX:
+	case BS_AUTOCHECKBOX:
+		FastFillRect(hdc, &rc, GetSysColor(COLOR_BTNFACE));
+		/*rc.left += 2;*/
+		/*rc.top += 2;*/
+		rc.right = rc.left + 12;
+		rc.bottom = rc.top + 12;
+		/*Draw3dBox(hdc, rc.left, rc.top, 8, 8,
+			GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_3DLIGHT));*/
+		Draw3dInset(hdc, rc.left, rc.top, 12, 12);
+		InsetR(&rc, 2, 2);
+		FastFillRect(hdc, &rc, GetSysColor(COLOR_BTNHIGHLIGHT));
+		iFaceOffset = 1;
+		if(wEnumState & PBS_CHECKED) {
+			MoveToEx(hdc, rc.left, rc.top,NULL);
+			LineTo(hdc, rc.right, rc.bottom);
+			MoveToEx(hdc, rc.left, rc.bottom,NULL);
+			LineTo(hdc, rc.right, rc.top);
+		}
+		break;
+
+       	case BS_AUTORADIOBUTTON:
+        case BS_RADIOBUTTON:
+		FastFillRect(hdc, &rc, GetSysColor(COLOR_BTNFACE));
+		rc.left = 0;
+		rc.top += 1;
+		rc.right = rc.left + 10;
+		rc.bottom = rc.top + 10;
+
+		SelectObject(hdc, GetStockObject(NULL_BRUSH));
+		hOldPen = SelectObject(hdc, CreatePen(PS_SOLID, 1,
+			GetSysColor(COLOR_BTNSHADOW)));
+		SelectObject(hdc, GetStockObject(WHITE_BRUSH));
+		Ellipse(hdc,rc.left,rc.top, rc.right,rc.bottom);
+		InsetR(&rc, 1, 1);
+
+		SelectObject(hdc, GetStockObject(WHITE_BRUSH));
+		DeleteObject(SelectObject(hdc, 
+			CreatePen(PS_SOLID, 1,GetSysColor(COLOR_WINDOWFRAME))));
+		Ellipse(hdc,rc.left,rc.top, rc.right,rc.bottom);
+		DeleteObject(SelectObject(hdc, hOldPen));
+
+		iFaceOffset = 0;
+		if(wEnumState & PBS_CHECKED)
+			Ellipse(hdc, rc.left+2, rc.top+2, rc.right-2,
+					rc.bottom-2);
+		break;
+	}
+
+	/*
+	 * draw text
+	 */
+	if(buf[ 0]) {
+		hNewFont = GetStockObject( DEFAULT_GUI_FONT);
+		hOldFont = SelectObject( hdc, hNewFont);
+
+		/* calculate text bounding rect*/
+		rect.left = 0;
+		rect.top = 0;
+		DrawText( hdc, buf, -1, &rect, DT_CALCRECT | DT_LEFT |
+			DT_SINGLELINE | DT_TOP);
+		rectSave = rect;
+
+		/*
+		 * calculate text draw location
+		 */
+		switch((int)(dwStyle & (BS_LEFT|BS_CENTER|BS_RIGHT))) {
+		case BS_CENTER:
+		default:
+			rect.left = (uiWidth - (rect.right - rect.left)) / 2
+				+ iFaceOffset;
+			break; 
+		case BS_LEFT:
+			rect.left = uiWidthFrame + uiWidthShadow + 2
+				+ iFaceOffset;
+			break;
+		case BS_RIGHT:
+			rect.left = (rect.right - rect.left) + uiWidthFrame
+				+ uiWidthShadow + 4 + iFaceOffset;
+			break;
+		}
+
+		switch((int)(dwStyle & 0x0f)) {
+		case BS_CHECKBOX:
+		case BS_AUTOCHECKBOX:
+		case BS_AUTORADIOBUTTON:
+		case BS_RADIOBUTTON:
+			rect.left = 12;
+			break;
+		}
+
+		rect.right += rect.left - rectSave.left;
+
+		switch((int)(dwStyle & (BS_TOP|BS_VCENTER|BS_BOTTOM))) {
+		case BS_VCENTER:
+		default:
+			rect.top = (uiHeight - (rect.bottom - rect.top)) / 2
+				+ iFaceOffset;
+			break;
+		case BS_TOP:
+			rect.top = 2 + uiWidthFrame + uiWidthShadow
+				+ iFaceOffset;
+			break;
+		case BS_BOTTOM:
+			rect.top = uiHeight - uiWidthFrame - uiWidthShadow -
+				(rect.bottom - rect.top) - 1 + iFaceOffset;
+			break;
+		}
+		switch((int)(dwStyle & 0x0f)) {
+		case BS_CHECKBOX:
+		case BS_AUTOCHECKBOX:
+		case BS_AUTORADIOBUTTON:
+		case BS_RADIOBUTTON:
+			rect.top = 0;
+			break;
+		}
+		rect.bottom += rect.top - rectSave.top;
+
+		oldBkMode = SetBkMode( hdc, TRANSPARENT);
+		if(wEnumState & PBS_DISABLED)
+			hOldColor = SetTextColor( hdc,
+				GetSysColor( COLOR_GRAYTEXT));
+		else
+			hOldColor = SetTextColor( hdc,
+				GetSysColor( COLOR_BTNTEXT));
+
+		DrawText( hdc, buf, -1, &rect,DT_LEFT | DT_SINGLELINE | DT_TOP);
+
+		SetBkMode( hdc, oldBkMode);
+		SetTextColor( hdc, hOldColor);
+		SelectObject( hdc, hOldFont);
+	}
+
+#if 0
+	if( (!(wEnumState&PBS_CHECKED) && (wEnumState&PBS_FOCUSDOWN)) || 
+						(wEnumState & PBS_FOCUSUP)) {
+		rect = rectClient;
+		uiWidth = uiWidthFrame + uiWidthShadow + 2;
+		rect.left += uiWidth;
+		rect.top += uiWidth;
+		rect.right -= uiWidth;
+		rect.bottom -= uiWidth;
+		if((dwStyle & (BS_FLAT|BS_NOFOCUSRECT)) == 0)
+			DrawFocusRect( hdc, &rect);
+	}
+#endif
+
+	SetTextColor( hdc, crOld);
+	SetBkColor( hdc, crBkOld);
+
+Return:
+	EndPaint(hwnd, &ps);
+}
+
+static void WINAPI
+cenButton_OnSetFocus(
+HWND		hwnd,
+HWND		hwndOldFocus)
+{
+	/* WM_SETFOCUS is sent when the user clicks on the control */
+	/* or when the dialog manager determines that a keystroke  */
+	/* should cause the control to be focused.	This affects   */
+	/* the appearance of the control so the state is saved for */
+	/* future drawing.										   */
+
+	WORD		wState;
+
+	wState = cenButton_FnStart( hwnd);
+	/*if(!IsWindowEnabled(hwnd))
+		cenButton_SetState( hwnd, PUSH_FOCUS, TRUE );*/
+	cenButton_FnEnd( hwnd, wState);
+}
+
+static void WINAPI
+cenButton_OnSetStyle(
+HWND		hwnd,
+WORD		style,
+BOOL		bRedraw)
+{
+	WORD		wState;
+
+	wState = cenButton_FnStart( hwnd);
+	cenButton_SetState( hwnd, PUSH_DEFAULT,
+		(style & 0x0f) == BS_DEFPUSHBUTTON);
+	cenButton_FnEnd( hwnd, wState);
+}
+
+static void WINAPI
+cenButton_OnSetState(
+HWND		hwnd,
+WORD		wState)
+{
+	WORD		wStateOld;
+
+	wStateOld = cenButton_FnStart( hwnd);
+	cenButton_SetState( hwnd, PUSH_DOWN, (wState ? TRUE : FALSE ) );
+	cenButton_FnEnd( hwnd, wStateOld);
+}
+
+static void WINAPI
+cenButton_SetState(
+HWND	hwnd,
+WORD	wState,
+BOOL	bEnable )
+{
+	/* Turn on/off state bits according to the bEnable flag.  If the   */
+	/* new state is different, invalidate the client window so that	   */
+	/* the proper bitmap is displayed.								   */
+
+	WORD	wNewState;
+	WORD	wOldState;
+	RECT	rectClient;
+
+	wOldState = GET_PBSTATE( hwnd);
+	wNewState = (bEnable ? (wOldState | wState) : (wOldState & ~wState));
+
+	if (wOldState != wNewState)
+	{	SET_PBSTATE( hwnd, wNewState );
+		GetClientRect(hwnd, &rectClient);
+		InvalidateRect(hwnd, &rectClient, FALSE);
+	}
+}
+
+#if 0
+static void WINAPI
+cenButton_OnSetFont(
+HWND		hwnd,
+HFONT		hFont,
+BOOL		bRedraw)
+{
+	BOOL		bDeleteFont = FALSE;
+	HFONT		hFontNew = 0;
+	LOGFONT		logFont;
+
+	/* create a thin font*/
+	if( GetObject( hFont, sizeof( logFont), &logFont) != 0) {
+		if( logFont.lfWeight != FW_NORMAL) {
+			logFont.lfWeight = FW_NORMAL;
+			if( ( hFontNew = CreateFontIndirect( &logFont)) != 0) {
+				hFont = hFontNew;
+				bDeleteFont = TRUE;
+			}
+		}
+	}
+
+	if( GET_PBDELETEFONT( hwnd))
+		DeleteObject( GET_PBFONT( hwnd));
+
+	SET_PBDELETEFONT( hwnd, bDeleteFont);
+	SET_PBFONT( hwnd, hFont);
+
+	FORWARD_WM_SETFONT( hwnd, hFont, bRedraw, DefWindowProc);
+}
+#endif
+
+static void WINAPI
+cenButton_OnSetText(
+HWND		hwnd,
+LPCSTR		lpszText)
+{
+	/* WM_SETTEXT is sent to change the text of the button	   */
+	/* control.	 In this case we allow the default window proc */
+	/* to handle the message first.	 But this only affects the */
+	/* internal Windows data structure of the control, it does */
+	/* not display the change.	To do this we invalidate and   */
+	/* update the client area of the control which displays	   */
+	/* the new text.										   */
+
+	FORWARD_WM_SETTEXT( hwnd, lpszText, DefWindowProc);
+	InvalidateRect( hwnd, NULL, FALSE);
+	UpdateWindow( hwnd);
+}
+
+LRESULT CALLBACK
+cenButtonWndFn(
+HWND	hwnd,
+UINT	message,
+WPARAM	wParam,
+LPARAM	lParam)
+{
+	/* This is the window proc for the pushbutton control.	Most of	   */
+	/* the drawing is accomplished in the DrawPushButton() function. */
+	/* The code below is mainly concerned with the keyboard and mouse  */
+	/* events that the control detects.								   */
+
+	switch( message) {
+	HANDLE_MSG( hwnd, WM_CREATE, cenButton_OnCreate);
+	/*HANDLE_MSG( hwnd, WM_ENABLE, cenButton_OnEnable);*/
+	HANDLE_MSG( hwnd, WM_SETFOCUS, cenButton_OnSetFocus);
+	HANDLE_MSG( hwnd, WM_KILLFOCUS, cenButton_OnKillFocus);
+	HANDLE_MSG( hwnd, WM_LBUTTONDOWN, cenButton_OnLButtonDown);
+	HANDLE_MSG( hwnd, WM_LBUTTONDBLCLK, cenButton_OnLButtonDown);
+	HANDLE_MSG( hwnd, WM_LBUTTONUP, cenButton_OnLButtonUp);
+	HANDLE_MSG( hwnd, WM_MOUSEMOVE, cenButton_OnMouseMove);
+	/*HANDLE_MSG( hwnd, WM_KEYDOWN, cenButton_OnKey);*/
+	/*HANDLE_MSG( hwnd, WM_KEYUP, cenButton_OnKey);*/
+	HANDLE_MSG( hwnd, WM_ERASEBKGND, cenButton_OnEraseBkgnd);
+	HANDLE_MSG( hwnd, WM_PAINT_SPECIAL, cenButton_OnPaint);
+	/*HANDLE_MSG( hwnd, WM_GETDLGCODE, cenButton_OnGetDlgCode);*/
+	HANDLE_MSG( hwnd, BM_SETSTYLE, cenButton_OnSetStyle);
+	HANDLE_MSG( hwnd, BM_GETSTATE, cenButton_OnGetState);
+	HANDLE_MSG( hwnd, BM_SETSTATE, cenButton_OnSetState);
+	/*HANDLE_MSG( hwnd, WM_DESTROY, cenButton_OnDestroy);*/
+	/*HANDLE_MSG( hwnd, WM_SETFONT, cenButton_OnSetFont);*/
+	HANDLE_MSG( hwnd, WM_SETTEXT, cenButton_OnSetText);
+
+	case BM_GETCHECK:
+#if 0
+ 		return cenButton_OnGetState(hwnd);
+#else 
+		return( ( GET_PBSTATE(hwnd) & PUSH_CHECKED) == PUSH_CHECKED);
+#endif
+
+	case BM_SETCHECK:
+#if 0
+		cenButton_OnSetState(hwnd, (WORD)wParam);
+#else
+{
+		WORD		wStateOld;
+
+		wStateOld = cenButton_FnStart( hwnd);
+		cenButton_SetState( hwnd, PUSH_CHECKED,
+			((WORD)wParam ? TRUE : FALSE) );
+		cenButton_FnEnd( hwnd, wStateOld);
+}
+#endif
+		return 0;
+	}
+
+	return DefWindowProc( hwnd, message, wParam, lParam);
+}
+
+/* backwards compatibility*/
+int WINAPI
+MwButtonRegister(HINSTANCE hInstance)
+{
+	return MwRegisterButtonControl(hInstance);
+}
+
+int WINAPI
+MwRegisterButtonControl(HINSTANCE hInstance)
+{
+	WNDCLASS	wc;
+
+	wc.style	= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
+	wc.lpfnWndProc	= (WNDPROC)cenButtonWndFn;
+	wc.cbClsExtra	= 0;
+	wc.cbWndExtra	= 10;
+	wc.hInstance	= hInstance;
+	wc.hIcon	= NULL;
+	wc.hCursor	= 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground= GetStockObject(LTGRAY_BRUSH);
+	wc.lpszMenuName	= NULL;
+	wc.lpszClassName= "BUTTON";
+
+	return RegisterClass(&wc);
+}
+
+static void WINAPI
+DrawGroupBox(HWND hwnd,HDC hDCwParam,DWORD dwStyle)
+{
+	HDC		hdc;
+	HFONT 		hFont;
+	RECT		rcClient;
+	RECT		rcText;
+	RECT		rc;
+	PAINTSTRUCT	ps;
+	char		buf[256];
+	HPEN		hPenTop, hPenBottom, holdPen;
+	COLORREF 	crTop,crBottom;
+
+
+	hdc = BeginPaint(hwnd, &ps);
+	if(!hdc)
+		goto Return;
+
+	GetWindowText(hwnd, buf, sizeof(buf));
+	GetClientRect( hwnd, &rcClient );
+
+	hFont = GetStockObject( DEFAULT_GUI_FONT);
+	if (hFont)
+		hFont = SelectObject(hdc,hFont);
+
+	rc.left = 0;
+	rc.top = 0;
+	DrawText( hdc, buf, -1, &rc, DT_CALCRECT);
+
+	if(buf[ 0]) {
+		SetTextColor(hdc,GetSysColor(COLOR_WINDOWTEXT));
+		SetBkMode(hdc,TRANSPARENT);
+		SetRect(&rcText,8,2,rc.right+8,rc.bottom+2);
+		DrawText(hdc,buf,-1,&rcText,DT_CENTER);
+	}
+
+	crTop=GetSysColor(COLOR_BTNHIGHLIGHT);
+	crBottom=GetSysColor(COLOR_BTNSHADOW);
+
+	hPenTop = CreatePen( PS_SOLID, 1, crTop);
+	hPenBottom = CreatePen( PS_SOLID, 1, crBottom);
+	holdPen = SelectObject( hdc, hPenTop);
+
+	MoveToEx(hdc,0,rc.bottom/2,NULL);
+
+	if(buf[ 0]) {
+		LineTo(hdc,5,rc.bottom/2);
+		MoveToEx(hdc,rc.right+11,rc.bottom/2,NULL);
+		LineTo(hdc,rcClient.right-1,rc.bottom/2);
+	}
+	else
+		LineTo(hdc,rcClient.right-1,rc.bottom/2);
+
+	LineTo(hdc,rcClient.right-1,rcClient.bottom-1);
+
+	SelectObject( hdc, hPenBottom);
+	LineTo(hdc,rcClient.left,rcClient.bottom-1);
+	LineTo(hdc,rcClient.left,rc.bottom/2);
+
+	SelectObject( hdc, holdPen);
+	DeleteObject( hPenTop);
+	DeleteObject( hPenBottom);
+
+	if (hFont)
+		SelectObject(hdc,hFont);
+
+Return:
+	EndPaint(hwnd, &ps);
+}
+
+/* temporarily here, should move to winuser.c*/
+void WINAPI
+CheckRadioButton(HWND hDlg, int nIDFirst,int nIDLast,int nIDCheckButton)
+{
+	HWND	hWndCheck,hWndTemp;
+	DWORD 	dwStyle;
+
+	if (!(hWndCheck = GetDlgItem(hDlg,nIDCheckButton)))
+	    return;
+
+	for(hWndTemp=hDlg->children; hWndTemp; hWndTemp=hWndTemp->siblings) {
+		if(hWndCheck == hWndTemp) continue;
+		dwStyle = GetWindowLong(hWndTemp,GWL_STYLE);
+		if ((hWndTemp->id >= (WORD)nIDFirst) && 
+		    (hWndTemp->id <= (WORD)nIDLast) &&
+			((LOWORD(dwStyle) == BS_RADIOBUTTON) ||
+			 (LOWORD(dwStyle) == BS_AUTORADIOBUTTON)))
+			SendMessage(hWndTemp,BM_SETCHECK,FALSE,0);
+	}
+	SendMessage(hWndCheck,BM_SETCHECK,TRUE,0);
+}
diff -urN lib/microwindows/src/mwin/winlib/button.org /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/button.org
--- lib/microwindows/src/mwin/winlib/button.org	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/button.org	2005-02-21 16:13:26.000000000 +0100
@@ -0,0 +1,796 @@
+#include "../windows.h"
+#include "../windowsx.h"
+#include "../wintools.h"
+/*
+ * WINCTL Custom Control Library
+ * Push button Custom Control
+ *	This control implements a custom pushbutton control.
+ *
+ * 4/8/98 g haerr original version from control palette v2.00, Blaise Computing
+ */
+
+#define IDTIMERMOUSEMOVE	10	/* id of timer on mouse moves*/
+
+void WINAPI cpDrawPushButton(HWND hwnd,HDC hDCwParam,UINT wEnumState,
+	DWORD dwStyle);
+
+#define GET_PBSTATE(h)			(GetWindowWord(h, 0))
+#define GET_PBCAPTURE(h)		(GetWindowWord(h, 2))
+#define GET_PBWASINSIDE(h)		(GetWindowWord(h, 4))
+#define GET_PBUPDATELOCK(h)		(GetWindowWord(h, 6))
+#define GET_PBDELETEFONT(h)		(GetWindowWord(h, 8))
+#define GET_PBFONT(h)			(GetWindowWord(h, 10))
+
+#define SET_PBSTATE(h,x)		(SetWindowWord(h, 0, x))
+#define SET_PBCAPTURE(h,x)		(SetWindowWord(h, 2, x))
+#define SET_PBWASINSIDE(h,x)		(SetWindowWord(h, 4, x))
+#define SET_PBUPDATELOCK(h,x)		(SetWindowWord(h, 6, x))
+#define SET_PBDELETEFONT(h,x)		(SetWindowWord(h, 8, x))
+#define SET_PBFONT(h,x)			(SetWindowWord(h, 10, x))
+
+#define PARENT(hwnd)		((HWND)GetWindowLong(hwnd,GWL_HWNDPARENT))
+
+/* Internal state variable bit positions							   */
+#define PUSH_UP			0x0000
+#define PUSH_DOWN		0x0001	/* Button is down					   */
+#define PUSH_FOCUS		0x0002	/* Button is focused				   */
+#define PUSH_DISABLED	0x0004	/* Button is disabled				   */
+#define PUSH_DEFAULT	0x0008	/* Button is currently a default	   */
+
+/* Push Button states */
+#define PBS_UP			0x0000			/* Normal button state.				*/
+#define PBS_FOCUSDOWN	0x0001			/* Button pressed.					*/
+#define PBS_FOCUSUP		0x0002			/* Focused state.					*/
+#define PBS_DISABLED	0x0004			/* Disabled state.					*/
+#define PBS_DEFAULT		0x0008			/* Default state.					*/
+#define PBS_CHECKED		0x0010			/* checked state.					*/
+
+/* BOOL Cls_OnGetState( HWND hwnd); */
+#define HANDLE_BM_GETSTATE(hwnd, wParam, lParam, fn) ((fn)(hwnd))
+#define FORWARD_BM_GETSTATE(hwnd) \
+	(LONG)(fn)((hwnd), BM_GETSTATE, (WPARAM)0, (LPARAM)0)
+
+/* void Cls_OnSetState( HWND hwnd, WORD wState); */
+#define HANDLE_BM_SETSTATE( hwnd, wParam, lParam, fn) \
+	((fn)((hwnd), (WORD)wParam), 0)
+#define FORWARD_BM_SETSTATE( hwnd, wState) \
+	(fn)((hwnd), BM_SETSTATE, (WPARAM)wState, (LPARAM)0)
+
+/* void Cls_OnSetStyle( HWND hwnd, WORD style, BOOL bRedraw); */
+#define HANDLE_BM_SETSTYLE( hwnd, wParam, lParam, fn) \
+	((fn)((hwnd), (WORD)wParam, (BOOL)LOWORD(lParam)), 0)
+#define FORWARD_BM_SETSTYLE( hwnd, style, bRedraw, fn) \
+	(fn)((hwnd), BM_SETSTYLE, (WPARAM)style, MAKELPARAM(bRedraw, 0))
+
+/* local procs*/
+static void WINAPI	cenButton_FnEnd( HWND, WORD);
+static WORD WINAPI	cenButton_FnStart( HWND);
+static BOOL WINAPI	cenButton_OnCreate( HWND, LPCREATESTRUCT);
+/*static void WINAPI	cenButton_OnDestroy( HWND);*/
+/*static void WINAPI	cenButton_OnEnable( HWND, BOOL);*/
+static BOOL WINAPI	cenButton_OnEraseBkgnd( HWND, HDC);
+/*static UINT WINAPI	cenButton_OnGetDlgCode( HWND, LPMSG);*/
+static LONG WINAPI	cenButton_OnGetState( HWND);
+/*static void WINAPI	cenButton_OnKey( HWND, UINT, BOOL, int, UINT);*/
+static void WINAPI	cenButton_OnKillFocus( HWND, HWND);
+static void WINAPI	cenButton_OnLButtonDown( HWND, BOOL, UINT, UINT, UINT);
+static void WINAPI	cenButton_OnLButtonUp( HWND, UINT, UINT, UINT);
+static void WINAPI	cenButton_OnMouseMove( HWND, UINT, UINT, UINT);
+static void WINAPI	cenButton_OnPaint( HWND, HDC);
+/*static void WINAPI	cenButton_OnTimer( HWND, UINT);*/
+static void WINAPI	cenButton_OnSetFocus( HWND, HWND);
+static void WINAPI	cenButton_OnSetStyle( HWND, WORD, BOOL);
+static void WINAPI	cenButton_OnSetState( HWND, WORD);
+static void WINAPI	cenButton_SetState( HWND, WORD, BOOL);
+static void WINAPI	cenButton_OnSetText( HWND, LPCSTR);
+
+static void WINAPI
+cenButton_FnEnd(
+HWND		hwnd,
+WORD		wState)
+{
+	WORD		wLock;
+
+	wLock = GET_PBUPDATELOCK( hwnd) - 1;
+	if( wLock > 32767)
+		wLock = 0;
+	SET_PBUPDATELOCK( hwnd, wLock);
+	if( ( wLock == 0) && ( wState != GET_PBSTATE( hwnd))) {
+		if( IsWindowVisible( hwnd))
+			UpdateWindow( hwnd);
+	}
+}
+
+static WORD WINAPI
+cenButton_FnStart(
+HWND		hwnd)
+{
+	WORD		wState;
+	WORD		wLock;
+
+	wState = GET_PBSTATE( hwnd);
+	wLock = GET_PBUPDATELOCK( hwnd) + 1;
+	SET_PBUPDATELOCK( hwnd, wLock);
+
+	return( wState);
+}
+
+static BOOL WINAPI
+cenButton_OnCreate(
+HWND			hwnd,
+LPCREATESTRUCT	lpCreate)
+{
+	/* WM_CREATE is sent as the control is created but before  */
+	/* it is displayed.	 The control is registered (that is,   */
+	/* a data structure is created and associated with this	   */
+	/* control instance.  This data structure is used to hold  */
+	/* attributes set as a response to the WM_CTLATTRIBS	   */
+	/* message.)  Several window extra-bytes variables are set */
+	/* with the initial capture state information.	Some of	   */
+	/* this information (default & disabled) is found in the   */
+	/* window style.										   */
+
+	/* Set initial states */
+	/*SET_PBDELETEFONT( hwnd, FALSE);*/
+    	/*SET_PBFONT( hwnd, NULL);*/
+	SET_PBUPDATELOCK( hwnd, 1);
+	SET_PBSTATE( hwnd, PUSH_UP );
+	SET_PBCAPTURE( hwnd, FALSE );
+	SET_PBWASINSIDE( hwnd, FALSE );
+
+	if ((lpCreate->style & 0x0f) == BS_DEFPUSHBUTTON)
+		cenButton_SetState( hwnd, PUSH_DEFAULT, TRUE );
+
+	if (lpCreate->style & WS_DISABLED)
+		cenButton_SetState( hwnd, PUSH_DISABLED, TRUE );
+
+	SET_PBUPDATELOCK( hwnd, 0);
+
+	return( TRUE);
+}
+
+#if 0
+static void WINAPI
+cenButton_OnDestroy(
+HWND		hwnd)
+{
+	if( GET_PBDELETEFONT( hwnd)) {
+		DeleteObject( GET_PBFONT( hwnd));
+		SET_PBDELETEFONT( hwnd, FALSE);
+	}
+}
+
+static void WINAPI
+cenButton_OnEnable(
+HWND		hwnd,
+BOOL		bEnable)
+{
+	/* WM_ENABLE is sent when the button is enabled or		   */
+	/* disabled.  This information is saved for use when the   */
+	/* button is eventually drawn.							   */
+
+	WORD		wState;
+
+	wState = cenButton_FnStart( hwnd);
+	cenButton_SetState( hwnd, PUSH_DISABLED, !bEnable);
+	cenButton_FnEnd( hwnd, wState);
+}
+#endif
+
+static BOOL WINAPI
+cenButton_OnEraseBkgnd(
+HWND		hwnd,
+HDC			hdc)
+{
+	/* WM_ERASEBKGND is sent when the window background is	   */
+	/* to be redrawn.  Since all of the painting (including	   */
+	/* the background) is accomplished in WM_PAINT, it is	   */
+	/* disabled.											   */
+
+	return TRUE;
+}
+
+#if 0
+static UINT WINAPI
+cenButton_OnGetDlgCode(
+HWND	hwnd,
+LPMSG 	lpMsg)
+{
+	/* WM_GETDLGCODE is sent by the dialog manager to find	   */
+	/* what type/style of control is responding and/or to	   */
+	/* determine what keystrokes the control wants to process  */
+	/* itself.	In this case, the pushbutton identifies itself */
+	/* and also indicates whether it is currently the default  */
+	/* pushbutton.											   */
+
+	/*return( DLGC_BUTTON | ((GET_PBSTATE( hwnd) & PUSH_DEFAULT) ?
+				DLGC_DEFPUSHBUTTON : DLGC_UNDEFPUSHBUTTON));*/
+	return( DLGC_BUTTON);
+}
+#endif
+
+static LONG WINAPI
+cenButton_OnGetState(
+HWND		hwnd)
+{
+	/* BM_GETSTATE is sent to enquire about the state of the   */
+	/* control.	 It returns TRUE if the button is in the down  */
+	/* state.												   */
+
+	return( ( GET_PBSTATE( hwnd) & PUSH_DOWN) == PUSH_DOWN);
+}
+
+#if 0
+static void WINAPI
+cenButton_OnKey(
+HWND		hwnd,
+UINT		vk,
+BOOL		bDown,
+int			cRepeat,
+UINT		flag)
+{
+	WORD		wState;
+
+	wState = cenButton_FnStart( hwnd);
+	if (bDown) {
+	 	/* WM_KEYDOWN is sent when a non-system key is pressed.	   */
+		/* If a spacebar is detected and the previous key state	   */
+		/* was up, then the control should switch to the down	   */
+		/* state.												   */
+
+		if ( (vk == ' ') && !(HIBYTE(flag) & 0x40) )
+			cenButton_SetState( hwnd, PUSH_DOWN, TRUE );
+	}
+	else {
+		/* WM_KEYUP is sent when a non-system key is released.	   */
+		/* If a space bar is detected, change to the up state.	If */
+		/* the control is the focused control, send the BN_CLICKED */
+		/* notification message.								   */
+
+		if ( vk == ' ' )
+		{	cenButton_SetState( hwnd, PUSH_DOWN, FALSE );
+
+			if (GET_PBSTATE( hwnd) & PUSH_FOCUS) {
+				FORWARD_WM_COMMAND( PARENT( hwnd), GetDlgCtrlID( hwnd),
+					hwnd, BN_CLICKED, SendMessage);
+				if(!IsWindow(hwnd))
+					return;
+			}
+		}
+	}
+	cenButton_FnEnd( hwnd, wState);
+}
+#endif
+
+static void WINAPI
+cenButton_OnKillFocus(
+HWND		hwnd,
+HWND		hwndNewFocus)
+{
+	/* WM_KILLFOCUS is sent as the control loses focus.	 Two   */
+	/* states are disabled since the control is no longer	   */
+	/* focused and can no longer be in the down state.		   */
+
+	WORD		wState;
+
+	wState = cenButton_FnStart( hwnd);
+	cenButton_SetState( hwnd, PUSH_FOCUS, FALSE );
+	cenButton_FnEnd( hwnd, wState);
+}
+
+static void WINAPI
+cenButton_OnLButtonDown(
+HWND		hwnd,
+BOOL		bDblClick,
+UINT		x,
+UINT		y,
+UINT		keyState)
+{
+	/* WM_LBUTTONDOWN is sent when the user presses the left   */
+	/* mouse button.  First the control captures the mouse and */
+	/* sets the focus to itself.  Then the capture variables   */
+	/* are set and the down state is set.					   */
+
+	WORD		wState;
+
+	wState = cenButton_FnStart( hwnd);
+	SetCapture( hwnd );
+	SetFocus( hwnd );
+	SET_PBCAPTURE( hwnd, TRUE );
+	SET_PBWASINSIDE( hwnd, TRUE );
+	cenButton_SetState( hwnd, PUSH_DOWN, TRUE );
+	cenButton_FnEnd( hwnd, wState);
+}
+
+static void WINAPI
+cenButton_OnLButtonUp(
+HWND		hwnd,
+UINT		x,
+UINT		y,
+UINT		keys)
+{
+	/* WM_LBUTTONUP is sent when the user releases the left	   */
+	/* mouse button.  Release the mouse capture and update the */
+	/* state.  If the cursor is inside the control send the	   */
+	/* BN_CLICKED notification to the parent.  Then reset the  */
+	/* capture variables.									   */
+
+	WORD		wState;
+
+	wState = cenButton_FnStart( hwnd);
+
+	/* only draw up state if we captured mouse*/
+	if(GetCapture() == hwnd)
+		cenButton_SetState( hwnd, PUSH_DOWN, FALSE );
+	ReleaseCapture();
+
+	if (GET_PBWASINSIDE( hwnd)) {
+		FORWARD_WM_COMMAND( PARENT( hwnd), GetDlgCtrlID( hwnd), hwnd,
+			BN_CLICKED, SendMessage);
+		if(!IsWindow(hwnd))
+			return;
+	}
+
+	SET_PBCAPTURE( hwnd, FALSE );
+	SET_PBWASINSIDE( hwnd, FALSE );
+	cenButton_FnEnd( hwnd, wState);
+}
+
+static void WINAPI
+cenButton_OnMouseMove(
+HWND		hwnd,
+UINT		x,
+UINT		y,
+UINT		keys)
+{
+	/* WM_MOUSEMOVE is sent at every discernable mouse		   */
+	/* movement.  It is necessary to detect this because if	   */
+	/* the mouse has been captured (because of a button down   */
+	/* message), the location of the cursor needs to be		   */
+	/* tracked.	 If it moves out of the confines of the		   */
+	/* control, the control should change to the focus/up	   */
+	/* state (and retain capture.)	If the cursor then moves   */
+	/* back into the control, change back to the down state.   */
+
+	WORD		wState;
+	DWORD		dwStyle;
+
+	wState = cenButton_FnStart( hwnd);
+	dwStyle = GetWindowLong(hwnd, GWL_STYLE);
+	if( GET_PBCAPTURE( hwnd)) {
+		if( !PtInsideWindow( hwnd, x, y) ) {
+			if( GET_PBWASINSIDE( hwnd)) {
+				cenButton_SetState( hwnd, PUSH_DOWN, FALSE);
+				SET_PBWASINSIDE( hwnd, FALSE );
+			}
+		} else {
+			if ( !( GET_PBWASINSIDE( hwnd)) ) {
+				cenButton_SetState( hwnd, PUSH_DOWN, TRUE );
+				SET_PBWASINSIDE( hwnd, TRUE );
+			}
+		}
+	}
+#if 0
+	else if(dwStyle & BS_FLAT) {
+		// draw the button as though it has focus
+		// and set a timer to determine when the cursor
+		// has moved off the button
+		cenButton_SetState( hwnd, PUSH_FOCUS, TRUE );
+		SetTimer(hwnd, IDTIMERMOUSEMOVE, 50, NULL);
+		InvalidateRect(hwnd, NULL, FALSE);
+	}
+#endif
+	cenButton_FnEnd( hwnd, wState);
+}
+
+#if 0
+static void WINAPI
+cenButton_OnTimer(
+HWND		hwnd,
+UINT		id)
+{
+	POINT		pt;
+
+	switch(id) {
+	case IDTIMERMOUSEMOVE:
+		// if the cursor has moved off the button,
+		// redraw the button without focus and kill the timer
+		GetCursorPos(&pt);
+		ScreenToClient(hwnd, &pt);
+		if(!PtInsideWindow(hwnd, pt.x, pt.y)) {
+			KillTimer(hwnd, IDTIMERMOUSEMOVE);
+			cenButton_SetState( hwnd, PUSH_FOCUS, FALSE );
+			InvalidateRect(hwnd, NULL, FALSE);
+		}
+		break;
+	}
+}
+#endif
+
+static void WINAPI
+cenButton_OnPaint(
+HWND		hwnd,
+HDC		hDCwParam)
+{
+	UINT		wEnumState;
+	DWORD		dwStyle;
+
+	if( GET_PBSTATE( hwnd) & PUSH_DISABLED)
+		wEnumState = PBS_DISABLED;
+	else if( GET_PBSTATE( hwnd) & PUSH_DOWN)
+		wEnumState = PBS_FOCUSDOWN;
+	else
+	{
+		if( GET_PBSTATE( hwnd) & PUSH_FOCUS)
+			wEnumState = PBS_FOCUSUP;
+		else
+			wEnumState = PBS_UP;
+		if( GET_PBSTATE( hwnd) & PUSH_DEFAULT)
+			wEnumState |= PBS_DEFAULT;
+	}
+
+	/* common draw code for button and checkbox*/
+	dwStyle = GetWindowLong(hwnd, GWL_STYLE);
+	cpDrawPushButton( hwnd, hDCwParam, wEnumState, dwStyle);
+}
+
+void WINAPI
+cpDrawPushButton(HWND hwnd,HDC hDCwParam,UINT wEnumState,DWORD dwStyle)
+{
+	HDC		hdc;
+	HBRUSH		hNewBrush;
+	RECT		rect;
+	RECT		rectClient;
+	RECT		rectSave;
+	RECT		rc;
+	int		iFaceOffset;
+	INT		uiHeight;
+	INT		uiWidth;
+	COLORREF	crOld;
+	COLORREF	crBkOld;
+	int		oldBkMode;
+	HFONT		hNewFont;
+	HFONT		hOldFont;
+	COLORREF	hOldColor;
+	PAINTSTRUCT	ps;
+	char		buf[256];
+#define uiWidthFrame	0
+#define uiWidthShadow	2
+
+	hdc = BeginPaint(hwnd, &ps);
+	if(!hdc)
+		goto Return;
+
+	GetWindowText(hwnd, buf, sizeof(buf));
+	GetClientRect( hwnd, &rectClient );
+	uiWidth	= rectClient.right - rectClient.left;
+	uiHeight = rectClient.bottom - rectClient.top;
+
+	hNewBrush = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
+	crOld = SetTextColor( hdc, GetSysColor( COLOR_BTNTEXT));
+	crBkOld = SetBkColor( hdc, GetSysColor( COLOR_BTNFACE));
+
+	rc = rectClient;
+	switch((int)(dwStyle & 0x0f)) {
+	case BS_PUSHBUTTON:
+	case BS_DEFPUSHBUTTON:
+		if( wEnumState & PBS_FOCUSDOWN) {
+			Draw3dBox(hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
+				GetSysColor(COLOR_WINDOWFRAME), GetSysColor(COLOR_WINDOWFRAME));
+			InsetR(&rc, 1, 1);
+			Draw3dBox(hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
+				GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNSHADOW));
+			InsetR(&rc, 1, 1);
+			FastFillRect(hdc, &rc, GetSysColor(COLOR_BTNFACE));
+			iFaceOffset = 1;
+		} else {
+			if(wEnumState & PBS_DEFAULT) {
+				Draw3dBox(hdc, rc.left, rc.top,
+					rc.right-rc.left, rc.bottom-rc.top,
+					GetSysColor(COLOR_WINDOWFRAME),
+					GetSysColor(COLOR_WINDOWFRAME));
+				InsetR(&rc, 1, 1);
+			}
+			Draw3dBox(hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
+				GetSysColor(COLOR_BTNHIGHLIGHT),GetSysColor(COLOR_WINDOWFRAME));
+			InsetR(&rc, 1, 1);
+			Draw3dBox(hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
+				GetSysColor(COLOR_3DLIGHT), GetSysColor(COLOR_BTNSHADOW));
+			InsetR(&rc, 1, 1);
+			FastFillRect(hdc, &rc, GetSysColor(COLOR_BTNFACE));
+			iFaceOffset = 0;
+		}
+		break;
+	case BS_CHECKBOX:
+	case BS_AUTOCHECKBOX:
+		FastFillRect(hdc, &rc, GetSysColor(COLOR_BTNFACE));
+		rc.left += 2;
+		rc.top += 2;
+		rc.right = rc.left + 8;
+		rc.bottom = rc.top + 8;
+		Draw3dBox(hdc, rc.left, rc.top, 8, 8,
+			GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_3DLIGHT));
+		InsetR(&rc, 1, 1);
+		FastFillRect(hdc, &rc, GetSysColor(COLOR_BTNHIGHLIGHT));
+		iFaceOffset = 1;
+		break;
+	}
+
+	/*
+	 * draw text
+	 */
+	if(buf[ 0]) {
+		hNewFont = GetStockObject( DEFAULT_GUI_FONT);
+		hOldFont = SelectObject( hdc, hNewFont);
+
+		/* calculate text bounding rect*/
+		rect.left = 0;
+		rect.top = 0;
+		DrawText( hdc, buf, -1, &rect, DT_CALCRECT | DT_LEFT |
+			DT_SINGLELINE | DT_TOP);
+		rectSave = rect;
+
+		/*
+		 * calculate text draw location
+		 */
+		switch((int)(dwStyle & (BS_LEFT|BS_CENTER|BS_RIGHT))) {
+		case BS_CENTER:
+		default:
+			rect.left = (uiWidth - (rect.right - rect.left)) / 2
+				+ iFaceOffset;
+			break; 
+		case BS_LEFT:
+			rect.left = uiWidthFrame + uiWidthShadow + 2
+				+ iFaceOffset;
+			break;
+		case BS_RIGHT:
+			rect.left = (rect.right - rect.left) + uiWidthFrame
+				+ uiWidthShadow + 4 + iFaceOffset;
+			break;
+		}
+		rect.right += rect.left - rectSave.left;
+
+		switch((int)(dwStyle & (BS_TOP|BS_VCENTER|BS_BOTTOM))) {
+		case BS_VCENTER:
+		default:
+			rect.top = (uiHeight - (rect.bottom - rect.top)) / 2
+				+ iFaceOffset;
+			break;
+		case BS_TOP:
+			rect.top = 2 + uiWidthFrame + uiWidthShadow
+				+ iFaceOffset;
+			break;
+		case BS_BOTTOM:
+			rect.top = uiHeight - uiWidthFrame - uiWidthShadow -
+				(rect.bottom - rect.top) - 1 + iFaceOffset;
+			break;
+		}
+		rect.bottom += rect.top - rectSave.top;
+
+		oldBkMode = SetBkMode( hdc, TRANSPARENT);
+		if(wEnumState & PBS_DISABLED)
+			hOldColor = SetTextColor( hdc,
+				GetSysColor( COLOR_GRAYTEXT));
+		else
+			hOldColor = SetTextColor( hdc,
+				GetSysColor( COLOR_BTNTEXT));
+
+		DrawText( hdc, buf, -1, &rect,DT_LEFT | DT_SINGLELINE | DT_TOP);
+
+		SetBkMode( hdc, oldBkMode);
+		SetTextColor( hdc, hOldColor);
+		SelectObject( hdc, hOldFont);
+	}
+
+#if 0
+	if( (!(wEnumState&PBS_CHECKED) && (wEnumState&PBS_FOCUSDOWN)) || 
+						(wEnumState & PBS_FOCUSUP)) {
+		rect = rectClient;
+		uiWidth = uiWidthFrame + uiWidthShadow + 2;
+		rect.left += uiWidth;
+		rect.top += uiWidth;
+		rect.right -= uiWidth;
+		rect.bottom -= uiWidth;
+		if((dwStyle & (BS_FLAT|BS_NOFOCUSRECT)) == 0)
+			DrawFocusRect( hdc, &rect);
+	}
+#endif
+
+	SetTextColor( hdc, crOld);
+	SetBkColor( hdc, crBkOld);
+
+Return:
+	EndPaint(hwnd, &ps);
+}
+
+static void WINAPI
+cenButton_OnSetFocus(
+HWND		hwnd,
+HWND		hwndOldFocus)
+{
+	/* WM_SETFOCUS is sent when the user clicks on the control */
+	/* or when the dialog manager determines that a keystroke  */
+	/* should cause the control to be focused.	This affects   */
+	/* the appearance of the control so the state is saved for */
+	/* future drawing.										   */
+
+	WORD		wState;
+
+	wState = cenButton_FnStart( hwnd);
+	/*if(!IsWindowEnabled(hwnd))
+		cenButton_SetState( hwnd, PUSH_FOCUS, TRUE );*/
+	cenButton_FnEnd( hwnd, wState);
+}
+
+static void WINAPI
+cenButton_OnSetStyle(
+HWND		hwnd,
+WORD		style,
+BOOL		bRedraw)
+{
+	/* BM_SETSTYLE is sent to set the style of the button.	   */
+	/* The internal state variable is updated.				   */
+
+	WORD		wState;
+
+	wState = cenButton_FnStart( hwnd);
+	cenButton_SetState( hwnd, PUSH_DEFAULT, (style & 0x0f) == BS_DEFPUSHBUTTON);
+	cenButton_FnEnd( hwnd, wState);
+}
+
+static void WINAPI
+cenButton_OnSetState(
+HWND		hwnd,
+WORD		wState)
+{
+	/* BM_SETSTATE is sent to set the state of the control.	   */
+	/* The internal state variable is updated.				   */
+
+	WORD		wStateOld;
+
+	wStateOld = cenButton_FnStart( hwnd);
+	cenButton_SetState( hwnd, PUSH_DOWN, (wState ? TRUE : FALSE ) );
+	cenButton_FnEnd( hwnd, wStateOld);
+}
+
+static void WINAPI
+cenButton_SetState(
+HWND	hwnd,
+WORD	wState,
+BOOL	bEnable )
+{
+	/* Turn on/off state bits according to the bEnable flag.  If the   */
+	/* new state is different, invalidate the client window so that	   */
+	/* the proper bitmap is displayed.								   */
+
+	WORD	wNewState;
+	WORD	wOldState;
+	RECT	rectClient;
+
+	wOldState = GET_PBSTATE( hwnd);
+	wNewState = (bEnable ? (wOldState | wState) : (wOldState & ~wState));
+
+	if (wOldState != wNewState)
+	{	SET_PBSTATE( hwnd, wNewState );
+		GetClientRect(hwnd, &rectClient);
+		InvalidateRect(hwnd, &rectClient, FALSE);
+	}
+}
+
+#if 0
+static void WINAPI
+cenButton_OnSetFont(
+HWND		hwnd,
+HFONT		hFont,
+BOOL		bRedraw)
+{
+	BOOL		bDeleteFont = FALSE;
+	HFONT		hFontNew = 0;
+	LOGFONT		logFont;
+
+	/* create a thin font*/
+	if( GetObject( hFont, sizeof( logFont), &logFont) != 0) {
+		if( logFont.lfWeight != FW_NORMAL) {
+			logFont.lfWeight = FW_NORMAL;
+			if( ( hFontNew = CreateFontIndirect( &logFont)) != 0) {
+				hFont = hFontNew;
+				bDeleteFont = TRUE;
+			}
+		}
+	}
+
+	if( GET_PBDELETEFONT( hwnd))
+		DeleteObject( GET_PBFONT( hwnd));
+
+	SET_PBDELETEFONT( hwnd, bDeleteFont);
+	SET_PBFONT( hwnd, hFont);
+
+	FORWARD_WM_SETFONT( hwnd, hFont, bRedraw, DefWindowProc);
+}
+#endif
+
+static void WINAPI
+cenButton_OnSetText(
+HWND		hwnd,
+LPCSTR		lpszText)
+{
+	/* WM_SETTEXT is sent to change the text of the button	   */
+	/* control.	 In this case we allow the default window proc */
+	/* to handle the message first.	 But this only affects the */
+	/* internal Windows data structure of the control, it does */
+	/* not display the change.	To do this we invalidate and   */
+	/* update the client area of the control which displays	   */
+	/* the new text.										   */
+
+	FORWARD_WM_SETTEXT( hwnd, lpszText, DefWindowProc);
+	InvalidateRect( hwnd, NULL, FALSE);
+	UpdateWindow( hwnd);
+}
+
+LRESULT CALLBACK
+cenButtonWndFn(
+HWND	hwnd,
+UINT	message,
+WPARAM	wParam,
+LPARAM	lParam)
+{
+	/* This is the window proc for the pushbutton control.	Most of	   */
+	/* the drawing is accomplished in the cpDrawPushButton() function. */
+	/* The code below is mainly concerned with the keyboard and mouse  */
+	/* events that the control detects.								   */
+
+#define WM_PAINT_SPECIAL	WM_PAINT
+#define HANDLE_WM_PAINT_SPECIAL(hwnd, wParam, lParam, fn) \
+    ((fn)((hwnd),(HDC)(wParam)), 0L)
+
+	switch( message) {
+	HANDLE_MSG( hwnd, WM_CREATE, cenButton_OnCreate);
+	/*HANDLE_MSG( hwnd, WM_ENABLE, cenButton_OnEnable);*/
+	HANDLE_MSG( hwnd, WM_SETFOCUS, cenButton_OnSetFocus);
+	HANDLE_MSG( hwnd, WM_KILLFOCUS, cenButton_OnKillFocus);
+	HANDLE_MSG( hwnd, WM_LBUTTONDOWN, cenButton_OnLButtonDown);
+	HANDLE_MSG( hwnd, WM_LBUTTONDBLCLK, cenButton_OnLButtonDown);
+	HANDLE_MSG( hwnd, WM_LBUTTONUP, cenButton_OnLButtonUp);
+	HANDLE_MSG( hwnd, WM_MOUSEMOVE, cenButton_OnMouseMove);
+	/*HANDLE_MSG( hwnd, WM_KEYDOWN, cenButton_OnKey);*/
+	/*HANDLE_MSG( hwnd, WM_KEYUP, cenButton_OnKey);*/
+	HANDLE_MSG( hwnd, WM_ERASEBKGND, cenButton_OnEraseBkgnd);
+	HANDLE_MSG( hwnd, WM_PAINT_SPECIAL, cenButton_OnPaint);
+	/*HANDLE_MSG( hwnd, WM_TIMER, cenButton_OnTimer);*/
+	/*HANDLE_MSG( hwnd, WM_GETDLGCODE, cenButton_OnGetDlgCode);*/
+	HANDLE_MSG( hwnd, BM_SETSTYLE, cenButton_OnSetStyle);
+	HANDLE_MSG( hwnd, BM_GETSTATE, cenButton_OnGetState);
+	HANDLE_MSG( hwnd, BM_SETSTATE, cenButton_OnSetState);
+	/*HANDLE_MSG( hwnd, WM_DESTROY, cenButton_OnDestroy);*/
+	/*HANDLE_MSG( hwnd, WM_SETFONT, cenButton_OnSetFont);*/
+	HANDLE_MSG( hwnd, WM_SETTEXT, cenButton_OnSetText);
+
+	case BM_GETCHECK:
+		return cenButton_OnGetState(hwnd);
+
+	case BM_SETCHECK:
+		cenButton_OnSetState(hwnd, (WORD)wParam);
+		return 0;
+	}
+
+	return DefWindowProc( hwnd, message, wParam, lParam);
+}
+
+int WINAPI
+WndButtonRegister(HINSTANCE hInstance)
+{
+	WNDCLASS	wc;
+
+	wc.style	= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
+	wc.lpfnWndProc	= (WNDPROC)cenButtonWndFn;
+	wc.cbClsExtra	= 0;
+	wc.cbWndExtra	= 12;
+	wc.hInstance	= hInstance;
+	wc.hIcon	= NULL;
+	wc.hCursor	= 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground= GetStockObject(LTGRAY_BRUSH);
+	wc.lpszMenuName	= NULL;
+	wc.lpszClassName= "BUTTON";
+
+	return RegisterClass(&wc);
+}
diff -urN lib/microwindows/src/mwin/winlib/caret.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/caret.c
--- lib/microwindows/src/mwin/winlib/caret.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/caret.c	2005-02-21 16:13:25.000000000 +0100
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Caret control for Microwindows win32 api.
+ *
+ * TODO: add SetSysTimer for blinking
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <malloc.h>
+#include "windows.h"
+#include "device.h"
+
+#define DEF_BLINK_TIME		500	/* default blink time in ms*/
+
+typedef struct {
+	HWND	hwnd;		/* != NULL if caret is created*/
+	int	x;
+	int	y;
+	int	nWidth;
+	int	nHeight;
+	BOOL	fShown;		/* caret is currently visible*/
+	int	nShowCount;	/* <= 0 for hidden caret*/
+	UINT	nBlinkTime;
+} CARETINFO;
+
+/* local data*/
+static CARETINFO sysCaret;	/* the system caret*/
+
+/* local procs*/
+static void MwShowCaret(void);
+static void MwHideCaret(void);
+static void MwUpdateCaret(void);
+
+BOOL WINAPI
+CreateCaret(HWND hwnd, HBITMAP hBitmap, int nWidth, int nHeight)
+{
+
+	DestroyCaret();			/* destroy old caret if any*/
+
+	if (nWidth <= 0)
+		nWidth = 1;
+	if (nHeight <= 0)
+		nHeight = 1;
+
+        sysCaret.hwnd = hwnd;
+        sysCaret.x = 0;
+	sysCaret.y = 0;
+	sysCaret.nWidth = nWidth;
+        sysCaret.nHeight = nHeight;
+        sysCaret.fShown = FALSE;
+        sysCaret.nShowCount = 0;
+        sysCaret.nBlinkTime = DEF_BLINK_TIME;
+	return TRUE;
+}
+
+BOOL WINAPI
+DestroyCaret(VOID)
+{
+	if (sysCaret.fShown)
+		MwHideCaret();
+	sysCaret.hwnd = NULL;
+	sysCaret.fShown = FALSE;
+	return TRUE;
+}
+
+BOOL WINAPI
+HideCaret(HWND hwnd)
+{
+	if (hwnd == NULL)
+		hwnd = sysCaret.hwnd;
+	if (hwnd == NULL || hwnd != sysCaret.hwnd)
+		return FALSE;
+
+	/* hide caret if this call made it invisible*/
+	if (--sysCaret.nShowCount == 0) {
+		MwHideCaret();
+		return TRUE;
+	}
+	return FALSE;
+}
+
+BOOL WINAPI
+ShowCaret(HWND hwnd)
+{
+	if (hwnd == NULL)
+		hwnd = sysCaret.hwnd;
+	if (hwnd == NULL || hwnd != sysCaret.hwnd || sysCaret.nShowCount < 0)
+		return FALSE;
+
+	if (++sysCaret.nShowCount > 1)
+		return TRUE;
+
+	/* show caret, this call made it visible*/
+	MwShowCaret();
+	return TRUE;
+}
+
+BOOL WINAPI
+SetCaretPos(int nX, int nY)
+{
+	if (sysCaret.fShown && (sysCaret.x != nX || sysCaret.y != nY)) {
+		MwUpdateCaret();	/* toggle off*/
+		sysCaret.x = nX;
+		sysCaret.y = nY;
+		MwUpdateCaret();	/* toggle on in new location*/
+		return TRUE;
+	}
+	sysCaret.x = nX;
+	sysCaret.y = nY;
+	return TRUE;
+}
+
+BOOL WINAPI
+GetCaretPos(LPPOINT lpPoint)
+{
+	lpPoint->x = sysCaret.x;
+	lpPoint->y = sysCaret.y;
+	return TRUE;
+}
+
+UINT WINAPI
+GetCaretBlinkTime(VOID)
+{
+	return sysCaret.nBlinkTime;
+}
+
+BOOL WINAPI
+SetCaretBlinkTime(UINT uMSeconds)
+{
+	sysCaret.nBlinkTime = uMSeconds;
+	//SetSysTimer
+	return TRUE;
+}
+
+static void
+MwShowCaret(void)
+{
+	if (sysCaret.fShown)
+		return;
+	MwUpdateCaret();
+	sysCaret.fShown = TRUE;
+}
+
+static void
+MwHideCaret(void)
+{
+	if (!sysCaret.fShown)
+		return;
+	MwUpdateCaret();
+	sysCaret.fShown = FALSE;
+}
+
+/* Draw the caret using XOR.  Same routine is used to show and hide caret.*/
+static void
+MwUpdateCaret(void)
+{
+	int	oldmode;
+	HDC	hdc;
+	HPEN	hpen;
+	HBRUSH	hbr;
+
+	oldmode = GdSetMode(MWMODE_XOR);
+	hdc = GetDC(sysCaret.hwnd);
+	hpen = SelectObject(hdc, GetStockObject(WHITE_PEN));
+
+	/* it seems there's some problems with Rectangle with nWidth == 1*/
+	if (sysCaret.nWidth == 1) {
+		MoveToEx(hdc, sysCaret.x, sysCaret.y, NULL);
+		LineTo(hdc, sysCaret.x, sysCaret.y+sysCaret.nHeight);
+	} else {
+		hbr = SelectObject(hdc, GetStockObject(WHITE_BRUSH));
+		Rectangle(hdc, sysCaret.x, sysCaret.y,
+			sysCaret.x+sysCaret.nWidth,
+			sysCaret.y+sysCaret.nHeight);
+		SelectObject(hdc, hbr);
+	}
+	SelectObject(hdc, hpen);
+	ReleaseDC(sysCaret.hwnd, hdc);
+	GdSetMode(oldmode);
+}
diff -urN lib/microwindows/src/mwin/winlib/combobox.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/combobox.c
--- lib/microwindows/src/mwin/winlib/combobox.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/combobox.c	2005-02-21 16:13:25.000000000 +0100
@@ -0,0 +1,1788 @@
+/*--------------------------------------------------------------------------
+**      ComboBox.c             Twin           From:  Twin/controls
+**
+**              
+**------------------------- < License Information > ------------------------
+**
+**      This file was originally a part of Willows TWIN.  Willows
+**  TWIN was released under a Library GPL (LGPL).  This permits
+**  redistribution of this source code, provided that the full
+**  TWIN license is in effect, and provided that all modifications
+**  to this source code are made publicly available.
+**  Please refer to Willows software (www.willows.com) or
+**  LICENSE for full information.
+**  
+**      Under Twine, this file is also protected by an LGPL.  Please
+**  see LICENSE for full details on this license.
+**  
+**
+**      Copyright 1997 Willows Software, Inc. 
+**------------------------ < File Content Description > --------------------
+**
+**  Module:	 controls/ComboBox.c
+**
+**  Description:
+**      
+**
+**  Functions defined:
+**    
+**------------------------- < Revision Information > -----------------------
+** $Header: /twinecvs/src/controls/ComboBox.c,v 1.6 2000/01/21 02:48:47 robf Exp $
+** $Header: /mwin/winlib/ComboBox.c,v 1.7 2000/06/28 jmt Exp $
+** $Header: /mwin/winlib/ComboBox.c,v 1.8 2000/08/14 jmt Exp $
+**
+**      Full Revision history at bottom of file
+**      
+**--------------------------------------------------------------------------*/
+#ifndef OEMRESOURCE
+#define OEMRESOURCE     /* for OBM_CLOSE */
+#endif
+/*----------------------------------------------------------------------------
+**              E X T E R N A L     I N C L U D E S 
+**--------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+**              I N T E R N A L     I N C L U D E S
+**--------------------------------------------------------------------------*/
+
+
+#include "windows.h"
+#include "windowsx.h"
+
+#undef OEMRESOURCE
+#undef LATER
+
+#if 1
+#include <stdlib.h> //free
+#include <stdio.h> //stder
+#define WinMalloc(n)	malloc((n))
+#define WinFree(p)	free(p)
+
+#define GET_WM_COMMAND_ID(wp, lp)               LOWORD(wp)
+#define GET_WM_COMMAND_HWND(wp, lp)             (HWND)(lp)
+#define GET_WM_COMMAND_CMD(wp, lp)              HIWORD(wp)
+#define GET_WM_COMMAND_MPS(id, hwnd, cmd)    \
+        (WPARAM)MAKELONG(id, cmd), (LONG)(hwnd)
+#define LOSHORT(x)	(short int)LOWORD(x)
+#define Edit_SetSel(hwndCtl, ichStart, ichEnd)  ((void)SendMessage((hwndCtl), EM_SETSEL, (ichStart), (ichEnd)))
+#endif
+
+#include <string.h>
+
+typedef struct  {
+    HFONT   hFont;          /* hFont used */
+    HWND    hWndParent;     /* parent window */
+    UINT    nID;            /* control ID */
+    WORD    wStateFlags;    /* combobox state flags */
+    UINT    wStyle;         /* this is a copy of LOWORD(style) */
+    BOOL    bExtended;      /* extended UI flag */
+    BOOL    bRedraw;        /* MiD - redraw flag, draw only if it's 1 */
+    HWND    EditControl;    /* edit/static control hWnd */
+    HWND    ListBoxControl; /* listbox control hWnd */
+    RECT    ButtonRect;     /* local button rect (client) */
+    RECT    ListBoxRect;    /* listbox rect (screen) */
+    UINT    uHeight;        /* height of the normal state */
+    WNDPROC lpfnOldStatic;  /* previous static wndproc */
+    UINT    nListItems;     /* ecw */
+} COMBOBOX;
+
+#define CWD_LPCBDATA  0
+#define CBC_EDITID    1
+
+#define CSF_CAPTUREACTIVE   0x0001
+#define CSF_LOCALBUTTONDOWN 0x0002
+#define CSF_BUTTONDOWN      0x0004
+#define CSF_LBOXBUTTONDOWN  0x0008
+#define CSF_FOCUS           0x0010 /* MiD */
+#define CSF_HASDROPPED	    0x0020 /* weav */
+
+#define SET_STATE(lp, wMask)   (lp->wStateFlags |= (wMask))
+#define CLEAR_STATE(lp, wMask) (lp->wStateFlags &= ~(wMask))
+#define IS_SET(lp, wMask)      (lp->wStateFlags & (wMask))
+
+#define BOWNERDRAW(l) ((l)->wStyle & (CBS_OWNERDRAWFIXED|CBS_OWNERDRAWVARIABLE))
+
+/**********************************************
+    Styles:
+
+    CBS_AUTOHSCROLL     passed to the edit control
+    CBS_DISABLENOSCROLL passed to the listbox control
+    CBS_DROPDOWN
+    CBS_DROPDOWNLIST
+    CBS_HASSTRINGS      passed to the listbox control
+    CBS_NOINTEGRALHEIGHT    passed to the listbox control
+    CBS_OEMCONVERT      passed to the edit control
+    CBS_OWNERDRAWFIXED  passed to the listbox control
+    CBS_OWNERDRAWVARIABLE   passed to the listbox control
+    CBS_SIMPLE      TODO
+    CBS_SORT        passed to the listbox control
+
+    WS_VSCROLL      passed to the listbox control
+
+*********************************************/
+
+/**********************************************
+    CBN_xxx messages to be added
+
+    from mouse tracking...
+    CBN_SELENDCANCEL    TODO
+    CBN_SELENDOK        TODO
+
+*********************************************/
+
+/* imported stuff */
+#if 1
+void
+Draw3DButtonRect(HDC hDC, HPEN hPenHigh, HPEN hPenShadow,
+		RECT rc, BOOL fClicked)
+{
+    HPEN     hPenOld;
+    POINT    lpt[6];
+
+    POINT    p3[3];
+    int	     shrink=1;
+
+    hPenOld = SelectObject(hDC, hPenShadow);
+    if (fClicked) {
+	lpt[0].x = lpt[1].x = rc.left;
+	lpt[1].y = lpt[2].y = rc.top;
+	lpt[2].x = rc.right-1;
+	lpt[0].y = rc.bottom-1;
+        Polyline(hDC,lpt,3);
+    }
+    else {
+	lpt[0].x = lpt[1].x = rc.right-1;
+	lpt[0].y = rc.top;
+	lpt[1].y = lpt[2].y = rc.bottom-1;
+	lpt[2].x = rc.left;
+	lpt[3].x = rc.left+1;	
+	lpt[3].y = lpt[4].y = rc.bottom-2;	
+	lpt[4].x = lpt[5].x = rc.right-2;
+	lpt[5].y = rc.top+1;
+	Polyline(hDC,lpt,6);
+
+	SelectObject(hDC, hPenHigh);
+	lpt[0].x = rc.right-1;
+	lpt[0].y = lpt[1].y = rc.top;
+	lpt[1].x = lpt[2].x = rc.left;
+	lpt[2].y = rc.bottom-1;
+	lpt[3].x = lpt[4].x = rc.left+1;
+	lpt[3].y = rc.bottom-2;
+	lpt[4].y = lpt[5].y = rc.top+1;
+	lpt[5].x = rc.right-2;
+	Polyline(hDC,lpt,6);
+    }
+
+    SelectObject(hDC,GetStockObject(BLACK_BRUSH));
+    /* down */
+    p3[0].x= rc.left + ((rc.right-rc.left)/2) - 1;
+    p3[0].y= rc.bottom - 4 - shrink;
+    p3[1].x= rc.left + 2 + shrink - 1;
+    p3[1].y= rc.bottom-(rc.bottom-rc.top) + 2 + shrink;
+    p3[2].x= rc.left + ((rc.right-rc.left)-4) - shrink;
+    p3[2].y= rc.bottom-(rc.bottom-rc.top) + 2 + shrink;
+    Polygon(hDC,p3,3);
+
+    SelectObject(hDC,hPenOld);
+}
+#endif
+
+#if 0//jmt: fix: no COMBOLBOX
+//-extern LRESULT  DefLISTBOXProc(HWND, UINT, WPARAM, LPARAM);
+extern LRESULT  ListboxCtrlProc(HWND, UINT, WPARAM, LPARAM);
+#endif
+
+#if 0
+//-static HPEN     GetSysColorPen(int color)//?
+//-{
+//-	return NULL;//?
+//-}
+//-static HBRUSH   GetSysColorBrush(int color)//?
+//-{
+//-	return NULL;//?
+//-}
+#endif
+typedef HWND HWND32;
+#if 0//jmt: fix: no ownerdraw
+//-typedef HANDLE HCLASS32;
+//-static HCLASS32 FindClass(LPCSTR str, HINSTANCE hInstance)//?
+//-{
+//-	return NULL;//?
+//-}
+#endif
+#if 0//jmt: fix: no scrollbar
+//-static HWND TWIN_ConvertToSysScroll(HWND hwnd, BOOL status, LPPOINT pp)//?
+//-{
+//-	return NULL;//?
+//-}
+#endif
+extern HWND listwp;
+static HWND WindowFromPoint(POINT pt)
+{
+	HWND wp,wp1;
+	int dx,dy,dx1,dy1;
+#if 0
+	return NULL;//fix!!
+#else
+	wp1=NULL;
+	switch(sizeof(dx))
+	{
+	case 4:
+		dx=0x7fffffff;
+		dy=0x7fffffff;
+		break;
+	case 2:
+		dx=0x7fff;
+		dy=0x7fff;
+		break;
+	}
+	for(wp=listwp; wp; wp=wp->next) 
+	{
+		if (wp->winrect.left <= pt.x && pt.x <= wp->winrect.right)
+		{
+			dx1=(wp->winrect.right-pt.x);
+			if (dx1<dx)
+			{
+				wp1=wp;
+				dx=dx1;	
+			}
+			dx1=(pt.x-wp->winrect.left);
+			if (dx1<dx)
+			{
+				wp1=wp;
+				dx=dx1;	
+			}
+		}
+		if (wp->winrect.top <= pt.y && pt.y <= wp->winrect.bottom)
+		{
+			dy1=(wp->winrect.bottom-pt.y);
+			if (dy1<dy)
+			{
+				wp1=wp;
+				dy=dy1;	
+			}
+			dy1=(pt.y-wp->winrect.top);
+			if (dy1<dy)
+			{
+				wp1=wp;
+				dy=dy1;	
+			}
+		}
+	}
+#endif
+	return wp1;
+}
+
+/* internal stuff */
+static void CBoxDrawButton(HWND,UINT,COMBOBOX *);
+static void CBoxSendMouseToLBox(COMBOBOX *, UINT, WPARAM, POINT);
+static void CBoxCapture(HWND, WORD);
+static void CBoxDrawEdit(COMBOBOX *, HWND, UINT);
+static void CBoxDrawStatic(COMBOBOX *, HWND, UINT); /* MiD */
+
+/* handle specific CB messages */
+static LRESULT DefCBProc(HWND , UINT , WPARAM , LPARAM );
+
+#if 0//jmt: fix: no ownerdraw
+//-static WNDPROC lpComboBinToNat = 0;
+#endif
+
+static LRESULT CALLBACK 
+DefComboboxProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+int WINAPI MwRegisterComboboxControl(HINSTANCE hInstance)
+{
+	WNDCLASS	wc;
+
+	wc.style	= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
+	wc.lpfnWndProc	= (WNDPROC)DefComboboxProc;
+	wc.cbClsExtra	= 0;
+	wc.cbWndExtra	= 0;
+	wc.hInstance	= hInstance;
+	wc.hIcon	= NULL;
+	wc.hCursor	= 0; 
+	wc.hbrBackground= GetStockObject(WHITE_BRUSH);
+	wc.lpszMenuName	= NULL;
+	wc.lpszClassName= "COMBOBOX";
+
+	return RegisterClass(&wc);
+}
+
+static LRESULT CALLBACK 
+DefComboboxProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    PAINTSTRUCT ps;
+    HDC      hDC;
+    TEXTMETRIC tm;
+#if 0//jmt: fix: no ownerdraw
+    //-MEASUREITEMSTRUCT mis;
+#endif
+    COMBOBOX *lp = (COMBOBOX *)NULL;
+    LRESULT   rc;
+    HINSTANCE hInst;
+    POINT     cp,cpScreen,pp;
+    UINT      uiKey;
+    LPCREATESTRUCT lpcs;
+#if 1//jmt: fix: no WM_WINDOWPOSCHANGING
+    LPWINDOWPOS lpwp;
+#endif
+#if 0//jmt: fix: no ownerdraw
+    //-HCLASS32 hComboClass32;
+    //-LPMEASUREITEMSTRUCT lpmis;
+    //-LPDRAWITEMSTRUCT lpdis;
+    //-LPDELETEITEMSTRUCT lpdlis;
+#endif
+    DWORD dwStyle,dwExStyle;
+    WORD wEditWidth = 0,wEditHeight;
+    WORD wCBN;
+#if 0//jmt: fix: no WM_SETFONT/WM_GETFONT
+    RECT rcClient;
+#endif
+
+    rc = CB_OKAY;
+    if ((uMsg != WM_CREATE/*WM_NCCREATE*/) && /*(uMsg != WM_CONVERT) &&*/
+       !(lp = (COMBOBOX *)hWnd->userdata/*GetWindowLong(hWnd,CWD_LPCBDATA)*/))
+    	return rc;
+
+    switch(uMsg) {
+#ifdef  LATER
+    case WM_SIZE:
+    case WM_ENABLE:
+    case WM_LBUTTONDBLCLK:
+    //-case WM_COMPAREITEM:
+    //-case WM_CUT:
+    //-case WM_CLEAR:
+#endif               
+
+    case WM_SETFOCUS://
+        SET_STATE(lp, CSF_FOCUS);
+        if ((lp->wStyle & 0x0F) == CBS_DROPDOWNLIST)
+           {
+           uiKey = (UINT)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0L);
+           CBoxDrawStatic(lp, hWnd, uiKey);
+           }
+	if (lp->EditControl)
+        {
+	   SetFocus(lp->EditControl);
+        }
+        break;
+        
+    case WM_KILLFOCUS://
+        CLEAR_STATE(lp, CSF_FOCUS);
+        if ((lp->wStyle & 0x0F) == CBS_DROPDOWNLIST)
+        {
+           uiKey = (UINT)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0L);
+           CBoxDrawStatic(lp, hWnd, uiKey);
+        }
+        /*
+        **    Hide listbox when loosing focus to window other than 
+        **    our own listbox... When wParam == 0 we "loose" the focus
+        **    to the scrollbar in a listbox!
+        */
+        if ((lp->wStyle & 0x0F) != CBS_SIMPLE && wParam != (WPARAM)lp->ListBoxControl && wParam != 0)
+           SendMessage(hWnd, CB_SHOWDROPDOWN, 0, 0L);
+        fprintf(stderr," 385: WM_KILLFOCUS\n");
+        break;
+
+#if 0//jmt: fix: no WM_KEYDOWN
+    case WM_KEYDOWN:     /* MiD 08/14/95 */
+        /*
+        **   We have to process this message in order to show
+        **   current selection in a static control for certain
+        **   keys. This doesn't affect combobox with an edit
+        **   control, since the edit traps all key messages.
+        */
+        {
+        int nCur   = SendMessage(lp->ListBoxControl, LB_GETCURSEL,0, 0L);
+	int nPrevCur = nCur;
+        int nCount = SendMessage(lp->ListBoxControl, LB_GETCOUNT, 0, 0L);
+
+        if (nCount == 0)
+           break;
+
+        switch(wParam)
+            {
+            case VK_HOME:
+               nCur = 0;
+               break;
+
+            case VK_END:
+               nCur = nCount - 1;
+               break;
+
+            case VK_UP:
+               nCur--;
+               break;
+
+            case VK_DOWN:
+               nCur++;
+               break;
+
+            default:
+              return 0L;
+            }
+
+        if (nCur >= nCount)
+           nCur = nCount - 1;  
+        if (nCur < 0)
+           nCur = 0;
+
+        SendMessage(lp->ListBoxControl, LB_SETCURSEL, nCur, 0L);
+        SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID, hWnd, CBN_SELCHANGE));
+	if (nCur != nPrevCur)
+/* ecw */  SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID, hWnd, CBN_SELENDOK));
+        InvalidateRect(hWnd, NULL, 1);
+        break;
+        }
+#endif//WM_KEYDOWN
+
+    case WM_CHAR:
+        {
+        int nNewCur;
+        int nOldCur;
+
+        if (lp->EditControl)
+           {
+           SendMessage(lp->EditControl, uMsg, wParam, lParam);
+           }
+        else {
+             nOldCur = SendMessage(lp->ListBoxControl, LB_GETCURSEL,0, 0L);
+             SendMessage(lp->ListBoxControl, uMsg, wParam, lParam);
+             nNewCur = SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0L);
+             if (nNewCur != nOldCur)
+                {
+                SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID, hWnd, CBN_SELCHANGE));
+                InvalidateRect(hWnd, NULL, 1);
+                }
+             }
+        break;
+        }
+
+#if 0//jmt: fix: no WM_SETREDRAW
+    case WM_SETREDRAW: 
+        lp->bRedraw = wParam;
+        if (lp->EditControl)
+           SendMessage(lp->EditControl, WM_SETREDRAW, wParam, lParam);
+        if (lp->ListBoxControl)
+           SendMessage(lp->ListBoxControl, WM_SETREDRAW, wParam, lParam);
+        break;
+#endif        
+    case WM_CREATE: /*WM_NCCREATE:*/
+        lp = (COMBOBOX *)WinMalloc(sizeof(COMBOBOX));
+        memset((LPSTR)lp,'\0',sizeof(COMBOBOX));
+
+        /* save ptr to internal structure */
+        hWnd->userdata=(DWORD)lp;//-SetWindowLong(hWnd, CWD_LPCBDATA, (LONG) lp);
+
+        /* this is for CreateWindow calls */
+        hInst = NULL;//-GetWindowInstance(hWnd);
+
+        /* fill in the internal structure */
+        lpcs = (LPCREATESTRUCT)lParam;
+        lp->bRedraw = 1;
+        lp->wStateFlags = 0;
+        lp->wStyle  = (UINT)LOWORD(lpcs->style);
+        if (!BOWNERDRAW(lp))
+           lp->wStyle |= CBS_HASSTRINGS;
+        lp->bExtended  = TRUE;
+        lp->hFont = 0;
+        lp->hWndParent = lpcs->hwndParent;
+        lp->nID  = (UINT)lpcs->hMenu;
+
+#if 0//jmt: fix: no ownerdraw
+        /* calc the height of the edit/static control */
+        if (0)//(BOWNERDRAW(lp)) 
+           {
+           mis.CtlType = ODT_COMBOBOX;
+           mis.CtlID = (UINT)lpcs->hMenu;
+           mis.itemID = (UINT)-1;
+           mis.itemData = 0L;
+           SendMessage(lpcs->hwndParent, WM_MEASUREITEM, (WPARAM)lpcs->hMenu, (LPARAM)&mis);
+           /*** wEditHeight = (WORD)mis.itemHeight + 2; ***/
+           }
+#endif//ownerdraw
+
+        /* get system font dimensions */
+        hDC = GetDC((HWND)0);
+        GetTextMetrics(hDC,&tm);
+        ReleaseDC((HWND)0,hDC);
+
+        /* allow different fonts to fit, don't hard code */
+        /* otherwise big fonts won't fit. */
+        /*****wEditHeight = ((tm.tmHeight - tm.tmInternalLeading)*7)/4;*****/
+        wEditHeight = tm.tmHeight + tm.tmInternalLeading * 3;
+
+        lp->uHeight = (UINT)wEditHeight;
+
+	if ((lp->wStyle & 0x0F) != CBS_SIMPLE)
+           {
+           lp->ButtonRect.top    = 0;
+           lp->ButtonRect.left   = lpcs->cx - 1 - GetSystemMetrics(SM_CXVSCROLL);
+           lp->ButtonRect.right  = lpcs->cx;
+           lp->ButtonRect.bottom = wEditHeight;
+           /* for CBS_DROPDOWN/DROPDOWNLIST resize the window  */
+           SetWindowPos(hWnd, 0,
+                        0, 0, lpcs->cx, (int)wEditHeight,
+                        SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW);
+           }
+        else SetRectEmpty(&lp->ButtonRect);
+
+        if ((lp->wStyle & 0xf) != CBS_DROPDOWNLIST) 
+           {  /* EDIT field - calc edit control style */
+           dwStyle = WS_CHILD | WS_VISIBLE | WS_BORDER;
+           if (lp->wStyle & CBS_AUTOHSCROLL)
+              dwStyle |= ES_AUTOHSCROLL;
+           if (lp->wStyle & CBS_OEMCONVERT)
+              dwStyle |= ES_OEMCONVERT;
+
+           if ((lp->wStyle & 0x0F) == CBS_SIMPLE)
+	   {
+	     	fprintf(stderr," 528: wEditWidth = lpcs->cx=%d\n",lpcs->cx);
+	     	wEditWidth = lpcs->cx;
+	   }
+           else //?if ((lp->wStyle & 0xf) == CBS_DROPDOWN)
+	   {
+		fprintf(stderr," 533: wEditWidth = lp->ButtonRect.left - 5=%d;\n",lp->ButtonRect.left - 5);
+                wEditWidth = lp->ButtonRect.left - 5;
+	   }
+           /* create edit control */
+           lp->EditControl = CreateWindow("EDIT", NULL, dwStyle,
+                                          0, 0, wEditWidth, wEditHeight,
+                                          hWnd, (HMENU)CBC_EDITID,
+                                          hInst,(LPVOID)NULL);
+           }
+        else /* CBS_DROPDOWN -- static instead of edit */
+             lp->EditControl = 0;
+             
+        /* listbox style */
+	//jmt: fix: no WS_EX_SAVEBITS, WS_EX_NOCAPTURE, WS_EX_POPUPMENU
+        dwExStyle = 0L;//WS_EX_SAVEBITS | WS_EX_NOCAPTURE | WS_EX_POPUPMENU;
+        dwStyle =   WS_BORDER | LBS_NOTIFY ; //| LBS_COMBOLBOX;
+        if ((lp->wStyle & 0xf) == CBS_SIMPLE)
+            dwStyle |= WS_VISIBLE | WS_CHILD; 
+        else
+            dwStyle |= WS_POPUP;
+        //if (lp->wStyle & CBS_DISABLENOSCROLL)
+            //dwStyle |= LBS_DISABLENOSCROLL;
+        if (lp->wStyle & CBS_HASSTRINGS)
+            dwStyle |= LBS_HASSTRINGS;
+        if (lp->wStyle & CBS_NOINTEGRALHEIGHT)
+            dwStyle |= LBS_NOINTEGRALHEIGHT;
+        if (lp->wStyle & CBS_OWNERDRAWFIXED)
+            dwStyle |= LBS_OWNERDRAWFIXED;
+        if (lp->wStyle & CBS_OWNERDRAWVARIABLE)
+            dwStyle |= LBS_OWNERDRAWVARIABLE;
+        if (lp->wStyle & CBS_SORT)
+            dwStyle |= LBS_SORT;
+        if (lpcs->style & WS_VSCROLL)
+            dwStyle |= WS_VSCROLL;
+
+        /* calc listbox dimensions and position */
+        if ((lp->wStyle & 0xf) == CBS_SIMPLE) { 
+             lp->ListBoxRect.left = 5;
+             lp->ListBoxRect.top = wEditHeight - 1;
+             lp->ListBoxRect.right = lpcs->cx;
+             lp->ListBoxRect.bottom = lpcs->cy - 2;
+        } else {
+             lp->ListBoxRect.left = lpcs->x; 
+             lp->ListBoxRect.right = lp->ListBoxRect.left + lpcs->cx - 1;
+             lp->ListBoxRect.top = lpcs->y + wEditHeight - 1;
+             lp->ListBoxRect.bottom = lp->ListBoxRect.top + lpcs->cy + 1;
+             if ((lp->wStyle & 0x0F) == CBS_DROPDOWN) {
+                lp->ListBoxRect.left += 5;
+             }
+        }
+#ifdef LATER
+        cp.x = ((lp->wStyle & 0xf) == CBS_DROPDOWNLIST)?0:5;
+        cp.y = wEditHeight - 1;
+        if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+            ClientToScreen(hWnd,&cp);
+        lp->ListBoxRect.left = cp.x;
+        lp->ListBoxRect.top =  cp.y;
+        lp->ListBoxRect.right = cp.x + lpcs->cx;
+        if ((lp->wStyle & 0xf) != CBS_DROPDOWNLIST)
+            lp->ListBoxRect.right -= 5;
+        lp->ListBoxRect.bottom = lp->ListBoxRect.top + lpcs->cy -
+                wEditHeight + 1;
+#endif
+
+        lp->ListBoxControl = CreateWindowEx(dwExStyle,"LISTBOX",/*"COMBOLBOX",*/
+	    NULL, dwStyle,
+	    lp->ListBoxRect.left, lp->ListBoxRect.top,
+	    lp->ListBoxRect.right - lp->ListBoxRect.left,
+	    lp->ListBoxRect.bottom - lp->ListBoxRect.top,
+	    hWnd, 0,
+	    hInst,(LPVOID)NULL);
+#if MWCLIENT
+        //GrLowerWindow(lp->ListBoxControl->wid);
+	MwLowerWindow(lp->ListBoxControl);
+#endif           
+#ifdef  LATER
+        /* Microsoft Word 6.0 wants to see COMBOLBOX on top */
+        /*  of Z-order... */
+        if (dwStyle & WS_POPUP)
+	{
+            SetWindowPos(lp->ListBoxControl, HWND_TOP,
+                         0, 0, 0, 0,
+                         SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
+	}
+#endif
+
+#if 0//jmt: fix: no HWND32(LPWININFO)
+        /* physically expand client window,
+           if there is a scroll style
+        */
+        if (lpcs->style & WS_VSCROLL) 
+           {
+           HWND32 hWnd32 = GETHWND32(hWnd);
+
+           SetRectEmpty(&hWnd32->rcNC);
+
+           hWnd32->wWidth = (WORD) hWnd32->rWnd.right-hWnd32->rWnd.left;
+           hWnd32->wHeight = (WORD)hWnd32->rWnd.bottom-hWnd32->rWnd.top;
+	   RELEASEWININFO(hWnd32);
+           }
+#endif
+        /* 
+        **   Finally turn off border drawing and WM_?SCROLL styles to prevent creation
+        **   of system scrollbars.
+        */ 
+        dwStyle = GetWindowLong(hWnd, GWL_STYLE);//ok
+        dwStyle &= ~(WS_VSCROLL | WS_HSCROLL | WS_BORDER | WS_DLGFRAME | WS_THICKFRAME);
+        SetWindowLong(hWnd, GWL_STYLE, dwStyle);
+        lp->nListItems = 0;
+        return TRUE;
+
+    case WM_DESTROY: /*WM_NCDESTROY:*/
+        if (IsWindow(lp->ListBoxControl))
+           DestroyWindow(lp->ListBoxControl);
+        if (IsWindow(lp->EditControl))
+           DestroyWindow(lp->EditControl);
+        WinFree((LPSTR)lp);
+        return 0L;
+
+    case WM_GETDLGCODE:
+        return (LRESULT)(DLGC_WANTCHARS|DLGC_WANTARROWS);
+
+//jmt: twine->mwin bug fixed:
+    case WM_NCLBUTTONDOWN://jmt: a must 
+#if 0//twine->mw buggy
+    //!case WM_LBUTTONDOWN:
+#endif
+        if ((lp->wStyle & 0xf) == CBS_SIMPLE)
+            break;
+
+        cp.x = (int)(short)LOWORD(lParam);
+        cp.y = (int)(short)HIWORD(lParam);
+#if 1//WM_NCLBUTTONDOWM:
+        ScreenToClient(hWnd, &cp);//jmt: a must
+#endif
+        if (!IS_SET(lp, CSF_CAPTUREACTIVE)) /* no listbox yet */
+        {                                                                          
+           /* click on a button or anywhere if it's dropdown combo */
+           if (PtInRect(&lp->ButtonRect, cp) || 
+              (lp->wStyle & 0x0F) == CBS_DROPDOWNLIST)
+              {
+              if (PtInRect(&lp->ButtonRect, cp))
+                 CBoxDrawButton(hWnd, 1, lp);
+
+              cp.x = ((lp->wStyle & 0xf) != CBS_DROPDOWNLIST) ? 5 : 0;
+              cp.y = lp->uHeight - 1;
+
+              ClientToScreen(hWnd, &cp);
+
+	      fprintf(stderr," (1)lp->ListBoxRect:(%d,%d,%d,%d)\n",
+			  lp->ListBoxRect.left,
+			  lp->ListBoxRect.top,
+			  lp->ListBoxRect.right,
+			  lp->ListBoxRect.bottom);
+
+              OffsetRect(&lp->ListBoxRect, cp.x - lp->ListBoxRect.left, cp.y - lp->ListBoxRect.top);
+
+	      fprintf(stderr," (2)lp->ListBoxRect:(%d,%d,%d,%d)\n",
+			  lp->ListBoxRect.left,
+			  lp->ListBoxRect.top,
+			  lp->ListBoxRect.right,
+			  lp->ListBoxRect.bottom);
+
+              SetWindowPos(lp->ListBoxControl, HWND_TOP, /*0,*/
+                           cp.x, cp.y, 0, 0,
+                           SWP_NOSIZE | /*SWP_NOZORDER |*/ SWP_NOACTIVATE);
+
+              SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_DROPDOWN));
+	      /*  ECW   added following conditional...  4/4/96 */
+	      /*  JMT   following conditional is a must for microwindows  8/14/2k */
+	      if (1)//-(!IS_SET(lp, CSF_HASDROPPED))//jmt: a must 
+	      {
+		  /* ??first time it drops down, size it to hold all items?? */
+
+		  int nitems = SendMessage(lp->ListBoxControl,LB_GETCOUNT,0,0L);
+#if 0
+		  /* resize if too small, in this case, also do too long */
+		  if (lp->ListBoxRect.bottom - lp->ListBoxRect.top <
+		      ((lp->uHeight-2) * nitems)) 
+		  {
+#endif
+		    nitems = (nitems > 12 ? 12 : nitems); /* a dozen, max */
+
+#if 0//twine->mw buggy?
+		    lp->ListBoxRect.bottom =
+		      lp->ListBoxRect.top + ((lp->uHeight-2) * nitems);
+#endif
+	      	    fprintf(stderr," (2.5)lp->ListBoxRect:(%d,%d,%d,%d)\n",
+			  lp->ListBoxRect.left,
+			  lp->ListBoxRect.top,
+			  lp->ListBoxRect.right,
+			  lp->ListBoxRect.bottom);
+
+//jmt: twine->mwin bug fixed:
+	      	    fprintf(stderr," 706: fixed: SetWindowPos(lp->ListBoxControl,,%d,%d,...)\n",cp.x,cp.y);
+#if 0//twine->mwin bug
+		    SetWindowPos(lp->ListBoxControl,HWND_TOP,0,0,
+				 lp->ListBoxRect.right - lp->ListBoxRect.left,
+				 lp->ListBoxRect.bottom - lp->ListBoxRect.top,
+				 SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
+#else//jmt: twine->mwin bug fixed:
+		    SetWindowPos(lp->ListBoxControl,HWND_TOP,cp.x,cp.y,
+				 lp->ListBoxRect.right - lp->ListBoxRect.left,
+				 lp->ListBoxRect.bottom - lp->ListBoxRect.top,
+				 SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
+#endif
+
+#if 0
+		  }
+#endif
+		  SET_STATE(lp, CSF_HASDROPPED);
+	      }
+	      /*  End of addition */
+              ShowWindow(lp->ListBoxControl, SW_SHOW);
+#if 0//orig(twine)
+	      //?SetFocus(lp->ListBoxControl);
+#else//jmt: mwclient
+	      SetForegroundWindow(lp->ListBoxControl);
+#endif
+              CBoxCapture(hWnd, 1);
+              SET_STATE(lp, CSF_CAPTUREACTIVE);
+              SET_STATE(lp, CSF_BUTTONDOWN);
+              }
+        }
+        else 
+        { /* there is a listbox visible */
+             HWND hwndNewFocus = 0;
+             
+             cpScreen = cp;
+
+             if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+             {
+                ClientToScreen(hWnd, &cpScreen);
+                hwndNewFocus = WindowFromPoint(cpScreen);
+             }
+
+	     fprintf(stderr," (3)lp->ListBoxRect:(%d,%d,%d,%d)\n",
+			  lp->ListBoxRect.left,
+			  lp->ListBoxRect.top,
+			  lp->ListBoxRect.right,
+			  lp->ListBoxRect.bottom);
+
+             if (PtInRect(&lp->ListBoxRect, cpScreen))//
+             {
+                CBoxSendMouseToLBox(lp, WM_LBUTTONDOWN, wParam, cpScreen);
+             }
+             else 
+	     {
+                  if (PtInRect(&lp->ButtonRect, cp))
+                     CBoxDrawButton(hWnd, 0, lp);
+                  if ((lp->wStyle & 0x0F) == CBS_DROPDOWN && hwndNewFocus == lp->EditControl)
+                     /* don't close listbox */;
+                  else {
+                       SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_CLOSEUP));
+
+	      	       fprintf(stderr," 802: (hide) SetWindowPos(lp->ListBoxControl, , 0, 0, 0, 0,..)\n");
+
+                       SetWindowPos(lp->ListBoxControl, 0,
+                               0, 0, 0, 0,
+                               SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_HIDEWINDOW);
+#if MWCLIENT
+		       MwLowerWindow(lp->ListBoxControl);
+#endif
+                       CBoxCapture(hWnd, 0);
+                       CLEAR_STATE(lp, CSF_BUTTONDOWN);
+                       }
+                  CLEAR_STATE(lp, CSF_CAPTUREACTIVE);
+
+                  if (hwndNewFocus && hwndNewFocus != hWnd)
+                  {                      
+                     ScreenToClient(hwndNewFocus, &cpScreen);
+                     SetFocus(hwndNewFocus);
+
+                     SendMessage(hwndNewFocus, WM_LBUTTONDOWN, wParam, MAKELONG(cpScreen.x, cpScreen.y));
+                  }
+              }//!(PtInRect(&lp->ListBoxRect, cpScreen)) 
+         }
+        break;
+
+//jmt: twine->mwin bug fixed:
+    case WM_NCMOUSEMOVE://?
+#if 0//jmt: twine->mw buggy
+    //!case WM_MOUSEMOVE:
+#endif
+        if (!IS_SET(lp,CSF_BUTTONDOWN) && ((lp->wStyle & 0xf) == CBS_SIMPLE))
+            break;
+
+        cp.x = (int)(short)LOWORD(lParam);
+        cp.y = (int)(short)HIWORD(lParam);
+#if 1//WM_NCMOUSEMOVE:
+        ScreenToClient(hWnd, &cp);//jmt: a must
+#endif
+
+        if (IS_SET(lp, CSF_CAPTUREACTIVE)) 
+           {
+           if (PtInRect(&lp->ButtonRect,cp))
+              {
+              if (!IS_SET(lp, CSF_LOCALBUTTONDOWN))
+                 CBoxDrawButton(hWnd, 1, lp);
+              break;
+              }   
+           if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+              ClientToScreen(hWnd,&cp);
+           if (PtInRect(&lp->ListBoxRect,cp)) 
+              {
+              CBoxSendMouseToLBox(lp,WM_MOUSEMOVE,wParam,cp);
+              }
+           if (IS_SET(lp,CSF_LOCALBUTTONDOWN) && ((lp->wStyle & 0xf) != CBS_SIMPLE))
+              CBoxDrawButton(hWnd,0,lp);
+           }
+        break;
+
+//jmt: twine->mwin bug fixed:
+    case WM_NCLBUTTONUP://
+#if 0//twine->mw buggy
+    //!case WM_LBUTTONUP:
+#endif
+        if (!IS_SET(lp, CSF_CAPTUREACTIVE))
+            break;
+
+        cp.x = (int)(short)LOWORD(lParam);
+        cp.y = (int)(short)HIWORD(lParam);
+#if 1//WM_NCLBUTTONUP
+        ScreenToClient(hWnd, &cp);//jmt: a must
+#endif
+
+        CLEAR_STATE(lp,CSF_BUTTONDOWN);
+
+        if (PtInRect(&lp->ButtonRect, cp))
+           /*(lp->wStyle & 0x0F) == CBS_DROPDOWNLIST)*/
+           {
+           if (PtInRect(&lp->ButtonRect, cp))
+               CBoxDrawButton(hWnd, 0, lp);
+           if (IS_SET(lp, CSF_LBOXBUTTONDOWN)) 
+              {
+              if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+                 ClientToScreen(hWnd, &cp);
+              CBoxSendMouseToLBox(lp, WM_LBUTTONUP, wParam, cp);
+              CLEAR_STATE(lp,CSF_LBOXBUTTONDOWN);
+              }
+           break;
+           }
+        if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+           ClientToScreen(hWnd, &cp);
+
+        if (PtInRect(&lp->ListBoxRect, cp)) 
+           {
+           uiKey = (UINT)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0);
+           if (uiKey != (UINT)LB_ERR) 
+              { 
+              if (lp->EditControl)
+                 {
+                 SetFocus(lp->EditControl); 
+
+                 CBoxDrawEdit(lp, hWnd, uiKey); 
+                 }
+              else { 
+                   SetFocus(hWnd); 
+
+                   CBoxDrawStatic(lp, hWnd, uiKey); 
+                   }
+              
+              /*  LATER check the WS_EX_NOPARENTNOTIFY bit in ext style.*/
+/* ecw */     SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_SELENDOK));
+              SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_CLOSEUP));
+
+	      fprintf(stderr," 844: (hide) SetWindowPos(lp->ListBoxControl, , 0, 0, 0, 0,..)\n");
+
+              SetWindowPos(lp->ListBoxControl, 0,
+                           0, 0, 0, 0,
+                           SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_HIDEWINDOW);
+
+              CBoxCapture(hWnd, 0);
+              CLEAR_STATE(lp,CSF_CAPTUREACTIVE);
+              }//uiKey ok
+              
+           CBoxSendMouseToLBox(lp, WM_LBUTTONUP, wParam, cp);
+           CLEAR_STATE(lp,CSF_LBOXBUTTONDOWN);
+#if MWCLIENT
+	   //GrLowerWindow(lp->ListBoxControl->wid);
+	   MwLowerWindow(lp->ListBoxControl);
+#endif
+           }
+        else /* clicked somewhere outside button or listbox -
+             ** the listbox should stay intact... MiD
+             */
+             if (IS_SET(lp, CSF_LBOXBUTTONDOWN)) 
+                {
+                if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+                   ClientToScreen(hWnd, &cp);
+                CBoxSendMouseToLBox(lp, WM_LBUTTONUP, wParam, cp);
+                CLEAR_STATE(lp,CSF_LBOXBUTTONDOWN);
+                }
+        break;
+
+    case WM_ERASEBKGND:
+        return 1L;
+
+    case WM_PAINT:
+        BeginPaint(hWnd,&ps);
+        EndPaint(hWnd,&ps);
+
+        if (!IsWindowVisible(hWnd) || !lp->bRedraw)
+           return 0L;
+
+        if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+           CBoxDrawButton(hWnd, IS_SET(lp,CSF_LOCALBUTTONDOWN), lp);
+        uiKey = (UINT)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0);
+        if (lp->EditControl) 
+           CBoxDrawEdit(lp, hWnd, uiKey);
+        else CBoxDrawStatic(lp, hWnd, uiKey);
+        return 0L;
+        
+    case WM_COMMAND:
+        if (GET_WM_COMMAND_ID(wParam,lParam) == CBC_EDITID) {
+            /* edit/static control notifications */
+            switch((short)GET_WM_COMMAND_CMD(wParam,lParam)) {
+            case EN_SETFOCUS:
+#ifdef  LATER
+                wCBN = CBN_SETFOCUS;
+#else
+                wCBN = 0;
+#endif
+                break;
+            case EN_KILLFOCUS:
+                wCBN = CBN_KILLFOCUS;
+                break;
+            case EN_CHANGE:
+                {
+                int  index = 0;
+                char sz[128];
+                /*
+                **   Advance listbox
+                **   selection until there is string match. One first mismatch
+                **   listbox advances to its first item.
+                */
+                SendMessage(lp->EditControl, WM_GETTEXT, sizeof(sz)-1, (LPARAM)sz);
+                if (/*l*/strlen(sz) > 0/*L*/)
+                   index = (int)SendMessage(lp->ListBoxControl, LB_FINDSTRING, -1, (LPARAM)sz);
+                if (index == LB_ERR)
+                   index = 0;
+                SendMessage(lp->ListBoxControl, LB_SETTOPINDEX, index, 0L);
+                wCBN = CBN_EDITCHANGE;
+                break;
+                }
+            case EN_UPDATE:
+                wCBN = CBN_EDITUPDATE;
+                break;
+            case EN_ERRSPACE:
+                wCBN = CBN_ERRSPACE;
+                break;
+            default:
+                wCBN = 0;
+                break;
+            }
+            if (wCBN)
+            return SendMessage(lp->hWndParent,WM_COMMAND,
+                GET_WM_COMMAND_MPS(lp->nID,hWnd,wCBN));
+            else
+            return rc;
+        }
+        if (GET_WM_COMMAND_ID(wParam,lParam) == 0) {
+            /* listbox notifications */
+            switch ((short)GET_WM_COMMAND_CMD(wParam,lParam)) {
+            case LBN_ERRSPACE:
+                wCBN = CBN_ERRSPACE;
+                break;
+            case LBN_SELCHANGE:
+                if ((lp->wStyle & 0xf) == CBS_SIMPLE) 
+                   {
+                   uiKey = (UINT)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0);
+                   if (uiKey != (UINT)LB_ERR)
+                      if (lp->EditControl)
+                         {
+                         CBoxDrawEdit(lp, hWnd, uiKey);
+                         }
+                   }
+                wCBN = CBN_SELCHANGE;
+                break;
+            case LBN_DBLCLK:
+                wCBN = CBN_DBLCLK;
+                break;
+            case LBN_SELCANCEL: /* TODO */
+                wCBN = 0;
+                break;
+            case LBN_SETFOCUS:
+                wCBN = CBN_SETFOCUS;
+                break;
+            case LBN_KILLFOCUS:
+                wCBN = CBN_KILLFOCUS;
+                break;
+            default:
+                wCBN = 0;
+                break;
+            }
+            if (wCBN)
+               return SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,wCBN));
+            else
+            return rc;
+            }
+        break;
+
+    case WM_GETTEXT:
+	if ( lp->EditControl )
+	    return SendMessage(lp->EditControl,uMsg,wParam,lParam);
+	else if ( lp->ListBoxControl ) {
+	    WPARAM sel, len;
+
+	    sel = (WPARAM)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0);
+	    if ( sel != (WPARAM)LB_ERR ) {
+		len = (WPARAM)SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, 0, 0);
+		if ( len <= wParam )
+		    return SendMessage(lp->ListBoxControl, LB_GETTEXT, sel, lParam);
+	    }
+	}
+	return CB_ERR;
+
+    case WM_GETTEXTLENGTH:
+	if ( lp->EditControl )
+	    return SendMessage(lp->EditControl,uMsg,wParam,lParam);
+	else if ( lp->ListBoxControl ) {
+	    WPARAM sel;
+
+	    sel = (WPARAM)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0);
+	    if ( sel != (WPARAM)LB_ERR ) 
+		return SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, sel, 0);
+	}
+	return CB_ERR;
+
+    case WM_SETTEXT:
+	if ( lp->EditControl )
+	    return SendMessage(lp->EditControl,uMsg,wParam,lParam);
+	return CB_ERR;
+
+#if 0//jmt: fix: no WM_SETFONT/WM_GETFONT
+    case WM_SETFONT:
+        lp->hFont = (HFONT)wParam;
+
+        hDC = GetDC(hWnd);
+        SelectObject(hDC,lp->hFont);
+        GetTextMetrics(hDC,&tm);
+        ReleaseDC(hWnd,hDC);
+        wEditHeight = tm.tmHeight + 3 * tm.tmInternalLeading;
+
+        if (wEditHeight == lp->uHeight)
+            return 0L;
+
+        lp->uHeight = (UINT)wEditHeight;
+        lp->ButtonRect.bottom = wEditHeight;
+        /*
+        **   The following SetWindowPos causes WM_WINDOWPOSCHANGING message
+        **   where child windows are resized and/or moved.
+        */
+        ShowWindow(hWnd, SW_HIDE);
+        GetClientRect(hWnd,&rcClient);
+        if ((lp->wStyle & 0xf) != CBS_SIMPLE) 
+           SetWindowPos(hWnd, 0,
+                        0, 0, rcClient.right, (int)wEditHeight,
+                        SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW);
+        else SetWindowPos(hWnd, 0,
+                          0, 0, rcClient.right, (int)wEditHeight + lp->ListBoxRect.bottom - lp->ListBoxRect.top + 1,
+                          SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW);
+        ShowWindow(hWnd, SW_SHOWNA);
+
+        if (lp->EditControl)
+           SendMessage(lp->EditControl, WM_SETFONT, wParam,lParam);
+        SendMessage(lp->ListBoxControl, WM_SETFONT, wParam,lParam);
+
+        if(LOWORD(lParam))
+            RedrawWindow(hWnd,(const RECT *)0,(HRGN)0,
+            RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW );
+        return (LRESULT)0;
+
+    case WM_GETFONT:
+        return lp->hFont;
+#endif//WM_SETFONT/WM_GETFONT
+
+    case WM_MOVE: /*WM_WINDOWPOSCHANGING:*/
+#if 0
+        lpwp = (LPWINDOWPOS)lParam;
+#else
+	pp.x=LOWORD(lParam);
+	pp.y=HIWORD(lParam);
+#endif
+        if (1)/*(lpwp)*/ {
+        if (1)/*(!(lpwp->flags & SWP_NOSIZE))*/ {
+            lp->ButtonRect.right  = (hWnd->winrect.right-hWnd->winrect.left);//lpwp->cx;
+            if ((lp->wStyle & 0xf) == CBS_SIMPLE) 
+               lp->ButtonRect.left = lp->ButtonRect.right;
+            else lp->ButtonRect.left = (hWnd->winrect.right-hWnd->winrect.left)/*lpwp->cx*/ - 1 -
+                    GetSystemMetrics(SM_CXVSCROLL);
+
+            if (lp->EditControl) 
+               {
+               wEditWidth = lp->ButtonRect.left + 1;
+               if ((lp->wStyle & 0xf) == CBS_SIMPLE)
+                  wEditWidth --;
+               if ((lp->wStyle & 0xf) == CBS_DROPDOWN)
+                  wEditWidth -= 5;
+               SetWindowPos(lp->EditControl,(HWND)0,
+                            0,0,
+                            wEditWidth, lp->uHeight,
+                            SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
+               }
+            if (lp->ListBoxControl) 
+               {
+               if ((lp->wStyle & 0x0F) == CBS_SIMPLE)
+                  {
+                  lp->ListBoxRect.left = 5;
+                  lp->ListBoxRect.top = lp->uHeight - 1;
+                  lp->ListBoxRect.right = (hWnd->winrect.right-hWnd->winrect.left);//lpwp->cx;
+                  lp->ListBoxRect.bottom = (hWnd->winrect.bottom-hWnd->winrect.top)/*lpwp->cy*/ - 2;
+                  }
+               else {
+                    POINT cp;
+		    cp.x = 0;
+		    cp.y = lp->uHeight - 1;
+                    ClientToScreen(hWnd, &cp);
+                    OffsetRect(&lp->ListBoxRect, cp.x - lp->ListBoxRect.left, cp.y - lp->ListBoxRect.top);
+
+                    lp->ListBoxRect.right = lp->ListBoxRect.left + (hWnd->winrect.right-hWnd->winrect.left)/*lpwp->cx*/;
+                    if ((lp->wStyle & 0xf) != CBS_DROPDOWNLIST)
+                       lp->ListBoxRect.right -= 5;
+                    }
+
+               SetWindowPos(lp->ListBoxControl,(HWND)0,
+                            lp->ListBoxRect.left, lp->ListBoxRect.top, 
+                            lp->ListBoxRect.right - lp->ListBoxRect.left,
+                            lp->ListBoxRect.bottom - lp->ListBoxRect.top,
+                            SWP_NOACTIVATE|SWP_NOZORDER);
+               }
+#if 0//jmt: fix: no WM_WINDOWPOSCHANGING
+            /* the height of the normal state stays the same */
+            if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+               lpwp->cy = (int)lp->uHeight;
+#endif
+            }
+        }
+        return (LRESULT)0;
+
+    case WM_WINDOWPOSCHANGED:
+        DefWindowProc(hWnd,uMsg,wParam,lParam);
+        lpwp = (LPWINDOWPOS)lParam;
+        if (lpwp) {
+       		if (!(lpwp->flags & SWP_NOSIZE)) /* TODO */
+#if 0
+            		RedrawWindow(hWnd,(const RECT *)0,(HRGN)0,
+            			RDW_INVALIDATE|RDW_ERASE);
+#else
+			InvalidateRect(hWnd,NULL,TRUE);
+#endif
+        }
+        return (LRESULT)0;
+
+#if 0//jmt: fix: no ownerdraw
+    /*********************************************/
+    /* ownerdraw stuff               */
+    /*********************************************/
+    case WM_DRAWITEM:
+        lpdis = (LPDRAWITEMSTRUCT)lParam;
+        lpdis->CtlType = ODT_COMBOBOX;
+        lpdis->CtlID = lp->nID;
+        lpdis->hwndItem = hWnd;
+        return SendMessage(lp->hWndParent,WM_DRAWITEM,
+                (WPARAM)lp->nID,lParam);
+
+    case WM_MEASUREITEM:
+        lpmis = (LPMEASUREITEMSTRUCT)lParam;
+        lpmis->CtlType = ODT_COMBOBOX;
+        lpmis->CtlID = lp->nID;
+        return SendMessage(lp->hWndParent,WM_MEASUREITEM,
+                (WPARAM)lp->nID,lParam);
+
+    case WM_DELETEITEM:
+        lpdlis = (LPDELETEITEMSTRUCT)lParam;
+        lpdlis->CtlType = ODT_COMBOBOX;
+        lpdlis->CtlID = lp->nID;
+        lpdlis->hwndItem = hWnd;
+        return SendMessage(lp->hWndParent,WM_DELETEITEM,
+                (WPARAM)lp->nID,lParam);
+
+    case WM_CONVERT:
+        if (!lpComboBinToNat) {
+        	hComboClass32 = FindClass("COMBOBOX",0);
+        	lpComboBinToNat = (WNDPROC)GetClassHandleLong(
+                	hComboClass32,GCL_BINTONAT);
+        }
+        if (lpComboBinToNat)
+        return lpComboBinToNat(hWnd, uMsg, wParam, lParam);
+        else
+        return (LRESULT)0;
+#endif//ownerdraw
+
+    default:
+        return DefCBProc( hWnd, uMsg, wParam, lParam);
+    }
+    return rc;
+}
+
+/************************************************************************
+**
+************************************************************************/
+static LRESULT DefCBProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    int       len,index;
+    COMBOBOX *lp;
+    char     *selection;
+    int   rc;
+    POINT   cp;
+
+    lp = (COMBOBOX *) hWnd->userdata/*GetWindowLong(hWnd,CWD_LPCBDATA)*/;
+    switch(uMsg) {
+        /*********************************************/
+        /* messages specific to the list box control */
+        /*********************************************/
+        case CB_ADDSTRING:
+            lp->nListItems++;  /* shd. test for successful return */
+            return SendMessage(lp->ListBoxControl,LB_ADDSTRING,
+                wParam,lParam);
+            
+        case CB_DELETESTRING:
+	    if (lp->nListItems)
+	      lp->nListItems--;
+            return SendMessage(lp->ListBoxControl,LB_DELETESTRING,
+                wParam,lParam);
+            
+        case CB_DIR:
+            return SendMessage(lp->ListBoxControl,LB_DIR,
+                wParam,lParam);
+            
+        case CB_FINDSTRING:
+            return SendMessage(lp->ListBoxControl,LB_FINDSTRING,
+                wParam,lParam);
+            
+        case CB_FINDSTRINGEXACT:
+               return SendMessage(lp->ListBoxControl,LB_FINDSTRINGEXACT,
+                wParam,lParam);
+            
+        case CB_GETCOUNT:
+            return SendMessage(lp->ListBoxControl,LB_GETCOUNT,
+                wParam,lParam);
+            
+        case CB_GETCURSEL:
+            return SendMessage(lp->ListBoxControl,LB_GETCURSEL,
+                wParam,lParam);
+            
+        case CB_GETITEMDATA:
+            return SendMessage(lp->ListBoxControl,LB_GETITEMDATA,
+                wParam,lParam);
+            
+        case CB_GETITEMHEIGHT:
+            return SendMessage(lp->ListBoxControl,LB_GETITEMHEIGHT,
+                wParam,lParam);
+            
+        case CB_GETLBTEXT:
+            return SendMessage(lp->ListBoxControl,LB_GETTEXT,
+                wParam,lParam);
+            
+        case CB_GETLBTEXTLEN:
+            return SendMessage(lp->ListBoxControl,LB_GETTEXTLEN,
+                wParam,lParam);
+            
+        case CB_INSERTSTRING:
+            return SendMessage(lp->ListBoxControl,LB_INSERTSTRING,
+                wParam,lParam);
+            
+        case CB_SETITEMDATA:
+            return SendMessage(lp->ListBoxControl,LB_SETITEMDATA,
+                wParam,lParam);
+            
+        /*********************************************/
+        /* messages specific to the edit control */
+        /*********************************************/
+        case CB_GETEDITSEL:
+            return SendMessage(lp->EditControl,EM_GETSEL,0,0);
+                
+        case CB_LIMITTEXT:
+            return SendMessage(lp->EditControl,EM_LIMITTEXT,
+                wParam,lParam);
+
+        case CB_SETEDITSEL:
+            return SendMessage(lp->EditControl,EM_SETSEL,
+                wParam,lParam);
+
+        /*********************************************/
+        /* messages handled by the combobox          */
+        /*********************************************/
+        case CB_GETDROPPEDCONTROLRECT:
+            CopyRect((LPRECT)lParam,&lp->ListBoxRect);
+            break;
+        case CB_GETDROPPEDSTATE:
+            return IS_SET(lp,CSF_CAPTUREACTIVE);
+
+        case CB_GETEXTENDEDUI:
+            return (LRESULT)lp->bExtended;
+
+        case CB_RESETCONTENT:
+            SendMessage(lp->ListBoxControl,LB_RESETCONTENT,0,0);
+            if (lp->EditControl)
+               SendMessage(lp->EditControl,WM_SETTEXT,0,(LPARAM)(LPSTR)"");
+            break;
+
+        case CB_SELECTSTRING:
+            index = (int)SendMessage(lp->ListBoxControl, LB_SELECTSTRING, wParam, lParam);
+            if (index == LB_ERR)
+               return CB_ERR;
+
+            len = (int)SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, index, 0);
+            if (len <= 0)
+               return CB_ERR;
+
+            selection = (LPSTR)WinMalloc((UINT)len+1);  
+            rc = (int)SendMessage(lp->ListBoxControl, LB_GETTEXT, (WPARAM)index, (LPARAM)selection);
+            if (lp->EditControl)
+               rc = (int)SendMessage(lp->EditControl, WM_SETTEXT, 0, (LPARAM)selection);
+            else CBoxDrawStatic(lp, hWnd, index);
+            WinFree(selection);
+            break;
+            
+        case CB_SETCURSEL:
+            rc = (int)SendMessage(lp->ListBoxControl, LB_SETCURSEL, wParam, lParam);
+            if (rc == LB_ERR)
+               return CB_ERR;
+            len = (int)SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, wParam, 0);
+            if (len <= 0)
+               return CB_ERR;
+
+            selection = (LPSTR)WinMalloc((UINT)len+1);  
+            rc = (int)SendMessage(lp->ListBoxControl, LB_GETTEXT, wParam, (LPARAM)selection);
+            if (lp->EditControl)
+               rc = (int)SendMessage(lp->EditControl, WM_SETTEXT, 0, (LPARAM)selection);
+            else CBoxDrawStatic(lp, hWnd, wParam);
+            WinFree(selection);
+            return (LRESULT)wParam;
+
+        case CB_SETEXTENDEDUI:
+            lp->bExtended = (BOOL)wParam;
+            break;  
+
+        case CB_SETITEMHEIGHT:      /* TODO */
+            break;
+
+        case CB_SHOWDROPDOWN:
+            if ((lp->wStyle & 0xf) == CBS_SIMPLE)
+                return 1L;
+            if (wParam) 
+            {
+               if (IS_SET(lp,CSF_CAPTUREACTIVE))
+                  return 1L;
+
+               cp.x = ((lp->wStyle & 0xf) != CBS_DROPDOWNLIST) ? 5 : 0;
+               cp.y = lp->uHeight -1;
+
+               ClientToScreen(hWnd, &cp);
+               OffsetRect(&lp->ListBoxRect, cp.x - lp->ListBoxRect.left, cp.y - lp->ListBoxRect.top);
+
+               SetWindowPos(lp->ListBoxControl, 0,
+                            cp.x, cp.y, 0, 0,
+                            SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
+
+               SendMessage(lp->hWndParent,WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_DROPDOWN));
+
+	       fprintf(stderr," 1330: SetWindowPos(lp->ListBoxControl, , 0, 0, 0, 0,..)\n");
+
+               SetWindowPos(lp->ListBoxControl, HWND_TOP,
+                            0, 0, 0, 0,
+                            SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
+
+                CBoxCapture(hWnd, 1);
+                SET_STATE(lp,CSF_CAPTUREACTIVE);
+             }
+            else 
+	    {
+                 if (!IS_SET(lp,CSF_CAPTUREACTIVE))
+                    return 1L;
+
+                 SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_CLOSEUP));
+//test:
+  	         fprintf(stderr," 1343: (hide) SetWindowPos(lp->ListBoxControl, , 0, 0, 0, 0,..)\n");
+
+                 SetWindowPos(lp->ListBoxControl, 0,
+                              0, 0, 0, 0,
+                              SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_HIDEWINDOW);
+
+                 CBoxCapture(hWnd, 0);
+                 CLEAR_STATE(lp, CSF_CAPTUREACTIVE);
+             }
+            return 1L;
+
+        /*********************************************/
+        /* messages handled by the defwindowproc.... */
+        /*********************************************/
+        default:
+            return DefWindowProc( hWnd, uMsg, wParam, lParam);
+    }
+    return CB_OKAY;
+}
+
+
+static void
+CBoxDrawButton(HWND hWnd,UINT wState,COMBOBOX *lp)
+{
+    HDC       hDC;
+    int     x,y;
+    int     dx,dy;
+#if 0//jmt: fix: no LoadBitmap()
+    //-int     cx,cy;
+    //-static int nWidth,nHeight;
+    //-BITMAP    bmpCombo;
+    //-static HBITMAP hbmpCombo = 0; 
+    //-HBITMAP   hbmpOld = 0;
+    //-HDC       hdcSrc;
+    //-COLORREF  rgbText, rgbBk;
+#endif
+    HBRUSH    hBrush;
+    HPEN      hPenHigh,hPenShadow;
+    RECT      rc;
+
+    hDC = GetDC(hWnd);
+
+    CopyRect(&rc,&lp->ButtonRect);
+    x = rc.left;
+    y = rc.top;
+    dx = rc.right;
+    dy = rc.bottom;
+
+    hPenHigh = GetStockObject(WHITE_PEN);
+#if 0
+    //-hPenShadow = GetSysColorPen(COLOR_BTNSHADOW);
+#else
+    hPenShadow = CreatePen(PS_SOLID,1,GetSysColor(COLOR_BTNSHADOW));
+#endif
+#if 0
+    //-hBrush = GetSysColorBrush(COLOR_BTNFACE);
+#else
+    hBrush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
+#endif
+    FillRect(hDC, &rc, hBrush);
+#if 0
+    hBrush = GetStockObject(BLACK_BRUSH);
+    FillRect/*FrameRect*/(hDC, &lp->ButtonRect, hBrush);//?
+#else
+    SelectObject(hDC,GetStockObject(BLACK_PEN));
+    Rectangle(hDC,lp->ButtonRect.left,lp->ButtonRect.top,lp->ButtonRect.right,lp->ButtonRect.bottom);
+#endif
+    rc.left += 1; rc.right -= 1;
+    rc.top += 1; rc.bottom -= 1;
+
+    Draw3DButtonRect(hDC,hPenHigh,hPenShadow,rc,wState);
+
+#if 0//jmt: fix: no LoadBitmap(),GetObject()
+    if (hbmpCombo == 0) 
+       {
+       hbmpCombo = LoadBitmap(0,(LPSTR)OBM_COMBO);
+       GetObject(hbmpCombo, sizeof(BITMAP), (LPVOID)&bmpCombo);
+       nWidth  = bmpCombo.bmWidth;
+       nHeight = bmpCombo.bmHeight;
+       }
+   /*
+   **   MiD 08/15/95 changed to mono bitmap as it is in Windows. Convert
+   **                it to colors on the fly
+   */
+   hdcSrc = CreateCompatibleDC(hDC);
+   hbmpOld = SelectObject(hdcSrc, hbmpCombo);
+   /*
+   **   Source hdc ok. Prepare the target hdc, then BitBlt to it.
+   */
+   rgbText = SetTextColor(hDC,GetSysColor(COLOR_BTNTEXT));
+   rgbBk = SetBkColor(hDC,GetSysColor(COLOR_BTNFACE));
+
+   cx = (dx - x - nWidth)/2;
+   cy = (dy - y - nHeight)/2;
+   if (wState) 
+      {  cx++; cy++;  }
+   BitBlt(hDC, x+cx, y+cy, nWidth, nHeight, hdcSrc, 0, 0, SRCCOPY);
+
+   SetTextColor(hDC, rgbText);
+   SetBkColor(hDC, rgbBk);
+   SelectObject(hdcSrc,hbmpOld);
+   DeleteDC(hdcSrc);
+#endif//BitBlt Bitmap
+#if 1
+   DeleteObject(hBrush);
+   DeleteObject(hPenShadow);
+#endif
+   ReleaseDC(hWnd,hDC);
+
+    if (wState)
+        SET_STATE(lp,CSF_LOCALBUTTONDOWN);
+    else
+        CLEAR_STATE(lp,CSF_LOCALBUTTONDOWN);
+}
+
+#if 0//jmt: fix: no COMBOLBOX
+/************************************************************************
+**
+************************************************************************/
+LRESULT DefCOMBOLBOXProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    //-return DefLISTBOXProc(hWnd, msg, wParam,lParam);
+    return ListboxCtrlProc(hWnd, msg, wParam,lParam);
+}
+#endif
+
+/************************************************************************
+**
+************************************************************************/
+static void CBoxSendMouseToLBox(COMBOBOX *lp, UINT uiMsg, WPARAM wParam, POINT ptScreen)
+{
+    POINT pt;
+    int nNCHit;
+#if 0//jmt: fix: no scrollbar
+    //-HWND hWndScroll;
+#endif
+    pt = ptScreen;
+    ScreenToClient(lp->ListBoxControl,&pt);
+
+    nNCHit = LOSHORT(SendMessage(lp->ListBoxControl, WM_NCHITTEST, 0, MAKELPARAM(ptScreen.x,ptScreen.y)));
+
+    switch (nNCHit) 
+       {
+       case HTCLIENT:
+           if (uiMsg == WM_MOUSEMOVE && !IS_SET(lp,CSF_LBOXBUTTONDOWN)) 
+              {
+              SendMessage(lp->ListBoxControl, WM_LBUTTONDOWN, 0, MAKELONG((WORD)pt.x,(WORD)pt.y));
+
+              SET_STATE(lp, CSF_BUTTONDOWN | CSF_LBOXBUTTONDOWN);
+              }
+           SendMessage(lp->ListBoxControl, uiMsg, wParam, MAKELONG((WORD)pt.x,(WORD)pt.y));
+           break;
+
+#if 0//jmt: fix: no scrollbar           
+       case HTVSCROLL:
+           if (0 != (hWndScroll = TWIN_ConvertToSysScroll(lp->ListBoxControl, TRUE /* vertical */, &pt)))
+              SendMessage(hWndScroll, uiMsg, wParam, MAKELONG((WORD)pt.x,(WORD)pt.y));
+           break;
+#endif           
+       default:
+           break;
+    }
+}
+
+/************************************************************************
+**
+************************************************************************/
+static void CBoxCapture(HWND hWnd, WORD wFunc)
+{
+    static HWND hWndCapture = (HWND)0;
+
+    if (wFunc) 
+       {
+       hWndCapture = SetCapture(hWnd);
+
+       SetFocus(hWnd);
+       }
+    else {
+         if (!hWndCapture)
+            ReleaseCapture();
+         else {
+#ifdef  LATER
+              SetCapture(hWndCapture);
+#else
+              ReleaseCapture();
+#endif
+              hWndCapture = (HWND)0;
+              }
+         }
+}
+
+/************************************************************************
+**
+************************************************************************/
+static void CBoxDrawEdit(COMBOBOX *lp, HWND hWnd, UINT uiKey)
+{
+    int    nLen;
+    LPVOID lpData;
+#if 0//jmt: fix: no ownerdraw
+    //HRGN   hRgn;
+    //-DRAWITEMSTRUCT dis;
+#endif
+/*
+    if (uiKey == (UINT)LB_ERR)
+       return;
+
+    if (!BOWNERDRAW(lp)) 
+*/
+    if (lp->wStyle & CBS_HASSTRINGS)
+       {
+       if (uiKey == (UINT)LB_ERR)
+	  return;
+       nLen = (int)SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, uiKey, 0L);
+       if (nLen <= 0)
+           return;
+       lpData = (LPVOID)WinMalloc(nLen+1);
+       SendMessage(lp->ListBoxControl, LB_GETTEXT, uiKey, (LPARAM)lpData);
+       SendMessage(lp->EditControl, WM_SETTEXT, strlen(lpData), (LPARAM)lpData);
+       Edit_SetSel(lp->EditControl, 0, -1);
+       WinFree((LPSTR)lpData);
+       }
+#if 0//jmt: fix: no ownerdraw
+    else {
+         dis.CtlType = ODT_COMBOBOX;
+         dis.CtlID = (UINT)lp->nID;
+         dis.itemID = -1; /* used to be uiKey */
+         dis.itemAction = ODA_DRAWENTIRE;
+         dis.itemState = ODS_FOCUS;
+         dis.hwndItem = hWnd;
+         dis.itemData = 0;
+         GetClientRect(lp->EditControl,&dis.rcItem);
+         dis.rcItem.left += 3;
+         dis.rcItem.right -= 3;
+         dis.rcItem.top += 2;
+         dis.rcItem.bottom -= 2;
+
+         dis.hDC = GetDC(lp->EditControl);
+         hRgn = CreateRectRgnIndirect(&dis.rcItem);
+         SelectClipRgn(dis.hDC,hRgn);
+         SelectObject(dis.hDC, lp->hFont);
+         SendMessage(lp->hWndParent, WM_DRAWITEM, (WPARAM)(UINT)lp->nID, (LPARAM)&dis);
+         ReleaseDC(lp->EditControl,dis.hDC);
+         DeleteObject(hRgn);
+         }   
+#endif//ownerdraw
+}
+
+/************************************************************************
+**
+************************************************************************/
+static void CBoxDrawStatic(COMBOBOX *lp, HWND hWnd, UINT uiKey)
+{   
+    int    nLen;
+    HDC    hdc;
+    LPVOID lpData;
+    RECT   rcClient;
+    HFONT  hfonOld = 0;
+#if 0//jmt: fix: no ownerdraw
+    //HRGN   hRgn;
+    //-DRAWITEMSTRUCT dis;
+#endif
+    HBRUSH hbrStatic, hbrOld;               
+    
+    /*   Draw rectangle regardless of ownerdraw style...
+    */           
+    hdc = GetDC(hWnd);         
+    rcClient.left   = 0;
+    rcClient.top    = 0;
+    rcClient.right  = lp->ButtonRect.left+1;
+    rcClient.bottom = lp->uHeight;
+    hbrStatic = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
+    hbrOld = SelectObject(hdc, hbrStatic);
+    SelectObject(hdc, GetStockObject(BLACK_PEN));/* ??? COLOR_WINDOWFRAME */
+    Rectangle(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
+    SelectObject(hdc, hbrOld);
+    DeleteObject(hbrStatic);
+    ReleaseDC(hWnd, hdc);
+
+    if (uiKey == (UINT)LB_ERR)
+       return;
+
+//jmt: no ownerdraw
+    if (1)//(!BOWNERDRAW(lp))
+       {
+       /* if necessary, draw text */
+       hdc = GetDC(hWnd);
+       nLen = (int)SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, (WPARAM)uiKey, 0L);
+       if (nLen > 0)
+          {
+          lpData = (LPVOID)WinMalloc(nLen+1);
+          SendMessage(lp->ListBoxControl, LB_GETTEXT, uiKey, (LPARAM)lpData);
+          SetBkMode(hdc, TRANSPARENT);
+          if (!IS_SET(lp, CSF_FOCUS))
+             {
+             SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT));
+             rcClient.left += 2;
+             }
+          else {
+               InflateRect(&rcClient, -2, -2);
+               hbrStatic = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT));
+               hbrOld = SelectObject(hdc, hbrStatic);
+               FillRect(hdc, &rcClient, hbrStatic);
+#if 0//jmt: fix: no DrawFocusRect()
+               //?DrawFocusRect(hdc, &rcClient);
+#endif
+               SelectObject(hdc, hbrOld);
+               DeleteObject(hbrStatic);
+               SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
+               }
+          if (lp->hFont)
+             hfonOld = SelectObject(hdc, lp->hFont);
+          DrawText(hdc, (LPSTR)lpData, nLen, &rcClient, DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
+          if (lp->hFont)
+             SelectObject(hdc, hfonOld);
+          WinFree((LPVOID)lpData);
+          }
+       ReleaseDC(hWnd, hdc);
+       }
+#if 0//jmt: fix: no ownerdraw
+    else { /* fill OWNERDRAWSTRUCT and send WM_DRAWITEM message */
+         dis.CtlType    = ODT_COMBOBOX;
+         dis.CtlID      = (UINT)lp->nID;
+         dis.itemID     = uiKey;
+         dis.itemAction = ODA_DRAWENTIRE;
+         dis.itemState  = ODS_FOCUS;
+         dis.hwndItem   = hWnd;
+         dis.itemData   = SendMessage(lp->ListBoxControl, LB_GETITEMDATA, uiKey, 0L);
+         GetClientRect(hWnd, &dis.rcItem);
+         dis.rcItem.left += 3; 
+         dis.rcItem.right = lp->ButtonRect.left - 2;  /* do not touch button */
+         dis.rcItem.top += 2; 
+         dis.rcItem.bottom -= 2; 
+
+         dis.hDC = GetDC(hWnd);
+         hRgn = CreateRectRgnIndirect(&dis.rcItem);
+         SelectClipRgn(dis.hDC, hRgn);
+         SelectObject(dis.hDC, lp->hFont);
+         SendMessage(lp->hWndParent, WM_DRAWITEM, (WPARAM)(UINT)lp->nID, (LPARAM)&dis);
+         ReleaseDC(hWnd, dis.hDC);
+         DeleteObject(hRgn);
+         }  
+#endif//ownerdraw
+ 
+}
+
+
+/*------------------------- < Full Revision History > ----------------------
+** $Log: ComboBox.c,v $
+** Revision 1.8  2000/08/14 jmt
+** ported to microwin(non-client/server mode)
+**
+** Revision 1.7  2000/06/28 jmt
+** porting to microwin
+**
+** Revision 1.6  2000/01/21 02:48:47  robf
+** remove dead code
+**
+** Revision 1.5  1999/11/29 05:07:54  robf
+** removed extraneous call CreateCompatibleDC
+**
+** Revision 1.4  1999/07/08 18:52:50  mwalsh
+** Updated Comments
+**
+**-------------------------------------------------------------------------*/
+
diff -urN lib/microwindows/src/mwin/winlib/combobox.org /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/combobox.org
--- lib/microwindows/src/mwin/winlib/combobox.org	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/combobox.org	2005-02-21 16:13:27.000000000 +0100
@@ -0,0 +1,1597 @@
+/*--------------------------------------------------------------------------
+**      ComboBox.c             Twin           From:  Twin/controls
+**
+**              
+**------------------------- < License Information > ------------------------
+**
+**      This file was originally a part of Willows TWIN.  Willows
+**  TWIN was released under a Library GPL (LGPL).  This permits
+**  redistribution of this source code, provided that the full
+**  TWIN license is in effect, and provided that all modifications
+**  to this source code are made publicly available.
+**  Please refer to Willows software (www.willows.com) or
+**  LICENSE for full information.
+**  
+**      Under Twine, this file is also protected by an LGPL.  Please
+**  see LICENSE for full details on this license.
+**  
+**
+**      Copyright 1997 Willows Software, Inc. 
+**------------------------ < File Content Description > --------------------
+**
+**  Module:	 controls/ComboBox.c
+**
+**  Description:
+**      
+**
+**  Functions defined:
+**    
+**------------------------- < Revision Information > -----------------------
+** $Header: /twinecvs/src/controls/ComboBox.c,v 1.6 2000/01/21 02:48:47 robf Exp $
+** $Header: /mwin/winlib/ComboBox.c,v 1.7 2000/06/28 jmt Exp $
+**
+**      Full Revision history at bottom of file
+**      
+**--------------------------------------------------------------------------*/
+#ifndef OEMRESOURCE
+#define OEMRESOURCE     /* for OBM_CLOSE */
+#endif
+/*----------------------------------------------------------------------------
+**              E X T E R N A L     I N C L U D E S 
+**--------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+**              I N T E R N A L     I N C L U D E S
+**--------------------------------------------------------------------------*/
+
+
+#include "windows.h"
+#include "windowsx.h"
+
+#undef OEMRESOURCE
+
+//-#include "WinDefs.h"    /* this file now knows about HWND32 */
+//?#include "WinData.h"
+//?#include "Driver.h"
+//?#include "Log.h"
+
+#if 1
+#include <stdlib.h> //free
+#define WinMalloc(n)	malloc((n))
+#define WinFree(p)	free(p)
+
+#define GET_WM_COMMAND_ID(wp, lp)               LOWORD(wp)
+#define GET_WM_COMMAND_HWND(wp, lp)             (HWND)(lp)
+#define GET_WM_COMMAND_CMD(wp, lp)              HIWORD(wp)
+#define GET_WM_COMMAND_MPS(id, hwnd, cmd)    \
+        (WPARAM)MAKELONG(id, cmd), (LONG)(hwnd)
+#define LOSHORT(x)	(short int)LOWORD(x)
+#define Edit_SetSel(hwndCtl, ichStart, ichEnd)  ((void)SendMessage((hwndCtl), EM_SETSEL, (ichStart), (ichEnd)))
+#endif
+
+#include <string.h>
+
+typedef struct  {
+    HFONT   hFont;          /* hFont used */
+    HWND    hWndParent;     /* parent window */
+    UINT    nID;            /* control ID */
+    WORD    wStateFlags;    /* combobox state flags */
+    UINT    wStyle;         /* this is a copy of LOWORD(style) */
+    BOOL    bExtended;      /* extended UI flag */
+    BOOL    bRedraw;        /* MiD - redraw flag, draw only if it's 1 */
+    HWND    EditControl;    /* edit/static control hWnd */
+    HWND    ListBoxControl; /* listbox control hWnd */
+    RECT    ButtonRect;     /* local button rect (client) */
+    RECT    ListBoxRect;    /* listbox rect (screen) */
+    UINT    uHeight;        /* height of the normal state */
+    WNDPROC lpfnOldStatic;  /* previous static wndproc */
+    UINT    nListItems;     /* ecw */
+} COMBOBOX;
+
+#define CWD_LPCBDATA  0
+#define CBC_EDITID    1
+
+#define CSF_CAPTUREACTIVE   0x0001
+#define CSF_LOCALBUTTONDOWN 0x0002
+#define CSF_BUTTONDOWN      0x0004
+#define CSF_LBOXBUTTONDOWN  0x0008
+#define CSF_FOCUS           0x0010 /* MiD */
+#define CSF_HASDROPPED	    0x0020 /* weav */
+
+#define SET_STATE(lp, wMask)   (lp->wStateFlags |= (wMask))
+#define CLEAR_STATE(lp, wMask) (lp->wStateFlags &= ~(wMask))
+#define IS_SET(lp, wMask)      (lp->wStateFlags & (wMask))
+
+#define BOWNERDRAW(l) ((l)->wStyle & (CBS_OWNERDRAWFIXED|CBS_OWNERDRAWVARIABLE))
+
+/**********************************************
+    Styles:
+
+    CBS_AUTOHSCROLL     passed to the edit control
+    CBS_DISABLENOSCROLL passed to the listbox control
+    CBS_DROPDOWN
+    CBS_DROPDOWNLIST
+    CBS_HASSTRINGS      passed to the listbox control
+    CBS_NOINTEGRALHEIGHT    passed to the listbox control
+    CBS_OEMCONVERT      passed to the edit control
+    CBS_OWNERDRAWFIXED  passed to the listbox control
+    CBS_OWNERDRAWVARIABLE   passed to the listbox control
+    CBS_SIMPLE      TODO
+    CBS_SORT        passed to the listbox control
+
+    WS_VSCROLL      passed to the listbox control
+
+*********************************************/
+
+/**********************************************
+    CBN_xxx messages to be added
+
+    from mouse tracking...
+    CBN_SELENDCANCEL    TODO
+    CBN_SELENDOK        TODO
+
+*********************************************/
+
+/* imported stuff */
+#if 1
+void
+Draw3DButtonRect(HDC hDC, HPEN hPenHigh, HPEN hPenShadow,
+		RECT rc, BOOL fClicked)
+{
+    HPEN     hPenOld;
+    POINT    lpt[6];
+
+    hPenOld = SelectObject(hDC, hPenShadow);
+    if (fClicked) {
+	lpt[0].x = lpt[1].x = rc.left;
+	lpt[1].y = lpt[2].y = rc.top;
+	lpt[2].x = rc.right-1;
+	lpt[0].y = rc.bottom-1;
+        Polyline(hDC,lpt,3);
+    }
+    else {
+	lpt[0].x = lpt[1].x = rc.right-1;
+	lpt[0].y = rc.top;
+	lpt[1].y = lpt[2].y = rc.bottom-1;
+	lpt[2].x = rc.left;
+	lpt[3].x = rc.left+1;	
+	lpt[3].y = lpt[4].y = rc.bottom-2;	
+	lpt[4].x = lpt[5].x = rc.right-2;
+	lpt[5].y = rc.top+1;
+	Polyline(hDC,lpt,6);
+
+	SelectObject(hDC, hPenHigh);
+	lpt[0].x = rc.right-1;
+	lpt[0].y = lpt[1].y = rc.top;
+	lpt[1].x = lpt[2].x = rc.left;
+	lpt[2].y = rc.bottom-1;
+	lpt[3].x = lpt[4].x = rc.left+1;
+	lpt[3].y = rc.bottom-2;
+	lpt[4].y = lpt[5].y = rc.top+1;
+	lpt[5].x = rc.right-2;
+	Polyline(hDC,lpt,6);
+    }
+    SelectObject(hDC,hPenOld);
+}
+#endif
+
+#if 0//jmt: fix: no COMBOLBOX
+//-extern LRESULT  DefLISTBOXProc(HWND, UINT, WPARAM, LPARAM);
+extern LRESULT  ListboxCtrlProc(HWND, UINT, WPARAM, LPARAM);
+#endif
+
+#if 0
+//-static HPEN     GetSysColorPen(int color)//?
+//-{
+//-	return NULL;//?
+//-}
+//-static HBRUSH   GetSysColorBrush(int color)//?
+//-{
+//-	return NULL;//?
+//-}
+#endif
+typedef HWND HWND32;
+#if 0//jmt: fix: no ownerdraw
+//-typedef HANDLE HCLASS32;
+//-static HCLASS32 FindClass(LPCSTR str, HINSTANCE hInstance)//?
+//-{
+//-	return NULL;//?
+//-}
+#endif
+#if 0//jmt: fix: no scrollbar
+//-static HWND TWIN_ConvertToSysScroll(HWND hwnd, BOOL status, LPPOINT pp)//?
+//-{
+//-	return NULL;//?
+//-}
+#endif
+static HWND WindowFromPoint(POINT pt)
+{
+	return NULL;//fix!!
+}
+
+/* internal stuff */
+static void CBoxDrawButton(HWND,UINT,COMBOBOX *);
+static void CBoxSendMouseToLBox(COMBOBOX *, UINT, WPARAM, POINT);
+static void CBoxCapture(HWND, WORD);
+static void CBoxDrawEdit(COMBOBOX *, HWND, UINT);
+static void CBoxDrawStatic(COMBOBOX *, HWND, UINT); /* MiD */
+
+/* handle specific CB messages */
+static LRESULT DefCBProc(HWND , UINT , WPARAM , LPARAM );
+
+#if 0//jmt: fix: no ownerdraw
+//-static WNDPROC lpComboBinToNat = 0;
+#endif
+
+static LRESULT CALLBACK 
+DefComboboxProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+int WINAPI MwRegisterComboboxControl(HINSTANCE hInstance)
+{
+	WNDCLASS	wc;
+
+	wc.style	= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
+	wc.lpfnWndProc	= (WNDPROC)DefComboboxProc;
+	wc.cbClsExtra	= 0;
+	wc.cbWndExtra	= 0;
+	wc.hInstance	= hInstance;
+	wc.hIcon	= NULL;
+	wc.hCursor	= 0; 
+	wc.hbrBackground= GetStockObject(WHITE_BRUSH);
+	wc.lpszMenuName	= NULL;
+	wc.lpszClassName= "COMBOBOX";
+
+	return RegisterClass(&wc);
+}
+
+static LRESULT CALLBACK 
+DefComboboxProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    PAINTSTRUCT ps;
+    HDC      hDC;
+    TEXTMETRIC tm;
+#if 0//jmt: fix: no ownerdraw
+    //-MEASUREITEMSTRUCT mis;
+#endif
+    COMBOBOX *lp = (COMBOBOX *)NULL;
+    LRESULT   rc;
+    HINSTANCE hInst;
+    POINT     cp,cpScreen,pp;
+    UINT      uiKey;
+    LPCREATESTRUCT lpcs;
+#if 1//jmt: fix: no WM_WINDOWPOSCHANGING
+    LPWINDOWPOS lpwp;
+#endif
+#if 0//jmt: fix: no ownerdraw
+    //-HCLASS32 hComboClass32;
+    //-LPMEASUREITEMSTRUCT lpmis;
+    //-LPDRAWITEMSTRUCT lpdis;
+    //-LPDELETEITEMSTRUCT lpdlis;
+#endif
+    DWORD dwStyle,dwExStyle;
+    WORD wEditWidth = 0,wEditHeight;
+    WORD wCBN;
+#if 0//jmt: fix: no WM_SETFONT/WM_GETFONT
+    RECT rcClient;
+#endif
+
+    rc = CB_OKAY;
+    if ((uMsg != WM_CREATE/*WM_NCCREATE*/) && /*(uMsg != WM_CONVERT) &&*/
+       !(lp = (COMBOBOX *)hWnd->userdata/*GetWindowLong(hWnd,CWD_LPCBDATA)*/))
+    	return rc;
+
+    switch(uMsg) {
+#ifdef  LATER
+    case WM_SIZE:
+    case WM_ENABLE:
+    case WM_LBUTTONDBLCLK:
+    case WM_COMPAREITEM:
+    case WM_CUT:
+    case WM_CLEAR:
+#endif               
+
+    case WM_SETFOCUS:
+        SET_STATE(lp, CSF_FOCUS);
+        if ((lp->wStyle & 0x0F) == CBS_DROPDOWNLIST)
+           {
+           uiKey = (UINT)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0L);
+           CBoxDrawStatic(lp, hWnd, uiKey);
+           }
+	if (lp->EditControl)
+	   SetFocus(lp->EditControl);
+        break;
+        
+    case WM_KILLFOCUS:
+        CLEAR_STATE(lp, CSF_FOCUS);
+        if ((lp->wStyle & 0x0F) == CBS_DROPDOWNLIST)
+           {
+           uiKey = (UINT)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0L);
+           CBoxDrawStatic(lp, hWnd, uiKey);
+           }
+        /*
+        **    Hide listbox when loosing focus to window other than 
+        **    our own listbox... When wParam == 0 we "loose" the focus
+        **    to the scrollbar in a listbox!
+        */
+        if ((lp->wStyle & 0x0F) != CBS_SIMPLE && wParam != (WPARAM)lp->ListBoxControl && wParam != 0)
+           SendMessage(hWnd, CB_SHOWDROPDOWN, 0, 0L);
+
+        break;
+
+#if 0//jmt: fix: no WM_KEYDOWN
+    case WM_KEYDOWN:     /* MiD 08/14/95 */
+        /*
+        **   We have to process this message in order to show
+        **   current selection in a static control for certain
+        **   keys. This doesn't affect combobox with an edit
+        **   control, since the edit traps all key messages.
+        */
+        {
+        int nCur   = SendMessage(lp->ListBoxControl, LB_GETCURSEL,0, 0L);
+	int nPrevCur = nCur;
+        int nCount = SendMessage(lp->ListBoxControl, LB_GETCOUNT, 0, 0L);
+
+        if (nCount == 0)
+           break;
+
+        switch(wParam)
+            {
+            case VK_HOME:
+               nCur = 0;
+               break;
+
+            case VK_END:
+               nCur = nCount - 1;
+               break;
+
+            case VK_UP:
+               nCur--;
+               break;
+
+            case VK_DOWN:
+               nCur++;
+               break;
+
+            default:
+              return 0L;
+            }
+
+        if (nCur >= nCount)
+           nCur = nCount - 1;  
+        if (nCur < 0)
+           nCur = 0;
+
+        SendMessage(lp->ListBoxControl, LB_SETCURSEL, nCur, 0L);
+        SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID, hWnd, CBN_SELCHANGE));
+	if (nCur != nPrevCur)
+/* ecw */  SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID, hWnd, CBN_SELENDOK));
+        InvalidateRect(hWnd, NULL, 1);
+        break;
+        }
+#endif//WM_KEYDOWN
+
+    case WM_CHAR:
+        {
+        int nNewCur;
+        int nOldCur;
+
+        if (lp->EditControl)
+           {
+           SendMessage(lp->EditControl, uMsg, wParam, lParam);
+           }
+        else {
+             nOldCur = SendMessage(lp->ListBoxControl, LB_GETCURSEL,0, 0L);
+             SendMessage(lp->ListBoxControl, uMsg, wParam, lParam);
+             nNewCur = SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0L);
+             if (nNewCur != nOldCur)
+                {
+                SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID, hWnd, CBN_SELCHANGE));
+                InvalidateRect(hWnd, NULL, 1);
+                }
+             }
+        break;
+        }
+
+#if 0//jmt: fix: no WM_SETREDRAW
+    case WM_SETREDRAW: 
+        lp->bRedraw = wParam;
+        if (lp->EditControl)
+           SendMessage(lp->EditControl, WM_SETREDRAW, wParam, lParam);
+        if (lp->ListBoxControl)
+           SendMessage(lp->ListBoxControl, WM_SETREDRAW, wParam, lParam);
+        break;
+#endif        
+    case WM_CREATE: /*WM_NCCREATE:*/
+        lp = (COMBOBOX *)WinMalloc(sizeof(COMBOBOX));
+        memset((LPSTR)lp,'\0',sizeof(COMBOBOX));
+
+        /* save ptr to internal structure */
+        hWnd->userdata=(DWORD)lp;//-SetWindowLong(hWnd, CWD_LPCBDATA, (LONG) lp);
+
+        /* this is for CreateWindow calls */
+        hInst = NULL;//-GetWindowInstance(hWnd);
+
+        /* fill in the internal structure */
+        lpcs = (LPCREATESTRUCT)lParam;
+        lp->bRedraw = 1;
+        lp->wStateFlags = 0;
+        lp->wStyle  = (UINT)LOWORD(lpcs->style);
+        if (!BOWNERDRAW(lp))
+           lp->wStyle |= CBS_HASSTRINGS;
+        lp->bExtended  = TRUE;
+        lp->hFont = 0;
+        lp->hWndParent = lpcs->hwndParent;
+        lp->nID  = (UINT)lpcs->hMenu;
+
+#if 0//jmt: fix: no ownerdraw
+        /* calc the height of the edit/static control */
+        if (0)//(BOWNERDRAW(lp)) 
+           {
+           mis.CtlType = ODT_COMBOBOX;
+           mis.CtlID = (UINT)lpcs->hMenu;
+           mis.itemID = (UINT)-1;
+           mis.itemData = 0L;
+           SendMessage(lpcs->hwndParent, WM_MEASUREITEM, (WPARAM)lpcs->hMenu, (LPARAM)&mis);
+           /*** wEditHeight = (WORD)mis.itemHeight + 2; ***/
+           }
+#endif//ownerdraw
+
+        /* get system font dimensions */
+        hDC = GetDC((HWND)0);
+        GetTextMetrics(hDC,&tm);
+        ReleaseDC((HWND)0,hDC);
+
+        /* allow different fonts to fit, don't hard code */
+        /* otherwise big fonts won't fit. */
+        /*****wEditHeight = ((tm.tmHeight - tm.tmInternalLeading)*7)/4;*****/
+        wEditHeight = tm.tmHeight + tm.tmInternalLeading * 3;
+
+        lp->uHeight = (UINT)wEditHeight;
+
+	if ((lp->wStyle & 0x0F) != CBS_SIMPLE)
+           {
+           lp->ButtonRect.top    = 0;
+           lp->ButtonRect.left   = lpcs->cx - 1 - GetSystemMetrics(SM_CXVSCROLL);
+           lp->ButtonRect.right  = lpcs->cx;
+           lp->ButtonRect.bottom = wEditHeight;
+           /* for CBS_DROPDOWN/DROPDOWNLIST resize the window  */
+           SetWindowPos(hWnd, 0,
+                        0, 0, lpcs->cx, (int)wEditHeight,
+                        SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW);
+           }
+        else SetRectEmpty(&lp->ButtonRect);
+
+        if ((lp->wStyle & 0xf) != CBS_DROPDOWNLIST) 
+           {  /* EDIT field - calc edit control style */
+           dwStyle = WS_CHILD | WS_VISIBLE | WS_BORDER;
+           if (lp->wStyle & CBS_AUTOHSCROLL)
+              dwStyle |= ES_AUTOHSCROLL;
+           if (lp->wStyle & CBS_OEMCONVERT)
+              dwStyle |= ES_OEMCONVERT;
+
+           if ((lp->wStyle & 0x0F) == CBS_SIMPLE)
+             wEditWidth = lpcs->cx;
+           else if ((lp->wStyle & 0xf) == CBS_DROPDOWN)
+                   wEditWidth = lp->ButtonRect.left - 5;
+
+           /* create edit control */
+           lp->EditControl = CreateWindow("EDIT", NULL, dwStyle,
+                                          0, 0, wEditWidth, wEditHeight,
+                                          hWnd, (HMENU)CBC_EDITID,
+                                          hInst,(LPVOID)NULL);
+           }
+        else /* CBS_DROPDOWN -- static instead of edit */
+             lp->EditControl = 0;
+             
+        /* listbox style */
+	//jmt: fix: no WS_EX_SAVEBITS, WS_EX_NOCAPTURE, WS_EX_POPUPMENU
+        dwExStyle = 0L;//WS_EX_SAVEBITS | WS_EX_NOCAPTURE | WS_EX_POPUPMENU;
+        dwStyle =   WS_BORDER | LBS_NOTIFY ; //| LBS_COMBOLBOX;
+        if ((lp->wStyle & 0xf) == CBS_SIMPLE)
+            dwStyle |= WS_VISIBLE | WS_CHILD; 
+        else
+            dwStyle |= WS_POPUP;
+        //if (lp->wStyle & CBS_DISABLENOSCROLL)
+            //dwStyle |= LBS_DISABLENOSCROLL;
+        if (lp->wStyle & CBS_HASSTRINGS)
+            dwStyle |= LBS_HASSTRINGS;
+        if (lp->wStyle & CBS_NOINTEGRALHEIGHT)
+            dwStyle |= LBS_NOINTEGRALHEIGHT;
+        if (lp->wStyle & CBS_OWNERDRAWFIXED)
+            dwStyle |= LBS_OWNERDRAWFIXED;
+        if (lp->wStyle & CBS_OWNERDRAWVARIABLE)
+            dwStyle |= LBS_OWNERDRAWVARIABLE;
+        if (lp->wStyle & CBS_SORT)
+            dwStyle |= LBS_SORT;
+        if (lpcs->style & WS_VSCROLL)
+            dwStyle |= WS_VSCROLL;
+
+        /* calc listbox dimensions and position */
+        if ((lp->wStyle & 0xf) == CBS_SIMPLE) { 
+             lp->ListBoxRect.left = 5;
+             lp->ListBoxRect.top = wEditHeight - 1;
+             lp->ListBoxRect.right = lpcs->cx;
+             lp->ListBoxRect.bottom = lpcs->cy - 2;
+        } else {
+             lp->ListBoxRect.left = lpcs->x; 
+             lp->ListBoxRect.right = lp->ListBoxRect.left + lpcs->cx - 1;
+             lp->ListBoxRect.top = lpcs->y + wEditHeight - 1;
+             lp->ListBoxRect.bottom = lp->ListBoxRect.top + lpcs->cy + 1;
+             if ((lp->wStyle & 0x0F) == CBS_DROPDOWN) {
+                lp->ListBoxRect.left += 5;
+             }
+        }
+#ifdef LATER
+        cp.x = ((lp->wStyle & 0xf) == CBS_DROPDOWNLIST)?0:5;
+        cp.y = wEditHeight - 1;
+        if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+            ClientToScreen(hWnd,&cp);
+        lp->ListBoxRect.left = cp.x;
+        lp->ListBoxRect.top =  cp.y;
+        lp->ListBoxRect.right = cp.x + lpcs->cx;
+        if ((lp->wStyle & 0xf) != CBS_DROPDOWNLIST)
+            lp->ListBoxRect.right -= 5;
+        lp->ListBoxRect.bottom = lp->ListBoxRect.top + lpcs->cy -
+                wEditHeight + 1;
+#endif
+        lp->ListBoxControl = CreateWindowEx(dwExStyle,"LISTBOX",/*"COMBOLBOX",*/
+	    NULL, dwStyle,
+	    lp->ListBoxRect.left, lp->ListBoxRect.top,
+	    lp->ListBoxRect.right - lp->ListBoxRect.left,
+	    lp->ListBoxRect.bottom - lp->ListBoxRect.top,
+	    hWnd, 0,
+	    hInst,(LPVOID)NULL);
+           
+#ifdef  LATER
+        /* Microsoft Word 6.0 wants to see COMBOLBOX on top */
+        /*  of Z-order... */
+        if (dwStyle & WS_POPUP)
+            SetWindowPos(lp->ListBoxControl, HWND_TOP,
+                         0, 0, 0, 0,
+                         SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
+#endif
+
+#if 0//jmt: fix: no HWND32(LPWININFO)
+        /* physically expand client window,
+           if there is a scroll style
+        */
+        if (lpcs->style & WS_VSCROLL) 
+           {
+           HWND32 hWnd32 = GETHWND32(hWnd);
+
+           SetRectEmpty(&hWnd32->rcNC);
+
+           hWnd32->wWidth = (WORD) hWnd32->rWnd.right-hWnd32->rWnd.left;
+           hWnd32->wHeight = (WORD)hWnd32->rWnd.bottom-hWnd32->rWnd.top;
+	   RELEASEWININFO(hWnd32);
+           }
+#endif
+        /* 
+        **   Finally turn off border drawing and WM_?SCROLL styles to prevent creation
+        **   of system scrollbars.
+        */ 
+        dwStyle = GetWindowLong(hWnd, GWL_STYLE);//ok
+        dwStyle &= ~(WS_VSCROLL | WS_HSCROLL | WS_BORDER | WS_DLGFRAME | WS_THICKFRAME);
+        SetWindowLong(hWnd, GWL_STYLE, dwStyle);
+        lp->nListItems = 0;
+        return TRUE;
+
+    case WM_DESTROY: /*WM_NCDESTROY:*/
+        if (IsWindow(lp->ListBoxControl))
+           DestroyWindow(lp->ListBoxControl);
+        if (IsWindow(lp->EditControl))
+           DestroyWindow(lp->EditControl);
+        WinFree((LPSTR)lp);
+        return 0L;
+
+    case WM_GETDLGCODE:
+        return (LRESULT)(DLGC_WANTCHARS|DLGC_WANTARROWS);
+
+    case WM_LBUTTONDOWN:
+        if ((lp->wStyle & 0xf) == CBS_SIMPLE)
+            break;
+
+        cp.x = (int)(short)LOWORD(lParam);
+        cp.y = (int)(short)HIWORD(lParam);
+
+        if (!IS_SET(lp, CSF_CAPTUREACTIVE)) /* no listbox yet */
+           {                                                                          
+           /* click on a button or anywhere if it's dropdown combo */
+           if (PtInRect(&lp->ButtonRect, cp) || 
+              (lp->wStyle & 0x0F) == CBS_DROPDOWNLIST)
+              {
+              if (PtInRect(&lp->ButtonRect, cp))
+                 CBoxDrawButton(hWnd, 1, lp);
+              cp.x = ((lp->wStyle & 0xf) != CBS_DROPDOWNLIST) ? 5 : 0;
+              cp.y = lp->uHeight - 1;
+              ClientToScreen(hWnd, &cp);
+              OffsetRect(&lp->ListBoxRect, cp.x - lp->ListBoxRect.left, cp.y - lp->ListBoxRect.top);
+              SetWindowPos(lp->ListBoxControl, HWND_TOP, /*0,*/
+                           cp.x, cp.y, 0, 0,
+                           SWP_NOSIZE | /*SWP_NOZORDER |*/ SWP_NOACTIVATE);
+              SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_DROPDOWN));
+	      /*  ECW   added following conditional...  4/4/96 */
+	      if (!IS_SET(lp, CSF_HASDROPPED)) {
+		  /* first time it drops down, size it to hold all items */
+		  int nitems = SendMessage(lp->ListBoxControl,LB_GETCOUNT,0,0L);
+#if 0
+		  /* resize if too small, in this case, also do too long */
+		  if (lp->ListBoxRect.bottom - lp->ListBoxRect.top <
+		      ((lp->uHeight-2) * nitems)) {
+#endif
+		    nitems = (nitems > 12 ? 12 : nitems); /* a dozen, max */
+		    lp->ListBoxRect.bottom =
+		      lp->ListBoxRect.top + ((lp->uHeight-2) * nitems);
+		    SetWindowPos(lp->ListBoxControl,HWND_TOP,0,0,
+				 lp->ListBoxRect.right - lp->ListBoxRect.left,
+				 lp->ListBoxRect.bottom - lp->ListBoxRect.top,
+				 SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER);
+#if 0
+		  }
+#endif
+		  SET_STATE(lp, CSF_HASDROPPED);
+	      }
+	      /*  End of addition */
+              ShowWindow(lp->ListBoxControl, SW_SHOW);
+	      SetFocus(lp->ListBoxControl);
+              CBoxCapture(hWnd, 1);
+              SET_STATE(lp, CSF_CAPTUREACTIVE);
+              SET_STATE(lp, CSF_BUTTONDOWN);
+              }
+           }
+        else { /* there is a listbox visible */
+             HWND hwndNewFocus = 0;
+             
+             cpScreen = cp;
+             if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+                {
+                ClientToScreen(hWnd, &cpScreen);
+                hwndNewFocus = WindowFromPoint(cpScreen);
+                }
+             if (PtInRect(&lp->ListBoxRect, cpScreen)) 
+                {
+                CBoxSendMouseToLBox(lp, WM_LBUTTONDOWN, wParam, cpScreen);
+                }
+             else {
+                  if (PtInRect(&lp->ButtonRect, cp))
+                     CBoxDrawButton(hWnd, 0, lp);
+                  if ((lp->wStyle & 0x0F) == CBS_DROPDOWN && hwndNewFocus == lp->EditControl)
+                     /* don't close listbox */;
+                  else {
+                       SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_CLOSEUP));
+                       SetWindowPos(lp->ListBoxControl, 0,
+                               0, 0, 0, 0,
+                               SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_HIDEWINDOW);
+                       CBoxCapture(hWnd, 0);
+                       CLEAR_STATE(lp, CSF_BUTTONDOWN);
+                       }
+                  CLEAR_STATE(lp, CSF_CAPTUREACTIVE);
+                  if (hwndNewFocus && hwndNewFocus != hWnd)
+                     {                      
+                     ScreenToClient(hwndNewFocus, &cpScreen);
+                     SetFocus(hwndNewFocus);
+                     SendMessage(hwndNewFocus, WM_LBUTTONDOWN, wParam, MAKELONG(cpScreen.x, cpScreen.y));
+                     }
+                  }
+             }
+        break;
+
+    case WM_MOUSEMOVE:
+        if (!IS_SET(lp,CSF_BUTTONDOWN) && ((lp->wStyle & 0xf) == CBS_SIMPLE))
+            break;
+        cp.x = (int)(short)LOWORD(lParam);
+        cp.y = (int)(short)HIWORD(lParam);
+        if (IS_SET(lp, CSF_CAPTUREACTIVE)) 
+           {
+           if (PtInRect(&lp->ButtonRect,cp))
+              {
+              if (!IS_SET(lp, CSF_LOCALBUTTONDOWN))
+                 CBoxDrawButton(hWnd, 1, lp);
+              break;
+              }   
+           if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+              ClientToScreen(hWnd,&cp);
+           if (PtInRect(&lp->ListBoxRect,cp)) 
+              {
+              CBoxSendMouseToLBox(lp,WM_MOUSEMOVE,wParam,cp);
+              }
+           if (IS_SET(lp,CSF_LOCALBUTTONDOWN) && ((lp->wStyle & 0xf) != CBS_SIMPLE))
+              CBoxDrawButton(hWnd,0,lp);
+           }
+        break;
+
+    case WM_LBUTTONUP:
+        if (!IS_SET(lp, CSF_CAPTUREACTIVE))
+            break;
+        cp.x = (int)(short)LOWORD(lParam);
+        cp.y = (int)(short)HIWORD(lParam);
+
+        CLEAR_STATE(lp,CSF_BUTTONDOWN);
+
+        if (PtInRect(&lp->ButtonRect, cp))
+           /*(lp->wStyle & 0x0F) == CBS_DROPDOWNLIST)*/
+           {
+           if (PtInRect(&lp->ButtonRect, cp))
+               CBoxDrawButton(hWnd, 0, lp);
+           if (IS_SET(lp, CSF_LBOXBUTTONDOWN)) 
+              {
+              if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+                 ClientToScreen(hWnd, &cp);
+              CBoxSendMouseToLBox(lp, WM_LBUTTONUP, wParam, cp);
+              CLEAR_STATE(lp,CSF_LBOXBUTTONDOWN);
+              }
+           break;
+           }
+        if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+           ClientToScreen(hWnd, &cp);
+
+        if (PtInRect(&lp->ListBoxRect, cp)) 
+           {
+           uiKey = (UINT)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0);
+           if (uiKey != (UINT)LB_ERR) 
+              { 
+              if (lp->EditControl)
+                 { 
+                 SetFocus(lp->EditControl); 
+                 CBoxDrawEdit(lp, hWnd, uiKey); 
+                 }
+              else { 
+                   SetFocus(hWnd); 
+                   CBoxDrawStatic(lp, hWnd, uiKey); 
+                   }
+              
+              /*  LATER check the WS_EX_NOPARENTNOTIFY bit in ext style.*/
+/* ecw */     SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_SELENDOK));
+              SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_CLOSEUP));
+              SetWindowPos(lp->ListBoxControl, 0,
+                           0, 0, 0, 0,
+                           SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_HIDEWINDOW);
+              CBoxCapture(hWnd, 0);
+              CLEAR_STATE(lp,CSF_CAPTUREACTIVE);
+           }
+              
+           CBoxSendMouseToLBox(lp, WM_LBUTTONUP, wParam, cp);
+           CLEAR_STATE(lp,CSF_LBOXBUTTONDOWN);
+           }
+        else /* clicked somewhere outside button or listbox -
+             ** the listbox should stay intact... MiD
+             */
+             if (IS_SET(lp, CSF_LBOXBUTTONDOWN)) 
+                {
+                if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+                   ClientToScreen(hWnd, &cp);
+                CBoxSendMouseToLBox(lp, WM_LBUTTONUP, wParam, cp);
+                CLEAR_STATE(lp,CSF_LBOXBUTTONDOWN);
+                }
+        break;
+
+    case WM_ERASEBKGND:
+        return 1L;
+
+    case WM_PAINT:
+        BeginPaint(hWnd,&ps);
+        EndPaint(hWnd,&ps);
+
+        if (!IsWindowVisible(hWnd) || !lp->bRedraw)
+           return 0L;
+
+        if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+           CBoxDrawButton(hWnd, IS_SET(lp,CSF_LOCALBUTTONDOWN), lp);
+        uiKey = (UINT)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0);
+        if (lp->EditControl) 
+           CBoxDrawEdit(lp, hWnd, uiKey);
+        else CBoxDrawStatic(lp, hWnd, uiKey);
+        return 0L;
+        
+    case WM_COMMAND:
+        if (GET_WM_COMMAND_ID(wParam,lParam) == CBC_EDITID) {
+            /* edit/static control notifications */
+            switch((short)GET_WM_COMMAND_CMD(wParam,lParam)) {
+            case EN_SETFOCUS:
+#ifdef  LATER
+                wCBN = CBN_SETFOCUS;
+#else
+                wCBN = 0;
+#endif
+                break;
+            case EN_KILLFOCUS:
+                wCBN = CBN_KILLFOCUS;
+                break;
+            case EN_CHANGE:
+                {
+                int  index = 0;
+                char sz[128];
+                /*
+                **   Advance listbox
+                **   selection until there is string match. One first mismatch
+                **   listbox advances to its first item.
+                */
+                SendMessage(lp->EditControl, WM_GETTEXT, sizeof(sz)-1, (LPARAM)sz);
+                if (/*l*/strlen(sz) > 0/*L*/)
+                   index = (int)SendMessage(lp->ListBoxControl, LB_FINDSTRING, -1, (LPARAM)sz);
+                if (index == LB_ERR)
+                   index = 0;
+                SendMessage(lp->ListBoxControl, LB_SETTOPINDEX, index, 0L);
+                wCBN = CBN_EDITCHANGE;
+                break;
+                }
+            case EN_UPDATE:
+                wCBN = CBN_EDITUPDATE;
+                break;
+            case EN_ERRSPACE:
+                wCBN = CBN_ERRSPACE;
+                break;
+            default:
+                wCBN = 0;
+                break;
+            }
+            if (wCBN)
+            return SendMessage(lp->hWndParent,WM_COMMAND,
+                GET_WM_COMMAND_MPS(lp->nID,hWnd,wCBN));
+            else
+            return rc;
+        }
+        if (GET_WM_COMMAND_ID(wParam,lParam) == 0) {
+            /* listbox notifications */
+            switch ((short)GET_WM_COMMAND_CMD(wParam,lParam)) {
+            case LBN_ERRSPACE:
+                wCBN = CBN_ERRSPACE;
+                break;
+            case LBN_SELCHANGE:
+                if ((lp->wStyle & 0xf) == CBS_SIMPLE) 
+                   {
+                   uiKey = (UINT)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0);
+                   if (uiKey != (UINT)LB_ERR)
+                      if (lp->EditControl)
+                         {
+                         CBoxDrawEdit(lp, hWnd, uiKey);
+                         }
+                   }
+                wCBN = CBN_SELCHANGE;
+                break;
+            case LBN_DBLCLK:
+                wCBN = CBN_DBLCLK;
+                break;
+            case LBN_SELCANCEL: /* TODO */
+                wCBN = 0;
+                break;
+            case LBN_SETFOCUS:
+                wCBN = CBN_SETFOCUS;
+                break;
+            case LBN_KILLFOCUS:
+                wCBN = CBN_KILLFOCUS;
+                break;
+            default:
+                wCBN = 0;
+                break;
+            }
+            if (wCBN)
+               return SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,wCBN));
+            else
+            return rc;
+            }
+        break;
+
+    case WM_GETTEXT:
+	if ( lp->EditControl )
+	    return SendMessage(lp->EditControl,uMsg,wParam,lParam);
+	else if ( lp->ListBoxControl ) {
+	    WPARAM sel, len;
+
+	    sel = (WPARAM)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0);
+	    if ( sel != (WPARAM)LB_ERR ) {
+		len = (WPARAM)SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, 0, 0);
+		if ( len <= wParam )
+		    return SendMessage(lp->ListBoxControl, LB_GETTEXT, sel, lParam);
+	    }
+	}
+	return CB_ERR;
+
+    case WM_GETTEXTLENGTH:
+	if ( lp->EditControl )
+	    return SendMessage(lp->EditControl,uMsg,wParam,lParam);
+	else if ( lp->ListBoxControl ) {
+	    WPARAM sel;
+
+	    sel = (WPARAM)SendMessage(lp->ListBoxControl, LB_GETCURSEL, 0, 0);
+	    if ( sel != (WPARAM)LB_ERR ) 
+		return SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, sel, 0);
+	}
+	return CB_ERR;
+
+    case WM_SETTEXT:
+	if ( lp->EditControl )
+	    return SendMessage(lp->EditControl,uMsg,wParam,lParam);
+	return CB_ERR;
+
+#if 0//jmt: fix: no WM_SETFONT/WM_GETFONT
+    case WM_SETFONT:
+        lp->hFont = (HFONT)wParam;
+
+        hDC = GetDC(hWnd);
+        SelectObject(hDC,lp->hFont);
+        GetTextMetrics(hDC,&tm);
+        ReleaseDC(hWnd,hDC);
+        wEditHeight = tm.tmHeight + 3 * tm.tmInternalLeading;
+
+        if (wEditHeight == lp->uHeight)
+            return 0L;
+
+        lp->uHeight = (UINT)wEditHeight;
+        lp->ButtonRect.bottom = wEditHeight;
+        /*
+        **   The following SetWindowPos causes WM_WINDOWPOSCHANGING message
+        **   where child windows are resized and/or moved.
+        */
+        ShowWindow(hWnd, SW_HIDE);
+        GetClientRect(hWnd,&rcClient);
+        if ((lp->wStyle & 0xf) != CBS_SIMPLE) 
+           SetWindowPos(hWnd, 0,
+                        0, 0, rcClient.right, (int)wEditHeight,
+                        SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW);
+        else SetWindowPos(hWnd, 0,
+                          0, 0, rcClient.right, (int)wEditHeight + lp->ListBoxRect.bottom - lp->ListBoxRect.top + 1,
+                          SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW);
+        ShowWindow(hWnd, SW_SHOWNA);
+
+        if (lp->EditControl)
+           SendMessage(lp->EditControl, WM_SETFONT, wParam,lParam);
+        SendMessage(lp->ListBoxControl, WM_SETFONT, wParam,lParam);
+
+        if(LOWORD(lParam))
+            RedrawWindow(hWnd,(const RECT *)0,(HRGN)0,
+            RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW );
+        return (LRESULT)0;
+
+    case WM_GETFONT:
+        return lp->hFont;
+#endif//WM_SETFONT/WM_GETFONT
+
+    case WM_MOVE: /*WM_WINDOWPOSCHANGING:*/
+#if 0
+        lpwp = (LPWINDOWPOS)lParam;
+#else
+	pp.x=LOWORD(lParam);
+	pp.y=HIWORD(lParam);
+#endif
+        if (1)/*(lpwp)*/ {
+        if (1)/*(!(lpwp->flags & SWP_NOSIZE))*/ {
+            lp->ButtonRect.right  = (hWnd->winrect.right-hWnd->winrect.left);//lpwp->cx;
+            if ((lp->wStyle & 0xf) == CBS_SIMPLE) 
+               lp->ButtonRect.left = lp->ButtonRect.right;
+            else lp->ButtonRect.left = (hWnd->winrect.right-hWnd->winrect.left)/*lpwp->cx*/ - 1 -
+                    GetSystemMetrics(SM_CXVSCROLL);
+
+            if (lp->EditControl) 
+               {
+               wEditWidth = lp->ButtonRect.left + 1;
+               if ((lp->wStyle & 0xf) == CBS_SIMPLE)
+                  wEditWidth --;
+               if ((lp->wStyle & 0xf) == CBS_DROPDOWN)
+                  wEditWidth -= 5;
+               SetWindowPos(lp->EditControl,(HWND)0,
+                            0,0,
+                            wEditWidth, lp->uHeight,
+                            SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
+               }
+            if (lp->ListBoxControl) 
+               {
+               if ((lp->wStyle & 0x0F) == CBS_SIMPLE)
+                  {
+                  lp->ListBoxRect.left = 5;
+                  lp->ListBoxRect.top = lp->uHeight - 1;
+                  lp->ListBoxRect.right = (hWnd->winrect.right-hWnd->winrect.left);//lpwp->cx;
+                  lp->ListBoxRect.bottom = (hWnd->winrect.bottom-hWnd->winrect.top)/*lpwp->cy*/ - 2;
+                  }
+               else {
+                    POINT cp;
+		    cp.x = 0;
+		    cp.y = lp->uHeight - 1;
+                    ClientToScreen(hWnd, &cp);
+                    OffsetRect(&lp->ListBoxRect, cp.x - lp->ListBoxRect.left, cp.y - lp->ListBoxRect.top);
+
+                    lp->ListBoxRect.right = lp->ListBoxRect.left + (hWnd->winrect.right-hWnd->winrect.left)/*lpwp->cx*/;
+                    if ((lp->wStyle & 0xf) != CBS_DROPDOWNLIST)
+                       lp->ListBoxRect.right -= 5;
+                    }
+               SetWindowPos(lp->ListBoxControl,(HWND)0,
+                            lp->ListBoxRect.left, lp->ListBoxRect.top, 
+                            lp->ListBoxRect.right - lp->ListBoxRect.left,
+                            lp->ListBoxRect.bottom - lp->ListBoxRect.top,
+                            SWP_NOACTIVATE|SWP_NOZORDER);
+               }
+#if 0//jmt: fix: no WM_WINDOWPOSCHANGING
+            /* the height of the normal state stays the same */
+            if ((lp->wStyle & 0xf) != CBS_SIMPLE)
+               lpwp->cy = (int)lp->uHeight;
+#endif
+            }
+        }
+        return (LRESULT)0;
+
+    case WM_WINDOWPOSCHANGED:
+        DefWindowProc(hWnd,uMsg,wParam,lParam);
+        lpwp = (LPWINDOWPOS)lParam;
+        if (lpwp) {
+       		if (!(lpwp->flags & SWP_NOSIZE)) /* TODO */
+#if 0
+            		RedrawWindow(hWnd,(const RECT *)0,(HRGN)0,
+            			RDW_INVALIDATE|RDW_ERASE);
+#else
+			InvalidateRect(hWnd,NULL,TRUE);
+#endif
+        }
+        return (LRESULT)0;
+
+#if 0//jmt: fix: no ownerdraw
+    /*********************************************/
+    /* ownerdraw stuff               */
+    /*********************************************/
+    case WM_DRAWITEM:
+        lpdis = (LPDRAWITEMSTRUCT)lParam;
+        lpdis->CtlType = ODT_COMBOBOX;
+        lpdis->CtlID = lp->nID;
+        lpdis->hwndItem = hWnd;
+        return SendMessage(lp->hWndParent,WM_DRAWITEM,
+                (WPARAM)lp->nID,lParam);
+
+    case WM_MEASUREITEM:
+        lpmis = (LPMEASUREITEMSTRUCT)lParam;
+        lpmis->CtlType = ODT_COMBOBOX;
+        lpmis->CtlID = lp->nID;
+        return SendMessage(lp->hWndParent,WM_MEASUREITEM,
+                (WPARAM)lp->nID,lParam);
+
+    case WM_DELETEITEM:
+        lpdlis = (LPDELETEITEMSTRUCT)lParam;
+        lpdlis->CtlType = ODT_COMBOBOX;
+        lpdlis->CtlID = lp->nID;
+        lpdlis->hwndItem = hWnd;
+        return SendMessage(lp->hWndParent,WM_DELETEITEM,
+                (WPARAM)lp->nID,lParam);
+
+    case WM_CONVERT:
+        if (!lpComboBinToNat) {
+        	hComboClass32 = FindClass("COMBOBOX",0);
+        	lpComboBinToNat = (WNDPROC)GetClassHandleLong(
+                	hComboClass32,GCL_BINTONAT);
+        }
+        if (lpComboBinToNat)
+        return lpComboBinToNat(hWnd, uMsg, wParam, lParam);
+        else
+        return (LRESULT)0;
+#endif//ownerdraw
+
+    default:
+        return DefCBProc( hWnd, uMsg, wParam, lParam);
+    }
+    return rc;
+}
+
+/************************************************************************
+**
+************************************************************************/
+static LRESULT DefCBProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    int       len,index;
+    COMBOBOX *lp;
+    char     *selection;
+    int   rc;
+    POINT   cp;
+
+    lp = (COMBOBOX *) hWnd->userdata/*GetWindowLong(hWnd,CWD_LPCBDATA)*/;
+    switch(uMsg) {
+        /*********************************************/
+        /* messages specific to the list box control */
+        /*********************************************/
+        case CB_ADDSTRING:
+            lp->nListItems++;  /* shd. test for successful return */
+            return SendMessage(lp->ListBoxControl,LB_ADDSTRING,
+                wParam,lParam);
+            
+        case CB_DELETESTRING:
+	    if (lp->nListItems)
+	      lp->nListItems--;
+            return SendMessage(lp->ListBoxControl,LB_DELETESTRING,
+                wParam,lParam);
+            
+        case CB_DIR:
+            return SendMessage(lp->ListBoxControl,LB_DIR,
+                wParam,lParam);
+            
+        case CB_FINDSTRING:
+            return SendMessage(lp->ListBoxControl,LB_FINDSTRING,
+                wParam,lParam);
+            
+        case CB_FINDSTRINGEXACT:
+               return SendMessage(lp->ListBoxControl,LB_FINDSTRINGEXACT,
+                wParam,lParam);
+            
+        case CB_GETCOUNT:
+            return SendMessage(lp->ListBoxControl,LB_GETCOUNT,
+                wParam,lParam);
+            
+        case CB_GETCURSEL:
+            return SendMessage(lp->ListBoxControl,LB_GETCURSEL,
+                wParam,lParam);
+            
+        case CB_GETITEMDATA:
+            return SendMessage(lp->ListBoxControl,LB_GETITEMDATA,
+                wParam,lParam);
+            
+        case CB_GETITEMHEIGHT:
+            return SendMessage(lp->ListBoxControl,LB_GETITEMHEIGHT,
+                wParam,lParam);
+            
+        case CB_GETLBTEXT:
+            return SendMessage(lp->ListBoxControl,LB_GETTEXT,
+                wParam,lParam);
+            
+        case CB_GETLBTEXTLEN:
+            return SendMessage(lp->ListBoxControl,LB_GETTEXTLEN,
+                wParam,lParam);
+            
+        case CB_INSERTSTRING:
+            return SendMessage(lp->ListBoxControl,LB_INSERTSTRING,
+                wParam,lParam);
+            
+        case CB_SETITEMDATA:
+            return SendMessage(lp->ListBoxControl,LB_SETITEMDATA,
+                wParam,lParam);
+            
+        /*********************************************/
+        /* messages specific to the edit control */
+        /*********************************************/
+        case CB_GETEDITSEL:
+            return SendMessage(lp->EditControl,EM_GETSEL,0,0);
+                
+        case CB_LIMITTEXT:
+            return SendMessage(lp->EditControl,EM_LIMITTEXT,
+                wParam,lParam);
+
+        case CB_SETEDITSEL:
+            return SendMessage(lp->EditControl,EM_SETSEL,
+                wParam,lParam);
+
+        /*********************************************/
+        /* messages handled by the combobox          */
+        /*********************************************/
+        case CB_GETDROPPEDCONTROLRECT:
+            CopyRect((LPRECT)lParam,&lp->ListBoxRect);
+            break;
+        case CB_GETDROPPEDSTATE:
+            return IS_SET(lp,CSF_CAPTUREACTIVE);
+
+        case CB_GETEXTENDEDUI:
+            return (LRESULT)lp->bExtended;
+
+        case CB_RESETCONTENT:
+            SendMessage(lp->ListBoxControl,LB_RESETCONTENT,0,0);
+            if (lp->EditControl)
+               SendMessage(lp->EditControl,WM_SETTEXT,0,(LPARAM)(LPSTR)"");
+            break;
+
+        case CB_SELECTSTRING:
+            index = (int)SendMessage(lp->ListBoxControl, LB_SELECTSTRING, wParam, lParam);
+            if (index == LB_ERR)
+               return CB_ERR;
+
+            len = (int)SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, index, 0);
+            if (len <= 0)
+               return CB_ERR;
+
+            selection = (LPSTR)WinMalloc((UINT)len+1);  
+            rc = (int)SendMessage(lp->ListBoxControl, LB_GETTEXT, (WPARAM)index, (LPARAM)selection);
+            if (lp->EditControl)
+               rc = (int)SendMessage(lp->EditControl, WM_SETTEXT, 0, (LPARAM)selection);
+            else CBoxDrawStatic(lp, hWnd, index);
+            WinFree(selection);
+            break;
+            
+        case CB_SETCURSEL:
+            rc = (int)SendMessage(lp->ListBoxControl, LB_SETCURSEL, wParam, lParam);
+            if (rc == LB_ERR)
+               return CB_ERR;
+            len = (int)SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, wParam, 0);
+            if (len <= 0)
+               return CB_ERR;
+
+            selection = (LPSTR)WinMalloc((UINT)len+1);  
+            rc = (int)SendMessage(lp->ListBoxControl, LB_GETTEXT, wParam, (LPARAM)selection);
+            if (lp->EditControl)
+               rc = (int)SendMessage(lp->EditControl, WM_SETTEXT, 0, (LPARAM)selection);
+            else CBoxDrawStatic(lp, hWnd, wParam);
+            WinFree(selection);
+            return (LRESULT)wParam;
+
+        case CB_SETEXTENDEDUI:
+            lp->bExtended = (BOOL)wParam;
+            break;  
+
+        case CB_SETITEMHEIGHT:      /* TODO */
+            break;
+
+        case CB_SHOWDROPDOWN:
+            if ((lp->wStyle & 0xf) == CBS_SIMPLE)
+                return 1L;
+            if (wParam) 
+               {
+               if (IS_SET(lp,CSF_CAPTUREACTIVE))
+                  return 1L;
+               cp.x = ((lp->wStyle & 0xf) != CBS_DROPDOWNLIST) ? 5 : 0;
+               cp.y = lp->uHeight -1;
+               ClientToScreen(hWnd, &cp);
+               OffsetRect(&lp->ListBoxRect, cp.x - lp->ListBoxRect.left, cp.y - lp->ListBoxRect.top);
+               SetWindowPos(lp->ListBoxControl, 0,
+                            cp.x, cp.y, 0, 0,
+                            SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
+               SendMessage(lp->hWndParent,WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_DROPDOWN));
+               SetWindowPos(lp->ListBoxControl, HWND_TOP,
+                            0, 0, 0, 0,
+                            SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
+                CBoxCapture(hWnd, 1);
+                SET_STATE(lp,CSF_CAPTUREACTIVE);
+                }
+            else {
+                 if (!IS_SET(lp,CSF_CAPTUREACTIVE))
+                    return 1L;
+                 SendMessage(lp->hWndParent, WM_COMMAND, GET_WM_COMMAND_MPS(lp->nID,hWnd,CBN_CLOSEUP));
+                 SetWindowPos(lp->ListBoxControl, 0,
+                              0, 0, 0, 0,
+                              SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_HIDEWINDOW);
+                 CBoxCapture(hWnd, 0);
+                 CLEAR_STATE(lp, CSF_CAPTUREACTIVE);
+                 }
+            return 1L;
+
+        /*********************************************/
+        /* messages handled by the defwindowproc.... */
+        /*********************************************/
+        default:
+            return DefWindowProc( hWnd, uMsg, wParam, lParam);
+    }
+    return CB_OKAY;
+}
+
+
+static void
+CBoxDrawButton(HWND hWnd,UINT wState,COMBOBOX *lp)
+{
+    HDC       hDC;
+    int     x,y;
+    int     dx,dy;
+#if 0//jmt: fix: no LoadBitmap()
+    //-int     cx,cy;
+    //-static int nWidth,nHeight;
+    //-BITMAP    bmpCombo;
+    //-static HBITMAP hbmpCombo = 0; 
+    //-HBITMAP   hbmpOld = 0;
+    //-HDC       hdcSrc;
+    //-COLORREF  rgbText, rgbBk;
+#endif
+    HBRUSH    hBrush;
+    HPEN      hPenHigh,hPenShadow;
+    RECT      rc;
+
+    hDC = GetDC(hWnd);
+
+    CopyRect(&rc,&lp->ButtonRect);
+    x = rc.left;
+    y = rc.top;
+    dx = rc.right;
+    dy = rc.bottom;
+
+    hPenHigh = GetStockObject(WHITE_PEN);
+#if 0
+    //-hPenShadow = GetSysColorPen(COLOR_BTNSHADOW);
+#else
+    hPenShadow = CreatePen(PS_SOLID,1,GetSysColor(COLOR_BTNSHADOW));
+#endif
+#if 0
+    //-hBrush = GetSysColorBrush(COLOR_BTNFACE);
+#else
+    hBrush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
+#endif
+    FillRect(hDC, &rc, hBrush);
+#if 0
+    hBrush = GetStockObject(BLACK_BRUSH);
+    FillRect/*FrameRect*/(hDC, &lp->ButtonRect, hBrush);//?
+#else
+    SelectObject(hDC,GetStockObject(BLACK_PEN));
+    Rectangle(hDC,lp->ButtonRect.left,lp->ButtonRect.top,lp->ButtonRect.right,lp->ButtonRect.bottom);
+#endif
+    rc.left += 1; rc.right -= 1;
+    rc.top += 1; rc.bottom -= 1;
+
+    Draw3DButtonRect(hDC,hPenHigh,hPenShadow,rc,wState);
+
+#if 0//jmt: fix: no LoadBitmap(),GetObject()
+    if (hbmpCombo == 0) 
+       {
+       hbmpCombo = LoadBitmap(0,(LPSTR)OBM_COMBO);
+       GetObject(hbmpCombo, sizeof(BITMAP), (LPVOID)&bmpCombo);
+       nWidth  = bmpCombo.bmWidth;
+       nHeight = bmpCombo.bmHeight;
+       }
+   /*
+   **   MiD 08/15/95 changed to mono bitmap as it is in Windows. Convert
+   **                it to colors on the fly
+   */
+   hdcSrc = CreateCompatibleDC(hDC);
+   hbmpOld = SelectObject(hdcSrc, hbmpCombo);
+   /*
+   **   Source hdc ok. Prepare the target hdc, then BitBlt to it.
+   */
+   rgbText = SetTextColor(hDC,GetSysColor(COLOR_BTNTEXT));
+   rgbBk = SetBkColor(hDC,GetSysColor(COLOR_BTNFACE));
+
+   cx = (dx - x - nWidth)/2;
+   cy = (dy - y - nHeight)/2;
+   if (wState) 
+      {  cx++; cy++;  }
+   BitBlt(hDC, x+cx, y+cy, nWidth, nHeight, hdcSrc, 0, 0, SRCCOPY);
+
+   SetTextColor(hDC, rgbText);
+   SetBkColor(hDC, rgbBk);
+   SelectObject(hdcSrc,hbmpOld);
+   DeleteDC(hdcSrc);
+#endif//BitBlt Bitmap
+#if 1
+   DeleteObject(hBrush);
+   DeleteObject(hPenShadow);
+#endif
+   ReleaseDC(hWnd,hDC);
+
+    if (wState)
+        SET_STATE(lp,CSF_LOCALBUTTONDOWN);
+    else
+        CLEAR_STATE(lp,CSF_LOCALBUTTONDOWN);
+}
+
+#if 0//jmt: fix: no COMBOLBOX
+/************************************************************************
+**
+************************************************************************/
+LRESULT DefCOMBOLBOXProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    //-return DefLISTBOXProc(hWnd, msg, wParam,lParam);
+    return ListboxCtrlProc(hWnd, msg, wParam,lParam);
+}
+#endif
+
+/************************************************************************
+**
+************************************************************************/
+static void CBoxSendMouseToLBox(COMBOBOX *lp, UINT uiMsg, WPARAM wParam, POINT ptScreen)
+{
+    POINT pt;
+    int nNCHit;
+#if 0//jmt: fix: no scrollbar
+    //-HWND hWndScroll;
+#endif
+    pt = ptScreen;
+    ScreenToClient(lp->ListBoxControl,&pt);
+
+    nNCHit = LOSHORT(SendMessage(lp->ListBoxControl, WM_NCHITTEST, 0, MAKELPARAM(ptScreen.x,ptScreen.y)));
+
+    switch (nNCHit) 
+       {
+       case HTCLIENT:
+           if (uiMsg == WM_MOUSEMOVE && !IS_SET(lp,CSF_LBOXBUTTONDOWN)) 
+              {
+              SendMessage(lp->ListBoxControl, WM_LBUTTONDOWN, 0, MAKELONG((WORD)pt.x,(WORD)pt.y));
+
+              SET_STATE(lp, CSF_BUTTONDOWN | CSF_LBOXBUTTONDOWN);
+              }
+           SendMessage(lp->ListBoxControl, uiMsg, wParam, MAKELONG((WORD)pt.x,(WORD)pt.y));
+           break;
+
+#if 0//jmt: fix: no scrollbar           
+       case HTVSCROLL:
+           if (0 != (hWndScroll = TWIN_ConvertToSysScroll(lp->ListBoxControl, TRUE /* vertical */, &pt)))
+              SendMessage(hWndScroll, uiMsg, wParam, MAKELONG((WORD)pt.x,(WORD)pt.y));
+           break;
+#endif           
+       default:
+           break;
+    }
+}
+
+/************************************************************************
+**
+************************************************************************/
+static void CBoxCapture(HWND hWnd, WORD wFunc)
+{
+    static HWND hWndCapture = (HWND)0;
+
+    if (wFunc) 
+       {
+       hWndCapture = SetCapture(hWnd);
+       SetFocus(hWnd);
+       }
+    else {
+         if (!hWndCapture)
+            ReleaseCapture();
+         else {
+#ifdef  LATER
+              SetCapture(hWndCapture);
+#else
+              ReleaseCapture();
+#endif
+              hWndCapture = (HWND)0;
+              }
+         }
+}
+
+/************************************************************************
+**
+************************************************************************/
+static void CBoxDrawEdit(COMBOBOX *lp, HWND hWnd, UINT uiKey)
+{
+    int    nLen;
+    LPVOID lpData;
+#if 0//jmt: fix: no ownerdraw
+    //HRGN   hRgn;
+    //-DRAWITEMSTRUCT dis;
+#endif
+/*
+    if (uiKey == (UINT)LB_ERR)
+       return;
+
+    if (!BOWNERDRAW(lp)) 
+*/
+    if (lp->wStyle & CBS_HASSTRINGS)
+       {
+       if (uiKey == (UINT)LB_ERR)
+	  return;
+       nLen = (int)SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, uiKey, 0L);
+       if (nLen <= 0)
+           return;
+       lpData = (LPVOID)WinMalloc(nLen+1);
+       SendMessage(lp->ListBoxControl, LB_GETTEXT, uiKey, (LPARAM)lpData);
+       SendMessage(lp->EditControl, WM_SETTEXT, strlen(lpData), (LPARAM)lpData);
+       Edit_SetSel(lp->EditControl, 0, -1);
+       WinFree((LPSTR)lpData);
+       }
+#if 0//jmt: fix: no ownerdraw
+    else {
+         dis.CtlType = ODT_COMBOBOX;
+         dis.CtlID = (UINT)lp->nID;
+         dis.itemID = -1; /* used to be uiKey */
+         dis.itemAction = ODA_DRAWENTIRE;
+         dis.itemState = ODS_FOCUS;
+         dis.hwndItem = hWnd;
+         dis.itemData = 0;
+         GetClientRect(lp->EditControl,&dis.rcItem);
+         dis.rcItem.left += 3;
+         dis.rcItem.right -= 3;
+         dis.rcItem.top += 2;
+         dis.rcItem.bottom -= 2;
+
+         dis.hDC = GetDC(lp->EditControl);
+         hRgn = CreateRectRgnIndirect(&dis.rcItem);
+         SelectClipRgn(dis.hDC,hRgn);
+         SelectObject(dis.hDC, lp->hFont);
+         SendMessage(lp->hWndParent, WM_DRAWITEM, (WPARAM)(UINT)lp->nID, (LPARAM)&dis);
+         ReleaseDC(lp->EditControl,dis.hDC);
+         DeleteObject(hRgn);
+         }   
+#endif//ownerdraw
+}
+
+/************************************************************************
+**
+************************************************************************/
+static void CBoxDrawStatic(COMBOBOX *lp, HWND hWnd, UINT uiKey)
+{   
+    int    nLen;
+    HDC    hdc;
+    LPVOID lpData;
+    RECT   rcClient;
+    HFONT  hfonOld = 0;
+#if 0//jmt: fix: no ownerdraw
+    //HRGN   hRgn;
+    //-DRAWITEMSTRUCT dis;
+#endif
+    HBRUSH hbrStatic, hbrOld;               
+    
+    /*   Draw rectangle regardless of ownerdraw style...
+    */           
+    hdc = GetDC(hWnd);         
+    rcClient.left   = 0;
+    rcClient.top    = 0;
+    rcClient.right  = lp->ButtonRect.left+1;
+    rcClient.bottom = lp->uHeight;
+    hbrStatic = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
+    hbrOld = SelectObject(hdc, hbrStatic);
+    SelectObject(hdc, GetStockObject(BLACK_PEN));/* ??? COLOR_WINDOWFRAME */
+    Rectangle(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
+    SelectObject(hdc, hbrOld);
+    DeleteObject(hbrStatic);
+    ReleaseDC(hWnd, hdc);
+
+    if (uiKey == (UINT)LB_ERR)
+       return;
+
+//jmt: no ownerdraw
+    if (1)//(!BOWNERDRAW(lp))
+       {
+       /* if necessary, draw text */
+       hdc = GetDC(hWnd);
+       nLen = (int)SendMessage(lp->ListBoxControl, LB_GETTEXTLEN, (WPARAM)uiKey, 0L);
+       if (nLen > 0)
+          {
+          lpData = (LPVOID)WinMalloc(nLen+1);
+          SendMessage(lp->ListBoxControl, LB_GETTEXT, uiKey, (LPARAM)lpData);
+          SetBkMode(hdc, TRANSPARENT);
+          if (!IS_SET(lp, CSF_FOCUS))
+             {
+             SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT));
+             rcClient.left += 2;
+             }
+          else {
+               InflateRect(&rcClient, -2, -2);
+               hbrStatic = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT));
+               hbrOld = SelectObject(hdc, hbrStatic);
+               FillRect(hdc, &rcClient, hbrStatic);
+#if 0//jmt: fix: no DrawFocusRect()
+               //?DrawFocusRect(hdc, &rcClient);
+#endif
+               SelectObject(hdc, hbrOld);
+               DeleteObject(hbrStatic);
+               SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
+               }
+          if (lp->hFont)
+             hfonOld = SelectObject(hdc, lp->hFont);
+          DrawText(hdc, (LPSTR)lpData, nLen, &rcClient, DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
+          if (lp->hFont)
+             SelectObject(hdc, hfonOld);
+          WinFree((LPVOID)lpData);
+          }
+       ReleaseDC(hWnd, hdc);
+       }
+#if 0//jmt: fix: no ownerdraw
+    else { /* fill OWNERDRAWSTRUCT and send WM_DRAWITEM message */
+         dis.CtlType    = ODT_COMBOBOX;
+         dis.CtlID      = (UINT)lp->nID;
+         dis.itemID     = uiKey;
+         dis.itemAction = ODA_DRAWENTIRE;
+         dis.itemState  = ODS_FOCUS;
+         dis.hwndItem   = hWnd;
+         dis.itemData   = SendMessage(lp->ListBoxControl, LB_GETITEMDATA, uiKey, 0L);
+         GetClientRect(hWnd, &dis.rcItem);
+         dis.rcItem.left += 3; 
+         dis.rcItem.right = lp->ButtonRect.left - 2;  /* do not touch button */
+         dis.rcItem.top += 2; 
+         dis.rcItem.bottom -= 2; 
+
+         dis.hDC = GetDC(hWnd);
+         hRgn = CreateRectRgnIndirect(&dis.rcItem);
+         SelectClipRgn(dis.hDC, hRgn);
+         SelectObject(dis.hDC, lp->hFont);
+         SendMessage(lp->hWndParent, WM_DRAWITEM, (WPARAM)(UINT)lp->nID, (LPARAM)&dis);
+         ReleaseDC(hWnd, dis.hDC);
+         DeleteObject(hRgn);
+         }  
+#endif//ownerdraw
+ 
+}
+
+
+/*------------------------- < Full Revision History > ----------------------
+** $Log: ComboBox.c,v $
+** Revision 1.7  2000/06/28 jmt
+** porting to microwin
+**
+** Revision 1.6  2000/01/21 02:48:47  robf
+** remove dead code
+**
+** Revision 1.5  1999/11/29 05:07:54  robf
+** removed extraneous call CreateCompatibleDC
+**
+** Revision 1.4  1999/07/08 18:52:50  mwalsh
+** Updated Comments
+**
+**-------------------------------------------------------------------------*/
+
diff -urN lib/microwindows/src/mwin/winlib/draw3d.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/draw3d.c
--- lib/microwindows/src/mwin/winlib/draw3d.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/draw3d.c	2005-02-21 16:03:39.000000000 +0100
@@ -0,0 +1,144 @@
+#include "windows.h"
+#include "wintools.h"
+/*
+ * WIN Draw Library
+ *	Draw3dShadow - draws a shadow with bottom-left and top-right missing
+ *	Draw3dBox - draws a complete shadow
+ *	Draw3dInset - draw a 2 line 3d inset
+ *	Draw3dOutset - draw a 2 line 3d outset
+ */
+
+/*
+ * Draw3dShadow
+ * 	NOINDENT_BLACK	T=white, B=black
+ * 	NOINDENT_GRAY	T=white, B=dkgray
+ * 	INDENT_BLACK	T=black, B=white
+ * 	INDENT_GRAY		T=dkgray, B=white
+ *
+ *	TTTTTTTTTTTTTT
+ *	T             B
+ *	T             B
+ *	 BBBBBBBBBBBBBB
+ */
+void WINAPI
+Draw3dShadow(HDC hDC,int x,int y,int w,int h,COLORREF crTop,COLORREF crBottom)
+{
+	HPEN	hPenTop, hPenBottom, holdPen;
+
+	hPenTop = CreatePen( PS_SOLID, 1, crTop);
+	hPenBottom = CreatePen( PS_SOLID, 1, crBottom);
+	holdPen = SelectObject( hDC, hPenTop);
+	MoveToEx( hDC, x, y+h-2, NULL);
+	LineTo( hDC, x, y);				/* left side*/
+	LineTo( hDC, x+w-1, y);				/* top side*/
+
+	SelectObject( hDC, hPenBottom);
+	MoveToEx( hDC, x+w-1, y+1, NULL);
+	LineTo( hDC, x+w-1, y+h-1);			/* right side*/
+	LineTo( hDC, x, y+h-1);				/* bottom side*/
+
+	SelectObject( hDC, holdPen);
+	DeleteObject( hPenTop);
+	DeleteObject( hPenBottom);
+}
+
+/*
+ * Draw3dBox
+ *
+ *	TTTTTTTTTTTTTTB
+ *	T             B
+ *	T             B
+ *	BBBBBBBBBBBBBBB
+ */
+void WINAPI
+Draw3dBox(HDC hDC,int x,int y,int w,int h,COLORREF crTop,COLORREF crBottom)
+{
+	HPEN		hPenTop, hPenBottom, holdPen;
+
+	hPenTop = CreatePen( PS_SOLID, 1, crTop);
+	hPenBottom = CreatePen( PS_SOLID, 1, crBottom);
+	holdPen = SelectObject( hDC, hPenTop);
+	MoveToEx( hDC, x, y+h-2, NULL);
+	LineTo( hDC, x, y);				/* left side*/
+	MoveToEx( hDC, x, y, NULL);
+	LineTo( hDC, x+w-1, y);				/* top side*/
+
+	SelectObject( hDC, hPenBottom);
+	MoveToEx( hDC, x+w-1, y, NULL);
+	LineTo( hDC, x+w-1, y+h-1);			/* right side*/
+	LineTo( hDC, x-1, y+h-1);			/* bottom side*/
+
+	SelectObject( hDC, holdPen);
+	DeleteObject( hPenTop);
+	DeleteObject( hPenBottom);
+}
+
+/*
+ * Draw 2 line deep 3d inset
+ */
+void WINAPI
+Draw3dInset(HDC hDC,int x,int y,int w,int h)
+{
+	Draw3dBox(hDC, x, y, w, h,
+		GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNHIGHLIGHT));
+	++x; ++y; w -= 2; h -= 2;
+	Draw3dBox(hDC, x, y, w, h,
+		GetSysColor(COLOR_WINDOWFRAME), GetSysColor(COLOR_3DLIGHT));
+}
+
+/*
+ * Draw 2 line deep 3d outset
+ */
+void WINAPI
+Draw3dOutset(HDC hDC,int x,int y,int w,int h)
+{
+	Draw3dBox(hDC, x, y, w, h,
+		GetSysColor(COLOR_3DLIGHT), GetSysColor(COLOR_WINDOWFRAME));
+	++x; ++y; w -= 2; h -= 2;
+	Draw3dBox(hDC, x, y, w, h,
+		GetSysColor(COLOR_BTNHIGHLIGHT), GetSysColor(COLOR_BTNSHADOW));
+}
+
+/*
+ * Draw 1 line pushed down rectangle
+ */
+void WINAPI
+Draw3dPushDown(HDC hDC, int x, int y, int w, int h)
+{
+	Draw3dBox(hDC, x, y, w, h, GetSysColor(COLOR_BTNSHADOW),
+		GetSysColor(COLOR_BTNSHADOW));
+}
+
+/*
+ * Draw either 3d up or down depending on state
+ */
+void WINAPI
+Draw3dUpDownState(HDC hDC, int x, int y, int w, int h, BOOL fDown)
+{
+	if (fDown)
+		Draw3dPushDown(hDC, x, y, w, h);
+	else Draw3dOutset(hDC, x, y, w, h);
+}
+
+void WINAPI
+Draw3dUpFrame(HDC hDC, int l, int t, int r, int b)
+{
+	RECT	rc;
+	HBRUSH	hbr;
+
+	SetRect(&rc, l, t, r, b);
+	Draw3dBox(hDC, rc.left, rc.top,
+		rc.right-rc.left, rc.bottom-rc.top,
+		GetSysColor(COLOR_3DLIGHT),
+		GetSysColor(COLOR_WINDOWFRAME));
+	InflateRect(&rc, -1, -1);
+	Draw3dBox(hDC, rc.left, rc.top,
+		rc.right-rc.left, rc.bottom-rc.top,
+		GetSysColor(COLOR_BTNHIGHLIGHT),
+		GetSysColor(COLOR_BTNSHADOW));
+	InflateRect(&rc, -1, -1);
+
+	hbr = CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
+	FillRect(hDC, &rc, hbr);
+	DeleteObject(hbr);
+}
diff -urN lib/microwindows/src/mwin/winlib/edit.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/edit.c
--- lib/microwindows/src/mwin/winlib/edit.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/edit.c	2005-02-21 16:13:25.000000000 +0100
@@ -0,0 +1,1166 @@
+/*
+ * Copyright (C) 1999, 2000, Wei Yongming.
+ * Portions Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Edit control for Microwindows win32 api.
+ */
+
+/*
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Library General Public
+**  License as published by the Free Software Foundation; either
+**  version 2 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Library General Public License for more details.
+**
+**  You should have received a copy of the GNU Library General Public
+**  License along with this library; if not, write to the Free
+**  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+**  MA 02111-1307, USA
+*/
+
+/*
+**  Alternatively, the contents of this file may be used under the terms 
+**  of the Mozilla Public License (the "MPL License") in which case the
+**  provisions of the MPL License are applicable instead of those above.
+*/
+
+// Note:
+//  Although there was a version by Zhao Jianghua, this version of
+//  EDIT control is written by Wei Yongming from scratch.
+//
+// Create date: 1999/8/26
+//
+// Modify records:
+//
+//  Who             When        Where       For What                Status
+//-----------------------------------------------------------------------------
+//  WEI Yongming    2000/02/24  Tsinghua    Add MPL License         Finished
+//  Kevin Tseng     2000/05/30  gv          port to microwin        ported
+//  Greg Haerr      2000/06/16  Utah        3d look, bug fixes      Finished
+//  Kevin Tseng     2000/06/22  gv          port to mw-nanox        ported
+//
+// TODO:
+//    * Selection.
+//    * Undo.
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define MWINCLUDECOLORS
+#include "windows.h"	/* windef.h, winuser.h */
+#include "wintools.h"
+#include "device.h" 	/* GdGetTextSize */
+
+#define USE_BIG5
+
+//#define DEFAULT_FONT	DEFAULT_GUI_FONT
+#define DEFAULT_FONT	SYSTEM_FIXED_FONT
+
+#define WIDTH_EDIT_BORDER       2
+#define MARGIN_EDIT_LEFT        1
+#define MARGIN_EDIT_TOP         1
+#define MARGIN_EDIT_RIGHT       2
+#define MARGIN_EDIT_BOTTOM      1
+
+#define LEN_SLEDIT_BUFFER       3000
+#define LEN_SLEDIT_UNDOBUFFER   1024
+
+#define EST_FOCUSED     0x00000001L
+#define EST_MODIFY      0x00000002L
+#define EST_READONLY    0x00000004L
+#define EST_REPLACE     0x00000008L
+
+#define EDIT_OP_NONE    0x00
+#define EDIT_OP_DELETE  0x01
+#define EDIT_OP_INSERT  0x02
+#define EDIT_OP_REPLACE 0x03
+
+typedef struct tagSLEDITDATA {
+    HFONT   hFont;          // hFont used
+    int     bufferLen;      // length of buffer
+
+    int     dataEnd;        // data end position
+    int     editPos;        // current edit position
+    int     caretOff;       // caret offset in box
+    int     startPos;       // start display position
+    
+    int     selStart;       // selection start position
+    int     selEnd;         // selection end position
+    
+    int     passwdChar;     // password character
+    
+    int     leftMargin;     // left margin
+    int     topMargin;      // top margin
+    int     rightMargin;    // right margin
+    int     bottomMargin;   // bottom margin
+    
+    int     hardLimit;      // hard limit
+
+    int     lastOp;         // last operation
+    int     lastPos;        // last operation position
+    int     affectedLen;    // affected len of last operation
+    int     undoBufferLen;  // undo buffer len
+    char    undoBuffer [LEN_SLEDIT_UNDOBUFFER];	// Undo buffer;
+    char    buffer [LEN_SLEDIT_BUFFER];		// buffer
+} SLEDITDATA, *PSLEDITDATA;
+
+static LRESULT CALLBACK
+SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+static int GetSysCharHeight (HWND hwnd) 
+{
+#ifndef USE_BIG5	    
+	HDC 		hdc;
+    	int xw, xh, xb;
+
+    	hdc = GetDC(hwnd);
+	SelectObject(hdc, GetStockObject(DEFAULT_FONT));
+	GdSetFont(hdc->font->pfont);
+    	GdGetTextSize(hdc->font->pfont,"X",1, &xw,&xh,&xb,MWTF_ASCII);
+    	ReleaseDC(hwnd,hdc);
+
+	return xh;
+#else
+	return 12;
+#endif
+}
+
+static int GetSysCharWidth (HWND hwnd) 
+{
+#ifndef USE_BIG5	    
+	HDC 		hdc;
+    	int xw, xh, xb;
+
+    	hdc = GetDC(hwnd);
+	SelectObject(hdc, GetStockObject(DEFAULT_FONT));
+	GdSetFont(hdc->font->pfont);
+    	GdGetTextSize(hdc->font->pfont,"X",1, &xw,&xh,&xb,MWTF_ASCII);
+    	ReleaseDC(hwnd,hdc);
+
+	return xw;
+#else
+	return 6;
+#endif
+}
+
+static int GetSysCCharWidth (HWND hwnd)
+{
+	return (2*GetSysCharWidth(hwnd));
+}
+
+int WINAPI MwRegisterEditControl(HINSTANCE hInstance)
+{
+	WNDCLASS	wc;
+
+	wc.style	= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
+	wc.lpfnWndProc	= (WNDPROC)SLEditCtrlProc;
+	wc.cbClsExtra	= 0;
+	wc.cbWndExtra	= 0;
+	wc.hInstance	= hInstance;
+	wc.hIcon	= NULL;
+	wc.hCursor	= 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground= GetStockObject(WHITE_BRUSH);
+	wc.lpszMenuName	= NULL;
+	wc.lpszClassName= "EDIT";
+
+	return RegisterClass(&wc);
+}
+
+static int edtGetOutWidth (const HWND pCtrl)
+{
+    return pCtrl->clirect.right - pCtrl->clirect.left 
+            - ((PSLEDITDATA)(pCtrl->userdata2))->leftMargin
+            - ((PSLEDITDATA)(pCtrl->userdata2))->rightMargin;
+}
+
+static int edtGetStartDispPosAtEnd (const HWND pCtrl, PSLEDITDATA pSLEditData)
+{
+    int         nOutWidth = edtGetOutWidth (pCtrl);
+    int         endPos  = pSLEditData->dataEnd;
+    int         newStartPos = pSLEditData->startPos;
+    const char* buffer = pSLEditData->buffer;
+
+    while (TRUE) {
+        if ((endPos - newStartPos) * GetSysCharWidth (pCtrl) < nOutWidth)//+
+            break;
+        
+	/* FIXME: #ifdef GB2312?*/
+        if ((BYTE)buffer [newStartPos] > 0xA0)//1st:gb:a1-f7,big5:a1-f9 
+	{//+
+            newStartPos ++;
+            if (newStartPos < pSLEditData->dataEnd) 
+	    {
+#ifndef USE_BIG5
+                if ((BYTE)buffer [newStartPos] > 0xA0)
+#else//2nd:gb:a1-fe,big5:40-7e,a1-fe
+                if ( ((BYTE)buffer [newStartPos] >= 0x40 && (BYTE)buffer[newStartPos] <= 0x7e) ||
+                     ((BYTE)buffer [newStartPos] >= 0xa1 && (BYTE)buffer[newStartPos] <= 0xfe)) 
+#endif
+                    newStartPos ++;
+            }
+        }
+        else
+            newStartPos ++;
+    }
+
+    return newStartPos;
+}
+
+static int edtGetDispLen (const HWND pCtrl)
+{
+    int i, n = 0;
+    int nOutWidth = edtGetOutWidth (pCtrl);
+    int nTextWidth = 0;
+    PSLEDITDATA pSLEditData = (PSLEDITDATA)(pCtrl->userdata2);
+    const char* buffer = pSLEditData->buffer;
+
+    for (i = pSLEditData->startPos; i < pSLEditData->dataEnd; i++) {
+	/* FIXME #ifdef GB2312?*/
+        if ((BYTE)buffer [i] > 0xA0)//1st:gb:a1-f7,big5:a1-f9 
+	{//+
+            i++;
+            if (i < pSLEditData->dataEnd) 
+	    {
+#ifndef USE_BIG5
+                if ((BYTE)buffer [i] > 0xA0)//2nd:gb:a1-fe,big5:40-7e,a1-fe 
+#else//2nd:gb:a1-fe,big5:40-7e,a1-fe
+                if ( ((BYTE)buffer [i] >= 0x40 && (BYTE)buffer[i] <= 0x7e) ||
+                     ((BYTE)buffer [i] >= 0xa1 && (BYTE)buffer[i] <= 0xfe))
+#endif
+		{//+
+                    nTextWidth += GetSysCCharWidth (pCtrl);//+
+                    n += 2;
+                }
+                else
+                    i--;
+            }
+            else 
+            {
+                nTextWidth += GetSysCharWidth (pCtrl);//+
+                n++;
+            }
+        }
+        else 
+        {
+            nTextWidth += GetSysCharWidth (pCtrl);//+
+            n++;
+        }
+
+        if (nTextWidth > nOutWidth)
+            break;
+    }
+
+    return n;
+}
+
+static int edtGetOffset (HWND hwnd,const SLEDITDATA* pSLEditData, int x)//+
+{
+    int i;
+    int newOff = 0;
+    int nTextWidth = 0;
+    const char* buffer = pSLEditData->buffer;
+
+    x -= pSLEditData->leftMargin;
+    for (i = pSLEditData->startPos; i < pSLEditData->dataEnd; i++) {
+        if ((nTextWidth + (GetSysCharWidth(hwnd) >> 1)) >= x)//+
+            break;
+
+	/* FIXME #ifdef GB2312?*/
+        if ((BYTE)buffer [i] > 0xA0)//1st:gb:a1-f7,big5:a1-f9 
+	{//+
+            i++;
+            if (i < pSLEditData->dataEnd) 
+	    {
+#ifndef USE_BIG5
+                if ((BYTE)buffer [i] > 0xA0)//2nd:gb:a1-fe,big5:40-7e,a1-fe 
+#else//2nd:gb:a1-fe,big5:40-7e,a1-fe
+                if ( ((BYTE)buffer [i] >= 0x40 && (BYTE)buffer[i] <= 0x7e) || 
+                     ((BYTE)buffer [i] >= 0xa1 && (BYTE)buffer[i] <= 0xfe))
+#endif
+		{//+
+                    nTextWidth += GetSysCCharWidth (hwnd);//+
+                    newOff += 2;
+                }
+                else
+                    i --;
+            }
+            else 
+            {
+                nTextWidth += GetSysCharWidth (hwnd);//+
+                newOff ++;
+            }
+        }
+        else 
+        {
+            nTextWidth += GetSysCharWidth (hwnd);//+
+            newOff ++;
+        }
+
+    }
+
+    return newOff;
+}
+
+static BOOL edtIsACCharBeforePosition (const char* string, int pos)
+{
+    if (pos < 2)
+        return FALSE;
+
+//1st:gb:a1-f7,big5:a1-f9//2nd:gb:a1-fe,big5:40-7e,a1-fe
+#ifndef USE_BIG5
+    /* FIXME #ifdef GB2312?*/
+    if ((BYTE)string [pos - 2] > 0xA0 && (BYTE)string [pos - 1] > 0xA0)
+        return TRUE;
+#else
+    if ((BYTE)string [pos - 2] > 0xA0)
+    {
+	if ( ((BYTE)string [pos - 1] >= 0x40 && (BYTE)string[pos - 1] <= 0x7e) ||
+	     ((BYTE)string [pos - 1] >= 0xa1 && (BYTE)string[pos - 1] <= 0xfe))
+            return TRUE;
+    }
+#endif
+
+    return FALSE;
+}
+
+static BOOL edtIsACCharAtPosition (const char* string, int len, int pos)
+{
+    if (pos > (len - 2))
+        return FALSE;
+
+//1st:gb:a1-f7,big5:a1-f9//2nd:gb:a1-fe,big5:40-7e,a1-fe
+#ifndef USE_BIG5
+    if ((BYTE)string [pos] > 0xA0 && (BYTE)string [pos + 1] > 0xA0)
+        return TRUE;
+#else
+    if ((BYTE)string [pos] > 0xA0)
+    {
+	if ( ((BYTE)string [pos + 1] >= 0x40 && (BYTE)string [pos + 1] <= 0x7e) ||
+	     ((BYTE)string [pos + 1] >= 0xa1 && (BYTE)string [pos + 1] <= 0xfe))
+	    //fprintf(stderr,"true\n");
+	    //fflush(stderr);
+	    return TRUE;
+    }
+#endif
+
+    return FALSE;
+}
+
+LRESULT CALLBACK
+SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{   
+    HWND	pCtrl;
+    DWORD       dwStyle;
+    HDC         hdc;
+    PSLEDITDATA pSLEditData;
+    RECT	rc;
+
+    pCtrl       = hWnd;
+    dwStyle     = pCtrl->style;
+
+    switch (message)
+    {
+        case WM_CREATE:
+            if (!(pSLEditData = malloc (sizeof (SLEDITDATA)))) {
+                fprintf (stderr, "EDIT: malloc error!\n");
+                return -1;
+            }
+
+            pSLEditData->hFont      	= GetStockObject(DEFAULT_FONT);
+
+            pSLEditData->bufferLen      = LEN_SLEDIT_BUFFER;
+            pSLEditData->editPos        = 0;
+            pSLEditData->caretOff       = 0;
+            pSLEditData->startPos       = 0;
+            
+            pSLEditData->selStart       = 0;
+            pSLEditData->selEnd         = 0;
+            pSLEditData->passwdChar     = '*';
+            pSLEditData->leftMargin     = MARGIN_EDIT_LEFT;
+            pSLEditData->topMargin      = MARGIN_EDIT_TOP;
+            pSLEditData->rightMargin    = MARGIN_EDIT_RIGHT;
+            pSLEditData->bottomMargin   = MARGIN_EDIT_BOTTOM;
+
+            pSLEditData->hardLimit      = -1;
+            
+            // undo information
+            pSLEditData->lastOp         = EDIT_OP_NONE;
+            pSLEditData->lastPos        = 0;
+            pSLEditData->affectedLen    = 0;
+            pSLEditData->undoBufferLen  = LEN_SLEDIT_UNDOBUFFER;
+            pSLEditData->undoBuffer [0] = '\0';
+
+            pSLEditData->dataEnd        = strlen (pCtrl->szTitle);
+            memcpy (pSLEditData->buffer, pCtrl->szTitle,
+                    min (LEN_SLEDIT_BUFFER, pSLEditData->dataEnd));
+
+            pCtrl->userdata2 = (DWORD) pSLEditData;
+
+            pCtrl->userdata  = 0;
+        break;
+
+        case WM_DESTROY:
+            DestroyCaret ();
+
+            free ((void*)pCtrl->userdata2);
+        break;
+#if 0        
+        case WM_CHANGESIZE:
+        {
+            pCtrl->cl = pCtrl->left   + WIDTH_EDIT_BORDER;
+            pCtrl->ct = pCtrl->top    + WIDTH_EDIT_BORDER;
+            pCtrl->cr = pCtrl->right  - WIDTH_EDIT_BORDER;
+            pCtrl->cb = pCtrl->bottom - WIDTH_EDIT_BORDER;
+        }
+        break;
+#endif
+
+#if 1//jmt: for edit: chinese support
+        case WM_SETFONT:
+	{
+		pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+        	pSLEditData->hFont = (HFONT)wParam;
+
+        	ShowWindow(hWnd, SW_HIDE);
+        	ShowWindow(hWnd, SW_SHOWNA);
+
+        	if(LOWORD(lParam))
+            		InvalidateRect(hWnd,NULL,TRUE);
+	}
+	return (LRESULT)0;
+        
+        case WM_GETFONT:
+		pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+        	return (LRESULT)pSLEditData->hFont;
+#endif    
+
+#if 0    
+        case WM_SETCURSOR:
+            if (dwStyle & WS_DISABLED) 
+	    {
+                SetCursor (GetSystemCursor (IDC_ARROW));
+                return 0;
+            }
+        break;
+#endif
+        case WM_KILLFOCUS:
+            pCtrl->userdata &= ~EST_FOCUSED;
+
+            HideCaret (hWnd);
+	    DestroyCaret ();
+
+            SendMessage (GetParent (hWnd), WM_COMMAND, 
+		 (WPARAM) MAKELONG (pCtrl->id, EN_KILLFOCUS), (LPARAM)hWnd);
+        break;
+        
+        case WM_SETFOCUS:
+            if (pCtrl->userdata & EST_FOCUSED)
+                return 0;
+            
+            pCtrl->userdata |= EST_FOCUSED;
+
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+            // only implemented for ES_LEFT align format.
+
+            CreateCaret (hWnd, NULL, 1 /*+ GetSysCharWidth(hWnd)*/,
+		    hWnd->clirect.bottom-hWnd->clirect.top-2);
+            SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                    + pSLEditData->leftMargin, pSLEditData->topMargin);
+            ShowCaret (hWnd);
+
+            SendMessage (GetParent (hWnd), WM_COMMAND,
+	       (WPARAM) MAKELONG (pCtrl->id, EN_SETFOCUS), (LPARAM) hWnd);
+        break;
+        
+        case WM_ENABLE:
+            if ( (!(dwStyle & WS_DISABLED) && !wParam)
+                    || ((dwStyle & WS_DISABLED) && wParam) ) {
+                if (wParam)
+                    pCtrl->style &= ~WS_DISABLED;
+                else
+                    pCtrl->style |=  WS_DISABLED;
+
+                InvalidateRect (hWnd, NULL, FALSE);
+            }
+        break;
+
+	case WM_NCCALCSIZE:
+	{
+		LPNCCALCSIZE_PARAMS lpnc;
+
+		/* calculate client rect from passed window rect in rgrc[0]*/
+		lpnc = (LPNCCALCSIZE_PARAMS)lParam;
+		if(GetWindowLong(hWnd, GWL_STYLE) & WS_BORDER)
+			InflateRect(&lpnc->rgrc[0], -2, -2);
+	}
+		break;
+
+        case WM_NCPAINT:
+            hdc = wParam? (HDC)wParam: GetWindowDC (hWnd);
+	    GetWindowRect(hWnd, &rc);
+
+            if (dwStyle & WS_BORDER)
+		Draw3dInset(hdc, rc.left, rc.top,
+			rc.right-rc.left, rc.bottom-rc.top);
+
+            if (!wParam)
+                ReleaseDC (hWnd, hdc);
+            break;
+
+        case WM_PAINT:
+        {
+            int     dispLen;
+            char*   dispBuffer;
+            RECT    rect,rc;
+	    PAINTSTRUCT ps;
+
+	    HGDIOBJ oldfont;
+	    oldfont=NULL;
+
+            hdc = BeginPaint (hWnd,&ps);
+            GetClientRect (hWnd, &rect);
+    
+            if (dwStyle & WS_DISABLED)
+            {
+#if 0
+                SetBrushColor (hdc, LTGRAY/*COLOR_lightgray*/);
+                FillBox (hdc, 0, 0, rect.right, rect.bottom);
+#else
+		rc.left=0; rc.top=0; rc.bottom=rect.bottom; rc.right=rect.right;
+		FillRect(hdc,&rc,GetStockObject(LTGRAY_BRUSH));
+#endif
+                SetBkColor (hdc, LTGRAY/*COLOR_lightgray*/);
+            }
+            else 
+	    {
+#if 0
+                SetBrushColor (hdc, WHITE/*COLOR_lightwhite*/);
+                FillBox (hdc, 0, 0, rect.right, rect.bottom);
+#else
+		rc.left=0; rc.top=0; rc.bottom=rect.bottom; rc.right=rect.right;
+		FillRect(hdc,&rc,GetStockObject(WHITE_BRUSH));
+#endif
+                SetBkColor (hdc, WHITE/*COLOR_lightwhite*/);
+            }
+
+            SetTextColor (hdc, BLACK/*COLOR_black*/);
+            dispLen = edtGetDispLen (pCtrl);
+            if (dispLen == 0) 
+	    {
+                EndPaint (hWnd, &ps);
+                break;
+            }
+
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+
+#ifdef _DEBUG
+            if (pSLEditData->startPos > pSLEditData->dataEnd)
+                fprintf (stderr, "ASSERT failure: %s.\n", "Edit Paint");
+#endif
+            
+            dispBuffer = ALLOCA(dispLen + 1);
+
+            if (dwStyle & ES_PASSWORD)
+                memset (dispBuffer, '*', dispLen);
+            else
+                memcpy (dispBuffer, 
+                    pSLEditData->buffer + pSLEditData->startPos,
+                    dispLen);
+
+            dispBuffer [dispLen] = '\0';
+
+            // only implemented ES_LEFT align format for single line edit.
+            rect.left += pSLEditData->leftMargin;
+            rect.top += pSLEditData->topMargin;
+            rect.right -= pSLEditData->rightMargin;
+            rect.bottom -= pSLEditData->bottomMargin;
+
+#if 0//fix: no ClipRectIntersect()
+#if 0            
+            ClipRectIntersect (hdc, &rect);
+#else
+	    GdSetClipRects(hdc->psd,1,&rect);//??==ClipRectIntersect??
+#endif
+#endif
+
+#ifdef USE_BIG5	    
+	    oldfont=SelectObject(hdc,CreateFont(12,
+			0,0,0,0,0,0,0,0,0,0,0,
+			FF_DONTCARE|DEFAULT_PITCH,
+			"HZXFONT"));
+#else
+    	    SelectObject(hdc, pSLEditData->hFont);
+#endif
+            TextOut (hdc, pSLEditData->leftMargin, pSLEditData->topMargin, 
+                dispBuffer,-1);
+
+#ifdef USE_BIG5	    
+    	    DeleteObject(SelectObject(hdc,oldfont));
+#endif
+            
+	    EndPaint (hWnd, &ps);
+
+	    FREEA(dispBuffer);
+        }
+        break;
+#if 1//jmt+
+        case WM_KEYDOWN:
+        {
+            BOOL    bChange = FALSE;
+            int     i;
+            RECT    InvRect;
+            int     deleted;
+
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+        
+            switch ((int)(wParam))//(LOWORD (wParam))
+            {
+#if 0
+//                case SCANCODE_ENTER:
+//                    SendMessage (GetParent (hWnd), WM_COMMAND, 
+//		    	(WPARAM) MAKELONG (pCtrl->id, EN_ENTER), (LPARAM) hWnd);
+//                return 0;
+//
+//                case SCANCODE_HOME:
+//                    if (pSLEditData->editPos == 0)
+//                        return 0;
+//
+//                    pSLEditData->editPos  = 0;
+//                    pSLEditData->caretOff = 0;
+//
+//                    SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+//                        + pSLEditData->leftMargin, pSLEditData->topMargin);
+//                    if (pSLEditData->startPos != 0)
+//                        InvalidateRect (hWnd, NULL, FALSE);
+//                    
+//                    pSLEditData->startPos = 0;
+//                return 0;
+//           
+//                case SCANCODE_END:
+//                {
+//                    int newStartPos;
+//                   
+//                    if (pSLEditData->editPos == pSLEditData->dataEnd)
+//                        return 0;
+//
+//                    newStartPos = edtGetStartDispPosAtEnd (pCtrl, pSLEditData);
+//                    
+//                    pSLEditData->editPos = pSLEditData->dataEnd;
+//                    pSLEditData->caretOff = pSLEditData->editPos - newStartPos;
+//
+//                   SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd)
+//                        + pSLEditData->leftMargin, pSLEditData->topMargin);
+//                   if (pSLEditData->startPos != newStartPos)
+//                        InvalidateRect (hWnd, NULL, FALSE);
+//                    
+//                    pSLEditData->startPos = newStartPos;
+//                }
+//                return 0;
+#endif
+
+                case VK_LEFT: //SCANCODE_CURSORBLOCKLEFT:
+                {
+                    BOOL bScroll = FALSE;
+                    int  scrollStep;
+                    
+                    if (pSLEditData->editPos == 0)
+                        return 0;
+
+                    if (edtIsACCharBeforePosition (pSLEditData->buffer, 
+                            pSLEditData->editPos)) 
+		    {
+                        scrollStep = 2;
+                        pSLEditData->editPos -= 2;
+                    }
+                    else {
+                        scrollStep = 1;
+                        pSLEditData->editPos --;
+                    }
+
+                    pSLEditData->caretOff -= scrollStep;
+                    if (pSLEditData->caretOff == 0 
+                            && pSLEditData->editPos != 0) 
+                    {
+                        bScroll = TRUE;
+
+                        if (edtIsACCharBeforePosition (pSLEditData->buffer, 
+                                pSLEditData->editPos)) 
+                        {
+                            pSLEditData->startPos -= 2;
+                            pSLEditData->caretOff = 2;
+                        }
+                        else 
+                        {
+                            pSLEditData->startPos --;
+                            pSLEditData->caretOff = 1;
+                        }
+                    }
+                    else if (pSLEditData->caretOff < 0) 
+                    {
+                        pSLEditData->startPos = 0;
+                        pSLEditData->caretOff = 0;
+                    }
+	        
+                    SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                            + pSLEditData->leftMargin, pSLEditData->topMargin);
+	
+                    if (bScroll)
+                        InvalidateRect (hWnd, NULL, FALSE);
+                }
+                return 0;
+                
+                case VK_RIGHT: //SCANCODE_CURSORBLOCKRIGHT:
+                {
+                    BOOL bScroll = FALSE;
+                    int  scrollStep, moveStep;
+
+                    if (pSLEditData->editPos == pSLEditData->dataEnd)
+                        return 0;
+
+                    if (edtIsACCharAtPosition (pSLEditData->buffer, 
+                                pSLEditData->dataEnd,
+                                pSLEditData->startPos)) 
+		    {
+                        if (edtIsACCharAtPosition (pSLEditData->buffer, 
+                                    pSLEditData->dataEnd,
+                                    pSLEditData->editPos)) 
+                        {
+                            scrollStep = 2;
+                            moveStep = 2;
+                            pSLEditData->editPos  += 2;
+                        }
+                        else 
+                        {
+                            scrollStep = 2;
+                            moveStep = 1;
+                            pSLEditData->editPos ++;
+                        }
+                    }
+                    else 
+		    {
+                        if (edtIsACCharAtPosition (pSLEditData->buffer, 
+                                    pSLEditData->dataEnd,
+                                    pSLEditData->editPos)) 
+			{
+                            if (edtIsACCharAtPosition (pSLEditData->buffer, 
+                                    pSLEditData->dataEnd,
+                                    pSLEditData->startPos + 1))
+                                scrollStep = 3;
+                            else
+                                scrollStep = 2;
+
+                            moveStep = 2;
+                            pSLEditData->editPos += 2;
+                        }
+                        else 
+			{
+                            scrollStep = 1;
+                            moveStep = 1;
+                            pSLEditData->editPos ++;
+                        }
+                    }
+
+                    pSLEditData->caretOff += moveStep;
+                    if (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                            > edtGetOutWidth (pCtrl)) 
+		    {
+                        bScroll = TRUE;
+                        pSLEditData->startPos += scrollStep;
+
+                        pSLEditData->caretOff = 
+                            pSLEditData->editPos - pSLEditData->startPos;
+                    }
+
+                    SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                            + pSLEditData->leftMargin, pSLEditData->topMargin);
+                    if (bScroll)
+                        InvalidateRect (hWnd, NULL, FALSE);
+                }
+                return 0;
+#if 0                
+//                case SCANCODE_INSERT:
+//                    pCtrl->userdata ^= EST_REPLACE;
+//                break;
+#endif
+                case VK_DELETE: //SCANCODE_REMOVE:
+                    if ((pCtrl->userdata & EST_READONLY)
+                            || (pSLEditData->editPos == pSLEditData->dataEnd)){
+	#if 0//fix: no ping()                        
+			Ping ();
+	#endif
+                        return 0;
+                    }
+                    
+                    if (edtIsACCharAtPosition (pSLEditData->buffer, 
+			    pSLEditData->dataEnd, pSLEditData->editPos))
+                        deleted = 2;
+                    else
+                        deleted = 1;
+                        
+                    for (i = pSLEditData->editPos; 
+                            i < pSLEditData->dataEnd - deleted; i++)
+                        pSLEditData->buffer [i] 
+                            = pSLEditData->buffer [i + deleted];
+
+                    pSLEditData->dataEnd -= deleted;
+                    bChange = TRUE;
+                    
+                    InvRect.left = pSLEditData->leftMargin
+			    + pSLEditData->caretOff * GetSysCharWidth (hWnd);
+                    InvRect.top = pSLEditData->topMargin;
+                    InvRect.right = pCtrl->clirect.right - pCtrl->clirect.left;
+                    InvRect.bottom = pCtrl->clirect.bottom - pCtrl->clirect.top;
+
+                    InvalidateRect (hWnd, &InvRect, FALSE);
+                break;
+
+                case VK_BACK: //SCANCODE_BACKSPACE:
+                    if ((pCtrl->userdata & EST_READONLY)
+                            || (pSLEditData->editPos == 0)) {
+                        //-Ping ();//fix: no ping
+                        return 0;
+                    }
+
+                    if (edtIsACCharBeforePosition (pSLEditData->buffer, 
+                                    pSLEditData->editPos))
+                        deleted = 2;
+                    else
+                        deleted = 1;
+                        
+                    for (i = pSLEditData->editPos; 
+                            i < pSLEditData->dataEnd;
+                            i++)
+                        pSLEditData->buffer [i - deleted] 
+                            = pSLEditData->buffer [i];
+
+                    pSLEditData->dataEnd -= deleted;
+                    pSLEditData->editPos -= deleted;
+                    bChange = TRUE;
+                    
+                    pSLEditData->caretOff -= deleted;
+                    if (pSLEditData->caretOff == 0 
+                            && pSLEditData->editPos != 0) {
+                        if (edtIsACCharBeforePosition (pSLEditData->buffer, 
+                                pSLEditData->editPos)) {
+                            pSLEditData->startPos -= 2;
+                            pSLEditData->caretOff = 2;
+                        }
+                        else {
+                            pSLEditData->startPos --;
+                            pSLEditData->caretOff = 1;
+                        }
+                        
+                        InvRect.left = pSLEditData->leftMargin;
+                        InvRect.top = pSLEditData->topMargin;
+                        InvRect.right = pCtrl->clirect.right -
+				pCtrl->clirect.left;
+                        InvRect.bottom = pCtrl->clirect.bottom -
+				pCtrl->clirect.top;
+                    }
+                    else {
+                        InvRect.left = pSLEditData->leftMargin
+			    + pSLEditData->caretOff * GetSysCharWidth (hWnd);
+                        InvRect.top = pSLEditData->topMargin;
+                        InvRect.right = pCtrl->clirect.right -
+				pCtrl->clirect.left;
+                        InvRect.bottom = pCtrl->clirect.bottom -
+				pCtrl->clirect.top;
+                    }
+
+                    SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                            + pSLEditData->leftMargin, pSLEditData->topMargin);
+                    InvalidateRect (hWnd, &InvRect, FALSE);
+                break;
+
+                default:
+                break;
+            }
+       
+            if (bChange)
+                SendMessage (GetParent (hWnd), WM_COMMAND, 
+                    (WPARAM) MAKELONG (pCtrl->id, EN_CHANGE), (LPARAM) hWnd);
+        }
+	break;
+#endif
+        case WM_CHAR:
+        {
+            char charBuffer [2];
+            int  i, chars, scrollStep, inserting;
+            RECT InvRect;
+
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+
+            if (dwStyle & ES_READONLY) {
+
+#if 0//fix: no ping()
+                Ping();
+#endif
+                return 0;
+            }
+            
+            if (HIBYTE (wParam)) {
+                charBuffer [0] = LOBYTE (wParam);
+                charBuffer [1] = HIBYTE (wParam);
+                chars = 2;
+            }
+            else {
+                charBuffer [0] = LOBYTE (wParam);
+                chars = 1;
+            }
+            
+            if (chars == 1) {
+                switch (charBuffer [0])
+                {
+                    case 0x00:  // NULL
+                    case 0x07:  // BEL
+                    case 0x08:  // BS
+                    case 0x09:  // HT
+                    case 0x0A:  // LF
+                    case 0x0B:  // VT
+                    case 0x0C:  // FF
+                    case 0x0D:  // CR
+                    case 0x1B:  // Escape
+                    return 0;
+                }
+            }
+
+            if (pCtrl->userdata & EST_REPLACE) {
+                if (pSLEditData->dataEnd == pSLEditData->editPos)
+                    inserting = chars;
+                else if (edtIsACCharAtPosition (pSLEditData->buffer, 
+                                pSLEditData->dataEnd,
+                                pSLEditData->editPos)) {
+                    if (chars == 2)
+                        inserting = 0;
+                    else
+                        inserting = -1;
+                }
+                else {
+                    if (chars == 2)
+                        inserting = 1;
+                    else
+                        inserting = 0;
+                }
+            }
+            else
+                inserting = chars;
+
+            // check space
+            if (pSLEditData->dataEnd + inserting > pSLEditData->bufferLen) {
+
+#if 0//fix: no ping()
+                Ping ();
+#endif
+                SendMessage (GetParent (hWnd), WM_COMMAND,
+		    (WPARAM) MAKELONG (pCtrl->id, EN_MAXTEXT), (LPARAM) hWnd);
+                return 0;
+            }
+            else if ((pSLEditData->hardLimit >= 0) 
+                        && ((pSLEditData->dataEnd + inserting) 
+                            > pSLEditData->hardLimit)) {
+#if 0//fix: no ping()
+                Ping ();
+#endif
+                SendMessage (GetParent (hWnd), WM_COMMAND,
+		    (WPARAM) MAKELONG (pCtrl->id, EN_MAXTEXT), (LPARAM) hWnd);
+                return 0;
+            }
+
+            if (inserting == -1) {
+                for (i = pSLEditData->editPos; i < pSLEditData->dataEnd-1; i++)
+                    pSLEditData->buffer [i] = pSLEditData->buffer [i + 1];
+            }
+            else if (inserting > 0) {
+                for (i = pSLEditData->dataEnd + inserting - 1; 
+                        i > pSLEditData->editPos + inserting - 1; 
+                        i--)
+                    pSLEditData->buffer [i] 
+                            = pSLEditData->buffer [i - inserting];
+            }
+
+            for (i = 0; i < chars; i++)
+                    pSLEditData->buffer [pSLEditData->editPos + i] 
+                        = charBuffer [i];
+            
+            pSLEditData->editPos += chars;
+            pSLEditData->caretOff += chars;
+            pSLEditData->dataEnd += inserting;
+
+            if (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                            > edtGetOutWidth (pCtrl))
+            {
+                if (edtIsACCharAtPosition (pSLEditData->buffer, 
+                                pSLEditData->dataEnd,
+                                pSLEditData->startPos))
+                    scrollStep = 2;
+                else {
+                    if (chars == 2) {
+                        if (edtIsACCharAtPosition (pSLEditData->buffer, 
+                                pSLEditData->dataEnd,
+                                pSLEditData->startPos + 1))
+                            scrollStep = 3;
+                        else
+                            scrollStep = 2;
+                    }
+                    else
+                        scrollStep = 1;
+                }
+                    
+                pSLEditData->startPos += scrollStep;
+
+                pSLEditData->caretOff = 
+                            pSLEditData->editPos - pSLEditData->startPos;
+
+                InvRect.left = pSLEditData->leftMargin;
+                InvRect.top = pSLEditData->topMargin;
+                InvRect.right = pCtrl->clirect.right - pCtrl->clirect.left;
+                InvRect.bottom = pCtrl->clirect.bottom - pCtrl->clirect.top;
+            }
+            else {
+                InvRect.left = pSLEditData->leftMargin
+                                    + (pSLEditData->caretOff - chars)
+                                        * GetSysCharWidth (hWnd);
+                InvRect.top = pSLEditData->topMargin;
+                InvRect.right = pCtrl->clirect.right - pCtrl->clirect.left;
+                InvRect.bottom = pCtrl->clirect.bottom - pCtrl->clirect.top;
+            }
+
+            SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                            + pSLEditData->leftMargin, pSLEditData->topMargin);
+            InvalidateRect (hWnd, &InvRect, FALSE);
+
+            SendMessage (GetParent (hWnd), WM_COMMAND,
+                (WPARAM) MAKELONG (pCtrl->id, EN_CHANGE), (LPARAM) hWnd);
+        }
+        break;
+
+        case WM_GETTEXTLENGTH:
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+            return pSLEditData->dataEnd;
+        
+        case WM_GETTEXT:
+        {
+            char*   buffer = (char*)lParam;
+            int     len;
+
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+
+            len = min ((int)wParam, pSLEditData->dataEnd);
+
+            memcpy (buffer, pSLEditData->buffer, len);
+            buffer [len] = '\0';
+
+            return len;
+        }
+        break;
+
+        case WM_SETTEXT:
+        {
+            int len;
+
+            if (dwStyle & ES_READONLY)
+                return 0;
+
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+
+            
+            len = strlen ((char*)lParam);
+            len = min (len, pSLEditData->bufferLen);
+            
+            if (pSLEditData->hardLimit >= 0)
+                len = min (len, pSLEditData->hardLimit);
+           
+            pSLEditData->dataEnd = len;
+            memcpy (pSLEditData->buffer, (char*)lParam, len);
+
+            pSLEditData->editPos        = 0;
+            pSLEditData->caretOff       = 0;
+            pSLEditData->startPos       = 0;
+            
+            InvalidateRect (hWnd, NULL, FALSE);
+        }
+        break;
+
+        case WM_LBUTTONDBLCLK:
+        break;
+        
+        case WM_LBUTTONDOWN:
+        {
+            int newOff;
+
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+            newOff = edtGetOffset (hWnd,pSLEditData, LOWORD (lParam));
+            
+            if (newOff != pSLEditData->caretOff) 
+	    {
+                pSLEditData->editPos += newOff - pSLEditData->caretOff;
+                pSLEditData->caretOff = newOff;
+
+                SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                        + pSLEditData->leftMargin, pSLEditData->topMargin);
+            }
+        }
+        break;
+
+        case WM_LBUTTONUP:
+        break;
+        
+        case WM_MOUSEMOVE:
+        break;
+
+        case WM_GETDLGCODE:
+        return DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS;
+
+        case EM_SETREADONLY:
+            if (wParam)
+                pCtrl->style/*dwStyle*/ |= ES_READONLY;
+            else
+                pCtrl->style/*dwStyle*/ &= ~ES_READONLY;
+        return 0;
+        
+        case EM_SETPASSWORDCHAR:
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+
+            if (pSLEditData->passwdChar != (int)wParam) {
+                if (dwStyle & ES_PASSWORD) {
+                    pSLEditData->passwdChar = (int)wParam;
+                    InvalidateRect (hWnd, NULL, TRUE);
+                }
+            }
+        return 0;
+    
+        case EM_GETPASSWORDCHAR:
+        {
+            int* passwdchar;
+            
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+            passwdchar = (int*) lParam;
+
+            *passwdchar = pSLEditData->passwdChar;
+        }
+        return 0;
+    
+        case EM_LIMITTEXT:
+        {
+            int newLimit = (int)wParam;
+            
+            if (newLimit >= 0) {
+                pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+                if (pSLEditData->bufferLen < newLimit)
+                    pSLEditData->hardLimit = -1;
+                else
+                    pSLEditData->hardLimit = newLimit;
+            }
+        }
+        return 0;
+    
+        default:
+    		return DefWindowProc (hWnd, message, wParam, lParam);
+        break;
+    } 
+    return 0;
+}
diff -urN lib/microwindows/src/mwin/winlib/edit.org /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/edit.org
--- lib/microwindows/src/mwin/winlib/edit.org	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/edit.org	2005-02-21 16:13:27.000000000 +0100
@@ -0,0 +1,1052 @@
+/*
+ * Copyright (C) 1999, 2000, Wei Yongming.
+ * Portions Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Edit control for Microwindows win32 api.
+ */
+
+/*
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Library General Public
+**  License as published by the Free Software Foundation; either
+**  version 2 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Library General Public License for more details.
+**
+**  You should have received a copy of the GNU Library General Public
+**  License along with this library; if not, write to the Free
+**  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+**  MA 02111-1307, USA
+*/
+
+/*
+**  Alternatively, the contents of this file may be used under the terms 
+**  of the Mozilla Public License (the "MPL License") in which case the
+**  provisions of the MPL License are applicable instead of those above.
+*/
+
+// Note:
+//  Although there was a version by Zhao Jianghua, this version of
+//  EDIT control is written by Wei Yongming from scratch.
+//
+// Create date: 1999/8/26
+//
+// Modify records:
+//
+//  Who             When        Where       For What                Status
+//-----------------------------------------------------------------------------
+//  WEI Yongming    2000/02/24  Tsinghua    Add MPL License         Finished
+//  Kevin Tseng     2000/05/30  gv          port to microwin        ported
+//  Greg Haerr      2000/06/16  Utah        3d look, bug fixes      Finished
+//
+// TODO:
+//    * Selection.
+//    * Undo.
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define MWINCLUDECOLORS
+#include "windows.h"	/* windef.h, winuser.h */
+#include "wintools.h"
+#include "device.h" 	/* GdGetTextSize */
+
+#define WIDTH_EDIT_BORDER       2
+#define MARGIN_EDIT_LEFT        1
+#define MARGIN_EDIT_TOP         1
+#define MARGIN_EDIT_RIGHT       2
+#define MARGIN_EDIT_BOTTOM      1
+
+#define LEN_SLEDIT_BUFFER       3000
+#define LEN_SLEDIT_UNDOBUFFER   1024
+
+#define EST_FOCUSED     0x00000001L
+#define EST_MODIFY      0x00000002L
+#define EST_READONLY    0x00000004L
+#define EST_REPLACE     0x00000008L
+
+#define EDIT_OP_NONE    0x00
+#define EDIT_OP_DELETE  0x01
+#define EDIT_OP_INSERT  0x02
+#define EDIT_OP_REPLACE 0x03
+
+typedef struct tagSLEDITDATA {
+    int     bufferLen;      // length of buffer
+
+    int     dataEnd;        // data end position
+    int     editPos;        // current edit position
+    int     caretOff;       // caret offset in box
+    int     startPos;       // start display position
+    
+    int     selStart;       // selection start position
+    int     selEnd;         // selection end position
+    
+    int     passwdChar;     // password character
+    
+    int     leftMargin;     // left margin
+    int     topMargin;      // top margin
+    int     rightMargin;    // right margin
+    int     bottomMargin;   // bottom margin
+    
+    int     hardLimit;      // hard limit
+
+    int     lastOp;         // last operation
+    int     lastPos;        // last operation position
+    int     affectedLen;    // affected len of last operation
+    int     undoBufferLen;  // undo buffer len
+    char    undoBuffer [LEN_SLEDIT_UNDOBUFFER];	// Undo buffer;
+    char    buffer [LEN_SLEDIT_BUFFER];		// buffer
+} SLEDITDATA, *PSLEDITDATA;
+
+static LRESULT CALLBACK
+SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+static int GetSysCharWidth (HWND hwnd) 
+{
+	HDC 		hdc;
+    	int xw, xh, xb;
+
+    	hdc = GetDC(hwnd);
+	SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
+    	GdGetTextSize(hdc->font->pfont,"X",1, &xw,&xh,&xb,MWTF_ASCII);
+    	ReleaseDC(hwnd,hdc);
+
+	return xw;
+}
+
+static int GetSysCCharWidth (HWND hwnd)
+{
+	return (2*GetSysCharWidth(hwnd));
+}
+
+int WINAPI MwRegisterEditControl(HINSTANCE hInstance)
+{
+	WNDCLASS	wc;
+
+	wc.style	= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
+	wc.lpfnWndProc	= (WNDPROC)SLEditCtrlProc;
+	wc.cbClsExtra	= 0;
+	wc.cbWndExtra	= 0;
+	wc.hInstance	= hInstance;
+	wc.hIcon	= NULL;
+	wc.hCursor	= 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground= GetStockObject(WHITE_BRUSH);
+	wc.lpszMenuName	= NULL;
+	wc.lpszClassName= "EDIT";
+
+	return RegisterClass(&wc);
+}
+
+static int edtGetOutWidth (const HWND pCtrl)
+{
+    return pCtrl->clirect.right - pCtrl->clirect.left 
+            - ((PSLEDITDATA)(pCtrl->userdata2))->leftMargin
+            - ((PSLEDITDATA)(pCtrl->userdata2))->rightMargin;
+}
+
+static int edtGetStartDispPosAtEnd (const HWND pCtrl, PSLEDITDATA pSLEditData)
+{
+    int         nOutWidth = edtGetOutWidth (pCtrl);
+    int         endPos  = pSLEditData->dataEnd;
+    int         newStartPos = pSLEditData->startPos;
+    const char* buffer = pSLEditData->buffer;
+
+    while (TRUE) {
+        if ((endPos - newStartPos) * GetSysCharWidth (pCtrl) < nOutWidth)//+
+            break;
+        
+	/* FIXME: #ifdef GB2312?*/
+        if ((BYTE)buffer [newStartPos] > 0xA0) 
+	{//+
+            newStartPos ++;
+            if (newStartPos < pSLEditData->dataEnd) 
+	    {
+                if ((BYTE)buffer [newStartPos] > 0xA0)//+
+                    newStartPos ++;
+            }
+        }
+        else
+            newStartPos ++;
+    }
+
+    return newStartPos;
+}
+
+static int edtGetDispLen (const HWND pCtrl)
+{
+    int i, n = 0;
+    int nOutWidth = edtGetOutWidth (pCtrl);
+    int nTextWidth = 0;
+    PSLEDITDATA pSLEditData = (PSLEDITDATA)(pCtrl->userdata2);
+    const char* buffer = pSLEditData->buffer;
+
+    for (i = pSLEditData->startPos; i < pSLEditData->dataEnd; i++) {
+	/* FIXME #ifdef GB2312?*/
+        if ((BYTE)buffer [i] > 0xA0) 
+	{//+
+            i++;
+            if (i < pSLEditData->dataEnd) {
+                if ((BYTE)buffer [i] > 0xA0) 
+		{//+
+                    nTextWidth += GetSysCCharWidth (pCtrl);//+
+                    n += 2;
+                }
+                else
+                    i--;
+            }
+            else {
+                nTextWidth += GetSysCharWidth (pCtrl);//+
+                n++;
+            }
+        }
+        else {
+            nTextWidth += GetSysCharWidth (pCtrl);//+
+            n++;
+        }
+
+        if (nTextWidth > nOutWidth)
+            break;
+    }
+
+    return n;
+}
+
+static int edtGetOffset (HWND hwnd,const SLEDITDATA* pSLEditData, int x)//+
+{
+    int i;
+    int newOff = 0;
+    int nTextWidth = 0;
+    const char* buffer = pSLEditData->buffer;
+
+    x -= pSLEditData->leftMargin;
+    for (i = pSLEditData->startPos; i < pSLEditData->dataEnd; i++) {
+        if ((nTextWidth + (GetSysCharWidth(hwnd) >> 1)) >= x)//+
+            break;
+
+	/* FIXME #ifdef GB2312?*/
+        if ((BYTE)buffer [i] > 0xA0) 
+	{//+
+            i++;
+            if (i < pSLEditData->dataEnd) {
+                if ((BYTE)buffer [i] > 0xA0) 
+		{//+
+                    nTextWidth += GetSysCCharWidth (hwnd);//+
+                    newOff += 2;
+                }
+                else
+                    i --;
+            }
+            else {
+                nTextWidth += GetSysCharWidth (hwnd);//+
+                newOff ++;
+            }
+        }
+        else {
+            nTextWidth += GetSysCharWidth (hwnd);//+
+            newOff ++;
+        }
+
+    }
+
+    return newOff;
+}
+
+static BOOL edtIsACCharBeforePosition (const char* string, int pos)
+{
+    if (pos < 2)
+        return FALSE;
+
+    /* FIXME #ifdef GB2312?*/
+    if ((BYTE)string [pos - 2] > 0xA0 && (BYTE)string [pos - 1] > 0xA0)
+        return TRUE;
+
+    return FALSE;
+}
+
+static BOOL edtIsACCharAtPosition (const char* string, int len, int pos)
+{
+    if (pos > (len - 2))
+        return FALSE;
+
+    if ((BYTE)string [pos] > 0xA0 && (BYTE)string [pos + 1] > 0xA0)
+        return TRUE;
+
+    return FALSE;
+}
+
+static LRESULT CALLBACK
+SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{   
+    HWND	pCtrl;
+    DWORD       dwStyle;
+    HDC         hdc;
+    PSLEDITDATA pSLEditData;
+    RECT	rc;
+
+    pCtrl       = hWnd;
+    dwStyle     = pCtrl->style;
+
+    switch (message)
+    {
+        case WM_CREATE:
+            if (!(pSLEditData = malloc (sizeof (SLEDITDATA)))) {
+                fprintf (stderr, "EDIT: malloc error!\n");
+                return -1;
+            }
+
+            pSLEditData->bufferLen      = LEN_SLEDIT_BUFFER;
+            pSLEditData->editPos        = 0;
+            pSLEditData->caretOff       = 0;
+            pSLEditData->startPos       = 0;
+            
+            pSLEditData->selStart       = 0;
+            pSLEditData->selEnd         = 0;
+            pSLEditData->passwdChar     = '*';
+            pSLEditData->leftMargin     = MARGIN_EDIT_LEFT;
+            pSLEditData->topMargin      = MARGIN_EDIT_TOP;
+            pSLEditData->rightMargin    = MARGIN_EDIT_RIGHT;
+            pSLEditData->bottomMargin   = MARGIN_EDIT_BOTTOM;
+
+            pSLEditData->hardLimit      = -1;
+            
+            // undo information
+            pSLEditData->lastOp         = EDIT_OP_NONE;
+            pSLEditData->lastPos        = 0;
+            pSLEditData->affectedLen    = 0;
+            pSLEditData->undoBufferLen  = LEN_SLEDIT_UNDOBUFFER;
+            pSLEditData->undoBuffer [0] = '\0';
+
+            pSLEditData->dataEnd        = strlen (pCtrl->szTitle);
+            memcpy (pSLEditData->buffer, pCtrl->szTitle,
+                    min (LEN_SLEDIT_BUFFER, pSLEditData->dataEnd));
+
+            pCtrl->userdata2 = (DWORD) pSLEditData;
+
+            pCtrl->userdata  = 0;
+        break;
+
+        case WM_DESTROY:
+
+            DestroyCaret ();
+            free ((void*)pCtrl->userdata2);
+        break;
+#if 0        
+        case WM_CHANGESIZE:
+        {
+            pCtrl->cl = pCtrl->left   + WIDTH_EDIT_BORDER;
+            pCtrl->ct = pCtrl->top    + WIDTH_EDIT_BORDER;
+            pCtrl->cr = pCtrl->right  - WIDTH_EDIT_BORDER;
+            pCtrl->cb = pCtrl->bottom - WIDTH_EDIT_BORDER;
+        }
+        break;
+#endif
+#if 0
+        case WM_SETFONT:
+        break;
+        
+        case WM_GETFONT:
+        break;
+#endif    
+#if 0    
+        case WM_SETCURSOR:
+            if (dwStyle & WS_DISABLED) {
+                SetCursor (GetSystemCursor (IDC_ARROW));
+                return 0;
+            }
+        break;
+#endif
+        case WM_KILLFOCUS:
+            pCtrl->userdata &= ~EST_FOCUSED;
+
+            HideCaret (hWnd);
+	    DestroyCaret ();
+
+            SendMessage (GetParent (hWnd), WM_COMMAND, 
+		 (WPARAM) MAKELONG (pCtrl->id, EN_KILLFOCUS), (LPARAM)hWnd);
+        break;
+        
+        case WM_SETFOCUS:
+            if (pCtrl->userdata & EST_FOCUSED)
+                return 0;
+            
+            pCtrl->userdata |= EST_FOCUSED;
+
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+            // only implemented for ES_LEFT align format.
+
+            CreateCaret (hWnd, NULL, 1, /*GetSysCharWidth(hWnd)+1,*/
+		    hWnd->clirect.bottom-hWnd->clirect.top-2);
+            SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                    + pSLEditData->leftMargin, pSLEditData->topMargin);
+            ShowCaret (hWnd);
+
+            SendMessage (GetParent (hWnd), WM_COMMAND,
+	       (WPARAM) MAKELONG (pCtrl->id, EN_SETFOCUS), (LPARAM) hWnd);
+        break;
+        
+        case WM_ENABLE:
+            if ( (!(dwStyle & WS_DISABLED) && !wParam)
+                    || ((dwStyle & WS_DISABLED) && wParam) ) {
+                if (wParam)
+                    pCtrl->style &= ~WS_DISABLED;
+                else
+                    pCtrl->style |=  WS_DISABLED;
+
+                InvalidateRect (hWnd, NULL, FALSE);
+            }
+        break;
+
+	case WM_NCCALCSIZE:
+	{
+		LPNCCALCSIZE_PARAMS lpnc;
+
+		/* calculate client rect from passed window rect in rgrc[0]*/
+		lpnc = (LPNCCALCSIZE_PARAMS)lParam;
+		if(GetWindowLong(hWnd, GWL_STYLE) & WS_BORDER)
+			InflateRect(&lpnc->rgrc[0], -2, -2);
+	}
+		break;
+
+        case WM_NCPAINT:
+            hdc = wParam? (HDC)wParam: GetWindowDC (hWnd);
+	    GetWindowRect(hWnd, &rc);
+
+            if (dwStyle & WS_BORDER)
+		Draw3dInset(hdc, rc.left, rc.top,
+			rc.right-rc.left, rc.bottom-rc.top);
+
+            if (!wParam)
+                ReleaseDC (hWnd, hdc);
+            break;
+
+        case WM_PAINT:
+        {
+            int     dispLen;
+            char*   dispBuffer;
+            RECT    rect,rc;
+	    PAINTSTRUCT ps;
+
+            hdc = BeginPaint (hWnd,&ps);
+            GetClientRect (hWnd, &rect);
+    
+            if (dwStyle & WS_DISABLED)
+            {
+#if 0
+                SetBrushColor (hdc, LTGRAY/*COLOR_lightgray*/);
+                FillBox (hdc, 0, 0, rect.right, rect.bottom);
+#else
+		rc.left=0; rc.top=0; rc.bottom=rect.bottom; rc.right=rect.right;
+		FillRect(hdc,&rc,GetStockObject(LTGRAY_BRUSH));
+#endif
+                SetBkColor (hdc, LTGRAY/*COLOR_lightgray*/);
+            }
+            else 
+	    {
+#if 0
+                SetBrushColor (hdc, WHITE/*COLOR_lightwhite*/);
+                FillBox (hdc, 0, 0, rect.right, rect.bottom);
+#else
+		rc.left=0; rc.top=0; rc.bottom=rect.bottom; rc.right=rect.right;
+		FillRect(hdc,&rc,GetStockObject(WHITE_BRUSH));
+#endif
+                SetBkColor (hdc, WHITE/*COLOR_lightwhite*/);
+            }
+
+            SetTextColor (hdc, BLACK/*COLOR_black*/);
+            dispLen = edtGetDispLen (pCtrl);
+            if (dispLen == 0) 
+	    {
+                EndPaint (hWnd, &ps);
+                break;
+            }
+
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+
+#ifdef _DEBUG
+            if (pSLEditData->startPos > pSLEditData->dataEnd)
+                fprintf (stderr, "ASSERT failure: %s.\n", "Edit Paint");
+#endif
+            
+            dispBuffer = alloca (dispLen + 1);
+
+            if (dwStyle & ES_PASSWORD)
+                memset (dispBuffer, '*', dispLen);
+            else
+                memcpy (dispBuffer, 
+                    pSLEditData->buffer + pSLEditData->startPos,
+                    dispLen);
+
+            dispBuffer [dispLen] = '\0';
+
+            // only implemented ES_LEFT align format for single line edit.
+            rect.left += pSLEditData->leftMargin;
+            rect.top += pSLEditData->topMargin;
+            rect.right -= pSLEditData->rightMargin;
+            rect.bottom -= pSLEditData->bottomMargin;
+
+#if 0//fix: no ClipRectIntersect()
+#if 0            
+            ClipRectIntersect (hdc, &rect);
+#else
+	    GdSetClipRects(hdc->psd,1,&rect);//??==ClipRectIntersect??
+#endif
+#endif
+	    SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
+            TextOut (hdc, pSLEditData->leftMargin, pSLEditData->topMargin, 
+                dispBuffer,-1);
+            
+	    EndPaint (hWnd, &ps);
+        }
+        break;
+#if 0//fix: no WM_KEYDOWN
+        case WM_KEYDOWN:
+        {
+            BOOL    bChange = FALSE;
+            int     i;
+            RECT    InvRect;
+            int     deleted;
+
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+        
+            switch (LOWORD (wParam))
+            {
+                case SCANCODE_ENTER:
+                    SendMessage (GetParent (hWnd), WM_COMMAND, 
+		    	(WPARAM) MAKELONG (pCtrl->id, EN_ENTER), (LPARAM) hWnd);
+                return 0;
+
+                case SCANCODE_HOME:
+                    if (pSLEditData->editPos == 0)
+                        return 0;
+
+                    pSLEditData->editPos  = 0;
+                    pSLEditData->caretOff = 0;
+
+                    SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                        + pSLEditData->leftMargin, pSLEditData->topMargin);
+
+                    if (pSLEditData->startPos != 0)
+                        InvalidateRect (hWnd, NULL, FALSE);
+                    
+                    pSLEditData->startPos = 0;
+                return 0;
+           
+                case SCANCODE_END:
+                {
+                    int newStartPos;
+                   
+                    if (pSLEditData->editPos == pSLEditData->dataEnd)
+                        return 0;
+
+                    newStartPos = edtGetStartDispPosAtEnd (pCtrl, pSLEditData);
+                    
+                    pSLEditData->editPos = pSLEditData->dataEnd;
+                    pSLEditData->caretOff = pSLEditData->editPos - newStartPos;
+
+                    SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd)
+                        + pSLEditData->leftMargin, pSLEditData->topMargin);
+
+                    if (pSLEditData->startPos != newStartPos)
+                        InvalidateRect (hWnd, NULL, FALSE);
+                    
+                    pSLEditData->startPos = newStartPos;
+                }
+                return 0;
+
+                case SCANCODE_CURSORBLOCKLEFT:
+                {
+                    BOOL bScroll = FALSE;
+                    int  scrollStep;
+                    
+                    if (pSLEditData->editPos == 0)
+                        return 0;
+
+                    if (edtIsACCharBeforePosition (pSLEditData->buffer, 
+                            pSLEditData->editPos)) {
+                        scrollStep = 2;
+                        pSLEditData->editPos -= 2;
+                    }
+                    else {
+                        scrollStep = 1;
+                        pSLEditData->editPos --;
+                    }
+
+                    pSLEditData->caretOff -= scrollStep;
+                    if (pSLEditData->caretOff == 0 
+                            && pSLEditData->editPos != 0) {
+
+                        bScroll = TRUE;
+
+                        if (edtIsACCharBeforePosition (pSLEditData->buffer, 
+                                pSLEditData->editPos)) {
+                            pSLEditData->startPos -= 2;
+                            pSLEditData->caretOff = 2;
+                        }
+                        else {
+                            pSLEditData->startPos --;
+                            pSLEditData->caretOff = 1;
+                        }
+                    }
+                    else if (pSLEditData->caretOff < 0) {
+                        pSLEditData->startPos = 0;
+                        pSLEditData->caretOff = 0;
+                    }
+
+                    SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                            + pSLEditData->leftMargin, pSLEditData->topMargin);
+
+                    if (bScroll)
+                        InvalidateRect (hWnd, NULL, FALSE);
+                }
+                return 0;
+                
+                case SCANCODE_CURSORBLOCKRIGHT:
+                {
+                    BOOL bScroll = FALSE;
+                    int  scrollStep, moveStep;
+
+                    if (pSLEditData->editPos == pSLEditData->dataEnd)
+                        return 0;
+
+                    if (edtIsACCharAtPosition (pSLEditData->buffer, 
+                                pSLEditData->dataEnd,
+                                pSLEditData->startPos)) {
+                        if (edtIsACCharAtPosition (pSLEditData->buffer, 
+                                    pSLEditData->dataEnd,
+                                    pSLEditData->editPos)) {
+                            scrollStep = 2;
+                            moveStep = 2;
+                            pSLEditData->editPos  += 2;
+                        }
+                        else {
+                            scrollStep = 2;
+                            moveStep = 1;
+                            pSLEditData->editPos ++;
+                        }
+                    }
+                    else {
+                        if (edtIsACCharAtPosition (pSLEditData->buffer, 
+                                    pSLEditData->dataEnd,
+                                    pSLEditData->editPos)) {
+                                    
+                            if (edtIsACCharAtPosition (pSLEditData->buffer, 
+                                    pSLEditData->dataEnd,
+                                    pSLEditData->startPos + 1))
+                                scrollStep = 3;
+                            else
+                                scrollStep = 2;
+
+                            moveStep = 2;
+                            pSLEditData->editPos += 2;
+                        }
+                        else {
+                            scrollStep = 1;
+                            moveStep = 1;
+                            pSLEditData->editPos ++;
+                        }
+                    }
+
+                    pSLEditData->caretOff += moveStep;
+                    if (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                            > edtGetOutWidth (pCtrl)) {
+                        bScroll = TRUE;
+                        pSLEditData->startPos += scrollStep;
+
+                        pSLEditData->caretOff = 
+                            pSLEditData->editPos - pSLEditData->startPos;
+                    }
+
+                    SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                            + pSLEditData->leftMargin, pSLEditData->topMargin);
+
+                    if (bScroll)
+                        InvalidateRect (hWnd, NULL, FALSE);
+                }
+                return 0;
+                
+                case SCANCODE_INSERT:
+                    pCtrl->userdata ^= EST_REPLACE;
+                break;
+
+                case SCANCODE_REMOVE:
+                    if ((pCtrl->userdata & EST_READONLY)
+                            || (pSLEditData->editPos == pSLEditData->dataEnd)){
+#if 0//fix: no ping()                        
+			Ping ();
+#endif
+                        return 0;
+                    }
+                    
+                    if (edtIsACCharAtPosition (pSLEditData->buffer, 
+			    pSLEditData->dataEnd, pSLEditData->editPos))
+                        deleted = 2;
+                    else
+                        deleted = 1;
+                        
+                    for (i = pSLEditData->editPos; 
+                            i < pSLEditData->dataEnd - deleted; i++)
+                        pSLEditData->buffer [i] 
+                            = pSLEditData->buffer [i + deleted];
+
+                    pSLEditData->dataEnd -= deleted;
+                    bChange = TRUE;
+                    
+                    InvRect.left = pSLEditData->leftMargin
+			    + pSLEditData->caretOff * GetSysCharWidth (hWnd);
+                    InvRect.top = pSLEditData->topMargin;
+                    InvRect.right = pCtrl->clirect.right - pCtrl->clirect.left;
+                    InvRect.bottom = pCtrl->clirect.bottom - pCtrl->clirect.top;
+
+                    InvalidateRect (hWnd, &InvRect, FALSE);
+                break;
+
+                case SCANCODE_BACKSPACE:
+                    if ((pCtrl->userdata & EST_READONLY)
+                            || (pSLEditData->editPos == 0)) {
+                        Ping ();
+                        return 0;
+                    }
+
+                    if (edtIsACCharBeforePosition (pSLEditData->buffer, 
+                                    pSLEditData->editPos))
+                        deleted = 2;
+                    else
+                        deleted = 1;
+                        
+                    for (i = pSLEditData->editPos; 
+                            i < pSLEditData->dataEnd;
+                            i++)
+                        pSLEditData->buffer [i - deleted] 
+                            = pSLEditData->buffer [i];
+
+                    pSLEditData->dataEnd -= deleted;
+                    pSLEditData->editPos -= deleted;
+                    bChange = TRUE;
+                    
+                    pSLEditData->caretOff -= deleted;
+                    if (pSLEditData->caretOff == 0 
+                            && pSLEditData->editPos != 0) {
+                        if (edtIsACCharBeforePosition (pSLEditData->buffer, 
+                                pSLEditData->editPos)) {
+                            pSLEditData->startPos -= 2;
+                            pSLEditData->caretOff = 2;
+                        }
+                        else {
+                            pSLEditData->startPos --;
+                            pSLEditData->caretOff = 1;
+                        }
+                        
+                        InvRect.left = pSLEditData->leftMargin;
+                        InvRect.top = pSLEditData->topMargin;
+                        InvRect.right = pCtrl->clirect.right -
+				pCtrl->clirect.left;
+                        InvRect.bottom = pCtrl->clirect.bottom -
+				pCtrl->clirect.top;
+                    }
+                    else {
+                        InvRect.left = pSLEditData->leftMargin
+			    + pSLEditData->caretOff * GetSysCharWidth (hWnd);
+                        InvRect.top = pSLEditData->topMargin;
+                        InvRect.right = pCtrl->clirect.right -
+				pCtrl->clirect.left;
+                        InvRect.bottom = pCtrl->clirect.bottom -
+				pCtrl->clirect.top;
+                    }
+
+                    SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                            + pSLEditData->leftMargin, pSLEditData->topMargin);
+
+                    InvalidateRect (hWnd, &InvRect, FALSE);
+                break;
+
+                default:
+                break;
+            }
+       
+            if (bChange)
+                SendMessage (GetParent (hWnd), WM_COMMAND, 
+                    (WPARAM) MAKELONG (pCtrl->id, EN_CHANGE), (LPARAM) hWnd);
+        }
+	break;
+#endif
+        case WM_CHAR:
+        {
+            char charBuffer [2];
+            int  i, chars, scrollStep, inserting;
+            RECT InvRect;
+
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+
+            if (dwStyle & ES_READONLY) {
+
+#if 0//fix: no ping()
+                Ping();
+#endif
+                return 0;
+            }
+            
+            if (HIBYTE (wParam)) {
+                charBuffer [0] = LOBYTE (wParam);
+                charBuffer [1] = HIBYTE (wParam);
+                chars = 2;
+            }
+            else {
+                charBuffer [0] = LOBYTE (wParam);
+                chars = 1;
+            }
+            
+            if (chars == 1) {
+                switch (charBuffer [0])
+                {
+                    case 0x00:  // NULL
+                    case 0x07:  // BEL
+                    case 0x08:  // BS
+                    case 0x09:  // HT
+                    case 0x0A:  // LF
+                    case 0x0B:  // VT
+                    case 0x0C:  // FF
+                    case 0x0D:  // CR
+                    case 0x1B:  // Escape
+                    return 0;
+                }
+            }
+
+            if (pCtrl->userdata & EST_REPLACE) {
+                if (pSLEditData->dataEnd == pSLEditData->editPos)
+                    inserting = chars;
+                else if (edtIsACCharAtPosition (pSLEditData->buffer, 
+                                pSLEditData->dataEnd,
+                                pSLEditData->editPos)) {
+                    if (chars == 2)
+                        inserting = 0;
+                    else
+                        inserting = -1;
+                }
+                else {
+                    if (chars == 2)
+                        inserting = 1;
+                    else
+                        inserting = 0;
+                }
+            }
+            else
+                inserting = chars;
+
+            // check space
+            if (pSLEditData->dataEnd + inserting > pSLEditData->bufferLen) {
+
+#if 0//fix: no ping()
+                Ping ();
+#endif
+                SendMessage (GetParent (hWnd), WM_COMMAND,
+		    (WPARAM) MAKELONG (pCtrl->id, EN_MAXTEXT), (LPARAM) hWnd);
+                return 0;
+            }
+            else if ((pSLEditData->hardLimit >= 0) 
+                        && ((pSLEditData->dataEnd + inserting) 
+                            > pSLEditData->hardLimit)) {
+#if 0//fix: no ping()
+                Ping ();
+#endif
+                SendMessage (GetParent (hWnd), WM_COMMAND,
+		    (WPARAM) MAKELONG (pCtrl->id, EN_MAXTEXT), (LPARAM) hWnd);
+                return 0;
+            }
+
+            if (inserting == -1) {
+                for (i = pSLEditData->editPos; i < pSLEditData->dataEnd-1; i++)
+                    pSLEditData->buffer [i] = pSLEditData->buffer [i + 1];
+            }
+            else if (inserting > 0) {
+                for (i = pSLEditData->dataEnd + inserting - 1; 
+                        i > pSLEditData->editPos + inserting - 1; 
+                        i--)
+                    pSLEditData->buffer [i] 
+                            = pSLEditData->buffer [i - inserting];
+            }
+
+            for (i = 0; i < chars; i++)
+                    pSLEditData->buffer [pSLEditData->editPos + i] 
+                        = charBuffer [i];
+            
+            pSLEditData->editPos += chars;
+            pSLEditData->caretOff += chars;
+            pSLEditData->dataEnd += inserting;
+
+            if (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                            > edtGetOutWidth (pCtrl))
+            {
+                if (edtIsACCharAtPosition (pSLEditData->buffer, 
+                                pSLEditData->dataEnd,
+                                pSLEditData->startPos))
+                    scrollStep = 2;
+                else {
+                    if (chars == 2) {
+                        if (edtIsACCharAtPosition (pSLEditData->buffer, 
+                                pSLEditData->dataEnd,
+                                pSLEditData->startPos + 1))
+                            scrollStep = 3;
+                        else
+                            scrollStep = 2;
+                    }
+                    else
+                        scrollStep = 1;
+                }
+                    
+                pSLEditData->startPos += scrollStep;
+
+                pSLEditData->caretOff = 
+                            pSLEditData->editPos - pSLEditData->startPos;
+
+                InvRect.left = pSLEditData->leftMargin;
+                InvRect.top = pSLEditData->topMargin;
+                InvRect.right = pCtrl->clirect.right - pCtrl->clirect.left;
+                InvRect.bottom = pCtrl->clirect.bottom - pCtrl->clirect.top;
+            }
+            else {
+                InvRect.left = pSLEditData->leftMargin
+                                    + (pSLEditData->caretOff - chars)
+                                        * GetSysCharWidth (hWnd);
+                InvRect.top = pSLEditData->topMargin;
+                InvRect.right = pCtrl->clirect.right - pCtrl->clirect.left;
+                InvRect.bottom = pCtrl->clirect.bottom - pCtrl->clirect.top;
+            }
+
+            SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                            + pSLEditData->leftMargin, pSLEditData->topMargin);
+            InvalidateRect (hWnd, &InvRect, FALSE);
+
+            SendMessage (GetParent (hWnd), WM_COMMAND,
+                (WPARAM) MAKELONG (pCtrl->id, EN_CHANGE), (LPARAM) hWnd);
+        }
+        break;
+
+        case WM_GETTEXTLENGTH:
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+            return pSLEditData->dataEnd;
+        
+        case WM_GETTEXT:
+        {
+            char*   buffer = (char*)lParam;
+            int     len;
+
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+
+            len = min ((int)wParam, pSLEditData->dataEnd);
+
+            memcpy (buffer, pSLEditData->buffer, len);
+            buffer [len] = '\0';
+
+            return len;
+        }
+        break;
+
+        case WM_SETTEXT:
+        {
+            int len;
+
+            if (dwStyle & ES_READONLY)
+                return 0;
+
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+
+            
+            len = strlen ((char*)lParam);
+            len = min (len, pSLEditData->bufferLen);
+            
+            if (pSLEditData->hardLimit >= 0)
+                len = min (len, pSLEditData->hardLimit);
+           
+            pSLEditData->dataEnd = len;
+            memcpy (pSLEditData->buffer, (char*)lParam, len);
+
+            pSLEditData->editPos        = 0;
+            pSLEditData->caretOff       = 0;
+            pSLEditData->startPos       = 0;
+            
+            InvalidateRect (hWnd, NULL, FALSE);
+        }
+        break;
+
+        case WM_LBUTTONDBLCLK:
+        break;
+        
+        case WM_LBUTTONDOWN:
+        {
+            int newOff;
+            
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+            
+            newOff = edtGetOffset (hWnd,pSLEditData, LOWORD (lParam));
+            
+            if (newOff != pSLEditData->caretOff) {
+                pSLEditData->editPos += newOff - pSLEditData->caretOff;
+                pSLEditData->caretOff = newOff;
+
+                SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+                        + pSLEditData->leftMargin, pSLEditData->topMargin);
+            }
+        }
+        break;
+
+        case WM_LBUTTONUP:
+        break;
+        
+        case WM_MOUSEMOVE:
+        break;
+
+        case WM_GETDLGCODE:
+        return DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS;
+
+        case EM_SETREADONLY:
+            if (wParam)
+                pCtrl->style/*dwStyle*/ |= ES_READONLY;
+            else
+                pCtrl->style/*dwStyle*/ &= ~ES_READONLY;
+        return 0;
+        
+        case EM_SETPASSWORDCHAR:
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+
+            if (pSLEditData->passwdChar != (int)wParam) {
+                if (dwStyle & ES_PASSWORD) {
+                    pSLEditData->passwdChar = (int)wParam;
+                    InvalidateRect (hWnd, NULL, TRUE);
+                }
+            }
+        return 0;
+    
+        case EM_GETPASSWORDCHAR:
+        {
+            int* passwdchar;
+            
+            pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+            passwdchar = (int*) lParam;
+
+            *passwdchar = pSLEditData->passwdChar;
+        }
+        return 0;
+    
+        case EM_LIMITTEXT:
+        {
+            int newLimit = (int)wParam;
+            
+            if (newLimit >= 0) {
+                pSLEditData = (PSLEDITDATA) (pCtrl->userdata2);
+                if (pSLEditData->bufferLen < newLimit)
+                    pSLEditData->hardLimit = -1;
+                else
+                    pSLEditData->hardLimit = newLimit;
+            }
+        }
+        return 0;
+    
+        default:
+    		return DefWindowProc (hWnd, message, wParam, lParam);
+        break;
+    } 
+    return 0;
+}
diff -urN lib/microwindows/src/mwin/winlib/fastfill.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/fastfill.c
--- lib/microwindows/src/mwin/winlib/fastfill.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/fastfill.c	2005-02-21 16:03:40.000000000 +0100
@@ -0,0 +1,19 @@
+#include "windows.h"
+#include "wintools.h"
+/*
+ * WIN Draw Library
+ *	Fast fill rectangle
+ */
+
+/*
+ * fast fill background (works with non-dithered colors only)
+ */
+void WINAPI
+FastFillRect(HDC hdc,LPRECT lprect,COLORREF cr)
+{
+	COLORREF	crOld;
+
+	crOld = SetBkColor( hdc, cr);
+	ExtTextOut( hdc, 0, 0, ETO_OPAQUE | ETO_CLIPPED, lprect, NULL, 0, NULL);
+	SetBkColor( hdc, crOld);
+}
diff -urN lib/microwindows/src/mwin/winlib/file /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/file
--- lib/microwindows/src/mwin/winlib/file	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/file	2005-02-21 16:13:27.000000000 +0100
@@ -0,0 +1,80 @@
+edit.c:static int GetSysCharHeight (HWND hwnd) 
+edit.c:static int GetSysCharWidth (HWND hwnd) 
+edit.c:	return (2*GetSysCharWidth(hwnd));
+edit.c:        if ((endPos - newStartPos) * GetSysCharWidth (pCtrl) < nOutWidth)//+
+edit.c:                nTextWidth += GetSysCharWidth (pCtrl);//+
+edit.c:            nTextWidth += GetSysCharWidth (pCtrl);//+
+edit.c:        if ((nTextWidth + (GetSysCharWidth(hwnd) >> 1)) >= x)//+
+edit.c:                nTextWidth += GetSysCharWidth (hwnd);//+
+edit.c:            nTextWidth += GetSysCharWidth (hwnd);//+
+edit.c:            CreateCaret (hWnd, NULL, 1 /*+ GetSysCharWidth(hWnd)*/,
+edit.c:            SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+edit.c://                    SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+edit.c://                   SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd)
+edit.c:                    SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+edit.c:                    if (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+edit.c:                    SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+edit.c:			    + pSLEditData->caretOff * GetSysCharWidth (hWnd);
+edit.c:			    + pSLEditData->caretOff * GetSysCharWidth (hWnd);
+edit.c:                    SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+edit.c:            if (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+edit.c:                                        * GetSysCharWidth (hWnd);
+edit.c:            SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+edit.c:                SetCaretPos (pSLEditData->caretOff * GetSysCharWidth (hWnd) 
+listbox.c://- pData->itemHeight = GetSysCharHeight ();
+listbox.c://jmt: should be SYSTEM_FIXED_FONT because of minigui's GetSysCharXXX()
+medit.c:extern int GetSysCharHeight (HWND hwnd); 
+medit.c:extern int GetSysCharWidth (HWND hwnd); 
+medit.c:        if ((endPos - newStartPos) * GetSysCharWidth (hWnd) < nOutWidth)
+medit.c:                nTextWidth += GetSysCharWidth (hWnd);
+medit.c:            nTextWidth += GetSysCharWidth (hWnd);
+medit.c:        if ((nTextWidth + (GetSysCharWidth(hwnd) >> 1)) >= x)
+medit.c:                nTextWidth += GetSysCharWidth (hwnd);
+medit.c:            nTextWidth += GetSysCharWidth (hwnd);
+medit.c:	    nline = x / GetSysCharHeight(hwnd);
+medit.c:	    pMLEditData->MaxlinesDisp   = (clientRect.bottom-clientRect.top)/GetSysCharHeight(hWnd);
+medit.c:            CreateCaret (hWnd, NULL, 1, /*GetSysCharWidth(hWnd)+1,*/
+medit.c:            SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+medit.c:				pMLEditData->leftMargin - pMLEditData->dispPos * GetSysCharWidth(hWnd) ,
+medit.c:				GetSysCharHeight(hWnd)*(pLineData->lineNO - pMLEditData->StartlineDisp) 
+medit.c:                    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+medit.c:                        (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+medit.c:                        (pMLEditData->editLine-pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+medit.c:                    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd)
+medit.c:						(pMLEditData->editLine-pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+medit.c:                    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+medit.c:						(pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+medit.c:            	        if (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+medit.c:                    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+medit.c:                        (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight (hWnd) 
+medit.c:                   				pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+medit.c:                      				pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+medit.c:                          			+ pMLEditData->leftMargin+GetSysCharWidth(hWnd)/2);
+medit.c:                    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+medit.c:					    (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+medit.c:                   				pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+medit.c:                       				pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+medit.c:                           			+ pMLEditData->leftMargin+GetSysCharWidth(hWnd)/2);
+medit.c:                    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+medit.c:					    (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+medit.c:                    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+medit.c:					    (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+medit.c:            if (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+medit.c:            SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+medit.c:					    (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+medit.c:   	        		newOff = edtGetOffset (hWnd,pMLEditData,temp, LOWORD(lParam)+GetSysCharWidth(hWnd)/2);
+medit.c:   	        	    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+medit.c:					(pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+progbar.c:GetSysCharWidth(HDC hdc)
+progbar.c:GetSysCharHeight(HDC hdc)
+progbar.c:	int maxw = GetSysCharWidth (hdc) << 2;
+progbar.c:	int charh = GetSysCharHeight (hdc);
+progbar.c:        TextOut (hdc, x + ((w - GetSysCharWidth (hdc) * strlen (szText) )>>1), 
+progbar.c:                      y + ((h - GetSysCharHeight(hdc) )>>1), 
+static.c:static int GetSysCharHeight (HWND hwnd) 
+static.c://jmt: should be SYSTEM_FIXED_FONT because of minigui's GetSysCharXXX()
+static.c:static int GetSysCharWidth (HWND hwnd) 
+static.c://jmt: should be SYSTEM_FIXED_FONT because of minigui's GetSysCharXXX()
+static.c:			    rcClient.top + (GetSysCharHeight(hwnd) >> 1),
+static.c:			rcClient.top+(GetSysCharHeight(hwnd) >> 1),
+static.c:                        TextOut (hdc, GetSysCharWidth (hwnd), 2, spCaption, -1);
diff -urN lib/microwindows/src/mwin/winlib/graph3d.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/graph3d.c
--- lib/microwindows/src/mwin/winlib/graph3d.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/graph3d.c	2005-02-21 16:03:40.000000000 +0100
@@ -0,0 +1,540 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * 3D Graphics Library for Micro-Windows
+ */
+#define MWINCLUDECOLORS
+#include "windows.h"
+#include "device.h"
+#include "graph3d.h"
+#define USEBLIT		1	/* =1 to use memDC's*/
+
+static int	nxpix;
+static int	nypix;
+static vec1	xscale;
+static vec1	yscale;
+static vec3	eye;
+static vec3	direct;
+static double 	Q[5][5];
+static HDC	hdc;
+static HDC	hdcMem;
+static HBITMAP	hbmp, hbmpOrg;
+
+/* setup eye, direction, calc observation matrix Q*/
+void
+look3(vec1 x, vec1 y, vec1 z)
+{
+	eye.x = x;
+	eye.y = y;
+	eye.z = z;
+	direct.x = -eye.x;
+	direct.y = -eye.y;
+	direct.z = -eye.z;
+	findQ();
+}
+
+void
+init3(HDC hDC, HWND memhwnd)
+{
+	HBRUSH	hbr;
+
+	hdc = hDC;
+	if(hdc) {
+		nxpix = hdc->hwnd->clirect.right - hdc->hwnd->clirect.left;
+		nypix = hdc->hwnd->clirect.bottom - hdc->hwnd->clirect.top;
+		xscale = (vec1)(nxpix-1) / nxpix * nxpix/2;
+		yscale = (vec1)(nypix-1) / nypix * nypix/2;
+
+		if(memhwnd) {
+			hdcMem = CreateCompatibleDC(NULL);
+			if(hdcMem) {
+				hbmp = CreateCompatibleBitmap(hdcMem,
+					nxpix, nypix);
+				hbmpOrg = SelectObject(hdcMem, hbmp);
+				hdc = hdcMem;
+			}
+			hbr = (HBRUSH)GetClassLong(memhwnd, GCL_HBRBACKGROUND);
+			FillRect(hdc, NULL, hbr);
+		}
+		/* create pen for setcolor3() color override*/
+		SelectObject(hdc, CreatePen(PS_SOLID, 1, BLACK));
+	}
+}
+
+void
+paint3(HDC hDC)
+{
+	if(hdcMem) {
+		BitBlt(hDC, 0, 0, nxpix, nypix, hdcMem, 0, 0, SRCCOPY);
+		DeleteObject(SelectObject(hdcMem, hbmpOrg));
+		DeleteDC(hdcMem);
+	}
+	hdcMem = NULL;
+}
+
+int
+fx(vec1 x)
+{
+	return (int)(x * xscale + nxpix*0.5 - 0.5);
+}
+
+int
+fy(vec1 y)
+{
+	return (int)(y * yscale + nypix*0.5 - 0.5);
+}
+
+void
+moveto3(vec2 pt)
+{
+	MoveToEx(hdc, fx(pt.x), fy(pt.y), NULL);
+}
+
+void
+setcolor3(MWCOLORVAL c)
+{
+	if(hdc)
+		hdc->pen->color = c;
+}
+
+void
+lineto3(vec2 pt)
+{
+	LineTo(hdc, fx(pt.x), fy(pt.y));
+}
+
+void
+polyfill(int n, vec2 points[])
+{
+	int	i;
+	int	xoff, yoff;
+	MWPOINT	pv[MAXPOLY];
+
+	if(!hdc)
+		return;
+
+	/* calc window offset*/
+	xoff = hdc->hwnd->clirect.left;
+	yoff = hdc->hwnd->clirect.top;
+
+	/* only plot non-trivial polygons*/
+	if(n > 2) {
+		for(i=0; i<n; ++i) {
+			pv[i].x = fx(points[i].x) + xoff;
+			pv[i].y = fy(points[i].y) + yoff;
+			/* fix: floating round error, y intercept difference
+			 * with GdLine
+			 */
+			/*pv[i].x = fx(points[i].x + xoff);*/
+			/*pv[i].y = fy(points[i].y + yoff);*/
+		}
+		GdSetForeground(GdFindColor(hdc->pen->color));
+		GdFillPoly(hdc->psd, n, pv);
+	}
+}
+
+void
+square(void)
+{
+	vec2	pt0, pt1, pt2, pt3;
+
+	pt0.x = -1; pt0.y = 1;
+	pt1.x = -1; pt1.y = -1;
+	pt2.x = 1; pt2.y = -1;
+	pt3.x = 1; pt3.y = 1;
+	moveto3(pt0);
+	lineto3(pt1);
+	lineto3(pt2);
+	lineto3(pt3);
+	lineto3(pt0);
+}
+
+void
+circle3(vec1 r)
+{
+	vec1 	theta = 0;
+	vec1	thinc = 2*pi/100;
+	int 	i;
+	vec2	pt;
+
+	pt.x = r;
+	pt.y = 0.0;
+	moveto3(pt);
+
+	for(i=0; i<100; ++i) {
+		theta = theta + thinc;
+		pt.x = r*cos(theta);
+		pt.y = r*sin(theta);
+		lineto3(pt);
+	}
+}
+
+void
+daisy(vec1 r,int points)
+{
+	int	i, j;
+	vec1	theta = 0;
+	vec1	thinc;
+	vec2	pt[100];
+
+	/* calculate n points on a circle*/
+	thinc = 2*pi/points;
+	for(i=0; i<points; ++i) {
+		pt[i].x = r*cos(theta);
+		pt[i].y = r*sin(theta);
+		theta += thinc;
+	}
+
+	/* join point i to point j for all 0 <= i < j < n */
+	for(i=0; i<points-1; ++i) {
+		for(j=i+1; j<points; ++j) {
+			moveto3(pt[i]);
+			lineto3(pt[j]);
+		}
+	}
+}
+
+void
+rose(vec1 r,int levels,int points)
+{
+	int	i, j, m, n;
+	vec1	r1, theta, thinc;
+	vec2	inner[100];
+	vec2	outer[100];
+	vec2	triangle[3];
+
+	m = levels;
+	n = points;
+	thinc = 2*pi/n;
+
+	/* initial inner circle*/
+	for(i=0; i<n; ++i) {
+		inner[i].x = 0.0;
+		inner[i].y = 0.0;
+	}
+
+	/* loop thru m levels*/
+	for(j=1; j<=m; ++j) {
+		theta = -j*pi/n;
+		r1 = r * (vec1)j/m;
+
+		/* calc n points on outer circle*/
+		for(i=0; i<n; ++i) {
+			theta += thinc;
+			outer[i].x = r1*cos(theta);
+			outer[i].y = r1*sin(theta);
+		}
+
+		/* construct/draw triangles with vertices on
+		 * inner and outer circles
+		 */
+		for(i=0; i<n; ++i) {
+			triangle[0] = outer[i];
+			triangle[1] = outer[(i+1) % n];
+			triangle[2] = inner[i];
+
+			/* fill triangle in red*/
+			setcolor3(RED);
+			polyfill(3, triangle);
+
+#if 1
+			/* outline triangle in white*/
+			setcolor3(WHITE);
+			moveto3(triangle[0]);
+			lineto3(triangle[1]);
+			lineto3(triangle[2]);
+			lineto3(triangle[0]);
+#endif
+		}
+
+		/* copy points on outer circle to inner arrays*/
+		for(i=0; i<n; ++i)
+			inner[i] = outer[i];
+	}
+}
+
+/* draw a triangle with cordners v0, v1, v2*/
+void
+triangle(vec2 v0, vec2 v1, vec2 v2)
+{
+	vec2	poly[3];
+
+	poly[0] = v0;
+	poly[1] = v1;
+	poly[2] = v2;
+
+	setcolor3(GREEN);
+	polyfill(3, poly);
+	setcolor3(BLACK);
+	moveto3(poly[2]);
+	lineto3(poly[0]);
+	lineto3(poly[1]);
+	lineto3(poly[2]);
+}
+
+/* draw a quadrilateral with corners v0, v1, v2, v3*/
+void
+quadrilateral(vec2 v0, vec2 v1, vec2 v2, vec2 v3)
+{
+	vec2	poly[4];
+
+	poly[0] = v0;
+	poly[1] = v1;
+	poly[2] = v2;
+	poly[3] = v3;
+	setcolor3(GREEN);
+	polyfill(4, poly);
+	setcolor3(BLACK);
+	moveto3(poly[3]);
+	lineto3(poly[0]);
+	lineto3(poly[1]);
+	lineto3(poly[2]);
+	lineto3(poly[3]);
+}
+
+/* find intersection of lines v0 to v1 and v2 to v3*/
+static int
+patch(vec2 v0, vec2 v1, vec2 v2, vec2 v3)
+{
+	vec1	denom;
+	vec1	mu;
+	vec2	v4;
+
+	denom = (v1.x-v0.x)*(v3.y-v2.y) - (v1.y-v0.y)*(v3.x-v2.x);
+	if(fabs(denom) > epsilon) {
+		mu = ((v2.x-v0.x)*(v3.y-v2.y) - (v2.y-v0.y)*(v3.x-v2.x))/denom;
+
+		/* if intersection between lines v0 to v1 and v2 to v3,
+		 * call it v4 and form triangles v0,v2,v4 and v1,v3,v4
+		 */
+		if(mu >= 0 && mu <= 1) {
+			v4.x = (1-mu)*v0.x + mu*v1.x;
+			v4.y = (1-mu)*v0.y + mu*v1.y;
+			triangle(v0, v2, v4);
+			triangle(v1, v3, v4);
+			return 0;
+		}
+	}
+
+	/* else find intersection of lines v0 to v2 and v1 to v3*/
+	denom = (v2.x-v0.x)*(v3.y-v1.y) - (v2.y-v0.y)*(v3.x-v1.x);
+	if(fabs(denom) > epsilon) {
+		mu = ((v1.x-v0.x)*(v3.y-v1.y) - (v1.y-v0.y)*(v3.x-v1.x))/denom;
+
+		/* if intersection between v0 and v1, call it v4
+		 * and form triangles v0,v1,v4 and v2,v3,v4
+		 */
+		if(mu >= 0 && mu <= 1) {
+			v4.x = (1-mu)*v0.x + mu*v2.x;
+			v4.y = (1-mu)*v0.y + mu*v2.y;
+			triangle(v0, v1, v4);
+			triangle(v2, v3, v4);
+			return 0;
+		}
+	}
+
+	/* there are no proper intersections so form quadrilateral v0,v1,v3,v2*/
+	quadrilateral(v0, v1, v3, v2);
+	return 1;
+}
+
+/* plotted function*/
+static vec1
+plotfn(vec1 x, vec1 z)
+{
+	vec1	t;
+
+	/* y = 4sin(sqrt(x*x+z*z))/sqrt(x*x+z*z) */
+	t = sqrt(x*x + z*z);
+	if(fabs(t) < epsilon)
+		return 4.0;
+	return 4.0 * sin(t) / t;
+}
+
+/* draw mathematical function plotfn*/
+void
+drawgrid(vec1 xmin, vec1 xmax, int nx, vec1 zmin, vec1 zmax, int nz)
+{
+	int	i, j;
+	vec1	xi, xstep, yij;
+	vec1	zj, zstep;
+	vec2	v[2][100];
+	double	S[5][5];
+
+	/* scale it down*/
+	scale3(1.0/(xmax-xmin)*2, 1.0/(xmax-xmin)*2, 1.0/(zmax-zmin), S);
+	mult3(Q, S, Q);
+
+	/* grid from xmin to xmax in nx steps and zmin to xmax in nz steps*/
+	xstep = (xmax-xmin)/nx;
+	zstep = (zmax-zmin)/nz;
+	xi = xmin;
+	zj = zmin;
+
+	/* calc grid points on first fixed-z line, fine the y-height
+	 * and transfrorm the points (xi,yij,zj) into observed
+	 * position.  Observed first set stored in v[0,1..nx]
+	 */
+	for(i=0; i<=nx; ++i) {
+		yij = plotfn(xi, zj);
+		v[0][i].x = Q[1][1]*xi + Q[1][2]*yij + Q[1][3]*zj;
+		v[0][i].y = Q[2][1]*xi + Q[2][2]*yij + Q[2][3]*zj;
+		xi += xstep;
+	}
+
+	/* run thru consecutive fixed-z lines (the second set)*/
+	for(j=0; j<nz; ++j) {
+		xi = xmin;
+		zj += zstep;
+
+		/* calc grid points on this second set, find the
+		 * y-height and transform the points (xi,yij,zj)
+		 * into observed position.  Observed second set
+		 * stored in v[1,0..nx]
+		 */
+		for(i=0; i<=nx; ++i) {
+			yij = plotfn(xi, zj);
+			v[1][i].x = Q[1][1]*xi + Q[1][2]*yij + Q[1][3]*zj;
+			v[1][i].y = Q[2][1]*xi + Q[2][2]*yij + Q[2][3]*zj;
+			xi += xstep;
+		}
+
+		/* run thru the nx patches formed by these two sets*/
+		for(i=0; i<nx; ++i)
+			patch(v[0][i], v[0][i+1], v[1][i], v[1][i+1]);
+
+		/* copy second set into first set*/
+		for(i=0; i<=nx; ++i)
+			v[0][i] = v[1][i];
+	}
+}
+
+/* returns the angle whose tangent is y/x.
+ * all anomalies such as x=0 are also checked
+ */
+vec1
+angle(vec1 x, vec1 y)
+{
+	if(fabs(x) < epsilon)
+		if(fabs(y) < epsilon)
+			return 0.0;
+		else 
+			if(y > 0.0)
+				return pi*0.5;
+			else return pi*1.5;
+	else
+		if(x < 0.0)
+			return atan(y/x) + pi;
+		else return atan(y/x);
+}
+
+/* calc 3d scaling matrix A giving scaling vector sx,sy,sz.
+ * one unit on the x axis becomes sx units, one unit on y, sy,
+ * and one unit on the z axis becomes sz units
+ */
+void
+scale3(vec1 sx, vec1 sy, vec1 sz, double A[][5])
+{
+	int	i, j;
+
+	for(i=1; i<5; ++i)
+		for(j=1; j<5; ++j)
+			A[i][j] = 0.0;
+	A[1][1] = sx;
+	A[2][2] = sy;
+	A[3][3] = sz;
+	A[4][4] = 1.0;
+}
+
+/* calc 3d axes translation matrix A
+ * origin translated by vectdor tx,ty,tz
+ */
+void
+tran3(vec1 tx, vec1 ty, vec1 tz, double A[][5])
+{
+	int	i, j;
+
+	for(i=1; i<5; ++i) {
+		for(j=1; j<5; ++j)
+			A[i][j] = 0.0;
+		A[i][i] = 1.0;
+	}
+	A[1][4] = -tx;
+	A[2][4] = -ty;
+	A[3][4] = -tz;
+}
+
+/* calc 3d axes rotation matrix A.  The axes are
+ * rotated anti-clockwise through an angle theta radians
+ * about an axis specified by m: m=1 means x, m=2 y, m=3 z axis
+ */
+void
+rot3(int m, vec1 theta, double A[][5])
+{
+	int	i, j, m1, m2;
+	vec1	c, s;
+
+	for(i=1; i<5; ++i) 
+		for(j=1; j<5; ++j)
+			A[i][j] = 0.0;
+	A[m][m] = 1.0;
+	A[4][4] = 1.0;
+	m1 = (m % 3) + 1;
+	m2 = (m1 % 3) + 1;
+	c = cos(theta);
+	s = sin(theta);
+	A[m1][m1] = c;
+	A[m2][m2] = c;
+	A[m1][m2] = s;
+	A[m2][m1] = s;
+}
+
+/* calc the matrix product C of two matrices A and B*/
+void
+mult3(double A[][5], double B[][5], double C[][5])
+{
+	int	i, j, k;
+	vec1	ab;
+
+	for(i=1; i<5; ++i) 
+		for(j=1; j<5; ++j) {
+			ab = 0;
+			for(k=1; k<5; ++k)
+				ab += A[i][k] * B[k][j];
+			C[i][j] = ab;
+		}
+}
+
+/* calc observation matrix Q for given observer*/
+void
+findQ(void)
+{
+	vec1	alpha, beta, gamma, v, w;
+	double	E[5][5];
+	double	F[5][5];
+	double	G[5][5];
+	double	H[5][5];
+	double	U[5][5];
+
+	/* calc translation matrix F*/
+	tran3(eye.x, eye.y, eye.z, F);
+
+	/* calc rotation matrix G*/
+	alpha = angle(-direct.x, -direct.y);
+	rot3(3, alpha, G);
+
+	/* calc rotation matrix H*/
+	v = sqrt(direct.x*direct.x + direct.y*direct.y);
+	beta = angle(-direct.z, v);
+	rot3(2, beta, H);
+
+	/* calc rotation matrix U*/
+	w = sqrt(v*v + direct.z*direct.z);
+	gamma = angle(-direct.x*w, direct.y*direct.z);
+	rot3(3, -gamma, U);
+
+	/* combine the transformations to find Q*/
+	mult3(G, F, Q);
+	mult3(H, Q, E);
+	mult3(U, E, Q);
+}
diff -urN lib/microwindows/src/mwin/winlib/insetr.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/insetr.c
--- lib/microwindows/src/mwin/winlib/insetr.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/insetr.c	2005-02-21 16:03:40.000000000 +0100
@@ -0,0 +1,14 @@
+#include "windows.h"
+#include "wintools.h"
+/*
+ * WIN Draw Library
+ */
+
+void WINAPI
+InsetR(LPRECT lprc,int h,int v)
+{
+	lprc->top += v;
+	lprc->left += h;
+	lprc->right -= 2*h-1;
+	lprc->bottom -= 2*v-1;
+}
diff -urN lib/microwindows/src/mwin/winlib/listbox.0 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/listbox.0
--- lib/microwindows/src/mwin/winlib/listbox.0	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/listbox.0	2005-02-21 16:13:27.000000000 +0100
@@ -0,0 +1,1653 @@
+/*
+ * Copyright (C) 1999, 2000, Wei Yongming.
+ * Portions Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Listbox for Microwindows win32 api.
+ */
+
+/*
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Library General Public
+**  License as published by the Free Software Foundation; either
+**  version 2 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Library General Public License for more details.
+**
+**  You should have received a copy of the GNU Library General Public
+**  License along with this library; if not, write to the Free
+**  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+**  MA 02111-1307, USA
+*/
+
+/*
+**  Alternatively, the contents of this file may be used under the terms 
+**  of the Mozilla Public License (the "MPL License") in which case the
+**  provisions of the MPL License are applicable instead of those above.
+*/
+
+// Note:
+//  Although there was a version by Zhao Jianghua, this version of
+//  LISTBOX control is written by Wei Yongming from scratch.
+//
+// Modify records:
+//
+//  Who             When        Where       For What                Status
+//-----------------------------------------------------------------------------
+//  Wei Yongming    1999/10/18  Tsinghua    Item Additional Data    Finished
+//  Wei Yongming    1999/10/31  Tsinghua    Space bar for checkmark Finished
+//  Wei Yongming    1999/10/31  Tsinghua    Character match item    Finished
+//  Wei Yongming    1999/11/07  Tsinghua    Character match item    Bug fixing
+//  WEI Yongming    2000/01/20  Tsinghua    Thumb dragging          Finished
+//  WEI Yongming    2000/02/24  Tsinghua    Add MPL License         Finished
+//  Kevin Tseng     2000/05/26  gv          port to microwin        ported
+//  Greg Haerr      2000/06/15  Utah        3d look, bug fixes      Finished
+//  Kevin Tseng     2000/06/22  gv          fixed bug if no item    Finished
+//
+// TODO:
+// 1. Multiple columns support.
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define MWINCLUDECOLORS
+#include "windows.h"
+#include "wintools.h" 	/* Draw3dBox */
+#include "device.h" 	/* GdGetTextSize */
+
+#define FixStrAlloc(n)	malloc((n)+1)
+#define FreeFixStr(p)	free(p)
+
+#define LBIF_NORMAL         0x0000L
+#define LBIF_SELECTED       0x0001L
+#define LBIF_CHECKED        0x0010L
+#define LBIF_PARTCHECKED    0x0020L
+#define LBIF_CHECKMARKMASK  0x00F0L
+
+#define CMFLAG_BLANK        0
+#define CMFLAG_CHECKED      1
+#define CMFLAG_PARTCHECKED  2
+typedef struct _LISTBOXITEMINFO {
+    int     insPos;         // insert position
+    char*   string;         // item string
+    int     cmFlag;         // check mark flag
+    HICON   hIcon;          // handle of icon
+} LISTBOXITEMINFO, *PLISTBOXITEMINFO;
+
+typedef struct _LISTBOXITEM {
+    char*   key;                // item sort key
+    DWORD   dwFlags;            // item flags
+    DWORD   dwData;             // item data
+    DWORD   dwAddData;          // item additional data
+    struct  _LISTBOXITEM* next;  // next item
+} LISTBOXITEM, *PLISTBOXITEM;
+
+#define DEF_LB_BUFFER_LEN       5
+
+#define LBF_FOCUS               0x0001
+#define LBF_NOTHINGSELECTED	0x0002
+
+typedef struct _LISTBOXDATA {
+    DWORD dwFlags;          // listbox flags
+
+    int itemCount;          // items count
+    int itemTop;            // start display item
+    int itemVisibles;       // number of visible items
+
+    int itemHilighted;      // current hilighted item
+    int itemHeight;         // item height
+
+    LISTBOXITEM* head;      // items linked list head
+
+    int buffLen;            // buffer length
+    LISTBOXITEM* buffStart; // buffer start
+    LISTBOXITEM* buffEnd;   // buffer end
+    LISTBOXITEM* freeList;  // free list in buffer 
+} LISTBOXDATA, *PLISTBOXDATA;
+
+void ListboxControlCleanup ();
+static LRESULT CALLBACK
+ListboxCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+#define ITEM_BOTTOM(x)  (x->itemTop + x->itemVisibles - 1)
+
+#define LST_WIDTH_CHECKMARK     11
+#define LST_HEIGHT_CHECKMARK    11
+#define LST_INTER_BMPTEXT       2
+
+int WINAPI MwRegisterListboxControl(HINSTANCE hInstance)
+{
+	WNDCLASS	wc;
+#if 0
+    static BITMAP sg_bmpCheckMark;
+    if (!LoadSystemBitmap (&sg_bmpCheckMark, "checkmark")) {
+        fprintf (stderr, "Load ListBox Check Mark Bitmap failure!\n");
+        return FALSE;
+    }
+#endif
+	wc.style	= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
+	wc.lpfnWndProc	= (WNDPROC)ListboxCtrlProc;
+	wc.cbClsExtra	= 0;
+	wc.cbWndExtra	= 0;
+	wc.hInstance	= hInstance;
+	wc.hIcon	= NULL;
+	wc.hCursor	= 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground= GetStockObject(WHITE_BRUSH);
+	wc.lpszMenuName	= NULL;
+	wc.lpszClassName= "LISTBOX";
+
+	return RegisterClass(&wc);
+}
+
+void ListboxControlCleanup ()
+{
+#if 0
+    UnloadBitmap (&sg_bmpCheckMark);
+#endif
+}
+
+static LRESULT NotifyParent (HWND hwnd, int id, int code)
+{
+    return SendMessage (GetParent (hwnd), WM_COMMAND, 
+                 (WPARAM) MAKELONG (id, code), (LPARAM)hwnd);
+}
+
+static BOOL lstInitListBoxData (HWND hwnd,LISTBOXDATA* pData, int len)
+{
+    int i, xw, xh, xb;
+    PLISTBOXITEM plbi;
+    HDC hdc;
+    
+    memset (pData, 0, sizeof (LISTBOXDATA));
+#if 0
+//- pData->itemHeight = GetSysCharHeight ();
+#else
+    hdc=GetDC(hwnd);
+    SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
+    GdGetTextSize(hdc->font->pfont,"X",1,
+		&xw,&xh,&xb,MWTF_ASCII);
+    ReleaseDC(hwnd,hdc);
+    pData->itemHeight=xh + 1; 
+#endif
+    pData->itemHilighted = 0;
+    pData->dwFlags = LBF_NOTHINGSELECTED;
+
+    // init item buffer.
+    if (!(pData->buffStart = malloc (len * sizeof (LISTBOXITEM))))
+        return FALSE;
+
+    pData->buffLen = len;
+    pData->buffEnd = pData->buffStart + len;
+    pData->freeList = pData->buffStart;
+
+    plbi = pData->freeList;
+    for (i = 0; i < len - 1; i++) {
+        plbi->next = plbi + 1;
+        plbi ++;
+    }
+    plbi->next = NULL;
+
+    return TRUE;
+}
+
+static void lstListBoxCleanUp (LISTBOXDATA* pData)
+{
+    PLISTBOXITEM plbi;
+    PLISTBOXITEM next;
+
+    plbi = pData->head;
+    while (plbi) {
+        FreeFixStr (plbi->key);
+        next = plbi->next;
+        if (plbi < pData->buffStart || plbi > pData->buffEnd)
+            free (plbi);
+
+        plbi = next;
+    }
+    
+    free (pData->buffStart);
+}
+
+static void lstResetListBoxContent (PLISTBOXDATA pData)
+{
+    int i;
+    PLISTBOXITEM plbi, next;
+
+    pData->itemCount = 0;
+    pData->itemTop = 0;
+    pData->itemHilighted = 0;
+//    pData->itemVisibles = 0;
+
+    plbi = pData->head;
+    while (plbi) {
+        FreeFixStr (plbi->key);
+        next = plbi->next;
+        if (plbi < pData->buffStart || plbi > pData->buffEnd)
+            free (plbi);
+
+        plbi = next;
+    }
+
+    pData->head = NULL;
+    pData->freeList = pData->buffStart;
+
+    plbi = pData->freeList;
+    for (i = 0; i < pData->buffLen - 1; i++) {
+        plbi->next = plbi + 1;
+        plbi ++;
+    }
+    plbi->next = NULL;
+}
+
+static PLISTBOXITEM lstAllocItem (PLISTBOXDATA pData)
+{
+    PLISTBOXITEM plbi;
+
+    if (pData->freeList) {
+        plbi = pData->freeList;
+        pData->freeList = plbi->next;
+    }
+    else
+        plbi = (PLISTBOXITEM) malloc (sizeof (LISTBOXITEM));
+    
+    return plbi;
+}
+
+static void lstFreeItem (PLISTBOXDATA pData, PLISTBOXITEM plbi)
+{
+    if (plbi < pData->buffStart || plbi > pData->buffEnd)
+        free (plbi);
+    else {
+        plbi->next = pData->freeList;
+        pData->freeList = plbi;
+    }
+}
+
+static int lstAddNewItem (DWORD dwStyle, 
+        PLISTBOXDATA pData, PLISTBOXITEM newItem, int pos)
+{
+    PLISTBOXITEM plbi;
+    PLISTBOXITEM insPosItem = NULL;
+    int insPos = 0;
+
+    newItem->next = NULL;
+    if (!pData->head)
+        insPosItem = NULL;
+    else if (dwStyle & LBS_SORT) {
+        plbi = pData->head;
+
+        if (strcmp (newItem->key, plbi->key) < 0) {
+            insPosItem = NULL;
+            insPos = 0;
+        }
+        else {
+            while (plbi->next) {
+                if (strcmp (newItem->key, plbi->next->key) <= 0)
+                    break;
+            
+                plbi = plbi->next;
+                insPos ++;
+            }
+            insPosItem = plbi;
+        }
+    }
+    else {
+        plbi = pData->head;
+
+        if (pos < 0) {
+            while (plbi->next) {
+                plbi = plbi->next;
+                insPos ++;
+            }
+            insPosItem = plbi;
+        }
+        else if (pos > 0) {
+            int index = 0;
+
+            while (plbi->next) {
+                if (pos == index)
+                    break;
+                plbi = plbi->next;
+                index ++;
+                insPos ++;
+            }
+            insPosItem = plbi;
+        }
+    }
+
+    if (insPosItem) {
+        plbi = insPosItem->next;
+        insPosItem->next = newItem;
+        newItem->next = plbi;
+
+        insPos ++;
+    }
+    else {
+        plbi = pData->head;
+        pData->head = newItem;
+        newItem->next = plbi;
+    }
+
+    pData->itemCount ++;
+    return insPos;
+}
+
+static PLISTBOXITEM lstRemoveItem (PLISTBOXDATA pData, int* pos)
+{
+    int index = 0;
+    PLISTBOXITEM plbi, prev;
+
+    if (!pData->head)
+        return NULL;
+
+    if (*pos < 0) {
+        prev = pData->head;
+        plbi = pData->head;
+        while (plbi->next) {
+            prev = plbi;
+            plbi = plbi->next;
+            index ++;
+        }
+
+        if (plbi == pData->head) {
+            pData->head = pData->head->next;
+            *pos = 0;
+            return plbi;
+        }
+        else {
+            prev->next = plbi->next;
+            *pos = index;
+            return plbi;
+        }
+    }
+    else if (*pos == 0) {
+        plbi = pData->head;
+        pData->head = plbi->next;
+        return plbi;
+    }
+    else {
+        index = 0;
+        prev = pData->head;
+        plbi = pData->head;
+        while (plbi->next) {
+            if (*pos == index)
+                break;
+
+            prev = plbi;
+            plbi = plbi->next;
+            index ++;
+        }
+
+        if (plbi == pData->head) {
+            pData->head = pData->head->next;
+            *pos = 0;
+            return plbi;
+        }
+        else {
+            prev->next = plbi->next;
+            *pos = index;
+            return plbi;
+        }
+    }
+
+    return NULL;
+}
+
+static void lstGetItemsRect (PLISTBOXDATA pData, int start, int end, RECT* prc)
+{
+    if (start < 0)
+        start = 0;
+
+    prc->top = (start - pData->itemTop)*pData->itemHeight;
+
+    if (end >= 0)
+        prc->bottom = (end - pData->itemTop + 1)*pData->itemHeight;
+
+}
+
+static void lstInvalidateItem (HWND hwnd, PLISTBOXDATA pData, int pos,BOOL fEBk)
+{
+    RECT rcInv;
+    
+    if (pos < pData->itemTop || pos > (pData->itemTop + pData->itemVisibles))
+        return;
+    
+    GetClientRect (hwnd, &rcInv);
+    rcInv.top = (pos - pData->itemTop)*pData->itemHeight;
+    rcInv.bottom = rcInv.top + pData->itemHeight;
+
+    InvalidateRect (hwnd, &rcInv, fEBk);
+}
+
+static BOOL lstInvalidateUnderItem (HWND hwnd, PLISTBOXDATA pData, int pos)
+{
+    RECT rcInv;
+    
+    if (pos > (pData->itemTop + pData->itemVisibles))
+        return FALSE;
+
+    if (pos <= pData->itemTop) {
+        InvalidateRect (hwnd, NULL, TRUE);
+        return TRUE;
+    }
+    
+    GetClientRect (hwnd, &rcInv);
+
+    lstGetItemsRect (pData, pos, -1, &rcInv);
+
+    if (rcInv.top < rcInv.bottom)
+        InvalidateRect (hwnd, &rcInv, TRUE);
+
+    return TRUE;
+}
+
+static PLISTBOXITEM lstGetItem (PLISTBOXDATA pData, int pos)
+{
+    int i;
+    PLISTBOXITEM plbi;
+
+    plbi = pData->head;
+    for (i=0; i < pos && plbi; i++)
+        plbi = plbi->next;
+
+    return plbi;
+}
+
+static int lstFindItem (PLISTBOXDATA pData, int start, char* key, BOOL bExact)
+{
+    PLISTBOXITEM plbi;
+    int keylen = strlen (key);
+  
+    if (start >= (pData->itemCount - 1))
+        start = 0;
+
+    plbi = lstGetItem (pData, start);
+
+    while (plbi)
+    {
+        if (bExact && (keylen != strlen (plbi->key))) {
+            plbi = plbi->next;
+            start ++;
+            continue;
+        }
+
+        if (strncasecmp (key, plbi->key, keylen) == 0)
+            return start;
+            
+        plbi = plbi->next;
+        start ++;
+    }
+
+    return LB_ERR;
+}
+
+static void lstOnDrawSListBoxItems (HDC hdc, DWORD dwStyle, 
+                PLISTBOXDATA pData, int width)
+{
+    PLISTBOXITEM plbi;
+    int i;
+    int x = 0, y = 0;
+    int offset;
+    RECT rc;
+    COLORREF bk;
+
+    plbi = lstGetItem (pData, pData->itemTop);
+    
+    for (i = 0; plbi && i < (pData->itemVisibles + 1); i++) {
+
+        if (plbi->dwFlags & LBIF_SELECTED) {
+            SetBkColor (hdc, bk = BLUE);
+            SetTextColor (hdc, WHITE);
+        }
+        else {
+            SetBkColor (hdc, bk = WHITE);
+            SetTextColor (hdc, BLACK);
+        }
+	rc.left = 0;
+	rc.top = y;
+	rc.right = width;
+	rc.bottom = y + pData->itemHeight;
+	FastFillRect(hdc, &rc, bk);
+
+        if (dwStyle & LBS_CHECKBOX) {
+            x = LST_INTER_BMPTEXT;
+            if (plbi->dwFlags & LBIF_CHECKED)
+                offset = 0;
+            else if (plbi->dwFlags & LBIF_PARTCHECKED)
+                offset = LST_WIDTH_CHECKMARK << 1;
+            else
+                offset = LST_WIDTH_CHECKMARK;
+#if 0//fix: no bitmap            
+            FillBoxWithBitmapPart (hdc, 
+                x, y + ((pData->itemHeight - LST_HEIGHT_CHECKMARK)>>1),
+                LST_WIDTH_CHECKMARK, LST_HEIGHT_CHECKMARK,
+                0, 0,
+                &sg_bmpCheckMark,
+                offset, 0);
+#endif
+            x += LST_WIDTH_CHECKMARK + LST_INTER_BMPTEXT;
+        }
+#if 0//fix: no icon
+        if (dwStyle & LBS_USEICON && plbi->dwData) {
+            DrawIcon (hdc, 
+                x, y, pData->itemHeight, pData->itemHeight, 
+                (HICON) plbi->dwData);
+            x += pData->itemHeight + LST_INTER_BMPTEXT;
+        }
+#endif
+        SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
+        TextOut (hdc, x+2, y, plbi->key,-1);
+
+        y += pData->itemHeight;
+        plbi = plbi->next;
+    }
+}
+
+static int lstSelectItem (DWORD dwStyle, PLISTBOXDATA pData, int newSel)
+{
+    PLISTBOXITEM plbi, newItem;
+    int index;
+    
+    newItem = lstGetItem (pData, newSel);
+    if (!newItem) return -1;
+    
+#ifdef _DEBUG
+    if (!newItem)
+        fprintf (stderr, "ASSERT failed: return value of lstGetItem"
+                         " in lstSelectItem.\n");
+#endif
+
+    if (dwStyle & LBS_MULTIPLESEL) {
+        newItem->dwFlags ^= LBIF_SELECTED;
+        return newSel;
+    }
+
+    index = 0;
+    plbi = pData->head;
+    while (plbi) {
+        if (plbi->dwFlags & LBIF_SELECTED) {
+            if (index != newSel) {
+                plbi->dwFlags &= ~LBIF_SELECTED;
+                newItem->dwFlags |= LBIF_SELECTED;
+                return index;
+            }
+            break;
+        }
+
+        plbi = plbi->next;
+        index ++;
+    }
+
+    newItem->dwFlags |= LBIF_SELECTED;
+    return -1;
+}
+
+static void lstDrawFocusRect (HDC hdc, PLISTBOXDATA pData, RECT* rc)
+{
+    HGDIOBJ oldbrush,oldpen;
+
+    if (pData->itemHilighted < pData->itemTop
+            || pData->itemHilighted > (pData->itemTop + pData->itemVisibles))
+        return;
+
+    if (pData->dwFlags & LBF_FOCUS) {
+        lstGetItemsRect (pData, pData->itemHilighted, pData->itemHilighted, rc);
+        //InflateRect (rc, -1, -1);
+#if 0
+        FocusRect (hdc, rc->left - 1, rc->top, rc->right, rc->bottom);
+#else
+	oldbrush=SelectObject(hdc, GetStockObject(NULL_BRUSH));
+	oldpen=SelectObject(hdc, CreatePen(PS_SOLID, 1,
+				GetSysColor(COLOR_BTNHIGHLIGHT)));
+	//GdSetMode(MWMODE_XOR);
+        Rectangle (hdc, rc->left, rc->top, rc->right, rc->bottom);
+	//GdSetMode(MWMODE_SET);
+	SelectObject(hdc,oldbrush);
+	DeleteObject(SelectObject(hdc,oldpen));
+#endif
+    }
+}
+
+static void lstCalcParams (const RECT* rcClient, PLISTBOXDATA pData)
+{
+#define RECTHP(prc)  (prc->bottom - prc->top)
+    pData->itemVisibles = (RECTHP (rcClient)) / pData->itemHeight;
+}
+
+static void lstSetVScrollInfo (HWND hwnd, PLISTBOXDATA pData, BOOL fRedraw)//fix: no scrollbar
+{
+#if 0
+    SCROLLINFO si;
+
+    if (pData->itemVisibles >= pData->itemCount) {
+        SetScrollPos (hwnd, SB_VERT, 0);
+        EnableScrollBar (hwnd, SB_VERT, FALSE);
+        return;
+    }
+    
+    si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
+    si.nMax = pData->itemCount - 1;
+    si.nMin = 0;
+    si.nPage = min (pData->itemVisibles, (pData->itemCount - pData->itemTop));
+    si.nPos = pData->itemTop;
+    SetScrollInfo (hwnd, SB_VERT, &si, fRedraw);
+    EnableScrollBar (hwnd, SB_VERT, TRUE);
+#endif
+}
+
+static LRESULT CALLBACK
+ListboxCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    HDC             hdc;
+    HWND	    pCtrl;
+    PLISTBOXDATA    pData;
+    DWORD           dwStyle;
+    
+    pCtrl   = hwnd;
+    dwStyle = pCtrl->style;
+
+    switch (message)
+    {
+        case WM_CREATE:
+            pData = (LISTBOXDATA*) malloc (sizeof(LISTBOXDATA));
+            if (pData == NULL) 
+                return -1;
+
+            pCtrl->userdata = (DWORD)pData;
+            if (!lstInitListBoxData (hwnd, pData, DEF_LB_BUFFER_LEN)) {
+                free (pData);
+                return -1;
+            }
+        break;
+
+	case WM_SIZE:
+	{
+	    RECT rc;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+	    GetClientRect(hwnd, &rc);
+            lstCalcParams (&rc, pData);
+	}
+        break;
+
+        case WM_DESTROY:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            lstListBoxCleanUp (pData);
+            free (pData);
+        break;
+
+        case LB_RESETCONTENT:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            lstResetListBoxContent (pData);
+            InvalidateRect (hwnd, NULL, TRUE);
+        break;
+        
+        case LB_ADDSTRING:
+        case LB_INSERTSTRING:
+        {
+            char* string = NULL;
+            PLISTBOXITEMINFO plbii = NULL;
+            PLISTBOXITEM newItem;
+            int pos;
+           
+            if (dwStyle & LBS_CHECKBOX || dwStyle & LBS_USEICON) {
+                plbii = (PLISTBOXITEMINFO)lParam;
+                if (!plbii)
+                    return LB_ERR;
+
+                string = plbii->string;
+            }
+            else {
+                string = (char*)lParam;
+                if (string == NULL || string [0] == '\0')
+                    return LB_ERR;
+            }
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            newItem = lstAllocItem (pData);
+            if (!newItem) {
+                NotifyParent (hwnd, pCtrl->id, LBN_ERRSPACE);
+                return LB_ERRSPACE;
+            }
+
+            newItem->key = FixStrAlloc (strlen (string));
+            strcpy (newItem->key, string);
+            newItem->dwFlags = LBIF_NORMAL;
+            if (plbii) {
+                switch (plbii->cmFlag) {
+                    case CMFLAG_CHECKED:
+                        newItem->dwFlags |= LBIF_CHECKED;
+                    break;
+                    case CMFLAG_PARTCHECKED:
+                        newItem->dwFlags |= LBIF_PARTCHECKED;
+                    break;
+                }
+                
+                if (dwStyle & LBS_USEICON)
+                    newItem->dwData = (DWORD)plbii->hIcon;
+                else
+                    newItem->dwData = 0L;
+            }
+            newItem->dwAddData = 0L;
+
+            if (message == LB_ADDSTRING)
+                pos = lstAddNewItem (dwStyle, pData, newItem, -1);
+            else
+                pos = lstAddNewItem (dwStyle, pData, newItem, (int)wParam);
+
+            lstInvalidateUnderItem (hwnd, pData, pos);
+
+            lstSetVScrollInfo (hwnd, pData, TRUE);
+
+            return pos;
+        }
+        break;
+        
+        case LB_DELETESTRING:
+        {
+            PLISTBOXITEM removed;
+            int delete;
+
+            delete = (int)wParam;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            removed = lstRemoveItem (pData, &delete);
+            if (removed) {
+                FreeFixStr (removed->key);
+                lstFreeItem (pData, removed);
+                
+                pData->itemCount --;
+
+                if (pData->itemTop != 0 
+                        && pData->itemCount <= pData->itemVisibles) {
+                    pData->itemTop = 0;
+                    InvalidateRect (hwnd, NULL, TRUE);
+                }
+                else {
+                    lstInvalidateUnderItem (hwnd, pData, delete);
+                    if (delete <= pData->itemTop) {
+                        pData->itemTop --;
+                        if (pData->itemTop < 0)
+                            pData->itemTop = 0;
+                    }
+                }
+
+                if (pData->itemHilighted >= pData->itemCount) {
+                    pData->itemHilighted = pData->itemCount - 1;
+                    if (pData->itemHilighted < 0)
+                        pData->itemHilighted = 0;
+                }
+
+                if (pData->itemHilighted < pData->itemTop)
+                    pData->itemHilighted = pData->itemTop;
+                if (pData->itemHilighted > ITEM_BOTTOM (pData))
+                    pData->itemHilighted = ITEM_BOTTOM (pData);
+             
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+            }
+        }
+        break;
+
+        case LB_FINDSTRING:
+            if( *(char*)lParam == '\0' )
+                return LB_ERR;
+                
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return lstFindItem(pData, (int)wParam, (char*)lParam, FALSE);
+
+        case LB_FINDSTRINGEXACT:
+            if( *(char*)lParam == '\0' )
+                return LB_ERR;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return lstFindItem(pData, (int)wParam, (char*)lParam, TRUE);
+    
+        case LB_SETTOPINDEX:
+        {
+            int newTop = (int) wParam;
+            
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+            if (newTop <0)
+                newTop = 0;
+            else if (newTop > pData->itemCount - pData->itemVisibles)
+                newTop = pData->itemCount - pData->itemVisibles;
+                
+            if (pData->itemTop != newTop) {
+                pData->itemTop = newTop;
+
+                if (pData->itemHilighted < pData->itemTop)
+                    pData->itemHilighted = pData->itemTop;
+                if (pData->itemHilighted > ITEM_BOTTOM (pData))
+                    pData->itemHilighted = ITEM_BOTTOM (pData);
+
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+
+                InvalidateRect (hwnd, NULL, TRUE);
+            }
+        }
+        break;
+    
+        case LB_SETCURSEL:
+        case LB_SETCARETINDEX:
+        {
+            int new = (int)wParam;
+            int old, newTop;
+            
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (new < 0 || new > pData->itemCount - 1)
+                return LB_ERR;
+
+            old = pData->itemHilighted;
+            if (new >= 0 && new != old) {
+                if (pData->itemCount - new >= pData->itemVisibles)
+                    newTop = new;
+                else
+                    newTop = max (pData->itemCount - pData->itemVisibles, 0);
+
+                pData->itemTop = newTop;
+                pData->itemHilighted = new;
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+            }
+
+            if (!(dwStyle & LBS_MULTIPLESEL))
+                lstSelectItem (dwStyle, pData, new);
+            InvalidateRect (hwnd, NULL, TRUE);
+
+            return old;
+        }
+        break;
+    
+        case LB_GETCOUNT:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return pData->itemCount;
+        break;
+    
+        case LB_GETCURSEL:
+        {
+            PLISTBOXITEM plbi;
+            int index = 0;
+            
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (dwStyle & LBS_MULTIPLESEL)
+                return pData->itemHilighted;
+
+            plbi = pData->head;
+            while (plbi) {
+                if (plbi->dwFlags & LBIF_SELECTED)
+                    return index;
+
+                index ++;
+                plbi = plbi->next;
+           }
+           
+           return LB_ERR;
+        }
+        break;
+    
+        case LB_GETSELCOUNT:
+        {
+            int nSel;
+            PLISTBOXITEM plbi;
+            
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+            nSel = 0;
+            plbi = pData->head;
+            while (plbi) {
+                if (plbi->dwFlags & LBIF_SELECTED)
+                    nSel ++;
+                plbi = plbi->next;
+            }
+            
+            return nSel;
+        }
+        break;
+    
+        case LB_GETTOPINDEX:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return pData->itemTop;
+        break;
+    
+        case LB_GETCARETINDEX:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return pData->itemHilighted;
+        break;
+
+        case LB_GETTEXTLEN:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = lstGetItem (pData, (int)wParam);
+            if (plbi)
+                return strlen (plbi->key);
+            else
+                return LB_ERR;
+        }
+        break;
+        
+        case LB_GETTEXT:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = lstGetItem (pData, (int)wParam);
+            if (plbi)
+                strcpy ((char*)lParam, plbi->key);
+            else
+                return LB_ERR;
+        }
+        break;
+
+        case LB_SETTEXT:
+        {
+            PLISTBOXITEM plbi;
+            char* newStr;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = lstGetItem (pData, (int)wParam);
+            if (plbi) {
+                newStr = FixStrAlloc (strlen ((char*)lParam));
+                if (newStr) {
+                    FreeFixStr (plbi->key);
+                    plbi->key = newStr;
+                    strcpy (plbi->key, (char*)lParam);
+                    lstInvalidateItem (hwnd, pData, (int)wParam, TRUE);
+                }
+                else
+                    return LB_ERR;
+            }
+            else
+                return LB_ERR;
+        }
+        break;
+    
+        case LB_GETITEMDATA:
+        {
+            PLISTBOXITEM plbi;
+            PLISTBOXITEMINFO plbii;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            if (!(dwStyle & LBS_CHECKBOX || dwStyle & LBS_USEICON)) {
+                return plbi->dwData;
+            }
+            
+            plbii = (PLISTBOXITEMINFO)lParam;
+            if (!plbii)
+                return LB_ERR;
+
+            if (plbi->dwFlags & LBIF_CHECKED)
+                plbii->cmFlag = CMFLAG_CHECKED;
+            else if (plbi->dwFlags & LBIF_PARTCHECKED)
+                plbii->cmFlag = CMFLAG_PARTCHECKED;
+            else
+                plbii->cmFlag = CMFLAG_BLANK;
+            plbii->hIcon = (HICON)plbi->dwData;
+
+            return LB_OKAY;
+        }
+        break;
+    
+        case LB_SETITEMDATA:
+        {
+            PLISTBOXITEM plbi;
+            PLISTBOXITEMINFO plbii;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            if (!(dwStyle & LBS_CHECKBOX || dwStyle & LBS_USEICON)) {
+                plbi->dwData = (DWORD)lParam;
+                return LB_OKAY;
+            }
+
+            plbii = (PLISTBOXITEMINFO)lParam;
+            if (!plbii)
+                return LB_ERR;
+
+            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+            switch (plbii->cmFlag) {
+                case CMFLAG_CHECKED:
+                    plbi->dwFlags |= LBIF_CHECKED;
+                break;
+                case CMFLAG_PARTCHECKED:
+                    plbi->dwFlags |= LBIF_PARTCHECKED;
+                break;
+            }
+                
+            if (dwStyle & LBS_USEICON)
+                plbi->dwData = (DWORD)plbii->hIcon;
+            else
+                plbi->dwData = 0;
+            
+            lstInvalidateItem (hwnd, pData, (int)wParam, TRUE);
+
+            return LB_OKAY;
+        }
+        break;
+        
+        case LB_GETITEMADDDATA:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            return plbi->dwAddData;
+        }
+        break;
+    
+        case LB_SETITEMADDDATA:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            plbi->dwAddData = (DWORD)lParam;
+
+            return LB_OKAY;
+        }
+        break;
+        
+        case LB_GETCHECKMARK:
+        {
+            PLISTBOXITEM plbi;
+
+            if (!(dwStyle & LBS_CHECKBOX))
+                return LB_ERR;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            if (plbi->dwFlags & LBIF_CHECKED)
+                return CMFLAG_CHECKED;
+
+            if (plbi->dwFlags & LBIF_PARTCHECKED)
+                return CMFLAG_PARTCHECKED;
+
+            return CMFLAG_BLANK;
+        }
+        break;
+
+        case LB_SETCHECKMARK:
+        {
+            PLISTBOXITEM plbi;
+
+            if (!(dwStyle & LBS_CHECKBOX))
+                return LB_ERR;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+            switch (lParam) {
+                case CMFLAG_CHECKED:
+                    plbi->dwFlags |= LBIF_CHECKED;
+                break;
+                case CMFLAG_PARTCHECKED:
+                    plbi->dwFlags |= LBIF_PARTCHECKED;
+                break;
+            }
+                
+            lstInvalidateItem (hwnd, pData, (int)wParam, TRUE);
+
+            return LB_OKAY;
+        }
+        break;
+
+        case LB_GETSELITEMS:
+        {
+            int  nItem;
+            int  nSel = 0;
+            int  index = 0;
+            int* pInt;
+            PLISTBOXITEM plbi;
+
+            nItem = (int)wParam;
+            pInt  = (int*)lParam;
+            
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = pData->head;
+            while (plbi) {
+
+                if (plbi->dwFlags & LBIF_SELECTED) {
+                    if (pInt) {
+                        if (nSel < nItem)
+                            *(pInt + nSel) = index;
+                        else 
+                            return nItem;
+                    }
+                    nSel ++;
+                }
+                
+                plbi = plbi->next;
+                index ++;
+            }
+            
+            return nSel;
+        }
+        break;
+    
+        case LB_GETSEL:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = lstGetItem (pData, (int)wParam);
+            if (plbi)
+                return plbi->dwFlags & LBIF_SELECTED;
+            else
+                return LB_ERR;
+        }
+        break;
+
+        case LB_SETSEL:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = lstGetItem (pData, (int)lParam);
+            if (plbi) {
+		pData->dwFlags &= ~LBF_NOTHINGSELECTED;
+                if (wParam == -1)
+                    plbi->dwFlags ^= LBIF_SELECTED;
+                else if (wParam == 0)
+                    plbi->dwFlags &= ~LBIF_SELECTED;
+                else
+                    plbi->dwFlags |= LBIF_SELECTED;
+
+                lstInvalidateItem (hwnd, pData, (int)lParam, FALSE);
+            }
+            else
+                return LB_ERR;
+        }
+        break;
+    
+        case LB_GETITEMHEIGHT:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return pData->itemHeight;
+        break;
+    
+        case LB_SETITEMHEIGHT:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (pData->itemHeight != LOWORD (lParam)) {
+                RECT rcClient;
+                
+                pData->itemHeight = LOWORD (lParam);
+                GetClientRect (hwnd, &rcClient);
+                lstCalcParams (&rcClient, pData);
+                
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+                InvalidateRect (hwnd, NULL, TRUE);
+            }
+        break;
+
+        case WM_SETFOCUS:
+        {
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+            if (pData->dwFlags & LBF_FOCUS)
+                break;
+                
+            pData->dwFlags |= LBF_FOCUS;
+	    InvalidateRect(hwnd, NULL, TRUE);
+
+            NotifyParent (hwnd, pCtrl->id, LBN_SETFOCUS);
+        }
+        break;
+        
+        case WM_KILLFOCUS:
+        {
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+            pData->dwFlags &= ~LBF_FOCUS;
+	    InvalidateRect(hwnd, NULL, TRUE);
+
+            NotifyParent (hwnd, pCtrl->id, LBN_KILLFOCUS);
+        }
+        break;
+
+        case WM_GETDLGCODE:
+            return DLGC_WANTARROWS | DLGC_WANTCHARS;
+
+        case WM_GETTEXTLENGTH:
+        case WM_GETTEXT:
+        case WM_SETTEXT:
+            return -1;
+#if 0            
+	case WM_SETFONT:
+        break;
+        
+	case WM_GETFONT:
+        break;
+#endif        
+	case WM_NCCALCSIZE:
+	{
+		LPNCCALCSIZE_PARAMS lpnc;
+
+		/* calculate client rect from passed window rect in rgrc[0]*/
+		lpnc = (LPNCCALCSIZE_PARAMS)lParam;
+		if(GetWindowLong(hwnd, GWL_STYLE) & WS_BORDER)
+			InflateRect(&lpnc->rgrc[0], -2, -2);
+	}
+		break;
+
+        case WM_NCPAINT:
+	{
+	    RECT rc;
+
+            hdc = wParam? (HDC)wParam: GetWindowDC (hwnd);
+	    GetWindowRect(hwnd, &rc);
+
+            if (dwStyle & WS_BORDER)
+		Draw3dInset(hdc, rc.left, rc.top,
+			rc.right-rc.left, rc.bottom-rc.top);
+
+            if (!wParam)
+                ReleaseDC (hwnd, hdc);
+	}
+            break;
+
+        case WM_PAINT:
+        {
+            RECT rc;
+	    PAINTSTRUCT ps;
+            
+            hdc = BeginPaint (hwnd,&ps);
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+	    /*
+	     * If this is the first paint and there's nothing
+	     * selected, then auto select the topmost displayed item.
+	     */
+	    if (pData->dwFlags & LBF_NOTHINGSELECTED) {
+		    lstSelectItem (hwnd->style, pData, pData->itemTop);
+		    pData->dwFlags &= ~LBF_NOTHINGSELECTED;
+	    }
+            GetClientRect (hwnd, &rc);
+            lstOnDrawSListBoxItems (hdc, dwStyle, pData, rc.right-rc.left);
+            lstDrawFocusRect (hdc, pData, &rc);
+
+            EndPaint (hwnd, &ps);
+        }
+        break;
+    
+        case WM_LBUTTONDBLCLK:
+            if (dwStyle & LBS_NOTIFY)
+                NotifyParent (hwnd, pCtrl->id, LBN_DBLCLK);
+        break;
+    
+        case WM_LBUTTONDOWN:
+        {
+            int oldSel, mouseX, mouseY, hit;
+            RECT rcInv;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (pData->itemCount == 0)
+                break;
+
+            mouseX = LOWORD (lParam);
+            mouseY = HIWORD (lParam);
+            hit = mouseY / pData->itemHeight;
+            hit += pData->itemTop;
+            
+            if (hit >= pData->itemCount)
+                break;
+
+            GetClientRect (hwnd, &rcInv);
+            oldSel = lstSelectItem (dwStyle, pData, hit);
+            if ((dwStyle & LBS_NOTIFY) && (oldSel != hit))
+                NotifyParent (hwnd, pCtrl->id, LBN_SELCHANGE);
+            if (oldSel >= 0) {
+                if (oldSel >= pData->itemTop 
+                        && (oldSel <= pData->itemTop + pData->itemVisibles)) {
+                    lstGetItemsRect (pData, oldSel, oldSel, &rcInv);
+                    InvalidateRect (hwnd, &rcInv, TRUE);
+                }
+            }
+
+            lstGetItemsRect (pData, hit, hit, &rcInv);
+            InvalidateRect (hwnd, &rcInv, TRUE);
+
+            if (pData->itemHilighted != hit) {
+#if 0
+                hdc = GetClientDC (hwnd);
+#else
+                hdc = GetDC(hwnd);
+#endif
+                lstDrawFocusRect (hdc, pData, &rcInv);
+                ReleaseDC (hwnd,hdc);
+            }
+            pData->itemHilighted = hit;
+
+            if (dwStyle & LBS_CHECKBOX) {
+                if (mouseX > 0 && mouseX < LST_WIDTH_CHECKMARK) {
+                    NotifyParent (hwnd, pCtrl->id, LBN_CLICKCHECKMARK);//?
+                    
+                    if (dwStyle & LBS_AUTOCHECK) {
+                        PLISTBOXITEM plbi;
+
+                        plbi = lstGetItem (pData, hit);
+
+                        switch (plbi->dwFlags & LBIF_CHECKMARKMASK) {
+                        case LBIF_CHECKED:
+                            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+                            break;
+                        default:
+                            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+                            plbi->dwFlags |= LBIF_CHECKED;
+                            break;
+                        }
+                
+                        lstInvalidateItem (hwnd, pData, hit, TRUE);
+                    }
+                }
+            }
+            
+            lstSetVScrollInfo (hwnd, pData, TRUE);
+        }
+        break;
+    
+        case WM_LBUTTONUP:
+        break;
+    
+        case WM_MOUSEMOVE:
+        break;
+#if 0
+//:     case WM_KEYDOWN:
+        {
+            int oldSel, newSel, newTop;
+            RECT rcInv;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            newTop = pData->itemTop;
+            newSel = pData->itemHilighted;
+            switch (LOWORD (wParam))
+            {
+                case SCANCODE_HOME:
+                    newSel = 0;
+                    newTop = 0;
+                break;
+                
+                case SCANCODE_END:
+                    newSel = pData->itemCount - 1;
+                    if (pData->itemCount > pData->itemVisibles)
+                        newTop = pData->itemCount - pData->itemVisibles;
+                    else
+                        newTop = 0;
+                break;
+                
+                case SCANCODE_CURSORBLOCKDOWN:
+                    newSel ++;
+                    if (newSel >= pData->itemCount)
+                        return 0;
+                    if (newSel > ITEM_BOTTOM (pData))
+                        newTop ++;
+                break;
+                
+                case SCANCODE_CURSORBLOCKUP:
+                    newSel --;
+                    if (newSel < 0)
+                        return 0;
+                    if (newSel < pData->itemTop)
+                        newTop --;
+                break;
+                
+                case SCANCODE_PAGEDOWN:
+                    newSel += pData->itemVisibles;
+                    if (newSel >= pData->itemCount)
+                        newSel = pData->itemCount - 1;
+                        
+                    if (pData->itemCount - newSel >= pData->itemVisibles)
+                        newTop = newSel;
+                    else
+                        newTop = max (pData->itemCount-pData->itemVisibles, 0);
+                break;
+
+                case SCANCODE_PAGEUP:
+                    newSel -= pData->itemVisibles;
+                    if (newSel < 0)
+                        newSel = 0;
+                        
+                    newTop -= pData->itemVisibles;
+                    if (newTop < 0)
+                        newTop = 0;
+                break;
+                
+                default:
+                return 0;
+            }
+
+            GetClientRect (hwnd, &rcInv);
+            if (pData->itemHilighted != newSel) {
+                if (pData->itemTop != newTop) {
+                    pData->itemTop = newTop;
+                    pData->itemHilighted = newSel;
+                    if (!(dwStyle & LBS_MULTIPLESEL)) {
+                        oldSel = lstSelectItem (dwStyle, pData, newSel);
+                        if ((dwStyle & LBS_NOTIFY) && (oldSel != newSel))
+                            NotifyParent (hwnd, pCtrl->id, LBN_SELCHANGE);
+                    }
+                    InvalidateRect (hwnd, NULL, TRUE);
+                }
+                else {
+                    if (!(dwStyle & LBS_MULTIPLESEL)) {
+                        oldSel = lstSelectItem (dwStyle, pData, newSel);
+                        if ((dwStyle & LBS_NOTIFY) && (oldSel != newSel))
+                            NotifyParent (hwnd, pCtrl->id, LBN_SELCHANGE);
+                        if (oldSel >= 0) {
+                            if (oldSel >= pData->itemTop 
+                                    && oldSel <= (ITEM_BOTTOM (pData) + 1)) {
+                                lstGetItemsRect (pData, oldSel, oldSel, &rcInv);
+                                InvalidateRect (hwnd, &rcInv, TRUE);
+                            }
+                        }
+                        
+                        if (newSel < newTop) {
+                            pData->itemHilighted = newSel;
+                            break;
+                        }
+                            
+                        lstGetItemsRect (pData, pData->itemHilighted,
+                                                pData->itemHilighted, &rcInv);
+#if 0
+                	hdc = GetClientDC (hwnd);
+#else
+                	hdc = GetDC(hwnd);
+#endif
+                        lstDrawFocusRect (hdc, pData, &rcInv);
+                        ReleaseDC (hwnd,hdc);
+                        
+                        pData->itemHilighted = newSel;
+                        lstGetItemsRect (pData, newSel, newSel, &rcInv);
+                        InvalidateRect (hwnd, &rcInv, TRUE);
+                    }
+                    else {
+#if 0
+                	hdc = GetClientDC (hwnd);
+#else
+                	hdc = GetDC(hwnd);
+#endif
+                        lstDrawFocusRect (hdc, pData, &rcInv);
+                        pData->itemHilighted = newSel;
+                        GetClientRect (hwnd, &rcInv);
+                        lstDrawFocusRect (hdc, pData, &rcInv);
+                        ReleaseDC (hwnd,hdc);
+                    }
+                }
+                lstSetVScrollInfo (hwnd, pData, TRUE);//
+            }
+        }
+        break;
+
+//:     case WM_CHAR:
+        {
+            char head [2];
+            int index;
+            int newTop;
+            
+            if (HIBYTE (wParam))
+                break;
+           
+            head [0] = LOBYTE (wParam);
+            head [1] = '\0';
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+            if (head[0] == ' ') {
+                if (dwStyle & LBS_MULTIPLESEL) {
+                    RECT rcInv;
+                    
+                    GetClientRect (hwnd, &rcInv);
+                    lstSelectItem (dwStyle, pData, pData->itemHilighted);
+                    lstGetItemsRect (pData, 
+                            pData->itemHilighted, 
+                            pData->itemHilighted,
+                            &rcInv);
+                    InvalidateRect (hwnd, &rcInv, TRUE);
+                }
+                else if (dwStyle & LBS_CHECKBOX) {
+                    NotifyParent (hwnd, pCtrl->id, LBN_CLICKCHECKMARK);
+                    
+                    if (dwStyle & LBS_AUTOCHECK) {
+                        PLISTBOXITEM plbi;
+
+                        plbi = lstGetItem (pData, pData->itemHilighted);
+
+                        switch (plbi->dwFlags & LBIF_CHECKMARKMASK) {
+                        case LBIF_CHECKED:
+                            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+                            break;
+                        default:
+                            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+                            plbi->dwFlags |= LBIF_CHECKED;
+                            break;
+                        }
+                
+                        lstInvalidateItem (hwnd, pData, 
+                                pData->itemHilighted, TRUE);
+                    }
+                }
+                break;
+            }
+
+            index = lstFindItem (pData, pData->itemHilighted + 1, head, FALSE);
+            if (index < 0) {
+                index = lstFindItem (pData, 0, head, FALSE);
+            }
+
+            if (index >= 0) {
+                if (pData->itemCount - index >= pData->itemVisibles)
+                    newTop = index;
+                else
+                    newTop = max (pData->itemCount - pData->itemVisibles, 0);
+
+                pData->itemTop = newTop;
+                pData->itemHilighted = index;
+                if (!(dwStyle & LBS_MULTIPLESEL))
+                    lstSelectItem (dwStyle, pData, index);
+                InvalidateRect (hwnd, NULL, TRUE);
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+            }
+        }
+        break;
+#endif 
+#if 0
+//:     case WM_VSCROLL:
+        {
+            int newTop;
+            int scrollHeight = 0;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            newTop = pData->itemTop;
+            switch(wParam)
+            {
+                case SB_LINEDOWN:
+                    if (ITEM_BOTTOM (pData) < (pData->itemCount - 1)) {
+                        newTop ++;
+                        scrollHeight = -pData->itemHeight;
+                    }
+                break;
+                
+                case SB_LINEUP:
+                    if (pData->itemTop > 0) {
+                        newTop --;
+                        scrollHeight = pData->itemHeight;
+                    }
+                break;
+                
+                case SB_PAGEDOWN:
+                    if ((pData->itemTop + (pData->itemVisibles << 1)) <=
+                            pData->itemCount)
+                        newTop += pData->itemVisibles;
+                    else
+                        newTop = pData->itemCount - pData->itemVisibles;
+
+                    if (newTop < 0)
+                        return 0;
+
+                    scrollHeight = -(newTop - pData->itemTop)
+                                    *pData->itemHeight;
+                break;
+
+                case SB_PAGEUP:
+                    if (pData->itemTop >= pData->itemVisibles)
+                        newTop -= pData->itemVisibles;
+                    else
+                        newTop = 0;
+
+                    scrollHeight = (pData->itemTop - newTop)*pData->itemHeight;
+                break;
+
+                case SB_THUMBTRACK:
+                    newTop = (int)lParam;
+                    scrollHeight = (pData->itemTop - newTop)*pData->itemHeight;
+                break;
+            }
+            
+            if (scrollHeight) {
+                pData->itemTop = newTop;
+                ScrollWindow (hwnd, 0, scrollHeight, NULL, NULL);
+                SendMessage (hwnd, MSG_PAINT, 0, 0);
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+                return 0;
+            }
+        }
+        break;
+
+//:     case WM_HSCROLL:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            switch (wParam)
+            {
+                case SB_LINERIGHT:
+                break;
+                
+                case SB_LINELEFT:
+                break;
+                
+                case SB_PAGELEFT:
+                break;
+                
+                case SB_PAGERIGHT:
+                break;
+            }
+        break;
+#endif
+        default:
+    		return DefWindowProc (hwnd, message, wParam, lParam);
+    }
+    return 0;
+}
diff -urN lib/microwindows/src/mwin/winlib/listbox.1 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/listbox.1
--- lib/microwindows/src/mwin/winlib/listbox.1	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/listbox.1	2005-02-21 16:13:27.000000000 +0100
@@ -0,0 +1,1663 @@
+/*
+ * Copyright (C) 1999, 2000, Wei Yongming.
+ * Portions Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Listbox for Microwindows win32 api.
+ */
+
+/*
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Library General Public
+**  License as published by the Free Software Foundation; either
+**  version 2 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Library General Public License for more details.
+**
+**  You should have received a copy of the GNU Library General Public
+**  License along with this library; if not, write to the Free
+**  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+**  MA 02111-1307, USA
+*/
+
+/*
+**  Alternatively, the contents of this file may be used under the terms 
+**  of the Mozilla Public License (the "MPL License") in which case the
+**  provisions of the MPL License are applicable instead of those above.
+*/
+
+// Note:
+//  Although there was a version by Zhao Jianghua, this version of
+//  LISTBOX control is written by Wei Yongming from scratch.
+//
+// Modify records:
+//
+//  Who             When        Where       For What                Status
+//-----------------------------------------------------------------------------
+//  Wei Yongming    1999/10/18  Tsinghua    Item Additional Data    Finished
+//  Wei Yongming    1999/10/31  Tsinghua    Space bar for checkmark Finished
+//  Wei Yongming    1999/10/31  Tsinghua    Character match item    Finished
+//  Wei Yongming    1999/11/07  Tsinghua    Character match item    Bug fixing
+//  WEI Yongming    2000/01/20  Tsinghua    Thumb dragging          Finished
+//  WEI Yongming    2000/02/24  Tsinghua    Add MPL License         Finished
+//  Kevin Tseng     2000/05/26  gv          port to microwin        ported
+//  Greg Haerr      2000/06/15  Utah        3d look, bug fixes      Finished
+//  Kevin Tseng     2000/06/22  gv          port to mw-nanox        ported
+//  Kevin Tseng     2000/06/22  gv          fixed bug if no item    Finished
+//  Kevin Tseng     2000/08/08  gv          enable scrollbar        porting
+//
+// TODO:
+// 1. Multiple columns support.
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define MWINCLUDECOLORS
+#include "windows.h"
+#include "wintools.h" 	/* Draw3dBox */
+#include "device.h" 	/* GdGetTextSize */
+
+#define DEFAULT_FONT	DEFAULT_GUI_FONT
+//#define DEFAULT_FONT	SYSTEM_FIXED_FONT
+
+#define FixStrAlloc(n)	malloc((n)+1)
+#define FreeFixStr(p)	free(p)
+
+#define LBIF_NORMAL         0x0000L
+#define LBIF_SELECTED       0x0001L
+#define LBIF_CHECKED        0x0010L
+#define LBIF_PARTCHECKED    0x0020L
+#define LBIF_CHECKMARKMASK  0x00F0L
+
+#define CMFLAG_BLANK        0
+#define CMFLAG_CHECKED      1
+#define CMFLAG_PARTCHECKED  2
+typedef struct _LISTBOXITEMINFO {
+    int     insPos;         // insert position
+    char*   string;         // item string
+    int     cmFlag;         // check mark flag
+    HICON   hIcon;          // handle of icon
+} LISTBOXITEMINFO, *PLISTBOXITEMINFO;
+
+typedef struct _LISTBOXITEM {
+    char*   key;                // item sort key
+    DWORD   dwFlags;            // item flags
+    DWORD   dwData;             // item data
+    DWORD   dwAddData;          // item additional data
+    struct  _LISTBOXITEM* next;  // next item
+} LISTBOXITEM, *PLISTBOXITEM;
+
+#define DEF_LB_BUFFER_LEN       5
+
+#define LBF_FOCUS               0x0001
+#define LBF_NOTHINGSELECTED	0x0002
+
+typedef struct _LISTBOXDATA {
+    DWORD dwFlags;          // listbox flags
+
+    int itemCount;          // items count
+    int itemTop;            // start display item
+    int itemVisibles;       // number of visible items
+
+    int itemHilighted;      // current hilighted item
+    int itemHeight;         // item height
+
+    LISTBOXITEM* head;      // items linked list head
+
+    int buffLen;            // buffer length
+    LISTBOXITEM* buffStart; // buffer start
+    LISTBOXITEM* buffEnd;   // buffer end
+    LISTBOXITEM* freeList;  // free list in buffer 
+} LISTBOXDATA, *PLISTBOXDATA;
+
+void ListboxControlCleanup ();
+static LRESULT CALLBACK
+ListboxCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+#define ITEM_BOTTOM(x)  (x->itemTop + x->itemVisibles - 1)
+
+#define LST_WIDTH_CHECKMARK     11
+#define LST_HEIGHT_CHECKMARK    11
+#define LST_INTER_BMPTEXT       2
+
+int WINAPI MwRegisterListboxControl(HINSTANCE hInstance)
+{
+	WNDCLASS	wc;
+#if 0
+    static BITMAP sg_bmpCheckMark;
+    if (!LoadSystemBitmap (&sg_bmpCheckMark, "checkmark")) {
+        fprintf (stderr, "Load ListBox Check Mark Bitmap failure!\n");
+        return FALSE;
+    }
+#endif
+	wc.style	= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
+	wc.lpfnWndProc	= (WNDPROC)ListboxCtrlProc;
+	wc.cbClsExtra	= 0;
+	wc.cbWndExtra	= 0;
+	wc.hInstance	= hInstance;
+	wc.hIcon	= NULL;
+	wc.hCursor	= 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground= GetStockObject(WHITE_BRUSH);
+	wc.lpszMenuName	= NULL;
+	wc.lpszClassName= "LISTBOX";
+
+	return RegisterClass(&wc);
+}
+
+void ListboxControlCleanup ()
+{
+#if 0
+    UnloadBitmap (&sg_bmpCheckMark);
+#endif
+}
+
+static LRESULT NotifyParent (HWND hwnd, int id, int code)
+{
+    return SendMessage (GetParent (hwnd), WM_COMMAND, 
+                 (WPARAM) MAKELONG (id, code), (LPARAM)hwnd);
+}
+
+static BOOL lstInitListBoxData (HWND hwnd,LISTBOXDATA* pData, int len)
+{
+    int i, xw, xh, xb;
+    PLISTBOXITEM plbi;
+    HDC hdc;
+    
+    memset (pData, 0, sizeof (LISTBOXDATA));
+#if 0
+//- pData->itemHeight = GetSysCharHeight ();
+#else
+    hdc=GetDC(hwnd);
+    SelectObject(hdc, GetStockObject(DEFAULT_FONT));
+    //GdSetFont(hdc->font->pfont);
+    GdGetTextSize(hdc->font->pfont,"X",1,
+		&xw,&xh,&xb,MWTF_ASCII);
+    ReleaseDC(hwnd,hdc);
+    pData->itemHeight=xh + 1; 
+#endif
+    pData->itemHilighted = 0;
+    pData->dwFlags = LBF_NOTHINGSELECTED;
+
+    // init item buffer.
+    if (!(pData->buffStart = malloc (len * sizeof (LISTBOXITEM))))
+        return FALSE;
+
+    pData->buffLen = len;
+    pData->buffEnd = pData->buffStart + len;
+    pData->freeList = pData->buffStart;
+
+    plbi = pData->freeList;
+    for (i = 0; i < len - 1; i++) {
+        plbi->next = plbi + 1;
+        plbi ++;
+    }
+    plbi->next = NULL;
+
+    return TRUE;
+}
+
+static void lstListBoxCleanUp (LISTBOXDATA* pData)
+{
+    PLISTBOXITEM plbi;
+    PLISTBOXITEM next;
+
+    plbi = pData->head;
+    while (plbi) {
+        FreeFixStr (plbi->key);
+        next = plbi->next;
+        if (plbi < pData->buffStart || plbi > pData->buffEnd)
+            free (plbi);
+
+        plbi = next;
+    }
+    
+    free (pData->buffStart);
+}
+
+static void lstResetListBoxContent (PLISTBOXDATA pData)
+{
+    int i;
+    PLISTBOXITEM plbi, next;
+
+    pData->itemCount = 0;
+    pData->itemTop = 0;
+    pData->itemHilighted = 0;
+//    pData->itemVisibles = 0;
+
+    plbi = pData->head;
+    while (plbi) {
+        FreeFixStr (plbi->key);
+        next = plbi->next;
+        if (plbi < pData->buffStart || plbi > pData->buffEnd)
+            free (plbi);
+
+        plbi = next;
+    }
+
+    pData->head = NULL;
+    pData->freeList = pData->buffStart;
+
+    plbi = pData->freeList;
+    for (i = 0; i < pData->buffLen - 1; i++) {
+        plbi->next = plbi + 1;
+        plbi ++;
+    }
+    plbi->next = NULL;
+}
+
+static PLISTBOXITEM lstAllocItem (PLISTBOXDATA pData)
+{
+    PLISTBOXITEM plbi;
+
+    if (pData->freeList) {
+        plbi = pData->freeList;
+        pData->freeList = plbi->next;
+    }
+    else
+        plbi = (PLISTBOXITEM) malloc (sizeof (LISTBOXITEM));
+    
+    return plbi;
+}
+
+static void lstFreeItem (PLISTBOXDATA pData, PLISTBOXITEM plbi)
+{
+    if (plbi < pData->buffStart || plbi > pData->buffEnd)
+        free (plbi);
+    else {
+        plbi->next = pData->freeList;
+        pData->freeList = plbi;
+    }
+}
+
+static int lstAddNewItem (DWORD dwStyle, 
+        PLISTBOXDATA pData, PLISTBOXITEM newItem, int pos)
+{
+    PLISTBOXITEM plbi;
+    PLISTBOXITEM insPosItem = NULL;
+    int insPos = 0;
+
+    newItem->next = NULL;
+    if (!pData->head)
+        insPosItem = NULL;
+    else if (dwStyle & LBS_SORT) {
+        plbi = pData->head;
+
+        if (strcmp (newItem->key, plbi->key) < 0) {
+            insPosItem = NULL;
+            insPos = 0;
+        }
+        else {
+            while (plbi->next) {
+                if (strcmp (newItem->key, plbi->next->key) <= 0)
+                    break;
+            
+                plbi = plbi->next;
+                insPos ++;
+            }
+            insPosItem = plbi;
+        }
+    }
+    else {
+        plbi = pData->head;
+
+        if (pos < 0) {
+            while (plbi->next) {
+                plbi = plbi->next;
+                insPos ++;
+            }
+            insPosItem = plbi;
+        }
+        else if (pos > 0) {
+            int index = 0;
+
+            while (plbi->next) {
+                if (pos == index)
+                    break;
+                plbi = plbi->next;
+                index ++;
+                insPos ++;
+            }
+            insPosItem = plbi;
+        }
+    }
+
+    if (insPosItem) {
+        plbi = insPosItem->next;
+        insPosItem->next = newItem;
+        newItem->next = plbi;
+
+        insPos ++;
+    }
+    else {
+        plbi = pData->head;
+        pData->head = newItem;
+        newItem->next = plbi;
+    }
+
+    pData->itemCount ++;
+    return insPos;
+}
+
+static PLISTBOXITEM lstRemoveItem (PLISTBOXDATA pData, int* pos)
+{
+    int index = 0;
+    PLISTBOXITEM plbi, prev;
+
+    if (!pData->head)
+        return NULL;
+
+    if (*pos < 0) {
+        prev = pData->head;
+        plbi = pData->head;
+        while (plbi->next) {
+            prev = plbi;
+            plbi = plbi->next;
+            index ++;
+        }
+
+        if (plbi == pData->head) {
+            pData->head = pData->head->next;
+            *pos = 0;
+            return plbi;
+        }
+        else {
+            prev->next = plbi->next;
+            *pos = index;
+            return plbi;
+        }
+    }
+    else if (*pos == 0) {
+        plbi = pData->head;
+        pData->head = plbi->next;
+        return plbi;
+    }
+    else {
+        index = 0;
+        prev = pData->head;
+        plbi = pData->head;
+        while (plbi->next) {
+            if (*pos == index)
+                break;
+
+            prev = plbi;
+            plbi = plbi->next;
+            index ++;
+        }
+
+        if (plbi == pData->head) {
+            pData->head = pData->head->next;
+            *pos = 0;
+            return plbi;
+        }
+        else {
+            prev->next = plbi->next;
+            *pos = index;
+            return plbi;
+        }
+    }
+
+    return NULL;
+}
+
+static void lstGetItemsRect (PLISTBOXDATA pData, int start, int end, RECT* prc)
+{
+    if (start < 0)
+        start = 0;
+
+    prc->top = (start - pData->itemTop)*pData->itemHeight;
+
+    if (end >= 0)
+        prc->bottom = (end - pData->itemTop + 1)*pData->itemHeight;
+
+}
+
+static void lstInvalidateItem (HWND hwnd, PLISTBOXDATA pData, int pos,BOOL fEBk)
+{
+    RECT rcInv;
+    
+    if (pos < pData->itemTop || pos > (pData->itemTop + pData->itemVisibles))
+        return;
+    
+    GetClientRect (hwnd, &rcInv);
+    rcInv.top = (pos - pData->itemTop)*pData->itemHeight;
+    rcInv.bottom = rcInv.top + pData->itemHeight;
+
+    InvalidateRect (hwnd, &rcInv, fEBk);
+}
+
+static BOOL lstInvalidateUnderItem (HWND hwnd, PLISTBOXDATA pData, int pos)
+{
+    RECT rcInv;
+    
+    if (pos > (pData->itemTop + pData->itemVisibles))
+        return FALSE;
+
+    if (pos <= pData->itemTop) {
+        InvalidateRect (hwnd, NULL, TRUE);
+        return TRUE;
+    }
+    
+    GetClientRect (hwnd, &rcInv);
+
+    lstGetItemsRect (pData, pos, -1, &rcInv);
+
+    if (rcInv.top < rcInv.bottom)
+        InvalidateRect (hwnd, &rcInv, TRUE);
+
+    return TRUE;
+}
+
+static PLISTBOXITEM lstGetItem (PLISTBOXDATA pData, int pos)
+{
+    int i;
+    PLISTBOXITEM plbi;
+
+    plbi = pData->head;
+    for (i=0; i < pos && plbi; i++)
+        plbi = plbi->next;
+
+    return plbi;
+}
+
+static int lstFindItem (PLISTBOXDATA pData, int start, char* key, BOOL bExact)
+{
+    PLISTBOXITEM plbi;
+    int keylen = strlen (key);
+  
+    if (start >= (pData->itemCount - 1))
+        start = 0;
+
+    plbi = lstGetItem (pData, start);
+
+    while (plbi)
+    {
+        if (bExact && (keylen != strlen (plbi->key))) {
+            plbi = plbi->next;
+            start ++;
+            continue;
+        }
+
+        if (strncasecmp (key, plbi->key, keylen) == 0)
+            return start;
+            
+        plbi = plbi->next;
+        start ++;
+    }
+
+    return LB_ERR;
+}
+
+static void lstOnDrawSListBoxItems (HDC hdc, DWORD dwStyle, 
+                PLISTBOXDATA pData, int width)
+{
+    PLISTBOXITEM plbi;
+    int i;
+    int x = 0, y = 0;
+    int offset;
+    RECT rc;
+    COLORREF bk;
+
+    plbi = lstGetItem (pData, pData->itemTop);
+    
+    for (i = 0; plbi && i < (pData->itemVisibles + 1); i++) {
+
+        if (plbi->dwFlags & LBIF_SELECTED) {
+            SetBkColor (hdc, bk = BLUE);
+            SetTextColor (hdc, WHITE);
+        }
+        else {
+            SetBkColor (hdc, bk = WHITE);
+            SetTextColor (hdc, BLACK);
+        }
+	rc.left = 0;
+	rc.top = y;
+	rc.right = width;
+	rc.bottom = y + pData->itemHeight;
+	FastFillRect(hdc, &rc, bk);
+
+        if (dwStyle & LBS_CHECKBOX) {
+            x = LST_INTER_BMPTEXT;
+            if (plbi->dwFlags & LBIF_CHECKED)
+                offset = 0;
+            else if (plbi->dwFlags & LBIF_PARTCHECKED)
+                offset = LST_WIDTH_CHECKMARK << 1;
+            else
+                offset = LST_WIDTH_CHECKMARK;
+#if 0//fix: no bitmap            
+            FillBoxWithBitmapPart (hdc, 
+                x, y + ((pData->itemHeight - LST_HEIGHT_CHECKMARK)>>1),
+                LST_WIDTH_CHECKMARK, LST_HEIGHT_CHECKMARK,
+                0, 0,
+                &sg_bmpCheckMark,
+                offset, 0);
+#endif
+            x += LST_WIDTH_CHECKMARK + LST_INTER_BMPTEXT;
+        }
+#if 0//fix: no icon
+        if (dwStyle & LBS_USEICON && plbi->dwData) {
+            DrawIcon (hdc, 
+                x, y, pData->itemHeight, pData->itemHeight, 
+                (HICON) plbi->dwData);
+            x += pData->itemHeight + LST_INTER_BMPTEXT;
+        }
+#endif
+
+	SelectObject(hdc, GetStockObject(DEFAULT_FONT));
+        TextOut (hdc, x+2, y, plbi->key,-1);
+
+        y += pData->itemHeight;
+        plbi = plbi->next;
+    }
+}
+
+static int lstSelectItem (DWORD dwStyle, PLISTBOXDATA pData, int newSel)
+{
+    PLISTBOXITEM plbi, newItem;
+    int index;
+    
+    newItem = lstGetItem (pData, newSel);
+    if (!newItem) return -1;
+#ifdef _DEBUG
+    if (!newItem)
+        fprintf (stderr, "ASSERT failed: return value of lstGetItem"
+                         " in lstSelectItem.\n");
+#endif
+
+    if (dwStyle & LBS_MULTIPLESEL) {
+        newItem->dwFlags ^= LBIF_SELECTED;
+        return newSel;
+    }
+
+    index = 0;
+    plbi = pData->head;
+    while (plbi) {
+        if (plbi->dwFlags & LBIF_SELECTED) {
+            if (index != newSel) {
+                plbi->dwFlags &= ~LBIF_SELECTED;
+                newItem->dwFlags |= LBIF_SELECTED;
+                return index;
+            }
+            break;
+        }
+
+        plbi = plbi->next;
+        index ++;
+    }
+
+    newItem->dwFlags |= LBIF_SELECTED;
+    return -1;
+}
+
+static void lstDrawFocusRect (HDC hdc, PLISTBOXDATA pData, RECT* rc)
+{
+    HGDIOBJ oldbrush,oldpen;
+
+    if (pData->itemHilighted < pData->itemTop
+            || pData->itemHilighted > (pData->itemTop + pData->itemVisibles))
+        return;
+
+    if (pData->dwFlags & LBF_FOCUS) {
+        lstGetItemsRect (pData, pData->itemHilighted, pData->itemHilighted, rc);
+        //InflateRect (rc, -1, -1);
+#if 0
+        FocusRect (hdc, rc->left - 1, rc->top, rc->right, rc->bottom);
+#else
+	oldbrush=SelectObject(hdc, GetStockObject(NULL_BRUSH));
+	oldpen=SelectObject(hdc, CreatePen(PS_SOLID, 1,
+				GetSysColor(COLOR_BTNHIGHLIGHT)));
+	//GdSetMode(MWMODE_XOR);
+        Rectangle (hdc, rc->left, rc->top, rc->right, rc->bottom);
+	//GdSetMode(MWMODE_SET);
+	SelectObject(hdc,oldbrush);
+	DeleteObject(SelectObject(hdc,oldpen));
+#endif
+    }
+}
+
+static void lstCalcParams (const RECT* rcClient, PLISTBOXDATA pData)
+{
+#define RECTHP(prc)  (prc->bottom - prc->top)
+    pData->itemVisibles = (RECTHP (rcClient)) / pData->itemHeight;
+}
+
+static void lstSetVScrollInfo (HWND hwnd, PLISTBOXDATA pData, BOOL fRedraw)//fix: no scrollbar
+{
+#if 0
+    SCROLLINFO si;
+
+    if (pData->itemVisibles >= pData->itemCount) 
+    {
+#if 1
+        SetScrollPos (hwnd, SB_VERT, 0);
+        EnableScrollBar (hwnd, SB_VERT, FALSE);
+#endif
+        return;
+    }
+    
+    si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
+    si.nMax = pData->itemCount - 1;
+    si.nMin = 0;
+    si.nPage = min (pData->itemVisibles, (pData->itemCount - pData->itemTop));
+    si.nPos = pData->itemTop;
+#if 1
+    SetScrollInfo (hwnd, SB_VERT, &si, fRedraw);
+    EnableScrollBar (hwnd, SB_VERT, TRUE);
+#endif
+
+#endif
+}
+
+LRESULT CALLBACK
+ListboxCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    HDC             hdc;
+    HWND	    pCtrl;
+    PLISTBOXDATA    pData;
+    DWORD           dwStyle;
+    
+    pCtrl   = hwnd;
+    dwStyle = pCtrl->style;
+
+    switch (message)
+    {
+        case WM_CREATE:
+            pData = (LISTBOXDATA*) malloc (sizeof(LISTBOXDATA));
+            if (pData == NULL) 
+                return -1;
+
+            pCtrl->userdata = (DWORD)pData;
+            if (!lstInitListBoxData (hwnd, pData, DEF_LB_BUFFER_LEN)) {
+                free (pData);
+                return -1;
+            }
+        break;
+
+	case WM_SIZE:
+	{
+	    RECT rc;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+	    GetClientRect(hwnd, &rc);
+            lstCalcParams (&rc, pData);
+	}
+        break;
+
+        case WM_DESTROY:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            lstListBoxCleanUp (pData);
+            free (pData);
+        break;
+
+        case LB_RESETCONTENT:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            lstResetListBoxContent (pData);
+            InvalidateRect (hwnd, NULL, TRUE);
+        break;
+        
+        case LB_ADDSTRING:
+        case LB_INSERTSTRING:
+        {
+            char* string = NULL;
+            PLISTBOXITEMINFO plbii = NULL;
+            PLISTBOXITEM newItem;
+            int pos;
+           
+            if (dwStyle & LBS_CHECKBOX || dwStyle & LBS_USEICON) {
+                plbii = (PLISTBOXITEMINFO)lParam;
+                if (!plbii)
+                    return LB_ERR;
+
+                string = plbii->string;
+            }
+            else {
+                string = (char*)lParam;
+                if (string == NULL || string [0] == '\0')
+                    return LB_ERR;
+            }
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            newItem = lstAllocItem (pData);
+            if (!newItem) {
+                NotifyParent (hwnd, pCtrl->id, LBN_ERRSPACE);
+                return LB_ERRSPACE;
+            }
+
+            newItem->key = FixStrAlloc (strlen (string));
+            strcpy (newItem->key, string);
+            newItem->dwFlags = LBIF_NORMAL;
+            if (plbii) {
+                switch (plbii->cmFlag) {
+                    case CMFLAG_CHECKED:
+                        newItem->dwFlags |= LBIF_CHECKED;
+                    break;
+                    case CMFLAG_PARTCHECKED:
+                        newItem->dwFlags |= LBIF_PARTCHECKED;
+                    break;
+                }
+                
+                if (dwStyle & LBS_USEICON)
+                    newItem->dwData = (DWORD)plbii->hIcon;
+                else
+                    newItem->dwData = 0L;
+            }
+            newItem->dwAddData = 0L;
+
+            if (message == LB_ADDSTRING)
+                pos = lstAddNewItem (dwStyle, pData, newItem, -1);
+            else
+                pos = lstAddNewItem (dwStyle, pData, newItem, (int)wParam);
+
+            lstInvalidateUnderItem (hwnd, pData, pos);
+
+            lstSetVScrollInfo (hwnd, pData, TRUE);
+
+            return pos;
+        }
+        break;
+        
+        case LB_DELETESTRING:
+        {
+            PLISTBOXITEM removed;
+            int delete;
+
+            delete = (int)wParam;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            removed = lstRemoveItem (pData, &delete);
+            if (removed) {
+                FreeFixStr (removed->key);
+                lstFreeItem (pData, removed);
+                
+                pData->itemCount --;
+
+                if (pData->itemTop != 0 
+                        && pData->itemCount <= pData->itemVisibles) {
+                    pData->itemTop = 0;
+                    InvalidateRect (hwnd, NULL, TRUE);
+                }
+                else {
+                    lstInvalidateUnderItem (hwnd, pData, delete);
+                    if (delete <= pData->itemTop) {
+                        pData->itemTop --;
+                        if (pData->itemTop < 0)
+                            pData->itemTop = 0;
+                    }
+                }
+
+                if (pData->itemHilighted >= pData->itemCount) {
+                    pData->itemHilighted = pData->itemCount - 1;
+                    if (pData->itemHilighted < 0)
+                        pData->itemHilighted = 0;
+                }
+
+                if (pData->itemHilighted < pData->itemTop)
+                    pData->itemHilighted = pData->itemTop;
+                if (pData->itemHilighted > ITEM_BOTTOM (pData))
+                    pData->itemHilighted = ITEM_BOTTOM (pData);
+             
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+            }
+        }
+        break;
+
+        case LB_FINDSTRING:
+            if( *(char*)lParam == '\0' )
+                return LB_ERR;
+                
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return lstFindItem(pData, (int)wParam, (char*)lParam, FALSE);
+
+        case LB_FINDSTRINGEXACT:
+            if( *(char*)lParam == '\0' )
+                return LB_ERR;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return lstFindItem(pData, (int)wParam, (char*)lParam, TRUE);
+    
+        case LB_SETTOPINDEX:
+        {
+            int newTop = (int) wParam;
+            
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+            if (newTop <0)
+                newTop = 0;
+            else if (newTop > pData->itemCount - pData->itemVisibles)
+                newTop = pData->itemCount - pData->itemVisibles;
+                
+            if (pData->itemTop != newTop) {
+                pData->itemTop = newTop;
+
+                if (pData->itemHilighted < pData->itemTop)
+                    pData->itemHilighted = pData->itemTop;
+                if (pData->itemHilighted > ITEM_BOTTOM (pData))
+                    pData->itemHilighted = ITEM_BOTTOM (pData);
+
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+
+                InvalidateRect (hwnd, NULL, TRUE);
+            }
+        }
+        break;
+    
+        case LB_SETCURSEL:
+        case LB_SETCARETINDEX:
+        {
+            int new = (int)wParam;
+            int old, newTop;
+            
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (new < 0 || new > pData->itemCount - 1)
+                return LB_ERR;
+
+            old = pData->itemHilighted;
+            if (new >= 0 && new != old) {
+                if (pData->itemCount - new >= pData->itemVisibles)
+                    newTop = new;
+                else
+                    newTop = max (pData->itemCount - pData->itemVisibles, 0);
+
+                pData->itemTop = newTop;
+                pData->itemHilighted = new;
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+            }
+
+            if (!(dwStyle & LBS_MULTIPLESEL))
+                lstSelectItem (dwStyle, pData, new);
+            InvalidateRect (hwnd, NULL, TRUE);
+
+            return old;
+        }
+        break;
+    
+        case LB_GETCOUNT:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return pData->itemCount;
+        break;
+    
+        case LB_GETCURSEL:
+        {
+            PLISTBOXITEM plbi;
+            int index = 0;
+            
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (dwStyle & LBS_MULTIPLESEL)
+                return pData->itemHilighted;
+
+            plbi = pData->head;
+            while (plbi) {
+                if (plbi->dwFlags & LBIF_SELECTED)
+                    return index;
+
+                index ++;
+                plbi = plbi->next;
+           }
+           
+           return LB_ERR;
+        }
+        break;
+    
+        case LB_GETSELCOUNT:
+        {
+            int nSel;
+            PLISTBOXITEM plbi;
+            
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+            nSel = 0;
+            plbi = pData->head;
+            while (plbi) {
+                if (plbi->dwFlags & LBIF_SELECTED)
+                    nSel ++;
+                plbi = plbi->next;
+            }
+            
+            return nSel;
+        }
+        break;
+    
+        case LB_GETTOPINDEX:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return pData->itemTop;
+        break;
+    
+        case LB_GETCARETINDEX:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return pData->itemHilighted;
+        break;
+
+        case LB_GETTEXTLEN:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = lstGetItem (pData, (int)wParam);
+            if (plbi)
+                return strlen (plbi->key);
+            else
+                return LB_ERR;
+        }
+        break;
+        
+        case LB_GETTEXT:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = lstGetItem (pData, (int)wParam);
+            if (plbi)
+                strcpy ((char*)lParam, plbi->key);
+            else
+                return LB_ERR;
+        }
+        break;
+
+        case LB_SETTEXT:
+        {
+            PLISTBOXITEM plbi;
+            char* newStr;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = lstGetItem (pData, (int)wParam);
+            if (plbi) {
+                newStr = FixStrAlloc (strlen ((char*)lParam));
+                if (newStr) {
+                    FreeFixStr (plbi->key);
+                    plbi->key = newStr;
+                    strcpy (plbi->key, (char*)lParam);
+                    lstInvalidateItem (hwnd, pData, (int)wParam, TRUE);
+                }
+                else
+                    return LB_ERR;
+            }
+            else
+                return LB_ERR;
+        }
+        break;
+    
+        case LB_GETITEMDATA:
+        {
+            PLISTBOXITEM plbi;
+            PLISTBOXITEMINFO plbii;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            if (!(dwStyle & LBS_CHECKBOX || dwStyle & LBS_USEICON)) {
+                return plbi->dwData;
+            }
+            
+            plbii = (PLISTBOXITEMINFO)lParam;
+            if (!plbii)
+                return LB_ERR;
+
+            if (plbi->dwFlags & LBIF_CHECKED)
+                plbii->cmFlag = CMFLAG_CHECKED;
+            else if (plbi->dwFlags & LBIF_PARTCHECKED)
+                plbii->cmFlag = CMFLAG_PARTCHECKED;
+            else
+                plbii->cmFlag = CMFLAG_BLANK;
+            plbii->hIcon = (HICON)plbi->dwData;
+
+            return LB_OKAY;
+        }
+        break;
+    
+        case LB_SETITEMDATA:
+        {
+            PLISTBOXITEM plbi;
+            PLISTBOXITEMINFO plbii;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            if (!(dwStyle & LBS_CHECKBOX || dwStyle & LBS_USEICON)) {
+                plbi->dwData = (DWORD)lParam;
+                return LB_OKAY;
+            }
+
+            plbii = (PLISTBOXITEMINFO)lParam;
+            if (!plbii)
+                return LB_ERR;
+
+            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+            switch (plbii->cmFlag) {
+                case CMFLAG_CHECKED:
+                    plbi->dwFlags |= LBIF_CHECKED;
+                break;
+                case CMFLAG_PARTCHECKED:
+                    plbi->dwFlags |= LBIF_PARTCHECKED;
+                break;
+            }
+                
+            if (dwStyle & LBS_USEICON)
+                plbi->dwData = (DWORD)plbii->hIcon;
+            else
+                plbi->dwData = 0;
+            
+            lstInvalidateItem (hwnd, pData, (int)wParam, TRUE);
+
+            return LB_OKAY;
+        }
+        break;
+        
+        case LB_GETITEMADDDATA:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            return plbi->dwAddData;
+        }
+        break;
+    
+        case LB_SETITEMADDDATA:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            plbi->dwAddData = (DWORD)lParam;
+
+            return LB_OKAY;
+        }
+        break;
+        
+        case LB_GETCHECKMARK:
+        {
+            PLISTBOXITEM plbi;
+
+            if (!(dwStyle & LBS_CHECKBOX))
+                return LB_ERR;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            if (plbi->dwFlags & LBIF_CHECKED)
+                return CMFLAG_CHECKED;
+
+            if (plbi->dwFlags & LBIF_PARTCHECKED)
+                return CMFLAG_PARTCHECKED;
+
+            return CMFLAG_BLANK;
+        }
+        break;
+
+        case LB_SETCHECKMARK:
+        {
+            PLISTBOXITEM plbi;
+
+            if (!(dwStyle & LBS_CHECKBOX))
+                return LB_ERR;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+            switch (lParam) {
+                case CMFLAG_CHECKED:
+                    plbi->dwFlags |= LBIF_CHECKED;
+                break;
+                case CMFLAG_PARTCHECKED:
+                    plbi->dwFlags |= LBIF_PARTCHECKED;
+                break;
+            }
+                
+            lstInvalidateItem (hwnd, pData, (int)wParam, TRUE);
+
+            return LB_OKAY;
+        }
+        break;
+
+        case LB_GETSELITEMS:
+        {
+            int  nItem;
+            int  nSel = 0;
+            int  index = 0;
+            int* pInt;
+            PLISTBOXITEM plbi;
+
+            nItem = (int)wParam;
+            pInt  = (int*)lParam;
+            
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = pData->head;
+            while (plbi) {
+
+                if (plbi->dwFlags & LBIF_SELECTED) {
+                    if (pInt) {
+                        if (nSel < nItem)
+                            *(pInt + nSel) = index;
+                        else 
+                            return nItem;
+                    }
+                    nSel ++;
+                }
+                
+                plbi = plbi->next;
+                index ++;
+            }
+            
+            return nSel;
+        }
+        break;
+    
+        case LB_GETSEL:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = lstGetItem (pData, (int)wParam);
+            if (plbi)
+                return plbi->dwFlags & LBIF_SELECTED;
+            else
+                return LB_ERR;
+        }
+        break;
+
+        case LB_SETSEL:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = lstGetItem (pData, (int)lParam);
+            if (plbi) {
+		pData->dwFlags &= ~LBF_NOTHINGSELECTED;
+                if (wParam == -1)
+                    plbi->dwFlags ^= LBIF_SELECTED;
+                else if (wParam == 0)
+                    plbi->dwFlags &= ~LBIF_SELECTED;
+                else
+                    plbi->dwFlags |= LBIF_SELECTED;
+
+                lstInvalidateItem (hwnd, pData, (int)lParam, FALSE);
+            }
+            else
+                return LB_ERR;
+        }
+        break;
+    
+        case LB_GETITEMHEIGHT:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return pData->itemHeight;
+        break;
+    
+        case LB_SETITEMHEIGHT:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (pData->itemHeight != LOWORD (lParam)) {
+                RECT rcClient;
+                
+                pData->itemHeight = LOWORD (lParam);
+                GetClientRect (hwnd, &rcClient);
+                lstCalcParams (&rcClient, pData);
+                
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+                InvalidateRect (hwnd, NULL, TRUE);
+            }
+        break;
+
+        case WM_SETFOCUS:
+        {
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+            if (pData->dwFlags & LBF_FOCUS)
+                break;
+                
+            pData->dwFlags |= LBF_FOCUS;
+	    InvalidateRect(hwnd, NULL, TRUE);
+
+            NotifyParent (hwnd, pCtrl->id, LBN_SETFOCUS);
+        }
+        break;
+        
+        case WM_KILLFOCUS:
+        {
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+            pData->dwFlags &= ~LBF_FOCUS;
+	    InvalidateRect(hwnd, NULL, TRUE);
+
+            NotifyParent (hwnd, pCtrl->id, LBN_KILLFOCUS);
+        }
+        break;
+
+        case WM_GETDLGCODE:
+            return DLGC_WANTARROWS | DLGC_WANTCHARS;
+
+        case WM_GETTEXTLENGTH:
+        case WM_GETTEXT:
+        case WM_SETTEXT:
+            return -1;
+#if 0            
+	case WM_SETFONT:
+        break;
+        
+	case WM_GETFONT:
+        break;
+#endif        
+	case WM_NCCALCSIZE:
+	{
+		LPNCCALCSIZE_PARAMS lpnc;
+
+		/* calculate client rect from passed window rect in rgrc[0]*/
+		lpnc = (LPNCCALCSIZE_PARAMS)lParam;
+		if(GetWindowLong(hwnd, GWL_STYLE) & WS_BORDER)
+			InflateRect(&lpnc->rgrc[0], -2, -2);
+	}
+		break;
+
+        case WM_NCPAINT:
+	{
+	    RECT rc;
+
+            hdc = wParam? (HDC)wParam: GetWindowDC (hwnd);
+	    GetWindowRect(hwnd, &rc);
+
+            if (dwStyle & WS_BORDER)
+		Draw3dInset(hdc, rc.left, rc.top,
+			rc.right-rc.left, rc.bottom-rc.top);
+
+            if (!wParam)
+                ReleaseDC (hwnd, hdc);
+	}
+            break;
+
+        case WM_PAINT:
+        {
+            RECT rc;
+	    PAINTSTRUCT ps;
+            
+            hdc = BeginPaint (hwnd,&ps);
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+	    /*
+	     * If this is the first paint and there's nothing
+	     * selected, then auto select the topmost displayed item.
+	     */
+	    if (pData->dwFlags & LBF_NOTHINGSELECTED) {
+		    lstSelectItem (hwnd->style, pData, pData->itemTop);
+		    pData->dwFlags &= ~LBF_NOTHINGSELECTED;
+	    }
+            GetClientRect (hwnd, &rc);
+            lstOnDrawSListBoxItems (hdc, dwStyle, pData, rc.right-rc.left);
+            lstDrawFocusRect (hdc, pData, &rc);
+
+            EndPaint (hwnd, &ps);
+        }
+        break;
+    
+        case WM_LBUTTONDBLCLK:
+            if (dwStyle & LBS_NOTIFY)
+                NotifyParent (hwnd, pCtrl->id, LBN_DBLCLK);
+        break;
+    
+        case WM_LBUTTONDOWN:
+        {
+            int oldSel, mouseX, mouseY, hit;
+            RECT rcInv;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (pData->itemCount == 0)
+                break;
+
+            mouseX = LOWORD (lParam);
+            mouseY = HIWORD (lParam);
+            hit = mouseY / pData->itemHeight;
+            hit += pData->itemTop;
+            
+            if (hit >= pData->itemCount)
+                break;
+
+            GetClientRect (hwnd, &rcInv);
+            oldSel = lstSelectItem (dwStyle, pData, hit);
+            if ((dwStyle & LBS_NOTIFY) && (oldSel != hit))
+                NotifyParent (hwnd, pCtrl->id, LBN_SELCHANGE);
+            if (oldSel >= 0) {
+                if (oldSel >= pData->itemTop 
+                        && (oldSel <= pData->itemTop + pData->itemVisibles)) {
+                    lstGetItemsRect (pData, oldSel, oldSel, &rcInv);
+                    InvalidateRect (hwnd, &rcInv, TRUE);
+                }
+            }
+
+            lstGetItemsRect (pData, hit, hit, &rcInv);
+            InvalidateRect (hwnd, &rcInv, TRUE);
+
+            if (pData->itemHilighted != hit) 
+	    {
+                hdc = GetDC(hwnd);
+
+                lstDrawFocusRect (hdc, pData, &rcInv);
+                ReleaseDC (hwnd,hdc);
+            }
+            pData->itemHilighted = hit;
+
+            if (dwStyle & LBS_CHECKBOX) {
+                if (mouseX > 0 && mouseX < LST_WIDTH_CHECKMARK) {
+                    NotifyParent (hwnd, pCtrl->id, LBN_CLICKCHECKMARK);//?
+                    
+                    if (dwStyle & LBS_AUTOCHECK) {
+                        PLISTBOXITEM plbi;
+
+                        plbi = lstGetItem (pData, hit);
+
+                        switch (plbi->dwFlags & LBIF_CHECKMARKMASK) {
+                        case LBIF_CHECKED:
+                            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+                            break;
+                        default:
+                            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+                            plbi->dwFlags |= LBIF_CHECKED;
+                            break;
+                        }
+                
+                        lstInvalidateItem (hwnd, pData, hit, TRUE);
+                    }
+                }
+            }
+            
+            lstSetVScrollInfo (hwnd, pData, TRUE);
+        }
+        break;
+    
+        case WM_LBUTTONUP:
+        break;
+    
+        case WM_MOUSEMOVE:
+        break;
+
+        case WM_KEYDOWN:
+        {
+            int oldSel, newSel, newTop;
+            RECT rcInv;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            newTop = pData->itemTop;
+            newSel = pData->itemHilighted;
+            switch (LOWORD (wParam))
+            {
+                case VK_HOME://SCANCODE_HOME:
+                    newSel = 0;
+                    newTop = 0;
+                break;
+                
+                case VK_END://SCANCODE_END:
+                    newSel = pData->itemCount - 1;
+                    if (pData->itemCount > pData->itemVisibles)
+                        newTop = pData->itemCount - pData->itemVisibles;
+                    else
+                        newTop = 0;
+                break;
+                
+                case VK_DOWN://SCANCODE_CURSORBLOCKDOWN:
+                    newSel ++;
+                    if (newSel >= pData->itemCount)
+                        return 0;
+                    if (newSel > ITEM_BOTTOM (pData))
+                        newTop ++;
+                break;
+                
+                case VK_UP://SCANCODE_CURSORBLOCKUP:
+                    newSel --;
+                    if (newSel < 0)
+                        return 0;
+                    if (newSel < pData->itemTop)
+                        newTop --;
+                break;
+                
+                case VK_NEXT://SCANCODE_PAGEDOWN:
+                    newSel += pData->itemVisibles;
+                    if (newSel >= pData->itemCount)
+                        newSel = pData->itemCount - 1;
+                        
+                    if (pData->itemCount - newSel >= pData->itemVisibles)
+                        newTop = newSel;
+                    else
+                        newTop = max (pData->itemCount-pData->itemVisibles, 0);
+                break;
+
+                case VK_PRIOR://SCANCODE_PAGEUP:
+                    newSel -= pData->itemVisibles;
+                    if (newSel < 0)
+                        newSel = 0;
+                        
+                    newTop -= pData->itemVisibles;
+                    if (newTop < 0)
+                        newTop = 0;
+                break;
+                
+                default:
+                return 0;
+            }
+
+            GetClientRect (hwnd, &rcInv);
+            if (pData->itemHilighted != newSel) {
+                if (pData->itemTop != newTop) {
+                    pData->itemTop = newTop;
+                    pData->itemHilighted = newSel;
+                    if (!(dwStyle & LBS_MULTIPLESEL)) {
+                        oldSel = lstSelectItem (dwStyle, pData, newSel);
+                        if ((dwStyle & LBS_NOTIFY) && (oldSel != newSel))
+                            NotifyParent (hwnd, pCtrl->id, LBN_SELCHANGE);
+                    }
+                    InvalidateRect (hwnd, NULL, TRUE);
+                }
+                else {
+                    if (!(dwStyle & LBS_MULTIPLESEL)) {
+                        oldSel = lstSelectItem (dwStyle, pData, newSel);
+                        if ((dwStyle & LBS_NOTIFY) && (oldSel != newSel))
+                            NotifyParent (hwnd, pCtrl->id, LBN_SELCHANGE);
+                        if (oldSel >= 0) {
+                            if (oldSel >= pData->itemTop 
+                                    && oldSel <= (ITEM_BOTTOM (pData) + 1)) {
+                                lstGetItemsRect (pData, oldSel, oldSel, &rcInv);
+                                InvalidateRect (hwnd, &rcInv, TRUE);
+                            }
+                        }
+                        
+                        if (newSel < newTop) {
+                            pData->itemHilighted = newSel;
+                            break;
+                        }
+                            
+                        lstGetItemsRect (pData, pData->itemHilighted,
+                                                pData->itemHilighted, &rcInv);
+
+                	hdc = GetDC(hwnd);
+
+                        lstDrawFocusRect (hdc, pData, &rcInv);
+                        ReleaseDC (hwnd,hdc);
+                        
+                        pData->itemHilighted = newSel;
+                        lstGetItemsRect (pData, newSel, newSel, &rcInv);
+                        InvalidateRect (hwnd, &rcInv, TRUE);
+                    }
+                    else 
+		    {
+                	hdc = GetDC(hwnd);
+
+                        lstDrawFocusRect (hdc, pData, &rcInv);
+                        pData->itemHilighted = newSel;
+                        GetClientRect (hwnd, &rcInv);
+                        lstDrawFocusRect (hdc, pData, &rcInv);
+                        ReleaseDC (hwnd,hdc);
+                    }
+                }
+                lstSetVScrollInfo (hwnd, pData, TRUE);//
+            }
+        }
+        break;
+
+        case WM_CHAR:
+        {
+            char head [2];
+            int index;
+            int newTop;
+            
+            //?if (HIBYTE (wParam))
+            //?    break;
+           
+            head [0] = (char)/*LOBYTE*/ (wParam);
+            head [1] = '\0';
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+            if (head[0] == ' ') {
+                if (dwStyle & LBS_MULTIPLESEL) {
+                    RECT rcInv;
+                    
+                    GetClientRect (hwnd, &rcInv);
+                    lstSelectItem (dwStyle, pData, pData->itemHilighted);
+                    lstGetItemsRect (pData, 
+                            pData->itemHilighted, 
+                            pData->itemHilighted,
+                            &rcInv);
+                    InvalidateRect (hwnd, &rcInv, TRUE);
+                }
+                else if (dwStyle & LBS_CHECKBOX) {
+                    NotifyParent (hwnd, pCtrl->id, LBN_CLICKCHECKMARK);
+                    
+                    if (dwStyle & LBS_AUTOCHECK) {
+                        PLISTBOXITEM plbi;
+
+                        plbi = lstGetItem (pData, pData->itemHilighted);
+
+                        switch (plbi->dwFlags & LBIF_CHECKMARKMASK) {
+                        case LBIF_CHECKED:
+                            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+                            break;
+                        default:
+                            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+                            plbi->dwFlags |= LBIF_CHECKED;
+                            break;
+                        }
+                
+                        lstInvalidateItem (hwnd, pData, 
+                                pData->itemHilighted, TRUE);
+                    }
+                }
+                break;
+            }
+
+            index = lstFindItem (pData, pData->itemHilighted + 1, head, FALSE);
+            if (index < 0) {
+                index = lstFindItem (pData, 0, head, FALSE);
+            }
+
+            if (index >= 0) {
+                if (pData->itemCount - index >= pData->itemVisibles)
+                    newTop = index;
+                else
+                    newTop = max (pData->itemCount - pData->itemVisibles, 0);
+
+                pData->itemTop = newTop;
+                pData->itemHilighted = index;
+                if (!(dwStyle & LBS_MULTIPLESEL))
+                    lstSelectItem (dwStyle, pData, index);
+                InvalidateRect (hwnd, NULL, TRUE);
+
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+            }
+        }
+        break;
+ 
+        case WM_VSCROLL:
+        {
+            int newTop;
+            int scrollHeight = 0;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            newTop = pData->itemTop;
+            switch(wParam)
+            {
+                case SB_LINEDOWN:
+                    if (ITEM_BOTTOM (pData) < (pData->itemCount - 1)) {
+                        newTop ++;
+                        scrollHeight = -pData->itemHeight;
+                    }
+                break;
+                
+                case SB_LINEUP:
+                    if (pData->itemTop > 0) {
+                        newTop --;
+                        scrollHeight = pData->itemHeight;
+                    }
+                break;
+                
+                case SB_PAGEDOWN:
+                    if ((pData->itemTop + (pData->itemVisibles << 1)) <=
+                            pData->itemCount)
+                        newTop += pData->itemVisibles;
+                    else
+                        newTop = pData->itemCount - pData->itemVisibles;
+
+                    if (newTop < 0)
+                        return 0;
+
+                    scrollHeight = -(newTop - pData->itemTop)
+                                    *pData->itemHeight;
+                break;
+
+                case SB_PAGEUP:
+                    if (pData->itemTop >= pData->itemVisibles)
+                        newTop -= pData->itemVisibles;
+                    else
+                        newTop = 0;
+
+                    scrollHeight = (pData->itemTop - newTop)*pData->itemHeight;
+                break;
+
+                case SB_THUMBTRACK:
+                    newTop = (int)lParam;
+                    scrollHeight = (pData->itemTop - newTop)*pData->itemHeight;
+                break;
+            }
+            
+            if (scrollHeight) {
+                pData->itemTop = newTop;
+#if 0//!!: fix: no scroll
+                ScrollWindow (hwnd, 0, scrollHeight, NULL, NULL);
+#endif
+                SendMessage (hwnd, WM_PAINT, 0, 0);
+
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+
+                return 0;
+            }
+        }
+        break;
+
+	case WM_HSCROLL:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            switch (wParam)
+            {
+                case SB_LINERIGHT:
+                break;
+                
+                case SB_LINELEFT:
+                break;
+                
+                case SB_PAGELEFT:
+                break;
+                
+                case SB_PAGERIGHT:
+                break;
+            }
+        break;
+
+        default:
+    		return DefWindowProc (hwnd, message, wParam, lParam);
+    }
+    return 0;
+}
diff -urN lib/microwindows/src/mwin/winlib/listbox.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/listbox.c
--- lib/microwindows/src/mwin/winlib/listbox.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/listbox.c	2005-02-21 16:13:25.000000000 +0100
@@ -0,0 +1,1679 @@
+/*
+ * Copyright (C) 1999, 2000, Wei Yongming.
+ * Portions Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Listbox for Microwindows win32 api.
+ */
+
+/*
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Library General Public
+**  License as published by the Free Software Foundation; either
+**  version 2 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Library General Public License for more details.
+**
+**  You should have received a copy of the GNU Library General Public
+**  License along with this library; if not, write to the Free
+**  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+**  MA 02111-1307, USA
+*/
+
+/*
+**  Alternatively, the contents of this file may be used under the terms 
+**  of the Mozilla Public License (the "MPL License") in which case the
+**  provisions of the MPL License are applicable instead of those above.
+*/
+
+// Note:
+//  Although there was a version by Zhao Jianghua, this version of
+//  LISTBOX control is written by Wei Yongming from scratch.
+//
+// Modify records:
+//
+//  Who             When        Where       For What                Status
+//-----------------------------------------------------------------------------
+//  Wei Yongming    1999/10/18  Tsinghua    Item Additional Data    Finished
+//  Wei Yongming    1999/10/31  Tsinghua    Space bar for checkmark Finished
+//  Wei Yongming    1999/10/31  Tsinghua    Character match item    Finished
+//  Wei Yongming    1999/11/07  Tsinghua    Character match item    Bug fixing
+//  WEI Yongming    2000/01/20  Tsinghua    Thumb dragging          Finished
+//  WEI Yongming    2000/02/24  Tsinghua    Add MPL License         Finished
+//  Kevin Tseng     2000/05/26  gv          port to microwin        ported
+//  Greg Haerr      2000/06/15  Utah        3d look, bug fixes      Finished
+//  Kevin Tseng     2000/06/22  gv          port to mw-nanox        ported
+//  Kevin Tseng     2000/06/22  gv          fixed bug if no item    Finished
+//  Kevin Tseng     2000/08/08  gv          enable scrollbar(V)     porting
+//  Kevin Tseng     2000/08/10  gv          enable scrollbar(V)     ported
+//  Kevin Tseng     2000/08/10  gv          WM_CHAR, WM_KEYDOWN     ported
+//
+// TODO:
+// 1. Multiple columns support.
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define MWINCLUDECOLORS
+#include "windows.h"
+#include "wintools.h" 	/* Draw3dBox */
+#include "device.h" 	/* GdGetTextSize */
+
+#define FixStrAlloc(n)	malloc((n)+1)
+#define FreeFixStr(p)	free(p)
+
+#define LBIF_NORMAL         0x0000L
+#define LBIF_SELECTED       0x0001L
+#define LBIF_CHECKED        0x0010L
+#define LBIF_PARTCHECKED    0x0020L
+#define LBIF_CHECKMARKMASK  0x00F0L
+
+#define CMFLAG_BLANK        0
+#define CMFLAG_CHECKED      1
+#define CMFLAG_PARTCHECKED  2
+typedef struct _LISTBOXITEMINFO {
+    int     insPos;         // insert position
+    char*   string;         // item string
+    int     cmFlag;         // check mark flag
+    HICON   hIcon;          // handle of icon
+} LISTBOXITEMINFO, *PLISTBOXITEMINFO;
+
+typedef struct _LISTBOXITEM {
+    char*   key;                // item sort key
+    DWORD   dwFlags;            // item flags
+    DWORD   dwData;             // item data
+    DWORD   dwAddData;          // item additional data
+    struct  _LISTBOXITEM* next;  // next item
+} LISTBOXITEM, *PLISTBOXITEM;
+
+#define DEF_LB_BUFFER_LEN       5
+
+#define LBF_FOCUS               0x0001
+#define LBF_NOTHINGSELECTED	0x0002
+
+typedef struct _LISTBOXDATA {
+    DWORD dwFlags;          // listbox flags
+
+    int itemCount;          // items count
+    int itemTop;            // start display item
+    int itemVisibles;       // number of visible items
+
+    int itemHilighted;      // current hilighted item
+    int itemHeight;         // item height
+
+    LISTBOXITEM* head;      // items linked list head
+
+    int buffLen;            // buffer length
+    LISTBOXITEM* buffStart; // buffer start
+    LISTBOXITEM* buffEnd;   // buffer end
+    LISTBOXITEM* freeList;  // free list in buffer 
+} LISTBOXDATA, *PLISTBOXDATA;
+
+void ListboxControlCleanup ();
+static LRESULT CALLBACK
+ListboxCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+#define ITEM_BOTTOM(x)  (x->itemTop + x->itemVisibles - 1)
+
+#define LST_WIDTH_CHECKMARK     11
+#define LST_HEIGHT_CHECKMARK    11
+#define LST_INTER_BMPTEXT       2
+
+int WINAPI MwRegisterListboxControl(HINSTANCE hInstance)
+{
+	WNDCLASS	wc;
+#if 0
+    static BITMAP sg_bmpCheckMark;
+    if (!LoadSystemBitmap (&sg_bmpCheckMark, "checkmark")) {
+        fprintf (stderr, "Load ListBox Check Mark Bitmap failure!\n");
+        return FALSE;
+    }
+#endif
+	wc.style	= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
+	wc.lpfnWndProc	= (WNDPROC)ListboxCtrlProc;
+	wc.cbClsExtra	= 0;
+	wc.cbWndExtra	= 0;
+	wc.hInstance	= hInstance;
+	wc.hIcon	= NULL;
+	wc.hCursor	= 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground= GetStockObject(WHITE_BRUSH);
+	wc.lpszMenuName	= NULL;
+	wc.lpszClassName= "LISTBOX";
+
+	return RegisterClass(&wc);
+}
+
+void ListboxControlCleanup ()
+{
+#if 0
+    UnloadBitmap (&sg_bmpCheckMark);
+#endif
+}
+
+static LRESULT NotifyParent (HWND hwnd, int id, int code)
+{
+    return SendMessage (GetParent (hwnd), WM_COMMAND, 
+                 (WPARAM) MAKELONG (id, code), (LPARAM)hwnd);
+}
+
+static BOOL lstInitListBoxData (HWND hwnd,LISTBOXDATA* pData, int len)
+{
+    int i, xw, xh, xb;
+    PLISTBOXITEM plbi;
+    HDC hdc;
+    
+    memset (pData, 0, sizeof (LISTBOXDATA));
+#if 0
+//- pData->itemHeight = GetSysCharHeight ();
+#else
+    hdc=GetDC(hwnd);
+#if MWCLIENT//nanox client
+    GrSetGCFont(hdc->gc,hdc->font->fontid);//+
+    GrGetGCTextSize(hdc->gc,"X",1,
+		MWTF_ASCII,&xw,&xh,&xb);
+#else
+    GdSetFont(hdc->font->pfont);//+
+    GdGetTextSize(hdc->font->pfont,"X",1,
+		&xw,&xh,&xb,MWTF_ASCII);
+#endif
+    ReleaseDC(hwnd,hdc);
+    pData->itemHeight=xh + 1; 
+#endif
+    pData->itemHilighted = 0;
+    pData->dwFlags = LBF_NOTHINGSELECTED;
+
+    // init item buffer.
+    if (!(pData->buffStart = malloc (len * sizeof (LISTBOXITEM))))
+        return FALSE;
+
+    pData->buffLen = len;
+    pData->buffEnd = pData->buffStart + len;
+    pData->freeList = pData->buffStart;
+
+    plbi = pData->freeList;
+    for (i = 0; i < len - 1; i++) {
+        plbi->next = plbi + 1;
+        plbi ++;
+    }
+    plbi->next = NULL;
+
+    return TRUE;
+}
+
+static void lstListBoxCleanUp (LISTBOXDATA* pData)
+{
+    PLISTBOXITEM plbi;
+    PLISTBOXITEM next;
+
+    plbi = pData->head;
+    while (plbi) {
+        FreeFixStr (plbi->key);
+        next = plbi->next;
+        if (plbi < pData->buffStart || plbi > pData->buffEnd)
+            free (plbi);
+
+        plbi = next;
+    }
+    
+    free (pData->buffStart);
+}
+
+static void lstResetListBoxContent (PLISTBOXDATA pData)
+{
+    int i;
+    PLISTBOXITEM plbi, next;
+
+    pData->itemCount = 0;
+    pData->itemTop = 0;
+    pData->itemHilighted = 0;
+//    pData->itemVisibles = 0;
+
+    plbi = pData->head;
+    while (plbi) {
+        FreeFixStr (plbi->key);
+        next = plbi->next;
+        if (plbi < pData->buffStart || plbi > pData->buffEnd)
+            free (plbi);
+
+        plbi = next;
+    }
+
+    pData->head = NULL;
+    pData->freeList = pData->buffStart;
+
+    plbi = pData->freeList;
+    for (i = 0; i < pData->buffLen - 1; i++) {
+        plbi->next = plbi + 1;
+        plbi ++;
+    }
+    plbi->next = NULL;
+}
+
+static PLISTBOXITEM lstAllocItem (PLISTBOXDATA pData)
+{
+    PLISTBOXITEM plbi;
+
+    if (pData->freeList) {
+        plbi = pData->freeList;
+        pData->freeList = plbi->next;
+    }
+    else
+        plbi = (PLISTBOXITEM) malloc (sizeof (LISTBOXITEM));
+    
+    return plbi;
+}
+
+static void lstFreeItem (PLISTBOXDATA pData, PLISTBOXITEM plbi)
+{
+    if (plbi < pData->buffStart || plbi > pData->buffEnd)
+        free (plbi);
+    else {
+        plbi->next = pData->freeList;
+        pData->freeList = plbi;
+    }
+}
+
+static int lstAddNewItem (DWORD dwStyle, 
+        PLISTBOXDATA pData, PLISTBOXITEM newItem, int pos)
+{
+    PLISTBOXITEM plbi;
+    PLISTBOXITEM insPosItem = NULL;
+    int insPos = 0;
+
+    newItem->next = NULL;
+    if (!pData->head)
+        insPosItem = NULL;
+    else if (dwStyle & LBS_SORT) {
+        plbi = pData->head;
+
+        if (strcmp (newItem->key, plbi->key) < 0) {
+            insPosItem = NULL;
+            insPos = 0;
+        }
+        else {
+            while (plbi->next) {
+                if (strcmp (newItem->key, plbi->next->key) <= 0)
+                    break;
+            
+                plbi = plbi->next;
+                insPos ++;
+            }
+            insPosItem = plbi;
+        }
+    }
+    else {
+        plbi = pData->head;
+
+        if (pos < 0) {
+            while (plbi->next) {
+                plbi = plbi->next;
+                insPos ++;
+            }
+            insPosItem = plbi;
+        }
+        else if (pos > 0) {
+            int index = 0;
+
+            while (plbi->next) {
+                if (pos == index)
+                    break;
+                plbi = plbi->next;
+                index ++;
+                insPos ++;
+            }
+            insPosItem = plbi;
+        }
+    }
+
+    if (insPosItem) {
+        plbi = insPosItem->next;
+        insPosItem->next = newItem;
+        newItem->next = plbi;
+
+        insPos ++;
+    }
+    else {
+        plbi = pData->head;
+        pData->head = newItem;
+        newItem->next = plbi;
+    }
+
+    pData->itemCount ++;
+    return insPos;
+}
+
+static PLISTBOXITEM lstRemoveItem (PLISTBOXDATA pData, int* pos)
+{
+    int index = 0;
+    PLISTBOXITEM plbi, prev;
+
+    if (!pData->head)
+        return NULL;
+
+    if (*pos < 0) {
+        prev = pData->head;
+        plbi = pData->head;
+        while (plbi->next) {
+            prev = plbi;
+            plbi = plbi->next;
+            index ++;
+        }
+
+        if (plbi == pData->head) {
+            pData->head = pData->head->next;
+            *pos = 0;
+            return plbi;
+        }
+        else {
+            prev->next = plbi->next;
+            *pos = index;
+            return plbi;
+        }
+    }
+    else if (*pos == 0) {
+        plbi = pData->head;
+        pData->head = plbi->next;
+        return plbi;
+    }
+    else {
+        index = 0;
+        prev = pData->head;
+        plbi = pData->head;
+        while (plbi->next) {
+            if (*pos == index)
+                break;
+
+            prev = plbi;
+            plbi = plbi->next;
+            index ++;
+        }
+
+        if (plbi == pData->head) {
+            pData->head = pData->head->next;
+            *pos = 0;
+            return plbi;
+        }
+        else {
+            prev->next = plbi->next;
+            *pos = index;
+            return plbi;
+        }
+    }
+
+    return NULL;
+}
+
+static void lstGetItemsRect (PLISTBOXDATA pData, int start, int end, RECT* prc)
+{
+    if (start < 0)
+        start = 0;
+
+    prc->top = (start - pData->itemTop)*pData->itemHeight;
+
+    if (end >= 0)
+        prc->bottom = (end - pData->itemTop + 1)*pData->itemHeight;
+
+}
+
+static void lstInvalidateItem (HWND hwnd, PLISTBOXDATA pData, int pos,BOOL fEBk)
+{
+    RECT rcInv;
+    
+    if (pos < pData->itemTop || pos > (pData->itemTop + pData->itemVisibles))
+        return;
+    
+    GetClientRect (hwnd, &rcInv);
+    rcInv.top = (pos - pData->itemTop)*pData->itemHeight;
+    rcInv.bottom = rcInv.top + pData->itemHeight;
+
+    InvalidateRect (hwnd, &rcInv, fEBk);
+}
+
+static BOOL lstInvalidateUnderItem (HWND hwnd, PLISTBOXDATA pData, int pos)
+{
+    RECT rcInv;
+    
+    if (pos > (pData->itemTop + pData->itemVisibles))
+        return FALSE;
+
+    if (pos <= pData->itemTop) {
+        InvalidateRect (hwnd, NULL, TRUE);
+        return TRUE;
+    }
+    
+    GetClientRect (hwnd, &rcInv);
+
+    lstGetItemsRect (pData, pos, -1, &rcInv);
+
+    if (rcInv.top < rcInv.bottom)
+        InvalidateRect (hwnd, &rcInv, TRUE);
+
+    return TRUE;
+}
+
+static PLISTBOXITEM lstGetItem (PLISTBOXDATA pData, int pos)
+{
+    int i;
+    PLISTBOXITEM plbi;
+
+    plbi = pData->head;
+    for (i=0; i < pos && plbi; i++)
+        plbi = plbi->next;
+
+    return plbi;
+}
+
+static int lstFindItem (PLISTBOXDATA pData, int start, char* key, BOOL bExact)
+{
+    PLISTBOXITEM plbi;
+    int keylen = strlen (key);
+  
+    if (start >= (pData->itemCount - 1))
+        start = 0;
+
+    plbi = lstGetItem (pData, start);
+
+    while (plbi)
+    {
+        if (bExact && (keylen != strlen (plbi->key))) {
+            plbi = plbi->next;
+            start ++;
+            continue;
+        }
+
+        if (strncasecmp (key, plbi->key, keylen) == 0)
+            return start;
+            
+        plbi = plbi->next;
+        start ++;
+    }
+
+    return LB_ERR;
+}
+
+static void lstOnDrawSListBoxItems (HDC hdc, DWORD dwStyle, 
+                PLISTBOXDATA pData, int width)
+{
+    PLISTBOXITEM plbi;
+    int i;
+    int x = 0, y = 0;
+    int offset;
+    RECT rc;
+    COLORREF bk;
+
+    plbi = lstGetItem (pData, pData->itemTop);
+    
+    for (i = 0; plbi && i < (pData->itemVisibles + 1); i++) {
+
+        if (plbi->dwFlags & LBIF_SELECTED) {
+            SetBkColor (hdc, bk = BLUE);
+            SetTextColor (hdc, WHITE);
+        }
+        else {
+            SetBkColor (hdc, bk = WHITE);
+            SetTextColor (hdc, BLACK);
+        }
+	rc.left = 0;
+	rc.top = y;
+	rc.right = width;
+	rc.bottom = y + pData->itemHeight;
+	FastFillRect(hdc, &rc, bk);
+
+        if (dwStyle & LBS_CHECKBOX) {
+            x = LST_INTER_BMPTEXT;
+            if (plbi->dwFlags & LBIF_CHECKED)
+                offset = 0;
+            else if (plbi->dwFlags & LBIF_PARTCHECKED)
+                offset = LST_WIDTH_CHECKMARK << 1;
+            else
+                offset = LST_WIDTH_CHECKMARK;
+#if 0//fix: no bitmap            
+            FillBoxWithBitmapPart (hdc, 
+                x, y + ((pData->itemHeight - LST_HEIGHT_CHECKMARK)>>1),
+                LST_WIDTH_CHECKMARK, LST_HEIGHT_CHECKMARK,
+                0, 0,
+                &sg_bmpCheckMark,
+                offset, 0);
+#endif
+            x += LST_WIDTH_CHECKMARK + LST_INTER_BMPTEXT;
+        }
+#if 0//fix: no icon
+        if (dwStyle & LBS_USEICON && plbi->dwData) {
+            DrawIcon (hdc, 
+                x, y, pData->itemHeight, pData->itemHeight, 
+                (HICON) plbi->dwData);
+            x += pData->itemHeight + LST_INTER_BMPTEXT;
+        }
+#endif
+
+//jmt: should be SYSTEM_FIXED_FONT because of minigui's GetSysCharXXX()
+	//-SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
+	SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
+        TextOut (hdc, x+2, y, plbi->key,-1);
+
+        y += pData->itemHeight;
+        plbi = plbi->next;
+    }
+}
+
+static int lstSelectItem (DWORD dwStyle, PLISTBOXDATA pData, int newSel)
+{
+    PLISTBOXITEM plbi, newItem;
+    int index;
+    
+    newItem = lstGetItem (pData, newSel);
+#if 1//jmt: fixed if no item added
+    if (!newItem) return -1;
+#endif 
+#ifdef _DEBUG
+    if (!newItem)
+        fprintf (stderr, "ASSERT failed: return value of lstGetItem"
+                         " in lstSelectItem.\n");
+#endif
+
+    if (dwStyle & LBS_MULTIPLESEL) {
+        newItem->dwFlags ^= LBIF_SELECTED;
+        return newSel;
+    }
+
+    index = 0;
+    plbi = pData->head;
+    while (plbi) {
+        if (plbi->dwFlags & LBIF_SELECTED) {
+            if (index != newSel) {
+                plbi->dwFlags &= ~LBIF_SELECTED;
+                newItem->dwFlags |= LBIF_SELECTED;
+                return index;
+            }
+            break;
+        }
+
+        plbi = plbi->next;
+        index ++;
+    }
+
+    newItem->dwFlags |= LBIF_SELECTED;
+    return -1;
+}
+
+static void lstDrawFocusRect (HDC hdc, PLISTBOXDATA pData, RECT* rc)
+{
+    HGDIOBJ oldbrush,oldpen;
+
+    if (pData->itemHilighted < pData->itemTop
+            || pData->itemHilighted > (pData->itemTop + pData->itemVisibles))
+        return;
+
+    if (pData->dwFlags & LBF_FOCUS) {
+        lstGetItemsRect (pData, pData->itemHilighted, pData->itemHilighted, rc);
+        //InflateRect (rc, -1, -1);
+#if 0
+        FocusRect (hdc, rc->left - 1, rc->top, rc->right, rc->bottom);
+#else
+	oldbrush=SelectObject(hdc, GetStockObject(NULL_BRUSH));
+	oldpen=SelectObject(hdc, CreatePen(PS_SOLID, 1,
+				GetSysColor(COLOR_BTNHIGHLIGHT)));
+	//GdSetMode(MWMODE_XOR);
+        Rectangle (hdc, rc->left, rc->top, rc->right, rc->bottom);
+	//GdSetMode(MWMODE_SET);
+	SelectObject(hdc,oldbrush);
+	DeleteObject(SelectObject(hdc,oldpen));
+#endif
+    }
+}
+
+static void lstCalcParams (const RECT* rcClient, PLISTBOXDATA pData)
+{
+#define RECTHP(prc)  (prc->bottom - prc->top)
+    pData->itemVisibles = (RECTHP (rcClient)) / pData->itemHeight;
+
+#if 1//test calculation of itemVisibles
+    if( ((RECTHP (rcClient)) % pData->itemHeight) )
+    	pData->itemVisibles++;
+#endif
+}
+
+extern BOOL SetScrollPos (HWND hWnd, int iSBar, int iNewPos);
+extern BOOL EnableScrollBar (HWND hWnd, int iSBar, BOOL bEnable);
+
+static void lstSetVScrollInfo (HWND hwnd, PLISTBOXDATA pData, BOOL fRedraw)//ok
+{
+    SCROLLINFO si;
+
+    if (pData->itemVisibles >= pData->itemCount) 
+    {
+        SetScrollPos (hwnd, SB_VERT, 0);
+        EnableScrollBar (hwnd, SB_VERT, FALSE);
+        return;
+    }
+    
+    si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
+    si.nMax = pData->itemCount - 1;
+    si.nMin = 0;
+    si.nPage = min (pData->itemVisibles, (pData->itemCount - pData->itemTop));
+    si.nPos = pData->itemTop;
+
+    SetScrollInfo (hwnd, SB_VERT, &si, fRedraw);
+    EnableScrollBar (hwnd, SB_VERT, TRUE);
+}
+
+LRESULT CALLBACK
+ListboxCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    HDC             hdc;
+    HWND	    pCtrl;
+    PLISTBOXDATA    pData;
+    DWORD           dwStyle;
+    
+    pCtrl   = hwnd;
+    dwStyle = pCtrl->style;
+
+    switch (message)
+    {
+        case WM_CREATE:
+            pData = (LISTBOXDATA*) malloc (sizeof(LISTBOXDATA));
+            if (pData == NULL) 
+                return -1;
+
+            pCtrl->userdata = (DWORD)pData;
+            if (!lstInitListBoxData (hwnd, pData, DEF_LB_BUFFER_LEN)) {
+                free (pData);
+                return -1;
+            }
+        break;
+
+	case WM_SIZE:
+	{
+	    RECT rc;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+	    GetClientRect(hwnd, &rc);
+            lstCalcParams (&rc, pData);
+	}
+        break;
+
+        case WM_DESTROY:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            lstListBoxCleanUp (pData);
+            free (pData);
+        break;
+
+        case LB_RESETCONTENT:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            lstResetListBoxContent (pData);
+            InvalidateRect (hwnd, NULL, TRUE);
+        break;
+        
+        case LB_ADDSTRING:
+        case LB_INSERTSTRING:
+        {
+            char* string = NULL;
+            PLISTBOXITEMINFO plbii = NULL;
+            PLISTBOXITEM newItem;
+            int pos;
+           
+            if (dwStyle & LBS_CHECKBOX || dwStyle & LBS_USEICON) {
+                plbii = (PLISTBOXITEMINFO)lParam;
+                if (!plbii)
+                    return LB_ERR;
+
+                string = plbii->string;
+            }
+            else {
+                string = (char*)lParam;
+                if (string == NULL || string [0] == '\0')
+                    return LB_ERR;
+            }
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            newItem = lstAllocItem (pData);
+            if (!newItem) {
+                NotifyParent (hwnd, pCtrl->id, LBN_ERRSPACE);
+                return LB_ERRSPACE;
+            }
+
+            newItem->key = FixStrAlloc (strlen (string));
+            strcpy (newItem->key, string);
+            newItem->dwFlags = LBIF_NORMAL;
+            if (plbii) {
+                switch (plbii->cmFlag) {
+                    case CMFLAG_CHECKED:
+                        newItem->dwFlags |= LBIF_CHECKED;
+                    break;
+                    case CMFLAG_PARTCHECKED:
+                        newItem->dwFlags |= LBIF_PARTCHECKED;
+                    break;
+                }
+                
+                if (dwStyle & LBS_USEICON)
+                    newItem->dwData = (DWORD)plbii->hIcon;
+                else
+                    newItem->dwData = 0L;
+            }
+            newItem->dwAddData = 0L;
+
+            if (message == LB_ADDSTRING)
+                pos = lstAddNewItem (dwStyle, pData, newItem, -1);
+            else
+                pos = lstAddNewItem (dwStyle, pData, newItem, (int)wParam);
+
+            lstInvalidateUnderItem (hwnd, pData, pos);
+
+            lstSetVScrollInfo (hwnd, pData, TRUE);
+
+            return pos;
+        }
+        break;
+        
+        case LB_DELETESTRING:
+        {
+            PLISTBOXITEM removed;
+            int delete;
+
+            delete = (int)wParam;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            removed = lstRemoveItem (pData, &delete);
+            if (removed) {
+                FreeFixStr (removed->key);
+                lstFreeItem (pData, removed);
+                
+                pData->itemCount --;
+
+                if (pData->itemTop != 0 
+                        && pData->itemCount <= pData->itemVisibles) {
+                    pData->itemTop = 0;
+                    InvalidateRect (hwnd, NULL, TRUE);
+                }
+                else {
+                    lstInvalidateUnderItem (hwnd, pData, delete);
+                    if (delete <= pData->itemTop) {
+                        pData->itemTop --;
+                        if (pData->itemTop < 0)
+                            pData->itemTop = 0;
+                    }
+                }
+
+                if (pData->itemHilighted >= pData->itemCount) {
+                    pData->itemHilighted = pData->itemCount - 1;
+                    if (pData->itemHilighted < 0)
+                        pData->itemHilighted = 0;
+                }
+
+                if (pData->itemHilighted < pData->itemTop)
+                    pData->itemHilighted = pData->itemTop;
+                if (pData->itemHilighted > ITEM_BOTTOM (pData))
+                    pData->itemHilighted = ITEM_BOTTOM (pData);
+             
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+            }
+        }
+        break;
+
+        case LB_FINDSTRING:
+            if( *(char*)lParam == '\0' )
+                return LB_ERR;
+                
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return lstFindItem(pData, (int)wParam, (char*)lParam, FALSE);
+
+        case LB_FINDSTRINGEXACT:
+            if( *(char*)lParam == '\0' )
+                return LB_ERR;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return lstFindItem(pData, (int)wParam, (char*)lParam, TRUE);
+    
+        case LB_SETTOPINDEX:
+        {
+            int newTop = (int) wParam;
+            
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+            if (newTop <0)
+                newTop = 0;
+            else if (newTop > pData->itemCount - pData->itemVisibles)
+                newTop = pData->itemCount - pData->itemVisibles;
+                
+            if (pData->itemTop != newTop) {
+                pData->itemTop = newTop;
+
+                if (pData->itemHilighted < pData->itemTop)
+                    pData->itemHilighted = pData->itemTop;
+                if (pData->itemHilighted > ITEM_BOTTOM (pData))
+                    pData->itemHilighted = ITEM_BOTTOM (pData);
+
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+
+                InvalidateRect (hwnd, NULL, TRUE);
+            }
+        }
+        break;
+    
+        case LB_SETCURSEL:
+        case LB_SETCARETINDEX:
+        {
+            int new = (int)wParam;
+            int old, newTop;
+            
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (new < 0 || new > pData->itemCount - 1)
+                return LB_ERR;
+
+            old = pData->itemHilighted;
+            if (new >= 0 && new != old) {
+                if (pData->itemCount - new >= pData->itemVisibles)
+                    newTop = new;
+                else
+                    newTop = max (pData->itemCount - pData->itemVisibles, 0);
+
+                pData->itemTop = newTop;
+                pData->itemHilighted = new;
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+            }
+
+            if (!(dwStyle & LBS_MULTIPLESEL))
+                lstSelectItem (dwStyle, pData, new);
+            InvalidateRect (hwnd, NULL, TRUE);
+
+            return old;
+        }
+        break;
+    
+        case LB_GETCOUNT:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return pData->itemCount;
+        break;
+    
+        case LB_GETCURSEL:
+        {
+            PLISTBOXITEM plbi;
+            int index = 0;
+            
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (dwStyle & LBS_MULTIPLESEL)
+                return pData->itemHilighted;
+
+            plbi = pData->head;
+            while (plbi) {
+                if (plbi->dwFlags & LBIF_SELECTED)
+                    return index;
+
+                index ++;
+                plbi = plbi->next;
+           }
+           
+           return LB_ERR;
+        }
+        break;
+    
+        case LB_GETSELCOUNT:
+        {
+            int nSel;
+            PLISTBOXITEM plbi;
+            
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+            nSel = 0;
+            plbi = pData->head;
+            while (plbi) {
+                if (plbi->dwFlags & LBIF_SELECTED)
+                    nSel ++;
+                plbi = plbi->next;
+            }
+            
+            return nSel;
+        }
+        break;
+    
+        case LB_GETTOPINDEX:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return pData->itemTop;
+        break;
+    
+        case LB_GETCARETINDEX:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return pData->itemHilighted;
+        break;
+
+        case LB_GETTEXTLEN:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = lstGetItem (pData, (int)wParam);
+            if (plbi)
+                return strlen (plbi->key);
+            else
+                return LB_ERR;
+        }
+        break;
+        
+        case LB_GETTEXT:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = lstGetItem (pData, (int)wParam);
+            if (plbi)
+                strcpy ((char*)lParam, plbi->key);
+            else
+                return LB_ERR;
+        }
+        break;
+
+        case LB_SETTEXT:
+        {
+            PLISTBOXITEM plbi;
+            char* newStr;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = lstGetItem (pData, (int)wParam);
+            if (plbi) {
+                newStr = FixStrAlloc (strlen ((char*)lParam));
+                if (newStr) {
+                    FreeFixStr (plbi->key);
+                    plbi->key = newStr;
+                    strcpy (plbi->key, (char*)lParam);
+                    lstInvalidateItem (hwnd, pData, (int)wParam, TRUE);
+                }
+                else
+                    return LB_ERR;
+            }
+            else
+                return LB_ERR;
+        }
+        break;
+    
+        case LB_GETITEMDATA:
+        {
+            PLISTBOXITEM plbi;
+            PLISTBOXITEMINFO plbii;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            if (!(dwStyle & LBS_CHECKBOX || dwStyle & LBS_USEICON)) {
+                return plbi->dwData;
+            }
+            
+            plbii = (PLISTBOXITEMINFO)lParam;
+            if (!plbii)
+                return LB_ERR;
+
+            if (plbi->dwFlags & LBIF_CHECKED)
+                plbii->cmFlag = CMFLAG_CHECKED;
+            else if (plbi->dwFlags & LBIF_PARTCHECKED)
+                plbii->cmFlag = CMFLAG_PARTCHECKED;
+            else
+                plbii->cmFlag = CMFLAG_BLANK;
+            plbii->hIcon = (HICON)plbi->dwData;
+
+            return LB_OKAY;
+        }
+        break;
+    
+        case LB_SETITEMDATA:
+        {
+            PLISTBOXITEM plbi;
+            PLISTBOXITEMINFO plbii;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            if (!(dwStyle & LBS_CHECKBOX || dwStyle & LBS_USEICON)) {
+                plbi->dwData = (DWORD)lParam;
+                return LB_OKAY;
+            }
+
+            plbii = (PLISTBOXITEMINFO)lParam;
+            if (!plbii)
+                return LB_ERR;
+
+            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+            switch (plbii->cmFlag) {
+                case CMFLAG_CHECKED:
+                    plbi->dwFlags |= LBIF_CHECKED;
+                break;
+                case CMFLAG_PARTCHECKED:
+                    plbi->dwFlags |= LBIF_PARTCHECKED;
+                break;
+            }
+                
+            if (dwStyle & LBS_USEICON)
+                plbi->dwData = (DWORD)plbii->hIcon;
+            else
+                plbi->dwData = 0;
+            
+            lstInvalidateItem (hwnd, pData, (int)wParam, TRUE);
+
+            return LB_OKAY;
+        }
+        break;
+        
+        case LB_GETITEMADDDATA:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            return plbi->dwAddData;
+        }
+        break;
+    
+        case LB_SETITEMADDDATA:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            plbi->dwAddData = (DWORD)lParam;
+
+            return LB_OKAY;
+        }
+        break;
+        
+        case LB_GETCHECKMARK:
+        {
+            PLISTBOXITEM plbi;
+
+            if (!(dwStyle & LBS_CHECKBOX))
+                return LB_ERR;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            if (plbi->dwFlags & LBIF_CHECKED)
+                return CMFLAG_CHECKED;
+
+            if (plbi->dwFlags & LBIF_PARTCHECKED)
+                return CMFLAG_PARTCHECKED;
+
+            return CMFLAG_BLANK;
+        }
+        break;
+
+        case LB_SETCHECKMARK:
+        {
+            PLISTBOXITEM plbi;
+
+            if (!(dwStyle & LBS_CHECKBOX))
+                return LB_ERR;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (!(plbi = lstGetItem (pData, (int)wParam)))
+                return LB_ERR;
+
+            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+            switch (lParam) {
+                case CMFLAG_CHECKED:
+                    plbi->dwFlags |= LBIF_CHECKED;
+                break;
+                case CMFLAG_PARTCHECKED:
+                    plbi->dwFlags |= LBIF_PARTCHECKED;
+                break;
+            }
+                
+            lstInvalidateItem (hwnd, pData, (int)wParam, TRUE);
+
+            return LB_OKAY;
+        }
+        break;
+
+        case LB_GETSELITEMS:
+        {
+            int  nItem;
+            int  nSel = 0;
+            int  index = 0;
+            int* pInt;
+            PLISTBOXITEM plbi;
+
+            nItem = (int)wParam;
+            pInt  = (int*)lParam;
+            
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = pData->head;
+            while (plbi) {
+
+                if (plbi->dwFlags & LBIF_SELECTED) {
+                    if (pInt) {
+                        if (nSel < nItem)
+                            *(pInt + nSel) = index;
+                        else 
+                            return nItem;
+                    }
+                    nSel ++;
+                }
+                
+                plbi = plbi->next;
+                index ++;
+            }
+            
+            return nSel;
+        }
+        break;
+    
+        case LB_GETSEL:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = lstGetItem (pData, (int)wParam);
+            if (plbi)
+                return plbi->dwFlags & LBIF_SELECTED;
+            else
+                return LB_ERR;
+        }
+        break;
+
+        case LB_SETSEL:
+        {
+            PLISTBOXITEM plbi;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            plbi = lstGetItem (pData, (int)lParam);
+            if (plbi) {
+		pData->dwFlags &= ~LBF_NOTHINGSELECTED;
+                if (wParam == -1)
+                    plbi->dwFlags ^= LBIF_SELECTED;
+                else if (wParam == 0)
+                    plbi->dwFlags &= ~LBIF_SELECTED;
+                else
+                    plbi->dwFlags |= LBIF_SELECTED;
+
+                lstInvalidateItem (hwnd, pData, (int)lParam, FALSE);
+            }
+            else
+                return LB_ERR;
+        }
+        break;
+    
+        case LB_GETITEMHEIGHT:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            return pData->itemHeight;
+        break;
+    
+        case LB_SETITEMHEIGHT:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (pData->itemHeight != LOWORD (lParam)) {
+                RECT rcClient;
+                
+                pData->itemHeight = LOWORD (lParam);
+                GetClientRect (hwnd, &rcClient);
+                lstCalcParams (&rcClient, pData);
+                
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+                InvalidateRect (hwnd, NULL, TRUE);
+            }
+        break;
+
+        case WM_SETFOCUS:
+        {
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+            if (pData->dwFlags & LBF_FOCUS)
+                break;
+                
+            pData->dwFlags |= LBF_FOCUS;
+	    InvalidateRect(hwnd, NULL, TRUE);
+
+            NotifyParent (hwnd, pCtrl->id, LBN_SETFOCUS);
+        }
+        break;
+        
+        case WM_KILLFOCUS:
+        {
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+            pData->dwFlags &= ~LBF_FOCUS;
+	    InvalidateRect(hwnd, NULL, TRUE);
+
+            NotifyParent (hwnd, pCtrl->id, LBN_KILLFOCUS);
+        }
+        break;
+
+        case WM_GETDLGCODE:
+            return DLGC_WANTARROWS | DLGC_WANTCHARS;
+
+        case WM_GETTEXTLENGTH:
+        case WM_GETTEXT:
+        case WM_SETTEXT:
+            return -1;
+#if 0            
+	case WM_SETFONT:
+        break;
+        
+	case WM_GETFONT:
+        break;
+#endif        
+	case WM_NCCALCSIZE:
+	{
+		LPNCCALCSIZE_PARAMS lpnc;
+
+		/* calculate client rect from passed window rect in rgrc[0]*/
+		lpnc = (LPNCCALCSIZE_PARAMS)lParam;
+		if(GetWindowLong(hwnd, GWL_STYLE) & WS_BORDER)
+			InflateRect(&lpnc->rgrc[0], -2, -2);
+	}
+		break;
+
+        case WM_NCPAINT:
+	{
+	    RECT rc;
+
+            hdc = wParam? (HDC)wParam: GetWindowDC (hwnd);
+	    GetWindowRect(hwnd, &rc);
+
+            if (dwStyle & WS_BORDER)
+		Draw3dInset(hdc, rc.left, rc.top,
+			rc.right-rc.left, rc.bottom-rc.top);
+
+            if (!wParam)
+                ReleaseDC (hwnd, hdc);
+	}
+            break;
+
+        case WM_PAINT:
+        {
+            RECT rc;
+	    PAINTSTRUCT ps;
+            
+            hdc = BeginPaint (hwnd,&ps);
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+	    /*
+	     * If this is the first paint and there's nothing
+	     * selected, then auto select the topmost displayed item.
+	     */
+	    if (pData->dwFlags & LBF_NOTHINGSELECTED) {
+		    lstSelectItem (hwnd->style, pData, pData->itemTop);
+		    pData->dwFlags &= ~LBF_NOTHINGSELECTED;
+	    }
+            GetClientRect (hwnd, &rc);
+            lstOnDrawSListBoxItems (hdc, dwStyle, pData, rc.right-rc.left);
+            lstDrawFocusRect (hdc, pData, &rc);
+
+            EndPaint (hwnd, &ps);
+        }
+        break;
+    
+        case WM_LBUTTONDBLCLK:
+            if (dwStyle & LBS_NOTIFY)
+                NotifyParent (hwnd, pCtrl->id, LBN_DBLCLK);
+        break;
+    
+        case WM_LBUTTONDOWN:
+        {
+            int oldSel, mouseX, mouseY, hit;
+            RECT rcInv;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            if (pData->itemCount == 0)
+                break;
+
+            mouseX = LOWORD (lParam);
+            mouseY = HIWORD (lParam);
+            hit = mouseY / pData->itemHeight;
+            hit += pData->itemTop;
+            
+            if (hit >= pData->itemCount)
+                break;
+
+            GetClientRect (hwnd, &rcInv);
+            oldSel = lstSelectItem (dwStyle, pData, hit);
+            if ((dwStyle & LBS_NOTIFY) && (oldSel != hit))
+                NotifyParent (hwnd, pCtrl->id, LBN_SELCHANGE);
+            if (oldSel >= 0) {
+                if (oldSel >= pData->itemTop 
+                        && (oldSel <= pData->itemTop + pData->itemVisibles)) {
+                    lstGetItemsRect (pData, oldSel, oldSel, &rcInv);
+                    InvalidateRect (hwnd, &rcInv, TRUE);
+                }
+            }
+
+            lstGetItemsRect (pData, hit, hit, &rcInv);
+            InvalidateRect (hwnd, &rcInv, TRUE);
+
+            if (pData->itemHilighted != hit) 
+	    {
+                hdc = GetDC(hwnd); //hdc = GetClientDC (hwnd);
+
+                lstDrawFocusRect (hdc, pData, &rcInv);
+                ReleaseDC (hwnd,hdc);
+            }
+            pData->itemHilighted = hit;
+
+            if (dwStyle & LBS_CHECKBOX) {
+                if (mouseX > 0 && mouseX < LST_WIDTH_CHECKMARK) {
+                    NotifyParent (hwnd, pCtrl->id, LBN_CLICKCHECKMARK);//?
+                    
+                    if (dwStyle & LBS_AUTOCHECK) {
+                        PLISTBOXITEM plbi;
+
+                        plbi = lstGetItem (pData, hit);
+
+                        switch (plbi->dwFlags & LBIF_CHECKMARKMASK) {
+                        case LBIF_CHECKED:
+                            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+                            break;
+                        default:
+                            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+                            plbi->dwFlags |= LBIF_CHECKED;
+                            break;
+                        }
+                
+                        lstInvalidateItem (hwnd, pData, hit, TRUE);
+                    }
+                }
+            }
+            
+            lstSetVScrollInfo (hwnd, pData, TRUE);
+        }
+        break;
+    
+        case WM_LBUTTONUP:
+        break;
+    
+        case WM_MOUSEMOVE:
+        break;
+
+        case WM_KEYDOWN:
+        {
+            int oldSel, newSel, newTop;
+            RECT rcInv;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            newTop = pData->itemTop;
+            newSel = pData->itemHilighted;
+            switch (LOWORD (wParam))
+            {
+                case VK_HOME://SCANCODE_HOME:
+                    newSel = 0;
+                    newTop = 0;
+                break;
+                
+                case VK_END://SCANCODE_END:
+                    newSel = pData->itemCount - 1;
+                    if (pData->itemCount > pData->itemVisibles)
+                        newTop = pData->itemCount - pData->itemVisibles;
+                    else
+                        newTop = 0;
+                break;
+                
+                case VK_DOWN://SCANCODE_CURSORBLOCKDOWN:
+                    newSel ++;
+                    if (newSel >= pData->itemCount)
+                        return 0;
+                    if (newSel > ITEM_BOTTOM (pData))
+                        newTop ++;
+                break;
+                
+                case VK_UP://SCANCODE_CURSORBLOCKUP:
+                    newSel --;
+                    if (newSel < 0)
+                        return 0;
+                    if (newSel < pData->itemTop)
+                        newTop --;
+                break;
+                
+                case VK_NEXT://SCANCODE_PAGEDOWN:
+                    newSel += pData->itemVisibles;
+                    if (newSel >= pData->itemCount)
+                        newSel = pData->itemCount - 1;
+                        
+                    if (pData->itemCount - newSel >= pData->itemVisibles)
+                        newTop = newSel;
+                    else
+                        newTop = max (pData->itemCount-pData->itemVisibles, 0);
+                break;
+
+                case VK_PRIOR://SCANCODE_PAGEUP:
+                    newSel -= pData->itemVisibles;
+                    if (newSel < 0)
+                        newSel = 0;
+                        
+                    newTop -= pData->itemVisibles;
+                    if (newTop < 0)
+                        newTop = 0;
+                break;
+                
+                default:
+                return 0;
+            }
+
+            GetClientRect (hwnd, &rcInv);
+            if (pData->itemHilighted != newSel) {
+                if (pData->itemTop != newTop) {
+                    pData->itemTop = newTop;
+                    pData->itemHilighted = newSel;
+                    if (!(dwStyle & LBS_MULTIPLESEL)) {
+                        oldSel = lstSelectItem (dwStyle, pData, newSel);
+                        if ((dwStyle & LBS_NOTIFY) && (oldSel != newSel))
+                            NotifyParent (hwnd, pCtrl->id, LBN_SELCHANGE);
+                    }
+                    InvalidateRect (hwnd, NULL, TRUE);
+                }
+                else {
+                    if (!(dwStyle & LBS_MULTIPLESEL)) {
+                        oldSel = lstSelectItem (dwStyle, pData, newSel);
+                        if ((dwStyle & LBS_NOTIFY) && (oldSel != newSel))
+                            NotifyParent (hwnd, pCtrl->id, LBN_SELCHANGE);
+                        if (oldSel >= 0) {
+                            if (oldSel >= pData->itemTop 
+                                    && oldSel <= (ITEM_BOTTOM (pData) + 1)) {
+                                lstGetItemsRect (pData, oldSel, oldSel, &rcInv);
+                                InvalidateRect (hwnd, &rcInv, TRUE);
+                            }
+                        }
+                        
+                        if (newSel < newTop) {
+                            pData->itemHilighted = newSel;
+                            break;
+                        }
+                            
+                        lstGetItemsRect (pData, pData->itemHilighted,
+                                                pData->itemHilighted, &rcInv);
+
+                	hdc = GetDC(hwnd); //hdc = GetClientDC (hwnd);
+
+                        lstDrawFocusRect (hdc, pData, &rcInv);
+                        ReleaseDC (hwnd,hdc);
+                        
+                        pData->itemHilighted = newSel;
+                        lstGetItemsRect (pData, newSel, newSel, &rcInv);
+                        InvalidateRect (hwnd, &rcInv, TRUE);
+                    }
+                    else 
+		    {
+                	hdc = GetDC(hwnd); //hdc = GetClientDC (hwnd);
+
+                        lstDrawFocusRect (hdc, pData, &rcInv);
+                        pData->itemHilighted = newSel;
+                        GetClientRect (hwnd, &rcInv);
+                        lstDrawFocusRect (hdc, pData, &rcInv);
+                        ReleaseDC (hwnd,hdc);
+                    }
+                }
+                lstSetVScrollInfo (hwnd, pData, TRUE);//
+            }
+        }
+        break;
+
+        case WM_CHAR:
+        {
+            char head [2];
+            int index;
+            int newTop;
+            
+            head [0] = (char) (wParam);
+            head [1] = '\0';
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+
+            if (head[0] == ' ') {
+                if (dwStyle & LBS_MULTIPLESEL) {
+                    RECT rcInv;
+                    
+                    GetClientRect (hwnd, &rcInv);
+                    lstSelectItem (dwStyle, pData, pData->itemHilighted);
+                    lstGetItemsRect (pData, 
+                            pData->itemHilighted, 
+                            pData->itemHilighted,
+                            &rcInv);
+                    InvalidateRect (hwnd, &rcInv, TRUE);
+                }
+                else if (dwStyle & LBS_CHECKBOX) {
+                    NotifyParent (hwnd, pCtrl->id, LBN_CLICKCHECKMARK);
+                    
+                    if (dwStyle & LBS_AUTOCHECK) {
+                        PLISTBOXITEM plbi;
+
+                        plbi = lstGetItem (pData, pData->itemHilighted);
+
+                        switch (plbi->dwFlags & LBIF_CHECKMARKMASK) {
+                        case LBIF_CHECKED:
+                            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+                            break;
+                        default:
+                            plbi->dwFlags &= ~LBIF_CHECKMARKMASK;
+                            plbi->dwFlags |= LBIF_CHECKED;
+                            break;
+                        }
+                
+                        lstInvalidateItem (hwnd, pData, 
+                                pData->itemHilighted, TRUE);
+                    }
+                }
+                break;
+            }
+
+            index = lstFindItem (pData, pData->itemHilighted + 1, head, FALSE);
+            if (index < 0) {
+                index = lstFindItem (pData, 0, head, FALSE);
+            }
+
+            if (index >= 0) {
+                if (pData->itemCount - index >= pData->itemVisibles)
+                    newTop = index;
+                else
+                    newTop = max (pData->itemCount - pData->itemVisibles, 0);
+
+                pData->itemTop = newTop;
+                pData->itemHilighted = index;
+                if (!(dwStyle & LBS_MULTIPLESEL))
+                    lstSelectItem (dwStyle, pData, index);
+                InvalidateRect (hwnd, NULL, TRUE);
+
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+            }
+        }
+        break;
+ 
+        case WM_VSCROLL:
+        {
+            int newTop;
+            int scrollHeight = 0;
+
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            newTop = pData->itemTop;
+            switch(wParam)
+            {
+                case SB_LINEDOWN:
+
+#if 0//test itemVisibles
+		    printf("itemVisibles:%d\n",pData->itemVisibles);
+		    printf("SB_LINEDOWN:(%d:%d)\n",
+                    	ITEM_BOTTOM (pData),(pData->itemCount - 1 )); 
+#endif
+                    if (ITEM_BOTTOM (pData) < (pData->itemCount - 1 )) 
+		    {
+                        newTop ++;
+                        scrollHeight = -pData->itemHeight;//for ScrollWindow()
+                    }
+                break;
+                
+                case SB_LINEUP:
+                    if (pData->itemTop > 0) 
+		    {
+                        newTop --;
+                        scrollHeight = pData->itemHeight;
+                    }
+                break;
+                
+                case SB_PAGEDOWN:
+                    if ((pData->itemTop + (pData->itemVisibles << 1)) <=
+                            pData->itemCount)
+                        newTop += pData->itemVisibles;
+                    else
+                        newTop = pData->itemCount - pData->itemVisibles;
+
+                    if (newTop < 0)
+                        return 0;
+
+                    scrollHeight = -(newTop - pData->itemTop)
+                                    *pData->itemHeight;
+                break;
+
+                case SB_PAGEUP:
+                    if (pData->itemTop >= pData->itemVisibles)
+                        newTop -= pData->itemVisibles;
+                    else
+                        newTop = 0;
+
+                    scrollHeight = (pData->itemTop - newTop)*pData->itemHeight;
+                break;
+
+                case SB_THUMBTRACK:
+                    newTop = (int)lParam;
+                    scrollHeight = (pData->itemTop - newTop)*pData->itemHeight;
+                break;
+            }
+            
+            if (scrollHeight) 
+	    {
+                pData->itemTop = newTop;
+#if 0//!!: fix: no scroll
+                ScrollWindow (hwnd, 0, scrollHeight, NULL, NULL);
+#endif
+                SendMessage (hwnd, WM_PAINT, 0, 0);
+
+                lstSetVScrollInfo (hwnd, pData, TRUE);
+
+                return 0;
+            }
+        }
+        break;
+
+	case WM_HSCROLL:
+            pData = (PLISTBOXDATA)pCtrl->userdata;
+            switch (wParam)
+            {
+                case SB_LINERIGHT:
+                break;
+                
+                case SB_LINELEFT:
+                break;
+                
+                case SB_PAGELEFT:
+                break;
+                
+                case SB_PAGERIGHT:
+                break;
+            }
+        break;
+
+        default:
+    		return DefWindowProc (hwnd, message, wParam, lParam);
+    }
+    return 0;
+}
diff -urN lib/microwindows/src/mwin/winlib/medit.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/medit.c
--- lib/microwindows/src/mwin/winlib/medit.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/medit.c	2005-02-21 16:13:26.000000000 +0100
@@ -0,0 +1,1784 @@
+// $Id: medit.c,v 1.5 2000/08/08 01:20:34 kevin Exp $
+//
+// medit.c: the Multi Line Edit Control module.
+//
+// Copyright (C) 1999, 2000, Wei Yongming.
+// 
+// Current maintainer: Wei Yongming.
+//
+
+/*
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Library General Public
+**  License as published by the Free Software Foundation; either
+**  version 2 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Library General Public License for more details.
+**
+**  You should have received a copy of the GNU Library General Public
+**  License along with this library; if not, write to the Free
+**  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+**  MA 02111-1307, USA
+*/
+
+/*
+**  Alternatively, the contents of this file may be used under the terms 
+**  of the Mozilla Public License (the "MPL License") in which case the
+**  provisions of the MPL License are applicable instead of those above.
+*/
+
+// Note:
+//  Although there was a version by Zhao Jianghua, this version of
+//  EDIT control is written by Wei Yongming from scratch.
+//
+// Create date: 1999/8/26
+//
+// Modify records:
+//
+//  Who             When        Where       For What                Status
+//-----------------------------------------------------------------------------
+//  WEI Yongming    2000/02/24  Tsinghua    Add MPL License         Finished
+//  Kevin Tseng     2000/08/30  gv          port to microwin        ported
+//
+//
+// TODO:
+//    * Selection.
+//    * Undo.
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define MWINCLUDECOLORS
+#include "windows.h"	/* windef.h, winuser.h */
+#include "wintools.h"
+#include "device.h" 	/* GdGetTextSize */
+
+#include <sys/time.h>
+
+#define WIDTH_MEDIT_BORDER       2
+#define MARGIN_MEDIT_LEFT        1
+#define MARGIN_MEDIT_TOP         1
+#define MARGIN_MEDIT_RIGHT       2
+#define MARGIN_MEDIT_BOTTOM      1
+
+#define LEN_MLEDIT_BUFFER       3000
+#define LEN_MLEDIT_UNDOBUFFER   1024
+
+#define EST_FOCUSED     0x00000001L
+#define EST_MODIFY      0x00000002L
+#define EST_READONLY    0x00000004L
+#define EST_REPLACE     0x00000008L
+
+#define MEDIT_OP_NONE    0x00
+#define MEDIT_OP_DELETE  0x01
+#define MEDIT_OP_INSERT  0x02
+#define MEDIT_OP_REPLACE 0x03
+
+#define USE_BIG5
+
+/*typedef struct tagMLEDITDATA
+{
+    int     bufferLen;      // length of buffer
+
+    int     dataEnd;        // data end position
+    int     editPos;        // current edit position
+	int     editLine;		// current eidt line
+    int     caretOff;       // caret offset in box
+	int     caretLine;
+    int     startPos;       // start display position
+    
+    int     selStart;       // selection start position
+	int     selStartLine;   // selection start line
+    int     selEnd;         // selection end position
+	int     selEndLine;     // selection end line
+    
+    int     passwdChar;     // password character
+    
+    int     leftMargin;     // left margin
+    int     topMargin;      // top margin
+    int     rightMargin;    // right margin
+    int     bottomMargin;   // bottom margin
+    
+    int     hardLimit;      // hard limit
+
+    int     lastOp;         // last operation
+    int     lastPos;        // last operation position
+	int     lastLine;       // last operation line
+    int     affectedLen;    // affected len of last operation
+    int     undoBufferLen;  // undo buffer len
+    char    undoBuffer [LEN_MLEDIT_UNDOBUFFER];
+                            // Undo buffer;
+    
+    char    buffer [LEN_MLEDIT_BUFFER];
+                            // buffer
+}MLEDITDATA;
+typedef MLEDITDATA* PMLEDITDATA;
+  */  
+
+typedef struct tagLINEDATA
+{
+	int     lineNO;	                  // �к�
+	int     dataEnd; 
+	struct  tagLINEDATA *previous;    // ǰһ��
+	struct  tagLINEDATA *next;        // ��һ�� 
+	char    buffer[LEN_MLEDIT_BUFFER+1];
+}LINEDATA;
+typedef    LINEDATA*     PLINEDATA;
+
+#define ATTENG 0//english
+#define ATTCHL 1//chinese left(1st) byte
+#define ATTCHR 2//chinese right(2nd) byte
+static char attr[LEN_MLEDIT_BUFFER];
+
+typedef struct tagMLEDITDATA
+{
+    int     totalLen;      // length of buffer,����û����
+
+    int     editPos;        // current edit position
+    int     caretPos;       // caret offset in box
+	int     editLine;		// current eidt line
+	int     dispPos;        // ��ʼ��ʾ��λ��
+	int     StartlineDisp;  // start line displayed
+    int     EndlineDisp;    // end line displayed
+    int     linesDisp;      // ��Ҫ��ʾ������
+	int     lines;		    // �ܵ�����`
+	int     MaxlinesDisp;    // �����ʾ������.
+							
+    int     selStartPos;    // selection start position
+	int     selStartLine;   // selection start line
+    int     selEndPos;      // selection end position
+	int     selEndLine;     // selection end line
+    
+    int     passwdChar;     // password character
+    
+    int     leftMargin;     // left margin
+    int     topMargin;      // top margin
+    int     rightMargin;    // right margin
+    int     bottomMargin;   // bottom margin
+    
+    int     hardLimit;      // hard limit
+
+    int     lastOp;         // last operation
+    int     lastPos;        // last operation position
+	int     lastLine;       // last operation line
+    int     affectedLen;    // affected len of last operation
+    int     undoBufferLen;  // undo buffer len
+    char    undoBuffer [LEN_MLEDIT_UNDOBUFFER];
+                            // Undo buffer;
+   	PLINEDATA   head;       // buffer
+	PLINEDATA   tail;       // ���ܲ���Ҫ
+}MLEDITDATA;
+typedef MLEDITDATA* PMLEDITDATA;
+
+BOOL RegisterMLEditControl (void);
+
+int MLEditCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam);
+
+#define PIXEL_invalid (-1)
+extern HWND sg_hCaretWnd;
+extern HWND rootwp;
+
+static int GetSysCharHeight (HWND hwnd) 
+{
+#ifndef USE_BIG5	    
+	HDC 		hdc;
+    	int xw, xh, xb;
+
+    	hdc = GetDC(hwnd);
+	SelectObject(hdc, GetStockObject(DEFAULT_FONT));
+	GdSetFont(hdc->font->pfont);
+    	GdGetTextSize(hdc->font->pfont,"X",1, &xw,&xh,&xb,MWTF_ASCII);
+    	ReleaseDC(hwnd,hdc);
+
+	return xh;
+#else
+	return 12;
+#endif
+}
+
+static int GetSysCharWidth (HWND hwnd) 
+{
+#ifndef USE_BIG5	    
+	HDC 		hdc;
+    	int xw, xh, xb;
+
+    	hdc = GetDC(hwnd);
+	SelectObject(hdc, GetStockObject(DEFAULT_FONT));
+	GdSetFont(hdc->font->pfont);
+    	GdGetTextSize(hdc->font->pfont,"X",1, &xw,&xh,&xb,MWTF_ASCII);
+    	ReleaseDC(hwnd,hdc);
+
+	return xw;
+#else
+	return 6;
+#endif
+}
+
+static int GetSysCCharWidth (HWND hwnd)
+{
+	return (2*GetSysCharWidth(hwnd));
+}
+char* GetWindowCaption (HWND hWnd)//ok
+{
+    return hWnd->szTitle;
+}
+
+DWORD GetWindowAdditionalData (HWND hWnd)//ok
+{
+        return hWnd->userdata;
+}
+
+DWORD SetWindowAdditionalData (HWND hWnd, DWORD newData)//ok
+{
+    DWORD    oldOne = 0L;
+
+    oldOne = hWnd->userdata;
+    hWnd->userdata = newData;
+    
+    return oldOne;
+}
+
+DWORD GetWindowAdditionalData2 (HWND hWnd)//ok
+{
+        return hWnd->userdata2;
+}
+
+DWORD SetWindowAdditionalData2 (HWND hWnd, DWORD newData)//ok
+{
+    DWORD    oldOne = 0L;
+
+    oldOne = hWnd->userdata2;
+    hWnd->userdata2 = newData;
+    
+    return oldOne;
+}
+
+DWORD GetWindowStyle (HWND hWnd)//ok
+{
+        return hWnd->style;
+}
+
+BOOL ExcludeWindowStyle (HWND hWnd, DWORD dwStyle)//ok
+{
+    	if (hWnd == rootwp/*HWND_DESKTOP*/)
+        	return FALSE;
+
+        hWnd->style &= ~dwStyle;
+        return TRUE;
+}
+
+BOOL IncludeWindowStyle (HWND hWnd, DWORD dwStyle)//ok
+{
+
+    	if (hWnd == rootwp/*HWND_DESKTOP*/)
+        	return FALSE;
+
+        hWnd->style |= dwStyle;
+        return TRUE;
+}
+
+int WINAPI MwRegisterMEditControl(HINSTANCE hInstance)
+{
+	WNDCLASS	wc;
+
+	wc.style	= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
+	wc.lpfnWndProc	= (WNDPROC)MLEditCtrlProc;
+	wc.cbClsExtra	= 0;
+	wc.cbWndExtra	= 0;
+	wc.hInstance	= hInstance;
+	wc.hIcon	= NULL;
+	wc.hCursor	= 0; 
+	wc.hbrBackground= GetStockObject(WHITE_BRUSH);
+	wc.lpszMenuName	= NULL;
+	wc.lpszClassName= "MEDIT";
+
+	return RegisterClass(&wc);
+}
+
+static inline int edtGetOutWidth (HWND hWnd)
+{
+	PMLEDITDATA pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd);
+	RECT rc;
+	GetClientRect(hWnd,&rc);
+    return rc.right - rc.left 
+            - pMLEditData->leftMargin
+            - pMLEditData->rightMargin;
+}
+
+static int edtGetStartDispPosAtEnd (HWND hWnd,
+            PLINEDATA pLineData)
+{
+    int         nOutWidth = edtGetOutWidth (hWnd);
+    int         endPos  = pLineData->dataEnd;
+    PMLEDITDATA pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd);
+    int         newStartPos = pMLEditData->dispPos;
+    const char* buffer = pLineData->buffer;
+
+    if(endPos < newStartPos)
+		return 0;
+    while (TRUE) 
+    {
+        if ((endPos - newStartPos) * GetSysCharWidth (hWnd) < nOutWidth)
+            break;
+        
+        //1st:gb:a1-f7,big5:a1-f9 
+        if ((BYTE)buffer [newStartPos] > 0xA0)//ok 
+	{
+            newStartPos ++;
+            if (newStartPos < pLineData->dataEnd) 
+	    {
+#ifndef USE_BIG5
+                if ((BYTE)buffer [newStartPos] > 0xA0)//ok
+#else//2nd:gb:a1-fe,big5:40-7e,a1-fe
+                if ( ((BYTE)buffer [newStartPos] >= 0x40 && (BYTE)buffer[newStartPos] <= 0x7e) ||
+                     ((BYTE)buffer [newStartPos] >= 0xa1 && (BYTE)buffer[newStartPos] <= 0xfe)) 
+#endif
+                    newStartPos ++;
+            }
+        }
+        else
+            newStartPos ++;
+    }
+    return newStartPos;
+}
+
+static int edtGetDispLen (HWND hWnd,PLINEDATA pLineData)
+{
+    int i, n = 0;
+    int nOutWidth = edtGetOutWidth (hWnd);
+    int nTextWidth = 0;
+    PMLEDITDATA pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd);
+    const char* buffer = pLineData->buffer;
+    
+    if(buffer[0]==0||pLineData->dataEnd<pMLEditData->dispPos)
+		return 0;
+	
+    for (i = pMLEditData->dispPos; i < pLineData->dataEnd; i++) 
+    {
+        //1st:gb:a1-f7,big5:a1-f9 
+        if ((BYTE)buffer [i] > 0xA0)//ok 
+   	{
+            i++;
+            if (i < pLineData->dataEnd) 
+	    {
+#ifndef USE_BIG5
+                if ((BYTE)buffer [i] > 0xA0)//2nd:gb:a1-fe,big5:40-7e,a1-fe 
+#else//2nd:gb:a1-fe,big5:40-7e,a1-fe
+                if ( ((BYTE)buffer [i] >= 0x40 && (BYTE)buffer[i] <= 0x7e) ||
+                     ((BYTE)buffer [i] >= 0xa1 && (BYTE)buffer[i] <= 0xfe))
+#endif
+		{
+                    nTextWidth += GetSysCCharWidth (hWnd);
+                    n += 2;
+                }
+                else
+                    i--;
+            }
+            else 
+	    {
+                nTextWidth += GetSysCharWidth (hWnd);
+                n++;
+            }
+        }
+        else 
+	{
+            nTextWidth += GetSysCharWidth (hWnd);
+            n++;
+        }
+
+        if (nTextWidth > nOutWidth)
+            break;
+    }
+
+    return n;
+}
+
+static int edtGetOffset (HWND hwnd,const MLEDITDATA* pMLEditData, PLINEDATA pLineData, int x)
+{
+    int i;
+    int newOff = 0;
+    int nTextWidth = 0;
+    const char* buffer = pLineData->buffer;
+
+    if(pLineData->dataEnd<pMLEditData->dispPos)
+		return pLineData->dataEnd;
+
+    x -= pMLEditData->leftMargin;
+    for (i = pMLEditData->dispPos; i < pLineData->dataEnd; i++) {
+        if ((nTextWidth + (GetSysCharWidth(hwnd) >> 1)) >= x)
+            break;
+
+        //1st:gb:a1-f7,big5:a1-f9 
+        if ((BYTE)buffer [i] > 0xA0)//ok 
+	{
+            i++;
+
+   	    if (nTextWidth + GetSysCCharWidth(hwnd)/2 >= x)
+		break;
+
+            if (i < pLineData->dataEnd) 
+	    {
+#ifndef USE_BIG5
+                if ((BYTE)buffer [i] > 0xA0)//2nd:gb:a1-fe,big5:40-7e,a1-fe 
+#else//2nd:gb:a1-fe,big5:40-7e,a1-fe
+                if ( ((BYTE)buffer [i] >= 0x40 && (BYTE)buffer[i] <= 0x7e) || 
+                     ((BYTE)buffer [i] >= 0xa1 && (BYTE)buffer[i] <= 0xfe))
+#endif
+		{
+                    nTextWidth += GetSysCCharWidth (hwnd);
+                    newOff += 2;
+                }
+                else
+                    i --;
+            }
+            else 
+	    {
+                nTextWidth += GetSysCharWidth (hwnd);
+                newOff ++;
+            }
+        }
+        else 
+	{
+            nTextWidth += GetSysCharWidth (hwnd);
+            newOff ++;
+        }
+    }
+    return newOff;
+}
+
+static int edtGetLineNO (HWND hwnd,const MLEDITDATA* pMLEditData, int x)
+{
+    int nline = 0;
+	if(x>=0)
+	{
+	    nline = x / GetSysCharHeight(hwnd);
+		if (nline <= pMLEditData->linesDisp)
+   			return nline;
+	}
+	return -1;
+}
+
+static BOOL edtIsACCharAtPosition (const char* string, int len, int pos)//ok
+{
+    if (pos > (len - 2))
+        return FALSE;
+
+//1st:gb:a1-f7,big5:a1-f9//2nd:gb:a1-fe,big5:40-7e,a1-fe
+#ifndef USE_BIG5
+    if ((BYTE)string [pos] > 0xA0 && (BYTE)string [pos + 1] > 0xA0)//ok
+        return TRUE;
+#else
+    if ((BYTE)string [pos] > 0xA0)//ok
+    {
+	if ( ((BYTE)string [pos + 1] >= 0x40 && (BYTE)string [pos + 1] <= 0x7e) ||
+	     ((BYTE)string [pos + 1] >= 0xa1 && (BYTE)string [pos + 1] <= 0xfe))
+	    //fprintf(stderr,"true\n");
+	    //fflush(stderr);
+	    return TRUE;
+    }
+#endif
+
+    return FALSE;
+}
+
+static void str2attr(const char* str,int len)//ok
+{
+    int i=0;
+    do
+    {
+	if (edtIsACCharAtPosition(str,len,i))
+	{
+		attr[i]=ATTCHL;
+		attr[i+1]=ATTCHR;
+		i+=2;
+	}
+	else
+	{
+		attr[i]=ATTENG;
+		i++;
+	}
+    }while(i<len);
+}
+
+static BOOL edtIsACCharBeforePosition (const char* string,int len, int pos)//##
+{
+    if (pos < 2)
+        return FALSE;
+
+//1st:gb:a1-f7,big5:a1-f9//2nd:gb:a1-fe,big5:40-7e,a1-fe
+#ifndef USE_BIG5
+    /* FIXME #ifdef GB2312?*/
+    if ((BYTE)string [pos - 2] > 0xA0 && (BYTE)string [pos - 1] > 0xA0)//ok
+        return TRUE;
+#else
+#if 0
+    if ((BYTE)string [pos - 2] > 0xA0)//!!
+    {
+	if ( ((BYTE)string [pos - 1] >= 0x40 && (BYTE)string[pos - 1] <= 0x7e) ||
+	     ((BYTE)string [pos - 1] >= 0xa1 && (BYTE)string[pos - 1] <= 0xfe))
+            return TRUE;
+    }
+#else
+    str2attr(string,len);//ok
+    if (attr[pos-1]==ATTENG) return FALSE;
+    else return TRUE;
+#endif
+#endif
+
+    return FALSE;
+}
+
+
+static BOOL edtIsACCharFromBegin(const char* string,int len,int pos)
+{
+	int i;
+	if(pos == 0)
+		return TRUE;
+	if(len == 0)
+		return FALSE;
+	for(i=0;i<len;)
+	{
+		if( edtIsACCharAtPosition(string,len,i) )
+			i += 2;
+		else 
+			i++;
+		if(i==pos)
+			return TRUE;
+	}
+	return FALSE;
+}
+
+int GetRETURNPos(char *str)
+{
+	int i;
+	for(i=0;i<strlen(str);i++)
+	{	
+		if(str[i]==10)
+			return i;
+	}
+	return -1;
+}
+
+void MLEditInitBuffer (PMLEDITDATA pMLEditData,char *spcaption)
+{
+	char *caption=spcaption; 
+    int off1;
+	int lineNO=0;
+	PLINEDATA  pLineData;
+	if (!(pMLEditData->head = malloc (sizeof (LINEDATA)))) {
+		fprintf (stderr, "EDITLINE: malloc error!\n");
+		return ;
+	}
+	pMLEditData->head->previous = NULL;
+	pLineData=pMLEditData->head;	
+	while ( (off1 = GetRETURNPos(caption)) != -1)
+	{
+		off1 = min(off1, LEN_MLEDIT_BUFFER);
+		memcpy(pLineData->buffer,caption,off1);
+		pLineData->buffer[off1] = '\0';
+		caption+=min(off1,LEN_MLEDIT_BUFFER)+1;
+		pLineData->lineNO  = lineNO;
+		pMLEditData->dispPos = 0;
+		pLineData->dataEnd = strlen(pLineData->buffer); 
+		pLineData->next    = malloc (sizeof (LINEDATA));
+		pLineData->next->previous = pLineData; 
+		pLineData = pLineData->next;
+		lineNO++;
+	}	
+	off1 = min(strlen(caption),LEN_MLEDIT_BUFFER);
+	memcpy(pLineData->buffer,caption,off1);
+	pLineData->buffer[off1] = '\0';
+	pLineData->lineNO  = lineNO++;
+	pMLEditData->dispPos = 0;
+	pLineData->dataEnd = strlen(pLineData->buffer); 
+	pLineData->next    = NULL; 
+	pMLEditData->lines      = lineNO ; 
+}
+
+PLINEDATA GetLineData(PMLEDITDATA pMLEditData,int lineNO)
+{
+	PLINEDATA pLineData=pMLEditData->head;
+	while(pLineData)
+	{
+		if(pLineData->lineNO==lineNO)
+			return pLineData;
+		pLineData = pLineData->next;
+	}
+	return NULL;
+}
+
+int MLEditCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
+{   
+    DWORD       dwStyle;
+	DWORD 		dw;
+    HDC         hdc;
+	PLINEDATA  pLineData;
+	RECT		clientRect;
+    PMLEDITDATA pMLEditData;
+    dwStyle     = GetWindowStyle(hWnd);
+
+    switch (message)
+    {
+        case WM_CREATE://
+	{
+            if (!(pMLEditData = malloc (sizeof (MLEDITDATA)))) {
+                fprintf (stderr, "EDIT: malloc error!\n");
+                return -1;
+            }
+
+            pMLEditData->totalLen      = LEN_MLEDIT_BUFFER;
+            pMLEditData->editPos        = 0;
+            pMLEditData->editLine       = 0;
+            pMLEditData->caretPos       = 0;
+
+	    MLEditInitBuffer(pMLEditData,GetWindowCaption(hWnd));	
+
+	    GetClientRect(hWnd,&clientRect);            
+	    pMLEditData->MaxlinesDisp   = (clientRect.bottom-clientRect.top)/GetSysCharHeight(hWnd);
+	    pMLEditData->linesDisp		= min(pMLEditData->MaxlinesDisp,pMLEditData->lines);
+	    pMLEditData->StartlineDisp  = 0;
+	    pMLEditData->EndlineDisp    = pMLEditData->StartlineDisp + pMLEditData->linesDisp - 1;
+
+            pMLEditData->selStartPos       = 0;
+            pMLEditData->selEndPos         = 0;
+            pMLEditData->passwdChar     = '*';
+            pMLEditData->leftMargin     = MARGIN_MEDIT_LEFT;
+            pMLEditData->topMargin      = MARGIN_MEDIT_TOP;
+            pMLEditData->rightMargin    = MARGIN_MEDIT_RIGHT;
+            pMLEditData->bottomMargin   = MARGIN_MEDIT_BOTTOM;
+
+            pMLEditData->hardLimit      = -1;
+            
+            // undo information
+            pMLEditData->lastOp         = MEDIT_OP_NONE;
+            pMLEditData->lastPos        = 0;
+            pMLEditData->affectedLen    = 0;
+            pMLEditData->undoBufferLen  = LEN_MLEDIT_UNDOBUFFER;
+            pMLEditData->undoBuffer [0] = '\0';
+			SetWindowAdditionalData2(hWnd,(DWORD)pMLEditData);
+			SetWindowAdditionalData(hWnd,(DWORD)0);
+            break;
+	}
+        case WM_DESTROY://
+        {
+		PLINEDATA temp;
+		pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd);
+	    	DestroyCaret ();
+		pLineData = pMLEditData->head;	
+		while(pLineData)
+		{
+//			printf("delete lineNO = %d,buffer=%s\n",pLineData->lineNO,pLineData->buffer);
+			temp = pLineData->next;
+			free(pLineData);
+			pLineData = temp;
+		}		
+            	free(pMLEditData); 
+	}
+        break;
+        
+    	/*  
+//-	case WM_SIZECHANGED://
+//-     {
+//-     }
+//-     return 0;
+	*/
+        case WM_SETFONT://
+        break;
+        
+        case WM_GETFONT://
+        break;
+#if 0//fix: no WM_SETCURSOR        
+        case WM_SETCURSOR://
+            if (dwStyle & WS_DISABLED) {
+                //SetCursor (GetSystemCursor (IDC_ARROW));//fix: no IDC_ARROW
+                return 0;
+            }
+        break;
+#endif
+        case WM_KILLFOCUS://
+	{
+	    dw= GetWindowAdditionalData(hWnd);
+            dw&= ~EST_FOCUSED;
+	    SetWindowAdditionalData(hWnd,dw);
+
+            HideCaret (hWnd);
+	    DestroyCaret ();
+
+            SendMessage (GetParent (hWnd), 
+                         WM_COMMAND, 
+                         (WPARAM) MAKELONG (GetDlgCtrlID(hWnd), EN_KILLFOCUS),
+                         (LPARAM)hWnd);
+	}
+        break;
+        
+        case WM_SETFOCUS://
+		{
+			dw= GetWindowAdditionalData(hWnd);
+            if (dw & EST_FOCUSED)
+                return 0;
+            
+            dw |= EST_FOCUSED;
+			SetWindowAdditionalData(hWnd,dw);
+
+            pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd);
+
+            // only implemented for ES_LEFT align format.
+
+            CreateCaret (hWnd, NULL, 1, /*GetSysCharWidth(hWnd)+1,*/
+		    hWnd->clirect.bottom-hWnd->clirect.top-2);
+            SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+                    + pMLEditData->leftMargin, pMLEditData->topMargin);
+	    ShowCaret(hWnd);
+
+            SendMessage (GetParent (hWnd), 
+                         WM_COMMAND,
+                         (WPARAM) MAKELONG (GetDlgCtrlID(hWnd), EN_SETFOCUS),
+                         (LPARAM) hWnd);
+		}
+        break;
+        
+        case WM_ENABLE://
+            if ( (!(dwStyle & WS_DISABLED) && !wParam)
+                    || ((dwStyle & WS_DISABLED) && wParam) ) {
+                if (wParam)
+			ExcludeWindowStyle(hWnd,WS_DISABLED);
+                else
+			IncludeWindowStyle(hWnd,WS_DISABLED);
+
+                InvalidateRect (hWnd, NULL, FALSE);
+            }
+        return 0;
+
+        case WM_NCPAINT://
+	{
+	    RECT rc;
+#if 0
+            if (wParam)
+                hdc = (HDC)wParam;
+            else
+                hdc = GetDC (hWnd);
+            //if (lParam)//fix: no ClipRectIntersect()
+            //    ClipRectIntersect (hdc, (RECT*)lParam);
+#else
+            hdc = wParam? (HDC)wParam: GetWindowDC (hWnd);
+	    GetWindowRect(hWnd, &rc);
+#endif
+            if (dwStyle & WS_BORDER)
+	    {
+#if 0
+		RECT rc;
+		GetWindowRect(hWnd,&rc);
+                Draw3DDownFrame (hdc, 0, 0, 
+                                      rc.right - rc.left - 1, 
+                                      rc.bottom - rc.top - 1,
+                                      PIXEL_invalid);
+#else
+		Draw3dInset(hdc, rc.left, rc.top,
+			rc.right-rc.left, rc.bottom-rc.top);
+#endif
+	    }
+            if (!wParam)
+                //!ReleaseDC (hdc);
+		ReleaseDC(hWnd,hdc);
+	}
+        return 0;
+
+        case WM_PAINT://
+        {
+            int     dispLen,i;
+            char*   dispBuffer;
+            RECT    rect,rc;
+	    PAINTSTRUCT ps;
+	    HGDIOBJ oldfont=NULL;
+            
+            //!hdc = BeginPaint (hWnd);
+            hdc = BeginPaint (hWnd,&ps);
+            GetClientRect (hWnd, &rect);
+    
+            if (dwStyle & WS_DISABLED)
+            {
+#if 0
+                SetBrushColor (hdc, LTGRAY/*PIXEL_lightgray*/);
+                FillBox (hdc, 0, 0, rect.right, rect.bottom);
+#else
+		rc.left=0; rc.top=0; rc.bottom=rect.bottom; rc.right=rect.right;
+		FillRect(hdc,&rc,GetStockObject(LTGRAY_BRUSH));
+#endif
+                SetBkColor (hdc, LTGRAY/*PIXEL_lightgray*/);
+            }
+            else {
+#if 0
+                SetBrushColor (hdc, WHITE/*PIXEL_lightwhite*/);
+                FillBox (hdc, 0, 0, rect.right, rect.bottom);
+#else
+		rc.left=0; rc.top=0; rc.bottom=rect.bottom; rc.right=rect.right;
+		FillRect(hdc,&rc,GetStockObject(WHITE_BRUSH));
+#endif
+                SetBkColor (hdc, WHITE/*PIXEL_lightwhite*/);
+            }
+
+            SetTextColor (hdc, BLACK/*PIXEL_black*/);
+
+            pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd);
+			for(i = pMLEditData->StartlineDisp; i <= pMLEditData->EndlineDisp; i++)
+			{
+				pLineData= GetLineData(pMLEditData,i);
+            	dispLen = edtGetDispLen (hWnd,pLineData);
+         	    if (dispLen == 0 && pMLEditData->EndlineDisp >= pMLEditData->lines) {
+                	continue;
+           		 }
+
+#ifdef _DEBUG
+       	    	if (pMLEditData->dispPos > pLineData->dataEnd)
+        	        fprintf (stderr, "ASSERT failure: %s.\n", "Edit Paint");
+#endif
+            
+                dispBuffer = alloca (LEN_MLEDIT_BUFFER+1);
+
+                if (dwStyle & ES_PASSWORD)
+                    memset (dispBuffer, '*', pLineData->dataEnd);
+				    memcpy (dispBuffer, 
+                   	    pLineData->buffer,// +pMLEditData->dispPos,
+						pLineData->dataEnd);// - pMLEditData->dispPos);
+               		dispBuffer[pLineData->dataEnd] = '\0';
+
+            // only implemented ES_LEFT align format for single line edit.
+                rect.left = pMLEditData->leftMargin;
+                rect.top = pMLEditData->topMargin ;
+                rect.right = pMLEditData->rightMargin;
+                rect.bottom = pMLEditData->bottomMargin;
+//				printf("lineNO=%d,lines=%d,editLine=%d\n",pLineData->lineNO,pMLEditData->lines,
+//							pMLEditData->editLine);
+	//			printf("--dispBuffer=%s--\n",dispBuffer);
+                //ClipRectIntersect (hdc, &rect);//fix: no ClipRectIntersect()
+#ifdef USE_BIG5	    
+	    oldfont=SelectObject(hdc,CreateFont(12,
+			0,0,0,0,0,0,0,0,0,0,0,
+			FF_DONTCARE|DEFAULT_PITCH,
+			"HZXFONT"));
+#endif
+                TextOut (hdc, 
+				pMLEditData->leftMargin - pMLEditData->dispPos * GetSysCharWidth(hWnd) ,
+				GetSysCharHeight(hWnd)*(pLineData->lineNO - pMLEditData->StartlineDisp) 
+					+ pMLEditData->topMargin,
+				dispBuffer,-1);//
+			}
+#ifdef USE_BIG5	    
+    	    DeleteObject(SelectObject(hdc,oldfont));
+#endif
+            //!EndPaint (hWnd, hdc);
+	    EndPaint (hWnd, &ps);
+        }
+        break;
+
+        case WM_KEYDOWN://
+        {
+            BOOL    bChange = FALSE;
+            int     i;
+       //     RECT    InvRect;
+            int     deleted;
+			PLINEDATA temp = NULL;
+			char *  tempP = NULL;
+
+            pMLEditData =(PMLEDITDATA) GetWindowAdditionalData2(hWnd);
+        
+            switch (LOWORD (wParam))
+            {
+				
+                case VK_RETURN: //SCANCODE_ENTER:
+				{
+					pLineData = GetLineData(pMLEditData,pMLEditData->editLine);
+					if (pMLEditData->editPos < pLineData->dataEnd)
+						tempP = pLineData->buffer + pMLEditData->editPos;
+				    temp = pLineData->next;
+					pLineData->next = malloc( sizeof(LINEDATA) );
+					pLineData->next->previous = pLineData;
+					pLineData->next->next = temp;
+					if(temp)
+					{
+						temp->previous = pLineData->next;
+					}
+					temp = pLineData->next;
+					temp->lineNO  = pMLEditData->editLine + 1;
+					if(tempP)
+					{
+						memcpy(temp->buffer,tempP,strlen(tempP));
+						temp->dataEnd = strlen(tempP);
+					}
+					else
+						temp->dataEnd = 0;
+					temp->buffer[temp->dataEnd] = '\0'; 
+					pLineData->dataEnd = pMLEditData->editPos;
+					pLineData->buffer[pLineData->dataEnd]='\0';
+					temp = temp->next;
+					while (temp)
+					{
+						temp->lineNO++;
+						temp = temp->next;
+					}
+					pMLEditData->editPos = 0;
+					pMLEditData->caretPos= 0;
+					pMLEditData->dispPos = 0;
+					if(pMLEditData->linesDisp < pMLEditData->MaxlinesDisp)
+					{
+						pMLEditData->EndlineDisp++;
+						pMLEditData->linesDisp++;
+					}
+					else if(pMLEditData->editLine == pMLEditData->EndlineDisp) 
+					{
+						pMLEditData->StartlineDisp++;
+						pMLEditData->EndlineDisp++;
+					}
+					pMLEditData->editLine++;
+					pMLEditData->lines++;
+                    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+                            + pMLEditData->leftMargin, 
+                        (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+							+pMLEditData->topMargin);
+    	            InvalidateRect (hWnd, NULL, FALSE);
+        	        return 0;
+				}
+                case VK_HOME: //SCANCODE_HOME:
+				{
+					PLINEDATA temp;
+                    if (pMLEditData->editPos == 0)
+                        return 0;
+
+                    pMLEditData->editPos  = 0;
+                    pMLEditData->caretPos = 0;
+
+                    SetCaretPos (pMLEditData->leftMargin, 
+                        (pMLEditData->editLine-pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+							+pMLEditData->topMargin);
+					temp = GetLineData(pMLEditData,pMLEditData->editLine);	
+                    if (pMLEditData->dispPos != 0)
+					{
+						pMLEditData->dispPos = 0;
+					    InvalidateRect (hWnd, NULL, FALSE);
+					}
+               		return 0;
+            	}
+                case VK_END: //SCANCODE_END:
+                {
+                    int newStartPos;
+                    pLineData = GetLineData(pMLEditData,pMLEditData->editLine);
+                    if (pMLEditData->editPos == pLineData->dataEnd)
+                        return 0;
+                    newStartPos = edtGetStartDispPosAtEnd (hWnd, pLineData);
+                    
+                    pMLEditData->editPos = pLineData->dataEnd;
+                    pMLEditData->caretPos = pMLEditData->editPos - newStartPos;
+                    
+                    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd)
+                            + pMLEditData->leftMargin, 
+						(pMLEditData->editLine-pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+	                        + pMLEditData->topMargin);
+
+                    if (pMLEditData->dispPos != newStartPos)
+                        InvalidateRect (hWnd, NULL, FALSE);
+					pMLEditData->dispPos = newStartPos;
+                }
+                return 0;
+
+                case VK_LEFT: //SCANCODE_CURSORBLOCKLEFT:
+                {
+                    BOOL bScroll = FALSE;
+                    int  scrollStep,newStartPos;
+					PLINEDATA temp;
+					pLineData = GetLineData(pMLEditData,pMLEditData->editLine);
+                    if (pMLEditData->editPos == 0 )
+					{
+						temp = pLineData->previous;
+						if(temp && pMLEditData->editLine > pMLEditData->StartlineDisp)
+						{
+							pMLEditData->editLine --;						
+							pMLEditData->editPos = temp->dataEnd; 
+		                    newStartPos = edtGetStartDispPosAtEnd (hWnd, temp);
+                    		pMLEditData->caretPos = pMLEditData->editPos - newStartPos;
+                    		if (pMLEditData->dispPos != newStartPos)
+							{
+								pMLEditData->dispPos = newStartPos;
+								bScroll = TRUE;
+							}
+						}
+						else
+	                        return 0;
+					}
+					else
+                    {	if (edtIsACCharBeforePosition (pLineData->buffer, 
+                                    pLineData->dataEnd,
+                        	    pMLEditData->editPos)) {
+                        	scrollStep = 2;
+                        	pMLEditData->editPos -= 2;
+                    	}
+                    	else {
+                       	 	scrollStep = 1;
+                        	pMLEditData->editPos --;
+                    	}
+
+                    	pMLEditData->caretPos -= scrollStep;
+                    	if (pMLEditData->caretPos == 0 
+                        	    && pMLEditData->editPos != 0) {
+
+                        	bScroll = TRUE;
+
+                        	if (edtIsACCharBeforePosition (pLineData->buffer, 
+                                    pLineData->dataEnd,
+                            	    pMLEditData->editPos)) {
+                           		pMLEditData->dispPos -= 2;
+                            	pMLEditData->caretPos = 2;
+                        	}
+                        	else {
+								pMLEditData->dispPos--;							
+	                            pMLEditData->caretPos = 1;
+    	                    }
+        	            }
+            	        else if (pMLEditData->caretPos < 0) {
+							pMLEditData->dispPos = 0;
+                    	    pMLEditData->caretPos = 0;
+                    	}
+                    }    
+                    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+                            + pMLEditData->leftMargin, 
+						(pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+                        	+ pMLEditData->topMargin);
+
+                    if (bScroll)
+                        InvalidateRect (hWnd, NULL, FALSE);
+                }
+                return 0;
+                
+		case VK_RIGHT: //SCANCODE_CURSORBLOCKRIGHT:
+                {
+                    BOOL bScroll = FALSE;
+                    int  scrollStep, moveStep;
+					PLINEDATA temp;
+
+					pLineData = GetLineData(pMLEditData,pMLEditData->editLine);
+                    if (pMLEditData->editPos == pLineData->dataEnd)
+					{
+						temp = pLineData->next;
+						if(temp)
+						{
+							pMLEditData->editLine++;
+							pMLEditData->editPos  = 0;
+							pMLEditData->caretPos = 0;	
+							if(pMLEditData->dispPos !=0)
+							{
+								pMLEditData->dispPos  = 0;
+								bScroll = TRUE;
+							}
+						}
+						else
+	                        return 0;
+					}
+					else
+                    {	
+						if (edtIsACCharAtPosition (pLineData->buffer, 
+                        	        pLineData->dataEnd,
+                            	    pMLEditData->dispPos)) {
+              	            if (edtIsACCharAtPosition (pLineData->buffer, 
+                                    pLineData->dataEnd,
+                                    pMLEditData->editPos)) {
+                      	        scrollStep = 2;
+                        	    moveStep = 2;
+                            	pMLEditData->editPos  += 2;
+                        	}
+                        	else {
+                            	scrollStep = 2;
+	                            moveStep = 1;
+    	                        pMLEditData->editPos ++;
+        	                }
+            	        }
+                	    else {
+                    	    if (edtIsACCharAtPosition (pLineData->buffer, 
+                        	            pLineData->dataEnd,
+                            	        pMLEditData->editPos)) {
+                                    
+	                            if (edtIsACCharAtPosition (pLineData->buffer, 
+    	                                pLineData->dataEnd,
+        	                            pMLEditData->dispPos + 1))
+            	                    scrollStep = 3;
+                	            else
+                    	            scrollStep = 2;
+	
+    	                        moveStep = 2;
+        	                    pMLEditData->editPos += 2;
+            	            }
+                	        else {
+                    	        scrollStep = 1;
+                        	    moveStep = 1;
+                            	pMLEditData->editPos ++;
+	                        }
+    	                }
+
+        	            pMLEditData->caretPos += moveStep;
+            	        if (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+                	            > edtGetOutWidth (hWnd)) {
+                    	    bScroll = TRUE;
+                        	pMLEditData->dispPos += scrollStep;
+	                        pMLEditData->caretPos = 
+    	                        pMLEditData->editPos - pMLEditData->dispPos;
+        	            }
+					}
+                    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+                            + pMLEditData->leftMargin, 
+                        (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight (hWnd) 
+                        	+ pMLEditData->topMargin);
+
+                    if (bScroll)
+                        InvalidateRect (hWnd, NULL, FALSE);
+                }
+                return 0;
+               	
+		case VK_UP: //SCANCODE_CURSORBLOCKUP:
+		{
+                    BOOL bScroll = FALSE;
+                    int  newStartPos;
+					PLINEDATA temp;
+					pLineData = GetLineData(pMLEditData,pMLEditData->editLine);
+					temp = pLineData->previous; 
+					if(pMLEditData->editLine == 0)
+						return 0;
+					else if (pMLEditData->editLine == pMLEditData->StartlineDisp)
+					{
+						bScroll = TRUE;
+						pMLEditData->StartlineDisp--;
+						pMLEditData->EndlineDisp--;	
+					}
+					pMLEditData->editLine--;
+
+					if( pMLEditData->editPos >= temp->dataEnd ) 
+					{
+						pMLEditData->editPos = temp->dataEnd;
+						pMLEditData->dispPos = 0;
+	                   	newStartPos = edtGetStartDispPosAtEnd (hWnd, temp);
+               			pMLEditData->dispPos =  newStartPos;
+						pMLEditData->caretPos = pMLEditData->editPos - newStartPos;
+						bScroll = TRUE;
+					}				
+					else 
+					{
+       			   		newStartPos = edtGetOffset(hWnd, pMLEditData,temp,
+                   				pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+                       			+ pMLEditData->leftMargin);
+						if(!edtIsACCharFromBegin(temp->buffer,temp->dataEnd,
+								pMLEditData->dispPos))
+						{
+							bScroll = TRUE;
+							pMLEditData->dispPos--;
+        			   		newStartPos = edtGetOffset(hWnd, pMLEditData,temp,
+                      				pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+                          			+ pMLEditData->leftMargin+GetSysCharWidth(hWnd)/2);
+						}
+	   	        	    pMLEditData->editPos = newStartPos + pMLEditData->dispPos;
+   		    	        pMLEditData->caretPos = newStartPos;
+					}
+                    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+                            + pMLEditData->leftMargin, 
+					    (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+                            + pMLEditData->topMargin);
+					if(bScroll)
+						InvalidateRect(hWnd,NULL,FALSE);	
+				}
+				break;
+		case VK_DOWN: //SCANCODE_CURSORBLOCKDOWN:
+		{
+                    BOOL bScroll = FALSE;
+                    int  newStartPos;
+					PLINEDATA temp;
+					pLineData = GetLineData(pMLEditData,pMLEditData->editLine);
+					temp = pLineData->next; 
+					if(pMLEditData->editLine == pMLEditData->lines-1)
+						return 0;
+					else if (pMLEditData->editLine == pMLEditData->EndlineDisp)
+					{
+						bScroll = TRUE;
+						pMLEditData->StartlineDisp++;
+						pMLEditData->EndlineDisp++;	
+					}
+					pMLEditData->editLine++;
+
+					if( pMLEditData->editPos >= temp->dataEnd ) 
+					{
+						pMLEditData->editPos = temp->dataEnd;
+						pMLEditData->dispPos = 0;
+	                   	newStartPos = edtGetStartDispPosAtEnd (hWnd, temp);
+               			pMLEditData->dispPos =  newStartPos;
+						pMLEditData->caretPos = pMLEditData->editPos - newStartPos;
+						bScroll = TRUE;
+					}				
+					else 
+					{
+       			   		newStartPos = edtGetOffset(hWnd, pMLEditData,temp,
+                   				pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+                       			+ pMLEditData->leftMargin);
+						if(!edtIsACCharFromBegin(temp->buffer,temp->dataEnd,
+								pMLEditData->dispPos))
+						{
+							bScroll = TRUE;
+							pMLEditData->dispPos--;
+           			   		newStartPos = edtGetOffset(hWnd, pMLEditData,temp,
+                       				pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+                           			+ pMLEditData->leftMargin+GetSysCharWidth(hWnd)/2);
+						}
+	   	        	    pMLEditData->editPos = newStartPos + pMLEditData->dispPos;
+   		    	        pMLEditData->caretPos = newStartPos;
+					}
+                    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+                            + pMLEditData->leftMargin, 
+					    (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+                            + pMLEditData->topMargin);
+					if(bScroll)
+						InvalidateRect(hWnd,NULL,FALSE);	
+		
+				}
+				break;
+                case VK_INSERT: //SCANCODE_INSERT:
+					dw = GetWindowAdditionalData(hWnd);	
+                    dw ^= EST_REPLACE;
+					SetWindowAdditionalData(hWnd,dw);
+                break;
+
+                case VK_DELETE: //SCANCODE_REMOVE:
+				{
+					PLINEDATA temp;
+					int leftLen;
+					pLineData = GetLineData(pMLEditData,pMLEditData->editLine);
+                    if ((GetWindowAdditionalData(hWnd) & EST_READONLY) ){
+                        //Ping ();//fix: no Ping()
+                        return 0;
+                    }
+                   	temp = pLineData->next; 
+					if (pLineData->dataEnd == pMLEditData->editPos && temp)
+					{
+						if(pLineData->dataEnd + temp->dataEnd <= LEN_MLEDIT_BUFFER)
+						{
+							memcpy(pLineData->buffer+pLineData->dataEnd,temp->buffer,temp->dataEnd);	
+							pLineData->dataEnd += temp->dataEnd;
+							pLineData->buffer[pLineData->dataEnd] = '\0';
+							if(temp->next)
+							{
+							    pLineData->next = temp->next;
+								temp->next->previous = pLineData;	
+							}
+							else
+								pLineData->next = NULL;
+							free(temp);
+							temp = pLineData->next;
+							while (temp)
+							{
+								temp->lineNO--;
+								temp = temp->next;
+							}
+							if(pMLEditData->lines <= pMLEditData->MaxlinesDisp)
+							{
+								pMLEditData->EndlineDisp--;
+								pMLEditData->linesDisp--;
+							}
+							if(pMLEditData->EndlineDisp >= pMLEditData->lines-1)		
+							{
+								pMLEditData->EndlineDisp--;
+								if(pMLEditData->StartlineDisp !=0)
+									pMLEditData->StartlineDisp--;
+								else
+									pMLEditData->linesDisp--;
+							}
+							pMLEditData->lines--;
+						}
+						else if (temp->dataEnd > 0)
+						{
+							leftLen = LEN_MLEDIT_BUFFER - pLineData->dataEnd;
+							memcpy(pLineData->buffer+pLineData->dataEnd,temp->buffer,leftLen);
+							pLineData->dataEnd +=leftLen;
+							pLineData->buffer[pLineData->dataEnd] = '\0';
+							memcpy(temp->buffer,temp->buffer+leftLen,temp->dataEnd-leftLen);  
+							temp->dataEnd -=leftLen;
+							temp->buffer[temp->dataEnd] = '\0';
+						}
+					}
+					else if (pMLEditData->editPos != pLineData->dataEnd)
+					{	
+	                    if (edtIsACCharAtPosition (pLineData->buffer, 
+    	                                pLineData->dataEnd,
+        	                            pMLEditData->editPos))
+	                        deleted = 2;
+    	                else
+        	                deleted = 1;
+                        
+            	        for (i = pMLEditData->editPos; 
+                	            i < pLineData->dataEnd - deleted;
+                    	        i++)
+ 	                       pLineData->buffer [i] 
+    	                        = pLineData->buffer [i + deleted];
+
+        	            pLineData->dataEnd -= deleted;
+						pLineData->buffer[pLineData->dataEnd] = '\0';
+					}
+                	bChange = TRUE;
+                    InvalidateRect (hWnd, NULL,FALSE);
+				}
+                break;
+
+                case VK_BACK: //SCANCODE_BACKSPACE:
+				{
+					PLINEDATA temp;
+					int leftLen,tempEnd;
+                    if ((GetWindowAdditionalData(hWnd) & EST_READONLY) ){
+                        //Ping ();//fix: no Ping()
+                        return 0;
+                    }
+					pLineData = GetLineData(pMLEditData,pMLEditData->editLine);
+					temp = pLineData->previous;	
+					if (pMLEditData->editPos == 0 && temp)
+					{
+						tempEnd = temp->dataEnd;
+						if(pLineData->dataEnd + temp->dataEnd <= LEN_MLEDIT_BUFFER)	
+						{
+							memcpy(temp->buffer+temp->dataEnd,pLineData->buffer,pLineData->dataEnd);	
+							temp->dataEnd +=pLineData->dataEnd;
+							temp->buffer[temp->dataEnd] = '\0';
+							if(pLineData->next)
+							{
+							    temp->next = pLineData->next;
+								pLineData->next->previous = temp;
+							}
+							else
+								temp->next = NULL;
+							free(pLineData);
+							pLineData = temp;
+							temp = temp->next;
+							while(temp)
+							{
+								temp->lineNO--;
+								temp = temp->next;
+							}
+							if(pMLEditData->StartlineDisp == pMLEditData->editLine
+									&& pMLEditData->StartlineDisp != 0)
+							{
+								pMLEditData->StartlineDisp--;	
+								if(pMLEditData->EndlineDisp == pMLEditData->lines)
+									pMLEditData->EndlineDisp--;
+							}
+							if(pMLEditData->lines <= pMLEditData->MaxlinesDisp)
+							{
+								pMLEditData->linesDisp--;
+								pMLEditData->EndlineDisp--;
+							}
+							pMLEditData->lines--;
+						}
+						else if (pLineData->dataEnd > 0)
+						{
+							leftLen = LEN_MLEDIT_BUFFER - temp->dataEnd;
+							memcpy(temp->buffer+temp->dataEnd,pLineData->buffer,leftLen);
+							temp->dataEnd +=leftLen;
+							temp->buffer[temp->dataEnd] = '\0';
+							memcpy(pLineData->buffer,pLineData->buffer+leftLen,pLineData->dataEnd-leftLen);  
+							pLineData->dataEnd -=leftLen;
+							pLineData->buffer[pLineData->dataEnd] = '\0';
+						}
+						pMLEditData->editLine--;
+						pMLEditData->editPos = tempEnd;
+						pMLEditData->dispPos = tempEnd;
+						//���༭λ�ò�Ϊ0,caretλ��Ϊ0��ʱ��,�ƶ�caretλ��.
+           		        if (pMLEditData->caretPos == 0 
+                	            && pMLEditData->editPos != 0) {
+        	                if (edtIsACCharBeforePosition (pLineData->buffer, 
+                                    pLineData->dataEnd,
+            	                    pMLEditData->editPos)) {
+                	           	pMLEditData->dispPos -= 2;
+                    	        pMLEditData->caretPos = 2;
+                   		    }
+                        	else {
+								pMLEditData->dispPos--;							
+                           		pMLEditData->caretPos = 1;
+                    	    }
+                   	 	}
+                    	else if (pMLEditData->caretPos < 0) {
+							pMLEditData->dispPos = 0;
+                        	pMLEditData->caretPos = 0;
+                    	}
+					}
+					else if (pMLEditData->editPos != 0 )
+					{
+	                    if (edtIsACCharBeforePosition (pLineData->buffer, 
+                                        pLineData->dataEnd,
+    	                                pMLEditData->editPos))
+        	                deleted = 2;
+            	        else
+                	        deleted = 1;
+                        
+    	                for (i = pMLEditData->editPos; 
+        	                    i < pLineData->dataEnd;
+            	                i++)
+                	        pLineData->buffer [i - deleted] 
+                    	        = pLineData->buffer [i];
+
+  	    	            pLineData->dataEnd -= deleted;
+    	                pMLEditData->editPos -= deleted;
+                	    pMLEditData->caretPos -= deleted;
+	                    if (pMLEditData->caretPos == 0 
+    	                        && pMLEditData->editPos != 0) {
+        	                if (edtIsACCharBeforePosition (pLineData->buffer, 
+                                    pLineData->dataEnd,
+            	                    pMLEditData->editPos)) {
+                	            pMLEditData->dispPos -= 2;
+                    	        pMLEditData->caretPos = 2;
+       		                 }
+            	            else {
+                	            pMLEditData->dispPos --;
+                    	        pMLEditData->caretPos = 1;
+                    	    }
+                        
+                	    }
+					}
+            	    bChange = TRUE;
+                    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+                            + pMLEditData->leftMargin, 
+					    (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+                            + pMLEditData->topMargin);
+                    InvalidateRect (hWnd, NULL, FALSE);
+				}
+                break;
+
+                default:
+                break;
+            }
+       
+            if (bChange)
+                SendMessage (GetParent (hWnd), WM_COMMAND, 
+                        (WPARAM) MAKELONG (GetDlgCtrlID(hWnd), EN_CHANGE),
+                        (LPARAM) hWnd);
+            return 0;
+        }
+
+        case WM_CHAR://
+        {
+            char charBuffer [2];
+            int  i, chars, scrollStep, inserting;
+			UINT format;
+      //      RECT InvRect;
+	
+            pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); 
+
+			pLineData = GetLineData(pMLEditData,pMLEditData->editLine);
+
+            if (dwStyle & ES_READONLY) {
+                //Ping();//fix: no Ping()
+                return 0;
+            }
+            if (HIBYTE (wParam)) {
+                charBuffer [0] = LOBYTE (wParam);
+                charBuffer [1] = HIBYTE (wParam);
+                chars = 2;
+            }
+            else {
+                charBuffer [0] = LOBYTE (wParam);
+                chars = 1;
+            }
+            
+            if (chars == 1) {
+                switch (charBuffer [0])
+                {
+                    case 0x00:  // NULL
+                    case 0x07:  // BEL
+                    case 0x08:  // BS
+                    case 0x09:  // HT
+                    case 0x0A:  // LF
+                    case 0x0B:  // VT
+                    case 0x0C:  // FF
+                    case 0x0D:  // CR
+                    case 0x1B:  // Escape
+                    return 0;
+                }
+            }
+            if (GetWindowAdditionalData(hWnd) & EST_REPLACE) {
+                if (pLineData->dataEnd == pMLEditData->editPos)
+                    inserting = chars;
+                else if (edtIsACCharAtPosition (pLineData->buffer, 
+                                pLineData->dataEnd,
+                                pMLEditData->editPos)) {
+                    if (chars == 2)
+                        inserting = 0;        
+                    else
+                        inserting = -1;       
+                }
+                else {
+                    if (chars == 2)
+                        inserting = 1;		  	
+                    else
+                        inserting = 0;        
+                }
+            }
+            else
+                inserting = chars;
+
+            // check space
+            if (pLineData->dataEnd + inserting > pMLEditData->totalLen) {
+                //Ping ();//fix: no Ping()
+                SendMessage (GetParent (hWnd), WM_COMMAND,
+                            (WPARAM) MAKELONG (GetDlgCtrlID(hWnd), EN_MAXTEXT),
+                            (LPARAM) hWnd);
+                return 0;
+            }
+            else if ((pMLEditData->hardLimit >= 0) 
+                        && ((pLineData->dataEnd + inserting) 
+                            > pMLEditData->hardLimit)) {
+                //Ping ();//fix: no Ping()
+                SendMessage (GetParent (hWnd), WM_COMMAND,
+                            (WPARAM) MAKELONG (GetDlgCtrlID(hWnd), EN_MAXTEXT),
+                            (LPARAM) hWnd);
+                return 0;
+            }
+            if (inserting == -1) {
+                for (i = pMLEditData->editPos; i < pLineData->dataEnd-1; i++)
+                    pLineData->buffer [i] = pLineData->buffer [i + 1];
+            }
+            else if (inserting > 0) {
+                for (i = pLineData->dataEnd + inserting - 1; 
+                        i > pMLEditData->editPos + inserting - 1; 
+                        i--)
+                    pLineData->buffer [i] 
+                            = pLineData->buffer [i - inserting];
+            }
+            for (i = 0; i < chars; i++)
+                    pLineData->buffer [pMLEditData->editPos + i] 
+                        = charBuffer [i];
+            
+            pMLEditData->editPos += chars;
+            pMLEditData->caretPos += chars;
+            pLineData->dataEnd += inserting;
+			pLineData->buffer[pLineData->dataEnd] = '\0';
+            if (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+                            > edtGetOutWidth (hWnd))
+            {
+                if (edtIsACCharAtPosition (pLineData->buffer, 
+                                pLineData->dataEnd,
+                                pMLEditData->dispPos))
+                    scrollStep = 2;
+                else {
+                    if (chars == 2) {
+                        if (edtIsACCharAtPosition (pLineData->buffer, 
+                                pLineData->dataEnd,
+                                pMLEditData->dispPos + 1))
+                            scrollStep = 3;
+                        else
+                            scrollStep = 2;
+                    }
+                    else
+                        scrollStep = 1;
+                }
+                    
+                pMLEditData->dispPos += scrollStep;
+
+                pMLEditData->caretPos = 
+                            pMLEditData->editPos - pMLEditData->dispPos;
+
+            }
+            SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+                            + pMLEditData->leftMargin, 
+					    (pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+                            + pMLEditData->topMargin);
+            InvalidateRect (hWnd, NULL,FALSE);
+			format = DT_NOPREFIX;
+            SendMessage (GetParent (hWnd), WM_COMMAND,
+                    (WPARAM) MAKELONG (GetDlgCtrlID(hWnd), EN_CHANGE),
+                    (LPARAM) hWnd);
+        }
+        return 0;
+
+        case WM_GETTEXTLENGTH://
+		{
+			PLINEDATA temp;
+			int    lineNO = (int)wParam;
+            pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); 
+			temp = pMLEditData->head;
+			while(temp)
+			{
+				if (temp->lineNO == lineNO)
+					return  temp->dataEnd;
+				temp = temp->next;
+			}
+        return -1;
+        }
+		case WM_GETTEXT://
+		{
+			PLINEDATA temp;
+			int len,total = 0,lineNO;
+			char * buffer = (char*)lParam;
+            pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); 
+			len = (int)wParam;
+            lineNO = (int)wParam;
+			temp = pMLEditData->head;
+			while (temp && total + temp->dataEnd < len)  
+			{
+				memcpy(buffer+total,temp->buffer,temp->dataEnd);
+				total += temp->dataEnd;
+				temp = temp->next;
+			}	
+					
+		}
+		return 0;
+//can i add it to message define ?
+/*
+        case WM_GETLINETEXT://
+        {
+			PLINEDATA temp;
+            char*   buffer = (char*)lParam;
+            int     lineNO,len;
+
+            pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); 
+            lineNO = (int)wParam;
+			temp = GetLineData(pMLEditData,lineNO);
+			if(temp)
+			{
+				len = min ((int)wParam, temp->dataEnd);
+		    	memcpy (buffer, temp->buffer,len);
+		        buffer [len] = '\0';
+				return 0;
+			}
+            return -1;
+        }
+        break;
+		case WM_SETTEXT://
+		{
+			MLEditInitBuffer(pMLEditData,(char *)lParam);
+		}
+		return 0;
+*/
+//can i add it to message defined?
+/*        case WM_SETLINETEXT://
+        {
+            int len,lineNO;
+			PLINEDATA temp;
+
+            if (dwStyle & ES_READONLY)
+                return 0;
+
+            pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); 
+            
+            len = strlen ((char*)lParam);
+			lineNO = (int)wParam;
+			temp = pMLEditData->head;
+            len = min (len, pMLEditData->totalLen);
+            
+            if (pMLEditData->hardLimit >= 0)
+                len = min (len, pMLEditData->hardLimit);
+          	while (temp)
+			{
+				if(temp->lineNO == lineNO)
+				{
+     		        temp->dataEnd = len;
+            	    memcpy (temp->buffer, (char*)lParam, len);
+				}
+				temp = temp->next;
+			}
+            pMLEditData->editPos        = 0;
+            pMLEditData->caretPos       = 0;
+            pMLEditData->dispPos        = 0;
+            InvalidateRect (hWnd, NULL, FALSE);
+        }
+        return 0;
+*/
+        case WM_LBUTTONDBLCLK://
+        break;
+        
+        case WM_LBUTTONDOWN://
+        {
+            int newOff,lineNO;
+			PLINEDATA temp;
+			BOOL bScroll = FALSE;
+            
+            pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); 
+            lineNO = edtGetLineNO (hWnd,pMLEditData, HIWORD (lParam));
+			if ( lineNO < 0 )
+				return 0;
+			lineNO += pMLEditData->StartlineDisp;
+			if (lineNO <= pMLEditData->EndlineDisp && lineNO <= pMLEditData->lines-1 )
+			{
+				temp = GetLineData(pMLEditData,lineNO);		
+   		        newOff = edtGetOffset (hWnd,pMLEditData,temp, LOWORD (lParam));
+				if(!edtIsACCharFromBegin(temp->buffer,temp->dataEnd,pMLEditData->dispPos))
+				{
+					bScroll = TRUE;
+					pMLEditData->dispPos--;
+   	        		newOff = edtGetOffset (hWnd,pMLEditData,temp, LOWORD(lParam)+GetSysCharWidth(hWnd)/2);
+				}
+    	        if (newOff != pMLEditData->caretPos || lineNO != pMLEditData->editLine) {
+					pMLEditData->editLine = temp->lineNO;
+   	        	    pMLEditData->editPos = newOff +pMLEditData->dispPos;
+        	        pMLEditData->caretPos = newOff;
+   	        	    SetCaretPos (pMLEditData->caretPos * GetSysCharWidth (hWnd) 
+           	            + pMLEditData->leftMargin, 
+					(pMLEditData->editLine - pMLEditData->StartlineDisp) * GetSysCharHeight(hWnd)
+                	        	+ pMLEditData->topMargin);
+           		}
+				if(bScroll)
+					InvalidateRect(hWnd,NULL,FALSE);
+			}
+        }
+        break;
+
+        case WM_LBUTTONUP://
+        break;
+        
+        case WM_MOUSEMOVE://
+        break;
+        
+        case WM_GETDLGCODE://
+        return DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS;
+        
+        case EM_SETREADONLY:
+            if (wParam)
+				IncludeWindowStyle(hWnd,ES_READONLY);
+            else
+				ExcludeWindowStyle(hWnd,ES_READONLY);
+        return 0;
+        
+        case EM_SETPASSWORDCHAR:
+            pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); 
+
+            if (pMLEditData->passwdChar != (int)wParam) {
+                if (dwStyle & ES_PASSWORD) {
+                    pMLEditData->passwdChar = (int)wParam;
+                    InvalidateRect (hWnd, NULL, TRUE);
+                }
+            }
+        return 0;
+    
+        case EM_GETPASSWORDCHAR:
+        {
+            int* passwdchar;
+            
+            pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); 
+            passwdchar = (int*) lParam;
+
+            *passwdchar = pMLEditData->passwdChar;
+        }
+        return 0;
+    
+        case EM_LIMITTEXT:
+        {
+            int newLimit = (int)wParam;
+            
+            if (newLimit >= 0) {
+            pMLEditData = (PMLEDITDATA)GetWindowAdditionalData2(hWnd); 
+                if (pMLEditData->totalLen < newLimit)
+                    pMLEditData->hardLimit = -1;
+                else
+                    pMLEditData->hardLimit = newLimit;
+            }
+        }
+        return 0;
+    
+        default:
+    		return DefWindowProc (hWnd, message, wParam, lParam);
+        break;
+    } 
+
+    return 0;//!DefaultControlProc (hWnd, message, wParam, lParam);
+}
+
diff -urN lib/microwindows/src/mwin/winlib/mwuser.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/mwuser.c
--- lib/microwindows/src/mwin/winlib/mwuser.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/mwuser.c	2005-02-21 16:03:41.000000000 +0100
@@ -0,0 +1,7 @@
+#include "windows.h"
+
+int
+MwUserInit(int ac,char **av)
+{
+	return 0;
+}
diff -urN lib/microwindows/src/mwin/winlib/progbar.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/progbar.c
--- lib/microwindows/src/mwin/winlib/progbar.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/progbar.c	2005-02-21 16:13:26.000000000 +0100
@@ -0,0 +1,355 @@
+/*
+ * Copyright (C) 1999, 2000, Wei Yongming.
+ * Portions Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Progress bar for Microwindows win32 api.
+ */
+
+/*
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Library General Public
+**  License as published by the Free Software Foundation; either
+**  version 2 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Library General Public License for more details.
+**
+**  You should have received a copy of the GNU Library General Public
+**  License along with this library; if not, write to the Free
+**  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+**  MA 02111-1307, USA
+*/
+
+/*
+**  Alternatively, the contents of this file may be used under the terms 
+**  of the Mozilla Public License (the "MPL License") in which case the
+**  provisions of the MPL License are applicable instead of those above.
+*/
+
+// Copyright (C) 1999, 2000, Wei Yongming.
+//
+// Note:
+//   Originally by Zhao Jianghua. 
+//
+// Create date: 1999/8/29
+//
+// Modify records:
+//
+//  Who             When        Where       For What                Status
+//-----------------------------------------------------------------------------
+//  WEI Yongming    1999/10/27  Tsinghua    unsigned int            Finished
+//  WEI Yongming    1999/10/27  Tsinghua    FPException fixing      Finished
+//  WEI Yongming    2000/02/24  Tsinghua    Add MPL License         Finished
+//  Kevin Tseng     2000/05/24  gv          port to microwin        ported
+//  Greg Haerr      2000/06/15  Utah        removed floats          Finished
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define MWINCLUDECOLORS
+#include "windows.h"	/* windef.h, winuser.h */
+#include "wintools.h" 	/* Draw3dBox */
+#include "device.h" 	/* GdGetTextSize */
+
+#define TEST	1	/* =1 for testing*/
+
+#define  WIDTH_PBAR_BORDER  2 
+
+typedef  struct _PROGRESSDATA {
+    unsigned int nMin;
+    unsigned int nMax;
+    unsigned int nPos;
+    unsigned int nStepInc;
+} PROGRESSDATA, *PPROGRESSDATA;
+
+static LRESULT CALLBACK
+ProgressBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+int WINAPI MwRegisterProgressBarControl(HINSTANCE hInstance)
+{
+	WNDCLASS	wc;
+
+	wc.style	= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
+	wc.lpfnWndProc	= (WNDPROC)ProgressBarCtrlProc;
+	wc.cbClsExtra	= 0;
+	wc.cbWndExtra	= 0;
+	wc.hInstance	= hInstance;
+	wc.hIcon	= NULL;
+	wc.hCursor	= 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground= GetStockObject(LTGRAY_BRUSH);
+	wc.lpszMenuName	= NULL;
+	wc.lpszClassName= "PROGBAR";
+
+	return RegisterClass(&wc);
+}
+
+static void
+FillBox(HDC hdc, int x, int y, int w, int h, COLORREF cr)
+{
+	RECT	rc;
+
+	if (w <= 0)
+		return;
+	SetRect(&rc, x, y, x+w, y+h);
+	FastFillRect(hdc, &rc, cr);
+}
+
+static int
+GetSysCharWidth(HDC hdc)
+{
+	int	cw, ch, cb;
+
+	GdGetTextSize(hdc->font->pfont,"X",1, &cw,&ch,&cb,MWTF_ASCII);
+	return cw;
+}
+
+static int
+GetSysCharHeight(HDC hdc)
+{
+	int	cw, ch, cb;
+
+	GdGetTextSize(hdc->font->pfont,"X",1, &cw,&ch,&cb,MWTF_ASCII);
+	return ch;
+}
+
+void pbarOnDraw (HWND hwnd, HDC hdc, PROGRESSDATA* pData, BOOL fVertical,
+	BOOL fErase)
+{
+    int     x, y, w, h;
+    unsigned int     nAllPart;
+    unsigned int     nNowPart;
+    int     whOne, nRem;
+    int     ix, iy;
+    int     i;
+    int     step;
+    COLORREF cr;
+    RECT    rcClient;
+    char    szText[8];
+    
+    if (!hdc || (pData->nMax == pData->nMin))
+        return;
+    
+    if ((pData->nMax - pData->nMin) > 5)
+        step = 5;
+    else
+        step = 1;
+
+    GetClientRect (hwnd, &rcClient);
+    SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
+
+    x = rcClient.left + WIDTH_PBAR_BORDER;
+    y = rcClient.top + WIDTH_PBAR_BORDER;
+    w = (rcClient.right - rcClient.left) - (WIDTH_PBAR_BORDER << 1);
+    h = (rcClient.bottom - rcClient.top) - (WIDTH_PBAR_BORDER << 1);
+
+    nAllPart = (pData->nMax - pData->nMin) / step;
+    nNowPart = (pData->nPos - pData->nMin) / step;
+    if (fVertical) {
+        whOne = h / nAllPart;
+        nRem = h % nAllPart;
+    } else {
+        whOne = w / nAllPart;
+        nRem = w % nAllPart;
+    }
+        
+    if (fErase)
+	FillBox (hdc, x, y, w, h, GetSysColor(COLOR_BTNSHADOW));
+
+    if(whOne >= 4) {
+        if (fVertical) {
+            for (i = 0, iy = y + h - 1; i < nNowPart; ++i) {
+                //if ((iy - whOne) < y) 
+                    //whOne = iy - y;
+
+		FillBox (hdc, x, iy - whOne, w, whOne - 1, BLUE);
+
+                iy -= whOne + 1;
+                //if(nRem > 0) {
+                    //iy --;
+                    //nRem --;
+                //}
+            }
+        }
+        else {
+            for (i = 0, ix = x + 1; i < nNowPart; ++i) {
+                //if ((ix + whOne) > (x + w)) 
+                    //whOne = x + w - ix;
+		FillBox (hdc, ix, y, whOne - 1, h, BLUE);
+                ix += whOne + 1;
+                //if(nRem > 0) {
+                    //ix ++;
+                    //nRem --;
+                //}
+            }
+        }
+    }
+    else {
+        // no vertical support
+        int d = nNowPart*100/nAllPart;
+	int maxw = GetSysCharWidth (hdc) << 2;
+	int charh = GetSysCharHeight (hdc);
+
+	if (d > 50)
+	    cr = BLUE;
+        else
+	    cr = GetSysColor(COLOR_BTNSHADOW);
+	FillBox (hdc, x + ((w - maxw)>>1), y + ((h - charh) > 1), maxw,
+		charh - 1, cr);
+	FillBox (hdc, x, y, (int)((long)w*d/100L), h, BLUE);
+        SetTextColor (hdc, WHITE);
+        SetBkMode (hdc, TRANSPARENT);
+        sprintf (szText, "%d%%", d);
+        TextOut (hdc, x + ((w - GetSysCharWidth (hdc) * strlen (szText) )>>1), 
+                      y + ((h - GetSysCharHeight(hdc) )>>1), 
+                      szText, strlen(szText));
+    }
+}
+
+static void pbarNormalizeParams (const HWND pCtrl, 
+                PROGRESSDATA* pData, BOOL fNotify)
+{
+    if (pData->nPos > pData->nMax) {
+        if (fNotify)
+            SendMessage (GetParent ((HWND)pCtrl), WM_COMMAND, 
+		(WPARAM)MAKELONG (pCtrl->id, PBN_REACHMAX), (LPARAM)pCtrl);
+        pData->nPos = pData->nMax;
+    }
+
+    if (pData->nPos < pData->nMin) {
+        if (fNotify)
+            SendMessage (GetParent ((HWND)pCtrl), WM_COMMAND, 
+		(WPARAM)MAKELONG (pCtrl->id, PBN_REACHMIN), (LPARAM)pCtrl);
+        pData->nPos = pData->nMin;
+    }
+}
+
+static LRESULT CALLBACK
+ProgressBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    HDC           hdc;
+    HWND	  pCtrl;
+    PROGRESSDATA* pData;
+    BOOL          fErase;
+    RECT	rc;
+    PAINTSTRUCT ps;
+    int		pos;
+    
+    pCtrl = hwnd;
+    
+    switch (message)
+    {
+        case WM_CREATE:
+            if (!(pData = malloc (sizeof (PROGRESSDATA)))) {
+                fprintf(stderr, "Create progress bar control failure!\n");
+                return -1;
+            }
+            
+#if TEST
+            pData->nMax     = 1000;
+            pData->nMin     = 0;
+            pData->nPos     = 500;
+            pData->nStepInc = 100;
+#else
+            pData->nMax     = 100;
+            pData->nMin     = 0;
+            pData->nPos     = 0;
+            pData->nStepInc = 10;
+#endif
+
+            pCtrl->userdata = (DWORD)pData;
+        break;
+    
+        case WM_DESTROY:
+            free ((void *)(pCtrl->userdata));
+        break;
+
+        case WM_GETDLGCODE:
+            return DLGC_STATIC;
+
+	case WM_NCPAINT:
+		if(GetWindowLong(hwnd, GWL_STYLE) & WS_BORDER) {
+			GetWindowRect(hwnd, &rc);
+			hdc = GetWindowDC(hwnd);
+			Draw3dBox(hdc, rc.left, rc.top, rc.right-rc.left,
+				rc.bottom-rc.top, GetSysColor(COLOR_BTNSHADOW),
+				GetSysColor(COLOR_BTNHIGHLIGHT));
+		}
+	    break;
+
+	case WM_PAINT:
+            hdc = BeginPaint (hwnd,&ps);
+            pbarOnDraw (hwnd, hdc, (PROGRESSDATA *)pCtrl->userdata, 
+                            hwnd->style & PBS_VERTICAL, TRUE);
+            EndPaint (hwnd, &ps);
+            break;
+
+        case PBM_SETRANGE:
+            pData = (PROGRESSDATA *)pCtrl->userdata;
+            pData->nMin = min (wParam, lParam);
+            pData->nMax = max (wParam, lParam);
+            if (pData->nPos > pData->nMax)
+                pData->nPos = pData->nMax;
+            if (pData->nPos < pData->nMin)
+                pData->nPos = pData->nMin;
+        break;
+        
+        case PBM_SETSTEP:
+            pData = (PROGRESSDATA *)pCtrl->userdata;
+            pData->nStepInc = wParam;
+        break;
+        
+        case PBM_SETPOS:
+            pData = (PROGRESSDATA *)pCtrl->userdata;
+            
+            if (pData->nPos == wParam)
+                break;
+
+            fErase = (wParam < pData->nPos);
+            pData->nPos = wParam;
+            pbarNormalizeParams (pCtrl, pData, hwnd->style & PBS_NOTIFY);
+	    InvalidateRect(hwnd, NULL, fErase);
+        break;
+        
+        case PBM_DELTAPOS:
+            pData = (PROGRESSDATA *)pCtrl->userdata;
+
+            if (wParam == 0)
+                break;
+            
+            fErase = (wParam < 0);
+            pData->nPos += wParam;
+            pbarNormalizeParams (pCtrl, pData, hwnd->style & PBS_NOTIFY);
+	    InvalidateRect(hwnd, NULL, fErase);
+        break;
+        
+        case PBM_STEPIT:
+            pData = (PROGRESSDATA *)pCtrl->userdata;
+            
+            if (pData->nStepInc == 0)
+                break;
+
+            fErase = (pData->nStepInc < 0);
+            pData->nPos += pData->nStepInc;
+            pbarNormalizeParams (pCtrl, pData, hwnd->style & PBS_NOTIFY);
+	    InvalidateRect(hwnd, NULL, fErase);
+        break;
+            
+#if TEST
+	case WM_LBUTTONDOWN:
+	case WM_LBUTTONDBLCLK:
+                pData = (PROGRESSDATA *)pCtrl->userdata;
+		pos = pData->nPos;
+		pos += pData->nStepInc;
+		if (pos > pData->nMax)
+			pos = pData->nMin;
+		SendMessage(hwnd, PBM_SETPOS, pos, 0L);
+		break;
+#endif
+        default:
+    		return DefWindowProc (hwnd, message, wParam, lParam);
+    }
+    return 0;
+}
diff -urN lib/microwindows/src/mwin/winlib/ptinsid.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/ptinsid.c
--- lib/microwindows/src/mwin/winlib/ptinsid.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/ptinsid.c	2005-02-21 16:03:41.000000000 +0100
@@ -0,0 +1,18 @@
+#include "windows.h"
+#include "wintools.h"
+
+BOOL WINAPI
+PtInsideWindow(HWND hwnd,UINT x,UINT y)
+{
+	/* Determine whether or not the position ( x, y) is contained			*/
+	/* within the control's client rectangle.							*/
+
+	RECT	clientRect;
+	POINT	buttonPoint;
+
+	buttonPoint.x = x;
+	buttonPoint.y = y;
+
+	GetClientRect( hwnd, &clientRect);
+	return PtInRect( &clientRect, buttonPoint);
+}
diff -urN lib/microwindows/src/mwin/winlib/scrlbar.0 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/scrlbar.0
--- lib/microwindows/src/mwin/winlib/scrlbar.0	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/scrlbar.0	2005-02-21 16:13:27.000000000 +0100
@@ -0,0 +1,1157 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1999, 2000, Wei Yongming.
+ * jmt: scrollbar thumb ported
+ *
+ * Microwindows win32 Scrollbars control
+ */
+
+#define MWINCLUDECOLORS//jmt: for color macros
+#include "windows.h"
+#include "wintern.h"
+#include "wintools.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>//printf
+
+/* scroll bar style mask*/
+#define SBS_TYPEMASK		0x0001
+
+/* scrollbar status/positions*/
+#define SBS_UNKNOWN		0x0000
+#define SBS_LEFTARROW		0x0001
+#define SBS_RIGHTARROW		0x0002
+#define SBS_LEFTSPACE		0x0004
+#define SBS_RIGHTSPACE		0x0008
+#define SBS_HORZTHUMB		0x0010
+#define SBS_UPARROW		0x0020
+#define SBS_DOWNARROW		0x0040
+#define SBS_UPSPACE		0x0080
+#define SBS_DOWNSPACE		0x0100
+#define SBS_VERTTHUMB		0x0200
+#define SBS_MASK		0x03ff
+#define SBS_DISABLED		0x4000
+#define SBS_HIDE		0x8000
+
+
+#define MWM_DEFBARLEN	18//
+#define MWM_MINBARLEN	8//
+
+static LRESULT CALLBACK
+ScrollbarControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+
+int WINAPI MwRegisterScrollbarControl(HINSTANCE hInstance)
+{
+	WNDCLASS	wc;
+
+	wc.style	= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
+	wc.lpfnWndProc	= (WNDPROC)ScrollbarControlProc;
+	wc.cbClsExtra	= 0;
+	wc.cbWndExtra	= 0;
+	wc.hInstance	= hInstance;
+	wc.hIcon	= NULL;
+	wc.hCursor	= 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground= GetStockObject(WHITE_BRUSH);
+	wc.lpszMenuName	= NULL;
+	wc.lpszClassName= "SCROLLBAR";
+
+	return RegisterClass(&wc);
+}
+
+/****************************** Drawing Helpers *******************************/
+static void
+Draw3DUpFrame(HDC hDC, int l, int t, int r, int b)
+{
+	RECT	rc;
+	HBRUSH	hbr;
+
+	SetRect(&rc, l, t, r, b);
+	Draw3dBox(hDC, rc.left, rc.top,
+		rc.right-rc.left, rc.bottom-rc.top,
+		GetSysColor(COLOR_3DLIGHT),
+		GetSysColor(COLOR_WINDOWFRAME));
+	InflateRect(&rc, -1, -1);
+	Draw3dBox(hDC, rc.left, rc.top,
+		rc.right-rc.left, rc.bottom-rc.top,
+		GetSysColor(COLOR_BTNHIGHLIGHT),
+		GetSysColor(COLOR_BTNSHADOW));
+	InflateRect(&rc, -1, -1);
+
+	hbr = CreateSolidBrush(LTGRAY);
+	FillRect(hDC, &rc, hbr);
+	DeleteObject(hbr);
+}
+
+static DWORD GetWindowStyle (HWND hwnd)
+{
+	return hwnd->style;
+}
+
+static int
+wndGetBorder(HWND hwnd)
+{
+	if (hwnd->style & WS_BORDER)  {
+		if ((hwnd->style & WS_CAPTION) == WS_CAPTION)
+			return mwSYSMETRICS_CXFRAME;
+		return mwSYSMETRICS_CXBORDER;
+	}
+	return 0;
+}
+
+static BOOL
+wndGetVScrollBarRect (HWND hwnd, RECT* rcVBar)
+{
+	int cx,cy; RECT rc;
+    	MWSCROLLBARINFO* pData;
+	
+        pData = (MWSCROLLBARINFO *)hwnd->userdata;
+	rc = hwnd->winrect;//
+	cx=rc.right-rc.left;
+	cy=rc.bottom-rc.top;
+
+	rcVBar->left = hwnd->winrect.right - cx
+		- wndGetBorder (hwnd);
+	rcVBar->right = hwnd->winrect.right - wndGetBorder (hwnd);
+	rcVBar->top  = hwnd->winrect.top;
+	rcVBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd);
+
+	return TRUE;
+}
+
+static BOOL
+wndGetHScrollBarRect (HWND hwnd, RECT* rcHBar)
+{
+	int cx,cy; RECT rc;
+    	MWSCROLLBARINFO* pData;
+	
+        pData = (MWSCROLLBARINFO *)hwnd->userdata;
+	rc = hwnd->winrect;//
+	cx=rc.right-rc.left;
+	cy=rc.bottom-rc.top;
+
+        rcHBar->top = hwnd->winrect.bottom - cy
+                        - wndGetBorder (hwnd);
+        rcHBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd);
+        rcHBar->left  = hwnd->winrect.left;
+        rcHBar->right = hwnd->winrect.right - wndGetBorder (hwnd);
+
+        return TRUE;
+}
+
+void
+MwPaintScrollbars(HWND hwnd, HDC hdc, DWORD style)
+{
+	BOOL	vertbar = (style==SBS_VERT);
+        BOOL	horzbar = (style==SBS_HORZ);
+	BOOL	fGotDC = FALSE;
+	RECT	rc,rc2;
+
+	POINT	p3[3];
+	int	shrink=2;
+
+        int start = 0;
+        RECT rcHBar, rcVBar;
+
+	int cx,cy;
+    	MWSCROLLBARINFO* pData;
+	
+        pData = (MWSCROLLBARINFO *)hwnd->userdata;
+	rc = hwnd->winrect;//
+	cx=rc.right-rc.left;
+	cy=rc.bottom-rc.top;
+
+	if (!hdc && (horzbar || vertbar)) {
+		hdc = GetWindowDC(hwnd);
+		fGotDC = TRUE;
+	}
+
+	if (vertbar) {
+
+		/* up */
+		Draw3dUpDownState(hdc, rc.left, rc.top,
+			cx, cx,
+			pData->status & SBS_UPARROW);
+		/* down */
+		Draw3dUpDownState(hdc, rc.left,rc.bottom-cx,
+			cx, cx,
+			pData->status & SBS_DOWNARROW);
+//jmt: draw arrows
+		SelectObject(hdc,GetStockObject(BLACK_BRUSH));
+		/* up */
+		p3[0].x= rc.left + (cx/2) - 1;
+		p3[0].y= rc.top + 2 + shrink;
+		p3[1].x= rc.left + 2 + shrink - 1;
+		p3[1].y= rc.top + (cx-4) - shrink;
+		p3[2].x= rc.left + (cx-4) - shrink;
+		p3[2].y= rc.top + (cx-4) - shrink;
+		Polygon(hdc,p3,3);
+		/* down */
+		p3[0].x= rc.left + (cx/2) - 1;
+		p3[0].y= rc.bottom - 4 - shrink;
+		p3[1].x= rc.left + 2 + shrink - 1;
+		p3[1].y= rc.bottom-cx + 2 + shrink;
+		p3[2].x= rc.left + (cx-4) - shrink;
+		p3[2].y= rc.bottom-cx + 2 + shrink;
+		Polygon(hdc,p3,3);
+
+        	// draw moving bar
+
+    		wndGetVScrollBarRect (hwnd, &rcVBar);
+    		rcVBar.left -- ;
+    		//rcVBar.right -- ;
+
+        	start = rcVBar.top + cx + pData->barStart;
+                    
+        	if (start + pData->barLen > rcVBar.bottom)
+            		start = rcVBar.bottom - pData->barLen;
+		
+		if (pData->barLen == 0)
+			pData->barLen=rc.bottom-rc.top-(cx*2); 
+
+		/* bkgnd */
+		rc2.left=rc.left; rc2.right=rc.right/*-1*/;
+		rc2.top=rc.top+cx;
+		rc2.bottom=start;
+		if (rc2.bottom>rc2.top)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+		rc2.top=start+pData->barLen;
+		rc2.bottom=rc.bottom-cx;
+		if (rc2.bottom>rc2.top)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+        	Draw3DUpFrame (hdc, rcVBar.left, start, rcVBar.right,
+	    		start + pData->barLen);
+#if 0
+		printf("barv:(l,t,r,b):(%d,%d,%d,%d)\n",
+        		rcVBar.left, start, rcVBar.right,
+	    		start + pData->barLen);
+#endif
+
+	}
+	if (horzbar) {
+		/* left */
+		Draw3dUpDownState(hdc, rc.left, rc.top,
+			cy, cy,
+			pData->status & SBS_LEFTARROW);
+		/* right */
+		Draw3dUpDownState(hdc, rc.right-cy, rc.top,
+			cy, cy,
+			pData->status & SBS_RIGHTARROW);
+//jmt: draw arrows
+		SelectObject(hdc,GetStockObject(BLACK_BRUSH));
+		/* left */
+		p3[0].x= rc.left + 2 + shrink;
+		p3[0].y= rc.top + (cy/2) ;
+		p3[1].x= rc.left + (cy-4) - shrink ;
+		p3[1].y= rc.top + 2 + shrink;
+		p3[2].x= rc.left + (cy-4) - shrink;
+		p3[2].y= rc.bottom - 4 - shrink + 1;
+		Polygon(hdc,p3,3);
+		/* right */
+		p3[0].x= rc.right - 4 - shrink;
+		p3[0].y= rc.top + (cy/2) ;
+		p3[1].x= rc.right-cy + 2 + shrink ;
+		p3[1].y= rc.top + 2 + shrink;
+		p3[2].x= rc.right-cy + 2 + shrink;
+		p3[2].y= rc.bottom - 4 - shrink + 1;
+		Polygon(hdc,p3,3);
+
+        	// draw moving bar.
+
+    		wndGetHScrollBarRect (hwnd, &rcHBar);
+    		rcHBar.top -- ;
+    		//rcHBar.bottom -- ;
+
+        	start = rcHBar.left + cy + pData->barStart;
+
+        	if (start + pData->barLen > rcHBar.right)
+            		start = rcHBar.right - pData->barLen;
+
+		if (pData->barLen == 0)
+			pData->barLen=rc.right-rc.left-(cy*2); 
+
+		/* bkgnd */
+		rc2.top=rc.top; rc2.bottom=rc.bottom/*-1*/;
+		rc2.left=rc.left+cy;
+		rc2.right=start;
+		if (rc2.right>rc2.left)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+		rc2.left=start+pData->barLen;
+		rc2.right=rc.right-cy;
+		if (rc2.right>rc2.left)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+        	Draw3DUpFrame (hdc, start, rcHBar.top, start + pData->barLen,
+	    		rcHBar.bottom);
+#if 0
+		printf("barh:(l,t,r,b):(%d,%d,%d,%d)\n",
+        		start, rcHBar.top, start + pData->barLen,
+	    		rcHBar.bottom);
+#endif
+	}
+
+	if (fGotDC)
+		ReleaseDC(hwnd, hdc);
+}
+
+/* handle a non-client message for a scrollbar*/
+void
+MwHandleMessageScrollbar(HWND hwnd, WPARAM hitcode, LPARAM lParam, UINT msg, DWORD style)//
+{
+	int	pos = SBS_UNKNOWN;
+	BOOL	vertbar = (style==SBS_VERT);
+        BOOL	horzbar = (style==SBS_HORZ);
+	int *	pStat;
+	POINT	pt;
+	RECT	rc;
+
+	static BOOL bDraw;
+
+    	static int downPos = SBS_UNKNOWN;//
+    	static int sbCode;
+    	int newThumbPos;
+
+	int itemMoveable,itemCount,itemVisible,moveRange;//jmt:2k0819
+	int moveTop,moveBottom,moveLeft,moveRight;//jmt:2k0819
+
+	int cx,cy;
+    	MWSCROLLBARINFO* pData;
+	
+        pData = (MWSCROLLBARINFO *)hwnd->userdata;
+	rc = hwnd->winrect;//
+	cx=rc.right-rc.left;
+	cy=rc.bottom-rc.top;
+
+	POINTSTOPOINT(pt, lParam);
+	for (;;) {	/* use for() to allow break statement*/
+		if (vertbar) 
+		{
+			pStat = &pData->status;
+			rc = hwnd->winrect;//
+			rc.bottom = rc.top + cx;
+			if (PtInRect(&rc, pt)) 
+			{
+				pos = SBS_UPARROW;
+				break;
+			}
+			rc.bottom = hwnd->winrect.bottom;//
+			rc.top = rc.bottom - cx;
+			if (PtInRect(&rc, pt)) 
+			{
+				pos = SBS_DOWNARROW;
+				break;
+			}
+			pos = SBS_VERTTHUMB;
+		} else if (horzbar) 
+		{
+			pStat = &pData->status;
+			rc = hwnd->winrect;//
+			rc.right = rc.left + cy;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_LEFTARROW;
+				break;
+			}
+			rc.right = hwnd->winrect.right;//
+			rc.left = rc.right - cy;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_RIGHTARROW;
+				break;
+			}
+			pos = SBS_HORZTHUMB;
+		} else
+			return;
+		break;
+	}
+
+	if (pos == SBS_UNKNOWN)
+		return;
+
+	*pStat &= ~SBS_MASK;		/* remove stray mouse states*/
+
+	if (msg == WM_NCLBUTTONDOWN || msg == WM_NCLBUTTONDBLCLK)//
+		*pStat |= pos;
+	else *pStat &= ~pos;
+
+	if (msg == WM_NCLBUTTONDOWN || msg == WM_NCLBUTTONDBLCLK)
+		bDraw=TRUE;
+
+	if (bDraw)
+		MwPaintScrollbars(hwnd, NULL,style);
+
+        if (pos == SBS_UPARROW || pos == SBS_LEFTARROW)//jmt:2k0820 
+	{
+                if (pData->curPos != pData->minPos)
+			sbCode = SB_LINEUP;
+        }
+        else if (pos == SBS_DOWNARROW || pos == SBS_RIGHTARROW)//jmt:2k0820 
+	{
+                if (pData->curPos != pData->maxPos)
+			sbCode = SB_LINEDOWN;
+        }
+        else if (pos == SBS_VERTTHUMB || pos == SBS_HORZTHUMB)// 
+	{
+                sbCode = SB_THUMBTRACK;//
+        }
+
+	switch(msg)
+	{
+	case WM_NCLBUTTONDOWN:
+	case WM_NCLBUTTONDBLCLK:
+	    downPos = pos;
+        break;
+
+        case WM_NCMOUSEMOVE:
+	    if (vertbar) 
+	    {
+		if (sbCode == SB_THUMBTRACK && downPos == SBS_VERTTHUMB)// 
+	    	{
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->winrect;//
+			moveTop = rc.top + cx;
+			moveBottom = hwnd->winrect.bottom - cx;//
+			moveRange = moveBottom - moveTop;
+
+			itemCount = pData->maxPos - pData->minPos + 1;
+			itemVisible = pData->pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.y - moveTop) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveTop,itemMoveable,moveRange,newThumbPos);
+			//#
+
+                	if ( newThumbPos >= pData->minPos &&
+                    	     newThumbPos <= pData->maxPos)
+			{
+                    	     	SendMessage (hwnd,
+                        		WM_VSCROLL, SB_THUMBTRACK, newThumbPos);
+
+                    	     	SendMessage (GetParent(hwnd),
+                        		WM_VSCROLL, SB_THUMBTRACK, newThumbPos);
+			}
+                	break;
+            	}
+	    }
+	    if (horzbar) 
+	    {
+		if (sbCode == SB_THUMBTRACK && downPos == SBS_HORZTHUMB)// 
+		{
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->winrect;
+			moveLeft = rc.left + cy;
+			moveRight = hwnd->winrect.right - cy;
+			moveRange = moveRight - moveLeft;
+
+			itemCount = pData->maxPos - pData->minPos + 1;
+			itemVisible = pData->pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.x - moveLeft) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveLeft,itemMoveable,moveRange,newThumbPos);
+			//#
+			    
+			if ( newThumbPos >= pData->minPos &&
+			     newThumbPos <= pData->maxPos)
+			{
+			    	SendMessage (hwnd,
+					WM_HSCROLL, SB_THUMBTRACK, newThumbPos);
+
+			    	SendMessage (GetParent(hwnd),
+					WM_HSCROLL, SB_THUMBTRACK, newThumbPos);
+			}
+			break;
+		}
+             }
+        break;
+
+	case WM_NCLBUTTONUP:
+	    bDraw=FALSE;
+	    downPos = SBS_UNKNOWN;//
+
+	    if (sbCode==SB_THUMBTRACK)
+	    {
+		    if (vertbar) 
+		    {
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->winrect;
+			moveTop = rc.top + cx;
+			moveBottom = hwnd->winrect.bottom - cx;
+			moveRange = moveBottom - moveTop;
+
+			itemCount = pData->maxPos - pData->minPos + 1;
+			itemVisible = pData->pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.y - moveTop) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveTop,itemMoveable,moveRange,newThumbPos);
+			//#
+
+			if ( newThumbPos >= pData->minPos &&
+			     newThumbPos <= pData->maxPos)
+			{
+				SendMessage (hwnd,
+					WM_VSCROLL, SB_THUMBTRACK, newThumbPos);
+
+				SendMessage (GetParent(hwnd),
+					WM_VSCROLL, SB_THUMBTRACK, newThumbPos);
+			}
+			break;//case
+		    }
+		    if (horzbar) 
+		    {
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->winrect;
+			moveLeft = rc.left + cy;
+			moveRight = hwnd->winrect.right - cy;
+			moveRange = moveRight - moveLeft;
+
+			itemCount = pData->maxPos - pData->minPos + 1;
+			itemVisible = pData->pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.x - moveLeft) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveLeft,itemMoveable,moveRange,newThumbPos);
+			//#
+				    
+			if ( newThumbPos >= pData->minPos &&
+			     newThumbPos <= pData->maxPos)
+			{
+			    SendMessage (hwnd,
+					WM_HSCROLL, SB_THUMBTRACK, newThumbPos);
+
+			    SendMessage (GetParent(hwnd),
+					WM_HSCROLL, SB_THUMBTRACK, newThumbPos);
+			}
+			break;//case
+		    }
+	    }
+	    else
+	    {
+		if (vertbar) 
+		{
+			SendMessage (hwnd, WM_VSCROLL, sbCode, 0);
+			SendMessage (GetParent(hwnd), WM_VSCROLL, sbCode, 0);
+		}
+		if (horzbar) 
+		{
+			SendMessage (hwnd, WM_HSCROLL, sbCode, 0);
+			SendMessage (GetParent(hwnd), WM_HSCROLL, sbCode, 0);
+		}
+	    }
+	break;
+	}
+}
+
+
+static BOOL
+PtInRect2(const RECT *lprc, int x, int y)
+{
+	POINT	p;
+
+	p.x = x;
+	p.y = y;
+	return PtInRect(lprc, p);
+}
+
+static void
+wndScrollBarPos (HWND hwnd, BOOL bIsHBar, RECT* rcBar)//jmt: 2k0820
+{
+    UINT moveRange;
+    PMWSCROLLBARINFO pSBar;
+    int cx,cy;
+    RECT rc;
+	
+    rc = hwnd->winrect;//
+    cx=rc.right-rc.left;
+    cy=rc.bottom-rc.top;
+    pSBar = (MWSCROLLBARINFO *)hwnd->userdata;
+
+    if (pSBar->minPos == pSBar->maxPos) {
+        pSBar->status |= SBS_HIDE;
+        return;
+    }
+
+    if (bIsHBar)
+        moveRange = (rcBar->right - rcBar->left) - (cy << 1);
+    else
+        moveRange = (rcBar->bottom - rcBar->top) - (cx << 1);
+
+
+    if (pSBar->pageStep == 0) 
+    {
+        pSBar->barLen = MWM_DEFBARLEN;
+
+        if (pSBar->barLen > moveRange)
+            pSBar->barLen = MWM_MINBARLEN;
+    }
+    else 
+    {
+        pSBar->barLen = moveRange * pSBar->pageStep /
+	      (pSBar->maxPos - pSBar->minPos + 1);
+        if (pSBar->barLen < MWM_MINBARLEN)
+            pSBar->barLen = MWM_MINBARLEN;
+    }
+
+    pSBar->barStart = moveRange * (pSBar->curPos - pSBar->minPos) /
+       (pSBar->maxPos - pSBar->minPos + 1);
+
+
+    if (pSBar->barStart + pSBar->barLen > moveRange)
+        pSBar->barStart = moveRange - pSBar->barLen;
+
+
+    if (pSBar->barStart < 0)
+        pSBar->barStart = 0;
+}
+
+static PMWSCROLLBARINFO wndGetScrollBar (HWND pWin)//jmt: 2k0820
+{
+    	MWSCROLLBARINFO* pData;
+	
+        pData = (MWSCROLLBARINFO *)pWin->userdata;
+
+	if (!strcmp(pWin->pClass->lpszClassName,"SCROLLBAR"))
+		return pData;
+	else
+    		return NULL;
+}
+
+BOOL EnableScrollBarEx (HWND hWnd, int iSBar, BOOL bEnable)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    BOOL bPrevState;
+    RECT rcBar;
+    
+    DWORD dwStyle;//jmt:2k0820
+
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )//ok
+        return FALSE;
+
+    bPrevState = !(pSBar->status & SBS_DISABLED);
+
+    if (bEnable && !bPrevState)
+        pSBar->status &= ~SBS_DISABLED;
+    else if (!bEnable && bPrevState)
+        pSBar->status |= SBS_DISABLED;
+    else
+        return FALSE;
+
+    dwStyle = (GetWindowStyle (hWnd) & SBS_TYPEMASK);//jmt: 2k0820
+
+    if (dwStyle == SBS_VERT)//
+    {
+        wndGetVScrollBarRect (pWin, &rcBar);
+        rcBar.left --;
+        rcBar.right --;
+    }
+    else
+    {
+        wndGetHScrollBarRect (pWin, &rcBar);
+        rcBar.top  --;
+        rcBar.bottom --;
+    }
+#if 0
+    SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+    MwPaintScrollbars(hWnd,NULL,dwStyle);//a must
+#endif
+
+    return TRUE;
+}
+
+BOOL GetScrollPosEx (HWND hWnd, int iSBar, int* pPos)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )
+        return FALSE;
+
+    *pPos = pSBar->curPos;
+    return TRUE;
+}
+
+BOOL GetScrollRangeEx (HWND hWnd, int iSBar, int* pMinPos, int* pMaxPos)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )
+        return FALSE;
+
+    *pMinPos = pSBar->minPos;
+    *pMaxPos = pSBar->maxPos;
+    return TRUE;
+}
+
+BOOL SetScrollPosEx (HWND hWnd, int iSBar, int iNewPos)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    RECT rcBar;
+    
+    DWORD dwStyle;//jmt:2k0820
+
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )
+        return FALSE;
+
+    if (iNewPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+    else
+        pSBar->curPos = iNewPos;
+
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+    
+    dwStyle = (GetWindowStyle (hWnd) & SBS_TYPEMASK);//jmt: 2k0820
+
+    if (dwStyle == SBS_VERT)
+    {
+        wndGetVScrollBarRect (pWin, &rcBar);
+        rcBar.left --;
+        rcBar.right --;
+    }
+    else
+    {
+        wndGetHScrollBarRect (pWin, &rcBar);
+        rcBar.top  --;
+        rcBar.bottom --;
+    }
+
+    wndScrollBarPos (pWin, dwStyle == SBS_HORZ, &rcBar);
+
+#if 0
+    SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+    MwPaintScrollbars(hWnd,NULL,dwStyle);//a must
+#endif
+    return TRUE;
+}
+
+BOOL SetScrollRangeEx (HWND hWnd, int iSBar, int iMinPos, int iMaxPos)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    RECT rcBar;
+    
+    DWORD dwStyle;//jmt:2k0820
+
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )
+        return FALSE;
+
+    pSBar->minPos = (iMinPos < iMaxPos)?iMinPos:iMaxPos;
+    pSBar->maxPos = (iMinPos > iMaxPos)?iMinPos:iMaxPos;
+    
+    // validate parameters.
+    if (pSBar->curPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+
+    if (pSBar->pageStep <= 0)
+        pSBar->pageStep = 0;
+    else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1))
+        pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1;
+    
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+
+    dwStyle = (GetWindowStyle (hWnd) & SBS_TYPEMASK);//jmt: 2k0820
+
+    if (dwStyle == SBS_VERT)
+    {
+        wndGetVScrollBarRect (pWin, &rcBar);
+    	rcBar.left --;
+      	rcBar.right --;
+    }
+    else
+    {
+        wndGetHScrollBarRect (pWin, &rcBar);
+    	rcBar.top  --;
+    	rcBar.bottom --;
+    }
+    wndScrollBarPos (pWin, dwStyle == SBS_HORZ, &rcBar);
+
+#if 0
+    SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+    MwPaintScrollbars(hWnd,NULL,dwStyle);//a must
+#endif
+
+    return TRUE;
+}
+
+BOOL SetScrollInfoEx (HWND hWnd, int iSBar, 
+                LPCSCROLLINFO lpsi, BOOL fRedraw)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    RECT rcBar;
+    
+    DWORD dwStyle;//jmt:2k0820
+
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )
+        return FALSE;
+        
+    if( lpsi->fMask & SIF_RANGE )
+    {
+        pSBar->minPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMin:lpsi->nMax;
+        pSBar->maxPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMax:lpsi->nMin;
+    }
+    
+    if( lpsi->fMask & SIF_POS )
+        pSBar->curPos = lpsi->nPos;
+    
+    if( lpsi->fMask & SIF_PAGE )
+        pSBar->pageStep = lpsi->nPage;
+
+    // validate parameters.
+    if (pSBar->curPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+
+    if (pSBar->pageStep <= 0)
+        pSBar->pageStep = 0;
+    else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1))
+        pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1;
+    
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+
+    dwStyle = (GetWindowStyle (hWnd) & SBS_TYPEMASK);//jmt: 2k0820
+
+    if(fRedraw)
+    {
+        if (dwStyle == SBS_VERT)
+	{
+            wndGetVScrollBarRect (pWin, &rcBar);
+            rcBar.left --;
+            rcBar.right --;
+	}
+        else
+	{
+            wndGetHScrollBarRect (pWin, &rcBar);
+            rcBar.top --;
+            rcBar.bottom --;
+	}
+        wndScrollBarPos (pWin, dwStyle == SBS_HORZ, &rcBar);
+
+#if 0
+        SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+	MwPaintScrollbars(hWnd,NULL,dwStyle);//a must
+#endif
+    }
+    
+    return TRUE;
+}
+
+BOOL GetScrollInfoEx(HWND hWnd, int iSBar, LPSCROLLINFO lpsi)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )
+        return FALSE;
+        
+    if( lpsi->fMask & SIF_RANGE )
+    {
+        lpsi->nMin = pSBar->minPos;
+        lpsi->nMax = pSBar->maxPos;
+    }
+    
+    if( lpsi->fMask & SIF_POS )
+    {
+        lpsi->nPos = pSBar->curPos;
+    }
+    
+    if( lpsi->fMask & SIF_PAGE )
+        lpsi->nPage = pSBar->pageStep;
+    
+    return TRUE;
+}
+
+BOOL ShowScrollBarEx (HWND hWnd, int iSBar, BOOL bShow)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    BOOL bPrevState;
+    RECT rcBar;
+    
+    DWORD dwStyle;//jmt:2k0820
+
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )
+        return FALSE;
+
+    bPrevState = !(pSBar->status & SBS_HIDE);
+
+    if (bShow && !bPrevState)
+        pSBar->status &= ~SBS_HIDE;
+    else if (!bShow && bPrevState)
+        pSBar->status |= SBS_HIDE;
+    else
+        return FALSE;
+
+#if 0//fix: no WM_CHANGESIZE
+    SendMessage (hWnd, WM_CHANGESIZE, 0, 0);
+#endif
+
+    dwStyle = (GetWindowStyle (hWnd) & SBS_TYPEMASK);//jmt: 2k0820
+
+    if (dwStyle == SBS_VERT)
+        wndGetVScrollBarRect (pWin, &rcBar);
+    else
+        wndGetHScrollBarRect (pWin, &rcBar);
+
+    {
+        RECT rcWin, rcClient;
+        
+        memcpy (&rcWin, &pWin->winrect.left, sizeof (RECT));
+        
+        rcClient.left = 0;
+        rcClient.top  = 0;
+        rcClient.right = pWin->clirect.right - pWin->clirect.left;
+        rcClient.bottom = pWin->clirect.bottom - pWin->clirect.top;
+#if 0//fix: no WM_SIZECHANGED
+        SendMessage (hWnd, WM_SIZECHANGED, 
+            (WPARAM)&rcWin, (LPARAM)&rcClient);
+#endif
+    }
+    
+    if (bShow) {
+        SendMessage (hWnd, WM_NCPAINT, 0, 0);
+    }
+    else {
+        rcBar.left -= pWin->clirect.left;
+        rcBar.top  -= pWin->clirect.top;
+        rcBar.right -= pWin->clirect.left;
+        rcBar.bottom -= pWin->clirect.top;
+        SendMessage (hWnd, WM_NCPAINT, 0, 0);
+        InvalidateRect (hWnd, &rcBar, TRUE);
+    }
+
+    return TRUE;
+}
+
+static void sbSetScrollInfo (HWND hwnd, PMWSCROLLBARINFO pData, BOOL fRedraw)//jmt:2k0820
+{
+    SCROLLINFO si;
+
+    int itemCount,itemVisibles;
+
+    itemCount = pData->maxPos - pData->minPos + 1;
+    itemVisibles = pData->pageStep;
+
+    if (itemVisibles >= itemCount) 
+    {
+	SetScrollPosEx (hwnd, 0, 0);//jmt: arg2 not used
+	EnableScrollBarEx (hwnd, 0, FALSE);//jmt: arg2 not used
+        return;
+    }
+    
+    si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
+    si.nMax = itemCount - 1;
+    si.nMin = 0;
+
+    si.nPage = itemVisibles;//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+    si.nPos = pData->curPos;
+
+    SetScrollInfoEx (hwnd, 0, &si, fRedraw);//jmt: arg2 not used
+    EnableScrollBarEx (hwnd, 0, TRUE);//jmt: arg2 not used
+}
+
+static LRESULT CALLBACK
+ScrollbarControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)//jmt:2k0820
+{
+    	DWORD dwStyle;
+    	MWSCROLLBARINFO* pData;
+
+	int moveRange;
+	RECT rcBar;
+
+	dwStyle = (GetWindowStyle (hwnd) & SBS_TYPEMASK);
+    	switch (message) 
+	{
+        case WM_CREATE:
+            	if (!(pData = malloc (sizeof (MWSCROLLBARINFO)))) 
+		{
+                	fprintf(stderr, "Create scroll bar control failure!\n");
+                	return -1;
+            	}
+
+		pData->minPos=0;           /* min value of scroll range.*/
+		/* max value of scroll range.*/
+		pData->maxPos=0;     
+		if  (dwStyle==SBS_VERT)
+			moveRange=((hwnd->winrect.bottom-hwnd->winrect.top)
+				-((hwnd->winrect.right-hwnd->winrect.left)<<1));
+		else
+			moveRange=((hwnd->winrect.right-hwnd->winrect.left)
+				-((hwnd->winrect.bottom-hwnd->winrect.top)<<1));
+		if (moveRange > MWM_MINBARLEN)
+		{
+
+
+			pData->maxPos=moveRange / MWM_MINBARLEN;
+			if( (moveRange % MWM_MINBARLEN) )
+				pData->maxPos++;
+		}     
+		printf("maxPos=%d\n",pData->maxPos);
+
+		pData->curPos=0;             /* current scroll pos.*/
+
+		/* steps per page.*/
+		pData->pageStep=1;
+		if ( (pData->maxPos - 2) > 1)
+			pData->pageStep = pData->maxPos - 2;
+		printf("pageStep=%d\n",pData->pageStep);
+
+		pData->barStart=0;           /* start pixel of bar.*/
+		pData->barLen=MWM_MINBARLEN; /* length of bar.*/
+		pData->status=SBS_UNKNOWN;   /* status of scroll bar.*/
+#if 0//jmt: must handle WM_MOVE
+		//?pData->rc=hwnd->winrect;   /* screen coordinates position*/
+#endif
+            	hwnd->userdata = (DWORD)pData;
+
+		if (dwStyle == SBS_VERT)
+		{
+		    wndGetVScrollBarRect (hwnd, &rcBar);
+		    rcBar.left --;
+		    rcBar.right --;
+		}
+		else
+		{
+		    wndGetHScrollBarRect (hwnd, &rcBar);
+		    rcBar.top --;
+		    rcBar.bottom --;
+		}
+		//adjust pData->barLen
+		wndScrollBarPos (hwnd, dwStyle == SBS_HORZ, &rcBar);
+
+        	break;
+            
+        case WM_DESTROY: 
+            	free ((void *)(hwnd->userdata));
+            	break;
+
+        case WM_PAINT:
+		MwPaintScrollbars(hwnd,NULL,dwStyle);
+            	break;
+	
+	case WM_NCLBUTTONDOWN:
+	case WM_NCLBUTTONDBLCLK:
+	case WM_NCMOUSEMOVE:
+	case WM_NCLBUTTONUP:
+		MwHandleMessageScrollbar(hwnd, wParam, lParam, message, dwStyle);
+		break;
+
+        case WM_HSCROLL:
+        case WM_VSCROLL:
+        {
+            int newTop,itemCount,itemVisibles;
+            //int scrollHeight = 0;
+
+	    pData = (MWSCROLLBARINFO *)hwnd->userdata;
+            newTop = pData->curPos;
+	    itemCount = pData->maxPos - pData->minPos + 1;
+	    itemVisibles = pData->pageStep;
+
+            switch(wParam)
+            {
+                case SB_LINEDOWN:
+#define ITEM_BOTTOM(x)  (x->curPos + itemVisibles - 1)
+                    if (ITEM_BOTTOM (pData) < (itemCount - 1 )) 
+		    {
+                        newTop ++;
+                    }
+                break;
+                
+                case SB_LINEUP:
+                    if (pData->curPos > 0) 
+		    {
+                        newTop --;
+                    }
+                break;
+                
+                case SB_PAGEDOWN:
+                    if ((pData->curPos + (itemVisibles << 1)) <=
+                            itemCount)
+                        newTop += itemVisibles;
+                    else
+                        newTop = itemCount - itemVisibles;
+
+                    if (newTop < 0)
+                        return 0;
+
+                break;
+
+                case SB_PAGEUP:
+                    if (pData->curPos >= itemVisibles)
+                        newTop -= itemVisibles;
+                    else
+                        newTop = 0;
+
+                break;
+
+                case SB_THUMBTRACK:
+                    newTop = (int)lParam;
+                break;
+            }
+            
+            pData->curPos = newTop;
+
+            SendMessage (hwnd, WM_PAINT, 0, 0);
+
+            sbSetScrollInfo (hwnd, pData, TRUE);
+
+            return 0;
+        }
+        break;
+
+        default:
+    		return DefWindowProc (hwnd, message, wParam, lParam);
+    	}
+    	return 0;
+}
+
diff -urN lib/microwindows/src/mwin/winlib/scrlbar.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/scrlbar.c
--- lib/microwindows/src/mwin/winlib/scrlbar.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/scrlbar.c	2005-02-21 16:13:26.000000000 +0100
@@ -0,0 +1,1150 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1999, 2000, Wei Yongming.
+ * jmt: scrollbar thumb ported
+ *
+ * Microwindows win32 Scrollbars control
+ */
+
+#define MWINCLUDECOLORS//jmt: for color macros
+#include "windows.h"
+#include "wintern.h"
+#include "wintools.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>//printf
+
+/* scrollbar status/positions*/
+#define SBS_UNKNOWN		0x0000
+#define SBS_LEFTARROW		0x0001
+#define SBS_RIGHTARROW		0x0002
+#define SBS_LEFTSPACE		0x0004
+#define SBS_RIGHTSPACE		0x0008
+#define SBS_HORZTHUMB		0x0010
+#define SBS_UPARROW		0x0020
+#define SBS_DOWNARROW		0x0040
+#define SBS_UPSPACE		0x0080
+#define SBS_DOWNSPACE		0x0100
+#define SBS_VERTTHUMB		0x0200
+#define SBS_MASK		0x03ff
+#define SBS_DISABLED		0x4000
+#define SBS_HIDE		0x8000
+
+
+#define MWM_DEFBARLEN	18//
+#define MWM_MINBARLEN	8//
+
+static LRESULT CALLBACK
+ScrollbarControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+
+int WINAPI MwRegisterScrollbarControl(HINSTANCE hInstance)
+{
+	WNDCLASS	wc;
+
+	wc.style	= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
+	wc.lpfnWndProc	= (WNDPROC)ScrollbarControlProc;
+	wc.cbClsExtra	= 0;
+	wc.cbWndExtra	= 0;
+	wc.hInstance	= hInstance;
+	wc.hIcon	= NULL;
+	wc.hCursor	= 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground= GetStockObject(WHITE_BRUSH);
+	wc.lpszMenuName	= NULL;
+	wc.lpszClassName= "SCROLLBAR";
+
+	return RegisterClass(&wc);
+}
+
+static DWORD GetWindowStyle (HWND hwnd)
+{
+	return hwnd->style;
+}
+
+static int
+wndGetBorder(HWND hwnd)
+{
+	if (hwnd->style & WS_BORDER)  {
+		if ((hwnd->style & WS_CAPTION) == WS_CAPTION)
+			return mwSYSMETRICS_CXFRAME;
+		return mwSYSMETRICS_CXBORDER;
+	}
+	return 0;
+}
+
+static BOOL
+wndGetVScrollBarRect (HWND hwnd, RECT* rcVBar)
+{
+	int cx,cy; RECT rc;
+    	MWSCROLLBARINFO* pData;
+	
+        pData = (MWSCROLLBARINFO *)hwnd->userdata;
+	rc = hwnd->winrect;//
+	cx=rc.right-rc.left;
+	cy=rc.bottom-rc.top;
+
+	rcVBar->left = hwnd->winrect.right - cx
+		- wndGetBorder (hwnd);
+	rcVBar->right = hwnd->winrect.right - wndGetBorder (hwnd);
+	rcVBar->top  = hwnd->winrect.top;
+	rcVBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd);
+
+	return TRUE;
+}
+
+static BOOL
+wndGetHScrollBarRect (HWND hwnd, RECT* rcHBar)
+{
+	int cx,cy; RECT rc;
+    	MWSCROLLBARINFO* pData;
+	
+        pData = (MWSCROLLBARINFO *)hwnd->userdata;
+	rc = hwnd->winrect;//
+	cx=rc.right-rc.left;
+	cy=rc.bottom-rc.top;
+
+        rcHBar->top = hwnd->winrect.bottom - cy
+                        - wndGetBorder (hwnd);
+        rcHBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd);
+        rcHBar->left  = hwnd->winrect.left;
+        rcHBar->right = hwnd->winrect.right - wndGetBorder (hwnd);
+
+        return TRUE;
+}
+
+void
+MwPaintScrollbars(HWND hwnd, HDC hdc, DWORD style)
+{
+	BOOL	vertbar = (style==SBS_VERT);
+        BOOL	horzbar = (style==SBS_HORZ);
+	BOOL	fGotDC = FALSE;
+	RECT	rc,rc2;
+
+	POINT	p3[3];
+	int	shrink=2;
+
+        int start = 0;
+        RECT rcHBar, rcVBar;
+
+	int cx,cy;
+    	MWSCROLLBARINFO* pData;
+	
+        pData = (MWSCROLLBARINFO *)hwnd->userdata;
+	rc = hwnd->winrect;//
+	cx=rc.right-rc.left;
+	cy=rc.bottom-rc.top;
+
+	if (!hdc && (horzbar || vertbar)) {
+		hdc = GetWindowDC(hwnd);
+		fGotDC = TRUE;
+	}
+
+	if (vertbar) {
+
+#if 1
+		/* bkgnd */
+		rc2.left=rc.left; rc2.right=rc2.left+ cx;
+		rc2.top=rc.top;
+		rc2.bottom=rc2.top+ cx;
+		FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1));
+		rc2.top=rc.bottom- cx;
+		rc2.bottom=rc2.top+ cx;
+		FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1));
+#endif
+		/* up */
+		Draw3dUpDownState(hdc, rc.left, rc.top,
+			cx, cx,
+			pData->status & SBS_UPARROW);
+		/* down */
+		Draw3dUpDownState(hdc, rc.left,rc.bottom-cx,
+			cx, cx,
+			pData->status & SBS_DOWNARROW);
+//jmt: draw arrows
+		SelectObject(hdc,GetStockObject(BLACK_BRUSH));
+		/* up */
+		p3[0].x= rc.left + (cx/2) - 1;
+		p3[0].y= rc.top + 2 + shrink;
+		p3[1].x= rc.left + 2 + shrink - 1;
+		p3[1].y= rc.top + (cx-4) - shrink;
+		p3[2].x= rc.left + (cx-4) - shrink;
+		p3[2].y= rc.top + (cx-4) - shrink;
+		Polygon(hdc,p3,3);
+		/* down */
+		p3[0].x= rc.left + (cx/2) - 1;
+		p3[0].y= rc.bottom - 4 - shrink;
+		p3[1].x= rc.left + 2 + shrink - 1;
+		p3[1].y= rc.bottom-cx + 2 + shrink;
+		p3[2].x= rc.left + (cx-4) - shrink;
+		p3[2].y= rc.bottom-cx + 2 + shrink;
+		Polygon(hdc,p3,3);
+
+        	// draw moving bar
+
+    		wndGetVScrollBarRect (hwnd, &rcVBar);
+    		rcVBar.left -- ;
+    		//rcVBar.right -- ;
+
+        	start = rcVBar.top + cx + pData->barStart;
+                    
+        	if (start + pData->barLen > rcVBar.bottom)
+            		start = rcVBar.bottom - pData->barLen;
+		
+		if (pData->barLen == 0)
+			pData->barLen=rc.bottom-rc.top-(cx*2); 
+
+		/* bkgnd */
+		rc2.left=rc.left; rc2.right=rc.right/*-1*/;
+		rc2.top=rc.top+cx;
+		rc2.bottom=start;
+		if (rc2.bottom>rc2.top)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+		rc2.top=start+pData->barLen;
+		rc2.bottom=rc.bottom-cx;
+		if (rc2.bottom>rc2.top)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+        	Draw3dUpFrame (hdc, rcVBar.left, start, rcVBar.right,
+	    		start + pData->barLen);
+#if 0
+		printf("barv:(l,t,r,b):(%d,%d,%d,%d)\n",
+        		rcVBar.left, start, rcVBar.right,
+	    		start + pData->barLen);
+#endif
+
+	}
+	if (horzbar) {
+#if 1
+		/* bkgnd */
+		rc2.top=rc.top; rc2.bottom=rc2.top+ cy;
+		rc2.left=rc.left;
+		rc2.right=rc2.left+ cy;
+		FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1));
+		rc2.left=rc.right- cy;
+		rc2.right=rc2.left+ cy;
+		FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1));
+#endif
+		/* left */
+		Draw3dUpDownState(hdc, rc.left, rc.top,
+			cy, cy,
+			pData->status & SBS_LEFTARROW);
+		/* right */
+		Draw3dUpDownState(hdc, rc.right-cy, rc.top,
+			cy, cy,
+			pData->status & SBS_RIGHTARROW);
+//jmt: draw arrows
+		SelectObject(hdc,GetStockObject(BLACK_BRUSH));
+		/* left */
+		p3[0].x= rc.left + 2 + shrink;
+		p3[0].y= rc.top + (cy/2) ;
+		p3[1].x= rc.left + (cy-4) - shrink ;
+		p3[1].y= rc.top + 2 + shrink;
+		p3[2].x= rc.left + (cy-4) - shrink;
+		p3[2].y= rc.bottom - 4 - shrink + 1;
+		Polygon(hdc,p3,3);
+		/* right */
+		p3[0].x= rc.right - 4 - shrink;
+		p3[0].y= rc.top + (cy/2) ;
+		p3[1].x= rc.right-cy + 2 + shrink ;
+		p3[1].y= rc.top + 2 + shrink;
+		p3[2].x= rc.right-cy + 2 + shrink;
+		p3[2].y= rc.bottom - 4 - shrink + 1;
+		Polygon(hdc,p3,3);
+
+        	// draw moving bar.
+
+    		wndGetHScrollBarRect (hwnd, &rcHBar);
+    		rcHBar.top -- ;
+    		//rcHBar.bottom -- ;
+
+        	start = rcHBar.left + cy + pData->barStart;
+
+        	if (start + pData->barLen > rcHBar.right)
+            		start = rcHBar.right - pData->barLen;
+
+		if (pData->barLen == 0)
+			pData->barLen=rc.right-rc.left-(cy*2); 
+
+		/* bkgnd */
+		rc2.top=rc.top; rc2.bottom=rc.bottom/*-1*/;
+		rc2.left=rc.left+cy;
+		rc2.right=start;
+		if (rc2.right>rc2.left)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+		rc2.left=start+pData->barLen;
+		rc2.right=rc.right-cy;
+		if (rc2.right>rc2.left)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+        	Draw3dUpFrame (hdc, start, rcHBar.top, start + pData->barLen,
+	    		rcHBar.bottom);
+#if 0
+		printf("barh:(l,t,r,b):(%d,%d,%d,%d)\n",
+        		start, rcHBar.top, start + pData->barLen,
+	    		rcHBar.bottom);
+#endif
+	}
+
+	if (fGotDC)
+		ReleaseDC(hwnd, hdc);
+}
+
+/* handle a non-client message for a scrollbar*/
+void
+MwHandleMessageScrollbar(HWND hwnd, WPARAM hitcode, LPARAM lParam, UINT msg, DWORD style)//
+{
+	int	pos = SBS_UNKNOWN;
+	BOOL	vertbar = (style==SBS_VERT);
+        BOOL	horzbar = (style==SBS_HORZ);
+	int *	pStat;
+	POINT	pt;
+	RECT	rc;
+
+	static BOOL bDraw;
+
+    	static int downPos = SBS_UNKNOWN;//
+    	static int sbCode;
+    	int newThumbPos;
+
+	int itemMoveable,itemCount,itemVisible,moveRange;//jmt:2k0819
+	int moveTop,moveBottom,moveLeft,moveRight;//jmt:2k0819
+
+	int cx,cy;
+    	MWSCROLLBARINFO* pData;
+	
+        pData = (MWSCROLLBARINFO *)hwnd->userdata;
+	rc = hwnd->winrect;//
+	cx=rc.right-rc.left;
+	cy=rc.bottom-rc.top;
+
+	POINTSTOPOINT(pt, lParam);
+	for (;;) {	/* use for() to allow break statement*/
+		if (vertbar) 
+		{
+			pStat = &pData->status;
+			rc = hwnd->winrect;//
+			rc.bottom = rc.top + cx;
+			if (PtInRect(&rc, pt)) 
+			{
+				pos = SBS_UPARROW;
+				break;
+			}
+			rc.bottom = hwnd->winrect.bottom;//
+			rc.top = rc.bottom - cx;
+			if (PtInRect(&rc, pt)) 
+			{
+				pos = SBS_DOWNARROW;
+				break;
+			}
+			pos = SBS_VERTTHUMB;
+		} else if (horzbar) 
+		{
+			pStat = &pData->status;
+			rc = hwnd->winrect;//
+			rc.right = rc.left + cy;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_LEFTARROW;
+				break;
+			}
+			rc.right = hwnd->winrect.right;//
+			rc.left = rc.right - cy;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_RIGHTARROW;
+				break;
+			}
+			pos = SBS_HORZTHUMB;
+		} else
+			return;
+		break;
+	}
+
+	if (pos == SBS_UNKNOWN)
+		return;
+
+	*pStat &= ~SBS_MASK;		/* remove stray mouse states*/
+
+	if (msg == WM_NCLBUTTONDOWN || msg == WM_NCLBUTTONDBLCLK)//
+		*pStat |= pos;
+	else *pStat &= ~pos;
+
+	if (msg == WM_NCLBUTTONDOWN || msg == WM_NCLBUTTONDBLCLK)
+		bDraw=TRUE;
+
+	if (bDraw)
+		MwPaintScrollbars(hwnd, NULL,style);
+
+        if (pos == SBS_UPARROW || pos == SBS_LEFTARROW)//jmt:2k0820 
+	{
+                if (pData->curPos != pData->minPos)
+			sbCode = SB_LINEUP;
+        }
+        else if (pos == SBS_DOWNARROW || pos == SBS_RIGHTARROW)//jmt:2k0820 
+	{
+                if (pData->curPos != pData->maxPos)
+			sbCode = SB_LINEDOWN;
+        }
+        else if (pos == SBS_VERTTHUMB || pos == SBS_HORZTHUMB)// 
+	{
+                sbCode = SB_THUMBTRACK;//
+        }
+
+	switch(msg)
+	{
+	case WM_NCLBUTTONDOWN:
+	case WM_NCLBUTTONDBLCLK:
+	    downPos = pos;
+        break;
+
+        case WM_NCMOUSEMOVE:
+	    if (vertbar) 
+	    {
+		if (sbCode == SB_THUMBTRACK && downPos == SBS_VERTTHUMB)// 
+	    	{
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->winrect;//
+			moveTop = rc.top + cx;
+			moveBottom = hwnd->winrect.bottom - cx;//
+			moveRange = moveBottom - moveTop;
+
+			itemCount = pData->maxPos - pData->minPos + 1;
+			itemVisible = pData->pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.y - moveTop) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveTop,itemMoveable,moveRange,newThumbPos);
+			//#
+
+                	if ( newThumbPos >= pData->minPos &&
+                    	     newThumbPos <= pData->maxPos)
+			{
+                    	     	SendMessage (hwnd,
+                        		WM_VSCROLL, SB_THUMBTRACK, newThumbPos);
+
+                    	     	SendMessage (GetParent(hwnd),
+                        		WM_VSCROLL, SB_THUMBTRACK, newThumbPos);
+			}
+                	break;
+            	}
+	    }
+	    if (horzbar) 
+	    {
+		if (sbCode == SB_THUMBTRACK && downPos == SBS_HORZTHUMB)// 
+		{
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->winrect;
+			moveLeft = rc.left + cy;
+			moveRight = hwnd->winrect.right - cy;
+			moveRange = moveRight - moveLeft;
+
+			itemCount = pData->maxPos - pData->minPos + 1;
+			itemVisible = pData->pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.x - moveLeft) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveLeft,itemMoveable,moveRange,newThumbPos);
+			//#
+			    
+			if ( newThumbPos >= pData->minPos &&
+			     newThumbPos <= pData->maxPos)
+			{
+			    	SendMessage (hwnd,
+					WM_HSCROLL, SB_THUMBTRACK, newThumbPos);
+
+			    	SendMessage (GetParent(hwnd),
+					WM_HSCROLL, SB_THUMBTRACK, newThumbPos);
+			}
+			break;
+		}
+             }
+        break;
+
+	case WM_NCLBUTTONUP:
+	    bDraw=FALSE;
+	    downPos = SBS_UNKNOWN;//
+
+	    if (sbCode==SB_THUMBTRACK)
+	    {
+		    if (vertbar) 
+		    {
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->winrect;
+			moveTop = rc.top + cx;
+			moveBottom = hwnd->winrect.bottom - cx;
+			moveRange = moveBottom - moveTop;
+
+			itemCount = pData->maxPos - pData->minPos + 1;
+			itemVisible = pData->pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.y - moveTop) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveTop,itemMoveable,moveRange,newThumbPos);
+			//#
+
+			if ( newThumbPos >= pData->minPos &&
+			     newThumbPos <= pData->maxPos)
+			{
+				SendMessage (hwnd,
+					WM_VSCROLL, SB_THUMBTRACK, newThumbPos);
+
+				SendMessage (GetParent(hwnd),
+					WM_VSCROLL, SB_THUMBTRACK, newThumbPos);
+			}
+			break;//case
+		    }
+		    if (horzbar) 
+		    {
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->winrect;
+			moveLeft = rc.left + cy;
+			moveRight = hwnd->winrect.right - cy;
+			moveRange = moveRight - moveLeft;
+
+			itemCount = pData->maxPos - pData->minPos + 1;
+			itemVisible = pData->pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.x - moveLeft) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveLeft,itemMoveable,moveRange,newThumbPos);
+			//#
+				    
+			if ( newThumbPos >= pData->minPos &&
+			     newThumbPos <= pData->maxPos)
+			{
+			    SendMessage (hwnd,
+					WM_HSCROLL, SB_THUMBTRACK, newThumbPos);
+
+			    SendMessage (GetParent(hwnd),
+					WM_HSCROLL, SB_THUMBTRACK, newThumbPos);
+			}
+			break;//case
+		    }
+	    }
+	    else
+	    {
+		if (vertbar) 
+		{
+			SendMessage (hwnd, WM_VSCROLL, sbCode, 0);
+			SendMessage (GetParent(hwnd), WM_VSCROLL, sbCode, 0);
+		}
+		if (horzbar) 
+		{
+			SendMessage (hwnd, WM_HSCROLL, sbCode, 0);
+			SendMessage (GetParent(hwnd), WM_HSCROLL, sbCode, 0);
+		}
+	    }
+	break;
+	}
+}
+
+
+static BOOL
+PtInRect2(const RECT *lprc, int x, int y)
+{
+	POINT	p;
+
+	p.x = x;
+	p.y = y;
+	return PtInRect(lprc, p);
+}
+
+static void
+wndScrollBarPos (HWND hwnd, BOOL bIsHBar, RECT* rcBar)//jmt: 2k0820
+{
+    UINT moveRange;
+    PMWSCROLLBARINFO pSBar;
+    int cx,cy;
+    RECT rc;
+	
+    rc = hwnd->winrect;//
+    cx=rc.right-rc.left;
+    cy=rc.bottom-rc.top;
+    pSBar = (MWSCROLLBARINFO *)hwnd->userdata;
+
+    if (pSBar->minPos == pSBar->maxPos) {
+        pSBar->status |= SBS_HIDE;
+        return;
+    }
+
+    if (bIsHBar)
+        moveRange = (rcBar->right - rcBar->left) - (cy << 1);
+    else
+        moveRange = (rcBar->bottom - rcBar->top) - (cx << 1);
+
+
+    if (pSBar->pageStep == 0) 
+    {
+        pSBar->barLen = MWM_DEFBARLEN;
+
+        if (pSBar->barLen > moveRange)
+            pSBar->barLen = MWM_MINBARLEN;
+    }
+    else 
+    {
+        pSBar->barLen = moveRange * pSBar->pageStep /
+	      (pSBar->maxPos - pSBar->minPos + 1);
+        if (pSBar->barLen < MWM_MINBARLEN)
+            pSBar->barLen = MWM_MINBARLEN;
+    }
+
+    pSBar->barStart = moveRange * (pSBar->curPos - pSBar->minPos) /
+       (pSBar->maxPos - pSBar->minPos + 1);
+
+
+    if (pSBar->barStart + pSBar->barLen > moveRange)
+        pSBar->barStart = moveRange - pSBar->barLen;
+
+
+    if (pSBar->barStart < 0)
+        pSBar->barStart = 0;
+}
+
+static PMWSCROLLBARINFO wndGetScrollBar (HWND pWin)//jmt: 2k0820
+{
+    	MWSCROLLBARINFO* pData;
+	
+        pData = (MWSCROLLBARINFO *)pWin->userdata;
+
+	if (!strcmp(pWin->pClass->lpszClassName,"SCROLLBAR"))
+		return pData;
+	else
+    		return NULL;
+}
+
+BOOL EnableScrollBarEx (HWND hWnd, int iSBar, BOOL bEnable)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    BOOL bPrevState;
+    RECT rcBar;
+    
+    DWORD dwStyle;//jmt:2k0820
+
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )//ok
+        return FALSE;
+
+    bPrevState = !(pSBar->status & SBS_DISABLED);
+
+    if (bEnable && !bPrevState)
+        pSBar->status &= ~SBS_DISABLED;
+    else if (!bEnable && bPrevState)
+        pSBar->status |= SBS_DISABLED;
+    else
+        return FALSE;
+
+    dwStyle = (GetWindowStyle (hWnd) & SBS_TYPEMASK);//jmt: 2k0820
+
+    if (dwStyle == SBS_VERT)//
+    {
+        wndGetVScrollBarRect (pWin, &rcBar);
+        rcBar.left --;
+        rcBar.right --;
+    }
+    else
+    {
+        wndGetHScrollBarRect (pWin, &rcBar);
+        rcBar.top  --;
+        rcBar.bottom --;
+    }
+#if 0
+    SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+    MwPaintScrollbars(hWnd,NULL,dwStyle);//a must
+#endif
+
+    return TRUE;
+}
+
+BOOL GetScrollPosEx (HWND hWnd, int iSBar, int* pPos)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )
+        return FALSE;
+
+    *pPos = pSBar->curPos;
+    return TRUE;
+}
+
+BOOL GetScrollRangeEx (HWND hWnd, int iSBar, int* pMinPos, int* pMaxPos)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )
+        return FALSE;
+
+    *pMinPos = pSBar->minPos;
+    *pMaxPos = pSBar->maxPos;
+    return TRUE;
+}
+
+BOOL SetScrollPosEx (HWND hWnd, int iSBar, int iNewPos)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    RECT rcBar;
+    
+    DWORD dwStyle;//jmt:2k0820
+
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )
+        return FALSE;
+
+    if (iNewPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+    else
+        pSBar->curPos = iNewPos;
+
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+    
+    dwStyle = (GetWindowStyle (hWnd) & SBS_TYPEMASK);//jmt: 2k0820
+
+    if (dwStyle == SBS_VERT)
+    {
+        wndGetVScrollBarRect (pWin, &rcBar);
+        rcBar.left --;
+        rcBar.right --;
+    }
+    else
+    {
+        wndGetHScrollBarRect (pWin, &rcBar);
+        rcBar.top  --;
+        rcBar.bottom --;
+    }
+
+    wndScrollBarPos (pWin, dwStyle == SBS_HORZ, &rcBar);
+
+#if 0
+    SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+    MwPaintScrollbars(hWnd,NULL,dwStyle);//a must
+#endif
+    return TRUE;
+}
+
+BOOL SetScrollRangeEx (HWND hWnd, int iSBar, int iMinPos, int iMaxPos)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    RECT rcBar;
+    
+    DWORD dwStyle;//jmt:2k0820
+
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )
+        return FALSE;
+
+    pSBar->minPos = (iMinPos < iMaxPos)?iMinPos:iMaxPos;
+    pSBar->maxPos = (iMinPos > iMaxPos)?iMinPos:iMaxPos;
+    
+    // validate parameters.
+    if (pSBar->curPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+
+    if (pSBar->pageStep <= 0)
+        pSBar->pageStep = 0;
+    else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1))
+        pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1;
+    
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+
+    dwStyle = (GetWindowStyle (hWnd) & SBS_TYPEMASK);//jmt: 2k0820
+
+    if (dwStyle == SBS_VERT)
+    {
+        wndGetVScrollBarRect (pWin, &rcBar);
+    	rcBar.left --;
+      	rcBar.right --;
+    }
+    else
+    {
+        wndGetHScrollBarRect (pWin, &rcBar);
+    	rcBar.top  --;
+    	rcBar.bottom --;
+    }
+    wndScrollBarPos (pWin, dwStyle == SBS_HORZ, &rcBar);
+
+#if 0
+    SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+    MwPaintScrollbars(hWnd,NULL,dwStyle);//a must
+#endif
+
+    return TRUE;
+}
+
+BOOL SetScrollInfoEx (HWND hWnd, int iSBar, 
+                LPCSCROLLINFO lpsi, BOOL fRedraw)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    RECT rcBar;
+    
+    DWORD dwStyle;//jmt:2k0820
+
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )
+        return FALSE;
+        
+    if( lpsi->fMask & SIF_RANGE )
+    {
+        pSBar->minPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMin:lpsi->nMax;
+        pSBar->maxPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMax:lpsi->nMin;
+    }
+    
+    if( lpsi->fMask & SIF_POS )
+        pSBar->curPos = lpsi->nPos;
+    
+    if( lpsi->fMask & SIF_PAGE )
+        pSBar->pageStep = lpsi->nPage;
+
+    // validate parameters.
+    if (pSBar->curPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+
+    if (pSBar->pageStep <= 0)
+        pSBar->pageStep = 0;
+    else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1))
+        pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1;
+    
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+
+    dwStyle = (GetWindowStyle (hWnd) & SBS_TYPEMASK);//jmt: 2k0820
+
+    if(fRedraw)
+    {
+        if (dwStyle == SBS_VERT)
+	{
+            wndGetVScrollBarRect (pWin, &rcBar);
+            rcBar.left --;
+            rcBar.right --;
+	}
+        else
+	{
+            wndGetHScrollBarRect (pWin, &rcBar);
+            rcBar.top --;
+            rcBar.bottom --;
+	}
+        wndScrollBarPos (pWin, dwStyle == SBS_HORZ, &rcBar);
+
+#if 0
+        SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+	MwPaintScrollbars(hWnd,NULL,dwStyle);//a must
+#endif
+    }
+    
+    return TRUE;
+}
+
+BOOL GetScrollInfoEx(HWND hWnd, int iSBar, LPSCROLLINFO lpsi)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )
+        return FALSE;
+        
+    if( lpsi->fMask & SIF_RANGE )
+    {
+        lpsi->nMin = pSBar->minPos;
+        lpsi->nMax = pSBar->maxPos;
+    }
+    
+    if( lpsi->fMask & SIF_POS )
+    {
+        lpsi->nPos = pSBar->curPos;
+    }
+    
+    if( lpsi->fMask & SIF_PAGE )
+        lpsi->nPage = pSBar->pageStep;
+    
+    return TRUE;
+}
+
+BOOL ShowScrollBarEx (HWND hWnd, int iSBar, BOOL bShow)//jmt: iSBar not used
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    BOOL bPrevState;
+    RECT rcBar;
+    
+    DWORD dwStyle;//jmt:2k0820
+
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin)) )
+        return FALSE;
+
+    bPrevState = !(pSBar->status & SBS_HIDE);
+
+    if (bShow && !bPrevState)
+        pSBar->status &= ~SBS_HIDE;
+    else if (!bShow && bPrevState)
+        pSBar->status |= SBS_HIDE;
+    else
+        return FALSE;
+
+#if 0//fix: no WM_CHANGESIZE
+    SendMessage (hWnd, WM_CHANGESIZE, 0, 0);
+#endif
+
+    dwStyle = (GetWindowStyle (hWnd) & SBS_TYPEMASK);//jmt: 2k0820
+
+    if (dwStyle == SBS_VERT)
+        wndGetVScrollBarRect (pWin, &rcBar);
+    else
+        wndGetHScrollBarRect (pWin, &rcBar);
+
+    {
+        RECT rcWin, rcClient;
+        
+        memcpy (&rcWin, &pWin->winrect.left, sizeof (RECT));
+        
+        rcClient.left = 0;
+        rcClient.top  = 0;
+        rcClient.right = pWin->clirect.right - pWin->clirect.left;
+        rcClient.bottom = pWin->clirect.bottom - pWin->clirect.top;
+#if 0//fix: no WM_SIZECHANGED
+        SendMessage (hWnd, WM_SIZECHANGED, 
+            (WPARAM)&rcWin, (LPARAM)&rcClient);
+#endif
+    }
+    
+    if (bShow) {
+        SendMessage (hWnd, WM_NCPAINT, 0, 0);
+    }
+    else {
+        rcBar.left -= pWin->clirect.left;
+        rcBar.top  -= pWin->clirect.top;
+        rcBar.right -= pWin->clirect.left;
+        rcBar.bottom -= pWin->clirect.top;
+        SendMessage (hWnd, WM_NCPAINT, 0, 0);
+        InvalidateRect (hWnd, &rcBar, TRUE);
+    }
+
+    return TRUE;
+}
+
+static void sbSetScrollInfo (HWND hwnd, PMWSCROLLBARINFO pData, BOOL fRedraw)//jmt:2k0820
+{
+    SCROLLINFO si;
+
+    int itemCount,itemVisibles;
+
+    itemCount = pData->maxPos - pData->minPos + 1;
+    itemVisibles = pData->pageStep;
+
+    if (itemVisibles >= itemCount) 
+    {
+	SetScrollPosEx (hwnd, 0, 0);//jmt: arg2 not used
+	EnableScrollBarEx (hwnd, 0, FALSE);//jmt: arg2 not used
+        return;
+    }
+    
+    si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
+    si.nMax = itemCount - 1;
+    si.nMin = 0;
+
+    si.nPage = itemVisibles;//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+    si.nPos = pData->curPos;
+
+    SetScrollInfoEx (hwnd, 0, &si, fRedraw);//jmt: arg2 not used
+    EnableScrollBarEx (hwnd, 0, TRUE);//jmt: arg2 not used
+}
+
+static LRESULT CALLBACK
+ScrollbarControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)//jmt:2k0820
+{
+    	DWORD dwStyle;
+    	MWSCROLLBARINFO* pData;
+
+	int moveRange;
+	RECT rcBar;
+
+	dwStyle = (GetWindowStyle (hwnd) & SBS_TYPEMASK);
+    	switch (message) 
+	{
+        case WM_CREATE:
+            	if (!(pData = malloc (sizeof (MWSCROLLBARINFO)))) 
+		{
+                	fprintf(stderr, "Create scroll bar control failure!\n");
+                	return -1;
+            	}
+
+		pData->minPos=0;           /* min value of scroll range.*/
+		/* max value of scroll range.*/
+		pData->maxPos=0;     
+		if  (dwStyle==SBS_VERT)
+			moveRange=((hwnd->winrect.bottom-hwnd->winrect.top)
+				-((hwnd->winrect.right-hwnd->winrect.left)<<1));
+		else
+			moveRange=((hwnd->winrect.right-hwnd->winrect.left)
+				-((hwnd->winrect.bottom-hwnd->winrect.top)<<1));
+		if (moveRange > MWM_MINBARLEN)
+		{
+
+
+			pData->maxPos=moveRange / MWM_MINBARLEN;
+			if( (moveRange % MWM_MINBARLEN) )
+				pData->maxPos++;
+		}     
+		printf("maxPos=%d\n",pData->maxPos);
+
+		pData->curPos=0;             /* current scroll pos.*/
+
+		/* steps per page.*/
+		pData->pageStep=1;
+		if ( (pData->maxPos - 2) > 1)
+			pData->pageStep = pData->maxPos - 2;
+		printf("pageStep=%d\n",pData->pageStep);
+
+		pData->barStart=0;           /* start pixel of bar.*/
+		pData->barLen=MWM_MINBARLEN; /* length of bar.*/
+		pData->status=SBS_UNKNOWN;   /* status of scroll bar.*/
+#if 0//jmt: must handle WM_MOVE
+		//?pData->rc=hwnd->winrect;   /* screen coordinates position*/
+#endif
+            	hwnd->userdata = (DWORD)pData;
+
+		if (dwStyle == SBS_VERT)
+		{
+		    wndGetVScrollBarRect (hwnd, &rcBar);
+		    rcBar.left --;
+		    rcBar.right --;
+		}
+		else
+		{
+		    wndGetHScrollBarRect (hwnd, &rcBar);
+		    rcBar.top --;
+		    rcBar.bottom --;
+		}
+		//adjust pData->barLen
+		wndScrollBarPos (hwnd, dwStyle == SBS_HORZ, &rcBar);
+
+        	break;
+            
+        case WM_DESTROY: 
+            	free ((void *)(hwnd->userdata));
+            	break;
+
+        case WM_PAINT:
+		MwPaintScrollbars(hwnd,NULL,dwStyle);
+            	break;
+	
+	case WM_NCLBUTTONDOWN:
+	case WM_NCLBUTTONDBLCLK:
+	case WM_NCMOUSEMOVE:
+	case WM_NCLBUTTONUP:
+		MwHandleMessageScrollbar(hwnd, wParam, lParam, message, dwStyle);
+		break;
+
+        case WM_HSCROLL:
+        case WM_VSCROLL:
+        {
+            int newTop,itemCount,itemVisibles;
+            //int scrollHeight = 0;
+
+	    pData = (MWSCROLLBARINFO *)hwnd->userdata;
+            newTop = pData->curPos;
+	    itemCount = pData->maxPos - pData->minPos + 1;
+	    itemVisibles = pData->pageStep;
+
+            switch(wParam)
+            {
+                case SB_LINEDOWN:
+#define ITEM_BOTTOM(x)  (x->curPos + itemVisibles - 1)
+                    if (ITEM_BOTTOM (pData) < (itemCount - 1 )) 
+		    {
+                        newTop ++;
+                    }
+                break;
+                
+                case SB_LINEUP:
+                    if (pData->curPos > 0) 
+		    {
+                        newTop --;
+                    }
+                break;
+                
+                case SB_PAGEDOWN:
+                    if ((pData->curPos + (itemVisibles << 1)) <=
+                            itemCount)
+                        newTop += itemVisibles;
+                    else
+                        newTop = itemCount - itemVisibles;
+
+                    if (newTop < 0)
+                        return 0;
+
+                break;
+
+                case SB_PAGEUP:
+                    if (pData->curPos >= itemVisibles)
+                        newTop -= itemVisibles;
+                    else
+                        newTop = 0;
+
+                break;
+
+                case SB_THUMBTRACK:
+                    newTop = (int)lParam;
+                break;
+            }
+            
+            pData->curPos = newTop;
+
+            SendMessage (hwnd, WM_PAINT, 0, 0);
+
+            sbSetScrollInfo (hwnd, pData, TRUE);
+
+            return 0;
+        }
+        break;
+
+        default:
+    		return DefWindowProc (hwnd, message, wParam, lParam);
+    	}
+    	return 0;
+}
+
diff -urN lib/microwindows/src/mwin/winlib/static.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/static.c
--- lib/microwindows/src/mwin/winlib/static.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winlib/static.c	2005-02-21 16:13:26.000000000 +0100
@@ -0,0 +1,372 @@
+/*
+ * Copyright (C) 1999, 2000, Wei Yongming.
+ * Portions Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Static control for Microwindows win32 api.
+ */
+
+/*
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Library General Public
+**  License as published by the Free Software Foundation; either
+**  version 2 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Library General Public License for more details.
+**
+**  You should have received a copy of the GNU Library General Public
+**  License along with this library; if not, write to the Free
+**  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+**  MA 02111-1307, USA
+*/
+
+/*
+**  Alternatively, the contents of this file may be used under the terms 
+**  of the Mozilla Public License (the "MPL License") in which case the
+**  provisions of the MPL License are applicable instead of those above.
+*/
+
+// Create date: 1999/5/22
+//
+// Modify records:
+//
+//  Who             When        Where       For What                Status
+//-----------------------------------------------------------------------------
+//  WEI Yongming    1999/8/21   Tsinghua    Rearrangment            Finished
+//  WEI Yongming    1999/10/27  Tsinghua    SETTEXT bug             Finished
+//  WEI Yongming    1999/10/27  Tsinghua    SETTEXT bug             Finished
+//  WEI Yongming    2000/02/24  Tsinghua    Add MPL License         Finished
+//  Kevin Tseng     2000/06/26  gv          port to microwin        ported
+//  Greg Haerr      2000/07/05  Utah        bug fixes               Finished
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define MWINCLUDECOLORS
+#include "windows.h"	/* windef.h, winuser.h */
+#include "wintools.h"
+#include "device.h" 	/* GdGetTextSize */
+
+static LRESULT CALLBACK
+StaticControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+int WINAPI MwRegisterStaticControl(HINSTANCE hInstance)
+{
+	WNDCLASS	wc;
+
+	wc.style	= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
+	wc.lpfnWndProc	= (WNDPROC)StaticControlProc;
+	wc.cbClsExtra	= 0;
+	wc.cbWndExtra	= 0;
+	wc.hInstance	= hInstance;
+	wc.hIcon	= NULL;
+	wc.hCursor	= 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground= GetStockObject(WHITE_BRUSH);
+	wc.lpszMenuName	= NULL;
+	wc.lpszClassName= "STATIC";
+
+	return RegisterClass(&wc);
+}
+
+#if 1
+#define RECTW(rc) (rc.right-rc.left)
+#define RECTH(rc) (rc.bottom-rc.top)
+
+static DWORD GetWindowStyle (HWND hwnd)
+{
+	return hwnd->style;
+}
+
+static COLORREF GetWindowBkColor (HWND hwnd)
+{
+	MWBRUSHOBJ *hbr;
+	hbr=(MWBRUSHOBJ *)hwnd->pClass->hbrBackground;
+	return hbr->color;
+}
+
+static char *GetWindowCaption (HWND hwnd)
+{
+	return hwnd->szTitle;
+}
+
+static void SetWindowCaption (HWND hwnd,char *caption)
+{
+	if (strlen(caption)<=63)//mw: szTitle[64]
+		strcpy(hwnd->szTitle,caption);
+	else
+	{
+		strncpy(hwnd->szTitle,caption,63);
+		hwnd->szTitle[63]='\0';
+	}
+}
+
+static int GetSysCharHeight (HWND hwnd) 
+{
+	HDC 		hdc;
+    	int xw, xh, xb;
+
+    	hdc = GetDC(hwnd);
+
+//jmt: should be SYSTEM_FIXED_FONT because of minigui's GetSysCharXXX()
+	//-SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
+	SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
+
+#if MWCLIENT//nanox client
+    	GrGetGCTextSize(hdc->gc, "X", 1, MWTF_ASCII, &xw, &xh, &xb);
+#else
+    	GdGetTextSize(hdc->font->pfont,"X",1, &xw,&xh,&xb,MWTF_ASCII);
+#endif
+    	ReleaseDC(hwnd,hdc);
+
+	return xh;
+}
+
+static int GetSysCharWidth (HWND hwnd) 
+{
+	HDC 		hdc;
+    	int xw, xh, xb;
+
+    	hdc = GetDC(hwnd);
+
+//jmt: should be SYSTEM_FIXED_FONT because of minigui's GetSysCharXXX()
+	//-SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
+	SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
+
+#if MWCLIENT//nanox client
+    	GrGetGCTextSize(hdc->gc, "X", 1, MWTF_ASCII, &xw, &xh, &xb);
+#else
+    	GdGetTextSize(hdc->font->pfont,"X",1, &xw,&xh,&xb,MWTF_ASCII);
+#endif
+    	ReleaseDC(hwnd,hdc);
+
+	return xw;
+}
+#endif
+
+static LRESULT CALLBACK
+StaticControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    RECT        rcClient;
+    HDC         hdc;
+    //?HICON       hIcon;//fix
+    char*       spCaption;
+    HWND    	pCtrl;
+    UINT        uFormat;
+    DWORD       dwStyle;
+    
+    pCtrl = hwnd;                        
+    switch (message) {
+        case WM_CREATE:
+            return 0;
+            
+        case WM_DESTROY: 
+            break;
+
+        case STM_GETIMAGE:
+            return (int)(pCtrl->userdata); 
+        
+        case STM_SETIMAGE:
+        {
+            int pOldValue;
+            
+            pOldValue  = (int)(pCtrl->userdata);
+            pCtrl->userdata = (DWORD)wParam;
+            InvalidateRect (hwnd, NULL, FALSE);
+            return pOldValue;
+        }
+           
+        case WM_GETDLGCODE:
+            return DLGC_STATIC;
+
+
+        case WM_PAINT:
+	{
+	    PAINTSTRUCT ps;
+	    RECT rc;
+	    HBRUSH hbr;
+
+            hdc = BeginPaint (hwnd,&ps);
+
+            GetClientRect (hwnd, &rcClient);
+
+	    FastFillRect(hdc, &rcClient, GetSysColor(COLOR_BTNFACE));//cms+
+
+            dwStyle = GetWindowStyle (hwnd);
+
+            switch (dwStyle & SS_TYPEMASK)
+            {
+                case SS_GRAYRECT:
+#if 0
+                    SetBrushColor (hdc, LTGRAY);
+                    FillBox(hdc, 0, 0, RECTW(rcClient), RECTH(rcClient));
+#else
+		    rc.left=0; rc.top=0; rc.bottom=RECTH(rcClient); rc.right=RECTW(rcClient);
+		    FillRect(hdc,&rc,GetStockObject(LTGRAY_BRUSH));
+#endif
+                break;
+                
+                case SS_GRAYFRAME:
+#if 0
+                    Draw3DDownFrame (hdc, 
+                            0, 0, rcClient.right, rcClient.bottom, 
+                            DKGRAY);
+#else
+		    Draw3dInset(hdc, 0, 0,
+			rcClient.right, rcClient.bottom);
+#endif
+                break;
+                
+                case SS_BITMAP:
+#if 0//jmt: fix: no FillBoxWithBitmap()
+                    FillBoxWithBitmap(hdc, 0, 0, 0, 0,
+                        (PBITMAP)(pCtrl->userdata));
+#endif
+                break;
+                
+                case SS_ICON:
+#if 0//jmt: fix: no DrawIcon
+                    hIcon = (HICON)(pCtrl->userdata);
+                    DrawIcon (hdc, 0, 0, 0, 0, hIcon);
+#endif
+                break;
+      
+                case SS_SIMPLE:
+#if 0
+                    SetBrushColor (hdc, GetWindowBkColor (hwnd));
+                    FillBox (hdc, 0, 0, rcClient.right, rcClient.bottom);
+#else
+		    hbr=CreateSolidBrush(GetWindowBkColor(hwnd));
+		    rc.left=0; rc.top=0; rc.bottom=rcClient.bottom; rc.right=rcClient.right;
+		    FillRect(hdc,&rc,hbr);
+		    DeleteObject(hbr);
+#endif        
+                    if (dwStyle & WS_DISABLED)
+                        SetTextColor (hdc, DKGRAY);
+                    else
+                        SetTextColor (hdc, BLACK);
+
+                    //-SetBkColor (hdc, GetWindowBkColor (hwnd));//ok
+		    SetBkColor(hdc, GetSysColor(COLOR_BTNFACE));//cms+
+                    spCaption = GetWindowCaption (hwnd);
+                    if (spCaption)
+		    {
+	    		//-SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
+	    		SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
+                        TextOut (hdc, 0, 0, spCaption, -1); 
+		    }
+                break; 
+
+                case SS_LEFT:
+                case SS_CENTER:
+                case SS_RIGHT:
+                case SS_LEFTNOWORDWRAP:
+                    uFormat = DT_TOP;
+                    if ( (dwStyle & SS_TYPEMASK) == SS_LEFT)
+                        uFormat |= DT_LEFT | DT_WORDBREAK;
+                    else if ( (dwStyle & SS_TYPEMASK) == SS_CENTER)
+                        uFormat |= DT_CENTER | DT_WORDBREAK;
+                    else if ( (dwStyle & SS_TYPEMASK) == SS_RIGHT)
+                        uFormat |= DT_RIGHT | DT_WORDBREAK;
+                    else if ( (dwStyle & SS_TYPEMASK) == SS_LEFTNOWORDWRAP)
+                        uFormat |= DT_LEFT | DT_SINGLELINE | DT_EXPANDTABS;
+                    
+                    if (dwStyle & WS_DISABLED)
+                        SetTextColor (hdc, DKGRAY);
+                    else
+                        SetTextColor (hdc, BLACK);
+
+                    //-SetBkColor (hdc, GetWindowBkColor (hwnd));//ok
+		    SetBkColor(hdc, GetSysColor(COLOR_BTNFACE));//cms+
+                    spCaption = GetWindowCaption (hwnd);
+                    if (dwStyle & SS_NOPREFIX)
+                        uFormat |= DT_NOPREFIX;
+                        
+                    if (spCaption)
+		    {
+	    		//-SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
+	    		SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
+                        DrawText (hdc, spCaption, -1, &rcClient, uFormat);
+		    }
+                break;
+
+                case SS_GROUPBOX:
+#if 0
+                    Draw3DBorder (hdc,  rcClient.left, 
+			    rcClient.top + (GetSysCharHeight(hwnd) >> 1),
+			    rcClient.right, rcClient.bottom);
+#else
+		    Draw3dInset(hdc, rcClient.left, 
+			rcClient.top+(GetSysCharHeight(hwnd) >> 1),
+			rcClient.right-rcClient.left,
+			rcClient.bottom-rcClient.top);
+#endif                    
+                    if (dwStyle & WS_DISABLED)
+                        SetTextColor (hdc, DKGRAY);
+                    else
+                        SetTextColor (hdc, BLACK);
+
+                    //-SetBkColor(hdc, GetWindowBkColor (GetParent (hwnd)));
+		    SetBkColor(hdc, GetSysColor(COLOR_BTNFACE));//cms+
+                    spCaption = GetWindowCaption (hwnd);
+                    if (spCaption)
+		    {
+	    		//-SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
+	    		SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
+                        TextOut (hdc, GetSysCharWidth (hwnd), 2, spCaption, -1);
+		    }
+                break;
+            }
+	    EndPaint (hwnd, &ps);
+	}
+            break;
+
+#if 0//jmt: SS_NOTIFY isn't standard in win32
+        case WM_LBUTTONDBLCLK:
+            if (GetWindowStyle (hwnd) & SS_NOTIFY)
+                SendMessage (GetParent(hwnd), WM_COMMAND, 
+                    (WPARAM)MAKELONG(pCtrl->id, STN_DBLCLK),
+                    (LPARAM)hwnd);   
+            break;
+#endif
+        case WM_LBUTTONDOWN:
+            break;
+
+        case WM_NCLBUTTONDBLCLK:
+            break;
+
+        case WM_NCLBUTTONDOWN:
+            break;
+
+	case WM_NCHITTEST:
+            dwStyle = GetWindowStyle (hwnd);
+            if ((dwStyle & SS_TYPEMASK) == SS_GROUPBOX)
+                return HTTRANSPARENT;
+
+#if 0//jmt: SS_NOTIFY isn't standard in win32
+            if (GetWindowStyle (hwnd) & SS_NOTIFY)
+                return HTCLIENT;
+            else
+#endif
+                return HTNOWHERE;
+        break;
+
+
+#if 0//jmt: fix: no WM_GETFONT/WM_SETFONT
+        case WM_GETFONT:
+            break;
+        case WM_SETFONT:
+            break;
+#endif
+        case WM_SETTEXT:
+            SetWindowCaption (hwnd, (char*)lParam);
+            InvalidateRect (hwnd, NULL, TRUE);
+            break;
+            
+        default:
+    		return DefWindowProc (hwnd, message, wParam, lParam);
+    }
+    return 0;
+}
diff -urN lib/microwindows/src/mwin/winmain.1 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winmain.1
--- lib/microwindows/src/mwin/winmain.1	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winmain.1	2005-02-21 16:13:30.000000000 +0100
@@ -0,0 +1,548 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Main module of Microwindows
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+
+#ifndef __PACIFIC__
+#include <errno.h>
+#include <sys/types.h>
+#endif
+
+#if UNIX | DOS_DJGPP
+#include <unistd.h>
+#if _MINIX
+#include <sys/times.h>
+#else
+#include <sys/time.h>
+#endif
+#endif
+
+#if ELKS
+#include <linuxmt/posix_types.h>
+#include <linuxmt/time.h>
+#endif
+
+#include "windows.h"
+#include "wintern.h"
+#include "device.h"
+/*
+ * External definitions defined here.
+ */
+HWND		listwp;			/* list of all windows */
+HWND		rootwp;			/* root window pointer */
+HWND		focuswp;		/* focus window for keyboard */
+HWND		mousewp;		/* window mouse is currently in */
+HWND		capturewp;		/* capture window*/
+HWND		dragwp;			/* window user is dragging*/
+HCURSOR		curcursor;		/* currently enabled cursor */
+MWCOORD		cursorx;		/* current x position of cursor */
+MWCOORD		cursory;		/* current y position of cursor */
+DWORD		startTicks;		/* tickcount on startup */
+int		keyb_fd;		/* the keyboard file descriptor */
+int		mouse_fd;		/* the mouse file descriptor */
+int		escape_quits = 1;	/* terminate when pressing ESC */
+
+int
+main(int ac,char **av)
+{
+	/* call user hook routine before anything*/
+	if(MwUserInit(ac, av) < 0)
+		exit(1);
+
+	if(MwOpen() < 0)
+		exit(1);
+
+	/* call windows main program entry point*/
+	WinMain(NULL, NULL, NULL, SW_SHOW);
+
+	MwClose();
+	return 0;
+}
+
+/*
+ * Open a connection from a new client to the server.
+ * Returns -1 on failure.
+ */
+int
+MwOpen(void)
+{
+	/* Client calls this routine once.  We 
+	 * init everything here
+	 */
+	if(MwInitialize() < 0)
+		return -1;
+        return 1;
+}
+
+/*
+ * Close the connection to the server.
+ */
+void
+MwClose(void)
+{
+	MwTerminate();
+}
+
+#if (UNIX | DOS_DJGPP) && !_MINIX
+/*
+ * Support for more than one user fd.
+ * Chris Johns (ccj@acm.org)
+ *
+ * Register the specified file descriptor to post
+ * WM_FDINPUT/WM_FDOUTPUT/WM_FDEXCEPT to the passed hwnd
+ * when input/output/except is ready.
+ *
+ * Allow for any fd to be selected on.
+ *
+ * The user fd's are listed and scanned helping keep the
+ * overhead down for a large list of fd's being selected on.
+ */
+
+typedef struct {
+	HWND read;
+	HWND write;
+	HWND except;
+	int  next;
+} WNDUSERFD;
+
+static WNDUSERFD userregfd[FD_SETSIZE];
+static int       userregfd_head;
+
+void
+MwRegisterFdInput(HWND hwnd, int fd)
+{
+	if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) {
+		if (!userregfd[fd].read) {
+			userregfd[fd].read = hwnd;
+			if (userregfd[fd].next == -1) {
+				userregfd[fd].next = userregfd_head;
+				userregfd_head = fd;
+			}
+		}
+	}
+}
+
+void
+MwUnregisterFdInput(HWND hwnd, int fd)
+{
+	if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) {
+		if (userregfd[fd].read == hwnd) {
+			userregfd[fd].read = NULL;
+			if (!userregfd[fd].write && !userregfd[fd].except) {
+				int *listfd = &userregfd_head;
+				while (*listfd != -1) {
+					if (*listfd == fd) {
+						*listfd = userregfd[fd].next;
+						userregfd[fd].next = -1;
+						return;
+					}
+					listfd = &userregfd[*listfd].next;
+				}
+				userregfd_head = fd;
+			}
+		}
+	}
+}
+
+void
+MwRegisterFdOutput(HWND hwnd, int fd)
+{
+	if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) {
+		if (!userregfd[fd].write) {
+			userregfd[fd].write = hwnd;
+			if (userregfd[fd].next == -1) {
+				userregfd[fd].next = userregfd_head;
+				userregfd_head = fd;
+			}
+		}
+	}
+}
+
+void
+MwUnregisterFdOutput(HWND hwnd, int fd)
+{
+	if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) {
+		if (userregfd[fd].write == hwnd) {
+			userregfd[fd].write = NULL;
+			if (!userregfd[fd].read && !userregfd[fd].except) {
+				int *listfd = &userregfd_head;
+				while (*listfd != -1) {
+					if (*listfd == fd) {
+						*listfd = userregfd[fd].next;
+						userregfd[fd].next = -1;
+						return;
+					}
+					listfd = &userregfd[*listfd].next;
+				}
+				userregfd_head = fd;
+			}
+		}
+	}
+}
+
+void
+MwRegisterFdExcept(HWND hwnd, int fd)
+{
+	if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) {
+		if (!userregfd[fd].except) {
+			userregfd[fd].except = hwnd;
+			if (userregfd[fd].next == -1) {
+				userregfd[fd].next = userregfd_head;
+				userregfd_head = fd;
+			}
+		}
+	}
+}
+
+void
+MwUnregisterFdExcept(HWND hwnd, int fd)
+{
+	if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) {
+		if (userregfd[fd].except == hwnd) {
+			userregfd[fd].except = NULL;
+			if (!userregfd[fd].read && !userregfd[fd].write) {
+				int *listfd = &userregfd_head;
+				while (*listfd != -1) {
+					if (*listfd == fd) {
+						*listfd = userregfd[fd].next;
+						userregfd[fd].next = -1;
+						return;
+					}
+					listfd = &userregfd[*listfd].next;
+				}
+				userregfd_head = fd;
+			}
+		}
+	}
+}
+
+#endif /* UNIX | DOS_DJGPP*/
+
+#if MSDOS | _MINIX
+void
+MwSelect(void)
+{
+	/* If mouse data present, service it*/
+	if(mousedev.Poll())
+		while(MwCheckMouseEvent())
+			continue;
+
+	/* If keyboard data present, service it*/
+	if(kbddev.Poll())
+		while(MwCheckKeyboardEvent())
+			continue;
+
+	MwHandleTimers();
+}
+#endif
+
+#if UNIX && defined(HAVESELECT)
+static int fade = 0;
+
+void
+MwSelect(void)
+{
+	fd_set	rfds;
+	fd_set	wfds;
+	fd_set	efds;
+	int 	fd;
+	int 	e;
+	int	setsize = 0;
+	struct timeval to;
+
+	/* perform pre-select duties, if any*/
+	if(scrdev.PreSelect)
+		scrdev.PreSelect(&scrdev);
+
+	/* Set up the FDs for use in the main select(): */
+	FD_ZERO(&rfds);
+	FD_ZERO(&wfds);
+	FD_ZERO(&efds);
+  
+	if(mouse_fd >= 0) {
+		FD_SET(mouse_fd, &rfds);
+		if(mouse_fd > setsize)
+			setsize = mouse_fd;
+	}
+	if(keyb_fd >= 0) {
+		FD_SET(keyb_fd, &rfds);
+		if(keyb_fd > setsize)
+			setsize = keyb_fd;
+	}
+
+	/* handle registered file descriptors */
+	fd = userregfd_head;
+	while (fd != -1) {
+		if (userregfd[fd].read) FD_SET(fd, &rfds);
+		if (userregfd[fd].write) FD_SET(fd, &wfds);
+		if (userregfd[fd].except) FD_SET(fd, &efds);
+		if(fd > setsize) setsize = fd;
+		fd = userregfd[fd].next;
+	}
+
+	++setsize;
+
+	/* Set up the timeout for the main select().  If
+	 * the mouse is captured we're probably moving a window,
+	 * so poll quickly to allow other windows to repaint while
+	 * checking for more event input.
+	 */
+	if(dragwp)
+		to.tv_sec = to.tv_usec = 0L;
+	else {
+		UINT	timeout;
+
+		timeout = MwGetNextTimeoutValue();	/* returns ms*/
+#if ANIMATEPALETTE
+		if(fade < 100)
+			timeout = 40;
+		else 
+#endif
+		if(timeout == 0)
+			timeout = 10;	/* 10ms required for vt fb switch*/
+		to.tv_sec = timeout / 1000;
+		to.tv_usec = (timeout % 1000) * 1000;
+	}
+
+	/* Wait for some input on any of the fds in the set or a timeout: */
+	if((e = select(setsize, &rfds, &wfds, &efds, &to)) > 0) {
+		
+		/* If data is present on the mouse fd, service it: */
+		if(mouse_fd >= 0 && FD_ISSET(mouse_fd, &rfds))
+			while(MwCheckMouseEvent())
+				continue;
+
+		/* If data is present on the keyboard fd, service it: */
+		if(keyb_fd >= 0 && FD_ISSET(keyb_fd, &rfds))
+			while(MwCheckKeyboardEvent())
+				continue;
+
+		/* If registered descriptor, handle it */
+		fd = userregfd_head;
+		while (fd != -1) {
+			if (userregfd[fd].read && FD_ISSET(fd, &rfds))
+				PostMessage(userregfd[fd].read, WM_FDINPUT, fd, 0);
+			if (userregfd[fd].write && FD_ISSET(fd, &wfds))
+				PostMessage(userregfd[fd].write, WM_FDOUTPUT, fd, 0);
+			if (userregfd[fd].except && FD_ISSET(fd, &efds))
+				PostMessage(userregfd[fd].except, WM_FDEXCEPT, fd, 0);
+			fd = userregfd[fd].next;
+		}
+	} 
+	else if(e == 0) {
+		/* timeout has occured*/
+#if VTSWITCH
+		if(MwCheckVtChange()) {
+			fade = 0;
+			MwRedrawScreen();
+		}
+#endif
+#if ANIMATEPALETTE
+		if(fade <= 100) {
+			setfadelevel(&scrdev, fade);
+			fade += 5;
+		}
+#endif
+		MwHandleTimers();
+	} else
+		if(errno != EINTR)
+			EPRINTF("Select() call in main failed\n");
+}
+#endif
+
+/*
+ * Initialize the graphics and mouse devices at startup.
+ * Returns nonzero with a message printed if the initialization failed.
+ */
+int
+MwInitialize(void)
+{
+	HWND		wp;		/* root window */
+	PSD		psd;
+	WNDCLASS	wc;
+	int		fd;
+	static MWCURSOR arrow = {	/* default arrow cursor*/
+		16, 16,
+		0,  0,
+		RGB(255, 255, 255), RGB(0, 0, 0),
+		{ 0xe000, 0x9800, 0x8600, 0x4180,
+		  0x4060, 0x2018, 0x2004, 0x107c,
+		  0x1020, 0x0910, 0x0988, 0x0544,
+		  0x0522, 0x0211, 0x000a, 0x0004 },
+		{ 0xe000, 0xf800, 0xfe00, 0x7f80,
+		  0x7fe0, 0x3ff8, 0x3ffc, 0x1ffc,
+		  0x1fe0, 0x0ff0, 0x0ff8, 0x077c,
+		  0x073e, 0x021f, 0x000e, 0x0004 }
+	};
+
+	extern MWLISTHEAD mwClassHead;
+
+#if (UNIX | DOS_DJGPP) && !_MINIX
+	for (fd = 0; fd < FD_SETSIZE; fd++) {
+		userregfd[fd].read = NULL;
+		userregfd[fd].write = NULL;
+		userregfd[fd].except = NULL;
+		userregfd[fd].next = -1;
+  	}
+	userregfd_head = -1;
+#endif
+	/* catch terminate signal to restore tty state*/
+	signal(SIGTERM, (void *)MwTerminate);
+
+	startTicks = GetTickCount();
+	
+	if ((keyb_fd = GdOpenKeyboard()) == -1) {
+		EPRINTF("Cannot initialise keyboard\n");
+		return -1;
+	}
+
+	if ((psd = GdOpenScreen()) == NULL) {
+		EPRINTF("Cannot initialise screen\n");
+		GdCloseKeyboard();
+		return -1;
+	}
+
+	if ((mouse_fd = GdOpenMouse()) == -1) {
+		EPRINTF("Cannot initialise mouse\n");
+		GdCloseScreen(psd);
+		GdCloseKeyboard();
+		return -1;
+	}
+
+#if ANIMATEPALETTE
+	setfadelevel(psd, 0);
+#endif
+#if VTSWITCH
+	MwInitVt();
+#endif
+
+	/*
+	 * Initialize the root window.
+	 */
+	wc.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW;
+	wc.lpfnWndProc = (WNDPROC)DefWindowProc;
+	wc.cbClsExtra = 0;
+	wc.cbWndExtra = 0;
+	wc.hInstance = 0;
+	wc.hIcon = 0; /*LoadIcon(GetHInstance(), MAKEINTRESOURCE( 1));*/
+	wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground = CreateSolidBrush(GetSysColor(COLOR_BACKGROUND));
+	wc.lpszMenuName = NULL;
+	wc.lpszClassName =  "DeskTop";
+	RegisterClass( &wc);
+	
+	wp = GdItemNew(struct hwnd);
+	if (!wp) {
+		EPRINTF("No memory for root window\n");
+		GdCloseMouse();
+		GdCloseScreen(psd);
+		GdCloseKeyboard();
+		return -1;
+	}
+	/* remove the WS_CAPTION to have bare desktop window*/
+	/*wp->style = WS_CLIPCHILDREN | WS_CAPTION | WS_VISIBLE;*/
+	wp->style = WS_CLIPCHILDREN | WS_VISIBLE;
+	wp->exstyle = 0;
+	wp->pClass = (PWNDCLASS)mwClassHead.head;
+	wp->parent = NULL;
+	wp->children = NULL;
+	wp->siblings = NULL;
+	wp->next = NULL;
+	SetRect(&wp->winrect, 0, 0, psd->xvirtres, psd->yvirtres);
+	MwCalcClientRect(wp);
+	wp->cursor = NULL;
+	wp->unmapcount = 0;
+	wp->id = 0;
+	strcpy(wp->szTitle, "Microwindows");
+	wp->gotPaintMsg = PAINT_PAINTED;
+#if UPDATEREGIONS
+	wp->update = GdAllocRegion();
+#endif
+
+	listwp = wp;
+	rootwp = wp;
+	focuswp = wp;
+	mousewp = wp;
+
+	/* schedule desktop window paint*/
+	InvalidateRect(rootwp, NULL, TRUE);
+
+	/*
+	 * Initialize and position the default cursor.
+	 */
+	curcursor = NULL;
+	cursorx = -1;
+	cursory = -1;
+	GdShowCursor(psd);
+	MwMoveCursor(psd->xvirtres / 2, psd->yvirtres / 2);
+	MwSetCursor(rootwp, &arrow);
+
+	/*
+	 * Finally tell the mouse driver some things.
+	 */
+	GdRestrictMouse(0, 0, psd->xvirtres - 1, psd->yvirtres - 1);
+	GdMoveMouse(psd->xvirtres / 2, psd->yvirtres / 2);
+
+	return 0;
+}
+
+/*
+ * Here to close down the server.
+ */
+void
+MwTerminate(void)
+{
+	GdCloseScreen(&scrdev);
+	GdCloseMouse();
+	GdCloseKeyboard();
+#if VTSWITCH
+	MwRedrawVt(mwvterm);
+	MwExitVt();
+#endif
+	exit(0);
+}
+
+/*
+ * Return # milliseconds elapsed since start of Microwindows
+ * Granularity is 25 msec
+ */
+DWORD WINAPI
+GetTickCount(VOID)
+{
+#if MSDOS
+#include <time.h>
+	return (DWORD)(clock() * 1000 / CLOCKS_PER_SEC);
+#else
+#if _MINIX
+	struct tms	t;
+	
+	return (DWORD)times(&t) * 16;
+#else
+#if UNIX
+	struct timeval t;
+
+	gettimeofday(&t, NULL);
+	return ((t.tv_sec * 1000) + (t.tv_usec / 25000) * 25) - startTicks;
+#else
+	return 0L;
+#endif
+#endif
+#endif
+}
+
+VOID WINAPI
+Sleep(DWORD dwMilliseconds)
+{
+	int i, j, k;
+	const int loops_per_ms = 20000;
+
+	/* FIXME this is not calibrated */
+	for(i=0; i < dwMilliseconds; i++)
+		for(j=0; j < loops_per_ms; j++)
+			k = i * j;
+}
diff -urN lib/microwindows/src/mwin/winmain.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winmain.c
--- lib/microwindows/src/mwin/winmain.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winmain.c	2005-02-21 16:13:29.000000000 +0100
@@ -0,0 +1,558 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Main module of Microwindows
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+
+#ifndef __PACIFIC__
+#include <errno.h>
+#include <sys/types.h>
+#endif
+
+#if UNIX | DOS_DJGPP
+#include <unistd.h>
+#if _MINIX
+#include <sys/times.h>
+#else
+#include <sys/time.h>
+#endif
+#endif
+
+#if ELKS
+#include <linuxmt/posix_types.h>
+#include <linuxmt/time.h>
+#endif
+
+#include "windows.h"
+#include "wintern.h"
+#include "device.h"
+/*
+ * External definitions defined here.
+ */
+HWND		listwp;			/* list of all windows */
+HWND		rootwp;			/* root window pointer */
+HWND		focuswp;		/* focus window for keyboard */
+HWND		mousewp;		/* window mouse is currently in */
+HWND		capturewp;		/* capture window*/
+HWND		dragwp;			/* window user is dragging*/
+HCURSOR		curcursor;		/* currently enabled cursor */
+MWCOORD		cursorx;		/* current x position of cursor */
+MWCOORD		cursory;		/* current y position of cursor */
+DWORD		startTicks;		/* tickcount on startup */
+int		keyb_fd;		/* the keyboard file descriptor */
+int		mouse_fd;		/* the mouse file descriptor */
+int		escape_quits = 1;	/* terminate when pressing ESC */
+
+int
+main(int ac,char **av)
+{
+	/* call user hook routine before anything*/
+	if(MwUserInit(ac, av) < 0)
+		exit(1);
+
+	if(MwOpen() < 0)
+		exit(1);
+
+	/* call windows main program entry point*/
+	WinMain(NULL, NULL, NULL, SW_SHOW);
+
+	MwClose();
+	return 0;
+}
+
+/*
+ * Open a connection from a new client to the server.
+ * Returns -1 on failure.
+ */
+int
+MwOpen(void)
+{
+	/* Client calls this routine once.  We 
+	 * init everything here
+	 */
+	if(MwInitialize() < 0)
+		return -1;
+        return 1;
+}
+
+/*
+ * Close the connection to the server.
+ */
+void
+MwClose(void)
+{
+	MwTerminate();
+}
+
+#if (UNIX | DOS_DJGPP) && !_MINIX
+/*
+ * Support for more than one user fd.
+ * Chris Johns (ccj@acm.org)
+ *
+ * Register the specified file descriptor to post
+ * WM_FDINPUT/WM_FDOUTPUT/WM_FDEXCEPT to the passed hwnd
+ * when input/output/except is ready.
+ *
+ * Allow for any fd to be selected on.
+ *
+ * The user fd's are listed and scanned helping keep the
+ * overhead down for a large list of fd's being selected on.
+ */
+
+typedef struct {
+	HWND read;
+	HWND write;
+	HWND except;
+	int  next;
+} WNDUSERFD;
+
+static WNDUSERFD userregfd[FD_SETSIZE];
+static int       userregfd_head;
+
+void
+MwRegisterFdInput(HWND hwnd, int fd)
+{
+	if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) {
+		if (!userregfd[fd].read) {
+			userregfd[fd].read = hwnd;
+			if (userregfd[fd].next == -1 && !userregfd[fd].write && !userregfd[fd].except) {
+				userregfd[fd].next = userregfd_head;
+				userregfd_head = fd;
+			}
+		}
+	}
+}
+
+void
+MwUnregisterFdInput(HWND hwnd, int fd)
+{
+	if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) {
+		if (userregfd[fd].read == hwnd) {
+			userregfd[fd].read = NULL;
+			if (!userregfd[fd].write && !userregfd[fd].except) {
+				int *listfd = &userregfd_head;
+				while (*listfd != -1) {
+					if (*listfd == fd) {
+						*listfd = userregfd[fd].next;
+						userregfd[fd].next = -1;
+						return;
+					}
+					listfd = &userregfd[*listfd].next;
+				}
+				userregfd_head = fd;
+			}
+		}
+	}
+}
+
+void
+MwRegisterFdOutput(HWND hwnd, int fd)
+{
+	if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) {
+		if (!userregfd[fd].write) {
+			userregfd[fd].write = hwnd;
+			if (userregfd[fd].next == -1 && !userregfd[fd].read && !userregfd[fd].except) {
+				userregfd[fd].next = userregfd_head;
+				userregfd_head = fd;
+			}
+		}
+	}
+}
+
+void
+MwUnregisterFdOutput(HWND hwnd, int fd)
+{
+	if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) {
+		if (userregfd[fd].write == hwnd) {
+			userregfd[fd].write = NULL;
+			if (!userregfd[fd].read && !userregfd[fd].except) {
+				int *listfd = &userregfd_head;
+				while (*listfd != -1) {
+					if (*listfd == fd) {
+						*listfd = userregfd[fd].next;
+						userregfd[fd].next = -1;
+						return;
+					}
+					listfd = &userregfd[*listfd].next;
+				}
+				userregfd_head = fd;
+			}
+		}
+	}
+}
+
+void
+MwRegisterFdExcept(HWND hwnd, int fd)
+{
+	if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) {
+		if (!userregfd[fd].except) {
+			userregfd[fd].except = hwnd;
+			if (userregfd[fd].next == -1 && !userregfd[fd].read && !userregfd[fd].write) {
+				userregfd[fd].next = userregfd_head;
+				userregfd_head = fd;
+			}
+		}
+	}
+}
+
+void
+MwUnregisterFdExcept(HWND hwnd, int fd)
+{
+	if (fd < FD_SETSIZE && fd != mouse_fd && fd != keyb_fd) {
+		if (userregfd[fd].except == hwnd) {
+			userregfd[fd].except = NULL;
+			if (!userregfd[fd].read && !userregfd[fd].write) {
+				int *listfd = &userregfd_head;
+				while (*listfd != -1) {
+					if (*listfd == fd) {
+						*listfd = userregfd[fd].next;
+						userregfd[fd].next = -1;
+						return;
+					}
+					listfd = &userregfd[*listfd].next;
+				}
+				userregfd_head = fd;
+			}
+		}
+	}
+}
+
+#endif /* UNIX | DOS_DJGPP*/
+
+#if MSDOS | _MINIX
+void
+MwSelect(void)
+{
+	/* If mouse data present, service it*/
+	if(mousedev.Poll())
+		while(MwCheckMouseEvent())
+			continue;
+
+	/* If keyboard data present, service it*/
+	if(kbddev.Poll())
+		while(MwCheckKeyboardEvent())
+			continue;
+
+	MwHandleTimers();
+}
+#endif
+
+#if UNIX && defined(HAVESELECT)
+#if ANIMATEPALETTE
+static int fade = 0;
+#endif
+
+void
+MwSelect(void)
+{
+	fd_set	rfds;
+	fd_set	wfds;
+	fd_set	efds;
+	int 	fd;
+	int 	e;
+	int	setsize = 0;
+	UINT	timeout;
+	struct timeval to;
+
+	/* perform pre-select duties, if any*/
+	if(scrdev.PreSelect)
+		scrdev.PreSelect(&scrdev);
+
+	/* Set up the FDs for use in the main select(): */
+	FD_ZERO(&rfds);
+	FD_ZERO(&wfds);
+	FD_ZERO(&efds);
+  
+	if(mouse_fd >= 0) {
+		FD_SET(mouse_fd, &rfds);
+		if(mouse_fd > setsize)
+			setsize = mouse_fd;
+	}
+	if(keyb_fd >= 0) {
+		FD_SET(keyb_fd, &rfds);
+		if(keyb_fd > setsize)
+			setsize = keyb_fd;
+	}
+
+	/* handle registered file descriptors */
+	fd = userregfd_head;
+	while (fd != -1) {
+		if (userregfd[fd].read) FD_SET(fd, &rfds);
+		if (userregfd[fd].write) FD_SET(fd, &wfds);
+		if (userregfd[fd].except) FD_SET(fd, &efds);
+		if(fd > setsize) setsize = fd;
+		fd = userregfd[fd].next;
+	}
+
+	++setsize;
+
+	/* Set up the timeout for the main select().  If
+	 * the mouse is captured we're probably moving a window,
+	 * so poll quickly to allow other windows to repaint while
+	 * checking for more event input.
+	 */
+	if(dragwp)
+		timeout = to.tv_sec = to.tv_usec = 0L;
+	else {
+		timeout = MwGetNextTimeoutValue();	/* returns ms*/
+#if ANIMATEPALETTE
+		if(fade < 100)
+			timeout = 40;
+#endif
+if (!timeout) timeout = 10;	/* temp kluge required for mdemo to run ok*/
+		GdGetNextTimeout(&to, timeout);
+	}
+
+	/* Wait for some input on any of the fds in the set or a timeout: */
+	if((e = select(setsize, &rfds, &wfds, &efds, &to)) > 0) {
+		
+		/* If data is present on the mouse fd, service it: */
+		if(mouse_fd >= 0 && FD_ISSET(mouse_fd, &rfds))
+			while(MwCheckMouseEvent())
+				continue;
+
+		/* If data is present on the keyboard fd, service it: */
+		if(keyb_fd >= 0 && FD_ISSET(keyb_fd, &rfds))
+			while(MwCheckKeyboardEvent())
+				continue;
+
+		/* If registered descriptor, handle it */
+		fd = userregfd_head;
+		while (fd != -1) {
+			if (userregfd[fd].read && FD_ISSET(fd, &rfds))
+				PostMessage(userregfd[fd].read, WM_FDINPUT, fd, 0);
+			if (userregfd[fd].write && FD_ISSET(fd, &wfds))
+				PostMessage(userregfd[fd].write, WM_FDOUTPUT, fd, 0);
+			if (userregfd[fd].except && FD_ISSET(fd, &efds))
+				PostMessage(userregfd[fd].except, WM_FDEXCEPT, fd, 0);
+			fd = userregfd[fd].next;
+		}
+	} 
+	else if(e == 0) {
+		/* timeout has occured*/
+		if(GdTimeout() == FALSE)
+			return;
+#if ANIMATEPALETTE
+		if(fade <= 100) {
+			setfadelevel(&scrdev, fade);
+			fade += 5;
+		}
+#endif
+		MwHandleTimers();
+	} else
+		if(errno != EINTR)
+			EPRINTF("Select() call in main failed\n");
+}
+#endif
+
+#if VTSWITCH
+static void
+CheckVtChange(void *arg)
+{
+	if(MwCheckVtChange()) {
+#if ANIMATEPALETTE
+		fade = 0;
+#endif
+		MwRedrawScreen();
+	}
+	GdAddTimer(50, CheckVtChange, NULL);
+}
+#endif
+
+/*
+ * Initialize the graphics and mouse devices at startup.
+ * Returns nonzero with a message printed if the initialization failed.
+ */
+int
+MwInitialize(void)
+{
+	HWND		wp;		/* root window */
+	PSD		psd;
+	WNDCLASS	wc;
+	int		fd;
+	static MWCURSOR arrow = {	/* default arrow cursor*/
+		16, 16,
+		0,  0,
+		RGB(255, 255, 255), RGB(0, 0, 0),
+		{ 0xe000, 0x9800, 0x8600, 0x4180,
+		  0x4060, 0x2018, 0x2004, 0x107c,
+		  0x1020, 0x0910, 0x0988, 0x0544,
+		  0x0522, 0x0211, 0x000a, 0x0004 },
+		{ 0xe000, 0xf800, 0xfe00, 0x7f80,
+		  0x7fe0, 0x3ff8, 0x3ffc, 0x1ffc,
+		  0x1fe0, 0x0ff0, 0x0ff8, 0x077c,
+		  0x073e, 0x021f, 0x000e, 0x0004 }
+	};
+
+	extern MWLISTHEAD mwClassHead;
+
+#if (UNIX | DOS_DJGPP) && !_MINIX
+	for (fd = 0; fd < FD_SETSIZE; fd++) {
+		userregfd[fd].read = NULL;
+		userregfd[fd].write = NULL;
+		userregfd[fd].except = NULL;
+		userregfd[fd].next = -1;
+  	}
+	userregfd_head = -1;
+#endif
+	/* catch terminate signal to restore tty state*/
+	signal(SIGTERM, (void *)MwTerminate);
+
+	startTicks = GetTickCount();
+	
+	if ((keyb_fd = GdOpenKeyboard()) == -1) {
+		EPRINTF("Cannot initialise keyboard\n");
+		return -1;
+	}
+
+	if ((psd = GdOpenScreen()) == NULL) {
+		EPRINTF("Cannot initialise screen\n");
+		GdCloseKeyboard();
+		return -1;
+	}
+
+	if ((mouse_fd = GdOpenMouse()) == -1) {
+		EPRINTF("Cannot initialise mouse\n");
+		GdCloseScreen(psd);
+		GdCloseKeyboard();
+		return -1;
+	}
+
+#if ANIMATEPALETTE
+	setfadelevel(psd, 0);
+#endif
+#if VTSWITCH
+	MwInitVt();
+	/* Check for VT change every 50 ms: */
+	GdAddTimer(50, CheckVtChange, NULL);
+#endif
+
+	/*
+	 * Initialize the root window.
+	 */
+	wc.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW;
+	wc.lpfnWndProc = (WNDPROC)DefWindowProc;
+	wc.cbClsExtra = 0;
+	wc.cbWndExtra = 0;
+	wc.hInstance = 0;
+	wc.hIcon = 0; /*LoadIcon(GetHInstance(), MAKEINTRESOURCE( 1));*/
+	wc.hCursor = 0; /*LoadCursor(NULL, IDC_ARROW);*/
+	wc.hbrBackground = CreateSolidBrush(GetSysColor(COLOR_BACKGROUND));
+	wc.lpszMenuName = NULL;
+	wc.lpszClassName =  "DeskTop";
+	RegisterClass( &wc);
+	
+	wp = GdItemNew(struct hwnd);
+	if (!wp) {
+		EPRINTF("No memory for root window\n");
+		GdCloseMouse();
+		GdCloseScreen(psd);
+		GdCloseKeyboard();
+		return -1;
+	}
+	/* remove the WS_CAPTION to have bare desktop window*/
+	/*wp->style = WS_CLIPCHILDREN | WS_CAPTION | WS_VISIBLE;*/
+	wp->style = WS_CLIPCHILDREN | WS_VISIBLE;
+	wp->exstyle = 0;
+	wp->pClass = (PWNDCLASS)mwClassHead.head;
+	wp->parent = NULL;
+	wp->children = NULL;
+	wp->siblings = NULL;
+	wp->next = NULL;
+	SetRect(&wp->winrect, 0, 0, psd->xvirtres, psd->yvirtres);
+	MwCalcClientRect(wp);
+	wp->cursor = NULL;
+	wp->unmapcount = 0;
+	wp->id = 0;
+	strcpy(wp->szTitle, "Microwindows");
+	wp->gotPaintMsg = PAINT_PAINTED;
+#if UPDATEREGIONS
+	wp->update = GdAllocRegion();
+#endif
+
+	listwp = wp;
+	rootwp = wp;
+	focuswp = wp;
+	mousewp = wp;
+
+	/* schedule desktop window paint*/
+	InvalidateRect(rootwp, NULL, TRUE);
+
+	/*
+	 * Initialize and position the default cursor.
+	 */
+	curcursor = NULL;
+	cursorx = -1;
+	cursory = -1;
+	GdShowCursor(psd);
+	MwMoveCursor(psd->xvirtres / 2, psd->yvirtres / 2);
+	MwSetCursor(rootwp, &arrow);
+
+	/*
+	 * Finally tell the mouse driver some things.
+	 */
+	GdRestrictMouse(0, 0, psd->xvirtres - 1, psd->yvirtres - 1);
+	GdMoveMouse(psd->xvirtres / 2, psd->yvirtres / 2);
+
+	return 0;
+}
+
+/*
+ * Here to close down the server.
+ */
+void
+MwTerminate(void)
+{
+	GdCloseScreen(&scrdev);
+	GdCloseMouse();
+	GdCloseKeyboard();
+#if VTSWITCH
+	MwRedrawVt(mwvterm);
+	MwExitVt();
+#endif
+	exit(0);
+}
+
+/*
+ * Return # milliseconds elapsed since start of Microwindows
+ * Granularity is 25 msec
+ */
+DWORD WINAPI
+GetTickCount(VOID)
+{
+#if MSDOS
+#include <time.h>
+	return (DWORD)(clock() * 1000 / CLOCKS_PER_SEC);
+#else
+#if _MINIX
+	struct tms	t;
+	
+	return (DWORD)times(&t) * 16;
+#else
+#if UNIX
+	struct timeval t;
+
+	gettimeofday(&t, NULL);
+	return ((t.tv_sec * 1000) + (t.tv_usec / 25000) * 25) - startTicks;
+#else
+	return 0L;
+#endif
+#endif
+#endif
+}
+
+VOID WINAPI
+Sleep(DWORD dwMilliseconds)
+{
+	int i, j, k;
+	const int loops_per_ms = 20000;
+
+	/* FIXME this is not calibrated */
+	for(i=0; i < dwMilliseconds; i++)
+		for(j=0; j < loops_per_ms; j++)
+			k = i * j;
+}
diff -urN lib/microwindows/src/mwin/winrgn.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winrgn.c
--- lib/microwindows/src/mwin/winrgn.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winrgn.c	2005-02-21 16:03:43.000000000 +0100
@@ -0,0 +1,566 @@
+/*
+ * Portions Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ *	Somewhat less shamelessly ripped from the Wine distribution
+ *
+ * Win32 API Region Management Routines.
+ * Win32 API Complex Rectangle Routines.
+ *
+ * GDI region objects. Shamelessly ripped out from the X11 distribution
+ * Thanks for the nice licence.
+ *
+ * Copyright 1993, 1994, 1995 Alexandre Julliard
+ * Modifications and additions: Copyright 1998 Huw Davies
+ */
+#include "windows.h"
+#include "device.h"
+#include <stdlib.h>
+#include <string.h>
+
+/* later, error checking can be built into this get*/
+#define GDI_GetObjPtr(hrgn,type)	(hrgn)
+
+/* local functions*/
+static HRGN REGION_CreateRegion(void);
+/*BOOL REGION_UnionRectWithRgn( HRGN hrgn, const RECT *lpRect );*/
+/*BOOL REGION_FrameRgn( HRGN hDest, HRGN hSrc, INT x, INT y );*/
+
+#define EMPTY_REGION(pReg) { \
+    (pReg)->numRects = 0; \
+    (pReg)->extents.left = (pReg)->extents.top = 0; \
+    (pReg)->extents.right = (pReg)->extents.bottom = 0; \
+    (pReg)->type = NULLREGION; \
+ }
+
+/*
+ *          Create a new empty region.
+ */
+static HRGN
+REGION_CreateRegion(void)
+{
+    MWRGNOBJ *obj;
+    
+    obj = GdItemNew(MWRGNOBJ);
+    if(!obj)
+    	return NULL;
+    obj->hdr.type = OBJ_REGION;
+    obj->hdr.stockobj = FALSE;
+    if(!(obj->rgn = GdAllocRegion())) {
+	GdItemFree(obj);
+	return NULL;
+    }
+    return (HRGN)obj;
+}
+
+
+INT WINAPI
+OffsetRgn( HRGN hrgn, INT x, INT y )
+{
+    MWRGNOBJ * obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION );
+
+    if (obj)
+    {
+	GdOffsetRegion(obj->rgn, x, y);
+	return obj->rgn->type;
+    }
+    return ERRORREGION;
+}
+
+
+INT WINAPI
+GetRgnBox( HRGN hrgn, LPRECT rect )
+{
+    MWRGNOBJ * obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION );
+    if (obj)
+	return GdGetRegionBox(obj->rgn, rect);
+    return ERRORREGION;
+}
+
+
+HRGN WINAPI
+CreateRectRgn(INT left, INT top, INT right, INT bottom)
+{
+    HRGN hrgn;
+
+    if (!(hrgn = REGION_CreateRegion()))
+	return 0;
+    /*TRACE(region, "\n");*/
+    SetRectRgn(hrgn, left, top, right, bottom);
+    return hrgn;
+}
+
+
+HRGN WINAPI
+CreateRectRgnIndirect( const RECT* rect )
+{
+    return CreateRectRgn( rect->left, rect->top, rect->right, rect->bottom );
+}
+
+
+/*
+ * Allows either or both left and top to be greater than right or bottom.
+ */
+VOID WINAPI
+SetRectRgn( HRGN hrgn, INT left, INT top, INT right, INT bottom )
+{
+    MWRGNOBJ * obj;
+    MWCLIPREGION *rgn;
+
+    /*TRACE(region, " %04x %d,%d-%d,%d\n", hrgn, left, top, right, bottom );*/
+    
+    if (!(obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION ))) return;
+
+    if (left > right) { INT tmp = left; left = right; right = tmp; }
+    if (top > bottom) { INT tmp = top; top = bottom; bottom = tmp; }
+
+    rgn = obj->rgn;
+    GdSetRectRegion(rgn, left, top, right, bottom);
+}
+
+
+HRGN WINAPI
+CreateRoundRectRgn( INT left, INT top, INT right, INT bottom,
+	INT ellipse_width, INT ellipse_height )
+{
+    MWRGNOBJ * obj;
+    HRGN hrgn;
+    int asq, bsq, d, xd, yd;
+    RECT rect;
+    
+    /* Check if we can do a normal rectangle instead */
+    if (ellipse_width == 0 || ellipse_height == 0)
+	return CreateRectRgn( left, top, right, bottom );
+
+    /* Make the dimensions sensible */
+    if (left > right) { INT tmp = left; left = right; right = tmp; }
+    if (top > bottom) { INT tmp = top; top = bottom; bottom = tmp; }
+
+    ellipse_width = abs(ellipse_width);
+    ellipse_height = abs(ellipse_height);
+
+    /* Create region */
+
+    if (!(hrgn = REGION_CreateRegion()))
+	    return 0;
+    obj = (MWRGNOBJ *)hrgn;
+    /*TRACE(region,"(%d,%d-%d,%d %dx%d): ret=%04x\n",
+	       left, top, right, bottom, ellipse_width, ellipse_height, hrgn);*/
+
+    /* Check parameters */
+
+    if (ellipse_width > right-left) ellipse_width = right-left;
+    if (ellipse_height > bottom-top) ellipse_height = bottom-top;
+
+    /* Ellipse algorithm, based on an article by K. Porter */
+    /* in DDJ Graphics Programming Column, 8/89 */
+
+    asq = ellipse_width * ellipse_width / 4;        /* a^2 */
+    bsq = ellipse_height * ellipse_height / 4;      /* b^2 */
+    if (asq == 0) asq = 1;
+    if (bsq == 0) bsq = 1;
+    d = bsq - asq * ellipse_height / 2 + asq / 4;   /* b^2 - a^2b + a^2/4 */
+    xd = 0;
+    yd = asq * ellipse_height;                      /* 2a^2b */
+
+    rect.left   = left + ellipse_width / 2;
+    rect.right  = right - ellipse_width / 2;
+
+    /* Loop to draw first half of quadrant */
+
+    while (xd < yd)
+    {
+	if (d > 0)  /* if nearest pixel is toward the center */
+	{
+	      /* move toward center */
+	    rect.top = top++;
+	    rect.bottom = rect.top + 1;
+	    GdUnionRectWithRegion( &rect, obj->rgn );
+	    rect.top = --bottom;
+	    rect.bottom = rect.top + 1;
+	    GdUnionRectWithRegion( &rect, obj->rgn );
+	    yd -= 2*asq;
+	    d  -= yd;
+	}
+	rect.left--;        /* next horiz point */
+	rect.right++;
+	xd += 2*bsq;
+	d  += bsq + xd;
+    }
+
+    /* Loop to draw second half of quadrant */
+
+    d += (3 * (asq-bsq) / 2 - (xd+yd)) / 2;
+    while (yd >= 0)
+    {
+	  /* next vertical point */
+	rect.top = top++;
+	rect.bottom = rect.top + 1;
+	GdUnionRectWithRegion( &rect, obj->rgn );
+	rect.top = --bottom;
+	rect.bottom = rect.top + 1;
+	GdUnionRectWithRegion( &rect, obj->rgn );
+	if (d < 0)   /* if nearest pixel is outside ellipse */
+	{
+	    rect.left--;     /* move away from center */
+	    rect.right++;
+	    xd += 2*bsq;
+	    d  += xd;
+	}
+	yd -= 2*asq;
+	d  += asq - yd;
+    }
+
+    /* Add the inside rectangle */
+
+    if (top <= bottom)
+    {
+	rect.top = top;
+	rect.bottom = bottom;
+	GdUnionRectWithRegion( &rect, obj->rgn );
+    }
+    obj->rgn->type = SIMPLEREGION; /* FIXME? */
+    return hrgn;
+}
+
+
+HRGN WINAPI
+CreateEllipticRgn( INT left, INT top, INT right, INT bottom )
+{
+    return CreateRoundRectRgn(left, top, right, bottom, right-left, bottom-top);
+}
+
+
+HRGN WINAPI
+CreateEllipticRgnIndirect( const RECT *rect )
+{
+    return CreateRoundRectRgn( rect->left, rect->top, rect->right,
+				 rect->bottom, rect->right - rect->left,
+				 rect->bottom - rect->top );
+}
+
+HRGN WINAPI
+CreatePolygonRgn(const POINT *points, INT count, INT mode)
+{
+#if POLYREGIONS
+	HRGN		hrgn;
+    	MWRGNOBJ * 	obj;
+	MWCLIPREGION *	rgn;
+
+    	if (!(hrgn = REGION_CreateRegion()))
+		return NULL;
+    	obj = (MWRGNOBJ *)GDI_GetObjPtr(hrgn, OBJ_REGION);
+	if (!obj)
+		return NULL;
+
+	rgn = GdAllocPolygonRegion((POINT *)points, count, mode);
+	if (!rgn)
+		return hrgn;
+	GdDestroyRegion(obj->rgn);
+	obj->rgn = rgn;
+	return hrgn;
+#endif
+}
+
+DWORD WINAPI
+GetRegionData(HRGN hrgn, DWORD count, LPRGNDATA rgndata)
+{
+    DWORD size;
+    MWRGNOBJ *obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION );
+    MWCLIPREGION *rgn;
+    
+    /*TRACE(region," %04x count = %ld, rgndata = %p\n", hrgn, count, rgndata);*/
+
+    if(!obj) return 0;
+
+    rgn = obj->rgn;
+    size = rgn->numRects * sizeof(RECT);
+    if(count < (size + sizeof(RGNDATAHEADER)) || rgndata == NULL)
+        return size + sizeof(RGNDATAHEADER);
+
+    rgndata->rdh.dwSize = sizeof(RGNDATAHEADER);
+    rgndata->rdh.iType = RDH_RECTANGLES;
+    rgndata->rdh.nCount = rgn->numRects;
+    rgndata->rdh.nRgnSize = size;
+    rgndata->rdh.rcBound.left = rgn->extents.left;
+    rgndata->rdh.rcBound.top = rgn->extents.top;
+    rgndata->rdh.rcBound.right = rgn->extents.right;
+    rgndata->rdh.rcBound.bottom = rgn->extents.bottom;
+
+    memcpy( rgndata->Buffer, rgn->rects, size );
+
+    return 1;
+}
+
+
+#if 0
+HRGN WINAPI
+ExtCreateRegion(const XFORM* lpXform, DWORD dwCount, const RGNDATA* rgndata)
+{
+    HRGN hrgn = CreateRectRgn(0, 0, 0, 0);
+    MWRGNOBJ *obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION );
+    RECT *pCurRect, *pEndRect;
+
+    /*TRACE(region, " %p %ld %p. Returning %04x\n",
+		lpXform, dwCount, rgndata, hrgn);*/
+    if(!hrgn)
+    {
+        WARN(region, "Can't create a region!\n");
+	return 0;
+    }
+    if(lpXform)
+        WARN(region, "Xform not implemented - ignoring\n");
+    
+    if(rgndata->rdh.iType != RDH_RECTANGLES)
+    {
+        WARN(region, "Type not RDH_RECTANGLES\n");
+	DeleteObject( hrgn );
+	return 0;
+    }
+
+    pEndRect = (RECT *)rgndata->Buffer + rgndata->rdh.nCount;
+    for(pCurRect = (RECT *)rgndata->Buffer; pCurRect < pEndRect; pCurRect++)
+        GdUnionRectWithRegion( pCurRect, obj->rgn );
+
+    return hrgn;
+}
+#endif
+
+
+BOOL WINAPI
+PtInRegion( HRGN hrgn, INT x, INT y )
+{
+    MWRGNOBJ * obj;
+    
+    obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION );
+    if(!obj)
+	    return FALSE;
+    return GdPtInRegion(obj->rgn, x, y);
+}
+
+/*
+ * Returns TRUE if rect is at least partly inside hrgn
+ */
+BOOL WINAPI
+RectInRegion( HRGN hrgn, const RECT *rect )
+{
+    MWRGNOBJ * obj;
+    
+    obj = (MWRGNOBJ *) GDI_GetObjPtr( hrgn, OBJ_REGION );
+    if(!obj)
+	    return FALSE;
+    return (GdRectInRegion(obj->rgn, rect) == MWRECT_OUT? FALSE: TRUE);
+}
+
+BOOL WINAPI
+EqualRgn( HRGN hrgn1, HRGN hrgn2 )
+{
+    MWRGNOBJ *obj1, *obj2;
+
+    if ((obj1 = (MWRGNOBJ *) GDI_GetObjPtr( hrgn1, OBJ_REGION ))) 
+	if ((obj2 = (MWRGNOBJ *) GDI_GetObjPtr( hrgn2, OBJ_REGION ))) 
+	    return GdEqualRegion(obj1->rgn, obj2->rgn);
+    return FALSE;
+}
+
+#if 0
+/*
+ *           REGION_UnionRectWithRgn
+ *           Adds a rectangle to a HRGN
+ *           A helper used by scroll.c
+ */
+BOOL
+REGION_UnionRectWithRgn( HRGN hrgn, const RECT *lpRect )
+{
+    MWRGNOBJ *obj = (MWRGNOBJ *)hrgn;
+
+    if(!obj) return FALSE;
+    GdUnionRectWithRegion( lpRect, obj->rgn );
+    return TRUE;
+}
+
+/*
+ *           REGION_FrameRgn
+ * Create a region that is a frame around another region.
+ * Expand all rectangles by +/- x and y, then subtract original region.
+ */
+BOOL
+REGION_FrameRgn( HRGN hDest, HRGN hSrc, INT x, INT y )
+{
+    BOOL bRet;
+    MWRGNOBJ *srcObj = (MWRGNOBJ*) GDI_GetObjPtr( hSrc, OBJ_REGION );
+
+    if (srcObj->rgn->numRects != 0) 
+    {
+	MWRGNOBJ* destObj = (MWRGNOBJ*) GDI_GetObjPtr( hDest, OBJ_REGION );
+	RECT *pRect, *pEndRect;
+	RECT tempRect;
+
+	EMPTY_REGION( destObj->rgn );
+	
+	pEndRect = srcObj->rgn->rects + srcObj->rgn->numRects;
+	for(pRect = srcObj->rgn->rects; pRect < pEndRect; pRect++)
+	{
+	    tempRect.left = pRect->left - x;        
+	    tempRect.top = pRect->top - y;
+	    tempRect.right = pRect->right + x;
+	    tempRect.bottom = pRect->bottom + y;
+	    GdUnionRectWithRegion( &tempRect, destObj->rgn );
+	}
+	GdSubtractRegion( destObj->rgn, destObj->rgn, srcObj->rgn );
+	bRet = TRUE;
+    }
+    else
+	bRet = FALSE;
+    return bRet;
+}
+#endif
+
+/*
+ * Note: The behavior is correct even if src and dest regions are the same.
+ */
+INT WINAPI
+CombineRgn(HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode)
+{
+    MWRGNOBJ *destObj = (MWRGNOBJ *) GDI_GetObjPtr( hDest, OBJ_REGION);
+    INT result = ERRORREGION;
+
+    /*TRACE(region, " %04x,%04x -> %04x mode=%x\n", hSrc1, hSrc2, hDest,mode);*/
+
+    if (destObj)
+    {
+	MWRGNOBJ *src1Obj = (MWRGNOBJ *) GDI_GetObjPtr( hSrc1, OBJ_REGION);
+
+	if (src1Obj)
+	{
+	    /*TRACE(region, "dump:\n");
+	    if(TRACE_ON(region)) 
+	        REGION_DumpRegion(src1Obj->rgn);*/
+	    if (mode == RGN_COPY)
+	    {
+		GdCopyRegion( destObj->rgn, src1Obj->rgn );
+		result = destObj->rgn->type;
+	    }
+	    else
+	    {
+		MWRGNOBJ *src2Obj = (MWRGNOBJ *) GDI_GetObjPtr( hSrc2, OBJ_REGION);
+
+		if (src2Obj)
+		{
+		    /*TRACE(region, "dump:\n");
+		    if(TRACE_ON(region)) 
+		        REGION_DumpRegion(src2Obj->rgn);*/
+		    switch (mode)
+		    {
+		    case RGN_AND:
+			GdIntersectRegion( destObj->rgn, src1Obj->rgn, src2Obj->rgn);
+			break;
+		    case RGN_OR:
+			GdUnionRegion( destObj->rgn, src1Obj->rgn, src2Obj->rgn );
+			break;
+		    case RGN_XOR:
+			GdXorRegion( destObj->rgn, src1Obj->rgn, src2Obj->rgn );
+			break;
+		    case RGN_DIFF:
+			GdSubtractRegion( destObj->rgn, src1Obj->rgn, src2Obj->rgn );
+			break;
+		    }
+		    result = destObj->rgn->type;
+		}
+	    }
+	}
+	/*TRACE(region, "dump:\n");
+	if(TRACE_ON(region)) 
+	    REGION_DumpRegion(destObj->rgn);*/
+    }
+    return result;
+}
+
+/*
+ * Rectangle-related functions
+ *
+ * Copyright 1993, 1996 Alexandre Julliard
+ *
+ */
+BOOL WINAPI
+IntersectRect( LPRECT dest, const RECT *src1, const RECT *src2 )
+{
+    if (IsRectEmpty(src1) || IsRectEmpty(src2) ||
+	(src1->left >= src2->right) || (src2->left >= src1->right) ||
+	(src1->top >= src2->bottom) || (src2->top >= src1->bottom))
+    {
+	SetRectEmpty( dest );
+	return FALSE;
+    }
+    dest->left   = MWMAX( src1->left, src2->left );
+    dest->right  = MWMIN( src1->right, src2->right );
+    dest->top    = MWMAX( src1->top, src2->top );
+    dest->bottom = MWMIN( src1->bottom, src2->bottom );
+    return TRUE;
+}
+
+
+BOOL WINAPI
+UnionRect( LPRECT dest, const RECT *src1, const RECT *src2 )
+{
+    if (IsRectEmpty(src1))
+    {
+	if (IsRectEmpty(src2))
+	{
+	    SetRectEmpty( dest );
+	    return FALSE;
+	}
+	else *dest = *src2;
+    }
+    else
+    {
+	if (IsRectEmpty(src2)) *dest = *src1;
+	else
+	{
+	    dest->left   = MWMIN( src1->left, src2->left );
+	    dest->right  = MWMAX( src1->right, src2->right );
+	    dest->top    = MWMIN( src1->top, src2->top );
+	    dest->bottom = MWMAX( src1->bottom, src2->bottom );	    
+	}
+    }
+    return TRUE;
+}
+
+
+BOOL WINAPI
+EqualRect( const RECT* rect1, const RECT* rect2 )
+{
+    return ((rect1->left == rect2->left) && (rect1->right == rect2->right) &&
+	    (rect1->top == rect2->top) && (rect1->bottom == rect2->bottom));
+}
+
+
+BOOL WINAPI
+SubtractRect( LPRECT dest, const RECT *src1, const RECT *src2 )
+{
+    RECT tmp;
+
+    if (IsRectEmpty( src1 ))
+    {
+	SetRectEmpty( dest );
+	return FALSE;
+    }
+    *dest = *src1;
+    if (IntersectRect( &tmp, src1, src2 ))
+    {
+	if (EqualRect( &tmp, dest ))
+	{
+	    SetRectEmpty( dest );
+	    return FALSE;
+	}
+	if ((tmp.top == dest->top) && (tmp.bottom == dest->bottom))
+	{
+	    if (tmp.left == dest->left) dest->left = tmp.right;
+	    else if (tmp.right == dest->right) dest->right = tmp.left;
+	}
+	else if ((tmp.left == dest->left) && (tmp.right == dest->right))
+	{
+	    if (tmp.top == dest->top) dest->top = tmp.bottom;
+	    else if (tmp.bottom == dest->bottom) dest->bottom = tmp.top;
+	}
+    }
+    return TRUE;
+}
diff -urN lib/microwindows/src/mwin/winsbar.0 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winsbar.0
--- lib/microwindows/src/mwin/winsbar.0	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winsbar.0	2005-02-21 16:13:30.000000000 +0100
@@ -0,0 +1,2186 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1999, 2000, Wei Yongming.
+ *
+ * Microwindows win32 NonClient Scrollbars
+ */
+#include "windows.h"
+#include "wintern.h"
+#include "wintools.h"
+#include <stdlib.h>
+#include <string.h>
+
+/* scrollbar status/positions*/
+#define SBS_UNKNOWN		0x0000
+#define SBS_LEFTARROW		0x0001
+#define SBS_RIGHTARROW		0x0002
+#define SBS_LEFTSPACE		0x0004
+#define SBS_RIGHTSPACE		0x0008
+#define SBS_HORZTHUMB		0x0010
+#define SBS_UPARROW		0x0020
+#define SBS_DOWNARROW		0x0040
+#define SBS_UPSPACE		0x0080
+#define SBS_DOWNSPACE		0x0100
+#define SBS_VERTTHUMB		0x0200
+#define SBS_MASK		0x03ff
+#define SBS_DISABLED		0x4000
+#define SBS_HIDE		0x8000
+
+#define HSCROLLBARVISIBLE(hwnd)	((hwnd)->style & WS_HSCROLL)
+#define VSCROLLBARVISIBLE(hwnd)	((hwnd)->style & WS_VSCROLL)
+
+/* 
+ * Adjust client area smaller if scrollbars visible.
+ * Also, compute the NC hittest regions for the scrollbars.
+ */
+void
+MwAdjustNCScrollbars(HWND hwnd)
+{
+	BOOL	vertbar = VSCROLLBARVISIBLE(hwnd);
+        BOOL	horzbar = HSCROLLBARVISIBLE(hwnd);
+
+	if (vertbar) {
+		hwnd->clirect.right -= mwSYSMETRICS_CXVSCROLL;
+		if (horzbar)
+			hwnd->clirect.bottom -= mwSYSMETRICS_CYHSCROLL;
+		hwnd->vscroll.rc.left = hwnd->clirect.right;
+		hwnd->vscroll.rc.right = hwnd->clirect.right +
+			mwSYSMETRICS_CXVSCROLL;
+		hwnd->vscroll.rc.top = hwnd->clirect.top;
+		hwnd->vscroll.rc.bottom = hwnd->clirect.bottom;
+	} else
+		SetRectEmpty(&hwnd->vscroll.rc);
+	if (horzbar) {
+		if (!vertbar)
+			hwnd->clirect.bottom -= mwSYSMETRICS_CYHSCROLL;
+		hwnd->hscroll.rc.top = hwnd->clirect.bottom;
+		hwnd->hscroll.rc.bottom = hwnd->clirect.bottom +
+			mwSYSMETRICS_CYHSCROLL;
+		hwnd->hscroll.rc.left = hwnd->clirect.left;
+		hwnd->hscroll.rc.right = hwnd->clirect.right;
+	} else
+		SetRectEmpty(&hwnd->hscroll.rc);
+}
+
+void
+MwPaintNCScrollbars(HWND hwnd, HDC hdc)
+{
+	BOOL	vertbar = VSCROLLBARVISIBLE(hwnd);
+        BOOL	horzbar = HSCROLLBARVISIBLE(hwnd);
+	BOOL	fGotDC = FALSE;
+	RECT	rc;
+
+	if (!hdc && (horzbar || vertbar)) {
+		hdc = GetWindowDC(hwnd);
+		fGotDC = TRUE;
+	}
+
+	if (horzbar && vertbar) {
+		rc.left = hwnd->clirect.right;
+		rc.top = hwnd->clirect.bottom;
+		rc.right = rc.left + mwSYSMETRICS_CXVSCROLL;
+		rc.bottom = rc.top + mwSYSMETRICS_CYHSCROLL;
+		FillRect(hdc, &rc, (HBRUSH)(COLOR_BTNFACE+1));
+	}
+	if (vertbar) {
+		rc = hwnd->vscroll.rc;
+		/* bkgnd*/
+		FillRect(hdc, &rc, (HBRUSH)(COLOR_BTNFACE+1));
+		/* up*/
+		Draw3dUpDownState(hdc, rc.left, rc.top,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->vscroll.status & SBS_UPARROW);
+		/* down*/
+		Draw3dUpDownState(hdc, rc.left,rc.bottom-mwSYSMETRICS_CYHSCROLL,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->vscroll.status & SBS_DOWNARROW);
+	}
+	if (horzbar) {
+		rc = hwnd->hscroll.rc;
+		/* bkgnd*/
+		FillRect(hdc, &rc, (HBRUSH)(COLOR_BTNFACE+1));
+		/* left*/
+		Draw3dUpDownState(hdc, rc.left, rc.top,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->hscroll.status & SBS_LEFTARROW);
+		/* right*/
+		Draw3dUpDownState(hdc, rc.right-mwSYSMETRICS_CXVSCROLL, rc.top,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->hscroll.status & SBS_RIGHTARROW);
+	}
+
+	if (fGotDC)
+		ReleaseDC(hwnd, hdc);
+}
+
+/* handle a non-client message for a scrollbar*/
+void
+MwHandleNCMessageScrollbar(HWND hwnd, WPARAM hitcode, LPARAM lParam, BOOL fDown)
+{
+	int	pos = SBS_UNKNOWN;
+	BOOL	vertbar = VSCROLLBARVISIBLE(hwnd);
+        BOOL	horzbar = HSCROLLBARVISIBLE(hwnd);
+	int *	pStat;
+	POINT	pt;
+	RECT	rc;
+
+	POINTSTOPOINT(pt, lParam);
+	for (;;) {	/* use for() to allow break statement*/
+		if (hitcode == HTVSCROLL && vertbar) {
+			pStat = &hwnd->vscroll.status;
+			rc = hwnd->vscroll.rc;
+			rc.bottom = rc.top + mwSYSMETRICS_CYVSCROLL;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_UPARROW;
+				break;
+			}
+			rc.bottom = hwnd->vscroll.rc.bottom;
+			rc.top = rc.bottom - mwSYSMETRICS_CYVSCROLL;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_DOWNARROW;
+				break;
+			}
+			pos = SBS_VERTTHUMB;
+		} else if (hitcode == HTHSCROLL && horzbar) {
+			pStat = &hwnd->hscroll.status;
+			rc = hwnd->hscroll.rc;
+			rc.right = rc.left + mwSYSMETRICS_CXHSCROLL;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_LEFTARROW;
+				break;
+			}
+			rc.right = hwnd->hscroll.rc.right;
+			rc.left = rc.right - mwSYSMETRICS_CXHSCROLL;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_RIGHTARROW;
+				break;
+			}
+			pos = SBS_HORZTHUMB;
+		} else
+			return;
+		break;
+	}
+
+	if (pos == SBS_UNKNOWN)
+		return;
+
+	*pStat &= ~SBS_MASK;		/* remove stray mouse states*/
+	if (fDown)
+		*pStat |= pos;
+	else *pStat &= ~pos;
+	MwPaintNCScrollbars(hwnd, NULL);
+}
+
+#if 0000
+static int
+wndGetBorder(HWND hwnd)
+{
+	if (hwnd->style & WS_BORDER)  {
+		if ((hwnd->style & WS_CAPTION) == WS_CAPTION)
+			return mwSYSMETRICS_CXFRAME;
+		return mwSYSMETRICS_CXBORDER;
+	}
+	return 0;
+}
+
+static BOOL
+wndGetVScrollBarRect (HWND hwnd, RECT* rcVBar)
+{
+    if (hwnd->style & WS_VSCROLL) {
+        rcVBar->left = hwnd->winrect.right - mwSYSMETRICS_CXVSCROLL
+                        - wndGetBorder (hwnd);
+        rcVBar->right = hwnd->right - wndGetBorder (hwnd);
+        rcVBar->top  = hwnd->clirect.top;
+        rcVBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd);
+
+        if (hwnd->style & WS_HSCROLL && !(hwnd->hscroll.status & SBS_HIDE))
+            rcVBar->bottom -= mwSYSMETRICS_CYHSCROLL;
+        
+        return TRUE;
+    }
+    
+    return FALSE;
+}
+
+static BOOL
+wndGetHScrollBarRect (HWND hwnd, RECT* rcHBar)
+{
+    if (hwnd->style & WS_HSCROLL) {
+        rcHBar->top = hwnd->winrect.bottom - mwSYSMETRICS_CYHSCROLL
+                        - wndGetBorder (hwnd);
+        rcHBar->bottom = hwnd->bottom - wndGetBorder (hwnd);
+        rcHBar->left  = hwnd->clirect.left;
+        rcHBar->right = hwnd->winrect.right - wndGetBorder (hwnd);
+
+        if (hwnd->style & WS_VSCROLL && !(hwnd->vscroll.status & SBS_HIDE))
+            rcHBar->right -= mwSYSMETRICS_CXVSCROLL;
+
+        return TRUE;
+    }
+    
+    return FALSE;
+}
+
+static int
+wndGetHScrollBarPos (HWND hwnd, int x, int y)
+{
+    RECT rcBar;
+    RECT rcArea;
+
+    if (hwnd->hscroll.status & SBS_DISABLED)
+        return SBS_UNKNOWN;
+
+    wndGetHScrollBarRect (hwnd, &rcBar);
+
+    if (!PtInRect (&rcBar, x, y))
+        return SBS_UNKNOWN;
+
+    rcArea.top  = rcBar.top;
+    rcArea.bottom = rcBar.bottom;
+
+    // Left arrow area
+    rcArea.left = rcBar.left;
+    rcArea.right = rcArea.left + mwSYSMETRICS_CXHSCROLL;
+
+    if (PtInRect (&rcArea, x, y))
+        return SBS_LEFTARROW;
+
+    // Right arrow area
+    rcArea.left = rcBar.right - mwSYSMETRICS_CXHSCROLL;
+    rcArea.right = rcBar.right;
+
+    if (PtInRect (&rcArea, x, y))
+        return SBS_RIGHTARROW;
+
+
+    if (x < (rcBar.left + hwnd->hscroll.barStart + mwSYSMETRICS_CXHSCROLL))
+        return SBS_LEFTSPACE;
+
+    if (x > (rcBar.left + hwnd->hscroll.barStart + hwnd->hscroll.barLen
+            + mwSYSMETRICS_CXHSCROLL))
+        return SBS_RIGHTSPACE;
+
+    return SBS_UNKNOWN;
+}
+
+static int
+wndGetVScrollBarPos (HWND hwnd, int x, int y)
+{
+    RECT rcBar;
+    RECT rcArea;
+
+    if (hwnd->vscroll.status & SBS_DISABLED)
+        return SBS_UNKNOWN;
+
+    wndGetVScrollBarRect (hwnd, &rcBar);
+
+    if (!PtInRect (&rcBar, x, y))
+        return SBS_UNKNOWN;
+
+    rcArea.left  = rcBar.left;
+    rcArea.right = rcBar.right;
+
+    // Left arrow area
+    rcArea.top = rcBar.top;
+    rcArea.bottom = rcArea.top + mwSYSMETRICS_CYVSCROLL;
+
+    if (PtInRect (&rcArea, x, y))
+        return SBS_UPARROW;
+
+    // Right arrow area
+    rcArea.top = rcBar.bottom - mwSYSMETRICS_CYVSCROLL;
+    rcArea.bottom = rcBar.bottom;
+
+    if (PtInRect (&rcArea, x, y))
+        return SBS_DOWNARROW;
+
+
+    if (y < (rcBar.top + hwnd->vscroll.barStart + mwSYSMETRICS_CYVSCROLL))
+        return SBS_UPSPACE;
+
+    if (y > (rcBar.top + hwnd->vscroll.barStart + hwnd->vscroll.barLen
+            + mwSYSMETRICS_CYVSCROLL))
+        return SBS_DOWNSPACE;
+
+    return SBS_UNKNOWN;
+}
+
+static BOOL
+sbGetSBarArrowPos (HWND hwnd, int location, int* x, int* y, int* w, int* h)
+{
+    RECT rcBar;
+
+    if (location < SBS_UPARROW) 
+        wndGetHScrollBarRect (hwnd, &rcBar);
+    else
+        wndGetVScrollBarRect (hwnd, &rcBar);
+
+    *w = mwSYSMETRICS_CXHSCROLL;
+    *h = mwSYSMETRICS_CYHSCROLL;
+    switch (location) {
+        case SBS_LEFTARROW:
+            *x = rcBar.left;
+            *y = rcBar.top;
+        break;
+        
+        case SBS_RIGHTARROW:
+            *x = rcBar.right - mwSYSMETRICS_CXHSCROLL;
+            *y = rcBar.top;
+        break;
+
+        case SBS_UPARROW:
+            *x = rcBar.left;
+            *y = rcBar.top;
+        break;
+
+        case SBS_DOWNARROW:
+            *x = rcBar.left;
+            *y = rcBar.bottom - mwSYSMETRICS_CYVSCROLL;
+        break;
+
+        default:
+        return FALSE;
+    }
+
+    *x -= hwnd->left;
+    *y -= hwnd->top;
+
+    return TRUE;
+}
+
+static BOOL
+sbDownButton (PMAINWIN pWin, int downCode)
+{
+    HDC hdc;
+    int x, y, w, h;
+
+    
+    if (!sbGetButtonPos (pWin, downCode, &x, &y, &w, &h))
+        return FALSE;
+
+    w += x - 1;
+    h += y - 1;
+    hdc = GetDC ((HWND)pWin);
+    Draw3DDownFrame(hdc, x, y, w, h, COLOR_invalid);
+    ReleaseDC (hdc);
+
+    return TRUE;
+}
+
+static BOOL sbUpButton (PMAINWIN pWin, int downCode)
+{
+    HDC hdc;
+    int x, y, w, h;
+    PBITMAP bmp = NULL;
+    
+    if (!sbGetButtonPos (pWin, downCode, &x, &y, &w, &h))
+        return FALSE;
+
+    hdc = GetDC ((HWND)pWin);
+    switch (downCode) {
+        case HT_MAXBUTTON:
+            bmp = GetSystemBitmap (SYSBMP_MAXIMIZE);
+            break;
+        case HT_MINBUTTON:
+            bmp = GetSystemBitmap (SYSBMP_MINIMIZE);
+            break;
+        case HT_CLOSEBUTTON:
+            bmp = GetSystemBitmap (SYSBMP_CLOSE);
+            break;
+
+        case SBS_UPARROW:
+            bmp = GetSystemBitmap (SYSBMP_ARROWUP);
+            break;
+        case SBS_DOWNARROW:
+            bmp = GetSystemBitmap (SYSBMP_ARROWDOWN);
+            break;
+        case SBS_LEFTARROW:
+            bmp = GetSystemBitmap (SYSBMP_ARROWLEFT);
+            break;
+        case SBS_RIGHTARROW:
+            bmp = GetSystemBitmap (SYSBMP_ARROWRIGHT);
+            break;
+    }
+
+    if (bmp)
+        FillBoxWithBitmap (hdc, x, y, w, h, bmp);
+
+    ReleaseDC (hdc);
+
+    return TRUE;
+}
+
+static BOOL
+wndHandleHScrollBar (HWND hwnd, int message, int x, int y)
+{
+    int curPos;
+    RECT rcBar;
+    static int downPos = SBS_UNKNOWN;
+    static int movePos = SBS_UNKNOWN;
+    static int sbCode;
+
+    wndGetHScrollBarRect (hwnd, &rcBar);
+    rcBar.left -= hwnd->winrect.left;
+    rcBar.top  -= hwnd->winrect.top;
+    rcBar.right -= hwnd->winrect.left;
+    rcBar.bottom -= hwnd->winrect.top;
+    
+    rcBar.left += mwSYSMETRICS_CXHSCROLL;
+    rcBar.right -= mwSYSMETRICS_CXHSCROLL;
+
+    curPos = wndGetHScrollBarPos (hwnd, x, y);
+    
+    if (curPos == SBS_UNKNOWN && downPos == SBS_UNKNOWN)
+        return FALSE;
+    
+    switch( message )
+    {
+        case WM_NCLBUTTONDOWN:
+            downPos = curPos;
+            movePos = curPos;
+            if (curPos == SBS_LEFTARROW) {
+                sbDownButton (hwnd, curPos);
+                if (hwnd->hscroll.curPos == hwnd->hscroll.minPos)
+                    break;
+
+                sbCode = SB_LINELEFT;
+            }
+            else if (curPos == SBS_RIGHTARROW) {
+                sbDownButton (hwnd, curPos);
+                if (hwnd->hscroll.curPos == hwnd->hscroll.maxPos)
+                    break;
+                
+                sbCode = SB_LINERIGHT;
+            }
+            else if (curPos == SBS_LEFTSPACE) {
+                if (hwnd->hscroll.curPos == hwnd->hscroll.minPos)
+                    break;
+
+                sbCode = SB_PAGELEFT;
+            }
+            else if (curPos == SBS_RIGHTSPACE) {
+                if (hwnd->hscroll.curPos == hwnd->hscroll.maxPos)
+                    break;
+                
+                sbCode = SB_PAGERIGHT;
+            }
+        break;
+
+        case WM_NCLBUTTONUP:
+            if (curPos == downPos) {
+                sbUpButton (hwnd, curPos);
+                SendNotifyMessage (hwnd, WM_HSCROLL, sbCode, 0);
+            }
+
+            downPos = SBS_UNKNOWN;
+            movePos = SBS_UNKNOWN;
+        break;
+    
+        case WM_NCMOUSEMOVE:
+            if (movePos == downPos && curPos != downPos)
+                sbUpButton (hwnd, downPos);
+            else if (movePos != downPos && curPos == downPos)
+                sbDownButton (hwnd, downPos);
+            movePos = curPos;
+        break;
+    }
+
+    return TRUE;
+}
+
+static BOOL
+wndHandleVScrollBar (HWND hwnd, int message, int x, int y)
+{
+    static int downPos = SBS_UNKNOWN;
+    static int movePos = SBS_UNKNOWN;
+    static int sbCode;
+    int curPos;
+    RECT rcBar;
+
+    wndGetVScrollBarRect (hwnd, &rcBar);
+    rcBar.left -= hwnd->left;
+    rcBar.top  -= hwnd->top;
+    rcBar.right -= hwnd->left;
+    rcBar.bottom -= hwnd->top;
+
+    rcBar.top += mwSYSMETRICS_CYVSCROLL);
+    rcBar.bottom -= mwSYSMETRICS_CYVSCROLL);
+
+    curPos = wndGetVScrollBarPos (hwnd, x, y);
+
+    if (curPos == SBS_UNKNOWN && downPos == SBS_UNKNOWN)
+        return FALSE;
+    
+    switch( message )
+    {
+        case WM_NCLBUTTONDOWN:
+            downPos = curPos;
+            movePos = curPos;
+            if (curPos == SBS_UPARROW) {
+                sbDownButton (hwnd, curPos);
+                if (hwnd->vscroll.curPos == hwnd->vscroll.minPos)
+                    break;
+
+                sbCode = SB_LINEUP;
+            }
+            else if (curPos == SBS_DOWNARROW) {
+                sbDownButton (hwnd, curPos);
+                if (hwnd->vscroll.curPos == hwnd->vscroll.maxPos)
+                    break;
+
+                sbCode = SB_LINEDOWN;
+            }
+            else if (curPos == SBS_UPSPACE) {
+                if (hwnd->vscroll.curPos == hwnd->vscroll.minPos)
+                    break;
+
+                sbCode = SB_PAGEUP;
+            }
+            else if (curPos == SBS_DOWNSPACE) {
+                if (hwnd->vscroll.curPos == hwnd->vscroll.maxPos)
+                    break;
+
+                sbCode = SB_PAGEDOWN;
+            }
+        break;
+
+        case WM_NCLBUTTONUP:
+            if (curPos == downPos) {
+                sbUpButton (hwnd, curPos);
+                SendNotifyMessage (hwnd, WM_VSCROLL, sbCode, 0);
+            }
+
+            downPos = SBS_UNKNOWN;
+            movePos = SBS_UNKNOWN;
+        break;
+    
+        case WM_NCMOUSEMOVE:
+            if (movePos == downPos && curPos != downPos)
+                sbUpButton (hwnd, downPos);
+            else if (movePos != downPos && curPos == downPos)
+                sbDownButton (hwnd, downPos);
+            movePos = curPos;
+        break;
+    }
+
+    return TRUE;
+}
+
+// this function is CONTROL safe.
+static int DefaultNCMouseMsgHandler(PMAINWIN hwnd, int message, 
+                           int location, int x, int y)
+{
+    static PMAINWIN downWin  = NULL;
+    static int downCode = HT_UNKNOWN;
+    static int moveCode = HT_UNKNOWN;
+    static int oldx, oldy;
+    static RECT rcWindow;
+
+    int barItem;
+
+    if (hwnd->WinType == TYPE_MAINWIN && message == WM_NCMOUSEMOVE)
+        wndTrackMenuBarOnMouseMove(pWin, message, location, x, y);
+
+    if ((pWin->style & WS_HSCROLL) 
+            && wndHandleHScrollBar (pWin, message, x, y))
+        return 0;
+    
+    if ((pWin->style & WS_VSCROLL)
+            && wndHandleVScrollBar (pWin, message, x, y))
+        return 0;
+
+    switch( message )
+    {
+        case WM_NCLBUTTONDOWN:
+            if (location == HT_MENUBAR) {
+                barItem = MenuBarHitTest ((HWND)pWin, x, y);
+                if (barItem >= 0)
+                    TrackMenuBar ((HWND)pWin, barItem);
+
+                return 0;
+            }
+            else if (location == HT_CAPTION) {
+                GetWindowRect ((HWND)pWin, &rcWindow);
+                FocusRect (0, rcWindow.left, rcWindow.top,
+                              rcWindow.right, rcWindow.bottom);
+                oldx = x;
+                oldy = y;
+            }
+            downCode = location;
+            moveCode = location;
+            downWin  = pWin;
+            sbDownButton (pWin, downCode);
+            break;
+
+        case WM_NCMOUSEMOVE:
+            if (downCode != HT_UNKNOWN) { 
+                if (downCode == HT_CAPTION && downWin == pWin) {
+                    FocusRect (0, rcWindow.left, rcWindow.top,
+                              rcWindow.right, rcWindow.bottom);
+                    OffsetRect (&rcWindow, x - oldx, y - oldy);
+                    FocusRect (0, rcWindow.left, rcWindow.top,
+                              rcWindow.right, rcWindow.bottom);
+                    
+                    oldx = x;
+                    oldy = y;
+                }
+                else if (moveCode == downCode && location != downCode) {
+                    sbUpButton (pWin, downCode);
+                    moveCode = location;
+                }
+                else if (moveCode != downCode && location == downCode) {
+                    sbDownButton (pWin, downCode);
+                    moveCode = location;
+                }
+            }
+            break;
+
+        case WM_NCLBUTTONUP:
+            if (downCode == HT_CAPTION) {
+                FocusRect (0, rcWindow.left, rcWindow.top,
+                              rcWindow.right, rcWindow.bottom);
+                    
+                MoveWindow ((HWND)pWin, rcWindow.left,
+                                        rcWindow.top,
+                                        RECTW (rcWindow),
+                                        RECTH (rcWindow),
+                                        FALSE);
+            }
+            else if (location == downCode) {
+                sbUpButton (pWin, downCode);
+                switch (location) {
+                    case HT_CLOSEBUTTON:
+                        SendNotifyMessage ((HWND)pWin, WM_CLOSE, 0, 0);
+                    break;
+
+                    case HT_MAXBUTTON:
+                    break;
+
+                    case HT_MINBUTTON:
+                    break;
+
+                    case HT_ICON:
+                        if (pWin->hSysMenu)
+                            TrackPopupMenu (pWin->hSysMenu, 
+                                TPM_SYSCMD, x, y, (HWND)pWin);
+                    break;
+
+                    case HT_CAPTION:
+                    break;
+
+                }
+            }
+            downCode = HT_UNKNOWN;
+            moveCode = HT_UNKNOWN;
+            downWin  = NULL;
+            break;
+            
+        case WM_NCRBUTTONDOWN:
+            break;
+
+        case WM_NCRBUTTONUP:
+            if (location == HT_CAPTION && pWin->hSysMenu)
+                TrackPopupMenu (pWin->hSysMenu, TPM_SYSCMD, x, y, (HWND)pWin);
+            break;
+            
+        case WM_NCLBUTTONDBLCLK:
+            if (location == HT_ICON)
+                SendNotifyMessage ((HWND)pWin, WM_CLOSE, 0, 0);
+//            else if (location == HT_CAPTION)
+//                SendNotifyMessage ((HWND)pWin, WM_MAXIMIZE, 0, 0);
+            break;
+
+        case WM_NCRBUTTONDBLCLK:
+            break;
+    }
+
+    return 0;
+}
+
+static void
+wndScrollBarPos (HWND hwnd, BOOL bIsHBar, RECT* rcBar)
+{
+    UINT moveRange;
+    PSCROLLBARINFO pSBar;
+
+    if (bIsHBar)
+        pSBar = &hwnd->hscroll;
+    else
+        pSBar = &hwnd->vscroll;
+
+    if (pSBar->minPos == pSBar->maxPos) {
+        pSBar->status |= SBS_HIDE;
+        return;
+    }
+
+    if (bIsHBar)
+        moveRange = (rcBar->right - rcBar->left) - (mwSYSMETRICS_CXHSCROLL<<1);
+    else
+        moveRange = (rcBar->bottom - rcBar->top) - (mwSYSMETRICS_CYVSCROLL<<1);
+
+#define MWM_DEFBARLEN	18
+#define MWM_MINBARLEN	8
+
+    if (pSBar->pageStep == 0) {
+        pSBar->barLen = MWM_DEFBARLEN;
+
+        if (pSBar->barLen > moveRange)
+            pSBar->barLen = MWM_MINBARLEN;
+    }
+    else {
+        pSBar->barLen = moveRange * pSBar->pageStep /
+	      (pSBar->maxPos - pSBar->minPos + 1);
+        if (pSBar->barLen < MWM_MINBARLEN)
+            pSBar->barLen = MWM_MINBARLEN;
+    }
+
+    pSBar->barStart = moveRange * (pSBar->curPos - pSBar->minPos) /
+       (pSBar->maxPos - pSBar->minPos + 1);
+
+    if (pSBar->barStart + pSBar->barLen > moveRange)
+        pSBar->barStart = moveRange - pSBar->barLen;
+    if (pSBar->barStart < 0)
+        pSBar->barStart = 0;
+}
+
+static void OnChangeSize(PMAINWIN pWin, PRECT pDestRect, PRECT pResultRect)
+{
+    int iBorder = 0;
+    int iCaptionY = 0;
+    int iIconX = 0;
+    int iIconY = 0;
+    int iMenuY = 0;
+
+    if (pWin->style & WS_BORDER) 
+        iBorder = GetMainWinMetrics(MWM_BORDER);
+    else if (pWin->style & WS_THICKFRAME)
+        iBorder = GetMainWinMetrics(MWM_THICKFRAME);
+    else if (pWin->style & WS_THINFRAME)
+        iBorder = GetMainWinMetrics (MWM_THINFRAME);
+
+    if( pWin->style & WS_CAPTION )
+    {
+        iCaptionY = GetMainWinMetrics(MWM_CAPTIONY);
+
+        if (pWin->WinType == TYPE_MAINWIN && pWin->hIcon) {
+            iIconX = GetMainWinMetrics(MWM_ICONX);
+            iIconY = GetMainWinMetrics(MWM_ICONY);
+        }
+    }
+
+    if (pWin->WinType == TYPE_MAINWIN && pWin->hMenu) {
+        iMenuY = GetMainWinMetrics (MWM_MENUBARY);
+        iMenuY += GetMainWinMetrics (MWM_MENUBAROFFY)<<1;
+    }
+
+    if (pDestRect) {
+        int minWidth = 0, minHeight = 0;
+
+        memcpy(&pWin->left, pDestRect, sizeof(RECT));
+
+        minHeight = iMenuY + (iCaptionY<<1);
+        if (pWin->style & WS_VSCROLL) {
+            minWidth += GetMainWinMetrics (MWM_CXVSCROLL);
+            minHeight += (GetMainWinMetrics (MWM_CYVSCROLL)<<1) +
+                         (GetMainWinMetrics (MWM_MINBARLEN)<<1);
+        }
+        
+        if (pWin->WinType == TYPE_MAINWIN)
+            minWidth += GetMainWinMetrics (MWM_MINWIDTH);
+
+        if (pWin->style & WS_HSCROLL) {
+            minHeight += GetMainWinMetrics (MWM_CYHSCROLL);
+            minWidth += (GetMainWinMetrics (MWM_CXHSCROLL)<<1) +
+                        (GetMainWinMetrics (MWM_MINBARLEN)<<1);
+        }
+
+        if(minHeight > (pWin->bottom - pWin->top))
+            pWin->bottom = pWin->top + minHeight;
+
+        if(pWin->right < (pWin->left + minWidth))
+            pWin->right = pWin->left + minWidth;
+
+        if( pResultRect )
+             memcpy(pResultRect, &pWin->left, sizeof(RECT));
+    }
+
+    memcpy(&pWin->cl, &pWin->left, sizeof(RECT));
+
+    pWin->cl += iBorder;
+    pWin->ct += iBorder;
+    pWin->cr -= iBorder;
+    pWin->cb -= iBorder;
+    pWin->ct += iCaptionY;
+    pWin->ct += iMenuY;
+    
+    if (pWin->style & WS_HSCROLL && !(pWin->hscroll.status & SBS_HIDE)) {
+    
+        RECT rcBar;
+        wndGetHScrollBarRect (pWin, &rcBar);
+        wndScrollBarPos (pWin, TRUE, &rcBar);
+
+        pWin->cb -= GetMainWinMetrics (MWM_CYHSCROLL);
+    }
+        
+    if (pWin->style & WS_VSCROLL && !(pWin->vscroll.status & SBS_HIDE)) {
+    
+        RECT rcBar;
+        wndGetVScrollBarRect (pWin, &rcBar);
+        wndScrollBarPos (pWin, FALSE, &rcBar);
+
+        pWin->cr -= GetMainWinMetrics (MWM_CXVSCROLL);
+    }
+}
+
+int ClientWidthToWindowWidth (DWORD dwStyle, int cw)
+{
+    int iBorder = 0;
+    int iScroll = 0;
+
+    if (dwStyle & WS_BORDER) 
+        iBorder = GetMainWinMetrics(MWM_BORDER);
+    else if (dwStyle & WS_THICKFRAME)
+        iBorder = GetMainWinMetrics(MWM_THICKFRAME);
+    else if (dwStyle & WS_THINFRAME)
+        iBorder = GetMainWinMetrics (MWM_THINFRAME);
+
+    if (dwStyle & WS_VSCROLL)
+        iScroll = GetMainWinMetrics (MWM_CXVSCROLL);
+        
+    return cw + (iBorder<<1) + iScroll;
+}
+
+int ClientHeightToWindowHeight (DWORD dwStyle, int ch, BOOL hasMenu)
+{
+    int iBorder  = 0;
+    int iCaption = 0;
+    int iScroll  = 0;
+    int iMenu    = 0;
+
+    if (dwStyle & WS_BORDER) 
+        iBorder = GetMainWinMetrics(MWM_BORDER);
+    else if (dwStyle & WS_THICKFRAME)
+        iBorder = GetMainWinMetrics(MWM_THICKFRAME);
+    else if (dwStyle & WS_THINFRAME)
+        iBorder = GetMainWinMetrics (MWM_THINFRAME);
+
+    if (dwStyle & WS_HSCROLL)
+        iScroll = GetMainWinMetrics (MWM_CYHSCROLL);
+        
+    if (dwStyle & WS_CAPTION)
+        iCaption = GetMainWinMetrics(MWM_CAPTIONY);
+
+    if (hasMenu) {
+        iMenu = GetMainWinMetrics (MWM_MENUBARY);
+        iMenu += GetMainWinMetrics (MWM_MENUBAROFFY)<<1;
+    }
+    
+    return ch + (iBorder<<1) + iCaption + iScroll + iMenu;
+}
+
+// this function is CONTROL safe.
+static int HittestOnNClient (PMAINWIN pWin, int x, int y)
+{
+    RECT rcCaption, rcIcon, rcButton, rcMenuBar;
+    int iBorder = 0;
+    int iCaption = 0;
+    int iIconX = 0;
+    int iIconY = 0;
+
+    if (pWin->dwStyle & WS_BORDER) 
+        iBorder = GetMainWinMetrics(MWM_BORDER);
+    else if (pWin->dwStyle & WS_THICKFRAME)
+        iBorder = GetMainWinMetrics(MWM_THICKFRAME);
+    else if (pWin->dwStyle & WS_THINFRAME)
+        iBorder = GetMainWinMetrics (MWM_THINFRAME);
+
+    if (pWin->dwStyle & WS_HSCROLL && !(pWin->hscroll.status & SBS_HIDE)) {
+    
+        RECT rcBar;
+        wndGetHScrollBarRect (pWin, &rcBar);
+
+        if (PtInRect (&rcBar, x, y))
+            return HT_HSCROLL;
+    }
+        
+    if (pWin->dwStyle & WS_VSCROLL && !(pWin->vscroll.status & SBS_HIDE)) {
+    
+        RECT rcBar;
+        wndGetVScrollBarRect (pWin, &rcBar);
+
+        if (PtInRect (&rcBar, x, y))
+            return HT_VSCROLL;
+    }
+    
+    if (!(pWin->dwStyle & WS_CAPTION))
+         return HT_BORDER;
+
+    iCaption = GetMainWinMetrics(MWM_CAPTIONY);
+
+    if (pWin->WinType == TYPE_MAINWIN && pWin->hIcon)
+    {
+        iIconX = GetMainWinMetrics(MWM_ICONX);
+        iIconY = GetMainWinMetrics(MWM_ICONY);
+    }
+
+    // Caption rect;
+    rcCaption.left = pWin->left + iBorder;
+    rcCaption.top = pWin->top + iBorder;
+    rcCaption.right = pWin->right - iBorder;
+    rcCaption.bottom = rcCaption.top + iCaption;
+                    
+    if (pWin->WinType == TYPE_MAINWIN && pWin->hIcon)
+    { 
+        rcIcon.left = rcCaption.left;
+        rcIcon.top = rcCaption.top;
+        rcIcon.right = rcIcon.left + iIconX;
+        rcIcon.bottom = rcIcon.top + iIconY;
+
+        if (PtInRect (&rcIcon, x, y))
+            return HT_ICON;
+    }
+
+    rcButton.left = rcCaption.right - GetMainWinMetrics (MWM_SB_WIDTH);
+    rcButton.top = rcCaption.top;
+    rcButton.right = rcCaption.right;
+    rcButton.bottom = rcCaption.top + GetMainWinMetrics (MWM_SB_HEIGHT);
+    if (PtInRect (&rcButton, x, y))
+        return HT_CLOSEBUTTON;
+
+    rcButton.left -= GetMainWinMetrics (MWM_SB_WIDTH);
+    rcButton.left -= GetMainWinMetrics (MWM_SB_INTERX)<<1;
+    if (pWin->dwStyle & WS_MAXIMIZEBOX) {
+        rcButton.right = rcButton.left + GetMainWinMetrics (MWM_SB_WIDTH);
+        if (PtInRect (&rcButton, x, y))
+            return HT_MAXBUTTON;
+
+        rcButton.left -= GetMainWinMetrics (MWM_SB_WIDTH);
+        rcButton.left -= GetMainWinMetrics (MWM_SB_INTERX);
+    }
+
+    if (pWin->dwStyle & WS_MINIMIZEBOX) {
+        rcButton.right = rcButton.left + GetMainWinMetrics (MWM_SB_WIDTH);
+        if (PtInRect (&rcButton, x, y))
+            return HT_MINBUTTON;
+    }
+
+    if (PtInRect (&rcCaption, x, y))
+        return HT_CAPTION;
+
+    if (pWin->WinType == TYPE_MAINWIN && pWin->hMenu) {
+        rcMenuBar.left = rcCaption.left;
+        rcMenuBar.top = rcCaption.bottom + 1;
+        rcMenuBar.right = rcCaption.right;
+        rcMenuBar.bottom = rcMenuBar.top + GetMainWinMetrics (MWM_MENUBARY);
+        rcMenuBar.bottom += GetMainWinMetrics (MWM_MENUBAROFFY)<<1;
+                
+        if (PtInRect (&rcMenuBar, x, y))
+            return HT_MENUBAR;
+    }
+
+    return HT_UNKNOWN;
+}
+
+static int DefaultPostMsgHandler(PMAINWIN pWin, int message,
+                           WPARAM wParam, LPARAM lParam)
+{
+    switch (message)
+    {
+        case MSG_SETCURSOR:
+//
+// NOTE:
+// this message is only implemented for main window.
+// for CONTROL, must handle this message and should NOT 
+// call default window procedure
+// when handle MSG_SETCURSOR.
+//
+            if (wndMouseInWhichControl (pWin, LOWORD(lParam), HIWORD(lParam), 
+                    NULL))
+                break;
+
+            if (pWin->hCursor)
+                SetCursor(pWin->hCursor);
+        break;
+
+        case MSG_NCSETCURSOR:
+//
+// NOTE:
+// this message is only implemented for main window.
+// for CONTROL, must handle this message and should NOT 
+// call default window procedure
+// when handle MSG_SETCURSOR.
+//
+            SetCursor (GetSystemCursor (IDC_ARROW));
+        break;
+        
+        case MSG_HITTEST:
+            if( PtInRect((PRECT)(&(pWin->cl)), (int)wParam, (int)lParam) )
+                return HT_CLIENT;
+            else
+                return HittestOnNClient (pWin, 
+                            (int)wParam, (int)lParam);
+        break;
+
+        case MSG_CHANGESIZE:
+            OnChangeSize(pWin, (PRECT)wParam, (PRECT)lParam);
+        break;
+
+        case MSG_SIZECHANGING:
+            memcpy ((PRECT)lParam, (PRECT)wParam, sizeof (RECT));
+        break;
+        
+        case MSG_QUERYNCRECT:
+            OnQueryNCRect(pWin, (PRECT)lParam);
+        break;
+
+        case MSG_QUERYCLIENTAREA:
+            OnQueryClientArea(pWin, (PRECT)lParam);
+        break;
+
+        case MSG_SETFOCUS:
+        case MSG_KILLFOCUS:
+            if (pWin->WinType == TYPE_MAINWIN) {
+                if (pWin->hActiveChild)
+                    SendMessage (pWin->hActiveChild, message, 0, 0);
+            }
+        break;
+        
+        case MSG_MOUSEACTIVE:
+            if (pWin->WinType == TYPE_CONTROL 
+                && !(pWin->dwStyle & WS_DISABLED)) {
+
+                PCONTROL pCtrl = (PCONTROL)pWin;
+               
+                if (pCtrl->pMainWin->hActiveChild != (HWND)pWin) {
+                    if (pCtrl->pMainWin->hActiveChild) {
+                        SendMessage (pCtrl->pMainWin->hActiveChild,
+                                    MSG_ACTIVE, FALSE, 0);
+                        SendMessage (pCtrl->pMainWin->hActiveChild,
+                                    MSG_KILLFOCUS, 0, 0);
+                    }
+
+                    pCtrl->pMainWin->hActiveChild = (HWND)pWin;
+
+                    SendMessage ((HWND)pWin, MSG_ACTIVE, TRUE, 0);
+                    SendMessage ((HWND)pWin, MSG_SETFOCUS, 0, 0);
+                }
+            }
+        break;
+        
+        case MSG_ACTIVEMENU:
+        break;
+
+        case MSG_VSCROLL:
+        case MSG_HSCROLL:
+        break;
+    }
+
+    return 0;
+}
+
+static void wndDrawNCArea(const MAINWIN* pWin, HDC hdc)
+{
+    // Draw window frame
+    if (pWin->dwStyle & WS_BORDER)
+    {
+        if (pWin->dwStyle & WS_CHILD)
+            Draw3DDownFrame(hdc, 
+                   0, 0, 
+                   pWin->right - pWin->left - 1, 
+                   pWin->bottom - pWin->top - 1, 
+                   COLOR_invalid);
+        else
+            Draw3DUpFrame(hdc, 
+                   0, 0, 
+                   pWin->right - pWin->left, 
+                   pWin->bottom - pWin->top, 
+                   COLOR_invalid);
+    }
+    else if ((pWin->dwStyle & WS_THICKFRAME) ||
+            (pWin->dwStyle & WS_THINFRAME))
+    {
+       SetPenColor(hdc, COLOR_black);
+       Rectangle(hdc, 0, 0, 
+                      pWin->right - pWin->left - 1, 
+                      pWin->bottom - pWin->top - 1);
+    }
+
+}
+
+static void
+wndDrawScrollBar (HWND hwnd, HDC hdc)
+{
+    int iBorder = 0, start = 0;
+    RECT rcHBar, rcVBar;
+    PBITMAP bmp;
+    
+    if (hwnd->dwStyle & WS_BORDER) 
+        iBorder = GetMainWinMetrics (MWM_BORDER);
+    else if (hwnd->dwStyle & WS_THICKFRAME)
+        iBorder = GetMainWinMetrics (MWM_THICKFRAME);
+    else if (hwnd->dwStyle & WS_THINFRAME)
+        iBorder = GetMainWinMetrics (MWM_THINFRAME);
+   
+    wndGetVScrollBarRect (hwnd, &rcVBar);
+    rcVBar.left -= hwnd->left;
+    rcVBar.top  -= hwnd->top;
+    rcVBar.right -= hwnd->left;
+    rcVBar.bottom -= hwnd->top;
+    wndGetHScrollBarRect (hwnd, &rcHBar);
+    rcHBar.left -= hwnd->left;
+    rcHBar.top  -= hwnd->top;
+    rcHBar.right -= hwnd->left;
+    rcHBar.bottom -= hwnd->top;
+
+    SetBrushColor (hdc, COLOR_lightgray);
+    if (hwnd->dwStyle & WS_HSCROLL && !(hwnd->hscroll.status & SBS_HIDE)) {
+        FillBox (hdc, rcHBar.left, rcHBar.top,
+                  rcHBar.right - rcHBar.left + mwSYSMETRICS_CXVSCROLL,
+                  rcHBar.bottom - rcHBar.top);
+
+        // draw left and right buttons.
+        if (hwnd->hscroll.status & SBS_DISABLED)
+            bmp = GetSystemBitmap (SYSBMP_ARROWLEFTD);
+        else
+            bmp = GetSystemBitmap (SYSBMP_ARROWLEFT);
+        
+        FillBoxWithBitmap (hdc, rcHBar.left, rcHBar.top, 
+		mwSYSMETRICS_CXHSCROLL, mwSYSMETRICS_CYHSCROLL, bmp);
+
+        if (hwnd->hscroll.status & SBS_DISABLED)
+            bmp = GetSystemBitmap (SYSBMP_ARROWRIGHTD);
+        else
+            bmp = GetSystemBitmap (SYSBMP_ARROWRIGHT);
+        
+        FillBoxWithBitmap (hdc, rcHBar.right - mwSYSMETRICS_CXHSCROLL,
+		rcHBar.top, mwSYSMETRICS_CXHSCROLL, mwSYSMETRICS_CYHSCROLL,
+		bmp);
+                                
+        // draw moving bar.
+        start = rcHBar.left + mwSYSMETRICS_CXHSCROLL + hwnd->hscroll.barStart;
+
+        if (start + hwnd->hscroll.barLen > rcHBar.right)
+            start = rcHBar.right - hwnd->hscroll.barLen;
+
+        Draw3DUpFrame (hdc, start, rcHBar.top, start + hwnd->hscroll.barLen,
+	    rcHBar.bottom, COLOR_invalid);
+    }
+
+    if (hwnd->dwStyle & WS_VSCROLL && !(hwnd->vscroll.status & SBS_HIDE)) {
+        
+        FillBox (hdc, rcVBar.left, rcVBar.top,
+                  rcVBar.right - rcVBar.left, rcVBar.bottom - rcVBar.top);
+
+        // draw top and bottom buttons.
+        if (hwnd->vscroll.status & SBS_DISABLED)
+            bmp = GetSystemBitmap (SYSBMP_ARROWUPD);
+        else
+            bmp = GetSystemBitmap (SYSBMP_ARROWUP);
+        
+        FillBoxWithBitmap (hdc, rcVBar.left, rcVBar.top, 
+		mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYVSCROLL, bmp);
+
+        if (hwnd->vscroll.status & SBS_DISABLED)
+            bmp = GetSystemBitmap (SYSBMP_ARROWDOWND);
+        else
+            bmp = GetSystemBitmap (SYSBMP_ARROWDOWN);
+        
+        FillBoxWithBitmap (hdc, rcVBar.left,
+		rcVBar.bottom - mwSYSMETRICS_CYVSCROLL,
+		mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYVSCROLL, bmp);
+
+        // draw moving bar
+        start = rcVBar.top + mwSYSMETRICS_CYVSCROLL + hwnd->vscroll.barStart;
+                    
+        if (start + hwnd->vscroll.barLen > rcVBar.bottom)
+            start = rcVBar.bottom - hwnd->vscroll.barLen;
+
+        Draw3DUpFrame (hdc, rcVBar.left, start, rcVBar.right,
+	    start + hwnd->vscroll.barLen,
+	    COLOR_invalid);
+
+    }
+}
+
+// this function is CONTROL safe.
+static void wndDrawCaption(const MAINWIN* pWin, HDC hdc, BOOL bFocus)
+{
+    int i;
+    RECT rc;
+    int iBorder = 0;
+    int iCaption = 0;
+    int iIconX = 0;
+    int iIconY = 0;
+    int x, y, w, h;
+    PBITMAP bmp;
+
+    if( pWin->dwStyle & WS_BORDER ) 
+        iBorder = GetMainWinMetrics(MWM_BORDER);
+    else if( pWin->dwStyle & WS_THICKFRAME ) {
+        iBorder = GetMainWinMetrics(MWM_THICKFRAME);
+        
+        SetPenColor(hdc, bFocus?COLOR_blue:COLOR_black);
+        for (i=1; i<iBorder; i++)
+            Rectangle(hdc, i, i, 
+                      pWin->right - pWin->left - i - 1, 
+                      pWin->bottom - pWin->top - i - 1);
+
+        return;
+    }
+    else if (pWin->dwStyle & WS_THINFRAME)
+        return; // thin frame.
+
+    if (!(pWin->dwStyle & WS_CAPTION))
+        return;
+
+    if( pWin->hIcon )
+    {
+        iIconX = GetMainWinMetrics(MWM_ICONX);
+        iIconY = GetMainWinMetrics(MWM_ICONY);
+    }
+
+    iCaption = GetMainWinMetrics(MWM_CAPTIONY);
+
+    // draw Caption
+    rc.left = iBorder;
+    rc.top = iBorder;
+    rc.right = pWin->right - pWin->left - iBorder;
+    rc.bottom = iBorder + iCaption;
+    ClipRectIntersect (hdc, &rc);
+                    
+    SetBrushColor(hdc, bFocus ? COLOR_darkblue : COLOR_darkgray);
+    FillBox(hdc,
+               iBorder, iBorder,
+               pWin->right - pWin->left - iBorder, 
+               iCaption);
+    if (pWin->hIcon)
+        DrawIcon(hdc, iBorder, iBorder,
+               iIconX, iIconY,
+               pWin->hIcon);
+
+    SetTextColor(hdc, bFocus ? COLOR_lightwhite : COLOR_lightgray);
+    SetBkColor(hdc, bFocus ? COLOR_darkblue : COLOR_darkgray);
+    TextOut(hdc, 
+                iBorder + iIconX + 2, iBorder*2,
+                pWin->spCaption);
+
+    // draw system button
+    w = GetMainWinMetrics (MWM_SB_WIDTH);
+    x = rc.right - w;
+    y = GetMainWinMetrics (MWM_SB_HEIGHT);
+    if (y < iCaption) {
+        y = iBorder + ((iCaption - y)>>1);
+        h = GetMainWinMetrics (MWM_SB_HEIGHT);
+    }
+    else {
+        y = iBorder;
+        h = iIconY;
+    }
+
+    // close bitmap    
+    bmp = GetSystemBitmap (SYSBMP_CLOSE);
+    FillBoxWithBitmap (hdc, x, y, w, h, bmp);
+    x -= GetMainWinMetrics (MWM_SB_WIDTH);
+    x -= GetMainWinMetrics (MWM_SB_INTERX)<<1;
+
+    if (pWin->dwStyle & WS_MAXIMIZEBOX) {
+        // restore/maximize bitmap
+        if (pWin->dwStyle & WS_MAXIMIZE)
+            bmp = GetSystemBitmap (SYSBMP_RESTORE);
+        else
+            bmp = GetSystemBitmap (SYSBMP_MAXIMIZE);
+        FillBoxWithBitmap (hdc, x, y, w, h, bmp);
+        x -= GetMainWinMetrics (MWM_SB_WIDTH);
+        x -= GetMainWinMetrics (MWM_SB_INTERX);
+    }
+
+    if (pWin->dwStyle & WS_MINIMIZEBOX) {
+        // minimize bitmap
+        bmp = GetSystemBitmap (SYSBMP_MINIMIZE);
+        FillBoxWithBitmap (hdc, x, y, w, h, bmp);
+    }
+}
+
+static void wndDrawNCFrame(MAINWIN* pWin, HDC hdc, const RECT* prcInvalid)
+{
+    BOOL fGetDC = FALSE;
+    
+    if (hdc == 0) {
+        hdc = GetDC ((HWND)pWin);
+        fGetDC = TRUE;
+    }
+        
+    if (prcInvalid)
+        ClipRectIntersect (hdc, prcInvalid);
+
+    wndDrawNCArea (pWin, hdc);
+
+    wndDrawScrollBar (pWin, hdc);
+
+    if (pWin->WinType == TYPE_MAINWIN) {
+        wndDrawCaption (pWin, hdc, !(pWin->dwStyle & WS_DISABLED) 
+            && (GetActiveWindow() == (HWND)pWin));
+        DrawMenuBarHelper (pWin, hdc, prcInvalid);
+    }
+    else {
+        wndDrawCaption (pWin, hdc, !(pWin->dwStyle & WS_DISABLED) && 
+                ((PCONTROL)pWin)->pMainWin->hActiveChild == (HWND)pWin);
+    }
+
+    if (fGetDC)
+        ReleaseDC (hdc);
+}
+
+// this function is CONTROL safe.
+static void wndActiveMainWindow (PMAINWIN pWin, BOOL fActive)
+{
+    HDC hdc;
+
+    hdc = GetDC ((HWND)pWin);
+
+    wndDrawCaption (pWin, hdc, fActive);
+        
+    ReleaseDC (hdc);
+}
+
+static int DefaultPaintMsgHandler(PMAINWIN pWin, int message,
+                           WPARAM wParam, LPARAM lParam)
+{
+    switch( message )
+    {
+        case MSG_SHOWWINDOW:
+            OnShowWindow (pWin, (int)wParam);
+        break;
+        
+        case MSG_NCPAINT:
+            wndDrawNCFrame (pWin, (HDC)wParam, (const RECT*)lParam);
+        break;
+
+        case MSG_ERASEBKGND:
+            wndEraseBackground (pWin, (HDC)wParam, (const RECT*)lParam);
+        break;
+
+        case MSG_NCACTIVATE:
+            wndActiveMainWindow (pWin, (BOOL)wParam);
+        break;
+
+        case MSG_SYNCPAINT:
+            wndActiveMainWindow (pWin, (BOOL)wParam);
+            PostMessage ((HWND)pWin, MSG_NCPAINT, 0, 0);
+            PostMessage ((HWND)pWin, MSG_ERASEBKGND, 0, 0);
+        break;
+
+        case MSG_PAINT:
+        {
+            PINVRGN pInvRgn;
+
+            pInvRgn = &pWin->InvRgn;
+
+#ifdef USETRYLOCK
+            while (pthread_mutex_trylock (&pInvRgn->lock) == EBUSY);
+#else
+            pthread_mutex_lock (&pInvRgn->lock);
+#endif
+            EmptyClipRgn (&pInvRgn->rgn);
+            pthread_mutex_unlock (&pInvRgn->lock);
+        }
+
+        break;
+
+    }
+
+    return 0;
+}
+
+static int DefaultControlMsgHandler(PMAINWIN pWin, int message,
+                           WPARAM wParam, LPARAM lParam)
+{
+    HDC hdc;
+
+    switch( message )
+    {
+        case MSG_ENABLE:
+            if ( (!(pWin->dwStyle & WS_DISABLED) && !wParam)
+                    || ((pWin->dwStyle & WS_DISABLED) && wParam) ) {
+                if (wParam)
+                    pWin->dwStyle &= ~WS_DISABLED;
+                else
+                    pWin->dwStyle |=  WS_DISABLED;
+            }
+        break;
+        
+        case MSG_SYSCOMMAND:
+            if (wParam == SC_CLOSE)
+                SendNotifyMessage ((HWND)pWin, MSG_CLOSE, 0, 0);
+        break;
+
+        case MSG_GETTEXTLENGTH:
+            if (pWin->spCaption)
+                return strlen (pWin->spCaption);
+            else
+                return 0;
+
+        case MSG_GETTEXT:
+            if (pWin->spCaption) {
+                int len;
+                char* buffer = (char*)lParam;
+
+                len = min (strlen (pWin->spCaption), wParam);
+                memcpy (buffer, pWin->spCaption, len);
+                buffer [len] = '\0';
+                return len;
+            }
+            else
+                return 0;
+        break;
+
+        case MSG_SETTEXT:
+//
+// NOTE:
+// this message is only implemented for main window.
+// for CONTROL, must handle this message and should NOT 
+// call default window procedure
+// when handle MSG_SETTEXT.
+//
+            if (pWin->WinType == TYPE_CONTROL)
+                return 0;
+
+            FreeFixStr (pWin->spCaption);
+            pWin->spCaption = FixStrAlloc (strlen ((char*)lParam));
+            strcpy (pWin->spCaption, (char*)lParam);
+
+            hdc = GetDC ((HWND)pWin);
+            wndDrawCaption(pWin, hdc, GetForegroundWindow () == (HWND)pWin);
+            ReleaseDC (hdc);
+        break;
+    }
+
+    return 0;
+}
+
+// NOTE:
+// This default main window call-back procedure
+// also implemented for control.
+int DefaultMainWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
+{
+    PMAINWIN pWin = (PMAINWIN)hWnd;
+
+    if( message >= MSG_FIRSTMOUSEMSG && message <= MSG_NCMOUSEOFF)
+        return DefaultMouseMsgHandler(pWin, message, 
+            wParam, LOWORD (lParam), HIWORD (lParam));
+    else if( message > MSG_NCMOUSEOFF && message <= MSG_LASTMOUSEMSG)
+        return DefaultNCMouseMsgHandler(pWin, message, 
+            (int)wParam, LOWORD (lParam), HIWORD (lParam));
+    else if( message >= MSG_FIRSTKEYMSG && message <= MSG_LASTKEYMSG)
+        return DefaultKeyMsgHandler(pWin, message, wParam, lParam);
+    else if( message >= MSG_FIRSTPOSTMSG && message <= MSG_LASTPOSTMSG)
+        return DefaultPostMsgHandler(pWin, message, wParam, lParam);
+    else if( message >= MSG_FIRSTCREATEMSG && message <= MSG_LASTCREATEMSG) 
+        return DefaultCreateMsgHandler(pWin, message, wParam, lParam);
+    else if( message >= MSG_FIRSTPAINTMSG && message <= MSG_LASTPAINTMSG) 
+        return DefaultPaintMsgHandler(pWin, message, wParam, lParam);
+    else if( message >= MSG_FIRSTSESSIONMSG && message <= MSG_LASTSESSIONMSG) 
+        return DefaultSessionMsgHandler(pWin, message, wParam, lParam);
+    else if( message >= MSG_FIRSTCONTROLMSG && message <= MSG_LASTCONTROLMSG) 
+        return DefaultControlMsgHandler(pWin, message, wParam, lParam);
+    else if( message >= MSG_FIRSTSYSTEMMSG && message <= MSG_LASTSYSTEMMSG) 
+        return DefaultSystemMsgHandler(pWin, message, wParam, lParam);
+
+    return 0;
+}
+
+int WinMainMetrics[MWM_ITEM_NUMBER];
+
+void InitMainWinMetrics()
+{
+    WinMainMetrics[MWM_MINWIDTH] = 50;
+    WinMainMetrics[MWM_MINHEIGHT] = 50;
+    WinMainMetrics[MWM_BORDER] = 2;
+    WinMainMetrics[MWM_THICKFRAME] = 2;
+    WinMainMetrics[MWM_THINFRAME] = 1;
+    WinMainMetrics[MWM_CAPTIONY] = GetCharHeight() + 4;
+    WinMainMetrics[MWM_ICONX] = 16;
+    WinMainMetrics[MWM_ICONY] = 16;
+    WinMainMetrics[MWM_MENUBARY] = GetCharHeight();
+    WinMainMetrics[MWM_MENUBAROFFX] = 8;
+    WinMainMetrics[MWM_MENUBAROFFY] = 5;
+    WinMainMetrics[MWM_MENUITEMY] = GetCharHeight();
+    WinMainMetrics[MWM_INTERMENUITEMX] = GetCCharWidth();
+    WinMainMetrics[MWM_INTERMENUITEMY] = 2;
+    WinMainMetrics[MWM_MENUITEMOFFX] = 18;
+    WinMainMetrics[MWM_MENUTOPMARGIN] = 4;
+    WinMainMetrics[MWM_MENUBOTTOMMARGIN] = 4;
+    WinMainMetrics[MWM_MENULEFTMARGIN] = 4;
+    WinMainMetrics[MWM_MENURIGHTMARGIN] = 4;
+    WinMainMetrics[MWM_MENUITEMMINX] = 64;
+    WinMainMetrics[MWM_MENUSEPARATORY] = 4;
+    WinMainMetrics[MWM_MENUSEPARATORX] = 4;
+    WinMainMetrics[MWM_SB_WIDTH] = 16;
+    WinMainMetrics[MWM_SB_HEIGHT] = 14;
+    WinMainMetrics[MWM_SB_INTERX] = 2;
+    WinMainMetrics[MWM_CXVSCROLL] = 18;
+    WinMainMetrics[MWM_CYVSCROLL] = 18;
+    WinMainMetrics[MWM_CXHSCROLL] = 18;
+    WinMainMetrics[MWM_CYHSCROLL] = 18;
+    WinMainMetrics[MWM_MINBARLEN] = 8;
+    WinMainMetrics[MWM_DEFBARLEN] = 18;
+
+}
+
+static PSCROLLBARINFO wndGetScrollBar (MAINWIN* pWin, int iSBar)
+{
+    if (iSBar == SB_HORZ) {
+        if (pWin->dwStyle & WS_HSCROLL)
+            return &pWin->hscroll;
+    }
+    else if (iSBar == SB_VERT) {
+        if (pWin->dwStyle & WS_VSCROLL)
+            return &pWin->vscroll;
+    }
+
+    return NULL;
+}
+
+BOOL GUIAPI EnableScrollBar (HWND hWnd, int iSBar, BOOL bEnable)
+{
+    PSCROLLBARINFO pSBar;
+    PMAINWIN pWin;
+    BOOL bPrevState;
+    RECT rcBar;
+    
+    pWin = (PMAINWIN)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    bPrevState = !(pSBar->status & SBS_DISABLED);
+
+    if (bEnable && !bPrevState)
+        pSBar->status &= ~SBS_DISABLED;
+    else if (!bEnable && bPrevState)
+        pSBar->status |= SBS_DISABLED;
+    else
+        return FALSE;
+
+    if (iSBar == SB_VERT)
+        wndGetVScrollBarRect (pWin, &rcBar);
+    else
+        wndGetHScrollBarRect (pWin, &rcBar);
+        
+    rcBar.left -= pWin->left;
+    rcBar.top  -= pWin->top;
+    rcBar.right -= pWin->left;
+    rcBar.bottom -= pWin->top;
+
+    SendAsyncMessage (hWnd, MSG_NCPAINT, 0, (LPARAM)(&rcBar));
+
+    return TRUE;
+}
+
+BOOL GUIAPI GetScrollPos (HWND hWnd, int iSBar, int* pPos)
+{
+    PSCROLLBARINFO pSBar;
+    PMAINWIN pWin;
+    
+    pWin = (PMAINWIN)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    *pPos = pSBar->curPos;
+    return TRUE;
+}
+
+BOOL GUIAPI GetScrollRange (HWND hWnd, int iSBar, int* pMinPos, int* pMaxPos)
+{
+    PSCROLLBARINFO pSBar;
+    PMAINWIN pWin;
+    
+    pWin = (PMAINWIN)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    *pMinPos = pSBar->minPos;
+    *pMaxPos = pSBar->maxPos;
+    return TRUE;
+}
+
+BOOL GUIAPI SetScrollPos (HWND hWnd, int iSBar, int iNewPos)
+{
+    PSCROLLBARINFO pSBar;
+    PMAINWIN pWin;
+    RECT rcBar;
+    
+    pWin = (PMAINWIN)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    if (iNewPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+    else
+        pSBar->curPos = iNewPos;
+
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+    
+    if (iSBar == SB_VERT)
+        wndGetVScrollBarRect (pWin, &rcBar);
+    else
+        wndGetHScrollBarRect (pWin, &rcBar);
+
+    rcBar.left -= pWin->left;
+    rcBar.top  -= pWin->top;
+    rcBar.right -= pWin->left;
+    rcBar.bottom -= pWin->top;
+
+    wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar);
+
+    if (iSBar == SB_VERT) {
+        rcBar.top += GetMainWinMetrics (MWM_CYVSCROLL);
+        rcBar.bottom -= GetMainWinMetrics (MWM_CYVSCROLL);
+    }
+    else {
+        rcBar.left += GetMainWinMetrics (MWM_CXHSCROLL);
+        rcBar.right -= GetMainWinMetrics (MWM_CXHSCROLL);
+    }
+
+    SendAsyncMessage (hWnd, MSG_NCPAINT, 0, (LPARAM)(&rcBar));
+
+    return TRUE;
+}
+
+BOOL GUIAPI SetScrollRange (HWND hWnd, int iSBar, int iMinPos, int iMaxPos)
+{
+    PSCROLLBARINFO pSBar;
+    PMAINWIN pWin;
+    RECT rcBar;
+    
+    pWin = (PMAINWIN)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    pSBar->minPos = (iMinPos < iMaxPos)?iMinPos:iMaxPos;
+    pSBar->maxPos = (iMinPos > iMaxPos)?iMinPos:iMaxPos;
+    
+    // validate parameters.
+    if (pSBar->curPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+
+    if (pSBar->pageStep <= 0)
+        pSBar->pageStep = 0;
+    else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1))
+        pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1;
+    
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+
+    if (iSBar == SB_VERT)
+        wndGetVScrollBarRect (pWin, &rcBar);
+    else
+        wndGetHScrollBarRect (pWin, &rcBar);
+
+    rcBar.left -= pWin->left;
+    rcBar.top  -= pWin->top;
+    rcBar.right -= pWin->left;
+    rcBar.bottom -= pWin->top;
+
+    wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar);
+
+    if (iSBar == SB_VERT) {
+        rcBar.top += GetMainWinMetrics (MWM_CYVSCROLL);
+        rcBar.bottom -= GetMainWinMetrics (MWM_CYVSCROLL);
+    }
+    else {
+        rcBar.left += GetMainWinMetrics (MWM_CXHSCROLL);
+        rcBar.right -= GetMainWinMetrics (MWM_CXHSCROLL);
+    }
+
+    SendAsyncMessage (hWnd, MSG_NCPAINT, 0, (LPARAM)(&rcBar));
+
+    return TRUE;
+}
+
+BOOL GUIAPI SetScrollInfo (HWND hWnd, int iSBar, 
+                LPCSCROLLINFO lpsi, BOOL fRedraw)
+{
+    PSCROLLBARINFO pSBar;
+    PMAINWIN pWin;
+    RECT rcBar;
+    
+    pWin = (PMAINWIN)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+        
+    if( lpsi->fMask & SIF_RANGE )
+    {
+        pSBar->minPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMin:lpsi->nMax;
+        pSBar->maxPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMax:lpsi->nMin;
+    }
+    
+    if( lpsi->fMask & SIF_POS )
+        pSBar->curPos = lpsi->nPos;
+    
+    if( lpsi->fMask & SIF_PAGE )
+        pSBar->pageStep = lpsi->nPage;
+
+    // validate parameters.
+    if (pSBar->curPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+
+    if (pSBar->pageStep <= 0)
+        pSBar->pageStep = 0;
+    else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1))
+        pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1;
+    
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+
+    if(fRedraw)
+    {
+        if (iSBar == SB_VERT)
+            wndGetVScrollBarRect (pWin, &rcBar);
+        else
+            wndGetHScrollBarRect (pWin, &rcBar);
+        
+        rcBar.left -= pWin->left;
+        rcBar.top  -= pWin->top;
+        rcBar.right -= pWin->left;
+        rcBar.bottom -= pWin->top;
+    
+        wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar);
+
+        if (iSBar == SB_VERT) {
+            rcBar.top += GetMainWinMetrics (MWM_CYVSCROLL);
+            rcBar.bottom -= GetMainWinMetrics (MWM_CYVSCROLL);
+        }
+        else {
+            rcBar.left += GetMainWinMetrics (MWM_CXHSCROLL);
+            rcBar.right -= GetMainWinMetrics (MWM_CXHSCROLL);
+        }
+
+        SendAsyncMessage (hWnd, MSG_NCPAINT, 0, (LPARAM)(&rcBar));
+    }
+    
+    return TRUE;
+}
+
+BOOL GUIAPI GetScrollInfo(HWND hWnd, int iSBar, LPSCROLLINFO lpsi)
+{
+    PSCROLLBARINFO pSBar;
+    PMAINWIN pWin;
+    
+    pWin = (PMAINWIN)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+        
+    if( lpsi->fMask & SIF_RANGE )
+    {
+        lpsi->nMin = pSBar->minPos;
+        lpsi->nMax = pSBar->maxPos;
+    }
+    
+    if( lpsi->fMask & SIF_POS )
+    {
+        lpsi->nPos = pSBar->curPos;
+    }
+    
+    if( lpsi->fMask & SIF_PAGE )
+        lpsi->nPage = pSBar->pageStep;
+    
+    return TRUE;
+}
+
+BOOL GUIAPI ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow)
+{
+    PSCROLLBARINFO pSBar;
+    PMAINWIN pWin;
+    BOOL bPrevState;
+    RECT rcBar;
+    
+    pWin = (PMAINWIN)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    bPrevState = !(pSBar->status & SBS_HIDE);
+
+    if (bShow && !bPrevState)
+        pSBar->status &= ~SBS_HIDE;
+    else if (!bShow && bPrevState)
+        pSBar->status |= SBS_HIDE;
+    else
+        return FALSE;
+
+    SendAsyncMessage (hWnd, MSG_CHANGESIZE, 0, 0);
+
+    if (iSBar == SB_VERT)
+        wndGetVScrollBarRect (pWin, &rcBar);
+    else
+        wndGetHScrollBarRect (pWin, &rcBar);
+
+    {
+        RECT rcWin, rcClient;
+        
+        memcpy (&rcWin, &pWin->left, sizeof (RECT));
+        
+        rcClient.left = 0;
+        rcClient.top  = 0;
+        rcClient.right = pWin->cr - pWin->cl;
+        rcClient.bottom = pWin->cb - pWin->ct;
+
+        SendAsyncMessage (hWnd, MSG_SIZECHANGED, 
+            (WPARAM)&rcWin, (LPARAM)&rcClient);
+    }
+    
+    if (bShow) {
+        SendAsyncMessage (hWnd, MSG_NCPAINT, 0, 0);
+    }
+    else {
+        rcBar.left -= pWin->cl;
+        rcBar.top  -= pWin->ct;
+        rcBar.right -= pWin->cl;
+        rcBar.bottom -= pWin->ct;
+        SendAsyncMessage (hWnd, MSG_NCPAINT, 0, 0);
+        InvalidateRect (hWnd, &rcBar, TRUE);
+    }
+
+    return TRUE;
+}
+
+HWND GUIAPI CreateMainWindow(PMAINWINCREATE pCreateInfo)
+{
+    PMAINWIN pWin;
+    PZORDERNODE pZOrderNode = NULL;
+
+    if( !(pWin = malloc(sizeof(MAINWIN))) ) return HWND_INVALID;
+
+    if (pCreateInfo->hHosting == HWND_DESKTOP) {
+        // Create message queue for this new main window.
+        if( !(pWin->pMessages = malloc(sizeof(MSGQUEUE))) ) {
+            free(pWin);
+            return HWND_INVALID;
+        }
+        
+        // Init message queue.
+        if (!InitMsgQueue(pWin->pMessages, 0))
+            goto err;
+    }
+    else
+        pWin->pMessages = GetMsgQueue (pCreateInfo->hHosting);
+
+    pWin->pMainWin      = NULL;
+    pWin->pFirstHosted  = NULL;
+    pWin->pHosting      = (PMAINWIN) pCreateInfo->hHosting;
+    pWin->pNextHosted   = NULL;
+        
+    pWin->DataType      = TYPE_HWND;
+    pWin->WinType       = TYPE_MAINWIN;
+
+    pWin->th            = pthread_self();
+
+    pWin->hFirstChild   = 0;
+    pWin->hActiveChild  = 0;
+
+    pWin->dwStyle       = (pCreateInfo->dwStyle);
+    pWin->dwExStyle     = (pCreateInfo->dwExStyle);
+
+    pWin->hMenu         = pCreateInfo->hMenu;
+    pWin->hCursor       = pCreateInfo->hCursor;
+    pWin->hIcon         = pCreateInfo->hIcon;
+    if ((pWin->dwStyle & WS_CAPTION) && (pWin->dwStyle & WS_SYSMENU))
+        pWin->hSysMenu= CreateSystemMenu ((HWND)pWin, pWin->dwStyle);
+    else
+        pWin->hSysMenu = 0;
+
+    pWin->spCaption    = FixStrAlloc (strlen (pCreateInfo->spCaption));
+    strcpy (pWin->spCaption, pCreateInfo->spCaption);
+
+    pWin->MainWindowProc = pCreateInfo->MainWindowProc;
+    pWin->iBkColor    = pCreateInfo->iBkColor;
+
+    pWin->pCaretInfo = NULL;
+
+    pWin->dwAddData = pCreateInfo->dwAddData;
+
+    pWin->TimerMask = 0xFF;
+
+    if ( !( pZOrderNode = malloc (sizeof(ZORDERNODE))) )
+        goto err;
+
+    pWin->pZOrderNode = pZOrderNode;
+
+    // Scroll bar
+    if (pWin->dwStyle && WS_VSCROLL) {
+        pWin->vscroll.minPos = 0;
+        pWin->vscroll.maxPos = 100;
+        pWin->vscroll.curPos = 0;
+        pWin->vscroll.pageStep = 0;
+        pWin->vscroll.barStart = 0;
+        pWin->vscroll.barLen = 10;
+        pWin->vscroll.status = SBS_NORMAL;
+    }
+    else
+        pWin->vscroll.status = SBS_HIDE | SBS_DISABLED;
+        
+    if (pWin->dwStyle && WS_HSCROLL) {
+        pWin->hscroll.minPos = 0;
+        pWin->hscroll.maxPos = 100;
+        pWin->hscroll.curPos = 0;
+        pWin->hscroll.pageStep = 0;
+        pWin->hscroll.barStart = 0;
+        pWin->hscroll.barLen = 10;
+        pWin->hscroll.status = SBS_NORMAL;
+    }
+    else
+        pWin->hscroll.status = SBS_HIDE | SBS_DISABLED;
+
+    if (SendMessage ((HWND)pWin, MSG_NCCREATE, 0, (LPARAM)pCreateInfo))
+        goto err;
+
+    SendMessage ((HWND)pWin, MSG_CHANGESIZE, (WPARAM)&pCreateInfo->lx, 0);
+
+    if (SendMessage ((HWND)pWin, MSG_CREATE, 0, (LPARAM)pCreateInfo))
+        goto err;
+
+    {
+        RECT rcWin, rcClient;
+        
+        memcpy (&rcWin, &pWin->left, sizeof (RECT));
+        
+        rcClient.left = 0;
+        rcClient.top  = 0;
+        rcClient.right = pWin->cr - pWin->cl;
+        rcClient.bottom = pWin->cb - pWin->ct;
+
+        SendAsyncMessage ((HWND)pWin, MSG_SIZECHANGED, 
+            (WPARAM)&rcWin, (LPARAM)&rcClient);
+    }
+   
+    SendMessage (HWND_DESKTOP, MSG_ADDNEWMAINWIN,
+                                (WPARAM) pWin, (LPARAM) pZOrderNode);
+
+    // Create private cient dc.
+    if (pWin->dwExStyle & WS_EX_USEPRIVATECDC)
+        pWin->privCDC = CreatePrivateClientDC ((HWND)pWin);
+    else
+        pWin->privCDC = 0;
+
+    return (HWND)pWin;
+
+err:
+    if (pWin->pMessages) {
+        DestroyMsgQueue (pWin->pMessages);
+        free (pWin->pMessages);
+    }
+    if (pZOrderNode) free (pZOrderNode);
+    free (pWin);
+
+    return HWND_INVALID;
+}
+
+// this function show window in behavious by specified iCmdShow.
+// if the window was previously visible, the return value is nonzero.
+// if the window was previously hiddedn, the return value is zero.
+//
+BOOL GUIAPI ShowWindow(HWND hWnd, int iCmdShow)
+{
+    if (IsMainWindow (hWnd)) {
+        switch (iCmdShow)
+        {
+            case SW_SHOWNORMAL:
+                SendMessage (HWND_DESKTOP, 
+                    MSG_MOVETOTOPMOST, (WPARAM)hWnd, 0);
+            break;
+            
+            case SW_SHOW:
+                SendMessage (HWND_DESKTOP, 
+                    MSG_SHOWMAINWIN, (WPARAM)hWnd, 0);
+            break;
+
+            case SW_HIDE:
+                SendMessage (HWND_DESKTOP, 
+                    MSG_HIDEMAINWIN, (WPARAM)hWnd, 0);
+            break;
+        }
+    }
+    else {
+        PCONTROL pControl;
+
+        pControl = (PCONTROL)hWnd;
+        
+        switch (iCmdShow)
+        {
+            case SW_SHOWNORMAL:
+                SendAsyncMessage (hWnd, MSG_NCPAINT, 0, 0);
+                InvalidateRect (hWnd, NULL, TRUE);
+            break;
+
+            case SW_SHOW:
+                if (!(pControl->dwStyle & WS_VISIBLE)) {
+                
+                    pControl->dwStyle |= WS_VISIBLE;
+
+                    SendAsyncMessage (hWnd, MSG_NCPAINT, 0, 0);
+                    InvalidateRect (hWnd, NULL, TRUE);
+                }
+            break;
+            
+            case SW_HIDE:
+                if (pControl->dwStyle & WS_VISIBLE) {
+                
+                    pControl->dwStyle &= ~WS_VISIBLE;
+
+                    InvalidateRect ((HWND)(pControl->pMainWin), 
+                        (RECT*)(&pControl->left), TRUE);
+                }
+            break;
+        }
+    }
+    
+    SendNotifyMessage (hWnd, MSG_SHOWWINDOW, (WPARAM)iCmdShow, 0);
+    return TRUE;
+}
+
+HWND GUIAPI CreateWindow (const char* spClassName, const char* spCaption,
+                  DWORD dwStyle, int id, 
+                  int x, int y, int w, int h,
+                  HWND hParentWnd, DWORD dwAddData)
+{
+    PMAINWIN pParentWin;
+    PCTRLCLASSINFO cci;
+    PCONTROL pNewCtrl;
+
+    if (!(pParentWin = MainWindow (hParentWnd))) return HWND_INVALID;
+
+    cci = (PCTRLCLASSINFO)SendMessage (HWND_DESKTOP, 
+                MSG_GETCTRLCLASSINFO, 0, (LPARAM)spClassName);
+                
+    if (!cci) return HWND_INVALID;
+
+    pNewCtrl = malloc (sizeof (CONTROL));
+
+    if (!pNewCtrl) return HWND_INVALID;
+
+    pNewCtrl->DataType = TYPE_HWND;
+    pNewCtrl->WinType  = TYPE_CONTROL;
+
+    pNewCtrl->left     = x;
+    pNewCtrl->top      = y;
+    pNewCtrl->right    = x + w;
+    pNewCtrl->bottom   = y + h;
+
+    memcpy (&pNewCtrl->cl, &pNewCtrl->left, sizeof (RECT));
+
+    if (spCaption) {
+        int len = strlen (spCaption);
+        
+        pNewCtrl->spCaption    = FixStrAlloc (len);
+        if (len > 0)
+            strcpy (pNewCtrl->spCaption, spCaption);
+    }
+    else
+        pNewCtrl->spCaption = "";
+        
+    pNewCtrl->dwStyle  = dwStyle;
+    pNewCtrl->id       = id;
+
+    pNewCtrl->pCaretInfo = NULL;
+    
+    pNewCtrl->dwAddData = dwAddData;
+
+    // Scroll bar
+    if (pNewCtrl->dwStyle && WS_VSCROLL) {
+        pNewCtrl->vscroll.minPos = 0;
+        pNewCtrl->vscroll.maxPos = 100;
+        pNewCtrl->vscroll.curPos = 0;
+        pNewCtrl->vscroll.pageStep = 0;
+        pNewCtrl->vscroll.barStart = 0;
+        pNewCtrl->vscroll.barLen = 10;
+        pNewCtrl->vscroll.status = SBS_NORMAL;
+    }
+    else
+        pNewCtrl->vscroll.status = SBS_HIDE | SBS_DISABLED;
+
+    if (pNewCtrl->dwStyle && WS_HSCROLL) {
+        pNewCtrl->hscroll.minPos = 0;
+        pNewCtrl->hscroll.maxPos = 100;
+        pNewCtrl->hscroll.curPos = 0;
+        pNewCtrl->hscroll.pageStep = 0;
+        pNewCtrl->hscroll.barStart = 0;
+        pNewCtrl->hscroll.barLen = 10;
+        pNewCtrl->hscroll.status = SBS_NORMAL;
+    }
+    else
+        pNewCtrl->hscroll.status = SBS_HIDE | SBS_DISABLED;
+
+    pNewCtrl->children = NULL;              // always be NULL.
+    pNewCtrl->active   = NULL;              // always be NULL.
+
+    pNewCtrl->pMainWin = pParentWin;
+    pNewCtrl->next     = NULL;
+
+    pNewCtrl->pcci     = cci;
+
+    if (SendMessage ((HWND)pNewCtrl, MSG_NCCREATE, 0, (LPARAM)pNewCtrl)) {
+        free (pNewCtrl);
+        return HWND_INVALID;
+    }
+
+    SendMessage ((HWND)pNewCtrl, MSG_CHANGESIZE, 
+                    (WPARAM)(&pNewCtrl->left), 0);
+
+    if (SendMessage ((HWND)pNewCtrl, MSG_CREATE, 
+        (WPARAM)hParentWnd, (LPARAM)dwAddData)) {
+        
+        free (pNewCtrl);
+        return HWND_INVALID;
+    }
+
+    {
+        RECT rcWin, rcClient;
+        
+        memcpy (&rcWin, &pNewCtrl->left, sizeof (RECT));
+        
+        rcClient.left = 0;
+        rcClient.top  = 0;
+        rcClient.right = pNewCtrl->cr - pNewCtrl->cl;
+        rcClient.bottom = pNewCtrl->cb - pNewCtrl->ct;
+
+        SendAsyncMessage ((HWND)pNewCtrl, MSG_SIZECHANGED, 
+            (WPARAM)&rcWin, (LPARAM)&rcClient);
+    }
+
+    if (cci->dwStyle & CS_OWNDC)
+        pNewCtrl->privCDC = CreatePrivateClientDC ((HWND)pNewCtrl);
+    else
+        pNewCtrl->privCDC = 0;
+        
+    SendMessage (HWND_DESKTOP, 
+        MSG_NEWCTRLINSTANCE, (WPARAM)hParentWnd, (LPARAM)pNewCtrl);
+        
+    // reset static variables
+    DefaultMouseMsgHandler(HWND_DESKTOP, MSG_WINDOWCHANGED, 0, 0, 0);
+
+    return (HWND)pNewCtrl;
+}
+#endif
diff -urN lib/microwindows/src/mwin/winsbar.1 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winsbar.1
--- lib/microwindows/src/mwin/winsbar.1	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winsbar.1	2005-02-21 16:13:30.000000000 +0100
@@ -0,0 +1,1773 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1999, 2000, Wei Yongming.
+ *
+ * Microwindows win32 NonClient Scrollbars
+ */
+#define MWINCLUDECOLORS//jmt: for color macros
+#include "windows.h"
+#include "wintern.h"
+#include "wintools.h"
+#include <stdlib.h>
+#include <string.h>
+
+/* scrollbar status/positions*/
+#define SBS_UNKNOWN		0x0000
+#define SBS_LEFTARROW		0x0001
+#define SBS_RIGHTARROW		0x0002
+#define SBS_LEFTSPACE		0x0004
+#define SBS_RIGHTSPACE		0x0008
+#define SBS_HORZTHUMB		0x0010
+#define SBS_UPARROW		0x0020
+#define SBS_DOWNARROW		0x0040
+#define SBS_UPSPACE		0x0080
+#define SBS_DOWNSPACE		0x0100
+#define SBS_VERTTHUMB		0x0200
+#define SBS_MASK		0x03ff
+#define SBS_DISABLED		0x4000
+#define SBS_HIDE		0x8000
+
+#define HSCROLLBARVISIBLE(hwnd)	((hwnd)->style & WS_HSCROLL)
+#define VSCROLLBARVISIBLE(hwnd)	((hwnd)->style & WS_VSCROLL)
+
+//#
+
+#define SBPOS_LEFTARROW     0x81
+#define SBPOS_RIGHTARROW    0x82
+#define SBPOS_LEFTSPACE     0x83
+#define SBPOS_RIGHTSPACE    0x84
+#define SBPOS_UPARROW       0x85
+#define SBPOS_DOWNARROW     0x86
+#define SBPOS_UPSPACE       0x87
+#define SBPOS_DOWNSPACE     0x88
+#define SBPOS_THUMB         0x89
+#define SBPOS_UNKNOWN       0x80
+#define SBPOS_MASK          0x80
+
+#define WS_THINFRAME        	0x00100000L
+
+#define MWM_MINWIDTH            0
+#define MWM_MINHEIGHT           1
+#define MWM_BORDER              2
+#define MWM_THICKFRAME          3
+#define MWM_CAPTIONY            4
+#define MWM_ICONX               5
+#define MWM_ICONY               6
+#define MWM_CAPTIONOFFY         7
+#define MWM_MENUBARY            8
+#define MWM_MENUBAROFFX         9
+#define MWM_MENUBAROFFY         10
+#define MWM_MENUITEMY           11 
+#define MWM_INTERMENUITEMX      12
+#define MWM_INTERMENUITEMY      13
+#define MWM_MENUITEMOFFX        14
+#define MWM_MENUTOPMARGIN       15
+#define MWM_MENUBOTTOMMARGIN    16
+#define MWM_MENULEFTMARGIN      17
+#define MWM_MENURIGHTMARGIN     18
+#define MWM_MENUITEMMINX        19
+#define MWM_MENUSEPARATORY      20
+#define MWM_MENUSEPARATORX      21
+#define MWM_SB_HEIGHT           22
+#define MWM_SB_WIDTH            23
+#define MWM_SB_INTERX           24
+#define MWM_THINFRAME           25
+#define MWM_CXVSCROLL           26
+#define MWM_CYVSCROLL           27
+#define MWM_CXHSCROLL           28
+#define MWM_CYHSCROLL           29
+//-#define MWM_MINBARLEN           30//(index->const)8
+//-#define MWM_DEFBARLEN           31//(index->const)18
+#define MWM_ITEM_NUMBER         32
+#define GetMainWinMetrics(iItem)    (WinMainMetrics[iItem])
+int WinMainMetrics[MWM_ITEM_NUMBER];
+void InitMainWinMetrics()
+{
+    WinMainMetrics[MWM_MINWIDTH] = 50;
+    WinMainMetrics[MWM_MINHEIGHT] = 50;
+    WinMainMetrics[MWM_BORDER] = 2;
+    WinMainMetrics[MWM_THICKFRAME] = 2;
+    WinMainMetrics[MWM_THINFRAME] = 1;
+    WinMainMetrics[MWM_CAPTIONY] = 12/*GetCharHeight()*/ + 4;
+    WinMainMetrics[MWM_ICONX] = 16;
+    WinMainMetrics[MWM_ICONY] = 16;
+    WinMainMetrics[MWM_MENUBARY] = 12/*GetCharHeight()*/;
+    WinMainMetrics[MWM_MENUBAROFFX] = 8;
+    WinMainMetrics[MWM_MENUBAROFFY] = 5;
+    WinMainMetrics[MWM_MENUITEMY] = 12/*GetCharHeight()*/;
+    WinMainMetrics[MWM_INTERMENUITEMX] = 12/*GetCCharWidth()*/;
+    WinMainMetrics[MWM_INTERMENUITEMY] = 2;
+    WinMainMetrics[MWM_MENUITEMOFFX] = 18;
+    WinMainMetrics[MWM_MENUTOPMARGIN] = 4;
+    WinMainMetrics[MWM_MENUBOTTOMMARGIN] = 4;
+    WinMainMetrics[MWM_MENULEFTMARGIN] = 4;
+    WinMainMetrics[MWM_MENURIGHTMARGIN] = 4;
+    WinMainMetrics[MWM_MENUITEMMINX] = 64;
+    WinMainMetrics[MWM_MENUSEPARATORY] = 4;
+    WinMainMetrics[MWM_MENUSEPARATORX] = 4;
+    WinMainMetrics[MWM_SB_WIDTH] = 16;
+    WinMainMetrics[MWM_SB_HEIGHT] = 14;
+    WinMainMetrics[MWM_SB_INTERX] = 2;
+    WinMainMetrics[MWM_CXVSCROLL] = 18;
+    WinMainMetrics[MWM_CYVSCROLL] = 18;
+    WinMainMetrics[MWM_CXHSCROLL] = 18;
+    WinMainMetrics[MWM_CYHSCROLL] = 18;
+    //-WinMainMetrics[MWM_MINBARLEN] = 8;
+    //-WinMainMetrics[MWM_DEFBARLEN] = 18;
+}
+
+
+/* 
+ * Adjust client area smaller if scrollbars visible.
+ * Also, compute the NC hittest regions for the scrollbars.
+ */
+void
+MwAdjustNCScrollbars(HWND hwnd)
+{
+	BOOL	vertbar = VSCROLLBARVISIBLE(hwnd);
+        BOOL	horzbar = HSCROLLBARVISIBLE(hwnd);
+
+	if (vertbar) {
+		hwnd->clirect.right -= mwSYSMETRICS_CXVSCROLL;
+		if (horzbar)
+			hwnd->clirect.bottom -= mwSYSMETRICS_CYHSCROLL;
+		hwnd->vscroll.rc.left = hwnd->clirect.right;
+		hwnd->vscroll.rc.right = hwnd->clirect.right +
+			mwSYSMETRICS_CXVSCROLL;
+		hwnd->vscroll.rc.top = hwnd->clirect.top;
+		hwnd->vscroll.rc.bottom = hwnd->clirect.bottom;
+	} else
+		SetRectEmpty(&hwnd->vscroll.rc);
+	if (horzbar) {
+		if (!vertbar)
+			hwnd->clirect.bottom -= mwSYSMETRICS_CYHSCROLL;
+		hwnd->hscroll.rc.top = hwnd->clirect.bottom;
+		hwnd->hscroll.rc.bottom = hwnd->clirect.bottom +
+			mwSYSMETRICS_CYHSCROLL;
+		hwnd->hscroll.rc.left = hwnd->clirect.left;
+		hwnd->hscroll.rc.right = hwnd->clirect.right;
+	} else
+		SetRectEmpty(&hwnd->hscroll.rc);
+}
+
+void
+MwPaintNCScrollbars(HWND hwnd, HDC hdc)
+{
+	BOOL	vertbar = VSCROLLBARVISIBLE(hwnd);
+        BOOL	horzbar = HSCROLLBARVISIBLE(hwnd);
+	BOOL	fGotDC = FALSE;
+	RECT	rc;
+
+	if (!hdc && (horzbar || vertbar)) {
+		hdc = GetWindowDC(hwnd);
+		fGotDC = TRUE;
+	}
+
+	if (horzbar && vertbar) {
+		rc.left = hwnd->clirect.right;
+		rc.top = hwnd->clirect.bottom;
+		rc.right = rc.left + mwSYSMETRICS_CXVSCROLL;
+		rc.bottom = rc.top + mwSYSMETRICS_CYHSCROLL;
+		FillRect(hdc, &rc, (HBRUSH)(COLOR_BTNFACE+1));
+	}
+	if (vertbar) {
+		rc = hwnd->vscroll.rc;
+		/* bkgnd*/
+		FillRect(hdc, &rc, (HBRUSH)(COLOR_BTNFACE+1));
+		/* up*/
+		Draw3dUpDownState(hdc, rc.left, rc.top,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->vscroll.status & SBS_UPARROW);
+		/* down*/
+		Draw3dUpDownState(hdc, rc.left,rc.bottom-mwSYSMETRICS_CYHSCROLL,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->vscroll.status & SBS_DOWNARROW);
+	}
+	if (horzbar) {
+		rc = hwnd->hscroll.rc;
+		/* bkgnd*/
+		FillRect(hdc, &rc, (HBRUSH)(COLOR_BTNFACE+1));
+		/* left*/
+		Draw3dUpDownState(hdc, rc.left, rc.top,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->hscroll.status & SBS_LEFTARROW);
+		/* right*/
+		Draw3dUpDownState(hdc, rc.right-mwSYSMETRICS_CXVSCROLL, rc.top,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->hscroll.status & SBS_RIGHTARROW);
+	}
+
+	if (fGotDC)
+		ReleaseDC(hwnd, hdc);
+}
+
+/* handle a non-client message for a scrollbar*/
+void
+MwHandleNCMessageScrollbar(HWND hwnd, WPARAM hitcode, LPARAM lParam, BOOL fDown)
+{
+	int	pos = SBS_UNKNOWN;
+	BOOL	vertbar = VSCROLLBARVISIBLE(hwnd);
+        BOOL	horzbar = HSCROLLBARVISIBLE(hwnd);
+	int *	pStat;
+	POINT	pt;
+	RECT	rc;
+
+    static int downPos = SBS_UNKNOWN;
+    static int movePos = SBS_UNKNOWN;
+    static int sbCode;
+
+	POINTSTOPOINT(pt, lParam);
+	for (;;) {	/* use for() to allow break statement*/
+		if (hitcode == HTVSCROLL && vertbar) {
+			pStat = &hwnd->vscroll.status;
+			rc = hwnd->vscroll.rc;
+			rc.bottom = rc.top + mwSYSMETRICS_CYVSCROLL;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_UPARROW;
+				break;
+			}
+			rc.bottom = hwnd->vscroll.rc.bottom;
+			rc.top = rc.bottom - mwSYSMETRICS_CYVSCROLL;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_DOWNARROW;
+				break;
+			}
+			pos = SBS_VERTTHUMB;
+		} else if (hitcode == HTHSCROLL && horzbar) {
+			pStat = &hwnd->hscroll.status;
+			rc = hwnd->hscroll.rc;
+			rc.right = rc.left + mwSYSMETRICS_CXHSCROLL;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_LEFTARROW;
+				break;
+			}
+			rc.right = hwnd->hscroll.rc.right;
+			rc.left = rc.right - mwSYSMETRICS_CXHSCROLL;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_RIGHTARROW;
+				break;
+			}
+			pos = SBS_HORZTHUMB;
+		} else
+			return;
+		break;
+	}
+
+	if (pos == SBS_UNKNOWN)
+		return;
+
+	*pStat &= ~SBS_MASK;		/* remove stray mouse states*/
+	if (fDown)
+		*pStat |= pos;
+	else *pStat &= ~pos;
+	MwPaintNCScrollbars(hwnd, NULL);
+#if 1
+        downPos = pos;
+        movePos = pos;
+        if (pos == SBS_UPARROW) {
+                //?sbDownButton (hwnd, pos);
+                if (hwnd->vscroll.curPos != hwnd->vscroll.minPos)
+			sbCode = SB_LINEUP;
+        }
+        else if (pos == SBS_DOWNARROW) {
+                //?sbDownButton (hwnd, pos);
+                if (hwnd->vscroll.curPos != hwnd->vscroll.maxPos)
+			sbCode = SB_LINEDOWN;
+        }
+        else if (pos == SBS_UPSPACE) {
+                if (hwnd->vscroll.curPos != hwnd->vscroll.minPos)
+			sbCode = SB_PAGEUP;
+        }
+        else if (pos == SBS_DOWNSPACE) {
+                if (hwnd->vscroll.curPos != hwnd->vscroll.maxPos)
+			sbCode = SB_PAGEDOWN;
+        }
+	if (!fDown)
+		SendMessage (hwnd, WM_VSCROLL, sbCode, 0);
+#endif
+}
+
+#if 1//0000
+static int
+wndGetBorder(HWND hwnd)
+{
+	if (hwnd->style & WS_BORDER)  {
+		if ((hwnd->style & WS_CAPTION) == WS_CAPTION)
+			return mwSYSMETRICS_CXFRAME;
+		return mwSYSMETRICS_CXBORDER;
+	}
+	return 0;
+}
+
+static BOOL
+wndGetVScrollBarRect (HWND hwnd, RECT* rcVBar)
+{
+    if (hwnd->style & WS_VSCROLL) {
+        rcVBar->left = hwnd->winrect.right - mwSYSMETRICS_CXVSCROLL
+                        - wndGetBorder (hwnd);
+        rcVBar->right = hwnd->winrect.right/*right*/ - wndGetBorder (hwnd);
+        rcVBar->top  = hwnd->clirect.top;
+        rcVBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd);
+
+        if (hwnd->style & WS_HSCROLL && !(hwnd->hscroll.status & SBS_HIDE))
+            rcVBar->bottom -= mwSYSMETRICS_CYHSCROLL;
+        
+        return TRUE;
+    }
+    
+    return FALSE;
+}
+
+static BOOL
+wndGetHScrollBarRect (HWND hwnd, RECT* rcHBar)
+{
+    if (hwnd->style & WS_HSCROLL) {
+        rcHBar->top = hwnd->winrect.bottom - mwSYSMETRICS_CYHSCROLL
+                        - wndGetBorder (hwnd);
+        rcHBar->bottom = hwnd->winrect.bottom/*bottom*/ - wndGetBorder (hwnd);
+        rcHBar->left  = hwnd->clirect.left;
+        rcHBar->right = hwnd->winrect.right - wndGetBorder (hwnd);
+
+        if (hwnd->style & WS_VSCROLL && !(hwnd->vscroll.status & SBS_HIDE))
+            rcHBar->right -= mwSYSMETRICS_CXVSCROLL;
+
+        return TRUE;
+    }
+    
+    return FALSE;
+}
+
+static BOOL
+PtInRect2(const RECT *lprc, int x, int y)
+{
+	POINT	p;
+
+	p.x = x;
+	p.y = y;
+	return PtInRect(lprc, p);
+}
+
+#if 0000
+static int
+wndGetHScrollBarPos (HWND hwnd, int x, int y)
+{
+    RECT rcBar;
+    RECT rcArea;
+
+    if (hwnd->hscroll.status & SBS_DISABLED)
+        return SBS_UNKNOWN;
+
+    wndGetHScrollBarRect (hwnd, &rcBar);
+
+    if (!PtInRect2 (&rcBar, x, y))
+        return SBS_UNKNOWN;
+
+    rcArea.top  = rcBar.top;
+    rcArea.bottom = rcBar.bottom;
+
+    // Left arrow area
+    rcArea.left = rcBar.left;
+    rcArea.right = rcArea.left + mwSYSMETRICS_CXHSCROLL;
+
+    if (PtInRect2 (&rcArea, x, y))
+        return SBS_LEFTARROW;
+
+    // Right arrow area
+    rcArea.left = rcBar.right - mwSYSMETRICS_CXHSCROLL;
+    rcArea.right = rcBar.right;
+
+    if (PtInRect2 (&rcArea, x, y))
+        return SBS_RIGHTARROW;
+
+
+    if (x < (rcBar.left + hwnd->hscroll.barStart + mwSYSMETRICS_CXHSCROLL))
+        return SBS_LEFTSPACE;
+
+    if (x > (rcBar.left + hwnd->hscroll.barStart + hwnd->hscroll.barLen
+            + mwSYSMETRICS_CXHSCROLL))
+        return SBS_RIGHTSPACE;
+
+    return SBS_UNKNOWN;
+}
+
+static int
+wndGetVScrollBarPos (HWND hwnd, int x, int y)
+{
+    RECT rcBar;
+    RECT rcArea;
+
+    if (hwnd->vscroll.status & SBS_DISABLED)
+        return SBS_UNKNOWN;
+
+    wndGetVScrollBarRect (hwnd, &rcBar);
+
+    if (!PtInRect2 (&rcBar, x, y))
+        return SBS_UNKNOWN;
+
+    rcArea.left  = rcBar.left;
+    rcArea.right = rcBar.right;
+
+    // Left arrow area
+    rcArea.top = rcBar.top;
+    rcArea.bottom = rcArea.top + mwSYSMETRICS_CYVSCROLL;
+
+    if (PtInRect2 (&rcArea, x, y))
+        return SBS_UPARROW;
+
+    // Right arrow area
+    rcArea.top = rcBar.bottom - mwSYSMETRICS_CYVSCROLL;
+    rcArea.bottom = rcBar.bottom;
+
+    if (PtInRect2 (&rcArea, x, y))
+        return SBS_DOWNARROW;
+
+
+    if (y < (rcBar.top + hwnd->vscroll.barStart + mwSYSMETRICS_CYVSCROLL))
+        return SBS_UPSPACE;
+
+    if (y > (rcBar.top + hwnd->vscroll.barStart + hwnd->vscroll.barLen
+            + mwSYSMETRICS_CYVSCROLL))
+        return SBS_DOWNSPACE;
+
+    return SBS_UNKNOWN;
+}
+#endif
+
+static BOOL
+sbGetSBarArrowPos (HWND hwnd, int location, int* x, int* y, int* w, int* h)
+{
+    RECT rcBar;
+
+    if (location < SBS_UPARROW) 
+        wndGetHScrollBarRect (hwnd, &rcBar);
+    else
+        wndGetVScrollBarRect (hwnd, &rcBar);
+
+    *w = mwSYSMETRICS_CXHSCROLL;
+    *h = mwSYSMETRICS_CYHSCROLL;
+    switch (location) {
+        case SBS_LEFTARROW:
+            *x = rcBar.left;
+            *y = rcBar.top;
+        break;
+        
+        case SBS_RIGHTARROW:
+            *x = rcBar.right - mwSYSMETRICS_CXHSCROLL;
+            *y = rcBar.top;
+        break;
+
+        case SBS_UPARROW:
+            *x = rcBar.left;
+            *y = rcBar.top;
+        break;
+
+        case SBS_DOWNARROW:
+            *x = rcBar.left;
+            *y = rcBar.bottom - mwSYSMETRICS_CYVSCROLL;
+        break;
+
+        default:
+        return FALSE;
+    }
+
+    *x -= hwnd->winrect.left/*left*/;
+    *y -= hwnd->winrect.top/*top*/;
+
+    return TRUE;
+}
+
+static BOOL sbGetButtonPos (HWND/*PMAINWIN*/ pWin, int location, 
+                            int* x, int* y, int* w, int* h)//!!
+{
+    RECT rc;
+    int iBorder = 0;
+    int iCaption = 0;
+    //-int iIconX = 0;
+    int iIconY = 0;
+
+    if (pWin->style/*dwStyle*/ & WS_BORDER) 
+        iBorder = GetMainWinMetrics(MWM_BORDER);
+    else if (pWin->style/*dwStyle*/ & WS_THICKFRAME)
+        iBorder = GetMainWinMetrics(MWM_THICKFRAME);
+    else if (pWin->style/*dwStyle*/ & WS_THINFRAME)
+        iBorder = GetMainWinMetrics(MWM_THINFRAME);
+
+    // scroll bar position
+    if (location & SBPOS_MASK)
+        return sbGetSBarArrowPos (pWin, location, x, y, w, h);
+
+    if (!(pWin->style/*dwStyle*/ & WS_CAPTION))
+         return FALSE;
+#if 0//fix: no ->hIcon
+    if (pWin->hIcon)
+    {
+        iIconX = GetMainWinMetrics(MWM_ICONX);
+        iIconY = GetMainWinMetrics(MWM_ICONY);
+    }
+#endif
+    iCaption = GetMainWinMetrics(MWM_CAPTIONY);
+
+    rc.left = iBorder;
+    rc.top = iBorder;
+    rc.right = pWin->winrect.right/*right*/ - pWin->winrect.left/*left*/ - iBorder;
+    rc.bottom = iBorder + iCaption;
+                    
+    // close button
+    *x = rc.right - GetMainWinMetrics (MWM_SB_WIDTH);
+    *y = GetMainWinMetrics (MWM_SB_HEIGHT);
+    *w = GetMainWinMetrics (MWM_SB_WIDTH);
+    if (*y < iCaption) {
+        *y = iBorder + ((iCaption - *y)>>1);
+        *h = GetMainWinMetrics (MWM_SB_HEIGHT);
+    }
+    else {
+        *y = iBorder;
+        *h = iIconY;
+    }
+
+    if (location == HTCLOSE)//
+        return TRUE;
+
+    *x -= GetMainWinMetrics (MWM_SB_WIDTH);
+    *x -= GetMainWinMetrics (MWM_SB_INTERX)<<1;
+    if (pWin->style/*dwStyle*/ & WS_MAXIMIZEBOX) {
+        // restore/maximize button
+        if (location == HTMAXBUTTON)//
+            return TRUE;
+
+        *x -= GetMainWinMetrics (MWM_SB_WIDTH);
+        *x -= GetMainWinMetrics (MWM_SB_INTERX);
+    }
+
+    if (pWin->style/*dwStyle*/ & WS_MINIMIZEBOX) {
+        // minimize button.
+        if (location == HTMINBUTTON)//
+            return TRUE;
+    }
+
+    return FALSE;
+}
+
+static BOOL
+sbDownButton (HWND pWin, int downCode)
+{
+    HDC hdc;
+    int x, y, w, h;
+
+    
+    if (!sbGetButtonPos (pWin, downCode, &x, &y, &w, &h))
+        return FALSE;
+
+    w += x - 1;
+    h += y - 1;
+    hdc = GetDC ((HWND)pWin);
+    //Draw3DDownFrame(hdc, x, y, w, h);
+    Draw3dUpDownState(hdc, x, y, w, h, TRUE);
+    ReleaseDC (hdc->hwnd,hdc);
+
+    return TRUE;
+}
+
+static BOOL sbUpButton (HWND pWin, int downCode)
+{
+    HDC hdc;
+    int x, y, w, h;
+    //-PBITMAP bmp = NULL;
+    
+    if (!sbGetButtonPos (pWin, downCode, &x, &y, &w, &h))
+        return FALSE;
+
+    hdc = GetDC ((HWND)pWin);
+    switch (downCode) {
+        case HTMAXBUTTON:
+            //bmp = GetSystemBitmap (SYSBMP_MAXIMIZE);
+            break;
+        case HTMINBUTTON:
+            //bmp = GetSystemBitmap (SYSBMP_MINIMIZE);
+            break;
+        case HTCLOSE://HT_CLOSEBUTTON:
+            //bmp = GetSystemBitmap (SYSBMP_CLOSE);
+            break;
+
+        case SBS_UPARROW:
+            //bmp = GetSystemBitmap (SYSBMP_ARROWUP);
+            break;
+        case SBS_DOWNARROW:
+            //bmp = GetSystemBitmap (SYSBMP_ARROWDOWN);
+            break;
+        case SBS_LEFTARROW:
+            //bmp = GetSystemBitmap (SYSBMP_ARROWLEFT);
+            break;
+        case SBS_RIGHTARROW:
+            //bmp = GetSystemBitmap (SYSBMP_ARROWRIGHT);
+            break;
+    }
+#if 0//!!: fix: use draw instead of bitmap
+    if (bmp)
+        FillBoxWithBitmap (hdc, x, y, w, h, bmp);
+#endif
+    ReleaseDC (hdc->hwnd,hdc);//
+
+    return TRUE;
+}
+
+#if 0000
+static BOOL
+wndHandleHScrollBar (HWND hwnd, int message, int x, int y)
+{
+    int curPos;
+    RECT rcBar;
+    static int downPos = SBS_UNKNOWN;
+    static int movePos = SBS_UNKNOWN;
+    static int sbCode;
+
+    wndGetHScrollBarRect (hwnd, &rcBar);
+    rcBar.left -= hwnd->winrect.left;
+    rcBar.top  -= hwnd->winrect.top;
+    rcBar.right -= hwnd->winrect.left;
+    rcBar.bottom -= hwnd->winrect.top;
+    
+    rcBar.left += mwSYSMETRICS_CXHSCROLL;
+    rcBar.right -= mwSYSMETRICS_CXHSCROLL;
+
+    curPos = wndGetHScrollBarPos (hwnd, x, y);
+    
+    if (curPos == SBS_UNKNOWN && downPos == SBS_UNKNOWN)
+        return FALSE;
+    
+    switch( message )
+    {
+        case WM_NCLBUTTONDOWN:
+            downPos = curPos;
+            movePos = curPos;
+            if (curPos == SBS_LEFTARROW) {
+                sbDownButton (hwnd, curPos);
+                if (hwnd->hscroll.curPos == hwnd->hscroll.minPos)
+                    break;
+
+                sbCode = SB_LINELEFT;
+            }
+            else if (curPos == SBS_RIGHTARROW) {
+                sbDownButton (hwnd, curPos);
+                if (hwnd->hscroll.curPos == hwnd->hscroll.maxPos)
+                    break;
+                
+                sbCode = SB_LINERIGHT;
+            }
+            else if (curPos == SBS_LEFTSPACE) {
+                if (hwnd->hscroll.curPos == hwnd->hscroll.minPos)
+                    break;
+
+                sbCode = SB_PAGELEFT;
+            }
+            else if (curPos == SBS_RIGHTSPACE) {
+                if (hwnd->hscroll.curPos == hwnd->hscroll.maxPos)
+                    break;
+                
+                sbCode = SB_PAGERIGHT;
+            }
+        break;
+
+        case WM_NCLBUTTONUP:
+            if (curPos == downPos) {
+                sbUpButton (hwnd, curPos);
+                SendMessage/*SendNotifyMessage*/ (hwnd, WM_HSCROLL, sbCode, 0);
+            }
+
+            downPos = SBS_UNKNOWN;
+            movePos = SBS_UNKNOWN;
+        break;
+    
+        case WM_NCMOUSEMOVE:
+            if (movePos == downPos && curPos != downPos)
+                sbUpButton (hwnd, downPos);
+            else if (movePos != downPos && curPos == downPos)
+                sbDownButton (hwnd, downPos);
+            movePos = curPos;
+        break;
+    }
+
+    return TRUE;
+}
+
+
+
+static BOOL
+wndHandleVScrollBar (HWND hwnd, int message, int x, int y)
+{
+    static int downPos = SBS_UNKNOWN;
+    static int movePos = SBS_UNKNOWN;
+    static int sbCode;
+    int curPos;
+    RECT rcBar;
+
+    wndGetVScrollBarRect (hwnd, &rcBar);
+    rcBar.left -= hwnd->winrect.left/*left*/;
+    rcBar.top  -= hwnd->winrect.top/*top*/;
+    rcBar.right -= hwnd->winrect.left/*left*/;
+    rcBar.bottom -= hwnd->winrect.top/*top*/;
+
+    rcBar.top += GetMainWinMetrics(mwSYSMETRICS_CYVSCROLL);//?
+    rcBar.bottom -= GetMainWinMetrics(mwSYSMETRICS_CYVSCROLL);//?
+
+    curPos = wndGetVScrollBarPos (hwnd, x, y);
+
+    if (curPos == SBS_UNKNOWN && downPos == SBS_UNKNOWN)
+        return FALSE;
+    
+    switch( message )
+    {
+        case WM_NCLBUTTONDOWN:
+            downPos = curPos;
+            movePos = curPos;
+            if (curPos == SBS_UPARROW) {
+                sbDownButton (hwnd, curPos);
+                if (hwnd->vscroll.curPos == hwnd->vscroll.minPos)
+                    break;
+
+                sbCode = SB_LINEUP;
+            }
+            else if (curPos == SBS_DOWNARROW) {
+                sbDownButton (hwnd, curPos);
+                if (hwnd->vscroll.curPos == hwnd->vscroll.maxPos)
+                    break;
+
+                sbCode = SB_LINEDOWN;
+            }
+            else if (curPos == SBS_UPSPACE) {
+                if (hwnd->vscroll.curPos == hwnd->vscroll.minPos)
+                    break;
+
+                sbCode = SB_PAGEUP;
+            }
+            else if (curPos == SBS_DOWNSPACE) {
+                if (hwnd->vscroll.curPos == hwnd->vscroll.maxPos)
+                    break;
+
+                sbCode = SB_PAGEDOWN;
+            }
+        break;
+
+        case WM_NCLBUTTONUP:
+            if (curPos == downPos) {
+                sbUpButton (hwnd, curPos);
+                SendMessage/*SendNotifyMessage*/ (hwnd, WM_VSCROLL, sbCode, 0);
+            }
+
+            downPos = SBS_UNKNOWN;
+            movePos = SBS_UNKNOWN;
+        break;
+    
+        case WM_NCMOUSEMOVE:
+            if (movePos == downPos && curPos != downPos)
+                sbUpButton (hwnd, downPos);
+            else if (movePos != downPos && curPos == downPos)
+                sbDownButton (hwnd, downPos);
+            movePos = curPos;
+        break;
+    }
+
+    return TRUE;
+}
+
+// this function is CONTROL safe.
+static int DefaultNCMouseMsgHandler(HWND hwnd, int message, 
+                           int location, int x, int y)
+{
+    static HWND downWin  = NULL;
+    static int downCode = HTNOWHERE;//HT_UNKNOWN;
+    static int moveCode = HTNOWHERE;//HT_UNKNOWN;
+    //-static int oldx, oldy;
+    //-static RECT rcWindow;
+
+    HWND pWin = hwnd;//+
+
+    //-int barItem;
+#if 0//fix: no menu
+//?    if (message == WM_NCMOUSEMOVE)
+//?        wndTrackMenuBarOnMouseMove(pWin, message, location, x, y);
+#endif
+    if ((pWin->style & WS_HSCROLL) 
+            && wndHandleHScrollBar (pWin, message, x, y))
+        return 0;
+    
+    if ((pWin->style & WS_VSCROLL)
+            && wndHandleVScrollBar (pWin, message, x, y))
+        return 0;
+
+    switch( message )
+    {
+        case WM_NCLBUTTONDOWN:
+#if 0//fix: no menu
+//?            if (location == HTMENU/*HT_MENUBAR*/)//? 
+//?	    {
+//?                barItem = MenuBarHitTest ((HWND)pWin, x, y);
+//?                if (barItem >= 0)
+//?                    TrackMenuBar ((HWND)pWin, barItem);
+//?
+//?                return 0;
+//?            }
+//?            else 
+#endif
+
+            downCode = location;
+            moveCode = location;
+            downWin  = pWin;
+            sbDownButton (pWin, downCode);
+            break;
+
+        case WM_NCMOUSEMOVE:
+            if (downCode != HTNOWHERE/*HT_UNKNOWN*/) { 
+                if (moveCode == downCode && location != downCode) {
+                    sbUpButton (pWin, downCode);
+                    moveCode = location;
+                }
+                else if (moveCode != downCode && location == downCode) {
+                    sbDownButton (pWin, downCode);
+                    moveCode = location;
+                }
+            }
+            break;
+
+        case WM_NCLBUTTONUP:
+            if (location == downCode) {
+                sbUpButton (pWin, downCode);
+                switch (location) {
+                    case HTCLOSE://HT_CLOSEBUTTON:
+                        SendMessage/*SendNotifyMessage*/ ((HWND)pWin, WM_CLOSE, 0, 0);
+                    break;
+
+#if 0//fix: no HT_ICON,HTICON
+//?                 case HT_ICON:
+//?                     if (pWin->hSysMenu)
+//?                         TrackPopupMenu (pWin->hSysMenu, 
+//?                             TPM_SYSCMD, x, y, (HWND)pWin);
+//?                 break;
+#endif
+                }
+            }
+            downCode = HTNOWHERE;//HT_UNKNOWN;
+            moveCode = HTNOWHERE;//HT_UNKNOWN;
+            downWin  = NULL;
+            break;
+            
+        case WM_NCRBUTTONDOWN:
+            break;
+
+        case WM_NCRBUTTONUP:
+#if 0//fix: no menu
+//?            if (location == HTCAPTION && pWin->hSysMenu)
+//?                TrackPopupMenu (pWin->hSysMenu, TPM_SYSCMD, x, y, (HWND)pWin);
+//?            break;
+#endif            
+        case WM_NCLBUTTONDBLCLK:
+#if 0//fix: no HT_ICON,HTICON
+//-            if (location == HT_ICON)
+//-                SendNotifyMessage ((HWND)pWin, WM_CLOSE, 0, 0);
+#endif
+//-            else if (location == HTCAPTION)
+//-                SendNotifyMessage ((HWND)pWin, WM_MAXIMIZE, 0, 0);
+            break;
+
+        case WM_NCRBUTTONDBLCLK:
+            break;
+    }
+
+    return 0;
+}
+#endif
+
+static void
+wndScrollBarPos (HWND hwnd, BOOL bIsHBar, RECT* rcBar)
+{
+    UINT moveRange;
+    PMWSCROLLBARINFO pSBar;
+
+    if (bIsHBar)
+        pSBar = &hwnd->hscroll;
+    else
+        pSBar = &hwnd->vscroll;
+
+    if (pSBar->minPos == pSBar->maxPos) {
+        pSBar->status |= SBS_HIDE;
+        return;
+    }
+
+    if (bIsHBar)
+        moveRange = (rcBar->right - rcBar->left) - (mwSYSMETRICS_CXHSCROLL<<1);
+    else
+        moveRange = (rcBar->bottom - rcBar->top) - (mwSYSMETRICS_CYVSCROLL<<1);
+
+#define MWM_DEFBARLEN	18//
+#define MWM_MINBARLEN	8//
+
+    if (pSBar->pageStep == 0) {
+        pSBar->barLen = MWM_DEFBARLEN;
+
+        if (pSBar->barLen > moveRange)
+            pSBar->barLen = MWM_MINBARLEN;
+    }
+    else {
+        pSBar->barLen = moveRange * pSBar->pageStep /
+	      (pSBar->maxPos - pSBar->minPos + 1);
+        if (pSBar->barLen < MWM_MINBARLEN)
+            pSBar->barLen = MWM_MINBARLEN;
+    }
+
+    pSBar->barStart = moveRange * (pSBar->curPos - pSBar->minPos) /
+       (pSBar->maxPos - pSBar->minPos + 1);
+
+    if (pSBar->barStart + pSBar->barLen > moveRange)
+        pSBar->barStart = moveRange - pSBar->barLen;
+    if (pSBar->barStart < 0)
+        pSBar->barStart = 0;
+}
+
+#if 0000
+static void OnChangeSize(HWND pWin, PRECT pDestRect, PRECT pResultRect)
+{
+    int iBorder = 0;
+    int iCaptionY = 0;
+    //-int iIconX = 0;
+    //-int iIconY = 0;
+    int iMenuY = 0;
+
+    if (pWin->style & WS_BORDER) 
+        iBorder = GetMainWinMetrics(MWM_BORDER);
+    else if (pWin->style & WS_THICKFRAME)
+        iBorder = GetMainWinMetrics(MWM_THICKFRAME);
+    else if (pWin->style & WS_THINFRAME)
+        iBorder = GetMainWinMetrics (MWM_THINFRAME);
+
+    if( pWin->style & WS_CAPTION )
+    {
+        iCaptionY = GetMainWinMetrics(MWM_CAPTIONY);
+#if 0//fix: no ->hIcon
+        if (pWin->hIcon) {
+            iIconX = GetMainWinMetrics(MWM_ICONX);
+            iIconY = GetMainWinMetrics(MWM_ICONY);
+        }
+#endif
+    }
+#if 0//fix: no menu
+//?    if (pWin->hMenu) {
+//?        iMenuY = GetMainWinMetrics (MWM_MENUBARY);
+//?        iMenuY += GetMainWinMetrics (MWM_MENUBAROFFY)<<1;
+//?    }
+#endif
+    if (pDestRect) {
+        int minWidth = 0, minHeight = 0;
+
+        memcpy(&pWin->winrect.left/*left*/, pDestRect, sizeof(RECT));
+
+        minHeight = iMenuY + (iCaptionY<<1);
+        if (pWin->style & WS_VSCROLL) {
+            minWidth += GetMainWinMetrics (MWM_CXVSCROLL);
+            minHeight += (GetMainWinMetrics (MWM_CYVSCROLL)<<1) +
+                         (GetMainWinMetrics (MWM_MINBARLEN)<<1);
+        }
+        
+        if (1)//type_mainwin
+            minWidth += GetMainWinMetrics (MWM_MINWIDTH);
+
+        if (pWin->style & WS_HSCROLL) {
+            minHeight += GetMainWinMetrics (MWM_CYHSCROLL);
+            minWidth += (GetMainWinMetrics (MWM_CXHSCROLL)<<1) +
+                        (GetMainWinMetrics (MWM_MINBARLEN)<<1);
+        }
+
+        if(minHeight > (pWin->winrect.bottom/*bottom*/ - pWin->winrect.top/*top*/))
+            pWin->winrect.bottom/*bottom*/ = pWin->winrect.top/*top*/ + minHeight;
+
+        if(pWin->winrect.right/*right*/ < (pWin->winrect.left/*left*/ + minWidth))
+            pWin->winrect.right/*right*/ = pWin->winrect.left/*left*/ + minWidth;
+
+        if( pResultRect )
+             memcpy(pResultRect, &pWin->winrect.left/*left*/, sizeof(RECT));
+    }
+
+    memcpy(&pWin->clirect.left/*cl*/, &pWin->winrect.left/*left*/, sizeof(RECT));
+
+    pWin->clirect.left/*cl*/ += iBorder;
+    pWin->clirect.top/*ct*/ += iBorder;
+    pWin->clirect.right/*cr*/ -= iBorder;
+    pWin->clirect.bottom/*cb*/ -= iBorder;
+    pWin->clirect.top/*ct*/ += iCaptionY;
+    pWin->clirect.top/*ct*/ += iMenuY;
+    
+    if (pWin->style & WS_HSCROLL && !(pWin->hscroll.status & SBS_HIDE)) {
+    
+        RECT rcBar;
+        wndGetHScrollBarRect (pWin, &rcBar);
+        wndScrollBarPos (pWin, TRUE, &rcBar);
+
+        pWin->clirect.bottom/*cb*/ -= GetMainWinMetrics (MWM_CYHSCROLL);
+    }
+        
+    if (pWin->style & WS_VSCROLL && !(pWin->vscroll.status & SBS_HIDE)) {
+    
+        RECT rcBar;
+        wndGetVScrollBarRect (pWin, &rcBar);
+        wndScrollBarPos (pWin, FALSE, &rcBar);
+
+        pWin->clirect.right/*cr*/ -= GetMainWinMetrics (MWM_CXVSCROLL);
+    }
+}
+#endif
+
+int ClientWidthToWindowWidth (DWORD dwStyle, int cw)
+{
+    int iBorder = 0;
+    int iScroll = 0;
+
+    if (dwStyle & WS_BORDER) 
+        iBorder = GetMainWinMetrics(MWM_BORDER);
+    else if (dwStyle & WS_THICKFRAME)
+        iBorder = GetMainWinMetrics(MWM_THICKFRAME);
+    else if (dwStyle & WS_THINFRAME)
+        iBorder = GetMainWinMetrics (MWM_THINFRAME);
+
+    if (dwStyle & WS_VSCROLL)
+        iScroll = GetMainWinMetrics (MWM_CXVSCROLL);
+        
+    return cw + (iBorder<<1) + iScroll;
+}
+
+int ClientHeightToWindowHeight (DWORD dwStyle, int ch, BOOL hasMenu)
+{
+    int iBorder  = 0;
+    int iCaption = 0;
+    int iScroll  = 0;
+    int iMenu    = 0;
+
+    if (dwStyle & WS_BORDER) 
+        iBorder = GetMainWinMetrics(MWM_BORDER);
+    else if (dwStyle & WS_THICKFRAME)
+        iBorder = GetMainWinMetrics(MWM_THICKFRAME);
+    else if (dwStyle & WS_THINFRAME)
+        iBorder = GetMainWinMetrics (MWM_THINFRAME);
+
+    if (dwStyle & WS_HSCROLL)
+        iScroll = GetMainWinMetrics (MWM_CYHSCROLL);
+        
+    if (dwStyle & WS_CAPTION)
+        iCaption = GetMainWinMetrics(MWM_CAPTIONY);
+#if 0//fix: no menu
+//?    if (hasMenu) {
+//?        iMenu = GetMainWinMetrics (MWM_MENUBARY);
+//?        iMenu += GetMainWinMetrics (MWM_MENUBAROFFY)<<1;
+//?    }
+#endif
+    return ch + (iBorder<<1) + iCaption + iScroll + iMenu;
+}
+
+#if 0000
+// this function is CONTROL safe.
+static int HittestOnNClient (HWND pWin, int x, int y)
+{
+    RECT rcCaption, /*rcIcon,*/ rcButton/*, rcMenuBar*/;
+    int iBorder = 0;
+    int iCaption = 0;
+    //-int iIconX = 0;
+    //-int iIconY = 0;
+
+    if (pWin->style/*dwStyle*/ & WS_BORDER) 
+        iBorder = GetMainWinMetrics(MWM_BORDER);
+    else if (pWin->style/*dwStyle*/ & WS_THICKFRAME)
+        iBorder = GetMainWinMetrics(MWM_THICKFRAME);
+    else if (pWin->style/*dwStyle*/ & WS_THINFRAME)
+        iBorder = GetMainWinMetrics (MWM_THINFRAME);
+
+    if (pWin->style/*dwStyle*/ & WS_HSCROLL && !(pWin->hscroll.status & SBS_HIDE)) {
+    
+        RECT rcBar;
+        wndGetHScrollBarRect (pWin, &rcBar);
+
+        if (PtInRect2 (&rcBar, x, y))
+            return HTHSCROLL;
+    }
+        
+    if (pWin->style/*dwStyle*/ & WS_VSCROLL && !(pWin->vscroll.status & SBS_HIDE)) {
+    
+        RECT rcBar;
+        wndGetVScrollBarRect (pWin, &rcBar);
+
+        if (PtInRect2 (&rcBar, x, y))
+            return HTVSCROLL;
+    }
+    
+    if (!(pWin->style/*dwStyle*/ & WS_CAPTION))
+         return HTBORDER;
+
+    iCaption = GetMainWinMetrics(MWM_CAPTIONY);
+#if 0//fix: no ->hIcon
+    if (pWin->hIcon)
+    {
+        iIconX = GetMainWinMetrics(MWM_ICONX);
+        iIconY = GetMainWinMetrics(MWM_ICONY);
+    }
+#endif
+    // Caption rect;
+    rcCaption.left = pWin->winrect.left/*left*/ + iBorder;
+    rcCaption.top = pWin->winrect.top/*top*/ + iBorder;
+    rcCaption.right = pWin->winrect.right/*right*/ - iBorder;
+    rcCaption.bottom = rcCaption.top + iCaption;
+
+#if 0//fix: no HT_ICON,HTICON                    
+    if (pWin->hIcon)
+    { 
+        rcIcon.left = rcCaption.left;
+        rcIcon.top = rcCaption.top;
+        rcIcon.right = rcIcon.left + iIconX;
+        rcIcon.bottom = rcIcon.top + iIconY;
+
+        if (PtInRect2 (&rcIcon, x, y))
+            return HT_ICON;
+    }
+#endif
+
+    rcButton.left = rcCaption.right - GetMainWinMetrics (MWM_SB_WIDTH);
+    rcButton.top = rcCaption.top;
+    rcButton.right = rcCaption.right;
+    rcButton.bottom = rcCaption.top + GetMainWinMetrics (MWM_SB_HEIGHT);
+    if (PtInRect2 (&rcButton, x, y))
+        return HTCLOSE;
+
+    rcButton.left -= GetMainWinMetrics (MWM_SB_WIDTH);
+    rcButton.left -= GetMainWinMetrics (MWM_SB_INTERX)<<1;
+    if (pWin->style/*dwStyle*/ & WS_MAXIMIZEBOX) {
+        rcButton.right = rcButton.left + GetMainWinMetrics (MWM_SB_WIDTH);
+        if (PtInRect2 (&rcButton, x, y))
+            return HTMAXBUTTON;
+
+        rcButton.left -= GetMainWinMetrics (MWM_SB_WIDTH);
+        rcButton.left -= GetMainWinMetrics (MWM_SB_INTERX);
+    }
+
+    if (pWin->style/*dwStyle*/ & WS_MINIMIZEBOX) {
+        rcButton.right = rcButton.left + GetMainWinMetrics (MWM_SB_WIDTH);
+        if (PtInRect2 (&rcButton, x, y))
+            return HTMINBUTTON;
+    }
+
+    if (PtInRect2 (&rcCaption, x, y))
+        return HTCAPTION;
+#if 0//fix: no menu
+//?    if (pWin->hMenu) {
+//?        rcMenuBar.left = rcCaption.left;
+//?        rcMenuBar.top = rcCaption.bottom + 1;
+//?        rcMenuBar.right = rcCaption.right;
+//?        rcMenuBar.bottom = rcMenuBar.top + GetMainWinMetrics (MWM_MENUBARY);
+//?        rcMenuBar.bottom += GetMainWinMetrics (MWM_MENUBAROFFY)<<1;
+//?                
+//?        if (PtInRect2 (&rcMenuBar, x, y))
+//?            return HTMENU;//HT_MENUBAR;
+//?    }
+#endif
+    return HTNOWHERE;//HT_UNKNOWN;
+}
+
+static void wndDrawNCArea(const HWND pWin, HDC hdc)
+{
+    HGDIOBJ oldpen;
+    // Draw window frame
+    if (pWin->style/*dwStyle*/ & WS_BORDER)
+    {
+        if (pWin->style/*dwStyle*/ & WS_CHILD)
+            Draw3DDownFrame(hdc, 
+                   0, 0, 
+                   pWin->winrect.right/*right*/ - pWin->winrect.left/*left*/ - 1, 
+                   pWin->winrect.bottom/*bottom*/ - pWin->winrect.top/*top*/ - 1);
+        else
+            Draw3DUpFrame(hdc, 
+                   0, 0, 
+                   pWin->winrect.right/*right*/ - pWin->winrect.left/*left*/, 
+                   pWin->winrect.bottom/*bottom*/ - pWin->winrect.top/*top*/);
+    }
+    else if ((pWin->style/*dwStyle*/ & WS_THICKFRAME) ||
+            (pWin->style/*dwStyle*/ & WS_THINFRAME))
+    {
+       //-SetPenColor(hdc, BLACK/*COLOR_black*/);
+       oldpen=SelectObject(hdc,GetStockObject(BLACK_PEN));
+       Rectangle(hdc, 0, 0, 
+                      pWin->winrect.right/*right*/ - pWin->winrect.left/*left*/ - 1, 
+                      pWin->winrect.bottom/*bottom*/ - pWin->winrect.top/*top*/ - 1);
+       SelectObject(hdc,oldpen);
+    }
+
+}
+
+static void
+wndDrawScrollBar (HWND hwnd, HDC hdc)
+{
+    int iBorder = 0, start = 0;
+    RECT rcHBar, rcVBar;
+    //PBITMAP bmp;
+    RECT rc;
+    
+    if (hwnd->style/*dwStyle*/ & WS_BORDER) 
+        iBorder = GetMainWinMetrics (MWM_BORDER);
+    else if (hwnd->style/*dwStyle*/ & WS_THICKFRAME)
+        iBorder = GetMainWinMetrics (MWM_THICKFRAME);
+    else if (hwnd->style/*dwStyle*/ & WS_THINFRAME)
+        iBorder = GetMainWinMetrics (MWM_THINFRAME);
+   
+    wndGetVScrollBarRect (hwnd, &rcVBar);
+    rcVBar.left -= hwnd->winrect.left/*left*/;
+    rcVBar.top  -= hwnd->winrect.top/*top*/;
+    rcVBar.right -= hwnd->winrect.left/*left*/;
+    rcVBar.bottom -= hwnd->winrect.top/*top*/;
+    wndGetHScrollBarRect (hwnd, &rcHBar);
+    rcHBar.left -= hwnd->winrect.left/*left*/;
+    rcHBar.top  -= hwnd->winrect.top/*top*/;
+    rcHBar.right -= hwnd->winrect.left/*left*/;
+    rcHBar.bottom -= hwnd->winrect.top/*top*/;
+
+    //?SetBrushColor (hdc, LTGRAY/*COLOR_lightgray*/);
+    if (hwnd->style/*dwStyle*/ & WS_HSCROLL && !(hwnd->hscroll.status & SBS_HIDE)) 
+    {
+#if 0
+        FillBox (hdc, rcHBar.left, rcHBar.top,
+                  rcHBar.right - rcHBar.left + mwSYSMETRICS_CXVSCROLL,
+                  rcHBar.bottom - rcHBar.top);
+#else
+        rc.left=rcHBar.left; rc.top=rcHBar.top;
+        rc.right=rcHBar.right - rcHBar.left + mwSYSMETRICS_CXVSCROLL;
+        rc.bottom=rcHBar.bottom - rcHBar.top;
+	FillRect(hdc,&rc,GetStockObject(LTGRAY_BRUSH));
+#endif
+        // draw left and right buttons.
+        //if (hwnd->hscroll.status & SBS_DISABLED)
+            //bmp = NULL;//GetSystemBitmap (SYSBMP_ARROWLEFTD);
+        //else
+            //bmp = NULL;//GetSystemBitmap (SYSBMP_ARROWLEFT);
+#if 0//!!: fix: use draw instead of bitmap        
+        FillBoxWithBitmap (hdc, rcHBar.left, rcHBar.top, 
+		mwSYSMETRICS_CXHSCROLL, mwSYSMETRICS_CYHSCROLL, bmp);
+#endif
+        //if (hwnd->hscroll.status & SBS_DISABLED)
+            //bmp = NULL;//GetSystemBitmap (SYSBMP_ARROWRIGHTD);
+        //else
+            //bmp = NULL;//GetSystemBitmap (SYSBMP_ARROWRIGHT);
+#if 0//!!: fix: use draw instead of bitmap        
+        FillBoxWithBitmap (hdc, rcHBar.right - mwSYSMETRICS_CXHSCROLL,
+		rcHBar.top, mwSYSMETRICS_CXHSCROLL, mwSYSMETRICS_CYHSCROLL,
+		bmp);
+#endif
+        // draw moving bar.
+        start = rcHBar.left + mwSYSMETRICS_CXHSCROLL + hwnd->hscroll.barStart;
+
+        if (start + hwnd->hscroll.barLen > rcHBar.right)
+            start = rcHBar.right - hwnd->hscroll.barLen;
+
+        Draw3DUpFrame (hdc, start, rcHBar.top, start + hwnd->hscroll.barLen,
+	    rcHBar.bottom);
+    }
+
+    if (hwnd->style/*dwStyle*/ & WS_VSCROLL && !(hwnd->vscroll.status & SBS_HIDE)) 
+    {
+#if 0        
+        FillBox (hdc, rcVBar.left, rcVBar.top,
+                  rcVBar.right - rcVBar.left, rcVBar.bottom - rcVBar.top);
+#else
+        rc.left=rcVBar.left; rc.top=rcVBar.top;
+        rc.right=rcVBar.right - rcVBar.left;
+        rc.bottom=rcVBar.bottom - rcVBar.top;
+	FillRect(hdc,&rc,GetStockObject(LTGRAY_BRUSH));
+#endif
+        // draw top and bottom buttons.
+        //if (hwnd->vscroll.status & SBS_DISABLED)
+            //bmp = NULL;//GetSystemBitmap (SYSBMP_ARROWUPD);
+        //else
+            //bmp = NULL;//GetSystemBitmap (SYSBMP_ARROWUP);
+#if 0//!!: fix: use draw instead of bitmap        
+        FillBoxWithBitmap (hdc, rcVBar.left, rcVBar.top, 
+		mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYVSCROLL, bmp);
+#endif
+        //if (hwnd->vscroll.status & SBS_DISABLED)
+            //bmp = NULL;//GetSystemBitmap (SYSBMP_ARROWDOWND);
+        //else
+            //bmp = NULL;//GetSystemBitmap (SYSBMP_ARROWDOWN);
+#if 0//!!: fix: use draw instead of bitmap        
+        FillBoxWithBitmap (hdc, rcVBar.left,
+		rcVBar.bottom - mwSYSMETRICS_CYVSCROLL,
+		mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYVSCROLL, bmp);
+#endif
+        // draw moving bar
+        start = rcVBar.top + mwSYSMETRICS_CYVSCROLL + hwnd->vscroll.barStart;
+                    
+        if (start + hwnd->vscroll.barLen > rcVBar.bottom)
+            start = rcVBar.bottom - hwnd->vscroll.barLen;
+
+        Draw3DUpFrame (hdc, rcVBar.left, start, rcVBar.right,
+	    start + hwnd->vscroll.barLen);
+
+    }
+}
+#endif
+
+static PMWSCROLLBARINFO wndGetScrollBar (HWND pWin, int iSBar)
+{
+    if (iSBar == SB_HORZ) {
+        if (pWin->style/*dwStyle*/ & WS_HSCROLL)
+            return &pWin->hscroll;
+    }
+    else if (iSBar == SB_VERT) {
+        if (pWin->style/*dwStyle*/ & WS_VSCROLL)
+            return &pWin->vscroll;
+    }
+
+    return NULL;
+}
+
+BOOL  EnableScrollBar (HWND hWnd, int iSBar, BOOL bEnable)//!!
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    BOOL bPrevState;
+    RECT rcBar;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    bPrevState = !(pSBar->status & SBS_DISABLED);
+
+    if (bEnable && !bPrevState)
+        pSBar->status &= ~SBS_DISABLED;
+    else if (!bEnable && bPrevState)
+        pSBar->status |= SBS_DISABLED;
+    else
+        return FALSE;
+
+    if (iSBar == SB_VERT)
+        wndGetVScrollBarRect (pWin, &rcBar);
+    else
+        wndGetHScrollBarRect (pWin, &rcBar);
+        
+    rcBar.left -= pWin->winrect.left/*left*/;
+    rcBar.top  -= pWin->winrect.top/*top*/;
+    rcBar.right -= pWin->winrect.left/*left*/;
+    rcBar.bottom -= pWin->winrect.top/*top*/;
+
+    SendMessage/*SendAsyncMessage*/ (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+
+    return TRUE;
+}
+
+BOOL  GetScrollPos (HWND hWnd, int iSBar, int* pPos)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    *pPos = pSBar->curPos;
+    return TRUE;
+}
+
+BOOL  GetScrollRange (HWND hWnd, int iSBar, int* pMinPos, int* pMaxPos)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    *pMinPos = pSBar->minPos;
+    *pMaxPos = pSBar->maxPos;
+    return TRUE;
+}
+
+BOOL  SetScrollPos (HWND hWnd, int iSBar, int iNewPos)//!!
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    RECT rcBar;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    if (iNewPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+    else
+        pSBar->curPos = iNewPos;
+
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+    
+    if (iSBar == SB_VERT)
+        wndGetVScrollBarRect (pWin, &rcBar);
+    else
+        wndGetHScrollBarRect (pWin, &rcBar);
+
+    rcBar.left -= pWin->winrect.left/*left*/;
+    rcBar.top  -= pWin->winrect.top/*top*/;
+    rcBar.right -= pWin->winrect.left/*left*/;
+    rcBar.bottom -= pWin->winrect.top/*top*/;
+
+    wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar);
+
+    if (iSBar == SB_VERT) {
+        rcBar.top += GetMainWinMetrics (MWM_CYVSCROLL);
+        rcBar.bottom -= GetMainWinMetrics (MWM_CYVSCROLL);
+    }
+    else {
+        rcBar.left += GetMainWinMetrics (MWM_CXHSCROLL);
+        rcBar.right -= GetMainWinMetrics (MWM_CXHSCROLL);
+    }
+
+    SendMessage/*SendAsyncMessage*/ (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+
+    return TRUE;
+}
+
+BOOL  SetScrollRange (HWND hWnd, int iSBar, int iMinPos, int iMaxPos)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    RECT rcBar;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    pSBar->minPos = (iMinPos < iMaxPos)?iMinPos:iMaxPos;
+    pSBar->maxPos = (iMinPos > iMaxPos)?iMinPos:iMaxPos;
+    
+    // validate parameters.
+    if (pSBar->curPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+
+    if (pSBar->pageStep <= 0)
+        pSBar->pageStep = 0;
+    else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1))
+        pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1;
+    
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+
+    if (iSBar == SB_VERT)
+        wndGetVScrollBarRect (pWin, &rcBar);
+    else
+        wndGetHScrollBarRect (pWin, &rcBar);
+
+    rcBar.left -= pWin->winrect.left/*left*/;
+    rcBar.top  -= pWin->winrect.top/*top*/;
+    rcBar.right -= pWin->winrect.left/*left*/;
+    rcBar.bottom -= pWin->winrect.top/*top*/;
+
+    wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar);
+
+    if (iSBar == SB_VERT) {
+        rcBar.top += GetMainWinMetrics (MWM_CYVSCROLL);
+        rcBar.bottom -= GetMainWinMetrics (MWM_CYVSCROLL);
+    }
+    else {
+        rcBar.left += GetMainWinMetrics (MWM_CXHSCROLL);
+        rcBar.right -= GetMainWinMetrics (MWM_CXHSCROLL);
+    }
+
+    SendMessage/*SendAsyncMessage*/ (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+
+    return TRUE;
+}
+
+BOOL  SetScrollInfo (HWND hWnd, int iSBar, 
+                LPCSCROLLINFO lpsi, BOOL fRedraw)//!!
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    RECT rcBar;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+        
+    if( lpsi->fMask & SIF_RANGE )
+    {
+        pSBar->minPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMin:lpsi->nMax;
+        pSBar->maxPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMax:lpsi->nMin;
+    }
+    
+    if( lpsi->fMask & SIF_POS )
+        pSBar->curPos = lpsi->nPos;
+    
+    if( lpsi->fMask & SIF_PAGE )
+        pSBar->pageStep = lpsi->nPage;
+
+    // validate parameters.
+    if (pSBar->curPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+
+    if (pSBar->pageStep <= 0)
+        pSBar->pageStep = 0;
+    else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1))
+        pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1;
+    
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+
+    if(fRedraw)
+    {
+        if (iSBar == SB_VERT)
+            wndGetVScrollBarRect (pWin, &rcBar);
+        else
+            wndGetHScrollBarRect (pWin, &rcBar);
+        
+        rcBar.left -= pWin->winrect.left/*left*/;
+        rcBar.top  -= pWin->winrect.top/*top*/;
+        rcBar.right -= pWin->winrect.left/*left*/;
+        rcBar.bottom -= pWin->winrect.top/*top*/;
+    
+        wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar);
+
+        if (iSBar == SB_VERT) {
+            rcBar.top += GetMainWinMetrics (MWM_CYVSCROLL);
+            rcBar.bottom -= GetMainWinMetrics (MWM_CYVSCROLL);
+        }
+        else {
+            rcBar.left += GetMainWinMetrics (MWM_CXHSCROLL);
+            rcBar.right -= GetMainWinMetrics (MWM_CXHSCROLL);
+        }
+
+        SendMessage/*SendAsyncMessage*/ (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+    }
+    
+    return TRUE;
+}
+
+BOOL  GetScrollInfo(HWND hWnd, int iSBar, LPSCROLLINFO lpsi)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+        
+    if( lpsi->fMask & SIF_RANGE )
+    {
+        lpsi->nMin = pSBar->minPos;
+        lpsi->nMax = pSBar->maxPos;
+    }
+    
+    if( lpsi->fMask & SIF_POS )
+    {
+        lpsi->nPos = pSBar->curPos;
+    }
+    
+    if( lpsi->fMask & SIF_PAGE )
+        lpsi->nPage = pSBar->pageStep;
+    
+    return TRUE;
+}
+
+BOOL  ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    BOOL bPrevState;
+    RECT rcBar;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    bPrevState = !(pSBar->status & SBS_HIDE);
+
+    if (bShow && !bPrevState)
+        pSBar->status &= ~SBS_HIDE;
+    else if (!bShow && bPrevState)
+        pSBar->status |= SBS_HIDE;
+    else
+        return FALSE;
+#if 0//fix: no WM_CHANGESIZE
+    SendMessage/*SendAsyncMessage*/ (hWnd, WM_CHANGESIZE, 0, 0);
+#endif
+    if (iSBar == SB_VERT)
+        wndGetVScrollBarRect (pWin, &rcBar);
+    else
+        wndGetHScrollBarRect (pWin, &rcBar);
+
+    {
+        RECT rcWin, rcClient;
+        
+        memcpy (&rcWin, &pWin->winrect.left/*left*/, sizeof (RECT));
+        
+        rcClient.left = 0;
+        rcClient.top  = 0;
+        rcClient.right = pWin->clirect.right/*cr*/ - pWin->clirect.left/*cl*/;
+        rcClient.bottom = pWin->clirect.bottom/*cb*/ - pWin->clirect.top/*ct*/;
+#if 0//fix: no WM_SIZECHANGED
+        SendMessage/*SendAsyncMessage*/ (hWnd, WM_SIZECHANGED, 
+            (WPARAM)&rcWin, (LPARAM)&rcClient);
+#endif
+    }
+    
+    if (bShow) {
+        SendMessage/*SendAsyncMessage*/ (hWnd, WM_NCPAINT, 0, 0);
+    }
+    else {
+        rcBar.left -= pWin->clirect.left/*cl*/;
+        rcBar.top  -= pWin->clirect.top/*ct*/;
+        rcBar.right -= pWin->clirect.left/*cl*/;
+        rcBar.bottom -= pWin->clirect.top/*ct*/;
+        SendMessage/*SendAsyncMessage*/ (hWnd, WM_NCPAINT, 0, 0);
+        InvalidateRect (hWnd, &rcBar, TRUE);
+    }
+
+    return TRUE;
+}
+
+//HWND  CreateWindow (const char* spClassName, const char* spCaption,
+//                  DWORD dwStyle, int id, 
+//                  int x, int y, int w, int h,
+//                  HWND hParentWnd, DWORD dwAddData)
+//{
+//    HWND pParentWin;
+//    PCTRLCLASSINFO cci;
+//    HWND pNewCtrl;
+//
+//    if (!(pParentWin = MainWindow (hParentWnd))) return HWND_INVALID;
+//
+//    cci = (PCTRLCLASSINFO)SendMessage (HWND_DESKTOP, 
+//                WM_GETCTRLCLASSINFO, 0, (LPARAM)spClassName);
+//                
+//    if (!cci) return HWND_INVALID;
+//
+//    pNewCtrl = malloc (sizeof (CONTROL));
+//
+//    if (!pNewCtrl) return HWND_INVALID;
+//
+//    pNewCtrl->DataType = TYPE_HWND;
+//    pNewCtrl->WinType  = TYPE_CONTROL;
+//
+//    pNewCtrl->left     = x;
+//    pNewCtrl->top      = y;
+//    pNewCtrl->right    = x + w;
+//    pNewCtrl->bottom   = y + h;
+//
+//    memcpy (&pNewCtrl->cl, &pNewCtrl->left, sizeof (RECT));
+//
+//    if (spCaption) {
+//        int len = strlen (spCaption);
+//        
+//        pNewCtrl->spCaption    = FixStrAlloc (len);
+//        if (len > 0)
+//            strcpy (pNewCtrl->spCaption, spCaption);
+//    }
+//    else
+//        pNewCtrl->spCaption = "";
+//        
+//    pNewCtrl->dwStyle  = dwStyle;
+//    pNewCtrl->id       = id;
+//
+//    pNewCtrl->pCaretInfo = NULL;
+//    
+//    pNewCtrl->dwAddData = dwAddData;
+//
+//    // Scroll bar//
+//    if (pNewCtrl->dwStyle && WS_VSCROLL) {//
+//        pNewCtrl->vscroll.minPos = 0;//
+//        pNewCtrl->vscroll.maxPos = 100;//
+//        pNewCtrl->vscroll.curPos = 0;//
+//        pNewCtrl->vscroll.pageStep = 0;//
+//        pNewCtrl->vscroll.barStart = 0;//
+//        pNewCtrl->vscroll.barLen = 10;//
+//        pNewCtrl->vscroll.status = SBS_NORMAL;//
+//    }//
+//    else//
+//        pNewCtrl->vscroll.status = SBS_HIDE | SBS_DISABLED;//
+////
+//    if (pNewCtrl->dwStyle && WS_HSCROLL) {//
+//        pNewCtrl->hscroll.minPos = 0;//
+//        pNewCtrl->hscroll.maxPos = 100;//
+//        pNewCtrl->hscroll.curPos = 0;//
+//        pNewCtrl->hscroll.pageStep = 0;//
+//        pNewCtrl->hscroll.barStart = 0;//
+//        pNewCtrl->hscroll.barLen = 10;//
+//        pNewCtrl->hscroll.status = SBS_NORMAL;//
+//    }//
+//    else//
+//        pNewCtrl->hscroll.status = SBS_HIDE | SBS_DISABLED;//
+//
+//    pNewCtrl->children = NULL;              // always be NULL.
+//    pNewCtrl->active   = NULL;              // always be NULL.
+//
+//    pNewCtrl->pMainWin = pParentWin;
+//    pNewCtrl->next     = NULL;
+//
+//    pNewCtrl->pcci     = cci;
+//
+//    if (SendMessage ((HWND)pNewCtrl, WM_NCCREATE, 0, (LPARAM)pNewCtrl)) {
+//        free (pNewCtrl);
+//        return HWND_INVALID;
+//    }
+//#if 0//fix: no WM_CHANGESIZE
+//    SendMessage ((HWND)pNewCtrl, WM_CHANGESIZE, 
+//                    (WPARAM)(&pNewCtrl->left), 0);
+//#endif
+//    if (SendMessage ((HWND)pNewCtrl, WM_CREATE, 
+//        (WPARAM)hParentWnd, (LPARAM)dwAddData)) {
+//        
+//        free (pNewCtrl);
+//        return HWND_INVALID;
+//    }
+//
+//    {
+//        RECT rcWin, rcClient;
+//        
+//        memcpy (&rcWin, &pNewCtrl->left, sizeof (RECT));
+//        
+//        rcClient.left = 0;
+//        rcClient.top  = 0;
+//        rcClient.right = pNewCtrl->cr - pNewCtrl->cl;
+//        rcClient.bottom = pNewCtrl->cb - pNewCtrl->ct;
+//#if 0//fix: no WM_SIZECHANGED
+//        SendMessage/*SendAsyncMessage*/ ((HWND)pNewCtrl, WM_SIZECHANGED, 
+//            (WPARAM)&rcWin, (LPARAM)&rcClient);
+//#endif
+//    }
+//
+//    if (cci->dwStyle & CS_OWNDC)
+//        pNewCtrl->privCDC = CreatePrivateClientDC ((HWND)pNewCtrl);
+//    else
+//        pNewCtrl->privCDC = 0;
+//        
+//    SendMessage (HWND_DESKTOP, 
+//        WM_NEWCTRLINSTANCE, (WPARAM)hParentWnd, (LPARAM)pNewCtrl);
+//        
+//    // reset static variables
+//    DefaultMouseMsgHandler(HWND_DESKTOP, WM_WINDOWCHANGED, 0, 0, 0);
+//
+//    return (HWND)pNewCtrl;
+//}
+#endif
diff -urN lib/microwindows/src/mwin/winsbar.2 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winsbar.2
--- lib/microwindows/src/mwin/winsbar.2	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winsbar.2	2005-02-21 16:03:44.000000000 +0100
@@ -0,0 +1,940 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1999, 2000, Wei Yongming.
+ * jmt: scrollbar thumb ported
+ *
+ * Microwindows win32 NonClient Scrollbars
+ */
+#define MWINCLUDECOLORS//jmt: for color macros
+#include "windows.h"
+#include "wintern.h"
+#include "wintools.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>//printf
+/* scrollbar status/positions*/
+#define SBS_UNKNOWN		0x0000
+#define SBS_LEFTARROW		0x0001
+#define SBS_RIGHTARROW		0x0002
+#define SBS_LEFTSPACE		0x0004
+#define SBS_RIGHTSPACE		0x0008
+#define SBS_HORZTHUMB		0x0010
+#define SBS_UPARROW		0x0020
+#define SBS_DOWNARROW		0x0040
+#define SBS_UPSPACE		0x0080
+#define SBS_DOWNSPACE		0x0100
+#define SBS_VERTTHUMB		0x0200
+#define SBS_MASK		0x03ff
+#define SBS_DISABLED		0x4000
+#define SBS_HIDE		0x8000
+
+#define HSCROLLBARVISIBLE(hwnd)	((hwnd)->style & WS_HSCROLL)
+#define VSCROLLBARVISIBLE(hwnd)	((hwnd)->style & WS_VSCROLL)
+
+//#
+
+/****************************** Drawing Helpers *******************************/
+static void
+Draw3DUpFrame(HDC hDC, int l, int t, int r, int b)
+{
+	RECT	rc;
+	HBRUSH	hbr;
+
+	SetRect(&rc, l, t, r, b);
+	Draw3dBox(hDC, rc.left, rc.top,
+		rc.right-rc.left, rc.bottom-rc.top,
+		GetSysColor(COLOR_3DLIGHT),
+		GetSysColor(COLOR_WINDOWFRAME));
+	InflateRect(&rc, -1, -1);
+	Draw3dBox(hDC, rc.left, rc.top,
+		rc.right-rc.left, rc.bottom-rc.top,
+		GetSysColor(COLOR_BTNHIGHLIGHT),
+		GetSysColor(COLOR_BTNSHADOW));
+	InflateRect(&rc, -1, -1);
+
+	hbr = CreateSolidBrush(LTGRAY);
+	FillRect(hDC, &rc, hbr);
+	DeleteObject(hbr);
+}
+
+
+/* 
+ * Adjust client area smaller if scrollbars visible.
+ * Also, compute the NC hittest regions for the scrollbars.
+ */
+void
+MwAdjustNCScrollbars(HWND hwnd)
+{
+	BOOL	vertbar = VSCROLLBARVISIBLE(hwnd);
+        BOOL	horzbar = HSCROLLBARVISIBLE(hwnd);
+
+	if (vertbar) {
+		hwnd->clirect.right -= mwSYSMETRICS_CXVSCROLL;
+		if (horzbar)
+			hwnd->clirect.bottom -= mwSYSMETRICS_CYHSCROLL;
+		hwnd->vscroll.rc.left = hwnd->clirect.right;
+		hwnd->vscroll.rc.right = hwnd->clirect.right +
+			mwSYSMETRICS_CXVSCROLL;
+		hwnd->vscroll.rc.top = hwnd->clirect.top;
+		hwnd->vscroll.rc.bottom = hwnd->clirect.bottom;
+	} else
+		SetRectEmpty(&hwnd->vscroll.rc);
+	if (horzbar) {
+		if (!vertbar)
+			hwnd->clirect.bottom -= mwSYSMETRICS_CYHSCROLL;
+		hwnd->hscroll.rc.top = hwnd->clirect.bottom;
+		hwnd->hscroll.rc.bottom = hwnd->clirect.bottom +
+			mwSYSMETRICS_CYHSCROLL;
+		hwnd->hscroll.rc.left = hwnd->clirect.left;
+		hwnd->hscroll.rc.right = hwnd->clirect.right;
+	} else
+		SetRectEmpty(&hwnd->hscroll.rc);
+}
+
+static int
+wndGetBorder(HWND hwnd)
+{
+	if (hwnd->style & WS_BORDER)  {
+		if ((hwnd->style & WS_CAPTION) == WS_CAPTION)
+			return mwSYSMETRICS_CXFRAME;
+		return mwSYSMETRICS_CXBORDER;
+	}
+	return 0;
+}
+
+static BOOL
+wndGetVScrollBarRect (HWND hwnd, RECT* rcVBar)
+{
+    if (hwnd->style & WS_VSCROLL) {
+        rcVBar->left = hwnd->winrect.right - mwSYSMETRICS_CXVSCROLL
+                        - wndGetBorder (hwnd);
+        rcVBar->right = hwnd->winrect.right - wndGetBorder (hwnd);
+        rcVBar->top  = hwnd->clirect.top;
+        rcVBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd);
+
+        if (hwnd->style & WS_HSCROLL && !(hwnd->hscroll.status & SBS_HIDE))
+            rcVBar->bottom -= mwSYSMETRICS_CYHSCROLL;
+        
+        return TRUE;
+    }
+    
+    return FALSE;
+}
+
+static BOOL
+wndGetHScrollBarRect (HWND hwnd, RECT* rcHBar)
+{
+    if (hwnd->style & WS_HSCROLL) {
+        rcHBar->top = hwnd->winrect.bottom - mwSYSMETRICS_CYHSCROLL
+                        - wndGetBorder (hwnd);
+        rcHBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd);
+        rcHBar->left  = hwnd->clirect.left;
+        rcHBar->right = hwnd->winrect.right - wndGetBorder (hwnd);
+
+        if (hwnd->style & WS_VSCROLL && !(hwnd->vscroll.status & SBS_HIDE))
+            rcHBar->right -= mwSYSMETRICS_CXVSCROLL;
+
+        return TRUE;
+    }
+    
+    return FALSE;
+}
+
+void
+MwPaintNCScrollbars(HWND hwnd, HDC hdc)
+{
+	BOOL	vertbar = VSCROLLBARVISIBLE(hwnd);
+        BOOL	horzbar = HSCROLLBARVISIBLE(hwnd);
+	BOOL	fGotDC = FALSE;
+	RECT	rc,rc2;
+
+	POINT	p3[3];
+	int	shrink=2;
+
+        int start = 0;
+        RECT rcHBar, rcVBar;
+
+
+	if (!hdc && (horzbar || vertbar)) {
+		hdc = GetWindowDC(hwnd);
+		fGotDC = TRUE;
+	}
+
+	if (horzbar && vertbar) {
+		rc.left = hwnd->clirect.right;
+		rc.top = hwnd->clirect.bottom;
+		rc.right = rc.left + mwSYSMETRICS_CXVSCROLL;
+		rc.bottom = rc.top + mwSYSMETRICS_CYHSCROLL;
+		FillRect(hdc, &rc, (HBRUSH)(COLOR_BTNFACE+1));
+	}
+	if (vertbar) {
+		rc = hwnd->vscroll.rc;
+
+		/* bkgnd */
+		FillRect(hdc, &rc, (HBRUSH)(COLOR_BTNFACE+1));
+
+		/* up */
+		Draw3dUpDownState(hdc, rc.left, rc.top,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->vscroll.status & SBS_UPARROW);
+		/* down */
+		Draw3dUpDownState(hdc, rc.left,rc.bottom-mwSYSMETRICS_CYHSCROLL,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->vscroll.status & SBS_DOWNARROW);
+#if 1//jmt: draw arrows
+		SelectObject(hdc,GetStockObject(BLACK_BRUSH));
+		/* up */
+		p3[0].x= rc.left + (mwSYSMETRICS_CXVSCROLL/2) - 1;
+		p3[0].y= rc.top + 2 + shrink;
+		p3[1].x= rc.left + 2 + shrink - 1;
+		p3[1].y= rc.top + (mwSYSMETRICS_CYHSCROLL-4) - shrink;
+		p3[2].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink;
+		p3[2].y= rc.top + (mwSYSMETRICS_CYHSCROLL-4) - shrink;
+		Polygon(hdc,p3,3);
+		/* down */
+		p3[0].x= rc.left + (mwSYSMETRICS_CXVSCROLL/2) - 1;
+		p3[0].y= rc.bottom - 4 - shrink;
+		p3[1].x= rc.left + 2 + shrink - 1;
+		p3[1].y= rc.bottom-mwSYSMETRICS_CYHSCROLL + 2 + shrink;
+		p3[2].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink;
+		p3[2].y= rc.bottom-mwSYSMETRICS_CYHSCROLL + 2 + shrink;
+		Polygon(hdc,p3,3);
+#endif
+#if 1
+        	// draw moving bar
+
+    		wndGetVScrollBarRect (hwnd, &rcVBar);
+    		rcVBar.left -- ;
+    		rcVBar.right -- ;
+
+        	start = rcVBar.top + mwSYSMETRICS_CYVSCROLL + hwnd->vscroll.barStart;
+                    
+        	if (start + hwnd->vscroll.barLen > rcVBar.bottom)
+            		start = rcVBar.bottom - hwnd->vscroll.barLen;
+
+		if (hwnd->vscroll.barLen == 0)
+			hwnd->vscroll.barLen=rc.bottom-rc.top-(mwSYSMETRICS_CYVSCROLL*2); 
+		
+		/* bkgnd */
+		rc2.left=rc.left; rc2.right=rc.right/*-1*/;
+		rc2.top=rc.top+mwSYSMETRICS_CYHSCROLL;
+		rc2.bottom=start;
+		if (rc2.bottom>rc2.top)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+		rc2.top=start+hwnd->vscroll.barLen;
+		rc2.bottom=rc.bottom-mwSYSMETRICS_CYHSCROLL;
+		if (rc2.bottom>rc2.top)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+        	Draw3DUpFrame (hdc, rcVBar.left, start, rcVBar.right,
+	    		start + hwnd->vscroll.barLen);
+#if 0
+		printf("barv:(l,t,r,b):(%d,%d,%d,%d)\n",
+        		rcVBar.left, start, rcVBar.right,
+	    		start + hwnd->vscroll.barLen);
+#endif
+#endif
+	}
+	if (horzbar) {
+		rc = hwnd->hscroll.rc;
+
+		/* bkgnd */
+		FillRect(hdc, &rc, (HBRUSH)(COLOR_BTNFACE+1));
+
+		/* left */
+		Draw3dUpDownState(hdc, rc.left, rc.top,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->hscroll.status & SBS_LEFTARROW);
+		/* right */
+		Draw3dUpDownState(hdc, rc.right-mwSYSMETRICS_CXVSCROLL, rc.top,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->hscroll.status & SBS_RIGHTARROW);
+#if 1//jmt: draw arrows
+		SelectObject(hdc,GetStockObject(BLACK_BRUSH));
+		/* left */
+		p3[0].x= rc.left + 2 + shrink;
+		p3[0].y= rc.top + (mwSYSMETRICS_CYHSCROLL/2) ;
+		p3[1].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink ;
+		p3[1].y= rc.top + 2 + shrink;
+		p3[2].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink;
+		p3[2].y= rc.bottom - 4 - shrink + 1;
+		Polygon(hdc,p3,3);
+		/* right */
+		p3[0].x= rc.right - 4 - shrink;
+		p3[0].y= rc.top + (mwSYSMETRICS_CYHSCROLL/2) ;
+		p3[1].x= rc.right-mwSYSMETRICS_CXVSCROLL + 2 + shrink ;
+		p3[1].y= rc.top + 2 + shrink;
+		p3[2].x= rc.right-mwSYSMETRICS_CXVSCROLL + 2 + shrink;
+		p3[2].y= rc.bottom - 4 - shrink + 1;
+		Polygon(hdc,p3,3);
+#endif
+#if 1
+        	// draw moving bar.
+
+    		wndGetHScrollBarRect (hwnd, &rcHBar);
+    		rcHBar.top -- ;
+    		rcHBar.bottom -- ;
+
+        	start = rcHBar.left + mwSYSMETRICS_CXHSCROLL + hwnd->hscroll.barStart;
+
+        	if (start + hwnd->hscroll.barLen > rcHBar.right)
+            		start = rcHBar.right - hwnd->hscroll.barLen;
+
+		if (hwnd->hscroll.barLen == 0)
+			hwnd->hscroll.barLen=rc.right-rc.left-(mwSYSMETRICS_CXHSCROLL*2); 
+
+		/* bkgnd */
+		rc2.top=rc.top; rc2.bottom=rc.bottom/*-1*/;
+		rc2.left=rc.left+mwSYSMETRICS_CXVSCROLL;
+		rc2.right=start;
+		if (rc2.right>rc2.left)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+		rc2.left=start+hwnd->hscroll.barLen;
+		rc2.right=rc.right-mwSYSMETRICS_CXVSCROLL;
+		if (rc2.right>rc2.left)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+        	Draw3DUpFrame (hdc, start, rcHBar.top, start + hwnd->hscroll.barLen,
+	    		rcHBar.bottom);
+#if 0
+		printf("barh:(l,t,r,b):(%d,%d,%d,%d)\n",
+        		start, rcHBar.top, start + hwnd->hscroll.barLen,
+	    		rcHBar.bottom);
+#endif
+#endif
+	}
+
+	if (fGotDC)
+		ReleaseDC(hwnd, hdc);
+}
+
+/* handle a non-client message for a scrollbar*/
+void
+MwHandleNCMessageScrollbar(HWND hwnd, WPARAM hitcode, LPARAM lParam, UINT msg/*BOOL fDown*/)
+{
+	int	pos = SBS_UNKNOWN;
+	BOOL	vertbar = VSCROLLBARVISIBLE(hwnd);
+        BOOL	horzbar = HSCROLLBARVISIBLE(hwnd);
+	int *	pStat;
+	POINT	pt;
+	RECT	rc;
+
+	static BOOL bDraw;
+
+    	static int downPos = SBS_UNKNOWN;//
+    	static int sbCode;
+    	int newThumbPos;
+
+	int itemMoveable,itemCount,itemVisible,moveRange;//jmt:2k0819
+	int moveTop,moveBottom,moveLeft,moveRight;//jmt:2k0819
+
+	POINTSTOPOINT(pt, lParam);
+	for (;;) {	/* use for() to allow break statement*/
+		if (hitcode == HTVSCROLL && vertbar) 
+		{
+			pStat = &hwnd->vscroll.status;
+			rc = hwnd->vscroll.rc;
+			rc.bottom = rc.top + mwSYSMETRICS_CYVSCROLL;
+			if (PtInRect(&rc, pt)) 
+			{
+				pos = SBS_UPARROW;
+				break;
+			}
+			rc.bottom = hwnd->vscroll.rc.bottom;
+			rc.top = rc.bottom - mwSYSMETRICS_CYVSCROLL;
+			if (PtInRect(&rc, pt)) 
+			{
+				pos = SBS_DOWNARROW;
+				break;
+			}
+			pos = SBS_VERTTHUMB;
+		} else if (hitcode == HTHSCROLL && horzbar) 
+		{
+			pStat = &hwnd->hscroll.status;
+			rc = hwnd->hscroll.rc;
+			rc.right = rc.left + mwSYSMETRICS_CXHSCROLL;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_LEFTARROW;
+				break;
+			}
+			rc.right = hwnd->hscroll.rc.right;
+			rc.left = rc.right - mwSYSMETRICS_CXHSCROLL;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_RIGHTARROW;
+				break;
+			}
+			pos = SBS_HORZTHUMB;
+		} else
+			return;
+		break;
+	}
+
+	if (pos == SBS_UNKNOWN)
+		return;
+
+	*pStat &= ~SBS_MASK;		/* remove stray mouse states*/
+
+	if (msg == WM_NCLBUTTONDOWN || msg == WM_NCLBUTTONDBLCLK)//jmt:2k0819
+		*pStat |= pos;
+	else *pStat &= ~pos;
+
+	if (msg == WM_NCLBUTTONDOWN || msg == WM_NCLBUTTONDBLCLK)//jmt:2k0819
+		bDraw=TRUE;
+
+	if (bDraw)
+		MwPaintNCScrollbars(hwnd, NULL);
+
+        if (pos == SBS_UPARROW || pos == SBS_LEFTARROW)//jmt:2k0820 
+	{
+                if (hwnd->vscroll.curPos != hwnd->vscroll.minPos)
+			sbCode = SB_LINEUP;
+        }
+        else if (pos == SBS_DOWNARROW || pos == SBS_RIGHTARROW)//jmt:2k0820 
+	{
+                if (hwnd->vscroll.curPos != hwnd->vscroll.maxPos)
+			sbCode = SB_LINEDOWN;
+        }
+        else if (pos == SBS_VERTTHUMB || pos == SBS_HORZTHUMB)// 
+	{
+                sbCode = SB_THUMBTRACK;//
+        }
+
+	switch(msg)
+	{
+	case WM_NCLBUTTONDOWN:
+	case WM_NCLBUTTONDBLCLK://jmt:2k0819
+	    downPos = pos;
+        break;
+
+        case WM_NCMOUSEMOVE://jmt:2k0819
+	    if (hitcode == HTVSCROLL && vertbar) 
+	    {
+		if (sbCode == SB_THUMBTRACK && downPos == SBS_VERTTHUMB)// 
+	    	{
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->vscroll.rc;
+			moveTop = rc.top + mwSYSMETRICS_CYVSCROLL;
+			moveBottom = hwnd->vscroll.rc.bottom - mwSYSMETRICS_CYVSCROLL;
+			moveRange = moveBottom - moveTop;
+
+			itemCount = hwnd->vscroll.maxPos - hwnd->vscroll.minPos + 1;
+			itemVisible = hwnd->vscroll.pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.y - moveTop) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveTop,itemMoveable,moveRange,newThumbPos);
+			//#
+
+                	if ( newThumbPos >= hwnd->vscroll.minPos &&
+                    	     newThumbPos <= hwnd->vscroll.maxPos)
+                    		SendMessage (hwnd,
+                        		WM_VSCROLL, SB_THUMBTRACK, newThumbPos);
+                	break;
+            	}
+	    }
+
+	    if (hitcode == HTHSCROLL && horzbar) 
+	    {
+		if (sbCode == SB_THUMBTRACK && downPos == SBS_HORZTHUMB)// 
+		{
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->hscroll.rc;
+			moveLeft = rc.left + mwSYSMETRICS_CXHSCROLL;
+			moveRight = hwnd->hscroll.rc.right - mwSYSMETRICS_CXHSCROLL;
+			moveRange = moveRight - moveLeft;
+
+			itemCount = hwnd->hscroll.maxPos - hwnd->hscroll.minPos + 1;
+			itemVisible = hwnd->hscroll.pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.x - moveLeft) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveLeft,itemMoveable,moveRange,newThumbPos);
+			//#
+    
+			if ( newThumbPos >= hwnd->hscroll.minPos &&
+			     newThumbPos <= hwnd->hscroll.maxPos)
+			    	SendMessage (hwnd,
+					WM_HSCROLL, SB_THUMBTRACK, newThumbPos);
+			break;
+		}
+             }
+
+        break;
+
+	case WM_NCLBUTTONUP://jmt:2k0819
+	    bDraw=FALSE;
+	    downPos = SBS_UNKNOWN;//
+
+	    if (sbCode==SB_THUMBTRACK)
+	    {
+		    if (hitcode == HTVSCROLL && vertbar) 
+		    {
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->vscroll.rc;
+			moveTop = rc.top + mwSYSMETRICS_CYVSCROLL;
+			moveBottom = hwnd->vscroll.rc.bottom - mwSYSMETRICS_CYVSCROLL;
+			moveRange = moveBottom - moveTop;
+
+			itemCount = hwnd->vscroll.maxPos - hwnd->vscroll.minPos + 1;
+			itemVisible = hwnd->vscroll.pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.y - moveTop) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveTop,itemMoveable,moveRange,newThumbPos);
+			//#
+			if ( newThumbPos >= hwnd->vscroll.minPos &&
+			     newThumbPos <= hwnd->vscroll.maxPos)
+				SendMessage (hwnd,
+					WM_VSCROLL, SB_THUMBTRACK, newThumbPos);
+			break;
+		    }
+
+		    if (hitcode == HTHSCROLL && horzbar) 
+		    {
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->hscroll.rc;
+			moveLeft = rc.left + mwSYSMETRICS_CXHSCROLL;
+			moveRight = hwnd->hscroll.rc.right - mwSYSMETRICS_CXHSCROLL;
+			moveRange = moveRight - moveLeft;
+
+			itemCount = hwnd->hscroll.maxPos - hwnd->hscroll.minPos + 1;
+			itemVisible = hwnd->hscroll.pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.x - moveLeft) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveLeft,itemMoveable,moveRange,newThumbPos);
+			//#
+    
+			if ( newThumbPos >= hwnd->hscroll.minPos &&
+			     newThumbPos <= hwnd->hscroll.maxPos)
+				SendMessage (hwnd,
+					WM_HSCROLL, SB_THUMBTRACK, newThumbPos);
+			break;
+		    }
+	     }
+	     else//jmt:2k0820
+	     {
+		    if (hitcode == HTVSCROLL && vertbar) 
+			SendMessage (hwnd, WM_VSCROLL, sbCode, 0);
+
+		    if (hitcode == HTHSCROLL && horzbar) 
+			SendMessage (hwnd, WM_HSCROLL, sbCode, 0);
+	     }
+	break;
+	}
+
+}
+
+
+static BOOL
+PtInRect2(const RECT *lprc, int x, int y)
+{
+	POINT	p;
+
+	p.x = x;
+	p.y = y;
+	return PtInRect(lprc, p);
+}
+
+#if 1//0000
+
+
+static void
+wndScrollBarPos (HWND hwnd, BOOL bIsHBar, RECT* rcBar)
+{
+    UINT moveRange;
+    PMWSCROLLBARINFO pSBar;
+
+    if (bIsHBar)
+        pSBar = &hwnd->hscroll;
+    else
+        pSBar = &hwnd->vscroll;
+
+    if (pSBar->minPos == pSBar->maxPos) {
+        pSBar->status |= SBS_HIDE;
+        return;
+    }
+
+    if (bIsHBar)
+        moveRange = (rcBar->right - rcBar->left) - (mwSYSMETRICS_CXHSCROLL<<1);
+    else
+        moveRange = (rcBar->bottom - rcBar->top) - (mwSYSMETRICS_CYVSCROLL<<1);
+
+#define MWM_DEFBARLEN	18//
+#define MWM_MINBARLEN	8//
+
+    if (pSBar->pageStep == 0) 
+    {
+        pSBar->barLen = MWM_DEFBARLEN;
+
+        if (pSBar->barLen > moveRange)
+            pSBar->barLen = MWM_MINBARLEN;
+    }
+    else 
+    {
+        pSBar->barLen = moveRange * pSBar->pageStep /
+	      (pSBar->maxPos - pSBar->minPos + 1);
+        if (pSBar->barLen < MWM_MINBARLEN)
+            pSBar->barLen = MWM_MINBARLEN;
+    }
+
+    pSBar->barStart = moveRange * (pSBar->curPos - pSBar->minPos) /
+       (pSBar->maxPos - pSBar->minPos + 1);
+
+
+    if (pSBar->barStart + pSBar->barLen > moveRange)
+        pSBar->barStart = moveRange - pSBar->barLen;
+
+
+    if (pSBar->barStart < 0)
+        pSBar->barStart = 0;
+}
+
+static PMWSCROLLBARINFO wndGetScrollBar (HWND pWin, int iSBar)
+{
+    if (iSBar == SB_HORZ) {
+        if (pWin->style & WS_HSCROLL)
+            return &pWin->hscroll;
+    }
+    else if (iSBar == SB_VERT) {
+        if (pWin->style & WS_VSCROLL)
+            return &pWin->vscroll;
+    }
+
+    return NULL;
+}
+
+BOOL EnableScrollBar (HWND hWnd, int iSBar, BOOL bEnable)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    BOOL bPrevState;
+    RECT rcBar;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )//ok
+        return FALSE;
+
+    bPrevState = !(pSBar->status & SBS_DISABLED);
+
+    if (bEnable && !bPrevState)
+        pSBar->status &= ~SBS_DISABLED;
+    else if (!bEnable && bPrevState)
+        pSBar->status |= SBS_DISABLED;
+    else
+        return FALSE;
+
+    if (iSBar == SB_VERT)
+    {
+        wndGetVScrollBarRect (pWin, &rcBar);
+        rcBar.left --;
+        rcBar.right --;
+    }
+    else
+    {
+        wndGetHScrollBarRect (pWin, &rcBar);
+        rcBar.top  --;
+        rcBar.bottom --;
+    }
+#if 0
+    SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+    MwPaintNCScrollbars(hWnd,NULL);//a must
+#endif
+
+    return TRUE;
+}
+
+BOOL  GetScrollPos (HWND hWnd, int iSBar, int* pPos)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    *pPos = pSBar->curPos;
+    return TRUE;
+}
+
+BOOL  GetScrollRange (HWND hWnd, int iSBar, int* pMinPos, int* pMaxPos)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    *pMinPos = pSBar->minPos;
+    *pMaxPos = pSBar->maxPos;
+    return TRUE;
+}
+
+BOOL  SetScrollPos (HWND hWnd, int iSBar, int iNewPos)//ok
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    RECT rcBar;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    if (iNewPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+    else
+        pSBar->curPos = iNewPos;
+
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+    
+    if (iSBar == SB_VERT)
+    {
+        wndGetVScrollBarRect (pWin, &rcBar);
+        rcBar.left --;
+        rcBar.right --;
+    }
+    else
+    {
+        wndGetHScrollBarRect (pWin, &rcBar);
+        rcBar.top  --;
+        rcBar.bottom --;
+    }
+
+    wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar);
+
+#if 0
+    SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+    MwPaintNCScrollbars(hWnd,NULL);//a must
+#endif
+    return TRUE;
+}
+
+BOOL  SetScrollRange (HWND hWnd, int iSBar, int iMinPos, int iMaxPos)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    RECT rcBar;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    pSBar->minPos = (iMinPos < iMaxPos)?iMinPos:iMaxPos;
+    pSBar->maxPos = (iMinPos > iMaxPos)?iMinPos:iMaxPos;
+    
+    // validate parameters.
+    if (pSBar->curPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+
+    if (pSBar->pageStep <= 0)
+        pSBar->pageStep = 0;
+    else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1))
+        pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1;
+    
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+
+    if (iSBar == SB_VERT)
+    {
+        wndGetVScrollBarRect (pWin, &rcBar);
+    	rcBar.left --;
+      	rcBar.right --;
+    }
+    else
+    {
+        wndGetHScrollBarRect (pWin, &rcBar);
+    	rcBar.top  --;
+    	rcBar.bottom --;
+    }
+    wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar);
+
+#if 0
+    SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+    MwPaintNCScrollbars(hWnd,NULL);//a must
+#endif
+
+    return TRUE;
+}
+
+BOOL  SetScrollInfo (HWND hWnd, int iSBar, 
+                LPCSCROLLINFO lpsi, BOOL fRedraw)//ok
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    RECT rcBar;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+        
+    if( lpsi->fMask & SIF_RANGE )
+    {
+        pSBar->minPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMin:lpsi->nMax;
+        pSBar->maxPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMax:lpsi->nMin;
+    }
+    
+    if( lpsi->fMask & SIF_POS )
+        pSBar->curPos = lpsi->nPos;
+    
+    if( lpsi->fMask & SIF_PAGE )
+        pSBar->pageStep = lpsi->nPage;
+
+    // validate parameters.
+    if (pSBar->curPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+
+    if (pSBar->pageStep <= 0)
+        pSBar->pageStep = 0;
+    else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1))
+        pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1;
+    
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+
+    if(fRedraw)
+    {
+        if (iSBar == SB_VERT)
+	{
+            wndGetVScrollBarRect (pWin, &rcBar);
+            rcBar.left --;
+            rcBar.right --;
+	}
+        else
+	{
+            wndGetHScrollBarRect (pWin, &rcBar);
+            rcBar.top --;
+            rcBar.bottom --;
+	}
+        wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar);
+
+#if 0
+        SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+	MwPaintNCScrollbars(hWnd,NULL);//a must
+#endif
+    }
+    
+    return TRUE;
+}
+
+BOOL  GetScrollInfo(HWND hWnd, int iSBar, LPSCROLLINFO lpsi)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+        
+    if( lpsi->fMask & SIF_RANGE )
+    {
+        lpsi->nMin = pSBar->minPos;
+        lpsi->nMax = pSBar->maxPos;
+    }
+    
+    if( lpsi->fMask & SIF_POS )
+    {
+        lpsi->nPos = pSBar->curPos;
+    }
+    
+    if( lpsi->fMask & SIF_PAGE )
+        lpsi->nPage = pSBar->pageStep;
+    
+    return TRUE;
+}
+
+BOOL  ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    BOOL bPrevState;
+    RECT rcBar;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    bPrevState = !(pSBar->status & SBS_HIDE);
+
+    if (bShow && !bPrevState)
+        pSBar->status &= ~SBS_HIDE;
+    else if (!bShow && bPrevState)
+        pSBar->status |= SBS_HIDE;
+    else
+        return FALSE;
+#if 0//fix: no WM_CHANGESIZE
+    SendMessage (hWnd, WM_CHANGESIZE, 0, 0);
+#endif
+    if (iSBar == SB_VERT)
+        wndGetVScrollBarRect (pWin, &rcBar);
+    else
+        wndGetHScrollBarRect (pWin, &rcBar);
+
+    {
+        RECT rcWin, rcClient;
+        
+        memcpy (&rcWin, &pWin->winrect.left, sizeof (RECT));
+        
+        rcClient.left = 0;
+        rcClient.top  = 0;
+        rcClient.right = pWin->clirect.right - pWin->clirect.left;
+        rcClient.bottom = pWin->clirect.bottom - pWin->clirect.top;
+#if 0//fix: no WM_SIZECHANGED
+        SendMessage/*SendAsyncMessage*/ (hWnd, WM_SIZECHANGED, 
+            (WPARAM)&rcWin, (LPARAM)&rcClient);
+#endif
+    }
+    
+    if (bShow) {
+        SendMessage (hWnd, WM_NCPAINT, 0, 0);
+    }
+    else {
+        rcBar.left -= pWin->clirect.left;
+        rcBar.top  -= pWin->clirect.top;
+        rcBar.right -= pWin->clirect.left;
+        rcBar.bottom -= pWin->clirect.top;
+        SendMessage (hWnd, WM_NCPAINT, 0, 0);
+        InvalidateRect (hWnd, &rcBar, TRUE);
+    }
+
+    return TRUE;
+}
+#endif
diff -urN lib/microwindows/src/mwin/winsbar.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winsbar.c
--- lib/microwindows/src/mwin/winsbar.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winsbar.c	2005-02-21 16:13:29.000000000 +0100
@@ -0,0 +1,927 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1999, 2000, Wei Yongming.
+ * jmt: scrollbar thumb ported
+ *
+ * Microwindows win32 NonClient Scrollbars
+ */
+#define MWINCLUDECOLORS//jmt: for color macros
+#include "windows.h"
+#include "wintern.h"
+#include "wintools.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>//printf
+/* scrollbar status/positions*/
+#define SBS_UNKNOWN		0x0000
+#define SBS_LEFTARROW		0x0001
+#define SBS_RIGHTARROW		0x0002
+#define SBS_LEFTSPACE		0x0004
+#define SBS_RIGHTSPACE		0x0008
+#define SBS_HORZTHUMB		0x0010
+#define SBS_UPARROW		0x0020
+#define SBS_DOWNARROW		0x0040
+#define SBS_UPSPACE		0x0080
+#define SBS_DOWNSPACE		0x0100
+#define SBS_VERTTHUMB		0x0200
+#define SBS_MASK		0x03ff
+#define SBS_DISABLED		0x4000
+#define SBS_HIDE		0x8000
+
+#define HSCROLLBARVISIBLE(hwnd)	((hwnd)->style & WS_HSCROLL)
+#define VSCROLLBARVISIBLE(hwnd)	((hwnd)->style & WS_VSCROLL)
+
+/* 
+ * Adjust client area smaller if scrollbars visible.
+ * Also, compute the NC hittest regions for the scrollbars.
+ */
+void
+MwAdjustNCScrollbars(HWND hwnd)
+{
+	BOOL	vertbar = VSCROLLBARVISIBLE(hwnd);
+        BOOL	horzbar = HSCROLLBARVISIBLE(hwnd);
+
+	if (vertbar) {
+		hwnd->clirect.right -= mwSYSMETRICS_CXVSCROLL;
+		if (horzbar)
+			hwnd->clirect.bottom -= mwSYSMETRICS_CYHSCROLL;
+		hwnd->vscroll.rc.left = hwnd->clirect.right;
+		hwnd->vscroll.rc.right = hwnd->clirect.right +
+			mwSYSMETRICS_CXVSCROLL;
+		hwnd->vscroll.rc.top = hwnd->clirect.top;
+		hwnd->vscroll.rc.bottom = hwnd->clirect.bottom;
+	} else
+		SetRectEmpty(&hwnd->vscroll.rc);
+	if (horzbar) {
+		if (!vertbar)
+			hwnd->clirect.bottom -= mwSYSMETRICS_CYHSCROLL;
+		hwnd->hscroll.rc.top = hwnd->clirect.bottom;
+		hwnd->hscroll.rc.bottom = hwnd->clirect.bottom +
+			mwSYSMETRICS_CYHSCROLL;
+		hwnd->hscroll.rc.left = hwnd->clirect.left;
+		hwnd->hscroll.rc.right = hwnd->clirect.right;
+	} else
+		SetRectEmpty(&hwnd->hscroll.rc);
+}
+
+static int
+wndGetBorder(HWND hwnd)
+{
+	if (hwnd->style & WS_BORDER)  {
+		if ((hwnd->style & WS_CAPTION) == WS_CAPTION)
+			return mwSYSMETRICS_CXFRAME;
+		return mwSYSMETRICS_CXBORDER;
+	}
+	return 0;
+}
+
+static BOOL
+wndGetVScrollBarRect (HWND hwnd, RECT* rcVBar)
+{
+    if (hwnd->style & WS_VSCROLL) {
+        rcVBar->left = hwnd->winrect.right - mwSYSMETRICS_CXVSCROLL
+                        - wndGetBorder (hwnd);
+        rcVBar->right = hwnd->winrect.right - wndGetBorder (hwnd);
+        rcVBar->top  = hwnd->clirect.top;
+        rcVBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd);
+
+        if (hwnd->style & WS_HSCROLL && !(hwnd->hscroll.status & SBS_HIDE))
+            rcVBar->bottom -= mwSYSMETRICS_CYHSCROLL;
+        
+        return TRUE;
+    }
+    
+    return FALSE;
+}
+
+static BOOL
+wndGetHScrollBarRect (HWND hwnd, RECT* rcHBar)
+{
+    if (hwnd->style & WS_HSCROLL) {
+        rcHBar->top = hwnd->winrect.bottom - mwSYSMETRICS_CYHSCROLL
+                        - wndGetBorder (hwnd);
+        rcHBar->bottom = hwnd->winrect.bottom - wndGetBorder (hwnd);
+        rcHBar->left  = hwnd->clirect.left;
+        rcHBar->right = hwnd->winrect.right - wndGetBorder (hwnd);
+
+        if (hwnd->style & WS_VSCROLL && !(hwnd->vscroll.status & SBS_HIDE))
+            rcHBar->right -= mwSYSMETRICS_CXVSCROLL;
+
+        return TRUE;
+    }
+    
+    return FALSE;
+}
+
+void
+MwPaintNCScrollbars(HWND hwnd, HDC hdc)
+{
+	BOOL	vertbar = VSCROLLBARVISIBLE(hwnd);
+        BOOL	horzbar = HSCROLLBARVISIBLE(hwnd);
+	BOOL	fGotDC = FALSE;
+	RECT	rc,rc2;
+
+	POINT	p3[3];
+	int	shrink=2;
+
+        int start = 0;
+        RECT rcHBar, rcVBar;
+
+
+	if (!hdc && (horzbar || vertbar)) {
+		hdc = GetWindowDC(hwnd);
+		fGotDC = TRUE;
+	}
+
+	if (horzbar && vertbar) {
+		rc.left = hwnd->clirect.right;
+		rc.top = hwnd->clirect.bottom;
+		rc.right = rc.left + mwSYSMETRICS_CXVSCROLL;
+		rc.bottom = rc.top + mwSYSMETRICS_CYHSCROLL;
+		FillRect(hdc, &rc, (HBRUSH)(COLOR_BTNFACE+1));
+	}
+	if (vertbar) {
+		rc = hwnd->vscroll.rc;
+#if 1
+		/* bkgnd */
+		rc2.left=rc.left; rc2.right=rc2.left+ mwSYSMETRICS_CXVSCROLL;
+		rc2.top=rc.top;
+		rc2.bottom=rc2.top+ mwSYSMETRICS_CYHSCROLL;
+		FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1));
+		rc2.top=rc.bottom- mwSYSMETRICS_CYHSCROLL;
+		rc2.bottom=rc2.top+ mwSYSMETRICS_CYHSCROLL;
+		FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1));
+#endif
+		/* up */
+		Draw3dUpDownState(hdc, rc.left, rc.top,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->vscroll.status & SBS_UPARROW);
+		/* down */
+		Draw3dUpDownState(hdc, rc.left,rc.bottom-mwSYSMETRICS_CYHSCROLL,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->vscroll.status & SBS_DOWNARROW);
+//jmt: draw arrows
+		SelectObject(hdc,GetStockObject(BLACK_BRUSH));
+		/* up */
+		p3[0].x= rc.left + (mwSYSMETRICS_CXVSCROLL/2) - 1;
+		p3[0].y= rc.top + 2 + shrink;
+		p3[1].x= rc.left + 2 + shrink - 1;
+		p3[1].y= rc.top + (mwSYSMETRICS_CYHSCROLL-4) - shrink;
+		p3[2].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink;
+		p3[2].y= rc.top + (mwSYSMETRICS_CYHSCROLL-4) - shrink;
+		Polygon(hdc,p3,3);
+		/* down */
+		p3[0].x= rc.left + (mwSYSMETRICS_CXVSCROLL/2) - 1;
+		p3[0].y= rc.bottom - 4 - shrink;
+		p3[1].x= rc.left + 2 + shrink - 1;
+		p3[1].y= rc.bottom-mwSYSMETRICS_CYHSCROLL + 2 + shrink;
+		p3[2].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink;
+		p3[2].y= rc.bottom-mwSYSMETRICS_CYHSCROLL + 2 + shrink;
+		Polygon(hdc,p3,3);
+
+        	// draw moving bar
+
+    		wndGetVScrollBarRect (hwnd, &rcVBar);
+    		rcVBar.left -- ;
+    		rcVBar.right -- ;
+
+        	start = rcVBar.top + mwSYSMETRICS_CYVSCROLL + hwnd->vscroll.barStart;
+                    
+        	if (start + hwnd->vscroll.barLen > rcVBar.bottom)
+            		start = rcVBar.bottom - hwnd->vscroll.barLen;
+
+		if (hwnd->vscroll.barLen == 0)
+			hwnd->vscroll.barLen=rc.bottom-rc.top-(mwSYSMETRICS_CYVSCROLL*2); 
+		
+		/* bkgnd */
+		rc2.left=rc.left; rc2.right=rc.right/*-1*/;
+		rc2.top=rc.top+mwSYSMETRICS_CYHSCROLL;
+		rc2.bottom=start;
+		if (rc2.bottom>rc2.top)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+		rc2.top=start+hwnd->vscroll.barLen;
+		rc2.bottom=rc.bottom-mwSYSMETRICS_CYHSCROLL;
+		if (rc2.bottom>rc2.top)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+        	Draw3dUpFrame (hdc, rcVBar.left, start, rcVBar.right,
+	    		start + hwnd->vscroll.barLen);
+#if 0
+		printf("barv:(l,t,r,b):(%d,%d,%d,%d)\n",
+        		rcVBar.left, start, rcVBar.right,
+	    		start + hwnd->vscroll.barLen);
+#endif
+	}
+	if (horzbar) {
+		rc = hwnd->hscroll.rc;
+
+#if 1
+		/* bkgnd */
+		rc2.top=rc.top; rc2.bottom=rc2.top+ mwSYSMETRICS_CYHSCROLL;
+		rc2.left=rc.left;
+		rc2.right=rc2.left+ mwSYSMETRICS_CXVSCROLL;
+		FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1));
+		rc2.left=rc.right- mwSYSMETRICS_CXVSCROLL;
+		rc2.right=rc2.left+ mwSYSMETRICS_CXVSCROLL;
+		FillRect(hdc, &rc2, (HBRUSH)(COLOR_BTNFACE+1));
+#endif
+
+		/* left */
+		Draw3dUpDownState(hdc, rc.left, rc.top,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->hscroll.status & SBS_LEFTARROW);
+		/* right */
+		Draw3dUpDownState(hdc, rc.right-mwSYSMETRICS_CXVSCROLL, rc.top,
+			mwSYSMETRICS_CXVSCROLL, mwSYSMETRICS_CYHSCROLL,
+			hwnd->hscroll.status & SBS_RIGHTARROW);
+//jmt: draw arrows
+		SelectObject(hdc,GetStockObject(BLACK_BRUSH));
+		/* left */
+		p3[0].x= rc.left + 2 + shrink;
+		p3[0].y= rc.top + (mwSYSMETRICS_CYHSCROLL/2) ;
+		p3[1].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink ;
+		p3[1].y= rc.top + 2 + shrink;
+		p3[2].x= rc.left + (mwSYSMETRICS_CXVSCROLL-4) - shrink;
+		p3[2].y= rc.bottom - 4 - shrink + 1;
+		Polygon(hdc,p3,3);
+		/* right */
+		p3[0].x= rc.right - 4 - shrink;
+		p3[0].y= rc.top + (mwSYSMETRICS_CYHSCROLL/2) ;
+		p3[1].x= rc.right-mwSYSMETRICS_CXVSCROLL + 2 + shrink ;
+		p3[1].y= rc.top + 2 + shrink;
+		p3[2].x= rc.right-mwSYSMETRICS_CXVSCROLL + 2 + shrink;
+		p3[2].y= rc.bottom - 4 - shrink + 1;
+		Polygon(hdc,p3,3);
+
+        	// draw moving bar.
+
+    		wndGetHScrollBarRect (hwnd, &rcHBar);
+    		rcHBar.top -- ;
+    		rcHBar.bottom -- ;
+
+        	start = rcHBar.left + mwSYSMETRICS_CXHSCROLL + hwnd->hscroll.barStart;
+
+        	if (start + hwnd->hscroll.barLen > rcHBar.right)
+            		start = rcHBar.right - hwnd->hscroll.barLen;
+
+		if (hwnd->hscroll.barLen == 0)
+			hwnd->hscroll.barLen=rc.right-rc.left-(mwSYSMETRICS_CXHSCROLL*2); 
+
+		/* bkgnd */
+		rc2.top=rc.top; rc2.bottom=rc.bottom/*-1*/;
+		rc2.left=rc.left+mwSYSMETRICS_CXVSCROLL;
+		rc2.right=start;
+		if (rc2.right>rc2.left)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+		rc2.left=start+hwnd->hscroll.barLen;
+		rc2.right=rc.right-mwSYSMETRICS_CXVSCROLL;
+		if (rc2.right>rc2.left)
+			FillRect(hdc, &rc2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));   
+
+        	Draw3dUpFrame (hdc, start, rcHBar.top, start + hwnd->hscroll.barLen,
+	    		rcHBar.bottom);
+#if 0
+		printf("barh:(l,t,r,b):(%d,%d,%d,%d)\n",
+        		start, rcHBar.top, start + hwnd->hscroll.barLen,
+	    		rcHBar.bottom);
+#endif
+
+	}
+
+	if (fGotDC)
+		ReleaseDC(hwnd, hdc);
+}
+
+/* handle a non-client message for a scrollbar*/
+void
+MwHandleNCMessageScrollbar(HWND hwnd, UINT msg, WPARAM hitcode, LPARAM lParam)
+{
+	int	pos = SBS_UNKNOWN;
+	BOOL	vertbar = VSCROLLBARVISIBLE(hwnd);
+        BOOL	horzbar = HSCROLLBARVISIBLE(hwnd);
+	int *	pStat;
+	POINT	pt;
+	RECT	rc;
+
+	static BOOL bDraw;
+
+    	static int downPos = SBS_UNKNOWN;//
+    	static int sbCode;
+    	int newThumbPos;
+
+	int itemMoveable,itemCount,itemVisible,moveRange;//jmt:2k0819
+	int moveTop,moveBottom,moveLeft,moveRight;//jmt:2k0819
+
+	POINTSTOPOINT(pt, lParam);
+	for (;;) {	/* use for() to allow break statement*/
+		if (hitcode == HTVSCROLL && vertbar) 
+		{
+			pStat = &hwnd->vscroll.status;
+			rc = hwnd->vscroll.rc;
+			rc.bottom = rc.top + mwSYSMETRICS_CYVSCROLL;
+			if (PtInRect(&rc, pt)) 
+			{
+				pos = SBS_UPARROW;
+				break;
+			}
+			rc.bottom = hwnd->vscroll.rc.bottom;
+			rc.top = rc.bottom - mwSYSMETRICS_CYVSCROLL;
+			if (PtInRect(&rc, pt)) 
+			{
+				pos = SBS_DOWNARROW;
+				break;
+			}
+			pos = SBS_VERTTHUMB;
+		} else if (hitcode == HTHSCROLL && horzbar) 
+		{
+			pStat = &hwnd->hscroll.status;
+			rc = hwnd->hscroll.rc;
+			rc.right = rc.left + mwSYSMETRICS_CXHSCROLL;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_LEFTARROW;
+				break;
+			}
+			rc.right = hwnd->hscroll.rc.right;
+			rc.left = rc.right - mwSYSMETRICS_CXHSCROLL;
+			if (PtInRect(&rc, pt)) {
+				pos = SBS_RIGHTARROW;
+				break;
+			}
+			pos = SBS_HORZTHUMB;
+		} else
+			return;
+		break;
+	}
+
+	if (pos == SBS_UNKNOWN)
+		return;
+
+	*pStat &= ~SBS_MASK;		/* remove stray mouse states*/
+
+	if (msg == WM_NCLBUTTONDOWN || msg == WM_NCLBUTTONDBLCLK)//jmt:2k0819
+		*pStat |= pos;
+	else *pStat &= ~pos;
+
+	if (msg == WM_NCLBUTTONDOWN || msg == WM_NCLBUTTONDBLCLK)//jmt:2k0819
+		bDraw=TRUE;
+
+	if (bDraw)
+		MwPaintNCScrollbars(hwnd, NULL);
+
+        if (pos == SBS_UPARROW || pos == SBS_LEFTARROW)//jmt:2k0820 
+	{
+                if (hwnd->vscroll.curPos != hwnd->vscroll.minPos)
+			sbCode = SB_LINEUP;
+        }
+        else if (pos == SBS_DOWNARROW || pos == SBS_RIGHTARROW)//jmt:2k0820 
+	{
+                if (hwnd->vscroll.curPos != hwnd->vscroll.maxPos)
+			sbCode = SB_LINEDOWN;
+        }
+        else if (pos == SBS_VERTTHUMB || pos == SBS_HORZTHUMB)// 
+	{
+                sbCode = SB_THUMBTRACK;//
+        }
+
+	switch(msg)
+	{
+	case WM_NCLBUTTONDOWN:
+	case WM_NCLBUTTONDBLCLK://jmt:2k0819
+	    downPos = pos;
+#if MWCLIENT
+	    InvalidateRect(hwnd,NULL,TRUE);
+#endif
+        break;
+
+        case WM_NCMOUSEMOVE://jmt:2k0819
+	    if (hitcode == HTVSCROLL && vertbar) 
+	    {
+		if (sbCode == SB_THUMBTRACK && downPos == SBS_VERTTHUMB)// 
+	    	{
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->vscroll.rc;
+			moveTop = rc.top + mwSYSMETRICS_CYVSCROLL;
+			moveBottom = hwnd->vscroll.rc.bottom - mwSYSMETRICS_CYVSCROLL;
+			moveRange = moveBottom - moveTop;
+
+			itemCount = hwnd->vscroll.maxPos - hwnd->vscroll.minPos + 1;
+			itemVisible = hwnd->vscroll.pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.y - moveTop) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveTop,itemMoveable,moveRange,newThumbPos);
+			//#
+
+                	if ( newThumbPos >= hwnd->vscroll.minPos &&
+                    	     newThumbPos <= hwnd->vscroll.maxPos)
+                    		SendMessage (hwnd,
+                        		WM_VSCROLL, SB_THUMBTRACK, newThumbPos);
+                	break;
+            	}
+	    }
+
+	    if (hitcode == HTHSCROLL && horzbar) 
+	    {
+		if (sbCode == SB_THUMBTRACK && downPos == SBS_HORZTHUMB)// 
+		{
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->hscroll.rc;
+			moveLeft = rc.left + mwSYSMETRICS_CXHSCROLL;
+			moveRight = hwnd->hscroll.rc.right - mwSYSMETRICS_CXHSCROLL;
+			moveRange = moveRight - moveLeft;
+
+			itemCount = hwnd->hscroll.maxPos - hwnd->hscroll.minPos + 1;
+			itemVisible = hwnd->hscroll.pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.x - moveLeft) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveLeft,itemMoveable,moveRange,newThumbPos);
+			//#
+    
+			if ( newThumbPos >= hwnd->hscroll.minPos &&
+			     newThumbPos <= hwnd->hscroll.maxPos)
+			    	SendMessage (hwnd,
+					WM_HSCROLL, SB_THUMBTRACK, newThumbPos);
+			break;
+		}
+             }
+
+        break;
+
+	case WM_NCLBUTTONUP://jmt:2k0819
+	    bDraw=FALSE;
+	    downPos = SBS_UNKNOWN;//
+
+	    if (sbCode==SB_THUMBTRACK)
+	    {
+		    if (hitcode == HTVSCROLL && vertbar) 
+		    {
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->vscroll.rc;
+			moveTop = rc.top + mwSYSMETRICS_CYVSCROLL;
+			moveBottom = hwnd->vscroll.rc.bottom - mwSYSMETRICS_CYVSCROLL;
+			moveRange = moveBottom - moveTop;
+
+			itemCount = hwnd->vscroll.maxPos - hwnd->vscroll.minPos + 1;
+			itemVisible = hwnd->vscroll.pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.y - moveTop) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveTop,itemMoveable,moveRange,newThumbPos);
+			//#
+			if ( newThumbPos >= hwnd->vscroll.minPos &&
+			     newThumbPos <= hwnd->vscroll.maxPos)
+				SendMessage (hwnd,
+					WM_VSCROLL, SB_THUMBTRACK, newThumbPos);
+			break;
+		    }
+
+		    if (hitcode == HTHSCROLL && horzbar) 
+		    {
+			//jmt(2k0819): new algorithm for SB_THUMBTRACK
+
+			rc = hwnd->hscroll.rc;
+			moveLeft = rc.left + mwSYSMETRICS_CXHSCROLL;
+			moveRight = hwnd->hscroll.rc.right - mwSYSMETRICS_CXHSCROLL;
+			moveRange = moveRight - moveLeft;
+
+			itemCount = hwnd->hscroll.maxPos - hwnd->hscroll.minPos + 1;
+			itemVisible = hwnd->hscroll.pageStep;
+			itemMoveable = itemCount - itemVisible + 1;
+
+			newThumbPos = ((pt.x - moveLeft) * itemMoveable) / moveRange;
+			printf("((%d-%d)*%d)/%d=%d\n",
+				pt.y,moveLeft,itemMoveable,moveRange,newThumbPos);
+			//#
+    
+			if ( newThumbPos >= hwnd->hscroll.minPos &&
+			     newThumbPos <= hwnd->hscroll.maxPos)
+				SendMessage (hwnd,
+					WM_HSCROLL, SB_THUMBTRACK, newThumbPos);
+			break;
+		    }
+	     }
+	     else//jmt:2k0820
+	     {
+		    if (hitcode == HTVSCROLL && vertbar) 
+			SendMessage (hwnd, WM_VSCROLL, sbCode, 0);
+
+		    if (hitcode == HTHSCROLL && horzbar) 
+			SendMessage (hwnd, WM_HSCROLL, sbCode, 0);
+	     }
+	break;
+	}
+
+}
+
+
+static BOOL
+PtInRect2(const RECT *lprc, int x, int y)
+{
+	POINT	p;
+
+	p.x = x;
+	p.y = y;
+	return PtInRect(lprc, p);
+}
+
+#if 1//0000
+
+
+static void
+wndScrollBarPos (HWND hwnd, BOOL bIsHBar, RECT* rcBar)
+{
+    UINT moveRange;
+    PMWSCROLLBARINFO pSBar;
+
+    if (bIsHBar)
+        pSBar = &hwnd->hscroll;
+    else
+        pSBar = &hwnd->vscroll;
+
+    if (pSBar->minPos == pSBar->maxPos) {
+        pSBar->status |= SBS_HIDE;
+        return;
+    }
+
+    if (bIsHBar)
+        moveRange = (rcBar->right - rcBar->left) - (mwSYSMETRICS_CXHSCROLL<<1);
+    else
+        moveRange = (rcBar->bottom - rcBar->top) - (mwSYSMETRICS_CYVSCROLL<<1);
+
+#define MWM_DEFBARLEN	18//
+#define MWM_MINBARLEN	8//
+
+    if (pSBar->pageStep == 0) 
+    {
+        pSBar->barLen = MWM_DEFBARLEN;
+
+        if (pSBar->barLen > moveRange)
+            pSBar->barLen = MWM_MINBARLEN;
+    }
+    else 
+    {
+        pSBar->barLen = moveRange * pSBar->pageStep /
+	      (pSBar->maxPos - pSBar->minPos + 1);
+        if (pSBar->barLen < MWM_MINBARLEN)
+            pSBar->barLen = MWM_MINBARLEN;
+    }
+
+    pSBar->barStart = moveRange * (pSBar->curPos - pSBar->minPos) /
+       (pSBar->maxPos - pSBar->minPos + 1);
+
+
+    if (pSBar->barStart + pSBar->barLen > moveRange)
+        pSBar->barStart = moveRange - pSBar->barLen;
+
+
+    if (pSBar->barStart < 0)
+        pSBar->barStart = 0;
+}
+
+static PMWSCROLLBARINFO wndGetScrollBar (HWND pWin, int iSBar)
+{
+    if (iSBar == SB_HORZ) {
+        if (pWin->style & WS_HSCROLL)
+            return &pWin->hscroll;
+    }
+    else if (iSBar == SB_VERT) {
+        if (pWin->style & WS_VSCROLL)
+            return &pWin->vscroll;
+    }
+
+    return NULL;
+}
+
+BOOL  EnableScrollBar (HWND hWnd, int iSBar, BOOL bEnable)//ok
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    BOOL bPrevState;
+    RECT rcBar;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )//ok
+        return FALSE;
+
+    bPrevState = !(pSBar->status & SBS_DISABLED);
+
+    if (bEnable && !bPrevState)
+        pSBar->status &= ~SBS_DISABLED;
+    else if (!bEnable && bPrevState)
+        pSBar->status |= SBS_DISABLED;
+    else
+        return FALSE;
+
+    if (iSBar == SB_VERT)
+    {
+        wndGetVScrollBarRect (pWin, &rcBar);
+        rcBar.left --;
+        rcBar.right --;
+    }
+    else
+    {
+        wndGetHScrollBarRect (pWin, &rcBar);
+        rcBar.top  --;
+        rcBar.bottom --;
+    }
+#if 0
+    SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+    MwPaintNCScrollbars(hWnd,NULL);//a must
+#endif
+
+    return TRUE;
+}
+
+BOOL  GetScrollPos (HWND hWnd, int iSBar, int* pPos)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    *pPos = pSBar->curPos;
+    return TRUE;
+}
+
+BOOL  GetScrollRange (HWND hWnd, int iSBar, int* pMinPos, int* pMaxPos)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    *pMinPos = pSBar->minPos;
+    *pMaxPos = pSBar->maxPos;
+    return TRUE;
+}
+
+BOOL  SetScrollPos (HWND hWnd, int iSBar, int iNewPos)//ok
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    RECT rcBar;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    if (iNewPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+    else
+        pSBar->curPos = iNewPos;
+
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+    
+    if (iSBar == SB_VERT)
+    {
+        wndGetVScrollBarRect (pWin, &rcBar);
+        rcBar.left --;
+        rcBar.right --;
+    }
+    else
+    {
+        wndGetHScrollBarRect (pWin, &rcBar);
+        rcBar.top  --;
+        rcBar.bottom --;
+    }
+
+    wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar);
+
+#if 0
+    SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+    MwPaintNCScrollbars(hWnd,NULL);//a must
+#endif
+    return TRUE;
+}
+
+BOOL  SetScrollRange (HWND hWnd, int iSBar, int iMinPos, int iMaxPos)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    RECT rcBar;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    pSBar->minPos = (iMinPos < iMaxPos)?iMinPos:iMaxPos;
+    pSBar->maxPos = (iMinPos > iMaxPos)?iMinPos:iMaxPos;
+    
+    // validate parameters.
+    if (pSBar->curPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+
+    if (pSBar->pageStep <= 0)
+        pSBar->pageStep = 0;
+    else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1))
+        pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1;
+    
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+
+    if (iSBar == SB_VERT)
+    {
+        wndGetVScrollBarRect (pWin, &rcBar);
+    	rcBar.left --;
+      	rcBar.right --;
+    }
+    else
+    {
+        wndGetHScrollBarRect (pWin, &rcBar);
+    	rcBar.top  --;
+    	rcBar.bottom --;
+    }
+    wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar);
+
+#if 0
+    SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+    MwPaintNCScrollbars(hWnd,NULL);//a must
+#endif
+
+    return TRUE;
+}
+
+BOOL  SetScrollInfo (HWND hWnd, int iSBar, 
+                LPCSCROLLINFO lpsi, BOOL fRedraw)//ok
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    RECT rcBar;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+        
+    if( lpsi->fMask & SIF_RANGE )
+    {
+        pSBar->minPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMin:lpsi->nMax;
+        pSBar->maxPos = (lpsi->nMin < lpsi->nMax)?lpsi->nMax:lpsi->nMin;
+    }
+    
+    if( lpsi->fMask & SIF_POS )
+        pSBar->curPos = lpsi->nPos;
+    
+    if( lpsi->fMask & SIF_PAGE )
+        pSBar->pageStep = lpsi->nPage;
+
+    // validate parameters.
+    if (pSBar->curPos < pSBar->minPos)
+        pSBar->curPos = pSBar->minPos;
+
+    if (pSBar->pageStep <= 0)
+        pSBar->pageStep = 0;
+    else if (pSBar->pageStep > (pSBar->maxPos - pSBar->minPos + 1))
+        pSBar->pageStep = pSBar->maxPos - pSBar->minPos + 1;
+    
+    {
+        int max = pSBar->maxPos;
+        max -= ((pSBar->pageStep - 1) > 0)?(pSBar->pageStep - 1):0;
+
+        if (pSBar->curPos > max)
+            pSBar->curPos = max;
+    }
+
+    if(fRedraw)
+    {
+        if (iSBar == SB_VERT)
+	{
+            wndGetVScrollBarRect (pWin, &rcBar);
+            rcBar.left --;
+            rcBar.right --;
+	}
+        else
+	{
+            wndGetHScrollBarRect (pWin, &rcBar);
+            rcBar.top --;
+            rcBar.bottom --;
+	}
+        wndScrollBarPos (pWin, iSBar == SB_HORZ, &rcBar);
+
+#if 0
+        SendMessage (hWnd, WM_NCPAINT, 0, (LPARAM)(&rcBar));
+#else
+	MwPaintNCScrollbars(hWnd,NULL);//a must
+#endif
+    }
+    
+    return TRUE;
+}
+
+BOOL  GetScrollInfo(HWND hWnd, int iSBar, LPSCROLLINFO lpsi)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+        
+    if( lpsi->fMask & SIF_RANGE )
+    {
+        lpsi->nMin = pSBar->minPos;
+        lpsi->nMax = pSBar->maxPos;
+    }
+    
+    if( lpsi->fMask & SIF_POS )
+    {
+        lpsi->nPos = pSBar->curPos;
+    }
+    
+    if( lpsi->fMask & SIF_PAGE )
+        lpsi->nPage = pSBar->pageStep;
+    
+    return TRUE;
+}
+
+BOOL  ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow)
+{
+    PMWSCROLLBARINFO pSBar;
+    HWND pWin;
+    BOOL bPrevState;
+    RECT rcBar;
+    
+    pWin = (HWND)hWnd;
+    
+    if ( !(pSBar = wndGetScrollBar (pWin, iSBar)) )
+        return FALSE;
+
+    bPrevState = !(pSBar->status & SBS_HIDE);
+
+    if (bShow && !bPrevState)
+        pSBar->status &= ~SBS_HIDE;
+    else if (!bShow && bPrevState)
+        pSBar->status |= SBS_HIDE;
+    else
+        return FALSE;
+#if 0//fix: no WM_CHANGESIZE
+    SendMessage (hWnd, WM_CHANGESIZE, 0, 0);
+#endif
+    if (iSBar == SB_VERT)
+        wndGetVScrollBarRect (pWin, &rcBar);
+    else
+        wndGetHScrollBarRect (pWin, &rcBar);
+
+    {
+        RECT rcWin, rcClient;
+        
+        memcpy (&rcWin, &pWin->winrect.left, sizeof (RECT));
+        
+        rcClient.left = 0;
+        rcClient.top  = 0;
+        rcClient.right = pWin->clirect.right - pWin->clirect.left;
+        rcClient.bottom = pWin->clirect.bottom - pWin->clirect.top;
+#if 0//fix: no WM_SIZECHANGED
+        SendMessage/*SendAsyncMessage*/ (hWnd, WM_SIZECHANGED, 
+            (WPARAM)&rcWin, (LPARAM)&rcClient);
+#endif
+    }
+    
+    if (bShow) {
+        SendMessage (hWnd, WM_NCPAINT, 0, 0);
+    }
+    else {
+        rcBar.left -= pWin->clirect.left;
+        rcBar.top  -= pWin->clirect.top;
+        rcBar.right -= pWin->clirect.left;
+        rcBar.bottom -= pWin->clirect.top;
+        SendMessage (hWnd, WM_NCPAINT, 0, 0);
+        InvalidateRect (hWnd, &rcBar, TRUE);
+    }
+
+    return TRUE;
+}
+#endif
diff -urN lib/microwindows/src/mwin/winuser.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winuser.c
--- lib/microwindows/src/mwin/winuser.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin/winuser.c	2005-02-21 16:13:29.000000000 +0100
@@ -0,0 +1,1419 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Win32 API upper level window creation, management and msg routines
+ */
+#include "windows.h"
+#include "wintern.h"
+#include "device.h"
+#include <stdlib.h>
+#include <string.h>
+
+#define PAINTONCE	1	/* =1 to queue paint msgs only once*/
+#define MOUSETEST	1
+
+MWLISTHEAD mwMsgHead;		/* application msg queue*/
+MWLISTHEAD mwClassHead;		/* register class list*/
+
+int	mwSYSMETRICS_CYCAPTION = 12;	/* Y caption height*/
+int	mwSYSMETRICS_CXFRAME = 3;	/* width of frame border*/
+int	mwSYSMETRICS_CYFRAME = 3;	/* height of frame border*/
+int	mwSYSMETRICS_CXBORDER = 1;	/* width of single border*/
+int	mwSYSMETRICS_CYBORDER = 1;	/* width of single border*/
+int	mwSYSMETRICS_CXVSCROLL = 13;	/* width of vertical scrollbar*/
+int	mwSYSMETRICS_CYHSCROLL = 13;	/* height of horizontal scrollbar*/
+int	mwSYSMETRICS_CXHSCROLL = 13;	/* width of arrow on horz scrollbar*/
+int	mwSYSMETRICS_CYVSCROLL = 13;	/* height of arrow on vert scrollbar*/
+int	mwSYSMETRICS_CXDOUBLECLK = 2;	/* +/- X double click position*/
+int	mwSYSMETRICS_CYDOUBLECLK = 2;	/* +/- Y double click position*/
+int	mwpaintSerial = 1;		/* experimental alphablend sequencing*/
+int	mwpaintNC = 1;			/* experimental NC paint handling*/
+BOOL 	mwforceNCpaint = FALSE;		/* force NC paint when alpha blending*/
+
+static void MwOffsetChildren(HWND hwnd, int offx, int offy);
+
+LRESULT WINAPI
+CallWindowProc(WNDPROC lpPrevWndFunc, HWND hwnd, UINT Msg, WPARAM wParam,
+	LPARAM lParam)
+{
+	return (*lpPrevWndFunc)(hwnd, Msg, wParam, lParam);
+}
+
+LRESULT WINAPI
+SendMessage(HWND hwnd, UINT Msg,WPARAM wParam,LPARAM lParam)
+{
+	if(hwnd && hwnd->pClass) {
+		hwnd->paintSerial = mwpaintSerial; /* assign msg sequence #*/
+		return (*hwnd->pClass->lpfnWndProc)(hwnd, Msg, wParam, lParam);
+	}
+	return 0;
+}
+
+BOOL WINAPI
+PostMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+{
+	MSG *	pMsg;
+
+#if PAINTONCE
+	/* don't queue paint msgs, set window paint status instead*/
+	if(Msg == WM_PAINT) {
+		hwnd->gotPaintMsg = PAINT_NEEDSPAINT;
+		return TRUE;
+	}
+#endif
+#if MOUSETEST
+	/* replace multiple mouse messages with one for better mouse handling*/
+	if(Msg == WM_MOUSEMOVE) {
+		PMWLIST	p;
+		for(p=mwMsgHead.head; p; p=p->next) {
+			pMsg = GdItemAddr(p, MSG, link);
+			if(pMsg->hwnd == hwnd && pMsg->message == Msg) {
+				pMsg->wParam = wParam;
+				pMsg->lParam = lParam;
+				pMsg->time = GetTickCount();
+				pMsg->pt.x = cursorx;
+				pMsg->pt.y = cursory;
+				return TRUE;
+			}
+		}
+	}
+#endif
+	pMsg = GdItemNew(MSG);
+	if(!pMsg)
+		return FALSE;
+	pMsg->hwnd = hwnd;
+	pMsg->message = Msg;
+	pMsg->wParam = wParam;
+	pMsg->lParam = lParam;
+	pMsg->time = GetTickCount();
+	pMsg->pt.x = cursorx;
+	pMsg->pt.y = cursory;
+	GdListAdd(&mwMsgHead, &pMsg->link);
+	return TRUE;
+}
+
+/* currently, we post to the single message queue, regardless of thread*/
+BOOL WINAPI
+PostThreadMessage(DWORD dwThreadId, UINT Msg, WPARAM wParam, LPARAM lParam)
+{
+	return PostMessage(NULL, Msg, wParam, lParam);
+}
+
+VOID WINAPI
+PostQuitMessage(int nExitCode)
+{
+	PostMessage(NULL, WM_QUIT, nExitCode, 0L);
+}
+
+static BOOL
+chkPaintMsg(HWND wp, LPMSG lpMsg)
+{
+		/*
+		 * Tricky: only repaint window if there
+		 * isn't a mouse capture (window move) in progress,
+		 * or the window is the moving window.
+		 */
+		if(wp->gotPaintMsg == PAINT_NEEDSPAINT &&
+		    (!dragwp || dragwp == wp)) {
+	paint:
+			wp->gotPaintMsg = PAINT_PAINTED;
+			lpMsg->hwnd = wp;
+			lpMsg->message = WM_PAINT;
+			lpMsg->wParam = 0;
+			lpMsg->lParam = 0;
+			lpMsg->time = 0;
+			lpMsg->pt.x = cursorx;
+			lpMsg->pt.y = cursory;
+			return TRUE;
+		} else if(dragwp && wp->gotPaintMsg == PAINT_NEEDSPAINT) {
+			/* All other windows we'll check for
+			 * event input first, then allow repaint.
+			 */
+			MwSelect();
+			if(mwMsgHead.head == NULL)
+				goto paint;
+		}
+	return FALSE;
+}
+
+BOOL WINAPI
+PeekMessage(LPMSG lpMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
+	UINT wRemoveMsg)
+{
+	HWND	wp;
+	PMSG	pNxtMsg;
+
+	/* check if no messages in queue*/
+	if(mwMsgHead.head == NULL) {
+#if PAINTONCE
+		/* check all windows for pending paint messages*/
+		for(wp=listwp; wp; wp=wp->next) {
+			if(!(wp->style & WS_CHILD)) {
+				if(chkPaintMsg(wp, lpMsg))
+					return TRUE;
+			}
+		}
+		for(wp=listwp; wp; wp=wp->next) {
+			if(wp->style & WS_CHILD) {
+				if(chkPaintMsg(wp, lpMsg))
+					return TRUE;
+			}
+		}
+#endif
+		MwSelect();
+	}
+
+	if(mwMsgHead.head == NULL)
+		return FALSE;
+
+	pNxtMsg = (PMSG)mwMsgHead.head;
+	if(wRemoveMsg & PM_REMOVE)
+		GdListRemove(&mwMsgHead, &pNxtMsg->link);
+	*lpMsg = *pNxtMsg;
+	if(wRemoveMsg & PM_REMOVE)
+		GdItemFree(pNxtMsg);
+	return TRUE;
+}
+
+BOOL WINAPI
+GetMessage(LPMSG lpMsg,HWND hwnd,UINT wMsgFilterMin,UINT wMsgFilterMax)
+{
+	/*
+	 * currently MwSelect() must poll for VT switch reasons,
+	 * so this code will work
+	 */
+	while(!PeekMessage(lpMsg, hwnd, wMsgFilterMin, wMsgFilterMax,PM_REMOVE))
+		continue;
+	return lpMsg->message != WM_QUIT;
+}
+
+BOOL WINAPI 
+TranslateMessage(CONST MSG *lpMsg)
+{
+	return FALSE;
+}
+
+LONG WINAPI
+DispatchMessage(CONST MSG *lpMsg)
+{
+	return SendMessage(lpMsg->hwnd, lpMsg->message, lpMsg->wParam,
+		lpMsg->lParam);
+}
+
+/* find the registered window class struct by name*/
+PWNDCLASS
+MwFindClassByName(LPCSTR lpClassName)
+{
+	PMWLIST		p;
+	PWNDCLASS	pClass;
+
+	for(p=mwClassHead.head; p; p=p->next) {
+		pClass = GdItemAddr(p, WNDCLASS, link);
+		if(strcmpi(pClass->szClassName, lpClassName) == 0)
+			return pClass;
+	}
+	return NULL;
+}
+
+ATOM WINAPI
+RegisterClass(CONST WNDCLASS *lpWndClass)
+{
+	PWNDCLASS	pClass;
+
+	/* check if already present*/
+	pClass = MwFindClassByName(lpWndClass->lpszClassName);
+	if(pClass)
+		return 0;
+	
+	/* copy class into new struct*/
+	pClass = GdItemNew(WNDCLASS);
+	if(!pClass)
+		return 0;
+	*pClass = *lpWndClass;
+	strcpy(pClass->szClassName, lpWndClass->lpszClassName);
+	GdListAdd(&mwClassHead, &pClass->link);
+
+	return 1;
+}
+
+BOOL WINAPI
+UnregisterClass(LPCSTR lpClassName, HINSTANCE hInstance)
+{
+	PWNDCLASS	pClass;
+
+	pClass = MwFindClassByName(lpClassName);
+	if(!pClass)
+		return FALSE;
+	GdListRemove(&mwClassHead, &pClass->link);
+	DeleteObject(pClass->hbrBackground);
+	GdItemFree(pClass);
+	return TRUE;
+}
+
+HWND WINAPI
+CreateWindowEx(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName,
+	DWORD dwStyle, int x, int y, int nWidth, int nHeight,
+	HWND hwndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam)
+{
+	HWND		pwp;		/* parent window */
+	HWND		wp;		/* new window */
+	HWND		hwndOwner;
+	PWNDCLASS	pClass;
+	CREATESTRUCT	cs;
+	static int	nextx = 20;
+	static int	nexty = 20;
+
+	pClass = MwFindClassByName(lpClassName);
+	if(!pClass)
+		return NULL;
+
+	if(x == CW_USEDEFAULT || y == CW_USEDEFAULT) {
+		x = nextx;
+		nextx += 10;
+		y = nexty;
+		nexty += 10;
+		if(nextx > 200)
+			nextx = nexty = 20;
+	}
+	if(nWidth == CW_USEDEFAULT || nHeight == CW_USEDEFAULT) {
+		nWidth = 250;
+		nHeight = 250;
+	}
+
+	if(hwndParent == NULL) {
+		if(dwStyle & WS_CHILD)
+			return NULL;
+		pwp = rootwp;
+	} else
+		pwp = hwndParent;
+
+	/* WS_POPUP z-order parent is the root window (passed parent is owner)*/
+	if(dwStyle & WS_POPUP)
+		pwp = rootwp;		/* force clip to root, not z-parent*/
+
+	/* window owner is NULL for child windows, else it's the passed parent*/
+	if(dwStyle & WS_CHILD)
+		hwndOwner = NULL;
+	else hwndOwner = hwndParent;
+
+	wp = (HWND)GdItemAlloc(sizeof(struct hwnd) - 1 + pClass->cbWndExtra);
+	if(!wp)
+		return NULL;
+
+	/* force all clipping on by default*/
+	dwStyle |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
+
+	wp->pClass = pClass;
+	wp->style = dwStyle;
+	wp->exstyle = dwExStyle;
+	wp->parent = pwp;
+	wp->owner = hwndOwner;
+	wp->children = NULL;
+	wp->siblings = pwp->children;
+	pwp->children = wp;
+	wp->next = listwp;
+	listwp = wp;
+	wp->winrect.left = pwp->clirect.left + x;
+	wp->winrect.top = pwp->clirect.top + y;
+	wp->winrect.right = wp->winrect.left + nWidth;
+	wp->winrect.bottom = wp->winrect.top + nHeight;
+	wp->cursor = pwp->cursor;
+	wp->cursor->usecount++;
+	wp->unmapcount = pwp->unmapcount + 1;
+	wp->id = (int)hMenu;
+	wp->gotPaintMsg = PAINT_PAINTED;
+	strzcpy(wp->szTitle, lpWindowName, sizeof(wp->szTitle));
+#if UPDATEREGIONS
+	wp->update = GdAllocRegion();
+#endif
+	wp->nextrabytes = pClass->cbWndExtra;
+
+	/* calculate client area*/
+	MwCalcClientRect(wp);
+
+	cs.lpCreateParams = lpParam;
+	cs.hInstance = hInstance;
+	cs.hMenu = hMenu;
+	cs.hwndParent = hwndParent;
+	cs.cy = nHeight;
+	cs.cx = nWidth;
+	cs.y = y;
+	cs.x = x;
+	cs.style = dwStyle;
+	cs.lpszName = lpWindowName;
+	cs.lpszClass = lpClassName;
+	cs.dwExStyle = dwExStyle;
+
+	if(SendMessage(wp, WM_CREATE, 0, (LPARAM)(LPSTR)&cs) == -1) {
+		MwDestroyWindow(wp, FALSE);
+		return NULL;
+	}
+
+	/* send SIZE and MOVE msgs*/
+	MwSendSizeMove(wp, TRUE, TRUE);
+
+	if(wp->style & WS_VISIBLE) {
+		MwShowWindow(wp, TRUE);
+		SetFocus(wp);
+	}
+
+	return wp;
+}
+
+BOOL WINAPI
+DestroyWindow(HWND hwnd)
+{
+	MwDestroyWindow(hwnd, TRUE);
+	return TRUE;
+}
+
+/*
+ * Destroy the specified window, and all of its children.
+ * This is a recursive routine.
+ */
+void
+MwDestroyWindow(HWND hwnd,BOOL bSendMsg)
+{
+	HWND	wp = hwnd;
+	HWND	prevwp;
+	PMWLIST	p;
+	PMSG	pmsg;
+
+	if (wp == rootwp)
+		return;
+
+	/*
+	 * Unmap the window.
+	 */
+	if (wp->unmapcount == 0)
+		MwHideWindow(wp, FALSE, FALSE);
+
+	if(bSendMsg)
+		SendMessage(hwnd, WM_DESTROY, 0, 0L);
+
+	/*
+	 * Disable all sendmessages to this window.
+	 */
+	wp->pClass = NULL;
+
+	/*
+	 * Destroy all children, sending WM_DESTROY messages.
+	 */
+	while (wp->children)
+		MwDestroyWindow(wp->children, bSendMsg);
+
+	/*
+	 * Free any cursor associated with the window.
+	 */
+	if (wp->cursor->usecount-- == 1) {
+		free(wp->cursor);
+		wp->cursor = NULL;
+	}
+
+	/*
+	 * Remove this window from the child list of its parent.
+	 */
+	prevwp = wp->parent->children;
+	if (prevwp == wp)
+		wp->parent->children = wp->siblings;
+	else {
+		while (prevwp->siblings != wp)
+			prevwp = prevwp->siblings;
+		prevwp->siblings = wp->siblings;
+	}
+	wp->siblings = NULL;
+
+	/*
+	 * Remove this window from the complete list of windows.
+	 */
+	prevwp = listwp;
+	if (prevwp == wp)
+		listwp = wp->next;
+	else {
+		while (prevwp->next != wp)
+			prevwp = prevwp->next;
+		prevwp->next = wp->next;
+	}
+	wp->next = NULL;
+
+	/*
+	 * Forget various information related to this window.
+	 * Then finally free the structure.
+	 */
+
+	/* Remove all messages from msg queue for this window*/
+	for(p=mwMsgHead.head; p; ) {
+		pmsg = GdItemAddr(p, MSG, link);
+		if(pmsg->hwnd == wp) {
+			p = p->next;
+			GdListRemove(&mwMsgHead, &pmsg->link);
+		} else
+			p = p->next;
+	}
+
+	/* FIXME: destroy hdc's relating to window?*/
+
+	if (wp == capturewp) {
+		capturewp = NULL;
+		MwCheckMouseWindow();
+	}
+
+	if (wp == MwGetTopWindow(focuswp))
+		SetFocus(rootwp->children? rootwp->children: rootwp);
+
+	/* destroy private DC*/
+	if(wp->owndc) {
+		HDC hdc = wp->owndc;
+		wp->owndc = NULL;	/* force destroy with ReleaseDC*/
+		ReleaseDC(wp, hdc);
+	}
+#if UPDATEREGIONS
+	GdDestroyRegion(wp->update);
+#endif
+	GdItemFree(wp);
+}
+
+BOOL WINAPI
+IsWindow(HWND hwnd)
+{
+	HWND	wp;
+
+	for(wp=listwp; wp; wp=wp->next)
+		if(wp == hwnd)
+			return TRUE;
+	return FALSE;
+}
+
+BOOL WINAPI
+ShowWindow(HWND hwnd, int nCmdShow)
+{
+	if(!hwnd)
+		return FALSE;
+	
+	/* fix: send show msg*/
+
+	switch(nCmdShow) {
+	case SW_HIDE:
+		if (!(hwnd->style & WS_VISIBLE))
+			return FALSE;
+		MwHideWindow(hwnd, TRUE, TRUE);
+		hwnd->style &= ~WS_VISIBLE;
+		break;
+
+	default:
+		if (hwnd->style & WS_VISIBLE)
+			return FALSE;
+		hwnd->style |= WS_VISIBLE;
+		MwShowWindow(hwnd, TRUE);
+	}
+	return TRUE;
+}
+
+BOOL WINAPI
+InvalidateRect(HWND hwnd, CONST RECT *lpRect, BOOL bErase)
+{
+	/* FIXME: handle bErase*/
+	if(!hwnd)
+		MwRedrawScreen();
+	else {
+#if UPDATEREGIONS
+		RECT	rc;
+
+		/* add to update region*/
+		if(!lpRect)
+			GetClientRect(hwnd, &rc);
+		else rc = *lpRect;
+		rc.bottom += mwSYSMETRICS_CYCAPTION +
+			mwSYSMETRICS_CYFRAME + 1;
+		rc.right += mwSYSMETRICS_CXFRAME;
+		MwUnionUpdateRegion(hwnd, rc.left, rc.top,
+			rc.right-rc.left, rc.bottom-rc.top, TRUE);
+
+		/* if update region not empty, mark as needing painting*/
+		if(hwnd->update->numRects != 0)
+#endif
+			if(hwnd->gotPaintMsg == PAINT_PAINTED)
+				hwnd->gotPaintMsg = PAINT_NEEDSPAINT;
+	}
+	return TRUE;
+}
+
+#if UPDATEREGIONS
+/* add region to window update region*/
+BOOL WINAPI
+InvalidateRgn(HWND hwnd, HRGN hrgn, BOOL bErase)
+{
+	/* FIXME: handle bErase*/
+	if(hwnd) {
+		if(!hrgn)
+			/* add client area to update region*/
+			return InvalidateRect(hwnd, NULL, bErase);
+
+		/* passed region is in client coords, convert to screen*/
+		GdOffsetRegion(((MWRGNOBJ *)hrgn)->rgn,
+			hwnd->clirect.left, hwnd->clirect.top);
+		GdUnionRegion(hwnd->update, hwnd->update,
+			((MWRGNOBJ *)hrgn)->rgn);
+		GdOffsetRegion(((MWRGNOBJ *)hrgn)->rgn,
+			-hwnd->clirect.left, -hwnd->clirect.top);
+
+		/* if update region not empty, mark as needing painting*/
+		if(hwnd->update->numRects != 0)
+			if(hwnd->gotPaintMsg == PAINT_PAINTED)
+				hwnd->gotPaintMsg = PAINT_NEEDSPAINT;
+	}
+	return TRUE;
+}
+
+BOOL WINAPI
+ValidateRect(HWND hwnd, CONST RECT *lprc)
+{
+	RECT	rc;
+
+	if(!hwnd)
+		MwRedrawScreen();
+	else {
+		/* subtract from update region*/
+		if(!lprc)
+			GetClientRect(hwnd, &rc);
+		else rc = *lprc;
+		rc.bottom += mwSYSMETRICS_CYCAPTION +
+			mwSYSMETRICS_CYFRAME + 1;
+		rc.right += mwSYSMETRICS_CXFRAME;
+		MwUnionUpdateRegion(hwnd, rc.left, rc.top,
+			rc.right-rc.left, rc.bottom-rc.top, FALSE);
+
+		/* if update region empty, mark window as painted*/
+		if(hwnd->update->numRects == 0)
+			if(hwnd->gotPaintMsg == PAINT_NEEDSPAINT)
+				hwnd->gotPaintMsg = PAINT_PAINTED;
+	}
+	return TRUE;
+}
+
+/* remove region from window update region*/
+BOOL WINAPI
+ValidateRgn(HWND hwnd, HRGN hrgn)
+{
+	if(hwnd) {
+		if(!hrgn)
+			/* remove client area from update region*/
+			return ValidateRect(hwnd, NULL);
+
+		/* passed region is in client coords, convert to screen*/
+		GdOffsetRegion(((MWRGNOBJ *)hrgn)->rgn,
+			hwnd->clirect.left, hwnd->clirect.top);
+		GdSubtractRegion(hwnd->update, hwnd->update,
+			((MWRGNOBJ *)hrgn)->rgn);
+		GdOffsetRegion(((MWRGNOBJ *)hrgn)->rgn,
+			-hwnd->clirect.left, -hwnd->clirect.top);
+
+		/* if update region empty, mark window as painted*/
+		if(hwnd->update->numRects == 0)
+			if(hwnd->gotPaintMsg == PAINT_NEEDSPAINT)
+				hwnd->gotPaintMsg = PAINT_PAINTED;
+	}
+	return TRUE;
+}
+#endif /* UPDATEREGIONS*/
+
+BOOL WINAPI
+UpdateWindow(HWND hwnd)
+{
+#if PAINTONCE
+	if(hwnd && hwnd->gotPaintMsg == PAINT_NEEDSPAINT) {
+		SendMessage(hwnd, WM_PAINT, 0, 0L);
+		hwnd->gotPaintMsg = PAINT_PAINTED;
+		return TRUE;
+	}
+	return FALSE;
+#else
+	/* fix: remove other paint messages from queue*/
+	SendMessage(hwnd, WM_PAINT, 0, 0L);
+	return TRUE;
+#endif
+}
+
+HWND WINAPI
+GetFocus(VOID)
+{
+	return focuswp;
+}
+
+HWND WINAPI
+SetFocus(HWND hwnd)
+{
+	HWND	oldfocus;
+	HWND	top, top2;
+
+	/* if NULL or hidden, set focus to desktop*/
+	if(!hwnd || hwnd->unmapcount)
+		hwnd = rootwp;
+
+	if(hwnd == focuswp)
+		return focuswp;
+
+	oldfocus = focuswp;
+	SendMessage(oldfocus, WM_KILLFOCUS, (WPARAM)hwnd, 0L);
+	focuswp = hwnd;
+	SendMessage(focuswp, WM_SETFOCUS, (WPARAM)oldfocus, 0L);
+
+	/* FIXME SetActiveWindow() here?*/
+	top = MwGetTopWindow(oldfocus);
+	top2 = MwGetTopWindow(focuswp);
+	if(top2 != top) {
+		/* send deactivate*/
+		SendMessage(top, WM_ACTIVATE, (WPARAM)MAKELONG(WA_INACTIVE, 0),
+			(LPARAM)top2);
+		/* repaint captions*/
+		MwPaintNCArea(top);
+#if 0
+		/* Make sure that caption area is fully invalidated,
+		 * as repaint will be in active color.
+		 * FIXME: this doesn't work; breaks terminal emulator
+		 * on focus out/in
+		 */
+		MwUnionUpdateRegion(top2, 0, 0,
+			top2->winrect.right-top2->winrect.left,
+			mwSYSMETRICS_CYCAPTION+4, TRUE);
+#endif
+		/* send deactivate*/
+		SendMessage(top, WM_ACTIVATE, (WPARAM)MAKELONG(WA_ACTIVE, 0),
+			(LPARAM)top);
+		MwPaintNCArea(top2);
+	}
+
+	return oldfocus;
+}
+
+/* the foreground window is the top level window at the top of the z order*/
+/* setting the foreground window sets focus and moves window to top*/
+BOOL WINAPI
+SetForegroundWindow(HWND hwnd)
+{
+	/* activate (set focus to) specified window*/
+	SetFocus(hwnd);
+
+	/* raise top level parent to top of z order*/
+	SetWindowPos(MwGetTopWindow(hwnd), HWND_TOP, 0, 0, 0, 0,
+		SWP_NOMOVE|SWP_NOSIZE);
+
+	return TRUE;
+}
+
+/* our SetActiveWindow is the same as SetFocus, no z order change*/
+HWND WINAPI
+SetActiveWindow(HWND hwnd)
+{
+	HWND	oldActive;
+
+	oldActive = GetActiveWindow();
+	SetFocus(hwnd);		 /* WM_ACTIVATE sent by SetFocus*/
+	return oldActive;
+}
+
+/* The active window is the first non-child ancestor of focus window*/
+HWND WINAPI
+GetActiveWindow(VOID)
+{
+	return MwGetTopWindow(focuswp);
+}
+
+/* activate the top level window associated with window*/
+BOOL WINAPI
+BringWindowToTop(HWND hwnd)
+{
+	return SetForegroundWindow(hwnd);
+}
+
+HWND WINAPI
+GetDesktopWindow(VOID)
+{
+	return rootwp;
+}
+
+HWND
+MwGetTopWindow(HWND hwnd)
+{
+	while(hwnd->style & WS_CHILD)
+		hwnd = hwnd->parent;
+	return hwnd;
+}
+
+HWND WINAPI
+GetParent(HWND hwnd)
+{
+	/* top level windows return NULL instead of rootwp*/
+	if(!hwnd || !(hwnd->style & (WS_POPUP|WS_CHILD)))
+		return NULL;		/* toplevel window*/
+	if(hwnd->style & WS_POPUP)
+		return hwnd->owner;	/* popup window*/
+	return hwnd->parent;		/* child window*/
+}
+
+BOOL WINAPI
+EnableWindow(HWND hwnd, BOOL bEnable)
+{
+	if(bEnable && (hwnd->style & WS_DISABLED)) {
+		/* enable window*/
+		hwnd->style &= ~WS_DISABLED;
+		SendMessage(hwnd, WM_ENABLE, TRUE, 0L);
+		return TRUE;
+	}
+	if(!bEnable && !(hwnd->style & WS_DISABLED)) {
+		/* disable window*/
+		hwnd->style |= WS_DISABLED;
+		/* FIXME: handle lost focus for child window of hwnd*/
+		/* FIXME: handle lost focus for capture window*/
+		if(hwnd == focuswp)
+			SetFocus(NULL);
+		SendMessage(hwnd, WM_ENABLE, FALSE, 0L);
+		return FALSE;
+	}
+	return (hwnd->style & WS_DISABLED) != 0;
+}
+
+/* calc window rect from client rect in screen coords*/
+BOOL WINAPI
+AdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle)
+{
+	int	yoffset;
+
+	if(dwStyle & WS_BORDER) {
+		if((dwStyle & WS_CAPTION) == WS_CAPTION) {
+			InflateRect(lpRect, mwSYSMETRICS_CXFRAME,
+				mwSYSMETRICS_CYFRAME);
+			yoffset = mwSYSMETRICS_CYCAPTION + 1;
+			lpRect->top -= yoffset;
+			lpRect->bottom -= yoffset;
+		} else
+			InflateRect(lpRect, 1, 1);
+
+		/* make sure upper left is on screen*/
+		if(lpRect->left < 0) {
+			lpRect->right -= lpRect->left;
+			lpRect->left = 0;
+		}
+		if(lpRect->top < 0) {
+			lpRect->bottom -= lpRect->top;
+			lpRect->top = 0;
+		}
+	}
+	return TRUE;
+}
+
+/* set the client rect for a window from the window position*/
+void
+MwCalcClientRect(HWND hwnd)
+{
+	NCCALCSIZE_PARAMS	nccs;
+
+	/* set first rectangle to window rect*/
+	nccs.rgrc[0] = hwnd->winrect;
+	SendMessage(hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)(LPSTR)&nccs);
+	hwnd->clirect = nccs.rgrc[0];
+
+	/* adjust client area if scrollbar(s) visible*/
+	MwAdjustNCScrollbars(hwnd);
+}
+
+BOOL WINAPI
+GetClientRect(HWND hwnd, LPRECT lpRect)
+{
+	if(!hwnd || !lpRect)
+		return FALSE;
+
+	/* convert client area rect from screen coordinates*/
+	lpRect->left = 0;
+	lpRect->top = 0;
+	lpRect->right = hwnd->clirect.right - hwnd->clirect.left;
+	lpRect->bottom = hwnd->clirect.bottom - hwnd->clirect.top;
+	return TRUE;
+}
+
+BOOL WINAPI
+GetWindowRect(HWND hwnd, LPRECT lpRect)
+{
+	if(!hwnd || !lpRect)
+		return FALSE;
+	
+	/* window rect is already in screen coordinates*/
+	*lpRect = hwnd->winrect;
+	return TRUE;
+}
+
+BOOL WINAPI
+ClientToScreen(HWND hwnd, LPPOINT lpPoint)
+{
+	if(!hwnd || !lpPoint)
+		return FALSE;
+	MapWindowPoints(hwnd, NULL, lpPoint, 1);
+	return TRUE;
+}
+
+BOOL WINAPI
+ScreenToClient(HWND hwnd, LPPOINT lpPoint)
+{
+	if(!hwnd || !lpPoint)
+		return FALSE;
+	MapWindowPoints(NULL, hwnd, lpPoint, 1);
+	return TRUE;
+}
+
+int WINAPI
+MapWindowPoints(HWND hwndFrom, HWND hwndTo, LPPOINT lpPoints, UINT cPoints)
+{
+	MWCOORD	offx = 0;
+	MWCOORD	offy = 0;
+
+	/* map src window to screen coords*/
+	if(hwndFrom) {
+		offx = hwndFrom->clirect.left;
+		offy = hwndFrom->clirect.top;
+	}
+
+	/* map to dst window client coords*/
+	if(hwndTo) {
+		offx -= hwndTo->clirect.left;
+		offy -= hwndTo->clirect.top;
+	}
+
+	/* adjust points*/
+	while(cPoints--) {
+		lpPoints->x += offx;
+		lpPoints->y += offy;
+		++lpPoints;
+	}
+	return (int)MAKELONG(offx, offy);
+}
+
+BOOL WINAPI
+SetRect(LPRECT lprc, int xLeft, int yTop, int xRight, int yBottom)
+{
+	lprc->left = xLeft;
+	lprc->top = yTop;
+	lprc->right = xRight;
+	lprc->bottom = yBottom;
+	return TRUE;
+}
+
+BOOL WINAPI
+SetRectEmpty(LPRECT lprc)
+{
+	lprc->left = lprc->right = lprc->top = lprc->bottom = 0;
+	return TRUE;
+}
+
+BOOL WINAPI
+CopyRect(LPRECT lprcDst, CONST RECT *lprcSrc)
+{
+	*lprcDst = *lprcSrc;
+	return TRUE;
+}
+
+BOOL WINAPI
+IsRectEmpty(CONST RECT *lprc)
+{
+	/* FIXME: should this just be ==, not <= ?*/
+	/*return lprc->left == lprc->right || lprc->top == lprc->bottom;*/
+	return lprc->right <= lprc->left || lprc->bottom <= lprc->top;
+}
+
+BOOL WINAPI
+InflateRect(LPRECT lprc, int dx, int dy)
+{
+	lprc->left -= dx;
+	lprc->top -= dy;
+	lprc->right += dx;
+	lprc->bottom += dy;
+	return TRUE;
+}
+
+BOOL WINAPI
+OffsetRect(LPRECT lprc, int dx, int dy)
+{
+	lprc->left += dx;
+	lprc->right += dx;
+	lprc->top += dy;
+	lprc->bottom += dy;
+	return TRUE;
+}
+
+/* PtInRect is #defined to MwPTINRECT because of bcc struct passing bug*/
+BOOL WINAPI
+MwPTINRECT(CONST RECT *lprc, POINT pt)
+{
+	return (pt.x >= lprc->left && pt.x < lprc->right &&
+		pt.y >= lprc->top && pt.y < lprc->bottom);
+}
+
+LONG WINAPI
+GetWindowLong(HWND hwnd, int nIndex)
+{
+	switch(nIndex) {
+	case GWL_WNDPROC:
+		return (LONG)hwnd->pClass->lpfnWndProc;
+	case GWL_HINSTANCE:
+		/* nyi*/
+		break;
+	case GWL_HWNDPARENT:
+		return (LONG)hwnd->parent;
+	case GWL_ID:
+		return hwnd->id;
+	case GWL_STYLE:
+		return hwnd->style;
+	case GWL_EXSTYLE:
+		return hwnd->exstyle;
+	case GWL_USERDATA:
+		return hwnd->userdata;
+	default:
+		if(nIndex+3 < hwnd->nextrabytes)
+			return *(LONG *)&hwnd->extrabytes[nIndex];
+	}
+	return 0;
+}
+
+LONG WINAPI
+SetWindowLong(HWND hwnd, int nIndex, LONG lNewLong)
+{
+	LONG	oldval = 0;
+
+	switch(nIndex) {
+	case GWL_USERDATA:
+		oldval = hwnd->userdata;
+		hwnd->userdata = lNewLong;
+		break;
+	case GWL_WNDPROC:
+		oldval = (LONG)hwnd->pClass->lpfnWndProc;
+		hwnd->pClass->lpfnWndProc = (WNDPROC)lNewLong;
+		break;
+	case GWL_HINSTANCE:
+	case GWL_HWNDPARENT:
+	case GWL_ID:
+	case GWL_STYLE:
+	case GWL_EXSTYLE:
+		/* nyi*/
+		break;
+	default:
+		if(nIndex+3 < hwnd->nextrabytes) {
+			oldval = GetWindowLong(hwnd, nIndex);
+			*(LONG *)&hwnd->extrabytes[nIndex] = lNewLong;
+		}
+		break;
+	}
+	return oldval;
+}
+
+WORD WINAPI
+GetWindowWord(HWND hwnd, int nIndex)
+{
+	if(nIndex+1 < hwnd->nextrabytes)
+		return *(WORD *)&hwnd->extrabytes[nIndex];
+	return 0;
+}
+
+WORD WINAPI
+SetWindowWord(HWND hwnd, int nIndex, WORD wNewWord)
+{
+	WORD	oldval = 0;
+
+	if(nIndex+1 < hwnd->nextrabytes) {
+		oldval = GetWindowWord(hwnd, nIndex);
+		*(WORD *)&hwnd->extrabytes[nIndex] = wNewWord;
+	}
+	return oldval;
+}
+
+DWORD WINAPI
+GetClassLong(HWND hwnd, int nIndex)
+{
+	switch(nIndex) {
+	case GCL_HBRBACKGROUND:
+		return (DWORD)hwnd->pClass->hbrBackground;
+	case GCL_CBWNDEXTRA:
+		return (DWORD)hwnd->pClass->cbWndExtra;
+	}
+	return 0;
+}
+
+int WINAPI
+GetWindowTextLength(HWND hwnd)
+{
+	return SendMessage(hwnd, WM_GETTEXTLENGTH, 0, 0L);
+}
+
+int WINAPI
+GetWindowText(HWND hwnd, LPSTR lpString, int nMaxCount)
+{
+	return SendMessage(hwnd, WM_GETTEXT, nMaxCount,(LPARAM)(LPSTR)lpString);
+}
+
+BOOL WINAPI
+SetWindowText(HWND hwnd, LPCSTR lpString)
+{
+	return SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM)(LPCSTR)lpString);
+}
+
+/* Recursively offset all children of passed window*/
+static void
+MwOffsetChildren(HWND hwnd, int offx, int offy)
+{
+	HWND	cp;
+
+	/* offset all child windows for move*/
+	for(cp=hwnd->children; cp; cp=cp->siblings) {
+
+		/* offset window and client area rects*/
+		OffsetRect(&cp->winrect, offx, offy);
+		OffsetRect(&cp->clirect, offx, offy);
+
+		/* offset scrollbar NC hittest rects*/
+		if(!IsRectEmpty(&cp->vscroll.rc))
+			OffsetRect(&cp->vscroll.rc, offx, offy);
+		if(!IsRectEmpty(&cp->hscroll.rc))
+			OffsetRect(&cp->hscroll.rc, offx, offy);
+		MwOffsetChildren(cp, offx, offy);
+	}
+}
+
+BOOL
+SetWindowPos(HWND hwnd, HWND hwndInsertAfter, int x, int y, int cx, int cy,
+	UINT fuFlags)
+{
+	int		hidden;
+	BOOL		bMove, bSize, bZorder;
+	MWCOORD		offx = 0, offy = 0;	/* = 0 for bad gcc warning*/
+	WINDOWPOS	winpos;
+
+	if(!hwnd || hwnd == rootwp || cx < 0 || cy < 0)
+		return FALSE;
+
+	/* FIXME SWP_NOACTIVATE*/
+
+	if((fuFlags & SWP_SHOWWINDOW))
+		return ShowWindow(hwnd, SW_SHOW);
+
+	if((fuFlags & SWP_HIDEWINDOW))
+		return ShowWindow(hwnd, SW_HIDE);
+
+	/* move is relative to parent's client rect for child windows*/
+	if(hwnd->style & WS_CHILD) {
+		x += hwnd->parent->clirect.left;
+		y += hwnd->parent->clirect.top;
+	} else {
+		x += hwnd->parent->winrect.left;
+		y += hwnd->parent->winrect.top;
+	}
+
+	bMove = !(fuFlags & SWP_NOMOVE) &&
+			(hwnd->winrect.left != x || hwnd->winrect.top != y);
+	bSize = !(fuFlags & SWP_NOSIZE) &&
+			((hwnd->winrect.right - hwnd->winrect.left) != cx ||
+		 	(hwnd->winrect.bottom - hwnd->winrect.top) != cy);
+	bZorder = !(fuFlags & SWP_NOZORDER);
+	if(!bMove && !bSize && !bZorder)
+		return TRUE;
+
+	/* could optimize to not require redraw when possible*/
+	hidden = hwnd->unmapcount || (fuFlags & SWP_NOREDRAW);
+
+	if(bZorder) {
+		switch((int)hwndInsertAfter) {
+		case (int)HWND_TOP:
+			MwRaiseWindow(hwnd);
+			break;
+		case (int)HWND_BOTTOM:
+			MwLowerWindow(hwnd);
+			break;
+		default:
+			/* FIXME for non top/bottom zorder*/
+			break;
+		}
+	} else {
+		if(!hidden)
+			MwHideWindow(hwnd, FALSE, FALSE);
+	}
+
+	if(bMove) {
+		offx = x - hwnd->winrect.left;
+		offy = y - hwnd->winrect.top;
+	}
+	if(bMove || bSize) {
+		hwnd->winrect.left = x;
+		hwnd->winrect.top = y;
+		hwnd->winrect.right = x + cx;
+		hwnd->winrect.bottom = y + cy;
+	}
+	if(bMove)
+		MwOffsetChildren(hwnd, offx, offy);
+
+	if(bMove || bSize) {
+		MwCalcClientRect(hwnd);
+
+		/* send windowposchanged message*/
+		/* FIXME: move WM_MOVE, WM_SIZE to defwndproc*/
+		winpos.hwnd = hwnd;
+		winpos.hwndInsertAfter = hwndInsertAfter;
+		winpos.x = x;
+		winpos.y = y;
+		winpos.cx = cx;
+		winpos.cy = cy;
+		winpos.flags = fuFlags;
+		SendMessage(hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)&winpos);
+
+		MwSendSizeMove(hwnd, bSize, bMove);
+	}
+
+	++mwpaintSerial;	/* increment paint serial # for alphablending*/
+	++mwpaintNC;		/* increment paint serial # for NC painting*/
+	if(!bZorder && !hidden)
+		MwShowWindow(hwnd, FALSE);
+
+	return TRUE;
+}
+
+BOOL WINAPI
+MoveWindow(HWND hwnd, int x, int y, int nWidth, int nHeight, BOOL bRepaint)
+{
+	UINT	flags = SWP_NOZORDER | SWP_NOACTIVATE;
+
+	if(!bRepaint)
+		flags |= SWP_NOREDRAW;
+	return SetWindowPos(hwnd, 0, x, y, nWidth, nHeight, flags);
+}
+
+void
+MwSendSizeMove(HWND hwnd, BOOL bSize, BOOL bMove)
+{
+	DWORD	dwStyle;
+	RECT	rc;
+
+	if(bSize) {
+		GetClientRect(hwnd, &rc);
+		SendMessage(hwnd, WM_SIZE, SIZE_RESTORED,
+			MAKELONG(rc.right, rc.bottom));
+	}
+	if(bMove) {
+		dwStyle = GetWindowLong(hwnd, GWL_STYLE);
+		GetWindowRect(hwnd, &rc);
+		/* return parent coords for child windows*/
+		if(dwStyle & WS_CHILD)
+			ScreenToClient(hwnd->parent, (LPPOINT)&rc.left);
+		SendMessage(hwnd, WM_MOVE, 0, MAKELONG(rc.left, rc.top));
+	}
+}
+
+/*
+ * Specify a cursor for a window.
+ * This cursor will only be used within that window, and by default
+ * for its new children.  If the cursor is currently within this
+ * window, it will be changed to the new one immediately.
+ */
+void
+MwSetCursor(HWND wp, PMWCURSOR pcursor)
+{
+	HCURSOR	cp;
+	int	bytes;
+
+	if(!wp || !pcursor)
+		return;
+
+	bytes = MWIMAGE_SIZE(pcursor->width,pcursor->height)
+		* sizeof(MWIMAGEBITS);
+
+	/*
+	 * See if the window is using a shared cursor definition.
+	 * If so, then allocate a new private one, otherwise reuse it.
+	 */
+	cp = wp->cursor;
+	if (!cp || cp->usecount-- > 1) {
+		cp = GdItemNew(struct hcursor);
+		if(!cp)
+			return;
+	}
+
+	cp->usecount = 1;
+	cp->cursor.width = pcursor->width;
+	cp->cursor.height = pcursor->height;
+	cp->cursor.hotx = pcursor->hotx;
+	cp->cursor.hoty = pcursor->hoty;
+	cp->cursor.fgcolor = pcursor->fgcolor;
+	cp->cursor.bgcolor = pcursor->bgcolor;
+	memcpy(cp->cursor.image, pcursor->image, bytes);
+	memcpy(cp->cursor.mask, pcursor->mask, bytes);
+	wp->cursor = cp;
+
+	/*
+	 * If this was the current cursor, then draw the new one.
+	 */
+	if (cp == curcursor || curcursor == NULL) {
+		GdMoveCursor(cursorx - cp->cursor.hotx,
+			cursory - cp->cursor.hoty);
+		GdSetCursor(&cp->cursor);
+	}
+}
+
+BOOL WINAPI
+GetCursorPos(LPPOINT lpPoint)
+{
+	MWCOORD	x, y;
+
+	if(lpPoint) {
+		GdGetCursorPos(&x, &y);
+		lpPoint->x = x;
+		lpPoint->y = y;
+		return TRUE;
+	}
+	return FALSE;
+}
+
+HWND WINAPI
+GetCapture(VOID)
+{
+	return capturewp;
+}
+
+HWND WINAPI
+SetCapture(HWND hwnd)
+{
+	HWND	oldCapture = capturewp;
+
+	capturewp = hwnd;
+	MwCheckMouseWindow();
+	return oldCapture;
+}
+
+BOOL WINAPI
+ReleaseCapture(VOID)
+{
+	capturewp = NULL;
+	MwCheckMouseWindow();
+	return TRUE;
+}
+
+struct timer {			/* private timer structure*/
+	HWND	hwnd;		/* window associated with timer, NULL if none*/
+	UINT	idTimer;	/* id for timer*/
+	UINT	uTimeout;	/* timeout value, in msecs*/
+	DWORD	dwClockExpires;	/* GetTickCount timer expiration value*/
+	TIMERPROC lpTimerFunc;	/* callback function*/
+};
+
+static struct timer timer;	/* single global timer FIXME*/
+
+UINT WINAPI
+SetTimer(HWND hwnd, UINT idTimer, UINT uTimeout, TIMERPROC lpTimerFunc)
+{
+	static UINT nextID = 0;	/* next ID when hwnd is NULL*/
+
+	/* assign timer id based on valid window handle*/
+	timer.hwnd = hwnd;
+	timer.idTimer = hwnd? idTimer: ++nextID;
+	timer.uTimeout = uTimeout;
+	timer.dwClockExpires = GetTickCount() + uTimeout;
+	timer.lpTimerFunc = lpTimerFunc;
+
+	return timer.idTimer;
+}
+
+BOOL WINAPI
+KillTimer(HWND hwnd, UINT idTimer)
+{
+	if(timer.hwnd == hwnd && timer.idTimer == idTimer) {
+		timer.uTimeout = 0;
+		return TRUE;
+	}
+	return FALSE;
+}
+
+/*
+ * Return the next timeout value in msecs
+ */
+UINT
+MwGetNextTimeoutValue(void)
+{
+	int	timeout;
+
+	if(timer.uTimeout) {
+		timeout = timer.dwClockExpires - GetTickCount();
+		if(timeout > 0)
+			return timeout;
+	}
+	return 0;
+}
+
+/*
+ * Check if any timers have expired by looking at current system ticks
+ */
+void
+MwHandleTimers(void)
+{
+	int	timeout;
+	DWORD	dwTime;
+
+	/* check if timer running*/
+	if(timer.uTimeout == 0)
+		return;
+
+	/* determine if timer expired*/
+	dwTime = GetTickCount();
+	timeout = timer.dwClockExpires - dwTime;
+	if(timeout > 0)
+		return;
+
+	/* call timer function or post timer message*/
+	if(timer.lpTimerFunc)
+		timer.lpTimerFunc(timer.hwnd, WM_TIMER, timer.idTimer, dwTime);
+	else PostMessage(timer.hwnd, WM_TIMER, timer.idTimer, 0);
+
+	/* reset timer*/
+	timer.dwClockExpires = dwTime + timer.uTimeout;
+}
+
+int WINAPI
+GetSystemMetrics(int nIndex)
+{
+	switch(nIndex) {
+	case SM_CXSCREEN:
+		return scrdev.xvirtres;
+	case SM_CYSCREEN:
+		return scrdev.yvirtres;
+	case SM_CXVSCROLL:
+		return mwSYSMETRICS_CXVSCROLL;
+	case SM_CYHSCROLL:
+		return mwSYSMETRICS_CYHSCROLL;
+	case SM_CYCAPTION:
+		/* + 1 for line under caption*/
+		return mwSYSMETRICS_CYCAPTION + 1;
+	case SM_CXBORDER:
+		return mwSYSMETRICS_CXBORDER;
+	case SM_CYBORDER:
+		return mwSYSMETRICS_CYBORDER;
+	case SM_CYMENU:
+		break;		/* FIXME: 19 when menubars work*/
+	case SM_CYVSCROLL:
+		return mwSYSMETRICS_CYVSCROLL;
+	case SM_CXHSCROLL:
+		return mwSYSMETRICS_CXHSCROLL;
+	case SM_CXFRAME:
+	case SM_CXDLGFRAME:
+		return mwSYSMETRICS_CXFRAME;
+	case SM_CYFRAME:
+	case SM_CYDLGFRAME:
+		return mwSYSMETRICS_CYFRAME;
+	}
+	return 0;
+}
+
+HWND WINAPI
+GetDlgItem(HWND hDlg, int nIDDlgItem)
+{
+	HWND	wp;
+
+	if(hDlg) {
+		for(wp=hDlg->children; wp; wp=wp->siblings)
+			if(wp->id == nIDDlgItem)
+				return wp;
+	}
+	return 0;
+}
Binary files lib/microwindows/src/mwin.tgz and /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/mwin.tgz differ
diff -urN lib/microwindows/src/nano-X.cfg /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nano-X.cfg
--- lib/microwindows/src/nano-X.cfg	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nano-X.cfg	2005-02-21 16:13:43.000000000 +0100
@@ -0,0 +1,201 @@
+# Font Configuration file for nano-X: T1 fonts (URW)
+# EXPERIMENTAL, SUBJECT TO CHANGE
+# This file is only used if Nano-X is compiled with #define FONTMAPPER 1
+#
+# This file is used by specifying the '-c' option to the nano-X server.  Several
+# such configuration files may be specified with multiple '-c' options.
+
+# Only use 'clear-fonts' once before setting up all the fonts, possibly from different
+# files, e.g. one file for genuine PostScript files, one for similar files, one for
+# builtin fonts, one for freetype fonts etc., but only one 'clear-fonts':
+clear-fonts
+
+
+# There are two font-definition formats:
+#
+#  font <foundry> <family>	<fontname>			<attributes>				<renderer>,<physical-fontname>
+#  font alias	<family>	<fontname>			<attributes>				[<foundry>],<fontname>
+#
+# The family name is used to find a related font with different style, e.g. ask for "Times New Roman",
+# which is an upright font, and then be able to say "I want it in Italics".  What happens is that
+# the family name of "Times New Roman", which is "Times", is used as a basis to find a font whose
+# attributes best match those sought.
+
+# Some aliases for use by Browsers etc.
+font	alias	-		Serif				Proportional,Serif			Times
+font	alias	-		Sans-serif			Proportional,Sans-serif			Helvetica
+font	alias	-		Fantasy				Proportional,Serif			NewCewturySchlbk
+font	alias	-		Cursive				Proportional,Serif			ChanceryL,ChanceryL-MediItal
+font	alias	-		Monospace			Monospace,Serif				NimbusMonL
+
+# This is a "Times" Lookalike font
+font	unknown	-		NimbusRomNo9L-Regu		Proportional,Serif,Regular,Roman	T1,n021003l
+font	unknown	-		NimbusRomNo9L-ReguItal		Proportional,Serif,Regular,Italic	T1,n021023l
+font	unknown	-		NimbusRomNo9L-Medi		Proportional,Serif,Medium,Roman		T1,n021004l
+font	unknown	-		NimbusRomNo9L-MediItal		Proportional,Serif,Medium,Italic	T1,n021024l
+font	alias	NimbusRomNo9L	"NimbusRomNo9L Regular"		Proportional,Serif,Regular,Roman	unknown,NimbusRomNo9L-Regu
+font	alias	NimbusRomNo9L	"NimbusRomNo9L Regular Italic"	Proportional,Serif,Regular,Italic	unknown,NimbusRomNo9L-ReguItal
+font	alias	NimbusRomNo9L	"NimbusRomNo9L Medium"		Proportional,Serif,Medium,Roman		unknown,NimbusRomNo9L-Medi
+font	alias	NimbusRomNo9L	"NimbusRomNo9L Medium Italic"	Proportional,Serif,Medium,Italic	unknown,NimbusRomNo9L-MediItal
+
+font	alias	Times		"Times Roman"			Proportional,Serif,Regular,Roman	unknown,NimbusRomNo9L-Regu
+font	alias	Times		"Times Italic"			Proportional,Serif,Regular,Italic	unknown,NimbusRomNo9L-ReguItal
+font	alias	Times		"Times Bold"			Proportional,Serif,Bold,Roman		unknown,NimbusRomNo9L-Medi
+font	alias	Times		"Times Bold Italic"		Proportional,Serif,Bold,Italic		unknown,NimbusRomNo9L-MediItal
+
+font	alias	Times		"Times New Roman"		Proportional,Serif,Regular,Roman	unknown,NimbusRomNo9L-Regu
+font	alias	Times		"Times New Italic"		Proportional,Serif,Regular,Italic	unknown,NimbusRomNo9L-ReguItal
+font	alias	Times		"Times New Bold"		Proportional,Serif,Bold,Roman		unknown,NimbusRomNo9L-Medi
+font	alias	Times		"Times New Bold Italic"		Proportional,Serif,Bold,Italic		unknown,NimbusRomNo9L-MediItal
+
+
+# This is a Helvetica font
+font	unknown	-		NimbusSanL-Regu			Proportional,Sans-serif,Regular,Roman	T1,n019003l
+font	unknown	-		NimbusSanL-ReguItal		Proportional,Sans-serif,Regular,Italic 	T1,n019023l
+font	unknown	-		NimbusSanL-Bold			Proportional,Sans-serif,Bold,Roman	T1,n019004l
+font	unknown	-		NimbusSanL-BoldItal		Proportional,Sans-serif,Bold,Italic	T1,n019024l
+font	alias	NimbusSanL	"NimbusSanL Regular"		Proportional,Sans-serif,Regular,Roman	unknown,NimbusSanL-Regu
+font	alias	NimbusSanL	"NimbusSanL Regular Italic"	Proportional,Sans-serif,Regular,Italic	unknown,NimbusSanL-ReguItal
+font	alias	NimbusSanL	"NimbusSanL Bold"		Proportional,Sans-serif,Bold,Roman	unknown,NimbusSanL-Bold
+font	alias	NimbusSanL	"NimbusSanL Bold Italic"	Proportional,Sans-serif,Bold,Italic	unknown,NimbusSanL-BoldItal
+
+font	alias	Helvetica	"Helvetica"			Proportional,Sans-serif,Regular,Roman		unknown,NimbusSanL-Regu
+font	alias	Helvetica	"Helvetica Oblique"		Proportional,Sans-serif,Regular,Oblique		unknown,NimbusSanL-ReguItal
+font	alias	Helvetica	"Helvetica Bold"		Proportional,Sans-serif,Bold,Roman		unknown,NimbusSanL-Bold
+font	alias	Helvetica	"Helvetica Bold Oblique"	Proportional,Sans-serif,Bold,Oblique		unknown,NimbusSanL-BoldItal
+
+
+# This is a "courier" font
+font	unknown	-		NimbusMonL-Regu			Monospace,Serif,Regular,Roman		T1,n022003l
+font	unknown	-		NimbusMonL-ReguObli		Monospace,Serif,Regular,Oblique		T1,n022023l
+font	unknown	-		NimbusMonL-Bold			Monospace,Serif,Bold,Roman		T1,n022004l
+font	unknown	-		NimbusMonL-BoldObli		Monospace,Serif,Bold,Oblique   		T1,n022024l
+font	alias	NimbusMonL	"NimbusMonL Regular"		Monospace,Serif,Regular,Roman		unknown,NimbusMonL-Regu
+font	alias	NimbusMonL	"NimbusMonL Regular Oblique"	Monospace,Serif,Regular,Olique  	unknown,NimbusMonL-ReguObli
+font	alias	NimbusMonL	"NimbusMonL Bold"		Monospace,Serif,Bold,Roman		unknown,NimbusMonL-Bold
+font	alias	NimbusMonL	"NimbusMonL Bold Oblique"	Monospace,Serif,Bold,Oblique   		unknown,NimbusMonL-BoldObli
+
+font	alias	Courier		"Courier"			Monospace,Serif,Regular,Roman		unknown,NimbusMonL-Regu
+font	alias	Courier		"Courier Oblique"		Monospace,Serif,Regular,Oblique		unknown,NimbusMonL-ReguObli
+font	alias	Courier		"Courier Bold"			Monospace,Serif,Bold,Roman		unknown,NimbusMonL-Bold
+font	alias	Courier		"Courier Bold Oblique"		Monospace,Serif,Bold,Oblique		unknown,NimbusMonL-BoldObli
+
+
+# This is a "Palatino" lookalike
+font	URW	-		PalladioL-Roma			Proportional,Serif,Regular,Roman	T1,p052003l
+font	URW	-		PalladioL-Ital			Proportional,Serif,Regular,Italic	T1,p052023l
+font	URW	-		PalladioL-Bold			Proportional,Serif,Bold,Roman		T1,p052004l
+font	URW	-		PalladioL-BoldItal		Proportional,Serif,Bold,Italic		T1,p052024l
+font	alias	PalladioL	"PalladioL Roman"		Proportional,Serif,Regular,Roman  	URW,PalladioL-Roma
+font	alias	PalladioL	"PalladioL Italic"		Proportional,Serif,Regular,Italic	URW,PalladioL-Ital
+font	alias	PalladioL	"PalladioL Bold"		Proportional,Serif,Bold,Roman		URW,PalladioL-Bold
+font	alias	PalladioL	"PalladioL Bold Italic"		Proportional,Serif,Bold,Italic		URW,PalladioL-BoldItal
+
+font	alias	Palatino	"Palatino Roman"		Proportional,Serif,Regular,Roman	URW,URWPalladioL-Roma
+font	alias	Palatino	"Palatino Italic"		Proportional,Serif,Regular,Italic	URW,URWPalladioL-Ital
+font	alias	Palatino	"Palatino Bold"			Proportional,Serif,Bold,Roman		URWPalladioL-Bold
+font	alias	Palatino	"Palatino Bold Italic"		Proportional,Serif,Bold,Italic		URWPalladioL-BoldItal
+
+
+# Schoolbook
+font	unknown	-		CenturySchL-Roma		Proportional,Serif,Regular,Roman	T1,c059013l
+font	unknown	-		CenturySchL-Ital		Proportional,Serif,Regular,Italic	T1,c059033l
+font	unknown	-		CenturySchL-Bold		Proportional,Serif,Bold,Roman		T1,c059016l
+font	unknown	-		CenturySchL-BoldItal		Proportional,Serif,Bold,Italic	 	T1,c059036l
+font	alias	CenturySchL	"CenturySchL Roman"		Proportional,Serif,Regular,Roman	unknown,CenturySchL-Roma
+font	alias	CenturySchL	"CenturySchL Ital"		Proportional,Serif,Regular,Italic	unknown,CenturySchL-Ital
+font	alias	CenturySchL	"CenturySchL Bold"		Proportional,Serif,Bold,Roman		unknown,CenturySchL-Bold
+font	alias	CenturySchL	"CenturySchL Bold Italic"	Proportional,Serif,Bold,Italic	 	unknown,CenturySchL-BoldItal
+
+font	alias	NewCewturySchlbk	"NewCewturySchlbk Roman"	Proportional,Serif,Regular,Roman	unknown,CenturySchL-Roma
+font	alias	NewCewturySchlbk	"NewCewturySchlbk Italic"	Proportional,Serif,Regular,Italic	unknown,CenturySchL-Ital
+font	alias	NewCewturySchlbk	"NewCewturySchlbk Bold"		Proportional,Serif,Bold,Roman		unknown,CenturySchL-Bold
+font	alias	NewCewturySchlbk	"NewCewturySchlbk Bold Italic"	Proportional,Serif,Bold,Italic		unknown,CenturySchL-BoldItal
+
+
+# Bookman
+font	URW	-		BookmanL-DemiBold		Proportional,Serif,Demibold,Roman	T1,b018015l
+font	URW	-		BookmanL-DemiBoldItal		Proportional,Serif,Demibold,Italic	T1,b018035l
+font	URW	-		BookmanL-Ligh			Proportional,Serif,Light,Roman 		T1,b018012l
+font	URW	-		BookmanL-LighItal		Proportional,Serif,Light,Italic   	T1,b018032l
+font	alias	BookmanL	"BookmanL DemiBold"		Proportional,Serif,Demibold,Roman	URW,BookmanL-DemiBold
+font	alias	BookmanL	"BookmanL DemiBold Italic"	Proportional,Serif,Demibold,Italic	URW,BookmanL-DemiBoldItal
+font	alias	BookmanL	"BookmanL Light"		Proportional,Serif,Light,Roman		URW,BookmanL-Ligh
+font	alias	BookmanL	"BookmanL Light Italic"		Proportional,Serif,Light,Italic		URW,BookmanL-LighItal
+
+font	alias	Bookman		"Bookman Demi"			Proportional,Serif,Demibold,Roman	URW,BookmanL-DemiBold
+font	alias	Bookman		"Bookman Demibold"		Proportional,Serif,Demibold,Roman	URW,BookmanL-DemiBold
+font	alias	Bookman		"Bookman Demi Italic"		Proportional,Serif,Demibold,Italic	URW,BookmanL-DemiBoldItal
+font	alias	Bookman		"Bookman Demibold Italic"	Proportional,Serif,Demibold,Italic	URW,BookmanL-DemiBoldItal
+font	alias	Bookman		"Bookman Light"			Proportional,Serif,Light,Roman       	URW,BookmanL-Ligh
+font	alias	Bookman		"Bookman Light Italic"		Proportional,Serif,Light,Italic   	URW,BookmanL-LighItal
+font	alias	Bookman		"Bookman Bold"			Proportional,Serif,Demibold,Roman	URW,BookmanL-DemiBold
+font	alias	Bookman		"Bookman Bold Italic"		Proportional,Serif,Demibold,Italic	URW,BookmanL-DemiBoldItal
+
+# Gothic
+font	URW	-		GothicL-Book			Regular,Sans-serif	        	T1,a010013l
+font	URW	-		GothicL-BookObli		Regular,Oblique,Sans-serif	    	T1,a010033l
+font	URW	-		GothicL-Demi			Demibold,Sans-serif		       	T1,a010015l
+font	URW	-		GothicL-DemiObli		Demibold,Oblique,Sans-serif	    	T1,a010035l
+font	alias	GothicL		"GothicL Book"			Regular,Sans-serif			URW,GothicL-Book
+font	alias	GothicL		"GothicL Book Oblique"		Regular,Oblique,Sans-serif	    	URW,GothicL-BookObli
+font	alias	GothicL		"GothicL Demibold"		Demibold,Sans-serif		       	URW,GothicL-Demi
+font	alias	GothicL		"GothicL Demi Oblique"		Demibold,Oblique,Sans-serif	    	URW,GothicL-DemiObli
+font	alias	GothicL		"GothicL Demibold Oblique"	Demibold,Oblique,Sans-serif	    	URW,GothicL-DemiObli
+
+# A condensed Sans-serif font (narrow)
+font	unknown	-		NimbusSanL-ReguCond			Proportional,Sans-serif,Regular,Condensed    		T1,n019043l
+font	unknown	-		NimbusSanL-ReguCondItal			Proportional,Sans-serif,Regular,Condensed,Italic   	T1,n019063l
+font	unknown	-		NimbusSanL-BoldCond			Proportional,Sans-serif,Bold,Condensed		    	T1,n019044l
+font	unknown	-		NimbusSanL-BoldCondItal			Proportional,Sans-serif,Bold,Condensed,Italic   	T1,n019064l
+font	alias	NimbusSanL	"NimbusSanL Regular Condensed"		Proportional,Sans-serif,Regular,Condensed    		unknown,NimbusSanL-ReguCond
+font	alias	NimbusSanL	"NimbusSanL Regular Condensed Italic"	Proportional,Sans-serif,Regular,Condensed,Italic	unknown,NimbusSanL-ReguCondItal
+font	alias	NimbusSanL	"NimbusSanL Bold Condensd"		Proportional,Sans-serif,Bold,Condensed		  	unknown,NimbusSanL-BoldCond
+font	alias	NimbusSanL	"NimbusSanL Bold Condensed Italic"	Proportional,Sans-serif,Bold,Condensed,Italic   	unknown,NimbusSanL-BoldCondItal
+
+font	alias	"Helvetica Narrow"	"Helvetica Narrow"		Proportional,Sans-serif,Condensed,Regular,Roman	  unknown,NimbusSanL-ReguCond
+font	alias	"Helvetica Narrow"	"Helvelica Narrow-Oblique"	Proportional,Sans-serif,Condensed,Regular,Oblique unknown,NimbusSanL-ReguCondItal
+font	alias	"Helvetica Narrow"	"Helvelica Narrow-Bold"		Proportional,Sans-serif,Condensed,Bold,Roman	  unknown,NimbusSanL-BoldCond
+font	alias	"Helvetica Narrow"	"Helvelica Narrow-BoldOblique"	Proportional,Sans-serif,Condensed,Bold,Oblique	  unknown,NimbusSanL-BoldCondItal
+
+
+
+# Misc fonts
+font	unknown	-		StandardSymL-Regu		Regular					T1,s050000l
+font	alias	-		"Standard Symbol"		Regular					StandardSymL-Regu
+
+font	unknown	-		Dingbats-Regu			Regular					T1,d050000l
+font	alias	-		Dingbats			Regular					Dingbats-Regu
+
+font	URW	ChanceryL	ChanceryL-MediItal		Proportional,Serif,Medium,Italic	z003034l
+font	alias	-		Chancery			Proportional,Serif,Medium,Italic	ChanceryL,ChanceryL-MediItal
+font	alias	-		"Zapf Chancery"			Proportional,Serif,Medium,Italic	ChanceryL,ChanceryL-MediItal
+font	alias	-		"Zapf Chancery Medium Italic"	Proportional,Serif,Medium,Italic	ChanceryL,ChanceryL-MediItal
+
+
+# Aliases
+
+
+
+font	alias	AvantGarde	"AvantGarde Book"		Proportional,Sans-serif,Regular,Roman		URW,URWGothicL-Book
+font	alias	AvantGarde	"AvantGarde BookOblique"	Proportional,Sans-serif,Regular,Oblique		URW,URWGothicL-BookObli
+font	alias	AvantGarde	"AvantGarde Demi"		Proportional,Sans-serif,DemiBold,Roman		URWGothicL-Demi
+font	alias	AvantGarde	"AvantGarde DemiOblique"	Proportional,Sans-serif,DemiBold,Oblique	URW,URWGothicL-DemiObli
+
+
+
+
+# /Symbol                         /StandardSymL   ;
+# 
+# /ZapfChancery-MediumItalic      /URWChanceryL-MediItal  ;
+# 
+# /ZapfDingbats                   /Dingbats       ;
+
+
+
+# The default Microwindows and Nano-X fonts
+# font	MWF	-		System				Proportional,Sans-serif,Regular,Roman,Normal		MWF,System
+# font	MWF	-		Helvetica			Proportional,Sans-serif,Regular,Roman,Normal		MWF,Helvetica
+# font	MWF	-		Terminal			Regular,Roman,Normal,Monospace,Sans-serif		MWF,Terminal
+# font	MWF	-		SystemFixed			Regular,Roman,Normal,Monospace,Sans-serif		MWF,SystemFixed
+
diff -urN lib/microwindows/src/nanowm-ecos/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/Makefile
--- lib/microwindows/src/nanowm-ecos/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/Makefile	2005-02-21 16:13:41.000000000 +0100
@@ -0,0 +1,42 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+ifndef TOP
+TOP = ..
+CONFIG = $(TOP)/config
+endif
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES +=
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME = libNanoXApp.a
+
+# List of objects to compile
+OBJS = nanowm.o events.o wlist.o clients.o actions.o
+
+all: default
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+
diff -urN lib/microwindows/src/nanowm-ecos/actions.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/actions.c
--- lib/microwindows/src/nanowm-ecos/actions.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/actions.c	2005-02-21 16:13:41.000000000 +0100
@@ -0,0 +1,496 @@
+/*
+ * NanoWM - Window Manager for Nano-X
+ *
+ * Copyright (C) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+#include "nxdraw.h"
+/* Uncomment this if you want debugging output from this file */
+//#define DEBUG
+#include "nanowm.h"
+
+/* uncomment this line to perform outline move operations*/
+//#define OUTLINE_MOVE
+
+void redraw_ncarea(win *window)
+{
+	GR_WINDOW_INFO info;
+	GR_WM_PROPERTIES props;
+	GR_BOOL active;
+
+//	diag_printf("NanoWM: container_exposure window %d\n", window->wid);
+
+	GrGetWindowInfo(window->wid, &info);
+
+	GrGetWMProperties(window->clientid, &props);
+
+	/*
+	 * Check for invalid window.  This will be the
+	 * case if the client exited, and we're just
+	 * getting the paint notification for our parent.
+	 */
+	if (props.flags == 0)
+		return;
+
+	active = (window->clientid == GrGetFocus());
+	nxPaintNCArea(window->wid, info.width, info.height, props.title,
+		active, props.props);
+}
+
+void container_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	//diag_printf("NanoWM: container_exposure window %d\n", window->wid);
+
+	redraw_ncarea(window);
+}
+
+static GR_BOOL
+PtInRect(GR_RECT *prc, GR_SIZE x, GR_SIZE y)
+{
+	return (x >= prc->x && x < (prc->x+prc->width) &&
+		y >= prc->y && y < (prc->y+prc->height));
+}
+
+void container_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	struct pos_size *pos;
+	GR_RECT		r;
+	GR_COORD	cxborder = 0, cyborder = 0;
+	GR_WINDOW_INFO	info;
+	GR_GC_ID        gc;
+	//diag_printf("container_buttondown window %d\n", window->wid);
+
+	if(window->active) return;
+
+	GrGetWindowInfo(window->wid, &info);
+
+	/* calc border sizes*/
+	if (info.props & GR_WM_PROPS_BORDER) {
+		cxborder = 1;
+		cyborder = 1;
+	}
+	if (info.props & GR_WM_PROPS_APPFRAME) {
+		cxborder = CXBORDER;
+		cyborder = CYBORDER;
+	}
+
+	/* Check for close box press*/
+	if ((info.props & (GR_WM_PROPS_CAPTION|GR_WM_PROPS_CLOSEBOX)) ==
+	    (GR_WM_PROPS_CAPTION|GR_WM_PROPS_CLOSEBOX)) {
+
+		/* Get close box rect*/
+		r.x = info.width - CXCLOSEBOX - cxborder - 2;
+		r.y = cyborder + 2;
+		r.width = CXCLOSEBOX;
+		r.height = CYCLOSEBOX;
+
+		/* Check mousedn in close box*/
+		if (PtInRect(&r, event->x, event->y)) {
+			/* this may or not close the window...*/
+			GrCloseWindow(window->clientid);
+			return;
+		}
+	}
+
+	/* Set focus on button down*/
+	GrSetFocus(window->clientid);
+
+	/* check for corner resize */
+	r.x = info.width - 5;
+	r.y = info.height - 5;
+	r.width = 5;
+	r.height = 5;
+
+	if(PtInRect(&r,event->x, event->y)) {
+
+	  struct pos_size * pos;
+
+	  if(!window->data)
+	    if(!(window->data = malloc(sizeof(struct pos_size)))) return;
+
+	  window->sizing = GR_TRUE;
+	  pos = (struct pos_size*)window->data;
+	  
+	  // save off the width/height offset from the window manager
+	  GrGetWindowInfo(window->clientid,&info);
+	  pos->xoff = -info.width;
+	  pos->yoff = -info.height;
+
+	  GrGetWindowInfo(window->wid,&info);
+	  pos->xoff += info.width;
+	  pos->yoff += info.height;
+
+	  gc = GrNewGC();
+	  GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
+	  GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, info.width, info.height);
+	  GrDestroyGC(gc);
+
+	  // save this rectangle's width/height so we can erase it later
+	  pos->width = info.width;
+	  pos->height = info.height;
+
+	  return;
+	}
+
+	/* if not in caption, return (FIXME, not calc'd exactly)*/
+	if (!(info.props & GR_WM_PROPS_CAPTION))
+		return;
+
+	/* Get caption box rect*/
+	r.x = cxborder;
+	r.y = cyborder;
+	r.width = info.width - cxborder*2;
+	r.height = CYCAPTION;
+
+	/* Check for mousedn in caption box*/
+	if (!PtInRect(&r, event->x, event->y))
+		return;
+
+	/* Raise window if mouse down and allowed*/
+	if (!(info.props & GR_WM_PROPS_NORAISE))
+		GrRaiseWindow(window->wid);
+
+	/* Don't allow window move if NOMOVE property set*/
+	if (info.props & GR_WM_PROPS_NOMOVE)
+		return;
+
+	if(!window->data)
+		if(!(window->data = malloc(sizeof(struct pos_size)))) return;
+
+	pos = (struct pos_size *) window->data;
+
+	GrGetWindowInfo(window->wid,&info);
+	
+	pos->xoff = event->x;
+	pos->yoff = event->y;
+
+#ifdef OUTLINE_MOVE
+	pos->xorig = info.x;
+	pos->yorig = info.y;
+	pos->width = info.width;
+	pos->height = info.height;
+
+	gc = GrNewGC();
+	GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
+	GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, info.width, info.height);
+	GrDestroyGC(gc);
+#endif	
+	window->active = GR_TRUE;
+}
+
+void container_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	//diag_printf("container_buttonup window %d\n", window->wid);
+
+	if(window->active) {
+	  struct pos_size * pos = (struct pos_size *)window->data;
+#ifdef OUTLINE_MOVE
+	  GR_GC_ID gc;	  
+	  gc = GrNewGC();
+	  GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
+	  GrRect(GR_ROOT_WINDOW_ID,gc,pos->xorig, pos->yorig, pos->width, pos->height);
+
+	  GrMoveWindow(window->wid, pos->xorig, pos->yorig);
+
+#endif
+	  free(pos);
+	  window->active = GR_FALSE;
+	  window->data = 0;
+	}
+	
+	if(window->sizing) {
+	  GR_WINDOW_INFO info;
+	  GR_GC_ID gc;
+
+	  struct pos_size * pos = (struct pos_size *)window->data;
+
+	  gc = GrNewGC();
+	  GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
+
+	  GrGetWindowInfo(window->wid, &info);
+
+	  GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, pos->width, pos->height);
+
+	  GrResizeWindow(window->wid,event->rootx - info.x, event->rooty - info.y);
+	  GrResizeWindow(window->clientid,event->rootx - info.x - pos->xoff, 
+			 event->rooty - info.y - pos->yoff);
+	  GrDestroyGC(gc);
+	  free(window->data);
+	  window->sizing = GR_FALSE;
+	  window->data = 0;
+	}
+}
+
+void container_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	struct pos_size *pos;
+	GR_WINDOW_INFO info;
+	GR_GC_ID gc;
+#if 0
+	diag_printf("container_mousemoved window %d\n", window->wid);
+#endif
+	if(window->sizing) {
+
+	  struct pos_size * pos = (struct pos_size*)window->data;
+	  GrGetWindowInfo(window->wid, &info);
+
+	  gc = GrNewGC();
+	  GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
+
+	  // erase old rectangle
+	  GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, pos->width, pos->height);
+	  // draw new one
+	  GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, 
+		 event->rootx - info.x, event->rooty - info.y);
+	  GrDestroyGC(gc);
+
+	  // save this new rectangle's width, height
+	  // I know, this shouldn't be stored in x/y, but...
+	  pos->width = event->rootx - info.x;
+	  pos->height = event->rooty - info.y;
+
+	  return;
+	}
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+#ifdef OUTLINE_MOVE
+	gc = GrNewGC();
+	GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
+	GrRect(GR_ROOT_WINDOW_ID,gc,pos->xorig, pos->yorig, pos->width, pos->height);
+	GrRect(GR_ROOT_WINDOW_ID,gc,event->rootx - pos->xoff, event->rooty - pos->yoff,
+	       pos->width, pos->height);
+
+	pos->xorig = event->rootx - pos->xoff;
+	pos->yorig = event->rooty - pos->yoff;
+	
+	GrDestroyGC(gc);
+#else	
+	GrMoveWindow(window->wid, event->rootx - pos->xoff,
+		event->rooty - pos->yoff);
+#endif
+}
+
+#if 0000
+void topbar_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	win *pwin = find_window(window->pid);
+	struct clientinfo *ci = pwin->data;
+	GR_WM_PROPERTIES prop;
+
+	Dprintf("topbar_exposure window %d\n", window->wid);
+
+	GrGetWMProperties(ci->cid, &prop);
+	if (prop.title)
+		GrText(window->wid, buttonsgc, 0, 0, prop.title, -1,
+			GR_TFASCII|GR_TFTOP);
+}
+
+void closebutton_exposure(win *window, GR_EVENT_EXPOSURE *event)
+{
+	Dprintf("closebutton_exposure window %d\n", window->wid);
+
+	GrBitmap(window->wid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT,
+		TITLE_BAR_HEIGHT, window->active ? closebutton_pressed :
+						closebutton_notpressed);
+}
+
+void topbar_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	struct position *pos;
+
+	Dprintf("topbar_buttondown window %d\n", window->wid);
+
+	GrRaiseWindow(window->pid);
+
+	if(window->active) return;
+
+	if(!window->data)
+		if(!(window->data = malloc(sizeof(struct position)))) return;
+
+	pos = (struct position *) window->data;
+
+	pos->x = event->x + TITLE_BAR_HEIGHT;	/* actually width*/
+	pos->y = event->y;
+
+	window->active = GR_TRUE;
+}
+
+void resizebar_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	GR_WINDOW_INFO wi;
+	struct pos_size *pos;
+
+	Dprintf("resizebar_buttondown window %d\n", window->wid);
+
+	GrRaiseWindow(window->pid);
+
+	if(window->active) return;
+
+	if(!window->data)
+		if(!(window->data = malloc(sizeof(struct pos_size)))) return;
+
+	pos = (struct pos_size *) window->data;
+
+	GrGetWindowInfo(window->pid, &wi);
+
+	pos->xoff = event->x;
+	pos->yoff = event->y;
+	pos->xorig = wi.x;
+	pos->yorig = wi.y;
+	pos->width = wi.width;
+	pos->height = wi.height;
+
+	window->active = GR_TRUE;
+}
+
+void closebutton_buttondown(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("closebutton_buttondown window %d\n", window->wid);
+
+	GrRaiseWindow(window->pid);
+
+	window->active = GR_TRUE;
+	closebutton_exposure(window, NULL);
+}
+
+
+void topbar_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	Dprintf("topbar_buttonup window %d\n", window->wid);
+
+	window->active = GR_FALSE;
+}
+
+void closebutton_buttonup(win *window, GR_EVENT_BUTTON *event)
+{
+	win *pwin = find_window(window->pid);
+	struct clientinfo *ci = pwin->data;
+
+	Dprintf("closebutton_buttonup window %d\n", window->wid);
+
+	window->active = GR_FALSE;
+	closebutton_exposure(window, NULL);
+
+	GrCloseWindow(ci->cid);
+}
+
+void topbar_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	struct position *pos;
+	GR_WM_PROPERTIES props;
+
+	Dprintf("topbar_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct position *) window->data;
+
+	/* turn off background erase draw while moving*/
+	GrGetWMProperties(window->pid, &props);
+	props.flags = GR_WM_FLAGS_PROPS;
+	props.props |= GR_WM_PROPS_NOBACKGROUND;
+	GrSetWMProperties(window->pid, &props);
+
+	GrMoveWindow(window->pid, event->rootx - pos->x,
+			event->rooty - pos->y);
+
+	props.props &= ~GR_WM_PROPS_NOBACKGROUND;
+	GrSetWMProperties(window->pid, &props);
+}
+
+void leftbar_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	GR_COORD newx;
+	GR_SIZE newwidth;
+	struct pos_size *pos;
+
+	Dprintf("leftbar_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+	newx = event->rootx - pos->xoff;
+	newwidth = pos->width + pos->xorig - event->rootx - pos->xoff;
+
+	GrMoveWindow(window->pid, newx, pos->yorig);
+	GrResizeWindow(window->pid, newwidth, pos->height);
+}
+
+void leftresize_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	GR_COORD newx;
+	GR_SIZE newwidth, newheight;
+	struct pos_size *pos;
+
+	Dprintf("leftresize_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+	newx = event->rootx - pos->xoff;
+	newheight = event->rooty - pos->yorig;
+	newwidth = pos->width + pos->xorig - event->rootx - pos->xoff;
+
+	GrMoveWindow(window->pid, newx, pos->yorig);
+	GrResizeWindow(window->pid, newwidth, newheight);
+}
+
+void bottombar_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	GR_SIZE newheight;
+	struct pos_size *pos;
+
+	Dprintf("bottombar_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+	newheight = event->rooty - pos->yorig;
+
+	GrResizeWindow(window->pid, pos->width, newheight);
+}
+
+void rightresize_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	GR_SIZE newwidth, newheight;
+	struct pos_size *pos;
+
+	Dprintf("rightresize_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+	newheight = event->rooty - pos->yorig;
+	newwidth = event->rootx - pos->xorig;
+
+	GrResizeWindow(window->pid, newwidth, newheight);
+}
+
+void rightbar_mousemoved(win *window, GR_EVENT_MOUSE *event)
+{
+	GR_SIZE newwidth;
+	struct pos_size *pos;
+
+	Dprintf("rightbar_mousemoved window %d\n", window->wid);
+
+	if(!window->active) return;
+
+	pos = (struct pos_size *) window->data;
+
+	newwidth = event->rootx - pos->xorig;
+
+	GrResizeWindow(window->pid, newwidth, pos->height);
+
+}
+#endif /* 0000*/
diff -urN lib/microwindows/src/nanowm-ecos/clients.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/clients.c
--- lib/microwindows/src/nanowm-ecos/clients.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/clients.c	2005-02-21 16:13:41.000000000 +0100
@@ -0,0 +1,372 @@
+/*
+ * NanoWM - Window Manager for Nano-X
+ *
+ * Copyright (C) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+#include "nxdraw.h"
+/* Uncomment this if you want debugging output from this file */
+//#define DEBUG
+#include "nanowm.h"
+
+/* default window style for GR_WM_PROPS_APPWINDOW*/
+#define DEFAULT_WINDOW_STYLE	(GR_WM_PROPS_APPFRAME | GR_WM_PROPS_CAPTION |\
+					GR_WM_PROPS_CLOSEBOX)
+
+static GR_COORD lastx = FIRST_WINDOW_LOCATION;
+static GR_COORD lasty = FIRST_WINDOW_LOCATION;
+
+/*
+ * A new client window has been mapped, so we need to reparent and decorate it.
+ * Returns -1 on failure or 0 on success.
+ */
+int new_client_window(GR_WINDOW_ID wid)
+{
+	win window;
+	GR_WINDOW_ID pid;
+	GR_WINDOW_INFO winfo;
+	GR_COORD x, y, width, height, xoffset, yoffset;
+	GR_WM_PROPS style;
+	GR_WM_PROPERTIES props;
+
+	/* get client window information*/
+	GrGetWindowInfo(wid, &winfo);
+	style = winfo.props;
+
+	/* if not redecorating or not child of root window, return*/
+	if (winfo.parent != GR_ROOT_WINDOW_ID ||
+	    (style & GR_WM_PROPS_NODECORATE))
+		return 0;
+
+	/* deal with replacing borders with window decorations*/
+	if (winfo.bordersize) {
+		/*
+		 * For complex reasons, it's easier to unmap,
+		 * remove the borders, and then map again,
+		 * rather than try to recalculate the window
+		 * position in the server w/o borders.  By
+		 * the time we get this event, the window has
+		 * already been painted with borders...
+		 * This currently causes a screen flicker as
+		 * the window is painted twice.  The workaround
+		 * is to create the window without borders in
+		 * the first place.
+		 */
+		GrUnmapWindow(wid);
+
+		/* remove client borders, if any*/
+		props.flags = style | GR_WM_FLAGS_BORDERSIZE;
+		props.bordersize = 0;
+		GrSetWMProperties(wid, &props);
+
+		/* remap the window without borders, call this routine again*/
+		GrMapWindow(wid);
+		return 0;
+	}
+	
+	/* if default decoration style asked for, set real draw bits*/
+	if ((style & GR_WM_PROPS_APPMASK) == GR_WM_PROPS_APPWINDOW) {
+		GR_WM_PROPERTIES pr;
+
+		style = (style & ~GR_WM_PROPS_APPMASK)|DEFAULT_WINDOW_STYLE;
+		pr.flags = GR_WM_FLAGS_PROPS;
+		pr.props = style;
+		GrSetWMProperties(wid, &pr);
+	}
+
+	/* determine container widths and client child window offsets*/
+	if (style & GR_WM_PROPS_APPFRAME) {
+		width = winfo.width + CXFRAME;
+		height = winfo.height + CYFRAME;
+		xoffset = CXBORDER;
+		yoffset = CYBORDER;
+	} else if (style & GR_WM_PROPS_BORDER) {
+		width = winfo.width + 2;
+		height = winfo.height + 2;
+		xoffset = 1;
+		yoffset = 1;
+	} else {
+		width = winfo.width;
+		height = winfo.height;
+		xoffset = 0;
+		yoffset = 0;
+	}
+	if (style & GR_WM_PROPS_CAPTION) {
+		height += CYCAPTION;
+		yoffset += CYCAPTION;
+		if (style & GR_WM_PROPS_APPFRAME) {
+			/* extra line under caption with appframe*/
+			++height;
+			++yoffset;
+		}
+	}
+
+	/* determine x,y window location*/
+	if (style & GR_WM_PROPS_NOAUTOMOVE) {
+		x = winfo.x;
+		y = winfo.y;
+	} else {
+		/* We could proably use a more intelligent algorithm here */
+		x = lastx + WINDOW_STEP;
+		if((x + width) > si.cols)
+			x = FIRST_WINDOW_LOCATION;
+		lastx = x;
+		y = lasty + WINDOW_STEP;
+		if((y + height) > si.rows)
+			y = FIRST_WINDOW_LOCATION;
+		lasty = y;
+	}
+
+	/* create container window*/
+	pid = GrNewWindow(GR_ROOT_WINDOW_ID, x, y, width, height,
+		0, LTGRAY, BLACK);
+	window.sizing=GR_FALSE;
+	window.wid = pid;
+	window.pid = GR_ROOT_WINDOW_ID;
+	window.type = WINDOW_TYPE_CONTAINER;
+	window.active = 0;
+	window.data = NULL;
+	window.clientid = wid;
+	add_window(&window);
+
+	/* don't erase background of container window*/
+	props.flags = GR_WM_FLAGS_PROPS;
+	props.props = style | GR_WM_PROPS_NOBACKGROUND;
+	GrSetWMProperties(pid, &props);
+
+	//diag_printf("New client window %d container %d\n", wid, pid);
+
+	GrSelectEvents(pid, GR_EVENT_MASK_CHLD_UPDATE
+		| GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_BUTTON_DOWN
+		| GR_EVENT_MASK_MOUSE_POSITION | GR_EVENT_MASK_EXPOSURE);
+
+	/* reparent client to container window*/
+	/* must map before reparent (nano-x bug)*/
+	GrMapWindow(pid);
+	GrReparentWindow(wid, pid, xoffset, yoffset);
+
+	GrSetFocus(wid);	/* force fixed focus*/
+
+	/* add client window*/
+	window.sizing = GR_FALSE;
+	window.wid = wid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_CLIENT;
+	window.active = 0;
+	window.clientid = 0;
+	window.data = NULL;
+	add_window(&window);
+
+#if 0000
+	/* add system utility button*/
+	nid = GrNewWindow(pid, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0,
+							LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_UTILITYBUTTON;
+	window.active = GR_FALSE;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_EXPOSURE
+				| GR_EVENT_MASK_MOUSE_EXIT);
+	GrMapWindow(nid);
+	GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
+						utilitybutton_notpressed);
+
+	nid = GrNewWindow(pid, TITLE_BAR_HEIGHT + 1, 1, width - (4 *
+			TITLE_BAR_HEIGHT) - 3, TITLE_BAR_HEIGHT - 3, 1, LTGRAY,
+								BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_TOPBAR;
+	window.active = GR_FALSE;
+	window.data = NULL;
+
+	add_window(&window);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_EXPOSURE
+				| GR_EVENT_MASK_MOUSE_POSITION);
+	GrMapWindow(nid);
+
+	nid = GrNewWindow(pid, width - (3 * TITLE_BAR_HEIGHT), 0,
+			TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_ICONISEBUTTON;
+	window.active = GR_FALSE;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_EXPOSURE
+				| GR_EVENT_MASK_MOUSE_EXIT);
+	GrMapWindow(nid);
+	GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
+						iconisebutton_notpressed);
+
+	nid = GrNewWindow(pid, width - (2 * TITLE_BAR_HEIGHT), 0,
+			TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_MAXIMISEBUTTON;
+	window.active = GR_FALSE;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_EXPOSURE
+				| GR_EVENT_MASK_MOUSE_EXIT);
+	GrMapWindow(nid);
+	GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
+						maximisebutton_notpressed);
+
+	nid = GrNewWindow(pid, width - TITLE_BAR_HEIGHT, 0,
+			TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_CLOSEBUTTON;
+	window.active = GR_FALSE;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_EXPOSURE
+				| GR_EVENT_MASK_MOUSE_EXIT);
+	GrMapWindow(nid);
+	GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
+						closebutton_notpressed);
+
+	nid = GrNewWindow(pid, 1, TITLE_BAR_HEIGHT + 1, BORDER_WIDTHS - 2,
+				height - TITLE_BAR_HEIGHT - BORDER_WIDTHS - 1,
+				1, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_LEFTBAR;
+	window.active = GR_FALSE;
+	window.data = NULL;
+
+	add_window(&window);
+
+	GrSetCursor(nid, horizontal_resize_columns, horizontal_resize_rows,
+			horizontal_resize_hotx, horizontal_resize_hoty,
+			BLACK, WHITE, horizontal_resize_fg,
+			horizontal_resize_bg);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_MOUSE_POSITION);
+
+	GrMapWindow(nid);
+
+	nid = GrNewWindow(pid, 1, height - BORDER_WIDTHS + 1, BORDER_WIDTHS - 2,
+					BORDER_WIDTHS - 2, 1, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_LEFTRESIZE;
+	window.active = GR_FALSE;
+	window.data = NULL;
+
+
+	add_window(&window);
+
+	GrSetCursor(nid, lefthand_resize_columns, lefthand_resize_rows,
+			lefthand_resize_hotx, lefthand_resize_hoty,
+			BLACK, WHITE, lefthand_resize_fg, lefthand_resize_bg);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_MOUSE_POSITION);
+
+	GrMapWindow(nid);
+
+	nid = GrNewWindow(pid, BORDER_WIDTHS, height - BORDER_WIDTHS + 1,
+			width - (2 * BORDER_WIDTHS), BORDER_WIDTHS - 2, 1,
+							LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_BOTTOMBAR;
+	window.active = GR_FALSE;
+	window.data = NULL;
+	add_window(&window);
+
+	GrSetCursor(nid, vertical_resize_columns, vertical_resize_rows,
+			vertical_resize_hotx, vertical_resize_hoty,
+			BLACK, WHITE, vertical_resize_fg, vertical_resize_bg);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_MOUSE_POSITION);
+
+	GrMapWindow(nid);
+
+	nid = GrNewWindow(pid, width - BORDER_WIDTHS + 1,
+			height - BORDER_WIDTHS + 1, BORDER_WIDTHS - 2,
+					BORDER_WIDTHS - 2, 1, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_RIGHTRESIZE;
+	window.active = GR_FALSE;
+	window.data = NULL;
+
+	add_window(&window);
+
+	GrSetCursor(nid, righthand_resize_columns, righthand_resize_rows,
+			righthand_resize_hotx, righthand_resize_hoty,
+			BLACK, WHITE, righthand_resize_fg, righthand_resize_bg);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_MOUSE_POSITION);
+
+	GrMapWindow(nid);
+
+	nid = GrNewWindow(pid, width - BORDER_WIDTHS + 1, TITLE_BAR_HEIGHT + 1,
+		BORDER_WIDTHS - 2, height - TITLE_BAR_HEIGHT - BORDER_WIDTHS -1,
+							 1, LTGRAY, BLACK);
+	window.wid = nid;
+	window.pid = pid;
+	window.type = WINDOW_TYPE_RIGHTBAR;
+	window.active = GR_FALSE;
+	window.data = NULL;
+
+	add_window(&window);
+
+	GrSetCursor(nid, horizontal_resize_columns, horizontal_resize_rows,
+			horizontal_resize_hotx, horizontal_resize_hoty,
+			BLACK, WHITE, horizontal_resize_fg,
+			horizontal_resize_bg);
+
+	GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
+				| GR_EVENT_MASK_MOUSE_POSITION);
+	GrMapWindow(nid);
+#endif
+	return 0;
+}
+
+/*
+ * We've just received an event notifying us that a client window has been
+ * unmapped, so we need to destroy all of the decorations.
+ */
+void client_window_destroy(win *window)
+{
+	win *pwin;
+	GR_WINDOW_ID pid;
+
+	Dprintf("Client window %d has been destroyed\n", window->wid);
+
+	if(!(pwin = find_window(window->pid))) {
+		diag_printf("Couldn't find parent of destroyed window "
+				"%d\n", window->wid);
+		return;
+	}
+
+	/* Do it this way around so we don't handle events after destroying */
+	pid = pwin->wid;
+	remove_window_and_children(pwin);
+
+	Dprintf("Destroying container %d\n", pid);
+	GrDestroyWindow(pid);
+}
diff -urN lib/microwindows/src/nanowm-ecos/demo.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/demo.c
--- lib/microwindows/src/nanowm-ecos/demo.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/demo.c	2005-02-21 16:13:41.000000000 +0100
@@ -0,0 +1,479 @@
+/*
+ * Demonstration program for Nano-X graphics.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+#if DOS_TURBOC
+unsigned _stklen = 32768;
+#endif
+
+/*
+ * Definitions to make it easy to define cursors
+ */
+#define	_	((unsigned) 0)		/* off bits */
+#define	X	((unsigned) 1)		/* on bits */
+#define	MASK(a,b,c,d,e,f,g) \
+	(((((((((((((a * 2) + b) * 2) + c) * 2) + d) * 2) \
+	+ e) * 2) + f) * 2) + g) << 9)
+
+#define	W2_WIDTH	70
+#define	W2_HEIGHT	40
+
+
+static	GR_WINDOW_ID	w1;		/* id for large window */
+static	GR_WINDOW_ID	w2;		/* id for small window */
+static	GR_WINDOW_ID	w3;		/* id for third window */
+static	GR_WINDOW_ID	w4;		/* id for grabbable window */
+static	GR_WINDOW_ID	w5;		/* id for testing enter/exit window */
+static	GR_GC_ID	gc1;		/* graphics context for text */
+static	GR_GC_ID	gc2;		/* graphics context for rectangle */
+static	GR_GC_ID	gc3;		/* graphics context for circles */
+static	GR_GC_ID	gc4;		/* graphics context for lines */
+static	GR_COORD	begxpos;	/* beginning x position */
+static	GR_COORD	xpos;		/* x position for text drawing */
+static	GR_COORD	ypos;		/* y position for text drawing */
+static	GR_COORD	linexpos;	/* x position for line drawing */
+static	GR_COORD	lineypos;	/* y position for line drawing */
+static	GR_COORD	xorxpos;	/* x position for xor line */
+static	GR_COORD	xorypos;	/* y position for xor line */
+static	GR_BOOL		lineok;		/* ok to draw line */
+static	GR_SIZE		COLS, ROWS;
+static	GR_SCREEN_INFO	si;		/* information about screen */
+
+void do_buttondown(GR_EVENT_BUTTON	*bp);
+void do_buttonup(GR_EVENT_BUTTON	*bp);
+void do_motion(GR_EVENT_MOUSE		*mp);
+void do_keystroke(GR_EVENT_KEYSTROKE	*kp);
+void do_exposure(GR_EVENT_EXPOSURE	*ep);
+void do_focusin(GR_EVENT_GENERAL	*gp);
+void do_focusout(GR_EVENT_GENERAL	*gp);
+void do_enter(GR_EVENT_GENERAL		*gp);
+void do_exit(GR_EVENT_GENERAL		*gp);
+void do_idle(void);
+/* routine to handle errors */
+void errorcatcher(GR_EVENT *ep);
+
+int
+main(int argc,char **argv)
+{
+	GR_EVENT	event;		/* current event */
+	GR_BITMAP	bitmap1fg[7];	/* bitmaps for first cursor */
+	GR_BITMAP	bitmap1bg[7];
+	GR_BITMAP	bitmap2fg[7];	/* bitmaps for second cursor */
+	GR_BITMAP	bitmap2bg[7];
+
+	if (GrOpen() < 0) {
+		fprintf(stderr, "cannot open graphics\n");
+		exit(1);
+	}
+
+	GrReqShmCmds(655360);
+	
+	GrGetScreenInfo(&si);
+COLS = si.cols - 40;
+ROWS = si.rows - 80;
+
+	/* print error, but don't exit*/
+	GrSetErrorHandler(errorcatcher);
+
+	w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 100, 50, COLS - 120,
+		ROWS - 60, 1, BROWN, WHITE);
+	w2 = GrNewWindow(GR_ROOT_WINDOW_ID, 6, 6, W2_WIDTH, W2_HEIGHT, 2, GREEN,
+		WHITE);
+	w3 = GrNewWindow(GR_ROOT_WINDOW_ID, 250, 30, 80, 100, 1, LTGRAY,
+		GREEN);
+	w4 = GrNewWindow(GR_ROOT_WINDOW_ID, 350, 20, 200, 150, 5, BLACK, WHITE);
+	w5 = GrNewWindow(GR_ROOT_WINDOW_ID, 11, 143, 209, 100, 1, BLUE, GREEN);
+
+	GrSelectEvents(w1, GR_EVENT_MASK_BUTTON_DOWN |
+		GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_EXPOSURE |
+		GR_EVENT_MASK_FOCUS_IN | GR_EVENT_MASK_FOCUS_OUT |
+		GR_EVENT_MASK_CLOSE_REQ);
+	/* must select down and up for w2 to get implicit grab when
+	 * running window manager, otherwise the wm-created parent
+	 * window will get the grab, and we won't get the button up...
+	 */
+	GrSelectEvents(w2, GR_EVENT_MASK_BUTTON_DOWN |
+			GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(w3, GR_EVENT_MASK_BUTTON_DOWN |
+		GR_EVENT_MASK_MOUSE_MOTION | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(w4, GR_EVENT_MASK_BUTTON_DOWN |
+		GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_MOUSE_POSITION |
+		GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(w5, GR_EVENT_MASK_MOUSE_ENTER |
+		GR_EVENT_MASK_MOUSE_EXIT | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_BUTTON_DOWN |
+			GR_EVENT_MASK_CLOSE_REQ);
+
+	GrMapWindow(w1);
+	GrMapWindow(w2);
+	GrMapWindow(w3);
+	GrMapWindow(w4);
+	GrMapWindow(w5);
+
+	gc1 = GrNewGC();
+	gc2 = GrNewGC();
+	gc3 = GrNewGC();
+	gc4 = GrNewGC();
+
+	GrSetGCForeground(gc1, RED);
+	GrSetGCBackground(gc1, BROWN);
+	GrSetGCForeground(gc2, MAGENTA);
+	GrSetGCMode(gc4, GR_MODE_XOR);
+
+	bitmap1fg[0] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[1] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[2] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[3] = MASK(X,X,X,X,X,X,X);
+	bitmap1fg[4] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[5] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[6] = MASK(_,_,_,X,_,_,_);
+
+	bitmap1bg[0] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[1] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[2] = MASK(X,X,X,X,X,X,X);
+	bitmap1bg[3] = MASK(X,X,X,X,X,X,X);
+	bitmap1bg[4] = MASK(X,X,X,X,X,X,X);
+	bitmap1bg[5] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[6] = MASK(_,_,X,X,X,_,_);
+
+	bitmap2fg[0] = MASK(_,_,X,X,X,_,_);
+	bitmap2fg[1] = MASK(_,X,_,_,_,X,_);
+	bitmap2fg[2] = MASK(X,_,_,_,_,_,X);
+	bitmap2fg[3] = MASK(X,_,_,_,_,_,X);
+	bitmap2fg[4] = MASK(_,X,_,_,_,X,_);
+	bitmap2fg[5] = MASK(_,_,X,X,X,_,_);
+
+	bitmap2bg[0] = MASK(_,_,X,X,X,_,_);
+	bitmap2bg[1] = MASK(_,X,X,X,X,X,_);
+	bitmap2bg[2] = MASK(X,X,X,X,X,X,X);
+	bitmap2bg[3] = MASK(X,X,X,X,X,X,X);
+	bitmap2bg[4] = MASK(_,X,X,X,X,X,_);
+	bitmap2bg[5] = MASK(_,_,X,X,X,_,_);
+
+	GrSetCursor(w1, 7, 7, 3, 3, WHITE, BLACK, bitmap1fg, bitmap1bg);
+	GrSetCursor(w2, 7, 7, 3, 3, WHITE, BLACK, bitmap2fg, bitmap2bg);
+
+	while (1) {
+		GrCheckNextEvent(&event);
+
+		switch (event.type) {
+			case GR_EVENT_TYPE_BUTTON_DOWN:
+				do_buttondown(&event.button);
+				break;
+
+			case GR_EVENT_TYPE_BUTTON_UP:
+				do_buttonup(&event.button);
+				break;
+
+			case GR_EVENT_TYPE_MOUSE_POSITION:
+			case GR_EVENT_TYPE_MOUSE_MOTION:
+				do_motion(&event.mouse);
+				break;
+
+			case GR_EVENT_TYPE_KEY_DOWN:
+				do_keystroke(&event.keystroke);
+				break;
+
+			case GR_EVENT_TYPE_EXPOSURE:
+				do_exposure(&event.exposure);
+				break;
+
+			case GR_EVENT_TYPE_FOCUS_IN:
+				do_focusin(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_FOCUS_OUT:
+				do_focusout(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_MOUSE_ENTER:
+				do_enter(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_MOUSE_EXIT:
+				do_exit(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_CLOSE_REQ:
+				GrClose();
+				exit(0);
+
+			case GR_EVENT_TYPE_NONE:
+				do_idle();
+				break;
+		}
+	}
+}
+
+
+/*
+ * Here when a button is pressed.
+ */
+void
+do_buttondown(GR_EVENT_BUTTON	*bp)
+{
+	GR_PIXELVAL	intable[W2_WIDTH * W2_HEIGHT];
+	GR_PIXELVAL	outtable[W2_WIDTH * W2_HEIGHT * 6];
+	GR_PIXELVAL	*inp;
+	GR_PIXELVAL	*outp;
+	GR_PIXELVAL	*oldinp;
+	GR_COORD	row;
+	GR_COORD	col;
+
+	/*static int xx = 100;
+	static int yy = 50;*/
+
+	if (bp->wid == w3) {
+		GrRaiseWindow(w3);
+		GrReadArea(w2, 0, 0, W2_WIDTH, W2_HEIGHT, intable);
+		inp = intable;
+		outp = outtable;
+		for (row = 0; row < W2_HEIGHT; row++) {
+			oldinp = inp;
+			for (col = 0; col < W2_WIDTH; col++) {
+				*outp++ = *inp;
+				*outp++ = *inp++;
+			}
+			inp = oldinp;
+			for (col = 0; col < W2_WIDTH; col++) {
+				*outp++ = *inp;
+				*outp++ = *inp++;
+			}
+			inp = oldinp;
+			for (col = 0; col < W2_WIDTH; col++) {
+				*outp++ = *inp;
+				*outp++ = *inp++;
+			}
+		}
+		GrArea(w1, gc1, 0, 0, W2_WIDTH * 2, W2_HEIGHT * 3, outtable,
+			MWPF_PIXELVAL);
+		return;
+	}
+
+	if (bp->wid == w4) {
+		GrRaiseWindow(w4);
+		linexpos = bp->x;
+		lineypos = bp->y;
+		xorxpos = bp->x;
+		xorypos = bp->y;
+		GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+		lineok = GR_TRUE;
+		return;
+	}
+
+	if (bp->wid != w1) {
+		/*
+		 * Cause a fatal error for testing if more than one
+		 * button is pressed.
+		 */
+		if ((bp->buttons & -((int) bp->buttons)) != bp->buttons)
+			GrClearWindow(-1, 0);
+		return;
+	}
+
+	GrRaiseWindow(w1);
+	/*GrMoveWindow(w1, ++xx, yy);*/
+
+	if (bp->buttons & GR_BUTTON_L) {
+		GrClearWindow(w1, GR_TRUE);
+		return;
+	}
+
+	begxpos = bp->x;
+	xpos = bp->x;
+	ypos = bp->y;
+}
+
+
+/*
+ * Here when a button is released.
+ */
+void
+do_buttonup(GR_EVENT_BUTTON	*bp)
+{
+	if (bp->wid == w4) {
+		if (lineok) {
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+			GrLine(w4, gc3, bp->x, bp->y, linexpos, lineypos);
+		}
+		lineok = GR_FALSE;
+		return;
+	}
+
+	if (bp->wid == w2) {
+		GrClose();
+		exit(0);
+	}
+}
+
+
+/*
+ * Here when the mouse has a motion event.
+ */
+void
+do_motion(GR_EVENT_MOUSE	*mp)
+{
+	if (mp->wid == w4) {
+		if (lineok) {
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+			xorxpos = mp->x;
+			xorypos = mp->y;
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+		}
+		return;
+	}
+
+	if (mp->wid == w3) {
+		GrPoint(w3, gc3, mp->x, mp->y);
+		return;
+	}
+}
+
+
+/*
+ * Here when a keyboard press occurs.
+ */
+void
+do_keystroke(GR_EVENT_KEYSTROKE	*kp)
+{
+	GR_SIZE		width;		/* width of character */
+	GR_SIZE		height;		/* height of character */
+	GR_SIZE		base;		/* height of baseline */
+
+	if (kp->wid == w4) {
+		if (lineok) {
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+			lineok = GR_FALSE;
+		}
+		return;
+	}
+
+	GrGetGCTextSize(gc1, &kp->ch, 1, GR_TFASCII, &width, &height, &base);
+	if ((kp->ch == '\r') || (kp->ch == '\n')) {
+		xpos = begxpos;
+		ypos += height;
+		return;
+	}
+	if (kp->ch == '\b') {		/* assumes fixed width font!! */
+		if (xpos <= begxpos)
+			return;
+		xpos -= width;
+		GrSetGCForeground(gc3, BROWN);
+		GrFillRect(w1, gc3, xpos, ypos - height + base + 1,
+			width, height);
+		return;
+	}
+	GrText(w1, gc1, xpos, ypos + base, &kp->ch, 1, 0);
+	xpos += width;
+}
+
+
+/*
+ * Here when an exposure event occurs.
+ */
+void
+do_exposure(GR_EVENT_EXPOSURE	*ep)
+{
+	GR_POINT	points[3];
+
+	if (ep->wid != w1)
+		return;
+	points[0].x = 311;
+	points[0].y = 119;
+	points[1].x = 350;
+	points[1].y = 270;
+	points[2].x = 247;
+	points[2].y = 147;
+
+	GrFillRect(w1, gc2, 50, 50, 150, 200);
+	GrFillPoly(w1, gc2, 3, points);
+}
+
+
+/*
+ * Here when a focus in event occurs.
+ */
+void
+do_focusin(GR_EVENT_GENERAL	*gp)
+{
+	if (gp->wid != w1)
+		return;
+	GrSetBorderColor(w1, WHITE);
+}
+
+/*
+ * Here when a focus out event occurs.
+ */
+void
+do_focusout(GR_EVENT_GENERAL	*gp)
+{
+	if (gp->wid != w1)
+		return;
+	GrSetBorderColor(w1, GRAY);
+}
+
+
+/*
+ * Here when a enter window event occurs.
+ */
+void
+do_enter(GR_EVENT_GENERAL	*gp)
+{
+	if (gp->wid != w5)
+		return;
+	GrSetBorderColor(w5, WHITE);
+	GrRaiseWindow(w5);
+}
+
+
+/*
+ * Here when a exit window event occurs.
+ */
+void
+do_exit(GR_EVENT_GENERAL	*gp)
+{
+	if (gp->wid != w5)
+		return;
+	GrSetBorderColor(w5, GREEN);
+	GrLowerWindow(w5);
+}
+
+
+/*
+ * Here to do an idle task when nothing else is happening.
+ * Just draw a randomly colored filled circle in the small window.
+ */
+void
+do_idle(void)
+{
+	GR_COORD	x;
+	GR_COORD	y;
+	GR_SIZE		rx;
+	GR_SIZE		ry;
+	GR_COLOR	color;
+
+	x = rand() % 70;
+	y = rand() % 40;
+	rx = (rand() % 10) + 5;
+	ry = (rx * si.ydpcm) / si.xdpcm;	/* make it appear circular */
+	
+	color = rand() % si.ncolors;
+
+	GrSetGCForeground(gc3, MWPALINDEX(color));
+	GrFillEllipse(w2, gc3, x, y, rx, ry);	
+}
+
+
+/*
+ * Here on a server error.  Print the std message but don't exit.
+ */
+void
+errorcatcher(GR_EVENT *ep)
+{
+	printf("nxclient: Error (%s) ", ep->error.name);
+	printf(nxErrorStrings[ep->error.code], ep->error.id);
+}
diff -urN lib/microwindows/src/nanowm-ecos/events.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/events.c
--- lib/microwindows/src/nanowm-ecos/events.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/events.c	2005-02-21 16:13:41.000000000 +0100
@@ -0,0 +1,200 @@
+/*
+ * NanoWM - Window Manager for Nano-X
+ *
+ * Copyright (C) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+/* Uncomment this if you want debugging output from this file */
+//#define DEBUG
+#include "nanowm.h"
+
+void do_exposure(GR_EVENT_EXPOSURE *event)
+{
+	win *window;
+#if 0
+	diag_printf("NanoWM: do_exposure: wid %d, x %d, y %d, width %d, height %d\n",
+		event->wid, event->x, event->y, event->width, event->height);
+#endif
+	if(!(window = find_window(event->wid))) return;
+
+	switch(window->type) {
+		case WINDOW_TYPE_CONTAINER:
+			container_exposure(window, event);
+			break;
+		default:
+			diag_printf("Unhandled exposure on window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+
+}
+
+void do_button_down(GR_EVENT_BUTTON *event)
+{
+	win *window;
+#if 0
+	diag_printf("do_button_down: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
+		"y %d, buttons %d, changebuttons %d, modifiers %d\n",
+		event->wid, event->subwid, event->rootx, event->rooty, event->x,
+		event->y, event->buttons, event->changebuttons,
+		event->modifiers);
+#endif
+	if(!(window = find_window(event->wid))) return;
+
+	switch(window->type) {
+		case WINDOW_TYPE_CONTAINER:
+			container_buttondown(window, event);
+			break;
+		default:
+			printf("Unhandled button down on window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_button_up(GR_EVENT_BUTTON *event)
+{
+	win *window;
+#if 0
+	Dprintf("do_button_up: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
+		"y %d, buttons %d, changebuttons %d, modifiers %d\n",
+		event->wid, event->subwid, event->rootx, event->rooty, event->x,
+		event->y, event->buttons, event->changebuttons,
+		event->modifiers);
+#endif
+	if(!(window = find_window(event->wid))) return;
+
+	switch(window->type) {
+		case WINDOW_TYPE_CONTAINER:
+			container_buttonup(window, event);
+			break;
+		default:
+			printf("Unhandled button up on window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_mouse_enter(GR_EVENT_GENERAL *event)
+{
+	win *window;
+
+	//diag_printf("NanoWM: do_mouse_enter: wid %d\n", event->wid);
+
+	if(!(window = find_window(event->wid)))
+		return;
+
+	switch(window->type) {
+		default:
+			printf("Unhandled mouse enter from window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_mouse_exit(GR_EVENT_GENERAL *event)
+{
+	win *window;
+
+	//diag_printf("NanoWM: do_mouse_exit: wid %d\n", event->wid);
+
+	if(!(window = find_window(event->wid))) return;
+
+	switch(window->type) {
+		default:
+			printf("Unhandled mouse exit from window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_mouse_moved(GR_EVENT_MOUSE *event)
+{
+	win *window;
+#if 0
+	diag_printf("NanoWM: do_mouse_moved: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
+		"y %d, buttons %d, modifiers %d\n", event->wid, event->subwid,
+		event->rootx, event->rooty, event->x, event->y, event->buttons,
+		event->modifiers);
+#endif
+	if(!(window = find_window(event->wid))) return;
+
+	switch(window->type) {
+		case WINDOW_TYPE_CONTAINER:
+			container_mousemoved(window, event);
+			break;
+		default:
+			printf("Unhandled mouse movement in window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_focus_in(GR_EVENT_GENERAL *event)
+{
+	win *window;
+	//diag_printf("do_focus_in: wid %d\n", event->wid);
+
+	if(!(window = find_window(event->wid)))
+		return;
+
+	switch(window->type) {
+		default:
+			printf("Unhandled focus in from window %d "
+				"(type %d)\n", window->wid, window->type);
+			break;
+	}
+}
+
+void do_key_down(GR_EVENT_KEYSTROKE *event)
+{
+	Dprintf("do_key_down: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
+		"y %d, buttons %d, modifiers %d, uch %lu, special %d, "
+		"ch %d, content %d\n", event->wid, event->subwid, event->rootx,
+		event->rooty, event->x, event->y, event->buttons,
+		event->modifiers, event->uch, event->special, event->ch,
+		event->content);
+
+	/* FIXME: Implement keyboard shortcuts */
+}
+
+void do_key_up(GR_EVENT_KEYSTROKE *event)
+{
+	Dprintf("do_key_up: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
+		"y %d, buttons %d, modifiers %d, uch %lu, special %d, "
+		"ch %d, content %d\n", event->wid, event->subwid, event->rootx,
+		event->rooty, event->x, event->y, event->buttons,
+		event->modifiers, event->uch, event->special, event->ch,
+		event->content);
+}
+
+void do_update(GR_EVENT_UPDATE *event)
+{
+	win *window;
+#if 0
+	diag_printf("do_update: wid %d, subwid %d, x %d, y %d, width %d, height %d, "
+		"utype %d\n", event->wid, event->subwid, event->x, event->y, event->width,
+		event->height, event->utype);
+#endif
+	if(!(window = find_window(event->subwid))) {
+		if (event->utype == GR_UPDATE_MAP)
+			new_client_window(event->subwid);
+		return;
+	}
+
+	if(window->type == WINDOW_TYPE_CONTAINER) {
+		if (event->utype == GR_UPDATE_ACTIVATE)
+			redraw_ncarea(window);
+		return;
+	}
+
+	if(window->type != WINDOW_TYPE_CLIENT)
+		return;
+
+	if(event->utype == GR_UPDATE_DESTROY)
+		client_window_destroy(window);
+}
diff -urN lib/microwindows/src/nanowm-ecos/nanowm.2 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/nanowm.2
--- lib/microwindows/src/nanowm-ecos/nanowm.2	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/nanowm.2	2005-02-21 16:13:41.000000000 +0100
@@ -0,0 +1,195 @@
+/*
+ * NanoWM- the NanoGUI window manager.
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+
+#ifndef __NANOWM_H
+#define __NANOWM_H
+
+#ifdef DEBUG
+#define Dprintf printf
+#else
+#define Dprintf(ignore...)
+#endif
+
+/* Where to place the first window on the screen */
+#define FIRST_WINDOW_LOCATION 2
+
+/* The distance to leave between windows when deciding where to place */
+#define WINDOW_STEP 20
+
+/* The different window types which can be used in windowlist->type */
+enum {
+	WINDOW_TYPE_ROOT,
+	WINDOW_TYPE_CONTAINER,
+	WINDOW_TYPE_CLIENT
+	/***WINDOW_TYPE_TOPBAR,
+	WINDOW_TYPE_LEFTBAR,
+	WINDOW_TYPE_RIGHTBAR,
+	WINDOW_TYPE_BOTTOMBAR,
+	WINDOW_TYPE_LEFTRESIZE,
+	WINDOW_TYPE_RIGHTRESIZE,
+	WINDOW_TYPE_CLOSEBUTTON,
+	WINDOW_TYPE_MAXIMISEBUTTON,
+	WINDOW_TYPE_RESTOREBUTTON,
+	WINDOW_TYPE_ICONISEBUTTON,
+	WINDOW_TYPE_ICON,
+	WINDOW_TYPE_UTILITYBUTTON,
+	WINDOW_TYPE_UTILITYMENU,
+	WINDOW_TYPE_UTILITYMENUENTRY,
+	WINDOW_TYPE_ROOTMENU,
+	WINDOW_TYPE_ROOTMENUENTRY**/
+};
+
+/* 
+ * Used to keep a list of all the windows we know about so we can quickly
+ * find out whether a window is "one of ours", and if it is, what kind of
+ * window it is (title bar, side bar, button, icon, root menu, etc.), who
+ * it's a child of, and any special data associated with it (the title
+ * used in the title, the text of a root menu entry, the pixmap of an
+ * icon, etc.).
+ */
+struct windowlist {
+	GR_WINDOW_ID wid;	/* The ID of this window */
+	GR_WINDOW_ID pid;	/* The ID of this window's parent */
+	GR_WINDOW_ID clientid;	/* clientid for container window*/
+	int type;		/* What kind of window this is */
+	int active;		/* Whether this window is active or not */
+	void *data;		/* Data associated with this window */
+	struct windowlist *next; /* The next window in the list */
+};
+typedef struct windowlist win;
+
+/*
+ * Used to record the offset position when performing a move.
+ */
+struct position {
+	GR_COORD x;
+	GR_COORD y;
+};
+
+/*
+ * Used to record the original position, original size, and offset position
+ * when performing a resize.
+ */
+struct pos_size {
+	GR_COORD xoff;
+	GR_COORD yoff;
+	GR_COORD xorig;
+	GR_COORD yorig;
+	GR_SIZE width;
+	GR_SIZE height;
+};
+
+#if 0000
+/*
+ * Used to record some general information about the client.
+ */
+struct clientinfo {
+	GR_WINDOW_ID cid;
+};
+#endif
+
+/* Function prototypes */
+win *find_window(GR_WINDOW_ID wid);
+int add_window(win *window);
+int remove_window(win *window);
+int remove_window_and_children(win *window);
+int new_client_window(GR_WINDOW_ID wid);
+void client_window_destroy(win *window);
+void redraw_ncarea(win *window);
+void do_exposure(GR_EVENT_EXPOSURE *event);
+void do_button_down(GR_EVENT_BUTTON *event);
+void do_button_up(GR_EVENT_BUTTON *event);
+void do_mouse_enter(GR_EVENT_GENERAL *event);
+void do_mouse_exit(GR_EVENT_GENERAL *event);
+void do_mouse_moved(GR_EVENT_MOUSE *event);
+void do_focus_in(GR_EVENT_GENERAL *event);
+void do_key_down(GR_EVENT_KEYSTROKE *event);
+void do_key_up(GR_EVENT_KEYSTROKE *event);
+void do_focus_in(GR_EVENT_GENERAL *event);
+void do_focus_out(GR_EVENT_GENERAL *event);
+void do_update(GR_EVENT_UPDATE *event);
+void do_chld_update(GR_EVENT_UPDATE *event);
+void rootwindow_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void container_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void topbar_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void closebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void maximisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void restorebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void iconisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void utilitybutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void utilitymenu_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void utilitymenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void rootmenu_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void rootmenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void icon_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void rootwindow_buttondown(win *window, GR_EVENT_BUTTON *event);
+void container_buttondown(win *window, GR_EVENT_BUTTON *event);
+void topbar_buttondown(win *window, GR_EVENT_BUTTON *event);
+void resizebar_buttondown(win *window, GR_EVENT_BUTTON *event);
+void closebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void maximisebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void restorebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void iconisebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void utilitybutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void icon_buttondown(win *window, GR_EVENT_BUTTON *event);
+void rootwindow_buttonup(win *window, GR_EVENT_BUTTON *event);
+void container_buttonup(win *window, GR_EVENT_BUTTON *event);
+void topbar_buttonup(win *window, GR_EVENT_BUTTON *event);
+void resizebar_buttonup(win *window, GR_EVENT_BUTTON *event);
+void closebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void maximisebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void restorebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void iconisebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void utilitybutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void icon_buttonup(win *window, GR_EVENT_BUTTON *event);
+void utilitymenuentry_buttonup(win *window, GR_EVENT_BUTTON *event);
+void rootmenuentry_buttonup(win *window, GR_EVENT_BUTTON *event);
+void closebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void maximisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void restorebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void iconisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void utilitybutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void utilitymenu_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void utilitymenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void rootmenu_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void rootmenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void container_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void topbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void leftbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void leftresize_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void bottombar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void rightresize_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void rightbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+
+extern GR_SCREEN_INFO si;
+extern win *windows;
+extern GR_BITMAP utilitybutton_notpressed[];
+extern GR_BITMAP utilitybutton_pressed[];
+extern GR_BITMAP maximisebutton_notpressed[];
+extern GR_BITMAP maximisebutton_pressed[];
+extern GR_BITMAP iconisebutton_notpressed[];
+extern GR_BITMAP iconisebutton_pressed[];
+extern GR_BITMAP closebutton_notpressed[];
+extern GR_BITMAP closebutton_pressed[];
+extern GR_BITMAP restorebutton_notpressed[];
+extern GR_BITMAP restorebutton_pressed[];
+extern GR_BITMAP horizontal_resize_fg[];
+extern GR_BITMAP horizontal_resize_bg[];
+extern GR_BITMAP vertical_resize_fg[];
+extern GR_BITMAP vertical_resize_bg[];
+extern GR_BITMAP righthand_resize_fg[];
+extern GR_BITMAP righthand_resize_bg[];
+extern GR_BITMAP lefthand_resize_fg[];
+extern GR_BITMAP lefthand_resize_bg[];
+extern int horizontal_resize_columns, horizontal_resize_rows;
+extern int horizontal_resize_hotx, horizontal_resize_hoty;
+extern int vertical_resize_columns, vertical_resize_rows;
+extern int vertical_resize_hotx, vertical_resize_hoty;
+extern int lefthand_resize_columns, lefthand_resize_rows;
+extern int lefthand_resize_hotx, lefthand_resize_hoty;
+extern int righthand_resize_columns, righthand_resize_rows;
+extern int righthand_resize_hotx, righthand_resize_hoty;
+
+#endif
diff -urN lib/microwindows/src/nanowm-ecos/nanowm.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/nanowm.c
--- lib/microwindows/src/nanowm-ecos/nanowm.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/nanowm.c	2005-02-21 16:13:41.000000000 +0100
@@ -0,0 +1,102 @@
+/*
+ * NanoWM - Window Manager for Nano-X
+ *
+ * Copyright (C) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ * Parts based on npanel.c Copyright (C) 1999 Alistair Riddoch.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+/* Uncomment this if you want debugging output from this file */
+/* #define DEBUG */
+#include "nanowm.h"
+
+GR_SCREEN_INFO si;
+
+void * eCos_NanoWM(void * arg)
+{
+	GR_EVENT event;
+	GR_WM_PROPERTIES props;
+	win window;
+
+	if(GrOpen() < 0) {
+		diag_printf("NanoWM: Couldn't connect to Nano-X server!\n");
+		pthread_exit(NULL);
+	}
+
+	/* pass errors through main loop, don't exit*/
+	GrSetErrorHandler(NULL);
+
+	GrGetScreenInfo(&si);
+
+	/* add root window*/
+	window.wid = GR_ROOT_WINDOW_ID;
+	window.pid = GR_ROOT_WINDOW_ID;
+	window.type = WINDOW_TYPE_ROOT;
+	window.clientid = 1;
+	window.active = 0;
+	window.data = NULL;
+	add_window(&window);
+	diag_printf("NanoWM: SelectEvents\n");
+	GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_CHLD_UPDATE);
+
+	/* Set new root window background color*/
+	props.flags = GR_WM_FLAGS_BACKGROUND;
+	props.background = GrGetSysColor(GR_COLOR_DESKTOP);
+	diag_printf("NanoWM: SelectWMProperties\n");
+	GrSetWMProperties(GR_ROOT_WINDOW_ID, &props);
+
+	while(1) { 
+		GrGetNextEvent(&event);
+
+		switch(event.type) {
+			case GR_EVENT_TYPE_ERROR:
+				diag_printf("nanowm: error %d\n", event.error.code);
+				break;
+			case GR_EVENT_TYPE_EXPOSURE:
+#if 0
+				diag_printf("NanoWM: EXPOSURE\n");
+#endif
+				do_exposure(&event.exposure);
+				break;
+			case GR_EVENT_TYPE_BUTTON_DOWN:
+				do_button_down(&event.button);
+				break;
+			case GR_EVENT_TYPE_BUTTON_UP:
+				do_button_up(&event.button);
+				break;
+			case GR_EVENT_TYPE_MOUSE_ENTER:
+				do_mouse_enter(&event.general);
+				break;
+			case GR_EVENT_TYPE_MOUSE_EXIT:
+				do_mouse_exit(&event.general);
+				break;
+			case GR_EVENT_TYPE_MOUSE_POSITION:
+				do_mouse_moved(&event.mouse);
+				break;
+			case GR_EVENT_TYPE_KEY_DOWN:
+				do_key_down(&event.keystroke);
+				break;
+			case GR_EVENT_TYPE_KEY_UP:
+				do_key_up(&event.keystroke);
+				break;
+			case GR_EVENT_TYPE_FOCUS_IN:
+				//diag_printf("NanoWM: Focus in\n");
+				do_focus_in(&event.general);
+				break;
+			case GR_EVENT_TYPE_CHLD_UPDATE:
+#if 0
+				diag_printf("NanoWM: CHLD_UPDATE\n");
+#endif
+				do_update(&event.update);
+				break;
+			default:
+				diag_printf("Got unexpected event %d\n", event.type);
+				break;
+		}
+	}
+
+	GrClose();
+}
diff -urN lib/microwindows/src/nanowm-ecos/nanowm.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/nanowm.h
--- lib/microwindows/src/nanowm-ecos/nanowm.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/nanowm.h	2005-02-21 16:13:41.000000000 +0100
@@ -0,0 +1,196 @@
+/*
+ * NanoWM- the NanoGUI window manager.
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+
+#ifndef __NANOWM_H
+#define __NANOWM_H
+
+#ifdef DEBUG
+#define Dprintf printf
+#else
+#define Dprintf(ignore...)
+#endif
+
+/* Where to place the first window on the screen */
+#define FIRST_WINDOW_LOCATION 2
+
+/* The distance to leave between windows when deciding where to place */
+#define WINDOW_STEP 20
+
+/* The different window types which can be used in windowlist->type */
+enum {
+	WINDOW_TYPE_ROOT,
+	WINDOW_TYPE_CONTAINER,
+	WINDOW_TYPE_CLIENT
+	/***WINDOW_TYPE_TOPBAR,
+	WINDOW_TYPE_LEFTBAR,
+	WINDOW_TYPE_RIGHTBAR,
+	WINDOW_TYPE_BOTTOMBAR,
+	WINDOW_TYPE_LEFTRESIZE,
+	WINDOW_TYPE_RIGHTRESIZE,
+	WINDOW_TYPE_CLOSEBUTTON,
+	WINDOW_TYPE_MAXIMISEBUTTON,
+	WINDOW_TYPE_RESTOREBUTTON,
+	WINDOW_TYPE_ICONISEBUTTON,
+	WINDOW_TYPE_ICON,
+	WINDOW_TYPE_UTILITYBUTTON,
+	WINDOW_TYPE_UTILITYMENU,
+	WINDOW_TYPE_UTILITYMENUENTRY,
+	WINDOW_TYPE_ROOTMENU,
+	WINDOW_TYPE_ROOTMENUENTRY**/
+};
+
+/* 
+ * Used to keep a list of all the windows we know about so we can quickly
+ * find out whether a window is "one of ours", and if it is, what kind of
+ * window it is (title bar, side bar, button, icon, root menu, etc.), who
+ * it's a child of, and any special data associated with it (the title
+ * used in the title, the text of a root menu entry, the pixmap of an
+ * icon, etc.).
+ */
+struct windowlist {
+	GR_WINDOW_ID wid;	/* The ID of this window */
+	GR_WINDOW_ID pid;	/* The ID of this window's parent */
+	GR_WINDOW_ID clientid;	/* clientid for container window*/
+	int type;		/* What kind of window this is */
+  int sizing;                   /* True if in the middle of a sizing request */
+  int active;		/* Whether this window is active or not */
+	void *data;		/* Data associated with this window */
+	struct windowlist *next; /* The next window in the list */
+};
+typedef struct windowlist win;
+
+/*
+ * Used to record the offset position when performing a move.
+ */
+struct position {
+	GR_COORD x;
+	GR_COORD y;
+};
+
+/*
+ * Used to record the original position, original size, and offset position
+ * when performing a resize.
+ */
+struct pos_size {
+	GR_COORD xoff;
+	GR_COORD yoff;
+	GR_COORD xorig;
+	GR_COORD yorig;
+	GR_SIZE width;
+	GR_SIZE height;
+};
+
+#if 0000
+/*
+ * Used to record some general information about the client.
+ */
+struct clientinfo {
+	GR_WINDOW_ID cid;
+};
+#endif
+
+/* Function prototypes */
+win *find_window(GR_WINDOW_ID wid);
+int add_window(win *window);
+int remove_window(win *window);
+int remove_window_and_children(win *window);
+int new_client_window(GR_WINDOW_ID wid);
+void client_window_destroy(win *window);
+void redraw_ncarea(win *window);
+void do_exposure(GR_EVENT_EXPOSURE *event);
+void do_button_down(GR_EVENT_BUTTON *event);
+void do_button_up(GR_EVENT_BUTTON *event);
+void do_mouse_enter(GR_EVENT_GENERAL *event);
+void do_mouse_exit(GR_EVENT_GENERAL *event);
+void do_mouse_moved(GR_EVENT_MOUSE *event);
+void do_focus_in(GR_EVENT_GENERAL *event);
+void do_key_down(GR_EVENT_KEYSTROKE *event);
+void do_key_up(GR_EVENT_KEYSTROKE *event);
+void do_focus_in(GR_EVENT_GENERAL *event);
+void do_focus_out(GR_EVENT_GENERAL *event);
+void do_update(GR_EVENT_UPDATE *event);
+void do_chld_update(GR_EVENT_UPDATE *event);
+void rootwindow_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void container_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void topbar_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void closebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void maximisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void restorebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void iconisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void utilitybutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void utilitymenu_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void utilitymenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void rootmenu_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void rootmenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void icon_exposure(win *window, GR_EVENT_EXPOSURE *event);
+void rootwindow_buttondown(win *window, GR_EVENT_BUTTON *event);
+void container_buttondown(win *window, GR_EVENT_BUTTON *event);
+void topbar_buttondown(win *window, GR_EVENT_BUTTON *event);
+void resizebar_buttondown(win *window, GR_EVENT_BUTTON *event);
+void closebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void maximisebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void restorebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void iconisebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void utilitybutton_buttondown(win *window, GR_EVENT_BUTTON *event);
+void icon_buttondown(win *window, GR_EVENT_BUTTON *event);
+void rootwindow_buttonup(win *window, GR_EVENT_BUTTON *event);
+void container_buttonup(win *window, GR_EVENT_BUTTON *event);
+void topbar_buttonup(win *window, GR_EVENT_BUTTON *event);
+void resizebar_buttonup(win *window, GR_EVENT_BUTTON *event);
+void closebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void maximisebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void restorebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void iconisebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void utilitybutton_buttonup(win *window, GR_EVENT_BUTTON *event);
+void icon_buttonup(win *window, GR_EVENT_BUTTON *event);
+void utilitymenuentry_buttonup(win *window, GR_EVENT_BUTTON *event);
+void rootmenuentry_buttonup(win *window, GR_EVENT_BUTTON *event);
+void closebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void maximisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void restorebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void iconisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void utilitybutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void utilitymenu_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void utilitymenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void rootmenu_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void rootmenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event);
+void container_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void topbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void leftbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void leftresize_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void bottombar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void rightresize_mousemoved(win *window, GR_EVENT_MOUSE *event);
+void rightbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
+
+extern GR_SCREEN_INFO si;
+extern win *windows;
+extern GR_BITMAP utilitybutton_notpressed[];
+extern GR_BITMAP utilitybutton_pressed[];
+extern GR_BITMAP maximisebutton_notpressed[];
+extern GR_BITMAP maximisebutton_pressed[];
+extern GR_BITMAP iconisebutton_notpressed[];
+extern GR_BITMAP iconisebutton_pressed[];
+extern GR_BITMAP closebutton_notpressed[];
+extern GR_BITMAP closebutton_pressed[];
+extern GR_BITMAP restorebutton_notpressed[];
+extern GR_BITMAP restorebutton_pressed[];
+extern GR_BITMAP horizontal_resize_fg[];
+extern GR_BITMAP horizontal_resize_bg[];
+extern GR_BITMAP vertical_resize_fg[];
+extern GR_BITMAP vertical_resize_bg[];
+extern GR_BITMAP righthand_resize_fg[];
+extern GR_BITMAP righthand_resize_bg[];
+extern GR_BITMAP lefthand_resize_fg[];
+extern GR_BITMAP lefthand_resize_bg[];
+extern int horizontal_resize_columns, horizontal_resize_rows;
+extern int horizontal_resize_hotx, horizontal_resize_hoty;
+extern int vertical_resize_columns, vertical_resize_rows;
+extern int vertical_resize_hotx, vertical_resize_hoty;
+extern int lefthand_resize_columns, lefthand_resize_rows;
+extern int lefthand_resize_hotx, lefthand_resize_hoty;
+extern int righthand_resize_columns, righthand_resize_rows;
+extern int righthand_resize_hotx, righthand_resize_hoty;
+
+#endif
diff -urN lib/microwindows/src/nanowm-ecos/wlist.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/wlist.c
--- lib/microwindows/src/nanowm-ecos/wlist.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm-ecos/wlist.c	2005-02-21 16:13:42.000000000 +0100
@@ -0,0 +1,123 @@
+/*
+ * NanoWM - Window Manager for Nano-X
+ *
+ * Copyright (C) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+/* Uncomment this to get debugging output from this file */
+//#define DEBUG
+#include "nanowm.h"
+
+static win *windows = NULL;
+
+/*
+ * Find the windowlist entry for the specified window ID and return a pointer
+ * to it, or NULL if it isn't in the list.
+ */
+win *find_window(GR_WINDOW_ID wid)
+{
+	win *w = windows;
+
+	Dprintf("Looking for window %d... ", wid);
+
+	while(w) {
+		Dprintf("%d ", w->wid);
+		if(w->wid == wid) {
+			Dprintf("found it!\n");
+			return w;
+		}
+		w = w->next;
+	}
+
+	Dprintf("Nope, %d is not in the list\n", wid);
+	return NULL;
+}
+
+/*
+ * Add a new entry to the front of the windowlist.
+ * Returns -1 on failure or 0 on success.
+ */
+int add_window(win *window)
+{
+	win *w;
+
+	diag_printf("NanoWM: Adding window %d\n", window->wid);
+
+	if(!(w = malloc(sizeof(win)))) 
+		return -1;
+
+	w->wid = window->wid;
+	w->pid = window->pid;
+	w->type = window->type;
+	w->active = window->active;
+	w->clientid = window->clientid;
+	w->data = window->data;
+	w->sizing = window->sizing;
+	w->next = windows;
+	windows = w;
+
+	return 0;
+}
+
+/*
+ * Remove an entry from the windowlist.
+ * We must search through the list for it so that we can find the previous
+ * entry in the list and fix the next pointer. The alternative is to add a
+ * prev pointer to the structure which would increase the memory usage.
+ * Returns -1 on failure or 0 on success.
+ */
+int remove_window(win *window)
+{
+	win *w = windows;
+	win *prev = NULL;
+
+	while(w) {
+		if(w == window) {
+			if(!prev) windows = w->next;
+			else prev->next = w->next;
+			if(w->data) free(w->data);
+			free(w);
+			return 0;
+		}
+		prev = w;
+		w = w->next;
+	}
+
+	return -1;
+}
+
+/*
+ * Remove an entry and all it's children from the windowlist.
+ * Returns -1 on failure or 0 on success.
+ */
+int remove_window_and_children(win *window)
+{
+	win *t, *w = windows;
+	win *prev = NULL;
+	GR_WINDOW_ID pid = window->wid;
+
+	Dprintf("Removing window %d and children\n", window->wid);
+
+	while(w) {
+		Dprintf("Examining window %d (pid %d)\n", w->wid, w->pid);
+		if((w->pid == pid) || (w == window)) {
+			Dprintf("Removing window %d (pid %d)\n", w->wid,
+								w->pid);
+			if(prev) prev->next = w->next;
+			else windows = w->next;
+			t = w->next;
+			if(w->data) free(w->data);
+			free(w);
+			w = t;
+			continue;
+		}
+		prev = w;
+		w = w->next;
+	}
+
+	return -1;
+}
diff -urN lib/microwindows/src/nanowm.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm.sh
--- lib/microwindows/src/nanowm.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanowm.sh	2005-02-21 16:13:43.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X & bin/nanowm & bin/demo6 bin/nanogui.ppm & bin/nxclock & sleep 10000
diff -urN lib/microwindows/src/nanox/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/Makefile
--- lib/microwindows/src/nanox/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/Makefile	2005-02-21 16:13:31.000000000 +0100
@@ -0,0 +1,86 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+ifndef TOP
+TOP = ..
+CONFIG = $(TOP)/config
+endif
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+
+# Defines for preprocessor
+ifeq ($(LINK_APP_INTO_SERVER), Y)
+DEFINES += -DNONETWORK=1
+endif
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(NANOX), Y)
+
+ifeq ($(GTKSCREEN),Y)
+DEFINES += -DGTKSCREEN=1
+endif
+ifeq ($(IOMONITOR),Y)
+DEFINES += -DIOMONITOR=1
+endif
+# If you want to create a library with the objects files, define the name here
+LIBNAME = libnano-X.a
+LIBNAMESO = libnano-X.so
+
+# Nano-X server files
+NANOXAPPS  = $(TOP)/lib/libNanoXApp.a
+NANOXAPPLIB = -lNanoXApp
+NANOXFILES = srvmain.o srvfunc.o srvutil.o srvevent.o srvclip.o
+NANOXECOSFILES= srvmain.o srvnet.o srvfunc.o srvutil.o srvevent.o srvclip.o strdup.o mqfs.o nxproto_ecos.o nxdraw.o nxutil.o client_ecos.o demo2.o 
+NETFILES = srvnet.o
+UTILFILES = nxdraw.o nxutil.o
+
+ifeq ($(LINK_APP_INTO_SERVER), Y)
+NANOXFILES += $(UTILFILES)
+OBJS = $(NANOXFILES)
+else
+NANOXFILES += $(NETFILES)
+##########OBJS = client.o nxproto.o error.o $(UTILFILES)
+OBJS = client.o
+
+ifeq ($(ECOS), Y)
+all: $(TOP)/bin/nano-X-ecos
+else
+all: default $(TOP)/bin/nano-X
+endif
+
+endif
+
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+$(TOP)/bin/nano-X-ecos: $(NANOXECOSFILES)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(NANOXECOSFILES) $(NANOXSERVERLIBS) $(NANOXAPPS)
+
+# Server binary ...
+ifeq ($(SHAREDLIBS), Y)
+$(TOP)/bin/nano-X: $(NANOXFILES) $(NANOXSERVERLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(NANOXFILES) $(CCNANOXSERVERLIBS)
+else
+$(TOP)/bin/nano-X: $(NANOXFILES) $(NANOXSERVERLIBS) $(TOP)/config
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(NANOXFILES) $(NANOXSERVERLIBS)
+endif
+
diff -urN lib/microwindows/src/nanox/client.1 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/client.1
--- lib/microwindows/src/nanox/client.1	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/client.1	2005-02-21 16:13:33.000000000 +0100
@@ -0,0 +1,2083 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1999, 2000 Alex Holden <alex@linuxhacker.org>
+ * Copyright (c) 1991 David I. Bell
+ * Copyright (c) 2000 Vidar Hokstad
+ * Copyright (c) 2000 Morten Rolland <mortenro@screenmedia.no>
+ *
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Client routines to do graphics with windows and graphics contexts.
+ *
+ * Rewritten heavily for speed by Greg Haerr
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <stddef.h>
+#include <errno.h>
+#include <time.h>
+#if HAVE_SHAREDMEM_SUPPORT
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#endif
+#include <sys/time.h>
+#include <sys/socket.h>
+#if ELKS
+#include <linuxmt/na.h>
+#include <linuxmt/time.h>
+#else
+#include <sys/un.h>
+#if hpux
+#include <sys/time.h>
+#else
+#include <sys/select.h>
+#endif
+#endif
+#include <signal.h> 
+#include "nano-X.h"
+#include "serv.h"
+#include "nxproto.h"
+
+#define GR_CLOSE_FIX	1	/* dirty hack attempts to fix GrClose hang bug*/
+
+#define SHM_BLOCK_SIZE	4096
+
+/* exported global data*/
+int 	   nxSocket = -1;	/* The network socket descriptor */
+#if HAVE_SHAREDMEM_SUPPORT
+char *	   nxSharedMem = 0;	/* Address of shared memory segment*/
+static int nxSharedMemSize;	/* Size in bytes of shared mem segment*/
+#endif
+
+/* readable error strings*/
+char *nxErrorStrings[] = {
+	GR_ERROR_STRINGS
+};
+
+static int storedevent = 0;
+static GR_EVENT storedevent_data;
+
+/*
+ * The following is the user defined function for handling errors.
+ * If this is not set, then the default action is to close the connection
+ * to the server, describe the error, and then exit.  This error function
+ * will only be called when the client asks for events.
+ */
+static GR_FNCALLBACKEVENT ErrorFunc = GrDefaultErrorHandler;
+
+/* 
+ * The default error handler which is called when the server
+ * reports an error event and the client hasn't set a handler for error events.
+ */
+void 
+GrDefaultErrorHandler(GR_EVENT *ep)
+{
+	if (ep->type == GR_EVENT_TYPE_ERROR) {
+		EPRINTF("nxclient %d: Error (%s) ", getpid(), ep->error.name);
+		EPRINTF(nxErrorStrings[ep->error.code], ep->error.id);
+		GrClose();
+		exit(1);
+	}
+}
+
+/*
+ * Set an error handling routine, which will be called on any errors from
+ * the server (when events are asked for by the client).  If zero is given,
+ * then errors will be returned as regular events.  
+ * Returns the previous error handler.
+ */
+GR_FNCALLBACKEVENT
+GrSetErrorHandler(GR_FNCALLBACKEVENT fncb)
+{
+	GR_FNCALLBACKEVENT orig = ErrorFunc;
+
+	ErrorFunc = fncb;
+	return orig;
+}
+
+/*
+ * Check if the passed event is an error event, and call
+ * error handler if registered.  Error event is then converted
+ * to a null event in case it's later processed by the main loop.
+ * This solution is simpler than creating a client-side event queue.
+ */
+static void
+CheckErrorEvent(GR_EVENT *ep)
+{
+	if (ep->type == GR_EVENT_TYPE_ERROR) {
+		if (ErrorFunc) {
+			/* call error handler*/
+			ErrorFunc(ep);
+
+			/* then convert to null event*/
+			ep->type = GR_EVENT_TYPE_NONE;
+		}
+	}
+}
+
+/*
+ * Read n bytes of data from the server into block *b.  Make sure the data
+ * you are about to read are actually of the correct type - e.g. make a
+ * check for the first block of data you read as a response to a command
+ * with the Typed version of this function. Returns 0 on success or -1 on
+ * failure.
+ */
+static int GrReadBlock(void *b, int n)
+{
+	int i = 0;
+	char *v;
+
+	v = (char *) b;
+
+	nxFlushReq(0L,0);
+	while(v < ((char *) b + n)) {
+		i = read(nxSocket, v, ((char *) b + n - v));
+		if ( i <= 0 ) {
+			if ( i == 0 ) {
+				/* We should maybe produce an event here,
+				 * if possible.
+				 */
+				EPRINTF("nxclient: lost connection to Nano-X server\n");
+				exit(1);
+			}
+			if ( errno == EINTR || errno == EAGAIN )
+				continue;
+
+			EPRINTF("nxclient: bad readblock %d\n", i);
+			return -1;
+		}
+		v += i;
+	}
+
+	return 0;
+}
+
+/*
+ * Read a byte of data from the server.
+ */
+static int GrReadByte()
+{
+	unsigned char c;
+
+	if(GrReadBlock(&c, 1) == -1)
+		return -1;
+	else return (int) c;
+}
+
+
+/* Check if the data we are about to read are of the correct type.  This
+ * must be done in order to avoid reading an event as part of the response
+ * from the server to a command that requires a reply.
+ */
+
+static int GrCheckBlockType(short packettype)
+{
+	short b;
+	while (GrReadBlock(&b,sizeof(b)) != -1) {
+		if (b == packettype)
+			return b;
+
+		if (b == GrNumGetNextEvent) {
+			/*EPRINTF("nxclient %d: Storing event (expected %d)\n",
+				getpid(), packettype);*/
+
+			/* We only need to handle one event, since the next
+			 * event won't arrive until the next GrPrepareSelect()
+			 * has been called, and by then we have already
+			 * handled this event in GrServiceSelect(). If
+			 * GrPrepareSelect() is never called, then we should
+			 * never get here either, so that is cool too.
+			 */
+if (storedevent) printf("\7ERROR\n");
+			GrReadBlock(&storedevent_data,
+				    sizeof(storedevent_data));
+			storedevent = 1;
+		} else {
+			EPRINTF("nxclient %d: Wrong packet type %d "
+				"(expected %d)\n", getpid(),b, packettype);
+		}
+	}
+	EPRINTF("nxclient %d: Corrupted packet\n", getpid());
+	return -1;
+}
+
+/* Actually read a response from the server, much like the GrReadBlock but
+ * make sure the response is of the right kind, e.g. store the event that
+ * may have sneaked into the stream.
+ */
+
+static int GrTypedReadBlock(void *b, int n, int type)
+{
+	int r;
+   
+	r = GrCheckBlockType(type);
+	if (r != type)
+		return -1;
+	return GrReadBlock(b,n);
+}
+
+#if 0000
+/*
+ * Read an error event structure from the server and deliver it to the client.
+ */
+static int GrDeliverErrorEvent(void)
+{
+	GR_EVENT_ERROR err;
+
+	if(GrReadBlock(&err, sizeof(err)) == -1)
+		return -1;
+
+	GrErrorFunc(err);
+
+	return 0;
+}
+
+/*
+ * Send a block of data to the server and read it's reply.
+ */
+static int GrSendBlock(void *b, long n)
+{
+	int i = 0;
+	unsigned char *c;
+
+	c = (unsigned char *) b;
+
+	/* FIXME: n > 64k will fail here if sizeof(int) == 2*/
+	while(c < ((unsigned char *) b + n)) {
+		i = write(nxSocket, c, ((unsigned char *) b + n - c));
+		if(i <= 0)
+			return -1;
+		c += i;
+	}
+
+#if 0
+	do {
+		int	z;
+
+		if((i = GrReadByte()) < 0) return -1;
+		else if(i == GrRetESig) {
+			z = GrReadByte();
+			if(z == -1) return -1;
+EPRINTF("nxclient: bad GrSendBlock\r\n");
+			raise(z);
+		}
+		else if(i == GrRetErrorPending) {
+			if(GrDeliverErrorEvent() == -1) return -1;
+		} else if (i == GrEventFollows) {
+		   
+		}
+
+	} while((i == GrRetESig) | (i == GrRetErrorPending));
+	return((int) i);
+#endif
+	return 0;
+}
+
+/*
+ * Send a single byte to the server and read the reply.
+ */
+static int GrSendByte(unsigned char c)
+{
+	return GrSendBlock(&c, 1);
+}
+#endif
+
+/*
+ * Flush the message buffer of any messages it may contain.
+ */
+void 
+GrFlush(void)
+{
+	nxFlushReq(0L,1);
+}
+
+/*
+ * Open a connection to the graphics server.
+ * Returns the fd of the connection to the server if successful,
+ * or -1 on failure.
+ */
+int 
+GrOpen(void)
+{
+	size_t 		size;
+	nxOpenReq	req;
+	int		tries;
+	int		ret;
+#if ELKS
+	struct sockaddr_na name;
+#else
+	struct sockaddr_un name;
+#endif
+	
+	if(nxSocket == -1)
+#if ELKS
+		if((nxSocket = socket(AF_NANO, SOCK_STREAM, 0)) == -1) {
+#else
+		if((nxSocket = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
+#endif
+			nxSocket = -1;
+			return -1;
+		}
+
+#if ELKS
+	name.sun_family = AF_NANO;
+	name.sun_no = GR_NUMB_SOCKET;
+	size = sizeof(struct sockaddr_na);
+#else
+	name.sun_family = AF_UNIX;
+	strcpy(name.sun_path, GR_NAMED_SOCKET);
+	size = (offsetof(struct sockaddr_un, sun_path) +
+		strlen(name.sun_path) + 1);
+#endif
+	/*
+	 * Try to open the connection for up to a second,
+	 * waiting 1/10 second between attempts.
+	 */
+	for (tries=1; tries<=10; ++tries) {
+		struct timespec req;
+
+		ret = connect(nxSocket, (struct sockaddr *) &name, size);
+		if (ret >= 0)
+			break;
+		req.tv_sec = 0;
+		req.tv_nsec = 100000000L;
+		nanosleep(&req, NULL);
+		EPRINTF("nxclient: retry connect attempt %d\n", tries);
+	}
+	if (ret == -1) {
+		close(nxSocket);
+		nxSocket = -1;
+		return -1;
+	}
+
+	/* By Performing the 'GrOpen' without allocating a buffer, just
+	 * shuffeling the struct over the wire, we can postpone the
+	 * allocation of the client size command buffer, which will never be
+	 * allocated if the first command after GrOpen() is
+	 * GrReqShmCmds() which allocates a replacement shared memory
+	 * segment.
+	 * So: Calling GrReqShmCmds() right after GrOpen will prevent the
+	 * traditional command queue buffer from being allocated from
+	 * the process heap - and only the shared memory segment is
+	 * allocated.
+	 */
+	req.reqType = GrNumOpen;
+	req.hilength = 0;
+	req.length = sizeof(req);
+
+	nxWriteSocket((char *)&req,sizeof(req));
+	return nxSocket;
+}
+
+/*
+ * Close the graphics device, flushing any waiting messages.
+ * Vladimir Cotfas: 
+ *  - hang in GrFlush() --> nxFlushReq(0L,1);
+ *
+ */
+#if GR_CLOSE_FIX
+static void
+mySignalhandler(int sig)
+{
+	if (sig == SIGALRM) {
+	    printf("Oops! nxFlushReq() timed out, cowardly chickening out!\n");
+	    exit(127);
+	}
+}
+#endif
+
+void 
+GrClose(void)
+{
+#if GR_CLOSE_FIX
+	/* allow 1 second to flush*/
+	void * oldSignalHandler = signal(SIGALRM, mySignalhandler);
+	alarm(1);
+#endif
+	AllocReq(Close);
+	GrFlush();
+#if GR_CLOSE_FIX
+	alarm(0); 
+	signal(SIGALRM, oldSignalHandler);
+#endif
+	close(nxSocket);
+}
+
+/*
+ * Return useful information about the screen.
+ * Returns -1 on failure or 0 on success.
+ */
+void 
+GrGetScreenInfo(GR_SCREEN_INFO *sip)
+{
+	AllocReq(GetScreenInfo);
+	GrTypedReadBlock(sip, sizeof(GR_SCREEN_INFO),GrNumGetScreenInfo);
+}
+
+/* Return system-defined color*/
+GR_COLOR
+GrGetSysColor(int index)
+{
+	nxGetSysColorReq *req;
+	GR_COLOR color;
+
+	req = AllocReq(GetSysColor);
+	req->index = index;
+	if(GrTypedReadBlock(&color, sizeof(color),GrNumGetSysColor) == -1)
+		return 0;
+	return color;
+}
+
+/*
+ * Return useful information about the specified font.
+ */
+void 
+GrGetFontInfo(GR_FONT_ID fontno, GR_FONT_INFO *fip)
+{
+	nxGetFontInfoReq *req;
+
+	req = AllocReq(GetFontInfo);
+	req->fontid = fontno;
+	GrTypedReadBlock(fip, sizeof(GR_FONT_INFO),GrNumGetFontInfo);
+}
+
+/*
+ * Return information about the specified graphics context.
+ */
+void GrGetGCInfo(GR_GC_ID gc, GR_GC_INFO *gcip)
+{
+	nxGetGCInfoReq *req;
+
+	req = AllocReq(GetGCInfo);
+	req->gcid = gc;
+	GrTypedReadBlock(gcip, sizeof(GR_GC_INFO),GrNumGetGCInfo);
+}
+
+/*
+ * Return the size of a text string for the font in a graphics context.
+ * This is the width of the string, the height of the string,
+ * and the height above the bottom of the font of the baseline for the font.
+ */
+void GrGetGCTextSize(GR_GC_ID gc, void *str, int count, int flags,
+	GR_SIZE *retwidth, GR_SIZE *retheight, GR_SIZE *retbase)
+{
+	nxGetGCTextSizeReq *req;
+	int		    size;
+
+	if(count == -1 && (flags&MWTF_PACKMASK) == MWTF_ASCII)
+		count = strlen((char *)str);
+
+	size = nxCalcStringBytes(str, count, flags);
+
+	req = AllocReqExtra(GetGCTextSize, size);
+	req->gcid = gc;
+	req->flags = flags;
+	memcpy(GetReqData(req), str, size);
+	GrTypedReadBlock(retwidth, sizeof(*retwidth),GrNumGetGCTextSize);
+	GrReadBlock(retheight, sizeof(*retheight));
+	GrReadBlock(retbase, sizeof(*retbase));
+}
+
+/*
+ * Register the specified file descriptor to return an event
+ * when input is ready.
+ * FIXME: only one external file descriptor works
+ */
+static int regfd = -1;
+
+void 
+GrRegisterInput(int fd)
+{
+	regfd = fd;
+}
+
+/* Passive library entry points*/
+
+/* The GrPrepareSelect function serves two purposes:  It puts the server into
+ * a mode where it will send the first event that arrives for this connection
+ * directly to the client.  It also initializes a fd_set so that a 'select'
+ * system call will wake up when this first event arrives.
+ *
+ * The 'maxfd' is used to find the value of the biggest filedescriptor in
+ * use - it will be updated if Nano-X uses a filedescriptor with a larger
+ * value.
+ */
+void
+GrPrepareSelect(int *maxfd,void *rfdset)
+{
+	fd_set *rfds = rfdset;
+
+	AllocReq(GetNextEvent);
+	GrFlush();
+
+	FD_SET(nxSocket, rfds);
+	if(nxSocket > *maxfd)
+		*maxfd = nxSocket;
+	if(regfd != -1) {
+		FD_SET(regfd, rfds);
+		if(regfd > *maxfd)
+			*maxfd = regfd;
+	}
+}
+
+void
+GrServiceSelect(void *rfdset, GR_FNCALLBACKEVENT fncb)
+{
+	fd_set *	rfds = rfdset;
+	GR_EVENT 	ev;
+
+        /* Clean out any event that might have arrived while waiting
+	 * for other data, for instance by doing Nano-X requests
+	 * between GrPrepareSelect() and GrServiceSelect(), or when
+	 * an event is generated in Nano-X at the same time as the
+	 * client wakes up for some reason and calls Nano-X functions.
+	 */
+	if (storedevent) {
+		/*DPRINTF("nxclient: Handling stored event\n");*/
+		CheckErrorEvent(&storedevent_data);
+		fncb(&storedevent_data);
+		storedevent = 0;
+	} else {
+		if(FD_ISSET(nxSocket, rfds)) {
+			GrTypedReadBlock(&ev, sizeof(ev),GrNumGetNextEvent);
+			CheckErrorEvent(&ev);
+			fncb(&ev);
+		}
+	}
+
+#if 0 
+	/* Morten - remove this if you want*/
+	while ( GrPeekEvent(&ev) )
+		CheckErrorEvent(&ev);
+		fncb(&ev);
+#endif
+
+	if(regfd != -1 && FD_ISSET(regfd, rfds)) {
+		ev.type = GR_EVENT_TYPE_FDINPUT;
+		ev.fdinput.fd = regfd;
+		fncb(&ev);
+	}
+}
+
+void
+GrMainLoop(GR_FNCALLBACKEVENT fncb)
+{
+	fd_set	rfds;
+	int	setsize = 0;
+
+	for(;;) {
+		FD_ZERO(&rfds);
+		GrPrepareSelect(&setsize, &rfds);
+		if(select(setsize+1, &rfds, NULL, NULL, NULL) > 0)
+			GrServiceSelect(&rfds, fncb);
+	}
+}
+
+/*
+ * Return the next event from the event queue.
+ * This waits for a new one if one is not ready.
+ */
+void 
+GrGetNextEvent(GR_EVENT *ep)
+{
+	GrGetNextEventTimeout(ep, 0L);
+}
+
+/*
+ * Return the next event from the event queue, or
+ * wait for a new one if one is not ready.  If timeout
+ * is nonzero, return timeout event if time elapsed.
+ */
+void
+GrGetNextEventTimeout(GR_EVENT *ep, GR_TIMEOUT timeout)
+{
+	fd_set 		rfds;
+	int		setsize = 0;
+	int		e;
+	struct timeval 	to;
+
+	if (storedevent) {
+		/*DPRINTF("nxclient %d: Returning stored event\n",getpid());*/
+		memcpy(ep,&storedevent_data,sizeof(*ep));
+		storedevent = 0;
+		CheckErrorEvent(ep);
+		return;
+	}
+
+	FD_ZERO(&rfds);
+	GrPrepareSelect(&setsize, &rfds);
+	if (timeout) {
+		to.tv_sec = timeout / 1000;
+		to.tv_usec = (timeout % 1000) * 1000;
+	}
+
+	if ((e = select(setsize+1, &rfds, NULL, NULL, timeout? &to: NULL)) > 0){
+		if(FD_ISSET(nxSocket, &rfds)) {
+			/* this will never be GR_EVENT_NONE
+			 * with current implementation
+			 */
+		        GrTypedReadBlock(ep, sizeof(*ep),GrNumGetNextEvent);
+			CheckErrorEvent(ep);
+			return;
+		}
+		if(regfd != -1 && FD_ISSET(regfd, &rfds)) {
+			ep->type = GR_EVENT_TYPE_FDINPUT;
+			ep->fdinput.fd = regfd;
+			return;
+		}
+	}
+	else if (e == 0) {
+		/* 
+		 * Timeout has occured.  Currently return
+		 * a timeout event regardless of whether
+		 * client has selected for it.
+		 */
+		ep->type = GR_EVENT_TYPE_TIMEOUT;
+	}
+}
+
+/*
+ * Return the next event from the event queue if one is ready.
+ * If one is not ready, then the type GR_EVENT_TYPE_NONE is returned.
+ * If it is an error event, then a user-specified routine is called
+ * if it was defined, otherwise we clean up and exit.
+ */
+void 
+GrCheckNextEvent(GR_EVENT *ep)
+{
+	AllocReq(CheckNextEvent);
+	GrTypedReadBlock(ep, sizeof(*ep),GrNumGetNextEvent);
+	CheckErrorEvent(ep);
+}
+
+/*
+ * Return the next event from the event queue if available.
+ * If there is no event, then a null event type is returned.
+ */
+int 
+GrPeekEvent(GR_EVENT *ep)
+{
+	int	ret;
+
+	if (storedevent) {
+		*ep = storedevent_data;
+		storedevent = 0;
+		return 1;
+	}
+	AllocReq(PeekEvent);
+	GrTypedReadBlock(ep, sizeof(*ep),GrNumPeekEvent);
+	ret = GrReadByte();
+	CheckErrorEvent(ep);
+	return ret;
+}
+
+/*
+ * Select events for a window for this client.
+ * The events are a bitmask for the events desired.
+ * Error events are always returned/handled regardless of mask.
+ */
+void 
+GrSelectEvents(GR_WINDOW_ID wid, GR_EVENT_MASK eventmask)
+{
+	
+	nxSelectEventsReq *req;
+
+	req = AllocReq(SelectEvents);
+	req->windowid = wid;
+	req->eventmask = eventmask;
+}
+
+/*
+ * Allocate a new window which is a child of the specified window.
+ * The window inherits the cursor of the parent window.
+ */
+GR_WINDOW_ID
+GrNewWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, GR_SIZE bordersize, GR_COLOR background,
+	GR_COLOR bordercolor)
+{
+	nxNewWindowReq *req;
+	GR_WINDOW_ID 	wid;
+
+	req = AllocReq(NewWindow);
+	req->parentid = parent;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	req->backgroundcolor = background;
+	req->bordercolor = bordercolor;
+	req->bordersize = bordersize;
+	if(GrTypedReadBlock(&wid, sizeof(wid),GrNumNewWindow) == -1)
+		return 0;
+	return wid;
+}
+   
+   
+/*
+ * Allocate a new pixmap
+ * FIXME: Add support for shared memory...
+ */
+GR_WINDOW_ID
+GrNewPixmap(GR_SIZE width, GR_SIZE height, void *addr)
+{
+	nxNewPixmapReq *req;
+	GR_WINDOW_ID 	wid;
+
+	req = AllocReq(NewPixmap);
+	req->width = width;
+	req->height = height;
+	if(GrTypedReadBlock(&wid, sizeof(wid), GrNumNewPixmap) == -1)
+		return 0;
+	return wid;
+}
+
+/*
+ * Allocate a new input-only window which is a child of the specified window.
+ * The window inherits the cursor of the parent window.
+ */
+GR_WINDOW_ID
+GrNewInputWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height)
+{
+	nxNewInputWindowReq *req;
+	GR_WINDOW_ID 	     wid;
+
+	req = AllocReq(NewInputWindow);
+	req->parentid = parent;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	if(GrTypedReadBlock(&wid, sizeof(wid), GrNumNewInputWindow) == -1)
+		return 0;
+	return wid;
+}
+
+/*
+ * Destroy an existing window.
+ */
+void 
+GrDestroyWindow(GR_WINDOW_ID wid)
+{
+	nxDestroyWindowReq *req;
+
+	req = AllocReq(DestroyWindow);
+	req->windowid = wid;
+}
+
+/*
+ * Return information about a window id.
+ */
+void 
+GrGetWindowInfo(GR_WINDOW_ID wid, GR_WINDOW_INFO *infoptr)
+{
+	nxGetWindowInfoReq *req;
+
+	req = AllocReq(GetWindowInfo);
+	req->windowid = wid;
+	GrTypedReadBlock(infoptr, sizeof(GR_WINDOW_INFO), GrNumGetWindowInfo);
+}
+
+/*
+ * Allocate a new GC with default parameters.
+ */
+GR_GC_ID 
+GrNewGC(void)
+{
+	GR_GC_ID    gc;
+
+	AllocReq(NewGC);
+	if(GrTypedReadBlock(&gc, sizeof(gc),GrNumNewGC) == -1)
+		return 0;
+	return gc;
+}
+
+/*
+ * Allocate a new GC which is a copy of another one.
+ */
+GR_GC_ID 
+GrCopyGC(GR_GC_ID gc)
+{
+	nxCopyGCReq *req;
+	GR_GC_ID     newgc;
+
+	req = AllocReq(CopyGC);
+	req->gcid = gc;
+	if(GrTypedReadBlock(&newgc, sizeof(newgc),GrNumCopyGC) == -1)
+		return 0;
+	return newgc;
+}
+
+/*
+ * Destroy an existing graphics context.
+ */
+void
+GrDestroyGC(GR_GC_ID gc)
+{
+	nxDestroyGCReq *req;
+
+	req = AllocReq(DestroyGC);
+	req->gcid = gc;
+}
+
+/*
+ * Allocate a new region.
+ */
+GR_REGION_ID 
+GrNewRegion(void)
+{
+	GR_REGION_ID    region;
+
+	AllocReq(NewRegion);
+	if(GrTypedReadBlock(&region, sizeof(region),GrNumNewRegion) == -1)
+		return 0;
+	return region;
+}
+
+/*
+ * Destroy an existing region.
+ */
+void
+GrDestroyRegion(GR_REGION_ID region)
+{
+	nxDestroyRegionReq *req;
+
+	req = AllocReq(DestroyRegion);
+	req->regionid = region;
+}
+
+/*
+ * Updates the region from a union of the specified rectangle
+ * and the original region.
+ */
+void
+GrUnionRectWithRegion(GR_REGION_ID region, GR_RECT *rect)
+{
+	nxUnionRectWithRegionReq *req;
+
+ 	req = AllocReq(UnionRectWithRegion);
+ 	if(rect) {
+ 		memcpy(&req->rect, rect, sizeof(*rect));
+ 	}
+ 	req->regionid = region;
+}
+
+/*
+ * Updates the region from a union of two regions.
+ */
+void
+GrUnionRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxUnionRegionReq *req;
+
+ 	req = AllocReq(UnionRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/*
+ * Updates the region by subtracting a region from another.
+ */
+void
+GrSubtractRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxSubtractRegionReq *req;
+
+ 	req = AllocReq(SubtractRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/*
+ * Updates the region to the difference of two regions.
+ */
+void
+GrXorRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxXorRegionReq *req;
+
+ 	req = AllocReq(XorRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/*
+ * Updates the region from a intersection of two regions.
+ */
+void
+GrIntersectRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxIntersectRegionReq *req;
+
+ 	req = AllocReq(IntersectRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/*
+ * Sets the clip-mask in the GC to the specified region.
+ */
+void
+GrSetGCRegion(GR_GC_ID gc, GR_REGION_ID region)
+{
+	nxSetGCRegionReq *req;
+	
+	req = AllocReq(SetGCRegion);
+	req->gcid = gc;
+	req->regionid = region;
+}
+
+/*
+ * Determines whether a specified point resides in a region.
+ */
+GR_BOOL
+GrPointInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y)
+{
+	nxPointInRegionReq *req;
+	GR_BOOL             ret_value;
+
+	req = AllocReq(PointInRegion);
+	req->regionid = region;
+	req->x = x;
+	req->y = y;
+	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumPointInRegion) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/*
+ * Determines whether a specified rectangle at least partly resides
+ * in a region.
+ */
+int
+GrRectInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y, GR_COORD w,
+	GR_COORD h)
+{
+	nxRectInRegionReq *req;
+	unsigned short	   ret_value;
+	
+	req = AllocReq(RectInRegion);
+	req->regionid = region;
+	req->x = x;
+	req->y = y;
+	req->w = w;
+	req->h = h;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumRectInRegion) == -1)
+		return 0;
+	return (int)ret_value;
+}
+
+/*
+ * Return GR_TRUE if a region is empty.
+ */ 
+GR_BOOL
+GrEmptyRegion(GR_REGION_ID region)
+{
+	nxEmptyRegionReq *req;
+	GR_BOOL 	  ret_value;
+	
+	req = AllocReq(EmptyRegion);
+	req->regionid = region;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumEmptyRegion) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/*
+ * Return GR_TRUE if two regions are identical.
+ */ 
+GR_BOOL
+GrEqualRegion(GR_REGION_ID rgn1, GR_REGION_ID rgn2)
+{
+	nxEqualRegionReq *req;
+	GR_BOOL 	  ret_value;
+	
+	req = AllocReq(EqualRegion);
+	req->region1 = rgn1;
+	req->region2 = rgn2;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumEqualRegion) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/*
+ * Offset a region by dx, dy.
+ */ 
+void
+GrOffsetRegion(GR_REGION_ID region, GR_SIZE dx, GR_SIZE dy)
+{
+	nxOffsetRegionReq *req;
+	
+	req = AllocReq(OffsetRegion);
+	req->region = region;
+	req->dx = dx;
+	req->dy = dy;
+}
+
+/*
+ * Return the bounding box for the specified region.
+ */
+int
+GrGetRegionBox(GR_REGION_ID region, GR_RECT *rect)
+{
+	nxGetRegionBoxReq *req;
+	unsigned short	   ret_value;
+	
+	if (!rect)
+		return GR_FALSE;
+	req = AllocReq(GetRegionBox);
+	req->regionid = region;
+ 	if(GrTypedReadBlock(rect, sizeof(*rect), GrNumGetRegionBox) == -1)
+		return GR_FALSE;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumGetRegionBox) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/*
+ * Allocate a new region from a set of points interpreted as a polygon.
+ */
+GR_REGION_ID 
+GrNewPolygonRegion(int mode, GR_COUNT count, GR_POINT *points)
+{
+	nxNewPolygonRegionReq	*req;
+	long			size;
+	GR_REGION_ID		region;
+
+	if(count == 0)
+		return GrNewRegion();
+	
+	if(points == NULL)
+		return 0;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(NewPolygonRegion, size);
+	req->mode = mode;
+	/* FIXME: unportable method, depends on sizeof(int) in GR_POINT*/
+	memcpy(GetReqData(req), points, size);
+
+	if(GrTypedReadBlock(&region, sizeof(region),
+		GrNumNewPolygonRegion) == -1)
+		return 0;
+	return region;
+}
+
+/*
+ * Map the window to make it (and possibly its children) visible on the screen.
+ * This paints the border and background of the window, and creates an
+ * exposure event to tell the client to draw into it.
+ */
+void 
+GrMapWindow(GR_WINDOW_ID wid)
+{
+	nxMapWindowReq *req;
+
+	req = AllocReq(MapWindow);
+	req->windowid = wid;
+}
+
+/*
+ * Unmap the window to make it and its children invisible on the screen.
+ */
+void 
+GrUnmapWindow(GR_WINDOW_ID wid)
+{
+	nxUnmapWindowReq *req;
+
+	req = AllocReq(UnmapWindow);
+	req->windowid = wid;
+}
+
+/*
+ * Raise the window to the highest level among its siblings.
+ */
+void 
+GrRaiseWindow(GR_WINDOW_ID wid)
+{
+	nxRaiseWindowReq *req;
+
+	req = AllocReq(RaiseWindow);
+	req->windowid = wid;
+}
+
+/*
+ * Lower the window to the lowest level among its siblings.
+ */
+void 
+GrLowerWindow(GR_WINDOW_ID wid)
+{
+	nxLowerWindowReq *req;
+
+	req = AllocReq(LowerWindow);
+	req->windowid = wid;
+}
+
+/*
+ * Move the window to the specified position relative to its parent.
+ */
+void 
+GrMoveWindow(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y)
+{
+	nxMoveWindowReq *req;
+
+	req = AllocReq(MoveWindow);
+	req->windowid = wid;
+	req->x = x;
+	req->y = y;
+}
+
+/*
+ * Resize the window to be the specified size.
+ */
+void 
+GrResizeWindow(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height)
+{
+	nxResizeWindowReq *req;
+
+	req = AllocReq(ResizeWindow);
+	req->windowid = wid;
+	req->width = width;
+	req->height = height;
+}
+
+/*
+ * Reparent window to new parent, position at passed x, y
+ */
+void 
+GrReparentWindow(GR_WINDOW_ID wid, GR_WINDOW_ID pwid, GR_COORD x, GR_COORD y)
+{
+	nxReparentWindowReq *req;
+
+	req = AllocReq(ReparentWindow);
+	req->windowid = wid;
+	req->parentid = pwid;
+	req->x = x;
+	req->y = y;
+}
+
+/*
+ * Clear the specified window by setting it to its background color.
+ * If the exposeflag is nonzero, then this also creates an exposure
+ * event for the window.
+ */
+void 
+GrClearWindow(GR_WINDOW_ID wid, GR_BOOL exposeflag)
+{
+	nxClearWindowReq *req;
+
+	req = AllocReq(ClearWindow);
+	req->windowid = wid;
+	req->exposeflag = exposeflag;
+}
+
+/* Return window with keyboard focus.*/
+GR_WINDOW_ID
+GrGetFocus(void)
+{
+	GR_WINDOW_ID	wid;
+
+	AllocReq(GetFocus);
+	if(GrTypedReadBlock(&wid, sizeof(wid), GrNumGetFocus) == -1)
+		return 0;
+	return wid;
+}
+
+/*
+ * Set the focus to a particular window.
+ * This makes keyboard events only visible to that window or children of it,
+ * depending on the pointer location.
+ */
+void 
+GrSetFocus(GR_WINDOW_ID wid)
+{
+	nxSetFocusReq *req;
+
+	req = AllocReq(SetFocus);
+	req->windowid = wid;
+}
+
+/*
+ * Set the border of a window to the specified color.
+ */
+void 
+GrSetBorderColor(GR_WINDOW_ID wid, GR_COLOR colour)
+{
+	nxSetBorderColorReq *req;
+
+	req = AllocReq(SetBorderColor);
+	req->windowid = wid;
+	req->color = colour;
+}
+
+/*
+ * Specify a cursor for a window.
+ * This cursor will only be used within that window, and by default
+ * for its new children.  If the cursor is currently within this
+ * window, it will be changed to the new one immediately.
+ */
+void
+GrSetCursor(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height, GR_COORD hotx,
+	GR_COORD hoty, GR_COLOR foreground, GR_COLOR background,
+	GR_BITMAP *fgbitmap, GR_BITMAP *bgbitmap)
+{
+	nxSetCursorReq *req;
+	int 	     	bitmapsize;
+	char *	     	data;
+
+	bitmapsize = GR_BITMAP_SIZE(width, height) * sizeof(GR_BITMAP);
+	req = AllocReqExtra(SetCursor, bitmapsize*2);
+	req->windowid = wid;
+	req->width = width;
+	req->height = height;
+	req->hotx = hotx;
+	req->hoty = hoty;
+	req->fgcolor = foreground;
+	req->bgcolor = background;
+	data = GetReqData(req);
+	memcpy(data, fgbitmap, bitmapsize);
+	memcpy(data+bitmapsize, bgbitmap, bitmapsize);
+}
+
+/*
+ * Move the cursor to the specified absolute screen coordinates.
+ * The coordinates are that of the defined hot spot of the cursor.
+ * The cursor's appearance is changed to that defined for the window
+ * in which the cursor is moved to.
+ */
+void 
+GrMoveCursor(GR_COORD x, GR_COORD y)
+{
+	nxMoveCursorReq *req;
+
+	req = AllocReq(MoveCursor);
+	req->x = x;
+	req->y = y;
+}
+
+/*
+ * Set the foreground color in a graphics context.
+ */
+void 
+GrSetGCForeground(GR_GC_ID gc, GR_COLOR foreground)
+{
+	nxSetGCForegroundReq *req;
+
+	req = AllocReq(SetGCForeground);
+	req->gcid = gc;
+	req->color = foreground;
+}
+
+/*
+ * Set the background color in a graphics context.
+ */
+void 
+GrSetGCBackground(GR_GC_ID gc, GR_COLOR background)
+{
+	nxSetGCBackgroundReq *req;
+
+	req = AllocReq(SetGCBackground);
+	req->gcid = gc;
+	req->color = background;
+}
+
+/*
+ * Set the drawing mode in a graphics context.
+ */
+void 
+GrSetGCMode(GR_GC_ID gc, int mode)
+{
+	nxSetGCModeReq *req;
+
+	req = AllocReq(SetGCMode);
+	req->gcid = gc;
+	req->mode = mode;
+}
+
+/*
+ * Set whether or not the background color is drawn in bitmaps and text.
+ */
+void 
+GrSetGCUseBackground(GR_GC_ID gc, GR_BOOL flag)
+{
+	nxSetGCUseBackgroundReq *req;
+
+	req = AllocReq(SetGCUseBackground);
+	req->gcid = gc;
+	req->flag = flag;
+}
+
+GR_FONT_ID
+GrCreateFont(GR_CHAR *name, GR_COORD height, GR_LOGFONT *plogfont)
+{
+	nxCreateFontReq *req;
+	GR_FONT_ID	fontid;
+
+ 	req = AllocReq(CreateFont);
+ 	if (plogfont) {
+ 		memcpy(&req->lf, plogfont, sizeof(*plogfont));
+ 		req->height = 0;
+ 		req->lf_used = 1;
+ 	} else {
+		if (name)
+			strcpy(req->lf.lfFaceName, name);
+		else req->lf.lfFaceName[0] = '\0';
+  		req->height = height;
+ 		req->lf_used = 0;
+	}
+  
+	if(GrTypedReadBlock(&fontid, sizeof(fontid),GrNumCreateFont) == -1)
+		return 0;
+	return fontid;
+}
+
+void
+GrSetFontSize(GR_FONT_ID fontid, GR_COORD fontsize)
+{
+	nxSetFontSizeReq *req;
+
+	req = AllocReq(SetFontSize);
+	req->fontid = fontid;
+	req->fontsize = fontsize;
+}
+
+void
+GrSetFontRotation(GR_FONT_ID fontid, int tenthdegrees)
+{
+	nxSetFontRotationReq *req;
+
+	req = AllocReq(SetFontRotation);
+	req->fontid = fontid;
+	req->tenthdegrees = tenthdegrees;
+}
+
+void
+GrSetFontAttr(GR_FONT_ID fontid, int setflags, int clrflags)
+{
+	nxSetFontAttrReq *req;
+
+	req = AllocReq(SetFontAttr);
+	req->fontid = fontid;
+	req->setflags = setflags;
+	req->clrflags = clrflags;
+}
+
+void
+GrDestroyFont(GR_FONT_ID fontid)
+{
+	nxDestroyFontReq *req;
+
+	req = AllocReq(DestroyFont);
+	req->fontid = fontid;
+}
+
+/*
+ * Set the font used for text drawing in a graphics context.
+ * The font is a number identifying one of several fonts.
+ * Font number 0 is always available, and is the default font.
+ */
+void
+GrSetGCFont(GR_GC_ID gc, GR_FONT_ID font)
+{
+	nxSetGCFontReq *req;
+
+	req = AllocReq(SetGCFont);
+	req->gcid = gc;
+	req->fontid = font;
+}
+
+/*
+ * Draw a line in the specified drawable using the specified graphics context.
+ */
+void 
+GrLine(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x1, GR_COORD y1, GR_COORD x2,
+	GR_COORD y2)
+{
+	nxLineReq *req;
+
+	req = AllocReq(Line);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x1 = x1;
+	req->y1 = y1;
+	req->x2 = x2;
+	req->y2 = y2;
+}
+
+/*
+ * Draw the boundary of a rectangle in the specified drawable using the
+ * specified graphics context.
+ */
+void 
+GrRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height)
+{
+	nxRectReq *req;
+
+	req = AllocReq(Rect);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+}
+
+/*
+ * Fill a rectangle in the specified drawable using the specified
+ * graphics context.
+ */
+void 
+GrFillRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height)
+{
+	nxFillRectReq *req;
+
+	req = AllocReq(FillRect);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+}
+
+/*
+ * Draw the boundary of an ellipse in the specified drawable with
+ * the specified graphics context.
+ */
+void 
+GrEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx,
+	GR_SIZE ry)
+{
+	nxEllipseReq *req;
+
+	req = AllocReq(Ellipse);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+}
+
+/*
+ * Fill an ellipse in the specified drawable using the specified
+ * graphics context.
+ */
+void 
+GrFillEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry)
+{
+	nxFillEllipseReq *req;
+
+	req = AllocReq(FillEllipse);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+}
+
+/*
+ * Draw an arc, pie or ellipse in the specified drawable using
+ * the specified graphics context.  Integer only.
+ */
+void	
+GrArc(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry, GR_COORD ax, GR_COORD ay,
+	GR_COORD bx, GR_COORD by, int type)
+{
+	nxArcReq *req;
+
+	req = AllocReq(Arc);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+	req->ax = ax;
+	req->ay = ay;
+	req->bx = bx;
+	req->by = by;
+	req->type = type;
+}
+
+/*
+ * Draw an arc or pie in the specified drawable using
+ * the specified graphics context.  Requires floating point.
+ */
+void
+GrArcAngle(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry, GR_COORD angle1, GR_COORD angle2, int type)
+{
+	nxArcAngleReq *req;
+
+	req = AllocReq(ArcAngle);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+	req->angle1 = angle1;
+	req->angle2 = angle2;
+	req->type = type;
+}
+
+/*
+ * Draw a rectangular area in the specified drawable using the specified
+ * graphics, as determined by the specified bit map.  This differs from
+ * rectangle drawing in that the rectangle is drawn using the foreground
+ * color and possibly the background color as determined by the bit map.
+ * Each row of bits is aligned to the next bitmap word boundary (so there
+ * is padding at the end of the row).  The background bit values are
+ * only written if the usebackground flag is set in the GC.
+ */
+void 
+GrBitmap(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, GR_BITMAP *bitmaptable)
+{
+	nxBitmapReq *req;
+	long 	     bitmapsize;
+
+	bitmapsize = (long)GR_BITMAP_SIZE(width, height) * sizeof(GR_BITMAP);
+	req = AllocReqExtra(Bitmap, bitmapsize);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	memcpy(GetReqData(req), bitmaptable, bitmapsize);
+}
+
+/* Draw multicolor image from image structure*/
+void 
+GrDrawImageBits(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_IMAGE_HDR *pimage)
+{
+	nxDrawImageBitsReq *req;
+	int		    imagesize;
+	int		    palsize;
+	char *		    addr;
+
+	imagesize = pimage->pitch * pimage->height;
+	palsize = pimage->palsize * sizeof(MWPALENTRY);
+	req = AllocReqExtra(DrawImageBits, imagesize + palsize);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	/* fill MWIMAGEHDR items passed externally*/
+	req->width = pimage->width;
+	req->height = pimage->height;
+	req->planes = pimage->planes;
+	req->bpp = pimage->bpp;
+	req->pitch = pimage->pitch;
+	req->bytesperpixel = pimage->bytesperpixel;
+	req->compression = pimage->compression;
+	req->palsize = pimage->palsize;
+	req->transcolor = pimage->transcolor;
+	addr = GetReqData(req);
+	memcpy(addr, pimage->imagebits, imagesize);
+	memcpy(addr+imagesize, pimage->palette, palsize);
+}
+
+/* Load an image file from disk and display it at the specified coordinates*/
+void
+GrDrawImageFromFile(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, char* path, int flags)
+{
+	nxDrawImageFromFileReq *req;
+
+	req = AllocReqExtra(DrawImageFromFile, strlen(path)+1);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	req->flags = flags;
+	memcpy(GetReqData(req), path, strlen(path)+1);	
+}
+
+/* load image from file and cache it*/
+GR_IMAGE_ID
+GrLoadImageFromFile(char *path, int flags)
+{
+	nxLoadImageFromFileReq *req;
+	GR_IMAGE_ID		imageid;
+
+	req = AllocReqExtra(LoadImageFromFile, strlen(path)+1);
+	req->flags = flags;
+	memcpy(GetReqData(req), path, strlen(path)+1);	
+
+	if(GrTypedReadBlock(&imageid, sizeof(imageid),
+		GrNumLoadImageFromFile) == -1)
+			return 0;
+	return imageid;
+}
+
+/* draw cached image*/
+void
+GrDrawImageToFit(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, GR_IMAGE_ID imageid)
+{
+	nxDrawImageToFitReq *req;
+
+	req = AllocReq(DrawImageToFit);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	req->imageid = imageid;
+}
+
+/* free cached image*/
+void
+GrFreeImage(GR_IMAGE_ID id)
+{
+	nxFreeImageReq *req;
+
+	req = AllocReq(FreeImage);
+	req->id = id;
+}
+
+/* return cached image information*/
+void
+GrGetImageInfo(GR_IMAGE_ID id, GR_IMAGE_INFO *iip)
+{
+	nxGetImageInfoReq *req;
+
+	req = AllocReq(GetImageInfo);
+	req->id = id;
+	GrTypedReadBlock(iip, sizeof(GR_IMAGE_INFO), GrNumGetImageInfo);
+}
+
+/*
+ * Draw a rectangular area in the specified drawable using the specified
+ * graphics context.  This differs from rectangle drawing in that the
+ * color values for each pixel in the rectangle are specified.
+ * The color table is indexed
+ * row by row.  Values whose color matches the background color are only
+ * written if the usebackground flag is set in the GC.
+ *
+ * The pixels are packed according to pixtype:
+ *
+ * pixtype		array of
+ * MWPF_RGB		MWCOLORVAL (unsigned long)
+ * MWPF_PIXELVAL	MWPIXELVAL (compile-time dependent)
+ * MWPF_PALETTE		unsigned char
+ * MWPF_TRUECOLOR0888	unsigned long
+ * MWPF_TRUECOLOR888	packed struct {char r,char g,char b} (24 bits)
+ * MWPF_TRUECOLOR565	unsigned short
+ * MWPF_TRUECOLOR332	unsigned char
+ */
+void 
+GrArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, void *pixels, int pixtype)
+{
+	nxAreaReq *req;
+	long       size;
+	long       chunk_y;
+	int        pixsize;
+
+	/* Calculate size of packed pixels*/
+	switch(pixtype) {
+	case MWPF_RGB:
+		pixsize = sizeof(MWCOLORVAL);
+		break;
+	case MWPF_PIXELVAL:
+		pixsize = sizeof(MWPIXELVAL);
+		break;
+	case MWPF_PALETTE:
+	case MWPF_TRUECOLOR332:
+		pixsize = sizeof(unsigned char);
+		break;
+	case MWPF_TRUECOLOR0888:
+		pixsize = sizeof(unsigned long);
+		break;
+	case MWPF_TRUECOLOR888:
+		pixsize = 3;
+		break;
+	case MWPF_TRUECOLOR565:
+		pixsize = sizeof(unsigned short);
+		break;
+	default:
+		return;
+	}
+
+	/* Break request into MAXREQUESTSZ size packets*/
+	while(height > 0) {
+		chunk_y = (MAXREQUESTSZ - sizeof(nxAreaReq)) /
+			((long)width * pixsize);
+		if(chunk_y > height)
+			chunk_y = height;
+		size = chunk_y * ((long)width * pixsize);
+		req = AllocReqExtra(Area, size);
+		req->drawid = id;
+		req->gcid = gc;
+		req->x = x;
+		req->y = y;
+		req->width = width;
+		req->height = chunk_y;
+		req->pixtype = pixtype;
+		memcpy(GetReqData(req), pixels, size);
+		pixels = (void *)(((char *)pixels) + size);
+		y += chunk_y;
+		height -= chunk_y;
+	}
+}
+
+void
+GrCopyArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, GR_DRAW_ID srcid,
+	GR_COORD srcx, GR_COORD srcy, int op)
+{
+	nxCopyAreaReq *req;
+
+        req = AllocReq(CopyArea);
+        req->drawid = id;
+        req->gcid = gc;
+        req->x = x;
+        req->y = y;
+        req->width = width;
+        req->height = height;
+        req->srcid = srcid;
+        req->srcx = srcx;
+        req->srcy = srcy;
+        req->op = op;
+}
+   
+   
+/*
+ * Read the color values from the specified rectangular area of the
+ * specified drawable into a supplied buffer.  If the drawable is a
+ * window which is obscured by other windows, then the returned values
+ * will include the values from the covering windows.  Regions outside
+ * of the screen boundaries, or unmapped windows will return black.
+ */
+void 
+GrReadArea(GR_DRAW_ID id,GR_COORD x,GR_COORD y,GR_SIZE width,
+	GR_SIZE height, GR_PIXELVAL *pixels)
+{
+	nxReadAreaReq *req;
+	long           size;
+
+	req = AllocReq(ReadArea);
+	req->drawid = id;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	size = (long)width * height * sizeof(MWPIXELVAL);
+	GrTypedReadBlock(pixels, size, GrNumReadArea);
+}
+
+/*
+ * Draw a point in the specified drawable using the specified
+ * graphics context.
+ */
+void 
+GrPoint(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y)
+{
+	nxPointReq *req;
+
+	req = AllocReq(Point);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+
+}
+
+/*
+ * Draw points in the specified drawable using the specified
+ * graphics context.
+ */
+void 
+GrPoints(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable)
+{
+	nxPointsReq *req;
+	long       size;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(Points, size);
+	req->drawid = id;
+	req->gcid = gc;
+	memcpy(GetReqData(req), pointtable, size);
+}
+
+/*
+ * Draw a polygon in the specified drawable using the specified
+ * graphics context.  The polygon is only complete if the first
+ * point is repeated at the end.
+ */
+void 
+GrPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable)
+{
+	nxPolyReq *req;
+	long       size;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(Poly, size);
+	req->drawid = id;
+	req->gcid = gc;
+	memcpy(GetReqData(req), pointtable, size);
+}
+
+/*
+ * Draw a filled polygon in the specified drawable using the specified
+ * graphics context.  The last point may be a duplicate of the first
+ * point, but this is not required.
+ */
+void 
+GrFillPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count,GR_POINT *pointtable)
+{
+	nxFillPolyReq *req;
+	long           size;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(FillPoly, size);
+	req->drawid = id;
+	req->gcid = gc;
+	memcpy(GetReqData(req), pointtable, size);
+}
+
+/*
+ * Draw a text string in the specified drawable using the specified
+ * graphics context.  The background of the characters are only drawn
+ * if the usebackground flag in the GC is set.
+ */
+void 
+GrText(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, void *str,
+	GR_COUNT count, int flags)
+{
+	nxTextReq *req;
+	int	   size;
+
+	if(count == -1 && (flags&MWTF_PACKMASK) == MWTF_ASCII)
+		count = strlen((char *)str);
+
+	size = nxCalcStringBytes(str, count, flags);
+
+	req = AllocReqExtra(Text, size);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->count = count;
+	req->flags = flags;
+	memcpy(GetReqData(req), str, size);
+}
+
+/* Return the system palette entries*/
+void
+GrGetSystemPalette(GR_PALETTE *pal)
+{
+	AllocReq(GetSystemPalette);
+	GrTypedReadBlock(pal, sizeof(*pal), GrNumGetSystemPalette);
+}
+
+/* Set the system palette entries from first for count*/
+void
+GrSetSystemPalette(GR_COUNT first, GR_PALETTE *pal)
+{
+	nxSetSystemPaletteReq *req;
+
+	req = AllocReq(SetSystemPalette);
+	req->first = first;
+	req->count = pal->count;
+	memcpy(req->palette, pal->palette, sizeof(GR_PALENTRY) * pal->count);
+}
+
+/* Convert passed color value to pixel value, depending on system mode*/
+void
+GrFindColor(GR_COLOR c, GR_PIXELVAL *retpixel)
+{
+	nxFindColorReq *req;
+
+	req = AllocReq(FindColor);
+	req->color = c;
+	GrTypedReadBlock(retpixel, sizeof(*retpixel), GrNumFindColor);
+}
+
+void
+GrReqShmCmds(long shmsize)
+{
+#if HAVE_SHAREDMEM_SUPPORT
+	nxReqShmCmdsReq	req;
+	int key, shmid;
+
+	if ( nxSharedMem != 0 )
+		return;
+
+	GrFlush();
+
+	shmsize = (shmsize+SHM_BLOCK_SIZE-1) & ~(SHM_BLOCK_SIZE-1);
+
+	req.reqType = GrNumReqShmCmds;
+	req.hilength = 0;
+	req.length = sizeof(req);
+	req.size = shmsize;
+
+	nxWriteSocket((char *)&req,sizeof(req));
+	GrReadBlock(&key,sizeof(key));
+
+	if ( !key ) {
+		EPRINTF("nxclient: no shared memory support on server\n");
+		return;
+	}
+
+	shmid = shmget(key,shmsize,0);
+	if ( shmid == -1 ) {
+		EPRINTF("nxclient: Can't shmget key %d: %m\n", key);
+		return;
+	}
+
+	nxSharedMem = shmat(shmid,0,0);
+	shmctl(shmid,IPC_RMID,0);	/* Prevent other from attaching */
+	if ( nxSharedMem == (char *)-1 )
+		return;
+
+	nxSharedMemSize = shmsize;
+	nxAssignReqbuffer(nxSharedMem, shmsize);
+#endif /* HAVE_SHAREDMEM_SUPPORT*/
+}
+
+void
+GrInjectPointerEvent(GR_COORD x, GR_COORD y, int button, int visible)
+{
+	nxInjectEventReq *req;
+
+	req = AllocReq(InjectEvent);
+	req->event_type = GR_INJECT_EVENT_POINTER;
+	req->event.pointer.visible = visible;
+	req->event.pointer.x = x;
+	req->event.pointer.y = y;
+	req->event.pointer.button = button;
+
+	GrFlush();
+}
+
+void
+GrInjectKeyboardEvent(GR_WINDOW_ID wid, GR_KEY keyvalue,
+	GR_KEYMOD modifier, GR_SCANCODE scancode, GR_BOOL pressed)
+{
+	nxInjectEventReq *req;
+
+	req = AllocReq(InjectEvent);
+	req->event_type = GR_INJECT_EVENT_KEYBOARD;
+	req->event.keyboard.wid = wid;
+	req->event.keyboard.keyvalue = keyvalue;
+	req->event.keyboard.modifier = modifier;
+	req->event.keyboard.scancode = scancode;
+	req->event.keyboard.pressed = pressed;
+
+	GrFlush();
+}
+
+/*
+ * Send the GR_WM_PROPERTIES structure for the specified window id.
+ */
+void
+GrSetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props)
+{
+	nxSetWMPropertiesReq *req;
+	char 		     *addr;
+	int 		      s;
+
+	if ((props->flags & GR_WM_FLAGS_TITLE) && props->title)
+		s = strlen(props->title) + 1;
+	else s = 0;
+
+	req = AllocReqExtra(SetWMProperties, s + sizeof(GR_WM_PROPERTIES));
+	req->windowid = wid;
+	addr = GetReqData(req);
+	memcpy(addr, props, sizeof(GR_WM_PROPERTIES));
+	if (s)
+		memcpy(addr + sizeof(GR_WM_PROPERTIES), props->title, s);
+}
+
+/*
+ * Read the GR_WM_PROPERTIES structure for the specified window id.
+ * The caller needs to remember to free the returned title before freeing
+ * the structure (we allocate it dynamically because we don't know how
+ * big it is in advance). We set the title to NULL if there isn't one.
+ * The title will also be set to NULL if we can't allocate enough memory
+ * to store it.
+ */
+void
+GrGetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props)
+{
+	nxGetWMPropertiesReq *req;
+	UINT16 		      textlen;
+	GR_CHAR 	      c;
+
+	req = AllocReq(GetWMProperties);
+	req->windowid = wid;
+
+	GrTypedReadBlock(props, sizeof(GR_WM_PROPERTIES), GrNumGetWMProperties);
+	GrReadBlock(&textlen, sizeof(textlen));
+	if(!textlen) {
+		props->title = NULL;
+		return;
+	}
+	if(!(props->title = malloc(textlen))) {
+		/* Oh dear, we're out of memory but still have to purge the
+		   requested data (and throw it away) */
+		while(textlen--)
+			GrReadBlock(&c, 1);
+	} else {
+		GrReadBlock(props->title, textlen);
+	}
+}
+
+/*
+ * Send a CLOSE_REQ event to the specified window (assuming they've selected
+ * for it). This is used to politely ask an application to shut down when the
+ * user clicks the window close button.
+ */
+void 
+GrCloseWindow(GR_WINDOW_ID wid)
+{
+	nxCloseWindowReq *req;
+
+	req = AllocReq(CloseWindow);
+	req->windowid = wid;
+}
+
+/*
+ * Forcibly disconnect the client which owns this window. Used to kill an
+ * application which has locked up and is not responding to CLOSE_REQ events.
+ */
+void 
+GrKillWindow(GR_WINDOW_ID wid)
+{
+	nxKillWindowReq *req;
+
+	req = AllocReq(KillWindow);
+	req->windowid = wid;
+}
diff -urN lib/microwindows/src/nanox/client.2 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/client.2
--- lib/microwindows/src/nanox/client.2	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/client.2	2005-02-21 16:13:33.000000000 +0100
@@ -0,0 +1,2178 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1999, 2000 Alex Holden <alex@linuxhacker.org>
+ * Copyright (c) 1991 David I. Bell
+ * Copyright (c) 2000 Vidar Hokstad
+ * Copyright (c) 2000 Morten Rolland <mortenro@screenmedia.no>
+ *
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Client routines to do graphics with windows and graphics contexts.
+ *
+ * Rewritten heavily for speed by Greg Haerr
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <stddef.h>
+#include <errno.h>
+#include <time.h>
+#if HAVE_SHAREDMEM_SUPPORT
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#endif
+#include <sys/time.h>
+#include <sys/socket.h>
+#if ELKS
+#include <linuxmt/na.h>
+#include <linuxmt/time.h>
+#else
+#include <sys/un.h>
+#if hpux
+#include <sys/time.h>
+#else
+#include <sys/select.h>
+#endif
+#endif
+#include <signal.h> 
+#include "nano-X.h"
+#include "serv.h"
+#include "nxproto.h"
+
+#define GR_CLOSE_FIX	1	/* dirty hack attempts to fix GrClose hang bug*/
+
+#define SHM_BLOCK_SIZE	4096
+
+/* exported global data*/
+int 	   nxSocket = -1;	/* The network socket descriptor */
+#if HAVE_SHAREDMEM_SUPPORT
+char *	   nxSharedMem = 0;	/* Address of shared memory segment*/
+static int nxSharedMemSize;	/* Size in bytes of shared mem segment*/
+#endif
+
+/* readable error strings*/
+char *nxErrorStrings[] = {
+	GR_ERROR_STRINGS
+};
+
+//static int storedevent = 0;
+//static GR_EVENT storedevent_data;
+
+/*
+ * Client side event queue
+ */
+typedef struct event_list EVENT_LIST;
+struct event_list {
+	EVENT_LIST *	next;
+	GR_EVENT	event;
+};
+static EVENT_LIST *	evlist;
+
+/*
+ * The following is the user defined function for handling errors.
+ * If this is not set, then the default action is to close the connection
+ * to the server, describe the error, and then exit.  This error function
+ * will only be called when the client asks for events.
+ */
+static GR_FNCALLBACKEVENT ErrorFunc = GrDefaultErrorHandler;
+
+/* 
+ * The default error handler which is called when the server
+ * reports an error event and the client hasn't set a handler for error events.
+ */
+void 
+GrDefaultErrorHandler(GR_EVENT *ep)
+{
+	if (ep->type == GR_EVENT_TYPE_ERROR) {
+		EPRINTF("nxclient %d: Error (%s) ", getpid(), ep->error.name);
+		EPRINTF(nxErrorStrings[ep->error.code], ep->error.id);
+		GrClose();
+		exit(1);
+	}
+}
+
+/*
+ * Set an error handling routine, which will be called on any errors from
+ * the server (when events are asked for by the client).  If zero is given,
+ * then errors will be returned as regular events.  
+ * Returns the previous error handler.
+ */
+GR_FNCALLBACKEVENT
+GrSetErrorHandler(GR_FNCALLBACKEVENT fncb)
+{
+	GR_FNCALLBACKEVENT orig = ErrorFunc;
+
+	ErrorFunc = fncb;
+	return orig;
+}
+
+/*
+ * Queue an event in FIFO for later retrieval.
+ */
+static void
+QueueEvent(GR_EVENT *ep)
+{
+	EVENT_LIST *	elp;
+	EVENT_LIST *	prevelp;
+
+	elp = malloc(sizeof(EVENT_LIST));
+	if (elp) {
+		elp->event = *ep;
+		elp->next = NULL;
+
+		/* add as last entry on list*/
+		if (!evlist) {
+			evlist = elp;
+			return;
+		}
+		prevelp = evlist;
+		while (prevelp->next)
+			prevelp = prevelp->next;
+		prevelp->next = elp;
+	}
+}
+
+/*
+ * Retrieve first event in FIFO event queue.
+ */
+static void
+GetNextQueuedEvent(GR_EVENT *ep)
+{
+	*ep = evlist->event;
+	evlist = evlist->next;
+}
+
+/*
+ * Check if the passed event is an error event, and call
+ * error handler if registered.  Error event is then converted
+ * to a null event in case it's later processed by the main loop.
+ * This solution is simpler than creating a client-side event queue.
+ */
+static void
+CheckErrorEvent(GR_EVENT *ep)
+{
+	if (ep->type == GR_EVENT_TYPE_ERROR) {
+		if (ErrorFunc) {
+			/* call error handler*/
+			ErrorFunc(ep);
+
+			/* then convert to null event*/
+			ep->type = GR_EVENT_TYPE_NONE;
+		}
+	}
+}
+
+/*
+ * Read n bytes of data from the server into block *b.  Make sure the data
+ * you are about to read are actually of the correct type - e.g. make a
+ * check for the first block of data you read as a response to a command
+ * with the Typed version of this function. Returns 0 on success or -1 on
+ * failure.
+ */
+static int GrReadBlock(void *b, int n)
+{
+	int i = 0;
+	char *v;
+
+	v = (char *) b;
+
+	nxFlushReq(0L,0);
+	while(v < ((char *) b + n)) {
+		i = read(nxSocket, v, ((char *) b + n - v));
+		if ( i <= 0 ) {
+			if ( i == 0 ) {
+				/* We should maybe produce an event here,
+				 * if possible.
+				 */
+				EPRINTF("nxclient: lost connection to Nano-X server\n");
+				exit(1);
+			}
+			if ( errno == EINTR || errno == EAGAIN )
+				continue;
+
+			EPRINTF("nxclient: bad readblock %d\n", i);
+			return -1;
+		}
+		v += i;
+	}
+
+	return 0;
+}
+
+/*
+ * Read a byte of data from the server.
+ */
+static int GrReadByte()
+{
+	unsigned char c;
+
+	if(GrReadBlock(&c, 1) == -1)
+		return -1;
+	else return (int) c;
+}
+
+
+/* Check if the data we are about to read are of the correct type.  This
+ * must be done in order to avoid reading an event as part of the response
+ * from the server to a command that requires a reply.
+ */
+
+static int GrCheckBlockType(short packettype)
+{
+	short		b;
+	GR_EVENT	event;
+
+	while (GrReadBlock(&b,sizeof(b)) != -1) {
+		if (b == packettype)
+			return b;
+
+		if (b == GrNumGetNextEvent) {
+			/*EPRINTF("nxclient %d: Storing event (expected %d)\n",
+				getpid(), packettype);*/
+
+#if 0
+			/* We only need to handle one event, since the next
+			 * event won't arrive until the next GrPrepareSelect()
+			 * has been called, and by then we have already
+			 * handled this event in GrServiceSelect(). If
+			 * GrPrepareSelect() is never called, then we should
+			 * never get here either, so that is cool too.
+			 */
+			GrReadBlock(&storedevent_data,
+				    sizeof(storedevent_data));
+			storedevent = 1;
+#endif
+			/* read event and queue it for later processing*/
+			GrReadBlock(&event, sizeof(event));
+			QueueEvent(&event);
+		} else {
+			EPRINTF("nxclient %d: Wrong packet type %d "
+				"(expected %d)\n", getpid(),b, packettype);
+		}
+	}
+	EPRINTF("nxclient %d: Corrupted packet\n", getpid());
+	return -1;
+}
+
+/* Actually read a response from the server, much like the GrReadBlock but
+ * make sure the response is of the right kind, e.g. store the event that
+ * may have sneaked into the stream.
+ */
+
+static int GrTypedReadBlock(void *b, int n, int type)
+{
+	int r;
+   
+	r = GrCheckBlockType(type);
+	if (r != type)
+		return -1;
+	return GrReadBlock(b,n);
+}
+
+#if 0000
+/*
+ * Read an error event structure from the server and deliver it to the client.
+ */
+static int GrDeliverErrorEvent(void)
+{
+	GR_EVENT_ERROR err;
+
+	if(GrReadBlock(&err, sizeof(err)) == -1)
+		return -1;
+
+	GrErrorFunc(err);
+
+	return 0;
+}
+
+/*
+ * Send a block of data to the server and read it's reply.
+ */
+static int GrSendBlock(void *b, long n)
+{
+	int i = 0;
+	unsigned char *c;
+
+	c = (unsigned char *) b;
+
+	/* FIXME: n > 64k will fail here if sizeof(int) == 2*/
+	while(c < ((unsigned char *) b + n)) {
+		i = write(nxSocket, c, ((unsigned char *) b + n - c));
+		if(i <= 0)
+			return -1;
+		c += i;
+	}
+
+#if 0
+	do {
+		int	z;
+
+		if((i = GrReadByte()) < 0) return -1;
+		else if(i == GrRetESig) {
+			z = GrReadByte();
+			if(z == -1) return -1;
+EPRINTF("nxclient: bad GrSendBlock\r\n");
+			raise(z);
+		}
+		else if(i == GrRetErrorPending) {
+			if(GrDeliverErrorEvent() == -1) return -1;
+		} else if (i == GrEventFollows) {
+		   
+		}
+
+	} while((i == GrRetESig) | (i == GrRetErrorPending));
+	return((int) i);
+#endif
+	return 0;
+}
+
+/*
+ * Send a single byte to the server and read the reply.
+ */
+static int GrSendByte(unsigned char c)
+{
+	return GrSendBlock(&c, 1);
+}
+#endif
+
+/*
+ * Flush the message buffer of any messages it may contain.
+ */
+void 
+GrFlush(void)
+{
+	nxFlushReq(0L,1);
+}
+
+/*
+ * Open a connection to the graphics server.
+ * Returns the fd of the connection to the server if successful,
+ * or -1 on failure.
+ */
+int 
+GrOpen(void)
+{
+	size_t 		size;
+	nxOpenReq	req;
+	int		tries;
+	int		ret = 0;
+#if ELKS
+	struct sockaddr_na name;
+#else
+	struct sockaddr_un name;
+#endif
+	
+	if(nxSocket == -1)
+#if ELKS
+		if((nxSocket = socket(AF_NANO, SOCK_STREAM, 0)) == -1) {
+#else
+		if((nxSocket = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
+#endif
+			nxSocket = -1;
+			return -1;
+		}
+
+#if ELKS
+	name.sun_family = AF_NANO;
+	name.sun_no = GR_NUMB_SOCKET;
+	size = sizeof(struct sockaddr_na);
+#else
+	name.sun_family = AF_UNIX;
+	strcpy(name.sun_path, GR_NAMED_SOCKET);
+	size = (offsetof(struct sockaddr_un, sun_path) +
+		strlen(name.sun_path) + 1);
+#endif
+	/*
+	 * Try to open the connection for up to a second,
+	 * waiting 1/10 second between attempts.
+	 */
+	for (tries=1; tries<=10; ++tries) {
+		struct timespec req;
+
+		ret = connect(nxSocket, (struct sockaddr *) &name, size);
+		if (ret >= 0)
+			break;
+		req.tv_sec = 0;
+		req.tv_nsec = 100000000L;
+		nanosleep(&req, NULL);
+		EPRINTF("nxclient: retry connect attempt %d\n", tries);
+	}
+	if (ret == -1) {
+		close(nxSocket);
+		nxSocket = -1;
+		return -1;
+	}
+
+	/* By Performing the 'GrOpen' without allocating a buffer, just
+	 * shuffeling the struct over the wire, we can postpone the
+	 * allocation of the client size command buffer, which will never be
+	 * allocated if the first command after GrOpen() is
+	 * GrReqShmCmds() which allocates a replacement shared memory
+	 * segment.
+	 * So: Calling GrReqShmCmds() right after GrOpen will prevent the
+	 * traditional command queue buffer from being allocated from
+	 * the process heap - and only the shared memory segment is
+	 * allocated.
+	 */
+	req.reqType = GrNumOpen;
+	req.hilength = 0;
+	req.length = sizeof(req);
+
+	nxWriteSocket((char *)&req,sizeof(req));
+	return nxSocket;
+}
+
+/*
+ * Close the graphics device, flushing any waiting messages.
+ * Vladimir Cotfas: 
+ *  - hang in GrFlush() --> nxFlushReq(0L,1);
+ *
+ */
+#if GR_CLOSE_FIX
+static void
+mySignalhandler(int sig)
+{
+	if (sig == SIGALRM) {
+	    printf("Oops! nxFlushReq() timed out, cowardly chickening out!\n");
+	    exit(127);
+	}
+}
+#endif
+
+void 
+GrClose(void)
+{
+#if GR_CLOSE_FIX
+	/* allow 1 second to flush*/
+	void * oldSignalHandler = signal(SIGALRM, mySignalhandler);
+	alarm(1);
+#endif
+	AllocReq(Close);
+	GrFlush();
+#if GR_CLOSE_FIX
+	alarm(0); 
+	signal(SIGALRM, oldSignalHandler);
+#endif
+	close(nxSocket);
+}
+
+/*
+ * Return useful information about the screen.
+ * Returns -1 on failure or 0 on success.
+ */
+void 
+GrGetScreenInfo(GR_SCREEN_INFO *sip)
+{
+	AllocReq(GetScreenInfo);
+	GrTypedReadBlock(sip, sizeof(GR_SCREEN_INFO),GrNumGetScreenInfo);
+}
+
+/* Return system-defined color*/
+GR_COLOR
+GrGetSysColor(int index)
+{
+	nxGetSysColorReq *req;
+	GR_COLOR color;
+
+	req = AllocReq(GetSysColor);
+	req->index = index;
+	if(GrTypedReadBlock(&color, sizeof(color),GrNumGetSysColor) == -1)
+		return 0;
+	return color;
+}
+
+/*
+ * Return useful information about the specified font.
+ */
+void 
+GrGetFontInfo(GR_FONT_ID fontno, GR_FONT_INFO *fip)
+{
+	nxGetFontInfoReq *req;
+
+	req = AllocReq(GetFontInfo);
+	req->fontid = fontno;
+	GrTypedReadBlock(fip, sizeof(GR_FONT_INFO),GrNumGetFontInfo);
+}
+
+/*
+ * Return information about the specified graphics context.
+ */
+void GrGetGCInfo(GR_GC_ID gc, GR_GC_INFO *gcip)
+{
+	nxGetGCInfoReq *req;
+
+	req = AllocReq(GetGCInfo);
+	req->gcid = gc;
+	GrTypedReadBlock(gcip, sizeof(GR_GC_INFO),GrNumGetGCInfo);
+}
+
+/*
+ * Return the size of a text string for the font in a graphics context.
+ * This is the width of the string, the height of the string,
+ * and the height above the bottom of the font of the baseline for the font.
+ */
+void GrGetGCTextSize(GR_GC_ID gc, void *str, int count, int flags,
+	GR_SIZE *retwidth, GR_SIZE *retheight, GR_SIZE *retbase)
+{
+	nxGetGCTextSizeReq *req;
+	int		    size;
+
+	if(count == -1 && (flags&MWTF_PACKMASK) == MWTF_ASCII)
+		count = strlen((char *)str);
+
+	size = nxCalcStringBytes(str, count, flags);
+
+	req = AllocReqExtra(GetGCTextSize, size);
+	req->gcid = gc;
+	req->flags = flags;
+	memcpy(GetReqData(req), str, size);
+	GrTypedReadBlock(retwidth, sizeof(*retwidth),GrNumGetGCTextSize);
+	GrReadBlock(retheight, sizeof(*retheight));
+	GrReadBlock(retbase, sizeof(*retbase));
+}
+
+/*
+ * Register the specified file descriptor to return an event
+ * when input is ready.
+ * FIXME: only one external file descriptor works
+ */
+static int regfd = -1;
+
+void 
+GrRegisterInput(int fd)
+{
+	regfd = fd;
+}
+
+/* Passive library entry points*/
+
+/* The GrPrepareSelect function serves two purposes:  It puts the server into
+ * a mode where it will send the first event that arrives for this connection
+ * directly to the client.  It also initializes a fd_set so that a 'select'
+ * system call will wake up when this first event arrives.
+ *
+ * The 'maxfd' is used to find the value of the biggest filedescriptor in
+ * use - it will be updated if Nano-X uses a filedescriptor with a larger
+ * value.
+ */
+void
+GrPrepareSelect(int *maxfd,void *rfdset)
+{
+	fd_set *rfds = rfdset;
+
+	AllocReq(GetNextEvent);
+	GrFlush();
+
+	FD_SET(nxSocket, rfds);
+	if(nxSocket > *maxfd)
+		*maxfd = nxSocket;
+	if(regfd != -1) {
+		FD_SET(regfd, rfds);
+		if(regfd > *maxfd)
+			*maxfd = regfd;
+	}
+}
+
+void
+GrServiceSelect(void *rfdset, GR_FNCALLBACKEVENT fncb)
+{
+	fd_set *	rfds = rfdset;
+	GR_EVENT 	ev;
+
+        /* Clean out any event that might have arrived while waiting
+	 * for other data, for instance by doing Nano-X requests
+	 * between GrPrepareSelect() and GrServiceSelect(), or when
+	 * an event is generated in Nano-X at the same time as the
+	 * client wakes up for some reason and calls Nano-X functions.
+	 */
+#if 0
+	if (storedevent) {
+		/*DPRINTF("nxclient: Handling stored event\n");*/
+		CheckErrorEvent(&storedevent_data);
+		fncb(&storedevent_data);
+		storedevent = 0;
+	}
+#endif
+	if (evlist) {
+		/*DPRINTF("nxclient: Handling queued event\n");*/
+		GetNextQueuedEvent(&ev);
+		CheckErrorEvent(&ev);
+		fncb(&ev);
+	}
+	else {
+		if(FD_ISSET(nxSocket, rfds)) {
+			GrTypedReadBlock(&ev, sizeof(ev),GrNumGetNextEvent);
+			CheckErrorEvent(&ev);
+			fncb(&ev);
+		}
+	}
+
+#if 0 
+	/* Morten - remove this if you want*/
+	while ( GrPeekEvent(&ev) )
+		CheckErrorEvent(&ev);
+		fncb(&ev);
+#endif
+
+	if(regfd != -1 && FD_ISSET(regfd, rfds)) {
+		ev.type = GR_EVENT_TYPE_FDINPUT;
+		ev.fdinput.fd = regfd;
+		fncb(&ev);
+	}
+}
+
+void
+GrMainLoop(GR_FNCALLBACKEVENT fncb)
+{
+	fd_set	rfds;
+	int	setsize = 0;
+
+	for(;;) {
+		FD_ZERO(&rfds);
+		GrPrepareSelect(&setsize, &rfds);
+		if(select(setsize+1, &rfds, NULL, NULL, NULL) > 0)
+			GrServiceSelect(&rfds, fncb);
+	}
+}
+
+/*
+ * Return the next event from the event queue.
+ * This waits for a new one if one is not ready.
+ */
+void 
+GrGetNextEvent(GR_EVENT *ep)
+{
+	GrGetNextEventTimeout(ep, 0L);
+}
+
+/*
+ * Return the next event from the event queue, or
+ * wait for a new one if one is not ready.  If timeout
+ * is nonzero, return timeout event if time elapsed.
+ */
+void
+GrGetNextEventTimeout(GR_EVENT *ep, GR_TIMEOUT timeout)
+{
+	fd_set 		rfds;
+	int		setsize = 0;
+	int		e;
+	struct timeval 	to;
+
+#if 0
+	if (storedevent) {
+		/*DPRINTF("nxclient %d: Returning stored event\n",getpid());*/
+		memcpy(ep,&storedevent_data,sizeof(*ep));
+		storedevent = 0;
+		CheckErrorEvent(ep);
+		return;
+	}
+#endif
+	if (evlist) {
+		/*DPRINTF("nxclient %d: Returning queued event\n",getpid());*/
+		GetNextQueuedEvent(ep);
+		CheckErrorEvent(ep);
+		return;
+	}
+
+	FD_ZERO(&rfds);
+	/*
+	 * This will cause a GrGetNextEvent to be sent down the wire.
+	 * If we timeout before the server responds, and then
+	 * call this procedure again, and the server has more than
+	 * one event waiting for this process, then more than one
+	 * event will be written on the socket by the server.  At
+	 * that point, a single stored event won't work, and the
+	 * client needs an event queue.
+	 */
+	GrPrepareSelect(&setsize, &rfds);
+	if (timeout) {
+		to.tv_sec = timeout / 1000;
+		to.tv_usec = (timeout % 1000) * 1000;
+	}
+
+	if ((e = select(setsize+1, &rfds, NULL, NULL, timeout? &to: NULL)) > 0){
+		if(FD_ISSET(nxSocket, &rfds)) {
+			/* this will never be GR_EVENT_NONE
+			 * with current implementation
+			 */
+		        GrTypedReadBlock(ep, sizeof(*ep),GrNumGetNextEvent);
+			CheckErrorEvent(ep);
+			return;
+		}
+		if(regfd != -1 && FD_ISSET(regfd, &rfds)) {
+			ep->type = GR_EVENT_TYPE_FDINPUT;
+			ep->fdinput.fd = regfd;
+			return;
+		}
+	}
+	else if (e == 0) {
+		/* 
+		 * Timeout has occured.  Currently return
+		 * a timeout event regardless of whether
+		 * client has selected for it.
+		 */
+		ep->type = GR_EVENT_TYPE_TIMEOUT;
+	} else {
+		if(errno == EINTR) {
+			ep->type = GR_EVENT_TYPE_NONE;
+		} else {
+			EPRINTF("nxclient: select failed\n");
+			GrClose();
+			exit(1);
+		}
+	}
+}
+
+/*
+ * Return the next event from the event queue if one is ready.
+ * If one is not ready, then the type GR_EVENT_TYPE_NONE is returned.
+ * If it is an error event, then a user-specified routine is called
+ * if it was defined, otherwise we clean up and exit.
+ */
+void 
+GrCheckNextEvent(GR_EVENT *ep)
+{
+	AllocReq(CheckNextEvent);
+	GrTypedReadBlock(ep, sizeof(*ep),GrNumGetNextEvent);
+	CheckErrorEvent(ep);
+}
+
+/*
+ * Return the next event from the event queue if available.
+ * If there is no event, then a null event type is returned.
+ */
+int 
+GrPeekEvent(GR_EVENT *ep)
+{
+	int	ret;
+
+#if 0
+	if (storedevent) {
+		*ep = storedevent_data;
+		storedevent = 0;
+		return 1;
+	}
+#endif
+	if (evlist) {
+		GetNextQueuedEvent(ep);
+		CheckErrorEvent(ep);
+		return 1;
+	}
+
+	AllocReq(PeekEvent);
+	GrTypedReadBlock(ep, sizeof(*ep),GrNumPeekEvent);
+	ret = GrReadByte();
+	CheckErrorEvent(ep);
+	return ret;
+}
+
+/*
+ * Select events for a window for this client.
+ * The events are a bitmask for the events desired.
+ * Error events are always returned/handled regardless of mask.
+ */
+void 
+GrSelectEvents(GR_WINDOW_ID wid, GR_EVENT_MASK eventmask)
+{
+	
+	nxSelectEventsReq *req;
+
+	req = AllocReq(SelectEvents);
+	req->windowid = wid;
+	req->eventmask = eventmask;
+}
+
+/*
+ * Allocate a new window which is a child of the specified window.
+ * The window inherits the cursor of the parent window.
+ */
+GR_WINDOW_ID
+GrNewWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, GR_SIZE bordersize, GR_COLOR background,
+	GR_COLOR bordercolor)
+{
+	nxNewWindowReq *req;
+	GR_WINDOW_ID 	wid;
+
+	req = AllocReq(NewWindow);
+	req->parentid = parent;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	req->backgroundcolor = background;
+	req->bordercolor = bordercolor;
+	req->bordersize = bordersize;
+	if(GrTypedReadBlock(&wid, sizeof(wid),GrNumNewWindow) == -1)
+		return 0;
+	return wid;
+}
+   
+   
+/*
+ * Allocate a new pixmap
+ * FIXME: Add support for shared memory...
+ */
+GR_WINDOW_ID
+GrNewPixmap(GR_SIZE width, GR_SIZE height, void *addr)
+{
+	nxNewPixmapReq *req;
+	GR_WINDOW_ID 	wid;
+
+	req = AllocReq(NewPixmap);
+	req->width = width;
+	req->height = height;
+	if(GrTypedReadBlock(&wid, sizeof(wid), GrNumNewPixmap) == -1)
+		return 0;
+	return wid;
+}
+
+/*
+ * Allocate a new input-only window which is a child of the specified window.
+ * The window inherits the cursor of the parent window.
+ */
+GR_WINDOW_ID
+GrNewInputWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height)
+{
+	nxNewInputWindowReq *req;
+	GR_WINDOW_ID 	     wid;
+
+	req = AllocReq(NewInputWindow);
+	req->parentid = parent;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	if(GrTypedReadBlock(&wid, sizeof(wid), GrNumNewInputWindow) == -1)
+		return 0;
+	return wid;
+}
+
+/*
+ * Destroy an existing window.
+ */
+void 
+GrDestroyWindow(GR_WINDOW_ID wid)
+{
+	nxDestroyWindowReq *req;
+
+	req = AllocReq(DestroyWindow);
+	req->windowid = wid;
+}
+
+/*
+ * Return information about a window id.
+ */
+void 
+GrGetWindowInfo(GR_WINDOW_ID wid, GR_WINDOW_INFO *infoptr)
+{
+	nxGetWindowInfoReq *req;
+
+	req = AllocReq(GetWindowInfo);
+	req->windowid = wid;
+	GrTypedReadBlock(infoptr, sizeof(GR_WINDOW_INFO), GrNumGetWindowInfo);
+}
+
+/*
+ * Allocate a new GC with default parameters.
+ */
+GR_GC_ID 
+GrNewGC(void)
+{
+	GR_GC_ID    gc;
+
+	AllocReq(NewGC);
+	if(GrTypedReadBlock(&gc, sizeof(gc),GrNumNewGC) == -1)
+		return 0;
+	return gc;
+}
+
+/*
+ * Allocate a new GC which is a copy of another one.
+ */
+GR_GC_ID 
+GrCopyGC(GR_GC_ID gc)
+{
+	nxCopyGCReq *req;
+	GR_GC_ID     newgc;
+
+	req = AllocReq(CopyGC);
+	req->gcid = gc;
+	if(GrTypedReadBlock(&newgc, sizeof(newgc),GrNumCopyGC) == -1)
+		return 0;
+	return newgc;
+}
+
+/*
+ * Destroy an existing graphics context.
+ */
+void
+GrDestroyGC(GR_GC_ID gc)
+{
+	nxDestroyGCReq *req;
+
+	req = AllocReq(DestroyGC);
+	req->gcid = gc;
+}
+
+/*
+ * Allocate a new region.
+ */
+GR_REGION_ID 
+GrNewRegion(void)
+{
+	GR_REGION_ID    region;
+
+	AllocReq(NewRegion);
+	if(GrTypedReadBlock(&region, sizeof(region),GrNumNewRegion) == -1)
+		return 0;
+	return region;
+}
+
+/*
+ * Destroy an existing region.
+ */
+void
+GrDestroyRegion(GR_REGION_ID region)
+{
+	nxDestroyRegionReq *req;
+
+	req = AllocReq(DestroyRegion);
+	req->regionid = region;
+}
+
+/*
+ * Updates the region from a union of the specified rectangle
+ * and the original region.
+ */
+void
+GrUnionRectWithRegion(GR_REGION_ID region, GR_RECT *rect)
+{
+	nxUnionRectWithRegionReq *req;
+
+ 	req = AllocReq(UnionRectWithRegion);
+ 	if(rect)
+ 		memcpy(&req->rect, rect, sizeof(*rect));
+ 	req->regionid = region;
+}
+
+/*
+ * Updates the region from a union of two regions.
+ */
+void
+GrUnionRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxUnionRegionReq *req;
+
+ 	req = AllocReq(UnionRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/*
+ * Updates the region by subtracting a region from another.
+ */
+void
+GrSubtractRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxSubtractRegionReq *req;
+
+ 	req = AllocReq(SubtractRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/*
+ * Updates the region to the difference of two regions.
+ */
+void
+GrXorRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxXorRegionReq *req;
+
+ 	req = AllocReq(XorRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/*
+ * Updates the region from a intersection of two regions.
+ */
+void
+GrIntersectRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxIntersectRegionReq *req;
+
+ 	req = AllocReq(IntersectRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/*
+ * Sets the clip-mask in the GC to the specified region.
+ */
+void
+GrSetGCRegion(GR_GC_ID gc, GR_REGION_ID region)
+{
+	nxSetGCRegionReq *req;
+	
+	req = AllocReq(SetGCRegion);
+	req->gcid = gc;
+	req->regionid = region;
+}
+
+/*
+ * Determines whether a specified point resides in a region.
+ */
+GR_BOOL
+GrPointInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y)
+{
+	nxPointInRegionReq *req;
+	GR_BOOL             ret_value;
+
+	req = AllocReq(PointInRegion);
+	req->regionid = region;
+	req->x = x;
+	req->y = y;
+	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumPointInRegion) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/*
+ * Determines whether a specified rectangle at least partly resides
+ * in a region.
+ */
+int
+GrRectInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y, GR_COORD w,
+	GR_COORD h)
+{
+	nxRectInRegionReq *req;
+	unsigned short	   ret_value;
+	
+	req = AllocReq(RectInRegion);
+	req->regionid = region;
+	req->x = x;
+	req->y = y;
+	req->w = w;
+	req->h = h;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumRectInRegion) == -1)
+		return 0;
+	return (int)ret_value;
+}
+
+/*
+ * Return GR_TRUE if a region is empty.
+ */ 
+GR_BOOL
+GrEmptyRegion(GR_REGION_ID region)
+{
+	nxEmptyRegionReq *req;
+	GR_BOOL 	  ret_value;
+	
+	req = AllocReq(EmptyRegion);
+	req->regionid = region;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumEmptyRegion) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/*
+ * Return GR_TRUE if two regions are identical.
+ */ 
+GR_BOOL
+GrEqualRegion(GR_REGION_ID rgn1, GR_REGION_ID rgn2)
+{
+	nxEqualRegionReq *req;
+	GR_BOOL 	  ret_value;
+	
+	req = AllocReq(EqualRegion);
+	req->region1 = rgn1;
+	req->region2 = rgn2;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumEqualRegion) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/*
+ * Offset a region by dx, dy.
+ */ 
+void
+GrOffsetRegion(GR_REGION_ID region, GR_SIZE dx, GR_SIZE dy)
+{
+	nxOffsetRegionReq *req;
+	
+	req = AllocReq(OffsetRegion);
+	req->region = region;
+	req->dx = dx;
+	req->dy = dy;
+}
+
+/*
+ * Return the bounding box for the specified region.
+ */
+int
+GrGetRegionBox(GR_REGION_ID region, GR_RECT *rect)
+{
+	nxGetRegionBoxReq *req;
+	unsigned short	   ret_value;
+	
+	if (!rect)
+		return GR_FALSE;
+	req = AllocReq(GetRegionBox);
+	req->regionid = region;
+ 	if(GrTypedReadBlock(rect, sizeof(*rect), GrNumGetRegionBox) == -1)
+		return GR_FALSE;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumGetRegionBox) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/*
+ * Allocate a new region from a set of points interpreted as a polygon.
+ */
+GR_REGION_ID 
+GrNewPolygonRegion(int mode, GR_COUNT count, GR_POINT *points)
+{
+	nxNewPolygonRegionReq	*req;
+	long			size;
+	GR_REGION_ID		region;
+
+	if(count == 0)
+		return GrNewRegion();
+	
+	if(points == NULL)
+		return 0;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(NewPolygonRegion, size);
+	req->mode = mode;
+	/* FIXME: unportable method, depends on sizeof(int) in GR_POINT*/
+	memcpy(GetReqData(req), points, size);
+
+	if(GrTypedReadBlock(&region, sizeof(region),
+		GrNumNewPolygonRegion) == -1)
+		return 0;
+	return region;
+}
+
+/*
+ * Map the window to make it (and possibly its children) visible on the screen.
+ * This paints the border and background of the window, and creates an
+ * exposure event to tell the client to draw into it.
+ */
+void 
+GrMapWindow(GR_WINDOW_ID wid)
+{
+	nxMapWindowReq *req;
+
+	req = AllocReq(MapWindow);
+	req->windowid = wid;
+}
+
+/*
+ * Unmap the window to make it and its children invisible on the screen.
+ */
+void 
+GrUnmapWindow(GR_WINDOW_ID wid)
+{
+	nxUnmapWindowReq *req;
+
+	req = AllocReq(UnmapWindow);
+	req->windowid = wid;
+}
+
+/*
+ * Raise the window to the highest level among its siblings.
+ */
+void 
+GrRaiseWindow(GR_WINDOW_ID wid)
+{
+	nxRaiseWindowReq *req;
+
+	req = AllocReq(RaiseWindow);
+	req->windowid = wid;
+}
+
+/*
+ * Lower the window to the lowest level among its siblings.
+ */
+void 
+GrLowerWindow(GR_WINDOW_ID wid)
+{
+	nxLowerWindowReq *req;
+
+	req = AllocReq(LowerWindow);
+	req->windowid = wid;
+}
+
+/*
+ * Move the window to the specified position relative to its parent.
+ */
+void 
+GrMoveWindow(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y)
+{
+	nxMoveWindowReq *req;
+
+	req = AllocReq(MoveWindow);
+	req->windowid = wid;
+	req->x = x;
+	req->y = y;
+}
+
+/*
+ * Resize the window to be the specified size.
+ */
+void 
+GrResizeWindow(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height)
+{
+	nxResizeWindowReq *req;
+
+	req = AllocReq(ResizeWindow);
+	req->windowid = wid;
+	req->width = width;
+	req->height = height;
+}
+
+/*
+ * Reparent window to new parent, position at passed x, y
+ */
+void 
+GrReparentWindow(GR_WINDOW_ID wid, GR_WINDOW_ID pwid, GR_COORD x, GR_COORD y)
+{
+	nxReparentWindowReq *req;
+
+	req = AllocReq(ReparentWindow);
+	req->windowid = wid;
+	req->parentid = pwid;
+	req->x = x;
+	req->y = y;
+}
+
+/*
+ * Clear the specified window by setting it to its background color.
+ * If the exposeflag is nonzero, then this also creates an exposure
+ * event for the window.
+ */
+void 
+GrClearWindow(GR_WINDOW_ID wid, GR_BOOL exposeflag)
+{
+	nxClearWindowReq *req;
+
+	req = AllocReq(ClearWindow);
+	req->windowid = wid;
+	req->exposeflag = exposeflag;
+}
+
+/* Return window with keyboard focus.*/
+GR_WINDOW_ID
+GrGetFocus(void)
+{
+	GR_WINDOW_ID	wid;
+
+	AllocReq(GetFocus);
+	if(GrTypedReadBlock(&wid, sizeof(wid), GrNumGetFocus) == -1)
+		return 0;
+	return wid;
+}
+
+/*
+ * Set the focus to a particular window.
+ * This makes keyboard events only visible to that window or children of it,
+ * depending on the pointer location.
+ */
+void 
+GrSetFocus(GR_WINDOW_ID wid)
+{
+	nxSetFocusReq *req;
+
+	req = AllocReq(SetFocus);
+	req->windowid = wid;
+}
+
+/*
+ * Set the border of a window to the specified color.
+ */
+void 
+GrSetBorderColor(GR_WINDOW_ID wid, GR_COLOR colour)
+{
+	nxSetBorderColorReq *req;
+
+	req = AllocReq(SetBorderColor);
+	req->windowid = wid;
+	req->color = colour;
+}
+
+/*
+ * Specify a cursor for a window.
+ * This cursor will only be used within that window, and by default
+ * for its new children.  If the cursor is currently within this
+ * window, it will be changed to the new one immediately.
+ */
+void
+GrSetCursor(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height, GR_COORD hotx,
+	GR_COORD hoty, GR_COLOR foreground, GR_COLOR background,
+	GR_BITMAP *fgbitmap, GR_BITMAP *bgbitmap)
+{
+	nxSetCursorReq *req;
+	int 	     	bitmapsize;
+	char *	     	data;
+
+	bitmapsize = GR_BITMAP_SIZE(width, height) * sizeof(GR_BITMAP);
+	req = AllocReqExtra(SetCursor, bitmapsize*2);
+	req->windowid = wid;
+	req->width = width;
+	req->height = height;
+	req->hotx = hotx;
+	req->hoty = hoty;
+	req->fgcolor = foreground;
+	req->bgcolor = background;
+	data = GetReqData(req);
+	memcpy(data, fgbitmap, bitmapsize);
+	memcpy(data+bitmapsize, bgbitmap, bitmapsize);
+}
+
+/*
+ * Move the cursor to the specified absolute screen coordinates.
+ * The coordinates are that of the defined hot spot of the cursor.
+ * The cursor's appearance is changed to that defined for the window
+ * in which the cursor is moved to.
+ */
+void 
+GrMoveCursor(GR_COORD x, GR_COORD y)
+{
+	nxMoveCursorReq *req;
+
+	req = AllocReq(MoveCursor);
+	req->x = x;
+	req->y = y;
+}
+
+/*
+ * Set the foreground color in a graphics context.
+ */
+void 
+GrSetGCForeground(GR_GC_ID gc, GR_COLOR foreground)
+{
+	nxSetGCForegroundReq *req;
+
+	req = AllocReq(SetGCForeground);
+	req->gcid = gc;
+	req->color = foreground;
+}
+
+/*
+ * Set the background color in a graphics context.
+ */
+void 
+GrSetGCBackground(GR_GC_ID gc, GR_COLOR background)
+{
+	nxSetGCBackgroundReq *req;
+
+	req = AllocReq(SetGCBackground);
+	req->gcid = gc;
+	req->color = background;
+}
+
+/*
+ * Set the drawing mode in a graphics context.
+ */
+void 
+GrSetGCMode(GR_GC_ID gc, int mode)
+{
+	nxSetGCModeReq *req;
+
+	req = AllocReq(SetGCMode);
+	req->gcid = gc;
+	req->mode = mode;
+}
+
+/*
+ * Set whether or not the background color is drawn in bitmaps and text.
+ */
+void 
+GrSetGCUseBackground(GR_GC_ID gc, GR_BOOL flag)
+{
+	nxSetGCUseBackgroundReq *req;
+
+	req = AllocReq(SetGCUseBackground);
+	req->gcid = gc;
+	req->flag = flag;
+}
+
+GR_FONT_ID
+GrCreateFont(GR_CHAR *name, GR_COORD height, GR_LOGFONT *plogfont)
+{
+	nxCreateFontReq *req;
+	GR_FONT_ID	fontid;
+
+ 	req = AllocReq(CreateFont);
+ 	if (plogfont) {
+ 		memcpy(&req->lf, plogfont, sizeof(*plogfont));
+ 		req->height = 0;
+ 		req->lf_used = 1;
+ 	} else {
+		if (name)
+			strcpy(req->lf.lfFaceName, name);
+		else req->lf.lfFaceName[0] = '\0';
+  		req->height = height;
+ 		req->lf_used = 0;
+	}
+  
+	if(GrTypedReadBlock(&fontid, sizeof(fontid),GrNumCreateFont) == -1)
+		return 0;
+	return fontid;
+}
+
+void
+GrSetFontSize(GR_FONT_ID fontid, GR_COORD fontsize)
+{
+	nxSetFontSizeReq *req;
+
+	req = AllocReq(SetFontSize);
+	req->fontid = fontid;
+	req->fontsize = fontsize;
+}
+
+void
+GrSetFontRotation(GR_FONT_ID fontid, int tenthdegrees)
+{
+	nxSetFontRotationReq *req;
+
+	req = AllocReq(SetFontRotation);
+	req->fontid = fontid;
+	req->tenthdegrees = tenthdegrees;
+}
+
+void
+GrSetFontAttr(GR_FONT_ID fontid, int setflags, int clrflags)
+{
+	nxSetFontAttrReq *req;
+
+	req = AllocReq(SetFontAttr);
+	req->fontid = fontid;
+	req->setflags = setflags;
+	req->clrflags = clrflags;
+}
+
+void
+GrDestroyFont(GR_FONT_ID fontid)
+{
+	nxDestroyFontReq *req;
+
+	req = AllocReq(DestroyFont);
+	req->fontid = fontid;
+}
+
+/*
+ * Set the font used for text drawing in a graphics context.
+ * The font is a number identifying one of several fonts.
+ * Font number 0 is always available, and is the default font.
+ */
+void
+GrSetGCFont(GR_GC_ID gc, GR_FONT_ID font)
+{
+	nxSetGCFontReq *req;
+
+	req = AllocReq(SetGCFont);
+	req->gcid = gc;
+	req->fontid = font;
+}
+
+/*
+ * Draw a line in the specified drawable using the specified graphics context.
+ */
+void 
+GrLine(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x1, GR_COORD y1, GR_COORD x2,
+	GR_COORD y2)
+{
+	nxLineReq *req;
+
+	req = AllocReq(Line);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x1 = x1;
+	req->y1 = y1;
+	req->x2 = x2;
+	req->y2 = y2;
+}
+
+/*
+ * Draw the boundary of a rectangle in the specified drawable using the
+ * specified graphics context.
+ */
+void 
+GrRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height)
+{
+	nxRectReq *req;
+
+	req = AllocReq(Rect);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+}
+
+/*
+ * Fill a rectangle in the specified drawable using the specified
+ * graphics context.
+ */
+void 
+GrFillRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height)
+{
+	nxFillRectReq *req;
+
+	req = AllocReq(FillRect);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+}
+
+/*
+ * Draw the boundary of an ellipse in the specified drawable with
+ * the specified graphics context.
+ */
+void 
+GrEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx,
+	GR_SIZE ry)
+{
+	nxEllipseReq *req;
+
+	req = AllocReq(Ellipse);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+}
+
+/*
+ * Fill an ellipse in the specified drawable using the specified
+ * graphics context.
+ */
+void 
+GrFillEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry)
+{
+	nxFillEllipseReq *req;
+
+	req = AllocReq(FillEllipse);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+}
+
+/*
+ * Draw an arc, pie or ellipse in the specified drawable using
+ * the specified graphics context.  Integer only.
+ */
+void	
+GrArc(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry, GR_COORD ax, GR_COORD ay,
+	GR_COORD bx, GR_COORD by, int type)
+{
+	nxArcReq *req;
+
+	req = AllocReq(Arc);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+	req->ax = ax;
+	req->ay = ay;
+	req->bx = bx;
+	req->by = by;
+	req->type = type;
+}
+
+/*
+ * Draw an arc or pie in the specified drawable using
+ * the specified graphics context.  Requires floating point.
+ */
+void
+GrArcAngle(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry, GR_COORD angle1, GR_COORD angle2, int type)
+{
+	nxArcAngleReq *req;
+
+	req = AllocReq(ArcAngle);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+	req->angle1 = angle1;
+	req->angle2 = angle2;
+	req->type = type;
+}
+
+/*
+ * Draw a rectangular area in the specified drawable using the specified
+ * graphics, as determined by the specified bit map.  This differs from
+ * rectangle drawing in that the rectangle is drawn using the foreground
+ * color and possibly the background color as determined by the bit map.
+ * Each row of bits is aligned to the next bitmap word boundary (so there
+ * is padding at the end of the row).  The background bit values are
+ * only written if the usebackground flag is set in the GC.
+ */
+void 
+GrBitmap(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, GR_BITMAP *bitmaptable)
+{
+	nxBitmapReq *req;
+	long 	     bitmapsize;
+
+	bitmapsize = (long)GR_BITMAP_SIZE(width, height) * sizeof(GR_BITMAP);
+	req = AllocReqExtra(Bitmap, bitmapsize);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	memcpy(GetReqData(req), bitmaptable, bitmapsize);
+}
+
+/* Draw multicolor image from image structure*/
+void 
+GrDrawImageBits(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_IMAGE_HDR *pimage)
+{
+	nxDrawImageBitsReq *req;
+	int		    imagesize;
+	int		    palsize;
+	char *		    addr;
+
+	imagesize = pimage->pitch * pimage->height;
+	palsize = pimage->palsize * sizeof(MWPALENTRY);
+	req = AllocReqExtra(DrawImageBits, imagesize + palsize);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	/* fill MWIMAGEHDR items passed externally*/
+	req->width = pimage->width;
+	req->height = pimage->height;
+	req->planes = pimage->planes;
+	req->bpp = pimage->bpp;
+	req->pitch = pimage->pitch;
+	req->bytesperpixel = pimage->bytesperpixel;
+	req->compression = pimage->compression;
+	req->palsize = pimage->palsize;
+	req->transcolor = pimage->transcolor;
+	addr = GetReqData(req);
+	memcpy(addr, pimage->imagebits, imagesize);
+	memcpy(addr+imagesize, pimage->palette, palsize);
+}
+
+/* Load an image file from disk and display it at the specified coordinates*/
+void
+GrDrawImageFromFile(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, char* path, int flags)
+{
+	nxDrawImageFromFileReq *req;
+
+	req = AllocReqExtra(DrawImageFromFile, strlen(path)+1);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	req->flags = flags;
+	memcpy(GetReqData(req), path, strlen(path)+1);	
+}
+
+/* load image from file and cache it*/
+GR_IMAGE_ID
+GrLoadImageFromFile(char *path, int flags)
+{
+	nxLoadImageFromFileReq *req;
+	GR_IMAGE_ID		imageid;
+
+	req = AllocReqExtra(LoadImageFromFile, strlen(path)+1);
+	req->flags = flags;
+	memcpy(GetReqData(req), path, strlen(path)+1);	
+
+	if(GrTypedReadBlock(&imageid, sizeof(imageid),
+		GrNumLoadImageFromFile) == -1)
+			return 0;
+	return imageid;
+}
+
+/* draw cached image*/
+void
+GrDrawImageToFit(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, GR_IMAGE_ID imageid)
+{
+	nxDrawImageToFitReq *req;
+
+	req = AllocReq(DrawImageToFit);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	req->imageid = imageid;
+}
+
+/* free cached image*/
+void
+GrFreeImage(GR_IMAGE_ID id)
+{
+	nxFreeImageReq *req;
+
+	req = AllocReq(FreeImage);
+	req->id = id;
+}
+
+/* return cached image information*/
+void
+GrGetImageInfo(GR_IMAGE_ID id, GR_IMAGE_INFO *iip)
+{
+	nxGetImageInfoReq *req;
+
+	req = AllocReq(GetImageInfo);
+	req->id = id;
+	GrTypedReadBlock(iip, sizeof(GR_IMAGE_INFO), GrNumGetImageInfo);
+}
+
+/*
+ * Draw a rectangular area in the specified drawable using the specified
+ * graphics context.  This differs from rectangle drawing in that the
+ * color values for each pixel in the rectangle are specified.
+ * The color table is indexed
+ * row by row.  Values whose color matches the background color are only
+ * written if the usebackground flag is set in the GC.
+ *
+ * The pixels are packed according to pixtype:
+ *
+ * pixtype		array of
+ * MWPF_RGB		MWCOLORVAL (unsigned long)
+ * MWPF_PIXELVAL	MWPIXELVAL (compile-time dependent)
+ * MWPF_PALETTE		unsigned char
+ * MWPF_TRUECOLOR0888	unsigned long
+ * MWPF_TRUECOLOR888	packed struct {char r,char g,char b} (24 bits)
+ * MWPF_TRUECOLOR565	unsigned short
+ * MWPF_TRUECOLOR555	unsigned short
+ * MWPF_TRUECOLOR332	unsigned char
+ */
+void 
+GrArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, void *pixels, int pixtype)
+{
+	nxAreaReq *req;
+	long       size;
+	long       chunk_y;
+	int        pixsize;
+
+	/* Calculate size of packed pixels*/
+	switch(pixtype) {
+	case MWPF_RGB:
+		pixsize = sizeof(MWCOLORVAL);
+		break;
+	case MWPF_PIXELVAL:
+		pixsize = sizeof(MWPIXELVAL);
+		break;
+	case MWPF_PALETTE:
+	case MWPF_TRUECOLOR332:
+		pixsize = sizeof(unsigned char);
+		break;
+	case MWPF_TRUECOLOR0888:
+		pixsize = sizeof(unsigned long);
+		break;
+	case MWPF_TRUECOLOR888:
+		pixsize = 3;
+		break;
+	case MWPF_TRUECOLOR565:
+	case MWPF_TRUECOLOR555:
+		pixsize = sizeof(unsigned short);
+		break;
+	default:
+		return;
+	}
+
+	/* Break request into MAXREQUESTSZ size packets*/
+	while(height > 0) {
+		chunk_y = (MAXREQUESTSZ - sizeof(nxAreaReq)) /
+			((long)width * pixsize);
+		if(chunk_y > height)
+			chunk_y = height;
+		size = chunk_y * ((long)width * pixsize);
+		req = AllocReqExtra(Area, size);
+		req->drawid = id;
+		req->gcid = gc;
+		req->x = x;
+		req->y = y;
+		req->width = width;
+		req->height = chunk_y;
+		req->pixtype = pixtype;
+		memcpy(GetReqData(req), pixels, size);
+		pixels = (void *)(((char *)pixels) + size);
+		y += chunk_y;
+		height -= chunk_y;
+	}
+}
+
+void
+GrCopyArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, GR_DRAW_ID srcid,
+	GR_COORD srcx, GR_COORD srcy, int op)
+{
+	nxCopyAreaReq *req;
+
+        req = AllocReq(CopyArea);
+        req->drawid = id;
+        req->gcid = gc;
+        req->x = x;
+        req->y = y;
+        req->width = width;
+        req->height = height;
+        req->srcid = srcid;
+        req->srcx = srcx;
+        req->srcy = srcy;
+        req->op = op;
+}
+   
+   
+/*
+ * Read the color values from the specified rectangular area of the
+ * specified drawable into a supplied buffer.  If the drawable is a
+ * window which is obscured by other windows, then the returned values
+ * will include the values from the covering windows.  Regions outside
+ * of the screen boundaries, or unmapped windows will return black.
+ */
+void 
+GrReadArea(GR_DRAW_ID id,GR_COORD x,GR_COORD y,GR_SIZE width,
+	GR_SIZE height, GR_PIXELVAL *pixels)
+{
+	nxReadAreaReq *req;
+	long           size;
+
+	req = AllocReq(ReadArea);
+	req->drawid = id;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	size = (long)width * height * sizeof(MWPIXELVAL);
+	GrTypedReadBlock(pixels, size, GrNumReadArea);
+}
+
+/*
+ * Draw a point in the specified drawable using the specified
+ * graphics context.
+ */
+void 
+GrPoint(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y)
+{
+	nxPointReq *req;
+
+	req = AllocReq(Point);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+
+}
+
+/*
+ * Draw points in the specified drawable using the specified
+ * graphics context.
+ */
+void 
+GrPoints(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable)
+{
+	nxPointsReq *req;
+	long       size;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(Points, size);
+	req->drawid = id;
+	req->gcid = gc;
+	memcpy(GetReqData(req), pointtable, size);
+}
+
+/*
+ * Draw a polygon in the specified drawable using the specified
+ * graphics context.  The polygon is only complete if the first
+ * point is repeated at the end.
+ */
+void 
+GrPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable)
+{
+	nxPolyReq *req;
+	long       size;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(Poly, size);
+	req->drawid = id;
+	req->gcid = gc;
+	memcpy(GetReqData(req), pointtable, size);
+}
+
+/*
+ * Draw a filled polygon in the specified drawable using the specified
+ * graphics context.  The last point may be a duplicate of the first
+ * point, but this is not required.
+ */
+void 
+GrFillPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count,GR_POINT *pointtable)
+{
+	nxFillPolyReq *req;
+	long           size;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(FillPoly, size);
+	req->drawid = id;
+	req->gcid = gc;
+	memcpy(GetReqData(req), pointtable, size);
+}
+
+/*
+ * Draw a text string in the specified drawable using the specified
+ * graphics context.  The background of the characters are only drawn
+ * if the usebackground flag in the GC is set.
+ */
+void 
+GrText(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, void *str,
+	GR_COUNT count, int flags)
+{
+	nxTextReq *req;
+	int	   size;
+
+	if(count == -1 && (flags&MWTF_PACKMASK) == MWTF_ASCII)
+		count = strlen((char *)str);
+
+	size = nxCalcStringBytes(str, count, flags);
+
+	req = AllocReqExtra(Text, size);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->count = count;
+	req->flags = flags;
+	memcpy(GetReqData(req), str, size);
+}
+
+/* Return the system palette entries*/
+void
+GrGetSystemPalette(GR_PALETTE *pal)
+{
+	AllocReq(GetSystemPalette);
+	GrTypedReadBlock(pal, sizeof(*pal), GrNumGetSystemPalette);
+}
+
+/* Set the system palette entries from first for count*/
+void
+GrSetSystemPalette(GR_COUNT first, GR_PALETTE *pal)
+{
+	nxSetSystemPaletteReq *req;
+
+	req = AllocReq(SetSystemPalette);
+	req->first = first;
+	req->count = pal->count;
+	memcpy(req->palette, pal->palette, sizeof(GR_PALENTRY) * pal->count);
+}
+
+/* Convert passed color value to pixel value, depending on system mode*/
+void
+GrFindColor(GR_COLOR c, GR_PIXELVAL *retpixel)
+{
+	nxFindColorReq *req;
+
+	req = AllocReq(FindColor);
+	req->color = c;
+	GrTypedReadBlock(retpixel, sizeof(*retpixel), GrNumFindColor);
+}
+
+void
+GrReqShmCmds(long shmsize)
+{
+#if HAVE_SHAREDMEM_SUPPORT
+	nxReqShmCmdsReq	req;
+	int key, shmid;
+
+	if ( nxSharedMem != 0 )
+		return;
+
+	GrFlush();
+
+	shmsize = (shmsize+SHM_BLOCK_SIZE-1) & ~(SHM_BLOCK_SIZE-1);
+
+	req.reqType = GrNumReqShmCmds;
+	req.hilength = 0;
+	req.length = sizeof(req);
+	req.size = shmsize;
+
+	nxWriteSocket((char *)&req,sizeof(req));
+	GrReadBlock(&key,sizeof(key));
+
+	if ( !key ) {
+		EPRINTF("nxclient: no shared memory support on server\n");
+		return;
+	}
+
+	shmid = shmget(key,shmsize,0);
+	if ( shmid == -1 ) {
+		EPRINTF("nxclient: Can't shmget key %d: %m\n", key);
+		return;
+	}
+
+	nxSharedMem = shmat(shmid,0,0);
+	shmctl(shmid,IPC_RMID,0);	/* Prevent other from attaching */
+	if ( nxSharedMem == (char *)-1 )
+		return;
+
+	nxSharedMemSize = shmsize;
+	nxAssignReqbuffer(nxSharedMem, shmsize);
+#endif /* HAVE_SHAREDMEM_SUPPORT*/
+}
+
+void
+GrInjectPointerEvent(GR_COORD x, GR_COORD y, int button, int visible)
+{
+	nxInjectEventReq *req;
+
+	req = AllocReq(InjectEvent);
+	req->event_type = GR_INJECT_EVENT_POINTER;
+	req->event.pointer.visible = visible;
+	req->event.pointer.x = x;
+	req->event.pointer.y = y;
+	req->event.pointer.button = button;
+
+	GrFlush();
+}
+
+void
+GrInjectKeyboardEvent(GR_WINDOW_ID wid, GR_KEY keyvalue,
+	GR_KEYMOD modifier, GR_SCANCODE scancode, GR_BOOL pressed)
+{
+	nxInjectEventReq *req;
+
+	req = AllocReq(InjectEvent);
+	req->event_type = GR_INJECT_EVENT_KEYBOARD;
+	req->event.keyboard.wid = wid;
+	req->event.keyboard.keyvalue = keyvalue;
+	req->event.keyboard.modifier = modifier;
+	req->event.keyboard.scancode = scancode;
+	req->event.keyboard.pressed = pressed;
+
+	GrFlush();
+}
+
+/*
+ * Send the GR_WM_PROPERTIES structure for the specified window id.
+ */
+void
+GrSetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props)
+{
+	nxSetWMPropertiesReq *req;
+	char 		     *addr;
+	int 		      s;
+
+	if ((props->flags & GR_WM_FLAGS_TITLE) && props->title)
+		s = strlen(props->title) + 1;
+	else s = 0;
+
+	req = AllocReqExtra(SetWMProperties, s + sizeof(GR_WM_PROPERTIES));
+	req->windowid = wid;
+	addr = GetReqData(req);
+	memcpy(addr, props, sizeof(GR_WM_PROPERTIES));
+	if (s)
+		memcpy(addr + sizeof(GR_WM_PROPERTIES), props->title, s);
+}
+
+/*
+ * Read the GR_WM_PROPERTIES structure for the specified window id.
+ * The caller needs to remember to free the returned title before freeing
+ * the structure (we allocate it dynamically because we don't know how
+ * big it is in advance). We set the title to NULL if there isn't one.
+ * The title will also be set to NULL if we can't allocate enough memory
+ * to store it.
+ */
+void
+GrGetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props)
+{
+	nxGetWMPropertiesReq *req;
+	UINT16 		      textlen;
+	GR_CHAR 	      c;
+
+	req = AllocReq(GetWMProperties);
+	req->windowid = wid;
+
+	GrTypedReadBlock(props, sizeof(GR_WM_PROPERTIES), GrNumGetWMProperties);
+	GrReadBlock(&textlen, sizeof(textlen));
+	if(!textlen) {
+		props->title = NULL;
+		return;
+	}
+	if(!(props->title = malloc(textlen))) {
+		/* Oh dear, we're out of memory but still have to purge the
+		   requested data (and throw it away) */
+		while(textlen--)
+			GrReadBlock(&c, 1);
+	} else {
+		GrReadBlock(props->title, textlen);
+	}
+}
+
+/*
+ * Send a CLOSE_REQ event to the specified window (assuming they've selected
+ * for it). This is used to politely ask an application to shut down when the
+ * user clicks the window close button.
+ */
+void 
+GrCloseWindow(GR_WINDOW_ID wid)
+{
+	nxCloseWindowReq *req;
+
+	req = AllocReq(CloseWindow);
+	req->windowid = wid;
+}
+
+/*
+ * Forcibly disconnect the client which owns this window. Used to kill an
+ * application which has locked up and is not responding to CLOSE_REQ events.
+ */
+void 
+GrKillWindow(GR_WINDOW_ID wid)
+{
+	nxKillWindowReq *req;
+
+	req = AllocReq(KillWindow);
+	req->windowid = wid;
+}
diff -urN lib/microwindows/src/nanox/client.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/client.c
--- lib/microwindows/src/nanox/client.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/client.c	2005-02-21 16:13:30.000000000 +0100
@@ -0,0 +1,5 @@
+#if ECOS
+#include "client_ecos.c"
+#else
+#include "client_orig.c"
+#endif
diff -urN lib/microwindows/src/nanox/client_ecos.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/client_ecos.c
--- lib/microwindows/src/nanox/client_ecos.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/client_ecos.c	2005-02-21 16:13:34.000000000 +0100
@@ -0,0 +1,3174 @@
+/*
+ * Copyright (c) 2001 I-Jui Sung <ijsung@csie.nctu.edu.tw>
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1999, 2000 Alex Holden <alex@linuxhacker.org>
+ * Copyright (c) 1991 David I. Bell
+ * Copyright (c) 2000 Vidar Hokstad
+ * Copyright (c) 2000 Morten Rolland <mortenro@screenmedia.no>
+ *
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Client routines to do graphics with windows and graphics contexts.
+ *
+ * Port to eCos/Linux by I-Jui Sung
+ * Rewritten heavily for speed by Greg Haerr
+ *
+ * Whenever you add a new API entry point, please comment it in the same way
+ * as the rest of the functions in this file. Also add your functions to the
+ * appropriate section(s) in doc/nano-X/nano-X-sections.txt and regenerate the
+ * documentation by running make in the doc/nano-X/ directory. If you do not
+ * have the necessary tools (gtk-doc and the docbook-tools) to rebuild the
+ * documentation, just skip that step and we will do it for you.
+ */
+#include <unistd.h>
+#include <cyg/infra/diag.h>
+#include <cyg/fileio/fileio.h>
+#include <cyg/kernel/kapi.h>
+#include <cyg/libc/stdio/stdio.h>
+#include <assert.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <sys/malloc.h>
+//#include <sys/select.h>
+#include "device.h"
+#include "nano-X.h"
+#include "mqproto.h"
+#include "serv.h"
+#include "nxproto.h"
+
+#define GR_CLOSE_FIX	1	/* dirty hack attempts to fix GrClose hang bug*/
+
+#define SHM_BLOCK_SIZE	4096
+
+
+#if !ECOS
+/* exported global data */
+int 	   nxSocket = -1;	/* The network socket descriptor */
+#endif
+
+#if HAVE_SHAREDMEM_SUPPORT
+char *	   nxSharedMem = 0;	/* Address of shared memory segment*/
+static int nxSharedMemSize;	/* Size in bytes of shared mem segment*/
+#endif
+
+#include "ptd.h"	/* per thread data */
+
+/*
+ * Queue an event in FIFO for later retrieval.
+ */
+static void
+QueueEvent(GR_EVENT *ep)
+{
+	EVENT_LIST *	elp;
+	EVENT_LIST *	prevelp;
+	GET_PER_THREAD_DATA;
+
+	elp = malloc(sizeof(EVENT_LIST));
+	if (elp) {
+		elp->event = *ep;
+		elp->next = NULL;
+
+		/* add as last entry on list*/
+		if (!ptdp->evlist) {
+			ptdp->evlist = elp;
+			return;
+		}
+		prevelp = ptdp->evlist;
+		while (prevelp->next)
+			prevelp = prevelp->next;
+		prevelp->next = elp;
+	}
+}
+
+/*
+ * Retrieve first event in FIFO event queue.
+ */
+static void
+GetNextQueuedEvent(GR_EVENT *ep)
+{
+	GET_PER_THREAD_DATA;
+	*ep = ptdp->evlist->event;
+	ptdp->evlist = ptdp->evlist->next;
+}
+/*
+ * Read n bytes of data from the server into block *b.  Make sure the data
+ * you are about to read are actually of the correct type - e.g. make a
+ * check for the first block of data you read as a response to a command
+ * with the Typed version of this function. Returns 0 on success or -1 on
+ * failure.
+ */
+static int GrReadBlock(void *b, int n)
+{
+	GET_PER_THREAD_DATA;
+	mqmessage * msgp=(mqmessage *)ptdp->buffer;
+	nxFlushReq(0L,0);	//Just flush request buffer, do not realloc
+	if(ptdp->resultbuffer==NULL)
+	{	/* no further results, reread from server*/
+		/* the buffer is to store message, while real microwindows message
+		   will be addressed by resultbuffer pointer
+		 */
+		read(ptdp->clientfd, ptdp->buffer, ptdp->buffersz);
+		ptdp->resultbuffer=msgp->msgbuf;
+		ptdp->resultbuffersz=msgp->msgsize;
+		ptdp->resultbufferloc=0;	/* initially locate at 0*/
+	}
+	/* make sure request read block size is smaller than actually readed message size */
+	if(n>ptdp->resultbuffersz-ptdp->resultbufferloc)
+	{
+		diag_printf("GrReadBlock Request buffer size=%d,loc=%d,n=%d\n",ptdp->resultbuffersz, ptdp->resultbufferloc, n);
+		assert(n<=ptdp->resultbuffersz-ptdp->resultbufferloc);
+	}
+	memcpy(b, &ptdp->resultbuffer[ptdp->resultbufferloc], n);
+	ptdp->resultbufferloc+=n;
+	/* if we exhaust current result, automatically free it */
+	if(ptdp->resultbufferloc==ptdp->resultbuffersz)
+	{
+		assert(ptdp->resultbufferloc!=0);
+		assert(ptdp->resultbuffer!=NULL);
+		free(ptdp->resultbuffer);
+		ptdp->resultbuffersz=0;
+		ptdp->resultbuffer=NULL;
+		ptdp->resultbufferloc=0;
+
+	}
+	return 0;
+}
+/*
+ * Read a byte of data from the server.
+ */
+static int GrReadByte()
+{
+	unsigned char c;
+
+	if(GrReadBlock(&c, 1) == -1)
+		return -1;
+	else return (int) c;
+}
+
+/*
+ * Check if this is a CLIENT_DATA event, in which case we need to read the
+ * data for the event into a buffer and set the event data pointer to the
+ * address of it (or NULL if the malloc() fails). We also don't try to read
+ * any data if datalen is 0.
+ */
+static void GrCheckForClientData(GR_EVENT *evp)
+{
+	GR_EVENT_CLIENT_DATA *event;
+
+	if(evp->type == GR_EVENT_TYPE_CLIENT_DATA) {
+		event = (GR_EVENT_CLIENT_DATA *)evp;
+		if(!event->datalen) {
+			event->data = NULL;
+			return;
+		}
+		if(!(event->data = malloc(event->datalen))) return;
+		GrReadBlock(event->data, event->datalen);
+	}
+}
+
+/*
+ * Check if the data we are about to read is of the correct type. This
+ * must be done in order to avoid reading an event as part of the response
+ * from the server to a command that requires a reply.
+ */
+static int GrCheckBlockType(short packettype)
+{
+	short		b;
+	GR_EVENT	event;
+
+	while (GrReadBlock(&b,sizeof(b)) != -1) {
+		if (b == packettype)
+			return b;
+
+		if (b == GrNumGetNextEvent) {
+			/*EPRINTF("nxclient %d: Storing event (expected %d)\n",
+				getpid(), packettype);*/
+
+#if 0
+			/* We only need to handle one event, since the next
+			 * event won't arrive until the next GrPrepareSelect()
+			 * has been called, and by then we have already
+			 * handled this event in GrServiceSelect(). If
+			 * GrPrepareSelect() is never called, then we should
+			 * never get here either, so that is cool too.
+			 */
+			GrReadBlock(&storedevent_data,
+				    sizeof(storedevent_data));
+			GrCheckForClientData(&storedevent_data);
+			storedevent = 1;
+#endif
+			/* read event and queue it for later processing*/
+			GrReadBlock(&event, sizeof(event));
+			QueueEvent(&event);
+		} else {
+			EPRINTF("nxclient %d: Wrong packet type %d "
+				"(expected %d)\n", pthread_self(),b, packettype);
+		}
+	}
+	EPRINTF("nxclient %d: Corrupted packet\n", pthread_self());
+	return -1;
+}
+
+/*
+ * Actually read a response from the server, much like the GrReadBlock but
+ * make sure the response is of the right kind, e.g. store the event that
+ * may have sneaked into the stream.
+ */
+static int GrTypedReadBlock(void *b, int n, int type)
+{
+	int r;
+   
+	r = GrCheckBlockType(type);
+	if (r != type)
+	{
+		diag_printf("Unexpected event (%d) on GrTypedReadBlock\n",type);
+		return -1;
+	}
+	return GrReadBlock(b,n);
+}
+
+/*
+ * Check if the passed event is an error event, and call the error handler if
+ * there is one. After calling the handler (if it returns), the event type is
+ * set to a non-event so that we don't return an error event through the
+ * GetEvent() mechanism. This solution is simpler than creating a client-side
+ * event queue.
+ */
+static void
+CheckErrorEvent(GR_EVENT *ep)
+{
+	GET_PER_THREAD_DATA;
+	if (ep->type == GR_EVENT_TYPE_ERROR) {
+		if (ptdp->ErrorFunc) {
+			/* call error handler*/
+			ptdp->ErrorFunc(ep);
+
+			/* then convert to null event*/
+			ep->type = GR_EVENT_TYPE_NONE;
+		}
+	}
+}
+
+/**
+ * GrFlush:
+ *
+ * Flush the message buffer of any messages it may contain.
+ */
+
+void 
+GrFlush(void)
+{
+	nxFlushReq(0L,1);
+}
+
+/* establish a connection */
+static int mqconnect(ThreadNanoXData * tp)
+{
+	mqmessage msg, *reply;
+	char buf[tp->buffersz];
+
+	reply=(mqmessage *)buf;
+	msg.type=MSG_CLIENT_CONNECT;
+	msg.reply=tp->clientfd;
+	mq_send(tp->ServerMQD, (const char *)&msg, sizeof(msg),DEFAULT_MSG_PRIO);
+	read(tp->clientfd, buf, tp->buffersz);
+	return (reply->type==MSG_CLIENT_CONNECT_ESTABLISHED) ? 0 : -1;
+}
+/**
+ * GrOpen:
+ * @Returns: the fd of the connection to the server or -1 on failure
+ *
+ * Open a connection to the graphics server.
+ */
+int 
+GrOpen(void)
+{
+	extern cyg_file *cyg_fp_get( int fd );
+	extern void cyg_fp_free(cyg_file *);
+	cyg_file * file_objp; 
+	mqd_t	clientmqd;
+	int tries;
+	int ret;
+	nxOpenReq	req;
+	ThreadNanoXData * ptdp;
+	char mqname[100];
+	struct mq_attr attr;
+	/* Generate a unique name for that process .. */
+	sprintf(mqname,CLIENTMQNAME, pthread_self());
+	/*allocate per-thread data*/
+	if(NULL==(ptdp=malloc(sizeof(ThreadNanoXData))))
+	{
+		diag_printf("Can't allocate per-thread data space");
+		return -1;
+	}
+	/* Set per thread data to store client side mqueue data */
+	if(pthread_setspecific(PerThreadNanoXDataKey, ptdp))
+	{
+		free(ptdp);
+		diag_printf("Can't set pthread per thread data for PerThreadNanoXDataKey\n");
+		return -1;
+	}
+        /*open server msg queue for write*/
+#if 0
+        diag_printf("GrOpen(): Open Nano X Server MQueue.\n");
+#endif
+        if((ptdp->ServerMQD=mq_open(NXMQUEUE_NAME, O_WRONLY,NULL,NULL))==(mqd_t)-1)
+        {
+		free(ptdp);
+                diag_printf("Can't Open NanoX Server Message Queue for write.\n");
+                return -1;
+        }
+        /*open client msg queue for read and write(from server)*/
+        diag_printf("GrOpen(): Open Client MQueue:%s.\n",mqname);
+        if((ptdp->clientfd=open(mqname,O_RDWR|O_CREAT))==-1)
+        {
+		mq_close(ptdp->ServerMQD);
+		free(ptdp);
+                diag_printf("Can't Open Client Message Queue for read.\n");
+		return -1;
+        }
+
+	file_objp=cyg_fp_get(ptdp->clientfd);
+
+	clientmqd=((mqfile *)file_objp->f_data)->mqd;
+        /* query its max message size */
+        mq_getattr(clientmqd,&attr);
+	ptdp->buffersz=attr.mq_msgsize;
+	diag_printf("Buffer size=%d\n",ptdp->buffersz);
+	if(NULL==(ptdp->buffer=malloc(ptdp->buffersz)))
+	{
+		mq_close(ptdp->ServerMQD);
+		close(ptdp->clientfd);
+		free(ptdp);
+		diag_printf("Can't allcate message buffer\n");
+		return -1;
+	}
+
+	cyg_fp_free(file_objp);
+
+
+	/*
+	 * Try to open the connection for up to a second,
+	 * waiting 1/10 second between attempts.
+	 */
+	for (tries=0; tries<10; tries++) 
+	{
+
+		ret = mqconnect(ptdp);
+		if (ret >= 0)
+			break;
+		cyg_thread_delay(100);
+		EPRINTF("nxclient: retry connect attempt %d\n", tries);
+	}
+	if (ret == -1) {
+		mq_close(ptdp->ServerMQD);
+		close(ptdp->clientfd);
+		free(ptdp);
+		diag_printf("Can't connect to NanoX server\n");
+		return -1;
+	}
+	diag_printf("Client Connect OK\n");
+	/* initialize other per thread data */
+	ptdp->ErrorFunc = GrDefaultErrorHandler;
+	ptdp->reqbuf.bufptr=NULL;
+	ptdp->reqbuf.bufmax=NULL;
+	ptdp->reqbuf.buffer=NULL;
+
+	ptdp->resultbuffersz=0;/* size of information returned from server */
+        ptdp->resultbuffer=NULL; /* information returned from server */
+        ptdp->resultbufferloc=0;/* current location of information returned from server */
+
+	ptdp->evlist=NULL;	/*client side event queue*/
+
+	/*
+	 * By Performing the 'GrOpen' without allocating a buffer, just
+	 * shuffeling the struct over the wire, we can postpone the
+	 * allocation of the client size command buffer, which will never be
+	 * allocated if the first command after GrOpen() is
+	 * GrReqShmCmds() which allocates a replacement shared memory
+	 * segment.
+	 * So: Calling GrReqShmCmds() right after GrOpen will prevent the
+	 * traditional command queue buffer from being allocated from
+	 * the process heap - and only the shared memory segment is
+	 * allocated.
+	 */
+	req.reqType = GrNumOpen;
+	req.hilength = 0;
+	req.length = sizeof(req);
+
+	nxWriteSocket((char *)&req,sizeof(req));
+
+	return  ptdp->clientfd;
+#if !ECOS
+	size_t 		size;
+	nxOpenReq	req;
+	int		tries;
+	int		ret = 0;
+#if ELKS
+	struct sockaddr_na name;
+#else
+	struct sockaddr_un name;
+#endif
+	
+	if(nxSocket == -1)
+#if ELKS
+		if((nxSocket = socket(AF_NANO, SOCK_STREAM, 0)) == -1) {
+#else
+		if((nxSocket = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
+#endif
+			nxSocket = -1;
+			return -1;
+		}
+
+#if ELKS
+	name.sun_family = AF_NANO;
+	name.sun_no = GR_NUMB_SOCKET;
+	size = sizeof(struct sockaddr_na);
+#else
+	name.sun_family = AF_UNIX;
+	strcpy(name.sun_path, GR_NAMED_SOCKET);
+	size = (offsetof(struct sockaddr_un, sun_path) +
+		strlen(name.sun_path) + 1);
+#endif
+
+	/*
+	 * Try to open the connection for up to a second,
+	 * waiting 1/10 second between attempts.
+	 */
+	for (tries=1; tries<=10; ++tries) {
+		struct timespec req;
+
+		ret = connect(nxSocket, (struct sockaddr *) &name, size);
+		if (ret >= 0)
+			break;
+		req.tv_sec = 0;
+		req.tv_nsec = 100000000L;
+		nanosleep(&req, NULL);
+		EPRINTF("nxclient: retry connect attempt %d\n", tries);
+	}
+	if (ret == -1) {
+		close(nxSocket);
+		nxSocket = -1;
+		return -1;
+	}
+
+	/*
+	 * By Performing the 'GrOpen' without allocating a buffer, just
+	 * shuffeling the struct over the wire, we can postpone the
+	 * allocation of the client size command buffer, which will never be
+	 * allocated if the first command after GrOpen() is
+	 * GrReqShmCmds() which allocates a replacement shared memory
+	 * segment.
+	 * So: Calling GrReqShmCmds() right after GrOpen will prevent the
+	 * traditional command queue buffer from being allocated from
+	 * the process heap - and only the shared memory segment is
+	 * allocated.
+	 */
+	req.reqType = GrNumOpen;
+	req.hilength = 0;
+	req.length = sizeof(req);
+
+	nxWriteSocket((char *)&req,sizeof(req));
+	return nxSocket;
+#endif
+}
+
+#if GR_CLOSE_FIX
+#if !ECOS
+static void
+mySignalhandler(int sig)
+{
+	if (sig == SIGALRM) {
+		printf("Oops! nxFlushReq() timed out, cowardly chickening "
+								"out!\n");
+		exit(127);
+	}
+}
+#endif
+#endif
+
+/**
+ * GrClose:
+ *
+ * Close the graphics device, flushing any waiting messages.
+ */
+/* Vladimir Cotfas: hang in GrFlush() --> nxFlushReq(0L,1); */
+void 
+GrClose(void)
+{
+	GET_PER_THREAD_DATA;
+	diag_printf("GrClosing(%d)!\n", ptdp->clientfd);
+
+	AllocReq(Close);
+	GrFlush();
+
+	/*close server connection*/
+	mq_close(ptdp->ServerMQD);
+	/*close client queue*/
+	close(ptdp->clientfd);
+	if(ptdp->reqbuf.buffer != NULL) 
+		free(ptdp->reqbuf.buffer);
+	free(ptdp->buffer);
+	if(ptdp->resultbuffer!=NULL)
+		free(ptdp->resultbuffer);
+	free(ptdp);
+
+#if !ECOS
+
+#if GR_CLOSE_FIX
+	/* allow 1 second to flush*/
+	void * oldSignalHandler = signal(SIGALRM, mySignalhandler);
+	alarm(1);
+#endif
+	AllocReq(Close);
+	GrFlush();
+#if GR_CLOSE_FIX
+	alarm(0);
+	signal(SIGALRM, oldSignalHandler);
+#endif
+	close(nxSocket);
+#endif
+}
+
+/**
+ * GrDefaultErrorHandler:
+ * @ep: the error event structure
+ * 
+ * The default error handler which is called when the server reports an error
+ * event and the client hasn't set up a handler of it's own.
+ *
+ * Generates a human readable error message on stderr describing what error
+ * occurred and what function it occured in, then exits.
+ */
+void 
+GrDefaultErrorHandler(GR_EVENT *ep)
+{
+	if (ep->type == GR_EVENT_TYPE_ERROR) {
+		EPRINTF("nxclient %d: Error (%s) ", pthread_self(), ep->error.name);
+		EPRINTF(nxErrorStrings[ep->error.code], ep->error.id);
+		GrClose();
+		pthread_exit(NULL);
+	}
+}
+
+/**
+ * GrSetErrorHandler:
+ * @fncb: the function to call to handle error events
+ * @Returns: the address of the previous error handler
+ *
+ * Sets an error handling routine that will be called on any errors from
+ * the server (assuming the client has asked to receive them). If zero is
+ * used as the argument, errors will be returned as regular events instead.
+ */
+GR_FNCALLBACKEVENT
+GrSetErrorHandler(GR_FNCALLBACKEVENT fncb)
+{
+	GET_PER_THREAD_DATA;
+	GR_FNCALLBACKEVENT orig;
+	orig = ptdp->ErrorFunc;
+	ptdp->ErrorFunc = fncb;
+	return orig;
+}
+
+/**
+ * GrGetScreenInfo:
+ * @sip: pointer to a GR_SCREEN_INFO structure
+ *
+ * Fills in the specified GR_SCREEN_INFO structure.
+ */
+void 
+GrGetScreenInfo(GR_SCREEN_INFO *sip)
+{
+	AllocReq(GetScreenInfo);
+	GrTypedReadBlock(sip, sizeof(GR_SCREEN_INFO),GrNumGetScreenInfo);
+}
+
+/**
+ * GrGetSysColor:
+ * @index: an index into the server's colour look up table
+ * @Returns: the colour found at the specified index
+ *
+ * Returns the colour at the specified index into the server's colour look
+ * up table. The colours in the table are those with names like
+ * "GR_COLOR_DESKTOP", "GR_COLOR_ACTIVECAPTION", "GR_COLOR_APPWINDOW", etc.
+ * as listed in nano-X.h
+ */
+GR_COLOR
+GrGetSysColor(int index)
+{
+	nxGetSysColorReq *req;
+	GR_COLOR color;
+
+	req = AllocReq(GetSysColor);
+	req->index = index;
+	if(GrTypedReadBlock(&color, sizeof(color),GrNumGetSysColor) == -1)
+		return 0;
+	return color;
+}
+
+/**
+ * GrGetFontInfo:
+ * @fontno: the font ID number
+ * @fip: pointer to a GR_FONT_INFO structure
+ *
+ * Fills in the specified GR_FONT_INFO structure with information regarding
+ * the specified font.
+ */
+void 
+GrGetFontInfo(GR_FONT_ID fontno, GR_FONT_INFO *fip)
+{
+	nxGetFontInfoReq *req;
+
+	req = AllocReq(GetFontInfo);
+	req->fontid = fontno;
+	GrTypedReadBlock(fip, sizeof(GR_FONT_INFO),GrNumGetFontInfo);
+}
+
+/**
+ * GrGetGCInfo:
+ * @gc: a graphics context
+ * @gcip: pointer to a GR_GC_INFO structure
+ *
+ * Fills in the specified GR_GC_INFO structure with information regarding the
+ * specified graphics context.
+ */
+void GrGetGCInfo(GR_GC_ID gc, GR_GC_INFO *gcip)
+{
+	nxGetGCInfoReq *req;
+
+	req = AllocReq(GetGCInfo);
+	req->gcid = gc;
+	GrTypedReadBlock(gcip, sizeof(GR_GC_INFO),GrNumGetGCInfo);
+}
+
+/**
+ * GrGetGCTextSize:
+ * @gc: the graphics context
+ * @str: pointer to a text string
+ * @count: the length of the string
+ * @flags: text rendering flags (GR_TF*)
+ * @retwidth: pointer to the variable the width will be returned in
+ * @retheight: pointer to the variable the height will be returned in
+ * @retbase: pointer to the variable the baseline height will be returned in
+ *
+ * Calculates the dimensions of the specified text string using the current font
+ * and flags in the specified graphics context. The count argument can be -1
+ * if the string is null terminated.
+ */
+void GrGetGCTextSize(GR_GC_ID gc, void *str, int count, int flags,
+	GR_SIZE *retwidth, GR_SIZE *retheight, GR_SIZE *retbase)
+{
+	nxGetGCTextSizeReq *req;
+	int size;
+
+	if(count == -1 && (flags&MWTF_PACKMASK) == MWTF_ASCII)
+		count = strlen((char *)str);
+
+	size = nxCalcStringBytes(str, count, flags);
+
+	req = AllocReqExtra(GetGCTextSize, size);
+	req->gcid = gc;
+	req->flags = flags;
+	memcpy(GetReqData(req), str, size);
+	GrTypedReadBlock(retwidth, sizeof(*retwidth),GrNumGetGCTextSize);
+	GrReadBlock(retheight, sizeof(*retheight));
+	GrReadBlock(retbase, sizeof(*retbase));
+}
+
+static int regfd = -1;
+
+/**
+ * GrRegisterInput:
+ * @fd: the file descriptor to monitor
+ *
+ * Register an extra file descriptor to monitor in the main select() call.
+ * An event will be returned when the fd has data waiting to be read if that
+ * event has been selected for.
+ */
+/* FIXME: only one extra file descriptor can be monitored */
+void 
+GrRegisterInput(int fd)
+{
+	regfd = fd;
+}
+
+/**
+ * GrPrepareSelect:
+ * @maxfd: pointer to a variable which the highest in use fd will be written to
+ * @rfdset: pointer to the file descriptor set structure to use
+ *
+ * Prepare for a GrServiceSelect function by asking the server to send the next
+ * event but not waiting around for it to arrive and initialising the
+ * specified fd_set structure with the client/server socket descriptor and any
+ * previously registered external file descriptors. Also compares the current
+ * contents of maxfd, the client/server socket descriptor, and the previously
+ * registered external file descriptors, and returns the highest of them in
+ * maxfd.
+ */
+void
+GrPrepareSelect(int *maxfd,void *rfdset)
+{
+	GET_PER_THREAD_DATA;
+	fd_set *rfds = rfdset;
+
+	AllocReq(GetNextEvent);
+	GrFlush();
+
+	FD_SET(ptdp->clientfd, rfds);
+	if(ptdp->clientfd > *maxfd)
+		*maxfd = ptdp->clientfd;
+	if(regfd != -1) {
+		FD_SET(regfd, rfds);
+		if(regfd > *maxfd)
+			*maxfd = regfd;
+	}
+}
+
+/**
+ * GrServiceSelect:
+ * @rfdset: pointer to the file descriptor set to monitor
+ * @fncb: pointer to the function to call when an event needs handling
+ *
+ * Used by GrMainLoop() to call the specified callback function when an
+ * event arrives or there is data waiting on an external fd specified by
+ * GrRegisterInput().
+ */
+void
+GrServiceSelect(void *rfdset, GR_FNCALLBACKEVENT fncb)
+{
+	GET_PER_THREAD_DATA;
+	fd_set *	rfds = rfdset;
+	GR_EVENT 	ev;
+
+        /* Clean out any event that might have arrived while waiting
+	 * for other data, for instance by doing Nano-X requests
+	 * between GrPrepareSelect() and GrServiceSelect(), or when
+	 * an event is generated in Nano-X at the same time as the
+	 * client wakes up for some reason and calls Nano-X functions.
+	 */
+#if 0
+	if (storedevent) {
+		/*DPRINTF("nxclient: Handling stored event\n");*/
+		CheckErrorEvent(&storedevent_data);
+		fncb(&storedevent_data);
+		storedevent = 0;
+	}
+#endif
+	if (ptdp->evlist) {
+		DPRINTF("nxclient: Handling queued event\n");
+		GetNextQueuedEvent(&ev);
+		CheckErrorEvent(&ev);
+		fncb(&ev);
+	}
+	else {
+		if(FD_ISSET(ptdp->clientfd, rfds)) {
+			GrTypedReadBlock(&ev, sizeof(ev),GrNumGetNextEvent);
+			GrCheckForClientData(&ev);
+			CheckErrorEvent(&ev);
+			fncb(&ev);
+		}
+	}
+
+#if 0 
+	/* Morten - remove this if you want*/
+	while ( GrPeekEvent(&ev) )
+		CheckErrorEvent(&ev);
+		fncb(&ev);
+#endif
+
+	if(regfd != -1 && FD_ISSET(regfd, rfds)) {
+		ev.type = GR_EVENT_TYPE_FDINPUT;
+		ev.fdinput.fd = regfd;
+		fncb(&ev);
+	}
+}
+
+/**
+ * GrMainLoop:
+ * @fncb:
+ *
+ * A convenience function which calls the specified callback function whenever
+ * an event arrives or there is data to be read on a file descriptor previously
+ * specified by GrRegisterInput(). Currently never returns.
+ */
+void
+GrMainLoop(GR_FNCALLBACKEVENT fncb)
+{
+#if !ECOS
+	fd_set	rfds;
+	int	setsize = 0;
+
+	for(;;) {
+		FD_ZERO(&rfds);
+		GrPrepareSelect(&setsize, &rfds);
+		if(select(setsize+1, &rfds, NULL, NULL, NULL) > 0)
+			GrServiceSelect(&rfds, fncb);
+	}
+#endif
+}
+
+/**
+ * GrGetNextEvent:
+ * @ep: pointer to the GR_EVENT structure to return the event in
+ *
+ * Gets the next event from the event queue and places it in the specified
+ * GR_EVENT structure. If the queue is currently empty, we sleep until the
+ * next event arrives from the server or input is read on a file descriptor
+ * previously specified by GrRegisterInput().
+ */
+void 
+GrGetNextEvent(GR_EVENT *ep)
+{
+	GrGetNextEventTimeout(ep, 0L);
+}
+
+/**
+ * GrGetNextEventTimeout:
+ * @ep: pointer to the GR_EVENT structure to return the event in
+ * @timeout: the number of milliseconds to wait before timing out
+ *
+ * Gets the next event from the event queue and places it in the specified
+ * GR_EVENT structure. If the queue is currently empty, we sleep until the
+ * next event arrives from the server, input is read on a file descriptor
+ * previously specified by GrRegisterInput(), or a timeout occurs. Note
+ * that a value of 0 for the timeout parameter doesn't mean "timeout after 0
+ * milliseconds" but is in fact a magic number meaning "never time out".
+ */
+void
+GrGetNextEventTimeout(GR_EVENT *ep, GR_TIMEOUT timeout)
+{
+	fd_set		rfds;
+	int		setsize = 0;
+	int		e;
+	struct timeval	to;
+	GET_PER_THREAD_DATA;
+	if (ptdp->evlist) {
+		DPRINTF("nxclient (fd=%d): Returning queued event\n",ptdp->clientfd);
+		GetNextQueuedEvent(ep);
+		CheckErrorEvent(ep);
+		return;
+	}
+
+	FD_ZERO(&rfds);
+	/*
+	 * This will cause a GrGetNextEvent to be sent down the wire.
+	 * If we timeout before the server responds, and then
+	 * call this procedure again, and the server has more than
+	 * one event waiting for this process, then more than one
+	 * event will be written on the socket by the server.  At
+	 * that point, a single stored event won't work, and the
+	 * client needs an event queue.
+	 */
+	GrPrepareSelect(&setsize, &rfds);
+	if (timeout) {
+		to.tv_sec = timeout / 1000;
+		to.tv_usec = (timeout % 1000) * 1000;
+	}
+
+	if((e = select(setsize+1, &rfds, NULL, NULL, timeout ? &to : NULL))>0) {
+		if(FD_ISSET(ptdp->clientfd, &rfds)) {
+			/*
+			 * This will never be GR_EVENT_NONE with the current
+			 * implementation.
+			 */
+		        GrTypedReadBlock(ep, sizeof(*ep),GrNumGetNextEvent);
+			GrCheckForClientData(ep);
+			CheckErrorEvent(ep);
+			return;
+		}
+		if(regfd != -1 && FD_ISSET(regfd, &rfds)) {
+			ep->type = GR_EVENT_TYPE_FDINPUT;
+			ep->fdinput.fd = regfd;
+			return;
+		}
+	}
+	else if (e == 0) {
+		/*
+		 * Timeout has occured. We currently return a timeout event
+		 * regardless of whether the client has selected for it.
+		 */
+		ep->type = GR_EVENT_TYPE_TIMEOUT;
+	} else {
+/* ijsung fix */
+#if 0 
+		if(errno == EINTR) {
+			ep->type = GR_EVENT_TYPE_NONE;
+		} else {
+#endif
+			EPRINTF("nxclient: select failed\n");
+			GrClose();
+			pthread_exit(NULL);
+#if 0
+		}
+#endif
+	}
+}
+
+/**
+ * GrCheckNextEvent:
+ * @ep: pointer to the GR_EVENT structure to return the event in
+ *
+ * Gets the next event from the event queue if there is one, or returns
+ * immediately with an event type of GR_EVENT_TYPE_NONE if it is empty.
+ */
+void 
+GrCheckNextEvent(GR_EVENT *ep)
+{
+	AllocReq(CheckNextEvent);
+	GrTypedReadBlock(ep, sizeof(*ep),GrNumGetNextEvent);
+	GrCheckForClientData(ep);
+	CheckErrorEvent(ep);
+}
+
+/**
+ * GrPeekEvent:
+ * @ep: pointer to the GR_EVENT structure to return the event in
+ * @Returns: 1 if an event was returned, or 0 if the queue was empty
+ *
+ * Fills in the specified event structure with a copy of the next event on the
+ * queue, without actually removing it from the queue. An event type of
+ * GR_EVENT_TYPE_NONE is given if the queue is empty.
+ */
+int 
+GrPeekEvent(GR_EVENT *ep)
+{
+	int ret;
+	GET_PER_THREAD_DATA;
+#if 0
+	if (storedevent) {
+		*ep = storedevent_data;
+		storedevent = 0;
+		return 1;
+	}
+#endif
+	if (ptdp->evlist) {
+		GetNextQueuedEvent(ep);
+		CheckErrorEvent(ep);
+		return 1;
+	}
+
+	AllocReq(PeekEvent);
+	GrTypedReadBlock(ep, sizeof(*ep),GrNumPeekEvent);
+	GrCheckForClientData(ep);
+	ret = GrReadByte();
+	CheckErrorEvent(ep);
+	return ret;
+}
+
+/**
+ * GrSelectEvents:
+ * @wid: the ID of the window to set the event mask of
+ * @eventmask: a bit field specifying the desired event mask
+ *
+ * Select the event types which should be returned for the specified window.
+ */
+void 
+GrSelectEvents(GR_WINDOW_ID wid, GR_EVENT_MASK eventmask)
+{
+	
+	nxSelectEventsReq *req;
+
+	req = AllocReq(SelectEvents);
+	req->windowid = wid;
+	req->eventmask = eventmask;
+}
+
+/**
+ * GrNewWindow:
+ * @parent: the ID of the parent window
+ * @x: the X coordinate of the new window relative to the parent window
+ * @y: the Y coordinate of the new window relative to the parent window
+ * @width: the width of the new window
+ * @height: the height of the new window
+ * @bordersize: the width of the window border
+ * @background: the colour of the window background
+ * @bordercolor: the colour of the window border
+ * @Returns: the ID of the newly created window
+ *
+ * Create a new window with the specified parent and window attributes.
+ */
+GR_WINDOW_ID
+GrNewWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, GR_SIZE bordersize, GR_COLOR background,
+	GR_COLOR bordercolor)
+{
+	nxNewWindowReq *req;
+	GR_WINDOW_ID 	wid;
+
+	req = AllocReq(NewWindow);
+	req->parentid = parent;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	req->backgroundcolor = background;
+	req->bordercolor = bordercolor;
+	req->bordersize = bordersize;
+	if(GrTypedReadBlock(&wid, sizeof(wid),GrNumNewWindow) == -1)
+		return 0;
+	return wid;
+}
+   
+   
+/**
+ * GrNewPixmap:
+ * @width: the width of the pixmap
+ * @height: the height of the pixmap
+ * @addr: currently unused in client/server mode
+ * @Returns: the ID of the newly created pixmap
+ *
+ * Create a new server side pixmap (an offscreen drawing area which can be
+ * copied into a window using a GrCopyArea call) of the specified width and
+ * height.
+ */
+/* FIXME: Add support for shared memory... */
+GR_WINDOW_ID
+GrNewPixmap(GR_SIZE width, GR_SIZE height, void *addr)
+{
+	nxNewPixmapReq *req;
+	GR_WINDOW_ID 	wid;
+
+	req = AllocReq(NewPixmap);
+	req->width = width;
+	req->height = height;
+	if(GrTypedReadBlock(&wid, sizeof(wid), GrNumNewPixmap) == -1)
+		return 0;
+	return wid;
+}
+
+/**
+ * GrNewInputWindow:
+ * @parent: the ID of the window to use as the parent of the new window
+ * @x: the X coordinate of the new window relative to the parent window
+ * @y: the Y coordinate of the new window relative to the parent window
+ * @width: the width of the new window
+ * @height: the height of the new window
+ * @Returns: the ID of the newly created window
+ *
+ * Create a new input-only window with the specified dimensions which is a
+ * child of the specified parent window.
+ */
+GR_WINDOW_ID
+GrNewInputWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height)
+{
+	nxNewInputWindowReq *req;
+	GR_WINDOW_ID 	     wid;
+
+	req = AllocReq(NewInputWindow);
+	req->parentid = parent;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	if(GrTypedReadBlock(&wid, sizeof(wid), GrNumNewInputWindow) == -1)
+		return 0;
+	return wid;
+}
+
+/**
+ * GrDestroyWindow:
+ * @wid: the ID of the window to destroy
+ *
+ * Recursively unmaps and frees the data structures associated with the
+ * specified window and all of its children.
+ */
+void 
+GrDestroyWindow(GR_WINDOW_ID wid)
+{
+	nxDestroyWindowReq *req;
+
+	req = AllocReq(DestroyWindow);
+	req->windowid = wid;
+}
+
+/**
+ * GrGetWindowInfo:
+ * @wid: the ID of the window to retrieve information about
+ * @infoptr: pointer to a GR_WINDOW_INFO structure to return the information in
+ *
+ * Fills in a GR_WINDOW_INFO structure with information regarding the window
+ * with the specified window ID.
+ */
+void 
+GrGetWindowInfo(GR_WINDOW_ID wid, GR_WINDOW_INFO *infoptr)
+{
+	nxGetWindowInfoReq *req;
+
+	req = AllocReq(GetWindowInfo);
+	req->windowid = wid;
+	GrTypedReadBlock(infoptr, sizeof(GR_WINDOW_INFO), GrNumGetWindowInfo);
+}
+
+/**
+ * GrNewGC:
+ * @Returns: the ID of the newly created graphics context or 0 on error
+ *
+ * Creates a new graphics context structure and returns the ID used to refer
+ * to it. The structure is initialised with a set of default parameters.
+ */
+GR_GC_ID 
+GrNewGC(void)
+{
+	GR_GC_ID    gc;
+
+	AllocReq(NewGC);
+	if(GrTypedReadBlock(&gc, sizeof(gc),GrNumNewGC) == -1)
+		return 0;
+	return gc;
+}
+
+/**
+ * GrCopyGC:
+ * @gc: the already existing graphics context to copy the parameters from
+ * @Returns: the ID of the newly created graphics context or 0 on error
+ *
+ * Creates a new graphics context structure and fills it in with the values
+ * from the specified already existing graphics context.
+ */
+GR_GC_ID 
+GrCopyGC(GR_GC_ID gc)
+{
+	nxCopyGCReq *req;
+	GR_GC_ID     newgc;
+
+	req = AllocReq(CopyGC);
+	req->gcid = gc;
+	if(GrTypedReadBlock(&newgc, sizeof(newgc),GrNumCopyGC) == -1)
+		return 0;
+	return newgc;
+}
+
+/**
+ * GrDestroyGC:
+ * @gc: the ID of the graphics context structure to destroy
+ *
+ * Destroys the graphics context structure with the specified ID.
+ */
+void
+GrDestroyGC(GR_GC_ID gc)
+{
+	nxDestroyGCReq *req;
+
+	req = AllocReq(DestroyGC);
+	req->gcid = gc;
+}
+
+/**
+ * GrNewRegion:
+ * @Returns: the ID of the newly created region
+ *
+ * Creates a new region structure and returns the ID used to refer to it.
+ * The structure is initialised with a set of default parameters.
+ */
+GR_REGION_ID 
+GrNewRegion(void)
+{
+	GR_REGION_ID    region;
+
+	AllocReq(NewRegion);
+	if(GrTypedReadBlock(&region, sizeof(region),GrNumNewRegion) == -1)
+		return 0;
+	return region;
+}
+
+/**
+ * GrDestroyRegion:
+ * @region: the ID of the region structure to destroy
+ *
+ * Destroys the region structure with the specified ID.
+ */
+void
+GrDestroyRegion(GR_REGION_ID region)
+{
+	nxDestroyRegionReq *req;
+
+	req = AllocReq(DestroyRegion);
+	req->regionid = region;
+}
+
+/**
+ * GrUnionRectWithRegion:
+ * @region: the ID of the region to modify
+ * @rect: a pointer to the rectangle to add to the region
+ *
+ * Makes a union of the specified region and the specified rectangle and
+ * places the result back in the source region.
+ */
+void
+GrUnionRectWithRegion(GR_REGION_ID region, GR_RECT *rect)
+{
+	nxUnionRectWithRegionReq *req;
+
+ 	req = AllocReq(UnionRectWithRegion);
+ 	if(rect)
+ 		memcpy(&req->rect, rect, sizeof(*rect));
+ 	req->regionid = region;
+}
+
+/**
+ * GrUnionRegion:
+ * @dst_rgn: the ID of the destination region
+ * @src_rgn1: the ID of the first source region
+ * @src_rgn2: the ID of the second source region
+ *
+ * Makes a union of the specified source regions and places the result in the
+ * specified destination region.
+ */
+void
+GrUnionRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxUnionRegionReq *req;
+
+ 	req = AllocReq(UnionRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/**
+ * GrSubtractRegion:
+ * @dst_rgn: the ID of the destination region
+ * @src_rgn1: the ID of the first source region
+ * @src_rgn2: the ID of the second source region
+ *
+ * Subtracts the second source region from the first source region and places
+ * the result in the specified destination region.
+ */
+void
+GrSubtractRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxSubtractRegionReq *req;
+
+ 	req = AllocReq(SubtractRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/**
+ * GrXorRegion:
+ * @dst_rgn: the ID of the destination region
+ * @src_rgn1: the ID of the first source region
+ * @src_rgn2: the ID of the second source region
+ *
+ * Performs a logical exclusive OR operation on the specified source regions
+ * and places the result in the destination region. The destination region
+ * will contain only the parts of the source regions which do not overlap.
+ */
+void
+GrXorRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxXorRegionReq *req;
+
+ 	req = AllocReq(XorRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/**
+ * GrIntersectRegion:
+ * @dst_rgn: the ID of the destination region
+ * @src_rgn1: the ID of the first source region
+ * @src_rgn2: the ID of the second source region
+ *
+ * Calculates the intersection of the two specified source regions and places
+ * the result in the specified destination region. The destination region
+ * will contain only the parts of the source regions which overlap each other.
+ */
+void
+GrIntersectRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxIntersectRegionReq *req;
+
+ 	req = AllocReq(IntersectRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/**
+ * GrSetGCRegion:
+ * @gc: the ID of the graphics context to set the clip mask of
+ * @region: the ID of the region to use as the clip mask
+ *
+ * Sets the clip mask of the specified graphics context to the specified
+ * region. Subsequent drawing operations using this graphics context will not
+ * draw outside the specified region. The region ID can be set to 0 to remove
+ * the clipping region from the specified graphics context.
+ */
+void
+GrSetGCRegion(GR_GC_ID gc, GR_REGION_ID region)
+{
+	nxSetGCRegionReq *req;
+	
+	req = AllocReq(SetGCRegion);
+	req->gcid = gc;
+	req->regionid = region;
+}
+
+/**
+ * GrPointInRegion:
+ * @region: the ID of the region to examine
+ * @x: the X coordinate of the point to test for
+ * @y: the Y coordinate of the point to test for
+ * @Returns: True if the point is within the region, or False otherwise
+ *
+ * Tests whether the specified point is within the specified region, and
+ * then returns either True or False depending on the result.
+ */
+GR_BOOL
+GrPointInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y)
+{
+	nxPointInRegionReq *req;
+	GR_BOOL             ret_value;
+
+	req = AllocReq(PointInRegion);
+	req->regionid = region;
+	req->x = x;
+	req->y = y;
+	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumPointInRegion) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/**
+ * GrRectInRegion:
+ * @region: the ID of the region to examine
+ * @x: the X coordinates of the rectangle to test
+ * @y: the Y coordinates of the rectangle to test
+ * @w: the width of the rectangle to test
+ * @h: the height of the rectangle to test
+ * @Returns: GR_RECT_PARTIN, GR_RECT_ALLIN, or GR_RECT_OUT
+ *
+ * Tests whether the specified rectangle is contained within the specified
+ * region. Returns GR_RECT_OUT if it is not inside it at all, GR_RECT_ALLIN
+ * if it is completely contained within the region, or GR_RECT_PARTIN if
+ * it is partially contained within the region.
+ */
+int
+GrRectInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y, GR_COORD w,
+	GR_COORD h)
+{
+	nxRectInRegionReq *req;
+	unsigned short	   ret_value;
+	
+	req = AllocReq(RectInRegion);
+	req->regionid = region;
+	req->x = x;
+	req->y = y;
+	req->w = w;
+	req->h = h;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumRectInRegion) == -1)
+		return 0;
+	return (int)ret_value;
+}
+
+/**
+ * GrEmptyRegion:
+ * @region: the ID of the region to examine
+ * @Returns: GR_TRUE if the region is empty, or GR_FALSE if it is not
+ *
+ * Determines whether the specified region is empty, and returns GR_TRUE
+ * if it is, or GR_FALSE otherwise.
+ */
+GR_BOOL
+GrEmptyRegion(GR_REGION_ID region)
+{
+	nxEmptyRegionReq *req;
+	GR_BOOL 	  ret_value;
+	
+	req = AllocReq(EmptyRegion);
+	req->regionid = region;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumEmptyRegion) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/**
+ * GrEqualRegion:
+ * @rgn1: the ID of the first region to examine
+ * @rgn2: the ID of the second region to examine
+ * @Returns: GR_TRUE if the regions are equal, or GR_FALSE otherwise
+ *
+ * Determines whether the specified regions are identical, and returns GR_TRUE
+ * if it is, or GR_FALSE otherwise.
+ */
+GR_BOOL
+GrEqualRegion(GR_REGION_ID rgn1, GR_REGION_ID rgn2)
+{
+	nxEqualRegionReq *req;
+	GR_BOOL 	  ret_value;
+	
+	req = AllocReq(EqualRegion);
+	req->region1 = rgn1;
+	req->region2 = rgn2;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumEqualRegion) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/**
+ * GrOffsetRegion:
+ * @region: the ID of the region to offset
+ * @dx: the distance to offset the region by in the X axis
+ * @dy: the distance to offset the region by in the Y axis
+ *
+ * Offsets the specified region by the specified distance.
+ */
+void
+GrOffsetRegion(GR_REGION_ID region, GR_SIZE dx, GR_SIZE dy)
+{
+	nxOffsetRegionReq *req;
+	
+	req = AllocReq(OffsetRegion);
+	req->region = region;
+	req->dx = dx;
+	req->dy = dy;
+}
+
+/**
+ * GrGetRegionBox:
+ * @region: the ID of the region to get the bounding box of
+ * @rect: pointer to a rectangle structure
+ * @Returns: the region type
+ *
+ * Fills in the specified rectangle structure with a bounding box that would
+ * completely enclose the specified region, and also returns the type of the
+ * specified region. 
+ */
+int
+GrGetRegionBox(GR_REGION_ID region, GR_RECT *rect)
+{
+	nxGetRegionBoxReq *req;
+	unsigned short	   ret_value;
+	
+	if (!rect)
+		return GR_FALSE;
+	req = AllocReq(GetRegionBox);
+	req->regionid = region;
+ 	if(GrTypedReadBlock(rect, sizeof(*rect), GrNumGetRegionBox) == -1)
+		return GR_FALSE;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumGetRegionBox) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/**
+ * GrNewPolygonRegion:
+ * @mode: the polygon mode to use (GR_POLY_EVENODD or GR_POLY_WINDING)
+ * @count: the number of points in the polygon
+ * @points: pointer to an array of point structures describing the polygon
+ * @Returns: the ID of the newly allocated region structure, or 0 on error
+ *
+ * Creates a new region structure, fills it with the region described by the
+ * specified polygon, and returns the ID used to refer to it.
+ */
+GR_REGION_ID 
+GrNewPolygonRegion(int mode, GR_COUNT count, GR_POINT *points)
+{
+	nxNewPolygonRegionReq	*req;
+	long			size;
+	GR_REGION_ID		region;
+
+	if(count == 0)
+		return GrNewRegion();
+	
+	if(points == NULL)
+		return 0;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(NewPolygonRegion, size);
+	req->mode = mode;
+	/* FIXME: unportable method, depends on sizeof(int) in GR_POINT*/
+	memcpy(GetReqData(req), points, size);
+
+	if(GrTypedReadBlock(&region, sizeof(region),
+		GrNumNewPolygonRegion) == -1)
+		return 0;
+	return region;
+}
+
+/**
+ * GrMapWindow:
+ * @wid: the ID of the window to map
+ *
+ * Recursively maps (makes visible) the specified window and all of the
+ * child windows which have a sufficient map count. The border and background
+ * of the window are painted, and an exposure event is generated for the
+ * window and every child which becomes visible.
+ */
+void 
+GrMapWindow(GR_WINDOW_ID wid)
+{
+	nxMapWindowReq *req;
+	req = AllocReq(MapWindow);
+	req->windowid = wid;
+}
+
+/**
+ * GrUnmapWindow:
+ * @wid: the ID of the window to unmap
+ *
+ * Recursively unmaps (makes invisible) the specified window and all of the
+ * child windows.
+ */
+void 
+GrUnmapWindow(GR_WINDOW_ID wid)
+{
+	nxUnmapWindowReq *req;
+
+	req = AllocReq(UnmapWindow);
+	req->windowid = wid;
+}
+
+/**
+ * GrRaiseWindow:
+ * @wid: the ID of the window to raise
+ *
+ * Places the specified window at the top of its parents drawing stack, above
+ * all of its sibling windows.
+ */
+void 
+GrRaiseWindow(GR_WINDOW_ID wid)
+{
+	nxRaiseWindowReq *req;
+
+	req = AllocReq(RaiseWindow);
+	req->windowid = wid;
+}
+
+/**
+ * GrLowerWindow:
+ * @wid: the ID of the window to lower
+ *
+ * Places the specified window at the bottom of its parents drawing stack,
+ * below all of its sibling windows.
+ */
+void 
+GrLowerWindow(GR_WINDOW_ID wid)
+{
+	nxLowerWindowReq *req;
+
+	req = AllocReq(LowerWindow);
+	req->windowid = wid;
+}
+
+/**
+ * GrMoveWindow:
+ * @wid: the ID of the window to move
+ * @x: the X coordinate to move the window to relative to its parent.
+ * @y: the Y coordinate to move the window to relative to its parent.
+ * 
+ * Moves the specified window to the specified position relative to its
+ * parent window.
+ */
+void 
+GrMoveWindow(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y)
+{
+	nxMoveWindowReq *req;
+
+	req = AllocReq(MoveWindow);
+	req->windowid = wid;
+	req->x = x;
+	req->y = y;
+}
+
+/**
+ * GrResizeWindow:
+ * @wid: the ID of the window to resize
+ * @width: the width to resize the window to
+ * @height: the height to resize the window to
+ *
+ * Resizes the specified window to be the specified width and height.
+ */
+void 
+GrResizeWindow(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height)
+{
+	nxResizeWindowReq *req;
+
+	req = AllocReq(ResizeWindow);
+	req->windowid = wid;
+	req->width = width;
+	req->height = height;
+}
+
+/**
+ * GrReparentWindow:
+ * @wid: the ID of the window to reparent
+ * @pwid: the ID of the new parent window
+ * @x: the X coordinate to place the window at relative to the new parent
+ * @y: the Y coordinate to place the window at relative to the new parent
+ *
+ * Changes the parent window of the specified window to the specified parent
+ * window and places it at the specified coordinates relative to the new
+ * parent.
+ */
+void 
+GrReparentWindow(GR_WINDOW_ID wid, GR_WINDOW_ID pwid, GR_COORD x, GR_COORD y)
+{
+	nxReparentWindowReq *req;
+
+	req = AllocReq(ReparentWindow);
+	req->windowid = wid;
+	req->parentid = pwid;
+	req->x = x;
+	req->y = y;
+}
+
+/**
+ * GrClearWindow:
+ * @wid: the ID of the window to clear
+ * @exposeflag: a flag indicating whether to also generate an exposure event
+ *
+ * Clears the specified window by setting it to its background color.
+ * If the exposeflag parameter is non zero, an exposure event is generated for
+ * the window after it has been cleared.
+ */
+void 
+GrClearWindow(GR_WINDOW_ID wid, GR_BOOL exposeflag)
+{
+	nxClearWindowReq *req;
+
+	req = AllocReq(ClearWindow);
+	req->windowid = wid;
+	req->exposeflag = exposeflag;
+}
+
+/**
+ * GrGetFocus:
+ * @Returns: the ID of the window which currently has the keyboard focus
+ *
+ * Returns the ID of the window which currently has the keyboard focus.
+ */
+GR_WINDOW_ID
+GrGetFocus(void)
+{
+	GR_WINDOW_ID    wid;
+
+	AllocReq(GetFocus);
+	if(GrTypedReadBlock(&wid, sizeof(wid), GrNumGetFocus) == -1)
+		return 0;
+	return wid;
+}
+
+/**
+ * GrSetFocus:
+ * @wid: the ID of the window to set the focus to
+ *
+ * Sets the keyboard focus to the specified window.
+ */
+void 
+GrSetFocus(GR_WINDOW_ID wid)
+{
+	nxSetFocusReq *req;
+
+	req = AllocReq(SetFocus);
+	req->windowid = wid;
+}
+
+/**
+ * GrSetBorderColor:
+ * @wid: the ID of the window to set the border colour of
+ * @colour: the colour to set the border to
+ *
+ * Sets the border colour of the specified window to the specified colour.
+ */
+void 
+GrSetBorderColor(GR_WINDOW_ID wid, GR_COLOR colour)
+{
+	nxSetBorderColorReq *req;
+
+	req = AllocReq(SetBorderColor);
+	req->windowid = wid;
+	req->color = colour;
+}
+
+/**
+ * GrSetCursor:
+ * @wid: the ID of the window to set the cursor of
+ * @width: the width of the pointer bitmap
+ * @height: the height of the pointer bitmap
+ * @hotx: the X coordinate within the bitmap used as the target of the pointer
+ * @hoty: the Y coordinate within the bitmap used as the target of the pointer
+ * @foreground: the colour to use for the foreground of the pointer
+ * @background: the colour to use for the background of the pointer
+ * @fgbitmap: pointer to bitmap data specifying the foreground of the pointer
+ * @bgbitmap: pointer to bitmap data specifying the background of the pointer
+ *
+ * Specifies a cursor (mouse pointer graphic) to display when the mouse
+ * pointer is over the specified window and subsequently created children.
+ * Points in the bitmap which have neither the foreground or background bits
+ * set are not painted.
+ */
+void
+GrSetCursor(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height, GR_COORD hotx,
+	GR_COORD hoty, GR_COLOR foreground, GR_COLOR background,
+	GR_BITMAP *fgbitmap, GR_BITMAP *bgbitmap)
+{
+	nxSetCursorReq *req;
+	int 	     	bitmapsize;
+	char *	     	data;
+
+	bitmapsize = GR_BITMAP_SIZE(width, height) * sizeof(GR_BITMAP);
+	req = AllocReqExtra(SetCursor, bitmapsize*2);
+	req->windowid = wid;
+	req->width = width;
+	req->height = height;
+	req->hotx = hotx;
+	req->hoty = hoty;
+	req->fgcolor = foreground;
+	req->bgcolor = background;
+	//req->flags = flags;
+	data = GetReqData(req);
+	memcpy(data, fgbitmap, bitmapsize);
+	memcpy(data+bitmapsize, bgbitmap, bitmapsize);
+}
+
+/**
+ * GrMoveCursor:
+ * @x: the X coordinate to move the pointer to
+ * @y: the Y coordinate to move the pointer to
+ *
+ * Moves the cursor (mouse pointer) to the specified coordinates.
+ * The coordinates are relative to the root window, where (0,0) is the upper
+ * left hand corner of the screen. The reference point used for the pointer
+ * is that of the "hot spot". After moving the pointer, the graphic used for
+ * the pointer will change to the graphic defined for use in the window which
+ * it is over.
+ */
+void 
+GrMoveCursor(GR_COORD x, GR_COORD y)
+{
+	nxMoveCursorReq *req;
+
+	req = AllocReq(MoveCursor);
+	req->x = x;
+	req->y = y;
+}
+
+/**
+ * GrSetGCForeground:
+ * @gc: the ID of the graphics context to set the foreground colour of
+ * @foreground: the colour to use as the new foreground colour
+ *
+ * Changes the foreground colour of the specified graphics context to the
+ * specified colour.
+ */
+void 
+GrSetGCForeground(GR_GC_ID gc, GR_COLOR foreground)
+{
+	nxSetGCForegroundReq *req;
+
+	req = AllocReq(SetGCForeground);
+	req->gcid = gc;
+	req->color = foreground;
+}
+
+/**
+ * GrSetGCBackground:
+ * @gc: the ID of the graphics context to set the background colour of
+ * @background: the colour to use as the new background colour
+ *
+ * Changes the background colour of the specified graphics context to the
+ * specified colour.
+ */
+void 
+GrSetGCBackground(GR_GC_ID gc, GR_COLOR background)
+{
+	nxSetGCBackgroundReq *req;
+
+	req = AllocReq(SetGCBackground);
+	req->gcid = gc;
+	req->color = background;
+}
+
+/**
+ * GrSetGCMode:
+ * @gc: the ID of the graphics context to set the drawing mode of
+ * @mode: the new drawing mode
+ *
+ * Changes the drawing mode (SET, XOR, OR, AND, etc.) of the specified
+ * graphics context to the specified mode.
+ */
+void 
+GrSetGCMode(GR_GC_ID gc, int mode)
+{
+	nxSetGCModeReq *req;
+
+	req = AllocReq(SetGCMode);
+	req->gcid = gc;
+	req->mode = mode;
+}
+
+/**
+ * GrSetGCUseBackground:
+ * @gc: the ID of the graphics context to change the "use background" flag of
+ * @flag: flag specifying whether to use the background colour or not
+ *
+ * Sets the flag which chooses whether or not the background colour is used
+ * when drawing bitmaps and text using the specified graphics context to the
+ * specified value.
+ */
+void 
+GrSetGCUseBackground(GR_GC_ID gc, GR_BOOL flag)
+{
+	nxSetGCUseBackgroundReq *req;
+
+	req = AllocReq(SetGCUseBackground);
+	req->gcid = gc;
+	req->flag = flag;
+}
+
+/**
+ * GrCreateFont:
+ * @name: string containing the name of a built in font to look for
+ * @height: the desired height of the font
+ * @plogfont: pointer to a LOGFONT structure
+ * @Returns: a font ID number which can be used to refer to the font
+ *
+ * Attempts to locate a font with the desired attributes and returns a font
+ * ID number which can be used to refer to it. If the plogfont argument is
+ * not NULL, the values in that structure will be used to choose a font.
+ * Otherwise, if the height is non zero, the built in font with the closest
+ * height to that specified will be used. If the height is zero, the built
+ * in font with the specified name will be used. If the desired font is not
+ * found, the first built in font will be returned as a last resort.
+ */
+GR_FONT_ID
+GrCreateFont(GR_CHAR *name, GR_COORD height, GR_LOGFONT *plogfont)
+{
+	nxCreateFontReq *req;
+	GR_FONT_ID	fontid;
+
+ 	req = AllocReq(CreateFont);
+ 	if (plogfont) {
+ 		memcpy(&req->lf, plogfont, sizeof(*plogfont));
+ 		req->height = 0;
+ 		req->lf_used = 1;
+ 	} else {
+		if (name)
+			strcpy(req->lf.lfFaceName, name);
+		else req->lf.lfFaceName[0] = '\0';
+  		req->height = height;
+ 		req->lf_used = 0;
+	}
+  
+	if(GrTypedReadBlock(&fontid, sizeof(fontid),GrNumCreateFont) == -1)
+		return 0;
+	return fontid;
+}
+
+/**
+ * GrSetFontSize:
+ * @fontid: the ID number of the font to change the size of
+ * @fontsize: the size to change the font to
+ *
+ * Changes the size of the specified font to the specified size.
+ */
+void
+GrSetFontSize(GR_FONT_ID fontid, GR_COORD fontsize)
+{
+	nxSetFontSizeReq *req;
+
+	req = AllocReq(SetFontSize);
+	req->fontid = fontid;
+	req->fontsize = fontsize;
+}
+
+/**
+ * GrSetFontRotation:
+ * @fontid: the ID number of the font to rotate
+ * @tenthdegrees: the angle to set the rotation to in tenths of a degree
+ *
+ * Changes the rotation of the specified font to the specified angle.
+ */
+void
+GrSetFontRotation(GR_FONT_ID fontid, int tenthdegrees)
+{
+	nxSetFontRotationReq *req;
+
+	req = AllocReq(SetFontRotation);
+	req->fontid = fontid;
+	req->tenthdegrees = tenthdegrees;
+}
+
+/**
+ * GrSetFontAttr:
+ * @fontid: the ID of the font to set the attributes of
+ * @setflags: mask specifying attribute flags to set
+ * @clrflags: mask specifying attribute flags to clear
+ *
+ * Changes the attributes (GR_TFKERNING, GR_TFANTIALIAS, GR_TFUNDERLINE, etc.)
+ * of the specified font according to the set and clear mask arguments.
+ */
+void
+GrSetFontAttr(GR_FONT_ID fontid, int setflags, int clrflags)
+{
+	nxSetFontAttrReq *req;
+
+	req = AllocReq(SetFontAttr);
+	req->fontid = fontid;
+	req->setflags = setflags;
+	req->clrflags = clrflags;
+}
+
+/**
+ * GrDestroyFont:
+ * @fontid: the ID of the font to destroy
+ *
+ * Frees all resources associated with the specified font ID, and if the font
+ * is a non built in type and this is the last ID referring to it, unloads the
+ * font from memory.
+ */
+void
+GrDestroyFont(GR_FONT_ID fontid)
+{
+	nxDestroyFontReq *req;
+
+	req = AllocReq(DestroyFont);
+	req->fontid = fontid;
+}
+
+/**
+ * GrSetGCFont:
+ * @gc: the ID of the graphics context to set the font of
+ * @font: the ID of the font
+ *
+ * Sets the font to be used for text drawing in the specified graphics
+ * context to the specified font ID.
+ */
+void
+GrSetGCFont(GR_GC_ID gc, GR_FONT_ID font)
+{
+	nxSetGCFontReq *req;
+
+	req = AllocReq(SetGCFont);
+	req->gcid = gc;
+	req->fontid = font;
+}
+
+/**
+ * GrLine:
+ * @id: the ID of the drawable to draw the line on
+ * @gc: the ID of the graphics context to use when drawing the line
+ * @x1: the X coordinate of the start of the line relative to the drawable
+ * @y1: the Y coordinate of the start of the line relative to the drawable
+ * @x2: the X coordinate of the end of the line relative to the drawable
+ * @y2: the Y coordinate of the end of the line relative to the drawable
+ *
+ * Draws a line using the specified graphics context on the specified drawable
+ * from (x1, y1) to (x2, y2), with coordinates given relative to the drawable.
+ */
+void 
+GrLine(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x1, GR_COORD y1, GR_COORD x2,
+	GR_COORD y2)
+{
+	nxLineReq *req;
+
+	req = AllocReq(Line);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x1 = x1;
+	req->y1 = y1;
+	req->x2 = x2;
+	req->y2 = y2;
+}
+
+/**
+ * GrRect:
+ * @id: the ID of the drawable to draw the rectangle on
+ * @gc: the ID of the graphics context to use when drawing the rectangle
+ * @x: the X coordinate of the rectangle relative to the drawable
+ * @y: the Y coordinate of the rectangle relative to the drawable
+ * @width: the width of the rectangle
+ * @height: the height of the rectangle
+ *
+ * Draw the boundary of a rectangle of the specified dimensions and position
+ * on the specified drawable using the specified graphics context.
+ */
+void 
+GrRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height)
+{
+	nxRectReq *req;
+
+	req = AllocReq(Rect);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+}
+
+/**
+ * GrFillRect:
+ * @id: the ID of the drawable to draw the rectangle on
+ * @gc: the ID of the graphics context to use when drawing the rectangle
+ * @x: the X coordinate of the rectangle relative to the drawable
+ * @y: the Y coordinate of the rectangle relative to the drawable
+ * @width: the width of the rectangle
+ * @height: the height of the rectangle
+ *
+ * Draw a filled rectangle of the specified dimensions and position on the
+ * specified drawable using the specified graphics context.
+ */
+void 
+GrFillRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height)
+{
+	nxFillRectReq *req;
+
+	req = AllocReq(FillRect);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+}
+
+/**
+ * GrEllipse:
+ * @id: the ID of the drawable to draw the ellipse on
+ * @gc: the ID of the graphics context to use when drawing the ellipse
+ * @x: the X coordinate to draw the ellipse at relative to the drawable
+ * @y: the Y coordinate to draw the ellipse at relative to the drawable
+ * @rx: the radius of the ellipse on the X axis
+ * @ry: the radius of the ellipse on the Y axis
+ *
+ * Draws the boundary of ellipse at the specified position using the specified
+ * dimensions and graphics context on the specified drawable.
+ */
+void 
+GrEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx,
+	GR_SIZE ry)
+{
+	nxEllipseReq *req;
+
+	req = AllocReq(Ellipse);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+}
+
+/**
+ * GrFillEllipse:
+ * @id: the ID of the drawable to draw the filled ellipse on
+ * @gc: the ID of the graphics context to use when drawing the ellipse
+ * @x: the X coordinate to draw the ellipse at relative to the drawable
+ * @y: the Y coordinate to draw the ellipse at relative to the drawable
+ * @rx: the radius of the ellipse on the X axis
+ * @ry: the radius of the ellipse on the Y axis
+ *
+ * Draws a filled ellipse at the specified position using the specified
+ * dimensions and graphics context on the specified drawable.
+ */
+void 
+GrFillEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry)
+{
+	nxFillEllipseReq *req;
+
+	req = AllocReq(FillEllipse);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+}
+
+/**
+ * GrArc:
+ * @id: the ID of the drawable to draw the arc on
+ * @gc: the graphics context to use when drawing the arc
+ * @x: the X coordinate to draw the arc at relative to the drawable
+ * @y: the Y coordinate to draw the arc at relative to the drawable
+ * @rx: the radius of the arc on the X axis
+ * @ry: the radius of the arc on the Y axis
+ * @ax: the X coordinate of the start of the arc relative to the drawable
+ * @ay: the Y coordinate of the start of the arc relative to the drawable
+ * @bx: the X coordinate of the end of the arc relative to the drawable
+ * @by: the Y coordinate of the end of the arc relative to the drawable
+ * @type: the fill style to use when drawing the arc
+ *
+ * Draws an arc with the specified dimensions at the specified position
+ * on the specified drawable using the specified graphics context.
+ * The type specifies the fill type. Possible values include GR_ARC and
+ * GR_PIE.
+ */
+void	
+GrArc(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry, GR_COORD ax, GR_COORD ay,
+	GR_COORD bx, GR_COORD by, int type)
+{
+	nxArcReq *req;
+
+	req = AllocReq(Arc);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+	req->ax = ax;
+	req->ay = ay;
+	req->bx = bx;
+	req->by = by;
+	req->type = type;
+}
+
+/**
+ * GrArcAngle:
+ * @id: the ID of the drawable to draw the arc on
+ * @gc: the graphics context to use when drawing the arc
+ * @x: the X coordinate to draw the arc at relative to the drawable
+ * @y: the Y coordinate to draw the arc at relative to the drawable
+ * @rx: the radius of the arc on the X axis
+ * @ry: the radius of the arc on the Y axis
+ * @angle1: the angle of the start of the arc
+ * @angle2: the angle of the end of the arc
+ * @type: the fill style to use when drawing the arc
+ *
+ * Draws an arc with the specified dimensions at the specified position
+ * on the specified drawable using the specified graphics context.
+ * The type specifies the fill type. Possible values include GR_ARC and
+ * GR_PIE. This function requires floating point support, and is slightly
+ * slower than the GrArc() function which does not require floating point.
+ */
+void
+GrArcAngle(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry, GR_COORD angle1, GR_COORD angle2, int type)
+{
+	nxArcAngleReq *req;
+
+	req = AllocReq(ArcAngle);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+	req->angle1 = angle1;
+	req->angle2 = angle2;
+	req->type = type;
+}
+
+/**
+ * GrBitmap:
+ * @id: the ID of the drawable to draw the bitmap onto
+ * @gc: the ID of the graphics context to use when drawing the bitmap
+ * @x: the X coordinate to draw the bitmap at relative to the drawable
+ * @y: the Y coordinate to draw the bitmap at relative to the drawable
+ * @width: the width of the bitmap
+ * @height: the height of the bitmap
+ * @bitmaptable: pointer to the bitmap data
+ *
+ * Draws the monochrome bitmap data provided in the bitmaptable argument
+ * at the specified position on the specified drawable using the specified
+ * graphics context. Note that the bitmap data should be an array of aligned
+ * 16 bit words. The usebackground flag in the graphics context specifies
+ * whether to draw the background colour wherever a bit value is zero.
+ */
+void 
+GrBitmap(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, GR_BITMAP *bitmaptable)
+{
+	nxBitmapReq *req;
+	long 	     bitmapsize;
+
+	bitmapsize = (long)GR_BITMAP_SIZE(width, height) * sizeof(GR_BITMAP);
+	req = AllocReqExtra(Bitmap, bitmapsize);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	memcpy(GetReqData(req), bitmaptable, bitmapsize);
+}
+
+/**
+ * GrDrawImageBits:
+ * @id: the ID of the drawable to draw the image onto
+ * @gc: the ID of the graphics context to use when drawing the image
+ * @x: the X coordinate to draw the image at relative to the drawable
+ * @y: the Y coordinate to draw the image at relative to the drawable
+ * @pimage: pointer to the image structure
+ *
+ * Draws the image contained in the specified image structure onto the
+ * specified drawable at the specified coordinates using the specified
+ * graphics context.
+ */
+void
+GrDrawImageBits(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_IMAGE_HDR *pimage)
+{
+	nxDrawImageBitsReq	*req;
+	int			imagesize;
+	int			palsize;
+	char			*addr;
+
+	imagesize = pimage->pitch * pimage->height;
+	palsize = pimage->palsize * sizeof(MWPALENTRY);
+	req = AllocReqExtra(DrawImageBits, imagesize + palsize);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	/* fill MWIMAGEHDR items passed externally*/
+	req->width = pimage->width;
+	req->height = pimage->height;
+	req->planes = pimage->planes;
+	req->bpp = pimage->bpp;
+	req->pitch = pimage->pitch;
+	req->bytesperpixel = pimage->bytesperpixel;
+	req->compression = pimage->compression;
+	req->palsize = pimage->palsize;
+	req->transcolor = pimage->transcolor;
+	addr = GetReqData(req);
+	memcpy(addr, pimage->imagebits, imagesize);
+	memcpy(addr+imagesize, pimage->palette, palsize);
+}
+
+/**
+ * GrDrawImageFromFile:
+ * @id: the ID of the drawable to draw the image onto
+ * @gc: the ID of the graphics context to use when drawing the image
+ * @x: the X coordinate to draw the image at relative to the drawable
+ * @y: the Y coordinate to draw the image at relative to the drawable
+ * @width: the maximum image width
+ * @height: the maximum image height
+ * @path: string containing the filename of the image to load
+ * @flags: flags specific to the particular image loader
+ *
+ * Loads the specified image file and draws it at the specified position
+ * on the specified drawable using the specified graphics context. The
+ * width and height values specify the size of the image to draw- if the
+ * actual image is a different size, it will be scaled to fit. The image type
+ * is automatically detected using the magic numbers in the image header (ie.
+ * the filename extension is irrelevant). The currently supported image types
+ * include GIF, JPEG, Windows BMP, PNG, XPM, and both ascii and binary
+ * variants of PBM, PGM, and PPM. However the image types supported by a
+ * particular server depend on which image types were enabled in the server
+ * configuration at build time. 
+ */
+void
+GrDrawImageFromFile(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, char* path, int flags)
+{
+	nxDrawImageFromFileReq *req;
+
+	req = AllocReqExtra(DrawImageFromFile, strlen(path)+1);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	req->flags = flags;
+	memcpy(GetReqData(req), path, strlen(path)+1);
+}
+
+/**
+ * GrLoadImageFromFile:
+ * @path: string containing the filename of the image to load
+ * @flags: flags specific to the particular image loader
+ * @Returns: ID of the image buffer the image was loaded into
+ *
+ * Loads the specified image file into a newly created server image buffer
+ * and returns the ID of the buffer. The image type is automatically detected
+ * using the magic numbers in the image header (ie. the filename extension is
+ * irrelevant). The currently supported image types include GIF, JPEG, Windows
+ * BMP, PNG, XPM, and both ascii and binary variants of PBM, PGM, and PPM.
+ * However the image types supported by a particular server depend on which
+ * image types were enabled in the server configuration at build time. 
+ */
+GR_IMAGE_ID
+GrLoadImageFromFile(char *path, int flags)
+{
+	nxLoadImageFromFileReq *req;
+	GR_IMAGE_ID		imageid;
+
+	req = AllocReqExtra(LoadImageFromFile, strlen(path)+1);
+	req->flags = flags;
+	memcpy(GetReqData(req), path, strlen(path)+1);
+
+	if(GrTypedReadBlock(&imageid, sizeof(imageid),
+		GrNumLoadImageFromFile) == -1)
+		return 0;
+	return imageid;
+}
+
+/**
+ * GrDrawImageToFit:
+ * @id: the ID of the drawable to draw the image onto
+ * @gc: the ID of the graphics context to use when drawing the image
+ * @x: the X coordinate to draw the image at relative to the drawable
+ * @y: the Y coordinate to draw the image at relative to the drawable
+ * @width: the maximum image width
+ * @height: the maximum image height
+ * @imageid: the ID of the image buffer containing the image to display
+ *
+ * Draws the image from the specified image buffer at the specified position
+ * on the specified drawable using the specified graphics context. The
+ * width and height values specify the size of the image to draw- if the
+ * actual image is a different size, it will be scaled to fit.
+ */ 
+void
+GrDrawImageToFit(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, GR_IMAGE_ID imageid)
+{
+	nxDrawImageToFitReq *req;
+
+	req = AllocReq(DrawImageToFit);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	req->imageid = imageid;
+}
+
+/**
+ * GrFreeImage:
+ * @id: ID of the image buffer to free
+ *
+ * Destroys the specified image buffer and reclaims the memory used by it.
+ */
+void
+GrFreeImage(GR_IMAGE_ID id)
+{
+	nxFreeImageReq *req;
+
+	req = AllocReq(FreeImage);
+	req->id = id;
+}
+
+/**
+ * GrGetImageInfo:
+ * @id: ID of an image buffer
+ * @iip: pointer to a GR_IMAGE_INFO structure
+ *
+ * Fills in the specified image information structure with the details of the
+ * specified image buffer.
+ */
+void
+GrGetImageInfo(GR_IMAGE_ID id, GR_IMAGE_INFO *iip)
+{
+	nxGetImageInfoReq *req;
+
+	req = AllocReq(GetImageInfo);
+	req->id = id;
+	GrTypedReadBlock(iip, sizeof(GR_IMAGE_INFO), GrNumGetImageInfo);
+}
+
+/*
+ * Draw a rectangular area in the specified drawable using the specified
+ * graphics context.  This differs from rectangle drawing in that the
+ * color values for each pixel in the rectangle are specified.
+ * The color table is indexed
+ * row by row.  Values whose color matches the background color are only
+ * written if the usebackground flag is set in the GC.
+ *
+ * The pixels are packed according to pixtype:
+ *
+ * pixtype		array of
+ * MWPF_RGB		MWCOLORVAL (unsigned long)
+ * MWPF_PIXELVAL	MWPIXELVAL (compile-time dependent)
+ * MWPF_PALETTE		unsigned char
+ * MWPF_TRUECOLOR0888	unsigned long
+ * MWPF_TRUECOLOR888	packed struct {char r,char g,char b} (24 bits)
+ * MWPF_TRUECOLOR565	unsigned short
+ * MWPF_TRUECOLOR555	unsigned short
+ * MWPF_TRUECOLOR332	unsigned char
+ */
+/**
+ * GrArea:
+ * @id: the ID of the drawable to draw the area onto
+ * @gc: the ID of the graphics context to use when drawing the area
+ * @x: the X coordinate to draw the area at relative to the drawable
+ * @y: the Y coordinate to draw the area at relative to the drawable
+ * @width: the width of the area
+ * @height: the height of the area
+ * @pixels: pointer to an array containing the pixel data
+ * @pixtype: the format of the pixel data
+ *
+ * Draws the specified pixel array of the specified size and format onto the
+ * specified drawable using the specified graphics context at the specified
+ * position. Note that colour conversion is currently only performed when using
+ * the GR_PF_RGB format, which is an unsigned long containing RGBX data.
+ */
+void 
+GrArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, void *pixels, int pixtype)
+{
+	nxAreaReq *req;
+	long       size;
+	long       chunk_y;
+	int        pixsize;
+
+	/* Calculate size of packed pixels*/
+	switch(pixtype) {
+	case MWPF_RGB:
+		pixsize = sizeof(MWCOLORVAL);
+		break;
+	case MWPF_PIXELVAL:
+		pixsize = sizeof(MWPIXELVAL);
+		break;
+	case MWPF_PALETTE:
+	case MWPF_TRUECOLOR332:
+		pixsize = sizeof(unsigned char);
+		break;
+	case MWPF_TRUECOLOR0888:
+		pixsize = sizeof(unsigned long);
+		break;
+	case MWPF_TRUECOLOR888:
+		pixsize = 3;
+		break;
+	case MWPF_TRUECOLOR565:
+	case MWPF_TRUECOLOR555:
+		pixsize = sizeof(unsigned short);
+		break;
+	default:
+		return;
+	}
+
+	/* Break request into MAXREQUESTSZ size packets*/
+	while(height > 0) {
+		chunk_y = (MAXREQUESTSZ - sizeof(nxAreaReq)) /
+			((long)width * pixsize);
+		if(chunk_y > height)
+			chunk_y = height;
+		size = chunk_y * ((long)width * pixsize);
+		req = AllocReqExtra(Area, size);
+		req->drawid = id;
+		req->gcid = gc;
+		req->x = x;
+		req->y = y;
+		req->width = width;
+		req->height = chunk_y;
+		req->pixtype = pixtype;
+		memcpy(GetReqData(req), pixels, size);
+		pixels = (void *)(((char *)pixels) + size);
+		y += chunk_y;
+		height -= chunk_y;
+	}
+}
+
+/**
+ * GrCopyArea:
+ * @id: the ID of the drawable to copy the area to
+ * @gc: the ID of the graphics context to use when copying the area
+ * @x: the X coordinate to copy the area to within the destination drawable
+ * @y: the Y coordinate to copy the area to within the destination drawable
+ * @width: the width of the area to copy
+ * @height: the height of the area to copy
+ * @srcid: the ID of the drawable to copy the area from
+ * @srcx: the X coordinate to copy the area from within the source drawable
+ * @srcy: the Y coordinate to copy the area from within the source drawable
+ * @op: the ROP codes to pass to the blitter when performing the copy
+ *
+ * Copies the specified area of the specified size between the specified
+ * drawables at the specified positions using the specified graphics context
+ * and ROP codes. 0 is a sensible default ROP code in most cases.
+ */
+void
+GrCopyArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, GR_DRAW_ID srcid,
+	GR_COORD srcx, GR_COORD srcy, int op)
+{
+	nxCopyAreaReq *req;
+
+        req = AllocReq(CopyArea);
+        req->drawid = id;
+        req->gcid = gc;
+        req->x = x;
+        req->y = y;
+        req->width = width;
+        req->height = height;
+        req->srcid = srcid;
+        req->srcx = srcx;
+        req->srcy = srcy;
+        req->op = op;
+}
+   
+   
+/**
+ * GrReadArea:
+ * @id: the ID of the drawable to read an area from
+ * @x: the X coordinate to read the area from relative to the drawable
+ * @y: the Y coordinate to read the area from relative to the drawable
+ * @width: the width of the area to read
+ * @height: the height of the area to read
+ * @pixels: pointer to an area of memory to place the pixel data in
+ *
+ * Reads the pixel data of the specified size from the specified position on
+ * the specified drawable into the specified pixel array. If the drawable is
+ * a window, the data returned will be the pixel values from the relevant
+ * position on the screen regardless of whether the window is obscured by other
+ * windows. If the window is unmapped, or partially or fully outside a window
+ * boundary, black pixel values will be returned.
+ */
+void 
+GrReadArea(GR_DRAW_ID id,GR_COORD x,GR_COORD y,GR_SIZE width,
+	GR_SIZE height, GR_PIXELVAL *pixels)
+{
+	nxReadAreaReq *req;
+	long           size;
+
+	req = AllocReq(ReadArea);
+	req->drawid = id;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	size = (long)width * height * sizeof(MWPIXELVAL);
+	GrTypedReadBlock(pixels, size, GrNumReadArea);
+}
+
+/**
+ * GrPoint:
+ * @id: the ID of the drawable to draw a point on
+ * @gc: the ID of the graphics context to use when drawing the point
+ * @x: the X coordinate to draw the point at relative to the drawable
+ * @y: the Y coordinate to draw the point at relative to the drawable
+ *
+ * Draws a point using the specified graphics context at the specified position
+ * on the specified drawable.
+ */
+void 
+GrPoint(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y)
+{
+	nxPointReq *req;
+
+	req = AllocReq(Point);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+
+}
+
+/**
+ * GrPoints:
+ * @id: the ID of the drawable to draw a point on
+ * @gc: the ID of the graphics context to use when drawing the point
+ * @count: the number of points in the point table
+ * @pointtable: pointer to a GR_POINT array which lists the points to draw
+ *
+ * Draws a set of points using the specified graphics context at the positions
+ * specified by the point table on the specified drawable.
+ */
+void
+GrPoints(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable)
+{
+	nxPointsReq *req;
+	long	size;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(Points, size);
+	req->drawid = id;
+	req->gcid = gc;
+	memcpy(GetReqData(req), pointtable, size);
+}
+
+/**
+ * GrPoly:
+ * @id: the ID of the drawable to draw the polygon onto
+ * @gc: the ID of the graphics context to use when drawing the polygon
+ * @count: the number of points in the point array
+ * @pointtable: pointer to an array of points describing the polygon
+ *
+ * Draws an unfilled polygon on the specified drawable using the specified
+ * graphics context. The polygon is specified by an array of point structures.
+ * The polygon is not automatically closed- if a closed polygon is desired,
+ * the last point must be the same as the first.
+ */
+void 
+GrPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable)
+{
+	nxPolyReq *req;
+	long       size;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(Poly, size);
+	req->drawid = id;
+	req->gcid = gc;
+	memcpy(GetReqData(req), pointtable, size);
+}
+
+/**
+ * GrFillPoly:
+ * @id: the ID of the drawable to draw the polygon onto
+ * @gc: the ID of the graphics context to use when drawing the polygon
+ * @count: the number of points in the point array
+ * @pointtable: pointer to an array of points describing the polygon
+ *
+ * Draws a filled polygon on the specified drawable using the specified
+ * graphics context. The polygon is specified by an array of point structures.
+ * The polygon is automatically closed- the last point need not be the same as
+ * the first in order for the polygon to be closed.
+ */
+void 
+GrFillPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count,GR_POINT *pointtable)
+{
+	nxFillPolyReq *req;
+	long           size;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(FillPoly, size);
+	req->drawid = id;
+	req->gcid = gc;
+	memcpy(GetReqData(req), pointtable, size);
+}
+
+/**
+ * GrText:
+ * @id: the ID of the drawable to draw the text string onto
+ * @gc: the ID of the graphics context to use when drawing the text string
+ * @x: the X coordinate to draw the string at relative to the drawable
+ * @y: the Y coordinate to draw the string at relative to the drawable
+ * @str: the text string to draw
+ * @count: the number of characters (not bytes) in the string
+ * @flags: flags specifying text encoding, alignment, etc.
+ *
+ * Draws the specified text string at the specified position on the specified
+ * drawable using the specified graphics context and flags. The default flags
+ * specify ASCII encoding and baseline alignment.
+ */
+void 
+GrText(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, void *str,
+	GR_COUNT count, int flags)
+{
+	nxTextReq *req;
+	int	   size;
+
+	if(count == -1 && (flags&MWTF_PACKMASK) == MWTF_ASCII)
+		count = strlen((char *)str);
+
+	size = nxCalcStringBytes(str, count, flags);
+
+	req = AllocReqExtra(Text, size);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->count = count;
+	req->flags = flags;
+	memcpy(GetReqData(req), str, size);
+}
+
+
+/**
+ * GrGetSystemPalette:
+ * @pal: pointer to a palette structure to fill in with the system palette
+ *
+ * Retrieves the system palette and places it in the specified palette
+ * structure.
+ */
+void
+GrGetSystemPalette(GR_PALETTE *pal)
+{
+	AllocReq(GetSystemPalette);
+	GrTypedReadBlock(pal, sizeof(*pal), GrNumGetSystemPalette);
+}
+
+/**
+ * GrSetSystemPalette:
+ * @first: the first palette value to set
+ * @pal: pointer to a palette structure containing the new values
+ *
+ * Sets the system palette to the values stored in the specified palette
+ * structure. The values before the specified first value are not set.
+ */
+void
+GrSetSystemPalette(GR_COUNT first, GR_PALETTE *pal)
+{
+	nxSetSystemPaletteReq *req;
+
+	req = AllocReq(SetSystemPalette);
+	req->first = first;
+	req->count = pal->count;
+	memcpy(req->palette, pal->palette, sizeof(GR_PALENTRY) * pal->count);
+}
+
+/**
+ * GrFindColor:
+ * @c: the colour value to find
+ * @retpixel: pointer to the returned pixel value
+ *
+ * Calculates the pixel value to use to display the specified colour value.
+ * The colour value is specified as a GR_COLOR, which is a 32 bit truecolour
+ * value stored as RGBX. The pixel value size depends on the architecture.
+ */
+void
+GrFindColor(GR_COLOR c, GR_PIXELVAL *retpixel)
+{
+	nxFindColorReq *req;
+
+	req = AllocReq(FindColor);
+	req->color = c;
+	GrTypedReadBlock(retpixel, sizeof(*retpixel), GrNumFindColor);
+}
+
+/**
+ * GrReqShmCmds:
+ * @shmsize: the size of the shared memory area to allocate
+ *
+ * Requests a shared memory area of the specified size to use for transferring
+ * command arguments. This is faster but less portable than the standard BSD
+ * sockets method of communication (and of course will only work if the client
+ * and server are on the same machine). Apart from the initial allocation of
+ * the area using this call, the use of shared memory is completely
+ * transparent. Additionally, if the allocation fails we silently and
+ * automatically fall back on socket communication. It is safe to call this
+ * function even if shared memory support is not compiled in; it will simply
+ * do nothing.
+ *
+ * FIXME: how does the user decide what size of shared memory area to allocate?
+ */
+void
+GrReqShmCmds(long shmsize)
+{
+#if HAVE_SHAREDMEM_SUPPORT
+	nxReqShmCmdsReq	req;
+	int key, shmid;
+
+	if ( nxSharedMem != 0 )
+		return;
+
+	GrFlush();
+
+	shmsize = (shmsize+SHM_BLOCK_SIZE-1) & ~(SHM_BLOCK_SIZE-1);
+
+	req.reqType = GrNumReqShmCmds;
+	req.hilength = 0;
+	req.length = sizeof(req);
+	req.size = shmsize;
+
+	nxWriteSocket((char *)&req,sizeof(req));
+	GrReadBlock(&key,sizeof(key));
+
+	if ( !key ) {
+		EPRINTF("nxclient: no shared memory support on server\n");
+		return;
+	}
+
+	shmid = shmget(key,shmsize,0);
+	if ( shmid == -1 ) {
+		EPRINTF("nxclient: Can't shmget key %d: %m\n", key);
+		return;
+	}
+
+	nxSharedMem = shmat(shmid,0,0);
+	shmctl(shmid,IPC_RMID,0);	/* Prevent other from attaching */
+	if ( nxSharedMem == (char *)-1 )
+		return;
+
+	nxSharedMemSize = shmsize;
+	nxAssignReqbuffer(nxSharedMem, shmsize);
+#endif /* HAVE_SHAREDMEM_SUPPORT*/
+}
+
+/**
+ * GrInjectPointerEvent:
+ * @x: the X coordinate of the pointer event relevant to the root window
+ * @y: the Y coordinate of the pointer event relevant to the root window
+ * @button: the pointer button status
+ * @visible: whether to display the pointer after the event
+ *
+ * Sets the pointer invisible if the visible parameter is GR_FALSE, or visible
+ * if it is GR_TRUE, then moves the pointer to the specified position and
+ * generates a mouse event with the specified button status. Also performs
+ * a GrFlush() so that the event takes effect immediately.
+ */
+void
+GrInjectPointerEvent(GR_COORD x, GR_COORD y, int button, int visible)
+{
+	nxInjectEventReq *req;
+
+	req = AllocReq(InjectEvent);
+	req->event_type = GR_INJECT_EVENT_POINTER;
+	req->event.pointer.visible = visible;
+	req->event.pointer.x = x;
+	req->event.pointer.y = y;
+	req->event.pointer.button = button;
+
+	GrFlush();
+}
+
+/**
+ * GrInjectKeyboardEvent:
+ * @wid: ID of the window to send the event to, or 0
+ * @uch: 32 bit Unicode keystroke value to inject
+ * @ch: 8 bit ascii keystroke value to inject
+ * @modifier: modifiers (shift, ctrl, alt, etc.) to inject
+ * @special: special keys to inject
+ * @content: mask specifying which arguments are valid
+ *
+ * Sends a keyboard event to the specified window, or to the window with the
+ * current keyboard focus if 0 is used as the ID. The other arguments
+ * correspond directly to the fields of the same names in the keyboard event
+ * structure.
+ */
+void
+GrInjectKeyboardEvent(GR_WINDOW_ID wid, GR_KEY keyvalue,
+	GR_KEYMOD modifier, GR_SCANCODE scancode, GR_BOOL pressed)
+{
+	nxInjectEventReq *req;
+
+	req = AllocReq(InjectEvent);
+	req->event_type = GR_INJECT_EVENT_KEYBOARD;
+	req->event.keyboard.wid = wid;
+	req->event.keyboard.keyvalue = keyvalue;
+	req->event.keyboard.modifier = modifier;
+	req->event.keyboard.scancode = scancode;
+	req->event.keyboard.pressed = pressed;
+
+	GrFlush();
+}
+
+/**
+ * GrSetWMProperties:
+ * @wid: the ID of the window to set the WM properties of
+ * @props: pointer to a GR_WM_PROPERTIES structure
+ *
+ * Copies the provided GR_WM_PROPERTIES structure into the the GR_WM_PROPERTIES
+ * structure of the specified window id.
+ */
+void
+GrSetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props)
+{
+	nxSetWMPropertiesReq *req;
+	char		*addr;
+	int		s;
+
+	if ((props->flags & GR_WM_FLAGS_TITLE) && props->title)
+		s = strlen(props->title) + 1;
+	else s = 0;
+
+	req = AllocReqExtra(SetWMProperties, s + sizeof(GR_WM_PROPERTIES));
+	req->windowid = wid;
+	addr = GetReqData(req);
+	memcpy(addr, props, sizeof(GR_WM_PROPERTIES));
+	if (s)
+		memcpy(addr + sizeof(GR_WM_PROPERTIES), props->title, s);
+}
+
+/**
+ * GrGetWMProperties:
+ * @wid: the ID of the window to retreive the WM properties of
+ * @props: pointer to a GR_WM_PROPERTIES structure to fill in
+ *
+ * Reads the GR_WM_PROPERTIES structure for the window with the specified
+ * id and fills in the provided structure with the information.
+ * It is the callers responsibility to free the title member as it is allocated
+ * dynamically. The title field will be set to NULL if the window has no title.
+ */
+void
+GrGetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props)
+{
+	nxGetWMPropertiesReq *req;
+	UINT16 textlen;
+	GR_CHAR c;
+
+	req = AllocReq(GetWMProperties);
+	req->windowid = wid;
+
+	GrTypedReadBlock(props, sizeof(GR_WM_PROPERTIES), GrNumGetWMProperties);
+	GrReadBlock(&textlen, sizeof(textlen));
+	if(!textlen) {
+		props->title = NULL;
+		return;
+	}
+	if(!(props->title = malloc(textlen))) {
+		/* Oh dear, we're out of memory but still have to purge the
+		   requested data (and throw it away) */
+		while(textlen--) GrReadBlock(&c, 1);
+	} else {
+		GrReadBlock(props->title, textlen);
+	}
+}
+
+/**
+ * GrCloseWindow:
+ * @wid: the ID of the window to send the CLOSE_REQ event to
+ *
+ * Sends a CLOSE_REQ event to the specified window if the client has selected
+ * to receive CLOSE_REQ events on this window. Used to request an application
+ * to shut down but not force it to do so immediately, so the application can
+ * ask whether to save changed files before shutting down cleanly.
+ */
+void 
+GrCloseWindow(GR_WINDOW_ID wid)
+{
+	nxCloseWindowReq *req;
+
+	req = AllocReq(CloseWindow);
+	req->windowid = wid;
+}
+
+/**
+ * GrKillWindow:
+ * @wid: the ID of the window to kill
+ *
+ * Forcibly disconnects the client which owns this window with the specified
+ * ID number. Used to kill an application which has locked up and is not
+ * responding to CLOSE_REQ events.
+ */
+void 
+GrKillWindow(GR_WINDOW_ID wid)
+{
+	nxKillWindowReq *req;
+
+	req = AllocReq(KillWindow);
+	req->windowid = wid;
+}
+
+/**
+ * GrSetScreenSaverTimeout:
+ * @timeout: the number of seconds of inactivity before screen saver activates
+ *
+ * Sets the number of seconds of inactivity before a screen saver activate
+ * event is sent to the root window ID. A value of 0 activates the
+ * screen saver immediately, and a value of -1 disables the screen saver
+ * function.
+ */
+void 
+GrSetScreenSaverTimeout(GR_TIMEOUT timeout)
+{
+	nxSetScreenSaverTimeoutReq *req;
+
+	req = AllocReq(SetScreenSaverTimeout);
+	req->timeout = timeout;
+}
+
+/**
+ * GrSetSelectionOwner:
+ * @wid: the ID of the window to set the selection owner to
+ * @typelist: list of mime types selection data can be supplied as
+ *
+ * Sets the current selection (otherwise known as the clipboard) ownership
+ * to the specified window. Specifying an owner of 0 disowns the selection.
+ * The typelist argument is a list of mime types (seperated by space
+ * characters) which the window is able to supply the data as. At least one
+ * type must be specified unless you are disowning the selection (typically
+ * text/plain for plain ASCII text or text/uri-list for a filename).
+ *
+ * The window which owns the current selection must be prepared to handle
+ * SELECTION_LOST events (received when another window takes ownership of the
+ * selection) and CLIENT_DATA_REQ events (received when a client wishes to
+ * retreive the selection data).
+ */
+void
+GrSetSelectionOwner(GR_WINDOW_ID wid, GR_CHAR *typelist)
+{
+	nxSetSelectionOwnerReq *req;
+	char *p;
+	int len;
+
+	if(wid) {
+		len = strlen(typelist) + 1;
+		req = AllocReqExtra(SetSelectionOwner, len);
+		p = GetReqData(req);
+		memcpy(p, typelist, len);
+	} else {
+		req = AllocReq(SetSelectionOwner);
+	}
+
+	req->wid = wid;
+}
+
+/**
+ * GrGetSelectionOwner:
+ * @typelist: pointer used to return the list of available mime types 
+ * @Returns: the ID of the window which currently owns the selection, or 0
+ *
+ * Finds the window which currently owns the selection and returns its ID,
+ * or 0 if no window currently owns the selection. A pointer to the list of
+ * mime types the selection owner is capable of supplying is placed in the
+ * pointer specified by the typelist argument. The typelist is null terminated,
+ * and the fields are seperated by space characters. It is the callers
+ * responsibility to free the typelist string, as it is allocated dynamically.
+ * If the allocation fails, it will be set to a NULL pointer, so remember to
+ * check the value of it before using it.
+ */
+GR_WINDOW_ID
+GrGetSelectionOwner(GR_CHAR **typelist)
+{
+	nxGetSelectionOwnerReq *req;
+	UINT16 textlen;
+	GR_CHAR c;
+	GR_WINDOW_ID wid;
+
+	req = AllocReq(GetSelectionOwner);
+	GrTypedReadBlock(&wid, sizeof(wid), GrNumGetSelectionOwner);
+	if(wid) {
+		GrReadBlock(&textlen, sizeof(textlen));
+		if(!(*typelist = malloc(textlen))) {
+			/* Oh dear, we're out of memory but still have to
+			purge the requested data (and throw it away) */
+			while(textlen--) GrReadBlock(&c, 1);
+		} else {
+			GrReadBlock(*typelist, textlen);
+		}
+	}
+	return wid;
+}
+
+/**
+ * GrRequestClientData:
+ * @wid: the ID of the window requesting the data
+ * @rid: the ID of the window to request the data from
+ * @serial: the serial number of the request
+ * @mimetype: the number of the desired mime type to request
+ *
+ * Sends a CLIENT_DATA_REQ event to the specified window. Used for requesting
+ * both selection and "drag and drop" data. The mimetype argument specifies
+ * the format of the data you would like to receive, as an index into the list
+ * returned by GrGetSelectionOwner (the first type in the list is index 0).
+ * The server makes no guarantees as to when, or even if, the client will
+ * reply to the request. If the client does reply, the reply will take the
+ * form of one or more CLIENT_DATA events. The request serial number is
+ * typically a unique ID which the client can assign to a request in order for
+ * it to be able to keep track of transfers (CLIENT_DATA events contain the
+ * same number in the sid field). Remember to free the data field of the
+ * CLIENT_DATA events as they are dynamically allocated. Also note that if
+ * the allocation fails the data field will be set to NULL, so you should
+ * check the value before using it.
+ */
+void
+GrRequestClientData(GR_WINDOW_ID wid, GR_WINDOW_ID rid, GR_SERIALNO serial,
+							GR_MIMETYPE mimetype)
+{
+	nxRequestClientDataReq *req;
+
+	req = AllocReq(RequestClientData);
+	req->wid = wid;
+	req->rid = rid;
+	req->serial = serial;
+	req->mimetype = mimetype;
+}
+
+/**
+ * GrSendClientData:
+ * @wid: the ID of the window sending the data
+ * @did: the ID of the destination window
+ * @sid: the serial number of the request
+ * @len: the number of bytes of data to transfer
+ * @thislen: the number of bytes in this packet
+ * @data: pointer to the data to transfer
+ *
+ * Used as the response to a CLIENT_DATA_REQ event. Sends the specified data
+ * of the specified length to the specified window using the specified source
+ * window ID and transfer serial number. Any fragmentation of the data into
+ * multiple CLIENT_DATA events which is required is handled automatically.
+ * The serial number should always be set to the value supplied by the
+ * CLIENT_DATA_REQ event. The thislen parameter is used internally to split
+ * the data up into packets. It should be set to the same value as the len
+ * parameter.
+ * 
+ */
+void
+GrSendClientData(GR_WINDOW_ID wid, GR_WINDOW_ID did, GR_SERIALNO serial,
+			GR_LENGTH len, GR_LENGTH thislen, void *data)
+{
+	nxSendClientDataReq *req;
+	char *p;
+	GR_LENGTH l, pos = 0;
+
+	while(pos < len) {
+		l = MAXREQUESTSZ - sizeof(nxSendClientDataReq);
+		if(l > (len - pos)) l = len - pos;
+		req = AllocReqExtra(SendClientData, l);
+		req->wid = wid;
+		req->did = did;
+		req->serial = serial;
+		req->len = len;
+		p = GetReqData(req);
+		memcpy(p, data + pos, l);
+		pos += l;
+	}
+}
+
+/**
+ * GrBell:
+ *
+ * Asks the server to ring the console bell on behalf of the client (intended
+ * for terminal apps to be able to ring the bell on the server even if they
+ * are running remotely).
+ */
+void
+GrBell(void)
+{
+	AllocReq(Bell);
+}
+
+/**
+ * GrSetBackgroundPixmap:
+ * @wid: ID of the window to set the background of
+ * @pixmap: ID of the pixmap to use as the background
+ * @flags: flags specifying how to draw the pixmap onto the window
+ *
+ * Sets the background of the specified window to the specified pixmap.
+ * The flags which specify how to draw the pixmap (in the top left of the
+ * window, in the centre of the window, tiled, etc.) are those which start with
+ * GR_BACKGROUND_ in nano-X.h. If the pixmap value is 0, the server will
+ * disable the background pixmap and return to using a solid colour fill.
+ */
+void
+GrSetBackgroundPixmap(GR_WINDOW_ID wid, GR_WINDOW_ID pixmap, int flags)
+{
+	nxSetBackgroundPixmapReq *req;
+
+	req = AllocReq(SetBackgroundPixmap);
+	req->wid = wid;
+	req->pixmap = pixmap;
+	req->flags = flags;
+}
+
+#if YOU_WANT_TO_IMPLEMENT_DRAG_AND_DROP
+/**
+ * GrRegisterDragAndDropWindow:
+ * @wid: the ID of the window to use as the drag and drop source window
+ * @iid: the ID of the pixmap to use as the drag and drop icon
+ * @typelist: list of mime types the drag and drop data can be supplied as
+ *
+ * Enables the specified window to be used as a drag and drop source. The
+ * specified pixmap will be used as the icon shown whilst dragging, and the
+ * null terminated, newline seperated list of mime types which the data can
+ * be supplied as is specified by the typelist argument. At least one type
+ * (typically text/plain for plain ASCII or text/uri-list for a filename or
+ * list of filenames) must be specified. When the icon is dropped,
+ * the window which it is dropped on will receive a DROP event (providing it
+ * has selected for DROP events), and if the client wishes to accept the data
+ * and is able to handle one of the mime types in the type list, it should use
+ * GrRequestClientData() to retrieve the data from the drag and drop source
+ * window. Remember to free the typelist field of the DROP event as it is
+ * dynamically allocated. It is possible for a client to select for DROP events
+ * on the Root window if it is desired to allow dropping icons on the desktop.
+ */
+void
+GrRegisterDragAndDropWindow(GR_WINDOW_ID wid, GR_WINDOW_ID iid,
+				GR_CHAR *typelist)
+{
+}
+#endif
diff -urN lib/microwindows/src/nanox/client_orig.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/client_orig.c
--- lib/microwindows/src/nanox/client_orig.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/client_orig.c	2005-02-21 16:13:34.000000000 +0100
@@ -0,0 +1,3044 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1999, 2000 Alex Holden <alex@linuxhacker.org>
+ * Copyright (c) 1991 David I. Bell
+ * Copyright (c) 2000 Vidar Hokstad
+ * Copyright (c) 2000 Morten Rolland <mortenro@screenmedia.no>
+ *
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Client routines to do graphics with windows and graphics contexts.
+ *
+ * Rewritten heavily for speed by Greg Haerr
+ *
+ * Whenever you add a new API entry point, please comment it in the same way
+ * as the rest of the functions in this file. Also add your functions to the
+ * appropriate section(s) in doc/nano-X/nano-X-sections.txt and regenerate the
+ * documentation by running make in the doc/nano-X/ directory. If you do not
+ * have the necessary tools (gtk-doc and the docbook-tools) to rebuild the
+ * documentation, just skip that step and we will do it for you.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <stddef.h>
+#include <signal.h>
+#include <errno.h>
+#include <time.h>
+#if HAVE_SHAREDMEM_SUPPORT
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#endif
+#include <sys/time.h>
+#include <sys/socket.h>
+#if ELKS
+#include <linuxmt/na.h>
+#include <linuxmt/time.h>
+#else
+#include <sys/un.h>
+#if hpux
+#include <sys/time.h>
+#else
+#include <sys/select.h>
+#endif
+#endif
+#include "nano-X.h"
+#include "serv.h"
+#include "nxproto.h"
+
+#define GR_CLOSE_FIX	1	/* dirty hack attempts to fix GrClose hang bug*/
+
+#define SHM_BLOCK_SIZE	4096
+
+/* exported global data */
+int 	   nxSocket = -1;	/* The network socket descriptor */
+#if HAVE_SHAREDMEM_SUPPORT
+char *	   nxSharedMem = 0;	/* Address of shared memory segment*/
+static int nxSharedMemSize;	/* Size in bytes of shared mem segment*/
+#endif
+
+/* readable error strings*/
+char *nxErrorStrings[] = {
+	GR_ERROR_STRINGS
+};
+
+//static int storedevent = 0;
+//static GR_EVENT storedevent_data;
+
+/*
+ * Client side event queue
+ */
+typedef struct event_list EVENT_LIST;
+struct event_list {
+	EVENT_LIST *	next;
+	GR_EVENT	event;
+};
+static EVENT_LIST *	evlist;
+
+/*
+ * The following is the user defined function for handling errors.
+ * If this is not set, then the default action is to close the connection
+ * to the server, describe the error, and then exit.  This error function
+ * will only be called when the client asks for events.
+ */
+static GR_FNCALLBACKEVENT ErrorFunc = GrDefaultErrorHandler;
+
+/*
+ * Queue an event in FIFO for later retrieval.
+ */
+static void
+QueueEvent(GR_EVENT *ep)
+{
+	EVENT_LIST *	elp;
+	EVENT_LIST *	prevelp;
+
+	elp = malloc(sizeof(EVENT_LIST));
+	if (elp) {
+		elp->event = *ep;
+		elp->next = NULL;
+
+		/* add as last entry on list*/
+		if (!evlist) {
+			evlist = elp;
+			return;
+		}
+		prevelp = evlist;
+		while (prevelp->next)
+			prevelp = prevelp->next;
+		prevelp->next = elp;
+	}
+}
+
+/*
+ * Retrieve first event in FIFO event queue.
+ */
+static void
+GetNextQueuedEvent(GR_EVENT *ep)
+{
+	*ep = evlist->event;
+	evlist = evlist->next;
+}
+
+/*
+ * Read n bytes of data from the server into block *b.  Make sure the data
+ * you are about to read are actually of the correct type - e.g. make a
+ * check for the first block of data you read as a response to a command
+ * with the Typed version of this function. Returns 0 on success or -1 on
+ * failure.
+ */
+static int GrReadBlock(void *b, int n)
+{
+	int i = 0;
+	char *v;
+
+	v = (char *) b;
+
+	nxFlushReq(0L,0);
+	while(v < ((char *) b + n)) {
+		i = read(nxSocket, v, ((char *) b + n - v));
+		if ( i <= 0 ) {
+			if ( i == 0 ) {
+				/* We should maybe produce an event here,
+				 * if possible.
+				 */
+				EPRINTF("nxclient: lost connection to Nano-X "
+					"server\n");
+				exit(1);
+			}
+			if ( errno == EINTR || errno == EAGAIN )
+				continue;
+
+			EPRINTF("nxclient: bad readblock %d\n", i);
+			return -1;
+		}
+		v += i;
+	}
+
+	return 0;
+}
+
+/*
+ * Read a byte of data from the server.
+ */
+static int GrReadByte()
+{
+	unsigned char c;
+
+	if(GrReadBlock(&c, 1) == -1)
+		return -1;
+	else return (int) c;
+}
+
+/*
+ * Check if this is a CLIENT_DATA event, in which case we need to read the
+ * data for the event into a buffer and set the event data pointer to the
+ * address of it (or NULL if the malloc() fails). We also don't try to read
+ * any data if datalen is 0.
+ */
+static void GrCheckForClientData(GR_EVENT *evp)
+{
+	GR_EVENT_CLIENT_DATA *event;
+
+	if(evp->type == GR_EVENT_TYPE_CLIENT_DATA) {
+		event = (GR_EVENT_CLIENT_DATA *)evp;
+		if(!event->datalen) {
+			event->data = NULL;
+			return;
+		}
+		if(!(event->data = malloc(event->datalen))) return;
+		GrReadBlock(event->data, event->datalen);
+	}
+}
+
+/*
+ * Check if the data we are about to read is of the correct type. This
+ * must be done in order to avoid reading an event as part of the response
+ * from the server to a command that requires a reply.
+ */
+static int GrCheckBlockType(short packettype)
+{
+	short		b;
+	GR_EVENT	event;
+
+	while (GrReadBlock(&b,sizeof(b)) != -1) {
+		if (b == packettype)
+			return b;
+
+		if (b == GrNumGetNextEvent) {
+			/*EPRINTF("nxclient %d: Storing event (expected %d)\n",
+				getpid(), packettype);*/
+
+#if 0
+			/* We only need to handle one event, since the next
+			 * event won't arrive until the next GrPrepareSelect()
+			 * has been called, and by then we have already
+			 * handled this event in GrServiceSelect(). If
+			 * GrPrepareSelect() is never called, then we should
+			 * never get here either, so that is cool too.
+			 */
+			GrReadBlock(&storedevent_data,
+				    sizeof(storedevent_data));
+			GrCheckForClientData(&storedevent_data);
+			storedevent = 1;
+#endif
+			/* read event and queue it for later processing*/
+			GrReadBlock(&event, sizeof(event));
+			QueueEvent(&event);
+		} else {
+			EPRINTF("nxclient %d: Wrong packet type %d "
+				"(expected %d)\n", getpid(),b, packettype);
+		}
+	}
+	EPRINTF("nxclient %d: Corrupted packet\n", getpid());
+	return -1;
+}
+
+/*
+ * Actually read a response from the server, much like the GrReadBlock but
+ * make sure the response is of the right kind, e.g. store the event that
+ * may have sneaked into the stream.
+ */
+static int GrTypedReadBlock(void *b, int n, int type)
+{
+	int r;
+   
+	r = GrCheckBlockType(type);
+	if (r != type)
+		return -1;
+	return GrReadBlock(b,n);
+}
+
+/*
+ * Check if the passed event is an error event, and call the error handler if
+ * there is one. After calling the handler (if it returns), the event type is
+ * set to a non-event so that we don't return an error event through the
+ * GetEvent() mechanism. This solution is simpler than creating a client-side
+ * event queue.
+ */
+static void
+CheckErrorEvent(GR_EVENT *ep)
+{
+	if (ep->type == GR_EVENT_TYPE_ERROR) {
+		if (ErrorFunc) {
+			/* call error handler*/
+			ErrorFunc(ep);
+
+			/* then convert to null event*/
+			ep->type = GR_EVENT_TYPE_NONE;
+		}
+	}
+}
+
+/**
+ * GrFlush:
+ *
+ * Flush the message buffer of any messages it may contain.
+ */
+void 
+GrFlush(void)
+{
+	nxFlushReq(0L,1);
+}
+
+/**
+ * GrOpen:
+ * @Returns: the fd of the connection to the server or -1 on failure
+ *
+ * Open a connection to the graphics server.
+ */
+int 
+GrOpen(void)
+{
+	size_t 		size;
+	nxOpenReq	req;
+	int		tries;
+	int		ret = 0;
+#if ELKS
+	struct sockaddr_na name;
+#else
+	struct sockaddr_un name;
+#endif
+	
+	if(nxSocket == -1)
+#if ELKS
+		if((nxSocket = socket(AF_NANO, SOCK_STREAM, 0)) == -1) {
+#else
+		if((nxSocket = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
+#endif
+			nxSocket = -1;
+			return -1;
+		}
+
+#if ELKS
+	name.sun_family = AF_NANO;
+	name.sun_no = GR_NUMB_SOCKET;
+	size = sizeof(struct sockaddr_na);
+#else
+	name.sun_family = AF_UNIX;
+	strcpy(name.sun_path, GR_NAMED_SOCKET);
+	size = (offsetof(struct sockaddr_un, sun_path) +
+		strlen(name.sun_path) + 1);
+#endif
+
+	/*
+	 * Try to open the connection for up to a second,
+	 * waiting 1/10 second between attempts.
+	 */
+	for (tries=1; tries<=10; ++tries) {
+		struct timespec req;
+
+		ret = connect(nxSocket, (struct sockaddr *) &name, size);
+		if (ret >= 0)
+			break;
+		req.tv_sec = 0;
+		req.tv_nsec = 100000000L;
+		nanosleep(&req, NULL);
+		EPRINTF("nxclient: retry connect attempt %d\n", tries);
+	}
+	if (ret == -1) {
+		close(nxSocket);
+		nxSocket = -1;
+		return -1;
+	}
+
+	/*
+	 * By Performing the 'GrOpen' without allocating a buffer, just
+	 * shuffeling the struct over the wire, we can postpone the
+	 * allocation of the client size command buffer, which will never be
+	 * allocated if the first command after GrOpen() is
+	 * GrReqShmCmds() which allocates a replacement shared memory
+	 * segment.
+	 * So: Calling GrReqShmCmds() right after GrOpen will prevent the
+	 * traditional command queue buffer from being allocated from
+	 * the process heap - and only the shared memory segment is
+	 * allocated.
+	 */
+	req.reqType = GrNumOpen;
+	req.hilength = 0;
+	req.length = sizeof(req);
+
+	nxWriteSocket((char *)&req,sizeof(req));
+	return nxSocket;
+}
+
+#if GR_CLOSE_FIX
+static void
+mySignalhandler(int sig)
+{
+	if (sig == SIGALRM) {
+		printf("Oops! nxFlushReq() timed out, cowardly chickening "
+								"out!\n");
+		exit(127);
+	}
+}
+#endif
+
+/**
+ * GrClose:
+ *
+ * Close the graphics device, flushing any waiting messages.
+ */
+/* Vladimir Cotfas: hang in GrFlush() --> nxFlushReq(0L,1); */
+void 
+GrClose(void)
+{
+#if GR_CLOSE_FIX
+	/* allow 1 second to flush*/
+	void * oldSignalHandler = signal(SIGALRM, mySignalhandler);
+	alarm(1);
+#endif
+	AllocReq(Close);
+	GrFlush();
+#if GR_CLOSE_FIX
+	alarm(0);
+	signal(SIGALRM, oldSignalHandler);
+#endif
+	close(nxSocket);
+}
+
+/**
+ * GrDefaultErrorHandler:
+ * @ep: the error event structure
+ * 
+ * The default error handler which is called when the server reports an error
+ * event and the client hasn't set up a handler of it's own.
+ *
+ * Generates a human readable error message on stderr describing what error
+ * occurred and what function it occured in, then exits.
+ */
+void 
+GrDefaultErrorHandler(GR_EVENT *ep)
+{
+	if (ep->type == GR_EVENT_TYPE_ERROR) {
+		EPRINTF("nxclient %d: Error (%s) ", getpid(), ep->error.name);
+		EPRINTF(nxErrorStrings[ep->error.code], ep->error.id);
+		GrClose();
+		exit(1);
+	}
+}
+
+/**
+ * GrSetErrorHandler:
+ * @fncb: the function to call to handle error events
+ * @Returns: the address of the previous error handler
+ *
+ * Sets an error handling routine that will be called on any errors from
+ * the server (assuming the client has asked to receive them). If zero is
+ * used as the argument, errors will be returned as regular events instead.
+ */
+GR_FNCALLBACKEVENT
+GrSetErrorHandler(GR_FNCALLBACKEVENT fncb)
+{
+	GR_FNCALLBACKEVENT orig = ErrorFunc;
+
+	ErrorFunc = fncb;
+	return orig;
+}
+
+/**
+ * GrGetScreenInfo:
+ * @sip: pointer to a GR_SCREEN_INFO structure
+ *
+ * Fills in the specified GR_SCREEN_INFO structure.
+ */
+void 
+GrGetScreenInfo(GR_SCREEN_INFO *sip)
+{
+	AllocReq(GetScreenInfo);
+	GrTypedReadBlock(sip, sizeof(GR_SCREEN_INFO),GrNumGetScreenInfo);
+}
+
+/**
+ * GrGetSysColor:
+ * @index: an index into the server's colour look up table
+ * @Returns: the colour found at the specified index
+ *
+ * Returns the colour at the specified index into the server's colour look
+ * up table. The colours in the table are those with names like
+ * "GR_COLOR_DESKTOP", "GR_COLOR_ACTIVECAPTION", "GR_COLOR_APPWINDOW", etc.
+ * as listed in nano-X.h
+ */
+GR_COLOR
+GrGetSysColor(int index)
+{
+	nxGetSysColorReq *req;
+	GR_COLOR color;
+
+	req = AllocReq(GetSysColor);
+	req->index = index;
+	if(GrTypedReadBlock(&color, sizeof(color),GrNumGetSysColor) == -1)
+		return 0;
+	return color;
+}
+
+/**
+ * GrGetFontInfo:
+ * @fontno: the font ID number
+ * @fip: pointer to a GR_FONT_INFO structure
+ *
+ * Fills in the specified GR_FONT_INFO structure with information regarding
+ * the specified font.
+ */
+void 
+GrGetFontInfo(GR_FONT_ID fontno, GR_FONT_INFO *fip)
+{
+	nxGetFontInfoReq *req;
+
+	req = AllocReq(GetFontInfo);
+	req->fontid = fontno;
+	GrTypedReadBlock(fip, sizeof(GR_FONT_INFO),GrNumGetFontInfo);
+}
+
+/**
+ * GrGetGCInfo:
+ * @gc: a graphics context
+ * @gcip: pointer to a GR_GC_INFO structure
+ *
+ * Fills in the specified GR_GC_INFO structure with information regarding the
+ * specified graphics context.
+ */
+void GrGetGCInfo(GR_GC_ID gc, GR_GC_INFO *gcip)
+{
+	nxGetGCInfoReq *req;
+
+	req = AllocReq(GetGCInfo);
+	req->gcid = gc;
+	GrTypedReadBlock(gcip, sizeof(GR_GC_INFO),GrNumGetGCInfo);
+}
+
+/**
+ * GrGetGCTextSize:
+ * @gc: the graphics context
+ * @str: pointer to a text string
+ * @count: the length of the string
+ * @flags: text rendering flags (GR_TF*)
+ * @retwidth: pointer to the variable the width will be returned in
+ * @retheight: pointer to the variable the height will be returned in
+ * @retbase: pointer to the variable the baseline height will be returned in
+ *
+ * Calculates the dimensions of the specified text string using the current font
+ * and flags in the specified graphics context. The count argument can be -1
+ * if the string is null terminated.
+ */
+void GrGetGCTextSize(GR_GC_ID gc, void *str, int count, int flags,
+	GR_SIZE *retwidth, GR_SIZE *retheight, GR_SIZE *retbase)
+{
+	nxGetGCTextSizeReq *req;
+	int size;
+
+	if(count == -1 && (flags&MWTF_PACKMASK) == MWTF_ASCII)
+		count = strlen((char *)str);
+
+	size = nxCalcStringBytes(str, count, flags);
+
+	req = AllocReqExtra(GetGCTextSize, size);
+	req->gcid = gc;
+	req->flags = flags;
+	memcpy(GetReqData(req), str, size);
+	GrTypedReadBlock(retwidth, sizeof(*retwidth),GrNumGetGCTextSize);
+	GrReadBlock(retheight, sizeof(*retheight));
+	GrReadBlock(retbase, sizeof(*retbase));
+}
+
+static int regfd = -1;
+
+/**
+ * GrRegisterInput:
+ * @fd: the file descriptor to monitor
+ *
+ * Register an extra file descriptor to monitor in the main select() call.
+ * An event will be returned when the fd has data waiting to be read if that
+ * event has been selected for.
+ */
+/* FIXME: only one extra file descriptor can be monitored */
+void 
+GrRegisterInput(int fd)
+{
+	regfd = fd;
+}
+
+/**
+ * GrPrepareSelect:
+ * @maxfd: pointer to a variable which the highest in use fd will be written to
+ * @rfdset: pointer to the file descriptor set structure to use
+ *
+ * Prepare for a GrServiceSelect function by asking the server to send the next
+ * event but not waiting around for it to arrive and initialising the
+ * specified fd_set structure with the client/server socket descriptor and any
+ * previously registered external file descriptors. Also compares the current
+ * contents of maxfd, the client/server socket descriptor, and the previously
+ * registered external file descriptors, and returns the highest of them in
+ * maxfd.
+ */
+void
+GrPrepareSelect(int *maxfd,void *rfdset)
+{
+	fd_set *rfds = rfdset;
+
+	AllocReq(GetNextEvent);
+	GrFlush();
+
+	FD_SET(nxSocket, rfds);
+	if(nxSocket > *maxfd)
+		*maxfd = nxSocket;
+	if(regfd != -1) {
+		FD_SET(regfd, rfds);
+		if(regfd > *maxfd)
+			*maxfd = regfd;
+	}
+}
+
+/**
+ * GrServiceSelect:
+ * @rfdset: pointer to the file descriptor set to monitor
+ * @fncb: pointer to the function to call when an event needs handling
+ *
+ * Used by GrMainLoop() to call the specified callback function when an
+ * event arrives or there is data waiting on an external fd specified by
+ * GrRegisterInput().
+ */
+void
+GrServiceSelect(void *rfdset, GR_FNCALLBACKEVENT fncb)
+{
+	fd_set *	rfds = rfdset;
+	GR_EVENT 	ev;
+
+        /* Clean out any event that might have arrived while waiting
+	 * for other data, for instance by doing Nano-X requests
+	 * between GrPrepareSelect() and GrServiceSelect(), or when
+	 * an event is generated in Nano-X at the same time as the
+	 * client wakes up for some reason and calls Nano-X functions.
+	 */
+#if 0
+	if (storedevent) {
+		/*DPRINTF("nxclient: Handling stored event\n");*/
+		CheckErrorEvent(&storedevent_data);
+		fncb(&storedevent_data);
+		storedevent = 0;
+	}
+#endif
+	if (evlist) {
+		/*DPRINTF("nxclient: Handling queued event\n");*/
+		GetNextQueuedEvent(&ev);
+		CheckErrorEvent(&ev);
+		fncb(&ev);
+	}
+	else {
+		if(FD_ISSET(nxSocket, rfds)) {
+			GrTypedReadBlock(&ev, sizeof(ev),GrNumGetNextEvent);
+			GrCheckForClientData(&ev);
+			CheckErrorEvent(&ev);
+			fncb(&ev);
+		}
+	}
+
+#if 0 
+	/* Morten - remove this if you want*/
+	while ( GrPeekEvent(&ev) )
+		CheckErrorEvent(&ev);
+		fncb(&ev);
+#endif
+
+	if(regfd != -1 && FD_ISSET(regfd, rfds)) {
+		ev.type = GR_EVENT_TYPE_FDINPUT;
+		ev.fdinput.fd = regfd;
+		fncb(&ev);
+	}
+}
+
+/**
+ * GrMainLoop:
+ * @fncb:
+ *
+ * A convenience function which calls the specified callback function whenever
+ * an event arrives or there is data to be read on a file descriptor previously
+ * specified by GrRegisterInput(). Currently never returns.
+ */
+void
+GrMainLoop(GR_FNCALLBACKEVENT fncb)
+{
+	fd_set	rfds;
+	int	setsize = 0;
+
+	for(;;) {
+		FD_ZERO(&rfds);
+		GrPrepareSelect(&setsize, &rfds);
+		if(select(setsize+1, &rfds, NULL, NULL, NULL) > 0)
+			GrServiceSelect(&rfds, fncb);
+	}
+}
+
+/**
+ * GrGetNextEvent:
+ * @ep: pointer to the GR_EVENT structure to return the event in
+ *
+ * Gets the next event from the event queue and places it in the specified
+ * GR_EVENT structure. If the queue is currently empty, we sleep until the
+ * next event arrives from the server or input is read on a file descriptor
+ * previously specified by GrRegisterInput().
+ */
+void 
+GrGetNextEvent(GR_EVENT *ep)
+{
+	GrGetNextEventTimeout(ep, 0L);
+}
+
+/**
+ * GrGetNextEventTimeout:
+ * @ep: pointer to the GR_EVENT structure to return the event in
+ * @timeout: the number of milliseconds to wait before timing out
+ *
+ * Gets the next event from the event queue and places it in the specified
+ * GR_EVENT structure. If the queue is currently empty, we sleep until the
+ * next event arrives from the server, input is read on a file descriptor
+ * previously specified by GrRegisterInput(), or a timeout occurs. Note
+ * that a value of 0 for the timeout parameter doesn't mean "timeout after 0
+ * milliseconds" but is in fact a magic number meaning "never time out".
+ */
+void
+GrGetNextEventTimeout(GR_EVENT *ep, GR_TIMEOUT timeout)
+{
+	fd_set		rfds;
+	int		setsize = 0;
+	int		e;
+	struct timeval	to;
+
+#if 0
+	if (storedevent) {
+		/*DPRINTF("nxclient %d: Returning stored event\n",getpid());*/
+		memcpy(ep,&storedevent_data,sizeof(*ep));
+		storedevent = 0;
+		CheckErrorEvent(ep);
+		return;
+	}
+#endif
+	if (evlist) {
+		/*DPRINTF("nxclient %d: Returning queued event\n",getpid());*/
+		GetNextQueuedEvent(ep);
+		CheckErrorEvent(ep);
+		return;
+	}
+
+	FD_ZERO(&rfds);
+	/*
+	 * This will cause a GrGetNextEvent to be sent down the wire.
+	 * If we timeout before the server responds, and then
+	 * call this procedure again, and the server has more than
+	 * one event waiting for this process, then more than one
+	 * event will be written on the socket by the server.  At
+	 * that point, a single stored event won't work, and the
+	 * client needs an event queue.
+	 */
+	GrPrepareSelect(&setsize, &rfds);
+	if (timeout) {
+		to.tv_sec = timeout / 1000;
+		to.tv_usec = (timeout % 1000) * 1000;
+	}
+
+	if((e = select(setsize+1, &rfds, NULL, NULL, timeout ? &to : NULL))>0) {
+		if(FD_ISSET(nxSocket, &rfds)) {
+			/*
+			 * This will never be GR_EVENT_NONE with the current
+			 * implementation.
+			 */
+		        GrTypedReadBlock(ep, sizeof(*ep),GrNumGetNextEvent);
+			GrCheckForClientData(ep);
+			CheckErrorEvent(ep);
+			return;
+		}
+		if(regfd != -1 && FD_ISSET(regfd, &rfds)) {
+			ep->type = GR_EVENT_TYPE_FDINPUT;
+			ep->fdinput.fd = regfd;
+			return;
+		}
+	}
+	else if (e == 0) {
+		/*
+		 * Timeout has occured. We currently return a timeout event
+		 * regardless of whether the client has selected for it.
+		 */
+		ep->type = GR_EVENT_TYPE_TIMEOUT;
+	} else {
+		if(errno == EINTR) {
+			ep->type = GR_EVENT_TYPE_NONE;
+		} else {
+			EPRINTF("nxclient: select failed\n");
+			GrClose();
+			exit(1);
+		}
+	}
+}
+
+/**
+ * GrCheckNextEvent:
+ * @ep: pointer to the GR_EVENT structure to return the event in
+ *
+ * Gets the next event from the event queue if there is one, or returns
+ * immediately with an event type of GR_EVENT_TYPE_NONE if it is empty.
+ */
+void 
+GrCheckNextEvent(GR_EVENT *ep)
+{
+	AllocReq(CheckNextEvent);
+	GrTypedReadBlock(ep, sizeof(*ep),GrNumGetNextEvent);
+	GrCheckForClientData(ep);
+	CheckErrorEvent(ep);
+}
+
+/**
+ * GrPeekEvent:
+ * @ep: pointer to the GR_EVENT structure to return the event in
+ * @Returns: 1 if an event was returned, or 0 if the queue was empty
+ *
+ * Fills in the specified event structure with a copy of the next event on the
+ * queue, without actually removing it from the queue. An event type of
+ * GR_EVENT_TYPE_NONE is given if the queue is empty.
+ */
+int 
+GrPeekEvent(GR_EVENT *ep)
+{
+	int ret;
+
+#if 0
+	if (storedevent) {
+		*ep = storedevent_data;
+		storedevent = 0;
+		return 1;
+	}
+#endif
+	if (evlist) {
+		GetNextQueuedEvent(ep);
+		CheckErrorEvent(ep);
+		return 1;
+	}
+
+	AllocReq(PeekEvent);
+	GrTypedReadBlock(ep, sizeof(*ep),GrNumPeekEvent);
+	GrCheckForClientData(ep);
+	ret = GrReadByte();
+	CheckErrorEvent(ep);
+	return ret;
+}
+
+/**
+ * GrSelectEvents:
+ * @wid: the ID of the window to set the event mask of
+ * @eventmask: a bit field specifying the desired event mask
+ *
+ * Select the event types which should be returned for the specified window.
+ */
+void 
+GrSelectEvents(GR_WINDOW_ID wid, GR_EVENT_MASK eventmask)
+{
+	
+	nxSelectEventsReq *req;
+
+	req = AllocReq(SelectEvents);
+	req->windowid = wid;
+	req->eventmask = eventmask;
+}
+
+/**
+ * GrNewWindow:
+ * @parent: the ID of the parent window
+ * @x: the X coordinate of the new window relative to the parent window
+ * @y: the Y coordinate of the new window relative to the parent window
+ * @width: the width of the new window
+ * @height: the height of the new window
+ * @bordersize: the width of the window border
+ * @background: the colour of the window background
+ * @bordercolor: the colour of the window border
+ * @Returns: the ID of the newly created window
+ *
+ * Create a new window with the specified parent and window attributes.
+ */
+GR_WINDOW_ID
+GrNewWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, GR_SIZE bordersize, GR_COLOR background,
+	GR_COLOR bordercolor)
+{
+	nxNewWindowReq *req;
+	GR_WINDOW_ID 	wid;
+
+	req = AllocReq(NewWindow);
+	req->parentid = parent;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	req->backgroundcolor = background;
+	req->bordercolor = bordercolor;
+	req->bordersize = bordersize;
+	if(GrTypedReadBlock(&wid, sizeof(wid),GrNumNewWindow) == -1)
+		return 0;
+	return wid;
+}
+   
+   
+/**
+ * GrNewPixmap:
+ * @width: the width of the pixmap
+ * @height: the height of the pixmap
+ * @addr: currently unused in client/server mode
+ * @Returns: the ID of the newly created pixmap
+ *
+ * Create a new server side pixmap (an offscreen drawing area which can be
+ * copied into a window using a GrCopyArea call) of the specified width and
+ * height.
+ */
+/* FIXME: Add support for shared memory... */
+GR_WINDOW_ID
+GrNewPixmap(GR_SIZE width, GR_SIZE height, void *addr)
+{
+	nxNewPixmapReq *req;
+	GR_WINDOW_ID 	wid;
+
+	req = AllocReq(NewPixmap);
+	req->width = width;
+	req->height = height;
+	if(GrTypedReadBlock(&wid, sizeof(wid), GrNumNewPixmap) == -1)
+		return 0;
+	return wid;
+}
+
+/**
+ * GrNewInputWindow:
+ * @parent: the ID of the window to use as the parent of the new window
+ * @x: the X coordinate of the new window relative to the parent window
+ * @y: the Y coordinate of the new window relative to the parent window
+ * @width: the width of the new window
+ * @height: the height of the new window
+ * @Returns: the ID of the newly created window
+ *
+ * Create a new input-only window with the specified dimensions which is a
+ * child of the specified parent window.
+ */
+GR_WINDOW_ID
+GrNewInputWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height)
+{
+	nxNewInputWindowReq *req;
+	GR_WINDOW_ID 	     wid;
+
+	req = AllocReq(NewInputWindow);
+	req->parentid = parent;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	if(GrTypedReadBlock(&wid, sizeof(wid), GrNumNewInputWindow) == -1)
+		return 0;
+	return wid;
+}
+
+/**
+ * GrDestroyWindow:
+ * @wid: the ID of the window to destroy
+ *
+ * Recursively unmaps and frees the data structures associated with the
+ * specified window and all of its children.
+ */
+void 
+GrDestroyWindow(GR_WINDOW_ID wid)
+{
+	nxDestroyWindowReq *req;
+
+	req = AllocReq(DestroyWindow);
+	req->windowid = wid;
+}
+
+/**
+ * GrGetWindowInfo:
+ * @wid: the ID of the window to retrieve information about
+ * @infoptr: pointer to a GR_WINDOW_INFO structure to return the information in
+ *
+ * Fills in a GR_WINDOW_INFO structure with information regarding the window
+ * with the specified window ID.
+ */
+void 
+GrGetWindowInfo(GR_WINDOW_ID wid, GR_WINDOW_INFO *infoptr)
+{
+	nxGetWindowInfoReq *req;
+
+	req = AllocReq(GetWindowInfo);
+	req->windowid = wid;
+	GrTypedReadBlock(infoptr, sizeof(GR_WINDOW_INFO), GrNumGetWindowInfo);
+}
+
+/**
+ * GrNewGC:
+ * @Returns: the ID of the newly created graphics context or 0 on error
+ *
+ * Creates a new graphics context structure and returns the ID used to refer
+ * to it. The structure is initialised with a set of default parameters.
+ */
+GR_GC_ID 
+GrNewGC(void)
+{
+	GR_GC_ID    gc;
+
+	AllocReq(NewGC);
+	if(GrTypedReadBlock(&gc, sizeof(gc),GrNumNewGC) == -1)
+		return 0;
+	return gc;
+}
+
+/**
+ * GrCopyGC:
+ * @gc: the already existing graphics context to copy the parameters from
+ * @Returns: the ID of the newly created graphics context or 0 on error
+ *
+ * Creates a new graphics context structure and fills it in with the values
+ * from the specified already existing graphics context.
+ */
+GR_GC_ID 
+GrCopyGC(GR_GC_ID gc)
+{
+	nxCopyGCReq *req;
+	GR_GC_ID     newgc;
+
+	req = AllocReq(CopyGC);
+	req->gcid = gc;
+	if(GrTypedReadBlock(&newgc, sizeof(newgc),GrNumCopyGC) == -1)
+		return 0;
+	return newgc;
+}
+
+/**
+ * GrDestroyGC:
+ * @gc: the ID of the graphics context structure to destroy
+ *
+ * Destroys the graphics context structure with the specified ID.
+ */
+void
+GrDestroyGC(GR_GC_ID gc)
+{
+	nxDestroyGCReq *req;
+
+	req = AllocReq(DestroyGC);
+	req->gcid = gc;
+}
+
+/**
+ * GrNewRegion:
+ * @Returns: the ID of the newly created region
+ *
+ * Creates a new region structure and returns the ID used to refer to it.
+ * The structure is initialised with a set of default parameters.
+ */
+GR_REGION_ID 
+GrNewRegion(void)
+{
+	GR_REGION_ID    region;
+
+	AllocReq(NewRegion);
+	if(GrTypedReadBlock(&region, sizeof(region),GrNumNewRegion) == -1)
+		return 0;
+	return region;
+}
+
+/**
+ * GrDestroyRegion:
+ * @region: the ID of the region structure to destroy
+ *
+ * Destroys the region structure with the specified ID.
+ */
+void
+GrDestroyRegion(GR_REGION_ID region)
+{
+	nxDestroyRegionReq *req;
+
+	req = AllocReq(DestroyRegion);
+	req->regionid = region;
+}
+
+/**
+ * GrUnionRectWithRegion:
+ * @region: the ID of the region to modify
+ * @rect: a pointer to the rectangle to add to the region
+ *
+ * Makes a union of the specified region and the specified rectangle and
+ * places the result back in the source region.
+ */
+void
+GrUnionRectWithRegion(GR_REGION_ID region, GR_RECT *rect)
+{
+	nxUnionRectWithRegionReq *req;
+
+ 	req = AllocReq(UnionRectWithRegion);
+ 	if(rect)
+ 		memcpy(&req->rect, rect, sizeof(*rect));
+ 	req->regionid = region;
+}
+
+/**
+ * GrUnionRegion:
+ * @dst_rgn: the ID of the destination region
+ * @src_rgn1: the ID of the first source region
+ * @src_rgn2: the ID of the second source region
+ *
+ * Makes a union of the specified source regions and places the result in the
+ * specified destination region.
+ */
+void
+GrUnionRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxUnionRegionReq *req;
+
+ 	req = AllocReq(UnionRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/**
+ * GrSubtractRegion:
+ * @dst_rgn: the ID of the destination region
+ * @src_rgn1: the ID of the first source region
+ * @src_rgn2: the ID of the second source region
+ *
+ * Subtracts the second source region from the first source region and places
+ * the result in the specified destination region.
+ */
+void
+GrSubtractRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxSubtractRegionReq *req;
+
+ 	req = AllocReq(SubtractRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/**
+ * GrXorRegion:
+ * @dst_rgn: the ID of the destination region
+ * @src_rgn1: the ID of the first source region
+ * @src_rgn2: the ID of the second source region
+ *
+ * Performs a logical exclusive OR operation on the specified source regions
+ * and places the result in the destination region. The destination region
+ * will contain only the parts of the source regions which do not overlap.
+ */
+void
+GrXorRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxXorRegionReq *req;
+
+ 	req = AllocReq(XorRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/**
+ * GrIntersectRegion:
+ * @dst_rgn: the ID of the destination region
+ * @src_rgn1: the ID of the first source region
+ * @src_rgn2: the ID of the second source region
+ *
+ * Calculates the intersection of the two specified source regions and places
+ * the result in the specified destination region. The destination region
+ * will contain only the parts of the source regions which overlap each other.
+ */
+void
+GrIntersectRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	nxIntersectRegionReq *req;
+
+ 	req = AllocReq(IntersectRegion);
+ 	req->regionid = dst_rgn;
+ 	req->srcregionid1 = src_rgn1;
+ 	req->srcregionid2 = src_rgn2;
+}
+
+/**
+ * GrSetGCRegion:
+ * @gc: the ID of the graphics context to set the clip mask of
+ * @region: the ID of the region to use as the clip mask
+ *
+ * Sets the clip mask of the specified graphics context to the specified
+ * region. Subsequent drawing operations using this graphics context will not
+ * draw outside the specified region. The region ID can be set to 0 to remove
+ * the clipping region from the specified graphics context.
+ */
+void
+GrSetGCRegion(GR_GC_ID gc, GR_REGION_ID region)
+{
+	nxSetGCRegionReq *req;
+	
+	req = AllocReq(SetGCRegion);
+	req->gcid = gc;
+	req->regionid = region;
+}
+
+/**
+ * GrPointInRegion:
+ * @region: the ID of the region to examine
+ * @x: the X coordinate of the point to test for
+ * @y: the Y coordinate of the point to test for
+ * @Returns: True if the point is within the region, or False otherwise
+ *
+ * Tests whether the specified point is within the specified region, and
+ * then returns either True or False depending on the result.
+ */
+GR_BOOL
+GrPointInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y)
+{
+	nxPointInRegionReq *req;
+	GR_BOOL             ret_value;
+
+	req = AllocReq(PointInRegion);
+	req->regionid = region;
+	req->x = x;
+	req->y = y;
+	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumPointInRegion) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/**
+ * GrRectInRegion:
+ * @region: the ID of the region to examine
+ * @x: the X coordinates of the rectangle to test
+ * @y: the Y coordinates of the rectangle to test
+ * @w: the width of the rectangle to test
+ * @h: the height of the rectangle to test
+ * @Returns: GR_RECT_PARTIN, GR_RECT_ALLIN, or GR_RECT_OUT
+ *
+ * Tests whether the specified rectangle is contained within the specified
+ * region. Returns GR_RECT_OUT if it is not inside it at all, GR_RECT_ALLIN
+ * if it is completely contained within the region, or GR_RECT_PARTIN if
+ * it is partially contained within the region.
+ */
+int
+GrRectInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y, GR_COORD w,
+	GR_COORD h)
+{
+	nxRectInRegionReq *req;
+	unsigned short	   ret_value;
+	
+	req = AllocReq(RectInRegion);
+	req->regionid = region;
+	req->x = x;
+	req->y = y;
+	req->w = w;
+	req->h = h;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumRectInRegion) == -1)
+		return 0;
+	return (int)ret_value;
+}
+
+/**
+ * GrEmptyRegion:
+ * @region: the ID of the region to examine
+ * @Returns: GR_TRUE if the region is empty, or GR_FALSE if it is not
+ *
+ * Determines whether the specified region is empty, and returns GR_TRUE
+ * if it is, or GR_FALSE otherwise.
+ */
+GR_BOOL
+GrEmptyRegion(GR_REGION_ID region)
+{
+	nxEmptyRegionReq *req;
+	GR_BOOL 	  ret_value;
+	
+	req = AllocReq(EmptyRegion);
+	req->regionid = region;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumEmptyRegion) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/**
+ * GrEqualRegion:
+ * @rgn1: the ID of the first region to examine
+ * @rgn2: the ID of the second region to examine
+ * @Returns: GR_TRUE if the regions are equal, or GR_FALSE otherwise
+ *
+ * Determines whether the specified regions are identical, and returns GR_TRUE
+ * if it is, or GR_FALSE otherwise.
+ */
+GR_BOOL
+GrEqualRegion(GR_REGION_ID rgn1, GR_REGION_ID rgn2)
+{
+	nxEqualRegionReq *req;
+	GR_BOOL 	  ret_value;
+	
+	req = AllocReq(EqualRegion);
+	req->region1 = rgn1;
+	req->region2 = rgn2;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumEqualRegion) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/**
+ * GrOffsetRegion:
+ * @region: the ID of the region to offset
+ * @dx: the distance to offset the region by in the X axis
+ * @dy: the distance to offset the region by in the Y axis
+ *
+ * Offsets the specified region by the specified distance.
+ */
+void
+GrOffsetRegion(GR_REGION_ID region, GR_SIZE dx, GR_SIZE dy)
+{
+	nxOffsetRegionReq *req;
+	
+	req = AllocReq(OffsetRegion);
+	req->region = region;
+	req->dx = dx;
+	req->dy = dy;
+}
+
+/**
+ * GrGetRegionBox:
+ * @region: the ID of the region to get the bounding box of
+ * @rect: pointer to a rectangle structure
+ * @Returns: the region type
+ *
+ * Fills in the specified rectangle structure with a bounding box that would
+ * completely enclose the specified region, and also returns the type of the
+ * specified region. 
+ */
+int
+GrGetRegionBox(GR_REGION_ID region, GR_RECT *rect)
+{
+	nxGetRegionBoxReq *req;
+	unsigned short	   ret_value;
+	
+	if (!rect)
+		return GR_FALSE;
+	req = AllocReq(GetRegionBox);
+	req->regionid = region;
+ 	if(GrTypedReadBlock(rect, sizeof(*rect), GrNumGetRegionBox) == -1)
+		return GR_FALSE;
+ 	if(GrTypedReadBlock(&ret_value, sizeof(ret_value),
+		GrNumGetRegionBox) == -1)
+		return GR_FALSE;
+	return ret_value;
+}
+
+/**
+ * GrNewPolygonRegion:
+ * @mode: the polygon mode to use (GR_POLY_EVENODD or GR_POLY_WINDING)
+ * @count: the number of points in the polygon
+ * @points: pointer to an array of point structures describing the polygon
+ * @Returns: the ID of the newly allocated region structure, or 0 on error
+ *
+ * Creates a new region structure, fills it with the region described by the
+ * specified polygon, and returns the ID used to refer to it.
+ */
+GR_REGION_ID 
+GrNewPolygonRegion(int mode, GR_COUNT count, GR_POINT *points)
+{
+	nxNewPolygonRegionReq	*req;
+	long			size;
+	GR_REGION_ID		region;
+
+	if(count == 0)
+		return GrNewRegion();
+	
+	if(points == NULL)
+		return 0;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(NewPolygonRegion, size);
+	req->mode = mode;
+	/* FIXME: unportable method, depends on sizeof(int) in GR_POINT*/
+	memcpy(GetReqData(req), points, size);
+
+	if(GrTypedReadBlock(&region, sizeof(region),
+		GrNumNewPolygonRegion) == -1)
+		return 0;
+	return region;
+}
+
+/**
+ * GrMapWindow:
+ * @wid: the ID of the window to map
+ *
+ * Recursively maps (makes visible) the specified window and all of the
+ * child windows which have a sufficient map count. The border and background
+ * of the window are painted, and an exposure event is generated for the
+ * window and every child which becomes visible.
+ */
+void 
+GrMapWindow(GR_WINDOW_ID wid)
+{
+	nxMapWindowReq *req;
+
+	req = AllocReq(MapWindow);
+	req->windowid = wid;
+}
+
+/**
+ * GrUnmapWindow:
+ * @wid: the ID of the window to unmap
+ *
+ * Recursively unmaps (makes invisible) the specified window and all of the
+ * child windows.
+ */
+void 
+GrUnmapWindow(GR_WINDOW_ID wid)
+{
+	nxUnmapWindowReq *req;
+
+	req = AllocReq(UnmapWindow);
+	req->windowid = wid;
+}
+
+/**
+ * GrRaiseWindow:
+ * @wid: the ID of the window to raise
+ *
+ * Places the specified window at the top of its parents drawing stack, above
+ * all of its sibling windows.
+ */
+void 
+GrRaiseWindow(GR_WINDOW_ID wid)
+{
+	nxRaiseWindowReq *req;
+
+	req = AllocReq(RaiseWindow);
+	req->windowid = wid;
+}
+
+/**
+ * GrLowerWindow:
+ * @wid: the ID of the window to lower
+ *
+ * Places the specified window at the bottom of its parents drawing stack,
+ * below all of its sibling windows.
+ */
+void 
+GrLowerWindow(GR_WINDOW_ID wid)
+{
+	nxLowerWindowReq *req;
+
+	req = AllocReq(LowerWindow);
+	req->windowid = wid;
+}
+
+/**
+ * GrMoveWindow:
+ * @wid: the ID of the window to move
+ * @x: the X coordinate to move the window to relative to its parent.
+ * @y: the Y coordinate to move the window to relative to its parent.
+ * 
+ * Moves the specified window to the specified position relative to its
+ * parent window.
+ */
+void 
+GrMoveWindow(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y)
+{
+	nxMoveWindowReq *req;
+
+	req = AllocReq(MoveWindow);
+	req->windowid = wid;
+	req->x = x;
+	req->y = y;
+}
+
+/**
+ * GrResizeWindow:
+ * @wid: the ID of the window to resize
+ * @width: the width to resize the window to
+ * @height: the height to resize the window to
+ *
+ * Resizes the specified window to be the specified width and height.
+ */
+void 
+GrResizeWindow(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height)
+{
+	nxResizeWindowReq *req;
+
+	req = AllocReq(ResizeWindow);
+	req->windowid = wid;
+	req->width = width;
+	req->height = height;
+}
+
+/**
+ * GrReparentWindow:
+ * @wid: the ID of the window to reparent
+ * @pwid: the ID of the new parent window
+ * @x: the X coordinate to place the window at relative to the new parent
+ * @y: the Y coordinate to place the window at relative to the new parent
+ *
+ * Changes the parent window of the specified window to the specified parent
+ * window and places it at the specified coordinates relative to the new
+ * parent.
+ */
+void 
+GrReparentWindow(GR_WINDOW_ID wid, GR_WINDOW_ID pwid, GR_COORD x, GR_COORD y)
+{
+	nxReparentWindowReq *req;
+
+	req = AllocReq(ReparentWindow);
+	req->windowid = wid;
+	req->parentid = pwid;
+	req->x = x;
+	req->y = y;
+}
+
+/**
+ * GrClearWindow:
+ * @wid: the ID of the window to clear
+ * @exposeflag: a flag indicating whether to also generate an exposure event
+ *
+ * Clears the specified window by setting it to its background color.
+ * If the exposeflag parameter is non zero, an exposure event is generated for
+ * the window after it has been cleared.
+ */
+void 
+GrClearWindow(GR_WINDOW_ID wid, GR_BOOL exposeflag)
+{
+	nxClearWindowReq *req;
+
+	req = AllocReq(ClearWindow);
+	req->windowid = wid;
+	req->exposeflag = exposeflag;
+}
+
+/**
+ * GrGetFocus:
+ * @Returns: the ID of the window which currently has the keyboard focus
+ *
+ * Returns the ID of the window which currently has the keyboard focus.
+ */
+GR_WINDOW_ID
+GrGetFocus(void)
+{
+	GR_WINDOW_ID    wid;
+
+	AllocReq(GetFocus);
+	if(GrTypedReadBlock(&wid, sizeof(wid), GrNumGetFocus) == -1)
+		return 0;
+	return wid;
+}
+
+/**
+ * GrSetFocus:
+ * @wid: the ID of the window to set the focus to
+ *
+ * Sets the keyboard focus to the specified window.
+ */
+void 
+GrSetFocus(GR_WINDOW_ID wid)
+{
+	nxSetFocusReq *req;
+
+	req = AllocReq(SetFocus);
+	req->windowid = wid;
+}
+
+/**
+ * GrSetBorderColor:
+ * @wid: the ID of the window to set the border colour of
+ * @colour: the colour to set the border to
+ *
+ * Sets the border colour of the specified window to the specified colour.
+ */
+void 
+GrSetBorderColor(GR_WINDOW_ID wid, GR_COLOR colour)
+{
+	nxSetBorderColorReq *req;
+
+	req = AllocReq(SetBorderColor);
+	req->windowid = wid;
+	req->color = colour;
+}
+
+/**
+ * GrSetCursor:
+ * @wid: the ID of the window to set the cursor of
+ * @width: the width of the pointer bitmap
+ * @height: the height of the pointer bitmap
+ * @hotx: the X coordinate within the bitmap used as the target of the pointer
+ * @hoty: the Y coordinate within the bitmap used as the target of the pointer
+ * @foreground: the colour to use for the foreground of the pointer
+ * @background: the colour to use for the background of the pointer
+ * @fgbitmap: pointer to bitmap data specifying the foreground of the pointer
+ * @bgbitmap: pointer to bitmap data specifying the background of the pointer
+ *
+ * Specifies a cursor (mouse pointer graphic) to display when the mouse
+ * pointer is over the specified window and subsequently created children.
+ * Points in the bitmap which have neither the foreground or background bits
+ * set are not painted.
+ */
+void
+GrSetCursor(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height, GR_COORD hotx,
+	GR_COORD hoty, GR_COLOR foreground, GR_COLOR background,
+	GR_BITMAP *fgbitmap, GR_BITMAP *bgbitmap)
+{
+	nxSetCursorReq *req;
+	int 	     	bitmapsize;
+	char *	     	data;
+
+	bitmapsize = GR_BITMAP_SIZE(width, height) * sizeof(GR_BITMAP);
+	req = AllocReqExtra(SetCursor, bitmapsize*2);
+	req->windowid = wid;
+	req->width = width;
+	req->height = height;
+	req->hotx = hotx;
+	req->hoty = hoty;
+	req->fgcolor = foreground;
+	req->bgcolor = background;
+	//req->flags = flags;
+	data = GetReqData(req);
+	memcpy(data, fgbitmap, bitmapsize);
+	memcpy(data+bitmapsize, bgbitmap, bitmapsize);
+}
+
+/**
+ * GrMoveCursor:
+ * @x: the X coordinate to move the pointer to
+ * @y: the Y coordinate to move the pointer to
+ *
+ * Moves the cursor (mouse pointer) to the specified coordinates.
+ * The coordinates are relative to the root window, where (0,0) is the upper
+ * left hand corner of the screen. The reference point used for the pointer
+ * is that of the "hot spot". After moving the pointer, the graphic used for
+ * the pointer will change to the graphic defined for use in the window which
+ * it is over.
+ */
+void 
+GrMoveCursor(GR_COORD x, GR_COORD y)
+{
+	nxMoveCursorReq *req;
+
+	req = AllocReq(MoveCursor);
+	req->x = x;
+	req->y = y;
+}
+
+/**
+ * GrSetGCForeground:
+ * @gc: the ID of the graphics context to set the foreground colour of
+ * @foreground: the colour to use as the new foreground colour
+ *
+ * Changes the foreground colour of the specified graphics context to the
+ * specified colour.
+ */
+void 
+GrSetGCForeground(GR_GC_ID gc, GR_COLOR foreground)
+{
+	nxSetGCForegroundReq *req;
+
+	req = AllocReq(SetGCForeground);
+	req->gcid = gc;
+	req->color = foreground;
+}
+
+/**
+ * GrSetGCBackground:
+ * @gc: the ID of the graphics context to set the background colour of
+ * @background: the colour to use as the new background colour
+ *
+ * Changes the background colour of the specified graphics context to the
+ * specified colour.
+ */
+void 
+GrSetGCBackground(GR_GC_ID gc, GR_COLOR background)
+{
+	nxSetGCBackgroundReq *req;
+
+	req = AllocReq(SetGCBackground);
+	req->gcid = gc;
+	req->color = background;
+}
+
+/**
+ * GrSetGCMode:
+ * @gc: the ID of the graphics context to set the drawing mode of
+ * @mode: the new drawing mode
+ *
+ * Changes the drawing mode (SET, XOR, OR, AND, etc.) of the specified
+ * graphics context to the specified mode.
+ */
+void 
+GrSetGCMode(GR_GC_ID gc, int mode)
+{
+	nxSetGCModeReq *req;
+
+	req = AllocReq(SetGCMode);
+	req->gcid = gc;
+	req->mode = mode;
+}
+
+/**
+ * GrSetGCUseBackground:
+ * @gc: the ID of the graphics context to change the "use background" flag of
+ * @flag: flag specifying whether to use the background colour or not
+ *
+ * Sets the flag which chooses whether or not the background colour is used
+ * when drawing bitmaps and text using the specified graphics context to the
+ * specified value.
+ */
+void 
+GrSetGCUseBackground(GR_GC_ID gc, GR_BOOL flag)
+{
+	nxSetGCUseBackgroundReq *req;
+
+	req = AllocReq(SetGCUseBackground);
+	req->gcid = gc;
+	req->flag = flag;
+}
+
+/**
+ * GrCreateFont:
+ * @name: string containing the name of a built in font to look for
+ * @height: the desired height of the font
+ * @plogfont: pointer to a LOGFONT structure
+ * @Returns: a font ID number which can be used to refer to the font
+ *
+ * Attempts to locate a font with the desired attributes and returns a font
+ * ID number which can be used to refer to it. If the plogfont argument is
+ * not NULL, the values in that structure will be used to choose a font.
+ * Otherwise, if the height is non zero, the built in font with the closest
+ * height to that specified will be used. If the height is zero, the built
+ * in font with the specified name will be used. If the desired font is not
+ * found, the first built in font will be returned as a last resort.
+ */
+GR_FONT_ID
+GrCreateFont(GR_CHAR *name, GR_COORD height, GR_LOGFONT *plogfont)
+{
+	nxCreateFontReq *req;
+	GR_FONT_ID	fontid;
+
+ 	req = AllocReq(CreateFont);
+ 	if (plogfont) {
+ 		memcpy(&req->lf, plogfont, sizeof(*plogfont));
+ 		req->height = 0;
+ 		req->lf_used = 1;
+ 	} else {
+		if (name)
+			strcpy(req->lf.lfFaceName, name);
+		else req->lf.lfFaceName[0] = '\0';
+  		req->height = height;
+ 		req->lf_used = 0;
+	}
+  
+	if(GrTypedReadBlock(&fontid, sizeof(fontid),GrNumCreateFont) == -1)
+		return 0;
+	return fontid;
+}
+
+/**
+ * GrSetFontSize:
+ * @fontid: the ID number of the font to change the size of
+ * @fontsize: the size to change the font to
+ *
+ * Changes the size of the specified font to the specified size.
+ */
+void
+GrSetFontSize(GR_FONT_ID fontid, GR_COORD fontsize)
+{
+	nxSetFontSizeReq *req;
+
+	req = AllocReq(SetFontSize);
+	req->fontid = fontid;
+	req->fontsize = fontsize;
+}
+
+/**
+ * GrSetFontRotation:
+ * @fontid: the ID number of the font to rotate
+ * @tenthdegrees: the angle to set the rotation to in tenths of a degree
+ *
+ * Changes the rotation of the specified font to the specified angle.
+ */
+void
+GrSetFontRotation(GR_FONT_ID fontid, int tenthdegrees)
+{
+	nxSetFontRotationReq *req;
+
+	req = AllocReq(SetFontRotation);
+	req->fontid = fontid;
+	req->tenthdegrees = tenthdegrees;
+}
+
+/**
+ * GrSetFontAttr:
+ * @fontid: the ID of the font to set the attributes of
+ * @setflags: mask specifying attribute flags to set
+ * @clrflags: mask specifying attribute flags to clear
+ *
+ * Changes the attributes (GR_TFKERNING, GR_TFANTIALIAS, GR_TFUNDERLINE, etc.)
+ * of the specified font according to the set and clear mask arguments.
+ */
+void
+GrSetFontAttr(GR_FONT_ID fontid, int setflags, int clrflags)
+{
+	nxSetFontAttrReq *req;
+
+	req = AllocReq(SetFontAttr);
+	req->fontid = fontid;
+	req->setflags = setflags;
+	req->clrflags = clrflags;
+}
+
+/**
+ * GrDestroyFont:
+ * @fontid: the ID of the font to destroy
+ *
+ * Frees all resources associated with the specified font ID, and if the font
+ * is a non built in type and this is the last ID referring to it, unloads the
+ * font from memory.
+ */
+void
+GrDestroyFont(GR_FONT_ID fontid)
+{
+	nxDestroyFontReq *req;
+
+	req = AllocReq(DestroyFont);
+	req->fontid = fontid;
+}
+
+/**
+ * GrSetGCFont:
+ * @gc: the ID of the graphics context to set the font of
+ * @font: the ID of the font
+ *
+ * Sets the font to be used for text drawing in the specified graphics
+ * context to the specified font ID.
+ */
+void
+GrSetGCFont(GR_GC_ID gc, GR_FONT_ID font)
+{
+	nxSetGCFontReq *req;
+
+	req = AllocReq(SetGCFont);
+	req->gcid = gc;
+	req->fontid = font;
+}
+
+/**
+ * GrLine:
+ * @id: the ID of the drawable to draw the line on
+ * @gc: the ID of the graphics context to use when drawing the line
+ * @x1: the X coordinate of the start of the line relative to the drawable
+ * @y1: the Y coordinate of the start of the line relative to the drawable
+ * @x2: the X coordinate of the end of the line relative to the drawable
+ * @y2: the Y coordinate of the end of the line relative to the drawable
+ *
+ * Draws a line using the specified graphics context on the specified drawable
+ * from (x1, y1) to (x2, y2), with coordinates given relative to the drawable.
+ */
+void 
+GrLine(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x1, GR_COORD y1, GR_COORD x2,
+	GR_COORD y2)
+{
+	nxLineReq *req;
+
+	req = AllocReq(Line);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x1 = x1;
+	req->y1 = y1;
+	req->x2 = x2;
+	req->y2 = y2;
+}
+
+/**
+ * GrRect:
+ * @id: the ID of the drawable to draw the rectangle on
+ * @gc: the ID of the graphics context to use when drawing the rectangle
+ * @x: the X coordinate of the rectangle relative to the drawable
+ * @y: the Y coordinate of the rectangle relative to the drawable
+ * @width: the width of the rectangle
+ * @height: the height of the rectangle
+ *
+ * Draw the boundary of a rectangle of the specified dimensions and position
+ * on the specified drawable using the specified graphics context.
+ */
+void 
+GrRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height)
+{
+	nxRectReq *req;
+
+	req = AllocReq(Rect);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+}
+
+/**
+ * GrFillRect:
+ * @id: the ID of the drawable to draw the rectangle on
+ * @gc: the ID of the graphics context to use when drawing the rectangle
+ * @x: the X coordinate of the rectangle relative to the drawable
+ * @y: the Y coordinate of the rectangle relative to the drawable
+ * @width: the width of the rectangle
+ * @height: the height of the rectangle
+ *
+ * Draw a filled rectangle of the specified dimensions and position on the
+ * specified drawable using the specified graphics context.
+ */
+void 
+GrFillRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height)
+{
+	nxFillRectReq *req;
+
+	req = AllocReq(FillRect);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+}
+
+/**
+ * GrEllipse:
+ * @id: the ID of the drawable to draw the ellipse on
+ * @gc: the ID of the graphics context to use when drawing the ellipse
+ * @x: the X coordinate to draw the ellipse at relative to the drawable
+ * @y: the Y coordinate to draw the ellipse at relative to the drawable
+ * @rx: the radius of the ellipse on the X axis
+ * @ry: the radius of the ellipse on the Y axis
+ *
+ * Draws the boundary of ellipse at the specified position using the specified
+ * dimensions and graphics context on the specified drawable.
+ */
+void 
+GrEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx,
+	GR_SIZE ry)
+{
+	nxEllipseReq *req;
+
+	req = AllocReq(Ellipse);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+}
+
+/**
+ * GrFillEllipse:
+ * @id: the ID of the drawable to draw the filled ellipse on
+ * @gc: the ID of the graphics context to use when drawing the ellipse
+ * @x: the X coordinate to draw the ellipse at relative to the drawable
+ * @y: the Y coordinate to draw the ellipse at relative to the drawable
+ * @rx: the radius of the ellipse on the X axis
+ * @ry: the radius of the ellipse on the Y axis
+ *
+ * Draws a filled ellipse at the specified position using the specified
+ * dimensions and graphics context on the specified drawable.
+ */
+void 
+GrFillEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry)
+{
+	nxFillEllipseReq *req;
+
+	req = AllocReq(FillEllipse);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+}
+
+/**
+ * GrArc:
+ * @id: the ID of the drawable to draw the arc on
+ * @gc: the graphics context to use when drawing the arc
+ * @x: the X coordinate to draw the arc at relative to the drawable
+ * @y: the Y coordinate to draw the arc at relative to the drawable
+ * @rx: the radius of the arc on the X axis
+ * @ry: the radius of the arc on the Y axis
+ * @ax: the X coordinate of the start of the arc relative to the drawable
+ * @ay: the Y coordinate of the start of the arc relative to the drawable
+ * @bx: the X coordinate of the end of the arc relative to the drawable
+ * @by: the Y coordinate of the end of the arc relative to the drawable
+ * @type: the fill style to use when drawing the arc
+ *
+ * Draws an arc with the specified dimensions at the specified position
+ * on the specified drawable using the specified graphics context.
+ * The type specifies the fill type. Possible values include GR_ARC and
+ * GR_PIE.
+ */
+void	
+GrArc(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry, GR_COORD ax, GR_COORD ay,
+	GR_COORD bx, GR_COORD by, int type)
+{
+	nxArcReq *req;
+
+	req = AllocReq(Arc);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+	req->ax = ax;
+	req->ay = ay;
+	req->bx = bx;
+	req->by = by;
+	req->type = type;
+}
+
+/**
+ * GrArcAngle:
+ * @id: the ID of the drawable to draw the arc on
+ * @gc: the graphics context to use when drawing the arc
+ * @x: the X coordinate to draw the arc at relative to the drawable
+ * @y: the Y coordinate to draw the arc at relative to the drawable
+ * @rx: the radius of the arc on the X axis
+ * @ry: the radius of the arc on the Y axis
+ * @angle1: the angle of the start of the arc
+ * @angle2: the angle of the end of the arc
+ * @type: the fill style to use when drawing the arc
+ *
+ * Draws an arc with the specified dimensions at the specified position
+ * on the specified drawable using the specified graphics context.
+ * The type specifies the fill type. Possible values include GR_ARC and
+ * GR_PIE. This function requires floating point support, and is slightly
+ * slower than the GrArc() function which does not require floating point.
+ */
+void
+GrArcAngle(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry, GR_COORD angle1, GR_COORD angle2, int type)
+{
+	nxArcAngleReq *req;
+
+	req = AllocReq(ArcAngle);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->rx = rx;
+	req->ry = ry;
+	req->angle1 = angle1;
+	req->angle2 = angle2;
+	req->type = type;
+}
+
+/**
+ * GrBitmap:
+ * @id: the ID of the drawable to draw the bitmap onto
+ * @gc: the ID of the graphics context to use when drawing the bitmap
+ * @x: the X coordinate to draw the bitmap at relative to the drawable
+ * @y: the Y coordinate to draw the bitmap at relative to the drawable
+ * @width: the width of the bitmap
+ * @height: the height of the bitmap
+ * @bitmaptable: pointer to the bitmap data
+ *
+ * Draws the monochrome bitmap data provided in the bitmaptable argument
+ * at the specified position on the specified drawable using the specified
+ * graphics context. Note that the bitmap data should be an array of aligned
+ * 16 bit words. The usebackground flag in the graphics context specifies
+ * whether to draw the background colour wherever a bit value is zero.
+ */
+void 
+GrBitmap(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, GR_BITMAP *bitmaptable)
+{
+	nxBitmapReq *req;
+	long 	     bitmapsize;
+
+	bitmapsize = (long)GR_BITMAP_SIZE(width, height) * sizeof(GR_BITMAP);
+	req = AllocReqExtra(Bitmap, bitmapsize);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	memcpy(GetReqData(req), bitmaptable, bitmapsize);
+}
+
+/**
+ * GrDrawImageBits:
+ * @id: the ID of the drawable to draw the image onto
+ * @gc: the ID of the graphics context to use when drawing the image
+ * @x: the X coordinate to draw the image at relative to the drawable
+ * @y: the Y coordinate to draw the image at relative to the drawable
+ * @pimage: pointer to the image structure
+ *
+ * Draws the image contained in the specified image structure onto the
+ * specified drawable at the specified coordinates using the specified
+ * graphics context.
+ */
+void
+GrDrawImageBits(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_IMAGE_HDR *pimage)
+{
+	nxDrawImageBitsReq	*req;
+	int			imagesize;
+	int			palsize;
+	char			*addr;
+
+	imagesize = pimage->pitch * pimage->height;
+	palsize = pimage->palsize * sizeof(MWPALENTRY);
+	req = AllocReqExtra(DrawImageBits, imagesize + palsize);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	/* fill MWIMAGEHDR items passed externally*/
+	req->width = pimage->width;
+	req->height = pimage->height;
+	req->planes = pimage->planes;
+	req->bpp = pimage->bpp;
+	req->pitch = pimage->pitch;
+	req->bytesperpixel = pimage->bytesperpixel;
+	req->compression = pimage->compression;
+	req->palsize = pimage->palsize;
+	req->transcolor = pimage->transcolor;
+	addr = GetReqData(req);
+	memcpy(addr, pimage->imagebits, imagesize);
+	memcpy(addr+imagesize, pimage->palette, palsize);
+}
+
+/**
+ * GrDrawImageFromFile:
+ * @id: the ID of the drawable to draw the image onto
+ * @gc: the ID of the graphics context to use when drawing the image
+ * @x: the X coordinate to draw the image at relative to the drawable
+ * @y: the Y coordinate to draw the image at relative to the drawable
+ * @width: the maximum image width
+ * @height: the maximum image height
+ * @path: string containing the filename of the image to load
+ * @flags: flags specific to the particular image loader
+ *
+ * Loads the specified image file and draws it at the specified position
+ * on the specified drawable using the specified graphics context. The
+ * width and height values specify the size of the image to draw- if the
+ * actual image is a different size, it will be scaled to fit. The image type
+ * is automatically detected using the magic numbers in the image header (ie.
+ * the filename extension is irrelevant). The currently supported image types
+ * include GIF, JPEG, Windows BMP, PNG, XPM, and both ascii and binary
+ * variants of PBM, PGM, and PPM. However the image types supported by a
+ * particular server depend on which image types were enabled in the server
+ * configuration at build time. 
+ */
+void
+GrDrawImageFromFile(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, char* path, int flags)
+{
+	nxDrawImageFromFileReq *req;
+
+	req = AllocReqExtra(DrawImageFromFile, strlen(path)+1);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	req->flags = flags;
+	memcpy(GetReqData(req), path, strlen(path)+1);
+}
+
+/**
+ * GrLoadImageFromFile:
+ * @path: string containing the filename of the image to load
+ * @flags: flags specific to the particular image loader
+ * @Returns: ID of the image buffer the image was loaded into
+ *
+ * Loads the specified image file into a newly created server image buffer
+ * and returns the ID of the buffer. The image type is automatically detected
+ * using the magic numbers in the image header (ie. the filename extension is
+ * irrelevant). The currently supported image types include GIF, JPEG, Windows
+ * BMP, PNG, XPM, and both ascii and binary variants of PBM, PGM, and PPM.
+ * However the image types supported by a particular server depend on which
+ * image types were enabled in the server configuration at build time. 
+ */
+GR_IMAGE_ID
+GrLoadImageFromFile(char *path, int flags)
+{
+	nxLoadImageFromFileReq *req;
+	GR_IMAGE_ID		imageid;
+
+	req = AllocReqExtra(LoadImageFromFile, strlen(path)+1);
+	req->flags = flags;
+	memcpy(GetReqData(req), path, strlen(path)+1);
+
+	if(GrTypedReadBlock(&imageid, sizeof(imageid),
+		GrNumLoadImageFromFile) == -1)
+			return 0;
+	return imageid;
+}
+
+/**
+ * GrDrawImageToFit:
+ * @id: the ID of the drawable to draw the image onto
+ * @gc: the ID of the graphics context to use when drawing the image
+ * @x: the X coordinate to draw the image at relative to the drawable
+ * @y: the Y coordinate to draw the image at relative to the drawable
+ * @width: the maximum image width
+ * @height: the maximum image height
+ * @imageid: the ID of the image buffer containing the image to display
+ *
+ * Draws the image from the specified image buffer at the specified position
+ * on the specified drawable using the specified graphics context. The
+ * width and height values specify the size of the image to draw- if the
+ * actual image is a different size, it will be scaled to fit.
+ */ 
+void
+GrDrawImageToFit(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, GR_IMAGE_ID imageid)
+{
+	nxDrawImageToFitReq *req;
+
+	req = AllocReq(DrawImageToFit);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	req->imageid = imageid;
+}
+
+/**
+ * GrFreeImage:
+ * @id: ID of the image buffer to free
+ *
+ * Destroys the specified image buffer and reclaims the memory used by it.
+ */
+void
+GrFreeImage(GR_IMAGE_ID id)
+{
+	nxFreeImageReq *req;
+
+	req = AllocReq(FreeImage);
+	req->id = id;
+}
+
+/**
+ * GrGetImageInfo:
+ * @id: ID of an image buffer
+ * @iip: pointer to a GR_IMAGE_INFO structure
+ *
+ * Fills in the specified image information structure with the details of the
+ * specified image buffer.
+ */
+void
+GrGetImageInfo(GR_IMAGE_ID id, GR_IMAGE_INFO *iip)
+{
+	nxGetImageInfoReq *req;
+
+	req = AllocReq(GetImageInfo);
+	req->id = id;
+	GrTypedReadBlock(iip, sizeof(GR_IMAGE_INFO), GrNumGetImageInfo);
+}
+
+/*
+ * Draw a rectangular area in the specified drawable using the specified
+ * graphics context.  This differs from rectangle drawing in that the
+ * color values for each pixel in the rectangle are specified.
+ * The color table is indexed
+ * row by row.  Values whose color matches the background color are only
+ * written if the usebackground flag is set in the GC.
+ *
+ * The pixels are packed according to pixtype:
+ *
+ * pixtype		array of
+ * MWPF_RGB		MWCOLORVAL (unsigned long)
+ * MWPF_PIXELVAL	MWPIXELVAL (compile-time dependent)
+ * MWPF_PALETTE		unsigned char
+ * MWPF_TRUECOLOR0888	unsigned long
+ * MWPF_TRUECOLOR888	packed struct {char r,char g,char b} (24 bits)
+ * MWPF_TRUECOLOR565	unsigned short
+ * MWPF_TRUECOLOR555	unsigned short
+ * MWPF_TRUECOLOR332	unsigned char
+ */
+/**
+ * GrArea:
+ * @id: the ID of the drawable to draw the area onto
+ * @gc: the ID of the graphics context to use when drawing the area
+ * @x: the X coordinate to draw the area at relative to the drawable
+ * @y: the Y coordinate to draw the area at relative to the drawable
+ * @width: the width of the area
+ * @height: the height of the area
+ * @pixels: pointer to an array containing the pixel data
+ * @pixtype: the format of the pixel data
+ *
+ * Draws the specified pixel array of the specified size and format onto the
+ * specified drawable using the specified graphics context at the specified
+ * position. Note that colour conversion is currently only performed when using
+ * the GR_PF_RGB format, which is an unsigned long containing RGBX data.
+ */
+void 
+GrArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, void *pixels, int pixtype)
+{
+	nxAreaReq *req;
+	long       size;
+	long       chunk_y;
+	int        pixsize;
+
+	/* Calculate size of packed pixels*/
+	switch(pixtype) {
+	case MWPF_RGB:
+		pixsize = sizeof(MWCOLORVAL);
+		break;
+	case MWPF_PIXELVAL:
+		pixsize = sizeof(MWPIXELVAL);
+		break;
+	case MWPF_PALETTE:
+	case MWPF_TRUECOLOR332:
+		pixsize = sizeof(unsigned char);
+		break;
+	case MWPF_TRUECOLOR0888:
+		pixsize = sizeof(unsigned long);
+		break;
+	case MWPF_TRUECOLOR888:
+		pixsize = 3;
+		break;
+	case MWPF_TRUECOLOR565:
+	case MWPF_TRUECOLOR555:
+		pixsize = sizeof(unsigned short);
+		break;
+	default:
+		return;
+	}
+
+	/* Break request into MAXREQUESTSZ size packets*/
+	while(height > 0) {
+		chunk_y = (MAXREQUESTSZ - sizeof(nxAreaReq)) /
+			((long)width * pixsize);
+		if(chunk_y > height)
+			chunk_y = height;
+		size = chunk_y * ((long)width * pixsize);
+		req = AllocReqExtra(Area, size);
+		req->drawid = id;
+		req->gcid = gc;
+		req->x = x;
+		req->y = y;
+		req->width = width;
+		req->height = chunk_y;
+		req->pixtype = pixtype;
+		memcpy(GetReqData(req), pixels, size);
+		pixels = (void *)(((char *)pixels) + size);
+		y += chunk_y;
+		height -= chunk_y;
+	}
+}
+
+/**
+ * GrCopyArea:
+ * @id: the ID of the drawable to copy the area to
+ * @gc: the ID of the graphics context to use when copying the area
+ * @x: the X coordinate to copy the area to within the destination drawable
+ * @y: the Y coordinate to copy the area to within the destination drawable
+ * @width: the width of the area to copy
+ * @height: the height of the area to copy
+ * @srcid: the ID of the drawable to copy the area from
+ * @srcx: the X coordinate to copy the area from within the source drawable
+ * @srcy: the Y coordinate to copy the area from within the source drawable
+ * @op: the ROP codes to pass to the blitter when performing the copy
+ *
+ * Copies the specified area of the specified size between the specified
+ * drawables at the specified positions using the specified graphics context
+ * and ROP codes. 0 is a sensible default ROP code in most cases.
+ */
+void
+GrCopyArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, GR_DRAW_ID srcid,
+	GR_COORD srcx, GR_COORD srcy, int op)
+{
+	nxCopyAreaReq *req;
+
+        req = AllocReq(CopyArea);
+        req->drawid = id;
+        req->gcid = gc;
+        req->x = x;
+        req->y = y;
+        req->width = width;
+        req->height = height;
+        req->srcid = srcid;
+        req->srcx = srcx;
+        req->srcy = srcy;
+        req->op = op;
+}
+   
+   
+/**
+ * GrReadArea:
+ * @id: the ID of the drawable to read an area from
+ * @x: the X coordinate to read the area from relative to the drawable
+ * @y: the Y coordinate to read the area from relative to the drawable
+ * @width: the width of the area to read
+ * @height: the height of the area to read
+ * @pixels: pointer to an area of memory to place the pixel data in
+ *
+ * Reads the pixel data of the specified size from the specified position on
+ * the specified drawable into the specified pixel array. If the drawable is
+ * a window, the data returned will be the pixel values from the relevant
+ * position on the screen regardless of whether the window is obscured by other
+ * windows. If the window is unmapped, or partially or fully outside a window
+ * boundary, black pixel values will be returned.
+ */
+void 
+GrReadArea(GR_DRAW_ID id,GR_COORD x,GR_COORD y,GR_SIZE width,
+	GR_SIZE height, GR_PIXELVAL *pixels)
+{
+	nxReadAreaReq *req;
+	long           size;
+
+	req = AllocReq(ReadArea);
+	req->drawid = id;
+	req->x = x;
+	req->y = y;
+	req->width = width;
+	req->height = height;
+	size = (long)width * height * sizeof(MWPIXELVAL);
+	GrTypedReadBlock(pixels, size, GrNumReadArea);
+}
+
+/**
+ * GrPoint:
+ * @id: the ID of the drawable to draw a point on
+ * @gc: the ID of the graphics context to use when drawing the point
+ * @x: the X coordinate to draw the point at relative to the drawable
+ * @y: the Y coordinate to draw the point at relative to the drawable
+ *
+ * Draws a point using the specified graphics context at the specified position
+ * on the specified drawable.
+ */
+void 
+GrPoint(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y)
+{
+	nxPointReq *req;
+
+	req = AllocReq(Point);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+
+}
+
+/**
+ * GrPoints:
+ * @id: the ID of the drawable to draw a point on
+ * @gc: the ID of the graphics context to use when drawing the point
+ * @count: the number of points in the point table
+ * @pointtable: pointer to a GR_POINT array which lists the points to draw
+ *
+ * Draws a set of points using the specified graphics context at the positions
+ * specified by the point table on the specified drawable.
+ */
+void
+GrPoints(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable)
+{
+	nxPointsReq *req;
+	long	size;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(Points, size);
+	req->drawid = id;
+	req->gcid = gc;
+	memcpy(GetReqData(req), pointtable, size);
+}
+
+/**
+ * GrPoly:
+ * @id: the ID of the drawable to draw the polygon onto
+ * @gc: the ID of the graphics context to use when drawing the polygon
+ * @count: the number of points in the point array
+ * @pointtable: pointer to an array of points describing the polygon
+ *
+ * Draws an unfilled polygon on the specified drawable using the specified
+ * graphics context. The polygon is specified by an array of point structures.
+ * The polygon is not automatically closed- if a closed polygon is desired,
+ * the last point must be the same as the first.
+ */
+void 
+GrPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable)
+{
+	nxPolyReq *req;
+	long       size;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(Poly, size);
+	req->drawid = id;
+	req->gcid = gc;
+	memcpy(GetReqData(req), pointtable, size);
+}
+
+/**
+ * GrFillPoly:
+ * @id: the ID of the drawable to draw the polygon onto
+ * @gc: the ID of the graphics context to use when drawing the polygon
+ * @count: the number of points in the point array
+ * @pointtable: pointer to an array of points describing the polygon
+ *
+ * Draws a filled polygon on the specified drawable using the specified
+ * graphics context. The polygon is specified by an array of point structures.
+ * The polygon is automatically closed- the last point need not be the same as
+ * the first in order for the polygon to be closed.
+ */
+void 
+GrFillPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count,GR_POINT *pointtable)
+{
+	nxFillPolyReq *req;
+	long           size;
+
+	size = (long)count * sizeof(GR_POINT);
+	req = AllocReqExtra(FillPoly, size);
+	req->drawid = id;
+	req->gcid = gc;
+	memcpy(GetReqData(req), pointtable, size);
+}
+
+/**
+ * GrText:
+ * @id: the ID of the drawable to draw the text string onto
+ * @gc: the ID of the graphics context to use when drawing the text string
+ * @x: the X coordinate to draw the string at relative to the drawable
+ * @y: the Y coordinate to draw the string at relative to the drawable
+ * @str: the text string to draw
+ * @count: the number of characters (not bytes) in the string
+ * @flags: flags specifying text encoding, alignment, etc.
+ *
+ * Draws the specified text string at the specified position on the specified
+ * drawable using the specified graphics context and flags. The default flags
+ * specify ASCII encoding and baseline alignment.
+ */
+void 
+GrText(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, void *str,
+	GR_COUNT count, int flags)
+{
+	nxTextReq *req;
+	int	   size;
+
+	if(count == -1 && (flags&MWTF_PACKMASK) == MWTF_ASCII)
+		count = strlen((char *)str);
+
+	size = nxCalcStringBytes(str, count, flags);
+
+	req = AllocReqExtra(Text, size);
+	req->drawid = id;
+	req->gcid = gc;
+	req->x = x;
+	req->y = y;
+	req->count = count;
+	req->flags = flags;
+	memcpy(GetReqData(req), str, size);
+}
+
+
+/**
+ * GrGetSystemPalette:
+ * @pal: pointer to a palette structure to fill in with the system palette
+ *
+ * Retrieves the system palette and places it in the specified palette
+ * structure.
+ */
+void
+GrGetSystemPalette(GR_PALETTE *pal)
+{
+	AllocReq(GetSystemPalette);
+	GrTypedReadBlock(pal, sizeof(*pal), GrNumGetSystemPalette);
+}
+
+/**
+ * GrSetSystemPalette:
+ * @first: the first palette value to set
+ * @pal: pointer to a palette structure containing the new values
+ *
+ * Sets the system palette to the values stored in the specified palette
+ * structure. The values before the specified first value are not set.
+ */
+void
+GrSetSystemPalette(GR_COUNT first, GR_PALETTE *pal)
+{
+	nxSetSystemPaletteReq *req;
+
+	req = AllocReq(SetSystemPalette);
+	req->first = first;
+	req->count = pal->count;
+	memcpy(req->palette, pal->palette, sizeof(GR_PALENTRY) * pal->count);
+}
+
+/**
+ * GrFindColor:
+ * @c: the colour value to find
+ * @retpixel: pointer to the returned pixel value
+ *
+ * Calculates the pixel value to use to display the specified colour value.
+ * The colour value is specified as a GR_COLOR, which is a 32 bit truecolour
+ * value stored as RGBX. The pixel value size depends on the architecture.
+ */
+void
+GrFindColor(GR_COLOR c, GR_PIXELVAL *retpixel)
+{
+	nxFindColorReq *req;
+
+	req = AllocReq(FindColor);
+	req->color = c;
+	GrTypedReadBlock(retpixel, sizeof(*retpixel), GrNumFindColor);
+}
+
+/**
+ * GrReqShmCmds:
+ * @shmsize: the size of the shared memory area to allocate
+ *
+ * Requests a shared memory area of the specified size to use for transferring
+ * command arguments. This is faster but less portable than the standard BSD
+ * sockets method of communication (and of course will only work if the client
+ * and server are on the same machine). Apart from the initial allocation of
+ * the area using this call, the use of shared memory is completely
+ * transparent. Additionally, if the allocation fails we silently and
+ * automatically fall back on socket communication. It is safe to call this
+ * function even if shared memory support is not compiled in; it will simply
+ * do nothing.
+ *
+ * FIXME: how does the user decide what size of shared memory area to allocate?
+ */
+void
+GrReqShmCmds(long shmsize)
+{
+#if HAVE_SHAREDMEM_SUPPORT
+	nxReqShmCmdsReq	req;
+	int key, shmid;
+
+	if ( nxSharedMem != 0 )
+		return;
+
+	GrFlush();
+
+	shmsize = (shmsize+SHM_BLOCK_SIZE-1) & ~(SHM_BLOCK_SIZE-1);
+
+	req.reqType = GrNumReqShmCmds;
+	req.hilength = 0;
+	req.length = sizeof(req);
+	req.size = shmsize;
+
+	nxWriteSocket((char *)&req,sizeof(req));
+	GrReadBlock(&key,sizeof(key));
+
+	if ( !key ) {
+		EPRINTF("nxclient: no shared memory support on server\n");
+		return;
+	}
+
+	shmid = shmget(key,shmsize,0);
+	if ( shmid == -1 ) {
+		EPRINTF("nxclient: Can't shmget key %d: %m\n", key);
+		return;
+	}
+
+	nxSharedMem = shmat(shmid,0,0);
+	shmctl(shmid,IPC_RMID,0);	/* Prevent other from attaching */
+	if ( nxSharedMem == (char *)-1 )
+		return;
+
+	nxSharedMemSize = shmsize;
+	nxAssignReqbuffer(nxSharedMem, shmsize);
+#endif /* HAVE_SHAREDMEM_SUPPORT*/
+}
+
+/**
+ * GrInjectPointerEvent:
+ * @x: the X coordinate of the pointer event relevant to the root window
+ * @y: the Y coordinate of the pointer event relevant to the root window
+ * @button: the pointer button status
+ * @visible: whether to display the pointer after the event
+ *
+ * Sets the pointer invisible if the visible parameter is GR_FALSE, or visible
+ * if it is GR_TRUE, then moves the pointer to the specified position and
+ * generates a mouse event with the specified button status. Also performs
+ * a GrFlush() so that the event takes effect immediately.
+ */
+void
+GrInjectPointerEvent(GR_COORD x, GR_COORD y, int button, int visible)
+{
+	nxInjectEventReq *req;
+
+	req = AllocReq(InjectEvent);
+	req->event_type = GR_INJECT_EVENT_POINTER;
+	req->event.pointer.visible = visible;
+	req->event.pointer.x = x;
+	req->event.pointer.y = y;
+	req->event.pointer.button = button;
+
+	GrFlush();
+}
+
+/**
+ * GrInjectKeyboardEvent:
+ * @wid: ID of the window to send the event to, or 0
+ * @uch: 32 bit Unicode keystroke value to inject
+ * @ch: 8 bit ascii keystroke value to inject
+ * @modifier: modifiers (shift, ctrl, alt, etc.) to inject
+ * @special: special keys to inject
+ * @content: mask specifying which arguments are valid
+ *
+ * Sends a keyboard event to the specified window, or to the window with the
+ * current keyboard focus if 0 is used as the ID. The other arguments
+ * correspond directly to the fields of the same names in the keyboard event
+ * structure.
+ */
+void
+GrInjectKeyboardEvent(GR_WINDOW_ID wid, GR_KEY keyvalue,
+	GR_KEYMOD modifier, GR_SCANCODE scancode, GR_BOOL pressed)
+{
+	nxInjectEventReq *req;
+
+	req = AllocReq(InjectEvent);
+	req->event_type = GR_INJECT_EVENT_KEYBOARD;
+	req->event.keyboard.wid = wid;
+	req->event.keyboard.keyvalue = keyvalue;
+	req->event.keyboard.modifier = modifier;
+	req->event.keyboard.scancode = scancode;
+	req->event.keyboard.pressed = pressed;
+
+	GrFlush();
+}
+
+/**
+ * GrSetWMProperties:
+ * @wid: the ID of the window to set the WM properties of
+ * @props: pointer to a GR_WM_PROPERTIES structure
+ *
+ * Copies the provided GR_WM_PROPERTIES structure into the the GR_WM_PROPERTIES
+ * structure of the specified window id.
+ */
+void
+GrSetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props)
+{
+	nxSetWMPropertiesReq *req;
+	char		*addr;
+	int		s;
+
+	if ((props->flags & GR_WM_FLAGS_TITLE) && props->title)
+		s = strlen(props->title) + 1;
+	else s = 0;
+
+	req = AllocReqExtra(SetWMProperties, s + sizeof(GR_WM_PROPERTIES));
+	req->windowid = wid;
+	addr = GetReqData(req);
+	memcpy(addr, props, sizeof(GR_WM_PROPERTIES));
+	if (s)
+		memcpy(addr + sizeof(GR_WM_PROPERTIES), props->title, s);
+}
+
+/**
+ * GrGetWMProperties:
+ * @wid: the ID of the window to retreive the WM properties of
+ * @props: pointer to a GR_WM_PROPERTIES structure to fill in
+ *
+ * Reads the GR_WM_PROPERTIES structure for the window with the specified
+ * id and fills in the provided structure with the information.
+ * It is the callers responsibility to free the title member as it is allocated
+ * dynamically. The title field will be set to NULL if the window has no title.
+ */
+void
+GrGetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props)
+{
+	nxGetWMPropertiesReq *req;
+	UINT16 textlen;
+	GR_CHAR c;
+
+	req = AllocReq(GetWMProperties);
+	req->windowid = wid;
+
+	GrTypedReadBlock(props, sizeof(GR_WM_PROPERTIES), GrNumGetWMProperties);
+	GrReadBlock(&textlen, sizeof(textlen));
+	if(!textlen) {
+		props->title = NULL;
+		return;
+	}
+	if(!(props->title = malloc(textlen))) {
+		/* Oh dear, we're out of memory but still have to purge the
+		   requested data (and throw it away) */
+		while(textlen--) GrReadBlock(&c, 1);
+	} else {
+		GrReadBlock(props->title, textlen);
+	}
+}
+
+/**
+ * GrCloseWindow:
+ * @wid: the ID of the window to send the CLOSE_REQ event to
+ *
+ * Sends a CLOSE_REQ event to the specified window if the client has selected
+ * to receive CLOSE_REQ events on this window. Used to request an application
+ * to shut down but not force it to do so immediately, so the application can
+ * ask whether to save changed files before shutting down cleanly.
+ */
+void 
+GrCloseWindow(GR_WINDOW_ID wid)
+{
+	nxCloseWindowReq *req;
+
+	req = AllocReq(CloseWindow);
+	req->windowid = wid;
+}
+
+/**
+ * GrKillWindow:
+ * @wid: the ID of the window to kill
+ *
+ * Forcibly disconnects the client which owns this window with the specified
+ * ID number. Used to kill an application which has locked up and is not
+ * responding to CLOSE_REQ events.
+ */
+void 
+GrKillWindow(GR_WINDOW_ID wid)
+{
+	nxKillWindowReq *req;
+
+	req = AllocReq(KillWindow);
+	req->windowid = wid;
+}
+
+/**
+ * GrSetScreenSaverTimeout:
+ * @timeout: the number of seconds of inactivity before screen saver activates
+ *
+ * Sets the number of seconds of inactivity before a screen saver activate
+ * event is sent to the root window ID. A value of 0 activates the
+ * screen saver immediately, and a value of -1 disables the screen saver
+ * function.
+ */
+void 
+GrSetScreenSaverTimeout(GR_TIMEOUT timeout)
+{
+	nxSetScreenSaverTimeoutReq *req;
+
+	req = AllocReq(SetScreenSaverTimeout);
+	req->timeout = timeout;
+}
+
+/**
+ * GrSetSelectionOwner:
+ * @wid: the ID of the window to set the selection owner to
+ * @typelist: list of mime types selection data can be supplied as
+ *
+ * Sets the current selection (otherwise known as the clipboard) ownership
+ * to the specified window. Specifying an owner of 0 disowns the selection.
+ * The typelist argument is a list of mime types (seperated by space
+ * characters) which the window is able to supply the data as. At least one
+ * type must be specified unless you are disowning the selection (typically
+ * text/plain for plain ASCII text or text/uri-list for a filename).
+ *
+ * The window which owns the current selection must be prepared to handle
+ * SELECTION_LOST events (received when another window takes ownership of the
+ * selection) and CLIENT_DATA_REQ events (received when a client wishes to
+ * retreive the selection data).
+ */
+void
+GrSetSelectionOwner(GR_WINDOW_ID wid, GR_CHAR *typelist)
+{
+	nxSetSelectionOwnerReq *req;
+	char *p;
+	int len;
+
+	if(wid) {
+		len = strlen(typelist) + 1;
+		req = AllocReqExtra(SetSelectionOwner, len);
+		p = GetReqData(req);
+		memcpy(p, typelist, len);
+	} else {
+		req = AllocReq(SetSelectionOwner);
+	}
+
+	req->wid = wid;
+}
+
+/**
+ * GrGetSelectionOwner:
+ * @typelist: pointer used to return the list of available mime types 
+ * @Returns: the ID of the window which currently owns the selection, or 0
+ *
+ * Finds the window which currently owns the selection and returns its ID,
+ * or 0 if no window currently owns the selection. A pointer to the list of
+ * mime types the selection owner is capable of supplying is placed in the
+ * pointer specified by the typelist argument. The typelist is null terminated,
+ * and the fields are seperated by space characters. It is the callers
+ * responsibility to free the typelist string, as it is allocated dynamically.
+ * If the allocation fails, it will be set to a NULL pointer, so remember to
+ * check the value of it before using it.
+ */
+GR_WINDOW_ID
+GrGetSelectionOwner(GR_CHAR **typelist)
+{
+	nxGetSelectionOwnerReq *req;
+	UINT16 textlen;
+	GR_CHAR c;
+	GR_WINDOW_ID wid;
+
+	req = AllocReq(GetSelectionOwner);
+	GrTypedReadBlock(&wid, sizeof(wid), GrNumGetSelectionOwner);
+	if(wid) {
+		GrReadBlock(&textlen, sizeof(textlen));
+		if(!(*typelist = malloc(textlen))) {
+			/* Oh dear, we're out of memory but still have to
+			purge the requested data (and throw it away) */
+			while(textlen--) GrReadBlock(&c, 1);
+		} else {
+			GrReadBlock(*typelist, textlen);
+		}
+	}
+
+	return wid;
+}
+
+/**
+ * GrRequestClientData:
+ * @wid: the ID of the window requesting the data
+ * @rid: the ID of the window to request the data from
+ * @serial: the serial number of the request
+ * @mimetype: the number of the desired mime type to request
+ *
+ * Sends a CLIENT_DATA_REQ event to the specified window. Used for requesting
+ * both selection and "drag and drop" data. The mimetype argument specifies
+ * the format of the data you would like to receive, as an index into the list
+ * returned by GrGetSelectionOwner (the first type in the list is index 0).
+ * The server makes no guarantees as to when, or even if, the client will
+ * reply to the request. If the client does reply, the reply will take the
+ * form of one or more CLIENT_DATA events. The request serial number is
+ * typically a unique ID which the client can assign to a request in order for
+ * it to be able to keep track of transfers (CLIENT_DATA events contain the
+ * same number in the sid field). Remember to free the data field of the
+ * CLIENT_DATA events as they are dynamically allocated. Also note that if
+ * the allocation fails the data field will be set to NULL, so you should
+ * check the value before using it.
+ */
+void
+GrRequestClientData(GR_WINDOW_ID wid, GR_WINDOW_ID rid, GR_SERIALNO serial,
+							GR_MIMETYPE mimetype)
+{
+	nxRequestClientDataReq *req;
+
+	req = AllocReq(RequestClientData);
+	req->wid = wid;
+	req->rid = rid;
+	req->serial = serial;
+	req->mimetype = mimetype;
+}
+
+/**
+ * GrSendClientData:
+ * @wid: the ID of the window sending the data
+ * @did: the ID of the destination window
+ * @sid: the serial number of the request
+ * @len: the number of bytes of data to transfer
+ * @thislen: the number of bytes in this packet
+ * @data: pointer to the data to transfer
+ *
+ * Used as the response to a CLIENT_DATA_REQ event. Sends the specified data
+ * of the specified length to the specified window using the specified source
+ * window ID and transfer serial number. Any fragmentation of the data into
+ * multiple CLIENT_DATA events which is required is handled automatically.
+ * The serial number should always be set to the value supplied by the
+ * CLIENT_DATA_REQ event. The thislen parameter is used internally to split
+ * the data up into packets. It should be set to the same value as the len
+ * parameter.
+ * 
+ */
+void
+GrSendClientData(GR_WINDOW_ID wid, GR_WINDOW_ID did, GR_SERIALNO serial,
+			GR_LENGTH len, GR_LENGTH thislen, void *data)
+{
+	nxSendClientDataReq *req;
+	char *p;
+	GR_LENGTH l, pos = 0;
+
+	while(pos < len) {
+		l = MAXREQUESTSZ - sizeof(nxSendClientDataReq);
+		if(l > (len - pos)) l = len - pos;
+		req = AllocReqExtra(SendClientData, l);
+		req->wid = wid;
+		req->did = did;
+		req->serial = serial;
+		req->len = len;
+		p = GetReqData(req);
+		memcpy(p, data + pos, l);
+		pos += l;
+	}
+}
+
+/**
+ * GrBell:
+ *
+ * Asks the server to ring the console bell on behalf of the client (intended
+ * for terminal apps to be able to ring the bell on the server even if they
+ * are running remotely).
+ */
+void
+GrBell(void)
+{
+	AllocReq(Bell);
+}
+
+/**
+ * GrSetBackgroundPixmap:
+ * @wid: ID of the window to set the background of
+ * @pixmap: ID of the pixmap to use as the background
+ * @flags: flags specifying how to draw the pixmap onto the window
+ *
+ * Sets the background of the specified window to the specified pixmap.
+ * The flags which specify how to draw the pixmap (in the top left of the
+ * window, in the centre of the window, tiled, etc.) are those which start with
+ * GR_BACKGROUND_ in nano-X.h. If the pixmap value is 0, the server will
+ * disable the background pixmap and return to using a solid colour fill.
+ */
+void
+GrSetBackgroundPixmap(GR_WINDOW_ID wid, GR_WINDOW_ID pixmap, int flags)
+{
+	nxSetBackgroundPixmapReq *req;
+
+	req = AllocReq(SetBackgroundPixmap);
+	req->wid = wid;
+	req->pixmap = pixmap;
+	req->flags = flags;
+}
+
+#if YOU_WANT_TO_IMPLEMENT_DRAG_AND_DROP
+/**
+ * GrRegisterDragAndDropWindow:
+ * @wid: the ID of the window to use as the drag and drop source window
+ * @iid: the ID of the pixmap to use as the drag and drop icon
+ * @typelist: list of mime types the drag and drop data can be supplied as
+ *
+ * Enables the specified window to be used as a drag and drop source. The
+ * specified pixmap will be used as the icon shown whilst dragging, and the
+ * null terminated, newline seperated list of mime types which the data can
+ * be supplied as is specified by the typelist argument. At least one type
+ * (typically text/plain for plain ASCII or text/uri-list for a filename or
+ * list of filenames) must be specified. When the icon is dropped,
+ * the window which it is dropped on will receive a DROP event (providing it
+ * has selected for DROP events), and if the client wishes to accept the data
+ * and is able to handle one of the mime types in the type list, it should use
+ * GrRequestClientData() to retrieve the data from the drag and drop source
+ * window. Remember to free the typelist field of the DROP event as it is
+ * dynamically allocated. It is possible for a client to select for DROP events
+ * on the Root window if it is desired to allow dropping icons on the desktop.
+ */
+void
+GrRegisterDragAndDropWindow(GR_WINDOW_ID wid, GR_WINDOW_ID iid,
+				GR_CHAR *typelist)
+{
+}
+#endif
diff -urN lib/microwindows/src/nanox/demo.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/demo.c
--- lib/microwindows/src/nanox/demo.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/demo.c	2005-02-21 16:13:34.000000000 +0100
@@ -0,0 +1,469 @@
+/*
+ * Demonstration program for Nano-X graphics.
+ */
+#include <cyg/kernel/kapi.h>
+#include <cyg/infra/diag.h>
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+#define	W2_WIDTH	70
+#define	W2_HEIGHT	40
+
+
+static	GR_WINDOW_ID	w1;		/* id for large window */
+static	GR_WINDOW_ID	w2;		/* id for small window */
+static	GR_WINDOW_ID	w3;		/* id for third window */
+static	GR_WINDOW_ID	w4;		/* id for grabbable window */
+static	GR_WINDOW_ID	w5;		/* id for testing enter/exit window */
+static	GR_GC_ID	gc1;		/* graphics context for text */
+static	GR_GC_ID	gc2;		/* graphics context for rectangle */
+static	GR_GC_ID	gc3;		/* graphics context for circles */
+static	GR_GC_ID	gc4;		/* graphics context for lines */
+static	GR_COORD	begxpos;	/* beginning x position */
+static	GR_COORD	xpos;		/* x position for text drawing */
+static	GR_COORD	ypos;		/* y position for text drawing */
+static	GR_COORD	linexpos;	/* x position for line drawing */
+static	GR_COORD	lineypos;	/* y position for line drawing */
+static	GR_COORD	xorxpos;	/* x position for xor line */
+static	GR_COORD	xorypos;	/* y position for xor line */
+static	GR_BOOL		lineok;		/* ok to draw line */
+static	GR_SIZE		COLS, ROWS;
+static	GR_SCREEN_INFO	si;		/* information about screen */
+
+void do_buttondown(GR_EVENT_BUTTON	*bp);
+void do_buttonup(GR_EVENT_BUTTON	*bp);
+void do_motion(GR_EVENT_MOUSE		*mp);
+void do_keystroke(GR_EVENT_KEYSTROKE	*kp);
+void do_exposure(GR_EVENT_EXPOSURE	*ep);
+void do_focusin(GR_EVENT_GENERAL	*gp);
+void do_focusout(GR_EVENT_GENERAL	*gp);
+void do_enter(GR_EVENT_GENERAL		*gp);
+void do_exit(GR_EVENT_GENERAL		*gp);
+void do_idle(void);
+/* routine to handle errors */
+void errorcatcher(GR_EVENT *ep);
+
+int
+demo(void)
+{
+	GR_EVENT	event;		/* current event */
+	GR_BITMAP	bitmap1fg[7];	/* bitmaps for first cursor */
+	GR_BITMAP	bitmap1bg[7];
+	GR_BITMAP	bitmap2fg[7];	/* bitmaps for second cursor */
+	GR_BITMAP	bitmap2bg[7];
+
+	if (GrOpen() < 0) {
+		fprintf(stderr, "cannot open graphics\n");
+		exit(1);
+	}
+	while(1)
+		;
+	GrReqShmCmds(655360);
+	
+	GrGetScreenInfo(&si);
+COLS = si.cols - 40;
+ROWS = si.rows - 80;
+
+	/* print error, but don't exit*/
+	GrSetErrorHandler(errorcatcher);
+
+	w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 100, 50, COLS - 120,
+		ROWS - 60, 1, BROWN, WHITE);
+	w2 = GrNewWindow(GR_ROOT_WINDOW_ID, 6, 6, W2_WIDTH, W2_HEIGHT, 2, GREEN,
+		WHITE);
+	w3 = GrNewWindow(GR_ROOT_WINDOW_ID, 250, 30, 80, 100, 1, LTGRAY,
+		GREEN);
+	w4 = GrNewWindow(GR_ROOT_WINDOW_ID, 350, 20, 200, 150, 5, BLACK, WHITE);
+	w5 = GrNewWindow(GR_ROOT_WINDOW_ID, 11, 143, 209, 100, 1, BLUE, GREEN);
+
+	GrSelectEvents(w1, GR_EVENT_MASK_BUTTON_DOWN |
+		GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_EXPOSURE |
+		GR_EVENT_MASK_FOCUS_IN | GR_EVENT_MASK_FOCUS_OUT |
+		GR_EVENT_MASK_CLOSE_REQ);
+	/* must select down and up for w2 to get implicit grab when
+	 * running window manager, otherwise the wm-created parent
+	 * window will get the grab, and we won't get the button up...
+	 */
+	GrSelectEvents(w2, GR_EVENT_MASK_BUTTON_DOWN |
+			GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(w3, GR_EVENT_MASK_BUTTON_DOWN |
+		GR_EVENT_MASK_MOUSE_MOTION | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(w4, GR_EVENT_MASK_BUTTON_DOWN |
+		GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_MOUSE_POSITION |
+		GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(w5, GR_EVENT_MASK_MOUSE_ENTER |
+		GR_EVENT_MASK_MOUSE_EXIT | GR_EVENT_MASK_CLOSE_REQ);
+	GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_BUTTON_DOWN |
+			GR_EVENT_MASK_CLOSE_REQ);
+
+	GrMapWindow(w1);
+	GrMapWindow(w2);
+	GrMapWindow(w3);
+	GrMapWindow(w4);
+	GrMapWindow(w5);
+
+	gc1 = GrNewGC();
+	gc2 = GrNewGC();
+	gc3 = GrNewGC();
+	gc4 = GrNewGC();
+
+	GrSetGCForeground(gc1, RED);
+	GrSetGCBackground(gc1, BROWN);
+	GrSetGCForeground(gc2, MAGENTA);
+	GrSetGCMode(gc4, GR_MODE_XOR);
+
+	bitmap1fg[0] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[1] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[2] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[3] = MASK(X,X,X,X,X,X,X);
+	bitmap1fg[4] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[5] = MASK(_,_,_,X,_,_,_);
+	bitmap1fg[6] = MASK(_,_,_,X,_,_,_);
+
+	bitmap1bg[0] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[1] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[2] = MASK(X,X,X,X,X,X,X);
+	bitmap1bg[3] = MASK(X,X,X,X,X,X,X);
+	bitmap1bg[4] = MASK(X,X,X,X,X,X,X);
+	bitmap1bg[5] = MASK(_,_,X,X,X,_,_);
+	bitmap1bg[6] = MASK(_,_,X,X,X,_,_);
+
+	bitmap2fg[0] = MASK(_,_,X,X,X,_,_);
+	bitmap2fg[1] = MASK(_,X,_,_,_,X,_);
+	bitmap2fg[2] = MASK(X,_,_,_,_,_,X);
+	bitmap2fg[3] = MASK(X,_,_,_,_,_,X);
+	bitmap2fg[4] = MASK(_,X,_,_,_,X,_);
+	bitmap2fg[5] = MASK(_,_,X,X,X,_,_);
+
+	bitmap2bg[0] = MASK(_,_,X,X,X,_,_);
+	bitmap2bg[1] = MASK(_,X,X,X,X,X,_);
+	bitmap2bg[2] = MASK(X,X,X,X,X,X,X);
+	bitmap2bg[3] = MASK(X,X,X,X,X,X,X);
+	bitmap2bg[4] = MASK(_,X,X,X,X,X,_);
+	bitmap2bg[5] = MASK(_,_,X,X,X,_,_);
+
+	GrSetCursor(w1, 7, 7, 3, 3, WHITE, BLACK, bitmap1fg, bitmap1bg);
+	GrSetCursor(w2, 7, 7, 3, 3, WHITE, BLACK, bitmap2fg, bitmap2bg);
+
+	while (1) {
+		GrCheckNextEvent(&event);
+
+		switch (event.type) {
+			case GR_EVENT_TYPE_BUTTON_DOWN:
+				do_buttondown(&event.button);
+				break;
+
+			case GR_EVENT_TYPE_BUTTON_UP:
+				do_buttonup(&event.button);
+				break;
+
+			case GR_EVENT_TYPE_MOUSE_POSITION:
+			case GR_EVENT_TYPE_MOUSE_MOTION:
+				do_motion(&event.mouse);
+				break;
+
+			case GR_EVENT_TYPE_KEY_DOWN:
+				do_keystroke(&event.keystroke);
+				break;
+
+			case GR_EVENT_TYPE_EXPOSURE:
+				do_exposure(&event.exposure);
+				break;
+
+			case GR_EVENT_TYPE_FOCUS_IN:
+				do_focusin(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_FOCUS_OUT:
+				do_focusout(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_MOUSE_ENTER:
+				do_enter(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_MOUSE_EXIT:
+				do_exit(&event.general);
+				break;
+
+			case GR_EVENT_TYPE_CLOSE_REQ:
+				GrClose();
+				exit(0);
+
+			case GR_EVENT_TYPE_NONE:
+				do_idle();
+				break;
+		}
+	}
+}
+
+
+/*
+ * Here when a button is pressed.
+ */
+void
+do_buttondown(GR_EVENT_BUTTON	*bp)
+{
+	GR_PIXELVAL	intable[W2_WIDTH * W2_HEIGHT];
+	GR_PIXELVAL	outtable[W2_WIDTH * W2_HEIGHT * 6];
+	GR_PIXELVAL	*inp;
+	GR_PIXELVAL	*outp;
+	GR_PIXELVAL	*oldinp;
+	GR_COORD	row;
+	GR_COORD	col;
+
+	/*static int xx = 100;
+	static int yy = 50;*/
+
+	if (bp->wid == w3) {
+		GrRaiseWindow(w3);
+		GrReadArea(w2, 0, 0, W2_WIDTH, W2_HEIGHT, intable);
+		inp = intable;
+		outp = outtable;
+		for (row = 0; row < W2_HEIGHT; row++) {
+			oldinp = inp;
+			for (col = 0; col < W2_WIDTH; col++) {
+				*outp++ = *inp;
+				*outp++ = *inp++;
+			}
+			inp = oldinp;
+			for (col = 0; col < W2_WIDTH; col++) {
+				*outp++ = *inp;
+				*outp++ = *inp++;
+			}
+			inp = oldinp;
+			for (col = 0; col < W2_WIDTH; col++) {
+				*outp++ = *inp;
+				*outp++ = *inp++;
+			}
+		}
+		GrArea(w1, gc1, 0, 0, W2_WIDTH * 2, W2_HEIGHT * 3, outtable,
+			MWPF_PIXELVAL);
+		return;
+	}
+
+	if (bp->wid == w4) {
+		GrRaiseWindow(w4);
+		linexpos = bp->x;
+		lineypos = bp->y;
+		xorxpos = bp->x;
+		xorypos = bp->y;
+		GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+		lineok = GR_TRUE;
+		return;
+	}
+
+	if (bp->wid != w1) {
+		/*
+		 * Cause a fatal error for testing if more than one
+		 * button is pressed.
+		 */
+		if ((bp->buttons & -((int) bp->buttons)) != bp->buttons)
+			GrClearWindow(-1, 0);
+		return;
+	}
+
+	GrRaiseWindow(w1);
+	/*GrMoveWindow(w1, ++xx, yy);*/
+
+	if (bp->buttons & GR_BUTTON_L) {
+		GrClearWindow(w1, GR_TRUE);
+		return;
+	}
+
+	begxpos = bp->x;
+	xpos = bp->x;
+	ypos = bp->y;
+}
+
+
+/*
+ * Here when a button is released.
+ */
+void
+do_buttonup(GR_EVENT_BUTTON	*bp)
+{
+	if (bp->wid == w4) {
+		if (lineok) {
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+			GrLine(w4, gc3, bp->x, bp->y, linexpos, lineypos);
+		}
+		lineok = GR_FALSE;
+		return;
+	}
+
+	if (bp->wid == w2) {
+		GrClose();
+		exit(0);
+	}
+}
+
+
+/*
+ * Here when the mouse has a motion event.
+ */
+void
+do_motion(GR_EVENT_MOUSE	*mp)
+{
+	if (mp->wid == w4) {
+		if (lineok) {
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+			xorxpos = mp->x;
+			xorypos = mp->y;
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+		}
+		return;
+	}
+
+	if (mp->wid == w3) {
+		GrPoint(w3, gc3, mp->x, mp->y);
+		return;
+	}
+}
+
+
+/*
+ * Here when a keyboard press occurs.
+ */
+void
+do_keystroke(GR_EVENT_KEYSTROKE	*kp)
+{
+	GR_SIZE		width;		/* width of character */
+	GR_SIZE		height;		/* height of character */
+	GR_SIZE		base;		/* height of baseline */
+
+	if (kp->wid == w4) {
+		if (lineok) {
+			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
+			lineok = GR_FALSE;
+		}
+		return;
+	}
+
+	GrGetGCTextSize(gc1, &kp->ch, 1, GR_TFASCII, &width, &height, &base);
+	if ((kp->ch == '\r') || (kp->ch == '\n')) {
+		xpos = begxpos;
+		ypos += height;
+		return;
+	}
+	if (kp->ch == '\b') {		/* assumes fixed width font!! */
+		if (xpos <= begxpos)
+			return;
+		xpos -= width;
+		GrSetGCForeground(gc3, BROWN);
+		GrFillRect(w1, gc3, xpos, ypos - height + base + 1,
+			width, height);
+		return;
+	}
+	GrText(w1, gc1, xpos, ypos + base, &kp->ch, 1, 0);
+	xpos += width;
+}
+
+
+/*
+ * Here when an exposure event occurs.
+ */
+void
+do_exposure(GR_EVENT_EXPOSURE	*ep)
+{
+	GR_POINT	points[3];
+
+	if (ep->wid != w1)
+		return;
+	points[0].x = 311;
+	points[0].y = 119;
+	points[1].x = 350;
+	points[1].y = 270;
+	points[2].x = 247;
+	points[2].y = 147;
+
+	GrFillRect(w1, gc2, 50, 50, 150, 200);
+	GrFillPoly(w1, gc2, 3, points);
+}
+
+
+/*
+ * Here when a focus in event occurs.
+ */
+void
+do_focusin(GR_EVENT_GENERAL	*gp)
+{
+	if (gp->wid != w1)
+		return;
+	GrSetBorderColor(w1, WHITE);
+}
+
+/*
+ * Here when a focus out event occurs.
+ */
+void
+do_focusout(GR_EVENT_GENERAL	*gp)
+{
+	if (gp->wid != w1)
+		return;
+	GrSetBorderColor(w1, GRAY);
+}
+
+
+/*
+ * Here when a enter window event occurs.
+ */
+void
+do_enter(GR_EVENT_GENERAL	*gp)
+{
+	if (gp->wid != w5)
+		return;
+	GrSetBorderColor(w5, WHITE);
+	GrRaiseWindow(w5);
+}
+
+
+/*
+ * Here when a exit window event occurs.
+ */
+void
+do_exit(GR_EVENT_GENERAL	*gp)
+{
+	if (gp->wid != w5)
+		return;
+	GrSetBorderColor(w5, GREEN);
+	GrLowerWindow(w5);
+}
+
+
+/*
+ * Here to do an idle task when nothing else is happening.
+ * Just draw a randomly colored filled circle in the small window.
+ */
+void
+do_idle(void)
+{
+	GR_COORD	x;
+	GR_COORD	y;
+	GR_SIZE		rx;
+	GR_SIZE		ry;
+	GR_COLOR	color;
+
+	x = rand() % 70;
+	y = rand() % 40;
+	rx = (rand() % 10) + 5;
+	ry = (rx * si.ydpcm) / si.xdpcm;	/* make it appear circular */
+	
+	color = rand() % si.ncolors;
+
+	GrSetGCForeground(gc3, MWPALINDEX(color));
+	GrFillEllipse(w2, gc3, x, y, rx, ry);	
+}
+
+
+/*
+ * Here on a server error.  Print the std message but don't exit.
+ */
+void
+errorcatcher(GR_EVENT *ep)
+{
+	printf("nxclient: Error (%s) ", ep->error.name);
+	printf(nxErrorStrings[ep->error.code], ep->error.id);
+}
diff -urN lib/microwindows/src/nanox/demo2.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/demo2.c
--- lib/microwindows/src/nanox/demo2.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/demo2.c	2005-02-21 16:13:34.000000000 +0100
@@ -0,0 +1,112 @@
+#include <cyg/kernel/kapi.h>
+#include <cyg/infra/diag.h>
+#include <pthread.h>
+#define MWINCLUDECOLORS
+#include <stdio.h>
+#include "nano-X.h"
+
+#include <signal.h>
+
+void *
+NanoXdemo(void * arg)
+{
+	GR_WINDOW_ID 	w, w2;
+	GR_GC_ID	gc;
+	GR_EVENT 	event;
+	GR_WM_PROPERTIES props;
+		unsigned time=0;
+	char buffer[100];
+	diag_printf("NanoX Demo..\n");
+
+	if (GrOpen() < 0) {
+		diag_printf("Can't open graphics\n");
+		pthread_exit((void *)-1);
+	}
+
+	/* pass errors through main loop*/
+	GrSetErrorHandler(NULL);
+
+#define WIDTH	200
+#define HEIGHT	200
+/* Parent is root window, x=20, y=20, width=200, height=200,border size 0, background color=GREEN, border color=blcak*/
+	w = GrNewWindow(GR_ROOT_WINDOW_ID, 20, 20, WIDTH, HEIGHT,
+		0, GREEN, BLACK);
+	//w2 = GrNewWindow(w, 20, 20, 40, 40, 0, WHITE, BLACK);
+	props.flags = GR_WM_FLAGS_PROPS | GR_WM_FLAGS_TITLE;
+	props.props = GR_WM_PROPS_NOBACKGROUND;
+	props.title = "Nano-X Demo2";
+	GrSetWMProperties(w, &props);
+
+	gc = GrNewGC();
+	GrSelectEvents(w, GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_CLOSE_REQ
+		| GR_EVENT_MASK_BUTTON_DOWN
+		| GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_KEY_UP);
+	GrMapWindow(w);
+	GrSetFocus(w);
+	//GrMapWindow(w2);
+	//GrGetFocus();
+	//cyg_thread_delay(100);
+#if 1
+	for (;;) {
+		//GR_EVENT_KEYSTROKE *kev;
+
+		GrGetNextEvent(&event);
+		switch (event.type) {
+		case GR_EVENT_TYPE_EXPOSURE:
+			//diag_printf("Demo 2: Wid %d Exposure\n",event.exposure.wid); 
+#if 1
+			GrSetGCForeground(gc,GrGetSysColor(GR_COLOR_APPWINDOW));
+			GrFillRect(w, gc, event.exposure.x, event.exposure.y,
+				event.exposure.width, event.exposure.height);
+			GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_APPTEXT));
+			GrSetGCUseBackground(gc, GR_FALSE);
+			GrText(w, gc, 10, 30, "Hello World", -1, GR_TFASCII);
+#endif
+			break;
+		case GR_EVENT_TYPE_CLOSE_REQ:
+			diag_printf("Thread demo2 exiting!\n");
+			GrClose();
+			pthread_exit(NULL);
+			break;
+		case GR_EVENT_TYPE_ERROR:
+			diag_printf("\7demo2: Error (%s) ", event.error.name);
+			diag_printf(nxErrorStrings[event.error.code],event.error.id);
+			break;
+#if 1
+		case GR_EVENT_TYPE_BUTTON_DOWN:
+			//diag_printf("demo2:Mouse down\n");
+			sprintf(buffer,"Be touched for %d times.\n", ++time);
+			GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_APPTEXT));
+			GrSetGCBackground(gc,GrGetSysColor(GR_COLOR_APPWINDOW));
+			GrSetGCUseBackground(gc, GR_TRUE);
+			GrText(w, gc, 10, 50, buffer, -1, GR_TFASCII);
+
+//			GrMapWindow(w2);
+			break;
+			/* test server error on bad syscall*/
+			GrMoveWindow(GR_ROOT_WINDOW_ID, 0, 0);
+			{ GR_SCREEN_INFO sinfo; GrGetScreenInfo(&sinfo); }
+			break;
+#endif
+#if 0
+		case GR_EVENT_TYPE_KEY_DOWN:
+			kev = (GR_EVENT_KEYSTROKE *)&event;
+			diag_printf("DOWN %d (%04x) %04x\n",
+				kev->ch, kev->ch, kev->modifiers);
+			break;
+		case GR_EVENT_TYPE_KEY_UP:
+			kev = (GR_EVENT_KEYSTROKE *)&event;
+			diag_printf("UP %d (%04x) %04x\n",
+				kev->ch, kev->ch, kev->modifiers);
+			break;
+#endif
+		default:
+//			diag_printf("Demo 2: Unknown event:%d\n",event.type);
+			break;
+		}
+
+	}
+	GrClose();
+	return 0;
+#endif
+}
diff -urN lib/microwindows/src/nanox/elkspatch.pl /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/elkspatch.pl
--- lib/microwindows/src/nanox/elkspatch.pl	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/elkspatch.pl	2005-02-21 16:03:45.000000000 +0100
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+# elkspatch.pl
+#
+# Perl script to hack AllocReq macros for ELKS bcc compiler
+#
+# This script rewrites the AllocReq macro which uses ANSI C's '##'
+# token pasting operator to an input compatible with the bcc compiler
+#
+# This is only required if desiring to build client/server Nano-X for ELKS
+# To run:
+#	mv client.c client.dist
+#	./elkspatch.pl < client.dist > client.c
+#
+
+while (<>) {
+	if (/^(.*)AllocReq\(([A-Za-z]+)\)(.*)$/) {
+		print("#if ELKS /* KLUDGE */\n");
+		printf("%s((nx%sReq *)nxAllocReq(GrNum%s,(long)sizeof(nx%sReq), 0L))%s /* KLUDGE */\n",
+			$1, $2, $2, $2, $3);
+		print("#else /* KLUDGE */\n");
+		print;
+		print("#endif /* KLUDGE */\n");
+	} elsif (/^(.*)AllocReqExtra\(([A-Za-z]+) *, *(.*)\)(;)$/) {
+		print("#if ELKS /* KLUDGE */\n");
+		printf("%s((nx%sReq *)nxAllocReq(GrNum%s,(long)sizeof(nx%sReq), (long)%s))%s /* KLUDGE */\n",
+			$1, $2, $2, $2, $3, $4);
+		print("#else /* KLUDGE */\n");
+		print;
+		print("#endif /* KLUDGE */\n");
+	} else {
+		print;
+	}
+}
diff -urN lib/microwindows/src/nanox/error.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/error.c
--- lib/microwindows/src/nanox/error.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/error.c	2005-02-21 16:13:31.000000000 +0100
@@ -0,0 +1,24 @@
+/*
+ * Reconfigurable error handler
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#if (UNIX | DOS_DJGPP)
+#include <unistd.h>
+#endif
+#include "device.h"
+
+/* output error message and return -1*/
+int
+GdError(const char *format, ...)
+{
+	va_list args;
+	char 	buf[512];
+
+	va_start(args, format);
+	vsprintf(buf, format, args);
+	va_end(args);
+	write(2, buf, strlen(buf));
+	return -1;
+}
diff -urN lib/microwindows/src/nanox/mqfs.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/mqfs.c
--- lib/microwindows/src/nanox/mqfs.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/mqfs.c	2005-02-21 16:13:34.000000000 +0100
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2001 I-Jui Sung <ijsung@csie.nctu.edu.tw>
+ * Message queue fs (let select() work on posix message queues in eCos
+ */
+
+#include <stdio.h>
+#include <cyg/kernel/kapi.h>
+#include <cyg/infra/diag.h>
+#include <pthread.h>
+#include <sys/malloc.h>
+#include <time.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <fcntl.h> /*for O_xxxx */
+#include <unistd.h>
+#include <assert.h>
+#include "mqproto.h"
+
+////////////////////////////////////////////////////////////
+
+//select
+static int posixmq_fo_select(struct CYG_FILE_TAG *fp, int which, CYG_ADDRWORD info);
+static int posixmq_fo_read(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio);
+static int posixmq_fo_write(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio);
+
+/* r.w mutex */
+static cyg_mutex_t rwlock;
+
+static cyg_fileops mqfs_fileops =
+{
+    posixmq_fo_read,
+    posixmq_fo_write,
+    cyg_fileio_enosys,
+    cyg_fileio_enosys,
+    posixmq_fo_select,
+    cyg_fileio_enosys,
+    cyg_fileio_enosys,
+    cyg_fileio_enosys,
+    cyg_fileio_enosys,
+    cyg_fileio_enosys
+};
+
+static int posixmq_mount( cyg_fstab_entry *fste, cyg_mtab_entry *mte )
+{
+	//mte->root
+	//diag_printf("Mount!!!!!!\n");
+	cyg_mutex_init(&rwlock);
+	return 0;
+}
+static int posixmq_open( cyg_mtab_entry *mte, cyg_dir dir, const char *name, int mode,  cyg_file *file )
+{
+	mqfile * mq;
+	struct mq_attr attr;
+	int mymode=mode&(O_CREAT|O_RDWR);
+#if 0
+	diag_printf("Opening filename=%s!!!!!!\n",name);
+#endif
+	if( (mq=malloc(sizeof(mqfile))) == NULL)
+	{
+		diag_printf("Can't allocate spece for mq\n");
+		return ENOSPC;
+	}
+	if((mq->mqd=mq_open(name, mymode,NULL,NULL))==(mqd_t)-1)
+	{
+		free(mq);
+		diag_printf("posix mq: can't open\n");
+		return EPERM;
+	}
+	/* query its max message size */
+	mq_getattr(mq->mqd,&attr);
+	mq->msgsz=attr.mq_msgsize;
+	/* initilize the mq object's count to 0*/
+	mq->count=0;
+	mq->select_info.si_info=(CYG_ADDRWORD)NULL;
+	mq->select_info.si_thread=(CYG_ADDRWORD)NULL;
+
+	/* initialize file object */
+	cyg_mutex_lock(&rwlock);
+	file->f_flag        |= mode & CYG_FILE_MODE_MASK;
+	file->f_type        = CYG_FILE_TYPE_FILE;
+	file->f_ops         = &mqfs_fileops;
+	file->f_offset      = 0;
+	file->f_data        = (CYG_ADDRWORD)mq;
+	file->f_xops        = 0;
+	cyg_mutex_unlock(&rwlock);
+	return ENOERR;
+}
+/* return nonzero if we have data on that object */
+static int posixmq_fo_select(struct CYG_FILE_TAG *fp, int which, CYG_ADDRWORD info)
+{
+	mqfile * file=(mqfile *)fp->f_data;
+
+	//diag_printf("posix mq: fo_select\n");
+	assert(which==CYG_FREAD);	/* we can only support select on read now */
+
+	cyg_mutex_lock(&rwlock);
+	/* test its # of messages */
+	if(file->count==0)	/*no message?*/
+	{
+		/* record information on this object */
+		cyg_selrecord((CYG_ADDRWORD)NULL, &file->select_info);
+		cyg_mutex_unlock(&rwlock);
+		return 0;
+	}
+	else	/* tell select to FD_SET it*/
+	{
+		cyg_mutex_unlock(&rwlock);
+		return 1;
+	}
+}
+
+/* read serve as almost a wrapper of mq_receive, except that it updates file->count
+ * don't support iovec, so only 1 read is accepted
+ */
+static int posixmq_fo_read(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio)
+{
+	mqfile * mq_file=(mqfile *)fp->f_data;
+	cyg_iovec *iov = &uio->uio_iov[0];
+	char *buf = (char *)iov->iov_base;
+	off_t len = iov->iov_len;
+	ssize_t reallen;
+	//diag_printf("fo_read:before assert\n");
+	/* we can't support iovcnt>1*/
+	assert(uio->uio_iovcnt==1);
+	/*make sure buffer size>=max msg size*/
+	if(mq_file->msgsz > len)
+	{
+		diag_printf("ERRRRRRRRRRRRRRRR: fo_read: buffer less than max msg size.\n");
+		return EINVAL;
+	}
+	/*receive! (we may block here.)	*/
+	reallen=mq_receive(mq_file->mqd, buf, len, NULL);
+	//diag_printf("fo_read:%d bytes read from mq.\n",reallen);
+	if(reallen>=0)
+	{	/* update */
+		cyg_mutex_lock(&rwlock);
+		mq_file->count--;
+		uio->uio_resid-=reallen;
+		cyg_mutex_unlock(&rwlock);
+		return ENOERR;
+	}
+	else
+		return EINVAL;
+}
+/* read serve as almost a wrapper of mq_receive, except that it updates file->count
+ * don't support iovec, so only 1 write is accepted
+ * it also do some wakeup for select
+ */
+
+static int posixmq_fo_write(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio)
+{
+	mqfile * mq_file=(mqfile *)fp->f_data;
+	cyg_iovec *iov = &uio->uio_iov[0];
+	char *buf = (char *)iov->iov_base;
+	off_t len = iov->iov_len;
+	//diag_printf("fo_write:before assert\n");
+
+	/* we can't support iovcnt>1*/
+	assert(uio->uio_iovcnt==1);
+	/*make sure buffer size>=max msg size*/
+	//diag_printf("fo_write:before\n");
+	if(mq_file->msgsz < len)
+	{
+		diag_printf("fo_write: buffer bigger than max msg size.\n");
+		return EINVAL;
+	}
+	/*send!*/
+	if(mq_send(mq_file->mqd, buf, len, (int)NULL)==-1)
+	{
+		diag_printf("fo_write:failed writing!.\n");
+		return EINVAL;
+	}
+	else
+	{	/* update */
+		//diag_printf("fo_write:after(ok)\n");
+		cyg_mutex_lock(&rwlock);
+		mq_file->count++;
+		uio->uio_resid-=len;
+		cyg_mutex_unlock(&rwlock);
+		/* wake for threads pending on select */
+		cyg_selwakeup(&mq_file->select_info);
+		return ENOERR;
+	}
+	
+}
+
+FSTAB_ENTRY( posixmq_fs, "POSIX MQ FS", 0,
+             CYG_SYNCMODE_FILE_FILESYSTEM,	/* we can't lock on file entry..*/
+             posixmq_mount,
+             NULL,
+             posixmq_open,
+             NULL,
+             NULL,
+             NULL,
+             NULL,
+             NULL,
+             NULL,
+             NULL,
+             NULL,
+             NULL,
+             NULL);
+
+MTAB_ENTRY( posixmq_mte,
+                   "/mqueue",
+                   "POSIX MQ FS",
+                   "",
+                   0);
+
diff -urN lib/microwindows/src/nanox/mqproto.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/mqproto.h
--- lib/microwindows/src/nanox/mqproto.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/mqproto.h	2005-02-21 16:13:34.000000000 +0100
@@ -0,0 +1,42 @@
+#ifndef MQ_PROTO_H
+#define MQ_PROTO_H
+/* use message queue to transmit messages */
+#include <mqueue.h>
+#include <semaphore.h>
+#include <cyg/fileio/fileio.h>
+#include <fcntl.h> /*for O_xxxx */
+#define DEFAULT_MSG_PRIO 20
+typedef enum
+{ 
+	MSG_EVENT_MOUSE=1,	/*Mouse events*/
+	MSG_EVENT_KEYBOARD,
+	MSG_CLIENT_CONNECT,	/*A new client want to "connect" to server*/
+	MSG_CLIENT_CONNECT_ESTABLISHED,
+	MSG_CLIENT_CLOSE,
+	MSG_CLIENT_REQBUF,
+	MSG_SERVER_REPLY
+} messagetype;
+#define MAX_NAME 50
+
+typedef struct
+{
+	messagetype type;
+	//mqd_t	reply;	/*reply address*/
+	int	reply;	/*reply fd*/
+	unsigned msgsize;
+	char * msgbuf;	/*store original implementation's reqbuf here*/
+}mqmessage;
+
+#define  NXMQUEUE_NAME "/nanoX"
+
+#define	CLIENTMQNAME "/mqueue/c%X"
+/* File object */
+typedef struct
+{
+	size_t	msgsz;
+	struct  CYG_SELINFO_TAG select_info;
+	mqd_t	mqd;
+	unsigned count;	/* # of objects in mqueue. explicitly modified in write/read */
+}mqfile;
+
+#endif
diff -urN lib/microwindows/src/nanox/nxdraw.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/nxdraw.c
--- lib/microwindows/src/nanox/nxdraw.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/nxdraw.c	2005-02-21 16:13:31.000000000 +0100
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Nano-X Draw Library
+ */
+#define MWINCLUDECOLORS
+#include <stdio.h>
+#include "nano-X.h"
+#include "nxdraw.h"
+
+void
+nxPaintNCArea(GR_DRAW_ID id, int w, int h, GR_CHAR *title, GR_BOOL active,
+	GR_WM_PROPS props)
+{
+	int		x = 0;
+	int		y = 0;
+	GR_GC_ID	gc = GrNewGC();
+	GR_FONT_ID	fontid;
+	GR_RECT		r;
+
+
+	if (props & GR_WM_PROPS_APPFRAME) {
+		/* draw 2-line 3d border around window*/
+		nxDraw3dOutset(id, x, y, w, h);
+		x += 2; y += 2; w -= 4; h -= 4;
+
+		/* draw 1-line inset inside border*/
+		GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_APPWINDOW));
+		GrRect(id, gc, x, y, w, h);
+		x += 1; y += 1; w -= 2; h -= 2;
+	} else if (props & GR_WM_PROPS_BORDER) {
+		/* draw 1-line black border around window*/
+		GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_WINDOWFRAME));
+		GrRect(id, gc, x, y, w, h);
+		x += 1; y += 1; w -= 2; h -= 2;
+	}
+
+	if (!(props & GR_WM_PROPS_CAPTION))
+		goto out;
+
+	/* fill caption*/
+	GrSetGCForeground(gc, 
+		GrGetSysColor(active? GR_COLOR_ACTIVECAPTION:
+			GR_COLOR_INACTIVECAPTION));
+	GrFillRect(id, gc, x, y, w, CYCAPTION);
+
+	/* draw caption text*/
+	if (title) {
+		GrSetGCForeground(gc,
+			GrGetSysColor(active? GR_COLOR_ACTIVECAPTIONTEXT:
+				GR_COLOR_INACTIVECAPTIONTEXT));
+		GrSetGCUseBackground(gc, GR_FALSE);
+		fontid = GrCreateFont(GR_FONT_GUI_VAR, 0, NULL);
+		GrSetGCFont(gc, fontid);
+		GrText(id, gc, x+4, y-1, title, -1, GR_TFASCII|GR_TFTOP);
+		GrDestroyFont(fontid);
+	}
+	y += CYCAPTION;
+
+	/* draw one line under caption*/
+	if (props & GR_WM_PROPS_APPFRAME) {
+		GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_APPWINDOW));
+		GrLine(id, gc, x, y, x+w-1, y);
+	}
+
+	if (props & GR_WM_PROPS_CLOSEBOX) {
+		/* draw close box*/
+		r.x = x + w - CXCLOSEBOX - 2;
+		r.y = y - CYCAPTION + 2;
+		r.width = CXCLOSEBOX;
+		r.height = CYCLOSEBOX;
+
+		nxDraw3dBox(id, r.x, r.y, r.width, r.height,
+			GrGetSysColor(GR_COLOR_BTNHIGHLIGHT),
+			GrGetSysColor(GR_COLOR_WINDOWFRAME));
+		nxInflateRect(&r, -1, -1);
+		GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_APPWINDOW));
+		GrFillRect(id, gc, r.x, r.y, r.width, r.height);
+
+		nxInflateRect(&r, -1, -1);
+		GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_BTNTEXT));
+		GrLine(id, gc, r.x, r.y, r.x+r.width-1, r.y+r.height-1);
+		GrLine(id, gc, r.x, r.y+r.height-1, r.x+r.width-1, r.y);
+	}
+
+#if 0
+	/* fill in client area*/
+	y++;
+	h -= CYCAPTION+1;
+	GrSetGCForeground(gc, GrGetSysColor(GR_COLOR_APPWINDOW));
+	GrFillRect(id, gc, x, y, w, h);
+#endif
+
+out:
+	GrDestroyGC(gc);
+}
+
+/*
+ * Enlarge/decrease the size of a rectangle
+ */
+void
+nxInflateRect(GR_RECT *prc, GR_SIZE dx, GR_SIZE dy)
+{
+	prc->x -= dx;
+	prc->y -= dy;
+	prc->width += dx * 2;
+	prc->height += dy * 2;
+}
+
+/*
+ * nxDraw3dShadow
+ * 	NOINDENT_BLACK	T=white, B=black
+ * 	NOINDENT_GRAY	T=white, B=dkgray
+ * 	INDENT_BLACK	T=black, B=white
+ * 	INDENT_GRAY		T=dkgray, B=white
+ *
+ *	TTTTTTTTTTTTTT
+ *	T             B
+ *	T             B
+ *	 BBBBBBBBBBBBBB
+ */
+void
+nxDraw3dShadow(GR_DRAW_ID id,int x,int y,int w,int h,GR_COLOR crTop,
+	GR_COLOR crBottom)
+{
+	GR_GC_ID	gc = GrNewGC();
+
+	GrSetGCForeground(gc, crTop);
+	/*MoveToEx( hDC, x, y+h-2, NULL);*/
+	/*LineTo( hDC, x, y);*/				/* left side*/
+	GrLine(id, gc, x, y+h-2, x, y);			/* left*/
+	/*LineTo( hDC, x+w-1, y);*/			/* top side*/
+	GrLine(id, gc, x, y, x+w-2, y);			/* top*/
+
+	GrSetGCForeground(gc, crBottom);
+	/*MoveToEx( hDC, x+w-1, y+1, NULL);*/
+	/*LineTo( hDC, x+w-1, y+h-1);*/			/* right side*/
+	GrLine(id, gc, x+w-1, y+1, x+w-1, y+h-2);	/* right*/
+	/*LineTo( hDC, x, y+h-1);*/			/* bottom side*/
+	GrLine(id, gc, x+w-1, y+h-1, x, y+h-1);		/* bottom*/
+
+	GrDestroyGC(gc);
+}
+
+/*
+ * nxDraw3dBox
+ *
+ *	TTTTTTTTTTTTTTB
+ *	T             B
+ *	T             B
+ *	BBBBBBBBBBBBBBB
+ */
+void
+nxDraw3dBox(GR_WINDOW_ID id,int x,int y,int w,int h,GR_COLOR crTop,
+	GR_COLOR crBottom)
+{
+	GR_GC_ID	gc = GrNewGC();
+
+	GrSetGCForeground(gc, crTop);
+	/*MoveToEx( hDC, x, y+h-2, NULL);*/
+	/*LineTo( hDC, x, y);*/				/* left side*/
+	GrLine(id, gc, x, y+h-2, x, y+1);		/* left*/
+	/*MoveToEx( hDC, x, y, NULL);*/
+	/*LineTo( hDC, x+w-1, y);*/			/* top side*/
+	GrLine(id, gc, x, y, x+w-2, y);			/* top*/
+
+	GrSetGCForeground(gc, crBottom);
+	GrLine(id, gc, x+w-1, y, x+w-1, y+h-2);		/* right*/
+	/*MoveToEx( hDC, x+w-1, y, NULL);*/
+	/*LineTo( hDC, x+w-1, y+h-1);*/			/* right side*/
+	GrLine(id, gc, x+w-1, y+h-1, x, y+h-1);		/* bottom*/
+	/*LineTo( hDC, x-1, y+h-1);*/			/* bottom side*/
+
+	GrDestroyGC(gc);
+}
+
+/*
+ * Draw 2 line deep 3d inset
+ */
+void
+nxDraw3dInset(GR_DRAW_ID id,int x,int y,int w,int h)
+{
+	nxDraw3dBox(id, x, y, w, h,
+		GrGetSysColor(GR_COLOR_BTNSHADOW),
+		GrGetSysColor(GR_COLOR_BTNHIGHLIGHT));
+	++x; ++y; w -= 2; h -= 2;
+	nxDraw3dBox(id, x, y, w, h,
+		GrGetSysColor(GR_COLOR_WINDOWFRAME),
+		GrGetSysColor(GR_COLOR_3DLIGHT));
+}
+
+/*
+ * Draw 2 line deep 3d outset
+ */
+void
+nxDraw3dOutset(GR_DRAW_ID id,int x,int y,int w,int h)
+{
+	nxDraw3dBox(id, x, y, w, h,
+		GrGetSysColor(GR_COLOR_3DLIGHT),
+		GrGetSysColor(GR_COLOR_WINDOWFRAME));
+	++x; ++y; w -= 2; h -= 2;
+	nxDraw3dBox(id, x, y, w, h,
+		GrGetSysColor(GR_COLOR_BTNHIGHLIGHT),
+		GrGetSysColor(GR_COLOR_BTNSHADOW));
+}
+
+/*
+ * Draw 1 line pushed down rectangle
+ */
+void
+nxDraw3dPushDown(GR_DRAW_ID id, int x, int y, int w, int h)
+{
+	nxDraw3dBox(id, x, y, w, h, GrGetSysColor(GR_COLOR_BTNSHADOW),
+		GrGetSysColor(GR_COLOR_BTNSHADOW));
+}
+
+/*
+ * Draw either 3d up or down depending on state
+ */
+void
+nxDraw3dUpDownState(GR_DRAW_ID id, int x, int y, int w, int h, GR_BOOL fDown)
+{
+	if (fDown)
+		nxDraw3dPushDown(id, x, y, w, h);
+	else nxDraw3dOutset(id, x, y, w, h);
+}
+
+#if 0
+void
+nxDraw3dUpFrame(GR_DRAW_ID id, int l, int t, int r, int b)
+{
+	RECT	rc;
+	HBRUSH	hbr;
+
+	SetRect(&rc, l, t, r, b);
+	nxDraw3dBox(hDC, rc.left, rc.top,
+		rc.right-rc.left, rc.bottom-rc.top,
+		GrGetSysColor(GR_COLOR_3DLIGHT),
+		GrGetSysColor(GR_COLOR_WINDOWFRAME));
+	nxInflateRect(&rc, -1, -1);
+	nxDraw3dBox(hDC, rc.left, rc.top,
+		rc.right-rc.left, rc.bottom-rc.top,
+		GrGetSysColor(GR_COLOR_BTNHIGHLIGHT),
+		GrGetSysColor(GR_COLOR_BTNSHADOW));
+	nxInflateRect(&rc, -1, -1);
+
+	hbr = CreateSolidBrush(GrGetSysColor(GR_COLOR_APPWINDOW));
+	FillRect(hDC, &rc, hbr);
+	DeleteObject(hbr);
+}
+#endif
diff -urN lib/microwindows/src/nanox/nxproto.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/nxproto.c
--- lib/microwindows/src/nanox/nxproto.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/nxproto.c	2005-02-21 16:13:31.000000000 +0100
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Nano-X Core Protocol Client Request Handling Routines
+ */ 
+#include <stdio.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include "serv.h"
+#include "nxproto.h"
+
+#define SZREQBUF	2048	/* initial request buffer size*/
+
+/* queued request buffer*/
+typedef struct {
+	BYTE8 *	bufptr;		/* next unused buffer location*/
+	BYTE8 *	bufmax;		/* max buffer location*/
+	BYTE8 *	buffer;		/* request buffer*/
+} REQBUF;
+
+static REQBUF	reqbuf;		/* request buffer*/
+
+extern int 	nxSocket;
+extern char *	nxSharedMem;
+
+/* Allocate a request buffer of passed size and fill in header fields*/
+void *
+nxAllocReq(int type, long size, long extra)
+{
+	nxReq *	req;
+	long	aligned_len;
+
+	/* variable size requests must be hand-padded*/
+	if(extra)
+		assert((size & (long)(ALIGNSZ-1)) == 0);
+
+	/* calculate aligned length of request buffer*/
+	aligned_len = (size + extra + (long)(ALIGNSZ-1)) & ~(long)(ALIGNSZ-1);
+
+	/* verify we're not greater than max request size*/
+	assert(aligned_len <= MAXREQUESTSZ);
+
+	/* flush buffer if required, and allocate larger one if required*/
+	if(reqbuf.bufptr + aligned_len >= reqbuf.bufmax)
+		nxFlushReq(aligned_len,1);
+
+	/* fill in request header*/
+	req = (nxReq *)reqbuf.bufptr;
+	req->reqType = (BYTE8)type;
+	req->hilength = (BYTE8)((size + extra) >> 16);
+	req->length = (UINT16)(size + extra);
+	reqbuf.bufptr += aligned_len;
+	return req;
+}
+
+static void nxAllocReqbuffer(long newsize)
+{
+	if(newsize < (long)SZREQBUF)
+		newsize = SZREQBUF;
+	reqbuf.buffer = malloc(newsize);
+	if(!reqbuf.buffer) {
+		EPRINTF("nxFlushReq: Can't allocate initial request buffer\n");
+		exit(1);
+	}
+	reqbuf.bufptr = reqbuf.buffer;
+	reqbuf.bufmax = reqbuf.buffer + newsize;
+}
+
+void
+nxAssignReqbuffer(char *buffer, long size)
+{
+	if ( reqbuf.buffer != 0 )
+		free(reqbuf.buffer);
+	reqbuf.buffer = buffer;
+	reqbuf.bufptr = reqbuf.buffer;
+	reqbuf.bufmax = reqbuf.buffer + size;
+}
+
+/* Write a block of data on the socket to the nano-X server */
+void
+nxWriteSocket(char *buf, int todo)
+{
+	int written;
+	do {
+		written = write(nxSocket, buf, todo);
+		if ( written < 0 ) {
+			if ( errno == EAGAIN || errno == EINTR )
+				continue;
+			EPRINTF("nxFlushReq: write failed: %m\n");
+			exit(1);
+		}
+		buf += written;
+		todo -= written;
+	} while ( todo > 0 );
+}
+
+/* Flush request buffer if required, possibly reallocate buffer size*/
+void
+nxFlushReq(long newsize, int reply_needed)
+{
+	/* handle one-time initialization case*/
+	if(reqbuf.buffer == NULL) {
+		nxAllocReqbuffer(newsize);
+		return;
+	}
+
+	/* flush buffer if required*/
+	if(reqbuf.bufptr > reqbuf.buffer) {
+		char *	buf = reqbuf.buffer;
+		int	todo = reqbuf.bufptr - reqbuf.buffer;
+
+#if HAVE_SHAREDMEM_SUPPORT
+		if ( nxSharedMem != 0 ) {
+			/* There is a shared memory segment used for the
+			 * request buffer.  Make up a flush command and
+			 * send it over the socket, to tell the server to
+			 * process the shared memory segment.
+			 * The 'reply_needed' argument should be non-zero
+			 * when a confirmation is needed that all commands
+			 * are flushed, so new ones can be filled into the
+			 * request buffer.  NOTE:  This is *only* needed
+			 * when explicitely flushing the request buffer, or
+			 * when flushing it to make space for new commands.
+			 * DO NOT REQUEST A REPLY when flushing the request
+			 * buffer because the last command in the buffer
+			 * will send a response:  This response would be
+			 * queued up first and had to be drained before the
+			 * response to the flush command itsel....
+			 * So the GrReadBlock used to read replys to commands
+			 * must not specify a nonzero 'reply_needed'.
+			 * Not requesting a reply in this case is
+			 * safe, since the command executed will wait for
+			 * the reply *it* is waiting for, and thus make
+			 * sure the request buffer is flushed before
+			 * continuing.
+			 *
+			 * We have to make the protocol request by hand,
+			 * as it has to be sent over the socket to wake
+			 * up the Nano-X server.
+			 */
+			char c;
+			nxShmCmdsFlushReq req;
+
+			req.reqType = GrNumShmCmdsFlush;
+			req.hilength = 0;
+			req.length = sizeof(req);
+			req.size = todo;
+			req.reply = reply_needed;
+
+			nxWriteSocket((char *)&req,sizeof(req));
+
+			if ( reply_needed )
+				while ( read(nxSocket, &c, 1) != 1 )
+					;
+
+			reqbuf.bufptr = reqbuf.buffer;
+
+			if ( reqbuf.buffer + newsize > reqbuf.bufmax ) {
+				/* Shared memory too small, critical */
+				EPRINTF("nxFlushReq: shm region too small\n");
+				exit(1);
+			}
+			return;
+		}
+#endif /* HAVE_SHAREDMEM_SUPPORT*/
+
+		/* Standard Socket transfer */
+		nxWriteSocket(buf,todo);
+		reqbuf.bufptr = reqbuf.buffer;
+	}
+
+	/* allocate larger buffer for current request, if needed*/
+	if(reqbuf.bufptr + newsize >= reqbuf.bufmax) {
+		reqbuf.buffer = realloc(reqbuf.buffer, newsize);
+		if(!reqbuf.buffer) {
+		       EPRINTF("nxFlushReq: Can't reallocate request buffer\n");
+			exit(1);
+		}
+		reqbuf.bufptr = reqbuf.buffer;
+		reqbuf.bufmax = reqbuf.buffer + newsize;
+	}
+}
+
+/* calc # bytes required for passed string according to encoding*/
+int
+nxCalcStringBytes(void *str, int count, int flags)
+{
+	int	nbytes;
+
+	/* calc byte length of data*/
+	if(flags & MWTF_UC16)
+		nbytes = count * 2;
+	else if(flags & MWTF_UC32)
+		nbytes = count * 4;
+	else
+		nbytes = count;
+
+	return nbytes;
+}
diff -urN lib/microwindows/src/nanox/nxproto.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/nxproto.h
--- lib/microwindows/src/nanox/nxproto.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/nxproto.h	2005-02-21 16:13:31.000000000 +0100
@@ -0,0 +1,1065 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 2000 Alex Holden <alex@linuxhacker.org>
+ *
+ * Nano-X Core Protocol Header
+ * 
+ * These structures define the Nano-X client/server protocol.
+ * Much of this has been modeled after the X11 implementation.
+ * Note that all NX Protocol requests should have all data quantities
+ * properly aligned. This is assured by hand-coding each NX request
+ * structure.  Unlike Xlib, fixed size request structs don't have to
+ * be a multiple of 4 bytes, since the length field is a byte count
+ * and GetReq() automatically pads all requests to 4-byte boundaries.
+ * Request structs for variable size data, however, must be hand-padded
+ * to 4-byte alignment, as variable data starts after sizeof(structure).
+ * Also, the hilength/length fields store the unaligned byte count, so
+ * that extra code isn't required to de-crypt extra data size or
+ * big packets.
+ */
+
+/*
+ * The following is provided to allow limiting the maximum
+ * request size that will be sent (not received) using this protocol.
+ * The protocol allows for 2^24 byte maximum, but the
+ * server currently allocates the MAXREQUESTSZ in a stack buffer.
+ * Also, the client realloc's the request queue to 
+ * the largest size asked for, and currently never reduces it.
+ *
+ * Routines like GrArea will split packets to be <= MAXREQUESTSZ
+ * automatically.
+ *
+ * NOTE: MAXREQUESTSZ must be an _aligned_ multiple of 4, meaning
+ * that MAXREQUESTSZ = (MAXREQUESTSZ + 3) & ~3.
+ */
+#define MAXREQUESTSZ	10000		/* max request size (65532)*/
+
+typedef unsigned char	BYTE8;		/* 1 byte*/
+typedef unsigned short	UINT16;		/* 2 bytes*/
+typedef short		INT16;		/* 2 bytes*/
+typedef unsigned long	UINT32;		/* 4 bytes*/
+
+#if ELKS
+typedef UINT16		IDTYPE;
+#define ALIGNSZ		2	/* 2 byte packet alignment*/
+#else
+typedef UINT32		IDTYPE;
+#define ALIGNSZ		4	/* 4 byte packet alignment*/
+#endif
+
+/* all requests share this header*/
+typedef struct {
+	BYTE8	reqType;	/* request code*/
+	BYTE8	hilength;	/* upper 24 bits of unaligned length*/
+	UINT16	length;		/* lower 16 bits of unaligned length*/
+} nxReq;
+
+/* Allocate a fixed size request from request buffer*/
+#define AllocReq(name) \
+	((nx##name##Req *)nxAllocReq(GrNum##name,sizeof(nx##name##Req), 0))
+
+/* Allocate a request, but allocate n extra bytes*/
+#define AllocReqExtra(name,n) \
+	((nx##name##Req *)nxAllocReq(GrNum##name,sizeof(nx##name##Req), n))
+
+/* return pointer to variable length data*/
+#define GetReqData(req)		((void *)((char *)req + sizeof(* (req))))
+
+/* FIXME fails when sizeof(int) == 2*/
+/* get request total valid data length, including header*/
+#define GetReqLen(req)		(((req)->hilength << 16) | (req)->length)
+
+/* get request variable data length, not including fixed size structure*/
+#define GetReqVarLen(req)	(GetReqLen(req) - sizeof(* (req)))
+
+/* get request total aligned length*/
+#define GetReqAlignedLen(req)	((GetReqLen(req) + (ALIGNSZ-1)) & ~(ALIGNSZ-1))
+
+void * 	nxAllocReq(int type, long size, long extra);
+void	nxFlushReq(long newsize, int reply_needed);
+void 	nxAssignReqbuffer(char *buffer, long size);
+void 	nxWriteSocket(char *buf, int todo);
+int	nxCalcStringBytes(void *str, int count, int flags);
+
+#if notyet
+/* all replies share this header*/
+typedef struct {
+	BYTE8	repType;	/* reply code*/
+	BYTE8	hilength;	/* upper 24 bits of unaligned length*/
+	UINT16	length;		/* lower 16 bits of unaligned length*/
+} nxReply;
+
+/* reply types if not equal to request type*/
+#define GrNumErrorReply		255
+#define GrNumEventReply		254
+#endif /* notyet*/
+
+#define GrNumOpen               0
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+} nxOpenReq;
+
+#define GrNumClose              1
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+} nxCloseReq;
+
+#define GrNumGetScreenInfo      2
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+} nxGetScreenInfoReq;
+
+#define GrNumNewWindow          3
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	parentid;
+	INT16	x;
+	INT16	y;
+	INT16	width;
+	INT16	height;
+	UINT32	backgroundcolor;
+	UINT32	bordercolor;
+	INT16	bordersize;
+} nxNewWindowReq;
+
+#define GrNumNewInputWindow     4
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	parentid;
+	INT16	x;
+	INT16	y;
+	INT16	width;
+	INT16	height;
+} nxNewInputWindowReq;
+
+#define GrNumDestroyWindow      5
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+} nxDestroyWindowReq;
+
+#define GrNumNewGC              6
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+} nxNewGCReq;
+
+#define GrNumCopyGC		7
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	gcid;
+} nxCopyGCReq;
+
+#define GrNumGetGCInfo          8
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	gcid;
+} nxGetGCInfoReq;
+
+#define GrNumDestroyGC          9
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	gcid;
+} nxDestroyGCReq;
+
+#define GrNumMapWindow          10
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+} nxMapWindowReq;
+
+#define GrNumUnmapWindow        11
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+} nxUnmapWindowReq;
+
+#define GrNumRaiseWindow        12
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+} nxRaiseWindowReq;
+
+#define GrNumLowerWindow        13
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+} nxLowerWindowReq;
+
+#define GrNumMoveWindow         14
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+	INT16	x;
+	INT16	y;
+} nxMoveWindowReq;
+
+#define GrNumResizeWindow       15
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+	INT16	width;
+	INT16	height;
+} nxResizeWindowReq;
+
+#define GrNumGetWindowInfo      16
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+} nxGetWindowInfoReq;
+
+#define GrNumGetFontInfo        17
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	fontid;
+} nxGetFontInfoReq;
+
+#define GrNumSetFocus           18
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+} nxSetFocusReq;
+
+#define GrNumSetBorderColor     19
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+	UINT32	color;
+} nxSetBorderColorReq;
+
+#define GrNumClearWindow        20
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+	UINT16	exposeflag;
+} nxClearWindowReq;
+
+#define GrNumSelectEvents       21
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+	UINT32	eventmask;
+} nxSelectEventsReq;
+
+#define GrNumGetNextEvent       22
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+} nxGetNextEventReq;
+
+#define GrNumCheckNextEvent     23
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+} nxCheckNextEventReq;
+
+#define GrNumPeekEvent          24
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+} nxPeekEventReq;
+
+#define GrNumLine               25
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	INT16	x1;
+	INT16	y1;
+	INT16	x2;
+	INT16	y2;
+} nxLineReq;
+
+#define GrNumPoint              26
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	INT16	x;
+	INT16	y;
+} nxPointReq;
+
+#define GrNumRect               27
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	INT16	x;
+	INT16	y;
+	INT16	width;
+	INT16	height;
+} nxRectReq;
+
+#define GrNumFillRect           28
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	INT16	x;
+	INT16	y;
+	INT16	width;
+	INT16	height;
+} nxFillRectReq;
+
+#define GrNumPoly               29
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	/*INT16 pointtable[];*/
+} nxPolyReq;
+
+#define GrNumFillPoly           30
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	/*INT16 pointtable[];*/
+} nxFillPolyReq;
+
+#define GrNumEllipse            31
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	INT16	x;
+	INT16	y;
+	INT16	rx;
+	INT16	ry;
+} nxEllipseReq;
+
+#define GrNumFillEllipse        32
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	INT16	x;
+	INT16	y;
+	INT16	rx;
+	INT16	ry;
+} nxFillEllipseReq;
+
+#define GrNumSetGCForeground    33
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	gcid;
+	UINT32	color;
+} nxSetGCForegroundReq;
+
+#define GrNumSetGCBackground    34
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	gcid;
+	UINT32	color;
+} nxSetGCBackgroundReq;
+
+#define GrNumSetGCUseBackground 35
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	gcid;
+	UINT16	flag;
+} nxSetGCUseBackgroundReq;
+
+#define GrNumSetGCMode          36
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	gcid;
+	UINT16	mode;
+} nxSetGCModeReq;
+
+#define GrNumSetGCFont          37
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	gcid;
+	IDTYPE	fontid;
+} nxSetGCFontReq;
+
+#define GrNumGetGCTextSize      38
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	gcid;
+	UINT16	flags;
+	UINT16	pad;
+	/*BYTE8	text[];*/
+} nxGetGCTextSizeReq;
+
+#define GrNumReadArea           39
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	INT16	x;
+	INT16	y;
+	INT16	width;
+	INT16	height;
+} nxReadAreaReq;
+
+#define GrNumArea               40
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	INT16	x;
+	INT16	y;
+	INT16	width;
+	INT16	height;
+	INT16	pixtype;
+	INT16	pad;
+	/*UINT32 pixels[];*/
+} nxAreaReq;
+
+#define GrNumBitmap             41
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	INT16	x;
+	INT16	y;
+	INT16	width;
+	INT16	height;
+	/*UINT16 bitmaptable[];*/
+} nxBitmapReq;
+
+#define GrNumText               42
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	INT16	x;
+	INT16	y;
+	INT16	count;
+	INT16	flags;
+	/*BYTE8	text[];*/
+} nxTextReq;
+
+#define GrNumSetCursor          43
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+	INT16	width;
+	INT16	height;
+	INT16	hotx;
+	INT16	hoty;
+	UINT32	fgcolor;
+	UINT32	bgcolor;
+	/*UINT16 fgbitmap[];*/
+	/*UINT16 bgbitmap[];*/
+} nxSetCursorReq;
+
+#define GrNumMoveCursor         44
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	INT16	x;
+	INT16	y;
+} nxMoveCursorReq;
+
+#define GrNumGetSystemPalette      45
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+} nxGetSystemPaletteReq;
+
+#define GrNumFindColor             46
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	UINT32	color;
+} nxFindColorReq;
+
+#define GrNumReparentWindow        47
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+	IDTYPE	parentid;
+	INT16	x;
+	INT16	y;
+} nxReparentWindowReq;
+
+#define GrNumDrawImageFromFile     48
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	INT16	x;
+	INT16	y;
+	INT16	width;
+	INT16	height;
+	IDTYPE	flags;
+	/*char path[];*/
+} nxDrawImageFromFileReq;
+
+#define GrNumLoadImageFromFile     49
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	INT16	flags;
+	INT16	pad;
+} nxLoadImageFromFileReq;
+
+#define GrNumNewPixmap          50
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	INT16	width;
+	INT16	height;
+/* FIXME: Add support for passing shared memory info */
+} nxNewPixmapReq;
+
+#define GrNumCopyArea          51
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	INT16	x;
+	INT16	y;
+	INT16	width;
+	INT16	height;
+	IDTYPE	srcid;
+	INT16	srcx;
+	INT16	srcy;
+	INT16	op;
+} nxCopyAreaReq;
+
+#define GrNumSetFontSize        52
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	fontid;
+	INT16	fontsize;
+} nxSetFontSizeReq;
+
+#define GrNumCreateFont		53
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	INT16	height;
+	INT16	lf_used;
+	MWLOGFONT lf;
+} nxCreateFontReq;
+
+#define GrNumDestroyFont	54
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	fontid;
+} nxDestroyFontReq;
+
+#define GrNumReqShmCmds         55
+typedef struct {
+	BYTE8   reqType;
+	BYTE8   hilength;
+	UINT16  length;
+	UINT32  size;
+} nxReqShmCmdsReq;
+
+#define GrNumShmCmdsFlush       56
+typedef struct {
+	BYTE8   reqType;
+	BYTE8   hilength;
+	UINT16  length;
+	UINT32  size;
+	UINT32  reply;
+} nxShmCmdsFlushReq;
+
+#define GrNumSetFontRotation    57
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	fontid;
+	INT16	tenthdegrees;
+} nxSetFontRotationReq;
+
+#define GrNumSetFontAttr        58
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	fontid;
+	INT16	setflags;
+	INT16	clrflags;
+} nxSetFontAttrReq;
+
+#define GrNumSetSystemPalette   59
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	INT16	first;
+	INT16	count;
+	MWPALENTRY palette[256];
+} nxSetSystemPaletteReq;
+
+#define GrNumInjectEvent	60
+#define GR_INJECT_EVENT_POINTER		0
+#define GR_INJECT_EVENT_KEYBOARD	1
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	union {
+		struct {
+			INT16	x;
+			INT16	y;
+			UINT16	button;
+			BYTE8	visible;
+		} pointer;
+		struct {
+			IDTYPE	wid;
+			UINT16	keyvalue;
+			UINT16	modifier;
+			BYTE8	scancode;
+			BYTE8	pressed;
+		} keyboard;
+	} event;
+	UINT16	event_type;
+} nxInjectEventReq;
+
+#define GrNumNewRegion		61
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+} nxNewRegionReq;
+
+#define GrNumDestroyRegion	62
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	regionid;
+} nxDestroyRegionReq;
+
+#define GrNumUnionRectWithRegion	63
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	regionid;
+	GR_RECT	rect;
+} nxUnionRectWithRegionReq;
+
+#define GrNumUnionRegion	64
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	regionid;
+	IDTYPE	srcregionid1;
+	IDTYPE	srcregionid2;
+} nxUnionRegionReq;
+
+#define GrNumIntersectRegion	65
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	regionid;
+	IDTYPE	srcregionid1;
+	IDTYPE	srcregionid2;
+} nxIntersectRegionReq;
+
+#define GrNumSetGCRegion	66
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	gcid;
+	IDTYPE	regionid;
+} nxSetGCRegionReq;
+
+#define GrNumSubtractRegion	67
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	regionid;
+	IDTYPE	srcregionid1;
+	IDTYPE	srcregionid2;
+} nxSubtractRegionReq;
+
+#define GrNumXorRegion		68
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	regionid;
+	IDTYPE	srcregionid1;
+	IDTYPE	srcregionid2;
+} nxXorRegionReq;
+
+#define GrNumPointInRegion	69
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	regionid;
+	INT16	x;
+	INT16	y;
+} nxPointInRegionReq;
+
+#define GrNumRectInRegion	70
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	regionid;
+	INT16	x;
+	INT16	y;
+	INT16	w;
+	INT16	h;
+} nxRectInRegionReq;
+
+#define GrNumEmptyRegion	71
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	regionid;
+} nxEmptyRegionReq;
+
+#define GrNumEqualRegion	72
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	region1;
+	IDTYPE	region2;
+} nxEqualRegionReq;
+
+#define GrNumOffsetRegion	73
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	region;
+	INT16	dx;
+	INT16	dy;
+} nxOffsetRegionReq;
+
+#define GrNumGetRegionBox	74
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	regionid;
+} nxGetRegionBoxReq;
+
+#define GrNumNewPolygonRegion	75
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	UINT16	mode;
+	UINT16	pad;
+	/*INT16 points[];*/
+} nxNewPolygonRegionReq;
+
+#define GrNumArc		76
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	INT16	x;
+	INT16	y;
+	INT16	rx;
+	INT16	ry;
+	INT16	ax;
+	INT16	ay;
+	INT16	bx;
+	INT16	by;
+	INT16	type;
+} nxArcReq;
+
+#define GrNumArcAngle		77
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	INT16	x;
+	INT16	y;
+	INT16	rx;
+	INT16	ry;
+	INT16	angle1;
+	INT16	angle2;
+	INT16	type;
+} nxArcAngleReq;
+
+#define GrNumSetWMProperties	78
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+	/* GR_WM_PROPERTIES props */
+	/* GR_CHAR *title */
+} nxSetWMPropertiesReq;
+
+#define GrNumGetWMProperties	79
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+} nxGetWMPropertiesReq;
+
+#define GrNumCloseWindow	80
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+} nxCloseWindowReq;
+
+#define GrNumKillWindow		81
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	windowid;
+} nxKillWindowReq;
+
+#define GrNumDrawImageToFit     82
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	INT16	x;
+	INT16	y;
+	INT16	width;
+	INT16	height;
+	IDTYPE	imageid;
+} nxDrawImageToFitReq;
+
+#define GrNumFreeImage          83
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	id;
+} nxFreeImageReq;
+
+#define GrNumGetImageInfo       84
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	id;
+} nxGetImageInfoReq;
+
+#define GrNumDrawImageBits      85
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	INT16	x;
+	INT16	y;
+	INT16	width;		/* MWIMAGEHDR start*/
+	INT16	height;
+	INT16	planes;
+	INT16	bpp;
+	INT16	pitch;
+	INT16	bytesperpixel;
+	INT16	compression;
+	INT16	palsize;
+	UINT32	transcolor;
+	/*MWIMAGEBITS imagebits[];*/
+	/*MWPALENTRY palette[palsize];*/
+} nxDrawImageBitsReq;
+
+#define GrNumPoints             86
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	drawid;
+	IDTYPE	gcid;
+	/*INT16 pointtable[];*/
+} nxPointsReq;
+
+#define GrNumGetFocus           87
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+} nxGetFocusReq;
+
+#define GrNumGetSysColor        88
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	UINT16	index;
+} nxGetSysColorReq;
+
+#define GrNumSetScreenSaverTimeout	89
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	UINT32	timeout;
+} nxSetScreenSaverTimeoutReq;
+
+#define GrNumSetSelectionOwner	90
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	wid;
+	/* GR_CHAR *typelist */
+} nxSetSelectionOwnerReq;
+
+#define GrNumGetSelectionOwner	91
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+} nxGetSelectionOwnerReq;
+
+#define GrNumRequestClientData	92
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	wid;
+	IDTYPE	rid;
+	UINT32	serial;
+	UINT16	mimetype;
+} nxRequestClientDataReq;
+
+#define GrNumSendClientData	93
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	wid;
+	IDTYPE	did;
+	UINT32	serial;
+	UINT32	len;
+	/* void *data */
+} nxSendClientDataReq;
+
+#define GrNumBell		94
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+} nxBellReq;
+
+#define GrNumSetBackgroundPixmap 95
+typedef struct {
+	BYTE8	reqType;
+	BYTE8	hilength;
+	UINT16	length;
+	IDTYPE	wid;
+	IDTYPE	pixmap;
+	UINT32	flags;
+} nxSetBackgroundPixmapReq;
+
+#define GrTotalNumCalls         96
diff -urN lib/microwindows/src/nanox/nxproto_ecos.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/nxproto_ecos.c
--- lib/microwindows/src/nanox/nxproto_ecos.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/nxproto_ecos.c	2005-02-21 16:13:35.000000000 +0100
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ *
+ * Copyright (c) 2001 I-Jui Sung <ijsung@csie.nctu.edu.tw>
+ * I-Jui Sung: port to eCos using message queues
+ * Nano-X Core Protocol Client Request Handling Routines
+ */ 
+#include <cyg/kernel/kapi.h>
+#include <cyg/infra/diag.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/malloc.h>
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include "serv.h"
+#include "nxproto.h"
+#include "ptd.h"
+
+#define SZREQBUF	2048	/* initial request buffer size*/
+
+extern char *	nxSharedMem;
+
+/* Allocate a request buffer of passed size and fill in header fields*/
+void *
+nxAllocReq(int type, long size, long extra)
+{
+	nxReq *	req;
+	long	aligned_len;
+	GET_PER_THREAD_DATA;
+	/* variable size requests must be hand-padded*/
+	if(extra)
+		assert((size & (long)(ALIGNSZ-1)) == 0);
+
+	/* calculate aligned length of request buffer*/
+	aligned_len = (size + extra + (long)(ALIGNSZ-1)) & ~(long)(ALIGNSZ-1);
+
+	/* verify we're not greater than max request size*/
+	assert(aligned_len <= MAXREQUESTSZ);
+
+	/* flush buffer if required, and allocate larger one if required*/
+	/* will automatically allocate a buffer when ptdp->reqbuf.bufptr==NULL */
+	if(ptdp->reqbuf.bufptr + aligned_len >= ptdp->reqbuf.bufmax)
+		nxFlushReq(aligned_len,1);
+
+	/* fill in request header*/
+	req = (nxReq *)ptdp->reqbuf.bufptr;
+	req->reqType = (BYTE8)type;
+	req->hilength = (BYTE8)((size + extra) >> 16);
+	req->length = (UINT16)(size + extra);
+	ptdp->reqbuf.bufptr += aligned_len;
+	return req;
+}
+
+static void nxAllocReqbuffer(long newsize)
+{
+	GET_PER_THREAD_DATA;
+	if(newsize < (long)SZREQBUF)
+		newsize = SZREQBUF;
+	ptdp->reqbuf.buffer = malloc(newsize);
+	if(!ptdp->reqbuf.buffer) {
+		EPRINTF("nxFlushReq: Can't allocate initial request buffer\n");
+		pthread_exit(NULL);
+	}
+	ptdp->reqbuf.bufptr = ptdp->reqbuf.buffer;
+	ptdp->reqbuf.bufmax = ptdp->reqbuf.buffer + newsize;
+}
+
+void
+nxAssignReqbuffer(char *buffer, long size)
+{
+	GET_PER_THREAD_DATA;
+	if ( ptdp->reqbuf.buffer != NULL)
+		free(ptdp->reqbuf.buffer);
+	ptdp->reqbuf.buffer = buffer;
+	ptdp->reqbuf.bufptr = ptdp->reqbuf.buffer;
+	ptdp->reqbuf.bufmax = ptdp->reqbuf.buffer + size;
+}
+
+/* Write a block of data on the socket to the nano-X server */
+void
+nxWriteSocket(char *buf, int todo)
+{
+	char * copied;
+
+	mqmessage msg;
+	GET_PER_THREAD_DATA;
+	if((copied=malloc(todo))==NULL)
+	{
+		diag_printf("Can't allocate nxWriteSocket buffer, Exiting.\n");
+		pthread_exit(NULL);
+	}
+	/* duplicate buffer */
+	memcpy(copied, buf,todo);
+
+	msg.type=MSG_CLIENT_REQBUF;	
+	msg.reply=ptdp->clientfd;
+	msg.msgbuf=copied;	/* it's receiver's responsbility to free this */
+	msg.msgsize=todo;
+	if(mq_send(ptdp->ServerMQD, (const char *)&msg, sizeof(mqmessage),DEFAULT_MSG_PRIO)==-1)
+	{
+		EPRINTF("nxFlushReq: write failed: %m\n");
+		pthread_exit(NULL);
+	}
+}
+
+/* Flush request buffer if required, possibly reallocate buffer size*/
+void
+nxFlushReq(long newsize, int reply_needed)
+{
+	GET_PER_THREAD_DATA;
+	/* handle one-time initialization case*/
+	if(ptdp->reqbuf.buffer == NULL) {
+		nxAllocReqbuffer(newsize);
+		return;
+	}
+
+	/* flush buffer if required*/
+	if(ptdp->reqbuf.bufptr > ptdp->reqbuf.buffer) {
+		char *	buf =  ptdp->reqbuf.buffer;
+		int	todo = ptdp->reqbuf.bufptr - ptdp->reqbuf.buffer;
+#if HAVE_SHAREDMEM_SUPPORT
+		if ( nxSharedMem != 0 ) {
+			/* There is a shared memory segment used for the
+			 * request buffer.  Make up a flush command and
+			 * send it over the socket, to tell the server to
+			 * process the shared memory segment.
+			 * The 'reply_needed' argument should be non-zero
+			 * when a confirmation is needed that all commands
+			 * are flushed, so new ones can be filled into the
+			 * request buffer.  NOTE:  This is *only* needed
+			 * when explicitely flushing the request buffer, or
+			 * when flushing it to make space for new commands.
+			 * DO NOT REQUEST A REPLY when flushing the request
+			 * buffer because the last command in the buffer
+			 * will send a response:  This response would be
+			 * queued up first and had to be drained before the
+			 * response to the flush command itsel....
+			 * So the GrReadBlock used to read replys to commands
+			 * must not specify a nonzero 'reply_needed'.
+			 * Not requesting a reply in this case is
+			 * safe, since the command executed will wait for
+			 * the reply *it* is waiting for, and thus make
+			 * sure the request buffer is flushed before
+			 * continuing.
+			 *
+			 * We have to make the protocol request by hand,
+			 * as it has to be sent over the socket to wake
+			 * up the Nano-X server.
+			 */
+			char c;
+			nxShmCmdsFlushReq req;
+
+			req.reqType = GrNumShmCmdsFlush;
+			req.hilength = 0;
+			req.length = sizeof(req);
+			req.size = todo;
+			req.reply = reply_needed;
+
+			nxWriteSocket((char *)&req,sizeof(req));
+
+			if ( reply_needed )
+				while ( read(nxSocket, &c, 1) != 1 )
+					;
+
+			reqbuf.bufptr = reqbuf.buffer;
+
+			if ( reqbuf.buffer + newsize > reqbuf.bufmax ) {
+				/* Shared memory too small, critical */
+				EPRINTF("nxFlushReq: shm region too small\n");
+				exit(1);
+			}
+			return;
+		}
+#endif /* HAVE_SHAREDMEM_SUPPORT*/
+		/* Standard Socket transfer */
+		nxWriteSocket(buf,todo);
+		ptdp->reqbuf.bufptr = ptdp->reqbuf.buffer;
+	}
+
+	/* allocate larger buffer for current request, if needed*/
+	if(ptdp->reqbuf.bufptr + newsize >= ptdp->reqbuf.bufmax) {
+		ptdp->reqbuf.buffer = realloc(ptdp->reqbuf.buffer, newsize);
+		if(!ptdp->reqbuf.buffer) {
+			EPRINTF("nxFlushReq: Can't reallocate request buffer\n");
+			pthread_exit(NULL);
+		}
+		ptdp->reqbuf.bufptr = ptdp->reqbuf.buffer;
+		ptdp->reqbuf.bufmax = ptdp->reqbuf.buffer + newsize;
+	}
+}
+
+/* calc # bytes required for passed string according to encoding*/
+int
+nxCalcStringBytes(void *str, int count, int flags)
+{
+	int	nbytes;
+
+	/* calc byte length of data*/
+	if(flags & MWTF_UC16)
+		nbytes = count * 2;
+	else if(flags & MWTF_UC32)
+		nbytes = count * 4;
+	else
+		nbytes = count;
+
+	return nbytes;
+}
diff -urN lib/microwindows/src/nanox/nxutil.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/nxutil.c
--- lib/microwindows/src/nanox/nxutil.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/nxutil.c	2005-02-21 16:13:32.000000000 +0100
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ *
+ * Nano-X Client utility routines
+ *
+ * These routines are Gr* functionality without requiring new API entry points.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#define MWINCLUDECOLORS
+#include "nano-X.h"
+
+/*
+ * Create new window with passed style, title and location.
+ */
+GR_WINDOW_ID
+GrNewWindowEx(GR_WM_PROPS props, GR_CHAR *title, GR_WINDOW_ID parent,
+	GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height,
+	GR_COLOR background)
+{
+	GR_WINDOW_ID		wid;
+	GR_WM_PROPERTIES	wmprops;
+
+	/* create window with no borders*/
+	wid = GrNewWindow(parent, x, y, width, height, 0, background, BLACK);
+	if (wid) {
+		/* set properties and title*/
+		wmprops.flags = GR_WM_FLAGS_PROPS | GR_WM_FLAGS_TITLE;
+		wmprops.props = props;
+		wmprops.title = title;
+		GrSetWMProperties(wid, &wmprops);
+	}
+	return wid;
+}
+
+/* draw an array of lines*/
+void
+GrDrawLines(GR_DRAW_ID w, GR_GC_ID gc, GR_POINT *points, GR_COUNT count)
+{
+	GR_POINT	beg, end;
+
+	if (count < 1)
+		return;
+	if (count == 1) {
+		GrPoint(w, gc, points->x, points->y);
+		return;
+	}
+	
+	beg = *points++;
+	while (--count > 0) {
+		end = *points++;
+		GrLine(w, gc, beg.x, beg.y, end.x, end.y);
+		beg = end;
+	}
+}
+
+/* byte-reversing table for reversing X bitmaps*/
+static const unsigned char revbyte[256] = {
+  0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
+  0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+  0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
+  0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+  0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
+  0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+  0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
+  0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+  0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
+  0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+  0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
+  0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+  0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
+  0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+  0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
+  0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
+  0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
+  0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
+  0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
+  0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
+  0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
+  0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
+  0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
+  0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
+  0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
+  0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
+  0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
+  0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
+  0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
+  0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
+  0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
+  0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
+};
+
+/*
+ * Create a new pixmap and initialize from bitmap data and fg/bg colors
+ */
+GR_WINDOW_ID
+GrNewPixmapFromData(GR_SIZE width, GR_SIZE height, GR_COLOR foreground,
+	GR_COLOR background, void * bits, int flags)
+{
+	GR_WINDOW_ID	pid;
+	GR_GC_ID	gc;
+	int		xb;
+	int		brev = flags & GR_BMDATA_BYTEREVERSE;
+	int		bswap = flags & GR_BMDATA_BYTESWAP;
+	unsigned char *	inbuf = bits;
+	unsigned char *	buf;
+
+	pid = GrNewPixmap(width, height, NULL);
+	if (pid) {
+		gc = GrNewGC();
+		GrSetGCForeground(gc, foreground);
+		GrSetGCBackground(gc, background);
+
+		/* 
+		 * bit reverse or byte-swap short words in image
+		 * and pad to 16 bits for GrBitmap()
+		 */
+		xb = (width+7)/8;
+		buf = malloc(((xb+1)&~01) * height);
+		if (buf) {
+			int x, y;
+			unsigned char *p = buf;
+			for(y=0; y<height; ++y) {
+				for(x=0; x<xb; ) {
+				    if (bswap) {
+					/* byte-swap short words*/
+					unsigned char c = *inbuf++;
+					p[1] = brev? revbyte[c]: c;
+					if (x < xb-1) {
+						c = *inbuf++;
+						p[0] = brev? revbyte[c]: c;
+					} else p[0] = 0;
+				    } else {
+					/* no byte swapping*/
+					unsigned char c = *inbuf++;
+					p[1] = brev? revbyte[c]: c;
+					if (x < xb-1) {
+						c = *inbuf++;
+						p[0] = brev? revbyte[c]: c;
+					} else p[0] = 0;
+				    }
+				    x += 2;
+				    p += 2;
+				}
+				/* pad to 16 bits*/
+				if (xb & 1)
+					*p++ = 0;
+			}
+		} else buf = bits;
+		GrBitmap(pid, gc, 0, 0, width, height, (GR_BITMAP *)buf);
+		GrDestroyGC(gc);
+		if (buf != bits)
+			free(buf);
+	}
+	return pid;
+}
diff -urN lib/microwindows/src/nanox/ptd.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/ptd.h
--- lib/microwindows/src/nanox/ptd.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/ptd.h	2005-02-21 16:13:35.000000000 +0100
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2001 I-Jui Sung <ijsung@csie.nctu.edu.tw>
+ * Client Side Per-thread data management
+ */
+#include <pthread.h>
+
+/* queued request buffer*/
+typedef struct {
+        BYTE8 * bufptr;         /* next unused buffer location*/
+        BYTE8 * bufmax;         /* max buffer location*/
+        BYTE8 * buffer;         /* request buffer*/
+} REQBUF;
+
+/*
+ * Client side event queue
+ */
+typedef struct event_list EVENT_LIST;
+struct event_list {
+        EVENT_LIST *    next;
+        GR_EVENT        event;
+};
+
+extern pthread_key_t PerThreadNanoXDataKey;
+/* Per thread data addressed by PerThreadNanoXDataKey*/
+typedef struct {   
+        mqd_t   ServerMQD;      /* write-only permission for server */
+//        mqd_t   ClientMQD;
+        int     clientfd;       /* read-only client-side message q (only used in select)*/
+        size_t  buffersz;       /* Message buffer size */
+        char    * buffer;       /* Message buffer */
+	unsigned resultbuffersz;/* size of information returned from server */
+	char	* resultbuffer;	/* information returned from server */
+	unsigned resultbufferloc;/* current location of information returned from server */
+	REQBUF   reqbuf;         /* request buffer*/
+/*
+ * The following is the user defined function for handling errors.
+ * If this is not set, then the default action is to close the connection
+ * to the server, describe the error, and then exit.  This error function
+ * will only be called when the client asks for events.
+ */
+        GR_FNCALLBACKEVENT ErrorFunc;
+	EVENT_LIST *     evlist;
+	
+} ThreadNanoXData;
+
+#define GET_PER_THREAD_DATA ThreadNanoXData * ptdp=(ThreadNanoXData*)pthread_getspecific(PerThreadNanoXDataKey)
diff -urN lib/microwindows/src/nanox/serv.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/serv.h
--- lib/microwindows/src/nanox/serv.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/serv.h	2005-02-21 16:13:32.000000000 +0100
@@ -0,0 +1,361 @@
+#ifndef	_SERV_H
+#define	_SERV_H
+/*
+ * Copyright (c) 2001 I-Jui Sung <ijsung@csie.nctu.edu.tw>
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 2000 Alex Holden <alex@linuxhacker.org>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Private definitions for the graphics server.
+ * These definitions are not to be used by clients.
+ */
+
+#define HAVE_PREFIX
+
+#include "nano-X.h"
+#include "device.h"
+#include "mqproto.h"
+/*
+ * Drawing types.
+ */
+typedef	int	GR_DRAW_TYPE;
+
+#define	GR_DRAW_TYPE_NONE	0	/* none or error */
+#define	GR_DRAW_TYPE_WINDOW	1	/* windows */
+#define	GR_DRAW_TYPE_PIXMAP	2	/* pixmaps */
+
+#define	GR_MAX_MODE		MWMODE_AND
+/*
+ * List of elements for events.
+ */
+typedef	struct gr_event_list GR_EVENT_LIST;
+struct gr_event_list {
+	GR_EVENT_LIST	*next;		/* next element in list */
+	GR_EVENT	event;		/* event */
+};
+
+/*
+ * Data structure to keep track of state of clients.
+ */
+typedef struct gr_client GR_CLIENT;
+struct gr_client {
+	int		id;		/* client id and socket descriptor */
+	GR_EVENT_LIST	*eventhead;	/* head of event chain (or NULL) */
+	GR_EVENT_LIST	*eventtail;	/* tail of event chain (or NULL) */
+	GR_CLIENT	*next;		/* the next client in the list */
+	GR_CLIENT	*prev;		/* the previous client in the list */
+	int		waiting_for_event; /* used to implement GrGetNextEvent*/
+	char		*shm_cmds;
+	int		shm_cmds_size;
+	int		shm_cmds_shmid;
+};
+
+/*
+ * Structure to remember clients associated with events.
+ */
+typedef	struct gr_event_client	GR_EVENT_CLIENT;
+struct gr_event_client	{
+	GR_EVENT_CLIENT	*next;		/* next interested client or NULL */
+	GR_EVENT_MASK	eventmask;	/* events client wants to see */
+	GR_CLIENT	*client;	/* client who is interested */
+};
+
+/*
+ * Structure to remember graphics contexts.
+ */
+typedef	struct gr_gc	GR_GC;
+struct gr_gc {
+	GR_GC_ID	id;		/* graphics context id */
+	int		mode;		/* drawing mode */
+	GR_REGION_ID	regionid;	/* current clipping region */
+	GR_FONT_ID	fontid;		/* current font id*/
+	GR_COLOR	foreground;	/* foreground color */
+	GR_COLOR	background;	/* background color */
+	GR_BOOL		usebackground;	/* actually display the background */
+	GR_BOOL		changed;	/* graphics context has been changed */
+	GR_CLIENT 	*owner;		/* client that created it */
+	GR_GC		*next;		/* next graphics context */
+};
+
+/*
+ * Structure to remember regions.
+ */
+typedef struct gr_region	GR_REGION;
+struct gr_region {
+	MWCLIPREGION *	rgn;
+	GR_REGION_ID	id;
+	GR_CLIENT *	owner;		/* client that created it */
+	GR_REGION *	next;
+};
+ 
+/*
+ * Structure to remember fonts.
+ */
+typedef struct gr_font	GR_FONT;
+struct gr_font {
+	PMWFONT		pfont;		/* font*/
+	int		fontsize;	/* font size*/
+	GR_FONT_ID	id;		/* font id*/
+	GR_CLIENT *	owner;		/* client that created it */
+	GR_FONT *	next;		/* next font*/
+};
+
+/*
+ * Structure to remember images.
+ */
+typedef struct gr_image	GR_IMAGE;
+struct gr_image {
+	GR_IMAGE_ID	id;
+	GR_CLIENT *	owner;		/* client that created it */
+	GR_IMAGE *	next;
+};
+ 
+/*
+ * Structure to remember cursor definitions.
+ */
+typedef	struct {
+	int		usecount;	/* use counter */
+	MWCURSOR	cursor;
+} GR_CURSOR;
+
+/*
+ * Structure to remember selection owner and mime types it can produce.
+ */
+typedef struct {
+	GR_WINDOW_ID wid;
+	GR_CHAR *typelist;
+} GR_SELECTIONOWNER;
+
+/*
+ * Drawable structure.  This structure must be the first
+ * elements in a GR_WINDOW or GR_PIXMAP, as GrPrepareWindow
+ * returns a GR_DRAWABLE.  This structure includes
+ * only those items that routines that use GrPrepareWindow
+ * might dereference, and must be included in windows or pixmaps.
+ */
+typedef struct gr_drawable {
+	GR_COORD	x;		/* x position (0)*/
+	GR_COORD	y;		/* y position (0)*/
+	GR_SIZE		width;		/* width */
+	GR_SIZE		height;		/* height */
+        struct _mwscreendevice *psd;    /* associated screen device */
+	GR_WINDOW_ID	id;		/* window/pixmap id */
+} GR_DRAWABLE;
+
+/*
+ * Window structure
+ * Note: first elements must match GR_DRAWABLE
+ */
+typedef struct gr_window GR_WINDOW;
+typedef struct gr_pixmap GR_PIXMAP;
+struct gr_window {
+	GR_COORD	x;		/* absolute x position */
+	GR_COORD	y;		/* absolute y position */
+	GR_SIZE		width;		/* width */
+	GR_SIZE		height;		/* height */
+        struct _mwscreendevice *psd;    /* associated screen device */
+	GR_WINDOW_ID	id;		/* window id */
+	/* end of GR_DRAWABLE common members*/
+
+	GR_WINDOW	*next;		/* next window in complete list */
+	GR_CLIENT	*owner;		/* client that created it */
+	GR_WINDOW	*parent;	/* parent window */
+	GR_WINDOW	*children;	/* first child window */
+	GR_WINDOW	*siblings;	/* next sibling window */
+	GR_SIZE		bordersize;	/* size of border */
+	GR_COLOR	bordercolor;	/* color of border */
+	GR_COLOR	background;	/* background color */
+	GR_PIXMAP	*bgpixmap;	/* background pixmap */
+	int		bgpixmapflags;	/* center, tile etc. */
+	GR_EVENT_MASK	nopropmask;	/* events not to be propagated */
+	GR_EVENT_CLIENT	*eventclients;	/* clients interested in events */
+	GR_CURSOR	*cursor;	/* cursor for this window */
+	GR_BOOL		mapped;		/* TRUE if explicitly mapped */
+	GR_COUNT	unmapcount;	/* count of reasons not really mapped */
+	GR_BOOL		output;		/* TRUE if window can do output */
+	GR_WM_PROPS	props;		/* window properties*/
+	GR_CHAR		*title;		/* window title*/
+};
+
+/*
+ * Pixmap structure
+ * Note: first elements must match GR_DRAWABLE
+ */
+struct gr_pixmap {
+	GR_COORD	x;		/* x position (0)*/
+	GR_COORD	y;		/* y position (0)*/
+	GR_SIZE		width;		/* width */
+	GR_SIZE		height;		/* height */
+        struct _mwscreendevice *psd;    /* associated screen device */
+	GR_WINDOW_ID	id;		/* pixmap id */
+	/* end of GR_DRAWABLE common members*/
+
+	GR_PIXMAP	*next;		/* next pixmap in list */
+	GR_CLIENT	*owner;		/* client that created it */
+};
+
+/*
+ * Macros to obtain the client number from a resource id, and to
+ * produce the first resource id to be used for a client number.
+ * Client numbers must not be zero.  This allows for 255 clients.
+#define	GR_ID_CLIENT(n)	(((GR_ID) (n)) >> 24)
+#define	GR_ID_BASE(n)	(((GR_ID) (n)) << 24)
+ */
+
+/*
+ * Graphics server routines.
+ */
+void		GsClose(int fd);
+void		GsSelect(GR_TIMEOUT timeout);
+void		GsTerminate(void);
+GR_TIMEOUT	GsGetTickCount(void);
+void		GsRedrawScreen(void);
+void		GsError(GR_ERROR code, GR_ID id);
+GR_BOOL		GsCheckMouseEvent(void);
+GR_BOOL		GsCheckKeyboardEvent(void);
+int		GsReadKeyboard(GR_CHAR *buf, int *modifiers);
+int		GsOpenKeyboard(void);
+void		GsGetButtonInfo(int *buttons);
+void		GsGetModifierInfo(int *modifiers);
+void		GsCloseKeyboard(void);
+void		GsExposeArea(GR_WINDOW *wp, GR_COORD rootx, GR_COORD rooty,
+			GR_SIZE width, GR_SIZE height, GR_WINDOW *stopwp);
+void		GsCheckCursor(void);
+void		GsWpSetFocus(GR_WINDOW *wp);
+void		GsWpDrawBackgroundPixmap(GR_WINDOW *wp, GR_PIXMAP *pm,
+						GR_COORD x, GR_COORD y,
+						GR_SIZE width, GR_SIZE height);
+void		GsWpTileBackgroundPixmap(GR_WINDOW *wp, GR_PIXMAP *pm,
+						GR_COORD x, GR_COORD y,
+						GR_SIZE width, GR_SIZE height);
+void		GsWpClearWindow(GR_WINDOW *wp, GR_COORD x, GR_COORD y,
+			GR_SIZE width, GR_SIZE height, GR_BOOL exposeflag);
+void		GsWpUnmapWindow(GR_WINDOW *wp, GR_BOOL temp_unmap);
+void		GsWpMapWindow(GR_WINDOW *wp, GR_BOOL temp);
+void		GsWpDestroyWindow(GR_WINDOW *wp);
+void		GsSetClipWindow(GR_WINDOW *wp, MWCLIPREGION *userregion,
+			int flags);
+void		GsHandleMouseStatus(GR_COORD newx, GR_COORD newy,
+			int newbuttons);
+void		GsFreePositionEvent(GR_CLIENT *client, GR_WINDOW_ID wid,
+			GR_WINDOW_ID subwid);
+void		GsDeliverButtonEvent(GR_EVENT_TYPE type, int buttons,
+			int changebuttons, int modifiers);
+void		GsDeliverMotionEvent(GR_EVENT_TYPE type, int buttons,
+			MWKEYMOD modifiers);
+void		GsDeliverKeyboardEvent(GR_WINDOW_ID wid, GR_EVENT_TYPE type,
+			GR_KEY keyvalue, GR_KEYMOD modifiers,
+			GR_SCANCODE scancode);
+void		GsDeliverExposureEvent(GR_WINDOW *wp, GR_COORD x, GR_COORD y,
+			GR_SIZE width, GR_SIZE height);
+void		GsFreeExposureEvent(GR_CLIENT *client, GR_WINDOW_ID wid,
+			GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height);
+void		GsDeliverUpdateEvent(GR_WINDOW *wp, GR_UPDATE_TYPE utype,
+			GR_COORD x, GR_COORD y, GR_SIZE width, GR_SIZE height);
+void		GsDeliverGeneralEvent(GR_WINDOW *wp, GR_EVENT_TYPE type,
+			GR_WINDOW *other);
+void		GsDeliverScreenSaverEvent(GR_BOOL activate);
+void		GsDeliverClientDataReqEvent(GR_WINDOW_ID wid, GR_WINDOW_ID rid,
+				GR_SERIALNO serial, GR_MIMETYPE mimetype);
+void		GsDeliverClientDataEvent(GR_WINDOW_ID wid, GR_WINDOW_ID rid,
+				GR_SERIALNO serial, GR_LENGTH len,
+				GR_LENGTH thislen, void *data);
+void		GsDeliverSelectionChangedEvent(GR_WINDOW_ID old_owner,
+						GR_WINDOW_ID new_owner);
+void		GsCheckMouseWindow(void);
+void		GsCheckFocusWindow(void);
+GR_DRAW_TYPE	GsPrepareDrawing(GR_DRAW_ID id, GR_GC_ID gcid,
+			GR_DRAWABLE **retdp);
+GR_BOOL		GsCheckOverlap(GR_WINDOW *topwp, GR_WINDOW *botwp);
+GR_EVENT	*GsAllocEvent(GR_CLIENT *client);
+GR_WINDOW	*GsFindWindow(GR_WINDOW_ID id);
+GR_PIXMAP 	*GsFindPixmap(GR_WINDOW_ID id);
+GR_GC		*GsFindGC(GR_GC_ID gcid);
+GR_REGION	*GsFindRegion(GR_REGION_ID regionid);
+GR_FONT 	*GsFindFont(GR_FONT_ID fontid);
+GR_WINDOW	*GsPrepareWindow(GR_WINDOW_ID wid);
+GR_WINDOW	*GsFindVisibleWindow(GR_COORD x, GR_COORD y);
+void		GsDrawBorder(GR_WINDOW *wp);
+int		GsCurrentVt(void);
+void		GsRedrawVt(int t);
+int		GsOpenSocket(void);
+void		GsCloseSocket(void);
+void		GsAcceptClient(void);
+void		GsAcceptClientFd(int i);
+int		GsPutCh(int fd, unsigned char c);
+void		GsDestroyClientResources(GR_CLIENT * client);
+int		GsRead(int fd, void *buf, int c);
+
+void		GsDropClient(int fd);
+GR_CLIENT	*GsFindClient(int fd);
+#if ECOS
+void		GsHandleClient(mqmessage * msg);
+#else
+void		GsHandleClient(int fd);
+#endif
+void		GsResetScreenSaver(void);
+void		GsActivateScreenSaver(void *arg);
+void		GrGetNextEventWrapperFinish(int);
+
+/*
+ * External data definitions.
+ */
+extern	char *		curfunc;		/* current function name */
+extern	GR_WINDOW_ID	cachewindowid;		/* cached window id */
+extern  GR_WINDOW_ID    cachepixmapid;
+extern	GR_GC_ID	cachegcid;		/* cached graphics context id */
+extern	GR_GC		*cachegcp;		/* cached graphics context */
+extern	GR_GC		*listgcp;		/* list of all gc */
+extern	GR_REGION	*listregionp;		/* list of all regions */
+extern	GR_FONT		*listfontp;		/* list of all fonts */
+extern	GR_IMAGE	*listimagep;		/* list of all images */
+extern	GR_GC		*curgcp;		/* current graphics context */
+extern	GR_WINDOW	*cachewp;		/* cached window pointer */
+extern  GR_PIXMAP       *cachepp;		/* cached pixmap pointer */
+extern	GR_WINDOW	*listwp;		/* list of all windows */
+extern	GR_PIXMAP	*listpp;		/* list of all pixmaps */
+extern	GR_WINDOW	*rootwp;		/* root window pointer */
+extern	GR_WINDOW	*clipwp;		/* window clipping is set for */
+extern	GR_WINDOW	*focuswp;		/* focus window for keyboard */
+extern	GR_WINDOW	*mousewp;		/* window mouse is currently in */
+extern	GR_WINDOW	*grabbuttonwp;		/* window grabbed by button */
+extern	GR_CURSOR	*curcursor;		/* currently enabled cursor */
+extern	GR_COORD	cursorx;		/* x position of cursor */
+extern	GR_COORD	cursory;		/* y position of cursor */
+extern	int		curbuttons;		/* current state of buttons */
+extern	GR_CLIENT	*curclient;		/* current client */
+extern	char		*current_shm_cmds;
+extern	int		current_shm_cmds_size;
+extern	GR_EVENT_LIST	*eventfree;		/* list of free events */
+extern	GR_BOOL		focusfixed;		/* TRUE if focus is fixed */
+extern	GR_SCREEN_INFO	sinfo;			/* screen information */
+extern	PMWFONT		stdfont;		/* default font*/
+extern	int		escape_quits;		/* terminate when pressing ESC*/
+extern	int		connectcount;		/* # of connections to server */
+extern	GR_TIMEOUT	screensaver_delay;	/* time before screensaver */
+						/* activates */
+extern	GR_BOOL		screensaver_active;	/* screensaver is active */
+extern	GR_SELECTIONOWNER selection_owner;	/* the selection owner */
+
+/*
+ * The filename to use for the named socket. If we ever support multiple
+ * servers on one machine, the last digit will be that of the FB used for it.
+ */
+#define GR_NAMED_SOCKET "/tmp/.nano-X"
+#define GR_NUMB_SOCKET 79
+
+#if VTSWITCH
+/* temp framebuffer vt switch stuff at upper level
+ * this should be handled at the lower level, just like vgalib does.
+ */
+void MwInitVt(void);
+int  MwCurrentVt(void);
+int  MwCheckVtChange(void);
+void MwRedrawVt(int t);
+void MwExitVt(void);
+extern int mwvterm;
+#endif /* VTSWITCH*/
+
+#endif /* _SERV_H*/
diff -urN lib/microwindows/src/nanox/srvclip.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvclip.c
--- lib/microwindows/src/nanox/srvclip.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvclip.c	2005-02-21 16:03:46.000000000 +0100
@@ -0,0 +1,7 @@
+#include "device.h"
+
+#if DYNAMICREGIONS
+#include "srvclip2.c"
+#else
+#include "srvclip1.c"
+#endif
diff -urN lib/microwindows/src/nanox/srvclip1.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvclip1.c
--- lib/microwindows/src/nanox/srvclip1.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvclip1.c	2005-02-21 16:03:46.000000000 +0100
@@ -0,0 +1,371 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "serv.h"
+
+/*
+ * Macro to distinguish cases of clipping.
+ */
+#define	GAPVAL(leftgap, rightgap, topgap, bottomgap) \
+	(((leftgap) << 3) + ((rightgap) << 2) + ((topgap) << 1) + (bottomgap))
+
+static GR_COUNT	GsSplitClipRect(MWCLIPRECT *srcrect, MWCLIPRECT *destrect,
+			GR_COORD minx, GR_COORD miny, GR_COORD maxx,
+			GR_COORD maxy);
+/*
+ * Set the clip rectangles for a window taking into account other
+ * windows that may be obscuring it.  The windows that may be obscuring
+ * this one are the siblings of each direct ancestor which are higher
+ * in priority than those ancestors.  Also, each parent limits the visible
+ * area of the window.  The clipping is not done if it is already up to
+ * date of if the window is not outputtable.
+ */
+void
+GsSetClipWindow(GR_WINDOW *wp, MWCLIPREGION *userregion, int flags)
+{
+	GR_WINDOW	*pwp;		/* parent window */
+	GR_WINDOW	*sibwp;		/* sibling windows */
+	MWCLIPRECT	*clip;		/* first clip rectangle */
+	GR_COUNT	count;		/* number of clip rectangles */
+	GR_COUNT	newcount;	/* number of new rectangles */
+	GR_COUNT	i;		/* current index */
+	GR_COORD	minx;		/* minimum clip x coordinate */
+	GR_COORD	miny;		/* minimum clip y coordinate */
+	GR_COORD	maxx;		/* maximum clip x coordinate */
+	GR_COORD	maxy;		/* maximum clip y coordinate */
+	GR_COORD	diff;		/* difference in coordinates */
+	GR_SIZE		bs;		/* border size */
+	GR_BOOL		toomany;	/* TRUE if too many clip rects */
+	MWCLIPRECT	cliprects[MAX_CLIPRECTS];	/* clip rectangles */
+
+	if (wp->unmapcount || !wp->output || (wp == clipwp))
+		return;
+
+	clipwp = wp;
+
+	/*
+	 * Start with the rectangle for the complete window.
+	 * We will then cut pieces out of it as needed.
+	 */
+	count = 1;
+	clip = cliprects;
+	clip->x = wp->x;
+	clip->y = wp->y;
+	clip->width = wp->width;
+	clip->height = wp->height;
+
+	/*
+	 * First walk upwards through all parent windows,
+	 * and restrict the visible part of this window to the part
+	 * that shows through all of those parent windows.
+	 */
+	pwp = wp;
+	while (pwp != rootwp) {
+		pwp = pwp->parent;
+
+		diff = pwp->x - clip->x;
+		if (diff > 0) {
+			clip->width -= diff;
+			clip->x = pwp->x;
+		}
+
+		diff = (pwp->x + pwp->width) - (clip->x + clip->width);
+		if (diff < 0)
+			clip->width += diff;
+
+		diff = pwp->y - clip->y;
+		if (diff > 0) {
+			clip->height -= diff;
+			clip->y = pwp->y;
+		}
+
+		diff = (pwp->y + pwp->height) - (clip->y + clip->height);
+		if (diff < 0)
+			clip->height += diff;
+	}
+
+	/*
+	 * If the window is completely clipped out of view, then
+	 * set the clipping region to indicate that.
+	 */
+	if ((clip->width <= 0) || (clip->height <= 0)) {
+		GdSetClipRects(clipwp->psd, 1, cliprects);
+		return;
+	}
+
+	/*
+	 * Now examine all windows that obscure this window, and
+	 * for each obscuration, break up the clip rectangles into
+	 * the smaller pieces that are still visible.  The windows
+	 * that can obscure us are the earlier siblings of all of
+	 * our parents.
+ 	 */
+	toomany = GR_FALSE;
+	pwp = wp;
+/*while (pwp != rootwp) {*/
+	while (pwp != NULL) {
+		wp = pwp;
+		pwp = wp->parent;
+
+		if(!pwp) {
+			/* We're clipping the root window*/
+			sibwp = rootwp->children;
+			wp = NULL;
+		} else
+			sibwp = pwp->children;
+
+		for (; sibwp != wp; sibwp = sibwp->siblings) {
+			if (sibwp->unmapcount || !sibwp->output)
+				continue;
+
+			bs = sibwp->bordersize;
+			minx = sibwp->x - bs;
+			miny = sibwp->y - bs;
+			maxx = sibwp->x + sibwp->width + bs - 1;
+			maxy = sibwp->y + sibwp->height + bs - 1;
+
+			newcount = count;
+			for (i = 0; i < count; i++) {
+				if (newcount > MAX_CLIPRECTS - 3) {
+					toomany = GR_TRUE;
+					break;
+				}
+				newcount += GsSplitClipRect(&cliprects[i],
+					&cliprects[newcount],
+					minx, miny, maxx, maxy);
+			}
+			count = newcount;
+		}
+if(pwp == rootwp)
+break;
+	}
+
+	if (toomany) {
+		GsError(GR_ERROR_TOO_MUCH_CLIPPING, wp->id);
+		clip->x = 0;
+		clip->y = 0;
+		clip->width = -1;
+		clip->height = -1;
+		count = 1;
+	}
+
+	/*
+	 * Set the clip rectangles.
+	 */
+	GdSetClipRects(clipwp->psd, count, cliprects);
+}
+
+/*
+ * Check the specified clip rectangle against the specified rectangular
+ * region, and reduce it or split it up into multiple clip rectangles
+ * such that the specified region is not contained in any of the clip
+ * rectangles.  The source clip rectangle can be modified in place, and
+ * in addition more clip rectangles can be generated, which are placed in
+ * the indicated destination location.  The maximum number of new clip
+ * rectangles needed is 3.  Returns the number of clip rectangles added.
+ * If the source clip rectangle is totally obliterated, it is set to an
+ * impossible region and 0 is returned.  When splits are done, we prefer
+ * to create wide regions instead of high regions.
+ */
+static GR_COUNT
+GsSplitClipRect(MWCLIPRECT *srcrect, MWCLIPRECT *destrect, GR_COORD minx,
+	GR_COORD miny, GR_COORD maxx, GR_COORD maxy)
+{
+	GR_COORD	x;
+	GR_COORD	y;
+	GR_SIZE		width;
+	GR_SIZE		height;
+	GR_COORD	dx;
+	GR_COORD	dy;
+	int		gaps;
+
+	/*
+	 * First see if there is any overlap at all.
+	 * If not, then nothing to do.
+	 */
+	x = srcrect->x;
+	y = srcrect->y;
+	width = srcrect->width;
+	height = srcrect->height;
+
+	if ((minx > maxx) || (miny > maxy) || (maxx < x) || (maxy < y) ||
+		(x + width <= minx) || (y + height <= miny))
+			return 0;
+
+	/*
+	 * There is an overlap.  Calculate a value to differentiate
+	 * various cases, and then handle each case separately.  The
+	 * cases are classified on whether there are gaps on the left,
+	 * right, top, and bottom sides of the clip rectangle.
+	 */
+	gaps = 0;
+	if (x < minx)
+		gaps |= GAPVAL(1, 0, 0, 0);
+	if (x + width - 1 > maxx)
+		gaps |= GAPVAL(0, 1, 0, 0);
+	if (y < miny)
+		gaps |= GAPVAL(0, 0, 1, 0);
+	if (y + height - 1 > maxy)
+		gaps |= GAPVAL(0, 0, 0, 1);
+
+	switch (gaps) {
+		case GAPVAL(0, 0, 0, 0):	/* no gaps at all */
+			srcrect->x = 0;
+			srcrect->y = 0;
+			srcrect->width = 0;
+			srcrect->height = 0;
+			return 0;
+
+		case GAPVAL(0, 0, 0, 1):	/* gap on bottom */
+			dy = maxy - y + 1;
+			srcrect->y += dy;
+			srcrect->height -= dy;
+			return 0;
+
+		case GAPVAL(0, 0, 1, 0):	/* gap on top */
+			srcrect->height = miny - y;
+			return 0;
+
+		case GAPVAL(0, 0, 1, 1):	/* gap on top, bottom */
+			srcrect->height = miny - y;
+			destrect->x = x;
+			destrect->width = width;
+			destrect->y = maxy + 1;
+			destrect->height = y + height - maxy - 1;
+			return 1;
+
+		case GAPVAL(0, 1, 0, 0):	/* gap on right */
+			dx = maxx - x + 1;
+			srcrect->x += dx;
+			srcrect->width -= dx;
+			return 0;
+
+		case GAPVAL(0, 1, 0, 1):	/* gap on right, bottom */
+			dx = maxx - x + 1;
+			srcrect->x += dx;
+			srcrect->width -= dx;
+			srcrect->height = maxy - y + 1;
+			destrect->x = x;
+			destrect->width = width;
+			destrect->y = maxy + 1;
+			destrect->height = y + height - maxy - 1;
+			return 1;
+
+		case GAPVAL(0, 1, 1, 0):	/* gap on right, top */
+			dx = maxx - x + 1;
+			srcrect->height = miny - y;
+			destrect->x = x + dx;
+			destrect->width = width - dx;
+			destrect->y = miny;
+			destrect->height = y + height - miny;
+			return 1;
+
+		case GAPVAL(0, 1, 1, 1):	/* gap on right, top, bottom */
+			dx = maxx - x + 1;
+			srcrect->height = miny - y;
+			destrect->x = x;
+			destrect->width = width;
+			destrect->y = maxy + 1;
+			destrect->height = y + height - maxy - 1;
+			destrect++;
+			destrect->x = x + dx;
+			destrect->width = width - dx;
+			destrect->y = miny;
+			destrect->height = maxy - miny + 1;
+			return 2;
+
+		case GAPVAL(1, 0, 0, 0):	/* gap on left */
+			srcrect->width = minx - x;
+			return 0;
+
+		case GAPVAL(1, 0, 0, 1):	/* gap on left, bottom */
+			srcrect->width = minx - x;
+			srcrect->height = maxy - y + 1;
+			destrect->x = x;
+			destrect->width = width;
+			destrect->y = maxy + 1;
+			destrect->height = y + height - maxy - 1;
+			return 1;
+
+		case GAPVAL(1, 0, 1, 0):	/* gap on left, top */
+			srcrect->height = miny - y;
+			destrect->x = x;
+			destrect->width = minx - x;
+			destrect->y = miny;
+			destrect->height = y + height - miny;
+			return 1;
+
+		case GAPVAL(1, 0, 1, 1):	/* gap on left, top, bottom */
+			srcrect->height = miny - y;
+			destrect->x = x;
+			destrect->width = minx - x;
+			destrect->y = miny;
+			destrect->height = maxy - miny + 1;
+			destrect++;
+			destrect->x = x;
+			destrect->width = width;
+			destrect->y = maxy + 1;
+			destrect->height = y + height - maxy - 1;
+			return 2;
+
+		case GAPVAL(1, 1, 0, 0):	/* gap on left, right */
+			destrect->x = maxx + 1;
+			destrect->width = x + width - maxx - 1;
+			destrect->y = y;
+			destrect->height = height;
+			srcrect->width = minx - x;
+			return 1;
+
+		case GAPVAL(1, 1, 0, 1):	/* gap on left, right, bottom */
+			dy = maxy - y + 1;
+			srcrect->y += dy;
+			srcrect->height -= dy;
+			destrect->x = x;
+			destrect->width = minx - x;
+			destrect->y = y;
+			destrect->height = dy;
+			destrect++;
+			destrect->x = maxx + 1;
+			destrect->width = x + width - maxx - 1;
+			destrect->y = y;
+			destrect->height = dy;
+			return 2;
+
+		case GAPVAL(1, 1, 1, 0):	/* gap on left, right, top */
+			srcrect->height = miny - y;
+			destrect->x = x;
+			destrect->width = minx - x;
+			destrect->y = miny;
+			destrect->height = y + height - miny;
+			destrect++;
+			destrect->x = maxx + 1;
+			destrect->width = x + width - maxx - 1;
+			destrect->y = miny;
+			destrect->height = y + height - miny;
+			return 2;
+
+		case GAPVAL(1, 1, 1, 1):	/* gap on all sides */
+			srcrect->height = miny - y;
+			destrect->x = x;
+			destrect->width = minx - x;
+			destrect->y = miny;
+			destrect->height = maxy - miny + 1;
+			destrect++;
+			destrect->x = maxx + 1;
+			destrect->width = x + width - maxx - 1;
+			destrect->y = miny;
+			destrect->height = maxy - miny + 1;
+			destrect++;
+			destrect->x = x;
+			destrect->width = width;
+			destrect->y = maxy + 1;
+			destrect->height = y + height - maxy - 1;
+			return 3;
+	}
+	return 0; /* NOTREACHED */
+}
diff -urN lib/microwindows/src/nanox/srvclip2.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvclip2.c
--- lib/microwindows/src/nanox/srvclip2.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvclip2.c	2005-02-21 16:13:32.000000000 +0100
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * DYNAMICREGIONS GsSetClipWindow
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include "serv.h"
+
+/*
+ * Set the clip rectangles for a window taking into account other
+ * windows that may be obscuring it.  The windows that may be obscuring
+ * this one are the siblings of each direct ancestor which are higher
+ * in priority than those ancestors.  Also, each parent limits the visible
+ * area of the window.  The clipping is not done if it is already up to
+ * date of if the window is not outputtable.
+ */
+void
+GsSetClipWindow(GR_WINDOW *wp, MWCLIPREGION *userregion, int flags)
+{
+	GR_WINDOW	*orgwp;		/* original window pointer */
+	GR_WINDOW	*pwp;		/* parent window */
+	GR_WINDOW	*sibwp;		/* sibling windows */
+	GR_COORD	minx;		/* minimum clip x coordinate */
+	GR_COORD	miny;		/* minimum clip y coordinate */
+	GR_COORD	maxx;		/* maximum clip x coordinate */
+	GR_COORD	maxy;		/* maximum clip y coordinate */
+	GR_COORD	diff;		/* difference in coordinates */
+	GR_SIZE		bs;		/* border size */
+	GR_COORD	x, y, width, height;
+	MWCLIPREGION	*vis, *r;
+
+	if (wp->unmapcount || !wp->output)
+		return;
+
+	clipwp = wp;
+
+	/*
+	 * Start with the rectangle for the complete window.
+	 * We will then cut pieces out of it as needed.
+	 */
+	x = wp->x;
+	y = wp->y;
+	width = wp->width;
+	height = wp->height;
+
+	/*
+	 * First walk upwards through all parent windows,
+	 * and restrict the visible part of this window to the part
+	 * that shows through all of those parent windows.
+	 */
+	pwp = wp;
+	while (pwp != rootwp) {
+		pwp = pwp->parent;
+
+		diff = pwp->x - x;
+		if (diff > 0) {
+			width -= diff;
+			x = pwp->x;
+		}
+
+		diff = (pwp->x + pwp->width) - (x + width);
+		if (diff < 0)
+			width += diff;
+
+		diff = pwp->y - y;
+		if (diff > 0) {
+			height -= diff;
+			y = pwp->y;
+		}
+
+		diff = (pwp->y + pwp->height) - (y + height);
+		if (diff < 0)
+			height += diff;
+	}
+
+	/*
+	 * If the window is completely clipped out of view, then
+	 * set the clipping region to indicate that.
+	 */
+	if (width <= 0 || height <= 0) {
+		GdSetClipRegion(clipwp->psd, NULL);
+		return;
+	}
+
+	/*
+	 * Allocate region to clipped size of window
+	 */
+	vis = GdAllocRectRegion(x, y, x+width, y+height);
+
+	/* 
+	 * Allocate temp region
+	 */
+	r = GdAllocRegion();
+
+	/*
+	 * Now examine all windows that obscure this window, and
+	 * for each obscuration, break up the clip rectangles into
+	 * the smaller pieces that are still visible.  The windows
+	 * that can obscure us are the earlier siblings of all of
+	 * our parents.
+ 	 */
+	orgwp = wp;
+	pwp = wp;
+	while (pwp != NULL) {
+		wp = pwp;
+		pwp = wp->parent;
+
+		if(!pwp) {
+			/* We're clipping the root window*/
+			if (!(flags & GR_MODE_EXCLUDECHILDREN))
+				/* start with root's children*/
+				sibwp = rootwp->children;
+			else sibwp = NULL;	 /* no search*/
+			wp = NULL;		 /* search all root's children*/
+		} else {
+			sibwp = pwp->children;	 /* clip siblings*/
+		}
+
+		for (; sibwp != wp; sibwp = sibwp->siblings) {
+			if (sibwp->unmapcount || !sibwp->output)
+				continue;
+
+			bs = sibwp->bordersize;
+			minx = sibwp->x - bs;
+			miny = sibwp->y - bs;
+			maxx = sibwp->x + sibwp->width + bs;
+			maxy = sibwp->y + sibwp->height + bs;
+
+			GdSetRectRegion(r, minx, miny, maxx, maxy);
+			GdSubtractRegion(vis, vis, r);
+		}
+
+		/* if not clipping the root window, stop when you reach it*/
+		if (pwp == rootwp)
+			break;
+	}
+
+	wp = orgwp;
+	/*
+	 * If not the root window, clip all children.
+	 * (Root window's children are are clipped above)
+	 */
+	if(wp != rootwp && !(flags & GR_MODE_EXCLUDECHILDREN)) {
+		for (sibwp=wp->children; sibwp; sibwp = sibwp->siblings) {
+			if (sibwp->unmapcount || !sibwp->output)
+				continue;
+
+			bs = sibwp->bordersize;
+			minx = sibwp->x - bs;
+			miny = sibwp->y - bs;
+			maxx = sibwp->x + sibwp->width + bs;
+			maxy = sibwp->y + sibwp->height + bs;
+
+			GdSetRectRegion(r, minx, miny, maxx, maxy);
+			GdSubtractRegion(vis, vis, r);
+		}
+	}
+
+	/*
+	 * Intersect with user region, if set.
+	 */
+	if (userregion) {
+		/* temporarily offset region by window coordinates*/
+		GdOffsetRegion(userregion, wp->x, wp->y);
+		GdIntersectRegion(vis, vis, userregion);
+		GdOffsetRegion(userregion, -wp->x, -wp->y);
+	}
+
+	/*
+	 * Set the clip region (later destroy handled by GdSetClipRegion)
+	 */
+	GdSetClipRegion(clipwp->psd, vis);
+
+	/*
+	 * Destroy temp region
+	 */
+	GdDestroyRegion(r);
+}
diff -urN lib/microwindows/src/nanox/srvevent.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvevent.c
--- lib/microwindows/src/nanox/srvevent.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvevent.c	2005-02-21 16:13:32.000000000 +0100
@@ -0,0 +1,846 @@
+/*
+ * Copyright (c) 2001 I-Jui Sung <ijsung@csie.nctu.edu.tw>
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Graphics server event routines for windows.
+ */
+#include <stdio.h>
+#if ECOS
+#include <cyg/kernel/kapi.h>
+#include <cyg/infra/diag.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+#include "serv.h"
+
+/* readable error strings*/
+const   char * const nxErrorStrings[] = {
+	GR_ERROR_STRINGS
+};
+
+#if NONETWORK
+/* [copied from client.c]
+ * The following is the user defined function for handling errors.
+ * If this is not set, then the default action is to close the connection
+ * to the server, describe the error, and then exit.  This error function
+ * will only be called when the client asks for events.
+ */
+static GR_FNCALLBACKEVENT ErrorFunc = GrDefaultErrorHandler;
+
+/* 
+ * The default error handler which is called when the server
+ * reports an error event and the client hasn't set a handler for error events.
+ */
+void 
+GrDefaultErrorHandler(GR_EVENT *ep)
+{
+	if (ep->type == GR_EVENT_TYPE_ERROR) {
+		EPRINTF("nxclient: Error (%s) ", ep->error.name);
+		EPRINTF(nxErrorStrings[ep->error.code], ep->error.id);
+		GrClose();
+		exit(1);
+	}
+}
+
+/*
+ * Set an error handling routine, which will be called on any errors from
+ * the server (when events are asked for by the client).  If zero is given,
+ * then errors will be returned as regular events.  
+ * Returns the previous error handler.
+ */
+GR_FNCALLBACKEVENT
+GrSetErrorHandler(GR_FNCALLBACKEVENT fncb)
+{
+	GR_FNCALLBACKEVENT orig = ErrorFunc;
+
+	ErrorFunc = fncb;
+	return orig;
+}
+#endif /* NONETWORK*/
+
+/*
+ * Generate an error from a graphics function.
+ * This creates a special event which describes the error.
+ * Only one error event at a time can be saved for delivery to a client.
+ * This is ok since there are usually lots of redundant errors generated
+ * before the client can notice, errors occurs after the fact, and clients
+ * can't do much about them except complain and die.  The error is saved
+ * specially so that memory problems cannot occur.
+ */
+void GsError(GR_ERROR code, GR_ID id)
+{
+	GR_EVENT_ERROR	*ep;		/* event to describe error */
+
+	EPRINTF("nano-X: GsError ");
+	if(curfunc)
+		EPRINTF("(%s) ", curfunc);
+	EPRINTF(nxErrorStrings[code], id);
+
+	/* if no clients, nothing to report*/
+	if (!curclient)
+		return;
+
+	/* queue the error event regardless of GrSelectEvents*/
+	ep = (GR_EVENT_ERROR *)GsAllocEvent(curclient);
+	ep->type = GR_EVENT_TYPE_ERROR;
+	ep->name[0] = 0;
+	if(curfunc) {
+		strncpy(ep->name, curfunc, sizeof(GR_FUNC_NAME));
+		ep->name[sizeof(GR_FUNC_NAME)-1] = '\0';
+	}
+	ep->code = code;
+	ep->id = id;
+}
+
+/*
+ * Allocate an event to be passed back to the specified client.
+ * The event is already chained onto the event queue, and only
+ * needs filling out.  Returns NULL with an error generated if
+ * the event cannot be allocated.
+ */
+GR_EVENT *GsAllocEvent(GR_CLIENT *client)
+{
+	GR_EVENT_LIST	*elp;		/* current element list */
+	GR_CLIENT	*oldcurclient;	/* old current client */
+
+	/*
+	 * Get a new event structure from the free list, or else
+	 * allocate it using malloc.
+	 */
+	elp = eventfree;
+	if (elp)
+		eventfree = elp->next;
+	else {
+		elp = (GR_EVENT_LIST *) malloc(sizeof(GR_EVENT_LIST));
+		if (elp == NULL) {
+			oldcurclient = curclient;
+			curclient = client;
+			GsError(GR_ERROR_MALLOC_FAILED, 0);
+			curclient = oldcurclient;
+			return NULL;
+		}
+	}
+
+	/*
+	 * Add the event to the end of the event list.
+	 */
+	if (client->eventhead)
+		client->eventtail->next = elp;
+	else
+		client->eventhead = elp;
+	client->eventtail = elp;
+	elp->next = NULL;
+	elp->event.type = GR_EVENT_TYPE_NONE;
+
+	return &elp->event;
+}
+
+/*
+ * Update mouse status and issue events on it if necessary.
+ * This function doesn't block, but is normally only called when
+ * there is known to be some data waiting to be read from the mouse.
+ */
+GR_BOOL GsCheckMouseEvent(void)
+{
+	GR_COORD	rootx;		/* latest mouse x position */
+	GR_COORD	rooty;		/* latest mouse y position */
+	int		newbuttons;	/* latest buttons */
+	int		mousestatus;	/* latest mouse status */
+
+	/* Read the latest mouse status: */
+	mousestatus = GdReadMouse(&rootx, &rooty, &newbuttons);
+	if(mousestatus < 0) {
+		GsError(GR_ERROR_MOUSE_ERROR, 0);
+		return FALSE;
+	} else if(mousestatus) {	/* Deliver events as appropriate: */	
+		GsHandleMouseStatus(rootx, rooty, newbuttons);
+		return TRUE;
+	}
+	return FALSE;
+}
+
+/*
+ * Update keyboard status and issue events on it if necessary.
+ * This function doesn't block, but is normally only called when
+ * there is known to be some data waiting to be read from the keyboard.
+ */
+GR_BOOL GsCheckKeyboardEvent(void)
+{
+	MWKEY	 	mwkey;		/* latest character */
+	MWKEYMOD 	modifiers;	/* latest modifiers */
+	MWSCANCODE	scancode;
+	int	 	keystatus;	/* latest keyboard status */
+
+	/* Read the latest keyboard status: */
+	keystatus = GdReadKeyboard(&mwkey, &modifiers, &scancode);
+
+	if(keystatus < 0) {
+		if(keystatus == -2)	/* special case return code*/
+			GsTerminate();
+		GsError(GR_ERROR_KEYBOARD_ERROR, 0);
+		return FALSE;
+	} else if(keystatus) {		/* Deliver events as appropriate: */	
+		switch (mwkey) {
+		case MWKEY_QUIT:
+			GsTerminate();
+			/* no return*/
+		case MWKEY_REDRAW:
+			GsRedrawScreen();
+			break;
+		case MWKEY_PRINT:
+			GdCaptureScreen("file");
+			break;
+		}
+		GsDeliverKeyboardEvent(0,
+			(keystatus==1?
+			GR_EVENT_TYPE_KEY_DOWN: GR_EVENT_TYPE_KEY_UP),
+			mwkey, modifiers, scancode);
+		return TRUE;
+	}
+	return FALSE;
+}
+
+/*
+ * Handle all mouse events.  These are mouse enter, mouse exit, mouse
+ * motion, mouse position, button down, and button up.  This also moves
+ * the cursor to the new mouse position and changes it shape if needed.
+ */
+void GsHandleMouseStatus(GR_COORD newx, GR_COORD newy, int newbuttons)
+{
+	int	 changebuttons;	/* buttons that have changed */
+	MWKEYMOD modifiers;	/* latest modifiers */
+
+	GdGetModifierInfo(NULL, &modifiers); /* Read kbd modifiers */
+
+	/*
+	 * First, if the mouse has moved, then position the cursor to the
+	 * new location, which will send mouse enter, mouse exit, focus in,
+	 * and focus out events if needed.  Check here for mouse motion and
+	 * mouse position events.  Flush the device queue to make sure the
+	 * new cursor location is quickly seen by the user.
+	 */
+	if ((newx != cursorx) || (newy != cursory)) {
+#if !ECOS
+		GsResetScreenSaver();
+#endif
+		PREFIX(GrMoveCursor)(newx, newy);
+		GsDeliverMotionEvent(GR_EVENT_TYPE_MOUSE_MOTION,
+			newbuttons, modifiers);
+		GsDeliverMotionEvent(GR_EVENT_TYPE_MOUSE_POSITION,
+			newbuttons, modifiers);
+	}
+
+	/*
+	 * Next, generate a button up event if any buttons have been released.
+	 */
+	changebuttons = (curbuttons & ~newbuttons);
+	if (changebuttons) {
+#if !ECOS
+		GsResetScreenSaver();
+#endif
+		GsDeliverButtonEvent(GR_EVENT_TYPE_BUTTON_UP,
+			newbuttons, changebuttons, modifiers);
+	}
+
+	/*
+	 * Finally, generate a button down event if any buttons have been
+	 * pressed.
+	 */
+	changebuttons = (~curbuttons & newbuttons);
+	if (changebuttons) {
+#if !ECOS
+		GsResetScreenSaver();
+#endif
+		GsDeliverButtonEvent(GR_EVENT_TYPE_BUTTON_DOWN,
+			newbuttons, changebuttons, modifiers);
+	}
+
+	curbuttons = newbuttons;
+}
+
+/*
+ * Deliver a mouse button event to the clients which have selected for it.
+ * Each client can only be delivered one instance of the event.  The window
+ * the event is delivered for is either the smallest one containing the
+ * mouse coordinates, or else one of its direct ancestors.  The lowest
+ * window in that tree which has enabled for the event gets it.  This scan
+ * is done independently for each client.  If a window with the correct
+ * noprop mask is reached, or if no window selects for the event, then the
+ * event is discarded for that client.  Special case: for the first client
+ * that is enabled for both button down and button up events in a window,
+ * then the pointer is implicitly grabbed by that window when a button is
+ * pressed down in that window.  The grabbing remains until all buttons are
+ * released.  While the pointer is grabbed, no other clients or windows can
+ * receive button down or up events.
+ */
+void GsDeliverButtonEvent(GR_EVENT_TYPE type, int buttons, int changebuttons,
+			int modifiers)
+{
+	GR_EVENT_BUTTON	*ep;		/* mouse button event */
+	GR_WINDOW	*wp;		/* current window */
+	GR_EVENT_CLIENT	*ecp;		/* current event client */
+	GR_CLIENT	*client;	/* current client */
+	GR_WINDOW_ID	subwid;		/* subwindow id event is for */
+	GR_EVENT_MASK	eventmask;	/* event mask */
+	GR_EVENT_MASK	tempmask;	/* to get around compiler bug */
+
+	eventmask = GR_EVENTMASK(type);
+	if (eventmask == 0)
+		return;
+
+	/*
+	 * If the pointer is implicitly grabbed, then the only window
+	 * which can receive button events is that window.  Otherwise
+	 * the window the pointer is in gets the events.  Determine the
+	 * subwindow by seeing if it is a child of the grabbed button.
+	 */
+	wp = mousewp;
+	subwid = wp->id;
+
+	if (grabbuttonwp) {
+		while ((wp != rootwp) && (wp != grabbuttonwp))
+			wp = wp->parent;
+#if 0
+		if (wp != grabbuttonwp)
+			subwid = grabbuttonwp->id;
+#endif
+		wp = grabbuttonwp;
+	}
+
+	for (;;) {
+		for (ecp = wp->eventclients; ecp; ecp = ecp->next) {
+			if ((ecp->eventmask & eventmask) == 0)
+				continue;
+
+			client = ecp->client;
+
+			/*
+			 * If this is a button down, the buttons are not
+			 * yet grabbed, and this client is enabled for both
+			 * button down and button up events, then implicitly
+			 * grab the window for him.
+			 */
+			if ((type == GR_EVENT_TYPE_BUTTON_DOWN)
+				&& (grabbuttonwp == NULL))
+			{
+				tempmask = GR_EVENT_MASK_BUTTON_UP;
+				if (ecp->eventmask & tempmask) {
+/*DPRINTF("nano-X: implicit grab on window %d\n", wp->id);*/
+					grabbuttonwp = wp;
+				}
+			}
+
+			ep = (GR_EVENT_BUTTON *) GsAllocEvent(client);
+			if (ep == NULL)
+				continue;
+
+			ep->type = type;
+			ep->wid = wp->id;
+			ep->subwid = subwid;
+			ep->rootx = cursorx;
+			ep->rooty = cursory;
+			ep->x = cursorx - wp->x;
+			ep->y = cursory - wp->y;
+			ep->buttons = buttons;
+			ep->changebuttons = changebuttons;
+			ep->modifiers = modifiers;
+			ep->time = GsGetTickCount();
+		}
+
+		/*
+		 * Events do not propagate if the window was grabbed.
+		 * Also release the grab if the buttons are now all released,
+		 * which can cause various events.
+		 */
+		if (grabbuttonwp) {
+			if (buttons == 0) {
+				grabbuttonwp = NULL;
+				PREFIX(GrMoveCursor)(cursorx, cursory);
+			}
+			return;
+		}
+
+		if ((wp == rootwp) || (wp->nopropmask & eventmask))
+			return;
+
+		wp = wp->parent;
+	}
+}
+
+/*
+ * Deliver a mouse motion event to the clients which have selected for it.
+ * Each client can only be delivered one instance of the event.  The window
+ * the event is delivered for is either the smallest one containing the
+ * mouse coordinates, or else one of its direct ancestors.  The lowest
+ * window in that tree which has enabled for the event gets it.  This scan
+ * is done independently for each client.  If a window with the correct
+ * noprop mask is reached, or if no window selects for the event, then the
+ * event is discarded for that client.  Special case: If the event type is
+ * GR_EVENT_TYPE_MOUSE_POSITION, then only the last such event is queued for
+ * any single client to reduce events.  If the mouse is implicitly grabbed,
+ * then only the grabbing window receives the events, and continues to do
+ * so even if the mouse is currently outside of the grabbing window.
+ */
+void GsDeliverMotionEvent(GR_EVENT_TYPE type, int buttons, MWKEYMOD modifiers)
+{
+	GR_EVENT_MOUSE	*ep;		/* mouse motion event */
+	GR_WINDOW	*wp;		/* current window */
+	GR_EVENT_CLIENT	*ecp;		/* current event client */
+	GR_CLIENT	*client;	/* current client */
+	GR_WINDOW_ID	subwid;		/* subwindow id event is for */
+	GR_EVENT_MASK	eventmask;	/* event mask */
+
+	eventmask = GR_EVENTMASK(type);
+	if (eventmask == 0)
+		return;
+
+	wp = mousewp;
+	subwid = wp->id;
+
+	if (grabbuttonwp) {
+		while ((wp != rootwp) && (wp != grabbuttonwp))
+			wp = wp->parent;
+#if 0
+		if (wp != grabbuttonwp)
+			subwid = grabbuttonwp->id;
+#endif
+		wp = grabbuttonwp;
+	}
+
+	for (;;) {
+		for (ecp = wp->eventclients; ecp; ecp = ecp->next) {
+			if ((ecp->eventmask & eventmask) == 0)
+				continue;
+
+			client = ecp->client;
+
+			/*
+			 * If the event is for just the latest position,
+			 * then search the event queue for an existing
+			 * event of this type (if any), and free it.
+			 */
+			if (type == GR_EVENT_TYPE_MOUSE_POSITION) 
+				GsFreePositionEvent(client, wp->id, subwid);
+
+			ep = (GR_EVENT_MOUSE *) GsAllocEvent(client);
+			if (ep == NULL)
+				continue;
+
+			ep->type = type;
+			ep->wid = wp->id;
+			ep->subwid = subwid;
+			ep->rootx = cursorx;
+			ep->rooty = cursory;
+			ep->x = cursorx - wp->x;
+			ep->y = cursory - wp->y;
+			ep->buttons = buttons;
+			ep->modifiers = modifiers;
+		}
+
+		if ((wp == rootwp) || grabbuttonwp ||
+			(wp->nopropmask & eventmask))
+				return;
+
+		wp = wp->parent;
+	}
+}
+
+/*
+ * Deliver a keyboard event to one of the clients which have selected for it.
+ * Only the first client found gets the event (no duplicates are sent).  The
+ * window the event is delivered to is either the smallest one containing
+ * the mouse coordinates, or else one of its direct ancestors (if such a
+ * window is a descendant of the focus window), or else just the focus window.
+ * The lowest window in that tree which has enabled for the event gets it.
+ * If a window with the correct noprop mask is reached, or if no window selects
+ * for the event, then the event is discarded.
+ */
+void GsDeliverKeyboardEvent(GR_WINDOW_ID wid, GR_EVENT_TYPE type,
+	GR_KEY keyvalue, GR_KEYMOD modifiers, GR_SCANCODE scancode)
+{
+	GR_EVENT_KEYSTROKE	*ep;		/* keystroke event */
+	GR_WINDOW		*wp;		/* current window */
+	GR_WINDOW		*tempwp;	/* temporary window pointer */
+	GR_EVENT_CLIENT		*ecp;		/* current event client */
+	GR_WINDOW_ID		subwid;		/* subwindow id event is for */
+	GR_EVENT_MASK		eventmask;	/* event mask */
+	GR_WINDOW		*kwp;
+
+	eventmask = GR_EVENTMASK(type);
+	if (eventmask == 0)
+		return;
+#if !ECOS
+	GsResetScreenSaver();
+#endif
+	/* if window id passed, use it, otherwise focus window*/
+	if (wid) {
+		kwp = GsFindWindow(wid);
+		if (!kwp)
+			return;
+	} else
+		kwp = focuswp;
+	wp = mousewp;
+	subwid = wp->id;
+
+	/*
+	 * See if the actual window the pointer is in is a descendant of
+	 * the focus window.  If not, then ignore it, and force the input
+	 * into the focus window itself.
+	 */
+	tempwp = wp;
+	while ((tempwp != kwp) && (tempwp != rootwp))
+		tempwp = tempwp->parent;
+
+	if (tempwp != kwp) {
+		wp = kwp;
+		subwid = wp->id;
+	}
+
+	/*
+	 * Now walk upwards looking for the first window which will accept
+	 * the keyboard event.  However, do not go beyond the focus window,
+	 * and only give the event to one client.
+	 */
+	for (;;) {
+		for (ecp = wp->eventclients; ecp; ecp = ecp->next) {
+			if ((ecp->eventmask & eventmask) == 0)
+				continue;
+
+			ep = (GR_EVENT_KEYSTROKE *) GsAllocEvent(ecp->client);
+			if (ep == NULL)
+				return;
+
+			ep->type = type;
+			ep->wid = wp->id;
+			ep->subwid = subwid;
+			ep->rootx = cursorx;
+			ep->rooty = cursory;
+			ep->x = cursorx - wp->x;
+			ep->y = cursory - wp->y;
+			ep->buttons = curbuttons;
+			ep->modifiers = modifiers;
+			ep->ch = keyvalue;
+			ep->scancode = scancode;
+			return;			/* only one client gets it */
+		}
+
+		if ((wp == rootwp) || (wp == kwp) ||
+			(wp->nopropmask & eventmask))
+				return;
+
+		wp = wp->parent;
+	}
+}
+
+/*
+ * Try to deliver a exposure event to the clients which have selected for it.
+ * This does not send exposure events for unmapped or input-only windows.
+ * Exposure events do not propagate upwards.
+ */
+void
+GsDeliverExposureEvent(GR_WINDOW *wp, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height)
+{
+	GR_EVENT_EXPOSURE	*ep;		/* exposure event */
+	GR_EVENT_CLIENT		*ecp;		/* current event client */
+
+	if (wp->unmapcount || !wp->output)
+		return;
+
+	for (ecp = wp->eventclients; ecp; ecp = ecp->next) {
+		if ((ecp->eventmask & GR_EVENT_MASK_EXPOSURE) == 0)
+			continue;
+
+		GsFreeExposureEvent(ecp->client, wp->id, x, y, width, height);
+
+		ep = (GR_EVENT_EXPOSURE *) GsAllocEvent(ecp->client);
+		if (ep == NULL)
+			continue;
+
+		ep->type = GR_EVENT_TYPE_EXPOSURE;
+		ep->wid = wp->id;
+		ep->x = x;
+		ep->y = y;
+		ep->width = width;
+		ep->height = height;
+	}
+}
+
+/*
+ * Search for an enclosed expose event in the specified client's
+ * event queue, and remove it.  This is used to prevent multiple expose
+ * events from being delivered, thus providing a more pleasing visual
+ * redraw effect than if the events were all sent.
+ */
+void
+GsFreeExposureEvent(GR_CLIENT *client, GR_WINDOW_ID wid, GR_COORD x,
+	GR_COORD y, GR_SIZE width, GR_SIZE height)
+{
+	GR_EVENT_LIST	*elp;		/* current element list */
+	GR_EVENT_LIST	*prevelp;	/* previous element list */
+
+	prevelp = NULL;
+	for (elp = client->eventhead; elp; prevelp = elp, elp = elp->next) {
+		if (elp->event.type != GR_EVENT_TYPE_EXPOSURE ||
+		    elp->event.exposure.wid != wid)
+			continue;
+		if (elp->event.exposure.x < x || elp->event.exposure.y < y ||
+		    elp->event.exposure.x+elp->event.exposure.width > x+width ||
+		    elp->event.exposure.y+elp->event.exposure.height > y+height)
+			continue;
+
+		/*
+		 * Found one, remove it and put it back on the free list.
+		 */
+		if (prevelp)
+			prevelp->next = elp->next;
+		else
+			client->eventhead = elp->next;
+		if (client->eventtail == elp)
+			client->eventtail = prevelp;
+
+		elp->next = eventfree;
+		eventfree = elp;
+		return;
+	}
+}
+
+/*
+ * Try to deliver an update event to the clients which have selected for it.
+ */
+void GsDeliverUpdateEvent(GR_WINDOW *wp, GR_UPDATE_TYPE utype, GR_COORD x,
+			GR_COORD y, GR_SIZE width, GR_SIZE height)
+{
+	GR_EVENT_MASK		cmask = GR_EVENT_MASK_UPDATE;
+	GR_EVENT_UPDATE		*ep;		/* update event */
+	GR_EVENT_CLIENT		*ecp;		/* current event client */
+	GR_WINDOW_ID		id = wp->id;
+	int			lcount = 0;
+
+update_again:
+	for (ecp = wp->eventclients; ecp; ecp = ecp->next) {
+		if ((ecp->eventmask & cmask) == 0)
+			continue;
+
+		ep = (GR_EVENT_UPDATE *) GsAllocEvent(ecp->client);
+		if (ep == NULL)
+			continue;
+
+		ep->type = lcount? 
+			GR_EVENT_TYPE_CHLD_UPDATE: GR_EVENT_TYPE_UPDATE;
+		ep->utype = utype;
+		ep->wid = wp->id;	/* GrSelectEvents window id*/
+		ep->subwid = id;	/* update window id*/
+		ep->x = x;
+		ep->y = y;
+		ep->width = width;
+		ep->height = height;
+	}
+
+	/* If we are currently checking the window updated, go back and 
+	 * check its parent too */
+	if (!lcount++) {	
+		wp = wp->parent;
+		/* check for NULL on root window id*/
+		if (wp == NULL)
+			return;
+		cmask = GR_EVENT_MASK_CHLD_UPDATE;
+		goto update_again;
+	}
+}
+
+/*
+ * Try to deliver a general event such as focus in, focus out, mouse enter,
+ * or mouse exit to the clients which have selected for it.  These events
+ * only have the window id as data, and do not propagate upwards.
+ */
+void GsDeliverGeneralEvent(GR_WINDOW *wp, GR_EVENT_TYPE type, GR_WINDOW *other)
+{
+	GR_EVENT_GENERAL	*gp;		/* general event */
+	GR_EVENT_CLIENT		*ecp;		/* current event client */
+	GR_EVENT_MASK		eventmask;	/* event mask */
+
+	eventmask = GR_EVENTMASK(type);
+	if (eventmask == 0)
+		return;
+
+	for (ecp = wp->eventclients; ecp; ecp = ecp->next) {
+		if ((ecp->eventmask & eventmask) == 0)
+			continue;
+
+		gp = (GR_EVENT_GENERAL *) GsAllocEvent(ecp->client);
+		if (gp == NULL)
+			continue;
+
+		gp->type = type;
+		gp->wid = wp->id;
+		if (other)
+			gp->otherid = other->id;
+		else gp->otherid = 0;
+	}
+}
+
+/*
+ * Deliver a Screen Saver event. There is only one parameter- activate the
+ * screen saver or deactivate it. We only deliver it to the root window,
+ * but we do send it to every client which has selected for it (because the
+ * program which starts the screen saver on an activate event might not also
+ * be the screen saver program which wants to catch the deactivate event).
+ */
+void GsDeliverScreenSaverEvent(GR_BOOL activate)
+{
+	GR_EVENT_SCREENSAVER	*gp;		/* screensaver event */
+	GR_EVENT_CLIENT		*ecp;		/* current event client */
+
+	for (ecp = rootwp->eventclients; ecp; ecp = ecp->next) {
+		if ((ecp->eventmask & GR_EVENT_MASK_SCREENSAVER) == 0)
+			continue;
+
+		gp = (GR_EVENT_SCREENSAVER *) GsAllocEvent(ecp->client);
+		if (gp == NULL)
+			continue;
+
+		gp->type = GR_EVENT_TYPE_SCREENSAVER;
+		gp->activate = activate;
+	}
+}
+
+/*
+ * Deliver a client data request event. Delivered to the clients who have
+ * selected for this event on the specified window only.
+ */
+void
+GsDeliverClientDataReqEvent(GR_WINDOW_ID wid, GR_WINDOW_ID rid,
+			GR_SERIALNO serial, GR_MIMETYPE mimetype)
+{
+	GR_EVENT_CLIENT_DATA_REQ *gp;		/* client data request event */
+	GR_EVENT_CLIENT		*ecp;		/* current event client */
+	GR_WINDOW *wp;
+
+	if(!(wp = GsFindWindow(wid))) return;
+
+	for (ecp = wp->eventclients; ecp; ecp = ecp->next) {
+		if ((ecp->eventmask & GR_EVENT_MASK_CLIENT_DATA_REQ) == 0)
+			continue;
+
+		gp = (GR_EVENT_CLIENT_DATA_REQ *) GsAllocEvent(ecp->client);
+		if (gp == NULL)
+			continue;
+
+		gp->type = GR_EVENT_TYPE_CLIENT_DATA_REQ;
+		gp->wid = wid;
+		gp->rid = rid;
+		gp->serial = serial;
+		gp->mimetype = mimetype;
+		continue;
+	}
+}
+
+/*
+ * Deliver a client data event. Delivered to the clients who have selected for
+ * this event on the specified window only.
+ */
+void
+GsDeliverClientDataEvent(GR_WINDOW_ID wid, GR_WINDOW_ID rid,
+	GR_SERIALNO serial, GR_LENGTH len, GR_LENGTH thislen, void *data)
+{
+	GR_EVENT_CLIENT_DATA *gp;		/* client data request event */
+	GR_EVENT_CLIENT		*ecp;		/* current event client */
+	GR_WINDOW *wp;
+
+	if(!(wp = GsFindWindow(wid))) return;
+
+	for (ecp = wp->eventclients; ecp; ecp = ecp->next) {
+		if ((ecp->eventmask & GR_EVENT_MASK_CLIENT_DATA) == 0)
+			continue;
+
+		gp = (GR_EVENT_CLIENT_DATA *) GsAllocEvent(ecp->client);
+		if (gp == NULL)
+			continue;
+
+		gp->type = GR_EVENT_TYPE_CLIENT_DATA;
+		gp->wid = wid;
+		gp->rid = rid;
+		gp->serial = serial;
+		gp->len = len;
+		gp->datalen = thislen;
+		if(!(gp->data = malloc(thislen))) {
+			GsError(GR_ERROR_MALLOC_FAILED, wid);
+			return;
+		}
+		memcpy(gp->data, data, thislen);
+		continue;
+	}
+}
+
+/*
+ * Search for a matching mouse position event in the specified client's
+ * event queue, and remove it.  This is used to prevent multiple position
+ * events from being delivered, thus providing a more efficient rubber-
+ * banding effect than if the mouse motion events were all sent.
+ */
+void
+GsFreePositionEvent(GR_CLIENT *client, GR_WINDOW_ID wid, GR_WINDOW_ID subwid)
+{
+	GR_EVENT_LIST	*elp;		/* current element list */
+	GR_EVENT_LIST	*prevelp;	/* previous element list */
+
+	prevelp = NULL;
+	for (elp = client->eventhead; elp; prevelp = elp, elp = elp->next) {
+		if (elp->event.type != GR_EVENT_TYPE_MOUSE_POSITION)
+			continue;
+		if (elp->event.mouse.wid != wid)
+			continue;
+		if (elp->event.mouse.subwid != subwid)
+			continue;
+
+		/*
+		 * Found one, remove it and put it back on the free list.
+		 */
+		if (prevelp)
+			prevelp->next = elp->next;
+		else
+			client->eventhead = elp->next;
+		if (client->eventtail == elp)
+			client->eventtail = prevelp;
+
+		elp->next = eventfree;
+		eventfree = elp;
+		return;
+	}
+}
+
+/*
+ * Deliver a "selection owner changed" event to all windows which have
+ * selected for it. We deliver this event to all clients which have selected
+ * to receive GR_EVENT_TYPE_SELECTION_CHANGED events for the window of the
+ * _previous_ selection owner.
+ */
+void GsDeliverSelectionChangedEvent(GR_WINDOW_ID old_owner,
+					GR_WINDOW_ID new_owner)
+{
+	GR_EVENT_SELECTION_CHANGED *gp;		/* selection changed event */
+	GR_EVENT_CLIENT		*ecp;		/* current event client */
+	GR_WINDOW *wp;
+
+	if(!(wp = GsFindWindow(old_owner))) return;
+
+	for (ecp = wp->eventclients; ecp; ecp = ecp->next) {
+		if ((ecp->eventmask & GR_EVENT_MASK_SELECTION_CHANGED) == 0)
+			continue;
+#if ECOS
+		diag_printf("Delivering a selection changed event\n");
+#else
+		fprintf(stderr, "Delivering a selection changed event\n");
+#endif
+		gp = (GR_EVENT_SELECTION_CHANGED *) GsAllocEvent(ecp->client);
+		if (gp == NULL)
+			continue;
+
+		gp->type = GR_EVENT_TYPE_SELECTION_CHANGED;
+		gp->new_owner = new_owner;
+	}
+}
diff -urN lib/microwindows/src/nanox/srvfunc.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvfunc.c
--- lib/microwindows/src/nanox/srvfunc.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvfunc.c	2005-02-21 16:13:32.000000000 +0100
@@ -0,0 +1,2642 @@
+/* Copyright (c) 2001 I-Jui Sung <ijsung@csie.nctu.edu.tw>
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 2000 Alex Holden <alex@linuxhacker.org>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ */
+/* ijsung: add prefix to non-local functions */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if ECOS
+extern char * strdup(const char *);
+#endif
+#define MWINCLUDECOLORS
+
+#define HAVE_PREFIX
+#include "serv.h"
+
+static int	nextid = GR_ROOT_WINDOW_ID + 1;
+
+static void CheckNextEvent(GR_EVENT *ep, GR_BOOL doSelect);
+
+#if ECOS
+#if 0
+int 		PREFIX(GrPeekEvent)(GR_EVENT *ep);
+GR_WINDOW_ID 	PREFIX(GrNewPixmap)(GR_SIZE width, GR_SIZE height, void * pixels);
+GR_GC_ID 	PREFIX(GrNewGC)(void);
+void 		PREFIX(GrSetGCMode)(GR_GC_ID gc, int mode);
+void		PREFIX(GrCopyArea)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+        		GR_SIZE width, GR_SIZE height, GR_DRAW_ID source,
+        		GR_COORD srcx, GR_COORD srcy, int op);
+void		PREFIX(GrDestroyGC)(GR_GC_ID gc);
+#endif
+#else
+#define PREFIX(x) 
+#endif
+
+/*
+ * Return information about the screen for clients to use.
+ */
+void 
+PREFIX(GrGetScreenInfo) (GR_SCREEN_INFO *sip)
+{
+	GdGetScreenInfo(rootwp->psd, sip);
+
+	/* virtual/workspace screen sizing*/
+#if 0
+	/* force small screen for emulation purposes*/
+	sip->vs_width = 240;	/* PDA*/
+	sip->vs_height = 320;
+	sip->ws_width = 240;
+	sip->ws_height = 298;
+#else
+	/* set workspace equal to screen area minus 22 pixel taskbar*/
+	sip->vs_width = sip->cols;
+	sip->vs_height = sip->rows;
+	sip->ws_width = sip->cols;
+	sip->ws_height = sip->rows - 22;
+#endif
+}
+
+/*
+ * Return the size of a text string for the font in a graphics context.
+ * This is the width of the string, the height of the string,
+ * and the height above the bottom of the font of the baseline for the font.
+ */
+void 
+PREFIX(GrGetGCTextSize)(GR_GC_ID gc, void *str, int count, int flags,
+	GR_SIZE *retwidth, GR_SIZE *retheight, GR_SIZE *retbase)
+{
+	GR_GC		*gcp;
+	GR_FONT		*fontp;
+	PMWFONT		pf;
+
+	gcp = GsFindGC(gc);
+	if (gcp == NULL)
+		fontp = NULL;
+	else
+		fontp = GsFindFont(gcp->fontid);
+	pf = fontp? fontp->pfont: stdfont;
+	GdGetTextSize(pf, str, count, retwidth, retheight, retbase, flags);
+}
+
+#if NONETWORK
+/*
+ * Return the next waiting event for a client, or wait for one if there
+ * is none yet.  The event is copied into the specified structure, and
+ * then is moved from the event queue to the free event queue.  If there
+ * is an error event waiting, it is delivered before any other events.
+ */
+void
+GrGetNextEvent(GR_EVENT *ep)
+{
+	GrGetNextEventTimeout(ep, 0L);
+}
+
+/*
+ * Return the next event from the event queue, or
+ * wait for a new one if one is not ready.  If timeout
+ * is nonzero, return timeout event if time elapsed.
+ */
+void
+GrGetNextEventTimeout(GR_EVENT *ep, GR_TIMEOUT timeout)
+{
+	/* If no event ready, wait for one*/
+	/* Note: won't work for multiple clients*/
+	/* This is OK, since only static linked apps call this function*/
+	while(curclient->eventhead == NULL)
+		GsSelect(timeout);
+	CheckNextEvent(ep, GR_FALSE);
+}
+#endif
+
+/*
+ * Return the next event from the event queue if one is ready.
+ * If one is not ready, then the type GR_EVENT_TYPE_NONE is returned.
+ * If it is an error event, then a user-specified routine is called
+ * if it was defined, otherwise we clean up and exit.
+ */
+void
+PREFIX(GrCheckNextEvent)(GR_EVENT *ep)
+{
+	CheckNextEvent(ep, GR_TRUE);
+}
+
+static void
+CheckNextEvent(GR_EVENT *ep, GR_BOOL doSelect)
+{
+	GR_EVENT_LIST *	elp;
+
+#if NONETWORK
+	/* Since we're bound to server, select() is only called 
+	 * thru here
+	 */
+	if(doSelect)
+		GsSelect(0L);
+#endif
+	/* Copy first event if any*/
+	if(!PREFIX(GrPeekEvent)(ep))
+		return;
+
+	/* Get first event again*/
+	elp = curclient->eventhead;
+
+	/* Remove first event from queue*/
+	curclient->eventhead = elp->next;
+	if (curclient->eventtail == elp)
+		curclient->eventtail = NULL;
+
+	elp->next = eventfree;
+	eventfree = elp;
+}
+
+/*
+ * Peek at the event queue for the current client to see if there are any
+ * outstanding events.  Returns the event at the head of the queue, or
+ * else a null event type.  The event is still left in the queue, however.
+ */
+int
+PREFIX(GrPeekEvent)(GR_EVENT *ep)
+{
+	GR_EVENT_LIST *	elp;
+
+	elp = curclient->eventhead;
+	if(elp == NULL) {
+		ep->type = GR_EVENT_TYPE_NONE;
+		return 0;
+	}
+
+	/* copy event out*/
+	*ep = elp->event;
+	return 1;
+}
+
+/*
+ * Return information about a window id.
+ */
+void
+PREFIX(GrGetWindowInfo)(GR_WINDOW_ID wid, GR_WINDOW_INFO *infoptr)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_PIXMAP	*pp;
+	GR_EVENT_CLIENT	*evp;		/* event-client structure */
+
+	/* first check window list*/
+	wp = GsFindWindow(wid);
+	if (wp) {
+		infoptr->wid = wid;
+		infoptr->x = wp->x;
+		infoptr->y = wp->y;
+		infoptr->width = wp->width;
+		infoptr->height = wp->height;
+		infoptr->parent = wp->parent? wp->parent->id: 0;
+		infoptr->child = wp->children? wp->children->id: 0;
+		infoptr->sibling = wp->siblings? wp->siblings->id: 0;
+		infoptr->mapped = wp->mapped;
+		infoptr->unmapcount = wp->unmapcount;
+		infoptr->inputonly = !wp->output;
+		infoptr->bordersize = wp->bordersize;
+		infoptr->bordercolor = wp->bordercolor;
+		infoptr->background = wp->background;
+		infoptr->props = wp->props;
+		infoptr->eventmask = 0;
+
+		for (evp = wp->eventclients; evp; evp = evp->next) {
+			if (evp->client == curclient)
+				infoptr->eventmask = evp->eventmask;
+		}
+		return;
+	}
+
+	/* then pixmap list*/
+	pp = GsFindPixmap(wid);
+	if (pp) {
+		infoptr->wid = wid;
+		infoptr->x = pp->x;
+		infoptr->y = pp->y;
+		infoptr->width = pp->width;
+		infoptr->height = pp->height;
+		infoptr->parent = 0;
+		infoptr->child = 0;
+		infoptr->sibling = 0;
+		infoptr->mapped = GR_FALSE;
+		infoptr->unmapcount = 0;
+		infoptr->inputonly = GR_FALSE;
+		infoptr->bordersize = 0;
+		infoptr->bordercolor = 0;
+		infoptr->background = 0;
+		infoptr->eventmask = 0;
+		return;
+	}
+
+	/* No error if window id is invalid.*/
+	memset(infoptr, 0, sizeof(GR_WINDOW_INFO));
+}
+
+/*
+ * Destroy an existing window and all of its children.
+ * Also used to destroy a pixmap.
+ */
+void
+PREFIX(GrDestroyWindow)(GR_WINDOW_ID wid)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_PIXMAP	*pp;
+	GR_PIXMAP	*prevpp;
+	PSD		psd;
+
+	wp = GsFindWindow(wid);
+	if (wp) {
+		GsWpDestroyWindow(wp);
+	} else {
+		pp = GsFindPixmap(wid);
+		if (pp) {
+			psd = pp->psd;
+			/* deallocate pixmap memory*/
+			if (psd->flags & PSF_ADDRMALLOC)
+				free(psd->addr);
+
+			/* deallocate mem gc*/
+			psd->FreeMemGC(psd);
+
+			/*
+			 * Remove this pixmap from the complete list of pixmaps.
+			 */
+			prevpp = listpp;
+			if (prevpp == pp)
+				listpp = pp->next;
+			else {
+				while (prevpp->next != pp)
+					prevpp = prevpp->next;
+				prevpp->next = pp->next;
+			}
+
+			/*
+			 * Forget various information if they related to this
+			 * pixmap.  Then finally free the structure.
+			 */
+			if (pp == cachepp) {
+				cachepixmapid = 0;
+				cachepp = NULL;
+			}
+			free(pp);
+		}
+	}
+}
+
+
+/*
+ * Raise a window to the highest level among its siblings.
+ */
+void
+PREFIX(GrRaiseWindow)(GR_WINDOW_ID wid)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_WINDOW	*prevwp;	/* previous window pointer */
+	GR_BOOL		overlap;	/* TRUE if there was overlap */
+
+	wp = GsFindWindow(wid);
+	if ((wp == NULL) || (wp == rootwp))
+		return;
+
+	/*
+	 * If this is already the highest window then we are done.
+	 */
+	prevwp = wp->parent->children;
+	if (prevwp == wp)
+		return;
+
+	/*
+	 * Find the sibling just before this window so we can unlink it.
+	 * Also, determine if any sibling ahead of us overlaps the window.
+	 * Remember that for exposure events.
+	 */
+	overlap = GR_FALSE;
+	while (prevwp->siblings != wp) {
+		overlap |= GsCheckOverlap(prevwp, wp);
+		prevwp = prevwp->siblings;
+	}
+	overlap |= GsCheckOverlap(prevwp, wp);
+
+	/*
+	 * Now unlink the window and relink it in at the front of the
+	 * sibling chain.
+	 */
+	prevwp->siblings = wp->siblings;
+	wp->siblings = wp->parent->children;
+	wp->parent->children = wp;
+
+	/*
+	 * Finally redraw the window if necessary.
+	 */
+	if (overlap) {
+		GsDrawBorder(wp);
+		GsExposeArea(wp, wp->x, wp->y, wp->width, wp->height, NULL);
+	}
+}
+
+/*
+ * Lower a window to the lowest level among its siblings.
+ */
+void 
+PREFIX(GrLowerWindow)(GR_WINDOW_ID wid)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_WINDOW	*prevwp;	/* previous window pointer */
+	GR_WINDOW	*sibwp;		/* sibling window */
+	GR_WINDOW	*expwp;		/* siblings being exposed */
+
+	wp = GsFindWindow(wid);
+	if ((wp == NULL) || (wp == rootwp))
+		return;
+	if (wp->siblings == NULL)
+		return;
+
+	/*
+	 * Find the sibling just before this window so we can unlink us.
+	 */
+	prevwp = wp->parent->children;
+	if (prevwp != wp) {
+		while (prevwp->siblings != wp)
+			prevwp = prevwp->siblings;
+	}
+
+	/*
+	 * Remember the first sibling that is after us, so we can
+	 * generate exposure events for the remaining siblings.  Then
+	 * walk down the sibling chain looking for the last sibling.
+	 */
+	expwp = wp->siblings;
+	sibwp = wp;
+	while (sibwp->siblings)
+		sibwp = sibwp->siblings;
+
+	/*
+	 * Now unlink the window and relink it in at the end of the
+	 * sibling chain.
+	 */
+	if (prevwp == wp)
+		wp->parent->children = wp->siblings;
+	else
+		prevwp->siblings = wp->siblings;
+	sibwp->siblings = wp;
+
+	wp->siblings = NULL;
+
+	/*
+	 * Finally redraw the sibling windows which this window covered
+	 * if they overlapped our window.
+	 */
+	while (expwp && (expwp != wp)) {
+		if (GsCheckOverlap(wp, expwp)) {
+			GsExposeArea(expwp, wp->x - wp->bordersize,
+				wp->y - wp->bordersize,
+				wp->width + wp->bordersize * 2,
+				wp->height + wp->bordersize * 2, NULL);
+		}
+		expwp = expwp->siblings;
+	}
+}
+
+/* Offset a window position and all children by offx,offy*/
+static void
+OffsetWindow(GR_WINDOW *wp, GR_COORD offx, GR_COORD offy)
+{
+	GR_WINDOW	*cp;
+
+	wp->x += offx;
+	wp->y += offy;
+	for(cp=wp->children; cp; cp=cp->siblings)
+		OffsetWindow(cp, offx, offy);
+}
+
+/* deliver an update move event to window and all children*/
+static void
+DeliverUpdateMoveEventAndChildren(GR_WINDOW *wp)
+{
+	GR_WINDOW *	childwp;
+
+	GsDeliverUpdateEvent(wp, GR_UPDATE_MOVE, wp->x, wp->y,
+		wp->width, wp->height);
+
+	for (childwp = wp->children; childwp; childwp = childwp->siblings)
+		DeliverUpdateMoveEventAndChildren(childwp);
+}
+
+/*
+ * Move the window to the specified position relative to its parent.
+ */
+void
+PREFIX(GrMoveWindow)(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_COORD	offx, offy;
+
+	wp = GsFindWindow(wid);
+	if (wp == NULL)
+		return;
+	if (wp == rootwp) {
+		GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wid);
+		return;
+	}
+
+	x += wp->parent->x;
+	y += wp->parent->y;
+	offx = x - wp->x;
+	offy = y - wp->y;
+
+	if (wp->x == x && wp->y == y)
+		return;
+
+	/*** move algorithms not requiring unmap/map ***/
+#if 1
+	/* perform screen blit if topmost and mapped - no flicker!*/
+	if (wp->mapped && wp == wp->parent->children
+		&& wp->parent->id == GR_ROOT_WINDOW_ID) {
+		int 		oldx = wp->x;
+		int 		oldy = wp->y;
+		GR_WINDOW_ID 	pixid = PREFIX(GrNewPixmap)(wp->width, wp->height,NULL);
+		GR_GC_ID	gc = PREFIX(GrNewGC)();
+		GR_WINDOW * 	stopwp = wp;
+		int		X, Y, W, H;
+
+		/* must hide cursor first or GdFixCursor() will show it*/
+		GdHideCursor(rootwp->psd);
+
+		/* turn off clipping of root's children*/
+		PREFIX(GrSetGCMode)(gc, GR_MODE_SET|GR_MODE_EXCLUDECHILDREN);
+
+		/* copy topmost window contents offscreen*/
+		PREFIX(GrCopyArea)(pixid, gc, 0, 0, wp->width, wp->height,
+			GR_ROOT_WINDOW_ID, oldx, oldy, MWROP_SRCCOPY);
+
+		/* calc new window offsets*/
+		OffsetWindow(wp, offx, offy);
+
+		/* force recalc of clip region*/
+		clipwp = NULL;
+
+		/* copy window bits to new location*/
+		PREFIX(GrCopyArea)(GR_ROOT_WINDOW_ID, gc, wp->x, wp->y, wp->width,
+			wp->height, pixid, 0, 0, MWROP_SRCCOPY);
+
+		/*
+		 * If any portion of the window was offscreen
+		 * and is coming onscreen, must send expose events
+		 * to this window as well.
+		 */
+		if ((oldx < 0 && wp->x > oldx) ||
+		    (oldy < 0 && wp->y > oldy) ||
+		    (oldx+wp->width > rootwp->width && wp->x < oldx) ||
+		    (oldy+wp->height > rootwp->height && wp->y < oldy))
+			stopwp = NULL;
+
+		/* 
+		 * Calculate bounded exposed area and
+		 * redraw anything lower than stopwp window.
+		 */
+		X = MWMIN(oldx, wp->x);
+		Y = MWMIN(oldy, wp->y);
+		W = MWMAX(oldx, wp->x) + wp->width - X;
+		H = MWMAX(oldy, wp->y) + wp->height - Y;
+		GsExposeArea(rootwp, X, Y, W, H, stopwp);
+
+		GdShowCursor(rootwp->psd);
+		PREFIX(GrDestroyGC)(gc);
+		PREFIX(GrDestroyWindow)(pixid);
+		DeliverUpdateMoveEventAndChildren(wp);
+		return;
+	}
+#endif
+#if 0
+	/* perform quick move and expose if topmost and mapped - no blit*/
+	if (wp->mapped && wp == wp->parent->children) {
+		int	oldx = wp->x;
+		int	oldy = wp->y;
+		int	X, Y, W, H;
+
+		OffsetWindow(wp, offx, offy);
+
+		/* force recalc of clip region*/
+		clipwp = NULL;
+
+		X = MWMIN(oldx, wp->x);
+		Y = MWMIN(oldy, wp->y);
+		W = MWMAX(oldx, wp->x) + wp->width - X;
+		H = MWMAX(oldy, wp->y) + wp->height - Y;
+		GsExposeArea(rootwp, X, Y, W, H, NULL);
+		DeliverUpdateMoveEventAndChildren(wp);
+		return;
+	}
+#endif
+	/*
+	 * This method will redraw the window entirely,
+	 * resulting in considerable flicker.
+	 */
+	GsWpUnmapWindow(wp, GR_TRUE);
+	OffsetWindow(wp, offx, offy);
+	GsWpMapWindow(wp, GR_FALSE);
+	DeliverUpdateMoveEventAndChildren(wp);
+}
+
+/*
+ * Resize the window to be the specified size.
+ */
+void
+PREFIX(GrResizeWindow)(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height)
+{
+	GR_WINDOW	*wp;		/* window structure */
+
+	wp = GsFindWindow(wid);
+	if (wp == NULL)
+		return;
+	if (wp == rootwp) {
+		GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wid);
+		return;
+	}
+	if ((width <= 0) || (height <= 0)) {
+		GsError(GR_ERROR_BAD_WINDOW_SIZE, wid);
+		return;
+	}
+
+	if ((wp->width == width) && (wp->height == height))
+		return;
+
+	if (wp->unmapcount || !wp->output) {
+		wp->width = width;
+		wp->height = height;
+		return;
+	}
+
+	/*
+	 * This should be optimized to not require redrawing of the window
+	 * when possible.
+	 */
+	GsWpUnmapWindow(wp, GR_TRUE);
+	wp->width = width;
+	wp->height = height;
+	GsWpMapWindow(wp, GR_FALSE);
+	GsDeliverUpdateEvent(wp, GR_UPDATE_SIZE, wp->x, wp->y, width, height);
+}
+
+/*
+ * Reparent window to new parent, position at passed x, y
+ *
+ * NOTE: currently, the new parent must be mapped before
+ * reparenting, or the children of the newly parented window
+ * will have bad unmapcount values due to the GrMapWindow
+ * being called on the parent afterwards, and chaining down
+ * through the children.
+ */
+void
+PREFIX(GrReparentWindow)(GR_WINDOW_ID wid, GR_WINDOW_ID pwid, GR_COORD x, GR_COORD y)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_WINDOW	*pwp;		/* parent window structure */
+	GR_WINDOW	**mysibptr;	/* handle to my sibling ptr */
+	GR_COORD	offx, offy;
+
+	wp = GsFindWindow(wid);
+	pwp = GsFindWindow(pwid);
+	if (wp == NULL || pwp == NULL || wp == pwp)
+		return;
+	if (wp == rootwp) {
+		GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wid);
+		return;
+	}
+
+	x += pwp->x;
+	y += pwp->y;
+	offx = x - wp->x;
+	offy = y - wp->y;
+
+	GsWpUnmapWindow(wp, GR_TRUE);
+	for(mysibptr = &(wp->parent->children); *mysibptr != wp; 
+		mysibptr = &((*mysibptr)->siblings))
+			continue;
+	*mysibptr = wp->siblings;
+	wp->parent = pwp;
+	wp->siblings = pwp->children;
+	pwp->children = wp;
+	OffsetWindow(wp, offx, offy);
+	GsWpMapWindow(wp, GR_FALSE);
+}
+
+static int nextgcid = 1000;
+/*
+ * Allocate a new GC with default parameters.
+ * The GC is owned by the current client.
+ */
+GR_GC_ID 
+PREFIX(GrNewGC)(void)
+{
+	GR_GC	*gcp;
+
+	gcp = (GR_GC *) malloc(sizeof(GR_GC));
+	if (gcp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		return 0;
+	}
+
+	gcp->id = nextgcid++;
+	gcp->mode = GR_MODE_SET;
+	gcp->regionid = 0;	/* no region*/
+	gcp->fontid = 0;	/* 0 is default font*/
+	gcp->foreground = WHITE;
+	gcp->background = BLACK;
+	gcp->usebackground = GR_TRUE;
+	gcp->changed = GR_TRUE;
+	gcp->owner = curclient;
+	gcp->next = listgcp;
+
+	listgcp = gcp;
+
+	return gcp->id;
+}
+
+/*
+ * Destroy an existing graphics context.
+ */
+void
+PREFIX(GrDestroyGC)(GR_GC_ID gc)
+{
+	GR_GC		*gcp;		/* graphics context */
+	GR_GC		*prevgcp;	/* previous graphics context */
+
+	gcp = GsFindGC(gc);
+	if (gcp == NULL)
+		return;
+
+	if (gc == cachegcid) {
+		cachegcid = 0;
+		cachegcp = NULL;
+	}
+	if (gcp == curgcp)
+		curgcp = NULL;
+
+	if (listgcp == gcp)
+		listgcp = gcp->next;
+	else {
+		prevgcp = listgcp;
+		while (prevgcp->next != gcp)
+			prevgcp = prevgcp->next;
+
+		prevgcp->next = gcp->next;
+	}
+	free(gcp);
+}
+
+/*
+ * Allocate a new GC which is a copy of another one.
+ * The GC is owned by the current client.
+ */
+GR_GC_ID 
+PREFIX(GrCopyGC)(GR_GC_ID gc)
+{
+	GR_GC		*oldgcp;	/* old graphics context */
+	GR_GC		*gcp;		/* new graphics context */
+
+	oldgcp = GsFindGC(gc);
+	if (oldgcp == NULL)
+		return 0;
+
+	gcp = (GR_GC *) malloc(sizeof(GR_GC));
+	if (gcp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		return 0;
+	}
+
+	/*
+	 * Copy all the old gcp values into the new one, except allocate
+	 * a new id for it and link it into the list of GCs.
+	 */
+	*gcp = *oldgcp;
+	gcp->id = nextgcid++;
+	gcp->changed = GR_TRUE;
+	gcp->owner = curclient;
+	gcp->next = listgcp;
+	listgcp = gcp;
+
+	return gcp->id;
+}
+
+/*
+ * Return information about the specified graphics context.
+ */
+void 
+PREFIX(GrGetGCInfo)(GR_GC_ID gcid, GR_GC_INFO *gcip)
+{
+	GR_GC		*gcp;
+
+	/*
+	 * Find the GC manually so that an error is not generated.
+	 */
+	for (gcp = listgcp; gcp && (gcp->id != gcid); gcp = gcp->next)
+		continue;
+
+	if (gcp == NULL) {
+		memset(gcip, 0, sizeof(GR_GC_INFO));
+		return;
+	}
+
+	gcip->gcid = gcid;
+	gcip->mode = gcp->mode;
+	gcip->region = gcp->regionid;
+	gcip->font = gcp->fontid;
+	gcip->foreground = gcp->foreground;
+	gcip->background = gcp->background;
+	gcip->usebackground = gcp->usebackground;
+}
+
+static int nextregionid = 1000;
+/*
+ * Allocate a new REGION with default parameters.
+ * The REGION is owned by the current client.
+ */
+GR_REGION_ID
+PREFIX(GrNewRegion)(void)
+{
+	GR_REGION *regionp;
+           
+	regionp = (GR_REGION *) malloc(sizeof(GR_REGION));
+	if (regionp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		return 0;
+	}
+	
+	regionp->rgn = GdAllocRegion();
+	regionp->id = nextregionid++;
+	regionp->owner = curclient;
+	regionp->next = listregionp;
+
+	listregionp = regionp;
+	return regionp->id;
+}
+
+/*
+ * Allocate a new region from a set of points interpreted as a polygon.
+ * The REGION is owned by the current client.
+ */
+GR_REGION_ID
+PREFIX(GrNewPolygonRegion)(int mode, GR_COUNT count, GR_POINT *points)
+{
+#if POLYREGIONS
+	GR_REGION *regionp;
+           
+	regionp = (GR_REGION *) malloc(sizeof(GR_REGION));
+	if (regionp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		return 0;
+	}
+	
+	regionp->rgn = GdAllocPolygonRegion(points, count, mode);
+	regionp->id = nextregionid++;
+	regionp->owner = curclient;
+	regionp->next = listregionp;
+
+	listregionp = regionp;
+	return regionp->id;
+#else
+	return 0;
+#endif
+}
+
+/*
+ * Destroy an existing region.
+ */
+void
+PREFIX(GrDestroyRegion)(GR_REGION_ID region)
+{
+	GR_REGION	*regionp;	/* region */
+	GR_REGION	*prevregionp;	/* previous region */
+
+	regionp = GsFindRegion(region);
+	if (regionp == NULL)
+		return;
+
+	if (listregionp == regionp)
+		listregionp = regionp->next;
+	else {
+		prevregionp = listregionp;
+		while (prevregionp->next != regionp)
+			prevregionp = prevregionp->next;
+
+		prevregionp->next = regionp->next;
+	}
+	GdDestroyRegion(regionp->rgn);
+	free(regionp);
+}
+
+/*
+ * Updates the region from a union of the specified rectangle
+ * and the original region.
+ */
+void
+PREFIX(GrUnionRectWithRegion)(GR_REGION_ID region, GR_RECT *rect)
+{
+	GR_REGION	*regionp;
+	MWRECT		rc;
+	
+	regionp = GsFindRegion(region);
+	if (regionp) {
+		/* convert Nano-X rect to MW rect*/
+		rc.left = rect->x;
+		rc.top = rect->y;
+		rc.right = rect->x + rect->width;
+		rc.bottom = rect->y + rect->height;
+		GdUnionRectWithRegion(&rc, regionp->rgn);	
+	}
+}
+
+/*
+ * Updates the region from a union of two regions.
+ */ 
+void
+PREFIX(GrUnionRegion)(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	GR_REGION	*regionp;
+	GR_REGION	*srcregionp1;
+	GR_REGION	*srcregionp2;
+	
+	regionp = GsFindRegion(dst_rgn);
+	if (regionp == NULL)
+		return;
+	
+	srcregionp1 = GsFindRegion(src_rgn1);
+	if (srcregionp1 == NULL)
+		return;
+	
+	srcregionp2 = GsFindRegion(src_rgn2);
+	if (srcregionp2 == NULL)
+		return;
+	
+	GdUnionRegion(regionp->rgn, srcregionp1->rgn, srcregionp2->rgn);
+}
+
+/*
+ * Updates the region by subtracting a region from another.
+ */ 
+void
+PREFIX(GrSubtractRegion)(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	GR_REGION	*regionp;
+	GR_REGION	*srcregionp1;
+	GR_REGION	*srcregionp2;
+	
+	regionp = GsFindRegion(dst_rgn);
+	if (regionp == NULL)
+		return;
+	
+	srcregionp1 = GsFindRegion(src_rgn1);
+	if (srcregionp1 == NULL)
+		return;
+	
+	srcregionp2 = GsFindRegion(src_rgn2);
+	if (srcregionp2 == NULL)
+		return;
+	
+	GdSubtractRegion(regionp->rgn, srcregionp1->rgn, srcregionp2->rgn);
+}
+
+/*
+ * Updates the region to the difference of two regions.
+ */ 
+void
+PREFIX(GrXorRegion)(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	GR_REGION	*regionp;
+	GR_REGION	*srcregionp1;
+	GR_REGION	*srcregionp2;
+	
+	regionp = GsFindRegion(dst_rgn);
+	if (regionp == NULL)
+		return;
+	
+	srcregionp1 = GsFindRegion(src_rgn1);
+	if (srcregionp1 == NULL)
+		return;
+	
+	srcregionp2 = GsFindRegion(src_rgn2);
+	if (srcregionp2 == NULL)
+		return;
+	
+	GdXorRegion(regionp->rgn, srcregionp1->rgn, srcregionp2->rgn);
+}
+
+/*
+ * Updates the region from a intersection of two regions.
+ */ 
+void
+PREFIX(GrIntersectRegion)(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	GR_REGION	*regionp;
+	GR_REGION	*srcregionp1;
+	GR_REGION	*srcregionp2;
+	
+	regionp = GsFindRegion(dst_rgn);
+	if (regionp == NULL)
+		return;
+	
+	srcregionp1 = GsFindRegion(src_rgn1);
+	if (srcregionp1 == NULL)
+		return;
+	
+	srcregionp2 = GsFindRegion(src_rgn2);
+	if (srcregionp2 == NULL)
+		return;
+	
+	GdIntersectRegion(regionp->rgn, srcregionp1->rgn, srcregionp2->rgn);
+}
+
+/*
+ * Sets the clip-mask in the GC to the specified region.
+ */
+void
+PREFIX(GrSetGCRegion)(GR_GC_ID gc, GR_REGION_ID region)
+{
+	GR_GC		*gcp;
+	
+	gcp = GsFindGC(gc);
+	if(gcp == NULL)
+		return;
+	
+	gcp->regionid = region;
+	gcp->changed = GR_TRUE;
+}
+
+/*
+ * Determines whether a specified point resides in a region.
+ */ 
+GR_BOOL
+PREFIX(GrPointInRegion)(GR_REGION_ID region, GR_COORD x, GR_COORD y)
+{
+	GR_REGION	*regionp;
+	
+	regionp =  GsFindRegion(region);
+	if (regionp == NULL)
+		return GR_FALSE;
+	
+	return GdPtInRegion(regionp->rgn, x, y);
+}
+
+/*
+ * Determines whether a specified rectangle at least partly resides
+ * in a region.
+ */ 
+int
+PREFIX(GrRectInRegion)(GR_REGION_ID region, GR_COORD x, GR_COORD y, GR_COORD w,
+	GR_COORD h)
+{
+	GR_REGION	*regionp;
+	MWRECT		rect;
+	
+	regionp =  GsFindRegion(region);
+	if (regionp == NULL)
+		return MWRECT_OUT;
+	
+	rect.left = x;
+	rect.top = y;
+	rect.right = x + w;
+	rect.bottom = y + h;
+	return GdRectInRegion(regionp->rgn, &rect);
+}
+
+/*
+ * Return GR_TRUE if a region is empty.
+ */ 
+GR_BOOL
+PREFIX(GrEmptyRegion)(GR_REGION_ID region)
+{
+	GR_REGION	*regionp;
+	
+	regionp =  GsFindRegion(region);
+	if (regionp == NULL)
+		return GR_TRUE;
+	
+	return GdEmptyRegion(regionp->rgn);
+}
+
+/*
+ * Return GR_TRUE if two regions are identical.
+ */ 
+GR_BOOL
+PREFIX(GrEqualRegion)(GR_REGION_ID rgn1, GR_REGION_ID rgn2)
+{
+	GR_REGION	*prgn1;
+	GR_REGION	*prgn2;
+	
+	prgn1 = GsFindRegion(rgn1);
+	prgn2 = GsFindRegion(rgn2);
+
+	if (!prgn1 && !prgn2)
+		return GR_TRUE;
+	if (!prgn1 || !prgn2)
+		return GR_FALSE;
+	
+	return GdEqualRegion(prgn1->rgn, prgn2->rgn);
+}
+
+/*
+ * Offset a region by dx, dy.
+ */ 
+void
+PREFIX(GrOffsetRegion)(GR_REGION_ID region, GR_SIZE dx, GR_SIZE dy)
+{
+	GR_REGION	*regionp;
+	
+	regionp =  GsFindRegion(region);
+	if (regionp)
+		GdOffsetRegion(regionp->rgn, dx, dy);
+}
+
+/*
+ * Return the bounding box for the specified region.
+ */
+int
+PREFIX(GrGetRegionBox)(GR_REGION_ID region, GR_RECT *rect)
+{
+	GR_REGION	*regionp;
+	MWRECT		rc;
+	int		ret_val;
+	
+	regionp =  GsFindRegion(region);
+	if (regionp == NULL) {
+		memset(rect, 0, sizeof(GR_RECT));
+		return MWREGION_ERROR;
+	}
+	
+	ret_val = GdGetRegionBox(regionp->rgn, &rc);
+	/* convert MW rect to Nano-X rect*/
+	rect->x = rc.left;
+	rect->y = rc.top;
+	rect->width = rc.right - rc.left;
+	rect->height = rc.bottom - rc.top;
+	return ret_val;
+}
+
+static int nextfontid = 1000;
+/*
+ * Allocate a new GC with default parameters.
+ * The GC is owned by the current client.
+ */
+GR_FONT_ID
+PREFIX(GrCreateFont)(GR_CHAR *name, GR_COORD height, GR_LOGFONT *plogfont)
+{
+	GR_FONT	*fontp;
+
+	fontp = (GR_FONT *) malloc(sizeof(GR_FONT));
+	if (fontp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		return 0;
+	}
+
+	if (plogfont)
+		fontp->pfont = GdCreateFont(&scrdev, NULL, 0, plogfont);
+	else
+		fontp->pfont = GdCreateFont(&scrdev, name, height, NULL);
+	fontp->id = nextfontid++;
+	fontp->owner = curclient;
+	fontp->next = listfontp;
+
+	listfontp = fontp;
+
+	return fontp->id;
+}
+
+/* Set the font size for the passed font*/
+void
+PREFIX(GrSetFontSize)(GR_FONT_ID fontid, GR_COORD size)
+{
+	GR_FONT		*fontp;
+
+	fontp = GsFindFont(fontid);
+	if (fontp)
+		GdSetFontSize(fontp->pfont, size);
+}
+
+/* Set the font rotation in tenths of degrees for the passed font*/
+void
+PREFIX(GrSetFontRotation)(GR_FONT_ID fontid, int tenthdegrees)
+{
+	GR_FONT		*fontp;
+
+	fontp = GsFindFont(fontid);
+	if (fontp)
+		GdSetFontRotation(fontp->pfont, tenthdegrees);
+}
+
+/* Set the font size for the passed font*/
+void
+PREFIX(GrSetFontAttr)(GR_FONT_ID fontid, int setflags, int clrflags)
+{
+	GR_FONT		*fontp;
+
+	fontp = GsFindFont(fontid);
+	if (fontp)
+		GdSetFontAttr(fontp->pfont, setflags, clrflags);
+}
+
+/*
+ * Unload and deallocate an existing font.
+ */
+void
+PREFIX(GrDestroyFont)(GR_FONT_ID fontid)
+{
+	GR_FONT		*fontp;
+	GR_FONT		*prevfontp;
+
+	fontp = GsFindFont(fontid);
+	if (fontp == NULL)
+		return;
+
+	if (listfontp == fontp)
+		listfontp = fontp->next;
+	else {
+		prevfontp = listfontp;
+		while (prevfontp->next != fontp)
+			prevfontp = prevfontp->next;
+
+		prevfontp->next = fontp->next;
+	}
+	GdDestroyFont(fontp->pfont);
+	free(fontp);
+}
+
+/*
+ * Return useful information about the specified font.
+ * Font #0 returns info about the standard font.
+ */
+void
+PREFIX(GrGetFontInfo)(GR_FONT_ID font, GR_FONT_INFO *fip)
+{
+	GR_FONT	*fontp;
+	PMWFONT	pf;
+
+	if (font == 0)
+		pf = stdfont;
+	else {
+		fontp = GsFindFont(font);
+		if (!fontp) {
+			memset(fip, 0, sizeof(GR_FONT_INFO));
+			return;
+		}
+		pf = fontp->pfont;
+	}
+	GdGetFontInfo(pf, fip);
+}
+
+/*
+ * Select events for a window for this client.
+ * The events are a bitmask for the events desired.
+ */
+void 
+PREFIX(GrSelectEvents)(GR_WINDOW_ID wid, GR_EVENT_MASK eventmask)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_EVENT_CLIENT	*evp;		/* event-client structure */
+
+	wp = GsFindWindow(wid);
+	if (wp == NULL)
+		return;
+
+	/*
+	 * See if this client is already in the event client list.
+	 * If so, then just replace the events he is selecting for.
+	 */
+	for (evp = wp->eventclients; evp; evp = evp->next) {
+		if (evp->client == curclient) {
+			evp->eventmask = eventmask;
+			return;
+		}
+	}
+
+	/*
+	 * A new client for this window, so allocate a new event client
+	 * structure and insert it into the front of the list in the window.
+	 */
+	evp = (GR_EVENT_CLIENT *) malloc(sizeof(GR_EVENT_CLIENT));
+	if (evp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, wid);
+		return;
+	}
+
+	evp->client = curclient;
+	evp->eventmask = eventmask;
+	evp->next = wp->eventclients;
+	wp->eventclients = evp;
+
+	/*
+	 * If it's a request for child updates to the root window,
+	 * then search entire list and send map events for
+	 * mapped windows now.  This allows a window manager
+	 * to get the mapped window list without another API call.
+	 */
+	if (wid==GR_ROOT_WINDOW_ID && (eventmask & GR_EVENT_MASK_CHLD_UPDATE)) {
+		for (wp = listwp; wp; wp = wp->next) {
+			if (wp->unmapcount == 0)
+				GsDeliverUpdateEvent(wp, GR_UPDATE_MAP,
+					wp->x, wp->y, wp->width, wp->height);
+		}
+	}
+}
+
+static GR_WINDOW *
+NewWindow(GR_WINDOW *pwp, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, GR_SIZE bordersize, GR_COLOR background,
+	GR_COLOR bordercolor)
+{
+	GR_WINDOW	*wp;	/* new window*/
+
+	if (width <= 0 || height <= 0 || bordersize < 0) {
+		GsError(GR_ERROR_BAD_WINDOW_SIZE, 0);
+		return NULL;
+	}
+
+	wp = (GR_WINDOW *) malloc(sizeof(GR_WINDOW));
+	if (wp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		return NULL;
+	}
+
+	wp->id = nextid++;
+	wp->psd = rootwp->psd;
+	wp->parent = pwp;
+	wp->children = NULL;
+	wp->siblings = pwp->children;
+	wp->next = listwp;
+	wp->x = pwp->x + x;
+	wp->y = pwp->y + y;
+	wp->width = width;
+	wp->height = height;
+	wp->bordersize = bordersize;
+	wp->background = background;
+	wp->bgpixmap = NULL;
+	wp->bgpixmapflags = GR_BACKGROUND_TILE;
+	wp->bordercolor = bordercolor;
+	wp->nopropmask = 0;
+	wp->eventclients = NULL;
+	wp->owner = curclient;
+	wp->cursor = pwp->cursor;
+	wp->cursor->usecount++;
+	wp->mapped = GR_FALSE;
+	wp->unmapcount = pwp->unmapcount + 1;
+	wp->output = GR_TRUE;
+	wp->props = 0;
+	wp->title = NULL;
+
+	pwp->children = wp;
+	listwp = wp;
+
+	return wp;
+}
+
+/*
+ * Allocate a new window which is a child of the specified window.
+ * The window inherits the cursor of the parent window.
+ * The window is owned by the current client.
+ */
+GR_WINDOW_ID
+PREFIX(GrNewWindow)(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, GR_SIZE bordersize, GR_COLOR background,
+	GR_COLOR bordercolor)
+{
+	GR_WINDOW	*pwp;		/* parent window */
+	GR_WINDOW	*wp;		/* new window */
+
+	pwp = GsFindWindow(parent);
+	if (pwp == NULL)
+		return 0;
+
+	if (!pwp->output) {
+		GsError(GR_ERROR_INPUT_ONLY_WINDOW, pwp->id);
+		return 0;
+	}
+
+	wp = NewWindow(pwp, x, y, width, height, bordersize, background,
+		bordercolor);
+	return wp? wp->id: 0;
+}
+
+/*
+ * Allocate a new input-only window which is a child of the specified window.
+ * Such a window is invisible, cannot be drawn into, and is only used to
+ * return events.  The window inherits the cursor of the parent window.
+ * The window is owned by the current client.
+ */
+GR_WINDOW_ID
+PREFIX(GrNewInputWindow)(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height)
+{
+	GR_WINDOW	*pwp;		/* parent window */
+	GR_WINDOW	*wp;		/* new window */
+
+	pwp = GsFindWindow(parent);
+	if (pwp == NULL)
+		return 0;
+
+	wp = NewWindow(pwp, x, y, width, height, 0, BLACK, BLACK);
+	if (wp) {
+		/* convert to input-only window*/
+		wp->output = GR_FALSE;
+		return wp->id;
+	}
+	return 0;
+}
+
+/*
+ * Allocate a pixmap, can be used with any drawing functions
+ * for offscreen drawing
+ */
+GR_WINDOW_ID
+PREFIX(GrNewPixmap)(GR_SIZE width, GR_SIZE height, void * pixels)
+{
+	GR_PIXMAP	*pp;
+	PSD		psd;
+        int 		size, linelen, bpp, planes;
+   
+	if (width <= 0 || height <= 0) {
+		/* no error for now, server will desynchronize w/app*/
+		/*GsError(GR_ERROR_BAD_WINDOW_SIZE, 0);*/
+		return 0;
+	}
+
+	/*
+	 * allocate offscreen psd.  If screen driver doesn't
+	 * support blitting, this will fail.  Use root window screen
+	 * device for compatibility for now.
+	 */
+	planes = rootwp->psd->planes;
+	bpp = rootwp->psd->bpp;
+        psd = rootwp->psd->AllocateMemGC(rootwp->psd);
+	if (!psd)
+		return 0;
+
+	pp = (GR_PIXMAP *) malloc(sizeof(GR_PIXMAP));
+	if (pp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		psd->FreeMemGC(psd);
+		return 0;
+	}
+
+        GdCalcMemGCAlloc(psd, width, height, 0, 0, &size, &linelen);
+
+	/* Allocate space for pixel values */
+        if (!pixels) {
+	        pixels = calloc(size, 1);
+		psd->flags |= PSF_ADDRMALLOC;
+	}
+	if (!pixels) {
+		free(pp);
+		psd->FreeMemGC(psd);
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		return 0;
+	}
+  
+	pp->id = nextid++;
+	pp->next = listpp;
+	pp->psd = psd;
+	pp->x = 0;
+	pp->y = 0;
+	pp->width = width;
+	pp->height = height;
+	pp->owner = curclient;
+
+        psd->MapMemGC(psd, width, height, planes, bpp, linelen, size,
+		pixels);
+	
+        listpp = pp;
+	return pp->id;
+}
+
+/*
+ * Map the window to make it (and possibly its children) visible on the screen.
+ */
+void
+PREFIX(GrMapWindow)(GR_WINDOW_ID wid)
+{
+	GR_WINDOW	*wp;		/* window structure */
+
+	wp = GsFindWindow(wid);
+	if (!wp || wp->mapped)
+		return;
+
+	wp->mapped = GR_TRUE;
+
+	GsWpMapWindow(wp, GR_FALSE);
+}
+
+/*
+ * Unmap the window to make it and its children invisible on the screen.
+ */
+void
+PREFIX(GrUnmapWindow)(GR_WINDOW_ID wid)
+{
+	GR_WINDOW	*wp;		/* window structure */
+
+	wp = GsFindWindow(wid);
+	if (!wp || !wp->mapped)
+		return;
+
+	GsWpUnmapWindow(wp, GR_FALSE);
+
+	wp->mapped = GR_FALSE;
+}
+
+/*
+ * Clear the specified window.
+ * This sets the window to its background color.
+ * If the exposeflag is nonzero, then this also creates an exposure
+ * event for the window.
+ */
+void
+PREFIX(GrClearWindow)(GR_WINDOW_ID wid, GR_BOOL exposeflag)
+{
+	GR_WINDOW		*wp;	/* window structure */
+
+	wp = GsPrepareWindow(wid);
+	if (wp)
+		GsWpClearWindow(wp, 0, 0, wp->width, wp->height, exposeflag);
+}
+
+/* Return window with keyboard focus.*/
+GR_WINDOW_ID
+PREFIX(GrGetFocus)(void)
+{
+	return focuswp->id;
+}
+
+/*
+ * Set the focus to a particular window.
+ * This makes keyboard events only visible to that window or children of it,
+ * depending on the pointer location.
+ */
+void
+PREFIX(GrSetFocus)(GR_WINDOW_ID wid)
+{
+	GR_WINDOW	*wp;		/* window structure */
+
+	wp = GsFindWindow(wid);
+	if (wp == NULL)
+		return;
+
+	if (wp->unmapcount) {
+		GsError(GR_ERROR_UNMAPPED_FOCUS_WINDOW, wid);
+		return;
+	}
+
+	/* Check if window wants focus, if not, ignore call*/
+	if (wp->props & GR_WM_PROPS_NOFOCUS)
+		return;
+
+	focusfixed = (wp != rootwp);
+	GsWpSetFocus(wp);
+}
+
+/*
+ * Set the border of a window to the specified color.
+ */
+void
+PREFIX(GrSetBorderColor)(GR_WINDOW_ID wid, GR_COLOR color)
+{
+	GR_WINDOW	*wp;		/* window structure */
+
+	wp = GsFindWindow(wid);
+	if (!wp || wp->bordercolor == color || wp->bordersize == 0)
+		return;
+
+	wp->bordercolor = color;
+	if (wp->unmapcount == 0)
+		GsDrawBorder(wp);
+}
+
+/*
+ * Specify a cursor for a window.
+ * This cursor will only be used within that window, and by default
+ * for its new children.  If the cursor is currently within this
+ * window, it will be changed to the new one immediately.
+ */
+void
+PREFIX(GrSetCursor)(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height, GR_COORD hotx,
+	GR_COORD hoty, GR_COLOR foreground, GR_COLOR background,
+	GR_BITMAP *fgbitmap, GR_BITMAP *bgbitmap)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_CURSOR	*cp;		/* cursor structure */
+	int		bytes;		/* number of bytes of bitmap */
+
+	wp = GsFindWindow(wid);
+	if (wp == NULL)
+		return;
+
+	/*
+	 * Make sure the size of the bitmap is reasonable.
+	 */
+	if ((width <= 0) || (width > MWMAX_CURSOR_SIZE) ||
+		(height <= 0) || (height > MWMAX_CURSOR_SIZE))
+	{
+		GsError(GR_ERROR_BAD_CURSOR_SIZE, 0);
+		return;
+	}
+	bytes = GR_BITMAP_SIZE(width, height) * sizeof(GR_BITMAP);
+
+	/*
+	 * See if the window is using a shared cursor definition.
+	 * If so, then allocate a new private one, otherwise reuse it.
+	 */
+	cp = wp->cursor;
+	if (cp == NULL || cp->usecount-- > 1) {
+		cp = (GR_CURSOR *) malloc(sizeof(GR_CURSOR));
+		if (cp == NULL) {
+			GsError(GR_ERROR_MALLOC_FAILED, 0);
+			return;
+		}
+	}
+
+	cp->usecount = 1;
+	cp->cursor.width = width;
+	cp->cursor.height = height;
+	cp->cursor.hotx = hotx;
+	cp->cursor.hoty = hoty;
+	cp->cursor.fgcolor = foreground;
+	cp->cursor.bgcolor = background;
+	memcpy(cp->cursor.image, fgbitmap, bytes);
+	memcpy(cp->cursor.mask, bgbitmap, bytes);
+	wp->cursor = cp;
+
+	/*
+	 * If this was the current cursor, then draw the new one.
+	 */
+	if (cp == curcursor || curcursor == NULL) {
+		GdMoveCursor(cursorx - cp->cursor.hotx,
+			cursory - cp->cursor.hoty);
+		GdSetCursor(&cp->cursor);
+	}
+
+	GsCheckCursor();
+}
+
+/*
+ * Move the cursor to the specified absolute screen coordinates.
+ * The coordinates are that of the defined hot spot of the cursor.
+ * The cursor's appearance is changed to that defined for the window
+ * in which the cursor is moved to.  In addition, mouse enter, mouse
+ * exit, focus in, and focus out events are generated if necessary.
+ */
+void
+PREFIX(GrMoveCursor)(GR_COORD x, GR_COORD y)
+{
+	/*
+	 * Move the cursor only if necessary, offsetting it to
+	 * place the hot spot at the specified coordinates.
+	 */
+	if ((x != cursorx) || (y != cursory)) {
+		if(curcursor)
+			GdMoveCursor(x - curcursor->cursor.hotx,
+				y - curcursor->cursor.hoty);
+		cursorx = x;
+		cursory = y;
+	}
+
+	/*
+	 * Now check to see which window the mouse is in, whether or
+	 * not the cursor shape should be changed, and whether or not
+	 * the input focus window should be changed.
+	 */
+	GsCheckMouseWindow();
+	GsCheckFocusWindow();
+	GsCheckCursor();
+}
+
+/*
+ * Set the foreground color in a graphics context.
+ */
+void
+PREFIX(GrSetGCForeground)(GR_GC_ID gc, GR_COLOR foreground)
+{
+	GR_GC		*gcp;		/* graphics context */
+
+	gcp = GsFindGC(gc);
+	if (!gcp || gcp->foreground == foreground)
+		return;
+
+	gcp->foreground = foreground;
+	gcp->changed = GR_TRUE;
+}
+
+/*
+ * Set the background color in a graphics context.
+ */
+void
+PREFIX(GrSetGCBackground)(GR_GC_ID gc, GR_COLOR background)
+{
+	GR_GC		*gcp;		/* graphics context */
+
+	gcp = GsFindGC(gc);
+	if (!gcp || gcp->background == background)
+		return;
+
+	gcp->background = background;
+	gcp->changed = GR_TRUE;
+}
+
+/*
+ * Set whether or not the background color is drawn in bitmaps and text.
+ */
+void
+PREFIX(GrSetGCUseBackground)(GR_GC_ID gc, GR_BOOL flag)
+{
+	GR_GC		*gcp;		/* graphics context */
+
+	flag = (flag != 0);
+	gcp = GsFindGC(gc);
+	if (!gcp || gcp->usebackground == flag)
+		return;
+
+	gcp->usebackground = flag;
+	gcp->changed = GR_TRUE;
+}
+
+/*
+ * Set the drawing mode in a graphics context.
+ */
+void
+PREFIX(GrSetGCMode)(GR_GC_ID gc, int mode)
+{
+	GR_GC		*gcp;		/* graphics context */
+
+	gcp = GsFindGC(gc);
+	if (!gcp || gcp->mode == mode)
+		return;
+	if ((mode & GR_MODE_DRAWMASK) > GR_MAX_MODE) {
+		GsError(GR_ERROR_BAD_DRAWING_MODE, gc);
+		return;
+	}
+
+	gcp->mode = mode;
+	gcp->changed = GR_TRUE;
+}
+
+/*
+ * Set the text font in a graphics context.
+ */
+void
+PREFIX(GrSetGCFont)(GR_GC_ID gc, GR_FONT_ID font)
+{
+	GR_GC		*gcp;		/* graphics context */
+	GR_FONT		*fontp;
+
+	gcp = GsFindGC(gc);
+	if (!gcp || gcp->fontid == font)
+		return;
+
+	fontp = GsFindFont(font);
+	gcp->fontid = font;
+	gcp->changed = GR_TRUE;
+}
+
+/*
+ * Draw a line in the specified drawable using the specified graphics context.
+ */
+
+void
+PREFIX(GrLine)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x1, GR_COORD y1, GR_COORD x2,
+	GR_COORD y2)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdLine(dp->psd, dp->x + x1, dp->y + y1,
+				dp->x + x2, dp->y + y2, TRUE);
+			break;
+	}
+}
+
+/*
+ * Draw the boundary of a rectangle in the specified drawable using the
+ * specified graphics context.
+ * NOTE: this function draws a rectangle 1 pixel wider and higher
+ * than Xlib's XDrawRectangle().
+ */
+void 
+PREFIX(GrRect)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+      	        case GR_DRAW_TYPE_PIXMAP:
+			GdRect(dp->psd, dp->x + x, dp->y + y, width, height);
+			break;
+	}
+}
+
+/*
+ * Fill a rectangle in the specified drawable using the specified
+ * graphics context.
+ */
+void
+PREFIX(GrFillRect)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdFillRect(dp->psd, dp->x + x, dp->y + y, width,height);
+			break;
+	}
+}
+
+/*
+ * Draw the boundary of an ellipse in the specified drawable with
+ * the specified graphics context.  Integer only.
+ */
+void
+PREFIX(GrEllipse)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx,
+	GR_SIZE ry)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdEllipse(dp->psd, dp->x + x, dp->y + y, rx, ry, FALSE);
+			break;
+	}
+}
+
+/*
+ * Fill an ellipse in the specified drawable using the specified
+ * graphics context.  Integer only.
+ */
+void
+PREFIX(GrFillEllipse)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx,
+	GR_SIZE ry)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdEllipse(dp->psd, dp->x + x, dp->y + y, rx, ry, TRUE);
+			break;
+	}
+}
+
+/*
+ * Draw an arc, pie or ellipse in the specified drawable using
+ * the specified graphics context.  Integer only.
+ */
+void	
+PREFIX(GrArc)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry, GR_COORD ax, GR_COORD ay,
+	GR_COORD bx, GR_COORD by, int type)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdArc(dp->psd, dp->x + x, dp->y + y, rx, ry,
+				dp->x+ax, dp->y+ay, dp->x+bx, dp->y+by, type);
+			break;
+	}
+}
+
+/*
+ * Draw an arc or pie in the specified drawable using
+ * the specified graphics context.  Requires floating point.
+ */
+void
+PREFIX(GrArcAngle)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry, GR_COORD angle1, GR_COORD angle2, int type)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdArcAngle(dp->psd, dp->x + x, dp->y + y, rx, ry,
+				angle1, angle2, type);
+			break;
+	}
+}
+
+/*
+ * Draw a rectangular area in the specified drawable using the specified
+ * graphics, as determined by the specified bit map.  This differs from
+ * rectangle drawing in that the rectangle is drawn using the foreground
+ * color and possibly the background color as determined by the bit map.
+ * Each row of bits is aligned to the next bitmap word boundary (so there
+ * is padding at the end of the row).  The background bit values are only
+ * written if the usebackground flag is set in the GC.
+ */
+void
+PREFIX(GrBitmap)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, GR_BITMAP *imagebits)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdBitmap(dp->psd, dp->x + x, dp->y + y, width, height,
+				imagebits);
+			break;
+	}
+}
+
+/* draw a multicolor image at x, y*/
+void
+PREFIX(GrDrawImageBits)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_IMAGE_HDR *pimage)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdDrawImage(dp->psd, dp->x + x, dp->y + y, pimage);
+			break;
+	}
+}
+
+#if !((DOS_DJGPP) || (__PACIFIC__) || (DOS_TURBOC))
+/* Load an image file from disk and display it at the specified coordinates*/
+void
+PREFIX(GrDrawImageFromFile)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, char* path, int flags)
+{
+#if defined(HAVE_FILEIO)
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+ 	        case GR_DRAW_TYPE_PIXMAP:
+			GdDrawImageFromFile(dp->psd, dp->x + x, dp->y + y,
+				width, height, path, flags);
+			break;
+	}
+#endif
+}
+
+/* load image from file and cache it*/
+GR_IMAGE_ID
+PREFIX(GrLoadImageFromFile)(char *path, int flags)
+{
+#if defined(HAVE_FILEIO)
+	GR_IMAGE_ID	id;
+	GR_IMAGE *	imagep;
+
+	id = GdLoadImageFromFile(&scrdev, path, flags);
+	if (!id)
+		return 0;
+
+	imagep = (GR_IMAGE *) malloc(sizeof(GR_IMAGE));
+	if (imagep == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		GdFreeImage(id);
+		return 0;
+	}
+	
+	imagep->id = id;
+	imagep->owner = curclient;
+	imagep->next = listimagep;
+
+	listimagep = imagep;
+	return id;
+#else
+	return 0;
+#endif 
+}
+
+/* draw cached image*/
+void
+PREFIX(GrDrawImageToFit)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, GR_IMAGE_ID imageid)
+{
+#if defined(HAVE_FILEIO)
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+ 	        case GR_DRAW_TYPE_PIXMAP:
+			GdDrawImageToFit(dp->psd, dp->x + x, dp->y + y,
+				width, height, imageid);
+			break;
+	   
+	}
+#endif
+}
+
+/* free cached image*/
+void
+PREFIX(GrFreeImage)(GR_IMAGE_ID id)
+{
+#if defined(HAVE_FILEIO)
+	GR_IMAGE	*imagep;
+	GR_IMAGE	*previmagep;
+
+	for (imagep = listimagep; imagep; imagep = imagep->next) {
+		if (imagep->id == id) {
+
+			if (listimagep == imagep)
+				listimagep = imagep->next;
+			else {
+				previmagep = listimagep;
+				while (previmagep->next != imagep)
+					previmagep = previmagep->next;
+
+				previmagep->next = imagep->next;
+			}
+
+			GdFreeImage(imagep->id);
+			free(imagep);
+			return;
+		}
+	}
+#endif
+}
+
+/* return cached image information*/
+void
+PREFIX(GrGetImageInfo)(GR_IMAGE_ID id, GR_IMAGE_INFO *iip)
+{
+#if defined(HAVE_FILEIO)
+	GdGetImageInfo(id, iip);
+#else
+	memset(iip, 0, sizeof(GR_IMAGE_INFO));
+#endif
+}
+#endif /* !defined (DOS_DJGPP)|| (__PACIFIC__) || (DOS_TURBOC)) */
+
+/*
+ * Draw a rectangular area in the specified drawable using the specified
+ * graphics context.  This differs from rectangle drawing in that the
+ * color values for each pixel in the rectangle are specified.  
+ * The color table is indexed row by row.
+ */
+void
+PREFIX(GrArea)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, void *pixels, int pixtype)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdArea(dp->psd, dp->x + x, dp->y + y, width, height,
+				pixels, pixtype);
+			break;
+	}
+}
+
+/*
+ * Copy a rectangle from one drawable to another or the same
+ */
+void
+PREFIX(GrCopyArea)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, GR_DRAW_ID source,
+	GR_COORD srcx, GR_COORD srcy, int op)
+{
+	GR_DRAWABLE	*dp;
+        GR_WINDOW	*swp;
+        GR_PIXMAP	*spp = NULL;
+        GR_DRAW_TYPE	type;
+        PSD 		srcpsd;
+   
+        srcpsd = NULL;
+
+        swp = GsFindWindow(source);
+        type = GsPrepareDrawing(id, gc, &dp);
+	if (type == GR_DRAW_TYPE_NONE)
+		return;
+
+        if (swp) {
+		srcpsd = swp->psd;
+		srcx += swp->x;
+		srcy += swp->y;
+	} else {
+	       spp = GsFindPixmap(source);
+	       if (spp)
+		     srcpsd = spp->psd;
+	}
+        if (!srcpsd)
+		return;
+
+#if DYNAMICREGIONS
+	/*
+	 * Skip blit and send expose event if window is partly
+	 * obscured and source and destination are onscreen.
+	 * Also check that receiving window's first client has
+	 * selected for expose events.  This keeps brain-dead
+	 * programs that don't process exposure events somewhat working.
+	 */
+	if (swp && (srcpsd == dp->psd) && swp->eventclients &&
+	    (swp->eventclients->eventmask & GR_EVENT_MASK_EXPOSURE)) {
+		MWRECT 		rc;
+		extern MWCLIPREGION *clipregion;
+
+		/* clip blit rectangle to source screen/bitmap size*/
+		if(srcx+width > srcpsd->xvirtres)
+			width = srcpsd->xvirtres - srcx;
+		if(srcy+height > srcpsd->yvirtres)
+			height = srcpsd->yvirtres - srcy;
+
+		rc.left = srcx;
+		rc.top = srcy;
+		rc.right = srcx + width;
+		rc.bottom = srcy + height;
+
+		/*
+		 * if source isn't entirely within clip region, then
+		 * the blit is partly obscured and will copy some garbage.
+		 * In this case, skip the blit, punt, and deliver an
+		 * exposure event instead for proper display.
+		 */
+		if (GdRectInRegion(clipregion, &rc) != MWRECT_ALLIN) {
+			GsDeliverExposureEvent(swp, dp->x+x, dp->y+y,
+				width, height);
+			return;
+		}
+	}
+#endif
+	/* perform blit*/
+	GdBlit(dp->psd, dp->x+x, dp->y+y, width, height, srcpsd, srcx, srcy,op);
+}
+
+
+/*
+ * Read the color values from the specified rectangular area of the
+ * specified drawable into a supplied buffer.  If the drawable is a
+ * window which is obscured by other windows, then the returned values
+ * will include the values from the covering windows.  Regions outside
+ * of the screen boundaries, or unmapped windows will return black.
+ */
+void
+PREFIX(GrReadArea)(GR_DRAW_ID id,GR_COORD x,GR_COORD y,GR_SIZE width,GR_SIZE height,
+	GR_PIXELVAL *pixels)
+{
+	GR_WINDOW	*wp;
+	GR_PIXMAP	*pp = NULL;
+
+	if ((wp = GsFindWindow(id)) == NULL && (pp = GsFindPixmap(id)) == NULL){
+		GsError(GR_ERROR_BAD_WINDOW_ID, id);
+		return;
+	}
+
+	if (wp != NULL) {
+		if (wp->unmapcount || (x >= wp->width) || (y >= wp->height) ||
+		   (x + width <= 0) || (y + height <= 0)) {
+			/* long		count;
+			* GR_PIXELVAL	black;
+			*
+			* black = GdFindColor(BLACK);
+			* count = width * height;
+			* while (count-- > 0)
+			*	*pixels++ = black;
+			*/
+			return;
+		}
+		GdReadArea(wp->psd, wp->x+x, wp->y+y, width, height, pixels);
+	}
+	if (pp != NULL) {
+		if ((x >= pp->width) || (y >= pp->height) ||
+		    (x + width <= 0) || (y + height <= 0)) {
+			return;
+		}
+		GdReadArea(pp->psd, x, y, width, height, pixels);
+	}
+}
+
+/*
+ * Draw a point in the specified drawable using the specified
+ * graphics context.
+ */
+void
+PREFIX(GrPoint)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdPoint(dp->psd, dp->x + x, dp->y + y);
+			break;
+	}
+}
+
+/*
+ * Draw points in the specified drawable using the specified
+ * graphics context.
+ */
+void
+PREFIX(GrPoints)(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable)
+{
+	GR_DRAWABLE	*dp;
+	GR_POINT	*pp;
+	GR_COUNT	i;
+        PSD 		psd;
+   
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+	                psd = dp->psd;
+	                break;
+		default:
+			return;
+	}
+
+	pp = pointtable;
+	for (i = count; i-- > 0; pp++) {
+		GdPoint(psd, pp->x + dp->x, pp->y + dp->y);
+	}
+}
+
+/*
+ * Draw a polygon in the specified drawable using the specified
+ * graphics context.  The polygon is only complete if the first
+ * point is repeated at the end.
+ */
+void
+PREFIX(GrPoly)(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable)
+{
+	GR_DRAWABLE	*dp;
+	GR_POINT	*pp;
+	GR_COUNT	i;
+        PSD 		psd;
+   
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+	                psd = dp->psd;
+	                break;
+		default:
+			return;
+	}
+
+	/*
+	 * Here for drawing to a window.
+	 * Relocate all the points relative to the window.
+	 */
+	pp = pointtable;
+	for (i = count; i-- > 0; pp++) {
+		pp->x += dp->x;
+		pp->y += dp->y;
+	}
+
+	GdPoly(psd, count, pointtable);
+
+#ifdef NONETWORK   
+	/*
+	 * The following is only necessary when the server
+	 * isn't a separate process.  We don't want to change the
+	 * user's arguments!
+	 */
+	pp = pointtable;
+	for (i = count; i-- > 0; pp++) {
+		pp->x -= dp->x;
+		pp->y -= dp->y;
+	}
+#endif
+}
+
+/*
+ * Draw a filled polygon in the specified drawable using the specified
+ * graphics context.  The last point may be a duplicate of the first
+ * point, but this is not required.
+ */
+void
+PREFIX(GrFillPoly)(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable)
+{
+	GR_DRAWABLE	*dp;
+	GR_POINT	*pp;
+	GR_COUNT	i;
+        PSD 		psd;
+   
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+	                psd = dp->psd;
+			break;
+		default:
+			return;
+	}
+
+	/*
+	 * Here for drawing to a window.
+	 * Relocate all the points relative to the window.
+	 */
+	pp = pointtable;
+	for (i = count; i-- > 0; pp++) {
+		pp->x += dp->x;
+		pp->y += dp->y;
+	}
+
+	GdFillPoly(psd, count, pointtable);
+
+#ifdef NONETWORK
+	/*
+	 * The following is only necessary when the server
+	 * isn't a separate process.  We don't want to change the
+	 * user's arguments!
+	 */
+	pp = pointtable;
+	for (i = count; i-- > 0; pp++) {
+		pp->x -= dp->x;
+		pp->y -= dp->y;
+	}
+#endif   
+}
+
+/*
+ * Draw a text string in the specified drawable using the
+ * specified graphics context.
+ */
+void
+PREFIX(GrText)(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, void *str,
+	GR_COUNT count, int flags)
+{
+	GR_DRAWABLE	*dp;
+
+	/* default to baseline alignment if none specified*/
+	if((flags&(MWTF_TOP|MWTF_BASELINE|MWTF_BOTTOM)) == 0)
+		flags |= MWTF_BASELINE;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdText(dp->psd, dp->x + x, dp->y + y, str, count,flags);
+			break;
+	}
+}
+
+/* Return the system palette entries*/
+void
+PREFIX(GrGetSystemPalette)(GR_PALETTE *pal)
+{
+	/* return 0 count if not in palettized mode*/
+	memset(pal, 0, sizeof(GR_PALETTE *));
+
+	if(rootwp->psd->pixtype == MWPF_PALETTE) {
+		pal->count = (int)rootwp->psd->ncolors;
+		GdGetPalette(rootwp->psd, 0, pal->count, pal->palette);
+	}
+}
+
+/* Set the system palette entries from first for count*/
+void
+PREFIX(GrSetSystemPalette)(GR_COUNT first, GR_PALETTE *pal)
+{
+	GdSetPalette(rootwp->psd, first, pal->count, pal->palette);
+	if (first == 0)
+		GsRedrawScreen();
+}
+
+/* Convert passed color value to pixel value, depending on system mode*/
+void
+PREFIX(GrFindColor)(GR_COLOR c, GR_PIXELVAL *retpixel)
+{
+	*retpixel = GdFindColor(c);
+}
+
+/* visible =0, no cursor change; =1, show; else hide*/
+void
+PREFIX(GrInjectPointerEvent)(GR_COORD x, GR_COORD y, int button, int visible)
+{
+	if (visible != 0) {
+		if (visible == 1)
+			GdShowCursor(&scrdev);
+		else
+			GdHideCursor(&scrdev);
+	}
+
+	GdMoveMouse(x, y);
+	GsHandleMouseStatus(x, y, button);
+}
+
+void
+PREFIX(GrInjectKeyboardEvent)(GR_WINDOW_ID wid, GR_KEY keyvalue, GR_KEYMOD modifiers,
+	GR_SCANCODE scancode, GR_BOOL pressed)
+{
+	/* create a keyboard event */
+	GsDeliverKeyboardEvent(wid,
+		pressed? GR_EVENT_TYPE_KEY_DOWN: GR_EVENT_TYPE_KEY_UP,
+		keyvalue, modifiers, scancode);
+}
+
+/*
+ * Set certain window properties, according to flags value
+ * passed in props.
+ */
+void
+PREFIX(GrSetWMProperties)(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props)
+{
+	GR_WINDOW *wp;
+	int tl = 0;    /* Initialized to avoid warning */
+
+	/* Find the window structure (generate an error if it doesn't exist) */
+	wp = GsFindWindow(wid);
+	if(!wp) {
+		GsError(GR_ERROR_BAD_WINDOW_ID, wid);
+		return;
+	}
+
+	/* Set window properties*/
+	if (props->flags & GR_WM_FLAGS_PROPS)
+		wp->props = props->props;
+
+	/* Set window title*/
+	if (props->flags & GR_WM_FLAGS_TITLE) {
+		/* Remove the old title if it exists */
+		if(wp->title)
+			free(wp->title);
+
+		/* Calculate the space needed to store the new title */
+		if(props->title)
+			tl = strlen(props->title) + 1;
+
+		/* Check for empty title*/
+		if(!props->title || tl == 1) {
+			wp->title = NULL;
+		} else {
+			/* Otherwise, allocate some space for the new title */
+			if(!(wp->title = malloc(tl)))
+				GsError(GR_ERROR_MALLOC_FAILED, wid);
+			else
+				memcpy(wp->title, props->title, tl);
+		}
+	}
+
+	/* Set window background*/
+	if (props->flags & GR_WM_FLAGS_BACKGROUND) {
+		if (wp->background != props->background) {
+			wp->background = props->background;
+			GsExposeArea(wp, wp->x, wp->y, wp->width, wp->height,
+				NULL);
+		}
+	}
+
+	/* Set window border size*/
+	if (props->flags & GR_WM_FLAGS_BORDERSIZE) {
+		if (wp->bordersize != props->bordersize) {
+			GsWpUnmapWindow(wp, GR_TRUE);
+			wp->bordersize = props->bordersize;
+			GsWpMapWindow(wp, GR_TRUE);
+		}
+	}
+
+	/* Set window border color*/
+	if (props->flags & GR_WM_FLAGS_BORDERCOLOR) {
+		if (wp->bordercolor != props->bordercolor) {
+			wp->bordercolor = props->bordercolor;
+			if (wp->bordersize) {
+				int bs = wp->bordersize;
+				GsExposeArea(wp, wp->x - bs, wp->y - bs,
+					wp->width + bs*2, wp->height + bs*2,
+					NULL);
+			}
+		}
+	}
+}
+
+/*
+ * Return all window properties
+ */
+void
+PREFIX(GrGetWMProperties)(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props)
+{
+	GR_WINDOW *wp;
+
+	/* Find the window structure, no error on invalid window id*/ 
+	wp = GsFindWindow(wid);
+	if(!wp) {
+		/* set flags to 0 on bad window id*/
+		memset(props, 0, sizeof(GR_WM_PROPERTIES));
+		return;
+	}
+
+	/* Return everything, regardless of props->flags*/
+	props->flags = GR_WM_FLAGS_PROPS | GR_WM_FLAGS_TITLE |
+		GR_WM_FLAGS_BACKGROUND | GR_WM_FLAGS_BORDERSIZE |
+		GR_WM_FLAGS_BORDERCOLOR;
+	props->props = wp->props;
+	props->title = wp->title;
+	props->background = wp->background;
+	props->bordersize = wp->bordersize;
+	props->bordercolor = wp->bordercolor;
+}
+
+void
+PREFIX(GrCloseWindow)(GR_WINDOW_ID wid)
+{
+	GR_WINDOW *wp;
+
+	/* Find the window structure (generate an error if it doesn't exist) */
+	wp = GsFindWindow(wid);
+	if(!wp) {
+		/* 
+		 * no error for now, client/server problems
+		 * with nxwm when sent
+		 */
+		/*GsError(GR_ERROR_BAD_WINDOW_ID, wid);*/
+		return;
+	}
+
+	/* Send a CLOSE_REQ event to the client */
+	GsDeliverGeneralEvent(wp, GR_EVENT_TYPE_CLOSE_REQ, NULL);
+}
+
+void
+PREFIX(GrKillWindow)(GR_WINDOW_ID wid)
+{
+	GR_WINDOW *wp;
+
+	/* Find the window structure (generate an error if it doesn't exist) */
+	wp = GsFindWindow(wid);
+	if(!wp) {
+		GsError(GR_ERROR_BAD_WINDOW_ID, wid);
+		return;
+	}
+
+	/* Forcibly kill the connection to the client */
+	GsClose(wp->owner->id);
+}
+
+/*
+ * GrGetSystemColor color scheme definitions
+ */ 
+/* define color scheme: A (tan), B (winstd) or C (old)*/
+#define A
+
+#define A_RGB(r,g,b)
+#define B_RGB(r,g,b)
+#define C_RGB(r,g,b)
+
+#ifdef A
+#undef  A_RGB
+#define A_RGB(r,g,b)	GR_RGB(r,g,b),
+#endif
+#ifdef B
+#undef  B_RGB
+#define B_RGB(r,g,b)	GR_RGB(r,g,b),
+#endif
+#ifdef C
+#undef  C_RGB
+#define C_RGB(r,g,b)	GR_RGB(r,g,b),
+#endif
+
+#define MAXSYSCOLORS	20	/* # of GR_COLOR_* system colors*/
+
+static GR_COLOR sysColors[MAXSYSCOLORS] = {
+	/* desktop background*/
+	GR_RGB(  0, 128, 128),  /* GR_COLOR_DESKTOP             */
+
+	/* caption colors*/
+	A_RGB(128,   0,   0)	/* GR_COLOR_ACTIVECAPTION       */
+	B_RGB(128,   0, 128)	/* GR_COLOR_ACTIVECAPTION       */
+	C_RGB(128,   0, 128)	/* GR_COLOR_ACTIVECAPTION       */
+	GR_RGB(255, 255, 255),  /* GR_COLOR_ACTIVECAPTIONTEXT   */
+	A_RGB(162, 141, 104)	/* GR_COLOR_INACTIVECAPTION     */
+	B_RGB(128, 128, 128)  	/* GR_COLOR_INACTIVECAPTION     */
+	C_RGB(  0,  64, 128)	/* GR_COLOR_INACTIVECAPTION     */
+	GR_RGB(192, 192, 192),  /* GR_COLOR_INACTIVECAPTIONTEXT */
+
+	/* 3d border shades*/
+	GR_RGB(  0,   0,   0),  /* GR_COLOR_WINDOWFRAME         */
+	A_RGB(162, 141, 104)	/* GR_COLOR_BTNSHADOW           */
+	B_RGB(128, 128, 128)	/* GR_COLOR_BTNSHADOW           */
+	C_RGB(128, 128, 128)	/* GR_COLOR_BTNSHADOW           */
+	A_RGB(213, 204, 187)	/* GR_COLOR_3DLIGHT             */
+	B_RGB(223, 223, 223)	/* GR_COLOR_3DLIGHT             */
+	C_RGB(192, 192, 192)	/* GR_COLOR_3DLIGHT             */
+	A_RGB(234, 230, 221)  	/* GR_COLOR_BTNHIGHLIGHT        */
+	B_RGB(255, 255, 255)  	/* GR_COLOR_BTNHIGHLIGHT        */
+	C_RGB(223, 223, 223)  	/* GR_COLOR_BTNHIGHLIGHT        */
+
+	/* top level application window backgrounds/text*/
+	A_RGB(213, 204, 187)	/* GR_COLOR_APPWINDOW           */
+	B_RGB(192, 192, 192)	/* GR_COLOR_APPWINDOW           */
+	C_RGB(160, 160, 160)	/* GR_COLOR_APPWINDOW           */
+	GR_RGB(  0,   0,   0),  /* GR_COLOR_APPTEXT             */
+
+	/* button control backgrounds/text (usually same as app window colors)*/
+	A_RGB(213, 204, 187)	/* GR_COLOR_BTNFACE             */
+	B_RGB(192, 192, 192)	/* GR_COLOR_BTNFACE             */
+	C_RGB(160, 160, 160)	/* GR_COLOR_BTNFACE             */
+	GR_RGB(  0,   0,   0),  /* GR_COLOR_BTNTEXT             */
+
+	/* edit/listbox control backgrounds/text, selected highlights*/
+	GR_RGB(255, 255, 255),  /* GR_COLOR_WINDOW              */
+	GR_RGB(  0,   0,   0),  /* GR_COLOR_WINDOWTEXT          */
+	GR_RGB(128,   0,   0),  /* GR_COLOR_HIGHLIGHT           */
+	GR_RGB(255, 255, 255),  /* GR_COLOR_HIGHLIGHTTEXT       */
+	GR_RGB( 64,  64,  64),  /* GR_COLOR_GRAYTEXT            */
+
+	/* menu backgrounds/text*/
+	A_RGB(213, 204, 187)	/* GR_COLOR_MENU                */
+	B_RGB(192, 192, 192)	/* GR_COLOR_MENU                */
+	C_RGB(160, 160, 160)	/* GR_COLOR_MENU                */
+	GR_RGB(  0,   0,   0),  /* GR_COLOR_MENUTEXT            */
+};
+
+/* Return system-defined color*/
+GR_COLOR
+PREFIX(GrGetSysColor)(int index)
+{
+	if(index >= 0 && index < MAXSYSCOLORS)
+		return sysColors[index];
+	return 0;
+}
+void
+PREFIX(GrSetScreenSaverTimeout)(GR_TIMEOUT timeout)
+{
+#if !ECOS
+
+	MWTIMER *timer;
+
+	screensaver_delay = timeout * 1000;
+
+	if((timer = GdFindTimer(GsActivateScreenSaver))) GdDestroyTimer(timer);
+
+	GdAddTimer(screensaver_delay, GsActivateScreenSaver,
+					GsActivateScreenSaver);
+#endif
+}
+void
+PREFIX(GrSetSelectionOwner)(GR_WINDOW_ID wid, GR_CHAR *typelist)
+{
+	GR_WINDOW_ID oldwid = selection_owner.wid;
+
+	if(selection_owner.typelist) free(selection_owner.typelist);
+
+	selection_owner.wid = wid;
+
+	if(wid) {
+		if(!(selection_owner.typelist = strdup(typelist))) {
+			GsError(GR_ERROR_MALLOC_FAILED, wid);
+			selection_owner.wid = 0;
+		}
+	} else selection_owner.typelist = NULL;
+
+	GsDeliverSelectionChangedEvent(oldwid, wid);
+}
+
+GR_WINDOW_ID
+PREFIX(GrGetSelectionOwner)(GR_CHAR **typelist)
+{
+	*typelist = selection_owner.typelist;
+	return selection_owner.wid;
+}
+
+void
+PREFIX(GrRequestClientData)(GR_WINDOW_ID wid, GR_WINDOW_ID rid, GR_SERIALNO serial,
+							GR_MIMETYPE mimetype)
+{
+	GsDeliverClientDataReqEvent(rid, wid, serial, mimetype);
+}
+
+void
+PREFIX(GrSendClientData)(GR_WINDOW_ID wid, GR_WINDOW_ID did, GR_SERIALNO serial,
+				GR_LENGTH len, GR_LENGTH thislen, void *data)
+{
+	void *p;
+
+	if(!(p = malloc(len))) GsError(GR_ERROR_MALLOC_FAILED, wid);
+	memcpy(p, data, thislen);
+
+	GsDeliverClientDataEvent(did, wid, serial, len, thislen, p);
+}
+
+/*
+ * Set a window's background pixmap.  Note that this doesn't
+ * cause a screen refresh, use GrClearWindow if required.
+ */
+void
+PREFIX(GrSetBackgroundPixmap)(GR_WINDOW_ID wid, GR_WINDOW_ID pixmap, int flags)
+{
+	GR_WINDOW *wp;
+	GR_PIXMAP *pp = NULL;
+
+	if (!(wp = GsFindWindow(wid))) {
+		GsError(GR_ERROR_BAD_WINDOW_ID, wid);
+		return;
+	}
+
+	if (pixmap && !(pp = GsFindPixmap(pixmap))) {
+		GsError(GR_ERROR_BAD_WINDOW_ID, pixmap);
+		return;
+	}
+	wp->bgpixmap = pp;
+	wp->bgpixmapflags = flags;
+}
diff -urN lib/microwindows/src/nanox/srvfunc.c.orig /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvfunc.c.orig
--- lib/microwindows/src/nanox/srvfunc.c.orig	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvfunc.c.orig	2005-02-21 16:13:35.000000000 +0100
@@ -0,0 +1,2619 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 2000 Alex Holden <alex@linuxhacker.org>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define MWINCLUDECOLORS
+#include "serv.h"
+
+static int	nextid = GR_ROOT_WINDOW_ID + 1;
+
+static void CheckNextEvent(GR_EVENT *ep, GR_BOOL doSelect);
+
+/*
+ * Return information about the screen for clients to use.
+ */
+void 
+GrGetScreenInfo(GR_SCREEN_INFO *sip)
+{
+	GdGetScreenInfo(rootwp->psd, sip);
+
+	/* virtual/workspace screen sizing*/
+#if 0
+	/* force small screen for emulation purposes*/
+	sip->vs_width = 240;	/* PDA*/
+	sip->vs_height = 320;
+	sip->ws_width = 240;
+	sip->ws_height = 298;
+#else
+	/* set workspace equal to screen area minus 22 pixel taskbar*/
+	sip->vs_width = sip->cols;
+	sip->vs_height = sip->rows;
+	sip->ws_width = sip->cols;
+	sip->ws_height = sip->rows - 22;
+#endif
+}
+
+/*
+ * Return the size of a text string for the font in a graphics context.
+ * This is the width of the string, the height of the string,
+ * and the height above the bottom of the font of the baseline for the font.
+ */
+void 
+GrGetGCTextSize(GR_GC_ID gc, void *str, int count, int flags,
+	GR_SIZE *retwidth, GR_SIZE *retheight, GR_SIZE *retbase)
+{
+	GR_GC		*gcp;
+	GR_FONT		*fontp;
+	PMWFONT		pf;
+
+	gcp = GsFindGC(gc);
+	if (gcp == NULL)
+		fontp = NULL;
+	else
+		fontp = GsFindFont(gcp->fontid);
+	pf = fontp? fontp->pfont: stdfont;
+	GdGetTextSize(pf, str, count, retwidth, retheight, retbase, flags);
+}
+
+#if NONETWORK
+/*
+ * Return the next waiting event for a client, or wait for one if there
+ * is none yet.  The event is copied into the specified structure, and
+ * then is moved from the event queue to the free event queue.  If there
+ * is an error event waiting, it is delivered before any other events.
+ */
+void
+GrGetNextEvent(GR_EVENT *ep)
+{
+	GrGetNextEventTimeout(ep, 0L);
+}
+
+/*
+ * Return the next event from the event queue, or
+ * wait for a new one if one is not ready.  If timeout
+ * is nonzero, return timeout event if time elapsed.
+ */
+void
+GrGetNextEventTimeout(GR_EVENT *ep, GR_TIMEOUT timeout)
+{
+	/* If no event ready, wait for one*/
+	/* Note: won't work for multiple clients*/
+	/* This is OK, since only static linked apps call this function*/
+	while(curclient->eventhead == NULL)
+		GsSelect(timeout);
+	CheckNextEvent(ep, GR_FALSE);
+}
+#endif
+
+/*
+ * Return the next event from the event queue if one is ready.
+ * If one is not ready, then the type GR_EVENT_TYPE_NONE is returned.
+ * If it is an error event, then a user-specified routine is called
+ * if it was defined, otherwise we clean up and exit.
+ */
+void
+GrCheckNextEvent(GR_EVENT *ep)
+{
+	CheckNextEvent(ep, GR_TRUE);
+}
+
+static void
+CheckNextEvent(GR_EVENT *ep, GR_BOOL doSelect)
+{
+	GR_EVENT_LIST *	elp;
+
+#if NONETWORK
+	/* Since we're bound to server, select() is only called 
+	 * thru here
+	 */
+	if(doSelect)
+		GsSelect(0L);
+#endif
+	/* Copy first event if any*/
+	if(!GrPeekEvent(ep))
+		return;
+
+	/* Get first event again*/
+	elp = curclient->eventhead;
+
+	/* Remove first event from queue*/
+	curclient->eventhead = elp->next;
+	if (curclient->eventtail == elp)
+		curclient->eventtail = NULL;
+
+	elp->next = eventfree;
+	eventfree = elp;
+}
+
+/*
+ * Peek at the event queue for the current client to see if there are any
+ * outstanding events.  Returns the event at the head of the queue, or
+ * else a null event type.  The event is still left in the queue, however.
+ */
+int
+GrPeekEvent(GR_EVENT *ep)
+{
+	GR_EVENT_LIST *	elp;
+
+	elp = curclient->eventhead;
+	if(elp == NULL) {
+		ep->type = GR_EVENT_TYPE_NONE;
+		return 0;
+	}
+
+	/* copy event out*/
+	*ep = elp->event;
+	return 1;
+}
+
+/*
+ * Return information about a window id.
+ */
+void
+GrGetWindowInfo(GR_WINDOW_ID wid, GR_WINDOW_INFO *infoptr)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_PIXMAP	*pp;
+	GR_EVENT_CLIENT	*evp;		/* event-client structure */
+
+	/* first check window list*/
+	wp = GsFindWindow(wid);
+	if (wp) {
+		infoptr->wid = wid;
+		infoptr->x = wp->x;
+		infoptr->y = wp->y;
+		infoptr->width = wp->width;
+		infoptr->height = wp->height;
+		infoptr->parent = wp->parent? wp->parent->id: 0;
+		infoptr->child = wp->children? wp->children->id: 0;
+		infoptr->sibling = wp->siblings? wp->siblings->id: 0;
+		infoptr->mapped = wp->mapped;
+		infoptr->unmapcount = wp->unmapcount;
+		infoptr->inputonly = !wp->output;
+		infoptr->bordersize = wp->bordersize;
+		infoptr->bordercolor = wp->bordercolor;
+		infoptr->background = wp->background;
+		infoptr->props = wp->props;
+		infoptr->eventmask = 0;
+
+		for (evp = wp->eventclients; evp; evp = evp->next) {
+			if (evp->client == curclient)
+				infoptr->eventmask = evp->eventmask;
+		}
+		return;
+	}
+
+	/* then pixmap list*/
+	pp = GsFindPixmap(wid);
+	if (pp) {
+		infoptr->wid = wid;
+		infoptr->x = pp->x;
+		infoptr->y = pp->y;
+		infoptr->width = pp->width;
+		infoptr->height = pp->height;
+		infoptr->parent = 0;
+		infoptr->child = 0;
+		infoptr->sibling = 0;
+		infoptr->mapped = GR_FALSE;
+		infoptr->unmapcount = 0;
+		infoptr->inputonly = GR_FALSE;
+		infoptr->bordersize = 0;
+		infoptr->bordercolor = 0;
+		infoptr->background = 0;
+		infoptr->eventmask = 0;
+		return;
+	}
+
+	/* No error if window id is invalid.*/
+	memset(infoptr, 0, sizeof(GR_WINDOW_INFO));
+}
+
+/*
+ * Destroy an existing window and all of its children.
+ * Also used to destroy a pixmap.
+ */
+void
+GrDestroyWindow(GR_WINDOW_ID wid)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_PIXMAP	*pp;
+	GR_PIXMAP	*prevpp;
+	PSD		psd;
+
+	wp = GsFindWindow(wid);
+	if (wp) {
+		GsWpDestroyWindow(wp);
+	} else {
+		pp = GsFindPixmap(wid);
+		if (pp) {
+			psd = pp->psd;
+			/* deallocate pixmap memory*/
+			if (psd->flags & PSF_ADDRMALLOC)
+				free(psd->addr);
+
+			/* deallocate mem gc*/
+			psd->FreeMemGC(psd);
+
+			/*
+			 * Remove this pixmap from the complete list of pixmaps.
+			 */
+			prevpp = listpp;
+			if (prevpp == pp)
+				listpp = pp->next;
+			else {
+				while (prevpp->next != pp)
+					prevpp = prevpp->next;
+				prevpp->next = pp->next;
+			}
+
+			/*
+			 * Forget various information if they related to this
+			 * pixmap.  Then finally free the structure.
+			 */
+			if (pp == cachepp) {
+				cachepixmapid = 0;
+				cachepp = NULL;
+			}
+			free(pp);
+		}
+	}
+}
+
+
+/*
+ * Raise a window to the highest level among its siblings.
+ */
+void
+GrRaiseWindow(GR_WINDOW_ID wid)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_WINDOW	*prevwp;	/* previous window pointer */
+	GR_BOOL		overlap;	/* TRUE if there was overlap */
+
+	wp = GsFindWindow(wid);
+	if ((wp == NULL) || (wp == rootwp))
+		return;
+
+	/*
+	 * If this is already the highest window then we are done.
+	 */
+	prevwp = wp->parent->children;
+	if (prevwp == wp)
+		return;
+
+	/*
+	 * Find the sibling just before this window so we can unlink it.
+	 * Also, determine if any sibling ahead of us overlaps the window.
+	 * Remember that for exposure events.
+	 */
+	overlap = GR_FALSE;
+	while (prevwp->siblings != wp) {
+		overlap |= GsCheckOverlap(prevwp, wp);
+		prevwp = prevwp->siblings;
+	}
+	overlap |= GsCheckOverlap(prevwp, wp);
+
+	/*
+	 * Now unlink the window and relink it in at the front of the
+	 * sibling chain.
+	 */
+	prevwp->siblings = wp->siblings;
+	wp->siblings = wp->parent->children;
+	wp->parent->children = wp;
+
+	/*
+	 * Finally redraw the window if necessary.
+	 */
+	if (overlap) {
+		GsDrawBorder(wp);
+		GsExposeArea(wp, wp->x, wp->y, wp->width, wp->height, NULL);
+	}
+}
+
+/*
+ * Lower a window to the lowest level among its siblings.
+ */
+void GrLowerWindow(GR_WINDOW_ID wid)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_WINDOW	*prevwp;	/* previous window pointer */
+	GR_WINDOW	*sibwp;		/* sibling window */
+	GR_WINDOW	*expwp;		/* siblings being exposed */
+
+	wp = GsFindWindow(wid);
+	if ((wp == NULL) || (wp == rootwp))
+		return;
+	if (wp->siblings == NULL)
+		return;
+
+	/*
+	 * Find the sibling just before this window so we can unlink us.
+	 */
+	prevwp = wp->parent->children;
+	if (prevwp != wp) {
+		while (prevwp->siblings != wp)
+			prevwp = prevwp->siblings;
+	}
+
+	/*
+	 * Remember the first sibling that is after us, so we can
+	 * generate exposure events for the remaining siblings.  Then
+	 * walk down the sibling chain looking for the last sibling.
+	 */
+	expwp = wp->siblings;
+	sibwp = wp;
+	while (sibwp->siblings)
+		sibwp = sibwp->siblings;
+
+	/*
+	 * Now unlink the window and relink it in at the end of the
+	 * sibling chain.
+	 */
+	if (prevwp == wp)
+		wp->parent->children = wp->siblings;
+	else
+		prevwp->siblings = wp->siblings;
+	sibwp->siblings = wp;
+
+	wp->siblings = NULL;
+
+	/*
+	 * Finally redraw the sibling windows which this window covered
+	 * if they overlapped our window.
+	 */
+	while (expwp && (expwp != wp)) {
+		if (GsCheckOverlap(wp, expwp)) {
+			GsExposeArea(expwp, wp->x - wp->bordersize,
+				wp->y - wp->bordersize,
+				wp->width + wp->bordersize * 2,
+				wp->height + wp->bordersize * 2, NULL);
+		}
+		expwp = expwp->siblings;
+	}
+}
+
+/* Offset a window position and all children by offx,offy*/
+static void
+OffsetWindow(GR_WINDOW *wp, GR_COORD offx, GR_COORD offy)
+{
+	GR_WINDOW	*cp;
+
+	wp->x += offx;
+	wp->y += offy;
+	for(cp=wp->children; cp; cp=cp->siblings)
+		OffsetWindow(cp, offx, offy);
+}
+
+/* deliver an update move event to window and all children*/
+static void
+DeliverUpdateMoveEventAndChildren(GR_WINDOW *wp)
+{
+	GR_WINDOW *	childwp;
+
+	GsDeliverUpdateEvent(wp, GR_UPDATE_MOVE, wp->x, wp->y,
+		wp->width, wp->height);
+
+	for (childwp = wp->children; childwp; childwp = childwp->siblings)
+		DeliverUpdateMoveEventAndChildren(childwp);
+}
+
+/*
+ * Move the window to the specified position relative to its parent.
+ */
+void
+GrMoveWindow(GR_WINDOW_ID wid, GR_COORD x, GR_COORD y)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_COORD	offx, offy;
+
+	wp = GsFindWindow(wid);
+	if (wp == NULL)
+		return;
+	if (wp == rootwp) {
+		GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wid);
+		return;
+	}
+
+	x += wp->parent->x;
+	y += wp->parent->y;
+	offx = x - wp->x;
+	offy = y - wp->y;
+
+	if (wp->x == x && wp->y == y)
+		return;
+
+	/*** move algorithms not requiring unmap/map ***/
+#if 1
+	/* perform screen blit if topmost and mapped - no flicker!*/
+	if (wp->mapped && wp == wp->parent->children
+		&& wp->parent->id == GR_ROOT_WINDOW_ID) {
+		int 		oldx = wp->x;
+		int 		oldy = wp->y;
+		GR_WINDOW_ID 	pixid = GrNewPixmap(wp->width, wp->height,NULL);
+		GR_GC_ID	gc = GrNewGC();
+		GR_WINDOW * 	stopwp = wp;
+		int		X, Y, W, H;
+
+		/* must hide cursor first or GdFixCursor() will show it*/
+		GdHideCursor(rootwp->psd);
+
+		/* turn off clipping of root's children*/
+		GrSetGCMode(gc, GR_MODE_SET|GR_MODE_EXCLUDECHILDREN);
+
+		/* copy topmost window contents offscreen*/
+		GrCopyArea(pixid, gc, 0, 0, wp->width, wp->height,
+			GR_ROOT_WINDOW_ID, oldx, oldy, MWROP_SRCCOPY);
+
+		/* calc new window offsets*/
+		OffsetWindow(wp, offx, offy);
+
+		/* force recalc of clip region*/
+		clipwp = NULL;
+
+		/* copy window bits to new location*/
+		GrCopyArea(GR_ROOT_WINDOW_ID, gc, wp->x, wp->y, wp->width,
+			wp->height, pixid, 0, 0, MWROP_SRCCOPY);
+
+		/*
+		 * If any portion of the window was offscreen
+		 * and is coming onscreen, must send expose events
+		 * to this window as well.
+		 */
+		if ((oldx < 0 && wp->x > oldx) ||
+		    (oldy < 0 && wp->y > oldy) ||
+		    (oldx+wp->width > rootwp->width && wp->x < oldx) ||
+		    (oldy+wp->height > rootwp->height && wp->y < oldy))
+			stopwp = NULL;
+
+		/* 
+		 * Calculate bounded exposed area and
+		 * redraw anything lower than stopwp window.
+		 */
+		X = MWMIN(oldx, wp->x);
+		Y = MWMIN(oldy, wp->y);
+		W = MWMAX(oldx, wp->x) + wp->width - X;
+		H = MWMAX(oldy, wp->y) + wp->height - Y;
+		GsExposeArea(rootwp, X, Y, W, H, stopwp);
+
+		GdShowCursor(rootwp->psd);
+		GrDestroyGC(gc);
+		GrDestroyWindow(pixid);
+		DeliverUpdateMoveEventAndChildren(wp);
+		return;
+	}
+#endif
+#if 0
+	/* perform quick move and expose if topmost and mapped - no blit*/
+	if (wp->mapped && wp == wp->parent->children) {
+		int	oldx = wp->x;
+		int	oldy = wp->y;
+		int	X, Y, W, H;
+
+		OffsetWindow(wp, offx, offy);
+
+		/* force recalc of clip region*/
+		clipwp = NULL;
+
+		X = MWMIN(oldx, wp->x);
+		Y = MWMIN(oldy, wp->y);
+		W = MWMAX(oldx, wp->x) + wp->width - X;
+		H = MWMAX(oldy, wp->y) + wp->height - Y;
+		GsExposeArea(rootwp, X, Y, W, H, NULL);
+		DeliverUpdateMoveEventAndChildren(wp);
+		return;
+	}
+#endif
+	/*
+	 * This method will redraw the window entirely,
+	 * resulting in considerable flicker.
+	 */
+	GsWpUnmapWindow(wp, GR_TRUE);
+	OffsetWindow(wp, offx, offy);
+	GsWpMapWindow(wp, GR_FALSE);
+	DeliverUpdateMoveEventAndChildren(wp);
+}
+
+/*
+ * Resize the window to be the specified size.
+ */
+void
+GrResizeWindow(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height)
+{
+	GR_WINDOW	*wp;		/* window structure */
+
+	wp = GsFindWindow(wid);
+	if (wp == NULL)
+		return;
+	if (wp == rootwp) {
+		GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wid);
+		return;
+	}
+	if ((width <= 0) || (height <= 0)) {
+		GsError(GR_ERROR_BAD_WINDOW_SIZE, wid);
+		return;
+	}
+
+	if ((wp->width == width) && (wp->height == height))
+		return;
+
+	if (wp->unmapcount || !wp->output) {
+		wp->width = width;
+		wp->height = height;
+		return;
+	}
+
+	/*
+	 * This should be optimized to not require redrawing of the window
+	 * when possible.
+	 */
+	GsWpUnmapWindow(wp, GR_TRUE);
+	wp->width = width;
+	wp->height = height;
+	GsWpMapWindow(wp, GR_FALSE);
+	GsDeliverUpdateEvent(wp, GR_UPDATE_SIZE, wp->x, wp->y, width, height);
+}
+
+/*
+ * Reparent window to new parent, position at passed x, y
+ *
+ * NOTE: currently, the new parent must be mapped before
+ * reparenting, or the children of the newly parented window
+ * will have bad unmapcount values due to the GrMapWindow
+ * being called on the parent afterwards, and chaining down
+ * through the children.
+ */
+void
+GrReparentWindow(GR_WINDOW_ID wid, GR_WINDOW_ID pwid, GR_COORD x, GR_COORD y)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_WINDOW	*pwp;		/* parent window structure */
+	GR_WINDOW	**mysibptr;	/* handle to my sibling ptr */
+	GR_COORD	offx, offy;
+
+	wp = GsFindWindow(wid);
+	pwp = GsFindWindow(pwid);
+	if (wp == NULL || pwp == NULL || wp == pwp)
+		return;
+	if (wp == rootwp) {
+		GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wid);
+		return;
+	}
+
+	x += pwp->x;
+	y += pwp->y;
+	offx = x - wp->x;
+	offy = y - wp->y;
+
+	GsWpUnmapWindow(wp, GR_TRUE);
+	for(mysibptr = &(wp->parent->children); *mysibptr != wp; 
+		mysibptr = &((*mysibptr)->siblings))
+			continue;
+	*mysibptr = wp->siblings;
+	wp->parent = pwp;
+	wp->siblings = pwp->children;
+	pwp->children = wp;
+	OffsetWindow(wp, offx, offy);
+	GsWpMapWindow(wp, GR_FALSE);
+}
+
+static int nextgcid = 1000;
+/*
+ * Allocate a new GC with default parameters.
+ * The GC is owned by the current client.
+ */
+GR_GC_ID 
+GrNewGC(void)
+{
+	GR_GC	*gcp;
+
+	gcp = (GR_GC *) malloc(sizeof(GR_GC));
+	if (gcp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		return 0;
+	}
+
+	gcp->id = nextgcid++;
+	gcp->mode = GR_MODE_SET;
+	gcp->regionid = 0;	/* no region*/
+	gcp->fontid = 0;	/* 0 is default font*/
+	gcp->foreground = WHITE;
+	gcp->background = BLACK;
+	gcp->usebackground = GR_TRUE;
+	gcp->changed = GR_TRUE;
+	gcp->owner = curclient;
+	gcp->next = listgcp;
+
+	listgcp = gcp;
+
+	return gcp->id;
+}
+
+/*
+ * Destroy an existing graphics context.
+ */
+void
+GrDestroyGC(GR_GC_ID gc)
+{
+	GR_GC		*gcp;		/* graphics context */
+	GR_GC		*prevgcp;	/* previous graphics context */
+
+	gcp = GsFindGC(gc);
+	if (gcp == NULL)
+		return;
+
+	if (gc == cachegcid) {
+		cachegcid = 0;
+		cachegcp = NULL;
+	}
+	if (gcp == curgcp)
+		curgcp = NULL;
+
+	if (listgcp == gcp)
+		listgcp = gcp->next;
+	else {
+		prevgcp = listgcp;
+		while (prevgcp->next != gcp)
+			prevgcp = prevgcp->next;
+
+		prevgcp->next = gcp->next;
+	}
+	free(gcp);
+}
+
+/*
+ * Allocate a new GC which is a copy of another one.
+ * The GC is owned by the current client.
+ */
+GR_GC_ID 
+GrCopyGC(GR_GC_ID gc)
+{
+	GR_GC		*oldgcp;	/* old graphics context */
+	GR_GC		*gcp;		/* new graphics context */
+
+	oldgcp = GsFindGC(gc);
+	if (oldgcp == NULL)
+		return 0;
+
+	gcp = (GR_GC *) malloc(sizeof(GR_GC));
+	if (gcp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		return 0;
+	}
+
+	/*
+	 * Copy all the old gcp values into the new one, except allocate
+	 * a new id for it and link it into the list of GCs.
+	 */
+	*gcp = *oldgcp;
+	gcp->id = nextgcid++;
+	gcp->changed = GR_TRUE;
+	gcp->owner = curclient;
+	gcp->next = listgcp;
+	listgcp = gcp;
+
+	return gcp->id;
+}
+
+/*
+ * Return information about the specified graphics context.
+ */
+void 
+GrGetGCInfo(GR_GC_ID gcid, GR_GC_INFO *gcip)
+{
+	GR_GC		*gcp;
+
+	/*
+	 * Find the GC manually so that an error is not generated.
+	 */
+	for (gcp = listgcp; gcp && (gcp->id != gcid); gcp = gcp->next)
+		continue;
+
+	if (gcp == NULL) {
+		memset(gcip, 0, sizeof(GR_GC_INFO));
+		return;
+	}
+
+	gcip->gcid = gcid;
+	gcip->mode = gcp->mode;
+	gcip->region = gcp->regionid;
+	gcip->font = gcp->fontid;
+	gcip->foreground = gcp->foreground;
+	gcip->background = gcp->background;
+	gcip->usebackground = gcp->usebackground;
+}
+
+static int nextregionid = 1000;
+/*
+ * Allocate a new REGION with default parameters.
+ * The REGION is owned by the current client.
+ */
+GR_REGION_ID
+GrNewRegion(void)
+{
+	GR_REGION *regionp;
+           
+	regionp = (GR_REGION *) malloc(sizeof(GR_REGION));
+	if (regionp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		return 0;
+	}
+	
+	regionp->rgn = GdAllocRegion();
+	regionp->id = nextregionid++;
+	regionp->owner = curclient;
+	regionp->next = listregionp;
+
+	listregionp = regionp;
+	return regionp->id;
+}
+
+/*
+ * Allocate a new region from a set of points interpreted as a polygon.
+ * The REGION is owned by the current client.
+ */
+GR_REGION_ID
+GrNewPolygonRegion(int mode, GR_COUNT count, GR_POINT *points)
+{
+#if POLYREGIONS
+	GR_REGION *regionp;
+           
+	regionp = (GR_REGION *) malloc(sizeof(GR_REGION));
+	if (regionp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		return 0;
+	}
+	
+	regionp->rgn = GdAllocPolygonRegion(points, count, mode);
+	regionp->id = nextregionid++;
+	regionp->owner = curclient;
+	regionp->next = listregionp;
+
+	listregionp = regionp;
+	return regionp->id;
+#else
+	return 0;
+#endif
+}
+
+/*
+ * Destroy an existing region.
+ */
+void
+GrDestroyRegion(GR_REGION_ID region)
+{
+	GR_REGION	*regionp;	/* region */
+	GR_REGION	*prevregionp;	/* previous region */
+
+	regionp = GsFindRegion(region);
+	if (regionp == NULL)
+		return;
+
+	if (listregionp == regionp)
+		listregionp = regionp->next;
+	else {
+		prevregionp = listregionp;
+		while (prevregionp->next != regionp)
+			prevregionp = prevregionp->next;
+
+		prevregionp->next = regionp->next;
+	}
+	GdDestroyRegion(regionp->rgn);
+	free(regionp);
+}
+
+/*
+ * Updates the region from a union of the specified rectangle
+ * and the original region.
+ */
+void
+GrUnionRectWithRegion(GR_REGION_ID region, GR_RECT *rect)
+{
+	GR_REGION	*regionp;
+	MWRECT		rc;
+	
+	regionp = GsFindRegion(region);
+	if (regionp) {
+		/* convert Nano-X rect to MW rect*/
+		rc.left = rect->x;
+		rc.top = rect->y;
+		rc.right = rect->x + rect->width;
+		rc.bottom = rect->y + rect->height;
+		GdUnionRectWithRegion(&rc, regionp->rgn);	
+	}
+}
+
+/*
+ * Updates the region from a union of two regions.
+ */ 
+void
+GrUnionRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	GR_REGION	*regionp;
+	GR_REGION	*srcregionp1;
+	GR_REGION	*srcregionp2;
+	
+	regionp = GsFindRegion(dst_rgn);
+	if (regionp == NULL)
+		return;
+	
+	srcregionp1 = GsFindRegion(src_rgn1);
+	if (srcregionp1 == NULL)
+		return;
+	
+	srcregionp2 = GsFindRegion(src_rgn2);
+	if (srcregionp2 == NULL)
+		return;
+	
+	GdUnionRegion(regionp->rgn, srcregionp1->rgn, srcregionp2->rgn);
+}
+
+/*
+ * Updates the region by subtracting a region from another.
+ */ 
+void
+GrSubtractRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	GR_REGION	*regionp;
+	GR_REGION	*srcregionp1;
+	GR_REGION	*srcregionp2;
+	
+	regionp = GsFindRegion(dst_rgn);
+	if (regionp == NULL)
+		return;
+	
+	srcregionp1 = GsFindRegion(src_rgn1);
+	if (srcregionp1 == NULL)
+		return;
+	
+	srcregionp2 = GsFindRegion(src_rgn2);
+	if (srcregionp2 == NULL)
+		return;
+	
+	GdSubtractRegion(regionp->rgn, srcregionp1->rgn, srcregionp2->rgn);
+}
+
+/*
+ * Updates the region to the difference of two regions.
+ */ 
+void
+GrXorRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	GR_REGION	*regionp;
+	GR_REGION	*srcregionp1;
+	GR_REGION	*srcregionp2;
+	
+	regionp = GsFindRegion(dst_rgn);
+	if (regionp == NULL)
+		return;
+	
+	srcregionp1 = GsFindRegion(src_rgn1);
+	if (srcregionp1 == NULL)
+		return;
+	
+	srcregionp2 = GsFindRegion(src_rgn2);
+	if (srcregionp2 == NULL)
+		return;
+	
+	GdXorRegion(regionp->rgn, srcregionp1->rgn, srcregionp2->rgn);
+}
+
+/*
+ * Updates the region from a intersection of two regions.
+ */ 
+void
+GrIntersectRegion(GR_REGION_ID dst_rgn, GR_REGION_ID src_rgn1,
+	GR_REGION_ID src_rgn2)
+{
+	GR_REGION	*regionp;
+	GR_REGION	*srcregionp1;
+	GR_REGION	*srcregionp2;
+	
+	regionp = GsFindRegion(dst_rgn);
+	if (regionp == NULL)
+		return;
+	
+	srcregionp1 = GsFindRegion(src_rgn1);
+	if (srcregionp1 == NULL)
+		return;
+	
+	srcregionp2 = GsFindRegion(src_rgn2);
+	if (srcregionp2 == NULL)
+		return;
+	
+	GdIntersectRegion(regionp->rgn, srcregionp1->rgn, srcregionp2->rgn);
+}
+
+/*
+ * Sets the clip-mask in the GC to the specified region.
+ */
+void
+GrSetGCRegion(GR_GC_ID gc, GR_REGION_ID region)
+{
+	GR_GC		*gcp;
+	
+	gcp = GsFindGC(gc);
+	if(gcp == NULL)
+		return;
+	
+	gcp->regionid = region;
+	gcp->changed = GR_TRUE;
+}
+
+/*
+ * Determines whether a specified point resides in a region.
+ */ 
+GR_BOOL
+GrPointInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y)
+{
+	GR_REGION	*regionp;
+	
+	regionp =  GsFindRegion(region);
+	if (regionp == NULL)
+		return GR_FALSE;
+	
+	return GdPtInRegion(regionp->rgn, x, y);
+}
+
+/*
+ * Determines whether a specified rectangle at least partly resides
+ * in a region.
+ */ 
+int
+GrRectInRegion(GR_REGION_ID region, GR_COORD x, GR_COORD y, GR_COORD w,
+	GR_COORD h)
+{
+	GR_REGION	*regionp;
+	MWRECT		rect;
+	
+	regionp =  GsFindRegion(region);
+	if (regionp == NULL)
+		return MWRECT_OUT;
+	
+	rect.left = x;
+	rect.top = y;
+	rect.right = x + w;
+	rect.bottom = y + h;
+	return GdRectInRegion(regionp->rgn, &rect);
+}
+
+/*
+ * Return GR_TRUE if a region is empty.
+ */ 
+GR_BOOL
+GrEmptyRegion(GR_REGION_ID region)
+{
+	GR_REGION	*regionp;
+	
+	regionp =  GsFindRegion(region);
+	if (regionp == NULL)
+		return GR_TRUE;
+	
+	return GdEmptyRegion(regionp->rgn);
+}
+
+/*
+ * Return GR_TRUE if two regions are identical.
+ */ 
+GR_BOOL
+GrEqualRegion(GR_REGION_ID rgn1, GR_REGION_ID rgn2)
+{
+	GR_REGION	*prgn1;
+	GR_REGION	*prgn2;
+	
+	prgn1 = GsFindRegion(rgn1);
+	prgn2 = GsFindRegion(rgn2);
+
+	if (!prgn1 && !prgn2)
+		return GR_TRUE;
+	if (!prgn1 || !prgn2)
+		return GR_FALSE;
+	
+	return GdEqualRegion(prgn1->rgn, prgn2->rgn);
+}
+
+/*
+ * Offset a region by dx, dy.
+ */ 
+void
+GrOffsetRegion(GR_REGION_ID region, GR_SIZE dx, GR_SIZE dy)
+{
+	GR_REGION	*regionp;
+	
+	regionp =  GsFindRegion(region);
+	if (regionp)
+		GdOffsetRegion(regionp->rgn, dx, dy);
+}
+
+/*
+ * Return the bounding box for the specified region.
+ */
+int
+GrGetRegionBox(GR_REGION_ID region, GR_RECT *rect)
+{
+	GR_REGION	*regionp;
+	MWRECT		rc;
+	int		ret_val;
+	
+	regionp =  GsFindRegion(region);
+	if (regionp == NULL) {
+		memset(rect, 0, sizeof(GR_RECT));
+		return MWREGION_ERROR;
+	}
+	
+	ret_val = GdGetRegionBox(regionp->rgn, &rc);
+	/* convert MW rect to Nano-X rect*/
+	rect->x = rc.left;
+	rect->y = rc.top;
+	rect->width = rc.right - rc.left;
+	rect->height = rc.bottom - rc.top;
+	return ret_val;
+}
+
+static int nextfontid = 1000;
+/*
+ * Allocate a new GC with default parameters.
+ * The GC is owned by the current client.
+ */
+GR_FONT_ID
+GrCreateFont(GR_CHAR *name, GR_COORD height, GR_LOGFONT *plogfont)
+{
+	GR_FONT	*fontp;
+
+	fontp = (GR_FONT *) malloc(sizeof(GR_FONT));
+	if (fontp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		return 0;
+	}
+
+	if (plogfont)
+		fontp->pfont = GdCreateFont(&scrdev, NULL, 0, plogfont);
+	else
+		fontp->pfont = GdCreateFont(&scrdev, name, height, NULL);
+	fontp->id = nextfontid++;
+	fontp->owner = curclient;
+	fontp->next = listfontp;
+
+	listfontp = fontp;
+
+	return fontp->id;
+}
+
+/* Set the font size for the passed font*/
+void
+GrSetFontSize(GR_FONT_ID fontid, GR_COORD size)
+{
+	GR_FONT		*fontp;
+
+	fontp = GsFindFont(fontid);
+	if (fontp)
+		GdSetFontSize(fontp->pfont, size);
+}
+
+/* Set the font rotation in tenths of degrees for the passed font*/
+void
+GrSetFontRotation(GR_FONT_ID fontid, int tenthdegrees)
+{
+	GR_FONT		*fontp;
+
+	fontp = GsFindFont(fontid);
+	if (fontp)
+		GdSetFontRotation(fontp->pfont, tenthdegrees);
+}
+
+/* Set the font size for the passed font*/
+void
+GrSetFontAttr(GR_FONT_ID fontid, int setflags, int clrflags)
+{
+	GR_FONT		*fontp;
+
+	fontp = GsFindFont(fontid);
+	if (fontp)
+		GdSetFontAttr(fontp->pfont, setflags, clrflags);
+}
+
+/*
+ * Unload and deallocate an existing font.
+ */
+void
+GrDestroyFont(GR_FONT_ID fontid)
+{
+	GR_FONT		*fontp;
+	GR_FONT		*prevfontp;
+
+	fontp = GsFindFont(fontid);
+	if (fontp == NULL)
+		return;
+
+	if (listfontp == fontp)
+		listfontp = fontp->next;
+	else {
+		prevfontp = listfontp;
+		while (prevfontp->next != fontp)
+			prevfontp = prevfontp->next;
+
+		prevfontp->next = fontp->next;
+	}
+	GdDestroyFont(fontp->pfont);
+	free(fontp);
+}
+
+/*
+ * Return useful information about the specified font.
+ * Font #0 returns info about the standard font.
+ */
+void
+GrGetFontInfo(GR_FONT_ID font, GR_FONT_INFO *fip)
+{
+	GR_FONT	*fontp;
+	PMWFONT	pf;
+
+	if (font == 0)
+		pf = stdfont;
+	else {
+		fontp = GsFindFont(font);
+		if (!fontp) {
+			memset(fip, 0, sizeof(GR_FONT_INFO));
+			return;
+		}
+		pf = fontp->pfont;
+	}
+	GdGetFontInfo(pf, fip);
+}
+
+/*
+ * Select events for a window for this client.
+ * The events are a bitmask for the events desired.
+ */
+void 
+GrSelectEvents(GR_WINDOW_ID wid, GR_EVENT_MASK eventmask)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_EVENT_CLIENT	*evp;		/* event-client structure */
+
+	wp = GsFindWindow(wid);
+	if (wp == NULL)
+		return;
+
+	/*
+	 * See if this client is already in the event client list.
+	 * If so, then just replace the events he is selecting for.
+	 */
+	for (evp = wp->eventclients; evp; evp = evp->next) {
+		if (evp->client == curclient) {
+			evp->eventmask = eventmask;
+			return;
+		}
+	}
+
+	/*
+	 * A new client for this window, so allocate a new event client
+	 * structure and insert it into the front of the list in the window.
+	 */
+	evp = (GR_EVENT_CLIENT *) malloc(sizeof(GR_EVENT_CLIENT));
+	if (evp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, wid);
+		return;
+	}
+
+	evp->client = curclient;
+	evp->eventmask = eventmask;
+	evp->next = wp->eventclients;
+	wp->eventclients = evp;
+
+	/*
+	 * If it's a request for child updates to the root window,
+	 * then search entire list and send map events for
+	 * mapped windows now.  This allows a window manager
+	 * to get the mapped window list without another API call.
+	 */
+	if (wid==GR_ROOT_WINDOW_ID && (eventmask & GR_EVENT_MASK_CHLD_UPDATE)) {
+		for (wp = listwp; wp; wp = wp->next) {
+			if (wp->unmapcount == 0)
+				GsDeliverUpdateEvent(wp, GR_UPDATE_MAP,
+					wp->x, wp->y, wp->width, wp->height);
+		}
+	}
+}
+
+static GR_WINDOW *
+NewWindow(GR_WINDOW *pwp, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, GR_SIZE bordersize, GR_COLOR background,
+	GR_COLOR bordercolor)
+{
+	GR_WINDOW	*wp;	/* new window*/
+
+	if (width <= 0 || height <= 0 || bordersize < 0) {
+		GsError(GR_ERROR_BAD_WINDOW_SIZE, 0);
+		return NULL;
+	}
+
+	wp = (GR_WINDOW *) malloc(sizeof(GR_WINDOW));
+	if (wp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		return NULL;
+	}
+
+	wp->id = nextid++;
+	wp->psd = rootwp->psd;
+	wp->parent = pwp;
+	wp->children = NULL;
+	wp->siblings = pwp->children;
+	wp->next = listwp;
+	wp->x = pwp->x + x;
+	wp->y = pwp->y + y;
+	wp->width = width;
+	wp->height = height;
+	wp->bordersize = bordersize;
+	wp->background = background;
+	wp->bgpixmap = NULL;
+	wp->bgpixmapflags = GR_BACKGROUND_TILE;
+	wp->bordercolor = bordercolor;
+	wp->nopropmask = 0;
+	wp->eventclients = NULL;
+	wp->owner = curclient;
+	wp->cursor = pwp->cursor;
+	wp->cursor->usecount++;
+	wp->mapped = GR_FALSE;
+	wp->unmapcount = pwp->unmapcount + 1;
+	wp->output = GR_TRUE;
+	wp->props = 0;
+	wp->title = NULL;
+
+	pwp->children = wp;
+	listwp = wp;
+
+	return wp;
+}
+
+/*
+ * Allocate a new window which is a child of the specified window.
+ * The window inherits the cursor of the parent window.
+ * The window is owned by the current client.
+ */
+GR_WINDOW_ID
+GrNewWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, GR_SIZE bordersize, GR_COLOR background,
+	GR_COLOR bordercolor)
+{
+	GR_WINDOW	*pwp;		/* parent window */
+	GR_WINDOW	*wp;		/* new window */
+
+	pwp = GsFindWindow(parent);
+	if (pwp == NULL)
+		return 0;
+
+	if (!pwp->output) {
+		GsError(GR_ERROR_INPUT_ONLY_WINDOW, pwp->id);
+		return 0;
+	}
+
+	wp = NewWindow(pwp, x, y, width, height, bordersize, background,
+		bordercolor);
+	return wp? wp->id: 0;
+}
+
+/*
+ * Allocate a new input-only window which is a child of the specified window.
+ * Such a window is invisible, cannot be drawn into, and is only used to
+ * return events.  The window inherits the cursor of the parent window.
+ * The window is owned by the current client.
+ */
+GR_WINDOW_ID
+GrNewInputWindow(GR_WINDOW_ID parent, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height)
+{
+	GR_WINDOW	*pwp;		/* parent window */
+	GR_WINDOW	*wp;		/* new window */
+
+	pwp = GsFindWindow(parent);
+	if (pwp == NULL)
+		return 0;
+
+	wp = NewWindow(pwp, x, y, width, height, 0, BLACK, BLACK);
+	if (wp) {
+		/* convert to input-only window*/
+		wp->output = GR_FALSE;
+		return wp->id;
+	}
+	return 0;
+}
+
+/*
+ * Allocate a pixmap, can be used with any drawing functions
+ * for offscreen drawing
+ */
+GR_WINDOW_ID
+GrNewPixmap(GR_SIZE width, GR_SIZE height, void * pixels)
+{
+	GR_PIXMAP	*pp;
+	PSD		psd;
+        int 		size, linelen, bpp, planes;
+   
+	if (width <= 0 || height <= 0) {
+		/* no error for now, server will desynchronize w/app*/
+		/*GsError(GR_ERROR_BAD_WINDOW_SIZE, 0);*/
+		return 0;
+	}
+
+	/*
+	 * allocate offscreen psd.  If screen driver doesn't
+	 * support blitting, this will fail.  Use root window screen
+	 * device for compatibility for now.
+	 */
+	planes = rootwp->psd->planes;
+	bpp = rootwp->psd->bpp;
+        psd = rootwp->psd->AllocateMemGC(rootwp->psd);
+	if (!psd)
+		return 0;
+
+	pp = (GR_PIXMAP *) malloc(sizeof(GR_PIXMAP));
+	if (pp == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		psd->FreeMemGC(psd);
+		return 0;
+	}
+
+        GdCalcMemGCAlloc(psd, width, height, 0, 0, &size, &linelen);
+
+	/* Allocate space for pixel values */
+        if (!pixels) {
+	        pixels = calloc(size, 1);
+		psd->flags |= PSF_ADDRMALLOC;
+	}
+	if (!pixels) {
+		free(pp);
+		psd->FreeMemGC(psd);
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		return 0;
+	}
+  
+	pp->id = nextid++;
+	pp->next = listpp;
+	pp->psd = psd;
+	pp->x = 0;
+	pp->y = 0;
+	pp->width = width;
+	pp->height = height;
+	pp->owner = curclient;
+
+        psd->MapMemGC(psd, width, height, planes, bpp, linelen, size,
+		pixels);
+	
+        listpp = pp;
+	return pp->id;
+}
+
+/*
+ * Map the window to make it (and possibly its children) visible on the screen.
+ */
+void
+GrMapWindow(GR_WINDOW_ID wid)
+{
+	GR_WINDOW	*wp;		/* window structure */
+
+	wp = GsFindWindow(wid);
+	if (!wp || wp->mapped)
+		return;
+
+	wp->mapped = GR_TRUE;
+
+	GsWpMapWindow(wp, GR_FALSE);
+}
+
+/*
+ * Unmap the window to make it and its children invisible on the screen.
+ */
+void
+GrUnmapWindow(GR_WINDOW_ID wid)
+{
+	GR_WINDOW	*wp;		/* window structure */
+
+	wp = GsFindWindow(wid);
+	if (!wp || !wp->mapped)
+		return;
+
+	GsWpUnmapWindow(wp, GR_FALSE);
+
+	wp->mapped = GR_FALSE;
+}
+
+/*
+ * Clear the specified window.
+ * This sets the window to its background color.
+ * If the exposeflag is nonzero, then this also creates an exposure
+ * event for the window.
+ */
+void
+GrClearWindow(GR_WINDOW_ID wid, GR_BOOL exposeflag)
+{
+	GR_WINDOW		*wp;	/* window structure */
+
+	wp = GsPrepareWindow(wid);
+	if (wp)
+		GsWpClearWindow(wp, 0, 0, wp->width, wp->height, exposeflag);
+}
+
+/* Return window with keyboard focus.*/
+GR_WINDOW_ID
+GrGetFocus(void)
+{
+	return focuswp->id;
+}
+
+/*
+ * Set the focus to a particular window.
+ * This makes keyboard events only visible to that window or children of it,
+ * depending on the pointer location.
+ */
+void
+GrSetFocus(GR_WINDOW_ID wid)
+{
+	GR_WINDOW	*wp;		/* window structure */
+
+	wp = GsFindWindow(wid);
+	if (wp == NULL)
+		return;
+
+	if (wp->unmapcount) {
+		GsError(GR_ERROR_UNMAPPED_FOCUS_WINDOW, wid);
+		return;
+	}
+
+	/* Check if window wants focus, if not, ignore call*/
+	if (wp->props & GR_WM_PROPS_NOFOCUS)
+		return;
+
+	focusfixed = (wp != rootwp);
+	GsWpSetFocus(wp);
+}
+
+/*
+ * Set the border of a window to the specified color.
+ */
+void
+GrSetBorderColor(GR_WINDOW_ID wid, GR_COLOR color)
+{
+	GR_WINDOW	*wp;		/* window structure */
+
+	wp = GsFindWindow(wid);
+	if (!wp || wp->bordercolor == color || wp->bordersize == 0)
+		return;
+
+	wp->bordercolor = color;
+	if (wp->unmapcount == 0)
+		GsDrawBorder(wp);
+}
+
+/*
+ * Specify a cursor for a window.
+ * This cursor will only be used within that window, and by default
+ * for its new children.  If the cursor is currently within this
+ * window, it will be changed to the new one immediately.
+ */
+void
+GrSetCursor(GR_WINDOW_ID wid, GR_SIZE width, GR_SIZE height, GR_COORD hotx,
+	GR_COORD hoty, GR_COLOR foreground, GR_COLOR background,
+	GR_BITMAP *fgbitmap, GR_BITMAP *bgbitmap)
+{
+	GR_WINDOW	*wp;		/* window structure */
+	GR_CURSOR	*cp;		/* cursor structure */
+	int		bytes;		/* number of bytes of bitmap */
+
+	wp = GsFindWindow(wid);
+	if (wp == NULL)
+		return;
+
+	/*
+	 * Make sure the size of the bitmap is reasonable.
+	 */
+	if ((width <= 0) || (width > MWMAX_CURSOR_SIZE) ||
+		(height <= 0) || (height > MWMAX_CURSOR_SIZE))
+	{
+		GsError(GR_ERROR_BAD_CURSOR_SIZE, 0);
+		return;
+	}
+	bytes = GR_BITMAP_SIZE(width, height) * sizeof(GR_BITMAP);
+
+	/*
+	 * See if the window is using a shared cursor definition.
+	 * If so, then allocate a new private one, otherwise reuse it.
+	 */
+	cp = wp->cursor;
+	if (cp == NULL || cp->usecount-- > 1) {
+		cp = (GR_CURSOR *) malloc(sizeof(GR_CURSOR));
+		if (cp == NULL) {
+			GsError(GR_ERROR_MALLOC_FAILED, 0);
+			return;
+		}
+	}
+
+	cp->usecount = 1;
+	cp->cursor.width = width;
+	cp->cursor.height = height;
+	cp->cursor.hotx = hotx;
+	cp->cursor.hoty = hoty;
+	cp->cursor.fgcolor = foreground;
+	cp->cursor.bgcolor = background;
+	memcpy(cp->cursor.image, fgbitmap, bytes);
+	memcpy(cp->cursor.mask, bgbitmap, bytes);
+	wp->cursor = cp;
+
+	/*
+	 * If this was the current cursor, then draw the new one.
+	 */
+	if (cp == curcursor || curcursor == NULL) {
+		GdMoveCursor(cursorx - cp->cursor.hotx,
+			cursory - cp->cursor.hoty);
+		GdSetCursor(&cp->cursor);
+	}
+
+	GsCheckCursor();
+}
+
+/*
+ * Move the cursor to the specified absolute screen coordinates.
+ * The coordinates are that of the defined hot spot of the cursor.
+ * The cursor's appearance is changed to that defined for the window
+ * in which the cursor is moved to.  In addition, mouse enter, mouse
+ * exit, focus in, and focus out events are generated if necessary.
+ */
+void
+GrMoveCursor(GR_COORD x, GR_COORD y)
+{
+	/*
+	 * Move the cursor only if necessary, offsetting it to
+	 * place the hot spot at the specified coordinates.
+	 */
+	if ((x != cursorx) || (y != cursory)) {
+		if(curcursor)
+			GdMoveCursor(x - curcursor->cursor.hotx,
+				y - curcursor->cursor.hoty);
+		cursorx = x;
+		cursory = y;
+	}
+
+	/*
+	 * Now check to see which window the mouse is in, whether or
+	 * not the cursor shape should be changed, and whether or not
+	 * the input focus window should be changed.
+	 */
+	GsCheckMouseWindow();
+	GsCheckFocusWindow();
+	GsCheckCursor();
+}
+
+/*
+ * Set the foreground color in a graphics context.
+ */
+void
+GrSetGCForeground(GR_GC_ID gc, GR_COLOR foreground)
+{
+	GR_GC		*gcp;		/* graphics context */
+
+	gcp = GsFindGC(gc);
+	if (!gcp || gcp->foreground == foreground)
+		return;
+
+	gcp->foreground = foreground;
+	gcp->changed = GR_TRUE;
+}
+
+/*
+ * Set the background color in a graphics context.
+ */
+void
+GrSetGCBackground(GR_GC_ID gc, GR_COLOR background)
+{
+	GR_GC		*gcp;		/* graphics context */
+
+	gcp = GsFindGC(gc);
+	if (!gcp || gcp->background == background)
+		return;
+
+	gcp->background = background;
+	gcp->changed = GR_TRUE;
+}
+
+/*
+ * Set whether or not the background color is drawn in bitmaps and text.
+ */
+void
+GrSetGCUseBackground(GR_GC_ID gc, GR_BOOL flag)
+{
+	GR_GC		*gcp;		/* graphics context */
+
+	flag = (flag != 0);
+	gcp = GsFindGC(gc);
+	if (!gcp || gcp->usebackground == flag)
+		return;
+
+	gcp->usebackground = flag;
+	gcp->changed = GR_TRUE;
+}
+
+/*
+ * Set the drawing mode in a graphics context.
+ */
+void
+GrSetGCMode(GR_GC_ID gc, int mode)
+{
+	GR_GC		*gcp;		/* graphics context */
+
+	gcp = GsFindGC(gc);
+	if (!gcp || gcp->mode == mode)
+		return;
+	if ((mode & GR_MODE_DRAWMASK) > GR_MAX_MODE) {
+		GsError(GR_ERROR_BAD_DRAWING_MODE, gc);
+		return;
+	}
+
+	gcp->mode = mode;
+	gcp->changed = GR_TRUE;
+}
+
+/*
+ * Set the text font in a graphics context.
+ */
+void
+GrSetGCFont(GR_GC_ID gc, GR_FONT_ID font)
+{
+	GR_GC		*gcp;		/* graphics context */
+	GR_FONT		*fontp;
+
+	gcp = GsFindGC(gc);
+	if (!gcp || gcp->fontid == font)
+		return;
+
+	fontp = GsFindFont(font);
+	gcp->fontid = font;
+	gcp->changed = GR_TRUE;
+}
+
+/*
+ * Draw a line in the specified drawable using the specified graphics context.
+ */
+
+void
+GrLine(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x1, GR_COORD y1, GR_COORD x2,
+	GR_COORD y2)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdLine(dp->psd, dp->x + x1, dp->y + y1,
+				dp->x + x2, dp->y + y2, TRUE);
+			break;
+	}
+}
+
+/*
+ * Draw the boundary of a rectangle in the specified drawable using the
+ * specified graphics context.
+ * NOTE: this function draws a rectangle 1 pixel wider and higher
+ * than Xlib's XDrawRectangle().
+ */
+void 
+GrRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+      	        case GR_DRAW_TYPE_PIXMAP:
+			GdRect(dp->psd, dp->x + x, dp->y + y, width, height);
+			break;
+	}
+}
+
+/*
+ * Fill a rectangle in the specified drawable using the specified
+ * graphics context.
+ */
+void
+GrFillRect(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdFillRect(dp->psd, dp->x + x, dp->y + y, width,height);
+			break;
+	}
+}
+
+/*
+ * Draw the boundary of an ellipse in the specified drawable with
+ * the specified graphics context.  Integer only.
+ */
+void
+GrEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx,
+	GR_SIZE ry)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdEllipse(dp->psd, dp->x + x, dp->y + y, rx, ry, FALSE);
+			break;
+	}
+}
+
+/*
+ * Fill an ellipse in the specified drawable using the specified
+ * graphics context.  Integer only.
+ */
+void
+GrFillEllipse(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE rx,
+	GR_SIZE ry)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdEllipse(dp->psd, dp->x + x, dp->y + y, rx, ry, TRUE);
+			break;
+	}
+}
+
+/*
+ * Draw an arc, pie or ellipse in the specified drawable using
+ * the specified graphics context.  Integer only.
+ */
+void	
+GrArc(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry, GR_COORD ax, GR_COORD ay,
+	GR_COORD bx, GR_COORD by, int type)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdArc(dp->psd, dp->x + x, dp->y + y, rx, ry,
+				dp->x+ax, dp->y+ay, dp->x+bx, dp->y+by, type);
+			break;
+	}
+}
+
+/*
+ * Draw an arc or pie in the specified drawable using
+ * the specified graphics context.  Requires floating point.
+ */
+void
+GrArcAngle(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE rx, GR_SIZE ry, GR_COORD angle1, GR_COORD angle2, int type)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdArcAngle(dp->psd, dp->x + x, dp->y + y, rx, ry,
+				angle1, angle2, type);
+			break;
+	}
+}
+
+/*
+ * Draw a rectangular area in the specified drawable using the specified
+ * graphics, as determined by the specified bit map.  This differs from
+ * rectangle drawing in that the rectangle is drawn using the foreground
+ * color and possibly the background color as determined by the bit map.
+ * Each row of bits is aligned to the next bitmap word boundary (so there
+ * is padding at the end of the row).  The background bit values are only
+ * written if the usebackground flag is set in the GC.
+ */
+void
+GrBitmap(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, GR_BITMAP *imagebits)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdBitmap(dp->psd, dp->x + x, dp->y + y, width, height,
+				imagebits);
+			break;
+	}
+}
+
+/* draw a multicolor image at x, y*/
+void
+GrDrawImageBits(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_IMAGE_HDR *pimage)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdDrawImage(dp->psd, dp->x + x, dp->y + y, pimage);
+			break;
+	}
+}
+
+#if !((DOS_DJGPP) || (__PACIFIC__) || (DOS_TURBOC))
+/* Load an image file from disk and display it at the specified coordinates*/
+void
+GrDrawImageFromFile(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, char* path, int flags)
+{
+#if defined(HAVE_FILEIO)
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+ 	        case GR_DRAW_TYPE_PIXMAP:
+			GdDrawImageFromFile(dp->psd, dp->x + x, dp->y + y,
+				width, height, path, flags);
+			break;
+	}
+#endif
+}
+
+/* load image from file and cache it*/
+GR_IMAGE_ID
+GrLoadImageFromFile(char *path, int flags)
+{
+#if defined(HAVE_FILEIO)
+	GR_IMAGE_ID	id;
+	GR_IMAGE *	imagep;
+
+	id = GdLoadImageFromFile(&scrdev, path, flags);
+	if (!id)
+		return 0;
+
+	imagep = (GR_IMAGE *) malloc(sizeof(GR_IMAGE));
+	if (imagep == NULL) {
+		GsError(GR_ERROR_MALLOC_FAILED, 0);
+		GdFreeImage(id);
+		return 0;
+	}
+	
+	imagep->id = id;
+	imagep->owner = curclient;
+	imagep->next = listimagep;
+
+	listimagep = imagep;
+	return id;
+#else
+	return 0;
+#endif 
+}
+
+/* draw cached image*/
+void
+GrDrawImageToFit(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, GR_IMAGE_ID imageid)
+{
+#if defined(HAVE_FILEIO)
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+ 	        case GR_DRAW_TYPE_PIXMAP:
+			GdDrawImageToFit(dp->psd, dp->x + x, dp->y + y,
+				width, height, imageid);
+			break;
+	   
+	}
+#endif
+}
+
+/* free cached image*/
+void
+GrFreeImage(GR_IMAGE_ID id)
+{
+#if defined(HAVE_FILEIO)
+	GR_IMAGE	*imagep;
+	GR_IMAGE	*previmagep;
+
+	for (imagep = listimagep; imagep; imagep = imagep->next) {
+		if (imagep->id == id) {
+
+			if (listimagep == imagep)
+				listimagep = imagep->next;
+			else {
+				previmagep = listimagep;
+				while (previmagep->next != imagep)
+					previmagep = previmagep->next;
+
+				previmagep->next = imagep->next;
+			}
+
+			GdFreeImage(imagep->id);
+			free(imagep);
+			return;
+		}
+	}
+#endif
+}
+
+/* return cached image information*/
+void
+GrGetImageInfo(GR_IMAGE_ID id, GR_IMAGE_INFO *iip)
+{
+#if defined(HAVE_FILEIO)
+	GdGetImageInfo(id, iip);
+#else
+	memset(iip, 0, sizeof(GR_IMAGE_INFO));
+#endif
+}
+#endif /* !defined (DOS_DJGPP)|| (__PACIFIC__) || (DOS_TURBOC)) */
+
+/*
+ * Draw a rectangular area in the specified drawable using the specified
+ * graphics context.  This differs from rectangle drawing in that the
+ * color values for each pixel in the rectangle are specified.  
+ * The color table is indexed row by row.
+ */
+void
+GrArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, GR_SIZE width,
+	GR_SIZE height, void *pixels, int pixtype)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdArea(dp->psd, dp->x + x, dp->y + y, width, height,
+				pixels, pixtype);
+			break;
+	}
+}
+
+/*
+ * Copy a rectangle from one drawable to another or the same
+ */
+void
+GrCopyArea(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height, GR_DRAW_ID source,
+	GR_COORD srcx, GR_COORD srcy, int op)
+{
+	GR_DRAWABLE	*dp;
+        GR_WINDOW	*swp;
+        GR_PIXMAP	*spp = NULL;
+        GR_DRAW_TYPE	type;
+        PSD 		srcpsd;
+   
+        srcpsd = NULL;
+
+        swp = GsFindWindow(source);
+        type = GsPrepareDrawing(id, gc, &dp);
+	if (type == GR_DRAW_TYPE_NONE)
+		return;
+
+        if (swp) {
+		srcpsd = swp->psd;
+		srcx += swp->x;
+		srcy += swp->y;
+	} else {
+	       spp = GsFindPixmap(source);
+	       if (spp)
+		     srcpsd = spp->psd;
+	}
+        if (!srcpsd)
+		return;
+
+#if DYNAMICREGIONS
+	/*
+	 * Skip blit and send expose event if window is partly
+	 * obscured and source and destination are onscreen.
+	 * Also check that receiving window's first client has
+	 * selected for expose events.  This keeps brain-dead
+	 * programs that don't process exposure events somewhat working.
+	 */
+	if (swp && (srcpsd == dp->psd) && swp->eventclients &&
+	    (swp->eventclients->eventmask & GR_EVENT_MASK_EXPOSURE)) {
+		MWRECT 		rc;
+		extern MWCLIPREGION *clipregion;
+
+		/* clip blit rectangle to source screen/bitmap size*/
+		if(srcx+width > srcpsd->xvirtres)
+			width = srcpsd->xvirtres - srcx;
+		if(srcy+height > srcpsd->yvirtres)
+			height = srcpsd->yvirtres - srcy;
+
+		rc.left = srcx;
+		rc.top = srcy;
+		rc.right = srcx + width;
+		rc.bottom = srcy + height;
+
+		/*
+		 * if source isn't entirely within clip region, then
+		 * the blit is partly obscured and will copy some garbage.
+		 * In this case, skip the blit, punt, and deliver an
+		 * exposure event instead for proper display.
+		 */
+		if (GdRectInRegion(clipregion, &rc) != MWRECT_ALLIN) {
+			GsDeliverExposureEvent(swp, dp->x+x, dp->y+y,
+				width, height);
+			return;
+		}
+	}
+#endif
+	/* perform blit*/
+	GdBlit(dp->psd, dp->x+x, dp->y+y, width, height, srcpsd, srcx, srcy,op);
+}
+
+
+/*
+ * Read the color values from the specified rectangular area of the
+ * specified drawable into a supplied buffer.  If the drawable is a
+ * window which is obscured by other windows, then the returned values
+ * will include the values from the covering windows.  Regions outside
+ * of the screen boundaries, or unmapped windows will return black.
+ */
+void
+GrReadArea(GR_DRAW_ID id,GR_COORD x,GR_COORD y,GR_SIZE width,GR_SIZE height,
+	GR_PIXELVAL *pixels)
+{
+	GR_WINDOW	*wp;
+	GR_PIXMAP	*pp = NULL;
+
+	if ((wp = GsFindWindow(id)) == NULL && (pp = GsFindPixmap(id)) == NULL){
+		GsError(GR_ERROR_BAD_WINDOW_ID, id);
+		return;
+	}
+
+	if (wp != NULL) {
+		if (wp->unmapcount || (x >= wp->width) || (y >= wp->height) ||
+		   (x + width <= 0) || (y + height <= 0)) {
+			/* long		count;
+			* GR_PIXELVAL	black;
+			*
+			* black = GdFindColor(BLACK);
+			* count = width * height;
+			* while (count-- > 0)
+			*	*pixels++ = black;
+			*/
+			return;
+		}
+		GdReadArea(wp->psd, wp->x+x, wp->y+y, width, height, pixels);
+	}
+	if (pp != NULL) {
+		if ((x >= pp->width) || (y >= pp->height) ||
+		    (x + width <= 0) || (y + height <= 0)) {
+			return;
+		}
+		GdReadArea(pp->psd, x, y, width, height, pixels);
+	}
+}
+
+/*
+ * Draw a point in the specified drawable using the specified
+ * graphics context.
+ */
+void
+GrPoint(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y)
+{
+	GR_DRAWABLE	*dp;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdPoint(dp->psd, dp->x + x, dp->y + y);
+			break;
+	}
+}
+
+/*
+ * Draw points in the specified drawable using the specified
+ * graphics context.
+ */
+void
+GrPoints(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable)
+{
+	GR_DRAWABLE	*dp;
+	GR_POINT	*pp;
+	GR_COUNT	i;
+        PSD 		psd;
+   
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+	                psd = dp->psd;
+	                break;
+		default:
+			return;
+	}
+
+	pp = pointtable;
+	for (i = count; i-- > 0; pp++) {
+		GdPoint(psd, pp->x + dp->x, pp->y + dp->y);
+	}
+}
+
+/*
+ * Draw a polygon in the specified drawable using the specified
+ * graphics context.  The polygon is only complete if the first
+ * point is repeated at the end.
+ */
+void
+GrPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable)
+{
+	GR_DRAWABLE	*dp;
+	GR_POINT	*pp;
+	GR_COUNT	i;
+        PSD 		psd;
+   
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+	                psd = dp->psd;
+	                break;
+		default:
+			return;
+	}
+
+	/*
+	 * Here for drawing to a window.
+	 * Relocate all the points relative to the window.
+	 */
+	pp = pointtable;
+	for (i = count; i-- > 0; pp++) {
+		pp->x += dp->x;
+		pp->y += dp->y;
+	}
+
+	GdPoly(psd, count, pointtable);
+
+#ifdef NONETWORK   
+	/*
+	 * The following is only necessary when the server
+	 * isn't a separate process.  We don't want to change the
+	 * user's arguments!
+	 */
+	pp = pointtable;
+	for (i = count; i-- > 0; pp++) {
+		pp->x -= dp->x;
+		pp->y -= dp->y;
+	}
+#endif
+}
+
+/*
+ * Draw a filled polygon in the specified drawable using the specified
+ * graphics context.  The last point may be a duplicate of the first
+ * point, but this is not required.
+ */
+void
+GrFillPoly(GR_DRAW_ID id, GR_GC_ID gc, GR_COUNT count, GR_POINT *pointtable)
+{
+	GR_DRAWABLE	*dp;
+	GR_POINT	*pp;
+	GR_COUNT	i;
+        PSD 		psd;
+   
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+	                psd = dp->psd;
+			break;
+		default:
+			return;
+	}
+
+	/*
+	 * Here for drawing to a window.
+	 * Relocate all the points relative to the window.
+	 */
+	pp = pointtable;
+	for (i = count; i-- > 0; pp++) {
+		pp->x += dp->x;
+		pp->y += dp->y;
+	}
+
+	GdFillPoly(psd, count, pointtable);
+
+#ifdef NONETWORK
+	/*
+	 * The following is only necessary when the server
+	 * isn't a separate process.  We don't want to change the
+	 * user's arguments!
+	 */
+	pp = pointtable;
+	for (i = count; i-- > 0; pp++) {
+		pp->x -= dp->x;
+		pp->y -= dp->y;
+	}
+#endif   
+}
+
+/*
+ * Draw a text string in the specified drawable using the
+ * specified graphics context.
+ */
+void
+GrText(GR_DRAW_ID id, GR_GC_ID gc, GR_COORD x, GR_COORD y, void *str,
+	GR_COUNT count, int flags)
+{
+	GR_DRAWABLE	*dp;
+
+	/* default to baseline alignment if none specified*/
+	if((flags&(MWTF_TOP|MWTF_BASELINE|MWTF_BOTTOM)) == 0)
+		flags |= MWTF_BASELINE;
+
+	switch (GsPrepareDrawing(id, gc, &dp)) {
+		case GR_DRAW_TYPE_WINDOW:
+	        case GR_DRAW_TYPE_PIXMAP:
+			GdText(dp->psd, dp->x + x, dp->y + y, str, count,flags);
+			break;
+	}
+}
+
+/* Return the system palette entries*/
+void
+GrGetSystemPalette(GR_PALETTE *pal)
+{
+	/* return 0 count if not in palettized mode*/
+	memset(pal, 0, sizeof(GR_PALETTE *));
+
+	if(rootwp->psd->pixtype == MWPF_PALETTE) {
+		pal->count = (int)rootwp->psd->ncolors;
+		GdGetPalette(rootwp->psd, 0, pal->count, pal->palette);
+	}
+}
+
+/* Set the system palette entries from first for count*/
+void
+GrSetSystemPalette(GR_COUNT first, GR_PALETTE *pal)
+{
+	GdSetPalette(rootwp->psd, first, pal->count, pal->palette);
+	if (first == 0)
+		GsRedrawScreen();
+}
+
+/* Convert passed color value to pixel value, depending on system mode*/
+void
+GrFindColor(GR_COLOR c, GR_PIXELVAL *retpixel)
+{
+	*retpixel = GdFindColor(c);
+}
+
+/* visible =0, no cursor change; =1, show; else hide*/
+void
+GrInjectPointerEvent(GR_COORD x, GR_COORD y, int button, int visible)
+{
+	if (visible != 0) {
+		if (visible == 1)
+			GdShowCursor(&scrdev);
+		else
+			GdHideCursor(&scrdev);
+	}
+
+	GdMoveMouse(x, y);
+	GsHandleMouseStatus(x, y, button);
+}
+
+void
+GrInjectKeyboardEvent(GR_WINDOW_ID wid, GR_KEY keyvalue, GR_KEYMOD modifiers,
+	GR_SCANCODE scancode, GR_BOOL pressed)
+{
+	/* create a keyboard event */
+	GsDeliverKeyboardEvent(wid,
+		pressed? GR_EVENT_TYPE_KEY_DOWN: GR_EVENT_TYPE_KEY_UP,
+		keyvalue, modifiers, scancode);
+}
+
+/*
+ * Set certain window properties, according to flags value
+ * passed in props.
+ */
+void
+GrSetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props)
+{
+	GR_WINDOW *wp;
+	int tl;
+
+	/* Find the window structure (generate an error if it doesn't exist) */
+	wp = GsFindWindow(wid);
+	if(!wp) {
+		GsError(GR_ERROR_BAD_WINDOW_ID, wid);
+		return;
+	}
+
+	/* Set window properties*/
+	if (props->flags & GR_WM_FLAGS_PROPS)
+		wp->props = props->props;
+
+	/* Set window title*/
+	if (props->flags & GR_WM_FLAGS_TITLE) {
+		/* Remove the old title if it exists */
+		if(wp->title)
+			free(wp->title);
+
+		/* Calculate the space needed to store the new title */
+		if(props->title)
+			tl = strlen(props->title) + 1;
+
+		/* Check for empty title*/
+		if(!props->title || tl == 1) {
+			wp->title = NULL;
+		} else {
+			/* Otherwise, allocate some space for the new title */
+			if(!(wp->title = malloc(tl)))
+				GsError(GR_ERROR_MALLOC_FAILED, wid);
+			else
+				memcpy(wp->title, props->title, tl);
+		}
+	}
+
+	/* Set window background*/
+	if (props->flags & GR_WM_FLAGS_BACKGROUND) {
+		if (wp->background != props->background) {
+			wp->background = props->background;
+			GsExposeArea(wp, wp->x, wp->y, wp->width, wp->height,
+				NULL);
+		}
+	}
+
+	/* Set window border size*/
+	if (props->flags & GR_WM_FLAGS_BORDERSIZE) {
+		if (wp->bordersize != props->bordersize) {
+			GsWpUnmapWindow(wp, GR_TRUE);
+			wp->bordersize = props->bordersize;
+			GsWpMapWindow(wp, GR_TRUE);
+		}
+	}
+
+	/* Set window border color*/
+	if (props->flags & GR_WM_FLAGS_BORDERCOLOR) {
+		if (wp->bordercolor != props->bordercolor) {
+			wp->bordercolor = props->bordercolor;
+			if (wp->bordersize) {
+				int bs = wp->bordersize;
+				GsExposeArea(wp, wp->x - bs, wp->y - bs,
+					wp->width + bs*2, wp->height + bs*2,
+					NULL);
+			}
+		}
+	}
+}
+
+/*
+ * Return all window properties
+ */
+void
+GrGetWMProperties(GR_WINDOW_ID wid, GR_WM_PROPERTIES *props)
+{
+	GR_WINDOW *wp;
+
+	/* Find the window structure, no error on invalid window id*/ 
+	wp = GsFindWindow(wid);
+	if(!wp) {
+		/* set flags to 0 on bad window id*/
+		memset(props, 0, sizeof(GR_WM_PROPERTIES));
+		return;
+	}
+
+	/* Return everything, regardless of props->flags*/
+	props->flags = GR_WM_FLAGS_PROPS | GR_WM_FLAGS_TITLE |
+		GR_WM_FLAGS_BACKGROUND | GR_WM_FLAGS_BORDERSIZE |
+		GR_WM_FLAGS_BORDERCOLOR;
+	props->props = wp->props;
+	props->title = wp->title;
+	props->background = wp->background;
+	props->bordersize = wp->bordersize;
+	props->bordercolor = wp->bordercolor;
+}
+
+void
+GrCloseWindow(GR_WINDOW_ID wid)
+{
+	GR_WINDOW *wp;
+
+	/* Find the window structure (generate an error if it doesn't exist) */
+	wp = GsFindWindow(wid);
+	if(!wp) {
+		/* 
+		 * no error for now, client/server problems
+		 * with nxwm when sent
+		 */
+		/*GsError(GR_ERROR_BAD_WINDOW_ID, wid);*/
+		return;
+	}
+
+	/* Send a CLOSE_REQ event to the client */
+	GsDeliverGeneralEvent(wp, GR_EVENT_TYPE_CLOSE_REQ, NULL);
+}
+
+void
+GrKillWindow(GR_WINDOW_ID wid)
+{
+	GR_WINDOW *wp;
+
+	/* Find the window structure (generate an error if it doesn't exist) */
+	wp = GsFindWindow(wid);
+	if(!wp) {
+		GsError(GR_ERROR_BAD_WINDOW_ID, wid);
+		return;
+	}
+
+	/* Forcibly kill the connection to the client */
+	GsClose(wp->owner->id);
+}
+
+/*
+ * GrGetSystemColor color scheme definitions
+ */ 
+/* define color scheme: A (tan), B (winstd) or C (old)*/
+#define A
+
+#define A_RGB(r,g,b)
+#define B_RGB(r,g,b)
+#define C_RGB(r,g,b)
+
+#ifdef A
+#undef  A_RGB
+#define A_RGB(r,g,b)	GR_RGB(r,g,b),
+#endif
+#ifdef B
+#undef  B_RGB
+#define B_RGB(r,g,b)	GR_RGB(r,g,b),
+#endif
+#ifdef C
+#undef  C_RGB
+#define C_RGB(r,g,b)	GR_RGB(r,g,b),
+#endif
+
+#define MAXSYSCOLORS	20	/* # of GR_COLOR_* system colors*/
+
+static GR_COLOR sysColors[MAXSYSCOLORS] = {
+	/* desktop background*/
+	GR_RGB(  0, 128, 128),  /* GR_COLOR_DESKTOP             */
+
+	/* caption colors*/
+	A_RGB(128,   0,   0)	/* GR_COLOR_ACTIVECAPTION       */
+	B_RGB(128,   0, 128)	/* GR_COLOR_ACTIVECAPTION       */
+	C_RGB(128,   0, 128)	/* GR_COLOR_ACTIVECAPTION       */
+	GR_RGB(255, 255, 255),  /* GR_COLOR_ACTIVECAPTIONTEXT   */
+	A_RGB(162, 141, 104)	/* GR_COLOR_INACTIVECAPTION     */
+	B_RGB(128, 128, 128)  	/* GR_COLOR_INACTIVECAPTION     */
+	C_RGB(  0,  64, 128)	/* GR_COLOR_INACTIVECAPTION     */
+	GR_RGB(192, 192, 192),  /* GR_COLOR_INACTIVECAPTIONTEXT */
+
+	/* 3d border shades*/
+	GR_RGB(  0,   0,   0),  /* GR_COLOR_WINDOWFRAME         */
+	A_RGB(162, 141, 104)	/* GR_COLOR_BTNSHADOW           */
+	B_RGB(128, 128, 128)	/* GR_COLOR_BTNSHADOW           */
+	C_RGB(128, 128, 128)	/* GR_COLOR_BTNSHADOW           */
+	A_RGB(213, 204, 187)	/* GR_COLOR_3DLIGHT             */
+	B_RGB(223, 223, 223)	/* GR_COLOR_3DLIGHT             */
+	C_RGB(192, 192, 192)	/* GR_COLOR_3DLIGHT             */
+	A_RGB(234, 230, 221)  	/* GR_COLOR_BTNHIGHLIGHT        */
+	B_RGB(255, 255, 255)  	/* GR_COLOR_BTNHIGHLIGHT        */
+	C_RGB(223, 223, 223)  	/* GR_COLOR_BTNHIGHLIGHT        */
+
+	/* top level application window backgrounds/text*/
+	A_RGB(213, 204, 187)	/* GR_COLOR_APPWINDOW           */
+	B_RGB(192, 192, 192)	/* GR_COLOR_APPWINDOW           */
+	C_RGB(160, 160, 160)	/* GR_COLOR_APPWINDOW           */
+	GR_RGB(  0,   0,   0),  /* GR_COLOR_APPTEXT             */
+
+	/* button control backgrounds/text (usually same as app window colors)*/
+	A_RGB(213, 204, 187)	/* GR_COLOR_BTNFACE             */
+	B_RGB(192, 192, 192)	/* GR_COLOR_BTNFACE             */
+	C_RGB(160, 160, 160)	/* GR_COLOR_BTNFACE             */
+	GR_RGB(  0,   0,   0),  /* GR_COLOR_BTNTEXT             */
+
+	/* edit/listbox control backgrounds/text, selected highlights*/
+	GR_RGB(255, 255, 255),  /* GR_COLOR_WINDOW              */
+	GR_RGB(  0,   0,   0),  /* GR_COLOR_WINDOWTEXT          */
+	GR_RGB(128,   0,   0),  /* GR_COLOR_HIGHLIGHT           */
+	GR_RGB(255, 255, 255),  /* GR_COLOR_HIGHLIGHTTEXT       */
+	GR_RGB( 64,  64,  64),  /* GR_COLOR_GRAYTEXT            */
+
+	/* menu backgrounds/text*/
+	A_RGB(213, 204, 187)	/* GR_COLOR_MENU                */
+	B_RGB(192, 192, 192)	/* GR_COLOR_MENU                */
+	C_RGB(160, 160, 160)	/* GR_COLOR_MENU                */
+	GR_RGB(  0,   0,   0),  /* GR_COLOR_MENUTEXT            */
+};
+
+/* Return system-defined color*/
+GR_COLOR
+GrGetSysColor(int index)
+{
+	if(index >= 0 && index < MAXSYSCOLORS)
+		return sysColors[index];
+	return 0;
+}
+
+void
+GrSetScreenSaverTimeout(GR_TIMEOUT timeout)
+{
+	MWTIMER *timer;
+
+	screensaver_delay = timeout * 1000;
+
+	if((timer = GdFindTimer(GsActivateScreenSaver))) GdDestroyTimer(timer);
+
+	GdAddTimer(screensaver_delay, GsActivateScreenSaver,
+					GsActivateScreenSaver);
+}
+
+void
+GrSetSelectionOwner(GR_WINDOW_ID wid, GR_CHAR *typelist)
+{
+	GR_WINDOW_ID oldwid = selection_owner.wid;
+
+	if(selection_owner.typelist) free(selection_owner.typelist);
+
+	selection_owner.wid = wid;
+
+	if(wid) {
+		if(!(selection_owner.typelist = strdup(typelist))) {
+			GsError(GR_ERROR_MALLOC_FAILED, wid);
+			selection_owner.wid = 0;
+		}
+	} else selection_owner.typelist = NULL;
+
+	GsDeliverSelectionChangedEvent(oldwid, wid);
+}
+
+GR_WINDOW_ID
+GrGetSelectionOwner(GR_CHAR **typelist)
+{
+	*typelist = selection_owner.typelist;
+	return selection_owner.wid;
+}
+
+void
+GrRequestClientData(GR_WINDOW_ID wid, GR_WINDOW_ID rid, GR_SERIALNO serial,
+							GR_MIMETYPE mimetype)
+{
+	GsDeliverClientDataReqEvent(rid, wid, serial, mimetype);
+}
+
+void
+GrSendClientData(GR_WINDOW_ID wid, GR_WINDOW_ID did, GR_SERIALNO serial,
+				GR_LENGTH len, GR_LENGTH thislen, void *data)
+{
+	void *p;
+
+	if(!(p = malloc(len))) GsError(GR_ERROR_MALLOC_FAILED, wid);
+	memcpy(p, data, thislen);
+
+	GsDeliverClientDataEvent(did, wid, serial, len, thislen, p);
+}
+
+/*
+ * Set a window's background pixmap.  Note that this doesn't
+ * cause a screen refresh, use GrClearWindow if required.
+ */
+void
+GrSetBackgroundPixmap(GR_WINDOW_ID wid, GR_WINDOW_ID pixmap, int flags)
+{
+	GR_WINDOW *wp;
+	GR_PIXMAP *pp = NULL;
+
+	if (!(wp = GsFindWindow(wid))) {
+		GsError(GR_ERROR_BAD_WINDOW_ID, wid);
+		return;
+	}
+
+	if (pixmap && !(pp = GsFindPixmap(pixmap))) {
+		GsError(GR_ERROR_BAD_WINDOW_ID, pixmap);
+		return;
+	}
+	wp->bgpixmap = pp;
+	wp->bgpixmapflags = flags;
+}
diff -urN lib/microwindows/src/nanox/srvmain.1 /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvmain.1
--- lib/microwindows/src/nanox/srvmain.1	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvmain.1	2005-02-21 16:13:35.000000000 +0100
@@ -0,0 +1,710 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Main module of graphics server.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <string.h>
+#include <signal.h>
+
+#ifdef __PACIFIC__
+#include <unixio.h>
+#else
+#include <errno.h>
+#include <sys/types.h>
+#endif
+
+#ifdef DOS_TURBOC
+#include <io.h>
+#endif
+
+#define MWINCLUDECOLORS
+#include "serv.h"
+#if UNIX | DOS_DJGPP
+#include <unistd.h>
+#if _MINIX
+#include <sys/times.h>
+#else
+#include <sys/time.h>
+#endif
+#endif
+
+#if ELKS
+#include <linuxmt/posix_types.h>
+#include <linuxmt/time.h>
+#endif
+
+/*
+ * External definitions defined here.
+ */
+GR_WINDOW_ID	cachewindowid;		/* cached window id */
+GR_WINDOW_ID    cachepixmapid;         /* cached pixmap id */
+GR_GC_ID	cachegcid;		/* cached graphics context id */
+GR_WINDOW	*cachewp;		/* cached window pointer */
+GR_GC		*cachegcp;		/* cached graphics context */
+GR_PIXMAP       *cachepp;               /* cached pixmap */
+GR_PIXMAP       *listpp;                /* List of all pixmaps */
+GR_WINDOW	*listwp;		/* list of all windows */
+GR_WINDOW	*rootwp;		/* root window pointer */
+GR_GC		*listgcp;		/* list of all gc */
+GR_REGION	*listregionp;		/* list of all regions */
+GR_FONT		*listfontp;		/* list of all fonts */
+GR_IMAGE	*listimagep;		/* list of all images */
+GR_GC		*curgcp;		/* currently enabled gc */
+GR_WINDOW	*clipwp;		/* window clipping is set for */
+GR_WINDOW	*focuswp;		/* focus window for keyboard */
+GR_WINDOW	*mousewp;		/* window mouse is currently in */
+GR_WINDOW	*grabbuttonwp;		/* window grabbed by button */
+GR_CURSOR	*curcursor;		/* currently enabled cursor */
+GR_COORD	cursorx;		/* current x position of cursor */
+GR_COORD	cursory;		/* current y position of cursor */
+int		curbuttons;		/* current state of buttons */
+GR_CLIENT	*curclient;		/* client currently executing for */
+GR_EVENT_LIST	*eventfree;		/* list of free events */
+GR_BOOL		focusfixed;		/* TRUE if focus is fixed on a window */
+GR_SCREEN_INFO	sinfo;			/* screen information */
+PMWFONT		stdfont;		/* default font*/
+int		escape_quits = 1;	/* terminate when pressing ESC */
+char		*progname;		/* Name of this program.. */
+
+int		current_fd;		/* the fd of the client talking to */
+int		connectcount = 0;		/* number of connections to server */
+GR_CLIENT	*root_client;		/* root entry of the client table */
+GR_CLIENT	*current_client;	/* the client we are currently talking*/
+char		*current_shm_cmds;
+int		current_shm_cmds_size;
+int		keyb_fd;		/* the keyboard file descriptor */
+int		mouse_fd;		/* the mouse file descriptor */
+char		*curfunc;		/* the name of the current server func*/
+GR_TIMEOUT	screensaver_delay;	/* time before screensaver activates */
+GR_BOOL		screensaver_active;	/* time before screensaver activates */
+GR_SELECTIONOWNER selection_owner;	/* the selection owner and typelist */
+GR_TIMEOUT	startTicks;		/* ms time server started*/
+
+static int	persistent_mode = 0;
+extern int	gr_portraitmode;
+
+#if !NONETWORK
+int		un_sock;		/* the server socket descriptor */
+
+static void
+usage(void)
+{
+	fprintf(stderr,"Usage: %s [-e] [-p] [-N] [-c <fontconfig-file> ...]\n",
+		progname);
+	exit(1);
+}
+
+/*
+ * This is the main server loop which initialises the server, services
+ * the clients, and shuts the server down when there are no more clients.
+ */
+int
+main(int argc, char *argv[])
+{
+	int t;
+	int read_configfile(char *file);
+
+	progname = argv[0];
+
+	t = 1;
+	while ( t < argc ) {
+		if ( !strcmp("-e",argv[t])) {
+			escape_quits = 0;
+			t++;
+			continue;
+		}
+		if ( !strcmp("-p",argv[t]) ) {
+			persistent_mode = 1;
+			t++;
+			continue;
+		}
+		if ( !strcmp("-N",argv[t]) ) {
+			gr_portraitmode = 0;
+			t++;
+			continue;
+		}
+#if FONTMAPPER
+		if ( !strcmp("-c",argv[t]) ) {
+			if ( t+1 >= argc )
+				usage();
+			read_configfile(argv[t+1]);
+			t += 2;
+			continue;
+		}
+#endif
+		usage();
+	}
+
+	/* Attempt to initialise the server*/
+	if(GsInitialize() < 0)
+		exit(1);
+
+	while(1)
+		GsSelect(0L);
+	return 0;
+}
+#endif
+
+void
+GsAcceptClientFd(int i)
+{
+	GR_CLIENT *client, *cl;
+
+	if(!(client = malloc(sizeof(GR_CLIENT)))) {
+		close(i);
+		return;
+	}
+
+	client->id = i;
+	client->eventhead = NULL;
+	client->eventtail = NULL;
+	/*client->errorevent.type = GR_EVENT_TYPE_NONE;*/
+	client->next = NULL;
+	client->prev = NULL;
+	client->waiting_for_event = FALSE;
+	client->shm_cmds = 0;
+
+	if(connectcount++ == 0)
+		root_client = client;
+	else {
+		cl = root_client;
+			while(cl->next)
+				cl = cl->next;
+		client->prev = cl;
+		cl->next = client;
+	}
+}
+
+/*
+ * Open a connection from a new client to the server.
+ * Returns -1 on failure.
+ */
+int
+GrOpen(void)
+{
+#if NONETWORK
+	escape_quits = 1;
+
+	/* Client calls this routine once.  We 
+	 * init everything here
+	 */
+	if (connectcount <= 0) {
+		if(GsInitialize() < 0)
+			return -1;
+		GsAcceptClientFd(999);
+		curclient = root_client;
+	}
+#endif
+        return 1;
+}
+
+/*
+ * Close the current connection to the server.
+ */
+void
+GrClose(void)
+{
+	GsClose(current_fd);
+}
+
+/*
+ * Drop a specific server connection.
+ */
+void
+GsClose(int fd)
+{
+	GsDropClient(fd);
+	if(!persistent_mode && connectcount == 0)
+		GsTerminate();
+}
+
+#if NONETWORK
+/* client/server GsDropClient is in srvnet.c*/
+void
+GsDropClient(int fd)
+{
+	--connectcount;
+}
+#endif
+
+#if UNIX | DOS_DJGPP
+#if NONETWORK
+/*
+ * Register the specified file descriptor to return an event
+ * when input is ready.
+ * FIXME: only one external file descriptor works
+ */
+static int regfd = -1;
+
+void
+GrRegisterInput(int fd)
+{
+	regfd = fd;
+}
+#endif /* NONETWORK*/
+#endif /* UNIX | DOS_DJGPP*/
+
+#if NONETWORK
+void
+GrFlush(void)
+{
+}
+
+void
+GrMainLoop(GR_FNCALLBACKEVENT fncb)
+{
+	GR_EVENT event;
+
+	for(;;) {
+		GrGetNextEvent(&event);
+		fncb(&event);
+	}
+}
+
+void
+GrReqShmCmds(long shmsize)
+{
+	/* no action required, no client/server*/
+}
+#endif
+
+
+#if VXWORKS
+
+#define POLLTIME	100   /* polling sleep interval (in msec) */
+#define MAX_MOUSEEVENTS	10    /* max number of mouse event to get in 1 select */
+#define MAX_KEYBDEVENTS	10    /* max number of mouse event to get in 1 select */
+
+extern void GdSleep(int dwMilliseconds);
+
+void 
+GsSelect(GR_TIMEOUT timeout)
+{
+	int mouseevents = 0;
+	int keybdevents = 0;
+	GR_TIMEOUT waittime = 0;
+	GR_EVENT_GENERAL *gp;
+
+
+	/* input gathering loop */
+	while (1)
+	{
+
+		/* perform pre-select duties, if any */
+		if(scrdev.PreSelect)
+		{
+			scrdev.PreSelect(&scrdev);
+		}
+
+
+		/* If mouse data present, service it */
+		while (mousedev.Poll() > 0)
+		{
+			GsCheckMouseEvent();
+			if (mouseevents++ > MAX_MOUSEEVENTS)
+			{
+				/* don't handle too many events at one shot */
+				break;
+			}
+		}
+
+
+		/* If keyboard data present, service it */
+		while (kbddev.Poll() > 0)
+		{
+			GsCheckKeyboardEvent();
+			if (keybdevents++ > MAX_KEYBDEVENTS)
+			{
+				/* don't handle too many events at one shot */
+				break;
+			}
+		}
+
+		
+		/* did we process any input yet? */
+		if ((mouseevents > 0) || (keybdevents > 0))
+		{
+			/* yep -- return without sleeping */
+			return;
+		}
+
+
+		/* give up time-slice & sleep for a bit */
+		GdSleep(POLLTIME);
+		waittime += POLLTIME; 
+
+
+		/* have we timed out? */
+		if (waittime >= timeout)
+		{
+			/* special case: polling when timeout == 0 -- don't send timeout event */
+			if (timeout != 0)
+			{
+				/* Timeout has occured.  
+				** Currently return a timeout event regardless of whether client 
+				**   has selected for it.
+				*/
+				if ((gp = (GR_EVENT_GENERAL *)GsAllocEvent(curclient)) != NULL)
+				{
+					gp->type = GR_EVENT_TYPE_TIMEOUT;
+				}
+			}
+			return;
+		}
+	}
+
+}
+
+#elif MSDOS | _MINIX
+
+void
+GsSelect(GR_TIMEOUT timeout)
+{
+	/* If mouse data present, service it*/
+	if(mousedev.Poll())
+		while(GsCheckMouseEvent())
+			continue;
+
+	/* If keyboard data present, service it*/
+	if(kbddev.Poll())
+		while(GsCheckKeyboardEvent())
+			continue;
+
+}
+
+#elif UNIX && defined(HAVESELECT)
+
+void
+GsSelect(GR_TIMEOUT timeout)
+{
+	fd_set	rfds;
+	int 	e;
+	int	setsize = 0;
+	struct timeval to;
+
+	/* perform pre-select duties, if any*/
+	if(rootwp->psd->PreSelect)
+		rootwp->psd->PreSelect(rootwp->psd);
+
+	/* Set up the FDs for use in the main select(): */
+	FD_ZERO(&rfds);
+	if(mouse_fd >= 0) {
+		FD_SET(mouse_fd, &rfds);
+		if (mouse_fd > setsize)
+			setsize = mouse_fd;
+	}
+	if(keyb_fd >= 0) {
+		FD_SET(keyb_fd, &rfds);
+		if (keyb_fd > setsize)
+			setsize = keyb_fd;
+	}
+#if NONETWORK
+	/* handle registered input file descriptors*/
+	if (regfd != -1) {
+		FD_SET(regfd, &rfds);
+		if (regfd > setsize) setsize = regfd;
+	}
+#else
+	/* handle client socket connections*/
+	FD_SET(un_sock, &rfds);
+	if (un_sock > setsize) setsize = un_sock;
+	curclient = root_client;
+	while(curclient) {
+		if(curclient->waiting_for_event && curclient->eventhead) {
+			curclient->waiting_for_event = FALSE;
+			GrGetNextEventWrapperFinish(curclient->id);
+			return;
+		}
+		FD_SET(curclient->id, &rfds);
+		if(curclient->id > setsize) setsize = curclient->id;
+		curclient = curclient->next;
+	}
+#endif
+	/* Set up the timeout for the main select(): */
+	if (timeout) {
+		to.tv_sec = timeout / 1000;
+		to.tv_usec = (timeout % 1000) * 1000;
+	} else {
+		to.tv_sec = 0L;
+		to.tv_usec = 10000L;	/* min 10ms for VT switch*/
+	}
+
+	/* Wait for some input on any of the fds in the set or a timeout: */
+	if((e = select(setsize+1, &rfds, NULL, NULL, &to)) > 0) {
+		
+		/* If data is present on the mouse fd, service it: */
+		if(mouse_fd >= 0 && FD_ISSET(mouse_fd, &rfds))
+			while(GsCheckMouseEvent())
+				continue;
+
+		/* If data is present on the keyboard fd, service it: */
+		if(keyb_fd >= 0 && FD_ISSET(keyb_fd, &rfds))
+			while(GsCheckKeyboardEvent())
+				continue;
+
+#if NONETWORK
+		/* If registered input descriptor, handle it*/
+		if(regfd != -1 && FD_ISSET(regfd, &rfds)) {
+			GR_EVENT_FDINPUT *	gp;
+			gp = (GR_EVENT_FDINPUT *)GsAllocEvent(curclient);
+			if(gp) {
+				gp->type = GR_EVENT_TYPE_FDINPUT;
+				gp->fd = regfd;
+			}
+		}
+#else
+		/* If a client is trying to connect, accept it: */
+		if(FD_ISSET(un_sock, &rfds))
+			GsAcceptClient();
+
+		/* If a client is sending us a command, handle it: */
+		curclient = root_client;
+		while(curclient) {
+			GR_CLIENT *curclient_next;
+
+			/* curclient may be freed in GsDropClient*/
+			curclient_next = curclient->next;
+			if(FD_ISSET(curclient->id, &rfds))
+				GsHandleClient(curclient->id);
+			curclient = curclient_next;
+		}
+#endif
+	} 
+	else if (e == 0) {
+#if NONETWORK
+		/* 
+		 * Timeout has occured.  Currently return
+		 * a timeout event regardless of whether
+		 * client has selected for it.
+		 */
+		if (timeout) {
+			GR_EVENT_GENERAL *	gp;
+			gp = (GR_EVENT_GENERAL *)GsAllocEvent(curclient);
+			if(gp)
+				gp->type = GR_EVENT_TYPE_TIMEOUT;
+		}
+#endif
+#if VTSWITCH
+		if(MwCheckVtChange())
+			GsRedrawScreen();
+#endif
+	} else
+		if(errno != EINTR)
+			EPRINTF("Select() call in main failed\n");
+}
+#endif /* GsSelect() implementations*/
+
+/*
+ * Initialize the graphics and mouse devices at startup.
+ * Returns nonzero with a message printed if the initialization failed.
+ */
+int
+GsInitialize(void)
+{
+	GR_WINDOW	*wp;		/* root window */
+	PSD		psd;
+	static MWIMAGEBITS cursorbits[16] = {
+	      0xe000, 0x9800, 0x8600, 0x4180,
+	      0x4060, 0x2018, 0x2004, 0x107c,
+	      0x1020, 0x0910, 0x0988, 0x0544,
+	      0x0522, 0x0211, 0x000a, 0x0004
+	};
+	static MWIMAGEBITS cursormask[16] = {
+	      0xe000, 0xf800, 0xfe00, 0x7f80,
+	      0x7fe0, 0x3ff8, 0x3ffc, 0x1ffc,
+	      0x1fe0, 0x0ff0, 0x0ff8, 0x077c,
+	      0x073e, 0x021f, 0x000e, 0x0004
+	};
+
+	wp = (GR_WINDOW *) malloc(sizeof(GR_WINDOW));
+	if (wp == NULL) {
+		EPRINTF("Cannot allocate root window\n");
+		return -1;
+	}
+
+	startTicks = GsGetTickCount();
+
+	/* catch terminate signal to restore tty state*/
+	signal(SIGTERM, (void *)GsTerminate);
+
+	screensaver_delay = 0;
+	screensaver_active = GR_FALSE;
+	signal(SIGALRM, GsActivateScreenSaver);
+
+	selection_owner.wid = 0;
+	selection_owner.typelist = NULL;
+
+#if !NONETWORK
+	/* ignore pipe signal, sent when clients exit*/
+	signal(SIGPIPE, SIG_IGN);
+	signal(SIGHUP, SIG_IGN);
+
+	if (GsOpenSocket() < 0) {
+		EPRINTF("Cannot bind to named socket\n");
+		free(wp);
+		return -1;
+	}
+#endif
+
+	if ((keyb_fd = GdOpenKeyboard()) == -1) {
+		EPRINTF("Cannot initialise keyboard\n");
+		/*GsCloseSocket();*/
+		free(wp);
+		return -1;
+	}
+
+	if ((psd = GdOpenScreen()) == NULL) {
+		EPRINTF("Cannot initialise screen\n");
+		/*GsCloseSocket();*/
+		GdCloseKeyboard();
+		free(wp);
+		return -1;
+	}
+
+	if ((mouse_fd = GdOpenMouse()) == -1) {
+		EPRINTF("Cannot initialise mouse\n");
+		/*GsCloseSocket();*/
+		GdCloseScreen(psd);
+		GdCloseKeyboard();
+		free(wp);
+		return -1;
+	}
+
+	/*
+	 * Get screen dimensions for our own use,
+	 */
+	GdGetScreenInfo(psd, &sinfo);
+#if (HAVE_BIG5_SUPPORT | HAVE_GB2312_SUPPORT)
+	/* system fixed font looks better when mixed with chinese fonts*/
+	stdfont = GdCreateFont(psd, MWFONT_SYSTEM_FIXED, 0, NULL);
+#else
+	stdfont = GdCreateFont(psd, MWFONT_SYSTEM_VAR, 0, NULL);
+#endif
+
+	/*
+	 * Initialize the root window.
+	 */
+	wp->psd = psd;
+	wp->id = GR_ROOT_WINDOW_ID;
+	wp->parent = NULL;		/* changed: was = NULL*/
+	wp->owner = NULL;
+	wp->children = NULL;
+	wp->siblings = NULL;
+	wp->next = NULL;
+	wp->x = 0;
+	wp->y = 0;
+	wp->width = sinfo.cols;
+	wp->height = sinfo.rows;
+	wp->bordersize = 0;
+	wp->background = BLACK;
+	wp->bordercolor = BLACK;
+	wp->nopropmask = 0;
+	wp->bgpixmap = NULL;
+	wp->bgpixmapflags = GR_BACKGROUND_TILE;
+	wp->eventclients = NULL;
+	wp->cursor = NULL;
+	wp->mapped = GR_TRUE;
+	wp->unmapcount = 0;
+	wp->output = GR_TRUE;
+	wp->props = 0;
+	wp->title = NULL;
+
+        listpp = NULL;
+	listwp = wp;
+	rootwp = wp;
+	focuswp = wp;
+	mousewp = wp;
+	focusfixed = GR_FALSE;
+
+	/*
+	 * Initialize and position the default cursor.
+	 */
+	curcursor = NULL;
+	cursorx = -1;
+	cursory = -1;
+	GdShowCursor(psd);
+	GrMoveCursor(sinfo.cols / 2, sinfo.rows / 2);
+	GrSetCursor(GR_ROOT_WINDOW_ID, 16, 16, 0, 0, WHITE, BLACK,
+		cursorbits, cursormask);
+
+#if VTSWITCH
+	MwInitVt();
+#endif
+	psd->FillRect(psd, 0, 0, sinfo.cols-1, sinfo.rows-1,
+		GdFindColor(BLACK));
+
+	/*
+	 * Tell the mouse driver some things.
+	 */
+	curbuttons = 0;
+	GdRestrictMouse(0, 0, sinfo.cols - 1, sinfo.rows - 1);
+	GdMoveMouse(sinfo.cols / 2, sinfo.rows / 2);
+
+	/* Force root window screen paint*/
+	GsRedrawScreen();
+
+	/* 
+	 * Force the cursor to appear on the screen at startup.
+	 * (not required with above GsRedrawScreen)
+	GdHideCursor(&scrdev);
+	GdShowCursor(&scrdev);
+	 */
+
+	/*
+	 * All done.
+	 */
+	connectcount = 0;
+	return 0;
+}
+
+/*
+ * Here to close down the server.
+ */
+void
+GsTerminate(void)
+{
+#if !NONETWORK
+	GsCloseSocket();
+#endif
+	GdCloseScreen(rootwp->psd);
+	GdCloseMouse();
+	GdCloseKeyboard();
+#if VTSWITCH
+	MwRedrawVt(mwvterm);
+#endif
+	exit(0);
+}
+
+/*
+ * Return # milliseconds elapsed since start of Microwindows
+ * Granularity is 25 msec
+ */
+GR_TIMEOUT
+GsGetTickCount(void)
+{
+#if MSDOS
+#include <time.h>
+	return (DWORD)(clock() * 1000 / CLOCKS_PER_SEC);
+#else
+#if _MINIX
+	struct tms	t;
+	
+	return (DWORD)times(&t) * 16;
+#else
+#if UNIX
+	struct timeval t;
+
+	gettimeofday(&t, NULL);
+	return ((t.tv_sec * 1000) + (t.tv_usec / 25000) * 25) - startTicks;
+#else
+	return 0L;
+#endif
+#endif
+#endif
+}
diff -urN lib/microwindows/src/nanox/srvmain.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvmain.c
--- lib/microwindows/src/nanox/srvmain.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvmain.c	2005-02-21 16:13:32.000000000 +0100
@@ -0,0 +1,5 @@
+#if ECOS
+#include "srvmain_ecos.c"
+#else
+#include "srvmain_orig.c"
+#endif
diff -urN lib/microwindows/src/nanox/srvmain_ecos.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvmain_ecos.c
--- lib/microwindows/src/nanox/srvmain_ecos.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvmain_ecos.c	2005-02-21 16:13:35.000000000 +0100
@@ -0,0 +1,517 @@
+/*
+ * Copyright (c) 2001 I-Jui Sung <ijsung@csie.nctu.edu.tw>
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Main module of graphics server.
+ */
+
+#define MWINCLUDECOLORS
+#include "mwtypes.h"
+
+#include <stdio.h>
+#include <cyg/kernel/kapi.h>
+#include <cyg/infra/diag.h>
+#include <pthread.h>
+#include <mqueue.h>
+#include <fcntl.h> /*for O_xxxx */
+#include <serv.h>
+#include <sys/malloc.h>
+#include <time.h>
+#include <errno.h>
+#include <sys/types.h>
+
+#if GTKSCREEN
+#include "serv.h"
+#endif
+
+#include <unistd.h>
+#include "mqproto.h"
+
+/*
+ * External definitions defined here.
+ */
+GR_WINDOW_ID	cachewindowid;		/* cached window id */
+GR_WINDOW_ID    cachepixmapid;         /* cached pixmap id */
+GR_GC_ID	cachegcid;		/* cached graphics context id */
+GR_WINDOW	*cachewp;		/* cached window pointer */
+GR_GC		*cachegcp;		/* cached graphics context */
+GR_PIXMAP       *cachepp;               /* cached pixmap */
+GR_PIXMAP       *listpp;                /* List of all pixmaps */
+GR_WINDOW	*listwp;		/* list of all windows */
+GR_WINDOW	*rootwp;		/* root window pointer */
+GR_GC		*listgcp;		/* list of all gc */
+GR_REGION	*listregionp;		/* list of all regions */
+GR_FONT		*listfontp;		/* list of all fonts */
+GR_IMAGE	*listimagep;		/* list of all images */
+GR_GC		*curgcp;		/* currently enabled gc */
+GR_WINDOW	*clipwp;		/* window clipping is set for */
+GR_WINDOW	*focuswp;		/* focus window for keyboard */
+GR_WINDOW	*mousewp;		/* window mouse is currently in */
+GR_WINDOW	*grabbuttonwp;		/* window grabbed by button */
+GR_CURSOR	*curcursor;		/* currently enabled cursor */
+GR_COORD	cursorx;		/* current x position of cursor */
+GR_COORD	cursory;		/* current y position of cursor */
+int		curbuttons;		/* current state of buttons */
+GR_CLIENT	*curclient;		/* client currently executing for */
+GR_EVENT_LIST	*eventfree;		/* list of free events */
+GR_BOOL		focusfixed;		/* TRUE if focus is fixed on a window */
+GR_SCREEN_INFO	sinfo;			/* screen information */
+PMWFONT		stdfont;		/* default font*/
+int		escape_quits = 1;	/* terminate when pressing ESC */
+char		*progname;		/* Name of this program.. */
+int		PREFIX(current_fd);	/* the fd of the client talking to */
+int		connectcount = 0;		/* number of connections to server */
+GR_CLIENT	*root_client;		/* root entry of the client table */
+GR_CLIENT	*current_client;	/* the client we are currently talking*/
+char		*current_shm_cmds;
+int		current_shm_cmds_size;
+int		keyb_fd;		/* the keyboard file descriptor */
+int		mouse_fd;		/* the mouse file descriptor */
+char		*curfunc;		/* the name of the current server func*/
+GR_TIMEOUT	screensaver_delay;	/* time before screensaver activates */
+GR_BOOL		screensaver_active;	/* time before screensaver activates */
+GR_SELECTIONOWNER selection_owner;	/* the selection owner and typelist */
+GR_TIMEOUT	startTicks;		/* ms time server started*/
+
+static int	persistent_mode = 0;
+extern int	gr_portraitmode;
+
+/* Export Global Variables */
+mqd_t		PREFIX(nanoXq);		/* eCos use POSIX mqueue*/
+size_t		PREFIX(nanoXqBufSize);	/*Receive Buffer Size(must >= so)*/
+
+/* in eCos, the nanoX is a thread */
+static int GsInitialize(void);
+
+
+pthread_key_t PerThreadNanoXDataKey;
+
+typedef struct
+{
+	pthread_t	handle;
+	void * (*funcp)(void *);
+}nanoxclient_t ;
+
+#if 1
+extern void * NanoXdemo (void *);
+static nanoxclient_t demo={(pthread_t)0, NanoXdemo};
+
+extern void * eCos_NanoWM (void *);
+static nanoxclient_t nanowm={(pthread_t)0, eCos_NanoWM};
+
+#endif
+static int GsInitialize(void);
+
+/* The main start point -- create a nano-X server thread */
+void * nanoXServer(void *);
+
+
+#if GTKSCREEN||IOMONITOR
+/* The I/O monitor */
+static void * iomonitor(void * param)
+{
+	mqd_t	nxmq;
+	/*open server msg queue for write*/
+	diag_printf("I/O monitor thread:");
+	if((nxmq=mq_open(NXMQUEUE_NAME, O_WRONLY,NULL,NULL))==(mqd_t)-1)
+	{
+		diag_printf("Can't Open NanoX Server Message Queue for write.\n");
+		pthread_exit(NULL);
+	}
+	diag_printf("starting ok.\n");
+	/*check for the mouse events*/
+	while(1)
+	{
+		mqmessage msg;
+#if GTKSCREEN
+		extern int GtkServ_DetectMouseStateChange(void);
+		if(GtkServ_DetectMouseStateChange())
+#endif
+#if IOMONITOR
+		extern int Assabet_DetectMouseStateChange(void);
+		if(Assabet_DetectMouseStateChange())
+#endif
+		{
+			msg.type=MSG_EVENT_MOUSE;
+			mq_send(nxmq, (const char *)&msg,sizeof(msg),10);
+		}
+#if GTKSCREEN
+		cyg_thread_delay(10);
+#endif
+	}
+	return NULL;
+}
+#endif
+
+void	PerThreadNanoXData_destructor(void *p)
+{
+}
+//eCos main entry: POSIX compatibility
+int main(int argc, char *argv[])
+{
+	pthread_t nanoX_handle;
+	/* Create pthread key! */
+	pthread_key_create(&PerThreadNanoXDataKey,PerThreadNanoXData_destructor);
+	//diag_printf("nanoX: Per thread posix key=%d\n",PerThreadNanoXDataKey);
+
+	diag_printf("nanoX: creating main thread..\n");
+	/*Start main nano-x server thread*/
+	if(pthread_create(&nanoX_handle, NULL, nanoXServer, NULL))
+	{
+		diag_printf("Starting Nano X server failed!\n");
+		exit(-1);
+	}
+	pthread_detach(nanoX_handle);
+	cyg_thread_delay(10);
+#if 1
+
+	/*Start client*/
+	if(pthread_create(&demo.handle, NULL, demo.funcp,NULL))
+	{
+		diag_printf("Starting Demo failed!\n");
+	}
+	/* detach the thread so need not to explicitly free its resource */
+	pthread_detach(demo.handle);
+
+#if 1
+	cyg_thread_delay(10);
+	/*Start client*/
+	if(pthread_create(&nanowm.handle, NULL, nanowm.funcp,NULL))
+	{
+		diag_printf("Starting Demo failed!\n");
+	}
+	/* detach the thread so need not to explicitly free its resource */
+	pthread_detach(nanowm.handle);
+	cyg_thread_delay(50);
+
+#endif
+
+
+#endif
+
+	while(1)
+		cyg_thread_delay(50000);
+}
+
+void
+GsAcceptClientFd(int i)
+{
+	GR_CLIENT *client, *cl;
+
+	if(!(client = malloc(sizeof(GR_CLIENT)))) {
+		diag_printf("Can't malloc for client\n");
+		//mq_close(i);
+		return;
+	}
+
+	client->id = i;
+	client->eventhead = NULL;
+	client->eventtail = NULL;
+	/*client->errorevent.type = GR_EVENT_TYPE_NONE;*/
+	client->next = NULL;
+	client->prev = NULL;
+	client->waiting_for_event = FALSE;
+	client->shm_cmds = 0;
+
+	if(connectcount++ == 0)
+		root_client = client;
+	else {
+		cl = root_client;
+		while(cl->next)
+			cl = cl->next;
+		client->prev = cl;
+		cl->next = client;
+	}
+}
+/*
+ * Open a connection from a new client to the server.
+ * Returns -1 on failure.
+ */
+int
+PREFIX(GrOpen)(void)
+{
+#if NONETWORK
+        escape_quits = 1;
+
+        /* Client calls this routine once.  We 
+         * init everything here
+         */
+        if (connectcount <= 0) {
+                if(GsInitialize() < 0)
+                        return -1;
+                GsAcceptClientFd(999);
+                curclient = root_client;
+        }
+#endif
+        return 1;
+}
+/*
+ * Close the current connection to the server.
+ */
+void
+PREFIX(GrClose)(void)
+{
+        GsClose(PREFIX(current_fd));
+}
+/*
+ * Drop a specific server connection.
+ */
+void
+GsClose(int fd)
+{
+        GsDropClient(fd);
+        if(!persistent_mode && connectcount == 0)
+                GsTerminate();
+}
+/*
+ * Here to close down the server.
+ */
+void
+GsTerminate(void)
+{
+//        GsCloseSocket();
+        GdCloseScreen(rootwp->psd);
+        GdCloseMouse();
+//        GdCloseKeyboard();
+	pthread_exit(NULL);
+}
+/*
+ * This is the main server loop which initialises the server, services
+ * the clients, and shuts the server down when there are no more clients.
+ */
+
+void * nanoXServer(void * parm)
+{
+#if GTKSCREEN||IOMONITOR
+	pthread_t iomon_handle;
+#endif
+	/* open the message queue */
+	/* Attempt to initialise the server*/
+	if(GsInitialize() < 0) {
+		diag_printf("Can't Starting Nano-X Server Thread.\n");
+		pthread_exit(NULL);
+	}
+	else
+		diag_printf("Nano-X: Initialisation OK\n");
+#if GTKSCREEN||IOMONITOR
+	/*Start io monitor thread*/
+	if(pthread_create(&iomon_handle, NULL, iomonitor, NULL))
+	{
+		diag_printf("Starting I/O monitor failed!\n");
+		pthread_exit(NULL);
+	}
+	pthread_detach(iomon_handle);
+#endif
+	while(1)
+		GsSelect(0L);
+	/* can never run into here */
+	return (void *)0;
+}
+
+void
+GsSelect(GR_TIMEOUT timeout)
+{
+	unsigned prio;
+	int size;
+	mqmessage * msg;
+	/* gcc extensions: variable size array */
+	char buffer[PREFIX(nanoXqBufSize)];
+	msg=(mqmessage*)&buffer;
+	curclient = root_client;
+	while(curclient) {
+        	if(curclient->waiting_for_event && curclient->eventhead) {
+                	curclient->waiting_for_event = FALSE;
+                	GrGetNextEventWrapperFinish(curclient->id);
+                	return;
+        	}
+        	curclient = curclient->next;
+	}
+	size=mq_receive(PREFIX(nanoXq), buffer, PREFIX(nanoXqBufSize), &prio);
+	//assert(size==sizeof(mqmessage));
+	switch(msg->type)
+	{
+		case	MSG_EVENT_MOUSE:
+			while(GsCheckMouseEvent())
+				continue;
+			break;
+		case	MSG_CLIENT_CONNECT:
+			diag_printf("Server: A new client connection\n");
+			/* If a client is trying to connect, accept it: */
+			GsAcceptClientFd(msg->reply);
+			/* Tell client ok */
+			msg->type=MSG_CLIENT_CONNECT_ESTABLISHED;
+			if(write(msg->reply, (const char *)msg,sizeof(mqmessage))<=0)
+			{
+				diag_printf("can't send to client\n");
+			}
+			else
+				diag_printf("Nano X Server: Client Accepted \n");
+			break;
+		case	MSG_CLIENT_REQBUF:
+			//diag_printf("Server: Client reqbuf.\n");
+			curclient = root_client;
+			while(curclient) {
+				GR_CLIENT *curclient_next;
+				/* curclient may be freed in GsDropClient*/
+				curclient_next = curclient->next;
+				if(curclient->id==msg->reply)
+				{
+					GsHandleClient(msg);
+					break;
+				}
+				curclient = curclient_next;
+			}
+			break;
+		default:
+	}
+}
+
+/*
+ * Initialize the graphics and mouse devices at startup.
+ * Returns nonzero with a message printed if the initialization failed.
+ */
+static int
+GsInitialize(void)
+{
+	GR_WINDOW       *wp;            /* root window */
+	PSD psd;
+	static MWIMAGEBITS cursorbits[16] = {
+	      0xe000, 0x9800, 0x8600, 0x4180,
+	      0x4060, 0x2018, 0x2004, 0x107c,
+	      0x1020, 0x0910, 0x0988, 0x0544,
+	      0x0522, 0x0211, 0x000a, 0x0004
+	};
+	static MWIMAGEBITS cursormask[16] = {
+		0xe000, 0xf800, 0xfe00, 0x7f80,
+		0x7fe0, 0x3ff8, 0x3ffc, 0x1ffc,
+		0x1fe0, 0x0ff0, 0x0ff8, 0x077c,
+		0x073e, 0x021f, 0x000e, 0x0004
+	};
+
+	wp = (GR_WINDOW *) malloc(sizeof(GR_WINDOW));
+	if (wp == NULL) {
+        	EPRINTF("Cannot allocate root window\n");
+		return -1;
+	}
+
+	startTicks = GsGetTickCount();
+
+	screensaver_delay = 0;
+	screensaver_active = GR_FALSE;
+
+	selection_owner.wid = 0;
+	selection_owner.typelist = NULL;
+
+	if (GsOpenSocket() < 0) {
+		EPRINTF("Cannot bind to named socket\n");
+		free(wp);
+		return -1;
+	}
+
+	if ((psd = GdOpenScreen()) == NULL) {
+		diag_printf("Cannot initialise screen\n");
+		return -1;
+        }
+
+	if (GdOpenMouse() < 0) {
+        	EPRINTF("Cannot initialise mouse\n");
+#if 0
+		/*GsCloseSocket();*/
+		GdCloseScreen(psd);
+		//GdCloseKeyboard();
+		free(wp);
+		return -1;
+#endif
+	}
+	/*
+	 * Get screen dimensions for our own use,
+	 */
+	GdGetScreenInfo(psd, &sinfo);
+	/* system fixed font looks better when mixed with chinese fonts*/
+	stdfont = GdCreateFont(psd, MWFONT_SYSTEM_VAR, 0, NULL);
+	/*
+	 * Initialize the root window.
+	 */
+	wp->psd = psd;
+	wp->id = GR_ROOT_WINDOW_ID;
+	wp->parent = NULL;              /* changed: was = NULL*/
+	wp->owner = NULL;
+	wp->children = NULL;
+	wp->siblings = NULL;
+	wp->next = NULL;
+	wp->x = 0;
+	wp->y = 0;
+	wp->width = sinfo.cols;
+	wp->height = sinfo.rows;
+	wp->bordersize = 0;
+	wp->background = BLACK;
+	wp->bordercolor = BLACK;
+	wp->nopropmask = 0;
+	wp->bgpixmap = NULL;
+	wp->bgpixmapflags = GR_BACKGROUND_TILE;
+	wp->eventclients = NULL;
+	wp->cursor = NULL;
+	wp->mapped = GR_TRUE;
+	wp->unmapcount = 0;
+	wp->output = GR_TRUE;
+	wp->props = 0;
+	wp->title = NULL;
+
+	listpp = NULL;
+	listwp = wp;
+	rootwp = wp;
+	focuswp = wp;
+	mousewp = wp;
+	focusfixed = GR_FALSE;
+
+	/*
+	 * Initialize and position the default cursor.
+	 */
+	curcursor = NULL;
+	cursorx = -1;
+	cursory = -1;
+	GdShowCursor(psd);
+	PREFIX(GrMoveCursor)(sinfo.cols / 2, sinfo.rows / 2);
+	PREFIX(GrSetCursor)(GR_ROOT_WINDOW_ID, 16, 16, 0, 0, WHITE, BLACK,cursorbits, cursormask);
+
+	psd->FillRect(psd, 0, 0, sinfo.cols-1, sinfo.rows-1,
+		GdFindColor(BLACK));
+	/*
+	 * Tell the mouse driver some things.
+	 */
+	curbuttons = 0;
+	GdRestrictMouse(0, 0, sinfo.cols - 1, sinfo.rows - 1);
+#if ECOS
+	GdMoveMouse(0, 0);
+#else
+	GdMoveMouse(sinfo.cols / 2, sinfo.rows / 2);
+#endif
+
+	/* Force root window screen paint*/
+	GsRedrawScreen();
+	/*
+	 * All done.
+	 */
+	connectcount = 0;
+	return 0;
+}
+/*
+ * Return # milliseconds elapsed since start of Microwindows
+ * Granularity is 25 msec
+ */
+GR_TIMEOUT
+GsGetTickCount(void)
+{
+/* ecos hack..*/
+	time_t t;
+        return (GR_TIMEOUT)(time(&t));
+}
+void
+PREFIX(GrBell)(void)
+{
+        write(2, "\7", 1);
+}
+
diff -urN lib/microwindows/src/nanox/srvmain_orig.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvmain_orig.c
--- lib/microwindows/src/nanox/srvmain_orig.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvmain_orig.c	2005-02-21 16:13:35.000000000 +0100
@@ -0,0 +1,719 @@
+/*
+ * Copyright (c) 1999, 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Main module of graphics server.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <string.h>
+
+#ifdef __PACIFIC__
+#include <unixio.h>
+#else
+#include <errno.h>
+#include <sys/types.h>
+#endif
+
+#ifdef DOS_TURBOC
+#include <io.h>
+#endif
+
+#define MWINCLUDECOLORS
+#include "serv.h"
+#if UNIX | DOS_DJGPP
+#include <unistd.h>
+#if _MINIX
+#include <sys/times.h>
+#else
+#include <sys/time.h>
+#endif
+#endif
+
+#if ELKS
+#include <linuxmt/posix_types.h>
+#include <linuxmt/time.h>
+#endif
+
+/*
+ * External definitions defined here.
+ */
+GR_WINDOW_ID	cachewindowid;		/* cached window id */
+GR_WINDOW_ID    cachepixmapid;         /* cached pixmap id */
+GR_GC_ID	cachegcid;		/* cached graphics context id */
+GR_WINDOW	*cachewp;		/* cached window pointer */
+GR_GC		*cachegcp;		/* cached graphics context */
+GR_PIXMAP       *cachepp;               /* cached pixmap */
+GR_PIXMAP       *listpp;                /* List of all pixmaps */
+GR_WINDOW	*listwp;		/* list of all windows */
+GR_WINDOW	*rootwp;		/* root window pointer */
+GR_GC		*listgcp;		/* list of all gc */
+GR_REGION	*listregionp;		/* list of all regions */
+GR_FONT		*listfontp;		/* list of all fonts */
+GR_IMAGE	*listimagep;		/* list of all images */
+GR_GC		*curgcp;		/* currently enabled gc */
+GR_WINDOW	*clipwp;		/* window clipping is set for */
+GR_WINDOW	*focuswp;		/* focus window for keyboard */
+GR_WINDOW	*mousewp;		/* window mouse is currently in */
+GR_WINDOW	*grabbuttonwp;		/* window grabbed by button */
+GR_CURSOR	*curcursor;		/* currently enabled cursor */
+GR_COORD	cursorx;		/* current x position of cursor */
+GR_COORD	cursory;		/* current y position of cursor */
+int		curbuttons;		/* current state of buttons */
+GR_CLIENT	*curclient;		/* client currently executing for */
+GR_EVENT_LIST	*eventfree;		/* list of free events */
+GR_BOOL		focusfixed;		/* TRUE if focus is fixed on a window */
+GR_SCREEN_INFO	sinfo;			/* screen information */
+PMWFONT		stdfont;		/* default font*/
+int		escape_quits = 1;	/* terminate when pressing ESC */
+char		*progname;		/* Name of this program.. */
+
+int		current_fd;		/* the fd of the client talking to */
+int		connectcount = 0;		/* number of connections to server */
+GR_CLIENT	*root_client;		/* root entry of the client table */
+GR_CLIENT	*current_client;	/* the client we are currently talking*/
+char		*current_shm_cmds;
+int		current_shm_cmds_size;
+int		keyb_fd;		/* the keyboard file descriptor */
+int		mouse_fd;		/* the mouse file descriptor */
+char		*curfunc;		/* the name of the current server func*/
+GR_TIMEOUT	screensaver_delay;	/* time before screensaver activates */
+GR_BOOL		screensaver_active;	/* time before screensaver activates */
+GR_SELECTIONOWNER selection_owner;	/* the selection owner and typelist */
+GR_TIMEOUT	startTicks;		/* ms time server started*/
+
+static int	persistent_mode = 0;
+extern int	gr_portraitmode;
+
+#if !NONETWORK
+int		un_sock;		/* the server socket descriptor */
+
+static void
+usage(void)
+{
+	fprintf(stderr,"Usage: %s [-e] [-p] [-N] [-c <fontconfig-file> ...]\n",
+		progname);
+	exit(1);
+}
+
+/*
+ * This is the main server loop which initialises the server, services
+ * the clients, and shuts the server down when there are no more clients.
+ */
+int
+main(int argc, char *argv[])
+{
+	int t;
+	int read_configfile(char *file);
+
+	progname = argv[0];
+
+	t = 1;
+	while ( t < argc ) {
+		if ( !strcmp("-e",argv[t])) {
+			escape_quits = 0;
+			t++;
+			continue;
+		}
+		if ( !strcmp("-p",argv[t]) ) {
+			persistent_mode = 1;
+			t++;
+			continue;
+		}
+		if ( !strcmp("-N",argv[t]) ) {
+			gr_portraitmode = 0;
+			t++;
+			continue;
+		}
+#if FONTMAPPER
+		if ( !strcmp("-c",argv[t]) ) {
+			if ( t+1 >= argc )
+				usage();
+			read_configfile(argv[t+1]);
+			t += 2;
+			continue;
+		}
+#endif
+		usage();
+	}
+
+	/* Attempt to initialise the server*/
+	if(GsInitialize() < 0)
+		exit(1);
+
+	while(1)
+		GsSelect(0L);
+	return 0;
+}
+#endif
+
+void
+GsAcceptClientFd(int i)
+{
+	GR_CLIENT *client, *cl;
+
+	if(!(client = malloc(sizeof(GR_CLIENT)))) {
+		close(i);
+		return;
+	}
+
+	client->id = i;
+	client->eventhead = NULL;
+	client->eventtail = NULL;
+	/*client->errorevent.type = GR_EVENT_TYPE_NONE;*/
+	client->next = NULL;
+	client->prev = NULL;
+	client->waiting_for_event = FALSE;
+	client->shm_cmds = 0;
+
+	if(connectcount++ == 0)
+		root_client = client;
+	else {
+		cl = root_client;
+			while(cl->next)
+				cl = cl->next;
+		client->prev = cl;
+		cl->next = client;
+	}
+}
+
+/*
+ * Open a connection from a new client to the server.
+ * Returns -1 on failure.
+ */
+int
+GrOpen(void)
+{
+#if NONETWORK
+	escape_quits = 1;
+
+	/* Client calls this routine once.  We 
+	 * init everything here
+	 */
+	if (connectcount <= 0) {
+		if(GsInitialize() < 0)
+			return -1;
+		GsAcceptClientFd(999);
+		curclient = root_client;
+	}
+#endif
+        return 1;
+}
+
+/*
+ * Close the current connection to the server.
+ */
+void
+GrClose(void)
+{
+	GsClose(current_fd);
+}
+
+/*
+ * Drop a specific server connection.
+ */
+void
+GsClose(int fd)
+{
+	GsDropClient(fd);
+	if(!persistent_mode && connectcount == 0)
+		GsTerminate();
+}
+
+#if NONETWORK
+/* client/server GsDropClient is in srvnet.c*/
+void
+GsDropClient(int fd)
+{
+	--connectcount;
+}
+#endif
+
+#if UNIX | DOS_DJGPP
+#if NONETWORK
+/*
+ * Register the specified file descriptor to return an event
+ * when input is ready.
+ * FIXME: only one external file descriptor works
+ */
+static int regfd = -1;
+
+void
+GrRegisterInput(int fd)
+{
+	regfd = fd;
+}
+#endif /* NONETWORK*/
+#endif /* UNIX | DOS_DJGPP*/
+
+#if NONETWORK
+void
+GrFlush(void)
+{
+}
+
+void
+GrMainLoop(GR_FNCALLBACKEVENT fncb)
+{
+	GR_EVENT event;
+
+	for(;;) {
+		GrGetNextEvent(&event);
+		fncb(&event);
+	}
+}
+
+void
+GrReqShmCmds(long shmsize)
+{
+	/* no action required, no client/server*/
+}
+#endif
+
+
+#if VXWORKS
+
+#define POLLTIME	100   /* polling sleep interval (in msec) */
+#define MAX_MOUSEEVENTS	10    /* max number of mouse event to get in 1 select */
+#define MAX_KEYBDEVENTS	10    /* max number of mouse event to get in 1 select */
+
+extern void GdSleep(int dwMilliseconds);
+
+void 
+GsSelect(GR_TIMEOUT timeout)
+{
+	int mouseevents = 0;
+	int keybdevents = 0;
+	GR_TIMEOUT waittime = 0;
+	GR_EVENT_GENERAL *gp;
+
+
+	/* input gathering loop */
+	while (1)
+	{
+
+		/* perform pre-select duties, if any */
+		if(scrdev.PreSelect)
+		{
+			scrdev.PreSelect(&scrdev);
+		}
+
+
+		/* If mouse data present, service it */
+		while (mousedev.Poll() > 0)
+		{
+			GsCheckMouseEvent();
+			if (mouseevents++ > MAX_MOUSEEVENTS)
+			{
+				/* don't handle too many events at one shot */
+				break;
+			}
+		}
+
+
+		/* If keyboard data present, service it */
+		while (kbddev.Poll() > 0)
+		{
+			GsCheckKeyboardEvent();
+			if (keybdevents++ > MAX_KEYBDEVENTS)
+			{
+				/* don't handle too many events at one shot */
+				break;
+			}
+		}
+
+		
+		/* did we process any input yet? */
+		if ((mouseevents > 0) || (keybdevents > 0))
+		{
+			/* yep -- return without sleeping */
+			return;
+		}
+
+
+		/* give up time-slice & sleep for a bit */
+		GdSleep(POLLTIME);
+		waittime += POLLTIME; 
+
+
+		/* have we timed out? */
+		if (waittime >= timeout)
+		{
+			/* special case: polling when timeout == 0 -- don't send timeout event */
+			if (timeout != 0)
+			{
+				/* Timeout has occured.  
+				** Currently return a timeout event regardless of whether client 
+				**   has selected for it.
+				*/
+				if ((gp = (GR_EVENT_GENERAL *)GsAllocEvent(curclient)) != NULL)
+				{
+					gp->type = GR_EVENT_TYPE_TIMEOUT;
+				}
+			}
+			return;
+		}
+	}
+
+}
+
+#elif MSDOS | _MINIX
+
+void
+GsSelect(GR_TIMEOUT timeout)
+{
+	/* If mouse data present, service it*/
+	if(mousedev.Poll())
+		while(GsCheckMouseEvent())
+			continue;
+
+	/* If keyboard data present, service it*/
+	if(kbddev.Poll())
+		while(GsCheckKeyboardEvent())
+			continue;
+
+}
+
+#elif UNIX && defined(HAVESELECT)
+
+void
+GsSelect(GR_TIMEOUT timeout)
+{
+	fd_set	rfds;
+	int 	e;
+	int	setsize = 0;
+	struct timeval tout, *to;
+
+	/* perform pre-select duties, if any*/
+	if(rootwp->psd->PreSelect)
+		rootwp->psd->PreSelect(rootwp->psd);
+
+	/* Set up the FDs for use in the main select(): */
+	FD_ZERO(&rfds);
+	if(mouse_fd >= 0) {
+		FD_SET(mouse_fd, &rfds);
+		if (mouse_fd > setsize)
+			setsize = mouse_fd;
+	}
+	if(keyb_fd >= 0) {
+		FD_SET(keyb_fd, &rfds);
+		if (keyb_fd > setsize)
+			setsize = keyb_fd;
+	}
+#if NONETWORK
+	/* handle registered input file descriptors*/
+	if (regfd != -1) {
+		FD_SET(regfd, &rfds);
+		if (regfd > setsize) setsize = regfd;
+	}
+#else /* not NONETWORK */
+	/* handle client socket connections*/
+	FD_SET(un_sock, &rfds);
+	if (un_sock > setsize) setsize = un_sock;
+	curclient = root_client;
+	while(curclient) {
+		if(curclient->waiting_for_event && curclient->eventhead) {
+			curclient->waiting_for_event = FALSE;
+			GrGetNextEventWrapperFinish(curclient->id);
+			return;
+		}
+		FD_SET(curclient->id, &rfds);
+		if(curclient->id > setsize) setsize = curclient->id;
+		curclient = curclient->next;
+	}
+#endif /* NONETWORK */
+	/* Set up the timeout for the main select(): */
+	if(GdGetNextTimeout(&tout, timeout) == TRUE)
+		to = &tout;
+	else to = NULL;
+
+	/* Wait for some input on any of the fds in the set or a timeout: */
+	if((e = select(setsize+1, &rfds, NULL, NULL, to)) > 0) {
+		/* If data is present on the mouse fd, service it: */
+		if(mouse_fd >= 0 && FD_ISSET(mouse_fd, &rfds))
+			while(GsCheckMouseEvent())
+				continue;
+
+		/* If data is present on the keyboard fd, service it: */
+		if(keyb_fd >= 0 && FD_ISSET(keyb_fd, &rfds))
+			while(GsCheckKeyboardEvent())
+				continue;
+
+#if NONETWORK
+		/* If registered input descriptor, handle it*/
+		if(regfd != -1 && FD_ISSET(regfd, &rfds)) {
+			GR_EVENT_FDINPUT *	gp;
+			gp = (GR_EVENT_FDINPUT *)GsAllocEvent(curclient);
+			if(gp) {
+				gp->type = GR_EVENT_TYPE_FDINPUT;
+				gp->fd = regfd;
+			}
+		}
+#else /* not NONETWORK */
+		/* If a client is trying to connect, accept it: */
+		if(FD_ISSET(un_sock, &rfds))
+			GsAcceptClient();
+
+		/* If a client is sending us a command, handle it: */
+		curclient = root_client;
+		while(curclient) {
+			GR_CLIENT *curclient_next;
+
+			/* curclient may be freed in GsDropClient*/
+			curclient_next = curclient->next;
+			if(FD_ISSET(curclient->id, &rfds))
+				GsHandleClient(curclient->id);
+			curclient = curclient_next;
+		}
+#endif /* NONETWORK */
+	} 
+	else if (e == 0) {
+#if NONETWORK
+		/* 
+		 * Timeout has occured.  Currently return
+		 * a timeout event regardless of whether
+		 * client has selected for it.
+		 */
+		if(GdTimeout() == TRUE) {
+			GR_EVENT_GENERAL *	gp;
+			gp = (GR_EVENT_GENERAL *)GsAllocEvent(curclient);
+			if(gp)
+				gp->type = GR_EVENT_TYPE_TIMEOUT;
+		}
+#else /* not NONETWORK */
+		GdTimeout();
+#endif /* NONETWORK */
+	} else
+		if(errno != EINTR)
+			EPRINTF("Select() call in main failed\n");
+}
+#endif /* UNIX && defined(HAVESELECT)*/
+
+#if VTSWITCH
+static void
+CheckVtChange(void *arg)
+{
+	if(MwCheckVtChange())
+		GsRedrawScreen();
+	GdAddTimer(50, CheckVtChange, NULL);
+}
+#endif
+  
+/*
+ * Initialize the graphics and mouse devices at startup.
+ * Returns nonzero with a message printed if the initialization failed.
+ */
+int
+GsInitialize(void)
+{
+	GR_WINDOW	*wp;		/* root window */
+	PSD		psd;
+	static MWIMAGEBITS cursorbits[16] = {
+	      0xe000, 0x9800, 0x8600, 0x4180,
+	      0x4060, 0x2018, 0x2004, 0x107c,
+	      0x1020, 0x0910, 0x0988, 0x0544,
+	      0x0522, 0x0211, 0x000a, 0x0004
+	};
+	static MWIMAGEBITS cursormask[16] = {
+	      0xe000, 0xf800, 0xfe00, 0x7f80,
+	      0x7fe0, 0x3ff8, 0x3ffc, 0x1ffc,
+	      0x1fe0, 0x0ff0, 0x0ff8, 0x077c,
+	      0x073e, 0x021f, 0x000e, 0x0004
+	};
+
+	wp = (GR_WINDOW *) malloc(sizeof(GR_WINDOW));
+	if (wp == NULL) {
+		EPRINTF("Cannot allocate root window\n");
+		return -1;
+	}
+
+	startTicks = GsGetTickCount();
+
+	/* catch terminate signal to restore tty state*/
+	signal(SIGTERM, (void *)GsTerminate);
+
+	screensaver_delay = 0;
+	screensaver_active = GR_FALSE;
+
+	selection_owner.wid = 0;
+	selection_owner.typelist = NULL;
+
+#if !NONETWORK
+	/* ignore pipe signal, sent when clients exit*/
+	signal(SIGPIPE, SIG_IGN);
+	signal(SIGHUP, SIG_IGN);
+
+	if (GsOpenSocket() < 0) {
+		EPRINTF("Cannot bind to named socket\n");
+		free(wp);
+		return -1;
+	}
+#endif
+
+	if ((keyb_fd = GdOpenKeyboard()) == -1) {
+		EPRINTF("Cannot initialise keyboard\n");
+		/*GsCloseSocket();*/
+		free(wp);
+		return -1;
+	}
+
+	if ((psd = GdOpenScreen()) == NULL) {
+		EPRINTF("Cannot initialise screen\n");
+		/*GsCloseSocket();*/
+		GdCloseKeyboard();
+		free(wp);
+		return -1;
+	}
+
+	if ((mouse_fd = GdOpenMouse()) == -1) {
+		EPRINTF("Cannot initialise mouse\n");
+		/*GsCloseSocket();*/
+		GdCloseScreen(psd);
+		GdCloseKeyboard();
+		free(wp);
+		return -1;
+	}
+
+	/*
+	 * Get screen dimensions for our own use,
+	 */
+	GdGetScreenInfo(psd, &sinfo);
+#if (HAVE_BIG5_SUPPORT | HAVE_GB2312_SUPPORT)
+	/* system fixed font looks better when mixed with chinese fonts*/
+	stdfont = GdCreateFont(psd, MWFONT_SYSTEM_FIXED, 0, NULL);
+#else
+	stdfont = GdCreateFont(psd, MWFONT_SYSTEM_VAR, 0, NULL);
+#endif
+
+	/*
+	 * Initialize the root window.
+	 */
+	wp->psd = psd;
+	wp->id = GR_ROOT_WINDOW_ID;
+	wp->parent = NULL;		/* changed: was = NULL*/
+	wp->owner = NULL;
+	wp->children = NULL;
+	wp->siblings = NULL;
+	wp->next = NULL;
+	wp->x = 0;
+	wp->y = 0;
+	wp->width = sinfo.cols;
+	wp->height = sinfo.rows;
+	wp->bordersize = 0;
+	wp->background = BLACK;
+	wp->bordercolor = BLACK;
+	wp->nopropmask = 0;
+	wp->bgpixmap = NULL;
+	wp->bgpixmapflags = GR_BACKGROUND_TILE;
+	wp->eventclients = NULL;
+	wp->cursor = NULL;
+	wp->mapped = GR_TRUE;
+	wp->unmapcount = 0;
+	wp->output = GR_TRUE;
+	wp->props = 0;
+	wp->title = NULL;
+
+        listpp = NULL;
+	listwp = wp;
+	rootwp = wp;
+	focuswp = wp;
+	mousewp = wp;
+	focusfixed = GR_FALSE;
+
+	/*
+	 * Initialize and position the default cursor.
+	 */
+	curcursor = NULL;
+	cursorx = -1;
+	cursory = -1;
+	GdShowCursor(psd);
+	GrMoveCursor(sinfo.cols / 2, sinfo.rows / 2);
+	GrSetCursor(GR_ROOT_WINDOW_ID, 16, 16, 0, 0, WHITE, BLACK,
+		cursorbits, cursormask);
+
+#if VTSWITCH
+	MwInitVt();
+	/* Check for VT change every 50 ms: */
+	GdAddTimer(50, CheckVtChange, NULL);
+#endif
+	psd->FillRect(psd, 0, 0, sinfo.cols-1, sinfo.rows-1,
+		GdFindColor(BLACK));
+
+	/*
+	 * Tell the mouse driver some things.
+	 */
+	curbuttons = 0;
+	GdRestrictMouse(0, 0, sinfo.cols - 1, sinfo.rows - 1);
+	GdMoveMouse(sinfo.cols / 2, sinfo.rows / 2);
+
+	/* Force root window screen paint*/
+	GsRedrawScreen();
+
+	/* 
+	 * Force the cursor to appear on the screen at startup.
+	 * (not required with above GsRedrawScreen)
+	GdHideCursor(&scrdev);
+	GdShowCursor(&scrdev);
+	 */
+
+	/*
+	 * All done.
+	 */
+	connectcount = 0;
+	return 0;
+}
+
+/*
+ * Here to close down the server.
+ */
+void
+GsTerminate(void)
+{
+#if !NONETWORK
+	GsCloseSocket();
+#endif
+	GdCloseScreen(rootwp->psd);
+	GdCloseMouse();
+	GdCloseKeyboard();
+#if VTSWITCH
+	MwRedrawVt(mwvterm);
+#endif
+	exit(0);
+}
+
+/*
+ * Return # milliseconds elapsed since start of Microwindows
+ * Granularity is 25 msec
+ */
+GR_TIMEOUT
+GsGetTickCount(void)
+{
+#if MSDOS
+#include <time.h>
+	return (DWORD)(clock() * 1000 / CLOCKS_PER_SEC);
+#else
+#if _MINIX
+	struct tms	t;
+	
+	return (DWORD)times(&t) * 16;
+#else
+#if UNIX
+	struct timeval t;
+
+	gettimeofday(&t, NULL);
+	return ((t.tv_sec * 1000) + (t.tv_usec / 25000) * 25) - startTicks;
+#else
+	return 0L;
+#endif
+#endif
+#endif
+}
+
+void
+GrBell(void)
+{
+	write(2, "\7", 1);
+}
diff -urN lib/microwindows/src/nanox/srvnet.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvnet.c
--- lib/microwindows/src/nanox/srvnet.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvnet.c	2005-02-21 16:13:33.000000000 +0100
@@ -0,0 +1,1823 @@
+/*
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1999 Alex Holden <alex@linuxhacker.org>
+ * Copyright (c) 2000 Vidar Hokstad
+ * Copyright (c) 2000 Morten Rolland <mortenro@screenmedia.no>
+ * Portions Copyright (c) 1991 David I. Bell
+ *
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Completely rewritten for speed by Greg Haerr
+ *
+ * This is the server side of the network interface, which accepts
+ * connections from clients, receives functions from them, and dispatches
+ * events to them.
+ */
+#if ECOS
+#include <unistd.h>
+#include <assert.h>
+#if 0
+#include <malloc.h>
+#endif
+#include "mqproto.h"
+#include "serv.h"
+#include "nxproto.h"
+
+#include <stdio.h>
+#include <cyg/kernel/kapi.h>
+#include <cyg/infra/diag.h>
+#include <pthread.h>
+#include <fcntl.h> /*for O_xxxx */
+static int GsWrite(int fd, void *buf, int c);
+#else
+
+#include <stdio.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#if HAVE_SHAREDMEM_SUPPORT
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#endif
+#if ELKS
+#include <linuxmt/na.h>
+#else
+#include <sys/un.h>
+#endif
+#include "serv.h"
+#include "nxproto.h"
+
+/* fix bad MIPS sys headers...*/
+#ifndef SOCK_STREAM
+#define SOCK_STREAM	2	/* <asm/socket.h>*/
+#endif
+
+#endif /*ECOS*/
+
+#if ECOS
+extern	mqd_t		PREFIX(nanoXq);		/*POSIX mqueue instead of socket*/
+extern  size_t		PREFIX(nanoXqBufSize);
+#else 
+extern	int		un_sock;
+#endif
+
+extern	GR_CLIENT	*root_client;
+#if ECOS
+extern  int             PREFIX(current_fd);             /* the fd of the client talking to */
+static	int GsWriteType(int,short);
+static	void GsFlush(int fd);
+#define GSWRITEBUF	1024
+static	char		ServerReplyBuf[GSWRITEBUF];
+static	mqmessage	ServerReply={MSG_SERVER_REPLY,0, 0, (void *)NULL};
+#define FLUSH	GsFlush(PREFIX(current_fd))
+#else
+
+extern  int             current_fd;             /* the fd of the client talking to */
+static int GsWriteType(int,short);
+#define FLUSH	
+
+#endif
+
+/*
+ * Wrapper functions called after full packet read
+ */
+static void 
+GrOpenWrapper(void *r)
+{
+	PREFIX(GrOpen)();	/* code in srvmain_ecos.c, simply return 1 */
+}
+
+static void
+GrCloseWrapper(void *r)
+{
+	PREFIX(GrClose)();
+}
+
+static void
+GrGetScreenInfoWrapper(void *r)
+{
+	GR_SCREEN_INFO si;
+
+	PREFIX(GrGetScreenInfo)(&si);
+
+	GsWriteType(PREFIX(current_fd),GrNumGetScreenInfo);
+	GsWrite(PREFIX(current_fd), &si, sizeof(si));
+	FLUSH;
+}
+
+static void
+GrGetSysColorWrapper(void *r)
+{
+	nxGetSysColorReq *req = r;
+	GR_COLOR color = PREFIX(GrGetSysColor)(req->index);
+	GsWriteType(PREFIX(current_fd), GrNumGetSysColor);
+	GsWrite(PREFIX(current_fd), &color, sizeof(color));
+	FLUSH;
+}
+
+static void
+GrNewWindowWrapper(void *r)
+{
+	nxNewWindowReq *req = r;
+	GR_WINDOW_ID	wid;
+
+	wid = PREFIX(GrNewWindow)(req->parentid, req->x, req->y, req->width,
+		req->height, req->bordersize, req->backgroundcolor,
+		req->bordercolor);
+
+	GsWriteType(PREFIX(current_fd),GrNumNewWindow);
+	GsWrite(PREFIX(current_fd), &wid, sizeof(wid));
+	FLUSH;
+
+}
+
+
+static void
+GrNewPixmapWrapper(void *r)
+{
+	nxNewPixmapReq *req = r;
+	GR_WINDOW_ID	wid;
+
+        /* FIXME: Add support for passing info about shared memory
+	 * segment
+	 */
+	wid = PREFIX(GrNewPixmap)(req->width, req->height, 0);
+
+	GsWriteType(PREFIX(current_fd),GrNumNewPixmap);
+	GsWrite(PREFIX(current_fd), &wid, sizeof(wid));
+	FLUSH;
+}
+
+static void
+GrNewInputWindowWrapper(void *r)
+{
+	nxNewInputWindowReq *req = r;
+	GR_WINDOW_ID         wid;
+
+	wid = PREFIX(GrNewInputWindow)(req->parentid, req->x, req->y, req->width,
+		req->height);
+	GsWriteType(PREFIX(current_fd),GrNumNewInputWindow);
+	GsWrite(PREFIX(current_fd), &wid, sizeof(wid));
+	FLUSH;
+}
+
+static void
+GrDestroyWindowWrapper(void *r)
+{
+	nxDestroyWindowReq *req = r;
+
+	PREFIX(GrDestroyWindow)(req->windowid);
+}
+
+static void
+GrNewGCWrapper(void *r)
+{
+	GR_GC_ID gc = PREFIX(GrNewGC)();
+
+	GsWriteType(PREFIX(current_fd),GrNumNewGC);
+	GsWrite(PREFIX(current_fd), &gc, sizeof(gc));
+	FLUSH;
+}
+
+static void
+GrCopyGCWrapper(void *r)
+{
+	nxCopyGCReq *req = r;
+	GR_GC_ID     gcnew;
+
+	gcnew = PREFIX(GrCopyGC)(req->gcid);
+	GsWriteType(PREFIX(current_fd),GrNumCopyGC);
+	GsWrite(PREFIX(current_fd), &gcnew, sizeof(gcnew));
+	FLUSH;
+}
+
+static void
+GrGetGCInfoWrapper(void *r)
+{
+	nxGetGCInfoReq *req = r;
+	GR_GC_INFO      gcinfo;
+
+	PREFIX(GrGetGCInfo)(req->gcid, &gcinfo);
+	GsWriteType(PREFIX(current_fd),GrNumGetGCInfo);
+	GsWrite(PREFIX(current_fd), &gcinfo, sizeof(gcinfo));
+	FLUSH;
+}
+
+static void
+GrDestroyGCWrapper(void *r)
+{
+	nxDestroyGCReq *req = r;
+
+	PREFIX(GrDestroyGC)(req->gcid);
+}
+
+static void
+GrNewRegionWrapper(void *r)
+{
+	GR_REGION_ID region = PREFIX(GrNewRegion)();
+
+	GsWriteType(PREFIX(current_fd), GrNumNewRegion);
+	GsWrite(PREFIX(current_fd), &region, sizeof(region));
+	FLUSH;
+}
+
+static void
+GrDestroyRegionWrapper(void *r)
+{
+	nxDestroyRegionReq *req = r;
+
+	PREFIX(GrDestroyRegion)(req->regionid);
+}
+
+static void
+GrIntersectRegionWrapper(void *r)
+{
+	nxIntersectRegionReq *req = r;
+
+	PREFIX(GrIntersectRegion)(req->regionid, req->srcregionid1,
+		req->srcregionid2);
+}
+
+static void
+GrUnionRectWithRegionWrapper(void *r)
+{
+	nxUnionRectWithRegionReq *req = r;
+
+	PREFIX(GrUnionRectWithRegion)(req->regionid, &(req->rect));
+}
+
+static void
+GrUnionRegionWrapper(void *r)
+{
+	nxUnionRegionReq *req = r;
+
+	PREFIX(GrUnionRegion)(req->regionid, req->srcregionid1, req->srcregionid2);
+}
+
+static void
+GrSubtractRegionWrapper(void *r)
+{
+	nxSubtractRegionReq *req = r;
+
+	PREFIX(GrSubtractRegion)(req->regionid, req->srcregionid1, req->srcregionid2);
+}
+
+static void
+GrXorRegionWrapper(void *r)
+{
+	nxXorRegionReq *req = r;
+
+	PREFIX(GrXorRegion)(req->regionid, req->srcregionid1, req->srcregionid2);
+}
+
+static void
+GrPointInRegionWrapper(void *r)
+{
+	nxPointInRegionReq *req = r;
+	GR_BOOL ret_value = PREFIX(GrPointInRegion)(req->regionid, req->x, req->y);
+		
+	GsWriteType(PREFIX(current_fd), GrNumPointInRegion);
+	GsWrite(PREFIX(current_fd), &ret_value, sizeof(ret_value));
+	FLUSH;
+
+}
+
+static void
+GrRectInRegionWrapper(void *r)
+{
+	nxRectInRegionReq *req = r;
+	unsigned short ret_value;
+	
+	ret_value = (unsigned short)PREFIX(GrRectInRegion)(req->regionid,
+		req->x, req->y, req->w, req->h);
+		
+	GsWriteType(PREFIX(current_fd), GrNumRectInRegion);
+	GsWrite(PREFIX(current_fd), &ret_value, sizeof(ret_value));
+	FLUSH;
+
+}
+
+static void
+GrEmptyRegionWrapper(void *r)
+{
+	nxEmptyRegionReq *req = r;
+	GR_BOOL		  ret_value;
+	
+	ret_value = PREFIX(GrEmptyRegion)(req->regionid);
+	GsWriteType(PREFIX(current_fd), GrNumEmptyRegion);
+	GsWrite(PREFIX(current_fd), &ret_value, sizeof(ret_value));
+	FLUSH;
+
+}
+
+static void
+GrEqualRegionWrapper(void *r)
+{
+	nxEqualRegionReq *req = r;
+	GR_BOOL		  ret_value;
+	
+	ret_value = PREFIX(GrEqualRegion)(req->region1, req->region2);
+	GsWriteType(PREFIX(current_fd), GrNumEqualRegion);
+	GsWrite(PREFIX(current_fd), &ret_value, sizeof(ret_value));
+	FLUSH;
+
+}
+
+static void
+GrOffsetRegionWrapper(void *r)
+{
+	nxOffsetRegionReq *req = r;
+	
+	PREFIX(GrOffsetRegion)(req->region, req->dx, req->dy);
+}
+
+static void
+GrSetGCRegionWrapper(void *r)
+{
+	nxSetGCRegionReq *req = r;
+
+	PREFIX(GrSetGCRegion)(req->gcid, req->regionid);
+}
+
+static void
+GrGetRegionBoxWrapper(void *r)
+{
+	nxRectInRegionReq *req = r;
+	GR_BOOL		   ret_value;
+	GR_RECT		   ret_rect;
+
+	ret_value = PREFIX(GrGetRegionBox)(req->regionid, &ret_rect);
+		
+	GsWriteType(PREFIX(current_fd), GrNumGetRegionBox);
+	GsWrite(PREFIX(current_fd), &ret_rect, sizeof(ret_rect));
+	GsWriteType(PREFIX(current_fd), GrNumGetRegionBox);
+	GsWrite(PREFIX(current_fd), &ret_value, sizeof(ret_value));
+	FLUSH;
+}
+
+static void
+GrNewPolygonRegionWrapper(void *r)
+{
+	GR_REGION_ID region;
+	nxNewPolygonRegionReq *req = r;
+	int count;
+	
+	/* FIXME: unportable method, depends on sizeof(int) in GR_POINT*/
+	count = GetReqVarLen(req) / sizeof(GR_POINT);	
+	region = PREFIX(GrNewPolygonRegion)(req->mode, count,
+		(GR_POINT *)GetReqData(req));
+	
+	GsWriteType(PREFIX(current_fd), GrNumNewPolygonRegion);
+	GsWrite(PREFIX(current_fd), &region, sizeof(region));
+	FLUSH;
+}
+
+static void
+GrMapWindowWrapper(void *r)
+{
+	nxMapWindowReq *req = r;
+
+	PREFIX(GrMapWindow)(req->windowid);
+}
+
+static void
+GrUnmapWindowWrapper(void *r)
+{
+	nxUnmapWindowReq *req = r;
+
+	PREFIX(GrUnmapWindow)(req->windowid);
+}
+
+static void
+GrRaiseWindowWrapper(void *r)
+{
+	nxRaiseWindowReq *req = r;
+
+	PREFIX(GrRaiseWindow)(req->windowid);
+}
+
+static void
+GrLowerWindowWrapper(void *r)
+{
+	nxLowerWindowReq *req = r;
+
+	PREFIX(GrLowerWindow)(req->windowid);
+}
+
+static void
+GrMoveWindowWrapper(void *r)
+{
+	nxMoveWindowReq *req = r;
+
+	PREFIX(GrMoveWindow)(req->windowid, req->x, req->y);
+}
+
+static void
+GrResizeWindowWrapper(void *r)
+{
+	nxResizeWindowReq *req = r;
+
+	PREFIX(GrResizeWindow)(req->windowid, req->width, req->height);
+}
+
+static void
+GrReparentWindowWrapper(void *r)
+{
+	nxReparentWindowReq *req = r;
+
+	PREFIX(GrReparentWindow)(req->windowid, req->parentid, req->x, req->y);
+}
+
+static void
+GrGetWindowInfoWrapper(void *r)
+{
+	nxGetWindowInfoReq *req = r;
+	GR_WINDOW_INFO      wi;
+
+	PREFIX(GrGetWindowInfo)(req->windowid, &wi);
+	GsWriteType(PREFIX(current_fd),GrNumGetWindowInfo);
+	GsWrite(PREFIX(current_fd), &wi, sizeof(wi));
+	FLUSH;
+}
+
+static void
+GrGetFontInfoWrapper(void *r)
+{
+	nxGetFontInfoReq *req = r;
+	GR_FONT_INFO      fi;
+
+	PREFIX(GrGetFontInfo)(req->fontid, &fi);
+	GsWriteType(PREFIX(current_fd),GrNumGetFontInfo);
+	GsWrite(PREFIX(current_fd), &fi, sizeof(fi));
+	FLUSH;
+}
+
+static void
+GrGetFocusWrapper(void *r)
+{
+	GR_WINDOW_ID wid = PREFIX(GrGetFocus)();
+
+	GsWriteType(PREFIX(current_fd), GrNumGetFocus);
+	GsWrite(PREFIX(current_fd), &wid, sizeof(wid));
+	FLUSH;
+}
+
+static void
+GrSetFocusWrapper(void *r)
+{
+	nxSetFocusReq *req = r;
+
+	PREFIX(GrSetFocus)(req->windowid);
+}
+
+static void
+GrSetBorderColorWrapper(void *r)
+{
+	nxSetBorderColorReq *req = r;
+
+	PREFIX(GrSetBorderColor)(req->windowid, req->color);
+}
+
+static void
+GrClearWindowWrapper(void *r)
+{
+	nxClearWindowReq *req = r;
+
+	PREFIX(GrClearWindow)(req->windowid, req->exposeflag);
+}
+
+static void
+GrSelectEventsWrapper(void *r)
+{
+	nxSelectEventsReq *req = r;
+
+	PREFIX(GrSelectEvents)(req->windowid, req->eventmask);
+}
+
+static void
+GrGetNextEventWrapper(void *r)
+{
+#if 1
+	/* tell main loop to call Finish routine on event*/
+	curclient->waiting_for_event = TRUE;
+#else
+	GR_EVENT evt;
+
+	/* first check if any event ready*/
+	GrCheckNextEvent(&evt);
+	if(evt.type == GR_EVENT_TYPE_NONE) {
+		/* tell main loop to call Finish routine on event*/
+		curclient->waiting_for_event = TRUE;
+		return;
+	}
+
+	GsWriteType(PREFIX(current_fd), GrNumGetNextEvent);
+	GsWrite(PREFIX(current_fd), &evt, sizeof(evt));
+	if(evt.type == GR_EVENT_TYPE_CLIENT_DATA) {
+		GsWrite(fd, evt.data, evt.datalen);
+		free(evt.data);
+	}
+#endif
+}
+
+/* Complete the GrGetNextEvent call from client.
+ * The client is still waiting on a read at this point.
+ */
+void
+GrGetNextEventWrapperFinish(int fd)
+{
+	GR_EVENT evt;
+	GR_EVENT_CLIENT_DATA *cde;
+
+	/* get the event and pass it to client*/
+	/* this will never be GR_EVENT_TYPE_NONE*/
+	PREFIX(GrCheckNextEvent)(&evt);
+
+	GsWriteType(fd,GrNumGetNextEvent);
+	GsWrite(fd, &evt, sizeof(evt));
+	if(evt.type == GR_EVENT_TYPE_CLIENT_DATA) {
+		cde = (GR_EVENT_CLIENT_DATA *)&evt;
+		if(cde->data) {
+			GsWrite(fd, cde->data, cde->datalen);
+			free(cde->data);
+		} cde->datalen = 0;
+	}
+#if ECOS
+	GsFlush(fd);	/* should write to fd, not curclient->id , sigh.*/
+#endif
+}
+
+static void
+GrCheckNextEventWrapper(void *r)
+{
+	GR_EVENT evt;
+	GR_EVENT_CLIENT_DATA *cde;
+
+	PREFIX(GrCheckNextEvent)(&evt);
+
+	GsWriteType(PREFIX(current_fd),GrNumGetNextEvent);
+	GsWrite(PREFIX(current_fd), &evt, sizeof(evt));
+	if(evt.type == GR_EVENT_TYPE_CLIENT_DATA) {
+		cde = (GR_EVENT_CLIENT_DATA *)&evt;
+		if(cde->data) {
+			GsWrite(PREFIX(current_fd), cde->data, cde->datalen);
+			free(cde->data);
+		} cde->datalen = 0;
+	}
+	FLUSH;
+}
+
+static void
+GrPeekEventWrapper(void *r)
+{
+	GR_EVENT evt;
+	GR_CHAR	 ret;
+	GR_EVENT_CLIENT_DATA *cde;
+
+	ret = PREFIX(GrPeekEvent)(&evt);
+
+	GsWriteType(PREFIX(current_fd),GrNumPeekEvent);
+	GsWrite(PREFIX(current_fd), &evt, sizeof(evt));
+	if(evt.type == GR_EVENT_TYPE_CLIENT_DATA) {
+		cde = (GR_EVENT_CLIENT_DATA *)&evt;
+		if(cde->data) {
+			GsWrite(PREFIX(current_fd), cde->data, cde->datalen);
+			free(cde->data);
+		} cde->datalen = 0;
+	}
+	GsWrite(PREFIX(current_fd), &ret, sizeof(GR_CHAR));
+	FLUSH;
+}
+
+static void
+GrLineWrapper(void *r)
+{
+	nxLineReq *req = r;
+
+	PREFIX(GrLine)(req->drawid, req->gcid, req->x1, req->y1, req->x2, req->y2);
+}
+
+static void
+GrPointWrapper(void *r)
+{
+	nxPointReq *req = r;
+
+	PREFIX(GrPoint)(req->drawid, req->gcid, req->x, req->y);
+
+}
+
+static void
+GrPointsWrapper(void *r)
+{
+	nxPointsReq *req = r;
+	int        count;
+
+	count = GetReqVarLen(req) / sizeof(GR_POINT);
+	PREFIX(GrPoints)(req->drawid, req->gcid, count, (GR_POINT *)GetReqData(req));
+}
+
+static void
+GrRectWrapper(void *r)
+{
+	nxRectReq *req = r;
+
+	PREFIX(GrRect)(req->drawid, req->gcid, req->x, req->y, req->width, req->height);
+}
+
+static void
+GrFillRectWrapper(void *r)
+{
+	nxFillRectReq *req = r;
+
+	PREFIX(GrFillRect)(req->drawid, req->gcid, req->x, req->y, req->width,
+		req->height);
+}
+
+static void
+GrPolyWrapper(void *r)
+{
+	nxPolyReq *req = r;
+	int        count;
+
+	count = GetReqVarLen(req) / sizeof(GR_POINT);
+	PREFIX(GrPoly)(req->drawid, req->gcid, count, (GR_POINT *)GetReqData(req));
+}
+
+/* FIXME: fails with pointtable size > 64k if sizeof(int) == 2*/
+static void
+GrFillPolyWrapper(void *r)
+{
+	nxPolyReq *req = r;
+	int        count;
+
+	count = GetReqVarLen(req) / sizeof(GR_POINT);
+	PREFIX(GrFillPoly)(req->drawid, req->gcid, count, (GR_POINT *)GetReqData(req));
+}
+
+static void
+GrEllipseWrapper(void *r)
+{
+	nxEllipseReq *req = r;
+
+	PREFIX(GrEllipse)(req->drawid, req->gcid, req->x, req->y, req->rx, req->ry);
+}
+
+static void
+GrFillEllipseWrapper(void *r)
+{
+	nxFillEllipseReq *req = r;
+
+	PREFIX(GrFillEllipse)(req->drawid, req->gcid, req->x, req->y, req->rx, req->ry);
+}
+
+static void
+GrArcWrapper(void *r)
+{
+	nxArcReq *req = r;
+
+	PREFIX(GrArc)(req->drawid, req->gcid, req->x, req->y, req->rx, req->ry,
+		req->ax, req->ay, req->bx, req->by, req->type);
+}
+
+static void
+GrArcAngleWrapper(void *r)
+{
+	nxArcAngleReq *req = r;
+
+	PREFIX(GrArcAngle)(req->drawid, req->gcid, req->x, req->y, req->rx, req->ry,
+		req->angle1, req->angle2, req->type);
+}
+
+static void
+GrSetGCForegroundWrapper(void *r)
+{
+	nxSetGCForegroundReq *req = r;
+
+	PREFIX(GrSetGCForeground)(req->gcid, req->color);
+}
+
+static void
+GrSetGCBackgroundWrapper(void *r)
+{
+	nxSetGCBackgroundReq *req = r;
+
+	PREFIX(GrSetGCBackground)(req->gcid, req->color);
+}
+
+static void
+GrSetGCUseBackgroundWrapper(void *r)
+{
+	nxSetGCUseBackgroundReq *req = r;
+
+	PREFIX(GrSetGCUseBackground)(req->gcid, req->flag);
+}
+
+static void
+GrSetGCModeWrapper(void *r)
+{
+	nxSetGCModeReq *req = r;
+
+	PREFIX(GrSetGCMode)(req->gcid, req->mode);
+}
+
+static void
+GrCreateFontWrapper(void *r)
+{
+	nxCreateFontReq *req = r;
+	GR_FONT_ID 	fontid;
+
+	if(req->lf_used)
+		fontid = PREFIX(GrCreateFont)(NULL, 0, &req->lf);
+	else
+		fontid = PREFIX(GrCreateFont)(req->lf.lfFaceName, req->height, NULL);
+
+	GsWriteType(PREFIX(current_fd),GrNumCreateFont);
+	GsWrite(PREFIX(current_fd), &fontid, sizeof(fontid));
+	FLUSH;
+}
+
+static void
+GrSetFontSizeWrapper(void *r)
+{
+	nxSetFontSizeReq *req = r;
+
+ 	PREFIX(GrSetFontSize)(req->fontid, req->fontsize);
+}
+
+static void
+GrSetFontRotationWrapper(void *r)
+{
+	nxSetFontRotationReq *req = r;
+
+ 	PREFIX(GrSetFontRotation)(req->fontid, req->tenthdegrees);
+}
+
+static void
+GrSetFontAttrWrapper(void *r)
+{
+	nxSetFontAttrReq *req = r;
+
+ 	PREFIX(GrSetFontAttr)(req->fontid, req->setflags, req->clrflags);
+}
+
+static void
+GrDestroyFontWrapper(void *r)
+{
+	nxDestroyFontReq *req = r;
+
+	PREFIX(GrDestroyFont)(req->fontid);
+}
+
+static void
+GrSetGCFontWrapper(void *r)
+{
+	nxSetGCFontReq *req = r;
+
+	PREFIX(GrSetGCFont)(req->gcid, req->fontid);
+}
+
+static void
+GrGetGCTextSizeWrapper(void *r)
+{
+	nxGetGCTextSizeReq *req = r;
+	GR_SIZE             retwidth, retheight, retbase;
+
+	PREFIX(GrGetGCTextSize)(req->gcid, GetReqData(req), GetReqVarLen(req),
+		req->flags, &retwidth, &retheight, &retbase);
+
+ 	GsWriteType(PREFIX(current_fd),GrNumGetGCTextSize);
+	GsWrite(PREFIX(current_fd), &retwidth, sizeof(retwidth));
+	GsWrite(PREFIX(current_fd), &retheight, sizeof(retheight));
+	GsWrite(PREFIX(current_fd), &retbase, sizeof(retbase));
+	FLUSH;
+}
+
+/* FIXME: fails with size > 64k if sizeof(int) == 2*/
+static void
+GsReadAreaWrapper(void *r)
+{
+	nxReadAreaReq *req = r;
+	int            size;
+	GR_PIXELVAL *   area;
+
+	/* FIXME: optimize for smaller pixelvals*/
+	size = req->width * req->height * sizeof(GR_PIXELVAL);
+
+	if(!(area = malloc(size))) {
+		/*GsPutCh(current_fd, GrRetENoMem);*/ /* FIXME*/
+		/*return;*/
+	}
+
+	PREFIX(GrReadArea)(req->drawid, req->x, req->y, req->width, req->height, area);
+	GsWriteType(PREFIX(current_fd),GrNumReadArea);
+	GsWrite(PREFIX(current_fd), area, size);
+	free(area);
+	FLUSH;
+}
+
+/* FIXME: fails with size > 64k if sizeof(int) == 2*/
+static void
+GrAreaWrapper(void *r)
+{
+	nxAreaReq *req = r;
+
+	PREFIX(GrArea)(req->drawid, req->gcid, req->x, req->y, req->width, req->height,
+		GetReqData(req), req->pixtype);
+}
+
+/* FIXME: fails with bitmapsize > 64k if sizeof(int) == 2*/
+static void
+GrBitmapWrapper(void *r)
+{
+	nxBitmapReq *req = r;
+
+	PREFIX(GrBitmap)(req->drawid, req->gcid, req->x, req->y, req->width,
+		req->height, GetReqData(req));
+}
+
+static void
+GrDrawImageBitsWrapper(void *r)
+{
+	nxDrawImageBitsReq *req = r;
+	char *		    addr;
+	int		    imagesize;
+	GR_IMAGE_HDR	    hdr;
+
+	hdr.width = req->width;
+	hdr.height = req->height;
+	hdr.planes = req->planes;
+	hdr.bpp = req->bpp;
+	hdr.pitch = req->pitch;
+	hdr.bytesperpixel = req->bytesperpixel;
+	hdr.compression = req->compression;
+	hdr.palsize = req->palsize;
+	hdr.transcolor = req->transcolor;
+	addr = GetReqData(req);
+	hdr.imagebits = (MWUCHAR *)addr;
+	imagesize = hdr.pitch * hdr.height;
+	hdr.palette = (MWPALENTRY *)(addr + imagesize);
+	PREFIX(GrDrawImageBits)(req->drawid, req->gcid, req->x, req->y, &hdr);
+}
+
+static void
+GrCopyAreaWrapper(void *r)
+{
+	nxCopyAreaReq *req = r;
+
+	PREFIX(GrCopyArea)(req->drawid, req->gcid, req->x, req->y, req->width, req->height,
+		req->srcid, req->srcx, req->srcy, req->op);
+}
+
+static void
+GrTextWrapper(void *r)
+{
+	nxTextReq *req = r;
+
+	PREFIX(GrText)(req->drawid, req->gcid, req->x, req->y, GetReqData(req),
+		req->count, req->flags);
+}
+
+static void
+GrSetCursorWrapper(void *r)
+{
+	nxSetCursorReq *req = r;
+	int		varlen;
+	char *          bitmap;
+
+	varlen = GetReqVarLen(req);
+	bitmap = GetReqData(req);
+
+	PREFIX(GrSetCursor)(req->windowid, req->width, req->height,
+		req->hotx, req->hoty, req->fgcolor, req->bgcolor, 
+		(GR_BITMAP *)bitmap, (GR_BITMAP *)(bitmap+varlen/2));
+}
+
+static void
+GrMoveCursorWrapper(void *r)
+{
+	nxMoveCursorReq *req = r;
+
+	PREFIX(GrMoveCursor)(req->x, req->y);
+}
+
+static void
+GrGetSystemPaletteWrapper(void *r)
+{
+	GR_PALETTE             pal;
+
+	PREFIX(GrGetSystemPalette)(&pal);
+	GsWriteType(PREFIX(current_fd),GrNumGetSystemPalette);
+	GsWrite(PREFIX(current_fd), &pal, sizeof(pal));
+	FLUSH;
+}
+
+static void
+GrSetSystemPaletteWrapper(void *r)
+{
+	nxSetSystemPaletteReq *req = r;
+	GR_PALETTE	       pal;
+
+	pal.count = req->count;
+	memcpy(pal.palette, req->palette, sizeof(pal.palette));
+	PREFIX(GrSetSystemPalette)(req->first, &pal);
+}
+
+static void
+GrFindColorWrapper(void *r)
+{
+	nxFindColorReq *req = r;
+	GR_PIXELVAL	pixel;
+
+	PREFIX(GrFindColor)(req->color, &pixel);
+	GsWriteType(PREFIX(current_fd),GrNumFindColor);
+	GsWrite(PREFIX(current_fd), &pixel, sizeof(pixel));
+	FLUSH;
+}
+
+static void
+GrInjectEventWrapper(void *r)
+{
+	nxInjectEventReq *req = r;
+
+	switch(req->event_type) {
+	case GR_INJECT_EVENT_POINTER:
+		PREFIX(GrInjectPointerEvent)(req->event.pointer.x,
+				     req->event.pointer.y,
+				     req->event.pointer.button,
+				     req->event.pointer.visible);
+		break;
+
+	case GR_INJECT_EVENT_KEYBOARD:
+		PREFIX(GrInjectKeyboardEvent)(req->event.keyboard.wid,
+				      req->event.keyboard.keyvalue,
+				      req->event.keyboard.modifier,
+				      req->event.keyboard.scancode,
+				      req->event.keyboard.pressed);
+		break;
+	}
+}
+
+static void
+GrSetWMPropertiesWrapper(void *r)
+{
+	nxSetWMPropertiesReq *req = r;
+	GR_WM_PROPERTIES *props = GetReqData(req);
+
+	if(GetReqVarLen(req) - sizeof(GR_WM_PROPERTIES)) 
+		props->title = (char *)props + sizeof(GR_WM_PROPERTIES);
+	else
+		props->title = NULL;
+	PREFIX(GrSetWMProperties)(req->windowid, props);
+}
+
+static void
+GrGetWMPropertiesWrapper(void *r)
+{
+	nxGetWMPropertiesReq *req = r;
+	UINT16 textlen;
+	GR_WM_PROPERTIES props;
+	
+	PREFIX(GrGetWMProperties)(req->windowid, &props);
+
+	if(props.title)
+		textlen = strlen(props.title) + 1;
+	else textlen = 0;
+
+	GsWriteType(PREFIX(current_fd),GrNumGetWMProperties);
+	GsWrite(PREFIX(current_fd), &props, sizeof(props));
+	GsWrite(PREFIX(current_fd), &textlen, sizeof(textlen));
+	if(textlen)
+		GsWrite(PREFIX(current_fd), props.title, textlen);
+	FLUSH;
+}
+
+static void
+GrCloseWindowWrapper(void *r)
+{
+	nxCloseWindowReq *req = r;
+
+	PREFIX(GrCloseWindow)(req->windowid);
+}
+
+static void
+GrKillWindowWrapper(void *r)
+{
+	nxKillWindowReq *req = r;
+
+	PREFIX(GrKillWindow)(req->windowid);
+}
+
+static void
+GrDrawImageFromFileWrapper(void *r)
+{
+	nxDrawImageFromFileReq *req = r;
+
+	PREFIX(GrDrawImageFromFile)(req->drawid, req->gcid, req->x, req->y, req->width,
+		req->height, GetReqData(req), req->flags);
+}
+
+static void
+GrLoadImageFromFileWrapper(void *r)
+{
+	nxLoadImageFromFileReq *req = r;
+	GR_IMAGE_ID		id;
+
+	id = PREFIX(GrLoadImageFromFile)(GetReqData(req), req->flags);
+	GsWriteType(PREFIX(current_fd), GrNumLoadImageFromFile);
+	GsWrite(PREFIX(current_fd), &id, sizeof(id));
+	FLUSH;
+}
+
+static void
+GrDrawImageToFitWrapper(void *r)
+{
+	nxDrawImageToFitReq *req = r;
+
+	PREFIX(GrDrawImageToFit)(req->drawid, req->gcid, req->x, req->y, req->width,
+		req->height, req->imageid);
+}
+
+static void
+GrFreeImageWrapper(void *r)
+{
+	nxFreeImageReq *req = r;
+
+	PREFIX(GrFreeImage)(req->id);
+}
+
+static void
+GrGetImageInfoWrapper(void *r)
+{
+	nxGetImageInfoReq *req = r;
+	GR_IMAGE_INFO	   info;
+
+	PREFIX(GrGetImageInfo)(req->id, &info);
+	GsWriteType(PREFIX(current_fd), GrNumGetImageInfo);
+	GsWrite(PREFIX(current_fd), &info, sizeof(info));
+	FLUSH;
+}
+
+static void
+GrSetScreenSaverTimeoutWrapper(void *r)
+{
+	nxSetScreenSaverTimeoutReq *req = r;
+
+	PREFIX(GrSetScreenSaverTimeout)(req->timeout);
+}
+
+static void
+GrSetSelectionOwnerWrapper(void *r)
+{
+	nxSetSelectionOwnerReq *req = r;
+
+	PREFIX(GrSetSelectionOwner)(req->wid, GetReqData(req));
+}
+
+static void
+GrGetSelectionOwnerWrapper(void *r)
+{
+	GR_CHAR *typelist;
+	GR_WINDOW_ID wid;
+	unsigned short len;
+
+	wid = PREFIX(GrGetSelectionOwner)(&typelist);
+	GsWriteType(PREFIX(current_fd), GrNumGetSelectionOwner);
+	GsWrite(PREFIX(current_fd), &wid, sizeof(wid));
+
+	if(wid) {
+		len = strlen(typelist) + 1;
+		GsWrite(PREFIX(current_fd), &len, sizeof(len));
+		GsWrite(PREFIX(current_fd), typelist, len);
+	}
+	FLUSH;
+}
+
+static void
+GrRequestClientDataWrapper(void *r)
+{
+	nxRequestClientDataReq *req = r;
+
+	PREFIX(GrRequestClientData)(req->wid, req->rid, req->serial, req->mimetype);
+}
+
+static void
+GrSendClientDataWrapper(void *r)
+{
+	nxSendClientDataReq *req = r;
+
+	PREFIX(GrSendClientData)(req->wid, req->did, req->serial, req->len,
+							GetReqVarLen(req),
+							GetReqData(req));
+}
+
+static void
+GrBellWrapper(void *r)
+{
+	PREFIX(GrBell)();
+}
+
+static void
+GrSetBackgroundPixmapWrapper(void *r)
+{
+	nxSetBackgroundPixmapReq *req = r;
+
+	PREFIX(GrSetBackgroundPixmap)(req->wid, req->pixmap, req->flags);
+}
+
+/*
+ * This function makes the Nano-X server set up a shared memory segment
+ * that the client can use when feeding the Nano-X server with requests.
+ * There is a corresponding GrShmCmdsFlush function that will make the
+ * server execute the batched commands.
+ */
+#define SHMKEY_BASE 1000000
+#define SHMKEY_MAX 256
+
+void
+GrReqShmCmdsWrapper(void *r)
+{
+#if HAVE_SHAREDMEM_SUPPORT
+	nxReqShmCmdsReq *req = r;
+	int 		key, shmid;
+	char 		*tmp;
+
+	if ( curclient->shm_cmds != 0 )
+		goto bad;
+
+	for ( key=SHMKEY_BASE; key < SHMKEY_BASE+SHMKEY_MAX; key++ ) {
+		shmid = shmget(key,req->size,IPC_CREAT|IPC_EXCL|0666);
+		if ( shmid == -1 ) {
+			if ( errno != EEXIST )
+				goto bad;
+		} else {
+			tmp = shmat(shmid,0,0);
+			if ( tmp == (char *)-1 )
+				goto bad;
+			curclient->shm_cmds = tmp;
+			curclient->shm_cmds_shmid = shmid;
+			curclient->shm_cmds_size = req->size;
+			goto finish;
+		}
+	}
+
+ bad:
+	key = 0;
+
+ finish:
+	DPRINTF("Shm: Request key granted=%d\n",key);
+	GsWrite(PREFIX(current_fd), &key, sizeof(key));
+#else
+	/* return no shared memory support*/
+	int key = 0;
+	GsWrite(PREFIX(current_fd), &key, sizeof(key));
+#endif /* HAVE_SHAREDMEM_SUPPORT*/
+}
+
+void GrShmCmdsFlushWrapper(void *r);
+
+/*
+ * Handler functions, ordered by reqType
+ */
+struct GrFunction {
+	void		(*func)(void *);
+	GR_FUNC_NAME 	name;
+} GrFunctions[] = {
+	/*   0 */ {GrOpenWrapper, "GrOpen"},
+	/*   1 */ {GrCloseWrapper, "GrClose"},
+	/*   2 */ {GrGetScreenInfoWrapper, "GrGetScreenInfo"},
+	/*   3 */ {GrNewWindowWrapper, "GrNewWindow"},
+	/*   4 */ {GrNewInputWindowWrapper, "GrNewInputWindow"},
+	/*   5 */ {GrDestroyWindowWrapper, "GrDestroyWindow"},
+	/*   6 */ {GrNewGCWrapper, "GrNewGC"},
+	/*   7 */ {GrCopyGCWrapper, "GrCopyGC"},
+	/*   8 */ {GrGetGCInfoWrapper, "GrGetGCInfo"},
+	/*   9 */ {GrDestroyGCWrapper, "GrDestroyGC"},
+	/*  10 */ {GrMapWindowWrapper, "GrMapWindow"},
+	/*  11 */ {GrUnmapWindowWrapper, "GrUnmapWindow"},
+	/*  12 */ {GrRaiseWindowWrapper, "GrRaiseWindow"},
+	/*  13 */ {GrLowerWindowWrapper, "GrLowerWindow"},
+	/*  14 */ {GrMoveWindowWrapper, "GrMoveWindow"},
+	/*  15 */ {GrResizeWindowWrapper, "GrResizeWindow"},
+	/*  16 */ {GrGetWindowInfoWrapper, "GrGetWindowInfo"},
+	/*  17 */ {GrGetFontInfoWrapper, "GrGetFontInfo"},
+	/*  18 */ {GrSetFocusWrapper, "GrSetFocus"},
+	/*  19 */ {GrSetBorderColorWrapper, "GrSetBorderColor"},
+	/*  20 */ {GrClearWindowWrapper, "GrClearWindowWrapper"},
+	/*  21 */ {GrSelectEventsWrapper, "GrSelectEvents"},
+	/*  22 */ {GrGetNextEventWrapper, "GrGetNextEvent"},
+	/*  23 */ {GrCheckNextEventWrapper, "GrCheckNextEvent"},
+	/*  24 */ {GrPeekEventWrapper, "GrPeekEvent"},
+	/*  25 */ {GrLineWrapper, "GrLine"},
+	/*  26 */ {GrPointWrapper, "GrPoint"},
+	/*  27 */ {GrRectWrapper, "GrRect"},
+	/*  28 */ {GrFillRectWrapper, "GrFillRect"},
+	/*  29 */ {GrPolyWrapper, "GrPoly"},
+	/*  30 */ {GrFillPolyWrapper, "GrFillPoly"},
+	/*  31 */ {GrEllipseWrapper, "GrEllipse"},
+	/*  32 */ {GrFillEllipseWrapper, "GrFillEllipse"},
+	/*  33 */ {GrSetGCForegroundWrapper, "GrSetGCForeground"},
+	/*  34 */ {GrSetGCBackgroundWrapper, "GrSetGCBackGround"},
+	/*  35 */ {GrSetGCUseBackgroundWrapper, "GrSetGCUseBackGround"},
+	/*  36 */ {GrSetGCModeWrapper, "GrSetGCMode"},
+	/*  37 */ {GrSetGCFontWrapper, "GrSetGCFont"},
+	/*  38 */ {GrGetGCTextSizeWrapper, "GrGetGCTextSize"},
+	/*  39 */ {GsReadAreaWrapper, "GsReadArea"},
+	/*  40 */ {GrAreaWrapper, "GrArea"},
+	/*  41 */ {GrBitmapWrapper, "GrBitmap"},
+	/*  42 */ {GrTextWrapper, "GrText"},
+	/*  43 */ {GrSetCursorWrapper, "GrSetCursor"},
+	/*  44 */ {GrMoveCursorWrapper, "GrMoveCursor"},
+	/*  45 */ {GrGetSystemPaletteWrapper, "GrGetSystemPalette"},
+	/*  46 */ {GrFindColorWrapper, "GrFindColor"},
+	/*  47 */ {GrReparentWindowWrapper, "GrReparentWindow"},
+	/*  48 */ {GrDrawImageFromFileWrapper, "GrDrawImageFromFile"},
+	/*  49 */ {GrLoadImageFromFileWrapper, "GrLoadImageFromFile"},
+	/*  50 */ {GrNewPixmapWrapper, "GrNewPixmap"},
+	/*  51 */ {GrCopyAreaWrapper, "GrCopyArea"},
+	/*  52 */ {GrSetFontSizeWrapper, "GrSetFontSize"},
+	/*  53 */ {GrCreateFontWrapper, "GrCreateFont"},
+	/*  54 */ {GrDestroyFontWrapper, "GrDestroyFont"},
+	/*  55 */ {GrReqShmCmdsWrapper, "GrReqShmCmds"},
+	/*  56 */ {GrShmCmdsFlushWrapper, "GrShmCmdsFlush"},
+	/*  57 */ {GrSetFontRotationWrapper, "GrSetFontRotation"},
+	/*  58 */ {GrSetFontAttrWrapper, "GrSetFontAttr"},
+	/*  59 */ {GrSetSystemPaletteWrapper, "GrSetSystemPalette"},
+	/*  60 */ {GrInjectEventWrapper, "GrInjectEvent"},
+	/*  61 */ {GrNewRegionWrapper, "GrNewRegion"},
+	/*  62 */ {GrDestroyRegionWrapper, "GrDestroyRegion"},
+	/*  63 */ {GrUnionRectWithRegionWrapper, "GrUnionRectWithRegion"},
+	/*  64 */ {GrUnionRegionWrapper, "GrUnionRegion"},
+	/*  65 */ {GrIntersectRegionWrapper, "GrIntersectRegion"},
+	/*  66 */ {GrSetGCRegionWrapper, "GrSetGCRegion"},
+	/*  67 */ {GrSubtractRegionWrapper, "GrSubtractRegion"},
+	/*  68 */ {GrXorRegionWrapper, "GrXorRegion"},
+	/*  69 */ {GrPointInRegionWrapper, "GrPointInRegion"},
+	/*  70 */ {GrRectInRegionWrapper, "GrRectInRegion"},	
+	/*  71 */ {GrEmptyRegionWrapper, "GrEmptyRegion"},	
+	/*  72 */ {GrEqualRegionWrapper, "GrEqualRegion"},	
+	/*  73 */ {GrOffsetRegionWrapper, "GrOffsetRegion"},	
+	/*  74 */ {GrGetRegionBoxWrapper, "GrGetRegionBox"},	
+	/*  75 */ {GrNewPolygonRegionWrapper, "GrNewPolygonRegion"},	
+	/*  76 */ {GrArcWrapper, "GrArc"},
+	/*  77 */ {GrArcAngleWrapper, "GrArcAngle"},
+	/*  78 */ {GrSetWMPropertiesWrapper, "GrSetWMProperties"},
+	/*  79 */ {GrGetWMPropertiesWrapper, "GrGetWMProperties"},
+	/*  80 */ {GrCloseWindowWrapper, "GrCloseWindow"},
+	/*  81 */ {GrKillWindowWrapper, "GrKillWindow"},
+	/*  82 */ {GrDrawImageToFitWrapper, "GrDrawImageToFit"},
+	/*  83 */ {GrFreeImageWrapper, "GrFreeImage"},
+	/*  84 */ {GrGetImageInfoWrapper, "GrGetImageInfo"},
+	/*  85 */ {GrDrawImageBitsWrapper, "GrDrawImageBits"},
+ 	/*  86 */ {GrPointsWrapper, "GrPoints"},
+ 	/*  87 */ {GrGetFocusWrapper, "GrGetFocus"},
+ 	/*  88 */ {GrGetSysColorWrapper, "GrGetSysColor"},
+	/*  89 */ {GrSetScreenSaverTimeoutWrapper, "GrSetScreenSaverTimeout"},
+	/*  90 */ {GrSetSelectionOwnerWrapper, "GrSetSelectionOwner"},
+	/*  91 */ {GrGetSelectionOwnerWrapper, "GrGetSelectionOwner"},
+	/*  92 */ {GrRequestClientDataWrapper, "GrRequestClientData"},
+	/*  93 */ {GrSendClientDataWrapper, "GrSendClientData"},
+	/*  94 */ {GrBellWrapper, "GrBell"},
+	/*  95 */ {GrSetBackgroundPixmapWrapper, "GrSetBackgroundPixmap"}
+};
+
+void
+GrShmCmdsFlushWrapper(void *r)
+{
+	nxShmCmdsFlushReq *req = r;
+	unsigned char 	reply;
+#if HAVE_SHAREDMEM_SUPPORT
+	nxReq 		*pr;
+	int 		length;
+	unsigned char 	*do_req, *do_req_last;
+
+	if ( current_shm_cmds == 0 || current_shm_cmds_size < req->size ) {
+		/* No or short shm present serverside, bug or mischief */
+		EPRINTF("nano-X: Ill behaved client assumes shm ok\n");
+		if ( req->reply ) {
+			reply = 0;
+			GsWrite(PREFIX(current_fd), &reply, 1);
+		}
+		return;
+	}
+
+	do_req = current_shm_cmds;
+	do_req_last = current_shm_cmds + req->size;
+
+	while ( do_req < do_req_last ) {
+		pr = (nxReq *)do_req;
+		length = GetReqAlignedLen(pr);
+		if ( pr->reqType < GrTotalNumCalls ) {
+			GrFunctions[pr->reqType].func(pr);
+		} else {
+			EPRINTF("nano-X: Error bad shm function!\n");
+		}
+		do_req += length;
+	}
+
+	if ( req->reply ) {
+		reply = 1;
+		GsWrite(PREFIX(current_fd), &reply, 1);
+	}
+#else
+	/* no shared memory support*/
+	if ( req->reply ) {
+		reply = 0;
+		GsWrite(PREFIX(current_fd), &reply, 1);
+	}
+#endif /* HAVE_SHAREDMEM_SUPPORT*/
+}
+/*
+ * This function is used to bind to the named socket which is used to
+ * accept connections from the clients.
+ */
+#if ECOS
+int
+GsOpenSocket(void)
+{
+	struct mq_attr attr;
+	DPRINTF("%s():\n", __FUNCTION__);
+	/*  open a r/o posix message q to handle all client/server communications */
+	/*  eCos don't care mode at all*/
+	PREFIX(nanoXq)=mq_open(NXMQUEUE_NAME, O_RDONLY|O_CREAT);
+	if(PREFIX(nanoXq)==(mqd_t)-1)
+	{
+		diag_printf("Can't open mqueue for nanoxq\n");
+		return -1;
+	}
+	/* query its max message size */
+	mq_getattr(PREFIX(nanoXq),&attr);
+	PREFIX(nanoXqBufSize)=attr.mq_msgsize;
+	diag_printf(NXMQUEUE_NAME":max message size = %d\n",attr.mq_msgsize);
+	return 1;
+}
+#else /*for other os != ecos*/
+int 
+GsOpenSocket(void)
+{
+	struct stat s;
+#if ELKS
+	struct sockaddr_na sckt;
+#ifndef SUN_LEN
+#define SUN_LEN(ptr)	(sizeof(sckt))
+#endif
+#else
+	struct sockaddr_un sckt;
+#ifndef SUN_LEN
+#define SUN_LEN(ptr)	((size_t) (((struct sockaddr_un *) 0)->sun_path) \
+		      		+ strlen ((ptr)->sun_path))
+#endif
+#endif /* ELKS */
+#if ELKS
+	if((un_sock = socket(AF_NANO, SOCK_STREAM, 0)) == -1)
+		return -1;
+
+	sckt.sun_family = AF_NANO;
+	sckt.sun_no = GR_NUMB_SOCKET;
+#else
+	/* Check if the file already exists: */
+	if(!stat(GR_NAMED_SOCKET, &s)) {
+		/* FIXME: should try connecting to see if server is active */
+		if(unlink(GR_NAMED_SOCKET))
+			return -1;
+	}
+
+	/* Create the socket: */
+	if((un_sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
+		return -1;
+
+	/* Bind a name to the socket: */
+	sckt.sun_family = AF_UNIX;
+	strncpy(sckt.sun_path, GR_NAMED_SOCKET, sizeof(sckt.sun_path));
+#endif /* ELKS */
+	if(bind(un_sock, (struct sockaddr *) &sckt, SUN_LEN(&sckt)) < 0)
+		return -1;
+
+	/* Start listening on the socket: */
+	if(listen(un_sock, 5) == -1)
+		return -1;
+	return 1;
+}
+#endif /* ECOS */
+void
+GsCloseSocket(void)
+{
+#if !ECOS
+	if(un_sock != -1)
+		close(un_sock);
+	un_sock = -1;
+	unlink(GR_NAMED_SOCKET);
+#endif
+}
+#if !ECOS
+/*
+ * This function is used to accept a connnection from a client.
+ */
+void
+GsAcceptClient(void)
+{
+	int i;
+#if ELKS
+	struct sockaddr_na sckt;
+#else
+	struct sockaddr_un sckt;
+#endif
+	size_t size = sizeof(sckt);
+
+	if((i = accept(un_sock, (struct sockaddr *) &sckt, &size)) == -1) {
+		EPRINTF("nano-X: Error accept failed (%d)\n", errno);
+		return;
+	}
+	GsAcceptClientFd(i);
+}
+#endif
+/*
+ * This function accepts a client ID, and searches through the
+ * linked list of clients, returning a pointer to the relevant
+ * structure or NULL if not found.
+ */
+GR_CLIENT *
+GsFindClient(int fd)
+{
+	GR_CLIENT *client;
+
+	client = root_client;
+
+	while(client) {
+		if(client->id == fd)
+			return(client);
+		client = client->next;
+	}
+	
+	return 0;
+}
+/*
+ * Destroy windows and eventclient structures used by client.
+ * Called by GsDropClient after a client has exited to clean
+ * up resources.
+ */
+void
+GsDestroyClientResources(GR_CLIENT * client)
+{
+	GR_WINDOW     * wp, *nwp;
+	GR_PIXMAP     * pp, *npp;
+	GR_GC 	      * gp, *ngp;
+	GR_REGION     * rp, *nrp;
+	GR_FONT       * fp, *nfp;
+	GR_IMAGE      * ip, *nip;
+	GR_EVENT_CLIENT *ecp, *necp;
+	GR_EVENT_CLIENT *pecp = NULL;
+	GR_EVENT_LIST	*evp;
+
+diag_printf("Destroy client %d resources\n", client->id);
+	/* search window list, destroy windows owned by client*/
+	for(wp=listwp; wp; wp=nwp) {
+		nwp = wp->next;
+		/*
+		 * Remove eventclient structures for this client
+		 */
+		ecp = wp->eventclients;
+		while (ecp) {
+			necp = ecp->next;
+			if (ecp->client == client) {
+diag_printf( "  Destroy window %d eventclient mask %08lx\n", wp->id, ecp->eventmask);
+				if (ecp == wp->eventclients)
+					wp->eventclients = ecp->next;
+				else
+					pecp->next = ecp->next;
+				free(ecp);
+			} else
+				pecp = ecp;
+			ecp = necp;
+		}
+		if (wp->owner == client) {
+diag_printf("  Destroy window %d\n", wp->id);
+			PREFIX(GrDestroyWindow)(wp->id);
+		}
+	}
+
+	/* search pixmap list, destroy pixmaps owned by client*/
+	for(pp=listpp; pp; pp=npp) {
+		npp = pp->next;
+		if (pp->owner == client) {
+diag_printf("  Destroy pixmap %d\n", pp->id);
+			PREFIX(GrDestroyWindow)(pp->id);
+		}
+	}
+
+	/* free gc's owned by client*/
+	for(gp=listgcp; gp; gp=ngp) {
+		ngp = gp->next;
+		if (gp->owner == client) {
+diag_printf("  Destroy gc %d\n", gp->id);
+			PREFIX(GrDestroyGC)(gp->id);
+		}
+	}
+
+	/* free fonts owned by client*/
+	for(fp=listfontp; fp; fp=nfp) {
+		nfp = fp->next;
+		if (fp->owner == client) {
+diag_printf("  Destroy font %d\n", fp->id);
+			PREFIX(GrDestroyFont)(fp->id);
+		}
+	}
+
+	/* free regions owned by client*/
+	for(rp=listregionp; rp; rp=nrp) {
+		nrp = rp->next;
+		if (rp->owner == client) {
+diag_printf("  Destroy region %d\n", rp->id);
+			PREFIX(GrDestroyRegion)(rp->id);
+		}
+	}
+
+	/* free images owned by client*/
+	for(ip=listimagep; ip; ip=nip) {
+		nip = ip->next;
+		if (ip->owner == client) {
+diag_printf("  Destroy image %d\n", ip->id);
+			PREFIX(GrFreeImage)(ip->id);
+		}
+	}
+
+	/* Free events associated with client*/
+	evp = client->eventhead;
+	while (evp) {
+diag_printf("  Destroy event %d\n", evp->event.type);
+		client->eventhead = evp->next;
+		evp->next = eventfree;
+		eventfree = evp;
+		evp = client->eventhead;
+	}
+}
+
+/*
+ * Display window, pixmap, gc, font, region lists
+ */
+void
+GsPrintResources(void)
+{
+	GR_WINDOW *wp;
+	GR_PIXMAP *pp;
+	GR_GC *gp;
+	GR_REGION *rp;
+	GR_FONT *fp;
+	GR_IMAGE *ip;
+
+	/* window list*/
+	diag_printf("Window list:\n");
+	for(wp=listwp; wp; wp=wp->next) {
+		diag_printf("%d(%d),", wp->id, wp->owner? wp->owner->id: 0);
+	}
+	diag_printf("\nPixmap list:\n");
+	for(pp=listpp; pp; pp=pp->next) {
+		diag_printf("%d(%d),", pp->id, pp->owner->id);
+	}
+	diag_printf("\nGC list:\n");
+	for(gp=listgcp; gp; gp=gp->next) {
+		diag_printf("%d(%d),", gp->id, gp->owner->id);
+	}
+	diag_printf("\nFont list:\n");
+	for(fp=listfontp; fp; fp=fp->next) {
+		diag_printf("%d(%d),", fp->id, fp->owner->id);
+	}
+	diag_printf("\nRegion list:\n");
+	for(rp=listregionp; rp; rp=rp->next) {
+		diag_printf("%d(%d),", rp->id, rp->owner->id);
+	}
+	diag_printf("\nImage list:\n");
+	for(ip=listimagep; ip; ip=ip->next) {
+		diag_printf("%d(%d),", ip->id, ip->owner->id);
+	}
+	diag_printf("\n");
+}
+
+/*
+ * This is used to drop a client when it is detected that the connection to it
+ * has been lost.
+ */
+void
+GsDropClient(int fd)
+{
+	GR_CLIENT *client;
+
+	if((client = GsFindClient(fd))) { /* If it exists */
+#if !ECOS
+		close(fd);	/* Close the socket */
+#endif
+		GsDestroyClientResources(client);
+		if(client == root_client)
+			root_client = client->next;
+		/* Link the prev to the next */
+		if(client->prev) client->prev->next = client->next;
+
+		/* Link the next to the prev */
+		if(client->next) client->next->prev = client->prev;
+
+#if HAVE_SHAREDMEM_SUPPORT
+		if ( client->shm_cmds != 0 ) {
+			/* Free shared memory */
+			shmctl(client->shm_cmds_shmid,IPC_RMID,0);
+			shmdt(client->shm_cmds);
+		}
+#endif
+GsPrintResources();
+		free(client);	/* Free the structure */
+
+		clipwp = NULL;	/* reset clip window*/
+		--connectcount;
+	} else EPRINTF("nano-X: trying to drop non-existent client %d.\n", fd);
+}
+#if !ECOS	/* we don't need gsread in ecos implementation*/
+/*
+ * This is a wrapper to read() which handles error conditions, and
+ * returns 0 for both error conditions and no data.
+ */
+int
+#if ELKS
+GsRead(int fd, char *buf, int c)
+#else
+GsRead(int fd, void *buf, int c)
+#endif
+{
+	int e, n;
+
+	n = 0;
+
+	while(n < c) {
+		e = read(fd, (buf + n), (c - n));
+		if(e <= 0) {
+			if (e == 0)
+				EPRINTF("nano-X: client closed socket: %d\n", fd);
+			else EPRINTF("nano-X: GsRead failed %d %d: %d\r\n",
+			       e, n, errno);
+			GsClose(fd);
+			return -1;
+		}
+		n += e;
+	}
+
+	return 0;
+}
+#endif
+#if ECOS
+
+/*
+ * This is a wrapper to write().
+ */
+static  int GsWrite(int fd, void *buf, int c)
+{
+	char *pc=buf;
+	assert(ServerReply.msgsize<GSWRITEBUF);
+	while(c--)
+		ServerReplyBuf[ServerReply.msgsize++]=*pc++;
+	assert(ServerReply.msgsize<GSWRITEBUF);
+	return 0;
+}
+
+static int GsWriteType(int fd, short type)
+{
+	return GsWrite(fd,&type,sizeof(type));
+}
+/* Flush Server-side result buffer */
+static	void GsFlush(int fd)
+{
+        char * copied;
+	int i,todo=ServerReply.msgsize;
+	if(!todo) return;
+        if((copied=malloc(todo))==NULL)
+        {
+                diag_printf("Can't allocate GsFlush buffer!\n");
+        }
+        /* duplicate buffer */
+        for(i=0;i<todo;i++)
+                copied[i]=ServerReplyBuf[i];
+        ServerReply.msgbuf=copied;      /* it's client's responsbility to free this */
+        ServerReply.msgsize=todo;
+        if(write(fd, (const char *)&ServerReply, sizeof(mqmessage))<=0)
+	{
+                EPRINTF("GsFlush: write failed: %m\n");
+                pthread_exit(NULL);
+        }
+	ServerReply.msgbuf=NULL;
+	ServerReply.msgsize=0;
+}
+
+#else
+
+/*
+ * This is a wrapper to write().
+ */
+int GsWrite(int fd, void *buf, int c)
+{
+	int e, n;
+
+	n = 0;
+
+	while(n < c) {
+		e = write(fd, ((char *) buf + n), (c - n));
+		if(e <= 0) {
+			GsClose(fd);
+			return -1;
+		}
+		n += e;
+	}
+
+	return 0;
+}
+
+int GsWriteType(int fd, short type)
+{
+	return GsWrite(fd,&type,sizeof(type));
+}
+#endif
+/*
+ * This function is used to parse and dispatch requests from the clients.
+ * Note that the maximum request size is allocated from the stack
+ * in this function.
+ */
+
+#if ECOS
+
+void
+GsHandleClient(mqmessage * msg)
+{
+	nxReq *	req;
+	long	len;
+	char * current_location=msg->msgbuf;
+	PREFIX(current_fd) = msg->reply;
+
+#if HAVE_SHAREDMEM_SUPPORT
+	current_shm_cmds = curclient->shm_cmds;
+	current_shm_cmds_size = curclient->shm_cmds_size;
+#endif
+	while(current_location < msg->msgbuf+msg->msgsize)
+	{
+		len = GetReqAlignedLen((nxReq *)current_location);
+		if(len > sizeof(nxReq)) {
+			if(len > MAXREQUESTSZ) {
+				EPRINTF("nano-X: GsHandleClient request too large: %ld > %d\n",
+					len, MAXREQUESTSZ);
+				pthread_exit(NULL);
+			}
+		}
+		req = (nxReq *)current_location;
+		if(req->reqType < GrTotalNumCalls) {
+			curfunc = GrFunctions[req->reqType].name;
+#if 0
+			DPRINTF("HandleClient(%d) %s\r\n",PREFIX(current_fd), curfunc);
+#endif
+			GrFunctions[req->reqType].func(req);
+		} else {
+			EPRINTF("nano-X: GsHandleClient bad function\n");
+		}
+		current_location+=len;
+	}
+	free(msg->msgbuf);
+}
+
+#else
+
+void
+GsHandleClient(int fd)
+{
+	nxReq *	req;
+	long	len;
+	char	buf[MAXREQUESTSZ];
+	current_fd = fd;
+
+#if HAVE_SHAREDMEM_SUPPORT
+	current_shm_cmds = curclient->shm_cmds;
+	current_shm_cmds_size = curclient->shm_cmds_size;
+#endif
+	/* read request header*/
+	if(GsRead(fd, buf, sizeof(nxReq)))
+		return;
+
+	len = GetReqAlignedLen((nxReq *)&buf[0]);
+	if(len > sizeof(nxReq)) {
+		if(len > MAXREQUESTSZ) {
+			EPRINTF("nano-X: GsHandleClient request too large: %ld > %d\n",
+				len, MAXREQUESTSZ);
+			exit(1);
+		}
+		/* read additional request data*/
+		if(GsRead(fd, &buf[sizeof(nxReq)], len-sizeof(nxReq)))
+			return;
+	}
+	req = (nxReq *)&buf[0];
+	if(req->reqType < GrTotalNumCalls) {
+		curfunc = GrFunctions[req->reqType].name;
+/*DPRINTF("HandleClient %s\r\n", curfunc);*/
+		GrFunctions[req->reqType].func(req);
+	} else {
+		EPRINTF("nano-X: GsHandleClient bad function\n");
+	}
+}
+#endif
diff -urN lib/microwindows/src/nanox/srvutil.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvutil.c
--- lib/microwindows/src/nanox/srvutil.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/srvutil.c	2005-02-21 16:13:33.000000000 +0100
@@ -0,0 +1,1092 @@
+/*
+ * Copyright (c) 2000 Greg Haerr <greg@censoft.com>
+ * Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * Graphics server utility routines for windows.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef __PACIFIC__
+#include <fcntl.h>
+#endif
+
+#include "serv.h"
+
+/*
+ * Help prevent future bugs by defining this variable to an illegal value.
+ * These routines should not be referencing this, but should be using
+ * unmapcount instead.
+ */
+#define	mapped	cannotusemapped
+
+/*
+ * Redraw the screen completely.
+ */
+void
+GsRedrawScreen(void)
+{
+	/* Redraw all windows*/
+	GsExposeArea(rootwp, 0, 0, rootwp->width, rootwp->height, NULL);
+}
+#if !ECOS
+/*
+ * Activate Screen Saver.
+ */
+void
+GsActivateScreenSaver(void *arg)
+{
+	screensaver_active = GR_TRUE;
+	GsDeliverScreenSaverEvent(GR_TRUE);
+}
+
+/*
+ * Deactivate screen saver and reset timer if active.
+ */
+void
+GsResetScreenSaver(void)
+{
+	MWTIMER *timer;
+
+	if(screensaver_active == GR_TRUE) {
+		screensaver_active = GR_FALSE;
+		GsDeliverScreenSaverEvent(GR_FALSE);
+	}
+	if(screensaver_delay) {
+		if((timer = GdFindTimer(GsActivateScreenSaver)))
+			GdDestroyTimer(timer);
+		GdAddTimer(screensaver_delay, GsActivateScreenSaver,
+			GsActivateScreenSaver);
+	}
+}
+#endif
+/*
+ * Unmap the window to make it and its children invisible on the screen.
+ * This is a recursive routine which increments the unmapcount values for
+ * this window and all of its children, and causes exposure events for
+ * windows which are newly uncovered.
+ * If temp_unmap set, don't reset focus or generate mouse/focus events,
+ * as window will be mapped again momentarily (window move, resize, etc)
+ */
+void GsWpUnmapWindow(GR_WINDOW *wp, GR_BOOL temp_unmap)
+{
+	GR_WINDOW	*pwp;		/* parent window */
+	GR_WINDOW	*sibwp;		/* sibling window */
+	GR_WINDOW	*childwp;	/* child window */
+	GR_SIZE		bs;		/* border size of this window */
+
+	if (wp == rootwp) {
+		GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wp->id);
+		return;
+	}
+
+	if (wp == clipwp)
+		clipwp = NULL;
+
+	++wp->unmapcount;
+
+	for (childwp = wp->children; childwp; childwp = childwp->siblings)
+		GsWpUnmapWindow(childwp, temp_unmap);
+
+	if (!temp_unmap && wp == mousewp) {
+		GsCheckMouseWindow();
+		GsCheckCursor();
+	}
+
+	if (!temp_unmap && wp == focuswp) {
+		if (focusfixed)
+			/* don't revert to mouse enter/leave focus if fixed*/
+			focuswp = rootwp;
+		else {
+			focusfixed = GR_FALSE;
+			GsCheckFocusWindow();
+		}
+	}
+
+	/* Send update event if just unmapped*/
+	if (wp->unmapcount == 1) {
+		GsDeliverUpdateEvent(wp, 
+			(temp_unmap? GR_UPDATE_UNMAPTEMP: GR_UPDATE_UNMAP),
+			0, 0, 0, 0);
+	}
+
+	/*
+	 * If this is an input-only window or the parent window is
+	 * still unmapped, then we are all done.
+	 */
+	if (!wp->output || wp->parent->unmapcount)
+		return;
+
+	/*
+	 * Clear the area in the parent for this window, causing an
+	 * exposure event for it.  Take into account the border size.
+	 */
+	bs = wp->bordersize;
+	pwp = wp->parent;
+	GsWpClearWindow(pwp, wp->x - pwp->x - bs, wp->y - pwp->y - bs,
+		wp->width + bs * 2, wp->height + bs * 2, GR_TRUE);
+
+	/*
+	 * Finally clear and redraw all parts of our lower sibling
+	 * windows that were covered by this window.
+	 */
+	sibwp = wp;
+	while (sibwp->siblings) {
+		sibwp = sibwp->siblings;
+		GsExposeArea(sibwp, wp->x - bs, wp->y - bs,
+			wp->width + bs * 2, wp->height + bs * 2, NULL);
+	}
+}
+
+/*
+ * Map the window to possibly make it and its children visible on the screen.
+ * This is a recursive routine which decrements the unmapcount values for
+ * this window and all of its children, and causes exposure events for
+ * those windows which become visible.
+ * If temp is set, then window is being mapped again after a temporary
+ * unmap, so don't reset focus or generate mouse/focus events.
+ */
+void GsWpMapWindow(GR_WINDOW *wp, GR_BOOL temp)
+{
+	if (wp == rootwp) {
+		GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wp->id);
+		return;
+	}
+
+	if (wp->unmapcount)
+		--wp->unmapcount;
+
+	if (!temp && wp->unmapcount == 0) {
+		GsCheckMouseWindow();
+		GsCheckFocusWindow();
+		GsCheckCursor();
+	}
+
+	/* send update event if just mapped*/
+	if (wp->unmapcount == 0) {
+		GsDeliverUpdateEvent(wp, GR_UPDATE_MAP, wp->x, wp->y,
+			wp->width, wp->height);
+	}
+
+	/*
+	 * If the window is an output window and just became visible,
+	 * then draw its border, clear it to the background color, and
+	 * generate an exposure event.
+	 */
+	if (wp->output && (wp->unmapcount == 0)) {
+		GsDrawBorder(wp);
+		GsWpClearWindow(wp, 0, 0, wp->width, wp->height, GR_TRUE);
+	}
+
+	/*
+	 * Do the same thing for the children.
+	 */
+	for (wp = wp->children; wp; wp = wp->siblings)
+		GsWpMapWindow(wp, temp);
+}
+
+/*
+ * Destroy the specified window, and all of its children.
+ * This is a recursive routine.
+ */
+void GsWpDestroyWindow(GR_WINDOW *wp)
+{
+	GR_WINDOW	*prevwp;	/* previous window pointer */
+	GR_EVENT_CLIENT	*ecp;		/* selections for window */
+	GR_WINDOW_ID	oldwid;		/* old selection owner */
+
+	if (wp == rootwp) {
+		GsError(GR_ERROR_ILLEGAL_ON_ROOT_WINDOW, wp->id);
+		return;
+	}
+
+	/* Disable selection if this window is the owner */
+	if(selection_owner.wid == wp->id) {
+		oldwid = selection_owner.wid;
+		selection_owner.wid = 0;
+		if(selection_owner.typelist) free(selection_owner.typelist);
+		GsDeliverSelectionChangedEvent(oldwid, 0);
+	}
+
+	/*
+	 * Unmap the window first.
+	 */
+	if (wp->unmapcount == 0)
+		GsWpUnmapWindow(wp, GR_FALSE);
+
+	/* send update event*/
+	GsDeliverUpdateEvent(wp, GR_UPDATE_DESTROY, wp->x, wp->y,
+		wp->width, wp->height);
+
+	/*
+	 * Destroy all children.
+	 */
+	while (wp->children)
+		GsWpDestroyWindow(wp->children);
+
+	/*
+	 * Free all client selection structures.
+	 */
+	while (wp->eventclients) {
+		ecp = wp->eventclients;
+		wp->eventclients = ecp->next;
+		free(ecp);
+	}
+
+	/*
+	 * Free any cursor associated with the window.
+	 */
+	if (wp->cursor->usecount-- == 1) {
+		free(wp->cursor);
+		wp->cursor = NULL;
+	}
+
+	/*
+	 * Remove this window from the child list of its parent.
+	 */
+	prevwp = wp->parent->children;
+	if (prevwp == wp)
+		wp->parent->children = wp->siblings;
+	else {
+		while (prevwp->siblings != wp)
+			prevwp = prevwp->siblings;
+		prevwp->siblings = wp->siblings;
+	}
+	wp->siblings = NULL;
+
+	/*
+	 * Remove this window from the complete list of windows.
+	 */
+	prevwp = listwp;
+	if (prevwp == wp)
+		listwp = wp->next;
+	else {
+		while (prevwp->next != wp)
+			prevwp = prevwp->next;
+		prevwp->next = wp->next;
+	}
+	wp->next = NULL;
+
+	/*
+	 * Forget various information if they related to this window.
+	 * Then finally free the structure.
+	 */
+	if (wp == clipwp)
+		clipwp = NULL;
+	if (wp == grabbuttonwp)
+		grabbuttonwp = NULL;
+	if (wp == cachewp) {
+		cachewindowid = 0;
+		cachewp = NULL;
+	}
+	if (wp == focuswp) {
+		/* don't revert to mouse enter/leave focus if fixed*/
+		/*focusfixed = GR_FALSE;*/
+		focuswp = rootwp;
+	}
+
+	GsCheckMouseWindow();
+
+	if(wp->title)
+		free(wp->title);
+
+	free(wp);
+}
+
+/*
+ * Draw a window's background pixmap.
+ *
+ * The flags mean:
+ *   GR_BACKGROUND_TOPLEFT- draw the pixmap at (0,0) relative to the window.
+ *   GR_BACKGROUND_CENTER- draw the pixmap in the middle of the window.
+ *   GR_BACKGROUND_TILE- tile the pixmap across the window.
+ *   GR_BACKGROUND_TRANS- if the pixmap is smaller than the window and not
+ *     using tile mode, there will be gaps around the pixmap. This flag causes
+ *     to not fill in the spaces with the background colour.
+ */
+void GsWpDrawBackgroundPixmap(GR_WINDOW *wp, GR_PIXMAP *pm, GR_COORD x,
+	GR_COORD y, GR_SIZE width, GR_SIZE height)
+{
+	GR_SIZE destwidth, destheight, fillwidth, fillheight, pmwidth, pmheight;
+	GR_COORD fromx, fromy, destx, desty, pixmapx = 0, pixmapy = 0;
+
+	if(wp->bgpixmapflags & GR_BACKGROUND_TOPLEFT) {
+		pixmapx = 0;
+		pixmapy = 0;
+	} else if(wp->bgpixmapflags & GR_BACKGROUND_CENTER) {
+		if(pm->width >= wp->width) pixmapx = 0;
+		else pixmapx = (wp->width - pm->width) / 2;
+		if(pm->height >= wp->height) pixmapy = 0;
+		else pixmapy = (wp->height - pm->height) / 2;
+	} else { 
+		/* GR_BACKGROUND_TILE (default)*/
+		GsWpTileBackgroundPixmap(wp, pm, x, y, width, height);
+		return;
+	}
+
+	if(pm->width > wp->width) pmwidth = wp->width;
+	else pmwidth = pm->width;
+	if(pm->height > wp->height) pmheight = wp->height;
+	else pmheight = pm->height;
+
+	if(x > pixmapx) {
+		destx = x;
+		fromx = x - pixmapx;
+		destwidth = pixmapx + pmwidth - x;
+	} else {
+		destx = pixmapx;
+		fromx = 0;
+		destwidth = x + width - pixmapx;
+	}
+
+	if(y > pixmapy) {
+		desty = y;
+		fromy = y - pixmapy;
+		destheight = pixmapy + pmheight - desty;
+	} else {
+		desty = pixmapy;
+		fromy = 0;
+		destheight = y + height - pixmapy;
+	}
+
+	if((destwidth > 0) && (destheight > 0)) {
+		GdBlit(wp->psd, destx + wp->x, desty + wp->y, destwidth,
+			destheight, pm->psd, fromx, fromy, MWROP_SRCCOPY);
+	}
+
+	if(wp->bgpixmapflags & GR_BACKGROUND_TRANS)
+		return;
+
+	/* Fill in the gaps around the pixmap */
+	if(x < pixmapx) {
+		fillwidth = pixmapx - x;
+		if(fillwidth > width) fillwidth = width;
+		fillheight = height;
+		GdFillRect(wp->psd, wp->x + x, wp->y + y, fillwidth,fillheight);
+	}
+	if((x + width) > (pixmapx + pmwidth)) {
+		fillwidth = (x + width) - (pixmapx + pmwidth);
+		if(fillwidth > width) fillwidth = width;
+		fillheight = height;
+		if(x < (pixmapx + pmwidth)) destx = pixmapx + pmwidth + wp->x;
+		else destx = x + wp->x;
+		GdFillRect(wp->psd, destx, wp->y + y, fillwidth, fillheight);
+	}
+	if(y < pixmapy) {
+		fillheight = pixmapy - y;
+		if(fillheight > height) fillheight = height;
+		if(x < pixmapx) destx = pixmapx + wp->x;
+		else destx = x + wp->x;
+		if((x + width) > (pixmapx + pmwidth))
+			fillwidth = pixmapx + pmwidth - destx;
+		else fillwidth = x + width - destx;
+		if((fillwidth > 0) && (fillheight > 0)) {
+			GdFillRect(wp->psd, destx, wp->y + y, fillwidth,
+							fillheight);
+		}
+	}
+	if((y + height) > (pixmapy + pmheight)) {
+		fillheight = (y + height) - (pixmapy + pmheight);
+		if(fillheight > height) fillheight = height;
+		if(x < pixmapx) destx = pixmapx + wp->x;
+		else destx = x + wp->x;
+		if(y < (pixmapy + pmheight)) desty = pixmapy + pmheight + wp->y;
+		else desty = y + wp->y;
+	
+		if((x + width) > (pixmapx + pmwidth))
+			fillwidth = pixmapx + pmwidth - destx;
+		else fillwidth = x + width - destx;
+		if((fillwidth > 0) && (fillheight > 0)) {
+			GdFillRect(wp->psd, destx, desty, fillwidth,fillheight);
+		}
+	}
+}
+
+/*
+ * Draw a tiled pixmap window background.
+ */
+void 
+GsWpTileBackgroundPixmap(GR_WINDOW *wp, GR_PIXMAP *pm, GR_COORD x, GR_COORD y,
+	GR_SIZE width, GR_SIZE height)
+{
+	GR_COORD tilex = 0, tiley = 0, fromx, fromy, cx, cy;
+	GR_SIZE destwidth, destheight, pmwidth, pmheight, cwidth, cheight;
+
+	if(pm->width > wp->width) pmwidth = wp->width;
+	else pmwidth = pm->width;
+	if(pm->height > wp->height) pmheight = wp->height;
+	else pmheight = pm->height;
+
+	for(;tiley < wp->height; tiley += pmheight, tilex = 0) {
+		if(tiley > (y + height)) continue;
+		if(y > (tiley + pmheight)) continue;
+		if((tiley + pmheight) > wp->height)
+			destheight = wp->height - tiley;
+		else destheight = pmheight;
+		for(;tilex < wp->width; tilex += pmwidth) {
+			if(tilex > (x + width)) continue;
+			if(x > (tilex + pmwidth)) continue;
+			if((tilex + pmwidth) > wp->width)
+				destwidth = wp->width - tilex;
+			else destwidth = pmwidth;
+
+			if((tilex >= x) && ((tilex + destwidth)<=(x + width))) {
+				fromx = 0;
+				cx = tilex + wp->x;
+				cwidth = destwidth;
+			} else {
+				if(x > tilex) {
+					fromx = x - tilex;
+					cwidth = destwidth - fromx;
+				} else {
+					fromx = 0;
+					cwidth = x + width - tilex;
+				}
+				if(cwidth > width) cwidth = width;
+				if(cwidth > destwidth) cwidth = destwidth;
+				cx = wp->x + tilex + fromx;
+			}
+
+			if((tiley >= y)&&((tiley + destheight)<=(y + height))) {
+				fromy = 0;
+				cy = tiley + wp->y;
+				cheight = destheight;
+			} else {
+				if(y > tiley) {
+					fromy = y - tiley;
+					cheight = destheight - fromy;
+				} else {
+					fromy = 0;
+					cheight = y + height - tiley;
+				}
+				if(cwidth > width) cwidth = width;
+				if(cheight > destheight) cheight = destheight;
+				cy = wp->y + tiley + fromy;
+			}
+
+			if((cwidth > 0) && (cheight > 0)) {
+				GdBlit(wp->psd, cx, cy, cwidth, cheight,
+					pm->psd, fromx, fromy, MWROP_SRCCOPY);
+			}
+		}
+	}
+}
+
+/*
+ * Clear the specified area of a window and possibly make an exposure event.
+ * This sets the area window to its background color.  If the exposeflag is
+ * nonzero, then this also creates an exposure event for the window.
+ */
+void GsWpClearWindow(GR_WINDOW *wp, GR_COORD x, GR_COORD y, GR_SIZE width,
+			GR_SIZE  height, GR_BOOL exposeflag)
+{
+	if (wp->unmapcount || !wp->output)
+		return;
+	/*
+	 * Reduce the arguments so that they actually lie within the window.
+	 */
+	if (x < 0) {
+		width += x;
+		x = 0;
+	}
+	if (y < 0) {
+		height += y;
+		y = 0;
+	}
+	if (x + width > wp->width)
+		width = wp->width - x;
+	if (y + height > wp->height)
+		height = wp->height - y;
+
+	/*
+	 * Now see if the region is really in the window.  If not, then
+	 * do nothing.
+	 */
+	if ((x >= wp->width) || (y >= wp->height) || (width <= 0) ||
+		(height <= 0))
+			return;
+
+	/*
+	 * Draw the background of the window.
+	 * Invalidate the current graphics context since
+	 * we are changing the foreground color and mode.
+	 */
+	GsSetClipWindow(wp, NULL, 0);
+	curgcp = NULL;
+	if (!(wp->props & GR_WM_PROPS_NOBACKGROUND)) {
+		GdSetMode(GR_MODE_SET);
+		GdSetForeground(GdFindColor(wp->background));
+		if(wp->bgpixmap) {
+			GsWpDrawBackgroundPixmap(wp, wp->bgpixmap, x, y,
+				width, height);
+		} else {
+			GdFillRect(wp->psd, wp->x + x, wp->y + y, width,height);
+		}
+	}
+
+	/*
+	 * Now do the exposure if required.
+	 */
+	if (exposeflag)
+		GsDeliverExposureEvent(wp, x, y, width, height);
+}
+
+/*
+ * Handle the exposing of the specified absolute region of the screen,
+ * starting with the specified window.  That window and all of its
+ * children will be redrawn and/or exposure events generated if they
+ * overlap the specified area.  This is a recursive routine.
+ */
+void
+GsExposeArea(GR_WINDOW *wp, GR_COORD rootx, GR_COORD rooty, GR_SIZE width,
+	GR_SIZE height, GR_WINDOW *stopwp)
+{
+	if (!wp->output || wp->unmapcount || wp == stopwp)
+		return;
+
+	/*
+	 * First see if the area overlaps the window including the border.
+	 * If not, then there is nothing more to do.
+	 */
+	if ((rootx >= wp->x + wp->width + wp->bordersize) ||
+		(rooty >= wp->y + wp->height + wp->bordersize) ||
+		(rootx + width <= wp->x - wp->bordersize) ||
+		(rooty + height <= wp->y - wp->bordersize))
+			return;
+
+	/*
+	 * The area does overlap the window.  See if the area overlaps
+	 * the border, and if so, then redraw it.
+	 */
+	if ((rootx < wp->x) || (rooty < wp->y) ||
+		(rootx + width > wp->x + wp->width) ||
+		(rooty + height > wp->y + wp->height))
+			GsDrawBorder(wp);
+
+	/*
+	 * Now clear the window itself in the specified area,
+	 * which might cause an exposure event.
+	 */
+	GsWpClearWindow(wp, rootx - wp->x, rooty - wp->y,
+		width, height, GR_TRUE);
+
+	/*
+	 * Now do the same for all the children.
+	 */
+	for (wp = wp->children; wp; wp = wp->siblings)
+		GsExposeArea(wp, rootx, rooty, width, height, stopwp);
+}
+
+/*
+ * Draw the border of a window if there is one.
+ * Note: To allow the border to be drawn with the correct clipping,
+ * we temporarily grow the size of the window to include the border.
+ */
+void GsDrawBorder(GR_WINDOW *wp)
+{
+	GR_COORD	lminx;		/* left edge minimum x */
+	GR_COORD	rminx;		/* right edge minimum x */
+	GR_COORD	tminy;		/* top edge minimum y */
+	GR_COORD	bminy;		/* bottom edge minimum y */
+	GR_COORD	topy;		/* top y value of window */
+	GR_COORD	boty;		/* bottom y value of window */
+	GR_SIZE		width;		/* original width of window */
+	GR_SIZE		height;		/* original height of window */
+	GR_SIZE		bs;		/* border size */
+
+	bs = wp->bordersize;
+	if (bs <= 0)
+		return;
+
+	width = wp->width;
+	height = wp->height;
+	lminx = wp->x - bs;
+	rminx = wp->x + width;
+	tminy = wp->y - bs;
+	bminy = wp->y + height;
+	topy = wp->y;
+	boty = bminy - 1;
+ 
+	wp->x -= bs;
+	wp->y -= bs;
+	wp->width += (bs * 2);
+	wp->height += (bs * 2);
+	wp->bordersize = 0;
+
+	clipwp = NULL;
+	GsSetClipWindow(wp, NULL, 0);
+	curgcp = NULL;
+	GdSetMode(GR_MODE_SET);
+	GdSetForeground(GdFindColor(wp->bordercolor));
+
+	if (bs == 1) {
+		GdLine(wp->psd, lminx, tminy, rminx, tminy, TRUE);
+		GdLine(wp->psd, lminx, bminy, rminx, bminy, TRUE);
+		GdLine(wp->psd, lminx, topy, lminx, boty, TRUE);
+		GdLine(wp->psd, rminx, topy, rminx, boty, TRUE);
+	} else {
+		GdFillRect(wp->psd, lminx, tminy, width + bs * 2, bs);
+		GdFillRect(wp->psd, lminx, bminy, width + bs * 2, bs);
+		GdFillRect(wp->psd, lminx, topy, bs, height);
+		GdFillRect(wp->psd, rminx, topy, bs, height);
+	}
+
+	/*
+	 * Restore the true window size.
+	 * Forget the currently clipped window since we messed it up.
+	 */
+	wp->x += bs;
+	wp->y += bs;
+	wp->width -= (bs * 2);
+	wp->height -= (bs * 2);
+	wp->bordersize = bs;
+	clipwp = NULL;
+}
+
+/*
+ * Check to see if the first window overlaps the second window.
+ */
+GR_BOOL GsCheckOverlap(GR_WINDOW *topwp, GR_WINDOW *botwp)
+{
+	GR_COORD	minx1;
+	GR_COORD	miny1;
+	GR_COORD	maxx1;
+	GR_COORD	maxy1;
+	GR_COORD	minx2;
+	GR_COORD	miny2;
+	GR_COORD	maxx2;
+	GR_COORD	maxy2;
+	GR_SIZE		bs;
+
+	if (!topwp->output || topwp->unmapcount || botwp->unmapcount)
+		return GR_FALSE;
+
+	bs = topwp->bordersize;
+	minx1 = topwp->x - bs;
+	miny1 = topwp->y - bs;
+	maxx1 = topwp->x + topwp->width + bs - 1;
+	maxy1 = topwp->y + topwp->height + bs - 1;
+
+	bs = botwp->bordersize;
+	minx2 = botwp->x - bs;
+	miny2 = botwp->y - bs;
+	maxx2 = botwp->x + botwp->width + bs - 1;
+	maxy2 = botwp->y + botwp->height + bs - 1;
+
+	if ((minx1 > maxx2) || (minx2 > maxx1) || (miny1 > maxy2)
+		|| (miny2 > maxy1))
+			return GR_FALSE;
+
+	return GR_TRUE;
+}
+
+/*
+ * Return a pointer to the window structure with the specified window id.
+ * Returns NULL if the window does not exist.
+ */
+GR_WINDOW *
+GsFindWindow(GR_WINDOW_ID id)
+{
+	GR_WINDOW	*wp;		/* current window pointer */
+
+	/*
+	 * See if this is the root window or the same window as last time.
+	 */
+	if (id == GR_ROOT_WINDOW_ID)
+		return rootwp;
+
+	if ((id == cachewindowid) && id)
+		return cachewp;
+
+	/*
+	 * No, search for it and cache it for future calls.
+	 */
+	for (wp = listwp; wp; wp = wp->next) {
+		if (wp->id == id) {
+			cachewindowid = id;
+			cachewp = wp;
+			return wp;
+		}
+	}
+
+	return NULL;
+}
+
+
+
+/*
+ * Return a pointer to the pixmap structure with the specified window id.
+ * Returns NULL if the pixmap does not exist.
+ */
+GR_PIXMAP *
+GsFindPixmap(GR_WINDOW_ID id)
+{
+	GR_PIXMAP	*pp;		/* current pixmap pointer */
+
+	if ((id == cachepixmapid) && id)
+		return cachepp;
+
+	/*
+	 * No, search for it and cache it for future calls.
+	 */
+	for (pp = listpp; pp; pp = pp->next) {
+		if (pp->id == id) {
+			cachepixmapid = id;
+			cachepp = pp;
+			return pp;
+		}
+	}
+
+	return NULL;
+}
+
+
+/*
+ * Return a pointer to the graphics context with the specified id.
+ * Returns NULL if the graphics context does not exist, with an
+ * error saved.
+ */
+GR_GC *
+GsFindGC(GR_GC_ID gcid)
+{
+	GR_GC		*gcp;		/* current graphics context pointer */
+
+	/*
+	 * See if this is the same graphics context as last time.
+	 */
+	if ((gcid == cachegcid) && gcid)
+		return cachegcp;
+
+	/*
+	 * No, search for it and cache it for future calls.
+	 */
+	for (gcp = listgcp; gcp; gcp = gcp->next) {
+		if (gcp->id == gcid) {
+			cachegcid = gcid;
+			cachegcp = gcp;
+			return gcp;
+		}
+	}
+
+	GsError(GR_ERROR_BAD_GC_ID, gcid);
+
+	return NULL;
+}
+
+/* Return a pointer to the region with the specified id.*/
+GR_REGION *
+GsFindRegion(GR_REGION_ID regionid)
+{
+	GR_REGION	*regionp;	/* current region pointer */
+
+	for (regionp = listregionp; regionp; regionp = regionp->next) {
+		if (regionp->id == regionid) {
+			return regionp;
+		}
+	}
+
+	return NULL;
+}
+
+/* find a font with specified id*/
+GR_FONT *
+GsFindFont(GR_FONT_ID fontid)
+{
+	GR_FONT		*fontp;
+
+	for (fontp = listfontp; fontp; fontp = fontp->next) {
+		if (fontp->id == fontid)
+			return fontp;
+	}
+	return NULL;
+}
+
+/*
+ * Prepare to do drawing in a window or pixmap using the specified
+ * graphics context.  Returns the drawable pointer if successful,
+ * and the type of drawing id that was supplied.  Returns the special value
+ * GR_DRAW_TYPE_NONE if an error is generated, or if drawing is useless.
+ */
+GR_DRAW_TYPE GsPrepareDrawing(GR_DRAW_ID id, GR_GC_ID gcid, GR_DRAWABLE **retdp)
+{
+	GR_WINDOW	*wp;		/* found window */
+        GR_PIXMAP       *pp;            /* found pixmap */
+	GR_GC		*gcp;		/* found graphics context */
+	GR_FONT		*fontp;
+	GR_REGION	*regionp;	/* user clipping region */
+	MWCLIPREGION	*reg;
+	PMWFONT		pf;
+
+	*retdp = NULL;
+
+	gcp = GsFindGC(gcid);
+	if (gcp == NULL)
+		return GR_DRAW_TYPE_NONE;
+
+	/*
+	 * Look for window or pixmap id
+	 */
+        pp = NULL;
+	wp = GsFindWindow(id);
+	if (wp == NULL) {
+	        pp = GsFindPixmap(id);
+	        if (pp == NULL)
+		          return GR_DRAW_TYPE_NONE;
+	   
+#if DYNAMICREGIONS
+		reg = GdAllocRectRegion(0, 0, pp->psd->xvirtres,
+			pp->psd->yvirtres);
+		/* intersect with user region if any*/
+		if (gcp->regionid) {
+			regionp = GsFindRegion(gcp->regionid);
+			if (regionp)
+				GdIntersectRegion(reg, reg, regionp->rgn);
+		}
+		GdSetClipRegion(pp->psd, reg);
+#else
+		{
+		MWCLIPRECT	cliprect;
+		/* FIXME: setup pixmap clipping, different from windows*/
+	        cliprect.x = 0;
+	        cliprect.y = 0;
+	        cliprect.width = pp->psd->xvirtres;
+	        cliprect.height = pp->psd->yvirtres;
+	        GdSetClipRects(pp->psd, 1, &cliprect);
+		}
+#endif
+		/* reset clip cache for next window draw*/
+		clipwp = NULL;
+	} else {
+   
+	        if (!wp->output) {
+		          GsError(GR_ERROR_INPUT_ONLY_WINDOW, id);
+		          return GR_DRAW_TYPE_NONE;
+		}
+
+	        if (wp->unmapcount)
+		          return GR_DRAW_TYPE_NONE;
+	   
+	        /*
+		 * If the window is not the currently clipped one,
+		 * then make it the current one and define its clip rectangles.
+		 */
+	        if (wp != clipwp || gcp->changed) {
+			  /* find user region for intersect*/
+			  if (gcp->regionid)
+				regionp = GsFindRegion(gcp->regionid);
+			  else regionp = NULL;
+			  GsSetClipWindow(wp, regionp? regionp->rgn: NULL,
+				gcp->mode & ~GR_MODE_DRAWMASK);
+		}
+	}
+
+	/*
+	 * If the graphics context is not the current one, then
+	 * make it the current one and remember to update it.
+	 */
+	if (gcp != curgcp) {
+		curgcp = gcp;
+		gcp->changed = GR_TRUE;
+	}
+
+	/*
+	 * If the graphics context has been changed, then tell the
+	 * device driver about it.
+	 */
+	if (gcp->changed) {
+		GdSetForeground(GdFindColor(gcp->foreground));
+		GdSetBackground(GdFindColor(gcp->background));
+		GdSetMode(gcp->mode & GR_MODE_DRAWMASK);
+		GdSetUseBackground(gcp->usebackground);
+		fontp = GsFindFont(gcp->fontid);
+		pf = fontp? fontp->pfont: stdfont;
+		GdSetFont(pf);
+		gcp->changed = GR_FALSE;
+	}
+
+	*retdp = wp? (GR_DRAWABLE *)wp: (GR_DRAWABLE *)pp;
+	return wp? GR_DRAW_TYPE_WINDOW: GR_DRAW_TYPE_PIXMAP;
+}
+
+/*
+ * Prepare the specified window for drawing into it.
+ * This sets up the clipping regions to just allow drawing into it.
+ * Returns NULL if the drawing is illegal (with an error generated),
+ * or if the window is not mapped.
+ */
+GR_WINDOW *GsPrepareWindow(GR_WINDOW_ID wid)
+{
+	GR_WINDOW	*wp;		/* found window */
+
+	wp = GsFindWindow(wid);
+	if (wp == NULL)
+		return NULL;
+	
+	if (!wp->output) {
+		GsError(GR_ERROR_INPUT_ONLY_WINDOW, wid);
+		return NULL;
+	}
+
+	if (wp->unmapcount)
+		return NULL;
+
+	if (wp != clipwp) {
+		/* FIXME: no user region clipping here*/
+		GsSetClipWindow(wp, NULL, 0);
+	}
+
+	return wp;
+}
+
+/*
+ * Find the window which is currently visible for the specified coordinates.
+ * This just walks down the window tree looking for the deepest mapped
+ * window which contains the specified point.  If the coordinates are
+ * off the screen, the root window is returned.
+ */
+GR_WINDOW *GsFindVisibleWindow(GR_COORD x, GR_COORD y)
+{
+	GR_WINDOW	*wp;		/* current window */
+	GR_WINDOW	*retwp;		/* returned window */
+
+	wp = rootwp;
+	retwp = wp;
+	while (wp) {
+		if ((wp->unmapcount == 0) && (wp->x <= x) && (wp->y <= y) &&
+			(wp->x + wp->width > x) && (wp->y + wp->height > y))
+		{
+			retwp = wp;
+			wp = wp->children;
+			continue;
+		}
+		wp = wp->siblings;
+	}
+	return retwp;
+}
+
+/*
+ * Check to see if the cursor shape is the correct shape for its current
+ * location.  If not, its shape is changed.
+ */
+void GsCheckCursor(void)
+{
+	GR_WINDOW	*wp;		/* window cursor is in */
+	GR_CURSOR	*cp;		/* cursor definition */
+
+	/*
+	 * Get the cursor at its current position, and if it is not the
+	 * currently defined one, then set the new cursor.  However,
+	 * if the pointer is currently grabbed, then leave it alone.
+	 */
+	wp = grabbuttonwp;
+	if (wp == NULL)
+		wp = mousewp;
+
+	cp = wp->cursor;
+	if (cp == curcursor)
+		return;
+
+	/*
+	 * It needs redefining, so do it.
+	 */
+	curcursor = cp;
+	GdMoveCursor(cursorx - cp->cursor.hotx, cursory - cp->cursor.hoty);
+	GdSetCursor(&cp->cursor);
+}
+
+/*
+ * Check to see if the window the mouse is currently in has changed.
+ * If so, generate enter and leave events as required.  The newest
+ * mouse window is remembered in mousewp.  However, do not change the
+ * window while it is grabbed.
+ */
+void GsCheckMouseWindow(void)
+{
+	GR_WINDOW	*wp;		/* newest window for mouse */
+
+	wp = grabbuttonwp;
+	if (wp == NULL)
+		wp = GsFindVisibleWindow(cursorx, cursory);
+	if (wp == mousewp)
+		return;
+
+	GsDeliverGeneralEvent(mousewp, GR_EVENT_TYPE_MOUSE_EXIT, NULL);
+
+	mousewp = wp;
+
+	GsDeliverGeneralEvent(wp, GR_EVENT_TYPE_MOUSE_ENTER, NULL);
+}
+
+/*
+ * Determine the current focus window for the current mouse coordinates.
+ * The mouse coordinates only matter if the focus is not fixed.  Otherwise,
+ * the selected window is dependant on the window which wants keyboard
+ * events.  This also sets the current focus for that found window.
+ * The window with focus is remembered in focuswp.
+ */
+void GsCheckFocusWindow(void)
+{
+	GR_WINDOW		*wp;		/* current window */
+	GR_EVENT_CLIENT		*ecp;		/* current event client */
+	GR_EVENT_MASK		eventmask;	/* event mask */
+
+	if (focusfixed)
+		return;
+
+	eventmask = GR_EVENT_MASK_KEY_DOWN;
+
+	/*
+	 * Walk upwards from the current window containing the mouse
+	 * looking for the first window which would accept a keyboard event.
+	 */
+	for (wp = mousewp; ;wp = wp->parent) {
+		if (wp->props & GR_WM_PROPS_NOFOCUS)
+			continue;
+		for (ecp = wp->eventclients; ecp; ecp = ecp->next) {
+			if (ecp->eventmask & eventmask) {
+				GsWpSetFocus(wp);
+				return;
+			}
+		}
+		if ((wp == rootwp) || (wp->nopropmask & eventmask)) {
+			GsWpSetFocus(rootwp);
+			return;
+		}
+	}
+}
+
+/* Send an update activate event to top level window of passed window*/
+static void
+GsWpNotifyActivate(GR_WINDOW *wp)
+{
+	GR_WINDOW	*pwp;
+
+	for (pwp=wp; pwp->parent; pwp=pwp->parent)
+		if (pwp->parent->id == GR_ROOT_WINDOW_ID)
+			break;
+	if (pwp->id != GR_ROOT_WINDOW_ID)
+		GsDeliverUpdateEvent(pwp, GR_UPDATE_ACTIVATE, 0, 0, 0, 0);
+}
+
+/*
+ * Set the input focus to the specified window.
+ * This generates focus out and focus in events as necessary.
+ */
+void GsWpSetFocus(GR_WINDOW *wp)
+{
+	GR_WINDOW	*oldfocus;
+
+	if (wp == focuswp)
+		return;
+
+	GsDeliverGeneralEvent(focuswp, GR_EVENT_TYPE_FOCUS_OUT, wp);
+	GsWpNotifyActivate(focuswp);
+
+	oldfocus = focuswp;
+	focuswp = wp;
+
+	GsDeliverGeneralEvent(wp, GR_EVENT_TYPE_FOCUS_IN, oldfocus);
+	GsWpNotifyActivate(focuswp);
+}
diff -urN lib/microwindows/src/nanox/strdup.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/strdup.c
--- lib/microwindows/src/nanox/strdup.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nanox/strdup.c	2005-02-21 16:13:36.000000000 +0100
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2001 I-Jui Sung <ijsung@csie.nctu.edu.tw>
+ * eCos don't have strdup, so I rewrite one
+ */
+#include <cyg/kernel/kapi.h>
+#include <cyg/infra/diag.h>
+#include <string.h>
+char * strdup(const char *s)
+{
+	char * buffer=malloc(strlen(s)+1);
+	if(buffer)
+		strcpy(buffer,s);
+	return buffer;
+}
diff -urN lib/microwindows/src/npanel.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/npanel.sh
--- lib/microwindows/src/npanel.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/npanel.sh	2005-02-21 16:13:43.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X -p & bin/npanel
diff -urN lib/microwindows/src/nwidget/CHANGELOG /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/CHANGELOG
--- lib/microwindows/src/nwidget/CHANGELOG	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/CHANGELOG	2005-02-21 16:13:36.000000000 +0100
@@ -0,0 +1,22 @@
+27 May 2000 - Alex Holden <alex@linuxhacker.org>
+	* Fixed lots of things to make it build under 0.88pre8.
+	* Fixed a couple of bugs.
+	* Created nwidgets.h which includes all of the headers required for
+	  nwidget programs at once.
+	* Added n_main() utility function.
+
+1999/10/5  - Vidar Hokstad
+      I've intergrated Greg's changes to 0.1, and split the (unfinished)
+      textfield widget into it's it's own file. I've also started to add a
+      simple listview widget, and started moving rendering into a separate
+      class.
+ 
+      * Improved the rendering of the text field a lot. *HOWEVER* it will
+        probably look really bad on 0.5pre3 due to lack of text clipping.
+
+      * Text field now uses MODE_XOR for the cursor.
+
+      * Fixed some of the calculations regarding cursor positioning etc.
+        for the textfield.
+	
+      * Started adding a simple 3D look.
diff -urN lib/microwindows/src/nwidget/Makefile /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/Makefile
--- lib/microwindows/src/nwidget/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/Makefile	2005-02-21 16:13:36.000000000 +0100
@@ -0,0 +1,47 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+##############################################################################
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+INCLUDEDIRS +=
+# Defines for preprocessor
+DEFINES += -DMWIN
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+LDFLAGS +=
+
+############################# targets section ################################
+
+ifeq ($(NWIDGET), Y)
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME = libnwidget.a
+LIBNAMESO = libnwidget.so
+
+# List of objects to compile
+OBJS =	nclass.o \
+	nwidget.o \
+	nbutton.o \
+	ntoggle.o \
+	nradio.o \
+	nslider.o \
+	ntextfield.o \
+	nrender.o \
+	nlistview.o
+
+endif
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
diff -urN lib/microwindows/src/nwidget/README /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/README
--- lib/microwindows/src/nwidget/README	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/README	2005-02-21 16:13:37.000000000 +0100
@@ -0,0 +1,35 @@
+NanoWidgets v0.2
+
+(C) 1999 by Screen Media AS
+Written by Vidar Hokstad <vidarh@screenmedia.no> <vidar@hokstad.com>
+
+CREDITS
+
+Contains code from The Nano Toolkit (unreleased),
+(C) 1999 by Alexander Peuchert.
+
+Other contributors:
+   Greg Haerr
+
+LICENSE
+
+This code is licensed under the Mozilla Public License
+
+(note: I haven't gotten around to asking Alexander if the MPL is okay with
+him yet. There isn't much of his original code left at this stage, though,
+but I've mailed him to check)
+
+MISC INFO
+
+Thanks to Greg Haerr, it now works somewhat reliably with the MicrowWindows
+0.84 release of Nano-X. Most should still also work with 0.5pre3, but I've
+not tested that.
+
+Did I mention there's no warranties? Well, there isn't. This code
+is highly experimental, and needs a lot of work. Oh, and don't complain
+to me about how it looks. I've started to add hooks for attaching
+rendering objects to the widgets, to make the whole system themable,
+and the current look is like it is only for debugging purposes.
+
+For now, please send patches to me by e-mail. We'll get it into
+CVS later.
diff -urN lib/microwindows/src/nwidget/nbutton.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/nbutton.c
--- lib/microwindows/src/nwidget/nbutton.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/nbutton.c	2005-02-21 16:13:36.000000000 +0100
@@ -0,0 +1,89 @@
+#include <stdlib.h>
+#include <string.h>
+#include <nwidgets.h>
+
+static int button_init (NBUTTON * this, NWIDGET * parent, const char * text)
+{
+   if (n_widget_init(this,parent)) return -1;
+   this->pressed = 0;
+   this->text = (char *)strdup(text); 
+   this->onclick_handler = 0;
+   
+   return 0;
+}
+
+static void button_cleanup (NBUTTON * this)
+{
+   if (this->text) free(this->text);
+   n_super(object,cleanup,this,(this));
+}
+
+static void button_repaint (NBUTTON * this)
+{
+   int w,h;
+   int tw,th,tb,x,y;
+   int len;
+   
+   MWCOLORVAL textcol;
+   NRENDER * rob;
+   
+   textcol = n_widget_getrendercol(this,RCOL_WIDGET_TEXT);
+   rob = n_widget_getrenderob(this);
+   
+   n_widget_getgeometry(this,0,0,&w,&h);
+   n_render_panel(rob,this,0,0,w,h,this->pressed);
+   n_widget_setfg(this,textcol);
+   
+   if (!this->text) return;
+   
+   len = strlen(this->text);
+
+   tw = th = tb = 0;
+   n_widget_textextent(this,this->text,len,&tw,&th,&tb);
+
+   x = (w-tw)/2;
+   y = (h+th-tb)/2;
+   if (x<0) x=0;
+   if (y<0) y=0;
+   
+   n_widget_text(this,x,y,this->text,len);
+}
+
+static void button_buttondown(NBUTTON * this, int x, int y, unsigned int b)
+{
+   if (b & GR_BUTTON_L) this->pressed = 1;
+   n_widget_repaint(this);
+}
+
+static void button_buttonup(NBUTTON * this, int x, int y, unsigned int b)
+{
+   if (b & GR_BUTTON_L) this->pressed = 0;
+   n_widget_repaint(this);
+}
+
+static void button_clicked(NBUTTON * this, int x, int y, unsigned int b)
+{
+   if (b & GR_BUTTON_L) {
+      if (this->pressed && this->onclick_handler) this->onclick_handler(this,b);
+      this->pressed = 0;
+   }
+   n_widget_repaint(this);
+}
+
+static void button_onclick(NBUTTON * this, void (* h)(NBUTTON *, unsigned int))
+{
+   this->onclick_handler = h;
+}
+
+/* Implement the n_init_widget_class() function */
+INIT_NCLASS(button,widget)
+
+  /* Initialize the proper method slots with new and overridden methods */
+  NMETHOD(button,init,button_init);
+  NMETHOD(object,cleanup,button_cleanup);
+  NMETHOD(widget,repaint,button_repaint);
+  NMETHOD(widget,buttondown,button_buttondown);
+  NMETHOD(widget,buttonup,button_buttonup);
+  NMETHOD(widget,clicked,button_clicked);
+  NMETHOD(button,onclick,button_onclick);
+END_INIT
diff -urN lib/microwindows/src/nwidget/nclass.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/nclass.c
--- lib/microwindows/src/nwidget/nclass.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/nclass.c	2005-02-21 16:13:36.000000000 +0100
@@ -0,0 +1,51 @@
+/*
+ * NanoClasses v0.1
+ * (C) 1999 by Screen Media
+ * 
+ * Minimal toolkit to build a C based class hierarchy
+ * 
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <nclass.h>
+
+struct object_nclass __object_nclass;
+
+static int __object_init (NOBJECT * this) {
+   //printf("__object_init\n");
+   return 0;
+}
+
+static void __object_cleanup (NOBJECT * this) {
+   //printf("__object_cleanup\n");
+}
+
+void n_init_object_class (void) {
+   struct object_nclass * this = &__object_nclass;
+   __object_nclass.__super = 0;
+   
+   NMETHOD(object,init,__object_init);
+   NMETHOD(object,cleanup,__object_cleanup);
+}
+
+/* Create new objects, given a class pointer, and the size of the object. *DO NOT CALL DIRECTLY*
+ * Use NEW_NOBJECT(classname) instead.
+ */
+
+NOBJECT * n_new_object(NCLASS * c, int size)
+{
+   NOBJECT * tmp;
+   
+   tmp = (NOBJECT *)calloc(1,size);
+   if (!tmp) return 0;
+   tmp->__class = c;
+   return tmp;
+}
+
+void n_delete_object(NOBJECT * ob)
+{
+   if (!ob) return;
+   n_object_cleanup(ob);
+   free(ob);
+}
diff -urN lib/microwindows/src/nwidget/nlistview.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/nlistview.c
--- lib/microwindows/src/nwidget/nlistview.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/nlistview.c	2005-02-21 16:13:36.000000000 +0100
@@ -0,0 +1,80 @@
+#include <stdlib.h>
+#include <nwidgets.h>
+
+/* listview_resize()
+ * Used by addentry and addentries to resize the list array if this->maxentries are exceeded.
+ * Can also be used to trim the list in size.
+ */
+
+/* PRIVATE (for now) */
+static void listview_resize (NLISTVIEW * this, int size, int freeold)
+{   
+   const char ** ptr;
+   int i;
+   
+   this->maxentries = size;
+   size++; /* Make space for terminating 0 */
+   
+   ptr = this->entries;
+   
+   this->entries = (const char **) malloc (sizeof (const char *) * size);
+   
+   i = 0;
+   while (ptr[i] && (i < size)) {
+      this->entries[i] = ptr[i];
+      i++;
+   }
+   this->numentries = i;
+   if (this->topentry > this->numentries) this->topentry = this->numentries;
+   this->entries[i] = 0;
+   
+   /* Free old entries, unless specified otherwise */
+   if (ptr && freeold) free(ptr);
+}
+
+static void listview_repaint (NLISTVIEW * this)
+{
+   int w,h;
+   
+   n_widget_getgeometry(this,0,0,&w,&h);
+   n_widget_setfg(this,BLUE);
+   n_widget_setbg(this,BLUE);
+   n_widget_fillrect(this,0,0,w,h);
+   
+   /* Draw text... Excpect text clipping
+    * If selected line is among the visible ones,
+    * highlight.
+    */
+   
+   /* Draw border */
+
+   /* This widget doesnt support scrollbars/sliders. Use the list widget for that */
+}
+
+static void listview_init (NLISTVIEW * this, NWIDGET * parent, const char ** entries)
+{  
+   this->numentries = 0;
+   this->maxentries = 0;
+   this->selected = -1;
+   this->topentry = 0;
+   
+   this->entries = entries;
+   while (*entries) {
+      entries++;
+      this->numentries++;
+   }
+
+   /* Make space, and copy */
+   listview_resize(this, this->numentries + 100,0);
+}
+
+static void listview_cleanup (NLISTVIEW * this)
+{
+   if (this->entries) free(this->entries);
+   n_super(object,cleanup,this,(this));
+}
+
+INIT_NCLASS(listview,widget)
+  NMETHOD(listview,init,listview_init);
+  NMETHOD(object,cleanup,listview_cleanup);
+END_INIT
diff -urN lib/microwindows/src/nwidget/nradio.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/nradio.c
--- lib/microwindows/src/nwidget/nradio.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/nradio.c	2005-02-21 16:13:36.000000000 +0100
@@ -0,0 +1,77 @@
+#include <nwidgets.h>
+
+static int radio_init (NRADIO * this, NWIDGET * parent)
+{
+   if (n_toggle_init(this,parent)) return -1;
+   
+   this->next_radio = this;
+   this->last_radio = this;
+   
+   return 0;
+}
+
+static void radio_cleanup (NTOGGLE * this)
+{
+   n_super(object,cleanup,this,(this));
+}
+
+static void radio_paintstate (NRADIO *this, int state)
+{
+   int w,h;
+   n_widget_getgeometry(this,0,0,&w,&h);
+   if (state) {
+      n_widget_setfg(this,0);
+      n_widget_line(this,2,2,w-2,h-2);
+      n_widget_line(this,3,2,w-2,h-3);
+      n_widget_line(this,w-2,2,2,h-2);
+      n_widget_line(this,w-3,2,2,h-3);
+   }
+}
+
+static void radio_connect(NRADIO * this, NRADIO * ob)
+{
+   ob->next_radio = this->next_radio;
+   ob->last_radio = this;
+   
+   this->next_radio = ob;
+   ob->next_radio->last_radio = ob;
+
+   n_toggle_setstate(this,1);
+}
+
+static void radio_setstate(NRADIO * this, int state)
+{
+   NRADIO * tmp;
+   
+   n_super(toggle,setstate,this,(this,state));
+   
+   /* Reverse state for all the others in this group */
+   state = state ? 0 : 1;
+   tmp = this->next_radio;
+   while (tmp != this) {
+      n_super(toggle,setstate,tmp,(tmp,state));
+      tmp = tmp->next_radio;
+   }
+}
+
+static void radio_buttondown(NTOGGLE * this, int x, int y, unsigned int b)
+{
+   if (b & GR_BUTTON_L) {
+      this->pressed = 1;
+      n_toggle_setstate(this,1);
+   }
+}
+
+INIT_NCLASS(radio,toggle)
+
+  /* Initialize the proper method slots with new and overridden methods */
+  NMETHOD(radio,init,radio_init);
+  NMETHOD(radio,connect,radio_connect);
+
+  NMETHOD(toggle,setstate,radio_setstate);
+  NMETHOD(toggle,paintstate,radio_paintstate);
+
+  NMETHOD(widget,buttondown,radio_buttondown);
+
+  NMETHOD(object,cleanup,radio_cleanup);
+END_INIT
diff -urN lib/microwindows/src/nwidget/nrender.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/nrender.c
--- lib/microwindows/src/nwidget/nrender.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/nrender.c	2005-02-21 16:13:37.000000000 +0100
@@ -0,0 +1,58 @@
+#include <nwidgets.h>
+
+static int render_init (NRENDER * this)
+{
+   if (n_object_init(this)) return -1;
+   
+   /* Initialize default colors */
+   
+   this->colors[RCOL_WIDGET_BACKGROUND] = GRAY;
+   this->colors[RCOL_WIDGET_TEXT] = BLACK;
+   this->colors[RCOL_WIDGET_TEXTBACKGROUND] = LTGRAY;
+   this->colors[RCOL_WIDGET_DARK] = BLACK;
+   this->colors[RCOL_WIDGET_MEDIUM] = GRAY;
+   this->colors[RCOL_WIDGET_LIGHT] = WHITE;
+   this->colors[RCOL_HIGHLIGHTED] = LTBLUE;
+   this->colors[RCOL_CURSOR] = BLUE;
+   
+   return 0;
+}
+
+static void render_cleanup (NRENDER * this)
+{
+   n_super(object,cleanup,this,(this));
+}
+
+static MWCOLORVAL render_getcolor (NRENDER * this, int col)
+{
+   if (col>RCOL_MAXCOL || col < 0) return -1;
+   return this->colors[col];
+}
+
+static void render_border(NRENDER * this, NWIDGET * widget, int x,int y, int w,int h, int pressed)
+{
+   n_widget_setfg(widget,this->colors[pressed ? RCOL_WIDGET_DARK : RCOL_WIDGET_LIGHT]);
+   n_widget_line(widget,x,y,x+w-1,y);
+   n_widget_line(widget,x,y,x,y+h-1);
+   n_widget_setfg(widget,this->colors[!pressed ? RCOL_WIDGET_DARK : RCOL_WIDGET_LIGHT]);
+   n_widget_line(widget,x+w-1,y+1,x+w-1,y+h-1);
+   n_widget_line(widget,x+1,y+h-1,x+w-1,y+h-1);
+
+}
+
+static void render_panel(NRENDER * this, NWIDGET * widget, int x,int y, int w,int h, int pressed)
+{
+   n_widget_setfg(widget,this->colors[!pressed ? RCOL_WIDGET_BACKGROUND : RCOL_HIGHLIGHTED]);
+   n_widget_fillrect(widget,x,y,w,h);
+   n_render_border(this,widget,x,y,w,h,pressed);
+}
+
+INIT_NCLASS(render,object)
+
+  /* Initialize the proper method slots with new and overridden methods */
+  NMETHOD(render,init,render_init);
+  NMETHOD(object,cleanup,render_cleanup);
+  NMETHOD(render,getcolor,render_getcolor);
+  NMETHOD(render,border,render_border);
+  NMETHOD(render,panel,render_panel);
+END_INIT
diff -urN lib/microwindows/src/nwidget/nslider.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/nslider.c
--- lib/microwindows/src/nwidget/nslider.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/nslider.c	2005-02-21 16:13:37.000000000 +0100
@@ -0,0 +1,123 @@
+#include <nwidgets.h>
+
+/* Strictly internal. We dont export the interface for this one */
+static void slider_calcbounds(NSLIDER * this, int * x, int * y, int * w, int * h)
+{
+   *x = 2 + ((*w * this->rel_x) / this->rel_maxw);
+   *y = 2 + ((*h * this->rel_y) / this->rel_maxh);
+
+   *w = (*w / (this->rel_maxw / this->rel_w)) - 4;
+   *h = (*h / (this->rel_maxh / this->rel_h)) - 4;       
+}
+
+/* Make sure noone are playing tricks with the slider boundaries... */
+static void slider_enforcebounds(NSLIDER * this) 
+{
+   if (this->rel_x < 0) this->rel_x = 0;
+   if (this->rel_y < 0) this->rel_y = 0;
+   if (this->rel_x > (this->rel_maxw - this->rel_w)) this->rel_x = this->rel_maxw - this->rel_w;
+   if (this->rel_y > (this->rel_maxh - this->rel_h)) this->rel_y = this->rel_maxh - this->rel_h;
+}
+
+static void slider_buttondown(NSLIDER * this, int x, int y, unsigned int b)
+{
+   int bx,by,bw,bh;
+   if (b & GR_BUTTON_L) {
+      n_widget_getgeometry(this,0,0,&bw,&bh);
+      slider_calcbounds(this,&bx,&by,&bw,&bh);
+      
+      if (x>=bx && x<= (bx+bw) &&
+	  y>=by && y<= (by+bh)) {
+      
+	 this->pressed = 1;
+	 this->ox = x;
+	 this->oy = y;
+      }
+   }
+   n_widget_repaint(this);
+}
+
+static void slider_buttonup(NSLIDER * this, int x, int y, unsigned int b)
+{
+   if (b & GR_BUTTON_L) {
+      this->pressed = 0;
+      this->ox = 0;
+      this->oy = 0;
+   }
+   n_widget_repaint(this);
+}
+
+static void slider_mousemove(NSLIDER * this, int x, int y, unsigned int b)
+{
+   int w,h;
+   
+   if (this->pressed) {
+      n_widget_getgeometry(this,0,0,&w,&h);
+      //printf("MOUSEMOVE: x=%d,y=%d\n",x,y);
+
+      /* FIXME: Change rel_x/rel_y, based on ox-x and oy-y reset offset */
+      if (this->freedom & NSLIDER_FREEDOM_HORIZONTAL) {
+	 this->rel_x += ((x - this->ox) * (this->rel_maxw / (w-4)));
+      }
+      if (this->freedom & NSLIDER_FREEDOM_VERTICAL) {
+	 this->rel_y += ((y - this->oy) * (this->rel_maxh / (h-4)));
+      }
+      //printf("this->rel_y = %d, this->oy = %d, y=%d, this->rel_maxh / h = %d\n",this->rel_y, this->oy,y,this->rel_maxh / h);
+      this->ox = x;
+      this->oy = y;
+   
+      slider_enforcebounds(this);
+      
+      n_widget_repaint(this);
+   }
+}
+
+static void slider_repaint (NSLIDER * this)
+{
+   int w,h,x,y;
+   
+   NRENDER * rob;
+   
+   rob = n_widget_getrenderob(this);
+   n_widget_getgeometry(this,0,0,&w,&h);
+   
+   n_widget_setfg(this,LTGRAY);
+   n_widget_setbg(this,LTGRAY);
+   n_widget_fillrect(this,1,1,w-2,h-2);
+   n_render_border(rob,this,0,0,w,h,1);
+   
+   slider_calcbounds(this,&x,&y,&w,&h);
+#ifdef DEBUG   
+   fprintf(stderr,"SLIDER: x=%d, y=%d, w=%d, h=%d\n",x,y,w,h);
+#endif
+   n_render_panel(rob,this,x,y,w,h,this->pressed);
+   
+}
+
+static int slider_init (NSLIDER * this, NWIDGET * parent)
+{
+   if (n_widget_init(this,parent)) return -1;
+   
+   this->pressed = 0;
+   this->freedom = NSLIDER_FREEDOM_VERTICAL | NSLIDER_FREEDOM_HORIZONTAL; 
+   
+   this->rel_maxw = 1000;
+   this->rel_maxh = 1000;
+   this->rel_w = 100;
+   this->rel_h = 100;
+   this->rel_x = 0;
+   this->rel_y = 50;
+
+   this->move_handler = 0;
+   
+   return 0;
+}
+
+INIT_NCLASS(slider,widget)
+    NMETHOD(slider,init,slider_init); 
+    NMETHOD(widget,repaint,slider_repaint); 
+    NMETHOD(widget,buttondown,slider_buttondown);
+    NMETHOD(widget,buttonup,slider_buttonup);
+    NMETHOD(widget,clicked,slider_buttonup); /* No difference between click and buttonup for slider...*/
+    NMETHOD(widget,mousemove,slider_mousemove);
+END_INIT
diff -urN lib/microwindows/src/nwidget/ntextfield.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/ntextfield.c
--- lib/microwindows/src/nwidget/ntextfield.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/ntextfield.c	2005-02-21 16:13:37.000000000 +0100
@@ -0,0 +1,234 @@
+#include <stdlib.h>
+#include <string.h>
+#include <nwidgets.h>
+
+/* PRIVATE */
+static void textfield_drawcursor (NTEXTFIELD * this, int h)
+{
+   int th,tw,tb;
+   if (h == 0) n_widget_getgeometry(this,0,0,0,&h);   
+   n_widget_setfg(this,GRAY);
+   if (this->curpos > this->firstpos)
+     n_widget_textextent(this,this->textbuf + this->firstpos,this->curpos - this->firstpos,&tw,&th,&tb);
+   else tw = 0;
+   n_widget_setmode(this,GR_MODE_XOR); 
+   n_widget_line(this,2+tw,2,2+tw,h-2);
+   n_widget_setmode(this,GR_MODE_SET); 
+}
+
+static void textfield_repaint (NTEXTFIELD * this)
+{
+   int w,h;
+   int th,tw,tb,len;
+   NRENDER * rob;
+   
+   rob = n_widget_getrenderob(this);
+   n_widget_getgeometry(this,0,0,&w,&h);
+   
+   n_widget_setfg(this,LTGRAY);
+   n_widget_setbg(this,LTGRAY);
+   n_widget_fillrect(this,1,1,w-2,h-2);
+
+   n_widget_setfg(this,1);
+
+   len = strlen(this->textbuf + this->firstpos);
+
+   tw = th = tb = 0;
+   n_widget_textextent(this,this->textbuf + this->firstpos,len,&tw,&th,&tb);
+
+//   if (tw > w) printf("tw > w: tw = %d, w = %d\n",tw,w);
+   /* FIXME: Ugly and slow */
+   while (tw > w) {
+      len--;
+      n_widget_textextent(this,this->textbuf + this->firstpos,len,&tw,&th,&tb);
+   }
+//   n_widget_text(this,2,h - 2 - tb,this->textbuf+this->firstpos,len);
+   n_widget_text(this,2, tb + 4,this->textbuf+this->firstpos,len);
+
+   if (n_widget_isinfocus(this)) textfield_drawcursor(this,h);
+
+   n_render_border(rob,this,0,0,w,h,1);
+}
+
+static void textfield_settext (NTEXTFIELD * this, const char * text)
+{   
+   int maxsize;
+
+   if (text && strlen(text) > 256) maxsize = strlen(text) + 1;
+   else maxsize = 256;
+
+   if (this->maxsize < maxsize) {
+      if (this->textbuf) free(this->textbuf);
+      if ((this->textbuf = malloc(maxsize))) {
+	 this->textbuf[0] = '\0';
+	 this->maxsize = maxsize;
+      } else this->maxsize = 0;
+   }
+   
+   if (!this->textbuf) free(this->textbuf);
+   if (text) this->textbuf = strdup(text);
+   else this->textbuf = 0;
+
+   if (text && this->textbuf) strcpy(this->textbuf,text);
+   this->curpos = 0;
+   this->firstpos = 0;
+   
+   n_widget_repaint(this);
+
+}
+
+static void textfield_cleanup (NTEXTFIELD * this)
+{
+
+   if (this->textbuf) free(this->textbuf);
+   n_super(object,cleanup,this,(this));
+}
+
+static int textfield_init (NTEXTFIELD * this, NWIDGET * parent, const char * text)
+{
+   if (n_widget_init(this,parent)) return -1;
+
+   /* FIXME: Should use n_textfield_settext */
+
+   textfield_settext(this,text);
+
+   return 0;
+}
+
+static void textfield_buttondown(NTEXTFIELD *this, int x, int y, unsigned int b)
+{
+   int len;
+   int tw,th,tb;
+   
+   if (!this->textbuf) this->curpos = 0;
+   else {
+      /* FIXME: Do real calculation... This is *UGLY* */
+      this->curpos = this->firstpos;
+      tw = 0;
+      while(tw < x) {
+	 n_widget_textextent(this,this->textbuf + this->firstpos,this->curpos + 1 - this->firstpos,&tw,&th,&tb);
+	 this->curpos++;
+      }
+      this->curpos -= 1;      
+      
+      len = strlen(this->textbuf);
+      if (this->curpos > len) this->curpos = len;
+   }
+   n_widget_repaint(this);
+}
+
+/* PRIVATE */
+/* Adjust this->firstpos so that this->curpos is always visible
+ * FIXME: Currently this entire function is one *HUGE* hack. Should really
+ * cache the last visible position, and use that, and recalc that when
+ * firstpos is changed.
+ */
+static int textfield_adjustfirstpos(NTEXTFIELD * this)
+{
+   int w,h;
+   int th,tw,tb,len;
+   
+   if (this->curpos <= this->firstpos) {
+      this->curpos = this->firstpos;
+      return 0;
+   }
+   
+   n_widget_getgeometry(this,0,0,&w,&h);
+
+   len = this->curpos - this->firstpos;
+
+   tw = th = tb = 0;
+   n_widget_textextent(this,this->textbuf + this->firstpos,len,&tw,&th,&tb);
+
+   if (tw < (w-8)) return 0;
+   while (len>0 && tw > (w-8)) {
+      this->firstpos++;
+      len--;
+      n_widget_textextent(this,this->textbuf + this->firstpos,len,&tw,&th,&tb);
+   }
+   return 1;
+}
+
+/* FIXME: Clean this up... Logic is way too convoluted.
+ * This will also need to be improved to handle Unicode text in the future.
+ */
+static void textfield_keypress(NTEXTFIELD * this, int ch, unsigned int modifiers, unsigned int buttons)
+{
+   unsigned char c = (unsigned char) ch;
+   //fprintf(stderr,"   ch = %c / %x\n   modifiers = %x\n",ch,ch,modifiers);
+   if (this->textbuf && this->curpos < this->maxsize) {
+      /* Erase the cursor if it is tere... */
+      if (n_widget_isinfocus(this)) textfield_drawcursor(this,0);
+      
+      /* FIXME: Check modifiers */
+      if (this->esc) {
+	 if (c == 'D') {
+	    if (!this->curpos) {
+	       this->esc = 0;
+	       if (n_widget_isinfocus(this)) textfield_drawcursor(this,0);
+	       return;
+	    }
+	    this->curpos--;
+	    this->esc = 0;
+	    if (this->curpos < this->firstpos && this->firstpos) this->firstpos--;
+	    else {
+	       if (n_widget_isinfocus(this)) textfield_drawcursor(this,0);
+	       return;
+	    }
+	 } else if (c == 'C') {
+	    if (this->textbuf && this->textbuf[this->curpos]) this->curpos++;
+	    this->esc = 0;
+	    
+	    if (textfield_adjustfirstpos(this)) n_widget_repaint(this);
+	    else if (n_widget_isinfocus(this)) textfield_drawcursor(this,0);
+	    return;
+	 } else {
+	    if (n_widget_isinfocus(this)) textfield_drawcursor(this,0);
+	    return;
+	 }
+      } else if (c == 0x01) {  /* CTRL-A  -- Go to beginning */
+	 this->curpos = 0;
+	 this->firstpos = 0;
+
+      } else if (c == 0x05) {  /* CTRL-E  -- Go to end */
+	 this->curpos = strlen(this->textbuf);
+	 
+	 if (textfield_adjustfirstpos(this)) n_widget_repaint(this);
+	 else if (n_widget_isinfocus(this)) textfield_drawcursor(this,0);
+	 return;
+      } else if (c == 0x18) {  /* CTRL-X  -- Delete line */
+	 if (this->textbuf) this->textbuf[0] = '\0';
+	 this->curpos = 0;
+	 this->firstpos = 0;
+      } else if (c == 0x1b) {
+	 this->esc = 1;
+	 if (n_widget_isinfocus(this)) textfield_drawcursor(this,0);
+	 return;
+      } else if (c == 0x7f) {
+	 if (this->textbuf && this->curpos>0) {
+	    memmove(this->textbuf + this->curpos-1, this->textbuf + this->curpos, this->maxsize - this->curpos);
+	    this->curpos--;
+	    if (this->curpos < this->firstpos) this->firstpos--;
+	 }
+      } else if (c >= 0x20) {
+	 if (this->overwrite) {
+	    if (this->textbuf[this->curpos] == '\0') this->textbuf[this->curpos+1] = '\0';
+	 } else {
+	    memmove(this->textbuf + this->curpos + 1, this->textbuf + this->curpos, this->maxsize - this->curpos+1);
+	 }
+	 this->textbuf[this->curpos] = c;
+	 this->curpos++;
+	 textfield_adjustfirstpos(this);
+      }
+      /* FIXME: Use verify handler */
+      n_widget_repaint(this);
+   }
+}
+
+INIT_NCLASS(textfield,widget)
+   NMETHOD(textfield,init,textfield_init);
+   NMETHOD(object,cleanup,textfield_cleanup);
+   NMETHOD(widget,repaint,textfield_repaint);
+   NMETHOD(widget,buttondown,textfield_buttondown);
+   NMETHOD(widget,keypress,textfield_keypress);
+END_NCLASS
diff -urN lib/microwindows/src/nwidget/ntoggle.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/ntoggle.c
--- lib/microwindows/src/nwidget/ntoggle.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/ntoggle.c	2005-02-21 16:13:37.000000000 +0100
@@ -0,0 +1,93 @@
+#include <nwidgets.h>
+
+static int toggle_init (NTOGGLE * this, NWIDGET * parent)
+{
+   if (n_widget_init(this,parent)) return -1;
+   this->pressed = 0;
+   this->selected = 0;
+   this->onchange_handler = 0;
+   
+   return 0;
+}
+
+static void toggle_cleanup (NTOGGLE * this)
+{
+   n_super(object,cleanup,this,(this));
+}
+
+static void toggle_paintstate (NTOGGLE * this, int state)
+{
+   int w,h;
+   n_widget_getgeometry(this,0,0,&w,&h);
+   if (state) {
+      n_widget_setfg(this,0);
+      n_widget_line(this,3,(h/2),((w-4)/2),h-3);
+      n_widget_line(this,2,(h/2),((w-4)/2),h-2);
+      n_widget_line(this,((w-5)/2),h-2,w-5,2);
+      n_widget_line(this,((w-4)/2),h-2,w-4,2);
+   }
+}
+
+static void toggle_repaint (NTOGGLE * this)
+{
+   int w,h;
+   NRENDER * rob;
+   n_widget_getgeometry(this,0,0,&w,&h);
+   rob = n_widget_getrenderob(this);   
+   n_render_panel(rob,this,0,0,w,h,this->pressed);
+   n_toggle_paintstate(this,this->selected);
+}
+
+static int toggle_isselected (NTOGGLE * this)
+{
+   return this->selected;
+}
+
+static void toggle_setstate(NTOGGLE * this, int state)
+{
+   if (this->selected != state) {
+      this->selected = state;
+      if (this->onchange_handler) this->onchange_handler(this,state);
+      n_widget_repaint(this);
+   }
+}
+
+static void toggle_buttondown(NTOGGLE * this, int x, int y, unsigned int b)
+{
+   if (b & GR_BUTTON_L) {
+      this->pressed = 1;
+      n_toggle_setstate(this,this->selected ? 0 : 1);
+   }
+}
+
+static void toggle_buttonup(NTOGGLE * this, int x, int y, unsigned int b)
+{
+   if (b & GR_BUTTON_L) {
+      this->pressed = 0;
+      n_widget_repaint(this);
+   }
+}
+
+static void toggle_onchange(NTOGGLE * this, void (* h)(NTOGGLE *,int))
+{
+   this->onchange_handler = h;
+}
+
+/* Implement the n_init_widget_class() function */
+INIT_NCLASS(toggle,widget)
+
+  /* Initialize the proper method slots with new and overridden methods */
+  NMETHOD(toggle,init,toggle_init);
+  NMETHOD(toggle,onchange,toggle_onchange);
+  NMETHOD(toggle,setstate,toggle_setstate);
+  NMETHOD(toggle,paintstate,toggle_paintstate);
+  NMETHOD(toggle,isselected,toggle_isselected);
+
+  NMETHOD(widget,repaint,toggle_repaint);
+  NMETHOD(widget,buttondown,toggle_buttondown);
+  NMETHOD(widget,buttonup,toggle_buttonup);
+  NMETHOD(widget,clicked,toggle_buttonup);
+
+  NMETHOD(object,cleanup,toggle_cleanup);
+
+END_INIT
diff -urN lib/microwindows/src/nwidget/nwidget.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/nwidget.c
--- lib/microwindows/src/nwidget/nwidget.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nwidget/nwidget.c	2005-02-21 16:13:37.000000000 +0100
@@ -0,0 +1,449 @@
+/*
+ * NanoWidgets v0.2
+ * (C) 1999 Screen Media AS
+ * 
+ * Written by Vidar Hokstad
+ * 
+ * Contains code from The Nano Toolkit,
+ * (C) 1999 by Alexander Peuchert.
+ * 
+ * In theory, only the widget class should depend on the underlying windowing
+ * system. In practice, bitmap formats etc. may also end up being system
+ * specific, though.
+ */
+
+#include <stdio.h>
+#include <nwidgets.h>
+
+static NWIDGET * infocus = 0;
+static GR_GC_ID __defaultGC = -1;
+static NRENDER * __defaultRenderob = 0; /* FIXME, not implemented yet */
+
+typedef struct {
+  NWIDGET * wid;
+  GR_WINDOW_ID win;
+} _lookup_struct;
+
+#define LOOKUP_SIZE 256
+
+_lookup_struct _table[LOOKUP_SIZE];
+
+static NWIDGET * n_win2widget (GR_WINDOW_ID win)
+{
+  int i;
+
+  for (i = 0; i < LOOKUP_SIZE; i++) {
+    if (_table[i].win == win) {
+      /* widget found */
+      return _table[i].wid;
+    }
+  }
+  /* widget not found */
+  return (NWIDGET *)0;
+}
+
+static short n_lookup_init ()
+{
+  memset (_table, 0, sizeof (_lookup_struct) * LOOKUP_SIZE);
+  return 0;
+}
+
+static short n_lookup_add_widget (NWIDGET * wid)
+{
+  int i;
+  for (i = 0; i < LOOKUP_SIZE; i++) {
+    if (! _table[i].wid) {
+      /* found free row */
+      _table[i].wid = wid;
+      _table[i].win = wid->id;
+      return 0;
+    }
+  }
+  /* no free row found */
+  return -1;
+}
+
+static short n_lookup_remove_widget (NWIDGET * wid)
+{
+  int i;
+
+  for (i = 0; i < LOOKUP_SIZE; i++) {
+    if (_table[i].wid == wid) {
+      /* widget found */
+      _table[i].wid = (NWIDGET *)0;
+      _table[i].win = 0;
+      return 0;
+    }
+  }
+  /* widget not found */
+  return -1;
+  
+  return 0;
+}
+
+static int widget_isinfocus (NWIDGET * this)
+{
+   return this->infocus;
+}
+
+static void widget_leavefocus (NWIDGET * this)
+{
+   this->infocus = 0;
+   n_widget_repaint(this);
+}
+
+static void widget_setfocus (NWIDGET * this)
+{
+   
+   if (infocus) n_widget_leavefocus(infocus);
+   infocus = this;
+   if (this) this->infocus = 1;
+}
+
+static int widget_init (NWIDGET * this, NWIDGET * parent)
+{
+   //printf("widget_init\n");
+
+   if (n_object_init(this)) return -1;
+
+   this->parent = parent;
+   this->sibling = 0;
+   this->children = 0;
+   
+   this->x = 50;
+   this->y = 50;
+   this->w = 150;
+   this->h = 150;
+
+   this->shown = 0;
+   n_widget_setfocus(this);
+   
+   this->id = -1;
+
+   if (parent)  {
+      this->gc = parent->gc;
+      this->renderob = parent->renderob;
+      this->layout = parent->layout;
+   } else {
+      this->gc = __defaultGC;
+      this->renderob = (NOBJECT *) __defaultRenderob;
+      this->layout = 0; /* FIXME */
+   }
+   
+   /* Realize windows */
+   if (this->parent) {
+      /* widget has a parent */
+      this->id = GrNewWindow(((NWIDGET *)this->parent)->id,this->x, this->y, this->w, this->h, 0, 0 , 2);
+   } else {
+      /* widget has no parent -> it's some kind of root widget */
+      this->id = GrNewWindow(GR_ROOT_WINDOW_ID,this->x, this->y, this->w, this->h, 0, 6 , 15);
+   }
+
+   /* Add widget to window id -> widget lookup table */
+   n_lookup_add_widget(this);
+
+   /* Attach this widget to the parent structure as a child */
+   if (parent) n_widget_attach(parent,this);
+   
+   //printf("Widget id = %d\n",this->id);
+   if (this->id == -1) {
+      fprintf(stderr,"Unable to open window \n");
+   }
+   
+   /* FIXME: This is inefficient. Should at the VERY LEAST let the widgets that need mouse motion/mouse position
+    * events request them, instead of enabling those for all widgets
+    */
+   GrSelectEvents(this->id, GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_MOUSE_MOTION | GR_EVENT_MASK_MOUSE_POSITION |
+		  GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_MOUSE_MOTION | 
+		  GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_CLOSE_REQ); 
+   return 0;
+}
+
+static void widget_cleanup (NWIDGET * this)
+{
+#ifdef DEBUG   
+   printf ("%p::widget_cleanup()\n",this);
+#endif
+   
+   n_widget_hide(this);
+   
+   /* Remove widget from the system wide lookup table */
+   n_lookup_remove_widget(this);
+   
+   if (this->id != -1) GrDestroyWindow(this->id);
+   this->id = -1;
+   
+   n_super(object,cleanup,this,(this));
+}
+
+static void widget_getgeometry (NWIDGET * this, int * x, int *y, int * w, int * h)
+{
+   if (x) *x = this->x;
+   if (y) *y = this->y;
+   if (w) *w = this->w;
+   if (h) *h = this->h;
+}
+
+static void widget_move (NWIDGET * this, int x, int y)
+{
+   this->x = x; this->y = y;
+   if (this->id != -1) GrMoveWindow(this->id,x,y);
+}
+
+static void widget_resize (NWIDGET * this, int w, int h)
+{
+   this->w = w; this->h = h;
+   if (this->id != -1) GrResizeWindow(this->id,w,h);
+}
+
+static void widget_fillrect (NWIDGET * this, int x, int y, int w, int h)
+{
+   if (this->id == -1 || this->shown == NWFALSE) return;
+   GrFillRect(this->id,this->gc,x,y,w,h);
+}
+
+static void widget_rect (NWIDGET * this, int x, int y, int w, int h)
+{
+   if (this->id == -1 || this->shown == NWFALSE) return;
+   GrRect(this->id,this->gc,x,y,w,h);
+}
+
+static void widget_line (NWIDGET * this, int x1, int y1, int x2, int y2)
+{
+   if (this->id == -1 || this->shown == NWFALSE) return;
+   GrLine(this->id,this->gc,x1,y1,x2,y2);
+}
+
+static void widget_setfg (NWIDGET * this, GR_COLOR fg)
+{
+   GrSetGCForeground(this->gc,fg);
+}
+
+static void widget_setbg (NWIDGET * this, GR_COLOR bg)
+{
+   GrSetGCBackground(this->gc,bg);
+}
+
+static void widget_setmode (NWIDGET * this, int mode)
+{
+   GrSetGCMode(this->gc,mode);
+}
+
+static void widget_attach (NWIDGET * this, NWIDGET * child)
+{
+   if (!child || !this) return;
+   
+   child->sibling = this->children;
+   this->children = child;
+}
+
+static void widget_repaint (NWIDGET * this)
+{
+   NWIDGET * tmp;
+
+   MWCOLORVAL border;
+   MWCOLORVAL bg;
+   
+   if (this->id == -1 || this->shown == NWFALSE) return;
+   
+   /* FIXME: For test only... So I can see my widgets :) */
+   bg = n_widget_getrendercol(this,RCOL_WIDGET_BACKGROUND);
+   border = n_widget_getrendercol(this,RCOL_WIDGET_DARK);
+   
+   n_widget_setfg(this, bg);
+   n_widget_fillrect(this,0,0,this->w,this->h);
+   n_widget_setfg(this, border);
+   n_widget_rect(this,0,0,this->w,this->h);
+
+   tmp = this->children;
+   while (tmp) {
+      n_widget_repaint(tmp);
+      tmp = tmp->sibling;
+   }
+}
+
+static void widget_show (NWIDGET * this)
+{
+   if (this->id == -1) {
+//fixed by ijsung
+      printf ("   No window to show\n");
+      /* widget is not initialized. This is a fatal error... */
+      return;
+   }
+
+   /* now, map the widget in the server */
+   GrMapWindow(this->id);
+   this->shown = NWTRUE;
+   
+   n_widget_repaint(this); 
+}
+
+static void widget_hide (NWIDGET * this)
+{
+   if (this->id == -1) {
+      /* widget is not initialized. This is a fatal error... */
+      return;
+   }
+
+   /* now, unmap the widget in the server */
+   GrUnmapWindow(this->id);
+   this->shown = NWTRUE;
+}
+
+static void widget_buttondown(NWIDGET * this, int x, int y, unsigned int b)
+{
+   /* FIXME: For test purposes only */
+   if (b & GR_BUTTON_R) n_widget_repaint(this);
+}
+
+static void widget_buttonup(NWIDGET * this, int x, int y, unsigned int b)
+{
+}
+
+static void widget_clicked(NWIDGET * this, int x, int y, unsigned int b)
+{
+}
+
+static void widget_mousemove(NWIDGET * this, int x,int y, unsigned int b)
+{
+}
+
+static NRENDER * widget_getrenderob(NWIDGET * this)
+{
+   return (NRENDER *) this->renderob;
+}
+
+static MWCOLORVAL widget_getrendercol(NWIDGET * this, int col)
+{
+   if (!this->renderob) return -1;
+   return n_render_getcolor(this->renderob, col);
+}
+
+static void widget_text(NWIDGET * this, int x, int y, const char * text, int len)
+{
+   if (this->id == -1 || this->shown == NWFALSE) return;
+   if (!text || len <= 0 || *text == '\0') return;
+   GrText(this->id,this->gc,x,y,(char *)text,len, GR_TFASCII|GR_TFBOTTOM);
+}
+
+static void widget_textextent(NWIDGET * this, const char * text, int len, int * retw, int * reth, int * retb)
+{
+   if (!text || len <= 0 || *text == '\0') return;
+   GrGetGCTextSize(this->gc,(char *)text,len,0,retw,reth,retb);
+}
+
+static void widget_keypress(NWIDGET * this, unsigned int ch, unsigned int modifiers, unsigned int buttons)
+{
+   //printf("  ch = %c (%x)\n",ch,ch);
+   //printf("  modifiers = %x\n",modifiers);
+   //printf("  buttons = %x\n",buttons);
+}
+
+/* Implement the n_init_widget_class() function */
+INIT_NCLASS(widget,object)
+  /* Initalize Nano-X, and set up the default GC */
+
+  if (GrOpen() < 0) {
+     fprintf(stderr,"Unable to open connection to Nano X\n");
+     exit(1);
+  }
+
+  __defaultGC = GrNewGC();
+  GrSetGCBackground(__defaultGC, BLUE);
+  GrSetGCForeground(__defaultGC, GREEN);
+  GrSetGCUseBackground(__defaultGC, NWFALSE);
+#if 0
+#ifdef MWIN
+  GrSetGCFont(__defaultGC, GR_FONT_GUI_VAR);
+#endif
+#endif
+
+  n_init_render_class();
+  __defaultRenderob = NEW_NOBJECT(render);
+  n_render_init(__defaultRenderob);
+
+  /* Init window id -> widget lookup */
+  n_lookup_init();
+
+  /* Initialize the proper method slots with new and overridden methods */
+  NMETHOD(widget,init,widget_init);
+  NMETHOD(object,cleanup,widget_cleanup);
+  NMETHOD(widget,attach,widget_attach); 
+
+  NMETHOD(widget,show,widget_show); 
+  NMETHOD(widget,hide,widget_hide); 
+  NMETHOD(widget,repaint,widget_repaint);
+
+  NMETHOD(widget,fillrect,widget_fillrect);
+  NMETHOD(widget,rect,widget_rect);
+  NMETHOD(widget,line,widget_line);
+  NMETHOD(widget,setfg,widget_setfg);
+  NMETHOD(widget,setbg,widget_setbg);
+  NMETHOD(widget,setmode,widget_setmode);
+  NMETHOD(widget,move,widget_move);
+  NMETHOD(widget,resize,widget_resize);
+  NMETHOD(widget,getgeometry,widget_getgeometry);
+
+  NMETHOD(widget,buttonup,widget_buttonup);
+  NMETHOD(widget,buttondown,widget_buttondown);
+  NMETHOD(widget,mousemove,widget_mousemove);
+  NMETHOD(widget,clicked,widget_clicked);
+  NMETHOD(widget,keypress,widget_keypress);
+
+  NMETHOD(widget,setfocus,widget_setfocus);
+  NMETHOD(widget,leavefocus,widget_leavefocus);
+  NMETHOD(widget,isinfocus,widget_isinfocus);
+
+  NMETHOD(widget,text,widget_text);
+  NMETHOD(widget,textextent,widget_textextent);
+
+  NMETHOD(widget,getrendercol,widget_getrendercol);
+  NMETHOD(widget,getrenderob,widget_getrenderob);
+END_INIT
+
+void n_handle_event (void) 
+{
+   GR_EVENT event;          /* current event */
+   NWIDGET * evw;
+      
+   GrGetNextEvent(&event);
+
+   evw = n_win2widget(event.general.wid);
+      
+   switch (event.type) {
+    case GR_EVENT_TYPE_CLOSE_REQ:	/* FIXME: the app should handle this */
+      GrClose();
+      exit(0);
+    case GR_EVENT_TYPE_KEY_DOWN:
+      n_widget_keypress(infocus,event.keystroke.ch,event.keystroke.modifiers,event.keystroke.buttons);
+      break;
+    case GR_EVENT_TYPE_MOUSE_MOTION:
+//    case GR_EVENT_TYPE_MOUSE_POSITION:
+      evw = n_win2widget(event.mouse.wid);
+      if (evw) {
+	 //fprintf(stderr,"mouse.x = %d, mouse.y = %d, mouse.buttons = %d\n",event.mouse.x,event.mouse.y, event.mouse.buttons);
+	 n_widget_mousemove(evw,event.mouse.x,event.mouse.y,event.mouse.buttons);
+      }
+      break;
+    case GR_EVENT_TYPE_EXPOSURE:
+      if (evw) n_widget_repaint(evw);
+      break;
+    case GR_EVENT_TYPE_BUTTON_UP:
+      evw = n_win2widget(event.button.subwid);
+      if (evw) {
+	 /* FIXME: This does not work as planned. We may have to track focus */
+	 if (event.button.subwid == event.general.wid) {
+	    n_widget_clicked(evw,event.button.x,event.button.y,event.button.changebuttons);
+	 } else n_widget_buttonup(evw,event.button.x,event.button.y,event.button.changebuttons);
+      }
+      break;
+    case GR_EVENT_TYPE_BUTTON_DOWN:
+      evw = n_win2widget(event.button.subwid);
+      if (evw) {
+	 n_widget_setfocus(evw);
+	 n_widget_buttondown(evw,event.button.x,event.button.y,event.button.changebuttons);
+      }
+
+      break;
+   }
+}
diff -urN lib/microwindows/src/nxkbd.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nxkbd.sh
--- lib/microwindows/src/nxkbd.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nxkbd.sh	2005-02-21 16:13:43.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X & bin/nxkbd & bin/nanowm & bin/nxterm & bin/nxterm & sleep 10000
diff -urN lib/microwindows/src/nxview.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nxview.sh
--- lib/microwindows/src/nxview.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/nxview.sh	2005-02-21 16:03:54.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X -N & bin/nanowm & bin/nxview $1 $2; sleep 10000
diff -urN lib/microwindows/src/rtems/Makefile.rtems /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/rtems/Makefile.rtems
--- lib/microwindows/src/rtems/Makefile.rtems	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/rtems/Makefile.rtems	2005-02-21 16:03:50.000000000 +0100
@@ -0,0 +1,132 @@
+##############################################################################
+# Microwindows template Makefile
+# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
+#
+# Rosimildo da Silva
+# Udapted to the RTEMS environment...
+#
+##############################################################################
+
+ifndef TOP
+TOP = ..
+CONFIG = $(TOP)/config
+endif
+
+include $(CONFIG)
+
+######################## Additional Flags section ############################
+
+# Directories list for header files
+ifeq ($(HAVE_JPEG_SUPPORT), Y)
+INCLUDEDIRS += -I$(TOP)/jpeg-6b
+endif
+# Defines for preprocessor
+DEFINES +=
+# Defines for preprocessor
+ifeq ($(LINK_APP_INTO_SERVER), Y)
+DEFINES += -DNONETWORK=1
+endif
+
+# Compilation flags for C files OTHER than include directories
+CFLAGS +=
+# Preprocessor flags OTHER than defines
+CPPFLAGS +=
+# Linking flags
+ifeq ($(HAVE_JPEG_SUPPORT), Y)
+LDFLAGS += -L$(TOP)/jpeg-6b
+endif
+
+# PC386 specific stuff...
+PROJECT_RELEASE     = $(RTEMS_BUILD)/$(RTEMS_BSP)
+PROJECT_TOOLS       = $(PROJECT_RELEASE)/build-tools
+START16FILE         = $(PROJECT_RELEASE)/lib/start16.bin
+RELOCADDR           = 0x00100000
+START16ADDR         = 0x00097C00
+HEADERADDR          = 0x00097E00
+EXTRA_LFLAGS        =-Wl,-Ttext,$(RELOCADDR)
+
+############################# targets section ################################
+
+ifeq ($(ARCH), RTEMS)
+
+# If you want to create a library with the objects files, define the name here
+LIBNAME =
+
+
+# Name of the target which the image will be created to the downloaded to the
+# target box.
+RTEMS_TARGET=rtems
+
+
+# Main module -- this module defines the "main()" routine to get compiled.
+# It basically selects which application is actually built to be loaded as
+# the RTEMS system. 
+# For example, select one:
+# MAIN_OBJ = mw_uid_test.o                  -- Mouse & KBD test driver
+# MAIN_OBJ = ../demos/nanox/demo.o          -- Nano-X demo
+# MAIN_OBJ = ../demos/mwobjects/mwo-test.o  -- C++ demo
+# MAIN_OBJ = ../demos/test/test.o           -- test driver
+
+
+# If you want to build the "mineswipper" game, use the modules below.
+# This should give you an idea of what you have to do to the others demos.
+#MINEIMAGES = ../demos/mwin/mineflag.o ../demos/mwin/mineface.o \
+#             ../demos/mwin/minefacelost.o ../demos/mwin/minebomb.o \
+#             ../demos/mwin/minedone.o ../demos/mwin/minehitfalse.o
+#MAIN_OBJ =../demos/mwin/mine.o $(MINEIMAGES)
+
+MAIN_OBJ = ../demos/mwin/demo.o
+
+# List of objects always needed by a RTEMS application
+OBJS =	rtems_init.o 
+
+# IMPORTANT NOTE: if MAIN_OBJ is a C++ code, add it to CXXOBJS instead.
+OBJS += $(MAIN_OBJ)
+# CXXOBJS += $(MAIN_OBJ)
+
+
+all: default $(RTEMS_TARGET).bt
+
+
+######################### Makefile.rules section #############################
+
+include $(TOP)/Makefile.rules
+
+######################## Tools targets section ###############################
+# let's adjust the libraries to match the API that you are using.
+
+NLIBS =
+
+ifeq ($(NANOX), Y)
+NLIBS += -lnano-X
+endif
+
+ifeq ($(NWIDGET), Y)
+NLIBS += -lnwidget
+endif
+
+ifeq ($(OBJFRAMEWORK), Y)
+NLIBS += -lmwobjects
+endif
+
+ifeq ($(MICROWIN), Y)
+NLIBS += -lmwin -lmwinlib
+endif
+
+NLIBS += -lmwengine -lmwdrivers -lmwfonts -lmwimages -lm
+
+ifeq ($(VGALIB), Y)
+NLIBS += -lvga
+endif
+
+$(RTEMS_TARGET).bt: $(RTEMS_TARGET).exe
+	$(OBJCOPY) -O binary $(RTEMS_TARGET).exe $(RTEMS_TARGET).bin;
+	$(PROJECT_TOOLS)/bin2boot -v $(RTEMS_TARGET).bt $(HEADERADDR) $(START16FILE) \
+	$(START16ADDR) 0 $(RTEMS_TARGET).bin $(RELOCADDR) 0;
+	rm $(RTEMS_TARGET).bin
+
+$(RTEMS_TARGET).exe: $(OBJS) $(CXXOBJS)
+	$(CXX) $(CFLAGS) $(LDFLAGS) $(EXTRA_LFLAGS) $^ -o $@ $(NLIBS)
+
+
+endif
diff -urN lib/microwindows/src/rtems/mw_uid_test.cc /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/rtems/mw_uid_test.cc
--- lib/microwindows/src/rtems/mw_uid_test.cc	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/rtems/mw_uid_test.cc	2005-02-21 16:03:50.000000000 +0100
@@ -0,0 +1,101 @@
+/*
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+
+#include <rtems/mw_uid.h>
+#include <rtems/kd.h>
+
+static const char *Q_NAME       = "MWQ";
+#define            Q_MAX_MSGS   128
+
+
+/*
+ * "Select() routine called by the MicroWindows framework to receive events 
+ * from the input devices.
+ */
+void GsSelect(void)
+{
+  struct MW_UID_MESSAGE m;
+  int rc;
+
+  /* let's make sure that the type is invalid */
+  m.type = MV_UID_INVALID;
+
+  /* wait up to 100 milisecons for events */
+  rc = uid_read_message( &m, 100 );
+
+  /* return if timed-out or something went wrong */
+  if( rc < 0 )
+  {
+     if( errno != ETIMEDOUT )
+        printf( " rc= %d, errno=%d\n", rc, errno );
+     return;
+  }
+  /* let's pass the event up to microwindows */
+  switch( m.type )
+  {
+    /* Mouse or Touch Screen event */
+    case MV_UID_REL_POS:
+    case MV_UID_ABS_POS:
+        printf( "Mouse: btns=%X, dx=%d, dy=%d, dz=%d\n",  
+                  m.m.pos.btns, m.m.pos.x, m.m.pos.y, m.m.pos.z );
+        break;
+
+
+    /* KBD event */
+    case MV_UID_KBD:
+        printf( "Kbd: code=%X, modifiers=%X, mode=%d\n",  
+                 (unsigned char )m.m.kbd.code, m.m.kbd.modifiers, m.m.kbd.mode );
+        break;
+
+    /* micro-windows does nothing with those.. */
+    case MV_UID_TIMER:
+    case MV_UID_INVALID:
+    default:
+       ;
+  }
+}
+
+extern "C" int close( int );
+extern "C" int rtems_main(int argc, char **argv)
+{
+  int status;
+  printf( "Starting untar file.\n" ); 
+  struct MW_UID_MESSAGE m;
+
+  int rc;
+  /* if this is the first time around, create the message queue */
+  rc = uid_open_queue( Q_NAME, O_CREAT | O_RDWR, Q_MAX_MSGS );
+
+  printf( "Open QUEUE=%X\n", rc );
+
+  int mouse_fd = open( "/dev/mouse", O_NONBLOCK );
+  uid_register_device( mouse_fd, Q_NAME );
+
+  /* kbd it is already opened */
+  int kbd_fd = fileno( stdin );
+  uid_register_device( kbd_fd, Q_NAME );
+
+  int old_mode = 0;
+  /* set keyboard to scanmode */
+  rc = uid_set_kbd_mode( kbd_fd, MV_KEY_MODE_SCANCODE, &old_mode );
+  printf( "Kbd OldMode=%X, rc=%d\n", old_mode, rc );
+  while( TRUE )
+  {
+     GsSelect();
+  }
+  uid_unregister_device( kbd_fd  );
+  uid_unregister_device( mouse_fd );
+  rc = uid_close_queue();
+  printf( "Close QUEUE=%X\n", rc );
+
+  close( mouse_fd );
+
+  fprintf(stdout, "About to leave main()\n" ); 
+  return 0;
+}
diff -urN lib/microwindows/src/rtems/net_cfg.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/rtems/net_cfg.h
--- lib/microwindows/src/rtems/net_cfg.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/rtems/net_cfg.h	2005-02-21 16:13:38.000000000 +0100
@@ -0,0 +1,115 @@
+/***************************************************************************
+ *
+ * $Header: $
+ *
+ * MODULE DESCRIPTION: This module specializes the RTEMS Network configuration 
+ *                     for the omniORB examples. It could be used as a starting
+ *                     point of an application using omniORB and RTEMS.
+ *
+ * This file was based on "networkconfig.h" that comes with the netdemos
+ * examples that ships with the RTEMS distribution.
+ *
+ * NOTE: This file must be modified to match your environment.
+ *
+ * by: Rosimildo da Silva:
+ *     rdasilva@connecttel.com
+ *     http://www.connecttel.com
+ *
+ * MODIFICATION/HISTORY:
+ *
+ * $Log: $
+ ****************************************************************************/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+#define RTEMS_USE_BOOTP
+*/
+
+#include <stdio.h>
+#include <rtems/rtems_bsdnet.h>
+
+/*
+ * Define RTEMS_SET_ETHERNET_ADDRESS if you want to specify the
+ * Ethernet address here.  If RTEMS_SET_ETHERNET_ADDRESS is not
+ * defined the driver will choose an address.
+ */
+#define RTEMS_SET_ETHERNET_ADDRESS
+#if (defined (RTEMS_SET_ETHERNET_ADDRESS))
+static char ethernet_address[6] = { 0x20, 0x00, 0x27, 0xAF, 0x03, 0x51 };
+#endif
+
+#undef  RTEMS_BSP_NETWORK_DRIVER_NAME
+#define RTEMS_BSP_NETWORK_DRIVER_NAME  "ep0"
+
+extern int rtems_3c509_driver_attach( struct rtems_bsdnet_ifconfig *config );
+#undef  RTEMS_BSP_NETWORK_DRIVER_ATTACH
+#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_3c509_driver_attach
+
+/*
+ * Default network interface
+ */
+static struct rtems_bsdnet_ifconfig netdriver_config = 
+{
+   RTEMS_BSP_NETWORK_DRIVER_NAME,      /* name */
+	RTEMS_BSP_NETWORK_DRIVER_ATTACH,    /* attach function */
+
+	NULL,				/* link to next interface */
+
+#if (defined (RTEMS_USE_BOOTP))
+	NULL,				/* BOOTP supplies IP address */
+	NULL,				/* BOOTP supplies IP net mask */
+#else
+	"192.168.0.11",		/* IP address */
+	"255.255.255.0",		/* IP net mask */
+#endif /* !RTEMS_USE_BOOTP */
+
+#if (defined (RTEMS_SET_ETHERNET_ADDRESS))
+	ethernet_address,               /* Ethernet hardware address */
+#else
+	NULL,           /* Driver supplies hardware address */
+#endif
+	0				/* Use default driver parameters */
+};
+
+/*
+ * Network configuration
+ */
+struct rtems_bsdnet_config rtems_bsdnet_config = {
+	&netdriver_config,
+
+#if (defined (RTEMS_USE_BOOTP))
+	rtems_bsdnet_do_bootp,
+#else
+	NULL,
+#endif
+
+	0,			/* Default network task priority */
+	0,			/* Default mbuf capacity */
+	0,			/* Default mbuf cluster capacity */
+
+#if (!defined (RTEMS_USE_BOOTP))
+	"lucila",			/* Host name */
+	"rps.com",			/* Domain name */
+	"192.168.0.1",	/* Gateway */
+	"192.168.0.1",	/* Log host */
+	{"192.168.0.1" },	/* Name server(s) */
+#endif /* !RTEMS_USE_BOOTP */
+
+};
+
+/*
+ * For TFTP test application
+ */
+#if (!defined (RTEMS_USE_BOOTP))
+#define RTEMS_TFTP_TEST_HOST_NAME "192.168.0.2"
+#define RTEMS_TFTP_TEST_FILE_NAME "root/boot.bt"
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+ 
+/* end of include file */
diff -urN lib/microwindows/src/rtems/readme.rtems /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/rtems/readme.rtems
--- lib/microwindows/src/rtems/readme.rtems	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/rtems/readme.rtems	2005-02-21 16:03:50.000000000 +0100
@@ -0,0 +1,215 @@
+RTEMS Setup
+===========
+
+This file provide instructions on how to configure and build Microwindows
+for RTEMS.  It is assumed that you are familiar enough with RTEMS and Microwindows,
+and have a development environment that works with both systems. If you are not,
+it is encouraged to play around with each one these packages first, separately,
+before you start mixing them together. 
+
+
+NOTE: Microwindows code does not compile when ITRON API is enabled  -- need fix
+
+
+a) RTEMS --- Patching & Building
+==========================
+
+ + Download RTEMS source (rtems-4.5.0-beta3.tgz) from Oarcorp.
+
+ + make a build directory
+       mkdir work
+
+ + untar rtems beta3
+      cd work
+      tar xzf rtems-4.5.0-beta3.tgz 
+
+ + Download rtems and microwindows patches from Rosimildo's site.
+  - rtems-4.5.0beta2-microwin-0.88.patch
+  - microwin-088pre7-rtems.patch
+
+ + Apply rtems-4.5.0beta3-microwin-0.88.patch.
+   cd rtems-4.5.0-beta3
+   patch -p1  <../rtems-4.5.0beta3-microwin-0.88.patch 
+
+  NOTE:  find . -name "*.rej", t check for rejects.
+
+  # Regenerate some RTEMS build structure.  You may need to update
+  # autoconf and automake packages on your machine.
+  ./bootstrap
+
+
+  + Mouse driver setup: 
+This needs to be improved later. Right now this is utter complex.
+It reminds me setting up GRUB. :-).
+
+You need to edit the device driver table in rtemscfg.h, around line 61.
+There are two "/dev/mouse" drivers on RTEMS. Only one of them can be
+loaded on the system. Select the one that fits your needs.
+
+    i) for PS/2 mouse:
+Select to load PAUX_DRIVER_TABLE_ENTRY in the device driver table. You
+would do this, defining PS2_MOUSE in the file rtemscfg.h before the
+device driver table.
+
+#define PS2_MOUSE
+
+   ii) Serial Mouse 
+   
+-- Select the mouse type: "ms", "pc". Most serial mouses are microsoft ( "ms" )
+compatible. This is the default selection.
+
+
+-- Select serial port -- defaul is COM1
+
+Both selections are made in the header file: 
+       $RTEMS_SOURCE)/c/src/lib/libbsp/i386/pc386/console/serial_mouse.h
+around line 72.
+
+[snip from $RTEMS_SOURCE)/c/src/lib/libbsp/i386/pc386/console/serial_mouse.h ]
+/* Select the mouse type:  "ms","pc","ps2" */
+#define  MOUSE_TYPE        "ms"  
+
+/* Select the serial port used by the mouse driver */
+#define  SERIAL_MOUSE_COM1  1
+/* #define  SERIAL_MOUSE_COM2  1  */
+
+IMPORTANT: Any change on one of these settings, requires recompilation of RTEMS.
+
+
+
+Configure and install RTEMS.  This assumes RPMs are installed
+and tools are available as /opt/rtems.  You will need to
+be able to write into the /opt/rtems directory so you will
+likely have to be root to do the "make install" step.
+I am using the c build scripts and you should look
+at user.cfg to make sure it is OK for you.
+
+  ./bit_rtems i386 pc386
+  # takes a while and ends up with /opt/rtems/pc386 installed
+
+
+b) MicroWindows --- Patching & Building
+=======================================
+
+ + Downloaded Microwindows source (microwindows-0.88pre7.tar.gz) from censoft.
+
+ + make a build directory
+       mkdir work
+
+ + untar microwindows
+      cd work
+      tar xzf microwindows-0.88pre7.tar.gz
+
+ + Apply microwin-088pre7-rtems.patch.
+  cd microwin
+  patch -p1  <../microwin-088pre7-rtems.patch 
+
+Found readme.rtems in microwin source:
+
+  bash$ find . -name "readme.rtems"
+  ./src/rtems/readme.rtems
+
+Per readme.rtems use config.rtems for Microwindows.
+
+  cd microwin
+  cd src
+  cp config config.SHIP
+  cp config.rtems config
+
+
+Edit config to localize it.  Make sure these variables are 
+set as shown below:
+
+  RTEMSTOOLSPREFIX         = i386-rtems-
+  RTEMS_BUILD              = /opt/rtems
+
+Now build microwindows:
+
+  cd src
+  make 
+
+  NOTE:  This does not build the demos.
+
+Now build the demos.
+
+  src/rtems/Makefile.rtems is intended to be used to each of the
+  demos.  You have a couple of issues...
+
+   + This builds whatever demo is selected by the definition 
+     of MAIN_OBJ around line 52 of Makefile.rtems.
+
+   + This produces rtems.exe for each demo.  It is quite large
+     so you might want to strip it like this:
+
+bash$ cp rtems.exe rtems_nosym.exe
+bash$ i386-rtems-strip rtems_nosym.exe 
+
+
+
+c) Microwindows Configuration
+=============================
+
+NOTE: You can use the default configuration for RTEMS -- 
+      copy config.rtems to config
+
+  --> or
+
+1. Select the architecture to be RTEMS. :-)
+ARCH                     = RTEMS
+
+2. No demos are built for RTEMS. Later, using the Makefile under the
+rtems directory you can select whatever you need to build. This is because
+RTEMS requires special configuration tables, and a definition of the 
+"Init" task.
+
+  + A demo is selected by the definition of MAIN_OBJ around line 52 
+of Makefile.rtems.
+
+MICROWINDEMO             = N
+NANOXDEMO                = N
+
+
+3. color scheme  -- ( unless you wrote the super-duper video driver for RTEMS )
+SCREEN_PIXTYPE           = PF_PALETTE
+
+
+4. Nano-X server linked with client as a single executable
+LINK_APP_INTO_SERVER     = Y
+
+
+5.1. Enable the Micro FrameBuffer interface.
+FRAMEBUFFER              = Y
+FBVGA                    = Y
+
+  ==> or
+
+5.2. For SVGALIB -- This requires you have the SVGALIB support under RTEMS.
+Please go to this site for more information:
+http://members/xoom.com/rosimildo/rtems_svga.html
+
+LIBVGA                   = Y
+
+
+
+c) KBD & MOUSE Test
+===================
+
+A test program has been added to help debugging the input devices. It is 
+called rtems/mw_uid_test.cc. Modify the Makefile to build it. It'll help
+making sure that mouse&kbd works.
+
+
+
+
+Credits
+=======
+
+I'd like to Thank Joel Sherrill for going over the original notes, and
+prividing me with his own notes to be merged here.
+
+
+
+
+Good Luck !!!.
+
+Rosimildo.
diff -urN lib/microwindows/src/rtems/rtems_init.c /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/rtems/rtems_init.c
--- lib/microwindows/src/rtems/rtems_init.c	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/rtems/rtems_init.c	2005-02-21 16:13:38.000000000 +0100
@@ -0,0 +1,80 @@
+/*
+/////////////////////////////////////////////////////////////////////////////
+// $Header: $
+//
+// Copyright (c) 1999 ConnectTel, Inc. All Rights Reserved.
+//  
+// MODULE DESCRIPTION:
+//
+//  RTEMS Init Task for a MicroWindows application that 
+//        may or may not use network functionality.
+//
+//  by: Rosimildo da Silva:
+//      rdasilva@connecttel.com
+//      http://www.connecttel.com
+//
+// MODIFICATION/HISTORY:
+// $Log: $
+//
+/////////////////////////////////////////////////////////////////////////////
+*/
+
+#define  CONFIGURE_INIT
+#include <stdio.h>
+#include "rtemscfg.h"
+
+#ifndef  NONETWORK
+#include "net_cfg.h"
+#include <stdio.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <arpa/inet.h>
+#endif
+#include "device.h"  /* DPRINTF() macro */
+
+/* Enable the following define if you want to debug this application */
+/* #define USE_REMOTE_GDB__ */
+#ifdef USE_REMOTE_GDB__
+extern void init_remote_gdb( void );
+#define BREAKPOINT() asm("   int $3");
+#endif
+
+/* this is the command line options to be passed to the main routine */
+char *cc_argv[] = 
+{
+	"cc_main",    /* arg[ 0 ] -- always the name of the program */
+};
+int cc_argc = sizeof( cc_argv ) / sizeof( cc_argv[ 0 ]  );
+
+
+extern int rtems_main(int argc, char **argv);
+
+/*
+ * DESCRIPTION: Init task for any MicroWindows/RTEMS application.
+ */
+void *POSIX_Init( void *argument )
+{
+  size_t st = 0;
+
+#ifdef USE_REMOTE_GDB__
+  init_remote_gdb();
+/*  BREAKPOINT(); */
+#endif
+
+  DPRINTF( "\nStarting RTEMS init task...\n" );
+
+#ifndef NONETWORK
+  /* Make all network initialization */
+  rtems_bsdnet_initialize_network();
+  DPRINTF( "Netowrk Initialization is complete.\n\n" );
+#endif
+
+  st = _Thread_Executing->Start.Initial_stack.size;
+  DPRINTF( "Init Task Stack Size is: %d\n", st );
+
+  rtems_main( cc_argc, cc_argv );
+  DPRINTF( "*** Done ***\n\n\n" );
+  pthread_exit( NULL );
+  return NULL; /* just so the compiler thinks we returned something */
+}
diff -urN lib/microwindows/src/rtems/rtemscfg.h /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/rtems/rtemscfg.h
--- lib/microwindows/src/rtems/rtemscfg.h	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/rtems/rtemscfg.h	2005-02-21 16:13:38.000000000 +0100
@@ -0,0 +1,95 @@
+/***************************************************************************
+ *
+ * $Header: $
+ *
+ * Copyright (c) 1999 ConnectTel, Inc. All Rights Reserved.
+ *  
+ * MODULE DESCRIPTION: RTEMS configuration file. This file should be
+ *                     udpated to match your own configuration.
+ *
+ * by: Rosimildo da Silva:
+ *     rdasilva@connecttel.com
+ *     http://www.connecttel.com
+ *
+ * MODIFICATION/HISTORY:
+ *
+ * $Log: $
+ ****************************************************************************/
+
+
+#include <bsp.h>              /* includes <rtems.h> */
+#include <tty_drv.h>
+#include <rtems/ps2_drv.h>
+#include <rtems/fb_vga.h>
+#include <rtems/serial_mouse.h>
+
+/* functions */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* configuration information */
+#define CONFIGURE_MAXIMUM_DEVICES                     40
+#define CONFIGURE_MAXIMUM_TASKS                       300
+#define CONFIGURE_MAXIMUM_TIMERS                      32
+#define CONFIGURE_MAXIMUM_SEMAPHORES                  100
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES              20
+#define CONFIGURE_MAXIMUM_PARTITIONS                  10
+#define CONFIGURE_MAXIMUM_REGIONS                     10
+
+/* This seetings overwrite the ones defined in confdefs.h */
+#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 		         32
+#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES  	32
+#define CONFIGURE_MAXIMUM_POSIX_KEYS         		   32
+#define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 		   10
+#define CONFIGURE_MAXIMUM_POSIX_THREADS      		   256
+#define CONFIGURE_MAXIMUM_POSIX_TIMERS                10
+
+/* used by the input device driver */
+#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES        10
+
+void *POSIX_Init( void *argument );
+#define CONFIGURE_INIT_TASK_STACK_SIZE	               (512*1024)
+#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE        (512*1024)
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+
+#define CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
+#define CONFIGURE_MICROSECONDS_PER_TICK	        1000
+
+
+/* List of device drivers loaded by RTEMS at boot time */
+rtems_driver_address_table Device_drivers[] = 
+{
+  CONSOLE_DRIVER_TABLE_ENTRY,
+  CLOCK_DRIVER_TABLE_ENTRY,
+
+/* this can be a bit tricky: If you are using a serial mouse,
+   make sure that you do not install and serial driver that
+   uses the same port !!!!
+*/
+  TTY2_DRIVER_TABLE_ENTRY,
+
+#if PS2_MOUSE
+  PAUX_DRIVER_TABLE_ENTRY,
+#else
+
+  /*
+   * Make sure that you have selected the COM port and the
+   * mouse type in ( c/src/lib/libbsp/i386/pc386/console/serial_mouse.h ).
+   */
+  SERIAL_MOUSE_DRIVER_TABLE_ENTRY,
+#endif
+
+  /* Standard VGA driver */
+  FBVGA_DRIVER_TABLE_ENTRY,
+
+  { NULL,NULL, NULL,NULL,NULL, NULL }
+};
+
+#include <confdefs.h>
+
+#ifdef __cplusplus
+}
+#endif
+/* end of include file */
diff -urN lib/microwindows/src/scribble.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/scribble.sh
--- lib/microwindows/src/scribble.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/scribble.sh	2005-02-21 16:13:43.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X & bin/nxkbd & bin/nxscribble & bin/nanowm & bin/nxterm & bin/nxterm & sleep 10000
diff -urN lib/microwindows/src/slider.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/slider.sh
--- lib/microwindows/src/slider.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/slider.sh	2005-02-21 16:13:43.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X & bin/nanowm & bin/slider demos/nanox/slidebmp.bmp ; sleep 10000
diff -urN lib/microwindows/src/t1demo.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/t1demo.sh
--- lib/microwindows/src/t1demo.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/t1demo.sh	2005-02-21 16:13:44.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X & bin/nanowm & bin/t1demo
diff -urN lib/microwindows/src/tcmwin.mak /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/tcmwin.mak
--- lib/microwindows/src/tcmwin.mak	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/tcmwin.mak	2005-02-21 16:13:40.000000000 +0100
@@ -0,0 +1,575 @@
+#
+# Borland C++ IDE generated makefile
+# Generated 2000/4/21 at PM 02:09:29 
+#
+.AUTODEPEND
+
+
+#
+# Borland C++ tools
+#
+IMPLIB  = Implib
+BCCDOS  = Bcc +BccDos.cfg 
+TLINK   = TLink
+TLIB    = TLib
+TASM    = Tasm
+#
+# IDE macros
+#
+
+
+#
+# Options
+#
+BC_Path = C:\BC5
+BC_Lib_Path = $(BC_Path)\LIB
+BGI_Path = $(BC_Path)\BGI
+MW_Path = D:\microwin
+IDE_LinkFLAGSDOS =  -L$(BC_Lib_Path)
+IDE_BFLAGS = 
+CompLocalOptsAtDOS_mwdlib =  -ml -f-
+LinkerLocalOptsAtDOS_mwdlib =  -c -Tde
+ResLocalOptsAtDOS_mwdlib = 
+BLocalOptsAtDOS_mwdlib = 
+CompOptsAt_mwdlib = $(CompLocalOptsAtDOS_mwdlib)
+CompInheritOptsAt_mwdlib = -I$(MW_Path)\SRC\INCLUDE;$(MW_Path)\SRC\DRIVERS;$(MW_Path)\SRC\ENGINE;$(MW_Path)\SRC\MWIN;$(MW_Path)\SRC\MWIN\WINLIB;$(BC_Path)\INCLUDE -DMSDOS=1;DOS_TURBOC=1
+LinkerInheritOptsAt_mwdlib = -x
+LinkerOptsAt_mwdlib = $(LinkerLocalOptsAtDOS_mwdlib)
+ResOptsAt_mwdlib = $(ResLocalOptsAtDOS_mwdlib)
+BOptsAt_mwdlib = $(BLocalOptsAtDOS_mwdlib)
+CompLocalOptsAtDOS_demodexe =  -ml -f287
+LinkerLocalOptsAtDOS_demodexe =  -c -Tde
+ResLocalOptsAtDOS_demodexe = 
+BLocalOptsAtDOS_demodexe = 
+CompOptsAt_demodexe = $(CompLocalOptsAtDOS_demodexe)
+CompInheritOptsAt_demodexe = -I$(MW_Path)\SRC\INCLUDE;$(BC_Path)\INCLUDE -DMSDOS=1;DOS_TURBOC=1
+LinkerInheritOptsAt_demodexe = -x
+LinkerOptsAt_demodexe = $(LinkerLocalOptsAtDOS_demodexe)
+ResOptsAt_demodexe = $(ResLocalOptsAtDOS_demodexe)
+BOptsAt_demodexe = $(BLocalOptsAtDOS_demodexe)
+CompLocalOptsAtDOS_minedexe =  -ml -f287
+LinkerLocalOptsAtDOS_minedexe =  -c -Tde
+ResLocalOptsAtDOS_minedexe = 
+BLocalOptsAtDOS_minedexe = 
+CompOptsAt_minedexe = $(CompLocalOptsAtDOS_minedexe)
+CompInheritOptsAt_minedexe = -I$(MW_Path)\SRC\INCLUDE;$(BC_Path)\INCLUDE;$(MW_Path)\SRC\DEMOS\MWIN 
+LinkerInheritOptsAt_minedexe = -x
+LinkerOptsAt_minedexe = $(LinkerLocalOptsAtDOS_minedexe)
+ResOptsAt_minedexe = $(ResLocalOptsAtDOS_minedexe)
+BOptsAt_minedexe = $(BLocalOptsAtDOS_minedexe)
+CompLocalOptsAtDOS_demosbmwinbminedc = 
+LinkerLocalOptsAtDOS_demosbmwinbminedc = 
+ResLocalOptsAtDOS_demosbmwinbminedc = 
+BLocalOptsAtDOS_demosbmwinbminedc = 
+CompOptsAt_demosbmwinbminedc = $(CompOptsAt_minedexe) $(CompLocalOptsAtDOS_demosbmwinbminedc)
+CompInheritOptsAt_demosbmwinbminedc = -I$(MW_Path)\SRC\INCLUDE;$(BC_Path)\INCLUDE;$(MW_Path)\SRC\DEMOS\MWIN 
+LinkerInheritOptsAt_demosbmwinbminedc = -x
+LinkerOptsAt_demosbmwinbminedc = $(LinkerOptsAt_minedexe) $(LinkerLocalOptsAtDOS_demosbmwinbminedc)
+ResOptsAt_demosbmwinbminedc = $(ResOptsAt_minedexe) $(ResLocalOptsAtDOS_demosbmwinbminedc)
+BOptsAt_demosbmwinbminedc = $(BOptsAt_minedexe) $(BLocalOptsAtDOS_demosbmwinbminedc)
+CompLocalOptsAtDOS_malphadexe =  -ml -f-
+LinkerLocalOptsAtDOS_malphadexe =  -c -Tde
+ResLocalOptsAtDOS_malphadexe = 
+BLocalOptsAtDOS_malphadexe = 
+CompOptsAt_malphadexe = $(CompLocalOptsAtDOS_malphadexe)
+CompInheritOptsAt_malphadexe = -I$(MW_Path)\SRC\INCLUDE;$(BC_Path)\INCLUDE -DMSDOS=1;DOS_TURBOC=1
+LinkerInheritOptsAt_malphadexe = -x
+LinkerOptsAt_malphadexe = $(LinkerLocalOptsAtDOS_malphadexe)
+ResOptsAt_malphadexe = $(ResLocalOptsAtDOS_malphadexe)
+BOptsAt_malphadexe = $(BLocalOptsAtDOS_malphadexe)
+CompLocalOptsAtDOS_mtestdexe =  -ml -f-
+LinkerLocalOptsAtDOS_mtestdexe =  -c -Tde
+ResLocalOptsAtDOS_mtestdexe = 
+BLocalOptsAtDOS_mtestdexe = 
+CompOptsAt_mtestdexe = $(CompLocalOptsAtDOS_mtestdexe)
+CompInheritOptsAt_mtestdexe = -I$(MW_Path)\SRC\INCLUDE;$(BC_Path)\INCLUDE -DMSDOS=1;DOS_TURBOC=1
+LinkerInheritOptsAt_mtestdexe = -x
+LinkerOptsAt_mtestdexe = $(LinkerLocalOptsAtDOS_mtestdexe)
+ResOptsAt_mtestdexe = $(ResLocalOptsAtDOS_mtestdexe)
+BOptsAt_mtestdexe = $(BLocalOptsAtDOS_mtestdexe)
+
+#
+# Dependency List
+#
+Dep_mw = \
+   mw.lib\
+   demo.exe\
+   mine.exe\
+   malpha.exe\
+   mtest.exe
+
+mw : BccDos.cfg $(Dep_mw)
+  echo MakeNode
+
+Dep_mwdlib = \
+   egavga.obj\
+   rom8x16.obj\
+   winfreesansserif11x13.obj\
+   winfreesystem14x16.obj\
+   x6x13.obj\
+   genfont.obj\
+   kbd_tc.obj\
+   mou_dos.obj\
+   scr_tc.obj\
+   devclip.obj\
+   devdraw.obj\
+   devkbd.obj\
+   devlist.obj\
+   devfont.obj\
+   devmouse.obj\
+   devpal4.obj\
+   devpal2.obj\
+   devpal1.obj\
+   devrgn.obj\
+   devrgn2.obj\
+   devarc.obj\
+   error.obj\
+   cs1.obj\
+   button.obj\
+   edit.obj\
+   progbar.obj\
+   listbox.obj\
+   draw3d.obj\
+   fastfill.obj\
+   graph3d.obj\
+   insetr.obj\
+   ptinsid.obj\
+   mwuser.obj\
+   winsbar.obj\
+   winclip.obj\
+   windefw.obj\
+   winevent.obj\
+   winexpos.obj\
+   wingdi.obj\
+   winmain.obj\
+   winuser.obj
+
+mw.lib : $(Dep_mwdlib)
+  $(TLIB) $< $(IDE_BFLAGS) $(BOptsAt_mwdlib) @&&|
+ -+egavga.obj &
+-+rom8x16.obj &
+-+winfreesansserif11x13.obj &
+-+winfreesystem14x16.obj &
+-+x6x13.obj &
+-+genfont.obj &
+-+kbd_tc.obj &
+-+mou_dos.obj &
+-+scr_tc.obj &
+-+devclip.obj &
+-+devdraw.obj &
+-+devkbd.obj &
+-+devlist.obj &
+-+devfont.obj &
+-+devmouse.obj &
+-+devpal4.obj &
+-+devpal2.obj &
+-+devpal1.obj &
+-+devrgn.obj &
+-+devrgn2.obj &
+-+devarc.obj &
+-+error.obj &
+-+cs1.obj &
+-+button.obj &
+-+edit.obj &
+-+progbar.obj &
+-+listbox.obj &
+-+draw3d.obj &
+-+fastfill.obj &
+-+graph3d.obj &
+-+insetr.obj &
+-+ptinsid.obj &
+-+mwuser.obj &
+-+winsbar.obj &
+-+winclip.obj &
+-+windefw.obj &
+-+winevent.obj &
+-+winexpos.obj &
+-+wingdi.obj &
+-+winmain.obj &
+-+winuser.obj
+|
+
+rom8x16.obj :  fonts\rom8x16.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ fonts\rom8x16.c
+|
+
+winfreesansserif11x13.obj :  fonts\winfreesansserif11x13.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ fonts\winfreesansserif11x13.c
+|
+
+winfreesystem14x16.obj :  fonts\winfreesystem14x16.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ fonts\winfreesystem14x16.c
+|
+
+x6x13.obj :  fonts\x6x13.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ fonts\x6x13.c
+|
+
+genfont.obj :  drivers\genfont.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ drivers\genfont.c
+|
+
+kbd_tc.obj :  drivers\kbd_tc.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ drivers\kbd_tc.c
+|
+
+mou_dos.obj :  drivers\mou_dos.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ drivers\mou_dos.c
+|
+
+scr_tc.obj :  drivers\scr_tc.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ drivers\scr_tc.c
+|
+
+devclip.obj :  engine\devclip.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devclip.c
+|
+
+devdraw.obj :  engine\devdraw.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devdraw.c
+|
+
+devkbd.obj :  engine\devkbd.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devkbd.c
+|
+
+devlist.obj :  engine\devlist.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devlist.c
+|
+
+devfont.obj :  engine\devfont.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devfont.c
+|
+
+devmouse.obj :  engine\devmouse.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devmouse.c
+|
+
+devpal4.obj :  engine\devpal4.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devpal4.c
+|
+
+devpal2.obj :  engine\devpal2.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devpal2.c
+|
+
+devpal1.obj :  engine\devpal1.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devpal1.c
+|
+
+devrgn.obj :  engine\devrgn.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devrgn.c
+|
+
+devrgn2.obj :  engine\devrgn2.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devrgn2.c
+|
+
+devarc.obj :  engine\devarc.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\devarc.c
+|
+
+error.obj :  engine\error.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ engine\error.c
+|
+
+cs1.obj :  mwin\bmp\cs1.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\bmp\cs1.c
+|
+
+button.obj :  mwin\winlib\button.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\button.c
+|
+
+edit.obj :  mwin\winlib\edit.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\edit.c
+|
+
+progbar.obj :  mwin\winlib\progbar.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\progbar.c
+|
+
+listbox.obj :  mwin\winlib\listbox.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\listbox.c
+|
+
+draw3d.obj :  mwin\winlib\draw3d.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\draw3d.c
+|
+
+fastfill.obj :  mwin\winlib\fastfill.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\fastfill.c
+|
+
+graph3d.obj :  mwin\winlib\graph3d.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\graph3d.c
+|
+
+insetr.obj :  mwin\winlib\insetr.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\insetr.c
+|
+
+ptinsid.obj :  mwin\winlib\ptinsid.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\ptinsid.c
+|
+
+mwuser.obj :  mwin\winlib\mwuser.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winlib\mwuser.c
+|
+
+winsbar.obj :  mwin\winsbar.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winsbar.c
+|
+
+winclip.obj :  mwin\winclip.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winclip.c
+|
+
+windefw.obj :  mwin\windefw.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\windefw.c
+|
+
+winevent.obj :  mwin\winevent.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winevent.c
+|
+
+winexpos.obj :  mwin\winexpos.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winexpos.c
+|
+
+wingdi.obj :  mwin\wingdi.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\wingdi.c
+|
+
+winmain.obj :  mwin\winmain.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winmain.c
+|
+
+winuser.obj :  mwin\winuser.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mwdlib) $(CompInheritOptsAt_mwdlib) -o$@ mwin\winuser.c
+|
+
+Dep_demodexe = \
+   mw.lib\
+   microwin.obj\
+   penguin.obj\
+   demo.obj
+
+demo.exe : $(Dep_demodexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_demodexe) $(LinkerInheritOptsAt_demodexe) +
+$(BC_Lib_Path)\c0l.obj+
+microwin.obj+
+penguin.obj+
+demo.obj
+$<,$*
+mw.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+microwin.obj :  mwin\bmp\microwin.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_demodexe) $(CompInheritOptsAt_demodexe) -o$@ mwin\bmp\microwin.c
+|
+
+penguin.obj :  mwin\bmp\penguin.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_demodexe) $(CompInheritOptsAt_demodexe) -o$@ mwin\bmp\penguin.c
+|
+
+demo.obj :  demos\mwin\demo.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_demodexe) $(CompInheritOptsAt_demodexe) -o$@ demos\mwin\demo.c
+|
+
+Dep_minedexe = \
+   mw.lib\
+   minebomb.obj\
+   minedone.obj\
+   mineface.obj\
+   mineflag.obj\
+   minehitf.obj\
+   minelost.obj\
+   mine.obj
+
+mine.exe : $(Dep_minedexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_minedexe) $(LinkerInheritOptsAt_minedexe) +
+$(BC_Lib_Path)\c0l.obj+
+minebomb.obj+
+minedone.obj+
+mineface.obj+
+mineflag.obj+
+minehitf.obj+
+minelost.obj+
+mine.obj
+$<,$*
+mw.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+minebomb.obj :  demos\mwin\minebomb.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_minedexe) $(CompInheritOptsAt_minedexe) -o$@ demos\mwin\minebomb.c
+|
+
+minedone.obj :  demos\mwin\minedone.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_minedexe) $(CompInheritOptsAt_minedexe) -o$@ demos\mwin\minedone.c
+|
+
+mineface.obj :  demos\mwin\mineface.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_minedexe) $(CompInheritOptsAt_minedexe) -o$@ demos\mwin\mineface.c
+|
+
+mineflag.obj :  demos\mwin\mineflag.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_minedexe) $(CompInheritOptsAt_minedexe) -o$@ demos\mwin\mineflag.c
+|
+
+minehitf.obj :  demos\mwin\minehitf.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_minedexe) $(CompInheritOptsAt_minedexe) -o$@ demos\mwin\minehitf.c
+|
+
+minelost.obj :  demos\mwin\minelost.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_minedexe) $(CompInheritOptsAt_minedexe) -o$@ demos\mwin\minelost.c
+|
+
+mine.obj :  demos\mwin\mine.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_demosbmwinbminedc) $(CompInheritOptsAt_demosbmwinbminedc) -o$@ demos\mwin\mine.c
+|
+
+Dep_malphadexe = \
+   mw.lib\
+   car8.obj\
+   malpha.obj
+
+malpha.exe : $(Dep_malphadexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_malphadexe) $(LinkerInheritOptsAt_malphadexe) +
+$(BC_Lib_Path)\c0l.obj+
+car8.obj+
+malpha.obj
+$<,$*
+mw.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+car8.obj :  mwin\bmp\car8.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_malphadexe) $(CompInheritOptsAt_malphadexe) -o$@ mwin\bmp\car8.c
+|
+
+malpha.obj :  demos\mwin\malpha.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_malphadexe) $(CompInheritOptsAt_malphadexe) -o$@ demos\mwin\malpha.c
+|
+
+Dep_mtestdexe = \
+   mw.lib\
+   mtest.obj
+
+mtest.exe : $(Dep_mtestdexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_mtestdexe) $(LinkerInheritOptsAt_mtestdexe) +
+$(BC_Lib_Path)\c0l.obj+
+mtest.obj
+$<,$*
+mw.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+mtest.obj :  demos\mwin\mtest.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_mtestdexe) $(CompInheritOptsAt_mtestdexe) -o$@ demos\mwin\mtest.c
+|
+
+# Compiler configuration file
+BccDos.cfg : 
+   Copy &&|
+-W-
+-w
+-R
+-v
+-vi
+-H
+-H=mw.csm
+| $@
+
+
+clean :
+  del *.obj
+  del *.lib
+  del *.exe
+  del *.csm
+  del BccDos.cfg
+
+egavga.obj :
+  copy $(BGI_Path)\egavga.bgi .
+  $(BGI_Path)\bgiobj egavga
+  del egavga.bgi
+
diff -urN lib/microwindows/src/tcnanox.mak /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/tcnanox.mak
--- lib/microwindows/src/tcnanox.mak	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/tcnanox.mak	2005-02-21 16:13:40.000000000 +0100
@@ -0,0 +1,719 @@
+#
+# Borland C++ IDE generated makefile
+# Generated 2000/4/20 at PM 05:57:12 
+#
+.AUTODEPEND
+
+
+#
+# Borland C++ tools
+#
+IMPLIB  = Implib
+BCCDOS  = Bcc +BccDos.cfg 
+TLINK   = TLink
+TLIB    = TLib
+TASM    = Tasm
+#
+# IDE macros
+#
+
+
+#
+# Options
+#
+BC_Path = C:\BC5
+BC_Lib_Path = $(BC_Path)\LIB
+BGI_Path = $(BC_Path)\BGI
+MW_Path = D:\microwin
+IDE_LinkFLAGSDOS =  -L$(BC_Lib_Path)
+IDE_BFLAGS = 
+CompLocalOptsAtDOS_nanoxdlib =  -ml -f-
+LinkerLocalOptsAtDOS_nanoxdlib =  -c -Tde
+ResLocalOptsAtDOS_nanoxdlib = 
+BLocalOptsAtDOS_nanoxdlib = 
+CompOptsAt_nanoxdlib = $(CompLocalOptsAtDOS_nanoxdlib)
+CompInheritOptsAt_nanoxdlib = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE;$(MW_Path)\SRC\DRIVERS;$(MW_Path)\SRC\ENGINE;$(MW_Path)\SRC\NANOX -DMSDOS=1;DOS_TURBOC=1;NONETWORK=1
+LinkerInheritOptsAt_nanoxdlib = -x
+LinkerOptsAt_nanoxdlib = $(LinkerLocalOptsAtDOS_nanoxdlib)
+ResOptsAt_nanoxdlib = $(ResLocalOptsAtDOS_nanoxdlib)
+BOptsAt_nanoxdlib = $(BLocalOptsAtDOS_nanoxdlib)
+CompLocalOptsAtDOS_demodexe =  -ml -f-
+LinkerLocalOptsAtDOS_demodexe =  -c -Tde
+ResLocalOptsAtDOS_demodexe = 
+BLocalOptsAtDOS_demodexe = 
+CompOptsAt_demodexe = $(CompLocalOptsAtDOS_demodexe)
+CompInheritOptsAt_demodexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE 
+LinkerInheritOptsAt_demodexe = -x
+LinkerOptsAt_demodexe = $(LinkerLocalOptsAtDOS_demodexe)
+ResOptsAt_demodexe = $(ResLocalOptsAtDOS_demodexe)
+BOptsAt_demodexe = $(BLocalOptsAtDOS_demodexe)
+CompLocalOptsAtDOS_demo2dexe =  -ml -f-
+LinkerLocalOptsAtDOS_demo2dexe =  -c -Tde
+ResLocalOptsAtDOS_demo2dexe = 
+BLocalOptsAtDOS_demo2dexe = 
+CompOptsAt_demo2dexe = $(CompLocalOptsAtDOS_demo2dexe)
+CompInheritOptsAt_demo2dexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE 
+LinkerInheritOptsAt_demo2dexe = -x
+LinkerOptsAt_demo2dexe = $(LinkerLocalOptsAtDOS_demo2dexe)
+ResOptsAt_demo2dexe = $(ResLocalOptsAtDOS_demo2dexe)
+BOptsAt_demo2dexe = $(BLocalOptsAtDOS_demo2dexe)
+CompLocalOptsAtDOS_demo3dexe =  -ml -f-
+LinkerLocalOptsAtDOS_demo3dexe =  -c -Tde
+ResLocalOptsAtDOS_demo3dexe = 
+BLocalOptsAtDOS_demo3dexe = 
+CompOptsAt_demo3dexe = $(CompLocalOptsAtDOS_demo3dexe)
+CompInheritOptsAt_demo3dexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE 
+LinkerInheritOptsAt_demo3dexe = -x
+LinkerOptsAt_demo3dexe = $(LinkerLocalOptsAtDOS_demo3dexe)
+ResOptsAt_demo3dexe = $(ResLocalOptsAtDOS_demo3dexe)
+BOptsAt_demo3dexe = $(BLocalOptsAtDOS_demo3dexe)
+CompLocalOptsAtDOS_demo4dexe =  -ml -f-
+LinkerLocalOptsAtDOS_demo4dexe =  -c -Tde
+ResLocalOptsAtDOS_demo4dexe = 
+BLocalOptsAtDOS_demo4dexe = 
+CompOptsAt_demo4dexe = $(CompLocalOptsAtDOS_demo4dexe)
+CompInheritOptsAt_demo4dexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE 
+LinkerInheritOptsAt_demo4dexe = -x
+LinkerOptsAt_demo4dexe = $(LinkerLocalOptsAtDOS_demo4dexe)
+ResOptsAt_demo4dexe = $(ResLocalOptsAtDOS_demo4dexe)
+BOptsAt_demo4dexe = $(BLocalOptsAtDOS_demo4dexe)
+CompLocalOptsAtDOS_demo5dexe =  -ml -f-
+LinkerLocalOptsAtDOS_demo5dexe =  -c -Tde
+ResLocalOptsAtDOS_demo5dexe = 
+BLocalOptsAtDOS_demo5dexe = 
+CompOptsAt_demo5dexe = $(CompLocalOptsAtDOS_demo5dexe)
+CompInheritOptsAt_demo5dexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE 
+LinkerInheritOptsAt_demo5dexe = -x
+LinkerOptsAt_demo5dexe = $(LinkerLocalOptsAtDOS_demo5dexe)
+ResOptsAt_demo5dexe = $(ResLocalOptsAtDOS_demo5dexe)
+BOptsAt_demo5dexe = $(BLocalOptsAtDOS_demo5dexe)
+CompLocalOptsAtDOS_demo6dexe =  -ml -f-
+LinkerLocalOptsAtDOS_demo6dexe =  -c -Tde
+ResLocalOptsAtDOS_demo6dexe = 
+BLocalOptsAtDOS_demo6dexe = 
+CompOptsAt_demo6dexe = $(CompLocalOptsAtDOS_demo6dexe)
+CompInheritOptsAt_demo6dexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE 
+LinkerInheritOptsAt_demo6dexe = -x
+LinkerOptsAt_demo6dexe = $(LinkerLocalOptsAtDOS_demo6dexe)
+ResOptsAt_demo6dexe = $(ResLocalOptsAtDOS_demo6dexe)
+BOptsAt_demo6dexe = $(BLocalOptsAtDOS_demo6dexe)
+CompLocalOptsAtDOS_ftdemodexe =  -ml -f-
+LinkerLocalOptsAtDOS_ftdemodexe =  -c -Tde
+ResLocalOptsAtDOS_ftdemodexe = 
+BLocalOptsAtDOS_ftdemodexe = 
+CompOptsAt_ftdemodexe = $(CompLocalOptsAtDOS_ftdemodexe)
+CompInheritOptsAt_ftdemodexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE 
+LinkerInheritOptsAt_ftdemodexe = -x
+LinkerOptsAt_ftdemodexe = $(LinkerLocalOptsAtDOS_ftdemodexe)
+ResOptsAt_ftdemodexe = $(ResLocalOptsAtDOS_ftdemodexe)
+BOptsAt_ftdemodexe = $(BLocalOptsAtDOS_ftdemodexe)
+CompLocalOptsAtDOS_infodexe =  -ml -f-
+LinkerLocalOptsAtDOS_infodexe =  -c -Tde
+ResLocalOptsAtDOS_infodexe = 
+BLocalOptsAtDOS_infodexe = 
+CompOptsAt_infodexe = $(CompLocalOptsAtDOS_infodexe)
+CompInheritOptsAt_infodexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE 
+LinkerInheritOptsAt_infodexe = -x
+LinkerOptsAt_infodexe = $(LinkerLocalOptsAtDOS_infodexe)
+ResOptsAt_infodexe = $(ResLocalOptsAtDOS_infodexe)
+BOptsAt_infodexe = $(BLocalOptsAtDOS_infodexe)
+CompLocalOptsAtDOS_landminedexe =  -ml -f-
+LinkerLocalOptsAtDOS_landminedexe =  -c -Tde
+ResLocalOptsAtDOS_landminedexe = 
+BLocalOptsAtDOS_landminedexe = 
+CompOptsAt_landminedexe = $(CompLocalOptsAtDOS_landminedexe)
+CompInheritOptsAt_landminedexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE 
+LinkerInheritOptsAt_landminedexe = -x
+LinkerOptsAt_landminedexe = $(LinkerLocalOptsAtDOS_landminedexe)
+ResOptsAt_landminedexe = $(ResLocalOptsAtDOS_landminedexe)
+BOptsAt_landminedexe = $(BLocalOptsAtDOS_landminedexe)
+CompLocalOptsAtDOS_movedexe =  -ml -f-
+LinkerLocalOptsAtDOS_movedexe =  -c -Tde
+ResLocalOptsAtDOS_movedexe = 
+BLocalOptsAtDOS_movedexe = 
+CompOptsAt_movedexe = $(CompLocalOptsAtDOS_movedexe)
+CompInheritOptsAt_movedexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE 
+LinkerInheritOptsAt_movedexe = -x
+LinkerOptsAt_movedexe = $(LinkerLocalOptsAtDOS_movedexe)
+ResOptsAt_movedexe = $(ResLocalOptsAtDOS_movedexe)
+BOptsAt_movedexe = $(BLocalOptsAtDOS_movedexe)
+CompLocalOptsAtDOS_sliderdexe =  -ml -f-
+LinkerLocalOptsAtDOS_sliderdexe =  -c -Tde
+ResLocalOptsAtDOS_sliderdexe = 
+BLocalOptsAtDOS_sliderdexe = 
+CompOptsAt_sliderdexe = $(CompLocalOptsAtDOS_sliderdexe)
+CompInheritOptsAt_sliderdexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE 
+LinkerInheritOptsAt_sliderdexe = -x
+LinkerOptsAt_sliderdexe = $(LinkerLocalOptsAtDOS_sliderdexe)
+ResOptsAt_sliderdexe = $(ResLocalOptsAtDOS_sliderdexe)
+BOptsAt_sliderdexe = $(BLocalOptsAtDOS_sliderdexe)
+CompLocalOptsAtDOS_waitdexe =  -ml -f-
+LinkerLocalOptsAtDOS_waitdexe =  -c -Tde
+ResLocalOptsAtDOS_waitdexe = 
+BLocalOptsAtDOS_waitdexe = 
+CompOptsAt_waitdexe = $(CompLocalOptsAtDOS_waitdexe)
+CompInheritOptsAt_waitdexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE 
+LinkerInheritOptsAt_waitdexe = -x
+LinkerOptsAt_waitdexe = $(LinkerLocalOptsAtDOS_waitdexe)
+ResOptsAt_waitdexe = $(ResLocalOptsAtDOS_waitdexe)
+BOptsAt_waitdexe = $(BLocalOptsAtDOS_waitdexe)
+CompLocalOptsAtDOS_worlddexe =  -ml -f-
+LinkerLocalOptsAtDOS_worlddexe =  -c -Tde
+ResLocalOptsAtDOS_worlddexe = 
+BLocalOptsAtDOS_worlddexe = 
+CompOptsAt_worlddexe = $(CompLocalOptsAtDOS_worlddexe)
+CompInheritOptsAt_worlddexe = -I$(BC_Path)\INCLUDE;$(MW_Path)\SRC\INCLUDE 
+LinkerInheritOptsAt_worlddexe = -x
+LinkerOptsAt_worlddexe = $(LinkerLocalOptsAtDOS_worlddexe)
+ResOptsAt_worlddexe = $(ResLocalOptsAtDOS_worlddexe)
+BOptsAt_worlddexe = $(BLocalOptsAtDOS_worlddexe)
+
+#
+# Dependency List
+#
+Dep_nanox = \
+   nanox.lib\
+   demo.exe\
+   demo2.exe\
+   demo3.exe\
+   demo4.exe\
+   demo5.exe\
+   demo6.exe\
+   ftdemo.exe\
+   info.exe\
+   landmine.exe\
+   move.exe\
+   slider.exe\
+   wait.exe\
+   world.exe
+
+nanox : BccDos.cfg $(Dep_nanox)
+  echo MakeNode
+
+Dep_nanoxdlib = \
+   egavga.obj\
+   x6x13.obj\
+   rom8x16.obj\
+   winfreesansserif11x13.obj\
+   winfreesystem14x16.obj\
+   genfont.obj\
+   mou_dos.obj\
+   kbd_tc.obj\
+   scr_tc.obj\
+   devclip.obj\
+   devpal4.obj\
+   devpal2.obj\
+   devpal1.obj\
+   devmouse.obj\
+   devkbd.obj\
+   devfont.obj\
+   devdraw.obj\
+   devrgn.obj\
+   devrgn2.obj\
+   devarc.obj\
+   error.obj\
+   srvclip.obj\
+   srvutil.obj\
+   srvmain.obj\
+   srvfunc.obj\
+   srvevent.obj\
+   stubs.obj
+
+nanox.lib : $(Dep_nanoxdlib)
+  $(TLIB) $< $(IDE_BFLAGS) $(BOptsAt_nanoxdlib) @&&|
+ -+egavga.obj &
+-+x6x13.obj &
+-+rom8x16.obj &
+-+winfreesansserif11x13.obj &
+-+winfreesystem14x16.obj &
+-+genfont.obj &
+-+mou_dos.obj &
+-+kbd_tc.obj &
+-+scr_tc.obj &
+-+devclip.obj &
+-+devpal4.obj &
+-+devpal2.obj &
+-+devpal1.obj &
+-+devmouse.obj &
+-+devkbd.obj &
+-+devfont.obj &
+-+devdraw.obj &
+-+devrgn.obj &
+-+devrgn2.obj &
+-+devarc.obj &
+-+error.obj &
+-+srvclip.obj &
+-+srvutil.obj &
+-+srvmain.obj &
+-+srvfunc.obj &
+-+srvevent.obj &
+-+stubs.obj
+|
+
+x6x13.obj :  fonts\x6x13.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ fonts\x6x13.c
+|
+
+rom8x16.obj :  fonts\rom8x16.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ fonts\rom8x16.c
+|
+
+winfreesansserif11x13.obj :  fonts\winfreesansserif11x13.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ fonts\winfreesansserif11x13.c
+|
+
+winfreesystem14x16.obj :  fonts\winfreesystem14x16.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ fonts\winfreesystem14x16.c
+|
+
+genfont.obj :  drivers\genfont.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ drivers\genfont.c
+|
+
+mou_dos.obj :  drivers\mou_dos.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ drivers\mou_dos.c
+|
+
+kbd_tc.obj :  drivers\kbd_tc.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ drivers\kbd_tc.c
+|
+
+scr_tc.obj :  drivers\scr_tc.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ drivers\scr_tc.c
+|
+
+devclip.obj :  engine\devclip.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devclip.c
+|
+
+devpal4.obj :  engine\devpal4.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devpal4.c
+|
+
+devpal2.obj :  engine\devpal2.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devpal2.c
+|
+
+devpal1.obj :  engine\devpal1.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devpal1.c
+|
+
+devmouse.obj :  engine\devmouse.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devmouse.c
+|
+
+devkbd.obj :  engine\devkbd.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devkbd.c
+|
+
+devfont.obj :  engine\devfont.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devfont.c
+|
+
+devdraw.obj :  engine\devdraw.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devdraw.c
+|
+
+devrgn.obj :  engine\devrgn.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devrgn.c
+|
+
+devrgn2.obj :  engine\devrgn2.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devrgn2.c
+|
+
+devarc.obj :  engine\devarc.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\devarc.c
+|
+
+error.obj :  engine\error.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ engine\error.c
+|
+
+srvclip.obj :  nanox\srvclip.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ nanox\srvclip.c
+|
+
+srvutil.obj :  nanox\srvutil.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ nanox\srvutil.c
+|
+
+srvmain.obj :  nanox\srvmain.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ nanox\srvmain.c
+|
+
+srvfunc.obj :  nanox\srvfunc.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ nanox\srvfunc.c
+|
+
+srvevent.obj :  nanox\srvevent.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ nanox\srvevent.c
+|
+
+stubs.obj :  nanox\stubs.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_nanoxdlib) $(CompInheritOptsAt_nanoxdlib) -o$@ nanox\stubs.c
+|
+
+Dep_demodexe = \
+   nanox.lib\
+   demo.obj
+
+demo.exe : $(Dep_demodexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_demodexe) $(LinkerInheritOptsAt_demodexe) +
+$(BC_Lib_Path)\c0l.obj+
+demo.obj
+$<,$*
+nanox.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+demo.obj :  demos\nanox\demo.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_demodexe) $(CompInheritOptsAt_demodexe) -o$@ demos\nanox\demo.c
+|
+
+Dep_demo2dexe = \
+   nanox.lib\
+   demo2.obj
+
+demo2.exe : $(Dep_demo2dexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_demo2dexe) $(LinkerInheritOptsAt_demo2dexe) +
+$(BC_Lib_Path)\c0l.obj+
+demo2.obj
+$<,$*
+nanox.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+demo2.obj :  demos\nanox\demo2.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_demo2dexe) $(CompInheritOptsAt_demo2dexe) -o$@ demos\nanox\demo2.c
+|
+
+Dep_demo3dexe = \
+   nanox.lib\
+   demo3.obj
+
+demo3.exe : $(Dep_demo3dexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_demo3dexe) $(LinkerInheritOptsAt_demo3dexe) +
+$(BC_Lib_Path)\c0l.obj+
+demo3.obj
+$<,$*
+nanox.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+demo3.obj :  demos\nanox\demo3.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_demo3dexe) $(CompInheritOptsAt_demo3dexe) -o$@ demos\nanox\demo3.c
+|
+
+Dep_demo4dexe = \
+   nanox.lib\
+   demo4.obj
+
+demo4.exe : $(Dep_demo4dexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_demo4dexe) $(LinkerInheritOptsAt_demo4dexe) +
+$(BC_Lib_Path)\c0l.obj+
+demo4.obj
+$<,$*
+nanox.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+demo4.obj :  demos\nanox\demo4.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_demo4dexe) $(CompInheritOptsAt_demo4dexe) -o$@ demos\nanox\demo4.c
+|
+
+Dep_demo5dexe = \
+   nanox.lib\
+   demo5.obj
+
+demo5.exe : $(Dep_demo5dexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_demo5dexe) $(LinkerInheritOptsAt_demo5dexe) +
+$(BC_Lib_Path)\c0l.obj+
+demo5.obj
+$<,$*
+nanox.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+demo5.obj :  demos\nanox\demo5.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_demo5dexe) $(CompInheritOptsAt_demo5dexe) -o$@ demos\nanox\demo5.c
+|
+
+Dep_demo6dexe = \
+   nanox.lib\
+   demo6.obj
+
+demo6.exe : $(Dep_demo6dexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_demo6dexe) $(LinkerInheritOptsAt_demo6dexe) +
+$(BC_Lib_Path)\c0l.obj+
+demo6.obj
+$<,$*
+nanox.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+demo6.obj :  demos\nanox\demo6.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_demo6dexe) $(CompInheritOptsAt_demo6dexe) -o$@ demos\nanox\demo6.c
+|
+
+Dep_ftdemodexe = \
+   nanox.lib\
+   ftdemo.obj
+
+ftdemo.exe : $(Dep_ftdemodexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_ftdemodexe) $(LinkerInheritOptsAt_ftdemodexe) +
+$(BC_Lib_Path)\c0l.obj+
+ftdemo.obj
+$<,$*
+nanox.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+ftdemo.obj :  demos\nanox\ftdemo.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_ftdemodexe) $(CompInheritOptsAt_ftdemodexe) -o$@ demos\nanox\ftdemo.c
+|
+
+Dep_infodexe = \
+   nanox.lib\
+   info.obj
+
+info.exe : $(Dep_infodexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_infodexe) $(LinkerInheritOptsAt_infodexe) +
+$(BC_Lib_Path)\c0l.obj+
+info.obj
+$<,$*
+nanox.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+info.obj :  demos\nanox\info.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_infodexe) $(CompInheritOptsAt_infodexe) -o$@ demos\nanox\info.c
+|
+
+Dep_landminedexe = \
+   nanox.lib\
+   landmine.obj
+
+landmine.exe : $(Dep_landminedexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_landminedexe) $(LinkerInheritOptsAt_landminedexe) +
+$(BC_Lib_Path)\c0l.obj+
+landmine.obj
+$<,$*
+nanox.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+landmine.obj :  demos\nanox\landmine.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_landminedexe) $(CompInheritOptsAt_landminedexe) -o$@ demos\nanox\landmine.c
+|
+
+Dep_movedexe = \
+   nanox.lib\
+   move.obj
+
+move.exe : $(Dep_movedexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_movedexe) $(LinkerInheritOptsAt_movedexe) +
+$(BC_Lib_Path)\c0l.obj+
+move.obj
+$<,$*
+nanox.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+move.obj :  demos\nanox\move.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_movedexe) $(CompInheritOptsAt_movedexe) -o$@ demos\nanox\move.c
+|
+
+Dep_sliderdexe = \
+   nanox.lib\
+   slider.obj
+
+slider.exe : $(Dep_sliderdexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_sliderdexe) $(LinkerInheritOptsAt_sliderdexe) +
+$(BC_Lib_Path)\c0l.obj+
+slider.obj
+$<,$*
+nanox.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+slider.obj :  demos\nanox\slider.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_sliderdexe) $(CompInheritOptsAt_sliderdexe) -o$@ demos\nanox\slider.c
+|
+
+Dep_waitdexe = \
+   nanox.lib\
+   wait.obj
+
+wait.exe : $(Dep_waitdexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_waitdexe) $(LinkerInheritOptsAt_waitdexe) +
+$(BC_Lib_Path)\c0l.obj+
+wait.obj
+$<,$*
+nanox.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+wait.obj :  demos\nanox\wait.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_waitdexe) $(CompInheritOptsAt_waitdexe) -o$@ demos\nanox\wait.c
+|
+
+Dep_worlddexe = \
+   nanox.lib\
+   world.obj
+
+world.exe : $(Dep_worlddexe)
+  $(TLINK)   @&&|
+ /v $(IDE_LinkFLAGSDOS) $(LinkerOptsAt_worlddexe) $(LinkerInheritOptsAt_worlddexe) +
+$(BC_Lib_Path)\c0l.obj+
+world.obj
+$<,$*
+nanox.lib+
+$(BC_Lib_Path)\graphics.lib+
+$(BC_Lib_Path)\fp87.lib+
+$(BC_Lib_Path)\mathl.lib+
+$(BC_Lib_Path)\cl.lib
+
+
+
+|
+world.obj :  demos\nanox\world.c
+  $(BCCDOS) -P- -c @&&|
+ $(CompOptsAt_worlddexe) $(CompInheritOptsAt_worlddexe) -o$@ demos\nanox\world.c
+|
+
+# Compiler configuration file
+BccDos.cfg : 
+   Copy &&|
+-W-
+-w
+-R
+-v
+-vi
+-H
+-H=nanox.csm
+| $@
+
+
+clean :
+  del *.obj
+  del *.lib
+  del *.exe
+  del *.csm
+  del BccDos.cfg
+
+egavga.obj :
+  copy $(BGI_Path)\egavga.bgi .
+  $(BGI_Path)\bgiobj egavga
+  del egavga.bgi
+
diff -urN lib/microwindows/src/test.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/test.sh
--- lib/microwindows/src/test.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/test.sh	2005-02-21 16:13:44.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X & bin/nxkbd & bin/nanowm & bin/nxterm & bin/demo & sleep 10000
diff -urN lib/microwindows/src/vnc.sh /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/vnc.sh
--- lib/microwindows/src/vnc.sh	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/vnc.sh	2005-02-21 16:03:55.000000000 +0100
@@ -0,0 +1 @@
+bin/nano-X & bin/vnc win98:0
diff -urN lib/microwindows/src/xconfigure /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/xconfigure
--- lib/microwindows/src/xconfigure	1970-01-01 01:00:00.000000000 +0100
+++ /home/ge2513/ge2513_2LDS/SMART_SRC/microwin/src/xconfigure	2005-02-21 16:13:40.000000000 +0100
@@ -0,0 +1,1436 @@
+#!/usr/bin/wish -f
+#
+# Microwindows configuration interface: X11 version
+#
+# wish is available at http://dev.scriptics.com/software/tcltck
+#
+# (C) Martin Jolicoeur, 1999
+#
+# Thu Mar 16 14:33:08 CET 2000, Fabio Parodi, <fabio.parodi@iname.com>
+#       added VTSWITCH button
+#
+#
+
+set configfile 0;
+
+# Configurable options
+variable arch;
+variable armtoolsprefix;
+variable mipstoolsprefix;
+variable rtemstoolsprefix;
+variable optimize;
+variable debug;
+variable verbose
+variable microwin;
+variable nanox;
+variable shlibs;
+variable objframe;
+variable nwidget;
+variable microwindemo;
+variable nanoxdemo;
+variable screenpixtype;
+variable server;
+variable sharedmem;
+variable havefileio;
+variable havebmp;
+variable havejpg;
+variable incjpg;
+variable libjpg;
+variable haveft;
+variable incft;
+variable libft;
+variable havet1;
+variable inct1;
+variable libt1;
+
+variable havehzk;
+variable hzkdir;
+variable hzkfontsize;
+
+variable updateregions;
+variable erasemove;
+variable havemsfonts;
+variable graypalette;
+variable screenlinux;
+variable vgafb;
+variable portraitfb;
+variable x11e15;
+variable x11screenwidth;
+variable x11screenheight;
+variable x11screendepth;
+variable mouselinux;
+variable keyblinux;
+variable vtswitch;
+variable sa1100ltlend;
+variable rtemsbuild;
+variable rtemsbsp;
+variable screenelks;
+
+
+wm title . "Microwindows configuration"
+wm geometry . +100+100
+
+# Create main menu
+frame .main
+frame .main.col1
+frame .main.col2
+button .main.col1.compile -text "Compiling options" -command "compileoptions;"
+button .main.col1.platform -text "Platform" -command "platformoptions;"
+button .main.col1.lib -text "Libraries to compile" -command "liboptions;"
+button .main.col2.colors -text "Color options" -command "colorsoptions;"
+button .main.col2.io -text "I/O" -command "iooptions;"
+button .main.col2.misc -text "Miscellaneous options" -command "miscoptions;"
+pack .main.col1.compile .main.col1.platform .main.col1.lib -side top -fill x
+pack .main.col2.colors .main.col2.io .main.col2.misc -side top -fill x
+pack .main.col1 .main.col2 -side left
+
+# Create ok, cancel, help buttons
+frame .buttons
+pack .buttons -side bottom -fill x -pady 2m
+button .buttons.ok -text "Save & Exit" -command "writeconfig; destroy ."
+button .buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+button .buttons.cancel -text "Cancel" -command "destroy ."
+pack .buttons.cancel .buttons.help .buttons.ok -side right -expand 1
+
+pack .main .buttons -side bottom
+
+
+################################################################################
+#
+# Show the "compile" options dialog
+#
+################################################################################
+proc compileoptions {} {
+
+   toplevel .compile
+   wm title .compile "Compiling options"
+   wm geometry .compile +100+100
+
+   frame .compile.buttons
+   pack .compile.buttons -side bottom -fill x -pady 2m
+   button .compile.buttons.ok -text "Ok" -command "destroy .compile"
+   button .compile.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .compile.buttons.help .compile.buttons.ok -side right -expand 1
+
+   frame .compile.a0
+   frame .compile.a1
+   frame .compile.a2
+   checkbutton .compile.a0.b0 -text "Optimize" -variable optimize -relief flat
+   checkbutton .compile.a1.b1 -text "Debug" -variable debug -relief flat
+   checkbutton .compile.a2.b2 -text "Verbose" -variable verbose -relief flat
+   pack .compile.a0.b0 -side left
+   pack .compile.a1.b1 -side left
+   pack .compile.a2.b2 -side left
+   pack .compile.a0  -side top -pady 2 -anchor w -fill x
+   pack .compile.a1  -side top -pady 2 -anchor w -fill x
+   pack .compile.a2  -side top -pady 2 -anchor w -fill x
+   pack .compile.a0 .compile.a1 .compile.a2 -side top -anchor e
+}
+
+
+################################################################################
+#
+# Show the "platform" options dialog
+#
+################################################################################
+proc platformoptions {} {
+
+   toplevel .platform
+   wm title .platform "Platform options"
+   wm geometry .platform +100+100
+
+   frame .platform.buttons
+   pack .platform.buttons -side bottom -fill x -pady 2m
+   button .platform.buttons.ok -text "Ok" -command "destroy .platform"
+   button .platform.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .platform.buttons.help .platform.buttons.ok -side right -expand 1
+
+   frame .platform.a0
+   frame .platform.a1
+   frame .platform.a2
+   frame .platform.a3
+   frame .platform.a4
+   frame .platform.a5
+
+   radiobutton .platform.a0.b0 -text "Linux (native)" -variable arch -relief flat -value 0 -anchor w
+   button .platform.a0.options -text "Options" -command {nativelinuxoptions;};
+   radiobutton .platform.a1.b1 -text "Linux-ARM (x-compile)" -variable arch -relief flat -value 1 -anchor w
+   button .platform.a1.options -text "Options" -command {armlinuxoptions;};
+   radiobutton .platform.a2.b2 -text "Linux-MIPS (x-compile)" -variable arch -relief flat -value 2 -anchor w
+   button .platform.a2.options -text "Options" -command {mipslinuxoptions;};
+   radiobutton .platform.a3.b3 -text "RTEMS" -variable arch -relief flat -value 3 -anchor w
+   button .platform.a3.options -text "Options" -command {rtemsoptions;};
+   radiobutton .platform.a4.b4 -text "Solaris" -variable arch -relief flat -value 4 -anchor w
+   button .platform.a4.options -text "Options" -command {nativelinuxoptions;};
+   radiobutton .platform.a5.b5 -text "ELKS" -variable arch -relief flat -value 5 -anchor w
+   button .platform.a5.options -text "Options" -command {elksoptions;};
+   pack .platform.a0.b0 .platform.a0.options -side left
+   pack .platform.a1.b1 .platform.a1.options -side left
+   pack .platform.a2.b2 .platform.a2.options -side left
+   pack .platform.a3.b3 .platform.a3.options -side left
+   pack .platform.a4.b4 .platform.a4.options -side left
+   pack .platform.a5.b5 .platform.a5.options -side left
+   pack .platform.a0  -side top -pady 2 -anchor w -fill x
+   pack .platform.a1  -side top -pady 2 -anchor w -fill x
+   pack .platform.a2  -side top -pady 2 -anchor w -fill x
+   pack .platform.a3  -side top -pady 2 -anchor w -fill x
+   pack .platform.a4  -side top -pady 2 -anchor w -fill x
+   pack .platform.a5  -side top -pady 2 -anchor w -fill x
+   pack .platform.a0.options .platform.a1.options .platform.a2.options \
+   .platform.a3.options .platform.a4.options .platform.a5.options -side top -anchor e
+}
+
+
+################################################################################
+#
+# Show the "libraries" options dialog
+#
+################################################################################
+proc liboptions {} {
+
+   toplevel .lib
+   wm title .lib "Libraries to compile"
+   wm geometry .lib +100+100
+
+   frame .lib.buttons
+   pack .lib.buttons -side bottom -fill x -pady 2m
+   button .lib.buttons.ok -text "Ok" -command "destroy .lib"
+   button .lib.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .lib.buttons.help .lib.buttons.ok -side right -expand 1
+
+   frame .lib.a0
+   frame .lib.a1
+   frame .lib.a2
+   frame .lib.a3
+   checkbutton .lib.a0.b0 -text "NanoX" -variable nanox -relief flat
+   button .lib.a0.options -text "Options" -command {nanoxoptions;};
+   checkbutton .lib.a1.b1 -text "Microwindows" -variable microwin -relief flat
+   button .lib.a1.options -text "Options" -command {mwinoptions;};
+   checkbutton .lib.a2.b2 -text "Shared libs" -variable shlibs -relief flat
+   checkbutton .lib.a3.b3 -text "C++ obj framework" -variable objframe -relief flat
+
+   pack .lib.a0.b0 .lib.a0.options -side left
+   pack .lib.a1.b1 .lib.a1.options -side left
+   pack .lib.a2.b2 -side left
+   pack .lib.a3.b3 -side left
+   pack .lib.a0  -side top -pady 2 -anchor w -fill x
+   pack .lib.a1  -side top -pady 2 -anchor w -fill x
+   pack .lib.a2  -side top -pady 2 -anchor w -fill x
+   pack .lib.a3  -side top -pady 2 -anchor w -fill x
+   pack .lib.a0.options .lib.a1.options -side top -anchor e
+}
+
+
+################################################################################
+#
+# Show the "colors" options dialog
+#
+################################################################################
+proc colorsoptions {} {
+   global screenpixtype;
+
+   toplevel .colors
+   wm title .colors "Colors options"
+   wm geometry .colors +100+100
+
+   frame .colors.buttons
+   pack .colors.buttons -side bottom -fill x -pady 2m
+   button .colors.buttons.ok -text "Ok" -command "colorsoptions_ok; destroy .colors"
+   button .colors.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .colors.buttons.help .colors.buttons.ok -side right -expand 1
+
+   frame .colors.a0
+   frame .colors.a1
+   label .colors.a0.label -text "ScreenPixType:" -anchor e
+   entry .colors.a0.pixtype -width 25 -relief sunken
+   checkbutton .colors.a1.b1 -text "Gray Palette (4bpp only)" -variable graypalette -relief flat
+   pack .colors.a0.label .colors.a0.pixtype -side left
+   pack .colors.a1.b1 -side left
+   pack .colors.a0  -side top -pady 2 -anchor w -fill x
+   pack .colors.a1  -side top -pady 2 -anchor w -fill x
+   pack .colors.a0 .colors.a1 -side top -anchor e
+   .colors.a0.pixtype insert 0 $screenpixtype;
+}
+
+proc colorsoptions_ok {} {
+   global screenpixtype;
+   set screenpixtype [.colors.a0.pixtype get];
+}
+
+
+################################################################################
+#
+# Show the "I/O" options dialog
+#
+################################################################################
+proc iooptions {} {
+   global havebmp;
+   global havejpg;
+   global haveft;
+   global havet1;
+
+	global havehzk;
+
+   toplevel .io
+   wm title .io "I/O options"
+   wm geometry .io +100+100
+
+   frame .io.buttons
+   pack .io.buttons -side bottom -fill x -pady 2m
+   button .io.buttons.ok -text "Ok" -command "destroy .io"
+   button .io.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .io.buttons.help .io.buttons.ok -side right -expand 1
+
+   frame .io.a0
+   frame .io.a1
+   frame .io.a2
+   frame .io.a3
+   frame .io.a4
+
+   frame .io.a5
+
+   checkbutton .io.a0.b0 -text "Have File I/O" -variable havefileio -relief flat
+   label .io.a0.label -text "(If the above is disabled, this will disable all the features below)" -anchor e
+   checkbutton .io.a1.b0 -text "Have bmp support" -variable havebmp -relief flat
+   checkbutton .io.a2.b0 -text "Have jpeg support" -variable havejpg -relief flat
+   button .io.a2.options -text "Options" -command {jpegoptions;};
+   checkbutton .io.a3.b0 -text "Have freetype support (truetype fonts)" -variable haveft -relief flat
+   button .io.a3.options -text "Options" -command {ftoptions;};
+   checkbutton .io.a4.b0 -text "Have t1lib support (type 1 fonts)" -variable havet1 -relief flat
+   button .io.a4.options -text "Options" -command {t1options;};
+
+   checkbutton .io.a5.b0 -text "Have HZK support (Bitmap(Metrix) fonts)" -variable havehzk -relief flat
+   button .io.a5.options -text "Options" -command {hzkoptions;};
+
+   pack .io.a0.b0  .io.a0.label -side top -pady 2 -anchor w
+   pack .io.a1.b0  -side top -pady 2 -anchor w
+   pack .io.a2.b0 .io.a2.options -side left
+   pack .io.a3.b0 .io.a3.options -side left
+   pack .io.a4.b0 .io.a4.options -side left
+   pack .io.a5.b0 .io.a5.options -side left
+
+   pack .io.a0  -side top -pady 2 -anchor w -fill x
+   pack .io.a1  -side top -pady 2 -anchor w -fill x
+   pack .io.a2  -side top -pady 2 -anchor w -fill x
+   pack .io.a3  -side top -pady 2 -anchor w -fill x
+   pack .io.a4  -side top -pady 2 -anchor w -fill x
+   pack .io.a5  -side top -pady 2 -anchor w -fill x
+
+   pack .io.a2.options .io.a3.options .io.a4.options .io.a5.options -side top -anchor e
+}
+
+
+################################################################################
+#
+# Show the "Miscellaneous" options dialog
+#
+################################################################################
+proc miscoptions {} {
+
+   toplevel .misc
+   wm title .misc "Miscellaneous options"
+   wm geometry .misc +100+100
+
+   frame .misc.buttons
+   pack .misc.buttons -side bottom -fill x -pady 2m
+   button .misc.buttons.ok -text "Ok" -command "destroy .misc"
+   button .misc.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .misc.buttons.help .misc.buttons.ok -side right -expand 1
+
+   checkbutton .misc.b0 -text "Have MS fonts" -variable havemsfonts -relief flat
+   pack .misc.b0  -side top -pady 2 -anchor w
+}
+
+
+################################################################################
+#
+# Show nanox options dialog
+#
+################################################################################
+proc nanoxoptions {} {
+
+   toplevel .optnanox
+   wm title .optnanox "NanoX options"
+   wm geometry .optnanox +100+100
+
+   frame .optnanox.buttons
+   pack .optnanox.buttons -side bottom -fill x -pady 2m
+   button .optnanox.buttons.ok -text "Ok" -command "destroy .optnanox"
+   button .optnanox.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .optnanox.buttons.help .optnanox.buttons.ok -side right -expand 1
+
+   frame .optnanox.a0
+   checkbutton .optnanox.a0.server -text "Link app into server" -variable server -relief flat
+   checkbutton .optnanox.a0.sharedmem -text "Enable shared mem support (app/server only)" -variable sharedmem -relief flat
+   checkbutton .optnanox.a0.nwidget -text "Compile Nwidget library" -variable nwidget -relief flat
+   checkbutton .optnanox.a0.demo -text "Compile demos" -variable nanoxdemo -relief flat
+   pack .optnanox.a0.server  -side top -pady 2 -anchor w
+   pack .optnanox.a0.sharedmem  -side top -pady 2 -anchor w
+   pack .optnanox.a0.nwidget  -side top -pady 2 -anchor w
+   pack .optnanox.a0.demo  -side top -pady 2 -anchor w
+   pack .optnanox.a0  -side top -pady 2 -anchor w -fill x
+}
+
+
+################################################################################
+#
+# Show microwindows options dialog
+#
+################################################################################
+proc mwinoptions {} {
+
+   toplevel .optmwin
+   wm title .optmwin "MicroWindows options"
+   wm geometry .optmwin +100+100
+
+   frame .optmwin.buttons
+   pack .optmwin.buttons -side bottom -fill x -pady 2m
+   button .optmwin.buttons.ok -text "Ok" -command "destroy .optmwin"
+   button .optmwin.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .optmwin.buttons.help .optmwin.buttons.ok -side right -expand 1
+
+   frame .optmwin.algo -borderwidth 1 -relief solid
+   frame .optmwin.demo -borderwidth 1 -relief solid
+   pack .optmwin.algo .optmwin.demo -side top -fill x -pady .5c -padx .5c
+
+   frame .optmwin.algo.a0
+   frame .optmwin.algo.a1
+   label .optmwin.algo.label -text "Window move agorithm options"
+   pack .optmwin.algo.label -side top
+   checkbutton .optmwin.algo.a0.b0 -text "Update regions" -variable updateregions -relief flat
+   checkbutton .optmwin.algo.a1.b1 -text "Erase Move" -variable erasemove -relief flat
+   pack .optmwin.algo.a0.b0  -side top -pady 2 -anchor w
+   pack .optmwin.algo.a1.b1  -side top -pady 2 -anchor w
+   pack .optmwin.algo.a0  -side top -pady 2 -anchor w -fill x
+   pack .optmwin.algo.a1  -side top -pady 2 -anchor w -fill x
+
+   frame .optmwin.demo.a0
+   label .optmwin.demo.label -text "Other options"
+   pack .optmwin.demo.label -side top
+   checkbutton .optmwin.demo.a0.b0 -text "Compile demos" -variable microwindemo -relief flat
+   pack .optmwin.demo.a0.b0  -side top -pady 2 -anchor w
+   pack .optmwin.demo.a0  -side top -pady 2 -anchor w -fill x
+}
+
+
+################################################################################
+#
+# Show native linux/Solaris options dialog
+#
+################################################################################
+proc nativelinuxoptions {} {
+
+   toplevel .optnatlinux
+   wm title .optnatlinux "Native Linux/Solaris options"
+   wm geometry .optnatlinux +100+100
+
+   frame .optnatlinux.buttons
+   pack .optnatlinux.buttons -side bottom -fill x -pady 2m
+   button .optnatlinux.buttons.ok -text "Ok" -command "destroy .optnatlinux"
+   button .optnatlinux.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .optnatlinux.buttons.help .optnatlinux.buttons.ok -side right -expand 1
+
+   button .optnatlinux.screen -text "Screen driver" -command "screenoptions;"
+   button .optnatlinux.mouse -text "Mouse driver" -command "mouseoptions;"
+   button .optnatlinux.kbd -text "Keyboard driver" -command "kbdoptions;"
+   pack .optnatlinux.screen .optnatlinux.mouse .optnatlinux.kbd -side top -fill x
+}
+
+
+################################################################################
+#
+# Show arm linux options dialog
+#
+################################################################################
+proc armlinuxoptions {} {
+   global screenlinux;
+   global armtoolsprefix;
+
+   toplevel .optarmlinux
+   wm title .optarmlinux "ARM Linux options"
+   wm geometry .optarmlinux +100+100
+
+   frame .optarmlinux.buttons
+   pack .optarmlinux.buttons -side bottom -fill x -pady 2m
+   button .optarmlinux.buttons.ok -text "Ok" -command "armlinuxoptions_ok; destroy .optarmlinux"
+   button .optarmlinux.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .optarmlinux.buttons.help .optarmlinux.buttons.ok -side right -expand 1
+
+   frame .optarmlinux.comp -borderwidth 1 -relief solid
+   pack .optarmlinux.comp -side top -fill x -pady .5c -padx .5c
+
+   frame .optarmlinux.comp.a0
+   label .optarmlinux.comp.label -text "Compiler options"
+   pack .optarmlinux.comp.label -side top
+   label .optarmlinux.comp.a0.label -text "Tools Prefix:" -anchor e
+   entry .optarmlinux.comp.a0.prefix -width 25 -relief sunken
+   checkbutton .optarmlinux.comp.a0.sa1100ltlend \
+-text "SA1100 Little endian option (for 4 bpp only)" -variable sa1100ltlend -relief flat
+   pack .optarmlinux.comp.a0.label  -side top -pady 2 -anchor w
+   pack .optarmlinux.comp.a0.prefix  -side top -pady 2 -anchor c
+   pack .optarmlinux.comp.a0.sa1100ltlend  -side top -pady 2 -anchor c
+   pack .optarmlinux.comp.a0  -side top -pady 2 -anchor w -fill x
+   .optarmlinux.comp.a0.prefix insert 0 $armtoolsprefix;
+
+   button .optarmlinux.screen -text "Screen driver" -command "screenoptions;"
+   button .optarmlinux.mouse -text "Mouse driver" -command "mouseoptions;"
+   button .optarmlinux.kbd -text "Keyboard driver" -command "kbdoptions;"
+   pack .optarmlinux.comp .optarmlinux.screen .optarmlinux.mouse .optarmlinux.kbd -side top -fill x
+}
+
+proc armlinuxoptions_ok {} {
+   global armtoolsprefix;
+   set armtoolsprefix [.optarmlinux.comp.a0.prefix get];
+}
+
+
+################################################################################
+#
+# Show mips linux options dialog
+#
+################################################################################
+proc mipslinuxoptions {} {
+   global screenlinux;
+   global mipstoolsprefix;
+
+   toplevel .optmipslinux
+   wm title .optmipslinux "MIPS Linux options"
+   wm geometry .optmipslinux +100+100
+
+   frame .optmipslinux.buttons
+   pack .optmipslinux.buttons -side bottom -fill x -pady 2m
+   button .optmipslinux.buttons.ok -text "Ok" -command "mipslinuxoptions_ok; destroy .optmipslinux"
+   button .optmipslinux.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .optmipslinux.buttons.help .optmipslinux.buttons.ok -side right -expand 1
+
+   frame .optmipslinux.comp -borderwidth 1 -relief solid
+   pack .optmipslinux.comp -side top -fill x -pady .5c -padx .5c
+
+   frame .optmipslinux.comp.a0
+   label .optmipslinux.comp.label -text "Compiler options"
+   pack .optmipslinux.comp.label -side top
+   label .optmipslinux.comp.a0.label -text "Tools Prefix:" -anchor e
+   entry .optmipslinux.comp.a0.prefix -width 25 -relief sunken
+   pack .optmipslinux.comp.a0.label  -side top -pady 2 -anchor w
+   pack .optmipslinux.comp.a0.prefix  -side top -pady 2 -anchor c
+   pack .optmipslinux.comp.a0  -side top -pady 2 -anchor w -fill x
+   .optmipslinux.comp.a0.prefix insert 0 $mipstoolsprefix;
+
+   button .optmipslinux.screen -text "Screen driver" -command "screenoptions;"
+   button .optmipslinux.mouse -text "Mouse driver" -command "mouseoptions;"
+   button .optmipslinux.kbd -text "Keyboard driver" -command "kbdoptions;"
+   pack .optmipslinux.comp .optmipslinux.screen .optmipslinux.mouse .optmipslinux.kbd -side top -fill x
+}
+
+proc mipslinuxoptions_ok {} {
+   global mipstoolsprefix;
+   set mipstoolsprefix [.optmipslinux.comp.a0.prefix get];
+}
+
+
+################################################################################
+#
+# Show rtems options dialog
+#
+################################################################################
+proc rtemsoptions {} {
+   global rtemstoolsprefix;
+   global rtemsbuild;
+   global rtemsbsp;
+
+   toplevel .optrtems
+   wm title .optrtems "RTEMS options"
+   wm geometry .optrtems +100+100
+
+   frame .optrtems.buttons
+   pack .optrtems.buttons -side bottom -fill x -pady 2m
+   button .optrtems.buttons.ok -text "Ok" -command "rtemsoptions_ok; destroy .optrtems"
+   button .optrtems.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .optrtems.buttons.help .optrtems.buttons.ok -side right -expand 1
+
+   frame .optrtems.comp -borderwidth 1 -relief solid
+   pack .optrtems.comp -side top -fill x -pady .5c -padx .5c
+
+   frame .optrtems.comp.a0
+   frame .optrtems.comp.a1
+   frame .optrtems.comp.a2
+   label .optrtems.comp.label -text "Compiler options"
+   pack .optrtems.comp.label -side top
+   label .optrtems.comp.a0.label -text "Tools Prefix:" -anchor e
+   entry .optrtems.comp.a0.prefix -width 25 -relief sunken
+   label .optrtems.comp.a1.label -text "Build:" -anchor e
+   entry .optrtems.comp.a1.build -width 25 -relief sunken
+   label .optrtems.comp.a2.label -text "BSP:" -anchor e
+   entry .optrtems.comp.a2.bsp -width 25 -relief sunken
+   pack .optrtems.comp.a0.label  -side top -pady 2 -anchor w
+   pack .optrtems.comp.a0.prefix  -side top -pady 2 -anchor c
+   pack .optrtems.comp.a1.label .optrtems.comp.a1.build -side top -pady 2 -anchor w
+   pack .optrtems.comp.a2.label .optrtems.comp.a2.bsp -side top -pady 2 -anchor w
+   pack .optrtems.comp.a0  -side top -pady 2 -anchor w -fill x
+   pack .optrtems.comp.a1  -side top -pady 2 -anchor w -fill x
+   pack .optrtems.comp.a2  -side top -pady 2 -anchor w -fill x
+   pack .optrtems.comp.a0.prefix .optrtems.comp.a1.build .optrtems.comp.a2.bsp  -side top -anchor e
+   .optrtems.comp.a0.prefix insert 0 $rtemstoolsprefix;
+   .optrtems.comp.a1.build insert 0 $rtemsbuild;
+   .optrtems.comp.a2.bsp insert 0 $rtemsbsp;
+
+   button .optrtems.screen -text "Screen driver" -command "screenoptions;"
+   button .optrtems.mouse -text "Mouse driver" -command "mouseoptions;"
+   button .optrtems.kbd -text "Keyboard driver" -command "kbdoptions;"
+   pack .optrtems.comp .optrtems.screen .optrtems.mouse .optrtems.kbd -side top -fill x
+}
+
+proc rtemsoptions_ok {} {
+   global rtemstoolsprefix;
+   global rtemsbuild;
+   global rtemsbsp;
+   set rtemstoolsprefix [.optrtems.comp.a0.prefix get];
+   set rtemsbuild [.optrtems.comp.a1.build get];
+   set rtemsbsp [.optrtems.comp.a2.bsp get];
+}
+
+
+################################################################################
+#
+# Show jpeg options dialog
+#
+################################################################################
+proc jpegoptions {} {
+   global incjpg;
+   global libjpg;
+
+   toplevel .optjpeg
+   wm title .optjpeg "JPEG support options"
+   wm geometry .optjpeg +100+100
+
+   frame .optjpeg.buttons
+   pack .optjpeg.buttons -side bottom -fill x -pady 2m
+   button .optjpeg.buttons.ok -text "Ok" -command "jpegoptions_ok; destroy .optjpeg"
+   button .optjpeg.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .optjpeg.buttons.help .optjpeg.buttons.ok -side right -expand 1
+
+   frame .optjpeg.a0
+   frame .optjpeg.a1
+   label .optjpeg.a0.label -text "Libjpeg include dir:" -anchor e
+   entry .optjpeg.a0.incjpg -width 40 -relief sunken
+   label .optjpeg.a1.label -text "Libjpeg path:" -anchor e
+   entry .optjpeg.a1.libjpg -width 40 -relief sunken
+   pack .optjpeg.a0.label  -side top -pady 2 -anchor w
+   pack .optjpeg.a0.incjpg  -side top -pady 2 -anchor w
+   pack .optjpeg.a1.label  -side top -pady 2 -anchor w
+   pack .optjpeg.a1.libjpg  -side top -pady 2 -anchor w
+   pack .optjpeg.a0  -side top -pady 2 -anchor w -fill x
+   pack .optjpeg.a1  -side top -pady 2 -anchor w -fill x
+
+   pack .optjpeg.a0.incjpg .optjpeg.a1.libjpg  -side top -anchor e
+
+   .optjpeg.a0.incjpg insert 0 $incjpg;
+   .optjpeg.a1.libjpg insert 0 $libjpg;
+}
+
+
+proc jpegoptions_ok {} {
+   global incjpg;
+   global libjpg;
+   set incjpg [.optjpeg.a0.incjpg get];
+   set libjpg [.optjpeg.a1.libjpg get];
+}
+
+
+################################################################################
+#
+# Show freetype options dialog
+#
+################################################################################
+proc ftoptions {} {
+   global incft;
+   global libft;
+
+   toplevel .optft
+   wm title .optft "Freetype support options"
+   wm geometry .optft +100+100
+
+   frame .optft.buttons
+   pack .optft.buttons -side bottom -fill x -pady 2m
+   button .optft.buttons.ok -text "Ok" -command "ftoptions_ok; destroy .optft"
+   button .optft.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .optft.buttons.help .optft.buttons.ok -side right -expand 1
+
+   frame .optft.a0
+   frame .optft.a1
+   label .optft.a0.label -text "Freetype include dir:" -anchor e
+   entry .optft.a0.incft -width 40 -relief sunken
+   label .optft.a1.label -text "Freetype lib path:" -anchor e
+   entry .optft.a1.libft -width 40 -relief sunken
+   pack .optft.a0.label  -side top -pady 2 -anchor w
+   pack .optft.a0.incft  -side top -pady 2 -anchor w
+   pack .optft.a1.label  -side top -pady 2 -anchor w
+   pack .optft.a1.libft  -side top -pady 2 -anchor w
+   pack .optft.a0  -side top -pady 2 -anchor w -fill x
+   pack .optft.a1  -side top -pady 2 -anchor w -fill x
+
+   pack .optft.a0.incft .optft.a1.libft  -side top -anchor e
+
+   .optft.a0.incft insert 0 $incft;
+   .optft.a1.libft insert 0 $libft;
+}
+
+
+proc ftoptions_ok {} {
+   global incft;
+   global libft;
+   set incft [.optft.a0.incft get];
+   set libft [.optft.a1.libft get];
+}
+
+
+################################################################################
+#
+# Show t1lib options dialog
+#
+################################################################################
+proc t1options {} {
+   global inct1;
+   global libt1;
+
+   toplevel .optt1
+   wm title .optt1 "T1Lib support options"
+   wm geometry .optt1 +100+100
+
+   frame .optt1.buttons
+   pack .optt1.buttons -side bottom -fill x -pady 2m
+   button .optt1.buttons.ok -text "Ok" -command "t1options_ok; destroy .optt1"
+   button .optt1.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .optt1.buttons.help .optt1.buttons.ok -side right -expand 1
+
+   frame .optt1.a0
+   frame .optt1.a1
+   label .optt1.a0.label -text "T1lib include dir:" -anchor e
+   entry .optt1.a0.inct1 -width 40 -relief sunken
+   label .optt1.a1.label -text "T1lib path:" -anchor e
+   entry .optt1.a1.libt1 -width 40 -relief sunken
+   pack .optt1.a0.label  -side top -pady 2 -anchor w
+   pack .optt1.a0.inct1  -side top -pady 2 -anchor w
+   pack .optt1.a1.label  -side top -pady 2 -anchor w
+   pack .optt1.a1.libt1  -side top -pady 2 -anchor w
+   pack .optt1.a0  -side top -pady 2 -anchor w -fill x
+   pack .optt1.a1  -side top -pady 2 -anchor w -fill x
+
+   pack .optt1.a0.inct1 .optt1.a1.libt1  -side top -anchor e
+
+   .optt1.a0.inct1 insert 0 $inct1;
+   .optt1.a1.libt1 insert 0 $libt1;
+}
+
+
+proc t1options_ok {} {
+   global inct1;
+   global libt1;
+   set inct1 [.optt1.a0.inct1 get];
+   set libt1 [.optt1.a1.libt1 get];
+}
+
+################################################################################
+#
+# Show hzk dir options dialog
+#
+################################################################################
+proc hzkoptions {} {
+   global hzkdir;
+	 global hzkfontsize;
+
+   toplevel .opthzk
+   wm title .opthzk "HZK support options"
+   wm geometry .opthzk +100+100
+
+   frame .opthzk.buttons
+   pack .opthzk.buttons -side bottom -fill x -pady 2m
+   button .opthzk.buttons.ok -text "Ok" -command "hzkoptions_ok; destroy .opthzk"
+   button .opthzk.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .opthzk.buttons.help .opthzk.buttons.ok -side right -expand 1
+
+   frame .opthzk.a0
+   frame .opthzk.a1
+   label .opthzk.a0.label -text "HZK fonts dir:" -anchor e
+   entry .opthzk.a0.hzkdir -width 40 -relief sunken
+   label .opthzk.a1.label -text "HZK fonts Size:(16 or 12 ,now)" -anchor e
+   entry .opthzk.a1.hzksize -width 40 -relief sunken
+   pack .opthzk.a0.label  -side top -pady 2 -anchor w
+   pack .opthzk.a0.hzkdir -side top -pady 2 -anchor w
+   pack .opthzk.a1.label  -side top -pady 2 -anchor w
+   pack .opthzk.a1.hzksize -side top -pady 2 -anchor w
+   pack .opthzk.a0  -side top -pady 2 -anchor w -fill x
+   pack .opthzk.a1  -side top -pady 2 -anchor w -fill x
+
+	 pack .opthzk.a0.hzkdir .opthzk.a1.hzksize -side top -anchor e
+
+   .opthzk.a0.hzkdir insert 0 $hzkdir;
+   .opthzk.a1.hzksize insert 0 $hzkfontsize;
+}
+
+
+proc hzkoptions_ok {} {
+   global hzkdir;
+   global hzkfontsize;
+   set hzkdir [.opthzk.a0.hzkdir get];
+   set hzkfontsize [.opthzk.a1.hzksize get];
+
+}
+
+
+################################################################################
+#
+# Show screen driver options dialog
+#
+################################################################################
+proc screenoptions {} {
+
+   toplevel .optscreen
+   wm title .optscreen "Screen driver options"
+   wm geometry .optscreen +100+100
+
+   frame .optscreen.buttons
+   pack .optscreen.buttons -side bottom -fill x -pady 2m
+   button .optscreen.buttons.ok -text "Ok" -command "destroy .optscreen"
+   button .optscreen.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .optscreen.buttons.help .optscreen.buttons.ok -side right -expand 1
+
+   frame .optscreen.a0
+   frame .optscreen.a1
+   frame .optscreen.a2
+   frame .optscreen.a3
+   radiobutton .optscreen.a0.b0 -text "Framebuffer" -variable screenlinux -relief flat -value 0 -anchor w
+   button .optscreen.a0.options -text "Options" -command {fboptions;};
+   radiobutton .optscreen.a1.b1 -text "X11" -variable screenlinux -relief flat -value 1 -anchor w
+   button .optscreen.a1.options -text "Options" -command {x11options;};
+   radiobutton .optscreen.a2.b2 -text "VgaLib" -variable screenlinux -relief flat -value 2 -anchor w
+   radiobutton .optscreen.a3.b3 -text "HW Vga" -variable screenlinux -relief flat -value 3 -anchor w
+   pack .optscreen.a0.b0 .optscreen.a0.options -side left
+   pack .optscreen.a1.b1  .optscreen.a1.options -side left
+   pack .optscreen.a2.b2  -side top -pady 2 -anchor w
+   pack .optscreen.a3.b3  -side top -pady 2 -anchor w
+   pack .optscreen.a0  -side top -pady 2 -anchor w -fill x
+   pack .optscreen.a1  -side top -pady 2 -anchor w -fill x
+   pack .optscreen.a2  -side top -pady 2 -anchor w -fill x
+   pack .optscreen.a3  -side top -pady 2 -anchor w -fill x
+   pack .optscreen.a0.options .optscreen.a1.options  -side top -anchor e
+}
+
+
+################################################################################
+#
+# Show mouse options dialog
+#
+################################################################################
+proc mouseoptions {} {
+
+   toplevel .optmouse
+   wm title .optmouse "Mouse driver options"
+   wm geometry .optmouse +100+100
+
+   frame .optmouse.buttons
+   pack .optmouse.buttons -side bottom -fill x -pady 2m
+   button .optmouse.buttons.ok -text "Ok" -command "destroy .optmouse"
+   button .optmouse.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .optmouse.buttons.help .optmouse.buttons.ok -side right -expand 1
+
+   frame .optmouse.a0
+   frame .optmouse.a1
+   frame .optmouse.a2
+   frame .optmouse.a3
+   frame .optmouse.a4
+   radiobutton .optmouse.a0.b0 -text "GPM mouse" -variable mouselinux -relief flat -value 0 -anchor w
+   radiobutton .optmouse.a1.b1 -text "Serial mouse" -variable mouselinux -relief flat -value 1 -anchor w
+   radiobutton .optmouse.a2.b2 -text "Touch Pad" -variable mouselinux -relief flat -value 2 -anchor w
+   radiobutton .optmouse.a3.b3 -text "Touch screen" -variable mouselinux -relief flat -value 3 -anchor w
+   radiobutton .optmouse.a4.b4 -text "No Mouse" -variable mouselinux -relief flat -value 4 -anchor w
+   pack .optmouse.a0.b0  -side top -pady 2 -anchor w
+   pack .optmouse.a1.b1  -side top -pady 2 -anchor w
+   pack .optmouse.a2.b2  -side top -pady 2 -anchor w
+   pack .optmouse.a3.b3  -side top -pady 2 -anchor w
+   pack .optmouse.a4.b4  -side top -pady 2 -anchor w
+   pack .optmouse.a0  -side top -pady 2 -anchor w -fill x
+   pack .optmouse.a1  -side top -pady 2 -anchor w -fill x
+   pack .optmouse.a2  -side top -pady 2 -anchor w -fill x
+   pack .optmouse.a3  -side top -pady 2 -anchor w -fill x
+   pack .optmouse.a4  -side top -pady 2 -anchor w -fill x
+}
+
+
+################################################################################
+#
+# Show keyboard options dialog
+#
+################################################################################
+proc kbdoptions {} {
+
+   toplevel .optkbd
+   wm title .optkbd "Keyboard driver options"
+   wm geometry .optkbd +100+100
+
+   frame .optkbd.buttons
+   pack .optkbd.buttons -side bottom -fill x -pady 2m
+   button .optkbd.buttons.ok -text "Ok" -command "destroy .optkbd"
+   button .optkbd.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .optkbd.buttons.help .optkbd.buttons.ok -side right -expand 1
+
+   frame .optkbd.a0
+   frame .optkbd.a1
+   radiobutton .optkbd.a0.b0 -text "TTY" -variable keyblinux -relief flat -value 0 -anchor w
+   radiobutton .optkbd.a1.b0 -text "No keyboard" -variable keyblinux -relief flat -value 1 -anchor w
+   pack .optkbd.a0.b0  -side top -pady 2 -anchor w
+   pack .optkbd.a1.b0  -side top -pady 2 -anchor w
+   pack .optkbd.a0  -side top -pady 2 -anchor w -fill x
+   pack .optkbd.a1  -side top -pady 2 -anchor w -fill x
+}
+
+
+################################################################################
+#
+# Show framebuffer options dialog
+#
+################################################################################
+proc fboptions {} {
+
+   toplevel .optfb
+   wm title .optfb "Framebuffer options"
+   wm geometry .optfb +100+100
+
+   frame .optfb.buttons
+   pack .optfb.buttons -side bottom -fill x -pady 2m
+   button .optfb.buttons.ok -text "Ok" -command "destroy .optfb"
+   button .optfb.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .optfb.buttons.help .optfb.buttons.ok -side right -expand 1
+
+   frame .optfb.a0
+   frame .optfb.a1
+   frame .optfb.a2
+   checkbutton .optfb.a0.vgafb -text "VGA fb" -variable vgafb -relief flat
+   checkbutton .optfb.a1.portrait -text "Portrait mode" -variable portraitfb -relief flat
+   checkbutton .optfb.a2.vt -text "VTerm Switch code included" -variable vtswitch -relief flat
+   pack .optfb.a0.vgafb  -side top -pady 2 -anchor w
+   pack .optfb.a1.portrait  -side top -pady 2 -anchor w
+   pack .optfb.a2.vt  -side top -pady 2 -anchor w
+   pack .optfb.a0 .optfb.a1 .optfb.a2 -side top -pady 2 -anchor w -fill x
+}
+
+
+################################################################################
+#
+# Show X11 options dialog
+#
+################################################################################
+proc x11options {} {
+   global x11screenwidth;
+   global x11screenheight;
+   global x11screendepth;
+   global x11e15;
+
+   toplevel .optx11
+   wm title .optx11 "X11 options"
+   wm geometry .optx11 +100+100
+
+   frame .optx11.buttons
+   pack .optx11.buttons -side bottom -fill x -pady 2m
+   button .optx11.buttons.ok -text "Ok" -command "x11options_ok; destroy .optx11"
+   button .optx11.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .optx11.buttons.help .optx11.buttons.ok -side right -expand 1
+
+   frame .optx11.a0
+   frame .optx11.a1
+   frame .optx11.a2
+   frame .optx11.a3
+   label .optx11.a0.label -text "Screen width:" -anchor e
+   entry .optx11.a0.width -width 5 -relief sunken
+   label .optx11.a1.label -text "Screen height:" -anchor e
+   entry .optx11.a1.height -width 5 -relief sunken
+   label .optx11.a2.label -text "Screen depth:" -anchor e
+   entry .optx11.a2.depth -width 5 -relief sunken
+   checkbutton .optx11.a3.x11e15 -text "Use predefined model E15" -variable x11e15 -relief flat
+   pack .optx11.a0.label .optx11.a0.width  -side left
+   pack .optx11.a1.label .optx11.a1.height -side left
+   pack .optx11.a2.label .optx11.a2.depth -side left
+   pack .optx11.a3.x11e15  -side top -pady 2 -anchor w
+   pack .optx11.a0  -side top -pady 2 -anchor w -fill x
+   pack .optx11.a1  -side top -pady 2 -anchor w -fill x
+   pack .optx11.a2  -side top -pady 2 -anchor w -fill x
+   pack .optx11.a3  -side top -pady 2 -anchor w -fill x
+   pack .optx11.a0.width .optx11.a1.height .optx11.a2.depth -side top -anchor e
+   .optx11.a0.width insert 0 $x11screenwidth;
+   .optx11.a1.height insert 0 $x11screenheight;
+   .optx11.a2.depth insert 0 $x11screendepth;
+}
+
+proc x11options_ok {} {
+   global x11screenwidth;
+   global x11screenheight;
+   global x11screendepth;
+   set x11screenwidth [.optx11.a0.width get];
+   set x11screenheight [.optx11.a1.height get];
+   set x11screendepth [.optx11.a2.depth get];
+}
+
+
+################################################################################
+#
+# Show elks options dialog
+#
+################################################################################
+proc elksoptions {} {
+   global screenelks;
+
+   toplevel .optelks
+   wm title .optelks "ELKS options"
+   wm geometry .optelks +100+100
+
+   frame .optelks.buttons
+   pack .optelks.buttons -side bottom -fill x -pady 2m
+   button .optelks.buttons.ok -text "Ok" -command "destroy .optelks"
+   button .optelks.buttons.help -text "Help" -command "tk_dialog .help message TODO \"\" 0 ok"
+   pack .optelks.buttons.help .optelks.buttons.ok -side right -expand 1
+
+   frame .optelks.sd -borderwidth 1 -relief solid
+   pack .optelks.sd -side top -fill x -pady .5c -padx .5c
+
+   frame .optelks.sd.a0
+   frame .optelks.sd.a1
+   frame .optelks.sd.a2
+   label .optelks.sd.label -text "Screen driver"
+   pack .optelks.sd.label -side top
+   radiobutton .optelks.sd.a0.b0 -text "ASM VGA (faster)" -variable screenelks -relief flat -value 0 -anchor w
+   radiobutton .optelks.sd.a1.b1 -text "C VGA " -variable screenelks -relief flat -value 1 -anchor w
+   radiobutton .optelks.sd.a2.b2 -text "Hercule" -variable screenelks -relief flat -value 2 -anchor w
+   pack .optelks.sd.a0.b0  -side top -pady 2 -anchor w
+   pack .optelks.sd.a1.b1  -side top -pady 2 -anchor w
+   pack .optelks.sd.a2.b2  -side top -pady 2 -anchor w
+   pack .optelks.sd.a0  -side top -pady 2 -anchor w -fill x
+   pack .optelks.sd.a1  -side top -pady 2 -anchor w -fill x
+   pack .optelks.sd.a2  -side top -pady 2 -anchor w -fill x
+}
+
+
+################################################################################
+#
+# Read data from the configuration file
+#
+################################################################################
+proc readconfig {} {
+   global configfile;
+
+   global arch;
+   global armtoolsprefix;
+   global mipstoolsprefix;
+   global rtemstoolsprefix;
+   global optimize;
+   global debug;
+   global verbose
+   global microwin;
+   global nanox;
+   global shlibs;
+   global objframe;
+   global nwidget;
+   global microwindemo;
+   global nanoxdemo;
+   global screenpixtype;
+   global server;
+   global sharedmem;
+   global havefileio;
+   global havebmp;
+   global havejpg;
+   global incjpg;
+   global libjpg;
+   global haveft;
+   global incft;
+   global libft;
+   global havet1;
+   global inct1;
+   global libt1;
+   global havehzk;
+   global hzkdir;	
+   global hzkfontsize;
+   global updateregions;
+   global erasemove;
+   global havemsfonts;
+   global graypalette;
+   global screenlinux;
+   global vgafb;
+   global portraitfb;
+   global x11e15;
+   global x11screenwidth;
+   global x11screenheight;
+   global x11screendepth;
+   global mouselinux;
+   global keyblinux;
+   global vtswitch;
+   global sa1100ltlend;
+   global rtemsbuild;
+   global rtemsbsp;
+   global screenelks;
+
+   set configfile [open "config" r+]
+
+   set armtoolsprefix [getvalue "ARMTOOLSPREFIX" 0];
+   set mipstoolsprefix [getvalue "MIPSTOOLSPREFIX" 0];
+   set rtemstoolsprefix [getvalue "RTEMSTOOLSPREFIX" 0];
+
+   set arch [getvalue "ARCH" 0];
+   switch -exact $arch {
+        LINUX-NATIVE {set arch 0;}
+        LINUX-ARM {set arch 1;}
+        LINUX-MIPS {set arch 2;}
+        RTEMS {set arch 3;}
+        SOLARIS {set arch 4;}
+        ELKS {set arch 5;}
+        default {set arch 0}
+   }
+
+   set optimize [getvalue "OPTIMIZE" 1];
+   set debug [getvalue "DEBUG" 1];
+   set verbose [getvalue "VERBOSE" 1];
+   
+   set vtswitch [getvalue "VTSWITCH" 1];
+
+   set microwin [getvalue "MICROWIN" 1];
+   set nanox [getvalue "NANOX" 1];
+   set shlibs [getvalue "SHAREDLIBS" 1];
+   set objframe [getvalue "OBJFRAMEWORK" 1];
+   set nwidget [getvalue "NWIDGET" 1];
+
+   set microwindemo [getvalue "MICROWINDEMO" 1]
+   set nanoxdemo [getvalue "NANOXDEMO" 1];
+
+   set screenpixtype [getvalue "SCREEN_PIXTYPE" 0]
+   set server [getvalue "LINK_APP_INTO_SERVER" 1];
+   set sharedmem [getvalue "HAVE_SHAREDMEM_SUPPORT" 1];
+
+   set havefileio [getvalue "HAVE_FILEIO" 1];
+   set havebmp [getvalue "HAVE_BMP_SUPPORT" 1];
+   set havejpg [getvalue "HAVE_JPEG_SUPPORT" 1];
+   set incjpg [getvalue "INCJPEG" 0];
+   set libjpg [getvalue "LIBJPEG" 0];
+   set haveft [getvalue "HAVE_FREETYPE_SUPPORT" 1];
+   set incft [getvalue "INCFTLIB" 0];
+   set libft [getvalue "LIBFTLIB" 0];
+   set havet1 [getvalue "HAVE_T1LIB_SUPPORT" 1];
+   set inct1 [getvalue "INCT1LIB" 0];
+   set libt1 [getvalue "LIBT1LIB" 0];
+
+   set havehzk [getvalue "HAVE_HZK_SUPPORT" 1];
+   set hzkdir		[getvalue "HZK_FONT_DIR" 0];	
+   set hzkfontsize [getvalue "HZK_FONT_SIZE" 0];
+
+   set updateregions [getvalue "UPDATEREGIONS" 1]
+   set erasemove [getvalue "ERASEMOVE" 1]
+
+   set havemsfonts [getvalue "HAVEMSFONTS" 1];
+
+   set graypalette [getvalue "GRAYPALETTE" 1];
+
+   set vgafb [getvalue "FBVGA" 1]
+   set portraitfb [getvalue "PORTRAIT_MODE" 1]
+
+   set x11e15 [getvalue "SCREEN_E15 1" 1]
+   set x11screenwidth [getvalue "SCREEN_WIDTH" 0]
+   set x11screenheight [getvalue "SCREEN_HEIGHT" 0]
+   set x11screendepth [getvalue "SCREEN_DEPTH" 0]
+
+   set sa1100ltlend [getvalue "SA1100_LCD_LTLEND" 1]
+   set rtemsbuild [getvalue "RTEMS_BUILD" 0]
+   set rtemsbsp [getvalue "RTEMS_BSP" 0]
+
+   if {[getvalue "FRAMEBUFFER" 1] == 1} {set screenlinux 0;}
+   if {[getvalue "X11" 1] == 1} {set screenlinux 1}
+   if {[getvalue "VGALIB" 1] == 1} {set screenlinux 2}
+   if {[getvalue "HWVGA" 1] == 1} {set screenlinux 3}
+
+   if {[getvalue "GPMMOUSE" 1] == 1} {set mouselinux 0;}
+   if {[getvalue "SERMOUSE" 1] == 1} {set mouselinux 1}
+   if {[getvalue "TPMOUSE" 1] == 1} {set mouselinux 2}
+   if {[getvalue "TSMOUSE" 1] == 1} {set mouselinux 3}
+   if {[getvalue "NOMOUSE" 1] == 1} {set mouselinux 4}
+
+   if {[getvalue "TTYKBD" 1] == 1} {set keyblinux 0;}
+   if {[getvalue "NOKBD" 1] == 1} {set keyblinux 1;}
+
+   if {[getvalue "ASMVGADRIVER" 1] == 1} {set screenelks 0;}
+   if {[getvalue "CVGADRIVER" 1] == 1} {set screenelks 1}
+   if {[getvalue "HERCDRIVER" 1] == 1} {set screenelks 2}
+
+   close $configfile;
+}
+
+
+################################################################################
+#
+# Get a value from the config file
+#
+################################################################################
+proc getvalue {name isyesorno} {
+   global configfile;
+
+   set line 0;
+
+   seek $configfile 0 start;
+
+   while {[eof $configfile] == 0} {
+      set line [gets $configfile];
+
+      if {[regexp ($name)(\ |\t)*(=)(\ |\t)*(.*) $line all a b c d e] == 1} {
+         set $e [string trim $e]
+
+         if {$isyesorno == 1} {
+            switch -exact $e {
+            N {return 0;}
+            Y {return 1;}
+            default {return 0}
+            }
+         }
+
+         return $e
+      }
+   }
+}
+
+
+################################################################################
+#
+# Write data to the configuration file
+#
+################################################################################
+proc writeconfig {} {
+   global arch;
+   global armtoolsprefix;
+   global mipstoolsprefix;
+   global rtemstoolsprefix;
+   global optimize;
+   global debug;
+   global verbose
+   global microwin;
+   global nanox;
+   global shlibs;
+   global objframe;
+   global nwidget;
+   global microwindemo;
+   global nanoxdemo;
+   global screenpixtype;
+   global server;
+   global sharedmem;
+   global havefileio;
+   global havebmp;
+   global havejpg;
+   global incjpg;
+   global libjpg;
+   global haveft;
+   global incft;
+   global libft;
+   global havet1;
+   global inct1;
+   global libt1;
+   global havehzk;
+   global hzkdir;
+   global hzkfontsize;
+   global updateregions;
+   global erasemove;
+   global havemsfonts;
+   global graypalette;
+   global screenlinux;
+   global vgafb;
+   global portraitfb;
+   global x11e15;
+   global x11screenwidth;
+   global x11screenheight;
+   global x11screendepth;
+   global mouselinux;
+   global keyblinux;
+   global vtswitch;
+   global sa1100ltlend;
+   global rtemsbuild;
+   global rtemsbsp;
+   global screenelks;
+
+   if {$arch == 0} {putvalue "ARCH" "LINUX-NATIVE"
+   } elseif {$arch == 1} {putvalue "ARCH" "LINUX-ARM"
+   } elseif {$arch == 2} {putvalue "ARCH" "LINUX-MIPS"
+   } elseif {$arch == 3} {putvalue "ARCH" "RTEMS"
+   } elseif {$arch == 4} {putvalue "ARCH" "SOLARIS"
+   } elseif {$arch == 5} {putvalue "ARCH" "ELKS"}
+
+   putvalue "ARMTOOLSPREFIX" $armtoolsprefix;
+   putvalue "MIPSTOOLSPREFIX" $mipstoolsprefix;
+   putvalue "RTEMSTOOLSPREFIX" $rtemstoolsprefix;
+   putvalue "OPTIMIZE" $optimize;
+   putvalue "DEBUG" $debug;
+   putvalue "VERBOSE" $verbose;
+   putvalue "MICROWIN" $microwin
+   putvalue "NANOX" $nanox;
+   putvalue "SHAREDLIBS" $shlibs;
+   putvalue "OBJFRAMEWORK" $objframe;
+   putvalue "NWIDGET" $nwidget;
+   putvalue "MICROWINDEMO" $microwindemo;
+   putvalue "NANOXDEMO" $nanoxdemo;
+   putvalue "SCREEN_PIXTYPE" $screenpixtype;
+   putvalue "LINK_APP_INTO_SERVER" $server;
+   putvalue "HAVE_SHAREDMEM_SUPPORT" $sharedmem;
+   putvalue "HAVE_FILEIO" $havefileio;
+   putvalue "HAVE_BMP_SUPPORT" $havebmp;
+   putvalue "HAVE_JPEG_SUPPORT" $havejpg;
+   putvalue "INCJPEG" $incjpg;
+   putvalue "LIBJPEG" $libjpg;
+   putvalue "HAVE_FREETYPE_SUPPORT" $haveft;
+   putvalue "INCFTLIB" $incft;
+   putvalue "LIBFTLIB" $libft;
+   putvalue "HAVE_T1LIB_SUPPORT" $havet1;
+   putvalue "INCT1LIB" $inct1;
+   putvalue "LIBT1LIB" $libt1;
+   putvalue "HAVE_HZK_SUPPORT" $havehzk;
+   putvalue "HZK_FONT_DIR"		$hzkdir;
+   putvalue "HZK_FONT_SIZE"		$hzkfontsize;
+
+   putvalue "UPDATEREGIONS" $updateregions;
+   putvalue "ERASEMOVE" $erasemove;
+   putvalue "HAVEMSFONTS" $havemsfonts;
+   putvalue "GRAYPALETTE" $graypalette;
+   putvalue "PORTRAIT_MODE" $portraitfb;
+   putvalue "FBVGA" $vgafb;
+   putvalue "SCREEN_E15" $x11e15;
+   putvalue "SCREEN_WIDTH" $x11screenwidth;
+   putvalue "SCREEN_HEIGHT" $x11screenheight;
+   putvalue "SCREEN_DEPTH" $x11screendepth;
+   putvalue "RTEMS_BUILD" $rtemsbuild;
+   putvalue "RTEMS_BSP" $rtemsbsp;
+   putvalue "SA1100_LCD_LTLEND" $sa1100ltlend;
+
+   if {$screenlinux == 0} {
+      putvalue "FRAMEBUFFER" 1;
+      putvalue "X11" 0;
+      putvalue "VGALIB" 0;
+      putvalue "HWVGA" 0;
+   } elseif {$screenlinux == 1} {
+      putvalue "FRAMEBUFFER" 0;
+      putvalue "X11" 1;
+      putvalue "VGALIB" 0;
+      putvalue "HWVGA" 0;
+   } elseif {$screenlinux == 2} {
+      putvalue "FRAMEBUFFER" 0;
+      putvalue "X11" 0;
+      putvalue "VGALIB" 1;
+      putvalue "HWVGA" 0;
+   } elseif {$screenlinux == 2} {
+      putvalue "FRAMEBUFFER" 0;
+      putvalue "X11" 0;
+      putvalue "VGALIB" 0;
+      putvalue "HWVGA" 1;
+   }
+
+   if {$mouselinux == 0} {
+      putvalue "GPMMOUSE" 1;
+      putvalue "SERMOUSE" 0;
+      putvalue "TPMOUSE" 0;
+      putvalue "TSMOUSE" 0;
+      putvalue "NOMOUSE" 0;
+   } elseif {$mouselinux == 1} {
+      putvalue "GPMMOUSE" 0;
+      putvalue "SERMOUSE" 1;
+      putvalue "TPMOUSE" 0;
+      putvalue "TSMOUSE" 0;
+      putvalue "NOMOUSE" 0;
+   } elseif {$mouselinux == 2} {
+      putvalue "GPMMOUSE" 0;
+      putvalue "SERMOUSE" 0;
+      putvalue "TPMOUSE" 1;
+      putvalue "TSMOUSE" 0;
+      putvalue "NOMOUSE" 0;
+   } elseif {$mouselinux == 3} {
+      putvalue "GPMMOUSE" 0;
+      putvalue "SERMOUSE" 0;
+      putvalue "TPMOUSE" 0;
+      putvalue "TSMOUSE" 1;
+      putvalue "NOMOUSE" 0;
+   } elseif {$mouselinux == 4} {
+      putvalue "GPMMOUSE" 0;
+      putvalue "SERMOUSE" 0;
+      putvalue "TPMOUSE" 0;
+      putvalue "TSMOUSE" 0;
+      putvalue "NOMOUSE" 1;
+   }
+
+   if {$keyblinux == 0} {
+      putvalue "TTYKBD" 1;
+      putvalue "NOKBD" 0;
+   } elseif {$keyblinux == 1} {
+      putvalue "TTYKBD" 0;
+      putvalue "NOKBD" 1;
+   }
+
+   putvalue "VTSWITCH" $vtswitch;
+
+   if {$screenelks == 0} {
+      putvalue "ASMVGADRIVER" 1;
+      putvalue "CVGADRIVER" 0;
+      putvalue "HERCDRIVER" 0;
+   } elseif {$screenelks == 1} {
+      putvalue "ASMVGADRIVER" 0;
+      putvalue "CVGADRIVER" 1;
+      putvalue "HERCDRIVER" 0;
+   } elseif {$screenelks == 2} {
+      putvalue "ASMVGADRIVER" 0;
+      putvalue "CVGADRIVER" 0;
+      putvalue "HERCDRIVER" 1;
+   }
+
+   puts "Now type `make` ... Enjoy"
+}
+
+
+################################################################################
+#
+# Write a value to the configuration file
+#
+################################################################################
+proc putvalue {name value} {
+   global configfile;
+
+   set found 0;
+   set configfile [open "config" r+]
+   set tempconfigfile [open "config~" w+]
+
+   if {$value == "0"} {set value "N"} elseif {$value == "1"} {set value "Y"}
+
+   seek $configfile 0 start;
+   seek $tempconfigfile 0 start;
+
+   while {[eof $configfile] == 0} {
+      set linelength [gets $configfile line];
+
+      if {[regexp ($name)(\ |\t)*(=)(\ |\t)*(.*) $line all a b c d e] == 1 && $found == 0} {
+         set $e [string trim $e]
+
+         puts -nonewline $tempconfigfile $name
+
+         set padding [expr 25 - [string length $name]]
+
+         for {set i 0} {$i < $padding} {incr i} {
+            puts  -nonewline $tempconfigfile " "
+         }
+
+         puts $tempconfigfile "= $value"
+
+         set found 1;
+      } else {
+         if {[eof $configfile] == 0} {
+            puts $tempconfigfile $line
+         } else {
+            puts -nonewline $tempconfigfile $line
+         }
+      }
+   }
+
+
+   close $tempconfigfile;
+   close $configfile;
+
+   file rename -force "config~" "config"  
+}
+
+# Initialization ...
+readconfig;