#define REAL_MODE 1
char buf[NUMSIZE+2];
- register char *np = buf;
+ register char *np = &buf[1];
register int state = INT_MODE;
extern char *Salloc();
+ buf[0] = '-';
do {
if( np <= &buf[NUMSIZE] )
*np++ = ch;
lexerror("constant too long");
}
else {
- np = buf;
+ np = &buf[1];
while (*np == '0') /* skip leading zeros */
np++;
tk->TOK_INT = str2long(np, 10);
/* allocate struct for inverse */
tk->TOK_RIV = (struct real *) Malloc(sizeof(struct real));
tk->TOK_RIV->r_inverse = tk->tk_data.tk_real;
-
- /* sign */
- tk->TOK_RSI = 0;
- tk->TOK_RIV->r_sign = 1;
+ tk->TOK_RLA = 0;
+ tk->TOK_RIV->r_lab = 0;
if( np > &buf[NUMSIZE+1] ) {
tk->TOK_REL = Salloc("0.0", 4);
+ tk->TOK_RIV->r_real = tk->TOK_REL;
lexerror("floating constant too long");
}
- else tk->TOK_REL = Salloc(buf,(unsigned) (np - buf));
+ else {
+ tk->TOK_RIV->r_real = Salloc(buf,(unsigned) (np - buf));
+ tk->TOK_REL = tk->TOK_RIV->r_real + 1;
+ }
toktype = real_type;
return tk->tk_symb = REAL;
char *r_real; /* string representation of real */
struct real *r_inverse; /* the inverse of this real */
label r_lab; /* data label of real */
- int r_sign; /* positive or negative */
};
/* Token structure. Keep it small, as it is part of a parse-tree node
#define TOK_REL tk_data.tk_real->r_real
#define TOK_RIV tk_data.tk_real->r_inverse
#define TOK_RLA tk_data.tk_real->r_lab
-#define TOK_RSI tk_data.tk_real->r_sign
extern struct token dot, aside;
extern struct type *toktype, *asidetype;
Malloc(sizeof(struct real));
dotp->TOK_RIV->r_inverse = dotp->tk_data.tk_real;
- /* sign */
- dotp->TOK_RSI = 0;
- dotp->TOK_RIV->r_sign = 1;
-
dotp->TOK_REL = Salloc("0.0", 4);
+ dotp->TOK_RIV->r_real = dotp->TOK_REL;
toktype = real_type;
break;
}
RomReal(nd)
register struct node *nd;
{
- C_df_dlb(++data_label);
- C_rom_fcon(nd->nd_REL, nd->nd_type->tp_size);
- nd->nd_RLA = nd->nd_RIV->r_lab = data_label;
+ if (! nd->nd_RLA) {
+ C_df_dlb(++data_label);
+ nd->nd_RLA = data_label;
+ C_rom_fcon(nd->nd_REL, nd->nd_type->tp_size);
+ }
}
BssVar()
C_loc(nd->nd_INT);
break;
case REAL:
+ RomReal(nd);
C_lae_dlb(nd->nd_RLA, (arith) 0);
C_loi(tp->tp_size);
- if( nd->nd_RSI )
- C_ngf(tp->tp_size);
break;
case STRING:
if( tp->tp_fund == T_CHAR )
UnsignedNumber(register struct node **pnd;):
[INTEGER | REAL] { *pnd = MkLeaf(Value, &dot);
- if( ((*pnd)->nd_type = toktype) == real_type )
- RomReal(*pnd);
+ (*pnd)->nd_type = toktype;
}
;
#define nd_REL nd_token.TOK_REL
#define nd_RLA nd_token.TOK_RLA
#define nd_RIV nd_token.TOK_RIV
-#define nd_RSI nd_token.TOK_RSI
};
/* ALLOCDEF "node" 50 */
case T_ENUMERATION:
addc_db_str('e');
stb_type(tp, 0);
- adds_db_str(sprint(buf, ",%ld;", (long) df->enm_val));
+ adds_db_str(sprint(buf, ",%ld;", (long) df->con_const->nd_INT));
break;
case T_SET: {
register int i;