From 49d182a6e42d97ce7f65f4e33711cd31dbedf1d0 Mon Sep 17 00:00:00 2001 From: Markus Alexander Kuppe Date: Tue, 3 Dec 2019 13:31:26 -0800 Subject: [PATCH] Add TLCExt!PickSuccessor that, when set up as an action constraint, lets users interactively explore the state graph. This is based on a new TLC module override feature introduced with git commit bb64cfd921c2e8846f47a5818d85cd0e8f2aa2c5 https://github.com/tlaplus/tlaplus/commit/bb64cfd921c2e8846f47a5818d85cd0e8f2aa2c5 Can't think of a test right now that fits the current (stateless) framework. :-( --- build.xml | 2 +- modules/TLCExt.tla | 12 +++ modules/tlc2/overrides/TLCExt.java | 96 ++++++++++++++++++++++++ modules/tlc2/overrides/TLCOverrides.java | 37 +++++++++ 4 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 modules/tlc2/overrides/TLCExt.java create mode 100644 modules/tlc2/overrides/TLCOverrides.java diff --git a/build.xml b/build.xml index dd52fb1..c7560b1 100644 --- a/build.xml +++ b/build.xml @@ -27,7 +27,7 @@ + includes="**/*.class"/> \n%s", s0.toString().trim(), s1.toString().trim())); + } else if (nextLine.charAt(0) == 'd') { + MP.printMessage(EC.TLC_MODULE_OVERRIDE_STDOUT, s1.toString(s0)); + } else if (nextLine.charAt(0) == 'n') { + return BoolValue.ValFalse; + } + } + } +} diff --git a/modules/tlc2/overrides/TLCOverrides.java b/modules/tlc2/overrides/TLCOverrides.java new file mode 100644 index 0000000..4e59fd5 --- /dev/null +++ b/modules/tlc2/overrides/TLCOverrides.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2019 Microsoft Research. All rights reserved. + * + * The MIT License (MIT) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Contributors: + * Markus Alexander Kuppe - initial API and implementation + ******************************************************************************/ +package tlc2.overrides; + +// tlc2.tool.impl.SpecProcessor's "api" only loads class +// "tlc2.overrides.TLCOverrides". +public class TLCOverrides implements ITLCOverrides { + + @SuppressWarnings("rawtypes") + @Override + public Class[] get() { + return new Class[] {TLCExt.class}; + } +}