delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/03/21/11:32:42

Date: Mon, 21 Mar 1994 17:02:10 --100
From: javier AT altair DOT auto DOT isa DOT cie DOT uva DOT es (Javier Achirica)
Apparently-To: djgpp AT sun DOT soe DOT clarkson DOT edu

     hello,

     I'm posting to the list, so everyone can have the diffs, rather than
emailing everyone who asked.

     First, you can get the original Ghostscript 2.6.1 from prep.ai.mit.edu
or its mirrors. Let me explain the diffs:

     The first two diffs (files dos_.h and gp_dosfb.h) let Ghostscript see the
video memory where it is (in 0xe0000000). For these reason, it won't work in
DPMI mode. To make it work a complete rewrite of the video driver is needed
(which also would allow to use the VESA driver and will work correctly in
standard VGA mode, two of the problems these diffs have).

     See after the diffs for more info....

------------------------------ snip ---- snip -------------------------------
*** gs26/dos_.h Sat Apr 17 03:01:12 1993
--- dos_.h	Wed May 12 13:09:56 1993
***************
*** 62,65 ****
--- 62,74 ----
  
  #else			/* not Watcom or Microsoft */
+ #ifdef __GNUC__
+ /* ------------------ DJGPP */
+ #  include <dir.h>
+ #  define inport(px) inportw(px)
+ #  define outport(px,w) outportw(px,w)
+ #  define MK_PTR(seg,off) (void *)(((seg) << 4) + (off) + 0xe0000000)
+ #  define PTR_OFF(ptr) (unsigned short)(unsigned)(ptr)
+ #  define segread(ptr) /* */
+ #else
  
  /* ---------------- Borland compiler, 16:16 pseudo-segmented model. */
***************
*** 68,71 ****
--- 79,83 ----
  #  define MK_PTR(seg,off) MK_FP(seg,off)
  #  define PTR_OFF(ptr) FP_OFF(ptr)
+ #endif
  /* Define the regs union tag for short registers. */
  #  define rshort x
------------------------------ snip ---- snip -------------------------------
*** gs26/gp_dosfb.c     Mon Apr 12 01:56:58 1993
--- gp_dosfb.c  Wed May 12 09:26:10 1993
***************
*** 19,23 ****
--- 19,25 ----
  /* gp_dosfb.c */
  /* MS-DOS frame buffer swapping routines for Ghostscript */
+ #ifndef __GNUC__
  #include <conio.h>
+ #endif
  #include "malloc_.h"
  #include "memory_.h"
------------------------------ snip ---- snip -------------------------------

     Also, two new files are needed:

     gp_djgpp.c is a modified version of gp_itbc.c, supressing the CPU type
check code (in DJGPP is done by the extender) and making stdprn buffered to
improve efficiency when printing, reducing the number of switches to real
mode.

    djgpp.mak is the Makefile used to make gs.exe. There is still a problem:
The linker doesn't like the '+' signs in the *.tr files, but I haven't found
an easy way to remove them (except to remove them by hand and re-linking :-),
so compile the program and it will give an error when trying to link it.
Edit the *.tr files deleting the '+' signs in them and link the program (or
run make, which hopefully will only link the files).

     I hope you find them useful. I lost the original diffs because of a disk
crash, so I had to make them again. I hope I got it right, if not, just tell
me.

*** gp_djgpp.c ***------------ snip ---- snip -------------------------------
/* Copyright (C) 1989, 1992 Aladdin Enterprises.  All rights reserved.
   Distributed by Free Software Foundation, Inc.

This file is part of Ghostscript.

Ghostscript is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
to anyone for the consequences of using it or for whether it serves any
particular purpose or works at all, unless he says so in writing.  Refer
to the Ghostscript General Public License for full details.

Everyone is granted permission to copy, modify and redistribute
Ghostscript, but only under the conditions described in the Ghostscript
General Public License.  A copy of this license is supposed to have been
given to you along with Ghostscript so you can know your rights and
responsibilities.  It should be in a file named COPYING.  Among other
things, the copyright notice and this notice must be preserved on all
copies.  */

/* gp_djgpp.c */
/* Intel processor, DJGPP C-specific routines for Ghostscript */
#include "dos_.h"
#include <fcntl.h>
#include <io.h>
#include <signal.h>
#include "string_.h"
#include "gx.h"
#include "gp.h"

/* Library routines not declared in a standard header */
extern char *getenv(P1(const char *));

/* Define the size of the C stack. */
unsigned _stklen = 8000;		/* default is 4096, we need more */

/* Do platform-dependent initialization. */
void
gp_init(void)
{
	gp_init_console();
}

/* Do platform-dependent cleanup. */
void
gp_exit(int exit_status, int code)
{
}

/* ------ Printer accessing ------ */

/* Open a connection to a printer.  A null file name means use the */
/* standard printer connected to the machine, if any. */
/* Return NULL if the connection could not be opened. */
extern void gp_set_printer_binary(P2(int, int));
FILE *
gp_open_printer(char *fname, int binary_mode)
{   if ( strlen(fname) == 0 || !strcmp(fname, "PRN") )
    {   if ( binary_mode )
            gp_set_printer_binary(fileno(stdprn), 1);

        (*stdprn)._flag = _IOWRT;  /* Make stdprn buffered to improve performance */

        return stdprn;
    }
    else
        return fopen(fname, (binary_mode ? "wb" : "w"));
}

/* Close the connection to the printer. */
void
gp_close_printer(FILE *pfile, const char *fname)
{	if ( pfile != stdprn )
		fclose(pfile);
        else fflush(stdprn);
}

/* ------ File names ------ */

/* Create and open a scratch file with a given name prefix. */
/* Write the actual file name at fname. */
FILE *
gp_open_scratch_file(const char *prefix, char *fname, const char *mode)
{	char *temp;
	if ( (temp = getenv("TEMP")) == NULL )
		*fname = 0;
	else
	{	char last = '\\';
		strcpy(fname, temp);
		/* Prevent X's in path from being converted by mktemp. */
		for ( temp = fname; *temp; temp++ )
			*temp = last = tolower(*temp);
		switch ( last )
		{
		default:
			strcat(fname, "\\");
		case ':': case '\\':
			;
		}
	}
	strcat(fname, prefix);
	strcat(fname, "XXXXXX");
	mktemp(fname);
	return fopen(fname, mode);
}

/* ------ File operations ------ */

/* If the file given by fname exists, fill in its status and return 1; */
/* otherwise return 0. */
int
gp_file_status(const char *fname, file_status *pstatus)
{	FILE *f = fopen(fname, "r");
	long flen;
	struct ftime ft;
	if ( f == NULL ) return 0;
	if ( getftime(fileno(f), &ft) < 0 )
	   {	fclose(f);
		return 0;
	   }
	fseek(f, 0, SEEK_END);
	flen = ftell(f);
	pstatus->size_pages = (flen + 1023) >> 10;
	pstatus->size_bytes = flen;
	/* Make a single long value from the ftime structure. */
	pstatus->time_referenced = pstatus->time_created =
	  ((long)((ft.ft_year << 9) + (ft.ft_month << 5) + ft.ft_day) << 16) +
	  ((ft.ft_hour << 11) + (ft.ft_min << 5) + ft.ft_tsec);
	fclose(f);
	return 1;
}
*** djgpp.mak ***------------- snip ---- snip -------------------------------
#    Copyright (C) 1989, 1990, 1991, 1992 Aladdin Enterprises.  All rights reserved.
#    Distributed by Free Software Foundation, Inc.
#
# This file is part of Ghostscript.
#
# Ghostscript is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
# to anyone for the consequences of using it or for whether it serves any
# particular purpose or works at all, unless he says so in writing.  Refer
# to the Ghostscript General Public License for full details.
#
# Everyone is granted permission to copy, modify and redistribute
# Ghostscript, but only under the conditions described in the Ghostscript
# General Public License.  A copy of this license is supposed to have been
# given to you along with Ghostscript so you can know your rights and
# responsibilities.  It should be in a file named COPYING.  Among other
# things, the copyright notice and this notice must be preserved on all
# copies.

# makefile for Ghostscript, MS-DOS/DJGPP platform.

# ------------------------------- Options ------------------------------- #

###### This section is the only part of the file you should need to edit.

# ------ Generic options ------ #

# Define the default directory/ies for the runtime
# initialization and font files.  Separate multiple directories with ;.
# Use / to indicate directories, not a single \.

GS_LIB_DEFAULT=c:/gs;c:/gs/fonts

# Define the name of the Ghostscript initialization file.
# (There is no reason to change this.)

GS_INIT=gs_init.ps

# Choose generic configuration options.

# Choose generic configuration options.

# -DDEBUG
#	includes debugging features (-Z switch) in the code.
#	  Code runs substantially slower even if no debugging switches
#	  are set.
# -DNOPRIVATE
#	makes private (static) procedures and variables public,
#	  so they are visible to the debugger and profiler.
#	  No execution time or space penalty.

GENOPT=

# Define the name of the executable file.

GS=gs

# ------ Platform-specific options ------ #

# Define the drive, directory, and compiler name for the DJGPP files.
# CC is the compiler name (normally gcc).
# STUB is the full path name for the DOS extender stub (normally \bin\go32.exe).

CC=gcc
STUB=\bin\go32.exe

# Choose platform-specific options.

# Define the other compilation flags.
# Add -DBSD4_2 for 4.2bsd systems.
# Add -DUSG (GNU convention) or -DSYSV for System V or DG/UX.
# Add -DSYSV -D__SVR3 for SCO ODT, ISC Unix 2.2 or before,
#   or any System III Unix, or System V release 3-or-older Unix.
# Add -DSVR4 (not -DSYSV) for System V release 4.
# XCFLAGS can be set from the command line.
# We don't include -ansi, because this gets in the way of the platform-
#   specific stuff that <math.h> typically needs; nevertheless, we expect
#   gcc to accept ANSI-style function prototypes and function definitions.

CFLAGS=-g -O $(XCFLAGS)

# Define platform flags for ld.
# SunOS and some others want -X; Ultrix wants -x.
# SunOS 4.n may need -Bstatic.
# XLDFLAGS can be set from the command line.

LDFLAGS=$(XLDFLAGS)

# Define any extra libraries to link into the executable.
# ISC Unix 2.2 wants -linet.
# SCO Unix needs -lsocket if you aren't including the X11 driver.
# (Libraries required by individual drivers are handled automatically.)

EXTRALIBS=

# ---------------------------- End of options ---------------------------- #

# Define the platform name.

PLATFORM=dj_

# Define the name of the makefile -- used in dependencies.

MAKEFILE=djgpp.mak

# Define the ANSI-to-K&R dependency.  DJGPP accepts ANSI syntax.

AK=

# Define the extensions for the object and executable files.

OBJ=o
XE=.exe

# Define the need for uniq.

UNIQ=uniq$(XE)

# Define the current directory prefix, shell quote string, and shell name.

EXP=
QQ="
SH=
SHP=

INTASM=
PCFBASM=

# Make sure we get the right default target for make.

dosdefault: default

# Define the generic compilation rules.

.asm.o:
        $(ASM) $(ASMFLAGS) $<;

# -------------------------- Auxiliary programs --------------------------- #

CCAUX=$(COMP)

echogs$(XE): echogs.c
        $(CCAUX) -o echogs echogs.c
        coff2exe echogs


genarch$(XE): genarch.c
        $(CCAUX) -o genarch genarch.c
        coff2exe genarch

# We need a substitute for the Unix uniq utility.
# It only has to handle stdin and stdout, no options.
uniq$(XE): uniq.c
        $(CCAUX) -o uniq uniq.c
        coff2exe uniq

# ------------------------------------------------------------------------- #

CCFLAGS=$(GENOPT) $(CFLAGS)
CCC=$(CC) $(CCFLAGS) -c
CCD=$(CCC)
CCCF=$(CCC)
CCINT=$(CCC)

.c.o:
        $(CCC) $<

# ------ Devices and features ------ #

# Choose the language feature(s) to include.  See gs.mak for details.
# Since we have a large address space, we include the optional features.

FEATURE_DEVS=filter.dev dps.dev level2.dev

# Choose the device(s) to include.  See devs.mak for details.

DEVICE_DEVS=vga.dev ega.dev
DEVICE_DEVS2=atiw.dev s3vga.dev tseng.dev tvga.dev
DEVICE_DEVS3=deskjet.dev djet500.dev laserjet.dev ljetplus.dev ljet2p.dev ljet3.dev
DEVICE_DEVS4=cdeskjet.dev cdjcolor.dev cdjmono.dev cdj550.dev paintjet.dev pjetxl.dev
DEVICE_DEVS5=epson.dev eps9high.dev ibmpro.dev bj10e.dev
DEVICE_DEVS8=gifmono.dev gif8.dev pcxmono.dev pcx16.dev pcx256.dev bit.dev
!include "gs.mak"
!include "devs.mak"

# -------------------------------- Library -------------------------------- #

# The DJGPP platform

dj__=gp_djgpp.$(OBJ) gp_dosfb.$(OBJ) gp_msdos.$(OBJ)
dj_.dev: $(dj__)
        $(SHP)gssetmod dj_ $(dj__)

gp_djgpp.$(OBJ): gp_djgpp.c $(string__h) $(gx_h) $(gp_h)

gp_dosfb.$(OBJ): gp_dosfb.c $(memory__h) $(gx_h) $(gp_h) $(gserrors_h) $(gxdevice_h)

gp_msdos.$(OBJ): gp_msdos.c $(dos__h) $(string__h) $(gx_h) $(gp_h)

# ----------------------------- Main program ------------------------------ #

BEGINFILES=ccf.tr
CCBEGIN=$(CCC) *.c

# Get around the fact that the DOS shell has a rather small limit on
# the length of a command line.  (sigh)

LIBDOS=$(LIBGS) gp_djgpp.$(OBJ) gp_dosfb.$(OBJ) gp_msdos.$(OBJ)

# Interpreter main program

GS_ALL=gs.$(OBJ) $(INT) gsmain.$(OBJ) $(LIBDOS) obj.tr lib.tr

$(GS)$(XE): $(GS_ALL) $(ALL_DEVS)
        $(CC) $(LDFLAGS) -o $(GS) $(LCT) @obj.tr @gs.tr @lib.tr $(EXTRALIBS) -lm -lpc
        coff2exe $(GS)
------------------------------ snip ---- snip -------------------------------



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019