diff options
-rw-r--r-- | Makefile.in | 17 | ||||
-rw-r--r-- | Resource/Init/gs_cet.ps | 1 | ||||
-rw-r--r-- | Resource/Init/gs_dpnxt.ps | 133 | ||||
-rw-r--r-- | Resource/Init/gs_dps.ps | 222 | ||||
-rw-r--r-- | Resource/Init/gs_img.ps | 26 | ||||
-rw-r--r-- | Resource/Init/gs_init.ps | 13 | ||||
-rw-r--r-- | Resource/Init/pdf_draw.ps | 2 | ||||
-rw-r--r-- | base/gs.mak | 14 | ||||
-rw-r--r-- | base/gsdpnext.h | 25 | ||||
-rw-r--r-- | base/gsdps.c | 111 | ||||
-rw-r--r-- | base/gsdps.h | 32 | ||||
-rw-r--r-- | base/lib.mak | 27 | ||||
-rw-r--r-- | base/openvms.mak | 6 | ||||
-rw-r--r-- | base/openvms.mmk | 9 | ||||
-rw-r--r-- | base/unix-gcc.mak | 37 | ||||
-rw-r--r-- | base/unixansi.mak | 7 | ||||
-rw-r--r-- | gpdl/pspcl6_gcc.mak | 3 | ||||
-rw-r--r-- | gpdl/pspcl6_msvc.mak | 4 | ||||
-rw-r--r-- | psi/icontext.c | 3 | ||||
-rw-r--r-- | psi/int.mak | 43 | ||||
-rw-r--r-- | psi/msvc.mak | 4 | ||||
-rw-r--r-- | psi/os2.mak | 16 | ||||
-rw-r--r-- | psi/psromfs.mak | 2 | ||||
-rw-r--r-- | psi/zcontext.c | 1338 | ||||
-rw-r--r-- | psi/zdpnext.c | 483 | ||||
-rw-r--r-- | psi/zdps.c | 277 | ||||
-rw-r--r-- | psi/zpdfops.c | 27 | ||||
-rw-r--r-- | toolbin/pre.chk | 5 | ||||
-rwxr-xr-x | toolbin/pre.tcl | 1 | ||||
-rw-r--r-- | windows/ghostscript.vcproj | 34 | ||||
-rw-r--r-- | windows/ghostscript_rt.vcxproj | 8 |
31 files changed, 91 insertions, 2839 deletions
diff --git a/Makefile.in b/Makefile.in index 32db81d79..15c18fec3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -337,7 +337,7 @@ JPEGXR_OBJDIR=$(GLOBJDIR) # Define the directory where the ijs source is stored, # and the process forking method to use for the server. # See ijs.mak for more information. - + SHARE_IJS=@SHAREIJS@ IJS_NAME=@IJSLIB@ IJSSRCDIR=@IJSDIR@ @@ -390,7 +390,7 @@ CCAUXLD=$(CCAUX) GCFLAGS=@CPPFLAGS@ @GCFLAGS@ @CFLAGS@ @HAVE_POPEN_PROTO@ GCFLAGSAUX=@GCFLAGSAUX@ @HAVE_POPEN_PROTO@ -# Define the added flags for standard, debugging, profiling +# Define the added flags for standard, debugging, profiling # and shared object builds. CFLAGS_STANDARD=@OPT_CFLAGS@ @@ -496,7 +496,7 @@ XINCLUDE=@X_CFLAGS@ #XLIBS=Xt SM ICE Xext X11 # We use the autoconf macro AC_PATH_XTRA which defines X_LIBS with -# the -L (or whatever). It also defines X_PRE_LIBS and X_EXTRA_LIBS +# the -L (or whatever). It also defines X_PRE_LIBS and X_EXTRA_LIBS # all three of which are stripped and slotted into XLIBS below. # Usually however, all but X_LIBS are empty on modern platforms. XLIBDIRS=@X_LDFLAGS@ @@ -536,7 +536,7 @@ SO_LIB_VERSION_SEPARATOR=@SO_LIB_VERSION_SEPARATOR@ # Choose the language feature(s) to include. See gs.mak for details. # if it's included, $(PSD)gs_pdfwr.dev should always be one of the last in the list -PSI_FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)epsf.dev $(PSD)ttfont.dev \ +PSI_FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)epsf.dev $(PSD)ttfont.dev \ @UTF8DEVS@ $(PSD)fapi_ps.dev $(PSD)jpx.dev $(PSD)jbig2.dev $(PSD)gs_pdfwr.dev @@ -554,9 +554,9 @@ FEATURE_DEVS=$(GLD)pipe.dev $(GLD)gsnogc.dev $(GLD)htxlib.dev $(GLD)psl3lib.dev $(GLD)pwgd.dev #FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev -#FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(GLD)pipe.dev +#FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)ttfont.dev $(GLD)pipe.dev # The following is strictly for testing. -FEATURE_DEVS_ALL=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)double.dev $(PSD)trapping.dev $(PSD)stocht.dev $(GLD)pipe.dev $(GLD)gsnogc.dev $(GLD)htxlib.dev @JBIG2DEVS@ @JPXDEVS@ @UTF8DEVS@ $(GLD)ramfs.dev +FEATURE_DEVS_ALL=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)ttfont.dev $(PSD)double.dev $(PSD)trapping.dev $(PSD)stocht.dev $(GLD)pipe.dev $(GLD)gsnogc.dev $(GLD)htxlib.dev @JBIG2DEVS@ @JPXDEVS@ @UTF8DEVS@ $(GLD)ramfs.dev #FEATURE_DEVS=$(FEATURE_DEVS_ALL) # The list of resources to be included in the %rom% file system. @@ -578,11 +578,11 @@ BAND_LIST_COMPRESSOR=zlib FILE_IMPLEMENTATION=stdio -# List of default devices, in order of priority. They need not be +# List of default devices, in order of priority. They need not be # present in the actual build. GS_DEV_DEFAULT="x11alpha bbox" -# Fallback default device. This is set to 'display' by +# Fallback default device. This is set to 'display' by # unix-dll.mak when building a shared object. DISPLAY_DEV=$(DD)bbox.dev @@ -754,4 +754,3 @@ maintainer-clean : distclean check : default $(NO_OP) - diff --git a/Resource/Init/gs_cet.ps b/Resource/Init/gs_cet.ps index 3faa18e3d..e3fa8d479 100644 --- a/Resource/Init/gs_cet.ps +++ b/Resource/Init/gs_cet.ps @@ -24,7 +24,6 @@ currentglobal //true setglobal /product (PhotoPRINT SE 5.0v2) readonly put % match CPSI 3017.102 /revision 0 put % match CPSI 3017.103 Tek shows revision 5 /serialnumber dup {233640} readonly .makeoperator put % match CPSI 3017.102 Tek shows serialnumber 1401788461 - systemdict /deviceinfo undef % for CET 20-23-1 % /UNROLLFORMS true put % CET files do unreasonable things inside forms } 1183615869 internaldict /superexec get exec diff --git a/Resource/Init/gs_dpnxt.ps b/Resource/Init/gs_dpnxt.ps deleted file mode 100644 index 8e7e241d6..000000000 --- a/Resource/Init/gs_dpnxt.ps +++ /dev/null @@ -1,133 +0,0 @@ -% Copyright (C) 2001-2018 Artifex Software, Inc. -% All Rights Reserved. -% -% This software is provided AS-IS with no warranty, either express or -% implied. -% -% This software is distributed under license and may not be copied, -% modified or distributed except as expressly authorized under the terms -% of the license contained in the file LICENSE in this distribution. -% -% Refer to licensing information at http://www.artifex.com or contact -% Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, -% CA 94945, U.S.A., +1(415)492-9861, for further information. -% - -% gs_dpnxt.ps -% NeXT Display PostScript extensions - -% Define the operation values for compositing. These must match the values -% in gsdpnext.h, which also are the ones from the NeXT documentation. -% We put them in systemdict, which seems like as good a place as any. -mark - /Clear /Copy /Sover /Sin /Sout /Satop /Dover /Din /Dout /Datop /Xor - /PlusD /PlusL /Highlight % not sure about Highlight -counttomark { counttomark 1 sub def } repeat pop - -% We implement readimage and sizeimage using the following 3 otherwise -% undocumented lower-level operators: -% -% <x> <y> <width> <height> <matrix> .sizeimagebox -% <dev_x> <dev_y> <dev_width> <dev_height> <matrix> -% -% - .sizeimageparams <bits/sample> <multiproc> <ncolors> -% -% <device> <x> <y> <width> <max_height> <alpha?> <std_depth|null> -% <string> .getbitsrect <height> <substring> -% -% NOTE: These operators are subject to change without notice! - -% Implement readimage using .getbitsrect. Experimentation on a NeXT system -% shows that the data is always returned in order of increasing device Y, -% regardless of the CTM. -% -% Note that we can't make stack protection work for this operator, -% because it must remove its operands from the stack before calling -% the supplied procedure(s). - -/readimage { % <x> <y> <width> <height> <proc> [... <procN-1>] - % <string> <alpha?> readimage - - .sizeimageparams exch { - % multiproc = true. If N > 1, store the procedures in an array. - exch pop 1 index { 1 add } if - % Stack: ... string alpha? nprocs - dup 1 eq { - pop //false % only 1 procedure, multiproc is irrelevant - } { - dup array 4 1 roll 3 add 2 roll astore 3 1 roll //true - } ifelse - } { - % multiproc = false. - pop pop //false - } ifelse - % Map the rectangle to device coordinates. - % Stack: x y w h proc(s) str alpha? multi? - 8 -4 roll matrix .sizeimagebox pop 8 4 roll - % Make sure we allocate the operand array in local VM - % to avoid a possible invalidaccess. - .currentglobal //false .setglobal 9 1 roll - exch { 1 } { 0 } ifelse exch % alpha is last, if present - exch 4 1 roll 8 array astore exch .setglobal - { % Read out a block of scan lines and pass them to the procedure. - % Stack: [x y w h alpha? proc(s) str multi?] -- we must consume this. - dup 3 get 0 eq { pop exit } if - aload 9 1 roll pop exch pop currentdevice 7 1 roll - % Always read out the data as standard (not native) pixels. - .sizeimageparams pop pop exch .getbitsrect - % Stack: [x y w h alpha? proc(s) str multi?] hread substr - 3 -1 roll - % Stack: hread substr [x y w h alpha? proc(s) str multi?] - dup 1 2 copy get 5 index add put - % Stack: hread substr [x y' w h alpha? proc(s) str multi?] - dup 3 2 copy get 6 -1 roll sub put - % Stack: substr [x y' w h' alpha? proc(s) str multi?] - dup 5 get exch 7 get { - % multiproc = true, pass each plane to a different procedure. - % Stack: substr procs - 0 1 2 index length 1 sub { - % Push 1 plane and its procedure under the top 2 elements. - % Stack: ... substr procs plane# - 2 index length 2 index length idiv % bytes per plane - dup 2 index mul exch - % Stack: ... substr procs plane# start length - 4 index 3 1 roll getinterval 4 1 roll - 2 copy get 4 1 roll pop - } for - exch pop length 2 mul .execn - } { - % multiproc = false, just call the procedure. - exec - } ifelse - } //systemdict /exec get 3 packedarray cvx loop -} bind odef - -% -% <w> <h> <bpc> <mtx> <dsrc0> ... <multi> <ncomp> alphaimage - -% -img_utils_dict begin -/.alphaimage where - { - pop - .currentglobal //true .setglobal - /alphaimage - { - //true - //.colorimage - stopped - { /alphaimage .systemvar $error /errorname get signalerror } - if - } - .bind systemdict begin odef end - .setglobal - } -if -end - -% Implement sizeimage using lower-level operators. - -/sizeimage { % <x> <y> <width> <height> <matrix> sizeimage - % <devwidth> <devheight> <bits/sample> <matrix> - % <multiproc> <ncolors> - .sizeimagebox 5 -2 roll pop pop - .sizeimageparams 3 -1 roll 4 1 roll -} bind odef diff --git a/Resource/Init/gs_dps.ps b/Resource/Init/gs_dps.ps deleted file mode 100644 index 00c14d532..000000000 --- a/Resource/Init/gs_dps.ps +++ /dev/null @@ -1,222 +0,0 @@ -% Copyright (C) 2001-2018 Artifex Software, Inc. -% All Rights Reserved. -% -% This software is provided AS-IS with no warranty, either express or -% implied. -% -% This software is distributed under license and may not be copied, -% modified or distributed except as expressly authorized under the terms -% of the license contained in the file LICENSE in this distribution. -% -% Refer to licensing information at http://www.artifex.com or contact -% Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, -% CA 94945, U.S.A., +1(415)492-9861, for further information. -% - -% Initialization file for Display PostScript functions. - -% ------ Errors ------ % - -% These errors are only defined in DPS. -{ /invalidcontext /invalidid } { .registererror } forall - -% ------ Contexts ------ % - -% To create a context with private local VM, we use the .localfork -% operator to actually create the context, the new VM, and an empty -% userdict, and then we call the .initlocaldicts procedure to make -% local copies of the initial contents of the dictionaries in local VM. -% savedlocaldicts in systemdict is a global read-only dictionary whose -% elements are global read-only copies of these initial contents; -% we just copy its elements into local VM and install them in systemdict. -% userdict and internaldict require special handling. - -% Switching between contexts with different local VMs requires -% changing the bindings in systemdict that reference local objects. -% For this purpose, each userdict has an entry called localdicts -% which holds the local copies of the elements of savedlocaldicts, -% plus internaldict. The context switching code in the interpreter -% effectively copies this dictionary into systemdict. -% NOTE: the name localdicts is known to the interpreter. - -% Switching between contexts also requires resetting the user parameters. -% The interpreter records the value of userparams (a local dictionary -% referenced from systemdict) for each context, and uses it for this. -% See gs_lev2.ps for more details. -% NOTE: the name userparams is known to the interpreter. - -% Save copies of local dictionaries at the end of system initialization. -% Also save the initial gstate. -/.savelocalstate { - .currentglobal //true .setglobal - //systemdict /savedlocaldicts mark //systemdict { - dup gcheck { - pop pop - } { - dup type /dicttype eq { - % Save a copy of this dictionary in global VM. - dup maxlength dict .copydict readonly - } { - pop pop - } ifelse - } ifelse - } forall .dicttomark readonly put - % Create localdicts for the current context. - //false .setglobal - userdict /localdicts mark savedlocaldicts { - pop dup load - } forall /internaldict dup load - .dicttomark readonly put - % Save a copy of the initial gstate. - //systemdict /savedinitialgstate gstate readonly .forceput - .setglobal -} .bind executeonly odef % must be bound and hidden for .forceput - -% Initialize local dictionaries and gstate when creating a new context. -% Note that until this completes, we are in the anomalous situation of -% having systemdict point to dictionaries that are in a non-current -% local VM. Because of this, we turn off garbage collection temporarily. -/.copylocal { % <name> <dict> .copylocal <name> <dict'> - % Copy a dictionary to the current (local) VM, - % and make it read-only if its current definition is. - dup maxlength dict .copydict - 1 index load wcheck not { readonly } if -} .bind def -% When this is called, the dictionary stack is in its initial state, -% and there is (anomalously) only one gstate on the gstate stack. -/.initlocaldicts { % - .initlocaldicts - - -2 vmreclaim - .currentglobal //systemdict begin - //false .setglobal - % Since localdicts doesn't exist yet, references from - % systemdict to local objects won't get restored if - % a context switch happens in this code. Therefore, - % until localdicts is defined, we have to keep all our - % state on the operand stack. - - % Acquire userdict. - %****** WRONG IF NON-STANDARD INITIAL DSTACK ****** - countdictstack array dictstack - { dup gcheck not { exit } if pop } forall - % Create localdicts with a local copy of each dictionary, - % except for userdict and userparams, which just need - % to be filled in. - mark savedlocaldicts { - 1 index /userdict eq { - % Stack: userdict mark ... /userdict inituserdict - counttomark 1 add index .copydict - } { - 1 index /userparams eq { - % Stack: userdict mark ... /userparams inituserparams - userparams .copydict - } { - .copylocal - } ifelse - } ifelse - } forall /internaldict dup .makeinternaldict .makeoperator - .dicttomark readonly /localdicts exch put - % localdicts is now defined in userdict. - % Copy the definitions into systemdict. - localdicts { .forcedef } forall - % Set the user parameters. - userparams readonly .setuserparams - % Establish the initial gstate(s). - /savedinitialgstate .systemvar setgstate gsave - % Wrap up. - end .setglobal -} bind executeonly odef - -% Check whether an object is a procedure. -/.proccheck { % <obj> .proccheck <bool> - dup xcheck - exch type dup /arraytype eq exch /packedarraytype eq or and -} bind def - -% Create a context with private local VM. -% The .localfork operator does all the work, but we must ensure that -% .initlocaldicts gets called when the new context starts up. -/localfork { % <mark> <obj1> ... <objN> <proc> - % <stdin|null> <stdout|null> - % localfork <context> - .currentglobal //true .setglobal 3 index - dup .proccheck not { - pop .setglobal /localfork .systemvar /typecheck signalerror - } if - {exec .initlocaldicts} aload pop - 3 1 roll 3 packedarray cvx - 4 1 roll 5 -1 roll pop .setglobal .localfork -} odef - -% Fork a context that shares VM. The .fork operator creates an empty -% userparams dictionary for the context, but we still need to initialize -% this dictionary when the new context starts up. -/.postfork { % - .postfork - - % Initialize the user parameters. - savedlocaldicts /userparams get userparams .copydict readonly pop -} odef -/fork { % <mark> <obj1> ... <objN> <proc> fork <context> - .currentglobal //false .setglobal 1 index - dup .proccheck not { - pop .setglobal /fork .systemvar /typecheck signalerror - } if - {exec .postfork} aload pop - 3 1 roll 3 packedarray cvx - 3 1 roll exch pop .setglobal .fork -} odef - -% ------ Halftone phase ------ % - -/sethalftonephase { % <x> <y> sethalftonephase - - -1 2 index 2 index .setscreenphase pop pop -} odef -/currenthalftonephase { % - currenthalftonephase <x> <y> - 0 .currentscreenphase -} odef - -% ------ Device-source images ------ */ - -.imagetypes 2 /.image2 load put - -% ------ Device information ------ % - -/.deviceinfodict mark - /Colors //null /GrayValues //null /RedValues //null /GreenValues //null - /BlueValues //null /ColorValues //null -.dicttomark readonly def -/deviceinfo { % - deviceinfo <dict> - currentdevice //.deviceinfodict .getdeviceparams .dicttomark - dup begin - /ColorValues .knownget { - 0 le - { currentdict /ColorValues undef } - { - % hack around devices that incorrect set GrayValues - Colors 3 eq { 1 } { GrayValues } ifelse - RedValues mul GreenValues mul BlueValues mul ColorValues ne - { currentdict /GrayValues undef - currentdict /RedValues undef - currentdict /GreenValues undef - currentdict /BlueValues undef - } if - } - ifelse - } if - currentdict end readonly -} odef - -% The current implementation allocates a 2-element array each time. -% Perhaps we should change this to 2 separate parameters for X and Y? -/.wtdict mark - /wtranslation //null -.dicttomark readonly def -/wtranslation { % - wtranslation <x> <y> - currentdevice //.wtdict .getdeviceparams exch pop exch pop aload pop -} odef -currentdict /.wtdict .undef - -% ------ View clipping ------ % - -/rectviewclip { % <x> <y> <width> <height> rectviewclip - - % <numarray|numstring> rectviewclip - - newpath .rectappend viewclip -} odef diff --git a/Resource/Init/gs_img.ps b/Resource/Init/gs_img.ps index 4fbc097bb..1fec3b4ca 100644 --- a/Resource/Init/gs_img.ps +++ b/Resource/Init/gs_img.ps @@ -115,22 +115,6 @@ def 5 dict dup 1 /.imagemask1 load put def -end -.setglobal - -% -% Build a dictionary of utility procedures and constants for use in -% impelementing the image operators. This dictionary is in global VM but -% is maintained (during initialization) in userdict. It should be pushed -% onto the dictionary stack when constructing image-related procedures -% and pseudo-operators. -% -% This dictionary is removed from userdict when initialization is -% completed. -% -.currentglobal //true .setglobal -userdict /img_utils_dict 30 dict put -img_utils_dict begin % % Some useful local data structures: @@ -664,7 +648,7 @@ if } ifelse } -.bind systemdict begin odef end +.bind odef % An auxiliary function for checking whether an imagemask to be interpolated. /.is_low_resolution % <image dict> .is_low_resolution <bool> @@ -742,13 +726,11 @@ if } ifelse } -.bind systemdict begin odef end +.bind odef % undefine a bunch of local definitions -% NOTE: all this goes away if we just get rid of img_utils_dict, but -% that is intertwined with gs_dps.ps, so for now, just undef the separate pieces. [ -% /.colorimage -- used in gs_dpnxt,ps, need to nuke that so we can undef all this stuff + /.colorimage /img_params_dict /img_unbuild_dict /img_unbuild_image_dict @@ -769,6 +751,6 @@ if ] {currentdict exch .undef} forall -end % img_utils_dict +end % systemdict .setglobal % restore VM mode diff --git a/Resource/Init/gs_init.ps b/Resource/Init/gs_init.ps index 124a65960..bdad7cf57 100644 --- a/Resource/Init/gs_init.ps +++ b/Resource/Init/gs_init.ps @@ -2227,19 +2227,6 @@ SAFER { .setsafeglobal } if } .bind executeonly def % must be bound and hidden for .forceundef /UndefinePostScriptOperators { - - % This list is of Display PostScript operators. We believe that Display PostScript - % was never fully implemented and the only known user, GNUStep, is no longer - % using it. So lets remove it. - [ - /condition /currentcontext /detach /.fork /join /.localfork /lock /monitor /notify - /wait /yield /.currentscreenphase /.setscreenphase /.image2 /eoviewclip /initviewclip - /viewclip /viewclippath /defineusername - % NeXT DPS extensions - /currentalpha /setalpha /.alphaimage /composite /compositerect /dissolve /sizeimagebox /.sizeimageparams - ] - {systemdict exch .forceundef} forall - % This list is of operators which no longer appear to be used, and which we do not believe % to have any real use. For now we will undefine the operstors so they cannot easily be used % but can be easily restored (just delete the name from the list in the array). In future diff --git a/Resource/Init/pdf_draw.ps b/Resource/Init/pdf_draw.ps index b2c89aebb..f0b3aed6f 100644 --- a/Resource/Init/pdf_draw.ps +++ b/Resource/Init/pdf_draw.ps @@ -427,7 +427,7 @@ end } ifelse } bind executeonly def /sethalftonephases { - /sethalftonephase where { pop aload pop sethalftonephase } { pop } ifelse + aload pop -1 2 index 2 index .setscreenphase pop pop } bind executeonly def /HT { diff --git a/base/gs.mak b/base/gs.mak index a57192420..7ff92d622 100644 --- a/base/gs.mak +++ b/base/gs.mak @@ -69,8 +69,8 @@ # typically 'jbig2dec' or 'jbig2dec-/version/' # JPX_LIB - choice of which jpeg2k implementation to use # SHARE_JPX - If set to 1, asks the linker to use an existing -# complied jpeg2k library. If set to 0, asks to compile and -# link from a local copy of the source using our custom +# complied jpeg2k library. If set to 0, asks to compile and +# link from a local copy of the source using our custom # makefile. # JPXSRCDIR - the name of the jpeg2k library source directory # e.g. 'openjpeg' @@ -95,7 +95,7 @@ # pdf - a PDF 1.2 interpreter. # psl3 includes everything in psl2, and psl2 includes everything # in psl1. For backward compatibility, level1 is a synonym for -# psl1, and level2 is a synonym for psl2. +# psl1, and level2 is a synonym for psl2. # The remaining features are of interest primarily to developers # who want to "mix and match" features to create custom # configurations: @@ -113,8 +113,6 @@ # paramter for each %disk (see Language.htm). # dps - (partial) support for Display PostScript extensions: # see Language.htm for details. -# dpsnext - (partial) support for Display PostScript -# extensions with NeXT's additions. # epsf - support for recognizing and skipping the binary # header of MS-DOS EPSF files. # filter - support for Level 2 filters (other than eexec, @@ -139,7 +137,7 @@ # COMPILE_INITS - normally 1; compiles the PostScript language # initialization files (gs_init.ps et al) and Resource/* tree # into the executable, eliminating the need for these files -# to be present at run time. Files will be placed in the +# to be present at run time. Files will be placed in the # %rom% device. # BAND_LIST_STORAGE - normally file; if set to memory, stores band # lists in memory (with compression if needed). @@ -393,7 +391,7 @@ DEVICE_DEVS_ALL=$(DEVICE_DEVS) $(DEVICE_DEVS1) \ $(DEVICE_DEVS10) $(DEVICE_DEVS11) $(DEVICE_DEVS12) $(DEVICE_DEVS13) \ $(DEVICE_DEVS14) $(DEVICE_DEVS15) $(DEVICE_DEVS16) $(DEVICE_DEVS17) \ $(DEVICE_DEVS18) $(DEVICE_DEVS19) $(DEVICE_DEVS20) $(DEVICE_DEVS21) \ - $(DEVICE_DEVS_EXTRA) + $(DEVICE_DEVS_EXTRA) PSI_DEVS_ALL=$(GSPLAT_DEVS_ALL) \ $(PSI_FEATURE_DEVS) \ @@ -533,7 +531,7 @@ $(gconfxx_h) : $(ld_tr) $(gconfig_h) : $(gconfxx_h) $(RM_) $(gconfig_h) $(CP_) $(gconfxx_h) $(gconfig_h) - + # The line above is an empty command; don't delete. # save our set of makefile variables that are defined in every build (paths, etc.) diff --git a/base/gsdpnext.h b/base/gsdpnext.h deleted file mode 100644 index 392d6c519..000000000 --- a/base/gsdpnext.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 2001-2018 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - - -/* API for NeXT DPS facilities */ - -#ifndef gsdpnext_INCLUDED -# define gsdpnext_INCLUDED - -#include "gsalpha.h" -#include "gsalphac.h" - -#endif /* gsdpnext_INCLUDED */ diff --git a/base/gsdps.c b/base/gsdps.c deleted file mode 100644 index ef1b4a2d7..000000000 --- a/base/gsdps.c +++ /dev/null @@ -1,111 +0,0 @@ -/* Copyright (C) 2001-2018 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - - -/* Display PostScript extensions */ -#include "gx.h" -#include "gserrors.h" -#include "gsdps.h" -#include "gspath.h" /* for newpath */ -#include "gxdevice.h" /* for gxcpath.h */ -#include "gzpath.h" /* for gzcpath.h */ -#include "gzstate.h" -#include "gzcpath.h" - -/* ---------------- View clipping ---------------- */ - -/* Forward references */ -static int common_viewclip(gs_gstate *, int); - -int -gs_initviewclip(gs_gstate * pgs) -{ - gx_clip_path *pcpath = pgs->view_clip; - - if (pcpath != 0 && pcpath->rule != 0) { - gx_cpath_reset(pcpath); - pcpath->rule = 0; - } - return 0; -} - -int -gs_viewclip(gs_gstate * pgs) -{ - return common_viewclip(pgs, gx_rule_winding_number); -} - -int -gs_eoviewclip(gs_gstate * pgs) -{ - return common_viewclip(pgs, gx_rule_even_odd); -} - -/* This code is (almost) copied from common_clip in gspath.c. */ -/* Someday we'll find a way to merge them. */ -static int -common_viewclip(gs_gstate * pgs, int rule) -{ - gs_fixed_rect bbox; - gx_clip_path rpath; - int code; - gx_clip_path *pcpath = pgs->view_clip; - - if (pcpath == 0) { - pcpath = gx_cpath_alloc(pgs->memory, "gs_[eo]viewclip"); - if (pcpath == 0) - return_error(gs_error_VMerror); - pgs->view_clip = pcpath; - } - if ((code = gx_path_bbox(pgs->path, &bbox)) < 0) - return code; - gx_cpath_init_local(&rpath, pgs->memory); - code = gx_cpath_from_rectangle(&rpath, &bbox); - if (code >= 0) - code = gx_cpath_clip(pgs, &rpath, pgs->path, rule); - if (code < 0) { - gx_cpath_free(&rpath, "gs_[eo]viewclip"); - return code; - } - rpath.rule = rule; - gx_cpath_assign_free(pcpath, &rpath); - gs_newpath(pgs); - return 0; -} - -int -gs_viewclippath(gs_gstate * pgs) -{ - gx_path cpath; - gx_clip_path *pcpath = pgs->view_clip; - int code; - - gx_path_init_local(&cpath, pgs->memory); - if (pcpath == 0 || pcpath->rule == 0) { - /* No view clip path is active: fabricate one. */ - gs_fixed_rect box; - - code = gx_default_clip_box(pgs, &box); - if (code < 0) - return code; - code = gx_path_add_rectangle(&cpath, box.p.x, box.p.y, - box.q.x, box.q.y); - } else { - code = gx_cpath_to_path(pcpath, &cpath); - } - if (code < 0) - return code; - return gx_path_assign_free(pgs->path, &cpath); -} diff --git a/base/gsdps.h b/base/gsdps.h deleted file mode 100644 index 0cb4613f2..000000000 --- a/base/gsdps.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 2001-2018 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - - -/* Client interface to Display PostScript facilities. */ - -#ifndef gsdps_INCLUDED -# define gsdps_INCLUDED - -/* Device-source images */ -#include "gsiparm2.h" -#include "gsgstate.h" - -/* View clipping */ -int gs_initviewclip(gs_gstate *); -int gs_eoviewclip(gs_gstate *); -int gs_viewclip(gs_gstate *); -int gs_viewclippath(gs_gstate *); - -#endif /* gsdps_INCLUDED */ diff --git a/base/lib.mak b/base/lib.mak index 215b8ff65..2fb31d75e 100644 --- a/base/lib.mak +++ b/base/lib.mak @@ -2954,9 +2954,6 @@ $(GLOBJ)gximdecode.$(OBJ) : $(GLSRC)gximdecode.c $(gximdecode_h) $(string__h)\ # ================ Display Postscript extensions ================ # -gsiparm2_h=$(GLSRC)gsiparm2.h $(gsiparam_h) $(gsgstate_h) -gsdps_h=$(GLSRC)gsdps.h $(gsiparm2_h) $(gsgstate_h) - # Display PostScript needs the DevicePixel color space to implement # the PixelCopy option of ImageType 2 images. dpslib_=$(GLOBJ)gsdps.$(OBJ) $(GLOBJ)gximage2.$(OBJ) @@ -2966,36 +2963,12 @@ $(GLD)dpslib.dev : $(LIB_MAK) $(ECHOGS_XE) $(dpslib_) $(GLD)cspixlib.dev \ $(ADDMOD) $(GLD)dpslib -imagetype 2 $(ADDMOD) $(GLD)dpslib -include $(GLD)cspixlib -$(GLOBJ)gsdps.$(OBJ) : $(GLSRC)gsdps.c $(AK) $(gx_h)\ - $(gsdps_h) $(gserrors_h) $(gspath_h)\ - $(gxdevice_h) $(gzcpath_h) $(gzpath_h) $(gzstate_h) $(LIB_MAK) $(MAKEDIRS) - $(GLCC) $(GLO_)gsdps.$(OBJ) $(C_) $(GLSRC)gsdps.c - $(GLOBJ)gximage2.$(OBJ) : $(GLSRC)gximage2.c $(AK) $(gx_h)\ $(math__h) $(memory__h) $(gserrors_h) $(gscolor2_h)\ $(gscpixel_h) $(gscoord_h) $(gscspace_h) $(gsdevice_h) $(gsiparm2_h)\ $(gsmatrix_h) $(gxgetbit_h) $(gxiparam_h) $(gxpath_h) $(LIB_MAK) $(MAKEDIRS) $(GLCC) $(GLO_)gximage2.$(OBJ) $(C_) $(GLSRC)gximage2.c -# ---------------- NeXT Display PostScript ---------------- # - -gsalphac_h=$(GLSRC)gsalphac.h $(gscompt_h) $(std_h) -gsdpnext_h=$(GLSRC)gsdpnext.h $(gsalpha_h) $(gsalphac_h) - -$(GLOBJ)gsalphac.$(OBJ) : $(GLSRC)gsalphac.c $(AK) $(gx_h)\ - $(gserrors_h) $(memory__h) $(gsalphac_h) $(gsiparam_h) $(gsutil_h)\ - $(gxalpha_h) $(gxcomp_h) $(gxdevice_h) $(gxgetbit_h) $(gxlum_h)\ - $(LIB_MAK) $(MAKEDIRS) - $(GLCC) $(GLO_)gsalphac.$(OBJ) $(C_) $(GLSRC)gsalphac.c - -$(GLOBJ)gximagec.$(OBJ) : $(GLSRC)gximagec.c $(AK) $(LIB_MAK) $(MAKEDIRS) - $(GLCC) $(GLO_)gximagec.$(OBJ) $(C_) $(GLSRC)gximagec.c - -dpnxtlib_=$(GLOBJ)gsalphac.$(OBJ) -$(GLD)dpnxtlib.dev : $(LIB_MAK) $(ECHOGS_XE) $(dpnxtlib_) $(LIB_MAK) $(MAKEDIRS) - $(SETMOD) $(GLD)dpnxtlib $(dpnxtlib_) - $(ADDCOMP) $(GLD)dpnxtlib alpha - # ================ PostScript LanguageLevel 3 support ================ # $(GLOBJ)gscdevn.$(OBJ) : $(GLSRC)gscdevn.c $(AK) $(gx_h) $(gserrors_h)\ diff --git a/base/openvms.mak b/base/openvms.mak index 2dc3496b7..3e2c23697 100644 --- a/base/openvms.mak +++ b/base/openvms.mak @@ -187,7 +187,7 @@ endif COMP:=$(COMP)/DECC/PREFIX=ALL/NESTED_INCLUDE=PRIMARY/NAMES=SHORTENED -# Define any other compilation flags. +# Define any other compilation flags. # Including defines for A4 paper size ifdef A4_PAPER @@ -245,7 +245,7 @@ DEVICE_DEVS21= # Choose the language feature(s) to include. See gs.mak for details. -FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(PSD)fapi.dev +FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(PSD)fapi.dev # Choose whether to compile the .ps initialization files into the executable. # See gs.mak for details. @@ -460,7 +460,7 @@ $(GLOBJ)gp_stdia.$(OBJ): $(GLSRC)gp_stdia.c $(AK) $(stdio__h) $(time__h) $(unist # Interpreter AUX programs -$(ECHOGS_XE) : $(GLOBJ)echogs.$(OBJ) +$(ECHOGS_XE) : $(GLOBJ)echogs.$(OBJ) LINK/EXE=$@ $(GLOBJ)echogs.$(OBJ) $(GLOBJ)echogs.$(OBJ) : $(GLSRC)echogs.c diff --git a/base/openvms.mmk b/base/openvms.mmk index 1c38bc2df..2ad7186cb 100644 --- a/base/openvms.mmk +++ b/base/openvms.mmk @@ -189,7 +189,7 @@ SW_DEBUG=/NODEBUG/NOOPTIMIZE SW_PLATFORM=/DECC/PREFIX=ALL/NESTED_INCLUDE=PRIMARY/name=(as_is,short)/nowarn -# Define any other compilation flags. +# Define any other compilation flags. # Including defines for A4 paper size .ifdef A4_PAPER @@ -258,7 +258,7 @@ DEVICE_DEVS21= # Choose the language feature(s) to include. See gs.mak for details. -FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(PSD)fapi.dev $(PSD)jbig2.dev +FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(PSD)fapi.dev $(PSD)jbig2.dev # Choose whether to compile the .ps initialization files into the executable. # See gs.mak for details. @@ -429,7 +429,7 @@ JBIG2_EXTRA_OBJS=$(JBIG2OBJDIR)$(D)snprintf.$(OBJ) .include $(GLSRCDIR)contrib.mak -# ----------------------------- Main program ------------------------------ +# ----------------------------- Main program ------------------------------ macro : .ifdef A4_PAPER @@ -468,7 +468,7 @@ openvms__=$(GLOBJ)gp_getnv.$(OBJ) $(GLOBJ)gp_paper.$(OBJ) $(GLOBJ)gp_vms.$(OBJ) $(GLGEN)openvms_.dev : $(openvms__) $(GLGEN)nosync.dev $(SETMOD) $(GLGEN)openvms_ $(openvms__) -include $(GLGEN)nosync -$(ECHOGS_XE) : $(GLOBJDIR)echogs.$(OBJ) +$(ECHOGS_XE) : $(GLOBJDIR)echogs.$(OBJ) $(GENARCH_XE) : $(GLOBJDIR)genarch.$(OBJ) $(GENCONF_XE) : $(GLOBJDIR)genconf.$(OBJ) $(GENDEV_XE) : $(GLOBJDIR)gendev.$(OBJ) @@ -523,4 +523,3 @@ $(GLSRCDIR)openvms.opt : $(gconfig__h) : $(TOP_MAKEFILES) $(ECHOGS_XE) $(EXP)$(ECHOGS_XE) -w $(gconfig__h) -x 23 define "HAVE_SYS_TIME_H" - diff --git a/base/unix-gcc.mak b/base/unix-gcc.mak index d87d38c8e..2b38ff949 100644 --- a/base/unix-gcc.mak +++ b/base/unix-gcc.mak @@ -77,7 +77,7 @@ PSD=$(PSGENDIR)/ INSTALL = $(GLSRCDIR)/instcopy -c INSTALL_PROGRAM = $(INSTALL) -m 755 INSTALL_DATA = $(INSTALL) -m 644 -INSTALL_SHARED = +INSTALL_SHARED = prefix = /usr/local exec_prefix = ${prefix} @@ -299,10 +299,10 @@ JPX_CFLAGS= -DUSE_JPIP -DUSE_OPENJPEG_JP2 -DOPJ_HAVE_STDINT_H=1 -DOPJ_HAVE_INTT # options for lcms color management library SHARE_LCMS=0 LCMS2SRCDIR=./lcms2mt -LCMS2_CFLAGS=-DSHARE_LCMS=$(SHARE_LCMS) -DCMS_USE_BIG_ENDIAN=0 +LCMS2_CFLAGS=-DSHARE_LCMS=$(SHARE_LCMS) -DCMS_USE_BIG_ENDIAN=0 LCMS2MTSRCDIR=./lcms2mt -LCMS2_CFLAGS=-DSHARE_LCMS=$(SHARE_LCMS) -DCMS_USE_BIG_ENDIAN=0 +LCMS2_CFLAGS=-DSHARE_LCMS=$(SHARE_LCMS) -DCMS_USE_BIG_ENDIAN=0 # Which CMS are we using? # Options are currently lcms2mt or lcms2 @@ -323,7 +323,7 @@ JPEGXR_OBJDIR=$(GLOBJDIR) # Define the directory where the ijs source is stored, # and the process forking method to use for the server. # See ijs.mak for more information. - + SHARE_IJS=0 IJS_NAME= IJSSRCDIR=./ijs @@ -373,7 +373,7 @@ CCAUXLD=$(CCAUX) # Define the default gcc flags. GCFLAGS= -Wall -Wstrict-prototypes -Wundef -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -Wno-strict-aliasing -Werror=declaration-after-statement -fno-builtin -fno-common -Werror=return-type -DHAVE_STDINT_H=1 -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_INTTYPES_H=1 -DGX_COLOR_INDEX_TYPE="unsigned long int" -D__USE_UNIX98=1 -DNOCONTRIB -# Define the added flags for standard, debugging, profiling +# Define the added flags for standard, debugging, profiling # and shared object builds. CFLAGS_STANDARD= -O2 @@ -435,8 +435,8 @@ XPS_LDFLAGS_SO=-shared -Wl,$(LD_SET_DT_SONAME)$(LDFLAGS_SO_PREFIX)$(XPS_SONAME_M # Solaris may need -lnsl -lsocket -lposix4. # (Libraries required by individual drivers are handled automatically.) -EXTRALIBS=$(XTRALIBS) -ldl -lm -rdynamic -ldl -AUXEXTRALIBS=$(XTRALIBS) -ldl -lm -rdynamic -ldl +EXTRALIBS=$(XTRALIBS) -ldl -lm -rdynamic -ldl +AUXEXTRALIBS=$(XTRALIBS) -ldl -lm -rdynamic -ldl # Define the standard libraries to search at the end of linking. # Most platforms require -lpthread for the POSIX threads library; @@ -466,7 +466,7 @@ XINCLUDE= #XLIBS=Xt SM ICE Xext X11 # We use the autoconf macro AC_PATH_XTRA which defines X_LIBS with -# the -L (or whatever). It also defines X_PRE_LIBS and X_EXTRA_LIBS +# the -L (or whatever). It also defines X_PRE_LIBS and X_EXTRA_LIBS # all three of which are stripped and slotted into XLIBS below. # Usually however, all but X_LIBS are empty on modern platforms. XLIBDIRS= @@ -487,8 +487,8 @@ SYNC=nosync RM=rm -f # ------ Dynamic loader options ------- # -SOC_CFLAGS = -SOC_LIBS = +SOC_CFLAGS = +SOC_LIBS = SOC_LOADER = dxmainc.c # on virtually every Unix-a-like system, this is "so", @@ -506,7 +506,7 @@ SO_LIB_VERSION_SEPARATOR=. # Choose the language feature(s) to include. See gs.mak for details. # if it's included, $(PSD)gs_pdfwr.dev should always be one of the last in the list -PSI_FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)epsf.dev $(PSD)ttfont.dev \ +PSI_FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)epsf.dev $(PSD)ttfont.dev \ $(PSD)fapi_ps.dev $(PSD)jpx.dev $(PSD)jbig2.dev $(PSD)gs_pdfwr.dev @@ -527,9 +527,9 @@ FEATURE_DEVS=$(GLD)pipe.dev $(GLD)gsnogc.dev $(GLD)htxlib.dev $(GLD)psl3lib.dev #FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev -#FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(GLD)pipe.dev +#FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)ttfont.dev $(GLD)pipe.dev # The following is strictly for testing. -FEATURE_DEVS_ALL=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)double.dev $(PSD)trapping.dev $(PSD)stocht.dev $(GLD)pipe.dev $(GLD)gsnogc.dev $(GLD)htxlib.dev $(PSD)jbig2.dev $(PSD)jpx.dev $(GLD)ramfs.dev +FEATURE_DEVS_ALL=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)ttfont.dev $(PSD)double.dev $(PSD)trapping.dev $(PSD)stocht.dev $(GLD)pipe.dev $(GLD)gsnogc.dev $(GLD)htxlib.dev $(PSD)jbig2.dev $(PSD)jpx.dev $(GLD)ramfs.dev #FEATURE_DEVS=$(FEATURE_DEVS_ALL) # The list of resources to be included in the %rom% file system. @@ -551,24 +551,24 @@ BAND_LIST_COMPRESSOR=zlib FILE_IMPLEMENTATION=stdio -# List of default devices, in order of priority. They need not be +# List of default devices, in order of priority. They need not be # present in the actual build. GS_DEV_DEFAULT="x11alpha bbox" -# Fallback default device. This is set to 'display' by +# Fallback default device. This is set to 'display' by # unix-dll.mak when building a shared object. DISPLAY_DEV=$(DD)bbox.dev # Choose the device(s) to include. See devs.mak for details, # devs.mak and contrib.mak for the list of available devices. # DEVICE_DEVS=$(DISPLAY_DEV) $(DD)x11.dev $(DD)x11_.dev $(DD)x11alpha.dev $(DD)x11alt_.dev $(DD)x11cmyk.dev $(DD)x11cmyk2.dev $(DD)x11cmyk4.dev $(DD)x11cmyk8.dev $(DD)x11gray2.dev $(DD)x11gray4.dev $(DD)x11mono.dev $(DD)x11rg16x.dev $(DD)x11rg32x.dev -DEVICE_DEVS=$(DISPLAY_DEV) +DEVICE_DEVS=$(DISPLAY_DEV) DEVICE_DEVS1=$(DD)bit.dev $(DD)bitcmyk.dev $(DD)bitrgb.dev $(DD)bitrgbtags.dev $(DD)bmp16.dev $(DD)bmp16m.dev $(DD)bmp256.dev $(DD)bmp32b.dev $(DD)bmpgray.dev $(DD)bmpmono.dev $(DD)bmpsep1.dev $(DD)bmpsep8.dev $(DD)ccr.dev $(DD)cif.dev $(DD)devicen.dev $(DD)eps2write.dev $(DD)fpng.dev $(DD)inferno.dev $(DD)ink_cov.dev $(DD)inkcov.dev $(DD)jpeg.dev $(DD)jpegcmyk.dev $(DD)jpeggray.dev $(DD)mgr4.dev $(DD)mgr8.dev $(DD)mgrgray2.dev $(DD)mgrgray4.dev $(DD)mgrgray8.dev $(DD)mgrmono.dev $(DD)miff24.dev $(DD)pam.dev $(DD)pamcmyk32.dev $(DD)pamcmyk4.dev $(DD)pbm.dev $(DD)pbmraw.dev $(DD)pcx16.dev $(DD)pcx24b.dev $(DD)pcx256.dev $(DD)pcxcmyk.dev $(DD)pcxgray.dev $(DD)pcxmono.dev $(DD)pdfwrite.dev $(DD)pgm.dev $(DD)pgmraw.dev $(DD)pgnm.dev $(DD)pgnmraw.dev $(DD)pkm.dev $(DD)pkmraw.dev $(DD)pksm.dev $(DD)pksmraw.dev $(DD)plan.dev $(DD)plan9bm.dev $(DD)planc.dev $(DD)plang.dev $(DD)plank.dev $(DD)planm.dev $(DD)plank.dev $(DD)plib.dev $(DD)plibc.dev $(DD)plibg.dev $(DD)plibk.dev $(DD)plibm.dev $(DD)pnm.dev $(DD)pnmraw.dev $(DD)ppm.dev $(DD)ppmraw.dev $(DD)ps2write.dev $(DD)psdcmyk.dev $(DD)psdcmykog.dev $(DD)psdf.dev $(DD)psdrgb.dev $(DD)spotcmyk.dev $(DD)txtwrite.dev $(DD)xcf.dev DEVICE_DEVS2=$(DD)ap3250.dev $(DD)atx23.dev $(DD)atx24.dev $(DD)atx38.dev $(DD)bj10e.dev $(DD)bj200.dev $(DD)bjc600.dev $(DD)bjc800.dev $(DD)cdeskjet.dev $(DD)cdj500.dev $(DD)cdj550.dev $(DD)cdjcolor.dev $(DD)cdjmono.dev $(DD)cljet5.dev $(DD)cljet5c.dev $(DD)cljet5pr.dev $(DD)coslw2p.dev $(DD)coslwxl.dev $(DD)declj250.dev $(DD)deskjet.dev $(DD)dj505j.dev $(DD)djet500.dev $(DD)djet500c.dev $(DD)dnj650c.dev $(DD)eps9high.dev $(DD)eps9mid.dev $(DD)epson.dev $(DD)epsonc.dev $(DD)escp.dev $(DD)fs600.dev $(DD)hl7x0.dev $(DD)ibmpro.dev $(DD)imagen.dev $(DD)itk24i.dev $(DD)itk38.dev $(DD)jetp3852.dev $(DD)laserjet.dev $(DD)lbp8.dev $(DD)lips3.dev $(DD)lj250.dev $(DD)lj3100sw.dev $(DD)lj4dith.dev $(DD)lj4dithp.dev $(DD)lj5gray.dev $(DD)lj5mono.dev $(DD)ljet2p.dev $(DD)ljet3.dev $(DD)ljet3d.dev $(DD)ljet4.dev $(DD)ljet4d.dev $(DD)ljet4pjl.dev $(DD)ljetplus.dev $(DD)lp2563.dev $(DD)lp8000.dev $(DD)lq850.dev $(DD)lxm5700m.dev $(DD)m8510.dev $(DD)necp6.dev $(DD)oce9050.dev $(DD)oki182.dev $(DD)okiibm.dev $(DD)paintjet.dev $(DD)photoex.dev $(DD)picty180.dev $(DD)pj.dev $(DD)pjetxl.dev $(DD)pjxl.dev $(DD)pjxl300.dev $(DD)pxlcolor.dev $(DD)pxlmono.dev $(DD)r4081.dev $(DD)rinkj.dev $(DD)sj48.dev $(DD)st800.dev $(DD)stcolor.dev $(DD)t4693d2.dev $(DD)t4693d4.dev $(DD)t4693d8.dev $(DD)tek4696.dev $(DD)uniprint.dev DEVICE_DEVS3= -DEVICE_DEVS4=$(DD)ijs.dev +DEVICE_DEVS4=$(DD)ijs.dev DEVICE_DEVS5= -DEVICE_DEVS6=$(DD)png16.dev $(DD)png16m.dev $(DD)png256.dev $(DD)png48.dev $(DD)pngalpha.dev $(DD)pnggray.dev $(DD)pngmono.dev +DEVICE_DEVS6=$(DD)png16.dev $(DD)png16m.dev $(DD)png256.dev $(DD)png48.dev $(DD)pngalpha.dev $(DD)pnggray.dev $(DD)pngmono.dev DEVICE_DEVS7= DEVICE_DEVS8= DEVICE_DEVS9= @@ -702,4 +702,3 @@ maintainer-clean : distclean check : default $(NO_OP) - diff --git a/base/unixansi.mak b/base/unixansi.mak index 51597bbd2..5431749d5 100644 --- a/base/unixansi.mak +++ b/base/unixansi.mak @@ -147,7 +147,7 @@ SHARE_LIBPNG=0 LIBPNG_NAME=png # Define whether to use a shared version of libtiff and where -# it is stored and what its name is. +# it is stored and what its name is. SHARE_LIBTIFF=0 TIFFSRCDIR=tiff @@ -315,7 +315,7 @@ SYNC=nosync # Choose the language feature(s) to include. See gs.mak for details. -FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(GLD)pipe.dev $(PSD)fapi.dev +FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(GLD)pipe.dev $(PSD)fapi.dev # Choose whether to compile the .ps initialization files into the executable. # See gs.mak for details. @@ -415,7 +415,7 @@ include $(GLSRCDIR)/unixlink.mak include $(GLSRCDIR)/unix-end.mak include $(GLSRCDIR)/unixinst.mak -# platform-specific clean-up +# platform-specific clean-up # this makefile is intended to be hand edited so we don't distribute # the (presumedly modified) version in the top level directory distclean : clean config-clean @@ -424,4 +424,3 @@ distclean : clean config-clean maintainer-clean : distclean # nothing special to do - diff --git a/gpdl/pspcl6_gcc.mak b/gpdl/pspcl6_gcc.mak index d2436ca15..1f5fa69b7 100644 --- a/gpdl/pspcl6_gcc.mak +++ b/gpdl/pspcl6_gcc.mak @@ -85,7 +85,6 @@ DD=$(GLGENDIR)/ FEATURE_DEVS ?= \ $(DD)psl3.dev \ $(DD)pdf.dev \ - $(DD)dpsnext.dev \ $(DD)htxlib.dev \ $(DD)ttfont.dev \ $(DD)pipe.dev \ @@ -93,7 +92,7 @@ FEATURE_DEVS ?= \ # extra objects. XOBJS?=$(GLOBJDIR)/gsargs.o $(GLOBJDIR)/gconfig.o \ - $(GLOBJDIR)/gscdefs.o $(GLOBJDIR)/iconfig.o + $(GLOBJDIR)/gscdefs.o $(GLOBJDIR)/iconfig.o ifeq ($(COMPILE_INITS), 1) include $(PSSRCDIR)/psromfs.mak diff --git a/gpdl/pspcl6_msvc.mak b/gpdl/pspcl6_msvc.mak index 78a63048c..a656a0d93 100644 --- a/gpdl/pspcl6_msvc.mak +++ b/gpdl/pspcl6_msvc.mak @@ -248,11 +248,10 @@ BSCFILE=$(GENDIR)\language_switch.bsc TARGET_DEVS=$(PXLOBJDIR)\pxl.dev $(PCLOBJDIR)\pcl5c.dev $(PCLOBJDIR)\hpgl2c.dev !endif -!ifndef FEATURE_DEVS +!ifndef FEATURE_DEVS FEATURE_CORE = \ $(DD)\psl3.dev \ $(DD)\pdf.dev \ - $(DD)\dpsnext.dev \ $(DD)\htxlib.dev \ $(DD)\ttfont.dev \ $(DD)\gsnogc.dev \ @@ -273,4 +272,3 @@ FEATURE_DEVS = $(FEATURE_CORE) # Subsystems !include $(PSISRCDIR)\psi.mak - diff --git a/psi/icontext.c b/psi/icontext.c index 1fbe48696..159db8dbc 100644 --- a/psi/icontext.c +++ b/psi/icontext.c @@ -108,7 +108,8 @@ public_st_context_state(); static int no_reschedule(i_ctx_t **pi_ctx_p) { - return (gs_error_invalidcontext); + return 0; + /* return (gs_error_invalidcontext); */ } /* Allocate the state of a context. */ diff --git a/psi/int.mak b/psi/int.mak index 7ecf7e6ea..f85553750 100644 --- a/psi/int.mak +++ b/psi/int.mak @@ -1597,49 +1597,6 @@ $(PSOBJ)zfdctd.$(OBJ) : $(PSSRC)zfdctd.c $(OP)\ $(INT_MAK) $(MAKEDIRS) $(PSCC) $(PSO_)zfdctd.$(OBJ) $(C_) $(PSSRC)zfdctd.c -# ================ Display PostScript ================ # - -dps_=$(PSOBJ)zdps.$(OBJ) $(PSOBJ)zcontext.$(OBJ) -$(PSD)dps.dev : $(ECHOGS_XE) $(GLD)dpslib.dev $(PSD)psl2.dev\ - $(dps_) $(INT_MAK) $(MAKEDIRS) - $(SETMOD) $(PSD)dps -include $(GLD)dpslib $(PSD)psl2 - $(ADDMOD) $(PSD)dps -obj $(dps_) - $(ADDMOD) $(PSD)dps -oper zcontext1 zcontext2 zdps - $(ADDMOD) $(PSD)dps -ps gs_dps - -$(PSOBJ)zdps.$(OBJ) : $(PSSRC)zdps.c $(OP)\ - $(gsdps_h) $(gsimage_h) $(gsiparm2_h) $(gsstate_h)\ - $(gxalloc_h) $(gxfixed_h) $(gxpath_h)\ - $(btoken_h)\ - $(idparam_h) $(iddict_h) $(igstate_h) $(iimage2_h) $(iname_h)\ - $(store_h) $(INT_MAK) $(MAKEDIRS) - $(PSCC) $(PSO_)zdps.$(OBJ) $(C_) $(PSSRC)zdps.c - -$(PSOBJ)zcontext.$(OBJ) : $(PSSRC)zcontext.c $(OP) $(gp_h) $(memory__h)\ - $(gsexit_h) $(gsgc_h) $(gsstruct_h) $(gsutil_h) $(gxalloc_h) $(gxstate_h)\ - $(icontext_h) $(idict_h) $(igstate_h) $(interp_h) $(isave_h) $(istruct_h)\ - $(dstack_h) $(estack_h) $(files_h) $(ostack_h) $(store_h) $(stream_h)\ - $(INT_MAK) $(MAKEDIRS) - $(PSCC) $(PSO_)zcontext.$(OBJ) $(C_) $(PSSRC)zcontext.c - -# ---------------- NeXT Display PostScript ---------------- # - -dpsnext_=$(PSOBJ)zdpnext.$(OBJ) -$(PSD)dpsnext.dev : $(ECHOGS_XE) $(dpsnext_)\ - $(PSD)dps.dev $(GLD)dpnxtlib.dev $(INT_MAK) $(MAKEDIRS) - $(SETMOD) $(PSD)dpsnext -include $(PSD)dps $(GLD)dpnxtlib - $(ADDMOD) $(PSD)dpsnext -obj $(dpsnext_) - $(ADDMOD) $(PSD)dpsnext -oper zdpnext - $(ADDMOD) $(PSD)dpsnext -ps gs_dpnxt - -$(PSOBJ)zdpnext.$(OBJ) : $(PSSRC)zdpnext.c $(math__h) $(OP)\ - $(gscoord_h) $(gscspace_h) $(gsdpnext_h)\ - $(gsiparam_h) $(gsiparm2_h) $(gsmatrix_h) $(gspath2_h)\ - $(gxcvalue_h) $(gxdevice_h) $(gxsample_h)\ - $(ialloc_h) $(igstate_h) $(iimage_h) $(iimage2_h) $(store_h)\ - $(INT_MAK) $(MAKEDIRS) - $(PSCC) $(PSO_)zdpnext.$(OBJ) $(C_) $(PSSRC)zdpnext.c - # ==================== PostScript LanguageLevel 3 ===================== # # ---------------- DevicePixel color space ---------------- # diff --git a/psi/msvc.mak b/psi/msvc.mak index 125b92a28..3f547122b 100644 --- a/psi/msvc.mak +++ b/psi/msvc.mak @@ -1387,7 +1387,7 @@ JPX_CFLAGS = $JPX_CFLAGS -DUSE_JPIP -DUSE_OPENJPEG_JP2 -DOPJ_STATIC # Choose the language feature(s) to include. See gs.mak for details. # if it's included, $(PSD)gs_pdfwr.dev should always be one of the last in the list -PSI_FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)epsf.dev $(PSD)ttfont.dev \ +PSI_FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)epsf.dev $(PSD)ttfont.dev \ $(PSD)jbig2.dev $(PSD)jpx.dev $(PSD)fapi_ps.dev $(GLD)winutf8.dev $(PSD)gs_pdfwr.dev @@ -1641,7 +1641,7 @@ $(GS_XE): $(GSDLL_DLL) $(GS_XE): $(GSDLL_DLL) $(DWOBJ) $(GSCONSOLE_XE) $(GLOBJ)gp_wutf8.$(OBJ) $(TOP_MAKEFILES) echo /SUBSYSTEM:WINDOWS > $(PSGEN)gswin.rsp !if "$(PROFILE)"=="1" - echo /Profile >> $(PSGEN)gswin.rsp + echo /Profile >> $(PSGEN)gswin.rsp !endif !ifdef WIN64 echo /DEF:$(PSSRCDIR)\dwmain64.def /OUT:$(GS_XE) >> $(PSGEN)gswin.rsp diff --git a/psi/os2.mak b/psi/os2.mak index 4bd577708..1bfce67d6 100644 --- a/psi/os2.mak +++ b/psi/os2.mak @@ -11,7 +11,7 @@ # Novato, CA 94945, U.S.A., +1(415)492-9861, for further information. # # makefile for MS-DOS or OS/2 GCC/EMX platform. -# Uses Borland (MSDOS) MAKER or +# Uses Borland (MSDOS) MAKER or # Uses IBM NMAKE.EXE Version 2.000.000 Mar 27 1992 # ------------------------------- Options ------------------------------- # @@ -88,7 +88,7 @@ IBMCPP=0 BUILD_X11=0 !if $(BUILD_X11) X11INCLUDE=-I$(X11ROOT)\XFree86\include -X11LIBS=$(X11ROOT)\XFree86\lib\Xt.lib $(X11ROOT)\XFree86\lib\X11.lib +X11LIBS=$(X11ROOT)\XFree86\lib\Xt.lib $(X11ROOT)\XFree86\lib\X11.lib MT_OPT=-Zmtd !endif @@ -361,7 +361,7 @@ CEXESYS=-Zomf -Zsys GENOPT=$(CD) $(CGDB) $(CDLL) $(CO) $(CPNG) CCFLAGS0=$(GENOPT) $(PLATOPT) -D__OS2__ $(GCIFLAGS) -CCFLAGS=$(CCFLAGS0) +CCFLAGS=$(CCFLAGS0) CC=$(COMPDIR)\$(COMP) $(CCFLAGS0) CCAUX=$(CC) CC_=$(CC) @@ -375,7 +375,7 @@ CC_SHARED=$(CC_) # Choose the language feature(s) to include. See gs.mak for details. # Since we have a large address space, we include some optional features. -FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(PSD)os2print.dev +FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)ttfont.dev $(PSD)epsf.dev $(PSD)os2print.dev # Choose whether to compile the .ps initialization files into the executable. # See gs.mak for details. @@ -424,7 +424,7 @@ DEVICE_DEVS14=$(DD)jpeg.dev $(DD)jpeggray.dev $(DD)jpegcmyk.dev DEVICE_DEVS15=$(DD)pdfwrite.dev $(DD)ps2write.dev $(DD)eps2write.dev $(DD)txtwrite.dev $(DD)pxlmono.dev $(DD)pxlcolor.dev DEVICE_DEVS16=$(DD)bbox.dev $(DD)pdfimage8.dev $(DD)pdfimage24.dev $(DD)pdfimage32.dev $(DD)PCLm.dev # Overflow for DEVS3,4,5,6,9 -DEVICE_DEVS17=$(DD)ljet3.dev $(DD)ljet3d.dev $(DD)ljet4.dev $(DD)ljet4d.dev +DEVICE_DEVS17=$(DD)ljet3.dev $(DD)ljet3d.dev $(DD)ljet4.dev $(DD)ljet4d.dev DEVICE_DEVS18=$(DD)pj.dev $(DD)pjxl.dev $(DD)pjxl300.dev $(DD)jetp3852.dev $(DD)r4081.dev DEVICE_DEVS19=$(DD)lbp8.dev $(DD)m8510.dev $(DD)necp6.dev $(DD)bjc600.dev $(DD)bjc800.dev DEVICE_DEVS20=$(DD)pnm.dev $(DD)pnmraw.dev $(DD)ppm.dev $(DD)ppmraw.dev $(DD)pamcmyk32.dev @@ -451,7 +451,7 @@ DEVICE_DEVS21= $(DD)spotcmyk.dev $(DD)devicen.dev $(DD)bmpsep1.dev $(DD)bmpsep8. # The GCC/EMX platform -os2__=$(GLOBJ)gp_getnv.$(OBJ) $(GLOBJ)gp_getnv.$(OBJ) $(GLOBJ)gp_os2.$(OBJ) $(GLOBJ)gp_os2fs.$(OBJ) $(GLOBJ)gp_paper.$(OBJ) $(GLOBJ)gp_stdia.$(OBJ) $(GLOBJ)gp_nxpsprn.$(OBJ) +os2__=$(GLOBJ)gp_getnv.$(OBJ) $(GLOBJ)gp_getnv.$(OBJ) $(GLOBJ)gp_os2.$(OBJ) $(GLOBJ)gp_os2fs.$(OBJ) $(GLOBJ)gp_paper.$(OBJ) $(GLOBJ)gp_stdia.$(OBJ) $(GLOBJ)gp_nxpsprn.$(OBJ) $(GLGEN)os2_.dev: $(os2__) $(GLD)nosync.dev $(SETMOD) $(GLGEN)os2_ $(os2__) -include $(GLD)nosync @@ -582,7 +582,7 @@ $(GS_XE): $(BINDIR)\$(GSDLL).dll $(PSSRC)dpmain.c $(PSSRC)gsos2.rc $(GLOBJ)gscde !endif rc $(PSOBJ)$(GS).res $(GS_XE) -$(BINDIR)\$(GSDLL).dll: $(GS_ALL) $(ALL_DEVS) +$(BINDIR)\$(GSDLL).dll: $(GS_ALL) $(ALL_DEVS) !if $(EMX) LINK386 /DEBUG $(COMPBASE)\lib\dll0.obj $(COMPBASE)\lib\end.lib @$(ld_tr) $(PSOBJ)gsromfs$(COMPILE_INITS).$(OBJ), $(BINDIR)\$(GSDLL).dll, ,$(X11LIBS) $(COMPBASE)\lib\gcc.lib $(COMPBASE)\lib\st\c.lib $(COMPBASE)\lib\st\c_dllso.lib $(COMPBASE)\lib\st\sys.lib $(COMPBASE)\lib\c_alias.lib $(COMPBASE)\lib\os2.lib, $(PSSRC)gsdll2.def !endif @@ -622,7 +622,7 @@ $(GLOBJ)gspmdrv.res: $(GLSRC)gspmdrv.rc $(GLSRC)gspmdrv.h $(GLOBJ)gspmdrv.ico $( rc -i $(COMPBASE)\include -i $(GLSRCDIR) -i $(GLOBJDIR) -r $(GLSRC)gspmdrv.rc $(GLOBJ)gspmdrv.res $(BINDIR)\gspmdrv.exe: $(GLOBJ)gspmdrv.o $(GLOBJ)gspmdrv.res $(GLSRC)gspmdrv.def $(TOP_MAKEFILES) - $(COMPDIR)\$(COMP) $(CGDB) $(CO) -o $(GLOBJ)gspmdrv $(GLOBJ)gspmdrv.o + $(COMPDIR)\$(COMP) $(CGDB) $(CO) -o $(GLOBJ)gspmdrv $(GLOBJ)gspmdrv.o $(COMPDIR)\emxbind -p -r$(GLOBJ)gspmdrv.res -d$(GLSRC)gspmdrv.def $(COMPDIR)\emxl.exe $(GLOBJ)gspmdrv $(BINDIR)\gspmdrv.exe del $(GLOBJ)gspmdrv diff --git a/psi/psromfs.mak b/psi/psromfs.mak index a1e6754f5..e1ea4d4c3 100644 --- a/psi/psromfs.mak +++ b/psi/psromfs.mak @@ -378,8 +378,6 @@ PS_INIT_DEPS=\ $(PSRESDIR)$(D)Init$(D)gs_cspace.ps \ $(PSRESDIR)$(D)Init$(D)gs_dbt_e.ps \ $(PSRESDIR)$(D)Init$(D)gs_diskn.ps \ - $(PSRESDIR)$(D)Init$(D)gs_dpnxt.ps \ - $(PSRESDIR)$(D)Init$(D)gs_dps.ps \ $(PSRESDIR)$(D)Init$(D)gs_dps1.ps \ $(PSRESDIR)$(D)Init$(D)gs_dps2.ps \ $(PSRESDIR)$(D)Init$(D)gs_dscp.ps \ diff --git a/psi/zcontext.c b/psi/zcontext.c deleted file mode 100644 index 098a54aa8..000000000 --- a/psi/zcontext.c +++ /dev/null @@ -1,1338 +0,0 @@ -/* Copyright (C) 2001-2018 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - - -/* Display PostScript context operators */ -#include "memory_.h" -#include "ghost.h" -#include "gp.h" /* for usertime */ -#include "oper.h" -#include "gsexit.h" -#include "gsgc.h" -#include "gsstruct.h" -#include "gsutil.h" -#include "gxalloc.h" -#include "gxstate.h" /* for copying gstate stack */ -#include "stream.h" /* for files.h */ -#include "files.h" -#include "idict.h" -#include "igstate.h" -#include "icontext.h" -#include "interp.h" -#include "isave.h" -#include "istruct.h" -#include "dstack.h" -#include "estack.h" -#include "ostack.h" -#include "store.h" - -/* - * Define the reschedule_interval, the number of ticks between time - * slice reschedules. This may be changed by the user by setting the - * TIME_SLICE_INTERVAL variable in systemdict to the desired integer - * prior to running. If set to be less than the minimum interval (100), - * time slicing will be disabled. In this case, the time_slice_ticks - * field of the context state will be still be set to the default - * reschedule interval of 250 ticks. This will still permit the - * interpreter to garbage collect unclaimed memory at appropriate - * intervals, even when time slicing between contexts is disabled. - */ -enum { - default_reschedule_interval = 250, - minimum_reschedule_interval = 100 -}; - -static int reschedule_interval = default_reschedule_interval; - -/* Context structure */ -typedef enum { - cs_active, - cs_done -} ctx_status_t; -typedef long ctx_index_t; /* >= 0 */ -typedef struct gs_context_s gs_context_t; -typedef struct gs_scheduler_s gs_scheduler_t; - -/* - * If several contexts share local VM, then if any one of them has done an - * unmatched save, the others are not allowed to run. We handle this by - * maintaining the following invariant: - * When control reaches the point in the scheduler that decides - * what context to run next, then for each group of contexts - * sharing local VM, if the save level for that VM is non-zero, - * saved_local_vm is only set in the context that has unmatched - * saves. - * We maintain this invariant as follows: when control enters the - * scheduler, if a context was running, we set its saved_local_vm flag - * to (save_level > 0). When selecting a context to run, we ignore - * contexts where saved_local_vm is false and the local VM save_level > 0. - */ -struct gs_context_s { - gs_context_state_t state; /* (must be first for subclassing) */ - /* Private state */ - gs_scheduler_t *scheduler; - ctx_status_t status; - ctx_index_t index; /* > 0 */ - bool detach; /* true if a detach has been */ - /* executed for this context */ - bool saved_local_vm; /* (see above) */ - bool visible; /* during GC, true if visible; */ - /* otherwise, always true */ - ctx_index_t next_index; /* next context with same status */ - /* (active, waiting on same lock, */ - /* waiting on same condition, */ - /* waiting to be destroyed) */ - ctx_index_t joiner_index; /* context waiting on a join */ - /* for this one */ - gs_context_t *table_next; /* hash table chain -- this must be a real */ - /* pointer, for looking up indices */ -}; -static inline gs_context_t * -visible_context(gs_context_t *pctx) -{ - return (pctx && pctx->visible ? pctx : (gs_context_t *)0); -} - -/* GC descriptor */ -static -CLEAR_MARKS_PROC(context_clear_marks) -{ - gs_context_t *const pctx = vptr; - - (*st_context_state.clear_marks) - (cmem, &pctx->state, sizeof(pctx->state), &st_context_state); -} -static -ENUM_PTRS_WITH(context_enum_ptrs, gs_context_t *pctx) -ENUM_PREFIX(st_context_state, 2); -case 0: return ENUM_OBJ(pctx->scheduler); -case 1: { - /* Return the next *visible* context. */ - const gs_context_t *next = pctx->table_next; - - while (next && !next->visible) - next = next->table_next; - return ENUM_OBJ(next); -} -ENUM_PTRS_END -static RELOC_PTRS_WITH(context_reloc_ptrs, gs_context_t *pctx) - RELOC_PREFIX(st_context_state); - RELOC_VAR(pctx->scheduler); - /* Don't relocate table_next -- the scheduler object handles that. */ -RELOC_PTRS_END -gs_private_st_complex_only(st_context, gs_context_t, "gs_context_t", - context_clear_marks, context_enum_ptrs, context_reloc_ptrs, 0); - -/* - * Context list structure. Note that this uses context indices, not - * pointers, to avoid having to worry about pointers between local VMs. - */ -typedef struct ctx_list_s { - ctx_index_t head_index; - ctx_index_t tail_index; -} ctx_list_t; - -/* Condition structure */ -typedef struct gs_condition_s { - ctx_list_t waiting; /* contexts waiting on this condition */ -} gs_condition_t; -gs_private_st_simple(st_condition, gs_condition_t, "conditiontype"); - -/* Lock structure */ -typedef struct gs_lock_s { - ctx_list_t waiting; /* contexts waiting for this lock, */ - /* must be first for subclassing */ - ctx_index_t holder_index; /* context holding the lock, if any */ - gs_scheduler_t *scheduler; -} gs_lock_t; -gs_private_st_ptrs1(st_lock, gs_lock_t, "locktype", - lock_enum_ptrs, lock_reloc_ptrs, scheduler); - -/* Global state */ -/*typedef struct gs_scheduler_s gs_scheduler_t; *//* (above) */ -struct gs_scheduler_s { - gs_context_t *current; - long usertime_initial; /* usertime when current started running */ - ctx_list_t active; - vm_reclaim_proc((*save_vm_reclaim)); - ctx_index_t dead_index; -#define CTX_TABLE_SIZE 19 - gs_context_t *table[CTX_TABLE_SIZE]; -}; - -/* Convert a context index to a context pointer. */ -static gs_context_t * -index_context(const gs_scheduler_t *psched, long index) -{ - gs_context_t *pctx; - - if (index <= 0) - return NULL; - pctx = psched->table[index % CTX_TABLE_SIZE]; - while (pctx != NULL && pctx->index != index) - pctx = pctx->table_next; - return pctx; -} - -/* Structure definition */ -gs_private_st_composite(st_scheduler, gs_scheduler_t, "gs_scheduler", - scheduler_enum_ptrs, scheduler_reloc_ptrs); -/* - * The only cross-local-VM pointers in the context machinery are the - * table_next pointers in contexts, and the current and table[] pointers - * in the scheduler. We need to handle all of these specially. - */ -static ENUM_PTRS_WITH(scheduler_enum_ptrs, gs_scheduler_t *psched) -{ - index -= 1; - if (index < CTX_TABLE_SIZE) { - gs_context_t *pctx = psched->table[index]; - - while (pctx && !pctx->visible) - pctx = pctx->table_next; - return ENUM_OBJ(pctx); - } - return 0; -} -case 0: return ENUM_OBJ(visible_context(psched->current)); -ENUM_PTRS_END -static RELOC_PTRS_WITH(scheduler_reloc_ptrs, gs_scheduler_t *psched) -{ - if (psched->current->visible) - RELOC_VAR(psched->current); - { - int i; - - for (i = 0; i < CTX_TABLE_SIZE; ++i) { - gs_context_t **ppctx = &psched->table[i]; - gs_context_t **pnext; - - for (; *ppctx; ppctx = pnext) { - pnext = &(*ppctx)->table_next; - if ((*ppctx)->visible) - RELOC_VAR(*ppctx); - } - } - } -} -RELOC_PTRS_END - -/* - * The context scheduler requires special handling during garbage - * collection, since it is the only structure that can legitimately - * reference objects in multiple local VMs. To deal with this, we wrap the - * interpreter's garbage collector with code that prevents it from seeing - * contexts in other than the current local VM. ****** WORKS FOR LOCAL GC, - * NOT FOR GLOBAL ****** - */ -static void -context_reclaim(vm_spaces * pspaces, bool global) -{ - /* - * Search through the registered roots to find the current context. - * (This is a hack so we can find the scheduler.) - */ - int i; - gs_context_t *pctx = 0; /* = 0 is bogus to pacify compilers */ - gs_scheduler_t *psched = 0; - gs_ref_memory_t *lmem = 0; /* = 0 is bogus to pacify compilers */ - clump_locator_t loc; - - for (i = countof(pspaces->memories.indexed) - 1; psched == 0 && i > 0; --i) { - gs_ref_memory_t *mem = pspaces->memories.indexed[i]; - const gs_gc_root_t *root = mem->roots; - - for (; root; root = root->next) { - if (gs_object_type((gs_memory_t *)mem, *root->p) == &st_context) { - pctx = *root->p; - psched = pctx->scheduler; - lmem = mem; - break; - } - } - } - - /* Ensure psched is not NULL before we try to use it, exit if it is (should be impossible) */ - if (!psched) - return; - - /* Hide all contexts in other (local) VMs. */ - /* - * See context_create below for why we look for the context - * in stable memory. - */ - loc.memory = (gs_ref_memory_t *)gs_memory_stable((gs_memory_t *)lmem); - loc.cp = 0; - for (i = 0; i < CTX_TABLE_SIZE; ++i) - for (pctx = psched->table[i]; pctx; pctx = pctx->table_next) - pctx->visible = clump_locate_ptr(pctx, &loc); - -#ifdef DEBUG - if (!psched->current->visible) { - lprintf("Current context is invisible!\n"); - gs_abort((gs_memory_t *)lmem); - } -#endif - - /* Do the actual garbage collection. */ - psched->save_vm_reclaim(pspaces, global); - - /* Make all contexts visible again. */ - for (i = 0; i < CTX_TABLE_SIZE; ++i) - for (pctx = psched->table[i]; pctx; pctx = pctx->table_next) - pctx->visible = true; -} - -/* Forward references */ -static int context_create(gs_scheduler_t *, gs_context_t **, - const gs_dual_memory_t *, - const gs_context_state_t *, bool); -static long context_usertime(void); -static int context_param(const gs_scheduler_t *, os_ptr, gs_context_t **); -static void context_destroy(gs_context_t *); -static void stack_copy(ref_stack_t *, const ref_stack_t *, uint, uint); -static int lock_acquire(os_ptr, gs_context_t *); -static int lock_release(ref *); - -/* Internal procedures */ -static void -context_load(gs_scheduler_t *psched, gs_context_t *pctx) -{ - if_debug1('"', "[\"]loading %ld\n", pctx->index); - if ( pctx->state.keep_usertime ) - psched->usertime_initial = context_usertime(); - context_state_load(&pctx->state); -} -static void -context_store(gs_scheduler_t *psched, gs_context_t *pctx) -{ - if_debug1('"', "[\"]storing %ld\n", pctx->index); - context_state_store(&pctx->state); - if ( pctx->state.keep_usertime ) - pctx->state.usertime_total += - context_usertime() - psched->usertime_initial; -} - -/* List manipulation */ -static void -add_last(const gs_scheduler_t *psched, ctx_list_t *pl, gs_context_t *pc) -{ - pc->next_index = 0; - if (pl->head_index == 0) - pl->head_index = pc->index; - else { - gs_context_t *ready = index_context(psched, pl->tail_index); - if (ready) - ready->next_index = pc->index; - /* Other cases return fatal error if there is no context, but we can't do that */ - } - pl->tail_index = pc->index; -} - -/* ------ Initialization ------ */ - -static int ctx_initialize(i_ctx_t **); -static int ctx_reschedule(i_ctx_t **); -static int ctx_time_slice(i_ctx_t **); -static int -zcontext_init(i_ctx_t *i_ctx_p) -{ - /* Complete initialization after the interpreter is entered. */ - i_ctx_p->reschedule_proc = ctx_initialize; - i_ctx_p->time_slice_proc = ctx_initialize; - i_ctx_p->time_slice_ticks = 0; - return 0; -} -/* - * The interpreter calls this procedure at the first reschedule point. - * It completes context initialization. - */ -static int -ctx_initialize(i_ctx_t **pi_ctx_p) -{ - int interval = reschedule_interval; - i_ctx_t *i_ctx_p = *pi_ctx_p; /* for gs_imemory */ - gs_ref_memory_t *imem = iimemory_system; - gs_scheduler_t *psched = - gs_alloc_struct_immovable((gs_memory_t *) imem, gs_scheduler_t, - &st_scheduler, "gs_scheduler"); - if (psched == NULL) - return_error(gs_error_VMerror); - - psched->current = 0; - psched->active.head_index = psched->active.tail_index = 0; - psched->save_vm_reclaim = i_ctx_p->memory.spaces.vm_reclaim; - i_ctx_p->memory.spaces.vm_reclaim = context_reclaim; - psched->dead_index = 0; - memset(psched->table, 0, sizeof(psched->table)); - /* Create an initial context. */ - if (context_create(psched, &psched->current, &gs_imemory, *pi_ctx_p, true) < 0) { - lprintf("Can't create initial context!"); - gs_abort(imemory); - } - psched->current->scheduler = psched; - /* Hook into the interpreter. */ - *pi_ctx_p = &psched->current->state; - - if (interval < minimum_reschedule_interval) - interval = minimum_reschedule_interval; - psched->current->state.reschedule_proc = ctx_reschedule; - psched->current->state.time_slice_proc = ctx_time_slice; - psched->current->state.time_slice_ticks = interval; - return 0; -} - -/* ------ Interpreter interface to scheduler ------ */ - -/* When an operator decides it is time to run a new context, */ -/* it returns o_reschedule. The interpreter saves all its state in */ -/* memory, calls ctx_reschedule, and then loads the state from memory. */ -static int -ctx_reschedule(i_ctx_t **pi_ctx_p) -{ - gs_context_t *current = (gs_context_t *)*pi_ctx_p; - gs_scheduler_t *psched = current->scheduler; - -#ifdef DEBUG - if (*pi_ctx_p != ¤t->state) { - lprintf2("current->state = 0x%lx, != i_ctx_p = 0x%lx!\n", - (ulong)¤t->state, (ulong)*pi_ctx_p); - } -#endif - /* If there are any dead contexts waiting to be released, */ - /* take care of that now. */ - while (psched->dead_index != 0) { - gs_context_t *dead = index_context(psched, psched->dead_index); - long next_index; - - if (dead) { - next_index = dead->next_index; - - if (current == dead) { - if_debug1('"', "[\"]storing dead %ld\n", current->index); - context_state_store(¤t->state); - current = 0; - } - context_destroy(dead); - psched->dead_index = next_index; - } - } - /* Update saved_local_vm. See above for the invariant. */ - if (current != 0) - current->saved_local_vm = - current->state.memory.space_local->saved != 0; - /* Run the first ready context, taking the 'save' lock into account. */ - { - gs_context_t *prev = 0; - gs_context_t *ready; - - for (ready = index_context(psched, psched->active.head_index);; - prev = ready, ready = index_context(psched, ready->next_index) - ) { - if (ready == 0) { - if (current != 0) - context_store(psched, current); - lprintf("No context to run!"); - return_error(gs_error_Fatal); - } - /* See above for an explanation of the following test. */ - if (ready->state.memory.space_local->saved != 0 && - !ready->saved_local_vm - ) - continue; - /* Found a context to run. */ - { - ctx_index_t next_index = ready->next_index; - - if (prev) - prev->next_index = next_index; - else - psched->active.head_index = next_index; - if (!next_index) - psched->active.tail_index = (prev ? prev->index : 0); - } - break; - } - if (ready == current) - return 0; /* no switch */ - /* - * Save the state of the current context in psched->current, - * if any context is current. - */ - if (current != 0) - context_store(psched, current); - psched->current = ready; - /* Load the state of the new current context. */ - context_load(psched, ready); - /* Switch the interpreter's context state pointer. */ - *pi_ctx_p = &ready->state; - } - return 0; -} - -/* If the interpreter wants to time-slice, it saves its state, */ -/* calls ctx_time_slice, and reloads its state. */ -static int -ctx_time_slice(i_ctx_t **pi_ctx_p) -{ - gs_scheduler_t *psched = ((gs_context_t *)*pi_ctx_p)->scheduler; - - if (psched->active.head_index == 0 || - reschedule_interval < minimum_reschedule_interval) - return 0; - if_debug0('"', "[\"]time-slice\n"); - add_last(psched, &psched->active, psched->current); - return ctx_reschedule(pi_ctx_p); -} - -/* ------ Context operators ------ */ - -/* - currentcontext <context> */ -static int -zcurrentcontext(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - const gs_context_t *current = (const gs_context_t *)i_ctx_p; - - push(1); - make_int(op, current->index); - return 0; -} - -/* <context> detach - */ -static int -zdetach(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - const gs_scheduler_t *psched = ((gs_context_t *)i_ctx_p)->scheduler; - gs_context_t *pctx; - int code; - - if ((code = context_param(psched, op, &pctx)) < 0) - return code; - if_debug2('\'', "[']detach %ld, status = %d\n", - pctx->index, pctx->status); - if (pctx->joiner_index != 0 || pctx->detach) - return_error(gs_error_invalidcontext); - switch (pctx->status) { - case cs_active: - pctx->detach = true; - break; - case cs_done: - context_destroy(pctx); - } - pop(1); - return 0; -} - -static int - do_fork(i_ctx_t *i_ctx_p, os_ptr op, const ref * pstdin, - const ref * pstdout, uint mcount, bool local), - values_older_than(const ref_stack_t * pstack, uint first, uint last, - int max_space); -static int - fork_done(i_ctx_t *), - fork_done_with_error(i_ctx_t *), - finish_join(i_ctx_t *), - reschedule_now(i_ctx_t *); - -/* <mark> <obj1> ... <objN> <proc> .fork <context> */ -/* <mark> <obj1> ... <objN> <proc> <stdin|null> <stdout|null> */ -/* .localfork <context> */ -static int -zfork(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - uint mcount = ref_stack_counttomark(&o_stack); - ref rnull; - - if (mcount == 0) - return_error(gs_error_unmatchedmark); - make_null(&rnull); - return do_fork(i_ctx_p, op, &rnull, &rnull, mcount, false); -} -static int -zlocalfork(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - uint mcount = ref_stack_counttomark(&o_stack); - int code; - - if (mcount == 0) - return_error(gs_error_unmatchedmark); - code = values_older_than(&o_stack, 1, mcount - 1, avm_local); - if (code < 0) - return code; - code = do_fork(i_ctx_p, op - 2, op - 1, op, mcount - 2, true); - if (code < 0) - return code; - op = osp; - op[-2] = *op; - pop(2); - return code; -} - -/* Internal procedure to actually do the fork operation. */ -static int -do_fork(i_ctx_t *i_ctx_p, os_ptr op, const ref * pstdin, const ref * pstdout, - uint mcount, bool local) -{ - gs_context_t *pcur = (gs_context_t *)i_ctx_p; - gs_scheduler_t *psched = pcur->scheduler; - stream *s; - gs_dual_memory_t dmem; - gs_context_t *pctx; - ref old_userdict, new_userdict; - int code, interval; - - check_proc(*op); - if (iimemory_local->save_level) - return_error(gs_error_invalidcontext); - if (r_has_type(pstdout, t_null)) { - code = zget_stdout(i_ctx_p, &s); - if (code < 0) - return code; - pstdout = &ref_stdio[1]; - } else - check_read_file(i_ctx_p, s, pstdout); - if (r_has_type(pstdin, t_null)) { - code = zget_stdin(i_ctx_p, &s); - if (code < 0) - return code; - pstdin = &ref_stdio[0]; - } else - check_read_file(i_ctx_p, s, pstdin); - dmem = gs_imemory; - if (local) { - /* Share global VM, private local VM. */ - ref *puserdict; - uint userdict_size; - gs_memory_t *parent = iimemory_local->non_gc_memory; - gs_ref_memory_t *lmem; - gs_ref_memory_t *lmem_stable; - - if (dict_find_string(systemdict, "userdict", &puserdict) <= 0 || - !r_has_type(puserdict, t_dictionary) - ) - return_error(gs_error_Fatal); - old_userdict = *puserdict; - userdict_size = dict_maxlength(&old_userdict); - lmem = ialloc_alloc_state(parent, iimemory_local->clump_size); - lmem_stable = ialloc_alloc_state(parent, iimemory_local->clump_size); - if (lmem == 0 || lmem_stable == 0) { - gs_free_object(parent, lmem_stable, "do_fork"); - gs_free_object(parent, lmem, "do_fork"); - return_error(gs_error_VMerror); - } - lmem->space = avm_local; - lmem_stable->space = avm_local; - lmem->stable_memory = (gs_memory_t *)lmem_stable; - dmem.space_local = lmem; - code = context_create(psched, &pctx, &dmem, &pcur->state, false); - if (code < 0) { - /****** FREE lmem ******/ - return code; - } - /* - * Create a new userdict. PostScript code will take care of - * the rest of the initialization of the new context. - */ - code = dict_alloc(lmem, userdict_size, &new_userdict); - if (code < 0) { - context_destroy(pctx); - /****** FREE lmem ******/ - return code; - } - } else { - /* Share global and local VM. */ - code = context_create(psched, &pctx, &dmem, &pcur->state, false); - if (code < 0) { - /****** FREE lmem ******/ - return code; - } - /* - * Copy the gstate stack. The current method is not elegant; - * in fact, I'm not entirely sure it works. - */ - { - int n; - const gs_gstate *old; - gs_gstate *new; - - for (n = 0, old = igs; old != 0; old = gs_gstate_saved(old)) - ++n; - for (old = pctx->state.pgs; old != 0; old = gs_gstate_saved(old)) - --n; - for (; n > 0 && code >= 0; --n) - code = gs_gsave(pctx->state.pgs); - if (code < 0) { -/****** FREE lmem & GSTATES ******/ - return code; - } - for (old = igs, new = pctx->state.pgs; - old != 0 /* (== new != 0) */ && code >= 0; - old = gs_gstate_saved(old), new = gs_gstate_saved(new) - ) - code = gs_setgstate(new, old); - if (code < 0) { -/****** FREE lmem & GSTATES ******/ - return code; - } - } - } - zcontext_init(&pctx->state); - - interval = reschedule_interval; - if (interval < minimum_reschedule_interval) - interval = default_reschedule_interval; - - pctx->state.reschedule_proc = ctx_reschedule; - pctx->state.time_slice_proc = ctx_time_slice; - pctx->state.time_slice_ticks = interval; - - pctx->state.op_array_table_global = i_ctx_p->op_array_table_global; - pctx->state.op_array_table_local = i_ctx_p->op_array_table_local; - pctx->state.language_level = i_ctx_p->language_level; - pctx->state.dict_stack.min_size = idict_stack.min_size; - pctx->state.dict_stack.userdict_index = idict_stack.userdict_index; - pctx->state.stdio[0] = *pstdin; - pctx->state.stdio[1] = *pstdout; - pctx->state.stdio[2] = pcur->state.stdio[2]; - /* Initialize the interpreter stacks. */ - { - ref_stack_t *dstack = (ref_stack_t *)&pctx->state.dict_stack; - uint count = ref_stack_count(&d_stack); - uint copy = (local ? min_dstack_size : count); - - ref_stack_push(dstack, copy); - stack_copy(dstack, &d_stack, copy, count - copy); - if (local) { - /* Substitute the new userdict for the old one. */ - long i; - - for (i = 0; i < copy; ++i) { - ref *pdref = ref_stack_index(dstack, i); - - if (obj_eq(imemory, pdref, &old_userdict)) - *pdref = new_userdict; - } - } - } - { - ref_stack_t *estack = (ref_stack_t *)&pctx->state.exec_stack; - - ref_stack_push(estack, 3); - /* fork_done must be executed in both normal and error cases. */ - make_mark_estack(estack->p - 2, es_other, fork_done_with_error); - make_oper(estack->p - 1, 0, fork_done); - *estack->p = *op; - } - { - ref_stack_t *ostack = (ref_stack_t *)&pctx->state.op_stack; - uint count = mcount - 2; - - ref_stack_push(ostack, count); - stack_copy(ostack, &o_stack, count, osp - op + 1); - } - pctx->state.binary_object_format = pcur->state.binary_object_format; - add_last(psched, &psched->active, pctx); - pop(mcount - 1); - op = osp; - make_int(op, pctx->index); - return 0; -} - -/* - * Check that all values being passed by fork or join are old enough - * to be valid in the environment to which they are being transferred. - */ -static int -values_older_than(const ref_stack_t * pstack, uint first, uint last, - int next_space) -{ - uint i; - - for (i = first; i <= last; ++i) - if (r_space(ref_stack_index(pstack, (long)i)) >= next_space) - return_error(gs_error_invalidaccess); - return 0; -} - -/* This gets executed when a context terminates normally. */ -/****** MUST DO ALL RESTORES ******/ -/****** WHAT IF invalidrestore? ******/ -static int -fork_done(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - gs_context_t *pcur = (gs_context_t *)i_ctx_p; - gs_scheduler_t *psched = pcur->scheduler; - - if_debug2('\'', "[']done %ld%s\n", pcur->index, - (pcur->detach ? ", detached" : "")); - /* - * Clear the context's dictionary, execution and graphics stacks - * now, to retain as little as possible in case of a garbage - * collection or restore. We know that fork_done is the - * next-to-bottom entry on the execution stack. - */ - ref_stack_pop_to(&d_stack, min_dstack_size); - pop_estack(&pcur->state, ref_stack_count(&e_stack) - 1); - gs_grestoreall(igs); - /* - * If there are any unmatched saves, we need to execute restores - * until there aren't. An invalidrestore is possible and will - * result in an error termination. - */ - if (iimemory_local->save_level) { - ref *prestore; - - if (dict_find_string(systemdict, "restore", &prestore) <= 0) { - lprintf("restore not found in systemdict!"); - return_error(gs_error_Fatal); - } - if (pcur->detach) { - ref_stack_clear(&o_stack); /* help avoid invalidrestore */ - op = osp; - } - push(1); - make_tv(op, t_save, saveid, alloc_save_current_id(&gs_imemory)); - push_op_estack(fork_done); - ++esp; - ref_assign(esp, prestore); - return o_push_estack; - } - if (pcur->detach) { - /* - * We would like to free the context's memory, but we can't do - * it yet, because the interpreter still has references to it. - * Instead, queue the context to be freed the next time we - * reschedule. We can, however, clear its operand stack now. - */ - ref_stack_clear(&o_stack); - context_store(psched, pcur); - pcur->next_index = psched->dead_index; - psched->dead_index = pcur->index; - psched->current = 0; - } else { - gs_context_t *pctx = index_context(psched, pcur->joiner_index); - - pcur->status = cs_done; - /* Schedule the context waiting to join this one, if any. */ - if (pctx != 0) - add_last(psched, &psched->active, pctx); - } - return o_reschedule; -} -/* - * This gets executed when the stack is being unwound for an error - * termination. - */ -static int -fork_done_with_error(i_ctx_t *i_ctx_p) -{ -/****** WHAT TO DO? ******/ - return fork_done(i_ctx_p); -} - -/* <context> join <mark> <obj1> ... <objN> */ -static int -zjoin(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - gs_context_t *current = (gs_context_t *)i_ctx_p; - gs_scheduler_t *psched = current->scheduler; - gs_context_t *pctx; - int code; - - if ((code = context_param(psched, op, &pctx)) < 0) - return code; - if_debug2('\'', "[']join %ld, status = %d\n", - pctx->index, pctx->status); - /* - * It doesn't seem logically necessary, but the Red Book says that - * the context being joined must share both global and local VM with - * the current context. - */ - if (pctx->joiner_index != 0 || pctx->detach || pctx == current || - pctx->state.memory.space_global != - current->state.memory.space_global || - pctx->state.memory.space_local != - current->state.memory.space_local || - iimemory_local->save_level != 0 - ) - return_error(gs_error_invalidcontext); - switch (pctx->status) { - case cs_active: - /* - * We need to re-execute the join after the joined - * context is done. Since we can't return both - * o_push_estack and o_reschedule, we push a call on - * reschedule_now, which accomplishes the latter. - */ - check_estack(2); - push_op_estack(finish_join); - push_op_estack(reschedule_now); - pctx->joiner_index = current->index; - return o_push_estack; - case cs_done: - { - const ref_stack_t *ostack = - (ref_stack_t *)&pctx->state.op_stack; - uint count = ref_stack_count(ostack); - - push(count); - { - ref *rp = ref_stack_index(&o_stack, count); - - make_mark(rp); - } - stack_copy(&o_stack, ostack, count, 0); - context_destroy(pctx); - } - } - return 0; -} - -/* Finish a deferred join. */ -static int -finish_join(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - gs_context_t *current = (gs_context_t *)i_ctx_p; - gs_scheduler_t *psched = current->scheduler; - gs_context_t *pctx; - int code; - - if ((code = context_param(psched, op, &pctx)) < 0) - return code; - if_debug2('\'', "[']finish_join %ld, status = %d\n", - pctx->index, pctx->status); - if (pctx->joiner_index != current->index) - return_error(gs_error_invalidcontext); - pctx->joiner_index = 0; - return zjoin(i_ctx_p); -} - -/* Reschedule now. */ -static int -reschedule_now(i_ctx_t *i_ctx_p) -{ - return o_reschedule; -} - -/* - yield - */ -static int -zyield(i_ctx_t *i_ctx_p) -{ - gs_context_t *current = (gs_context_t *)i_ctx_p; - gs_scheduler_t *psched = current->scheduler; - - if (psched->active.head_index == 0) - return 0; - if_debug0('"', "[\"]yield\n"); - add_last(psched, &psched->active, current); - return o_reschedule; -} - -/* ------ Condition and lock operators ------ */ - -static int - monitor_cleanup(i_ctx_t *), - monitor_release(i_ctx_t *), - await_lock(i_ctx_t *); -static void - activate_waiting(gs_scheduler_t *, ctx_list_t * pcl); - -/* - condition <condition> */ -static int -zcondition(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - gs_condition_t *pcond = - ialloc_struct(gs_condition_t, &st_condition, "zcondition"); - - if (pcond == 0) - return_error(gs_error_VMerror); - pcond->waiting.head_index = pcond->waiting.tail_index = 0; - push(1); - make_istruct(op, a_all, pcond); - return 0; -} - -/* - lock <lock> */ -static int -zlock(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - gs_lock_t *plock = ialloc_struct(gs_lock_t, &st_lock, "zlock"); - - if (plock == 0) - return_error(gs_error_VMerror); - plock->holder_index = 0; - plock->waiting.head_index = plock->waiting.tail_index = 0; - plock->scheduler = NULL; - push(1); - make_istruct(op, a_all, plock); - return 0; -} - -/* <lock> <proc> monitor - */ -static int -zmonitor(i_ctx_t *i_ctx_p) -{ - gs_context_t *current = (gs_context_t *)i_ctx_p; - os_ptr op = osp; - gs_lock_t *plock; - gs_context_t *pctx; - int code; - - check_stype(op[-1], st_lock); - check_proc(*op); - plock = r_ptr(op - 1, gs_lock_t); - pctx = index_context(current->scheduler, plock->holder_index); - if_debug1('\'', "[']monitor 0x%lx\n", (ulong) plock); - if (pctx != 0) { - if (pctx == current || - (iimemory_local->save_level != 0 && - pctx->state.memory.space_local == - current->state.memory.space_local) - ) - return_error(gs_error_invalidcontext); - } - /* - * We push on the e-stack: - * The lock object - * An e-stack mark with monitor_cleanup, to release the lock - * in case of an error - * monitor_release, to release the lock in the normal case - * The procedure to execute - */ - check_estack(4); - code = lock_acquire(op - 1, current); - if (code != 0) { /* We didn't acquire the lock. Re-execute this later. */ - push_op_estack(zmonitor); - return code; /* o_reschedule */ - } - *++esp = op[-1]; - push_mark_estack(es_other, monitor_cleanup); - push_op_estack(monitor_release); - *++esp = *op; - pop(2); - return o_push_estack; -} -/* Release the monitor lock when unwinding for an error or exit. */ -static int -monitor_cleanup(i_ctx_t *i_ctx_p) -{ - int code = lock_release(esp); - - if (code < 0) - return code; - --esp; - return o_pop_estack; -} -/* Release the monitor lock when the procedure completes. */ -static int -monitor_release(i_ctx_t *i_ctx_p) -{ - int code = lock_release(esp - 1); - - if (code < 0) - return code; - esp -= 2; - return o_pop_estack; -} - -/* <condition> notify - */ -static int -znotify(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - gs_context_t *current = (gs_context_t *)i_ctx_p; - gs_condition_t *pcond; - - check_stype(*op, st_condition); - pcond = r_ptr(op, gs_condition_t); - if_debug1('"', "[\"]notify 0x%lx\n", (ulong) pcond); - pop(1); - op--; - if (pcond->waiting.head_index == 0) /* nothing to do */ - return 0; - activate_waiting(current->scheduler, &pcond->waiting); - return zyield(i_ctx_p); -} - -/* <lock> <condition> wait - */ -static int -zwait(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - gs_context_t *current = (gs_context_t *)i_ctx_p; - gs_scheduler_t *psched = current->scheduler; - gs_lock_t *plock; - gs_context_t *pctx; - gs_condition_t *pcond; - - check_stype(op[-1], st_lock); - plock = r_ptr(op - 1, gs_lock_t); - check_stype(*op, st_condition); - pcond = r_ptr(op, gs_condition_t); - if_debug2('"', "[\"]wait lock 0x%lx, condition 0x%lx\n", - (ulong) plock, (ulong) pcond); - pctx = index_context(psched, plock->holder_index); - if (pctx == 0 || pctx != psched->current || - (iimemory_local->save_level != 0 && - (r_space(op - 1) == avm_local || r_space(op) == avm_local)) - ) - return_error(gs_error_invalidcontext); - check_estack(1); - lock_release(op - 1); - add_last(psched, &pcond->waiting, pctx); - push_op_estack(await_lock); - return o_reschedule; -} -/* When the condition is signaled, wait for acquiring the lock. */ -static int -await_lock(i_ctx_t *i_ctx_p) -{ - gs_context_t *current = (gs_context_t *)i_ctx_p; - os_ptr op = osp; - int code = lock_acquire(op - 1, current); - - if (code == 0) { - pop(2); - return 0; - } - /* We didn't acquire the lock. Re-execute the wait. */ - push_op_estack(await_lock); - return code; /* o_reschedule */ -} - -/* Activate a list of waiting contexts, and reset the list. */ -static void -activate_waiting(gs_scheduler_t *psched, ctx_list_t * pcl) -{ - gs_context_t *pctx = index_context(psched, pcl->head_index); - gs_context_t *next; - - for (; pctx != 0; pctx = next) { - next = index_context(psched, pctx->next_index); - add_last(psched, &psched->active, pctx); - } - pcl->head_index = pcl->tail_index = 0; -} - -/* ------ Miscellaneous operators ------ */ - -/* - usertime <int> */ -static int -zusertime_context(i_ctx_t *i_ctx_p) -{ - gs_context_t *current = (gs_context_t *)i_ctx_p; - gs_scheduler_t *psched = current->scheduler; - os_ptr op = osp; - long utime = context_usertime(); - - push(1); - if (!current->state.keep_usertime) { - /* - * This is the first time this context has executed usertime: - * we must track its execution time from now on. - */ - psched->usertime_initial = utime; - current->state.keep_usertime = true; - } - make_int(op, current->state.usertime_total + utime - - psched->usertime_initial); - return 0; -} - -/* ------ Internal procedures ------ */ - -/* Create a context. */ -static int -context_create(gs_scheduler_t * psched, gs_context_t ** ppctx, - const gs_dual_memory_t * dmem, - const gs_context_state_t *i_ctx_p, bool copy_state) -{ - /* - * Contexts are always created at the outermost save level, so they do - * not need to be allocated in stable memory for the sake of - * save/restore. However, context_reclaim needs to be able to test - * whether a given context belongs to a given local VM, and allocating - * contexts in stable local VM avoids the need to scan multiple save - * levels when making this test. - */ - gs_memory_t *mem = gs_memory_stable((gs_memory_t *)dmem->space_local); - gs_context_t *pctx; - int code; - long ctx_index; - gs_context_t **pte; - ref *slice_ref; - - pctx = gs_alloc_struct(mem, gs_context_t, &st_context, "context_create"); - if (pctx == 0) - return_error(gs_error_VMerror); - if (copy_state) { - pctx->state = *i_ctx_p; - } else { - gs_context_state_t *pctx_st = &pctx->state; - - code = context_state_alloc(&pctx_st, systemdict, dmem); - if (code < 0) { - gs_free_object(mem, pctx, "context_create"); - return code; - } - } - - if (dict_find_string(systemdict, "TIME_SLICE_INTERVAL", &slice_ref) > 0) { - reschedule_interval = slice_ref->value.intval; - } - - ctx_index = gs_next_ids(mem, 1); - pctx->scheduler = psched; - pctx->status = cs_active; - pctx->index = ctx_index; - pctx->detach = false; - pctx->saved_local_vm = false; - pctx->visible = true; - pctx->next_index = 0; - pctx->joiner_index = 0; - pte = &psched->table[ctx_index % CTX_TABLE_SIZE]; - pctx->table_next = *pte; - *pte = pctx; - *ppctx = pctx; - if (gs_debug_c('\'') | gs_debug_c('"')) - dmlprintf2(imemory, "[']create %ld at 0x%lx\n", ctx_index, (ulong) pctx); - return 0; -} - -/* Check a context ID. Note that we do not check for context validity. */ -static int -context_param(const gs_scheduler_t * psched, os_ptr op, gs_context_t ** ppctx) -{ - gs_context_t *pctx; - - check_type(*op, t_integer); - pctx = index_context(psched, op->value.intval); - if (pctx == 0) - return_error(gs_error_invalidcontext); - *ppctx = pctx; - return 0; -} - -/* Read the usertime as a single value. */ -static long -context_usertime(void) -{ - long secs_ns[2]; - - gp_get_usertime(secs_ns); - return secs_ns[0] * 1000 + secs_ns[1] / 1000000; -} - -/* Destroy a context. */ -static void -context_destroy(gs_context_t * pctx) -{ - gs_ref_memory_t *mem = pctx->state.memory.space_local; - gs_scheduler_t *psched = pctx->scheduler; - gs_context_t **ppctx = &psched->table[pctx->index % CTX_TABLE_SIZE]; - - while (*ppctx != pctx) - ppctx = &(*ppctx)->table_next; - *ppctx = (*ppctx)->table_next; - if (gs_debug_c('\'') | gs_debug_c('"')) - dmlprintf3((const gs_memory_t *)mem, - "[']destroy %ld at 0x%lx, status = %d\n", - pctx->index, (ulong) pctx, pctx->status); - if (!context_state_free(&pctx->state)) - gs_free_object((gs_memory_t *) mem, pctx, "context_destroy"); -} - -/* Copy the top elements of one stack to another. */ -/* Note that this does not push the elements: */ -/* the destination stack must have enough space preallocated. */ -static void -stack_copy(ref_stack_t * to, const ref_stack_t * from, uint count, - uint from_index) -{ - long i; - - for (i = (long)count - 1; i >= 0; --i) - *ref_stack_index(to, i) = *ref_stack_index(from, i + from_index); -} - -/* Acquire a lock. Return 0 if acquired, o_reschedule if not. */ -static int -lock_acquire(os_ptr op, gs_context_t * pctx) -{ - gs_lock_t *plock = r_ptr(op, gs_lock_t); - - if (plock->holder_index == 0) { - plock->holder_index = pctx->index; - plock->scheduler = pctx->scheduler; - return 0; - } - add_last(pctx->scheduler, &plock->waiting, pctx); - return o_reschedule; -} - -/* Release a lock. Return 0 if OK, gs_error_invalidcontext if not. */ -static int -lock_release(ref * op) -{ - gs_lock_t *plock = r_ptr(op, gs_lock_t); - gs_scheduler_t *psched = plock->scheduler; - gs_context_t *pctx = index_context(psched, plock->holder_index); - - if (pctx != 0 && pctx == psched->current) { - plock->holder_index = 0; - activate_waiting(psched, &plock->waiting); - return 0; - } - return_error(gs_error_invalidcontext); -} - -/* ------ Initialization procedure ------ */ - -/* We need to split the table because of the 16-element limit. */ -const op_def zcontext1_op_defs[] = { - {"0condition", zcondition}, - {"0currentcontext", zcurrentcontext}, - {"1detach", zdetach}, - {"2.fork", zfork}, - {"1join", zjoin}, - {"4.localfork", zlocalfork}, - {"0lock", zlock}, - {"2monitor", zmonitor}, - {"1notify", znotify}, - {"2wait", zwait}, - {"0yield", zyield}, - /* Note that the following replace prior definitions */ - /* in the indicated files: */ - {"0usertime", zusertime_context}, /* zmisc.c */ - op_def_end(0) -}; -const op_def zcontext2_op_defs[] = { - /* Internal operators */ - {"0%fork_done", fork_done}, - {"1%finish_join", finish_join}, - {"0%monitor_cleanup", monitor_cleanup}, - {"0%monitor_release", monitor_release}, - {"2%await_lock", await_lock}, - op_def_end(zcontext_init) -}; diff --git a/psi/zdpnext.c b/psi/zdpnext.c deleted file mode 100644 index d649abe94..000000000 --- a/psi/zdpnext.c +++ /dev/null @@ -1,483 +0,0 @@ -/* Copyright (C) 2001-2018 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - - -/* NeXT Display PostScript extensions */ -#include "math_.h" -#include "ghost.h" -#include "oper.h" -#include "gscoord.h" -#include "gscspace.h" /* for iimage.h */ -#include "gsdpnext.h" -#include "gsmatrix.h" -#include "gsiparam.h" /* for iimage.h */ -#include "gsiparm2.h" -#include "gspath2.h" -#include "gxcvalue.h" -#include "gxdevice.h" -#include "gxsample.h" -#include "ialloc.h" -#include "igstate.h" -#include "iimage.h" -#include "iimage2.h" -#include "store.h" - -/* ------ alpha channel ------ */ - -/* - currentalpha <alpha> */ -static int -zcurrentalpha(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - - push(1); - make_real(op, gs_currentalpha(igs)); - return 0; -} - -/* <alpha> setalpha - */ -static int -zsetalpha(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - double alpha; - int code; - - if (real_param(op, &alpha) < 0) - return_op_typecheck(op); - if ((code = gs_setalpha(igs, alpha)) < 0) - return code; - pop(1); - return 0; -} - -/* ------ Imaging/compositing ------ */ - -/* - * Miscellaneous notes: - * - * composite / dissolve respect destination clipping (both clip & viewclip), - * but ignore source clipping. - * composite / dissolve must handle overlapping source/destination correctly. - * compositing converts the source to the destination's color model - * (including halftoning if needed). - */ - -/* - * Define the operand and bookeeping structure for a compositing operation. - */ -typedef struct alpha_composite_state_s { - /* Compositing parameters */ - gs_composite_alpha_params_t params; - /* Temporary structures */ - gs_composite_t *pcte; - gx_device *cdev; - gx_device *orig_dev; -} alpha_composite_state_t; - -/* Forward references */ -static int begin_composite(i_ctx_t *, alpha_composite_state_t *); -static void end_composite(i_ctx_t *, alpha_composite_state_t *); -static int xywh_param(os_ptr, double[4]); - -/* <dict> .alphaimage - */ -/* This is the dictionary version of the alphaimage operator, which is */ -/* now a pseudo-operator (see gs_dpnxt.ps). */ -static int -zalphaimage(i_ctx_t *i_ctx_p) -{ - return image1_setup(i_ctx_p, true); -} - -/* <destx> <desty> <width> <height> <op> compositerect - */ -static int -zcompositerect(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - double dest_rect[4]; - alpha_composite_state_t cstate; - int code = xywh_param(op - 1, dest_rect); - - if (code < 0) - return code; - check_int_leu(*op, compositerect_last); - cstate.params.op = (gs_composite_op_t) op->value.intval; - code = begin_composite(i_ctx_p, &cstate); - if (code < 0) - return code; - { - gs_rect rect; - - rect.q.x = (rect.p.x = dest_rect[0]) + dest_rect[2]; - rect.q.y = (rect.p.y = dest_rect[1]) + dest_rect[3]; - code = gs_rectfill(igs, &rect, 1); - } - end_composite(i_ctx_p, &cstate); - if (code >= 0) - pop(5); - return code; -} - -/* Common code for composite and dissolve. */ -static int -composite_image(i_ctx_t *i_ctx_p, const gs_composite_alpha_params_t * params) -{ - os_ptr op = osp; - alpha_composite_state_t cstate; - gs_image2_t image; - double src_rect[4]; - double dest_pt[2]; - gs_matrix save_ctm; - int code = xywh_param(op - 4, src_rect); - - cstate.params = *params; - gs_image2_t_init(&image); - if (code < 0 || - (code = num_params(op - 1, 2, dest_pt)) < 0 - ) - return code; - if (r_has_type(op - 3, t_null)) - image.DataSource = igs; - else { - check_stype(op[-3], st_igstate_obj); - check_read(op[-3]); - image.DataSource = igstate_ptr(op - 3); - } - image.XOrigin = src_rect[0]; - image.YOrigin = src_rect[1]; - image.Width = src_rect[2]; - image.Height = src_rect[3]; - image.PixelCopy = true; - /* Compute appropriate transformations. */ - gs_currentmatrix(igs, &save_ctm); - gs_translate(igs, dest_pt[0], dest_pt[1]); - gs_make_identity(&image.ImageMatrix); - if (image.DataSource == igs) { - image.XOrigin -= dest_pt[0]; - image.YOrigin -= dest_pt[1]; - } - code = begin_composite(i_ctx_p, &cstate); - if (code >= 0) { - code = process_non_source_image(i_ctx_p, - (const gs_image_common_t *)&image, - "composite_image"); - end_composite(i_ctx_p, &cstate); - if (code >= 0) - pop(8); - } - gs_setmatrix(igs, &save_ctm); - return code; -} - -/* <srcx> <srcy> <width> <height> <srcgstate|null> <destx> <desty> <op> */ -/* composite - */ -static int -zcomposite(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - gs_composite_alpha_params_t params; - - check_int_leu(*op, composite_last); - params.op = (gs_composite_op_t) op->value.intval; - params.delta = 0; /* prevents a Coverity warning, delta is only used for Dissolve mode */ - return composite_image(i_ctx_p, ¶ms); -} - -/* <srcx> <srcy> <width> <height> <srcgstate|null> <destx> <desty> <delta> */ -/* dissolve - */ -static int -zdissolve(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - gs_composite_alpha_params_t params; - double delta; - int code = real_param(op, &delta); - - if (code < 0) - return code; - if (delta < 0 || delta > 1) - return_error(gs_error_rangecheck); - params.op = composite_Dissolve; - params.delta = delta; - return composite_image(i_ctx_p, ¶ms); -} - -/* ------ Image reading ------ */ - -static int device_is_true_color(gx_device * dev); - -/* <x> <y> <width> <height> <matrix> .sizeimagebox */ -/* <dev_x> <dev_y> <dev_width> <dev_height> <matrix> */ -static void box_confine(int *pp, int *pq, int wh); -static int -zsizeimagebox(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - const gx_device *dev = gs_currentdevice(igs); - gs_rect srect, drect; - gs_matrix mat; - gs_int_rect rect; - int w, h; - int code; - - check_type(op[-4], t_integer); - check_type(op[-3], t_integer); - check_type(op[-2], t_integer); - check_type(op[-1], t_integer); - srect.p.x = (double)op[-4].value.intval; - srect.p.y = (double)op[-3].value.intval; - srect.q.x = srect.p.x + op[-2].value.intval; - srect.q.y = srect.p.y + op[-1].value.intval; - gs_currentmatrix(igs, &mat); - gs_bbox_transform(&srect, &mat, &drect); - /* - * We want the dimensions of the image as a source, not a - * destination, so we need to expand it rather than pixround. - */ - rect.p.x = (int)floor(drect.p.x); - rect.p.y = (int)floor(drect.p.y); - rect.q.x = (int)ceil(drect.q.x); - rect.q.y = (int)ceil(drect.q.y); - /* - * Clip the rectangle to the device boundaries, since that's what - * the NeXT implementation does. - */ - box_confine(&rect.p.x, &rect.q.x, dev->width); - box_confine(&rect.p.y, &rect.q.y, dev->height); - w = rect.q.x - rect.p.x; - h = rect.q.y - rect.p.y; - /* - * The NeXT documentation doesn't specify very clearly what is - * supposed to be in the matrix: the following produces results - * that match testing on an actual NeXT system. - */ - mat.tx -= rect.p.x; - mat.ty -= rect.p.y; - code = write_matrix(op, &mat); - if (code < 0) - return code; - make_int(op - 4, rect.p.x); - make_int(op - 3, rect.p.y); - make_int(op - 2, w); - make_int(op - 1, h); - return 0; -} -static void -box_confine(int *pp, int *pq, int wh) -{ - if ( *pq <= 0 ) - *pp = *pq = 0; - else if ( *pp >= wh ) - *pp = *pq = wh; - else { - if ( *pp < 0 ) - *pp = 0; - if ( *pq > wh ) - *pq = wh; - } -} - -/* - .sizeimageparams <bits/sample> <multiproc> <ncolors> */ -static int -zsizeimageparams(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - gx_device *dev = gs_currentdevice(igs); - uchar ncomp = dev->color_info.num_components; - int bps; - - push(3); - if (device_is_true_color(dev)) - bps = dev->color_info.depth / ncomp; - else { - /* - * Set bps to the smallest allowable number of bits that is - * sufficient to represent the number of different colors. - */ - gx_color_value max_value = - (dev->color_info.num_components == 1 ? - dev->color_info.max_gray : - max(dev->color_info.max_gray, dev->color_info.max_color)); - static const gx_color_value sizes[] = { - 1, 2, 4, 8, 12, gx_color_value_bits - }; - int i; - - for (i = 0;; ++i) - if (max_value <= ((ulong) 1 << sizes[i]) - 1) - break; - bps = sizes[i]; - } - make_int(op - 2, bps); - make_false(op - 1); - make_int(op, ncomp); - return 0; -} - -/* ------ Initialization procedure ------ */ - -const op_def zdpnext_op_defs[] = -{ - {"0currentalpha", zcurrentalpha}, - {"1setalpha", zsetalpha}, - {"1.alphaimage", zalphaimage}, - {"8composite", zcomposite}, - {"5compositerect", zcompositerect}, - {"8dissolve", zdissolve}, - {"5.sizeimagebox", zsizeimagebox}, - {"0.sizeimageparams", zsizeimageparams}, - op_def_end(0) -}; - -/* ------ Internal routines ------ */ - -/* Collect a rect operand. */ -static int -xywh_param(os_ptr op, double rect[4]) -{ - int code = num_params(op, 4, rect); - - if (code < 0) - return code; - if (rect[2] < 0) - rect[0] += rect[2], rect[2] = -rect[2]; - if (rect[3] < 0) - rect[1] += rect[3], rect[3] = -rect[3]; - return code; -} - -/* Begin a compositing operation. */ -static int -begin_composite(i_ctx_t *i_ctx_p, alpha_composite_state_t * pcp) -{ - gx_device *dev = gs_currentdevice(igs); - int code = - gs_create_composite_alpha(&pcp->pcte, &pcp->params, imemory); - - if (code < 0) - return code; - pcp->orig_dev = pcp->cdev = dev; /* for end_composite */ - code = (*dev_proc(dev, create_compositor)) - (dev, &pcp->cdev, pcp->pcte, igs, imemory, NULL); - if (code < 0) { - end_composite(i_ctx_p, pcp); - return code; - } - gs_setdevice_no_init(igs, pcp->cdev); - return 0; -} - -/* End a compositing operation. */ -static void -end_composite(i_ctx_t *i_ctx_p, alpha_composite_state_t * pcp) -{ - /* Close and free the compositor and the compositing object. */ - if (pcp->cdev != pcp->orig_dev) { - gs_closedevice(pcp->cdev); /* also frees the device */ - gs_setdevice_no_init(igs, pcp->orig_dev); - } - ifree_object(pcp->pcte, "end_composite(gs_composite_t)"); -} - -/* - * Determine whether a device has decomposed pixels with the components - * in the standard PostScript order, and a 1-for-1 color map - * (possibly inverted). Return 0 if not true color, 1 if true color, - * -1 if inverted true color. - */ -static int -device_is_true_color(gx_device * dev) -{ - uchar ncomp = dev->color_info.num_components; - int depth = dev->color_info.depth; - int i, max_v; - -#define CV(i) (gx_color_value)((ulong)gx_max_color_value * i / max_v) -#define CV0 ((gx_color_value)0) - - /****** DOESN'T HANDLE INVERSION YET ******/ - switch (ncomp) { - case 1: /* gray-scale */ - max_v = dev->color_info.max_gray; - if (max_v != (1 << depth) - 1) - return 0; - for (i = 0; i <= max_v; ++i) { - gx_color_value v[3]; - v[0] = v[1] = v[2] = CV(i); - if ((*dev_proc(dev, map_rgb_color)) (dev, v) != i) - return 0; - } - return true; - case 3: /* RGB */ - max_v = dev->color_info.max_color; - if (depth % 3 != 0 || max_v != (1 << (depth / 3)) - 1) - return false; - { - const int gs = depth / 3, rs = gs * 2; - - for (i = 0; i <= max_v; ++i) { - gx_color_value red[3]; - gx_color_value green[3]; - gx_color_value blue[3]; - red[0] = CV(i); red[1] = CV0, red[2] = CV0; - green[0] = CV0; green[1] = CV(i); green[2] = CV0; - blue[0] = CV0; blue[1] = CV0; blue[2] = CV(i); - if ((*dev_proc(dev, map_rgb_color)) (dev, red) != - i << rs || - (*dev_proc(dev, map_rgb_color)) (dev, green) != - i << gs || - (*dev_proc(dev, map_rgb_color)) (dev, blue) != - i /*<< bs */ - ) - return 0; - } - } - return true; - case 4: /* CMYK */ - max_v = dev->color_info.max_color; - if ((depth & 3) != 0 || max_v != (1 << (depth / 4)) - 1) - return false; - { - const int ys = depth / 4, ms = ys * 2, cs = ys * 3; - - for (i = 0; i <= max_v; ++i) { - - gx_color_value cyan[4]; - gx_color_value magenta[4]; - gx_color_value yellow[4]; - gx_color_value black[4]; - cyan[0] = CV(i); cyan[1] = cyan[2] = cyan[3] = CV0; - magenta[1] = CV(i); magenta[0] = magenta[2] = magenta[3] = CV0; - yellow[2] = CV(i); yellow[0] = yellow[1] = yellow[3] = CV0; - black[3] = CV(i); black[0] = black[1] = black[2] = CV0; - if ((*dev_proc(dev, map_cmyk_color)) (dev, cyan) != - i << cs || - (*dev_proc(dev, map_cmyk_color)) (dev, magenta) != - i << ms || - (*dev_proc(dev, map_cmyk_color)) (dev, yellow) != - i << ys || - (*dev_proc(dev, map_cmyk_color)) (dev, black) != - i /*<< ks */ - ) - return 0; - } - } - return 1; - default: - return 0; /* DeviceN */ - } -#undef CV -#undef CV0 -} diff --git a/psi/zdps.c b/psi/zdps.c deleted file mode 100644 index 76c98cc41..000000000 --- a/psi/zdps.c +++ /dev/null @@ -1,277 +0,0 @@ -/* Copyright (C) 2001-2018 Artifex Software, Inc. - All Rights Reserved. - - This software is provided AS-IS with no warranty, either express or - implied. - - This software is distributed under license and may not be copied, - modified or distributed except as expressly authorized under the terms - of the license contained in the file LICENSE in this distribution. - - Refer to licensing information at http://www.artifex.com or contact - Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato, - CA 94945, U.S.A., +1(415)492-9861, for further information. -*/ - - -/* Display PostScript extensions */ -#include "ghost.h" -#include "oper.h" -#include "gsstate.h" -#include "gsdps.h" -#include "gsimage.h" -#include "gsiparm2.h" -#include "gxalloc.h" /* for names_array in allocator */ -#include "gxfixed.h" /* for gxpath.h */ -#include "gxpath.h" -#include "btoken.h" /* for user_names_p */ -#include "iddict.h" -#include "idparam.h" -#include "igstate.h" -#include "iimage2.h" -#include "iname.h" -#include "store.h" - -/* Import the procedure for constructing user paths. */ -extern int make_upath(i_ctx_t *, ref *, const gs_gstate *, gx_path *, bool); - -/* ------ Graphics state ------ */ - -/* <screen_index> <x> <y> .setscreenphase - */ -static int -zsetscreenphase(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - int code; - int x, y; - - check_type(op[-2], t_integer); - check_type(op[-1], t_integer); - check_type(*op, t_integer); - x = op[-1].value.intval; - y = op->value.intval; - if (op[-2].value.intval < -1 || - op[-2].value.intval >= gs_color_select_count - ) - return_error(gs_error_rangecheck); - code = gs_setscreenphase(igs, x, y, - (gs_color_select_t) op[-2].value.intval); - if (code >= 0) - pop(3); - return code; -} - -/* <screen_index> .currentscreenphase <x> <y> */ -static int -zcurrentscreenphase(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - gs_int_point phase; - int code; - - check_type(*op, t_integer); - if (op->value.intval < -1 || - op->value.intval >= gs_color_select_count - ) - return_error(gs_error_rangecheck); - code = gs_currentscreenphase(igs, &phase, - (gs_color_select_t)op->value.intval); - if (code < 0) - return code; - push(1); - make_int(op - 1, phase.x); - make_int(op, phase.y); - return 0; -} - -/* ------ Device-source images ------ */ - -/* <dict> .image2 - */ -static int -zimage2(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - int code; - - check_type(*op, t_dictionary); - check_dict_read(*op); - { - gs_image2_t image; - ref *pDataSource; - - gs_image2_t_init(&image); - if ((code = dict_matrix_param(imemory, op, "ImageMatrix", - &image.ImageMatrix)) < 0 || - (code = dict_find_string(op, "DataSource", &pDataSource)) < 0 || - (code = dict_float_param(op, "XOrigin", 0.0, - &image.XOrigin)) != 0 || - (code = dict_float_param(op, "YOrigin", 0.0, - &image.YOrigin)) != 0 || - (code = dict_float_param(op, "Width", 0.0, - &image.Width)) != 0 || - image.Width <= 0 || - (code = dict_float_param(op, "Height", 0.0, - &image.Height)) != 0 || - image.Height <= 0 || - (code = dict_bool_param(op, "PixelCopy", false, - &image.PixelCopy)) < 0 - ) - return (code < 0 ? code : gs_note_error(gs_error_rangecheck)); - check_stype(*pDataSource, st_igstate_obj); - image.DataSource = igstate_ptr(pDataSource); - { - ref *ignoref; - - if (dict_find_string(op, "UnpaintedPath", &ignoref) > 0) { - check_dict_write(*op); - image.UnpaintedPath = gx_path_alloc(imemory, - ".image2 UnpaintedPath"); - if (image.UnpaintedPath == 0) - return_error(gs_error_VMerror); - } else - image.UnpaintedPath = 0; - } - code = process_non_source_image(i_ctx_p, - (const gs_image_common_t *)&image, - ".image2"); - if (image.UnpaintedPath) { - ref rupath; - - if (code < 0) - return code; - if (gx_path_is_null(image.UnpaintedPath)) - make_null(&rupath); - else - code = make_upath(i_ctx_p, &rupath, igs, image.UnpaintedPath, - false); - gx_path_free(image.UnpaintedPath, ".image2 UnpaintedPath"); - if (code < 0) - return code; - code = idict_put_string(op, "UnpaintedPath", &rupath); - } - } - if (code >= 0) - pop(1); - return code; -} - -/* ------ View clipping ------ */ - -/* - viewclip - */ -static int -zviewclip(i_ctx_t *i_ctx_p) -{ - return gs_viewclip(igs); -} - -/* - eoviewclip - */ -static int -zeoviewclip(i_ctx_t *i_ctx_p) -{ - return gs_eoviewclip(igs); -} - -/* - initviewclip - */ -static int -zinitviewclip(i_ctx_t *i_ctx_p) -{ - return gs_initviewclip(igs); -} - -/* - viewclippath - */ -static int -zviewclippath(i_ctx_t *i_ctx_p) -{ - return gs_viewclippath(igs); -} - -/* ------ User names ------ */ - -/* <index> <name> defineusername - */ -static int -zdefineusername(i_ctx_t *i_ctx_p) -{ - os_ptr op = osp; - ref uname; - - check_int_ltu(op[-1], max_array_size); - check_type(*op, t_name); - if (user_names_p == 0) { - int code = create_names_array(&user_names_p, imemory_local, - "defineusername"); - - if (code < 0) - return code; - } - if (array_get(imemory, user_names_p, - op[-1].value.intval, &uname) >= 0) { - switch (r_type(&uname)) { - case t_null: - break; - case t_name: - if (name_eq(&uname, op)) - goto ret; - /* falls through */ - default: - return_error(gs_error_invalidaccess); - } - } else { /* Expand the array. */ - ref new_array; - uint old_size = r_size(user_names_p); - uint new_size = (uint) op[-1].value.intval + 1; - - if (new_size < 100) - new_size = 100; - else if (new_size > max_array_size / 2) - new_size = max_array_size; - else if (new_size >> 1 < old_size) - new_size = (old_size > max_array_size / 2 ? max_array_size : - old_size << 1); - else - new_size <<= 1; - /* - * The user name array is allocated in stable local VM, - * because it must be immune to save/restore. - */ - { - gs_ref_memory_t *slmem = - (gs_ref_memory_t *)gs_memory_stable(imemory_local); - int code; - - code = gs_alloc_ref_array(slmem, &new_array, a_all, new_size, - "defineusername(new)"); - if (code < 0) - return code; - refcpy_to_new(new_array.value.refs, user_names_p->value.refs, - old_size, idmemory); - refset_null(new_array.value.refs + old_size, - new_size - old_size); - if (old_size) - gs_free_ref_array(slmem, user_names_p, "defineusername(old)"); - } - ref_assign(user_names_p, &new_array); - } - ref_assign(user_names_p->value.refs + op[-1].value.intval, op); - ret: - pop(2); - return 0; -} - -/* ------ Initialization procedure ------ */ - -const op_def zdps_op_defs[] = -{ - /* Graphics state */ - {"1.currentscreenphase", zcurrentscreenphase}, - {"3.setscreenphase", zsetscreenphase}, - /* Device-source images */ - {"1.image2", zimage2}, - /* View clipping */ - {"0eoviewclip", zeoviewclip}, - {"0initviewclip", zinitviewclip}, - {"0viewclip", zviewclip}, - {"0viewclippath", zviewclippath}, - /* User names */ - {"2defineusername", zdefineusername}, - op_def_end(0) -}; diff --git a/psi/zpdfops.c b/psi/zpdfops.c index 4b0d1df95..c082ac768 100644 --- a/psi/zpdfops.c +++ b/psi/zpdfops.c @@ -34,6 +34,32 @@ # include <stringprep.h> #endif +/* ------ Graphics state ------ */ + +/* <screen_index> <x> <y> .setscreenphase - */ +static int +zsetscreenphase(i_ctx_t *i_ctx_p) +{ + os_ptr op = osp; + int code; + int x, y; + + check_type(op[-2], t_integer); + check_type(op[-1], t_integer); + check_type(*op, t_integer); + x = op[-1].value.intval; + y = op->value.intval; + if (op[-2].value.intval < -1 || + op[-2].value.intval >= gs_color_select_count + ) + return_error(gs_error_rangecheck); + code = gs_setscreenphase(igs, x, y, + (gs_color_select_t) op[-2].value.intval); + if (code >= 0) + pop(3); + return code; +} + /* Construct a smooth path passing though a number of points on the stack */ /* for PDF ink annotations. The program is based on a very simple method of */ /* smoothing polygons by Maxim Shemanarev. */ @@ -222,6 +248,7 @@ const op_def zpdfops_op_defs[] = { {"0.pdfinkpath", zpdfinkpath}, {"1.pdfFormName", zpdfFormName}, + {"3.setscreenphase", zsetscreenphase}, #ifdef HAVE_LIBIDN {"1.saslprep", zsaslprep}, #endif diff --git a/toolbin/pre.chk b/toolbin/pre.chk index cbb4cdefd..136d81dd0 100644 --- a/toolbin/pre.chk +++ b/toolbin/pre.chk @@ -200,8 +200,8 @@ src/ugcclib.mak:DEVICE_DEVS14= src/ugcclib.mak:DEVICE_DEVS15= src/unixansi.mak:FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)pipe.dev src/unixtrad.mak:FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)pipe.dev -src/unix-gcc.mak:#FEATURE_DEVS=$(PSD)psl3.dev $(PSD)xpdf.dev $(PSD)dpsnext.dev $(PSD)pipe.dev $(PSD)rasterop.dev -src/unix-gcc.mak:FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)pipe.dev +src/unix-gcc.mak:#FEATURE_DEVS=$(PSD)psl3.dev $(PSD)xpdf.dev $(PSD)pipe.dev $(PSD)rasterop.dev +src/unix-gcc.mak:FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)pipe.dev src/dvx-gcc.mak:FEATURE_DEVS=psl3.dev pdf.dev src/bcwin32.mak:FEATURE_DEVS=psl3.dev pdf.dev ttfont.dev src/msvc32.mak:!ifndef FEATURE_DEVS @@ -235,4 +235,3 @@ src/watc.mak:CPU_TYPE=386 src/watc.mak:FPU_TYPE=0 src/gxfixed.h:#define _fixed_shift 12 src/gslib.c:/*#define CAPTURE */ -src/zcontext.c:private int reschedule_interval = 100; diff --git a/toolbin/pre.tcl b/toolbin/pre.tcl index 100046de8..332b1dd82 100755 --- a/toolbin/pre.tcl +++ b/toolbin/pre.tcl @@ -330,7 +330,6 @@ grept1 define.TEST [glob base/gdev*.c] grept1 define.PDFX base/gdevpdfx.h grept1 define.FORCE base/gshtscr.c grept1 define.CAPTURE base/gslib.c -grept1 interval.= base/zcontext.c # Apparently diff exits with a non-zero status if there are any differences! catch {exec diff $GREPFILE $CHECKFILE >> $DIFFFILE} exec wc $DIFFFILE >@ stdout diff --git a/windows/ghostscript.vcproj b/windows/ghostscript.vcproj index 65c05aca6..fd0597506 100644 --- a/windows/ghostscript.vcproj +++ b/windows/ghostscript.vcproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="UTF-8"?> <VisualStudioProject ProjectType="Visual C++" Version="8.00" @@ -1357,14 +1357,6 @@ > </File> <File - RelativePath="..\Resource\Init\gs_dpnxt.ps" - > - </File> - <File - RelativePath="..\Resource\Init\gs_dps.ps" - > - </File> - <File RelativePath="..\Resource\Init\gs_dps1.ps" > </File> @@ -2082,10 +2074,6 @@ > </File> <File - RelativePath="..\base\gsdps.c" - > - </File> - <File RelativePath="..\base\gsdps1.c" > </File> @@ -3594,14 +3582,6 @@ > </File> <File - RelativePath="..\base\gsdpnext.h" - > - </File> - <File - RelativePath="..\base\gsdps.h" - > - </File> - <File RelativePath="..\base\gsdsrc.h" > </File> @@ -8156,10 +8136,6 @@ > </File> <File - RelativePath="..\psi\zcontext.c" - > - </File> - <File RelativePath="..\psi\zcontrol.c" > </File> @@ -8200,14 +8176,6 @@ > </File> <File - RelativePath="..\psi\zdpnext.c" - > - </File> - <File - RelativePath="..\psi\zdps.c" - > - </File> - <File RelativePath="..\psi\zdps1.c" > </File> diff --git a/windows/ghostscript_rt.vcxproj b/windows/ghostscript_rt.vcxproj index 42e6fe474..b73fe2954 100644 --- a/windows/ghostscript_rt.vcxproj +++ b/windows/ghostscript_rt.vcxproj @@ -494,7 +494,6 @@ <ClCompile Include="..\base\gsdevice.c" /> <ClCompile Include="..\base\gsdevmem.c" /> <ClCompile Include="..\base\gsdparam.c" /> - <ClCompile Include="..\base\gsdps.c" /> <ClCompile Include="..\base\gsdps1.c" /> <ClCompile Include="..\base\gsdsrc.c" /> <ClCompile Include="..\base\gsfcid.c" /> @@ -1159,7 +1158,6 @@ <ClCompile Include="..\psi\zcolor1.c" /> <ClCompile Include="..\psi\zcolor2.c" /> <ClCompile Include="..\psi\zcolor3.c" /> - <ClCompile Include="..\psi\zcontext.c" /> <ClCompile Include="..\psi\zcontrol.c" /> <ClCompile Include="..\psi\zcrd.c" /> <ClCompile Include="..\psi\zcsindex.c" /> @@ -1170,8 +1168,6 @@ <ClCompile Include="..\psi\zdevice2.c" /> <ClCompile Include="..\psi\zdict.c" /> <ClCompile Include="..\psi\zdouble.c" /> - <ClCompile Include="..\psi\zdpnext.c" /> - <ClCompile Include="..\psi\zdps.c" /> <ClCompile Include="..\psi\zdps1.c" /> <ClCompile Include="..\psi\zdscpars.c" /> <ClCompile Include="..\psi\zfaes.c" /> @@ -1716,8 +1712,6 @@ <ClInclude Include="..\base\gsdfilt.h" /> <ClInclude Include="..\base\gsdll.h" /> <ClInclude Include="..\base\gsdllwin.h" /> - <ClInclude Include="..\base\gsdpnext.h" /> - <ClInclude Include="..\base\gsdps.h" /> <ClInclude Include="..\base\gsdsrc.h" /> <ClInclude Include="..\base\gsequivc.h" /> <ClInclude Include="..\base\gserrors.h" /> @@ -2612,8 +2606,6 @@ <None Include="..\Resource\Init\gs_dbt_e.ps" /> <None Include="..\Resource\Init\gs_diskf.ps" /> <None Include="..\Resource\Init\gs_diskn.ps" /> - <None Include="..\Resource\Init\gs_dpnxt.ps" /> - <None Include="..\Resource\Init\gs_dps.ps" /> <None Include="..\Resource\Init\gs_dps1.ps" /> <None Include="..\Resource\Init\gs_dps2.ps" /> <None Include="..\Resource\Init\gs_dscp.ps" /> |