Loading e-Knife/src/main/java/eknife/EKnife.java +19 −16 Original line number Diff line number Diff line /* * e-Knife, a program slicing tool for Erlang based on the EDG * Copyright (c) 2021. David Insa, Sergio Pérez, Josep Silva, Salvador Tamarit. * EDG, a library to generate and slice Expression Dependence Graphs. * Copyright (c) 2021-2023. David Insa, Carlos Galindo, Sergio Pérez, Josep Silva, Salvador Tamarit. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as Loading Loading @@ -113,11 +113,16 @@ public class EKnife { case "--ignore-constraints": kArgs.constrainedAlgorithm = false; break; case "--intraprocedural": kArgs.intraproceduralAlgorithm = true; case "--single-function": kArgs.singleFunction = true; break; case "--tabular": kArgs.tabular = true; case "--ignore-calling-context": kArgs.pdgAlgorithm = true; break; default: System.out.println("Unknown parameter " + arg); printHelp(); System.exit(1); } } Loading @@ -138,8 +143,8 @@ public class EKnife { help += " -G,--print-graph <file.dot> Exports the graph as a dot file\n"; help += " -G,--print-graph <file.pdf> Exports the graph as a PDF file\n"; help += " --ignore-constraints Generates constraints but ignores when slicing\n"; help += " --intraprocedural Makes the slice intraprocedural, the algorithm will not traverse function bounds\n"; help += " --tabular Uses the tabular slicing algorithm, skipping summary generation.\n"; help += " --ignore-calling-context Use a context-insensitive algorithm (will cross through functions).\n"; help += " --single-function The graph and the algorithm will not cross function bounds\n"; help += " --help Show this message.\n"; System.out.print(help); Loading @@ -147,7 +152,7 @@ public class EKnife { private static void run(Args a) { final LAST last = LASTFactory.createLAST(Language.Erlang, a.inputPath, true); final EDG edg = new EDGFactory(last, !a.intraproceduralAlgorithm).createEDG(); final EDG edg = new EDGFactory(last, !a.singleFunction).createEDG(); final SlicingCriterion slicingCriterion = new SlicingCriterion(a.file, a.line, a.name, a.occurrence); final Node SC; Loading Loading @@ -194,9 +199,9 @@ public class EKnife { int occurrence = 1; File graphFile; GraphFormat graphFormat; boolean intraproceduralAlgorithm = false; boolean singleFunction = false; boolean pdgAlgorithm = false; boolean constrainedAlgorithm = true; boolean tabular = false; Class<? extends SlicingAlgorithm> algClass; void setGraphFile(File graphFile) { Loading @@ -214,11 +219,9 @@ public class EKnife { void completeData() { if (file == null && inputPath != null && new File(inputPath).isFile()) file = new File(inputPath).getName(); if (intraproceduralAlgorithm) algClass = constrainedAlgorithm ? OnePassConstrainedAlgorithm.class : AdaptedStandardAlgorithm.class; else algClass = constrainedAlgorithm ? ConstrainedAlgorithm.class : StandardAlgorithm.class; if (tabular) algClass = constrainedAlgorithm ? ConstrainedTabularAlgorithm.class : TabularAlgorithm.class; if (pdgAlgorithm || singleFunction) algClass = constrainedAlgorithm ? OnePassConstrainedAlgorithm.class : OnePassStandardAlgorithm.class; else algClass = constrainedAlgorithm ? ConstrainedTabularAlgorithm.class : TabularAlgorithm.class; } boolean isValid() { Loading Loading
e-Knife/src/main/java/eknife/EKnife.java +19 −16 Original line number Diff line number Diff line /* * e-Knife, a program slicing tool for Erlang based on the EDG * Copyright (c) 2021. David Insa, Sergio Pérez, Josep Silva, Salvador Tamarit. * EDG, a library to generate and slice Expression Dependence Graphs. * Copyright (c) 2021-2023. David Insa, Carlos Galindo, Sergio Pérez, Josep Silva, Salvador Tamarit. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as Loading Loading @@ -113,11 +113,16 @@ public class EKnife { case "--ignore-constraints": kArgs.constrainedAlgorithm = false; break; case "--intraprocedural": kArgs.intraproceduralAlgorithm = true; case "--single-function": kArgs.singleFunction = true; break; case "--tabular": kArgs.tabular = true; case "--ignore-calling-context": kArgs.pdgAlgorithm = true; break; default: System.out.println("Unknown parameter " + arg); printHelp(); System.exit(1); } } Loading @@ -138,8 +143,8 @@ public class EKnife { help += " -G,--print-graph <file.dot> Exports the graph as a dot file\n"; help += " -G,--print-graph <file.pdf> Exports the graph as a PDF file\n"; help += " --ignore-constraints Generates constraints but ignores when slicing\n"; help += " --intraprocedural Makes the slice intraprocedural, the algorithm will not traverse function bounds\n"; help += " --tabular Uses the tabular slicing algorithm, skipping summary generation.\n"; help += " --ignore-calling-context Use a context-insensitive algorithm (will cross through functions).\n"; help += " --single-function The graph and the algorithm will not cross function bounds\n"; help += " --help Show this message.\n"; System.out.print(help); Loading @@ -147,7 +152,7 @@ public class EKnife { private static void run(Args a) { final LAST last = LASTFactory.createLAST(Language.Erlang, a.inputPath, true); final EDG edg = new EDGFactory(last, !a.intraproceduralAlgorithm).createEDG(); final EDG edg = new EDGFactory(last, !a.singleFunction).createEDG(); final SlicingCriterion slicingCriterion = new SlicingCriterion(a.file, a.line, a.name, a.occurrence); final Node SC; Loading Loading @@ -194,9 +199,9 @@ public class EKnife { int occurrence = 1; File graphFile; GraphFormat graphFormat; boolean intraproceduralAlgorithm = false; boolean singleFunction = false; boolean pdgAlgorithm = false; boolean constrainedAlgorithm = true; boolean tabular = false; Class<? extends SlicingAlgorithm> algClass; void setGraphFile(File graphFile) { Loading @@ -214,11 +219,9 @@ public class EKnife { void completeData() { if (file == null && inputPath != null && new File(inputPath).isFile()) file = new File(inputPath).getName(); if (intraproceduralAlgorithm) algClass = constrainedAlgorithm ? OnePassConstrainedAlgorithm.class : AdaptedStandardAlgorithm.class; else algClass = constrainedAlgorithm ? ConstrainedAlgorithm.class : StandardAlgorithm.class; if (tabular) algClass = constrainedAlgorithm ? ConstrainedTabularAlgorithm.class : TabularAlgorithm.class; if (pdgAlgorithm || singleFunction) algClass = constrainedAlgorithm ? OnePassConstrainedAlgorithm.class : OnePassStandardAlgorithm.class; else algClass = constrainedAlgorithm ? ConstrainedTabularAlgorithm.class : TabularAlgorithm.class; } boolean isValid() { Loading