Difference between revisions of "Peerd.c"

From Organic Design wiki
(comment includes)
m
Line 7: Line 7:
 
// Globals & constants
 
// Globals & constants
 
#define MAXITEMS 10000
 
#define MAXITEMS 10000
int i,j; // global iterators
 
 
int items = 0;
 
int items = 0;
 
int *space;
 
int *space;
Line 25: Line 24:
  
 
// Count how many nodes have payloads
 
// Count how many nodes have payloads
int p=0;
+
int i,j,p=0;
 
for (i=0; i<MAXITEMS; i++) if (listGetValue(i)) p++;
 
for (i=0; i<MAXITEMS; i++) if (listGetValue(i)) p++;
 
printf("%d items in use:\n", p);
 
printf("%d items in use:\n", p);

Revision as of 11:09, 4 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 items = 0; int *space;

int main() {

#include "file.c" // Logging and file read/write #include "listSpace.c" // ListSpace function declarations and initialisation #include "nodeSpace.c" // NodeSpace function declarations and initialisation #include "serialise.c" // Nodal-to-text and visa-versa #include "nodalHusk.c" // Actual nodal content and predeclared's #include "interface.c" // Layer model (currently bitmap/imagemap-based) #include "server.c" // Server must be last because it never returns

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 i,j,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");

}