[m-dev.] diff: including autoconfigured grade options in .c files

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon May 3 10:45:00 AEST 1999


compiler/llds_out.m:
	Put the values of the autoconfigured grade options into the comment
	we generate at the top of every .c file. We should be able to use this
	info to avoid removing all the .c files when rerunning configure
	on alphas.

Zoltan.

cvs diff: Diffing .
Index: llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.109
diff -u -b -u -r1.109 llds_out.m
--- llds_out.m	1999/04/30 08:23:49	1.109
+++ llds_out.m	1999/04/30 08:27:06
@@ -289,14 +289,7 @@
 		{ Result = ok }
 	->
 		{ library__version(Version) },
-		io__write_strings(
-			["/*\n",
-			"** Automatically generated from `", SourceFileName,
-				"' by the Mercury compiler,\n",
-			"** version ", Version, ".\n",
-			"** Do not edit.\n",
-			"*/\n"]),
-
+		output_c_file_intro_and_grade(SourceFileName, Version),
 		output_init_comment(ModuleName),
 		output_c_file_mercury_headers,
 		io__write_string("\n"),
@@ -326,6 +319,35 @@
 		io__write_string("#include ""mercury_imp.h""\n")
 	).
 
+:- pred output_c_file_intro_and_grade(string, string, io__state, io__state).
+:- mode output_c_file_intro_and_grade(in, in, di, uo) is det.
+
+output_c_file_intro_and_grade(SourceFileName, Version) -->
+	globals__io_lookup_int_option(num_tag_bits, NumTagBits),
+	{ string__int_to_string(NumTagBits, NumTagBitsStr) },
+	globals__io_lookup_bool_option(unboxed_float, UnboxedFloat),
+	{ convert_bool_to_string(UnboxedFloat, UnboxedFloatStr) },
+
+	io__write_strings(["/*\n",
+		"** Automatically generated from `", SourceFileName,
+			"' by the Mercury compiler,\n",
+		"** version ", Version, ".\n",
+		"** The autoconfigured grade settings governing\n",
+		"** the generation of this C file were\n",
+		"**\n",
+		"** TAG_BITS=", NumTagBitsStr, "\n",
+		"** UNBOXED_FLOAT=", UnboxedFloatStr, "\n",
+		"**\n",
+		"** END_OF_C_GRADE_INFO\n",
+		"** Do not edit.\n*/\n"
+	]).
+
+:- pred convert_bool_to_string(bool, string).
+:- mode convert_bool_to_string(in, out) is det.
+
+convert_bool_to_string(no, "no").
+convert_bool_to_string(yes, "yes").
+
 :- pred output_single_c_file(c_file, maybe(int), set_bbbtree(label),
 	maybe(rl_file), io__state, io__state).
 :- mode output_single_c_file(in, in, in, in, di, uo) is det.
@@ -345,13 +367,7 @@
 	->
 		{ library__version(Version) },
 		module_name_to_file_name(ModuleName, ".m", no, SourceFileName),
-		io__write_strings(
-			["/*\n",
-			"** Automatically generated from `", SourceFileName,
-				"' by the Mercury compiler,\n",
-			"** version ", Version, ".\n",
-			"** Do not edit.\n",
-			"*/\n"]),
+		output_c_file_intro_and_grade(SourceFileName, Version),
 		( { SplitFiles = yes(_) } ->
 			[]
 		;
cvs diff: Diffing notes
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list