Commit 67a992a2 authored by Dr. Michael Petter's avatar Dr. Michael Petter

init

parents
Pipeline #1206 failed with stages
in 1 second
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="lib/commons-cli-1.0.jar"/>
<classpathentry kind="lib" path="lib/jgraph.jar"/>
<classpathentry kind="lib" path="lib/jgrapht-0.5.3.jar"/>
<classpathentry kind="lib" path="lib/cfgstructure.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Analysator</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<project name="PolyInvar" default ="shared" basedir=".">
<property name="lib" location="lib" />
<property name="src" location="src" />
<property name="classes" location="bin" />
<property name="dist" location="dist"/>
<property name="etc" location="etc" />
<property name="images" location="images" />
<property name="tools" location="tools" />
<property name="plugins" location="/opt/eclipse-2.1.2/plugins" />
<property name="java" location="java"/>
<property name="jflex" location="jflex"/>
<property name="docs" location="docs"/>
<property environment="env" />
<path id="sources">
<fileset dir="${src}">
<include name="**/**.java" />
</fileset>
</path>
<path id="libraries">
<pathelement location="${classes}" />
<pathelement location="${lib}" />
<fileset dir="${lib}">
<include name="**/*.jar" />
<include name="**/*.zip" />
</fileset>
<!-- here, we include all necessary libraries -->
<!--fileset dir="${plugins}">
<include name="**/*.jar" />
</fileset-->
<pathelement path="${java.class.path}" />
</path>
<path id="tools">
<fileset dir="${tools}">
<include name="**/*.jar" />
<include name="**/*.zip" />
</fileset>
<pathelement path="${java.class.path}" />
</path>
<!-- taskdef JFlex -->
<taskdef name="jflex"
classname="JFlex.anttask.JFlexTask"
classpathref="tools"
/>
<!-- initialize the workspace -->
<target name="init">
<mkdir dir="${classes}" />
<mkdir dir="${dist}" />
<mkdir dir="${etc}" />
<mkdir dir="${java}" />
<mkdir dir="${docs}" />
</target>
<!-- deletes all build-related directories -->
<target name="clean">
<delete dir="${classes}" />
<delete dir="${dist}" />
<delete dir="${etc}" />
<delete dir="${java}" />
<delete dir="${docs}" />
</target>
<target name="copygen" depends="init">
<!--jflex file="${jflex}/ReverseSymtab.jflex" destdir="${java}"/>
<jflex file="${jflex}/StraightSymtab.jflex" destdir="${java}" /-->
<!--jflex file="${jflex}/Expression2Text.jflex" destdir="${java}" /-->
<copy todir="${java}"><fileset dir="${src}"/></copy>
</target>
<!-- Compiles the generated .java files to the classes directory -->
<target name="classes" depends="copygen">
<depend srcdir="${java}" destdir="${classes}" cache="${etc}" />
<javac srcdir="${java}" destdir="${classes}" verbose="off" listfiles="off"
source="1.5" target="1.5" debug="on">
<!--compilerarg value="-Xlint:unchecked" /-->
<classpath refid="libraries"/>
</javac>
</target>
<!-- Packs the runnable classes into single .jar files -->
<target name="shared" depends="classes">
<copy todir="${classes}/images"><fileset dir="${images}"/></copy>
<jar jarfile="${dist}/gui.jar" basedir="${classes}" includes="de/tum/in/wwwseidl/polyinvar/gui/**,images/**">
<manifest>
<attribute name="Main-Class" value="de.tum.in.wwwseidl.polyinvar.gui.GUI" />
<attribute name="Class-Path" value="fixpointiteration.jar cfgstructure.jar intrapoly.jar commons-cli-1.0.jar Compiler.jar" />
</manifest>
</jar>
<jar jarfile="${dist}/fixpointiteration.jar" basedir="${classes}" includes="de/tum/in/wwwseidl/polyinvar/messages/**,de/tum/in/wwwseidl/polyinvar/iterator/**" />
<copy todir="${dist}"><fileset dir="${lib}"></fileset></copy>
<!--signjar jar="${dist}/${ant.project.name}-static-${DSTAMP}.jar" alias="petter" keypass="hashen" storepass="hashen"/-->
</target>
<!-- Generates the API Documentation -->
<target name="javadoc">
<javadoc packagenames="de.tum.in.wwwseidl.polyinvar.iterator.*"
sourcepath="${src}" destdir="${docs}" windowtitle="Fixpoint Iteration API"
use="true" classpathref="libraries" linksource="yes">
<!--taglet name="ru.k2s.sam.gdk.taglet.ExampleTaglet"><path refid="tools" /></taglet-->
<doctitle><![CDATA[<h1>Fixpoint Iteration API</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright &#169; 2005 Michael Petter and Andrea
Flexeder, Chair Seidl, TU M&uuml;nchen. All Rights
Reserved.</i>]]></bottom>
<link href="http://java.sun.com/j2se/1.5.0/docs/api" />
<link href="../../cfgstructure/docs" />
</javadoc>
<copy file="${tools}/stylesheet.css" overwrite="true" todir="${docs}" />
</target>
<target name="run" depends="shared">
<java classname="de.tum.in.wwwseidl.polyinvar.gui.GUI" fork="true">
<classpath refid="libraries" />
<jvmarg value="-Dcom.sun.management.jmxremote"/>
<!--jvmarg value="-Dcom.sun.management.jmxremote"/-->
<!--assertions><enable /></assertions-->
</java>
</target>
<target name="debug" depends="shared">
<java classname="de.tum.in.wwwseidl.polyinvar.gui.GUI" fork="true">
<classpath refid="libraries" />
<jvmarg value="-Dcom.sun.management.jmxremote"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=y"/>
<assertions><enable /></assertions>
</java>
</target>
<!-- build the whole project -->
<target name="all" depends="clean,shared" />
</project>
package de.tum.in.wwwseidl.polyinvar.gui;
import de.tum.in.wwwseidl.programanalysis.cfg.SymbolTable;
import java.io.StringReader;
import java.io.IOException;
%%
%class Expression2Text
%public
%unicode
%standalone
%type String
%eofval{
return "";
%eofval}
%{
private SymbolTable symtab;
public Expression2Text(String input, SymbolTable symtab){
this.symtab = symtab;
this.yy_reader = new StringReader(input);
}
public static String convertToText(String input, SymbolTable symtab){
StringBuffer sb = new StringBuffer();
Expression2Text ss = new Expression2Text(input,symtab);
try {
while (!ss.yy_atEOF) {
String s = ss.yylex();
if (s==null) return null;
sb.append(s);
}
}catch (IOException ioe) {};
return sb.toString();
}
%}
%%
"(Variable: #" [0-9]+ ")" {
String text = yytext();
return symtab.getName(Integer.parseInt(text.substring(12,text.length()-1)));
}
.|\n { return yytext(); }
(require 'bs)
(global-set-key [C-tab] 'bs-cycle-next)
(global-set-key [C-M-tab] 'bs-cycle-previous)
This diff is collapsed.
This diff is collapsed.
package de.tum.in.wwwseidl.polyinvar.gui;
import de.tum.in.wwwseidl.programanalysis.cfg.*;
import de.tum.in.wwwseidl.programanalysis.cfg.expression.*;
import de.tum.in.wwwseidl.programanalysis.cfg.edges.*;
import java.util.Map;
import java.util.Set;
import java.util.HashMap;
import java.util.HashSet;
import de.tum.in.wwwseidl.invar.utils.AnnotatingSymbolFactory.ExtendedLocation;
public class Labelfinder extends AbstractCFGVisitor{
private Set<CFGState> memory = new HashSet<CFGState>();
private Map<Integer,CFGState> map = new HashMap<Integer,CFGState>();
public static Map<Integer,CFGState> labels(CFGClass c){
Labelfinder f = new Labelfinder();
for (CFGMethode m : c){
f.enter(m.getBegin());
}
f.fullAnalysis();
return f.map;
}
private Labelfinder(){
super(true);
}
public boolean visit(CFGState s){
if (memory.contains(s)) return false;
if (s.getAnnotation("__label")!=null){
map.put(((ExtendedLocation)s.getAnnotation("__location")).getOffset(),s);
}
memory.add(s);
return true;
}
}
package de.tum.in.wwwseidl.polyinvar.gui;
import java.util.Map;
import java.util.HashMap;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.Popup;
import javax.swing.PopupFactory;
import javax.swing.BorderFactory;
import de.tum.in.wwwseidl.programanalysis.cfg.Analyzable;
import de.tum.in.wwwseidl.programanalysis.cfg.Annotatable;
import de.tum.in.wwwseidl.programanalysis.cfg.CFGMethode;
import de.tum.in.wwwseidl.programanalysis.cfg.CFGState;
import de.tum.in.wwwseidl.programanalysis.cfg.edges.CFGEdge;
import de.tum.in.wwwseidl.polyinvar.gui.graphdisplay.GraphNode;
import de.tum.in.wwwseidl.polyinvar.gui.graphdisplay.GraphEdge;
import de.tum.in.wwwseidl.invar.utils.AnnotatingSymbolFactory.ExtendedLocation;
import de.tum.in.wwwseidl.polyinvar.iterator.gui.InitializationDialog;
public class RemoteControl implements de.tum.in.wwwseidl.polyinvar.iterator.RemoteControl {
private Map<CFGMethode,GraphPanel> meth2GP;
private long waitTime = 500;
private Popup pop;
private JTextArea jta;
private GUI gui;
public RemoteControl(Map<CFGMethode,GraphPanel> meth2GP,JTextArea jta,GUI gui){
this.meth2GP=meth2GP;
this.jta=jta;
this.gui=gui;
}
public void setWait(long timeInMSec){
waitTime=timeInMSec;
}
public long getWaitTime(){
return waitTime;
}
public void frame(CFGState s, Color c){
GraphNode g = get(s);
if (g!=null) g.frame(c.awtColor());
}
public void restoreFrame(CFGState s){
GraphNode g = get(s);
if (g!=null) g.restoreFrame();
}
public void background(CFGState s, Color c){
GraphNode g = get(s);
if (g!=null) g.background(c.awtColor());
}
public void restoreBackground(CFGState s){
GraphNode g = get(s);
if (g!=null) g.restoreBackground();
}
public void restore(Analyzable a){
restoreHighlight(a);
if (a instanceof CFGState) {
restoreBackground((CFGState) a);
restoreFrame((CFGState) a);
}
}
public void restoreHighlight(Analyzable a){
if (a instanceof CFGState) {
GraphNode g = get((CFGState)a);
if (g!=null) g.highlight(false);
} else {
GraphEdge e = get((CFGEdge)a);
if (e!=null) e.highlight(false);
}
if (pop!=null) pop.hide();
}
public void highlight(Analyzable a, Color c){
if (a instanceof CFGState) {
GraphNode g = get((CFGState)a);
if (g!=null) g.highlight(c.awtColor());
} else {
GraphEdge e = get((CFGEdge)a);
if (e!=null) e.highlight(c.awtColor());
}
}
public void annotate(Analyzable a,Color c,Object message){
if (a instanceof CFGState) {
GraphNode g = get((CFGState)a);
if (g!=null) {
pop(g,c.awtColor(),message);
}
} else {
GraphEdge e = get((CFGEdge)a);
if (e!=null) {
pop(e.getComponent(),c.awtColor(),message);
}
}
}
public void gotoSource(Annotatable a){
ExtendedLocation l = null;
ExtendedLocation r = null;
if (a instanceof CFGEdge) {
l = ((ExtendedLocation)a.getAnnotation("__location_left"));
r = ((ExtendedLocation)a.getAnnotation("__location_right"));
}
if (a instanceof CFGState) {
l = ((ExtendedLocation)a.getAnnotation("__location"));
r = ((ExtendedLocation)a.getAnnotation("__location"));
}
if (l==null) {
if (r==null){
System.err.println("There is no location information available");
return;
}
l = r;
}
if (r==null) { r = l; }
int begin = l.getOffset();//+l.getLine();
int end = r.getOffset();//+r.getLine();
gui.highlightPosition(begin,end);
}
public void highlight(Analyzable a, Color c, Object message){
highlight(a,c);
annotate(a,c,message);
}
public void message(String message){
jta.append(message+"\n");
}
private void pop(Component c, java.awt.Color col, Object message){
if (!c.isShowing()) {
System.err.println("Warning: Component is not visible");
return;
}
int x = c.getLocationOnScreen().x + c.getWidth()-4;
int y = c.getLocationOnScreen().y + c.getHeight()/2;
JLabel l = new JLabel(message.toString());
l.setBorder(BorderFactory.createLineBorder(col));
if (pop!=null) pop.hide();
pop = PopupFactory.getSharedInstance().getPopup(c,l,x,y);
pop.show();
}
private GraphNode get(CFGState s){
for (CFGMethode m : meth2GP.keySet()){
if (m.contains(s)) {
return meth2GP.get(m).get(s);
}
}
return null;
}
private GraphEdge get(CFGEdge s){
if (s==null) return null;
for (CFGMethode m : meth2GP.keySet()){
if (m.contains(s.getSource())) {
return meth2GP.get(m).get(s);
}
}
return null;
}
public void worklistadd(Analyzable where){
gui.updateWorklist();
}
public void worklistremove(Analyzable where){
gui.updateWorklist();
}
public void resetControls(){
gui.refreshButtons();
}
public <T> T initialize(T in){
InitializationDialog id = new InitializationDialog(in);
id.pack();
id.setVisible(true);
return in;
}
}
package de.tum.in.wwwseidl.polyinvar.gui.graphdisplay;
import java.awt.Color;
import java.awt.Component;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D;
import javax.swing.JLabel;
import javax.swing.JViewport;
import java.util.Map;
import de.tum.in.wwwseidl.polyinvar.gui.graphlayout.Edge;
import de.tum.in.wwwseidl.programanalysis.cfg.edges.CFGEdge;
import de.tum.in.wwwseidl.programanalysis.cfg.CFGState;
public class GraphEdge implements Edge {
private Color highlightColor;
private CFGEdge opcode;
private Component repainter;
private boolean highlight=false;
public JLabel label;
private Point labelLocation;
private Shape arrowLine;
private Shape arrowHead;
private boolean rightAlign;
private Map<CFGState,GraphNode> mapping;
public GraphEdge(CFGEdge opcode, Map<CFGState,GraphNode> mapping){
this.opcode=opcode;