Next Prev Up Top Contents Index

7.2.2 CLIM Operators for Defining Presentation Type Abbreviations

You can define an abbreviation for a presentation type for the purpose of naming a commonly used cliche. The abbreviation is simply another name for a presentation type specifier.

Exported functions that call expand-presentation-type-abbreviation allow abbreviations.









define-presentation translator


Arguments: name parameters equivalent-type &key options

Summary: Defines a presentation type that is an abbreviation for the presentation type specifier that is the value of equivalent-type.

Where presentation type abbreviations are allowed, equivalent-type and abbreviations are exactly equivalent and can be used interchangeably.

name must be a symbol and must not be the name of a CLOS class.

The equivalent-type form might be evaluated at compile time if presentation type abbreviations are expanded by compiler optimizers. Unlike inherit-from , equivalent-type can perform arbitrary computations and is not called with dummy parameter and option values. The type specifier produced by evaluating equivalent-type can be a real presentation type or another abbreviation. If the type specifier doesn't include the standard option :description , the option is automatically copied from the abbreviation to its expansion.

Note that you cannot define any presentation methods on a presentation type abbreviation. If you need methods, use define-presentation-type instead.

define-presentation-type-abbreviation is used to name a commonly used cliche. For example, a presentation type to read an octal integer might be defined as:

        (define-presentation-type-abbreviation octal-integer
          (&optional low high)
          `((integer ,low ,high) :base 8
            :description "octal integer"))

None of the arguments, except equivalent-type , is evaluated.

When writing presentation type abbreviations, it is sometimes useful to let CLIM include or exclude defaults for parameters and options. In some cases, you may also find it necessary to "expand" a presentation type abbreviation. The following three functions are useful in these circumstances.


Arguments: type &optional environment

Summary: If the presentation type specifier type is a presentation type abbreviation, or is an and , or , sequence , or sequence-enumerated that contains a presentation type abbreviation, then expand-presentation-type-abbreviation-1 expands the type abbreviation once and returns two values, the expansion and t . If type is not a presentation type abbreviation, then the values type and nil are returned. env is a macro-expansion environment, as in macroexpand .


Arguments: type &optional environment

Summary: expand-presentation-type-abbreviation is like expand-presentation-type-abbreviation-1 , except that type is repeatedly expanded until all presentation type abbreviations have been removed.

make-presentation-type-specifier [Function]	

Arguments: type-name-and-parameters &rest options

Summary: A convenient way to make a presentation type specifier including only non-default options. This is only useful for abbreviation expanders, not for the :inherit-from clause of define-presentation-type . type-name-and-parameters is a presentation type specifier that must be in the form of:

( type-name parameters ...)

options is a list of alternating keywords and values that are added as options to the specifier. If a value is equal to type-name 's default, that option is omitted, producing a more concise presentation type specifier.

Common Lisp Interface Manager 2.0 User Guide - 14 Dec 2001

Next Prev Up Top Contents Index