vsm2

exeprimental virtual stack machine for *nix
Log | Files | Refs

main.c (486B)


      1 #include <stdio.h>
      2 #include <string.h>
      3 
      4 #include "cell.h"
      5 #include "bus.h"
      6 #include "mem.h"
      7 
      8 int
      9 main(void)
     10 {
     11 	Bus *bus = createbus();
     12 	Mem *mem = createmem(bus);
     13 	Cell *cell = createcell(6, strdup("hello"));
     14 	printf("cell: %s\n", cell->p);
     15 	memstore(ChDebug, mem, 1234, cell);
     16 	memstep(mem);
     17 	memfetch(ChDebug, mem, 1234);
     18 	memstep(mem);
     19 	Msg *ret = buspull(bus, ChDebug);
     20 	if (ret != NULL) {
     21 		printf("yes: %s\n", ret->dat->p);
     22 	}
     23 	else printf("nope\n");
     24 	freemsg(ret);
     25 	return 0;
     26 }
     27