Initialize
authorSungho Park <chywoo.park@samsung.com>
Mon, 27 Feb 2012 12:19:34 +0000 (21:19 +0900)
committerSungho Park <chywoo.park@samsung.com>
Mon, 27 Feb 2012 12:19:34 +0000 (21:19 +0900)
38 files changed:
AUTHOR [new file with mode: 0644]
COPYING [new file with mode: 0644]
NOTICE [new file with mode: 0644]
builder/build.properties.clean [new file with mode: 0644]
builder/customTargets.xml [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing.feature/.project [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing.feature/build.properties [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing.feature/feature.properties [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing.feature/feature.xml [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing.tests/.classpath [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing.tests/.project [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing.tests/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing.tests/META-INF/MANIFEST.MF [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing.tests/build.properties [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing.tests/build.xml [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing.tests/src/org/tizen/nativeapp/assignmenttracing/tests/DUChainTest.java [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/.classpath [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/.project [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/META-INF/MANIFEST.MF [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/build.properties [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/build.xml [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/contexts.xml [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/fragment.xml [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/icons/duchain.gif [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/CFGBuilder.java [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/CFGNode.java [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/ChainBuilder.java [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/DefNode.java [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/SkipNode.java [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/UseNode.java [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/exceptions/TracingCancelException.java [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/exceptions/TracingUnsupportedException.java [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/ui/AssignmentTracingUI.java [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/ui/TracingActionDelegate.java [new file with mode: 0644]
org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/ui/TracingCommandHandler.java [new file with mode: 0644]
package/build.linux [new file with mode: 0755]
package/pkginfo.manifest [new file with mode: 0644]

diff --git a/AUTHOR b/AUTHOR
new file mode 100644 (file)
index 0000000..f40697c
--- /dev/null
+++ b/AUTHOR
@@ -0,0 +1,7 @@
+Woongsik Choi <woongsik76.choi@samsung.com>
+Hyukmin Kwon <hyukmin0530.kwon@samsung.com>
+Wooyoung Cho <wooyoung1.cho@samsung.com>
+Yoonseok Ko <ys597.ko@samsung.com>
+Sujin Kim <sujin921.kim@samsung.com>
+Jaeheung Kim <jaeheung.kim@samsung.com>
+HyunGoo Kang <hyungoo1.kang@samsung.com>
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..f94008a
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,206 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+
+
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..4297ee3
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
diff --git a/builder/build.properties.clean b/builder/build.properties.clean
new file mode 100644 (file)
index 0000000..d453be0
--- /dev/null
@@ -0,0 +1,260 @@
+###############################################################################
+# Copyright (c) 2003, 2006 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#     IBM Corporation - initial API and implementation
+###############################################################################
+#####################
+# Parameters describing how and where to execute the build.
+# Typical users need only update the following properties:
+#    baseLocation - where things you are building against are installed
+#    bootclasspath - The base jars to compile against (typicaly rt.jar)
+#    configs - the list of {os, ws, arch} configurations to build.  
+#
+# Of course any of the settings here can be overridden by spec'ing 
+# them on the command line (e.g., -DbaseLocation=d:/eclipse
+
+#The type of the top level element we are building,  generally "feature"
+topLevelElementType=feature
+#The id of the top level element we are building
+topLevelElementId=org.tizen.nativeapp.assignmenttracing.feature
+
+############# PRODUCT/PACKAGING CONTROL #############
+#product=/com.samsung.freshide/SLPSDK.product
+#runPackager=true
+
+#Set the name of the archive that will result from the product build.
+#archiveNamePrefix=
+
+# The prefix that will be used in the generated archive.
+archivePrefix="Do not touch here."
+
+# The location underwhich all of the build output will be collected.
+collectingFolder=${archivePrefix}
+
+# The list of {os, ws, arch} configurations to build.  This 
+# value is a '&' separated list of ',' separate triples.  For example, 
+#     configs=win32,win32,x86 & linux,motif,x86
+# By default the value is *,*,*
+configs="Do not touch here."
+#configs=win32, win32, x86 & \
+#      win32,win32,x86_64 & \
+#      win32,win32,wpf & \
+#      linux, gtk, ppc & \
+#      linux, gtk, x86 & \
+#      linux, gtk, x86_64 & \
+#      linux, motif, x86 & \
+#      solaris, motif, sparc & \
+#      solaris, gtk, sparc & \
+#      aix, motif, ppc & \
+#      hpux, motif, ia64_32 & \
+#      macosx, carbon, ppc & \
+#      macosx, carbon, x86 & \
+#      macosx, cocoa, ppc & \
+#      macosx, cocoa, x86 & \
+#      macosx, cocoa, x86_64
+
+# By default PDE creates one archive (result) per entry listed in the configs property.
+# Setting this value to true will cause PDE to only create one output containing all 
+# artifacts for all the platforms listed in the configs property.
+# To control the output format for the group, add a "group, group, group - <format>" entry to the
+# archivesFormat. 
+#groupConfigurations=true
+
+#The format of the archive. By default a zip is created using antZip.
+#The list can only contain the configuration for which the desired format is different than zip.
+#archivesFormat=win32, win32, x86 - antZip& \
+#      linux, gtk, ppc - antZip &\
+#    linux, gtk, x86 - antZip& \
+#      linux, gtk, x86_64 - antZip& \
+# linux, motif, x86 - antZip& \
+#      solaris, motif, sparc - antZip& \
+#      solaris, gtk, sparc - antZip& \
+#      aix, motif, ppc - antZip& \
+#      hpux, motif, PA_RISC - antZip& \
+#      macosx, carbon, ppc - antZip
+
+#Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles.
+allowBinaryCycles=true
+
+#Sort bundles depenedencies across all features instead of just within a given feature.
+#flattenDependencies = true
+
+#Parallel compilation, requires flattenedDependencies=true
+#parallelCompilation=true
+#parallelThreadCount=
+#parallelThreadsPerProcessor=
+       
+#Set to true if you want the output to be ready for an update jar (no site.xml generated)
+#outputUpdateJars = false
+
+#Set to true for Jnlp generation
+#codebase should be a URL that will be used as the root of all relative URLs in the output.
+#generateJnlp=false
+#jnlp.codebase=<codebase url>
+#jnlp.j2se=<j2se version>
+#jnlp.locale=<a locale>
+#jnlp.generateOfflineAllowed=true or false generate <offlineAllowed/> attribute in the generated features
+#jnlp.configs=${configs}                       #uncomment to filter the content of the generated jnlp files based on the configuration being built
+
+#Set to true if you want to sign jars
+#signJars=false
+#sign.alias=<alias>
+#sign.keystore=<keystore location>
+#sign.storepass=<keystore password>
+#sign.keypass=<key password>
+
+#Arguments to send to the zip executable
+#zipargs=
+
+#Arguments to send to the tar executable
+#tarargs=
+
+#Control the creation of a file containing the version included in each configuration - on by default 
+#generateVersionsLists=false
+
+############## BUILD NAMING CONTROL ################
+# The directory into which the build elements are fetched and where
+# the build takes place.
+buildDirectory="Do not touch here"
+
+# Type of build.  Used in naming the build output.  Typically this value is
+# one of I, N, M, S, ...
+buildType="Do not touch here"
+
+# ID of the build.  Used in naming the build output.
+buildId="Do not touch here"
+
+# Label for the build.  Used in naming the build output
+buildLabel=${buildType}.${buildId}
+
+# Timestamp for the build.  Used in naming the build output
+timestamp=007
+
+#The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde.
+#The value will only be applied to plugin or features indicating build.properties, qualifier = context 
+#forceContextQualifier=<the value for the qualifier>
+
+#Enable / disable the generation of a suffix for the features that use .qualifier. 
+#The generated suffix is computed according to the content of the feature   
+#generateFeatureVersionSuffix=true
+
+############# BASE CONTROL #############
+# Settings for the base Eclipse components and Java class libraries 
+# against which you are building.
+# Base location for anything the build needs to compile against.  For example,
+# in most RCP app or a plug-in,  the baseLocation should be the location of a previously
+# installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack.
+
+base="Do not touch here"
+baseLocation="Do not touch here"
+
+
+#Folder containing repositories whose content is needed to compile against
+#repoBaseLocation=${base}/repos
+#Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against
+#transformedRepoLocation=${base}/transformedRepos
+
+#Os/Ws/Arch/nl of the eclipse specified by baseLocation
+baseos=linux
+basews=gtk
+basearch=x86
+
+#this property indicates whether you want the set of plug-ins and features to be considered during the build to be limited to the ones reachable from the features / plugins being built
+filteredDependencyCheck=false
+
+#this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons)
+resolution.devMode=false
+
+#pluginPath is a list of locations in which to find plugins and features.  This list is separated by the platform file separator (; or :)
+#a location is one of:  
+#- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo
+#- a directory that contains a /plugins or /features subdirectory
+#- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml
+#pluginPath=
+
+skipBase=true
+eclipseURL=<url for eclipse download site>
+eclipseBuildId=<Id of Eclipse build to get>
+eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip
+
+
+############# MAP FILE CONTROL ################
+# This section defines CVS tags to use when fetching the map files from the repository.
+# If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml
+
+skipMaps=true
+mapsRepo=:pserver:anonymous@example.com/path/to/repo
+mapsRoot=path/to/maps
+mapsCheckoutTag=HEAD
+
+#tagMaps=true
+mapsTagTag=v${buildId}
+
+
+############ REPOSITORY CONTROL ###############
+# This section defines properties parameterizing the repositories where plugins, fragments
+# bundles and features are being obtained from. 
+
+# The tags to use when fetching elements to build.
+# By default thebuilder will use whatever is in the maps.  
+# This value takes the form of a comma separated list of repository identifier (like used in the map files) and the 
+# overriding value
+# For example fetchTag=CVS=HEAD, SVN=v20050101
+# fetchTag=HEAD
+skipFetch=true
+
+
+############# P2 OPTIONS ##############
+#p2.gathering = true
+#p2.compress=true
+
+############# JAVA COMPILER OPTIONS ##############
+# The location of the Java jars to compile against.  Typically the rt.jar for your JDK/JRE
+#bootclasspath=${java.home}/lib/rt.jar
+
+# specific JRE locations to compile against. These values are used to compile bundles specifying a 
+# Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support
+#CDC-1.0/Foundation-1.0= /path/to/rt.jar
+#CDC-1.1/Foundation-1.1=
+#OSGi/Minimum-1.0=
+#OSGi/Minimum-1.1=
+#JRE-1.1=
+#J2SE-1.2=
+#J2SE-1.3=
+#J2SE-1.4=
+#J2SE-1.5=
+#JavaSE-1.6=
+#PersonalJava-1.1=
+#PersonalJava-1.2=
+#CDC-1.0/PersonalBasis-1.0=
+#CDC-1.0/PersonalJava-1.0=
+#CDC-1.1/PersonalBasis-1.1=
+#CDC-1.1/PersonalJava-1.1=
+
+# Specify the output format of the compiler log when eclipse jdt is used
+logExtension=.log
+
+# Whether or not to include debug info in the output jars
+javacDebugInfo=true
+
+# Whether or not to fail the build if there are compiler errors
+javacFailOnError=true
+
+# Enable or disable verbose mode of the compiler
+javacVerbose=false
+
+# Extra arguments for the compiler. These are specific to the java compiler being used.
+#compilerArg=
+
+# Default value for the version of the source code. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacSource in build.properties
+javacSource=1.6
+
+# Default value for the version of the byte code targeted. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties.
+javacTarget=1.6
+
+
diff --git a/builder/customTargets.xml b/builder/customTargets.xml
new file mode 100644 (file)
index 0000000..6a42e92
--- /dev/null
@@ -0,0 +1,187 @@
+<project name="Build specific targets and properties" default="noDefault">
+
+       <!-- ===================================================================== -->
+       <!-- Run a given ${target} on all elements being built -->
+       <!-- Add on <ant> task for each top level element being built. -->
+       <!-- ===================================================================== -->
+       <available property="allElementsFile" file="${builder}/allElements.xml" value="${builder}/allElements.xml"/>
+       <property name="allElementsFile" location="${eclipse.pdebuild.templates}/headless-build/allElements.xml"/>
+
+       <import file="${allElementsFile}" />
+       <target name="allElements">
+               <ant antfile="${genericTargets}" target="${target}">
+                       <property name="type" value="${topLevelElementType}"/>
+                       <property name="id" value="${topLevelElementId}"/>
+               </ant>
+       </target>
+
+       <target
+               name="assemble.${topLevelElementId}.linux.gtk.x86">
+               <ant antfile="{$assembleScriptName}" dir="${buildDirectory}"/>
+       </target>
+       <target
+               name="assemble.${topLevelElementId}.win32.win32.x86">
+               <ant antfile="{$assembleScriptName}" dir="${buildDirectory}"/>
+       </target>
+       
+       <!-- ===================================================================== -->
+       <!-- ===================================================================== -->
+       <target name="getBaseComponents" depends="checkLocalBase" unless="skipBase">
+               <get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" />
+               <unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" />
+       </target>
+
+       <target name="checkLocalBase">
+               <available file="${base}" property="skipBase" />
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Check out map files from correct repository -->
+       <!-- Replace values for mapsCheckoutTag as desired. -->
+       <!-- ===================================================================== -->
+       <target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps">
+               <property name="mapsCheckoutTag" value="HEAD" />
+               <cvs cvsRoot="${mapsRepo}" package="${mapsRoot}" dest="${buildDirectory}/maps" tag="${mapsCheckoutTag}" />
+       </target>
+
+       <target name="checkLocalMaps">
+               <available property="skipMaps" file="${buildDirectory}/maps" />
+       </target>
+
+       <target name="tagMapFiles" if="tagMaps">
+               <cvs dest="${buildDirectory}/maps/${mapsRoot}" command="tag ${mapsTagTag}" />
+       </target>
+
+       <!-- ===================================================================== -->
+
+       <target name="clean" unless="noclean">
+               <antcall target="allElements">
+                       <param name="target" value="cleanElement" />
+               </antcall>
+       </target>
+
+       <target name="gatherLogs">
+               <mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" />
+               <antcall target="allElements">
+                       <param name="target" value="gatherLogs" />
+               </antcall>
+               <unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true">
+                       <fileset dir="${buildDirectory}/features">
+                               <include name="**/*.log.zip" />
+                       </fileset>
+               </unzip>
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do before setup -->
+       <!-- ===================================================================== -->
+       <target name="preSetup">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after setup but before starting the build proper -->
+       <!-- ===================================================================== -->
+       <target name="postSetup">
+               <antcall target="getBaseComponents" />
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do before fetching the build elements -->
+       <!-- ===================================================================== -->
+       <target name="preFetch">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after fetching the build elements -->
+       <!-- ===================================================================== -->
+       <target name="postFetch">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do before the repositories are being processed -->
+       <!-- ===================================================================== -->
+       <target name="preProcessRepos">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after the repositories have been processed -->
+       <!-- ===================================================================== -->
+       <target name="postProcessRepos">
+       </target>
+       
+       <!-- ===================================================================== -->
+       <!-- Steps to do before generating the build scripts. -->
+       <!-- ===================================================================== -->
+       <target name="preGenerate">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after generating the build scripts. -->
+       <!-- ===================================================================== -->
+       <target name="postGenerate">
+               <antcall target="clean" />
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do before running the build.xmls for the elements being built. -->
+       <!-- ===================================================================== -->
+       <target name="preProcess">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after running the build.xmls for the elements being built. -->
+       <!-- ===================================================================== -->
+       <target name="postProcess">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do before running assemble. -->
+       <!-- ===================================================================== -->
+       <target name="preAssemble">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after  running assemble. -->
+       <!-- ===================================================================== -->
+       <target name="postAssemble">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do before running package. -->
+       <!-- ===================================================================== -->
+       <target name="prePackage">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after  running package. -->
+       <!-- ===================================================================== -->
+       <target name="postPackage">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do after the build is done. -->
+       <!-- ===================================================================== -->
+       <target name="postBuild">
+               <antcall target="gatherLogs" />
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do to test the build results -->
+       <!-- ===================================================================== -->
+       <target name="test">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Steps to do to publish the build results -->
+       <!-- ===================================================================== -->
+       <target name="publish">
+       </target>
+
+       <!-- ===================================================================== -->
+       <!-- Default target                                                        -->
+       <!-- ===================================================================== -->
+       <target name="noDefault">
+               <echo message="You must specify a target when invoking this file" />
+       </target>
+
+</project>
diff --git a/org.tizen.nativeapp.assignmenttracing.feature/.project b/org.tizen.nativeapp.assignmenttracing.feature/.project
new file mode 100644 (file)
index 0000000..ea4449a
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.tizen.nativeapp.assignmenttracing.feature</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.pde.FeatureBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.FeatureNature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.tizen.nativeapp.assignmenttracing.feature/build.properties b/org.tizen.nativeapp.assignmenttracing.feature/build.properties
new file mode 100644 (file)
index 0000000..b3a611b
--- /dev/null
@@ -0,0 +1,2 @@
+bin.includes = feature.xml,\
+               feature.properties
diff --git a/org.tizen.nativeapp.assignmenttracing.feature/feature.properties b/org.tizen.nativeapp.assignmenttracing.feature/feature.properties
new file mode 100644 (file)
index 0000000..f905ab0
--- /dev/null
@@ -0,0 +1,53 @@
+###############################################################################
+# Copyright (C) 2000 - 2011 Samsung Electronics Co., Ltd.
+# All rights reserved. This program and the accompanying materials 
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Contributors:
+#      S-Core Co., Ltd
+###############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName=Tizen Assignment Tracing
+
+# "providerName" property - name of the company that provides the feature
+providerName=Samsung
+
+# "updateSiteName" property - label for the update site
+updateSiteName=Tizen Assignment Tracing Updates
+
+# "description" property - description of the feature
+description=Tizen Assignment Tracing for Native Applications.
+       14            %copyright
+       15         </copyright>
+# "copyright" property
+copyrightURL=https://developer.tizen.org
+copyright=Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd.\n\
+All rights reserved.\n
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Tizen SDK\n\
+\n\
+Tizen SDK contains software portions licensed under various open source licenses as well as proprietary components.  All open source software portions ("Open Source Software") are licensed under the open source licenses that accompany such Open Source Software.\n\
+ \n\
+The licenses governing the Open Source Software are available at: http://developer.tizen.org/download/tizen_sdk_opensource_license.html\n\
+ \n\
+Except for the Open Source Software contained in Tizen SDK, all other software portions contained in Tizen SDK are governed by the terms and conditions of the Tizen Software Development Kit License Agreement, available at: http://developer.tizen.org/download/samsung_sdk_license.html\n\
+ \n\
+You may access and download Tizen SDK Open Source Software at: http://developer.tizen.org/download/tizenopensdk.tar.gz\n\
+ \n\
+BY CLICKING THE "I AGREE" BUTTON OR BY USING ANY PART OF TIZEN SDK, YOU AGREE (ON BEHALF OF YOURSELF AND/OR YOUR COMPANY) TO THE OPEN SOURCE SOFTWARE LICENSE TERMS AND THE TIZEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT. IF YOU DO NOT AGREE WITH THE OPEN SOURCE SOFTWARE LICENSE TERMS OR THE TIZEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT, YOU MAY NOT DOWNLOAD OR USE TIZEN SDK.\n
+########### end of license property ##########################################
diff --git a/org.tizen.nativeapp.assignmenttracing.feature/feature.xml b/org.tizen.nativeapp.assignmenttracing.feature/feature.xml
new file mode 100644 (file)
index 0000000..ef02a29
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+      id="org.tizen.nativeapp.assignmenttracing.feature"
+      label="Tizen Assignment Tracing"
+      version="1.0.2"
+      provider-name="Samsung"
+      plugin="org.tizen.base.platform"
+      license-feature="org.tizen.base.feature">
+
+   <description>
+      %description
+   </description>
+
+   <copyright>
+      %copyright
+   </copyright>
+
+   <license url="">
+      %license
+   </license>
+
+   <requires>
+      <import plugin="org.eclipse.cdt.ui" version="5.2.2" match="greaterOrEqual"/>
+   </requires>
+
+   <plugin
+         id="org.tizen.nativeapp.assignmenttracing"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         fragment="true"
+         unpack="false"/>
+
+</feature>
diff --git a/org.tizen.nativeapp.assignmenttracing.tests/.classpath b/org.tizen.nativeapp.assignmenttracing.tests/.classpath
new file mode 100644 (file)
index 0000000..c0c925c
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+       <classpathentry combineaccessrules="false" kind="src" path="/org.tizen.nativeapp.assignmenttracing"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.tizen.nativeapp.assignmenttracing.tests/.project b/org.tizen.nativeapp.assignmenttracing.tests/.project
new file mode 100644 (file)
index 0000000..cab42b1
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.tizen.nativeapp.assignmenttracing.tests</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.tizen.nativeapp.assignmenttracing.tests/.settings/org.eclipse.jdt.core.prefs b/org.tizen.nativeapp.assignmenttracing.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..5d3767f
--- /dev/null
@@ -0,0 +1,8 @@
+#Wed Jun 22 16:02:35 KST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/org.tizen.nativeapp.assignmenttracing.tests/META-INF/MANIFEST.MF b/org.tizen.nativeapp.assignmenttracing.tests/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..91a8d9a
--- /dev/null
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tests for Assignment Tracing
+Bundle-SymbolicName: org.tizen.nativeapp.assignmenttracing.tests
+Bundle-Version: 1.0.2.v20120224
+Bundle-Vendor: Samsung
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: org.eclipse.cdt.core,
+ org.eclipse.cdt.core.dom.ast,
+ org.eclipse.cdt.core.dom.parser,
+ org.eclipse.cdt.core.dom.parser.c,
+ org.eclipse.cdt.core.dom.parser.cpp,
+ org.eclipse.cdt.core.parser,
+ org.eclipse.cdt.internal.core.dom.parser.c,
+ org.eclipse.cdt.internal.core.dom.parser.cpp,
+ org.eclipse.cdt.internal.core.dom.parser.cpp.semantics,
+ org.eclipse.cdt.internal.core.parser.scanner,
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime;version="3.4.0"
diff --git a/org.tizen.nativeapp.assignmenttracing.tests/build.properties b/org.tizen.nativeapp.assignmenttracing.tests/build.properties
new file mode 100644 (file)
index 0000000..34d2e4d
--- /dev/null
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
diff --git a/org.tizen.nativeapp.assignmenttracing.tests/build.xml b/org.tizen.nativeapp.assignmenttracing.tests/build.xml
new file mode 100644 (file)
index 0000000..31a0072
--- /dev/null
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- WARNING: Eclipse auto-generated file.
+              Any modifications will be overwritten.
+              To include a user specific buildfile here, simply create one in the same
+              directory with the processing instruction <?eclipse.ant.import?>
+              as the first entry and export the buildfile again. -->
+<project basedir="." default="build" name="org.tizen.nativeapp.assignmenttracing.tests">
+    <property environment="env"/>
+    <!--<property name="ECLIPSE_HOME" value="../../fresh-ide-pde/eclipse"/>-->
+    <property name="junit.output.dir" value="junit"/>
+    <property name="org.tizen.nativeapp.assignmenttracing.location" value="../org.tizen.nativeapp.assignmenttracing"/>
+    <property name="debuglevel" value="source,lines,vars"/>
+    <property name="target" value="1.5"/>
+    <property name="source" value="1.5"/>
+    <path id="Plug-in Dependencies.libraryclasspath">
+       <fileset dir="${ECLIPSE_HOME}/plugins/">
+               <include name="*.jar"/>
+       </fileset>
+    </path>
+    <path id="JUnit 4.libraryclasspath">
+        <pathelement location="${JUNIT_PATH}"/>
+    </path>
+    <path id="org.tizen.nativeapp.assignmenttracing.classpath">
+        <path refid="Plug-in Dependencies.libraryclasspath"/>
+        <pathelement location="${org.tizen.nativeapp.assignmenttracing.location}/@dot"/>
+    </path>
+    <path id="org.tizen.nativeapp.assignmenttracing.tests.classpath">
+        <path refid="Plug-in Dependencies.libraryclasspath"/>
+        <pathelement location="bin"/>
+        <path refid="JUnit 4.libraryclasspath"/>
+        <path refid="org.tizen.nativeapp.assignmenttracing.classpath"/>
+    </path>
+    <target name="init">
+        <mkdir dir="bin"/>
+        <copy includeemptydirs="false" todir="bin">
+            <fileset dir="src">
+                <exclude name="**/*.launch"/>
+                <exclude name="**/*.java"/>
+            </fileset>
+        </copy>
+    </target>
+    <target name="clean">
+        <delete dir="bin"/>
+    </target>
+    <target depends="clean" name="cleanall">
+        <ant antfile="build.xml" dir="${org.tizen.nativeapp.assignmenttracing.location}" inheritAll="false" target="clean"/>
+    </target>
+    <target depends="build-subprojects,build-project" name="build"/>
+    <target name="build-subprojects">
+        <ant antfile="build.xml" dir="${org.tizen.nativeapp.assignmenttracing.location}" inheritAll="false" target="build-project">
+            <propertyset>
+                <propertyref name="build.compiler"/>
+            </propertyset>
+        </ant>
+    </target>
+    <target depends="init" name="build-project">
+        <echo message="${ant.project.name}: ${ant.file}"/>
+        <javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
+            <src path="src"/>
+            <classpath refid="org.tizen.nativeapp.assignmenttracing.tests.classpath"/>
+        </javac>
+    </target>
+    <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
+    <target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
+        <copy todir="${ant.library.dir}">
+            <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
+        </copy>
+        <unzip dest="${ant.library.dir}">
+            <patternset includes="jdtCompilerAdapter.jar"/>
+            <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
+        </unzip>
+    </target>
+    <target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
+        <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
+        <antcall target="build"/>
+    </target>
+    <target name="org.tizen.nativeapp.assignmenttracing.tests">
+        <mkdir dir="${junit.output.dir}"/>
+        <junit fork="yes" printsummary="withOutAndErr">
+            <formatter type="xml"/>
+            <test name="org.tizen.nativeapp.assignmenttracing.tests.DUChainTest" todir="${junit.output.dir}"/>
+            <classpath refid="org.tizen.nativeapp.assignmenttracing.tests.classpath"/>
+        </junit>
+    </target>
+    <target name="junitreport">
+        <junitreport todir="${junit.output.dir}">
+            <fileset dir="${junit.output.dir}">
+                <include name="TEST-*.xml"/>
+            </fileset>
+            <report format="frames" todir="${junit.output.dir}"/>
+        </junitreport>
+    </target>
+</project>
diff --git a/org.tizen.nativeapp.assignmenttracing.tests/src/org/tizen/nativeapp/assignmenttracing/tests/DUChainTest.java b/org.tizen.nativeapp.assignmenttracing.tests/src/org/tizen/nativeapp/assignmenttracing/tests/DUChainTest.java
new file mode 100644 (file)
index 0000000..e3afe97
--- /dev/null
@@ -0,0 +1,4060 @@
+/*
+ * Program Understanding / Assignment Tracing Tests
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyukmin Kwon <hyukmin0530.kwon@samsung.com>
+ * Wooyoung Cho <wooyoung1.cho@samsung.com>
+ * Yoonseok Ko <ys597.ko@samsung.com>
+ * Jaeheung Kim <jaeheung.kim@samsung.com>
+ * Sujin Kim <sujin921.kim@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.nativeapp.assignmenttracing.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.IASTNode;
+import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
+import org.eclipse.cdt.core.dom.ast.IASTProblem;
+import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.cdt.core.dom.parser.IScannerExtensionConfiguration;
+import org.eclipse.cdt.core.dom.parser.ISourceCodeParser;
+import org.eclipse.cdt.core.dom.parser.c.GCCParserExtensionConfiguration;
+import org.eclipse.cdt.core.dom.parser.c.GCCScannerExtensionConfiguration;
+import org.eclipse.cdt.core.dom.parser.c.ICParserExtensionConfiguration;
+import org.eclipse.cdt.core.parser.FileContent;
+import org.eclipse.cdt.core.parser.IScanner;
+import org.eclipse.cdt.core.parser.IScannerInfo;
+import org.eclipse.cdt.core.parser.IncludeFileContentProvider;
+import org.eclipse.cdt.core.parser.NullLogService;
+import org.eclipse.cdt.core.parser.ParserLanguage;
+import org.eclipse.cdt.core.parser.ParserMode;
+import org.eclipse.cdt.core.parser.ScannerInfo;
+import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor;
+import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser;
+import org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.tizen.nativeapp.assignmenttracing.core.CFGBuilder;
+import org.tizen.nativeapp.assignmenttracing.core.CFGNode;
+import org.tizen.nativeapp.assignmenttracing.core.ChainBuilder;
+import org.tizen.nativeapp.assignmenttracing.core.exceptions.TracingUnsupportedException;
+import org.tizen.nativeapp.assignmenttracing.ui.AssignmentTracingUI;
+
+
+/**
+* JUnit tests for DU-chain and UD-chain.
+*
+* The input test case marks 'def' as '@d' and 'use' as '@u' and 'def' + 'use' as '@m'
+* and the interesting variable as '$'.
+*
+* The extractSourceAndMarkers method extracts these marks from the test case.
+* And the buildAndCheck method computes DU-chain and UD-chain and compares them with given marks.
+*
+* @author Hyukmin Kwon <hyukmin0530@samsung.com>
+*/
+@SuppressWarnings("restriction")
+public class DUChainTest {
+
+       private IASTTranslationUnit ast;
+       private CFGBuilder cfgBuilder;
+       private ChainBuilder chainBuilder;
+       private List<CFGNode> selNodes;
+
+       private ArrayList<IASTName> duChainMarks;
+       private ArrayList<IASTName> udChainMarks;
+       private ArrayList<Integer> duChainOffsets;
+       private ArrayList<Integer> udChainOffsets;
+       private int selOffset;
+
+       private static final NullLogService NULL_LOG = new NullLogService();
+
+       @BeforeClass
+       public static void setUpBeforeClass() throws Exception {
+       }
+
+       @AfterClass
+       public static void tearDownAfterClass() throws Exception {
+       }
+
+       @Before
+       public void setUp() throws Exception {
+       }
+
+       @After
+       public void tearDown() throws Exception {
+       }
+
+       /**
+        * @param args
+        */
+       @Test
+       public void testFieldRefExpr01(){
+               String strFieldRefExpr01 =      "struct s {                                             " +
+                                                                       "       int a;                                          " +
+                                                                       "};                                                             " +
+                                                                       "struct v {                                             " +
+                                                                       "       struct s ss;                            " +
+                                                                       "       char c;                                         " +
+                                                                       "};                                                             " +
+                                                                       "void main() {                                  " +
+                                                                       "       struct v *@dvv;                         " +
+                                                                       "       $vv->ss.a;                              " +
+                                                                       "}                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strFieldRefExpr01));
+       }
+
+       @Test
+       public void testFieldRefExpr02(){
+               String strFieldRefExpr02 =      "struct s {                                             " +
+                                                                       "       int a;                                          " +
+                                                                       "};                                                             " +
+                                                                       "void main() {                                  " +
+                                                                       "       struct s $ss;                           " +
+                                                                       "       ss.a;                                           " +
+                                                                       "}                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strFieldRefExpr02));
+       }
+
+       @Test
+       public void testFieldRefExpr03(){
+               String strFieldRefExpr03 =      "struct s {                                             " +
+                                                                       "       int a;                                          " +
+                                                                       "};                                                             " +
+                                                                       "void main() {                                  " +
+                                                                       "       struct s *$ss;                  " +
+                                                                       "       (*@uss).a;                                      " +
+                                                                       "}                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strFieldRefExpr03));
+       }
+
+       @Test
+       public void testFieldRefExpr04(){
+               String strFieldRefExpr04 =      "struct s {                                             " +
+                                                                       "       int a;                                          " +
+                                                                       "};                                                             " +
+                                                                       "void main() {                                  " +
+                                                                       "       struct s $ss[3];                        " +
+                                                                       "       ss[1].a;                                        " +
+                                                                       "}                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strFieldRefExpr04));
+       }
+
+       @Test
+       public void testTypeIdExpr01() {
+               String strTypeIdExpr01 =        "struct s {                                     " +
+                                                                       "       int a;                                  " +
+                                                                       "       int b;                                  " +
+                                                                       "};                                                     " +
+                                                                       "void main() {                          " +
+                                                                       "       int $x=3;                               " +
+                                                                       "       (struct s){@ux, @ux++}; " +
+                                                                       "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(strTypeIdExpr01));
+       }
+
+       @Test
+       public void testIdExpr01() {
+               String strIdExpr01 =    "void main() {                  " +
+                                                               "       int a,b,c,d;            " +
+                                                               "       d = a+b;                        " +
+                                                               "       $a=3;                           " +
+                                                               "       c = ((b+3)-@ua)*d;      " +
+                                                               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(strIdExpr01));
+       }
+
+       @Test
+       public void testIdExpr02() {
+               String strIdExpr02 =    "void main() {                  " +
+                                                               "       int a,b,c,d;            " +
+                                                               "       @dd = a+b;                      " +
+                                                               "       a=3;                            " +
+                                                               "       c = ((b+3)-a)*$d;       " +
+                                                               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(strIdExpr02));
+       }
+
+       @Test
+       public void testIdExpr03() {
+               String strIdExpr03 =    "void main() {                  " +
+                                                               "       int a,@db,c,d;          " +
+                                                               "       d = a+b;                        " +
+                                                               "       a=3;                            " +
+                                                               "       c = (($b+3)-a)*d;       " +
+                                                               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(strIdExpr03));
+       }
+
+       @Test
+       public void testCompoundExpr01() {
+               String strComExpr01 =   "void main() {                                          " +
+                                                               "       int @dx;                                                " +
+                                                               "       x = ({x+1; $x++; @ux*@ux;});    " +
+                                                               "}                                                                      ";
+               buildAndCheck(extractSourceAndMarkers(strComExpr01));
+       }
+
+       @Test
+       public void testArraySubExpr01(){
+               String strArraySubExpr01 =      "void main() {                          " +
+                                                                       "       int $x[3] = {0,0,0};    " +
+                                                                       "       printf(\"%d\", x[1]);   " +
+                                                                       "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(strArraySubExpr01));
+       }
+
+       @Test
+       public void testArraySubExpr02(){
+               String strArraySubExpr02 =      "void main() {                                  " +
+                                                                       "       int a=1, x[3] = {0,0,0};        " +
+                                                                       "       @da++;                                          " +
+                                                                       "       a = x[$a];                              " +
+                                                                       "}                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strArraySubExpr02));
+       }
+
+       @Test
+       public void testBinaExpr01() {
+               String strBinaExpr01 =  "void main() {          " +
+                                                               "       int x;                  " +
+                                                               "       @dx = x + 1;    " +
+                                                               "       $x;                     " +
+                                                               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(strBinaExpr01));
+       }
+
+       @Test
+       public void testBinaExpr02() {
+               String strBinaExpr02 =  "void main() {          " +
+                                                               "       int @dx;                " +
+                                                               "       x = $x + 1;     " +
+                                                               "       x;                              " +
+                                                               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(strBinaExpr02));
+       }
+
+       @Test
+       public void testBinaExpr03() {
+               String strBinaExpr03 =  "void main() {          " +
+                                                               "       int x;                  " +
+                                                               "       @dx %= 10;              " +
+                                                               "       $x;                     " +
+                                                               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(strBinaExpr03));
+       }
+
+       @Test
+       public void testBinaExpr04() {
+               String strBinaExpr04 =  "void main() {          " +
+                                                               "       int @dx;                " +
+                                                               "       x %= $x-3;      " +
+                                                               "       x;                              " +
+                                                               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(strBinaExpr04));
+       }
+
+       @Test
+       public void testBinaExpr05() {
+               String strBinaExpr05 =  "void main() {          " +
+                                                               "       int x=1;                " +
+                                                               "       (@dx=1)&&($x);" +
+                                                               "       x;                              " +
+                                                               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(strBinaExpr05));
+       }
+
+       @Test
+       public void testBinaExpr06() {
+               String strBinaExpr06 =  "void main() {          " +
+                                                               "       int x=1;                " +
+                                                               "       (@dx=1)&&(x);   " +
+                                                               "       $x;                     " +
+                                                               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(strBinaExpr06));
+       }
+
+       @Test
+       public void testBinaExpr07(){
+               String strBinaExpr07 =  "void main() {          " +
+                                                               "       int $x=10;      " +
+                                                               "       @ux * 10;               " +
+                                                               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(strBinaExpr07));
+       }
+
+       @Test
+       public void testBinaExpr08(){
+               String strBinaExpr08 =  "void main() {          " +
+                                                               "       int $x=10;      " +
+                                                               "       @ux * @ux;              " +
+                                                               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(strBinaExpr08));
+       }
+
+       @Test
+       public void testUnaExpr01(){
+               String strUnaExpr01 =   "void main() {          " +
+                                                               "       int @dx=0;              " +
+                                                               "       $x++;                   " +
+                                                               "       @ux;                    " +
+                                                               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(strUnaExpr01));
+       }
+
+       @Test
+       public void testUnaExpr02(){
+               String strUnaExpr02 =   "void main() {                  " +
+                                                               "       int @dx=0;                      " +
+                                                               "       ++$@mx;                         " +
+                                                               "       @ux;                            " +
+                                                               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(strUnaExpr02));
+       }
+
+       @Test
+       public void testUnaExpr03(){
+               String strUnaExpr03 =   "void main() {                  " +
+                                                               "       int @dx=0;                      " +
+                                                               "       ((($x)));                       " +
+                                                               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(strUnaExpr03));
+       }
+
+       @Test
+       public void testUnaExpr04(){
+               String strUnaExpr04 =   "void main() {                  " +
+                                                               "       int x=0;                        " +
+                                                               "       int *p = &$x;           " +
+                                                               "}                                              ";
+               try {
+                       buildAndCheck(extractSourceAndMarkers(strUnaExpr04));
+                       fail("amper expression of lvalue should raise a runtime exception");
+               } catch(TracingUnsupportedException e) {
+                       assertTrue(true);
+                       return;
+               }
+       }
+
+       @Test
+       public void testUnaExpr05(){
+               String strUnaExpr05 =   "void main() {                  " +
+                                                               "       int $x[2]={0,0};        " +
+                                                               "       &(x[1]);                        " +
+                                                               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(strUnaExpr05));
+       }
+
+       @Test
+       public void testUnaExpr06(){
+               String strUnaExpr06 =   "void main() {                  " +
+                                                               "       int @dx = 3;            " +
+                                                               "       int y = -$x;            " +
+                                                               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(strUnaExpr06));
+       }
+
+       @Test
+       public void testUnaExpr07(){
+               String strUnaExpr07 =   "void main() {                  " +
+                                                               "       int x=0;                        " +
+                                                               "       int *p = &((($x)));     " +
+                                                               "}                                              ";
+               try {
+                       buildAndCheck(extractSourceAndMarkers(strUnaExpr07));
+                       fail("amper expression of lvalue should raise a runtime exception");
+               } catch(TracingUnsupportedException e) {
+                       assertTrue(true);
+                       return;
+               }
+       }
+
+       @Test
+       public void testUnaExpr08(){
+               String strUnaExpr08 =   "void main() {                  " +
+                                                               "       int x=0;                        " +
+                                                               "       int *p = &x;            " +
+                                                               "       int **pp = &$p;         " +
+                                                               "}                                              ";
+               try {
+                       buildAndCheck(extractSourceAndMarkers(strUnaExpr08));
+                       fail("amper expression of lvalue should raise a runtime exception");
+               } catch(TracingUnsupportedException re) {
+                       assertTrue(true);
+                       return;
+               }
+       }
+
+       @Test
+       public void testCastExpr01(){
+               String strcastExpr01 =  "void main() {                  " +
+                                                               "       int $x=1;                       " +
+                                                               "       (byte)@ux;                      " +
+                                                               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(strcastExpr01));
+       }
+
+       @Test
+       public void testCondExpr01(){
+               String strCondExpr01 =  "void main() {                          " +
+                                                               "       int x=1;                                " +
+                                                               "       x<3?@dx=3:@dx=1;                " +
+                                                               "       $x;                                     " +
+                                                               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(strCondExpr01));
+       }
+
+       @Test
+       public void testCondExpr02(){
+               String strCondExpr02 =  "void main() {                          " +
+                                                               "       int @dx=1;                              " +
+                                                               "       x<3?x+1:x+1;                    " +
+                                                               "       $x;                                     " +
+                                                               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(strCondExpr02));
+       }
+
+       @Test
+       public void testCondExpr03(){
+               String strCondExpr03 =  "void main() {                          " +
+                                                               "       int $x=3;                               " +
+                                                               "       @ux>3?x=1:@ux;                  " +
+                                                               "       @ux;                                    " +
+                                                               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(strCondExpr03));
+       }
+
+       @Test
+       public void testCondExpr04(){
+               String strCondExpr04 =  "void main() {                          " +
+                                                               "       int $x=3;                               " +
+                                                               "       @ux>3?x=1:x=2;                  " +
+                                                               "       x;                                              " +
+                                                               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(strCondExpr04));
+       }
+
+       @Test
+       public void testCondExpr05(){
+               String strCondExpr05 =  "void main() {                          " +
+                                                               "       int @dx =3;                             " +
+                                                               "       (x>1?@dx:y) = 10;               " +
+                                                               "       $x;                                     " +
+                                                               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(strCondExpr05));
+       }
+
+       @Test
+       public void testListExpr01(){
+               String strListExpr01 =  "void main() {                                                                  " +
+                                                               "       int $x=1;                                                                       " +
+                                                               "       @ux+1, @ux++, x+2, x=3, printf(\"%d\",x);       " +
+                                                               "}                                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strListExpr01));
+       }
+
+       @Test
+       public void testListExpr02(){
+               String strListExpr02 =  "void main() {                                                                  " +
+                                                               "       int @dx=1;                                                                      " +
+                                                               "       $x+1, x++, x+2, x=3, printf(\"%d\",x);  " +
+                                                               "}                                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strListExpr02));
+       }
+
+       @Test
+       public void testListExpr03(){
+               String strListExpr03 =  "void main() {                                                                  " +
+                                                               "       int @dx=1;                                                                      " +
+                                                               "       x+1, $x++, @ux+2, x=3, printf(\"%d\",x);" +
+                                                               "}                                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strListExpr03));
+       }
+
+       @Test
+       public void testListExpr04(){
+               String strListExpr04 =  "void main() {                                                                  " +
+                                                               "       int x=1;                                                                        " +
+                                                               "       x+1, @dx++, $x+2, x=3, printf(\"%d\",x);" +
+                                                               "}                                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strListExpr04));
+       }
+
+       @Test
+       public void testListExpr06(){
+               String strListExpr06 =  "void main() {                                                                  " +
+                                                               "       int x=1;                                                                        " +
+                                                               "       x+1, x++, x+2, $x=3, printf(\"%d\",@ux);" +
+                                                               "}                                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strListExpr06));
+       }
+
+       @Test
+       public void testListExpr07(){
+               String strListExpr07 =  "void main() {                                                                  " +
+                                                               "       int x=1;                                                                        " +
+                                                               "       x+1, x++, x+2, @dx=3, printf(\"%d\",$x);" +
+                                                               "}                                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strListExpr07));
+       }
+
+       @Test
+       public void testFunCallExpr01(){
+               String strFunCallExpr01 =       "void main() {                                  " +
+                                                                       "       int $x=4;                                       " +
+                                                                       "       printf(\"%d\\n\",@ux);          " +
+                                                                       "}                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strFunCallExpr01));
+       }
+
+       @Test
+       public void testFunCallExpr02(){
+               String strFunCallExpr02 =       "double foo(int a, int b){                      " +
+                                                                       "       return a/b;                                             " +
+                                                                       "}                                                                      " +
+                                                                       "void main() {                                          " +
+                                                                       "       double (*@df)(int, int) = foo;  " +
+                                                                       "       $f(3,1);                                                " +
+                                                                       "}                                                                      ";
+               buildAndCheck(extractSourceAndMarkers(strFunCallExpr02));
+       }
+
+       @Test
+       public void testFunCallExpr03(){
+               String strFunCallExpr03 =       "void main() {                                                          " +
+                                                                       "       int @dx=1;                                                              " +
+                                                                       "       printf(\"%d %d %d\", x, x++, $x+1);     " +
+                                                                       "}                                                                                      ";
+               buildAndCheck(extractSourceAndMarkers(strFunCallExpr03));
+       }
+
+       @Test
+       public void testFunCallExpr04(){
+               String strFunCallExpr04 =       "void main() {                                                                  " +
+                                                                       "       int @dx=1;                                                                      " +
+                                                                       "       printf(\"%d %d %d\", @ux, $x++, x+1);           " +
+                                                                       "}                                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strFunCallExpr04));
+       }
+
+       @Test
+       public void testFunCallExpr05(){
+               String strFunCallExpr05 =       "void main() {                                                                  " +
+                                                                       "       int x=1;                                                                        " +
+                                                                       "       printf(\"%d %d %d\", $x, @dx++, x+1);           " +
+                                                                       "}                                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strFunCallExpr05));
+       }
+
+       @Test
+       public void testFunCallExpr06(){
+               String strFunCallExpr06 =       "void main() {  " +
+                                                                       "       int $x=1;       " +
+                                                                       "       foo(@ux);       " +
+                                                                       "}                              ";
+               buildAndCheck(extractSourceAndMarkers(strFunCallExpr06));
+       }
+
+       @Test
+       public void testFunCallExpr07(){
+               String strFunCallExpr06 =       "void main() {  " +
+                                                                       "       int $x=1;       " +
+                                                                       "       foo(&x);        " +
+                                                                       "}                              ";
+               try {
+                       buildAndCheck(extractSourceAndMarkers(strFunCallExpr06));
+                       fail("amper expression of lvalue should raise a runtime exception");
+               } catch(TracingUnsupportedException re) {
+                       assertTrue(true);
+                       return;
+               }
+       }
+
+       @Test
+       public void testInit01(){
+               String strInit01 =      "void main() {                                                  " +
+                                                       "       int @dx=3;                                                      " +
+                                                       "       int a[4] = {$x, x++, x+2, x--}; " +
+                                                       "}                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strInit01));
+       }
+
+       @Test
+       public void testInit02(){
+               String strInit02 =      "void main() {                                                  " +
+                                                       "       int @dx=3;                                                      " +
+                                                       "       int a[4] ={x, $x++, @ux+2, @ux--};" +
+                                                       "}                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strInit02));
+       }
+
+       @Test
+       public void testInit03(){
+               String strInit03 =      "void main() {                                                  " +
+                                                       "       int x=3;                                                        " +
+                                                       "       int a[4] = {x, @dx++, $x+2, x--};       " +
+                                                       "}                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strInit03));
+       }
+
+       @Test
+       public void testInit04(){
+               String strInit04 =      "void main() {                                                  " +
+                                                       "       int x=3;                                                        " +
+                                                       "       int a[4] = {x, @dx++, x+2, $x--};       " +
+                                                       "}                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strInit04));
+       }
+
+       @Test
+       public void testInit05(){
+               String strInit05 =      "void main() {                                                  " +
+                                                       "       int @dx=2;                                                      " +
+                                                       "       int a[3] = {[$x]=10};                           " +
+                                                       "}                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strInit05));
+       }
+
+       @Test
+       public void testInit06(){
+               String strInit06 =      "void main() {                                                  " +
+                                                       "       int @dx = 10;                                           " +
+                                                       "       int a[100] = {[0...4]=3, [$x]=10};" +
+                                                       "}                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strInit06));
+       }
+
+       @Test
+       public void testInit07(){
+               String strInit07 =      "struct s {                                                             " +
+                                                       "       int a[3];                                                       " +
+                                                       "};                                                                             " +
+                                                       "void main() {                                                  " +
+                                                       "       int $x=2;                                                       " +
+                                                       "       struct s ss = {a[@ux] = 2};                     " +
+                                                       "}                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(strInit07));
+       }
+
+       @Test
+       public void testInit08(){
+               String strInit08 =      "void main() {          " +
+                                                       "       int $a = 10;    " +
+                                                       "       int b = @ua;    " +
+                                                       "       b = @ua + 1;    " +
+                                                       "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(strInit08));
+       }
+
+       @Test
+       public void testInit09(){
+               String strInit09 =      "void main() {          " +
+                                                       "       int $a = 10;    " +
+                                                       "       int b = ++@ua;  " +
+                                                       "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(strInit09));
+       }
+
+       @Test
+       public void testInit10(){
+               String strInit10 =      "void main() {                                                  " +
+                                                       "       int $x=3;                                                       " +
+                                                       "       int *a[2] = {&x, &x};   " +
+                                                       "}                                                                              ";
+               try {
+                       buildAndCheck(extractSourceAndMarkers(strInit10));
+                       fail("amper expression of lvalue should raise a runtime exception");
+               } catch(TracingUnsupportedException re) {
+                       assertTrue(true);
+                       return;
+               }
+       }
+
+       /*
+           Testcases for statements
+        *
+        */
+       @Test
+       public void testWhile_M01()
+       {
+               String testWhile01 =
+               "void testWhile01()  " +
+               "{                   " +
+               "       int $x = 10;   " +
+               "       while( @ux )     " +
+               "       {                " +
+               "               x = @ux + 1; " +
+               "       }                " +
+               "       @ux;              " +
+               "}                   ";
+               buildAndCheck(extractSourceAndMarkers(testWhile01));
+       }
+
+       @Test
+       public void testWhile_M02()
+       {
+               String testWhile02 =
+               "void testWhile02()        "+
+               "{                                         "+
+               "       int x = 10;                "+
+               "       while( @ux )       "+
+               "       {                                  "+
+               "               $x = @ux + 1;"+
+               "       }                                  "+
+               "       @ux;                       "+
+               "}                                         ";
+               buildAndCheck(extractSourceAndMarkers(testWhile02));
+       }
+
+       @Test
+       public void testWhile_M03()
+       {
+               String testWhile03 =
+               "void testWhile03()        "+
+               "{                                         "+
+               "       int @dx = 10;      "+
+               "       while( x )                 "+
+               "       {                                  "+
+               "               @dx = $x + 1;"+
+               "       }                                  "+
+               "       x;                                 "+
+               "}                                     ";
+               buildAndCheck(extractSourceAndMarkers(testWhile03));
+       }
+
+       @Test
+       public void testWhile_M04()
+       {
+               String testWhile04 =
+               "void testWhile04()        "+
+               "{                                         "+
+               "       int @dx = 10;      "+
+               "       while( $x )      "+
+               "       {                  "+
+               "               @dx = x + 1;   "+
+               "       }                                  "+
+               "       x;                                 "+
+               "}                                         ";
+               buildAndCheck(extractSourceAndMarkers(testWhile04));
+       }
+
+       @Test
+       public void testWhile_M05()
+       {
+               String testWhile05 =
+               "void testWhile05()             "+
+               "{                                              "+
+               "       int @dx = 10;           "+
+               "       while( x )                      "+
+               "       {                                       "+
+               "               @dx = x + 1;    "+
+               "       }                                       "+
+               "       $x;                         "+
+               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(testWhile05));
+       }
+
+       @Test
+       public void testWhile_M06()
+       {
+               String testWhile06 =
+               "void testWhile06()             "+
+               "{                                              "+
+               "       int $x = 10;            "+
+               "       while( @ux )            "+
+               "       {                                       "+
+               "               continue;               "+
+               "               x = x + 1;              "+
+               "       }                                       "+
+               "       @ux;                            "+
+               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(testWhile06));
+       }
+
+       @Test
+       public void testWhile_M07()
+       {
+               String testWhile07 =
+               "void testWhile07()             "+
+               "{                                              "+
+               "       int x = 10;                     "+
+               "       while( x )                      "+
+               "       {                                       "+
+               "               $x = x + 1;     "+
+               "               break;                  "+
+               "       }                                       "+
+               "       @ux;                            "+
+               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(testWhile07));
+       }
+
+       @Test
+       public void testWhile_M08()
+       {
+               String testWhile08 =
+               "void testWhile08 ()"+
+               "{     "+
+               " int @dx = 10; "+
+               " int y;   "+
+               " while( x )  "+
+               " {    "+
+               "  y = x + 1; "+
+               " }    "+
+               " $x;   "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testWhile08));
+       }
+
+       @Test
+       public void testWhile_M09()
+       {
+               String testWhile09 =
+               "void testWhile09 () "+
+               "{      "+
+               " int x = 10;   "+
+               " while( @ux )  "+
+               " {     "+
+               "  $x = @ux + 1; "+
+               " }     "+
+               " @ux;    "+
+               "}      ";
+               buildAndCheck(extractSourceAndMarkers(testWhile09));
+       }
+
+       @Test
+       public void testWhile_M10()
+       {
+               String testWhile10 =
+               "void testWhile10 () "+
+               "{      "+
+               " int @dx = 10;  "+
+               " int y;    "+
+               " while( $x )  "+
+               " {     "+
+               "  y = x + 1;  "+
+               " }     "+
+               " x;     "+
+               "}      ";
+               buildAndCheck(extractSourceAndMarkers(testWhile10));
+       }
+
+       @Test
+       public void testWhile_M11()
+       {
+               String testWhile11 =
+               "void testWhile11 () "+
+               "{      "+
+               " int @dx = 10;  "+
+               " int y;    "+
+               " while( x )   "+
+               " {     "+
+               "  y = $x + 1; "+
+               " }     "+
+               " x;     "+
+               "}      ";
+               buildAndCheck(extractSourceAndMarkers(testWhile11));
+       }
+
+       @Test
+       public void testWhile_M12()
+       {
+               String testWhile12 =
+               "void testWhile12 ()"+
+               "{     "+
+               " int @dx = 10; "+
+               " int y;   "+
+               " while( x )  "+
+               " {    "+
+               "  y = x + 1; "+
+               " }    "+
+               " $x;   "+
+               "}     ";
+               buildAndCheck(extractSourceAndMarkers(testWhile12));
+       }
+
+       @Test
+       public void testNestedWhile_M01()
+       {
+               String testNestedWhile01 =
+               "void testNestedWhile01()       "+
+               "{                                                      "+
+               "       int @dx;                                "+
+               "       while(1) {                              "+
+               "               $x;                             "+
+               "               while(1) {                      "+
+               "                       @dx = 1;                "+
+               "                       break;          "+
+               "               }                                       "+
+               "               x;                                      "+
+               "       }                                               "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedWhile01));
+       }
+
+       @Test
+       public void testNestedWhile_M02()
+       {
+               String testNestedWhile02 =
+               "void testNestedWhile02()       "+
+               "{                                                      "+
+               "       int x;                                  "+
+               "       while(1) {                              "+
+               "               @ux;                            "+
+               "               while(1) {                      "+
+               "                       $x = 1;         "+
+               "                       break;                  "+
+               "               }                                       "+
+               "               @ux;                            "+
+               "       }                                               "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedWhile02));
+       }
+
+       @Test
+       public void testNestedWhile_M03()
+       {
+               String testNestedWhile03 =
+               "void testNestedWhile03()       "+
+               "{                                                      "+
+               "       int @dx;                                "+
+               "       while(1) {                              "+
+               "               x;                                      "+
+               "               while(1) {                      "+
+               "                       @dx = 1;                "+
+               "                       break;                  "+
+               "               }                                       "+
+               "               $x;                             "+
+               "       }                                               "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedWhile03));
+       }
+
+       @Test
+       public void testNestedWhile_M04()
+       {
+               String testNestedWhile04 =
+               "void testNestedWhile04()       "+
+               "{                                                      "+
+               "       int $x;                         "+
+               "       while(1) {                              "+
+               "               @ux;                            "+
+               "               while(1) {                      "+
+               "                       x = @ux + 1;    "+
+               "                       break;                  "+
+               "               }                                       "+
+               "               @ux;                            "+
+               "       }                                               "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedWhile04));
+       }
+
+       @Test
+       public void testNestedWhile_M05()
+       {
+               String testNestedWhile05 =
+               "void testNestedWhile05()       "+
+               "{                                                      "+
+               "       int x;                                  "+
+               "       while(1) {                              "+
+               "               @ux;                            "+
+               "               while(1) {                      "+
+               "                       $x = @ux + 1;   "+
+               "                       break;                  "+
+               "               }                                       "+
+               "               @ux;                            "+
+               "       }                                               "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedWhile05));
+       }
+
+       @Test
+       public void testNestedWhile_M06()
+       {
+
+               String testNestedWhile06 =
+               "void testNestedWhile06()       "+
+               "{                                                      "+
+               "       int @dx;                                "+
+               "       while(1) {                              "+
+               "               x;                                      "+
+               "               while(1) {                      "+
+               "                       @dx = $x + 1;   "+
+               "                       break;                  "+
+               "               }                                       "+
+               "               x;                                      "+
+               "       }                                               "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedWhile06));
+       }
+
+       @Test
+       public void testNestedWhile_M07()
+       {
+               String testNestedWhile07 =
+               "void testNestedWhile07()       "+
+               "{                                                      "+
+               "       int @dx;                                "+
+               "       while(1) {                              "+
+               "               x;                                      "+
+               "               while(1) {                      "+
+               "                       @dx = x + 1;    "+
+               "                       break;                  "+
+               "               }                                       "+
+               "               $x;                             "+
+               "       }                                               "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedWhile07));
+       }
+
+       @Test
+       public void testNestedWhile_M09()
+       {
+
+               String testNestedWhile09 =
+               "void testNestedWhile09()       "+
+               "{                                                      "+
+               "       int $x;                         "+
+               "       while(1) {                              "+
+               "               @ux;                            "+
+               "               while(1) {                      "+
+               "                       x = @ux + 1;    "+
+               "                       continue;               "+
+               "               }                                       "+
+               "               @ux;                            "+
+               "       }                                               "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedWhile09));
+       }
+
+       @Test
+       public void testNestedWhile_M10()
+       {
+
+               String testNestedWhile10 =
+               "void testNestedWhile10()       "+
+               "{                                                      "+
+               "       int x;                                  "+
+               "       while(1) {                              "+
+               "               @ux;                            "+
+               "               while(1) {                      "+
+               "                       $x = @ux + 1;   "+
+               "                       continue;               "+
+               "               }                                       "+
+               "               @ux;                            "+
+               "       }                                               "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedWhile10));
+       }
+
+       @Test
+       public void testNestedWhile_M11()
+       {
+               String testNestedWhile11 =
+               "void testNestedWhile11()       "+
+               "{                                                      "+
+               "       int @dx;                                "+
+               "       while(1) {                              "+
+               "               x;                                      "+
+               "               while(1) {                      "+
+               "                       @dx = $x + 1;   "+
+               "                       continue;               "+
+               "               }                                       "+
+               "               x;                                      "+
+               "       }                                               "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedWhile11));
+       }
+
+       @Test
+       public void testNestedWhile_M012()
+       {
+               String testNestedWhile12 =
+               "void testNestedWhile12()       "+
+               "{                                                      "+
+               "       int @dx;                                "+
+               "       while(1) {                              "+
+               "               x;                                      "+
+               "               while(1) {                      "+
+               "                       @dx = x + 1;    "+
+               "                       continue;               "+
+               "               }                                       "+
+               "               $x;                             "+
+               "       }                                               "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedWhile12));
+       }
+
+       @Test
+       public void testNestedWhile_M13()
+       {
+               String testNestedWhile13 =
+               "void testNestedWhile13()"+
+               "{                                              "+
+               "       int $x;                 "+
+               "       while(1) {                      "+
+               "               @ux;                    "+
+               "               while(1) {              "+
+               "                       x = 1;          "+
+               "                       continue;       "+
+               "               }                               "+
+               "               @ux;                    "+
+               "       }                                       "+
+               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(testNestedWhile13));
+       }
+
+       @Test
+       public void testNestedWhile_M14()
+       {
+
+               String testNestedWhile14 =
+               "void testNestedWhile14() "+
+               "{                                               "+
+               "       int x;                           "+
+               "       while(1) {                       "+
+               "               @ux;                     "+
+               "               while(1) {               "+
+               "                       $x = 1;          "+
+               "                       continue;        "+
+               "               }                                "+
+               "               @ux;                     "+
+               "       } "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedWhile14));
+       }
+
+       @Test
+       public void testNestedWhile_M15()
+       {
+
+               String testNestedWhile15 =
+               "void testNestedWhile15()       "+
+               "{                                                      "+
+               "       int @dx;                                "+
+               "       while(1) {                              "+
+               "               x;                                      "+
+               "               while(1) {                      "+
+               "                       @dx = 1;                "+
+               "                       continue;               "+
+               "               }                                       "+
+               "               $x;                             "+
+               "       }                                               "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedWhile15));
+       }
+
+       @Test
+       public void testGotoLabel_M01()
+       {
+               String testGotoLabel01 =
+               "void gotoLabel01 () "+
+               "{                                   "+
+               "       int $x = 10;   "+
+               "       int y;           "+
+               "       L01:             "+
+               "               y = @ux + 10;"+
+               "       goto L01;        "+
+               "       x = x + 1;       "+
+               "}                   ";
+               buildAndCheck(extractSourceAndMarkers(testGotoLabel01));
+       }
+
+       @Test
+       public void testGotoLabel_M02()
+       {
+               String testGotoLabel02 =
+               "void gotoLabel02 () "+
+               "{                   "+
+               "       int $x = 10;   "+
+               "       int y;           "+
+               "       goto L02;        "+
+               "       x = x * 2;       "+
+               "       L02:             "+
+               "               x = @ux + 10;"+
+               "       x = x + 1;       "+
+               "}                   ";
+               buildAndCheck(extractSourceAndMarkers(testGotoLabel02));
+       }
+
+       @Test
+       public void testGotoLabel_M03()
+       {
+               String testGotoLabel03 =
+               "void gotoLabel03 ()  "+
+               "{                    "+
+               "       int $dx = 10;     "+
+               "       goto L03;         "+
+               "       $dx = x * 2;      "+
+               "       L03:              "+
+               "               y = $x + 10;"+
+               "}                    ";
+               buildAndCheck(extractSourceAndMarkers(testGotoLabel03));
+       }
+
+       @Test
+       public void testGotoLabel_M04()
+       {
+               String testGotoLabel04 =
+               "void gotoLabel04 ()  "+
+               "{                                    "+
+               "       int x = 10;               "+
+               "       int y;            "+
+               "       L04:              "+
+               "               y = x + 10;   "+
+               "       goto L04;         "+
+               "       y = $x;         "+
+               "}                    ";
+               buildAndCheck(extractSourceAndMarkers(testGotoLabel04));
+       }
+
+
+       @Test
+       public void testGotoLabel_M05()
+       {
+               String testGotoLabel05 =
+               "void gotoLabel05 ()    "+
+               "{                      "+
+               "       int @dx = 10;       "+
+               "       int y;              "+
+               "       L05:                "+
+               "               @dx = $x + 10;"+
+               "       goto L05;           "+
+               "       y = x;              "+
+               "}                      ";
+               buildAndCheck(extractSourceAndMarkers(testGotoLabel05));
+       }
+
+       @Test
+       public void testGotoLabel_M06()
+       {
+               String testGotoLabel06 =
+               "void gotoLabel06 ()     "+
+               "{                       "+
+               "       int x = 10;          "+
+               "       int y;               "+
+               "       L06:                 "+
+               "               $x = @ux + 10; "+
+               "       goto L06;            "+
+               "       y = x;               "+
+               "}                       ";
+               buildAndCheck(extractSourceAndMarkers(testGotoLabel06));
+       }
+
+       @Test
+       public void testIf_M01()
+       {
+               String testIf01 =
+               "void testIf01()                        "+
+               "{                                                      "+
+               "       int $x = 10;                    "+
+               "       int y;                                  "+
+               "       if( @ux > 10 )                  "+
+               "       {                                               "+
+               "               y = @ux + 2;            "+
+               "               return ( @ux + 2 ); "+
+               "               x = x + 2;                      "+
+               "       }                                               "+
+               "       x = @ux + 10;                   "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testIf01));
+       }
+
+       @Test
+       public void testIf_M02()
+       {
+               String testIf02 =
+               "void testIf02()                        "+
+               "{                                                      "+
+               "       int $x = 10;                    "+
+               "       if( @ux > 9 )                   "+
+               "       {                                               "+
+               "               x = @ux * 2;            "+
+               "       }                                               "+
+               "       else                                    "+
+               "       {                                               "+
+               "               fun(@ux,@ux+2);         "+
+               "       }                                               "+
+               "       x = @ux + 10;                   "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testIf02));
+       }
+
+       @Test
+       public void testIf_M03()
+       {
+               String testIf03 =
+               "void testIf03()                        "+
+               "{                                                      "+
+               "       int $x = 10;                    "+
+               "       if( @ux > 9 )                   "+
+               "       {                                               "+
+               "               x = @ux * 2;            "+
+               "       }                                               "+
+               "       else                                    "+
+               "       {                                               "+
+               "               x = fun(@ux,@ux+2);     "+
+               "       }                                               "+
+               "       x = x + 10;                             "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testIf03));
+       }
+
+       @Test
+       public void testIf_M04()
+       {
+               String testIf04 =
+               "void testIf04()                        "+
+               "{                                                      "+
+               "       int $x = 10;                    "+
+               "       if( @ux > 10 )                  "+
+               "       {                                               "+
+               "               x = func(@ux);          "+
+               "       }                                               "+
+               "       else if ( @ux < 7 )             "+
+               "       {                                               "+
+               "               x = @ux * @ux;          "+
+               "       }                                               "+
+               "       x =  @ux + 1;                   "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testIf04));
+       }
+
+       @Test
+       public void testIf_M05()
+       {
+               String testIf05 =
+               "void testIf05()                        "+
+               "{                                                      "+
+               "       int $x = 10;                    "+
+               "       if( @ux > 10 )                  "+
+               "       {                                               "+
+               "               x = y[@ux];                     "+
+               "       }                                               "+
+               "       else if ( ( x =  y ) < 7 )"+
+               "       {                                               "+
+               "               x =  x+1;                       "+
+               "       }                                               "+
+               "       x;                                              "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testIf05));
+       }
+
+       @Test
+       public void testIf_M06()
+       {
+               String testIf06 =
+               "void testIf06()                        "+
+               "{                                                      "+
+               "       int $x = 10;                    "+
+               "       if( @ux > 10 )                  "+
+               "       {                                               "+
+               "               x = y[@ux];                     "+
+               "       }                                               "+
+               "       else if ( @ux < 7 )             "+
+               "       {                                               "+
+               "               x =  y[@ux+1];          "+
+               "       }                                               "+
+               "       else                                    "+
+               "       {                                               "+
+               "               @ux;                            "+
+               "       }                                               "+
+               "       @ux;                                    "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testIf06));
+       }
+
+       @Test
+       public void testIf_M07()
+       {
+               String testIf07 =
+               "void testIf07()                        "+
+               "{                                                      "+
+               "       int @dx = 10;                   "+
+               "       int y;                                  "+
+               "       if( x > 10 )                    "+
+               "       {                                               "+
+               "               y = x + 2;                      "+
+               "               return ( x + 2 );       "+
+               "               @dx = x + 2;            "+
+               "       }                                               "+
+               "       x = $x + 10;                    "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testIf07));
+       }
+
+       @Test
+       public void testIf_M08()
+       {
+               String testIf08 =
+               "void testIf08()                "+
+               "{                                              "+
+               "       int @dx = 10;           "+
+               "       if( x > 9 )                     "+
+               "       {                                       "+
+               "               @dx = x * 2;    "+
+               "       }                                       "+
+               "       else                            "+
+               "       {                                       "+
+               "               fun(x,x+2);             "+
+               "       }                                       "+
+               "       x = $x + 10;            "+
+               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(testIf08));
+       }
+
+       @Test
+       public void testIf_M09()
+       {
+               String testIf09 =
+               "void testIf09()                "+
+               "{                                              "+
+               "       int x = 10;                     "+
+               "       if( x > 9 )                     "+
+               "       {                                       "+
+               "               @dx = x * 2;    "+
+               "       }                                       "+
+               "       else                            "+
+               "       {                                       "+
+               "               @dx = fun(x,x+2);"+
+               "       }                                       "+
+               "       x = $x + 10;            "+
+               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(testIf09));
+       }
+
+       @Test
+       public void testIf_M10()
+       {
+               String testIf10 =
+               "void testIf10()                "+
+               "{                                              "+
+               "       int @dx = 10;           "+
+               "       if( x > 10 )            "+
+               "       {                                       "+
+               "               @dx = func(x);  "+
+               "       }                                       "+
+               "       else if ( x < 7 )       "+
+               "       {                                       "+
+               "               @dx = x * x;    "+
+               "       }                                       "+
+               "       x =  $x + 1;            "+
+               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(testIf10));
+       }
+
+       @Test
+       public void testIf_M11()
+       {
+               String testIf11 =
+               "void testIf11()                "+
+               "{                                              "+
+               "       int x = 10;                     "+
+               "       if( x > 10 )            "+
+               "       {                                       "+
+               "               @dx = y[x];             "+
+               "       }                                       "+
+               "       else if ( ( @dx =  y ) < 7 )"+
+               "       {                                       "+
+               "               @dx =  x+1;             "+
+               "       }                                       "+
+               "       x = $x + 1;             "+
+               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(testIf11));
+       }
+
+       @Test
+       public void testIf_M12()
+       {
+               String testIf12 =
+               "void testIf12() "+
+               "{     "+
+               " int $x = 10; "+
+               " if ( @ux > 5 ) {"+
+               "  @ux;  "+
+               " }    "+
+               " @ux;   "+
+               "}     ";
+               buildAndCheck(extractSourceAndMarkers(testIf12));
+       }
+
+       @Test
+       public void testIf_M13()
+       {
+               String testIf13 =
+               "void testIf13() "+
+               "{     "+
+               " int @dx = 10; "+
+               " if ( $x > 5 ) {"+
+               "  x;   "+
+               " }    "+
+               " x;    "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testIf13));
+       }
+
+       @Test
+       public void testIf_M14()
+       {
+               String testIf14 =
+               "void testIf14() "+
+               "{     "+
+               " int @dx = 10; "+
+               " if ( x > 5 ) { "+
+               "  $x;  "+
+               " }    "+
+               " x;    "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testIf14));
+       }
+
+       @Test
+       public void testIf_M15()
+       {
+               String testIf15 =
+               "void testIf15() "+
+               "{     "+
+               " int @dx = 10; "+
+               " if ( x > 5 ) { "+
+               "  x;   "+
+               " }    "+
+               " $x;   "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testIf15));
+       }
+
+       @Test
+       public void testIf_M16()
+       {
+               String testIf16 =
+               "void testIf16() "+
+               "{     "+
+               " int @dx = 10; "+
+               " if ( x > 5 ) { "+
+               "  x = $x + 1;"+
+               " }    "+
+               " x;    "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testIf16));
+       }
+
+       @Test
+       public void testIf_M17()
+       {
+               String testIf17 =
+               "void testIf17() "+
+               "{     "+
+               " int x = 10;  "+
+               " if ( x > 5 ) { "+
+               "  $x = x + 1;"+
+               " }    "+
+               " @ux;   "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testIf17));
+       }
+
+       @Test
+       public void testIf_M18()
+       {
+               String testIf18 =
+               "void testIf18() "+
+               "{     "+
+               " int $x = 10; "+
+               " if( @ux > 9 ) { "+
+               "  x = @ux * 2;"+
+               " }    "+
+               " else {   "+
+               "  @ux;  "+
+               " }    "+
+               " @ux;   "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testIf18));
+       }
+
+       @Test
+       public void testIf_M19()
+       {
+               String testIf19 =
+               "void testIf19() "+
+               "{     "+
+               " int x = 10;  "+
+               " if( x > 9 ) { "+
+               "  $x = x * 2;"+
+               " }    "+
+               " else {   "+
+               "  x;   "+
+               " }    "+
+               " @ux;   "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testIf19));
+       }
+
+       @Test
+       public void testIf_M20()
+       {
+               String testIf20 =
+               "void testIf20() "+
+               "{     "+
+               " int @dx = 10; "+
+               " if( x > 9 ) { "+
+               "  x = x * 2; "+
+               " }    "+
+               " else {   "+
+               "  $x;  "+
+               " }    "+
+               " x;    "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testIf20));
+       }
+
+       @Test
+       public void testIf_M21()
+       {
+               String testIf21 =
+               "void testIf21() "+
+               "{     "+
+               " int @dx = 10; "+
+               " if( x > 9 ) { "+
+               "  @dx = x * 2;"+
+               " }    "+
+               " else {   "+
+               "  x;   "+
+               " }    "+
+               " $x;   "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testIf21));
+       }
+
+       @Test
+       public void testIf_M22()
+       {
+               String testIf22 =
+               "void testIf22() "+
+               "{     "+
+               " int x = 10;  "+
+               " if( x > 9 ) { "+
+               "  $x = x * 2;"+
+               " }    "+
+               " else {   "+
+               "  x;   "+
+               " }    "+
+               " @ux;   "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testIf22));
+       }
+
+       @Test
+       public void testIf_M23()
+       {
+               String testIf23 =
+               "void testIf23() "+
+               "{     "+
+               " int @dx = 10; "+
+               " if( x > 9 ) { "+
+               "  x = x * 2; "+
+               " }    "+
+               " else {   "+
+               "  $x;  "+
+               " }    "+
+               " x;    "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testIf23));
+       }
+
+       @Test
+       public void testIf_M24()
+       {
+               String testIf24 =
+               "void testIf24() "+
+               "{     "+
+               " int @dx = 10; "+
+               " if( x > 9 ) { "+
+               "  @dx = x * 2;"+
+               " }    "+
+               " else {   "+
+               "  x;   "+
+               " }    "+
+               " $x;   "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testIf24));
+       }
+
+       @Test
+       public void testFor_M01()
+       {
+               String testFor01 =
+               "void testFor01()                   "+
+               "{                                  "+
+               "       int $x = 1;                   "+
+               "       for( ; ; )                      "+
+               "       {                               "+
+               "               x = @ux + 1;                "+
+               "       }                               "+
+               "       x = @ux + 1;                    "+
+               "}                                  ";
+               buildAndCheck(extractSourceAndMarkers(testFor01));
+       }
+
+       @Test
+       public void testFor_M02()
+       {
+               String testFor02 =
+               "void testFor02()                   "+
+               "{                                  "+
+               "int @dx = 1;                       "+
+               "for( ; ; )                         "+
+               "{                                  "+
+               "@dx = x + 1;                       "+
+               "}                                  "+
+               "x = $x + 1;                      "+
+               "}                                  ";
+               buildAndCheck(extractSourceAndMarkers(testFor02));
+       }
+
+       @Test
+       public void testFor_M03()
+       {
+               String testFor03 =
+               "void testFor03()                   "+
+               "{                                  "+
+               "int $x = 10;                     "+
+               "for( ; @ux < 10; )                 "+
+               "{                                  "+
+               "x = @ux + 1;                       "+
+               "}                                  "+
+               "x = @ux + 1;                       "+
+               "}                                  ";
+               buildAndCheck(extractSourceAndMarkers(testFor03));
+       }
+
+       @Test
+       public void testFor_M04()
+       {
+               String testFor04 =
+               "void testFor04()                   "+
+               "{                                  "+
+               "int @dx = 10;                      "+
+               "for( ; ; @dx++ )                   "+
+               "{                                  "+
+               "x = $x + 1;                      "+
+               "}                                  "+
+               "x = x + 1;                         "+
+               "}                                  ";
+               buildAndCheck(extractSourceAndMarkers(testFor04));
+       }
+
+       @Test
+       public void testFor_M05()
+       {
+               String testFor05 =
+               "void testFor05()                   "+
+               "{                                  "+
+               "int x = 5;                         "+
+               "for( ; ; @ux++ )                   "+
+               "{                                  "+
+               "$x = x + 1;                      "+
+               "}                                  "+
+               "x = x + 1;                         "+
+               "}                                  ";
+               buildAndCheck(extractSourceAndMarkers(testFor05));
+       }
+
+       @Test
+       public void testFor_M06()
+       {
+               String testFor06 =
+               "void testFor06()                   "+
+               "{                                  "+
+               "int @dx = 5;                       "+
+               "for( ; x < 10 ; @dx++ )            "+
+               "{                                  "+
+               "x = x + 1;                         "+
+               "}                                  "+
+               "x = $x + 1;                      "+
+               "}                                  ";
+               buildAndCheck(extractSourceAndMarkers(testFor06));
+       }
+
+       @Test
+       public void testFor_M07()
+       {
+               String testFor07 =
+               "void testFor07()                   "+
+               "{                                  "+
+               "for(int @dx = 5 ; $x < 10 ; @dx++ )"+
+               "{                                  "+
+               "y = x + 1;                         "+
+               "}                                  "+
+               "x = x + 1;                         "+
+               "}                                  ";
+               buildAndCheck(extractSourceAndMarkers(testFor07));
+       }
+
+       @Test
+       public void testFor_M08()
+       {
+               String testFor08 =
+               "void testFor08()                   "+
+               "{                                  "+
+               "for(int x = 5 ; @ux < 10 ; $x++ )"+
+               "{                                  "+
+               "@dx = @ux + 1;                     "+
+               "}                                  "+
+               "x = x + 1;                         "+
+               "}                                  ";
+               buildAndCheck(extractSourceAndMarkers(testFor08));
+       }
+
+       @Test
+       public void testFor_M09()
+       {
+               String testFor09 =
+               "void testFor09()                   "+
+               "{                                  "+
+               "for(int @dx = 5 ; x < 10 ; @dx++ ) "+
+               "{                                  "+
+               "x = $x + 1;                      "+
+               "}                                  "+
+               "x = x + 1;                         "+
+               "}                                  ";
+               buildAndCheck(extractSourceAndMarkers(testFor09));
+       }
+
+       @Test
+       public void testFor_M10()
+       {
+               String testFor10 =
+               "void testFor10()                   "+
+               "{                                  "+
+               "int x;                             "+
+               "for($x = 5 ; @ux < 10 ; @ux++ )  "+
+               "{                                  "+
+               "continue;                          "+
+               "x = x + 1;                         "+
+               "}                                  "+
+               "x = @ux + 1;                       "+
+               "}                                  ";
+               buildAndCheck(extractSourceAndMarkers(testFor10));
+       }
+
+       @Test
+       public void testFor_M11()
+       {
+               String testFor11 =
+               "void testFor11()                   "+
+               "{                                  "+
+               "int x;                             "+
+               "for($x = 5 ; @ux < 10 ; x++ )  "+
+               "{                                  "+
+               "break;                             "+
+               "x = x + 1;                         "+
+               "}                                  "+
+               "x = @ux + 1;                         "+
+               "}                                  ";
+               buildAndCheck(extractSourceAndMarkers(testFor11));
+       }
+
+       @Test
+       public void testFor_M12()
+       {
+               String testFor12 =
+               "void testFor12()                   "+
+               "{                                  "+
+               "int x;                             "+
+               "for(@dx = 5 ; x < 10 ; @dx++ )     "+
+               "{                                  "+
+               "x = x + 1;                         "+
+               "}                                  "+
+               "x = $x + 1;                      "+
+               "}                                  ";
+               buildAndCheck(extractSourceAndMarkers(testFor12));
+       }
+
+       @Test
+       public void testFor_M13()
+       {
+               String testFor13 =
+               "void testFor13()  "+
+               "{      "+
+               " int @dx = 1;  "+
+               " for( ; ; )   "+
+               " {     "+
+               "  @dx = $x + 1; "+
+               " }     "+
+               " x =  x + 1;   "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testFor13));
+       }
+
+       @Test
+       public void testFor_M14()
+       {
+               String testFor14 =
+               "void testFor14()  "+
+               "{      "+
+               " int x = 1;   "+
+               " for( ; ; )   "+
+               " {     "+
+               "  $x = @ux + 1; "+
+               " }     "+
+               " x =  @ux + 1;  "+
+               "}      ";
+               buildAndCheck(extractSourceAndMarkers(testFor14));
+       }
+
+       @Test
+       public void testFor_M15()
+       {
+               String testFor15 =
+               "void testFor15()  "+
+               "{      "+
+               " int @dx = 1;  "+
+               " for( ; $x < 10 ; )"+
+               " {     "+
+               "  @dx = x + 1; "+
+               " }     "+
+               " x =  x + 1;   "+
+               "}      ";
+               buildAndCheck(extractSourceAndMarkers(testFor15));
+       }
+
+       @Test
+       public void testFor_M16()
+       {
+               String testFor16 =
+               "void testFor16()  "+
+               "{      "+
+               " int @dx = 1;  "+
+               " for( ; x < 10 ; ) "+
+               " {     "+
+               "  @dx = $x + 1; "+
+               " }     "+
+               " x =  x + 1;   "+
+               "}      ";
+               buildAndCheck(extractSourceAndMarkers(testFor16));
+       }
+
+       @Test
+       public void testFor_M17()
+       {
+               String testFor17 =
+               "void testFor17()  "+
+               "{      "+
+               " int @dx = 1;  "+
+               " for( ; x < 10 ; ) "+
+               " {     "+
+               "  @dx = x + 1; "+
+               " }     "+
+               " x =  $x + 1;  "+
+               "}      ";
+               buildAndCheck(extractSourceAndMarkers(testFor17));
+       }
+
+       @Test
+       public void testFor_M18()
+       {
+               String testFor18 =
+               "void testFor18()  "+
+               "{      "+
+               " int x = 1;   "+
+               " for( ; @ux < 10 ; ) "+
+               " {        "+
+               "  $x = @ux + 1; "+
+               " }     "+
+               " x =  @ux + 1;  "+
+               "}      ";
+               buildAndCheck(extractSourceAndMarkers(testFor18));
+       }
+
+       @Test
+       public void testFor_M19()
+       {
+               String testFor19 =
+               "void testFor19()  "+
+               "{      "+
+               " int @dx = 1;  "+
+               " for( ; x < 10 ; ) "+
+               " {     "+
+               "  $x;   "+
+               " }     "+
+               " x =  x + 1;   "+
+               "}      ";
+               buildAndCheck(extractSourceAndMarkers(testFor19));
+       }
+
+       @Test
+       public void testFor_M20()
+       {
+               String testFor20 =
+               "void testFor20()  "+
+               "{      "+
+               " int @dx = 1;  "+
+               " for( ; x < 10 ; ) "+
+               " {     "+
+               "  x;    "+
+               " }     "+
+               " x =  $x + 1;  "+
+               "}      ";
+               buildAndCheck(extractSourceAndMarkers(testFor20));
+       }
+
+       @Test
+       public void testFor_M21()
+       {
+               String testFor21 =
+               "void testFor21() "  +
+               "{       "+
+               " int $x;    "+
+               " for( ; @ux < 10; @ux++ )"+
+               " {      "+
+               "  @ux;    "+
+               " }      "+
+               " @ux;     "+
+               "}       ";
+               buildAndCheck(extractSourceAndMarkers(testFor21));
+       }
+
+       @Test
+       public void testFor_M22()
+       {
+               String testFor22 =
+               "void testFor22()   "+
+               "{       "+
+               " int @dx;    "+
+               " for( ; $x < 10; @dx++ )"+
+               " {      "+
+               "  x;     "+
+               " }      "+
+               " x;      "+
+               "}       ";
+               buildAndCheck(extractSourceAndMarkers(testFor22));
+       }
+
+       @Test
+       public void testFor_M23()
+       {
+               String testFor23 =
+               "void testFor23()   "+
+               "{       "+
+               " int @dx;     "+
+               " for( ; @ux < 10; $@mx++ )"+
+               " {      "+
+               "  @ux;    "+
+               " }      "+
+               " @ux;     "+
+               "}       ";
+               buildAndCheck(extractSourceAndMarkers(testFor23));
+       }
+
+       @Test
+       public void testFor_M24()
+       {
+               String testFor24 =
+               "void testFor24()   "+
+               "{       "+
+               " int @dx;    "+
+               " for( ; x < 10; @dx++ ) "+
+               " {      "+
+               "  $x;    "+
+               " }      "+
+               " x;      "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testFor24));
+       }
+
+       @Test
+       public void testFor_M25()
+       {
+               String testFor25 =
+               "void testFor25()"+
+               "{      "+
+               " int @dx;   "+
+               " for( ; x < 10; @dx++ )"+
+               " {     "+
+               "  x;    "+
+               " }     "+
+               " $x;    "+
+               "}      ";
+               buildAndCheck(extractSourceAndMarkers(testFor25));
+       }
+
+       @Test
+       public void testFor_M26()
+       {
+               String testFor26 =
+               "void testFor26()   "+
+               "{       "+
+               " int x;     "+
+               " for($x = 5 ; @ux < 10 ; x++ )"+
+               " {        "+
+               "  x = @ux + 1;    "+
+               " }        "+
+               " x = @ux + 1;     "+
+               "}         ";
+               buildAndCheck(extractSourceAndMarkers(testFor26));
+       }
+
+       @Test
+       public void testFor_M27()
+       {
+               String testFor27 =
+               "void testFor27()  "+
+               "{      "+
+               " int x;    "+
+               " for(@dx = 5 ; $x < 10 ; @dx++ )"+
+               " {        "+
+               "  x = x + 1;     "+
+               " }        "+
+               " x = x + 1;      "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testFor27));
+       }
+
+       @Test
+       public void testFor_M28()
+       {
+               String testFor28 =
+               "void testFor28()  "+
+               "{      "+
+               " int x;    "+
+               " for(x = 5 ; @ux < 10 ; $x++ )"+
+               " {        "+
+               "  @dx = @ux + 1;    "+
+               " }        "+
+               " x = @ux + 1;     "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testFor28));
+       }
+
+       @Test
+       public void testFor_M29()
+       {
+               String testFor29 =
+               "void testFor29()    "+
+               "{        "+
+               " int x;      "+
+               " for(@dx = 5 ; x < 10 ; @dx++ )"+
+               " {       "+
+               "  x = $x + 1;   "+
+               " }       "+
+               " x = x + 1;     "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testFor29));
+       }
+
+       @Test
+       public void testFor_M30()
+       {
+               String testFor30 =
+               "void testFor30()    "+
+               "{        "+
+               " int x;      "+
+               " for(x = 5 ; x < 10 ; @ux++ )"+
+               " {       "+
+               "  $x = x + 1;   "+
+               " }       "+
+               " x = x + 1;     "+
+               "}       ";
+               buildAndCheck(extractSourceAndMarkers(testFor30));
+       }
+
+       @Test
+       public void testNestedFor_M01()
+       {
+               String testNestedFor01 =
+               "void testNestedFor01() "+
+               "{                                                      "+
+               "       int @dx;                                "+
+               "       for(;;) {                               "+
+               "               $x;                             "+
+               "               for(;;) {                       "+
+               "                       @dx = 1;                "+
+               "                       break;          "+
+               "               }                                       "+
+               "               x;                                      "+
+               "       }                                               "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedFor01));
+       }
+
+       @Test
+       public void testNestedFor_M02()
+       {
+               String testNestedFor02 =
+               "void testNestedFor02() "+
+               "{                                                      "+
+               "       int x;                                  "+
+               "       for(;;) {                               "+
+               "               @ux;                            "+
+               "               for(;;) {                       "+
+               "                       $x = 1;         "+
+               "                       break;                  "+
+               "               }                                       "+
+               "               @ux;                            "+
+               "       }                                               "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedFor02));
+       }
+
+       @Test
+       public void testNestedFor_M03()
+       {
+               String testNestedFor03 =
+               "void testNestedFor03() "+
+               "{                                                      "+
+               "       int @dx;                                "+
+               "       for(;;) {                               "+
+               "               x;                                      "+
+               "               for(;;) {                       "+
+               "                       @dx = 1;                "+
+               "                       break;                  "+
+               "               }                                       "+
+               "               $x;                             "+
+               "       }                                               "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedFor03));
+       }
+
+       @Test
+       public void testNestedFor_M04()
+       {
+               String testNestedFor04 =
+               "void testNestedFor04() "+
+               "{                                                      "+
+               "       int $x;                         "+
+               "       for(;;) {                               "+
+               "               @ux;                            "+
+               "               for(;;) {                       "+
+               "                       x = @ux + 1;    "+
+               "                       break;                  "+
+               "               }                                       "+
+               "               @ux;                            "+
+               "       }                                               "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedFor04));
+       }
+
+       @Test
+       public void testNestedFor_M05()
+       {
+               String testNestedFor05 =
+               "void testNestedFor05() "+
+               "{                                                      "+
+               "       int x;                                  "+
+               "       for(;;) {                               "+
+               "               @ux;                            "+
+               "               for(;;) {                       "+
+               "                       $x = @ux + 1;   "+
+               "                       break;                  "+
+               "               }                                       "+
+               "               @ux;                            "+
+               "       }                                               "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedFor05));
+       }
+
+       @Test
+       public void testNestedFor_M06()
+       {
+               String testNestedFor06 =
+               "void testNestedFor06() "+
+               "{                                                      "+
+               "       int @dx;                                "+
+               "       for(;;) {                               "+
+               "               x;                                      "+
+               "               for(;;) {                       "+
+               "                       @dx = $x + 1;   "+
+               "                       break;                  "+
+               "               }                                       "+
+               "               x;                                      "+
+               "       }                                               "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedFor06));
+       }
+
+       @Test
+       public void testNestedFor_M07()
+       {
+               String testNestedFor07 =
+               "void testNestedFor07() "+
+               "{                                                      "+
+               "       int @dx;                                "+
+               "       for(;;) {                               "+
+               "               x;                                      "+
+               "               for(;;) {                       "+
+               "                       @dx = x + 1;    "+
+               "                       break;                  "+
+               "               }                                       "+
+               "               $x;                             "+
+               "       }                                               "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedFor07));
+       }
+
+       @Test
+       public void testNestedFor_M09()
+       {
+               String testNestedFor09 =
+               "void testNestedFor09() "+
+               "{                                                      "+
+               "       int $x;                         "+
+               "       for(;;) {                               "+
+               "               @ux;                            "+
+               "               for(;;) {                       "+
+               "                       x = @ux + 1;    "+
+               "                       continue;               "+
+               "               }                                       "+
+               "               @ux;                            "+
+               "       }                                               "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedFor09));
+       }
+
+       @Test
+       public void testNestedFor_M10()
+       {
+               String testNestedFor10 =
+               "void testNestedFor10() "+
+               "{                                                      "+
+               "       int x;                                  "+
+               "       for(;;) {                               "+
+               "               @ux;                            "+
+               "               for(;;) {                       "+
+               "                       $x = @ux + 1;   "+
+               "                       continue;               "+
+               "               }                                       "+
+               "               @ux;                            "+
+               "       }                                               "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedFor10));
+       }
+
+       @Test
+       public void testNestedFor_M11()
+       {
+               String testNestedFor11 =
+               "void testNestedFor11() "+
+               "{                                                      "+
+               "       int @dx;                                "+
+               "       for(;;) {                               "+
+               "               x;                                      "+
+               "               for(;;) {                       "+
+               "                       @dx = $x + 1;   "+
+               "                       continue;               "+
+               "               }                                       "+
+               "               x;                                      "+
+               "       }                                               "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedFor11));
+       }
+
+       @Test
+       public void testNestedFor_M012()
+       {
+               String testNestedFor12 =
+               "void testNestedFor12() "+
+               "{                                                      "+
+               "       int @dx;                                "+
+               "       for(;;) {                               "+
+               "               x;                                      "+
+               "               for(;;) {                       "+
+               "                       @dx = x + 1;    "+
+               "                       continue;               "+
+               "               }                                       "+
+               "               $x;                             "+
+               "       }                                               "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedFor12));
+       }
+
+       @Test
+       public void testNestedFor_M13()
+       {
+               String testNestedFor13 =
+               "void testNestedFor13()"+
+               "{                                              "+
+               "       int $x;                 "+
+               "       for(;;) {                       "+
+               "               @ux;                    "+
+               "               for(;;) {               "+
+               "                       x = 1;          "+
+               "                       continue;       "+
+               "               }                               "+
+               "               @ux;                    "+
+               "       }                                       "+
+               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(testNestedFor13));
+       }
+
+       @Test
+       public void testNestedFor_M14()
+       {
+               String testNestedFor14 =
+               "void testNestedFor14() "+
+               "{                                               "+
+               "       int x;                           "+
+               "       for(;;) {                        "+
+               "               @ux;                     "+
+               "               for(;;) {                "+
+               "                       $x = 1;          "+
+               "                       continue;        "+
+               "               }                                "+
+               "               @ux;                     "+
+               "       } "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedFor14));
+       }
+
+       @Test
+       public void testNestedFor_M15()
+       {
+               String testNestedFor15 =
+               "void testNestedFor15() "+
+               "{                                                      "+
+               "       int @dx;                                "+
+               "       for(;;) {                               "+
+               "               x;                                      "+
+               "               for(;;) {                       "+
+               "                       @dx = 1;                "+
+               "                       continue;               "+
+               "               }                                       "+
+               "               $x;                             "+
+               "       }                                               "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedFor15));
+       }
+
+       @Test
+       public void testDoWhile_M01()
+       {
+               String testDoWhile01 =
+               "void testDoWhile01()   "+
+               "{                                      "+
+               "       int $x = 5;             "+
+               "       do{                              "+
+               "               x = @ux + 1;    "+
+               "       } while( x < 10 );  "+
+               "       x = x + 5;              "+
+               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(testDoWhile01));
+       }
+
+       @Test
+       public void testDoWhile_M02()
+       {
+               String testDoWhile02 =
+               "void testDoWhile02()    "+
+               "{                                       "+
+               "       int x = 5;                "+
+               "       do{                                     "+
+               "               $x = @ux + 1;    "+
+               "       } while( @ux < 10 );    "+
+               "       x = @ux + 5;             "+
+               "}                                       ";
+               buildAndCheck(extractSourceAndMarkers(testDoWhile02));
+       }
+
+       @Test
+       public void testDoWhile_M03()
+       {
+               String testDoWhile03 =
+               "void testDoWhile03()     "+
+               "{                                        "+
+               "       int @dx = 5;              "+
+               "       do{                                     "+
+               "               @dx = $x + 1;    "+
+               "       } while( x < 10 );    "+
+               "       x = x + 5;                "+
+               "}                                        ";
+               buildAndCheck(extractSourceAndMarkers(testDoWhile03));
+       }
+
+       @Test
+       public void testDoWhile_M04()
+       {
+               String testDoWhile04 =
+               "void testDoWhile04()    "+
+               "{                                       "+
+               "       int x = 5;              "+
+               "       do{                             "+
+               "               @dx = x + 1;            "+
+               "       } while( x < 10 );  "+
+               "       x = $x + 5;              "+
+               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(testDoWhile04));
+       }
+
+       @Test
+       public void testDoWhile_M05()
+       {
+               String testDoWhile05 =
+               "void testDoWhile05()    "+
+               "{                                       "+
+               "       int x = 5;              "+
+               "       do{                             "+
+               "               @dx = @ux + 1;  "+
+               "       } while( ( $x += 2 ) < 10 );    "+
+               "       x = @ux + 5;            "+
+               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(testDoWhile05));
+       }
+
+       @Test
+       public void testDoWhile_M06()
+       {
+               String testDoWhile06 =
+               "void testDoWhile06()    "+
+               "{                                      "+
+               "       int $x = 5;     "+
+               "       do{                              "+
+               "               continue;       "+
+               "               x = x + 1;      "+
+               "       } while( @ux > 10 ); "+
+               "       x = @ux + 5;             "+
+               "}                                       ";
+               buildAndCheck(extractSourceAndMarkers(testDoWhile06));
+       }
+
+       @Test
+       public void testDoWhile_M07()
+       {
+               String testDoWhile07 =
+               "void testDoWhile07()    "+
+               "{                                   "+
+               "       int @dx = 5;         "+
+               "       do{                             "+
+               "               continue;        "+
+               "               @dx = x + 1;       "+
+               "       } while( $x > 10 );  "+
+               "       x = x + 5;              "+
+               "}                                        ";
+               buildAndCheck(extractSourceAndMarkers(testDoWhile07));
+       }
+
+       @Test
+       public void testDoWhile_M08()
+       {
+               String testDoWhile08 =
+               "void testDoWhile08()   "+
+               "{                                      "+
+               "       int x = 5;              "+
+               "       do{                             "+
+               "               $x = x + 1;   "+
+               "               break;                  "+
+               "       } while( x > 10 );  "+
+               "       x = @ux + 5;            "+
+               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(testDoWhile08));
+       }
+
+       @Test
+       public void testDoWhile_M09()
+       {
+               String testDoWhile09 =
+               "void testDoWhile09()  "+
+               "{ " +
+               " int x = 5;    "+
+               " do{      "+
+               "  @dx = x + 1;  "+
+               " } while( $x < 10 ); "+
+               " x = x + 5;    "+
+               "}       ";
+               buildAndCheck(extractSourceAndMarkers(testDoWhile09));
+       }
+
+       @Test
+       public void testDoWhile_M10()
+       {
+               String testDoWhile10 =
+               "void testDoWhile10()  "+
+               "{ " +
+               " int $x = 5;   "+
+               " int y;     "+
+               " do{      "+
+               "  y = @ux + 1;  "+
+               " }while( @ux < 10 );  "+
+               " x =  @ux + 1;   "+
+               "}       ";
+               buildAndCheck(extractSourceAndMarkers(testDoWhile10));
+       }
+
+       @Test
+       public void testDoWhile_M11()
+       {
+               String testDoWhile11 =
+               "void testDoWhile11()  "+
+               "{       "+
+               " int @dx = 5;   "+
+               " int y;     "+
+               " do{      "+
+               "  y = $x + 1;  "+
+               " }while( x < 10 );  "+
+               " x =  x + 1;    "+
+               "} ";
+               buildAndCheck(extractSourceAndMarkers(testDoWhile11));
+       }
+
+       @Test
+       public void testDoWhile_M12()
+       {
+               String testDoWhile12 =
+               "void testDoWhile12()  "+
+               "{       "+
+               " int @dx = 5;   "+
+               " int y;     "+
+               " do{      "+
+               "  y = x + 1;   "+
+               " }while( $x < 10 ); "+
+               " x =  x + 1;    "+
+               "}  ";
+               buildAndCheck(extractSourceAndMarkers(testDoWhile12));
+       }
+
+       @Test
+       public void testDoWhile_M13()
+       {
+               String testDoWhile13 =
+               "void testDoWhile13()  "+
+               "{       "+
+               " int x = 5;    "+
+               " do{      "+
+               "  @dx = x + 1;  "+
+               " } while( $x > 10 ); "+
+               " x = x + 5;    "+
+               "} ";
+               buildAndCheck(extractSourceAndMarkers(testDoWhile13));
+       }
+
+       @Test
+       public void testDoWhile_M14()
+       {
+               String testDoWhile14 =
+               "void testDoWhile14()  "+
+               "{       "+
+               " int @dx = 5;   "+
+               " int y;     "+
+               " do{      "+
+               "  y = x + 1;   "+
+               " }while( x < 10 );  "+
+               " x =  $x + 1;   "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testDoWhile14));
+       }
+
+       @Test
+       public void testNestedDoWhile_M01()
+       {
+               String testNestedDoWhile01 =
+               "void testNestedDoWhile01()     "+
+               "{                                                      "+
+               "       int $x = 10;                    "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       x = 1;                  "+
+               "                       break;                  "+
+               "               } while(1);                     "+
+               "               x;                                      "+
+               "       } while(1);                             "+
+               "       x;                                              "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile01));
+       }
+
+       @Test
+       public void testNestedDoWhile_M02()
+       {
+               String testNestedDoWhile02 =
+               "void testNestedDoWhile02()     "+
+               "{                                                      "+
+               "       int x = 10;                             "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       $x = 1;         "+
+               "                       break;                  "+
+               "               } while(1);                     "+
+               "               @ux;                            "+
+               "       } while(1);                             "+
+               "       @ux;                                    "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile02));
+       }
+
+       @Test
+       public void testNestedDoWhile_M03()
+       {
+               String testNestedDoWhile03 =
+               "void testNestedDoWhile03()"+
+               "{                                                      "+
+               "       int x = 10;                             "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       @dx = 1;                "+
+               "                       break;                  "+
+               "               } while(1);                     "+
+               "               $x;                             "+
+               "       } while(1);                             "+
+               "       x;                                              "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile03));
+       }
+
+       @Test
+       public void testNestedDoWhile_M04()
+       {
+               String testNestedDoWhile04 =
+               "void testNestedDoWhile04()     "+
+               "{                                                      "+
+               "       int x = 10;                             "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       @dx = 1;                "+
+               "                       break;                  "+
+               "               } while(1);                     "+
+               "               x;                                      "+
+               "       } while(1);                             "+
+               "       $x;                                     "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile04));
+       }
+
+       @Test
+       public void testNestedDoWhile_M05()
+       {
+               String testNestedDoWhile05 =
+               "void testNestedDoWhile05()     "+
+               "{                                                      "+
+               "       int $x = 10;                    "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       x = @ux + 1;    "+
+               "                       break;                  "+
+               "               } while(1);                     "+
+               "               x;                                      "+
+               "       } while(1);                             "+
+               "       x;                                              "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile05));
+       }
+
+       @Test
+       public void testNestedDoWhile_M06()
+       {
+               String testNestedDoWhile06 =
+               "void testNestedDoWhile06()     "+
+               "{                                                      "+
+               "       int @dx = 10;                   "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       @dx = $x + 1;   "+
+               "                       break;                  "+
+               "               } while(1);                     "+
+               "               x;                                      "+
+               "       } while(1);                             "+
+               "       x;                                              "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile06));
+       }
+
+       @Test
+       public void testNestedDoWhile_M07()
+       {
+               String testNestedDoWhile07 =
+               "void testNestedDoWhile07()     "+
+               "{                                                      "+
+               "       int x = 10;                             "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       $x = @ux + 1;   "+
+               "                       break;                  "+
+               "               } while(1);                     "+
+               "               @ux;                            "+
+               "       } while(1);                             "+
+               "       @ux;                                    "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile07));
+       }
+
+       @Test
+       public void testNestedDoWhile_M08()
+       {
+               String testNestedDoWhile08 =
+               "void testNestedDoWhile08()     "+
+               "{                                                      "+
+               "       int x = 10;                             "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       @dx = x + 1;    "+
+               "                       break;                  "+
+               "               } while(1);                     "+
+               "               $x;                             "+
+               "       } while(1);                             "+
+               "       x;                                              "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile08));
+       }
+
+       @Test
+       public void testNestedDoWhile_M09()
+       {
+               String testNestedDoWhile09 =
+               "void testNestedDoWhile09()     "+
+               "{                                                      "+
+               "       int x = 10;                             "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       @dx = x + 1;    "+
+               "                       break;                  "+
+               "               } while(1);                     "+
+               "               x;                                      "+
+               "       } while(1);                             "+
+               "       $x;                                     "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile09));
+       }
+
+       @Test
+       public void testNestedDoWhile_M10()
+       {
+               String testNestedDoWhile10 =
+               "void testNestedDoWhile10()     "+
+               "{                                                      "+
+               "       int x = 10;                             "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       $x = 1;         "+
+               "                       continue;               "+
+               "               } while(1);                     "+
+               "               @ux;                            "+
+               "       } while(1);                             "+
+               "       @ux;                                    "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile10));
+       }
+
+       @Test
+       public void testNestedDoWhile_M11()
+       {
+               String testNestedDoWhile11 =
+               "void testNestedDoWhile11()     "+
+               "{                                                      "+
+               "       int x = 10;                             "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       @dx = 1;                "+
+               "                       continue;               "+
+               "               } while(1);                     "+
+               "               $x;                             "+
+               "       } while(1);                             "+
+               "       x;                                              "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile11));
+       }
+
+       @Test
+       public void testNestedDoWhile_M12()
+       {
+               String testNestedDoWhile12 =
+               "void testNestedDoWhile12()     "+
+               "{                                                      "+
+               "       int x = 10;                             "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       @dx = 1;                "+
+               "                       continue;               "+
+               "               } while(1);                     "+
+               "               x;                                      "+
+               "       } while(1);                             "+
+               "       $x;                                     "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile12));
+       }
+
+       @Test
+       public void testNestedDoWhile_M13()
+       {
+               String testNestedDoWhile13 =
+               "void testNestedDoWhile13()     "+
+               "{                                                      "+
+               "       int x = 10;                             "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       $x = @ux + 1;   "+
+               "                       continue;               "+
+               "               } while(1);                     "+
+               "               @ux;                            "+
+               "       } while(1);                             "+
+               "       @ux;                                    "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile13));
+       }
+
+       @Test
+       public void testNestedDoWhile_M14()
+       {
+
+               String testNestedDoWhile14 =
+               "void testNestedDoWhile14()     "+
+               "{                                                      "+
+               "       int @dx = 10;                   "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       @dx = $x + 1;   "+
+               "                       continue;               "+
+               "               } while(1);                     "+
+               "               x;                                      "+
+               "       } while(1);                             "+
+               "       x;                                              "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile14));
+       }
+
+       @Test
+       public void testNestedDoWhile_M15()
+       {
+               String testNestedDoWhile15 =
+               "void testNestedDoWhile15()     "+
+               "{                                                      "+
+               "       int x = 10;                             "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       @dx = x + 1;    "+
+               "                       continue;               "+
+               "               } while(1);                     "+
+               "               $x;                             "+
+               "       } while(1);                             "+
+               "       x;                                              "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile15));
+       }
+
+       @Test
+       public void testNestedDoWhile_M16()
+       {
+               String testNestedDoWhile16 =
+               "void testNestedDoWhile16()     "+
+               "{                                                      "+
+               "       int x = 10;                             "+
+               "       do{                                             "+
+               "               do {                            "+
+               "                       @dx = x + 1;    "+
+               "                       continue;               "+
+               "               } while(1);                     "+
+               "               x;                                      "+
+               "       } while(1);                             "+
+               "       $x;                                     "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testNestedDoWhile16));
+       }
+
+       @Test
+       public void testFunctionParam_M01()
+       {
+               String testFunctionParam01 =
+               "void funcParamTest01( int ((($x))), int ((x1)), int (x2) )"+
+               "{                                                                                                                "+
+               "       int val;                                                                                          "+
+               "       int result = (@ux) + x1 + ((val) = x2);                         "+
+               "}                                                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(testFunctionParam01));
+       }
+
+       @Test
+       public void testFunctionParam_M02()
+       {
+               String testFunctionParam02 =
+               "void funcParamTest02( int (((x))), int (($x1)), int (x2) )"+
+               "{                                                                                                              "+
+               "       int val;                                                                                        "+
+               "       int result = (x) + @ux1 + ((val) = x2);                         "+
+               "}                                                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(testFunctionParam02));
+       }
+
+       @Test
+       public void testFunctionParam_M03()
+       {
+               String testFunctionParam03 =
+               "void funcParamTest03( int (((x))), int ((x1)), int ($x2) )"+
+               "{                                                                                                               "+
+               "       int val;                                                                                        "+
+               "       int result = (x) + x1 + ((val) = @ux2);                         "+
+               "}                                                                                                              ";
+               buildAndCheck(extractSourceAndMarkers(testFunctionParam03));
+       }
+
+       @Test
+       public void testFunctionParam_M04()
+       {
+               String testFunctionParam04 =
+               "void funcParamTest04( int (((@dx))), int ((x1)), int (x2) )"+
+               "{                                                                                                              "+
+               "       int val;                                                                                        "+
+               "       int result = ($x) + x1 + ((val) = x2);                          "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testFunctionParam04));
+       }
+
+       @Test
+       public void testFunctionParam_M05()
+       {
+               String testFunctionParam05 =
+               "void funcParamTest05( int (((x))), int ((@dx1)), int (x2) )"+
+               "{                                                                                                                      "+
+               "       int val;                                                                                                "+
+               "       int result = (x) + $x1 + ((val) = x2);                          "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testFunctionParam05));
+       }
+
+       @Test
+       public void testFunctionParam_M06()
+       {
+               String testFunctionParam06 =
+               "void funcParamTest06( int (((x))), int ((x1)), int (@dx2) )"+
+               "{                                                                                                                      "+
+               "       int val;                                                                                                "+
+               "       int result = (x) + x1 + ((val) = $x2);                                  "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testFunctionParam06));
+       }
+
+       @Test
+       public void testFunctionParam_M07()
+       {
+               String code =
+               "void func( $a )"+
+               "{                                                                                                                      "+
+               "       @ua;                                                                                                    "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testFunctionParam_M08()
+       {
+               String code =
+               "void func( @da )"+
+               "{                                                                                                                      "+
+               "       $a;                                                                                                             "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testSwitch_M01()
+       {
+               String testSwitch01 =
+               "void testSwitch01()"           +
+               "{                                                      "+
+               "       int $x = 10;                    "+
+               "       switch(@ux)                             "+
+               "       {                                               "+
+               "               case 10: @ux;           "+
+               "               case 20: x = @ux + 1; break;"+
+               "       }                                               "+
+               "       @ux;                                            "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch01));
+       }
+
+       @Test
+       public void testSwitch_M02()
+       {
+               String testSwitch02 =
+               "void testSwitch02()                    "+
+               "{                                                              "+
+               "       int $x = 10;                            "+
+               "       switch(@ux)                                     "+
+               "       {                                                       "+
+               "       case 10: x = @ux + 1;           "+
+               "       case 20: x = @ux + 1; break;"+
+               "       default: x = @ux + 2;           "+
+               "       }                                                       "+
+               "       x;                                                      "+
+               "}                                                              ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch02));
+       }
+
+       @Test
+       public void testSwitch_M03()
+       {
+               String testSwitch03 =
+               "void testSwitch03()            "+
+               "{                                                      "+
+               "       int x = 10;                             "+
+               "       switch(x)                               "+
+               "       {                                               "+
+               "       case 10: x = x + 1;             "+
+               "       case 20: @dx = x + 1; break;"+
+               "       default: @dx = x + 2;   "+
+               "       }                                               "+
+               "       $x;                                     "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch03));
+       }
+
+       @Test
+       public void testSwitch_M04()
+       {
+               String testSwitch04 =
+               "void testSwitch04()            "+
+               "{                                                      "+
+               "       int x = 10;                             "+
+               "       switch(x)                               "+
+               "       {                                               "+
+               "       case 10: $x = x + 1;    "+
+               "       case 20: @ux + 1; break;"+
+               "       default: x = x + 2;             "+
+               "       }                                               "+
+               "       @ux;                                    "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch04));
+       }
+
+       @Test
+       public void testSwitch_M05()
+       {
+               String testSwitch05 =
+               "void testSwitch05()            "+
+               "{                                                      "+
+               "       int $x = 10;                    "+
+               "       int y;                                  "+
+               "       switch(@ux)                             "+
+               "       {                                               "+
+               "               y = x + 1;                      "+
+               "               case 10: @ux; break;"+
+               "               case 20: @ux;           "+
+               "       }                                               "+
+               "       @ux;                                    "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch05));
+       }
+
+       @Test
+       public void testSwitch_M06()
+       {
+               String testSwitch06 =
+               "void testSwitch06()                    "+
+               "{                                                              "+
+               "       int @dx = 10;                           "+
+               "       switch(x)                                       "+
+               "       {                                                       "+
+               "       case 10: @dx = x + 1;           "+
+               "       case 20: x = $x + 1; break;"+
+               "       default: x = x + 2;                     "+
+               "       }                                                       "+
+               "       x;                                                      "+
+               "}                                                              ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch06));
+       }
+
+       @Test
+       public void testSwitch_M07()
+       {
+               String testSwitch07 =
+               "void testSwitch07()            "+
+               "{                                                      "+
+               "       int @dx = 10;                   "+
+               "       switch(x)                               "+
+               "       {                                               "+
+               "       case 10: x = $x + 1;    "+
+               "       case 20: x = x + 1; break;"+
+               "       }                                               "+
+               "       x = x + 1;                              "+
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch07));
+       }
+
+       @Test
+       public void testSwitch_M08()
+       {
+               String testSwitch08 =
+               "void testSwitch08()                    "+
+               "{                                                              "+
+               "       int @dx = 10;                           "+
+               "       switch(x)                                       "+
+               "       {                                                       "+
+               "       case 10: x = x + 1;                     "+
+               "       case 20: x = x + 1; break;  "+
+               "       default: x = $x + 2;            "+
+               "       }                                                       "+
+               "       x;                                                      "+
+               "}                                                              ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch08));
+       }
+
+       @Test
+       public void testSwitch_M09()
+       {
+               String testSwitch09 =
+               "void testSwitch09()                    "+
+               "{                                                              "+
+               "       int x = 10;                                     "+
+               "       int y;                                          "+
+               "       switch(x)                                       "+
+               "       {                                                       "+
+               "               $x = 1;                         "+
+               "               y = @ux + 1;                    "+
+               "               case 10: @ux; break;    "+
+               "               case 20: x;                             "+
+               "       }                                                       "+
+               "       @ux;                                            "+
+               "}                                                              ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch09));
+       }
+
+       @Test
+       public void testSwitch_M10()
+       {
+               String testSwitch10=
+               "void testSwitch10()                    "+
+               "{                                                              "+
+               "       int @dx = 10;                           "+
+               "       switch(x)                                       "+
+               "       {                                                       "+
+               "               case 10: @dx = x++;             "+
+               "               case 20: x;                             "+
+               "               default: x = $x + 2;    "+
+               "       }                                                       "+
+               "       x;                                                      "+
+               "}                                                              ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch10));
+       }
+
+       @Test
+       public void testSwitch_M11()
+       {
+               String testSwitch11 =
+               "void testSwitch11() "+
+               "{      "+
+               " int @dx = 10;  "+
+               " switch(x)   "+
+               " {     "+
+               " case 10: x;   "+
+               " default: x = $x+1;"+
+               " }     "+
+               " x;     "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testSwitch11));
+       }
+
+       @Test
+       public void testSwitch_M12()
+       {
+               String testSwitch12 =
+               "void testSwitch12() "+
+               "{      "+
+               " int x = 10;   "+
+               " switch(x)   "+
+               " {     "+
+               " case 10: x;   "+
+               " default: $x = x+1;"+
+               " }     "+
+               " @ux;    "+
+               "}      ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch12));
+       }
+
+       @Test
+       public void testSwitch_M13()
+       {
+               String testSwitch13 =
+               "void testSwitch13() "+
+               "{      "+
+               " int x = 10;   "+
+               " switch(x)   "+
+               " {     "+
+               " case 10: x;   "+
+               " default: @dx = x+1; "+
+               " }     "+
+               " $x;    "+
+               "}";
+               buildAndCheck(extractSourceAndMarkers(testSwitch13));
+       }
+
+       @Test
+       public void testSwitch_M14()
+       {
+               String testSwitch14 =
+               "void testSwitch14() "+
+               "{      "+
+               " int $x = 10;  "+
+               " switch(@ux)   "+
+               " {     "+
+               " case 10: x = @ux+1; "+
+               " default: @ux+1;  "+
+               " }     "+
+               " @ux;    "+
+               "}      ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch14));
+       }
+
+       @Test
+       public void testSwitch_M15()
+       {
+               String testSwitch15 =
+               "void testSwitch15() "+
+               "{      "+
+               " int @dx = 10;  "+
+               " switch(x)   "+
+               " {     "+
+               " case 10: @dx = x+1; "+
+               " default: x = $x+1;"+
+               " }     "+
+               " x;     "+
+               "}      ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch15));
+       }
+
+       @Test
+       public void testSwitch_M16()
+       {
+               String testSwitch16 =
+               "void testSwitch16() "+
+               "{      "+
+               " int $x = 10;  "+
+               " switch(@ux)   "+
+               " {     "+
+               " case 10: @ux; break;"+
+               " default: x = @ux+1; "+
+               " }     "+
+               " @ux;    "+
+               "}      ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch16));
+       }
+
+       @Test
+       public void testSwitch_M17()
+       {
+               String testSwitch17 =
+               "void testSwitch17()   "+
+               "{        "+
+               " int x = 10;    "+
+               " switch(x)     "+
+               " {       "+
+               " case 10: @dx = x+1; break; "+
+               " default: @dx = x+1;   "+
+               " }       "+
+               " $x;      "+
+               "}        ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch17));
+       }
+
+       @Test
+       public void testSwitch_M18()
+       {
+               String testSwitch18 =
+               "void testSwitch18()   "+
+               "{        "+
+               " int x = 10;     "+
+               " switch(x)     "+
+               " {       "+
+               " case 10: $x = x+1; break; "+
+               " default: x = x+1;   "+
+               " }       "+
+               " @ux;      "+
+               "}        ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch18));
+       }
+
+       @Test
+       public void testSwitch_M19()
+       {
+               String testSwitch19 =
+               "void testSwitch19()   "+
+               "{        "+
+               " int @dx = 10;    "+
+               " switch(x)     "+
+               " {       "+
+               " case 10: x = x+1; break; "+
+               " default: x = $x+1;  "+
+               " }       "+
+               " x;       "+
+               "}        ";
+               buildAndCheck(extractSourceAndMarkers(testSwitch19));
+       }
+
+       @Test
+       public void testNestedSwitch_M01()
+       {
+               String testNestedSwitch01 =
+               "void testNestedSwitch1() {              "+
+               "int result = 100;                       "+
+               "int $tmp;                               "+
+        "                                        "+
+               "switch( result )                        "+
+               "{                                       "+
+               "case 10: tmp = @utmp + 1;               "+
+               "case 20: switch ( @utmp )               "+
+               "               {                                "+
+               "               case 30: tmp = @utmp + 3; break; "+
+               "               case 40: tmp = @utmp + 10; break;"+
+               "               }                                "+
+               "               tmp = @utmp + result;            "+
+               "               break;                           "+
+               "}                                       "+
+               "result = @utmp;                         "+
+               "}                                       ";
+               buildAndCheck(extractSourceAndMarkers(testNestedSwitch01));
+       }
+
+       @Test
+       public void nestedSwitchTest_M2()
+       {
+               String testNestedSwitch02 =
+               "void nestedSwitchTest2()                                "+
+           "{                                                                           "+
+               "int result = 100;                                               "+
+               "int $tmp;                                                               "+
+        "                                                                               "+
+               "switch( result )                                                "+
+               "{                                                                               "+
+               "case 10: tmp = @utmp + 1;                               "+
+               "case 20: switch ( @utmp )                               "+
+               "               {                                                                "+
+               "               case 30: tmp = @utmp + 3; break; "+
+               "               case 40: tmp = @utmp + 10; break;"+
+               "               default : tmp = @utmp + 5;       "+
+               "               }                                                                "+
+               "               tmp = tmp + result;              "+
+               "               break;                                                   "+
+               "}                                                                               "+
+               "result = @utmp;                         "+
+               "}                                       ";
+                buildAndCheck(extractSourceAndMarkers(testNestedSwitch02));
+       }
+
+       @Test
+       public void nestedSwitchTest_M3()
+       {
+               String testNestedSwitch03 =
+               "void nestedSwitchTesst3()              "+
+               "{                                                                              "+
+               "int result = 100;                                              "+
+               "int @dtmp;                                                             "+
+           "                                                                           "+
+               "switch( result )                                               "+
+               "{                                                                              "+
+               "case 10: @dtmp = tmp + 1;                              "+
+               "case 20: switch ( tmp )                                "+
+           "           {                                                               "+
+               "               case 30: tmp = tmp + 3;                 "+
+               "               case 40: @dtmp = tmp + 10; break;"+
+               "               }                                                               "+
+               "               tmp = $tmp + result;                    "+
+               "               break;                                                  "+
+               "}                                                                              "+
+               "result = tmp;                                                  "+
+               "}                                                                              ";
+                buildAndCheck(extractSourceAndMarkers(testNestedSwitch03));
+       }
+
+       @Test
+       public void nestedSwitchTest_M4()
+       {
+               String testNestedSwitch04 =
+               "void nestedSwitchTesst4()              "+
+               "{                                                                              "+
+               "int result = 100;                                              "+
+               "int @dtmp;                                                             "+
+           "                                                                           "+
+               "switch( result )                                               "+
+               "{                                                                              "+
+               "case 10: @dtmp = tmp + 1;                              "+
+               "case 20: switch ( tmp )                                "+
+           "           {                                                               "+
+               "               case 30: @dtmp = tmp + 3;break; "+
+               "               case 40: @dtmp = tmp + 10; break;"+
+               "               }                                                               "+
+               "               tmp = $tmp + result;                    "+
+               "               break;                                                  "+
+               "}                                                                              "+
+               "result = tmp;                                                  "+
+               "}                                                                              ";
+                buildAndCheck(extractSourceAndMarkers(testNestedSwitch04));
+       }
+
+       @Test
+       public void nestedSwitchTest_M5()
+       {
+               String testNestedSwitch05 =
+               "void nestedSwitchTesst5()              "+
+               "{                                                                              "+
+               "int result = 100;                                              "+
+               "int @dtmp;                                                             "+
+           "                                                                           "+
+               "switch( result )                                               "+
+               "{                                                                              "+
+               "case 10: @dtmp = tmp + 1;break;                "+
+               "case 20: switch ( tmp )                                "+
+           "           {                                                               "+
+               "               case 30: tmp = tmp + 3;break;   "+
+               "               case 40: tmp = tmp + 10; break;"+
+               "               }                                                               "+
+               "               @dtmp = tmp + result;                   "+
+               "               break;                                                  "+
+               "}                                                                              "+
+               "result = $tmp;                                                 "+
+               "}                                                                              ";
+                buildAndCheck(extractSourceAndMarkers(testNestedSwitch05));
+       }
+
+       @Test
+       public void testReturn_M01()
+       {
+               String testReturn01 =
+               "int testReturn01()     "+
+               "{                                      "+
+               "       int $x = 5;     "+
+               "       return @ux;             "+
+               "       x;                              "+
+               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(testReturn01));
+       }
+
+       @Test
+       public void testReturn_M02()
+       {
+               String testReturn02 =
+               "int testReturn02()     "+
+               "{                                      "+
+               "       int @dx = 5;    "+
+               "       return $x;      "+
+               "       x;                              "+
+               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(testReturn02));
+       }
+
+       @Test
+       public void testReturn_M03()
+       {
+               String testReturn03 =
+               "int testReturn03()     "+
+               "{                                      "+
+               "       int x = 5;              "+
+               "       return (x=x+1); "+
+               "       $x;                     "+
+               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(testReturn03));
+       }
+
+       @Test
+       public void testReturn_M04()
+       {
+               String testReturn04 =
+               "int testReturn04()     "+
+               "{                                      "+
+               "       int @dx = 5;    "+
+               "       return (x=$x+1);"+
+               "       x;                              "+
+               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(testReturn04));
+       }
+
+       @Test
+       public void testReturn_M05()
+       {
+               String testReturn05 =
+               "void testReturn05()    "+
+               "{                                              "+
+               "       int $x = 5;             "+
+               "       return;                         "+
+               "       x = x+1;                        "+
+               "}                                              ";
+               buildAndCheck(extractSourceAndMarkers(testReturn05));
+       }
+
+       @Test
+       public void testKnRFunction_M01()
+       {
+               String tsetKnRFunction01 =
+               "void func(x,y,z)          "+
+               "int $x,y;               "+
+               "int z;                    "+
+               "{                         "+
+               " int result;            "+
+               " result = @ux + y + z;  "+
+               "}                         ";
+               buildAndCheck(extractSourceAndMarkers(tsetKnRFunction01));
+       }
+
+       @Test
+       public void testKnRFunction_M02()
+       {
+               String tsetKnRFunction02 =
+               "void func(x,y,z)          "+
+               "int x,$y;               "+
+               "int z;                    "+
+               "{                         "+
+               " int result;            "+
+               " result = x + @uy + z;  "+
+               "}                         ";
+               buildAndCheck(extractSourceAndMarkers(tsetKnRFunction02));
+       }
+
+       @Test
+       public void testKnRFunction_M03()
+       {
+               String tsetKnRFunction03 =
+               "void func(x,y,z)          "+
+               "int x,y;                  "+
+               "int $z;                 "+
+               "{                         "+
+               " int result;            "+
+               " result = x + y + @uz;  "+
+               "}                         ";
+               buildAndCheck(extractSourceAndMarkers(tsetKnRFunction03));
+       }
+
+       @Test
+       public void testKnRFunction_M04()
+       {
+               String tsetKnRFunction04 =
+               "void func(x,y,z)          "+
+               "int @dx,y;                "+
+               "int z;                    "+
+               "{                         "+
+               " int result;            "+
+               " result = $x + y + z; "+
+               "}                         ";
+               buildAndCheck(extractSourceAndMarkers(tsetKnRFunction04));
+       }
+
+       @Test
+       public void testKnRFunction_M05()
+       {
+               String tsetKnRFunction05 =
+               "void func(x,y,z)          "+
+               "int x,@dy;                "+
+               "int z;                    "+
+               "{                         "+
+               " int result;            "+
+               " result = x + $y + z; "+
+               "}                         ";
+               buildAndCheck(extractSourceAndMarkers(tsetKnRFunction05));
+       }
+
+       @Test
+       public void testKnRFunction_M06()
+       {
+               String tsetKnRFunction06 =
+               "void func(x,y,z)          "+
+               "int x,y;                  "+
+               "int @dz;                  "+
+               "{                         "+
+               " int result;            "+
+               " result = x + y + $z; "+
+               "}                         ";
+               buildAndCheck(extractSourceAndMarkers(tsetKnRFunction06));
+       }
+
+       @Test
+       public void testKnRFunction_M07()
+       {
+               String code =
+               "void func($x,y,z)         "+
+               "int x,y;                       "+
+               "int z;                    "+
+               "{                         "+
+               " int result;                   "+
+               " result = @ux + y + z;         "+
+               "}                         ";
+
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testKnRFunction_M08()
+       {
+               String code =
+               "void func(x,y,$z)         "+
+               "int x,y;                       "+
+               "{                         "+
+               " int result;                   "+
+               " result = x + y + z;   "+
+               "}                         ";
+
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testArray01()
+       {
+               String code =
+               "void func()               "+
+               "{                         "+
+               " int result[10];          "+
+               " $result[10] = 0;              "+
+               "}                         ";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testArray02()
+       {
+               String code =
+               "void func()               "+
+               "{                         "+
+               " int $result[10];         "+
+               " result[10] = 0;                       "+
+               "}                         ";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testArray03(){
+               String code =
+               "void main(){           " +
+               "       int a[3];               " +
+               "       int *p = $a;    " +
+               "}                                      ";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testProblem01() {
+               String code =
+               "void func()    " +
+               "{                              " +
+               "       int $a,a;       " +
+               "       a;                      " +
+               "}";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testProblem02() {
+               String code =
+               "void func()    " +
+               "{                              " +
+               "       int a,$a;       " +
+               "       @ua;            " +
+               "}";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testProblem03() {
+               String code =
+               "void func()    " +
+               "{                              " +
+               "       int a,@da;      " +
+               "       $a;                     " +
+               "}                              ";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testProblem04() {
+               String code =
+               "void func(int $a, int a)       " +
+               "{                                                      " +
+               "       @ua;                                    " +
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testProblem05() {
+               String code =
+               "void func(int a, int $a)       " +
+               "{                                                      " +
+               "       a;                                              " +
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testProblem06() {
+               String code =
+               "void func(int @da, int a)      " +
+               "{                                                      " +
+               "       $a;                                             " +
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testProblemKnR01() {
+               String code =
+               "void func($a, b)                       " +
+               "int a;                                         " +
+               "int a;                                         " +
+               "{                                                      " +
+               "       @ua;                                    " +
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       /*
+        * This case is parsed differently from executed in Eclipse.
+        * In Eclipse, two declarations of parameter a have same binding.
+        * But in JUnit, they have difference bindings and the use of a has binding of first declaration.
+        */
+       /*
+       @Test
+       public void testProblemKnR02() {
+               String code =
+               "void func(a, b)                        " +
+               "int $a;                                        " +
+               "int a;                                         " +
+               "{                                                      " +
+               "       a;                                              " +
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+       */
+
+       @Test
+       public void testProblemKnR03() {
+               String code =
+               "void func(a, b)                        " +
+               "int a;                                         " +
+               "int $a;                                        " +
+               "{                                                      " +
+               "       @ua;                                    " +
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testDeclaration01() {
+               String code =
+               "void func()                            " +
+               "{                                                      " +
+               "       int @da;                                " +
+               "       $a;                                             " +
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testDeclaration02() {
+               String code =
+               "void func()                            " +
+               "{                                                      " +
+               "       int $a;                                 " +
+               "       @ua;                                    " +
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testDeclaration03() {
+               String code =
+               "void func()                            " +
+               "{                                                      " +
+               "       auto $a;                                        " +
+               "       @ua;                                    " +
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testStruct01() {
+               String code =
+               "struct s { int m1; };          " +
+               "void func()                            " +
+               "{                                                      " +
+               "       struct s $a;                    " +
+               "       a;                                              " +
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       @Test
+       public void testStruct02() {
+               String code =
+               "struct s { int m1; };          " +
+               "void func()                            " +
+               "{                                                      " +
+               "       struct s a;                             " +
+               "       $a;                                             " +
+               "}                                                      ";
+               buildAndCheck(extractSourceAndMarkers(code));
+       }
+
+       private String extractSourceAndMarkers(String str) {
+               StringBuffer resultStr = new StringBuffer();
+               duChainOffsets = new ArrayList<Integer>();
+               udChainOffsets = new ArrayList<Integer>();
+
+               selOffset = 0;
+               for (int i = 0; i < str.length(); i++) {
+                       switch (str.charAt(i)) {
+                               case '@': i++;
+                                       if (i < str.length()) {
+                                               switch (str.charAt(i)) {
+                                                       case 'm':
+                                                               duChainOffsets.add(resultStr.length());
+                                                               udChainOffsets.add(resultStr.length());
+                                                               break;
+                                                       case 'd':
+                                                               udChainOffsets.add(resultStr.length());
+                                                               break;
+                                                       case 'u':
+                                                               duChainOffsets.add(resultStr.length());
+                                                               break;
+                                                       default:
+                                                               resultStr.append(str.charAt(i));
+                                               }
+                                       }
+                                       break;
+                               case '$':
+                                       selOffset = resultStr.length();
+                                       break;
+                               default:
+                                       resultStr.append(str.charAt(i));
+                       }
+               }
+
+               return resultStr.toString();
+       }
+
+       private void buildAndCheck(String code) {
+               parse(code);
+               buildMarksArray();
+               if (checkInteresting()) {
+                       buildCFG();
+                       buildDUChain();
+                       checkDUChain();
+               } else {
+                       // if the selected name is unanalyzable, there should be no du/ud chain.
+                       assertEquals(udChainMarks.size(), 0);
+                       assertEquals(duChainMarks.size(), 0);
+               }
+       }
+
+       private IASTTranslationUnit parse(String code) {
+               FileContent codeReader = FileContent.create("code.c", code.toCharArray());
+
+               IScannerInfo scannerInfo = new ScannerInfo();
+               IScannerExtensionConfiguration scannerExtensionConfiguration =
+                               GCCScannerExtensionConfiguration.getInstance();
+        IScanner scanner = new CPreprocessor(codeReader, scannerInfo, ParserLanguage.C,
+                       NULL_LOG, scannerExtensionConfiguration,
+                       IncludeFileContentProvider.getSavedFilesProvider());
+
+               ICParserExtensionConfiguration parserExtensionConfig =
+                               new GCCParserExtensionConfiguration();
+               ISourceCodeParser parser = new GNUCSourceParser(scanner,
+                               ParserMode.COMPLETE_PARSE,NULL_LOG, parserExtensionConfig);
+
+               IASTTranslationUnit tu = parser.parse();
+               if (parser.encounteredError()) {
+                       fail("PARSE FAILURE");
+               }
+
+               IASTProblem[] problems = CVisitor.getProblems(tu);
+               assertEquals(problems.length, 0);
+
+               this.ast = tu;
+               return tu;
+       }
+
+       /*
+        * build IASTName arrays from offset arrays
+        * */
+       private void buildMarksArray() {
+               duChainMarks = new ArrayList<IASTName>();
+               udChainMarks = new ArrayList<IASTName>();
+               for (int offset: duChainOffsets) {
+                       duChainMarks.add(pickNameFromOffset(offset));
+               }
+               for (int offset: udChainOffsets) {
+                       udChainMarks.add(pickNameFromOffset(offset));
+               }
+       }
+
+       private boolean checkInteresting() {
+               IASTName selName = pickNameFromOffset(selOffset);
+               return AssignmentTracingUI.isInteresting(selName);
+       }
+
+       /*
+        * build CFG
+        */
+       private void buildCFG() {
+               IASTName selName = pickNameFromOffset(selOffset);
+               cfgBuilder = new CFGBuilder(new NullProgressMonitor());
+               selNodes = cfgBuilder.buildCFG(getEnclosingFunc(selName), selName);
+       }
+
+       private void checkDUChain() {
+               List<IASTName> duChain = chainBuilder.getDUChain();
+               List<IASTName> udChain = chainBuilder.getUDChain();
+
+               //assertEquals(duChain.size(), duChainMarks.size());
+               //assertEquals(udChain.size(), udChainMarks.size());
+
+               for (IASTName name: duChain) {
+                       assertTrue(duChainMarks.contains(name));
+               }
+               for (IASTName name: duChainMarks) {
+                       assertTrue(duChain.contains(name));
+               }
+               for (IASTName name: udChain) {
+                       assertTrue(udChainMarks.contains(name));
+               }
+               for (IASTName name: udChainMarks) {
+                       assertTrue(udChain.contains(name));
+               }
+       }
+
+       private void buildDUChain() {
+               chainBuilder = new ChainBuilder();
+               chainBuilder.buildChain(selNodes, cfgBuilder.getNodeCount());
+       }
+
+       private IASTName pickNameFromOffset(int offset) {
+               IASTNodeSelector selector= ast.getNodeSelector(null);
+               IASTName name = selector.findEnclosingName(offset, 1);
+               if (name == null) {
+                       name = selector.findEnclosingImplicitName(offset, 1);
+               }
+               assertNotNull(name);
+               return name;
+       }
+
+       private IASTFunctionDefinition getEnclosingFunc(IASTName name) {
+               IASTNode n = name;
+               // Find enclosing function definition
+               while (!(n instanceof IASTFunctionDefinition)) {
+                       if (n == null) {
+                               return null;
+                       }
+                       n = n.getParent();
+               }
+               return (IASTFunctionDefinition)n;
+       }
+}
diff --git a/org.tizen.nativeapp.assignmenttracing/.classpath b/org.tizen.nativeapp.assignmenttracing/.classpath
new file mode 100644 (file)
index 0000000..64c5e31
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.tizen.nativeapp.assignmenttracing/.project b/org.tizen.nativeapp.assignmenttracing/.project
new file mode 100644 (file)
index 0000000..58ceaf5
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.tizen.nativeapp.assignmenttracing</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.tizen.nativeapp.assignmenttracing/.settings/org.eclipse.jdt.core.prefs b/org.tizen.nativeapp.assignmenttracing/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..5ad7c4f
--- /dev/null
@@ -0,0 +1,12 @@
+#Thu Jun 09 11:16:30 KST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/org.tizen.nativeapp.assignmenttracing/META-INF/MANIFEST.MF b/org.tizen.nativeapp.assignmenttracing/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..84adaae
--- /dev/null
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Fragment-Host: org.eclipse.cdt.ui;bundle-version="5.2.2"
+Bundle-Name: Tizen Assignment Tracing
+Bundle-SymbolicName: org.tizen.nativeapp.assignmenttracing;singleton:=true
+Bundle-Version: 1.0.2.v20120224
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: org.eclipse.cdt.core,
+ org.eclipse.cdt.ui,
+ org.eclipse.ui
+Bundle-Vendor: Samsung
diff --git a/org.tizen.nativeapp.assignmenttracing/build.properties b/org.tizen.nativeapp.assignmenttracing/build.properties
new file mode 100644 (file)
index 0000000..187f664
--- /dev/null
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               fragment.xml,\
+               icons/
diff --git a/org.tizen.nativeapp.assignmenttracing/build.xml b/org.tizen.nativeapp.assignmenttracing/build.xml
new file mode 100644 (file)
index 0000000..7fdb2cd
--- /dev/null
@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="org.tizen.nativeapp.assignmenttracing" default="build.jars" basedir=".">
+
+       <property name="p2.build.repo" value="file:${buildDirectory}/buildRepo"/>
+       <property name="basews" value="${ws}"/>
+       <property name="baseos" value="${os}"/>
+       <property name="basearch" value="${arch}"/>
+       <property name="basenl" value="${nl}"/>
+       <property name="bundleId" value="org.tizen.nativeapp.assignmenttracing"/>
+       <property name="bundleVersion" value="1.0.0.v20111219"/>
+       <property name="p2.publishonerror" value="false"/>
+
+       <!-- Compiler settings. -->
+       <property name="javacFailOnError" value="false"/>
+       <property name="javacDebugInfo" value="on"/>
+       <property name="javacVerbose" value="false"/>
+       <property name="logExtension" value=".log"/>
+       <property name="compilerArg" value=""/>
+       <property name="compilation.prereq.log" value="${buildDirectory}/prereqErrors.log"/>
+       <property name="javacSource" value="1.5"/>
+       <property name="javacTarget" value="1.5"/>
+       <condition property="dir_bootclasspath" value="${java.home}/../Classes">
+               <os family="mac"/>
+       </condition>
+       <property name="dir_bootclasspath" value="${java.home}/lib"/>
+       <path id="path_bootclasspath">
+               <fileset dir="${dir_bootclasspath}">
+                       <include name="*.jar"/>
+               </fileset>
+       </path>
+       <property name="bootclasspath" refid="path_bootclasspath"/>
+       <condition property="bundleBootClasspath" value="${J2SE-1.5}"   >
+               <isset property="J2SE-1.5"/>
+       </condition>
+       <condition property="bundleJavacSource" value="1.5"     >
+               <isset property="J2SE-1.5"/>
+       </condition>
+       <condition property="bundleJavacTarget" value="1.5"     >
+               <isset property="J2SE-1.5"/>
+       </condition>
+       <property name="bundleJavacSource" value="${javacSource}"/>
+       <property name="bundleJavacTarget" value="${javacTarget}"/>
+       <property name="bundleBootClasspath" value="${bootclasspath}"/>
+
+       <target name="init" depends="properties">
+               <condition property="pluginTemp" value="${buildTempFolder}/plugins"             >
+                       <isset property="buildTempFolder"/>
+               </condition>
+               <property name="pluginTemp" value="${basedir}"/>
+               <condition property="build.result.folder" value="${pluginTemp}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219"           >
+                       <isset property="buildTempFolder"/>
+               </condition>
+               <property name="build.result.folder" value="${basedir}"/>
+               <property name="temp.folder" value="${basedir}/temp.folder"/>
+               <property name="plugin.destination" value="${basedir}"/>
+               <condition property="p2.publish.parts" value="true"             >
+                       <istrue value="${p2.gathering}"/>
+               </condition>
+               <property name="compilation.problem.marker" value="${build.result.folder}/compilation.problem"/>
+               <condition property="compilation.problem.marker.exists" value="true"            >
+                       <and>
+                       <available file="${compilation.problem.marker}"/>
+                       <isfalse value="${p2.publishonerror}"/>
+                       </and>
+               </condition>
+       </target>
+
+       <target name="properties" if="eclipse.running">
+               <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
+
+       </target>
+
+       <target name="build.update.jar" depends="init" description="Build the plug-in: org.tizen.nativeapp.assignmenttracing for an update site.">
+               <delete dir="${temp.folder}"/>
+               <mkdir dir="${temp.folder}"/>
+               <antcall target="build.jars"/>
+               <antcall target="gather.bin.parts">
+                       <param name="destination.temp.folder" value="${temp.folder}/"/>
+               </antcall>
+               <jar destfile="${plugin.destination}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219.jar" basedir="${temp.folder}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219" filesetmanifest="merge"/>
+               <delete dir="${temp.folder}"/>
+       </target>
+
+       <target name="@dot" depends="init" unless="@dot" description="Create jar: org.tizen.nativeapp.assignmenttracing @dot.">
+               <delete dir="${build.result.folder}/@dot"/>
+               <mkdir dir="${build.result.folder}/@dot"/>
+               <path id="@dot.classpath">
+                       <fileset dir="${ECLIPSE_HOME}/plugins/">
+                               <include name="*.jar"/>
+                       </fileset>
+               </path>
+               <!-- compile the source code -->
+               <javac destdir="${build.result.folder}/@dot" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bundleBootClasspath}" source="${bundleJavacSource}" target="${bundleJavacTarget}"            >
+                       <compilerarg line="${compilerArg}" compiler="${build.compiler}"/>
+                       <classpath refid="@dot.classpath" />
+                       <src path="src/"                        />
+                       <compilerarg value="@${basedir}/javaCompiler...args" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"                 />
+                       <compilerarg line="-log &apos;${build.result.folder}/@dot${logExtension}&apos;" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"                      />
+               </javac>
+               <antcall target="checkCompilationResults"/>
+               <!-- Copy necessary resources -->
+               <copy todir="${build.result.folder}/@dot" failonerror="true" overwrite="false">
+                       <fileset dir="src/">
+                               <exclude name="**/*.java"/>
+                               <exclude name="**/package.htm*"/>
+                       </fileset>
+               </copy>
+       </target>
+
+       <target name="src.zip" depends="init" unless="src.zip">
+               <mkdir dir="${build.result.folder}"/>
+               <antcall target="zip.src.zip"/>
+       </target>
+       <target name="zip.src.zip">
+               <zip destfile="${build.result.folder}/src.zip" filesonly="false" whenempty="skip" update="false">
+                       <fileset dir="src/">
+                               <include name="**/*.java"/>
+                       </fileset>
+               </zip>
+       </target>
+       <target name="copy.src.zip">
+               <copy todir="${source.destination.folder}/" failonerror="true" overwrite="true">
+                       <fileset dir="src/">
+                               <include name="**/*.java"/>
+                       </fileset>
+               </copy>
+       </target>
+
+       <target name="build.jars" depends="init" description="Compile classes and build nested jars for the plug-in: org.tizen.nativeapp.assignmenttracing.">
+               <delete file="${compilation.problem.marker}" quiet="true"/>
+               <available property="@dot" file="${build.result.folder}/@dot"/>
+               <antcall target="@dot"/>
+       </target>
+
+       <target name="checkCompilationResults" if="compilation.error.occured">
+               <echo file="${compilation.problem.marker}" message="org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219${line.separator}compilation.error.occured=${compilation.error.occured}"/>
+               <eclipse.logCompileError bundle="org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219" log="${compilation.prereq.log}">
+               </eclipse.logCompileError>
+       </target>
+
+       <target name="build.sources" depends="init">
+               <available property="src.zip" file="${build.result.folder}/src.zip"/>
+               <antcall target="src.zip"/>
+       </target>
+
+       <target name="publish.bin.parts" depends="init" if="p2.publish.parts" unless="compilation.problem.marker.exists">
+               <mkdir dir="${build.result.folder}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219"/>
+               <copy todir="${build.result.folder}" failonerror="true" overwrite="true">
+                       <fileset dir="${basedir}">
+                               <include name="META-INF/MANIFEST.MF"/>
+                               <include name="plugin.xml"/>
+                               <include name="fragment.xml"/>
+                       </fileset>
+               </copy>
+               <antcall target="apitools.generation">
+                       <param name="target.folder" value="${build.result.folder}"/>
+                       <param name="extraManifests" value="${basedir}/${ECLIPSE_HOME}/plugins/org.eclipse.cdt.ui_5.2.2.201102110609.jar"/>
+                       <param name="projectLocation" value="${basedir}"/>
+                       <param name="binary.folders" value="${build.result.folder}/@dot"/>
+                       <param name="projectName" value="${bundleId}_${bundleVersion}"/>
+               </antcall>
+               <eclipse.gatherBundle 
+                  metadataRepository="${p2.build.repo}"
+                  artifactRepository="${p2.build.repo}"
+                  buildResultFolder="${build.result.folder}"
+                  baseDirectory="${basedir}"
+               />
+       </target>
+
+       <target name="gather.bin.parts" depends="init" if="destination.temp.folder">
+               <mkdir dir="${destination.temp.folder}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219"/>
+               <copy todir="${destination.temp.folder}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219" failonerror="true" overwrite="false">
+                       <fileset dir="${build.result.folder}/@dot">
+                               <include name="**"/>
+                       </fileset>
+               </copy>
+               <copy todir="${destination.temp.folder}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219" failonerror="true" overwrite="true">
+                       <fileset dir="${basedir}">
+                               <include name="META-INF/"/>
+                               <include name="fragment.xml"/>
+                               <include name="icons/"/>
+                       </fileset>
+               </copy>
+               <antcall target="apitools.generation">
+                       <param name="target.folder" value="${destination.temp.folder}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219"/>
+                       <param name="extraManifests" value="${basedir}/${ECLIPSE_HOME}/plugins/org.eclipse.cdt.ui_5.2.2.201102110609.jar"/>
+                       <param name="projectLocation" value="${basedir}"/>
+                       <param name="binary.folders" value="${build.result.folder}/@dot"/>
+                       <param name="projectName" value="${bundleId}_${bundleVersion}"/>
+               </antcall>
+       </target>
+
+       <target name="build.zips" depends="init">
+       </target>
+
+       <target name="gather.sources" depends="init" if="destination.temp.folder">
+               <mkdir dir="${destination.temp.folder}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219"/>
+               <copy file="${build.result.folder}/src.zip" todir="${destination.temp.folder}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219" failonerror="false" overwrite="false"/>
+               <antcall target="copy.src.includes">
+                       <param name="source.destination.folder" value="${destination.temp.folder}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219"/>
+               </antcall>
+       </target>
+
+       <target name="gather.individual.sources" depends="init">
+               <antcall target="copy.src.zip">
+                       <param name="source.destination.folder" value="${destination.temp.folder}"/>
+               </antcall>
+               <antcall target="copy.src.includes">
+                       <param name="source.destination.folder" value="${destination.temp.folder}"/>
+               </antcall>
+       </target>
+
+       <target name="copy.src.includes" depends="init">
+       </target>
+
+       <target name="gather.logs" depends="init" if="destination.temp.folder">
+               <mkdir dir="${destination.temp.folder}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219"/>
+               <copy todir="${destination.temp.folder}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219" failonerror="false" overwrite="false">
+                       <fileset dir="${build.result.folder}">
+                               <include name="@dot${logExtension}"/>
+                       </fileset>
+               </copy>
+       </target>
+
+       <target name="clean" depends="init" description="Clean the plug-in: org.tizen.nativeapp.assignmenttracing of all the zips, jars and logs created.">
+               <delete dir="${build.result.folder}/@dot"/>
+               <delete file="${build.result.folder}/src.zip"/>
+               <delete file="${plugin.destination}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219.jar"/>
+               <delete file="${plugin.destination}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219.zip"/>
+               <delete dir="${temp.folder}"/>
+               <delete file="${compilation.problem.marker}" quiet="true"/>
+       </target>
+
+       <target name="refresh" depends="init" if="eclipse.running" description="Refresh this folder.">
+               <eclipse.convertPath fileSystemPath="/home/cho/tmp/duchain/org.tizen.nativeapp.assignmenttracing" property="resourcePath"/>
+               <eclipse.refreshLocal resource="${resourcePath}" depth="infinite"/>
+       </target>
+
+       <target name="zip.plugin" depends="init" description="Create a zip containing all the elements for the plug-in: org.tizen.nativeapp.assignmenttracing.">
+               <delete dir="${temp.folder}"/>
+               <mkdir dir="${temp.folder}"/>
+               <antcall target="build.jars"/>
+               <antcall target="build.sources"/>
+               <antcall target="gather.bin.parts">
+                       <param name="destination.temp.folder" value="${temp.folder}/"/>
+               </antcall>
+               <antcall target="gather.sources">
+                       <param name="destination.temp.folder" value="${temp.folder}/"/>
+               </antcall>
+               <delete>
+                       <fileset dir="${temp.folder}">
+                               <include name="**/*.bin${logExtension}"/>
+                       </fileset>
+               </delete>
+               <zip destfile="${plugin.destination}/org.tizen.nativeapp.assignmenttracing_1.0.0.v20111219.zip" basedir="${temp.folder}" filesonly="true" whenempty="skip" update="false"/>
+               <delete dir="${temp.folder}"/>
+       </target>
+
+       <target name="apitools.generation" if="generateAPIDescription">
+               <apitooling.apigeneration  projectName="${projectName}" project="${projectLocation}" binary="${binary.folders}" target="${target.folder}" extramanifests="${extraManifests}"            />
+       </target>
+
+</project>
diff --git a/org.tizen.nativeapp.assignmenttracing/contexts.xml b/org.tizen.nativeapp.assignmenttracing/contexts.xml
new file mode 100644 (file)
index 0000000..02e26e4
--- /dev/null
@@ -0,0 +1,12 @@
+<contexts>
+       <context id="viewer" title="Sample View">
+               <description>This is the context help for the sample view with a table viewer. It was generated by a PDE template.</description>
+               <topic href="/PLUGINS_ROOT/org.eclipse.platform.doc.isv/guide/ua_help_context.htm" label="Context-sensitive help">
+                       <enablement>
+                               <with variable="platform">
+                       <test property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.platform.doc.isv"/>
+                       </with>
+                       </enablement>
+               </topic>
+       </context>
+</contexts>
diff --git a/org.tizen.nativeapp.assignmenttracing/fragment.xml b/org.tizen.nativeapp.assignmenttracing/fragment.xml
new file mode 100644 (file)
index 0000000..b41938f
--- /dev/null
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<fragment>
+   <extension
+         point="org.eclipse.ui.editors.annotationTypes">
+      <type
+            name="org.tizen.nativeapp.assignmenttracing.def">
+      </type>
+      <type
+            name="org.tizen.nativeapp.assignmenttracing.use">
+      </type>
+      <type
+            name="org.tizen.nativeapp.assignmenttracing.sel">
+      </type>
+   </extension>
+   <extension
+         point="org.eclipse.ui.editors.markerAnnotationSpecification">
+      <specification
+            annotationType="org.tizen.nativeapp.assignmenttracing.def"
+            colorPreferenceKey="du.def.color"
+            colorPreferenceValue="220,30,30"
+            contributesToHeader="true"
+            highlightPreferenceKey="du.def.highlight"
+            highlightPreferenceValue="false"
+            includeOnPreferencePage="true"
+            label="Assignment Tracing - Assignment"
+            overviewRulerPreferenceKey="du.def.rulers.overview"
+            overviewRulerPreferenceValue="true"
+            presentationLayer="6"
+            textPreferenceKey="du.def.text"
+            textPreferenceValue="true"
+            textStylePreferenceKey="du.def.textstyle"
+            textStylePreferenceValue="BOX"
+            verticalRulerPreferenceKey="du.def.rulers.vertical"
+            verticalRulerPreferenceValue="false">
+      </specification>
+      <specification
+            annotationType="org.tizen.nativeapp.assignmenttracing.use"
+            colorPreferenceKey="du.use.color"
+            colorPreferenceValue="0,0,250"
+            contributesToHeader="true"
+            highlightPreferenceKey="du.use.highlight"
+            highlightPreferenceValue="false"
+            includeOnPreferencePage="true"
+            label="Assignment Tracing - Use"
+            overviewRulerPreferenceKey="du.use.rulers.overview"
+            overviewRulerPreferenceValue="true"
+            presentationLayer="5"
+            textPreferenceKey="du.use.text"
+            textPreferenceValue="true"
+            textStylePreferenceKey="du.use.textstyle"
+            textStylePreferenceValue="BOX"
+            verticalRulerPreferenceKey="du.use.rulers.vertical"
+            verticalRulerPreferenceValue="false">
+      </specification>
+      <specification
+            annotationType="org.tizen.nativeapp.assignmenttracing.sel"
+            colorPreferenceKey="du.sel.color"
+            colorPreferenceValue="150,150,250"
+            contributesToHeader="true"
+            highlightPreferenceKey="du.sel.highlight"
+            highlightPreferenceValue="true"
+            includeOnPreferencePage="true"
+            label="Assignment Tracing - Selection"
+            overviewRulerPreferenceKey="du.sel.rulers.overview"
+            overviewRulerPreferenceValue="true"
+            presentationLayer="7"
+            textPreferenceKey="du.sel.text"
+            textPreferenceValue="true"
+            textStylePreferenceKey="du.sel.textstyle"
+            textStylePreferenceValue="BOX"
+            verticalRulerPreferenceKey="du.sel.rulers.vertical"
+            verticalRulerPreferenceValue="false">
+      </specification>
+   </extension>
+
+   <extension
+         point="org.eclipse.ui.editorActions">
+      <editorContribution
+            id="org.tizen.nativeapp.assignmenttracing.duchain-action"
+            targetID="org.tizen.nativeapp.contentassist.SLPCEditor">
+         <action
+               class="org.tizen.nativeapp.assignmenttracing.ui.TracingActionDelegate"
+               icon="icons/duchain.gif"
+               id="org.tizen.nativeapp.assignmenttracing.mark-duchain"
+               label="Assignment Tracing"
+               state="true"
+               style="toggle"
+               tooltip="Toggle Assignment Tracing">
+         </action>
+      </editorContribution>
+   </extension>
+   
+      <extension
+         point="org.eclipse.ui.editorActions">
+      <editorContribution
+            id="org.tizen.nativeapp.assignmenttracing.duchain-action-c"
+            targetID="org.eclipse.cdt.ui.editor.CEditor">
+         <action
+               class="org.tizen.nativeapp.assignmenttracing.ui.TracingActionDelegate"
+               icon="icons/duchain.gif"
+               id="org.tizen.nativeapp.assignmenttracing.mark-duchain"
+               label="Assignment Tracing"
+               state="true"
+               style="toggle"
+               tooltip="Toggle Assignment Tracing">
+         </action>
+      </editorContribution>
+   </extension>
+   
+   <!-- Accelerator key -->
+ <extension point="org.eclipse.ui.commands">
+ <category
+           id="org.tizen.nativeapp.assignmenttracing.commands"
+           name="Assignment Tracing"
+           description="Assignment Tracing Commands"/>
+   <command name="Assignment Tracing - Previous"
+        description="Move cursor to the previous Assignment Tracing Result"
+        categoryId="org.tizen.nativeapp.assignmenttracing.commands"
+        defaultHandler="org.tizen.nativeapp.assignmenttracing.ui.TracingCommandHandler"
+        id="org.tizen.nativeapp.assignmenttracing.moveprevious">
+   </command>
+   <command name="Assignment Tracing - Next"
+        description="Move cursor to the next Assignment Tracing Result"
+        categoryId="org.tizen.nativeapp.assignmenttracing.commands"
+        defaultHandler="org.tizen.nativeapp.assignmenttracing.ui.TracingCommandHandler"
+        id="org.tizen.nativeapp.assignmenttracing.movenext">
+   </command>
+</extension>
+
+<extension point="org.eclipse.ui.bindings">
+    <key sequence="Ctrl+["
+        commandId="org.tizen.nativeapp.assignmenttracing.moveprevious"
+        schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+        contextId="org.eclipse.cdt.ui.cEditorScope"/>
+    <key sequence="Ctrl+]"
+        commandId="org.tizen.nativeapp.assignmenttracing.movenext"
+        schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+        contextId="org.eclipse.cdt.ui.cEditorScope"/>
+</extension>
+      
+</fragment>
diff --git a/org.tizen.nativeapp.assignmenttracing/icons/duchain.gif b/org.tizen.nativeapp.assignmenttracing/icons/duchain.gif
new file mode 100644 (file)
index 0000000..b441cfd
Binary files /dev/null and b/org.tizen.nativeapp.assignmenttracing/icons/duchain.gif differ
diff --git a/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/CFGBuilder.java b/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/CFGBuilder.java
new file mode 100644 (file)
index 0000000..f91169e
--- /dev/null
@@ -0,0 +1,854 @@
+/*
+ * Program Understanding / Assignment Tracing
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jaeheung Kim <jaeheung.kim@samsung.com>
+ * Sujin Kim <sujin921.kim@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.nativeapp.assignmenttracing.core;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
+import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
+import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
+import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
+import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
+import org.eclipse.cdt.core.dom.ast.IASTCaseStatement;
+import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
+import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
+import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
+import org.eclipse.cdt.core.dom.ast.IASTContinueStatement;
+import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
+import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
+import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
+import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement;
+import org.eclipse.cdt.core.dom.ast.IASTDoStatement;
+import org.eclipse.cdt.core.dom.ast.IASTEqualsInitializer;
+import org.eclipse.cdt.core.dom.ast.IASTExpression;
+import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
+import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
+import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
+import org.eclipse.cdt.core.dom.ast.IASTForStatement;
+import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
+import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
+import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
+import org.eclipse.cdt.core.dom.ast.IASTGotoStatement;
+import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
+import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
+import org.eclipse.cdt.core.dom.ast.IASTInitializer;
+import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
+import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
+import org.eclipse.cdt.core.dom.ast.IASTLabelStatement;
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.IASTNode;
+import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
+import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
+import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
+import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
+import org.eclipse.cdt.core.dom.ast.IASTStatement;
+import org.eclipse.cdt.core.dom.ast.IASTSwitchStatement;
+import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
+import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
+import org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator;
+import org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer;
+import org.eclipse.cdt.core.dom.ast.c.ICASTDesignator;
+import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
+import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
+import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
+import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
+import org.eclipse.cdt.core.dom.ast.gnu.c.IGCCASTArrayRangeDesignator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.tizen.nativeapp.assignmenttracing.core.exceptions.TracingCancelException;
+import org.tizen.nativeapp.assignmenttracing.core.exceptions.TracingUnsupportedException;
+
+
+/**
+ * This class builds CFG that is specifically related to a selected local variable.
+ * <p>
+ * Entry method is buildCFG and others are composed of statement and expression part. <br>
+ * Whenever it finds def/use of selected variable, it creates DefNode/UseNode and
+ * connects nodes with edges.
+ *
+ * @author Jaeheung Kim <jaeheung.kim@samsung.com>
+ * @author Sujin Kim <sujin921.kim@samsung.com>
+ */
+public class CFGBuilder {
+
+       private static final int DEF = 0;
+       private static final int USE = 1;
+       private static final int SKIP = 2;
+       private static final boolean LHS = true;
+       private static final boolean RHS = false;
+
+       private List<CFGNode> nameMatchedNode;
+       private HashMap<String, CFGNode> labels;
+       private HashMap<CFGNode, CFGNode> defaultTable;
+
+       // backup ASTName for other method
+       private IASTName selectedName;
+
+       private LinkedList<CFGNode> continueStack;
+       private LinkedList<CFGNode> breakStack;
+       private LinkedList<CFGNode> caseStack;
+
+       // total created node count
+       private int nodeCount;
+
+       private IProgressMonitor cancelMonitor;
+
+       /**
+        * Initialize all member fields
+        * @param monitor
+        */
+       public CFGBuilder(IProgressMonitor monitor) {
+               nameMatchedNode = new ArrayList<CFGNode>();
+               labels = new HashMap<String, CFGNode>();
+               defaultTable = new HashMap<CFGNode, CFGNode>();
+
+               continueStack = new LinkedList<CFGNode>();
+               breakStack = new LinkedList<CFGNode>();
+               caseStack = new LinkedList<CFGNode>();
+
+               nodeCount = 0;
+
+               this.cancelMonitor = monitor;
+       }
+
+       /**
+        * Starts CFG build.
+        *
+        * @param func IASTFunctionDefinition enclosing a selected variable
+        * @param selName selected variable name
+        * @return list of CFGNode matched to the selected variable
+        * @exception TracingCancelException if canceled, thrown with "canceled" message
+        * @exception TracingUnsupportedException if unsupported features are found
+        */
+       public List<CFGNode> buildCFG(IASTFunctionDefinition func, IASTName selName) {
+               CFGNode start = null;
+               selectedName = selName;
+
+               // identify nested function.
+               if (isNestedFunction(func)) {
+                       throw new TracingUnsupportedException();
+               }
+
+               IASTFunctionDeclarator funDeclarator = func.getDeclarator();
+               if (funDeclarator instanceof IASTStandardFunctionDeclarator) {
+                       IASTStandardFunctionDeclarator sfd = (IASTStandardFunctionDeclarator) funDeclarator;
+                       IASTParameterDeclaration fp[] = sfd.getParameters();
+                       for (IASTParameterDeclaration pd : fp) {
+                               start = createDeclarator(start, pd.getDeclarator());
+                       }
+               } else if (funDeclarator instanceof ICASTKnRFunctionDeclarator) {
+                       if (selName.getParent() instanceof ICASTKnRFunctionDeclarator) {
+                               // Formal parameter(parameter in parentheses) is selected.
+                               // In this case, ignore parameter type declarations.
+                               start = createNode(selName, DEF);
+                       } else {
+                               // Other than the formal parameters is selected including
+                               // parameter type declarations
+                               ICASTKnRFunctionDeclarator krfd = (ICASTKnRFunctionDeclarator) funDeclarator;
+                               IASTDeclaration[] dc = krfd.getParameterDeclarations();
+                               for (IASTDeclaration declaration : dc) {
+                                       start = createDeclaration(start, declaration);
+                               }
+                       }
+               }
+
+               if (start == null) {
+                       // if function parameters are not existed, or there is not string
+                       // matched variable.
+                       start = createNode(null, SKIP);
+               }
+
+               createStatement(start, func.getBody());
+
+               return nameMatchedNode;
+       }
+
+       private CFGNode createStatement(CFGNode prev, IASTStatement stmt) {
+               // check job cancellation before processing each statement
+               if (cancelMonitor.isCanceled()) {
+                       throw new TracingCancelException();
+               }
+
+               if (stmt instanceof IASTCompoundStatement) {
+                       IASTCompoundStatement compStmt = (IASTCompoundStatement) stmt;
+                       IASTStatement[] children = compStmt.getStatements();
+                       for (int idx = 0; idx < children.length; idx++) {
+                               IASTStatement node = children[idx];
+                               prev = createStatement(prev, node);
+                       }
+                       return prev;
+               } else if (stmt instanceof IASTExpressionStatement) {
+                       return createExpr(prev, ((IASTExpressionStatement) stmt).getExpression(), RHS);
+               } else if (stmt instanceof IASTDeclarationStatement) {
+                       return createDeclarationStatement(prev, (IASTDeclarationStatement) stmt);
+               } else if (stmt instanceof IASTIfStatement) {
+                       return createIfStatement(prev, (IASTIfStatement) stmt);
+               } else if (stmt instanceof IASTForStatement) {
+                       return createForStatement(prev, (IASTForStatement) stmt);
+               } else if (stmt instanceof IASTWhileStatement) {
+                       return createWhileStatement(prev, (IASTWhileStatement) stmt);
+               } else if (stmt instanceof IASTDoStatement) {
+                       return createDoWhileStatement(prev, (IASTDoStatement) stmt);
+               } else if (stmt instanceof IASTSwitchStatement) {
+                       return createSwitchStatement(prev, (IASTSwitchStatement) stmt);
+               } else if (stmt instanceof IASTLabelStatement) {
+                       return createLabelStatement(prev, (IASTLabelStatement) stmt);
+               } else if (stmt instanceof IASTGotoStatement) {
+                       return createGotoStatement(prev, (IASTGotoStatement) stmt);
+               } else if (stmt instanceof IASTReturnStatement) {
+                       return createReturnStatement(prev, (IASTReturnStatement) stmt);
+               } else if (stmt instanceof IASTCaseStatement) {
+                       return createCaseStatement(prev);
+               } else if (stmt instanceof IASTDefaultStatement) {
+                       return createDefaultStatement(prev);
+               } else if (stmt instanceof IASTBreakStatement) {
+                       connectNodes(prev, breakStack.peek());
+                       return null;
+               } else if (stmt instanceof IASTContinueStatement) {
+                       connectNodes(prev, continueStack.peek());
+                       return null;
+               } else {
+                       return prev;
+               }
+       }
+
+       private CFGNode createDeclarationStatement(CFGNode prev, IASTDeclarationStatement stmt) {
+               IASTDeclaration decl = stmt.getDeclaration();
+
+               // identify nested function.
+               if (decl instanceof IASTFunctionDefinition) {
+                       throw new TracingUnsupportedException();
+               }
+
+               prev = createDeclaration(prev, decl);
+               return prev;
+       }
+
+       private CFGNode createDeclaration(CFGNode prev, IASTDeclaration decl) {
+               // ignore problem declaration
+               if (decl instanceof IASTSimpleDeclaration) {
+                       IASTSimpleDeclaration simpleDecl = (IASTSimpleDeclaration) decl;
+                       IASTDeclarator[] declarators = simpleDecl.getDeclarators();
+
+                       for (IASTDeclarator declarator : declarators) {
+                               prev = createDeclarator(prev, declarator);
+                       }
+               }
+               return prev;
+       }
+
+       private CFGNode createDeclarator(CFGNode prev, IASTDeclarator declarator) {
+               IASTInitializer init = declarator.getInitializer();
+
+               if (init != null) {
+                       prev = createInitializer(prev, init, RHS);
+               }
+
+               if (declarator instanceof IASTArrayDeclarator) {
+                       IASTArrayDeclarator ad = (IASTArrayDeclarator) declarator;
+                       IASTArrayModifier[] am = ad.getArrayModifiers();
+
+                       for (int idx = am.length - 1; idx >= 0; idx--) {
+                               // process each subscript from right to left
+                               IASTExpression expr = am[idx].getConstantExpression();
+                               if (expr != null) {
+                                       prev = createExpr(prev, expr, RHS);
+                               }
+                       }
+               }
+
+               if (declarator.getNestedDeclarator() == null) {
+                       IASTName name = declarator.getName();
+                       if (isSelectedBinding(name)) {
+                               // create node
+                               CFGNode node = createNode(name, DEF);
+                               connectNodes(prev, node);
+                               prev = node;
+                       }
+               } else {
+                       prev = createDeclarator(prev, declarator.getNestedDeclarator());
+               }
+
+               return prev;
+       }
+
+       private CFGNode createIfStatement(CFGNode prev, IASTIfStatement stmt) {
+               prev = createExpr(prev, stmt.getConditionExpression(), RHS);
+
+               CFGNode thenNode = createStatement(prev, stmt.getThenClause());
+               CFGNode joinNode = createNode(null, SKIP);
+               CFGNode elseNode = null;
+
+               connectNodes(thenNode, joinNode);
+
+               if (stmt.getElseClause() == null) {
+                       connectNodes(prev, joinNode);
+               } else {
+                       elseNode = createStatement(prev, stmt.getElseClause());
+                       connectNodes(elseNode, joinNode);
+               }
+
+               return joinNode;
+       }
+
+       private CFGNode createForStatement(CFGNode prev, IASTForStatement stmt) {
+               CFGNode beforeCondNode = createNode(null, SKIP);
+               CFGNode beforeIterNode = createNode(null, SKIP);
+               CFGNode joinNode = createNode(null, SKIP);
+               CFGNode lastNode = null;
+
+               continueStack.push(beforeIterNode);
+               breakStack.push(joinNode);
+
+               // Init process
+               prev = createStatement(prev, stmt.getInitializerStatement());
+
+               // Condition & Then process
+               connectNodes(prev, beforeCondNode);
+
+               prev = createExpr(beforeCondNode, stmt.getConditionExpression(), RHS);
+               lastNode = createStatement(prev, stmt.getBody());
+
+               connectNodes(lastNode, beforeIterNode);
+               connectNodes(prev, joinNode); // no else connect
+
+               prev = createExpr(beforeIterNode, stmt.getIterationExpression(), RHS);
+
+               connectNodes(prev, beforeCondNode);
+
+               breakStack.pop();
+               continueStack.pop();
+
+               return joinNode;
+       }
+
+       private CFGNode createWhileStatement(CFGNode prev, IASTWhileStatement stmt) {
+               CFGNode joinNode = createNode(null, SKIP);
+               CFGNode beforeCondNode = createNode(null, SKIP);
+               CFGNode lastNode = null;
+
+               continueStack.push(beforeCondNode);
+               breakStack.push(joinNode);
+
+               connectNodes(prev, beforeCondNode);
+
+               prev = createExpr(beforeCondNode, stmt.getCondition(), RHS);
+               lastNode = createStatement(prev, stmt.getBody());
+
+               // connect lastNode TO nContinue.
+               connectNodes(lastNode, beforeCondNode);
+
+               // no else connect
+               connectNodes(prev, joinNode);
+
+               breakStack.pop();
+               continueStack.pop();
+
+               return joinNode;
+       }
+
+       private CFGNode createDoWhileStatement(CFGNode prev, IASTDoStatement stmt) {
+               CFGNode loopStartNode = createNode(null, SKIP);
+               CFGNode beforeCondNode = createNode(null, SKIP);
+               CFGNode joinNode = createNode(null, SKIP);
+               CFGNode lastNode = null;
+
+               continueStack.push(beforeCondNode);
+               breakStack.push(joinNode);
+
+               connectNodes(prev, loopStartNode);
+
+               lastNode = createStatement(loopStartNode, stmt.getBody());
+
+               connectNodes(lastNode, beforeCondNode);
+
+               prev = createExpr(beforeCondNode, stmt.getCondition(), RHS);
+
+               connectNodes(prev, loopStartNode);
+               connectNodes(prev, joinNode);
+
+               breakStack.pop();
+               continueStack.pop();
+
+               return joinNode;
+       }
+
+       private CFGNode createSwitchStatement(CFGNode prev, IASTSwitchStatement stmt) {
+               prev = createExpr(prev, stmt.getControllerExpression(), RHS);
+
+               CFGNode joinNode = createNode(null, SKIP);
+
+               caseStack.push(prev);
+               breakStack.push(joinNode);
+
+               // switch body ( compound Statement ) process
+               // null means that don't connect this stmt and the first stmt of stmt.getBody()
+               CFGNode lastNode = createStatement(null, stmt.getBody());
+               connectNodes(lastNode, joinNode);
+
+               if (defaultTable.get(caseStack.peek()) == null) {
+                       // if default statement of this switch doesn't exist,
+                       // then connect fall-through edge to after the switch
+                       connectNodes(caseStack.peek(), joinNode);
+               }
+
+               breakStack.pop();
+               caseStack.pop();
+
+               return joinNode;
+       }
+
+       private CFGNode createLabelStatement(CFGNode prev, IASTLabelStatement stmt) {
+               String labelName = stmt.getName().toString();
+               CFGNode labelNode = labels.get(labelName);
+
+               // if labelName is not in HashMap
+               if (labelNode == null) {
+                       labelNode = createNode(null, SKIP);
+                       labels.put(labelName, labelNode);
+               }
+
+               connectNodes(prev, labelNode);
+
+               return createStatement(labelNode, stmt.getNestedStatement());
+       }
+
+       private CFGNode createGotoStatement(CFGNode prev, IASTGotoStatement stmt) {
+               String labelName = stmt.getName().toString();
+               CFGNode labelNode = labels.get(labelName);
+
+               if (labelNode == null) {
+                       labelNode = createNode(null, SKIP);
+                       labels.put(labelName, labelNode);
+               }
+
+               // Connects Nodes : before gotoStmt to labelNode
+               connectNodes(prev, labelNode);
+
+               return null;
+       }
+
+       private CFGNode createReturnStatement(CFGNode prev, IASTReturnStatement stmt) {
+               IASTExpression expr = stmt.getReturnValue();
+
+               if (expr != null) {
+                       createExpr(prev, expr, RHS);
+               }
+
+               return null;
+       }
+
+       private CFGNode createCaseStatement(CFGNode prev) {
+               CFGNode caseSkipNode = createNode(null, SKIP);
+
+               connectNodes(prev, caseSkipNode);
+               connectNodes(caseStack.peek(), caseSkipNode);
+
+               return caseSkipNode;
+       }
+
+       private CFGNode createDefaultStatement(CFGNode prev) {
+               CFGNode defaultSkipNode = createNode(null, SKIP);
+
+               connectNodes(prev, defaultSkipNode);
+               connectNodes(caseStack.peek(), defaultSkipNode);
+
+               // put information that default statement is exist.
+               defaultTable.put(caseStack.peek(), defaultSkipNode);
+
+               return defaultSkipNode;
+       }
+
+       private CFGNode createExpr(CFGNode prev, IASTExpression expr, boolean side) {
+               if (expr instanceof IASTFieldReference) {
+                       IASTFieldReference fieldRef = (IASTFieldReference) expr;
+                       IASTExpression fieldOwner = fieldRef.getFieldOwner();
+                       if (fieldRef.isPointerDereference()) {
+                               prev = createExpr(prev, fieldOwner, RHS);
+                       } else {
+
+                               if (searchId(fieldOwner) == null) {
+                                       prev = createExpr(prev, fieldOwner, RHS);
+                               }
+                       }
+               }
+
+               else if (expr instanceof ICASTTypeIdInitializerExpression) {
+                       ICASTTypeIdInitializerExpression initExpr = (ICASTTypeIdInitializerExpression) expr;
+                       prev = createInitializer(prev, initExpr.getInitializer(), RHS);
+               }
+
+               else if (expr instanceof IASTIdExpression) {
+                       IASTName name = ((IASTIdExpression) expr).getName();
+                       if (isSelectedBinding(name)) {
+                               CFGNode node;
+                               if (side == LHS) {
+                                       node = createNode(name, DEF);
+                               } else {
+                                       node = createNode(name, USE);
+                               }
+                               connectNodes(prev, node);
+                               prev = node;
+                       }
+               }
+
+               else if (expr instanceof IGNUASTCompoundStatementExpression) {
+                       IGNUASTCompoundStatementExpression compoundStmtExpr =
+                                       (IGNUASTCompoundStatementExpression) expr;
+                       prev = createStatement(prev, compoundStmtExpr.getCompoundStatement());
+               }
+
+               else if (expr instanceof IASTArraySubscriptExpression) {
+                       IASTArraySubscriptExpression arrayExpr = (IASTArraySubscriptExpression) expr;
+                       prev = createExpr(prev, (IASTExpression) arrayExpr.getArgument(), RHS);
+                       prev = createExpr(prev, arrayExpr.getArrayExpression(), RHS);
+               }
+
+               else if(expr instanceof IASTBinaryExpression) {
+                       IASTBinaryExpression binaryExpr = (IASTBinaryExpression) expr;
+                       int operator = binaryExpr.getOperator();
+                       IASTExpression operand1 = binaryExpr.getOperand1();
+                       IASTExpression operand2 = binaryExpr.getOperand2();
+
+                       switch (operator) {
+                               case IASTBinaryExpression.op_assign:
+                                       prev = createExpr(prev, operand2, RHS);
+                                       prev = createExpr(prev, operand1, LHS);
+                                       break;
+
+                               case IASTBinaryExpression.op_multiplyAssign:
+                               case IASTBinaryExpression.op_divideAssign:
+                               case IASTBinaryExpression.op_moduloAssign:
+                               case IASTBinaryExpression.op_plusAssign:
+                               case IASTBinaryExpression.op_minusAssign:
+                               case IASTBinaryExpression.op_shiftLeftAssign:
+                               case IASTBinaryExpression.op_shiftRightAssign:
+                               case IASTBinaryExpression.op_binaryAndAssign:
+                               case IASTBinaryExpression.op_binaryXorAssign:
+                               case IASTBinaryExpression.op_binaryOrAssign:
+                                       prev = createExpr(prev, operand1, RHS);
+                                       prev = createExpr(prev, operand2, RHS);
+                                       prev = createExpr(prev, operand1, LHS);
+                                       break;
+
+                               case IASTBinaryExpression.op_logicalAnd:
+                               case IASTBinaryExpression.op_logicalOr:
+                                       CFGNode skip = createNode(null, SKIP);
+                                       CFGNode cond = createExpr(prev, operand1, RHS);
+                                       prev = createExpr(cond, operand2, RHS);
+                                       connectNodes(prev, skip);
+                                       connectNodes(cond, skip);
+                                       prev = skip;
+                                       break;
+
+                               default:
+                                       prev = createExpr(prev, operand1, RHS);
+                                       prev = createExpr(prev, operand2, RHS);
+                       }
+               }
+
+               else if(expr instanceof IASTUnaryExpression) {
+                       IASTUnaryExpression unaryExpr = (IASTUnaryExpression) expr;
+                       int operator = unaryExpr.getOperator();
+                       IASTExpression operand = unaryExpr.getOperand();
+
+                       switch (operator) {
+                               case IASTUnaryExpression.op_prefixDecr:
+                               case IASTUnaryExpression.op_prefixIncr: {
+                                       IASTIdExpression id = searchId(operand);
+                                       if (id != null) {
+                                               if (isSelectedBinding(id.getName())) {
+                                                       CFGNode use = createNode(id.getName(), USE);
+                                                       connectNodes(prev, use);
+                                                       CFGNode def = createNode(id.getName(), DEF);
+                                                       connectNodes(use, def);
+                                                       prev = def;
+                                               }
+                                       }
+                                       prev = createExpr(prev, operand, RHS);
+                               } break;
+
+                               case IASTUnaryExpression.op_postFixDecr:
+                               case IASTUnaryExpression.op_postFixIncr: {
+                                       IASTIdExpression id = searchId(operand);
+                                       prev = createExpr(prev, operand, RHS);
+                                       if (id != null) {
+                                               if (isSelectedBinding(id.getName())) {
+                                                       CFGNode use = createNode(id.getName(), USE);
+                                                       connectNodes(prev, use);
+                                                       CFGNode def = createNode(id.getName(), DEF);
+                                                       connectNodes(use, def);
+                                                       prev = def;
+                                               }
+                                       }
+                               } break;
+
+                               case IASTUnaryExpression.op_bracketedPrimary:
+                                       prev = createExpr(prev, operand, side);
+                                       break;
+
+                               case IASTUnaryExpression.op_amper:
+                                       if (searchId(operand) == null) {
+                                                // non interesting
+                                               prev = createExpr(prev, operand, RHS);
+                                       } else {
+                                               // "&(((x)))" expression do not make USE node. must be Exception
+                                               throw new TracingUnsupportedException();
+                                       }
+                                       break;
+
+                               default:
+                                       prev = createExpr(prev, operand, RHS);
+                       }
+               }
+
+               else if (expr instanceof IASTCastExpression) {
+                       prev = createExpr(prev, ((IASTCastExpression) expr).getOperand(), RHS);
+               }
+
+               /*
+                * prev of processExpr() parameter has succ nodes.
+                */
+               else if (expr instanceof IASTConditionalExpression) {
+                       IASTConditionalExpression conditionalExpr = ((IASTConditionalExpression) expr);
+                       IASTExpression conditionExpr = conditionalExpr.getLogicalConditionExpression();
+                       IASTExpression positiveExpr = conditionalExpr.getPositiveResultExpression();
+                       IASTExpression negativeExpr = conditionalExpr.getNegativeResultExpression();
+                       CFGNode skip = createNode(null, SKIP);
+                       if (side == RHS) {
+                               prev = createExpr(prev, conditionExpr, RHS);
+                               connectNodes(createExpr(prev, positiveExpr, RHS), skip);
+                               connectNodes(createExpr(prev, negativeExpr, RHS), skip);
+                       } else { // eg. (x > y ? x : y)= 1
+                               prev = createExpr(prev, conditionExpr, RHS);
+                               connectNodes(createExpr(prev, positiveExpr, LHS), skip);
+                               connectNodes(createExpr(prev, negativeExpr, LHS), skip);
+                       }
+                       prev = skip;
+               }
+
+               /* int a;
+                * a=1, printf("%d\t",a), printf("%d",++a);
+                * result : 1   2
+                */
+               else if (expr instanceof IASTExpressionList) {
+                       IASTExpression[] exprs = ((IASTExpressionList) expr).getExpressions();
+                       for (IASTExpression subexpr : exprs) {
+                               prev = createExpr(prev, subexpr, RHS);
+                       }
+               }
+
+               /* int a=1;
+                * printf("%d %d %d\n",a,a++,a++);
+                * result : 4 3 2
+                */
+               else if (expr instanceof IASTFunctionCallExpression) {
+                       IASTFunctionCallExpression functionExpr = (IASTFunctionCallExpression) expr;
+                       prev = createExpr(prev, functionExpr.getFunctionNameExpression(), RHS);
+                       IASTInitializerClause[] clauses = functionExpr.getArguments();
+                       for (int i=clauses.length-1 ; i>=0; i--) {
+                               prev = createInitializerClause(prev, clauses[i], RHS);
+                       }
+               }
+
+               else {
+                       /* Following expressions are properly ignored for building CFG.
+                        * - IASTLiteralExpression
+                        * - IASTProblemExpression
+                        * - IASTTypeIdExpression
+                        */
+               }
+
+               return prev;
+       }
+
+       /* int x=0;
+        * int a[3] = {x, x++, x++};
+        * results of a[0],a[1],a[2] are all zero. */
+       private CFGNode createInitializer(CFGNode prev, IASTInitializer init, boolean side) {
+               if (init instanceof IASTEqualsInitializer) {
+                       prev = createEqualsInitializer(prev, (IASTEqualsInitializer) init, side);
+               } else if (init instanceof IASTInitializerList) {
+                       prev = createInitializerList(prev, (IASTInitializerList) init, side);
+               } else if (init instanceof ICASTDesignatedInitializer) {
+                       prev = createDesignatedInitializer(prev, (ICASTDesignatedInitializer) init, side);
+               }
+               return prev;
+       }
+
+       private CFGNode createEqualsInitializer(CFGNode prev,
+                       IASTEqualsInitializer init, boolean side) {
+               return createInitializerClause(prev, init.getInitializerClause(), side);
+       }
+
+       private CFGNode createInitializerClause(CFGNode prev,
+                       IASTInitializerClause clause, boolean side) {
+               if (clause instanceof ICASTDesignatedInitializer) {
+                       prev = createDesignatedInitializer(prev, (ICASTDesignatedInitializer) clause, side);
+               } else if (clause instanceof IASTInitializerList) {
+                       prev = createInitializerList(prev, (IASTInitializerList) clause, side);
+               } else if (clause instanceof IASTExpression) {
+                       prev = createExpr(prev, (IASTExpression) clause, side);
+               }
+               return prev;
+       }
+
+       private CFGNode createDesignatedInitializer(CFGNode prev,
+                       ICASTDesignatedInitializer desgInit, boolean side) {
+               prev = createInitializerClause(prev, desgInit.getOperand(), RHS);
+               ICASTDesignator[] desgs = desgInit.getDesignators();
+               for (ICASTDesignator desg : desgs) {
+                       prev = createDesignator(prev, desg, RHS);
+               }
+               return prev;
+       }
+
+       private CFGNode createDesignator(CFGNode prev, ICASTDesignator desg, boolean side) {
+               if (desg instanceof ICASTArrayDesignator) {
+                       prev = createArrayDesignator(prev, (ICASTArrayDesignator) desg, side);
+               } else if (desg instanceof ICASTFieldDesignator) {
+                       prev = createFieldDesignator(prev, (ICASTFieldDesignator) desg, side);
+               } else if (desg instanceof IGCCASTArrayRangeDesignator) {
+                       prev = createArrayRangeDesignator(prev, (IGCCASTArrayRangeDesignator) desg, side);
+               }
+               return prev;
+       }
+
+       private CFGNode createArrayDesignator(CFGNode prev,
+                       ICASTArrayDesignator arrayDesg, boolean side) {
+               return prev = createExpr(prev, arrayDesg.getSubscriptExpression(), side);
+       }
+
+       private CFGNode createFieldDesignator(CFGNode prev,
+                       ICASTFieldDesignator fieldDesg, boolean side) {
+               /* TODO
+                *                * example
+                *                * struct ABC instance2 = {.def[0] = 9};
+                *                *                          ^
+                *                *                       IASTName
+                *                **/
+               return prev;
+       }
+
+       /* int width[10] = {[1...3]=1}; // ok
+        * int width[10] = {[x...x+4]=1}; // not ok
+        * Must have Constant in the "[]"
+        */
+       private CFGNode createArrayRangeDesignator(CFGNode prev,
+                       IGCCASTArrayRangeDesignator arrayRangeDesg, boolean side) {
+               prev = createExpr(prev, arrayRangeDesg.getRangeFloor(), side); // IASTLiteralExpression
+               prev = createExpr(prev, arrayRangeDesg.getRangeCeiling(), side); // IASTLiteralExpression
+               return prev;
+       }
+
+       private CFGNode createInitializerList(CFGNode prev,
+                       IASTInitializerList initList, boolean side) {
+               IASTInitializerClause[] clauses = initList.getClauses();
+               for (IASTInitializerClause clause : clauses) {
+                       prev = createInitializerClause(prev, clause, side);
+               }
+               return prev;
+       }
+
+       private void connectNodes(CFGNode prev, CFGNode next) {
+               if (prev == null || next == null) {
+                       return;
+               }
+
+               prev.addSucc(next);
+               next.addPred(prev);
+       }
+
+       private CFGNode createNode(IASTName name, Integer nodeType) {
+               CFGNode node = null;
+
+               if (nodeType == DEF) {
+                       node = new DefNode(name, nodeCount);
+               } else if (nodeType == USE) {
+                       node = new UseNode(name, nodeCount);
+               } else if (nodeType == SKIP) {
+                       node = new SkipNode(nodeCount);
+               }
+
+               if (name == selectedName) {
+                       nameMatchedNode.add(node);
+               }
+
+               nodeCount++;
+
+               return node;
+       }
+
+       private boolean isNestedFunction(IASTFunctionDefinition currentFunction) {
+               IASTNode parent = currentFunction.getParent();
+               while (parent != null) {
+                       if (parent instanceof IASTFunctionDefinition) {
+                               return true;
+                       }
+                       parent = parent.getParent();
+               }
+               return false;
+       }
+
+       private boolean isSelectedBinding(IASTName name) {
+               return selectedName.resolveBinding().equals(name.resolveBinding());
+       }
+
+       // (((x))) case. return ID
+       private IASTIdExpression searchId(IASTExpression expr) {        // expr must be lvalue
+               if (expr instanceof IASTIdExpression) {
+                       IASTIdExpression idExpr = (IASTIdExpression) expr;
+                       if (isSelectedBinding(idExpr.getName())) {
+                               // interesting
+                               return idExpr;
+                       } else {        // non interesting
+                               return null;
+                       }
+               } else if (expr instanceof IASTUnaryExpression) {
+                       IASTUnaryExpression unaryExpr = (IASTUnaryExpression) expr;
+                       if (unaryExpr.getOperator() == IASTUnaryExpression.op_bracketedPrimary) {
+                               /* ( xxxxx ) */
+                               return searchId(unaryExpr.getOperand());
+                       } else {
+                               return null; // *x
+                       }
+               } else {
+                       // syntax error
+                       return null;
+               }
+       }
+
+       /**
+        * Get the count of all CFG nodes.
+        *
+        * @return the count of all CFG nodes
+        */
+       public int getNodeCount() {
+               return nodeCount;
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/CFGNode.java b/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/CFGNode.java
new file mode 100644 (file)
index 0000000..2e4a559
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * Program Understanding / Assignment Tracing
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jaeheung Kim <jaeheung.kim@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.nativeapp.assignmenttracing.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The super class node of all types of cfg nodes.<p>
+ * A node can have incoming and outgoing edges connected to other nodes.<br>
+ * All nodes must have unique ID.
+ *
+ * @author Jaeheung Kim <jaeheung.kim@samsung.com>
+ */
+public class CFGNode {
+       private List<CFGNode> pred;
+       private List<CFGNode> succ;
+
+       private int id;
+
+       CFGNode(int id) {
+               this.id = id;
+
+               pred = new ArrayList<CFGNode>();
+               succ = new ArrayList<CFGNode>();
+       }
+
+    /**
+     * Get unique CFGNode ID
+     * @return unique CFGNode ID
+     */
+       public int getID() {
+               return id;
+       }
+
+    /**
+     * Get all predecessor CFGNodes of this node.
+     * @return list of CFGNodes
+     */
+       public List<CFGNode> getPred() {
+               return pred;
+       }
+
+    /**
+     * Get all successor CFGNodes of this node.
+     * @return list of CFGNodes
+     */
+       public List<CFGNode> getSucc() {
+               return succ;
+       }
+
+       /**
+        * Add successor CFGNode to this node.
+        * @param node
+        */
+       void addSucc(CFGNode node) {
+               succ.add(node);
+       }
+
+       /**
+        * Add predecessor CFGNode to this node.
+        * @param node
+        */
+       void addPred(CFGNode node) {
+               pred.add(node);
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/ChainBuilder.java b/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/ChainBuilder.java
new file mode 100644 (file)
index 0000000..c4f1443
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+ * Program Understanding / Assignment Tracing
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyukmin Kwon <hyukmin0530.kwon@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.nativeapp.assignmenttracing.core;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.tizen.nativeapp.assignmenttracing.ui.AssignmentTracingUI;
+
+
+/**
+ * This class builds Def-Use chain and Use-Def chain for given node
+ * by traversing the CFG (Control Flow Graph).
+ *
+ * @author Hyukmin Kwon <hyukmin0530@samsung.com>
+ */
+public class ChainBuilder {
+       private ArrayList<IASTName> udChain;
+       private ArrayList<IASTName> duChain;
+       private boolean[] explored;
+       private int visitedNodes, visitedSkipNodes, visitedUseNodes, visitedDefNodes;
+
+       public void buildChain(List<CFGNode> selNodes, int nodeCount) {
+               explored = new boolean[nodeCount];
+               duChain = new ArrayList<IASTName>();
+               udChain = new ArrayList<IASTName>();
+
+               if (AssignmentTracingUI.DEBUG) initStat();
+
+               for (CFGNode selNode: selNodes) {
+                       if (selNode instanceof DefNode) {
+                               initializeFlagArray();
+                               calcDUChain(selNode);
+                       } else if (selNode instanceof UseNode) {
+                               initializeFlagArray();
+                               calcUDChain(selNode);
+                       }
+               }
+
+               if (AssignmentTracingUI.DEBUG) printStat();
+
+               explored = null;
+       }
+
+    /**
+     * @return Return uses of the def node
+     */
+       public List<IASTName> getDUChain() {
+               return duChain;
+       }
+
+    /**
+     * @return Return defs for the use node
+     */
+       public List<IASTName> getUDChain() {
+               return udChain;
+       }
+
+       private void initializeFlagArray() {
+               for (int i=0; i< explored.length; i++) {
+                       explored[i] = false;
+               }
+       }
+
+       private void calcDUChain(CFGNode node) {
+               Stack<CFGNode> nodeStack = new Stack<CFGNode>();
+               nodeStack.push(node);
+
+               while (!nodeStack.empty()) {
+                       CFGNode currentNode = nodeStack.pop();
+
+                       if (AssignmentTracingUI.DEBUG)  checkStat(currentNode);
+
+                       explored[currentNode.getID()] = true;
+                       for (CFGNode succ : currentNode.getSucc()) {
+                               if (!explored [succ.getID()]) {
+                                       if (succ instanceof UseNode) {
+                                               UseNode useNode = (UseNode) succ;
+                                               duChain.add(useNode.getASTName());
+                                       }
+                                       if (!(succ instanceof DefNode)) {
+                                               nodeStack.push(succ);
+                                       }
+                               }
+                       }
+               }
+       }
+
+       private void calcUDChain(CFGNode node) {
+               Stack<CFGNode> nodeStack = new Stack<CFGNode>();
+               nodeStack.push(node);
+
+               while (!nodeStack.empty()) {
+                       CFGNode currentNode = nodeStack.pop();
+
+                       if (AssignmentTracingUI.DEBUG) checkStat(currentNode);
+
+                       explored[currentNode.getID()] = true;
+                       for (CFGNode pred : currentNode.getPred()) {
+                               if (!explored [pred.getID()]) {
+                                       if (pred instanceof DefNode) {
+                                               explored[pred.getID()] = true;
+                                               DefNode defNode = (DefNode) pred;
+                                               udChain.add(defNode.getASTName());
+                                       } else {
+                                               nodeStack.push(pred);
+                                       }
+                               }
+                       }
+               }
+       }
+
+       private void initStat() {
+               visitedNodes = 0;
+               visitedSkipNodes = 0;
+               visitedUseNodes = 0;
+               visitedDefNodes = 0;
+       }
+
+       private void checkStat(CFGNode node) {
+               visitedNodes++;
+               if (node instanceof UseNode) {
+                       visitedUseNodes++;
+               } else if (node instanceof DefNode) {
+                       visitedDefNodes++;
+               } else if (node instanceof SkipNode) {
+                       visitedSkipNodes++;
+               }
+       }
+
+       private void printStat() {
+               System.out.println("ChainBuilder visited " + visitedNodes +
+                               "(skip " + visitedSkipNodes +
+                               ",use " + visitedUseNodes +
+                               ",def " + visitedDefNodes +
+                               ")");
+       }
+}
diff --git a/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/DefNode.java b/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/DefNode.java
new file mode 100644 (file)
index 0000000..90023ca
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Program Understanding / Assignment Tracing
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jaeheung Kim <jaeheung.kim@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.nativeapp.assignmenttracing.core;
+
+import org.eclipse.cdt.core.dom.ast.IASTName;
+
+/**
+ * DefNode is used to find variables in write position that
+ * assigned the current values at the interested read position.
+ *
+ * @author Jaeheung Kim <jaeheung.kim@samsung.com>
+ */
+public class DefNode extends CFGNode {
+
+       private IASTName name;
+
+       DefNode(IASTName name, int id) {
+               super(id);
+               this.name = name;
+       }
+
+       /**
+        * Get IASTName of DefNode
+        * @return IASTName of DefNode
+        */
+       public IASTName getASTName() {
+               return name;
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/SkipNode.java b/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/SkipNode.java
new file mode 100644 (file)
index 0000000..8d395da
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Program Understanding / Assignment Tracing
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jaeheung Kim <jaeheung.kim@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.nativeapp.assignmenttracing.core;
+
+/**
+ * SkipNode is used only to join other CFGNodes, so it doesn't have associated IASTName field.
+ *
+ * @author Jaeheung Kim <jaeheung.kim@samsung.com>
+ */
+public class SkipNode extends CFGNode {
+       SkipNode(int id) {
+               super(id);
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/UseNode.java b/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/UseNode.java
new file mode 100644 (file)
index 0000000..071ec3b
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Program Understanding / Assignment Tracing
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jaeheung Kim <jaeheung.kim@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.nativeapp.assignmenttracing.core;
+
+import org.eclipse.cdt.core.dom.ast.IASTName;
+
+/**
+ * UseNode is used to find variables in read position of values assigned at the
+ * interested write position.
+ *
+ * @author Jaeheung Kim <jaeheung.kim@samsung.com>
+ */
+public class UseNode extends CFGNode {
+
+       private IASTName name;
+
+       UseNode(IASTName name, int id) {
+               super(id);
+               this.name = name;
+       }
+
+       /**
+        * Get IASTName of UseNode
+        * @return IASTName of UseNode
+        */
+       public IASTName getASTName() {
+               return name;
+       }
+}
diff --git a/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/exceptions/TracingCancelException.java b/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/exceptions/TracingCancelException.java
new file mode 100644 (file)
index 0000000..ecd7268
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Program Understanding / Assignment Tracing
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Wooyoung Cho <wooyoung1.cho@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.nativeapp.assignmenttracing.core.exceptions;
+
+/**
+ * This exception is thrown when tracing canceling situation is detected via
+ * progress monitor.
+ * @author Wooyoung Cho <wooyoung1.cho@samsung.com>
+ *
+ */
+public class TracingCancelException extends RuntimeException {
+       private static final long serialVersionUID = -6162831020705844096L;
+}
diff --git a/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/exceptions/TracingUnsupportedException.java b/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/core/exceptions/TracingUnsupportedException.java
new file mode 100644 (file)
index 0000000..724faac
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Program Understanding / Assignment Tracing
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Wooyoung Cho <wooyoung1.cho@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.nativeapp.assignmenttracing.core.exceptions;
+
+/**
+ * This exception is thrown when unsupported C features are detected while building
+ * control flow graph. Unsupported features are as follows:
+ * <ul>
+ * <li> The address of selected name is taken via ampersand(&) operator. </li>
+ * <li> The function containing the selection is nested in another function or has nested
+ * functions. In that situation, local variables can be accessed in another function, which
+ * is out of the feature's scope.
+ * </ul>
+ * @author Wooyoung Cho <wooyoung1.cho@samsung.com>
+ *
+ */
+public class TracingUnsupportedException extends RuntimeException {
+       private static final long serialVersionUID = 1357647060362109017L;
+}
diff --git a/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/ui/AssignmentTracingUI.java b/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/ui/AssignmentTracingUI.java
new file mode 100644 (file)
index 0000000..b0be7b0
--- /dev/null
@@ -0,0 +1,922 @@
+/*
+ * Program Understanding / Assignment Tracing
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Wooyoung Cho <wooyoung1.cho@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.nativeapp.assignmenttracing.ui;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.EScopeKind;
+import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
+import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
+import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
+import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.IASTNode;
+import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
+import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
+import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.cdt.core.dom.ast.IArrayType;
+import org.eclipse.cdt.core.dom.ast.IBinding;
+import org.eclipse.cdt.core.dom.ast.ICompositeType;
+import org.eclipse.cdt.core.dom.ast.IParameter;
+import org.eclipse.cdt.core.dom.ast.IQualifierType;
+import org.eclipse.cdt.core.dom.ast.IScope;
+import org.eclipse.cdt.core.dom.ast.IType;
+import org.eclipse.cdt.core.dom.ast.ITypedef;
+import org.eclipse.cdt.core.dom.ast.IVariable;
+import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage;
+import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
+import org.eclipse.cdt.core.model.ILanguage;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.core.model.IWorkingCopy;
+import org.eclipse.cdt.internal.ui.editor.CEditor;
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.ui.text.SharedASTJob;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentExtension4;
+import org.eclipse.jface.text.ISynchronizable;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.IAnnotationModelExtension;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.AbstractTextEditor;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.tizen.nativeapp.assignmenttracing.core.CFGBuilder;
+import org.tizen.nativeapp.assignmenttracing.core.CFGNode;
+import org.tizen.nativeapp.assignmenttracing.core.ChainBuilder;
+import org.tizen.nativeapp.assignmenttracing.core.exceptions.TracingCancelException;
+import org.tizen.nativeapp.assignmenttracing.core.exceptions.TracingUnsupportedException;
+
+
+/**
+ * Main class for Assignment Tracing(aka. def/use chain) fragment and UI.
+ * <p>
+ * This class is a fragment of org.eclipse.cdt.ui plugin to integrate assignment tracing feature
+ * with C editor. The assignment tracing result is visualized using annotation mechanism of CDT.
+ * <p>
+ * Notes:
+ * This class should be used as singleton object by <code>getInstance()</code> method.
+ * Most codes require UI context to run properly.
+ *
+ * @author Wooyoung Cho <wooyoung1.cho@samsung.com>
+ *
+ */
+public class AssignmentTracingUI {
+       /**
+        * Official name of this feature
+        */
+       private static final String ASSIGNMENT_TRACING_NAME = "Assignment Tracing";
+
+       /**
+        *  def annotation type
+        */
+       public static final String DEF_ANNOT_TYPE = "org.tizen.nativeapp.assignmenttracing.def";
+
+       /**
+        * use annotation type
+        */
+       public static final String USE_ANNOT_TYPE = "org.tizen.nativeapp.assignmenttracing.use";
+
+       /**
+        * selection annotation type
+        */
+       public static final String SEL_ANNOT_TYPE = "org.tizen.nativeapp.assignmenttracing.sel";
+
+       /**
+        * Set true for debug mode
+        */
+       public static final boolean DEBUG = false;
+
+       // The singleton instance
+       private static AssignmentTracingUI singleton;
+
+       /**
+        * Def/use annotations applied currently in the current editor
+        */
+       private Annotation[] annotations = null;
+       private IEditorPart currentEditor;
+       private SharedASTJob currentUpdater;
+
+       private long lastModificationStamp = IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
+
+       // working states
+       private boolean isOn = false;
+       private boolean isLoading = true;
+
+       // for Tracing result navigation Mode
+       private boolean navigationMode = false;
+       private List<Position> astNamePositionList = null;
+       private int positionIndex = 0;
+
+       // for debug and statistics
+       private long startCFGBuild, endCFGBuild, startChainBuild;
+       private long endChainBuild, startVisualize, endVisualize;
+       private long nodeCount;
+
+       /**
+        *  The listener we register with the selection service.
+        *  When a text is selected, process du-chain for the selection.
+        */
+       private ISelectionListener listener = new ISelectionListener() {
+               public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+                       // if other than editor is selected, ignore.
+                       if (!(part instanceof IEditorPart)) {
+                               return;
+                       }
+                       msg("selected");
+
+                       if (currentEditor == null) return;
+                       // currentEditor is always C editor and set before selection event is fired.
+                       // Thus if currentEditor doesn't equal to part, it's not a C editor.
+                       if (!currentEditor.equals(part)) {
+                               return;
+                       }
+
+                       // Only consider text selections
+                       if (selection instanceof ITextSelection) {
+                               showDUSelection((ITextSelection) selection);
+                       } else {
+                               removeAllAnnotations();
+                       }
+               }
+       };
+
+       /**
+        * Does not allow to create instance by other class.
+        */
+       private AssignmentTracingUI() {
+       }
+
+       /**
+        * Returns the singleton instance
+        *
+        * @return the singleton instance
+        */
+       public static AssignmentTracingUI getInstance() {
+               if (singleton == null)
+                       singleton = new AssignmentTracingUI();
+               return singleton;
+       }
+
+       private CEditor getActiveCEditor() {
+               IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+                               .getActiveEditor();
+               if (editor instanceof CEditor) {
+                       return (CEditor) editor;
+               } else {
+                       return null;
+               }
+       }
+
+       /**
+        * Installs duchain annotation updater. Add selection listener.
+        */
+       private void installUpdater() {
+               IWorkbench wb = PlatformUI.getWorkbench();
+               IWorkbenchWindow wbw = wb.getActiveWorkbenchWindow();
+               ISelectionService ss = wbw.getSelectionService();
+               ss.addPostSelectionListener(listener);
+       }
+
+       /**
+        * Uninstalls duchain annotation updater. Remove selection listener.
+        */
+       public void uninstallUpdater() {
+               IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+               // if eclipse is not exiting.
+               if (ww != null) {
+                       ww.getSelectionService().removePostSelectionListener(listener);
+               }
+       }
+
+       /**
+        *  Move cursor to the next occurrence
+        */
+       public void moveNext() {
+               if (astNamePositionList != null) {
+                       navigationMode = true;
+                       int listSize = astNamePositionList.size();
+                       positionIndex++;
+                       if (positionIndex >= listSize) {
+                               positionIndex = 0;
+                       } else {
+                               // check if duplicated offsets are exist
+                               while (astNamePositionList.get(positionIndex).getOffset() ==
+                                               astNamePositionList.get(positionIndex - 1).getOffset()) {
+                                       positionIndex++;
+                                       if (positionIndex >= listSize) {
+                                               positionIndex = 0;
+                                               break;
+                                       }
+                               }
+                       }
+                       Position pos = astNamePositionList.get(positionIndex);
+                       getActiveCEditor().selectAndReveal(pos.getOffset(), pos.getLength());
+               }
+       }
+
+       /**
+        *  Move cursor to the previous occurrence
+        */
+       public void movePrevious() {
+               if (astNamePositionList != null) {
+                       navigationMode = true;
+                       int listSize = astNamePositionList.size();
+                       positionIndex--;
+                       if (positionIndex < 0) {
+                               positionIndex = listSize - 1;
+                       } else {
+                               // check if duplicated offsets are exist
+                               while (astNamePositionList.get(positionIndex).getOffset() ==
+                                               astNamePositionList.get(positionIndex + 1).getOffset()) {
+                                       positionIndex--;
+                                       if (positionIndex < 0) {
+                                               positionIndex = listSize - 1;
+                                               break;
+                                       }
+                               }
+                       }
+                       Position pos = astNamePositionList.get(positionIndex);
+                       getActiveCEditor().selectAndReveal(pos.getOffset(), pos.getLength());
+               }
+       }
+
+       /**
+        * Check if the selection and the navigation variable's offset and length are equal or not.
+        * @param selection text selection
+        * @return <code>true</code> if both are equal
+        */
+       private boolean isNavigationModeSelection(ITextSelection selection) {
+               if (astNamePositionList != null) {
+                       Position pos = astNamePositionList.get(positionIndex);
+                       if ((pos.getOffset() == selection.getOffset()) &&
+                                       (pos.getLength() == selection.getLength())) {
+                               return true;
+                       }
+               }
+               return false;
+       }
+
+       /**
+        * Creates and schedules a job which actually analyzes and visualizes the result.
+        * If there is no working copy of the file (i.e. not a c file), ignore it.
+        * If an older job is not finished, cancel it. Then the older job will be finished as soon as
+        * it recognizes the cancellation and new job will be executed.
+        * This job analyzes code and saves selected name and def-use information in member fields
+        * and other methods can use them.
+        *
+        * @param selection a text selection that start to analyze
+        */
+       public void showDUSelection(final ITextSelection selection) {
+               // ignore selection occurred by navigation operations
+               if (navigationMode && isNavigationModeSelection(selection)) {
+                       navigationMode = false;
+                       return;
+               }
+               navigationMode = false;
+
+               lastModificationStamp = getCurrentModificationStamp();
+
+               ITranslationUnit tu = getCurrentTranslationUnit();
+               if (tu == null) {
+                       msg("no file or translation unit");
+                       return;
+               }
+
+               SharedASTJob job = new SharedASTJob(ASSIGNMENT_TRACING_NAME, tu) {
+                       private IProgressMonitor cancelMonitor = new NullProgressMonitor();
+
+                       private final Comparator<Position> offsetComparator = new Comparator<Position>() {
+                               public int compare(Position arg0, Position arg1) {
+                                       return arg0.getOffset() - arg1.getOffset();
+                               }
+                       };
+
+                       protected void canceling() {
+                               msg("canceling " + this);
+                               cancelMonitor.setCanceled(true);
+                       }
+
+                       @Override
+                       public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) throws CoreException {
+                               msg("start " + this);
+                               if (cancelMonitor.isCanceled()) {
+                                       return Status.CANCEL_STATUS;
+                               }
+
+                               // synchronize among updater jobs
+                               synchronized (AssignmentTracingUI.this) {
+                                       // initialize astNamePositionList to NULL not to move cursor
+                                       // using Ctrl + '[', ']'
+                                       astNamePositionList = null;
+
+                                       // find IASTName for the given selection
+                                       IASTNodeSelector selector = ast.getNodeSelector(null);
+                                       IASTName name = selector.findEnclosingName(
+                                                       selection.getOffset(), selection.getLength());
+                                       if (name == null) {
+                                               name = selector.findEnclosingImplicitName(
+                                                               selection.getOffset(), selection.getLength());
+                                       }
+                                       if (name == null) {
+                                               removeAllAnnotations();
+                                               return Status.CANCEL_STATUS;
+                                       }
+
+                                       if (cancelMonitor.isCanceled()) {
+                                               return Status.CANCEL_STATUS;
+                                       }
+
+                                       if (!isInteresting(name)) {
+                                               removeAllAnnotations();
+                                               return Status.CANCEL_STATUS;
+                                       }
+
+                                       IASTFunctionDefinition func = getEnclosingFunc(name);
+                                       // if name is not in function definition
+                                       if (func == null) {
+                                               return Status.CANCEL_STATUS;
+                                       }
+
+                                       if (cancelMonitor.isCanceled()) {
+                                               return Status.CANCEL_STATUS;
+                                       }
+
+                                       // build CFG
+                                       if (DEBUG) startCFGBuild = System.nanoTime();
+                                       CFGBuilder cfgBuilder = new CFGBuilder(cancelMonitor);
+                                       List<CFGNode> cfgNodes;
+                                       try {
+                                               cfgNodes = cfgBuilder.buildCFG(func, name);
+                                       } catch (TracingCancelException re) {
+                                               return Status.CANCEL_STATUS;
+                                       } catch (TracingUnsupportedException re) {
+                                               // when unsupported features are found,
+                                               // remove all annotations and cancel the process.
+                                               removeAllAnnotations();
+                                               return Status.CANCEL_STATUS;
+                                       }
+                                       if (DEBUG) endCFGBuild = System.nanoTime();
+                                       if (DEBUG) nodeCount = cfgBuilder.getNodeCount();
+
+                                       if (cancelMonitor.isCanceled()) {
+                                               return Status.CANCEL_STATUS;
+                                       }
+
+                                       // build DU-chain
+                                       if (DEBUG) startChainBuild = System.nanoTime();
+                                       ChainBuilder chainBuilder = new ChainBuilder();
+                                       chainBuilder.buildChain(cfgNodes, cfgBuilder.getNodeCount());
+                                       if (DEBUG) endChainBuild = System.nanoTime();
+
+                                       if (cancelMonitor.isCanceled()) {
+                                               return Status.CANCEL_STATUS;
+                                       }
+
+                                       // visualize
+                                       if (DEBUG) startVisualize = System.nanoTime();
+                                       IStatus status = visualizeDUChain(chainBuilder, name, cancelMonitor);
+                                       if (DEBUG) endVisualize = System.nanoTime();
+
+                                       astNamePositionList = new ArrayList<Position>();
+
+                                       // add position of selected name to astNamePositionList
+                                       IASTFileLocation selLoc = name.getFileLocation();
+                                       astNamePositionList.add(new Position(
+                                                       selLoc.getNodeOffset(), selLoc.getNodeLength()));
+
+                                       for (IASTName astName : chainBuilder.getDUChain()) {
+                                               // add all positions of DUChain to astNamePositionList
+                                               IASTFileLocation loc = astName.getFileLocation();
+                                               Position pos = new Position(loc.getNodeOffset(), loc.getNodeLength());
+                                               astNamePositionList.add(pos);
+                                       }
+
+                                       for (IASTName astName : chainBuilder.getUDChain()) {
+                                               // add all positions of UDChain to astNamePositionList
+                                               IASTFileLocation loc = astName.getFileLocation();
+                                               Position pos = new Position(loc.getNodeOffset(), loc.getNodeLength());
+                                               astNamePositionList.add(pos);
+                                       }
+
+                                       // Sort astNamePositionList in ascending-order using position offset.
+                                       Collections.sort(astNamePositionList, offsetComparator);
+
+                                       // Initialize positionIndex to properly move cursor
+                                       // to previous or next DUChain occurrence.
+                                       positionIndex = 0;
+                                       for (Position pos : astNamePositionList) {
+                                               if (name.getFileLocation().getNodeOffset() == pos.getOffset()) {
+                                                       break;
+                                               }
+                                               positionIndex++;
+                                       }
+
+                                       if (status.isOK()) {
+                                               if (DEBUG) {
+                                                       printStat();
+                                               }
+                                       } else {
+                                               return status;
+                                       }
+
+                                       return Status.OK_STATUS;
+                               }
+                       }
+               };
+
+               // if last updater is not finished, cancel it
+               if (currentUpdater != null && currentUpdater.getResult() == null) {
+                       currentUpdater.cancel();
+               }
+
+               currentUpdater = job;
+
+               // Assignment Tracing runs very frequently and very fast.
+               // So, prevent showing each running status by setting as system job.
+               job.setSystem(true);
+
+               job.schedule();
+       }
+
+       /**
+        * @return translation unit of the current editor. <code>null</code> if not found.
+        */
+       private ITranslationUnit getCurrentTranslationUnit() {
+               if (currentEditor == null) {
+                       return null;
+               }
+
+               IEditorInput input = currentEditor.getEditorInput();
+               // if no input
+               if (input == null) {
+                       return null;
+               }
+
+               URI uri;
+               if (input instanceof FileEditorInput) {
+                       // if file in workspace
+                       uri = ((FileEditorInput) input).getFile().getRawLocationURI();
+               } else if (input instanceof FileStoreEditorInput) {
+                       // if file not in workspace
+                       uri = ((FileStoreEditorInput) input).getURI();
+               } else {
+                       // shouldn't be reached here
+                       return null;
+               }
+               IWorkingCopy wc = getWorkingCopy(uri);
+
+               if (wc == null) {
+                       msg("No Working Copy");
+                       return null;
+               }
+
+               ITranslationUnit tu = wc.getTranslationUnit();
+               if (tu == null) {
+                       msg("No translation unit");
+                       return null;
+               }
+               return tu;
+       }
+
+       /**
+        * Find working copy of given path
+        * @param uri File uri
+        * @return Working copy for the uri
+        */
+       private IWorkingCopy getWorkingCopy(URI uri) {
+               for (IWorkingCopy wc : CUIPlugin.getSharedWorkingCopies()) {
+                       if (wc.getLocationURI().equals(uri)) {
+                               return wc;
+                       }
+               }
+               return null;
+       }
+
+       /**
+        * @param tu translation unit
+        * @return <code>true</code> if given translation unit is in C language.
+        */
+       private boolean isCLanguage(ITranslationUnit tu) {
+               if (tu == null) {
+                       return false;
+               }
+
+               try {
+                       ILanguage lang = tu.getLanguage();
+                       if (lang instanceof GCCLanguage) {
+                               return true;
+                       } else {
+                               return false;
+                       }
+               } catch (CoreException e) {
+                       return false;
+               }
+       }
+
+       /**
+        * @param ty type
+        * @return <code>true</code> if the given type is composite(struct) or array type.
+        *              If it's typedef or qualifier type, check its real type.
+        */
+       private static boolean isCompositeOrArrayType(IType ty) {
+               if (ty instanceof ITypedef) {
+                       return isCompositeOrArrayType(((ITypedef) ty).getType());
+               } else if (ty instanceof IQualifierType) {
+                       return isCompositeOrArrayType(((IQualifierType) ty).getType());
+               } else if (ty instanceof ICompositeType || ty instanceof IArrayType) {
+                       return true;
+               } else {
+                       return false;
+               }
+       }
+
+       /**
+        * Check if a name can be analyzed.
+        * Local/parameter and scalar variables.
+        * @param name name to be checked
+        * @return true if name is analyzable, false otherwise
+        */
+       public static boolean isInteresting(IASTName name) {
+               IBinding bind = name.resolveBinding();
+               if (bind != null) {
+                       // check variable
+                       if (!(bind instanceof IVariable)) {
+                               return false;
+                       }
+
+                       // Parameter is considered local variable.
+                       if (!(bind instanceof IParameter)) {
+                               IScope scope;
+                               try {
+                                       scope = bind.getScope();
+                               } catch (DOMException e) {
+                                       scope = null;
+                               }
+                               if (scope == null) {
+                                       msg("no scope");
+                                       return false;
+                               }
+
+                               // check local variable
+                               if (scope.getKind() != EScopeKind.eLocal) {
+                                       msg("not local");
+                                       return false;
+                               }
+                       }
+
+                       // check scalar
+                       IVariable v = (IVariable) bind;
+                       try {
+                               IType ty = v.getType();
+                               if (isCompositeOrArrayType(ty)) {
+                                       msg("not scalar");
+                                       return false;
+                               }
+                       } catch (Exception e) {
+                               return false;
+                       }
+
+                       // check K&R parameter without type declaration
+                       IASTNode parent = name.getParent();
+                       if (parent instanceof ICASTKnRFunctionDeclarator) {
+                               IASTDeclaration decls[] =
+                                               ((ICASTKnRFunctionDeclarator) parent).getParameterDeclarations();
+                               try {
+                                       for (IASTDeclaration decl : decls) {
+                                               IASTDeclarator declarators[] =
+                                                               ((IASTSimpleDeclaration) decl).getDeclarators();
+                                               for (IASTDeclarator declarator : declarators) {
+                                                       if (declarator.getName().toString().equals(name.toString())) {
+                                                               throw new Exception(); // found
+                                                       }
+                                               }
+                                       }
+                               } catch (Exception e) {
+                                       // Found the type declaration for name
+                                       return true;
+                               }
+                               // Couldn't find the type declaration for name
+                               // This case is actually not an error because it is treated as int by C spec.
+                               // But we ignore it as 'mark occurrence' does.
+                               msg("K&R parameter without type declaration");
+                               return false;
+                       }
+
+                       return true;
+               }
+               return false;
+       }
+
+       /**
+        * Return enclosing function definition of given name
+        * @param name
+        * @return If given name is in a function definition, return the function definition. Otherwise, return null.
+        */
+       private IASTFunctionDefinition getEnclosingFunc(IASTName name) {
+               IASTNode n = name;
+               // Find enclosing function definition
+               while (!(n instanceof IASTFunctionDefinition)) {
+                       if (n == null) {
+                               return null;
+                       }
+                       n = n.getParent();
+               }
+               return (IASTFunctionDefinition) n;
+       }
+
+       /**
+        * Visualize Def-Use Chain information using annotation mechanism of the editor.
+        * @param chainBuilder Chain builder that already built the chain information
+        * @param selectedName ast node of the selection
+        * @param cancelMonitor monitor
+        */
+       private IStatus visualizeDUChain(
+                       ChainBuilder chainBuilder, IASTName selectedName, IProgressMonitor cancelMonitor) {
+               List<IASTName> uses = chainBuilder.getDUChain();
+               List<IASTName> defs = chainBuilder.getUDChain();
+               int length = uses.size() + defs.size();
+
+               if (!(currentEditor instanceof AbstractTextEditor)) {
+                       return Status.CANCEL_STATUS;
+               }
+
+               AbstractTextEditor editor = (AbstractTextEditor) currentEditor;
+               IDocumentProvider documentProvider = editor.getDocumentProvider();
+               if (documentProvider == null) {
+                       return Status.CANCEL_STATUS;
+               }
+
+               IAnnotationModel annotationModel =
+                               documentProvider.getAnnotationModel(editor.getEditorInput());
+               if (annotationModel == null) {
+                       return Status.CANCEL_STATUS;
+               }
+
+               Map<Annotation, Position> annotationMap = new HashMap<Annotation, Position>(length);
+
+               for (IASTName use : uses) {
+                       IASTFileLocation loc = use.getFileLocation();
+                       Position position = new Position(loc.getNodeOffset(), loc.getNodeLength());
+                       Annotation an = new Annotation(USE_ANNOT_TYPE, false, new String("Used"));
+                       annotationMap.put(an, position);
+               }
+               for (IASTName def : defs) {
+                       IASTFileLocation loc = def.getFileLocation();
+                       Position position = new Position(loc.getNodeOffset(), loc.getNodeLength());
+                       Annotation an = new Annotation(DEF_ANNOT_TYPE, false, new String("Assigned"));
+                       annotationMap.put(an, position);
+               }
+               IASTFileLocation loc = selectedName.getFileLocation();
+               Position position = new Position(loc.getNodeOffset(), loc.getNodeLength());
+               Annotation an = new Annotation(SEL_ANNOT_TYPE, false, new String("Selected"));
+               annotationMap.put(an, position);
+
+               synchronized (getLockObject(annotationModel)) {
+                       // check code change
+                       long currentModificationStamp = getCurrentModificationStamp();
+
+                       // If canceled by UI thread, cancel it. If not canceled,
+                       // currentModificationStamp is valid.
+                       if (cancelMonitor.isCanceled()) {
+                               return Status.CANCEL_STATUS;
+                       }
+
+                       if (lastModificationStamp != IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP &&
+                                       currentModificationStamp != lastModificationStamp) {
+                               msg("code changed");
+                               return Status.CANCEL_STATUS;
+                       }
+                       // use replaceAnnotations() if available because it's faster
+                       if (annotationModel instanceof IAnnotationModelExtension) {
+                               ((IAnnotationModelExtension) annotationModel).replaceAnnotations(
+                                               annotations, annotationMap);
+                       } else {
+                               removeAllAnnotations();
+                               Iterator<Map.Entry<Annotation, Position>> iter =
+                                               annotationMap.entrySet().iterator();
+                               while (iter.hasNext()) {
+                                       Map.Entry<Annotation, Position> mapEntry = iter.next();
+                                       annotationModel.addAnnotation(mapEntry.getKey(), mapEntry.getValue());
+                               }
+                       }
+                       annotations = annotationMap.keySet().toArray(
+                                       new Annotation[annotationMap.keySet().size()]);
+               }
+               return Status.OK_STATUS;
+       }
+
+       /**
+        * @param annotationModel
+        * @return Lock object for concurrently accessing the given annotation model
+        */
+       private Object getLockObject(IAnnotationModel annotationModel) {
+               if (annotationModel instanceof ISynchronizable) {
+                       Object lock = ((ISynchronizable) annotationModel).getLockObject();
+                       if (lock != null) {
+                               return lock;
+                       }
+               }
+               return annotationModel;
+       }
+
+       /**
+        * @return current modification stamp of the document in the current editor
+        */
+       private long getCurrentModificationStamp() {
+               try {
+                       AbstractTextEditor editor = (AbstractTextEditor) currentEditor;
+                       IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
+                       return ((IDocumentExtension4) document).getModificationStamp();
+               } catch (NullPointerException e) {
+                       return IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP;
+               }
+       }
+
+       /**
+        * Remove all annotations.
+        */
+       private void removeAllAnnotations() {
+               if (currentEditor == null) {
+                       return;
+               }
+               if (annotations == null) {
+                       return;
+               }
+
+               IDocumentProvider documentProvider =
+                               ((AbstractTextEditor) currentEditor).getDocumentProvider();
+               if (documentProvider == null) {
+                       return;
+               }
+               IAnnotationModel annotationModel =
+                               documentProvider.getAnnotationModel(currentEditor.getEditorInput());
+               if (annotationModel == null) {
+                       return;
+               }
+
+               synchronized (getLockObject(annotationModel)) {
+                       // return if annotations is changed to null by UI thread
+                       if (annotations == null) return;
+                       if (annotationModel instanceof IAnnotationModelExtension) {
+                               ((IAnnotationModelExtension) annotationModel).replaceAnnotations(annotations, null);
+                       } else {
+                               for (Annotation an : annotations) {
+                                       annotationModel.removeAnnotation(an);
+                               }
+                       }
+                       annotations = null;
+               }
+       }
+
+       /**
+        * @return <code>true</code> if assignment tracing is on
+        */
+       public boolean isOn() {
+               return isOn;
+       }
+
+       /**
+        * Turns on and off assignment tracing feature.
+        * If trying to set same state, do nothing.
+        * If off to on, install the selection listener for as-you-type mechanism and run analysis
+        * for the currently selected selection.
+        * If on to off, uninstall the listener and remove all visualizations.
+        * @param newIsOn
+        */
+       public void setOn(boolean newIsOn) {
+               if (isOn != newIsOn) {
+                       if (newIsOn) {
+                               installUpdater();
+                               if (currentEditor != null && currentEditor instanceof ITextEditor) {
+                                       IEditorInput input = currentEditor.getEditorInput();
+                                       if (input instanceof IFileEditorInput) {
+                                               ISelectionProvider sp =
+                                                               ((ITextEditor) currentEditor).getSelectionProvider();
+                                               ISelection sel = sp.getSelection();
+                                               if (sel instanceof ITextSelection) {
+                                                       ITextSelection ts = (ITextSelection) sel;
+                                                       showDUSelection(ts);
+                                               }
+                                       }
+                               }
+                               isOn = true;
+                       } else {
+                               uninstallUpdater();
+                               removeAllAnnotations();
+                               isOn = false;
+                       }
+               }
+       }
+
+       /**
+        * Sets the currently selected editor in which assignment tracing runs.
+        * If the editor is showing C file, turn on assignment tracing.
+        * If not, disable the action.
+        * @param action action
+        * @param editorPart
+        */
+       public void setEditor(IAction action, IEditorPart editorPart) {
+               // when active editor(C editor) is changed, cancel the updater,
+               // remove annotations in older editor, and set new editor.
+               if (currentUpdater != null && currentUpdater.getResult() == null) {
+                       currentUpdater.cancel();
+               }
+               removeAllAnnotations();
+               currentEditor = editorPart;
+
+               ITranslationUnit tu = getCurrentTranslationUnit();
+               // if non-c file(ie. c++ file) is opened, disable button.
+               if (tu == null || !isCLanguage(tu)) {
+                       action.setEnabled(false);
+                       setOn(false);
+               } else {
+                       action.setEnabled(true);
+                       setOn(true);
+               }
+       }
+
+       /**
+        * @return <code>true</code> if no C editor is selected ever since start.
+        */
+       public boolean isLoading() {
+               return isLoading;
+       }
+
+       /**
+        * Sets that one C editor is selected at least once.
+        */
+       public void setLoaded() {
+               this.isLoading = false;
+       }
+
+       /**
+        * Prints a message for debugging
+        * @param msg
+        */
+       static void msg(String msg) {
+               if (DEBUG) {
+                       System.out.println(msg);
+               }
+       }
+
+       /**
+        * Print statistics
+        */
+       protected void printStat() {
+               msg("CFG " + ((endCFGBuild - startCFGBuild) / 1000000.0f) + "ms, " +
+                               "Chain " + ((endChainBuild - startChainBuild) / 1000000.0f) + "ms, " +
+                               "Visualize " + ((endVisualize - startVisualize) / 1000000.0f) + "ms, " +
+                               "#Nodes " + nodeCount);
+       }
+}
diff --git a/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/ui/TracingActionDelegate.java b/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/ui/TracingActionDelegate.java
new file mode 100644 (file)
index 0000000..ff38918
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Program Understanding / Assignment Tracing
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Wooyoung Cho <wooyoung1.cho@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.nativeapp.assignmenttracing.ui;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ *
+ * @author Wooyoung Cho <wooyoung1.cho@samsung.com>
+ *
+ */
+public class TracingActionDelegate implements IEditorActionDelegate {
+       /**
+        * turn on/off assignment tracing when button is clicked.
+        */
+       public void run(IAction action) {
+               AssignmentTracingUI.msg("DUChainAnnotationActionDelegate run");
+               // when button is pressed, apply the event to plugin.
+               AssignmentTracingUI p = AssignmentTracingUI.getInstance();
+               p.setOn(!p.isOn());
+       }
+
+
+       public void selectionChanged(IAction action, ISelection selection) {
+               // ignore
+       }
+
+       /**
+        * When active editor is changed, set the editor as current.
+        */
+       public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+               AssignmentTracingUI.msg("DUChainAnnotationActionDelegate set active editor");
+               AssignmentTracingUI p = AssignmentTracingUI.getInstance();
+               if (p.isLoading()) {
+                       p.setOn(true);
+                       p.setLoaded();
+               }
+               if (p.isOn()) {
+                       action.setChecked(true);
+               } else {
+                       action.setChecked(false);
+               }
+
+               p.setEditor(action, targetEditor);
+       }
+}
diff --git a/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/ui/TracingCommandHandler.java b/org.tizen.nativeapp.assignmenttracing/src/org/tizen/nativeapp/assignmenttracing/ui/TracingCommandHandler.java
new file mode 100644 (file)
index 0000000..4ba6190
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Program Understanding / Assignment Tracing
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jaeheung Kim <jaeheung.kim@samsung.com>
+ * Woongsik Choi <woongsik76.choi@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+package org.tizen.nativeapp.assignmenttracing.ui;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+/**
+ * Handler for shortcut keys. This is called when a shortcut key is pressed and move the cursor
+ * to previous or next location according to the event type.
+ * @author Jaeheung Kim <jaeheung.kim@samsung.com>
+ *
+ */
+public class TracingCommandHandler extends AbstractHandler {
+
+       public Object execute(ExecutionEvent event) throws ExecutionException {
+               if (event.getCommand().getId().equals(
+                               "org.tizen.nativeapp.assignmenttracing.moveprevious")) {
+                       AssignmentTracingUI.getInstance().movePrevious();
+               } else {
+                       AssignmentTracingUI.getInstance().moveNext();
+               }
+               return null;
+       }
+}
\ No newline at end of file
diff --git a/package/build.linux b/package/build.linux
new file mode 100755 (executable)
index 0000000..d257166
--- /dev/null
@@ -0,0 +1,291 @@
+#!/bin/bash -x
+
+build_path=${SRCDIR}/build_result
+
+__set_parameter()
+{
+       build_id=${package_name}
+       build_type=N
+       build_result_directory=${build_type}.${build_id}
+       build_result_path="$build_path/$build_result_directory"
+       architecture=x86
+       ide_root_path_name=IDE
+
+       case ${platform} in
+               linux)
+                       archive_platform_name=linux
+                       windowing=gtk
+                       ;;
+               windows)
+                       archive_platform_name=win32
+                       windowing=win32
+                       ;;
+               *)
+                       echo "${platform} is not support yet."
+                       ;;
+       esac
+
+       result_archive_file=${build_id}-${archive_platform_name}.${windowing}.${architecture}.zip
+}
+
+__set_build_parameter()
+{
+       case ${platform} in
+               linux)
+                       reference_ide_path=${ROOTDIR}/indigo-pde/eclipse
+                       ;;
+               windows)
+                       reference_ide_path=${ROOTDIR}/indigo-winpde/eclipse
+                       ;;
+               *)
+                       echo "${platform} is not support yet."
+                       ;;
+       esac
+}
+
+__set_install_parameter()
+{
+       INSTALL_DIR=${SRCDIR}/package/${package_name}.package.${platform}/data
+}
+
+__clean_build_environment()
+{
+       if [ -d $build_path ]
+       then
+               echo "Build result directory : [$build_path]"
+       else
+               echo "Make build result directory [$build_path]"
+               mkdir -p $build_path
+       fi
+
+       echo "Remove legacy build files..."
+       if [ -d ${build_result_path}/${archive_platform_name}.${windowing}.${architecture} ]
+       then
+               rm -rf ${build_result_path}/${archive_platform_name}.${windowing}.${architecture}
+       fi
+       if [ -e ${build_result_path}/${result_archive_file} ]
+       then
+               rm -rf ${build_result_path}/${result_archive_file}
+       fi
+       if [ -d ${build_path}/tmp ]
+       then
+               rm -rf ${build_path}/tmp
+       fi
+
+       if [ -d ${build_path}/buildRepo ]
+       then
+               rm -rf ${build_path}/buildRepo
+       fi
+
+       rm -r ${build_path}/*.xml
+       rm -r ${build_path}/*.properties
+       rm -r ${build_path}/*.clean
+
+
+       if [ -d $build_path/plugins ]
+       then
+               echo "plugins directory recreate..."
+               rm -rf $build_path/plugins
+               mkdir $build_path/plugins
+       else
+               echo "Make plugins directory..."
+               mkdir $build_path/plugins
+       fi
+       if [ -d $build_path/features/ ]
+       then
+               echo "features directory recreate..."
+               rm -rf $build_path/features
+               mkdir $build_path/features
+       else
+               echo "Make features directory..."
+               mkdir $build_path/features
+       fi
+
+}
+
+__copy_build_sources()
+{
+       echo "Copy features from $SRCDIR to $build_path/features"
+       cp -r $SRCDIR/*.feature $build_path/features
+
+       echo "Copy plugins from $SRCDIR to $build_path/plugins"
+       cp -r $SRCDIR/* $build_path/plugins
+       rm -rf $build_path/plugins/*.feature
+}
+
+__copy_dependency_plugins()
+{
+       dependency_plugin_path=${ROOTDIR}/${ide_root_path_name}
+       if [ -d ${dependency_plugin_path} ]
+       then
+               cp -rf ${dependency_plugin_path}/features/* ${build_path}/features/
+               cp -rf ${dependency_plugin_path}/plugins/* ${build_path}/plugins/
+       fi
+}
+
+__make_ant_build_properties_file()
+{
+       builder_path="${SRCDIR}/builder"
+       parent_path_of_based_eclipse=${reference_ide_path}/..
+
+       echo "Make build.properties file..."
+       if [ ! -e $builder_path/build.properties.clean ] ; then
+               echo "ERROR : \"build.properties.clean\" file does not exist..."
+               exit 1
+       fi
+       cp $builder_path/build.properties.clean $build_path
+       cp $builder_path/customTargets.xml $build_path
+
+       if [ -d $reference_ide_path ] 
+       then
+               sed -e "s;\(^buildDirectory=\).*;\1${build_path};g" \
+               -e "s;\(^base=\).*;\1${parent_path_of_based_eclipse};g" \
+               -e "s;\(^baseLocation=\).*;\1${reference_ide_path};g" \
+               -e "s;\(^configs=\).*;\1${archive_platform_name},${windowing},${architecture};g" \
+               -e "s;\(^buildType=\).*;\1${build_type};g" \
+               -e "s;\(^buildId=\).*;\1${build_id};g" \
+               -e "s;\(^archivePrefix=\).*;\1${build_id};g" \
+               < $build_path/build.properties.clean > $build_path/build.properties
+
+       else
+               echo "ERROR : target eclipse is not exist."
+               exit 1
+       fi
+}
+
+__execute_pde_build()
+{
+       echo "Execute Product Ant Builder..."
+       equinox_launcher=`echo org.eclipse.equinox.launcher_*.jar`
+       pde_build=`echo org.eclipse.pde.build_*`
+
+       java -jar ${reference_ide_path}/plugins/$equinox_launcher -application org.eclipse.ant.core.antRunner -buildfile ${reference_ide_path}/plugins/$pde_build/scripts/productBuild/productBuild.xml -Dbuilder=$build_path -Dosgi.locking=none 2>&1
+
+       if [ $? != 0 ];
+       then
+               echo "Build failed..."
+               exit 1
+       fi
+}
+
+__unzip_plugin_pack()
+{
+       echo "unzip to $build_result_path"
+       unzip -a $build_result_path/${result_archive_file} -d $build_result_path/${archive_platform_name}.${windowing}.${architecture}
+}
+
+build_plugins()
+{
+       case ${platform} in
+               linux)
+                       echo "build plugin for ${platform}"
+                       ;;
+               windows)
+                       echo "build plugin for ${platform}"
+                       ;;
+               *)
+                       echo "${platform} is not support yet."
+                       exit 1
+                       ;;
+       esac
+
+       __set_parameter
+       __set_build_parameter
+       __clean_build_environment
+       __copy_build_sources
+       __copy_dependency_plugins
+       __make_ant_build_properties_file
+       __execute_pde_build
+       __unzip_plugin_pack
+
+       echo "Build SUCCESS. You will find SDK IDE in \"${build_result_path}\"."
+}
+
+__clean_packaging_environment()
+{
+
+       if [ -d ${INSTALL_DIR} ]
+       then
+               rm -rf ${INSTALL_DIR}
+       else
+               mkdir -p ${INSTALL_DIR}
+       fi
+}
+
+__copy_necessary_binaries()
+{
+       echo "add necessary files."
+}
+
+packaging_plugins()
+{
+       __set_parameter
+       __set_install_parameter
+
+       __clean_packaging_environment
+       __copy_necessary_binaries
+
+       install_ide_path=${INSTALL_DIR}/${ide_root_path_name}
+       
+       if [ ! -d ${install_ide_path} ]
+       then
+               mkdir -p ${install_ide_path}
+       fi
+
+       cp -rf ${build_result_path}/${archive_platform_name}.${windowing}.${architecture}/${package_name}/* ${install_ide_path}/
+}
+
+# clean
+clean()
+{
+       echo "=========================================CLEAN============================================"
+       make clean
+       rm -rf ${SRCDIR}/*.zip
+       rm -rf ${SRCDIR}/*.tar.gz
+       rm -rf ${build_path}
+}
+
+# build
+build() 
+{
+       echo "=========================================BUILD============================================"
+       pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
+       for pkgname_and_platform in ${pkgname_and_platform_list}
+       do
+               pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
+               package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
+               platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`
+       
+               if [ "x${BUILD_TARGET_OS}" = "x${platform}" ]
+               then
+                       build_plugins
+               else
+                       echo ""
+               fi
+       done
+}
+
+# install
+install() 
+{
+       pkgname_and_platform_list=`awk 'BEGIN{RS="\n\n"; FS="\n"} /Package:/{for(i=1;i<NF;i++){if($i ~ /^OS:/){print $1,$i}}}' ${SRCDIR}/package/pkginfo.manifest | tr ' ' '@'`
+       for pkgname_and_platform in ${pkgname_and_platform_list}
+       do
+               echo "=========================================INSTALL============================================"
+               pkgname_and_platform=`echo $pkgname_and_platform | tr '@' ' '`
+               package_name=`echo ${pkgname_and_platform} | cut -f1 -d " " | cut -f2 -d ":"`
+               platform=`echo ${pkgname_and_platform} | cut -f2 -d " " | cut -f2 -d ":"`
+
+               if [ "x${BUILD_TARGET_OS}" = "x${platform}" ]
+               then
+                       packaging_plugins
+               else
+                       echo ""
+               fi
+       done    
+}
+
+[ "$1" = "clean" ] && clean
+[ "$1" = "build" ] && build
+[ "$1" = "install" ] && install
+exit 0
diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest
new file mode 100644 (file)
index 0000000..287a9a2
--- /dev/null
@@ -0,0 +1,20 @@
+Package:assignmenttracing-eplugin
+Version:1.0.2
+OS:linux
+Maintainer:Woongsik Choi <woongsik76.choi@samsung.com>, Hyukmin Kwon <hyukmin0530.kwon@samsung.com>, Wooyoung Cho <wooyoung1.cho@samsung.com>, Yoonseok Ko <ys597.ko@samsung.com>, Jaeheung Kim <jaeheung.kim@samsung.com>, Sujin Kim <sujin921.kim@samsung.com>
+Build-dependency:indigo-pde [linux], common-eplugin [linux]
+Build-host-os:linux
+Install-dependency:common-eplugin [linux], base-ide-product [linux]
+Source: assignmenttracing-eplugin
+Description: Assignment Tracing plugin
+
+Package:assignmenttracing-eplugin
+Version:1.0.2
+OS:windows
+Maintainer:Woongsik Choi <woongsik76.choi@samsung.com>, Hyukmin Kwon <hyukmin0530.kwon@samsung.com>, Wooyoung Cho <wooyoung1.cho@samsung.com>, Yoonseok Ko <ys597.ko@samsung.com>, Jaeheung Kim <jaeheung.kim@samsung.com>, Sujin Kim <sujin921.kim@samsung.com>
+Build-dependency:indigo-winpde [windows], common-eplugin [windows]
+Build-host-os:linux
+Install-dependency:common-eplugin [windows], base-ide-product [windows]
+Source: assignmenttracing-eplugin
+Description: Assignment Tracing plugin
+