diff options
Diffstat (limited to 'filter')
-rw-r--r-- | filter/Dependencies | 156 | ||||
-rw-r--r-- | filter/Makefile | 32 | ||||
-rw-r--r-- | filter/form-main.c | 53 | ||||
-rw-r--r-- | filter/form-ps.c | 40 | ||||
-rw-r--r-- | filter/form-tree.c | 615 | ||||
-rw-r--r-- | filter/form.h | 168 | ||||
-rw-r--r-- | filter/hpgl-attr.c | 479 | ||||
-rw-r--r-- | filter/hpgl-char.c | 631 | ||||
-rw-r--r-- | filter/hpgl-config.c | 636 | ||||
-rw-r--r-- | filter/hpgl-input.c | 272 | ||||
-rw-r--r-- | filter/hpgl-main.c | 269 | ||||
-rw-r--r-- | filter/hpgl-polygon.c | 385 | ||||
-rw-r--r-- | filter/hpgl-prolog.c | 369 | ||||
-rw-r--r-- | filter/hpgl-vector.c | 773 | ||||
-rw-r--r-- | filter/hpgltops.h | 240 |
15 files changed, 19 insertions, 5099 deletions
diff --git a/filter/Dependencies b/filter/Dependencies index a50962a1a..59fc5065d 100644 --- a/filter/Dependencies +++ b/filter/Dependencies @@ -1,37 +1,5 @@ # DO NOT DELETE -hpgl-attr.o: hpgltops.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -hpgl-attr.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h -hpgl-attr.o: ../cups/file.h ../cups/language.h ../cups/language.h -hpgl-attr.o: ../cups/string.h ../config.h -hpgl-config.o: hpgltops.h common.h ../cups/cups.h ../cups/ipp.h -hpgl-config.o: ../cups/http.h ../cups/versioning.h ../cups/ppd.h -hpgl-config.o: ../cups/array.h ../cups/file.h ../cups/language.h -hpgl-config.o: ../cups/language.h ../cups/string.h ../config.h -hpgl-main.o: hpgltops.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -hpgl-main.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h -hpgl-main.o: ../cups/file.h ../cups/language.h ../cups/language.h -hpgl-main.o: ../cups/string.h ../config.h ../cups/i18n.h ../cups/transcode.h -hpgl-prolog.o: hpgltops.h common.h ../cups/cups.h ../cups/ipp.h -hpgl-prolog.o: ../cups/http.h ../cups/versioning.h ../cups/ppd.h -hpgl-prolog.o: ../cups/array.h ../cups/file.h ../cups/language.h -hpgl-prolog.o: ../cups/language.h ../cups/string.h ../config.h -hpgl-char.o: hpgltops.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -hpgl-char.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h -hpgl-char.o: ../cups/file.h ../cups/language.h ../cups/language.h -hpgl-char.o: ../cups/string.h ../config.h -hpgl-input.o: hpgltops.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -hpgl-input.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h -hpgl-input.o: ../cups/file.h ../cups/language.h ../cups/language.h -hpgl-input.o: ../cups/string.h ../config.h ../cups/i18n.h ../cups/transcode.h -hpgl-polygon.o: hpgltops.h common.h ../cups/cups.h ../cups/ipp.h -hpgl-polygon.o: ../cups/http.h ../cups/versioning.h ../cups/ppd.h -hpgl-polygon.o: ../cups/array.h ../cups/file.h ../cups/language.h -hpgl-polygon.o: ../cups/language.h ../cups/string.h ../config.h -hpgl-vector.o: hpgltops.h common.h ../cups/cups.h ../cups/ipp.h -hpgl-vector.o: ../cups/http.h ../cups/versioning.h ../cups/ppd.h -hpgl-vector.o: ../cups/array.h ../cups/file.h ../cups/language.h -hpgl-vector.o: ../cups/language.h ../cups/string.h ../config.h image-bmp.o: image-private.h image.h ../cups/raster.h ../cups/cups.h image-bmp.o: ../cups/ipp.h ../cups/http.h ../cups/versioning.h ../cups/ppd.h image-bmp.o: ../cups/array.h ../cups/file.h ../cups/language.h @@ -99,17 +67,6 @@ raster.o: image-private.h image.h ../cups/raster.h ../cups/cups.h raster.o: ../cups/ipp.h ../cups/http.h ../cups/versioning.h ../cups/ppd.h raster.o: ../cups/array.h ../cups/file.h ../cups/language.h ../cups/debug.h raster.o: ../cups/string.h ../config.h -form-main.o: form.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -form-main.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h -form-main.o: ../cups/file.h ../cups/language.h ../cups/language.h -form-main.o: ../cups/string.h ../config.h -form-ps.o: form.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -form-ps.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h -form-ps.o: ../cups/language.h ../cups/language.h ../cups/string.h ../config.h -form-tree.o: form.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -form-tree.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h -form-tree.o: ../cups/file.h ../cups/language.h ../cups/language.h -form-tree.o: ../cups/string.h ../config.h bannertops.o: pstext.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h bannertops.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h bannertops.o: ../cups/file.h ../cups/language.h ../cups/language.h @@ -120,8 +77,7 @@ commandtops.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h commandtops.o: ../cups/file.h ../cups/language.h ../cups/string.h ../config.h commandtops.o: ../cups/sidechannel.h gziptoany.o: ../cups/file.h ../cups/versioning.h ../cups/string.h ../config.h -gziptoany.o: ../cups/i18n.h ../cups/transcode.h ../cups/language.h -gziptoany.o: ../cups/array.h +gziptoany.o: ../cups/i18n.h ../cups/transcode.h imagetops.o: common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h imagetops.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h imagetops.o: ../cups/file.h ../cups/language.h ../cups/language.h @@ -147,9 +103,9 @@ pstops.o: common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h pstops.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h pstops.o: ../cups/language.h ../cups/language.h ../cups/string.h ../config.h pstops.o: ../cups/file.h ../cups/array.h ../cups/i18n.h ../cups/transcode.h -rasterbench.o: ../cups/raster.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -rasterbench.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h -rasterbench.o: ../cups/file.h ../cups/language.h +rasterbench.o: ../config.h ../cups/raster.h ../cups/cups.h ../cups/ipp.h +rasterbench.o: ../cups/http.h ../cups/versioning.h ../cups/ppd.h +rasterbench.o: ../cups/array.h ../cups/file.h ../cups/language.h rastertoepson.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h rastertoepson.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h rastertoepson.o: ../cups/file.h ../cups/language.h ../cups/ppd.h @@ -182,38 +138,6 @@ texttops.o: ../cups/language.h ../cups/language.h ../cups/string.h texttops.o: ../config.h ../cups/i18n.h ../cups/transcode.h # DO NOT DELETE -hpgl-attr.32.o: hpgl-attr.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -hpgl-attr.32.o: hpgl-attr.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h -hpgl-attr.32.o: hpgl-attr.c ../cups/file.h ../cups/language.h ../cups/language.h -hpgl-attr.32.o: hpgl-attr.c ../cups/string.h ../config.h -hpgl-config.32.o: hpgl-config.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h -hpgl-config.32.o: hpgl-config.c ../cups/http.h ../cups/versioning.h ../cups/ppd.h -hpgl-config.32.o: hpgl-config.c ../cups/array.h ../cups/file.h ../cups/language.h -hpgl-config.32.o: hpgl-config.c ../cups/language.h ../cups/string.h ../config.h -hpgl-main.32.o: hpgl-main.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -hpgl-main.32.o: hpgl-main.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h -hpgl-main.32.o: hpgl-main.c ../cups/file.h ../cups/language.h ../cups/language.h -hpgl-main.32.o: hpgl-main.c ../cups/string.h ../config.h ../cups/i18n.h ../cups/transcode.h -hpgl-prolog.32.o: hpgl-prolog.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h -hpgl-prolog.32.o: hpgl-prolog.c ../cups/http.h ../cups/versioning.h ../cups/ppd.h -hpgl-prolog.32.o: hpgl-prolog.c ../cups/array.h ../cups/file.h ../cups/language.h -hpgl-prolog.32.o: hpgl-prolog.c ../cups/language.h ../cups/string.h ../config.h -hpgl-char.32.o: hpgl-char.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -hpgl-char.32.o: hpgl-char.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h -hpgl-char.32.o: hpgl-char.c ../cups/file.h ../cups/language.h ../cups/language.h -hpgl-char.32.o: hpgl-char.c ../cups/string.h ../config.h -hpgl-input.32.o: hpgl-input.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -hpgl-input.32.o: hpgl-input.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h -hpgl-input.32.o: hpgl-input.c ../cups/file.h ../cups/language.h ../cups/language.h -hpgl-input.32.o: hpgl-input.c ../cups/string.h ../config.h ../cups/i18n.h ../cups/transcode.h -hpgl-polygon.32.o: hpgl-polygon.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h -hpgl-polygon.32.o: hpgl-polygon.c ../cups/http.h ../cups/versioning.h ../cups/ppd.h -hpgl-polygon.32.o: hpgl-polygon.c ../cups/array.h ../cups/file.h ../cups/language.h -hpgl-polygon.32.o: hpgl-polygon.c ../cups/language.h ../cups/string.h ../config.h -hpgl-vector.32.o: hpgl-vector.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h -hpgl-vector.32.o: hpgl-vector.c ../cups/http.h ../cups/versioning.h ../cups/ppd.h -hpgl-vector.32.o: hpgl-vector.c ../cups/array.h ../cups/file.h ../cups/language.h -hpgl-vector.32.o: hpgl-vector.c ../cups/language.h ../cups/string.h ../config.h image-bmp.32.o: image-bmp.c image-private.h image.h ../cups/raster.h ../cups/cups.h image-bmp.32.o: image-bmp.c ../cups/ipp.h ../cups/http.h ../cups/versioning.h ../cups/ppd.h image-bmp.32.o: image-bmp.c ../cups/array.h ../cups/file.h ../cups/language.h @@ -281,17 +205,6 @@ raster.32.o: raster.c image-private.h image.h ../cups/raster.h ../cups/cups.h raster.32.o: raster.c ../cups/ipp.h ../cups/http.h ../cups/versioning.h ../cups/ppd.h raster.32.o: raster.c ../cups/array.h ../cups/file.h ../cups/language.h ../cups/debug.h raster.32.o: raster.c ../cups/string.h ../config.h -form-main.32.o: form-main.c form.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -form-main.32.o: form-main.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h -form-main.32.o: form-main.c ../cups/file.h ../cups/language.h ../cups/language.h -form-main.32.o: form-main.c ../cups/string.h ../config.h -form-ps.32.o: form-ps.c form.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -form-ps.32.o: form-ps.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h -form-ps.32.o: form-ps.c ../cups/language.h ../cups/language.h ../cups/string.h ../config.h -form-tree.32.o: form-tree.c form.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -form-tree.32.o: form-tree.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h -form-tree.32.o: form-tree.c ../cups/file.h ../cups/language.h ../cups/language.h -form-tree.32.o: form-tree.c ../cups/string.h ../config.h bannertops.32.o: bannertops.c pstext.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h bannertops.32.o: bannertops.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h bannertops.32.o: bannertops.c ../cups/file.h ../cups/language.h ../cups/language.h @@ -302,8 +215,7 @@ commandtops.32.o: commandtops.c ../cups/versioning.h ../cups/ppd.h ../cups/arra commandtops.32.o: commandtops.c ../cups/file.h ../cups/language.h ../cups/string.h ../config.h commandtops.32.o: commandtops.c ../cups/sidechannel.h gziptoany.32.o: gziptoany.c ../cups/file.h ../cups/versioning.h ../cups/string.h ../config.h -gziptoany.32.o: gziptoany.c ../cups/i18n.h ../cups/transcode.h ../cups/language.h -gziptoany.32.o: gziptoany.c ../cups/array.h +gziptoany.32.o: gziptoany.c ../cups/i18n.h ../cups/transcode.h imagetops.32.o: imagetops.c common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h imagetops.32.o: imagetops.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h imagetops.32.o: imagetops.c ../cups/file.h ../cups/language.h ../cups/language.h @@ -329,9 +241,9 @@ pstops.32.o: pstops.c common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h pstops.32.o: pstops.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h pstops.32.o: pstops.c ../cups/language.h ../cups/language.h ../cups/string.h ../config.h pstops.32.o: pstops.c ../cups/file.h ../cups/array.h ../cups/i18n.h ../cups/transcode.h -rasterbench.32.o: rasterbench.c ../cups/raster.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -rasterbench.32.o: rasterbench.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h -rasterbench.32.o: rasterbench.c ../cups/file.h ../cups/language.h +rasterbench.32.o: rasterbench.c ../config.h ../cups/raster.h ../cups/cups.h ../cups/ipp.h +rasterbench.32.o: rasterbench.c ../cups/http.h ../cups/versioning.h ../cups/ppd.h +rasterbench.32.o: rasterbench.c ../cups/array.h ../cups/file.h ../cups/language.h rastertoepson.32.o: rastertoepson.c ../cups/cups.h ../cups/ipp.h ../cups/http.h rastertoepson.32.o: rastertoepson.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h rastertoepson.32.o: rastertoepson.c ../cups/file.h ../cups/language.h ../cups/ppd.h @@ -364,38 +276,6 @@ texttops.32.o: texttops.c ../cups/language.h ../cups/language.h ../cups/string. texttops.32.o: texttops.c ../config.h ../cups/i18n.h ../cups/transcode.h # DO NOT DELETE -hpgl-attr.64.o: hpgl-attr.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -hpgl-attr.64.o: hpgl-attr.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h -hpgl-attr.64.o: hpgl-attr.c ../cups/file.h ../cups/language.h ../cups/language.h -hpgl-attr.64.o: hpgl-attr.c ../cups/string.h ../config.h -hpgl-config.64.o: hpgl-config.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h -hpgl-config.64.o: hpgl-config.c ../cups/http.h ../cups/versioning.h ../cups/ppd.h -hpgl-config.64.o: hpgl-config.c ../cups/array.h ../cups/file.h ../cups/language.h -hpgl-config.64.o: hpgl-config.c ../cups/language.h ../cups/string.h ../config.h -hpgl-main.64.o: hpgl-main.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -hpgl-main.64.o: hpgl-main.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h -hpgl-main.64.o: hpgl-main.c ../cups/file.h ../cups/language.h ../cups/language.h -hpgl-main.64.o: hpgl-main.c ../cups/string.h ../config.h ../cups/i18n.h ../cups/transcode.h -hpgl-prolog.64.o: hpgl-prolog.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h -hpgl-prolog.64.o: hpgl-prolog.c ../cups/http.h ../cups/versioning.h ../cups/ppd.h -hpgl-prolog.64.o: hpgl-prolog.c ../cups/array.h ../cups/file.h ../cups/language.h -hpgl-prolog.64.o: hpgl-prolog.c ../cups/language.h ../cups/string.h ../config.h -hpgl-char.64.o: hpgl-char.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -hpgl-char.64.o: hpgl-char.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h -hpgl-char.64.o: hpgl-char.c ../cups/file.h ../cups/language.h ../cups/language.h -hpgl-char.64.o: hpgl-char.c ../cups/string.h ../config.h -hpgl-input.64.o: hpgl-input.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -hpgl-input.64.o: hpgl-input.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h -hpgl-input.64.o: hpgl-input.c ../cups/file.h ../cups/language.h ../cups/language.h -hpgl-input.64.o: hpgl-input.c ../cups/string.h ../config.h ../cups/i18n.h ../cups/transcode.h -hpgl-polygon.64.o: hpgl-polygon.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h -hpgl-polygon.64.o: hpgl-polygon.c ../cups/http.h ../cups/versioning.h ../cups/ppd.h -hpgl-polygon.64.o: hpgl-polygon.c ../cups/array.h ../cups/file.h ../cups/language.h -hpgl-polygon.64.o: hpgl-polygon.c ../cups/language.h ../cups/string.h ../config.h -hpgl-vector.64.o: hpgl-vector.c hpgltops.h common.h ../cups/cups.h ../cups/ipp.h -hpgl-vector.64.o: hpgl-vector.c ../cups/http.h ../cups/versioning.h ../cups/ppd.h -hpgl-vector.64.o: hpgl-vector.c ../cups/array.h ../cups/file.h ../cups/language.h -hpgl-vector.64.o: hpgl-vector.c ../cups/language.h ../cups/string.h ../config.h image-bmp.64.o: image-bmp.c image-private.h image.h ../cups/raster.h ../cups/cups.h image-bmp.64.o: image-bmp.c ../cups/ipp.h ../cups/http.h ../cups/versioning.h ../cups/ppd.h image-bmp.64.o: image-bmp.c ../cups/array.h ../cups/file.h ../cups/language.h @@ -463,17 +343,6 @@ raster.64.o: raster.c image-private.h image.h ../cups/raster.h ../cups/cups.h raster.64.o: raster.c ../cups/ipp.h ../cups/http.h ../cups/versioning.h ../cups/ppd.h raster.64.o: raster.c ../cups/array.h ../cups/file.h ../cups/language.h ../cups/debug.h raster.64.o: raster.c ../cups/string.h ../config.h -form-main.64.o: form-main.c form.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -form-main.64.o: form-main.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h -form-main.64.o: form-main.c ../cups/file.h ../cups/language.h ../cups/language.h -form-main.64.o: form-main.c ../cups/string.h ../config.h -form-ps.64.o: form-ps.c form.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -form-ps.64.o: form-ps.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h -form-ps.64.o: form-ps.c ../cups/language.h ../cups/language.h ../cups/string.h ../config.h -form-tree.64.o: form-tree.c form.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -form-tree.64.o: form-tree.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h -form-tree.64.o: form-tree.c ../cups/file.h ../cups/language.h ../cups/language.h -form-tree.64.o: form-tree.c ../cups/string.h ../config.h bannertops.64.o: bannertops.c pstext.h common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h bannertops.64.o: bannertops.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h bannertops.64.o: bannertops.c ../cups/file.h ../cups/language.h ../cups/language.h @@ -484,8 +353,7 @@ commandtops.64.o: commandtops.c ../cups/versioning.h ../cups/ppd.h ../cups/arra commandtops.64.o: commandtops.c ../cups/file.h ../cups/language.h ../cups/string.h ../config.h commandtops.64.o: commandtops.c ../cups/sidechannel.h gziptoany.64.o: gziptoany.c ../cups/file.h ../cups/versioning.h ../cups/string.h ../config.h -gziptoany.64.o: gziptoany.c ../cups/i18n.h ../cups/transcode.h ../cups/language.h -gziptoany.64.o: gziptoany.c ../cups/array.h +gziptoany.64.o: gziptoany.c ../cups/i18n.h ../cups/transcode.h imagetops.64.o: imagetops.c common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h imagetops.64.o: imagetops.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h imagetops.64.o: imagetops.c ../cups/file.h ../cups/language.h ../cups/language.h @@ -511,9 +379,9 @@ pstops.64.o: pstops.c common.h ../cups/cups.h ../cups/ipp.h ../cups/http.h pstops.64.o: pstops.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h pstops.64.o: pstops.c ../cups/language.h ../cups/language.h ../cups/string.h ../config.h pstops.64.o: pstops.c ../cups/file.h ../cups/array.h ../cups/i18n.h ../cups/transcode.h -rasterbench.64.o: rasterbench.c ../cups/raster.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -rasterbench.64.o: rasterbench.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h -rasterbench.64.o: rasterbench.c ../cups/file.h ../cups/language.h +rasterbench.64.o: rasterbench.c ../config.h ../cups/raster.h ../cups/cups.h ../cups/ipp.h +rasterbench.64.o: rasterbench.c ../cups/http.h ../cups/versioning.h ../cups/ppd.h +rasterbench.64.o: rasterbench.c ../cups/array.h ../cups/file.h ../cups/language.h rastertoepson.64.o: rastertoepson.c ../cups/cups.h ../cups/ipp.h ../cups/http.h rastertoepson.64.o: rastertoepson.c ../cups/versioning.h ../cups/ppd.h ../cups/array.h rastertoepson.64.o: rastertoepson.c ../cups/file.h ../cups/language.h ../cups/ppd.h diff --git a/filter/Makefile b/filter/Makefile index 6e2e96bd1..184b3072d 100644 --- a/filter/Makefile +++ b/filter/Makefile @@ -3,7 +3,7 @@ # # Filter makefile for the Common UNIX Printing System (CUPS). # -# Copyright 2007-2009 by Apple Inc. +# Copyright 2007-2010 by Apple Inc. # Copyright 1997-2006 by Easy Software Products. # # These coded instructions, statements, and computer programs are the @@ -22,7 +22,6 @@ FILTERS = \ $(BANNERTOPS) \ commandtops \ gziptoany \ - hpgltops \ $(TEXTTOPS) \ pstops \ $(IMGFILTERS) \ @@ -43,16 +42,13 @@ TARGETS = \ $(LIBTARGETS) \ $(FILTERS) -HPGLOBJS = hpgl-attr.o hpgl-config.o hpgl-main.o hpgl-prolog.o \ - hpgl-char.o hpgl-input.o hpgl-polygon.o hpgl-vector.o IMAGEOBJS = image-bmp.o image-colorspace.o image-gif.o image-jpeg.o \ image-photocd.o image-pix.o image-png.o image-pnm.o \ image-sgi.o image-sgilib.o image-sun.o image-tiff.o \ image-zoom.o image.o error.o interpret.o raster.o IMAGE32OBJS = $(IMAGEOBJS:.o=.32.o) IMAGE64OBJS = $(IMAGEOBJS:.o=.64.o) -FORMOBJS = form-attr.o form-main.o form-ps.o form-text.o form-tree.o -OBJS = $(HPGLOBJS) $(IMAGEOBJS) $(FORMOBJS) \ +OBJS = $(IMAGEOBJS) \ bannertops.o commandtops.o gziptoany.o imagetops.o \ imagetoraster.o common.o pdftops.o pstext.o pstops.o \ rasterbench.o rastertoepson.o rastertohp.o rastertolabel.o \ @@ -131,7 +127,7 @@ install-exec: $(LN) rastertolabel $(SERVERBIN)/filter/rastertodymo if test "x$(SYMROOT)" != "x"; then \ $(INSTALL_DIR) $(SYMROOT); \ - for file in $(TARGETS); do \ + for file in $(FILTERS); do \ cp $$file $(SYMROOT); \ done \ fi @@ -161,6 +157,10 @@ install-libs: $(INSTALLSTATIC) $(INSTALL32) $(INSTALL64) $(RM) $(LIBDIR)/libcupsimage.dylib; \ $(LN) $(LIBCUPSIMAGE) $(LIBDIR)/libcupsimage.dylib; \ fi + if test "x$(SYMROOT)" != "x"; then \ + $(INSTALL_DIR) $(SYMROOT); \ + cp $(LIBCUPSIMAGE) $(SYMROOT); \ + fi installstatic: $(INSTALL_DIR) -m 755 $(LIBDIR) @@ -293,15 +293,6 @@ commandtops: commandtops.o ../cups/$(LIBCUPS) # -# formtops -# - -formtops: $(FORMOBJS) common.o ../cups/$(LIBCUPS) - echo Linking $@... - $(CC) $(LDFLAGS) -o $@ $(FORMOBJS) common.o $(LIBS) -lm - - -# # gziptoany # @@ -311,15 +302,6 @@ gziptoany: gziptoany.o ../Makedefs ../cups/$(LIBCUPS) # -# hpgltops -# - -hpgltops: $(HPGLOBJS) common.o ../cups/$(LIBCUPS) - echo Linking $@... - $(CC) $(LDFLAGS) -o $@ $(HPGLOBJS) common.o $(LIBS) -lm - - -# # libcupsimage.so.2, libcupsimage.sl.2 # diff --git a/filter/form-main.c b/filter/form-main.c deleted file mode 100644 index 0f4ff1b61..000000000 --- a/filter/form-main.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * "$Id: form-main.c 6649 2007-07-11 21:46:42Z mike $" - * - * CUPS form main entry for the Common UNIX Printing System (CUPS). - * - * Copyright 2007 by Apple Inc. - * Copyright 1997-2005 by Easy Software Products. - * - * These coded instructions, statements, and computer programs are the - * property of Apple Inc. and are protected by Federal copyright - * law. Distribution and use rights are outlined in the file "LICENSE.txt" - * which should have been included with this file. If this file is - * file is missing or damaged, see the license at "http://www.cups.org/". - * - * This file is subject to the Apple OS-Developed Software exception. - * - * Contents: - * - * main() - Load the specified form file and output PostScript. - */ - -/* - * Include necessary headers... - */ - -#include "form.h" - - -/* - * Globals... - */ - -int NumOptions; /* Number of command-line options */ -cups_option_t *Options; /* Command-line options */ -ppd_file_t *PPD; /* PPD file */ - - -/* - * 'main()' - Load the specified form file and output PostScript. - */ - -int /* O - Exit status */ -main(int argc, /* I - Number of command-line arguments */ - char *argv[]) /* I - Command-line arguments */ -{ - - return (0); -} - - -/* - * End of "$Id: form-main.c 6649 2007-07-11 21:46:42Z mike $". - */ diff --git a/filter/form-ps.c b/filter/form-ps.c deleted file mode 100644 index 6a1e1e327..000000000 --- a/filter/form-ps.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * "$Id: form-ps.c 6649 2007-07-11 21:46:42Z mike $" - * - * CUPS form PostScript routines for the Common UNIX Printing System (CUPS). - * - * Copyright 2007 by Apple Inc. - * Copyright 1997-2005 by Easy Software Products. - * - * These coded instructions, statements, and computer programs are the - * property of Apple Inc. and are protected by Federal copyright - * law. Distribution and use rights are outlined in the file "LICENSE.txt" - * which should have been included with this file. If this file is - * file is missing or damaged, see the license at "http://www.cups.org/". - * - * This file is subject to the Apple OS-Developed Software exception. - * - * Contents: - * - */ - -/* - * Include necessary headers... - */ - -#include "form.h" - - -/* - * 'formWrite()' - Write PostScript output for the given form document. - */ - -void -formWrite(tree_t *t) /* I - Document tree to write */ -{ -} - - -/* - * End of "$Id: form-ps.c 6649 2007-07-11 21:46:42Z mike $". - */ diff --git a/filter/form-tree.c b/filter/form-tree.c deleted file mode 100644 index 337924d09..000000000 --- a/filter/form-tree.c +++ /dev/null @@ -1,615 +0,0 @@ -/* - * "$Id: form-tree.c 6649 2007-07-11 21:46:42Z mike $" - * - * CUPS form document tree routines for the Common UNIX Printing - * System (CUPS). - * - * Copyright 2007 by Apple Inc. - * Copyright 1997-2005 by Easy Software Products. - * - * These coded instructions, statements, and computer programs are the - * property of Apple Inc. and are protected by Federal copyright - * law. Distribution and use rights are outlined in the file "LICENSE.txt" - * which should have been included with this file. If this file is - * file is missing or damaged, see the license at "http://www.cups.org/". - * - * This file is subject to the Apple OS-Developed Software exception. - * - * Contents: - * - */ - -/* - * Include necessary headers... - */ - -#include "form.h" - - -/* - * Local functions... - */ - -static int compare_attr(attr_t *a0, attr_t *a1); -static int compare_elements(char **e0, char **e1); -static int parse_attr(tree_t *t, FILE *fp); -static int parse_element(tree_t *t, FILE *fp); - - -/* - * Local globals... - */ - -static char *elements[] = - { - "", - "!--", - "ARC", - "BOX", - "BR", - "B", - "CUPSFORM", - "DEFVAR", - "FONT", - "H1", - "H2", - "H3", - "H4", - "H5", - "H6", - "HEAD", - "IMG", - "I", - "LINE", - "PAGE", - "PIE", - "POLY", - "PRE", - "P", - "RECT", - "TEXT", - "TT", - "VAR" - }; - - -/* - * 'formDelete()' - Delete a node and its children. - */ - -void -formDelete(tree_t *t) /* I - Tree node */ -{ -} - - -/* - * 'formGetAttr()' - Get a node attribute value. - */ - -char * /* O - Value or NULL */ -formGetAttr(tree_t *t, /* I - Tree node */ - const char *name) /* I - Name of attribute */ -{ -} - - -/* - * 'formNew()' - Create a new form node. - */ - -tree_t * /* O - New tree node */ -formNew(tree_t *p) /* I - Parent node */ -{ - tree_t *t; /* New tree node */ - - - /* - * Allocate the new node... - */ - - if ((t = (tree_t *)calloc(sizeof(tree_t), 1)) == NULL) - return (NULL); - - /* - * Set/copy attributes... - */ - - if (p == NULL) - { - t->bg[0] = 1.0; - t->bg[1] = 1.0; - t->bg[2] = 1.0; - t->halign = HALIGN_LEFT; - t->valign = VALIGN_MIDDLE; - t->typeface = "Courier"; - t->size = 12.0; - } - else - { - memcpy(t, p, sizeof(tree_t)); - - t->prev = NULL; - t->next = NULL; - t->child = NULL; - t->last_child = NULL; - t->parent = NULL; - t->num_attrs = 0; - t->attrs = NULL; - t->data = NULL; - } - - /* - * Return the new node... - */ - - return (t); -} - - -/* - * 'formRead()' - Read a form tree from a file. - */ - -tree_t * /* O - New form tree */ -formRead(FILE *fp, /* I - File to read from */ - tree_t *p) /* I - Parent node */ -{ - int ch, /* Character from file */ - closech, /* Closing character */ - have_whitespace; /* Leading whitespace? */ - static char s[10240]; /* String from file */ - uchar *ptr, /* Pointer in string */ - glyph[16], /* Glyph name (&#nnn;) */ - *glyphptr; /* Pointer in glyph string */ - tree_t *tree, /* "top" of this tree */ - *t, /* New tree node */ - *prev, /* Previous tree node */ - *temp; /* Temporary looping var */ - uchar *face, /* Typeface for FONT tag */ - *color, /* Color for FONT tag */ - *size; /* Size for FONT tag */ - - - /* - * Start off with no previous tree node... - */ - - prev = NULL; - tree = NULL; - - /* - * Parse data until we hit end-of-file... - */ - - while ((ch = getc(fp)) != EOF) - { - /* - * Ignore leading whitespace... - */ - - have_whitespace = 0; - closech = '/'; - - if (p == NULL || !p->preformatted) - { - while (isspace(ch & 255)) - { - have_whitespace = 1; - ch = getc(fp); - } - - if (ch == EOF) - break; - } - - /* - * Allocate a new tree node - use calloc() to get zeroed data... - */ - - t = formNew(p); - - /* - * See what the character was... - */ - - if (ch == '<') - { - /* - * Markup char; grab the next char to see if this is a /... - */ - - ch = getc(fp); - if (ch == ' ') - { - /* - * Illegal lone "<"! Ignore it... - */ - - free(t); - continue; - } - - if (ch != '/') - ungetc(ch, fp); - - if (parse_element(t, fp) < 0) - { - free(t); - break; - } - - if ((closech = getc(fp)) == '/') - getc(fp); - - /* - * If this is the matching close mark, or if we are starting the same - * element, or if we've completed a list, we're done! - */ - - if (ch == '/') - { - /* - * Close element; find matching element... - */ - - for (temp = p; temp != NULL; temp = temp->p) - if (temp->element == t->element) - break; - - free(t); - - if (temp != NULL) - break; - else - continue; - } - } - else if (t->preformatted) - { - /* - * Read a pre-formatted string into the current tree node... - */ - - ptr = s; - while (ch != '<' && ch != EOF && ptr < (s + sizeof(s) - 1)) - { - if (ch == '&') - { - for (glyphptr = glyph; - (ch = getc(fp)) != EOF && (glyphptr - glyph) < 15; - glyphptr ++) - if (!isalnum(ch & 255)) - break; - else - *glyphptr = ch; - - *glyphptr = '\0'; - if (atoi(glyph) > 0) - ch = atoi(glyph); - else if (strcmp(glyph, "lt") == 0) - ch = '<'; - else if (strcmp(glyph, "gt") == 0) - ch = '>'; - else if (strcmp(glyph, "quot") == 0) - ch = '\''; - else if (strcmp(glyph, "nbsp") == 0) - ch = ' '; - else - ch = '&'; - } - - if (ch != 0) - *ptr++ = ch; - - if (ch == '\n') - break; - - ch = getc(fp); - } - - *ptr = '\0'; - - if (ch == '<') - ungetc(ch, fp); - - t->element = ELEMENT_FRAGMENT; - t->data = strdup(s); - } - else - { - /* - * Read the next string fragment... - */ - - ptr = s; - if (have_whitespace) - *ptr++ = ' '; - - while (!isspace(ch & 255) && ch != '<' && ch != EOF && ptr < (s + sizeof(s) - 1)) - { - if (ch == '&') - { - for (glyphptr = glyph; - (ch = getc(fp)) != EOF && (glyphptr - glyph) < 15; - glyphptr ++) - if (!isalnum(ch & 255)) - break; - else - *glyphptr = ch; - - *glyphptr = '\0'; - if (atoi(glyph) > 0) - ch = atoi(glyph); - else if (strcmp(glyph, "lt") == 0) - ch = '<'; - else if (strcmp(glyph, "gt") == 0) - ch = '>'; - else if (strcmp(glyph, "quot") == 0) - ch = '\''; - else if (strcmp(glyph, "nbsp") == 0) - ch = ' '; - else - ch = '&'; - } - - if (ch != 0) - *ptr++ = ch; - - ch = getc(fp); - } - - if (isspace(ch & 255)) - *ptr++ = ' '; - - *ptr = '\0'; - - if (ch == '<') - ungetc(ch, fp); - - t->element = ELEMENT_FRAGMENT; - t->data = strdup(s); - } - - /* - * If the p tree pointer is not NULL and this is the first - * entry we've read, set the child pointer... - */ - - if (p != NULL && prev == NULL) - p->child = t; - - if (p != NULL) - p->last_child = t; - - /* - * Do the prev/next links... - */ - - t->parent = p; - t->prev = prev; - if (prev != NULL) - prev->next = t; - else - tree = t; - - prev = t; - - /* - * Do child stuff as needed... - */ - - if (closech == '>') - t->child = formRead(t, fp); - } - - return (tree); -} - - -/* - * 'formSetAttr()' - Set a node attribute. - */ - -void -formSetAttr(tree_t *t, /* I - Tree node */ - const char *name, /* I - Attribute name */ - const char *value) /* I - Attribute value */ -{ -} - - -/* - * 'compare_attr()' - Compare two attributes. - */ - -static int /* O - -1 if a0 < a1, etc. */ -compare_attr(attr_t *a0, /* I - First attribute */ - attr_t *a1) /* I - Second attribute */ -{ - return (strcasecmp(a0->name, a1->name)); -} - - -/* - * 'compare_elements()' - Compare two elements. - */ - -static int /* O - -1 if e0 < e1, etc. */ -compare_elements(char **e0, /* I - First element */ - char **e1) /* I - Second element */ -{ - return (strcasecmp(*e0, *e1)); -} - - -/* - * 'parse_attr()' - Parse an element attribute string. - */ - -static int /* O - -1 on error, 0 on success */ -parse_attr(tree_t *t, /* I - Current tree node */ - FILE *fp) /* I - Input file */ -{ - char name[1024], /* Name of attr */ - value[10240], /* Value of attr */ - *ptr; /* Temporary pointer */ - int ch; /* Character from file */ - - - ptr = name; - while ((ch = getc(fp)) != EOF) - if (isalnum(ch & 255)) - { - if (ptr < (name + sizeof(name) - 1)) - *ptr++ = ch; - } - else - break; - - *ptr = '\0'; - - while (isspace(ch & 255) || ch == '\r') - ch = getc(fp); - - switch (ch) - { - default : - ungetc(ch, fp); - return (formSetAttr(t, name, NULL)); - case EOF : - return (-1); - case '=' : - ptr = value; - ch = getc(fp); - - while (isspace(ch & 255) || ch == '\r') - ch = getc(fp); - - if (ch == EOF) - return (-1); - - if (ch == '\'') - { - while ((ch = getc(fp)) != EOF) - if (ch == '\'') - break; - else if (ptr < (value + sizeof(value) - 1)) - *ptr++ = ch; - - *ptr = '\0'; - } - else if (ch == '\"') - { - while ((ch = getc(fp)) != EOF) - if (ch == '\"') - break; - else if (ptr < (value + sizeof(value) - 1)) - *ptr++ = ch; - - *ptr = '\0'; - } - else - { - *ptr++ = ch; - while ((ch = getc(fp)) != EOF) - if (isspace(ch & 255) || ch == '>' || ch == '/' || ch == '\r') - break; - else if (ptr < (value + sizeof(value) - 1)) - *ptr++ = ch; - - *ptr = '\0'; - if (ch == '>' || ch == '/') - ungetc(ch, fp); - } - - return (formSetAttr(t, name, value)); - } -} - - -/* - * 'parse_element()' - Parse an element. - */ - -static int /* O - -1 on error or ELEMENT_nnnn */ -parse_element(tree_t *t, /* I - Current tree node */ - FILE *fp) /* I - Input file */ -{ - int ch; /* Character from file */ - char element[255], /* Element string... */ - *eptr, /* Current character... */ - comment[10240], /* Comment string */ - *cptr, /* Current char... */ - **temp; /* Element variable entry */ - - - eptr = element; - - while ((ch = getc(fp)) != EOF && eptr < (element + sizeof(element) - 1)) - if (ch == '>' || ch == '/' || isspace(ch & 255)) - break; - else - *eptr++ = ch; - - *eptr = '\0'; - - if (ch == EOF) - return (ELEMENT_ERROR); - - eptr = element; - temp = bsearch(&mptr, elements, sizeof(elements) / sizeof(elements[0]), - sizeof(elements[0]), - (int (*)(const void *, const void *))compare_elements); - - if (temp == NULL) - { - /* - * Unrecognized element stuff... - */ - - t->element = ELEMENT_COMMENT; - strcpy(comment, element); - cptr = comment + strlen(comment); - } - else - { - t->element = (element_t)((char **)temp - elements); - cptr = comment; - } - - if (t->element == ELEMENT_COMMENT) - { - while (ch != EOF && ch != '>' && cptr < (comment + sizeof(comment) - 1)) - { - *cptr++ = ch; - ch = getc(fp); - } - - *cptr = '\0'; - t->data = strdup(comment); - } - else - { - while (ch != EOF && ch != '>' && ch != '/') - { - if (!isspace(ch & 255)) - { - ungetc(ch, fp); - parse_variable(t, fp); - } - - ch = getc(fp); - } - - if (ch != EOF) - ungetc(ch, fp); - } - - return (t->element); -} - - -/* - * End of "$Id: form-tree.c 6649 2007-07-11 21:46:42Z mike $". - */ diff --git a/filter/form.h b/filter/form.h deleted file mode 100644 index 7b4598ef3..000000000 --- a/filter/form.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * "$Id: form.h 6649 2007-07-11 21:46:42Z mike $" - * - * CUPS form header file for the Common UNIX Printing System (CUPS). - * - * Copyright 2007 by Apple Inc. - * Copyright 1997-2005 by Easy Software Products. - * - * These coded instructions, statements, and computer programs are the - * property of Apple Inc. and are protected by Federal copyright - * law. Distribution and use rights are outlined in the file "LICENSE.txt" - * which should have been included with this file. If this file is - * file is missing or damaged, see the license at "http://www.cups.org/". - * - * This file is subject to the Apple OS-Developed Software exception. - */ - -/* - * Include necessary headers... - */ - -#include "common.h" - - -/* - * Form elements... - */ - -typedef enum -{ - ELEMENT_FILE = -1, /* Pseudo element, not in file, but above */ - ELEMENT_FRAGMENT, /* Text fragment */ - ELEMENT_COMMENT, /* <!-- .... --> */ - ELEMENT_ARC, - ELEMENT_BOX, - ELEMENT_BR, - ELEMENT_B, - ELEMENT_CUPSFORM, - ELEMENT_DEFVAR, - ELEMENT_FONT, - ELEMENT_H1, - ELEMENT_H2, - ELEMENT_H3, - ELEMENT_H4, - ELEMENT_H5, - ELEMENT_H6, - ELEMENT_HEAD, - ELEMENT_IMG, - ELEMENT_I, - ELEMENT_LINE, - ELEMENT_PAGE, - ELEMENT_PIE, - ELEMENT_POLY, - ELEMENT_PRE, - ELEMENT_P, - ELEMENT_RECT, - ELEMENT_TEXT, - ELEMENT_TT, - ELEMENT_VAR -} element_t; - - -/* - * Font styles... - */ - -typedef enum -{ - STYLE_NORMAL, - STYLE_BOLD, - STYLE_ITALIC, - STYLE_BOLD_ITALIC -} style_t; - - -/* - * Text alignments... - */ - -typedef enum -{ - HALIGN_LEFT, - HALIGN_CENTER, - HALIGN_RIGHT -} halign_t; - -typedef enum -{ - VALIGN_BOTTOM, - VALIGN_CENTER, - VALIGN_TOP -} valign_t; - - -/* - * Text directions... - */ - -typedef enun -{ - DIR_LEFT_TO_RIGHT, - DIR_RIGHT_TO_LEFT -} dir_t; - - -/* - * Attribute structure... - */ - -typedef struct -{ - char *name, /* Name of attribute */ - *value; /* Value of attribute */ -} attr_t; - - -/* - * Form document tree structure... - */ - -typedef struct tree_str -{ - struct tree_str *prev, /* Previous tree node */ - *next, /* Next tree node */ - *parent, /* Parent tree node */ - *child, /* First child node */ - *last_child; /* Last child node */ - element_t element; /* Element type */ - float x, y, w, h; /* Position and size in points */ - float bg[3], fg[3]; /* Colors of element */ - float thickness; /* Thickness of lines */ - int preformatted; /* Preformatted text? */ - float size; /* Height of text in points */ - char *typeface; /* Typeface of text */ - style_t style; /* Style of text */ - halign_t halign; /* Horizontal alignment */ - valign_t valign; /* Vertical alignment */ - dir_t dir; /* Direction of text */ - int num_attrs; /* Number of attributes */ - attr_t *attrs; /* Attributes */ - void *data; /* Text fragment data */ -} tree_t; - - -/* - * Globals... - */ - -extern int NumOptions; /* Number of command-line options */ -extern cups_option_t *Options; /* Command-line options */ -extern ppd_file_t *PPD; /* PPD file */ - - -/* - * Prototypes... - */ - -extern void formDelete(tree_t *t); -extern char *formGetAttr(tree_t *t, const char *name); -extern tree_t *formNew(tree_t *p); -extern tree_t *formRead(FILE *fp, tree_t *p); -extern void formSetAttr(tree_t *t, const char *name, const char *value); -extern void formWrite(tree_t *p); - - -/* - * End of "$Id: form.h 6649 2007-07-11 21:46:42Z mike $". - */ diff --git a/filter/hpgl-attr.c b/filter/hpgl-attr.c deleted file mode 100644 index 7a93ad7d8..000000000 --- a/filter/hpgl-attr.c +++ /dev/null @@ -1,479 +0,0 @@ -/* - * "$Id: hpgl-attr.c 6649 2007-07-11 21:46:42Z mike $" - * - * HP-GL/2 attribute processing for the Common UNIX Printing System (CUPS). - * - * Copyright 2007-2008 by Apple Inc. - * Copyright 1993-2007 by Easy Software Products. - * - * These coded instructions, statements, and computer programs are the - * property of Apple Inc. and are protected by Federal copyright - * law. Distribution and use rights are outlined in the file "LICENSE.txt" - * which should have been included with this file. If this file is - * file is missing or damaged, see the license at "http://www.cups.org/". - * - * This file is subject to the Apple OS-Developed Software exception. - * - * Contents: - * - * CR_color_range() - Set the range for color values. - * AC_anchor_corner() - Set the anchor corner. - * FT_fill_type() - Set the fill type or pattern. - * LA_line_attributes() - Set the line drawing attributes. - * LT_line_type() - Set the line type (style)... - * NP_number_pens() - Set the number of pens to be used. - * PC_pen_color() - Set the pen color... - * PW_pen_width() - Set the pen width. - * RF_raster_fill() - Set the raster fill pattern. - * SM_symbol_mode() - Set where symbols are drawn. - * SP_select_pen() - Select a pen for drawing. - * UL_user_line_type() - Set a user-defined line type. - * WU_width_units() - Set the units used for pen widths. - */ - -/* - * Include necessary headers... - */ - -#include "hpgltops.h" - - -/* - * 'CR_color_range()' - Set the range for color values. - */ - -void -CR_color_range(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - if (num_params == 0) - { - /* - * Default to 0 to 255 for all color values. - */ - - ColorRange[0][0] = 0.0; - ColorRange[0][1] = 255.0; - ColorRange[1][0] = 0.0; - ColorRange[1][1] = 255.0; - ColorRange[2][0] = 0.0; - ColorRange[2][1] = 255.0; - } - else if (num_params == 6) - { - /* - * Set the range based on the parameters... - */ - - ColorRange[0][0] = params[0].value.number; - ColorRange[0][1] = params[1].value.number - params[0].value.number; - ColorRange[1][0] = params[2].value.number; - ColorRange[1][1] = params[3].value.number - params[2].value.number; - ColorRange[2][0] = params[4].value.number; - ColorRange[2][1] = params[5].value.number - params[4].value.number; - } - else - fprintf(stderr, - "DEBUG: HP-GL/2 \'CR\' command with invalid number of " - "parameters (%d)!\n", num_params); -} - - -/* - * 'AC_anchor_corner()' - Set the anchor corner. - */ - -void -AC_anchor_corner(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; -} - - -/* - * 'FT_fill_type()' - Set the fill type or pattern. - * - * Note: - * - * This needs to be updated to support non-solid fill. - */ - -void -FT_fill_type(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - if (num_params == 0 || - params[0].value.number == 1 || - params[0].value.number == 2) - { - /**** SOLID PATTERN ****/ - } -} - - -/* - * 'LA_line_attributes()' - Set the line drawing attributes. - */ - -void -LA_line_attributes(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - int i; /* Looping var */ - - - if (num_params == 0) - { - MiterLimit = 3.0f; - LineCap = 0; - LineJoin = 0; - } - else for (i = 0; i < (num_params - 1); i += 2) - switch ((int)params[i].value.number) - { - case 1 : - LineCap = params[i + 1].value.number == 1 ? 0 : - params[i + 1].value.number == 4 ? 1 : 2; - break; - case 2 : - switch ((int)params[i + 1].value.number) - { - case 1 : - case 2 : - case 3 : - LineJoin = 0; - break; - case 5 : - LineJoin = 2; - break; - default : - LineJoin = 1; - break; - } - break; - case 3 : - MiterLimit = 1.0 + 0.5 * (params[i + 1].value.number - 1.0); - break; - } - - if (PageDirty) - { - printf("%.1f setmiterlimit\n", MiterLimit); - printf("%d setlinecap\n", LineCap); - printf("%d setlinejoin\n", LineJoin); - } -} - - -/* - * 'LT_line_type()' - Set the line type (style)... - * - * Note: - * - * This needs to be updated to support line types. - */ - -void -LT_line_type(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; -} - - -/* - * 'NP_number_pens()' - Set the number of pens to be used. - */ - -void -NP_number_pens(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - int i; /* Looping var */ - - - if (num_params == 0) - PenCount = 8; - else if (num_params == 1) - { - if (params[0].value.number < 1 || params[0].value.number > MAX_PENS) - { - fprintf(stderr, - "DEBUG: HP-GL/2 \'NP\' command with invalid number of " - "pens (%d)!\n", (int)params[0].value.number); - PenCount = 8; - } - else - PenCount = (int)params[0].value.number; - } - else - fprintf(stderr, - "DEBUG: HP-GL/2 \'NP\' command with invalid number of " - "parameters (%d)!\n", num_params); - - for (i = 0; i < PenCount; i ++) - Pens[i].width = PenWidth; - - PC_pen_color(0, NULL); -} - - -/* - * 'PC_pen_color()' - Set the pen color... - */ - -void -PC_pen_color(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - int i; /* Looping var */ - static float standard_colors[8][3] = /* Standard colors for first 8 pens */ - { - { 0.0, 0.0, 0.0 }, /* Black */ - { 1.0, 0.0, 0.0 }, /* Red */ - { 0.0, 1.0, 0.0 }, /* Green */ - { 1.0, 1.0, 0.0 }, /* Yellow */ - { 0.0, 0.0, 1.0 }, /* Blue */ - { 1.0, 0.0, 1.0 }, /* Magenta */ - { 0.0, 1.0, 1.0 }, /* Cyan */ - { 1.0, 1.0, 1.0 } /* White */ - }; - - - if (num_params == 0) - { - for (i = 0; i < PenCount; i ++) - if (i < 8) - { - Pens[i].rgb[0] = standard_colors[i][0]; - Pens[i].rgb[1] = standard_colors[i][1]; - Pens[i].rgb[2] = standard_colors[i][2]; - } - else - { - Pens[i].rgb[0] = 0.0f; - Pens[i].rgb[1] = 0.0f; - Pens[i].rgb[2] = 0.0f; - } - - if (PageDirty) - printf("%.3f %.3f %.3f %.2f SP\n", Pens[PenNumber].rgb[0], - Pens[PenNumber].rgb[1], Pens[PenNumber].rgb[2], - Pens[PenNumber].width * PenScaling); - } - else if (num_params == 1 || num_params == 4) - { - i = (int)params[0].value.number - 1; - - if (i < 0 || i >= PenCount) - { - fprintf(stderr, - "DEBUG: HP-GL/2 \'PC\' command with invalid pen (%d)!\n", i + 1); - return; - } - - if (num_params == 1) - { - Pens[i].rgb[0] = standard_colors[i & 7][0]; - Pens[i].rgb[1] = standard_colors[i & 7][1]; - Pens[i].rgb[2] = standard_colors[i & 7][2]; - } - else - { - Pens[i].rgb[0] = (params[1].value.number - ColorRange[0][0]) / - (ColorRange[0][1] - ColorRange[0][0]); - Pens[i].rgb[1] = (params[2].value.number - ColorRange[1][0]) / - (ColorRange[1][1] - ColorRange[1][0]); - Pens[i].rgb[2] = (params[3].value.number - ColorRange[2][0]) / - (ColorRange[2][1] - ColorRange[2][0]); - - fprintf(stderr, "DEBUG: Pen %d %.0f %.0f %.0f = %.3f %.3f %.3f\n", - i, params[1].value.number, params[2].value.number, - params[3].value.number, Pens[i].rgb[0], Pens[i].rgb[1], - Pens[i].rgb[2]); - } - - if (PageDirty && i == PenNumber) - printf("%.3f %.3f %.3f %.2f SP\n", Pens[PenNumber].rgb[0], - Pens[PenNumber].rgb[1], Pens[PenNumber].rgb[2], - Pens[PenNumber].width * PenScaling); - } - else - fprintf(stderr, - "DEBUG: HP-GL/2 \'PC\' command with invalid number of " - "parameters (%d)!\n", num_params); -} - - -/* - * 'PW_pen_width()' - Set the pen width. - */ - -void -PW_pen_width(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - int pen; /* Pen number */ - float w; /* Width value */ - - - if (WidthUnits == 0) - { - /* - * Metric... - */ - - if (num_params == 0) - w = 0.35f / 25.4f * 72.0f; - else - w = params[0].value.number / 25.4f * 72.0f; - } - else - { - /* - * Relative... - */ - - w = (float)hypot(PlotSize[0], PlotSize[1]) / 1016.0f * 72.0f; - - if (num_params == 0) - w *= 0.01f; - else - w *= params[0].value.number; - } - - if (num_params == 2) - { - pen = (int)params[1].value.number - 1; - - if (pen < 0 || pen >= PenCount) - { - fprintf(stderr, - "DEBUG: HP-GL/2 \'PW\' command with invalid pen (%d)!\n", - pen + 1); - return; - } - - Pens[pen].width = w; - - if (PageDirty && pen == PenNumber) - printf("%.3f %.3f %.3f %.2f SP\n", Pens[PenNumber].rgb[0], - Pens[PenNumber].rgb[1], Pens[PenNumber].rgb[2], - Pens[PenNumber].width * PenScaling); - } - else if (num_params < 2) - { - /* - * Set width for all pens... - */ - - for (pen = 0; pen < PenCount; pen ++) - Pens[pen].width = w; - - if (PageDirty) - printf("%.3f %.3f %.3f %.2f SP\n", Pens[PenNumber].rgb[0], - Pens[PenNumber].rgb[1], Pens[PenNumber].rgb[2], - Pens[PenNumber].width * PenScaling); - } - else - fprintf(stderr, - "DEBUG: HP-GL/2 \'PW\' command with invalid number of " - "parameters (%d)!\n", num_params); -} - - -/* - * 'RF_raster_fill()' - Set the raster fill pattern. - * - * Note: - * - * This needs to be implemented. - */ - -void -RF_raster_fill(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; -} - - -/* - * 'SM_symbol_mode()' - Set where symbols are drawn. - */ - -void -SM_symbol_mode(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; -} - - -/* - * 'SP_select_pen()' - Select a pen for drawing. - */ - -void -SP_select_pen(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - if (num_params == 0) - PenNumber = 0; - else if (num_params > 1) - fprintf(stderr, - "DEBUG: HP-GL/2 \'SP\' command with invalid number of parameters " - "(%d)!\n", num_params); - else if (params[0].value.number <= 0 || params[0].value.number >= PenCount) - fprintf(stderr, "DEBUG: HP-GL/2 \'SP\' command with invalid pen (%d)!\n", - (int)params[0].value.number); - else - PenNumber = (int)params[0].value.number - 1; - - if (PageDirty) - printf("%.3f %.3f %.3f %.2f SP\n", Pens[PenNumber].rgb[0], - Pens[PenNumber].rgb[1], Pens[PenNumber].rgb[2], - Pens[PenNumber].width * PenScaling); -} - - -/* - * 'UL_user_line_type()' - Set a user-defined line type. - */ - -void -UL_user_line_type(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; -} - - -/* - * 'WU_width_units()' - Set the units used for pen widths. - */ - -void -WU_width_units(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - if (num_params == 0) - WidthUnits = 0; - else if (num_params == 1) - WidthUnits = (int)params[0].value.number; - else - fprintf(stderr, - "DEBUG: HP-GL/2 \'WU\' command with invalid number of " - "parameters (%d)!\n", num_params); -} - - -/* - * End of "$Id: hpgl-attr.c 6649 2007-07-11 21:46:42Z mike $". - */ diff --git a/filter/hpgl-char.c b/filter/hpgl-char.c deleted file mode 100644 index 031b938fd..000000000 --- a/filter/hpgl-char.c +++ /dev/null @@ -1,631 +0,0 @@ -/* - * "$Id: hpgl-char.c 6649 2007-07-11 21:46:42Z mike $" - * - * HP-GL/2 character processing for the Common UNIX Printing System (CUPS). - * - * Copyright 2007 by Apple Inc. - * Copyright 1993-2005 by Easy Software Products. - * - * These coded instructions, statements, and computer programs are the - * property of Apple Inc. and are protected by Federal copyright - * law. Distribution and use rights are outlined in the file "LICENSE.txt" - * which should have been included with this file. If this file is - * file is missing or damaged, see the license at "http://www.cups.org/". - * - * This file is subject to the Apple OS-Developed Software exception. - * - * Contents: - * - * AD_define_alternate() - Define the alternate font. - * CF_character_fill() - Set whether or not to fill or outline - * characters. - * CP_character_plot() - Move the current pen position for the given - * number of columns and rows. - * DI_absolute_direction() - Set the direction vector for text. - * DR_relative_direction() - Set the relative direction vector for text. - * DT_define_label_term() - Set the label string terminator. - * DV_define_variable_path() - Define a path for text. - * ES_extra_space() - Set extra spacing (kerning) between characters. - * LB_label() - Display a label string. - * LO_label_origin() - Set the label origin. - * SA_select_alternate() - Select the alternate font. - * SD_define_standard() - Define the standard font... - * SI_absolute_size() - Set the absolute size of text. - * SL_character_slant() - Set the slant of text. - * SR_relative_size() - Set the relative size of text. - * SS_select_standard() - Select the standard font for text. - * TD_transparent_data() - Send transparent print data. - * - */ - -/* - * Include necessary headers... - */ - -#include "hpgltops.h" - - -/* - * 'define_font()' - Define the specified font... - */ - -void -define_font(int f) /* I - Font number */ -{ - font_t *font; /* Font */ - const char *fstring; /* Font string - SA or SS */ - float xform[2][2]; /* Transform matrix */ - - - /* - * Get the correct font data... - */ - - if (f) - { - font = &AlternateFont; - fstring = "SA"; - } - else - { - font = &StandardFont; - fstring = "SS"; - } - - /* - * Compute the font matrix, accounting for any rotation... - */ - - switch (Rotation) - { - default : - case 0 : - xform[0][0] = font->xpitch * font->x * font->height; - xform[0][1] = font->xpitch * font->y * font->height; - xform[1][0] = -font->y * font->height; - xform[1][1] = font->x * font->height; - break; - - case 90 : - xform[0][0] = -font->xpitch * font->y * font->height; - xform[0][1] = font->xpitch * font->x * font->height; - xform[1][0] = -font->x * font->height; - xform[1][1] = -font->y * font->height; - break; - - case 180 : - xform[0][0] = -font->xpitch * font->x * font->height; - xform[0][1] = -font->xpitch * font->y * font->height; - xform[1][0] = font->y * font->height; - xform[1][1] = -font->x * font->height; - break; - - case 270 : - xform[0][0] = font->xpitch * font->y * font->height; - xform[0][1] = -font->xpitch * font->x * font->height; - xform[1][0] = font->x * font->height; - xform[1][1] = font->y * font->height; - break; - } - - /* - * Send the font definition... - */ - - printf("/%s {\n" - " /%s%s%s%s findfont\n" - " [ %f %f %f %f 0.0 0.0 ] makefont\n" - " setfont\n" - "} bind def\n", - fstring, font->spacing ? "Helvetica" : "Courier", - (font->weight > 0 || font->posture) ? "-" : "", - font->weight > 0 ? "Bold" : "", - font->posture ? "Oblique" : "", - xform[0][0], xform[0][1], xform[1][0], xform[1][1]); - - if (f == CharFont) - printf("%s\n", fstring); -} - - -/* - * 'AD_define_alternate()' - Define the alternate font. - */ - -void -AD_define_alternate(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - int i; /* Looping var */ - - - /* - * Set default font attributes... - */ - - AlternateFont.symbol_set = 277; - AlternateFont.spacing = 0; - AlternateFont.pitch = 9; - AlternateFont.height = 11.5; - AlternateFont.posture = 0; - AlternateFont.weight = 0; - AlternateFont.typeface = 48; - AlternateFont.x = 1.0; - AlternateFont.y = 0.0; - - /* - * Loop through parameter value pairs... - */ - - for (i = 0; i < (num_params - 1); i += 2) - switch ((int)params[i].value.number) - { - case 1 : /* Symbol Set */ - AlternateFont.symbol_set = (int)params[i + 1].value.number; - break; - case 2 : /* Font Spacing */ - AlternateFont.spacing = (int)params[i + 1].value.number; - break; - case 3 : /* Pitch */ - AlternateFont.pitch = params[i + 1].value.number; - break; - case 4 : /* Height */ - AlternateFont.height = params[i + 1].value.number; - break; - case 5 : /* Posture */ - AlternateFont.posture = (int)params[i + 1].value.number; - break; - case 6 : /* Stroke Weight */ - AlternateFont.weight = (int)params[i + 1].value.number; - break; - case 7 : /* Typeface */ - AlternateFont.typeface = (int)params[i + 1].value.number; - break; - } - - if (AlternateFont.spacing) - { - /* - * Set proportional spacing font... - */ - - AlternateFont.xpitch = 1.0f; - } - else - { - /* - * Set fixed-spaced font... - */ - - AlternateFont.xpitch = 0.6f * AlternateFont.height / AlternateFont.pitch; - } - - /* - * Define the font... - */ - - if (PageDirty) - { - printf("%% AD"); - for (i = 0; i < num_params; i ++) - if (i) - printf(",%g", params[i].value.number); - else - printf("%g", params[i].value.number); - puts(";"); - - define_font(1); - } - - CharHeight[1] = AlternateFont.height; -} - - -/* - * 'CF_character_fill()' - Set whether or not to fill or outline characters. - */ - -void -CF_character_fill(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - if (num_params == 0) - CharFillMode = 0; - else - CharFillMode = (int)params[0].value.number; - - if (num_params == 2) - CharPen = (int)params[1].value.number; -} - - -/* - * 'CP_character_plot()' - Move the current pen position for the given number - * of columns and rows. - */ - -void -CP_character_plot(int num_params, - param_t *params) -{ - if (num_params < 2) - return; - - switch (Rotation) - { - case 0: - PenPosition[0] += params[0].value.number * 1.2f / CharHeight[CharFont]; - PenPosition[1] += params[1].value.number * CharHeight[CharFont]; - break; - case 90: - PenPosition[0] -= params[1].value.number * 1.2f / CharHeight[CharFont]; - PenPosition[1] += params[0].value.number * CharHeight[CharFont]; - break; - case 180: - PenPosition[0] -= params[0].value.number * 1.2f / CharHeight[CharFont]; - PenPosition[1] -= params[1].value.number * CharHeight[CharFont]; - break; - case 270: - PenPosition[0] += params[1].value.number * 1.2f / CharHeight[CharFont]; - PenPosition[1] -= params[0].value.number * CharHeight[CharFont]; - break; - } -} - - -/* - * 'DI_absolute_direction()' - Set the direction vector for text. - */ - -void -DI_absolute_direction(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - if (num_params != 2) - return; - - if (CharFont) - { - AlternateFont.x = params[0].value.number; - AlternateFont.y = params[1].value.number; - } - else - { - StandardFont.x = params[0].value.number; - StandardFont.y = params[1].value.number; - } - - if (PageDirty) - { - printf("%% DI%g,%g\n", params[0].value.number, params[1].value.number); - - define_font(CharFont); - } -} - - -/* - * 'DR_relative_direction()' - Set the relative direction vector for text. - */ - -void -DR_relative_direction(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; -} - - -/* - * 'DT_define_label_term()' - Set the label string terminator. - */ - -void -DT_define_label_term(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - if (num_params == 0) - StringTerminator = '\003'; - else - StringTerminator = params[0].value.string[0]; -} - - -/* - * 'DV_define_variable_path()' - Define a path for text. - */ - -void -DV_define_variable_path(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; -} - - -/* - * 'ES_extra_space()' - Set extra spacing (kerning) between characters. - */ - -void -ES_extra_space(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; -} - - -/* - * 'LB_label()' - Display a label string. - */ - -void -LB_label(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - char *s; /* Pointer into string */ - - - if (num_params == 0) - return; - - Outputf("gsave\n"); - Outputf("currentmiterlimit 1.0 setmiterlimit\n"); - Outputf("MP\n"); - Outputf("%.3f %.3f MO\n", PenPosition[0], PenPosition[1]); - PenValid = 1; - - Outputf("("); - for (s = params[0].value.string; *s != '\0'; s ++) - if (strchr("()\\", *s) != NULL) - Outputf("\\%c", *s); - else - Outputf("%c", *s); - Outputf(") true charpath\n"); - - if (CharFillMode != 1) - Outputf("FI\n"); - if (CharFillMode == 1 || CharFillMode == 3) - { - Outputf("%.3f %.3f %.3f %.2f SP ST\n", Pens[CharPen].rgb[0], - Pens[CharPen].rgb[CharPen], Pens[CharPen].rgb[2], - Pens[CharPen].width * PenScaling); - Outputf("%.3f %.3f %.3f %.2f SP\n", Pens[PenNumber].rgb[0], - Pens[PenNumber].rgb[1], Pens[PenNumber].rgb[2], - Pens[PenNumber].width * PenScaling); - } - - Outputf("setmiterlimit\n"); - Outputf("grestore\n"); -} - - -/* - * 'LO_label_origin()' - Set the label origin. - */ - -void -LO_label_origin(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; -} - - -/* - * 'SA_select_alternate()' - Select the alternate font. - */ - -void -SA_select_alternate(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; - - if (PageDirty) - puts("SA"); - - CharFont = 1; -} - - -/* - * 'SD_define_standard()' - Define the standard font... - */ - -void -SD_define_standard(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - int i; /* Looping var */ - - - /* - * Set default font attributes... - */ - - StandardFont.symbol_set = 277; - StandardFont.spacing = 0; - StandardFont.pitch = 9; - StandardFont.height = 11.5; - StandardFont.posture = 0; - StandardFont.weight = 0; - StandardFont.typeface = 48; - StandardFont.x = 1.0; - StandardFont.y = 0.0; - - /* - * Loop through parameter value pairs... - */ - - for (i = 0; i < (num_params - 1); i += 2) - switch ((int)params[i].value.number) - { - case 1 : /* Symbol Set */ - StandardFont.symbol_set = (int)params[i + 1].value.number; - break; - case 2 : /* Font Spacing */ - StandardFont.spacing = (int)params[i + 1].value.number; - break; - case 3 : /* Pitch */ - StandardFont.pitch = params[i + 1].value.number; - break; - case 4 : /* Height */ - StandardFont.height = params[i + 1].value.number; - break; - case 5 : /* Posture */ - StandardFont.posture = (int)params[i + 1].value.number; - break; - case 6 : /* Stroke Weight */ - StandardFont.weight = (int)params[i + 1].value.number; - break; - case 7 : /* Typeface */ - StandardFont.typeface = (int)params[i + 1].value.number; - break; - } - - if (StandardFont.spacing || StandardFont.pitch <= 0.0) - { - /* - * Set proportional spacing font... - */ - - StandardFont.xpitch = 1.0f; - } - else - { - /* - * Set fixed-spaced font... - */ - - StandardFont.xpitch = 0.6f * StandardFont.height / StandardFont.pitch; - } - - /* - * Define the font... - */ - - if (PageDirty) - { - printf("%% SD"); - for (i = 0; i < num_params; i ++) - if (i) - printf(",%g", params[i].value.number); - else - printf("%g", params[i].value.number); - puts(";"); - - define_font(0); - } - - CharHeight[0] = StandardFont.height; -} - - -/* - * 'SI_absolute_size()' - Set the absolute size of text. - */ - -void -SI_absolute_size(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - float xsize, ysize; /* Font size... */ - - - if (num_params != 2) - return; - - /* - * The "SI" values are supposed to be cm, but they appear to be inches - * when tested on real HP devices... - */ - - xsize = params[0].value.number * 72.0f; - ysize = params[1].value.number * 72.0f * 0.6f; - - if (CharFont) - { - AlternateFont.xpitch = xsize / ysize; - AlternateFont.height = ysize; - } - else - { - StandardFont.xpitch = xsize / ysize; - StandardFont.height = ysize; - } - - if (PageDirty) - { - printf("%% SI%g,%g\n", params[0].value.number, params[1].value.number); - - define_font(CharFont); - } -} - - -/* - * 'SL_character_slant()' - Set the slant of text. - */ - -void -SL_character_slant(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; -} - - -/* - * 'SR_relative_size()' - Set the relative size of text. - */ - -void -SR_relative_size(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; -} - - -/* - * 'SS_select_standard()' - Select the standard font for text. - */ - -void -SS_select_standard(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; - - if (PageDirty) - puts("SS"); - - CharFont = 0; -} - - -/* - * 'TD_transparent_data()' - Send transparent print data. - */ - -void -TD_transparent_data(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; -} - - -/* - * End of "$Id: hpgl-char.c 6649 2007-07-11 21:46:42Z mike $". - */ diff --git a/filter/hpgl-config.c b/filter/hpgl-config.c deleted file mode 100644 index 180674d79..000000000 --- a/filter/hpgl-config.c +++ /dev/null @@ -1,636 +0,0 @@ -/* - * "$Id: hpgl-config.c 6649 2007-07-11 21:46:42Z mike $" - * - * HP-GL/2 configuration routines for the Common UNIX Printing System (CUPS). - * - * Copyright 2007 by Apple Inc. - * Copyright 1993-2005 by Easy Software Products. - * - * These coded instructions, statements, and computer programs are the - * property of Apple Inc. and are protected by Federal copyright - * law. Distribution and use rights are outlined in the file "LICENSE.txt" - * which should have been included with this file. If this file is - * file is missing or damaged, see the license at "http://www.cups.org/". - * - * This file is subject to the Apple OS-Developed Software exception. - * - * Contents: - * - * update_transform() - Update the page transformation matrix as needed. - * BP_begin_plot() - Start a plot... - * DF_default_values() - Set all state info to the default values. - * IN_initialize() - Initialize the plotter. - * IP_input_absolute() - Set P1 and P2 values for the plot. - * IR_input_relative() - Update P1 and P2. - * IW_input_window() - Setup an input window. - * PG_advance_page() - Eject the current page. - * PS_plot_size() - Set the plot size. - * RO_rotate() - Rotate the plot. - * RP_replot() - Replot the current page. - * SC_scale() - Set user-defined scaling. - */ - -/* - * Include necessary headers... - */ - -#include "hpgltops.h" - -#define max(a,b) ((a) < (b) ? (b) : (a)) - - -/* - * 'update_transform()' - Update the page transformation matrix as needed. - */ - -void -update_transform(void) -{ - float page_width, /* Actual page width */ - page_height; /* Actual page height */ - float scaling; /* Scaling factor */ - float left, right, /* Scaling window */ - bottom, top; - float width, height; /* Scaling width and height */ - float iw1[2], iw2[2]; /* Clipping window */ - - - /* - * Get the page and input window sizes... - */ - - if (FitPlot) - { - page_width = PageRight - PageLeft; - page_height = PageTop - PageBottom; - } - else - { - page_width = (P2[0] - P1[0]) * 72.0f / 1016.0f; - page_height = (P2[1] - P1[1]) * 72.0f / 1016.0f; - } - - fprintf(stderr, "DEBUG: page_width = %.0f, page_height = %.0f\n", - page_width, page_height); - - if (page_width == 0 || page_height == 0) - return; - - /* - * Set the scaling window... - */ - - switch (ScalingType) - { - default : /* No user scaling */ - left = P1[0]; - bottom = P1[1]; - right = P2[0]; - top = P2[1]; - break; - - case 0 : /* Anisotropic (non-uniform) scaling */ - left = Scaling1[0]; - bottom = Scaling1[1]; - right = Scaling2[0]; - top = Scaling2[1]; - break; - - case 1 : /* Isotropic (uniform) scaling */ - left = Scaling1[0]; - bottom = Scaling1[1]; - right = Scaling2[0]; - top = Scaling2[1]; - - width = right - left; - height = top - bottom; - - if (width == 0 || height == 0) - return; - - if ((width * page_height) != (height * page_width)) - { - scaling = height * page_width / page_height; - if (width < scaling) - { - width = scaling; - left = 0.5f * (left + right - width); - right = left + width; - } - else - { - height = width * page_height / page_width; - bottom = 0.5f * (bottom + top - height); - top = bottom + height; - } - } - break; - - case 2 : - left = Scaling1[0]; - bottom = Scaling1[1]; - right = left + page_width * Scaling2[0] * 1016.0f / 72.0f; - top = bottom + page_height * Scaling2[1] * 1016.0f / 72.0f; - break; - } - - width = right - left; - height = top - bottom; - - if (width == 0 || height == 0) - return; - - /* - * Scale the plot as needed... - */ - - if (Rotation == 0 || Rotation == 180) - scaling = page_width / width; - else - scaling = page_width / height; - - if (FitPlot) - scaling *= max(page_width, page_height) / max(PlotSize[1], PlotSize[0]); - - /* - * Offset for the current P1 location... - */ - - if (FitPlot) - { - left = 0; - bottom = 0; - } - else - { - left = P1[0] * 72.0f / 1016.0f; - bottom = P1[1] * 72.0f / 1016.0f; - } - - /* - * Generate a new transformation matrix... - */ - - switch (Rotation) - { - default : - case 0 : - Transform[0][0] = scaling; - Transform[0][1] = 0.0; - Transform[0][2] = -left; - Transform[1][0] = 0.0; - Transform[1][1] = scaling; - Transform[1][2] = -bottom; - break; - - case 90 : - Transform[0][0] = 0.0; - Transform[0][1] = -scaling; - Transform[0][2] = PageLength - left; - Transform[1][0] = scaling; - Transform[1][1] = 0.0; - Transform[1][2] = -bottom; - break; - - case 180 : - Transform[0][0] = -scaling; - Transform[0][1] = 0.0; - Transform[0][2] = PageLength - left; - Transform[1][0] = 0.0; - Transform[1][1] = -scaling; - Transform[1][2] = PageWidth - bottom; - break; - - case 270 : - Transform[0][0] = 0.0; - Transform[0][1] = scaling; - Transform[0][2] = -left; - Transform[1][0] = -scaling; - Transform[1][1] = 0.0; - Transform[1][2] = PageWidth - bottom; - break; - } - - fprintf(stderr, "DEBUG: Transform = [ %.3f %.3f\n" - "DEBUG: %.3f %.3f\n" - "DEBUG: %.3f %.3f ]\n", - Transform[0][0], Transform[1][0], Transform[0][1], - Transform[1][1], Transform[0][2], Transform[1][2]); - - if (FitPlot) - { - if (Rotation == 0 || Rotation == 180) - PenScaling = page_width / PlotSize[1]; - else - PenScaling = page_width / PlotSize[0]; - } - else - PenScaling = 1.0; - - if (PenScaling < 0.0) - PenScaling = -PenScaling; - - if (PageDirty) - { - printf("%.2f setlinewidth\n", Pens[PenNumber].width * PenScaling); - - if (IW1[0] != IW2[0] && IW1[1] != IW2[1]) - { - iw1[0] = IW1[0] * 72.0f / 1016.0f; - iw1[1] = IW1[1] * 72.0f / 1016.0f; - iw2[0] = IW2[0] * 72.0f / 1016.0f; - iw2[1] = IW2[1] * 72.0f / 1016.0f; - - printf("initclip MP %.3f %.3f MO %.3f %.3f LI %.3f %.3f LI %.3f %.3f LI CP clip\n", - iw1[0], iw1[1], iw1[0], iw2[1], iw2[0], iw2[1], iw2[0], iw1[1]); - } - } -} - - -/* - * 'BP_begin_plot()' - Start a plot... - */ - -void -BP_begin_plot(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; -} - - -/* - * 'DF_default_values()' - Set all state info to the default values. - */ - -void -DF_default_values(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; - - NP_number_pens(0, NULL); - AC_anchor_corner(0, NULL); - AD_define_alternate(0, NULL); - SD_define_standard(0, NULL); - CF_character_fill(0, NULL); - DI_absolute_direction(0, NULL); - DT_define_label_term(0, NULL); - DV_define_variable_path(0, NULL); - ES_extra_space(0, NULL); - FT_fill_type(0, NULL); - IW_input_window(0, NULL); - LA_line_attributes(0, NULL); - LO_label_origin(0, NULL); - LT_line_type(0, NULL); - PA_plot_absolute(0, NULL); - PolygonMode = 0; - RF_raster_fill(0, NULL); - SC_scale(0, NULL); - SM_symbol_mode(0, NULL); - SS_select_standard(0, NULL); - TD_transparent_data(0, NULL); - UL_user_line_type(0, NULL); -} - - -/* - * 'IN_initialize()' - Initialize the plotter. - */ - -void -IN_initialize(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; - - DF_default_values(0, NULL); - PU_pen_up(0, NULL); - RO_rotate(0, NULL); - PS_plot_size(0, NULL); - WU_width_units(0, NULL); - PW_pen_width(0, NULL); - - PenWidth = 1; - - PenPosition[0] = PenPosition[1] = 0.0; -} - - -/* - * 'IP_input_absolute()' - Set P1 and P2 values for the plot. - */ - -void -IP_input_absolute(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - if (num_params == 0) - { - P1[0] = PageLeft / 72.0f * 1016.0f; - P1[1] = PageBottom / 72.0f * 1016.0f; - P2[0] = PageRight / 72.0f * 1016.0f; - P2[1] = PageTop / 72.0f * 1016.0f; - } - else if (num_params == 2) - { - P2[0] -= P1[0]; - P2[1] -= P1[1]; - P1[0] = params[0].value.number; - P1[1] = params[1].value.number; - P2[0] += P1[0]; - P2[1] += P1[1]; - } - else if (num_params == 4) - { - P1[0] = params[0].value.number; - P1[1] = params[1].value.number; - P2[0] = params[2].value.number; - P2[1] = params[3].value.number; - } - - IW1[0] = 0.0; - IW1[1] = 0.0; - IW2[0] = 0.0; - IW2[1] = 0.0; - - if (ScalingType < 0) - { - Scaling1[0] = P1[0]; - Scaling1[0] = P1[1]; - Scaling2[0] = P2[0]; - Scaling2[1] = P2[1]; - } - - update_transform(); -} - - -/* - * 'IR_input_relative()' - Update P1 and P2. - */ - -void -IR_input_relative(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - if (num_params == 0) - { - P1[0] = PageLeft / 72.0f * 1016.0f; - P1[1] = PageBottom / 72.0f * 1016.0f; - P2[0] = PageRight / 72.0f * 1016.0f; - P2[1] = PageTop / 72.0f * 1016.0f; - } - else if (num_params == 2) - { - P2[0] -= P1[0]; - P2[1] -= P1[1]; - P1[0] = params[0].value.number * PlotSize[0] / 72.0f * 1016.0f / 100.0f; - P1[1] = params[1].value.number * PlotSize[1] / 72.0f * 1016.0f / 100.0f; - P2[0] += P1[0]; - P2[1] += P1[1]; - } - else if (num_params == 4) - { - P1[0] = params[0].value.number * PlotSize[0] / 72.0f * 1016.0f / 100.0f; - P1[1] = params[1].value.number * PlotSize[1] / 72.0f * 1016.0f / 100.0f; - P2[0] = params[2].value.number * PlotSize[0] / 72.0f * 1016.0f / 100.0f; - P2[1] = params[3].value.number * PlotSize[1] / 72.0f * 1016.0f / 100.0f; - } - - IW1[0] = 0.0; - IW1[1] = 0.0; - IW2[0] = 0.0; - IW2[1] = 0.0; - - if (ScalingType < 0) - { - Scaling1[0] = P1[0]; - Scaling1[0] = P1[1]; - Scaling2[0] = P2[0]; - Scaling2[1] = P2[1]; - } - - update_transform(); -} - - -/* - * 'IW_input_window()' - Setup an input window. - */ - -void -IW_input_window(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - if (num_params == 0) - { - IW1[0] = PageLeft / 72.0f * 1016.0f; - IW1[1] = PageBottom / 72.0f * 1016.0f; - IW2[0] = PageRight / 72.0f * 1016.0f; - IW2[1] = PageTop / 72.0f * 1016.0f; - } - else if (num_params == 4) - { - - if (ScalingType < 0) - { - IW1[0] = params[0].value.number; - IW1[1] = params[1].value.number; - IW2[0] = params[2].value.number; - IW2[1] = params[3].value.number; - } - else - { - IW1[0] = (Transform[0][0] * params[0].value.number + - Transform[0][1] * params[1].value.number + - Transform[0][2]) / 72.0f * 1016.0f; - IW1[1] = (Transform[1][0] * params[0].value.number + - Transform[1][1] * params[1].value.number + - Transform[1][2]) / 72.0f * 1016.0f; - IW2[0] = (Transform[0][0] * params[2].value.number + - Transform[0][1] * params[3].value.number + - Transform[0][2]) / 72.0f * 1016.0f; - IW2[1] = (Transform[1][0] * params[2].value.number + - Transform[1][1] * params[3].value.number + - Transform[1][2]) / 72.0f * 1016.0f; - } - - fprintf(stderr, "DEBUG: IW%.0f,%.0f,%.0f,%.0f = [ %.0f %.0f %.0f %.0f ]\n", - params[0].value.number, params[1].value.number, - params[2].value.number, params[3].value.number, - IW1[0], IW1[1], IW2[0], IW2[1]); - } - - - update_transform(); -} - - -/* - * 'PG_advance_page()' - Eject the current page. - */ - -void -PG_advance_page(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; - - if (PageDirty) - { - puts("grestore"); - puts("showpage"); - - PageDirty = 0; - } -} - - -/* - * 'PS_plot_size()' - Set the plot size. - */ - -void -PS_plot_size(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - switch (num_params) - { - case 0 : /* PS ; */ - if (Rotation == 0 || Rotation == 180) - { - PlotSize[0] = PageWidth; - PlotSize[1] = PageLength; - } - else - { - PlotSize[0] = PageLength; - PlotSize[1] = PageWidth; - } - - PlotSizeSet = 0; - break; - case 1 : /* PS length ; */ - if (Rotation == 0 || Rotation == 180) - { - PlotSize[1] = 72.0f * params[0].value.number / 1016.0f; - PlotSize[0] = 0.75f * PlotSize[1]; - } - else - { - PlotSize[0] = 72.0f * params[0].value.number / 1016.0f; - PlotSize[1] = 0.75f * PlotSize[0]; - } - - PlotSizeSet = 1; - break; - case 2 : /* PS length, width ; */ - /* - * Unfortunately, it appears that NO application correctly - * sends a two-argument PS command as documented in the - * HP-GL/2 Reference Manual from HP. Instead, applications - * send the width before the length, which causes all sorts - * of problems when scaling. - * - * Rather than fight it, we now look for them as width,length - * instead of length,width. - * - * Don't like it? Send mail to the folks that make Ideas, Pro/E, - * AutoCAD, etc. - */ - - if (Rotation == 0 || Rotation == 180) - { - PlotSize[0] = 72.0f * params[0].value.number / 1016.0f; - PlotSize[1] = 72.0f * params[1].value.number / 1016.0f; - } - else - { - PlotSize[0] = 72.0f * params[1].value.number / 1016.0f; - PlotSize[1] = 72.0f * params[0].value.number / 1016.0f; - } - - PlotSizeSet = 1; - break; - } - - /* - * This is required for buggy files that don't set the input window. - */ - - IP_input_absolute(0, NULL); -} - - -/* - * 'RO_rotate()' - Rotate the plot. - */ - -void -RO_rotate(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - if (num_params == 0) - Rotation = 0; - else - Rotation = (int)params[0].value.number; - - update_transform(); -} - - -/* - * 'RP_replot()' - Replot the current page. - */ - -void -RP_replot(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; -} - - -/* - * 'SC_scale()' - Set user-defined scaling. - */ - -void -SC_scale(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - if (num_params == 0) - { - ScalingType = -1; - Scaling1[0] = P1[0]; - Scaling1[0] = P1[1]; - Scaling2[0] = P2[0]; - Scaling2[1] = P2[1]; - } - else if (num_params > 3) - { - Scaling1[0] = params[0].value.number; - Scaling2[0] = params[1].value.number; - Scaling1[1] = params[2].value.number; - Scaling2[1] = params[3].value.number; - - if (num_params > 4) - ScalingType = (int)params[4].value.number; - else - ScalingType = 1; - } - - update_transform(); -} - - -/* - * End of "$Id: hpgl-config.c 6649 2007-07-11 21:46:42Z mike $". - */ diff --git a/filter/hpgl-input.c b/filter/hpgl-input.c deleted file mode 100644 index 195094c75..000000000 --- a/filter/hpgl-input.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * "$Id: hpgl-input.c 7219 2008-01-14 22:00:02Z mike $" - * - * HP-GL/2 input processing for the Common UNIX Printing System (CUPS). - * - * Copyright 2007-2009 by Apple Inc. - * Copyright 1993-2006 by Easy Software Products. - * - * These coded instructions, statements, and computer programs are the - * property of Apple Inc. and are protected by Federal copyright - * law. Distribution and use rights are outlined in the file "LICENSE.txt" - * which should have been included with this file. If this file is - * file is missing or damaged, see the license at "http://www.cups.org/". - * - * This file is subject to the Apple OS-Developed Software exception. - * - * Contents: - * - * ParseCommand() - Parse an HPGL/2 command. - * FreeParameters() - Free all string parameter values. - */ - -/* - * Include necessary headers... - */ - -#include "hpgltops.h" -#include <ctype.h> -#include <cups/i18n.h> - -#define MAX_PARAMS 16384 - - -/* - * 'ParseCommand()' - Parse an HPGL/2 command. - * - * Returns the number of parameters seen or -1 on EOF. - */ - -int /* O - -1 on EOF, # params otherwise */ -ParseCommand(FILE *fp, /* I - File to read from */ - char *name, /* O - Name of command */ - param_t **params) /* O - Parameter list */ -{ - int num_params, /* Number of parameters seen */ - ch, /* Current char */ - done, /* Non-zero when the current command is read */ - i; /* Looping var */ - char buf[262144], /* String buffer */ - *bufptr; /* Pointer into buffer */ - float temp; /* Temporary parameter value */ - static param_t p[MAX_PARAMS]; /* Parameter buffer */ - - - num_params = 0; - done = 0; - - do - { - while ((ch = getc(fp)) != EOF) - if (strchr(" \t\r\n,;", ch) == NULL) - break; - - if (ch == EOF) - { - return (-1); - } - - if (ch == 0x1b) - switch (getc(fp)) - { - case '.' : /* HP-GL/2 job control */ - i = getc(fp); - - if (strchr(")Z", i) != NULL) - { - /* - * 'Printer Off' command - look for next 'Printer On' command... - */ - - for (;;) - { - while ((i = getc(fp)) != EOF && i != 0x1b); - - if (i == EOF) - return (-1); - - if (getc(fp) != '.') - continue; - - if ((i = getc(fp)) == '(' || - i == 'Y') - break; - } - } - else if (strchr("@HIMNTI\003", i) != NULL) - { - while ((i = getc(fp)) != EOF && i != ':'); - } - break; - - case '%' : /* PJL command? */ - if ((i = getc(fp)) == '-') - if ((i = getc(fp)) == '1') - if ((i = getc(fp)) == '2') - { - /* - * Yes, dump everything up to the "ENTER LANGUAGE" line... - */ - - while (fgets(buf, sizeof(buf), fp) != NULL) - if (strstr(buf, "ENTER") && strstr(buf, "LANGUAGE")) - break; - break; - } - - ungetc(i, fp); - - default : /* HP RTL/PCL control */ - while ((i = getc(fp)) != EOF && !isupper(i & 255)); - - if (i == EOF) - return (-1); - break; - } - } while (ch < ' '); - - name[0] = ch; - name[1] = getc(fp); - name[2] = '\0'; - - if (name[1] < ' ') - { - /* - * If we get here, then more than likely we are faced with a raw PCL - * file which we can't handle - abort! - */ - - fputs(_("ERROR: Invalid HP-GL/2 command seen, unable to print file\n"), - stderr); - return (-1); - } - - if (!strcasecmp(name, "LB")) - { - bufptr = buf; - while ((ch = getc(fp)) != StringTerminator && ch != EOF) - if (bufptr < (buf + sizeof(buf) - 1)) - *bufptr++ = ch; - *bufptr = '\0'; - - p[num_params].type = PARAM_STRING; - p[num_params].value.string = strdup(buf); - num_params ++; - } - else if (!strcasecmp(name, "SM")) - { - buf[0] = getc(fp); - buf[1] = '\0'; - p[num_params].type = PARAM_STRING; - p[num_params].value.string = strdup(buf); - num_params ++; - } - else if (!strcasecmp(name, "DT")) - { - if ((buf[0] = getc(fp)) != ';') - { - buf[1] = '\0'; - p[num_params].type = PARAM_STRING; - p[num_params].value.string = strdup(buf); - num_params ++; - } - } - else if (!strcasecmp(name, "PE")) - { - bufptr = buf; - while ((ch = getc(fp)) != ';') - if (ch == EOF) - break; - else if (bufptr < (buf + sizeof(buf) - 1)) - *bufptr++ = ch; - *bufptr = '\0'; - - p[num_params].type = PARAM_STRING; - p[num_params].value.string = strdup(buf); - num_params ++; - } - - while (!done) - switch (ch = getc(fp)) - { - case EOF : - done = 1; - break; - - case ',' : - case ' ' : - case '\n' : - case '\r' : - case '\t' : - break; - - case '\"' : - fscanf(fp, "%262143[^\"]\"", buf); - if (num_params < MAX_PARAMS) - { - p[num_params].type = PARAM_STRING; - p[num_params].value.string = strdup(buf); - num_params ++; - }; - break; - - case '-' : - case '+' : - ungetc(ch, fp); - if (fscanf(fp, "%f", &temp) == 1 && num_params < MAX_PARAMS) - { - p[num_params].type = PARAM_RELATIVE; - p[num_params].value.number = temp; - num_params ++; - } - break; - case '0' : - case '1' : - case '2' : - case '3' : - case '4' : - case '5' : - case '6' : - case '7' : - case '8' : - case '9' : - case '.' : - ungetc(ch, fp); - if (fscanf(fp, "%f", &temp) == 1 && num_params < MAX_PARAMS) - { - p[num_params].type = PARAM_ABSOLUTE; - p[num_params].value.number = temp; - num_params ++; - } - break; - default : - ungetc(ch, fp); - done = 1; - break; - } - - *params = p; - return (num_params); -} - - -/* - * 'FreeParameters()' - Free all string parameter values. - */ - -void -FreeParameters(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameter values */ -{ - int i; /* Looping var */ - - - for (i = 0; i < num_params; i ++) - if (params[i].type == PARAM_STRING) - free(params[i].value.string); -} - - -/* - * End of "$Id: hpgl-input.c 7219 2008-01-14 22:00:02Z mike $". - */ diff --git a/filter/hpgl-main.c b/filter/hpgl-main.c deleted file mode 100644 index 953d44702..000000000 --- a/filter/hpgl-main.c +++ /dev/null @@ -1,269 +0,0 @@ -/* - * "$Id: hpgl-main.c 6649 2007-07-11 21:46:42Z mike $" - * - * HP-GL/2 filter main entry for the Common UNIX Printing System (CUPS). - * - * Copyright 2007-2008 by Apple Inc. - * Copyright 1993-2007 by Easy Software Products. - * - * These coded instructions, statements, and computer programs are the - * property of Apple Inc. and are protected by Federal copyright - * law. Distribution and use rights are outlined in the file "LICENSE.txt" - * which should have been included with this file. If this file is - * file is missing or damaged, see the license at "http://www.cups.org/". - * - * This file is subject to the Apple OS-Developed Software exception. - * - * Contents: - * - * main() - Main entry for HP-GL/2 filter. - * compare_names() - Compare two command names. - */ - -/* - * Include necessary headers... - */ - -/*#define DEBUG*/ -#define _HPGL_MAIN_C_ -#include "hpgltops.h" -#include <cups/i18n.h> - - -/* - * HP-GL/2 command table... - */ - -typedef struct -{ - char name[4]; /* Name of command */ - void (*func)(int, param_t *); /* Function to call */ -} name_t; - -static name_t commands[] = -{ - { "BP", BP_begin_plot }, - { "DF", DF_default_values }, - { "IN", IN_initialize }, - { "IP", IP_input_absolute }, - { "IR", IR_input_relative }, - { "IW", IW_input_window }, - { "PG", PG_advance_page }, - { "RO", RO_rotate }, - { "RP", RP_replot }, - { "SC", SC_scale }, - { "AA", AA_arc_absolute }, - { "AR", AR_arc_relative }, - { "AT", AT_arc_absolute3 }, - { "CI", CI_circle }, - { "PA", PA_plot_absolute }, - { "PD", PD_pen_down }, - { "PE", PE_polyline_encoded }, - { "PR", PR_plot_relative }, - { "PS", PS_plot_size }, - { "PU", PU_pen_up }, - { "RT", RT_arc_relative3 }, - { "EA", EA_edge_rect_absolute }, - { "EP", EP_edge_polygon }, - { "ER", ER_edge_rect_relative }, - { "EW", EW_edge_wedge }, - { "FP", FP_fill_polygon }, - { "PM", PM_polygon_mode }, - { "RA", RA_fill_rect_absolute }, - { "RR", RR_fill_rect_relative }, - { "WG", WG_fill_wedge }, - { "AD", AD_define_alternate }, - { "CF", CF_character_fill }, - { "CP", CP_character_plot }, - { "DI", DI_absolute_direction }, - { "DR", DR_relative_direction }, - { "DT", DT_define_label_term }, - { "DV", DV_define_variable_path }, - { "ES", ES_extra_space }, - { "LB", LB_label }, - { "LO", LO_label_origin }, - { "SA", SA_select_alternate }, - { "SD", SD_define_standard }, - { "SI", SI_absolute_size }, - { "SL", SL_character_slant }, - { "SR", SR_relative_size }, - { "SS", SS_select_standard }, - { "TD", TD_transparent_data }, - { "AC", AC_anchor_corner }, - { "FT", FT_fill_type }, - { "LA", LA_line_attributes }, - { "LT", LT_line_type }, - { "NP", NP_number_pens }, - { "PC", PC_pen_color }, - { "CR", CR_color_range }, - { "PW", PW_pen_width }, - { "RF", RF_raster_fill }, - { "SM", SM_symbol_mode }, - { "SP", SP_select_pen }, - { "UL", UL_user_line_type }, - { "WU", WU_width_units } -}; -#define NUM_COMMANDS (sizeof(commands) / sizeof(name_t)) - - -/* - * Local functions... - */ - -static int compare_names(const void *p1, const void *p2); - - -/* - * 'main()' - Main entry for HP-GL/2 filter. - */ - -int /* O - Exit status */ -main(int argc, /* I - Number of command-line arguments */ - char *argv[]) /* I - Command-line arguments */ -{ - FILE *fp; /* Input file */ - int num_params; /* Number of parameters */ - param_t *params; /* Command parameters */ - name_t *command, /* Command */ - name; /* Name of command */ - int num_options; /* Number of print options */ - cups_option_t *options; /* Print options */ - const char *val; /* Option value */ - int shading; /* -1 = black, 0 = grey, 1 = color */ - - - /* - * Make sure status messages are not buffered... - */ - - setbuf(stdout, NULL); - setbuf(stderr, NULL); - - /* - * Check command-line... - */ - - if (argc < 6 || argc > 7) - { - fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"), - argv[0]); - return (1); - } - - /* - * If we have 7 arguments, print the file named on the command-line. - * Otherwise, send stdin instead... - */ - - if (argc == 6) - fp = stdin; - else - { - /* - * Try to open the print file... - */ - - if ((fp = fopen(argv[6], "rb")) == NULL) - { - perror("DEBUG: unable to open print file - "); - return (1); - } - } - - /* - * Process command-line options and write the prolog... - */ - - options = NULL; - num_options = cupsParseOptions(argv[5], 0, &options); - - PPD = SetCommonOptions(num_options, options, 1); - - PlotSize[0] = PageWidth; - PlotSize[1] = PageLength; - - shading = 1; - PenWidth = 1.0; - - if ((val = cupsGetOption("blackplot", num_options, options)) != NULL && - strcasecmp(val, "no") && strcasecmp(val, "off") && - strcasecmp(val, "false")) - shading = 0; - - if ((val = cupsGetOption("fitplot", num_options, options)) != NULL && - !strcasecmp(val, "true")) - FitPlot = 1; - else if ((val = cupsGetOption("fit-to-page", num_options, options)) != NULL && - !strcasecmp(val, "true")) - FitPlot = 1; - - if ((val = cupsGetOption("penwidth", num_options, options)) != NULL) - PenWidth = (float)atoi(val) * 0.001f; - - /* - * Write the PostScript prolog and initialize the plotting "engine"... - */ - - OutputProlog(argv[3], argv[2], shading); - - IP_input_absolute(0, NULL); - - /* - * Sort the command array... - */ - - qsort(commands, NUM_COMMANDS, sizeof(name_t), - (int (*)(const void *, const void *))compare_names); - - /* - * Read commands until we reach the end of file. - */ - - while ((num_params = ParseCommand(fp, name.name, ¶ms)) >= 0) - { - Outputf("%% %s(%d)\n", name.name, num_params); - -#ifdef DEBUG - { - int i; - fprintf(stderr, "DEBUG: %s(%d)", name.name, num_params); - for (i = 0; i < num_params; i ++) - if (params[i].type == PARAM_STRING) - fprintf(stderr, " \'%s\'", params[i].value.string); - else - fprintf(stderr, " %f", params[i].value.number); - fputs("\n", stderr); - } -#endif /* DEBUG */ - - if ((command = bsearch(&name, commands, NUM_COMMANDS, sizeof(name_t), - (int (*)(const void *, const void *))compare_names)) != NULL) - (*command->func)(num_params, params); - - FreeParameters(num_params, params); - } - - OutputTrailer(); - - if (fp != stdin) - fclose(fp); - - return (0); -} - - -/* - * 'compare_names()' - Compare two command names. - */ - -static int /* O - Result of strcasecmp() on names */ -compare_names(const void *p1, /* I - First name */ - const void *p2) /* I - Second name */ -{ - return (strcasecmp(((name_t *)p1)->name, ((name_t *)p2)->name)); -} - - -/* - * End of "$Id: hpgl-main.c 6649 2007-07-11 21:46:42Z mike $". - */ diff --git a/filter/hpgl-polygon.c b/filter/hpgl-polygon.c deleted file mode 100644 index 6f8df01c3..000000000 --- a/filter/hpgl-polygon.c +++ /dev/null @@ -1,385 +0,0 @@ -/* - * "$Id: hpgl-polygon.c 6649 2007-07-11 21:46:42Z mike $" - * - * HP-GL/2 polygon routines for the Common UNIX Printing System (CUPS). - * - * Copyright 2007 by Apple Inc. - * Copyright 1993-2005 by Easy Software Products. - * - * These coded instructions, statements, and computer programs are the - * property of Apple Inc. and are protected by Federal copyright - * law. Distribution and use rights are outlined in the file "LICENSE.txt" - * which should have been included with this file. If this file is - * file is missing or damaged, see the license at "http://www.cups.org/". - * - * This file is subject to the Apple OS-Developed Software exception. - * - * Contents: - * - * EA_edge_rect_absolute() - Draw a rectangle. - * EP_edge_polygon() - Stroke the edges of a polygon. - * ER_edge_rect_relative() - Draw a rectangle relative to the current - * EW_edge_wedge() - Draw a pie wedge. - * FP_fill_polygon() - Fill a polygon. - * PM_polygon_mode() - Set the polygon drawing mode. - * RA_fill_rect_absolute() - Fill a rectangle. - * RR_fill_rect_relative() - Fill a rectangle relative to the current - * WG_fill_wedge() - Fill a pie wedge. - */ - -/* - * Include necessary headers... - */ - -#include "hpgltops.h" - - -/* - * 'EA_edge_rect_absolute()' - Draw a rectangle. - */ - -void -EA_edge_rect_absolute(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - float x, y; /* Transformed coordinates */ - - - if (num_params < 2) - return; - - x = Transform[0][0] * params[0].value.number + - Transform[0][1] * params[1].value.number + - Transform[0][2]; - y = Transform[1][0] * params[0].value.number + - Transform[1][1] * params[1].value.number + - Transform[1][2]; - - if (!PolygonMode) - Outputf("MP\n"); - - PenValid = 1; - - Outputf("%.3f %.3f MO\n", PenPosition[0], PenPosition[1]); - Outputf("%.3f %.3f LI\n", PenPosition[0], y); - Outputf("%.3f %.3f LI\n", x, y); - Outputf("%.3f %.3f LI\n", x, PenPosition[1]); - - Outputf("CP\n"); - if (!PolygonMode) - Outputf("ST\n"); -} - - -/* - * 'EP_edge_polygon()' - Stroke the edges of a polygon. - */ - -void -EP_edge_polygon(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; - - Outputf("ST\n"); -} - - -/* - * 'ER_edge_rect_relative()' - Draw a rectangle relative to the current - * pen position. - */ - -void -ER_edge_rect_relative(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - float x, y; /* Transformed coordinates */ - - - if (num_params < 2) - return; - - x = Transform[0][0] * params[0].value.number + - Transform[0][1] * params[1].value.number + - PenPosition[0]; - y = Transform[1][0] * params[0].value.number + - Transform[1][1] * params[1].value.number + - PenPosition[1]; - - if (!PolygonMode) - Outputf("MP\n"); - - PenValid = 1; - - Outputf("%.3f %.3f MO\n", PenPosition[0], PenPosition[1]); - Outputf("%.3f %.3f LI\n", PenPosition[0], y); - Outputf("%.3f %.3f LI\n", x, y); - Outputf("%.3f %.3f LI\n", x, PenPosition[1]); - - Outputf("CP\n"); - if (!PolygonMode) - Outputf("ST\n"); -} - - -/* - * 'EW_edge_wedge()' - Draw a pie wedge. - */ - -void -EW_edge_wedge(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - float x, y; /* Transformed coordinates */ - float start, end, /* Start and end of arc */ - theta, /* Current angle */ - dt, /* Step between points */ - radius; /* Radius of arc */ - - - if (num_params < 3) - return; - - radius = params[0].value.number; - start = params[1].value.number; - end = start + params[2].value.number; - - if (num_params > 3) - dt = (float)fabs(params[3].value.number); - else - dt = 5.0f; - - if (!PolygonMode) - Outputf("MP\n"); - - PenValid = 1; - - Outputf("%.3f %.3f MO\n", PenPosition[0], PenPosition[1]); - - if (start < end) - for (theta = start + dt; theta < end; theta += dt) - { - x = (float)(PenPosition[0] + - radius * cos(M_PI * theta / 180.0) * Transform[0][0] + - radius * sin(M_PI * theta / 180.0) * Transform[0][1]); - y = (float)(PenPosition[1] + - radius * cos(M_PI * theta / 180.0) * Transform[1][0] + - radius * sin(M_PI * theta / 180.0) * Transform[1][1]); - - Outputf("%.3f %.3f LI\n", x, y); - } - else - for (theta = start - dt; theta > end; theta -= dt) - { - x = (float)(PenPosition[0] + - radius * cos(M_PI * theta / 180.0) * Transform[0][0] + - radius * sin(M_PI * theta / 180.0) * Transform[0][1]); - y = (float)(PenPosition[1] + - radius * cos(M_PI * theta / 180.0) * Transform[1][0] + - radius * sin(M_PI * theta / 180.0) * Transform[1][1]); - - Outputf("%.3f %.3f LI\n", x, y); - } - - x = (float)(PenPosition[0] + - radius * cos(M_PI * end / 180.0) * Transform[0][0] + - radius * sin(M_PI * end / 180.0) * Transform[0][1]); - y = (float)(PenPosition[1] + - radius * cos(M_PI * end / 180.0) * Transform[1][0] + - radius * sin(M_PI * end / 180.0) * Transform[1][1]); - Outputf("%.3f %.3f LI\n", x, y); - - Outputf("CP\n"); - if (!PolygonMode) - Outputf("ST\n"); -} - - -/* - * 'FP_fill_polygon()' - Fill a polygon. - */ - -void -FP_fill_polygon(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - (void)num_params; - (void)params; - - Outputf("FI\n"); -} - - -/* - * 'PM_polygon_mode()' - Set the polygon drawing mode. - */ - -void -PM_polygon_mode(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - if (num_params == 0 || - params[0].value.number == 0) - { - Outputf("MP\n"); - PenValid = 0; - PolygonMode = 1; - } - else if (params[0].value.number == 2) - PolygonMode = 0; -} - - -/* - * 'RA_fill_rect_absolute()' - Fill a rectangle. - */ - -void -RA_fill_rect_absolute(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - float x, y; /* Transformed coordinates */ - - - if (num_params < 2) - return; - - x = Transform[0][0] * params[0].value.number + - Transform[0][1] * params[1].value.number + - Transform[0][2]; - y = Transform[1][0] * params[0].value.number + - Transform[1][1] * params[1].value.number + - Transform[1][2]; - - if (!PolygonMode) - Outputf("MP\n"); - - PenValid = 1; - - Outputf("%.3f %.3f MO\n", PenPosition[0], PenPosition[1]); - Outputf("%.3f %.3f LI\n", PenPosition[0], y); - Outputf("%.3f %.3f LI\n", x, y); - Outputf("%.3f %.3f LI\n", x, PenPosition[1]); - - Outputf("CP\n"); - if (!PolygonMode) - Outputf("FI\n"); -} - - -/* - * 'RR_fill_rect_relative()' - Fill a rectangle relative to the current - * pen position. - */ - -void -RR_fill_rect_relative(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - float x, y; /* Transformed coordinates */ - - - if (num_params < 2) - return; - - x = Transform[0][0] * params[0].value.number + - Transform[0][1] * params[1].value.number + - PenPosition[0]; - y = Transform[1][0] * params[0].value.number + - Transform[1][1] * params[1].value.number + - PenPosition[1]; - - if (!PolygonMode) - Outputf("MP\n"); - - PenValid = 1; - - Outputf("%.3f %.3f MO\n", PenPosition[0], PenPosition[1]); - Outputf("%.3f %.3f LI\n", PenPosition[0], y); - Outputf("%.3f %.3f LI\n", x, y); - Outputf("%.3f %.3f LI\n", x, PenPosition[1]); - - Outputf("CP\n"); - if (!PolygonMode) - Outputf("FI\n"); -} - - -/* - * 'WG_fill_wedge()' - Fill a pie wedge. - */ - -void -WG_fill_wedge(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - float x, y; /* Transformed coordinates */ - float start, end, /* Start and end angles */ - theta, /* Current angle */ - dt, /* Step between points */ - radius; /* Radius of arc */ - - - if (num_params < 3) - return; - - radius = params[0].value.number; - start = params[1].value.number; - end = start + params[2].value.number; - - if (num_params > 3) - dt = (float)fabs(params[3].value.number); - else - dt = 5.0; - - if (!PolygonMode) - Outputf("MP\n"); - - PenValid = 1; - - Outputf("%.3f %.3f MO\n", PenPosition[0], PenPosition[1]); - - if (start < end) - for (theta = start + dt; theta < end; theta += dt) - { - x = (float)(PenPosition[0] + - radius * cos(M_PI * theta / 180.0) * Transform[0][0] + - radius * sin(M_PI * theta / 180.0) * Transform[0][1]); - y = (float)(PenPosition[1] + - radius * cos(M_PI * theta / 180.0) * Transform[1][0] + - radius * sin(M_PI * theta / 180.0) * Transform[1][1]); - - Outputf("%.3f %.3f LI\n", x, y); - } - else - for (theta = start - dt; theta > end; theta -= dt) - { - x = (float)(PenPosition[0] + - radius * cos(M_PI * theta / 180.0) * Transform[0][0] + - radius * sin(M_PI * theta / 180.0) * Transform[0][1]); - y = (float)(PenPosition[1] + - radius * cos(M_PI * theta / 180.0) * Transform[1][0] + - radius * sin(M_PI * theta / 180.0) * Transform[1][1]); - - Outputf("%.3f %.3f LI\n", x, y); - } - - x = (float)(PenPosition[0] + - radius * cos(M_PI * end / 180.0) * Transform[0][0] + - radius * sin(M_PI * end / 180.0) * Transform[0][1]); - y = (float)(PenPosition[1] + - radius * cos(M_PI * end / 180.0) * Transform[1][0] + - radius * sin(M_PI * end / 180.0) * Transform[1][1]); - Outputf("%.3f %.3f LI\n", x, y); - - Outputf("CP\n"); - if (!PolygonMode) - Outputf("FI\n"); -} - - -/* - * End of "$Id: hpgl-polygon.c 6649 2007-07-11 21:46:42Z mike $". - */ diff --git a/filter/hpgl-prolog.c b/filter/hpgl-prolog.c deleted file mode 100644 index 00e512b7a..000000000 --- a/filter/hpgl-prolog.c +++ /dev/null @@ -1,369 +0,0 @@ -/* - * "$Id: hpgl-prolog.c 6649 2007-07-11 21:46:42Z mike $" - * - * HP-GL/2 prolog routines for for the Common UNIX Printing System (CUPS). - * - * Copyright 2007 by Apple Inc. - * Copyright 1993-2007 by Easy Software Products. - * - * These coded instructions, statements, and computer programs are the - * property of Apple Inc. and are protected by Federal copyright - * law. Distribution and use rights are outlined in the file "LICENSE.txt" - * which should have been included with this file. If this file is - * file is missing or damaged, see the license at "http://www.cups.org/". - * - * This file is subject to the Apple OS-Developed Software exception. - * - * Contents: - * - * OutputProlog() - Output the PostScript prolog... - * OutputTrailer() - Output the PostScript trailer... - * Outputf() - Write a formatted string to the output file, creating the - * page header as needed... - */ - -/* - * Include necessary headers... - */ - -#include "hpgltops.h" -#include <stdarg.h> - - -/* - * 'OutputProlog()' - Output the PostScript prolog... - */ - -void -OutputProlog(char *title, /* I - Job title */ - char *user, /* I - Username */ - int shading) /* I - Type of shading */ -{ - FILE *prolog; /* Prolog file */ - char line[255]; /* Line from prolog file */ - const char *datadir; /* CUPS_DATADIR environment variable */ - char filename[1024]; /* Name of prolog file */ - time_t curtime; /* Current time */ - struct tm *curtm; /* Current date */ - - - curtime = time(NULL); - curtm = localtime(&curtime); - - puts("%!PS-Adobe-3.0"); - printf("%%%%BoundingBox: %.0f %.0f %.0f %.0f\n", - PageLeft, PageBottom, PageRight, PageTop); - puts("%%Pages: (atend)"); - printf("%%%%LanguageLevel: %d\n", LanguageLevel); - puts("%%DocumentData: Clean7Bit"); - puts("%%DocumentSuppliedResources: procset hpgltops 1.1 0"); - puts("%%DocumentNeededResources: font Courier Helvetica"); - puts("%%Creator: hpgltops/" CUPS_SVERSION); - strftime(line, sizeof(line), "%c", curtm); - printf("%%%%CreationDate: %s\n", line); - WriteTextComment("Title", title); - WriteTextComment("For", user); - printf("%%cupsRotation: %d\n", (Orientation & 3) * 90); - puts("%%EndComments"); - puts("%%BeginProlog"); - printf("/DefaultPenWidth %.2f def\n", PenWidth * 72.0 / 25.4); - if (!shading) /* Black only */ - puts("/setrgbcolor { pop pop pop } bind def"); - else if (!ColorDevice) /* Greyscale */ - puts("/setrgbcolor { 0.08 mul exch 0.61 mul add exch 0.31 mul add setgray } bind def\n"); - - if ((datadir = getenv("CUPS_DATADIR")) == NULL) - datadir = CUPS_DATADIR; - - snprintf(filename, sizeof(filename), "%s/data/HPGLprolog", datadir); - - if ((prolog = fopen(filename, "r")) == NULL) - { - fprintf(stderr, - "DEBUG: Unable to open HPGL prolog \"%s\" for reading - %s\n", - filename, strerror(errno)); - exit(1); - } - - while (fgets(line, sizeof(line), prolog) != NULL) - fputs(line, stdout); - - fclose(prolog); - - puts("%%EndProlog"); - - IN_initialize(0, NULL); -} - - -/* - * 'OutputTrailer()' - Output the PostScript trailer... - */ - -void -OutputTrailer(void) -{ - if (PageDirty) - PG_advance_page(0, NULL); - - puts("%%Trailer"); - printf("%%%%Pages: %d\n", PageCount); - puts("%%EOF"); -} - - -/* - * 'Outputf()' - Write a formatted string to the output file, creating the - * page header as needed... - */ - -int /* O - Number of bytes written */ -Outputf(const char *format, /* I - Printf-style string */ - ...) /* I - Additional args as needed */ -{ - va_list ap; /* Argument pointer */ - int bytes; /* Number of bytes written */ - float iw1[2], iw2[2]; /* Clipping window */ - int i; /* Looping var */ - ppd_size_t *size; /* Page size */ - ppd_option_t *option; /* Page size option */ - ppd_choice_t *choice; /* Page size choice */ - float width, length; /* Page dimensions */ - int landscape; /* Rotate for landscape orientation? */ - - - /* - * Write the page header as needed... - */ - - if (!PageDirty) - { - PageDirty = 1; - PageCount ++; - - printf("%%%%Page: %d %d\n", PageCount, PageCount); - - landscape = 0; - - if (!FitPlot && PlotSizeSet) - { - /* - * Set the page size for this page... - */ - - if (PageRotation == 0 || PageRotation == 180) - { - width = PlotSize[0]; - length = PlotSize[1]; - } - else - { - width = PlotSize[1]; - length = PlotSize[0]; - } - - fprintf(stderr, "DEBUG: hpgltops setting page size (%.0f x %.0f)\n", - width, length); - - if (PPD != NULL) - { - fputs("DEBUG: hpgltops has a PPD file!\n", stderr); - - /* - * Lookup the closest PageSize and set it... - */ - - for (i = PPD->num_sizes, size = PPD->sizes; i > 0; i --, size ++) - if ((fabs(length - size->length) < 36.0 && size->width >= width) || - (fabs(length - size->width) < 36.0 && size->length >= width)) - break; - - if (i == 0 && PPD->variable_sizes) - { - for (i = PPD->num_sizes, size = PPD->sizes; i > 0; i --, size ++) - if (strcasecmp(size->name, "custom") == 0) - break; - } - - if (i > 0) - { - /* - * Found a matching size... - */ - - option = ppdFindOption(PPD, "PageSize"); - choice = ppdFindChoice(option, size->name); - - puts("%%BeginPageSetup"); - printf("%%%%BeginFeature: PageSize %s\n", size->name); - - if (strcasecmp(size->name, "custom") == 0) - { - PageLeft = PPD->custom_margins[0]; - PageRight = width - PPD->custom_margins[2]; - PageWidth = width; - PageBottom = PPD->custom_margins[1]; - PageTop = length - PPD->custom_margins[3]; - PageLength = length; - - printf("%.0f %.0f 0 0 0\n", width, length); - - if (choice->code == NULL) - { - /* - * This can happen with certain buggy PPD files that don't include - * a CustomPageSize command sequence... We just use a generic - * Level 2 command sequence... - */ - - puts("pop pop pop"); - puts("<</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice\n"); - } - else - { - /* - * Use the vendor-supplied command... - */ - - printf("%s\n", choice->code); - } - } - else - { - if (choice->code) - printf("%s\n", choice->code); - - if (fabs(length - size->width) < 36.0) - { - /* - * Do landscape orientation... - */ - - PageLeft = size->bottom; - PageRight = size->top; - PageWidth = size->length; - PageBottom = size->left; - PageTop = size->right; - PageLength = size->width; - - landscape = 1; - } - else - { - /* - * Do portrait orientation... - */ - - PageLeft = size->left; - PageRight = size->right; - PageWidth = size->width; - PageBottom = size->bottom; - PageTop = size->top; - PageLength = size->length; - } - } - - puts("%%EndFeature"); - puts("%%EndPageSetup"); - } - } - else - { - fputs("DEBUG: hpgltops does not have a PPD file!\n", stderr); - - puts("%%BeginPageSetup"); - printf("%%%%BeginFeature: PageSize w%.0fh%.0f\n", width, length); - printf("<</PageSize[%.0f %.0f]/ImageBBox null>>setpagedevice\n", - width, length); - puts("%%EndFeature"); - puts("%%EndPageSetup"); - - PageLeft = 0.0; - PageRight = width; - PageWidth = width; - PageBottom = 0.0; - PageTop = length; - PageLength = length; - } - } - - define_font(0); - define_font(1); - - printf("%.1f setmiterlimit\n", MiterLimit); - printf("%d setlinecap\n", LineCap); - printf("%d setlinejoin\n", LineJoin); - - printf("%.3f %.3f %.3f %.2f SP\n", Pens[1].rgb[0], Pens[1].rgb[1], - Pens[1].rgb[2], Pens[1].width * PenScaling); - - puts("gsave"); - - if (Duplex && (PageCount & 1) == 0) - switch ((PageRotation / 90 + landscape) & 3) - { - case 0 : - printf("%.1f %.1f translate\n", PageWidth - PageRight, PageBottom); - break; - case 1 : - printf("%.0f 0 translate 90 rotate\n", PageLength); - printf("%.1f %.1f translate\n", PageLength - PageTop, - PageWidth - PageRight); - break; - case 2 : - printf("%.0f %.0f translate 180 rotate\n", PageWidth, PageLength); - printf("%.1f %.1f translate\n", PageLeft, PageLength - PageTop); - break; - case 3 : - printf("0 %.0f translate -90 rotate\n", PageWidth); - printf("%.1f %.1f translate\n", PageBottom, PageLeft); - break; - } - else - switch ((PageRotation / 90 + landscape) & 3) - { - case 0 : - printf("%.1f %.1f translate\n", PageLeft, PageBottom); - break; - case 1 : - printf("%.0f 0 translate 90 rotate\n", PageLength); - printf("%.1f %.1f translate\n", PageBottom, PageWidth - PageRight); - break; - case 2 : - printf("%.0f %.0f translate 180 rotate\n", PageWidth, PageLength); - printf("%.1f %.1f translate\n", PageWidth - PageRight, - PageLength - PageTop); - break; - case 3 : - printf("0 %.0f translate -90 rotate\n", PageWidth); - printf("%.1f %.1f translate\n", PageLength - PageTop, PageLeft); - break; - } - - if (IW1[0] != IW2[0] && IW1[1] != IW2[1]) - { - iw1[0] = IW1[0] * 72.0f / 1016.0f; - iw1[1] = IW1[1] * 72.0f / 1016.0f; - iw2[0] = IW2[0] * 72.0f / 1016.0f; - iw2[1] = IW2[1] * 72.0f / 1016.0f; - - printf("initclip MP %.3f %.3f MO %.3f %.3f LI %.3f %.3f LI %.3f %.3f LI CP clip\n", - iw1[0], iw1[1], iw1[0], iw2[1], iw2[0], iw2[1], iw2[0], iw1[1]); - } - } - - /* - * Write the string to the output file... - */ - - va_start(ap, format); - bytes = vprintf(format, ap); - va_end(ap); - - return (bytes); -} - - -/* - * End of "$Id: hpgl-prolog.c 6649 2007-07-11 21:46:42Z mike $". - */ diff --git a/filter/hpgl-vector.c b/filter/hpgl-vector.c deleted file mode 100644 index fdf8664a4..000000000 --- a/filter/hpgl-vector.c +++ /dev/null @@ -1,773 +0,0 @@ -/* - * "$Id: hpgl-vector.c 6649 2007-07-11 21:46:42Z mike $" - * - * HP-GL/2 vector routines for the Common UNIX Printing System (CUPS). - * - * Copyright 2007-2008 by Apple Inc. - * Copyright 1993-2007 by Easy Software Products. - * - * These coded instructions, statements, and computer programs are the - * property of Apple Inc. and are protected by Federal copyright - * law. Distribution and use rights are outlined in the file "LICENSE.txt" - * which should have been included with this file. If this file is - * file is missing or damaged, see the license at "http://www.cups.org/". - * - * This file is subject to the Apple OS-Developed Software exception. - * - * Contents: - * - * AA_arc_absolute() - Draw an arc. - * AR_arc_relative() - Draw an arc relative to the current pen - * AT_arc_absolute3() - Draw an arc using 3 points. - * CI_circle() - Draw a circle. - * PA_plot_absolute() - Plot a line using absolute coordinates. - * PD_pen_down() - Start drawing. - * PE_polygon_encoded() - Draw an encoded polyline. - * PR_plot_relative() - Plot a line using relative coordinates. - * PU_pen_up() - Stop drawing. - * RT_arc_relative3() - Draw an arc through 3 points relative to the - * decode_number() - Decode an encoded number. - * plot_points() - Plot the specified points. - */ - -/* - * Include necessary headers... - */ - -#include "hpgltops.h" - - -/* - * Local functions... - */ - -static double decode_number(unsigned char **, int, double); -static void plot_points(int, param_t *); - - -/* - * 'AA_arc_absolute()' - Draw an arc. - */ - -void -AA_arc_absolute(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - float x, y, /* Transformed coordinates */ - dx, dy; /* Distance from current pen */ - float start, end, /* Start and end angles */ - theta, /* Current angle */ - dt, /* Step between points */ - radius; /* Radius of arc */ - - - if (num_params < 3) - return; - - x = Transform[0][0] * params[0].value.number + - Transform[0][1] * params[1].value.number + - Transform[0][2]; - y = Transform[1][0] * params[0].value.number + - Transform[1][1] * params[1].value.number + - Transform[1][2]; - - dx = PenPosition[0] - x; - dy = PenPosition[1] - y; - - start = (float)(180.0 * atan2(dy, dx) / M_PI); - if (start < 0.0) - start += 360.0f; - - end = start + params[2].value.number; - radius = (float)hypot(dx, dy); - - if (PenDown) - { - if (num_params > 3 && params[3].value.number > 0.0) - dt = (float)fabs(params[3].value.number); - else - dt = 5.0; - - if (!PolygonMode) - Outputf("MP\n"); - - PenValid = 1; - - Outputf("%.3f %.3f MO\n", PenPosition[0], PenPosition[1]); - - if (start < end) - for (theta = start + dt; theta < end; theta += dt) - { - PenPosition[0] = (float)(x + radius * cos(M_PI * theta / 180.0)); - PenPosition[1] = (float)(y + radius * sin(M_PI * theta / 180.0)); - - Outputf("%.3f %.3f LI\n", PenPosition[0], PenPosition[1]); - } - else - for (theta = start - dt; theta > end; theta -= dt) - { - PenPosition[0] = (float)(x + radius * cos(M_PI * theta / 180.0)); - PenPosition[1] = (float)(y + radius * sin(M_PI * theta / 180.0)); - - Outputf("%.3f %.3f LI\n", PenPosition[0], PenPosition[1]); - } - } - - PenPosition[0] = (float)(x + radius * cos(M_PI * end / 180.0)); - PenPosition[1] = (float)(y + radius * sin(M_PI * end / 180.0)); - - if (PenDown) - { - Outputf("%.3f %.3f LI\n", PenPosition[0], PenPosition[1]); - - if (!PolygonMode) - Outputf("ST\n"); - } -} - - -/* - * 'AR_arc_relative()' - Draw an arc relative to the current pen - * position. - */ - -void -AR_arc_relative(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - float x, y, /* Transformed coordinates */ - dx, dy; /* Distance from current pen */ - float start, end, /* Start and end angles */ - theta, /* Current angle */ - dt, /* Step between points */ - radius; /* Radius of arc */ - - - if (num_params < 3) - return; - - x = Transform[0][0] * params[0].value.number + - Transform[0][1] * params[1].value.number + - PenPosition[0]; - y = Transform[1][0] * params[0].value.number + - Transform[1][1] * params[1].value.number + - PenPosition[1]; - - dx = PenPosition[0] - x; - dy = PenPosition[1] - y; - - start = (float)(180.0 * atan2(dy, dx) / M_PI); - if (start < 0.0) - start += 360.0f; - - end = start + params[2].value.number; - radius = (float)hypot(dx, dy); - - if (PenDown) - { - if (num_params > 3 && params[3].value.number > 0.0) - dt = (float)fabs(params[3].value.number); - else - dt = 5.0; - - if (!PolygonMode) - Outputf("MP\n"); - - PenValid = 1; - - Outputf("%.3f %.3f MO\n", PenPosition[0], PenPosition[1]); - - if (start < end) - for (theta = start + dt; theta < end; theta += dt) - { - PenPosition[0] = (float)(x + radius * cos(M_PI * theta / 180.0)); - PenPosition[1] = (float)(y + radius * sin(M_PI * theta / 180.0)); - - Outputf("%.3f %.3f LI\n", PenPosition[0], PenPosition[1]); - } - else - for (theta = start - dt; theta > end; theta -= dt) - { - PenPosition[0] = (float)(x + radius * cos(M_PI * theta / 180.0)); - PenPosition[1] = (float)(y + radius * sin(M_PI * theta / 180.0)); - - Outputf("%.3f %.3f LI\n", PenPosition[0], PenPosition[1]); - } - } - - PenPosition[0] = (float)(x + radius * cos(M_PI * end / 180.0)); - PenPosition[1] = (float)(y + radius * sin(M_PI * end / 180.0)); - - if (PenDown) - { - Outputf("%.3f %.3f LI\n", PenPosition[0], PenPosition[1]); - - if (!PolygonMode) - Outputf("ST\n"); - } -} - - -/* - * 'AT_arc_absolute3()' - Draw an arc using 3 points. - * - * Note: - * - * Currently this only draws two line segments through the - * specified points. - */ - -void -AT_arc_absolute3(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - if (num_params < 4) - return; - - if (PenDown) - { - if (!PolygonMode) - Outputf("MP\n"); - - PenValid = 1; - - Outputf("%.3f %.3f MO\n", PenPosition[0], PenPosition[1]); - - PenPosition[0] = Transform[0][0] * params[0].value.number + - Transform[0][1] * params[1].value.number + - Transform[0][2]; - PenPosition[1] = Transform[1][0] * params[0].value.number + - Transform[1][1] * params[1].value.number + - Transform[1][2]; - - Outputf("%.3f %.3f LI\n", PenPosition[0], PenPosition[1]); - } - - PenPosition[0] = Transform[0][0] * params[2].value.number + - Transform[0][1] * params[3].value.number + - Transform[0][2]; - PenPosition[1] = Transform[1][0] * params[2].value.number + - Transform[1][1] * params[3].value.number + - Transform[1][2]; - - if (PenDown) - { - Outputf("%.3f %.3f LI\n", PenPosition[0], PenPosition[1]); - - if (!PolygonMode) - Outputf("ST\n"); - } -} - - -/* - * 'CI_circle()' - Draw a circle. - */ - -void -CI_circle(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - float x, y; /* Transformed coordinates */ - float theta, /* Current angle */ - dt, /* Step between points */ - radius; /* Radius of circle */ - - - if (num_params < 1) - return; - - if (!PenDown) - return; - - radius = params[0].value.number; - - if (num_params > 1) - dt = (float)fabs(params[1].value.number); - else - dt = 5.0; - - if (!PolygonMode) - Outputf("MP\n"); - - PenValid = 1; - - for (theta = 0.0; theta < 360.0; theta += dt) - { - x = (float)(PenPosition[0] + - radius * cos(M_PI * theta / 180.0) * Transform[0][0] + - radius * sin(M_PI * theta / 180.0) * Transform[0][1]); - y = (float)(PenPosition[1] + - radius * cos(M_PI * theta / 180.0) * Transform[1][0] + - radius * sin(M_PI * theta / 180.0) * Transform[1][1]); - - Outputf("%.3f %.3f %s\n", x, y, theta == 0.0 ? "MO" : "LI"); - } - - Outputf("CP\n"); - if (!PolygonMode) - Outputf("ST\n"); -} - - -/* - * 'PA_plot_absolute()' - Plot a line using absolute coordinates. - */ - -void -PA_plot_absolute(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - PenMotion = 0; - - if (num_params > 1) - plot_points(num_params, params); -} - - -/* - * 'PD_pen_down()' - Start drawing. - */ - -void -PD_pen_down(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - PenDown = 1; - - if (num_params > 1) - plot_points(num_params, params); -} - - -/* - * 'PE_polygon_encoded()' - Draw an encoded polyline. - */ - -void -PE_polyline_encoded(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - unsigned char *s; /* Pointer into string */ - int temp, /* Temporary value */ - base_bits, /* Data bits per byte */ - draw, /* Draw or move */ - abscoords; /* Use absolute coordinates */ - double tx, ty, /* Transformed coordinates */ - x, y, /* Raw coordinates */ - frac_bits; /* Multiplier for encoded number */ - - - base_bits = 6; - frac_bits = 1.0; - draw = PenDown; - abscoords = 0; - - if (num_params == 0) - return; - - if (!PolygonMode) - { - Outputf("MP\n"); - PenValid = 0; - } - - if (!PenValid) - { - Outputf("%.3f %.3f MO\n", PenPosition[0], PenPosition[1]); - PenValid = 1; - } - - for (s = (unsigned char *)params[0].value.string; *s != '\0';) - switch (*s) - { - case '7' : - s ++; - base_bits = 5; - -#ifdef DEBUG - fputs("DEBUG: 7-bit\n", stderr); -#endif /* DEBUG */ - - Outputf("%% PE: 7-bit\n"); - break; - case ':' : /* Select pen */ - s ++; - temp = (int)decode_number(&s, base_bits, 1.0) - 1; - if (temp < 0 || temp >= PenCount) - { - fprintf(stderr, "DEBUG: Bad pen number %d in PE\n", temp + 1); - return; - } - - PenNumber = temp; - -#ifdef DEBUG - fprintf(stderr, "DEBUG: set pen #%d\n", PenNumber + 1); -#endif /* DEBUG */ - - Outputf("%% PE: set pen #%d\n", PenNumber + 1); - - if (PageDirty) - printf("%.3f %.3f %.3f %.2f SP\n", Pens[PenNumber].rgb[0], - Pens[PenNumber].rgb[1], Pens[PenNumber].rgb[2], - Pens[PenNumber].width * PenScaling); - break; - case '<' : /* Next coords are a move-to */ - draw = 0; - s ++; - -#ifdef DEBUG - fputs("DEBUG: moveto\n", stderr); -#endif /* DEBUG */ - - Outputf("%% PE: moveto\n"); - break; - case '>' : /* Set fractional bits */ - s ++; - temp = (int)decode_number(&s, base_bits, 1.0); - frac_bits = 1.0 / (1 << temp); - -#ifdef DEBUG - fprintf(stderr, "DEBUG: set fractional bits %d\n", temp); -#endif /* DEBUG */ - - Outputf("%% PE: set fractional bits %d\n", temp); - break; - case '=' : /* Next coords are absolute */ - s ++; - abscoords = 1; - -#ifdef DEBUG - fputs("DEBUG: absolute\n", stderr); -#endif /* DEBUG */ - - Outputf("%% PE: absolute\n"); - break; - default : - if (*s >= 63) - { - /* - * Coordinate... - */ - - x = decode_number(&s, base_bits, frac_bits); - y = decode_number(&s, base_bits, frac_bits); - -#ifdef DEBUG - fprintf(stderr, "DEBUG: coords %.3f %.3f\n", x, y); -#endif /* DEBUG */ - - Outputf("%% PE: coords %.3f %.3f\n", x, y); - - if (abscoords) - { - tx = Transform[0][0] * x + Transform[0][1] * y + - Transform[0][2]; - ty = Transform[1][0] * x + Transform[1][1] * y + - Transform[1][2]; - } - else if (x == 0.0 && y == 0.0) - { - draw = 1; - continue; - } - else - { - tx = Transform[0][0] * x + Transform[0][1] * y + - PenPosition[0]; - ty = Transform[1][0] * x + Transform[1][1] * y + - PenPosition[1]; - } - - if (draw) - { - if (fabs(PenPosition[0] - tx) > 0.001 || - fabs(PenPosition[1] - ty) > 0.001) - Outputf("%.3f %.3f LI\n", tx, ty); - } - else - Outputf("%.3f %.3f MO\n", tx, ty); - - PenPosition[0] = (float)tx; - PenPosition[1] = (float)ty; - - draw = 1; - abscoords = 0; - } - else - { - /* - * Junk - ignore... - */ - - if (*s != '\n' && *s != '\r') - fprintf(stderr, "WARNING: ignoring illegal PE char \'%c\'...\n", *s); - s ++; - } - break; - } - - if (!PolygonMode) - Outputf("ST\n"); -} - - -/* - * 'PR_plot_relative()' - Plot a line using relative coordinates. - */ - -void -PR_plot_relative(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - PenMotion = 1; - - if (num_params > 1) - plot_points(num_params, params); -} - - -/* - * 'PU_pen_up()' - Stop drawing. - */ - -void -PU_pen_up(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - PenDown = 0; - - if (num_params > 1) - plot_points(num_params, params); -} - - -/* - * 'RT_arc_relative3()' - Draw an arc through 3 points relative to the - * current pen position. - * - * Note: - * - * This currently only draws two line segments through the specified - * points. - */ - -void -RT_arc_relative3(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - if (num_params < 4) - return; - - if (PenDown) - { - if (!PolygonMode) - Outputf("MP\n"); - - PenValid = 1; - - Outputf("%.3f %.3f MO\n", PenPosition[0], PenPosition[1]); - - PenPosition[0] = Transform[0][0] * params[0].value.number + - Transform[0][1] * params[1].value.number + - PenPosition[0]; - PenPosition[1] = Transform[1][0] * params[0].value.number + - Transform[1][1] * params[1].value.number + - PenPosition[1]; - - Outputf("%.3f %.3f LI\n", PenPosition[0], PenPosition[1]); - } - - PenPosition[0] = Transform[0][0] * params[2].value.number + - Transform[0][1] * params[3].value.number + - PenPosition[0]; - PenPosition[1] = Transform[1][0] * params[2].value.number + - Transform[1][1] * params[3].value.number + - PenPosition[1]; - - if (PenDown) - { - Outputf("%.3f %.3f LI\n", PenPosition[0], PenPosition[1]); - - if (!PolygonMode) - Outputf("ST\n"); - } -} - - -/* - * 'decode_number()' - Decode an encoded number. - */ - -static double /* O - Value */ -decode_number(unsigned char **s, /* IO - String to decode */ - int base_bits, /* I - Number of data bits per byte */ - double frac_bits) /* I - Multiplier for fractional data */ -{ - double temp, /* Current value */ - shift; /* Multiplier */ - int sign; /* Sign of result */ - - - sign = 0; - - if (base_bits == 5) - { - for (temp = 0.0, shift = frac_bits * 0.5; **s != '\0'; (*s) ++) - if (**s >= 95 && **s < 127) - { - if (sign == 0) - { - if ((**s - 95) & 1) - sign = -1; - else - sign = 1; - - temp += ((**s - 95) & ~1) * shift; - } - else - temp += (**s - 95) * shift; - break; - } - else if (**s < 63) - { - if (**s != '\r' && **s != '\n') - fprintf(stderr, "DEBUG: Bad PE character 0x%02X!\n", **s); - - continue; - } - else - { - if (sign == 0) - { - if ((**s - 63) & 1) - sign = -1; - else - sign = 1; - - temp += ((**s - 63) & ~1) * shift; - } - else - temp += (**s - 63) * shift; - - shift *= 32.0; - } - } - else - { - for (temp = 0.0, shift = frac_bits * 0.5; **s != '\0'; (*s) ++) - if (**s >= 191 && **s < 255) - { - if (sign == 0) - { - if ((**s - 191) & 1) - sign = -1; - else - sign = 1; - - temp += ((**s - 191) & ~1) * shift; - } - else - temp += (**s - 191) * shift; - break; - } - else if (**s < 63) - { - if (**s != '\r' && **s != '\n') - fprintf(stderr, "DEBUG: Bad PE character 0x%02X!\n", **s); - - continue; - } - else - { - if (sign == 0) - { - if ((**s - 63) & 1) - sign = -1; - else - sign = 1; - - temp += ((**s - 63) & ~1) * shift; - } - else - temp += (**s - 63) * shift; - - shift *= 64.0; - } - } - - (*s) ++; - - return (temp * sign); -} - - -/* - * 'plot_points()' - Plot the specified points. - */ - -static void -plot_points(int num_params, /* I - Number of parameters */ - param_t *params) /* I - Parameters */ -{ - int i; /* Looping var */ - float x, y; /* Transformed coordinates */ - - - if (PenDown) - { - if (!PolygonMode) - { - Outputf("MP\n"); - Outputf("%.3f %.3f MO\n", PenPosition[0], PenPosition[1]); - - PenValid = 1; - } - } - - for (i = 0; i < num_params; i += 2) - { - if (PenMotion == 0) - { - x = Transform[0][0] * params[i + 0].value.number + - Transform[0][1] * params[i + 1].value.number + - Transform[0][2]; - y = Transform[1][0] * params[i + 0].value.number + - Transform[1][1] * params[i + 1].value.number + - Transform[1][2]; - } - else - { - x = Transform[0][0] * params[i + 0].value.number + - Transform[0][1] * params[i + 1].value.number + - PenPosition[0]; - y = Transform[1][0] * params[i + 0].value.number + - Transform[1][1] * params[i + 1].value.number + - PenPosition[1]; - } - - if (PenDown) - { - if (PolygonMode && i == 0) - Outputf("%.3f %.3f MO\n", x, y); - else if (fabs(PenPosition[0] - x) > 0.001 || - fabs(PenPosition[1] - y) > 0.001) - Outputf("%.3f %.3f LI\n", x, y); - } - - PenPosition[0] = x; - PenPosition[1] = y; - } - - if (PenDown) - { - if (!PolygonMode) - Outputf("ST\n"); - } -} - - -/* - * End of "$Id: hpgl-vector.c 6649 2007-07-11 21:46:42Z mike $". - */ diff --git a/filter/hpgltops.h b/filter/hpgltops.h deleted file mode 100644 index 4fe45d282..000000000 --- a/filter/hpgltops.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - * "$Id: hpgltops.h 6649 2007-07-11 21:46:42Z mike $" - * - * HP-GL/2 to PostScript filter for the Common UNIX Printing System (CUPS). - * - * Copyright 2007 by Apple Inc. - * Copyright 1993-2005 by Easy Software Products. - * - * These coded instructions, statements, and computer programs are the - * property of Apple Inc. and are protected by Federal copyright - * law. Distribution and use rights are outlined in the file "LICENSE.txt" - * which should have been included with this file. If this file is - * file is missing or damaged, see the license at "http://www.cups.org/". - * - * This file is subject to the Apple OS-Developed Software exception. - */ - -/* - * Include necessary headers... - */ - -#include "common.h" -#include <math.h> - -#ifndef M_PI -# define M_PI 3.14159265358979323846 -#endif /* M_PI */ - - -/* - * Maximum number of pens we emulate... - */ - -#define MAX_PENS 1024 - - -/* - * Parameter value structure... - */ - -typedef struct -{ - int type; - union - { - float number; - char *string; - } value; -} param_t; - -#define PARAM_ABSOLUTE 0 -#define PARAM_RELATIVE 1 -#define PARAM_STRING 2 - - -/* - * Font information... - */ - -typedef struct -{ - int symbol_set, /* Symbol set */ - spacing, /* Spacing (0 = fixed, 1 = proportional) */ - posture, /* Posture number */ - weight, /* Weight number */ - typeface; /* Typeface number */ - float pitch, /* Characters per inch */ - height, /* Height/size of font */ - xpitch; /* X pitch scaling value */ - float x, y; /* X and Y direction/scaling */ -} font_t; - - -/* - * Pen information... - */ - -typedef struct -{ - float rgb[3]; /* Pen color */ - float width; /* Pen width */ -} pen_t; - - -/* - * Globals... - */ - -#ifdef _HPGL_MAIN_C_ -# define VAR -# define VALUE(x) =x -# define VALUE2(x,y) ={x,y} -#else -# define VAR extern -# define VALUE(x) -# define VALUE2(x,y) -#endif /* _HPGL_MAIN_C_ */ - -VAR ppd_file_t *PPD VALUE(NULL); /* PPD file */ - -VAR float P1[2], /* Lower-lefthand physical limit */ - P2[2], /* Upper-righthand physical limit */ - IW1[2], /* Window lower-lefthand limit */ - IW2[2]; /* Window upper-righthand limit */ -VAR int Rotation VALUE(0); /* Page rotation */ -VAR int ScalingType VALUE(-1); /* Type of scaling (-1 for none) */ -VAR float Scaling1[2], /* Lower-lefthand user limit */ - Scaling2[2]; /* Upper-righthand user limit */ -VAR float Transform[2][3]; /* Transform matrix */ -VAR int PageRotation VALUE(0); /* Page/plot rotation */ - -VAR char StringTerminator VALUE('\003'); /* Terminator for labels */ -VAR font_t StandardFont, /* Standard font */ - AlternateFont; /* Alternate font */ -VAR float PenPosition[2] VALUE2(0.0f, 0.0f), - /* Current pen position */ - PenScaling VALUE(1.0f), /* Pen width scaling factor */ - PenWidth VALUE(1.0f); /* Default pen width */ -VAR pen_t Pens[MAX_PENS]; /* State of each pen */ -VAR int PenMotion VALUE(0), /* 0 = absolute, 1 = relative */ - PenValid VALUE(0), /* 1 = valid position, 0 = undefined */ - PenNumber VALUE(0), /* Current pen number */ - PenCount VALUE(8), /* Number of pens */ - PenDown VALUE(0), /* 0 = pen up, 1 = pen down */ - PolygonMode VALUE(0), /* Drawing polygons? */ - PageCount VALUE(0), /* Number of pages in plot */ - PageDirty VALUE(0), /* Current page written on? */ - WidthUnits VALUE(0); /* 0 = mm, 1 = proportionate */ -VAR float PlotSize[2] VALUE2(2592.0f, 3456.0f); - /* Plot size */ -VAR int PlotSizeSet VALUE(0); /* Plot size set? */ -VAR int CharFillMode VALUE(0), /* Where to draw labels */ - CharPen VALUE(0), /* Pen to use for labels */ - CharFont VALUE(0); /* Font to use for labels */ -VAR float CharHeight[2] VALUE2(11.5f,11.5f); - /* Size of font for labels */ -VAR int FitPlot VALUE(0); /* 1 = fit to page */ -VAR float ColorRange[3][2] /* Range of color values */ -#ifdef _HPGL_MAIN_C_ - = { - { 0.0, 255.0 }, - { 0.0, 255.0 }, - { 0.0, 255.0 } - } -#endif /* _HPGL_MAIN_C_ */ -; - -VAR int LineCap VALUE(0); /* Line capping */ -VAR int LineJoin VALUE(0); /* Line joining */ -VAR float MiterLimit VALUE(3.0f); /* Miter limit at joints */ - - -/* - * Prototypes... - */ - -/* hpgl-input.c */ -extern int ParseCommand(FILE *fp, char *name, param_t **params); -extern void FreeParameters(int num_params, param_t *params); - -/* hpgl-config.c */ -extern void update_transform(void); -extern void BP_begin_plot(int num_params, param_t *params); -extern void DF_default_values(int num_params, param_t *params); -extern void IN_initialize(int num_params, param_t *params); -extern void IP_input_absolute(int num_params, param_t *params); -extern void IR_input_relative(int num_params, param_t *params); -extern void IW_input_window(int num_params, param_t *params); -extern void PG_advance_page(int num_params, param_t *params); -extern void PS_plot_size(int num_params, param_t *params); -extern void RO_rotate(int num_params, param_t *params); -extern void RP_replot(int num_params, param_t *params); -extern void SC_scale(int num_params, param_t *params); - -/* hpgl-vector.c */ -extern void AA_arc_absolute(int num_params, param_t *params); -extern void AR_arc_relative(int num_params, param_t *params); -extern void AT_arc_absolute3(int num_params, param_t *params); -extern void CI_circle(int num_params, param_t *params); -extern void PA_plot_absolute(int num_params, param_t *params); -extern void PD_pen_down(int num_params, param_t *params); -extern void PE_polyline_encoded(int num_params, param_t *params); -extern void PR_plot_relative(int num_params, param_t *params); -extern void PU_pen_up(int num_params, param_t *params); -extern void RT_arc_relative3(int num_params, param_t *params); - -/* hpgl-polygon.c */ -extern void EA_edge_rect_absolute(int num_params, param_t *params); -extern void EP_edge_polygon(int num_params, param_t *params); -extern void ER_edge_rect_relative(int num_params, param_t *params); -extern void EW_edge_wedge(int num_params, param_t *params); -extern void FP_fill_polygon(int num_params, param_t *params); -extern void PM_polygon_mode(int num_params, param_t *params); -extern void RA_fill_rect_absolute(int num_params, param_t *params); -extern void RR_fill_rect_relative(int num_params, param_t *params); -extern void WG_fill_wedge(int num_params, param_t *params); - -/* hpgl-char.c */ -extern void define_font(int f); -extern void AD_define_alternate(int num_params, param_t *params); -extern void CF_character_fill(int num_params, param_t *params); -extern void CP_character_plot(int num_params, param_t *params); -extern void DI_absolute_direction(int num_params, param_t *params); -extern void DR_relative_direction(int num_params, param_t *params); -extern void DT_define_label_term(int num_params, param_t *params); -extern void DV_define_variable_path(int num_params, param_t *params); -extern void ES_extra_space(int num_params, param_t *params); -extern void LB_label(int num_params, param_t *params); -extern void LO_label_origin(int num_params, param_t *params); -extern void SA_select_alternate(int num_params, param_t *params); -extern void SD_define_standard(int num_params, param_t *params); -extern void SI_absolute_size(int num_params, param_t *params); -extern void SL_character_slant(int num_params, param_t *params); -extern void SR_relative_size(int num_params, param_t *params); -extern void SS_select_standard(int num_params, param_t *params); -extern void TD_transparent_data(int num_params, param_t *params); - -/* hpgl-attr.c */ -extern void AC_anchor_corner(int num_params, param_t *params); -extern void CR_color_range(int num_params, param_t *params); -extern void FT_fill_type(int num_params, param_t *params); -extern void LA_line_attributes(int num_params, param_t *params); -extern void LT_line_type(int num_params, param_t *params); -extern void NP_number_pens(int num_params, param_t *params); -extern void PC_pen_color(int num_params, param_t *params); -extern void PW_pen_width(int num_params, param_t *params); -extern void RF_raster_fill(int num_params, param_t *params); -extern void SM_symbol_mode(int num_params, param_t *params); -extern void SP_select_pen(int num_params, param_t *params); -extern void UL_user_line_type(int num_params, param_t *params); -extern void WU_width_units(int num_params, param_t *params); - -/* hpgl-prolog.c */ -extern void OutputProlog(char *title, char *user, int shading); -extern void OutputTrailer(void); -extern int Outputf(const char *format, ...); - -/* - * End of "$Id: hpgltops.h 6649 2007-07-11 21:46:42Z mike $". - */ |