Exemplo n.º 1
0
Arquivo: eval.c Projeto: certik/nwcc
static ppval pp_strtoconst(char *refc)
{
	ppval q;
	char *c = refc, *d;
	u_big ru;
	s_big rs;
	int sp, dec;

	if (*c == '\'' || *c == 'L') {
		q.sign = (*c == 'L') ? WCHAR_SIGNEDNESS : 1;
		if (*c == 'L' && *(++ c) != '\'') {
			error(eval_line,
				"invalid wide character constant: %s", refc);
			throw(eval_exception);
		}
		if (q.sign) {
			q.u.sv = big_s_fromlong(pp_char(c, refc));
		} else {
			q.u.uv = big_u_fromulong(pp_char(c, refc));
		}
		return q;
	}
	if (*c == '0') {
		/* octal or hexadecimal */
		dec = 0;
		c ++;
		if (*c == 'x' || *c == 'X') {
			c ++;
			d = big_u_hexconst(c, &ru, &rs, &sp);
		} else {
			d = big_u_octconst(c, &ru, &rs, &sp);
		}
	} else {
		dec = 1;
		d = big_u_decconst(c, &ru, &rs, &sp);
	}
	q.sign = pp_suffix(d, refc);
	if (q.sign) {
		if (!sp) {
			if (dec) {
				error(eval_line, "constant too large "
					"for destination type");
				throw(eval_exception);
			} else {
				warning(eval_line, "constant is so large "
					"that it is unsigned");
			}
			q.u.uv = ru;
			q.sign = 0;
		} else {
			q.u.sv = rs;
		}
	} else {
		q.u.uv = ru;
	}
	return q;
}
Exemplo n.º 2
0
static inline void pp_close_par(printer_t *p) {
  pp_char(p, ')');
}
Exemplo n.º 3
0
static inline void pp_space(printer_t *p) {
  pp_char(p, ' ');
}
Exemplo n.º 4
0
static inline void pp_open_par(printer_t *p) {
  pp_char(p, '(');
}