Common Lisp Package: FLEXICHAIN

README:

FUNCTION

Private

FIND-IF-2 (PREDICATE SEQUENCE)

Searches the sequence for an element that satisfies PREDICATE. Returns the element found or NIL of none was found, and a boolean indicating whether an element was found or not.

GAP-LOCATION (CHAIN)

Returns a keyword indicating the general location of the gap.

HOP-ELEMENTS-LEFT (CHAIN COUNT)

Moves the COUNT rightmost elements to the end of the gap, on the left of the data. Example: HOP-ELEMENTS-LEFT ---abcdefghijklm--- 2 => -lmabcdefghijk-----

HOP-ELEMENTS-RIGHT (CHAIN COUNT)

Moves the COUNT leftmost elements to the beginning of the gap, on the right of the data. Example: HOP-ELEMENTS-RIGHT ---abcdefghijklm--- 2 => -----cdefghijklmab-

INDEX-POSITION (CHAIN INDEX)

Returns the position corresponding to the INDEX in the CHAIN. Note: the result is undefined if INDEX is not the index of a valid element of the CHAIN.

MAKE-WEAK-POINTER (OBJECT)

Creates a new weak pointer which points to OBJECT. For portability reasons, OBJECT most not be NIL.

MOVE-EMPTY-GAP (CHAIN HOT-SPOT)

Moves the gap. Handles the case where the gap is empty.

MOVE-GAP (CHAIN HOT-SPOT)

Moves the elements and gap inside the buffer so that the element currently at HOT-SPOT becomes the first element following the gap, or does nothing if there are no elements.

MOVE-LEFT-GAP (CHAIN HOT-SPOT)

Moves the gap. Handles the case where the gap is on the left of the buffer.

MOVE-MIDDLE-GAP (CHAIN HOT-SPOT)

Moves the gap. Handles the case where the gap is in the middle of the buffer.

MOVE-NON-CONTIGUOUS-GAP (CHAIN HOT-SPOT)

Moves the gap. Handles the case where the gap is in 2 parts, on both ends of the buffer.

MOVE-RIGHT-GAP (CHAIN HOT-SPOT)

Moves the gap. Handles the case where the gap is on the right of the buffer.

NORMALIZE-INDICES (CHAIN)

Sets gap limits to 0 if they are at the end of the buffer.

POSITION-INDEX (CHAIN POSITION)

Returns the (0 indexed) index of the POSITION-th element of the CHAIN in the buffer.

PUSH-ELEMENTS-LEFT (CHAIN COUNT)

Pushes the COUNT elements of CHAIN at the right of the gap, to the beginning of the gap. The gap must be continuous. Example: PUSH-ELEMENTS-LEFT abcd-----efghijklm 2 => abcdef-----ghijklm

PUSH-ELEMENTS-RIGHT (CHAIN COUNT)

Pushes the COUNT elements of CHAIN at the left of the gap, to the end of the gap. The gap must be continuous. Example: PUSH-ELEMENTS-RIGHT abcd-----efghijklm 2 => ab-----cdefghijklm

SQUARE (X)

Returns the square of the number X.

WEAK-POINTER-VALUE (WEAK-POINTER)

If WEAK-POINTER is valid, returns its value. Otherwise, returns NIL.

Undocumented

ADJUST-CURSORS (CURSORS START END INCREMENT)

DECREASE-BUFFER-SIZE (CHAIN)

ENSURE-GAP-POSITION (CHAIN POSITION)

ENSURE-ROOM (CHAIN NB-ELEMENTS)

INCREASE-BUFFER-SIZE (CHAIN NB-ELEMENTS)

REQUIRED-SPACE (CHAIN NB-ELEMENTS)

MACRO

Private

Undocumented

WITH-VIRTUAL-GAP ((BL DS GS GE) CHAIN &BODY BODY)

GENERIC-FUNCTION

Public

AT-BEGINNING-P (CURSOR)

Returns true if the cursor is at the beginning of the chain.

AT-END-P (CURSOR)

Returns true if the cursor is at the beginning of the chain.

CLONE-CURSOR (CURSOR)

Creates a cursor that is initially at the same location as the one given as argument.

CURSOR-POS (CURSOR)

Returns the position of the cursor.

SETFCURSOR-POS (POSISTION CURSOR)

Set the position of the cursor.

DELETE* (CHAIN POSITION)

Deletes an element at POSITION of the chain. If POSITION is out of range (less than 0 or greater than or equal to the length of CHAIN, the FLEXI-POSITION-ERROR condition will be signaled.

DELETE-ELEMENTS* (CHAIN POSITION N)

Delete N elements at POSITION of the chain. If POSITION+N is out of range (less than 0 or greater than or equal to the length of CHAIN, the FLEXI-POSITION-ERROR condition will be signaled. N can be negative, in which case elements will be deleted before POSITION.

DELETE< (CURSOR &OPTIONAL N)

Deletes N objects before the cursor.

DELETE> (CURSOR &OPTIONAL N)

Deletes N objects after the cursor.

ELEMENT* (CHAIN POSITION)

Returns the element at POSITION of the chain. If POSITION is out of range (less than 0 or greater than or equal to the length of CHAIN, the FLEXI-POSITION-ERROR condition will be signaled.

SETFELEMENT* (OBJECT CHAIN POSITION)

Replaces the element at POSITION of CHAIN by OBJECT. If POSITION if out of range (less than 0 or greater than or equal to the length of CHAIN, the FLEXI-POSITION-ERROR condition will be signaled.

ELEMENT< (CURSOR)

Returns the element immediately before the cursor.

SETFELEMENT< (OBJECT CURSOR)

Replaces the element immediately before the cursor.

ELEMENT> (CURSOR)

Returns the element immediately after the cursor.

SETFELEMENT> (OBJECT CURSOR)

Replaces the element immediately after the cursor.

FLEXI-EMPTY-P (CHAIN)

Checks whether CHAIN is empty or not.

INSERT (CURSOR OBJECT)

Inserts an object at the cursor.

INSERT* (CHAIN POSITION OBJECT)

Inserts an object before the element at POSITION in the chain. If POSITION is out of range (less than 0 or greater than the length of CHAIN, the FLEXI-POSITION-ERROR condition will be signaled.

INSERT-SEQUENCE (CURSOR SEQUENCE)

The effect is the same as if each element of the sequence was inserted using INSERT.

INSERT-VECTOR* (CHAIN POSITION VECTOR)

Inserts the elements of VECTOR before the element at POSITION in the chain. If POSITION is out of range (less than 0 or greater than the length of CHAIN, the FLEXI-POSITION-ERROR condition will be signaled.

MOVE< (CURSOR &OPTIONAL N)

Moves the cursor backward N positions.

MOVE> (CURSOR &OPTIONAL N)

Moves the cursor forward N positions.

NB-ELEMENTS (CHAIN)

Returns the number of elements in the flexichain.

POP-END (CHAIN)

Pops and returns the element at the end of CHAIN.

POP-START (CHAIN)

Pops and returns the element at the beginning of CHAIN.

PUSH-END (CHAIN OBJECT)

Inserts an object at the end of CHAIN.

PUSH-START (CHAIN OBJECT)

Inserts an object at the beginning of CHAIN.

ROTATE (CHAIN &OPTIONAL N)

Rotates the elements of CHAIN so that the element that used to be at position N is now at position 0. With a negative value of N, rotates the elements so that the element that used to be at position 0 is now at position N.

Undocumented

FLEXI-FIRST-P (ELEMENT)

FLEXI-LAST-P (ELEMENT)

FLEXI-NEXT (ELEMENT)

FLEXI-PREV (ELEMENT)

RANK (ELEMENT)

Private

FILL-GAP (STANDARD-FLEXICHAIN START END)

fill part of gap with the fill element

MOVE-ELEMENTS (STANDARD-FLEXICHAIN TO FROM START1 START2 END2)

move elements of a flexichain and adjust data-start

RESIZE-BUFFER (STANDARD-FLEXICHAIN NEW-BUFFER-SIZE)

allocate a new buffer with the size indicated

Undocumented

AT-BEGINNING-ERROR-CURSOR (CONDITION)

AT-END-ERROR-CURSOR (CONDITION)

FLEXI-INCOMPATIBLE-TYPE-ERROR-CHAIN (CONDITION)

FLEXI-INCOMPATIBLE-TYPE-ERROR-ELEMENT (CONDITION)

FLEXI-INITIALIZATION-ERROR-CAUSE (CONDITION)

FLEXI-POSITION-ERROR-CHAIN (CONDITION)

FLEXI-POSITION-ERROR-POSITION (CONDITION)

SLOT-ACCESSOR

Public

Undocumented

CHAIN (OBJECT)

SETFCHAIN (NEW-VALUE OBJECT)

Private

Undocumented

FLEXICURSOR-INDEX (OBJECT)

SETFFLEXICURSOR-INDEX (NEW-VALUE OBJECT)

INDEX (OBJECT)

SETFINDEX (NEW-VALUE OBJECT)

CLASS

Public

CURSORCHAIN

The protocol class for cursor chains.

FLEXICHAIN

The protocol class for flexichains.

FLEXICURSOR

The protocol class for flexicursors.

STANDARD-CURSORCHAIN

The standard instantiable subclass of CURSORCHAIN

STANDARD-FLEXICHAIN

The standard instantiable subclass of FLEXICHAIN.

STANDARD-FLEXICURSOR

The standard instantiable subclass of FLEXICURSOR

Undocumented

ELEMENT-RANK-MIXIN

FLEXIRANK-MIXIN

LEFT-STICKY-FLEXICURSOR

RIGHT-STICKY-FLEXICURSOR

CONDITION

Public

Undocumented

AT-BEGINNING-ERROR

AT-END-ERROR

FLEXI-ERROR

FLEXI-INCOMPATIBLE-TYPE-ERROR

FLEXI-INITIALIZATION-ERROR

FLEXI-POSITION-ERROR