- (let ((firstp t))
- (dolist (arg (c-function-arguments type))
- (if firstp
- (setf firstp nil)
- (format stream ", ~_"))
- (if (eq arg :ellipsis)
- (write-string "..." stream)
- (pprint-c-type (argument-type arg)
- stream
- (argument-name arg))))))))))
+ (funcall print-args stream))))))
+
+(export 'pprint-argument-list)
+(defun pprint-argument-list (args stream)
+ "Print an argument list.
+
+ The ARGS is a list of `argument' objects, optionally containing an
+ `:ellipsis' marker. The output is written to STREAM.
+
+ Returns non-nil if any arguments were actually printed."
+ (let ((anyp nil))
+ (pprint-logical-block (stream nil)
+ (dolist (arg args)
+ (if anyp
+ (format stream ", ~_")
+ (setf anyp t))
+ (etypecase arg
+ ((member :ellipsis)
+ (write-string "..." stream))
+ (argument
+ (pprint-logical-block (stream nil)
+ (pprint-c-type (argument-type arg) stream
+ (argument-name arg)))))))
+ anyp))
+
+(let ((void-arglist (list (make-argument nil c-type-void))))
+ (defmethod pprint-c-type ((type c-function-type) stream kernel)
+ (let ((args (or (c-function-arguments type) void-arglist)))
+ (pprint-c-function-type (c-type-subtype type) stream
+ (lambda (stream)
+ (pprint-argument-list args stream))
+ kernel))))