[m-dev.] diff: move code from rl_code.m to bytecode_data.m

Simon Taylor stayl at cs.mu.OZ.AU
Tue Jul 13 13:23:31 AEST 1999



Estimated hours taken: 0.2

compiler/rl_code.m:
compiler/bytecode_data.m:
	Move code to convert a string to a list of bytes from
	rl_code.m to be near similar code for ints and floats
	in bytecode_data.m.

	Remove some unnecessary module imports.


Index: bytecode_data.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/bytecode_data.m,v
retrieving revision 1.4
diff -u -u -r1.4 bytecode_data.m
--- bytecode_data.m	1999/05/27 23:55:16	1.4
+++ bytecode_data.m	1999/07/13 01:21:29
@@ -23,6 +23,9 @@
 :- pred output_string(string, io__state, io__state).
 :- mode output_string(in, di, uo) is det.
 
+:- pred string_to_byte_list(string, list(int)).
+:- mode string_to_byte_list(in, out) is det.
+
 :- pred output_byte(int, io__state, io__state).
 :- mode output_byte(in, di, uo) is det.
 
@@ -75,11 +78,17 @@
 
 :- implementation.
 
-:- import_module require.
+:- import_module char, require.
 
 output_string(Val) -->
 	io__write_bytes(Val),
 	io__write_byte(0).
+
+string_to_byte_list(Val, List) :-
+	string__to_char_list(Val, Chars),
+	ToInt = (pred(C::in, I::out) is det :- char__to_int(C, I)),
+	list__map(ToInt, Chars, List0),
+	list__append(List0, [0], List).
 
 output_byte(Val) -->
 	( { Val < 256 } ->
Index: rl_code.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/rl_code.m,v
retrieving revision 1.5
diff -u -u -r1.5 rl_code.m
--- rl_code.m	1999/06/23 02:41:14	1.5
+++ rl_code.m	1999/07/13 02:35:23
@@ -5,7 +5,7 @@
 %-----------------------------------------------------------------------------%
 % Do not edit - this file was automatically generated by
 % $ADITI_ROOT/src/rosi/create_rl_code_m.
-% Created Wed Jun 23 12:31:39 1999
+% Created Tue Jul 13 12:35:22 1999
 
 %-----------------------------------------------------------------------------%
 :- module rl_code.
@@ -13,7 +13,7 @@
 %-----------------------------------------------------------------------------%
 :- interface.
 
-:- import_module int, list, string.
+:- import_module list.
 
 :- type int32		==	int.
 
@@ -424,8 +424,6 @@
 :- implementation.
 
 :- import_module bytecode_data.
-:- import_module int, string, char, bool, std_util.
-:- import_module term, varset.
 
 %-----------------------------------------------------------------------------%
 
@@ -1668,10 +1666,7 @@
 	short_to_byte_list(X, List).
 
 aString_to_bytecode(Str, Ints) :-
-	string__to_char_list(Str, Chars),
-	ToInt = lambda([C::in, I::out] is det, char__to_int(C, I)),
-	list__map(ToInt, Chars, Ints0),
-	list__append(Ints0, [0], Ints).
+	string_to_byte_list(Str, Ints).
 
 aDouble_to_bytecode(Flt, List) :-
 	float_to_byte_list(Flt, List).
--------------------------------------------------------------------------
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