[m-dev.] diff: bootstrap the none.gc.debug grade

Peter Ross peter.ross at miscrit.be
Mon Aug 14 18:58:57 AEST 2000


Hi,


===================================================================


Estimated hours taken: 2

Bootstrap the none.gc.debug grade using MSVC as the C compiler.

compiler/c_util.m:
	Avoid a limitation in MSVC where string literals are not allowed
	to be longer then 2048 chars.
	Error C2026 is now avoided by instead of outputing a string as 
	"a very long string" chunk it up into "a very " "long string"
	where each chunk is 512 characters long.
    Redefine c_util__output_quoted_string to call
    c_util__output_quoted_multi_string to avoid some code duplication.

compiler/llds_out.m:
	The definitions of any types used in the module need to be
	output before they are used, so output them first.


Index: compiler/c_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/c_util.m,v
retrieving revision 1.3
diff -u -r1.3 c_util.m
--- compiler/c_util.m	2000/05/09 11:23:20	1.3
+++ compiler/c_util.m	2000/08/14 08:44:49
@@ -145,17 +145,7 @@
 %-----------------------------------------------------------------------------%
 
 c_util__output_quoted_string(S0) -->
-	( { string__first_char(S0, Char, S1) } ->
-		( { c_util__quote_char(Char, QuoteChar) } ->
-			io__write_char('\\'),
-			io__write_char(QuoteChar)
-		;
-			io__write_char(Char)
-		),
-		c_util__output_quoted_string(S1)
-	;
-		[]
-	).
+	c_util__output_quoted_multi_string(string__length(S0), S0).
 
 c_util__output_quoted_multi_string(Len, S) -->
 	c_util__output_quoted_multi_string_2(0, Len, S).
@@ -165,6 +155,17 @@
 
 c_util__output_quoted_multi_string_2(Cur, Len, S) -->
 	( { Cur < Len } ->
+			% Avoid a limitation in the MSVC compiler where
+			% string literals can be no longer then 2048
+			% chars.  However if you output the string in
+			% chunks, eg "part a" "part b" it will accept a
+			% string longer then 2048 chars, go figure!
+		( { Cur \= 0, Cur mod 512 = 0 } ->
+			io__write_string("\" \"")
+		;
+			[]
+		),
+
 			% we must use unsafe index, because we want to be able
 			% to access chars beyond the first NUL
 		{ string__unsafe_index(S, Cur, Char) },
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.149
diff -u -r1.149 llds_out.m
--- compiler/llds_out.m	2000/08/11 08:19:09	1.149
+++ compiler/llds_out.m	2000/08/14 08:44:56
@@ -486,10 +486,10 @@
 
 		{ gather_c_file_labels(Modules, Labels) },
 		{ decl_set_init(DeclSet0) },
+		output_c_data_type_def_list(Datas, DeclSet0, DeclSet1),
 		output_c_label_decl_list(Labels, StackLayoutLabels,
-			DeclSet0, DeclSet1),
-		output_comp_gen_c_var_list(Vars, DeclSet1, DeclSet2),
-		output_c_data_type_def_list(Datas, DeclSet2, DeclSet3),
+			DeclSet1, DeclSet2),
+		output_comp_gen_c_var_list(Vars, DeclSet2, DeclSet3),
 		output_comp_gen_c_data_list(Datas, DeclSet3, DeclSet4),
 		output_comp_gen_c_module_list(Modules, StackLayoutLabels,
 			DeclSet4, _DeclSet),

--------------------------------------------------------------------------
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