Difference between revisions of "NodeSpace.h"

From Organic Design wiki
 
m (add nodal-constants)
Line 1: Line 1:
 +
#define CURRENT 2
 +
#define AND 3
 +
#define THEN 4
 +
#define CODE 5
 +
 
int nodeTraverse(int subject, int path) {
 
int nodeTraverse(int subject, int path) {
 
// select node wco selNode
 
// select node wco selNode

Revision as of 04:35, 2 July 2006

  1. define CURRENT 2
  2. define AND 3
  3. define THEN 4
  4. define CODE 5

int nodeTraverse(int subject, int path) { // select node wco selNode return subject; }

// set nodal value of node/path // - path is array-of-node int nodeGetValue(int subject, int path) { int value; return value; }

void nodeSetValue(int subject, int path, int value) { }

// PROBLEM: // - currently this code assumes all states are text, // but we need to be able to return function references too. // - not sure how to handle this in C++ properly, // we could get state to return a struct with STRING, INT, CODE // the caller knows which field is populated variant nodeGetState(int subject) { variant state; return state; }

void nodeSetState(int subject, variant state) { }

int nodeInsertKey(int subject, int key) { int instance; return instance; }

void nodeRemoveKey(int subject, int key) { }

// - Consumes quanta of execution // - Creates History from change events // - Builds, declares and executes functionality // - Should reduction handle cyles (current-cycle etc), or a separate root-thread void nodeReduce(int subject) { // return if no CURRENT node (either nonexistent, or ref to node 0) int node; if ((node = nodeGetValue(subject, CURRENT)) == 0) return; nodeSetValue(subject, CURRENT, nodeGetValue(node, AND)); if (nodeGetValue(node, CODE)) { void (*code)() = nodeGetState(node).code; code(); // Later this must declare and build if no function-reference // replace self in loop with node.THEN if non-zero } else nodeReduce(node); }