Browse Source

Added -importprismpp option to import directly from preprocessor files.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@3239 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 15 years ago
parent
commit
be2d5d7b55
  1. 19
      prism/src/prism/Prism.java
  2. 17
      prism/src/prism/PrismCL.java

19
prism/src/prism/Prism.java

@ -879,6 +879,25 @@ public class Prism implements PrismSettingsListener
return parseModelString(modelString);
}
/**
* Import a PRISM model from a PRISM preprocessor file
*/
public ModulesFile importPrismPreprocFile(File file, String params[]) throws PrismException
{
String modelString;
// Compile preprocessor file to a string
Preprocessor pp = new Preprocessor(this, file);
pp.setParameters(params);
modelString = pp.preprocess();
if (modelString == null) {
throw new PrismException("No preprocessing information");
}
// Parse string as PRISM model and return
return parseModelString(modelString);
}
// parse properties from file
// nb: need to pass in modules file to access its constants
// but if its null, we just create a blank one for you.

17
prism/src/prism/PrismCL.java

@ -43,6 +43,7 @@ public class PrismCL
private boolean verbose;
private boolean fixdl = false;
private boolean importpepa = false;
private boolean importprismpp = false;
private boolean importtrans = false;
private boolean importstates = false;
private boolean importlabels = false;
@ -86,6 +87,9 @@ public class PrismCL
// argument to -simpath switch
private String simpathDetails = null;
// argument to -importprismpp switch
private String prismppParams = null;
// files/filenames
private String mainLogFilename = "stdout";
private String techLogFilename = "stdout";
@ -525,6 +529,10 @@ public class PrismCL
if (importpepa) {
mainLog.print("\nImporting PEPA file \"" + modelFilename + "\"...\n");
modulesFile = prism.importPepaFile(new File(modelFilename));
} else if (importprismpp) {
mainLog.print("\nImporting PRISM preprocessor file \"" + modelFilename + "\"...\n");
String prismppParamsList[] = ("? " + prismppParams).split(" ");
modulesFile = prism.importPrismPreprocFile(new File(modelFilename), prismppParamsList);
} else if (importtrans) {
mainLog.print("\nImporting model (");
mainLog.print(typeOverride == null ? "MDP" : typeOverride);
@ -1130,6 +1138,15 @@ public class PrismCL
else if (sw.equals("importpepa")) {
importpepa = true;
}
// Import model from PRISM preprocessor
else if (sw.equals("importprismpp")) {
if (i < args.length - 1) {
importprismpp = true;
prismppParams = args[++i];
} else {
errorAndExit("No parameters specified for -" + sw + " switch");
}
}
// import model from explicit format
else if (sw.equals("importtrans")) {
importtrans = true;

Loading…
Cancel
Save