[m-rev.] for review: java as foreign and target language
Andre Yang
ayang at rationalizer.com
Tue Mar 12 03:57:43 AEDT 2002
Estimated hours taken: 18
The java language is added to the foreign language family and to the target
language family.
compiler/globals.m:
Adds java support to the 'convert_foreign_language_2/2'.
compiler/prog_io_pragma.m:
Adds java support to 'check_required_attributes/3'.
compiler/mlds_to_ilasm.m:
Adds java support for 'handle_foreign_lang/3'.
compiler/mlds_to_il.m:
Adds java support for 'atomic_statement_to_il/2.
compiler/mlds_to_c.m:
Adds java support for 'mlds_output_c_defn/2'.
compiler/mercury_compile.m:
Adds java support for 'make_foreign_import_header_code/2'.
compiler/foreign.m:
add java support for 'extrude_pragma_implementation_2/6'
and 'make_pred_name_rest/2'
and 'foreign_language_string/1'
and 'simple_foreign_language_string'
and 'foreign_language_file_extension/1'
and 'to_type_string/2'.
compiler/prog_data.m
add java to type foreign_language
compiler/mlds.m
add java to type target_lang
Index: mercury/compiler/globals.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/globals.m,v
retrieving revision 1.48
diff -u -u -r1.48 globals.m
--- mercury/compiler/globals.m 19 Feb 2002 06:21:43 -0000 1.48
+++ mercury/compiler/globals.m 6 Mar 2002 16:01:10 -0000
@@ -221,6 +221,7 @@
convert_foreign_language_2("csharp", csharp).
convert_foreign_language_2("c sharp", csharp).
convert_foreign_language_2("il", il).
+convert_foreign_language_2("java", java).
convert_gc_method("none", none).
convert_gc_method("conservative", conservative).
Index: mercury/compiler/prog_io_pragma.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_pragma.m,v
retrieving revision 1.47
diff -u -u -r1.47 prog_io_pragma.m
--- mercury/compiler/prog_io_pragma.m 19 Feb 2002 09:48:21 -0000 1.47
+++ mercury/compiler/prog_io_pragma.m 6 Mar 2002 16:01:19 -0000
@@ -1193,6 +1193,7 @@
check_required_attributes(c, Attrs, _Term) = ok(Attrs).
check_required_attributes(managed_cplusplus, Attrs, _Term) = ok(Attrs).
check_required_attributes(csharp, Attrs, _Term) = ok(Attrs).
+check_required_attributes(java, Attrs, _Term) = ok(Attrs).
check_required_attributes(il, Attrs, Term) = Res :-
( [] = list__filter_map(
(func(X) = X is semidet :- X = max_stack_size(_)),
Index: mercury/compiler/mlds_to_ilasm.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_ilasm.m,v
retrieving revision 1.16
diff -u -u -r1.16 mlds_to_ilasm.m
--- mercury/compiler/mlds_to_ilasm.m 18 Jul 2001 10:20:56 -0000 1.16
+++ mercury/compiler/mlds_to_ilasm.m 6 Mar 2002 16:01:52 -0000
@@ -85,6 +85,8 @@
sorry(this_file, "language C foreign code not supported").
handle_foreign_lang(il, _, _) :-
sorry(this_file, "language IL foreign code not supported").
+handle_foreign_lang(java, _, _) :-
+ sorry(this_file, "language Java foreign code not supported").
%
% Generate the `.il' file.
Index: mercury/compiler/mlds_to_il.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.107
diff -u -u -r1.107 mlds_to_il.m
--- mercury/compiler/mlds_to_il.m 5 Mar 2002 15:30:14 -0000 1.107
+++ mercury/compiler/mlds_to_il.m 6 Mar 2002 16:02:22 -0000
@@ -1922,6 +1922,8 @@
{ unexpected(this_file, "lang_GNU_C") }.
atomic_statement_to_il(inline_target_code(lang_C_minus_minus, _), _) -->
{ unexpected(this_file, "lang_C_minus_minus") }.
+atomic_statement_to_il(inline_target_code(lang_java, _), _) -->
+ { unexpected(this_file, "lang_java") }.
atomic_statement_to_il(trail_op(_), node(Instrs)) -->
Index: mercury/compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.121
diff -u -u -r1.121 mlds_to_c.m
--- mercury/compiler/mlds_to_c.m 27 Feb 2002 13:56:58 -0000 1.121
+++ mercury/compiler/mlds_to_c.m 6 Mar 2002 16:02:46 -0000
@@ -592,6 +592,8 @@
{ sorry(this_file, "foreign code other than C") }.
mlds_output_c_defn(_Indent, user_foreign_code(il, _, _)) -->
{ sorry(this_file, "foreign code other than C") }.
+mlds_output_c_defn(_Indent, user_foreign_code(java, _, _)) -->
+ { sorry(this_file, "foreign code other than C") }.
:- pred mlds_output_pragma_export_decl(mlds_module_name, indent,
mlds__pragma_export, io__state, io__state).
Index: mercury/compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.237
diff -u -u -r1.237 mercury_compile.m
--- mercury/compiler/mercury_compile.m 3 Mar 2002 13:43:44 -0000 1.237
+++ mercury/compiler/mercury_compile.m 6 Mar 2002 16:03:17 -0000
@@ -3156,6 +3156,9 @@
;
{ Lang = il },
{ error("sorry, not yet implemented: `:- pragma foreign_import_module' for IL") }
+ ;
+ { Lang = java },
+ { error("sorry, not yet implemented: `:- pragma foreign_import_module' for Java") }
).
:- pred get_c_body_code(foreign_body_info, list(user_foreign_code)).
Index: mercury/compiler/foreign.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/foreign.m,v
retrieving revision 1.10
diff -u -u -r1.10 foreign.m
--- mercury/compiler/foreign.m 16 Jan 2002 01:13:18 -0000 1.10
+++ mercury/compiler/foreign.m 6 Mar 2002 16:07:25 -0000
@@ -296,6 +296,9 @@
extrude_pragma_implementation_2(c, il, _, _, _, _) :-
unimplemented_combination(c, il).
+extrude_pragma_implementation_2(c, java, _, _, _, _) :-
+ unimplemented_combination(c, java).
+
extrude_pragma_implementation_2(c, c, ModuleInfo, Impl, ModuleInfo, Impl).
@@ -313,6 +316,8 @@
extrude_pragma_implementation_2(managed_cplusplus, il, _, _, _, _) :-
unimplemented_combination(managed_cplusplus, il).
+extrude_pragma_implementation_2(managed_cplusplus, java, _, _, _, _) :-
+ unimplemented_combination(managed_cplusplus, java).
extrude_pragma_implementation_2(csharp, csharp,
@@ -327,6 +332,9 @@
extrude_pragma_implementation_2(csharp, il, _, _, _, _) :-
unimplemented_combination(csharp, il).
+extrude_pragma_implementation_2(csharp, java, _, _, _, _) :-
+ unimplemented_combination(csharp, java).
+
extrude_pragma_implementation_2(il, il,
ModuleInfo, Impl, ModuleInfo, Impl).
@@ -340,6 +348,25 @@
extrude_pragma_implementation_2(il, csharp, _, _, _, _) :-
unimplemented_combination(il, csharp).
+extrude_pragma_implementation_2(il, java, _, _, _, _) :-
+ unimplemented_combination(il, java).
+
+
+extrude_pragma_implementation_2(java, java,
+ ModuleInfo, Impl, ModuleInfo, Impl).
+
+extrude_pragma_implementation_2(java, c, _, _, _, _) :-
+ unimplemented_combination(java, c).
+
+extrude_pragma_implementation_2(java, managed_cplusplus, _, _, _, _) :-
+ unimplemented_combination(java, managed_cplusplus).
+
+extrude_pragma_implementation_2(java, csharp, _, _, _, _) :-
+ unimplemented_combination(java, csharp).
+
+extrude_pragma_implementation_2(java, il , _, _, _, _) :-
+ unimplemented_combination(java, il).
+
:- pred unimplemented_combination(foreign_language::in, foreign_language::in)
@@ -364,6 +391,7 @@
make_pred_name_rest(managed_cplusplus, unqualified(Name)) = Name.
make_pred_name_rest(csharp, _SymName) = "some_csharp_name".
make_pred_name_rest(il, _SymName) = "some_il_name".
+make_pred_name_rest(java, _SymName) = "some_java_name".
make_pragma_import(PredInfo, ProcInfo, C_Function, Context,
@@ -542,16 +570,19 @@
foreign_language_string(managed_cplusplus) = "Managed C++".
foreign_language_string(csharp) = "C#".
foreign_language_string(il) = "IL".
+foreign_language_string(java) = "Java".
simple_foreign_language_string(c) = "c".
simple_foreign_language_string(managed_cplusplus) = "cpp". % XXX mcpp is better
simple_foreign_language_string(csharp) = "csharp".
simple_foreign_language_string(il) = "il".
+simple_foreign_language_string(java) = "java".
foreign_language_file_extension(c) = ".c".
foreign_language_file_extension(managed_cplusplus) = ".cpp".
foreign_language_file_extension(csharp) = ".cs".
foreign_language_file_extension(il) = _ :- fail.
+foreign_language_file_extension(java) = _ :- fail.
foreign_language_module_name(M, L) = FM :-
@@ -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,6 +660,8 @@
).
to_type_string(il, mercury(_Type)) = _ :-
sorry(this_file, "to_type_string for il").
+to_type_string(java, mercury(_Type)) = _ :-
+ sorry(this_file, "to_type_string for java").
%-----------------------------------------------------------------------------%
Index: mercury/compiler/prog_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.79
diff -u -u -r1.79 prog_data.m
--- mercury/compiler/prog_data.m 26 Feb 2002 02:45:49 -0000 1.79
+++ mercury/compiler/prog_data.m 6 Mar 2002 16:08:02 -0000
@@ -112,7 +112,7 @@
% ; cplusplus
; csharp
; managed_cplusplus
-% ; java
+ ; java
; il
.
Index: mercury/compiler/mlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds.m,v
retrieving revision 1.85
diff -u -u -r1.85 mlds.m
--- mercury/compiler/mlds.m 3 Mar 2002 17:27:08 -0000 1.85
+++ mercury/compiler/mlds.m 6 Mar 2002 16:08:38 -0000
@@ -1249,6 +1249,7 @@
; lang_il
; lang_java_asm
; lang_java_bytecode
+ ; lang_java
.
:- type target_code_componen
--------------------------------------------------------------------------
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