exp->ex_type = tp;
exp->ex_class = Float;
- exp->FL_VALUE = 0;
flt_arith2flt(exp->VL_VALUE, &(exp->FL_ARITH), uns);
- exp->FL_DATLAB = 0;
}
else {
fp_used = 1;
register struct expr *expr;
{
flt_umin(&(expr->FL_ARITH));
- if (expr->FL_VALUE) free(expr->FL_VALUE);
- expr->FL_VALUE = 0;
}
break;
}
case Float:
- if (!expr->FL_VALUE) {
- expr->FL_VALUE = Malloc(FLT_STRLEN);
- flt_flt2str(&(expr->FL_ARITH), expr->FL_VALUE, FLT_STRLEN);
- }
- print("%s\n", expr->FL_VALUE);
+ {
+ char buf[FLT_STRLEN];
+
+ flt_flt2str(&(expr->FL_ARITH), buf, FLT_STRLEN);
+ print("%s\n", buf);
break;
+ }
case Oper:
o = &expr->ex_object.ex_oper;
print("\n");
case Float: /* a floating constant */
if (gencode) {
label datlab = data_label();
+ char buf[FLT_STRLEN];
fp_used = 1;
- if (!expr->FL_VALUE) {
- expr->FL_VALUE = Malloc(FLT_STRLEN);
- flt_flt2str(&(expr->FL_ARITH), expr->FL_VALUE, FLT_STRLEN);
- }
+ flt_flt2str(&(expr->FL_ARITH), buf, FLT_STRLEN);
C_df_dlb(datlab);
- C_rom_fcon(expr->FL_VALUE, expr->ex_type->tp_size);
+ C_rom_fcon(buf, expr->ex_type->tp_size);
C_lae_dlb(datlab, (arith)0);
C_loi(expr->ex_type->tp_size);
}
ex->ex_class = String;
ex->SG_VALUE = str;
ex->SG_LEN = len;
- /* ex->SG_DATLAB = 0; */
}
int2expr(expr)
crash("(float2expr) bad fund %s\n", symbol2str(fund));
}
expr->ex_class = Float;
- expr->FL_VALUE = dot.tk_fval;
- flt_str2flt(expr->FL_VALUE, &(expr->FL_ARITH));
+ flt_str2flt(dot.tk_fval, &(expr->FL_ARITH));
+ free(dot.tk_fval);
ASSERT(flt_status != FLT_NOFLT);
if (flt_status == FLT_OVFL)
expr_warning(expr,"internal floating point overflow");
- expr->FL_DATLAB = 0;
}
struct expr*
/* The expression expr is freed recursively.
*/
if (expr) {
- if (expr->ex_class == Float && expr->FL_VALUE)
- free(expr->FL_VALUE);
if (expr->ex_class == Oper) {
free_expression(expr->OP_LEFT);
free_expression(expr->OP_RIGHT);
struct string {
char *sg_value; /* row of bytes repr. the constant */
int sg_len; /* length of the row */
- label sg_datlab; /* global data-label */
-};
-
-struct floating {
- char *fl_value; /* pointer to string repr. the fp const. */
- flt_arith fl_arith; /* the value in high precision */
- label fl_datlab; /* global data_label */
};
struct oper {
union {
struct value ex_value;
struct string ex_string;
- struct floating ex_float;
+ flt_arith ex_fl_arith;
struct oper ex_oper;
} ex_object;
};
#define VL_LBL EX_VALUE.vl_data.vl_lbl
#define SG_VALUE ex_object.ex_string.sg_value
#define SG_LEN ex_object.ex_string.sg_len
-#define SG_DATLAB ex_object.ex_string.sg_datlab
-#define FL_VALUE ex_object.ex_float.fl_value
-#define FL_ARITH ex_object.ex_float.fl_arith
-#define FL_DATLAB ex_object.ex_float.fl_datlab
+#define FL_ARITH ex_object.ex_fl_arith
#define OP_TYPE ex_object.ex_oper.op_type
#define OP_LEFT ex_object.ex_oper.op_left
#define OP_OPER ex_object.ex_oper.op_oper
default: /* there can't be another status */
crash("(fltcstoper) bad status");
}
- if ((*expp)->FL_VALUE) free((*expp)->FL_VALUE);
- (*expp)->FL_VALUE = 0;
if (compar) {
fill_int_expr(*expp, (arith)cmpval, INT);
} else {
print_expr("init-expr after cast", expr);
#endif DEBUG
if (expr->ex_class == Float) {
- if (!expr->FL_VALUE) {
- expr->FL_VALUE = Malloc(FLT_STRLEN);
- flt_flt2str(&(expr->FL_ARITH), expr->FL_VALUE, FLT_STRLEN);
- }
- C_con_fcon(expr->FL_VALUE, expr->ex_type->tp_size);
+ char buf[FLT_STRLEN];
+
+ flt_flt2str(&(expr->FL_ARITH), buf, FLT_STRLEN);
+ C_con_fcon(buf, expr->ex_type->tp_size);
}
#ifdef NOTDEF