Peerd.c

From Organic Design wiki
Revision as of 04:46, 2 July 2006 by Nad (talk | contribs) (#include serialise.c)

// 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"

// 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*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");

}