# kjs Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | 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  */
    00022
    00023 #include "debugger.h"
    00024 #include "value.h"
    00025 #include "object.h"
    00026 #include "types.h"
    00027 #include "interpreter.h"
    00028 #include "internal.h"
    00029 #include "ustring.h"
    00030
    00031 using namespace KJS;
    00032
    00033 // ------------------------------ Debugger -------------------------------------
    00034
    00035 namespace KJS {
    00036   struct AttachedInterpreter
    00037   {
    00038   public:
    00039     AttachedInterpreter(Interpreter *i) : interp(i), next(0L) {}
    00040     Interpreter *interp;
    00041     AttachedInterpreter *next;
    00042   };
    00043
    00044 }
    00045
    00046 Debugger::Debugger()
    00047 {
    00048   rep = new DebuggerImp();
    00049 }
    00050
    00051 Debugger::~Debugger()
    00052 {
    00053   // detach from all interpreters
    00054   while (rep->interps)
    00055     detach(rep->interps->interp);
    00056
    00057   delete rep;
    00058 }
    00059
    00060 void Debugger::attach(Interpreter *interp)
    00061 {
    00062   if (interp->imp()->debugger() != this)
    00063     interp->imp()->setDebugger(this);
    00064
    00065   // add to the list of attached interpreters
    00066   if (!rep->interps)
    00067     rep->interps = new AttachedInterpreter(interp);
    00068   else {
    00069     AttachedInterpreter *ai = rep->interps;
    00070     while (ai->next)
    00071       ai = ai->next;
    00072     ai->next = new AttachedInterpreter(interp);
    00073   }
    00074 }
    00075
    00076 void Debugger::detach(Interpreter *interp)
    00077 {
    00078   if (interp->imp()->debugger() == this)
    00079     interp->imp()->setDebugger(0L);
    00080
    00081   if (!rep->interps)
    00082     return;
    00083   // remove from the list of attached interpreters
    00084   if (rep->interps->interp == interp) {
    00085     AttachedInterpreter *old = rep->interps;
    00086     rep->interps = rep->interps->next;
    00087     delete old;
    00088   }
    00089
    00090   AttachedInterpreter *ai = rep->interps;
    00091   if (!ai)
    00092     return;
    00093   while (ai->next && ai->next->interp != interp)
    00094     ai = ai->next;
    00095   if (ai->next) {
    00096     AttachedInterpreter *old = ai->next;
    00097     ai->next = ai->next->next;
    00098     delete old;
    00099   }
    00100 }
    00101
    00102 bool Debugger::sourceParsed(ExecState * /*exec*/, int /*sourceId*/,
    00103                             const UString &/*source*/, int /*errorLine*/)
    00104 {
    00105   return true;
    00106 }
    00107
    00108 bool Debugger::sourceUnused(ExecState * /*exec*/, int /*sourceId*/)
    00109 {
    00110   return true;
    00111 }
    00112
    00113 bool Debugger::exception(ExecState * /*exec*/, const Value &/*value*/,
    00114              bool /*inTryCatch*/)
    00115 {
    00116   return true;
    00117 }
    00118
    00119 bool Debugger::atStatement(ExecState * /*exec*/)
    00120 {
    00121   return true;
    00122 }
    00123
    00124 bool Debugger::enterContext(ExecState * /*exec*/)
    00125 {
    00126   return true;
    00127 }
    00128
    00129 bool Debugger::exitContext(ExecState * /*exec*/, const Completion &/*completion*/)
    00130 {
    00131   return true;
    00132 }

This file is part of the documentation for kjs Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:23:05 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003