[cl-pdf-devel] Patch to quiet warnings
Peter Seibel
peter at gigamonkeys.com
Sat Apr 29 04:09:02 UTC 2006
I got tired of my life being cluttered up with warnings when I built
cl-pdf so I fixed them. Here's the patch. Next up, silencing cl-
typesetting.
-Peter
Index: pdf.lisp
===================================================================
--- pdf.lisp (revision 118)
+++ pdf.lisp (working copy)
@@ -23,8 +23,6 @@
(defgeneric make-dictionary (thing &key &allow-other-keys))
-(defgeneric font-descriptor (font-metrics &key embed errorp))
-
(defclass dictionary ()
((dict-values :accessor dict-values :initform nil :initarg :dict-
values)))
Index: defpackage.lisp
===================================================================
--- defpackage.lisp (revision 118)
+++ defpackage.lisp (working copy)
@@ -43,4 +43,10 @@
#:load-t1-font #:load-ttu-font #:encoding #:get-encoding
#:draw-bar-code128 #:*page-number*
#:test-template #:make-template-from-page #:add-templates-to-
page #:draw-template
+
+ ;; pdf-parser
+ #:insert-original-page-content
+ #:with-existing-document
+ #:with-existing-page
+
))
Index: ttu-font.lisp
===================================================================
--- ttu-font.lisp (revision 118)
+++ ttu-font.lisp (working copy)
@@ -21,7 +21,7 @@
(length1 :accessor length1)))
(defmethod font-type ((fm ttu-font-metrics))
- (declare (ignore fm))
+ #-allegro(declare (ignore fm))
"Type0")
(defun load-ttu-font (ufm-file &optional ttf-file)
@@ -39,6 +39,7 @@
(defmethod font-descriptor ((fm ttu-font-metrics)
&key (embed *embed-fonts*) (errorp t))
+ (declare (ignore errorp))
(flet ((conv-dim (d) (round (* 1000 d))))
(make-instance
'indirect-object
@@ -106,6 +107,7 @@
(defmethod make-dictionary
((fm ttu-font-metrics)
&key font (encoding (encoding font)) (embed *embed-fonts*))
+ (declare (ignore encoding))
(let* ((font-descriptor (font-descriptor fm :embed embed :errorp
nil))
(cid-font (make-instance
'cid-font
Index: t1-font.lisp
===================================================================
--- t1-font.lisp (revision 118)
+++ t1-font.lisp (working copy)
@@ -55,6 +55,7 @@
(defmethod font-descriptor ((t1fm t1-font-metrics)
&key (embed *embed-fonts*) (errorp t))
+ (declare (ignore errorp))
(flet ((conv-dim (d) (round (* 1000 d))))
(make-instance 'indirect-object :content
(make-instance 'dictionary ;:obj-number 0 :no-link t
Index: chart.lisp
===================================================================
--- chart.lisp (revision 118)
+++ chart.lisp (working copy)
@@ -89,7 +89,7 @@
(height axis))
(defmethod draw-object (obj)
- )
+ (declare (ignore obj)))
(defun nice-number (n approx integer-p)
(let* ((n10 (expt 10 (floor (log n 10))))
@@ -303,14 +303,14 @@
for bx from gx by group-width do
(loop for y = 0.0 then (+ y dy)
for value in values
- for (name color) in (labels&colors obj)
+ for (nil color) in (labels&colors obj)
for dy = (* value scale) do
(apply #'set-rgb-fill color)
(basic-rect bx y bar-width dy)
(fill-and-stroke)))
(loop for serie in (series obj)
for gx from (* 0.5 spacing) by bar-width
- for (name color) in (labels&colors obj) do
+ for (nil color) in (labels&colors obj) do
(apply #'set-rgb-fill color)
(loop for value in serie
for dy = (* (- value min-value) scale)
@@ -351,7 +351,7 @@
(apply #'set-rgb-fill (background-color obj))
(fill-and-stroke)
(loop for angle in angles
- for (name color) in (labels&colors obj)
+ for (nil color) in (labels&colors obj)
for start = 0 then end
for end = (+ start angle) do
(apply #'set-rgb-fill color)
@@ -473,7 +473,7 @@
(stroke))
(set-line-width (line-width obj))
(loop for serie in (series obj)
- for (name color) in (labels&colors obj) do
+ for (nil color) in (labels&colors obj) do
(apply #'set-rgb-stroke color)
(apply #'set-rgb-fill color)
(let ((points '())
Index: pdf-parser.lisp
===================================================================
--- pdf-parser.lisp (revision 118)
+++ pdf-parser.lisp (working copy)
@@ -118,8 +118,8 @@
(defun read-object (&optional (eof-error-p t))
"Returns one of the following PDF objects: boolean (:true
or :false),
number (Lisp number), string (Lisp string), name (Lisp symbol in the PDF
-package), array (Lisp vector), dictionary (Lisp property list), stream
-(Lisp pdf-stream) or null (Lisp NIL). When EOF-ERRORP is nil, it
returns
+package), array (Lisp vector), dictionary (Lisp property list),
stream (Lisp
+pdf-stream) or null (Lisp NIL). When EOF-ERRORP is nil, it returns
:eof for the end of the stream (otherwise it signals an error)."
(skip-whitespace eof-error-p)
(let ((char (peek-char nil *pdf-input-stream* eof-error-p)))
@@ -259,7 +259,7 @@
(otherwise
(push (read-object t)
plist)))))
- (loop for (k v . rest) on (nreverse plist) by #'cddr
+ (loop for (k v) on (nreverse plist) by #'cddr
collect (cons k v))))
(defun read-dictionary ()
@@ -314,6 +314,7 @@
(file-position *pdf-input-stream* file-position)
(let* ((object-number (read-integer))
(generation-number (read-integer)))
+ (declare (ignore object-number generation-number))
(eat-keyword "obj")
(let ((object (read-object)))
;; Some producers forget the "endobj" at the end of a stream
@@ -426,6 +427,7 @@
(defun read-pdf ()
(let* ((trailer (read-xref-and-trailer (find-cross-reference-
start)))
(%visited-object% (make-hash-table :test #'eql)))
+ (declare (ignore %visited-object%))
(setf (catalog *document*) (get-dict-value trailer "/Root")
(docinfo *document*) (get-dict-value trailer "/Info"))
(load-all-indirect-objects)
@@ -456,8 +458,6 @@
;; restore graphics state
(write-line " Q" *page-stream*))
-(export 'insert-original-page-content)
-
(defun ensure-dictionary (obj)
(if (typep obj 'indirect-object)
(content obj)
@@ -498,8 +498,6 @@
:title ,title :subject ,subject :keywords ,keywords)
, at body))
-(export 'with-existing-document)
-
(defmacro with-existing-page ((page-number) &body body)
`(let* ((*original-content* nil)
(*current-content* nil)
@@ -513,8 +511,6 @@
(get-output-stream-string pdf::*page-stream*)))
*current-content*)))))
-(export 'with-existing-page)
-
#|
(pdf:with-existing-document (#P"/tmp/MS-32.pdf")
Index: font.lisp
===================================================================
--- font.lisp (revision 118)
+++ font.lisp (working copy)
@@ -17,6 +17,8 @@
(defvar *compress-fonts* t "nil or decode filter designator")
+(defvar *font-metrics* (make-hash-table :test #'equal))
+
(defgeneric font-descriptor (font-metrics &key embed errorp))
(defclass font ()
@@ -148,5 +150,3 @@
(clear-font-cache)
(setf %fonts-loaded% t)))
-(eval-when (:load-toplevel :execute)
- (load-fonts))
Index: encodings.lisp
===================================================================
--- encodings.lisp (revision 118)
+++ encodings.lisp (working copy)
@@ -42,29 +42,8 @@
(defun get-encoding (encoding-designator)
(gethash encoding-designator *encodings*))
-(defun compute-encoding-differences (encoding &optional (from
*standard-encoding*))
- (let ((differences (make-array 20 :fill-pointer 0 :adjustable t))
- (range-started nil))
- (if from
- (flet ((start-range (code)
- (when (or (and code (not range-started))(and (not code) range-
started))
- (setf range-started code)
- (when code (vector-push-extend code differences)))))
- (loop with start-code = nil
- for standard-char-name across (char-names from)
- for char-name across (char-names encoding)
- for code from 0
- do
- (cond
- ((and (not char-name) standard-char-name)
- (start-range code) (vector-push-extend ".notdef" differences))
- ((and char-name (not (equal char-name standard-char-name)))
- (start-range code)
- (vector-push-extend (add-/ char-name) differences))
- (t (start-range nil)))))
- (full-encoding-differences encoding))
- differences))
+
;;; Just put all...
(defun full-encoding-differences (encoding)
(let ((differences (make-array 20 :fill-pointer 0 :adjustable t)))
@@ -411,3 +390,26 @@
"escyrillic" "tecyrillic" "ucyrillic" "efcyrillic"
"khacyrillic" "tsecyrillic"
"checyrillic" "shacyrillic" "shchacyrillic"
"hardsigncyrillic" "yericyrillic"
"softsigncyrillic" "ereversedcyrillic" "iucyrillic"
"iacyrillic")))
+
+
+(defun compute-encoding-differences (encoding &optional (from
*standard-encoding*))
+ (let ((differences (make-array 20 :fill-pointer 0 :adjustable t))
+ (range-started nil))
+ (if from
+ (flet ((start-range (code)
+ (when (or (and code (not range-started))(and (not code) range-
started))
+ (setf range-started code)
+ (when code (vector-push-extend code differences)))))
+ (loop for standard-char-name across (char-names from)
+ for char-name across (char-names encoding)
+ for code from 0
+ do
+ (cond
+ ((and (not char-name) standard-char-name)
+ (start-range code) (vector-push-extend ".notdef" differences))
+ ((and char-name (not (equal char-name standard-char-name)))
+ (start-range code)
+ (vector-push-extend (add-/ char-name) differences))
+ (t (start-range nil)))))
+ (full-encoding-differences encoding))
+ differences))
\ No newline at end of file
Index: font-metrics.lisp
===================================================================
--- font-metrics.lisp (revision 118)
+++ font-metrics.lisp (working copy)
@@ -6,8 +6,6 @@
;;Many thanks to Alexey Dejneka (adejneka at comail.ru) who finished the
parsing of the AFM files.
-(defvar *font-metrics* (make-hash-table :test #'equal))
-
(defclass char-metrics ()
((code :accessor code :initarg :code)
(name :accessor name :initarg :name)
@@ -293,7 +291,7 @@
(with-open-file (s filename :direction :input :external-format
+external-format+)
(setf font-metrics (afm-font-metrics s font-metrics-class)))
(setf void-char (gethash "VoidCharacter" (characters font-
metrics)))
- (iter (for (name char-metrics) in-hashtable (characters font-
metrics))
+ (iter (for (nil char-metrics) in-hashtable (characters font-
metrics))
(for gid = (index char-metrics))
(for code = (code char-metrics))
(when (and (<= 0 code #xfffe))
@@ -307,7 +305,7 @@
(vector-push-extend (vector (round (* 1000 (width char-
metrics)))) (cid-widths font-metrics))))
(setf encoding-vector (make-array (1+ max-code) :initial-
element void-char)
pdf-widths (make-array (1+ max-code) :initial-element 0))
- (iter (for (name char-metrics) in-hashtable (characters font-
metrics))
+ (iter (for (nil char-metrics) in-hashtable (characters font-
metrics))
(for code = (code char-metrics))
(when (<= min-code code max-code)
(setf (aref encoding-vector code) char-metrics
Index: pdf-base.lisp
===================================================================
--- pdf-base.lisp (revision 118)
+++ pdf-base.lisp (working copy)
@@ -320,6 +320,7 @@
args))
(defmethod make-image ((jpeg jpeg-image) &key type)
+ (declare (ignore type))
(make-instance 'pdf:image
:bits (data jpeg)
:width (width jpeg) :height (height jpeg)
Index: png.lisp
===================================================================
--- png.lisp (revision 118)
+++ png.lisp (working copy)
@@ -119,6 +119,7 @@
;; For color key masking, the Mask entry is an array of 2*N
integers,
;; [min1 max1 ¥ minN maxN], where N is the number of color
components in the
;; image's color space.
+ (declare (ignore type))
(let* ((nb-components (nb-components png))
(palette (palette png))
(lookup
Index: iterate/package.lisp
===================================================================
--- iterate/package.lisp (revision 118)
+++ iterate/package.lisp (working copy)
@@ -31,6 +31,7 @@
with while until adjoining nconcing appending
nunioning unioning reducing accumulate accumulating))
-(export +clause-names+ '#:iterate)
+(eval-when (:compile-toplevel :load-toplevel :execute)
+ (export +clause-names+ '#:iterate))
;;; arch-tag: "b8bb0bb6-313c-11d8-abb9-000c76244c24"
Index: zlib.lisp
===================================================================
--- zlib.lisp (revision 118)
+++ zlib.lisp (working copy)
@@ -81,6 +81,7 @@
#+use-salza-zlib
(defun load-zlib (&optional force)
+ (declare (ignore force))
(setf *compress-streams* t))
#+use-salza-zlib
Index: cl-pdf.asd
===================================================================
--- cl-pdf.asd (revision 118)
+++ cl-pdf.asd (working copy)
@@ -42,12 +42,12 @@
:components ((:file "defpackage")
(:file "config" :depends-on ("defpackage"))
#+use-uffi-zlib (:file "init" :depends-on ("config"))
- (:file "zlib" :depends-on ("defpackage" #+use-uffi-zlib
"init"))
- (:file "font-metrics" :depends-on ("config"))
+ (:file "zlib" :depends-on ("defpackage" "config" #+use-uffi-
zlib "init"))
+ (:file "font-metrics" :depends-on ("config" "font"))
(:file "encodings" :depends-on ("defpackage"))
- (:file "t1-font" :depends-on ("font-metrics" "encodings"))
+ (:file "t1-font" :depends-on ("font" "font-metrics"
"encodings"))
(:file "ttu-font" :depends-on ("font-metrics"))
- (:file "font" :depends-on ("t1-font"))
+ (:file "font" :depends-on ("encodings"))
(:file "pdf" :depends-on ("font"))
(:file "x11-colors" :depends-on ("defpackage"))
(:file "pdf-base" :depends-on ("pdf" "x11-colors"))
@@ -55,5 +55,6 @@
(:file "pdf-geom" :depends-on ("pdf-base"))
(:file "text" :depends-on ("pdf-base"))
(:file "bar-codes" :depends-on ("pdf-geom"))
- (:file "chart" :depends-on ("text" "pdf-geom")))
+ (:file "chart" :depends-on ("text" "pdf-geom" "load-fonts"))
+ (:file "load-fonts" :depends-on ("defpackage" "font-metrics")))
:depends-on (:iterate #+use-salza-zlib :salza))
--
Peter Seibel * peter at gigamonkeys.com
Gigamonkeys Consulting * http://www.gigamonkeys.com/
Practical Common Lisp * http://www.gigamonkeys.com/book/
More information about the cl-pdf-devel
mailing list