glenn@extro.ucc.su.oz.au (Glenn Geers) (06/28/90)
Hi, This is my first source posting so if I've done anything wrong would someone be kind enough to tell me. The enclosed shar file contains various files needed to port GhostScript 1.4beta3 to Xenix/386. I haven't tried gs 1.3 but I think it still all should hold together. You also get a cheap BSD gettimeofday() for SYSV. Defining SYSV in the gs makefile did not seem to get rid of the calls to gettimeofday so I hacked one together. It's reasonable, but I woudln't use the microsecond count for anything critical - no it's not set to zero but to get the functionality of gettimeofday I've used three system calls -:) Anyway, you'll find an example of how to direct port i/o by raising the i/o privilege of a user task. This is a compile time option. The recommended compiler is gcc. As usual it's all covered by the GNU public license. So if your monitor melts it ain't my fault -:) Share and Enjoy, Glenn ---- Cut Here and unpack ---- #!/bin/sh # shar: Shell Archiver (v1.22) # # Run the following text with /bin/sh to create: # README.XENIX # bsdtime.h # gdevxenix.c # gdevxenix.h # gp_unix.pat # gtd.c # makefile.cc # makefile.gcc # if test -f README.XENIX; then echo "File README.XENIX exists"; else echo "x - extracting README.XENIX (Text)" sed 's/^X//' << 'SHAR_EOF' > README.XENIX && XThis is the README file for the netwide release of the Xenix VGA GhostScript Xdriver. X XThe fastest possible interpreter is made using gcc. I am using undocumented Xfeatures of Xenix to get high speed. Please read gdevxenix.h and #undef XUSEASM if you don't want to make your interpreter setuid 0. You should X#undef USEASM in any case if you are not using gcc. XPlease note that on SCO UNIX you don't need have gs setuid 0 to use the Xassembler code. This is because SCO UNIX uses the TSS bitmaps to check I/O Xprivilege. It doesn't just change the 386's status word. This stuff *is* Xdocumented in SCO UNIX 3.2. XOn Xenix, if you issue ioctl(fd, VGA_IOPRIVL, 1), you can effectively have Xyour way with all of the machine hardware which may be dangerous. X XI have not done all port accesses using assembler - the fill routine is Xfairly fast as is. I will implement it in assembler when I get the urge. XIf anyone out there does implement it in assembler would you please post Xme the result. X XIn order to get all this stuff to work you need GhostScript 1.4beta3. This is Xavailable by anonymous ftp from extro.ucc.su.oz.au (IP: 129.78.64.1). It is Xin the directory archive/gnu. I know of no other sites with this version Xavailable. I'm hoping that no major device interface changes occur between Xwhat I have and the official release. X XThere are a few things that need to be pointed out before you start compiling XGhostScript. X X0. Apply the patch X1. Copy bsdtime.h /usr/include/sys/bsdtime.h if you can. Otherwise edit Xgp_unix.c and make the relevant change. XType X [g]cc -O -c gtd.c X Xand stick gtd.o into /lib/386/Slibx.a if you can. Otherwise edit the chosen Xmakefile to include gtd.o as a required object. X X2. Use the makefile.[gcc,cc] distributed with these patches - it is broken just Xlike the others -:) Copy the relevant one to makefile. X3. type: X make gdevxenix.o X4. Hand compile gsline.c if you are using gcc - the optimiser fails on this. X gcc -DSYSV -c gsline.c X OR X make ansi2knr X ansi2knr gsline.c _z.c X cc -Ox -CSON -DSYSV -c _z.c (works ok) X rm _z.c X mv _z.o gsline.o X5. type X make xenix.dev <- this should happen automatically: the makefile is Xbroken. X6. (at last) type X make X XTry gs golfer.ps. X XNote that GNU C is the recommended compiler. I have the 2.2 DS and I can't Xget GhostScript to compile using it. Would someone with a later compiler Xhave a shot and let me know the result? The problems is in gsmain.c and Xhas to do with pointers to functions. I could fix it but I don't really want Xto touch GhostScript proper if I can help it. X X Thanks, X Glenn X Xglenn@extro.ucc.su.oz.au SHAR_EOF chmod 0644 README.XENIX || echo "restore of README.XENIX fails" set `wc -c README.XENIX`;Sum=$1 if test "$Sum" != "2596" then echo original size 2596, current size $Sum;fi fi if test -f bsdtime.h; then echo "File bsdtime.h exists"; else echo "x - extracting bsdtime.h (Text)" sed 's/^X//' << 'SHAR_EOF' > bsdtime.h && X/* X** Minimal BSD sys/time.h clone X*/ X X/* X * Structure returned by gettimeofday(2) system call, X * and used in other calls. X */ X Xstruct timeval { X long tv_sec; /* seconds */ X long tv_usec; /* and microseconds */ X}; X Xstruct timezone { X int tz_minuteswest; /* minutes west of Greenwich */ X int tz_dsttime; /* type of dst correction */ X}; SHAR_EOF chmod 0644 bsdtime.h || echo "restore of bsdtime.h fails" set `wc -c bsdtime.h`;Sum=$1 if test "$Sum" != "337" then echo original size 337, current size $Sum;fi fi if test -f gdevxenix.c; then echo "File gdevxenix.c exists"; else echo "x - extracting gdevxenix.c (Text)" sed 's/^X//' << 'SHAR_EOF' > gdevxenix.c && Xstatic char rcsid[] = "$Header: gdevxenix.c,v 1.4 90/06/24 12:18:17 root Exp $"; X X/* Copyright (C) 1989, 1990 Aladdin Enterprises. All rights reserved. X Distributed by Free Software Foundation, Inc. X XThis file is part of Ghostscript. X XGhostscript is distributed in the hope that it will be useful, but XWITHOUT ANY WARRANTY. No author or distributor accepts responsibility Xto anyone for the consequences of using it or for whether it serves any Xparticular purpose or works at all, unless he says so in writing. Refer Xto the Ghostscript General Public License for full details. X XEveryone is granted permission to copy, modify and redistribute XGhostscript, but only under the conditions described in the Ghostscript XGeneral Public License. A copy of this license is supposed to have been Xgiven to you along with Ghostscript so you can know your rights and Xresponsibilities. It should be in a file named COPYING. Among other Xthings, the copyright notice and this notice must be preserved on all Xcopies. */ X X/* gdevxenix.c */ X X/* Ghostscript driver for Xenix/386 with VGA or EGA */ X X#include "gdevxenix.h" X X/* See gxdevice.h for the definitions of the procedures. */ X Xtypedef struct gx_device_s gx_device; X Xint xenix_open(P1(gx_device *)); X Xint xenix_close(P1(gx_device *)); X Xgx_color_index xenix_map_rgb_color(P4(gx_device *, ushort, ushort, ushort)); X Xint xenix_map_color_rgb(P3(gx_device *, gx_color_index, ushort *)); X Xint xenix_fill_rectangle(P6(gx_device *, int, int, int, int, gx_color_index)); X Xint xenix_tile_rectangle(P8(gx_device *, gx_bitmap *, int, int, int, int, gx_color_index, gx_color_index)); X Xint xenix_copy_mono(P10(gx_device *, unsigned char *, int, int, int, int, int, int, gx_color_index, gx_color_index)); X Xint xenix_copy_color(P8(gx_device *, unsigned char *, int, int, int, int, int, int)); X Xint xenix_draw_line(P6(gx_device *, int, int, int, int, gx_color_index)); X X/* The device descriptor */ Xprivate gx_device_procs xenix_procs = { X xenix_open, X gx_default_get_initial_matrix, X gx_default_sync_output, X gx_default_output_page, X xenix_close, X xenix_map_rgb_color, X xenix_map_color_rgb, X xenix_fill_rectangle, X xenix_tile_rectangle, X xenix_copy_mono, X xenix_copy_color, X xenix_draw_line, X gx_default_fill_trapezoid, X gx_default_tile_trapezoid X}; X X#if defined(VGADEV) X#define aspect_ratio 1.0 X#else X#define aspect_ratio (14.0/11.0) X#endif X Xgx_device gs_xenix_device = { X sizeof(gx_device), X &xenix_procs, X "xenix-vga", X NX, NY, X (NY*aspect_ratio)/11.0, NY/11.0, X 1, X 2, X 4, X 0 /* not open yet */ X}; X X X/* Open the driver for graphics mode */ Xint Xxenix_open(gx_device *dev) X{ X#if defined(VGADEV) || defined(EGASIM) X if ((devfd = open("/dev/vga", O_WRONLY)) == -1) { X#else X if ((devfd = open("/dev/ega", O_WRONLY)) == -1) { X#endif X fprintf(stderr, "Cannot open device - FATAL\n"); X exit(1); X } X X#if defined(VGADEV) || defined(EGASIM) X ioctl(devfd, SWAPVGA, 0); /* select vga */ X#else X ioctl(devfd, SWAPEGA, 0); /* select ega */ X#endif X X#if defined(USEASM) X setpriv(RAISEPRIV); X#endif X X#if defined(VGADEV) X ioctl(devfd, SW_VGA12, 0); /* Switch to graphics mode */ X#else X ioctl(devfd, SW_ENH_CG640); /* Switch to graphics mode */ X#endif X X#if defined(VGADEV) || defined(EGASIM) X vidmem = (char *)ioctl(devfd, MAPVGA, 0); /* map in video ram */ X#else X vidmem = (char *)ioctl(devfd, MAPEGA, 0); /* map in video ram */ X#endif X X return 0; X} X X X/* Close the driver */ Xint Xxenix_close(gx_device *dev) X{ X#if defined(USEASM) X setpriv(REDUCPRIV); X#endif X X#if defined(VGADEV) || defined(EGASIM) X ioctl(devfd, SW_VGA80x25, 0); X#else X ioctl(devfd, SW_ENHC80x25, 0); X#endif X close(devfd); X return 0; X} X X/* Map a r-g-b color to the 16 colors available with an EGA/VGA video card. */ X/* r, g, b are between 0 and 2. */ Xprivate char rgb_color[3][3][3] = X { { { BLACK, BLUE, LIGHTBLUE }, X { GREEN, CYAN, LIGHTCYAN }, X { LIGHTGREEN, LIGHTCYAN, LIGHTCYAN } }, X { { RED, MAGENTA, LIGHTMAGENTA }, X { BROWN, LIGHTGRAY, LIGHTBLUE }, X { YELLOW, YELLOW, WHITE } }, X { { LIGHTRED, LIGHTMAGENTA, LIGHTMAGENTA }, X { YELLOW, YELLOW, LIGHTMAGENTA }, X { YELLOW, YELLOW, WHITE } } X }; X Xgx_color_index Xxenix_map_rgb_color(gx_device *dev, ushort r, ushort g, ushort b) X{ X if ( dev->has_color ) X { return (gx_color_index)rgb_color[r][g][b]; X } X else X { if ( r > 0 || g > 0 || b > 0 ) X return (gx_color_index)WHITE; X else X return (gx_color_index)BLACK; X } X} X X X/* Map a color code to r-g-b. Surprisingly enough, this is algorithmic. */ Xint Xxenix_map_color_rgb(gx_device *dev, gx_color_index color, ushort *prgb) X{ int on = (color & 8 ? 2 : 1); X prgb[0] = (color & 4 ? on : 0); X prgb[1] = (color & 2 ? on : 0); X prgb[2] = (color & 1 ? on : 0); X return 0; X} X X X/* Copy a monochrome bitmap. The colors are given explicitly. */ X/* Color = gx_no_color_index means transparent (no effect on the image). */ Xint Xxenix_copy_mono(gx_device *dev, byte *base, int sourcex, int raster, X int x, int y, int w, int h, X gx_color_index zero, gx_color_index one) X{ byte *ptr_line = base + (sourcex >> 3); X int left_bit = 0x80 >> (sourcex & 7); X int dest_y = y, end_x = x + w; X int invert = 0; X int color; X X if ( zero == gx_no_color_index ) X { if ( one == gx_no_color_index ) return 0; X color = (int)one; X } X else X { if ( one == gx_no_color_index ) X { color = (int)zero; X invert = -1; X } X else X { /* Pre-clear the rectangle to zero */ X fillrect(x, y, x + w - 1, y + h - 1,0,0x00); X color = (int)one; X } X } X X setcolor(color); X X while ( h-- ) /* for each line */ X { byte *ptr_source = ptr_line; X register int dest_x = x; X register int bit = left_bit; X while ( dest_x < end_x ) /* for each bit in the line */ X { if ( (*ptr_source ^ invert) & bit ) X monopix(dest_x, dest_y); X dest_x++; X if ( (bit >>= 1) == 0 ) X bit = 0x80, ptr_source++; X } X dest_y++; X ptr_line += raster; X } X return 0; X} X X X/* Copy a color pixel map. This is just like a bitmap, except that */ X/* each pixel takes 4 bits instead of 1 when device driver has color. */ Xint Xxenix_copy_color(gx_device *dev, byte *base, int sourcex, int raster, X int x, int y, int w, int h) X{ X /* color device, four bits per pixel */ X byte *line = base + (sourcex >> 1); X int dest_y = y, end_x = x + w; X X if ( w <= 0 ) return 0; X while ( h-- ) /* for each line */ X { byte *source = line; X register int dest_x = x; X if ( sourcex & 1 ) /* odd nibble first */ X { int color = *source++ & 0xf; X colorpix(dest_x, dest_y, color); X dest_x++; X } X /* Now do full bytes */ X while ( dest_x < end_x ) X { int color = *source >> 4; X colorpix(dest_x, dest_y, color); X dest_x++; X if ( dest_x < end_x ) X { color = *source++ & 0xf; X colorpix(dest_x, dest_y, color); X dest_x++; X } X } X dest_y++; X line += raster; X } X return 0; X} X X X/* Fill a rectangle. */ Xint Xxenix_fill_rectangle(gx_device *dev, int x, int y, int w, int h, X gx_color_index color) X{ X fillrect(x, y, x + w - 1, y + h - 1, color, 0xff); X return 0; X} X X X/* Tile a rectangle. If neither color is transparent, */ X/* pre-clear the rectangle to color0 and just tile with color1. */ X/* This is faster because of how xenix_copy_mono is implemented. */ Xint Xxenix_tile_rectangle(gx_device *dev, gx_bitmap *tile, X int x, int y, int w, int h, gx_color_index czero, gx_color_index cone) X{ if ( czero != gx_no_color_index && cone != gx_no_color_index ) X { xenix_fill_rectangle(dev, x, y, w, h, czero); X czero = gx_no_color_index; X } X return gx_default_tile_rectangle(dev, tile, x, y, w, h, czero, cone); X} X X X/* Draw a line */ Xint Xxenix_draw_line(gx_device *dev, int x0, int y0, int x1, int y1, X gx_color_index color) X{ setcolor((int)color); X line(x0, y0, x1, y1); X return 0; X} SHAR_EOF chmod 0644 gdevxenix.c || echo "restore of gdevxenix.c fails" set `wc -c gdevxenix.c`;Sum=$1 if test "$Sum" != "7779" then echo original size 7779, current size $Sum;fi fi if test -f gdevxenix.h; then echo "File gdevxenix.h exists"; else echo "x - extracting gdevxenix.h (Text)" sed 's/^X//' << 'SHAR_EOF' > gdevxenix.h && X/* $Header: gdevxenix.h,v 1.6 90/06/27 17:40:36 root Exp $ */ X X/* Copyright (C) 1989, 1990 Aladdin Enterprises. All rights reserved. X Distributed by Free Software Foundation, Inc. X XThis file is part of Ghostscript. X XGhostscript is distributed in the hope that it will be useful, but XWITHOUT ANY WARRANTY. No author or distributor accepts responsibility Xto anyone for the consequences of using it or for whether it serves any Xparticular purpose or works at all, unless he says so in writing. Refer Xto the Ghostscript General Public License for full details. X XEveryone is granted permission to copy, modify and redistribute XGhostscript, but only under the conditions described in the Ghostscript XGeneral Public License. A copy of this license is supposed to have been Xgiven to you along with Ghostscript so you can know your rights and Xresponsibilities. It should be in a file named COPYING. Among other Xthings, the copyright notice and this notice must be preserved on all Xcopies. */ X X/* gdevxenix.h */ X X#include "gx.h" X#include "gsmatrix.h" /* for gxdevice.h */ X#include "gxbitmap.h" X#include "gxdevice.h" X X/* VGA/EGA and Xenix specific */ X X#include <fcntl.h> /* for O_WRONLY */ X#include <sys/machdep.h> /* adapter specifics */ X X/* Colours */ X X#define BLACK 0 X#define BLUE 1 X#define GREEN 2 X#define CYAN 3 X#define RED 4 X#define MAGENTA 5 X#define BROWN 6 X#define LIGHTGRAY 7 X#define DARKGRAY 8 X#define LIGHTBLUE 9 X#define LIGHTGREEN 10 X#define LIGHTCYAN 11 X#define LIGHTRED 12 X#define LIGHTMAGENTA 13 X#define YELLOW 14 X#define WHITE 15 X X/* Device specifics */ X X#define VGADEV /* udefine this for EGA */ X#undef EGASIM /* define this to simulate an EGA on a VGA */ X X/* X** Define the next macro if you want real speed. X** Only do so if you are using GNU C X** For the pivelege stuff to work under Xenix you have to invoke X** the program as root or make it setuid 0 X** On SCO UNIX the program does not have to be setuid 0 X*/ X X#define USEASM X X#define REDUCPRIV 0 X#define RAISEPRIV 1 X X#define NX 640 X#if defined(VGADEV) X#define NY 480 X#else X#define NY 350 X#endif X X#define GCTL 0x3ce X#define SEQCTL 0x3c4 X X#if defined(__GNUC__) X#define INLINE inline X#else X#define INLINE X#endif X X/* X* This is only a macro because its easier X* to substitute different routines X*/ X#define VGAREGOUT2(a) outp2(a); X Xprivate char *vidmem; /* Pointer to virtual address of start of video ram */ Xprivate int devfd; /* fd for /dev/vga */ Xprivate unsigned char mask; X Xprivate void INLINE outp2(P1(short)); Xprivate void INLINE setcolor(P1(unsigned char)); Xprivate void INLINE vgaout(P3(unsigned short, unsigned char, unsigned char)); Xprivate int INLINE line(P4(int, int, int, int)); Xprivate void INLINE monopix(P2(int, int)); Xprivate void INLINE colorpix(P3(int, int, unsigned char)); Xprivate void INLINE fillrect(P6(int,int,int,int,unsigned char,unsigned char)); Xprivate void INLINE setpriv(P1(int)); X Xprivate void INLINE Xsetcolor(unsigned char color) X{ X VGAREGOUT2(5); X VGAREGOUT2(color<<8); X VGAREGOUT2(0x0f01); X} X Xprivate int INLINE Xline(int x1,int y1,int x2,int y2) X{ X int width,deltax,deltay; X unsigned int xpos,ypos,i; X int xinc,yinc,error; X X xpos = x1; X ypos = y1; X X deltax = x2 - x1; X deltay = y2 - y1; X X if (deltax < 0) { X deltax = -deltax; X xinc = -1; X } X else X xinc = 1; X X if (deltay < 0) { X deltay = -deltay; X yinc = -1; X } X else X yinc = 1; X X if (deltax == 0) { X deltay++; X while(deltay>0) { X monopix(x1,ypos); X ypos += yinc; X deltay-- ; X } X return; X } X X if (deltay == 0) { X deltax++; X while(deltax>0) { X monopix(xpos,y1); X xpos += xinc; X deltax-- ; X } X return; X } X X if (deltax > deltay) { X deltay <<= 1; X error = deltay - deltax; X deltax = deltay - (deltax << 1); X while (xpos != x2) { X monopix(xpos,ypos); X xpos += xinc; X if (error > 0) { X ypos += yinc; X error += deltax; X } X else X error += deltay; X } X monopix(xpos,ypos); X return; X } X X deltax <<= 1; X error = deltax - deltay; X deltay = deltax - ( deltay << 1); X while (ypos != y2) { X monopix(xpos,ypos); X ypos += yinc; X if (error > 0) { X xpos += xinc; X error += deltay; X } X else X error += deltax; X } X monopix(xpos,ypos); X} X X/* colour each pixel separately */ Xprivate void INLINE Xcolorpix(int column, int row, unsigned char color) X{ X unsigned int byte; X X mask = 128 >> (column & 7); X byte = row << 6; X byte += row << 4; X byte += column >> 3; X X VGAREGOUT2(5); X VGAREGOUT2(color<<8); X VGAREGOUT2(0x0f01); X VGAREGOUT2(mask<<8 | 8); X X vidmem[byte] |= mask; X} X X/* use setcolor to set the pixel color before drawing */ Xprivate void INLINE Xmonopix(int col, int row) X{ X unsigned int byte; X X mask = 128 >> (col & 7); X X byte = row << 6; X byte += row << 4; X byte += col >> 3; X X VGAREGOUT2(mask<<8 | 8); X vidmem[byte] |= mask; X} X Xprivate void INLINE Xfillrect(int x,int y,int x1,int y1,unsigned char color,unsigned char pattern) X{ X unsigned int byte; X unsigned char bit, bit1; X int i, j, k; X X setcolor(color); X X bit = 0xff >> (x & 7); X x >>= 3; X X bit1 = 0x7f >> (x1 & 7); X bit1 ^= 0xff; X x1 >>= 3; X X vgaout(GCTL,8,0xff); X vgaout(SEQCTL,2,0xff); X X for(j=y; j<y1+1; j++) { X for(i=x+1;i<x1;i++) { X byte = j << 6; X byte += j << 4; X byte += i; X vidmem[byte] &= 0x00; X } X } X X vgaout(GCTL,8,pattern); X vgaout(SEQCTL,2,color & 15); X X for(j=y; j<y1+1; j++) { X for(i=x+1; i<x1; i++) { X byte = j << 6; X byte += j << 4; X byte += i; X vidmem[byte] |= 0xff; X } X } X X vgaout(GCTL,8,bit); X vgaout(SEQCTL,2,0xff); X X for(j=y; j<y1+1; j++) { X byte = j << 6; X byte += j << 4; X byte += x; X vidmem[byte] &= (bit^0xff); X } X X bit &=pattern; X X vgaout(GCTL,8,bit); X vgaout(SEQCTL,2,color & 15); X X for(j=y; j<y1+1; j++) { X byte = j << 6; X byte += j << 4; X byte += x; X vidmem[byte] |= 0xff; X } X X vgaout(GCTL,8,bit1); X vgaout(SEQCTL,2,0xff); X X for(j=y;j<y1+1;j++) { X byte = j << 6; X byte += j << 4; X byte += x1; X vidmem[byte] &= (bit1^0xff); X } X X bit1 &= pattern; X X vgaout(GCTL,8,bit1); X vgaout(SEQCTL,2,color & 15); X X for(j=y; j<y1+1; j++) { X byte = j << 6; X byte += j << 4; X byte += x1; X vidmem[byte] |= 0xff; X } X X vgaout(SEQCTL,2,0xff); X vgaout(GCTL,3,0); X vgaout(GCTL,8,0xff); X} X Xprivate void INLINE Xvgaout(unsigned short port,unsigned char index,unsigned char data) X{ X struct port_io_arg op; X X op.args[1].dir = op.args[0].dir = OUT_ON_PORT; X op.args[0].port = port; X op.args[0].data = index & 0xff; X X op.args[1].port = port+1; X op.args[1].data = data & 0xff; X X op.args[2].port = op.args[3].port = 0x00; X X ioctl(devfd, VGAIO, &op); X} X Xvoid INLINE Xoutp2(short data) X{ X#if !defined(USEASM) X struct port_io_arg op; X X op.args[1].dir = op.args[0].dir = OUT_ON_PORT; X X op.args[0].port = GCTL; X op.args[0].data = data&0xff; X X op.args[1].port = GCTL+1; X op.args[1].data = (data&0xff00)>>8; X X op.args[2].port = op.args[3].port = 0x00; X X ioctl(devfd, VGAIO, &op); X#else X asm("movw 8(%ebp),%cx"); X asm("movw %cx,8(%ebp)"); X asm("movw %cx,%dx"); X asm("andw $255,%dx"); X asm("movswl %dx,%eax"); X X asm("movswl 8(%ebp),%ecx"); X asm("andl $65280,%ecx"); X asm("sarl $8,%ecx"); X X asm("mov $0x03ce, %dx"); X asm("out %al, %dx"); X asm("inc %dx"); X asm("mov %cl, %al"); X asm("out %al, %dx"); X#endif X} X Xvoid INLINE Xsetpriv(int priv) X{ X if (ioctl(devfd, VGA_IOPRIVL, priv) == -1) { X xenix_close(); X fprintf(stderr, "Cannot set privelege level\n"); X exit(1); X } X} SHAR_EOF chmod 0644 gdevxenix.h || echo "restore of gdevxenix.h fails" set `wc -c gdevxenix.h`;Sum=$1 if test "$Sum" != "7924" then echo original size 7924, current size $Sum;fi fi if test -f gp_unix.pat; then echo "File gp_unix.pat exists"; else echo "x - extracting gp_unix.pat (Text)" sed 's/^X//' << 'SHAR_EOF' > gp_unix.pat && X*** ../orig/gp_unix.c Fri Jan 26 05:31:20 1990 X--- gp_unix.c Sun Jun 17 11:43:15 1990 X*************** X*** 20,27 **** X /* gp_unix.c */ X /* Unix-specific routines for Ghostscript */ X #include "gx.h" X! #include <sys/time.h> X! #include <sys/resource.h> X X /* Do platform-dependent initialization */ X void X--- 20,28 ---- X /* gp_unix.c */ X /* Unix-specific routines for Ghostscript */ X #include "gx.h" X! #include <sys/bsdtime.h> X! /* #include "bsdtime.h" */ X! #include <time.h> X X /* Do platform-dependent initialization */ X void SHAR_EOF chmod 0644 gp_unix.pat || echo "restore of gp_unix.pat fails" set `wc -c gp_unix.pat`;Sum=$1 if test "$Sum" != "536" then echo original size 536, current size $Sum;fi fi if test -f gtd.c; then echo "File gtd.c exists"; else echo "x - extracting gtd.c (Text)" sed 's/^X//' << 'SHAR_EOF' > gtd.c && Xstatic char rcsid[] = "$Header: gtd.c,v 1.3 90/04/01 19:56:14 glenn Exp $"; X X/* X** Approximation of BSD gettimeofday(2) for Sys V (Xenix at least) X** Should work on a 286 - I think I've got all the casts right! X** D. Glenn Geers 2/90 X*/ X X#include <sys/types.h> X#include <sys/timeb.h> X#include <sys/bsdtime.h> X/* #include "bsdtime.h" */ X#include <time.h> X#include <errno.h> X Xextern int errno; X Xint Xgettimeofday(tp, tzp) Xstruct timeval *tp; Xstruct timezone *tzp; X{ X long clock; X struct timeb *now; X struct tm *localnow; X X now = (struct timeb *)malloc(sizeof(struct timeb)); X localnow = (struct tm *)malloc(sizeof(struct tm)); X X clock = time(0); X localnow = localtime(&clock); X X ftime(now); X X/* Shouldn't fail - just for completeness and in case ... */ X if (errno == EFAULT) { X errno = EFAULT; /*must set since EFAULT was set for this call */ X return(-1); X } X X if (tzp != (struct timezone *)0) { X tzp->tz_minuteswest = (int)(localnow->tm_tzadj/60); X tzp->tz_dsttime = (int)(localnow->tm_isdst); X } X X tp->tv_sec = (long)(now->time); X tp->tv_usec = (long)(1000 * (long)(now->millitm)); X X return(0); X} SHAR_EOF chmod 0644 gtd.c || echo "restore of gtd.c fails" set `wc -c gtd.c`;Sum=$1 if test "$Sum" != "1100" then echo original size 1100, current size $Sum;fi fi if test -f makefile.cc; then echo "File makefile.cc exists"; else echo "x - extracting makefile.cc (Text)" sed 's/^X//' << 'SHAR_EOF' > makefile.cc && X# Copyright (C) 1989, 1990 Aladdin Enterprises. All rights reserved. X# Distributed by Free Software Foundation, Inc. X# X# This file is part of Ghostscript. X# X# Ghostscript is distributed in the hope that it will be useful, but X# WITHOUT ANY WARRANTY. No author or distributor accepts responsibility X# to anyone for the consequences of using it or for whether it serves any X# particular purpose or works at all, unless he says so in writing. Refer X# to the Ghostscript General Public License for full details. X# X# Everyone is granted permission to copy, modify and redistribute X# Ghostscript, but only under the conditions described in the Ghostscript X# General Public License. A copy of this license is supposed to have been X# given to you along with Ghostscript so you can know your rights and X# responsibilities. It should be in a file named COPYING. Among other X# things, the copyright notice and this notice must be preserved on all X# copies. X X# makefile for Ghostscript, Unix/gcc/xenix configuration. X X# ------------------------------- Options ------------------------------- # X X####### The following are the only parts of the file you should need to edit. X X# ------ Generic options ------ # X X# Choose the device(s) to include. See gdevs.mak for details. X XDEVICES=xenix X X# Choose generic configuration options. X X# -DDEBUG X# includes debugging features (-Z switch) in the code. X# Code runs substantially slower even if no debugging switches X# are set. X# -DNOPRIVATE X# makes private (static) procedures and variables public, X# so they are visible to the debugger and profiler. X# No execution time or space penalty. X XGENOPT= -Ox -CSON X X# ------ Platform-specific options ------ # X X# Define the name of the C compiler. X XCC=gcc X X# Define the other compilation flags. X# Add -DBSD4_2 for 4.2bsd systems. X# Add -DSYSV for System V. X# We don't include -ansi, because this gets in the way of the platform- X# specific stuff that <math.h> typically needs. X# If you are running on SunOS 4.0.x, you must add a -D for the machine X# type, or /usr/include/sys/ieeefp.h will fail to define X# fp_direction_type, and so <math.h> won't pass the compiler, and so X# zarith.c and many other files won't compile. The right -D symbol for X# the Sun-4 and SparcStation is -Dsparc; for the Sun-3, it is mc68000. X XCFLAGS= -O -DSYSV -fstrength-reduce -finline-functions X X# Define platform flags for ld. X# Most Unix systems accept -X, but some don't. X# Sun OS4.n may need -Bstatic. X XLDPLAT= X X# ---------------------------- End of options --------------------------- # X X# Define the name of the makefile -- used in dependencies. X XMAKEFILE=unix-gcc.mak X X# Define the extensions for the object and executable files. X XOBJ=o XXE= X X# Define the ANSI-to-K&R dependency. (gcc accepts ANSI syntax.) X XAK= ansi2knr X X# Define the compilation rules. X XCCFLAGS=$(GENOPT) $(CFLAGS) X X.c.o: X -ansi2knr $*.c _temp_.c X $(CC) $(CCFLAGS) -c _temp_.c X mv _temp_.o $*.o X XCCNA=./ccgs "$(CC) $(CCFLAGS)" _temp_.c X X# --------------------------- Generic makefile ---------------------------- # X X# The remainder of the makefile (ghost.mak, gdevs.mak, and unixtail.mak) X# is generic. tar_gs concatenates all these together. X# Copyright (C) 1989, 1990 Aladdin Enterprises. All rights reserved. X# Distributed by Free Software Foundation, Inc. X# X# This file is part of Ghostscript. X# X# Ghostscript is distributed in the hope that it will be useful, but X# WITHOUT ANY WARRANTY. No author or distributor accepts responsibility X# to anyone for the consequences of using it or for whether it serves any X# particular purpose or works at all, unless he says so in writing. Refer X# to the Ghostscript General Public License for full details. X# X# Everyone is granted permission to copy, modify and redistribute X# Ghostscript, but only under the conditions described in the Ghostscript X# General Public License. A copy of this license is supposed to have been X# given to you along with Ghostscript so you can know your rights and X# responsibilities. It should be in a file named COPYING. Among other X# things, the copyright notice and this notice must be preserved on all X# copies. X X# Generic makefile for Ghostscript. X# The platform-specific makefiles 'include' this file. X# They define the following symbols: X# XE - the extension for executable files (e.g., null or .exe). X# OBJ - the extension for relocatable object files (e.g., o or obj). X# CCNA - the non-ANSI C invocation for files that on some platforms X# include in-line assembly code or other non-standard X# constructs. Currently this is needed on every file that X# includes sstorei.h. X# AK - if source files must be converted from ANSI to K&R syntax, X# this is ansi2knr$(XE); if not, it is null. X Xdefault: gs$(XE) X Xtest: gt$(XE) X Xclean: X rm -f *.$(OBJ) *.a core X rm -f _temp_.* *.dev libc*.tl *.map gdevs.h gdevs.tl X rm -f ansi2knr$(XE) X rm -f gs$(XE) gs.sym X Xansi2knr$(XE): X cc -o ansi2knr$(XE) -O ansi2knr.c X X# Note: Unix uses malloc.h and memory.h; X# Turbo C uses alloc.h, stdlib.h, and mem.h. X# 4.2bsd uses strings.h; other systems use string.h. X# gcc on VMS doesn't have a math.h. X# We handle this by using local include files called X# malloc_.h, math_.h, memory_.h, and string_.h X# that perform appropriate indirection. X X# -------------------------------- Library -------------------------------- # X XGX=$(AK) std.h gx.h XGXERR=$(GX) gserrors.h X X# High-level facilities X Xgschar.$(OBJ): gschar.c $(GXERR) gxfixed.h gxmatrix.h gzdevice.h gxdevmem.h gxfont.h gxchar.h gzpath.h gzcolor.h gzstate.h X Xgscolor.$(OBJ): gscolor.c $(GXERR) gxfixed.h gxmatrix.h gxdevice.h gzstate.h gzcolor.h gzhalfto.h X Xgscoord.$(OBJ): gscoord.c $(GXERR) gxfixed.h gxmatrix.h gzdevice.h gzstate.h gscoord.h X Xgsdevice.$(OBJ): gsdevice.c $(GXERR) gxfixed.h gxmatrix.h gxbitmap.h gxdevmem.h gzstate.h gzdevice.h X Xgsfile.$(OBJ): gsfile.c $(GXERR) gsmatrix.h gxdevice.h gxdevmem.h X Xgsfont.$(OBJ): gsfont.c $(GXERR) gxdevice.h gxfixed.h gxmatrix.h gxfont.h gzstate.h X Xgsimage.$(OBJ): gsimage.c $(GXERR) gxfixed.h gxmatrix.h gspaint.h gzcolor.h gzdevice.h gzpath.h gzstate.h gximage.h X Xgsim2out.$(OBJ): gsim2out.c $(GXERR) X Xgsline.$(OBJ): gsline.c $(GXERR) gxfixed.h gxmatrix.h gzstate.h gzline.h X Xgsmatrix.$(OBJ): gsmatrix.c $(GXERR) gxfixed.h gxmatrix.h X Xgsmisc.$(OBJ): gsmisc.c $(GX) X Xgspaint.$(OBJ): gspaint.c $(GX) gxfixed.h gxmatrix.h gspaint.h gzpath.h gzstate.h gzdevice.h gximage.h X Xgspath.$(OBJ): gspath.c $(GXERR) gxfixed.h gxmatrix.h gxpath.h gzstate.h X Xgspath2.$(OBJ): gspath2.c $(GXERR) gspath.h gxfixed.h gxmatrix.h gzstate.h gzpath.h gzdevice.h X Xgsstate.$(OBJ): gsstate.c $(GXERR) gxfixed.h gxmatrix.h gzstate.h gzcolor.h gzdevice.h gzhalfto.h gzline.h gzpath.h X X# Low-level facilities X Xgxcache.$(OBJ): gxcache.c $(GX) gserrors.h gxfixed.h gxmatrix.h gspaint.h gzdevice.h gzcolor.h gxdevmem.h gxfont.h gxchar.h gzstate.h gzpath.h X Xgxcolor.$(OBJ): gxcolor.c $(GX) gxfixed.h gxmatrix.h gxdevice.h gzcolor.h gzhalfto.h X Xgxdraw.$(OBJ): gxdraw.c $(GX) gxfixed.h gxmatrix.h gxbitmap.h gzcolor.h gzdevice.h gzstate.h X Xgxfill.$(OBJ): gxfill.c $(GXERR) gxfixed.h gxmatrix.h gxdevice.h gzcolor.h gzpath.h gzstate.h X Xgxht.$(OBJ): gxht.c $(GXERR) gxfixed.h gxmatrix.h gxbitmap.h gzstate.h gzcolor.h gzdevice.h gzhalfto.h X Xgxpath.$(OBJ): gxpath.c $(GXERR) gxfixed.h gzpath.h X Xgxpath2.$(OBJ): gxpath2.c $(GXERR) gxfixed.h gzpath.h X Xgxstroke.$(OBJ): gxstroke.c $(GXERR) gxfixed.h gxmatrix.h gzstate.h gzcolor.h gzdevice.h gzline.h gzpath.h X X# The "memory" device X Xgdevmem.$(OBJ): gdevmem.c $(AK) gs.h gxbitmap.h gsmatrix.h gxdevice.h gxdevmem.h X $(CCNA) gdevmem.c X X# Files dependent on the set of installed devices. X# Generating gdevs.h also generates gdevs.tl. X Xgdevs.h: gdevs.mak $(MAKEFILE) X gsconfig $(DEVICES) X Xgdevs.$(OBJ): gdevs.c $(AK) gdevs.h X X# On Unix, we pre-link all of the library except the back end. X# On MS-DOS, we have to do the whole thing at once. X XLIB=gschar.$(OBJ) gscolor.$(OBJ) gscoord.$(OBJ) gsdevice.$(OBJ) \ X gsfile.$(OBJ) gsfont.$(OBJ) gsimage.$(OBJ) gsim2out.$(OBJ) \ X gsline.$(OBJ) gsmatrix.$(OBJ) gsmisc.$(OBJ) \ X gspaint.$(OBJ) gspath.$(OBJ) gspath2.$(OBJ) gsstate.$(OBJ) \ X gxcache.$(OBJ) gxcolor.$(OBJ) gxdraw.$(OBJ) gxfill.$(OBJ) \ X gxht.$(OBJ) gxpath.$(OBJ) gxpath2.$(OBJ) gxstroke.$(OBJ) \ X gdevmem.$(OBJ) gdevs.$(OBJ) X X# ------------------------------ Interpreter ------------------------------ # X X# Non-graphics utilities X XGH=$(AK) ghost.h X Xialloc.$(OBJ): ialloc.c $(AK) std.h alloc.h X Xidebug.$(OBJ): idebug.c $(GH) name.h X Xidict.$(OBJ): idict.c $(GH) alloc.h errors.h name.h store.h dict.h X Xiinit.$(OBJ): iinit.c $(GH) dict.h oper.h store.h X Xiname.$(OBJ): iname.c $(GH) alloc.h errors.h name.h store.h X Xinterp.$(OBJ): interp.c $(GH) errors.h name.h dict.h oper.h store.h sstorei.h stream.h X $(CCNA) interp.c X Xiscan.$(OBJ): iscan.c $(GH) alloc.h dict.h errors.h store.h stream.h X Xiutil.$(OBJ): iutil.c $(GH) errors.h alloc.h store.h gsmatrix.h gxdevice.h gzcolor.h X Xstream.$(OBJ): stream.c $(AK) std.h stream.h X X# Non-graphics operators X XOP=$(GH) errors.h oper.h X Xzarith.$(OBJ): zarith.c $(OP) store.h X Xzarray.$(OBJ): zarray.c $(OP) alloc.h store.h sstorei.h X $(CCNA) zarray.c X Xzcontrol.$(OBJ): zcontrol.c $(OP) estack.h store.h sstorei.h X $(CCNA) zcontrol.c X Xzdict.$(OBJ): zdict.c $(OP) dict.h store.h X Xzfile.$(OBJ): zfile.c $(OP) alloc.h stream.h store.h gsmatrix.h gxdevice.h gxdevmem.h X Xzgeneric.$(OBJ): zgeneric.c $(OP) dict.h estack.h store.h X Xzmath.$(OBJ): zmath.c $(OP) store.h X Xzmisc.$(OBJ): zmisc.c $(OP) alloc.h dict.h store.h X Xzrelbit.$(OBJ): zrelbit.c $(OP) store.h sstorei.h X $(CCNA) zrelbit.c X Xzstack.$(OBJ): zstack.c $(OP) store.h sstorei.h X $(CCNA) zstack.c X Xzstring.$(OBJ): zstring.c $(OP) alloc.h store.h stream.h X Xztype.$(OBJ): ztype.c $(OP) stream.h store.h X Xzvmem.$(OBJ): zvmem.c $(OP) alloc.h state.h store.h gsmatrix.h gsstate.h X X# Graphics operators X Xzchar.$(OBJ): zchar.c $(OP) gsmatrix.h gschar.h gxdevice.h gxfont.h alloc.h font.h estack.h state.h store.h X Xzcolor.$(OBJ): zcolor.c $(OP) alloc.h gsmatrix.h gsstate.h state.h store.h X Xzdevice.$(OBJ): zdevice.c $(OP) alloc.h state.h gsmatrix.h gsstate.h gxdevice.h store.h X Xzfont.$(OBJ): zfont.c $(OP) gsmatrix.h gxdevice.h gxfont.h alloc.h font.h dict.h state.h store.h X Xzgstate.$(OBJ): zgstate.c $(OP) alloc.h gsmatrix.h gsstate.h state.h store.h X Xzht.$(OBJ): zht.c $(OP) alloc.h estack.h gsmatrix.h gsstate.h state.h store.h X Xzmatrix.$(OBJ): zmatrix.c $(OP) gsmatrix.h state.h gscoord.h store.h X Xzpaint.$(OBJ): zpaint.c $(OP) alloc.h estack.h gsmatrix.h gspaint.h state.h store.h X Xzpath.$(OBJ): zpath.c $(OP) gsmatrix.h gspath.h state.h store.h X Xzpath2.$(OBJ): zpath2.c $(OP) alloc.h estack.h gspath.h state.h store.h X X# Linking X XINT=ialloc.$(OBJ) idebug.$(OBJ) idict.$(OBJ) iinit.$(OBJ) iname.$(OBJ) \ X interp.$(OBJ) iscan.$(OBJ) iutil.$(OBJ) stream.$(OBJ) \ X zarith.$(OBJ) zarray.$(OBJ) zcontrol.$(OBJ) zdict.$(OBJ) zfile.$(OBJ) \ X zgeneric.$(OBJ) zmath.$(OBJ) zmisc.$(OBJ) zrelbit.$(OBJ) \ X zstack.$(OBJ) zstring.$(OBJ) ztype.$(OBJ) zvmem.$(OBJ) \ X zchar.$(OBJ) zcolor.$(OBJ) zfont.$(OBJ) zdevice.$(OBJ) zgstate.$(OBJ) \ X zht.$(OBJ) zmatrix.$(OBJ) zpaint.$(OBJ) zpath.$(OBJ) zpath2.$(OBJ) X X# ----------------------------- Main program ------------------------------ # X X# Utilities shared between platforms X Xgsmain.$(OBJ): gsmain.c $(GX) gsmatrix.h gxdevice.h X X# Library test program driver X Xgt.$(OBJ): gt.c $(GX) gsmatrix.h gsstate.h gscoord.h gspaint.h gspath.h gxdevice.h X X# Interpreter main program X Xgs.$(OBJ): gs.c $(GH) alloc.h store.h stream.h X# Copyright (C) 1989, 1990 Aladdin Enterprises. All rights reserved. X# Distributed by Free Software Foundation, Inc. X# X# This file is part of Ghostscript. X# X# Ghostscript is distributed in the hope that it will be useful, but X# WITHOUT ANY WARRANTY. No author or distributor accepts responsibility X# to anyone for the consequences of using it or for whether it serves any X# particular purpose or works at all, unless he says so in writing. Refer X# to the Ghostscript General Public License for full details. X# X# Everyone is granted permission to copy, modify and redistribute X# Ghostscript, but only under the conditions described in the Ghostscript X# General Public License. A copy of this license is supposed to have been X# given to you along with Ghostscript so you can know your rights and X# responsibilities. It should be in a file named COPYING. Among other X# things, the copyright notice and this notice must be preserved on all X# copies. X X# makefile for Ghostscript device drivers. X X# -------------------------------- Catalog ------------------------------- # X X# It is possible to build Ghostscript with an arbitrary collection of X# device drivers, although many drivers are supported only on a subset X# of the target platforms. The currently available drivers are: X X# Displays: X# bgi Borland Graphics Interface [MS-DOS only] X# ega EGA display using direct addressing [MS-DOS only] X# ega_bios EGA display using BIOS calls (very slow) [MS-DOS only] X# x11 X Windows version 11, release >=3 [Unix only] X# Printers: X# deskjet H-P DeskJet [MS-DOS only] X# epson Epson dot matrix printers [MS-DOS only] X X# If you add drivers, it would be nice if you kept each list X# in alphabetical order. X X# Each platform-specific makefile should contain a line of the form X# DEVICES=<dev1> ... <devn> X# where dev1 ... devn are the devices to be included in the build. X# dev1 will be used as the default device. X# This line should appear before the lines X# (!)include gdevs.mak X# (!)include ghost.mak X# The rule for constructing the final executable should include gdevs.tl X# as one of the files on which the executable depends, and the executable X# must be linked with all the files named in gdevs.tl. X X# ---------------------------- End of catalog ---------------------------- # X X# If you want to add a new device driver, the examples below should be X# enough of a guide to the correct form for the makefile rules. X X# All device drivers depend on the following: X XGDEV=$(AK) gx.h gsmatrix.h gxbitmap.h gxdevice.h X X###### ----------------------- The EGA device ----------------------- ###### X Xega_=gdevegad.$(OBJ) gdevegaa.$(OBJ) Xega.dev: $(ega_) X gssetdev ega.dev $(ega_) X Xega_bios_=gdevegab.$(OBJ) gdevegaa.$(OBJ) Xega_bios.dev: $(ega_bios_) X gssetdev ega_bios.dev $(ega_bios_) X XETEST=ega.$(OBJ) trace.$(OBJ) $(ega_) Xega.exe: $(ETEST) libc$(MM).tl X tlink /m /l $(LIBDIR)\c0$(MM) @ega.tl @libc$(MM).tl X Xega.$(OBJ): ega.c $(GDEV) X X# Note: gdevega.h includes gs.h, gsmatrix.h, gxbitmap.h, and gxdevice.h. X# There is no way to express this indirect dependency in the makefile. X XGDEVEGAH=gs.h gdevega.h $(GDEV) X Xgdevegaa.$(OBJ): gdevegaa.asm X Xgdevegab.$(OBJ): gdevegab.c $(GDEVEGAH) X $(CCNA) $* X Xgdevegad.$(OBJ): gdevegad.c $(GDEVEGAH) X $(CCNA) $* X X###### --------- The BGI (Borland Graphics Interface) device -------- ###### X Xbgi_=gdevbgi.$(OBJ) Xbgi.dev: $(bgi_) X gssetdev bgi.dev $(bgi_) X Xgdevbgi.$(OBJ): gdevbgi.c $(GDEV) X X###### --------------- Memory-buffered printer devices --------------- ###### X Xgvirtmem.$(OBJ): gvirtmem.c gvirtmem.h X X# Virtual memory test program -- requires VMDEBUG X Xgvm.exe: gvirtmem.$(OBJ) trace.$(OBJ) X tlink /m /l $(LIBDIR)\c0$(MM) gvirtmem trace,gvm,gvm,$(LIBDIR)\c$(MM) X XPDEVH=$(GDEV) gxdevmem.h gdevprn.h X X### ------------------ The H-P DeskJet printer device ------------------ ### X Xdeskjet_=gdevdjet.$(OBJ) gvirtmem.$(OBJ) Xdeskjet.dev: $(deskjet_) X gssetdev deskjet.dev $(deskjet_) X Xgdevdjet.$(OBJ): gdevdjet.c $(PDEVH) X X### ----------------- The generic Epson printer device ----------------- ### X Xepson_=gdevepsn.$(OBJ) gvirtmem.$(OBJ) Xepson.dev: $(epson_) X gssetdev epson.dev $(epson_) X Xgdevepsn.$(OBJ): gdevepsn.c $(PDEVH) X X###### ----------------------- The Xenix device ----------------------- ###### X Xxenix_=gdevxenix.$(OBJ) Xxenix.dev: $(xenix_) X gssetdev xenix.dev $(xenix_) X Xgdevxenix.$(OBJ): gdevxenix.c $(GDEV) gdevxenix.h X X# Copyright (C) 1990 Aladdin Enterprises. All rights reserved. X# Distributed by Free Software Foundation, Inc. X# X# This file is part of Ghostscript. X# X# Ghostscript is distributed in the hope that it will be useful, but X# WITHOUT ANY WARRANTY. No author or distributor accepts responsibility X# to anyone for the consequences of using it or for whether it serves any X# particular purpose or works at all, unless he says so in writing. Refer X# to the Ghostscript General Public License for full details. X# X# Everyone is granted permission to copy, modify and redistribute X# Ghostscript, but only under the conditions described in the Ghostscript X# General Public License. A copy of this license is supposed to have been X# given to you along with Ghostscript so you can know your rights and X# responsibilities. It should be in a file named COPYING. Among other X# things, the copyright notice and this notice must be preserved on all X# copies. X X# Partial makefile for Ghostscript, common to all Unix configurations. X X# This is the last part of the makefile for Unix configurations. X# Since Unix make doesn't have an 'include' facility, we concatenate X# the various parts of the makefile together by brute force (in tar_gs). X X# -------------------------------- Library -------------------------------- # X X## The Unix platform X XPLATUNIX=gp_unix.$(OBJ) X Xgp_unix.$(OBJ): gp_unix.c X X# ----------------------------- Main program ------------------------------ # X X# (Dummy) tracing package X Xutrace.$(OBJ): utrace.c X X# Main program X XALLUNIX=gsmain.$(OBJ) utrace.$(OBJ) $(LIB) $(PLATUNIX) X X# Library test programs X XGTUNIX=gt.$(OBJ) $(ALLUNIX) Xgt: $(GTUNIX) gdevs.tl X $(CC) $(CFLAGS) $(LDPLAT) -o gt $(GTUNIX) `cat gdevs.tl` -lx -lfpu X X# Interpreter main program X XGSUNIX=gs.$(OBJ) $(INT) $(ALLUNIX) Xgs: $(GSUNIX) gdevs.tl X $(CC) $(CFLAGS) $(LDPLAT) -o gs $(GSUNIX) `cat gdevs.tl` -lx -lm SHAR_EOF chmod 0644 makefile.cc || echo "restore of makefile.cc fails" set `wc -c makefile.cc`;Sum=$1 if test "$Sum" != "17752" then echo original size 17752, current size $Sum;fi fi if test -f makefile.gcc; then echo "File makefile.gcc exists"; else echo "x - extracting makefile.gcc (Text)" sed 's/^X//' << 'SHAR_EOF' > makefile.gcc && X# Copyright (C) 1989, 1990 Aladdin Enterprises. All rights reserved. X# Distributed by Free Software Foundation, Inc. X# X# This file is part of Ghostscript. X# X# Ghostscript is distributed in the hope that it will be useful, but X# WITHOUT ANY WARRANTY. No author or distributor accepts responsibility X# to anyone for the consequences of using it or for whether it serves any X# particular purpose or works at all, unless he says so in writing. Refer X# to the Ghostscript General Public License for full details. X# X# Everyone is granted permission to copy, modify and redistribute X# Ghostscript, but only under the conditions described in the Ghostscript X# General Public License. A copy of this license is supposed to have been X# given to you along with Ghostscript so you can know your rights and X# responsibilities. It should be in a file named COPYING. Among other X# things, the copyright notice and this notice must be preserved on all X# copies. X X# makefile for Ghostscript, Unix/gcc/xenix configuration. X X# ------------------------------- Options ------------------------------- # X X####### The following are the only parts of the file you should need to edit. X X# ------ Generic options ------ # X X# Choose the device(s) to include. See gdevs.mak for details. X XDEVICES=xenix X X# Choose generic configuration options. X X# -DDEBUG X# includes debugging features (-Z switch) in the code. X# Code runs substantially slower even if no debugging switches X# are set. X# -DNOPRIVATE X# makes private (static) procedures and variables public, X# so they are visible to the debugger and profiler. X# No execution time or space penalty. X XGENOPT= X X# ------ Platform-specific options ------ # X X# Define the name of the C compiler. X XCC=gcc X X# Define the other compilation flags. X# Add -DBSD4_2 for 4.2bsd systems. X# Add -DSYSV for System V. X# We don't include -ansi, because this gets in the way of the platform- X# specific stuff that <math.h> typically needs. X# If you are running on SunOS 4.0.x, you must add a -D for the machine X# type, or /usr/include/sys/ieeefp.h will fail to define X# fp_direction_type, and so <math.h> won't pass the compiler, and so X# zarith.c and many other files won't compile. The right -D symbol for X# the Sun-4 and SparcStation is -Dsparc; for the Sun-3, it is mc68000. X XCFLAGS= -O -DSYSV -fstrength-reduce -finline-functions -fkeep-inline-functions X X# Define platform flags for ld. X# Most Unix systems accept -X, but some don't. X# Sun OS4.n may need -Bstatic. X XLDPLAT= X X# ---------------------------- End of options --------------------------- # X X# Define the name of the makefile -- used in dependencies. X XMAKEFILE=unix-gcc.mak X X# Define the extensions for the object and executable files. X XOBJ=o XXE= X X# Define the ANSI-to-K&R dependency. (gcc accepts ANSI syntax.) X XAK= X X# Define the compilation rules. X XCCFLAGS=$(GENOPT) $(CFLAGS) X X.c.o: X $(CC) $(CCFLAGS) -c $*.c X XCCNA=$(CC) $(CCFLAGS) -c X X# --------------------------- Generic makefile ---------------------------- # X X# The remainder of the makefile (ghost.mak, gdevs.mak, and unixtail.mak) X# is generic. tar_gs concatenates all these together. X# Copyright (C) 1989, 1990 Aladdin Enterprises. All rights reserved. X# Distributed by Free Software Foundation, Inc. X# X# This file is part of Ghostscript. X# X# Ghostscript is distributed in the hope that it will be useful, but X# WITHOUT ANY WARRANTY. No author or distributor accepts responsibility X# to anyone for the consequences of using it or for whether it serves any X# particular purpose or works at all, unless he says so in writing. Refer X# to the Ghostscript General Public License for full details. X# X# Everyone is granted permission to copy, modify and redistribute X# Ghostscript, but only under the conditions described in the Ghostscript X# General Public License. A copy of this license is supposed to have been X# given to you along with Ghostscript so you can know your rights and X# responsibilities. It should be in a file named COPYING. Among other X# things, the copyright notice and this notice must be preserved on all X# copies. X X# Generic makefile for Ghostscript. X# The platform-specific makefiles 'include' this file. X# They define the following symbols: X# XE - the extension for executable files (e.g., null or .exe). X# OBJ - the extension for relocatable object files (e.g., o or obj). X# CCNA - the non-ANSI C invocation for files that on some platforms X# include in-line assembly code or other non-standard X# constructs. Currently this is needed on every file that X# includes sstorei.h. X# AK - if source files must be converted from ANSI to K&R syntax, X# this is ansi2knr$(XE); if not, it is null. X Xdefault: gs$(XE) X Xtest: gt$(XE) X Xclean: X rm -f *.$(OBJ) *.a core X rm -f _temp_.* *.dev libc*.tl *.map gdevs.h gdevs.tl X rm -f ansi2knr$(XE) X rm -f gs$(XE) gs.sym X Xansi2knr$(XE): X cc -o ansi2knr$(XE) -O ansi2knr.c X X# Note: Unix uses malloc.h and memory.h; X# Turbo C uses alloc.h, stdlib.h, and mem.h. X# 4.2bsd uses strings.h; other systems use string.h. X# gcc on VMS doesn't have a math.h. X# We handle this by using local include files called X# malloc_.h, math_.h, memory_.h, and string_.h X# that perform appropriate indirection. X X# -------------------------------- Library -------------------------------- # X XGX=$(AK) std.h gx.h XGXERR=$(GX) gserrors.h X X# High-level facilities X Xgschar.$(OBJ): gschar.c $(GXERR) gxfixed.h gxmatrix.h gzdevice.h gxdevmem.h gxfont.h gxchar.h gzpath.h gzcolor.h gzstate.h X Xgscolor.$(OBJ): gscolor.c $(GXERR) gxfixed.h gxmatrix.h gxdevice.h gzstate.h gzcolor.h gzhalfto.h X Xgscoord.$(OBJ): gscoord.c $(GXERR) gxfixed.h gxmatrix.h gzdevice.h gzstate.h gscoord.h X Xgsdevice.$(OBJ): gsdevice.c $(GXERR) gxfixed.h gxmatrix.h gxbitmap.h gxdevmem.h gzstate.h gzdevice.h X Xgsfile.$(OBJ): gsfile.c $(GXERR) gsmatrix.h gxdevice.h gxdevmem.h X Xgsfont.$(OBJ): gsfont.c $(GXERR) gxdevice.h gxfixed.h gxmatrix.h gxfont.h gzstate.h X Xgsimage.$(OBJ): gsimage.c $(GXERR) gxfixed.h gxmatrix.h gspaint.h gzcolor.h gzdevice.h gzpath.h gzstate.h gximage.h X Xgsim2out.$(OBJ): gsim2out.c $(GXERR) X Xgsline.$(OBJ): gsline.c $(GXERR) gxfixed.h gxmatrix.h gzstate.h gzline.h X Xgsmatrix.$(OBJ): gsmatrix.c $(GXERR) gxfixed.h gxmatrix.h X Xgsmisc.$(OBJ): gsmisc.c $(GX) X Xgspaint.$(OBJ): gspaint.c $(GX) gxfixed.h gxmatrix.h gspaint.h gzpath.h gzstate.h gzdevice.h gximage.h X Xgspath.$(OBJ): gspath.c $(GXERR) gxfixed.h gxmatrix.h gxpath.h gzstate.h X Xgspath2.$(OBJ): gspath2.c $(GXERR) gspath.h gxfixed.h gxmatrix.h gzstate.h gzpath.h gzdevice.h X Xgsstate.$(OBJ): gsstate.c $(GXERR) gxfixed.h gxmatrix.h gzstate.h gzcolor.h gzdevice.h gzhalfto.h gzline.h gzpath.h X X# Low-level facilities X Xgxcache.$(OBJ): gxcache.c $(GX) gserrors.h gxfixed.h gxmatrix.h gspaint.h gzdevice.h gzcolor.h gxdevmem.h gxfont.h gxchar.h gzstate.h gzpath.h X Xgxcolor.$(OBJ): gxcolor.c $(GX) gxfixed.h gxmatrix.h gxdevice.h gzcolor.h gzhalfto.h X Xgxdraw.$(OBJ): gxdraw.c $(GX) gxfixed.h gxmatrix.h gxbitmap.h gzcolor.h gzdevice.h gzstate.h X Xgxfill.$(OBJ): gxfill.c $(GXERR) gxfixed.h gxmatrix.h gxdevice.h gzcolor.h gzpath.h gzstate.h X Xgxht.$(OBJ): gxht.c $(GXERR) gxfixed.h gxmatrix.h gxbitmap.h gzstate.h gzcolor.h gzdevice.h gzhalfto.h X Xgxpath.$(OBJ): gxpath.c $(GXERR) gxfixed.h gzpath.h X Xgxpath2.$(OBJ): gxpath2.c $(GXERR) gxfixed.h gzpath.h X Xgxstroke.$(OBJ): gxstroke.c $(GXERR) gxfixed.h gxmatrix.h gzstate.h gzcolor.h gzdevice.h gzline.h gzpath.h X X# The "memory" device X Xgdevmem.$(OBJ): gdevmem.c $(AK) gs.h gxbitmap.h gsmatrix.h gxdevice.h gxdevmem.h X $(CCNA) gdevmem.c X X# Files dependent on the set of installed devices. X# Generating gdevs.h also generates gdevs.tl. X Xgdevs.h: gdevs.mak $(MAKEFILE) X gsconfig $(DEVICES) X Xgdevs.$(OBJ): gdevs.c $(AK) gdevs.h X X# On Unix, we pre-link all of the library except the back end. X# On MS-DOS, we have to do the whole thing at once. X XLIB=gschar.$(OBJ) gscolor.$(OBJ) gscoord.$(OBJ) gsdevice.$(OBJ) \ X gsfile.$(OBJ) gsfont.$(OBJ) gsimage.$(OBJ) gsim2out.$(OBJ) \ X gsline.$(OBJ) gsmatrix.$(OBJ) gsmisc.$(OBJ) \ X gspaint.$(OBJ) gspath.$(OBJ) gspath2.$(OBJ) gsstate.$(OBJ) \ X gxcache.$(OBJ) gxcolor.$(OBJ) gxdraw.$(OBJ) gxfill.$(OBJ) \ X gxht.$(OBJ) gxpath.$(OBJ) gxpath2.$(OBJ) gxstroke.$(OBJ) \ X gdevmem.$(OBJ) gdevs.$(OBJ) X X# ------------------------------ Interpreter ------------------------------ # X X# Non-graphics utilities X XGH=$(AK) ghost.h X Xialloc.$(OBJ): ialloc.c $(AK) std.h alloc.h X Xidebug.$(OBJ): idebug.c $(GH) name.h X Xidict.$(OBJ): idict.c $(GH) alloc.h errors.h name.h store.h dict.h X Xiinit.$(OBJ): iinit.c $(GH) dict.h oper.h store.h X Xiname.$(OBJ): iname.c $(GH) alloc.h errors.h name.h store.h X Xinterp.$(OBJ): interp.c $(GH) errors.h name.h dict.h oper.h store.h sstorei.h stream.h X $(CCNA) interp.c X Xiscan.$(OBJ): iscan.c $(GH) alloc.h dict.h errors.h store.h stream.h X Xiutil.$(OBJ): iutil.c $(GH) errors.h alloc.h store.h gsmatrix.h gxdevice.h gzcolor.h X Xstream.$(OBJ): stream.c $(AK) std.h stream.h X X# Non-graphics operators X XOP=$(GH) errors.h oper.h X Xzarith.$(OBJ): zarith.c $(OP) store.h X Xzarray.$(OBJ): zarray.c $(OP) alloc.h store.h sstorei.h X $(CCNA) zarray.c X Xzcontrol.$(OBJ): zcontrol.c $(OP) estack.h store.h sstorei.h X $(CCNA) zcontrol.c X Xzdict.$(OBJ): zdict.c $(OP) dict.h store.h X Xzfile.$(OBJ): zfile.c $(OP) alloc.h stream.h store.h gsmatrix.h gxdevice.h gxdevmem.h X Xzgeneric.$(OBJ): zgeneric.c $(OP) dict.h estack.h store.h X Xzmath.$(OBJ): zmath.c $(OP) store.h X Xzmisc.$(OBJ): zmisc.c $(OP) alloc.h dict.h store.h X Xzrelbit.$(OBJ): zrelbit.c $(OP) store.h sstorei.h X $(CCNA) zrelbit.c X Xzstack.$(OBJ): zstack.c $(OP) store.h sstorei.h X $(CCNA) zstack.c X Xzstring.$(OBJ): zstring.c $(OP) alloc.h store.h stream.h X Xztype.$(OBJ): ztype.c $(OP) stream.h store.h X Xzvmem.$(OBJ): zvmem.c $(OP) alloc.h state.h store.h gsmatrix.h gsstate.h X X# Graphics operators X Xzchar.$(OBJ): zchar.c $(OP) gsmatrix.h gschar.h gxdevice.h gxfont.h alloc.h font.h estack.h state.h store.h X Xzcolor.$(OBJ): zcolor.c $(OP) alloc.h gsmatrix.h gsstate.h state.h store.h X Xzdevice.$(OBJ): zdevice.c $(OP) alloc.h state.h gsmatrix.h gsstate.h gxdevice.h store.h X Xzfont.$(OBJ): zfont.c $(OP) gsmatrix.h gxdevice.h gxfont.h alloc.h font.h dict.h state.h store.h X Xzgstate.$(OBJ): zgstate.c $(OP) alloc.h gsmatrix.h gsstate.h state.h store.h X Xzht.$(OBJ): zht.c $(OP) alloc.h estack.h gsmatrix.h gsstate.h state.h store.h X Xzmatrix.$(OBJ): zmatrix.c $(OP) gsmatrix.h state.h gscoord.h store.h X Xzpaint.$(OBJ): zpaint.c $(OP) alloc.h estack.h gsmatrix.h gspaint.h state.h store.h X Xzpath.$(OBJ): zpath.c $(OP) gsmatrix.h gspath.h state.h store.h X Xzpath2.$(OBJ): zpath2.c $(OP) alloc.h estack.h gspath.h state.h store.h X X# Linking X XINT=ialloc.$(OBJ) idebug.$(OBJ) idict.$(OBJ) iinit.$(OBJ) iname.$(OBJ) \ X interp.$(OBJ) iscan.$(OBJ) iutil.$(OBJ) stream.$(OBJ) \ X zarith.$(OBJ) zarray.$(OBJ) zcontrol.$(OBJ) zdict.$(OBJ) zfile.$(OBJ) \ X zgeneric.$(OBJ) zmath.$(OBJ) zmisc.$(OBJ) zrelbit.$(OBJ) \ X zstack.$(OBJ) zstring.$(OBJ) ztype.$(OBJ) zvmem.$(OBJ) \ X zchar.$(OBJ) zcolor.$(OBJ) zfont.$(OBJ) zdevice.$(OBJ) zgstate.$(OBJ) \ X zht.$(OBJ) zmatrix.$(OBJ) zpaint.$(OBJ) zpath.$(OBJ) zpath2.$(OBJ) X X# ----------------------------- Main program ------------------------------ # X X# Utilities shared between platforms X Xgsmain.$(OBJ): gsmain.c $(GX) gsmatrix.h gxdevice.h X X# Library test program driver X Xgt.$(OBJ): gt.c $(GX) gsmatrix.h gsstate.h gscoord.h gspaint.h gspath.h gxdevice.h X X# Interpreter main program X Xgs.$(OBJ): gs.c $(GH) alloc.h store.h stream.h X# Copyright (C) 1989, 1990 Aladdin Enterprises. All rights reserved. X# Distributed by Free Software Foundation, Inc. X# X# This file is part of Ghostscript. X# X# Ghostscript is distributed in the hope that it will be useful, but X# WITHOUT ANY WARRANTY. No author or distributor accepts responsibility X# to anyone for the consequences of using it or for whether it serves any X# particular purpose or works at all, unless he says so in writing. Refer X# to the Ghostscript General Public License for full details. X# X# Everyone is granted permission to copy, modify and redistribute X# Ghostscript, but only under the conditions described in the Ghostscript X# General Public License. A copy of this license is supposed to have been X# given to you along with Ghostscript so you can know your rights and X# responsibilities. It should be in a file named COPYING. Among other X# things, the copyright notice and this notice must be preserved on all X# copies. X X# makefile for Ghostscript device drivers. X X# -------------------------------- Catalog ------------------------------- # X X# It is possible to build Ghostscript with an arbitrary collection of X# device drivers, although many drivers are supported only on a subset X# of the target platforms. The currently available drivers are: X X# Displays: X# bgi Borland Graphics Interface [MS-DOS only] X# ega EGA display using direct addressing [MS-DOS only] X# ega_bios EGA display using BIOS calls (very slow) [MS-DOS only] X# x11 X Windows version 11, release >=3 [Unix only] X# Printers: X# deskjet H-P DeskJet [MS-DOS only] X# epson Epson dot matrix printers [MS-DOS only] X X# If you add drivers, it would be nice if you kept each list X# in alphabetical order. X X# Each platform-specific makefile should contain a line of the form X# DEVICES=<dev1> ... <devn> X# where dev1 ... devn are the devices to be included in the build. X# dev1 will be used as the default device. X# This line should appear before the lines X# (!)include gdevs.mak X# (!)include ghost.mak X# The rule for constructing the final executable should include gdevs.tl X# as one of the files on which the executable depends, and the executable X# must be linked with all the files named in gdevs.tl. X X# ---------------------------- End of catalog ---------------------------- # X X# If you want to add a new device driver, the examples below should be X# enough of a guide to the correct form for the makefile rules. X X# All device drivers depend on the following: X XGDEV=$(AK) gx.h gsmatrix.h gxbitmap.h gxdevice.h X X###### ----------------------- The EGA device ----------------------- ###### X Xega_=gdevegad.$(OBJ) gdevegaa.$(OBJ) Xega.dev: $(ega_) X gssetdev ega.dev $(ega_) X Xega_bios_=gdevegab.$(OBJ) gdevegaa.$(OBJ) Xega_bios.dev: $(ega_bios_) X gssetdev ega_bios.dev $(ega_bios_) X XETEST=ega.$(OBJ) trace.$(OBJ) $(ega_) Xega.exe: $(ETEST) libc$(MM).tl X tlink /m /l $(LIBDIR)\c0$(MM) @ega.tl @libc$(MM).tl X Xega.$(OBJ): ega.c $(GDEV) X X# Note: gdevega.h includes gs.h, gsmatrix.h, gxbitmap.h, and gxdevice.h. X# There is no way to express this indirect dependency in the makefile. X XGDEVEGAH=gs.h gdevega.h $(GDEV) X Xgdevegaa.$(OBJ): gdevegaa.asm X Xgdevegab.$(OBJ): gdevegab.c $(GDEVEGAH) X $(CCNA) $* X Xgdevegad.$(OBJ): gdevegad.c $(GDEVEGAH) X $(CCNA) $* X X###### --------- The BGI (Borland Graphics Interface) device -------- ###### X Xbgi_=gdevbgi.$(OBJ) Xbgi.dev: $(bgi_) X gssetdev bgi.dev $(bgi_) X Xgdevbgi.$(OBJ): gdevbgi.c $(GDEV) X X###### --------------- Memory-buffered printer devices --------------- ###### X Xgvirtmem.$(OBJ): gvirtmem.c gvirtmem.h X X# Virtual memory test program -- requires VMDEBUG X Xgvm.exe: gvirtmem.$(OBJ) trace.$(OBJ) X tlink /m /l $(LIBDIR)\c0$(MM) gvirtmem trace,gvm,gvm,$(LIBDIR)\c$(MM) X XPDEVH=$(GDEV) gxdevmem.h gdevprn.h X X### ------------------ The H-P DeskJet printer device ------------------ ### X Xdeskjet_=gdevdjet.$(OBJ) gvirtmem.$(OBJ) Xdeskjet.dev: $(deskjet_) X gssetdev deskjet.dev $(deskjet_) X Xgdevdjet.$(OBJ): gdevdjet.c $(PDEVH) X X### ----------------- The generic Epson printer device ----------------- ### X Xepson_=gdevepsn.$(OBJ) gvirtmem.$(OBJ) Xepson.dev: $(epson_) X gssetdev epson.dev $(epson_) X Xgdevepsn.$(OBJ): gdevepsn.c $(PDEVH) X X###### ----------------------- The Xenix device ----------------------- ###### X Xxenix_=gdevxenix.$(OBJ) Xxenix.dev: $(xenix_) X gssetdev xenix.dev $(xenix_) X Xgdevxenix.$(OBJ): gdevxenix.c $(GDEV) gdevxenix.h X X# Copyright (C) 1990 Aladdin Enterprises. All rights reserved. X# Distributed by Free Software Foundation, Inc. X# X# This file is part of Ghostscript. X# X# Ghostscript is distributed in the hope that it will be useful, but X# WITHOUT ANY WARRANTY. No author or distributor accepts responsibility X# to anyone for the consequences of using it or for whether it serves any X# particular purpose or works at all, unless he says so in writing. Refer X# to the Ghostscript General Public License for full details. X# X# Everyone is granted permission to copy, modify and redistribute X# Ghostscript, but only under the conditions described in the Ghostscript X# General Public License. A copy of this license is supposed to have been X# given to you along with Ghostscript so you can know your rights and X# responsibilities. It should be in a file named COPYING. Among other X# things, the copyright notice and this notice must be preserved on all X# copies. X X# Partial makefile for Ghostscript, common to all Unix configurations. X X# This is the last part of the makefile for Unix configurations. X# Since Unix make doesn't have an 'include' facility, we concatenate X# the various parts of the makefile together by brute force (in tar_gs). X X# -------------------------------- Library -------------------------------- # X X## The Unix platform X XPLATUNIX=gp_unix.$(OBJ) X Xgp_unix.$(OBJ): gp_unix.c X X# ----------------------------- Main program ------------------------------ # X X# (Dummy) tracing package X Xutrace.$(OBJ): utrace.c X X# Main program X XALLUNIX=gsmain.$(OBJ) utrace.$(OBJ) $(LIB) $(PLATUNIX) X X# Library test programs X XGTUNIX=gt.$(OBJ) $(ALLUNIX) Xgt: $(GTUNIX) gdevs.tl X $(CC) $(CFLAGS) $(LDPLAT) -o gt $(GTUNIX) `cat gdevs.tl` -lx -lm X X# Interpreter main program X XGSUNIX=gs.$(OBJ) $(INT) $(ALLUNIX) Xgs: $(GSUNIX) gdevs.tl X $(CC) $(CFLAGS) $(LDPLAT) -o gs $(GSUNIX) `cat gdevs.tl` -lx -lm SHAR_EOF chmod 0644 makefile.gcc || echo "restore of makefile.gcc fails" set `wc -c makefile.gcc`;Sum=$1 if test "$Sum" != "17693" then echo original size 17693, current size $Sum;fi fi exit 0 -- Glenn Geers | "So when it's over, we're back to people. Department of Theoretical Physics | Just to prove that human touch can have The University of Sydney | no equal." Sydney NSW 2006 Australia | - Basia Trzetrzelewska, 'Prime Time TV'