diff --git a/mps/design/abq.txt b/mps/design/abq.txt index e3bd56a9bc8..cc0cfe0159f 100644 --- a/mps/design/abq.txt +++ b/mps/design/abq.txt @@ -93,20 +93,20 @@ If the queue is full, return ``TRUE``, otherwise return ``FALSE``. Return the number of elements in the queue. -``typedef Bool (*ABQVisitor)(Bool *deleteReturn, void *element, void *closureP, Size closureS)`` +``typedef Bool (*ABQVisitor)(Bool *deleteReturn, void *element, void *closure)`` A callback function for ``ABQIterate()``. The parameter ``element`` is -an element in the queue, and ``closureP`` and ``closureS`` are the -values that were originally passed to ``ABQIterate()``. This function -must set ``*deleteReturn`` to ``FALSE`` if ``element`` must be kept in -the queue, or ``TRUE`` if ``element`` must be deleted from the queue. -It must return ``TRUE`` if the iteration must continue, or ``FALSE`` -if the iteration must stop after processing ``element``. +an element in the queue, and ``closure`` is the value originally +passed to ``ABQIterate()``. This function must set ``*deleteReturn`` +to ``FALSE`` if ``element`` must be kept in the queue, or ``TRUE`` if +``element`` must be deleted from the queue. It must return ``TRUE`` +if the iteration must continue, or ``FALSE`` if the iteration must +stop after processing ``element``. -``void ABQIterate(ABQ abq, ABQVisitor visitor, void *closureP, Size closureS)`` +``void ABQIterate(ABQ abq, ABQVisitor visitor, void *closure)`` Call ``visitor`` for each element in the queue, passing the element -and ``closureP``. See ``ABQVisitor`` for details. +and ``closure``. See ``ABQVisitor`` for details. Document History diff --git a/mps/design/land.txt b/mps/design/land.txt index 15c1454882d..ac3b4c011ad 100644 --- a/mps/design/land.txt +++ b/mps/design/land.txt @@ -78,14 +78,14 @@ Types _`.type.land`: The type of a generic land instance. -``typedef Bool (*LandVisitor)(Land land, Range range, void *closureP, Size closureS)`` +``typedef Bool (*LandVisitor)(Land land, Range range, void *closure)`` _`.type.visitor`: Type ``LandVisitor`` is a callback function that may be passed to ``LandIterate()``. It is called for every isolated contiguous range in address order. The function must return a ``Bool`` indicating whether to continue with the iteration. -``typedef Bool (*LandDeleteVisitor)(Bool *deleteReturn, Land land, Range range, void *closureP, Size closureS)`` +``typedef Bool (*LandDeleteVisitor)(Bool *deleteReturn, Land land, Range range, void *closure)`` _`.type.deletevisitor`: Type ``LandDeleteVisitor`` is a callback function that may be passed to ``LandIterateAndDelete()``. It is called for every isolated @@ -172,7 +172,7 @@ strategy. _`.function.delete.alias`: It is acceptable for ``rangeReturn`` and ``range`` to share storage. -``Bool LandIterate(Land land, LandVisitor visitor, void *closureP, Size closureS)`` +``Bool LandIterate(Land land, LandVisitor visitor, void *closure)`` _`.function.iterate`: ``LandIterate()`` is the function used to iterate all isolated contiguous ranges in a land. It receives a @@ -182,7 +182,7 @@ function returns ``FALSE``, then iteration is terminated and ``LandIterate()`` returns ``FALSE``. If all iterator method calls return ``TRUE``, then ``LandIterate()`` returns ``TRUE`` -``Bool LandIterateAndDelete(Land land, LandDeleteVisitor visitor, void *closureP, Size closureS)`` +``Bool LandIterateAndDelete(Land land, LandDeleteVisitor visitor, void *closure)`` _`.function.iterate.and.delete`: As ``LandIterate()``, but the visitor function additionally returns a Boolean indicating whether the range diff --git a/mps/design/splay.txt b/mps/design/splay.txt index 0e77835f734..823a2dc72dd 100644 --- a/mps/design/splay.txt +++ b/mps/design/splay.txt @@ -219,16 +219,16 @@ the root of the splay tree. It is intended that the `.usage.client-tree`_ for an example). No convenience functions are provided for allocation or deallocation. -``typedef Bool (*SplayTestNodeFunction)(SplayTree splay, Tree tree, void *closureP, Size closureS)`` +``typedef Bool (*SplayTestNodeFunction)(SplayTree splay, Tree tree, void *closure)`` _`.type.splay.test.node.function`: A function of type ``SplayTestNodeFunction`` required to determine whether the node itself meets some client determined property (see `.prop`_ and -`.usage.test.node`_ for an example). Parameters ``closureP`` and -``closureS`` describe the environment for the function (see +`.usage.test.node`_ for an example). Parameter ``closure`` +describes the environment for the function (see `.function.splay.find.first`_ and `.function.splay.find.last`_). -``typedef Bool (*SplayTestTreeFunction)(SplayTree splay, Tree tree, void *closureP, Size closureS)`` +``typedef Bool (*SplayTestTreeFunction)(SplayTree splay, Tree tree, void *closure)`` _`.type.splay.test.tree.function`: A function of type ``SplayTestTreeFunction`` is required to determine whether any of the @@ -237,7 +237,7 @@ determined property (see `.prop`_ and `.usage.test.tree`_ for an example). In particular, it must be a precise (not conservative) indication of whether there are any nodes in the sub-tree for which the ``testNode`` function (see `.type.splay.test.node.function`_) would -return ``TRUE``. Parameters ``closureP`` and ``closureS`` describe the +return ``TRUE``. Parameter ``closure`` describes the environment for the function (see `.function.splay.find.first`_ and `.function.splay.find.last`_). @@ -348,18 +348,17 @@ splay tree, using ``nodeDescribe`` to print client-oriented representations of the nodes (see `.req.debug`_). Provided for debugging only. -``Bool SplayFindFirst(Tree *nodeReturn, SplayTree splay, SplayTestNodeFunction testNode, SplayTestTreeFunction testTree, void *closureP, Size closureS)`` +``Bool SplayFindFirst(Tree *nodeReturn, SplayTree splay, SplayTestNodeFunction testNode, SplayTestTreeFunction testTree, void *closure)`` _`.function.splay.find.first`: Find the first node in the tree that satisfies some client property, as determined by the ``testNode`` and -``testTree`` functions (see `.req.property.find`_). ``closureP`` and -``closureS`` are arbitrary values, and are passed to the ``testNode`` -and ``testTree`` functions which may use the values as closure -environments. If there is no satisfactory node, return ``FALSE``; +``testTree`` functions (see `.req.property.find`_). ``closure`` +is an arbitrary value, and is passed to the ``testNode`` +and ``testTree`` functions. If there is no satisfactory node, return ``FALSE``; otherwise set ``*nodeReturn`` to the node and return ``TRUE``. See `.usage.delete`_ for an example. -``Bool SplayFindLast(Tree *nodeReturn, SplayTree splay, SplayTestNodeFunction testNode, SplayTestTreeFunction testTree, void *closureP, Size closureS)`` +``Bool SplayFindLast(Tree *nodeReturn, SplayTree splay, SplayTestNodeFunction testNode, SplayTestTreeFunction testTree, void *closure)`` _`.function.splay.find.last`: As ``SplayFindFirst()``, but find the last node in the tree that satisfies the client property. @@ -521,12 +520,12 @@ _`.usage.test.tree`: Test tree function (see `.type.splay.test.tree.function`_):: Bool FreeBlockTestTree(SplayTree splay, Tree tree - void *closureP, Size closureS) { - /* Closure environment has wanted size as value of closureS. */ + void *closure) { + /* Closure environment has wanted size as value of *closure. */ /* Look at the cached value for the node to see if any */ /* blocks in the subtree are big enough. */ - Size size = closureS; + Size size = *(Size *)closure; FreeBlock freeNode = FreeBlockOfTree(tree); return freeNode->maxSize >= size; } @@ -535,11 +534,11 @@ _`.usage.test.node`: Test node function (see `.type.splay.test.node.function`_):: Bool FreeBlockTestNode(SplayTree splay, Tree tree - void *closureP, Size closureS) { - /* Closure environment has wanted size as value of closureS. */ + void *closure) { + /* Closure environment has wanted size as value of *closure. */ /* Look at the size of the node to see if is big enough. */ - Size size = closureS; + Size size = *(Size *)closure; FreeBlock freeNode = FreeBlockOfTree(tree); return freeNode->size >= size; }