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

leonardo at ghostscript.com leonardo at ghostscript.com
Mon Apr 9 23:54:37 PDT 2007


Author: leonardo
Date: 2007-04-09 23:54:36 -0700 (Mon, 09 Apr 2007)
New Revision: 7839

Modified:
   trunk/gs/src/gxband.h
   trunk/gs/src/gxclfile.c
   trunk/gs/src/gxclio.h
   trunk/gs/src/gxclist.c
   trunk/gs/src/gxclmem.c
   trunk/gs/src/gxclread.c
   trunk/gs/src/lib.mak
Log:
Make the memory clist implementation to build always.

DETAILS : 

This is a preparation for fixing the bug 688396, step 2.
The memory clist implementation now builds unconditionally,
because it will be used for large patterns.
The file clist implementation builds if and only if it is requested with 
BAND_LIST_STORAGE=file .
See comment added into lib.mak .
clist_init_io_procs implements the choice.

Minor changes : io_procs are made const.
clist_io_procs_file, clist_io_procs_memory, allocateWithReserve are made local.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/src/gxband.h
===================================================================
--- trunk/gs/src/gxband.h	2007-04-09 20:50:20 UTC (rev 7838)
+++ trunk/gs/src/gxband.h	2007-04-10 06:54:36 UTC (rev 7839)
@@ -61,7 +61,7 @@
     clist_file_ptr cfile;	/* command file, normally 0 */
     char bfname[gp_file_name_sizeof];	/* block file name */
     clist_file_ptr bfile;	/* block file, normally 0 */
-    clist_io_procs_t *io_procs;
+    const clist_io_procs_t *io_procs;
     uint tile_cache_size;	/* size of tile cache */
     int64_t bfile_end_pos;		/* ftell at end of bfile */
     gx_band_params_t band_params;  /* parameters used when writing band list */

Modified: trunk/gs/src/gxclfile.c
===================================================================
--- trunk/gs/src/gxclfile.c	2007-04-09 20:50:20 UTC (rev 7838)
+++ trunk/gs/src/gxclfile.c	2007-04-10 06:54:36 UTC (rev 7839)
@@ -25,8 +25,6 @@
 /* This is an implementation of the command list I/O interface */
 /* that uses the file system for storage. */
 
-extern clist_io_procs_t *clist_io_procs_file_global;
-
 /* ------ Open/close/unlink ------ */
 
 private int
@@ -155,7 +153,7 @@
     return gp_fseek_64((FILE *) cf, offset, mode);
 }
 
-clist_io_procs_t clist_io_procs_file = {
+private clist_io_procs_t clist_io_procs_file = {
     clist_fopen,
     clist_fclose,
     clist_unlink,
@@ -168,7 +166,7 @@
     clist_fseek,
 };
 
-init_proc(gs_clist_init);
+init_proc(gs_gxclfile_init);
 int
 gs_gxclfile_init(gs_memory_t *mem)
 {

Modified: trunk/gs/src/gxclio.h
===================================================================
--- trunk/gs/src/gxclio.h	2007-04-09 20:50:20 UTC (rev 7838)
+++ trunk/gs/src/gxclio.h	2007-04-10 06:54:36 UTC (rev 7839)
@@ -90,6 +90,7 @@
 
 typedef struct clist_io_procs_s clist_io_procs_t;
 
-extern clist_io_procs_t *clist_io_procs_file_global;
+extern const clist_io_procs_t *clist_io_procs_file_global;
+extern const clist_io_procs_t *clist_io_procs_memory_global;
 
 #endif /* gxclio_INCLUDED */

Modified: trunk/gs/src/gxclist.c
===================================================================
--- trunk/gs/src/gxclist.c	2007-04-09 20:50:20 UTC (rev 7838)
+++ trunk/gs/src/gxclist.c	2007-04-10 06:54:36 UTC (rev 7839)
@@ -142,20 +142,19 @@
 /*------------------- Choose the implementation -----------------------
 
    For chossing the clist i/o implementation by makefile options
-   we define a global variable, which is initialized with
-   file io procs when they are included into the build.
+   we define global variables, which are initialized with
+   file/memory io procs when they are included into the build.
  */
-clist_io_procs_t *clist_io_procs_file_global = NULL;
+const clist_io_procs_t *clist_io_procs_file_global = NULL;
+const clist_io_procs_t *clist_io_procs_memory_global = NULL;
 
 void 
 clist_init_io_procs(gx_device_clist *pclist_dev, bool in_memory)
 {   
-#if 0 /* reserved for future use */
     if (in_memory || clist_io_procs_file_global == NULL)
 	pclist_dev->common.page_info.io_procs = pclist_dev->reader.page_info.io_procs = 
-		pclist_dev->writer.page_info.io_procs = &clist_io_procs_memory;
+		pclist_dev->writer.page_info.io_procs = clist_io_procs_memory_global;
     else
-#endif
 	pclist_dev->common.page_info.io_procs = pclist_dev->reader.page_info.io_procs = 
 		pclist_dev->writer.page_info.io_procs = clist_io_procs_file_global;
 }

Modified: trunk/gs/src/gxclmem.c
===================================================================
--- trunk/gs/src/gxclmem.c	2007-04-09 20:50:20 UTC (rev 7838)
+++ trunk/gs/src/gxclmem.c	2007-04-10 06:54:36 UTC (rev 7839)
@@ -178,7 +178,7 @@
 #endif
 
 /* ----------------------------- Memory Allocation --------------------- */
-void *	/* allocated memory's address, 0 if failure */
+private void *	/* allocated memory's address, 0 if failure */
 allocateWithReserve(
          MEMFILE  *f,			/* file to allocate mem to */
          int      sizeofBlock,		/* size of block to allocate */
@@ -1138,6 +1138,7 @@
     memfile_fseek,
 };
 
+init_proc(gs_gxclmem_init);
 int
 gs_gxclmem_init(gs_memory_t *mem)
 {

Modified: trunk/gs/src/gxclread.c
===================================================================
--- trunk/gs/src/gxclread.c	2007-04-09 20:50:20 UTC (rev 7838)
+++ trunk/gs/src/gxclread.c	2007-04-10 06:54:36 UTC (rev 7839)
@@ -60,7 +60,7 @@
 s_band_read_init(stream_state * st)
 {
     stream_band_read_state *const ss = (stream_band_read_state *) st;
-    clist_io_procs_t *io_procs = ss->page_info.io_procs;
+    const clist_io_procs_t *io_procs = ss->page_info.io_procs;
 
     ss->left = 0;
     ss->b_this.band_min = 0;
@@ -82,7 +82,7 @@
     uint left = ss->left;
     int status = 1;
     uint count;
-    clist_io_procs_t *io_procs = ss->page_info.io_procs;
+    const clist_io_procs_t *io_procs = ss->page_info.io_procs;
 
     while ((count = wlimit - q) != 0) {
 	if (left) {		/* Read more data for the current run. */

Modified: trunk/gs/src/lib.mak
===================================================================
--- trunk/gs/src/lib.mak	2007-04-09 20:50:20 UTC (rev 7838)
+++ trunk/gs/src/lib.mak	2007-04-10 06:54:36 UTC (rev 7839)
@@ -1629,8 +1629,15 @@
 clbase4_=$(GLOBJ)gsroptab.$(OBJ) $(GLOBJ)stream.$(OBJ)
 clpath_=$(GLOBJ)gxclimag.$(OBJ) $(GLOBJ)gxclpath.$(OBJ) $(GLOBJ)gxdhtserial.$(OBJ)
 clist_=$(clbase1_) $(clbase2_) $(clbase3_) $(clbase4_) $(clpath_)
+
+# The old code selected one of clmemory, clfile depending on BAND_LIST_STORAGE.
+# Now we meed clmemory to be included permanently for large patterns,
+# and clfile to be included on demand.
+# clfile works for page clist iff it is included.
+
 $(GLD)clist.dev : $(LIB_MAK) $(ECHOGS_XE) $(clist_)\
  $(GLD)cl$(BAND_LIST_STORAGE).dev\
+ $(GLD)clmemory.dev\
  $(GLD)cfe.dev $(GLD)cfd.dev $(GLD)rle.dev $(GLD)rld.dev $(GLD)psl2cs.dev
 	$(SETMOD) $(GLD)clist $(clbase1_)
 	$(ADDMOD) $(GLD)clist -obj $(clbase2_)
@@ -1638,6 +1645,7 @@
 	$(ADDMOD) $(GLD)clist -obj $(clbase4_)
 	$(ADDMOD) $(GLD)clist -obj $(clpath_)
 	$(ADDMOD) $(GLD)clist -include $(GLD)cl$(BAND_LIST_STORAGE)
+	$(ADDMOD) $(GLD)clist -include $(GLD)clmemory
 	$(ADDMOD) $(GLD)clist -include $(GLD)cfe $(GLD)cfd $(GLD)rle $(GLD)rld $(GLD)psl2cs
 
 $(GLOBJ)gxclist.$(OBJ) : $(GLSRC)gxclist.c $(GXERR) $(memory__h) $(string__h)\



More information about the gs-cvs mailing list