diff --git a/src/math.c b/src/math.c index a34597d..11ebbd1 100644 --- a/src/math.c +++ b/src/math.c @@ -3,6 +3,9 @@ #include "math.h" #include "util.h" +typedef struct s_expr EXPR; +EXPR sexpr [MAX_EXPR_ARGS]; + static char expr_out[(MAX_EXPR_LEN*2)+1]; int get_expr_count() @@ -83,7 +86,8 @@ char *ss_expr(char *string) syn_error("ss:error:calc operator not supported"); } - if(gcvt(finalf, 12, expr_out)==NULL) + sprintf(expr_out, "%f", finalf); + if(expr_out==NULL) syn_error("ss:error:calc illegal instruction"); return expr_out; diff --git a/src/math.h b/src/math.h index 3a482d1..d912d6f 100644 --- a/src/math.h +++ b/src/math.h @@ -4,8 +4,5 @@ struct s_expr char arg[MAX_EXPR_LEN+1]; }; -typedef struct s_expr EXPR; -EXPR sexpr [MAX_EXPR_ARGS]; - void set_expr_arg(int index, char *arg); char *ss_expr(char *string); diff --git a/src/util.c b/src/util.c index 33312f9..e308404 100644 --- a/src/util.c +++ b/src/util.c @@ -9,6 +9,8 @@ #include "deps.h" #include "util.h" +time_t current_time; + void syn_error(char *message) { printf("%s\n", message); diff --git a/src/util.h b/src/util.h index 5a62994..1f5cb43 100644 --- a/src/util.h +++ b/src/util.h @@ -5,8 +5,6 @@ View README file supplied with this software for more details */ -time_t current_time; - void syn_error(char *message); char *strip_nl(char *string); int file_exists(char *path);