Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
stage-L3-2016
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aliaume Lopez
stage-L3-2016
Commits
7e2f733a
Commit
7e2f733a
authored
Jul 11, 2016
by
Aliaume Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests. ...
parent
f8734bf8
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
548 additions
and
2260 deletions
+548
-2260
circuits.ml
circuits.ml
+521
-2193
dot.ml
dot.ml
+27
-20
dot.mli
dot.mli
+0
-47
No files found.
circuits.ml
View file @
7e2f733a
This diff is collapsed.
Click to expand it.
dot.ml
View file @
7e2f733a
...
...
@@ -51,16 +51,19 @@ let renderMods m = m
|>
List
.
map
(
fun
(
x
,
y
)
->
x
^
"="
^
y
)
|>
String
.
concat
","
;;
let
mod_shape
x
=
SM
.
add
"shape"
x
;;
let
mod_label
x
=
SM
.
add
"label"
(
"
\"
"
^
x
^
"
\"
"
);;
let
mod_style
x
=
SM
.
add
"style"
(
surround
"
\"
"
"
\"
"
x
);;
let
mod_width
x
=
SM
.
add
"width"
(
string_of_float
x
);;
let
mod_height
x
=
SM
.
add
"height"
(
string_of_float
x
);;
let
mod_shape
x
=
SM
.
add
"shape"
x
;;
let
mod_color
x
=
SM
.
add
"color"
x
;;
let
mod_label
x
=
SM
.
add
"label"
(
"
\"
"
^
x
^
"
\"
"
);;
let
mod_style
x
=
SM
.
add
"style"
(
surround
"
\"
"
"
\"
"
x
);;
let
mod_width
x
=
SM
.
add
"width"
(
string_of_float
x
);;
let
mod_height
x
=
SM
.
add
"height"
(
string_of_float
x
);;
let
mod_fixedsize
x
=
SM
.
add
"fixedsize"
(
"
\"
"
^
(
string_of_bool
x
)
^
"
\"
"
);;
(*
* Construit un label associé à un noeud, un port
* et savoir si c'est une entrée / sortie
* Making a node id
*
* Note : ports starts from 0 but they are displayed
* starting from 1, thus the (i+1) in the code
*
*)
let
mkLabel
id
port
io
=
...
...
@@ -68,9 +71,8 @@ let mkLabel id port io =
|
None
->
"N"
^
string_of_int
id
|
Some
i
->
"N"
^
string_of_int
id
^
":"
^
io
^
string_of_int
i
;;
let
mkNode
mods
=
let
id
=
uid
()
in
(
id
,
"N"
^
string_of_int
id
^
" ["
^
renderMods
mods
^
"]
\n
"
);;
let
mkNode
nid
mods
=
"N"
^
string_of_int
nid
^
" ["
^
renderMods
mods
^
"]
\n
"
;;
let
emptyMod
=
SM
.
empty
;;
let
baseMod
=
SM
.
singleton
"shape"
"record"
;;
...
...
@@ -89,20 +91,25 @@ let inputsOutputs label n m =
in
SM
.
add
"label"
labelFinal
;;
(* Link : fait un lien entre deux sommets *)
let
link
=
fun
i1
x
i2
y
->
(*
* Make a link between two nodes
*
* i1 : first node
* i2 : second node
* x : optionnal port (maybe int)
* y : optionnal port (maybe int)
*
*)
let
mkLink
=
fun
i1
x
i2
y
->
mkLabel
i1
x
"out"
^
" -> "
^
mkLabel
i2
y
"in"
^
"
\n
"
;;
(* shadowLink : fait un lien avec des pointillés ... *)
let
shadowLink
i1
x
i2
y
=
mkLabel
i1
x
"out"
^
" -> "
^
mkLabel
i2
y
"in"
^
"
\n
"
;;
(* " [style=dotted]\n";; *)
(**
* syntaxe : {rank=same; q1 q2 ... qn}
*
* syntax : {rank=min; ... } / {rank=max; ... }
*
*)
let
same_rankdir
l
=
let
s
=
surround
"{rank=same;"
"}
\n
"
in
let
rank_group
rg
l
=
let
s
=
surround
(
"{rank="
^
rg
^
";"
)
"}
\n
"
in
l
|>
List
.
map
(
fun
id
->
mkLabel
id
None
""
)
|>
String
.
concat
" "
|>
s
;;
let
addDot
=
(
^
);;
...
...
dot.mli
deleted
100644 → 0
View file @
f8734bf8
(** The interface to compile dot expressions *)
(** The type of a dot graphic *)
type
dot
(** The type of dot modifiers *)
type
node_mod
(** Dot uid *)
type
uid
=
int
(** Append the prelude and compiles to
* the string representation in dot language
*)
val
addPrelude
:
dot
->
string
val
uid
:
unit
->
uid
(* val renderMods : node_mod -> string *)
val
emptyMod
:
node_mod
val
baseMod
:
node_mod
val
mod_shape
:
string
->
node_mod
->
node_mod
val
mod_label
:
string
->
node_mod
->
node_mod
val
mod_style
:
string
->
node_mod
->
node_mod
val
mod_width
:
float
->
node_mod
->
node_mod
val
mod_height
:
float
->
node_mod
->
node_mod
val
mod_fixedsize
:
bool
->
node_mod
->
node_mod
val
inputsOutputs
:
string
->
int
->
int
->
node_mod
->
node_mod
val
mkLabel
:
uid
->
int
option
->
string
->
dot
val
mkNode
:
node_mod
->
uid
*
dot
val
link
:
uid
->
int
option
->
uid
->
int
option
->
dot
val
shadowLink
:
uid
->
int
option
->
uid
->
int
option
->
dot
val
same_rankdir
:
uid
list
->
dot
val
addDot
:
dot
->
dot
->
dot
val
addDots
:
dot
list
->
dot
val
tests
:
(
string
*
(
unit
->
unit
))
list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment