/* eval-client.c - A simple program that invokes the `eval-server' DLL - felix */


#include <stdio.h>
#include "chicken.h"


char buffer[ 4096 ];


int main(int argc, char *argv[])
{
  C_parameter p[ 1 ];

  p[ 0 ].p = buffer;
  printf("Enter an expression to be evaluated, followed by RETURN.\nEnter an empty line to exit.\n");

  for(;;) {
    fputs(">>> ", stdout);
    fflush(stdout);
    
    if(fgets(buffer, 4096, stdin) != NULL) {
      if(*buffer == '\n') break;
      else CHICKEN_invoke(1, p, 1, C_toplevel);

      printf("%s\n", p[ 0 ].p);
    }
  }

  return 0;
}
