Skip to content
Snippets Groups Projects
Commit d86380cd authored by Valerian Wintner's avatar Valerian Wintner
Browse files

cmi, logging

parent 46bf4fb8
No related branches found
No related tags found
No related merge requests found
......@@ -6,9 +6,38 @@ version = 3
name = "Project02"
version = "0.1.0"
dependencies = [
"clap",
"graphviz-rust",
"tracing",
"tracing-subscriber",
]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi",
]
[[package]]
name = "autocfg"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "bitflags"
version = "1.3.2"
......@@ -54,6 +83,36 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "3.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6f34b09b9ee8c7c7b400fe2f8df39cafc9538b03d6ba7f4ae13e4cb90bfbb7d"
dependencies = [
"atty",
"bitflags",
"clap_derive",
"indexmap",
"lazy_static",
"os_str_bytes",
"strsim",
"termcolor",
"textwrap",
]
[[package]]
name = "clap_derive"
version = "3.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41a0645a430ec9136d2d701e54a95d557de12649a9dd7109ced3187e648ac824"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "digest"
version = "0.8.1"
......@@ -120,6 +179,37 @@ dependencies = [
"tempfile",
]
[[package]]
name = "hashbrown"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]]
name = "heck"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "indexmap"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]]
name = "into-attr"
version = "0.1.0"
......@@ -142,24 +232,69 @@ dependencies = [
"syn",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.112"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
[[package]]
name = "log"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
dependencies = [
"cfg-if",
]
[[package]]
name = "maplit"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
[[package]]
name = "matchers"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
dependencies = [
"regex-automata",
]
[[package]]
name = "memchr"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
name = "once_cell"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
[[package]]
name = "opaque-debug"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]]
name = "os_str_bytes"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
dependencies = [
"memchr",
]
[[package]]
name = "pest"
version = "2.1.3"
......@@ -203,12 +338,42 @@ dependencies = [
"sha-1",
]
[[package]]
name = "pin-project-lite"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c"
[[package]]
name = "ppv-lite86"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]]
name = "proc-macro2"
version = "1.0.36"
......@@ -276,6 +441,30 @@ dependencies = [
"bitflags",
]
[[package]]
name = "regex"
version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
dependencies = [
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
dependencies = [
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "remove_dir_all"
version = "0.5.3"
......@@ -297,6 +486,27 @@ dependencies = [
"opaque-debug",
]
[[package]]
name = "sharded-slab"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"
dependencies = [
"lazy_static",
]
[[package]]
name = "smallvec"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
version = "1.0.84"
......@@ -322,6 +532,91 @@ dependencies = [
"winapi",
]
[[package]]
name = "termcolor"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
dependencies = [
"winapi-util",
]
[[package]]
name = "textwrap"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
[[package]]
name = "thread_local"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd"
dependencies = [
"once_cell",
]
[[package]]
name = "tracing"
version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105"
dependencies = [
"cfg-if",
"pin-project-lite",
"tracing-attributes",
"tracing-core",
]
[[package]]
name = "tracing-attributes"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tracing-core"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4"
dependencies = [
"lazy_static",
]
[[package]]
name = "tracing-log"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3"
dependencies = [
"lazy_static",
"log",
"tracing-core",
]
[[package]]
name = "tracing-subscriber"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d81bfa81424cc98cb034b837c985b7a290f592e5b4322f353f94a0ab0f9f594"
dependencies = [
"ansi_term",
"lazy_static",
"matchers",
"regex",
"sharded-slab",
"smallvec",
"thread_local",
"tracing",
"tracing-core",
"tracing-log",
]
[[package]]
name = "typenum"
version = "1.15.0"
......@@ -340,6 +635,12 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "wasi"
version = "0.10.2+wasi-snapshot-preview1"
......@@ -362,6 +663,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
......
......@@ -7,4 +7,7 @@ author = "Valerian Wintner"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = { version="3.0.5", features = ["derive", "color", "suggestions"] }
graphviz-rust = "0.1.2"
tracing = "0.1.29"
tracing-subscriber = { version="0.3.5", features=["std", "env-filter", "fmt", "ansi", "registry"]}
File moved
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.50.0 (0)
-->
<!-- Title: nice Pages: 1 -->
<svg width="390pt" height="126pt"
viewBox="0.00 0.00 390.42 125.81" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 121.81)">
<title>nice</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-121.81 386.42,-121.81 386.42,4 -4,4"/>
<!-- 1 -->
<g id="node1" class="node">
<title>1</title>
<polygon fill="#8b0000" stroke="#8b0000" points="36,-117.81 0,-117.81 0,-81.81 36,-81.81 36,-117.81"/>
<text text-anchor="middle" x="18" y="-96.11" font-family="Times,serif" font-size="14.00">1</text>
</g>
<!-- 2 -->
<g id="node2" class="node">
<title>2</title>
<polygon fill="#008b00" stroke="#008b00" points="106.21,-117.81 79.21,-99.81 106.21,-81.81 133.21,-99.81 106.21,-117.81"/>
<text text-anchor="middle" x="106.21" y="-96.11" font-family="Times,serif" font-size="14.00">2</text>
</g>
<!-- 1&#45;&gt;2 -->
<g id="edge6" class="edge">
<title>1&#45;&gt;2</title>
<path fill="none" stroke="black" d="M36.03,-94.3C47.73,-93.02 63.52,-92.73 77.06,-93.43"/>
<polygon fill="black" stroke="black" points="77.09,-96.94 87.32,-94.21 77.62,-89.96 77.09,-96.94"/>
</g>
<!-- 6 -->
<g id="node6" class="node">
<title>6</title>
<polygon fill="#008b00" stroke="#008b00" points="106.21,-40.66 79.04,-22.81 106.21,-4.96 133.38,-22.81 106.21,-40.66"/>
<polygon fill="none" stroke="#008b00" points="106.21,-45.42 71.79,-22.81 106.21,-0.19 140.63,-22.81 106.21,-45.42"/>
<text text-anchor="middle" x="106.21" y="-19.11" font-family="Times,serif" font-size="14.00">6</text>
</g>
<!-- 1&#45;&gt;6 -->
<g id="edge7" class="edge">
<title>1&#45;&gt;6</title>
<path fill="none" stroke="black" d="M36.03,-84.59C49.53,-72.54 68.49,-55.6 83.15,-42.51"/>
<polygon fill="black" stroke="black" points="85.66,-44.96 90.79,-35.69 81,-39.74 85.66,-44.96"/>
</g>
<!-- 2&#45;&gt;1 -->
<g id="edge8" class="edge">
<title>2&#45;&gt;1</title>
<path fill="none" stroke="black" d="M87.32,-105.4C75.44,-106.64 59.6,-106.88 46.17,-106.13"/>
<polygon fill="black" stroke="black" points="46.28,-102.63 36.03,-105.31 45.72,-109.6 46.28,-102.63"/>
</g>
<!-- 3 -->
<g id="node3" class="node">
<title>3</title>
<polygon fill="#8b0000" stroke="#8b0000" points="212.42,-117.81 176.42,-117.81 176.42,-81.81 212.42,-81.81 212.42,-117.81"/>
<text text-anchor="middle" x="194.42" y="-96.11" font-family="Times,serif" font-size="14.00">3</text>
</g>
<!-- 2&#45;&gt;3 -->
<g id="edge9" class="edge">
<title>2&#45;&gt;3</title>
<path fill="none" stroke="black" d="M133.55,-99.81C143.84,-99.81 155.64,-99.81 166.03,-99.81"/>
<polygon fill="black" stroke="black" points="166.22,-103.31 176.22,-99.81 166.22,-96.31 166.22,-103.31"/>
</g>
<!-- 4 -->
<g id="node4" class="node">
<title>4</title>
<polygon fill="#008b00" stroke="#008b00" points="275.42,-117.81 248.42,-99.81 275.42,-81.81 302.42,-99.81 275.42,-117.81"/>
<text text-anchor="middle" x="275.42" y="-96.11" font-family="Times,serif" font-size="14.00">4</text>
</g>
<!-- 3&#45;&gt;4 -->
<g id="edge2" class="edge">
<title>3&#45;&gt;4</title>
<path fill="none" stroke="black" d="M212.56,-94.13C222.47,-93.06 235.17,-92.79 246.48,-93.32"/>
<polygon fill="black" stroke="black" points="246.54,-96.83 256.77,-94.07 247.05,-89.85 246.54,-96.83"/>
</g>
<!-- 5 -->
<g id="node5" class="node">
<title>5</title>
<polygon fill="#8b0000" stroke="#8b0000" points="378.42,-94.81 342.42,-94.81 342.42,-58.81 378.42,-58.81 378.42,-94.81"/>
<polygon fill="none" stroke="#8b0000" points="382.42,-98.81 338.42,-98.81 338.42,-54.81 382.42,-54.81 382.42,-98.81"/>
<text text-anchor="middle" x="360.42" y="-73.11" font-family="Times,serif" font-size="14.00">5</text>
</g>
<!-- 3&#45;&gt;5 -->
<g id="edge1" class="edge">
<title>3&#45;&gt;5</title>
<path fill="none" stroke="black" d="M212.76,-88.34C222.73,-82.43 235.77,-75.84 248.42,-72.81 274.81,-66.47 305.72,-68.31 328.22,-71.25"/>
<polygon fill="black" stroke="black" points="327.82,-74.73 338.22,-72.7 328.83,-67.8 327.82,-74.73"/>
</g>
<!-- 4&#45;&gt;3 -->
<g id="edge4" class="edge">
<title>4&#45;&gt;3</title>
<path fill="none" stroke="black" d="M256.77,-105.54C246.77,-106.58 234.04,-106.82 222.78,-106.27"/>
<polygon fill="black" stroke="black" points="222.8,-102.76 212.56,-105.49 222.27,-109.74 222.8,-102.76"/>
</g>
<!-- 4&#45;&gt;5 -->
<g id="edge3" class="edge">
<title>4&#45;&gt;5</title>
<path fill="none" stroke="black" d="M294.84,-94.7C304.72,-91.97 317.14,-88.52 328.45,-85.39"/>
<polygon fill="black" stroke="black" points="329.72,-88.67 338.42,-82.63 327.85,-81.92 329.72,-88.67"/>
</g>
<!-- 6&#45;&gt;6 -->
<g id="edge5" class="edge">
<title>6&#45;&gt;6</title>
<path fill="none" stroke="black" d="M92.65,-37.03C86.05,-49.86 90.57,-63.61 106.21,-63.61 117.82,-63.61 123.3,-56.04 122.66,-46.89"/>
<polygon fill="black" stroke="black" points="125.94,-45.64 119.77,-37.03 119.22,-47.61 125.94,-45.64"/>
</g>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.50.0 (0)
-->
<!-- Title: nice Pages: 1 -->
<svg width="390pt" height="126pt"
viewBox="0.00 0.00 390.42 125.81" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 121.81)">
<title>nice</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-121.81 386.42,-121.81 386.42,4 -4,4"/>
<!-- 1 -->
<g id="node1" class="node">
<title>1</title>
<polygon fill="orange" stroke="orange" points="36,-117.81 0,-117.81 0,-81.81 36,-81.81 36,-117.81"/>
<text text-anchor="middle" x="18" y="-96.11" font-family="Times,serif" font-size="14.00">1</text>
</g>
<!-- 2 -->
<g id="node2" class="node">
<title>2</title>
<polygon fill="orange" stroke="orange" points="106.21,-117.81 79.21,-99.81 106.21,-81.81 133.21,-99.81 106.21,-117.81"/>
<text text-anchor="middle" x="106.21" y="-96.11" font-family="Times,serif" font-size="14.00">2</text>
</g>
<!-- 1&#45;&gt;2 -->
<g id="edge6" class="edge">
<title>1&#45;&gt;2</title>
<path fill="none" stroke="black" d="M36.03,-94.3C47.73,-93.02 63.52,-92.73 77.06,-93.43"/>
<polygon fill="black" stroke="black" points="77.09,-96.94 87.32,-94.21 77.62,-89.96 77.09,-96.94"/>
</g>
<!-- 6 -->
<g id="node6" class="node">
<title>6</title>
<polygon fill="orange" stroke="#ffa500" points="106.21,-40.66 79.04,-22.81 106.21,-4.96 133.38,-22.81 106.21,-40.66"/>
<polygon fill="none" stroke="#ffa500" points="106.21,-45.42 71.79,-22.81 106.21,-0.19 140.63,-22.81 106.21,-45.42"/>
<text text-anchor="middle" x="106.21" y="-19.11" font-family="Times,serif" font-size="14.00">6</text>
</g>
<!-- 1&#45;&gt;6 -->
<g id="edge7" class="edge">
<title>1&#45;&gt;6</title>
<path fill="none" stroke="black" d="M36.03,-84.59C49.53,-72.54 68.49,-55.6 83.15,-42.51"/>
<polygon fill="black" stroke="black" points="85.66,-44.96 90.79,-35.69 81,-39.74 85.66,-44.96"/>
</g>
<!-- 2&#45;&gt;1 -->
<g id="edge8" class="edge">
<title>2&#45;&gt;1</title>
<path fill="none" stroke="black" d="M87.32,-105.4C75.44,-106.64 59.6,-106.88 46.17,-106.13"/>
<polygon fill="black" stroke="black" points="46.28,-102.63 36.03,-105.31 45.72,-109.6 46.28,-102.63"/>
</g>
<!-- 3 -->
<g id="node3" class="node">
<title>3</title>
<polygon fill="orange" stroke="orange" points="212.42,-117.81 176.42,-117.81 176.42,-81.81 212.42,-81.81 212.42,-117.81"/>
<text text-anchor="middle" x="194.42" y="-96.11" font-family="Times,serif" font-size="14.00">3</text>
</g>
<!-- 2&#45;&gt;3 -->
<g id="edge9" class="edge">
<title>2&#45;&gt;3</title>
<path fill="none" stroke="black" d="M133.55,-99.81C143.84,-99.81 155.64,-99.81 166.03,-99.81"/>
<polygon fill="black" stroke="black" points="166.22,-103.31 176.22,-99.81 166.22,-96.31 166.22,-103.31"/>
</g>
<!-- 4 -->
<g id="node4" class="node">
<title>4</title>
<polygon fill="orange" stroke="orange" points="275.42,-117.81 248.42,-99.81 275.42,-81.81 302.42,-99.81 275.42,-117.81"/>
<text text-anchor="middle" x="275.42" y="-96.11" font-family="Times,serif" font-size="14.00">4</text>
</g>
<!-- 3&#45;&gt;4 -->
<g id="edge2" class="edge">
<title>3&#45;&gt;4</title>
<path fill="none" stroke="black" d="M212.56,-94.13C222.47,-93.06 235.17,-92.79 246.48,-93.32"/>
<polygon fill="black" stroke="black" points="246.54,-96.83 256.77,-94.07 247.05,-89.85 246.54,-96.83"/>
</g>
<!-- 5 -->
<g id="node5" class="node">
<title>5</title>
<polygon fill="orange" stroke="#ffa500" points="378.42,-94.81 342.42,-94.81 342.42,-58.81 378.42,-58.81 378.42,-94.81"/>
<polygon fill="none" stroke="#ffa500" points="382.42,-98.81 338.42,-98.81 338.42,-54.81 382.42,-54.81 382.42,-98.81"/>
<text text-anchor="middle" x="360.42" y="-73.11" font-family="Times,serif" font-size="14.00">5</text>
</g>
<!-- 3&#45;&gt;5 -->
<g id="edge1" class="edge">
<title>3&#45;&gt;5</title>
<path fill="none" stroke="black" d="M212.76,-88.34C222.73,-82.43 235.77,-75.84 248.42,-72.81 274.81,-66.47 305.72,-68.31 328.22,-71.25"/>
<polygon fill="black" stroke="black" points="327.82,-74.73 338.22,-72.7 328.83,-67.8 327.82,-74.73"/>
</g>
<!-- 4&#45;&gt;3 -->
<g id="edge4" class="edge">
<title>4&#45;&gt;3</title>
<path fill="none" stroke="black" d="M256.77,-105.54C246.77,-106.58 234.04,-106.82 222.78,-106.27"/>
<polygon fill="black" stroke="black" points="222.8,-102.76 212.56,-105.49 222.27,-109.74 222.8,-102.76"/>
</g>
<!-- 4&#45;&gt;5 -->
<g id="edge3" class="edge">
<title>4&#45;&gt;5</title>
<path fill="none" stroke="black" d="M294.84,-94.7C304.72,-91.97 317.14,-88.52 328.45,-85.39"/>
<polygon fill="black" stroke="black" points="329.72,-88.67 338.42,-82.63 327.85,-81.92 329.72,-88.67"/>
</g>
<!-- 6&#45;&gt;6 -->
<g id="edge5" class="edge">
<title>6&#45;&gt;6</title>
<path fill="none" stroke="black" d="M92.65,-37.03C86.05,-49.86 90.57,-63.61 106.21,-63.61 117.82,-63.61 123.3,-56.04 122.66,-46.89"/>
<polygon fill="black" stroke="black" points="125.94,-45.64 119.77,-37.03 119.22,-47.61 125.94,-45.64"/>
</g>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.50.0 (0)
-->
<!-- Title: sample Pages: 1 -->
<svg width="44pt" height="116pt"
viewBox="0.00 0.00 44.00 116.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 112)">
<title>sample</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-112 40,-112 40,4 -4,4"/>
<!-- a -->
<g id="node1" class="node">
<title>a</title>
<polygon fill="red" stroke="black" points="36,-108 0,-108 0,-72 36,-72 36,-108"/>
<text text-anchor="middle" x="18" y="-86.3" font-family="Times,serif" font-size="14.00">a</text>
</g>
<!-- b -->
<g id="node2" class="node">
<title>b</title>
<polygon fill="red" stroke="black" points="36,-36 0,-36 0,0 36,0 36,-36"/>
<text text-anchor="middle" x="18" y="-14.3" font-family="Times,serif" font-size="14.00">b</text>
</g>
<!-- a&#45;&gt;b -->
<g id="edge1" class="edge">
<title>a&#45;&gt;b</title>
<path fill="none" stroke="black" d="M18,-71.7C18,-63.98 18,-54.71 18,-46.11"/>
<polygon fill="black" stroke="black" points="21.5,-46.1 18,-36.1 14.5,-46.1 21.5,-46.1"/>
</g>
</g>
</svg>
......@@ -4,6 +4,7 @@
use std::collections::{HashMap, HashSet};
use std::hash::Hash;
use tracing::{debug, info, trace};
#[derive(PartialOrd, Ord, Clone, Debug)]
pub struct RedNode {
......@@ -97,7 +98,12 @@ pub fn winning_positions(
for winner in final_positions {
insert_node(winner.to_string(), &mut winning_positions, &mut pred);
}
// dbg!(&winning_positions, &pred);
{
debug!(
"[prestep] Winning positions after adding final positions: {:?}",
winning_positions
);
}
// Remove green nodes that have already been added to winners due to being final positions
greens = greens
.into_iter()
......@@ -107,6 +113,12 @@ pub fn winning_positions(
loop {
let (changed_greens, additional_winnings) =
pre(greens, &winning_positions, &succ, &mut pred);
{
debug!(
"[iter] Additional winning positions: {:?}",
additional_winnings
);
}
if additional_winnings.is_empty() {
return winning_positions;
}
......
mod arena;
use std::collections::{HashMap, HashSet};
use std::env;
use std::fs::{self, File};
use std::io::{Read, Write};
use std::rc::Rc;
use std::io::Write;
use clap::Parser;
use dot_generator::*;
use dot_structures::*;
......@@ -13,32 +13,73 @@ use graphviz_rust::cmd::{CommandArg, Format};
use graphviz_rust::printer::{DotPrinter, PrinterContext};
use graphviz_rust::*;
use graphviz_rust::{exec, parse};
use tracing_subscriber::fmt;
use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt;
use crate::arena::*;
#[derive(Parser, Debug)]
#[clap(about)]
struct Args {
/// input .dot-file
#[clap(parse(from_os_str))]
in_file: std::path::PathBuf,
/// Rendering of arena as svg (needs graphviz)
#[clap(long, parse(from_os_str))]
out: Option<std::path::PathBuf>,
/// Rendering of arena as svg, winning positions (needs graphviz)
#[clap(long, parse(from_os_str))]
out_solved: Option<std::path::PathBuf>,
/// Shows debug-info when running the algorithm
#[clap(short, long)]
debug: bool,
}
fn main() {
let mut args = env::args();
let filename = args.next().unwrap();
let infilename = args.next().unwrap_or_else(|| "src/sample.dot".to_string());
dbg!(&filename, &infilename);
let input = fs::read_to_string(infilename).expect("Could not read infile!");
dbg!(&input);
let args = Args::parse();
// Set up debug-info if chosen
if args.debug {
// Not using the env-variable for this, so setting it up manually.
let fmt_layer = fmt::layer().with_target(false).without_time();
let filter_layer = tracing_subscriber::filter::LevelFilter::DEBUG;
tracing_subscriber::registry()
.with(fmt_layer)
.with(filter_layer)
.init();
}
let input = fs::read_to_string(args.in_file).expect("Could not read infile!");
let g = parse(&input).unwrap();
let (greens, reds, final_positions, succ, pred) = build_inputs(&g);
// dbg!(greens, reds, final_positions, succ, pred);
let winners = arena::winning_positions(&greens, &final_positions, &succ, pred);
let g2 = build_graph(&greens, &reds, &final_positions, &succ, Some(&winners));
println!("{}", g2.print(&mut PrinterContext::default()));
if let Some(path) = args.out {
let g_out = build_graph(&reds, &greens, &final_positions, &succ, None);
output(&g_out, path);
}
dbg!(winners);
if let Some(path) = args.out_solved {
let g_out_solved = build_graph(&reds, &greens, &final_positions, &succ, Some(&winners));
output(&g_out_solved, path);
}
output(&g2);
if winners.is_empty() {
println!("There are no winning positions in this game.");
} else {
let mut winners: Vec<String> = winners.into_iter().collect();
winners.sort();
println!("Winning positions are: {}", winners.join(", "));
}
}
fn node_id(node: &Node) -> &String {
......@@ -164,12 +205,11 @@ fn build_graph(
};
node.attributes.push(attr!("color", colour));
} else {
node.attributes
.push(NodeAttributes::color(if is_winning {
color_name::orange
} else {
color_name::red4
}));
node.attributes.push(NodeAttributes::color(if is_winning {
color_name::orange
} else {
color_name::red4
}));
}
node
}
......@@ -238,7 +278,7 @@ fn change_graph(g: &Graph) -> Graph {
Graph::DiGraph { id, strict, stmts }
}
fn output(g: &Graph) {
fn output(g: &Graph, path: std::path::PathBuf) {
let graph_svg = exec(
g.clone(),
PrinterContext::default(),
......@@ -246,6 +286,6 @@ fn output(g: &Graph) {
)
.unwrap();
let mut file = File::create("out.svg").unwrap();
let mut file = File::create(path).unwrap();
file.write_all(graph_svg.as_bytes()).unwrap();
}
digraph sample {
a
b
a -> b
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment