[gs-cvs] rev 6899 - trunk/gs/src

ray at ghostscript.com ray at ghostscript.com
Thu Jul 6 14:32:51 PDT 2006


Author: ray
Date: 2006-07-06 14:32:50 -0700 (Thu, 06 Jul 2006)
New Revision: 6899

Modified:
   trunk/gs/src/bcwin32.mak
   trunk/gs/src/dvx-gcc.mak
   trunk/gs/src/files.h
   trunk/gs/src/gsiorom.c
   trunk/gs/src/int.mak
   trunk/gs/src/macos-mcp.mak
   trunk/gs/src/macosx.mak
   trunk/gs/src/msvc32.mak
   trunk/gs/src/msvclib.mak
   trunk/gs/src/os2.mak
   trunk/gs/src/ugcclib.mak
   trunk/gs/src/unix-gcc.mak
   trunk/gs/src/unixansi.mak
   trunk/gs/src/watclib.mak
   trunk/gs/src/watcw32.mak
   trunk/gs/src/zfile.c
Log:
Several %rom% related improvements. Add PSRESDIR macro to define the location
of the Resource/ path during the build. Remove the RESOURCE_LIST from the top
level makefiles (list now only in src/int.mak). Correct the font path to the
Adobe standard Resource/Font. Change the GS_LIB_DEFAULT to include Resource/Font
rather than the useless Resource path.

Change the %rom% device to return a custom 'block' stream that decompresses
by blocks into the buffer so that the entire file is never decompressed into
a 'string' for a sread_string type stream. The 'file_prepare_stream' is now
exported for use by gsiorom.c.

DETAILS:

That wasn't enough ?

One hack is that the s->file pointer in the stream_s is used to hold the pointer
to the node header in the %rom% file system. This seemed to make some sense.
Unlike the FILE * structure (which is somewhat opaque), there is no dynamic
state info in a node -- the s->position and read pointer within cbuf are enough
to allow read_process, seek, and available procs to operate.

The buffer is slighty larger than the ROMFS_BLOCKSIZE to allow for some data
(up to 256 bytes) not being consumed from the buffer when read_process is
used to refill the buffer. This way we can decompress directly into the cbuf
(at the correct point, of course) and avoid another buffer and copy. This
also means that each 'block' is always at or near the front of cbuf. After
a seek, the block will load at the beginning of cbuf (assuming we did not
already have the requested pos in the buffer).

As with 'file' type streams, the s->read_id is bumped so that the stream
access functions will see the file as 'invalid' (read_id won't match rsize).
The cbuf is also freed when the file is closed (to prevent leaks in a non
GC memory system).

NOTE: IT IS THE CALLER'S RESPONSIBILITY TO FREE THE STREAM RETURNED BY THE
romfs_open_file() function using the memory in the s->memory allocator. In
PostScript, since the -file- ref can be passed around among objects, the
GC is relied upon to free when no further references exist.




Modified: trunk/gs/src/bcwin32.mak
===================================================================
--- trunk/gs/src/bcwin32.mak	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/bcwin32.mak	2006-07-06 21:32:50 UTC (rev 6899)
@@ -31,6 +31,7 @@
 GLOBJDIR=obj
 PSSRCDIR=src
 PSLIBDIR=lib
+PSRESDIR=Resource
 PSGENDIR=obj
 PSOBJDIR=obj
 
@@ -53,7 +54,7 @@
 # Use / to indicate directories, not a single \.
 
 !ifndef GS_LIB_DEFAULT
-GS_LIB_DEFAULT=$(GSROOTDIR)/lib\;$(GSROOTDIR)/Resource\;$(AROOTDIR)/fonts
+GS_LIB_DEFAULT=$(GSROOTDIR)/lib\;$(GSROOTDIR)/Resource/Font\;$(AROOTDIR)/fonts
 !endif
 
 # Define whether or not searching for initialization files should always
@@ -311,10 +312,6 @@
 
 FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(PSD)mshandle.dev $(PSD)mspoll.dev $(GLD)pipe.dev $(PSD)fapi.dev
 
-# The list of resources to be included in the %rom% file system.
-# This is in the top makefile since the file descriptors are platform specific
-RESOURCE_LIST=Resource/CMap/ Resource/ColorSpace/ Resource/Decoding/ Resource/Fonts/ Resource/Procset/ Resource/IdiomSet/ Resource/CIDFont/
-
 # Choose whether to compile the .ps initialization files into the executable.
 # See gs.mak for details.
 

Modified: trunk/gs/src/dvx-gcc.mak
===================================================================
--- trunk/gs/src/dvx-gcc.mak	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/dvx-gcc.mak	2006-07-06 21:32:50 UTC (rev 6899)
@@ -34,6 +34,7 @@
 GLOBJDIR=obj
 PSSRCDIR=src
 PSLIBDIR=lib
+PSRESDIR=Resource
 PSGENDIR=obj
 PSOBJDIR=obj
 
@@ -58,7 +59,7 @@
 # Define the default directory/ies for the runtime
 # initialization, resource and font files.  Separate multiple directories with a ;.
 
-GS_LIB_DEFAULT="$(gsdatadir)/lib;$(gsdatadir)/Resource;$(gsfontdir)"
+GS_LIB_DEFAULT="$(gsdatadir)/lib;$(gsdatadir)/Resource/Font;$(gsfontdir)"
 
 # Define whether or not searching for initialization files should always
 # look in the current directory first.  This leads to well-known security
@@ -264,10 +265,6 @@
 
 FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(GLD)pipe.dev $(PSD)fapi.dev
 
-# The list of resources to be included in the %rom% file system.
-# This is in the top makefile since the file descriptors are platform specific
-RESOURCE_LIST=Resource/CMap/ Resource/ColorSpace/ Resource/Decoding/ Resource/Fonts/ Resource/Procset/ Resource/IdiomSet/ Resource/CIDFont/
-
 # Choose whether to compile the .ps initialization files into the executable.
 # See gs.mak for details.
 

Modified: trunk/gs/src/files.h
===================================================================
--- trunk/gs/src/files.h	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/files.h	2006-07-06 21:32:50 UTC (rev 6899)
@@ -46,6 +46,9 @@
 extern stream *const invalid_file_entry;
 /* Make an invalid file object. */
 void make_invalid_file(ref *);
+/* create a stream for a file object */
+int file_prepare_stream(const char *, uint, const char, 
+		 uint, stream **, char[4], gs_memory_t *);
 
 /*
  * Macros for checking file validity.

Modified: trunk/gs/src/gsiorom.c
===================================================================
--- trunk/gs/src/gsiorom.c	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/gsiorom.c	2006-07-06 21:32:50 UTC (rev 6899)
@@ -28,6 +28,7 @@
 #include "string_.h"
 #include "gsiorom.h"
 #include "gx.h"
+#include "gpcheck.h"
 #include "gserrors.h"
 #include "gsstruct.h"
 #include "gsutil.h"
@@ -87,7 +88,143 @@
     return v;
 }
 
+/* ------ Block streams, potentially compressed (read only) ------ */
+
+/* String stream procedures */
 private int
+    s_block_read_available(stream *, long *),
+    s_block_read_seek(stream *, long),
+    s_block_read_close(stream *),
+    s_block_read_process(stream_state *, stream_cursor_read *,
+			  stream_cursor_write *, bool);
+
+/* Initialize a stream for reading from a collection of blocks */
+void
+sread_block(register stream *s,  const byte *ptr, uint len, const uint32_t *node )
+{
+    static const stream_procs p = {
+	 s_block_read_available, s_block_read_seek, s_std_read_reset,
+	 s_std_read_flush, s_block_read_close, s_block_read_process,
+	 NULL		/* no read_switch */
+    };
+    s_std_init(s, (byte *)ptr, len, &p, s_mode_read + s_mode_seek);
+    s->end_status = 0;
+    s->file = (FILE *)node;	/* convenient place to put it for %rom% files */ 
+    s->file_modes = s->modes;
+    s->file_offset = 0;
+    s->file_limit = max_long;
+}
+
+/* Return the number of available bytes */
+private int
+s_block_read_available(stream *s, long *pl)
+{
+    uint32_t *node = (uint32_t *)s->file;
+    uint32_t filelen = get_u32_big_endian(node) & 0x7fffffff;	/* ignore compression bit */
+
+    *pl = filelen - s->position - (sbufptr(s) - s->cbuf);
+    if (*pl == 0 && s->close_at_eod)	/* EOF */
+	*pl = -1;
+    return 0;
+}
+
+/* Seek in a string being read.  Return 0 if OK, ERRC if not. */
+private int
+s_block_read_seek(register stream * s, long pos)
+{
+    uint32_t *node = (uint32_t *)s->file;
+    uint32_t filelen = get_u32_big_endian(node) & 0x7fffffff;	/* ignore compression bit */
+    uint end = s->srlimit - s->cbuf + 1;
+    long offset = pos - s->position;
+
+    if (pos < 0 || pos > filelen)
+	return ERRC;
+    if (offset < 0 || offset > end) {
+	/* Need to pull a different block into the buffer */
+	stream_cursor_write pw;
+
+	/* buffer stays aligned to blocks */
+	offset = pos % ROMFS_BLOCKSIZE;
+	s->position = pos - offset;
+	pw.ptr = s->cbuf - 1;
+	pw.limit = pw.ptr + s->cbsize;
+	if ((s->end_status = s_block_read_process((stream_state *)s, NULL, &pw, 0)) == ERRC)
+	    return ERRC;
+	if (s->end_status == 1)
+	    s->end_status = 0;
+	s->srptr = s->cbuf - 1;
+	s->srlimit = pw.ptr;		/* limit of the block just read */
+    } 
+    /* Now set the read pointer to the correct place in the buffer */
+    s->srptr = s->cbuf + offset - 1;
+    return 0;
+}
+
+private int
+s_block_read_close(stream * s)
+{
+    gs_free_object(s->memory, s->cbuf, "file_close(buffer)");
+    s->file = 0;			/* disconnect the node */
+    /* Increment the IDs to prevent further access. */
+    s->read_id = s->write_id = (s->read_id | s->write_id) + 1;
+    return 0;
+}
+
+private int
+s_block_read_process(stream_state * st, stream_cursor_read * ignore_pr,
+		      stream_cursor_write * pw, bool last)
+{
+    int  code;
+    stream *s = (stream *)st;	/* no separate state */
+    uint32_t *node = (uint32_t *)s->file;
+    uint max_count = pw->limit - pw->ptr;
+    int status = 1;
+    int compression = ((get_u32_big_endian(node) & 0x80000000) != 0) ? 1 : 0;
+    uint32_t filelen = get_u32_big_endian(node) & 0x7fffffff;	/* ignore compression bit */
+    uint32_t blocks = (filelen+ROMFS_BLOCKSIZE-1)/ ROMFS_BLOCKSIZE;
+    int iblock = (s->position + pw->ptr + 1 - s->cbuf) / ROMFS_BLOCKSIZE;
+    unsigned long block_length = get_u32_big_endian(node+1+(2*iblock));
+    unsigned const long block_offset = get_u32_big_endian(node+2+(2*iblock));
+    unsigned const char *block_data = ((unsigned char *)node) + block_offset;
+    int count = iblock < (blocks - 1) ? ROMFS_BLOCKSIZE : filelen - (ROMFS_BLOCKSIZE * iblock);
+
+    if (count > max_count) {
+	return ERRC;			/* should not happen */
+    }
+    if (block_data == NULL) {
+	return EOFC;
+    }
+    if (s->file_limit < max_long) {
+	long limit_count = s->file_offset + s->file_limit - s->position;
+
+	if (count > limit_count)
+	    count = limit_count;
+    }
+
+    if (count < ROMFS_BLOCKSIZE || iblock == (blocks - 1))
+	status = EOFC;			/* at EOF when not filling entire buffer */
+    /* get the block into the buffer */
+    if (compression) {
+	unsigned long buflen = ROMFS_BLOCKSIZE;
+
+	/* Decompress the data into this block */
+	code = uncompress (pw->ptr+1, &buflen, block_data, block_length);
+	if (count != buflen) {
+	    return ERRC;
+	}
+    } else {
+	/* not compressed -- just copy it */
+	memcpy(pw->ptr+1, block_data, block_length);
+	count = block_length;
+    }
+    if (count < 0)
+	count = 0;
+    pw->ptr += count;
+    process_interrupts(s->memory);
+    return status;
+}
+
+private int
 romfs_init(gx_io_device *iodev, gs_memory_t *mem)
 {
     romfs_state *state = gs_alloc_struct(mem, romfs_state, &st_romfs_state, 
@@ -103,11 +240,12 @@
     const char *access, stream **ps, gs_memory_t *mem)
 {
     extern const uint32_t *gs_romfs[];
+    int code;
     const uint32_t *node_scan = gs_romfs[0], *node = NULL;
     uint32_t filelen, blocks, decompress_len;
     int i, compression;
     char *filename;
-    byte *buf;
+    char fmode[4] = "\000\000\000\000";
 
     /* return an empty stream on error */
     *ps = NULL;
@@ -127,44 +265,14 @@
     if (node == NULL)
 	return_error(gs_error_undefinedfilename);
 
-    /* return the uncompressed contents of the string */
-    compression = ((get_u32_big_endian(node) & 0x80000000) != 0) ? 1 : 0;
-    buf = gs_alloc_string(mem, filelen, "romfs buffer");
-    if (buf == NULL) {
-	if_debug0('s', "%rom%: could not allocate buffer\n");
-	return_error(gs_error_VMerror);
-    }
-    /* deflate the file into the buffer */
-    decompress_len = 0;
-    for (i=0; i<blocks; i++) {
-	unsigned long block_length = get_u32_big_endian(node+1+(2*i));
-	unsigned const long block_offset = get_u32_big_endian(node+2+(2*i));
-	unsigned const char *block_data = ((unsigned char *)node) + block_offset;
-	int code;
-
-	if (compression) {
-	    unsigned long buflen = ROMFS_BLOCKSIZE;
-
-	    /* Decompress the data into this block */
-	    code = uncompress (buf+(i*ROMFS_BLOCKSIZE), &buflen,
-				block_data, block_length);
-	    decompress_len += buflen;
-	} else {
-	    /* not compressed -- just copy it */
-	    memcpy(buf+(i*ROMFS_BLOCKSIZE), block_data, block_length);
-	    decompress_len += block_length;
-        }
-    }
-    if (decompress_len != filelen) {
-	unsigned long dl=decompress_len, fl=filelen;
-
-	eprintf2("romfs decompression length error. Was %ld should be %ld\n",
-		dl, fl);
-	return_error(gs_error_ioerror);
-    }
-    *ps = s_alloc(mem, "romfs");
-    sread_string(*ps, buf, filelen);
-
+    /* Initialize a stream for reading this romfs file using a common function */
+    /* we get a buffer that is larger than what we need for decompression */
+    /* we need extra space since some filters may leave data in the buffer when */
+    /* calling 'read_process' */
+    code = file_prepare_stream(fname, namelen, access, ROMFS_BLOCKSIZE+256, ps, &fmode, mem);
+    if (code < 0) 
+	return code;
+    sread_block(*ps, (*ps)->cbuf, (*ps)->cbsize, node);
     /* return success */
     return 0;
 }

Modified: trunk/gs/src/int.mak
===================================================================
--- trunk/gs/src/int.mak	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/int.mak	2006-07-06 21:32:50 UTC (rev 6899)
@@ -981,10 +981,15 @@
 # versions.
 EXTRA_INIT_FILES= Fontmap cidfmap xlatmap FAPIcidfmap FAPIconfig FAPIfontmap
 
-# Note: RESOURCE_LIST is first since those are CWD relative. Later files use -P prefix paths
 #	The init files are put in the lib/ directory (gs_init.ps + EXTRA_INIT_FILES)
+#	Resource files go into Resource/...
+
+RESOURCE_LIST=ColorSpace/ Decoding/ Font/ Procset/ IdiomSet/ CIDFont/ CMap/
+
+# PCLXL_ PJL and XPS hooks are for other parsers that may be built with a PS
+# language switch build.
 $(GLOBJ)gsromfs.c : $(MKROMFS_XE) $(PSGEN)gs_init.ps $(arch_h)
-	$(EXP)$(MKROMFS_XE) -o $(GLOBJ)gsromfs.c -c -X .svn $(RESOURCE_LIST) -d lib/ -P $(PSGEN) gs_init.ps -P $(PSLIB) $(EXTRA_INIT_FILES)
+	$(EXP)$(MKROMFS_XE) -o $(GLOBJ)gsromfs.c -c -X .svn -P $(PSRESDIR)$(D) -d Resource/ $(RESOURCE_LIST) -d lib/ -P $(PSGEN) gs_init.ps -P $(PSLIB) $(EXTRA_INIT_FILES) $(PCLXL_ROMFS_ARGS) $(PJL_ROMFS_ARGS) $(XPS_ROMFS_ARGS)
 
 # ---------------- Stochastic halftone ---------------- #
 

Modified: trunk/gs/src/macos-mcp.mak
===================================================================
--- trunk/gs/src/macos-mcp.mak	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/macos-mcp.mak	2006-07-06 21:32:50 UTC (rev 6899)
@@ -31,6 +31,7 @@
 GLOBJDIR=./obj
 PSSRCDIR=./src
 PSLIBDIR=./lib
+PSRESDIR=./Resource
 PSGENDIR=./obj
 PSOBJDIR=./obj
 
@@ -46,7 +47,7 @@
 # Define the default directory/ies for the runtime
 # initialization, resource and font files.  Separate multiple directories with a :.
 
-GS_LIB_DEFAULT=:,:lib,:Resource,:files,:fonts,:examples
+GS_LIB_DEFAULT=:,:lib,:Resource/Font,:files,:fonts,:examples
 
 GS_DOCDIR=:doc
 
@@ -184,10 +185,6 @@
 FEATURE_DEVS_ALL=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)rasterop.dev $(PSD)double.dev $(PSD)trapping.dev $(PSD)stocht.dev $(GLD)pipe.dev $(GLD)macres.dev $(PSD)jbig2.dev $(PSD)jpx.dev $(PSD)macpoll.dev
 #FEATURE_DEVS=$(FEATURE_DEVS_ALL)
 
-# The list of resources to be included in the %rom% file system.
-# This is in the top makefile since the file descriptors are platform specific
-RESOURCE_LIST=Resource/CMap/ Resource/ColorSpace/ Resource/Decoding/ Resource/Fonts/ Resource/Procset/ Resource/IdiomSet/ Resource/CIDFont/
-
 # Choose whether to compile the .ps initialization files into the executable.
 # See gs.mak for details.
 

Modified: trunk/gs/src/macosx.mak
===================================================================
--- trunk/gs/src/macosx.mak	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/macosx.mak	2006-07-06 21:32:50 UTC (rev 6899)
@@ -27,6 +27,7 @@
 GLOBJDIR=./obj
 PSSRCDIR=./src
 PSLIBDIR=./lib
+PSRESDIR=./Resource
 PSGENDIR=./obj
 PSOBJDIR=./obj
 
@@ -70,7 +71,7 @@
 # Define the default directory/ies for the runtime
 # initialization, resource and font files.  Separate multiple directories with a :.
 
-GS_LIB_DEFAULT=$(gsdatadir)/lib:$(gsdatadir)/Resource:$(datadir)/fonts:/Library/Fonts:/System/Library/Fonts
+GS_LIB_DEFAULT=$(gsdatadir)/lib:$(gsdatadir)/Resource/Font:$(datadir)/fonts:/Library/Fonts:/System/Library/Fonts
 
 # Define whether or not searching for initialization files should always
 # look in the current directory first.  This leads to well-known security
@@ -333,10 +334,6 @@
 FEATURE_DEVS_ALL=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)rasterop.dev $(PSD)double.dev $(PSD)trapping.dev $(PSD)stocht.dev $(GLD)pipe.dev
 #FEATURE_DEVS=$(FEATURE_DEVS_ALL)
 
-# The list of resources to be included in the %rom% file system.
-# This is in the top makefile since the file descriptors are platform specific
-RESOURCE_LIST=Resource/CMap/ Resource/ColorSpace/ Resource/Decoding/ Resource/Fonts/ Resource/Procset/ Resource/IdiomSet/ Resource/CIDFont/
-
 # Choose whether to compile the .ps initialization files into the executable.
 # See gs.mak for details.
 

Modified: trunk/gs/src/msvc32.mak
===================================================================
--- trunk/gs/src/msvc32.mak	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/msvc32.mak	2006-07-06 21:32:50 UTC (rev 6899)
@@ -54,6 +54,9 @@
 !ifndef PSLIBDIR
 PSLIBDIR=.\lib
 !endif
+!ifndef PSRESDIR
+PSRESDIR=.\Resource
+!endif
 !ifndef PSGENDIR
 PSGENDIR=.\obj
 !endif
@@ -83,7 +86,7 @@
 # illegal escape.
 
 !ifndef GS_LIB_DEFAULT
-GS_LIB_DEFAULT=$(GSROOTDIR)/lib;$(GSROOTDIR)/Resource;$(AROOTDIR)/fonts
+GS_LIB_DEFAULT=$(GSROOTDIR)/lib;$(GSROOTDIR)/Resource/Font;$(AROOTDIR)/fonts
 !endif
 
 # Define whether or not searching for initialization files should always
@@ -623,9 +626,6 @@
 COMPILE_INITS=0
 !endif
 
-# This is in the top level makefile since it is platform dependent
-RESOURCE_LIST=Resource/CMap/ Resource/ColorSpace/ Resource/Decoding/ Resource/Fonts/ Resource/Procset/ Resource/IdiomSet/ Resource/CIDFont/
-
 # Choose whether to store band lists on files or in memory.
 # The choices are 'file' or 'memory'.
 

Modified: trunk/gs/src/msvclib.mak
===================================================================
--- trunk/gs/src/msvclib.mak	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/msvclib.mak	2006-07-06 21:32:50 UTC (rev 6899)
@@ -106,7 +106,10 @@
 !endif
 !ifndef GLSRCDIR
 GLSRCDIR=.\src
+!ifndef PSRESDIR
+PSRESDIR=.\Resource
 !endif
+!endif
 !ifndef GLGENDIR
 GLGENDIR=.\obj
 !endif
@@ -391,7 +394,8 @@
 
 # The list of resources to be included in the %rom% file system.
 # This is in the top makefile since the file descriptors are platform specific
-RESOURCE_LIST=Resource/CMap/ Resource/ColorSpace/ Resource/Decoding/ Resource/Fonts/ Resource/Procset/ Resource/IdiomSet/ Resource/CIDFont/
+RD=$(PSRESDIR)/
+RESOURCE_LIST=$(RD)CMap/ $(RD)ColorSpace/ $(RD)Decoding/ $(RD)Font/ $(RD)Procset/ $(RD)IdiomSet/ $(RD)CIDFont/
 
 # Choose whether to compile the .ps initialization files into the executable.
 # See gs.mak for details.

Modified: trunk/gs/src/os2.mak
===================================================================
--- trunk/gs/src/os2.mak	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/os2.mak	2006-07-06 21:32:50 UTC (rev 6899)
@@ -33,6 +33,7 @@
 GLOBJDIR=obj
 PSSRCDIR=src
 PSLIBDIR=lib
+PSRESDIR=Resource
 PSGENDIR=obj
 PSOBJDIR=obj
 
@@ -49,7 +50,7 @@
 # initialization, resource and font files.  Separate multiple directories with ;.
 # Use / to indicate directories, not a single \.
 
-GS_LIB_DEFAULT=$(GSROOTDIR)/lib;$(GSROOTDIR)/Resource;$(AROOTDIR)/fonts
+GS_LIB_DEFAULT=$(GSROOTDIR)/lib;$(GSROOTDIR)/Resource/Font;$(AROOTDIR)/fonts
 
 # Define whether or not searching for initialization files should always
 # look in the current directory first.  This leads to well-known security
@@ -454,9 +455,6 @@
 # Since we have a large address space, we include some optional features.
 
 FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(PSD)os2print.dev
-# The list of resources to be included in the %rom% file system.
-# This is in the top makefile since the file descriptors are platform specific
-RESOURCE_LIST=Resource/CMap/ Resource/ColorSpace/ Resource/Decoding/ Resource/Fonts/ Resource/Procset/ Resource/IdiomSet/ Resource/CIDFont/
 
 # Choose whether to compile the .ps initialization files into the executable.
 # See gs.mak for details.

Modified: trunk/gs/src/ugcclib.mak
===================================================================
--- trunk/gs/src/ugcclib.mak	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/ugcclib.mak	2006-07-06 21:32:50 UTC (rev 6899)
@@ -17,6 +17,7 @@
 GLSRCDIR=./src
 GLGENDIR=./libobj
 GLOBJDIR=./libobj
+PSRESDIR=./Resource
 DD=$(GLGENDIR)/
 GLD=$(GLGENDIR)/
 
@@ -28,7 +29,7 @@
 gsdir = /usr/local/share/ghostscript
 gsdatadir = $(gsdir)/$(GS_DOT_VERSION)
 GS_DOCDIR=$(gsdatadir)/doc
-GS_LIB_DEFAULT=$(gsdatadir)/lib:$(gsdatadir)/Resource:$(gsdir)/fonts
+GS_LIB_DEFAULT=$(gsdatadir)/lib:$(gsdatadir)/Resource/Font:$(gsdir)/fonts
 SEARCH_HERE_FIRST=1
 GS_INIT=gs_init.ps
 
@@ -104,10 +105,6 @@
  $(GLD)psl3lib.dev $(GLD)path1lib.dev $(GLD)patlib.dev $(GLD)htxlib.dev \
  $(GLD)roplib.dev $(GLD)devcmap.dev
 
-# The list of resources to be included in the %rom% file system.
-# This is in the top makefile since the file descriptors are platform specific
-RESOURCE_LIST=Resource/CMap/ Resource/ColorSpace/ Resource/Decoding/ Resource/Fonts/ Resource/Procset/ Resource/IdiomSet/ Resource/CIDFont/
-
 COMPILE_INITS=0
 BAND_LIST_STORAGE=file
 BAND_LIST_COMPRESSOR=zlib

Modified: trunk/gs/src/unix-gcc.mak
===================================================================
--- trunk/gs/src/unix-gcc.mak	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/unix-gcc.mak	2006-07-06 21:32:50 UTC (rev 6899)
@@ -27,6 +27,7 @@
 GLOBJDIR=./obj
 PSSRCDIR=./src
 PSLIBDIR=./lib
+PSRESDIR=./Resource
 PSGENDIR=./obj
 PSOBJDIR=./obj
 
@@ -328,10 +329,6 @@
 FEATURE_DEVS_ALL=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)rasterop.dev $(PSD)double.dev $(PSD)trapping.dev $(PSD)stocht.dev $(GLD)pipe.dev
 #FEATURE_DEVS=$(FEATURE_DEVS_ALL)
 
-# The list of resources to be included in the %rom% file system.
-# This is in the top makefile since the file descriptors are platform specific
-RESOURCE_LIST=Resource/CMap/ Resource/ColorSpace/ Resource/Decoding/ Resource/Fonts/ Resource/Procset/ Resource/IdiomSet/ Resource/CIDFont/
-
 # Choose whether to compile the .ps initialization files into the executable.
 # See gs.mak for details.
 

Modified: trunk/gs/src/unixansi.mak
===================================================================
--- trunk/gs/src/unixansi.mak	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/unixansi.mak	2006-07-06 21:32:50 UTC (rev 6899)
@@ -27,6 +27,7 @@
 GLOBJDIR=./obj
 PSSRCDIR=./src
 PSLIBDIR=./lib
+PSRESDIR=./Resource
 PSGENDIR=./obj
 PSOBJDIR=./obj
 
@@ -303,10 +304,6 @@
 
 FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(GLD)pipe.dev $(PSD)fapi.dev
 
-# The list of resources to be included in the %rom% file system.
-# This is in the top makefile since the file descriptors are platform specific
-RESOURCE_LIST=Resource/CMap/ Resource/ColorSpace/ Resource/Decoding/ Resource/Fonts/ Resource/Procset/ Resource/IdiomSet/ Resource/CIDFont/
-
 # Choose whether to compile the .ps initialization files into the executable.
 # See gs.mak for details.
 

Modified: trunk/gs/src/watclib.mak
===================================================================
--- trunk/gs/src/watclib.mak	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/watclib.mak	2006-07-06 21:32:50 UTC (rev 6899)
@@ -19,7 +19,7 @@
 AROOTDIR=c:/gs
 GSROOTDIR=$(AROOTDIR)/gs$(GS_DOT_VERSION)
 GS_DOCDIR=$(GSROOTDIR)/doc
-GS_LIB_DEFAULT=$(GSROOTDIR)/lib\;$(GSROOTDIR)/resource\;$(AROOTDIR)/fonts
+GS_LIB_DEFAULT=$(GSROOTDIR)/lib\;$(GSROOTDIR)/Resource/Font\;$(AROOTDIR)/fonts
 SEARCH_HERE_FIRST=1
 GS_INIT=gs_init.ps
 
@@ -41,6 +41,9 @@
 !ifndef GLSRCDIR
 GLSRCDIR=.\src
 !endif
+!ifndef PSRESDIR
+PSRESDIR=.\Resource
+!endif
 !ifndef GLGENDIR
 GLGENDIR=.\debugobj
 !endif
@@ -131,10 +134,6 @@
 DEVICE_DEVS=$(DD)vga.dev
 !endif
 
-# The list of resources to be included in the %rom% file system.
-# This is in the top makefile since the file descriptors are platform specific
-RESOURCE_LIST=Resource/CMap/ Resource/ColorSpace/ Resource/Decoding/ Resource/Fonts/ Resource/Procset/ Resource/IdiomSet/ Resource/CIDFont/
-
 !ifndef COMPILE_INITS
 COMPILE_INITS=0
 !endif

Modified: trunk/gs/src/watcw32.mak
===================================================================
--- trunk/gs/src/watcw32.mak	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/watcw32.mak	2006-07-06 21:32:50 UTC (rev 6899)
@@ -35,6 +35,7 @@
 GLOBJDIR=obj
 PSSRCDIR=src
 PSLIBDIR=lib
+PSRESDIR=Resource
 PSGENDIR=obj
 PSOBJDIR=obj
 
@@ -51,7 +52,7 @@
 # initialization, resource and font files.  Separate multiple directories with \;.
 # Use / to indicate directories, not a single \.
 
-GS_LIB_DEFAULT=$(GSROOTDIR)/lib\;$(GSROOTDIR)/Resource\;$(AROOTDIR)/fonts
+GS_LIB_DEFAULT=$(GSROOTDIR)/lib\;$(GSROOTDIR)/Resource/Font\;$(AROOTDIR)/fonts
 
 # Define whether or not searching for initialization files should always
 # look in the current directory first.  This leads to well-known security
@@ -216,10 +217,6 @@
 
 FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)epsf.dev
 
-# The list of resources to be included in the %rom% file system.
-# This is in the top makefile since the file descriptors are platform specific
-RESOURCE_LIST=Resource/CMap/ Resource/ColorSpace/ Resource/Decoding/ Resource/Fonts/ Resource/Procset/ Resource/IdiomSet/ Resource/CIDFont/
-
 # Choose whether to compile the .ps initialization files into the executable.
 # See gs.mak for details.
 

Modified: trunk/gs/src/zfile.c
===================================================================
--- trunk/gs/src/zfile.c	2006-07-06 17:12:15 UTC (rev 6898)
+++ trunk/gs/src/zfile.c	2006-07-06 21:32:50 UTC (rev 6899)
@@ -898,10 +898,9 @@
 /* Return 0 if successful, error code if not. */
 /* On a successful return, the C file name is in the stream buffer. */
 /* If fname==0, set up stream, and buffer. */
-private int
+int
 file_prepare_stream(const char *fname, uint len, const char *file_access, 
-		 uint buffer_size, stream ** ps, char fmode[4], 
-		 gx_io_device *iodev, gs_memory_t *mem)
+		 uint buffer_size, stream ** ps, char fmode[4], gs_memory_t *mem)
 {
     byte *buffer;
     register stream *s;
@@ -1134,8 +1133,7 @@
 
     if (!iodev)
 	iodev = iodev_default;
-    code = file_prepare_stream(fname, len, file_access, buffer_size, ps, fmode, 
-			    (!iodev ? iodev_default : iodev), mem);
+    code = file_prepare_stream(fname, len, file_access, buffer_size, ps, fmode, mem);
     if (code < 0)
 	return code;
     if (fname == 0)



More information about the gs-cvs mailing list