| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
Re-run the "scheduled inits" procs after installing the device
into the gstate - for the benefit of pdfwrite.
For neatness, move the scheduled inits list dictionary, and the proc
to run them into internaldict, so the don't contaminate the "normal"
name space in systemdict.
(Whatever git might say, the cleverness here is due to Chris).
|
| |
|
|
|
|
|
|
| |
Just create the device once, rather than creating once, and then
calling the creation function again to see if we need to create
a default.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
/GetDeviceParam .special_op does not work in the way you might expect.
<key> /GetDeviceParam .special_op
will either return:
<key> <value> true
or
false
Update the code to cope.
|
|
|
|
| |
Also, avoid memory leak in failure case.
|
|
|
|
|
|
| |
Instead of explicitly uninstalling the page device at the end of the job (and
installing the null device), use gsave/grestore so we can back up to a gstate
with the nullpage device installed at the end of the job.
|
| |
|
| |
|
|
|
|
| |
So after reset, push a null, then the integer we need.
|
|
|
|
|
|
|
|
|
| |
Rather than just saying "yes" or "no", each language auto sensor
routine returns a score between 0 (not a match) and 100 (definite
match) inclusive.
In particular we update the PS detector with some hairy logic to
guess whether it's a PS file or not.
|
|
|
|
|
|
|
|
|
|
|
| |
The GS init code sets the device paper size on startup.
Sadly now, this happens to the null device rather than our
intended target device, so the configuration is lost.
Accordingly, make the gs language code that sets the target
device carry the page size forwards. This does not affect
normal postscript language operations, just the way the
PS language implementation in gpdl builds calls it.
|
|
|
|
|
| |
If the languages exit with InterpreterExit, don't treat this
as an error.
|
|
|
|
|
|
|
|
|
|
| |
Do the actual device setting directly using C rather than entirely
in PS. This sidesteps the 'SAFER' checks and avoids problems in
the language switching where we try to insert a device under 'SAFER'
conditions.
This is not a security risk as we'll always be putting the same
device back in each time.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We add a pl_interp_implementation function for setting a parameter
in the language. Only the PS implementation implements this currently,
and that sets the given parameters in systemdict.
While we parse arguments, we both write them into a parameter list
(which we feed to the device at the end of argument processing), and
we use the new call to pass them into the languages.
It would arguably be preferably for things to be written to the
device parameter list only if the device understood it, and the
rest could go to systemdict. This is impossible (or at least
very complicated) with the current implementation of param lists.
As it is, we end up doing pretty much the same as gs, which is
probably a good thing.
Also in this commit, we tidy up some of the arg handling; better
checks on radix numbers (both base and value), better arg
checking ("BATCHPLEASE" no longer matches for "BATCH" etc)
|
| |
|
|
|
|
|
|
|
| |
If the set_device fails, unset the device to avoid us leaving
the device hooked into the PS interpreter. This causes errors
during shutdown when the reclaim tries to remove an already
freed device.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Using the the -g and -r flags, we need to set FIXEDMEDIA and
FIXEDRESOLUTION etc in the internals of the PS interpreter.
For this to work properly , it needs to be done during the init
phase (i.e. before gs_main_init2 is called).
Accordingly, we split the psapi init call in two. We also add
some plumbing to allow us to recover the resolutions/dimensions
of the pages from the top level, and to pass that down into
the internals of the interpreter.
For neatness, we make the standard gs init calls use these too.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Simple ppm like device that responds to LanguageUsesROPs device
parameter to reconfigure itself between rendering direct to the
required output space, or rendering to RGB contone, and then
converting in a post process step.
User settable parameters:
DstBitDepth = Number of bits per component in the final output
DstComponents = Number of components in the final output
OutputAsPXM = 0 or 1 (Raw or with an approriate PxM header where
possible)
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to cope with jobs exit the server loop, we have to ensure that the
change from the nulldevice (used during gpdl initialization) and the 'real'
device being set prior to running the job, happens outside the server loop.
Otherwise the job's exiting of the server loop results in restoring to the
original state (with the nulldevice), and creating a new server loop context
from that base.
As things stand, the code will also exit the server loop to 'unset' the device
(i.e. revert back to the nulldevice) at the end of the job.
If we have to cope with a workflow that relies on making changes that really
persist between jobs, we'll have to rejig this to only unset the device
before shutting down.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
gs_lib_ctx_t's now have a 'core' structure that contains things
like stdio and gs_id records.
When we try to make a gs_lib_ctx_t from a memory pointer that
doesn't contain a gs_lib_ctx_t, we do the same as now, and
create a completely new gs_lib_ctx, but put some of the contents
in a "core" structure within it.
When we try to make a gs_lib_ctx_t from a memory pointer that
DOES contain a gs_lib_ctx_t, we share the core structure with
the original.
This enables us to have 'families' of gs_lib_ctx_t's that share
the important things like stdin/stderr and gs_id records, while
keeping other things private (such as the io device tables which
are specific to individual languages).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When we set the device for gs, trigger the graphics state to
initialise. This fix (credit to Chris) should hopefully solve
the differences we were seeing between gs and gpdl in the graphics
state setup.
Calling gpdl and gs with:
-sDEVICE=ppmraw -r300 -dMaxBitmap=800000000
and a simple file that does a stroke was causing the stroking
code to be called with stroke_adjust = 1 in the gpdl case,
and stroke_adjust = 0 in the gs case.
After this fix, both are called with stroke_adjust = 0.
It is possible that this will resolve the differences in halftone
output we were seeing before.
|
|
|
|
|
| |
Now our gpdl library lives under the same API as our gs one
always has.
|
|
|
|
|
|
|
|
|
| |
First we separate iapi.obj from the bulk of the PSI objs,
then we arrange for a list of objects to be made without
including that object file as well as the usual list with
it.
We use that reduced list to link with gpdl.
|
|
|
|
|
|
|
| |
The ps_implementation for gpdl can now call psapi rather than gsapi.
This frees us up to replace plapi with a new implementation of
gsapi later.
|
| |
|
|
|
|
|
|
| |
Previously pl_process_file would crash if called for an
interpreter that didn't provide a proc_process_file function
pointer. Now we fall back to processing using strings.
|
|
|
|
|
| |
We don't need to hold the "desired_implementation" globally
as it's effectively local to one routine.
|
|
|
|
|
|
|
|
|
| |
Rather than having separate "init_job", "set_device" and
"remove_device", "dnit_job" entry points, roll each pair
into one.
We never want to init a job without setting the device,
neither do we want to remove a device without dniting the job.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Non-windows builds of PCL use realmain.c as their top level
function.
After running the command line using plapi_init_with_args
this feeds a PJL_UEL in using plapi_run_string_XXXX (for no
particularly good reason other than exercising our API).
Until now this hasn't done anything. Now we are implementing
plapi_run_string_XXXX, this is falling on its face due to
the code not accepting the (expected) return code of
gs_error_InterpreterExit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When asked to gsapi_run_file, we call gs_main_run_file, which
opens a file from the PS lib path, and runs it directly.
This precludes it working with PDF files.
The usual route with ghostscript is for things to get called
via "argproc" which calls "<filename> .runfile" using run_string.
We introduce gs_main_run_file2 to do the same, and make
gsapi_run_file call that instead. Possibly at some point we may want
to remove gs_main_run_file.
|
| |
|
|
|
|
|
|
|
| |
Use this offset rather than searching for UEL.
This has required us to tidy up the allocation/deallocation of
the postscript interpreter instance.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rather than relying on "PS_INTERP_ACT_ON_UEL" being in the
systemdict, put a flag in the gs_lib_ctx.
This flag is 0 by default, and we provide a gsapi_act_on_uel()
call to set it to 1.
We have a new .actonuel operator to get the value,
and we modify .forceinterp_exit and the PS setup code to use
this instead.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Ghostscript's API needs run_string_begin, run_string and run_string_end
calls. Originally I use the existing pl_dnit_job() call, but as that is
called for running by file as well as by buffer, it's less than ideal -
calling run_string_end with the _begin didn't *currently* cause an issue,
but it wasn't nice.
|
|
|
|
|
|
|
|
|
| |
This meant adding a new API call, process_begin().
Fix ps_impl_flush_to_eoj() so it actually does flush to EOJ.
Also also use ps_impl_process_eof() - that might need to change in favour of
a new process_end() call (as a match for _begin).
|
|
|
|
|
|
| |
The shared device can now belong to one of the interpreter's memory
allocators, so if the interpreters are shut down first, the free may
fail.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1) Adds gs_main_set_device() and gsapi_set_device() calls so the Ghostscript
device can be set via the C API. Not as trivial as for the other languages
since it requires the Postscript world to be properly synced with the
internals.
2) Adds a proc_get_device_memory() API into the language switching
interpreter implementation structure.
3) Tweak how Ghostscript is initialized from the language switching code,
so the garbage collecting allocator is available when we want to create a
new device.
4) Add the code in ps_impl_set_device() to call the new API calls added in 1).
5) Have a debug build throw an assert should more than one interpreter supply
an allocator from the proc_get_device_memory() call.
|
|
|
|
|
| |
This retrieves the allocator with which Ghostscript wants the
device allocated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The existing gs_register_root() API allows for two ways to call the function.
The first is for the client to pass in a pointer to a garbager root structure
to use, allowing the client to hold onto that root so it can, later,
unregister the root.
The second, the client passed in a NULL pointer for the garbager root structure,
and the allocator will allocate its root internally. Roots such as these are
not visible/accessible outside the allocator.
The problem with the former is that it requires the full definition of the
gs_gc_root_t type to be available to the caller: that is a dependency nightmare
(due to assumptions in the original design).
The problem with the second is that the caller has no record with which to
unregister the root.
This commit changes the API so it takes a pointer to a pointer to gs_gc_root_t.
If the gs_gc_root_t ** parameter is NULL, the behaviour is the same as the
existing code (the root is allocated and only visible inside the allocator).
If the gs_gc_root_t ** points to a "real" gs_gc_root_t *, that is the client
supplied root.
The new part is if gs_gc_root_t ** points to a NULL gs_gc_root_t *, the
allocator will allocate a new root, and return it to the client via the
pointer-pointer parameter.
Importantly, this allows gs_gc_root_t to be opaque for client code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug #700322 " Endless loop when converting pdf to text "
While trying to fit text (text format 2 or 3) we do some heuristic
juggling to decide whether or not to use a calculated minimum size.
During this we check to see whether the width is zero, and if it is
we don't try to use it because it would result in an infinite loop.
We actually need to allow a little 'slop' around zero, in case floating
point errors result in a very small, but not quite zero, width.
The loop resuling in the bug isn't endless, but it is very lengthy.
|
|
|
|
|
|
|
| |
For devices that are separable, (GX_CINFO_SEP_LIN), it is better to use
the comp_bits to determine the depth of a plane. Seen with the display
device in spot color mode where dest_depth calculation from the depth
divided by num_components is not correct.
|