I tried that patch grx.dif and it still crashed,I'm sure there is a patch called grx23upd.dif available at grx location,if not ,here it is,
diff -ur3 old/addons/ctx2jpeg.c new/addons/ctx2jpeg.c --- old/addons/ctx2jpeg.c Mon May 11 21:25:22 1998 +++ new/addons/ctx2jpeg.c Thu Sep 30 20:38:18 1999 @@ -137,7 +137,7 @@ int x; GrColor c; #if GRX_VERSION_API-0 >= 0x229 - const GrColor *rcb = GrGetScanlineC(ctx,0,width-1,row); + const GrColor *rcb = GrGetScanlineC(cxt,0,width-1,row); if (rcb) { for (x=0; x < width; ++x) { c = rcb[x]; diff -ur3 old/addons/print/grxprint.txt new/addons/print/grxprint.txt --- old/addons/print/grxprint.txt Thu May 14 18:46:58 1998 +++ new/addons/print/grxprint.txt Thu Sep 30 20:38:18 1999 @@ -5,7 +5,7 @@ Andris Pavenis e-mail: pavenis@lanet.lv
- 9 March 1998 + 26 June 1998
This directory contains procedures that allows printing graphics from GRX graphic library. The source of this package is based on @@ -13,7 +13,7 @@ developed by Ullrich von Bassevitz (see copying.uz). Printing from GRX is tested under MS-DOS with DJGPP and under Linux. There is no plans to allow use it from MS-DOS real mode with Borland C++ -as the memory available to program is mostly insufficient to allocate memory +as the memory available to program is insufficient to allocate memory area necessary to build image in memory.
diff -ur3 old/addons/print/readme.txt new/addons/print/readme.txt --- old/addons/print/readme.txt Tue Feb 17 15:30:22 1998 +++ new/addons/print/readme.txt Thu Sep 30 20:38:18 1999 @@ -1,39 +1,35 @@ -Printing from GRX (currently DJGPP version only) + Printing from GRX
This is source of beta version of printing procedures for GRX. These procedures are based on sources of printer BGI drivers for Borland C++ and Pascal compilers. This BGI driver was -developed by Ullrich von Bassevitz (see copying.uz) - -Current version is tested with DJGPP only. I didn't even try -to compile it with Borland C++ as I think it is useless and -under Linux. Perhaps it could also be used under Linux (it -is only necessary to write printer filter to let PCL through -to real printer without changes. As I remember there are -such filters available). I havent done this yet (maybe sometimes -in future). This code will not work in real mode under Borland C++ -as there is not enough memory for buffers and I didn't want -to port memory managment part of printer BGI driver (I don't -think it is necessary) +developed by Ullrich von Bassevitz (see copying.uz).
+Only part of sources of printer BGI driver are used. I didn't port +drawing functions from BGI driver as they are already implemented in GRX. +I took only printing part which is now rather heavily modified to get +rid of Borland C++ specific features (e.g. inline assembler). + +Current version is tested with DJGPP and Linux versions of GRX only. +I didn't even try to compile it with Borland C++ for real mode as +I think it is useless due to lack of memory needed for buffer where +to create image. To print from GRX under Linux one should install +printer filter that allows to send PCL output to printer. + Only some modes are tested: Epson LQ printer : 180x180 dpi LaserJet 4L : 300x300 dpi (with and without compression) + I also tried DeskJet 500C mode (300x300 dpi with separate black) on DeskJet 690C and it worked.
-The code for LaserJet and DeskJet printers is not optimized and -does not compiles Ok with -O3 if some of static functions are -made inlined (DJGPP likes this). Therefore these functions are -moved to end to avoid inlining them. - -I wrote this code to avoid linking it unless it is really -used. It can be included as addon to GRX and also in main -source distribution. +Printing code is linked into executable only when it is really required. + +Currently it's included as addon to GRX.
-------------------- Files ------------------------------------------- grxprint.c - main sources of printing code -grxprint.h - interface definitions for user +grxprint.h - interface definitions for user prndata.c - printer definitions grxprn00.h - definitions used internally by grxprint only test.cc - test example @@ -47,4 +43,4 @@
Andris Pavenis -e-mail: pavenis@acad.latnet.lv +e-mail: pavenis@latnet.lv diff -ur3 old/include/grdriver.h new/include/grdriver.h --- old/include/grdriver.h Sun May 24 21:36:12 1998 +++ new/include/grdriver.h Thu Sep 30 20:38:18 1999 @@ -51,9 +51,11 @@ _GrFrameDriverSVGA32H_LFB, /* Super VGA 16M color padded #2 */ #endif #else -_GrFrameDriverXWIN8, /* X 8 bpp */ -_GrFrameDriverXWIN16, /* X 16 bpp */ -_GrFrameDriverXWIN24, /* X 24 bpp */ +_GrFrameDriverXWIN8, /* X 8 bpp */ +_GrFrameDriverXWIN16, /* X 16 bpp */ +_GrFrameDriverXWIN24, /* X 24 bpp */ +_GrFrameDriverXWIN32L, /* X 32 bpp padded #1 */ +_GrFrameDriverXWIN32H, /* X 32 bpp padded #2 */ #endif _GrFrameDriverRAM1, /* mono */ _GrFrameDriverRAM4, /* 16 color planar */ diff -ur3 old/include/grx20.h new/include/grx20.h --- old/include/grx20.h Sun May 24 21:36:24 1998 +++ new/include/grx20.h Thu Sep 30 20:38:18 1999 @@ -24,7 +24,7 @@ ** #endif ** #endif */ -#define GRX_VERSION_API 0x0229 +#define GRX_VERSION_API 0x0230
/* these are the supported configurations: */ #define GRX_VERSION_TCC_8086_DOS 1 /* also works with BCC */ @@ -58,7 +58,7 @@ #endif /* __WATCOMC__ */
#ifndef GRX_VERSION -#if defined(unix) || defined(__unix) || defined(__unix__) +#if defined(unix) || defined(__unix) || defined(__unix__) || defined(_AIX) #define GRX_VERSION GRX_VERSION_GENERIC_X11 #endif #endif diff -ur3 old/makedefs.gnu new/makedefs.gnu --- old/makedefs.gnu Fri May 22 20:52:50 1998 +++ new/makedefs.gnu Thu Sep 30 20:38:18 1999 @@ -2,14 +2,14 @@
# Specify if you have libtiff.a and corresponding .h files. # Change setting to 'y' if you have it, or to 'n' if not. -HAVE_LIBTIFF=n +HAVE_LIBTIFF=y
# Specify if you have libjpeg.a and corresponding .h files. -HAVE_LIBJPEG=n +HAVE_LIBJPEG=y
# Specify if one of the above libs requires the # zlib compression library -NEED_ZLIB=n +NEED_ZLIB=y
# Specify if you want to include printing code from addons INCLUDE_PRINTING_CODE=y @@ -35,7 +35,7 @@ DOS_DJGPP_V1 = $(SYSTEM_TAG_PREFIX).005
ifdef DEBUG -CCOPT= -O2 -Wall -g -DDEBUG=$(DEBUG) +CCOPT= -O2 -Mpentium -Wall -g -DDEBUG=$(DEBUG) LDOPT= -g else CCOPT= -O6 -Wall diff -ur3 old/src/fdrivers/fd_xwin.c new/src/fdrivers/fd_xwin.c --- old/src/fdrivers/fd_xwin.c Sun May 24 21:37:40 1998 +++ new/src/fdrivers/fd_xwin.c Thu Sep 30 20:38:18 1999 @@ -653,6 +653,7 @@ ); else { XImage ximage; + Visual *visual = DefaultVisual(_XGrDisplay,_XGrScreen);
ximage.width = src->gf_lineoffset; ximage.height = sy + h; @@ -660,15 +661,15 @@ ximage.format = ZPixmap; ximage.data = src->gf_baseaddr[0]; ximage.byte_order = LSBFirst; - ximage.bitmap_unit = _XGrBitsPerPixel; - ximage.bitmap_bit_order = MSBFirst; - ximage.bitmap_pad = _XGrBitsPerPixel; + ximage.bitmap_unit = BitmapUnit(_XGrDisplay); + ximage.bitmap_bit_order = BitmapBitOrder(_XGrDisplay); + ximage.bitmap_pad = BitmapPad(_XGrDisplay); ximage.depth = _XGrDepth; ximage.bytes_per_line = src->gf_lineoffset; ximage.bits_per_pixel = _XGrBitsPerPixel; - ximage.red_mask = 0L; - ximage.green_mask = 0L; - ximage.blue_mask = 0L; + ximage.red_mask = visual->red_mask; + ximage.green_mask = visual->green_mask; + ximage.blue_mask = visual->blue_mask; ximage.obdata = NULL; sttzero(&ximage.f);
@@ -778,7 +779,7 @@ 1, /* number of planes */ 16, /* bits per pixel */ 16*16*1024L*1024L, /* max plane size the code can handle */ - NULL, + init, readpixel, drawpixel, drawline, @@ -802,7 +803,7 @@ 1, /* number of planes */ 24, /* bits per pixel */ 24*16*1024L*1024L, /* max plane size the code can handle */ - NULL, + init, readpixel, drawpixel, drawline, @@ -818,3 +819,50 @@ _GrFrDrvGenericPutScanline };
+GrFrameDriver _GrFrameDriverXWIN32L = { + GR_frameXWIN32L, /* frame mode */ + GR_frameRAM32L, /* compatible RAM frame mode */ + TRUE, /* onscreen */ + 4, /* line width alignment */ + 1, /* number of planes */ + 32, /* bits per pixel */ + 32*16*1024L*1024L, /* max plane size the code can handle */ + init, + readpixel, + drawpixel, + drawline, + drawhline, + drawvline, + drawblock, + drawbitmap, + drawpattern, + bitblt, + bltv2r, + bltr2v, + _GrFrDrvGenericGetIndexedScanline, + _GrFrDrvGenericPutScanline +}; + +GrFrameDriver _GrFrameDriverXWIN32H = { + GR_frameXWIN32H, /* frame mode */ + GR_frameRAM32H, /* compatible RAM frame mode */ + TRUE, /* onscreen */ + 4, /* line width alignment */ + 1, /* number of planes */ + 32, /* bits per pixel */ + 32*16*1024L*1024L, /* max plane size the code can handle */ + init, + readpixel, + drawpixel, + drawline, + drawhline, + drawvline, + drawblock, + drawbitmap, + drawpattern, + bitblt, + bltv2r, + bltr2v, + _GrFrDrvGenericGetIndexedScanline, + _GrFrDrvGenericPutScanline +}; diff -ur3 old/src/fdrivers/ftable.c new/src/fdrivers/ftable.c --- old/src/fdrivers/ftable.c Mon May 18 13:41:48 1998 +++ new/src/fdrivers/ftable.c Thu Sep 30 20:38:18 1999 @@ -39,6 +39,8 @@ &_GrFrameDriverXWIN8, &_GrFrameDriverXWIN16, &_GrFrameDriverXWIN24, + &_GrFrameDriverXWIN32L, + &_GrFrameDriverXWIN32H, #endif /* now the drivers for RAM based context */ &_GrFrameDriverRAM1, @@ -49,8 +51,6 @@ &_GrFrameDriverRAM3x8, #else &_GrFrameDriverRAM24, -#endif -#if !defined(__XWIN__) && !defined(GRX_USE_RAM3x8) &_GrFrameDriverRAM32L, &_GrFrameDriverRAM32H, #endif diff -ur3 old/src/include/allocate.h new/src/include/allocate.h --- old/src/include/allocate.h Mon May 18 09:36:26 1998 +++ new/src/include/allocate.h Thu Sep 30 20:38:18 1999 @@ -6,7 +6,7 @@ ** [e-mail: csaba@vuse.vanderbilt.edu] See "doc/copying.cb" for details. **/
-#if defined(__alpha__) || (GRX_VERSION==GRX_VERSION_GENERIC_X11) +#if defined(__alpha__) || (GRX_VERSION==GRX_VERSION_GENERIC_X11) && !defined(_AIX) # include <alloca.h> #elif defined(__TURBOC__) # include <alloc.h> diff -ur3 old/src/include/gcc/memfill.h new/src/include/gcc/memfill.h --- old/src/include/gcc/memfill.h Mon May 18 11:30:56 1998 +++ new/src/include/gcc/memfill.h Thu Sep 30 20:38:20 1999 @@ -182,7 +182,7 @@ "9: \n" \ : "=r" ((void *)(p)), "=r" ((int)(b)) \ : "d" ((int)(c)), "0" ((void *)(p)), "1" ((int)(b)) \ - : "ax", "cx", "dx" \ + : "ax", "cx" \ ); \ } while (0)
diff -ur3 old/src/include/gcc/mempeek.h new/src/include/gcc/mempeek.h --- old/src/include/gcc/mempeek.h Mon May 4 20:23:36 1998 +++ new/src/include/gcc/mempeek.h Thu Sep 30 20:38:20 1999 @@ -88,7 +88,6 @@ " "#INS"b %%ah," SEL "2(%1) \n" \ : /* nothing */ \ : "a" ((unsigned)(C)), "r" ((void *)(P)) \ - : "ax" \ ); \ } while (0)
diff -ur3 old/src/include/libgrx.h new/src/include/libgrx.h --- old/src/include/libgrx.h Wed May 20 13:11:44 1998 +++ new/src/include/libgrx.h Thu Sep 30 20:38:20 1999 @@ -16,6 +16,10 @@ # define __USE_MISC #endif
+#ifdef _AIX +#define _BIG_ENDIAN +#endif + #include <stdlib.h> #include <stdio.h> #include <string.h> diff -ur3 old/src/makefile.lnx new/src/makefile.lnx --- old/src/makefile.lnx Sun May 10 20:22:48 1998 +++ new/src/makefile.lnx Thu Sep 30 20:38:20 1999 @@ -8,12 +8,16 @@ INCDIR= -I. -I./include -I../include CCOPT += -DLFB_BY_NEAR_POINTER -pipe
+ifdef GRX_DEFAULT_FONT_PATH +CCOPT += -DGRX_DEFAULT_FONT_PATH=$(GRX_DEFAULT_FONT_PATH) +endif + ifndef DEBUG CCOPT += -fomit-frame-pointer endif
-GRX20SHli = ../lib/$(GRX_LIB_SUBDIR)/libgrx20.so -GRX20SHna = $(GRX20SHli).2.2.8 +GRX20SHli = ../lib/$(GRX_LIB_SUBDIR)/libgrx20.so.2 +GRX20SHna = $(GRX20SHli).3.0
GRX20ST = ../lib/$(GRX_LIB_SUBDIR)/libgrx20.a
diff -ur3 old/src/makefile.x11 new/src/makefile.x11 --- old/src/makefile.x11 Sun May 10 20:22:48 1998 +++ new/src/makefile.x11 Thu Sep 30 20:38:20 1999 @@ -9,11 +9,15 @@
INCDIR= -I. -I./include -I../include $(X11INCS)
-GRX20SHli = ../lib/$(GRX_LIB_SUBDIR)/libgrx20X.so -GRX20SHna = $(GRX20SHli).2.2.8 +GRX20SHli = ../lib/$(GRX_LIB_SUBDIR)/libgrx20X.so.2 +GRX20SHna = $(GRX20SHli).3.0
GRX20ST = ../lib/$(GRX_LIB_SUBDIR)/libgrx20X.a
+ifdef GRX_DEFAULT_FONT_PATH +CCOPT += -DGRX_DEFAULT_FONT_PATH=$(GRX_DEFAULT_FONT_PATH) +endif + ifdef SHARED CCOPT += -fPIC -D__SHARED__ endif @@ -57,6 +61,8 @@ O= $(STD_O) $(ADDON_O) \ fdrivers/fd_xwin.o \ fdrivers/ram24.o \ + fdrivers/ram32l.o \ + fdrivers/ram32h.o \ fonts/fdv_xwin.o \ mouse/xwininp.o \ mouse/xwinkeys.o \ diff -ur3 old/src/mouse/xwininp.c new/src/mouse/xwininp.c --- old/src/mouse/xwininp.c Mon May 18 11:32:24 1998 +++ new/src/mouse/xwininp.c Thu Sep 30 20:38:20 1999 @@ -21,6 +21,10 @@ #include "memfill.h" #include "mouse/input.h"
+#ifdef _AIX +#include <sys/select.h> +#endif + static int kbd_enabled = TRUE; static int kbd_lastmod = 0; static int mou_enabled = TRUE; diff -ur3 old/src/pattern/patfbox.c new/src/pattern/patfbox.c --- old/src/pattern/patfbox.c Tue Apr 28 21:30:54 1998 +++ new/src/pattern/patfbox.c Thu Sep 30 20:38:20 1999 @@ -18,6 +18,8 @@ mouse_block(CURC,x1,y1,x2,y2); width = x2 - x1 + 1; height = y2 - y1 + 1; + x1 += CURC->gc_xoffset; + y1 += CURC->gc_yoffset; if(!p->gp_ispixmap) while(--height >= 0) _GrFillPattern(x1,y1++,width,p); else { diff -ur3 old/src/utils/shiftscl.c new/src/utils/shiftscl.c --- old/src/utils/shiftscl.c Sun Apr 5 22:48:50 1998 +++ new/src/utils/shiftscl.c Thu Sep 30 20:38:20 1999 @@ -44,7 +44,7 @@ " movb %%ch,(%4) " : "=r" ((void *)s), "=r" ((void *)d), "=r" ((int)w) : "0" ((void *)s), "1" ((void *)d), "2" ((int)w), "c" ((int)shift) - : "ax", "cx" + : "ax" ); # elif defined(__TURBOC__) asm push ds ; @@ -98,7 +98,7 @@ " jne 1b " : "=r" ((void *)s), "=r" ((void *)d), "=r" ((int)w) : "0" ((void *)s), "1" ((void *)d), "2" ((int)w), "c" ((int)shift) - : "ax", "cx" + : "ax" ); # elif defined(__TURBOC__) asm push ds ; diff -ur3 old/src/vdrivers/vd_xwin.c new/src/vdrivers/vd_xwin.c --- old/src/vdrivers/vd_xwin.c Wed Apr 22 20:30:10 1998 +++ new/src/vdrivers/vd_xwin.c Thu Sep 30 20:38:20 1999 @@ -26,6 +26,7 @@ unsigned int _XGrColorOper; unsigned int _XGrDepth; unsigned int _XGrBitsPerPixel; +unsigned int _XGrScanlinePad;
unsigned long _XGrColorPlanes[8]; unsigned int _XGrColorNumPlanes; @@ -61,8 +62,6 @@ static int setmode(GrVideoMode *mp,int noclear) { char name[100], *window_name, *icon_name; - int nc; - char *cu; int res;
GRX_ENTER(); @@ -75,12 +74,7 @@
XResizeWindow (_XGrDisplay, _XGrWindow, mp->width, mp->height);
- cu = ""; - nc = 1 << mp->bpp; - if ((nc % 1024) == 0) nc >>= 10, cu = "K"; - if ((nc % 1024) == 0) nc >>= 10, cu = "M"; - - sprintf (name, "grx %dx%dx%d%s", mp->width, mp->height, nc, cu); + sprintf (name, "grx %dx%dx%d", mp->width, mp->height, mp->bpp); window_name = name; icon_name = name;
@@ -227,11 +221,14 @@ XSetWindowAttributes attr; unsigned long mask; Visual *visual; + XPixmapFormatValues *pfmt; + int pfmt_count; GrVideoMode *mp; - unsigned int depth, bpp; + unsigned int depth, bpp, pad; int private_colormap; int i, j, res;
+ GRX_ENTER(); res = FALSE; private_colormap = FALSE; @@ -373,27 +370,57 @@
grxwinext.frame = (char far *) _XGrWindow;
- bpp = depth; + pfmt = XListPixmapFormats (_XGrDisplay, &pfmt_count); + if (!pfmt || pfmt_count <= 0) { + XCloseDisplay (_XGrDisplay); + fprintf (stderr, "GRX init: cannot list pixmap formats\n"); + exit (1); + } + + bpp = 0; + pad = 0; + for (i = 0; i < pfmt_count; i++) { + if (pfmt[i].depth == depth) + { + bpp = pfmt[i].bits_per_pixel; + pad = pfmt[i].scanline_pad; + break; + } + } + XFree (pfmt); + if (!bpp) { + XCloseDisplay (_XGrDisplay); + fprintf (stderr, "GRX init: cannot find pixmap format\n"); + exit (1); + } + switch (depth) { case 1: grxwinext.mode = GR_frameXWIN1; break; case 4: grxwinext.mode = GR_frameXWIN4; break; case 8: grxwinext.mode = GR_frameXWIN8; break; - case 15: bpp++; + case 15: case 16: grxwinext.mode = GR_frameXWIN16; break; - case 24: grxwinext.mode = GR_frameXWIN24; break; + case 24: + switch (bpp) { + case 24: grxwinext.mode = GR_frameXWIN24; break; + case 32: grxwinext.mode = + (visual->red_mask & 0xff000000) ? GR_frameXWIN32H : GR_frameXWIN32L; break; + } + break; }
_XGrBitsPerPixel = bpp; + _XGrScanlinePad = pad;
/* fixed size modes */ for (mp = &modes[1]; mp < &modes[itemsof(modes)-1]; mp++) { mp->present = TRUE; - mp->bpp = depth; + mp->bpp = bpp; mp->lineoffset = (mp->width * bpp) / 8; } /* this is the variable size mode */ mp->present = FALSE; - mp->bpp = depth; + mp->bpp = bpp; mp->lineoffset = 0; res = TRUE; done: diff -ur3 old/src/vdrivers/vesa_pm.c new/src/vdrivers/vesa_pm.c --- old/src/vdrivers/vesa_pm.c Mon May 11 20:20:28 1998 +++ new/src/vdrivers/vesa_pm.c Thu Sep 30 20:50:52 1999 @@ -349,7 +349,7 @@ static INLINE void PM_banking(short BX, short DX) { __asm__ volatile ( " pushal \n" - " call %3 \n" + " call *%3 \n" " popal " : /* no output */ : "a" (0x4F05), "b" (BX), "d" (DX), @@ -362,7 +362,7 @@ " pushal \n" " movw %%ax, %%es \n" " movw $0x4f05, %%ax \n" - " call %3 \n" + " call *%3 \n" " popal " : /* no output */ : "a" (es), "b" (BX), "d" (DX), @@ -379,7 +379,7 @@ mov ax, 4f05h mov bx, myBX mov dx, myDX - call PM_banking_ptr + call *PM_banking_ptr popa } } @@ -393,7 +393,7 @@ mov ax, 4f05h mov bx, myBX mov dx, myDX - call PM_banking_ptr + call *PM_banking_ptr popa } } diff -ur3 old/test/keys.c new/test/keys.c --- old/test/keys.c Wed May 13 18:19:48 1998 +++ new/test/keys.c Thu Sep 30 20:38:20 1999 @@ -349,12 +349,12 @@ int ok;
/* need to initialize X11 drivers before using keyboard && mouse functions */ -#if (GRX_VERSION_API-0) >= 0x0229 - if ( GrGetLibrarySystem() == GRX_VERSION_GENERIC_X11) - GrSetMode(GR_320_200_graphics); -#elif (GRX_VERSION == GRX_VERSION_GENERIC_X11) +//#if (GRX_VERSION_API-0) >= 0x0229 +// if ( GrGetLibrarySystem() == GRX_VERSION_GENERIC_X11) +// GrSetMode(GR_320_200_graphics); +//#elif (GRX_VERSION == GRX_VERSION_GENERIC_X11) GrSetMode(GR_320_200_graphics); -#endif +//#endif
printf("\n\n Checking GrKey... style interface" "\n Type 3 spaces to quit the test\n\n");
----- Original Message ----- From: "Klaus Friis Østergaard" KFO@LASERTECH.DK To: grx@gnu.de Sent: Monday, April 17, 2000 21:44 Subject: compiling grx23 with 2.95.2
Hi,
I am trying to compile grx23 with the gnu gcc 2.95.2 compiler it fails.
I have changed the CC = gcc to CC = /usr/local/bin/gcc where I have my gcc-2.95.2 compiler along with GPC
I want to use GRX along with Gnu Pascal Version 19991030 which requeres gcc 2.95
this is the output when I run 'make -f makefile.lnx' the second time: make -C src STATIC=1 -f makefile.lnx make[1]: Entering directory `/usr/src/grx-2.3/src' /usr/local/bin/gcc -c -O6 -Wall -DLFB_BY_NEAR_POINTER -pipe -fomit-frame-pointer -I. -I./include -I../include -I../addons/print utils/shiftscl.c -o utils/shiftscl.o make[1]: Leaving directory `/usr/src/grx-2.3/src'
it leaves with messages about not valid asm set 2 register CREG in line 48 of shiftscl.c
can you help me?
Klaus F. Østergaard