\\ ** Convert source code(Java,C++,C code) to srcML(XML format)** \\ ./src2srcml -o \\ ** \\ Extract method calls in order as in an srcml file. \\ Retains the full path of the method call** \\ Preethas-MacBook-Pro:srcML preethac$ ./srcml2src --xpath="//src:call/src:name" SplashActivity.xml" \\ \\ \\ super.onCreate \\ setContentView \\ super.onResume \\ Handler \\ postDelayed \\ SplashActivity.this.finish\ \\ Intent \\ SplashActivity.this.startActivity \\ finish \\ Intent \\ SplashActivity.this.startActivity \\ **\\ Extract method calls in order from a specific class** \\ Preethas-MacBook-Pro:srcML preethac$ ./srcml2src --xpath="//src:class[src:name='']//src:call" **\\ Storing the output in a file** \\ > ** \\ \\ Counting number of blocks/functions:** \\ wifi-roaming-128-4-153-85:srcML preethac$ ./srcml2src --xpath="count(//src:block)" SplashActivity.xml 7 \\ wifi-roaming-128-4-153-85:srcML preethac$ ./srcml2src --xpath="count(//src:function)" SplashActivity.xml \\ 3 **\\ Counting the number of calls with arguments** \\ 'Preethas-MacBook-Pro:srcML preethac$ ./srcml2src --xpath="//src:block//src:call" SplashActivity.xml' \\ \\ \\ \\ \\ super.onCreate(savedInstanceState) \\ setContentView(R.layout.splash) \\ super.onResume() \\ Handler() \\ postDelayed(new Runnable() { public void run() { //Finish the splash activity so it can't be returned to. SplashActivity.this.finish(); // Create an Intent that will start the main activity. Intent mainIntent = new Intent(SplashActivity.this, CuringDepressionActivity.class); SplashActivity.this.startActivity(mainIntent); } }, SPLASH_DISPLAY_LENGTH) SplashActivity.this.finish() Intent(SplashActivity.this, CuringDepressionActivity.class) SplashActivity.this.startActivity(mainIntent) finish() Intent(SplashActivity.this, CuringDepressionActivity.class) SplashActivity.this.startActivity(mainIntent) Preethas-MacBook-Pro:srcML preethac$ \\ ** \\ Extracting method call sequences between control statements** \\ **Important: Does not work for commented out snippets of code.** **\\ Preethas-MacBook-Pro:srcML preethac$ ./srcml2src --xpath="//src:for//src:call/src:name" CuringDepressionActivity.xml** \\ Log.v question.toString View question.type.equals question.type.equals question.type.equals questionViews.add text.append question.toString \\ **Preethas-MacBook-Pro:srcML preethac$ ./srcml2src --xpath="//src:if//src:call/src:name" CuringDepressionActivity.xml** \\ moveTaskToBack setContentView question.type.equals question.type.equals question.type.equals Preethas-MacBook-Pro:srcML preethac$ ** \\ With Position Enabled** \\ Preethas-MacBook-Pro:srcML preethac$ ./srcml2src --xpath="//src:if//src:call/src:name" CuringDepressionActivity.xml moveTaskToBack setContentView question.type.equals question.type.equals question.type.equals \\ Preethas-MacBook-Pro:srcML preethac$ ./srcml2src --xpath="//src:if//src:block//src:call/src:name" CuringDepressionActivity.xml \\ moveTaskToBack setContentView **\\ With position enabled:** \\ Preethas-MacBook-Pro:srcML preethac$ ./srcml2src --xpath="//src:if//src:block//src:call/src:name" CuringDepressionActivity.xml moveTaskToBack setContentView \\ **\\ To store line numbers of source code** \\ Preethas-MacBook-Pro:srcML preethac$ ./src2srcml --position CuringDepressionActivity.java -o CuringDepressionActivity.xml \\ **\\ Question?** \\ How to determine the control statements?if/for etc?