Trinisic is a collection of useful functions that aid in extrinsic/intrinsic system construction.
(defgeneric client-form (client))
CLIENT-FORM returns a form that will return the current client when evaluated in the future. It is used during during macro-expansion so that the expanded code refers to correct client at execution time.
(defgeneric features-list (client)
Return a list of feature keywords to be merged with *FEATURES* for intrinsic clients. This generic function has NCONC method combination.
(defgeneric cell-value (client name type))
Returns the current value of a cell in the client. For example
(cell-value client 'cl:\*standard-output\* 'cl:variable)
could be
used to retrieve the value of *STANDARD-OUTPUT*.
(defgeneric (setf cell-value) (new-value client name type))
Set the value of the cell.
(defgeneric valid-cell-value-p (client name type value))
Checks for valid values of a cell.
(defgeneric initial-cell-value (client name type))
Returns the proper initial value for a cell.
(defgeneric call-with-cell-value (client name type value thunk))
Invokes THUNK with a cell value. For example:
(defmethod call-with-cell-value
(client (name (eql 'cl:*standard-output*)) (type (eql 'cl:variable))
value thunk)
(let ((cl:*standard-output* value))
(funcall thunk)))
(defmacro make-define-interface
((&key client-form client-class intrinsic)
declarations &body body))
MAKE-DEFINE-INTERFACE creates a macro in the current package called DEFINE-INTERFACE that used to create an interface in an intrinsic or extrinsic system. The macro DEFINE-INTERFACE will define an appropriate CLIENT-FORM method.
DECLARATIONS are a list of variable declarations each with the form
(var symbol &key variable)
. A LET binding is established around BODY
with these declarations. The value of VAR in this binding is as
follows:
- For intrinsic systems the initial value of VAR will be SYMBOL if SYMBOL is interned. If SYMBOL is uninterned the VAR will be set to an interned symbol in *PACKAGE* with same SYMBOL-NAME as SYMBOL.
- For extrinsic systems the initial value of VAR will be an an interned symbol in *PACKAGE* with same SYMBOL-NAME as SYMBOL.
- If the keyword argument :VARIABLE is supplied and is non-NIL then methods for CELL-VALUE, (SETF CELL-VALUE), and CALL-WITH-CELL-VALUE will be defined for a TYPE of CL:VARIABLE.
For intrinsic systems the DEFINE-INTERFACE macro created by MAKE-DEFINE-INTERFACE will also merge the features keywords from FEATURE-LIST into CL:*FEATURES* and disable package locks for the BODY via TRIVIAL-PACKAGE-LOCKS:WITH-UNLOCKED-SYSTEM-PACKAGES.