This commit is contained in:
Pentium44 2021-04-08 03:33:55 -07:00
parent 2745dbb1ce
commit 32ca3103b7
4 changed files with 7 additions and 6 deletions

View File

@ -3,6 +3,9 @@
#include "math.h" #include "math.h"
#include "util.h" #include "util.h"
typedef struct s_expr EXPR;
EXPR sexpr [MAX_EXPR_ARGS];
static char expr_out[(MAX_EXPR_LEN*2)+1]; static char expr_out[(MAX_EXPR_LEN*2)+1];
int get_expr_count() int get_expr_count()
@ -83,7 +86,8 @@ char *ss_expr(char *string)
syn_error("ss:error:calc operator not supported"); 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"); syn_error("ss:error:calc illegal instruction");
return expr_out; return expr_out;

View File

@ -4,8 +4,5 @@ struct s_expr
char arg[MAX_EXPR_LEN+1]; char arg[MAX_EXPR_LEN+1];
}; };
typedef struct s_expr EXPR;
EXPR sexpr [MAX_EXPR_ARGS];
void set_expr_arg(int index, char *arg); void set_expr_arg(int index, char *arg);
char *ss_expr(char *string); char *ss_expr(char *string);

View File

@ -9,6 +9,8 @@
#include "deps.h" #include "deps.h"
#include "util.h" #include "util.h"
time_t current_time;
void syn_error(char *message) void syn_error(char *message)
{ {
printf("%s\n", message); printf("%s\n", message);

View File

@ -5,8 +5,6 @@
View README file supplied with this software for more details View README file supplied with this software for more details
*/ */
time_t current_time;
void syn_error(char *message); void syn_error(char *message);
char *strip_nl(char *string); char *strip_nl(char *string);
int file_exists(char *path); int file_exists(char *path);