public JParser(IEnumerable<string> path, string save) { UppaalModel model = new UppaalModel(); var jClasses = new List<JClass>(); ClassNames.Add("Object"); foreach (var p in path) { var jClass = new JClass(p); ClassNames.Add(jClass.Name); jClasses.Add(jClass); foreach (var method in jClass.Methods) { var methodName = JClass.FirstNonKeyword(method.First()); if (!MethodNames.Contains(methodName)) { MethodNames.Add(methodName); } } } foreach (var jClass in jClasses) { model.AddTemplates(jClass); } var methods = new List<string>(); foreach (var jClass in jClasses) { jClass.SetSuper(jClasses); methods.AddRange(jClass.Methods.Select(x => jClass.Name + "_" + JClass.FirstNonKeyword(x.First()))); } //Build the heap foreach (var jClass in jClasses) { jClass.UpdateFields(); } foreach (var jClass in jClasses) { jClass.FindAloc(); } //var heap = AllocateHeap(JClass.GetAloc(jClasses.First().GetMethod("install")), jClasses); //Add Invoke model.AddInvokevirtual(jClasses); model.InitDec(10,3,3, methods); model.Save(save); }
public Rewriter(string path) { UppaalModel uml; // countermeasure parameter has to fit UPPAAL rewrite mode - e.g. "pc" for PCFault and "heap" for heap fault // should we handle Uppaal model generation without faults? uml = new UppaalModel(path, "pc"); uml.rewritePCFault(path.Split('.').First() + "_pcRewrite.xml"); uml = new UppaalModel(path, "heap"); uml.rewriteHeapFault(path.Split('.').First() + "_heapRewrite.xml"); uml = new UppaalModel(path, "locals"); uml.rewriteLocalFault(path.Split('.').First() + "_localRewrite.xml"); uml = new UppaalModel(path, "instruction"); uml.addErrorLocation(); uml.rewriteInstructionFault(path.Split('.').First() + "_instructionRewrite.xml"); uml = new UppaalModel(path, "opstack"); uml.rewriteOpstackFault(path.Split('.').First() + "_opstackRewrite.xml"); }