Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gendl
gendl
Commits
f134a526
Commit
f134a526
authored
Feb 11, 2012
by
Dave Cooper
Browse files
made pdf output slightly more efficient
parent
5aa9c4e8
Changes
3
Hide whitespace changes
Inline
Side-by-side
gdl/geom-base/formats/source/macro-redefs.lisp
View file @
f134a526
...
...
@@ -102,8 +102,9 @@ supports a full range of output options such as page dimensions, view transforms
(
let
((
flag
(
gensym
)))
(
let
(
;;(external-format (getf args :external-format))
(
args
(
remove-plist-keys
args
(
list
:external-format
))))
`
(
let
((
*%format%*
(
make-instance
',format
,@
args
)))
(
let
((
*stream*
(
if
(
or
(
stringp
,
stream-or-file
)
(
pathnamep
,
stream-or-file
))
`
(
let
((
*%format%*
(
make-instance
',format
,@
args
))
(
file?
(
or
(
stringp
,
stream-or-file
)
(
pathnamep
,
stream-or-file
))))
(
let
((
*stream*
(
if
file?
(
open
,
stream-or-file
:if-does-not-exist
:create
:if-exists
:supersede
:direction
:output
:element-type
'
(
unsigned-byte
8
)
...
...
@@ -133,27 +134,31 @@ supports a full range of output options such as page dimensions, view transforms
(
with-format-slots
(
page-width
page-length
)
(
pdf:translate
(
half
page-width
)
(
half
page-length
)))
,@
body
)
(
pdf:write-document
path
))
(
when
*stream*
(
with-open-file
(
in
path
:element-type
'
(
unsigned-byte
8
))
(
pdf:write-document
(
if
file?
,
stream-or-file
path
)))
(
when
(
and
*stream*
(
not
file?
))
(
with-open-file
(
in
path
:element-type
'
(
unsigned-byte
8
))
(
do
((
val
(
read-byte
in
nil
nil
)
(
read-byte
in
nil
nil
)))
((
null
val
))
(
write-byte
val
*stream*
))))
(
delete-file
path
)))
(
when
(
probe-file
path
)
(
delete-file
path
))))
;;
;; FLAG -- update multipage to match pdf case behavior
;;
(
pdf-multipage
`
(
let
((
path
(
glisp:temporary-file
)))
(
with-open-file
(
out
path
:direction
:output
:if-exists
:supersede
:if-does-not-exist
:create
)
(
pdf:with-document
()
,@
body
(
pdf:write-document
out
)))
(
when
*stream*
(
pdf:with-document
()
,@
body
(
pdf:write-document
(
if
file?
,
stream-or-file
path
)))
(
when
(
and
*stream*
(
not
file?
))
(
with-open-file
(
in
path
:element-type
'
(
unsigned-byte
8
))
(
do
((
val
(
read-byte
in
nil
nil
)
(
read-byte
in
nil
nil
)))
((
null
val
))
(
write-byte
val
*stream*
))))
(
delete-file
path
)))
(
when
(
probe-file
path
)
(
delete-file
path
)))
)
#+
nil
...
...
gdl/gwl/source/cl-pdf-patches.lisp
View file @
f134a526
...
...
@@ -4,6 +4,7 @@
(
in-package
:pdf
)
#+
nil
(
defmethod
write-object
((
obj
indirect-object
)
&optional
root-level
)
(
gdl:print-variables
*pdf-stream*
)
...
...
@@ -32,6 +33,7 @@
(
format
*pdf-stream*
"~d ~d R"
(
obj-number
obj
)(
gen-number
obj
))))
#+
nil
(
defmethod
write-document
((
s
stream
)
&optional
(
document
*document*
))
(
gdl:print-variables
s
)
...
...
gdl/gwl/source/initialize.lisp
View file @
f134a526
...
...
@@ -58,9 +58,9 @@
(
defun
client-test
(
port
)
(
multiple-value-bind
(
result
error
)
(
ignore-errors
(
net.aserve.client:do-http-request
(
format
nil
"http://localhost:~a"
port
)
:timeout
2
))
(
ignore-errors
(
net.aserve.client:do-http-request
(
format
nil
"http://localhost:~a"
port
)))
(
declare
(
ignore
result
))
(
when
(
typep
error
'error
)
port
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment