Difference between revisions of "NR.c"

From Organic Design wiki
 
(fix HL)
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
if (this = nodeGetValue(loop = nodeTraverse(this,nodeLOOP),0)) {           // this = current loop item
+
<source lang="c">
nodeSetValue(loop,0,nodeGetValue(this,nodeNEXT));                       // Rotate loop
+
// Moves "this" to node's focus if exists then rotates loop and executes/reduces the focus item
nodeGetValue(this,nodeCODE)?((code*)*nodeState(this,0))():nodeReduce(); // Exec or reduce item
+
void nodeReduce() {
}
+
    if(this = nodeLoopRotate(parent = this)) {       // Move "this" to the focus in the node's loop and rotate
 +
        nodeSetValue(this, nodePARENT, parent);       // Update the parent association
 +
        if(code = *nodeState(this, nodeCODE)) code(); // nodeCODE value is a pointer-index, execute as function-reference if non-zero
 +
    }
 +
}</source>

Latest revision as of 00:32, 26 May 2016

// Moves "this" to node's focus if exists then rotates loop and executes/reduces the focus item
void nodeReduce() {
    if(this = nodeLoopRotate(parent = this)) {        // Move "this" to the focus in the node's loop and rotate
        nodeSetValue(this, nodePARENT, parent);       // Update the parent association
        if(code = *nodeState(this, nodeCODE)) code(); // nodeCODE value is a pointer-index, execute as function-reference if non-zero
    }
}