Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lustre-v6
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
verimag
synchrone
lustre-v6
Commits
c1931201
Commit
c1931201
authored
9 years ago
by
Erwan Jahier
Browse files
Options
Downloads
Patches
Plain Diff
Add lv6Id.ml/mli that was not tracked by git !!!
parent
71fc4b66
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.org
+13
-6
13 additions, 6 deletions
README.org
release-lv6/Makefile
+4
-2
4 additions, 2 deletions
release-lv6/Makefile
src/lv6Id.ml
+195
-0
195 additions, 0 deletions
src/lv6Id.ml
src/lv6Id.mli
+72
-0
72 additions, 0 deletions
src/lv6Id.mli
with
284 additions
and
8 deletions
README.org
+
13
−
6
View file @
c1931201
* 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
* cloning
...
@@ -10,12 +22,7 @@ cd lus2lic
...
@@ -10,12 +22,7 @@ cd lus2lic
make
make
make test
make test
#+END_SRC
#+END_SRC
~
* Todo
cf file:todo.org
* Tests (=./test=)
* Tests (=./test=)
requires 'sudo apt-get install dejagnu'
requires 'sudo apt-get install dejagnu'
...
...
This diff is collapsed.
Click to expand it.
release-lv6/Makefile
+
4
−
2
View file @
c1931201
...
@@ -50,7 +50,7 @@ lic2c:
...
@@ -50,7 +50,7 @@ lic2c:
cp
$(
LIC2CDIR
)
/src/lic2c
$(
RELNAME
)
/bin/
cp
$(
LIC2CDIR
)
/src/lic2c
$(
RELNAME
)
/bin/
test_files
:
test_files
:
mk
f
ir
$(
RELNAME
)
/test/
||
true
mk
d
ir
$(
RELNAME
)
/test/
||
true
cp
-rf
$(
LUS2LICDIR
)
/test/should_work
$(
RELNAME
)
/test/
cp
-rf
$(
LUS2LICDIR
)
/test/should_work
$(
RELNAME
)
/test/
cp
-rf
$(
LUS2LICDIR
)
/test/should_fail
$(
RELNAME
)
/test/
cp
-rf
$(
LUS2LICDIR
)
/test/should_fail
$(
RELNAME
)
/test/
cp
-rf
$(
LUS2LICDIR
)
/test/lus2lic.tests
$(
RELNAME
)
/test/
cp
-rf
$(
LUS2LICDIR
)
/test/lus2lic.tests
$(
RELNAME
)
/test/
...
@@ -59,11 +59,13 @@ test_files:
...
@@ -59,11 +59,13 @@ test_files:
cp
-rf
$(
LUS2LICDIR
)
/test/config
$(
RELNAME
)
/test/
cp
-rf
$(
LUS2LICDIR
)
/test/config
$(
RELNAME
)
/test/
cp
-rf
$(
LUS2LICDIR
)
/test/myec2c
$(
RELNAME
)
/test/
cp
-rf
$(
LUS2LICDIR
)
/test/myec2c
$(
RELNAME
)
/test/
cp
-rf
$(
shell which lurettetop
)
$(
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/test_lus2lic_no_node
$(
RELNAME
)
/utils
cp
-rf
$(
LUS2LICDIR
)
/utils/compare_exec_and_2c
$(
RELNAME
)
/utils
cp
-rf
$(
LUS2LICDIR
)
/utils/compare_exec_and_2c
$(
RELNAME
)
/utils
cp
-rf
`
which lurettetop
`
$(
RELNAME
)
/test
cp
-rf
`
which lurettetop
`
$(
RELNAME
)
/test
cp
-rf
`
which lurettetop
`
_exe
$(
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/
*
/
*
/normal.lus
rm
-f
$(
RELNAME
)
/test/
*
/
*
/normal.lus
rm
-f
$(
RELNAME
)
/test/
*
/ELMU.lus
rm
-f
$(
RELNAME
)
/test/
*
/ELMU.lus
...
...
This diff is collapsed.
Click to expand it.
src/lv6Id.ml
0 → 100644
+
195
−
0
View file @
c1931201
(* 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
)
^
")"
(*************************************************************************)
This diff is collapsed.
Click to expand it.
src/lv6Id.mli
0 → 100644
+
72
−
0
View file @
c1931201
(* 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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment