From a4fc53764f1d6b7ecf1a1c89b3a069f4947f6364 Mon Sep 17 00:00:00 2001 From: Mamadou Ndiaye <ndiaye@malaval.imag.fr> Date: Fri, 19 Jun 2015 10:34:29 +0200 Subject: [PATCH] -kcg: OK for abstract types and functions and extern nodes --- src/licDump.ml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/licDump.ml b/src/licDump.ml index 8efdfd4d..581a5fc1 100644 --- a/src/licDump.ml +++ b/src/licDump.ml @@ -615,7 +615,16 @@ and (string_of_node_def : Lic.node_def -> string list) = (* exported *) and (type_decl: Lv6Id.long -> Lic.type_ -> string) = - fun tname teff -> + fun tname teff -> if global_opt.kcg then + match teff with + | Enum_type_eff (_) -> + "type " ^ (dump_long tname) ^ " = " ^ (string_def_of_type_eff teff) ^ ";\n" + | External_type_eff (_) + | Abstract_type_eff(_,External_type_eff (_)) -> "type imported " ^ (dump_long tname) ^ ";\n" + | _ -> "type " ^ (dump_long tname) ^ " = " ^ (string_def_of_type_eff teff) ^ ";\n" + + + else "type " ^ (dump_long tname) ^ (match teff with | Enum_type_eff (_) -> @@ -655,8 +664,8 @@ and node_of_node_exp_eff (neff: Lic.node_exp): string = ( if neff.is_safe_eff then "" else "unsafe " )^( - if neff.def_eff = ExternLic && not (global_opt.lv4) - (* no extern kwd in v4... *) + if neff.def_eff = ExternLic && not (global_opt.lv4) && not (global_opt.kcg) + (* no extern kwd in v4 and in "scade"... *) then "extern " else "" )^( if global_opt.lv4 || global_opt.kcg then ( @@ -665,6 +674,11 @@ and node_of_node_exp_eff (neff: Lic.node_exp): string = ) else ( if neff.has_mem_eff then "node " else "function " ) + )^(if global_opt.kcg then + if neff.def_eff = ExternLic + then "imported " else "" + else "" + )^( if global_opt.kcg then string_of_node_key_rec (not global_opt.no_prefix) neff.node_key_eff @@ -683,7 +697,7 @@ and node_of_node_exp_eff (neff: Lic.node_exp): string = (string_of_node_key_def neff.node_key_eff)^ (";\n") ) - | AbstractLic _ -> ";\n" + | AbstractLic _ -> "; \n" | BodyLic _ -> ( (if global_opt.kcg then "\n" else ";\n") ^ (match neff.loclist_eff with -- GitLab