summaryrefslogtreecommitdiff
path: root/gs/src/ibnum.c
diff options
context:
space:
mode:
authorStefan Kemper <stefan.kemper@artifex.com>2004-08-04 19:36:13 +0000
committerStefan Kemper <stefan.kemper@artifex.com>2004-08-04 19:36:13 +0000
commit6c95585894bbef5272bc99f7504e2304b92d6236 (patch)
treefad6c41436d9698d33babe98ec7f394de1af6e3d /gs/src/ibnum.c
parent53cf8957cca90409aac0092a899afbc18cae33a1 (diff)
Addition of a Library Context to start the process of removing globals.
DETAILS : The goals is to remove globals from the system, this includes static globals that would hinder multiple threads from running at once. gs_lib_ctx is intended to be used as the opaque "handle" object that a client would use to associate with a thread running through the library. Independent of a gs or a language switch build, this needs a new iapi2.h that allows the use of better job control from the client side. gs_lib_ctx is stashed under the gs_memory_t object and all memory objects used by a thread refer to the same gs_lib_ctx. This storage location was choosen as a convenence since a memory_t pointer is common throughout the system. Most of the turmoil is adding memory_t pointers to functions that used global variables but didn't have a memory pointer. FILE stdin, stdout, stderr are one per process by default. stdin and stdout may be changed but stderr may not. FILE stderr is one per process and shouldn't be changed. Note the stderr_fn is also one per process, changing this function pointer will not help as most users of stderr printing do not have a thread handle. Changing to a thread local storage mechanism can solve this. gs_id's are currently per thread with each thread starting over at 1. This can be moved to per process with mutexes if so desired. A library context has a pointer to the top_of_system the intent is that this a void handle avaliable to make top of the system calls without knowing the data type. In a postscript only build this would be gs_main_instance but in a language switched build this would be an object above that main_universe. Other members of gs_lib_ctx_t are nothing more than global objects relocated to this "bag". gs_name_table, dict_autoexpand are examples of this. There are a few more globals that will be moved. At the moment iapi is still constrained to one thread, since some of the globals haven't been removed yet. The display device's callback function setting is supported for now but this interface should be changed to a sDEVICE style call. gs_memory_t is the base type the abstract type gs_raw_memory_t is gone, this means that all memory types must derive from gs_memory_t. In addition to a pointer to the gs_lib_ctx there is a pointer to a non_gc_memory this will always point to a non garbage collected memory, it maybe the current object or an object below the current gargabe collected memory space. This can be used were the previous code used the global gs_malloc_memory. gs_malloc() now takes a memory pointer, it finds the non-gc memory from a valid memory pointer and allocates from it. The gdevbit device has an improved algorthym for converting from cmyk to rgb, this is never used by postscript but for pcl rops it puts the k plane into rgb. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@5215 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'gs/src/ibnum.c')
-rw-r--r--gs/src/ibnum.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gs/src/ibnum.c b/gs/src/ibnum.c
index 1dd16b755..e8c65fb62 100644
--- a/gs/src/ibnum.c
+++ b/gs/src/ibnum.c
@@ -76,10 +76,10 @@ num_array_size(const ref * op, int format)
/* Return t_int if integer, t_real if real, t_null if end of stream, */
/* or an error if the format is invalid. */
int
-num_array_get(const ref * op, int format, uint index, ref * np)
+num_array_get(const gs_memory_t *mem, const ref * op, int format, uint index, ref * np)
{
if (format == num_array) {
- int code = array_get(op, (long)index, np);
+ int code = array_get(mem, op, (long)index, np);
if (code < 0)
return t_null;