X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/aa14a4cddcb96b681d5c19a2ec8bad382f43b264..3f725f73b9ae26a54f49b5feb744d37a8f1dd308:/src/c-types-proto.lisp diff --git a/src/c-types-proto.lisp b/src/c-types-proto.lisp index bc36b2e..edadd64 100644 --- a/src/c-types-proto.lisp +++ b/src/c-types-proto.lisp @@ -109,14 +109,14 @@ (defun c-type-space (stream) "Print a space and a miser-mode newline to STREAM. - This is the right function to call in a PPRINT-C-TYPE kernel function when - the SPACEP argument is true." + This is the right function to call in a `pprint-c-type' kernel function + when the SPACEP argument is true." (pprint-indent :block 2 stream) (write-char #\space stream) (pprint-newline :miser stream)) (defun maybe-in-parens* (stream condition thunk) - "Helper function for the MAYBE-IN-PARENS macro." + "Helper function for the `maybe-in-parens' macro." (multiple-value-bind (prefix suffix) (if condition (values "(" ")") (values "" "")) (pprint-logical-block (stream nil :prefix prefix :suffix suffix) @@ -126,12 +126,12 @@ (defmacro maybe-in-parens ((stream condition) &body body) "Evaluate BODY; if CONDITION, write parens to STREAM around it. - This macro is useful for implementing the PPRINT-C-TYPE method on compound - types. The BODY is evaluated in the context of a logical block printing - to STREAM. If CONDITION is non-nil, then the block will have open/close - parens as its prefix and suffix; otherwise they will be empty. + This macro is useful for implementing the `pprint-c-type' method on + compound types. The BODY is evaluated in the context of a logical block + printing to STREAM. If CONDITION is non-nil, then the block will have + open/close parens as its prefix and suffix; otherwise they will be empty. - The STREAM is passed to PPRINT-LOGICAL-BLOCK, so it must be a symbol." + The STREAM is passed to `pprint-logical-block', so it must be a symbol." `(maybe-in-parens* ,stream ,condition (lambda (,stream) ,@body))) (export 'format-qualifiers) @@ -147,9 +147,9 @@ (:documentation "Print an abbreviated syntax for TYPE to the STREAM. - This function is suitable for use in FORMAT's ~/.../ command.")) + This function is suitable for use in `format's ~/.../ command.")) -(export 'expand-c-type-spec) +(export '(expand-c-type-spec expand-c-type-form)) (eval-when (:compile-toplevel :load-toplevel :execute) (defgeneric expand-c-type-spec (spec) (:documentation @@ -164,7 +164,7 @@ (export 'c-type) (defmacro c-type (spec) - "Expands to code to construct a C type, using EXPAND-C-TYPE-SPEC." + "Expands to code to construct a C type, using `expand-c-type-spec'." (expand-c-type-spec spec)) (export 'define-c-type-syntax) @@ -172,7 +172,7 @@ "Define a C-type syntax function. A function defined by BODY and with lambda-list BVL is associated with the - NAME. When EXPAND-C-TYPE sees a list (NAME . STUFF), it will call this + NAME. When `expand-c-type' sees a list (NAME . STUFF), it will call this function with the argument list STUFF." (with-gensyms (head tail) (multiple-value-bind (doc decls body) (parse-body body) @@ -201,8 +201,8 @@ "Define NAMES all to describe the C-type VALUE. NAMES can be a symbol (treated as a singleton list), or a list of symbols. - The VALUE is a C type S-expression, acceptable to EXPAND-C-TYPE. It will - be expanded once at run-time." + The VALUE is a C type S-expression, acceptable to `expand-c-type'. It + will be expanded once at run-time." (let* ((names (if (listp names) names (list names))) (namevar (gensym "NAME")) (typevar (symbolicate 'c-type- (car names)))) @@ -239,11 +239,13 @@ ;;; Function arguments. (export '(argument argumentp make-argument argument-name argument-type)) -(defstruct (argument (:constructor make-argument (name type)) +(defstruct (argument (:constructor make-argument (name type + &aux (%type type))) (:predicate argumentp)) "Simple structure representing a function argument." name - type) + %type) +(define-access-wrapper argument-type argument-%type) (export 'commentify-argument-name) (defgeneric commentify-argument-name (name) @@ -251,7 +253,7 @@ "Produce a `commentified' version of the argument. The default behaviour is that temporary argument names are simply omitted - (NIL is returned); otherwise, `/*...*/' markers are wrapped around the + (nil is returned); otherwise, `/*...*/' markers are wrapped around the printable representation of the argument.") (:method ((name null)) nil) (:method ((name t)) (format nil "/*~A*/" name)))