Difference between revisions of "NR.c"

From Organic Design wiki
m
m
Line 1: Line 1:
// Moves "this" to current loop item if exists then rotates loop and executes or reduces the item
+
// Moves "this" to node's [[[[focus]]]] if exists then rotates [[[[loop]]]] and executes/reduces the focus item
 
void nodeReduce() {
 
void nodeReduce() {
if (this = nodeGetValue(loop = nodeTraverse(this,nodeLOOP),0)) {           // Move "this" to current loop item
+
if (this = listGetValue(loop = this)) {               // Move "this" to the [[[[focus]]]] in the node's [[[[current loop]]]]
nodeSetValue(loop,0,nodeGetValue(this,nodeNEXT));                       // Rotate loop
+
listSetValue(loop,nodeGetValue(this,nodeNEXT));   // Rotate the loop
nodeGetValue(this,nodeCODE)?((code*)*nodeState(this,0))():nodeReduce(); // Execute or reduce item
+
code *ptr = *nodeState(this,nodeCODE);            // [[[[nodeCODE]]]] value is a pointer-index
 +
ptr ? ptr() : nodeReduce();                       // Execute ptr if non-NULL, else [[[[reduce]]]] item
 
}
 
}
 
}
 
}

Revision as of 23:28, 8 November 2006

// Moves "this" to node's [[focus]] if exists then rotates [[loop]] and executes/reduces the focus item void nodeReduce() { if (this = listGetValue(loop = this)) { // Move "this" to the [[focus]] in the node's [[current loop]] listSetValue(loop,nodeGetValue(this,nodeNEXT)); // Rotate the loop code *ptr = *nodeState(this,nodeCODE); // [[nodeCODE]] value is a pointer-index ptr ? ptr() : nodeReduce(); // Execute ptr if non-NULL, else [[reduce]] item } }