summaryrefslogtreecommitdiff
path: root/gs/base/gslib.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-09-13 00:40:03 +0100
committerRobin Watts <robin@peeves.(none)>2012-09-18 05:28:21 -0700
commit6777c88fab2afc3e6558fda1dfb51110088ede61 (patch)
treeab0ee337b8e03be4a595703c7177e76ac206e037 /gs/base/gslib.c
parent1fa1eca3be2955e1ed1f8433c18d06417ea85f4c (diff)
downloadghostpdl-6777c88fab2afc3e6558fda1dfb51110088ede61.tar.gz
Introduce GS_THREADSAFE define and modify printing calls.
Lots of debugging/error information is printed using eprintf and dlprintf etc. These functions do not take a gs_memory_t * and are not safe for use within code that runs under multiple instances created by gsapi. Introduce new versions (dmprintf, dmlprintf etc) that DO take a gs_memory_ *, and move as much of ghostscript/ghostpdl's usage over to these as possible. I have not touched the contrib directory, and some locations in the code do not easily have a gs_memory_t to hand, so I have left them be. If the GS_THREADSAFE define is made during building, then the functions that don't take an explicit memory handle are #defined away to nothing. If the GS_THREADSAFE define is made, we disable the gsapi check that checks for a single init.
Diffstat (limited to 'gs/base/gslib.c')
-rw-r--r--gs/base/gslib.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/gs/base/gslib.c b/gs/base/gslib.c
index 3b3d1b989..54161b4ab 100644
--- a/gs/base/gslib.c
+++ b/gs/base/gslib.c
@@ -143,9 +143,9 @@ main(int argc, const char *argv[])
lprintf1("reading Name failed! code = %d\n", code);
gs_abort(mem);
}
- dputs("Device name = ");
- debug_print_string(nstr.data, nstr.size);
- dputs("\n");
+ dmputs(dev->memory, "Device name = ");
+ debug_print_string(dev->memory, nstr.data, nstr.size);
+ dmputs(dev->memory, "\n");
gs_c_param_list_release(&list);
}
/*
@@ -196,12 +196,12 @@ main(int argc, const char *argv[])
gs_rect bbox;
gx_device_bbox_bbox(bbdev, &bbox);
- dprintf4("Bounding box: [%g %g %g %g]\n",
+ dmprintf4(mem, "Bounding box: [%g %g %g %g]\n",
bbox.p.x, bbox.p.y, bbox.q.x, bbox.q.y);
}
if (code)
- dprintf1("**** Test returned code = %d.\n", code);
- dputs("Done. Press <enter> to exit.");
+ dmprintf1(mem, "**** Test returned code = %d.\n", code);
+ dmputs(mem, "Done. Press <enter> to exit.");
fgetc(mem->gs_lib_ctx->fstdin);
gs_lib_finit(0, 0, mem);
return 0;
@@ -817,12 +817,12 @@ test7(gs_state * pgs, gs_memory_t * mem)
/* Fabricate a Type 5 halftone. */
code = gs_ht_build(&pht, 1, mem);
- dprintf1("ht build code = %d\n", code);
+ dmprintf1(mem, "ht build code = %d\n", code);
code = gs_ht_set_mask_comp(pht, 0,
4, 4, 4, masks, NULL, NULL);
- dprintf1("set mask code = %d\n", code);
+ dmprintf1(mem, "set mask code = %d\n", code);
code = gs_sethalftone(pgs, pht);
- dprintf1("sethalftone code = %d\n", code);
+ dmprintf1(mem, "sethalftone code = %d\n", code);
for (i = 0; i <= 4; ++i) {
gs_setgray(pgs, i / 4.0);
fill_rect1(pgs, 100 + i * 100, 100, 50, 50);