home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / gnu / gs-2.6.1.4-src.lha / src / diffs / ghostscript-2.6.1.diffs
Text File  |  1994-02-22  |  236KB  |  8,521 lines

  1. diff -rc --new-file ghostscript-2.6.1-fsf/NEWS ghostscript-2.6.1-amiga/NEWS
  2. *** ghostscript-2.6.1-fsf/NEWS    Sat May 29 07:40:14 1993
  3. --- ghostscript-2.6.1-amiga/NEWS    Tue Feb 22 13:48:22 1994
  4. ***************
  5. *** 1062,1068 ****
  6.   
  7.   For Unix systems, changes the directories in GS_LIB_DEFAULT from
  8.   `pwd` to $(gsdatadir), i.e., normally $(datadir)/ghostscript, where
  9. ! datadir is normally /usr/local/lib.
  10.   
  11.   Adds a note in the header file to the effect that the X Windows
  12.   driver expects to find header files in $(XINCLUDE)/X11, not in
  13. --- 1062,1068 ----
  14.   
  15.   For Unix systems, changes the directories in GS_LIB_DEFAULT from
  16.   `pwd` to $(gsdatadir), i.e., normally $(datadir)/ghostscript, where
  17. ! datadir is normally /gnu/lib.
  18.   
  19.   Adds a note in the header file to the effect that the X Windows
  20.   driver expects to find header files in $(XINCLUDE)/X11, not in
  21. diff -rc --new-file ghostscript-2.6.1-fsf/amiga-gcc.mak ghostscript-2.6.1-amiga/amiga-gcc.mak
  22. *** ghostscript-2.6.1-fsf/amiga-gcc.mak    Thu Jan  1 00:00:00 1970
  23. --- ghostscript-2.6.1-amiga/amiga-gcc.mak    Tue Feb 22 14:57:45 1994
  24. ***************
  25. *** 0 ****
  26. --- 1,2010 ----
  27. + #    Copyright (C) 1989, 1992, 1993 Aladdin Enterprises.  All rights reserved.
  28. + #
  29. + # This file is part of Ghostscript.
  30. + #
  31. + # Ghostscript is distributed in the hope that it will be useful, but
  32. + # WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  33. + # to anyone for the consequences of using it or for whether it serves any
  34. + # particular purpose or works at all, unless he says so in writing.  Refer
  35. + # to the Ghostscript General Public License for full details.
  36. + #
  37. + # Everyone is granted permission to copy, modify and redistribute
  38. + # Ghostscript, but only under the conditions described in the Ghostscript
  39. + # General Public License.  A copy of this license is supposed to have been
  40. + # given to you along with Ghostscript so you can know your rights and
  41. + # responsibilities.  It should be in a file named COPYING.  Among other
  42. + # things, the copyright notice and this notice must be preserved on all
  43. + # copies.
  44. + # makefile for Ghostscript, Unix/gcc/X11 configuration.
  45. + # Note: this makefile assumes you are using gcc in ANSI mode.
  46. + # ------------------------------- Options ------------------------------- #
  47. + ####### The following are the only parts of the file you should need to edit.
  48. + # ------ Generic options ------ #
  49. + # Define the installation commands and target directories for
  50. + # executables and files.  Only relevant to `make install'.
  51. + INSTALL = install -c
  52. + INSTALL_PROGRAM = $(INSTALL) -m 775
  53. + INSTALL_DATA = $(INSTALL) -m 664
  54. + prefix = /gnu
  55. + exec_prefix = $(prefix)
  56. + bindir = $(exec_prefix)/bin
  57. + datadir = $(prefix)/lib
  58. + gsdatadir = $(datadir)/ghostscript
  59. + # Define the default directory/ies for the runtime
  60. + # initialization and font files.  Separate multiple directories with a ','.
  61. + GS_LIB_DEFAULT=$(gsdatadir),$(gsdatadir)/fonts
  62. + # Define the name of the Ghostscript initialization file.
  63. + # (There is no reason to change this.)
  64. + GS_INIT=gs_init.ps
  65. + # Choose generic configuration options.
  66. + # -DDEBUG
  67. + #    includes debugging features (-Z switch) in the code.
  68. + #      Code runs substantially slower even if no debugging switches
  69. + #      are set.
  70. + # -DNOPRIVATE
  71. + #    makes private (static) procedures and variables public,
  72. + #      so they are visible to the debugger and profiler.
  73. + #      No execution time or space penalty.
  74. + GENOPT=
  75. + # Define the name of the executable file.
  76. + GS=gs
  77. + # ------ Platform-specific options ------ #
  78. + # Define the name of the C compiler.
  79. + CC=gcc
  80. + # Define the other compilation flags.
  81. + # Add -DBSD4_2 for 4.2bsd systems.
  82. + # Add -DUSG (GNU convention) or -DSYSV for System V or DG/UX.
  83. + # Add -DSYSV -D__SVR3 for SCO ODT, ISC Unix 2.2 or before,
  84. + #   or any System III Unix, or System V release 3-or-older Unix.
  85. + # Add -DSVR4 (not -DSYSV) for System V release 4.
  86. + # XCFLAGS can be set from the command line.
  87. + # We don't include -ansi, because this gets in the way of the platform-
  88. + #   specific stuff that <math.h> typically needs; nevertheless, we expect
  89. + #   gcc to accept ANSI-style function prototypes and function definitions.
  90. + #FPU_FLAG =-Dm68881
  91. + #CPU_FLAG =-Dm68030
  92. + XCFLAGS = -O6 $(FPU_FLAG) $(CPU_FLAG)
  93. + CFLAGS=-DUSG $(XCFLAGS)
  94. + # Define platform flags for ld.
  95. + # SunOS and some others want -X; Ultrix wants -x.
  96. + # SunOS 4.n may need -Bstatic.
  97. + # XLDFLAGS can be set from the command line.
  98. + LDFLAGS=$(XLDFLAGS)
  99. + # Define any extra libraries to link into the executable.
  100. + # ISC Unix 2.2 wants -linet.
  101. + # SCO Unix needs -lsocket if you aren't including the X11 driver.
  102. + # (Libraries required by individual drivers are handled automatically.)
  103. + EXTRALIBS=
  104. + # Define the include switch(es) for the X11 header files.
  105. + # This can be null if handled in some other way (e.g., the files are
  106. + # in /gnu/include, or the directory is supplied by an environment variable).
  107. + # Note that x_.h expects to find the header files in $(XINCLUDE)/X11,
  108. + # not in $(XINCLUDE).
  109. + #XINCLUDE=-I/gnu/X/include
  110. + # Define the directory/ies for the X11 library files.
  111. + # This can be null if these files are in the default linker search path.
  112. + #XLIBDIRS=-L/gnu/X/lib
  113. + # ------ Devices and features ------ #
  114. + # Choose the language feature(s) to include.  See gs.mak for details.
  115. + FEATURE_DEVS=filter.dev dps.dev level2.dev
  116. + # Choose the device(s) to include.  See devs.mak for details.
  117. + DEVICE_DEVS=amiga_.dev amiga.dev amiga_low.dev amiga_high.dev amiga_super.dev
  118. + DEVICE_DEVS1=amiga_a2024.dev amiga_picassoii.dev amiga_printer.dev
  119. + DEVICE_DEVS2=amiga_ilbm.dev amiga_custom.dev
  120. + # ---------------------------- End of options --------------------------- #
  121. + # Define the name of the makefile -- used in dependencies.
  122. + MAKEFILE=amiga-gcc.mak
  123. + # Define the ANSI-to-K&R dependency.  (gcc accepts ANSI syntax.)
  124. + AK=
  125. + # Define the compilation rules and flags.
  126. + CCC=$(CC) $(CCFLAGS) -c
  127. + # --------------------------- Generic makefile ---------------------------- #
  128. + # The remainder of the makefile (unixhead.mak, gs.mak, devs.mak, unixtail.mak)
  129. + # is generic.  tar_cat concatenates all these together.
  130. + #    Copyright (C) 1990, 1991, 1993 Aladdin Enterprises.  All rights reserved.
  131. + #
  132. + # This file is part of Ghostscript.
  133. + #
  134. + # Ghostscript is distributed in the hope that it will be useful, but
  135. + # WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  136. + # to anyone for the consequences of using it or for whether it serves any
  137. + # particular purpose or works at all, unless he says so in writing.  Refer
  138. + # to the Ghostscript General Public License for full details.
  139. + #
  140. + # Everyone is granted permission to copy, modify and redistribute
  141. + # Ghostscript, but only under the conditions described in the Ghostscript
  142. + # General Public License.  A copy of this license is supposed to have been
  143. + # given to you along with Ghostscript so you can know your rights and
  144. + # responsibilities.  It should be in a file named COPYING.  Among other
  145. + # things, the copyright notice and this notice must be preserved on all
  146. + # copies.
  147. + # Partial makefile for Ghostscript, common to all Unix configurations.
  148. + # This part of the makefile gets inserted after the compiler-specific part
  149. + # (xxx-head.mak) and before gs.mak and devs.mak.
  150. + # ----------------------------- Generic stuff ----------------------------- #
  151. + # Define the platform name.  For a "stock" System V platform,
  152. + # use sysv_ instead of unix_.
  153. + PLATFORM=amiga
  154. + # Define the extensions for the object and executable files.
  155. + OBJ=o
  156. + XE=
  157. + # Define the current directory prefix, shell quote string, and shell names.
  158. + EXP=
  159. + QQ=\"
  160. + SHELL=/bin/sh
  161. + SH=$(SHELL)
  162. + SHP=$(SH) $(EXP)
  163. + # Define the compilation rules and flags.
  164. + CCFLAGS=$(GENOPT) $(CFLAGS)
  165. + .c.o: $(AK)
  166. +     $(CCC) $*.c
  167. + CCCF=$(CCC)
  168. + CCD=$(CCC)
  169. + CCINT=$(CCC)
  170. + #    Copyright (C) 1989, 1992, 1993 Aladdin Enterprises.  All rights reserved.
  171. + #
  172. + # This file is part of Ghostscript.
  173. + #
  174. + # Ghostscript is distributed in the hope that it will be useful, but
  175. + # WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  176. + # to anyone for the consequences of using it or for whether it serves any
  177. + # particular purpose or works at all, unless he says so in writing.  Refer
  178. + # to the Ghostscript General Public License for full details.
  179. + #
  180. + # Everyone is granted permission to copy, modify and redistribute
  181. + # Ghostscript, but only under the conditions described in the Ghostscript
  182. + # General Public License.  A copy of this license is supposed to have been
  183. + # given to you along with Ghostscript so you can know your rights and
  184. + # responsibilities.  It should be in a file named COPYING.  Among other
  185. + # things, the copyright notice and this notice must be preserved on all
  186. + # copies.
  187. + # Generic makefile for Ghostscript.
  188. + # The platform-specific makefiles `include' this file.
  189. + # They define the following symbols:
  190. + #    GS - the name of the executable (without the extension, if any).
  191. + #    GS_LIB_DEFAULT - the default directory/ies for searching for the
  192. + #        initialization and font files at run time.
  193. + #    DEVICE_DEVS - the devices to include in the executable.
  194. + #        See devs.mak for details.
  195. + #    DEVICE_DEVS1...DEVICE_DEVS9 - additional devices, if the definition of
  196. + #        DEVICE_DEVS doesn't fit on one line.
  197. + #        See devs.mak for details.
  198. + #    FEATURE_DEVS - the optional features to include in the
  199. + #        executable.  Current features are:
  200. + #            dps - (partial) support for Display PostScript extensions:
  201. + #            see language.doc for details.
  202. + #            level2 - (partial) support for PostScript Level 2
  203. + #            extensions: see language.doc for details.
  204. + #            compfont - support for composite (type 0) fonts.
  205. + #            *** NOT IMPLEMENTED YET. ***
  206. + #            filter - support for Level 2 filters (other than eexec,
  207. + #            ASCIIHexEncode/Decode, NullEncode, PFBDecode,
  208. + #            and SubFileDecode, which are always included).
  209. + #            ccfonts - precompile fonts into C, and link them
  210. + #            with the executable.  In the standard makefiles,
  211. + #            this is only implemented for a very few fonts:
  212. + #            see fonts.doc for details.
  213. + # It is very unlikely that anyone would want to edit the remaining
  214. + #   symbols, but we describe them here for completeness:
  215. + #    GS_INIT - the name of the initialization file for Ghostscript,
  216. + #        normally gs_init.ps.
  217. + #    PLATFORM - a "device" name for the platform, so that platforms can
  218. + #        add various kinds of resources like devices and features.
  219. + #    QQ - a " preceded by whatever escape characters are needed to
  220. + #        persuade the shell to pass a " to a program (" on MS-DOS,
  221. + #        \" on Unix).
  222. + #    XE - the extension for executable files (e.g., null or .exe).
  223. + #    OBJ - the extension for relocatable object files (e.g., o or obj).
  224. + #    BEGINFILES - the list of files that `make begin' should delete.
  225. + #    CCBEGIN - the compilation command for `make begin', normally
  226. + #        $(CCC) *.c.
  227. + #    CCC - the C invocation for normal compilation.
  228. + #    CCD - the C invocation for files that store into frame buffers or
  229. + #        device registers.  Needed because some optimizing compilers
  230. + #        will eliminate necessary stores.
  231. + #    CCCF - the C invocation for compiled fonts and other large,
  232. + #        self-contained data modules.  Needed because MS-DOS
  233. + #        requires using the 'huge' memory model for these.
  234. + #    CCINT - the C invocation for compiling the main interpreter module,
  235. + #        normally the same as CCC: this is needed because the
  236. + #        Borland compiler generates *worse* code for this module
  237. + #        (but only this module) when optimization (-O) is turned on.
  238. + #    AK - if source files must be converted from ANSI to K&R syntax,
  239. + #        this is ansi2knr$(XE); if not, it is null.
  240. + #        If a particular platform requires other utility programs
  241. + #        to be built, AK must include them too.
  242. + #    SHP - the prefix for invoking a shell script in the current directory
  243. + #        (null for MS-DOS, $(SH) ./ for Unix).
  244. + #    EXPP, EXP - the prefix for invoking an executable program in the
  245. + #        current directory (null for MS-DOS, ./ for Unix).
  246. + #    SH - the shell for scripts (null on MS-DOS, sh on Unix).
  247. + # The platform-specific makefiles must also include rules for creating
  248. + #   ansi2knr$(XE), genarch$(XE), and genconf$(XE) from the corresponding
  249. + #   .c files -- this is needed because Turbo C and Unix C treat the -o
  250. + #   switch slightly differently (Turbo C requires no following space,
  251. + #   Unix C requires a following space), and I haven't found a way to capture
  252. + #   the difference in a macro.
  253. + all default: $(GS)$(XE)
  254. + distclean realclean: clean
  255. +     rm -f makefile
  256. + clean mostlyclean:
  257. +     rm -f *.$(OBJ) *.a core gmon.out
  258. +     rm -f *.dev *.d_* arch.h gconfig*.h o*.tr l*.tr
  259. +     rm -f t _temp_* _temp_*.* *.map *.sym
  260. +     rm -f ansi2knr$(XE) echogs$(XE) genarch$(XE) genconf$(XE)
  261. +     rm -f $(GS)$(XE) $(BEGINFILES)
  262. + # A rule to do a quick and dirty compilation attempt when first installing
  263. + # Ghostscript.  Many of the compilations will fail: follow this with 'make'.
  264. + begin:
  265. +     rm -f arch.h genarch$(XE) $(GS)$(XE) $(BEGINFILES)
  266. +     make arch.h
  267. +     - $(CCBEGIN)
  268. +     rm -f gconfig.$(OBJ) gdev*.$(OBJ) gp_*.$(OBJ) gsmisc.$(OBJ)
  269. +     rm -f iccfont.$(OBJ) iinit.$(OBJ) interp.$(OBJ) zfiledev.$(OBJ)
  270. + # Auxiliary programs
  271. + arch.h: genarch$(XE)
  272. +     $(EXPP) $(EXP)genarch arch.h
  273. + # -------------------------------- Library -------------------------------- #
  274. + # Define the inter-dependencies of the .h files.
  275. + # Since not all versions of `make' defer expansion of macros,
  276. + # we must list these in bottom-to-top order.
  277. + # Generic files
  278. + arch_h=arch.h
  279. + std_h=std.h $(arch_h)
  280. + # Platform interfaces
  281. + gp_h=gp.h
  282. + gpcheck_h=gpcheck.h
  283. + # C library interfaces
  284. + # Because of variations in the "standard" header files between systems, and
  285. + # because we must include std.h before any file that includes sys/types.h,
  286. + # we define local include files named *_.h to substitute for <*.h>.
  287. + vmsmath_h=vmsmath.h
  288. + dos__h=dos_.h
  289. + ctype__h=ctype_.h $(std_h)
  290. + errno__h=errno_.h
  291. + malloc__h=malloc_.h $(std_h)
  292. + math__h=math_.h $(std_h) $(vmsmath_h)
  293. + memory__h=memory_.h $(std_h)
  294. + stat__h=stat_.h $(std_h)
  295. + stdio__h=stdio_.h $(std_h)
  296. + string__h=string_.h $(std_h)
  297. + time__h=time_.h $(std_h)
  298. + windows__h=windows_.h
  299. + # Miscellaneous
  300. + gdebug_h=gdebug.h
  301. + gsio_h=gsio.h
  302. + gstypes_h=gstypes.h
  303. + gs_h=gs.h $(stdio__h) $(gsio_h) $(gstypes_h)
  304. + gx_h=gx.h $(gs_h) $(gdebug_h)
  305. + gconfig_h=gconfig.h gsconfig.h
  306. + gserrors_h=gserrors.h
  307. + GX=$(AK) $(gx_h)
  308. + GXERR=$(GX) $(gserrors_h)
  309. + ###### Low-level facilities and utilities
  310. + ### Include files
  311. + gsccode_h=gsccode.h
  312. + gschar_h=gschar.h $(gsccode_h)
  313. + gscie_h=gscie.h
  314. + gscolor_h=gscolor.h
  315. + gscolor2_h=gscolor2.h
  316. + gscoord_h=gscoord.h
  317. + gscrypt1_h=gscrypt1.h
  318. + gscspace_h=gscspace.h
  319. + gsfont_h=gsfont.h
  320. + gsimage_h=gsimage.h
  321. + gsmatrix_h=gsmatrix.h
  322. + gspaint_h=gspaint.h
  323. + gspath_h=gspath.h
  324. + gsprops_h=gsprops.h
  325. + gsstate_h=gsstate.h $(gscolor_h)
  326. + gstype1_h=gstype1.h
  327. + gsuid_h=gsuid.h
  328. + gsutil_h=gsutil.h
  329. + gsxfont_h=gsxfont.h
  330. + gxarith_h=gxarith.h
  331. + gxbitmap_h=gxbitmap.h
  332. + gxcache_h=gxcache.h $(gsuid_h) $(gsxfont_h)
  333. + gxcdir_h=gxcdir.h
  334. + gxchar_h=gxchar.h $(gschar_h)
  335. + gxclist_h=gxclist.h
  336. + # gxcldev is out of order because it include gxclist.
  337. + gxcldev_h=gxcldev.h $(gxclist_h)
  338. + gxcpath_h=gxcpath.h
  339. + gxdevice_h=gxdevice.h $(gsmatrix_h) $(gsxfont_h) $(gxbitmap_h)
  340. + gxdevmem_h=gxdevmem.h
  341. + gxfdir_h=gxfdir.h $(gxcdir_h)
  342. + gxfixed_h=gxfixed.h
  343. + gxfont_h=gxfont.h $(gsfont_h) $(gsuid_h)
  344. + gxfrac_h=gxfrac.h
  345. + gximage_h=gximage.h $(gscspace_h) $(gsimage_h)
  346. + gxlum_h=gxlum.h
  347. + gxmatrix_h=gxmatrix.h $(gsmatrix_h)
  348. + gxop1_h=gxop1.h
  349. + gxpath_h=gxpath.h
  350. + gxrefct_h=gxrefct.h
  351. + gxtype1_h=gxtype1.h $(gscrypt1_h) $(gstype1_h)
  352. + gxxfont_h=gxxfont.h $(gsccode_h) $(gsmatrix_h) $(gsuid_h) $(gsxfont_h)
  353. + # gxcolor and gxfmap are out of order because they include other files.
  354. + gxcolor_h=gxcolor.h $(gxfrac_h) $(gsuid_h)
  355. + gxfmap_h=gxfmap.h $(gxfrac_h) $(gxrefct_h)
  356. + gzcolor_h=gzcolor.h $(gscolor_h) $(gxfmap_h) $(gxlum_h)
  357. + gzdevice_h=gzdevice.h $(gxdevice_h)
  358. + gzht_h=gzht.h
  359. + gzline_h=gzline.h
  360. + gzpath_h=gzpath.h $(gxpath_h)
  361. + gzstate_h=gzstate.h $(gsstate_h) $(gxfixed_h) $(gxmatrix_h)
  362. + ### Executable code
  363. + gp_nofb.$(OBJ): gp_nofb.c $(AK) \
  364. +   $(gx_h) $(gp_h) $(gxdevice_h)
  365. + gsutil.$(OBJ): gsutil.c $(AK) \
  366. +   $(std_h) $(gsprops_h) $(gsutil_h)
  367. + gxccache.$(OBJ): gxccache.c $(GXERR) $(gpcheck_h) \
  368. +   $(gxfixed_h) $(gxmatrix_h) $(gzdevice_h) $(gzcolor_h) \
  369. +   $(gxcpath_h) $(gxdevmem_h) $(gxfont_h) $(gxfdir_h) $(gxchar_h) \
  370. +   $(gxcache_h) $(gxxfont_h) $(gzstate_h) $(gzpath_h) \
  371. +   $(gscspace_h) $(gsimage_h)
  372. + gxccman.$(OBJ): gxccman.c $(GXERR) $(gpcheck_h) \
  373. +   $(gxfixed_h) $(gxmatrix_h) $(gzdevice_h) $(gzcolor_h) \
  374. +   $(gxcpath_h) $(gxdevmem_h) $(gxfont_h) $(gxfdir_h) $(gxchar_h) \
  375. +   $(gxcache_h) $(gxxfont_h) $(gzstate_h) $(gzpath_h)
  376. + gxclist.$(OBJ): gxclist.c $(GXERR) $(gpcheck_h) \
  377. +   $(gsmatrix_h) $(gxbitmap_h) $(gxcldev_h) $(gxdevice_h) $(gxdevmem_h)
  378. + gxclread.$(OBJ): gxclread.c $(GXERR) $(gpcheck_h) \
  379. +   $(gsmatrix_h) $(gxbitmap_h) $(gxcldev_h) $(gxdevice_h) $(gxdevmem_h)
  380. + gxcmap.$(OBJ): gxcmap.c $(GXERR) \
  381. +   $(gscspace_h) \
  382. +   $(gxcolor_h) $(gxdevice_h) $(gxfrac_h) $(gxlum_h) \
  383. +   $(gzcolor_h) $(gzstate_h)
  384. + gxcpath.$(OBJ): gxcpath.c $(GXERR) \
  385. +   $(gxdevice_h) $(gxfixed_h) $(gzcolor_h) $(gzpath_h) $(gxcpath_h)
  386. + gxdither.$(OBJ): gxdither.c $(GX) \
  387. +   $(gxfixed_h) $(gxlum_h) $(gxmatrix_h) $(gzstate_h) $(gzdevice_h) $(gzcolor_h) $(gzht_h)
  388. + gxdraw.$(OBJ): gxdraw.c $(GXERR) $(gpcheck_h) \
  389. +   $(gxfixed_h) $(gxmatrix_h) $(gxbitmap_h) $(gzcolor_h) $(gzdevice_h) $(gzstate_h)
  390. + gxfill.$(OBJ): gxfill.c $(GXERR) \
  391. +   $(gxfixed_h) $(gxmatrix_h) $(gxdevice_h) $(gzcolor_h) $(gzpath_h) $(gzstate_h) $(gxcpath_h)
  392. + gxhint1.$(OBJ): gxhint1.c $(GXERR) \
  393. +   $(gxarith_h) $(gxfixed_h) $(gxmatrix_h) $(gxdevmem_h) $(gxchar_h) $(gxfont_h) $(gxtype1_h) \
  394. +   $(gzdevice_h) $(gzstate_h)
  395. + gxhint2.$(OBJ): gxhint2.c $(GXERR) \
  396. +   $(gxarith_h) $(gxfixed_h) $(gxmatrix_h) $(gxdevmem_h) $(gxchar_h) $(gxfont_h) $(gxtype1_h) $(gxop1_h) \
  397. +   $(gzdevice_h) $(gzstate_h)
  398. + gxht.$(OBJ): gxht.c $(GXERR) \
  399. +   $(gxfixed_h) $(gxmatrix_h) $(gxbitmap_h) $(gzstate_h) $(gzcolor_h) $(gzdevice_h) $(gzht_h)
  400. + gxpath.$(OBJ): gxpath.c $(GXERR) \
  401. +   $(gxfixed_h) $(gzpath_h)
  402. + gxpath2.$(OBJ): gxpath2.c $(GXERR) \
  403. +   $(gxfixed_h) $(gxarith_h) $(gzpath_h)
  404. + gxpcopy.$(OBJ): gxpcopy.c $(GXERR) \
  405. +   $(gxfixed_h) $(gxarith_h) $(gzpath_h)
  406. + gxstroke.$(OBJ): gxstroke.c $(GXERR) $(gpcheck_h) \
  407. +   $(gscoord_h) $(gxfixed_h) $(gxarith_h) $(gxmatrix_h) \
  408. +   $(gzstate_h) $(gzcolor_h) $(gzdevice_h) $(gzline_h) $(gzpath_h)
  409. + ###### High-level facilities
  410. + gschar.$(OBJ): gschar.c $(GXERR) \
  411. +   $(gxfixed_h) $(gxarith_h) $(gxmatrix_h) $(gzdevice_h) $(gxdevmem_h) $(gxfont_h) $(gxchar_h) $(gxcache_h) $(gstype1_h) $(gspath_h) $(gzpath_h) $(gzcolor_h) $(gzstate_h)
  412. + gscolor.$(OBJ): gscolor.c $(GXERR) \
  413. +   $(gscspace_h) $(gxcolor_h) $(gxdevice_h) $(gxrefct_h) \
  414. +   $(gzstate_h) $(gzcolor_h)
  415. + gscoord.$(OBJ): gscoord.c $(GXERR) \
  416. +   $(gsccode_h) $(gxarith_h) $(gxfixed_h) $(gxfont_h) $(gxmatrix_h) \
  417. +   $(gzdevice_h) $(gzstate_h) $(gscoord_h)
  418. + gsdevice.$(OBJ): gsdevice.c $(GXERR) \
  419. +   $(gxarith_h) $(gsprops_h) $(gsutil_h) $(gxbitmap_h) $(gxdevmem_h) \
  420. +   $(gzstate_h) $(gzdevice_h)
  421. + gsfile.$(OBJ): gsfile.c $(GXERR) \
  422. +   $(gsmatrix_h) $(gxdevice_h) $(gxdevmem_h)
  423. + gsfont.$(OBJ): gsfont.c $(GXERR) \
  424. +   $(gxdevice_h) $(gxfixed_h) $(gxmatrix_h) $(gxfont_h) $(gxfdir_h) \
  425. +   $(gzstate_h)
  426. + gsht.$(OBJ): gsht.c $(GXERR) \
  427. +   $(gzht_h) $(gzstate_h)
  428. + gsimage.$(OBJ): gsimage.c $(GXERR) $(gpcheck_h) \
  429. +   $(gxfixed_h) $(gxarith_h) $(gxmatrix_h) $(gspaint_h) \
  430. +   $(gzcolor_h) $(gzdevice_h) $(gzpath_h) $(gzstate_h) \
  431. +   $(gxcolor_h) $(gxcpath_h) $(gxdevmem_h) $(gximage_h)
  432. + gsimage1.$(OBJ): gsimage1.c $(GXERR) $(gpcheck_h) \
  433. +   $(gxfixed_h) $(gxarith_h) $(gxmatrix_h) $(gscspace_h) $(gspaint_h) \
  434. +   $(gzcolor_h) $(gzdevice_h) $(gzpath_h) $(gzstate_h) \
  435. +   $(gxcolor_h) $(gxcpath_h) $(gxdevmem_h) $(gximage_h)
  436. + gsimage2.$(OBJ): gsimage2.c $(GXERR) $(gpcheck_h) \
  437. +   $(gxfixed_h) $(gxarith_h) $(gxmatrix_h) $(gscspace_h) $(gspaint_h) \
  438. +   $(gzcolor_h) $(gzdevice_h) $(gzpath_h) $(gzstate_h) \
  439. +   $(gxcolor_h) $(gxcpath_h) $(gxdevmem_h) $(gximage_h)
  440. + gsimpath.$(OBJ): gsimpath.c $(GXERR) \
  441. +   $(gsmatrix_h) $(gsstate_h) $(gspath_h)
  442. + gsline.$(OBJ): gsline.c $(GXERR) \
  443. +   $(gxfixed_h) $(gxmatrix_h) $(gzstate_h) $(gzline_h)
  444. + gsmatrix.$(OBJ): gsmatrix.c $(GXERR) \
  445. +   $(gxfixed_h) $(gxarith_h) $(gxmatrix_h)
  446. + gsmisc.$(OBJ): gsmisc.c $(GX) $(errno__h) $(malloc__h) $(memory__h) $(MAKEFILE)
  447. +     $(CCC) -DUSE_ASM=0$(USE_ASM) gsmisc.c
  448. + gspaint.$(OBJ): gspaint.c $(GXERR) $(gpcheck_h) \
  449. +   $(gxfixed_h) $(gxmatrix_h) $(gspaint_h) $(gzpath_h) $(gzstate_h) $(gzdevice_h) $(gxcpath_h) $(gxdevmem_h) $(gximage_h)
  450. + gspath.$(OBJ): gspath.c $(GXERR) \
  451. +   $(gxfixed_h) $(gxmatrix_h) $(gxpath_h) $(gzstate_h)
  452. + gspath2.$(OBJ): gspath2.c $(GXERR) \
  453. +   $(gspath_h) $(gxfixed_h) $(gxmatrix_h) $(gzstate_h) $(gzpath_h) $(gzdevice_h)
  454. + gsstate.$(OBJ): gsstate.c $(GXERR) \
  455. +   $(gscie_h) $(gscolor2_h) $(gscspace_h) $(gxcolor_h) $(gxrefct_h) \
  456. +   $(gzstate_h) $(gzcolor_h) $(gzdevice_h) $(gzht_h) $(gzline_h) $(gzpath_h)
  457. + gstdev.$(OBJ): gstdev.c $(GXERR) \
  458. +   $(gxbitmap_h) $(gxdevice_h) $(gxfixed_h) $(gxmatrix_h)
  459. + gstype1.$(OBJ): gstype1.c $(GXERR) \
  460. +   $(gxarith_h) $(gxfixed_h) $(gxmatrix_h) $(gxchar_h) $(gxdevmem_h) $(gxop1_h) $(gxtype1_h) \
  461. +   $(gzstate_h) $(gzdevice_h) $(gzpath_h)
  462. + ###### The internal devices
  463. + gdevmem_h=gdevmem.h
  464. + gdevemap.$(OBJ): gdevemap.c $(AK) $(std_h)
  465. + gdevmem1.$(OBJ): gdevmem1.c $(AK) \
  466. +   $(gx_h) $(gserrors_h) $(gxdevice_h) $(gxdevmem_h) $(gdevmem_h)
  467. + gdevmem2.$(OBJ): gdevmem2.c $(AK) \
  468. +   $(gx_h) $(gxdevice_h) $(gxdevmem_h) $(gdevmem_h)
  469. + gdevmem3.$(OBJ): gdevmem3.c $(AK) \
  470. +   $(gx_h) $(gxdevice_h) $(gxdevmem_h) $(gdevmem_h)
  471. + ###### Files dependent on the installed devices, features, and platform.
  472. + # Generating gconfig.h also generates o*.tr and l*.tr.
  473. + # gconfig.h shouldn't have to depend on ALL_DEVS, but that would
  474. + # involve rewriting gsconfig to only save the device name, not the
  475. + # contents of the <device>.D_# files.
  476. + ALL_DEVS=$(FEATURE_DEVS) $(PLATFORM).dev \
  477. +   $(DEVICE_DEVS) $(DEVICE_DEVS1) \
  478. +   $(DEVICE_DEVS2) $(DEVICE_DEVS3) $(DEVICE_DEVS4) $(DEVICE_DEVS5)\
  479. +   $(DEVICE_DEVS6) $(DEVICE_DEVS7) $(DEVICE_DEVS8) $(DEVICE_DEVS9)
  480. + gconfig.h obj.tr objw.tr ld.tr lib.tr: \
  481. +   devs.mak $(MAKEFILE) echogs$(XE) genconf$(XE) $(ALL_DEVS)
  482. +     $(EXP)echogs -w t.cfg - $(FEATURE_DEVS) $(PLATFORM).dev
  483. +     $(EXP)echogs -a t.cfg - $(DEVICE_DEVS)
  484. +     $(EXP)echogs -a t.cfg - $(DEVICE_DEVS1)
  485. +     $(EXP)echogs -a t.cfg - $(DEVICE_DEVS2)
  486. +     $(EXP)echogs -a t.cfg - $(DEVICE_DEVS3)
  487. +     $(EXP)echogs -a t.cfg - $(DEVICE_DEVS4)
  488. +     $(EXP)echogs -a t.cfg - $(DEVICE_DEVS5)
  489. +     $(EXP)echogs -a t.cfg - $(DEVICE_DEVS6)
  490. +     $(EXP)echogs -a t.cfg - $(DEVICE_DEVS7)
  491. +     $(EXP)echogs -a t.cfg - $(DEVICE_DEVS8)
  492. +     $(EXP)echogs -a t.cfg - $(DEVICE_DEVS9)
  493. +     $(EXP)genconf @t.cfg -h gconfig.h -l lib.tr -o obj.tr -u ld.tr -w objw.tr
  494. +     rm t.cfg
  495. +     $(EXP)echogs -a gconfig.h -x 23 define GS_LIB_DEFAULT -x 2022 $(GS_LIB_DEFAULT) -x 22
  496. +     $(EXP)echogs -a gconfig.h -x 23 define GS_INIT -x 2022 $(GS_INIT) -x 22
  497. + gconfig.$(OBJ): gconfig.c $(AK) $(gconfig_h) $(MAKEFILE)
  498. + ###### On Unix, we pre-link all of the library except the back end.
  499. + ###### On MS-DOS, we have to do the whole thing at once.
  500. + LIBGS=gschar.$(OBJ) gscolor.$(OBJ) gscoord.$(OBJ) \
  501. +  gsdevice.$(OBJ) gsfile.$(OBJ) gsfont.$(OBJ) gsht.$(OBJ) \
  502. +  gsimage.$(OBJ) gsimage1.$(OBJ) gsimage2.$(OBJ) \
  503. +  gsimpath.$(OBJ) gsline.$(OBJ) gsmatrix.$(OBJ) gsmisc.$(OBJ) \
  504. +  gspaint.$(OBJ) gspath.$(OBJ) gspath2.$(OBJ) \
  505. +  gsstate.$(OBJ) gstdev.$(OBJ) gstype1.$(OBJ) gsutil.$(OBJ) \
  506. +  gxccache.$(OBJ) gxccman.$(OBJ) gxclist.$(OBJ) gxclread.$(OBJ) \
  507. +  gxcmap.$(OBJ) gxcpath.$(OBJ) \
  508. +  gxdither.$(OBJ) gxdraw.$(OBJ) gxfill.$(OBJ) \
  509. +  gxhint1.$(OBJ) gxhint2.$(OBJ) gxht.$(OBJ) \
  510. +  gxpath.$(OBJ) gxpath2.$(OBJ) gxpcopy.$(OBJ) gxstroke.$(OBJ) \
  511. +  gdevmem1.$(OBJ) gdevmem2.$(OBJ) gdevmem3.$(OBJ) gconfig.$(OBJ)
  512. + # ------------------------------ Interpreter ------------------------------ #
  513. + ###### Include files
  514. + alloc_h=alloc.h
  515. + astate_h=astate.h
  516. + ccfont_h=ccfont.h
  517. + dict_h=dict.h
  518. + dparam_h=dparam.h
  519. + dstack_h=dstack.h
  520. + errors_h=errors.h
  521. + estack_h=estack.h
  522. + filedev_h=filedev.h
  523. + files_h=files.h
  524. + font_h=font.h
  525. + ilevel_h=ilevel.h
  526. + iname_h=iname.h
  527. + iref_h=iref.h
  528. + iscan_h=iscan.h
  529. + ivmspace_h=ivmspace.h
  530. + iutil_h=iutil.h
  531. + main_h=main.h
  532. + opdef_h=opdef.h
  533. + ostack_h=ostack.h
  534. + overlay_h=overlay.h
  535. + packed_h=packed.h
  536. + save_h=save.h
  537. + scanchar_h=scanchar.h
  538. + sbits_h=sbits.h
  539. + shc_h=shc.h
  540. + state_h=state.h
  541. + store_h=store.h
  542. + stream_h=stream.h
  543. + # Nested include files
  544. + bfont_h=bfont.h $(font_h)
  545. + ghost_h=ghost.h $(gx_h) $(iref_h)
  546. + oper_h=oper.h $(gsutil_h) $(iutil_h) $(opdef_h) $(ostack_h)
  547. + scf_h=scf.h $(shc_h)
  548. + sdct_h=sdct.h $(shc_h)
  549. + # Include files for optional features
  550. + bnum_h=bnum.h
  551. + bseq_h=bseq.h
  552. + btoken_h=btoken.h
  553. + comp1_h=comp1.h $(ghost_h) $(oper_h) $(gserrors_h) $(gxfixed_h) $(gxop1_h)
  554. + gdevprn_h=gdevprn.h $(memory__h) $(string__h) $(gx_h) \
  555. +   $(gserrors_h) $(gsmatrix_h) $(gxdevice_h) $(gxdevmem_h) $(gxclist_h)
  556. + ###### Utilities
  557. + GH=$(AK) $(ghost_h)
  558. + ialloc.$(OBJ): ialloc.c $(AK) $(gx_h) $(alloc_h) $(astate_h) $(ivmspace_h)
  559. + iccfont.$(OBJ): iccfont.c $(GH) gconfigf.h \
  560. +   $(ghost_h) $(alloc_h) $(ccfont_h) $(dict_h) $(dstack_h) $(errors_h) \
  561. +   $(font_h) $(iutil_h) $(iname_h) $(oper_h) $(save_h) $(store_h)
  562. + idebug.$(OBJ): idebug.c $(GH) \
  563. +   $(iutil_h) $(dict_h) $(iname_h) $(ostack_h) $(opdef_h) $(packed_h) $(store_h)
  564. + idict.$(OBJ): idict.c $(GH) \
  565. +   $(alloc_h) $(errors_h) $(ivmspace_h) $(iname_h) $(packed_h) \
  566. +   $(save_h) $(store_h) $(iutil_h) $(dict_h) $(dstack_h)
  567. + idparam.$(OBJ): idparam.c $(GH) \
  568. +   $(gsmatrix_h) $(dict_h) $(dparam_h) $(errors_h) $(iutil_h)
  569. + iinit.$(OBJ): iinit.c $(GH) $(gconfig_h) \
  570. +   $(alloc_h) $(dict_h) $(dstack_h) $(errors_h) $(ilevel_h) $(iname_h) $(oper_h) $(store_h)
  571. + iname.$(OBJ): iname.c $(GH) $(alloc_h) $(errors_h) $(ivmspace_h) $(iname_h) $(store_h)
  572. + isave.$(OBJ): isave.c $(GH) $(alloc_h) $(astate_h) $(errors_h) $(iname_h) $(packed_h) $(save_h) $(store_h)
  573. + iscan.$(OBJ): iscan.c $(GH) $(ctype__h) \
  574. +   $(alloc_h) $(dict_h) $(dstack_h) $(errors_h) \
  575. +   $(ilevel_h) $(iutil_h) $(iscan_h) $(ivmspace_h) \
  576. +   $(iname_h) $(ostack_h) $(packed_h) $(store_h) $(stream_h) $(scanchar_h)
  577. + iutil.$(OBJ): iutil.c $(GH) \
  578. +   $(errors_h) $(alloc_h) $(dict_h) $(iutil_h) $(ivmspace_h) \
  579. +   $(iname_h) $(ostack_h) $(opdef_h) $(packed_h) $(store_h) \
  580. +   $(gsmatrix_h) $(gxdevice_h) $(gzcolor_h)
  581. + sfilter.$(OBJ): sfilter.c $(AK) $(stdio__h) \
  582. +   $(scanchar_h) $(stream_h) $(gscrypt1_h)
  583. + stream.$(OBJ): stream.c $(AK) $(stdio__h) $(memory__h) \
  584. +   $(gpcheck_h) $(scanchar_h) $(stream_h)
  585. + ###### Operators
  586. + OP=$(GH) $(errors_h) $(oper_h)
  587. + ### Non-graphics operators
  588. + zarith.$(OBJ): zarith.c $(OP) $(store_h)
  589. + zarray.$(OBJ): zarray.c $(OP) $(alloc_h) $(packed_h) $(store_h)
  590. + zcontrol.$(OBJ): zcontrol.c $(OP) $(estack_h) $(iutil_h) $(store_h)
  591. + zdict.$(OBJ): zdict.c $(OP) $(dict_h) $(dstack_h) $(iname_h) $(store_h)
  592. + zfile.$(OBJ): zfile.c $(OP) $(gp_h) \
  593. +   $(alloc_h) $(estack_h) $(filedev_h) $(files_h) $(ilevel_h) $(iutil_h) \
  594. +   $(save_h) $(stream_h) $(store_h)
  595. + zfiledev.$(OBJ): zfiledev.c $(OP) $(string__h) $(gp_h) $(gconfig_h) \
  596. +   $(filedev_h) $(files_h) $(stream_h)
  597. + zfileio.$(OBJ): zfileio.c $(OP) $(gp_h) \
  598. +   $(estack_h) $(files_h) $(iscan_h) $(store_h) $(stream_h) \
  599. +   $(gsmatrix_h) $(gxdevice_h) $(gxdevmem_h)
  600. + zfilter.$(OBJ): zfilter.c $(OP) $(alloc_h) $(stream_h)
  601. + zgeneric.$(OBJ): zgeneric.c $(OP) \
  602. +   $(dict_h) $(estack_h) $(ivmspace_h) $(iname_h) $(packed_h) $(store_h)
  603. + zmath.$(OBJ): zmath.c $(OP) $(store_h)
  604. + zmisc.$(OBJ): zmisc.c $(OP) $(gp_h) $(errno__h) $(memory__h) $(string__h) \
  605. +   $(alloc_h) $(dict_h) $(dstack_h) $(iname_h) $(ivmspace_h) $(packed_h) $(store_h) \
  606. +   $(gscrypt1_h)
  607. + zpacked.$(OBJ): zpacked.c $(OP) \
  608. +   $(alloc_h) $(dict_h) $(ivmspace_h) $(iname_h) $(packed_h) $(save_h) $(store_h)
  609. + zprops.$(OBJ): zprops.c $(OP) \
  610. +   $(alloc_h) $(dict_h) $(iname_h) $(state_h) $(store_h) \
  611. +   $(gsprops_h) $(gsmatrix_h) $(gxdevice_h) $(gsstate_h)
  612. + zrelbit.$(OBJ): zrelbit.c $(OP) $(store_h) $(dict_h)
  613. + zstack.$(OBJ): zstack.c $(OP) $(store_h)
  614. + zstring.$(OBJ): zstring.c $(OP) \
  615. +   $(alloc_h) $(iscan_h) $(iutil_h) $(iname_h) $(store_h) $(stream_h)
  616. + ztype.$(OBJ): ztype.c $(OP) \
  617. +   $(dict_h) $(iscan_h) $(iutil_h) $(iname_h) $(stream_h) $(store_h)
  618. + zvmem.$(OBJ): zvmem.c $(OP) $(alloc_h) $(dict_h) $(dstack_h) $(estack_h) $(save_h) $(state_h) $(store_h) \
  619. +   $(gsmatrix_h) $(gsstate_h)
  620. + ###### Graphics operators
  621. + zchar.$(OBJ): zchar.c $(OP) $(gxarith_h) $(gxfixed_h) $(gxmatrix_h) \
  622. +   $(gschar_h) $(gxtype1_h) $(gxdevice_h) $(gxfont_h) $(gzpath_h) $(gzstate_h) \
  623. +   $(alloc_h) $(dict_h) $(font_h) $(estack_h) $(ilevel_h) $(iname_h) $(state_h) $(store_h)
  624. + zcolor.$(OBJ): zcolor.c $(OP) $(alloc_h) $(estack_h) $(gxfixed_h) $(gxmatrix_h) $(gzstate_h) $(gxdevice_h) $(gzcolor_h) $(iutil_h) $(state_h) $(store_h)
  625. + zdevice.$(OBJ): zdevice.c $(OP) $(alloc_h) $(state_h) $(gsmatrix_h) $(gsstate_h) $(gxdevice_h) $(store_h)
  626. + zfont.$(OBJ): zfont.c $(OP) \
  627. +   $(gsmatrix_h) $(gxdevice_h) $(gxfont_h) $(gxfdir_h) $(gxcache_h) \
  628. +   $(alloc_h) $(bfont_h) $(dict_h) $(iname_h) $(packed_h) $(save_h) $(state_h) $(store_h)
  629. + zfont1.$(OBJ): zfont1.c $(OP) $(gsmatrix_h) $(gxdevice_h) $(gschar_h) $(gxfixed_h) $(gxfont_h) \
  630. +   $(bfont_h) $(dict_h) $(dparam_h) $(iname_h) $(store_h)
  631. + zfont2.$(OBJ): zfont2.c $(OP) $(gsmatrix_h) $(gxdevice_h) $(gschar_h) $(gxfixed_h) $(gxfont_h) \
  632. +   $(alloc_h) $(bfont_h) $(dict_h) $(dparam_h) $(ilevel_h) $(iname_h) \
  633. +   $(packed_h) $(save_h) $(store_h)
  634. + zgstate.$(OBJ): zgstate.c $(OP) $(alloc_h) $(gsmatrix_h) $(gsstate_h) $(state_h) $(store_h)
  635. + zht.$(OBJ): zht.c $(OP) $(alloc_h) $(estack_h) $(gsmatrix_h) $(gsstate_h) $(state_h) $(store_h)
  636. + zmatrix.$(OBJ): zmatrix.c $(OP) $(gsmatrix_h) $(state_h) $(gscoord_h) $(store_h)
  637. + zpaint.$(OBJ): zpaint.c $(OP) \
  638. +   $(alloc_h) $(estack_h) $(ilevel_h) $(state_h) $(store_h) $(stream_h) \
  639. +   $(gsimage_h) $(gsmatrix_h) $(gspaint_h)
  640. + zpath.$(OBJ): zpath.c $(OP) $(gsmatrix_h) $(gspath_h) $(state_h) $(store_h)
  641. + zpath2.$(OBJ): zpath2.c $(OP) $(alloc_h) $(estack_h) $(gspath_h) $(state_h) $(store_h)
  642. + ###### Linking
  643. + INT=ialloc.$(OBJ) idebug.$(OBJ) idict.$(OBJ) idparam.$(OBJ) \
  644. +  iinit.$(OBJ) iname.$(OBJ) \
  645. +  interp.$(OBJ) isave.$(OBJ) iscan.$(OBJ) iutil.$(OBJ) \
  646. +  sfilter.$(OBJ) stream.$(OBJ) \
  647. +  zarith.$(OBJ) zarray.$(OBJ) zcontrol.$(OBJ) zdict.$(OBJ) \
  648. +  zfile.$(OBJ) zfiledev.$(OBJ) zfileio.$(OBJ) zfilter.$(OBJ) zgeneric.$(OBJ) \
  649. +  zmath.$(OBJ) zmisc.$(OBJ) zpacked.$(OBJ) zprops.$(OBJ) zrelbit.$(OBJ) \
  650. +  zstack.$(OBJ) zstring.$(OBJ) ztype.$(OBJ) zvmem.$(OBJ) \
  651. +  zchar.$(OBJ) zcolor.$(OBJ) zfont.$(OBJ) zfont1.$(OBJ) zfont2.$(OBJ) \
  652. +  zdevice.$(OBJ) zgstate.$(OBJ) zht.$(OBJ) zmatrix.$(OBJ) \
  653. +  zpaint.$(OBJ) zpath.$(OBJ) zpath2.$(OBJ)
  654. + # -------------------------- Optional features ---------------------------- #
  655. + ### Additions common to Display PostScript and Level 2
  656. + # We have to split up the module list because of limitations
  657. + # on the number of arguments to a DOS batch file.
  658. + dpsand2a_=gsdps1.$(OBJ) ibnum.$(OBJ) iscan2.$(OBJ)
  659. + dpsand2b_=zbseq.$(OBJ) zchar2.$(OBJ) zdps1.$(OBJ) zupath.$(OBJ) zvmem2.$(OBJ)
  660. + dpsand2_=$(dpsand2a_) $(dpsand2b_)
  661. + dpsand2.dev: $(dpsand2_) gssetmod gsaddmod
  662. +     $(SHP)gssetmod dpsand2 $(dpsand2a_)
  663. +     $(SHP)gsaddmod dpsand2 -obj $(dpsand2b_)
  664. +     $(SHP)gsaddmod dpsand2 -oper2 zbseq zchar2 zdps1 zupath zvmem2
  665. +     $(SHP)gsaddmod dpsand2 -ps gs_dps1
  666. + gsdps1.$(OBJ): gsdps1.c $(GXERR) $(gxfixed_h) $(gxmatrix_h) $(gzpath_h) $(gzstate_h)
  667. + ibnum.$(OBJ): ibnum.c $(GH) $(errors_h) $(stream_h) $(bnum_h) $(btoken_h)
  668. + iscan2.$(OBJ): iscan2.c $(GH) $(errors_h) \
  669. +   $(alloc_h) $(dict_h) $(dstack_h) $(iscan_h) $(iutil_h) $(ivmspace_h) \
  670. +   $(iname_h) $(ostack_h) $(save_h) $(store_h) $(stream_h) \
  671. +   $(bseq_h) $(btoken_h) $(bnum_h)
  672. + zbseq.$(OBJ): zbseq.c $(OP) $(save_h) $(store_h) $(stream_h) $(files_h) $(iname_h) $(bnum_h) $(btoken_h) $(bseq_h)
  673. + zchar2.$(OBJ): zchar2.c $(OP) $(gschar_h) $(gsmatrix_h) $(gxfixed_h) $(gxfont_h) \
  674. +   $(alloc_h) $(estack_h) $(font_h) $(iname_h) $(state_h) $(store_h) $(stream_h) $(bnum_h)
  675. + zdps1.$(OBJ): zdps1.c $(OP) $(gsmatrix_h) $(gspath_h) $(gsstate_h) \
  676. +   $(alloc_h) $(ivmspace_h) $(state_h) $(store_h) $(stream_h) $(bnum_h)
  677. + zupath.$(OBJ): zupath.c $(OP) \
  678. +   $(dict_h) $(dstack_h) $(iutil_h) $(state_h) $(store_h) $(stream_h) $(bnum_h) \
  679. +   $(gscoord_h) $(gsmatrix_h) $(gspaint_h) $(gspath_h) $(gsstate_h) \
  680. +   $(gxfixed_h) $(gxdevice_h) $(gxpath_h)
  681. + zvmem2.$(OBJ): zvmem2.c $(OP) \
  682. +   $(ivmspace_h) $(store_h)
  683. + ### Display PostScript
  684. + # We should include zcontext, but it isn't in good enough shape yet:
  685. + #    $(SHP)gsaddmod dps -oper2 zcontext
  686. + dps_=
  687. + dps.dev: dpsand2.dev $(dps_) gssetmod gsaddmod
  688. +     $(SHP)gssetmod dps $(dps_)
  689. +     $(SHP)gsaddmod dps -include dpsand2
  690. + zcontext.$(OBJ): zcontext.c $(OP) \
  691. +   $(alloc_h) $(dict_h) $(dstack_h) $(estack_h) $(state_h) $(store_h)
  692. + ### Composite font support
  693. + gschar0.$(OBJ): gschar0.c $(GXERR) \
  694. +   $(gxfixed_h) $(gxmatrix_h) $(gzdevice_h) $(gxdevmem_h) $(gxfont_h) $(gxchar_h) $(gzstate_h)
  695. + zfont0.$(OBJ): zfont0.c $(OP) $(gsmatrix_h) $(gxdevice_h) $(gxfont_h) \
  696. +   $(alloc_h) $(bfont_h) $(dict_h) $(iname_h) $(state_h) $(store_h)
  697. + compfont_=zchar2.$(OBJ) zfont0.$(OBJ) gschar0.$(OBJ)
  698. + compfont.dev: $(compfont_) gssetmod gsaddmod
  699. +     $(SHP)gssetmod compfont $(compfont_)
  700. +     $(SHP)gsaddmod compfont -oper zfont0 zchar2
  701. +     $(SHP)gsaddmod compfont -ps gs_type0
  702. + ### Level 2 additions
  703. + # We have to split up the module list because of limitations
  704. + # on the number of arguments to a DOS batch file.
  705. + level2a_=gscie.$(OBJ) gscolor2.$(OBJ) zcie.$(OBJ) zcolor2.$(OBJ)
  706. + level2b_=zcspace2.$(OBJ) zht2.$(OBJ) zimage2.$(OBJ) zmisc2.$(OBJ)
  707. + level2_=$(level2a_) $(level2b_)
  708. + level2.dev: compfont.dev dpsand2.dev filter.dev $(level2_) gssetmod gsaddmod
  709. +     $(SHP)gssetmod level2 $(level2a_)
  710. +     $(SHP)gsaddmod level2 -obj $(level2b_)
  711. +     $(SHP)gsaddmod level2 -include compfont dpsand2 filter
  712. +     $(SHP)gsaddmod level2 -oper zmisc2_level
  713. +     $(SHP)gsaddmod level2 -oper2 zcie zcolor2 zcspace2
  714. +     $(SHP)gsaddmod level2 -oper2 zht2 zimage2 zmisc2
  715. +     $(SHP)gsaddmod level2 -ps gs_lev2
  716. + gscie.$(OBJ): gscie.c $(GXERR) \
  717. +   $(gscspace_h) $(gscie_h) $(gscolor2_h) \
  718. +   $(gxarith_h) $(gxcolor_h) $(gxdevice_h) $(gxrefct_h) \
  719. +   $(gzcolor_h) $(gzstate_h)
  720. + gscolor2.$(OBJ): gscolor2.c $(GXERR) \
  721. +   $(gscie_h) $(gscolor2_h) $(gscspace_h) \
  722. +   $(gxcolor_h) $(gxdevice_h) $(gxfixed_h) $(gxmatrix_h) $(gxrefct_h) \
  723. +   $(gzcolor_h) $(gzstate_h)
  724. + zcie.$(OBJ): zcie.c $(OP) \
  725. +   $(gscspace_h) $(gscolor2_h) $(gscie_h) $(gxcolor_h) $(gxrefct_h) \
  726. +   $(alloc_h) $(dict_h) $(dparam_h) $(estack_h) $(save_h) $(state_h) $(store_h)
  727. + zcolor2.$(OBJ): zcolor2.c $(OP) \
  728. +   $(gscolor_h) $(gxcolor_h) $(gscolor2_h) $(gscspace_h) $(gsmatrix_h) \
  729. +   $(dict_h) $(dparam_h) $(iname_h) $(state_h) $(store_h)
  730. + zcspace2.$(OBJ): zcspace2.c $(OP) \
  731. +   $(gscolor_h) $(gxcolor_h) $(gscolor2_h) $(gscspace_h) $(gsmatrix_h) \
  732. +   $(dict_h) $(dparam_h) $(estack_h) $(iname_h) $(state_h) $(store_h)
  733. + zht2.$(OBJ): zht2.c $(OP) \
  734. +   $(dict_h) $(dparam_h) $(iname_h) $(state_h) $(store_h)
  735. + zimage2.$(OBJ): zimage2.c $(OP) \
  736. +   $(gscolor_h) $(gscolor2_h) $(gscspace_h) $(gsmatrix_h) $(gxcolor_h) \
  737. +   $(dict_h) $(dparam_h) $(ilevel_h) $(state_h)
  738. + zmisc2.$(OBJ): zmisc2.c $(OP) \
  739. +   $(gsfont_h) \
  740. +   $(dict_h) $(dparam_h) $(dstack_h) $(estack_h) $(ilevel_h) $(iname_h) $(store_h)
  741. + ### Filters other than the ones in sfilter.c
  742. + sbits.$(OBJ): sbits.c $(AK) $(stdio__h) $(sbits_h) $(stream_h)
  743. + scftab.$(OBJ): scftab.c $(AK) $(std_h) $(scf_h)
  744. + scfdtab.$(OBJ): scfdtab.c $(AK) $(std_h) $(scf_h)
  745. + scfd.$(OBJ): scfd.c $(AK) $(stdio__h) $(gdebug_h)\
  746. +   $(sbits_h) $(scf_h) $(stream_h)
  747. + scfe.$(OBJ): scfe.c $(AK) $(stdio__h) $(gdebug_h)\
  748. +   $(sbits_h) $(scf_h) $(stream_h)
  749. + sdctd.$(OBJ): sdctd.c $(AK) $(stdio__h) $(gdebug_h) $(stream_h)
  750. + sdcte.$(OBJ): sdcte.c $(AK) $(stdio__h) $(gdebug_h) $(stream_h)
  751. + sfilter2.$(OBJ): sfilter2.c $(AK) $(stdio__h) $(scanchar_h) $(stream_h)
  752. + slzwd.$(OBJ): slzwd.c $(AK) $(stdio__h) $(gdebug_h) $(stream_h)
  753. + slzwe.$(OBJ): slzwe.c $(AK) $(stdio__h) $(gdebug_h) $(stream_h)
  754. + zfilter2.$(OBJ): zfilter2.c $(OP) $(alloc_h) $(dict_h) $(dparam_h) $(sdct_h) $(stream_h)
  755. + # Because of size limits on the DOS command line,
  756. + # we have to break this up into two parts.
  757. + filter_1=zfilter2.$(OBJ) sfilter2.$(OBJ) sbits.$(OBJ)
  758. + filter_2=scfdtab.$(OBJ) scftab.$(OBJ) scfd.$(OBJ) scfe.$(OBJ) 
  759. + filter_3=sdctd.$(OBJ) sdcte.$(OBJ) slzwd.$(OBJ) slzwe.$(OBJ)
  760. + filter.dev: $(filter_1) $(filter_2) $(filter_3) gssetmod gsaddmod
  761. +     $(SHP)gssetmod filter $(filter_1)
  762. +     $(SHP)gsaddmod filter -obj $(filter_2)
  763. +     $(SHP)gsaddmod filter -obj $(filter_3)
  764. +     $(SHP)gsaddmod filter -oper zfilter2
  765. + ### Precompiled fonts.  See fonts.doc for more information.
  766. + CCFONT=$(OP) $(ccfont_h)
  767. + # List the fonts we are going to compile.
  768. + # Because of intrinsic limitations in `make', we have to list
  769. + # the object file names and the font names separately.
  770. + ccfonts1_=uglyr.$(OBJ)
  771. + ccfonts1=uglyr
  772. + ccfonts.dev: $(MAKEFILE) gs.mak iccfont.$(OBJ) gssetmod gsaddmod \
  773. +   $(ccfonts1_) $(ccfonts2_) $(ccfonts3_) $(ccfonts4_) $(ccfonts5_)
  774. +     $(SHP)gssetmod ccfonts iccfont.$(OBJ)
  775. +     $(SHP)gsaddmod ccfonts -obj $(ccfonts1_)
  776. +     $(SHP)gsaddmod ccfonts -obj $(ccfonts2_)
  777. +     $(SHP)gsaddmod ccfonts -obj $(ccfonts3_)
  778. +     $(SHP)gsaddmod ccfonts -obj $(ccfonts4_)
  779. +     $(SHP)gsaddmod ccfonts -obj $(ccfonts5_)
  780. +     $(SHP)gsaddmod ccfonts -oper ccfonts
  781. + gconfigf.h: $(MAKEFILE) gs.mak genconf$(XE) gssetmod gsaddmod
  782. +     $(SHP)gssetmod ccfonts_
  783. +     $(SHP)gsaddmod ccfonts_ -font $(ccfonts1)
  784. +     $(SHP)gsaddmod ccfonts_ -font $(ccfonts2)
  785. +     $(SHP)gsaddmod ccfonts_ -font $(ccfonts3)
  786. +     $(SHP)gsaddmod ccfonts_ -font $(ccfonts4)
  787. +     $(SHP)gsaddmod ccfonts_ -font $(ccfonts5)
  788. +     $(EXP)genconf ccfonts_.dev -f gconfigf.h
  789. + uglyr.$(OBJ): uglyr.c $(CCFONT)
  790. +     $(CCCF) uglyr.c
  791. + ncrr.$(OBJ): ncrr.c $(CCFONT)
  792. +     $(CCCF) ncrr.c
  793. + pagk.$(OBJ): pagk.c $(CCFONT)
  794. +     $(CCCF) pagk.c
  795. + psyr.$(OBJ): psyr.c $(CCFONT)
  796. +     $(CCCF) psyr.c
  797. + ptmr.$(OBJ): ptmr.c $(CCFONT)
  798. +     $(CCCF) ptmr.c
  799. + pzdr.$(OBJ): pzdr.c $(CCFONT)
  800. +     $(CCCF) pzdr.c
  801. + # ----------------------------- Main program ------------------------------ #
  802. + # Interpreter main program
  803. + gs.$(OBJ): gs.c $(GH) $(ctype__h) \
  804. +   $(gxdevice_h) $(gxdevmem_h) \
  805. +   $(alloc_h) $(errors_h) $(estack_h) $(files_h) $(iscan_h) $(main_h) $(ostack_h) $(store_h) $(stream_h)
  806. + gsmain.$(OBJ): gsmain.c $(GH) \
  807. +   $(gp_h) $(gsmatrix_h) $(gxdevice_h) $(gserrors_h) \
  808. +   $(estack_h) $(files_h) $(iscan_h) $(main_h) $(ostack_h) $(store_h)
  809. + interp.$(OBJ): interp.c $(GH) \
  810. +   $(errors_h) $(estack_h) $(iname_h) $(dict_h) $(dstack_h) $(iscan_h) $(oper_h) $(ostack_h) $(packed_h) $(save_h) $(store_h) $(stream_h)
  811. +     $(CCINT) interp.c
  812. + #    Copyright (C) 1989, 1992, 1993 Aladdin Enterprises.  All rights reserved.
  813. + #
  814. + # This file is part of Ghostscript.
  815. + #
  816. + # Ghostscript is distributed in the hope that it will be useful, but
  817. + # WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  818. + # to anyone for the consequences of using it or for whether it serves any
  819. + # particular purpose or works at all, unless he says so in writing.  Refer
  820. + # to the Ghostscript General Public License for full details.
  821. + #
  822. + # Everyone is granted permission to copy, modify and redistribute
  823. + # Ghostscript, but only under the conditions described in the Ghostscript
  824. + # General Public License.  A copy of this license is supposed to have been
  825. + # given to you along with Ghostscript so you can know your rights and
  826. + # responsibilities.  It should be in a file named COPYING.  Among other
  827. + # things, the copyright notice and this notice must be preserved on all
  828. + # copies.
  829. + # makefile for Ghostscript device drivers.
  830. + # -------------------------------- Catalog ------------------------------- #
  831. + # It is possible to build Ghostscript with an arbitrary collection of
  832. + # device drivers, although some drivers are supported only on a subset
  833. + # of the target platforms.  The currently available drivers are:
  834. + # Displays:
  835. + #   MS-DOS EGA and VGA:
  836. + #    ega    EGA (640x350, 16-color)
  837. + #    vga    VGA (640x480, 16-color)
  838. + #   MS-DOS SuperVGA:
  839. + # +    atiw    ATI Wonder SuperVGA, 256-color modes
  840. + # +     atiw16  ATI Wonder SuperVGA in 800x600, 16-color mode
  841. + #    s3vga    SuperVGA with S3 86C911 chip (e.g., Diamond Stealth board)
  842. + #    tseng    SuperVGA using Tseng Labs ET3000/4000 chips, 256-color modes
  843. + #    tseng16  Tseng Labs SuperVGA in 800x600, 16-color mode (256K memory)
  844. + # +    tvga    Trident SuperVGA, 256-color modes
  845. + # +    tvga16    Trident SuperVGA in 800x600, 16-color mode (256K memory)
  846. + #   ****** NOTE: The vesa device does not work with the Watcom (32-bit MS-DOS)
  847. + #   ****** compiler or executable.
  848. + #    vesa    SuperVGA with VESA standard API driver
  849. + #   MS-DOS other:
  850. + #    bgi    Borland Graphics Interface (CGA)  [MS-DOS only]
  851. + # *    herc    Hercules Graphics display   [MS-DOS only]
  852. + #    mswin    Microsoft Windows 3.0, 3.1  [MS Windows only]
  853. + #    mswinprn  Microsoft Windows 3.0, 3.1 printer  [MS Windows only]
  854. + # *    pe    Private Eye display
  855. + #   Unix and VMS:
  856. + #   ****** NOTE: For direct frame buffer addressing under SCO Unix or Xenix,
  857. + #   ****** edit the definition of EGAVGA below.
  858. + # *    att3b1    AT&T 3b1/Unixpc monochrome display   [3b1 only]
  859. + # *    sonyfb    Sony Microsystems monochrome display   [Sony only]
  860. + # *    sunview  SunView window system   [SunOS only]
  861. + #    x11    X Windows version 11, release >=4   [Unix and VMS only]
  862. + # Printers:
  863. + # *    appledmp  Apple Dot Matrix Printer (should also work with Imagewriter)
  864. + #    bj10e    Canon BubbleJet BJ10e
  865. + # *    bj200    Canon BubbleJet BJ200
  866. + # *    cdeskjet  H-P DeskJet 500C with 1 bit/pixel color
  867. + # *    cdjcolor  H-P DeskJet 500C with 24 bit/pixel color and
  868. + #        high-quality color (Floyd-Steinberg) dithering
  869. + # *    cdjmono  H-P DeskJet 500C printing black only
  870. + # *    cdj500    H-P DeskJet 500C (same as cdjcolor)
  871. + # *    cdj550    H-P DeskJet 550C
  872. + # *    declj250  alternate DEC LJ250 driver
  873. + # +    deskjet  H-P DeskJet and DeskJet Plus
  874. + # *    dfaxhigh  DigiBoard, Inc.'s DigiFAX software format (high resolution)
  875. + # *    dfaxlow  DigiFAX low (normal) resolution
  876. + #    djet500  H-P DeskJet 500
  877. + # *    djet500c  H-P DeskJet 500C
  878. + #    epson    Epson-compatible dot matrix printers (9- or 24-pin)
  879. + # +    eps9high  Epson-compatible 9-pin, interleaved lines
  880. + #        (triple resolution)
  881. + # *    epsonc    Epson LQ-2550 and Fujitsu 3400/2400/1200 color printers
  882. + # *    escp2    Epson ESC/P 2 language printers, including Stylus 800
  883. + # +     ibmpro  IBM 9-pin Proprinter
  884. + # *    jetp3852  IBM Jetprinter ink-jet color printer (Model #3852)
  885. + # +    laserjet  H-P LaserJet
  886. + # *    la50    DEC LA50 printer
  887. + # *    la75    DEC LA75 printer
  888. + # *    lbp8    Canon LBP-8II laser printer
  889. + # *    ln03    DEC LN03 printer
  890. + # *    lj250    DEC LJ250 Companion color printer
  891. + # +    ljet2p    H-P LaserJet IId/IIp/III* with TIFF compression
  892. + # +    ljet3    H-P LaserJet III* with Delta Row compression
  893. + # +    ljet4    H-P LaserJet 4 (defaults to 600 dpi)
  894. + # +    ljetplus  H-P LaserJet Plus
  895. + # *    m8510    C.Itoh M8510 printer
  896. + # *    necp6    NEC P6/P6+/P60 printers at 360 x 360 DPI resolution
  897. + # *    nwp533  Sony Microsystems NWP533 laser printer   [Sony only]
  898. + # *    oki182    Okidata MicroLine 182
  899. + #    paintjet  H-P PaintJet color printer
  900. + # *    pj    alternate PaintJet XL driver 
  901. + # *    pjxl    H-P PaintJet XL color printer
  902. + # *    pjxl300  H-P PaintJet XL300 color printer
  903. + # *    r4081    Ricoh 4081 laser printer
  904. + # *    sparc    SPARCprinter
  905. + # *    t4693d2  Tektronix 4693d color printer, 2 bits per R/G/B component
  906. + # *    t4693d4  Tektronix 4693d color printer, 4 bits per R/G/B component
  907. + # *    t4693d8  Tektronix 4693d color printer, 8 bits per R/G/B component
  908. + # *    tek4696  Tektronix 4695/4696 inkjet plotter
  909. + # *    trufax    TruFax facsimile driver  [Unix only]
  910. + # File formats and others:
  911. + #    bit    A plain "bit bucket" device
  912. + #    bmpmono    Monochrome MS Windows .BMP file format
  913. + #    bmp16    4-bit (EGA/VGA) .BMP file format
  914. + #    bmp256    8-bit (256-color) .BMP file format
  915. + #    bmp16m    24-bit .BMP file format
  916. + #    gifmono    Monochrome GIF file format
  917. + #    gif8    8-bit color GIF file format
  918. + #    pcxmono    Monochrome PCX file format
  919. + #    pcxgray    8-bit gray scale PCX file format
  920. + #    pcx16    Older color PCX file format (EGA/VGA, 16-color)
  921. + #    pcx256    Newer color PCX file format (256-color)
  922. + #    pbm    Portable Bitmap (plain format)
  923. + #    pbmraw    Portable Bitmap (raw format)
  924. + #    pgm    Portable Graymap (plain format)
  925. + #    pgmraw    Portable Graymap (raw format)
  926. + #    ppm    Portable Pixmap (plain format)
  927. + #    ppmraw    Portable Pixmap (raw format)
  928. + # *    tiffg3    TIFF/F (G3 fax)
  929. + # User-contributed drivers marked with * require hardware or software
  930. + # that is not available to Aladdin Enterprises.  Please contact the
  931. + # original contributors, not Aladdin Enterprises, if you have questions.
  932. + # Contact information appears in the driver entry below.
  933. + #
  934. + # Drivers marked with a + are maintained by Aladdin Enterprises with
  935. + # the assistance of users, since Aladdin Enterprises doesn't have access to
  936. + # the hardware for these either.
  937. + # If you add drivers, it would be nice if you kept each list
  938. + # in alphabetical order.
  939. + # Each platform-specific makefile contains a line of the form
  940. + #    DEVICE_DEVS=<dev1>.dev ... <devn>.dev
  941. + # where dev1 ... devn are the devices to be included in the build.
  942. + # You may edit this line to select any desired set of devices.
  943. + # dev1 will be used as the default device (unless overridden from
  944. + # the command line with -sDEVICE=xxx, of course.)  If you can't fit all the
  945. + # devices on a single line, you may add lines defining
  946. + #    DEVICE_DEVS2=<dev21>.dev ... <dev2n>.dev
  947. + #    DEVICE_DEVS3=<dev31>.dev ... <dev3n>.dev
  948. + # etc. up to DEVICE_DEVS9.
  949. + # Don't use continuation lines, since this may break the MS-DOS command
  950. + # processor.
  951. + # ---------------------------- End of catalog ---------------------------- #
  952. + # If you want to add a new device driver, the examples below should be
  953. + # enough of a guide to the correct form for the makefile rules.
  954. + # All device drivers depend on the following:
  955. + GDEV=$(AK) echogs$(XE) $(gserrors_h) $(gx_h) $(gxdevice_h)
  956. + # Define the header files for device drivers.  Every header file used by
  957. + # more than one device driver must be listed here.
  958. + gdevpccm_h=gdevpccm.h
  959. + gdevpcfb_h=gdevpcfb.h $(dos__h)
  960. + gdevpcl_h=gdevpcl.h
  961. + gdevsvga_h=gdevsvga.h
  962. + gdevx_h=gdevx.h
  963. + ###### ------------------- MS-DOS display devices ------------------- ######
  964. + # There are really only three drivers: an EGA/VGA driver (4 bit-planes,
  965. + # plane-addressed), a SuperVGA driver (8 bit-planes, byte addressed),
  966. + # and a special driver for the S3 chip.
  967. + # To make A4 paper the default, change the compilation line from
  968. + #    $(CCD) ...
  969. + # to
  970. + #    $(CCD) -DA4
  971. + ### ----------------------- EGA and VGA displays ----------------------- ###
  972. + gdevegaa.$(OBJ): gdevegaa.asm
  973. + ETEST=ega.$(OBJ) $(ega_) gdevpcfb.$(OBJ) gdevegaa.$(OBJ)
  974. + ega.exe: $(ETEST) libc$(MM).tr
  975. +     $(COMPDIR)\tlink $(LCT) $(LO) $(LIBDIR)\c0$(MM) @ega.tr @libc$(MM).tr
  976. + ega.$(OBJ): ega.c $(GDEV)
  977. +     $(CCC) -v ega.c
  978. + # The shared MS-DOS makefile defines PCFBASM as either gdevegaa.$(OBJ)
  979. + # or an empty string.
  980. + # NOTE: for direct frame buffer addressing under SCO Unix or Xenix,
  981. + # change gdevevga to gdevsco in the following line.
  982. + EGAVGA=gdevevga.$(OBJ) gdevpcfb.$(OBJ) $(PCFBASM)
  983. + gdevevga.$(OBJ): gdevevga.c $(GDEV) $(gdevpcfb_h)
  984. +     $(CCD) gdevevga.c
  985. + gdevsco.$(OBJ): gdevsco.c $(GDEV) $(gdevpcfb_h)
  986. +     $(CCD) gdevsco.c
  987. + # Common code for MS-DOS and SCO.
  988. + gdevpcfb.$(OBJ): gdevpcfb.c $(GDEV) $(MAKEFILE) $(gdevpcfb_h)
  989. +     $(CCD) -DUSE_ASM=0$(USE_ASM) gdevpcfb.c
  990. + # The EGA/VGA family includes: EGA, VGA, and
  991. + # the ATI Wonder, Tseng ET3000/4000, and Trident SuperVGA in 16-color mode.
  992. + ega.dev: $(EGAVGA) gssetdev
  993. +     $(SHP)gssetdev ega $(EGAVGA)
  994. + vga.dev: $(EGAVGA) gssetdev
  995. +     $(SHP)gssetdev vga $(EGAVGA)
  996. + atiw16.dev: $(EGAVGA) gssetdev
  997. +     $(SHP)gssetdev atiw16 $(EGAVGA)
  998. + tseng16.dev: $(EGAVGA) gssetdev
  999. +     $(SHP)gssetdev tseng16 $(EGAVGA)
  1000. + tvga16.dev: $(EGAVGA) gssetdev
  1001. +     $(SHP)gssetdev tvga16 $(EGAVGA)
  1002. + ### ------------------------- SuperVGA displays ------------------------ ###
  1003. + SVGA=gdevsvga.$(OBJ) $(PCFBASM)
  1004. + gdevsvga.$(OBJ): gdevsvga.c $(GDEV) $(MAKEFILE) \
  1005. +   $(gdevpcfb_h) $(gdevsvga_h)
  1006. +     $(CCD) -DUSE_ASM=0$(USE_ASM) gdevsvga.c
  1007. + # The SuperVGA family includes: ATI Wonder, S3, Trident, Tseng ET3000/4000,
  1008. + # and VESA.
  1009. + atiw.dev: $(SVGA) gssetdev
  1010. +     $(SHP)gssetdev atiw $(SVGA)
  1011. + tseng.dev: $(SVGA) gssetdev
  1012. +     $(SHP)gssetdev tseng $(SVGA)
  1013. + tvga.dev: $(SVGA) gssetdev
  1014. +     $(SHP)gssetdev tvga $(SVGA)
  1015. + vesa.dev: $(SVGA) gssetdev
  1016. +     $(SHP)gssetdev vesa $(SVGA)
  1017. + # The S3 driver doesn't share much code with the others.
  1018. + s3vga_=$(SVGA) gdevs3ga.$(OBJ)
  1019. + s3vga.dev: $(s3vga_) gssetdev
  1020. +     $(SHP)gssetdev s3vga $(s3vga_)
  1021. + gdevs3ga.$(OBJ): gdevs3ga.c $(GDEV) $(MAKEFILE) $(gdevpcfb_h) $(gdevsvga_h)
  1022. +     $(CCD) gdevs3ga.c
  1023. + ### ------------ The BGI (Borland Graphics Interface) device ----------- ###
  1024. + cgaf.$(OBJ): $(BGIDIR)\cga.bgi
  1025. +     $(BGIDIR)\bgiobj /F $(BGIDIR)\cga
  1026. + egavgaf.$(OBJ): $(BGIDIR)\egavga.bgi
  1027. +     $(BGIDIR)\bgiobj /F $(BGIDIR)\egavga
  1028. + # Include egavgaf.$(OBJ) for debugging only.
  1029. + bgi_=gdevbgi.$(OBJ) cgaf.$(OBJ)
  1030. + bgi.dev: $(bgi_) gssetdev gsaddmod
  1031. +     $(SHP)gssetdev bgi $(bgi_)
  1032. +     $(SHP)gsaddmod bgi -lib $(LIBDIR)\graphics
  1033. + gdevbgi.$(OBJ): gdevbgi.c $(GDEV) $(MAKEFILE) $(gxxfont_h)
  1034. +     $(CCC) -DBGI_LIB=$(QQ)$(BGIDIRSTR)$(QQ) gdevbgi.c
  1035. + ### ------------------- The Hercules Graphics display ------------------- ###
  1036. + herc_=gdevherc.$(OBJ)
  1037. + herc.dev: $(herc_) gssetdev
  1038. +     $(SHP)gssetdev herc $(herc_)
  1039. + gdevherc.$(OBJ): gdevherc.c $(GDEV)
  1040. +     $(CCC) gdevherc.c
  1041. + ###### ------------------- The Private Eye display ------------------- ######
  1042. + ### Note: this driver was contributed by a user:                          ###
  1043. + ###   please contact narf@media-lab.media.mit.edu if you have questions.  ###
  1044. + pe_=gdevpe.$(OBJ)
  1045. + pe.dev: $(pe_) gssetdev
  1046. +     $(SHP)gssetdev pe $(pe_)
  1047. + gdevpe.$(OBJ): gdevpe.c $(GDEV)
  1048. + ###### ----------------- The MS-Windows 3.n display ------------------ ######
  1049. + gdevmswn_h=gdevmswn.h $(GDEV) gp_mswin.h
  1050. + # Choose one of gdevwddb or gdevwdib here.
  1051. + mswin_=gdevmswn.$(OBJ) gdevmsxf.$(OBJ) gdevwdib.$(OBJ) \
  1052. +   gdevemap.$(OBJ) gdevpccm.$(OBJ)
  1053. + mswin.dev: $(mswin_) gssetdev
  1054. +     $(SHP)gssetdev mswin $(mswin_)
  1055. + gdevmswn.$(OBJ): gdevmswn.c $(gdevmswn_h) $(gp_h) $(gpcheck_h) \
  1056. +   $(gsprops_h) $(gdevpccm_h)
  1057. + gdevmsxf.$(OBJ): gdevmsxf.c $(ctype__h) $(math__h) $(memory__h) \
  1058. +   $(gdevmswn_h) $(gsutil_h) $(gxxfont_h)
  1059. + # An implementation using a device-dependent bitmap.
  1060. + gdevwddb.$(OBJ): gdevwddb.c $(gdevmswn_h)
  1061. + # An implementation using a DIB filled by an image device.
  1062. + gdevwdib.$(OBJ): gdevwdib.c $(dos__h) $(gdevmswn_h)
  1063. + ###### ----------------- The MS-Windows 3.n printer ------------------ ######
  1064. + mswinprn_=gdevwprn.$(OBJ) gdevmsxf.$(OBJ)
  1065. + mswinprn.dev: $(mswinprn_) gssetdev
  1066. +     $(SHP)gssetdev mswinprn $(mswinprn_)
  1067. + gdevwprn.$(OBJ): gdevwprn.c $(gdevmswn_h) $(gp_h) $(gpcheck_h) \
  1068. +   $(gsprops_h) $(gdevpccm_h)
  1069. + ### ---------------- Amiga display/printer/file devices ---------------- ###
  1070. + ### Note: this driver was contributed by a user: please contact          ###
  1071. + ###       Olaf Barthel (olsen@sourcery.han.de) if you have questions.    ###
  1072. + ###       He would also like to hear from anyone using the driver.       ###
  1073. + ### Please consult the source code for additional documentation.         ###
  1074. + amiga_=gdevamiga.$(OBJ)
  1075. + amiga.dev: $(amiga_) gssetdev
  1076. +     $(SHP)gssetdev amiga $(amiga_)
  1077. + amiga_low.dev: $(amiga_) gssetdev
  1078. +     $(SHP)gssetdev amiga_low $(amiga_)
  1079. + amiga_high.dev: $(amiga_) gssetdev
  1080. +     $(SHP)gssetdev amiga_high $(amiga_)
  1081. + amiga_super.dev: $(amiga_) gssetdev
  1082. +     $(SHP)gssetdev amiga_super $(amiga_)
  1083. + amiga_a2024.dev: $(amiga_) gssetdev
  1084. +     $(SHP)gssetdev amiga_a2024 $(amiga_)
  1085. + amiga_picassoii.dev: $(amiga_) gssetdev
  1086. +     $(SHP)gssetdev amiga_picassoii $(amiga_)
  1087. + amiga_custom.dev: $(amiga_) gssetdev
  1088. +     $(SHP)gssetdev amiga_custom $(amiga_)
  1089. + amiga_printer.dev: $(amiga_) gssetdev
  1090. +     $(SHP)gssetdev amiga_printer $(amiga_)
  1091. + amiga_ilbm.dev: $(amiga_) gssetdev
  1092. +     $(SHP)gssetdev amiga_ilbm $(amiga_)
  1093. + gdevamiga.$(OBJ): gdevamiga.c $(GDEV) $(arch_h)
  1094. + ###### ----------- The AT&T 3b1 Unixpc monochrome display ------------ ######
  1095. + ### Note: this driver was contributed by a user: please contact           ###
  1096. + ###       Andy Fyfe (andy@cs.caltech.edu) if you have questions.          ###
  1097. + att3b1_=gdev3b1.$(OBJ)
  1098. + att3b1.dev: $(att3b1_) gssetdev
  1099. +     $(SHP)gssetdev att3b1 $(att3b1_)
  1100. + gdev3b1.$(OBJ): gdev3b1.c
  1101. + ###### --------------- Memory-buffered printer devices --------------- ######
  1102. + # The dependency list for printers includes devs.mak because
  1103. + # you can specify -DA4 to make A4 paper the default.
  1104. + # See below under, e.g., gdevdjet.c.
  1105. + PDEVH=$(GDEV) $(gdevprn_h) devs.mak
  1106. + gdevprn.$(OBJ): gdevprn.c $(PDEVH) $(gp_h) $(gsprops_h)
  1107. + ### ------------------- The Apple DMP printer device ------------------- ###
  1108. + appledmp_=gdevadmp.$(OBJ) gdevprn.$(OBJ)
  1109. + appledmp.dev: $(appledmp_) gssetdev
  1110. +     $(SHP)gssetdev appledmp $(appledmp_)
  1111. + ### ------------ The Canon BubbleJet BJ10e and BJ200 devices ------------ ###
  1112. + bj10e_=gdevbj10.$(OBJ) gdevprn.$(OBJ)
  1113. + bj10e.dev: $(bj10e_) gssetdev
  1114. +     $(SHP)gssetdev bj10e $(bj10e_)
  1115. + bj200.dev: $(bj10e_) gssetdev
  1116. +     $(SHP)gssetdev bj200 $(bj10e_)
  1117. + gdevbj10.$(OBJ): gdevbj10.c $(PDEVH)
  1118. + ### -------------------------- The DigiFAX device ----------------------- ###
  1119. + ###    This driver outputs images in a format suitable for use with       ###
  1120. + ###    DigiBoard, Inc.'s DigiFAX software.  Use -sDEVICE=dfaxhigh for     ###
  1121. + ###    high resolution output, -sDEVICE=dfaxlow for normal output.        ###
  1122. + ### Note: this driver was contributed by a user: please contact           ###
  1123. + ###       Rick Richardson (rick@digibd.com) if you have questions.        ###
  1124. + digifax_=gdevdfax.$(OBJ) gdevprn.$(OBJ)
  1125. + dfaxhigh.dev: $(digifax_) gssetdev
  1126. +     $(SHP)gssetdev dfaxhigh $(digifax_)
  1127. + dfaxlow.dev: $(digifax_) gssetdev
  1128. +     $(SHP)gssetdev dfaxlow $(digifax_)
  1129. + gdevdfax.$(OBJ): gdevdfax.c $(GDEV) $(gdevprn_h) gdevdfg3.h
  1130. + ### ----------- The H-P DeskJet and LaserJet printer devices ----------- ###
  1131. + ### These are essentially the same device.
  1132. + ### You can make A4 paper the default: see below.
  1133. + ### NOTE: printing at full resolution (300 DPI) requires a printer
  1134. + ###   with at least 1.5 Mb of memory.  150 DPI only requires .5 Mb.
  1135. + HPPCL=gdevprn.$(OBJ) gdevpcl.$(OBJ)
  1136. + HPMONO=gdevdjet.$(OBJ) $(HPPCL)
  1137. + gdevpcl.$(OBJ): gdevpcl.c $(PDEVH) $(gdevpcl_h)
  1138. + # To make A4 paper the default, change the second line below this to
  1139. + #    $(CCC) -DA4 gdevdjet.c
  1140. + gdevdjet.$(OBJ): gdevdjet.c $(PDEVH) $(gdevpcl_h)
  1141. +     $(CCC) gdevdjet.c
  1142. + deskjet.dev: $(HPMONO) gssetdev
  1143. +     $(SHP)gssetdev deskjet $(HPMONO)
  1144. + djet500.dev: $(HPMONO) gssetdev
  1145. +     $(SHP)gssetdev djet500 $(HPMONO)
  1146. + laserjet.dev: $(HPMONO) gssetdev
  1147. +     $(SHP)gssetdev laserjet $(HPMONO)
  1148. + ljetplus.dev: $(HPMONO) gssetdev
  1149. +     $(SHP)gssetdev ljetplus $(HPMONO)
  1150. + ### Selecting ljet2p provides TIFF (mode 2) compression on LaserJet III,
  1151. + ### IIIp, IIId, IIIsi, IId, and IIp. 
  1152. + ljet2p.dev: $(HPMONO) gssetdev
  1153. +     $(SHP)gssetdev ljet2p $(HPMONO)
  1154. + ### Selecting ljet3 provides Delta Row (mode 3) compression on LaserJet III,
  1155. + ### IIIp, IIId, IIIsi.
  1156. + ljet3.dev: $(HPMONO) gssetdev
  1157. +     $(SHP)gssetdev ljet3 $(HPMONO)
  1158. + ### Selecting ljet4 also provides Delta Row compression on LaserJet IV series.
  1159. + ljet4.dev: $(HPMONO) gssetdev
  1160. +     $(SHP)gssetdev ljet4 $(HPMONO)
  1161. + ###- The H-P DeskJet 500C/550C and PaintJet family color printer devices -###
  1162. + ### Note: there are two different 500C drivers, both contributed by users.###
  1163. + ###   If you have questions about the djet500c driver,                    ###
  1164. + ###       please contact AKayser@et.tudelft.nl.                           ###
  1165. + ###   If you have questions about the cdj* drivers,                       ###
  1166. + ###       please contact g.cameron@biomed.abdn.ac.uk.                     ###
  1167. + cdeskjet_=gdevcdj.$(OBJ) $(HPPCL)
  1168. + cdeskjet.dev: $(cdeskjet_) gssetdev
  1169. +     $(SHP)gssetdev cdeskjet $(cdeskjet_)
  1170. + cdjcolor.dev: $(cdeskjet_) gssetdev
  1171. +     $(SHP)gssetdev cdjcolor $(cdeskjet_)
  1172. + cdjmono.dev: $(cdeskjet_) gssetdev
  1173. +     $(SHP)gssetdev cdjmono $(cdeskjet_)
  1174. + cdj500.dev: $(cdeskjet_) gssetdev
  1175. +     $(SHP)gssetdev cdj500 $(cdeskjet_)
  1176. + cdj550.dev: $(cdeskjet_) gssetdev
  1177. +     $(SHP)gssetdev cdj550 $(cdeskjet_)
  1178. + declj250.dev: $(cdeskjet_) gssetdev
  1179. +     $(SHP)gssetdev declj250 $(cdeskjet_)
  1180. + pj.dev: $(cdeskjet_) gssetdev
  1181. +     $(SHP)gssetdev pj $(cdeskjet_)
  1182. + pjxl.dev: $(cdeskjet_) gssetdev
  1183. +     $(SHP)gssetdev pjxl $(cdeskjet_)
  1184. + pjxl300.dev: $(cdeskjet_) gssetdev
  1185. +     $(SHP)gssetdev pjxl300 $(cdeskjet_)
  1186. + # NB: you can also customise the build if required, using -DA4 (for A4 paper)
  1187. + # and -DBitsPerPixel=<number> if you wish the default to be other than 24
  1188. + # for the generic drivers (cdj500, cdj550, pjxl300, pjtest, pjxltest).
  1189. + # E.g,. to make A4 paper the default, change the second line below this to
  1190. + #    $(CCC) -DA4 gdevdjet.c
  1191. + gdevcdj.$(OBJ): gdevcdj.c $(PDEVH) $(gdevpcl_h)
  1192. +     $(CCC) gdevcdj.c
  1193. + djet500c_=gdevdjtc.$(OBJ) $(HPPCL)
  1194. + djet500c.dev: $(djet500c_) gssetdev
  1195. +     $(SHP)gssetdev djet500c $(djet500c_)
  1196. + gdevdjtc.$(OBJ): gdevdjtc.c $(PDEVH) $(gdevpcl_h)
  1197. + ### ----------------- The generic Epson printer device ----------------- ###
  1198. + epson_=gdevepsn.$(OBJ) gdevprn.$(OBJ)
  1199. + epson.dev: $(epson_) gssetdev
  1200. +     $(SHP)gssetdev epson $(epson_)
  1201. + eps9high.dev: $(epson_) gssetdev
  1202. +     $(SHP)gssetdev eps9high $(epson_)
  1203. + gdevepsn.$(OBJ): gdevepsn.c $(PDEVH)
  1204. + ### ----------------- The IBM Proprinter printer device ---------------- ###
  1205. + ibmpro.dev: $(epson_) gssetdev
  1206. +     $(SHP)gssetdev ibmpro $(epson_)
  1207. + ### -------------- The Epson LQ-2550 color printer device -------------- ###
  1208. + ### Note: this driver was contributed by users: please contact           ###
  1209. + ###       Dave St. Clair (dave@exlog.com) if you have questions.         ###
  1210. + epsonc_=gdevepsc.$(OBJ) gdevprn.$(OBJ)
  1211. + epsonc.dev: $(epsonc_) gssetdev
  1212. +     $(SHP)gssetdev epsonc $(epsonc_)
  1213. + gdevepsc.$(OBJ): gdevepsc.c $(PDEVH)
  1214. + ### -------------- The Epson ESC/P 2 language printer device ----------- ###
  1215. + ### Note: this driver was contributed by a user: if you have questions,  ###
  1216. + ###       please contact Richard Brown (rab@tauon.ph.unimelb.edu.au).    ###
  1217. + escp2_=gdevescp.$(OBJ) gdevprn.$(OBJ)
  1218. + escp2.dev: $(escp2_) gssetdev
  1219. +     $(SHP)gssetdev escp2 $(escp2_)
  1220. + gdevescp.$(OBJ): gdevescp.c $(PDEVH)
  1221. + ### ------------ The H-P PaintJet color printer device ----------------- ###
  1222. + ### Note: this driver also supports the DEC LJ250 color printer, which   ###
  1223. + ###       has a PaintJet-compatible mode, and the PaintJet XL.           ###
  1224. + ### If you have questions about the XL, please contact Rob Reiss         ###
  1225. + ###       (rob@moray.berkeley.edu).                                      ###
  1226. + PJET=gdevpjet.$(OBJ) $(HPPCL)
  1227. + gdevpjet.$(OBJ): gdevpjet.c $(PDEVH) $(gdevpcl_h)
  1228. + lj250.dev: $(PJET) gssetdev
  1229. +     $(SHP)gssetdev lj250 $(PJET)
  1230. + paintjet.dev: $(PJET) gssetdev
  1231. +     $(SHP)gssetdev paintjet $(PJET)
  1232. + pjetxl.dev: $(PJET) gssetdev
  1233. +     $(SHP)gssetdev pjetxl $(PJET)
  1234. + ### ------- The IBM 3852 JetPrinter color inkjet printer device -------- ###
  1235. + ### Note: this driver was contributed by users: please contact           ###
  1236. + ###       Kevin Gift (kgift@draper.com) if you have questions.           ###
  1237. + ### Note that the paper size that can be addressed by the graphics mode  ###
  1238. + ###   used in this driver is fixed at 7-1/2 inches wide (the printable   ###
  1239. + ###   width of the jetprinter itself.)                                   ###
  1240. + jetp3852_=gdev3852.$(OBJ) gdevprn.$(OBJ)
  1241. + jetp3852.dev: $(jetp3852_) gssetdev
  1242. +     $(SHP)gssetdev jetp3852 $(jetp3852_)
  1243. + gdevjetp.$(OBJ): gdevjetp.c $(PDEVH) $(gdevpcl_h)
  1244. + ### ----------------- The Canon LBP-8II printer device ----------------- ###
  1245. + ### Note: this driver was contributed by users: please contact           ###
  1246. + ###       Tom Quinn (trq@prg.oxford.ac.uk) if you have questions.        ###
  1247. + ### Note that the standard paper size for this driver is the European    ###
  1248. + ###   A4 size, not the American 8.5" x 11" size.                         ###
  1249. + lbp8_=gdevlbp8.$(OBJ) gdevprn.$(OBJ)
  1250. + lbp8.dev: $(lbp8_) gssetdev
  1251. +     $(SHP)gssetdev lbp8 $(lbp8_)
  1252. + gdevlbp8.$(OBJ): gdevlbp8.c $(PDEVH)
  1253. + ### -------------- The DEC LN03/LA50/LA75 printer devices -------------- ###
  1254. + ### Note: this driver was contributed by users: please contact           ###
  1255. + ###       Ulrich Mueller (ulm@vsnhd1.cern.ch) if you have questions.     ###
  1256. + ### For questions about LA50 and LA75: please contact                    ###
  1257. + ###       Ian MacPhedran (macphed@dvinci.USask.CA).                     ###
  1258. + ### For the LN03, you can make A4 paper the default: see below.          ###
  1259. + ln03_=gdevln03.$(OBJ) gdevprn.$(OBJ)
  1260. + ln03.dev: $(ln03_) gssetdev
  1261. +     $(SHP)gssetdev ln03 $(ln03_)
  1262. + la50.dev: $(ln03_) gssetdev
  1263. +     $(SHP)gssetdev la50 $(ln03_)
  1264. + la75.dev: $(ln03_) gssetdev
  1265. +     $(SHP)gssetdev la75 $(ln03_)
  1266. + # To make A4 paper the default, change the second line below this to
  1267. + #    $(CCC) -DA4 gdevln03.c
  1268. + gdevln03.$(OBJ): gdevln03.c $(PDEVH)
  1269. +     $(CCC) gdevln03.c
  1270. + ### -------------- The C.Itoh M8510 printer device --------------------- ###
  1271. + ### Note: this driver was contributed by a user: please contact Bob      ###
  1272. + ###       Smith <bob@snuffy.penfield.ny.us> if you have questions.       ###
  1273. + m8510_=gdev8510.$(OBJ) gdevprn.$(OBJ)
  1274. + m8510.dev: $(m8510_) gssetdev
  1275. +     $(SHP)gssetdev m8510 $(m8510_)
  1276. + gdev8510.$(OBJ): gdev8510.c $(PDEVH)
  1277. + ### --------------------- The NEC P6 family devices -------------------- ###
  1278. + necp6_=gdevnp6.$(OBJ) gdevprn.$(OBJ)
  1279. + necp6.dev: $(necp6_) gssetdev
  1280. +     $(SHP)gssetdev necp6 $(necp6_)
  1281. + gdevnp6.$(OBJ): gdevnp6.c $(PDEVH)
  1282. + ### ----------------- The Okidata MicroLine 182 device ----------------- ###
  1283. + ### Note: this driver was contributed by a user: please contact          ###
  1284. + ###       Maarten Koning (smeg@bnr.ca) if you have questions.            ###
  1285. + oki182_=gdevo182.$(OBJ) gdevprn.$(OBJ)
  1286. + oki182.dev: $(oki182_) gssetdev
  1287. +     $(SHP)gssetdev oki182 $(oki182_)
  1288. + gdevo182.$(OBJ): gdevo182.c $(PDEVH)
  1289. + ### ------------- The Ricoh 4081 laser printer device ------------------ ###
  1290. + ### Note: this driver was contributed by users:                          ###
  1291. + ###       please contact kdw@oasis.icl.co.uk if you have questions.      ###
  1292. + r4081_=gdev4081.$(OBJ) gdevprn.$(OBJ)
  1293. + r4081.dev: $(r4081_) gssetdev
  1294. +     $(SHP)gssetdev r4081 $(r4081_)
  1295. + gdev4081.$(OBJ): gdev4081.c $(PDEVH)
  1296. + ###### ------------------------ Sony devices ------------------------ ######
  1297. + ### Note: these drivers were contributed by users: please contact        ###
  1298. + ###       Mike Smolenski (mike@intertech.com) if you have questions.     ###
  1299. + ### ------------------- Sony NeWS frame buffer device ------------------ ###
  1300. + sonyfb_=gdevsnfb.$(OBJ) gdevprn.$(OBJ)
  1301. + sonyfb.dev: $(sonyfb_) gssetdev
  1302. +     $(SHP)gssetdev sonyfb $(sonyfb_)
  1303. + gdevsnfb.$(OBJ): gdevsnfb.c $(PDEVH)
  1304. + ### -------------------- Sony NWP533 printer device -------------------- ###
  1305. + ### Note: this driver was contributed by a user: please contact Tero     ###
  1306. + ###       Kivinen (kivinen@joker.cs.hut.fi) if you have questions.       ###
  1307. + nwp533_=gdevn533.$(OBJ) gdevprn.$(OBJ)
  1308. + nwp533.dev: $(nwp533_) gssetdev
  1309. +     $(SHP)gssetdev nwp533 $(nwp533_)
  1310. + gdevn533.$(OBJ): gdevn533.c $(PDEVH)
  1311. + ### ------------------------- The SPARCprinter ------------------------- ###
  1312. + ### Note: this driver was contributed by users: please contact Martin    ###
  1313. + ###       Schulte (schulte@thp.uni-koeln.de) if you have questions.      ###
  1314. + ###       He would also like to hear from anyone using the driver.       ###
  1315. + ### Please consult the source code for additional documentation.         ###
  1316. + sparc_=gdevsppr.$(OBJ) gdevprn.$(OBJ)
  1317. + sparc.dev: $(sparc_) gssetdev
  1318. +     $(SHP)gssetdev sparc $(sparc_)
  1319. + gdevsppr.$(OBJ): gdevsppr.c $(PDEVH)
  1320. + ###### --------------------- The SunView device --------------------- ######
  1321. + ### Note: this driver is maintained by a user: if you have questions,    ###
  1322. + ###       please contact Andreas Stolcke (stolcke@icsi.berkeley.edu).    ###
  1323. + sunview_=gdevsun.$(OBJ)
  1324. + sunview.dev: $(sunview_) gssetdev gsaddmod
  1325. +     $(SHP)gssetdev sunview $(sunview_)
  1326. +     $(SHP)gsaddmod sunview -lib suntool sunwindow pixrect
  1327. + gdevsun.$(OBJ): gdevsun.c $(GDEV) $(arch_h)
  1328. + ### ----------------- Tektronix 4396d color printer -------------------- ###
  1329. + ### Note: this driver was contributed by a user: please contact          ###
  1330. + ###       Karl Hakimian (hakimian@haney.eecs.wsu.edu)                    ###
  1331. + ###       if you have questions.                                         ###
  1332. + t4693d_=gdev4693.$(OBJ) gdevprn.$(OBJ)
  1333. + t4693d2.dev: $(t4693d_) gssetdev
  1334. +     $(SHP)gssetdev t4693d2 $(t4693d_)
  1335. + t4693d4.dev: $(t4693d_) gssetdev
  1336. +     $(SHP)gssetdev t4693d4 $(t4693d_)
  1337. + t4693d8.dev: $(t4693d_) gssetdev
  1338. +     $(SHP)gssetdev t4693d8 $(t4693d_)
  1339. + gdev4693.$(OBJ): gdev4693.c $(GDEV)
  1340. + ### -------------------- Tektronix ink-jet printers -------------------- ###
  1341. + ### Note: this driver was contributed by a user: please contact          ###
  1342. + ###       Karsten Spang (spang@nbivax.nbi.dk) if you have questions.     ###
  1343. + tek4696_=gdevtknk.$(OBJ) gdevprn.$(OBJ)
  1344. + tek4696.dev: $(tek4696_) gssetdev
  1345. +     $(SHP)gssetdev tek4696 $(tek4696_)
  1346. + gdevtknk.$(OBJ): gdevtknk.c $(PDEVH)
  1347. + ### ----------------- The TruFax facsimile device ---------------------- ###
  1348. + ### Note: this driver was contributed by users: please contact           ###
  1349. + ###       Neil Ostroff (nao@maestro.bellcore.com) if you have questions. ###
  1350. + ### Note that the driver requires a file encode_l.o supplied by the      ###
  1351. + ###   makers of the TruFax product.                                      ###
  1352. + trufax_=gdevtrfx.$(OBJ) gdevprn.$(OBJ) encode_l.$(OBJ)
  1353. + trufax.dev: $(trufax_) gssetdev
  1354. +     $(SHP)gssetdev trufax $(trufax_)
  1355. + gdevtrfx.$(OBJ): gdevtrfx.c $(GDEV)
  1356. + ###### ----------------------- The X11 device ----------------------- ######
  1357. + # Aladdin Enterprises does not support Ghostview.  For more information
  1358. + # about Ghostview, please contact Tim Theisen (ghostview@cs.wisc.edu).
  1359. + x11_=gdevx.$(OBJ) gdevxini.$(OBJ) gdevxxf.$(OBJ) gdevemap.$(OBJ)
  1360. + x11.dev: $(x11_) gssetdev gsaddmod
  1361. +     $(SHP)gssetdev x11 $(x11_)
  1362. +     $(SHP)gsaddmod x11 -lib Xt X11 Xext
  1363. + # See the main makefile for the definition of XINCLUDE.
  1364. + GDEVX=$(GDEV) x_.h gdevx.h $(MAKEFILE)
  1365. + gdevx.$(OBJ): gdevx.c $(GDEVX) $(gsprops_h) $(gsutil_h)
  1366. +     $(CCC) $(XINCLUDE) gdevx.c
  1367. + gdevxini.$(OBJ): gdevxini.c $(GDEVX) $(ctype__h)
  1368. +     $(CCC) $(XINCLUDE) gdevxini.c
  1369. + gdevxxf.$(OBJ): gdevxxf.c $(GDEVX) $(gsutil_h) $(gxxfont_h)
  1370. +     $(CCC) $(XINCLUDE) gdevxxf.c
  1371. + ### ---------------------- The bit bucket device ----------------------- ###
  1372. + bit_=gdevbit.$(OBJ) gdevprn.$(OBJ)
  1373. + bit.dev: $(bit_) gssetdev
  1374. +     $(SHP)gssetdev bit $(bit_)
  1375. + gdevbit.$(OBJ): gdevbit.c $(PDEVH)
  1376. + ###### ----------------------- PC file formats ---------------------- ######
  1377. + gdevpccm.$(OBJ): gdevpccm.c $(AK) \
  1378. +   $(gs_h) $(gsmatrix_h) $(gxdevice_h) $(gdevpccm_h)
  1379. + ### ------------------------- .BMP file formats ------------------------- ###
  1380. + bmp_=gdevbmp.$(OBJ) gdevpccm.$(OBJ) gdevprn.$(OBJ)
  1381. + gdevbmp.$(OBJ): gdevbmp.c $(PDEVH) $(gdevpccm_h)
  1382. + bmpmono.dev: $(bmp_) gssetdev
  1383. +     $(SHP)gssetdev bmpmono $(bmp_)
  1384. + bmp16.dev: $(bmp_) gssetdev
  1385. +     $(SHP)gssetdev bmp16 $(bmp_)
  1386. + bmp256.dev: $(bmp_) gssetdev
  1387. +     $(SHP)gssetdev bmp256 $(bmp_)
  1388. + bmp16m.dev: $(bmp_) gssetdev
  1389. +     $(SHP)gssetdev bmp16m $(bmp_)
  1390. + ### ------------------------- GIF file formats ------------------------- ###
  1391. + GIF=gdevgif.$(OBJ) gdevpccm.$(OBJ) gdevprn.$(OBJ)
  1392. + gdevgif.$(OBJ): gdevgif.c $(PDEVH) $(gdevpccm_h)
  1393. + gifmono.dev: $(GIF) gssetdev
  1394. +     $(SHP)gssetdev gifmono $(GIF)
  1395. + gif8.dev: $(GIF) gssetdev
  1396. +     $(SHP)gssetdev gif8 $(GIF)
  1397. + ### ------------------------- PCX file formats ------------------------- ###
  1398. + pcx_=gdevpcx.$(OBJ) gdevpccm.$(OBJ) gdevprn.$(OBJ)
  1399. + gdevpcx.$(OBJ): gdevpcx.c $(PDEVH) $(gdevpccm_h) $(gxlum_h)
  1400. + pcxmono.dev: $(pcx_) gssetdev
  1401. +     $(SHP)gssetdev pcxmono $(pcx_)
  1402. + pcxgray.dev: $(pcx_) gssetdev
  1403. +     $(SHP)gssetdev pcxgray $(pcx_)
  1404. + pcx16.dev: $(pcx_) gssetdev
  1405. +     $(SHP)gssetdev pcx16 $(pcx_)
  1406. + pcx256.dev: $(pcx_) gssetdev
  1407. +     $(SHP)gssetdev pcx256 $(pcx_)
  1408. + ###### ------------------- Portable Bitmap devices ------------------ ######
  1409. + ### For more information, see the pbm(5), pgm(5), and ppm(5) man pages.  ###
  1410. + pxm_=gdevpbm.$(OBJ) gdevprn.$(OBJ)
  1411. + gdevpbm.$(OBJ): gdevpbm.c $(PDEVH) $(gxlum_h)
  1412. + ### Portable Bitmap (PBM, plain or raw format, magic numbers "P1" or "P4")
  1413. + pbm.dev: $(pxm_) gssetdev
  1414. +     $(SHP)gssetdev pbm $(pxm_)
  1415. + pbmraw.dev: $(pxm_) gssetdev
  1416. +     $(SHP)gssetdev pbmraw $(pxm_)
  1417. + ### Portable Graymap (PGM, plain or raw format, magic numbers "P2" or "P5")
  1418. + pgm.dev: $(pxm_) gssetdev
  1419. +     $(SHP)gssetdev pgm $(pxm_)
  1420. + pgmraw.dev: $(pxm_) gssetdev
  1421. +     $(SHP)gssetdev pgmraw $(pxm_)
  1422. + ### Portable Pixmap (PPM, plain or raw format, magic numbers "P3" or "P6")
  1423. + ppm.dev: $(pxm_) gssetdev
  1424. +     $(SHP)gssetdev ppm $(pxm_)
  1425. + ppmraw.dev: $(pxm_) gssetdev
  1426. +     $(SHP)gssetdev ppmraw $(pxm_)
  1427. + ### -------------------------- TIFF/F device ---------------------------- ###
  1428. + ###    This driver outputs images in a TIFF format               ###
  1429. + ###    Use -sDEVICE=tiffg3 and                          ###
  1430. + ###      -r204x98 for low resolution output, or              ###
  1431. + ###      -r204x196 for high resolution output                  ###
  1432. + ###    Note also that 3 page sizes are understood: letter, A4, and B4      ###
  1433. + ### Note: this driver was contributed by a user: please contact           ###
  1434. + ###       Sam Leffler (sam@sgi.com) if you have questions.              ###
  1435. + tiffg3_=gdevtiff.$(OBJ) gdevprn.$(OBJ)
  1436. + tiffg3.dev: $(tiffg3_) gssetdev
  1437. +     $(SHP)gssetdev tiffg3 $(tiffg3_)
  1438. + gdevtiff.$(OBJ): gdevtiff.c $(GDEV) $(gdevprn_h) gdevdfg3.h gdevtiff.h
  1439. + #    Copyright (C) 1990, 1992, 1993 Aladdin Enterprises.  All rights reserved.
  1440. + #
  1441. + # This file is part of Ghostscript.
  1442. + #
  1443. + # Ghostscript is distributed in the hope that it will be useful, but
  1444. + # WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  1445. + # to anyone for the consequences of using it or for whether it serves any
  1446. + # particular purpose or works at all, unless he says so in writing.  Refer
  1447. + # to the Ghostscript General Public License for full details.
  1448. + #
  1449. + # Everyone is granted permission to copy, modify and redistribute
  1450. + # Ghostscript, but only under the conditions described in the Ghostscript
  1451. + # General Public License.  A copy of this license is supposed to have been
  1452. + # given to you along with Ghostscript so you can know your rights and
  1453. + # responsibilities.  It should be in a file named COPYING.  Among other
  1454. + # things, the copyright notice and this notice must be preserved on all
  1455. + # copies.
  1456. + # Partial makefile for Ghostscript, common to all Unix configurations.
  1457. + # This is the last part of the makefile for Unix configurations.
  1458. + # Since Unix make doesn't have an 'include' facility, we concatenate
  1459. + # the various parts of the makefile together by brute force (in tar_cat).
  1460. + # The following prevents GNU make from constructing argument lists that
  1461. + # include all environment variables, which can easily be longer than
  1462. + # brain-damaged system V allows.
  1463. + .NOEXPORT:
  1464. + # -------------------------------- Library -------------------------------- #
  1465. + ## The Commodore Amiga
  1466. + amiga__=gp_nofb.$(OBJ) gp_amiga.$(OBJ) gdevpipe.$(OBJ)
  1467. + amiga_.dev: $(amiga__) gssetmod gsaddmod
  1468. +     $(SHP)gssetmod amiga_ $(amiga__)
  1469. +     $(SHP)gsaddmod amiga_ -fdev pipe
  1470. + gp_amiga.$(OBJ): gp_amiga.c $(AK) $(memory__h) $(string__h) $(gx_h) $(gp_h) \
  1471. + ## The Unix platforms
  1472. + # We have to include a test for the existence of sys/time.h,
  1473. + # because some System V platforms don't have it.
  1474. + # All reasonable Unix platforms.
  1475. + unix__=gp_nofb.$(OBJ) gp_unix.$(OBJ) gdevpipe.$(OBJ)
  1476. + unix_.dev: $(unix__) gssetmod gsaddmod
  1477. +     $(SHP)gssetmod unix_ $(unix__)
  1478. +     $(SHP)gsaddmod unix_ -fdev pipe
  1479. + gp_unix.$(OBJ): gp_unix.c $(AK) $(memory__h) $(string__h) $(gx_h) $(gp_h) \
  1480. +  $(gsutil_h) $(stat__h) $(time__h)
  1481. +     if ( test -f /gnu/include/sys/time.h ) then $(CCC) gp_unix.c;\
  1482. +     else $(CCC) -DNOSYSTIME gp_unix.c; fi
  1483. + gdevpipe.$(OBJ): gdevpipe.c $(AK) $(stdio__h) $(gstypes_h) \
  1484. +   $(filedev_h) $(stream_h)
  1485. + # Brain-damaged System V platforms.
  1486. + sysv__=gp_nofb.$(OBJ) gp_unix.$(OBJ) gp_sysv.$(OBJ)
  1487. + sysv_.dev: $(sysv__) gssetmod
  1488. +     $(SHP)gssetmod sysv_ $(sysv__)
  1489. + gp_sysv.$(OBJ): gp_sysv.c $(time__h) $(AK)
  1490. +     if ( test -f /gnu/include/sys/time.h ) then $(CCC) gp_sysv.c;\
  1491. +     else $(CCC) -DNOSYSTIME gp_sysv.c; fi
  1492. + # -------------------------- Auxiliary programs --------------------------- #
  1493. + ansi2knr$(XE): ansi2knr.c $(stdio__h) $(string__h) $(malloc__h)
  1494. +     $(CC) -o ansi2knr$(XE) $(CFLAGS) ansi2knr.c
  1495. + echogs$(XE): echogs.c
  1496. +     $(CC) -o echogs$(XE) $(CFLAGS) echogs.c
  1497. + # On the RS/6000 (at least), compiling genarch.c with gcc with -O
  1498. + # produces a buggy executable.
  1499. + genarch$(XE): genarch.c
  1500. +     $(CC) -o genarch$(XE) genarch.c
  1501. + genconf$(XE): genconf.c
  1502. +     $(CC) -o genconf$(XE) genconf.c
  1503. + # ----------------------------- Main program ------------------------------ #
  1504. + BEGINFILES=
  1505. + CCBEGIN=$(CCC) *.c
  1506. + # Interpreter main program
  1507. + GSAMIGA=gs.$(OBJ) gsmain.$(OBJ) $(INT) $(LIBGS)
  1508. + # The second call on echogs writes a \.  This is the only
  1509. + # way to do it that works with all flavors of shell!
  1510. + $(GS)$(XE): $(GSAMIGA) ld.tr echogs $(ALL_DEVS)
  1511. +     ./echogs -n - $(CC) $(LDFLAGS) $(XLIBDIRS) -o gs $(GSAMIGA) >_temp_
  1512. +     ./echogs -x 205c >>_temp_
  1513. +     cat ld.tr >>_temp_
  1514. +     ./echogs - $(EXTRALIBS) -lm >>_temp_
  1515. +     $(SH) <_temp_
  1516. + # Installation
  1517. + TAGS:
  1518. +     etags -t *.c *.h
  1519. + docdir=$(gsdatadir)/doc
  1520. + exdir=$(gsdatadir)/examples
  1521. + install: $(GS)
  1522. +     if [ -d $(bindir) ]; then true; else mkdir $(bindir); fi
  1523. +     if [ -d $(datadir) ]; then true; else mkdir $(datadir); fi
  1524. +     if [ -d $(gsdatadir) ]; then true; else mkdir $(gsdatadir); fi
  1525. +     if [ -d $(gsdatadir)/fonts ]; then true; else mkdir $(gsdatadir)/fonts; fi
  1526. +     if [ -d $(docdir) ]; then true; else mkdir $(docdir); fi
  1527. +     if [ -d $(exdir) ]; then true; else mkdir $(exdir); fi
  1528. +     for f in $(GS) gsbj gsdj gslj gslp gsnd bdftops font2c ps2ascii ps2epsi ; do $(INSTALL_PROGRAM) $$f $(bindir)/$$f ; done
  1529. +     for f in README gslp.ps gs_init.ps gs_dps1.ps gs_fonts.ps gs_lev2.ps gs_statd.ps gs_type0.ps gs_dbt_e.ps gs_sym_e.ps quit.ps Fontmap uglyr.gsf bdftops.ps decrypt.ps font2c.ps impath.ps landscap.ps level1.ps prfont.ps ps2ascii.ps ps2epsi.ps ps2image.ps pstoppm.ps showpage.ps type1ops.ps wrfont.ps ; do $(INSTALL_DATA) $$f $(gsdatadir)/$$f ; done
  1530. +     for f in NEWS ansi2knr.1 devices.doc drivers.doc fonts.doc gs.1 hershey.doc history.doc humor.doc language.doc lib.doc make.doc ps2epsi.doc psfiles.doc readme.doc use.doc xfonts.doc ; do $(INSTALL_DATA) $$f $(docdir)/$$f ; done
  1531. +     for f in chess.ps cheq.ps colorcir.ps golfer.ps escher.ps snowflak.ps tiger.ps ; do $(INSTALL_DATA) $$f $(exdir)/$$f ; done
  1532. diff -rc --new-file ghostscript-2.6.1-fsf/amiga.doc ghostscript-2.6.1-amiga/amiga.doc
  1533. *** ghostscript-2.6.1-fsf/amiga.doc    Thu Jan  1 00:00:00 1970
  1534. --- ghostscript-2.6.1-amiga/amiga.doc    Wed Feb  2 13:38:30 1994
  1535. ***************
  1536. *** 0 ****
  1537. --- 1,318 ----
  1538. + GNU Ghostscript 2.6.1 Amiga port, revised 29 January 1994
  1539. + =========================================================
  1540. + This port requires:
  1541. + - An  Amiga  equipped  with  an '020 CPU or any successor CPU model and and
  1542. +   Kickstart 2.04 or higher.
  1543. + - Approx. 4.7 MBytes of hard disk space available.
  1544. + - A  minimum  of 1 MByte of chip memory, depending on what you will want to
  1545. +   do  with  the  interpreter.  Printer output requires at least 2 MBytes of
  1546. +   contiguous memory (any memory, not necessarily chip memory).
  1547. + - ixemul.library and a bunch of Postscript/Ghostscript fonts.
  1548. + New features in the revised v2.6.1 release
  1549. + ------------------------------------------
  1550. + By  public  request  I have recompiled the program to use the built-in math
  1551. + library,  so  you  no  longer need an FPU to run the program. I also took a
  1552. + closer  look  at  the  code  which  tries  to  determine  the  printer page
  1553. + resolution:  you  will  no  longer  have  trouble  with  printers featuring
  1554. + built-in  paper  tractors.  I  tried all printer drivers to be found on the
  1555. + Workbench  disk  to  make  sure the printer support code really works. Good
  1556. + luck!  Some  small  bugs  were  ironed  out and I also took the time to add
  1557. + support  for  another  two  display  drivers  (the  Picasso II driver which
  1558. + requires  the  Picasso  monitor  driver  v2.14  to  work  correctly and the
  1559. + `custom' driver which requires asl.library v38 to be installed). The entire
  1560. + program was recompiled using GCC 2.4.5.
  1561. + New Amiga features in release v2.6.1
  1562. + ------------------------------------
  1563. + The  v2.6.0 port used to implement only monochrome drivers, the v2.6.1 port
  1564. + supports  colour  output on most devices, exceptions where noted. You don't
  1565. + need  a  special  brand  of graphics hardware expansion, colour output will
  1566. + work  on  any  Amiga  model, provided there is enough memory available. All
  1567. + devices capable of doing colour output will reduce the number of colours to
  1568. + be displayed if in dire need of memory. As for the display oriented devices
  1569. + this will go mostly unnoticed as the Ghostscript halftoning algorithms will
  1570. + compensate  for  any  colour reductions. However, printer output quality is
  1571. + very likely to suffer from colour reduction. So, watch out!
  1572. +    As  the display oriented devices start up in colour output mode, black &
  1573. + white  rendering  may  be slightly slowed. The printer device is configured
  1574. + according  to  the  Preferences  settings;  `Black  & white' will result in
  1575. + monochrome  output,  `Grayscale  1'  and  `Grayscale  2'  will also produce
  1576. + monochrome  output  but will internally use a true colour representation of
  1577. + the  page,  so  does  `Color'. Please note that `true colour' refers to the
  1578. + Amiga  12  bit colour model, at this time of writing 24 bit colour printing
  1579. + is not yet implemented.
  1580. +    The  default  output  device  (a  super-bitmap  window  to opened on the
  1581. + default  public  screen,  such  as  Workbench)  will  take advantage of the
  1582. + Kickstart  3.0  pen  sharing  feature  if  enough  colours  (eight or more)
  1583. + are available.
  1584. + The v2.6.0 port used to rely on printer drivers to initialize their maximum
  1585. + page  size  information  upon startup. Several users reported problems with
  1586. + certain  drivers  which  would  make  this information available only after
  1587. + having  been  asked  to do so. The v2.6.1 port now follows the programmers'
  1588. + guidelines  how  to determine the maximum page size closely. The driver may
  1589. + still  complain  if  configured for `Grayscale 1', `Grayscale 2' or `Color'
  1590. + output  and  there  is  not  enough  memory  available  for  the page to be
  1591. + displayed.
  1592. + Installation
  1593. + ------------
  1594. + Enter  the  command  line interpreter, Create a directory on your hard disk
  1595. + drive,  label  it "ghostscript". Let's assume that the fully qualified name
  1596. + of  this  directory  will  be  "Work:ghostscript". Enter this directory and
  1597. + unpack  the  archive  "gs-2.6.1-amiga.lha".  This will create the directory
  1598. + "doc" which contains the Ghostscript documentation files, and the directory
  1599. + "examples" which is to hold some Postscript example files. To add the fonts
  1600. + from  the  Ghostscript distribution (not included in this release) create a
  1601. + directory  called  "Fonts" in the directory "Work:ghostscript" and copy all
  1602. + the  font files into it. You also need the `ixemul.library' included in the
  1603. + Amiga GCC distribution which should be copied to the `Libs:' directory. Now
  1604. + edit your `S:User-Startup' file, adding the following lines:
  1605. +    Assign ghostscript: "Work:ghostscript"
  1606. +    Path ghostscript: add
  1607. + Save the file back to disk and reboot your machine.
  1608. + Running the interpreter
  1609. + -----------------------
  1610. + Enter  the  command  line  interpreter,  type  "gs"  and  press return. The
  1611. + interpreter   will  be  loaded  and  will  try  to  initialize  itself.  If
  1612. + successfully initialized, a window should have been opened on the Workbench
  1613. + screen. The Shell window now should display the following text:
  1614. +    Initializing... done.
  1615. +    Ghostscript 2.6.1 (5/28/93)
  1616. +    Copyright (C) 1990-1993 Aladdin Enterprises, Menlo Park, CA.
  1617. +      All rights reserved.
  1618. +    Ghostscript comes with NO WARRANTY: see the file COPYING for details.
  1619. +    GS>
  1620. + At  the  command  prompt,  enter "(ghostscript:examples/golfer.ps) run" and
  1621. + press  return.  Click  on  the `Zoom' button in the top right corner of the
  1622. + window  to  bring it to full screen size, move the scrollers and watch what
  1623. + will  happen. When rendering is finished, the Shell window will display the
  1624. + following text:
  1625. +    >>showpage, press <return> to continue<<
  1626. + Press  return  to  erase  the  contents  of the window and to continue. The
  1627. + interpreter  will  be  in  interactive  mode  again, enter "quit" and press
  1628. + return to end this session.
  1629. + For  more  information  refer to the documentation in the "ghostscript:doc"
  1630. + drawer.
  1631. + How to print a document
  1632. + -----------------------
  1633. + As the corresponding Ghostscript device will always keep the entire page in
  1634. + memory  the  printer need not be capable of strip-printing. The bad news is
  1635. + that  the  entire page will consume *a lot* of memory. This Amiga port will
  1636. + keep  the page in any public memory area, so it will not necessarily eat up
  1637. + precious chip memory. This should make it possible to print pages on Amigas
  1638. + with  only  1  MByte of chip memory or less, provided enough fast memory is
  1639. + available.
  1640. + Enter  the  command  line interpreter, type "gs -sDEVICE=amiga_printer" and
  1641. + press  return.  This  will  invoke  the  Ghostscript  interpreter  with the
  1642. + "amiga_printer"  device  driver  selected  as  the startup device. When the
  1643. + command prompt appears, enter "(ghostscript:examples/butterfly.ps) run" and
  1644. + press return. The rendered image will be sent to the printer. When printing
  1645. + is finished, press return and enter "quit" to end this session.
  1646. + Note:  unless you want Ghostscript to prompt you to press return after each
  1647. + page  is  printed and ejected you should include "-dNOPAUSE" on the command
  1648. + line.
  1649. + Available device drivers
  1650. + ------------------------
  1651. + This port implements the following nine device drivers:
  1652. +    amiga
  1653. +       (This is the default output device)
  1654. +       Rendering  takes  place  in a super-bitmap window to be opened on the
  1655. +       Workbench  screen.  This  window  contains  scroller  handles to move
  1656. +       around in the bitmap. Usually, the bitmap will be four times as large
  1657. +       as the screen the window opens upon.
  1658. +    amiga_low
  1659. +       Renders into a low-resolution custom screen.
  1660. +    amiga_high
  1661. +       Renders into a high-resolution custom screen.
  1662. +    amiga_super
  1663. +       Renders into a super-high-resolution custom screen.
  1664. +    amiga_a2024¹
  1665. +       Renders into an A2024 resolution custom screen.
  1666. +    amiga_picassoii
  1667. +       Renders  into  a Picasso  II custom  screen (note: a plain  Intuition
  1668. +       custom screen  will be opened, this  driver will not directly  access
  1669. +       the  Picasso II  hardware).  The  Picasso  monitor  driver  v2.14  is
  1670. +       required for this driver to work.
  1671. +    amiga_custom
  1672. +       Unlike   the  other  display  drivers  which  will  open  screens  in
  1673. +       predefined  resolutions  and modes the `amiga_custom' driver will let
  1674. +       you select the display mode to use. On first invocation of the driver
  1675. +       a  screen mode requester will be opened for you to select the display
  1676. +       mode  to use. The name of the display mode selected will be stored in
  1677. +       a local environment variable called "GSCUSTOMMODE". The next time you
  1678. +       run  the  GhostScript  interpreter  with  the  `amiga_custom'  device
  1679. +       selected   the   device   will  try  to  read  the  contents  of  the
  1680. +       "GSCUSTOMMODE"  variable.  The list of screen display modes available
  1681. +       will  be scanned for a mode which name matches the variable. Wildcard
  1682. +       patterns  are  supported,  so  setting "GSCUSTOMMODE" to "#?lowres#?"
  1683. +       will  match  any  screen display mode with the string "lowres" in it,
  1684. +       such  as "NTSC:LowRes", "PAL:LowRes", etc. If you wish, you could set
  1685. +       the  global  environment  variable  "GSCUSTOMMODE" to a special value
  1686. +       which the `amiga_custom' device will always use. Please note that the
  1687. +       screen  mode  requester  will  only  be  opened if no local or global
  1688. +       environment variable "GSCUSTOMMODE" is defined.
  1689. +    amiga_printer
  1690. +       Outputs  pages  on  the  currently  configured  preferences  printer.
  1691. +       Respects density and resolution settings. Requires a lot of memory to
  1692. +       run.
  1693. +    amiga_ilbm¹
  1694. +       Will prompt for a file name to save the current page contents to. The
  1695. +       page  will  be  saved  as  a standard IFF-ILBM picture, including DPI
  1696. +       information,   suitable   for  postprocessing  using  standard  image
  1697. +       processing and editing software.
  1698. +    ¹) Monochrome output only
  1699. + Properties
  1700. + ----------
  1701. + With  Ghostscript  2.6.1 one can specify several driver specific options on
  1702. + the  command  line.  As  for  the Amiga drivers, they support the following
  1703. + properties:
  1704. + - PageWidth and PageHeight
  1705. +   The  dimensions  of  the  page  to  render  into.  The physical page size
  1706. +   Ghostscript  will  use  for  rendering is limited by these dimensions. On
  1707. +   startup  The Amiga drivers will default to a page size roughly equivalent
  1708. +   to A4 unless different dimensions are specified. The size definitions may
  1709. +   include  measuring  units  (e.g. "-sPageWidth=21cm"), the following units
  1710. +   are  supported: pt (points, the default if no unit is given), pc (picas),
  1711. +   in  (inches),  cm  (centimeters), mm (millimeters), dd (didôt points), cc
  1712. +   (ciceros).
  1713. + - OutputFile
  1714. +   The  amiga_ilbm device pays attention to this property, which it will use
  1715. +   to  construct  the  output  file  names for pages to be saved with. Thus,
  1716. +   `-sOutputFile="ram:page"'    yields    the   files   "ram:page0001.ilbm",
  1717. +   "ram:page0002.ilbm", etc.
  1718. + Not all devices will pay attention to DPI page resolutions.
  1719. + Installing fonts
  1720. + ----------------
  1721. + The   Ghostscript  distribution  includes  a  number  of  public-domain  or
  1722. + otherwise  freely  distributable  fonts.  However, these are mostly of poor
  1723. + quality.  In  order  to  install  a  new  font  or to replace a font with a
  1724. + different one, the following steps are required:
  1725. + 1. The  font  must  be  converted  to  Ghostscript format. For font files in
  1726. +    BDF-format  (such  as  the  fonts included in the X-Windows distribution)
  1727. +    this  requires  processing  with  the  "bdftops"  script  file (syntax is
  1728. +    "bdftops <Source file> <Destination file>"). Fonts in standard ASCII text
  1729. +    format (".PFA" format) or packed binary file format (".PFB" format), such
  1730. +    as  most  Adobe-Type-1  hinted outline fonts to be purchased from various
  1731. +    vendors, need  not  be converted as this is the native format Ghostscript
  1732. +    expects.
  1733. + 2. Copy  the resulting output file to the "ghostscript:fonts" drawer, choose
  1734. +    a   suitable   name   (see   the   file  "ghostscript:fontmap"  for  more
  1735. +    information).
  1736. + 3. Edit  the  file "ghostscript:fontmap" to include the font which will make
  1737. +    it visible to the interpreter. Read this file carefully as it gives basic
  1738. +    hints  how  to  name  a  font file and how to edit the corresponding font
  1739. +    entry.
  1740. + The Workbench window
  1741. + --------------------
  1742. + The  default output device (the Workbench window) can be controlled both by
  1743. + mouse and by keyboard:
  1744. +    Cursor  keys  will  move the currently visible area of the page, holding
  1745. +    down  a  Shift  or  Control  key will increase the size of the scrolling
  1746. +    steps.
  1747. +    Control+C  and  Escape  will  send the interpreter a signal to terminate
  1748. +    processing, so does clicking the window close button.
  1749. + By  default  the  page  size  will  always  be  four  times as large as the
  1750. + currently visible portion of the Workbench screen, see the section entitled
  1751. + "Page sizes and resolutions" for more information.
  1752. + Troubleshooting
  1753. + ---------------
  1754. + This  interpreter  implementation  requires a lot of chip memory to run. In
  1755. + order  to  assure that enough memory will be available, close any Workbench
  1756. + drawers  or  Shell  windows  which  are  not necessarily require to run the
  1757. + interpreter.
  1758. + Most  Postscript  documents  use  hard-coded  document page sizes, i.e. the
  1759. + output  page  size  will not be scaled to fit the currently set output page
  1760. + size.  In  these  cases  you may want to make use of the Postscript "scale"
  1761. + operator. Say, you wish to preview the file "butterfly.ps" in just half its
  1762. + size.  Enter  "0.5  dup  scale" and press return, now enter "(butterfly.ps)
  1763. + run"  and  press return; et voilà: the butterfly will be rendered just half
  1764. + as large as usual.
  1765. + Some  documents,  such  as  "porsche.ps",  contain no "showpage" command to
  1766. + finish  the  batch  job.  In this case, type "showpage" and press return or
  1767. + enter "erasepage" and press return to clear the page.
  1768. + About the Amiga port
  1769. + --------------------
  1770. + This  port  is  based  on  Ghostscript  2.6.1. It was implemented using GCC
  1771. + 2.4.5,  so  you  will  have  to refer to the file "COPYING" for copying and
  1772. + licensing information.
  1773. +                       This Amiga port was created by:
  1774. +                            Olaf `Olsen' Barthel
  1775. +                              Brabeckstrasse 35
  1776. +                              D-30559 Hannover
  1777. +                         Federal Republic of Germany
  1778. +                        eMail: olsen@sourcery.han.de
  1779. + The source code is included in the "amiga-src" drawer.
  1780. diff -rc --new-file ghostscript-2.6.1-fsf/bdftops ghostscript-2.6.1-amiga/bdftops
  1781. *** ghostscript-2.6.1-fsf/bdftops    Tue Oct 22 07:12:14 1991
  1782. --- ghostscript-2.6.1-amiga/bdftops    Thu Jan 27 21:39:12 1994
  1783. ***************
  1784. *** 1 ****
  1785. ! gs -q -dNODISPLAY -- bdftops.ps $*
  1786. --- 1,4 ----
  1787. ! .key ARGS/F
  1788. ! .bra {
  1789. ! .ket }
  1790. ! gs -q -dNODISPLAY -- bdftops.ps {ARGS}
  1791. diff -rc --new-file ghostscript-2.6.1-fsf/font2c ghostscript-2.6.1-amiga/font2c
  1792. *** ghostscript-2.6.1-fsf/font2c    Tue Feb 25 10:24:34 1992
  1793. --- ghostscript-2.6.1-amiga/font2c    Thu Jan 27 21:39:30 1994
  1794. ***************
  1795. *** 1 ****
  1796. ! gs -q -dNODISPLAY -dWRITESYSTEMDICT -- font2c.ps $*
  1797. --- 1,4 ----
  1798. ! .key ARGS/F
  1799. ! .bra {
  1800. ! .ket }
  1801. ! gs -q -dNODISPLAY -dWRITESYSTEMDICT -- font2c.ps {ARGS}
  1802. diff -rc --new-file ghostscript-2.6.1-fsf/gdevamiga.c ghostscript-2.6.1-amiga/gdevamiga.c
  1803. *** ghostscript-2.6.1-fsf/gdevamiga.c    Thu Jan  1 00:00:00 1970
  1804. --- ghostscript-2.6.1-amiga/gdevamiga.c    Wed Feb  2 13:21:04 1994
  1805. ***************
  1806. *** 0 ****
  1807. --- 1,5537 ----
  1808. + /* Copyright (C) 1992 Aladdin Enterprises.  All rights reserved.
  1809. +    Distributed by Free Software Foundation, Inc.
  1810. + This file is part of Ghostscript.
  1811. + Ghostscript is distributed in the hope that it will be useful, but
  1812. + WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  1813. + to anyone for the consequences of using it or for whether it serves any
  1814. + particular purpose or works at all, unless he says so in writing.  Refer
  1815. + to the Ghostscript General Public License for full details.
  1816. + Everyone is granted permission to copy, modify and redistribute
  1817. + Ghostscript, but only under the conditions described in the Ghostscript
  1818. + General Public License.  A copy of this license is supposed to have been
  1819. + given to you along with Ghostscript so you can know your rights and
  1820. + responsibilities.  It should be in a file named COPYING.  Among other
  1821. + things, the copyright notice and this notice must be preserved on all
  1822. + copies.  */
  1823. + /* gdevamiga.c */
  1824. + /* Amiga driver for Ghostscript library, requires Kickstart 2.04 or higher */
  1825. + /* Written by Olaf `Olsen' Barthel, last change 29 January 1994
  1826. +  *
  1827. +  * My address:   Olaf Barthel
  1828. +  *               Brabeckstrasse 35
  1829. +  *             D-30559 Hannover
  1830. +  *
  1831. +  *      eMail:   olsen@sourcery.han.de
  1832. +  */
  1833. + #define CheckIO foo123
  1834. + #define ushort foo
  1835. + #include <intuition/intuitionbase.h>
  1836. + #include <intuition/gadgetclass.h>
  1837. + #include <intuition/imageclass.h>
  1838. + #include <intuition/icclass.h>
  1839. + #include <graphics/displayinfo.h>
  1840. + #include <libraries/iffparse.h>
  1841. + #include <graphics/gfxbase.h>
  1842. + #include <devices/printer.h>
  1843. + #include <devices/prtbase.h>
  1844. + #include <devices/prtgfx.h>
  1845. + #include <libraries/asl.h>
  1846. + #include <exec/memory.h>
  1847. + #include <clib/macros.h>
  1848. + #include <dos/dostags.h>
  1849. + #include <dos/rdargs.h>
  1850. + #include <dos/var.h>
  1851. + #include <dos/dos.h>
  1852. + #include <clib/intuition_protos.h>
  1853. + #include <clib/graphics_protos.h>
  1854. + #include <clib/iffparse_protos.h>
  1855. + #include <clib/utility_protos.h>
  1856. + #include <clib/layers_protos.h>
  1857. + #include <clib/exec_protos.h>
  1858. + #include <clib/dos_protos.h>
  1859. + #include <clib/asl_protos.h>
  1860. + /*
  1861. + #include <inline/stubs.h>
  1862. + #include <inline/iffparse.h>
  1863. + #include <inline/utility.h>
  1864. + #include <inline/exec.h>
  1865. + #include <inline/dos.h>
  1866. + */
  1867. + #include <string.h>
  1868. + #include <signal.h>
  1869. + #undef ushort
  1870. + #undef CheckIO
  1871. + struct IORequest *CheckIO(struct IORequest *);
  1872. + #include "gx.h"        /* for gx_bitmap; includes std.h */
  1873. + #include "gsmatrix.h"    /* needed for gxdevice.h */
  1874. + #include "gxdevice.h"
  1875. + #include "gserrors.h"
  1876. + #include "gsprops.h"
  1877. +     /* Here is how to select a default page size format:
  1878. +      *
  1879. +      * Either enter include a line such as
  1880. +      *
  1881. +      *   #define AMIGA_PAGE_A4 1
  1882. +      *
  1883. +      * Somewhere above in this module, or edit the makefile
  1884. +      * to feature the option
  1885. +      *
  1886. +      *   -dAMIGA_PAGE_A4
  1887. +      *
  1888. +      * among the device specific flags. Available default page
  1889. +      * size formats are:
  1890. +      *
  1891. +      *   AMIGA_PAGE_A4         European A4 page size (default)
  1892. +      *   AMIGA_PAGE_A3         European A3 page size
  1893. +      *   AMIGA_PAGE_LETTER     US letter page size
  1894. +      *   AMIGA_PAGE_LEGAL      US legal page size
  1895. +      *   AMIGA_PAGE_LEDGER     US ledger paper size
  1896. +      *   AMIGA_PAGE_TABLOID    US tabloid paper size
  1897. +      */
  1898. +     /* Select the default paper size if none specified. */
  1899. + #if !defined(AMIGA_PAGE_A4) && !defined(AMIGA_PAGE_A3) && !defined(AMIGA_PAGE_LETTER) && !defined(AMIGA_PAGE_LEGAL) && !defined(AMIGA_PAGE_LEDGER) && !defined(AMIGA_PAGE_TABLOID)
  1900. + /*#define AMIGA_PAGE_A4 1*/
  1901. + #define AMIGA_PAGE_A3 1
  1902. + #endif    /* PAGE SIZE */
  1903. +     /* A4 page size (in inches!) */
  1904. + #ifdef AMIGA_PAGE_A4
  1905. + #define DEFAULT_WIDTH        8.2
  1906. + #define DEFAULT_HEIGHT        11.6
  1907. + #endif    /* AMIGA_PAGE_A4 */
  1908. +     /* A3 page size */
  1909. + #ifdef AMIGA_PAGE_A3
  1910. + #define DEFAULT_WIDTH        11.6
  1911. + #define DEFAULT_HEIGHT        16.5
  1912. + #endif    /* AMIGA_PAGE_A4 */
  1913. +     /* US letter page size */
  1914. + #ifdef AMIGA_PAGE_LETTER
  1915. + #define DEFAULT_WIDTH        8.5
  1916. + #define DEFAULT_HEIGHT        11.0
  1917. + #endif    /* AMIGA_PAGE_LETTER */
  1918. +     /* US legal page size */
  1919. + #ifdef AMIGA_PAGE_LEGAL
  1920. + #define DEFAULT_WIDTH        8.5
  1921. + #define DEFAULT_HEIGHT        14.0
  1922. + #endif    /* AMIGA_PAGE_LEGAL */
  1923. +     /* US ledger page size */
  1924. + #ifdef AMIGA_PAGE_LEDGER
  1925. + #define DEFAULT_WIDTH        16.0
  1926. + #define DEFAULT_HEIGHT        11.0
  1927. + #endif    /* AMIGA_PAGE_LEDGER */
  1928. +     /* US tabloid page size */
  1929. + #ifdef AMIGA_PAGE_TABLOID
  1930. + #define DEFAULT_WIDTH        11.0
  1931. + #define DEFAULT_HEIGHT        17.0
  1932. + #endif    /* AMIGA_PAGE_LEDGER */
  1933. +     /* Default output file name. */
  1934. + #define DEFAULT_FILENAME    "gs_page"
  1935. +     /* Turn a byte into a 24 bit colour value. */
  1936. + #define SPREAD(i)    ((ULONG)(i) << 24 | (ULONG)(i) << 16 | (ULONG)(i) << 8 | (i))
  1937. +     /* Scroller gadget IDs. */
  1938. + enum    {    VERTICAL_SCROLLER,    HORIZONTAL_SCROLLER,
  1939. +         UP_ARROW,        DOWN_ARROW,
  1940. +         LEFT_ARROW,        RIGHT_ARROW,
  1941. +         GADGET_COUNT };
  1942. +     /* Scroller arrow IDs. */
  1943. + enum    {    UP_IMAGE,        DOWN_IMAGE,
  1944. +         LEFT_IMAGE,        RIGHT_IMAGE,
  1945. +         IMAGE_COUNT };
  1946. +     /* Codes for the MoveAround() routine. */
  1947. + enum    {    MOVE_MIN,MOVE_FAR_DOWN,MOVE_DOWN,MOVE_UP,MOVE_FAR_UP,MOVE_MAX };
  1948. +     /* Some handy bit masks. */
  1949. + #define SIG_KILL    SIGBREAKF_CTRL_C
  1950. + #define SIG_HANDSHAKE    SIGF_SINGLE
  1951. +     /* Static dimensions of scroller arrows. */
  1952. + #define ARROW_WIDTH    16
  1953. + #define ARROW_HEIGHT    11
  1954. +     /* The `Help' key raw code. */
  1955. + #define HELP_CODE    95
  1956. +     /* Minimum window inner area dimension. */
  1957. + #define MINIMUM_WIDTH    64
  1958. + #define MINIMUM_HEIGHT    32
  1959. +     /* Handy superbitmap window macros. */
  1960. + #define LAYERXOFFSET(w)    ((w) -> RPort -> Layer -> Scroll_X)
  1961. + #define LAYERYOFFSET(w)    ((w) -> RPort -> Layer -> Scroll_Y)
  1962. +     /* User input to listen to. */
  1963. + #define IDCMP_FLAGS    (IDCMP_IDCMPUPDATE | IDCMP_GADGETUP | IDCMP_GADGETDOWN | IDCMP_MOUSEMOVE | IDCMP_NEWSIZE | IDCMP_CLOSEWINDOW | IDCMP_VANILLAKEY | IDCMP_RAWKEY)
  1964. +     /* Chunk IDs. */
  1965. + #define ID_ILBM        MAKE_ID('I','L','B','M')
  1966. + #define ID_BMHD        MAKE_ID('B','M','H','D')
  1967. + #define ID_CMAP        MAKE_ID('C','M','A','P')
  1968. + #define ID_CAMG        MAKE_ID('C','A','M','G')
  1969. + #define ID_ANNO        MAKE_ID('A','N','N','O')
  1970. + #define ID_DPI        MAKE_ID('D','P','I',' ')
  1971. + #define ID_BODY        MAKE_ID('B','O','D','Y')
  1972. +     /* Chunk contents definitions. */
  1973. + typedef struct
  1974. + {
  1975. +     UWORD        w,h;            /* raster width & height in pixels */
  1976. +     WORD        x,y;            /* position for this image */
  1977. +     UBYTE        nPlanes;        /* # source bitplanes */
  1978. +     UBYTE        masking;        /* masking technique */
  1979. +     UBYTE        compression;        /* compression algoithm */
  1980. +     UBYTE        pad1;            /* UNUSED.  For consistency, put 0 here.*/
  1981. +     UWORD        transparentColor;    /* transparent "color number" */
  1982. +     UBYTE        xAspect,yAspect;    /* aspect ratio, a rational number x/y */
  1983. +     WORD        pageWidth,pageHeight;    /* source "page" size in pixels */
  1984. + } BitMapHeader;
  1985. + typedef struct
  1986. + {
  1987. +     UWORD        dpi_x;
  1988. +     UWORD        dpi_y;
  1989. + } DPIHeader;
  1990. +     /* Packer modes. */
  1991. + #define DUMP        0
  1992. + #define RUN        1
  1993. +     /* Minimum data run size, maximum data run size and maximum cache size. */
  1994. + #define MINRUN        3
  1995. + #define MAXRUN        128
  1996. + #define MAXDAT        128
  1997. +     /* This module actually implements four different Amiga based
  1998. +      * devices. As the rendering operations are all the same,
  1999. +      * one single device definition is sufficient.
  2000. +      */
  2001. + typedef struct gx_device_amiga
  2002. + {
  2003. +     gx_device_common;
  2004. +     struct Screen    *screen;    /* Any screen */
  2005. +     struct Window    *window;    /* Some window to be opened on the Workbench screen */
  2006. +     LONG         super_width,    /* Superbitmap width */
  2007. +              super_height;    /* Superbitmap height */
  2008. +     struct BitMap    *super_bitmap;    /* Window superbitmap area */
  2009. +     struct Gadget    **gadget;    /* Scroller gadgets */
  2010. +     struct Image    **image;    /* Scroller arrow images */
  2011. +     struct Task    *dispatcher;    /* Slider dispatch task */
  2012. +     struct Process    *main;        /* Main program */
  2013. +     struct RastPort    *rport;        /* Rendering area */
  2014. +     struct IODRPReq *printer;    /* Printer interface data */
  2015. +     struct MsgPort    *port;        /* Printer io data */
  2016. +     struct ColorMap    *colormap;    /* A black/white colour map */
  2017. +     struct BitMap    *bitmap;    /* Rendering bitmap data */
  2018. +     PLANEPTR     bitplane;    /* Rendering raster */
  2019. +     gx_color_index     last_pen;    /* The last colour set */
  2020. +     float         page_width,    /* The page width */
  2021. +              page_height;    /* The page height */
  2022. +     char         file_name[256];/* The output file name */
  2023. +     int         page_count;    /* The page number counter */
  2024. +     int         cube_size;    /* Colour cube size, 0 for b/w */
  2025. +     struct RastPort    *temp_rport;    /* Temporary raster port for pixmap imaging. */
  2026. +     UBYTE        *temp_array;    /* Temporary colour manipulation array. */
  2027. +     LONG        *pens;
  2028. + } gx_device_amiga;
  2029. +     /* Function prototypes */
  2030. + VOID            set_mono_device(gx_device_amiga *dev);
  2031. + VOID            set_colour_device(gx_device_amiga *dev,int cube_size,LONG *pens);
  2032. + VOID            set_colour_printer_device(gx_device_amiga *dev,LONG CubeSize);
  2033. + VOID            DeleteBitMap(struct BitMap *BitMap,BOOL Private);
  2034. + struct BitMap *        CreateBitMap(LONG Width,LONG Height,LONG Depth,ULONG Flags,struct BitMap *Friend,BOOL Private);
  2035. + VOID            DeleteTempRPort(struct RastPort *Temp);
  2036. + struct RastPort *    CreateTempRPort(struct RastPort *Source);
  2037. + LONG            Euclid(LONG a,LONG b);
  2038. + BYTE *            PutDump(register BYTE *Destination,register LONG Count);
  2039. + BYTE *            PutRun(register BYTE *Destination,LONG Count,WORD Char);
  2040. + LONG            PackRow(PLANEPTR *SourcePtr,register BYTE *Destination,LONG RowSize);
  2041. + BOOL            PutBODY(struct IFFHandle *Handle,struct BitMap *BitMap);
  2042. + BOOL            PutANNO(struct IFFHandle *Handle);
  2043. + BOOL            PutCAMG(struct IFFHandle *Handle);
  2044. + BOOL            PutCMAP(struct IFFHandle *Handle);
  2045. + BOOL            PutDPI(struct IFFHandle *Handle,UWORD X_DPI,UWORD Y_DPI);
  2046. + BOOL            PutBMHD(struct IFFHandle *Handle,LONG Width,LONG Height,UWORD X_DPI,UWORD Y_DPI);
  2047. + BOOL            SaveBitMap(STRPTR Name,struct BitMap *BitMap,LONG Width,LONG Height,UWORD X_DPI,UWORD Y_DPI);
  2048. + float            GetInches(STRPTR Buffer);
  2049. + VOID            DispatchTask(VOID);
  2050. + VOID            DeleteScrollers(gx_device *dev);
  2051. + BOOL            CreateScrollers(gx_device *dev,struct Screen *Screen);
  2052. + VOID            WindowResize(gx_device *dev);
  2053. + VOID            WindowUpdate(struct Gadget *Gadget,gx_device *dev);
  2054. + VOID            MoveAround(struct Gadget *Gadget,LONG How,gx_device *dev);
  2055. + VOID            DispatchSuperWindow(gx_device *dev);
  2056. + void            devcleanup(VOID);
  2057. + gx_color_index        amiga_map_rgb_color(gx_device *dev,gx_color_value red,gx_color_value green,gx_color_value blue);
  2058. + int            amiga_map_color_rgb(gx_device *dev,gx_color_index color,gx_color_value rgb[3]);
  2059. + LONG *            AllocatePens(struct ViewPort *VPort,LONG CubeSize);
  2060. + int            amiga_open_default(gx_device *dev);
  2061. + int            amiga_open_low(gx_device *dev);
  2062. + int            amiga_open_high(gx_device *dev);
  2063. + int            amiga_open_super(gx_device *dev);
  2064. + int            amiga_open_a2024(gx_device *dev);
  2065. + int            amiga_open_picassoii(gx_device *dev);
  2066. + int            amiga_open_custom(gx_device *dev);
  2067. + int            amiga_open_printer(gx_device *dev);
  2068. + int            amiga_output_page_printer(gx_device *dev,int num_copies,int flush);
  2069. + int            amiga_close_printer(gx_device *dev);
  2070. + int            amiga_get_bits(gx_device *dev,int y,byte *str,byte **actual_data);
  2071. + int            amiga_open(gx_device *dev,ULONG Mode);
  2072. + int            amiga_output_page(gx_device *dev,int num_copies,int flush);
  2073. + int            amiga_close(gx_device *dev);
  2074. + int            amiga_fill_rectangle(gx_device *dev,int x,int y,int w,int h,gx_color_index color);
  2075. + int            amiga_copy_mono(gx_device *dev,const UBYTE *base,int sourcex,int raster,gx_bitmap_id id,int x,int y,int w,int h,gx_color_index zero,gx_color_index one);
  2076. + int            amiga_copy_color(gx_device *dev,const UBYTE *base,int sourcex,int raster,gx_bitmap_id id,int x,int y,int w,int h);
  2077. + int            amiga_draw_line(gx_device *dev,int x0,int y0,int x1,int y1,gx_color_index color);
  2078. + int            amiga_copy_mono_raw(gx_device *dev,const UBYTE *base,int sourcex,int raster,gx_bitmap_id id,int x,int y,int w,int h,gx_color_index zero,gx_color_index one);
  2079. + int            amiga_copy_color_raw(gx_device *dev,const UBYTE *base,int sourcex,int raster,gx_bitmap_id id,int x,int y,int w,int h);
  2080. + int            amiga_fill_rectangle_raw(gx_device *dev,int x,int y,int w,int h,gx_color_index color);
  2081. + int            amiga_draw_line_raw(gx_device *dev,int x,int y,int x1,int y1,gx_color_index color);
  2082. + int            amiga_open_ilbm(gx_device *dev);
  2083. + int            amiga_output_page_ilbm(gx_device *dev,int num_copies,int flush);
  2084. + int            amiga_close_ilbm(gx_device *dev);
  2085. + int            amiga_get_props(gx_device *dev,gs_prop_item *plist);
  2086. + int            amiga_put_props(gx_device *dev,gs_prop_item *plist,int count);
  2087. + gx_color_index        amiga_color_map_rgb_color(gx_device *dev,gx_color_value red,gx_color_value green,gx_color_value blue);
  2088. + int            amiga_color_map_color_rgb(gx_device *dev,gx_color_index color,gx_color_value rgb[3]);
  2089. + gx_color_index        amiga_color_map_rgb_color_pen(gx_device *dev,gx_color_value red,gx_color_value green,gx_color_value blue);
  2090. + int            amiga_color_map_color_rgb_pen(gx_device *dev,gx_color_index color,gx_color_value rgb[3]);
  2091. + int            amiga_copy_color8(gx_device *dev,const UBYTE *base,int sourcex,int raster,gx_bitmap_id id,int x,int y,int w,int h);
  2092. + int            amiga_copy_mono_raw_color(gx_device *dev,const UBYTE *base,int sourcex,int raster,gx_bitmap_id id,int x,int y,int w,int h,gx_color_index zero,gx_color_index one);
  2093. + int            amiga_copy_color_raw_color16(gx_device *dev,const UBYTE *data,int sourcex,int raster,gx_bitmap_id id,int x,int y,int w,int h);
  2094. + int            amiga_fill_rectangle_raw_color(gx_device *dev,int x,int y,int w,int h,gx_color_index color);
  2095. + int            amiga_draw_line_raw_color(gx_device *dev,int x,int y,int x1,int y1,gx_color_index color);
  2096. +     /* External reference to some libraries, required for version checking, etc. */
  2097. + extern struct GfxBase *GfxBase;
  2098. + extern struct Library *AslBase;
  2099. +     /* Number of packed bytes and pack buffer. */
  2100. + LONG    PackedBytes;
  2101. + BYTE    Buffer[MAXDAT + 1];
  2102. +     /* Bit masks. */
  2103. + STATIC UBYTE    shift[8] = { 128, 64, 32, 16,  8,  4,  2,  1 },
  2104. +         masks[8] = { 127,191,223,239,247,251,253,254 };
  2105. +     /* Device routine jump tables */
  2106. + STATIC gx_device_procs amiga_default_procs =
  2107. + {
  2108. +     amiga_open_default,
  2109. +     gx_default_get_initial_matrix,
  2110. +     gx_default_sync_output,
  2111. +     amiga_output_page,
  2112. +     amiga_close,
  2113. +     amiga_map_rgb_color,
  2114. +     amiga_map_color_rgb,
  2115. +     amiga_fill_rectangle,
  2116. +     gx_default_tile_rectangle,
  2117. +     amiga_copy_mono,
  2118. +     amiga_copy_color,
  2119. +     amiga_draw_line,
  2120. +     gx_default_get_bits,
  2121. +     amiga_get_props,
  2122. +     amiga_put_props
  2123. + };
  2124. + STATIC gx_device_procs amiga_low_procs =
  2125. + {
  2126. +     amiga_open_low,
  2127. +     gx_default_get_initial_matrix,
  2128. +     gx_default_sync_output,
  2129. +     amiga_output_page,
  2130. +     amiga_close,
  2131. +     amiga_map_rgb_color,
  2132. +     amiga_map_color_rgb,
  2133. +     amiga_fill_rectangle,
  2134. +     gx_default_tile_rectangle,
  2135. +     amiga_copy_mono,
  2136. +     amiga_copy_color,
  2137. +     amiga_draw_line,
  2138. +     gx_default_get_bits,
  2139. +     amiga_get_props,
  2140. +     amiga_put_props
  2141. + };
  2142. + STATIC gx_device_procs amiga_high_procs =
  2143. + {
  2144. +     amiga_open_high,
  2145. +     gx_default_get_initial_matrix,
  2146. +     gx_default_sync_output,
  2147. +     amiga_output_page,
  2148. +     amiga_close,
  2149. +     amiga_map_rgb_color,
  2150. +     amiga_map_color_rgb,
  2151. +     amiga_fill_rectangle,
  2152. +     gx_default_tile_rectangle,
  2153. +     amiga_copy_mono,
  2154. +     amiga_copy_color,
  2155. +     amiga_draw_line,
  2156. +     gx_default_get_bits,
  2157. +     amiga_get_props,
  2158. +     amiga_put_props
  2159. + };
  2160. + STATIC gx_device_procs amiga_super_procs =
  2161. + {
  2162. +     amiga_open_super,
  2163. +     gx_default_get_initial_matrix,
  2164. +     gx_default_sync_output,
  2165. +     amiga_output_page,
  2166. +     amiga_close,
  2167. +     amiga_map_rgb_color,
  2168. +     amiga_map_color_rgb,
  2169. +     amiga_fill_rectangle,
  2170. +     gx_default_tile_rectangle,
  2171. +     amiga_copy_mono,
  2172. +     amiga_copy_color,
  2173. +     amiga_draw_line,
  2174. +     gx_default_get_bits,
  2175. +     amiga_get_props,
  2176. +     amiga_put_props
  2177. + };
  2178. + STATIC gx_device_procs amiga_a2024_procs =
  2179. + {
  2180. +     amiga_open_a2024,
  2181. +     gx_default_get_initial_matrix,
  2182. +     gx_default_sync_output,
  2183. +     amiga_output_page,
  2184. +     amiga_close,
  2185. +     amiga_map_rgb_color,
  2186. +     amiga_map_color_rgb,
  2187. +     amiga_fill_rectangle,
  2188. +     gx_default_tile_rectangle,
  2189. +     amiga_copy_mono,
  2190. +     amiga_copy_color,
  2191. +     amiga_draw_line,
  2192. +     gx_default_get_bits,
  2193. +     amiga_get_props,
  2194. +     amiga_put_props
  2195. + };
  2196. + STATIC gx_device_procs amiga_picassoii_procs =
  2197. + {
  2198. +     amiga_open_picassoii,
  2199. +     gx_default_get_initial_matrix,
  2200. +     gx_default_sync_output,
  2201. +     amiga_output_page,
  2202. +     amiga_close,
  2203. +     amiga_map_rgb_color,
  2204. +     amiga_map_color_rgb,
  2205. +     amiga_fill_rectangle,
  2206. +     gx_default_tile_rectangle,
  2207. +     amiga_copy_mono,
  2208. +     amiga_copy_color,
  2209. +     amiga_draw_line,
  2210. +     gx_default_get_bits,
  2211. +     amiga_get_props,
  2212. +     amiga_put_props
  2213. + };
  2214. + STATIC gx_device_procs amiga_custom_procs =
  2215. + {
  2216. +     amiga_open_custom,
  2217. +     gx_default_get_initial_matrix,
  2218. +     gx_default_sync_output,
  2219. +     amiga_output_page,
  2220. +     amiga_close,
  2221. +     amiga_map_rgb_color,
  2222. +     amiga_map_color_rgb,
  2223. +     amiga_fill_rectangle,
  2224. +     gx_default_tile_rectangle,
  2225. +     amiga_copy_mono,
  2226. +     amiga_copy_color,
  2227. +     amiga_draw_line,
  2228. +     gx_default_get_bits,
  2229. +     amiga_get_props,
  2230. +     amiga_put_props
  2231. + };
  2232. + STATIC gx_device_procs amiga_printer_procs =
  2233. + {
  2234. +     amiga_open_printer,
  2235. +     gx_default_get_initial_matrix,
  2236. +     gx_default_sync_output,
  2237. +     amiga_output_page_printer,
  2238. +     amiga_close_printer,
  2239. +     amiga_map_rgb_color,
  2240. +     amiga_map_color_rgb,
  2241. +     amiga_fill_rectangle_raw,
  2242. +     gx_default_tile_rectangle,
  2243. +     amiga_copy_mono_raw,
  2244. +     amiga_copy_color_raw,
  2245. +     amiga_draw_line_raw,
  2246. +     amiga_get_bits,
  2247. +     amiga_get_props,
  2248. +     amiga_put_props
  2249. + };
  2250. + STATIC gx_device_procs amiga_ilbm_procs =
  2251. + {
  2252. +     amiga_open_ilbm,
  2253. +     gx_default_get_initial_matrix,
  2254. +     gx_default_sync_output,
  2255. +     amiga_output_page_ilbm,
  2256. +     amiga_close_ilbm,
  2257. +     amiga_map_rgb_color,
  2258. +     amiga_map_color_rgb,
  2259. +     amiga_fill_rectangle_raw,
  2260. +     gx_default_tile_rectangle,
  2261. +     amiga_copy_mono_raw,
  2262. +     amiga_copy_color_raw,
  2263. +     amiga_draw_line_raw,
  2264. +     amiga_get_bits,
  2265. +     amiga_get_props,
  2266. +     amiga_put_props
  2267. + };
  2268. +     /* Default device: opens a window on the Workbench screen and renders into it */
  2269. + gx_device_amiga gs_amiga_device =
  2270. + {
  2271. +     sizeof(gx_device_amiga),    /* params_size */
  2272. +     &amiga_default_procs,        /* procs */
  2273. +     "amiga",            /* dname */
  2274. +     0, 0,                /* width, height */
  2275. +     72.27, 72.27,            /* xdpi, ydpi */
  2276. +     no_margins,            /* margins */
  2277. +     dci_black_and_white,        /* color info */
  2278. +     0,                /* is_open */
  2279. +     NULL,                /* screen */
  2280. +     NULL,                /* window */
  2281. +     0,                /* super_width */
  2282. +     0,                /* super_height */
  2283. +     NULL,                /* super_bitmap */
  2284. +     NULL,                /* gadget */
  2285. +     NULL,                /* image */
  2286. +     NULL,                /* dispatcher */
  2287. +     NULL,                /* main */
  2288. +     NULL,                /* rport */
  2289. +     NULL,                /* printer */
  2290. +     NULL,                /* port */
  2291. +     NULL,                /* colormap */
  2292. +     NULL,                /* bitmap */
  2293. +     NULL,                /* bitplane */
  2294. +     1,                /* last_pen */
  2295. +     DEFAULT_WIDTH,            /* page width */
  2296. +     DEFAULT_HEIGHT,            /* page height */
  2297. +     DEFAULT_FILENAME,        /* output file */
  2298. +     1,                /* page counter */
  2299. +     0,                /* cube_size */
  2300. +     NULL,                /* temp_rport */
  2301. +     NULL,                /* temp_array */
  2302. +     NULL                /* pens */
  2303. + };
  2304. +     /* Low resolution device: opens a lores custom screen and renders into it */
  2305. + gx_device_amiga gs_amiga_low_device =
  2306. + {
  2307. +     sizeof(gx_device_amiga),    /* params_size */
  2308. +     &amiga_low_procs,        /* procs */
  2309. +     "amiga_low",            /* dname */
  2310. +     0, 0,                /* width, height */
  2311. +     72.27, 72.27,            /* xdpi, ydpi */
  2312. +     no_margins,            /* margins */
  2313. +     dci_black_and_white,        /* color info */
  2314. +     0,                /* is_open */
  2315. +     NULL,                /* screen */
  2316. +     NULL,                /* window */
  2317. +     0,                /* super_width */
  2318. +     0,                /* super_height */
  2319. +     NULL,                /* super_bitmap */
  2320. +     NULL,                /* gadget */
  2321. +     NULL,                /* image */
  2322. +     NULL,                /* dispatcher */
  2323. +     NULL,                /* main */
  2324. +     NULL,                /* rport */
  2325. +     NULL,                /* printer */
  2326. +     NULL,                /* port */
  2327. +     NULL,                /* colormap */
  2328. +     NULL,                /* bitmap */
  2329. +     NULL,                /* bitplane */
  2330. +     1,                /* last_pen */
  2331. +     DEFAULT_WIDTH,            /* page width */
  2332. +     DEFAULT_HEIGHT,            /* page height */
  2333. +     DEFAULT_FILENAME,        /* output file */
  2334. +     1,                /* page counter */
  2335. +     0,                /* cube_size */
  2336. +     NULL,                /* temp_rport */
  2337. +     NULL,                /* temp_array */
  2338. +     NULL                /* pens */
  2339. + };
  2340. +     /* High resolution device: opens a highres-interlaced custom screen */
  2341. + gx_device_amiga gs_amiga_high_device =
  2342. + {
  2343. +     sizeof(gx_device_amiga),    /* params_size */
  2344. +     &amiga_high_procs,        /* procs */
  2345. +     "amiga_high",            /* dname */
  2346. +     0, 0,                /* width, height */
  2347. +     72.27, 72.27,            /* xdpi, ydpi */
  2348. +     no_margins,            /* margins */
  2349. +     dci_black_and_white,        /* color info */
  2350. +     0,                /* is_open */
  2351. +     NULL,                /* screen */
  2352. +     NULL,                /* window */
  2353. +     0,                /* super_width */
  2354. +     0,                /* super_height */
  2355. +     NULL,                /* super_bitmap */
  2356. +     NULL,                /* gadget */
  2357. +     NULL,                /* image */
  2358. +     NULL,                /* dispatcher */
  2359. +     NULL,                /* main */
  2360. +     NULL,                /* rport */
  2361. +     NULL,                /* printer */
  2362. +     NULL,                /* port */
  2363. +     NULL,                /* colormap */
  2364. +     NULL,                /* bitmap */
  2365. +     NULL,                /* bitplane */
  2366. +     1,                /* last_pen */
  2367. +     DEFAULT_WIDTH,            /* page width */
  2368. +     DEFAULT_HEIGHT,            /* page height */
  2369. +     DEFAULT_FILENAME,        /* output file */
  2370. +     1,                /* page counter */
  2371. +     0,                /* cube_size */
  2372. +     NULL,                /* temp_rport */
  2373. +     NULL,                /* temp_array */
  2374. +     NULL                /* pens */
  2375. + };
  2376. +     /* Super high resolution device: opens a super-highres-interlaced custom screen */
  2377. + gx_device_amiga gs_amiga_super_device =
  2378. + {
  2379. +     sizeof(gx_device_amiga),    /* params_size */
  2380. +     &amiga_super_procs,        /* procs */
  2381. +     "amiga_super",            /* dname */
  2382. +     0, 0,                /* width, height */
  2383. +     72.27, 72.27,            /* xdpi, ydpi */
  2384. +     no_margins,            /* margins */
  2385. +     dci_black_and_white,        /* color info */
  2386. +     0,                /* is_open */
  2387. +     NULL,                /* screen */
  2388. +     NULL,                /* window */
  2389. +     0,                /* super_width */
  2390. +     0,                /* super_height */
  2391. +     NULL,                /* super_bitmap */
  2392. +     NULL,                /* gadget */
  2393. +     NULL,                /* image */
  2394. +     NULL,                /* dispatcher */
  2395. +     NULL,                /* main */
  2396. +     NULL,                /* rport */
  2397. +     NULL,                /* printer */
  2398. +     NULL,                /* port */
  2399. +     NULL,                /* colormap */
  2400. +     NULL,                /* bitmap */
  2401. +     NULL,                /* bitplane */
  2402. +     1,                /* last_pen */
  2403. +     DEFAULT_WIDTH,            /* page width */
  2404. +     DEFAULT_HEIGHT,            /* page height */
  2405. +     DEFAULT_FILENAME,        /* output file */
  2406. +     1,                /* page counter */
  2407. +     0,                /* cube_size */
  2408. +     NULL,                /* temp_rport */
  2409. +     NULL,                /* temp_array */
  2410. +     NULL                /* pens */
  2411. + };
  2412. +     /* A2024 device: opens an A2024 custom screen */
  2413. + gx_device_amiga gs_amiga_a2024_device =
  2414. + {
  2415. +     sizeof(gx_device_amiga),    /* params_size */
  2416. +     &amiga_a2024_procs,        /* procs */
  2417. +     "amiga_a2024",            /* dname */
  2418. +     0, 0,                /* width, height */
  2419. +     72.27, 72.27,            /* xdpi, ydpi */
  2420. +     no_margins,            /* margins */
  2421. +     dci_black_and_white,        /* color info */
  2422. +     0,                /* is_open */
  2423. +     NULL,                /* screen */
  2424. +     NULL,                /* window */
  2425. +     0,                /* super_width */
  2426. +     0,                /* super_height */
  2427. +     NULL,                /* super_bitmap */
  2428. +     NULL,                /* gadget */
  2429. +     NULL,                /* image */
  2430. +     NULL,                /* dispatcher */
  2431. +     NULL,                /* main */
  2432. +     NULL,                /* rport */
  2433. +     NULL,                /* printer */
  2434. +     NULL,                /* port */
  2435. +     NULL,                /* colormap */
  2436. +     NULL,                /* bitmap */
  2437. +     NULL,                /* bitplane */
  2438. +     1,                /* last_pen */
  2439. +     DEFAULT_WIDTH,            /* page width */
  2440. +     DEFAULT_HEIGHT,            /* page height */
  2441. +     DEFAULT_FILENAME,        /* output file */
  2442. +     1,                /* page counter */
  2443. +     0,                /* cube_size */
  2444. +     NULL,                /* temp_rport */
  2445. +     NULL,                /* temp_array */
  2446. +     NULL                /* pens */
  2447. + };
  2448. +     /* Picasso II device: opens a Picasso II custom screen */
  2449. + gx_device_amiga gs_amiga_picassoii_device =
  2450. + {
  2451. +     sizeof(gx_device_amiga),    /* params_size */
  2452. +     &amiga_picassoii_procs,        /* procs */
  2453. +     "amiga_picassoii",        /* dname */
  2454. +     0, 0,                /* width, height */
  2455. +     72.27, 72.27,            /* xdpi, ydpi */
  2456. +     no_margins,            /* margins */
  2457. +     dci_black_and_white,        /* color info */
  2458. +     0,                /* is_open */
  2459. +     NULL,                /* screen */
  2460. +     NULL,                /* window */
  2461. +     0,                /* super_width */
  2462. +     0,                /* super_height */
  2463. +     NULL,                /* super_bitmap */
  2464. +     NULL,                /* gadget */
  2465. +     NULL,                /* image */
  2466. +     NULL,                /* dispatcher */
  2467. +     NULL,                /* main */
  2468. +     NULL,                /* rport */
  2469. +     NULL,                /* printer */
  2470. +     NULL,                /* port */
  2471. +     NULL,                /* colormap */
  2472. +     NULL,                /* bitmap */
  2473. +     NULL,                /* bitplane */
  2474. +     1,                /* last_pen */
  2475. +     DEFAULT_WIDTH,            /* page width */
  2476. +     DEFAULT_HEIGHT,            /* page height */
  2477. +     DEFAULT_FILENAME,        /* output file */
  2478. +     1,                /* page counter */
  2479. +     0,                /* cube_size */
  2480. +     NULL,                /* temp_rport */
  2481. +     NULL,                /* temp_array */
  2482. +     NULL                /* pens */
  2483. + };
  2484. +     /* Custom device: opens a custom screen, will ask for screen mode or check env variable. */
  2485. + gx_device_amiga gs_amiga_custom_device =
  2486. + {
  2487. +     sizeof(gx_device_amiga),    /* params_size */
  2488. +     &amiga_custom_procs,        /* procs */
  2489. +     "amiga_custom",            /* dname */
  2490. +     0, 0,                /* width, height */
  2491. +     72.27, 72.27,            /* xdpi, ydpi */
  2492. +     no_margins,            /* margins */
  2493. +     dci_black_and_white,        /* color info */
  2494. +     0,                /* is_open */
  2495. +     NULL,                /* screen */
  2496. +     NULL,                /* window */
  2497. +     0,                /* super_width */
  2498. +     0,                /* super_height */
  2499. +     NULL,                /* super_bitmap */
  2500. +     NULL,                /* gadget */
  2501. +     NULL,                /* image */
  2502. +     NULL,                /* dispatcher */
  2503. +     NULL,                /* main */
  2504. +     NULL,                /* rport */
  2505. +     NULL,                /* printer */
  2506. +     NULL,                /* port */
  2507. +     NULL,                /* colormap */
  2508. +     NULL,                /* bitmap */
  2509. +     NULL,                /* bitplane */
  2510. +     1,                /* last_pen */
  2511. +     DEFAULT_WIDTH,            /* page width */
  2512. +     DEFAULT_HEIGHT,            /* page height */
  2513. +     DEFAULT_FILENAME,        /* output file */
  2514. +     1,                /* page counter */
  2515. +     0,                /* cube_size */
  2516. +     NULL,                /* temp_rport */
  2517. +     NULL,                /* temp_array */
  2518. +     NULL                /* pens */
  2519. + };
  2520. +     /* Printer device: renders the imagery and sends it to the printer */
  2521. + gx_device_amiga gs_amiga_printer_device =
  2522. + {
  2523. +     sizeof(gx_device_amiga),    /* params_size */
  2524. +     &amiga_printer_procs,        /* procs */
  2525. +     "amiga_printer",        /* dname */
  2526. +     0, 0,                /* width, height */
  2527. +     72.27, 72.27,            /* xdpi, ydpi */
  2528. +     no_margins,            /* margins */
  2529. +     dci_black_and_white,        /* color info */
  2530. +     0,                /* is_open */
  2531. +     NULL,                /* screen */
  2532. +     NULL,                /* window */
  2533. +     0,                /* super_width */
  2534. +     0,                /* super_height */
  2535. +     NULL,                /* super_bitmap */
  2536. +     NULL,                /* gadget */
  2537. +     NULL,                /* image */
  2538. +     NULL,                /* dispatcher */
  2539. +     NULL,                /* main */
  2540. +     NULL,                /* rport */
  2541. +     NULL,                /* printer */
  2542. +     NULL,                /* port */
  2543. +     NULL,                /* colormap */
  2544. +     NULL,                /* bitmap */
  2545. +     NULL,                /* bitplane */
  2546. +     1,                /* last_pen */
  2547. +     DEFAULT_WIDTH,            /* page width */
  2548. +     DEFAULT_HEIGHT,            /* page height */
  2549. +     DEFAULT_FILENAME,        /* output file */
  2550. +     1,                /* page counter */
  2551. +     0,                /* cube_size */
  2552. +     NULL,                /* temp_rport */
  2553. +     NULL,                /* temp_array */
  2554. +     NULL                /* pens */
  2555. + };
  2556. +     /* ILBM device: renders the imagery and saves it to an IFF-ILBM file. */
  2557. + gx_device_amiga gs_amiga_ilbm_device =
  2558. + {
  2559. +     sizeof(gx_device_amiga),    /* params_size */
  2560. +     &amiga_ilbm_procs,        /* procs */
  2561. +     "amiga_ilbm",            /* dname */
  2562. +     0, 0,                /* width, height */
  2563. +     72.27, 72.27,            /* xdpi, ydpi */
  2564. +     no_margins,            /* margins */
  2565. +     dci_black_and_white,        /* color info */
  2566. +     0,                /* is_open */
  2567. +     NULL,                /* screen */
  2568. +     NULL,                /* window */
  2569. +     0,                /* super_width */
  2570. +     0,                /* super_height */
  2571. +     NULL,                /* super_bitmap */
  2572. +     NULL,                /* gadget */
  2573. +     NULL,                /* image */
  2574. +     NULL,                /* dispatcher */
  2575. +     NULL,                /* main */
  2576. +     NULL,                /* rport */
  2577. +     NULL,                /* printer */
  2578. +     NULL,                /* port */
  2579. +     NULL,                /* colormap */
  2580. +     NULL,                /* bitmap */
  2581. +     NULL,                /* bitplane */
  2582. +     1,                /* last_pen */
  2583. +     DEFAULT_WIDTH,            /* page width */
  2584. +     DEFAULT_HEIGHT,            /* page height */
  2585. +     DEFAULT_FILENAME,        /* output file */
  2586. +     1,                /* page counter */
  2587. +     0,                /* cube_size */
  2588. +     NULL,                /* temp_rport */
  2589. +     NULL,                /* temp_array */
  2590. +     NULL                /* pens */
  2591. + };
  2592. +     /* Dark (black) and light (white) rendering colours; the default device
  2593. +      * determines the actual colours to be used by looking into the screen
  2594. +      * colour lookup table, the other device drivers leave these values
  2595. +      * untouched.
  2596. +      */
  2597. + STATIC UBYTE    DarkPen        = 0,
  2598. +         LightPen    = 1;
  2599. +     /* Cheap, but effective ;-) */
  2600. + #define xdev ((gx_device_amiga *)dev)
  2601. +     /* set_mono_device(gx_device_amiga *dev,int cube_size,LONG *pens):
  2602. +      *
  2603. +      *    Reconfigure a device for monochrome output.
  2604. +      */
  2605. + VOID
  2606. + set_mono_device(gx_device_amiga *dev)
  2607. + {
  2608. +     xdev -> color_info . depth        = 1;
  2609. +     xdev -> color_info . num_components    = 1;
  2610. +     xdev -> color_info . max_gray        = 1;
  2611. +     xdev -> color_info . max_rgb        = 0;
  2612. +     xdev -> color_info . dither_gray    = 2;
  2613. +     xdev -> color_info . dither_rgb        = 0;
  2614. +     xdev -> procs -> copy_color        = amiga_copy_color;
  2615. +     xdev -> procs -> map_rgb_color        = amiga_map_rgb_color;
  2616. +     xdev -> procs -> map_color_rgb        = amiga_map_color_rgb;
  2617. +     xdev -> cube_size            = 0;
  2618. + }
  2619. +     /* set_colour_device(gx_device_amiga *dev,int cube_size,LONG *pens):
  2620. +      *
  2621. +      *    Reconfigure a device for colour output.
  2622. +      */
  2623. + VOID
  2624. + set_colour_device(gx_device_amiga *dev,int cube_size,LONG *pens)
  2625. + {
  2626. +     xdev -> color_info . depth        = 8;
  2627. +     xdev -> color_info . num_components    = 3;
  2628. +     xdev -> color_info . max_gray        = cube_size - 1;
  2629. +     xdev -> color_info . max_rgb        = cube_size - 1;
  2630. +     xdev -> color_info . dither_gray    = cube_size;
  2631. +     xdev -> color_info . dither_rgb        = cube_size;
  2632. +     xdev -> procs -> copy_color        = amiga_copy_color8;
  2633. +         /* Any colours to be remapped? */
  2634. +     if(pens)
  2635. +     {
  2636. +         xdev -> procs -> map_rgb_color    = amiga_color_map_rgb_color_pen;
  2637. +         xdev -> procs -> map_color_rgb    = amiga_color_map_color_rgb_pen;
  2638. +         xdev -> pens            = pens;
  2639. +     }
  2640. +     else
  2641. +     {
  2642. +         xdev -> procs -> map_rgb_color    = amiga_color_map_rgb_color;
  2643. +         xdev -> procs -> map_color_rgb    = amiga_color_map_color_rgb;
  2644. +     }
  2645. +         /* Remember the size of the RGB cube. */
  2646. +     xdev -> cube_size            = cube_size;
  2647. + }
  2648. +     /* set_colour_printer_device(gx_device_amiga *dev,LONG CubeSize):
  2649. +      *
  2650. +      *    Configure the printer device for colour output.
  2651. +      */
  2652. + VOID
  2653. + set_colour_printer_device(gx_device_amiga *dev,LONG CubeSize)
  2654. + {
  2655. +     xdev -> color_info . depth        = 16;
  2656. +     xdev -> color_info . num_components    = 3;
  2657. +     xdev -> color_info . max_gray        = CubeSize - 1;
  2658. +     xdev -> color_info . max_rgb        = CubeSize - 1;
  2659. +     xdev -> color_info . dither_gray    = CubeSize;
  2660. +     xdev -> color_info . dither_rgb        = CubeSize;
  2661. +     xdev -> procs -> fill_rectangle        = amiga_fill_rectangle_raw_color;
  2662. +     xdev -> procs -> copy_mono        = amiga_copy_mono_raw_color;
  2663. +     xdev -> procs -> copy_color        = amiga_copy_color_raw_color16;
  2664. +     xdev -> procs -> draw_line        = amiga_draw_line_raw_color;
  2665. +     xdev -> procs -> get_bits        = gx_default_get_bits;
  2666. +     xdev -> procs -> map_rgb_color        = amiga_color_map_rgb_color;
  2667. +     xdev -> procs -> map_color_rgb        = amiga_color_map_color_rgb;
  2668. +     xdev -> cube_size            = CubeSize;
  2669. + }
  2670. +     /* DeleteBitMap(struct BitMap *BitMap,BOOL Private):
  2671. +      *
  2672. +      *    Free memory associated with a custom rendering bitmap.
  2673. +      */
  2674. + VOID
  2675. + DeleteBitMap(struct BitMap *BitMap,BOOL Private)
  2676. + {
  2677. +     if(GfxBase -> LibNode . lib_Version >= 39 && !Private)
  2678. +         FreeBitMap(BitMap);
  2679. +     else
  2680. +     {
  2681. +         LONG i;
  2682. +         for(i = 0 ; i < BitMap -> Depth ; i++)
  2683. +         {
  2684. +             if(BitMap -> Planes[i])
  2685. +                 FreeVec(BitMap -> Planes[i]);
  2686. +         }
  2687. +         FreeVec(BitMap);
  2688. +     }
  2689. + }
  2690. +     /* CreateBitMap(LONG Width,LONG Height,LONG Depth,ULONG Flags,struct BitMap *Friend,BOOL Private):
  2691. +      *
  2692. +      *    Create a custom rendering bitmap.
  2693. +      */
  2694. + struct BitMap *
  2695. + CreateBitMap(LONG Width,LONG Height,LONG Depth,ULONG Flags,struct BitMap *Friend,BOOL Private)
  2696. + {
  2697. +     if(GfxBase -> LibNode . lib_Version >= 39 && !Private)
  2698. +         return(AllocBitMap(Width,Height,Depth,Flags,Friend));
  2699. +     else
  2700. +     {
  2701. +         struct BitMap    *BitMap;
  2702. +         LONG         Plus;
  2703. +         ULONG         MemType;
  2704. +             /* Bitmap structure needs to be padded if more
  2705. +              * than the standard eight bitplanes are to be
  2706. +              * allocated.
  2707. +              */
  2708. +         if(Depth > 8)
  2709. +             Plus = (Depth - 8) * sizeof(PLANEPTR);
  2710. +         else
  2711. +             Plus = 0;
  2712. +         if(Private)
  2713. +             MemType = MEMF_ANY;
  2714. +         else
  2715. +             MemType = MEMF_CHIP;
  2716. +         if(BitMap = (struct BitMap *)AllocVec(sizeof(struct BitMap) + Plus,MEMF_ANY | MEMF_CLEAR))
  2717. +         {
  2718. +             LONG i,PageSize;
  2719. +             InitBitMap(BitMap,Depth,Width,Height);
  2720. +             PageSize = BitMap -> BytesPerRow * BitMap -> Rows;
  2721. +             for(i = 0 ; i < BitMap -> Depth ; i++)
  2722. +             {
  2723. +                 if(!(BitMap -> Planes[i] = (PLANEPTR)AllocVec(PageSize,MemType)))
  2724. +                 {
  2725. +                     LONG j;
  2726. +                     for(j = 0 ; j < i ; j++)
  2727. +                         FreeVec(BitMap -> Planes[j]);
  2728. +                     FreeVec(BitMap);
  2729. +                     return(NULL);
  2730. +                 }
  2731. +             }
  2732. +             return(BitMap);
  2733. +         }
  2734. +     }
  2735. + }
  2736. +     /* DeleteTempRPort(struct RastPort *Temp):
  2737. +      *
  2738. +      *    Free memory associated with a temporary raster port.
  2739. +      */
  2740. + VOID
  2741. + DeleteTempRPort(struct RastPort *Temp)
  2742. + {
  2743. +     DeleteBitMap(Temp -> BitMap,FALSE);
  2744. +     FreeVec(Temp);
  2745. + }
  2746. +     /* CreateTempRPort(struct RastPort *Source):
  2747. +      *
  2748. +      *    Allocate memory for temporary raster port (one line high).
  2749. +      */
  2750. + struct RastPort *
  2751. + CreateTempRPort(struct RastPort *Source)
  2752. + {
  2753. +     struct RastPort *Temp;
  2754. +     if(Temp = (struct RastPort *)AllocVec(sizeof(struct RastPort),MEMF_ANY))
  2755. +     {
  2756. +         LONG Width,Depth;
  2757. +         CopyMem(Source,Temp,sizeof(struct RastPort));
  2758. +         Temp -> Layer = NULL;
  2759. +         if(GfxBase -> LibNode . lib_Version >= 39)
  2760. +         {
  2761. +             Width    = GetBitMapAttr(Source -> BitMap,BMA_WIDTH);
  2762. +             Depth    = GetBitMapAttr(Source -> BitMap,BMA_DEPTH);
  2763. +         }
  2764. +         else
  2765. +         {
  2766. +             Width    = Source -> BitMap -> BytesPerRow * 8;
  2767. +             Depth    = Source -> BitMap -> Depth;
  2768. +         }
  2769. +         if(Temp -> BitMap = CreateBitMap(Width,1,Depth,NULL,Source -> BitMap,FALSE))
  2770. +             return(Temp);
  2771. +         else
  2772. +             FreeVec(Temp);
  2773. +     }
  2774. +     return(NULL);
  2775. + }
  2776. +     /* Euclid(LONG a,LONG b):
  2777. +      *
  2778. +      *    Compute the greatest common divisor of two integers.
  2779. +      */
  2780. + LONG
  2781. + Euclid(LONG a,LONG b)
  2782. + {
  2783. +     do
  2784. +     {
  2785. +         if(a < b)
  2786. +         {
  2787. +             LONG t;
  2788. +             t = a;
  2789. +             a = b;
  2790. +             b = t;
  2791. +         }
  2792. +         a = a % b;
  2793. +     }
  2794. +     while(a);
  2795. +     return(b);
  2796. + }
  2797. +     /* PutDump(register BYTE *Destination,register LONG Count):
  2798. +      *
  2799. +      *    Store a byte dump.
  2800. +      */
  2801. + BYTE *
  2802. + PutDump(register BYTE *Destination,register LONG Count)
  2803. + {
  2804. +     register BYTE *Source = Buffer;
  2805. +     *Destination++     = Count - 1;
  2806. +      PackedBytes    += Count + 1;
  2807. +     while(Count--)
  2808. +         *Destination++ = *Source++;
  2809. +     return(Destination);
  2810. + }
  2811. +     /* PutRun(register BYTE *Destination,LONG Count,WORD Char):
  2812. +      *
  2813. +      *    Store a byte run.
  2814. +      */
  2815. + BYTE *
  2816. + PutRun(register BYTE *Destination,LONG Count,WORD Char)
  2817. + {
  2818. +     *Destination++     = -(Count - 1);
  2819. +     *Destination++     = Char;
  2820. +      PackedBytes    += 2; 
  2821. +     return(Destination);
  2822. + }
  2823. +     /* PackRow(PLANEPTR *SourcePtr,register BYTE *Destination,LONG RowSize):
  2824. +      *
  2825. +      *    Pack a raster line using the CmpByteRun1 algorithm.
  2826. +      */
  2827. + LONG
  2828. + PackRow(PLANEPTR *SourcePtr,register BYTE *Destination,LONG RowSize)
  2829. + {
  2830. +     register BYTE *Source = *SourcePtr;
  2831. +     WORD    Buffered    = 1,
  2832. +         RunStart    = 0;
  2833. +     BYTE    Mode        = DUMP,
  2834. +         LastChar,
  2835. +         Char;
  2836. +     PackedBytes = 0;
  2837. +     Buffer[0] = LastChar = Char = *Source++;
  2838. +     RowSize--;
  2839. +     while(RowSize--)
  2840. +     {
  2841. +         Buffer[Buffered++] = Char = *Source++;
  2842. +         if(Mode)
  2843. +         {
  2844. +             if((Char != LastChar) || (Buffered - RunStart > MAXRUN))
  2845. +             {
  2846. +                 Destination    = PutRun(Destination,Buffered - 1 - RunStart,LastChar);
  2847. +                 Buffer[0]    = Char;
  2848. +                 Buffered    = 1;
  2849. +                 RunStart    = 0;
  2850. +                 Mode        = DUMP;
  2851. +             }
  2852. +         }
  2853. +         else
  2854. +         {
  2855. +             if(Buffered > MAXDAT)
  2856. +             {
  2857. +                 Destination    = PutDump(Destination,Buffered - 1);
  2858. +                 Buffer[0]    = Char;
  2859. +                 Buffered    = 1;
  2860. +                 RunStart    = 0;
  2861. +             }
  2862. +             else
  2863. +             {
  2864. +                 if(Char == LastChar)
  2865. +                 {
  2866. +                     if(Buffered - RunStart >= MINRUN)
  2867. +                     {
  2868. +                         if(RunStart)
  2869. +                             Destination = PutDump(Destination,RunStart);
  2870. +                         Mode = RUN;
  2871. +                     }
  2872. +                     else
  2873. +                     {
  2874. +                         if(!RunStart)
  2875. +                             Mode = RUN;
  2876. +                     }
  2877. +                 }
  2878. +                 else
  2879. +                     RunStart = Buffered - 1;
  2880. +             }
  2881. +         }
  2882. +         LastChar = Char;
  2883. +     }
  2884. +     if(Mode)
  2885. +         PutRun(Destination,Buffered - RunStart,LastChar);
  2886. +     else
  2887. +         PutDump(Destination,Buffered);
  2888. +     *SourcePtr = Source;
  2889. +     return(PackedBytes);
  2890. + }
  2891. +     /* PutBODY(struct IFFHandle *Handle,struct BitMap *BitMap):
  2892. +      *
  2893. +      *    Store a bitmap in a BODY chunk.
  2894. +      */
  2895. + BOOL
  2896. + PutBODY(struct IFFHandle *Handle,struct BitMap *BitMap)
  2897. + {
  2898. +     PLANEPTR    *Planes;
  2899. +     BYTE        *PackBuffer;
  2900. +     BOOL         Success = FALSE;
  2901. +     LONG         PackedBytes,
  2902. +              i,j;
  2903. +         /* Allocate the bitplane information. */
  2904. +     if(Planes = (PLANEPTR *)AllocVec(BitMap -> Depth * sizeof(PLANEPTR *),MEMF_ANY | MEMF_CLEAR))
  2905. +     {
  2906. +             /* Allocate the compression buffer. */
  2907. +         if(PackBuffer = (BYTE *)AllocVec(BitMap -> BytesPerRow * 2,MEMF_ANY))
  2908. +         {
  2909. +                 /* Copy the planes over. */
  2910. +             for(i = 0 ; i < BitMap -> Depth ; i++)
  2911. +                 Planes[i] = BitMap -> Planes[i];
  2912. +             if(!PushChunk(Handle,0,ID_BODY,IFFSIZE_UNKNOWN))
  2913. +             {
  2914. +                 Success = TRUE;
  2915. +                     /* Run down the rows. */
  2916. +                 for(i = 0 ; Success && i < BitMap -> Rows ; i++)
  2917. +                 {
  2918. +                     for(j = 0 ; Success && j < BitMap -> Depth ; j++)
  2919. +                     {
  2920. +                             /* Pack the data. */
  2921. +                         PackedBytes = PackRow(&Planes[j],PackBuffer,BitMap -> BytesPerRow);
  2922. +                             /* Write it to disk. */
  2923. +                         if(WriteChunkRecords(Handle,PackBuffer,PackedBytes,1) != 1)
  2924. +                             Success = FALSE;
  2925. +                     }
  2926. +                 }
  2927. +                 if(PopChunk(Handle))
  2928. +                     Success = FALSE;
  2929. +             }
  2930. +             FreeVec(PackBuffer);
  2931. +         }
  2932. +         FreeVec(Planes);
  2933. +     }
  2934. +     return(Success);
  2935. + }
  2936. +     /* PutANNO(struct IFFHandle *Handle):
  2937. +      *
  2938. +      *    Store annotation chunk.
  2939. +      */
  2940. + BOOL
  2941. + PutANNO(struct IFFHandle *Handle)
  2942. + {
  2943. +     STATIC STRPTR Note = "Rendered by GNU Ghostscript 2.6.0";
  2944. +     if(!PushChunk(Handle,0,ID_ANNO,strlen(Note)))
  2945. +     {
  2946. +         if(WriteChunkRecords(Handle,Note,strlen(Note),1) == 1)
  2947. +         {
  2948. +             if(!PopChunk(Handle))
  2949. +                 return(TRUE);
  2950. +         }
  2951. +     }
  2952. +     return(FALSE);
  2953. + }
  2954. +     /* PutCAMG(struct IFFHandle *Handle):
  2955. +      *
  2956. +      *    Store display mode chunk.
  2957. +      */
  2958. + BOOL
  2959. + PutCAMG(struct IFFHandle *Handle)
  2960. + {
  2961. +     ULONG ViewModes = HIRESLACE_KEY;
  2962. +     if(!PushChunk(Handle,0,ID_CAMG,sizeof(ULONG)))
  2963. +     {
  2964. +         if(WriteChunkRecords(Handle,&ViewModes,sizeof(ULONG),1) == 1)
  2965. +         {
  2966. +             if(!PopChunk(Handle))
  2967. +                 return(TRUE);
  2968. +         }
  2969. +     }
  2970. +     return(FALSE);
  2971. + }
  2972. +     /* PutCMAP(struct IFFHandle *Handle):
  2973. +      *
  2974. +      *    Store colour map chunk.
  2975. +      */
  2976. + BOOL
  2977. + PutCMAP(struct IFFHandle *Handle)
  2978. + {
  2979. +     STATIC UBYTE Colours[2][3] =
  2980. +     {
  2981. +         0x00,0x00,0x00,
  2982. +         0xFF,0xFF,0xFF
  2983. +     };
  2984. +     if(!PushChunk(Handle,0,ID_CMAP,sizeof(Colours)))
  2985. +     {
  2986. +         if(WriteChunkRecords(Handle,Colours,2,3) == 3)
  2987. +         {
  2988. +             if(!PopChunk(Handle))
  2989. +                 return(TRUE);
  2990. +         }
  2991. +     }
  2992. +     return(FALSE);
  2993. + }
  2994. +     /* PutDPI(struct IFFHandle *Handle,UWORD X_DPI,UWORD Y_DPI):
  2995. +      *
  2996. +      *    Store DPI chunk.
  2997. +      */
  2998. + BOOL
  2999. + PutDPI(struct IFFHandle *Handle,UWORD X_DPI,UWORD Y_DPI)
  3000. + {
  3001. +     DPIHeader Header;
  3002. +     Header . dpi_x = X_DPI;
  3003. +     Header . dpi_y = Y_DPI;
  3004. +     if(!PushChunk(Handle,0,ID_DPI,sizeof(Header)))
  3005. +     {
  3006. +         if(WriteChunkRecords(Handle,&Header,sizeof(Header),1) == 1)
  3007. +         {
  3008. +             if(!PopChunk(Handle))
  3009. +                 return(TRUE);
  3010. +         }
  3011. +     }
  3012. +     return(FALSE);
  3013. + }
  3014. +     /* PutBMHD(struct IFFHandle *Handle,LONG Width,LONG Height,UWORD X_DPI,UWORD Y_DPI):
  3015. +      *
  3016. +      *    Store BMHD chunk.
  3017. +      */
  3018. + BOOL
  3019. + PutBMHD(struct IFFHandle *Handle,LONG Width,LONG Height,UWORD X_DPI,UWORD Y_DPI)
  3020. + {
  3021. +         /* Valid parameters? */
  3022. +     if(X_DPI > 0 && Y_DPI > 0 && Width > 0 && Height > 0)
  3023. +     {
  3024. +         BitMapHeader    Header;
  3025. +         UWORD        gcd;
  3026. +             /* So we can store neat & small
  3027. +              * aspect ration values.
  3028. +              */
  3029. +         gcd = Euclid(X_DPI,Y_DPI);
  3030. +         Header . w            = Width;
  3031. +         Header . h            = Height;
  3032. +         Header . pageWidth        = Width;
  3033. +         Header . pageHeight        = Height;
  3034. +         Header . x            = 0;
  3035. +         Header . y            = 0;
  3036. +         Header . nPlanes        = 1;
  3037. +         Header . masking        = 0;
  3038. +         Header . compression        = 1;
  3039. +         Header . pad1            = 0;
  3040. +         Header . transparentColor    = 0;
  3041. +         Header . xAspect        = X_DPI / gcd;
  3042. +         Header . yAspect        = Y_DPI / gcd;
  3043. +         if(!PushChunk(Handle,0,ID_BMHD,sizeof(Header)))
  3044. +         {
  3045. +             if(WriteChunkRecords(Handle,&Header,sizeof(Header),1) == 1)
  3046. +             {
  3047. +                 if(!PopChunk(Handle))
  3048. +                     return(TRUE);
  3049. +             }
  3050. +         }
  3051. +     }
  3052. +     return(FALSE);
  3053. + }
  3054. +     /* SaveBitMap(STRPTR Name,struct BitMap *BitMap,LONG Width,LONG Height,UWORD X_DPI,UWORD Y_DPI):
  3055. +      *
  3056. +      *    Store a bitmap in an IFF-ILBM file.
  3057. +      */
  3058. + BOOL
  3059. + SaveBitMap(STRPTR Name,struct BitMap *BitMap,LONG Width,LONG Height,UWORD X_DPI,UWORD Y_DPI)
  3060. + {
  3061. +     struct IFFHandle    *Handle;
  3062. +     BOOL             Success = FALSE;
  3063. +     if(Handle = AllocIFF())
  3064. +     {
  3065. +         if(Handle -> iff_Stream = Open(Name,MODE_NEWFILE))
  3066. +         {
  3067. +             InitIFFasDOS(Handle);
  3068. +             if(!OpenIFF(Handle,IFFF_WRITE))
  3069. +             {
  3070. +                 if(!PushChunk(Handle,ID_ILBM,ID_FORM,IFFSIZE_UNKNOWN))
  3071. +                 {
  3072. +                     if(PutBMHD(Handle,Width,Height,X_DPI,Y_DPI))
  3073. +                     {
  3074. +                         if(PutANNO(Handle))
  3075. +                         {
  3076. +                             if(PutCMAP(Handle))
  3077. +                             {
  3078. +                                 if(PutCAMG(Handle))
  3079. +                                 {
  3080. +                                     if(PutDPI(Handle,X_DPI,Y_DPI))
  3081. +                                     {
  3082. +                                         if(PutBODY(Handle,BitMap))
  3083. +                                             Success = TRUE;
  3084. +                                     }
  3085. +                                 }
  3086. +                             }
  3087. +                         }
  3088. +                     }
  3089. +                     if(PopChunk(Handle))
  3090. +                         Success = FALSE;
  3091. +                 }
  3092. +                 CloseIFF(Handle);
  3093. +             }
  3094. +             Close(Handle -> iff_Stream);
  3095. +             if(!Success)
  3096. +                 DeleteFile(Name);
  3097. +         }
  3098. +         FreeIFF(Handle);
  3099. +     }
  3100. +     return(Success);
  3101. + }
  3102. +     /* GetInches(STRPTR Buffer):
  3103. +      *
  3104. +      *    Turn a parameter string into a number representing
  3105. +      *    a certain number of inches.
  3106. +      */
  3107. + float
  3108. + GetInches(STRPTR Buffer)
  3109. + {
  3110. +     STATIC struct { STRPTR Unit; float Factor; } Units[7] =
  3111. +     {
  3112. +         "pt",    1.0,            /* Point */
  3113. +         "pc",    12.0,            /* Pica */
  3114. +         "in",    72.72,            /* Inch */
  3115. +         "cm",    72.72 / 2.54,        /* Centimeter */
  3116. +         "mm",    727.2 / 2.54,        /* Millimeter */
  3117. +         "dd",    1157.0 / 1238.0,    /* Didot point */
  3118. +         "cc",    1157.0 / 103.0        /* Cicero */
  3119. +     };
  3120. +     UBYTE    Temp[40];
  3121. +     float    Value;
  3122. +     LONG    i;
  3123. +     i = 0;
  3124. +         /* Strip the numeric part. */
  3125. +     while((Buffer[i] >= '0' && Buffer[i] <= '9') || Buffer[i] == '.' || Buffer[i] == '+' || Buffer[i] == '-' || Buffer[i] == 'e')
  3126. +     {
  3127. +         Temp[i] = Buffer[i];
  3128. +         i++;
  3129. +     }
  3130. +         /* Provide null-termination. */
  3131. +     Temp[i] = 0;
  3132. +         /* atof() appears to be broken in ixemul.library 39.45. */
  3133. +     sscanf(Temp,"%f",&Value);
  3134. +     Buffer += i;
  3135. +         /* Which measuring unit? */
  3136. +     for(i = 0 ; i < 7 ; i++)
  3137. +     {
  3138. +             /* Return the result in inches. */
  3139. +         if(!Stricmp(Buffer,Units[i] . Unit))
  3140. +             return(Value * Units[i] . Factor / 72.27);
  3141. +     }
  3142. +         /* Return the result in inches. */
  3143. +     return(Value / 72.27);
  3144. + }
  3145. +     /* DispatchTask():
  3146. +      *
  3147. +      *    Asynchronous window message dispatcher.
  3148. +      */
  3149. + VOID
  3150. + DispatchTask()
  3151. + {
  3152. +     struct Task    *me;
  3153. +     gx_device    *dev;
  3154. +         /* Set up global data area base register. */
  3155. +     ix_geta4();
  3156. +         /* Who am I? */
  3157. +     me = FindTask(NULL);
  3158. +         /* Wait for wakeup call. */
  3159. +     Wait(SIG_HANDSHAKE);
  3160. +         /* Obtain device pointer. */
  3161. +     dev = me -> tc_UserData;
  3162. +         /* Enable user input. */
  3163. +     if(ModifyIDCMP(xdev -> window,IDCMP_FLAGS))
  3164. +     {
  3165. +         ULONG    Mask = 1 << xdev -> window -> UserPort -> mp_SigBit,
  3166. +             Set;
  3167. +         BOOL    Done = FALSE;
  3168. +             /* Fill in the dispatcher entry. */
  3169. +         xdev -> dispatcher = me;
  3170. +             /* Ring back. */
  3171. +         Signal((struct Task *)xdev -> main,SIG_HANDSHAKE);
  3172. +             /* Wait for input... */
  3173. +         do
  3174. +         {
  3175. +             Set = Wait(Mask | SIG_KILL);
  3176. +             if(Set & Mask)
  3177. +                 DispatchSuperWindow(dev);
  3178. +             if(Set & SIG_KILL)
  3179. +                 Done = TRUE;
  3180. +         }
  3181. +         while(!Done);
  3182. +             /* Disable user input. */
  3183. +         ModifyIDCMP(xdev -> window,NULL);
  3184. +     }
  3185. +         /* Disable task switching. */
  3186. +     Forbid();
  3187. +         /* Clear the dispatcher entry. */
  3188. +     xdev -> dispatcher = NULL;
  3189. +         /* Signal the main process that we are done. */
  3190. +     Signal((struct Task *)xdev -> main,SIG_HANDSHAKE);
  3191. +         /* Remove ourselves. */
  3192. +     RemTask(NULL);
  3193. + }
  3194. +     /* DeleteScrollers(gx_device *dev):
  3195. +      *
  3196. +      *    Delete the window border scrollers.
  3197. +      */
  3198. + VOID
  3199. + DeleteScrollers(gx_device *dev)
  3200. + {
  3201. +     if(xdev -> gadget)
  3202. +     {
  3203. +         if(xdev -> gadget[HORIZONTAL_SCROLLER])
  3204. +             DisposeObject(xdev -> gadget[HORIZONTAL_SCROLLER]);
  3205. +         if(xdev -> gadget[VERTICAL_SCROLLER])
  3206. +             DisposeObject(xdev -> gadget[VERTICAL_SCROLLER]);
  3207. +         if(xdev -> gadget[UP_ARROW])
  3208. +             DisposeObject(xdev -> gadget[UP_ARROW]);
  3209. +         if(xdev -> gadget[DOWN_ARROW])
  3210. +             DisposeObject(xdev -> gadget[DOWN_ARROW]);
  3211. +         if(xdev -> gadget[LEFT_ARROW])
  3212. +             DisposeObject(xdev -> gadget[LEFT_ARROW]);
  3213. +         if(xdev -> gadget[RIGHT_ARROW])
  3214. +             DisposeObject(xdev -> gadget[RIGHT_ARROW]);
  3215. +         FreeVec(xdev -> gadget);
  3216. +         xdev -> gadget = NULL;
  3217. +     }
  3218. +     if(xdev -> image)
  3219. +     {
  3220. +         if(xdev -> image[UP_IMAGE])
  3221. +             DisposeObject(xdev -> image[UP_IMAGE]);
  3222. +         if(xdev -> image[DOWN_IMAGE])
  3223. +             DisposeObject(xdev -> image[DOWN_IMAGE]);
  3224. +         if(xdev -> image[LEFT_IMAGE])
  3225. +             DisposeObject(xdev -> image[LEFT_IMAGE]);
  3226. +         if(xdev -> image[RIGHT_IMAGE])
  3227. +             DisposeObject(xdev -> image[RIGHT_IMAGE]);
  3228. +         FreeVec(xdev -> image);
  3229. +         xdev -> image = NULL;
  3230. +     }
  3231. + }
  3232. +     /* CreateScrollers(gx_device *dev,struct Screen *Screen):
  3233. +      *
  3234. +      *    Create the window border scroller handles.
  3235. +      */
  3236. + BOOL
  3237. + CreateScrollers(gx_device *dev,struct Screen *Screen)
  3238. + {
  3239. +     BOOL Result = FALSE;
  3240. +     if(xdev -> gadget = (struct Gadget **)AllocVec(sizeof(struct Gadget *) * GADGET_COUNT,MEMF_ANY | MEMF_CLEAR | MEMF_PUBLIC))
  3241. +     {
  3242. +         if(xdev -> image = (struct Image **)AllocVec(sizeof(struct Image *) * IMAGE_COUNT,MEMF_ANY | MEMF_CLEAR | MEMF_PUBLIC))
  3243. +         {
  3244. +             struct DrawInfo *DrawInfo;
  3245. +             if(DrawInfo = GetScreenDrawInfo(Screen))
  3246. +             {
  3247. +                 LONG    SizeWidth,
  3248. +                     SizeHeight;
  3249. +                 UWORD    SizeType;
  3250. +                 if(Screen -> Flags & SCREENHIRES)
  3251. +                 {
  3252. +                     SizeWidth    = 18;
  3253. +                     SizeHeight    = 10;
  3254. +                     SizeType    = SYSISIZE_MEDRES;
  3255. +                 }
  3256. +                 else
  3257. +                 {
  3258. +                     SizeWidth    = 13;
  3259. +                     SizeHeight    = 11;
  3260. +                     SizeType    = SYSISIZE_LOWRES;
  3261. +                 }
  3262. +                 if(xdev -> image[UP_IMAGE] = (struct Image *)NewObject(NULL,"sysiclass",
  3263. +                     SYSIA_Size,    SizeType,
  3264. +                     SYSIA_Which,    UPIMAGE,
  3265. +                     SYSIA_DrawInfo,    DrawInfo,
  3266. +                 TAG_DONE))
  3267. +                 {
  3268. +                     if(xdev -> image[DOWN_IMAGE] = (struct Image *)NewObject(NULL,"sysiclass",
  3269. +                         SYSIA_Size,    SizeType,
  3270. +                         SYSIA_Which,    DOWNIMAGE,
  3271. +                         SYSIA_DrawInfo,    DrawInfo,
  3272. +                     TAG_DONE))
  3273. +                     {
  3274. +                         if(xdev -> image[LEFT_IMAGE] = (struct Image *)NewObject(NULL,"sysiclass",
  3275. +                             SYSIA_Size,    SizeType,
  3276. +                             SYSIA_Which,    LEFTIMAGE,
  3277. +                             SYSIA_DrawInfo,    DrawInfo,
  3278. +                         TAG_DONE))
  3279. +                         {
  3280. +                             if(xdev -> image[RIGHT_IMAGE] = (struct Image *)NewObject(NULL,"sysiclass",
  3281. +                                 SYSIA_Size,    SizeType,
  3282. +                                 SYSIA_Which,    RIGHTIMAGE,
  3283. +                                 SYSIA_DrawInfo,    DrawInfo,
  3284. +                             TAG_DONE))
  3285. +                             {
  3286. +                                 if(xdev -> gadget[VERTICAL_SCROLLER] = NewObject(NULL,"propgclass",
  3287. +                                     GA_ID,        VERTICAL_SCROLLER,
  3288. +                                     GA_Top,        Screen -> WBorTop + Screen -> Font -> ta_YSize + 2,
  3289. +                                     GA_RelHeight,    -(Screen -> WBorTop + Screen -> Font -> ta_YSize + 2 + SizeHeight + 1 + 2 * ARROW_HEIGHT),
  3290. +                                     GA_Width,    SizeWidth - 8,
  3291. +                                     GA_RelRight,    -(SizeWidth - 5),
  3292. +                                     GA_GZZGadget,    TRUE,
  3293. +                                     GA_Immediate,    TRUE,
  3294. +                                     GA_FollowMouse,    TRUE,
  3295. +                                     GA_RelVerify,    TRUE,
  3296. +                                     GA_RightBorder,    TRUE,
  3297. +                                     PGA_Freedom,    FREEVERT,
  3298. +                                     PGA_NewLook,    TRUE,
  3299. +                                     PGA_Borderless,    TRUE,
  3300. +                                     PGA_Visible,    1,
  3301. +                                     PGA_Total,    1,
  3302. +                                 TAG_DONE))
  3303. +                                 {
  3304. +                                     if(xdev -> gadget[HORIZONTAL_SCROLLER] = NewObject(NULL,"propgclass",
  3305. +                                         GA_ID,        HORIZONTAL_SCROLLER,
  3306. +                                         GA_Previous,    xdev -> gadget[VERTICAL_SCROLLER],
  3307. +                                         GA_Height,    SizeHeight - 4,
  3308. +                                         GA_RelBottom,    -(SizeHeight - 4 + 1),
  3309. +                                         GA_Left,    4,
  3310. +                                         GA_RelWidth,    -(2 + SizeWidth + 4 + 2 * ARROW_WIDTH),
  3311. +                                         GA_GZZGadget,    TRUE,
  3312. +                                         GA_Immediate,    TRUE,
  3313. +                                         GA_FollowMouse,    TRUE,
  3314. +                                         GA_RelVerify,    TRUE,
  3315. +                                         GA_BottomBorder,TRUE,
  3316. +                                         PGA_Freedom,    FREEHORIZ,
  3317. +                                         PGA_NewLook,    TRUE,
  3318. +                                         PGA_Borderless,    TRUE,
  3319. +                                         PGA_Visible,    1,
  3320. +                                         PGA_Total,    1,
  3321. +                                     TAG_DONE))
  3322. +                                     {
  3323. +                                         STATIC struct TagItem ArrowMappings[] = { GA_ID, GA_ID, TAG_END };
  3324. +                                         if(xdev -> gadget[UP_ARROW] = NewObject(NULL,"buttongclass",
  3325. +                                             GA_ID,        UP_ARROW,
  3326. +                                             GA_Previous,    xdev -> gadget[HORIZONTAL_SCROLLER],
  3327. +                                             GA_GZZGadget,    TRUE,
  3328. +                                             GA_Image,    xdev -> image[UP_IMAGE],
  3329. +                                             GA_RelRight,    -(SizeWidth - 1),
  3330. +                                             GA_RelBottom,    -(SizeHeight - 1 + 2 * ARROW_HEIGHT),
  3331. +                                             GA_Height,    ARROW_HEIGHT,
  3332. +                                             GA_Width,    SizeWidth,
  3333. +                                             GA_Immediate,    TRUE,
  3334. +                                             GA_RelVerify,    TRUE,
  3335. +                                             GA_RightBorder,    TRUE,
  3336. +                                             ICA_TARGET,    ICTARGET_IDCMP,
  3337. +                                             ICA_MAP,    ArrowMappings,
  3338. +                                         TAG_DONE))
  3339. +                                         {
  3340. +                                             if(xdev -> gadget[DOWN_ARROW] = NewObject(NULL,"buttongclass",
  3341. +                                                 GA_ID,        DOWN_ARROW,
  3342. +                                                 GA_Previous,    xdev -> gadget[UP_ARROW],
  3343. +                                                 GA_GZZGadget,    TRUE,
  3344. +                                                 GA_Image,    xdev -> image[DOWN_IMAGE],
  3345. +                                                 GA_RelRight,    -(SizeWidth - 1),
  3346. +                                                 GA_RelBottom,    -(SizeHeight - 1 + ARROW_HEIGHT),
  3347. +                                                 GA_Height,    ARROW_HEIGHT,
  3348. +                                                 GA_Width,    SizeWidth,
  3349. +                                                 GA_Immediate,    TRUE,
  3350. +                                                 GA_RelVerify,    TRUE,
  3351. +                                                 GA_RightBorder,    TRUE,
  3352. +                                                 ICA_TARGET,    ICTARGET_IDCMP,
  3353. +                                                 ICA_MAP,    ArrowMappings,
  3354. +                                             TAG_DONE))
  3355. +                                             {
  3356. +                                                 if(xdev -> gadget[LEFT_ARROW] = NewObject(NULL,"buttongclass",
  3357. +                                                     GA_ID,        LEFT_ARROW,
  3358. +                                                     GA_Previous,    xdev -> gadget[DOWN_ARROW],
  3359. +                                                     GA_GZZGadget,    TRUE,
  3360. +                                                     GA_Image,    xdev -> image[LEFT_IMAGE],
  3361. +                                                     GA_RelRight,    -(SizeWidth - 1 + 2 * ARROW_WIDTH),
  3362. +                                                     GA_RelBottom,    -(SizeHeight - 1),
  3363. +                                                     GA_Height,    SizeHeight,
  3364. +                                                     GA_Width,    ARROW_WIDTH,
  3365. +                                                     GA_Immediate,    TRUE,
  3366. +                                                     GA_RelVerify,    TRUE,
  3367. +                                                     GA_BottomBorder,TRUE,
  3368. +                                                     ICA_TARGET,    ICTARGET_IDCMP,
  3369. +                                                     ICA_MAP,    ArrowMappings,
  3370. +                                                 TAG_DONE))
  3371. +                                                 {
  3372. +                                                     if(xdev -> gadget[RIGHT_ARROW] = NewObject(NULL,"buttongclass",
  3373. +                                                         GA_ID,        RIGHT_ARROW,
  3374. +                                                         GA_Previous,    xdev -> gadget[LEFT_ARROW],
  3375. +                                                         GA_GZZGadget,    TRUE,
  3376. +                                                         GA_Image,    xdev -> image[RIGHT_IMAGE],
  3377. +                                                         GA_RelRight,    -(SizeWidth - 1 + ARROW_WIDTH),
  3378. +                                                         GA_RelBottom,    -(SizeHeight - 1),
  3379. +                                                         GA_Height,    SizeHeight,
  3380. +                                                         GA_Width,    ARROW_WIDTH,
  3381. +                                                         GA_Immediate,    TRUE,
  3382. +                                                         GA_RelVerify,    TRUE,
  3383. +                                                         GA_BottomBorder,TRUE,
  3384. +                                                         ICA_TARGET,    ICTARGET_IDCMP,
  3385. +                                                         ICA_MAP,    ArrowMappings,
  3386. +                                                     TAG_DONE))
  3387. +                                                         Result = TRUE;
  3388. +                                                 }
  3389. +                                             }
  3390. +                                         }
  3391. +                                     }
  3392. +                                 }
  3393. +                             }
  3394. +                         }
  3395. +                     }
  3396. +                 }
  3397. +                 FreeScreenDrawInfo(Screen,DrawInfo);
  3398. +             }
  3399. +         }
  3400. +     }
  3401. +     return(Result);
  3402. + }
  3403. +     /* WindowResize(gx_device *dev):
  3404. +      *
  3405. +      *    Update the slider sizes and positions after the window
  3406. +      *    was resized.
  3407. +      */
  3408. + VOID
  3409. + WindowResize(gx_device *dev)
  3410. + {
  3411. +     LONG    DeltaX,
  3412. +         DeltaY,
  3413. +         Temp;
  3414. +         /* Query the current horizontal slider position. */
  3415. +     if((Temp = LAYERXOFFSET(xdev -> window) + xdev -> window -> GZZWidth) > xdev -> super_width)
  3416. +         DeltaX = xdev -> super_width - Temp;
  3417. +     else
  3418. +         DeltaX = 0;
  3419. +         /* Query the current vertical slider position. */
  3420. +     if((Temp = LAYERYOFFSET(xdev -> window) + xdev -> window -> GZZHeight) > xdev -> super_height)
  3421. +         DeltaY = xdev -> super_height - Temp;
  3422. +     else
  3423. +         DeltaY = 0;
  3424. +         /* Move the currently displayed window area around. */
  3425. +     if(DeltaX || DeltaY)
  3426. +         ScrollLayer(NULL,xdev -> window -> RPort -> Layer,DeltaX,DeltaY);
  3427. +         /* Update the new horizontal slider position and size. */
  3428. +     SetGadgetAttrs(xdev -> gadget[HORIZONTAL_SCROLLER],xdev -> window,NULL,
  3429. +         PGA_Top,    LAYERXOFFSET(xdev -> window),
  3430. +         PGA_Visible,    xdev -> window -> GZZWidth,
  3431. +         PGA_Total,    xdev -> super_width,
  3432. +     TAG_DONE);
  3433. +         /* Update the new vertical slider position and size. */
  3434. +     SetGadgetAttrs(xdev -> gadget[VERTICAL_SCROLLER],xdev -> window,NULL,
  3435. +         PGA_Top,    LAYERYOFFSET(xdev -> window),
  3436. +         PGA_Visible,    xdev -> window -> GZZHeight,
  3437. +         PGA_Total,    xdev -> super_height,
  3438. +     TAG_DONE);
  3439. + }
  3440. +     /* WindowUpdate(struct Gadget *Gadget,gx_device *dev):
  3441. +      *
  3442. +      *    Move the currently visible portion of the
  3443. +      *    window according to the current slider
  3444. +      *    position.
  3445. +      */
  3446. + VOID
  3447. + WindowUpdate(struct Gadget *Gadget,gx_device *dev)
  3448. + {
  3449. +     LONG Storage;
  3450. +     switch(Gadget -> GadgetID)
  3451. +     {
  3452. +         case HORIZONTAL_SCROLLER:
  3453. +             if(GetAttr(PGA_Top,Gadget,&Storage))
  3454. +                 ScrollLayer(NULL,xdev -> window -> RPort -> Layer,Storage - LAYERXOFFSET(xdev -> window),0);
  3455. +             break;
  3456. +         case VERTICAL_SCROLLER:
  3457. +             if(GetAttr(PGA_Top,Gadget,&Storage))
  3458. +                 ScrollLayer(NULL,xdev -> window -> RPort -> Layer,0,Storage - LAYERYOFFSET(xdev -> window));
  3459. +             break;
  3460. +     }
  3461. + }
  3462. +     /* MoveAround(struct Gadget *Gadget,int How,gx_device *dev):
  3463. +      *
  3464. +      *    Move the currently visible window area according to
  3465. +      *    user input.
  3466. +      */
  3467. + VOID
  3468. + MoveAround(struct Gadget *Gadget,LONG How,gx_device *dev)
  3469. + {
  3470. +     LONG Storage;
  3471. +     if(GetAttr(PGA_Top,Gadget,&Storage))
  3472. +     {
  3473. +         LONG Max;
  3474. +         switch(Gadget -> GadgetID)
  3475. +         {
  3476. +             case HORIZONTAL_SCROLLER:
  3477. +                 Max = xdev -> super_width - xdev -> window -> GZZWidth;
  3478. +                 break;
  3479. +             case VERTICAL_SCROLLER:
  3480. +                 Max = xdev -> super_height - xdev -> window -> GZZHeight;
  3481. +                 break;
  3482. +         }
  3483. +         switch(How)
  3484. +         {
  3485. +             case MOVE_MIN:
  3486. +                 Storage = 0;
  3487. +                 break;
  3488. +             case MOVE_MAX:
  3489. +                 Storage = Max;
  3490. +                 break;
  3491. +             case MOVE_DOWN:
  3492. +                 if(Storage > xdev -> super_height / 100)
  3493. +                     Storage -= xdev -> super_height / 100;
  3494. +                 else
  3495. +                     Storage = 0;
  3496. +                 break;
  3497. +             case MOVE_FAR_DOWN:
  3498. +                 if(Storage > xdev -> super_height / 10)
  3499. +                     Storage -= xdev -> super_height / 10;
  3500. +                 else
  3501. +                     Storage = 0;
  3502. +                 break;
  3503. +             case MOVE_FAR_UP:
  3504. +                 if(Storage + xdev -> super_width / 10 < Max)
  3505. +                     Storage += xdev -> super_width / 10;
  3506. +                 else
  3507. +                     Storage = Max;
  3508. +                 break;
  3509. +             case MOVE_UP:
  3510. +                 if(Storage + xdev -> super_width / 100 < Max)
  3511. +                     Storage += xdev -> super_width / 100;
  3512. +                 else
  3513. +                     Storage = Max;
  3514. +                 break;
  3515. +         }
  3516. +         switch(Gadget -> GadgetID)
  3517. +         {
  3518. +             case HORIZONTAL_SCROLLER:
  3519. +                 if(LAYERXOFFSET(xdev -> window) != Storage)
  3520. +                 {
  3521. +                     ScrollLayer(NULL,xdev -> window -> RPort -> Layer,Storage - LAYERXOFFSET(xdev -> window),0);
  3522. +                     SetGadgetAttrs(Gadget,xdev -> window,NULL,
  3523. +                         PGA_Top,Storage,
  3524. +                     TAG_DONE);
  3525. +                 }
  3526. +                 break;
  3527. +             case VERTICAL_SCROLLER:
  3528. +                 if(LAYERYOFFSET(xdev -> window) != Storage)
  3529. +                 {
  3530. +                     ScrollLayer(NULL,xdev -> window -> RPort -> Layer,0,Storage - LAYERYOFFSET(xdev -> window));
  3531. +                     SetGadgetAttrs(Gadget,xdev -> window,NULL,
  3532. +                         PGA_Top,Storage,
  3533. +                     TAG_DONE);
  3534. +                 }
  3535. +                 break;
  3536. +         }
  3537. +     }
  3538. + }
  3539. +     /* DispatchSuperWindow(gx_device *dev):
  3540. +      *
  3541. +      *    Dispatch user window input.
  3542. +      */
  3543. + VOID
  3544. + DispatchSuperWindow(gx_device *dev)
  3545. + {
  3546. +     STATIC struct Gadget    *CurrentGadget = NULL;
  3547. +     struct IntuiMessage    *IntuiMessage;
  3548. +     ULONG             MsgClass,
  3549. +                  MsgCode,
  3550. +                  MsgQualifier;
  3551. +     struct Gadget        *MsgGadget;
  3552. +     while(IntuiMessage = (struct IntuiMessage *)GetMsg(xdev -> window -> UserPort))
  3553. +     {
  3554. +         MsgClass    = IntuiMessage -> Class;
  3555. +         MsgCode        = IntuiMessage -> Code;
  3556. +         MsgQualifier    = IntuiMessage -> Qualifier;
  3557. +         MsgGadget    = IntuiMessage -> IAddress;
  3558. +         ReplyMsg((struct Message *)IntuiMessage);
  3559. +         switch(MsgClass)
  3560. +         {
  3561. +             case IDCMP_VANILLAKEY:
  3562. +                 if(MsgCode == '\033' || MsgCode == '\003')
  3563. +                     Signal((struct Task *)xdev -> main,SIG_KILL);
  3564. +                 break;
  3565. +             case IDCMP_RAWKEY:
  3566. +                 switch(MsgCode)
  3567. +                 {
  3568. +                     case HELP_CODE:
  3569. +                         DisplayBeep(xdev -> window -> WScreen);
  3570. +                         break;
  3571. +                     case CURSORUP:
  3572. +                         if(MsgQualifier & IEQUALIFIER_CONTROL)
  3573. +                             MoveAround(xdev -> gadget[VERTICAL_SCROLLER],MOVE_MIN,dev);
  3574. +                         else
  3575. +                         {
  3576. +                             if(MsgQualifier & (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT))
  3577. +                                 MoveAround(xdev -> gadget[VERTICAL_SCROLLER],MOVE_FAR_DOWN,dev);
  3578. +                             else
  3579. +                                 MoveAround(xdev -> gadget[VERTICAL_SCROLLER],MOVE_DOWN,dev);
  3580. +                         }
  3581. +                         break;
  3582. +                     case CURSORLEFT:
  3583. +                         if(MsgQualifier & IEQUALIFIER_CONTROL)
  3584. +                             MoveAround(xdev -> gadget[HORIZONTAL_SCROLLER],MOVE_MIN,dev);
  3585. +                         else
  3586. +                         {
  3587. +                             if(MsgQualifier & (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT))
  3588. +                                 MoveAround(xdev -> gadget[HORIZONTAL_SCROLLER],MOVE_FAR_DOWN,dev);
  3589. +                             else
  3590. +                                 MoveAround(xdev -> gadget[HORIZONTAL_SCROLLER],MOVE_DOWN,dev);
  3591. +                         }
  3592. +                         break;
  3593. +                     case CURSORRIGHT:
  3594. +                         if(MsgQualifier & IEQUALIFIER_CONTROL)
  3595. +                             MoveAround(xdev -> gadget[HORIZONTAL_SCROLLER],MOVE_MAX,dev);
  3596. +                         else
  3597. +                         {
  3598. +                             if(MsgQualifier & (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT))
  3599. +                                 MoveAround(xdev -> gadget[HORIZONTAL_SCROLLER],MOVE_FAR_UP,dev);
  3600. +                             else
  3601. +                                 MoveAround(xdev -> gadget[HORIZONTAL_SCROLLER],MOVE_UP,dev);
  3602. +                         }
  3603. +                         break;
  3604. +                     case CURSORDOWN:
  3605. +                         if(MsgQualifier & IEQUALIFIER_CONTROL)
  3606. +                             MoveAround(xdev -> gadget[VERTICAL_SCROLLER],MOVE_MAX,dev);
  3607. +                         else
  3608. +                         {
  3609. +                             if(MsgQualifier & (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT))
  3610. +                                 MoveAround(xdev -> gadget[VERTICAL_SCROLLER],MOVE_FAR_UP,dev);
  3611. +                             else
  3612. +                                 MoveAround(xdev -> gadget[VERTICAL_SCROLLER],MOVE_UP,dev);
  3613. +                         }
  3614. +                         break;
  3615. +                     default:
  3616. +                         break;
  3617. +                 }
  3618. +                 break;
  3619. +             case IDCMP_CLOSEWINDOW:
  3620. +                 Signal((struct Task *)xdev -> main,SIG_KILL);
  3621. +                 break;
  3622. +             case IDCMP_GADGETDOWN:
  3623. +                 CurrentGadget = MsgGadget;
  3624. +                 WindowUpdate(MsgGadget,dev);
  3625. +                 break;
  3626. +             case IDCMP_GADGETUP:
  3627. +                 CurrentGadget = NULL;
  3628. +                 WindowUpdate(MsgGadget,dev);
  3629. +                 break;
  3630. +             case IDCMP_MOUSEMOVE:
  3631. +                 if(CurrentGadget)
  3632. +                     WindowUpdate(CurrentGadget,dev);
  3633. +                 break;
  3634. +             case IDCMP_IDCMPUPDATE:
  3635. +                 switch(GetTagData(GA_ID,0,(struct TagItem *)MsgGadget))
  3636. +                 {
  3637. +                     case UP_ARROW:
  3638. +                         MoveAround(xdev -> gadget[VERTICAL_SCROLLER],MOVE_DOWN,dev);
  3639. +                         break;
  3640. +                     case DOWN_ARROW:
  3641. +                         MoveAround(xdev -> gadget[VERTICAL_SCROLLER],MOVE_UP,dev);
  3642. +                         break;
  3643. +                     case LEFT_ARROW:
  3644. +                         MoveAround(xdev -> gadget[HORIZONTAL_SCROLLER],MOVE_DOWN,dev);
  3645. +                         break;
  3646. +                     case RIGHT_ARROW:
  3647. +                         MoveAround(xdev -> gadget[HORIZONTAL_SCROLLER],MOVE_UP,dev);
  3648. +                         break;
  3649. +                     default:
  3650. +                         break;
  3651. +                 }
  3652. +                 break;
  3653. +             case IDCMP_NEWSIZE:
  3654. +                 WindowResize(dev);
  3655. +                 break;
  3656. +             default:
  3657. +                 break;
  3658. +         }
  3659. +     }
  3660. + }
  3661. +     /* Simple routine to call the cleanup routine of a device,
  3662. +      * all devices are smart enough to handle shutdown in
  3663. +      * case they have not been opened yet.
  3664. +      */
  3665. + STATIC void __inline
  3666. + close_device(gx_device_amiga *dev)
  3667. + {
  3668. +     (*xdev -> procs -> close_device)((gx_device *)dev);
  3669. + }
  3670. +     /* devcleanup():
  3671. +      *
  3672. +      *    Clean up all devices, free all resources.
  3673. +      */
  3674. + void
  3675. + devcleanup()
  3676. + {
  3677. +     close_device(&gs_amiga_device);
  3678. +     close_device(&gs_amiga_low_device);
  3679. +     close_device(&gs_amiga_high_device);
  3680. +     close_device(&gs_amiga_super_device);
  3681. +     close_device(&gs_amiga_a2024_device);
  3682. +     close_device(&gs_amiga_picassoii_device);
  3683. +     close_device(&gs_amiga_custom_device);
  3684. +     close_device(&gs_amiga_printer_device);
  3685. +     close_device(&gs_amiga_ilbm_device);
  3686. + }
  3687. +     /* amiga_set_pen(gx_device *dev,gx_color_index color):
  3688. +      *
  3689. +      *    Sets the rendering pen and remembers the current
  3690. +      *    settings.
  3691. +      */
  3692. + STATIC VOID __inline
  3693. + amiga_set_pen(gx_device *dev,gx_color_index color)
  3694. + {
  3695. +     if(xdev -> last_pen != color)
  3696. +         SetAPen(xdev -> rport,xdev -> last_pen = color);
  3697. + }
  3698. +     /* amiga_map_rgb_color(gx_device *dev,gx_color_value red,gx_color_value green,gx_color_value blue):
  3699. +      *
  3700. +      *    Map a colour either to the black or the light rendering pen.
  3701. +      */
  3702. + gx_color_index
  3703. + amiga_map_rgb_color(gx_device *dev,gx_color_value red,gx_color_value green,gx_color_value blue)
  3704. + {
  3705. +     if((red | green | blue) > gx_max_color_value / 2)
  3706. +         return(LightPen);
  3707. +     else
  3708. +         return(DarkPen);
  3709. + }
  3710. +     /* amiga_map_color_rgb(gx_device *dev,gx_color_index color,gx_color_value rgb[3]):
  3711. +      *
  3712. +      *    Map the light/dark rendering pen to RGB values.
  3713. +      */
  3714. + int
  3715. + amiga_map_color_rgb(gx_device *dev,gx_color_index color,gx_color_value rgb[3])
  3716. + {
  3717. +     int i;
  3718. +     if(color == LightPen)
  3719. +     {
  3720. +         for(i = 0 ; i < 3 ; i++)
  3721. +             rgb[i] = gx_max_color_value;
  3722. +     }
  3723. +     else
  3724. +     {
  3725. +         for(i = 0 ; i < 3 ; i++)
  3726. +             rgb[i] = 0;
  3727. +     }
  3728. +     return(0);
  3729. + }
  3730. +     /* AllocatePens(struct ViewPort *VPort,LONG CubeSize):
  3731. +      *
  3732. +      *    Allocate shareable viewport pens.
  3733. +      */
  3734. + LONG *
  3735. + AllocatePens(struct ViewPort *VPort,LONG CubeSize)
  3736. + {
  3737. +     if(GfxBase -> LibNode . lib_Version >= 39)
  3738. +     {
  3739. +         LONG Total = CubeSize * CubeSize * CubeSize,*Pens;
  3740. +         if(Pens = (LONG *)AllocVec(sizeof(LONG) * Total,MEMF_ANY))
  3741. +         {
  3742. +             LONG i,r,g,b,max = CubeSize - 1;
  3743. +             for(i = 0 ; i < Total ; i++)
  3744. +                 Pens[i] = -1;
  3745. +             i = 0;
  3746. +             for(r = 0 ; r < CubeSize ; r++)
  3747. +             {
  3748. +                 for(g = 0 ; g < CubeSize ; g++)
  3749. +                 {
  3750. +                     for(b = 0 ; b < CubeSize ; b++)
  3751. +                     {
  3752. +                         if((Pens[i++] = ObtainBestPen(VPort -> ColorMap,SPREAD((255 * r) / max),SPREAD((255 * g) / max),SPREAD((255 * b) / max),
  3753. +                             OBP_FailIfBad,    TRUE,
  3754. +                             OBP_Precision,    PRECISION_IMAGE,
  3755. +                         TAG_DONE)) == -1)
  3756. +                         {
  3757. +                             FreeVec(Pens);
  3758. +                             return(NULL);
  3759. +                         }
  3760. +                     }
  3761. +                 }
  3762. +             }
  3763. +             return(Pens);
  3764. +         }
  3765. +     }
  3766. +     return(NULL);
  3767. + }
  3768. +     /* amiga_open_default(gx_device *dev):
  3769. +      *
  3770. +      *    Open the default device, i.e. a window on the Workbench screen.
  3771. +      */
  3772. + int
  3773. + amiga_open_default(gx_device *dev)
  3774. + {
  3775. +     struct Screen *DefaultScreen;
  3776. +         /* Get a lock on the default public screen. */
  3777. +     if(DefaultScreen = LockPubScreen(NULL))
  3778. +     {
  3779. +         struct DisplayInfo    DisplayInfo;
  3780. +         ULONG             Mode;
  3781. +             /* Get the default public screen display mode. */
  3782. +         Mode = GetVPModeID(&DefaultScreen -> ViewPort);
  3783. +             /* Inquire display mode information. */
  3784. +         if(GetDisplayInfoData(NULL,(APTR)&DisplayInfo,sizeof(struct DisplayInfo),DTAG_DISP,Mode))
  3785. +         {
  3786. +             LONG    ScreenWidth,
  3787. +                 ScreenHeight;
  3788. +             LONG    i;
  3789. +             float    Width,
  3790. +                 Height;
  3791. +             LONG    Depth;
  3792. +             if(GfxBase -> LibNode . lib_Version >= 39)
  3793. +                 Depth = GetBitMapAttr(DefaultScreen -> RastPort . BitMap,BMA_DEPTH);
  3794. +             else
  3795. +                 Depth = DefaultScreen -> RastPort . BitMap -> Depth;
  3796. +                 /* Determine screen view dimensions. */
  3797. +             if(DefaultScreen -> ViewPort . ColorMap -> cm_vpe)
  3798. +             {
  3799. +                 struct ViewPortExtra *Extra = DefaultScreen -> ViewPort . ColorMap -> cm_vpe;
  3800. +                 ScreenWidth    = Extra -> DisplayClip . MaxX - Extra -> DisplayClip . MinX + 1;
  3801. +                 ScreenHeight    = Extra -> DisplayClip . MaxY - Extra -> DisplayClip . MinY + 1;
  3802. +             }
  3803. +             else
  3804. +             {
  3805. +                 struct ViewPortExtra *Extra;
  3806. +                 if(Extra = (struct ViewPortExtra *)GfxLookUp(&DefaultScreen -> ViewPort))
  3807. +                 {
  3808. +                     ScreenWidth    = Extra -> DisplayClip . MaxX - Extra -> DisplayClip . MinX + 1;
  3809. +                     ScreenHeight    = Extra -> DisplayClip . MaxY - Extra -> DisplayClip . MinY + 1;
  3810. +                 }
  3811. +                 else
  3812. +                 {
  3813. +                     ScreenWidth    = DefaultScreen -> Width;
  3814. +                     ScreenHeight    = DefaultScreen -> Height;
  3815. +                 }
  3816. +             }
  3817. +                 /* Use the best guess, we will take the standard
  3818. +                  * low resolution x-dpi value and scale it by
  3819. +                  * the pixel speed.
  3820. +                  */
  3821. +             if(DisplayInfo . PixelSpeed)
  3822. +             {
  3823. +                 xdev -> x_pixels_per_inch = (35.0 * 140.0) / (float)DisplayInfo . PixelSpeed;
  3824. +                 xdev -> y_pixels_per_inch = (xdev -> x_pixels_per_inch * (float)DisplayInfo . Resolution . x) / (float)DisplayInfo . Resolution . y;
  3825. +             }
  3826. +             else
  3827. +             {
  3828. +                 xdev -> x_pixels_per_inch = 72.27;
  3829. +                 xdev -> y_pixels_per_inch = 72.27;
  3830. +             }
  3831. +             if(xdev -> width > 0 && xdev -> height > 0)
  3832. +             {
  3833. +                 xdev -> super_width    = xdev -> width;
  3834. +                 xdev -> super_height    = xdev -> height;
  3835. +             }
  3836. +             else
  3837. +             {
  3838. +                 if(xdev -> page_width > 0.0)
  3839. +                     xdev -> super_width = (LONG)(xdev -> page_width * xdev -> x_pixels_per_inch);
  3840. +                 else
  3841. +                     xdev -> super_width = 640;
  3842. +                 if(xdev -> page_height > 0.0)
  3843. +                     xdev -> super_height = (LONG)(xdev -> page_height * xdev -> y_pixels_per_inch);
  3844. +                 else
  3845. +                     xdev -> super_height = 512;
  3846. +             }
  3847. +                 /* Allocate a bitmap ready to be used for
  3848. +                  * rendering.
  3849. +                  */
  3850. +             if(xdev -> super_bitmap = CreateBitMap(xdev -> super_width,xdev -> super_height,Depth,BMF_DISPLAYABLE,DefaultScreen -> RastPort . BitMap,FALSE))
  3851. +             {
  3852. +                     /* Clear the bitplanes. */
  3853. +                 BltBitMap(xdev -> super_bitmap,0,0,xdev -> super_bitmap,0,0,xdev -> super_width,xdev -> super_height,0x00,(1 << xdev -> super_bitmap -> Depth) - 1,NULL);
  3854. +                     /* Create the scroller handles. */
  3855. +                 if(CreateScrollers(dev,DefaultScreen))
  3856. +                 {
  3857. +                     struct IBox ZoomBox;
  3858. +                         /* Set up the window alternate
  3859. +                          * position.
  3860. +                          */
  3861. +                     ZoomBox . Left        = 0;
  3862. +                     ZoomBox . Top        = DefaultScreen -> BarHeight + 1;
  3863. +                     ZoomBox . Width        = ScreenWidth;
  3864. +                     ZoomBox . Height    = ScreenHeight - ZoomBox . Top;
  3865. +                         /* Eventually, open the display window. */
  3866. +                     if(xdev -> window = OpenWindowTags(NULL,
  3867. +                         WA_InnerWidth,        MIN(DefaultScreen -> Width / 2,xdev -> super_width),
  3868. +                         WA_InnerHeight,        MIN(DefaultScreen -> Height / 2,xdev -> super_height),
  3869. +                         WA_CloseGadget,        TRUE,
  3870. +                         WA_DepthGadget,        TRUE,
  3871. +                         WA_SizeGadget,        TRUE,
  3872. +                         WA_SizeBRight,        TRUE,
  3873. +                         WA_SizeBBottom,        TRUE,
  3874. +                         WA_Zoom,        &ZoomBox,
  3875. +                         WA_DragBar,        TRUE,
  3876. +                         WA_NoCareRefresh,    TRUE,
  3877. +                         WA_GimmeZeroZero,    TRUE,
  3878. +                         WA_RMBTrap,        TRUE,
  3879. +                         WA_SuperBitMap,        xdev -> super_bitmap,
  3880. +                         WA_Gadgets,        xdev -> gadget[VERTICAL_SCROLLER],
  3881. +                         WA_CustomScreen,    DefaultScreen,
  3882. +                         WA_Title,        "Ghostscript Amiga output window",
  3883. +                     TAG_DONE))
  3884. +                     {
  3885. +                         if(xdev -> temp_rport = CreateTempRPort(xdev -> window -> RPort))
  3886. +                         {
  3887. +                             if(xdev -> temp_array = (UBYTE *)AllocVec((xdev -> window -> WScreen -> Width + 15) & ~15,MEMF_ANY))
  3888. +                             {
  3889. +                                 struct Task *Task;
  3890. +                                     /* Bring the window dispatcher task
  3891. +                                      * to life...
  3892. +                                      */
  3893. +                                 if(Task = (struct Task *)CreateTask("Ghostscript window dispatcher",5,DispatchTask,8192))
  3894. +                                 {
  3895. +                                     const sigset_t trapped = sigmask(SIGINT);
  3896. +                                         /* Cheap... */
  3897. +                                     Task -> tc_UserData = dev;
  3898. +                                         /* Who's calling? */
  3899. +                                     xdev -> main = (struct Process *)FindTask(NULL);
  3900. +                                         /* Don't let anybody interrupt us! */
  3901. +                                     sigprocmask(SIG_BLOCK,&trapped,NULL);
  3902. +                                     Forbid();
  3903. +                                         /* Wake it up. */
  3904. +                                     Signal(Task,SIG_HANDSHAKE);
  3905. +                                         /* Clear the handshake bit. */
  3906. +                                     SetSignal(0,SIG_HANDSHAKE);
  3907. +                                         /* Wait for the report. */
  3908. +                                     Wait(SIG_HANDSHAKE);
  3909. +                                     Permit();
  3910. +                                         /* Get the result. */
  3911. +                                     Task = xdev -> dispatcher;
  3912. +                                         /* Unblock signals. */
  3913. +                                     sigprocmask(SIG_UNBLOCK,&trapped,NULL);
  3914. +                                 }
  3915. +                                     /* Did we succeed in creating
  3916. +                                      * the dispatcher task?
  3917. +                                      */
  3918. +                                 if(Task)
  3919. +                                 {
  3920. +                                     UWORD    MaxValue    = 0,
  3921. +                                         MinValue    = 15000,
  3922. +                                         Value,
  3923. +                                         R,G,B;
  3924. +                                         /* Set the window limits. */
  3925. +                                     WindowLimits(xdev -> window,xdev -> window -> BorderLeft + MINIMUM_WIDTH + xdev -> window -> BorderRight,xdev -> window -> BorderTop + MINIMUM_HEIGHT + xdev -> window -> BorderBottom,xdev -> window -> BorderLeft + xdev -> super_width + xdev -> window -> BorderRight,xdev -> window -> BorderTop + xdev -> super_height + xdev -> window -> BorderBottom);
  3926. +                                         /* Update the sliders. */
  3927. +                                     WindowResize(dev);
  3928. +                                         /* Look for the darkest and the lightest screen colours. */
  3929. +                                     for(i = 0 ; i < MIN(xdev -> window -> WScreen -> ViewPort . ColorMap -> Count,(1 << Depth)) ; i++)
  3930. +                                     {
  3931. +                                         Value = GetRGB4(xdev -> window -> WScreen -> ViewPort . ColorMap,i);
  3932. +                                         R = (Value >> 8) & 0xF;
  3933. +                                         G = (Value >> 4) & 0xF;
  3934. +                                         B =  Value       & 0xF;
  3935. +                                             /* Luminance conversion included */
  3936. +                                         Value = R * 299 + G * 588 + B * 113;
  3937. +                                         if(Value > MaxValue)
  3938. +                                         {
  3939. +                                             MaxValue = Value;
  3940. +                                             LightPen = i;
  3941. +                                         }
  3942. +                                         if(Value < MinValue)
  3943. +                                         {
  3944. +                                             MinValue = Value;
  3945. +                                             DarkPen = i;
  3946. +                                         }
  3947. +                                     }
  3948. +                                         /* Fill in the rest. */
  3949. +                                     xdev -> width    = xdev -> super_width;
  3950. +                                     xdev -> height    = xdev -> super_height;
  3951. +                                     xdev -> rport    = xdev -> window -> RPort;
  3952. +                                         /* Does the display support
  3953. +                                          * at least eight colours?
  3954. +                                          */
  3955. +                                     if(Depth >= 3)
  3956. +                                     {
  3957. +                                         LONG cube_size,max;
  3958. +                                             /* Set up a fitting colour cube. */
  3959. +                                         for(cube_size = 6 ; cube_size >= 2 ; cube_size--)
  3960. +                                         {
  3961. +                                             if((max = cube_size * cube_size * cube_size) <= 1 << Depth)
  3962. +                                                 break;
  3963. +                                         }
  3964. +                                             /* Got enough colours? */
  3965. +                                         if(cube_size != 1)
  3966. +                                         {
  3967. +                                             LONG *Pens;
  3968. +                                                 /* Try to grab the cube colours,
  3969. +                                                  * making a colour display.
  3970. +                                                  */
  3971. +                                             if(Pens = AllocatePens(&xdev -> window -> WScreen -> ViewPort,cube_size))
  3972. +                                                 set_colour_device((gx_device_amiga *)dev,cube_size,Pens);
  3973. +                                         }
  3974. +                                     }
  3975. +                                     SetBPen(xdev -> rport,0);
  3976. +                                     SetDrMd(xdev -> rport,JAM2);
  3977. +                                     amiga_set_pen(dev,DarkPen);
  3978. +                                     UnlockPubScreen(NULL,DefaultScreen);
  3979. +                                     return(0);
  3980. +                                 }
  3981. +                                 else
  3982. +                                     perror("Ghostscript: failed to create dispatcher task");
  3983. +                             }
  3984. +                             else
  3985. +                                 perror("Ghostscript: failed to create temporary line buffer.");
  3986. +                         }
  3987. +                         else
  3988. +                             perror("Ghostscript: failed to create temporary raster port");
  3989. +                     }
  3990. +                     else
  3991. +                         perror("Ghostscript: failed to open window");
  3992. +                 }
  3993. +                 else
  3994. +                     perror("Ghostscript: failed to allocate scrollers");
  3995. +             }
  3996. +             else
  3997. +                 perror("Ghostscript: failed to allocate bitmap");
  3998. +         }
  3999. +         else
  4000. +             perror("Ghostscript: failed to get display mode information");
  4001. +         UnlockPubScreen(NULL,DefaultScreen);
  4002. +     }
  4003. +     else
  4004. +         perror("Ghostscript: failed to lock default public screen");
  4005. +     return(-1);
  4006. + }
  4007. +     /* amiga_open_low(gx_device *dev):
  4008. +      *
  4009. +      *    Open the low resolution device.
  4010. +      */
  4011. + int
  4012. + amiga_open_low(gx_device *dev)
  4013. + {
  4014. +     return(amiga_open(dev,LORES_KEY));
  4015. + }
  4016. +     /* amiga_open_high(gx_device *dev):
  4017. +      *
  4018. +      *    Open the high resolution device.
  4019. +      */
  4020. + int
  4021. + amiga_open_high(gx_device *dev)
  4022. + {
  4023. +     return(amiga_open(dev,HIRESLACE_KEY));
  4024. + }
  4025. +     /* amiga_open_super(gx_device *dev):
  4026. +      *
  4027. +      *    Open the super high resolution device.
  4028. +      */
  4029. + int
  4030. + amiga_open_super(gx_device *dev)
  4031. + {
  4032. +         /* Fall back to the default if not available. */
  4033. +     if(ModeNotAvailable(SUPERLACE_KEY))
  4034. +         return(amiga_open_high(dev));
  4035. +     else
  4036. +         return(amiga_open(dev,SUPERLACE_KEY));
  4037. + }
  4038. +     /* amiga_open_a2024(gx_device *dev):
  4039. +      *
  4040. +      *    Open the A2024 device.
  4041. +      */
  4042. + int
  4043. + amiga_open_a2024(gx_device *dev)
  4044. + {
  4045. +         /* Fall back to the default if not available. */
  4046. +     if(ModeNotAvailable(A2024TENHERTZ_KEY))
  4047. +         return(amiga_open_super(dev));
  4048. +     else
  4049. +         return(amiga_open(dev,A2024TENHERTZ_KEY));
  4050. + }
  4051. +     /* amiga_open_picassoii(gx_device *dev):
  4052. +      *
  4053. +      *    Open the Picasso II device.
  4054. +      */
  4055. + int
  4056. + amiga_open_picassoii(gx_device *dev)
  4057. + {
  4058. +         /* Fall back to the default if not available. */
  4059. +     if(ModeNotAvailable(0x40020002))
  4060. +         return(amiga_open_super(dev));
  4061. +     else
  4062. +         return(amiga_open(dev,0x40020002));
  4063. + }
  4064. + int
  4065. + amiga_open_custom(gx_device *dev)
  4066. + {
  4067. +     UBYTE    Buffer[256];
  4068. +     ULONG    ScreenID    = INVALID_ID;
  4069. +     BOOL    DontTouch    = FALSE;
  4070. +         /* First step: check for an environment variable to give
  4071. +          *             the name of the display mode to use.
  4072. +          */
  4073. +     if(GetVar("GSCUSTOMMODE",Buffer,256,NULL) != -1)
  4074. +     {
  4075. +         UBYTE PatternBuffer[516];
  4076. +             /* Set up the search pattern. */
  4077. +         if(ParsePatternNoCase(Buffer,PatternBuffer,516) >= 0)
  4078. +         {
  4079. +             ULONG CurrentID = INVALID_ID,ID;
  4080. +                 /* Scan the entire list. */
  4081. +             while((CurrentID = NextDisplayInfo(CurrentID)) != INVALID_ID)
  4082. +             {
  4083. +                     /* Valid mode? */
  4084. +                 if(!ModeNotAvailable(CurrentID))
  4085. +                 {
  4086. +                     struct NameInfo    NameInfo;
  4087. +                         /* Get the name information. */
  4088. +                     if(GetDisplayInfoData(NULL,&NameInfo,sizeof(struct NameInfo),DTAG_NAME,CurrentID))
  4089. +                     {
  4090. +                             /* Does the mode name match the pattern given? */
  4091. +                         if(MatchPatternNoCase(PatternBuffer,NameInfo . Name))
  4092. +                         {
  4093. +                             ScreenID = CurrentID;
  4094. +                                 /* Don't overwrite the variable contents. */
  4095. +                             DontTouch = TRUE;
  4096. +                             break;
  4097. +                         }
  4098. +                     }
  4099. +                 }
  4100. +             }
  4101. +         }
  4102. +     }
  4103. +     if(ScreenID == INVALID_ID && AslBase)
  4104. +     {
  4105. +         struct ScreenModeRequester *ScreenModeRequester;
  4106. +         if(ScreenModeRequester = (struct ScreenModeRequester *)AllocAslRequestTags(ASL_ScreenModeRequest,TAG_DONE))
  4107. +         {
  4108. +             if(AslRequestTags(ScreenModeRequester,
  4109. +                 ASLSM_TitleText,    "Select GhostScript screen display mode",
  4110. +                 ASLSM_MinDepth,        1,
  4111. +                 ASLSM_MaxDepth,        8,
  4112. +             TAG_DONE))
  4113. +                 ScreenID = ScreenModeRequester -> sm_DisplayID;
  4114. +             FreeAslRequest(ScreenModeRequester);
  4115. +         }
  4116. +     }
  4117. +         /* Fall back to the default if not available. */
  4118. +     if(ModeNotAvailable(ScreenID))
  4119. +         return(amiga_open_default(dev));
  4120. +     else
  4121. +     {
  4122. +         int result = amiga_open(dev,ScreenID);
  4123. +             /* If successful store the name of the
  4124. +              * screen mode selected.
  4125. +              */
  4126. +         if(!result && !DontTouch)
  4127. +         {
  4128. +             struct NameInfo    NameInfo;
  4129. +             if(GetDisplayInfoData(NULL,&NameInfo,sizeof(struct NameInfo),DTAG_NAME,ScreenID))
  4130. +                 SetVar("GSCUSTOMMODE",NameInfo . Name,-1,NULL);
  4131. +         }
  4132. +         return(result);
  4133. +     }
  4134. + }
  4135. +     /* amiga_open_printer(gx_device *dev):
  4136. +      *
  4137. +      *    Open the printer device.
  4138. +      */
  4139. + int
  4140. + amiga_open_printer(gx_device *dev)
  4141. + {
  4142. +     if(xdev -> port = CreateMsgPort())
  4143. +     {
  4144. +         if(xdev -> printer = (struct IODRPReq *)CreateIORequest(xdev -> port,sizeof(struct IODRPReq)))
  4145. +         {
  4146. +             if(!OpenDevice("printer.device",0,(struct IORequest *)xdev -> printer,0))
  4147. +             {
  4148. +                 if(xdev -> rport = (struct RastPort *)AllocVec(sizeof(struct RastPort),MEMF_ANY))
  4149. +                 {
  4150. +                     const sigset_t    trapped = sigmask(SIGINT);
  4151. +                     struct BitMap    DummyBitMap;
  4152. +                     UWORD        DummyLine[12];
  4153. +                     InitRastPort(xdev -> rport);
  4154. +                         /* Cook up a dummy bitmap to keep
  4155. +                          * `smart' drivers from complaining.
  4156. +                          */
  4157. +                     InitBitMap(&DummyBitMap,12,16,16);
  4158. +                     DummyBitMap . Planes[0] = (PLANEPTR)&DummyLine;
  4159. +                     xdev -> rport -> BitMap = &DummyBitMap;
  4160. +                         /* Query page size requirements. */
  4161. +                     xdev -> printer -> io_Command    = PRD_DUMPRPORT;
  4162. +                     xdev -> printer -> io_RastPort    = xdev -> rport;
  4163. +                     xdev -> printer -> io_SrcWidth    = 16;
  4164. +                     xdev -> printer -> io_SrcHeight    = 16;
  4165. +                     xdev -> printer -> io_Modes    = LORES_KEY;
  4166. +                     xdev -> printer -> io_Special    |= SPECIAL_FULLCOLS | SPECIAL_FULLROWS | SPECIAL_NOPRINT;
  4167. +                         /* Don't let them stop us now! */
  4168. +                     sigprocmask(SIG_BLOCK,&trapped,NULL);
  4169. +                         /* Ask for it... */
  4170. +                     if(!DoIO((struct IORequest *)xdev -> printer))
  4171. +                     {
  4172. +                         struct PrinterExtendedData    *PED;
  4173. +                         struct PrinterData        *PD;
  4174. +                         struct Preferences        *Prefs;
  4175. +                         LONG                 Depth,
  4176. +                                          NumColours,
  4177. +                                          CubeSize;
  4178. +                         LONG                 PageWidth,
  4179. +                                          PageHeight;
  4180. +                             /* Unblock ^C signal. */
  4181. +                         sigprocmask(SIG_UNBLOCK,&trapped,NULL);
  4182. +                         xdev -> printer -> io_Special &= ~(SPECIAL_FULLCOLS | SPECIAL_FULLROWS | SPECIAL_NOPRINT);
  4183. +                             /* Get the printer internal data. */
  4184. +                         PD    = (struct PrinterData *)xdev -> printer -> io_Device;
  4185. +                         PED    = &PD -> pd_SegmentData -> ps_PED;
  4186. +                         Prefs    = &PD -> pd_Preferences;
  4187. +                             /* Calculate the printer page size. */
  4188. +                         PageWidth    = PED -> ped_XDotsInch * (Prefs -> PrintRightMargin - Prefs -> PrintLeftMargin + 1);
  4189. +                         PageHeight    = PED -> ped_YDotsInch * Prefs -> PaperLength;
  4190. +                         switch(Prefs -> PrintPitch)
  4191. +                         {
  4192. +                             case PICA:
  4193. +                                 PageWidth /= 10;
  4194. +                                 break;
  4195. +                             case ELITE:
  4196. +                                 PageWidth /= 12;
  4197. +                                 break;
  4198. +                             case FINE:
  4199. +                                 PageWidth /= 15;
  4200. +                                 break;
  4201. +                         }
  4202. +                         switch(Prefs -> PrintSpacing)
  4203. +                         {
  4204. +                             case SIX_LPI:
  4205. +                                 PageHeight /= 6;
  4206. +                                 break;
  4207. +                             case EIGHT_LPI:
  4208. +                                 PageHeight /= 8;
  4209. +                                 break;
  4210. +                         }
  4211. +                         if(PageWidth > PED -> ped_MaxXDots)
  4212. +                             PageWidth = PED -> ped_MaxXDots;
  4213. +                         if(PageHeight > PED -> ped_MaxYDots && PED -> ped_MaxYDots)
  4214. +                             PageHeight = PED -> ped_MaxYDots;
  4215. +                             /* Set up the default colour values. */
  4216. +                         if(Prefs -> PrintShade == SHADE_BW)
  4217. +                         {
  4218. +                             Depth        = 1;
  4219. +                             NumColours    = 2;
  4220. +                             CubeSize    = 0;
  4221. +                         }
  4222. +                         else
  4223. +                         {
  4224. +                             Depth        = 12;
  4225. +                             NumColours    = 4096;
  4226. +                             CubeSize    = 16;
  4227. +                         }
  4228. +                             /* Get the page size */
  4229. +                         if(xdev -> width > 0 && xdev -> height > 0)
  4230. +                         {
  4231. +                             if(PageWidth < xdev -> width)
  4232. +                                 xdev -> width = PageWidth;
  4233. +                             if(PageHeight < xdev -> height)
  4234. +                                 xdev -> height = PageHeight;
  4235. +                         }
  4236. +                         else
  4237. +                         {
  4238. +                             xdev -> width    = PageWidth;
  4239. +                             xdev -> height    = PageHeight;
  4240. +                         }
  4241. +                             /* Get the DPI values */
  4242. +                         xdev -> x_pixels_per_inch    = (float)PED -> ped_XDotsInch;
  4243. +                         xdev -> y_pixels_per_inch    = (float)PED -> ped_YDotsInch;
  4244. +                             /* Try to allocate a suitable bitmap.
  4245. +                              * If an allocation fails, rescale the
  4246. +                              * colour cube and bitmap depth and
  4247. +                              * retry. Minimum are eight colours.
  4248. +                              */
  4249. +                         do
  4250. +                         {
  4251. +                                 /* Try to allocate the raster... */
  4252. +                             if(!(xdev -> bitmap = CreateBitMap(xdev -> width,xdev -> height,Depth,NULL,NULL,TRUE)))
  4253. +                             {
  4254. +                                     /* Any chance to rescale the cube? */
  4255. +                                 if(Depth < 2)
  4256. +                                     break;
  4257. +                                 else
  4258. +                                 {
  4259. +                                         /* One plane less... */
  4260. +                                     Depth--;
  4261. +                                         /* Rescale the cube. */
  4262. +                                     while(CubeSize >= 2)
  4263. +                                     {
  4264. +                                         if((NumColours = CubeSize * CubeSize * CubeSize) <= (1 << Depth))
  4265. +                                             break;
  4266. +                                         else
  4267. +                                             CubeSize--;
  4268. +                                     }
  4269. +                                         /* Less than eight colours? */
  4270. +                                     if(CubeSize < 2)
  4271. +                                         break;
  4272. +                                 }
  4273. +                             }
  4274. +                         }
  4275. +                         while(!xdev -> bitmap);
  4276. +                             /* Got the bitmap? */
  4277. +                         if(xdev -> bitmap)
  4278. +                         {
  4279. +                                 /* Allocate a suitable colour map. */
  4280. +                             if(xdev -> colormap = GetColorMap(NumColours))
  4281. +                             {
  4282. +                                     /* Black & white only? */
  4283. +                                 if(NumColours == 2)
  4284. +                                 {
  4285. +                                     SetRGB4CM(xdev -> colormap,0,0x0,0x0,0x0);
  4286. +                                     SetRGB4CM(xdev -> colormap,1,0xF,0xF,0xF);
  4287. +                                 }
  4288. +                                 else
  4289. +                                 {
  4290. +                                     LONG i = 0,r,g,b,max = CubeSize - 1;
  4291. +                                         /* Fill in the colour cube. */
  4292. +                                     for(r = 0 ; r < CubeSize ; r++)
  4293. +                                     {
  4294. +                                         for(g = 0 ; g < CubeSize ; g++)
  4295. +                                         {
  4296. +                                             for(b = 0 ; b < CubeSize ; b++)
  4297. +                                                 SetRGB4CM(xdev -> colormap,i++,(15 * r) / max,(15 * g) / max,(15 * b) / max);
  4298. +                                         }
  4299. +                                     }
  4300. +                                     set_colour_printer_device((gx_device_amiga *)dev,CubeSize);
  4301. +                                 }
  4302. +                                 xdev -> printer -> io_ColorMap    = xdev -> colormap;
  4303. +                                 xdev -> rport -> BitMap        = xdev -> bitmap;
  4304. +                                 return(0);
  4305. +                             }
  4306. +                             else
  4307. +                                 perror("Ghostscript: failed to allocate colour map");
  4308. +                         }
  4309. +                         else
  4310. +                         {
  4311. +                             char buffer[256];
  4312. +                             sprintf(buffer,"Ghostscript: failed to allocate raster (wanted %ld, largest %ld)",(xdev -> width + 15) / 8 * xdev -> height * Depth,AvailMem(MEMF_ANY | MEMF_LARGEST));
  4313. +                             perror(buffer);
  4314. +                         }
  4315. +                     }
  4316. +                     else
  4317. +                     {
  4318. +                         char buffer[256];
  4319. +                         sigprocmask(SIG_UNBLOCK,&trapped,NULL);
  4320. +                         sprintf(buffer,"Ghostscript: failed to query printer page size (error code #%ld)",xdev -> printer -> io_Error);
  4321. +                         perror(buffer);
  4322. +                     }
  4323. +                 }
  4324. +                 else
  4325. +                     perror("Ghostscript: failed to allocate raster port");
  4326. +             }
  4327. +             else
  4328. +             {
  4329. +                 char buffer[256];
  4330. +                 sprintf(buffer,"Ghostscript: failed to open printer.device (error code #%ld)",xdev -> printer -> io_Error);
  4331. +                 perror(buffer);
  4332. +             }
  4333. +         }
  4334. +         else
  4335. +             perror("Ghostscript: failed to allocate device driver");
  4336. +     }
  4337. +     else
  4338. +         perror("Ghostscript: failed to create io port");
  4339. +     return(-1);
  4340. + }
  4341. +     /* amiga_output_page_printer(gx_device *dev,int,int):
  4342. +      *
  4343. +      *    Send a bitmap to the printer.
  4344. +      */
  4345. + int
  4346. + amiga_output_page_printer(gx_device *dev,int num_copies,int flush)
  4347. + {
  4348. +     const sigset_t trapped = sigmask(SIGINT);
  4349. +     int result,i;
  4350. +     ULONG Signals;
  4351. +     xdev -> printer -> io_Command    = PRD_DUMPRPORT;
  4352. +     xdev -> printer -> io_SrcWidth    = xdev -> width;
  4353. +     xdev -> printer -> io_SrcHeight    = xdev -> height;
  4354. +     xdev -> printer -> io_DestCols    = xdev -> width;
  4355. +     xdev -> printer -> io_DestRows    = xdev -> height;
  4356. +         /* We cannot possibly allow being interrupted in the middle
  4357. +          * of a raster dump!
  4358. +          */
  4359. +     sigprocmask(SIG_BLOCK,&trapped,NULL);
  4360. +     for(i = 0 ; i < num_copies ; i++)
  4361. +     {
  4362. +         SetSignal(0,SIGBREAKF_CTRL_C | (1L << xdev -> port -> mp_SigBit));
  4363. +         SendIO((struct IORequest *)xdev -> printer);
  4364. +         Signals = Wait(SIGBREAKF_CTRL_C | (1L << xdev -> port -> mp_SigBit));
  4365. +         if(Signals & SIGBREAKF_CTRL_C)
  4366. +         {
  4367. +             char buffer[256];
  4368. +             if(!CheckIO((struct IORequest *)xdev -> printer))
  4369. +                 AbortIO((struct IORequest *)xdev -> printer);
  4370. +             WaitIO((struct IORequest *)xdev -> printer);
  4371. +             sprintf(buffer,"Ghostscript: printing aborted");
  4372. +             perror(buffer);
  4373. +             result = -1;
  4374. +             sigprocmask(SIG_UNBLOCK,&trapped,NULL);
  4375. +             break;
  4376. +         }
  4377. +         if(Signals & (1L << xdev -> port -> mp_SigBit))
  4378. +         {
  4379. +             if(WaitIO((struct IORequest *)xdev -> printer))
  4380. +             {
  4381. +                 char buffer[256];
  4382. +                 sprintf(buffer,"Ghostscript: failed to print raster (error code #%ld)",xdev -> printer -> io_Error);
  4383. +                 perror(buffer);
  4384. +                 result = -1;
  4385. +                 sigprocmask(SIG_UNBLOCK,&trapped,NULL);
  4386. +                 break;
  4387. +             }
  4388. +             else
  4389. +                 result = 0;
  4390. +         }
  4391. +     }
  4392. +     sigprocmask(SIG_UNBLOCK,&trapped,NULL);
  4393. +     return(result);
  4394. + }
  4395. +     /* amiga_close_printer(gx_device *dev):
  4396. +      *
  4397. +      *    Close the printer driver.
  4398. +      */
  4399. + int
  4400. + amiga_close_printer(gx_device *dev)
  4401. + {
  4402. +     if(xdev -> bitmap)
  4403. +     {
  4404. +         DeleteBitMap(xdev -> bitmap,TRUE);
  4405. +         xdev -> bitmap = NULL;
  4406. +     }
  4407. +     if(xdev -> rport)
  4408. +     {
  4409. +         FreeVec(xdev -> rport);
  4410. +         xdev -> rport = NULL;
  4411. +     }
  4412. +     if(xdev -> colormap)
  4413. +     {
  4414. +         FreeColorMap(xdev -> colormap);
  4415. +         xdev -> colormap = NULL;
  4416. +     }
  4417. +     if(xdev -> printer)
  4418. +     {
  4419. +         if(xdev -> printer -> io_Device)
  4420. +             CloseDevice((struct IORequest *)xdev -> printer);
  4421. +         DeleteIORequest(xdev -> printer);
  4422. +         xdev -> printer = NULL;
  4423. +     }
  4424. +     if(xdev -> port)
  4425. +     {
  4426. +         DeleteMsgPort(xdev -> port);
  4427. +         xdev -> port = NULL;
  4428. +     }
  4429. +     xdev -> width = xdev -> height = 0;
  4430. + /*    xdev -> x_pixels_per_inch = x_pixels_per_inch = 72.72;*/
  4431. +     return(0);
  4432. + }
  4433. +     /* amiga_get_bits(gx_device *dev,int y,byte *str,byte **actual_data):
  4434. +      *
  4435. +      *    Read the raster bits into a buffer.
  4436. +      */
  4437. + int
  4438. + amiga_get_bits(gx_device *dev,int y,byte *str,byte **actual_data)
  4439. + {
  4440. +     if(y < 0 || y > xdev -> height)
  4441. +         return(-1);
  4442. +     else
  4443. +     {
  4444. +         if(actual_data)
  4445. +             *actual_data = (byte *)(xdev -> bitmap -> Planes[0] + xdev -> bitmap -> BytesPerRow * y);
  4446. +         else
  4447. +             memcpy(str,xdev -> bitmap -> Planes[0] + xdev -> bitmap -> BytesPerRow * y,xdev -> bitmap -> BytesPerRow);
  4448. +         return(0);
  4449. +     }
  4450. + }
  4451. +     /* amiga_open(gx_device *dev,ULONG Mode):
  4452. +      *
  4453. +      *    Open a custom screen.
  4454. +      */
  4455. + int
  4456. + amiga_open(gx_device *dev,ULONG Mode)
  4457. + {
  4458. +     struct DisplayInfo    DisplayInfo;
  4459. +     struct DimensionInfo    DimensionInfo;
  4460. +         /* Get the display dimensions. */
  4461. +     if(GetDisplayInfoData(NULL,(APTR)&DisplayInfo,sizeof(struct DisplayInfo),DTAG_DISP,Mode) && GetDisplayInfoData(NULL,(APTR)&DimensionInfo,sizeof(struct DimensionInfo),DTAG_DIMS,Mode))
  4462. +     {
  4463. +             /* Two shades only, black & white */
  4464. +         STATIC struct ColorSpec Colours[] =
  4465. +         {
  4466. +              0,    0x0000, 0x0000, 0x0000,
  4467. +              1,    0xFFFF, 0xFFFF, 0xFFFF,
  4468. +             -1
  4469. +         };
  4470. +         float    Width,
  4471. +             Height;
  4472. +         LONG    i,cube_size,max;
  4473. +         LONG    ScreenWidth,
  4474. +             ScreenHeight,
  4475. +             ScreenDepth;
  4476. +             /* Start up with a maximum depth display. */
  4477. +         ScreenDepth = DimensionInfo . MaxDepth;
  4478. +             /* Check to see whether we will be able to
  4479. +              * build a colour display or not.
  4480. +              */
  4481. +         for(cube_size = 6 ; cube_size >= 2 ; cube_size--)
  4482. +         {
  4483. +             if((max = cube_size * cube_size * cube_size) <= 1 << ScreenDepth)
  4484. +                 break;
  4485. +         }
  4486. +             /* Got enough colours? */
  4487. +         if(cube_size != 1)
  4488. +             set_colour_device((gx_device_amiga *)dev,cube_size,NULL);
  4489. +         else
  4490. +         {
  4491. +             ScreenDepth = 1;
  4492. +             set_mono_device((gx_device_amiga *)dev);
  4493. +         }
  4494. +         if(xdev -> width > 0 && xdev -> height > 0)
  4495. +         {
  4496. +             Width    = xdev -> width;
  4497. +             Height    = xdev -> height;
  4498. +         }
  4499. +         else
  4500. +         {
  4501. +             if(xdev -> page_width > 0.0)
  4502. +                 Width = xdev -> page_width;
  4503. +             else
  4504. +                 Width = 0.0;
  4505. +             if(xdev -> page_height > 0.0)
  4506. +                 Height = xdev -> page_height;
  4507. +             else
  4508. +                 Height = 0.0;
  4509. +         }
  4510. +             /* Use the best guess, we will take the standard
  4511. +              * low resolution x-dpi value and scale it by
  4512. +              * the pixel speed.
  4513. +              */
  4514. +         if(DisplayInfo . PixelSpeed)
  4515. +         {
  4516. +             xdev -> x_pixels_per_inch = (35.0 * 140.0) / (float)DisplayInfo . PixelSpeed;
  4517. +             xdev -> y_pixels_per_inch = (xdev -> x_pixels_per_inch * (float)DisplayInfo . Resolution . x) / (float)DisplayInfo . Resolution . y;
  4518. +         }
  4519. +         else
  4520. +         {
  4521. +             xdev -> x_pixels_per_inch = 72.27;
  4522. +             xdev -> y_pixels_per_inch = 72.27;
  4523. +         }
  4524. +         if(Width > 0.0)
  4525. +             ScreenWidth = (LONG)(Width * xdev -> x_pixels_per_inch);
  4526. +         else
  4527. +             ScreenWidth = 0;
  4528. +         if(Height > 0.0)
  4529. +             ScreenHeight = (LONG)(Height * xdev -> y_pixels_per_inch);
  4530. +         else
  4531. +             ScreenHeight = 0;
  4532. +         if(ScreenWidth < DimensionInfo . MinRasterWidth || ScreenWidth > DimensionInfo . MaxRasterWidth)
  4533. +             ScreenWidth = 0;
  4534. +         if(ScreenHeight < DimensionInfo . MinRasterHeight || ScreenHeight > DimensionInfo . MaxRasterHeight)
  4535. +             ScreenHeight = 0;
  4536. +             /* Try to open a custom screen; if this fails, try to
  4537. +              * rescale the colour cube and retry.
  4538. +              */
  4539. +         do
  4540. +         {
  4541. +             if(!(xdev -> screen = OpenScreenTags(NULL,
  4542. +                 SA_Depth,    ScreenDepth,
  4543. +                 SA_Overscan,    OSCAN_TEXT,
  4544. +                 SA_Quiet,    TRUE,
  4545. +                 SA_Behind,    TRUE,
  4546. +                 SA_DisplayID,    Mode,
  4547. +                 SA_Colors,    Colours,
  4548. +                 SA_AutoScroll,    TRUE,
  4549. +                 SA_ShowTitle,    FALSE,
  4550. +                 SA_Title,    "Ghostscript Amiga output screen",
  4551. +                 ScreenWidth  > 0 ? SA_Width  : TAG_IGNORE,    ScreenWidth,
  4552. +                 ScreenHeight > 0 ? SA_Height : TAG_IGNORE,    ScreenHeight,
  4553. +             TAG_DONE)))
  4554. +             {
  4555. +                 if(ScreenDepth < 2)
  4556. +                     break;
  4557. +                 else
  4558. +                 {
  4559. +                     ScreenDepth--;
  4560. +                         /* Check to see whether we will be able to
  4561. +                          * build a colour display or not.
  4562. +                          */
  4563. +                     while(cube_size >= 2)
  4564. +                     {
  4565. +                         if((max = cube_size * cube_size * cube_size) <= 1 << ScreenDepth)
  4566. +                             break;
  4567. +                         else
  4568. +                             cube_size--;
  4569. +                     }
  4570. +                         /* Got enough colours? */
  4571. +                     if(cube_size == 1 || ScreenDepth == 1)
  4572. +                     {
  4573. +                             /* Obviously not. */
  4574. +                         ScreenDepth = 1;
  4575. +                         set_mono_device((gx_device_amiga *)dev);
  4576. +                     }
  4577. +                 }
  4578. +             }
  4579. +         }
  4580. +         while(!xdev -> screen);
  4581. +             /* Did we succeed in opening the screen? */
  4582. +         if(xdev -> screen)
  4583. +         {
  4584. +             if(xdev -> window = OpenWindowTags(NULL,
  4585. +                 WA_Left,    0,
  4586. +                 WA_Top,        0,
  4587. +                 WA_Width,    xdev -> screen -> Width,
  4588. +                 WA_Height,    xdev -> screen -> Height,
  4589. +                 WA_Backdrop,    TRUE,
  4590. +                 WA_RMBTrap,    TRUE,
  4591. +                 WA_Borderless,    TRUE,
  4592. +                 WA_CustomScreen,xdev -> screen,
  4593. +             TAG_DONE))
  4594. +             {
  4595. +                 xdev -> rport    = xdev -> window -> RPort;
  4596. +                 xdev -> width    = xdev -> screen -> Width;
  4597. +                 xdev -> height    = xdev -> screen -> Height;
  4598. +             }
  4599. +             else
  4600. +             {
  4601. +                 xdev -> rport    = &xdev -> screen -> RastPort;
  4602. +                 xdev -> width    = xdev -> screen -> Width;
  4603. +                 xdev -> height    = xdev -> screen -> Height;
  4604. +             }
  4605. +                 /* Establish defaults. */
  4606. +             DarkPen        = 0;
  4607. +             LightPen    = 1;
  4608. +             SetBPen(xdev -> rport,0);
  4609. +             SetDrMd(xdev -> rport,JAM2);
  4610. +                 /* Create the temporary drawing area. */
  4611. +             if(xdev -> temp_rport = CreateTempRPort(xdev -> rport))
  4612. +             {
  4613. +                 if(xdev -> temp_array = (UBYTE *)AllocVec((xdev -> screen -> Width + 15) & ~15,MEMF_ANY))
  4614. +                 {
  4615. +                         /* Colour output enabled? */
  4616. +                     if(xdev -> cube_size > 0)
  4617. +                     {
  4618. +                         LONG r,g,b,max = xdev -> cube_size - 1;
  4619. +                         i = 0;
  4620. +                             /* Build a suitable colour map. */
  4621. +                         if(GfxBase -> LibNode . lib_Version >= 39)
  4622. +                         {
  4623. +                             for(r = 0 ; r < xdev -> cube_size ; r++)
  4624. +                             {
  4625. +                                 for(g = 0 ; g < xdev -> cube_size ; g++)
  4626. +                                 {
  4627. +                                     for(b = 0 ; b < xdev -> cube_size ; b++)
  4628. +                                         SetRGB32(&xdev -> screen -> ViewPort,i++,SPREAD((255 * r) / max),SPREAD((255 * g) / max),SPREAD((255 * b) / max));
  4629. +                                 }
  4630. +                             }
  4631. +                         }
  4632. +                         else
  4633. +                         {
  4634. +                             for(r = 0 ; r < xdev -> cube_size ; r++)
  4635. +                             {
  4636. +                                 for(g = 0 ; g < xdev -> cube_size ; g++)
  4637. +                                 {
  4638. +                                     for(b = 0 ; b < xdev -> cube_size ; b++)
  4639. +                                         SetRGB4(&xdev -> screen -> ViewPort,i++,(15 * r) / max,(15 * g) / max,(15 * b) / max);
  4640. +                                 }
  4641. +                             }
  4642. +                         }
  4643. +                     }
  4644. +                 }
  4645. +                 else
  4646. +                 {
  4647. +                     perror("Ghostscript: failed to allocate temporary line");
  4648. +                     return(-1);
  4649. +                 }
  4650. +             }
  4651. +             else
  4652. +             {
  4653. +                 perror("Ghostscript: failed to allocate temporary raster");
  4654. +                 return(-1);
  4655. +             }
  4656. +             amiga_set_pen(dev,DarkPen);
  4657. +             return(0);
  4658. +         }
  4659. +         else
  4660. +             perror("Ghostscript: failed to open screen");
  4661. +     }
  4662. +     else
  4663. +         perror("Ghostscript: failed to get display mode information");
  4664. +     return(-1);
  4665. + }
  4666. +     /* amiga_output_page(gx_device *dev,int,int):
  4667. +      *
  4668. +      *    Page is not `buffered', just bring screen/window
  4669. +      *    to the front.
  4670. +      */
  4671. + int
  4672. + amiga_output_page(gx_device *dev,int num_copies,int flush)
  4673. + {
  4674. +     if(xdev -> screen)
  4675. +         ScreenToFront(xdev -> screen);
  4676. +     else
  4677. +     {
  4678. +         if(xdev -> window)
  4679. +             WindowToFront(xdev -> window);
  4680. +     }
  4681. +     return(0);
  4682. + }
  4683. +     /* amiga_close(gx_device *dev):
  4684. +      *
  4685. +      *    Close the screen and free associated resources.
  4686. +      */
  4687. + int
  4688. + amiga_close(gx_device *dev)
  4689. + {
  4690. +     if(xdev -> dispatcher)
  4691. +     {
  4692. +         const sigset_t trapped = sigmask(SIGINT);
  4693. +         sigprocmask(SIG_BLOCK,&trapped,NULL);
  4694. +         Forbid();
  4695. +         Signal(xdev -> dispatcher,SIG_KILL);
  4696. +         SetSignal(0,SIG_HANDSHAKE);
  4697. +         Wait(SIG_HANDSHAKE);
  4698. +         Permit();
  4699. +         sigprocmask(SIG_UNBLOCK,&trapped,NULL);
  4700. +     }
  4701. +     if(xdev -> temp_array)
  4702. +     {
  4703. +         FreeVec(xdev -> temp_array);
  4704. +         xdev -> temp_array = NULL;
  4705. +     }
  4706. +     if(xdev -> pens)
  4707. +     {
  4708. +         LONG i;
  4709. +         for(i = 0 ; i < xdev -> cube_size * xdev -> cube_size * xdev -> cube_size ; i++)
  4710. +         {
  4711. +             if(xdev -> pens[i] != -1)
  4712. +                 ReleasePen(xdev -> window -> WScreen -> ViewPort . ColorMap,xdev -> pens[i]);
  4713. +         }
  4714. +         FreeVec(xdev -> pens);
  4715. +         xdev -> pens = NULL;
  4716. +     }
  4717. +     if(xdev -> temp_rport)
  4718. +     {
  4719. +         DeleteTempRPort(xdev -> temp_rport);
  4720. +         xdev -> temp_rport = NULL;
  4721. +     }
  4722. +     if(xdev -> window)
  4723. +     {
  4724. +         CloseWindow(xdev -> window);
  4725. +         xdev -> window = NULL;
  4726. +     }
  4727. +     DeleteScrollers(dev);
  4728. +     if(xdev -> super_bitmap)
  4729. +     {
  4730. +         DeleteBitMap(xdev -> super_bitmap,FALSE);
  4731. +         xdev -> super_bitmap = NULL;
  4732. +     }
  4733. +     if(xdev -> screen)
  4734. +     {
  4735. +         CloseScreen(xdev -> screen);
  4736. +         xdev -> screen = NULL;
  4737. +     }
  4738. +     xdev -> width = xdev -> height = 0;
  4739. + /*    xdev -> x_pixels_per_inch = x_pixels_per_inch = 72.72;*/
  4740. +     return(0);
  4741. + }
  4742. +     /* amiga_fill_rectangle(gx_device *dev,int x,int y,int w,int h,gx_color_index color):
  4743. +      *
  4744. +      *    Fill a rectangle with a given colour. This one is simple as it can
  4745. +      *    be done with the Amiga graphics primitives.
  4746. +      */
  4747. + int
  4748. + amiga_fill_rectangle(gx_device *dev,int x,int y,int w,int h,gx_color_index color)
  4749. + {
  4750. +     if(x < 0 || x > xdev -> width - w || y < 0 || y > xdev -> height - h)
  4751. +         return(-1);
  4752. +     else
  4753. +     {
  4754. +         if(w > 0 && h > 0 && color != gx_no_color_index)
  4755. +         {
  4756. +             amiga_set_pen(dev,color);
  4757. +             RectFill(xdev -> rport,x,y,x + w - 1,y + h - 1);
  4758. +         }
  4759. +         return(0);
  4760. +     }
  4761. + }
  4762. +     /* amiga_copy_mono():
  4763. +      *
  4764. +      *    Copy a monochrome image. This operation requires a bit of work as
  4765. +      *    we cannot simply blit the image into the bitmap.
  4766. +      */
  4767. + int
  4768. + amiga_copy_mono(gx_device *dev,const UBYTE *base,int sourcex,int raster,gx_bitmap_id id,int x,int y,int w,int h,gx_color_index zero,gx_color_index one)
  4769. + {
  4770. +     if(y < 0 || x < 0 || w < 0 || h < 0)
  4771. +         return(-1);
  4772. +     else
  4773. +     {
  4774. +         if(w > 0 && h > 0)
  4775. +         {
  4776. +             LONG i,j;
  4777. +             if(zero == gx_no_color_index)
  4778. +             {
  4779. +                 if(one != gx_no_color_index)
  4780. +                 {
  4781. +                     do
  4782. +                     {
  4783. +                         ReadPixelLine8(xdev -> rport,x,y,w,xdev -> temp_array,xdev -> temp_rport);
  4784. +                         for(i = sourcex, j = 0 ; i < sourcex + w ; i++, j++)
  4785. +                         {
  4786. +                             if(base[i >> 3] & shift[i & 7])
  4787. +                                 xdev -> temp_array[j] = one;
  4788. +                         }
  4789. +                         WritePixelLine8(xdev -> rport,x,y,w,xdev -> temp_array,xdev -> temp_rport);
  4790. +                         base += raster;
  4791. +                         y++;
  4792. +                     }
  4793. +                     while(--h);
  4794. +                 }
  4795. +             }
  4796. +             else
  4797. +             {
  4798. +                 if(one == gx_no_color_index)
  4799. +                 {
  4800. +                     do
  4801. +                     {
  4802. +                         ReadPixelLine8(xdev -> rport,x,y,w,xdev -> temp_array,xdev -> temp_rport);
  4803. +                         for(i = sourcex, j = 0 ; i < w + sourcex ; i++, j++)
  4804. +                         {
  4805. +                             if(!(base[i >> 3] & shift[i & 7]))
  4806. +                                 xdev -> temp_array[j] = zero;
  4807. +                         }
  4808. +                         WritePixelLine8(xdev -> rport,x,y,w,xdev -> temp_array,xdev -> temp_rport);
  4809. +                         base += raster;
  4810. +                         y++;
  4811. +                     }
  4812. +                     while(--h);
  4813. +                 }
  4814. +                 else
  4815. +                 {
  4816. +                     do
  4817. +                     {
  4818. +                         for(i = sourcex, j = 0 ; i < w + sourcex ; i++, j++)
  4819. +                         {
  4820. +                             if(base[i >> 3] & shift[i & 7])
  4821. +                                 xdev -> temp_array[j] = one;
  4822. +                             else
  4823. +                                 xdev -> temp_array[j] = zero;
  4824. +                         }
  4825. +                         WritePixelLine8(xdev -> rport,x,y,w,xdev -> temp_array,xdev -> temp_rport);
  4826. +                         base += raster;
  4827. +                         y++;
  4828. +                     }
  4829. +                     while(--h);
  4830. +                 }
  4831. +             }
  4832. +         }
  4833. +         return(0);
  4834. +     }
  4835. + }
  4836. +     /* amiga_copy_color():
  4837. +      *
  4838. +      *    Copy a color image (oh well...). This is just the same as the
  4839. +      *    copy_mono() routine.
  4840. +      */
  4841. + int
  4842. + amiga_copy_color(gx_device *dev,const UBYTE *base,int sourcex,int raster,gx_bitmap_id id,int x,int y,int w,int h)
  4843. + {
  4844. +     if(y < 0 || x < 0 || w < 0 || h < 0)
  4845. +         return(-1);
  4846. +     else
  4847. +     {
  4848. +         if(w > 0 && h > 0)
  4849. +         {
  4850. +             LONG i,j;
  4851. +             do
  4852. +             {
  4853. +                 for(i = sourcex, j = 0 ; i < w + sourcex ; i++, j++)
  4854. +                 {
  4855. +                     if(base[i >> 3] & shift[i & 7])
  4856. +                         xdev -> temp_array[j] = DarkPen;
  4857. +                     else
  4858. +                         xdev -> temp_array[j] = LightPen;
  4859. +                 }
  4860. +                 WritePixelLine8(xdev -> rport,x,y,w,xdev -> temp_array,xdev -> temp_rport);
  4861. +                 base += raster;
  4862. +                 y++;
  4863. +             }
  4864. +             while(--h);
  4865. +         }
  4866. +         return(0);
  4867. +     }
  4868. + }
  4869. +     /* amiga_draw_line(gx_device *dev,int x0,int y0,int x1,int y1,gx_color_index color):
  4870. +      *
  4871. +      *    Draw a line between two points. This one is easy as it can be done
  4872. +      *    with the Amiga graphics primitives, the only glitch is having to reset
  4873. +      *    the last dot to its original colour.
  4874. +      */
  4875. + int
  4876. + amiga_draw_line(gx_device *dev,int x0,int y0,int x1,int y1,gx_color_index color)
  4877. + {
  4878. +     if(color != gx_no_color_index && (x0 != x1 || y0 != y1))
  4879. +     {
  4880. +         LONG pen;
  4881. +         pen = ReadPixel(xdev -> rport,x1,y1);
  4882. +         amiga_set_pen(dev,color);
  4883. +         Move(xdev -> rport,x0,y0);
  4884. +         Draw(xdev -> rport,x1,y1);
  4885. +         if(pen == color)
  4886. +         {
  4887. +             amiga_set_pen(dev,pen);
  4888. +             WritePixel(xdev -> rport,x1,y1);
  4889. +         }
  4890. +     }
  4891. +     return(0);
  4892. + }
  4893. +     /* amiga_copy_mono_raw():
  4894. +      *
  4895. +      *    Copy a monochrome image to a bitmap. Just watch the
  4896. +      *    astounding number of case switches.
  4897. +      */
  4898. + int
  4899. + amiga_copy_mono_raw(gx_device *dev,const UBYTE *base,int sourcex,int raster,gx_bitmap_id id,int x,int y,int w,int h,gx_color_index zero,gx_color_index one)
  4900. + {
  4901. +     if(y < 0 || x < 0 || w < 0 || h < 0)
  4902. +         return(-1);
  4903. +     else
  4904. +     {
  4905. +         if(w > 0 && h > 0)
  4906. +         {
  4907. +             LONG i,j,modulo = xdev -> rport -> BitMap -> BytesPerRow;
  4908. +             UBYTE *line;
  4909. +             w += sourcex;
  4910. +             line = xdev -> rport -> BitMap -> Planes[0] + y * xdev -> rport -> BitMap -> BytesPerRow;
  4911. +             if(zero == gx_no_color_index)
  4912. +             {
  4913. +                 if(one != gx_no_color_index)
  4914. +                 {
  4915. +                     if(one)
  4916. +                     {
  4917. +                         do
  4918. +                         {
  4919. +                             for(i = sourcex, j = x ; i < w ; i++, j++)
  4920. +                             {
  4921. +                                 if(base[i >> 3] & shift[i & 7])
  4922. +                                     line[j >> 3] |= shift[j & 7];
  4923. +                             }
  4924. +                             base += raster;
  4925. +                             line += modulo;
  4926. +                         }
  4927. +                         while(--h);
  4928. +                     }
  4929. +                     else
  4930. +                     {
  4931. +                         do
  4932. +                         {
  4933. +                             for(i = sourcex, j = x ; i < w ; i++, j++)
  4934. +                             {
  4935. +                                 if(base[i >> 3] & shift[i & 7])
  4936. +                                     line[j >> 3] &= masks[j & 7];
  4937. +                             }
  4938. +                             base += raster;
  4939. +                             line += modulo;
  4940. +                         }
  4941. +                         while(--h);
  4942. +                     }
  4943. +                 }
  4944. +             }
  4945. +             else
  4946. +             {
  4947. +                 if(one == gx_no_color_index)
  4948. +                 {
  4949. +                     if(zero)
  4950. +                     {
  4951. +                         do
  4952. +                         {
  4953. +                             for(i = sourcex, j = x ; i < w ; i++, j++)
  4954. +                             {
  4955. +                                 if(!(base[i >> 3] & shift[i & 7]))
  4956. +                                     line[j >> 3] |= shift[j & 7];
  4957. +                             }
  4958. +                             base += raster;
  4959. +                             line += modulo;
  4960. +                         }
  4961. +                         while(--h);
  4962. +                     }
  4963. +                     else
  4964. +                     {
  4965. +                         do
  4966. +                         {
  4967. +                             for(i = sourcex, j = x ; i < w ; i++, j++)
  4968. +                             {
  4969. +                                 if(!(base[i >> 3] & shift[i & 7]))
  4970. +                                     line[j >> 3] &= masks[j & 7];
  4971. +                             }
  4972. +                             base += raster;
  4973. +                             line += modulo;
  4974. +                         }
  4975. +                         while(--h);
  4976. +                     }
  4977. +                 }
  4978. +                 else
  4979. +                 {
  4980. +                     if(one)
  4981. +                     {
  4982. +                         do
  4983. +                         {
  4984. +                             for(i = sourcex, j = x ; i < w ; i++, j++)
  4985. +                             {
  4986. +                                 if(base[i >> 3] & shift[i & 7])
  4987. +                                     line[j >> 3] |= shift[j & 7];
  4988. +                                 else
  4989. +                                     line[j >> 3] &= masks[j & 7];
  4990. +                             }
  4991. +                             base += raster;
  4992. +                             line += modulo;
  4993. +                         }
  4994. +                         while(--h);
  4995. +                     }
  4996. +                     else
  4997. +                     {
  4998. +                         do
  4999. +                         {
  5000. +                             for(i = sourcex, j = x ; i < w ; i++, j++)
  5001. +                             {
  5002. +                                 if(base[i >> 3] & shift[i & 7])
  5003. +                                     line[j >> 3] &= masks[j & 7];
  5004. +                                 else
  5005. +                                     line[j >> 3] |= shift[j & 7];
  5006. +                             }
  5007. +                             base += raster;
  5008. +                             line += modulo;
  5009. +                         }
  5010. +                         while(--h);
  5011. +                     }
  5012. +                 }
  5013. +             }
  5014. +         }
  5015. +         return(0);
  5016. +     }
  5017. + }
  5018. +     /* amiga_copy_color_raw():
  5019. +      *
  5020. +      *    Copy a color image (oh well...). This is just the same as the
  5021. +      *    copy_mono() routine.
  5022. +      */
  5023. + int
  5024. + amiga_copy_color_raw(gx_device *dev,const UBYTE *base,int sourcex,int raster,gx_bitmap_id id,int x,int y,int w,int h)
  5025. + {
  5026. +     if(y < 0 || x < 0 || w < 0 || h < 0)
  5027. +         return(-1);
  5028. +     else
  5029. +     {
  5030. +         if(w > 0 && h > 0)
  5031. +         {
  5032. +             LONG i,j,modulo = xdev -> rport -> BitMap -> BytesPerRow;
  5033. +             UBYTE *line;
  5034. +             line = xdev -> rport -> BitMap -> Planes[0] + y * xdev -> rport -> BitMap -> BytesPerRow;
  5035. +             w += sourcex;
  5036. +             do
  5037. +             {
  5038. +                 for(i = sourcex, j = x ; i < w ; i++, j++)
  5039. +                 {
  5040. +                     if(base[i >> 3] & shift[i & 7])
  5041. +                         line[j >> 3] |= shift[j & 7];
  5042. +                     else
  5043. +                         line[j >> 3] &= masks[j & 7];
  5044. +                 }
  5045. +                 base += raster;
  5046. +                 line += modulo;
  5047. +             }
  5048. +             while(--h);
  5049. +         }
  5050. +         return(0);
  5051. +     }
  5052. + }
  5053. +     /* amiga_fill_rectangle_raw():
  5054. +      *
  5055. +      *    Fill a rectangular area in a bitmap.
  5056. +      */
  5057. + int
  5058. + amiga_fill_rectangle_raw(gx_device *dev,int x,int y,int w,int h,gx_color_index color)
  5059. + {
  5060. +     if(x < 0 || x > xdev -> width - w || y < 0 || y > xdev -> height - h)
  5061. +         return(-1);
  5062. +     else
  5063. +     {
  5064. +         if(w > 0 && h > 0 && color != gx_no_color_index)
  5065. +         {
  5066. +             UBYTE *line,startmask,endmask;
  5067. +             LONG right,mid,modulo = xdev -> rport -> BitMap -> BytesPerRow;
  5068. +             right    = x + w;
  5069. +             mid    = (right >> 3) - (x >> 3);
  5070. +             line    = xdev -> rport -> BitMap -> Planes[0] + y * xdev -> rport -> BitMap -> BytesPerRow + (x >> 3);
  5071. +             x    &= 7;
  5072. +             right    &= 7;
  5073. +             if(color)
  5074. +             {
  5075. +                 startmask    = 0xFF >> x;
  5076. +                 endmask        = ~(0xFF >> right);
  5077. +                 if(mid)
  5078. +                 {
  5079. +                     UBYTE *ptr;
  5080. +                     int i;
  5081. +                     do
  5082. +                     {
  5083. +                         ptr = line;
  5084. +                         *ptr++ |= startmask;
  5085. +                         i = mid;
  5086. +                         while(--i > 0)
  5087. +                             *ptr++ = 0xFF;
  5088. +                         *ptr |= endmask;
  5089. +                         line += modulo;
  5090. +                     }
  5091. +                     while(--h);
  5092. +                 }
  5093. +                 else
  5094. +                 {
  5095. +                     startmask &= endmask;
  5096. +                     do
  5097. +                     {
  5098. +                         *line |= startmask;
  5099. +                         line += modulo;
  5100. +                     }
  5101. +                     while(--h);
  5102. +                 }
  5103. +             }
  5104. +             else
  5105. +             {
  5106. +                 startmask    = ~(0xFF >> x);
  5107. +                 endmask        = 0xFF >> right;
  5108. +                 if(mid)
  5109. +                 {
  5110. +                     UBYTE *ptr;
  5111. +                     LONG i;
  5112. +                     do
  5113. +                     {
  5114. +                         ptr = line;
  5115. +                         *ptr++ &= startmask;
  5116. +                         i = mid;
  5117. +                         while(--i > 0)
  5118. +                             *ptr++ = 0x00;
  5119. +                         *ptr &= endmask;
  5120. +                         line += modulo;
  5121. +                     }
  5122. +                     while(--h);
  5123. +                 }
  5124. +                 else
  5125. +                 {
  5126. +                     startmask |= endmask;
  5127. +                     do
  5128. +                     {
  5129. +                         *line &= startmask;
  5130. +                         line += modulo;
  5131. +                     }
  5132. +                     while(--h);
  5133. +                 }
  5134. +             }
  5135. +         }
  5136. +         return(0);
  5137. +     }
  5138. + }
  5139. +     /* amiga_draw_line_raw():
  5140. +      *
  5141. +      *    Draw a hair line, your basic DDA algorithm;
  5142. +      *    keep your fingers crossed.
  5143. +      */
  5144. + int
  5145. + amiga_draw_line_raw(gx_device *dev,int x,int y,int x1,int y1,gx_color_index color)
  5146. + {
  5147. +     if(color != gx_no_color_index && (x != x1 || y != y1))
  5148. +     {
  5149. +         short xstep,ystep,dx,dy,diff,modulo;
  5150. +         UBYTE *line,*plane,pen;
  5151. +         LONG last;
  5152. +         modulo    = xdev -> rport -> BitMap -> BytesPerRow;
  5153. +         plane    = xdev -> rport -> BitMap -> Planes[0];
  5154. +         line    = &plane[y1 * modulo];
  5155. +         last    = y1;
  5156. +         pen    = line[x1 >> 3] & (x1 & 7);
  5157. +         dx = x1 - x;
  5158. +         dy = y1 - y;
  5159. +         if(dx < 0)
  5160. +         {
  5161. +             dx = -dx;
  5162. +             dy = -dy;
  5163. +             x = x1;
  5164. +             y = y1;
  5165. +         }
  5166. +         if(y != last)
  5167. +             line = &plane[(last = y) * modulo];
  5168. +         if(color)
  5169. +         {
  5170. +             line[x >> 3] |= shift[x & 7];
  5171. +             xstep = ystep = 0;
  5172. +             if(dy < 0)
  5173. +             {
  5174. +                 if(dx > -dy)
  5175. +                 {
  5176. +                     diff = -dx / 2;
  5177. +                     do
  5178. +                     {
  5179. +                         xstep++;
  5180. +                         if(diff > 0)
  5181. +                         {
  5182. +                             ystep--;
  5183. +                             diff = diff - dy - dx;
  5184. +                         }
  5185. +                         else
  5186. +                             diff -= dy;
  5187. +                         {
  5188. +                             LONG x1 = x + xstep,y1 = y + ystep;
  5189. +                             if(y1 != last)
  5190. +                                 line = &plane[(last = y1) * modulo];
  5191. +                             line[x1 >> 3] |= shift[x1 & 7];
  5192. +                         }
  5193. +                     }
  5194. +                     while(xstep < dx);
  5195. +                 }
  5196. +                 else
  5197. +                 {
  5198. +                     if(dx == -dy)
  5199. +                         diff = 0;
  5200. +                     else
  5201. +                         diff = -dy / 2;
  5202. +                     do
  5203. +                     {
  5204. +                         ystep--;
  5205. +                         if(diff > 0)
  5206. +                             diff -= dx;
  5207. +                         else
  5208. +                         {
  5209. +                             xstep++;
  5210. +                             diff = diff - dy - dx;
  5211. +                         }
  5212. +                         {
  5213. +                             LONG x1 = x + xstep,y1 = y + ystep;
  5214. +                             if(y1 != last)
  5215. +                                 line = &plane[(last = y1) * modulo];
  5216. +                             line[x1 >> 3] |= shift[x1 & 7];
  5217. +                         }
  5218. +                     }
  5219. +                     while(ystep > dy);
  5220. +                 }
  5221. +             }
  5222. +             else
  5223. +             {
  5224. +                 if(dx > dy)
  5225. +                 {
  5226. +                     diff = -dx / 2;
  5227. +                     do
  5228. +                     {
  5229. +                         xstep++;
  5230. +                         if(diff > 0)
  5231. +                         {
  5232. +                             ystep++;
  5233. +                             diff = diff + dy - dx;
  5234. +                         }
  5235. +                         else
  5236. +                             diff += dy;
  5237. +                         {
  5238. +                             LONG x1 = x + xstep,y1 = y + ystep;
  5239. +                             if(y1 != last)
  5240. +                                 line = &plane[(last = y1) * modulo];
  5241. +                             line[x1 >> 3] |= shift[x1 & 7];
  5242. +                         }
  5243. +                     }
  5244. +                     while(xstep < dx);
  5245. +                 }
  5246. +                 else
  5247. +                 {
  5248. +                     if(dx == dy)
  5249. +                         diff = 0;
  5250. +                     else
  5251. +                         diff = dy / 2;
  5252. +                     do
  5253. +                     {
  5254. +                         ystep++;
  5255. +                         if(diff > 0)
  5256. +                             diff -= dx;
  5257. +                         else
  5258. +                         {
  5259. +                             xstep++;
  5260. +                             diff = diff + dy - dx;
  5261. +                         }
  5262. +                         {
  5263. +                             LONG x1 = x + xstep,y1 = y + ystep;
  5264. +                             if(y1 != last)
  5265. +                                 line = &plane[(last = y1) * modulo];
  5266. +                             line[x1 >> 3] |= shift[x1 & 7];
  5267. +                         }
  5268. +                     }
  5269. +                     while(ystep < dy);
  5270. +                 }
  5271. +             }
  5272. +             if(!pen)
  5273. +             {
  5274. +                 if(y1 != last)
  5275. +                     line = &plane[(last = y1) * modulo];
  5276. +                 line[x1 >> 3] &= masks[x1 & 7];
  5277. +             }
  5278. +         }
  5279. +         else
  5280. +         {
  5281. +             line[x >> 3] &= masks[x & 7];
  5282. +             xstep = ystep = 0;
  5283. +             if(dy < 0)
  5284. +             {
  5285. +                 if(dx > -dy)
  5286. +                 {
  5287. +                     diff = -dx / 2;
  5288. +                     do
  5289. +                     {
  5290. +                         xstep++;
  5291. +                         if(diff > 0)
  5292. +                         {
  5293. +                             ystep--;
  5294. +                             diff = diff - dy - dx;
  5295. +                         }
  5296. +                         else
  5297. +                             diff -= dy;
  5298. +                         {
  5299. +                             LONG x1 = x + xstep,y1 = y + ystep;
  5300. +                             if(y1 != last)
  5301. +                                 line = &plane[(last = y1) * modulo];
  5302. +                             line[x1 >> 3] &= masks[x1 & 7];
  5303. +                         }
  5304. +                     }
  5305. +                     while(xstep < dx);
  5306. +                 }
  5307. +                 else
  5308. +                 {
  5309. +                     if(dx == -dy)
  5310. +                         diff = 0;
  5311. +                     else
  5312. +                         diff = -dy / 2;
  5313. +                     do
  5314. +                     {
  5315. +                         ystep--;
  5316. +                         if(diff > 0)
  5317. +                             diff -= dx;
  5318. +                         else
  5319. +                         {
  5320. +                             xstep++;
  5321. +                             diff = diff - dy - dx;
  5322. +                         }
  5323. +                         {
  5324. +                             LONG x1 = x + xstep,y1 = y + ystep;
  5325. +                             if(y1 != last)
  5326. +                                 line = &plane[(last = y1) * modulo];
  5327. +                             line[x1 >> 3] &= masks[x1 & 7];
  5328. +                         }
  5329. +                     }
  5330. +                     while(ystep > dy);
  5331. +                 }
  5332. +             }
  5333. +             else
  5334. +             {
  5335. +                 if(dx > dy)
  5336. +                 {
  5337. +                     diff = -dx / 2;
  5338. +                     do
  5339. +                     {
  5340. +                         xstep++;
  5341. +                         if(diff > 0)
  5342. +                         {
  5343. +                             ystep++;
  5344. +                             diff = diff + dy - dx;
  5345. +                         }
  5346. +                         else
  5347. +                             diff += dy;
  5348. +                         {
  5349. +                             LONG x1 = x + xstep,y1 = y + ystep;
  5350. +                             if(y1 != last)
  5351. +                                 line = &plane[(last = y1) * modulo];
  5352. +                             line[x1 >> 3] &= masks[x1 & 7];
  5353. +                         }
  5354. +                     }
  5355. +                     while(xstep < dx);
  5356. +                 }
  5357. +                 else
  5358. +                 {
  5359. +                     if(dx == dy)
  5360. +                         diff = 0;
  5361. +                     else
  5362. +                         diff =  dy / 2;
  5363. +                     do
  5364. +                     {
  5365. +                         ystep++;
  5366. +                         if(diff > 0)
  5367. +                             diff -= dx;
  5368. +                         else
  5369. +                         {
  5370. +                             xstep++;
  5371. +                             diff = diff + dy - dx;
  5372. +                         }
  5373. +                         {
  5374. +                             LONG x1 = x + xstep,y1 = y + ystep;
  5375. +                             if(y1 != last)
  5376. +                                 line = &plane[(last = y1) * modulo];
  5377. +                             line[x1 >> 3] &= masks[x1 & 7];
  5378. +                         }
  5379. +                     }
  5380. +                     while(ystep < dy);
  5381. +                 }
  5382. +             }
  5383. +             if(pen)
  5384. +             {
  5385. +                 if(y1 != last)
  5386. +                     line = &plane[(last = y1) * modulo];
  5387. +                 line[x1 >> 3] |= pen;
  5388. +             }
  5389. +         }
  5390. +     }
  5391. +     return(0);
  5392. + }
  5393. +     /* amiga_open_ilbm(gx_device *dev):
  5394. +      *
  5395. +      *    Open the ilbm device.
  5396. +      */
  5397. + int
  5398. + amiga_open_ilbm(gx_device *dev)
  5399. + {
  5400. +     if(xdev -> width <= 0 || xdev -> height <= 0)
  5401. +     {
  5402. +         if(xdev -> page_width > 0.0)
  5403. +             xdev -> width = (int)(xdev -> x_pixels_per_inch * xdev -> page_width);
  5404. +         else
  5405. +             xdev -> width = 640;
  5406. +         if(xdev -> page_height > 0.0)
  5407. +             xdev -> height = (int)(xdev -> y_pixels_per_inch * xdev -> page_height);
  5408. +         else
  5409. +             xdev -> height = 512;
  5410. +     }
  5411. +     if(xdev -> rport = (struct RastPort *)AllocVec(sizeof(struct RastPort),MEMF_ANY))
  5412. +     {
  5413. +         InitRastPort(xdev -> rport);
  5414. +         if(xdev -> bitmap = (struct BitMap *)AllocVec(sizeof(struct BitMap),MEMF_ANY))
  5415. +         {
  5416. +             InitBitMap(xdev -> bitmap,1,xdev -> width,xdev -> height);
  5417. +             if(xdev -> bitplane = AllocVec(xdev -> bitmap -> Rows * xdev -> bitmap -> BytesPerRow,MEMF_ANY | MEMF_CLEAR))
  5418. +             {
  5419. +                 xdev -> bitmap -> Planes[0]    = xdev -> bitplane;
  5420. +                 xdev -> rport -> BitMap        = xdev -> bitmap;
  5421. +                 xdev -> page_count        = 1;
  5422. +                 DarkPen        = 0;
  5423. +                 LightPen    = 1;
  5424. +                 return(0);
  5425. +             }
  5426. +             else
  5427. +             {
  5428. +                 char buffer[256];
  5429. +                 sprintf(buffer,"Ghostscript: failed to allocate raster (wanted %ld, largest %ld)",xdev -> bitmap -> Rows * xdev -> bitmap -> BytesPerRow,AvailMem(MEMF_ANY | MEMF_LARGEST));
  5430. +                 perror(buffer);
  5431. +             }
  5432. +         }
  5433. +         else
  5434. +             perror("Ghostscript: failed to allocate bitmap");
  5435. +     }
  5436. +     else
  5437. +         perror("Ghostscript: failed to allocate raster port");
  5438. +     return(-1);
  5439. + }
  5440. +     /* amiga_output_page_ilbm(gx_device *dev,int,int):
  5441. +      *
  5442. +      *    Send a bitmap to an IFF-ILBM file.
  5443. +      */
  5444. + int
  5445. + amiga_output_page_ilbm(gx_device *dev,int num_copies,int flush)
  5446. + {
  5447. +     const sigset_t trapped = sigmask(SIGINT);
  5448. +     char buffer[270];
  5449. +     LONG result = -1;
  5450. +     sprintf(buffer,"%s_%04d.ilbm",xdev -> file_name,xdev -> page_count);
  5451. +     fprintf(stdout,"\n\033[ASaving page Nº%d to \"%s\"...\033[K",xdev -> page_count,buffer);
  5452. +     fflush(stdout);
  5453. +     sigprocmask(SIG_BLOCK,&trapped,NULL);
  5454. +     if(SaveBitMap(buffer,xdev -> bitmap,xdev -> width,xdev -> height,(UWORD)xdev -> x_pixels_per_inch,xdev -> y_pixels_per_inch))
  5455. +     {
  5456. +         fprintf(stdout,"\n\033[APage saved to file \"%s\".\033[K\n",buffer);
  5457. +         result = 0;
  5458. +         xdev -> page_count;
  5459. +     }
  5460. +     else
  5461. +         perror("\n\033[AGhostscript: error saving page\033[K");
  5462. +     sigprocmask(SIG_UNBLOCK,&trapped,NULL);
  5463. +     return(result);
  5464. + }
  5465. +     /* amiga_close_ilbm(gx_device *dev):
  5466. +      *
  5467. +      *    Close the ilbm driver.
  5468. +      */
  5469. + int
  5470. + amiga_close_ilbm(gx_device *dev)
  5471. + {
  5472. +     if(xdev -> bitplane)
  5473. +     {
  5474. +         FreeVec(xdev -> bitplane);
  5475. +         xdev -> bitplane = NULL;
  5476. +     }
  5477. +     if(xdev -> bitmap)
  5478. +     {
  5479. +         FreeVec(xdev -> bitmap);
  5480. +         xdev -> bitmap = NULL;
  5481. +     }
  5482. +     if(xdev -> rport)
  5483. +     {
  5484. +         FreeVec(xdev -> rport);
  5485. +         xdev -> rport = NULL;
  5486. +     }
  5487. +     xdev -> width = xdev -> height = 0;
  5488. + /*    xdev -> x_pixels_per_inch = x_pixels_per_inch = 72.72;*/
  5489. +     return(0);
  5490. + }
  5491. + private const gs_prop_item props_amiga[] =
  5492. + {
  5493. +     prop_def("PageWidth",    prt_string),
  5494. +     prop_def("PageHeight",    prt_string),
  5495. +     prop_def("OutputFile",    prt_string)
  5496. + };
  5497. + int
  5498. + amiga_get_props(gx_device *dev,gs_prop_item *plist)
  5499. + {
  5500. +     int start = gx_default_get_props(dev,plist);
  5501. +     if(plist != 0)
  5502. +     {
  5503. +         gs_prop_item *pi = plist + start;
  5504. +         memcpy(pi,props_amiga,sizeof(props_amiga));
  5505. +         pi[0] . value .a.p.s    = "";
  5506. +         pi[0] . value .a.size    = -1;
  5507. +         pi[1] . value .a.p.s    = "";
  5508. +         pi[1] . value .a.size    = -1;
  5509. +         pi[2] . value .a.p.s    = "";
  5510. +         pi[2] . value .a.size    = -1;
  5511. +     }
  5512. +     return(start + (sizeof(props_amiga) / sizeof(gs_prop_item)));
  5513. + }
  5514. + int
  5515. + amiga_put_props(gx_device *dev,gs_prop_item *plist,int count)
  5516. + {
  5517. +     gs_prop_item *known[3];
  5518. +     LONG code = 0;
  5519. +     props_extract(plist,count,props_amiga,3,known,0);
  5520. +     if((code = gx_default_put_props(dev,plist,count)) < 0)
  5521. +         return(code);
  5522. +     else
  5523. +     {
  5524. +         if(known[0] != 0)
  5525. +         {
  5526. +             gs_prop_item *pn = known[0];
  5527. +             LONG size = pn -> value . a . size;
  5528. +             char temp[256];
  5529. +             if(size >= 256)
  5530. +             {
  5531. +                 pn -> status = pv_limitcheck;
  5532. +                 code = gs_error_limitcheck;
  5533. +             }
  5534. +             else
  5535. +             {
  5536. +                 memcpy(temp,pn -> value . a . p . s,size);
  5537. +                 temp[size] = 0;
  5538. +                 xdev -> page_width = GetInches(temp);
  5539. +                 if(xdev -> page_width <= 0.0)
  5540. +                 {
  5541. +                     xdev -> page_width = 0.0;
  5542. +                     pn -> status = pv_limitcheck;
  5543. +                     code = gs_error_limitcheck;
  5544. +                 }
  5545. +                 else
  5546. +                 {
  5547. +                     if(code == 0)
  5548. +                         code = 1;
  5549. +                 }
  5550. +             }
  5551. +         }
  5552. +         if(known[1] != 0)
  5553. +         {
  5554. +             gs_prop_item *pn = known[1];
  5555. +             LONG size = pn -> value . a . size;
  5556. +             char temp[256];
  5557. +             if(size >= 256)
  5558. +             {
  5559. +                 pn -> status = pv_limitcheck;
  5560. +                 code = gs_error_limitcheck;
  5561. +             }
  5562. +             else
  5563. +             {
  5564. +                 memcpy(temp,pn -> value . a . p . s,size);
  5565. +                 temp[size] = 0;
  5566. +                 xdev -> page_height = GetInches(temp);
  5567. +                 if(xdev -> page_height <= 0.0)
  5568. +                 {
  5569. +                     xdev -> page_height = 0.0;
  5570. +                     pn -> status = pv_limitcheck;
  5571. +                     code = gs_error_limitcheck;
  5572. +                 }
  5573. +                 else
  5574. +                 {
  5575. +                     if(code == 0)
  5576. +                         code = 1;
  5577. +                 }
  5578. +             }
  5579. +         }
  5580. +         if(known[2] != 0)
  5581. +         {
  5582. +             gs_prop_item *pn = known[2];
  5583. +             LONG size = pn -> value . a . size;
  5584. +             if(size >= 256)
  5585. +             {
  5586. +                 pn -> status = pv_limitcheck;
  5587. +                 code = gs_error_limitcheck;
  5588. +             }
  5589. +             else
  5590. +             {
  5591. +                 memcpy(xdev -> file_name,pn -> value . a . p . s,size);
  5592. +                 xdev -> file_name[size] = 0;
  5593. +             }
  5594. +         }
  5595. +         if(code < 0)
  5596. +             return_error(code);
  5597. +         if(xdev -> is_open && code)
  5598. +         {
  5599. +             LONG ccode = gs_closedevice(dev);
  5600. +             if(ccode < 0)
  5601. +                 return(ccode);
  5602. +         }
  5603. +         return(code);
  5604. +     }
  5605. + }
  5606. +     /* amiga_color_map_rgb_color(gx_device *dev,gx_color_value red,gx_color_value green,gx_color_value blue):
  5607. +      *
  5608. +      *    Turn an RGB colour into a pen index.
  5609. +      */
  5610. + gx_color_index
  5611. + amiga_color_map_rgb_color(gx_device *dev,gx_color_value red,gx_color_value green,gx_color_value blue)
  5612. + {
  5613. +     LONG max = xdev -> cube_size - 1,r,g,b;
  5614. +     r = (max * red)   / gx_max_color_value;
  5615. +     g = (max * green) / gx_max_color_value;
  5616. +     b = (max * blue)  / gx_max_color_value;
  5617. +     return((r * xdev -> cube_size + g) * xdev -> cube_size + b);
  5618. + }
  5619. +     /* amiga_color_map_color_rgb(gx_device *dev,gx_color_index color,gx_color_value rgb[3]):
  5620. +      *
  5621. +      *    Turn a pen index into RGB colour values.
  5622. +      */
  5623. + int
  5624. + amiga_color_map_color_rgb(gx_device *dev,gx_color_index color,gx_color_value rgb[3])
  5625. + {
  5626. +     LONG i,value,max = xdev -> cube_size - 1;
  5627. +     for(i = 2 ; i >= 0 ; i--)
  5628. +     {
  5629. +         value = color % xdev -> cube_size;
  5630. +         rgb[i] = (gx_max_color_value * value) / max;
  5631. +         color /= xdev -> cube_size;
  5632. +     }
  5633. +     return(0);
  5634. + }
  5635. +     /* amiga_color_map_rgb_color_pen(gx_device *dev,gx_color_value red,gx_color_value green,gx_color_value blue):
  5636. +      *
  5637. +      *    Turn an RGB colour into a pen index; this routine takes remapped
  5638. +      *    pens into account.
  5639. +      */
  5640. + gx_color_index
  5641. + amiga_color_map_rgb_color_pen(gx_device *dev,gx_color_value red,gx_color_value green,gx_color_value blue)
  5642. + {
  5643. +     LONG max = xdev -> cube_size - 1,r,g,b;
  5644. +     r = (max * red)   / gx_max_color_value;
  5645. +     g = (max * green) / gx_max_color_value;
  5646. +     b = (max * blue)  / gx_max_color_value;
  5647. +     return(xdev -> pens[(r * xdev -> cube_size + g) * xdev -> cube_size + b]);
  5648. + }
  5649. +     /* amiga_color_map_color_rgb_pen(gx_device *dev,gx_color_index color,gx_color_value rgb[3]):
  5650. +      *
  5651. +      *    Turn a pen index into RGB colour values; this routine takes remapped
  5652. +      *    pens into account.
  5653. +      */
  5654. + int
  5655. + amiga_color_map_color_rgb_pen(gx_device *dev,gx_color_index color,gx_color_value rgb[3])
  5656. + {
  5657. +     LONG i,value,max = xdev -> cube_size - 1;
  5658. +         /* Find the matching pen... */
  5659. +     for(i = 0 ; i < xdev -> cube_size * xdev -> cube_size * xdev -> cube_size ; i++)
  5660. +     {
  5661. +         if(xdev -> pens[i] == color)
  5662. +         {
  5663. +             color = i;
  5664. +             break;
  5665. +         }
  5666. +     }
  5667. +     for(i = 2 ; i >= 0 ; i--)
  5668. +     {
  5669. +         value = color % xdev -> cube_size;
  5670. +         rgb[i] = (gx_max_color_value * value) / max;
  5671. +         color /= xdev -> cube_size;
  5672. +     }
  5673. +     return(0);
  5674. + }
  5675. +     /* amiga_copy_color8():
  5676. +      *
  5677. +      *    Copy a color image, the source is guaranteed to consist of
  5678. +      *    one byte per colour.
  5679. +      */
  5680. + int
  5681. + amiga_copy_color8(gx_device *dev,const UBYTE *base,int sourcex,int raster,gx_bitmap_id id,int x,int y,int w,int h)
  5682. + {
  5683. +     if(y < 0 || x < 0 || w < 0 || h < 0)
  5684. +         return(-1);
  5685. +     else
  5686. +     {
  5687. +         if(w > 0 && h > 0)
  5688. +         {
  5689. +             base += sourcex;
  5690. +             if(w > xdev -> width)
  5691. +                 w = xdev -> width;
  5692. +             do
  5693. +             {
  5694. +                 
  5695. +                 CopyMem((UBYTE *)base,xdev -> temp_array,w);
  5696. +                 WritePixelLine8(xdev -> rport,x,y++,w,xdev -> temp_array,xdev -> temp_rport);
  5697. +                 base += raster;
  5698. +             }
  5699. +             while(--h);
  5700. +         }
  5701. +         return(0);
  5702. +     }
  5703. + }
  5704. +     /* amiga_copy_mono_raw_color():
  5705. +      *
  5706. +      *    Copy a monochrome image to a bitmap.
  5707. +      */
  5708. + int
  5709. + amiga_copy_mono_raw_color(gx_device *dev,const UBYTE *base,int sourcex,int raster,gx_bitmap_id id,int x,int y,int w,int h,gx_color_index zero,gx_color_index one)
  5710. + {
  5711. +     if(y < 0 || x < 0 || w < 0 || h < 0)
  5712. +         return(-1);
  5713. +     else
  5714. +     {
  5715. +         if(w > 0 && h > 0 && zero != gx_no_color_index && one != gx_no_color_index)
  5716. +         {
  5717. +             PLANEPTR line[12];
  5718. +             LONG i,j,k,modulo = xdev -> rport -> BitMap -> BytesPerRow,depth = xdev -> rport -> BitMap -> Depth;
  5719. +             for(i = 0 ; i < depth ; i++)
  5720. +                 line[i] = xdev -> rport -> BitMap -> Planes[i] + y * modulo;
  5721. +             w += sourcex;
  5722. +             if(zero == gx_no_color_index)
  5723. +             {
  5724. +                 do
  5725. +                 {
  5726. +                     for(i = sourcex, j = x ; i < w ; i++, j++)
  5727. +                     {
  5728. +                         if(base[i >> 3] & shift[i & 7])
  5729. +                         {
  5730. +                             for(k = 0 ; k < depth ; k++)
  5731. +                             {
  5732. +                                 if(one & (1 << k))
  5733. +                                     line[k][j >> 3] |= shift[j & 7];
  5734. +                                 else
  5735. +                                     line[k][j >> 3] &= masks[j & 7];
  5736. +                             }
  5737. +                         }
  5738. +                     }
  5739. +                     base += raster;
  5740. +                     for(k = 0 ; k < depth ; k++)
  5741. +                         line[k] += modulo;
  5742. +                 }
  5743. +                 while(--h);
  5744. +             }
  5745. +             else
  5746. +             {
  5747. +                 if(one == gx_no_color_index)
  5748. +                 {
  5749. +                     do
  5750. +                     {
  5751. +                         for(i = sourcex, j = x ; i < w ; i++, j++)
  5752. +                         {
  5753. +                             if(base[i >> 3] & shift[i & 7])
  5754. +                             {
  5755. +                                 for(k = 0 ; k < depth ; k++)
  5756. +                                 {
  5757. +                                     if(zero & (1 << k))
  5758. +                                         line[k][j >> 3] |= shift[j & 7];
  5759. +                                     else
  5760. +                                         line[k][j >> 3] &= masks[j & 7];
  5761. +                                 }
  5762. +                             }
  5763. +                         }
  5764. +                         base += raster;
  5765. +                         for(k = 0 ; k < depth ; k++)
  5766. +                             line[k] += modulo;
  5767. +                     }
  5768. +                     while(--h);
  5769. +                 }
  5770. +                 else
  5771. +                 {
  5772. +                     do
  5773. +                     {
  5774. +                         for(i = sourcex, j = x ; i < w ; i++, j++)
  5775. +                         {
  5776. +                             if(base[i >> 3] & shift[i & 7])
  5777. +                             {
  5778. +                                 for(k = 0 ; k < depth ; k++)
  5779. +                                 {
  5780. +                                     if(one & (1 << k))
  5781. +                                         line[k][j >> 3] |= shift[j & 7];
  5782. +                                     else
  5783. +                                         line[k][j >> 3] &= masks[j & 7];
  5784. +                                 }
  5785. +                             }
  5786. +                             else
  5787. +                             {
  5788. +                                 for(k = 0 ; k < depth ; k++)
  5789. +                                 {
  5790. +                                     if(zero & (1 << k))
  5791. +                                         line[k][j >> 3] |= shift[j & 7];
  5792. +                                     else
  5793. +                                         line[k][j >> 3] &= masks[j & 7];
  5794. +                                 }
  5795. +                             }
  5796. +                         }
  5797. +                         base += raster;
  5798. +                         for(k = 0 ; k < depth ; k++)
  5799. +                             line[k] += modulo;
  5800. +                     }
  5801. +                     while(--h);
  5802. +                 }
  5803. +             }
  5804. +         }
  5805. +         return(0);
  5806. +     }
  5807. + }
  5808. +     /* amiga_copy_color_raw_color16():
  5809. +      *
  5810. +      *    Copy a color image, the source data is guaranteed to consist
  5811. +      *    of one word per colour.
  5812. +      */
  5813. + int
  5814. + amiga_copy_color_raw_color16(gx_device *dev,const UBYTE *data,int sourcex,int raster,gx_bitmap_id id,int x,int y,int w,int h)
  5815. + {
  5816. +     if(y < 0 || x < 0 || w < 0 || h < 0)
  5817. +         return(-1);
  5818. +     else
  5819. +     {
  5820. +         if(w > 0 && h > 0)
  5821. +         {
  5822. +             PLANEPTR line[12];
  5823. +             LONG i,j,k,modulo = xdev -> rport -> BitMap -> BytesPerRow,depth = xdev -> rport -> BitMap -> Depth;
  5824. +             UWORD *base = (UWORD *)data;
  5825. +             for(i = 0 ; i < depth ; i++)
  5826. +                 line[i] = xdev -> rport -> BitMap -> Planes[i] + y * modulo;
  5827. +             w += sourcex;
  5828. +             raster /= 2;
  5829. +             do
  5830. +             {
  5831. +                 for(i = sourcex, j = x ; i < w ; i++, j++)
  5832. +                 {
  5833. +                     for(k = 0 ; k < depth ; k++)
  5834. +                     {
  5835. +                         if(base[i] & (1 << k))
  5836. +                             line[k][j >> 3] |= shift[j & 7];
  5837. +                         else
  5838. +                             line[k][j >> 3] &= masks[j & 7];
  5839. +                     }
  5840. +                 }
  5841. +                 base += raster;
  5842. +                 for(k = 0 ; k < depth ; k++)
  5843. +                     line[k] += modulo;
  5844. +             }
  5845. +             while(--h);
  5846. +         }
  5847. +         return(0);
  5848. +     }
  5849. + }
  5850. +     /* amiga_fill_rectangle_raw_color():
  5851. +      *
  5852. +      *    Fill a rectangular area in a bitmap.
  5853. +      */
  5854. + int
  5855. + amiga_fill_rectangle_raw_color(gx_device *dev,int x,int y,int w,int h,gx_color_index color)
  5856. + {
  5857. +     if(x < 0 || x > xdev -> width - w || y < 0 || y > xdev -> height - h)
  5858. +         return(-1);
  5859. +     else
  5860. +     {
  5861. +         if(w > 0 && h > 0 && color != gx_no_color_index)
  5862. +         {
  5863. +             PLANEPTR line[12];
  5864. +             LONG i,j,right,mid,modulo = xdev -> rport -> BitMap -> BytesPerRow,depth = xdev -> rport -> BitMap -> Depth;
  5865. +             for(i = 0 ; i < depth ; i++)
  5866. +                 line[i] = xdev -> rport -> BitMap -> Planes[i] + y * modulo + (x >> 3);
  5867. +             right    = x + w;
  5868. +             mid    = (right >> 3) - (x >> 3);
  5869. +             x    &= 7;
  5870. +             right    &= 7;
  5871. +             if(mid)
  5872. +             {
  5873. +                 UBYTE *ptr;
  5874. +                 do
  5875. +                 {
  5876. +                     for(j = 0 ; j < depth ; j++)
  5877. +                     {
  5878. +                         ptr = line[j];
  5879. +                         i = mid;
  5880. +                         if(color & (1 << j))
  5881. +                         {
  5882. +                             *ptr++ |= 0xFF >> x;
  5883. +                             while(--i > 0)
  5884. +                                 *ptr++ = 0xFF;
  5885. +                             *ptr |= ~(0xFF >> right);
  5886. +                         }
  5887. +                         else
  5888. +                         {
  5889. +                             *ptr++ &= ~(0xFF >> x);
  5890. +                             while(--i > 0)
  5891. +                                 *ptr++ = 0x00;
  5892. +                             *ptr &= 0xFF >> right;
  5893. +                         }
  5894. +                         line[j] += modulo;
  5895. +                     }
  5896. +                 }
  5897. +                 while(--h);
  5898. +             }
  5899. +             else
  5900. +             {
  5901. +                 UBYTE    one_mask    = (0xFF >> x) & ~(0xFF >> right),
  5902. +                     zero_mask    = ~(0xFF >> x) | (0xFF >> right);
  5903. +                 do
  5904. +                 {
  5905. +                     for(j = 0 ; j < depth ; j++)
  5906. +                     {
  5907. +                         if(color & (1 << j))
  5908. +                             *line[j] |= one_mask;
  5909. +                         else
  5910. +                             *line[j] &= zero_mask;
  5911. +                         line[j] += modulo;
  5912. +                     }
  5913. +                 }
  5914. +                 while(--h);
  5915. +             }
  5916. +         }
  5917. +         return(0);
  5918. +     }
  5919. + }
  5920. +     /* amiga_draw_line_raw_color():
  5921. +      *
  5922. +      *    Draw a hair line, your basic DDA algorithm;
  5923. +      *    keep your fingers crossed.
  5924. +      */
  5925. + int
  5926. + amiga_draw_line_raw_color(gx_device *dev,int x,int y,int x1,int y1,gx_color_index color)
  5927. + {
  5928. +     if(color != gx_no_color_index && (x != x1 || y != y1))
  5929. +     {
  5930. +         LONG xstep,ystep,dx,dy,diff,modulo;
  5931. +         UBYTE *line,*plane,pen;
  5932. +         LONG last,i,orig_x = x,orig_y = y;
  5933. +         modulo = xdev -> rport -> BitMap -> BytesPerRow;
  5934. +         for(i = 0 ; i < xdev -> rport -> BitMap -> Depth ; i++)
  5935. +         {
  5936. +             plane    = xdev -> rport -> BitMap -> Planes[i];
  5937. +             line    = &plane[y1 * modulo];
  5938. +             last    = y1;
  5939. +             pen    = line[x1 >> 3] & (x1 & 7);
  5940. +             x    = orig_x;
  5941. +             y    = orig_y;
  5942. +             dx = x1 - x;
  5943. +             dy = y1 - y;
  5944. +             if(dx < 0)
  5945. +             {
  5946. +                 dx = -dx;
  5947. +                 dy = -dy;
  5948. +                 x = x1;
  5949. +                 y = y1;
  5950. +             }
  5951. +             if(y != last)
  5952. +                 line = &plane[(last = y) * modulo];
  5953. +             if(color & (1 << i))
  5954. +             {
  5955. +                 line[x >> 3] |= shift[x & 7];
  5956. +                 xstep = ystep = 0;
  5957. +                 if(dy < 0)
  5958. +                 {
  5959. +                     if(dx > -dy)
  5960. +                     {
  5961. +                         diff = -dx / 2;
  5962. +                         do
  5963. +                         {
  5964. +                             xstep++;
  5965. +                             if(diff > 0)
  5966. +                             {
  5967. +                                 ystep--;
  5968. +                                 diff = diff - dy - dx;
  5969. +                             }
  5970. +                             else
  5971. +                                 diff -= dy;
  5972. +                             {
  5973. +                                 LONG x1 = x + xstep,y1 = y + ystep;
  5974. +                                 if(y1 != last)
  5975. +                                     line = &plane[(last = y1) * modulo];
  5976. +                                 line[x1 >> 3] |= shift[x1 & 7];
  5977. +                             }
  5978. +                         }
  5979. +                         while(xstep < dx);
  5980. +                     }
  5981. +                     else
  5982. +                     {
  5983. +                         if(dx == -dy)
  5984. +                             diff = 0;
  5985. +                         else
  5986. +                             diff = -dy / 2;
  5987. +                         do
  5988. +                         {
  5989. +                             ystep--;
  5990. +                             if(diff > 0)
  5991. +                                 diff -= dx;
  5992. +                             else
  5993. +                             {
  5994. +                                 xstep++;
  5995. +                                 diff = diff - dy - dx;
  5996. +                             }
  5997. +                             {
  5998. +                                 LONG x1 = x + xstep,y1 = y + ystep;
  5999. +                                 if(y1 != last)
  6000. +                                     line = &plane[(last = y1) * modulo];
  6001. +                                 line[x1 >> 3] |= shift[x1 & 7];
  6002. +                             }
  6003. +                         }
  6004. +                         while(ystep > dy);
  6005. +                     }
  6006. +                 }
  6007. +                 else
  6008. +                 {
  6009. +                     if(dx > dy)
  6010. +                     {
  6011. +                         diff = -dx / 2;
  6012. +                         do
  6013. +                         {
  6014. +                             xstep++;
  6015. +                             if(diff > 0)
  6016. +                             {
  6017. +                                 ystep++;
  6018. +                                 diff = diff + dy - dx;
  6019. +                             }
  6020. +                             else
  6021. +                                 diff += dy;
  6022. +                             {
  6023. +                                 LONG x1 = x + xstep,y1 = y + ystep;
  6024. +                                 if(y1 != last)
  6025. +                                     line = &plane[(last = y1) * modulo];
  6026. +                                 line[x1 >> 3] |= shift[x1 & 7];
  6027. +                             }
  6028. +                         }
  6029. +                         while(xstep < dx);
  6030. +                     }
  6031. +                     else
  6032. +                     {
  6033. +                         if(dx == dy)
  6034. +                             diff = 0;
  6035. +                         else
  6036. +                             diff = dy / 2;
  6037. +                         do
  6038. +                         {
  6039. +                             ystep++;
  6040. +                             if(diff > 0)
  6041. +                                 diff -= dx;
  6042. +                             else
  6043. +                             {
  6044. +                                 xstep++;
  6045. +                                 diff = diff + dy - dx;
  6046. +                             }
  6047. +                             {
  6048. +                                 LONG x1 = x + xstep,y1 = y + ystep;
  6049. +                                 if(y1 != last)
  6050. +                                     line = &plane[(last = y1) * modulo];
  6051. +                                 line[x1 >> 3] |= shift[x1 & 7];
  6052. +                             }
  6053. +                         }
  6054. +                         while(ystep < dy);
  6055. +                     }
  6056. +                 }
  6057. +                 if(!pen)
  6058. +                 {
  6059. +                     if(y1 != last)
  6060. +                         line = &plane[(last = y1) * modulo];
  6061. +                     line[x1 >> 3] &= masks[x1 & 7];
  6062. +                 }
  6063. +             }
  6064. +             else
  6065. +             {
  6066. +                 line[x >> 3] &= masks[x & 7];
  6067. +                 xstep = ystep = 0;
  6068. +                 if(dy < 0)
  6069. +                 {
  6070. +                     if(dx > -dy)
  6071. +                     {
  6072. +                         diff = -dx / 2;
  6073. +                         do
  6074. +                         {
  6075. +                             xstep++;
  6076. +                             if(diff > 0)
  6077. +                             {
  6078. +                                 ystep--;
  6079. +                                 diff = diff - dy - dx;
  6080. +                             }
  6081. +                             else
  6082. +                                 diff -= dy;
  6083. +                             {
  6084. +                                 LONG x1 = x + xstep,y1 = y + ystep;
  6085. +                                 if(y1 != last)
  6086. +                                     line = &plane[(last = y1) * modulo];
  6087. +                                 line[x1 >> 3] &= masks[x1 & 7];
  6088. +                             }
  6089. +                         }
  6090. +                         while(xstep < dx);
  6091. +                     }
  6092. +                     else
  6093. +                     {
  6094. +                         if(dx == -dy)
  6095. +                             diff = 0;
  6096. +                         else
  6097. +                             diff = -dy / 2;
  6098. +                         do
  6099. +                         {
  6100. +                             ystep--;
  6101. +                             if(diff > 0)
  6102. +                                 diff -= dx;
  6103. +                             else
  6104. +                             {
  6105. +                                 xstep++;
  6106. +                                 diff = diff - dy - dx;
  6107. +                             }
  6108. +                             {
  6109. +                                 LONG x1 = x + xstep,y1 = y + ystep;
  6110. +                                 if(y1 != last)
  6111. +                                     line = &plane[(last = y1) * modulo];
  6112. +                                 line[x1 >> 3] &= masks[x1 & 7];
  6113. +                             }
  6114. +                         }
  6115. +                         while(ystep > dy);
  6116. +                     }
  6117. +                 }
  6118. +                 else
  6119. +                 {
  6120. +                     if(dx > dy)
  6121. +                     {
  6122. +                         diff = -dx / 2;
  6123. +                         do
  6124. +                         {
  6125. +                             xstep++;
  6126. +                             if(diff > 0)
  6127. +                             {
  6128. +                                 ystep++;
  6129. +                                 diff = diff + dy - dx;
  6130. +                             }
  6131. +                             else
  6132. +                                 diff += dy;
  6133. +                             {
  6134. +                                 LONG x1 = x + xstep,y1 = y + ystep;
  6135. +                                 if(y1 != last)
  6136. +                                     line = &plane[(last = y1) * modulo];
  6137. +                                 line[x1 >> 3] &= masks[x1 & 7];
  6138. +                             }
  6139. +                         }
  6140. +                         while(xstep < dx);
  6141. +                     }
  6142. +                     else
  6143. +                     {
  6144. +                         if(dx == dy)
  6145. +                             diff = 0;
  6146. +                         else
  6147. +                             diff =  dy / 2;
  6148. +                         do
  6149. +                         {
  6150. +                             ystep++;
  6151. +                             if(diff > 0)
  6152. +                                 diff -= dx;
  6153. +                             else
  6154. +                             {
  6155. +                                 xstep++;
  6156. +                                 diff = diff + dy - dx;
  6157. +                             }
  6158. +                             {
  6159. +                                 LONG x1 = x + xstep,y1 = y + ystep;
  6160. +                                 if(y1 != last)
  6161. +                                     line = &plane[(last = y1) * modulo];
  6162. +                                 line[x1 >> 3] &= masks[x1 & 7];
  6163. +                             }
  6164. +                         }
  6165. +                         while(ystep < dy);
  6166. +                     }
  6167. +                 }
  6168. +                 if(pen)
  6169. +                 {
  6170. +                     if(y1 != last)
  6171. +                         line = &plane[(last = y1) * modulo];
  6172. +                     line[x1 >> 3] |= pen;
  6173. +                 }
  6174. +             }
  6175. +         }
  6176. +     }
  6177. +     return(0);
  6178. + }
  6179. diff -rc --new-file ghostscript-2.6.1-fsf/gp_amiga.c ghostscript-2.6.1-amiga/gp_amiga.c
  6180. *** ghostscript-2.6.1-fsf/gp_amiga.c    Thu Jan  1 00:00:00 1970
  6181. --- ghostscript-2.6.1-amiga/gp_amiga.c    Sat Jan 29 15:11:38 1994
  6182. ***************
  6183. *** 0 ****
  6184. --- 1,346 ----
  6185. + /* Copyright (C) 1989, 1990, 1991 Aladdin Enterprises.  All rights reserved.
  6186. +    Distributed by Free Software Foundation, Inc.
  6187. + This file is part of Ghostscript.
  6188. + Ghostscript is distributed in the hope that it will be useful, but
  6189. + WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  6190. + to anyone for the consequences of using it or for whether it serves any
  6191. + particular purpose or works at all, unless he says so in writing.  Refer
  6192. + to the Ghostscript General Public License for full details.
  6193. + Everyone is granted permission to copy, modify and redistribute
  6194. + Ghostscript, but only under the conditions described in the Ghostscript
  6195. + General Public License.  A copy of this license is supposed to have been
  6196. + given to you along with Ghostscript so you can know your rights and
  6197. + responsibilities.  It should be in a file named COPYING.  Among other
  6198. + things, the copyright notice and this notice must be preserved on all
  6199. + copies.  */
  6200. + /* gp_amiga.c */
  6201. + /* Amiga specific routines for Ghostscript */
  6202. + #define timeval foo1
  6203. + #define ushort foo2
  6204. + #include <intuition/intuitionbase.h>
  6205. + #include <graphics/gfxbase.h>
  6206. + #include <dos/dosextens.h>
  6207. + #include <clib/exec_protos.h>
  6208. + #include <clib/dos_protos.h>
  6209. + /*
  6210. + #include <inline/exec.h>
  6211. + #include <inline/dos.h>
  6212. + */
  6213. + #include <signal.h>
  6214. + #undef ushort
  6215. + #undef timeval
  6216. + /* gp_amiga.c */
  6217. + /* Amiga-specific routines for Ghostscript */
  6218. + #include "memory_.h"
  6219. + #include "string_.h"
  6220. + #include "gx.h"
  6221. + #include "gp.h"
  6222. + #include "stat_.h"
  6223. + #include "time_.h"
  6224. + struct IntuitionBase    *IntuitionBase;
  6225. + struct GfxBase        *GfxBase;
  6226. + struct Library        *LayersBase,
  6227. +             *IFFParseBase,
  6228. +             *AslBase,
  6229. +             *UtilityBase;
  6230. + /* Nothing happens here */
  6231. + void
  6232. + gs_amiga_init()
  6233. + {
  6234. + }
  6235. + void
  6236. + gp_exit(int exit_status, int code)
  6237. + {
  6238. + }
  6239. + /* Cleanup routine, as called by atexit() trap */
  6240. + void
  6241. + cleanup()
  6242. + {
  6243. +     extern void devcleanup();
  6244. +     devcleanup();
  6245. +     if(IFFParseBase)
  6246. +     {
  6247. +         CloseLibrary(IFFParseBase);
  6248. +         IFFParseBase = NULL;
  6249. +     }
  6250. +     if(AslBase)
  6251. +     {
  6252. +         CloseLibrary(AslBase);
  6253. +         AslBase = NULL;
  6254. +     }
  6255. +     if(UtilityBase)
  6256. +     {
  6257. +         CloseLibrary(UtilityBase);
  6258. +         UtilityBase = NULL;
  6259. +     }
  6260. +     if(LayersBase)
  6261. +     {
  6262. +         CloseLibrary(LayersBase);
  6263. +         LayersBase = NULL;
  6264. +     }
  6265. +     if(GfxBase)
  6266. +     {
  6267. +         CloseLibrary((struct Library *)GfxBase);
  6268. +         GfxBase = NULL;
  6269. +     }
  6270. +     if(IntuitionBase)
  6271. +     {
  6272. +         CloseLibrary((struct Library *)IntuitionBase);
  6273. +         IntuitionBase = NULL;
  6274. +     }
  6275. + }
  6276. + void
  6277. + signal_handler(int signal)
  6278. + {
  6279. +     fprintf(stderr,"*** BREAK: Ghostscript\a\n");
  6280. +     exit(1);
  6281. + }
  6282. + /* Do platform-dependent initialization */
  6283. + void
  6284. + gp_init()
  6285. + {
  6286. +     atexit(cleanup);
  6287. +     signal(SIGINT,signal_handler);
  6288. +     if(!(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",37)))
  6289. +     {
  6290. +         perror("Ghostscript: cannot open intuition.library v37");
  6291. +         exit(20);
  6292. +     }
  6293. +     if(!(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",37)))
  6294. +     {
  6295. +         perror("Ghostscript: cannot open graphics.library v37");
  6296. +         exit(20);
  6297. +     }
  6298. +     if(!(LayersBase = OpenLibrary("layers.library",37)))
  6299. +     {
  6300. +         perror("Ghostscript: cannot open layers.library v37");
  6301. +         exit(20);
  6302. +     }
  6303. +     if(!(UtilityBase = OpenLibrary("utility.library",37)))
  6304. +     {
  6305. +         perror("Ghostscript: cannot open utility.library v37");
  6306. +         exit(20);
  6307. +     }
  6308. +     if(!(IFFParseBase = OpenLibrary("iffparse.library",37)))
  6309. +     {
  6310. +         perror("Ghostscript: cannot open iffparse.library v37");
  6311. +         exit(20);
  6312. +     }
  6313. +     AslBase = OpenLibrary("asl.library",38);
  6314. + }
  6315. + /* Read the current date (in days since Jan. 1, 1980) */
  6316. + /* and time (in milliseconds since midnight). */
  6317. + void
  6318. + gp_get_clock(long *pdt)
  6319. + {
  6320. +     struct DateStamp Date;
  6321. +     DateStamp(&Date);
  6322. +     pdt[0] = Date . ds_Days + 2 * 365;
  6323. +     pdt[1] = (Date . ds_Minute * 60 + Date . ds_Tick / TICKS_PER_SECOND) * 1000;
  6324. + }
  6325. + /* ------ Printer accessing ------ */
  6326. + /* Open a connection to a printer.  A null file name means use the */
  6327. + /* standard printer connected to the machine, if any. */
  6328. + /* "|command" opens an output pipe. */
  6329. + /* Return NULL if the connection could not be opened. */
  6330. + FILE *
  6331. + gp_open_printer(char *fname, int binary_mode)
  6332. + {    return
  6333. +       (strlen(fname) == 0 ?
  6334. +        gp_open_scratch_file(gp_scratch_file_name_prefix, fname, "w") :
  6335. +        fname[0] == '|' ?
  6336. +        popen(fname + 1, "w") :
  6337. +        fopen(fname, "w"));
  6338. + }
  6339. + /* Close the connection to the printer. */
  6340. + void
  6341. + gp_close_printer(FILE *pfile, const char *fname)
  6342. + {    if ( fname[0] == '|' )
  6343. +         pclose(pfile);
  6344. +     else
  6345. +         fclose(pfile);
  6346. + }
  6347. + /* ------ File name syntax ------ */
  6348. + /* Define the character used for separating file names in a list. */
  6349. + const char gp_file_name_list_separator = ',';
  6350. + /* Define the default scratch file name template. */
  6351. + const char gp_scratch_file_name_prefix[] = "T:gs_";
  6352. + /* Define the string to be concatenated with the file mode */
  6353. + /* for opening files without end-of-line conversion. */
  6354. + const char gp_fmode_binary_suffix[] = "b";
  6355. + /* Define the file modes for binary reading or writing. */
  6356. + const char gp_fmode_rb[] = "r";
  6357. + const char gp_fmode_wb[] = "w";
  6358. + /* Create and open a scratch file with a given name prefix. */
  6359. + /* Write the actual file name at fname. */
  6360. + FILE *
  6361. + gp_open_scratch_file(const char *prefix, char *fname, const char *mode)
  6362. + {
  6363. +     strcpy(fname,prefix);
  6364. +     /* Prevent trailing X's in path from being converted by mktemp. */
  6365. +     if ( *fname != 0 && fname[strlen(fname) - 1] == 'X' )
  6366. +         strcat(fname, "-");
  6367. +     strcat(fname, "XXXXXX");
  6368. +     mktemp(fname);
  6369. +     return fopen(fname, mode);
  6370. + }
  6371. + /* Answer whether a file name contains a directory/device specification, */
  6372. + /* i.e. is absolute (not directory- or device-relative). */
  6373. + int
  6374. + gp_file_name_is_absolute(const char *fname, uint len)
  6375. + {
  6376. +     int i;
  6377. +     for(i = 0 ; i < len ; i++)
  6378. +     {
  6379. +         if(fname[i] == ':')
  6380. +             return(1);
  6381. +     }
  6382. +     return(0);
  6383. + }
  6384. + /* Answer the string to be used for combining a directory/device prefix */
  6385. + /* with a base file name.  The file name is known to not be absolute. */
  6386. + const char *
  6387. + gp_file_name_concat_string(const char *prefix, uint plen, const char *fname, uint len)
  6388. + {
  6389. +     if(plen > 0 && (prefix[plen - 1] == '/' || prefix[plen - 1] == ':'))
  6390. +         return("");
  6391. +     else
  6392. +         return("/");
  6393. + }
  6394. + /* ------ File operations ------ */
  6395. + /* If the file given by fname exists, fill in its status and return 1; */
  6396. + /* otherwise return 0. */
  6397. + int
  6398. + gp_file_status(const char *fname, file_status *pstatus)
  6399. + {    struct stat sbuf;
  6400. +     /* The RS/6000 prototype for stat doesn't include const, */
  6401. +     /* so we have to explicitly remove the const modifier. */
  6402. +     if ( stat((char *)fname, &sbuf) < 0 ) return 0;
  6403. +     pstatus->size_pages = stat_blocks(&sbuf);    /* st_blocks is */
  6404. +                     /* missing on some systems, */
  6405. +                     /* see stat_.h */
  6406. +     pstatus->size_bytes = sbuf.st_size;
  6407. +     pstatus->time_referenced = sbuf.st_mtime;
  6408. +     pstatus->time_created = sbuf.st_ctime;
  6409. +     return 1;
  6410. + }
  6411. + /* ------ File enumeration ------ */
  6412. + /****** THIS IS NOT SUPPORTED ON UNIX SYSTEMS. ******/
  6413. + /* Amazingly enough, there is no standard Unix library routine */
  6414. + /* for enumerating the files matching a pattern, */
  6415. + /* or even for enumerating (conveniently) the files in a directory. */
  6416. + struct file_enum_s {
  6417. +     char *pattern;
  6418. +     int first_time;
  6419. +     const gs_memory_procs *mprocs;
  6420. + };
  6421. + /* Initialize an enumeration.  NEEDS WORK ON HANDLING * ? \. */
  6422. + file_enum *
  6423. + gp_enumerate_files_init(const char *pat, uint patlen,
  6424. +   const gs_memory_procs *mprocs)
  6425. + {    file_enum *pfen = (file_enum *)(*mprocs->alloc)(1, sizeof(file_enum), "gp_enumerate_files");
  6426. +     char *pattern;
  6427. +     if ( pfen == 0 ) return 0;
  6428. +     pattern = (*mprocs->alloc)(patlen + 1, 1,
  6429. +                 "gp_enumerate_files(pattern)");
  6430. +     if ( pattern == 0 ) return 0;
  6431. +     memcpy(pattern, pat, patlen);
  6432. +     pattern[patlen] = 0;
  6433. +     pfen->pattern = pattern;
  6434. +     pfen->mprocs = mprocs;
  6435. +     pfen->first_time = 1;
  6436. +     return pfen;
  6437. + }
  6438. + /* Enumerate the next file. */
  6439. + /* PUNT: JUST RETURN THE PATTERN. */
  6440. + uint
  6441. + gp_enumerate_files_next(file_enum *pfen, char *ptr, uint maxlen)
  6442. + {    if ( pfen->first_time )
  6443. +     {    char *pattern = pfen->pattern;
  6444. +         uint len = strlen(pattern);
  6445. +         pfen->first_time = 0;
  6446. +         if ( len > maxlen )
  6447. +             return maxlen + 1;
  6448. +         strcpy(ptr, pattern);
  6449. +         return len;
  6450. +     }
  6451. +     return -1;
  6452. + }
  6453. + /* Clean up the file enumeration. */
  6454. + void
  6455. + gp_enumerate_files_close(file_enum *pfen)
  6456. + {    const gs_memory_procs *mprocs = pfen->mprocs;
  6457. +     (*mprocs->free)(pfen->pattern, strlen(pfen->pattern) + 1, 1,
  6458. +             "gp_enumerate_files_close(pattern)");
  6459. +     (*mprocs->free)((char *)pfen, 1, sizeof(file_enum),
  6460. +             "gp_enumerate_files_close");
  6461. + }
  6462. diff -rc --new-file ghostscript-2.6.1-fsf/gs.1 ghostscript-2.6.1-amiga/gs.1
  6463. *** ghostscript-2.6.1-fsf/gs.1    Wed May 19 10:41:20 1993
  6464. --- ghostscript-2.6.1-amiga/gs.1    Tue Feb 22 13:49:34 1994
  6465. ***************
  6466. *** 154,160 ****
  6467.   3.
  6468.   The directory/ies specified by the GS_LIB_DEFAULT macro in the
  6469.   Ghostscript makefile (which has been set to
  6470. ! "/usr/local/lib/ghostscript:/usr/local/lib/ghostscript/fonts").
  6471.   .PP
  6472.   Each of these (GS_LIB_DEFAULT, GS_LIB, and \-I parameter) may be either
  6473.   a single directory, or a list of directories separated by a `:'.
  6474. --- 154,160 ----
  6475.   3.
  6476.   The directory/ies specified by the GS_LIB_DEFAULT macro in the
  6477.   Ghostscript makefile (which has been set to
  6478. ! "/gnu/lib/ghostscript:/gnu/lib/ghostscript/fonts").
  6479.   .PP
  6480.   Each of these (GS_LIB_DEFAULT, GS_LIB, and \-I parameter) may be either
  6481.   a single directory, or a list of directories separated by a `:'.
  6482. ***************
  6483. *** 320,335 ****
  6484.   device, as described above.
  6485.   .SH FILES
  6486.   .TP 
  6487. ! .B /usr/local/lib/ghostscript/*
  6488.   Startup-files, utilities, and basic font definitions.
  6489.   .TP 
  6490. ! .B /usr/local/lib/ghostscript/fonts/*
  6491.   Additional font definitions.
  6492.   .TP
  6493. ! .B /usr/local/lib/ghostscript/examples/*
  6494.   Demo Ghostscript files.
  6495.   .TP
  6496. ! .B /usr/local/lib/doc/ghostscript/doc/*
  6497.   Assorted document files.
  6498.   .SH "SEE ALSO"
  6499.   The various Ghostscript document files (above).
  6500. --- 320,335 ----
  6501.   device, as described above.
  6502.   .SH FILES
  6503.   .TP 
  6504. ! .B /gnu/lib/ghostscript/*
  6505.   Startup-files, utilities, and basic font definitions.
  6506.   .TP 
  6507. ! .B /gnu/lib/ghostscript/fonts/*
  6508.   Additional font definitions.
  6509.   .TP
  6510. ! .B /gnu/lib/ghostscript/examples/*
  6511.   Demo Ghostscript files.
  6512.   .TP
  6513. ! .B /gnu/lib/doc/ghostscript/doc/*
  6514.   Assorted document files.
  6515.   .SH "SEE ALSO"
  6516.   The various Ghostscript document files (above).
  6517. diff -rc --new-file ghostscript-2.6.1-fsf/gsaddmod ghostscript-2.6.1-amiga/gsaddmod
  6518. *** ghostscript-2.6.1-fsf/gsaddmod    Sun May 16 06:55:00 1993
  6519. --- ghostscript-2.6.1-amiga/gsaddmod    Sun Jan 30 12:28:23 1994
  6520. ***************
  6521. *** 1,3 ****
  6522.   export m; m=$1
  6523.   shift
  6524. ! echo $* >>${m}.dev
  6525. --- 1,4 ----
  6526.   export m; m=$1
  6527.   shift
  6528. ! # The builtin echo in pdksh is not up to this task.
  6529. ! /bin/echo $* >>${m}.dev
  6530. diff -rc --new-file ghostscript-2.6.1-fsf/gsnd ghostscript-2.6.1-amiga/gsnd
  6531. *** ghostscript-2.6.1-fsf/gsnd    Mon Feb  8 09:50:18 1993
  6532. --- ghostscript-2.6.1-amiga/gsnd    Thu Jan 27 21:39:59 1994
  6533. ***************
  6534. *** 1 ****
  6535. ! gs -DNODISPLAY $*
  6536. --- 1,4 ----
  6537. ! .key ARGS/F
  6538. ! .bra {
  6539. ! .ket }
  6540. ! gs -DNODISPLAY {ARGS}
  6541. diff -rc --new-file ghostscript-2.6.1-fsf/gssetdev ghostscript-2.6.1-amiga/gssetdev
  6542. *** ghostscript-2.6.1-fsf/gssetdev    Sun May 16 06:56:28 1993
  6543. --- ghostscript-2.6.1-amiga/gssetdev    Sun Jan 30 12:28:27 1994
  6544. ***************
  6545. *** 1,3 ****
  6546.   export m; m=$1
  6547.   shift
  6548. ! echo -dev ${m} -obj $* >${m}.dev
  6549. --- 1,4 ----
  6550.   export m; m=$1
  6551.   shift
  6552. ! # The builtin echo in pdksh is not up to this task.
  6553. ! /bin/echo -dev ${m} -obj $* >${m}.dev
  6554. diff -rc --new-file ghostscript-2.6.1-fsf/gssetmod ghostscript-2.6.1-amiga/gssetmod
  6555. *** ghostscript-2.6.1-fsf/gssetmod    Sun May 16 06:56:14 1993
  6556. --- ghostscript-2.6.1-amiga/gssetmod    Sun Jan 30 12:28:32 1994
  6557. ***************
  6558. *** 1,3 ****
  6559.   export m; m=$1
  6560.   shift
  6561. ! echo -obj $* >${m}.dev
  6562. --- 1,4 ----
  6563.   export m; m=$1
  6564.   shift
  6565. ! # The builtin echo in pdksh is not up to this task.
  6566. ! /bin/echo -obj $* >${m}.dev
  6567. diff -rc --new-file ghostscript-2.6.1-fsf/make.doc ghostscript-2.6.1-amiga/make.doc
  6568. *** ghostscript-2.6.1-fsf/make.doc    Fri May 28 22:57:00 1993
  6569. --- ghostscript-2.6.1-amiga/make.doc    Tue Feb 22 13:50:59 1994
  6570. ***************
  6571. *** 82,88 ****
  6572.   follows:
  6573.   
  6574.       - GS_LIB_DEFAULT: on Unix systems, /usr/local/lib/ghostscript
  6575. ! and /usr/local/lib/ghostscript/fonts; on MS-DOS systems, C:\GS.
  6576.   
  6577.       - TDEBUG: no debugging code included in the build.
  6578.   
  6579. --- 82,89 ----
  6580.   follows:
  6581.   
  6582.       - GS_LIB_DEFAULT: on Unix systems, /usr/local/lib/ghostscript
  6583. ! and /usr/local/lib/ghostscript/fonts; on MS-DOS systems, C:\GS; on AmigaDOS
  6584. ! systems, /gnu (aka gnu:)
  6585.   
  6586.       - TDEBUG: no debugging code included in the build.
  6587.   
  6588. diff -rc --new-file ghostscript-2.6.1-fsf/ps2ascii ghostscript-2.6.1-amiga/ps2ascii
  6589. *** ghostscript-2.6.1-fsf/ps2ascii    Thu Jan 27 21:23:52 1994
  6590. --- ghostscript-2.6.1-amiga/ps2ascii    Thu Jan 27 21:41:23 1994
  6591. ***************
  6592. *** 1,13 ****
  6593. ! #!/bin/sh -f
  6594. ! # Extract ASCII text from a PostScript file.  Usage:
  6595. ! #    ps2ascii [infile.ps [outfile.txt]]
  6596. ! # If outfile is omitted, output goes to stdout.
  6597. ! # If both infile and outfile are omitted, ps2ascii acts as a filter,
  6598. ! # reading from stdin and writing on stdout.
  6599. ! if ( test $# -eq 0 ) then
  6600. !     gs -q -dNODISPLAY -dNOBIND -dWRITESYSTEMDICT -dSIMPLE ps2ascii.ps - quit.ps
  6601. ! elif ( test $# -eq 1 ) then
  6602. !     gs -q -dNODISPLAY -dNOBIND -dWRITESYSTEMDICT -dSIMPLE ps2ascii.ps $1 quit.ps
  6603. ! else
  6604. !     gs -q -dNODISPLAY -dNOBIND -dWRITESYSTEMDICT -dSIMPLE ps2ascii.ps $1 quit.ps >$2
  6605. ! fi
  6606. --- 1,4 ----
  6607. ! .key IN/A,OUT/A
  6608. ! .bra {
  6609. ! .ket }
  6610. ! gs -q -dNODISPLAY -dNOBIND -dWRITESYSTEMDICT -dSIMPLE gs_2asc.ps {IN} quit.ps >{OUT}
  6611. diff -rc --new-file ghostscript-2.6.1-fsf/ps2epsi ghostscript-2.6.1-amiga/ps2epsi
  6612. *** ghostscript-2.6.1-fsf/ps2epsi    Fri May  7 18:39:56 1993
  6613. --- ghostscript-2.6.1-amiga/ps2epsi    Thu Jan 27 21:41:46 1994
  6614. ***************
  6615. *** 1,52 ****
  6616. ! #!/bin/sh
  6617.   
  6618. ! LOCALPATH=/usr/local/bin
  6619. ! PATH=/bin:/usr/bin:/usr/ucb\:$LOCALPATH\
  6620.   
  6621. ! export PATH outfile
  6622.   
  6623. ! if [ $# -lt 1 -o $# -gt 2 ]; then
  6624. !     echo "Usage: pstoepsi file.ps [file.epsi]" 1>&2
  6625. !     exit 1
  6626. ! fi
  6627.   
  6628. ! infile=$1
  6629. ! if [ $# -eq 1 ]
  6630. ! then
  6631. !     case "${infile}" in
  6632. !       *.ps)        base=`basename ${infile} .ps` ;;
  6633. !       *.cps)    base=`basename ${infile} .cps` ;;
  6634. !       *.eps)    base=`basename ${infile} .eps` ;;
  6635. !       *.epsf)    base=`basename ${infile} .epsf` ;;
  6636. !       *)        base=`basename ${infile}` ;;
  6637. !     esac
  6638. !     outfile=${base}.epsi
  6639. ! else
  6640. !     outfile=$2
  6641. ! fi
  6642. ! gs -q -dNOPAUSE -dNODISPLAY ps2epsi.ps < ${infile} 1>&2
  6643. ! (
  6644. ! cat << BEGINEPS
  6645. ! /InitDictCount countdictstack def
  6646. ! gsave
  6647. ! save
  6648. ! mark
  6649. ! newpath
  6650. ! /showpage {} def
  6651. ! BEGINEPS
  6652. ! cat ${infile}
  6653. ! cat << ENDEPS
  6654. ! countdictstack InitDictCount sub { end } repeat
  6655. ! cleartomark
  6656. ! restore
  6657. ! grestore
  6658. ! ENDEPS
  6659. ! ) >> ${outfile}
  6660. ! exit 0
  6661. --- 1,12 ----
  6662. ! .key IN/A,OUT/A
  6663. ! .bra [
  6664. ! .ket ]
  6665.   
  6666. ! gs -q -dNOPAUSE -dNODISPLAY ps2epsi.ps < [IN]
  6667.   
  6668. ! Echo "/InitDictCount countdictstack def gsave save mark newpath" >> [OUT]
  6669.   
  6670. ! type [OUT] >> [IN]
  6671.   
  6672. ! Echo "countdictstack InitDictCount sub { end } repeat" >> [OUT]
  6673. ! Echo "cleartomark restore grestore" >> [OUT]
  6674. diff -rc --new-file ghostscript-2.6.1-fsf/use.doc ghostscript-2.6.1-amiga/use.doc
  6675. *** ghostscript-2.6.1-fsf/use.doc    Thu Jan 27 21:27:38 1994
  6676. --- ghostscript-2.6.1-amiga/use.doc    Tue Feb 22 13:51:42 1994
  6677. ***************
  6678. *** 106,114 ****
  6679.   
  6680.   Installing Ghostscript on a Unix system requires compiling it first.
  6681.   The name of the executable is gs.  The makefile installs all the
  6682. ! files, except the fonts, in /usr/local or various subdirectories
  6683.   thereof.  The fonts should be installed in
  6684. ! /usr/local/lib/ghostscript/fonts.  Consult the makefile for more
  6685.   details.
  6686.   
  6687.   ********
  6688. --- 106,114 ----
  6689.   
  6690.   Installing Ghostscript on a Unix system requires compiling it first.
  6691.   The name of the executable is gs.  The makefile installs all the
  6692. ! files, except the fonts, in /gnu or various subdirectories
  6693.   thereof.  The fonts should be installed in
  6694. ! /gnu/lib/ghostscript/fonts.  Consult the makefile for more
  6695.   details.
  6696.   
  6697.   ********
  6698.