Forráskód Böngészése

built in the compile time flag NOFLOAT to get rid of the float stuff

erikb 38 éve
szülő
commit
f27be37970

+ 10 - 1
lang/cem/cemcom/LLlex.c

@@ -337,6 +337,7 @@ go_on:	/* rescan, the following character has been read	*/
 		register arith val = 0;
 		register arith val = 0;
 
 
 		if (ch == '.') {	/* an embarrassing ambiguity */
 		if (ch == '.') {	/* an embarrassing ambiguity */
+#ifndef NOFLOAT
 			LoadChar(vch);
 			LoadChar(vch);
 			PushBack();
 			PushBack();
 			if (!is_dig(vch))	/* just a `.'	*/
 			if (!is_dig(vch))	/* just a `.'	*/
@@ -345,6 +346,9 @@ go_on:	/* rescan, the following character has been read	*/
 			/*	in the rest of the compiler, all floats
 			/*	in the rest of the compiler, all floats
 				have to start with a digit.
 				have to start with a digit.
 			*/
 			*/
+#else NOFLOAT
+			return ptok->tk_symb = ch;
+#endif NOFLOAT
 		}
 		}
 		if (ch == '0') {
 		if (ch == '0') {
 			*np++ = ch;
 			*np++ = ch;
@@ -367,7 +371,10 @@ go_on:	/* rescan, the following character has been read	*/
 			ptok->tk_fund = LONG;
 			ptok->tk_fund = LONG;
 			return ptok->tk_symb = INTEGER;
 			return ptok->tk_symb = INTEGER;
 		}
 		}
-		if (base == 16 || !(ch == '.' || ch == 'e' || ch == 'E')) {
+#ifndef NOFLOAT
+		if (base == 16 || !(ch == '.' || ch == 'e' || ch == 'E'))
+#endif NOFLOAT
+		{
 			PushBack();
 			PushBack();
 			ptok->tk_ival = val;
 			ptok->tk_ival = val;
 			/*	The semantic analyser must know if the
 			/*	The semantic analyser must know if the
@@ -383,6 +390,7 @@ go_on:	/* rescan, the following character has been read	*/
 			return ptok->tk_symb = INTEGER;
 			return ptok->tk_symb = INTEGER;
 		}
 		}
 		/* where's the test for the length of the integral ???	*/
 		/* where's the test for the length of the integral ???	*/
+#ifndef NOFLOAT
 		if (ch == '.'){
 		if (ch == '.'){
 			if (np < &buf[NUMSIZE])
 			if (np < &buf[NUMSIZE])
 				*np++ = ch;
 				*np++ = ch;
@@ -423,6 +431,7 @@ go_on:	/* rescan, the following character has been read	*/
 		else
 		else
 			ptok->tk_fval = Salloc(buf, np - buf) + 1;
 			ptok->tk_fval = Salloc(buf, np - buf) + 1;
 		return ptok->tk_symb = FLOATING;
 		return ptok->tk_symb = FLOATING;
+#endif NOFLOAT
 	}
 	}
 	case STEOI:			/* end of text on source file	*/
 	case STEOI:			/* end of text on source file	*/
 		return ptok->tk_symb = EOI;
 		return ptok->tk_symb = EOI;

+ 4 - 0
lang/cem/cemcom/LLlex.h

@@ -21,7 +21,9 @@ struct token	{
 			int tok_fund;	/* INT or LONG */
 			int tok_fund;	/* INT or LONG */
 			arith tok_ival;
 			arith tok_ival;
 		} tok_integer;
 		} tok_integer;
+#ifndef NOFLOAT
 		char *tok_fval;
 		char *tok_fval;
+#endif NOFLOAT
 	} tok_data;
 	} tok_data;
 };
 };
 
 
@@ -33,7 +35,9 @@ struct token	{
 #define tk_len	tok_data.tok_string.tok_len
 #define tk_len	tok_data.tok_string.tok_len
 #define tk_fund	tok_data.tok_integer.tok_fund
 #define tk_fund	tok_data.tok_integer.tok_fund
 #define tk_ival	tok_data.tok_integer.tok_ival
 #define tk_ival	tok_data.tok_integer.tok_ival
+#ifndef NOFLOAT
 #define tk_fval	tok_data.tok_fval
 #define tk_fval	tok_data.tok_fval
+#endif NOFLOAT
 
 
 extern struct token dot, ahead, aside;
 extern struct token dot, ahead, aside;
 extern unsigned int LineNumber;	/* "LLlex.c"	*/
 extern unsigned int LineNumber;	/* "LLlex.c"	*/

+ 2 - 0
lang/cem/cemcom/LLmessage.c

@@ -44,8 +44,10 @@ insert_token(tk)
 		dot.tk_fund = INT;
 		dot.tk_fund = INT;
 		dot.tk_ival = 1;
 		dot.tk_ival = 1;
 		break;
 		break;
+#ifndef NOFLOAT
 	case FLOATING:
 	case FLOATING:
 		dot.tk_fval = Salloc("0.0", 4);
 		dot.tk_fval = Salloc("0.0", 4);
 		break;
 		break;
+#endif NOFLOAT
 	}
 	}
 }
 }

+ 4 - 0
lang/cem/cemcom/Parameters

@@ -66,8 +66,10 @@
 #define SZ_WORD		(arith)4
 #define SZ_WORD		(arith)4
 #define	SZ_INT		(arith)4
 #define	SZ_INT		(arith)4
 #define	SZ_LONG		(arith)4
 #define	SZ_LONG		(arith)4
+#ifndef NOFLOAT
 #define	SZ_FLOAT	(arith)4
 #define	SZ_FLOAT	(arith)4
 #define	SZ_DOUBLE	(arith)8
 #define	SZ_DOUBLE	(arith)8
+#endif NOFLOAT
 #define	SZ_POINTER	(arith)4
 #define	SZ_POINTER	(arith)4
 
 
 /* target machine alignment requirements	*/
 /* target machine alignment requirements	*/
@@ -76,8 +78,10 @@
 #define AL_WORD		SZ_WORD
 #define AL_WORD		SZ_WORD
 #define	AL_INT		SZ_WORD
 #define	AL_INT		SZ_WORD
 #define	AL_LONG		SZ_WORD
 #define	AL_LONG		SZ_WORD
+#ifndef NOFLOAT
 #define	AL_FLOAT	SZ_WORD
 #define	AL_FLOAT	SZ_WORD
 #define	AL_DOUBLE	SZ_WORD
 #define	AL_DOUBLE	SZ_WORD
+#endif NOFLOAT
 #define	AL_POINTER	SZ_WORD
 #define	AL_POINTER	SZ_WORD
 #define AL_STRUCT	1
 #define AL_STRUCT	1
 #define AL_UNION	1
 #define AL_UNION	1

+ 4 - 1
lang/cem/cemcom/align.h

@@ -3,7 +3,10 @@
 
 
 extern int
 extern int
 	short_align, word_align, int_align, long_align,
 	short_align, word_align, int_align, long_align,
-	float_align, double_align, pointer_align,
+#ifndef NOFLOAT
+	float_align, double_align,
+#endif NOFLOAT
+	pointer_align,
 	struct_align, union_align;
 	struct_align, union_align;
 
 
 extern arith align();
 extern arith align();

+ 12 - 0
lang/cem/cemcom/arith.c

@@ -36,6 +36,7 @@ arithbalance(e1p, oper, e2p)	/* RM 6.6 */
 	t2 = any2arith(e2p, oper);
 	t2 = any2arith(e2p, oper);
 
 
 	/* Now t1 and t2 are either INT or LONG or DOUBLE */
 	/* Now t1 and t2 are either INT or LONG or DOUBLE */
+#ifndef NOFLOAT
 	if (t1 == DOUBLE && t2 != DOUBLE)
 	if (t1 == DOUBLE && t2 != DOUBLE)
 		t2 = int2float(e2p, double_type);
 		t2 = int2float(e2p, double_type);
 	else
 	else
@@ -44,6 +45,7 @@ arithbalance(e1p, oper, e2p)	/* RM 6.6 */
 	else
 	else
 	if (t1 == DOUBLE)
 	if (t1 == DOUBLE)
 		return DOUBLE;
 		return DOUBLE;
+#endif NOFLOAT
 
 
 	/* Now they are INT or LONG */
 	/* Now they are INT or LONG */
 	u1 = (*e1p)->ex_type->tp_unsigned;
 	u1 = (*e1p)->ex_type->tp_unsigned;
@@ -148,11 +150,13 @@ any2arith(expp, oper)
 			expr_warning(*expp, "%s on enum", symbol2str(oper));
 			expr_warning(*expp, "%s on enum", symbol2str(oper));
 		int2int(expp, int_type);
 		int2int(expp, int_type);
 		break;
 		break;
+#ifndef NOFLOAT
 	case FLOAT:
 	case FLOAT:
 		float2float(expp, double_type);
 		float2float(expp, double_type);
 		break;
 		break;
 	case DOUBLE:
 	case DOUBLE:
 		break;
 		break;
+#endif NOFLOAT
 #ifndef NOBITFIELD
 #ifndef NOBITFIELD
 	case FIELD:
 	case FIELD:
 		field2arith(expp);
 		field2arith(expp);
@@ -220,6 +224,7 @@ int2int(expp, tp)
 	return (*expp)->ex_type->tp_fund;
 	return (*expp)->ex_type->tp_fund;
 }
 }
 
 
+#ifndef NOFLOAT
 int
 int
 int2float(expp, tp)
 int2float(expp, tp)
 	struct expr **expp;
 	struct expr **expp;
@@ -262,6 +267,7 @@ float2float(expp, tp)
 	else
 	else
 		*expp = arith2arith(tp, FLOAT2FLOAT, *expp);
 		*expp = arith2arith(tp, FLOAT2FLOAT, *expp);
 }
 }
+#endif NOFLOAT
 
 
 array2pointer(expp)
 array2pointer(expp)
 	struct expr **expp;
 	struct expr **expp;
@@ -337,8 +343,10 @@ opnd2logical(expp, oper)
 	case LONG:
 	case LONG:
 	case ENUM:
 	case ENUM:
 	case POINTER:
 	case POINTER:
+#ifndef NOFLOAT
 	case FLOAT:
 	case FLOAT:
 	case DOUBLE:
 	case DOUBLE:
+#endif NOFLOAT
 		break;
 		break;
 	default:
 	default:
 		expr_error(*expp, "%s operand to %s",
 		expr_error(*expp, "%s operand to %s",
@@ -429,7 +437,9 @@ any2opnd(expp, oper)
 	case CHAR:
 	case CHAR:
 	case SHORT:
 	case SHORT:
 	case ENUM:
 	case ENUM:
+#ifndef NOFLOAT
 	case FLOAT:
 	case FLOAT:
+#endif NOFLOAT
 		any2arith(expp, oper);
 		any2arith(expp, oper);
 		break;
 		break;
 	case ARRAY:
 	case ARRAY:
@@ -477,6 +487,7 @@ field2arith(expp)
 }
 }
 #endif NOBITFIELD
 #endif NOBITFIELD
 
 
+#ifndef NOFLOAT
 /*	switch_sign_fp() negates the given floating constant expression
 /*	switch_sign_fp() negates the given floating constant expression
 	The lexical analyser has reserved an extra byte of space in front
 	The lexical analyser has reserved an extra byte of space in front
 	of the string containing the representation of the floating
 	of the string containing the representation of the floating
@@ -491,3 +502,4 @@ switch_sign_fp(expr)
 	else
 	else
 		--(expr->FL_VALUE);
 		--(expr->FL_VALUE);
 }
 }
+#endif NOFLOAT

+ 7 - 0
lang/cem/cemcom/ch7.c

@@ -222,6 +222,7 @@ ch7cast(expp, oper, tp)
 					symbol2str(oper));
 					symbol2str(oper));
 			int2int(expp, tp);
 			int2int(expp, tp);
 		}
 		}
+#ifndef NOFLOAT
 		else
 		else
 		if (oldi && !i)	{
 		if (oldi && !i)	{
 			if (oldtp->tp_fund == ENUM && oper != CAST)
 			if (oldtp->tp_fund == ENUM && oper != CAST)
@@ -235,6 +236,10 @@ ch7cast(expp, oper, tp)
 			float2int(expp, tp);
 			float2int(expp, tp);
 		else		/* !oldi && !i */
 		else		/* !oldi && !i */
 			float2float(expp, tp);
 			float2float(expp, tp);
+#else NOFLOAT
+		else
+			crash("(ch7cast) floats not implemented\n");
+#endif NOFLOAT
 	}
 	}
 	else
 	else
 	if (oldtp->tp_fund == POINTER && tp->tp_fund == POINTER)	{
 	if (oldtp->tp_fund == POINTER && tp->tp_fund == POINTER)	{
@@ -404,8 +409,10 @@ is_arith_type(tp)
 	case INT:
 	case INT:
 	case LONG:
 	case LONG:
 	case ENUM:
 	case ENUM:
+#ifndef NOFLOAT
 	case FLOAT:
 	case FLOAT:
 	case DOUBLE:
 	case DOUBLE:
+#endif NOFLOAT
 		return 1;
 		return 1;
 #ifndef NOBITFIELD
 #ifndef NOBITFIELD
 	case FIELD:
 	case FIELD:

+ 2 - 0
lang/cem/cemcom/ch7bin.c

@@ -314,11 +314,13 @@ pointer_arithmetic(expp1, oper, expp2)
 	/*	prepares the integral expression expp2 in order to
 	/*	prepares the integral expression expp2 in order to
 		apply it to the pointer expression expp1
 		apply it to the pointer expression expp1
 	*/
 	*/
+#ifndef NOFLOAT
 	if (any2arith(expp2, oper) == DOUBLE)	{
 	if (any2arith(expp2, oper) == DOUBLE)	{
 		expr_error(*expp2,
 		expr_error(*expp2,
 			"illegal combination of float and pointer");
 			"illegal combination of float and pointer");
 		erroneous2int(expp2);
 		erroneous2int(expp2);
 	}
 	}
+#endif NOFLOAT
 	ch7bin( expp2, '*',
 	ch7bin( expp2, '*',
 		intexpr(size_of_type((*expp1)->ex_type->tp_up, "object"),
 		intexpr(size_of_type((*expp1)->ex_type->tp_up, "object"),
 			pa_type->tp_fund)
 			pa_type->tp_fund)

+ 4 - 0
lang/cem/cemcom/ch7mon.c

@@ -88,6 +88,7 @@ ch7mon(oper, expp)
 		}
 		}
 		break;
 		break;
 	case '~':
 	case '~':
+#ifndef NOFLOAT
 	{
 	{
 		int fund = (*expp)->ex_type->tp_fund;
 		int fund = (*expp)->ex_type->tp_fund;
 
 
@@ -102,6 +103,7 @@ ch7mon(oper, expp)
 		}
 		}
 		/* FALLTHROUGH */
 		/* FALLTHROUGH */
 	}
 	}
+#endif NOFLOAT
 	case '-':
 	case '-':
 		any2arith(expp, oper);
 		any2arith(expp, oper);
 		if (is_cp_cst(*expp))	{
 		if (is_cp_cst(*expp))	{
@@ -114,9 +116,11 @@ ch7mon(oper, expp)
 			  );
 			  );
 		}
 		}
 		else
 		else
+#ifndef NOFLOAT
 		if (is_fp_cst(*expp))
 		if (is_fp_cst(*expp))
 			switch_sign_fp(*expp);
 			switch_sign_fp(*expp);
 		else
 		else
+#endif NOFLOAT
 			*expp = new_oper((*expp)->ex_type,
 			*expp = new_oper((*expp)->ex_type,
 					NILEXPR, oper, *expp);
 					NILEXPR, oper, *expp);
 		break;
 		break;

+ 4 - 0
lang/cem/cemcom/code.c

@@ -32,7 +32,9 @@
 static struct stmt_block *stmt_stack;
 static struct stmt_block *stmt_stack;
 
 
 char *symbol2str();
 char *symbol2str();
+#ifndef NOFLOAT
 int fp_used;
 int fp_used;
+#endif NOFLOAT
 label lab_count = 1;
 label lab_count = 1;
 label datlab_count = 1;
 label datlab_count = 1;
 
 
@@ -254,11 +256,13 @@ end_proc(fbytes, nbytes)
 		else
 		else
 			C_ret(ATW(func_tp->tp_size));
 			C_ret(ATW(func_tp->tp_size));
 	}
 	}
+#ifndef NOFLOAT
 	if (fp_used && mes_flt_given == 0)	{
 	if (fp_used && mes_flt_given == 0)	{
 		/* floating point used	*/
 		/* floating point used	*/
 		C_ms_flt();
 		C_ms_flt();
 		mes_flt_given++;
 		mes_flt_given++;
 	}
 	}
+#endif NOFLOAT
 	C_ms_par(fbytes);		/* # bytes for formals		*/
 	C_ms_par(fbytes);		/* # bytes for formals		*/
 	if (sp_occurred[SP_SETJMP]) {	/* indicate use of "setjmp"	*/
 	if (sp_occurred[SP_SETJMP]) {	/* indicate use of "setjmp"	*/
 		C_ms_gto();
 		C_ms_gto();

+ 10 - 0
lang/cem/cemcom/conversion.c

@@ -9,7 +9,9 @@
 
 
 #define	T_SIGNED		1
 #define	T_SIGNED		1
 #define	T_UNSIGNED		2
 #define	T_UNSIGNED		2
+#ifndef NOFLOAT
 #define	T_FLOATING		3
 #define	T_FLOATING		3
+#endif NOFLOAT
 
 
 /*	conversion() generates the EM code for a conversion between
 /*	conversion() generates the EM code for a conversion between
 	the types char, short, int, long, float, double and pointer.
 	the types char, short, int, long, float, double and pointer.
@@ -51,11 +53,13 @@ conversion(from_type, to_type)
 			C_ciu();
 			C_ciu();
 			break;
 			break;
 
 
+#ifndef NOFLOAT
 		case T_FLOATING:
 		case T_FLOATING:
 			C_loc(from_size < word_size ? word_size : from_size);
 			C_loc(from_size < word_size ? word_size : from_size);
 			C_loc(to_size < word_size ? word_size : to_size);
 			C_loc(to_size < word_size ? word_size : to_size);
 			C_cif();
 			C_cif();
 			break;
 			break;
+#endif NOFLOAT
 		}
 		}
 		break;
 		break;
 
 
@@ -73,12 +77,15 @@ conversion(from_type, to_type)
 			C_cuu();
 			C_cuu();
 			break;
 			break;
 
 
+#ifndef NOFLOAT
 		case T_FLOATING:
 		case T_FLOATING:
 			C_cuf();
 			C_cuf();
 			break;
 			break;
+#endif NOFLOAT
 		}
 		}
 		break;
 		break;
 
 
+#ifndef NOFLOAT
 	case T_FLOATING:
 	case T_FLOATING:
 		C_loc(from_size < word_size ? word_size : from_size);
 		C_loc(from_size < word_size ? word_size : from_size);
 		C_loc(to_size < word_size ? word_size : to_size);
 		C_loc(to_size < word_size ? word_size : to_size);
@@ -98,6 +105,7 @@ conversion(from_type, to_type)
 			break;
 			break;
 		}
 		}
 		break;
 		break;
+#endif NOFLOAT
 	default:
 	default:
 		crash("(conversion) illegal type conversion");
 		crash("(conversion) illegal type conversion");
 	}
 	}
@@ -120,9 +128,11 @@ fundamental(tp)
 	case ENUM:
 	case ENUM:
 		return tp->tp_unsigned ? T_UNSIGNED : T_SIGNED;
 		return tp->tp_unsigned ? T_UNSIGNED : T_SIGNED;
 
 
+#ifndef NOFLOAT
 	case FLOAT:
 	case FLOAT:
 	case DOUBLE:
 	case DOUBLE:
 		return T_FLOATING;
 		return T_FLOATING;
+#endif NOFLOAT
 
 
 	case POINTER:	/* pointer : signed / unsigned	???	*/
 	case POINTER:	/* pointer : signed / unsigned	???	*/
 		return T_SIGNED;
 		return T_SIGNED;

+ 6 - 2
lang/cem/cemcom/decspecs.c

@@ -52,15 +52,19 @@ do_decspecs(ds)
 	case SHORT:
 	case SHORT:
 		if (tp == int_type)
 		if (tp == int_type)
 			tp = short_type;
 			tp = short_type;
-		else	error("short with illegal type");
+		else
+			error("short with illegal type");
 		break;
 		break;
 	case LONG:
 	case LONG:
 		if (tp == int_type)
 		if (tp == int_type)
 			tp = long_type;
 			tp = long_type;
 		else
 		else
+#ifndef NOFLOAT
 		if (tp == float_type)
 		if (tp == float_type)
 			tp = double_type;
 			tp = double_type;
-		else	error("long with illegal type");
+		else
+#endif NOFLOAT
+			error("long with illegal type");
 		break;
 		break;
 	}
 	}
 	if (ds->ds_unsigned)	{
 	if (ds->ds_unsigned)	{

+ 4 - 0
lang/cem/cemcom/dumpidf.c

@@ -327,7 +327,9 @@ p1_expr(lvl, expr)
 		expr->ex_depth,
 		expr->ex_depth,
 		expr->ex_class == Value ? "Value" :
 		expr->ex_class == Value ? "Value" :
 		expr->ex_class == String ? "String" :
 		expr->ex_class == String ? "String" :
+#ifndef NOFLOAT
 		expr->ex_class == Float ? "Float" :
 		expr->ex_class == Float ? "Float" :
+#endif NOFLOAT
 		expr->ex_class == Oper ? "Oper" :
 		expr->ex_class == Oper ? "Oper" :
 		expr->ex_class == Type ? "Type" : "UNKNOWN CLASS"
 		expr->ex_class == Type ? "Type" : "UNKNOWN CLASS"
 	);
 	);
@@ -361,9 +363,11 @@ p1_expr(lvl, expr)
 		);
 		);
 		break;
 		break;
 	}
 	}
+#ifndef NOFLOAT
 	case Float:
 	case Float:
 		print("%s\n", expr->FL_VALUE);
 		print("%s\n", expr->FL_VALUE);
 		break;
 		break;
+#endif NOFLOAT
 	case Oper:
 	case Oper:
 		o = &expr->ex_object.ex_oper;
 		o = &expr->ex_object.ex_oper;
 		print("\n");
 		print("\n");

+ 30 - 18
lang/cem/cemcom/eval.c

@@ -91,6 +91,7 @@ EVAL(expr, val, code, true_label, false_label)
 			C_lae_dlb(expr->VL_LBL, expr->VL_VALUE);
 			C_lae_dlb(expr->VL_LBL, expr->VL_VALUE);
 		}
 		}
 		break;
 		break;
+#ifndef NOFLOAT
 	case Float:	/* a floating constant	*/
 	case Float:	/* a floating constant	*/
 		if (gencode) {
 		if (gencode) {
 			label datlab = data_label();
 			label datlab = data_label();
@@ -101,6 +102,7 @@ EVAL(expr, val, code, true_label, false_label)
 			C_loi(expr->ex_type->tp_size);
 			C_loi(expr->ex_type->tp_size);
 		}
 		}
 		break;
 		break;
+#endif NOFLOAT
 	case Oper:	/* compound expression	*/
 	case Oper:	/* compound expression	*/
 	{
 	{
 		register int oper = expr->OP_OPER;
 		register int oper = expr->OP_OPER;
@@ -131,9 +133,11 @@ EVAL(expr, val, code, true_label, false_label)
 				case POINTER:
 				case POINTER:
 					C_ads(rightop->ex_type->tp_size);
 					C_ads(rightop->ex_type->tp_size);
 					break;
 					break;
+#ifndef NOFLOAT
 				case DOUBLE:
 				case DOUBLE:
 					C_adf(tp->tp_size);
 					C_adf(tp->tp_size);
 					break;
 					break;
+#endif NOFLOAT
 				default:
 				default:
 					crash("bad type +");
 					crash("bad type +");
 				}
 				}
@@ -144,14 +148,16 @@ EVAL(expr, val, code, true_label, false_label)
 				EVAL(rightop, RVAL, code, NO_LABEL, NO_LABEL);
 				EVAL(rightop, RVAL, code, NO_LABEL, NO_LABEL);
 				if (gencode) {
 				if (gencode) {
 					switch (tp->tp_fund)	{
 					switch (tp->tp_fund)	{
-					case DOUBLE:
-						C_ngf(tp->tp_size);
-						break;
 					case INT:
 					case INT:
 					case LONG:
 					case LONG:
 					case POINTER:
 					case POINTER:
 						C_ngi(tp->tp_size);
 						C_ngi(tp->tp_size);
 						break;
 						break;
+#ifndef NOFLOAT
+					case DOUBLE:
+						C_ngf(tp->tp_size);
+						break;
+#endif NOFLOAT
 					default:
 					default:
 						CRASH();
 						CRASH();
 					}
 					}
@@ -183,9 +189,11 @@ EVAL(expr, val, code, true_label, false_label)
 					C_ads(rightop->ex_type->tp_size);
 					C_ads(rightop->ex_type->tp_size);
 				}
 				}
 				break;
 				break;
+#ifndef NOFLOAT
 			case DOUBLE:
 			case DOUBLE:
 				C_sbf(tp->tp_size);
 				C_sbf(tp->tp_size);
 				break;
 				break;
+#endif NOFLOAT
 			default:
 			default:
 				crash("bad type -");
 				crash("bad type -");
 			}
 			}
@@ -206,9 +214,11 @@ EVAL(expr, val, code, true_label, false_label)
 						else
 						else
 							C_mli(tp->tp_size);
 							C_mli(tp->tp_size);
 						break;
 						break;
+#ifndef NOFLOAT
 					case DOUBLE:
 					case DOUBLE:
 						C_mlf(double_size);
 						C_mlf(double_size);
 						break;
 						break;
+#endif NOFLOAT
 					default:
 					default:
 						crash("bad type *");
 						crash("bad type *");
 					}
 					}
@@ -227,9 +237,11 @@ EVAL(expr, val, code, true_label, false_label)
 					else
 					else
 						C_dvi(tp->tp_size);
 						C_dvi(tp->tp_size);
 					break;
 					break;
+#ifndef NOFLOAT
 				case DOUBLE:
 				case DOUBLE:
 					C_dvf(double_size);
 					C_dvf(double_size);
 					break;
 					break;
+#endif NOFLOAT
 				default:
 				default:
 					crash("bad type /");
 					crash("bad type /");
 				}
 				}
@@ -237,17 +249,13 @@ EVAL(expr, val, code, true_label, false_label)
 		case '%':
 		case '%':
 			EVAL(leftop, RVAL, code, NO_LABEL, NO_LABEL);
 			EVAL(leftop, RVAL, code, NO_LABEL, NO_LABEL);
 			EVAL(rightop, RVAL, code, NO_LABEL, NO_LABEL);
 			EVAL(rightop, RVAL, code, NO_LABEL, NO_LABEL);
-			if (gencode)
-				if (	tp->tp_fund == INT
-				||	tp->tp_fund == LONG
-				)	{
-					if (tp->tp_unsigned)
-						C_rmu(tp->tp_size);
-					else
-						C_rmi(tp->tp_size);
-				}
+			ASSERT(tp->tp_fund==INT || tp->tp_fund==LONG);
+			if (gencode) {
+				if (tp->tp_unsigned)
+					C_rmu(tp->tp_size);
 				else
 				else
-					crash("bad type %%");
+					C_rmi(tp->tp_size);
+			}
 			break;
 			break;
 		case LEFT:
 		case LEFT:
 			EVAL(leftop, RVAL, code, NO_LABEL, NO_LABEL);
 			EVAL(leftop, RVAL, code, NO_LABEL, NO_LABEL);
@@ -287,10 +295,12 @@ EVAL(expr, val, code, true_label, false_label)
 					else
 					else
 						C_cmi(size);
 						C_cmi(size);
 					break;
 					break;
-				case FLOAT:
+#ifndef NOFLOAT
+				case FLOAT: /* thought they were converted??? */
 				case DOUBLE:
 				case DOUBLE:
 					C_cmf(size);
 					C_cmf(size);
 					break;
 					break;
+#endif NOFLOAT
 				case POINTER:
 				case POINTER:
 					C_cmp();
 					C_cmp();
 					break;
 					break;
@@ -553,12 +563,10 @@ EVAL(expr, val, code, true_label, false_label)
 
 
 			EVAL(leftop, RVAL, TRUE, l_true, l_false);
 			EVAL(leftop, RVAL, TRUE, l_true, l_false);
 			C_df_ilb(l_true);
 			C_df_ilb(l_true);
-			EVAL(rightop->OP_LEFT, RVAL, code,
-						NO_LABEL, NO_LABEL);
+			EVAL(rightop->OP_LEFT, RVAL, code, NO_LABEL, NO_LABEL);
 			C_bra(l_end);
 			C_bra(l_end);
 			C_df_ilb(l_false);
 			C_df_ilb(l_false);
-			EVAL(rightop->OP_RIGHT, RVAL, code,
-						NO_LABEL, NO_LABEL);
+			EVAL(rightop->OP_RIGHT, RVAL, code, NO_LABEL, NO_LABEL);
 			C_df_ilb(l_end);
 			C_df_ilb(l_end);
 			break;
 			break;
 		}
 		}
@@ -655,9 +663,11 @@ EVAL(expr, val, code, true_label, false_label)
 								true_label);
 								true_label);
 			break;
 			break;
 		case INT2INT:
 		case INT2INT:
+#ifndef NOFLOAT
 		case INT2FLOAT:
 		case INT2FLOAT:
 		case FLOAT2INT:
 		case FLOAT2INT:
 		case FLOAT2FLOAT:
 		case FLOAT2FLOAT:
+#endif NOFLOAT
 			EVAL(rightop, RVAL, code, NO_LABEL, NO_LABEL);
 			EVAL(rightop, RVAL, code, NO_LABEL, NO_LABEL);
 			if (gencode)
 			if (gencode)
 				conversion(rightop->ex_type, leftop->ex_type);
 				conversion(rightop->ex_type, leftop->ex_type);
@@ -784,6 +794,7 @@ assop(type, oper)
 			break;
 			break;
 		}
 		}
 		break;
 		break;
+#ifndef NOFLOAT
 	case FLOAT:
 	case FLOAT:
 	case DOUBLE:
 	case DOUBLE:
 		switch (oper)	{
 		switch (oper)	{
@@ -805,6 +816,7 @@ assop(type, oper)
 			break;
 			break;
 		}
 		}
 		break;
 		break;
+#endif NOFLOAT
 	case POINTER:
 	case POINTER:
 		if (oper == MINAB || oper == MINMIN || oper == POSTDECR)
 		if (oper == MINAB || oper == MINMIN || oper == POSTDECR)
 			C_ngi(size);
 			C_ngi(size);

+ 7 - 3
lang/cem/cemcom/expr.c

@@ -134,9 +134,11 @@ dot2expr(expp)
 	case INTEGER:
 	case INTEGER:
 		int2expr(*expp);
 		int2expr(*expp);
 		break;
 		break;
+#ifndef NOFLOAT
 	case FLOATING:
 	case FLOATING:
 		float2expr(*expp);
 		float2expr(*expp);
 		break;
 		break;
+#endif NOFLOAT
 	default:
 	default:
 		crash("bad conversion to expression");
 		crash("bad conversion to expression");
 		break;
 		break;
@@ -224,6 +226,7 @@ int2expr(expr)
 	fill_int_expr(expr, dot.tk_ival, dot.tk_fund);
 	fill_int_expr(expr, dot.tk_ival, dot.tk_fund);
 }
 }
 
 
+#ifndef NOFLOAT
 float2expr(expr)
 float2expr(expr)
 	struct expr *expr;
 	struct expr *expr;
 {
 {
@@ -235,6 +238,7 @@ float2expr(expr)
 	expr->FL_VALUE = dot.tk_fval;
 	expr->FL_VALUE = dot.tk_fval;
 	expr->FL_DATLAB = 0;
 	expr->FL_DATLAB = 0;
 }
 }
+#endif NOFLOAT
 
 
 struct expr*
 struct expr*
 intexpr(ivalue, fund)
 intexpr(ivalue, fund)
@@ -408,10 +412,8 @@ chk_cst_expr(expp)
 			expr_warning(expr,
 			expr_warning(expr,
 				"expression comma in constant expression");
 				"expression comma in constant expression");
 	}
 	}
-	
-	if (err) {
+	if (err)
 		erroneous2int(expp);
 		erroneous2int(expp);
-	}
 }
 }
 
 
 init_expression(eppp, expr)
 init_expression(eppp, expr)
@@ -453,6 +455,7 @@ is_cp_cst(expr)
 	return is_ld_cst(expr) && expr->VL_CLASS == Const;
 	return is_ld_cst(expr) && expr->VL_CLASS == Const;
 }
 }
 
 
+#ifndef NOFLOAT
 int
 int
 is_fp_cst(expr)
 is_fp_cst(expr)
 	register struct expr *expr;
 	register struct expr *expr;
@@ -462,6 +465,7 @@ is_fp_cst(expr)
 	*/
 	*/
 	return expr->ex_class == Float;
 	return expr->ex_class == Float;
 }
 }
+#endif NOFLOAT
 
 
 free_expression(expr)
 free_expression(expr)
 	struct expr *expr;
 	struct expr *expr;

+ 8 - 0
lang/cem/cemcom/expr.str

@@ -25,10 +25,12 @@ struct string	{
 	label sg_datlab;	/* global data-label			*/
 	label sg_datlab;	/* global data-label			*/
 };
 };
 
 
+#ifndef NOFLOAT
 struct floating	{
 struct floating	{
 	char *fl_value;		/* pointer to string repr. the fp const. */
 	char *fl_value;		/* pointer to string repr. the fp const. */
 	label fl_datlab;	/* global data_label	*/
 	label fl_datlab;	/* global data_label	*/
 };
 };
+#endif NOFLOAT
 
 
 struct oper	{
 struct oper	{
 	struct type *op_type;	/* resulting type of the operation	*/
 	struct type *op_type;	/* resulting type of the operation	*/
@@ -40,7 +42,9 @@ struct oper	{
 /* The following constants indicate the class of the expression: */
 /* The following constants indicate the class of the expression: */
 #define	Value	0		/* it is a value known at load time */
 #define	Value	0		/* it is a value known at load time */
 #define	String	1		/* it is a string constant  */
 #define	String	1		/* it is a string constant  */
+#ifndef NOFLOAT
 #define	Float	2		/* it is a floating point constant	*/
 #define	Float	2		/* it is a floating point constant	*/
+#endif NOFLOAT
 #define	Oper	3		/* it is a run-time expression */
 #define	Oper	3		/* it is a run-time expression */
 #define	Type	4		/* only its type is relevant */
 #define	Type	4		/* only its type is relevant */
 
 
@@ -56,7 +60,9 @@ struct expr	{
 	union	{
 	union	{
 		struct value ex_value;
 		struct value ex_value;
 		struct string ex_string;
 		struct string ex_string;
+#ifndef NOFLOAT
 		struct floating ex_float;
 		struct floating ex_float;
+#endif NOFLOAT
 		struct oper ex_oper;
 		struct oper ex_oper;
 	} ex_object;
 	} ex_object;
 };
 };
@@ -69,8 +75,10 @@ struct expr	{
 #define	SG_VALUE	ex_object.ex_string.sg_value
 #define	SG_VALUE	ex_object.ex_string.sg_value
 #define SG_LEN		ex_object.ex_string.sg_len
 #define SG_LEN		ex_object.ex_string.sg_len
 #define	SG_DATLAB	ex_object.ex_string.sg_datlab
 #define	SG_DATLAB	ex_object.ex_string.sg_datlab
+#ifndef NOFLOAT
 #define	FL_VALUE	ex_object.ex_float.fl_value
 #define	FL_VALUE	ex_object.ex_float.fl_value
 #define	FL_DATLAB	ex_object.ex_float.fl_datlab
 #define	FL_DATLAB	ex_object.ex_float.fl_datlab
+#endif NOFLOAT
 #define	OP_TYPE		ex_object.ex_oper.op_type
 #define	OP_TYPE		ex_object.ex_oper.op_type
 #define	OP_LEFT		ex_object.ex_oper.op_left
 #define	OP_LEFT		ex_object.ex_oper.op_left
 #define	OP_OPER		ex_object.ex_oper.op_oper
 #define	OP_OPER		ex_object.ex_oper.op_oper

+ 2 - 0
lang/cem/cemcom/idf.c

@@ -210,9 +210,11 @@ declare_idf(ds, dc, lvl)
 			type = construct_type(POINTER, type->tp_up, (arith)0);
 			type = construct_type(POINTER, type->tp_up, (arith)0);
 			formal_array = 1;
 			formal_array = 1;
 			break;
 			break;
+#ifndef NOFLOAT
 		case FLOAT:	/* RM 10.1	*/
 		case FLOAT:	/* RM 10.1	*/
 			type = double_type;
 			type = double_type;
 			break;
 			break;
+#endif NOFLOAT
 		case CHAR:
 		case CHAR:
 		case SHORT:
 		case SHORT:
 			/*	The RM is not clear about this: we must
 			/*	The RM is not clear about this: we must

+ 4 - 0
lang/cem/cemcom/ival.c

@@ -383,10 +383,12 @@ pad(tp)
 	case POINTER:
 	case POINTER:
 		C_con_ucon("0",  tp->tp_size);
 		C_con_ucon("0",  tp->tp_size);
 		break;
 		break;
+#ifndef NOFLOAT
 	case FLOAT:
 	case FLOAT:
 	case DOUBLE:
 	case DOUBLE:
 		C_con_fcon("0", tp->tp_size);
 		C_con_fcon("0", tp->tp_size);
 		break;
 		break;
+#endif NOFLOAT
 	case UNION:
 	case UNION:
 		error("initialisation of unions not allowed");
 		error("initialisation of unions not allowed");
 		break;
 		break;
@@ -448,6 +450,7 @@ check_ival(ex, tp)
 			C_con_dlb(ex->VL_LBL, ex->VL_VALUE);
 			C_con_dlb(ex->VL_LBL, ex->VL_VALUE);
 		}
 		}
 		break;
 		break;
+#ifndef NOFLOAT
 	case FLOAT:
 	case FLOAT:
 	case DOUBLE:
 	case DOUBLE:
 		ch7cast(&ex, '=', tp);
 		ch7cast(&ex, '=', tp);
@@ -471,6 +474,7 @@ check_ival(ex, tp)
 		else
 		else
 			illegal_init_cst(ex);
 			illegal_init_cst(ex);
 		break;
 		break;
+#endif NOFLOAT
 
 
 #ifndef NOBITFIELD
 #ifndef NOBITFIELD
 	case FIELD:
 	case FIELD:

+ 10 - 0
lang/cem/cemcom/main.c

@@ -48,8 +48,10 @@ arith
 	dword_size = (2 * SZ_WORD),
 	dword_size = (2 * SZ_WORD),
 	int_size = SZ_INT,
 	int_size = SZ_INT,
 	long_size = SZ_LONG,
 	long_size = SZ_LONG,
+#ifndef NOFLOAT
 	float_size = SZ_FLOAT,
 	float_size = SZ_FLOAT,
 	double_size = SZ_DOUBLE,
 	double_size = SZ_DOUBLE,
+#endif NOFLOAT
 	pointer_size = SZ_POINTER;
 	pointer_size = SZ_POINTER;
 
 
 int
 int
@@ -57,8 +59,10 @@ int
 	word_align = AL_WORD,
 	word_align = AL_WORD,
 	int_align = AL_INT,
 	int_align = AL_INT,
 	long_align = AL_LONG,
 	long_align = AL_LONG,
+#ifndef NOFLOAT
 	float_align = AL_FLOAT,
 	float_align = AL_FLOAT,
 	double_align = AL_DOUBLE,
 	double_align = AL_DOUBLE,
+#endif NOFLOAT
 	pointer_align = AL_POINTER,
 	pointer_align = AL_POINTER,
 	struct_align = AL_STRUCT,
 	struct_align = AL_STRUCT,
 	union_align = AL_UNION;
 	union_align = AL_UNION;
@@ -237,8 +241,10 @@ init()
 	long_type = standard_type(LONG, 0, long_align, long_size);
 	long_type = standard_type(LONG, 0, long_align, long_size);
 	ulong_type = standard_type(LONG, UNSIGNED, long_align, long_size);
 	ulong_type = standard_type(LONG, UNSIGNED, long_align, long_size);
 
 
+#ifndef NOFLOAT
 	float_type = standard_type(FLOAT, 0, float_align, float_size);
 	float_type = standard_type(FLOAT, 0, float_align, float_size);
 	double_type = standard_type(DOUBLE, 0, double_align, double_size);
 	double_type = standard_type(DOUBLE, 0, double_align, double_size);
+#endif NOFLOAT
 	void_type = standard_type(VOID, 0, 0, (arith)0);
 	void_type = standard_type(VOID, 0, 0, (arith)0);
 	label_type = standard_type(LABEL, 0, 0, (arith)0);
 	label_type = standard_type(LABEL, 0, 0, (arith)0);
 	error_type = standard_type(ERRONEOUS, 0, 1, (arith)1);
 	error_type = standard_type(ERRONEOUS, 0, 1, (arith)1);
@@ -274,8 +280,10 @@ init()
 	/* Define the standard type identifiers. */
 	/* Define the standard type identifiers. */
 	add_def(str2idf("char"), TYPEDEF, char_type, L_UNIVERSAL);
 	add_def(str2idf("char"), TYPEDEF, char_type, L_UNIVERSAL);
 	add_def(str2idf("int"), TYPEDEF, int_type, L_UNIVERSAL);
 	add_def(str2idf("int"), TYPEDEF, int_type, L_UNIVERSAL);
+#ifndef NOFLOAT
 	add_def(str2idf("float"), TYPEDEF, float_type, L_UNIVERSAL);
 	add_def(str2idf("float"), TYPEDEF, float_type, L_UNIVERSAL);
 	add_def(str2idf("double"), TYPEDEF, double_type, L_UNIVERSAL);
 	add_def(str2idf("double"), TYPEDEF, double_type, L_UNIVERSAL);
+#endif NOFLOAT
 	add_def(str2idf("void"), TYPEDEF, void_type, L_UNIVERSAL);
 	add_def(str2idf("void"), TYPEDEF, void_type, L_UNIVERSAL);
 	stack_level();
 	stack_level();
 }
 }
@@ -350,9 +358,11 @@ preprocess()
 		case INTEGER:
 		case INTEGER:
 			print("%ld ", dot.tk_ival);
 			print("%ld ", dot.tk_ival);
 			break;
 			break;
+#ifndef NOFLOAT
 		case FLOATING:
 		case FLOATING:
 			print("%s ", dot.tk_fval);
 			print("%s ", dot.tk_fval);
 			break;
 			break;
+#endif NOFLOAT
 		case EOI:
 		case EOI:
 		case EOF:
 		case EOF:
 			return;
 			return;

+ 4 - 0
lang/cem/cemcom/options.c

@@ -200,16 +200,20 @@ do_option(text)
 					long_align = align;
 					long_align = align;
 				break;
 				break;
 			case 'f':	/* float	*/
 			case 'f':	/* float	*/
+#ifndef NOFLOAT
 				if (size != (arith)0)
 				if (size != (arith)0)
 					float_size = size;
 					float_size = size;
 				if (align != 0)
 				if (align != 0)
 					float_align = align;
 					float_align = align;
+#endif NOFLOAT
 				break;
 				break;
 			case 'd':	/* double	*/
 			case 'd':	/* double	*/
+#ifndef NOFLOAT
 				if (size != (arith)0)
 				if (size != (arith)0)
 					double_size = size;
 					double_size = size;
 				if (align != 0)
 				if (align != 0)
 					double_align = align;
 					double_align = align;
+#endif NOFLOAT
 				break;
 				break;
 			case 'p':	/* pointer	*/
 			case 'p':	/* pointer	*/
 				if (size != (arith)0)
 				if (size != (arith)0)

+ 4 - 1
lang/cem/cemcom/sizes.h

@@ -3,6 +3,9 @@
 
 
 extern arith
 extern arith
 	short_size, word_size, dword_size, int_size, long_size,
 	short_size, word_size, dword_size, int_size, long_size,
-	float_size, double_size, pointer_size;
+#ifndef NOFLOAT
+	float_size, double_size,
+#endif NOFLOAT
+	pointer_size;
 
 
 extern arith max_int, max_unsigned;	/* cstoper.c	*/
 extern arith max_int, max_unsigned;	/* cstoper.c	*/

+ 2 - 0
lang/cem/cemcom/stack.c

@@ -128,10 +128,12 @@ unstack_level()
 					case POINTER:
 					case POINTER:
 						reg = reg_pointer;
 						reg = reg_pointer;
 						break;
 						break;
+#ifndef NOFLOAT
 					case FLOAT:
 					case FLOAT:
 					case DOUBLE:
 					case DOUBLE:
 						reg = reg_float;
 						reg = reg_float;
 						break;
 						break;
+#endif NOFLOAT
 					default:
 					default:
 						reg = reg_any;
 						reg = reg_any;
 						break;
 						break;

+ 2 - 0
lang/cem/cemcom/switch.c

@@ -49,10 +49,12 @@ code_startswitch(expp)
 			warning("long in switch (cast to int)");
 			warning("long in switch (cast to int)");
 		int2int(expp, int_type);
 		int2int(expp, int_type);
 		break;
 		break;
+#ifndef NOFLOAT
 	case DOUBLE:
 	case DOUBLE:
 		error("float/double in switch");
 		error("float/double in switch");
 		erroneous2int(expp);
 		erroneous2int(expp);
 		break;
 		break;
+#endif NOFLOAT
 	}
 	}
 	
 	
 	stack_stmt(l_break, NO_LABEL);
 	stack_stmt(l_break, NO_LABEL);

+ 2 - 0
lang/cem/cemcom/type.c

@@ -26,7 +26,9 @@ struct type
 	*word_type, *uword_type,
 	*word_type, *uword_type,
 	*int_type, *uint_type,
 	*int_type, *uint_type,
 	*long_type, *ulong_type,
 	*long_type, *ulong_type,
+#ifndef NOFLOAT
 	*float_type, *double_type,
 	*float_type, *double_type,
+#endif NOFLOAT
 	*void_type, *label_type,
 	*void_type, *label_type,
 	*string_type, *funint_type, *error_type;
 	*string_type, *funint_type, *error_type;
 
 

+ 2 - 0
lang/cem/cemcom/type.str

@@ -33,7 +33,9 @@ extern struct type
 	*word_type, *uword_type,
 	*word_type, *uword_type,
 	*int_type, *uint_type,
 	*int_type, *uint_type,
 	*long_type, *ulong_type,
 	*long_type, *ulong_type,
+#ifndef NOFLOAT
 	*float_type, *double_type,
 	*float_type, *double_type,
+#endif NOFLOAT
 	*void_type, *label_type,
 	*void_type, *label_type,
 	*string_type, *funint_type, *error_type;
 	*string_type, *funint_type, *error_type;