[gs-devel] ESP/GPL GhostScript merger: "pcl3" driver and undocumented removal of "gs_main_instance_default()"

Till Kamppeter till.kamppeter at gmail.com
Wed Apr 25 09:50:36 PDT 2007


I got also "lx5000" building now, replacing "gs_memory_default" by 
"gs_lib_ctx_get_non_gc_memory_t()".

I hope this is correct.

    Till

Stefan Kemper wrote:
> Use gs_lib_ctx_get_non_gc_memory_t() instead of a global, in all the
> alloc free calls.
> 
> get_minst_from_memory() has risks if you call it prior to the
> postscript interpreter coming up, not likely in a device, see ray's
> note.
> 
> ghostscript doesn't support multiple threads at this time...
> 
> 
> 
> On 4/25/07, Till Kamppeter <till.kamppeter at gmail.com> wrote:
>> Thank you very much, now all source files of the "pcl3" driver compile.
>>
>> Problems now are the following:
>>
>> 1. "pcl3" does not link. I get:
>>
>> -------------------------------------------------------------------------- 
>>
>> ./obj/eprnparm.o:(.bss+0x0): multiple definition of `mem'
>> ./obj/gdeveprn.o:(.bss+0x0): first defined here
>> ./obj/eprnrend.o:(.bss+0x0): multiple definition of `mem'
>> ./obj/gdeveprn.o:(.bss+0x0): first defined here
>> ./obj/eprnfs.o:(.bss+0x0): multiple definition of `mem'
>> ./obj/gdeveprn.o:(.bss+0x0): first defined here
>> ./obj/gdevpcl3.o:(.bss+0x0): multiple definition of `mem'
>> ./obj/gdeveprn.o:(.bss+0x0): first defined here
>> ./obj/pclcap.o:(.bss+0x0): multiple definition of `mem'
>> ./obj/gdeveprn.o:(.bss+0x0): first defined here
>> -------------------------------------------------------------------------- 
>>
>>
>> How can I introduce one global variable of type gs_memory_t* so that all
>> legacy drivers can use it for the "gs_malloc" and "gs_free" calls?
>>
>> 2. You say that your suggested solutions fail in multi-threaded
>> environments. What should I do? Can I block multi-threading for this
>> driver (slow printing is better than loosing support for certain printer
>> models). Or is there any other way to do the task of
>> "eprn_forget_defaultmatrix"?
>>
>> These problems show that it is urgent to get all GhostScript built-in
>> drivers modularized into pluggable OpenPrinting Vector drivers (see
>> http://www.linux-foundation.org/en/OpenPrinting/Implementation, task 3B).
>>
>>     Till
>>
>>
>> Stefan Kemper wrote:
>> > get_minst_from_memory(gs_lib_ctx_get_non_gc_memory_t())->i_ctx_p->pgs
>> >
>> > does the same as gs_main_instance_default,
>> > use of either the earlier method or the above one fails spectacularly
>> > in a multithreaded environment.
>> >
>> > Stefan
>> >
>> > On 4/25/07, Till Kamppeter <till.kamppeter at gmail.com> wrote:
>> >> Thank you very much for your help, but how do I apply this? How do I
>> >> declare the variable "mem"? With which do I replace
>> >> "gs_main_instance_default()" then?
>> >>
>> >>     Till
>> >>
>> >> Stefan Kemper wrote:
>> >> > mem  = gs_lib_ctx_get_non_gc_memory_t();
>> >> > gs_main_instance* get_minst_from_memory(mem);
>> >> >
>> >> > Might do the trick for you.
>> >> >
>> >> > Stefan
>> >> >
>> >> > On 4/25/07, Till Kamppeter <till.kamppeter at gmail.com> wrote:
>> >> >> Hi,
>> >> >>
>> >> >> I tried again to port the "pcl3" driver to GPL GhostScript 8.57. 
>> Now I
>> >> >> have introduced a variable
>> >> >>
>> >> >> gs_memory_t *mem;
>> >> >>
>> >> >> in contrib/pcl3/eprn/gdeveprn.h to be used with all gs_malloc and
>> >> >> gs_free calls. Compilation output is the following now:
>> >> >>
>> >> >> ------------------------------------------------------------------
>> >> >> ./contrib/pcl3/eprn/gdeveprn.c: In function 'eprn_set_page_layout':
>> >> >> ./contrib/pcl3/eprn/gdeveprn.c:665: warning: suggest parentheses
>> >> around
>> >> >> && within ||
>> >> >> ./contrib/pcl3/eprn/gdeveprn.c: In function
>> >> 'eprn_forget_defaultmatrix':
>> >> >> ./contrib/pcl3/eprn/gdeveprn.c:1116: warning: implicit 
>> declaration of
>> >> >> function 'gs_main_instance_default'
>> >> >> ./contrib/pcl3/eprn/gdeveprn.c:1116: error: invalid type argument
>> >> of '->'
>> >> >> ------------------------------------------------------------------
>> >> >>
>> >> >> The error is caused by the removal of "gs_main_instance_default()"
>> >> from
>> >> >> GhostScript and the "pcl3" driver uses it once in
>> >> >> contrib/pcl3/eprn/gdeveprn.c:
>> >> >>
>> >> >> ------------------------------------------------------------------
>> >> >> -static void eprn_forget_defaultmatrix(void)
>> >> >> {
>> >> >> #if EPRN_USE_GSTATE
>> >> >>    /* Old ghostscript versions */
>> >> >>    gs_setdefaultmatrix(igs, NULL);
>> >> >> #else
>> >> >>    gs_setdefaultmatrix(gs_main_instance_default()->i_ctx_p->pgs,
>> >> NULL);
>> >> >> #endif
>> >> >>
>> >> >>    return;
>> >> >> }
>> >> >> -----------------------------------------------------------------
>> >> >>
>> >> >> How should I replace this one?
>> >> >>
>> >> >>     Till
>> >> >> _______________________________________________
>> >> >> gs-devel mailing list
>> >> >> gs-devel at ghostscript.com
>> >> >> http://www.ghostscript.com/mailman/listinfo/gs-devel
>> >> >>
>> >> >
>> >>
>> >>
>> >
>>
>>
> 




More information about the gs-devel mailing list