Raymond Toy pushed to branch issue-495-describe-deftypes at cmucl / cmucl

Commits:

4 changed files:

Changes:

  • .gitlab-ci.yml
    ... ... @@ -7,7 +7,11 @@ variables:
    7 7
       download_url: "https://common-lisp.net/project/cmucl/downloads/release/$release"
    
    8 8
       version: "$release-x86"
    
    9 9
       tar_ext: "xz"
    
    10
    +  # bootstrap is for normal builds
    
    10 11
       bootstrap: "-B boot-21f"
    
    12
    +  # crossboot is for cross-compiles where the cross-compile script
    
    13
    +  # isn't enough and we need an extra file.
    
    14
    +  crossboot: "-B src/bootfiles/21f/boot-21f"
    
    11 15
     
    
    12 16
     workflow:
    
    13 17
       rules:
    
    ... ... @@ -229,7 +233,7 @@ linux:cross-build:
    229 233
       script:
    
    230 234
         - bin/create-target.sh xtarget $CONFIG
    
    231 235
         - bin/create-target.sh xcross $CONFIG
    
    232
    -    - bin/cross-build-world.sh -crl xtarget xcross src/tools/cross-scripts/cross-x86-x86.lisp snapshot/bin/lisp
    
    236
    +    - bin/cross-build-world.sh $crossboot -crl xtarget xcross src/tools/cross-scripts/cross-x86-x86.lisp snapshot/bin/lisp
    
    233 237
         - bin/build.sh -b xlinux $bootstrap -R -C $CONFIG -o "xtarget/lisp/lisp -lib xtarget/lisp"
    
    234 238
         - bin/make-dist.sh -I xdist xlinux-4
    
    235 239
     
    

  • src/bootfiles/21f/boot-21f.lisp
    1
    +;; Bootstrap file for issue #495 to add more information when
    
    2
    +;; describing user-defined types.
    
    3
    +;;
    
    1 4
     (setf lisp::*enable-package-locked-errors* nil)
    
    2 5
     
    
    3 6
     (in-package "C")
    
    4
    -;; deftype information
    
    7
    +;; New deftype information.
    
    8
    +;;
    
    9
    +;; We define a :lambda-list for types where we can store the
    
    10
    +;; lambda-list of the deftype.  We also add a :defype source-location
    
    11
    +;; for deftypes so we don't use :defvar for this.
    
    5 12
     (define-info-type type lambda-list list nil)
    
    6 13
     (define-info-type source-location deftype (or form-numbers null) nil)
    
    7 14
     
    
    8 15
     (in-package "LISP")
    
    16
    +;; New deftype macro to saves the lambda-list of the type.  %deftype
    
    17
    +;; is updated to take the extra arg for the lambda-list.
    
    9 18
     (defmacro deftype (name arglist &body body)
    
    10 19
       "Syntax like DEFMACRO, but defines a new type."
    
    11 20
       (unless (symbolp name)
    

  • src/code/describe.lisp
    ... ... @@ -480,18 +480,14 @@
    480 480
     	  (describe pcl-class)))))
    
    481 481
       ;;
    
    482 482
       ;; Print out information about any types named by the symbol
    
    483
    -  #+nil
    
    484
    -  (when (eq (info type kind x) :defined)
    
    485
    -    (format t (intl:gettext "~&It names a type specifier.")))
    
    486
    -  (format t "info type kind = ~A~%" (info type kind x))
    
    487
    -  (case (info type kind x)
    
    483
    +  (case (info :type :kind x)
    
    488 484
         (:defined
    
    489 485
          ;; User defined type
    
    490 486
          (format t (intl:gettext "~&It names a type specifier."))
    
    491 487
          (let ((lambda-list (info type lambda-list x)))
    
    492 488
            (when lambda-list
    
    493
    -	 (format t (intl:gettext "~& Lambda list: ~S") lambda-list)))
    
    494
    -     (let ((expander (info type expander x)))
    
    489
    +	 (format t (intl:gettext "~&  Lambda list: ~S") lambda-list)))
    
    490
    +     (let ((expander (info :type :expander x)))
    
    495 491
            (when expander
    
    496 492
     	 (let ((expansion (ignore-errors (funcall expander (list x)))))
    
    497 493
     	   (when expansion
    
    ... ... @@ -499,10 +495,10 @@
    499 495
     		     (list x) expansion))))))
    
    500 496
         (:primitive
    
    501 497
          ;; Primitive built-in type
    
    502
    -     (format t (intl:gettext "~&It names a type specifier."))
    
    503
    -     (let ((builtin (info type builtin x)))
    
    498
    +     (format t (intl:gettext "~&It names a primitive type specifier."))
    
    499
    +     (let ((builtin (info :type :builtin x)))
    
    504 500
            (when builtin
    
    505
    -	 (format t (intl:gettext "~& Internal type: ~S") builtin)))))
    
    501
    +	 (format t (intl:gettext "~&  Internal type: ~S") builtin)))))
    
    506 502
       ;;
    
    507 503
       ;; Print out properties, possibly ignoring implementation details.
    
    508 504
       (do ((plist (symbol-plist X) (cddr plist)))
    
    ... ... @@ -512,6 +508,15 @@
    512 508
           (describe (cadr plist))))
    
    513 509
     
    
    514 510
       ;; Describe where it was defined.
    
    511
    +  ;;
    
    512
    +  ;; Note: Source location for user-defined types is stored in
    
    513
    +  ;; :deftype.  However :defvar is currently used for defvar,
    
    514
    +  ;; defparameter, defconstant.  Just try printing both :defvar and
    
    515
    +  ;; :deftype locations.  They should be distinct.
    
    515 516
       (let ((locn (info :source-location :defvar x)))
    
    516 517
         (when locn
    
    517
    -      (format t (intl:gettext "~&It is defined in:~&~A") (c::file-source-location-pathname locn)))))
    518
    +      (format t (intl:gettext "~&It is defined in:~&~A") (c::file-source-location-pathname locn))))
    
    519
    +  (let ((locn (info :source-location :deftype x)))
    
    520
    +    (when locn
    
    521
    +      (format t (intl:gettext "~&The type is defined in:~&~A")
    
    522
    +	      (c::file-source-location-pathname locn)))))

  • src/i18n/locale/cmucl.pot
    No preview for this file type