feck/src/main.c

35 lines
591 B
C

#include "fe.h"
#include <stdio.h>
int
main(void)
{
const int size = 0xffffff;
void *data = malloc(size);
fe_Context *ctx = fe_open(data, size);
#ifdef RAYLIB
FILE *fp = fopen("test.fe", "rb");
int gc = fe_savegc(ctx);
for (;;) {
fe_Object *obj = fe_readfp(ctx, fp);
/* break if there's nothing left to read */
if (!obj)
break;
/* evaluate read object */
fe_eval(ctx, obj);
/* restore GC stack which would now contain both the
* read object and result from evaluation */
fe_restoregc(ctx, gc);
}
fclose(fp);
#endif
fe_close(ctx);
free(data);
return 0;
}