forked from alex-eg/sex
show the cases the comments were describing
This commit is contained in:
34
types.scm
34
types.scm
@@ -240,14 +240,14 @@
|
||||
|
||||
;;; The shape of a written type
|
||||
;;;
|
||||
;;; Three places have to tell a type from something that merely
|
||||
;;; contains one: an arglist entry is either `(name type)' or a bare
|
||||
;;; type, and an array's last element is either a bound or the last
|
||||
;;; word of its element type. They used to answer it separately, and
|
||||
;;; disagreed.
|
||||
;;; Where a type ends, asked by an arglist and by an array bound:
|
||||
;;;
|
||||
;;; (f1 float) a name and a type (unsigned int) a type
|
||||
;;; (¤ int 4) four of int (¤ const t) unsized, of const t
|
||||
;;; (¤ mytype N) N of mytype (¤ * size-t) unsized, of (* size-t)
|
||||
|
||||
;;; A qualifier can never end a type, which is what tells `(¤ const t)'
|
||||
;;; -- an unsized array of `t' -- from `(¤ int 4)'.
|
||||
;;; A qualifier cannot end a type: `(¤ const t)' is unsized, `(¤ int 4)'
|
||||
;;; is four of int.
|
||||
(define +c-qualifiers+ '(const volatile restrict _Atomic))
|
||||
|
||||
(define +c-specifiers+
|
||||
@@ -271,20 +271,22 @@
|
||||
(pair? (cdr arg)) ; 1 element args are always type
|
||||
(not (type-head? arg))))
|
||||
|
||||
;;; Is NAME a typedef, as opposed to a `define'd constant? Both live in
|
||||
;;; the same table, and only the first is part of a type.
|
||||
;;; A typedef and a `define' share +type-db+; only the typedef is part
|
||||
;;; of a type:
|
||||
;;;
|
||||
;;; (typedef small int) -> (¤ small N) is N of small
|
||||
;;; (define CAP 4) -> (¤ int CAP) is CAP of int
|
||||
(define (typedef-name? name)
|
||||
(let ((info (and (symbol? name) (get-type-info name))))
|
||||
(and info (memq (car info) '(typedef struct union enum)) #t)))
|
||||
|
||||
;;; `(¤ int N)' is N of int
|
||||
;;; `(¤ unsigned int)' is an unsized array of unsigned int
|
||||
;;; The last element is a bound only where what precedes it already
|
||||
;;; spells a whole type -- a specifier, a tag after its keyword, or a
|
||||
;;; typedef we have seen declared:
|
||||
;;;
|
||||
;;; The last element is a bound only if what precedes it is already a
|
||||
;;; complete type, so `(¤ const mytype)' and `(¤ * size-t)' end in the
|
||||
;;; last word of their element type and not in a bound. A type is
|
||||
;;; complete when it ends in a specifier, in a tag following its
|
||||
;;; keyword, or in a typedef we have seen declared.
|
||||
;;; (¤ int 4) four of int (¤ unsigned int) unsized
|
||||
;;; (¤ mytype CAP) CAP of mytype (¤ struct point) unsized
|
||||
;;; (¤ const mytype) unsized (¤ * size-t) unsized
|
||||
;;;
|
||||
;;; TYPE is the whole `(¤ ...)' form.
|
||||
(define (array-bound? type)
|
||||
|
||||
Reference in New Issue
Block a user