summaryrefslogtreecommitdiff
path: root/gs/src/gscspace.h
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/gscspace.h
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/gscspace.h')
-rw-r--r--gs/src/gscspace.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/gs/src/gscspace.h b/gs/src/gscspace.h
index a489320b6..e9bde4fdc 100644
--- a/gs/src/gscspace.h
+++ b/gs/src/gscspace.h
@@ -287,7 +287,7 @@ typedef ulong gs_separation_name; /* BOGUS */
* names.
*/
typedef int (gs_callback_func_get_colorname_string)
- (gs_separation_name colorname, unsigned char **ppstr, unsigned int *plen);
+ (const gs_memory_t *mem, gs_separation_name colorname, unsigned char **ppstr, unsigned int *plen);
typedef enum { SEP_NONE, SEP_ALL, SEP_OTHER } separation_type;
@@ -426,13 +426,13 @@ typedef struct gs_color_space_s gs_color_space;
*/
extern int
- gs_cspace_init_DeviceGray(gs_color_space *pcs),
+ gs_cspace_init_DeviceGray(const gs_memory_t *mem, gs_color_space *pcs),
gs_cspace_build_DeviceGray(gs_color_space ** ppcspace,
gs_memory_t * pmem),
- gs_cspace_init_DeviceRGB(gs_color_space *pcs),
+ gs_cspace_init_DeviceRGB(const gs_memory_t *mem, gs_color_space *pcs),
gs_cspace_build_DeviceRGB(gs_color_space ** ppcspace,
gs_memory_t * pmem),
- gs_cspace_init_DeviceCMYK(gs_color_space *pcs),
+ gs_cspace_init_DeviceCMYK(const gs_memory_t *mem, gs_color_space *pcs),
gs_cspace_build_DeviceCMYK(gs_color_space ** ppcspace,
gs_memory_t * pmem);