diff --git a/README.org b/README.org index bfeaa7ec2aeefddbdeda504353ebc80bb407912b..dc1d7af3954704b23a9de19e477e3b1849aafc31 100644 --- a/README.org +++ b/README.org @@ -1,4 +1,16 @@ +* windows + +Pour installer les outils de cross compilation (gcc et ocaml) : + + aptitude install mingw32 mingw32-binutils mingw32-runtime mingw32-ocaml gcc-mingw32 + + +sur grivola, le cross-compilateur gcc est la : + /usr/i586-mingw32msvc/bin + + + * cloning @@ -10,12 +22,7 @@ cd lus2lic make make test #+END_SRC - - - -* Todo -cf file:todo.org - +~ * Tests (=./test=) requires 'sudo apt-get install dejagnu' diff --git a/release-lv6/Makefile b/release-lv6/Makefile index 017b33d74b2fba65c5a7f38235709d01ca6fb01a..4e03b1aec562d7d6bb70e8973a8fd54e7e57a4ba 100644 --- a/release-lv6/Makefile +++ b/release-lv6/Makefile @@ -50,7 +50,7 @@ lic2c: cp $(LIC2CDIR)/src/lic2c $(RELNAME)/bin/ test_files: - mkfir $(RELNAME)/test/ || true + mkdir $(RELNAME)/test/ || true cp -rf $(LUS2LICDIR)/test/should_work $(RELNAME)/test/ cp -rf $(LUS2LICDIR)/test/should_fail $(RELNAME)/test/ cp -rf $(LUS2LICDIR)/test/lus2lic.tests $(RELNAME)/test/ @@ -59,11 +59,13 @@ test_files: cp -rf $(LUS2LICDIR)/test/config $(RELNAME)/test/ cp -rf $(LUS2LICDIR)/test/myec2c $(RELNAME)/test/ cp -rf $(shell which lurettetop) $(RELNAME)/test/ + cp -rf $(LUS2LICDIR)/utils/lustrequiv $(RELNAME)/utils cp -rf $(LUS2LICDIR)/utils/test_lus2lic_no_node $(RELNAME)/utils cp -rf $(LUS2LICDIR)/utils/compare_exec_and_2c $(RELNAME)/utils cp -rf `which lurettetop` $(RELNAME)/test cp -rf `which lurettetop`_exe $(RELNAME)/test - rm -f $(RELNAME)/test/*/*.lus~ + rm -f $(RELNAME)/test/*/*~ + rm -f $(RELNAME)/test/*/*/*~ rm -f $(RELNAME)/test/*/normal.lus rm -f $(RELNAME)/test/*/*/normal.lus rm -f $(RELNAME)/test/*/ELMU.lus diff --git a/src/lv6Id.ml b/src/lv6Id.ml new file mode 100644 index 0000000000000000000000000000000000000000..26c192c6750529391d781ccd6739590edc6cd9cf --- /dev/null +++ b/src/lv6Id.ml @@ -0,0 +1,195 @@ +(* Time-stamp: <modified the 26/05/2014 (at 10:44) by Erwan Jahier> *) + +(* J'ai appele ca symbol (mais ca remplace le ident) : +c'est juste une couche qui garantit l'unicite en memoire +des strings ... +C'est tout petit, non ??? + +(* debut symbol.mli *) +type t +val to_string : t -> string +val of_string : string -> t + +(* fin symbol.mli *) + +------------------ + +(* debut symbol.ml *) +type t = string + +module WeakStringTab = struct + include Weak.Make( + struct + type t = string + let equal = (=) + let hash = Hashtbl.hash + end + ) +end + +let zetab = WeakStringTab.create 100 +let (to_string : t -> string) = + fun x -> x + +let (of_string : string -> t) = + fun x -> ( + WeakStringTab.merge zetab x + ) +(* fin symbol.ml *) + + *) + +(*cf ~/dd/ocaml-3.10.0/typing/ident.ml *) + +type t = string +type pack_name = t +type long = pack_name * t + +let (pack_of_long : long -> pack_name) = + fun l -> fst l + +let (of_long : long -> t) = + fun l -> snd l + +let (to_string : t -> string) = + fun x -> x + +let (of_string : string -> t) = + fun x -> x + +let (pack_name_of_string : string -> pack_name) = + fun x -> x + +let (pack_name_to_string : pack_name -> string) = + fun x -> x + +let (string_of_long : long -> string) = + fun (pn, id) -> + let sep = + if Lv6MainArgs.global_opt.Lv6MainArgs.ec || Lv6MainArgs.global_opt.Lv6MainArgs.lv4 + then "__" else "::" + in + match pn with + | "" -> id + | _ -> +(* if Lv6MainArgs.global_opt.Lv6MainArgs.no_prefix then id else *) + Printf.sprintf "%s%s%s" pn sep id + +let (string_of_long2 : long -> string) = + function + | "Lustre","true" -> "true" + | "Lustre","false" -> "false" + | (pn, id) -> pn ^"::"^ id + +let (no_pack_string_of_long : long -> string) = + fun (pn, id) -> + id + +let (long_to_string : long -> string) = + string_of_long2 + +let (make_long : pack_name -> t -> long) = + fun pn id -> (pn,id) + +let dft_pack_name = ref "DftPack" (* this dft value ougth to be reset before being used *) + +let (set_dft_pack_name : pack_name -> unit) = + fun pn -> +(* print_string ("Change the dft pack name to "^ pn^"\n");flush stdout; *) + dft_pack_name := pn + + + +(* -> syntaxeTree.ml ? *) + +type idref = + { + id_pack : pack_name option; + id_id : t + } + +let (pack_of_idref : idref -> pack_name option) = + fun ir -> ir.id_pack + +let (name_of_idref : idref -> t) = + fun ir -> ir.id_id + + +(* utilitaires idref *) +let idref_of_string s = ( + match (Str.split (Str.regexp "::") s) with + [i] -> { id_pack = None; id_id = i} + | [p;i]-> { id_pack = Some p; id_id = i} + | _ -> raise (Failure ("idref_of_string: \""^s^"\" not a proper ident")) +) + +let out_of_pack s = ("", s) + +let (long_of_string : string -> long) = + fun s -> + match (Str.split (Str.regexp "::") s) with + [i] -> !dft_pack_name, i + | [p;i]-> p, i + | _ -> raise (Failure ("idref_of_string: \""^s^"\" not a proper ident")) + +let string_of_idref i = ( + match i.id_pack with + Some p -> + if Lv6MainArgs.global_opt.Lv6MainArgs.no_prefix then i.id_id else + if Lv6MainArgs.global_opt.Lv6MainArgs.ec then p^"__"^i.id_id else + if Lv6MainArgs.global_opt.Lv6MainArgs.lv4 then (p^"__"^i.id_id) else + (p^"::"^i.id_id) + | None -> i.id_id +) +let string_of_idref_bis i = ( + match i.id_pack with + Some p -> (p^"::"^i.id_id) + | None -> i.id_id +) +let raw_string_of_idref i = ( + let p = match i.id_pack with + | Some p -> "Some \""^p^"\"" + | None -> "None" + in + Printf.sprintf "(%s, \"%s\")" p i.id_id +) + + +let (wrap_idref : idref -> string -> string -> idref) = + fun { id_pack = p ; id_id = id } pref suff -> + { id_pack = p ; id_id = of_string (pref ^ (to_string id)^suff) } + +let (of_idref : idref -> t) = + fun idref -> + of_string (string_of_idref idref) + +let (to_idref : t -> idref) = + fun id -> idref_of_string (to_string id) + +let (long_of_idref : idref -> long) = + fun idr -> + match pack_of_idref idr with + Some p -> (p, name_of_idref idr) + | None -> (!dft_pack_name, name_of_idref idr) + +let (idref_of_long : long -> idref) = + fun (pn,id) -> + { id_pack = Some pn ; id_id = id } + +let (idref_of_id : t -> idref) = + fun id -> + { id_pack = None ; id_id = id } + +let (make_idref : pack_name -> t -> idref) = + fun pn id -> + { id_pack = Some pn ; id_id = id } + + + +type clk = long * t + +let (string_of_clk : clk -> string) = + fun (cc,cv) -> + (string_of_long cc) ^ "(" ^ (to_string cv) ^ ")" + +(*************************************************************************) diff --git a/src/lv6Id.mli b/src/lv6Id.mli new file mode 100644 index 0000000000000000000000000000000000000000..fed0c3739c5ad010c6b2b1cadde90b2b37740f66 --- /dev/null +++ b/src/lv6Id.mli @@ -0,0 +1,72 @@ +(* Time-stamp: <modified the 26/02/2015 (at 13:45) by Erwan Jahier> *) + +(** *) + +type t = string +type long = t * t +type pack_name = t + +val to_string : t -> string +val of_string : string -> t + +val of_long : long -> t +val pack_name_of_string : string -> pack_name +val pack_name_to_string : pack_name -> string +val pack_of_long : long -> pack_name + +val string_of_long : long -> string +val string_of_long2 : long -> string +(** To ignore pack name (meaningful when generating ec code for exemple *) +val no_pack_string_of_long : long -> string +val long_to_string : long -> string +val long_of_string : string -> long + +val make_long : pack_name -> t -> long + +(** lift simple string to long WITH EMPTY PACK *) +val out_of_pack : string -> long + +val set_dft_pack_name : pack_name -> unit + +(* TODO: a renommer et a abstraire ?? + a mettre dans syntaxe.ml ??? + + During parsing, we don't know yet what default name we should + give to the package. Once we know it, we manipulate Lv6Id.t rather than idref + + idref is used to denote user ident, that migth be prefixed + by the module name or not. One of the first stage of the compiling + will consist in transforming those idref (should be called user_id?) + into Lv6Id.long + +*) +type idref = + { + id_pack : string option; + id_id : string + } + +val idref_of_string : string -> idref +val make_idref : pack_name -> t -> idref + + +val string_of_idref : idref -> string +val string_of_idref_bis : idref -> string +val raw_string_of_idref : idref -> string +val of_idref : idref -> t +val to_idref : t -> idref + +val name_of_idref : idref -> t +val pack_of_idref : idref -> pack_name option + +(** [long_of_idref default_pack_name id_ref] builds a long ident from a + AstV6.idref *) +val long_of_idref : idref -> long + +val idref_of_long : long -> idref +val idref_of_id : t -> idref + +type clk = long * t +val string_of_clk : clk -> string + +val wrap_idref : idref -> string -> string -> idref