-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into unstable
- Loading branch information
Showing
3 changed files
with
112 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Testing compiling slugs | ||
|
||
on: [push] | ||
|
||
env: | ||
BUILD_TYPE: Release | ||
CCACHE_VERSION: 4.2.1 | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.config.name }} | ||
runs-on: ${{ matrix.config.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- { | ||
name: "Ubuntu Latest GCC", | ||
os: ubuntu-latest, | ||
cc: "gcc", cxx: "g++" | ||
} | ||
- { | ||
name: "MacOs Latest", | ||
os: macos-latest, | ||
} | ||
|
||
|
||
steps: | ||
# SRC: https://stackoverflow.com/questions/67457510/git-submodule-update-remote-merge-yields-fatal-needed-a-single-revision | ||
- uses: actions/checkout@main | ||
with: | ||
# we need the submodules. | ||
submodules: recursive | ||
- name: Update submodule. | ||
run: git submodule update --remote | ||
- name: Install various packages needed | ||
run: | | ||
if [ "$RUNNER_OS" == "Linux" ]; then | ||
sudo apt-get install build-essential libboost-all-dev | ||
elif [ "$RUNNER_OS" == "Windows" ]; then | ||
# Unsupported as of now. | ||
choco install stuff | ||
elif [ "$RUNNER_OS" == "macOS" ]; then | ||
brew install boost | ||
else | ||
echo "$RUNNER_OS not supported" | ||
exit 1 | ||
fi | ||
- name: Make the slugs executable | ||
run: cd src; make | ||
- name: Test a simple slugs run | ||
run: time src/slugs examples/firefighting.slugsin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Takes the output of "slugs --explicitStrategy ...other options..." and generates input to GraphViz from it. | ||
# | ||
# Pipe the output of slugs to this tool | ||
import sys | ||
|
||
propositions = None | ||
states = {} | ||
transitions = {} | ||
|
||
for line in sys.stdin.readlines(): | ||
if line.startswith("State"): | ||
assert line.count("<")==1 | ||
|
||
# Split line into state/rank number and proposition values | ||
linePart1 = line[0:line.index("<")] | ||
linePart2 = line[line.index("<"):].strip() | ||
linePart1 = linePart1.split(" ") | ||
stateNo = linePart1[1] | ||
rank = linePart1[4] | ||
|
||
# Parsing proposition values | ||
assert linePart2[0]=="<" | ||
assert linePart2[-1]==">" | ||
linePart2 = [a.strip().split(":") for a in linePart2[1:len(linePart2)-1].split(",")] | ||
thesePropositions = [a[0] for a in linePart2] | ||
theseValues = [a[1] for a in linePart2] | ||
|
||
if not propositions is None: | ||
assert propositions == thesePropositions | ||
propositions = thesePropositions | ||
|
||
states[stateNo] = (rank,theseValues) | ||
if line.strip().startswith("With successors : "): | ||
successors = line.strip()[18:] | ||
successors = [a.strip() for a in successors.split(",")] | ||
transitions[stateNo] = successors | ||
|
||
# Empty output | ||
if len(states)==0: | ||
print("digraph { \"Empty implementation\"; }") | ||
sys.exit(0) | ||
|
||
# Parsing done. Write | ||
print("digraph {") | ||
print("node [shape=tab] \""+",".join(propositions)+"\";") | ||
|
||
for (state,(rank,values)) in states.items(): | ||
print("\""+state+"\" [shape=box,label=\""+"".join(values)+"/"+rank+"\"];") | ||
for state in states: | ||
for b in transitions[state]: | ||
print("\""+state+"\" -> \""+str(b)+"\";") | ||
print("}") | ||
|
||
|