[gs-cvs] rev 7009 - trunk/gs/src
ray at ghostscript.com
ray at ghostscript.com
Mon Aug 28 21:45:23 PDT 2006
Author: ray
Date: 2006-08-28 21:45:22 -0700 (Mon, 28 Aug 2006)
New Revision: 7009
Modified:
trunk/gs/src/files.h
trunk/gs/src/sfxstdio.c
trunk/gs/src/stream.c
trunk/gs/src/stream.h
trunk/gs/src/zfile.c
Log:
Port changes over from the gs853merge tree to allow building a graphics
lib with strmio, but without any interpreter modules (PCL6).
Modified: trunk/gs/src/files.h
===================================================================
--- trunk/gs/src/files.h 2006-08-29 04:26:49 UTC (rev 7008)
+++ trunk/gs/src/files.h 2006-08-29 04:45:22 UTC (rev 7009)
@@ -48,21 +48,6 @@
void make_invalid_file(ref *);
/*
- * Macros for checking file validity.
- * NOTE: in order to work around a bug in the Borland 5.0 compiler,
- * you must use file_is_invalid rather than !file_is_valid.
- */
-#define file_is_valid(svar,op)\
- (svar = fptr(op), (svar->read_id | svar->write_id) == r_size(op))
-#define file_is_invalid(svar,op)\
- (svar = fptr(op), (svar->read_id | svar->write_id) != r_size(op))
-#define check_file(svar,op)\
- BEGIN\
- check_type(*(op), t_file);\
- if ( file_is_invalid(svar, op) ) return_error(e_invalidaccess);\
- END
-
-/*
* If a file is open for both reading and writing, its read_id, write_id,
* and stream procedures and modes reflect the current mode of use;
* an id check failure will switch it to the other mode.
Modified: trunk/gs/src/sfxstdio.c
===================================================================
--- trunk/gs/src/sfxstdio.c 2006-08-29 04:26:49 UTC (rev 7008)
+++ trunk/gs/src/sfxstdio.c 2006-08-29 04:45:22 UTC (rev 7009)
@@ -42,7 +42,8 @@
/* ------ File reading ------ */
-extern const uint file_default_buffer_size;
+#define DEFAULT_BUFFER_SIZE 2048
+const uint file_default_buffer_size = DEFAULT_BUFFER_SIZE;
/* Prepare a stream with a file name. */
/* Return 0 if successful, error code if not. */
Modified: trunk/gs/src/stream.c
===================================================================
--- trunk/gs/src/stream.c 2006-08-29 04:26:49 UTC (rev 7008)
+++ trunk/gs/src/stream.c 2006-08-29 04:45:22 UTC (rev 7009)
@@ -1219,6 +1219,40 @@
return 0;
}
+/* ------ Stream closing ------ */
+
+/*
+ * Finish closing a file stream. This used to check whether it was
+ * currentfile, but we don't have to do this any longer. This replaces the
+ * close procedure for the std* streams, which cannot actually be closed.
+ *
+ * This is exported for ziodev.c. */
+int
+file_close_finish(stream * s)
+{
+ return 0;
+}
+
+/*
+ * Close a file stream, but don't deallocate the buffer. This replaces the
+ * close procedure for %lineedit and %statementedit. (This is WRONG: these
+ * streams should allocate a new buffer each time they are opened, but that
+ * would overstress the allocator right now.) This is exported for ziodev.c.
+ * This also replaces the close procedure for the string-reading stream
+ * created for gs_run_string.
+ */
+int
+file_close_disable(stream * s)
+{
+ int code = (*s->save_close)(s);
+
+ if (code)
+ return code;
+ /* Increment the IDs to prevent further access. */
+ s->read_id = s->write_id = (s->read_id | s->write_id) + 1;
+ return file_close_finish(s);
+}
+
/* ------ NullEncode/Decode ------ */
/* Process a buffer */
Modified: trunk/gs/src/stream.h
===================================================================
--- trunk/gs/src/stream.h 2006-08-29 04:26:49 UTC (rev 7008)
+++ trunk/gs/src/stream.h 2006-08-29 04:45:22 UTC (rev 7009)
@@ -349,9 +349,29 @@
/* Allocate and return a file stream. */
stream * file_alloc_stream(gs_memory_t *, client_name_t);
+/*
+ * Macros for checking file validity.
+ * NOTE: in order to work around a bug in the Borland 5.0 compiler,
+ * you must use file_is_invalid rather than !file_is_valid.
+ */
+#define file_is_valid(svar,op)\
+ (svar = fptr(op), (svar->read_id | svar->write_id) == r_size(op))
+#define file_is_invalid(svar,op)\
+ (svar = fptr(op), (svar->read_id | svar->write_id) != r_size(op))
+#define check_file(svar,op)\
+ BEGIN\
+ check_type(*(op), t_file);\
+ if ( file_is_invalid(svar, op) ) return_error(e_invalidaccess);\
+ END
+
/* Close a file stream. */
int file_close_file(stream *);
+int file_close_finish(stream *);
+
+/* Disable further access on the stream by mangling the id's */
+int file_close_disable(stream *);
+
/* Create a stream on a string or a file. */
void sread_string(stream *, const byte *, uint),
sread_string_reusable(stream *, const byte *, uint),
Modified: trunk/gs/src/zfile.c
===================================================================
--- trunk/gs/src/zfile.c 2006-08-29 04:26:49 UTC (rev 7008)
+++ trunk/gs/src/zfile.c 2006-08-29 04:45:22 UTC (rev 7009)
@@ -107,7 +107,7 @@
* causing many aborted roundtrips through the JPEG filter code.
*/
#define DEFAULT_BUFFER_SIZE 2048
-const uint file_default_buffer_size = DEFAULT_BUFFER_SIZE;
+extern const uint file_default_buffer_size;
/* An invalid file object */
private stream invalid_file_stream;
@@ -1106,40 +1106,6 @@
return 0;
}
-/* ------ Stream closing ------ */
-
-/*
- * Finish closing a file stream. This used to check whether it was
- * currentfile, but we don't have to do this any longer. This replaces the
- * close procedure for the std* streams, which cannot actually be closed.
- *
- * This is exported for ziodev.c. */
-int
-file_close_finish(stream * s)
-{
- return 0;
-}
-
-/*
- * Close a file stream, but don't deallocate the buffer. This replaces the
- * close procedure for %lineedit and %statementedit. (This is WRONG: these
- * streams should allocate a new buffer each time they are opened, but that
- * would overstress the allocator right now.) This is exported for ziodev.c.
- * This also replaces the close procedure for the string-reading stream
- * created for gs_run_string.
- */
-int
-file_close_disable(stream * s)
-{
- int code = (*s->save_close)(s);
-
- if (code)
- return code;
- /* Increment the IDs to prevent further access. */
- s->read_id = s->write_id = (s->read_id | s->write_id) + 1;
- return file_close_finish(s);
-}
-
/* Close a file object. */
/* This is exported only for gsmain.c. */
int
More information about the gs-cvs
mailing list