Commit c8d6a6b0 authored by michael.kirsten's avatar michael.kirsten
Browse files

Removed annoying sysout messages.

parent bf35f666
No preview for this file type
This diff is collapsed.
//Calculate the factorial of k recursively. //Calculate the factorial of k recursively.
//other functions must be declared before the main
int fac(int k) { int fac(int k) {
if (k <= 1) if (k <= 1)
return 1; return 1;
int res; int res;
res = fac(k-1); res = fac(k-1);
...@@ -9,7 +8,6 @@ int fac(int k) { ...@@ -9,7 +8,6 @@ int fac(int k) {
return res; return res;
} }
//every program needs a main method
int main(int k) { int main(int k) {
int res; int res;
res = fac(k); res = fac(k);
......
...@@ -20,7 +20,7 @@ import dibugger.debuglogic.interpreter.WatchExpression; ...@@ -20,7 +20,7 @@ import dibugger.debuglogic.interpreter.WatchExpression;
* Heart of the Debug-Logic. The logic for start / stop / continue and all steps * Heart of the Debug-Logic. The logic for start / stop / continue and all steps
* is in this class. Additionally the creation of breakpoints and watch * is in this class. Additionally the creation of breakpoints and watch
* expressions is handled here. * expressions is handled here.
* *
* @author Pascal * @author Pascal
* *
*/ */
...@@ -61,7 +61,7 @@ public class DebugControl { ...@@ -61,7 +61,7 @@ public class DebugControl {
list_traceIterator = new ArrayList<ListIterator<TraceState>>(); list_traceIterator = new ArrayList<ListIterator<TraceState>>();
list_currentTraceStates = new ArrayList<TraceState>(); list_currentTraceStates = new ArrayList<TraceState>();
list_lastTraceStates = new ArrayList<TraceState>(); list_lastTraceStates = new ArrayList<TraceState>();
list_programInput = new ArrayList<ProgramInput>(); list_programInput = new ArrayList<ProgramInput>();
list_stepSize = new ArrayList<Integer>(); list_stepSize = new ArrayList<Integer>();
...@@ -72,7 +72,7 @@ public class DebugControl { ...@@ -72,7 +72,7 @@ public class DebugControl {
/** /**
* Launches the Debug Mode with a given List of programs. * Launches the Debug Mode with a given List of programs.
* *
* @param programs * @param programs
* the programs to run * the programs to run
* @throws DIbuggerLogicException * @throws DIbuggerLogicException
...@@ -89,7 +89,7 @@ public class DebugControl { ...@@ -89,7 +89,7 @@ public class DebugControl {
ListIterator<TraceState> generatedTrace; ListIterator<TraceState> generatedTrace;
try { try {
generatedTrace = generationController.generateTrace(pi.getText(), pi.getInputValues(), pi.getProgramID()); generatedTrace = generationController.generateTrace(pi.getText(), pi.getInputValues(), pi.getProgramID());
}catch(DIbuggerLogicException e) { }catch(DIbuggerLogicException e) {
throw new DIbuggerLogicException(e,"Program "+pi.getProgramID()+": "+ e.getMessage()); throw new DIbuggerLogicException(e,"Program "+pi.getProgramID()+": "+ e.getMessage());
} }
list_traceIterator.add(generatedTrace); list_traceIterator.add(generatedTrace);
...@@ -108,7 +108,7 @@ public class DebugControl { ...@@ -108,7 +108,7 @@ public class DebugControl {
/** /**
* Synchronizes the ProgramInput with a given Programinput List * Synchronizes the ProgramInput with a given Programinput List
* *
* @param programs * @param programs
* the list containing all new programs * the list containing all new programs
*/ */
...@@ -119,7 +119,7 @@ public class DebugControl { ...@@ -119,7 +119,7 @@ public class DebugControl {
/** /**
* Executes a step defined by a given step type. * Executes a step defined by a given step type.
* *
* @param type * @param type
* the type of the step * the type of the step
* (STEP_NORMAL,STEP_OVER,STEP_OUT,STEP_BACK) * (STEP_NORMAL,STEP_OVER,STEP_OUT,STEP_BACK)
...@@ -192,7 +192,7 @@ public class DebugControl { ...@@ -192,7 +192,7 @@ public class DebugControl {
/** /**
* Executes a normal step in a given program with size 1 * Executes a normal step in a given program with size 1
* *
* @param programID * @param programID
* the program to do a step * the program to do a step
*/ */
...@@ -228,7 +228,7 @@ public class DebugControl { ...@@ -228,7 +228,7 @@ public class DebugControl {
/** /**
* Executes a single step without evaluating breakpoints * Executes a single step without evaluating breakpoints
* *
* @param programID * @param programID
*/ */
private boolean singleStepNoEvaluation(int programID, int direction) { private boolean singleStepNoEvaluation(int programID, int direction) {
...@@ -280,7 +280,7 @@ public class DebugControl { ...@@ -280,7 +280,7 @@ public class DebugControl {
/** /**
* Creates a new watch expression * Creates a new watch expression
* *
* @param id * @param id
* the id of the watch expression * the id of the watch expression
* @param expr * @param expr
...@@ -288,7 +288,7 @@ public class DebugControl { ...@@ -288,7 +288,7 @@ public class DebugControl {
* @throws DIbuggerLogicException * @throws DIbuggerLogicException
*/ */
public void createWatchExpression(int id, String expr) throws DIbuggerLogicException { public void createWatchExpression(int id, String expr) throws DIbuggerLogicException {
System.out.println("Add watch expression: "+id+" "+expr); // System.out.println("Add watch expression: "+id+" "+expr);
while (list_watchExpressions.size() - 1 < id) { while (list_watchExpressions.size() - 1 < id) {
list_watchExpressions.add(null); list_watchExpressions.add(null);
} }
...@@ -297,7 +297,7 @@ public class DebugControl { ...@@ -297,7 +297,7 @@ public class DebugControl {
/** /**
* changes the watch expression with a given id * changes the watch expression with a given id
* *
* @param id * @param id
* the id of the watch expression to change * the id of the watch expression to change
* @param expr * @param expr
...@@ -307,7 +307,7 @@ public class DebugControl { ...@@ -307,7 +307,7 @@ public class DebugControl {
* @throws DIbuggerLogicException * @throws DIbuggerLogicException
*/ */
public void changeWatchExpression(int id, String expr, List<ScopeTuple> scopes) throws DIbuggerLogicException { public void changeWatchExpression(int id, String expr, List<ScopeTuple> scopes) throws DIbuggerLogicException {
//System.out.println("Change watch expression: "+id+" to "+expr); // System.out.println("Change watch expression: "+id+" to "+expr);
if (id < list_watchExpressions.size()) { if (id < list_watchExpressions.size()) {
WatchExpression e = list_watchExpressions.get(id); WatchExpression e = list_watchExpressions.get(id);
if (e != null) { if (e != null) {
...@@ -322,12 +322,12 @@ public class DebugControl { ...@@ -322,12 +322,12 @@ public class DebugControl {
/** /**
* Deletes the watch expression with a given id * Deletes the watch expression with a given id
* *
* @param id * @param id
* the id of the watch expression * the id of the watch expression
*/ */
public void deleteWatchExpression(int id) { public void deleteWatchExpression(int id) {
System.out.println("Remove watch expression: "+id); // System.out.println("Remove watch expression: "+id);
if (id == list_watchExpressions.size() - 1) { if (id == list_watchExpressions.size() - 1) {
list_watchExpressions.remove(id); list_watchExpressions.remove(id);
} else { } else {
...@@ -344,7 +344,7 @@ public class DebugControl { ...@@ -344,7 +344,7 @@ public class DebugControl {
/** /**
* creates a new conditional breakpoint * creates a new conditional breakpoint
* *
* @param id * @param id
* the id of the breakpoint * the id of the breakpoint
* @param cond * @param cond
...@@ -360,7 +360,7 @@ public class DebugControl { ...@@ -360,7 +360,7 @@ public class DebugControl {
/** /**
* changes the conditional breakpoint with a given id * changes the conditional breakpoint with a given id
* *
* @param id * @param id
* the id of the breakpoint to change * the id of the breakpoint to change
* @param cond * @param cond
...@@ -384,7 +384,7 @@ public class DebugControl { ...@@ -384,7 +384,7 @@ public class DebugControl {
/** /**
* deletes the breakpoint with a given id * deletes the breakpoint with a given id
* *
* @param id * @param id
* the id of the breakpoint * the id of the breakpoint
*/ */
...@@ -405,7 +405,7 @@ public class DebugControl { ...@@ -405,7 +405,7 @@ public class DebugControl {
/** /**
* creates a new breakpoint in a given program and line * creates a new breakpoint in a given program and line
* *
* @param program * @param program
* the programID to create the breakpoint in * the programID to create the breakpoint in
* @param line * @param line
...@@ -420,7 +420,7 @@ public class DebugControl { ...@@ -420,7 +420,7 @@ public class DebugControl {
/** /**
* deletes a breakpoint in a given proogram and line * deletes a breakpoint in a given proogram and line
* *
* @param program * @param program
* the program to search in * the program to search in
* @param line * @param line
...@@ -454,11 +454,11 @@ public class DebugControl { ...@@ -454,11 +454,11 @@ public class DebugControl {
list_watchExpressions.clear(); list_watchExpressions.clear();
list_condBreakpoints.clear(); list_condBreakpoints.clear();
list_currentTraceStates.clear(); list_currentTraceStates.clear();
maxIterations = DEF_IT; maxIterations = DEF_IT;
maxFunctionCalls = DEF_MAX_FUNC_CALLS; maxFunctionCalls = DEF_MAX_FUNC_CALLS;
} }
public void endRun(){ public void endRun(){
if(list_currentTraceStates.size()>0){ if(list_currentTraceStates.size()>0){
list_lastTraceStates.clear(); list_lastTraceStates.clear();
...@@ -469,7 +469,7 @@ public class DebugControl { ...@@ -469,7 +469,7 @@ public class DebugControl {
/** /**
* Sets the stepsize of a program * Sets the stepsize of a program
* *
* @param programID * @param programID
* the program to change the stepsize * the program to change the stepsize
* @param stepSize * @param stepSize
...@@ -485,7 +485,7 @@ public class DebugControl { ...@@ -485,7 +485,7 @@ public class DebugControl {
/** /**
* Getter for the current programCounter of all programs * Getter for the current programCounter of all programs
* *
* @return a list of integers representing all programCounters * @return a list of integers representing all programCounters
*/ */
public List<Integer> getProgramCounter() { public List<Integer> getProgramCounter() {
...@@ -498,7 +498,7 @@ public class DebugControl { ...@@ -498,7 +498,7 @@ public class DebugControl {
/** /**
* Getter for the current line of all programs * Getter for the current line of all programs
* *
* @return a list countaining the current execution line of all programs * @return a list countaining the current execution line of all programs
*/ */
public Map<String, Integer> getCurrentExecutionLines() { public Map<String, Integer> getCurrentExecutionLines() {
...@@ -512,7 +512,7 @@ public class DebugControl { ...@@ -512,7 +512,7 @@ public class DebugControl {
/** /**
* Sets the maximum iteration count for loops (example: while loop) * Sets the maximum iteration count for loops (example: while loop)
* *
* @param count * @param count
* the new maximum value * the new maximum value
*/ */
...@@ -521,16 +521,16 @@ public class DebugControl { ...@@ -521,16 +521,16 @@ public class DebugControl {
} }
/** /**
* *
* @return max interations the debugcontrol * @return max interations the debugcontrol
*/ */
public int getMaxIterations(){ public int getMaxIterations(){
return maxIterations; return maxIterations;
} }
/** /**
* Sets the maximum iteration count for recursive function calls * Sets the maximum iteration count for recursive function calls
* *
* @param count * @param count
* the new maximum value * the new maximum value
*/ */
...@@ -539,16 +539,16 @@ public class DebugControl { ...@@ -539,16 +539,16 @@ public class DebugControl {
} }
/** /**
* *
* @return max function calls of the debugcontrol * @return max function calls of the debugcontrol
*/ */
public int getMaxFunctionCalls(){ public int getMaxFunctionCalls(){
return maxFunctionCalls; return maxFunctionCalls;
} }
// Getter // Getter
/** /**
* *
* @return the amount of conditional breakpoints * @return the amount of conditional breakpoints
*/ */
public int getWatchExpressionSize() { public int getWatchExpressionSize() {
...@@ -556,7 +556,7 @@ public class DebugControl { ...@@ -556,7 +556,7 @@ public class DebugControl {
} }
/** /**
* *
* @return a list containing all expression of the watch expressions * @return a list containing all expression of the watch expressions
*/ */
public List<String> getWatchExpressions() { public List<String> getWatchExpressions() {
...@@ -572,10 +572,10 @@ public class DebugControl { ...@@ -572,10 +572,10 @@ public class DebugControl {
} }
return l; return l;
} }
/** /**
* Getter for the Scope Begin of a given Watch Expression * Getter for the Scope Begin of a given Watch Expression
* *
* @param expressionID * @param expressionID
* the id of the expression * the id of the expression
* @return a List containing all Scope begins for the given watch * @return a List containing all Scope begins for the given watch
...@@ -583,13 +583,13 @@ public class DebugControl { ...@@ -583,13 +583,13 @@ public class DebugControl {
*/ */
public List<Integer> getWEScopeBegin(int expressionID) { public List<Integer> getWEScopeBegin(int expressionID) {
List<Integer> l = new ArrayList<Integer>(); List<Integer> l = new ArrayList<Integer>();
System.out.println("Get Expression: "+expressionID); // System.out.println("Get Expression: "+expressionID);
System.out.println("From: "+list_watchExpressions); // System.out.println("From: "+list_watchExpressions);
if(list_watchExpressions.get(expressionID)!=null) { if(list_watchExpressions.get(expressionID)!=null) {
for (ScopeTuple it : list_watchExpressions.get(expressionID).getScopes()) { for (ScopeTuple it : list_watchExpressions.get(expressionID).getScopes()) {
l.add(it.getStartLine()); l.add(it.getStartLine());
} }
} }
if (l.size() == 0) { if (l.size() == 0) {
for (int i = 0; i < numPrograms; ++i) { for (int i = 0; i < numPrograms; ++i) {
l.add(1); l.add(1);
...@@ -600,7 +600,7 @@ public class DebugControl { ...@@ -600,7 +600,7 @@ public class DebugControl {
/** /**
* Getter for the Scope End of a given Watch Expression * Getter for the Scope End of a given Watch Expression
* *
* @param expressionID * @param expressionID
* the id of the expression * the id of the expression
* @return a List containing all Scope ends for the given watch expression. * @return a List containing all Scope ends for the given watch expression.
...@@ -611,7 +611,7 @@ public class DebugControl { ...@@ -611,7 +611,7 @@ public class DebugControl {
for (ScopeTuple it : list_watchExpressions.get(expressionID).getScopes()) { for (ScopeTuple it : list_watchExpressions.get(expressionID).getScopes()) {
l.add(it.getEndLine()); l.add(it.getEndLine());
} }
} }
if (l.size() == 0) { if (l.size() == 0) {
for (int i = 0; i < numPrograms; ++i) { for (int i = 0; i < numPrograms; ++i) {
l.add(list_programInput.get(i).getText().split("\n").length); l.add(list_programInput.get(i).getText().split("\n").length);
...@@ -622,7 +622,7 @@ public class DebugControl { ...@@ -622,7 +622,7 @@ public class DebugControl {
/** /**
* Getter for the value of a watch expression * Getter for the value of a watch expression
* *
* @param expressionID * @param expressionID
* the id of the expression * the id of the expression
* @return the current Value of the expression * @return the current Value of the expression
...@@ -637,7 +637,7 @@ public class DebugControl { ...@@ -637,7 +637,7 @@ public class DebugControl {
} }
/** /**
* *
* @return the amount of conditional breakpoints * @return the amount of conditional breakpoints
*/ */
public int getConditionalBreakpointSize() { public int getConditionalBreakpointSize() {
...@@ -645,7 +645,7 @@ public class DebugControl { ...@@ -645,7 +645,7 @@ public class DebugControl {
} }
/** /**
* *
* @return a list containing all conditions of the conditional breakpoints * @return a list containing all conditions of the conditional breakpoints
*/ */
public List<String> getConditionalBreakpoints() { public List<String> getConditionalBreakpoints() {
...@@ -664,7 +664,7 @@ public class DebugControl { ...@@ -664,7 +664,7 @@ public class DebugControl {
/** /**
* Getter for the Scope Begin of a given Conditional Breakpoint * Getter for the Scope Begin of a given Conditional Breakpoint
* *
* @param expressionID * @param expressionID
* the id of the expression * the id of the expression
* @return a List containing all Scope begins for the given conditional * @return a List containing all Scope begins for the given conditional
...@@ -676,7 +676,7 @@ public class DebugControl { ...@@ -676,7 +676,7 @@ public class DebugControl {
for (ScopeTuple it : list_condBreakpoints.get(expressionID).getScopes()) { for (ScopeTuple it : list_condBreakpoints.get(expressionID).getScopes()) {
l.add(it.getStartLine()); l.add(it.getStartLine());
} }
} }
if (l.size() == 0) { if (l.size() == 0) {
for (int i = 0; i < numPrograms; ++i) { for (int i = 0; i < numPrograms; ++i) {
l.add(1); l.add(1);
...@@ -687,7 +687,7 @@ public class DebugControl { ...@@ -687,7 +687,7 @@ public class DebugControl {
/** /**
* Getter for the Scope end of a given Conditional Breakpoint * Getter for the Scope end of a given Conditional Breakpoint
* *
* @param expressionID * @param expressionID
* the id of the expression * the id of the expression
* @return a List containing all Scope ends for the given conditional * @return a List containing all Scope ends for the given conditional
...@@ -699,7 +699,7 @@ public class DebugControl { ...@@ -699,7 +699,7 @@ public class DebugControl {
for (ScopeTuple it : list_condBreakpoints.get(expressionID).getScopes()) { for (ScopeTuple it : list_condBreakpoints.get(expressionID).getScopes()) {
l.add(it.getEndLine()); l.add(it.getEndLine());
} }
} }
if (l.size() == 0) { if (l.size() == 0) {
for (int i = 0; i < numPrograms; ++i) { for (int i = 0; i < numPrograms; ++i) {
l.add(list_programInput.get(i).getText().split("\n").length); l.add(list_programInput.get(i).getText().split("\n").length);
...@@ -710,7 +710,7 @@ public class DebugControl { ...@@ -710,7 +710,7 @@ public class DebugControl {
/** /**
* Getter for the value of a conditional breakpoint * Getter for the value of a conditional breakpoint
* *
* @param breakpointID * @param breakpointID
* the id of the conditional breakpoint * the id of the conditional breakpoint
* @return the current Value of the condition * @return the current Value of the condition
...@@ -727,7 +727,7 @@ public class DebugControl { ...@@ -727,7 +727,7 @@ public class DebugControl {
/** /**
* Getter for all breakpoints of a given program * Getter for all breakpoints of a given program
* *
* @param programID * @param programID
* the program id * the program id
* @return a list containing all programs of program programID * @return a list containing all programs of program programID
...@@ -745,7 +745,7 @@ public class DebugControl { ...@@ -745,7 +745,7 @@ public class DebugControl {
/** /**
* Getter for the amount of programs * Getter for the amount of programs
* *
* @return the amount of programs * @return the amount of programs
*/ */
public int getNumPrograms() {