• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kjs
 

kjs

  • kjs
debugger.cpp
1 // -*- c-basic-offset: 2 -*-
2 /*
3  * This file is part of the KDE libraries
4  * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
5  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  *
21  */
22 
23 #include "debugger.h"
24 #include "value.h"
25 #include "object.h"
26 #include "types.h"
27 #include "interpreter.h"
28 #include "internal.h"
29 #include "ustring.h"
30 
31 using namespace KJS;
32 
33 // ------------------------------ Debugger -------------------------------------
34 
35 namespace KJS {
36  struct AttachedInterpreter
37  {
38  public:
39  AttachedInterpreter(Interpreter *i) : interp(i), next(0L) {}
40  Interpreter *interp;
41  AttachedInterpreter *next;
42  };
43 
44 }
45 
46 Debugger::Debugger()
47 {
48  rep = new DebuggerImp();
49 }
50 
51 Debugger::~Debugger()
52 {
53  // detach from all interpreters
54  while (rep->interps)
55  detach(rep->interps->interp);
56 
57  delete rep;
58 }
59 
60 void Debugger::attach(Interpreter *interp)
61 {
62  if (interp->imp()->debugger() != this)
63  interp->imp()->setDebugger(this);
64 
65  // add to the list of attached interpreters
66  if (!rep->interps)
67  rep->interps = new AttachedInterpreter(interp);
68  else {
69  AttachedInterpreter *ai = rep->interps;
70  while (ai->next) {
71  if (ai->interp == interp)
72  return; // already in list
73  ai = ai->next;
74  }
75  ai->next = new AttachedInterpreter(interp);
76  }
77 }
78 
79 void Debugger::detach(Interpreter *interp)
80 {
81  if (interp->imp()->debugger() == this)
82  interp->imp()->setDebugger(0L);
83 
84  if (!rep->interps)
85  return;
86  // remove from the list of attached interpreters
87  if (rep->interps->interp == interp) {
88  AttachedInterpreter *old = rep->interps;
89  rep->interps = rep->interps->next;
90  delete old;
91  }
92 
93  AttachedInterpreter *ai = rep->interps;
94  if (!ai)
95  return;
96  while (ai->next && ai->next->interp != interp)
97  ai = ai->next;
98  if (ai->next) {
99  AttachedInterpreter *old = ai->next;
100  ai->next = ai->next->next;
101  delete old;
102  }
103 }
104 
105 bool Debugger::sourceParsed(ExecState * /*exec*/, int /*sourceId*/,
106  const UString &/*source*/, int /*errorLine*/)
107 {
108  return true;
109 }
110 
111 bool Debugger::sourceUnused(ExecState * /*exec*/, int /*sourceId*/)
112 {
113  return true;
114 }
115 
116 bool Debugger::exception(ExecState * /*exec*/, const Value &/*value*/,
117  bool /*inTryCatch*/)
118 {
119  return true;
120 }
121 
122 bool Debugger::atStatement(ExecState * /*exec*/)
123 {
124  return true;
125 }
126 
127 bool Debugger::enterContext(ExecState * /*exec*/)
128 {
129  return true;
130 }
131 
132 bool Debugger::exitContext(ExecState * /*exec*/, const Completion &/*completion*/)
133 {
134  return true;
135 }
KJS::Completion
Completion objects are used to convey the return status and value from functions.
Definition: completion.h:49
KJS::ExecState
Represents the current state of script execution.
Definition: interpreter.h:439
KJS::Interpreter
Interpreter objects can be used to evaluate ECMAScript code.
Definition: interpreter.h:173
KJS::UString
Unicode string class.
Definition: ustring.h:190
KJS::Value
Value objects are act as wrappers ("smart pointers") around ValueImp objects and their descendents.
Definition: value.h:168
KStdAccel::next
const KShortcut & next()

kjs

Skip menu "kjs"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kjs

Skip menu "kjs"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kjs by doxygen 1.9.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |