... |
... |
@@ -614,20 +614,43 @@ |
614
|
614
|
`(lisp::pointer-hash ,x))
|
615
|
615
|
|
616
|
616
|
;;; WITH-TEMPORARY-FILE -- Public
|
617
|
|
-(defmacro with-temporary-file ((var template-prefix &rest open-args) &parse-body (forms decls))
|
|
617
|
+(defmacro with-temporary-file ((var template-prefix
|
|
618
|
+ &key
|
|
619
|
+ (element-type 'base-char)
|
|
620
|
+ (external-format :default)
|
|
621
|
+ (buffering :full)
|
|
622
|
+ decoding-error
|
|
623
|
+ encoding-error)
|
|
624
|
+ &parse-body (forms decls))
|
618
|
625
|
"A temporary file is opened using the Open-args and bound to the
|
619
|
626
|
variable Var. The name of the temporary file uses Template-prefix
|
620
|
627
|
for the name. If the temporary file cannot be opened, the forms are
|
621
|
628
|
not evaluated. The Forms are executed, and when they terminate,
|
622
|
|
- normally or otherwise, the file is closed and deleted."
|
|
629
|
+ normally or otherwise, the file is closed.
|
|
630
|
+
|
|
631
|
+ Defined keywords:
|
|
632
|
+ :element-type - Type of object to read or write. Default BASE-CHAR
|
|
633
|
+ :external-format - An external format name
|
|
634
|
+ :buffering - Buffering to use for the file. Must be one of
|
|
635
|
+ :NONE, :LINE, :FULL
|
|
636
|
+ :decoding-error - How to handle decoding errors. See OPEN
|
|
637
|
+ :encoding-error - How to handle encoding errors. See OPEN"
|
623
|
638
|
(let ((abortp (gensym))
|
624
|
639
|
(template (gensym "TEMPLATE-")))
|
|
640
|
+
|
625
|
641
|
`(let* ((,template (concatenate 'string
|
626
|
642
|
,template-prefix
|
627
|
643
|
"XXXXXX"))
|
628
|
644
|
(,var (lisp::make-fd-stream (unix::unix-mkstemp ,template)
|
|
645
|
+ :auto-close t
|
629
|
646
|
:file ,template
|
630
|
|
- ,@open-args))
|
|
647
|
+ :output t
|
|
648
|
+ :input t
|
|
649
|
+ :element-type ',element-type
|
|
650
|
+ :external-format ,external-format
|
|
651
|
+ :decoding-error ,decoding-error
|
|
652
|
+ :encoding-error ,encoding-error
|
|
653
|
+ :buffering ,buffering))
|
631
|
654
|
(,abortp t))
|
632
|
655
|
,@decls
|
633
|
656
|
(unwind-protect
|