[Git][cmucl/cmucl][master] 2 commits: Fix #173: Add pprinter for define-assembly-routine
Raymond Toy (@rtoy)
gitlab at common-lisp.net
Mon Mar 6 17:08:01 UTC 2023
Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
b2f6ab4c by Raymond Toy at 2023-03-06T17:07:46+00:00
Fix #173: Add pprinter for define-assembly-routine
- - - - -
7a15c464 by Raymond Toy at 2023-03-06T17:07:49+00:00
Merge branch 'issue-173-pprint-def-assem-routine' into 'master'
Fix #173: Add pprinter for define-assembly-routine
Closes #173
See merge request cmucl/cmucl!126
- - - - -
1 changed file:
- src/code/pprint.lisp
Changes:
=====================================
src/code/pprint.lisp
=====================================
@@ -1920,6 +1920,42 @@ When annotations are present, invoke them at the right positions."
(pprint-newline :mandatory stream)))
(pprint-exit-if-list-exhausted)
(pprint-newline :mandatory stream))))
+
+(defun pprint-define-assembly (stream list &rest noise)
+ (declare (ignore noise))
+ (pprint-logical-block (stream list :prefix "(" :suffix ")")
+ ;; Output "define-assembly-routine"
+ (output-object (pprint-pop) stream)
+ (pprint-exit-if-list-exhausted)
+ (write-char #\space stream)
+ ;; Output routine name and options.
+ (pprint-logical-block (stream (pprint-pop) :prefix "(" :suffix ")")
+ ;; Output the routine name
+ (output-object (pprint-pop) stream)
+ (pprint-exit-if-list-exhausted)
+ (pprint-newline :mandatory stream)
+ (pprint-indent :block 0 stream)
+ ;; Output options, one per line, neatly lined up and indented
+ ;; below the routine name.
+ (loop
+ (output-object (pprint-pop) stream)
+ (pprint-exit-if-list-exhausted)
+ (pprint-newline :mandatory stream)))
+ ;; Now output the args, results, and temps used by the assembly
+ ;; routine. Instead of lining up with the routine name, let's
+ ;; just indent it 4 spaces from the "define-assembly-routine" so
+ ;; it doesn't look so top-heavy.
+ (pprint-indent :block 4 stream)
+ (pprint-newline :mandatory stream)
+ (pprint-logical-block (stream (pprint-pop) :prefix "(" :suffix ")")
+ (loop
+ (output-object (pprint-pop) stream)
+ (pprint-exit-if-list-exhausted)
+ (pprint-newline :mandatory stream)))
+ ;; Now print out the assembly code as if it were a tagbody. Then
+ ;; labels are outdented by one to make them easy to see.
+ (pprint-newline :mandatory stream)
+ (pprint-tagbody-guts stream)))
;;;; Interface seen by regular (ugly) printer and initialization routines.
@@ -2037,7 +2073,8 @@ When annotations are present, invoke them at the right positions."
(stream::with-stream-class pprint-with-like)
(lisp::with-array-data pprint-with-like)
(c:define-vop pprint-define-vop)
- (c:sc-case pprint-sc-case)))
+ (c:sc-case pprint-sc-case)
+ (c:define-assembly-routine pprint-define-assembly)))
(defun pprint-init ()
(setf *initial-pprint-dispatch* (make-pprint-dispatch-table))
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/9d32d69a918d3542444ab30e39439aeab205f98e...7a15c46492914989dc85c532c3517cc7fcea0510
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/9d32d69a918d3542444ab30e39439aeab205f98e...7a15c46492914989dc85c532c3517cc7fcea0510
You're receiving this email because of your account on gitlab.common-lisp.net.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20230306/88ab61f3/attachment-0001.html>
More information about the cmucl-cvs
mailing list