Common Lisp Package: COM.INFORMATIMAGO.CLEXT.CLOSER-WEAK

Closer to Weak objects. Implements the specification: <http://clisp.cons.org/impnotes/weak.html> for Common Lisp implementations that have weak-pointers. WEAK-OR-RELATION is a primitive that cannot be implemented propertly without implementation support. Currently work on: clisp full support cmucl partial support (missing WEAK-OR-RELATION) sbcl partial support (missing WEAK-OR-RELATION) Copyright Pascal Bourguignon 2006 - 2006 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

README:

FUNCTION

Public

HASH-TABLE-WEAK-P (OBJECT)

<http://clisp.cons.org/impnotes/hash-dict.html#make-hash>

MAKE-WEAK-AND-MAPPING (KEYS VALUE)

Creates a WEAK-AND-MAPPING between the keys objects in the given list and the given value. The keys list must be non-empty.

MAKE-WEAK-AND-RELATION (LIST)

Creates a WEAK-AND-RELATION between the objects in the given list.

MAKE-WEAK-LIST (LIST)

Creates a WEAK-LIST pointing to each of the elements in the given list.

MAKE-WEAK-MAPPING (KEY VALUE)

Creates a WEAK-MAPPING.

MAKE-WEAK-OR-MAPPING (KEYS VALUE)

Creates a WEAK-OR-MAPPING between the keys objects in the given list and the given value. The keys list must be non-empty.

MAKE-WEAK-OR-RELATION (LIST)

Creates a WEAK-OR-RELATION between the objects in the given list.

MAKE-WEAK-POINTER (OBJECT)

Allocate and return a weak pointer which points to OBJECT.

WEAK-AND-MAPPING-P (OBJECT)

Returns true if the object is of type WEAK-AND-MAPPING.

WEAK-AND-MAPPING-PAIR (MAPPING)

Returns three values: the list of keys, the value, and T, if none of the keys have been garbage-collected, else NIL, NIL, NIL. The returned keys list must not be destructively modified.

WEAK-AND-MAPPING-VALUE (MAPPING)

Returns the value, if none of the keys have been garbage-collected, else NIL.

SETFWEAK-AND-MAPPING-VALUE (VALUE MAPPING)

Replaces the value stored in the WEAK-AND-MAPPING. It has no effect when some key has already been garbage-collected.

WEAK-AND-RELATION-LIST (WEAK-AND-RELATION)

Returns the list of objects stored in the weak-and-relation. The returned list must not be destructively modified.

WEAK-AND-RELATION-P (OBJECT)

Returns true if the object is of type WEAK-AND-RELATION.

WEAK-LIST-LIST (WEAK-LIST)

Returns a LIST of those objects from the weak-list that are still alive.

SETFWEAK-LIST-LIST (VALUE WEAK-LIST)

Replaces the list of objects stored by the weak-list.

WEAK-LIST-P (OBJECT)

Returns true if the object is of type WEAK-LIST.

WEAK-MAPPING-P (OBJECT)

Returns true if the object is of type WEAK-MAPPING.

WEAK-MAPPING-PAIR (WEAK-MAPPING)

Returns true if the object is of type WEAK-MAPPING.

WEAK-MAPPING-VALUE (WEAK-MAPPING)

Returns three values: the original key, the original value, and T, if the key has not yet been garbage-collected, else NIL, NIL, NIL.

SETFWEAK-MAPPING-VALUE (VALUE WEAK-MAPPING)

Replaces the value stored in the weak-mapping. It has no effect when the key has already been garbage-collected.

WEAK-OR-MAPPING-P (OBJECT)

Returns true if the object is of type WEAK-OR-MAPPING.

WEAK-OR-MAPPING-PAIR (MAPPING)

Returns three values: the list of keys, the value, and T, if the keys have not yet been garbage-collected, else NIL, NIL, NIL. The returned keys list must not be destructively modified.

WEAK-OR-MAPPING-VALUE (MAPPING)

Returns the value, if the keys have not yet been garbage-collected, else NIL.

SETFWEAK-OR-MAPPING-VALUE (VALUE MAPPING)

Replaces the value stored in the WEAK-OR-MAPPING. It has no effect when the keys have already been garbage-collected.

WEAK-OR-RELATION-LIST (WEAK-OR-RELATION)

Returns the list of objects stored in the WEAK-OR-RELATION. The returned list must not be destructively modified.

WEAK-OR-RELATION-P (OBJECT)

Returns true if the object is of type WEAK-OR-RELATION.

WEAK-POINTER-P (OBJECT)

Returns true if the object is of type WEAK-POINTER.

WEAK-POINTER-VALUE (WEAK-POINTER)

If WEAK-POINTER is valid, return the value of WEAK-POINTER and T. If the referent of WEAK-POINTER has been garbage collected, returns the values NIL and NIL.

Undocumented

CLRHASH (HASH-TABLE)

GETHASH (KEY HASH-TABLE &OPTIONAL DEFAULT)

SETFGETHASH (VALUE KEY HASH-TABLE &OPTIONAL DEFAULT)

HASH-TABLE-COUNT (HASH-TABLE)

HASH-TABLE-P (OBJECT)

HASH-TABLE-REHASH-SIZE (HASH-TABLE)

HASH-TABLE-REHASH-THRESHOLD (HASH-TABLE)

HASH-TABLE-SIZE (HASH-TABLE)

HASH-TABLE-TEST (HASH-TABLE)

SETFHASH-TABLE-WEAK-P (VALUE OBJECT)

MAKE-HASH-TABLE (&REST OTHER-KEYS &KEY (TEST #'EQL TESTP) (SIZE NIL SIZEP) (REHASH-SIZE NIL REHASH-SIZE-P) (REHASH-THRESHOLD NIL REHASH-THRESHOLD-P) (WEAK NIL) &ALLOW-OTHER-KEYS)

MAKE-WEAK-ALIST (&KEY (TYPE KEY) (INITIAL-CONTENTS 'NIL))

MAPHASH (FUNCTION HASH-TABLE)

REMHASH (KEY HASH-TABLE)

Private

%WEAK-AND-MAPPING-KEYS (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%WEAK-AND-MAPPING-VALUE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%WEAK-AND-RELATION-OBJECTS (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%WEAK-MAPPING-KEY (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%WEAK-MAPPING-PAIR (WEAK-MAPPING)

Returns true if the object is of type WEAK-MAPPING.

%WEAK-MAPPING-VALUE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%WEAK-OR-MAPPING-KEYS (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%WEAK-OR-MAPPING-VALUE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%WEAK-OR-RELATION-OBJECTS (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

INVERSE-WEAK-MAPPING-KEY (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

INVERSE-WEAK-MAPPING-VALUE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

WEAK-LIST-HEAD (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

Undocumented

%MAKE-WEAK-AND-MAPPING (&KEY ((KEYS DUM726) NIL) ((VALUE DUM727) NIL))

%MAKE-WEAK-AND-RELATION (&KEY ((OBJECTS DUM88) NIL))

%MAKE-WEAK-LIST (&KEY ((HEAD DUM2) NIL))

%MAKE-WEAK-MAPPING (&KEY ((KEY DUM453) NIL) ((VALUE DUM454) NIL))

%MAKE-WEAK-OR-MAPPING (&KEY ((KEYS DUM806) NIL) ((VALUE DUM807) NIL))

%MAKE-WEAK-OR-RELATION (&KEY ((OBJECTS DUM147) NIL))

%SXHASH (OBJECT)

SETF%WEAK-AND-MAPPING-KEYS (NEW-VALUE INSTANCE)

SETF%WEAK-AND-MAPPING-VALUE (NEW-VALUE INSTANCE)

SETF%WEAK-AND-RELATION-OBJECTS (NEW-VALUE INSTANCE)

SETF%WEAK-MAPPING-KEY (NEW-VALUE INSTANCE)

SETF%WEAK-MAPPING-VALUE (NEW-VALUE INSTANCE)

SETF%WEAK-OR-MAPPING-KEYS (NEW-VALUE INSTANCE)

SETF%WEAK-OR-MAPPING-VALUE (NEW-VALUE INSTANCE)

SETF%WEAK-OR-RELATION-OBJECTS (NEW-VALUE INSTANCE)

COPY-INVERSE-WEAK-MAPPING (INSTANCE)

COPY-WEAK-AND-MAPPING (INSTANCE)

COPY-WEAK-AND-RELATION (INSTANCE)

COPY-WEAK-LIST (INSTANCE)

COPY-WEAK-MAPPING (INSTANCE)

COPY-WEAK-OR-MAPPING (INSTANCE)

COPY-WEAK-OR-RELATION (INSTANCE)

EQUIV (A B)

SETFINVERSE-WEAK-MAPPING-KEY (NEW-VALUE INSTANCE)

INVERSE-WEAK-MAPPING-P (OBJECT)

SETFINVERSE-WEAK-MAPPING-VALUE (NEW-VALUE INSTANCE)

MAKE-INVERSE-WEAK-MAPPING (&KEY ((KEY DUM886) NIL) ((VALUE DUM887) NIL))

SETFWEAK-LIST-HEAD (NEW-VALUE INSTANCE)

MACRO

Public

Undocumented

WITH-HASH-TABLE-ITERATOR ((NAME HASH-TABLE) &BODY BODY)

Private

DEFINE-MAPPING (OP)

Generates the functions for WEAK-AND/OR-MAPPINGS.

DEFINE-PAIR-METHODS (OP ALIVE-FUN)

Generates the methods for WEAK-AND-RELATIONs and WEAK-OR-RELATIONs.

Undocumented

DEFINE-FORWARD (NAME)

GENERIC-FUNCTION

Public

Undocumented

WEAK-ALIST-ASSOC (ITEM SELF &KEY TEST TEST-NOT KEY (TEST #'EQL) (TEST-NOT NIL) (KEY #'IDENTITY))

WEAK-ALIST-CONTENTS (WAL)

SETFWEAK-ALIST-CONTENTS (VALUE WAL)

WEAK-ALIST-P (WAL)

WEAK-ALIST-RASSOC (ITEM SELF &KEY (TEST #'EQL) (TEST-NOT NIL) (KEY #'IDENTITY))

WEAK-ALIST-TYPE (WAL)

WEAK-ALIST-VALUE (ITEM SELF &KEY (TEST #'EQL) (TEST-NOT NIL))

SETFWEAK-ALIST-VALUE (VALUE ITEM SELF &KEY (TEST #'EQL) (TEST-NOT NIL))

Private

ALIVEP (OBJECT)

Returns whether the object is alive.

PAIR-KEY (OBJECT)

Returns the key in the pair object.

PAIR-VALUE (OBJECT)

Returns the value in the pair object.

SETFPAIR-VALUE (VALUE OBJECT)

Changes the value in the pair object.

Undocumented

%CLRHASH (SELF)

%GETHASH (KEY SELF &OPTIONAL DEFAULT)

SETF%GETHASH (VALUE KEY SELF &OPTIONAL DEFAULT)

%HASH-TABLE-COUNT (SELF)

%HASH-TABLE-SIZE (SELF)

%MAPHASH (FUNCTION SELF)

%REHASH-TABLE (SELF NEW-SIZE)

%REMHASH (KEY SELF)

CHECK-INCREASE-SIZE (SELF RESULT-VALUES)

CHECK-REDUCE-SIZE (SELF RESULT-VALUES)

DUMP-WHT (SELF &OPTIONAL (OUT))

WAL-PAIR-CLASS (WAL)

WEAK-ALIST-REMOVE-ASSOC (ITEM SELF &KEY (TEST #'EQL) (TEST-NOT NIL) (KEY #'IDENTITY))

WHT-ITERATOR (SELF)

SLOT-ACCESSOR

Private

Undocumented

%HASH-TABLE-REHASH-SIZE (SELF)

SETF%HASH-TABLE-REHASH-SIZE (NEW-VALUE OBJECT)

%HASH-TABLE-REHASH-THRESHOLD (SELF)

SETF%HASH-TABLE-REHASH-THRESHOLD (NEW-VALUE OBJECT)

%HASH-TABLE-TEST (SELF)

SETF%HASH-TABLE-TEST (NEW-VALUE OBJECT)

WAL-CONTENTS (OBJECT)

SETFWAL-CONTENTS (NEW-VALUE OBJECT)

WHT-BUCKETS (OBJECT)

SETFWHT-BUCKETS (NEW-VALUE OBJECT)

WHT-PAIR-TYPE (OBJECT)

CLASS

Public

WEAK-AND-RELATION

A weak 'and' relation is an ordered collection of references to objects, that does not keep the objects from being garbage-collected, and which allows access to all the objects as long as all of them are still alive. As soon as one of them is garbage-collected, the entire collection of objects becomes empty.

WEAK-MAPPING

A weak association is a mapping from an object called key to an object called value, that exists as long as the key is alive. In other words, as long as the key is alive, it keeps the value from being garbage-collected.

WEAK-OR-MAPPING

A weak 'or' mapping is a mapping from a tuple of objects called keys to an object called value, that keeps all keys and the value from being garbage-collected as long as one of the keys is still alive. In other words, each of the keys keeps all others among them and the value from being garbage-collected. When all of them are unreferenced, the entire mapping goes away.

WEAK-OR-RELATION

A weak 'or' relation is an ordered collection of references to objects, that keeps all objects from being garbage-collected as long as one of them is still alive. In other words, each of them keeps all others among them from being garbage-collected. When all of them are unreferenced, the collection of objects becomes empty.

Undocumented

WEAK-POINTER

Private

WEAK-AND-MAPPING

A weak 'and' mapping is a mapping from a tuple of objects called keys to an object called value, that does not keep the keys from being garbage-collected and that exists as long as all keys are alive. As soon as one of the keys is garbage-collected, the entire mapping goes away.

WEAK-LIST

A WEAK-LIST is an ordered collection of references to objects that does not keep the objects from being garbage-collected. It is semantically equivalent to a list of WEAK-POINTERs, however with a more efficient in-memory representation than a plain list of WEAK-POINTERs would be.

Undocumented

INVERSE-WEAK-MAPPING

WAL-KEY

WAL-KEY-AND-VALUE

WAL-KEY-OR-VALUE

WAL-VALUE

WEAK-ALIST

WEAK-HASH-TABLE