NodeSpace.h

From Organic Design wiki
Revision as of 05:35, 4 July 2006 by Nad (talk | contribs) (change variant to void*)
  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 void* nodeGetState(int subject) { void* state; return state; }

void nodeSetState(int subject, void* 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(); // Later this must declare and build if no function-reference // replace self in loop with node.THEN if non-zero } else nodeReduce(node); }