示例#1
0
char 
*paridroid_eval(const char *in) 
{

  if(setjmp(env) != 0) {
    LOGE("setjmp different from zero");
    return "";
  }

  s_droidStr.n=0;
  avma=top;

  volatile GEN z = gnil;
  pari_CATCH(CATCH_ALL)
  {
    droidOutS(pari_err2str(__iferr_data));
  } pari_TRY {
    z = gp_read_str(in);
  } pari_ENDCATCH;
 
  if (z != gnil) 
  {
      char *out;
      pari_add_hist(z);
      if (in[strlen(in)-1]!=';') 
	{
	  out = GENtostr(z);
	  droidOutS(out);
	}
  }
  droidOutC(0);
  return droidStr;
}
示例#2
0
static VALUE gp_polinterpolate(VALUE self, VALUE sxa, VALUE sya, VALUE sx) {
  rb_io_puts(1, &sxa, rb_stdout); 
  rb_io_puts(1, &sya, rb_stdout); 
  rb_io_puts(1, &sx, rb_stdout); 
  GEN xa = geval(strtoGENstr(StringValueCStr(sxa)));
  GEN ya = geval(strtoGENstr(StringValueCStr(sya)));
  GEN x = geval(strtoGENstr(StringValueCStr(sx)));
  char* pol = GENtostr(polint(xa, ya, x, NULL));
  return rb_str_new2(pol);
}
示例#3
0
static VALUE gp_eval(VALUE self, VALUE str) {
  GEN v = geval(strtoGENstr(StringValueCStr(str)));
  char* pol = GENtostr(v);
  return rb_str_new2(pol);
}