#include #include #include #include #include "calc.yy.h" #include "calculator.h" extern void yyparse (); extern "C" int yywrap () { return 1; } static char * from_file (const char * filename) { struct stat statbuf; int r = stat (filename, & statbuf); if (r) return nullptr; char * buffer = (char*) malloc (statbuf.st_size + 1); FILE * in = fopen (filename,"r"); r = fread (buffer, 1, statbuf.st_size, in); if (r != statbuf.st_size) { free (buffer); fclose (in); return nullptr; } buffer [r] = '\0'; fclose (in); return buffer; } void emitData (double * x, double * y, const int len) { for (int n=0; n