( Title: Double-Linked Nodes File: dnode.fs Version: 1.2.3 Author: David N. Williams License: LGPL Last revision: September 1, 2006 ) \ Copyright (C) 2000-2002, 2006 David N. Williams ( This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or at your option any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. Please see the file POLITENESS included with this distribution. ANS Forth compatible except for: - Case sensitivity. - Assumption that zero does not occur as an address. Please see the file NOTATION. ) s" undef.fs" INCLUDED \ ensure [UNDEFINED] [UNDEFINED] field: [IF] : field: ( offset size -- offset+size ) create over , + DOES> ( struc -- struc+offset ) @ + ; [THEN] \ *** WORDS ( Double-linked node structure: /DNODE-DATA: /DNODE-HEADER >NXNODE >PREVNODE ) \ *** DNODE STRUCTURE ( "Dnodes" are double-linked nodes. They have two-cell headers, for a forward and a backward link. The list words in this distribution implicitly know the dnode structure; they do not use the words defined here. Please see dexample.fs for examples of their use by an application. ) 0 ( offset) 1 cells field: >nxnode 1 cells field: >prevnode constant /dnode-header : /dnode-data: ( "name" total.offset -- ) ( To be used at the end of a data continuation to a double-linked node structure to define a constant that counts the size of the data field only, leaving out the header. ) /dnode-header - constant ; \ *** DNODE SPACES ( A typical use of MAKE-NODES to allocate a space of double-linked nodes called MYDNODES might be the following: ) \ ( #nodes /node.data) /dnode-header \ make-nodes constant mydnodes