[m-rev.] for review: Add java support for the function foreign__to_type_string/2

Andre Yang ayang at rationalizer.com
Tue Mar 12 04:18:42 AEDT 2002


Hi, 

============================================================
Estimated hours taken: 2

Adds the support for java in the function foreign__to_type_string/2.

foreign.m:
	Adds the support for java in the function to_type_string/2.

Index: compiler/foreign.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/foreign.m,v
retrieving revision 1.10
diff -u -u -r1.10 foreign.m
--- compiler/foreign.m	16 Jan 2002 01:13:18 -0000	1.10
+++ compiler/foreign.m	11 Mar 2002 16:33:28 -0000
@@ -601,6 +632,8 @@
 	sym_name_to_string(ForeignType, "::", Result).
 to_type_string(il, foreign(ForeignType)) = Result :-
 	sym_name_to_string(ForeignType, ".", Result).
+to_type_string(java, foreign(ForeignType)) = Result :-
+	sym_name_to_string(ForeignType, ".", Result).
 
 	% XXX does this do the right thing for high level data?
 to_type_string(c, mercury(Type)) = Result :-
@@ -627,7 +660,18 @@
 	).
 to_type_string(il, mercury(_Type)) = _ :-
 	sorry(this_file, "to_type_string for il").
-	
+to_type_string(java, mercury(Type)) = Result :-
+	( Type = term__functor(term__atom("int"), [], _) ->
+		Result = "int"
+	; Type = term__functor(term__atom("float"), [], _) ->
+		Result = "double"
+	; Type = term__functor(term__atom("string"), [], _) ->
+		Result = "String"
+	; Type = term__functor(term__atom("character"), [], _) ->
+		Result = "char"
+	;
+		Result = "Object"
+	).	
 %-----------------------------------------------------------------------------%
 
 :- func this_file = string.


--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list