Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| da5a365dcf | |||
| 62aa417523 | |||
| dd774fcc67 | |||
| dbb2c0a69b | |||
| e8b1ba7b23 | |||
| 381bc04e61 | |||
| debb2220a0 |
@@ -23,7 +23,8 @@ public class Launcher {
|
||||
Properties appProps = new Properties();
|
||||
|
||||
// String appConfigPath = "/Users/anil.koyuncu/projects/fixminer/fixminer_source/src/main/resource/app.properties";
|
||||
String appConfigPath = args[0];
|
||||
// String appConfigPath = args[0];
|
||||
String appConfigPath = "src/main/resource/app.properties";
|
||||
appProps.load(new FileInputStream(appConfigPath));
|
||||
|
||||
// String portInner = appProps.getProperty("portInner","6380");
|
||||
@@ -40,12 +41,12 @@ public class Launcher {
|
||||
String redisPath = appProps.getProperty("redisPath","FORKJOIN");
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
String parameter = args[2];
|
||||
// String parameter = "L1";
|
||||
// String parameter = args[2];
|
||||
String parameter = "L1";
|
||||
// String parameter = "if";
|
||||
// String parameter = "add";
|
||||
String jobType = args[1];
|
||||
// String jobType = "RICHEDITSCRIPT";
|
||||
// String jobType = args[1];
|
||||
String jobType = "RICHEDITSCRIPT";
|
||||
// String jobType = "LOAD";
|
||||
// String jobType = "COMPARE";
|
||||
|
||||
@@ -93,6 +94,7 @@ public class Launcher {
|
||||
case "L1":
|
||||
// job = "shape";
|
||||
job = "single";
|
||||
|
||||
compareDBName = "clusterl0-gumInputALL.rdb";
|
||||
break;
|
||||
case "L2":
|
||||
|
||||
@@ -66,7 +66,7 @@ public class CompareTrees {
|
||||
Integer numberOfWorkers = Integer.valueOf(numOfWorkers);
|
||||
final ExecutorService executor = Executors.newWorkStealingPool(numberOfWorkers);
|
||||
ArrayList<Future<?>> results = new ArrayList<Future<?>>();
|
||||
for (int i = 1; i <numberOfWorkers ; i++) {
|
||||
for (int i = 0; i <numberOfWorkers ; i++) {
|
||||
|
||||
|
||||
// schedule the work
|
||||
|
||||
@@ -44,6 +44,7 @@ public class HierarchicalRegrouperForC {
|
||||
/*
|
||||
* Second, group actions by their positions.
|
||||
*/
|
||||
|
||||
HierarchicalActionSet actionSet = null;
|
||||
for(Action act : actions){
|
||||
if(act.getNode().getType() == 2){
|
||||
@@ -55,6 +56,7 @@ public class HierarchicalRegrouperForC {
|
||||
actionSet = createActionSet(act, parentAct, null);
|
||||
actionSets.add(actionSet);
|
||||
} else {
|
||||
// if (!addToAactionSet(act, parentAct, actionSets)) {
|
||||
if (!addToAactionSet(act, parentAct, actionSets)) {
|
||||
// The index of the parent action in the actions' list is larger than the index of this action.
|
||||
actionSet = createActionSet(act, parentAct, null);
|
||||
@@ -71,6 +73,7 @@ public class HierarchicalRegrouperForC {
|
||||
Action parentAct = actSet.getParentAction();
|
||||
if (parentAct != null) {
|
||||
addToActionSets(actSet, parentAct, actionSets);
|
||||
actionSets.set(actionSets.indexOf(actSet), null);
|
||||
} else {
|
||||
// TypeDeclaration, FieldDeclaration, MethodDeclaration, Statement.
|
||||
// CatchClause, ConstructorInvocation, SuperConstructorInvocation, SwitchCase
|
||||
@@ -78,21 +81,46 @@ public class HierarchicalRegrouperForC {
|
||||
// if (astNodeType.endsWith("TypeDeclaration") || astNodeType.endsWith("FieldDeclaration") || astNodeType.endsWith("EnumDeclaration") ||
|
||||
// astNodeType.endsWith("MethodDeclaration") || astNodeType.endsWith("Statement") ||
|
||||
// astNodeType.endsWith("ConstructorInvocation") || astNodeType.endsWith("CatchClause") || astNodeType.endsWith("SwitchCase")) {
|
||||
if (isStatement(actSet.getNode())) {
|
||||
// if (isStatement(actSet.getNode())) {
|
||||
reActionSets.add(actSet);
|
||||
}
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// return reActionSets1;
|
||||
// return reActionSets;
|
||||
|
||||
List<HierarchicalActionSet> re2ActionSets = new ArrayList<>();
|
||||
for (HierarchicalActionSet act:reActionSets){
|
||||
if (!act.getAction().getClass().equals(Update.class) || ((Update) act.getAction()).getflag() == true){
|
||||
re2ActionSets.add(act);
|
||||
continue;
|
||||
}
|
||||
findRealAction(act, re2ActionSets);
|
||||
|
||||
}
|
||||
|
||||
List<HierarchicalActionSet> reActionSets1 = new ArrayList<>();
|
||||
for(HierarchicalActionSet a:reActionSets){
|
||||
for(HierarchicalActionSet a:re2ActionSets){
|
||||
HierarchicalActionSet hierarchicalActionSet = removeBlocks(a);
|
||||
hierarchicalActionSet = removeIFthenBlocks(hierarchicalActionSet);
|
||||
reActionSets1.add(hierarchicalActionSet);
|
||||
|
||||
}
|
||||
|
||||
return reActionSets1;
|
||||
// return reActionSets;
|
||||
}
|
||||
|
||||
private void findRealAction(HierarchicalActionSet act, List<HierarchicalActionSet> re2ActionSets) {
|
||||
if (!act.getAction().getClass().equals(Update.class) || ((Update) act.getAction()).getflag() == true){
|
||||
re2ActionSets.add(act);
|
||||
return;
|
||||
}
|
||||
for (HierarchicalActionSet a:act.getSubActions()){
|
||||
findRealAction(a, re2ActionSets);
|
||||
}
|
||||
}
|
||||
|
||||
private HierarchicalActionSet removeBlocks(HierarchicalActionSet actionSet){
|
||||
@@ -145,6 +173,7 @@ public class HierarchicalRegrouperForC {
|
||||
}
|
||||
return actionSet;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private HierarchicalActionSet createActionSet(Action act, Action parentAct, HierarchicalActionSet parent) {
|
||||
@@ -189,7 +218,7 @@ public class HierarchicalRegrouperForC {
|
||||
private void addToActionSets(HierarchicalActionSet actionSet, Action parentAct, List<HierarchicalActionSet> actionSets) {
|
||||
Action act = actionSet.getAction();
|
||||
for (HierarchicalActionSet actSet : actionSets) {
|
||||
if (actSet.equals(actionSet)) continue;
|
||||
if (actSet == null || actSet.equals(actionSet)) continue;
|
||||
Action action = actSet.getAction();
|
||||
|
||||
if (!areRelatedActions(action, act)) continue;
|
||||
|
||||
@@ -32,8 +32,9 @@ public class TestPredefinedCases {
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
File revFile = new File("src/main/resource/testFiles/if_example_1.c");
|
||||
File prevFile =new File("src/main/resource/testFiles/prev_if_example_1.c");
|
||||
File revFile = new File("src/main/resource/testFiles/if_example_1.c");
|
||||
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
@@ -48,14 +49,50 @@ public class TestPredefinedCases {
|
||||
"---------UPD operator@@>= @TO@ > @AT@ 5 @LENGTH@ 2\n");
|
||||
|
||||
}
|
||||
@Test
|
||||
public void testIFCase2() throws IOException {
|
||||
Properties appProps = new Properties();
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
File prevFile =new File("src/main/resource/testFiles/prev_if_example_2.c");
|
||||
File revFile = new File("src/main/resource/testFiles/if_example_2.c");
|
||||
|
||||
|
||||
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
hierarchicalActionSets.size();
|
||||
Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
|
||||
Assert.assertEquals(hierarchicalActionSets.get(0).toString(),"UPD if@@i > 0 j > i x = j x = i @TO@ i > 0 j >= i x = j x != i @AT@ 3 @LENGTH@ 23\n" +
|
||||
"---UPD then@@j > i x = j x = i @TO@ j >= i x = j x != i @AT@ 19 @LENGTH@ 17\n" +
|
||||
"------UPD block@@j > i x = j x = i @TO@ j >= i x = j x != i @AT@ 19 @LENGTH@ 17\n" +
|
||||
"---------UPD if@@j > i x = j x = i @TO@ j >= i x = j x != i @AT@ 19 @LENGTH@ 17\n" +
|
||||
"------------UPD condition@@j > i @TO@ j >= i @AT@ 19 @LENGTH@ 10\n" +
|
||||
"---------------UPD expr@@j > i @TO@ j >= i @AT@ 21 @LENGTH@ 5\n" +
|
||||
"------------------UPD operator@@> @TO@ >= @AT@ 23 @LENGTH@ 1\n" +
|
||||
"------------UPD else@@x = i @TO@ x != i @AT@ 61 @LENGTH@ 5\n" +
|
||||
"---------------UPD block@@x = i @TO@ x != i @AT@ 61 @LENGTH@ 5\n" +
|
||||
"------------------UPD expr_stmt@@x = i @TO@ x != i @AT@ 61 @LENGTH@ 5\n" +
|
||||
"---------------------UPD expr@@x = i @TO@ x != i @AT@ 61 @LENGTH@ 5\n" +
|
||||
"------------------------UPD operator@@= @TO@ != @AT@ 63 @LENGTH@ 1\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testForCase1() throws IOException {
|
||||
Properties appProps = new Properties();
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
File revFile = new File("src/main/resource/testFiles/for_example_1.c");
|
||||
File prevFile =new File("src/main/resource/testFiles/prev_for_example_1.c");
|
||||
File revFile = new File("src/main/resource/testFiles/for_example_1.c");
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -84,16 +121,19 @@ public class TestPredefinedCases {
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath", "FORKJOIN");
|
||||
|
||||
|
||||
File revFile = new File("src/main/resource/testFiles/while_example_1.c");
|
||||
File prevFile = new File("src/main/resource/testFiles/prev_while_example_1.c");
|
||||
|
||||
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
hierarchicalActionSets.size();
|
||||
Assert.assertEquals(hierarchicalActionSets.size(), 1);
|
||||
|
||||
|
||||
Assert.assertEquals(hierarchicalActionSets.get(0).toString(), "UPD do@@y = f x x -- print x x > 0 @TO@ y = f x x -- x > 0 @AT@ 0 @LENGTH@ 62\n" +
|
||||
"---UPD block@@y = f x x -- print x @TO@ y = f x x -- @AT@ 3 @LENGTH@ 42\n" +
|
||||
"------DEL expr_stmt@@print x @AT@ 33 @LENGTH@ 7\n" +
|
||||
@@ -137,6 +177,7 @@ public class TestPredefinedCases {
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
|
||||
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
hierarchicalActionSets.size();
|
||||
// Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
@@ -160,9 +201,404 @@ public class TestPredefinedCases {
|
||||
// Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnionCase1() throws IOException {
|
||||
Properties appProps = new Properties();
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
File prevFile =new File("src/main/resource/testFiles/prev_union_example_1.c");
|
||||
File revFile = new File("src/main/resource/testFiles/union_example_1.c");
|
||||
|
||||
|
||||
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
hierarchicalActionSets.size();
|
||||
Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
|
||||
Assert.assertEquals(hierarchicalActionSets.get(0).toString(),"UPD union@@sign int svar unsigned uvar unsigned virus number @TO@ sign int svar unsigned uvar number @AT@ 0 @LENGTH@ 75\n" +
|
||||
"---UPD block@@int svar unsigned uvar unsigned virus @TO@ int svar unsigned uvar @AT@ 10 @LENGTH@ 57\n" +
|
||||
"------DEL decl_stmt@@unsigned virus @AT@ 49 @LENGTH@ 14\n" +
|
||||
"---------DEL decl@@unsigned virus @AT@ 49 @LENGTH@ 14\n" +
|
||||
"------------DEL type@@unsigned @AT@ 49 @LENGTH@ 8\n" +
|
||||
"---------------DEL name@@unsigned @AT@ 49 @LENGTH@ 8\n" +
|
||||
"------------DEL name@@virus @AT@ 58 @LENGTH@ 5\n");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnumCase1() throws IOException {
|
||||
Properties appProps = new Properties();
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath", "FORKJOIN");
|
||||
|
||||
File prevFile = new File("src/main/resource/testFiles/prev_enum_example_1.c");
|
||||
File revFile = new File("src/main/resource/testFiles/enum_example_1.c");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testContinueCase1() throws IOException {
|
||||
Properties appProps = new Properties();
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
File prevFile =new File("src/main/resource/testFiles/prev_continue_example_1.c");
|
||||
File revFile = new File("src/main/resource/testFiles/continue_example_1.c");
|
||||
|
||||
|
||||
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
hierarchicalActionSets.size();
|
||||
Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
|
||||
Assert.assertEquals(hierarchicalActionSets.get(0).toString(),"UPD while@@i -- > 0 x = f i x == 1 y += x * x @TO@ i -- > 1 x = f i x == 0 y += x * x @AT@ 6 @LENGTH@ 34\n" +
|
||||
"---UPD condition@@i -- > 0 @TO@ i -- > 1 @AT@ 6 @LENGTH@ 12\n" +
|
||||
"------UPD expr@@i -- > 0 @TO@ i -- > 1 @AT@ 8 @LENGTH@ 8\n" +
|
||||
"---------UPD literal@@0 @TO@ 1 @AT@ 14 @LENGTH@ 1\n" +
|
||||
"---UPD block@@x = f i x == 1 y += x * x @TO@ x = f i x == 0 y += x * x @AT@ 17 @LENGTH@ 80\n" +
|
||||
"------UPD if@@x == 1 @TO@ x == 0 @AT@ 42 @LENGTH@ 6\n" +
|
||||
"---------UPD condition@@x == 1 @TO@ x == 0 @AT@ 42 @LENGTH@ 11\n" +
|
||||
"------------UPD expr@@x == 1 @TO@ x == 0 @AT@ 44 @LENGTH@ 6\n" +
|
||||
"---------------UPD literal@@1 @TO@ 0 @AT@ 49 @LENGTH@ 1\n");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReturnCase1() throws IOException {
|
||||
Properties appProps = new Properties();
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
File prevFile =new File("src/main/resource/testFiles/prev_return_example_1.c");
|
||||
File revFile = new File("src/main/resource/testFiles/return_example_1.c");
|
||||
|
||||
|
||||
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
hierarchicalActionSets.size();
|
||||
Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
|
||||
Assert.assertEquals(hierarchicalActionSets.get(0).toString(),"UPD return@@( s * ( long long ) s ) @TO@ ( s * ( long int ) s ) @AT@ 0 @LENGTH@ 28\n" +
|
||||
"---UPD expr@@( s * ( long long ) s ) @TO@ ( s * ( long int ) s ) @AT@ 6 @LENGTH@ 23\n" +
|
||||
"------UPD name@@long @TO@ int @AT@ 18 @LENGTH@ 4\n");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSwitchCase1() throws IOException {
|
||||
Properties appProps = new Properties();
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
File prevFile =new File("src/main/resource/testFiles/prev_switch_example_1.c");
|
||||
File revFile = new File("src/main/resource/testFiles/switch_example_1.c");
|
||||
|
||||
|
||||
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
hierarchicalActionSets.size();
|
||||
Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
|
||||
Assert.assertEquals(hierarchicalActionSets.get(0).toString(),"UPD if@@i > 0 i - 1 n ++ 0 z ++ 2 p -- 0 @TO@ i > 0 i - 1 n ++ 0 z ++ 1 p ++ 0 @AT@ 3 @LENGTH@ 32\n" +
|
||||
"---UPD then@@i - 1 n ++ 0 z ++ 2 p -- @TO@ i - 1 n ++ 0 z ++ 1 p ++ @AT@ 22 @LENGTH@ 24\n" +
|
||||
"------UPD block@@i - 1 n ++ 0 z ++ 2 p -- @TO@ i - 1 n ++ 0 z ++ 1 p ++ @AT@ 22 @LENGTH@ 24\n" +
|
||||
"---------UPD switch@@i - 1 n ++ 0 z ++ 2 p -- @TO@ i - 1 n ++ 0 z ++ 1 p ++ @AT@ 22 @LENGTH@ 24\n" +
|
||||
"------------UPD block@@- 1 n ++ 0 z ++ 2 p -- @TO@ - 1 n ++ 0 z ++ 1 p ++ @AT@ 32 @LENGTH@ 148\n" +
|
||||
"---------------UPD case@@2 @TO@ 1 @AT@ 148 @LENGTH@ 9\n" +
|
||||
"------------------UPD expr@@2 @TO@ 1 @AT@ 153 @LENGTH@ 1\n" +
|
||||
"---------------------UPD literal@@2 @TO@ 1 @AT@ 153 @LENGTH@ 1\n" +
|
||||
"---------------UPD expr_stmt@@p -- @TO@ p ++ @AT@ 169 @LENGTH@ 4\n" +
|
||||
"------------------UPD expr@@p -- @TO@ p ++ @AT@ 169 @LENGTH@ 4\n" +
|
||||
"---------------------UPD operator@@-- @TO@ ++ @AT@ 170 @LENGTH@ 2\n" +
|
||||
"---------------INS break@@ @TO@ block@@- 1 n ++ 0 z ++ 2 p -- @AT@ 186 @LENGTH@ 0\n");
|
||||
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void testExternCase1() throws IOException {
|
||||
// Properties appProps = new Properties();
|
||||
// appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
// String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
//
|
||||
// File prevFile =new File("src/main/resource/testFiles/prev_extern_example_1.c");
|
||||
// File revFile = new File("src/main/resource/testFiles/extern_example_1.c");
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// EDiffHunkParser parser = new EDiffHunkParser();
|
||||
//
|
||||
// List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
// hierarchicalActionSets.size();
|
||||
// Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
//
|
||||
// Assert.assertEquals(hierarchicalActionSets.get(0).toString(),"UPD switch@@i - 1 n ++ 0 z ++ 2 p -- @TO@ i - 1 n ++ 0 z ++ 1 p ++ @AT@ 6 @LENGTH@ 24\n" +
|
||||
// "---UPD block@@- 1 n ++ 0 z ++ 2 p -- @TO@ - 1 n ++ 0 z ++ 1 p ++ @AT@ 11 @LENGTH@ 127\n" +
|
||||
// "------UPD case@@2 @TO@ 1 @AT@ 99 @LENGTH@ 9\n" +
|
||||
// "---------UPD expr@@2 @TO@ 1 @AT@ 104 @LENGTH@ 1\n" +
|
||||
// "------------UPD literal@@2 @TO@ 1 @AT@ 104 @LENGTH@ 1\n" +
|
||||
// "------UPD expr_stmt@@p -- @TO@ p ++ @AT@ 116 @LENGTH@ 4\n" +
|
||||
// "---------UPD expr@@p -- @TO@ p ++ @AT@ 116 @LENGTH@ 4\n" +
|
||||
// "------------UPD operator@@-- @TO@ ++ @AT@ 117 @LENGTH@ 2\n");
|
||||
//
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testFunctionCase1() throws IOException {
|
||||
Properties appProps = new Properties();
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
File prevFile =new File("src/main/resource/testFiles/prev_function_example_1.c");
|
||||
File revFile = new File("src/main/resource/testFiles/function_example_1.c");
|
||||
|
||||
|
||||
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
hierarchicalActionSets.size();
|
||||
Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
|
||||
Assert.assertEquals(hierarchicalActionSets.get(0).toString(),"UPD function@@int func a b c int a int b int c @TO@ int func a b c int a int c int b @AT@ 122 @LENGTH@ 32\n" +
|
||||
"---MOV decl_stmt@@int b @TO@ function@@int func a b c int a int b int c @AT@ 153 @LENGTH@ 5\n");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStaticCase1() throws IOException {
|
||||
Properties appProps = new Properties();
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
File prevFile =new File("src/main/resource/testFiles/prev_static_example_1.c");
|
||||
File revFile = new File("src/main/resource/testFiles/static_example_1.c");
|
||||
|
||||
|
||||
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
hierarchicalActionSets.size();
|
||||
Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
|
||||
Assert.assertEquals(hierarchicalActionSets.get(0).toString(),"UPD decl_stmt@@static const int rpm_ranges [] 2000 4000 8000 16000 @TO@ static const string rpm_ranges [] 1000 4000 8000 16000 @AT@ 95 @LENGTH@ 51\n" +
|
||||
"---UPD decl@@static const int rpm_ranges [] 2000 4000 8000 16000 @TO@ static const string rpm_ranges [] 1000 4000 8000 16000 @AT@ 95 @LENGTH@ 51\n" +
|
||||
"------UPD type@@const int @TO@ const string @AT@ 102 @LENGTH@ 9\n" +
|
||||
"---------UPD name@@int @TO@ string @AT@ 108 @LENGTH@ 3\n" +
|
||||
"------UPD init@@2000 4000 8000 16000 @TO@ 1000 4000 8000 16000 @AT@ 127 @LENGTH@ 20\n" +
|
||||
"---------UPD expr@@2000 4000 8000 16000 @TO@ 1000 4000 8000 16000 @AT@ 127 @LENGTH@ 20\n" +
|
||||
"------------UPD block@@2000 4000 8000 16000 @TO@ 1000 4000 8000 16000 @AT@ 127 @LENGTH@ 28\n" +
|
||||
"---------------UPD expr@@2000 @TO@ 1000 @AT@ 129 @LENGTH@ 4\n" +
|
||||
"------------------UPD literal@@2000 @TO@ 1000 @AT@ 129 @LENGTH@ 4\n");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTypedefCase1() throws IOException {
|
||||
Properties appProps = new Properties();
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
File prevFile =new File("src/main/resource/testFiles/prev_typedef_example_1.c");
|
||||
File revFile = new File("src/main/resource/testFiles/typedef_example_1.c");
|
||||
|
||||
|
||||
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
hierarchicalActionSets.size();
|
||||
Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
|
||||
Assert.assertEquals(hierarchicalActionSets.get(0).toString(),"UPD typedef@@club char name ] GROUP @TO@ club char name ] int size year GROUP @AT@ 123 @LENGTH@ 50\n" +
|
||||
"---UPD type@@club char name ] @TO@ club char name ] int size year @AT@ 138 @LENGTH@ 16\n" +
|
||||
"------UPD struct@@club char name ] @TO@ club char name ] int size year @AT@ 138 @LENGTH@ 16\n" +
|
||||
"---------UPD block@@char name ] @TO@ char name ] int size year @AT@ 143 @LENGTH@ 23\n" +
|
||||
"------------INS decl_stmt@@int size year @TO@ block@@char name ] @AT@ 168 @LENGTH@ 13\n" +
|
||||
"---------------INS decl@@int size @TO@ decl_stmt@@int size year @AT@ 168 @LENGTH@ 8\n" +
|
||||
"------------------INS type@@int @TO@ decl@@int size @AT@ 168 @LENGTH@ 3\n" +
|
||||
"---------------------INS name@@int @TO@ type@@int @AT@ 168 @LENGTH@ 3\n" +
|
||||
"------------------INS name@@size @TO@ decl@@int size @AT@ 172 @LENGTH@ 4\n" +
|
||||
"---------------INS name@@year @TO@ decl_stmt@@int size year @AT@ 178 @LENGTH@ 4\n");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testArrayCase1() throws IOException {
|
||||
Properties appProps = new Properties();
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
File prevFile =new File("src/main/resource/testFiles/prev_array_example_1.c");
|
||||
File revFile = new File("src/main/resource/testFiles/array_example_1.c");
|
||||
|
||||
|
||||
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
hierarchicalActionSets.size();
|
||||
Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
|
||||
Assert.assertEquals(hierarchicalActionSets.get(0).toString(),"UPD struct@@arr int a ] ] = 29 ] = 15 test @TO@ arr int a ] ] = 29 ] = 15 ] = 30 test @AT@ 0 @LENGTH@ 59\n" +
|
||||
"---UPD block@@int a ] ] = 29 ] = 15 @TO@ int a ] ] = 29 ] = 15 ] = 30 @AT@ 10 @LENGTH@ 43\n" +
|
||||
"------UPD decl_stmt@@int a ] ] = 29 ] = 15 @TO@ int a ] ] = 29 ] = 15 ] = 30 @AT@ 16 @LENGTH@ 21\n" +
|
||||
"---------UPD decl@@int a ] ] = 29 ] = 15 @TO@ int a ] ] = 29 ] = 15 ] = 30 @AT@ 16 @LENGTH@ 21\n" +
|
||||
"------------UPD init@@] = 29 ] = 15 @TO@ ] = 29 ] = 15 ] = 30 @AT@ 27 @LENGTH@ 13\n" +
|
||||
"---------------UPD expr@@] = 29 ] = 15 @TO@ ] = 29 ] = 15 ] = 30 @AT@ 27 @LENGTH@ 13\n" +
|
||||
"------------------UPD block@@] = 29 ] = 15 @TO@ ] = 29 ] = 15 ] = 30 @AT@ 27 @LENGTH@ 23\n" +
|
||||
"---------------------INS expr@@] = 30 @TO@ block@@] = 29 ] = 15 @AT@ 49 @LENGTH@ 6\n" +
|
||||
"------------------------INS index@@] @TO@ expr@@] = 30 @AT@ 49 @LENGTH@ 4\n" +
|
||||
"---------------------------INS expr@@[3 @TO@ index@@] @AT@ 50 @LENGTH@ 2\n" +
|
||||
"------------------------------INS literal@@[3 @TO@ expr@@[3 @AT@ 50 @LENGTH@ 2\n" +
|
||||
"------------------------INS operator@@= @TO@ expr@@] = 30 @AT@ 53 @LENGTH@ 1\n" +
|
||||
"------------------------INS literal@@30 @TO@ expr@@] = 30 @AT@ 55 @LENGTH@ 2\n");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBitfieldCase1() throws IOException {
|
||||
Properties appProps = new Properties();
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
File prevFile =new File("src/main/resource/testFiles/prev_bitfield_example_1.c");
|
||||
File revFile = new File("src/main/resource/testFiles/bitfield_example_1.c");
|
||||
|
||||
|
||||
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
hierarchicalActionSets.size();
|
||||
Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
|
||||
Assert.assertEquals(hierarchicalActionSets.get(0).toString(),"UPD struct@@employee char name ] int a 10 long cls temp @TO@ employee char name ] int a 5 long cls temp @AT@ 0 @LENGTH@ 74\n" +
|
||||
"---UPD block@@char name ] int a 10 long cls @TO@ char name ] int a 5 long cls @AT@ 15 @LENGTH@ 53\n" +
|
||||
"------UPD decl_stmt@@int a 10 @TO@ int a 5 @AT@ 40 @LENGTH@ 8\n" +
|
||||
"---------UPD decl@@int a 10 @TO@ int a 5 @AT@ 40 @LENGTH@ 8\n" +
|
||||
"------------UPD range@@10 @TO@ 5 @AT@ 48 @LENGTH@ 2\n" +
|
||||
"---------------UPD expr@@10 @TO@ 5 @AT@ 48 @LENGTH@ 2\n" +
|
||||
"------------------UPD literal@@10 @TO@ 5 @AT@ 48 @LENGTH@ 2\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testTernaryCase1() throws IOException {
|
||||
Properties appProps = new Properties();
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
File prevFile =new File("src/main/resource/testFiles/prev_ternary_example_1.c");
|
||||
File revFile = new File("src/main/resource/testFiles/ternary_example_1.c");
|
||||
|
||||
|
||||
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
hierarchicalActionSets.size();
|
||||
Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
|
||||
Assert.assertEquals(hierarchicalActionSets.get(0).toString(),"UPD function@@static int rpm_range_to_reg int range int i a x z @TO@ static int rpm_range_to_reg int range int i a x y @AT@ 0 @LENGTH@ 49\n" +
|
||||
"---UPD block@@int i a x z @TO@ int i a x y @AT@ 38 @LENGTH@ 31\n" +
|
||||
"------UPD return@@a x z @TO@ a x y @AT@ 49 @LENGTH@ 18\n" +
|
||||
"---------UPD expr@@a x z @TO@ a x y @AT@ 56 @LENGTH@ 5\n" +
|
||||
"------------UPD ternary@@a x z @TO@ a x y @AT@ 56 @LENGTH@ 5\n" +
|
||||
"---------------UPD else@@z @TO@ y @AT@ 64 @LENGTH@ 1\n" +
|
||||
"------------------UPD expr@@z @TO@ y @AT@ 64 @LENGTH@ 1\n" +
|
||||
"---------------------UPD name@@z @TO@ y @AT@ 64 @LENGTH@ 1\n");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDereferenceCase1() throws IOException {
|
||||
Properties appProps = new Properties();
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
File prevFile =new File("src/main/resource/testFiles/prev_dereference_example_1.c");
|
||||
File revFile = new File("src/main/resource/testFiles/dereference_example_1.c");
|
||||
|
||||
|
||||
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
hierarchicalActionSets.size();
|
||||
Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
|
||||
Assert.assertEquals(hierarchicalActionSets.get(0).toString(),"UPD function@@static struct max6639_data * max6639_update_device struct device * dev struct max6639_data * data dev_get_drvdata dev struct i2c_client * client data -> client @TO@ static struct max6639_data * max6639_update_device struct device * dev struct max6639_data * data dev_get_drvdata dev struct i2c_client * client test -> client @AT@ 0 @LENGTH@ 159\n" +
|
||||
"---UPD block@@struct max6639_data * data dev_get_drvdata dev struct i2c_client * client data -> client @TO@ struct max6639_data * data dev_get_drvdata dev struct i2c_client * client test -> client @AT@ 69 @LENGTH@ 98\n" +
|
||||
"------UPD decl_stmt@@struct i2c_client * client data -> client @TO@ struct i2c_client * client test -> client @AT@ 123 @LENGTH@ 41\n" +
|
||||
"---------UPD decl@@struct i2c_client * client data -> client @TO@ struct i2c_client * client test -> client @AT@ 123 @LENGTH@ 41\n" +
|
||||
"------------UPD init@@data -> client @TO@ test -> client @AT@ 151 @LENGTH@ 14\n" +
|
||||
"---------------UPD expr@@data -> client @TO@ test -> client @AT@ 151 @LENGTH@ 14\n" +
|
||||
"------------------UPD name@@data -> client @TO@ test -> client @AT@ 151 @LENGTH@ 14\n" +
|
||||
"---------------------UPD name@@data @TO@ test @AT@ 151 @LENGTH@ 4\n");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSizeofCase1() throws IOException {
|
||||
Properties appProps = new Properties();
|
||||
appProps.load(new FileInputStream("src/main/resource/app.properties"));
|
||||
String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN");
|
||||
|
||||
File prevFile =new File("src/main/resource/testFiles/prev_sizeof_example_1.c");
|
||||
File revFile = new File("src/main/resource/testFiles/sizeof_example_1.c");
|
||||
|
||||
|
||||
|
||||
|
||||
EDiffHunkParser parser = new EDiffHunkParser();
|
||||
|
||||
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
|
||||
hierarchicalActionSets.size();
|
||||
Assert.assertEquals(hierarchicalActionSets.size(),1);
|
||||
|
||||
Assert.assertEquals(hierarchicalActionSets.get(0).toString(),"UPD function@@int main printf \"%lu\\n\" char printf \"%lu\\n\" int printf \"%lu\\n\" float printf \"%lu\" double 0 @TO@ int main printf \"%lu\\n\" char printf \"%lu\\n\" int printf \"%lu\\n\" float printf \"%lu\" int 0 @AT@ 19 @LENGTH@ 90\n" +
|
||||
"---UPD block@@printf \"%lu\\n\" char printf \"%lu\\n\" int printf \"%lu\\n\" float printf \"%lu\" double 0 @TO@ printf \"%lu\\n\" char printf \"%lu\\n\" int printf \"%lu\\n\" float printf \"%lu\" int 0 @AT@ 31 @LENGTH@ 164\n" +
|
||||
"------UPD expr_stmt@@printf \"%lu\" double @TO@ printf \"%lu\" int @AT@ 146 @LENGTH@ 19\n" +
|
||||
"---------UPD expr@@printf \"%lu\" double @TO@ printf \"%lu\" int @AT@ 146 @LENGTH@ 19\n" +
|
||||
"------------UPD call@@printf \"%lu\" double @TO@ printf \"%lu\" int @AT@ 146 @LENGTH@ 19\n" +
|
||||
"---------------UPD argument_list@@\"%lu\" double @TO@ \"%lu\" int @AT@ 152 @LENGTH@ 24\n" +
|
||||
"------------------UPD argument@@double @TO@ int @AT@ 166 @LENGTH@ 6\n" +
|
||||
"---------------------UPD expr@@double @TO@ int @AT@ 166 @LENGTH@ 6\n" +
|
||||
"------------------------UPD sizeof@@double @TO@ int @AT@ 166 @LENGTH@ 6\n" +
|
||||
"---------------------------UPD argument_list@@double @TO@ int @AT@ 166 @LENGTH@ 9\n" +
|
||||
"------------------------------UPD argument@@double @TO@ int @AT@ 167 @LENGTH@ 6\n" +
|
||||
"---------------------------------UPD expr@@double @TO@ int @AT@ 167 @LENGTH@ 6\n" +
|
||||
"------------------------------------UPD name@@double @TO@ int @AT@ 167 @LENGTH@ 6\n");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class EDiffHelper {
|
||||
|
||||
|
||||
|
||||
if(actionSet.getParent() == null){
|
||||
if(actionSet.getParent() == null || ( actionSet.getParent().getAction().getClass().equals(Update.class) && ((Update) actionSet.getParent().getAction()).getflag() == false)){
|
||||
//root
|
||||
|
||||
// parent = new Tree(newType,"");
|
||||
@@ -175,7 +175,7 @@ public class EDiffHelper {
|
||||
if (subActions.size() != 0){
|
||||
for (HierarchicalActionSet subAction : subActions) {
|
||||
|
||||
if(actionSet.getParent() == null){
|
||||
if(actionSet.getParent() == null || ( actionSet.getParent().getAction().getClass().equals(Update.class) && ((Update) actionSet.getParent().getAction()).getflag() == false)){
|
||||
children = parent;
|
||||
}
|
||||
getTargetTree(subAction,children,null,tc);
|
||||
@@ -199,7 +199,7 @@ public class EDiffHelper {
|
||||
log.error("More than 1");
|
||||
}
|
||||
newType = keysByValue.get(0);
|
||||
if(actionSet.getParent() == null){
|
||||
if(actionSet.getParent() == null || ( actionSet.getParent().getAction().getClass().equals(Update.class) && ((Update) actionSet.getParent().getAction()).getflag() == false)){
|
||||
//root
|
||||
|
||||
// parent = new Tree(newType,"");
|
||||
@@ -215,7 +215,7 @@ public class EDiffHelper {
|
||||
if (subActions.size() != 0){
|
||||
for (HierarchicalActionSet subAction : subActions) {
|
||||
|
||||
if(actionSet.getParent() == null){
|
||||
if(actionSet.getParent() == null || ( actionSet.getParent().getAction().getClass().equals(Update.class) && ((Update) actionSet.getParent().getAction()).getflag() == false)){
|
||||
children = parent;
|
||||
}
|
||||
getASTTree(subAction,children,null,tc);
|
||||
@@ -461,7 +461,7 @@ public class EDiffHelper {
|
||||
}else{
|
||||
new Exception("unknow action");
|
||||
}
|
||||
if(actionSet.getParent() == null){
|
||||
if(actionSet.getParent() == null || ( actionSet.getParent().getAction().getClass().equals(Update.class) && ((Update) actionSet.getParent().getAction()).getflag() == false)){
|
||||
//root
|
||||
|
||||
parent = tc.createTree(newType, "", null);
|
||||
@@ -476,7 +476,7 @@ public class EDiffHelper {
|
||||
if (subActions.size() != 0){
|
||||
for (HierarchicalActionSet subAction : subActions) {
|
||||
|
||||
if(actionSet.getParent() == null){
|
||||
if(actionSet.getParent() == null || ( actionSet.getParent().getAction().getClass().equals(Update.class) && ((Update) actionSet.getParent().getAction()).getflag() == false)){
|
||||
children = parent;
|
||||
}
|
||||
getActionTree(subAction,children,null,tc);
|
||||
|
||||
@@ -3,15 +3,16 @@ pjName = gumInput
|
||||
portInner = 6380
|
||||
portDumps = 6399
|
||||
parallelism = AKKA
|
||||
numOfWorkers = 30
|
||||
numOfWorkers = 20
|
||||
hostname = localhost
|
||||
hunkLimit = 10
|
||||
|
||||
#inputPath = /Users/anilkoyuncu/projects/gumInputLinux
|
||||
inputPath = /Users/anil.koyuncu/projects/fixminer/fixminer-core/python/data/gumInputLinux
|
||||
redisPath = /Users/anil.koyuncu/projects/fixminer/fixminer-core/python/data/redis
|
||||
inputPath = /Users/haoye.tian/Documents/University/data/fixminer-data/gumInput
|
||||
redisPath = /Users/haoye.tian/Documents/University/project/fixminer-core/python/data/redis
|
||||
#srcMLPath= /Users/anil.koyuncu/Downloads/srcML/src2srcml
|
||||
srcMLPath= /Users/anil.koyuncu/Downloads/srcML.0.9.5/bin/srcml
|
||||
srcMLPath= /Users/haoye.tian/Do\
|
||||
cuments/University/project/srcML0.9.5/bin/srcml
|
||||
actionType = ALL
|
||||
eDiffTimeout = 900
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
struct abc
|
||||
{
|
||||
int a[6] = { [4] = 29, [2] = 16 };
|
||||
} test;
|
||||
@@ -0,0 +1,6 @@
|
||||
struct employee
|
||||
{
|
||||
char name[20];
|
||||
int a : 5;
|
||||
long cls;
|
||||
} temp;
|
||||
@@ -0,0 +1,8 @@
|
||||
while ( i-- > 1 )
|
||||
{
|
||||
x = f( i );
|
||||
if ( x == 0 ) {
|
||||
continue;
|
||||
}
|
||||
y += x * x;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
static struct max6639_data *max6639_update_device(struct device *dev)
|
||||
{
|
||||
struct max6639_data *data = dev_get_drvdata(dev);
|
||||
struct i2c_client *client = test->client;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
enum DAY {
|
||||
sunday = 0,
|
||||
monday = 1,
|
||||
tuesday,
|
||||
wednesday,
|
||||
thursday,
|
||||
friday,
|
||||
saturday,
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
extern "C" int x;
|
||||
@@ -1,3 +1,11 @@
|
||||
static long intel_gvt_match_device(struct intel_gvt *gvt,
|
||||
unsigned long device)
|
||||
{
|
||||
return intel_gvt_get_device_type(gvt);
|
||||
}
|
||||
|
||||
static void write_vreg(struct intel_vgpu *vgpu)
|
||||
{
|
||||
for (i = 0; i < max; i++ )
|
||||
{
|
||||
if ( line[i] == ' ' )
|
||||
@@ -6,6 +14,7 @@ for (i = 0; i < max; i++ )
|
||||
}
|
||||
if ( line[i] == '\t' )
|
||||
{
|
||||
tab++;
|
||||
tab--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
struct STUDENT sortstu( STUDENT a, STUDENT b );
|
||||
void print(STUDENT a);
|
||||
|
||||
int func(a, b, c)
|
||||
int a;
|
||||
int c;
|
||||
int b;
|
||||
{ }
|
||||
@@ -0,0 +1,5 @@
|
||||
if ( i > 0 )
|
||||
if ( j >= i )
|
||||
x = j;
|
||||
else
|
||||
x != i;
|
||||
@@ -0,0 +1,4 @@
|
||||
struct arr
|
||||
{
|
||||
int a[6] = { [4] = 29, [2] = 15 };
|
||||
} test;
|
||||
@@ -0,0 +1,6 @@
|
||||
struct employee
|
||||
{
|
||||
char name[20];
|
||||
int a : 10;
|
||||
long cls;
|
||||
} temp;
|
||||
@@ -0,0 +1,8 @@
|
||||
while ( i-- > 0 )
|
||||
{
|
||||
x = f( i );
|
||||
if ( x == 1 ) {
|
||||
continue;
|
||||
}
|
||||
y += x * x;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
static struct max6639_data *max6639_update_device(struct device *dev)
|
||||
{
|
||||
struct max6639_data *data = dev_get_drvdata(dev);
|
||||
struct i2c_client *client = data->client;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
enum DAY {
|
||||
sunday = 0,
|
||||
monday,
|
||||
tuesday,
|
||||
wednesday,
|
||||
thursday,
|
||||
friday,
|
||||
saturday,
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
extern "C" struct Z X;
|
||||
@@ -1,11 +1,20 @@
|
||||
static long intel_gvt_match_device(struct intel_gvt *gvt,
|
||||
unsigned long device)
|
||||
{
|
||||
return intel_gvt_get_device_type(gvt) & device;
|
||||
}
|
||||
|
||||
static void read_vreg(struct intel_vgpu *vgpu)
|
||||
{
|
||||
for (i = 0; i < max; i++ )
|
||||
{
|
||||
if ( line[i] == ' ' )
|
||||
{
|
||||
continue;
|
||||
space++;
|
||||
}
|
||||
if ( line[i] == '\t' )
|
||||
{
|
||||
tab++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
struct STUDENT sortstu( STUDENT a, STUDENT b );
|
||||
void print(STUDENT a);
|
||||
|
||||
int func(a, b, c)
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
{ }
|
||||
@@ -0,0 +1,5 @@
|
||||
if ( i > 0 )
|
||||
if ( j > i )
|
||||
x = j;
|
||||
else
|
||||
x = i;
|
||||
@@ -0,0 +1 @@
|
||||
return( s * (long long)s );
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
printf("%lu\n", sizeof(char));
|
||||
printf("%lu\n", sizeof(int));
|
||||
printf("%lu\n", sizeof(float));
|
||||
printf("%lu", sizeof(double));
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#define MAX6639_FAN_CONFIG3_THERM_FULL_SPEED
|
||||
static const int rpm_ranges[] = { 2000, 4000, 8000, 16000 };
|
||||
int(*X)(int, float);
|
||||
@@ -0,0 +1,23 @@
|
||||
static int abc(){
|
||||
if ( i > 0 )
|
||||
switch( i )
|
||||
{
|
||||
case -1:
|
||||
n++;
|
||||
break;
|
||||
case 0 :
|
||||
z++;
|
||||
break;
|
||||
case 1 :
|
||||
if (a)
|
||||
return 0
|
||||
}
|
||||
else
|
||||
return 0
|
||||
}
|
||||
|
||||
int func(a, b, c)
|
||||
int a;
|
||||
int c;
|
||||
int b;
|
||||
{ }
|
||||
@@ -0,0 +1,5 @@
|
||||
static int rpm_range_to_reg(int range)
|
||||
{
|
||||
int i;
|
||||
return a ? x : z;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/i2c.h>
|
||||
typedef struct club
|
||||
{
|
||||
char name[30];
|
||||
} GROUP;
|
||||
@@ -0,0 +1,6 @@
|
||||
union sign
|
||||
{
|
||||
int svar;
|
||||
unsigned uvar;
|
||||
unsigned virus;
|
||||
} number;
|
||||
@@ -0,0 +1 @@
|
||||
return( s * (long int)s );
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
printf("%lu\n", sizeof(char));
|
||||
printf("%lu\n", sizeof(int));
|
||||
printf("%lu\n", sizeof(float));
|
||||
printf("%lu", sizeof(int));
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#define MAX6639_FAN_CONFIG3_THERM_FULL_SPEED
|
||||
static const string rpm_ranges[] = { 1000, 4000, 8000, 16000 };
|
||||
int(*X)(int, float);
|
||||
@@ -0,0 +1,21 @@
|
||||
static double abc(){
|
||||
if ( i > 0 )
|
||||
switch( i )
|
||||
{
|
||||
case -1:
|
||||
n++;
|
||||
break;
|
||||
case 0 :
|
||||
z++;
|
||||
break;
|
||||
case 1 :
|
||||
return 0
|
||||
}
|
||||
else
|
||||
return 0
|
||||
}
|
||||
|
||||
double func(a, b, c)
|
||||
int a;
|
||||
int c;
|
||||
{ }
|
||||
@@ -0,0 +1,5 @@
|
||||
static int rpm_range_to_reg(int range)
|
||||
{
|
||||
int i;
|
||||
return a ? x : y;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/i2c.h>
|
||||
typedef struct club
|
||||
{
|
||||
char name[30];
|
||||
int size, year;
|
||||
} GROUP;
|
||||
@@ -0,0 +1,5 @@
|
||||
union sign
|
||||
{
|
||||
int svar;
|
||||
unsigned uvar;
|
||||
} number;
|
||||
Reference in New Issue
Block a user