This commit is contained in:
Léonard Gérard 2011-02-07 16:06:52 +01:00
parent d9ed1de9c5
commit c677f76009
2 changed files with 9 additions and 8 deletions

View file

@ -59,7 +59,7 @@ and vd_list s1 s2 s3 ff vd_l = match vd_l with
| _ -> fprintf ff "@[<v>%a@]@\n" (print_list_r (var_dec true) s1 s2 s3) vd_l
and field ff f =
fprintf ff "@[<2>%a%a%a%a %a%a;@]"
fprintf ff "@[<2>%a%a%a%a %a%a@]"
protection f.f_protection
static f.f_static
final f.f_final
@ -148,15 +148,15 @@ and act ff = function
exp e
(print_list_r pcb """""") c_b_l
| Aif (e,bt) ->
fprintf ff "@[<hv 2>if (%a) {@ %a@ }@]" exp e block bt
fprintf ff "@[<hv>@[<hv 2>if (%a) {@ %a@]@ }@]" exp e block bt
| Aifelse (e,bt,bf) ->
fprintf ff "@[<hv 2>if (%a) {@ %a@ }@]@\n@[<hv 2>else {@ %a@ }@]"
fprintf ff "@[<hv>@[<hv 2>if (%a) {@ %a@ @]}@\n@[<hv 2>else {@ %a@]@ }@]"
exp e
block bt
block bf
| Ablock b -> fprintf ff "@[<v2>{@ %a@ }]" block b
| Afor (x, i1, i2, b) ->
fprintf ff "@[<hv 2>for (%a = %a; %a<%a; %a++) {@ %a@ }@]"
fprintf ff "@[<hv>@[<hv 2>for (%a = %a; %a<%a; %a++) {@ %a@]@ }@]"
(var_dec false) x
exp i1
var_ident x.vd_ident
@ -172,7 +172,7 @@ let methode ff m =
ty m.m_returns
method_name m.m_name
(print_list_r (var_dec false) """,""") m.m_args
(print_list_r class_name "throws "",""") m.m_throws
(print_list_r class_name "throws "","" ") m.m_throws
block m.m_body
let constructor ff m =

View file

@ -33,6 +33,7 @@ let import_async = [Names.qualname_of_string "java.util.concurrent.Future";
let throws_async = [Names.qualname_of_string "InterruptedException";
Names.qualname_of_string "ExecutionException"]
let mk_classe = mk_classe ~imports:import_async
(** Additional classes created during the translation *)
@ -335,12 +336,12 @@ let create_async_classe async base_classe =
let body =
let act = Areturn (Emethod_call (Eval (Pthis id_inst), "step", exps_step)) in
mk_block [act]
in mk_methode ~returns:ty_result body "call"
in mk_methode ~throws:throws_async ~returns:ty_result body "call"
in mk_classe ~protection:Pprotected ~static:true ~fields:fields ~implements:[java_callable]
~constrs:[constructor] ~methodes:[call] callable_classe_name
in
mk_classe ~imports:import_async ~fields:fields ~constrs:[constructor]
mk_classe ~fields:fields ~constrs:[constructor]
~methodes:[step;reset] ~classes:[callable_class] classe_name
@ -419,7 +420,7 @@ let class_def_list classes cd_l =
let body = block param_env oreset.Obc.m_body in
mk_methode body "reset"
in
let classe = mk_classe ~imports:import_async ~fields:fields
let classe = mk_classe ~fields:fields
~constrs:[constructeur] ~methodes:[step;reset] class_name in
classe::classes
in