=================================================================== RCS file: /home/cvs/OpenXM/src/ox_gsl/ox_eval.c,v retrieving revision 1.5 retrieving revision 1.7 diff -u -p -r1.5 -r1.7 --- OpenXM/src/ox_gsl/ox_eval.c 2018/04/13 16:51:42 1.5 +++ OpenXM/src/ox_gsl/ox_eval.c 2018/04/18 08:31:51 1.7 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/ox_gsl/ox_eval.c,v 1.4 2018/04/06 10:44:51 ohara Exp $ */ +/* $OpenXM: OpenXM/src/ox_gsl/ox_eval.c,v 1.6 2018/04/17 02:50:07 ohara Exp $ */ #include #include @@ -50,6 +50,11 @@ static double op_negative(double x) return -x; } +static double op_parentheses(double x) +{ + return x; +} + /* 定数は引数なしの関数として実現する。*/ typedef struct { char *name; @@ -90,6 +95,7 @@ entry global_dic[512] = { {"j1",0,j1,1}, {"y0",0,y0,1}, {"y1",0,y1,1}, + {"()", 0,op_parentheses,1}, {"-", 0,op_negative,1}, {"+", 0,op_add,2}, {"-", 0,op_sub,2}, @@ -112,9 +118,10 @@ int register_entry(char *s, double v) { entry *e = &local_dic[local_dic_counter]; if(local_dic_countername = s; + e->name = (char *)malloc(strlen(s)+1); + strcpy(e->name, s); e->v = v; - e->f = NULL; + e->f = NULL; local_dic_counter++; return 1; }