diff --git a/.gitignore b/.gitignore index 851359aabb93c7e63502da1b740da02e53368e6a..e87f1c7e1b6674ea2a4b90b88c4b1b7612edf733 100644 --- a/.gitignore +++ b/.gitignore @@ -177,3 +177,4 @@ Makefile.version *.cmx *.cmxs *.o +*.bak \ No newline at end of file diff --git a/bin/main.ml b/bin/main.ml index 96243c5282d55085daecb6ef34c4774e38c3ab07..0388a4e0e8f0c02255b9b76b1d35bff7a8e4da2c 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 29/08/2019 (at 17:07) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/03/2020 (at 11:45) by Erwan Jahier> *) open AstV6 open Lxm @@ -40,19 +40,19 @@ let find_a_node opt = let (gen_rif_interface : LicPrg.t -> Lv6Id.idref option -> Lv6MainArgs.t -> unit) = - fun lic_prg main_node opt -> + fun lic_prg main_node opt -> let nk = match main_node with | None -> ( - let name = find_a_node opt in - let main_node = Lv6Id.to_idref name in - let nk = (Lic.node_key_of_idref main_node) in - if LicPrg.node_exists lic_prg nk then nk else ( - output_string opt.oc ("Error: no node is specified.\nbye\n"); - flush opt.oc; - my_exit opt 2 + let name = find_a_node opt in + let main_node = Lv6Id.to_idref name in + let nk = (Lic.node_key_of_idref main_node) in + if LicPrg.node_exists lic_prg nk then nk else ( + output_string opt.oc ("Error: no node is specified.\nbye\n"); + flush opt.oc; + my_exit opt 2 + ) ) - ) | Some main_node -> Lic.node_key_of_idref main_node in let invars,outvars = @@ -61,9 +61,12 @@ let (gen_rif_interface : LicPrg.t -> Lv6Id.idref option -> Lv6MainArgs.t -> unit | Some node_def -> Lic2soc.soc_profile_of_node node_def in let my_type_to_string t = - let str = Data.type_to_string t in - let idref = Lv6Id.idref_of_string str in - (idref.Lv6Id.id_id) + match t with + | Data.Extern _ -> "string" (* what else can i do with extern type for RIF? *) + | _ -> + let str = Data.type_to_string t in + let idref = Lv6Id.idref_of_string str in + (idref.Lv6Id.id_id) in let invars = SocVar.expand_profile true false invars in let outvars = SocVar.expand_profile true false outvars in @@ -254,7 +257,7 @@ let main () = ( let main_node = if opt.main_node = "" then None else Some (Lv6Id.idref_of_string opt.main_node) in - if opt.outfile <> "" then opt.oc <- open_out opt.outfile; + if opt.outfile <> "" then opt.oc <- open_out opt.outfile; (try ( let nsl = Lv6Compile.get_source_list opt opt.infiles in let lic_prg = Lv6Compile.doit opt nsl main_node in diff --git a/bin/soc2c.ml b/bin/soc2c.ml index dd94a6e65f2fae53418c7d67378077216985b2fa..214e3773a8c58fbb52a8217e884929105ad2e54b 100644 --- a/bin/soc2c.ml +++ b/bin/soc2c.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 14/02/2020 (at 14:03) by Erwan Jahier> *) +(* Time-stamp: <modified the 13/03/2020 (at 11:44) by Erwan Jahier> *) (* let put (os: out_channel) (fmt:('a, unit, string, unit) format4) : 'a = *) @@ -9,17 +9,18 @@ open Soc2cIdent open Data -let rec (type_to_string2 : Data.t -> string) = +let rec (type_to_string_rif : Data.t -> string) = fun v -> let str = match v with + | String -> "string" | Bool -> "bool" | Int -> "int" | Real -> "real" - | Extern s -> id2s s + | Extern _s -> (* view extern type as strings *) "string" (*id2s s*) | Enum (s, _sl) -> id2s s | Struct (sid,_) -> (id2s sid) - | Array (ty, sz) -> Printf.sprintf "%s_%d" (type_to_string2 ty) sz + | Array (ty, sz) -> Printf.sprintf "%s_%d" (type_to_string_rif ty) sz | Alpha nb -> "alpha_"^(string_of_int nb) | Alias(n,_) -> n in @@ -300,9 +301,9 @@ let (soc2c : int -> out_channel -> out_channel -> Soc.tbl -> Soc.key -> hfmt "#endif /* _%s_H_FILE */" base; close_out hfile; close_out cfile; - Printf.printf "%s.h has been generated.\n" base; - Printf.printf "%s.c has been generated.\n" base; - flush stdout + Printf.eprintf "W: %s.h has been generated.\n" base; + Printf.eprintf "W: %s.c has been generated.\n" base; + flush stderr ); cfiles_acc ) @@ -310,10 +311,11 @@ let (soc2c : int -> out_channel -> out_channel -> Soc.tbl -> Soc.key -> (****************************************************************************) let (type_to_format_string : Data.t -> string) = function + | String -> "%s" | Bool -> "%d" | Int -> "%d" | Real-> "%f" - | Extern _s -> "%d" + | Extern _s -> "%s" | Enum (_s, _sl) -> "%d" | Struct (_sid,_) -> "%s" | Array (_ty, _sz) -> "%s" @@ -606,17 +608,16 @@ int main(){" ^ (gen_main_loop_body inputs outputs soc ctx)); " ); ); - Printf.printf "%s has been generated.\n" mainfile; flush stdout; + Printf.eprintf "W: %s has been generated.\n" mainfile; flush stderr; close_out oc -let (gen_loop_file : LicPrg.t -> Soc.t -> string -> out_channel -> Soc.tbl -> unit) = - fun licprg soc base oc stbl -> +let (gen_loop_file : string -> LicPrg.t -> Soc.t -> string -> out_channel -> Soc.tbl + -> unit) = + fun fn licprg soc base oc stbl -> let putc s = output_string oc s in let ctx = get_ctx_name soc.key in let step = Soc2cDep.step_name soc.key "step" in - let (n,_,_) = soc.key in - let n = id2s n in let inputs,outputs = soc.profile in let inputs_io = SocVar.expand_profile true false inputs in let outputs_io = SocVar.expand_profile true false outputs in @@ -730,6 +731,27 @@ _real _get_real("^( } while(s != 1); return r; } +char* _get_string("^( + if SocUtils.is_memory_less soc then "" else + ctx^"_type* ctx," + ) ^"char* n){ + char b[512]; + char* r; + int s = 1; + do { + if(ISATTY) { + if(s != 1) printf(\"\\a\"); + //printf(\"%s (real) ? \", n); + } + if(scanf(\"%s\", b)==EOF) exit(0); + if(*b == '#') { + _read_pragma("^ + (if SocUtils.is_memory_less soc then "" else "ctx,")^"b); + } + } while(s != 1); + r = b; + return r; +} /* Standard Output procedures **************/ void _put_bottom(char* n){ if(ISATTY) printf(\"%s = \", n); @@ -750,17 +772,20 @@ void _put_real(char* n, _real _V){ if(ISATTY) printf(\"%s = \", n); printf(\"%f \", _V); if(ISATTY) printf(\"\\n\"); -}"^(Soc2cExtern.gen_getters licprg)^" +} +void _put_string(char* n, char* _V){ + if(ISATTY) printf(\"%s = \", n); + printf(\"%s \", _V); + if(ISATTY) printf(\"\\n\"); +} +"^(Soc2cExtern.gen_getters fn licprg soc)^" /* Output procedures **********************/ #ifdef CKCHECK void %s_BOT_n(void* cdata){ _put_bottom(\"n\"); } #endif -/* Output procedures **********************/ -void "^n^"_O_n(void* cdata, _integer _V) { - _put_int(\"n\", _V); -}"^ (gen_memoryless_ctx stbl) ^ +"^ (gen_memoryless_ctx stbl) ^ " /* Main procedure *************************/ int main(){ @@ -768,7 +793,7 @@ int main(){ (gen_main_loop_body inputs outputs soc ctx) ) ); - let to_rif_decl (n,t) = ("\\\""^n^"\\\":" ^(type_to_string t)) in + let to_rif_decl (n,t) = ("\\\""^n^"\\\":" ^(type_to_string_rif t)) in let inputs_t = List.map to_rif_decl inputs_io in let outputs_t = List.map to_rif_decl outputs_io in let inputs_decl = Printf.sprintf "#inputs %s" (String.concat " " inputs_t) in @@ -787,7 +812,7 @@ int main(){ ++_s; "); List.iter (fun (id,t) -> - let t = type_to_string2 t in + let t = type_to_string_rif t in let clk = "" in (* XXX finish me: get the clock if id using soc.clock_profile and set this string to something like "if (clk_id)" *) @@ -978,7 +1003,7 @@ typedef float _float; gen_main_wcet_file main_soc base stbl ) else - gen_loop_file licprg main_soc base ocl stbl; + gen_loop_file loopfile licprg main_soc base ocl stbl; output_string och " #include <stdlib.h> @@ -1009,7 +1034,7 @@ typedef float _float; puth "/////////////////////////////////////////////////\n"; if assign_ext_types_list <> [] then ( - output_string types_h_oc "// Defining array and extern types assignments \n"; + output_string types_h_oc "\n// Defining array and extern types assignments \n"; if Lv6MainArgs.global_opt.Lv6MainArgs.gen_wcet then List.iter (fun t -> output_string types_h_oc (Soc2cGenAssign.f_forloop t)) assign_ext_types_list @@ -1023,10 +1048,10 @@ typedef float _float; flush ocl; close_out ocl; flush consts_h_oc; close_out consts_h_oc; flush consts_c_oc; close_out consts_c_oc; - Printf.printf "%s has been generated.\n" loopfile; - Printf.printf "%s has been generated.\n" hfile; - Printf.printf "%s has been generated.\n" cfile; - flush stdout; + Printf.eprintf "W: %s has been generated.\n" loopfile; + Printf.eprintf "W: %s has been generated.\n" hfile; + Printf.eprintf "W: %s has been generated.\n" cfile; + flush stderr; let node = if args.Lv6MainArgs.main_node <> "" then args.Lv6MainArgs.main_node else Filename.basename (Filename.chop_extension (List.hd args.Lv6MainArgs.infiles)) diff --git a/bin/soc2cExtern.ml b/bin/soc2cExtern.ml index f8f88c2e3b3b4179c44370137c40e8452b79db75..49d52b6ad5669f5fb1159fb862602609d000fb27 100644 --- a/bin/soc2cExtern.ml +++ b/bin/soc2cExtern.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 29/08/2019 (at 17:04) by Erwan Jahier> *) +(* Time-stamp: <modified the 13/03/2020 (at 11:44) by Erwan Jahier> *) open Soc2cIdent @@ -20,7 +20,7 @@ let (type_decl : LicPrg.t -> string) = else acc in let preambule = "\n/* XXX FIXME: The following types must be defined/fixed */" ^ - "\n#define FAKE_TYPE_DEF_2FIX int\n" + "\n#define FAKE_TYPE_DEF_2FIX char*\n" in let str = LicPrg.fold_types type_to_string prg "" in if str = "" then "" else (preambule^""^str^"\n") @@ -94,16 +94,24 @@ let (const_declaration : LicPrg.t -> string) = let str = LicPrg.fold_consts const_to_string prg "" in if str = "" then "" else (preambule^str^"\n") -let (gen_getters : LicPrg.t -> string) = - fun prg -> - let type_to_string k t acc = - if is_extern_type t then +let (gen_getters : string -> LicPrg.t -> Soc.t -> string) = + fun fn prg soc -> + let ctx = get_ctx_name soc.key in + let type_to_string k t acc = + if is_extern_type t then ( + Printf.eprintf "W: please check the def of _get_%s in %s.\n%!" (long2s k) fn; Printf.sprintf "%s -_integer _get_%s(char* n) { - _integer r; - r = _get_int(n); +%s _get_%s(%schar* n) { + %s r; + // XXX the code below is just a guess: you should check it is ok + r = _get_string(%sn); return r; -}" acc (long2s k) +}" acc (long2s k) (long2s k) + (if SocUtils.is_memory_less soc then "" else + (Printf.sprintf "%s_type * ctx, " ctx)) + (long2s k) + (if SocUtils.is_memory_less soc then "" else "ctx, ") + ) else acc in let preambule = "\n/* XXX FIXME: The getters may need to be fixed too */" in @@ -136,6 +144,9 @@ let (gen_files : Soc.t -> Soc.tbl -> LicPrg.t -> string -> string -> string -> if not (Sys.file_exists ext_hfile) && needs_hfile then ( let ext_och = open_out ext_hfile in + + Printf.eprintf "W: please check the def of FAKE_TYPE_DEF_2FIX in %s.\n%!" + ext_hfile; output_string ext_och (type_decl licprg); (* output_string ext_och (cpy_decl licprg); *) @@ -145,14 +156,15 @@ let (gen_files : Soc.t -> Soc.tbl -> LicPrg.t -> string -> string -> string -> output_string ext_och proto_decl; ) extern_steps; close_out ext_och; - print_string (Printf.sprintf "%s has been generated.\n" ext_hfile); - + Printf.eprintf "W: %s has been generated.\n%!" ext_hfile; ); if not (Sys.file_exists ext_cfile) && needs_cfile then ( let ext_occ = open_out ext_cfile in if needs_hfile then output_string ext_occ (Printf.sprintf "#include \"%s\"\n" hfile); -(* output_string ext_occ (cpy_def licprg); *) + (* output_string ext_occ (cpy_def licprg); *) + Printf.eprintf "W: please check the def of FAKE_CONST_DEF_2FIX in %s.\n%!" + ext_cfile; output_string ext_occ (const_def licprg); List.iter (fun (sm,soc) -> (* let sname = Soc2cDep.step_name soc.key sm.name in *) @@ -161,7 +173,7 @@ let (gen_files : Soc.t -> Soc.tbl -> LicPrg.t -> string -> string -> string -> output_string ext_occ (Printf.sprintf " /* finish me! */\n}\n") ) extern_steps; close_out ext_occ; - print_string (Printf.sprintf "%s has been generated.\n" ext_cfile); + Printf.eprintf "W: %s has been generated.\n" ext_cfile; ); needs_cfile, needs_hfile diff --git a/bin/soc2cExtern.mli b/bin/soc2cExtern.mli index 560fe3e014930f69b4cea952933738811c2a4df0..7abc4386ef80c4b23c281aae89d5f2172eb6ece5 100644 --- a/bin/soc2cExtern.mli +++ b/bin/soc2cExtern.mli @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 05/05/2017 (at 11:31) by Erwan Jahier> *) +(* Time-stamp: <modified the 13/03/2020 (at 11:32) by Erwan Jahier> *) (* [gen_files main_soc licprg cfile hfile] returns a pair of bool that @@ -23,4 +23,4 @@ val gen_files : Soc.t -> Soc.tbl -> LicPrg.t -> string -> string -> string -> bo val const_declaration : LicPrg.t -> string (* ext type getters for the _loop.c file *) -val gen_getters : LicPrg.t -> string +val gen_getters : string -> LicPrg.t -> Soc.t -> string diff --git a/bin/soc2cGenAssign.ml b/bin/soc2cGenAssign.ml index 4c821647d9b1b417d607ea5f4158ddffb7df759b..26a7ba61a4ba6e37de7d0b08b248317dcffaa2d0 100644 --- a/bin/soc2cGenAssign.ml +++ b/bin/soc2cGenAssign.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 29/08/2019 (at 17:07) by Erwan Jahier> *) +(* Time-stamp: <modified the 11/03/2020 (at 16:51) by Erwan Jahier> *) open Data @@ -51,16 +51,17 @@ let (f: Data.t -> string) = let t_str = Soc2cIdent.type_to_short_string t in let t_def = match t with - | Bool | Int | Real | Enum _-> + | Bool | Int | Real | Enum _ -> Printf.sprintf " #ifndef _assign_%s #define _assign_%s(dest, source, size) dest = source #endif " t_str t_str + | String | Extern _ -> Printf.sprintf " #ifndef _assign_%s -#define _assign_%s(dest, source, size) dest = source // XXX fixme if not a basic type +#define _assign_%s(dest, source, size) dest = source // XXX fixme? #endif " t_str t_str diff --git a/bin/soc2cHeap.ml b/bin/soc2cHeap.ml index 4e1b4ad5848d8331d997ab9ab70634f5ce0f04e4..16ccd9bb327f084b65f80335c87626fa6d6325bf 100644 --- a/bin/soc2cHeap.ml +++ b/bin/soc2cHeap.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 29/08/2019 (at 17:05) by Erwan Jahier> *) +(* Time-stamp: <modified the 06/03/2020 (at 13:34) by Erwan Jahier> *) open Soc2cUtil open Soc2cIdent @@ -37,7 +37,8 @@ let rec (gen_assign : Data.t -> string -> string -> string) = | Data.Struct(_) (* should I rather use memcpy for struct? *) | Data.Bool | Data.Int | Data.Real -> Printf.sprintf " %s = %s;\n" vi vo - | Data.Alpha(_) (* dead code ? *) + | Data.Alpha(_) (* dead code ? *) + | Data.String | Data.Array(_) -> let t_str_short = Soc2cIdent.type_to_short_string t in Printf.sprintf " _assign_%s(%s, %s, sizeof(%s));\n" t_str_short vi vo t_str diff --git a/bin/soc2cStack.ml b/bin/soc2cStack.ml index fb13d06b9dacd49d143da30e42aedf8b93c82763..85fefe0cda3836642f416fa1482973ea2c979798 100644 --- a/bin/soc2cStack.ml +++ b/bin/soc2cStack.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 29/08/2019 (at 17:07) by Erwan Jahier> *) +(* Time-stamp: <modified the 06/03/2020 (at 13:36) by Erwan Jahier> *) open Soc2cUtil open Soc2cIdent @@ -77,6 +77,7 @@ let rec (gen_assign : Data.t -> string -> string -> string) = | Data.Struct(_) (* should I rather use memcpy for struct? *) | Data.Bool | Data.Int | Data.Real -> Printf.sprintf " %s = %s;\n" vi vo | Data.Alpha(_) (* dead code ? *) + | Data.String | Data.Array(_) -> let t_str_short = Soc2cIdent.type_to_short_string t in Printf.sprintf " _assign_%s(%s, %s, sizeof(%s));\n" t_str_short vi vo t_str diff --git a/bin/soc2cUtil.ml b/bin/soc2cUtil.ml index 9f4e5c2331a602a21c137b84b601be22a7d78c0d..a9a890213556c0ab6acba17cd257625aa19571ec 100644 --- a/bin/soc2cUtil.ml +++ b/bin/soc2cUtil.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 29/08/2019 (at 17:08) by Erwan Jahier> *) +(* Time-stamp: <modified the 06/03/2020 (at 13:35) by Erwan Jahier> *) open Soc2cIdent open Data @@ -25,6 +25,7 @@ let (type_to_string : Data.t -> string -> string) = | Bool -> finish acc ("_boolean "^n) | Int -> finish acc ("_integer "^n) | Real-> finish acc ("_real "^n) + | String -> finish acc ("_string "^n) | Extern s -> finish acc ((id2s s)^" "^n) | Enum (s, _sl) -> finish acc (id2s s ^" "^n) | Struct (sid,_) -> finish acc ((id2s sid)^" "^n) @@ -206,6 +207,7 @@ let (data_type_to_c: Data.t -> string -> string) = | Bool -> finish acc ("_boolean "^n) | Int -> finish acc ("_integer "^n) | Real-> finish acc ("_real "^n) + | String-> finish acc ("_string "^n) | Extern s -> finish acc ((id2s s)^" "^n) | Enum (s, _sl) -> finish acc (id2s s ^" "^n) | Struct (sid,_) -> finish acc ((id2s sid)^" "^n) diff --git a/bin/socPredef2cStack.ml b/bin/socPredef2cStack.ml index d4245b1a83aafc3addaa6f276e9b45fb42850fdc..fb65e2375b4f45ae5cd6677bfa0d0915eebe3983 100644 --- a/bin/socPredef2cStack.ml +++ b/bin/socPredef2cStack.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 29/08/2019 (at 17:11) by Erwan Jahier> *) +(* Time-stamp: <modified the 06/03/2020 (at 13:36) by Erwan Jahier> *) open Data open Soc @@ -287,7 +287,7 @@ let (get_iterator : Soc.t -> string -> Soc.t -> int -> string) = (* arg passed by value are copied into the stack, so it's safe to use the same variable *) true - | Alias _ | Alpha _ -> assert false + | String | Alias _ | Alpha _ -> assert false (* ougth to be deadcode; true is the safe value anyway *) | Extern _ | Array _ -> false diff --git a/lib/actionsDeps.ml b/lib/actionsDeps.ml index be2c39edf6ead3c384065f1296d39b614646334e..6d785584299b43863224e2ba7f3a904d8ef3d9f3 100644 --- a/lib/actionsDeps.ml +++ b/lib/actionsDeps.ml @@ -1,4 +1,4 @@ -(** Time-stamp: <modified the 29/08/2019 (at 15:23) by Erwan Jahier> *) +(** Time-stamp: <modified the 06/03/2020 (at 13:32) by Erwan Jahier> *) let dbg = (Lv6Verbose.get_flag "deps") @@ -136,7 +136,9 @@ let rec (_get_top_var : Soc.var_expr -> Soc.var_expr) = let rec (gen_children: Soc.var_expr -> Soc.var_expr list) = fun v -> match Soc.data_type_of_var_expr v with - | Data.Alpha _ | Data.Extern _ | Data.Enum _ | Data.Bool | Data.Int | Data.Real -> [v] + | Data.Alpha _ | Data.Extern _ | Data.Enum _ | Data.String + | Data.Bool | Data.Int | Data.Real + -> [v] | Data.Struct(_ident, ident_t_list) -> List.fold_left (fun acc (id,t) -> diff --git a/lib/soc2cIdent.ml b/lib/soc2cIdent.ml index b1488081170a5008af6a6b9396b9adf1b17ed144..63f2714a1e5321f81a5773bf38f6f72144641aa2 100644 --- a/lib/soc2cIdent.ml +++ b/lib/soc2cIdent.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 29/08/2019 (at 14:41) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/03/2020 (at 09:30) by Erwan Jahier> *) let colcol = Str.regexp "::" let prime = Str.regexp "'" @@ -23,6 +23,7 @@ let rec (type_to_short_string : Data.t -> string) = fun v -> let str = match v with + | Data.String -> "s" | Data.Bool -> "b" | Data.Int -> "i" | Data.Real-> "r" @@ -93,7 +94,6 @@ let _ = Hashtbl.clear key_table; () - let (get_ctx_name : Soc.key -> string) = fun sk -> (get_base_name sk) ^ "_ctx" diff --git a/lib/socExecValue.ml b/lib/socExecValue.ml index 9ca3287f1abeed553024f725cd5bd85b887b7b1e..a800ea5542817be278661146d0a6c7ccc52472cf 100644 --- a/lib/socExecValue.ml +++ b/lib/socExecValue.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 29/08/2019 (at 16:40) by Erwan Jahier> *) +(* Time-stamp: <modified the 06/03/2020 (at 13:30) by Erwan Jahier> *) let dbg = (Lv6Verbose.get_flag "exec") @@ -277,6 +277,7 @@ let rec (get_value : ctx -> var_expr -> Data.v) = | Const(id,Enum(_,idl)) -> E(id, Lv6util.pos_in_list 0 id idl) | Const(id,Array(_vt,_i)) -> get_val id ctx | Const(id,Struct _) -> get_val id ctx + | Const(_id, String) -> assert false | Const(_id, Bool) -> assert false | Const(_id, Extern _) -> assert false | Const(_id, Alias _) -> assert false diff --git a/lib/socVar.ml b/lib/socVar.ml index 81b8d0e4e5c0084164d9006831bf3c937e3b2663..fdd92a10237020f7fad6a5101dae7406fb2a2f18 100644 --- a/lib/socVar.ml +++ b/lib/socVar.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 29/08/2019 (at 14:17) by Erwan Jahier> *) +(* Time-stamp: <modified the 12/03/2020 (at 15:02) by Erwan Jahier> *) open Data @@ -26,6 +26,7 @@ and expand_var enum_flag c_access var = match var with | (_vn,Extern _id) -> [var] | (vn,Alias(_n, t)) -> expand_var enum_flag c_access (vn,t) | (_vn,Alpha _) -> assert false (* should not occur *) + | (_vn, String) -> assert false (* should not occur *) let (_int_to_enum : Data.v -> Soc.ident list -> Data.v) = fun v el -> @@ -38,7 +39,7 @@ let (expand_subst: Data.subst -> Data.subst list) = fun s -> let rec aux acc (n,v) = match v with - | U | I _ | F _ | B _ -> (n,v)::acc + | U | I _ | F _ | B _ | Str _ -> (n,v)::acc | E(_e,i) -> (n,I i)::acc | S fl -> let f (fn,fv) = n^"_"^fn, fv in @@ -77,7 +78,8 @@ let (unexpand_profile : sl -> Soc.var list -> sl) = match sl_todo, vl with | [],_::_ -> sl_done,[] | _,[] -> sl_done, sl_todo - | s::sl, (_, (Bool| Int | Real))::vl -> aux (s::sl_done) sl vl + | s::sl, (_, (Bool| Int | Real | Extern _ | String ))::vl -> + aux (s::sl_done) sl vl | (id,v)::sl, (_,Enum(_n,el))::vl -> let s = (id, int_to_enum v el) in aux (s::sl_done) sl vl @@ -101,7 +103,6 @@ let (unexpand_profile : sl -> Soc.var list -> sl) = let sl_done = (vn, S fl)::sl_done in aux sl_done sl_todo vl - | _, (_vn,Extern _id)::_ -> assert false (* finish me! *) | _, (_vn,Alpha _ )::_ -> assert false (* should not occur *) | _, (_, Alias _)::_ -> assert false (* should not occur *) diff --git a/test/lus2lic.sum b/test/lus2lic.sum index 9a238b1811c87280bd188da9a11279bf1449a780..3f153b25a1778ffe0aaad71daee8b1b7f892ca82 100644 --- a/test/lus2lic.sum +++ b/test/lus2lic.sum @@ -1,5 +1,5 @@ ==> lus2lic0.sum <== -Test run by jahier on Tue Mar 3 17:07:25 +Test run by jahier on Fri Mar 13 11:51:14 Native configuration is x86_64-pc-linux-gnu === lus2lic0 tests === @@ -66,7 +66,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus ==> lus2lic1.sum <== -Test run by jahier on Tue Mar 3 17:07:26 +Test run by jahier on Fri Mar 13 11:51:15 Native configuration is x86_64-pc-linux-gnu === lus2lic1 tests === @@ -413,7 +413,7 @@ PASS: ./lus2lic {-2c multipar.lus -n multipar} PASS: sh multipar.sh ==> lus2lic2.sum <== -Test run by jahier on Tue Mar 3 17:08:00 +Test run by jahier on Fri Mar 13 11:51:48 Native configuration is x86_64-pc-linux-gnu === lus2lic2 tests === @@ -753,7 +753,7 @@ PASS: sh zzz2.sh PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus {} ==> lus2lic3.sum <== -Test run by jahier on Tue Mar 3 17:08:40 +Test run by jahier on Fri Mar 13 11:52:27 Native configuration is x86_64-pc-linux-gnu === lus2lic3 tests === @@ -1267,7 +1267,7 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {} ==> lus2lic4.sum <== -Test run by jahier on Tue Mar 3 17:09:26 +Test run by jahier on Fri Mar 13 11:53:12 Native configuration is x86_64-pc-linux-gnu === lus2lic4 tests === @@ -1759,7 +1759,7 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {} # of expected failures 54 ==> lus2lic1.sum <== -PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus 33749 {} +PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus 33421 {} === lus2lic1 Summary === @@ -1788,13 +1788,13 @@ PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus 33749 =============================== # Total number of failures: 10 lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 1 seconds -lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 34 seconds -lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 40 seconds -lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 46 seconds -lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 26 seconds +lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 33 seconds +lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 39 seconds +lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 45 seconds +lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 25 seconds * Ref time: -86.77user 27.75system 2:26.54elapsed 78%CPU (0avgtext+0avgdata 284268maxresident)k -0inputs+146792outputs (0major+11400569minor)pagefaults 0swaps +82.98user 26.19system 2:22.66elapsed 76%CPU (0avgtext+0avgdata 283996maxresident)k +0inputs+149888outputs (0major+11433733minor)pagefaults 0swaps * Quick time (-j 4): -107.58user 29.57system 1:26.81elapsed 157%CPU (0avgtext+0avgdata 282988maxresident)k -0inputs+141688outputs (0major+11114687minor)pagefaults 0swaps +104.96user 28.76system 1:25.60elapsed 156%CPU (0avgtext+0avgdata 283296maxresident)k +0inputs+147480outputs (0major+11277942minor)pagefaults 0swaps