Raymond Toy pushed to branch issue-169-pprint-define-vop at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/code/pprint.lisp
    ... ... @@ -1841,49 +1841,54 @@ When annotations are present, invoke them at the right positions."
    1841 1841
       (declare (ignore noise))
    
    1842 1842
       (pprint-logical-block (stream list :prefix "(" :suffix ")")
    
    1843 1843
         ;; Output "define-vop"
    
    1844
    -    (kernel:output-object (pprint-pop) stream)
    
    1844
    +    (output-object (pprint-pop) stream)
    
    1845 1845
         (pprint-exit-if-list-exhausted)
    
    1846 1846
         (write-char #\space stream)
    
    1847 1847
         ;; Output vop name
    
    1848
    -    (kernel:output-object (pprint-pop) stream)
    
    1848
    +    (output-object (pprint-pop) stream)
    
    1849 1849
         (pprint-exit-if-list-exhausted)
    
    1850 1850
         (pprint-newline :mandatory stream)
    
    1851 1851
         (pprint-indent :block 0 stream)
    
    1852
    -    ;; Print out each option
    
    1852
    +    ;; Print out each option starting on a new line
    
    1853 1853
         (loop
    
    1854 1854
           (write-char #\space stream)
    
    1855 1855
           (let ((vop-option (pprint-pop)))
    
    1856
    -	  (case (car vop-option)
    
    1857
    -	    ((:args :results)
    
    1858
    -	     (pprint-logical-block (stream vop-option :prefix "(" :suffix ")")
    
    1859
    -	       ;; Output :args
    
    1860
    -	       (kernel:output-object (pprint-pop) stream)
    
    1861
    -	       (pprint-exit-if-list-exhausted)
    
    1862
    -	       (write-char #\space stream)
    
    1863
    -	       (pprint-indent :current 0 stream)
    
    1864
    -	       (loop
    
    1865
    -		 (kernel:output-object (pprint-pop) stream)
    
    1866
    -		 (pprint-exit-if-list-exhausted)
    
    1867
    -		 (pprint-newline :mandatory stream))))
    
    1868
    -	    ((:generator)
    
    1869
    -	     (pprint-logical-block (stream vop-option :prefix "(" :suffix ")")
    
    1870
    -	       ;; Output :generator
    
    1871
    -	       (kernel:output-object (pprint-pop) stream)
    
    1856
    +	;; Figure out what option we have and print it neatly
    
    1857
    +	(case (car vop-option)
    
    1858
    +	  ((:args :results)
    
    1859
    +	   ;; :args and :results print out each arg/result indented neatly
    
    1860
    +	   (pprint-logical-block (stream vop-option :prefix "(" :suffix ")")
    
    1861
    +	     ;; Output :args/:results
    
    1862
    +	     (output-object (pprint-pop) stream)
    
    1863
    +	     (pprint-exit-if-list-exhausted)
    
    1864
    +	     (write-char #\space stream)
    
    1865
    +	     (pprint-indent :current 0 stream)
    
    1866
    +	     ;; Print each value indented the same amount so the line
    
    1867
    +	     ;; up neatly.
    
    1868
    +	     (loop
    
    1869
    +	       (output-object (pprint-pop) stream)
    
    1872 1870
     	       (pprint-exit-if-list-exhausted)
    
    1873
    -	       (write-char #\space stream)
    
    1874
    -	       ;; Output cost
    
    1875
    -	       (kernel:output-object (pprint-pop) stream)
    
    1871
    +	       (pprint-newline :mandatory stream))))
    
    1872
    +	  ((:generator)
    
    1873
    +	   (pprint-logical-block (stream vop-option :prefix "(" :suffix ")")
    
    1874
    +	     ;; Output :generator
    
    1875
    +	     (output-object (pprint-pop) stream)
    
    1876
    +	     (pprint-exit-if-list-exhausted)
    
    1877
    +	     (write-char #\space stream)
    
    1878
    +	     ;; Output cost
    
    1879
    +	     (output-object (pprint-pop) stream)
    
    1880
    +	     (pprint-exit-if-list-exhausted)
    
    1881
    +	     ;; Newline and then the body of the generator
    
    1882
    +	     (pprint-newline :mandatory stream)
    
    1883
    +	     (write-char #\space stream)
    
    1884
    +	     (pprint-indent :current 0 stream)
    
    1885
    +	     (loop
    
    1886
    +	       (output-object (pprint-pop) stream)
    
    1876 1887
     	       (pprint-exit-if-list-exhausted)
    
    1877
    -	       ;; Newline and then the body of the generator
    
    1878
    -	       (pprint-newline :mandatory stream)
    
    1879
    -	       (write-char #\space stream)
    
    1880
    -	       (pprint-indent :current 0 stream)
    
    1881
    -	       (loop
    
    1882
    -		 (kernel:output-object (pprint-pop) stream)
    
    1883
    -		 (pprint-exit-if-list-exhausted)
    
    1884
    -		 (pprint-newline :mandatory stream))))
    
    1885
    -	    (t
    
    1886
    -	     (kernel:output-object vop-option stream))))
    
    1888
    +	       (pprint-newline :mandatory stream))))
    
    1889
    +	  (t
    
    1890
    +	   ;; Everything else just get printed as usual.
    
    1891
    +	   (output-object vop-option stream))))
    
    1887 1892
           (pprint-exit-if-list-exhausted)
    
    1888 1893
           (pprint-newline :linear stream))))
    
    1889 1894
     
    
    ... ... @@ -1891,26 +1896,26 @@ When annotations are present, invoke them at the right positions."
    1891 1896
       (declare (ignore noise))
    
    1892 1897
       (pprint-logical-block (stream list :prefix "(" :suffix ")")
    
    1893 1898
         ;; Output "sc-case"
    
    1894
    -    (kernel:output-object (pprint-pop) stream)
    
    1899
    +    (output-object (pprint-pop) stream)
    
    1895 1900
         (pprint-exit-if-list-exhausted)
    
    1896 1901
         (write-char #\space stream)
    
    1897
    -    ;; Output variable
    
    1898
    -    (kernel:output-object (pprint-pop) stream)
    
    1902
    +    ;; Output variable name
    
    1903
    +    (output-object (pprint-pop) stream)
    
    1899 1904
         (pprint-exit-if-list-exhausted)
    
    1905
    +    ;; Start the cases on a new line, indented.
    
    1900 1906
         (pprint-newline :mandatory stream)
    
    1901
    -    ;; Indent for the cases
    
    1902 1907
         (pprint-indent :block 0 stream)
    
    1903 1908
         ;; Print out each case.
    
    1904 1909
         (loop
    
    1905 1910
           (write-char #\space stream)
    
    1906 1911
           (pprint-logical-block (stream (pprint-pop) :prefix "(" :suffix ")")
    
    1907 1912
     	;; Output the case item
    
    1908
    -	(kernel:output-object (pprint-pop) stream)
    
    1913
    +	(output-object (pprint-pop) stream)
    
    1909 1914
     	(pprint-exit-if-list-exhausted)
    
    1910 1915
     	(pprint-newline :mandatory stream)
    
    1911
    -	;; Output everything else
    
    1916
    +	;; Output everything else, starting on a new line.
    
    1912 1917
     	(loop
    
    1913
    -	  (kernel:output-object (pprint-pop) stream)
    
    1918
    +	  (output-object (pprint-pop) stream)
    
    1914 1919
     	  (pprint-exit-if-list-exhausted)
    
    1915 1920
     	  (pprint-newline :mandatory stream)))
    
    1916 1921
           (pprint-exit-if-list-exhausted)