Subject:
Microwindows patches for VxWorks
From:
"Thompson, Brent" ####@####.####
Date:
6 Dec 2000 15:20:22 -0000
Message-Id: <3A2E5978.5010709@nlc.com>
Greg,
Just synchronizing up with Microwindows 0.89pre6. I see
that my previous patches to support a VxWorks port have
been integrated in (Thanks! :-) Attached are 5 more small
patches to 0.89pre6 to support the VxWorks port.
<microwin/src/include/windef.h>
* #ifdef's to deal with typedef conflicts in VxWorks port
<microwin/src/include/wintern.h>
* added VxWorks function prototype for strcmpi()
* included <string.h> to resolve compiler warnings
<microwin/src/nanox/nxdraw.c>
* changed C++ comments "// ..." to C "/* ... */" as
the VxWorks gcc in -ansi mode won't accept C++ comments
<microwin/src/engine/devfont.c>
* changed C++ comments "// ..." to C "/* ... */" as
the VxWorks gcc in -ansi mode won't accept C++ comments
<microwin/src/engine/devopen.c>
* instead of handling the default palette structures on
an OS basis (currently MSDOS & ELKS), I've added more
generic macro #ifdef's to not include a particular palette.
So, defining NOSTDPAL8 will prevent the reference of the
standard 8-bit palette (and thus you can compile the
engine without the standard 8-bit palette global variable).
Just for completeness, I also did this for the standard
1-bit, 2-bit, 3-bit, and 4-bit areas of the code.
Hope these can get folded into the next Microwindows
release. Keep up the *great* work, Greg! :-)
BAT
--
Brent A. Thompson, Next Level Communications <www.nlc.com>
1776 22nd Street #100, West Des Moines, IA 50266-1444
EMail: ####@####.#### Phone: (515)991-3853
--- windef.h-0.89pre6 Sun Sep 17 19:18:14 2000
+++ windef.h Tue Dec 5 10:54:43 2000
@@ -7,6 +7,17 @@
#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
@@ -51,24 +62,28 @@
#ifndef __ITRON_TYPES_h_ /* FIXME RTEMS hack*/
#ifndef COMMON_H /* MiniGUI hack*/
-typedef int BOOL;
#endif
#endif
+#ifndef VXWORKS
typedef unsigned char UCHAR;
+typedef unsigned short USHORT;
typedef unsigned long ULONG;
+typedef unsigned int UINT;
+typedef int BOOL;
+#endif
+
typedef ULONG * PULONG;
-typedef unsigned short USHORT;
typedef USHORT * PUSHORT;
typedef UCHAR * PUCHAR;
typedef char * PSZ;
typedef int INT;
-typedef unsigned int UINT;
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;
@@ -158,3 +173,4 @@
/* moved to winuser.h for resource compiler*/
/*typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);*/
+
--- wintern.h-0.89pre6 Mon Sep 18 02:15:22 2000
+++ wintern.h Tue Dec 5 11:04:23 2000
@@ -6,6 +6,8 @@
*/
#if (UNIX | DOS_DJGPP)
#define strcmpi strcasecmp
+#elif (VXWORKS)
+int strcmpi(const char *s1, const char *s2);
#endif
#ifdef __PACIFIC__
@@ -16,6 +18,8 @@
#ifdef DOS_TURBOC
#include <string.h>
#endif
+
+#include <string.h>
#define DBLCLICKSPEED 750 /* mouse dblclik speed msecs (was 450)*/
--- nxdraw.c-0.89pre6 Tue Oct 17 15:24:30 2000
+++ nxdraw.c Tue Dec 5 15:38:19 2000
@@ -126,17 +126,17 @@
GR_GC_ID gc = GrNewGC();
GrSetGCForeground(gc, crTop);
- //MoveToEx( hDC, x, y+h-2, NULL);
- //LineTo( hDC, x, y); /* left side*/
+ /*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*/
+ /*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*/
+ /*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*/
+ /*LineTo( hDC, x, y+h-1); /* bottom side*/
GrLine(id, gc, x+w-1, y+h-1, x, y+h-1); /* bottom*/
GrDestroyGC(gc);
@@ -157,19 +157,19 @@
GR_GC_ID gc = GrNewGC();
GrSetGCForeground(gc, crTop);
- //MoveToEx( hDC, x, y+h-2, NULL);
- //LineTo( hDC, x, y); /* left side*/
+ /*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*/
+ /*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*/
+ /*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*/
+ /*LineTo( hDC, x-1, y+h-1); /* bottom side*/
GrDestroyGC(gc);
}
--- devopen.c-0.89pre6 Thu Nov 2 01:37:00 2000
+++ devopen.c Tue Dec 5 12:56:14 2000
@@ -42,10 +42,6 @@
{
PSD psd;
MWPALENTRY * stdpal;
- extern MWPALENTRY mwstdpal1[2];
- extern MWPALENTRY mwstdpal2[4];
- extern MWPALENTRY mwstdpal4[16];
- extern MWPALENTRY mwstdpal8[256];
psd = scrdev.Open(&scrdev);
if (!psd)
@@ -57,18 +53,42 @@
/* 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;
+ }
+ break;
+#endif /* !defined(NOSTDPAL1) */
+
+#if !defined(NOSTDPAL2) /* don't require stdpal2 if not needed */
case 4: /* 2bpp*/
+ {
+ extern MWPALENTRY mwstdpal2[4];
stdpal = mwstdpal2;
- break;
+ }
+ break;
+#endif /* !defined(NOSTDPAL2) */
+
+#if !defined(NOSTDPAL3) /* don't require stdpal3 if not needed */
case 8: /* 3bpp - not fully supported*/
+#endif /* !defined(NOSTDPAL3) */
+
+#if !defined(NOSTDPAL4) && !defined(NOSTDPAL3) /* don't require stdpal4 if not needed */
case 16: /* 4bpp*/
+ {
+ extern MWPALENTRY mwstdpal4[16];
stdpal = mwstdpal4;
- break;
-#if !(MSDOS | ELKS) /* don't require large stdpal8 if not fb system*/
+ }
+ break;
+#endif /* !defined(NOSTDPAL4) && !defined(NOSTDPAL3) */
+
+#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;
@@ -77,8 +97,10 @@
gr_firstuserpalentry = FIRSTUSERPALENTRY;
#endif
stdpal = mwstdpal8;
- break;
-#endif
+ }
+ break;
+#endif /* !defined(NOSTDPAL8) */
+
default: /* truecolor*/
/* no palette*/
gr_firstuserpalentry = 0;
@@ -268,6 +290,7 @@
return best;
}
+#if 0
#include <unistd.h>
#include <fcntl.h>
/* capture the screen contents to a file for later makebmp processing*/
@@ -292,3 +315,4 @@
close(ofd);
return (ifd == -1 || ofd == -1);
}
+#endif