Difference between revisions of "Peerd.c"

From Organic Design wiki
(#include serialise.c)
(#include nodalHusk.c and move nodal-content into it)
Line 24: Line 24:
 
#include "serialise.c"
 
#include "serialise.c"
 
#include "server.c"
 
#include "server.c"
 
+
#include "nodalHusk.c"
// NODAL CONTENT - default "hardwired" default-nodal-app
 
 
 
// define the serialsed-text version of nodal structure
 
// - allow shorthand for Next's?
 
 
 
// NodalSpace = deserialise(string);
 
 
 
// if the node is a function (same type-check as reduce() uses),
 
//  then use its value (if any) as local function name,
 
//  change it to a ref with this[functionName] (if pre-declared - see below)
 
 
 
 
 
// NODAL FUNCTIONS - later included in content instead of "hardwired" here
 
 
 
// pre-declared functions built by nodal-app
 
// Currently it can't compile, so additional functionality required by nodal-app are pre-declared here
 
// later the script and its functions will be a nodal-state produced by a nodal-build and cache
 
 
 
// box properties
 
// events
 
// tcc
 
  
 
int test = deserialise( "testing deserialise:\n\r== can do headings for wiki ==\n*[[7491|Foo]]\n*[[2401|bar]]:[[1928|hello]] # my special association\r\r\n*[[2401|baz]]:[[1328|world]]\n*[[2421|key]]:[[1628]]\n*[[5061|key2]]:[[8928|]]\n*[[2821|key3]]:[[3928|value]]");
 
int test = deserialise( "testing deserialise:\n\r== can do headings for wiki ==\n*[[7491|Foo]]\n*[[2401|bar]]:[[1928|hello]] # my special association\r\r\n*[[2401|baz]]:[[1328|world]]\n*[[2421|key]]:[[1628]]\n*[[5061|key2]]:[[8928|]]\n*[[2821|key3]]:[[3928|value]]");

Revision as of 04:48, 2 July 2006

// prototype of listSpace in c // Licenced under LGPL: www.gnu.org/copyleft/lesser.html

  1. include <stdlib.h>
  2. include <stdio.h>
  3. include <string.h>

// Globals & constants

  1. define MAXITEMS 10000

int i,j; // global iterators int items = 0; int *space;

// Strucst used to emulate a variant-type typedef struct types { char* text; void (*code)(); int number; } variant;

int main() {

#include "listSpace.c" #include "nodeSpace.c" #include "serialise.c" #include "server.c" #include "nodalHusk.c"

int test = deserialise( "testing deserialise:\n\r== can do headings for wiki ==\n*Foo\n*bar:hello # my special association\r\r\n*baz:world\n*key:1628\n*key2:[[8928|]]\n*key3:value"); printf("\n%d list-space items have been created.\n", items);

// Count how many nodes have payloads int p=0; for (i=0; i<MAXITEMS; i++) if (listGetValue(i)) p++; printf("%d items in use:\n", p); for (i=0; i<MAXITEMS; i++) if (j=listGetValue(i)) printf("  %d = %d\n",i,j); printf("\n\n");

}