Difference between revisions of "NodeSpace.h"
(change variant to void*) |
m |
||
Line 3: | Line 3: | ||
#define THEN 4 | #define THEN 4 | ||
#define CODE 5 | #define CODE 5 | ||
+ | typedef int node; | ||
− | + | node nodeTraverse(node subject, node path) { | |
// select node wco selNode | // select node wco selNode | ||
return subject; | return subject; | ||
Line 11: | Line 12: | ||
// set nodal value of node/path | // set nodal value of node/path | ||
// - path is array-of-node | // - path is array-of-node | ||
− | + | node nodeGetValue(node subject, node path) { | |
− | + | node value; | |
return value; | return value; | ||
} | } | ||
− | void nodeSetValue( | + | void nodeSetValue(node subject, node path, node value) { |
} | } | ||
− | + | void* nodeGetState(node subject) { | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | void* nodeGetState( | ||
void* state; | void* state; | ||
return state; | return state; | ||
} | } | ||
− | void nodeSetState( | + | void nodeSetState(node subject, void* state) { |
} | } | ||
− | + | node nodeInsertKey(node subject, node key) { | |
− | + | node instance; | |
return instance; | return instance; | ||
} | } | ||
− | void nodeRemoveKey( | + | void nodeRemoveKey(node subject, node key) { |
} | } | ||
Line 45: | Line 40: | ||
// - Builds, declares and executes functionality | // - Builds, declares and executes functionality | ||
// - Should reduction handle cyles (current-cycle etc), or a separate root-thread | // - Should reduction handle cyles (current-cycle etc), or a separate root-thread | ||
− | void nodeReduce( | + | void nodeReduce(node subject) { |
// return if no CURRENT node (either nonexistent, or ref to node 0) | // return if no CURRENT node (either nonexistent, or ref to node 0) | ||
− | + | node n; | |
− | if (( | + | if ((n = nodeGetValue(subject, CURRENT)) == 0) return; |
− | nodeSetValue(subject, CURRENT, nodeGetValue( | + | nodeSetValue(subject, CURRENT, nodeGetValue(n, AND)); |
− | if (nodeGetValue( | + | if (nodeGetValue(n, CODE)) { |
− | void (*code)() = nodeGetState( | + | void (*code)() = nodeGetState(n); |
code(); | code(); | ||
// Later this must declare and build if no function-reference | // Later this must declare and build if no function-reference | ||
− | // replace self in loop with | + | // replace self in loop with n.THEN if non-zero |
− | } else nodeReduce( | + | } else nodeReduce(n); |
} | } |
Revision as of 12:40, 5 July 2006
- define CURRENT 2
- define AND 3
- define THEN 4
- define CODE 5
typedef int node;
node nodeTraverse(node subject, node path) { // select node wco selNode return subject; }
// set nodal value of node/path // - path is array-of-node node nodeGetValue(node subject, node path) { node value; return value; }
void nodeSetValue(node subject, node path, node value) { }
void* nodeGetState(node subject) { void* state; return state; }
void nodeSetState(node subject, void* state) { }
node nodeInsertKey(node subject, node key) { node instance; return instance; }
void nodeRemoveKey(node subject, node 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(node subject) { // return if no CURRENT node (either nonexistent, or ref to node 0) node n; if ((n = nodeGetValue(subject, CURRENT)) == 0) return; nodeSetValue(subject, CURRENT, nodeGetValue(n, AND)); if (nodeGetValue(n, CODE)) { void (*code)() = nodeGetState(n); code(); // Later this must declare and build if no function-reference // replace self in loop with n.THEN if non-zero } else nodeReduce(n); }