CHICKEN_eval_ bug added by rivo238123 on Wed Jan 9 15:19:42 2013

;; build options

make ARCH= \
    PREFIX=/usr \
    PLATFORM=linux \
    HOSTSYSTEM=mips-linux-gnu \
    DESTDIR=$HOME/sigma/libs/chicken-4.8.0/mips-target \
    TARGET_FEATURES="-no-feature x86 -feature mips" \
    LINKER_OPTIONS="-EL" \
    C_COMPILER_OPTIMIZATION_OPTIONS="-g -rdynamic -EL -O2 -Wa,-mips32r2 -march=24kf -mtune=24kf" \
    clean distclean install



////////// main source

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <wait.h>
#include <math.h>
#include <execinfo.h>
#include <chicken/chicken.h>
#include <sys/stat.h>

void chicken_script(const char* filename)
{
    static time_t filetime = 0;
    static int ready = FALSE;
    struct stat s;
    stat(filename,&s);
    if (filetime < s.st_mtim.tv_sec)
    {
        printf("reload %s %d\n",filename,s.st_mtim.tv_sec);
        CHICKEN_load((char*)filename);
        ready = TRUE;
        filetime = s.st_mtim.tv_sec;
    }
    if (ready)
    {
        char errbuf[1000];
        char outbuf[1000];
        sprintf(errbuf,"(render %f)",1.0);
        if (!CHICKEN_eval_string_to_string(errbuf,outbuf,sizeof(outbuf)))
        {
            CHICKEN_get_error_message(errbuf,sizeof(errbuf));
            sprintf("error>%s\n",errbuf);
            ready = FALSE;
        }
        printf(">%s\n",outbuf);
    }
}

int main(int argc,char** argv)
{
    CHICKEN_run(CHICKEN_default_toplevel);
    chicken_script("demo.scm");
}
   
;;;;;;;; demo.scm

(define (render t) (#f))