Browse Source

Added -exportprismconst switch.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@2178 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 16 years ago
parent
commit
25b65c4f26
  1. 3
      prism/NOTES
  2. 46
      prism/src/prism/PrismCL.java

3
prism/NOTES

@ -16,6 +16,9 @@ PTAs:
* non-zeno checks? * non-zeno checks?
* Sort VarList (two types - before and after constants evaluated). Need for simulator too. * Sort VarList (two types - before and after constants evaluated). Need for simulator too.
Sim(?):
* Auto x100 in GUI sim doesn't stop on even simple loops
======================================================= =======================================================
TODO (before public release) TODO (before public release)

46
prism/src/prism/PrismCL.java

@ -58,6 +58,7 @@ public class PrismCL
private boolean exportbsccs = false; private boolean exportbsccs = false;
private boolean exportresults = false; private boolean exportresults = false;
private boolean exportprism = false; private boolean exportprism = false;
private boolean exportprismconst = false;
private boolean exportPlainDeprecated = false; private boolean exportPlainDeprecated = false;
private int exportType = Prism.EXPORT_PLAIN; private int exportType = Prism.EXPORT_PLAIN;
private boolean exportordered = true; private boolean exportordered = true;
@ -97,6 +98,7 @@ public class PrismCL
private String exportResultsFilename = null; private String exportResultsFilename = null;
private String exportTransientFilename = null; private String exportTransientFilename = null;
private String exportPrismFilename = null; private String exportPrismFilename = null;
private String exportPrismConstFilename = null;
private String simpathFilename = null; private String simpathFilename = null;
// logs // logs
@ -230,13 +232,37 @@ public class PrismCL
// output final prism model here if required // output final prism model here if required
if (exportprism) { if (exportprism) {
mainLog.print("\nExporting parsed PRISM file ");
if (!exportPrismFilename.equals("stdout"))
mainLog.println("to file \"" + exportPrismFilename + "\"...");
else
mainLog.println("below:");
PrismFileLog tmpLog = new PrismFileLog(exportPrismFilename);
if (!tmpLog.ready()) {
errorAndExit("Couldn't open file \"" + exportPrismFilename + "\" for output");
}
tmpLog.print(modulesFile.toString());
}
if (exportprismconst) {
mainLog.print("\nExporting parsed PRISM file (with constant expansion) ");
if (!exportPrismConstFilename.equals("stdout"))
mainLog.println("to file \"" + exportPrismConstFilename + "\"...");
else
mainLog.println("below:");
PrismFileLog tmpLog = new PrismFileLog(exportPrismConstFilename);
if (!tmpLog.ready()) {
errorAndExit("Couldn't open file \"" + exportPrismConstFilename + "\" for output");
}
ModulesFile mfTmp = (ModulesFile) modulesFile.deepCopy();
try { try {
FileWriter writer = new FileWriter(exportPrismFilename);
writer.write(modulesFile.toString());
writer.close();
} catch (IOException e) {
error("Could not export PRISM model to file \"" + exportPrismFilename + "\"");
mfTmp = (ModulesFile) mfTmp.replaceConstants(modulesFile.getConstantValues());
mfTmp = (ModulesFile) mfTmp.replaceConstants(definedMFConstants);
// NB: Don't use simplify() here because doesn't work for the purposes of printing out
// (e.g. loss of parethenses causes precedence problems)
} catch (PrismLangException e) {
error(e.getMessage());
} }
tmpLog.print(mfTmp.toString());
} }
// decide if model construction is necessary // decide if model construction is necessary
@ -1019,6 +1045,15 @@ public class PrismCL
errorAndExit("No file specified for -" + sw + " switch"); errorAndExit("No file specified for -" + sw + " switch");
} }
} }
// export prism model to file (with consts expanded)
else if (sw.equals("exportprismconst")) {
if (i < args.length - 1) {
exportprismconst = true;
exportPrismConstFilename = args[++i];
} else {
errorAndExit("No file specified for -" + sw + " switch");
}
}
// export adversary to file // export adversary to file
else if (sw.equals("exportadv")) { else if (sw.equals("exportadv")) {
if (i < args.length - 1) { if (i < args.length - 1) {
@ -1742,6 +1777,7 @@ public class PrismCL
mainLog.println("-exportbsccs <file> ............ Compute and export all BSCCs of the model"); mainLog.println("-exportbsccs <file> ............ Compute and export all BSCCs of the model");
mainLog.println("-exporttransient <file> ........ Export transient probabilities to a file"); mainLog.println("-exporttransient <file> ........ Export transient probabilities to a file");
mainLog.println("-exportprism <file> ............ Export final PRISM model to a file"); mainLog.println("-exportprism <file> ............ Export final PRISM model to a file");
mainLog.println("-exportprismconst <file> ....... Export final PRISM model with expanded constants to a file");
mainLog.println(); mainLog.println();
mainLog.println("-mtbdd (or -m) ................. Use the MTBDD engine"); mainLog.println("-mtbdd (or -m) ................. Use the MTBDD engine");
mainLog.println("-sparse (or -s) ................ Use the Sparse engine"); mainLog.println("-sparse (or -s) ................ Use the Sparse engine");

Loading…
Cancel
Save