Difference between revisions of "NR.c"

From Organic Design wiki
(simplify for example)
(update here too)
Line 3: Line 3:
 
this = listGetValue(loop = this);                    // Move "this" to the [[[[focus]]]] in the node's [[[[loop]]]]
 
this = listGetValue(loop = this);                    // Move "this" to the [[[[focus]]]] in the node's [[[[loop]]]]
 
if (this) {                                          // Returns immediately if no node in focus (next [[[[quantum]]]] would start at [[[[nodeROOT|root]]]] again)
 
if (this) {                                          // Returns immediately if no node in focus (next [[[[quantum]]]] would start at [[[[nodeROOT|root]]]] again)
listSetValue(loop,nodeGetValue(this,nodeNEXT));  // Rotate the loop
+
listSetValue(loop,nodeGetValue(this,nodeNEXT));  // Rotate the [[[[loop]]]]
 +
nodeSetValue(this,nodePARENT,parent);            // Update the [[[[parent]]]] association
 
code *ptr = *nodeState(this,nodeCODE);            // [[[[nodeCODE|nodeCODE's]]]] state is either NULL, or a pointer to a function
 
code *ptr = *nodeState(this,nodeCODE);            // [[[[nodeCODE|nodeCODE's]]]] state is either NULL, or a pointer to a function
 
if (ptr) ptr(); else nodeReduce();                // Execute ptr if non-NULL, else [[[[reduce]]]] item (give quantum to focus to reduce)
 
if (ptr) ptr(); else nodeReduce();                // Execute ptr if non-NULL, else [[[[reduce]]]] item (give quantum to focus to reduce)
 
}
 
}
 
}
 
}

Revision as of 02:19, 12 November 2006

// Moves "this" to node's [[focus]] if exists then rotates [[loop]] and executes/reduces the focus item void nodeReduce() { this = listGetValue(loop = this); // Move "this" to the [[focus]] in the node's [[loop]] if (this) { // Returns immediately if no node in focus (next [[quantum]] would start at [[root]] again) listSetValue(loop,nodeGetValue(this,nodeNEXT)); // Rotate the [[loop]] nodeSetValue(this,nodePARENT,parent); // Update the [[parent]] association code *ptr = *nodeState(this,nodeCODE); // [[nodeCODE's]] state is either NULL, or a pointer to a function if (ptr) ptr(); else nodeReduce(); // Execute ptr if non-NULL, else [[reduce]] item (give quantum to focus to reduce) } }