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

kjs

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