1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
|
/***************************************************************************
xsldbgevent.c - event to notify app of
data from xsldbg
-------------------
begin : Fri Feb 1 2001
copyright : (C) 2001 by Keith Isdale
email : k_isdale@tpg.com.au
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <tqapplication.h>
#include <tqtimer.h>
#include <tqfile.h>
#include <kurl.h>
#include <tqtextstream.h>
#include <libxslt/xsltInternals.h>
#include "../libxsldbg/xsldbgevent.h"
#include "xsldbgdebuggerbase.h"
#include "../libxsldbg/arraylist.h"
#include "../libxsldbg/breakpoint.h"
#include "../libxsldbg/xsldbgmsg.h"
#include "../libxsldbg/xsldbgthread.h"
#include "../libxsldbg/options.h"
#include "../libxsldbg/files.h"
TQString updateText;
XsldbgEventData::XsldbgEventData()
{
int column;
for (column = 0; column < XSLDBGEVENT_COLUMNS; column++){
textValues[column] = TQString::null;
}
for (column = 0; column < XSLDBGEVENT_COLUMNS; column++){
intValues[column] = -1;
}
}
XsldbgEventData::~XsldbgEventData()
{
}
void XsldbgEventData::setText(int column, TQString text)
{
if ((column >= 0) && (column < XSLDBGEVENT_COLUMNS))
textValues[column] = text;
}
TQString XsldbgEventData::getText(int column)
{
if ((column >= 0) && (column < XSLDBGEVENT_COLUMNS))
return textValues[column];
else
return TQString::null;
}
void XsldbgEventData::setInt(int column, int value)
{
if ((column >= 0) && (column < XSLDBGEVENT_COLUMNS))
intValues[column] = value;
}
int XsldbgEventData::getInt(int column)
{
if ((column >= 0) && (column < XSLDBGEVENT_COLUMNS))
return intValues[column];
else
return -1;
}
XsldbgEvent::XsldbgEvent(XsldbgMessageEnum type, const void *data)
: TQEvent(TQEvent::User)
{
XsldbgEventData *eventData;
this->data = data;
debugger = 0L;
beenCreated = false;
if (type == XSLDBG_MSG_LIST){ /* 23 : As list of messages */
notifyMessageListPtr msgList = (notifyMessageListPtr)data;
void *msgData;
/* If this is an included source message, which just continues a source message,
we don't need to add an empty XsldbgEventData */
if (msgList->type != XSLDBG_MSG_INCLUDED_SOURCE_CHANGED){
/* add an empty event data item which indicates the start of a list */
eventData = new XsldbgEventData();
if (eventData != 0L)
list.append(eventData);
}
for (int index = 0; index < arrayListCount(msgList->list); index++){
msgData = ::arrayListGet(msgList->list, index);
eventData = createEventData(msgList->type, msgData);
if (eventData != 0L)
list.append(eventData);
}
::arrayListFree(msgList->list);
msgList->list = 0L;
itemType = msgList->type;
}else{
eventData = createEventData(type, data);
if (eventData != 0L)
list.append(eventData);
itemType = type;
}
beenCreated = true;
/* remove any knowledge of orginal data */
this->data = 0L;
}
XsldbgEvent::~XsldbgEvent()
{
}
XsldbgEventData *XsldbgEvent::createEventData(XsldbgMessageEnum type, const void *msgData)
{
XsldbgEventData *result = new XsldbgEventData();
if (result == 0L)
return result;
switch (type){
case XSLDBG_MSG_THREAD_NOTUSED: /* 0: Thread are not to be used */
case XSLDBG_MSG_THREAD_INIT: /* 1: The xsldbg thread is initializing */
case XSLDBG_MSG_THREAD_RUN: /* 2: The xsldbg thread is running */
case XSLDBG_MSG_THREAD_STOP: /* 3: The xsldbg thread is about to die */
case XSLDBG_MSG_THREAD_DEAD: /* 4: The xsldbg thread died */
/* we don't need to do anything extra with this message */
break;
/* input status ( once thread is running) */
case XSLDBG_MSG_AWAITING_INPUT: /* 5: Waiting for user input */
/* we don't need to do anything extra with this message */
break;
case XSLDBG_MSG_READ_INPUT: /* 6: Read user input */
/* we don't need to do anything extra with this message */
break;
case XSLDBG_MSG_PROCESSING_INPUT: /* 7: Processing user's request */
/* we don't need to do anything extra with this message */
break;
/* provide more informatiom about state of xsldbg (optional) */
case XSLDBG_MSG_PROCESSING_RESULT: /* 8: An error occured performing command
* requested command */
if (msgData != 0L){
xsldbgErrorMsgPtr msg = (xsldbgErrorMsgPtr)msgData;
if (msg->text)
result->setText(0, XsldbgDebuggerBase::fromUTF8(msg->text));
}
break;
case XSLDBG_MSG_LINE_CHANGED: /* 9: Changed to new line number
* ie a step */
handleLineNoChanged(result, msgData);
break;
case XSLDBG_MSG_FILE_CHANGED: /* 10: Changed selection for source/data/output file */
// not used
break;
case XSLDBG_MSG_BREAKPOINT_CHANGED: /* 11: Response to a showbreak command */
handleBreakpointItem(result, msgData);
break;
case XSLDBG_MSG_PARAMETER_CHANGED: /* 12: Response to showparam command */
handleParameterItem(result, msgData);
break;
case XSLDBG_MSG_TEXTOUT: /* 13 : Free form text from xsldg */
/* this is going to be most common and its so simple we can handle
it here */
result->setText(0, XsldbgDebuggerBase::fromUTF8((xmlChar*)msgData));
break;
case XSLDBG_MSG_FILEOUT: /* 14 : Response to cat commmand, ie
* Free form text in file */
/* this is actualy the file to load */
{
KURL url(XsldbgDebuggerBase::fromUTF8FileName((xmlChar*)msgData));
if (!url.isLocalFile()){
qDebug("Remote path to temp file %s unsupported, unable to read message from xsldbg", url.prettyURL().local8Bit().data());
break;
}
TQString fileName = url.path();
TQString outputText;
if (!fileName.isNull()){
TQFile file (fileName);
if (file.open(IO_ReadOnly)){
TQTextStream textFile(&file);
TQString textIn = "";
textFile.setEncoding(TQTextStream::UnicodeUTF8);
while (1){
textIn = textFile.readLine();
if (textIn.isNull())
break;
outputText.append(textIn).append("\n");
}
file.close();
}
outputText.append("\n");
result->setText(0, outputText);
}
}
break;
case XSLDBG_MSG_LOCALVAR_CHANGED: /* 15 : Response to locals command ie a
* local variable */
handleLocalVariableItem(result, msgData);
break;
case XSLDBG_MSG_GLOBALVAR_CHANGED: /* 16 : Response to globals command
* ie a global variable */
handleGlobalVariableItem(result, msgData);
break;
case XSLDBG_MSG_TEMPLATE_CHANGED: /* 17 : Response to templates commmand
* ie template details */
handleTemplateItem(result, msgData);
break;
case XSLDBG_MSG_SOURCE_CHANGED: /* 18 : Response to stylesheets command,
* a normal stylesheet */
handleSourceItem(result, msgData);
break;
case XSLDBG_MSG_INCLUDED_SOURCE_CHANGED: /* 19: Response to stylesheets
* command, a xmlNodeptr of
* a included stylesheet */
handleIncludedSourceItem(result, msgData);
break;
case XSLDBG_MSG_CALLSTACK_CHANGED: /* 20: Response to where command,
* ie a item on the call stack */
handleCallStackItem(result, msgData);
break;
case XSLDBG_MSG_ENTITIY_CHANGED: /* 21: Response to entities
* command */
handleEntityItem(result, msgData);
break;
case XSLDBG_MSG_RESOLVE_CHANGE: /* 22: Response to system or
* public command */
handleResolveItem(result, msgData);
break;
default:
qDebug("Unhandled type in createEventData %d", type);
}
return result;
}
void XsldbgEvent::emitMessage(XsldbgDebuggerBase *debugger)
{
XsldbgEventData *eventData;
this->debugger = debugger;
for (eventData = list.first(); eventData != 0L; eventData = list.next()){
emitMessage(eventData);
}
/* make sure that we only temporarily set the value for debugger*/
this->debugger = 0L;
}
void XsldbgEvent::emitMessage(XsldbgEventData *eventData)
{
if ((eventData == 0L) || (debugger == 0L)){
qDebug("emitMessage failed");
if (eventData == 0L)
qDebug("Event data == NULL");
if (debugger == 0L)
qDebug("Debugger == NULL");
return;
}
/*
Method use will end up like
emit debugger->lineNoChanged("", 1, false);
*/
switch (itemType){
case XSLDBG_MSG_THREAD_NOTUSED: /* 0: Thread are not to be used */
case XSLDBG_MSG_THREAD_INIT: /* 1: The xsldbg thread is initializing */
case XSLDBG_MSG_THREAD_RUN: /* 2: The xsldbg thread is running */
/* we don't need to do anything extra with this message */
break;
case XSLDBG_MSG_THREAD_STOP: /* 3: The xsldbg thread is about to die */
case XSLDBG_MSG_THREAD_DEAD: /* 4: The xsldbg thread died */
/* the debugger has stopped is about to stop */
debugger->setInitialized(false);
break;
/* input status ( once thread is running) */
case XSLDBG_MSG_AWAITING_INPUT: /* 5: Waiting for user input */
if ((getInputReady() == 0) && (debugger->commandQueue().count() > 0)){
qDebug("Command queue not empty");
TQTimerEvent *e = new TQTimerEvent(debugger->getUpdateTimerID());
TQApplication::postEvent(debugger, e);
}
if (!updateText.isEmpty()){
debugger->queueMessage(updateText);
updateText = "";
}
break;
case XSLDBG_MSG_READ_INPUT: /* 6: Read user input */
/* we don't need to do anything extra with this message */
break;
case XSLDBG_MSG_PROCESSING_INPUT: /* 7: Processing user's request */
/* we don't need to do anything extra with this message */
break;
/* provide more informatiom about state of xsldbg (optional) */
case XSLDBG_MSG_PROCESSING_RESULT: /* 8: An error occured performing command
* requested command */
if (!eventData->getText(0).isNull())
updateText.append(eventData->getText(0));
break;
case XSLDBG_MSG_LINE_CHANGED: /* 9: Changed to new line number
* ie a step */
handleLineNoChanged(eventData, 0L);
break;
case XSLDBG_MSG_FILE_CHANGED: /* 10: Loaded source/data file */
if (beenCreated == false){
/* Empty data */
}else{
emit debugger->fileDetailsChanged();
}
break;
case XSLDBG_MSG_BREAKPOINT_CHANGED: /* 11: Response to a showbreak command */
handleBreakpointItem(eventData, 0L);
break;
case XSLDBG_MSG_PARAMETER_CHANGED: /* 12: Response to showparam command */
handleParameterItem(eventData, 0L);
break;
case XSLDBG_MSG_TEXTOUT: /* 13 : Free form text from xsldg */
/* this is going to be most common and its so simple we can handle
it here */
/*
emit debugger->showMessage(eventData->getText(0));
*/
if (!eventData->getText(0).isNull())
updateText.append(eventData->getText(0));
break;
case XSLDBG_MSG_FILEOUT: /* 14 : Response to cat commmand */
if (!eventData->getText(0).isNull())
updateText.append(eventData->getText(0));
break;
case XSLDBG_MSG_LOCALVAR_CHANGED: /* 15 : Response to locals command ie a
* local variable */
handleLocalVariableItem(eventData, 0L);
break;
case XSLDBG_MSG_GLOBALVAR_CHANGED: /* 16 : Response to globals command
* ie a global variable */
handleGlobalVariableItem(eventData, 0L);
break;
case XSLDBG_MSG_TEMPLATE_CHANGED: /* 17 : Response to templates commmand
* ie template details */
handleTemplateItem(eventData, 0L);
break;
case XSLDBG_MSG_SOURCE_CHANGED: /* 18 : Response to stylesheets command,
* a normal stylesheet */
handleSourceItem(eventData, 0L);
break;
case XSLDBG_MSG_INCLUDED_SOURCE_CHANGED: /* 19: Response to stylesheets
* command, a xmlNodeptr of
* a included stylesheet */
handleIncludedSourceItem(eventData, 0L);
break;
case XSLDBG_MSG_CALLSTACK_CHANGED: /* 20: Response to where command,
* ie a item on the call stack */
handleCallStackItem(eventData, 0L);
break;
case XSLDBG_MSG_ENTITIY_CHANGED: /* 21: Response to entities
* command */
handleEntityItem(eventData, 0L);
break;
case XSLDBG_MSG_RESOLVE_CHANGE: /* 22: Response to system or
* public command */
handleResolveItem(eventData, 0L);
break;
default:
qDebug("Unhandled type in emitMessage %d", itemType);
}
}
void XsldbgEvent::handleLineNoChanged(XsldbgEventData *eventData, const void *msgData)
{
if (eventData != 0L){
if (beenCreated == false){
/* add our specific data to eventData*/
if (xsldbgUrl() != 0L){
eventData->setText(0, XsldbgDebuggerBase::fromUTF8FileName(xsldbgUrl()));
eventData->setInt(0, xsldbgLineNo());
eventData->setInt(1, msgData != 0L);
}
}else{
/* emit the event data via debugger*/
emit debugger->lineNoChanged(eventData->getText(0), eventData->getInt(0),
eventData->getInt(1));
}
}
}
void XsldbgEvent::handleShowMessage(XsldbgEventData *eventData, const void *msgData)
{
if (eventData != 0L){
if (beenCreated == false){
/* add our specific data to eventData*/
if (msgData != 0L){
eventData->setText(0, XsldbgDebuggerBase::fromUTF8((xmlChar*)msgData));
}
}else{
/* emit the event data via debugger*/
emit debugger->showMessage(eventData->getText(0));
}
}
}
void XsldbgEvent::handleBreakpointItem(XsldbgEventData *eventData, const void *msgData)
{
if (eventData != 0L){
if (beenCreated == false){
/* add our specific data to eventData*/
if (msgData != 0L){
breakPointPtr breakItem = (breakPointPtr)msgData;
/* set the file name*/
eventData->setText(0, XsldbgDebuggerBase::fromUTF8FileName(breakItem->url));
/* line number*/
eventData->setInt(0, (int)breakItem->lineNo);
/* templateName */
eventData->setText(1, XsldbgDebuggerBase::fromUTF8(breakItem->templateName));
/* modeName */
eventData->setText(2, XsldbgDebuggerBase::fromUTF8(breakItem->modeName));
/* enabled state */
eventData->setInt(1, (int)(breakItem->flags & BREAKPOINT_ENABLED));
/* id value */
eventData->setInt(2, (int)breakItem->id);
}
}else{
/* emit the event data via debugger*/
emit debugger->breakpointItem(eventData->getText(0), /* file name*/
eventData->getInt(0), /* line number*/
eventData->getText(1), /* template name */
eventData->getText(2), /* mode name */
eventData->getInt(1), /* enabled state*/
eventData->getInt(2) /* id*/);
}
}
}
void XsldbgEvent::handleGlobalVariableItem(XsldbgEventData *eventData, const void *msgData)
{
if (eventData != 0L){
if (beenCreated == false){
/* add our specific data to eventData*/
if (msgData != 0L){
xsltStackElemPtr item = (xsltStackElemPtr)msgData;
TQString name, fileName, selectXPath;
int lineNumber = -1;
/* variable name*/
if (item->nameURI)
name = (XsldbgDebuggerBase::fromUTF8FileName(item->nameURI)).append(":");
name.append(XsldbgDebuggerBase::fromUTF8(item->name));
if (item->computed && item->comp && item->comp->inst && item->comp->inst->doc){
fileName = XsldbgDebuggerBase::fromUTF8FileName(item->comp->inst->doc->URL);
lineNumber= xmlGetLineNo(item->comp->inst);
}
if (item->select)
selectXPath = XsldbgDebuggerBase::fromUTF8(item->select);
eventData->setText(0, name);
eventData->setText(1, "");
eventData->setText(2, fileName);
eventData->setText(3, selectXPath);
eventData->setInt(0, lineNumber);
eventData->setInt(1, 0);
}
}else{
/* emit the event data via debugger*/
emit debugger->variableItem(eventData->getText(0), /* variable name*/
eventData->getText(1), /* templatecontext*/
eventData->getText(2), /* file name */
eventData->getInt(0), /* line number */
eventData->getText(3), /* select XPath */
eventData->getInt(1) /* Is this a local variable */ );
}
}
}
void XsldbgEvent::handleLocalVariableItem(XsldbgEventData *eventData, const void *msgData)
{
if (eventData != 0L){
if (beenCreated == false){
/* add our specific data to eventData*/
if (msgData != 0L){
xsltStackElemPtr item = (xsltStackElemPtr)msgData;
TQString name, templateContext, fileName, selectXPath;
int lineNumber = -1;
xmlNodePtr varXmlNode;
/* variable name */
if (item->nameURI)
name = (XsldbgDebuggerBase::fromUTF8FileName(item->nameURI)).append(":");
name.append(XsldbgDebuggerBase::fromUTF8(item->name));
if (item->computed && item->comp && item->comp->inst){
varXmlNode = item->comp->inst;
/* try to find out what template this variable belongs to */
if (varXmlNode->parent && IS_XSLT_NAME(varXmlNode->parent, "template")) {
xmlChar* value = xmlGetProp(varXmlNode->parent, (xmlChar *) "name");
if (value) {
templateContext = XsldbgDebuggerBase::fromUTF8(value);
xmlFree(value);
}else{
value = xmlGetProp(varXmlNode->parent, (xmlChar *) "match");
if (value) {
templateContext = XsldbgDebuggerBase::fromUTF8(value);
xmlFree(value);
}
}
}
if (varXmlNode->doc) {
fileName = XsldbgDebuggerBase::fromUTF8FileName(varXmlNode->doc->URL);
lineNumber = xmlGetLineNo(varXmlNode);
}
if (item->select)
selectXPath = XsldbgDebuggerBase::fromUTF8(item->select);
eventData->setText(0, name);
eventData->setText(1, templateContext);
eventData->setText(2, fileName);
eventData->setText(3, selectXPath);
eventData->setInt(0, lineNumber);
eventData->setInt(1, 1);
}
}
}else{
/* emit the event data via debugger*/
emit debugger->variableItem(eventData->getText(0), /* variable name*/
eventData->getText(1), /* templatecontext*/
eventData->getText(2), /* file name */
eventData->getInt(0), /* line number */
eventData->getText(3), /* select XPath */
eventData->getInt(1) /* Is this a local variable */ );
}
}
}
void XsldbgEvent::handleTemplateItem(XsldbgEventData *eventData, const void *msgData)
{
if (eventData != 0L){
if (beenCreated == false){
/* add our specific data to eventData*/
if(msgData != 0L){
xsltTemplatePtr item = (xsltTemplatePtr)msgData;
TQString name, mode, fileName;
int lineNumber = -1;
if (item->nameURI)
name.append(XsldbgDebuggerBase::fromUTF8FileName(item->nameURI)).append(":");
if (item->name)
name.append(XsldbgDebuggerBase::fromUTF8(item->name));
else if (item->match)
name.append(XsldbgDebuggerBase::fromUTF8(item->match));
mode = XsldbgDebuggerBase::fromUTF8(item->mode);
if (item->elem && item->elem->doc){
fileName = XsldbgDebuggerBase::fromUTF8FileName(item->elem->doc->URL);
lineNumber = xmlGetLineNo(item->elem);
}
eventData->setText(0, name);
eventData->setText(1, mode);
eventData->setText(2, fileName);
eventData->setInt(0, lineNumber);
}
}else{
/* emit the event data via debugger*/
emit debugger->templateItem(eventData->getText(0), /* tempalte name*/
eventData->getText(1), /* mode*/
eventData->getText(2), /* file name*/
eventData->getInt(0) /* line number*/);
}
}
}
void XsldbgEvent::handleIncludedSourceItem(XsldbgEventData *eventData, const void *msgData)
{
if (eventData != 0L){
if (beenCreated == false){
/* add our specific data to eventData*/
if (msgData != 0L){
xmlNodePtr item = (xmlNodePtr)msgData;
TQString name, fileName;
int lineNumber = -1;
if (item->doc)
name = XsldbgDebuggerBase::fromUTF8FileName(item->doc->URL);
if (item->parent && item->parent->doc){
fileName = XsldbgDebuggerBase::fromUTF8FileName(item->parent->doc->URL);
lineNumber = xmlGetLineNo((xmlNodePtr)item->parent->doc);
}
eventData->setText(0, name);
eventData->setText(1, fileName);
eventData->setInt(0, lineNumber);
}
}else{
/* emit the event data via debugger*/
emit debugger->sourceItem(eventData->getText(0), /* file name*/
eventData->getText(1), /* parent file name*/
eventData->getInt(0) /* parent line number*/);
}
}
}
void XsldbgEvent::handleSourceItem(XsldbgEventData *eventData, const void *msgData)
{
if (eventData != 0L){
if (beenCreated == false){
/* add our specific data to eventData*/
if (msgData != 0L){
xsltStylesheetPtr item = (xsltStylesheetPtr)msgData;
TQString name, fileName;
int lineNumber = -1;
if (item->doc)
name = XsldbgDebuggerBase::fromUTF8FileName(item->doc->URL);
if (item->parent && item->parent->doc){
fileName = XsldbgDebuggerBase::fromUTF8FileName(item->parent->doc->URL);
lineNumber = xmlGetLineNo((xmlNodePtr)item->parent->doc);
}
eventData->setText(0, name);
eventData->setText(1, fileName);
eventData->setInt(0, lineNumber);
}
}else{
/* emit the event data via debugger*/
emit debugger->sourceItem(eventData->getText(0), /* name*/
eventData->getText(1), /* parent file name*/
eventData->getInt(0) /* parent line number*/);
}
}
}
void XsldbgEvent::handleParameterItem(XsldbgEventData *eventData, const void *msgData)
{
if (eventData != 0L){
if (beenCreated == false){
/* add our specific data to eventData*/
if (msgData != 0L){
parameterItemPtr paramItem = (parameterItemPtr)msgData;
TQString name, value;
name = XsldbgDebuggerBase::fromUTF8(paramItem->name);
value = XsldbgDebuggerBase::fromUTF8(paramItem->value);
eventData->setText(0, name);
eventData->setText(1, value);
}
}else{
/* emit the event data via debugger*/
emit debugger->parameterItem(eventData->getText(0), /* param name*/
eventData->getText(1) /* param value*/);
}
}
}
void XsldbgEvent::handleCallStackItem(XsldbgEventData *eventData, const void *msgData)
{
if (eventData != 0L){
if (beenCreated == false){
/* add our specific data to eventData*/
if (msgData != 0L){
callPointPtr item = (callPointPtr)msgData;
TQString templateName, fileName;
int lineNumber = -1;
/* template name */
if (item->info){
templateName = XsldbgDebuggerBase::fromUTF8(item->info->templateName);
fileName = XsldbgDebuggerBase::fromUTF8FileName(item->info->url);
lineNumber = item->lineNo;
}
eventData->setText(0, templateName);
eventData->setText(1, fileName);
eventData->setInt(0, lineNumber);
}
}else{
/* emit the event data via debugger*/
emit debugger->callStackItem(eventData->getText(0), /* template name*/
eventData->getText(1), /* fileName */
eventData->getInt(0) /* line number*/);
}
}
}
void XsldbgEvent::handleEntityItem(XsldbgEventData *eventData, const void *msgData)
{
if (eventData != 0L){
if (beenCreated == false){
/* add our specific data to eventData*/
if (msgData != 0L){
TQString SystemID, PublicID;
entityInfoPtr info = (entityInfoPtr)msgData;
SystemID = XsldbgDebuggerBase::fromUTF8FileName(info->SystemID);
PublicID = XsldbgDebuggerBase::fromUTF8(info->PublicID);
eventData->setText(0, SystemID);
eventData->setText(1, PublicID);
}
}else{
/* emit the event data via debugger*/
emit debugger->entityItem(eventData->getText(0), /* SystemID*/
eventData->getText(1) /* PublicID*/);
}
}
}
void XsldbgEvent::handleResolveItem(XsldbgEventData *eventData, const void *msgData)
{
if (eventData != 0L){
if (beenCreated == false){
/* add our specific data to eventData*/
if (msgData != 0L){
TQString URI = XsldbgDebuggerBase::fromUTF8FileName((const xmlChar*)msgData);
eventData->setText(0, URI);
}
}else{
/* emit the event data via debugger*/
emit debugger->resolveItem(eventData->getText(0) /* URI */);
}
}
}
void XsldbgEvent::handleIntOptionItem(XsldbgEventData *eventData, const void *msgData)
{
if (eventData != 0L){
if (beenCreated == false){
/* add our specific data to eventData*/
if (msgData != 0L){
parameterItemPtr paramItem = (parameterItemPtr)msgData;
eventData->setText(0, XsldbgDebuggerBase::fromUTF8(paramItem->name));
eventData->setInt(0, paramItem->intValue);
}
}else{
/* emit the event data via debugger*/
emit debugger->intOptionItem(eventData->getText(0), /* option name*/
eventData->getInt(0) /* value*/);
}
}
}
void XsldbgEvent::handleStringOptionItem(XsldbgEventData *eventData, const void *msgData)
{
if (eventData != 0L){
if (beenCreated == false){
/* add our specific data to eventData*/
if (msgData != 0L){
parameterItemPtr paramItem = (parameterItemPtr)msgData;
eventData->setText(0, XsldbgDebuggerBase::fromUTF8(paramItem->name));
eventData->setText(1, XsldbgDebuggerBase::fromUTF8(paramItem->value));
}
}else{
/* emit the event data via debugger*/
emit debugger->stringOptionItem(eventData->getText(0), /* option name*/
eventData->getText(1) /* value*/);
}
}
}
void XsldbgEventDataList::deleteItem( TQPtrCollection::Item d )
{
if ( del_item ) delete (XsldbgEventData *)d;
}
|