# kjs Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# debugger.cpp

    00001 // -*- c-basic-offset: 2 -*-
    00002 /*
    00003  *  This file is part of the KDE libraries
    00004  *  Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
    00005  *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
    00006  *
    00007  *  This library is free software; you can redistribute it and/or
    00008  *  modify it under the terms of the GNU Lesser General Public
    00009  *  License as published by the Free Software Foundation; either
    00010  *  version 2 of the License, or (at your option) any later version.
    00011  *
    00012  *  This library is distributed in the hope that it will be useful,
    00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015  *  Lesser General Public License for more details.
    00016  *
    00017  *  You should have received a copy of the GNU Lesser General Public
    00018  *  License along with this library; if not, write to the Free Software
    00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00020  *
    00021  *  $Id: debugger.cpp,v 1.14 2002/06/19 08:20:59 domi Exp $
    00022  */
    00023
    00024 #include "debugger.h"
    00025 #include "value.h"
    00026 #include "object.h"
    00027 #include "types.h"
    00028 #include "interpreter.h"
    00029 #include "internal.h"
    00030 #include "ustring.h"
    00031
    00032 using namespace KJS;
    00033
    00034 // ------------------------------ Debugger -------------------------------------
    00035
    00036 namespace KJS {
    00037   struct AttachedInterpreter
    00038   {
    00039   public:
    00040     AttachedInterpreter(Interpreter *i) : interp(i), next(0L) {}
    00041     Interpreter *interp;
    00042     AttachedInterpreter *next;
    00043   };
    00044
    00045 }
    00046
    00047 Debugger::Debugger()
    00048 {
    00049   rep = new DebuggerImp();
    00050 }
    00051
    00052 Debugger::~Debugger()
    00053 {
    00054   // detach from all interpreters
    00055   while (rep->interps)
    00056     detach(rep->interps->interp);
    00057
    00058   delete rep;
    00059 }
    00060
    00061 void Debugger::attach(Interpreter *interp)
    00062 {
    00063   if (interp->imp()->debugger() != this)
    00064     interp->imp()->setDebugger(this);
    00065
    00066   // add to the list of attached interpreters
    00067   if (!rep->interps)
    00068     rep->interps = new AttachedInterpreter(interp);
    00069   else {
    00070     AttachedInterpreter *ai = rep->interps;
    00071     while (ai->next)
    00072       ai = ai->next;
    00073     ai->next = new AttachedInterpreter(interp);;
    00074   }
    00075 }
    00076
    00077 void Debugger::detach(Interpreter *interp)
    00078 {
    00079   if (interp->imp()->debugger() == this)
    00080     interp->imp()->setDebugger(0L);
    00081
    00082   if (!rep->interps)
    00083     return;
    00084   // remove from the list of attached interpreters
    00085   if (rep->interps->interp == interp) {
    00086     AttachedInterpreter *old = rep->interps;
    00087     rep->interps = rep->interps->next;
    00088     delete old;
    00089   }
    00090
    00091   AttachedInterpreter *ai = rep->interps;
    00092   if (!ai)
    00093     return;
    00094   while (ai->next && ai->next->interp != interp)
    00095     ai = ai->next;
    00096   if (ai->next) {
    00097     AttachedInterpreter *old = ai->next;
    00098     ai->next = ai->next->next;
    00099     delete old;
    00100   }
    00101 }
    00102
    00103 bool Debugger::sourceParsed(ExecState */*exec*/, int /*sourceId*/,
    00104                             const UString &/*source*/, int /*errorLine*/)
    00105 {
    00106   return true;
    00107 }
    00108
    00109 bool Debugger::sourceUnused(ExecState */*exec*/, int /*sourceId*/)
    00110 {
    00111   return true;
    00112 }
    00113
    00114 bool Debugger::exception(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/,
    00115                          Object &/*exceptionObj*/)
    00116 {
    00117   return true;
    00118 }
    00119
    00120 bool Debugger::atStatement(ExecState */*exec*/, int /*sourceId*/, int /*firstLine*/,
    00121                            int /*lastLine*/)
    00122 {
    00123   return true;
    00124 }
    00125
    00126 bool Debugger::callEvent(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/,
    00127                          Object &/*function*/, const List &/*args*/)
    00128 {
    00129   return true;
    00130 }
    00131
    00132 bool Debugger::returnEvent(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/,
    00133                            Object &/*function*/)
    00134 {
    00135   return true;
    00136 }
    00137

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:08:20 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001