Insert some more newlines, and make existing ones less miserly. Also,
make sure margins are set before the newlines, rather than after.
Printing for `var' is lightly hacked to allow a break before the
initializer.
(when spacep (c-type-space stream))
(funcall print-kernel stream 2 nil)
(pprint-indent :block 4 stream)
(when spacep (c-type-space stream))
(funcall print-kernel stream 2 nil)
(pprint-indent :block 4 stream)
+ (pprint-newline :linear stream)
(pprint-logical-block
(stream nil :prefix "(" :suffix ")")
(funcall print-args stream))))))
(pprint-logical-block
(stream nil :prefix "(" :suffix ")")
(funcall print-args stream))))))
(stream (type c-function-type) &optional colon atsign)
(declare (ignore colon atsign))
(format stream "~:@<~
(stream (type c-function-type) &optional colon atsign)
(declare (ignore colon atsign))
(format stream "~:@<~
- FUN ~@_~:I~/sod:print-c-type/~
- ~{ ~_~:<~S ~@_~/sod:print-c-type/~:>~}~
+ FUN ~@_~:I~
+ ~/sod:print-c-type/~:[~; ~]~:*~_~
+ ~<~@{~:<~S ~@_~/sod:print-c-type/~:>~^ ~_~}~:>~
~:>"
(c-type-subtype type)
(mapcar (lambda (arg)
~:>"
(c-type-subtype type)
(mapcar (lambda (arg)
("nopenfd" int))))
"ftw"
(format nil "~
("nopenfd" int))))
"ftw"
(format nil "~
-int ftw(const char */*dirpath*/,
- int (*/*fn*/)(const char *fpath,
- const struct stat *sb,
- int typeflag),
+int ftw
+ (const char */*dirpath*/,
+ int (*/*fn*/)
+ (const char *fpath, const struct stat *sb, int typeflag),
int /*nopenfd*/)")))
;;;--------------------------------------------------------------------------
int /*nopenfd*/)")))
;;;--------------------------------------------------------------------------
(pprint-indent :block 2 stream)
(pprint-newline :linear stream)
(princ child stream)
(pprint-indent :block 2 stream)
(pprint-newline :linear stream)
(princ child stream)
- (pprint-indent :block 0 stream)
- (case morep
- (:space
- (write-char #\space stream)
- (pprint-newline :linear stream))
- ((t)
- (pprint-newline :mandatory stream)))))))
+ (pprint-indent :block 0 stream))
+ (case morep
+ (:space
+ (write-char #\space stream)
+ (pprint-newline :linear stream))
+ ((t)
+ (pprint-newline :mandatory stream))))))
(export 'format-compound-statement)
(defmacro format-compound-statement
(export 'format-compound-statement)
(defmacro format-compound-statement
;; prevent them from leaking.
(definst var (stream :export t) (name #1=#:type &optional init)
;; prevent them from leaking.
(definst var (stream :export t) (name #1=#:type &optional init)
- (pprint-c-type #1# stream name)
- (when init
- (format stream " = ~A" init))
- (write-char #\; stream))
+ (pprint-logical-block (stream nil)
+ (pprint-c-type #1# stream name)
+ (when init
+ (format stream " = ~2I~_~A" init))
+ (write-char #\; stream)))
(definst function (stream :export t)
(name #1=#:type body &optional #2=#:banner &rest banner-args)
(definst function (stream :export t)
(name #1=#:type body &optional #2=#:banner &rest banner-args)
(definst expr (stream :export t) (#1=#:expr)
(format stream "~A;" #1#))
(definst set (stream :export t) (var #1=#:expr)
(definst expr (stream :export t) (#1=#:expr)
(format stream "~A;" #1#))
(definst set (stream :export t) (var #1=#:expr)
- (format stream "~@<~A = ~@_~2I~A;~:>" var #1#))
+ (format stream "~@<~A = ~2I~_~A;~:>" var #1#))
(definst update (stream :export t) (var op #1=#:expr)
(definst update (stream :export t) (var op #1=#:expr)
- (format stream "~@<~A ~A= ~@_~2I~A;~:>" var op #1#))
+ (format stream "~@<~A ~A= ~2I~_~A;~:>" var op #1#))
;; Special kinds of expressions.
(definst call (stream :export t) (#1=#:func &rest args)
;; Special kinds of expressions.
(definst call (stream :export t) (#1=#:func &rest args)
- (format stream "~A(~@<~{~A~^, ~_~}~:>)" #1# args))
+ (format stream "~@<~A~4I~_(~@<~{~A~^, ~_~}~:>)~:>" #1# args))
(definst cond (stream :export t) (#1=#:cond conseq alt)
(format stream "~@<~A ~2I~@_~@<? ~A ~_: ~A~:>~:>" #1# conseq alt))
(definst cond (stream :export t) (#1=#:cond conseq alt)
(format stream "~@<~A ~2I~@_~@<? ~A ~_: ~A~:>~:>" #1# conseq alt))